Repository navigation
Add local Docker and model observation channels - #17
Conversation
Expose bounded read-only Docker, Ollama and MLX snapshots when subscribed. Reject non-Unix Docker contexts and keep each model source freshness independent. Co-Authored-By: Claude <noreply@anthropic.com>
fdussert
left a comment
There was a problem hiding this comment.
Thanks a lot for this, Florian, and for keeping the widgets out of the core and on the registry, as the project asks. The security design is good. Docker is reached through execFile with no shell, a fixed path and a sanitised environment. The context is resolved once and then passed explicitly as --host unix:///…, so a remote daemon can't be reached even by accident. The zod schemas drop commands, env, labels, mounts and ports. The Ollama client is pinned to loopback, refuses redirects, has a timeout and reads a bounded stream. Both channels stay inert until a widget subscribes, and the tests check that private strings don't leak. Typecheck and the full test suite pass here, and docker-local works against a real OrbStack install.
A few things before this can land:
-
Readability.
local-operations.tsand its test are written as packed one-liners: several statements per line, single-letter names, no comments. That makes them hard to review and maintain, the same point as on #14. Please format them like the other providers (calendar.tsandbattery.tsare good references): one statement per line, named types for the published snapshots instead ofunknown[], a short doc comment on each provider saying what it publishes and why, and noanyin the tests. -
Docker binary location.
/usr/local/bin/dockermisses Homebrew/Colima on Apple Silicon (/opt/homebrew/bin/docker) and Docker Desktop's per-user install (~/.docker/bin/docker). Those users would seeofflineforever, with no way to tell it apart from a stopped daemon. Could you try a short closed list of absolute paths, and report a distinct error such asunavailablewhen none exists? The changelog already promises "explicit unavailable states", and right now a missing binary is reported asoffline. -
Partial failures. More than 200 containers (
ps -acounts stopped ones too) makes the whole channelinvalid; capping the list would be better. And a container that stops betweenpsandstatsmakesdocker statsfail, so the whole snapshot becomesoffline. Keeping the container list and settingstats: nullwould be more robust. -
MLX model argument.
--modelis published verbatim. It's often an absolute path such as/Users/<name>/models/..., which hands the user's account name and directory layout to a widget that may have network access. Publishing only the last path segment, or only anorg/model-shaped id, would avoid that. Also, a server started through themlx_lm.serverconsole script shows up aspython …/bin/mlx_lm.server …and isn't matched by the-mpattern. -
Docs.
- Please add
docker-localandlocal-modelsto the channel list indocs/writing-widgets.md. - Please document the payload shapes and error codes (
remote-context,offline,invalid, and the newunavailable) indocs/local-operations.md, since registry widget authors will code against them. - The README sentence currently sits in the connections paragraph and would read better in its own place.
- The changelog entry should follow the style of its neighbours: a bold lead, then what the user can now do, without the claim about unavailable states until that exists.
- Please add
Smaller points, optional: the snapshot is marked stale: true before anything was ever fetched (updatedAt: null), and the two providers could go after the existing ones in providers/index.ts rather than at the top.
I don't think a privacy toggle is needed here: the consent dialog already lists both channels as reads, the same way it does for processes, and nothing leaves the machine. Thanks again, this will be a nice addition once these are addressed.
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
fdussert
left a comment
There was a problem hiding this comment.
Thanks Florian, that was a quick and thorough turnaround. Everything substantive is addressed:
- Docker is now resolved from a closed list of absolute paths, and a missing CLI reports
unavailable, which is distinct fromoffline. - The container list is capped at 200, and a failed
docker statskeeps the list withstats: nullinstead of blanking the snapshot. - The MLX
--modelvalue is reduced to a path-free label, and console-script launches (…/bin/mlx_lm.server,omlx,mlx-server) are detected. - The channels, payload shapes and error codes are documented, the README has its own bullet, and a snapshot that was never fetched is no longer marked stale.
Typecheck and the full suite pass here, and docker-local still works against a real OrbStack install.
A few non-blocking nits for a follow-up if you feel like it:
local-operations.tsstill has a handful of packed lines (theexecFilecall, the container mapping, the MLX mapping). Splitting them, adding a named type forz.infer<typeof Model>, and computingmlxBackend()once instead of twice with a!would make it read like the other providers.- The two providers could go after the existing ones in
providers/index.ts. - You might try
/usr/local/bin/dockerbefore/opt/homebrew/bin/docker: a stale Homebrew CLI can shadow the one OrbStack or Docker Desktop installs. It works either way, since the context picks the daemon. docs/local-operations.mdcould mention that themlxpart reportsofflinewhen the process list can't be read.
Approving and merging. Thanks again!
What this changes
Adds two demand-driven, read-only channels for local operations.
docker-locallists containers and bounded stats only when the selected Docker context resolves to a Unix socket.local-modelsreads local Ollama model lists and selected MLX/oMLX server processes. A loaded model or detected process is not presented as proof of active inference.The account-free provider code stays in Fremkit; its display widgets will be proposed separately to fremkit-sietch.
How to see it
See
docs/local-operations.md. With local Docker or Ollama installed, subscribe a compatible widget to the channel. A remote Docker context should showremote-contextwithout listing containers. This isolated branch was not installed on the live XENEON.Checks
pnpm typecheckpassedpnpm testpassed (1,363 server and 385 UI tests)pnpm buildpassed