@commonlyai/cli 0.1.354 → 0.1.356
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 +5 -0
- package/src/lib/adapters/dsh.js +13 -3
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -2363,6 +2363,11 @@ export const performRun = ({
|
|
|
2363
2363
|
const scratchCwd = join(tmpdir(), 'commonly-agents', stateKey);
|
|
2364
2364
|
const agentCwd = workspacePath || scratchCwd;
|
|
2365
2365
|
if (!existsSync(agentCwd)) mkdirSync(agentCwd, { recursive: true });
|
|
2366
|
+
// A workspace seat still mounts its skills into the scratch folder (the
|
|
2367
|
+
// claude adapter's skillMountDir), and that mount's mkdir is not recursive:
|
|
2368
|
+
// on a machine that never ran this seat without a workspace, the first
|
|
2369
|
+
// turn failed ENOENT and opened the circuit.
|
|
2370
|
+
if (!existsSync(scratchCwd)) mkdirSync(scratchCwd, { recursive: true });
|
|
2366
2371
|
// TASK-294: a pod can turn public after attach, so a workspace seat re-reads
|
|
2367
2372
|
// its pods before every turn, and a turn it cannot confirm (a failed read
|
|
2368
2373
|
// included) runs as a public seat in the scratch folder. The session is
|
package/src/lib/adapters/dsh.js
CHANGED
|
@@ -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
|
-
|
|
235
|
-
|
|
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 ? {
|