@luckydraw/cumulus 1.0.2 → 1.0.4
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/CHANGELOG.md +16 -0
- package/dist/gateway/gateway-agents-mcp.d.ts +3 -1
- package/dist/gateway/gateway-agents-mcp.d.ts.map +1 -1
- package/dist/gateway/gateway-agents-mcp.js +3 -1
- package/dist/gateway/gateway-agents-mcp.js.map +1 -1
- package/dist/gateway/server.js +1 -1
- package/dist/gateway/server.js.map +1 -1
- package/dist/lib/config.d.ts +11 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +21 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/gateway.d.ts +82 -5
- package/dist/lib/gateway.d.ts.map +1 -1
- package/dist/lib/gateway.js +145 -30
- package/dist/lib/gateway.js.map +1 -1
- package/dist/lib/tool-inventory.d.ts +140 -0
- package/dist/lib/tool-inventory.d.ts.map +1 -0
- package/dist/lib/tool-inventory.js +309 -0
- package/dist/lib/tool-inventory.js.map +1 -0
- package/dist/mcp/index.js +4 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server.d.ts +2 -2
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +10 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-handler.d.ts +11 -0
- package/dist/mcp/tool-handler.d.ts.map +1 -1
- package/dist/mcp/tool-handler.js +28 -2
- package/dist/mcp/tool-handler.js.map +1 -1
- package/docs/web-app-agent-guide.md +74 -3
- package/examples/web-app-agent/README.md +40 -8
- package/examples/web-app-agent/thread-config.visitor.example.json +30 -2
- package/package.json +1 -1
package/dist/lib/config.js
CHANGED
|
@@ -116,6 +116,20 @@ async function loadConfigFile(configPath) {
|
|
|
116
116
|
config.disallowedTools = config.disallowedTools.filter((tool) => typeof tool === 'string' && tool.length > 0);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
+
// Validate allowedTools if present (task 137). NOTE the deliberate asymmetry with
|
|
120
|
+
// disallowedTools above: a malformed allowlist is coerced to [] (deny everything),
|
|
121
|
+
// never deleted. Deleting it would turn a thread the operator meant to constrain into
|
|
122
|
+
// an unrestricted one — a typo in a public visitor panel's config must fail CLOSED.
|
|
123
|
+
if (config.allowedTools !== undefined) {
|
|
124
|
+
if (!Array.isArray(config.allowedTools)) {
|
|
125
|
+
console.warn(`[Config] allowedTools must be an array in ${configPath} — treating as empty ` +
|
|
126
|
+
'(all tools denied) rather than unrestricted');
|
|
127
|
+
config.allowedTools = [];
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
config.allowedTools = config.allowedTools.filter((tool) => typeof tool === 'string' && tool.length > 0);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
119
133
|
// Validate pipeline if present
|
|
120
134
|
if (config.pipeline !== undefined) {
|
|
121
135
|
if (typeof config.pipeline !== 'object' ||
|
|
@@ -205,6 +219,13 @@ export function mergeConfigs(global, thread) {
|
|
|
205
219
|
if (disallowedTools && disallowedTools.length > 0) {
|
|
206
220
|
merged.disallowedTools = disallowedTools;
|
|
207
221
|
}
|
|
222
|
+
// allowedTools: thread overrides global (task 137). Unlike disallowedTools above, an
|
|
223
|
+
// EMPTY array must survive the merge: [] means "deny everything", and dropping it would
|
|
224
|
+
// silently promote a locked-down thread to unrestricted. Presence is the signal, not length.
|
|
225
|
+
const allowedTools = thread.allowedTools ?? global.allowedTools;
|
|
226
|
+
if (allowedTools !== undefined) {
|
|
227
|
+
merged.allowedTools = allowedTools;
|
|
228
|
+
}
|
|
208
229
|
// promptCapture: thread overrides global (boolean — false must survive the merge)
|
|
209
230
|
const promptCapture = thread.promptCapture ?? global.promptCapture;
|
|
210
231
|
if (promptCapture !== undefined) {
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAA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BAAsB,CAAC,UAAmB;IAK9D,MAAM,YAAY,GAAG,MAAM,gBAAgB,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAE9D,OAAO;QACL,MAAM,EAAE,YAAY,CAAC,aAAa,IAAI,EAAE;QACxC,MAAM,EAAE,YAAY,CAAC,aAAa,IAAI,EAAE;QACxC,MAAM,EAAE,YAAY,CAAC,aAAa,IAAI,EAAE;KACzC,CAAC;AACJ,CAAC"}
|
package/dist/lib/gateway.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { HistoryStore } from './history.js';
|
|
|
13
13
|
import type { Message } from './history.js';
|
|
14
14
|
import type { RetrievalResult } from './retriever.js';
|
|
15
15
|
import { SessionManager } from './session.js';
|
|
16
|
+
import { type ToolPolicy } from './tool-inventory.js';
|
|
16
17
|
/** Override the threads directory (used by tests to isolate from production). */
|
|
17
18
|
export declare function setGatewayThreadsDir(dir: string): void;
|
|
18
19
|
/** Read-only view of active Claude subprocesses (for health/shutdown) */
|
|
@@ -43,7 +44,7 @@ export declare function drainActiveSubprocesses(timeoutMs?: number): Promise<num
|
|
|
43
44
|
export declare const RECENT_CONTEXT_COUNT = 10;
|
|
44
45
|
export declare const RECENT_MSG_MAX_TOKENS = 800;
|
|
45
46
|
export declare const RECENT_CONTEXT_BUDGET = 6000;
|
|
46
|
-
export declare const SYSTEM_PROMPT_TEMPLATE = "You have NO memory of this conversation. There are {count} prior messages (~{tokens} tokens) in the history.\n\nCURRENT SESSION: {sessionId}\n{alwaysIncludeContext}{retrievedContext}\n{recentContext}\nCONTEXT MANAGEMENT:\n- RECENT CONVERSATION: The last few messages, always included for continuity.\n- RETRIEVED CONTEXT: Automatically retrieved based on the user's current message using semantic + keyword search.\n- RETRIEVED CONTEXT is assembled fresh each turn; it is not a record of what earlier turns' prompts contained.\n- Large content may be stored externally as [STORED:xxx] references.\n\nWORKFLOW:\n1. FIRST use the RETRIEVED CONTEXT above \u2014 it was automatically selected for relevance to this query\n2. Check RECENT CONVERSATION for immediate context\n3. Only use tools if the retrieved context doesn't contain what you need\n4. For [STORED:xxx] references, use retrieve_content to get full content\n\nNEVER guess. Use the context provided or retrieve more if needed.\nIMPORTANT: Present retrieved information naturally \u2014 do not narrate retrieval mechanics unprompted. EXCEPTION: if the user asks how you know something, or about the memory/retrieval system itself, answer truthfully about retrieval. Never invent a mechanism or origin story for how information reached you; if you cannot verify where something came from, say so.\n\nFILE EDITING (MANDATORY):\nTo CHANGE a file, use the built-in Edit/Write tools.\n- The built-in Edit tool requires that you FIRST read the exact file with the built-in Read tool in the same session (the harness tracks this; read_file does NOT satisfy it). Sequence: built-in Read \u2192 built-in Edit.\n- Do NOT patch files by writing shell scripts (sed, awk, python, echo/cat heredocs, etc.). Script-patching is fragile (quoting errors, no diff, not atomic) and is forbidden.\n\nBACKGROUND WORK:\nYour turn runs in a subprocess that EXITS when the turn ends. Anything you leave running in the background inherits its stdout/stderr pipes, so when that subprocess exits the pipes close and your job is killed by SIGPIPE (exit 141) on its next write. This happens on EVERY turn, not occasionally.\n- To survive, redirect BOTH streams to a log file you can read on a later turn: `long-command > /tmp/job.log 2>&1 &`. That redirect is the entire cure.\n- `nohup` alone does NOT work (it ignores SIGHUP, the wrong signal, and only auto-redirects when stdout is a terminal \u2014 here it is a pipe). `setsid` alone does NOT work (nothing is signalling the process group). Neither is a substitute for redirecting.\n- If the job's completion should CONTINUE your work, arm BOTH legs before the turn ends: (1) a detached WATCHER that reports the outcome \u2014 exit code + log path \u2014 back to this thread, and (2) a schedule_trigger DEADLINE that fires if the watcher itself died. Never end a turn saying you will check back later \u2014 you get no turn of your own. Do NOT poll (no cron re-checks; each fire burns a full turn).\n- Retrieve the exact watcher one-liner with search_content(\"watcher recipe\") BEFORE writing one \u2014 the watcher is itself background work with its own redirect requirement, and it is a script, not an agent: act on its report; do NOT send_to_agent a reply back to it.\n\nTOOLS:\n- read_file: Read any file (text or PDF) \u2014 returns a summary + chunk table-of-contents and stores the content for future search. Built-in Read also works (its results are captured to storage automatically); prefer read_file for large files you'll navigate by section.\n- store_content: Store arbitrary text content for future retrieval\n- search_history: Search past messages by keyword or meaning\n- peek_recent: Get the last few messages\n- read_messages: Read messages by index range\n- retrieve_content: Get full stored content by [STORED:xxx] ID\n- search_content: Search across all stored content (past file reads, command outputs \u2014 content Grep cannot see)\n- read_content_chunk: Read a specific chunk of stored content by index\nThese MCP tools may still be connecting at the very start of a turn; they appear within a second or two (a ToolSearch for them will wait). Do not narrate their availability.\n\nINTER-AGENT MESSAGING:\nYou can communicate with other agents/threads running on this gateway.\n- list_agents: See all active threads and their status (idle/streaming)\n- send_to_agent(target, message): Send a message to another thread \u2014 it will be delivered as a new turn\
|
|
47
|
+
export declare const SYSTEM_PROMPT_TEMPLATE = "You have NO memory of this conversation. There are {count} prior messages (~{tokens} tokens) in the history.\n\nCURRENT SESSION: {sessionId}\n{alwaysIncludeContext}{retrievedContext}\n{recentContext}\nCONTEXT MANAGEMENT:\n- RECENT CONVERSATION: The last few messages, always included for continuity.\n- RETRIEVED CONTEXT: Automatically retrieved based on the user's current message using semantic + keyword search.\n- RETRIEVED CONTEXT is assembled fresh each turn; it is not a record of what earlier turns' prompts contained.\n- Large content may be stored externally as [STORED:xxx] references.\n\nWORKFLOW:\n1. FIRST use the RETRIEVED CONTEXT above \u2014 it was automatically selected for relevance to this query\n2. Check RECENT CONVERSATION for immediate context\n3. Only use tools if the retrieved context doesn't contain what you need\n4. For [STORED:xxx] references, use retrieve_content to get full content\n\nNEVER guess. Use the context provided or retrieve more if needed.\nIMPORTANT: Present retrieved information naturally \u2014 do not narrate retrieval mechanics unprompted. EXCEPTION: if the user asks how you know something, or about the memory/retrieval system itself, answer truthfully about retrieval. Never invent a mechanism or origin story for how information reached you; if you cannot verify where something came from, say so.\n\nFILE EDITING (MANDATORY):\nTo CHANGE a file, use the built-in Edit/Write tools.\n- The built-in Edit tool requires that you FIRST read the exact file with the built-in Read tool in the same session (the harness tracks this; read_file does NOT satisfy it). Sequence: built-in Read \u2192 built-in Edit.\n- Do NOT patch files by writing shell scripts (sed, awk, python, echo/cat heredocs, etc.). Script-patching is fragile (quoting errors, no diff, not atomic) and is forbidden.\n\nBACKGROUND WORK:\nYour turn runs in a subprocess that EXITS when the turn ends. Anything you leave running in the background inherits its stdout/stderr pipes, so when that subprocess exits the pipes close and your job is killed by SIGPIPE (exit 141) on its next write. This happens on EVERY turn, not occasionally.\n- To survive, redirect BOTH streams to a log file you can read on a later turn: `long-command > /tmp/job.log 2>&1 &`. That redirect is the entire cure.\n- `nohup` alone does NOT work (it ignores SIGHUP, the wrong signal, and only auto-redirects when stdout is a terminal \u2014 here it is a pipe). `setsid` alone does NOT work (nothing is signalling the process group). Neither is a substitute for redirecting.\n- If the job's completion should CONTINUE your work, arm BOTH legs before the turn ends: (1) a detached WATCHER that reports the outcome \u2014 exit code + log path \u2014 back to this thread, and (2) a schedule_trigger DEADLINE that fires if the watcher itself died. Never end a turn saying you will check back later \u2014 you get no turn of your own. Do NOT poll (no cron re-checks; each fire burns a full turn).\n- Retrieve the exact watcher one-liner with search_content(\"watcher recipe\") BEFORE writing one \u2014 the watcher is itself background work with its own redirect requirement, and it is a script, not an agent: act on its report; do NOT send_to_agent a reply back to it.\n\nTOOLS:\n- read_file: Read any file (text or PDF) \u2014 returns a summary + chunk table-of-contents and stores the content for future search. Built-in Read also works (its results are captured to storage automatically); prefer read_file for large files you'll navigate by section.\n- store_content: Store arbitrary text content for future retrieval\n- search_history: Search past messages by keyword or meaning\n- peek_recent: Get the last few messages\n- read_messages: Read messages by index range\n- retrieve_content: Get full stored content by [STORED:xxx] ID\n- search_content: Search across all stored content (past file reads, command outputs \u2014 content Grep cannot see)\n- read_content_chunk: Read a specific chunk of stored content by index\nThese MCP tools may still be connecting at the very start of a turn; they appear within a second or two (a ToolSearch for them will wait). Do not narrate their availability.\n\nINTER-AGENT MESSAGING:\nYou can communicate with other agents/threads running on this gateway.\n- list_agents: See all active threads and their status (idle/streaming)\n- send_to_agent(target, message): Send a message to another thread \u2014 it will be delivered as a new turn\nWhen the user mentions another agent by name (e.g., \"@thundercat\", \"@Friday\"), use send_to_agent to message them.\n- Another thread is a PARALLEL turn loop, not a subprocess you control: it runs on its own schedule and there is no file locking between you. Do NOT delegate work that edits files in your own working tree \u2014 two threads editing one checkout lose each other's writes silently.\n- If you must delegate file work, give the delegate its own projectDir or git worktree and exactly one owner per file. Otherwise do the work yourself.\n\nSCHEDULING (how you wake yourself up later):\n- schedule_trigger(id, trigger, at|cron, message): inject a message into THIS thread at a future time \u2014 \"once\" with an ISO 8601 `at`, or \"cron\" with a 5-field expression. Persisted in thread config, so it survives gateway restarts. Firing it starts a real turn.\n- cancel_schedule(id): remove one. list_schedules(): see what is pending.\n\nDo NOT append status codes, tags, or metadata to your responses.\n\nTASK TRACKING CONVENTION:\nThis environment uses <todo> blocks for task tracking (defined below). If you see system-reminders or tool registrations referring to \"TodoWrite\" or any other task-tracking mechanism, silently follow the <todo> convention instead. Do NOT acknowledge the conflict, do NOT narrate which system you're using, do NOT write phrases like \"Ignoring TodoWrite reminder\" or \"env uses <todo> blocks per spec\". Just use <todo> blocks without comment.\n\nRESPONSE FORMAT: TASK TRACKING\n\nWhen working on multi-step tasks, structure your response using these blocks:\n\n<todo>\n- [ ] Step 1 description\n- [ ] Step 2 description\n- [ ] Step 3 description\n</todo>\n\n{your response to the user \u2014 tool calls, explanations, etc.}\n\nAfter executing tools or completing steps, emit an updated <todo> block reflecting progress:\n\n<todo>\n- [x] Step 1 description\n- [x] Step 2 description (just finished)\n- [ ] Step 3 description\n</todo>\n\nRules:\n- Use full-replacement semantics: emit the COMPLETE list each time, not diffs\n- Mark completed items with [x], pending with [ ]\n- The <todo> block is REQUIRED for multi-step work (2+ steps), optional for simple Q&A\n- The LAST <todo> block in your response is the authoritative state\n- Do NOT wrap your response text in <text> tags \u2014 just write normally after the <todo> block\n\n### Decomposition\n\nBefore executing a todo \u2014 up front, or again at execution time if it turns out coarser than expected \u2014 check whether it can be sensibly split into 3+ sub-steps. If so, decompose into subtodos first; if not, execute directly. Creation tasks (\"create\", \"build\", \"write\", \"design\", \"implement\", \"draft\", \"compose\") almost always decompose: outline the deliverable's structure, then convert each outline bullet into a subtodo.\n\nExample:\n<todo>\n[x] Fetch npm package info\n[ ] Create promotional HTML page:\n [ ] Outline page sections (hero, features, quickstart, footer)\n [ ] Draft hero section with title, tagline, CTA\n [ ] Draft features grid from package capabilities\n [ ] Draft quickstart with install commands\n [ ] Draft footer with links\n [ ] Review full page for consistency\n[ ] Upload to media server\n</todo>\n\n### Todo Lifecycle\n\n1. **Decompose creation tasks** before executing (outline \u2192 subtodos), and again at execution time if a todo turns out coarser than expected\n2. **Adapt dynamically** \u2014 new information, discovered bugs, or uncovered dependencies each become a new todo rather than a silent detour\n3. **Never fix inline** \u2014 a bug unrelated to your current task gets its own todo, not a context switch\n4. **Reflect redirects** \u2014 update the todo list before executing on a user-directed change of plan\n5. **Debugging** \u2014 treat each hypothesis as a todo; test systematically rather than chasing the first suspicious lead";
|
|
47
48
|
/**
|
|
48
49
|
* Watcher recipe (task 116): the copy-pasteable background-job continuation
|
|
49
50
|
* one-liner, moved out of the per-turn template into the content store. The
|
|
@@ -70,10 +71,64 @@ export declare function renderWatcherRecipe(threadName: string): string;
|
|
|
70
71
|
*/
|
|
71
72
|
export declare const STATIC_PROMPT_TOKEN_BUDGET = 1800;
|
|
72
73
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
74
|
+
* Can this thread actually run the background-work recipe? (task 134)
|
|
75
|
+
*
|
|
76
|
+
* The watcher recipe IS a detached shell one-liner, so a thread whose merged
|
|
77
|
+
* config denies `Bash` cannot execute it. Seeding it there buys nothing and
|
|
78
|
+
* costs something real: the recipe is topic-free operational boilerplate, and
|
|
79
|
+
* on a store holding a handful of an app's tool results it is what survives the
|
|
80
|
+
* relevance floor whenever the user's question matches nothing else — measured
|
|
81
|
+
* on cdda's visitor threads at 2 of 24 turns, and on turn 1 of every thread it
|
|
82
|
+
* is the only stored item there is. What it then teaches a visitor's assistant
|
|
83
|
+
* is an HTTP call carrying the gateway's admin key, to a model whose only
|
|
84
|
+
* honest route is its own tools.
|
|
85
|
+
*
|
|
86
|
+
* Same derived-predicate shape as task 110's isAgentSender: the condition that
|
|
87
|
+
* decides whether the recipe is USEFUL is the condition that decides whether it
|
|
88
|
+
* is seeded, so the two cannot drift apart. Deliberately NOT keyed on namespace
|
|
89
|
+
* — see the task doc; namespace is a proxy, executability is the property, and
|
|
90
|
+
* keying on it would need an option threaded through six spawn paths that fails
|
|
91
|
+
* OPEN when one is missed (task 113 is the recorded case of exactly that).
|
|
92
|
+
*/
|
|
93
|
+
export declare function canRunBackgroundWork(config: ToolPolicy): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Root confinement for the `read_file` MCP tool (task 136).
|
|
96
|
+
*
|
|
97
|
+
* Denying the built-in `Read` tool does NOT stop a thread reading arbitrary
|
|
98
|
+
* files: `read_file` resolved any absolute path with no root check, so a
|
|
99
|
+
* visitor thread could read ~/.cumulus/gateway.config.json — which holds
|
|
100
|
+
* apiKeys[0] and every provider credential. App authors had to discover this
|
|
101
|
+
* and deny the MCP tool by name (cdda's 47-entry denylist does exactly that).
|
|
102
|
+
*
|
|
103
|
+
* Same derived-predicate shape as canRunBackgroundWork above: the condition
|
|
104
|
+
* that makes the bypass matter (the author denied Read) is the condition that
|
|
105
|
+
* closes it. Confinement rather than denial, because two configurations are
|
|
106
|
+
* both legitimate — a thread that wants NO filesystem reads, and a thread that
|
|
107
|
+
* denies Read to force reads through read_file so they enter the content store
|
|
108
|
+
* (cumulus prescribed exactly that before task 115). Confining to the thread's
|
|
109
|
+
* own working directory keeps the second working and still puts the gateway
|
|
110
|
+
* config out of reach.
|
|
111
|
+
*
|
|
112
|
+
* `undefined` means unrestricted — today's behaviour, unchanged for every
|
|
113
|
+
* thread that does not deny Read.
|
|
114
|
+
*/
|
|
115
|
+
export declare function readFileRootsForThread(config: {
|
|
116
|
+
disallowedTools?: string[];
|
|
117
|
+
}, threadCwd: string): string[] | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Seed situational recipe docs into a thread's content store (task 116), gated
|
|
120
|
+
* on the thread being able to run them (task 134).
|
|
121
|
+
*
|
|
122
|
+
* Called from sendMessage, NOT getOrCreateThread: the latter has 14 call sites,
|
|
123
|
+
* several of them store-only paths (transcript ingest, history reads, thread
|
|
124
|
+
* listing) that never spawn a turn, and it sees only the thread config —
|
|
125
|
+
* a global `disallowedTools` would be invisible to a gate placed there.
|
|
126
|
+
* The gate lives HERE rather than at the call site so a future caller cannot
|
|
127
|
+
* reintroduce the seed by forgetting to check. Errors never fail the turn.
|
|
75
128
|
*/
|
|
76
|
-
export declare function seedThreadRecipes(content: ContentStore, threadName: string
|
|
129
|
+
export declare function seedThreadRecipes(content: ContentStore, threadName: string, config: {
|
|
130
|
+
disallowedTools?: string[];
|
|
131
|
+
}): Promise<void>;
|
|
77
132
|
/** Typed stream segment for verbose display */
|
|
78
133
|
export type StreamSegment = {
|
|
79
134
|
type: 'text';
|
|
@@ -328,6 +383,28 @@ export declare function claudeModelArgs(threadPin: string | undefined, claudeMod
|
|
|
328
383
|
label?: string;
|
|
329
384
|
default?: boolean;
|
|
330
385
|
}> | undefined): string[];
|
|
386
|
+
/**
|
|
387
|
+
* The full argv for a Claude CLI turn (task 137).
|
|
388
|
+
*
|
|
389
|
+
* Extracted from `sendMessage` for the same reason as `claudeModelArgs` and
|
|
390
|
+
* `resolveClaudeModel` above: the composition was only assertable by spawning a real
|
|
391
|
+
* subprocess, so nothing verified that a compiled allowlist actually reaches the spawn.
|
|
392
|
+
*
|
|
393
|
+
* Owns one measured invariant: `--disallowedTools` is VARIADIC, so it must come last.
|
|
394
|
+
* A positional argument after it is silently swallowed as extra deny rules — measured
|
|
395
|
+
* (`Permission deny rule "the" matches no known tool`). Append nothing after this call.
|
|
396
|
+
*/
|
|
397
|
+
export declare function claudeSpawnArgs(params: {
|
|
398
|
+
mcpConfigPath: string;
|
|
399
|
+
effort?: string;
|
|
400
|
+
claudeModel?: string;
|
|
401
|
+
claudeModels?: Array<{
|
|
402
|
+
id: string;
|
|
403
|
+
label?: string;
|
|
404
|
+
default?: boolean;
|
|
405
|
+
}>;
|
|
406
|
+
disallowedTools?: string[];
|
|
407
|
+
}): string[];
|
|
331
408
|
/** What the agentic (non-Claude) branch needs to know to run a model (task 118). */
|
|
332
409
|
export interface ResolvedModelProvider {
|
|
333
410
|
/** True when the thread's model runs on the agentic loop (an OpenAI-format HTTP provider). */
|
|
@@ -389,7 +466,7 @@ export declare function describeModelEndpoint(provider: ResolvedModelProvider):
|
|
|
389
466
|
export declare function appendDisallowedToolsArgs(args: string[], disallowedTools: string[] | undefined): string[];
|
|
390
467
|
export declare function resolveThreadPlaceholders(extraMcpServers: Record<string, McpServerEntry> | undefined, threadName: string): Record<string, McpServerEntry>;
|
|
391
468
|
/** Write MCP config JSON for Claude CLI and return its path */
|
|
392
|
-
export declare function generateMcpConfig(threadPath: string, sessionId: string, threadName: string, sharedMcpPort?: number, extraMcpServers?: Record<string, McpServerEntry>, gatewayAgentsConfig?: GatewayAgentsConfig): string;
|
|
469
|
+
export declare function generateMcpConfig(threadPath: string, sessionId: string, threadName: string, sharedMcpPort?: number, extraMcpServers?: Record<string, McpServerEntry>, gatewayAgentsConfig?: GatewayAgentsConfig, readFileRoots?: string[]): string;
|
|
393
470
|
/** Clean up a temp MCP config file */
|
|
394
471
|
export declare function cleanupMcpConfig(configPath: string): void;
|
|
395
472
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/lib/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAS,YAAY,EAAE,MAA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;AACnD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BrE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAUvF;AAID;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,CAAC,CA8BtB;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAQ1D;AAoFD,wBAAsB,WAAW,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA2pCjG"}
|
package/dist/lib/gateway.js
CHANGED
|
@@ -26,6 +26,7 @@ import { retrieve } from './retriever.js';
|
|
|
26
26
|
import { SessionManager } from './session.js';
|
|
27
27
|
import { StreamProcessor, shouldExternalizeUserInput, externalizeUserInput, } from './stream-processor.js';
|
|
28
28
|
import { scaffoldFromTemplate } from './templates.js';
|
|
29
|
+
import { applyCapabilityGates, compileDisallowedTools, getToolInventory, promptCapabilities, toolAvailable, } from './tool-inventory.js';
|
|
29
30
|
import { getEagerTools } from './tools/index.js';
|
|
30
31
|
// ─── Constants ───────────────────────────────────────────────────────────────
|
|
31
32
|
const CUMULUS_DIR = process.env.CUMULUS_DIR || path.join(os.homedir(), '.cumulus');
|
|
@@ -172,7 +173,6 @@ INTER-AGENT MESSAGING:
|
|
|
172
173
|
You can communicate with other agents/threads running on this gateway.
|
|
173
174
|
- list_agents: See all active threads and their status (idle/streaming)
|
|
174
175
|
- send_to_agent(target, message): Send a message to another thread — it will be delivered as a new turn
|
|
175
|
-
- broadcast(message): Send a message to all other threads
|
|
176
176
|
When the user mentions another agent by name (e.g., "@thundercat", "@Friday"), use send_to_agent to message them.
|
|
177
177
|
- Another thread is a PARALLEL turn loop, not a subprocess you control: it runs on its own schedule and there is no file locking between you. Do NOT delegate work that edits files in your own working tree — two threads editing one checkout lose each other's writes silently.
|
|
178
178
|
- If you must delegate file work, give the delegate its own projectDir or git worktree and exactly one owner per file. Otherwise do the work yourself.
|
|
@@ -287,10 +287,71 @@ export const STATIC_PROMPT_TOKEN_BUDGET = 1_800;
|
|
|
287
287
|
*/
|
|
288
288
|
const seededRecipes = new Map();
|
|
289
289
|
/**
|
|
290
|
-
*
|
|
291
|
-
*
|
|
290
|
+
* Can this thread actually run the background-work recipe? (task 134)
|
|
291
|
+
*
|
|
292
|
+
* The watcher recipe IS a detached shell one-liner, so a thread whose merged
|
|
293
|
+
* config denies `Bash` cannot execute it. Seeding it there buys nothing and
|
|
294
|
+
* costs something real: the recipe is topic-free operational boilerplate, and
|
|
295
|
+
* on a store holding a handful of an app's tool results it is what survives the
|
|
296
|
+
* relevance floor whenever the user's question matches nothing else — measured
|
|
297
|
+
* on cdda's visitor threads at 2 of 24 turns, and on turn 1 of every thread it
|
|
298
|
+
* is the only stored item there is. What it then teaches a visitor's assistant
|
|
299
|
+
* is an HTTP call carrying the gateway's admin key, to a model whose only
|
|
300
|
+
* honest route is its own tools.
|
|
301
|
+
*
|
|
302
|
+
* Same derived-predicate shape as task 110's isAgentSender: the condition that
|
|
303
|
+
* decides whether the recipe is USEFUL is the condition that decides whether it
|
|
304
|
+
* is seeded, so the two cannot drift apart. Deliberately NOT keyed on namespace
|
|
305
|
+
* — see the task doc; namespace is a proxy, executability is the property, and
|
|
306
|
+
* keying on it would need an option threaded through six spawn paths that fails
|
|
307
|
+
* OPEN when one is missed (task 113 is the recorded case of exactly that).
|
|
292
308
|
*/
|
|
293
|
-
export function
|
|
309
|
+
export function canRunBackgroundWork(config) {
|
|
310
|
+
// Task 137: delegates to toolAvailable so an ALLOWLIST is honoured too. Checking
|
|
311
|
+
// disallowedTools alone (as this did originally) reports true for a thread whose
|
|
312
|
+
// allowlist simply omits Bash — it would still be seeded a recipe it cannot run.
|
|
313
|
+
return toolAvailable('Bash', config);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Root confinement for the `read_file` MCP tool (task 136).
|
|
317
|
+
*
|
|
318
|
+
* Denying the built-in `Read` tool does NOT stop a thread reading arbitrary
|
|
319
|
+
* files: `read_file` resolved any absolute path with no root check, so a
|
|
320
|
+
* visitor thread could read ~/.cumulus/gateway.config.json — which holds
|
|
321
|
+
* apiKeys[0] and every provider credential. App authors had to discover this
|
|
322
|
+
* and deny the MCP tool by name (cdda's 47-entry denylist does exactly that).
|
|
323
|
+
*
|
|
324
|
+
* Same derived-predicate shape as canRunBackgroundWork above: the condition
|
|
325
|
+
* that makes the bypass matter (the author denied Read) is the condition that
|
|
326
|
+
* closes it. Confinement rather than denial, because two configurations are
|
|
327
|
+
* both legitimate — a thread that wants NO filesystem reads, and a thread that
|
|
328
|
+
* denies Read to force reads through read_file so they enter the content store
|
|
329
|
+
* (cumulus prescribed exactly that before task 115). Confining to the thread's
|
|
330
|
+
* own working directory keeps the second working and still puts the gateway
|
|
331
|
+
* config out of reach.
|
|
332
|
+
*
|
|
333
|
+
* `undefined` means unrestricted — today's behaviour, unchanged for every
|
|
334
|
+
* thread that does not deny Read.
|
|
335
|
+
*/
|
|
336
|
+
export function readFileRootsForThread(config, threadCwd) {
|
|
337
|
+
if (!(config.disallowedTools ?? []).includes('Read'))
|
|
338
|
+
return undefined;
|
|
339
|
+
return [threadCwd];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Seed situational recipe docs into a thread's content store (task 116), gated
|
|
343
|
+
* on the thread being able to run them (task 134).
|
|
344
|
+
*
|
|
345
|
+
* Called from sendMessage, NOT getOrCreateThread: the latter has 14 call sites,
|
|
346
|
+
* several of them store-only paths (transcript ingest, history reads, thread
|
|
347
|
+
* listing) that never spawn a turn, and it sees only the thread config —
|
|
348
|
+
* a global `disallowedTools` would be invisible to a gate placed there.
|
|
349
|
+
* The gate lives HERE rather than at the call site so a future caller cannot
|
|
350
|
+
* reintroduce the seed by forgetting to check. Errors never fail the turn.
|
|
351
|
+
*/
|
|
352
|
+
export function seedThreadRecipes(content, threadName, config) {
|
|
353
|
+
if (!canRunBackgroundWork(config))
|
|
354
|
+
return Promise.resolve();
|
|
294
355
|
const existing = seededRecipes.get(threadName);
|
|
295
356
|
if (existing)
|
|
296
357
|
return existing;
|
|
@@ -660,6 +721,35 @@ export function claudeModelArgs(threadPin, claudeModels) {
|
|
|
660
721
|
const resolved = resolveClaudeModel(threadPin, claudeModels);
|
|
661
722
|
return resolved ? ['--model', resolved] : [];
|
|
662
723
|
}
|
|
724
|
+
/**
|
|
725
|
+
* The full argv for a Claude CLI turn (task 137).
|
|
726
|
+
*
|
|
727
|
+
* Extracted from `sendMessage` for the same reason as `claudeModelArgs` and
|
|
728
|
+
* `resolveClaudeModel` above: the composition was only assertable by spawning a real
|
|
729
|
+
* subprocess, so nothing verified that a compiled allowlist actually reaches the spawn.
|
|
730
|
+
*
|
|
731
|
+
* Owns one measured invariant: `--disallowedTools` is VARIADIC, so it must come last.
|
|
732
|
+
* A positional argument after it is silently swallowed as extra deny rules — measured
|
|
733
|
+
* (`Permission deny rule "the" matches no known tool`). Append nothing after this call.
|
|
734
|
+
*/
|
|
735
|
+
export function claudeSpawnArgs(params) {
|
|
736
|
+
return appendDisallowedToolsArgs([
|
|
737
|
+
'--print',
|
|
738
|
+
'--verbose',
|
|
739
|
+
'--output-format',
|
|
740
|
+
'stream-json',
|
|
741
|
+
'--permission-mode',
|
|
742
|
+
'bypassPermissions',
|
|
743
|
+
'--mcp-config',
|
|
744
|
+
params.mcpConfigPath,
|
|
745
|
+
'--strict-mcp-config',
|
|
746
|
+
'--input-format',
|
|
747
|
+
'stream-json',
|
|
748
|
+
'--effort',
|
|
749
|
+
params.effort || 'high',
|
|
750
|
+
...claudeModelArgs(params.claudeModel, params.claudeModels),
|
|
751
|
+
], params.disallowedTools);
|
|
752
|
+
}
|
|
663
753
|
/**
|
|
664
754
|
* Resolve which provider a thread's model id runs on (task 118) — pure, same
|
|
665
755
|
* rationale as `resolveClaudeModel`: the decision must be assertable without
|
|
@@ -735,10 +825,15 @@ export function resolveThreadPlaceholders(extraMcpServers, threadName) {
|
|
|
735
825
|
return resolved;
|
|
736
826
|
}
|
|
737
827
|
/** Write MCP config JSON for Claude CLI and return its path */
|
|
738
|
-
export function generateMcpConfig(threadPath, sessionId, threadName, sharedMcpPort, extraMcpServers, gatewayAgentsConfig) {
|
|
828
|
+
export function generateMcpConfig(threadPath, sessionId, threadName, sharedMcpPort, extraMcpServers, gatewayAgentsConfig, readFileRoots) {
|
|
739
829
|
const nodePath = resolveNode();
|
|
830
|
+
// Task 136: the shared server derives its ToolContext from thread name +
|
|
831
|
+
// basePath alone and cannot see thread config, so it cannot carry the roots.
|
|
832
|
+
// A confined thread therefore takes the per-thread server — fail closed, one
|
|
833
|
+
// condition, no new protocol.
|
|
834
|
+
const confined = !!readFileRoots?.length;
|
|
740
835
|
let cumulusHistoryConfig;
|
|
741
|
-
if (sharedMcpPort) {
|
|
836
|
+
if (sharedMcpPort && !confined) {
|
|
742
837
|
// Shared mode: lightweight proxy
|
|
743
838
|
const proxyPath = getProxyPathInternal();
|
|
744
839
|
cumulusHistoryConfig = {
|
|
@@ -763,6 +858,7 @@ export function generateMcpConfig(threadPath, sessionId, threadName, sharedMcpPo
|
|
|
763
858
|
CUMULUS_CONTENT_PATH: contentStorePath,
|
|
764
859
|
CUMULUS_SESSIONS_PATH: sessionsPath,
|
|
765
860
|
...(sessionId && { CUMULUS_SESSION_ID: sessionId }),
|
|
861
|
+
...(confined && { CUMULUS_READ_FILE_ROOTS: readFileRoots.join(path.delimiter) }),
|
|
766
862
|
},
|
|
767
863
|
};
|
|
768
864
|
}
|
|
@@ -961,9 +1057,9 @@ export async function getOrCreateThread(threadName, _basePath) {
|
|
|
961
1057
|
const adaptive = await loadAdaptiveState(threadPath, pinnedBudgetConfig(threadConfig.contextLimit));
|
|
962
1058
|
const thread = { history, content, session, adaptive, threadPath };
|
|
963
1059
|
threadCache.set(threadName, thread);
|
|
964
|
-
// Task
|
|
965
|
-
//
|
|
966
|
-
|
|
1060
|
+
// Task 134: recipe seeding moved to sendMessage. This function is also reached
|
|
1061
|
+
// by store-only paths that never spawn a turn, and it sees only the thread
|
|
1062
|
+
// config — the gate needs the merged one.
|
|
967
1063
|
return thread;
|
|
968
1064
|
}
|
|
969
1065
|
/** Clear a thread from the cache (and its recipe-seed memo, so recreation re-seeds) */
|
|
@@ -1168,6 +1264,17 @@ export async function sendMessage(options) {
|
|
|
1168
1264
|
const globalConfig = await loadGlobalConfig();
|
|
1169
1265
|
const threadConfig = await loadThreadConfig(threadName);
|
|
1170
1266
|
const mergedConfig = mergeConfigs(globalConfig, threadConfig);
|
|
1267
|
+
// Task 116 puts the watcher recipe in the store rather than the per-turn
|
|
1268
|
+
// template; task 134 gates it on this thread being able to run it. Here and
|
|
1269
|
+
// not in getOrCreateThread: this is the single funnel every spawning path
|
|
1270
|
+
// passes through, and the only place the MERGED config exists.
|
|
1271
|
+
void seedThreadRecipes(thread.content, threadName, mergedConfig);
|
|
1272
|
+
// Task 137: drop prompt sections whose tools this thread cannot reach. Computed ONCE
|
|
1273
|
+
// here because three sites consume the template (the prompt, the 088 capture, and the
|
|
1274
|
+
// direct-provider instructions) — task 113's lesson is that per-site derivation is how
|
|
1275
|
+
// one of N paths silently keeps the old behaviour. Identity when nothing is gated, so
|
|
1276
|
+
// every thread on this box is byte-unaffected.
|
|
1277
|
+
const gatedPromptTemplate = applyCapabilityGates(systemPromptTemplate ?? SYSTEM_PROMPT_TEMPLATE, promptCapabilities(mergedConfig));
|
|
1171
1278
|
const alwaysInclude = await readAlwaysIncludeFiles(mergedConfig, threadCwd);
|
|
1172
1279
|
// ── Model resolution ──
|
|
1173
1280
|
// Thread config `model` field determines the execution path:
|
|
@@ -1252,7 +1359,7 @@ export async function sendMessage(options) {
|
|
|
1252
1359
|
systemPromptLength: 0,
|
|
1253
1360
|
};
|
|
1254
1361
|
// ── System prompt ──
|
|
1255
|
-
const systemPrompt = generateSystemPrompt(stats.count, stats.totalTokens, thread.session.getSessionId(), recentConversation, retrievedContext, alwaysInclude.formattedContext,
|
|
1362
|
+
const systemPrompt = generateSystemPrompt(stats.count, stats.totalTokens, thread.session.getSessionId(), recentConversation, retrievedContext, alwaysInclude.formattedContext, gatedPromptTemplate, threadName);
|
|
1256
1363
|
// Update debug with system prompt breakdown
|
|
1257
1364
|
const systemPromptTokens = estimateTokens(systemPrompt);
|
|
1258
1365
|
const ragTokens = retrievalResult ? estimateTokens(retrievedContext) : 0;
|
|
@@ -1271,7 +1378,7 @@ export async function sendMessage(options) {
|
|
|
1271
1378
|
// ── Prompt capture (task 088): assemble the observable sections ──
|
|
1272
1379
|
// The pure template (empty components) isolates the instructions section.
|
|
1273
1380
|
const promptCaptureEnabled = mergedConfig.promptCapture !== false;
|
|
1274
|
-
const instructionsOnly = generateSystemPrompt(stats.count, stats.totalTokens, thread.session.getSessionId(), [], '', '',
|
|
1381
|
+
const instructionsOnly = generateSystemPrompt(stats.count, stats.totalTokens, thread.session.getSessionId(), [], '', '', gatedPromptTemplate, threadName);
|
|
1275
1382
|
// CLI shape by default; the HF branch overwrites path/instructions below.
|
|
1276
1383
|
let promptCapturePath = 'cli';
|
|
1277
1384
|
const promptCaptureSections = [
|
|
@@ -1476,7 +1583,7 @@ export async function sendMessage(options) {
|
|
|
1476
1583
|
// Build system blocks with cache_control on static parts
|
|
1477
1584
|
const systemBlocks = [];
|
|
1478
1585
|
// Static instructions (cacheable)
|
|
1479
|
-
const instructions =
|
|
1586
|
+
const instructions = gatedPromptTemplate;
|
|
1480
1587
|
const modelIdentity = `You are ${threadModel}. You are NOT Claude, NOT Opus, NOT Sonnet, NOT Haiku. If asked what model you are, say "${threadModel}". `;
|
|
1481
1588
|
const hfInstructionsText = modelIdentity +
|
|
1482
1589
|
instructions
|
|
@@ -1523,6 +1630,9 @@ export async function sendMessage(options) {
|
|
|
1523
1630
|
contentStore: thread.content,
|
|
1524
1631
|
sessionsPath: path.join(path.dirname(thread.history.threadPath), '..', 'sessions'),
|
|
1525
1632
|
currentSessionId: thread.session.getSessionId(),
|
|
1633
|
+
// Task 136 — same confinement as the Claude CLI path (task 113's lesson:
|
|
1634
|
+
// a field wired into one of several spawn paths silently does nothing).
|
|
1635
|
+
readFileRoots: readFileRootsForThread(mergedConfig, threadCwd),
|
|
1526
1636
|
};
|
|
1527
1637
|
// Wire all cumulus-history tools as mcp__cumulus_history__* (direct function calls)
|
|
1528
1638
|
for (const toolDef of getMcpToolDefinitions()) {
|
|
@@ -1717,7 +1827,13 @@ export async function sendMessage(options) {
|
|
|
1717
1827
|
tools: coreTools,
|
|
1718
1828
|
mcpTools: mcpToolEntries,
|
|
1719
1829
|
eagerAll: true, // HF models can't use ToolSearch — send all tools upfront
|
|
1720
|
-
|
|
1830
|
+
// Task 137: the allowlist must bind here too, or a visitor thread pinned to an
|
|
1831
|
+
// HF/OpenAI model would silently ignore it — the fail-open, one-of-N-paths gap
|
|
1832
|
+
// task 113 recorded. No probe needed on this path: the registry about to be
|
|
1833
|
+
// handed to the loop IS the exact inventory.
|
|
1834
|
+
disallowedTools: mergedConfig.allowedTools
|
|
1835
|
+
? compileDisallowedTools(mergedConfig.allowedTools, [...coreTools, ...mcpToolEntries].map(t => t.definition.name), mergedConfig.disallowedTools)
|
|
1836
|
+
: mergedConfig.disallowedTools,
|
|
1721
1837
|
onToken: (() => {
|
|
1722
1838
|
// Filter suppresses <todo> and <thinking> blocks from reaching the frontend (unless debug)
|
|
1723
1839
|
const filter = onToken
|
|
@@ -1806,23 +1922,23 @@ export async function sendMessage(options) {
|
|
|
1806
1922
|
}
|
|
1807
1923
|
}
|
|
1808
1924
|
// ── Local execution: spawn Claude on this machine ──
|
|
1809
|
-
const mcpConfigPath = generateMcpConfig(thread.threadPath, thread.session.getSessionId(), threadName, sharedMcpPort, extraMcpServers, gatewayAgentsConfig);
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1925
|
+
const mcpConfigPath = generateMcpConfig(thread.threadPath, thread.session.getSessionId(), threadName, sharedMcpPort, extraMcpServers, gatewayAgentsConfig, readFileRootsForThread(mergedConfig, threadCwd));
|
|
1926
|
+
const resolvedClaudePath = claudePath || resolveClaudeCli();
|
|
1927
|
+
// Task 137: compile an allowlist into --disallowedTools. The CLI's --allowedTools is an
|
|
1928
|
+
// AUTO-APPROVE list and does not restrict (measured under three permission modes), and
|
|
1929
|
+
// under --permission-mode bypassPermissions it is a guaranteed no-op — so deny-by-default
|
|
1930
|
+
// has to be expressed as a denylist. Gated on the field being present so an unconstrained
|
|
1931
|
+
// thread never pays for the inventory probe (a subprocess spawn) at all.
|
|
1932
|
+
const effectiveDisallowedTools = mergedConfig.allowedTools
|
|
1933
|
+
? compileDisallowedTools(mergedConfig.allowedTools, await getToolInventory(resolvedClaudePath), mergedConfig.disallowedTools)
|
|
1934
|
+
: mergedConfig.disallowedTools;
|
|
1935
|
+
const args = claudeSpawnArgs({
|
|
1818
1936
|
mcpConfigPath,
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
...claudeModelArgs(mergedConfig.claudeModel, options.claudeModels),
|
|
1825
|
-
], mergedConfig.disallowedTools);
|
|
1937
|
+
effort: mergedConfig.effort,
|
|
1938
|
+
claudeModel: mergedConfig.claudeModel,
|
|
1939
|
+
claudeModels: options.claudeModels,
|
|
1940
|
+
disallowedTools: effectiveDisallowedTools,
|
|
1941
|
+
});
|
|
1826
1942
|
// Filter out Claude env vars
|
|
1827
1943
|
const cleanEnv = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith('CLAUDE') && key !== 'CLAUDECODE'));
|
|
1828
1944
|
// Check if already aborted
|
|
@@ -1830,7 +1946,6 @@ export async function sendMessage(options) {
|
|
|
1830
1946
|
cleanupMcpConfig(mcpConfigPath);
|
|
1831
1947
|
throw new Error('Aborted');
|
|
1832
1948
|
}
|
|
1833
|
-
const resolvedClaudePath = claudePath || resolveClaudeCli();
|
|
1834
1949
|
// Windows: spawn() can't directly exec .cmd/.bat shims (CVE-2024-27980).
|
|
1835
1950
|
// Routing through cmd.exe is required for the npm-installed `claude.cmd`.
|
|
1836
1951
|
const isWindowsShim = process.platform === 'win32' && /\.(cmd|bat|ps1)$/i.test(resolvedClaudePath);
|