Skip to content

Phase 2: sandbox, agent, proc move into @artipod/core — events bus, /host controllers, console, sudo stub - #37

Merged
horner merged 12 commits into
mainfrom
phase-2-import-sandbox
Aug 31, 2026
Merged

horner merged 12 commits into
mainfrom
phase-2-import-sandbox

Conversation

@horner

@horner horner commented Aug 31, 2026

Copy link
Copy Markdown
Member

Package half of artipod-layer-plan Phase 2 (app half: horner/artipod-sync#2; ui acceptance: mieweb/ui#404).

  • Moved from artipod-sync with their 90 vitest tests: /sandbox (just-bash over ZenFS, git/edit/notes/storage/module commands, storage backends, git+git-auth engines), /proc (provider framework), /agent (loop, Ozwell client, local ONNX worker stack — CDN-loaded, types-only dep)
  • Collision ArtiPod Implementation v1 #1 resolved: the agent's file tools are now the VS Code-schema pod tools over a mount table (read_file/create_file/list_dir/…); bash keeps 16 KiB truncation; old write_file/list_files shapes deleted
  • pod.events coherence bus (exec:start/end, coarse fs:changed per command — the contract, edit:request, agent:tool-call, approval:request) wired through createSandbox and ArtiPod
  • /host: TerminalSession, FileBuffer, TreeSource — headless controllers extracted from the app components, tested against fakes
  • /console: installConsole overlay (zero-dep renderer, SSR-safe no-op, Ctrl+`/Ctrl+~)
  • sudo confinement stub (Decision Added main mount functionality. This is a backward-incompatible change. #10): default-deny EPERM until Phase 6.5, pinned by tests, surfaced via approval:request
  • Isomorphism fixes found by consuming: node path/crypto excised from core (posix pathUtils + WebCrypto ids; '/'-mount boundary bug), docker backend lazy + browser-field-stubbed (dockerode/ssh2 was breaking webpack), initFileSystem returns its zfs (file:-install dual-singleton fix)

306 tests green (17 files, docker suites included); Next production build of the consuming app green; acceptance flows verified live in a browser (see plan worklog). pod.createSandbox() deferred to Phase 3 with the realizers (noted in plan).

horner added 12 commits August 30, 2026 21:09
Verbatim move of lib/sandbox (incl. git/git-auth/storage/table + commands), lib/proc, lib/agent (loop, ozwell + local ONNX clients, worker) with their vitest suites (90 tests). Decoupled git.ts from the app fs singleton (factory-only; NEXT_PUBLIC_GIT_CORS_PROXY guarded for non-Next bundles). New subpath exports: ./sandbox ./proc ./agent (+ agent/local/worker). isomorphic-git + diff join the optional exact-pinned peers.
artimount/artipod now use dependency-free posix path helpers (pod paths are posix by contract; Windows callers pass forward slashes) and WebCrypto ids — node builtins broke browser bundles (Next/Vite don't polyfill). Root-mount ('/') traversal boundary fixed: '//' prefix never matched.
PodEvents: exec:start/end, coarse fs:changed per live command (command-boundary invalidation is the contract), edit:request, agent:tool-call, approval:request. sudo is default-deny EPERM until the Phase 6.5 approval flow (Decision #10), pinned by tests, attempt surfaced via approval:request.
Collision #1 resolved: read_file/write_file/list_files minimal shapes deleted; createSandboxTools now serves bash (16 KiB truncation kept) + the pod file tools (read_file/create_file/list_dir/create_directory/replace_string_in_file/multi_replace_string_in_file/apply_patch) resolved over an app-declared mount table (default '/'), sharing the shell's ZenFS store via Sandbox.zfs.
TerminalSession (line discipline, history, tab completion, Ctrl+C, agent echo via agent:tool-call), FileBuffer (dirty tracking, external-change reload/flag), TreeSource (TreeDataProvider-shaped, fs:changed invalidation) — extracted from artipod-sync's components per plan §3. installConsole: zero-dep overlay console, SSR-safe no-op, approval:request surfacing. New exports: ./host ./console.
sandbox index re-exports storage + git/git-auth APIs (what artipod-sync's app layer consumes); agent exports DEFAULT_LOCAL_MODEL + CachedModel; LocalModelClient worker URL now ./worker.js so bundlers resolve it inside the published dist; terminal echoes bash result summaries on agent:tool-call result phase.
ArtiPod's container methods import ./docker on first use; root entry re-exports docker TYPES only (values moved to @artipod/core/docker) — dockerode's ssh2 native addon was breaking webpack builds of browser consumers.
Under file:/link installs the package resolves its own @zenfs/core copy; consumers adopting the returned instance is the only way to guarantee one store. lib/filesystem in artipod-sync now binds result.zfs.
@horner
horner merged commit c698d29 into main Aug 31, 2026
0 of 2 checks passed
horner added a commit that referenced this pull request Aug 31, 2026
test(ci): 120s timeouts for container-execution tests (fixes red CI from #37)
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.

1 participant