@commonlyai/cli 0.1.355 → 0.1.357

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.355",
3
+ "version": "0.1.357",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -62,6 +62,8 @@ export const DSH_PUBLIC_GUARD_SERVICE = 'commonlyPublicGuard';
62
62
  /** A public turn's working directory, emptied before each turn, under the seat home. */
63
63
  export const PUBLIC_TURN_DIR = 'public-turn';
64
64
  const PUBLIC_GUARD_SOURCE = new URL('./dsh-public-guard.mjs', import.meta.url);
65
+ // @commonlyai/mcp's WITHHELD_TOOLS_ENV (commonly-mcp/src/server.js); a test holds the two equal.
66
+ export const WITHHELD_TOOLS_MCP_ENV = 'COMMONLY_MCP_WITHHELD_TOOLS';
65
67
  // The one thing a public seat's home keeps between turns (a symlink is not kept).
66
68
  const PUBLIC_HOME_KEPT = 'sessions';
67
69
 
@@ -230,9 +232,16 @@ export const resolveCommonlyMcp = (declared, ctx) => {
230
232
  const values = { credentialFile: ctx.credentialFile, instanceUrl: ctx.instanceUrl };
231
233
  const env = Object.fromEntries(Object.entries(delivery.env)
232
234
  .map(([name, value]) => [name, substitute(value, values)]));
233
- // A public seat's MCP always carries the public-seat flag, whatever was declared.
234
- if (ctx.publicSeat) env[PUBLIC_SEAT_MCP_ENV] = '1';
235
- const allowed = ['COMMONLY_API_URL', 'COMMONLY_TOKEN_FILE', ...(ctx.publicSeat ? [PUBLIC_SEAT_MCP_ENV] : [])];
235
+ // A public seat's MCP always carries the public-seat flag, whatever was declared,
236
+ // and the tools it must keep off the list (F468): dsh can't filter one server's
237
+ // tools, so the server does. The guard still refuses them at the call, which also
238
+ // covers a warmed MCP build too old to read the list.
239
+ if (ctx.publicSeat) {
240
+ env[PUBLIC_SEAT_MCP_ENV] = '1';
241
+ env[WITHHELD_TOOLS_MCP_ENV] = [...(ctx.withheldTools || [])].join(',');
242
+ }
243
+ const allowed = ['COMMONLY_API_URL', 'COMMONLY_TOKEN_FILE',
244
+ ...(ctx.publicSeat ? [PUBLIC_SEAT_MCP_ENV, WITHHELD_TOOLS_MCP_ENV] : [])];
236
245
  if (Object.keys(env).some((name) => !allowed.includes(name))
237
246
  || env.COMMONLY_TOKEN_FILE !== ctx.credentialFile || env.COMMONLY_API_URL !== ctx.instanceUrl) {
238
247
  throw new Error('dsh adapter: Commonly MCP must use this spawn\'s credential file');
@@ -496,6 +505,7 @@ export default {
496
505
  }
497
506
  const mcp = resolveCommonlyMcp(ctx.environment?.mcp, {
498
507
  publicSeat: isPublic,
508
+ withheldTools: publicSeat?.withheld,
499
509
  credentialFile: credential.path,
500
510
  instanceUrl: confined ? relay.url : ctx.instanceUrl,
501
511
  ...(confined ? {
@@ -603,8 +603,15 @@ export const buildSeatbeltProfile = ({
603
603
  `(allow file-read* file-test-existence ${literal(executablePath)})`,
604
604
  `(allow file-read-metadata file-test-existence (path-ancestors "${escapeSbplString(executablePath)}"))`,
605
605
  ].join('\n') : '';
606
+ // The config folder is usually under the temp folder, which resolves through
607
+ // /private; a realpath of a file there (dsh's plugin preflight on the public
608
+ // guard) stats each ancestor. Metadata only, as for the read-only folders: no
609
+ // read or write on an ancestor or a file beside it (F115 prod walk, 11-12).
606
610
  const mcpRule = resolvedMcpConfig
607
- ? `(allow file-read* file-test-existence ${subpath(resolvedMcpConfig)})`
611
+ ? [
612
+ `(allow file-read* file-test-existence ${subpath(resolvedMcpConfig)})`,
613
+ `(allow file-read-metadata file-test-existence (path-ancestors "${escapeSbplString(resolvedMcpConfig)}"))`,
614
+ ].join('\n')
608
615
  : '';
609
616
  const readOnlyRules = resolvedReadOnlyPaths.map((path) => (
610
617
  `(allow file-read* file-test-existence ${literal(path)})`