@commonlyai/cli 0.1.398 → 0.1.399
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/agent.js +16 -4
- package/src/lib/adapters/codex.js +615 -22
- package/src/lib/sandbox/guest-home.js +178 -0
- package/src/lib/sandbox/host-check.js +17 -2
- package/src/lib/sandbox/microsandbox.js +475 -57
- package/src/lib/sandbox/mode.js +24 -2
package/src/lib/sandbox/mode.js
CHANGED
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
*
|
|
27
27
|
* NOT used by the codex adapter. Codex's `mode` is read-vs-write access, not a
|
|
28
28
|
* host mechanism — its permission profiles run on both platforms — so its
|
|
29
|
-
* derived default is 'workspace' everywhere
|
|
29
|
+
* derived default is 'workspace' everywhere, except the Windows microVM opt-in
|
|
30
|
+
* (resolveCodexSandboxMode below).
|
|
30
31
|
*
|
|
31
32
|
* Native Windows, opt-in: with COMMONLY_SANDBOX_MICROVM=1 in the host process,
|
|
32
33
|
* an undeclared mode on win32 resolves to 'microvm' (a microsandbox microVM,
|
|
@@ -56,4 +57,25 @@ export const resolvePublicSandboxMode = (sandbox, platform = process.platform, e
|
|
|
56
57
|
return 'bwrap';
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The codex adapter's mode. Codex's `workspace` and `read-only` are read vs
|
|
62
|
+
* write access inside its own permission profile, not host mechanisms, so a
|
|
63
|
+
* public seat keeps whichever it declared (`workspace` when it declared none)
|
|
64
|
+
* on every host but one: native Windows with COMMONLY_SANDBOX_MICROVM=1. There
|
|
65
|
+
* a public Codex seat resolves to 'microvm' whatever it declared, because the
|
|
66
|
+
* only other confinement on that host is Codex's own Windows sandbox, which
|
|
67
|
+
* cannot enforce a public profile's read denies (host-check.js). Reading a
|
|
68
|
+
* declared mode as "use Codex's own sandbox" would hand the seat to a sandbox
|
|
69
|
+
* that refuses it, or worse; reading it as microvm only ever narrows it: the
|
|
70
|
+
* VM mounts the workspace read-only, so `workspace` runs as `read-only`.
|
|
71
|
+
*
|
|
72
|
+
* Any other trust returns null (no public profile). Codex refuses `workspace`
|
|
73
|
+
* trust itself (environment.js refuseWorkspaceTrust). Flag off, nothing moves.
|
|
74
|
+
*/
|
|
75
|
+
export const resolveCodexSandboxMode = (sandbox, platform = process.platform, env = process.env) => {
|
|
76
|
+
if (effectiveSandboxTrust(sandbox?.trust) !== 'public') return null;
|
|
77
|
+
if (platform === 'win32' && microvmFlagOn(env)) return 'microvm';
|
|
78
|
+
return sandbox?.mode ?? 'workspace';
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default { PUBLIC_SANDBOX_MODES, resolveCodexSandboxMode, resolvePublicSandboxMode };
|