@commonlyai/cli 0.1.385 → 0.1.386
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
|
@@ -53,7 +53,7 @@ import { describeTurnReap, markTurn, turnReapEnabled } from '@commonlyai/seats/t
|
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
55
|
import { requireSeatModel, seatModelRequired } from './seat-model.js';
|
|
56
|
-
import { claudeRunStats } from '../reply-receipt.js';
|
|
56
|
+
import { buildReplyReceipt, claudeRunStats, REPLY_RECEIPT_ENV } from '../reply-receipt.js';
|
|
57
57
|
import { spawn as childSpawn, spawnSync } from 'child_process';
|
|
58
58
|
import {
|
|
59
59
|
createHash, randomBytes, randomUUID, timingSafeEqual,
|
|
@@ -112,6 +112,7 @@ import { skillsAsText } from '../skill-prompt.js';
|
|
|
112
112
|
import { adapterFailure, redactKnownCredentials, spawnCredentials } from '../upstream-refusal.js';
|
|
113
113
|
import { PUBLIC_WITHHELD_TOOLS, publicSeatWithheldTools } from '../public-withheld-tools.js';
|
|
114
114
|
import { isShippedCommonlyMcpCommand } from '../declared-mcp-guard.js';
|
|
115
|
+
import { describeMcpCommand } from '../mcp-server-version.js';
|
|
115
116
|
import { isAnswerableToolError, PUBLIC_MCP_NOT_READY_CODE, PUBLIC_TOOL_FAILED_CODE } from '../public-tool-error.js';
|
|
116
117
|
import { resolveLaunch, resolveMcpCommand, resolveWindowsCommandWithReason } from '../windows-command.js';
|
|
117
118
|
import { startProviderProxy } from '../provider-proxy.js';
|
|
@@ -1282,6 +1283,12 @@ const buildMcpConfig = (mcpServers, ctx = {}) => {
|
|
|
1282
1283
|
// read the credential (a path, not a secret). An older warm build refuses.
|
|
1283
1284
|
const readyPath = spawnCommand ? commonlyMcpReadyFile(server, spawnCommand, ctx, { env: entry.env }) : null;
|
|
1284
1285
|
if (readyPath) entry.env = { ...(entry.env || {}), [MCP_READY_FILE_ENV]: readyPath };
|
|
1286
|
+
// F546: only our server posts replies, so only it is told what this spawn
|
|
1287
|
+
// runs with.
|
|
1288
|
+
if (ctx.replyReceipt && spawnCommand
|
|
1289
|
+
&& (isShippedCommonlyMcpCommand(server.command) || describeMcpCommand(spawnCommand)?.isCommonly)) {
|
|
1290
|
+
entry.env = { ...(entry.env || {}), [REPLY_RECEIPT_ENV]: JSON.stringify(ctx.replyReceipt) };
|
|
1291
|
+
}
|
|
1285
1292
|
const headerHelper = ctx.dynamicHeaderHelpers?.get(server.name);
|
|
1286
1293
|
if (server.headers) {
|
|
1287
1294
|
const headers = { ...server.headers };
|
|
@@ -2071,6 +2078,14 @@ export default {
|
|
|
2071
2078
|
publicSeat: publicTrust,
|
|
2072
2079
|
platform: ctx._platform || process.platform,
|
|
2073
2080
|
commandResolution: { env: withClaudePath(ctx.env), ...ctx._commandResolution },
|
|
2081
|
+
// Claude expands ${…} in this env, so a control holding a `$` (a model
|
|
2082
|
+
// id is free text) is left out rather than handed a credential.
|
|
2083
|
+
replyReceipt: buildReplyReceipt({
|
|
2084
|
+
adapterName: 'claude',
|
|
2085
|
+
stats: Object.fromEntries(Object.entries(
|
|
2086
|
+
controlsFromArguments(modelArgs, { modelFlag: '--model', effortFlag: '--effort' }),
|
|
2087
|
+
).filter(([, value]) => !String(value ?? '').includes('$'))),
|
|
2088
|
+
}),
|
|
2074
2089
|
});
|
|
2075
2090
|
}
|
|
2076
2091
|
if (mcpConfig?.unavailableMcp.length) throw publicMcpUnavailableError(mcpConfig.unavailableMcp);
|
package/src/lib/reply-receipt.js
CHANGED
|
@@ -35,6 +35,15 @@ export const claudeRunStats = (stdout) => {
|
|
|
35
35
|
return stats;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* F546: the receipt a spawn's Commonly MCP server attaches to the posts it
|
|
40
|
+
* makes, as JSON. An agent that answers with its own commonly_post_message
|
|
41
|
+
* call never goes through the wrapper's post, so this is how its reply names
|
|
42
|
+
* the adapter, model and effort the spawn ran with. Turns, tools and duration
|
|
43
|
+
* are only known after the turn, so they are not in it.
|
|
44
|
+
*/
|
|
45
|
+
export const REPLY_RECEIPT_ENV = 'COMMONLY_REPLY_RECEIPT';
|
|
46
|
+
|
|
38
47
|
/** The receipt for one reply, or null when there is no adapter to name. */
|
|
39
48
|
export const buildReplyReceipt = ({ adapterName, stats = {}, durationMs } = {}) => {
|
|
40
49
|
if (!isName(adapterName)) return null;
|