Add Mirage sandbox connector#70
Conversation
|
i think this connector is directionally very right, esp after the no-default-sandbox thread: Mirage is the Environment adapter, Flue still owns Agent/Session. one thing i'd fix before merge: the connector currently drops Flue's session id and flattens everything onto Mirage's default session. related: i tested await ws.execute("FOO=bar printenv FOO"); // exit 1
await ws.execute("FOO=bar echo $FOO"); // stdout: "echo\n"
shape i'd lean toward:
not trying to bikeshed the connector; this feels like the managed-agents boundary: Flue Session should map cleanly to the substrate session when the sandbox has one. |
|
@FredKSchott — read through this carefully because the connector pattern is something I've been studying. Mostly notes for the next reader; flagging a couple of small things you may or may not want to fold in. Things I picked up from reading it back to back with the vercel connector:
Polish-level things, take or leave:
Things that aren't issues but caught my eye:
Overall this is a clean conformant connector and a great template for future ones — the multi-target story ( |
Threads each Flue session id through Mirage's session manager so cwd, env, history, and lastExitCode stay isolated when one Workspace is shared across multiple Flue sessions (per @stainlu's review on #70). Documents the remaining workarounds (env shell-prefix, cwd shell-prefix, client-side timeout) as known limitations awaiting upstream fixes: - strukto-ai/mirage#4 (per-call cwd in ExecuteOptions) - strukto-ai/mirage#5 (per-call env in ExecuteOptions) - strukto-ai/mirage#6 (mid-flight AbortSignal observation) Once those land, the workarounds become removable in a follow-up.
|
Thanks @stainlu — your review was right on, and digging into the Mirage source confirmed the issues run a little deeper than just session mapping. Just pushed 657e487 which threads The other three connector bugs I found (per-call
Holding this PR until those three are resolved. The current code keeps the existing workarounds with TODO pointers; once Mirage ships the fixes, dropping them is mechanical. I don't want to land a connector where |
Threads each Flue session id through Mirage's session manager so cwd, env, history, and lastExitCode stay isolated when one Workspace is shared across multiple Flue sessions (per @stainlu's review on #70). Documents the remaining workarounds (env shell-prefix, cwd shell-prefix, client-side timeout) as known limitations awaiting upstream fixes: - strukto-ai/mirage#4 (per-call cwd in ExecuteOptions) - strukto-ai/mirage#5 (per-call env in ExecuteOptions) - strukto-ai/mirage#6 (mid-flight AbortSignal observation) Once those land, the workarounds become removable in a follow-up.
Mirage 0.0.2 ships first-class support for per-call cwd, per-call env, and mid-flight AbortSignal observation, resolving strukto-ai/mirage#4-#6. The connector now passes those options straight through to Workspace.execute() instead of wrapping with cd/env shell prefixes and entry-time signal checks. Verified end-to-end: per-call cwd/env do not leak into the Mirage session, and mid-flight aborts fire at signal time rather than after the command completes. Also folds in review polish from #70: defensive Uint8Array copy on readFileBuffer, Unix-epoch sentinel for missing mtime, comment on Mirage's readdir return shape, and aliases for the two runtime packages so flue add @struktoai/mirage-{node,browser} both resolve here. Drops the cleanup option to match the post-#85 connector contract.
657e487 to
d365a5e
Compare
|
nice, the latest shape looks much cleaner now that Mirage has first-class one small edge case i think is worth checking before this lands: that means if Flue passes both, and the caller aborts first, the connector can return a 124-shaped timeout result instead of surfacing caller cancellation. this can happen through the LLM-facing bash tool path: bash tool timeout gives Flue core seems to intentionally keep those different:
maybe keep the timeout signal separate and only synthesize 124 when the timeout signal is the one that won. if caller signal won, rethrow the abort error. |
Summary
connectors/sandbox--mirage.md, a sandbox connector for Mirage — Strukto AI's in-process unified virtual filesystem.@struktoai/mirage-core); users install@struktoai/mirage-nodeon--target nodeor@struktoai/mirage-browseron--target cloudflare.connectors/README.md; node-vs-browser specifics are folded into the existing "What this connector does" and "Required dependencies" slots rather than introducing new top-level sections.