@commonlyai/cli 0.1.136 → 0.1.138

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.136",
3
+ "version": "0.1.138",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -200,13 +200,15 @@ const preparePublicClaudeState = async (ctx) => {
200
200
  return { statePath, tmpPath, configPath };
201
201
  };
202
202
 
203
- const buildClaudeEnv = (input, state, expansionEnv = {}, credentialFile = null) => {
203
+ const buildClaudeEnv = (input, state, expansionEnv = {}, credentialFile = null, publicSeat = false) => {
204
204
  const source = input || process.env;
205
- const output = state ? {} : { ...source };
206
- if (state) {
205
+ const output = state || publicSeat ? {} : { ...source };
206
+ if (state || publicSeat) {
207
207
  for (const [key, value] of Object.entries(source)) {
208
208
  if (PUBLIC_SAFE_ENV.test(key)) output[key] = value;
209
209
  }
210
+ }
211
+ if (state) {
210
212
  output.HOME = state.statePath;
211
213
  output.TMPDIR = state.tmpPath;
212
214
  // Claude keeps its temp root at /private/tmp/claude-<uid> unless told
@@ -825,14 +827,16 @@ export default {
825
827
  let mcpConfig = null;
826
828
  let publicClaudeState = null;
827
829
  let publicSkillArgs = [];
830
+ const publicTrust = ctx.environment?.sandbox?.trust === 'public';
831
+ const publicNativeSandbox = publicTrust
832
+ && PUBLIC_SANDBOX_MODES.has(resolvePublicSandboxMode(ctx.environment?.sandbox));
833
+ const publicBwrapSandbox = publicTrust
834
+ && resolvePublicSandboxMode(ctx.environment?.sandbox) === 'bwrap';
828
835
  try {
829
836
  // Trust is normalized at entry (legacy `internal` reads as public). The
830
837
  // MCP policy follows trust alone, whatever confines the seat: a public
831
838
  // bwrap seat needs a host-prepared build exactly as a Seatbelt one does
832
839
  // (Rhea on #2247).
833
- const publicTrust = ctx.environment?.sandbox?.trust === 'public';
834
- const publicNativeSandbox = publicTrust
835
- && PUBLIC_SANDBOX_MODES.has(resolvePublicSandboxMode(ctx.environment?.sandbox));
836
840
  if (publicNativeSandbox) {
837
841
  publicClaudeState = await preparePublicClaudeState(ctx);
838
842
  }
@@ -863,8 +867,9 @@ export default {
863
867
  publicClaudeState,
864
868
  mcpConfig?.expansionEnv,
865
869
  mcpConfig?.credential?.path || null,
870
+ publicTrust,
866
871
  );
867
- if (publicNativeSandbox && ctx.commitAttributionEnv) {
872
+ if ((publicNativeSandbox || publicBwrapSandbox) && ctx.commitAttributionEnv) {
868
873
  Object.assign(claudeEnv, ctx.commitAttributionEnv);
869
874
  }
870
875
  const spawnCtx = {
@@ -920,8 +925,12 @@ export default {
920
925
  publicClaudeState,
921
926
  mcpConfig?.expansionEnv,
922
927
  mcpConfig?.credential?.path || null,
928
+ publicTrust,
923
929
  ),
924
930
  };
931
+ if ((publicNativeSandbox || publicBwrapSandbox) && ctx.commitAttributionEnv) {
932
+ Object.assign(retryCtx.claudeEnv, ctx.commitAttributionEnv);
933
+ }
925
934
  const retry = await prepareArgv(retryBase, retryCtx);
926
935
  const stdout = await runClaude({
927
936
  cmd: retry.cmd,
@@ -341,6 +341,9 @@ const preparePublicCodexHome = async (ctx) => {
341
341
  const PUBLIC_CODEX_INSTRUCTIONS_MAX_BYTES = 32 * 1024;
342
342
 
343
343
  const writePublicCodexInstructions = async (publicHome, ctx) => {
344
+ // Codex loads this file before AGENTS.md when it exists. Clear any leftover
345
+ // override on every spawn so it cannot shadow the seat's declared skills.
346
+ await rm(join(publicHome, 'AGENTS.override.md'), { force: true });
344
347
  const declared = Array.isArray(ctx.environment?.skills?.claude) ? ctx.environment.skills.claude : [];
345
348
  const baseDir = ctx.cwd || process.cwd();
346
349
  const sources = declared.map((source) => resolveSkillSource(source, baseDir));
@@ -327,7 +327,11 @@ export default {
327
327
  ],
328
328
  },
329
329
  },
330
- }, { workspacePath: ctx.cwd, homePath: home, readOnlyPaths: [tempDir, executable, packageDir, process.execPath, ...mcpReadDirectories].filter(Boolean) });
330
+ }, {
331
+ workspacePath: ctx.cwd,
332
+ homePath: home,
333
+ readOnlyPaths: [tempDir, executable, packageDir, process.execPath, ...mcpReadDirectories].filter(Boolean),
334
+ });
331
335
  } else if (isPublic) {
332
336
  if ((ctx._platform || process.platform) !== 'darwin') {
333
337
  throw new Error(`public Qwen sandbox.mode=${mode} requires Seatbelt on macOS or bwrap on Linux`);
@@ -92,8 +92,10 @@ export const detectBwrap = ({ spawn = spawnSync, platform = process.platform } =
92
92
  * user sees the gap before they think they're protected.
93
93
  *
94
94
  * The expansion order matches `bwrap`'s left-to-right argument application:
95
- * isolation flags first, then binds (later binds win on collision), then
96
- * --setenv, then `--` and the inner argv.
95
+ * isolation flags first, then binds (later binds win on collision), then the
96
+ * isolated HOME, then `--` and the inner argv. The caller passes the filtered
97
+ * child environment as the bwrap process environment; values must not be
98
+ * serialized into argv, where they would be visible in the process list.
97
99
  */
98
100
  export const wrapArgvWithBwrap = (innerArgv, env, opts = {}) => {
99
101
  if (process.platform !== 'linux') {