How SafeOS watches a room in your browser
SafeOS turns the camera and microphone of a phone, tablet or laptop into alerts, and the browser on that device does the watching: it compares frames, reads the sound level and, on the People and Wildlife pages, runs an object-detection model. A server is your own choice: run one, and the Motion and sound page sends it frames.
SafeOS adds an alert. It does not replace a person nearby. A phone or a browser can sleep, lose power or drop the camera, so stay within reach.
- The camera and the microphone of the device that watches.
- Three ways of watching, on the device:
- Motion and sound: motion, picture change, sound level and stillness, with no model.
- Lost and Found, on the Motion and sound page: colours and coarse shape, with no model.
- People and Wildlife: the gate, then the COCO-SSD model.
- The alert on the device: a sound, a notification if the browser allows it, a History entry and the kept picture.
- Kept in this browser: IndexedDB, localStorage and Cache Storage.
Only if you run a server and save its address, in a mode that uses it: frames from the Motion and sound page go to that server.
The object-detection model in your browser
People and Wildlife run one pretrained object-detection model, COCO-SSD (SSDLite on MobileNetV2), through TensorFlow.js in the page. It downloads only after you agree to 18.6 MB from Google’s storage, and it runs only when part of the picture changes enough.
To point the Wildlife page at a feeder or a path, read how to set up an old phone as a backyard wildlife camera.
- The camera’s video.
- A 320 by 240 canvas, every 500 ms on People and every 1 s on Wildlife.
- The gate: does any one of the 8 by 6 cells change by 15 or more? If not, the model does not run, and the page waits for the next check.
- COCO-SSD: the graph resizes the canvas to 300 by 300 and runs on WebGL where the browser allows it, otherwise on the processor.
- Boxes, each with a class name and a score of 0.5 or more.
- People: more people than the allowed number raises the alert. Wildlife: one of the 10 animal classes is kept as a sighting. While a People alert is on, the model also runs every 5 seconds, whatever moved.
The file and where it comes from
Both pages load the model through one loader, detection-model.ts, and share it once it is loaded. The Motion and sound page and Lost and Found load no model. The download is a manifest of 527,315 bytes and weight files of 18,034,528 bytes, together 18.6 MB (detection-model-facts.ts).
The file is TensorFlow’s own TF.js conversion of the ssdlite_mobilenet_v2_coco checkpoint, published by TensorFlow under the Apache License 2.0 (TensorFlow’s listing), and loaded through the @tensorflow-models/coco-ssd package, which calls itself “a TensorFlow.js port of the COCO-SSD model” (its README). Its graph holds about 4.5 million 32-bit weights in 641 nodes, and resizes whatever it is given to 300 by 300 pixels before it looks. It knows 80 classes; SafeOS keeps person and 10 animals: dog, cat, bird, horse, sheep, cow, elephant, bear, zebra and giraffe (animal-kinds.ts).
A download after a yes, kept on the device
Nothing downloads until setup is done and you press the download key; the yes is kept in localStorage, so the next visit does not ask again (detection-model.ts). Each file is written to the Cache Storage cache safeos-detection-model-v1 before it is used, where the browser lets it store files (detection-model.ts), and the page says the model is on this device only when every weight file the manifest lists is there (model-on-device.ts). An app update keeps the model, because the service worker deletes only its own build caches (sw.js); Clear all data on this device deletes it with the rest (local-data.ts).
The graphics chip, or the processor
The loader asks for TensorFlow’s WebGL backend, which runs the model on the graphics chip where the browser allows it and on the processor where it does not, with no message on the page (detection-model.ts). TensorFlow.js answers false when a backend will not start and then readies the next by priority, WebGL first and the processor second (tfjs-core 4.22.0), and its WebGL backend refuses a context the browser marks as slow, such as software rendering (failIfMajorPerformanceCaveat). TensorFlow’s guide calls the WebGL backend “up to 100x faster than the vanilla CPU backend” (TensorFlow, CC BY 4.0). On CI’s Measure run of 27 November 2026, WebGL would not start, so the model ran on the processor: one run took about 1.7 s at the processor’s own speed and about 10.8 s slowed six times (the run). On one server computer with no graphics card, its processor slowed to stand in for a phone. No real phone was measured.
The gate before the model
Each check draws the video into a 320 by 240 canvas, whatever size the camera gives (person-detection.ts). The canvas is cut into 8 by 6 cells of 40 by 40 pixels. A cell’s change is the mean of the absolute red, green and blue differences from the last check, on a scale of 0 to 100, and the model runs when the largest cell reaches 15 (subject-motion-gate.ts, person-detection.ts). So People finds people, and Wildlife 10 kinds of animal, only after a part of the picture changes that much: something small or far away changes a cell less and does not start the model. While a People alert is on, the model also runs every five seconds, whatever moved (page.tsx).
The arithmetic, as an example: a cell whose pixels change by 80 of 255 levels in each colour over half its area reads 15.7 and opens the gate; over a third of its area it reads 10.5 and stays shut. Both pages start the line at 15. Wildlife lets you move it from 5 to 50 with Movement to start the check (page.tsx); People shows no control for it and keeps 15 (security-store.ts). People checks every 500 ms by default, and never more often than every 250 ms (page.tsx); Wildlife checks every 1 s (page.tsx).
What comes out
The model returns boxes, each with a class name and a score, at most 10 a check. The package keeps one box where several overlap, by a single suppression for all classes (coco-ssd 2.2.3), and SafeOS keeps boxes that score 0.5 or more (person-detection.ts). Wildlife’s Alert line moves that score line from 10 to 90 hundredths (page.tsx). People counts the shapes the model calls a person and raises the alert when there are more than the number you allow. It does not know who anyone is: what it keeps is a count and the boxes. Everything runs on the page’s main thread; the app starts no worker.
Read more: Object detection in the browser: COCO-SSD on TensorFlow.js
Also: How SafeOS Guardian checks for motion before it runs a model. Code: detection-model.ts, subject-motion-gate.ts, person-detection.ts, animal-detection.ts. The document: docs/MODELS-AND-OFFLINE.md.
Limits
Nothing measures how often People, Wildlife or Lost and Found is right or wrong.
TensorFlow publishes a score for the original network in its model table; that table measures another program at another size, not SafeOS, so this page prints no figure from it. Something small or far away can change less than one cell’s line. A change of light counts as change. The timings above come from a server with its processor slowed; no phone was measured.
How the motion and sound checks work
The Motion and sound page compares camera frames 5 times a second and reads the microphone’s level 10 times a second, with arithmetic and no model. An alert starts when a reading stays over the line you set.
Three uses run on these checks alone: an old phone as a nap monitor, an old phone as a pet camera while you are out and an old phone as a camera for an elderly parent.
- Grey is (R + G + B) / 3, read at one pixel in 4 each way.
- A sample counts when the two greys differ by more than 30.
- The share of samples that changed is compared with the line: 20 per cent by default.
- Over the line, a box is drawn round the cells that changed.
Motion
The camera is asked for 1280 by 720 (camera-constraints.ts). Every 200 ms the page draws the video into a canvas of the video’s own size and reads its pixels (CameraFeed.tsx). The motion check reads one pixel in 4 along each axis, one in 16 in all, takes each one’s grey as (R + G + B) / 3, and counts a sample when the two greys differ by more than 30. Its reading is the share of the samples that changed (motion-detection.ts), or the busiest zone’s share where you drew zones.
The line is 100 minus the sensitivity (page.tsx). The default setting, Maximum Alert, has a motion sensitivity of 80, so its line is 20 per cent of the samples, between frames 200 ms apart (settings-store.ts). A 16 by 12 grid places the box round the cells that changed (motion-detection.ts).
Picture change
Picture change is a second check on the same frames, over every pixel by default. It weighs each pixel’s change in red, green and blue as 0.299 R + 0.587 G + 0.114 B, the weights of brightness, and counts a pixel whose weighted change is more than (100 minus the sensitivity) × 2.55 levels: 51 under Maximum Alert (pixel-detection.ts, pixel-detection.ts, page.tsx). It says yes when 1 per cent of the picture has changed, and an 8 by 8 grid marks where. It reads its store of frames before it adds the new one, so it compares the new frame with the frame two back, 400 ms earlier (pixel-detection.ts, pixel-detection.ts). A picture-change alert is medium, high or critical at 2, 5 and 10 times its line (page.tsx).
Sound
The microphone feeds a Web Audio AnalyserNode with an fftSize of 256, which gives 128 frequency bins; every 100 ms the page reads them (CameraFeed.tsx, CameraFeed.tsx). A pitch range you choose reads 2048 instead, for finer bins (audio-levels.ts). The level is the root mean square of the bins’ byte values, over 255 (audio-levels.ts). Those bytes are decibels the browser clips between its minDecibels and maxDecibels and scales to 0 to 255 (the Web Audio specification), −100 and −30 dB by default, smoothed at 0.8, defaults SafeOS leaves as they are (MDN). So the number is the level the browser reads, and a different microphone reads the same room differently. The page keeps no recording of the microphone: it reads a level, and a server you connect receives that level as a number beside the frame (page.tsx). Before the first watch on a device, the notice about alert pictures says: “Ask before you watch or listen to another adult or the people you live with. Laws on recording sound differ by place” (PicturesNotice.tsx, words.ts).
- Readings go over the line.
- They stay over it for the sustained window. If they drop under it first, nothing starts.
- The first alert.
- Repeats, each after the longer of the severity’s cooldown and the Cooldown Period; a rise in severity waits only for its own cooldown.
- Unacknowledged, it climbs to levels 2 to 5 at 30 s, 90 s, 210 s and 390 s.
- Readings stay under the line for the window, and the event ends.
From a reading to an alert
A reading must stay over the line for a set window before an alert starts, and a repeat waits for the longer of the severity’s cooldown and your Cooldown Period, while a rise to a higher severity waits only for that severity’s cooldown (alert-event.ts). Severity is how far over the line the reading is: 10, 25 and 40 points give medium, high and critical (page.tsx). An alert nobody acknowledges climbs 5 levels, 30, 60, 120 and 180 seconds apart, so they start at 0, 30, 90, 210 and 390 seconds (settings-store.ts, AlertPanel.tsx). Stillness is off until you turn it on; you set its minutes from 1 to 60, and the page checks it every 15 s (stillness-bounds.ts, page.tsx).
Each motion, picture change and sound alert keeps a picture, up to 640 px on the long edge at JPEG quality 0.7, and where it has a box a close-up of up to 480 px at 0.8; a stillness alert keeps none. A picture is marked dark when its mean brightness is under 26 of 255 (rules.ts, capture.ts, page.tsx). Pictures are kept 3 days unless you choose 1, 7 or 30 days, or to keep them until you delete them. The alert sounds are tones the browser makes with an oscillator, so they need no sound file (sound-manager.ts).
Read more: Webcam motion detection in JavaScript, plus sound levels
Code: CameraFeed.tsx, motion-detection.ts, pixel-detection.ts, audio-levels.ts, alert-event.ts. The document: docs/MONITORING.md.
Limits
Light, a camera’s exposure and a moving background count as change. The sound number is not a decibel reading. A hidden tab’s timers run slower, which the offline section covers.
How Lost and Found compares a pet’s photos
Lost and Found turns each photo of your pet into a summary: its colours, an 8 by 8 grid of edges and a size share. The site calls this summary a visual fingerprint: a summary of colours, an edge grid and a size, not a mark that identifies one animal. The browser compares parts of the camera’s picture with it, up to twice a second, with no model, and a part that comes close enough raises a possible sighting for you to check.
At home, watch the door for a lost cat or dog with an old phone.
- A pet’s photo, read at up to 256 by 256 pixels.
- Four parts:
- Colours: 32 of up to 64 buckets
- 5 main colours
- An 8 by 8 edge grid
- The size share, from the corners
- The parts of every photo of the pet merge into one summary.
One photo becomes a summary
You add 1 to 5 photos, each under 10 MB; the browser keeps each at up to 768 px at JPEG quality 0.9 (pet-photo-limits.ts, LostFoundSetup.tsx). A photo is read at up to 256 by 256 pixels (visual-fingerprint.ts, visual-fingerprint.ts), then:
- Colours: each of red, green and blue is cut into 4 levels, so there are up to 64 buckets, and the 32 largest are kept with their shares (
visual-fingerprint.ts,visual-fingerprint.ts). - Main colours: 5, by k-means over one pixel in four, from a fixed start, for 10 rounds, so the same photo always gives the same colours (
visual-fingerprint.ts). - Edges: an 8 by 8 grid. Each cell averages, over every second pixel each way, the length of two steps, to the pixel on the right and to the pixel below, each summed over red, green and blue. It is a plain difference between neighbours, with no smoothing (
visual-fingerprint.ts). - Size: the share of the photo that is unlike its four corners, pixels more than 50 away from the corners’ colour. A busy background counts as subject (
visual-fingerprint.ts).
The summaries of every photo of the pet merge into one (visual-fingerprint.ts).
- The camera’s picture, every 500 ms, or 900 ms in Lost and Found’s hybrid setting.
- The quick check of the whole picture. Under 25: stop until the next picture.
- 8 by 8 cells give 49 overlapping regions of 2 by 2 cells.
- Only regions that touch a cell that moved go on.
- Each region’s score: 0.4 colours + 0.35 main colours + 0.15 edges + 0.1 size.
- The best region at 70 or more raises a possible sighting: the picture beside the pet’s photo, for you to check.
Comparing a camera picture
The Motion and sound page compares the camera’s picture every 500 ms, or 900 ms in Lost and Found’s hybrid setting, one comparison at a time (page.tsx). A quick check of the whole picture comes first: its average colour counts 0.4 and the closest of its three main colours 0.6, and under 25, half the save line, the comparison stops there (subject-matcher.ts, visual-fingerprint.ts). Then an 8 by 8 grid gives 49 overlapping regions of 2 by 2 cells, and only the regions touching a cell that changed by more than 10 levels since the last picture are scored; on the first picture, all of them are (subject-matcher.ts, subject-matcher.ts). Adaptive lighting first moves a brighter or darker frame back toward the scene’s settled brightness, by at most 64 levels (subject-matcher.ts).
Each region is scored against the pet’s summary: colours 0.4, main colours 0.35, edges 0.15 and size 0.1 (visual-fingerprint.ts). The best region at 70 or more raises a possible sighting. 50 is the lowest score a region can show, and no frame is saved at it: the code that would save one has no caller (subject-matcher.ts, subject-matcher.ts). A colour sensitivity of 50 leaves the score as it is, a lower one raises it and a higher one lowers near scores (subject-matcher.ts). The score is a line on a scale, not a likelihood. A possible sighting is a History entry with your pet’s name and the camera’s picture of the moment, and the gallery shows the kept sightings (page.tsx, client-db.ts).
Read more: Image similarity by colour histogram, k-means and edges
Code: visual-fingerprint.ts, subject-matcher.ts, lost-found-words.ts.
Limits
Another animal, or a cushion or a bag in similar colours, can raise a possible sighting. The background in a photo counts. Lost and Found is for pets only. Nothing measures how often it is right. Up to twice a second holds on a fast device: on the Measure run, Lost and Found compared 2 pictures a second at the processor’s own speed and 0.63 a second slowed six times (the run). On one server computer with no graphics card, its processor slowed to stand in for a phone. No real phone was measured.
What works offline, and where things are kept
safeos.sh is a set of static files, and a service worker stores its pages, scripts, styles and everyday images on your first visit. After that the pages, the motion and sound checks and Lost and Found open with no connection, and People and Wildlife do once their model is saved. What the app keeps stays in this browser’s storage until you clear it or the browser deletes it.
- The build exports every page as a static file.
- One list of the files to keep, with a SHA-256 digest of them all.
- The service worker stores the whole list, or none of it.
- On taking over, it keeps the build that ran last and deletes the older ones.
- With no connection, a page comes from the stored build, or else the offline page.
The build and the service worker
The site is a static export: every page is a file, and GitHub Pages serves them (next.config.js, deploy-pages.yml). After the export, a script lists every file to keep and writes the list, with one SHA-256 digest of all of them, into the first line of the service worker. It leaves out the home page’s recordings and their posters (the worker saves the posters later, on their own), and the capture pictures, the social card, the screenshots and the Lost and Found example (generate-offline-manifest.mjs).
The worker stores the whole list or nothing, then takes over (sw.js): cache.addAll fails when any one file does not answer with a success (MDN). On taking over it keeps the build that ran last, deletes the older ones and takes the open pages (sw.js). It answers from the build’s cache first, finds a page by its path, and with no connection answers a page with /offline.html and any other file with an error (sw.js). Every page registers the worker when it loads (layout.tsx), this one included, so in a browser that runs service workers this visit has started storing the app’s files. Before each deploy, a check in Chromium opens only the home page, goes offline and opens the Wildlife page it never visited (check-offline-start.mjs); it runs no watch, and no phone was tried.
Where things are kept
The app keeps its records in the IndexedDB database safeos-guardian, version 8 (client-db.ts, client-db.ts), in localStorage and in Cache Storage:
| What | Where | How long |
|---|---|---|
| The app’s own files: every page, script, style and font of the build | Cache Storage, one cache for each build | Until the next build takes over; the build before it stays for pages still open |
| The detection model, 18.6 MB, after you agree to it | Cache Storage, safeos-detection-model-v1 | Kept through app updates |
| Alerts and their pictures, Lost and Found’s sightings, People’s pictures | IndexedDB, the database safeos-guardian | Pictures 3 days unless you choose 1, 7 or 30 days or to keep them |
| People’s alerts; your pets and their photos | IndexedDB and localStorage | People keeps 100 alerts; pets until you remove them |
| Your settings, Wildlife’s sightings with their pictures, your yes to the model download | localStorage | Wildlife keeps 100 sightings, their pictures as long as alert pictures; the rest until you change them |
| An alert sound you added | IndexedDB, a database of its own | Until you remove it |
Every row goes with Clear all data on this device on Settings, Data, or when the browser deletes the site’s storage.
Clear all data on this device empties both databases, deletes the caches whose names start with safeos and removes the app’s keys from localStorage (local-data.ts). Tabs agree that one watch runs on a device through a BroadcastChannel named safeos (tab-channel.ts), which carries messages between pages of the same origin inside the browser (MDN).
What leaves the device
Four connections, each with when it happens, who sees what and how to stop it. The privacy page shows the same table from the same component (DeviceConnections.tsx).
| Connection | When | Who sees what | How to stop it |
|---|---|---|---|
| The host’s log | Each time you open a page of safeos.sh. | GitHub, which hosts safeos.sh, logs your IP address and keeps it for security purposes. | Serve your own copy of SafeOS from a host you choose; that host’s own log then applies. |
| The detection model | Only after you agree to it, on People, Wildlife or Settings, Models; again if the browser’s storage is cleared. | Google’s storage (storage.googleapis.com) sees your IP address when the browser downloads the model. | Do not agree to the download. Motion and sound, and Lost & Found, need no model. |
| A spoken alert | Only after you choose an online voice under Spoken alert voice, on Settings, Alert sounds; then each time People, Wildlife or Lost & Found speaks an alert with it. | People, Wildlife and Lost & Found speak their alerts with a voice on this device. An online voice is a service run by the browser’s maker, which receives the words to speak. Alert sounds names each online voice with “(online)”. | Choose Use a voice on this device under Spoken alert voice. To stop spoken alerts as well: on People, turn off Voice Warnings; on Wildlife, choose Sound or Silent under Alert Mode; on Lost & Found, turn off Speak alert message under Image Flash Overlay. |
| A server you connect | Only after you save the address of a server you run, while Processing Mode on Settings, Models is Hybrid or AI queue. Hybrid is the default. | The monitor sends camera frames, with their motion and sound readings, to that server, and whoever runs it can see them. With cloud AI keys set, when Ollama is down or its analysis fails, the server sends the frame to the first of OpenRouter, OpenAI and Anthropic it has a key for and, if that one fails, to the next. | Choose Local instant under Processing Mode on Settings, Models, or clear the server address. |
GitHub’s own words on Pages: “the visitor’s IP address is logged and stored for security purposes” (GitHub Docs). Spoken alerts use a voice on this device unless you chose an online one (tts-alerts.ts); a browser marks each voice as on the device or a remote service (MDN).
Limits
- What a browser keeps for a site is best-effort, and the app does not ask for persistent storage. Safari, with cross-site tracking prevention on, deletes a site’s storage after seven days of browser use with no interaction with the site (MDN).
- Browsers slow the timers of a tab you cannot see; Firefox for Android waits at least 15 minutes in an inactive tab (MDN). Keep the watching page open and in front.
- The app keeps no screen awake: it does not use the Screen Wake Lock API (MDN).
- Notifications come from the open page. The app makes no push subscription, so nothing alerts with the browser closed; the worker’s push handler has nothing that subscribes to it (
sw.js).
Read more: How a PWA works offline: precaching and browser storage
Code: sw.js, generate-offline-manifest.mjs, check-offline-start.mjs, client-db.ts. Documents: docs/LOCAL-DATA.md, docs/MODELS-AND-OFFLINE.md, and the privacy page.
What the optional server adds
You can run the SafeOS server on your own machine with Docker. In the Hybrid and AI queue modes, the Motion and sound page sends it a frame while a check is over its line. At this commit that message names no stream, so the server refuses it, and its models read none of the web app’s frames. A frame on a stream the server holds is described with vision models through Ollama, and the server can send alerts by email, SMS, Telegram or push. safeos.sh itself has no server of Frame’s behind it.
- The browser sends a frame only in the Hybrid or AI queue mode, with a saved server address, while a check is over its line.
- The frame crosses the WebSocket as a JPEG, at most once each analysis interval.
- Does the frame name a stream its sender holds? The page’s frames name none at this commit, so the server refuses them here.
- The server checks that it decodes and keeps it 10 minutes.
- Is motion 10 or more, or sound 15 or more? Then it queues the frame.
- With Ollama working, Moondream looks first; on a concern, llava:7b looks closer.
- If Ollama is down or fails and a cloud key is set: OpenRouter, then OpenAI, then Anthropic.
- The alert reaches the browser, and email, SMS, Telegram or push as you chose.
What it runs on
The server is Node.js 20 with Express and ws, run from its TypeScript sources through tsx, and keeps its records in SQLite through @framers/sql-storage-adapter, with better-sqlite3 first (Dockerfile, server.ts, index.ts). docker compose starts Ollama, a step that pulls the models, the API and the web app, and publishes their ports on 127.0.0.1 only; Redis starts only with the with-redis profile and is not published (docker-compose.yml); a CI job fails a compose file in which a service other than the Caddy proxy publishes a port beyond this machine (ci.yml). Images of the API and the web app are published to ghcr.io from master (docker-publish.yml, docker-publish.yml).
What reaches it, and what it keeps
Only the Motion and sound page sends frames, and only in the Hybrid or AI queue mode on Settings, Models, with a saved server address, while motion, sound or picture change is over its line. The default setting, Maximum Alert, uses Hybrid, so saving a server address is enough to start (page.tsx, settings-store.ts). A frame is a JPEG at quality 0.7, sent at most once each analysis interval, 5 s under Maximum Alert (CameraFeed.tsx). People and Wildlife send nothing to it.
The page’s message carries no streamId and puts its picture under frame, where the server reads imageData, so the server answers each one with STREAM_FORBIDDEN and keeps none (page.tsx, server.ts). For a frame on a stream it holds, the server takes a decodable JPEG, PNG or WebP of up to 2 MiB and 16 megapixels, and up to 30 frames a minute from one profile (server.ts, server.ts). It keeps a frame for 10 minutes (index.ts, index.ts), and queues it for a look when its motion is 10 or more or its sound 15 or more (server.ts). It answers pages from listed origins only: safeos.sh, the phone apps and local addresses, or the ones you set in SAFEOS_ALLOWED_ORIGINS (server.ts).
How it reads a frame
Moondream takes a first look; when it reports a concern, llava:7b takes a closer one (analysis-queue.ts). Ollama lists them at 1.7 GB and 4.7 GB (moondream, llava). Only when Ollama is down or fails, and only with cloud keys set, the server tries OpenRouter, then OpenAI, then Anthropic, each with the frame, until one answers (cloud-fallback.ts). Alerts go to the channels you set up, browser push, Telegram, SMS and email, with quiet hours and a 5-minute cooldown, and the server runs 2 analyses at once (analysis-queue.ts, notification-manager.ts).
Moondream is under the Apache License 2.0, as its makers list it (moondream2), and LLaVA’s makers add usage notices for its training data and base model (LLaVA). Ollama pulls both on your own server.
Read more: Self-hosted camera AI with Ollama, Moondream and LLaVA
Code: server.ts, analysis-queue.ts, cloud-fallback.ts. Documents: docs/DOCKER.md, docs/DEPLOYMENT.md.
Limits
At this commit the server refuses the Motion and sound page’s frames. A frame it accepts stays 10 minutes, and its analysis and alerts stay after it. With a cloud key set, frames can reach a cloud provider. Nothing measures the server models’ answers.
How it is built and tested
Every pull request runs the server and web checks, browser walks that feed Chromium’s fake camera a clip in the public domain, and screenshots of the public pages in both looks. Every push to master is then measured on slowed processors, deploys only after an offline start check passes, and the live home page is compared with the build.
- A pull request starts CI, Pictures and the Deploy workflow’s build.
- CI runs the server and web checks and the browser walks. Pictures takes screenshots in both looks and reads contrast from the pixels.
- The merge to master.
- On master, Measure runs on slowed processors. Deploy builds the export and the offline file list, and the offline start check runs.
- GitHub Pages serves the build, and the live home is compared with it.
- safeos.sh.
The workflows
Every workflow runs on GitHub’s ubuntu-24.04 runners. CI runs on pull requests and master (ci.yml) with these jobs: server type check and lint, server tests, server build, web app type check and lint, web app tests, the alert walk, the Lost and Found walks, compose ports and account form pictures (ci.yml). Pictures runs on pull requests (pictures.yml); Measure runs on master (measure.yml); Deploy builds on pull requests and deploys from master (deploy-pages.yml, deploy-pages.yml).
A fake camera fed a real clip
The alert walk turns the committed sample clip, under CC0 1.0 (its record), into a .y4m file for Chromium’s fake camera and a .wav file for its fake microphone (ci.yml). It walks the repeating alert, the alert pictures and their box and the notifications in Chromium; under Firefox those camera walks skip, and Firefox runs one check of its own, on Settings, Notifications (ci.yml). The Lost and Found walks feed the fake camera a striped clip they write themselves and walk setup, the watch and a sighting’s entry with the camera’s picture beside the pet’s photo (ci.yml).
Measure, the words test, contrast and the deploy
Measure loads the built site in Chromium as a phone class and a laptop class, with the processor slowed by factors of 1, 2, 4 and 6, and records the watch, the model and Lost and Found without judging them (docs/PERFORMANCE.md). Its Wildlife probe watches the sample clip with Wildlife’s own timer, gate and model (wildlife-probe.mjs). A test reads the source of the public pages, this one included, and fails on claims the code does not back, each listed with what the code does instead (public-pages-say-what-is-true.test.ts, public-pages-say-what-is-true.test.ts). Pictures reads contrast from the screenshots’ own pixels (pictures.yml). Before each deploy the offline start check runs; after it, the live home page’s SHA-256 is compared with the build’s (deploy-pages.yml, deploy-pages.yml).
Read more: Playwright fake camera: testing a webcam app in CI
The Actions page. Documents: docs/DEVELOPMENT.md, docs/PERFORMANCE.md.
Limits
No test runs People’s watch with the real model at its real line; Measure’s probe runs Wildlife’s real gate and model. Unit tests fix the model’s answers instead of running it. No real phone is measured, and nothing measures how often People, Wildlife or Lost and Found is right or wrong.
Credits and licences
Object detection: COCO-SSD, ssdlite_mobilenet_v2, by the TensorFlow authors, Apache License 2.0, trained on the COCO dataset. COCO’s annotations are © COCO Consortium, CC BY 4.0. TensorFlow.js, Apache License 2.0. Every package SafeOS ships and its licence: third-party notices.
SafeOS is open source under the MIT License; the built site also ships packages and fonts under their own licences. This page describes the code at commit 017b33b.
TensorFlow, the TensorFlow logo and any related marks are trademarks of Google Inc. Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Other product names belong to their owners; SafeOS is not affiliated with them.