@commonlyai/cli 0.1.199 → 0.1.201

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.199",
3
+ "version": "0.1.201",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -96,6 +96,7 @@ import { buildMemoryPreamble, ROW_SLICING_CUE } from '../memory-bridge.js';
96
96
  import { claudeConfigDirFor, claudeContextTokens, claudeTranscriptPath } from '../session-recycle.js';
97
97
  import { skillsAsText } from '../skill-prompt.js';
98
98
  import { adapterFailure, spawnCredentials } from '../upstream-refusal.js';
99
+ import { PUBLIC_WITHHELD_TOOLS } from '../public-withheld-tools.js';
99
100
 
100
101
  // See codex.js for the rationale on bumping the default + env override.
101
102
  // Keeping both adapters in lockstep so any wrapper agent runtime has the
@@ -446,6 +447,10 @@ const buildPublicClaudePolicyArgs = (mcpToolPatterns, { trust, allow = [], memor
446
447
  const memoryDenies = memoryWithheld
447
448
  ? MEMORY_TOOLS.flatMap((tool) => mcpToolPatterns.map((pattern) => pattern.replace(/\*$/, tool)))
448
449
  : [];
450
+ // Nor, on any confined trust, the tools no public seat is offered
451
+ // (public-withheld-tools.js).
452
+ const withheldDenies = PUBLIC_WITHHELD_TOOLS
453
+ .flatMap((tool) => mcpToolPatterns.map((pattern) => pattern.replace(/\*$/, tool)));
449
454
  return [
450
455
  // HOME points at an isolated, sanitized state directory. Ignore settings
451
456
  // from user/project/local sources and disable slash-command extensions;
@@ -457,7 +462,7 @@ const buildPublicClaudePolicyArgs = (mcpToolPatterns, { trust, allow = [], memor
457
462
  '--permission-mode', 'dontAsk',
458
463
  '--allowedTools', 'Read(./**)', ...granted, ...mcpToolPatterns,
459
464
  '--disallowedTools', ...PUBLIC_DENIED_TOOLS.filter((tool) => !granted.includes(tool)),
460
- ...deniedReads, ...workspaceDenies, ...memoryDenies,
465
+ ...deniedReads, ...workspaceDenies, ...memoryDenies, ...withheldDenies,
461
466
  ];
462
467
  };
463
468
 
@@ -537,6 +542,11 @@ const runClaude = ({
537
542
  stallKill = setTimeout(() => {
538
543
  killProcessTree(proc, 'SIGKILL', treeIo(processTable));
539
544
  sweepStallSurvivors();
545
+ // A pipe holder the snapshot missed (ps failed, or it was reparented
546
+ // before the stall) would still keep close from firing. Dropping our
547
+ // ends of the pipes bounds every stalled turn at window plus grace.
548
+ proc.stdout?.destroy?.();
549
+ proc.stderr?.destroy?.();
540
550
  }, stallKillGraceMs);
541
551
  stallKill.unref?.();
542
552
  },
@@ -1262,7 +1272,7 @@ export default {
1262
1272
  // TASK-440: the context this turn left, read from the transcript the
1263
1273
  // child wrote under its own env (an isolated HOME for public seats).
1264
1274
  const contextTokens = claudeContextTokens({
1265
- cwd: ctx.cwd, sessionId, configDir: claudeConfigDirFor({ ...env, HOME: childHome || env?.HOME }),
1275
+ cwd: physicalPath(ctx.cwd), sessionId, configDir: claudeConfigDirFor({ ...env, HOME: childHome || env?.HOME }),
1266
1276
  });
1267
1277
  return { text: stdout.trim(), newSessionId: sessionId, contextTokens };
1268
1278
  } catch (err) {
@@ -1324,7 +1334,7 @@ export default {
1324
1334
  survivorIo: ctx._survivorIo,
1325
1335
  });
1326
1336
  const contextTokens = claudeContextTokens({
1327
- cwd: ctx.cwd, sessionId: freshId,
1337
+ cwd: physicalPath(ctx.cwd), sessionId: freshId,
1328
1338
  configDir: claudeConfigDirFor({ ...retry.env, HOME: retry.childHome || retry.env?.HOME }),
1329
1339
  });
1330
1340
  return { text: stdout.trim(), newSessionId: freshId, contextTokens };
@@ -71,6 +71,7 @@ import { buildMemoryPreamble, ROW_SLICING_CUE } from '../memory-bridge.js';
71
71
  import { resolveSkillSource, skillsAsText } from '../skill-prompt.js';
72
72
  import { isLegacySandboxTrust, normalizeSandboxTrust, refuseWorkspaceTrust } from '../environment.js';
73
73
  import { adapterFailure, spawnCredentials } from '../upstream-refusal.js';
74
+ import { PUBLIC_WITHHELD_TOOLS } from '../public-withheld-tools.js';
74
75
 
75
76
  // Default timeout for a single codex spawn (exec mode).
76
77
  //
@@ -212,6 +213,10 @@ const buildMcpOverrideArgs = (mcpServers, ctx = {}) => {
212
213
  '-c',
213
214
  `mcp_servers.${server.name}.default_tools_approval_mode="approve"`,
214
215
  );
216
+ // ...except the tools no public seat is offered (public-withheld-tools.js).
217
+ if (ctx.publicSeat) {
218
+ flags.push('-c', `mcp_servers.${server.name}.disabled_tools=[${PUBLIC_WITHHELD_TOOLS.map(toml).join(',')}]`);
219
+ }
215
220
  if (rest.length) {
216
221
  flags.push('-c', `mcp_servers.${server.name}.args=[${rest.map(toml).join(',')}]`);
217
222
  }
@@ -58,6 +58,7 @@ import { resolveProviderKeyFile, startProviderProxy } from '../provider-proxy.js
58
58
  import { isShippedCommonlyMcpCommand } from '../declared-mcp-guard.js';
59
59
  import { isAnswerableToolError } from '../public-tool-error.js';
60
60
  import { startInstanceProxy } from '../instance-proxy.js';
61
+ import { PUBLIC_WITHHELD_TOOLS } from '../public-withheld-tools.js';
61
62
 
62
63
  const DEFAULT_TIMEOUT_MS = 15 * 60 * 1000;
63
64
  const ISOLATED_PROXY_PORT = 8765;
@@ -246,6 +247,10 @@ const publicPermissions = (mode, mcpNames) => {
246
247
  todoread: 'allow',
247
248
  lsp: 'allow',
248
249
  ...Object.fromEntries(mcpNames.map((name) => [`${permissionMcpName(name)}_*`, 'allow'])),
250
+ // After the wildcard allow, since the last matching rule wins
251
+ // (public-withheld-tools.js).
252
+ ...Object.fromEntries(mcpNames.flatMap((name) => PUBLIC_WITHHELD_TOOLS
253
+ .map((tool) => [`${permissionMcpName(name)}_${tool}`, 'deny']))),
249
254
  };
250
255
  };
251
256
 
@@ -15,6 +15,7 @@ import { detectBwrap, wrapArgvWithBwrap } from '../sandbox/bwrap.js';
15
15
  import { wrapArgvWithSeatbelt } from '../sandbox/seatbelt.js';
16
16
  import { resolveProviderKeyFile, startProviderProxy } from '../provider-proxy.js';
17
17
  import { adapterFailure, spawnCredentials } from '../upstream-refusal.js';
18
+ import { PUBLIC_WITHHELD_TOOLS } from '../public-withheld-tools.js';
18
19
 
19
20
  // Add a version only with a passing real clean-box sandbox smoke that names it.
20
21
  const TESTED_QWEN_VERSIONS = Object.freeze(['0.25.1', '0.26.2']);
@@ -38,6 +39,9 @@ const EXCLUDED_TOOLS = [
38
39
  // per-spawn MCP credential file, so public turns cannot expose OS read tools.
39
40
  const PUBLIC_READ_TOOLS = [
40
41
  'read_file', 'grep_search', 'search_file_content', 'glob', 'list_directory', 'lsp',
42
+ // Both spellings of a Commonly MCP tool, as with the aliases above
43
+ // (public-withheld-tools.js).
44
+ ...PUBLIC_WITHHELD_TOOLS.flatMap((tool) => [tool, `mcp__commonly__${tool}`]),
41
45
  ];
42
46
 
43
47
  const parseVersion = (output) => {
@@ -0,0 +1,5 @@
1
+ // Commonly MCP tools that public seats are not offered, on any adapter.
2
+ // Claude workspace seats follow the same list. Each
3
+ // adapter removes them in its own vocabulary (TASK-287; Goose's public list
4
+ // already leaves them out).
5
+ export const PUBLIC_WITHHELD_TOOLS = Object.freeze(['commonly_attach_file']);