Skip to content

Add local Docker and model observation channels - #17

Merged
fdussert merged 3 commits into
fdussert:mainfrom
FlorianBruniaux:codex/local-operations-provider
Oct 15, 2026
Merged

fdussert merged 3 commits into
fdussert:mainfrom
FlorianBruniaux:codex/local-operations-provider

Conversation

@FlorianBruniaux

Copy link
Copy Markdown
Contributor

What this changes

Adds two demand-driven, read-only channels for local operations. docker-local lists containers and bounded stats only when the selected Docker context resolves to a Unix socket. local-models reads 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 show remote-context without listing containers. This isolated branch was not installed on the live XENEON.

Checks

  • pnpm typecheck passed
  • pnpm test passed (1,363 server and 385 UI tests)
  • pnpm build passed
  • No personal identifiers or credentials in the changed files
  • UI build after UI source changes: not applicable
  • Widget rescan after manifest changes: not applicable
  • French and English UI strings: not applicable, no UI text

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 fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Readability. local-operations.ts and 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.ts and battery.ts are good references): one statement per line, named types for the published snapshots instead of unknown[], a short doc comment on each provider saying what it publishes and why, and no any in the tests.

  2. Docker binary location. /usr/local/bin/docker misses Homebrew/Colima on Apple Silicon (/opt/homebrew/bin/docker) and Docker Desktop's per-user install (~/.docker/bin/docker). Those users would see offline forever, 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 as unavailable when none exists? The changelog already promises "explicit unavailable states", and right now a missing binary is reported as offline.

  3. Partial failures. More than 200 containers (ps -a counts stopped ones too) makes the whole channel invalid; capping the list would be better. And a container that stops between ps and stats makes docker stats fail, so the whole snapshot becomes offline. Keeping the container list and setting stats: null would be more robust.

  4. MLX model argument. --model is 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 an org/model-shaped id, would avoid that. Also, a server started through the mlx_lm.server console script shows up as python …/bin/mlx_lm.server … and isn't matched by the -m pattern.

  5. Docs.

    • Please add docker-local and local-models to the channel list in docs/writing-widgets.md.
    • Please document the payload shapes and error codes (remote-context, offline, invalid, and the new unavailable) in docs/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.

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.

FlorianBruniaux and others added 2 commits October 15, 2026 16:21
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>

@fdussert fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 from offline.
  • The container list is capped at 200, and a failed docker stats keeps the list with stats: null instead of blanking the snapshot.
  • The MLX --model value 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.ts still has a handful of packed lines (the execFile call, the container mapping, the MLX mapping). Splitting them, adding a named type for z.infer<typeof Model>, and computing mlxBackend() 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/docker before /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.md could mention that the mlx part reports offline when the process list can't be read.

Approving and merging. Thanks again!

@fdussert
fdussert merged commit 32ffac1 into fdussert:main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants