@hyperwindmill/caretaker-cli 0.24.0 → 0.25.0
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/dist/acp/index.d.ts +3 -0
- package/dist/acp/index.d.ts.map +1 -0
- package/dist/acp/index.js +2 -0
- package/dist/acp/install.d.ts +12 -0
- package/dist/acp/install.d.ts.map +1 -0
- package/dist/acp/install.js +110 -0
- package/dist/acp/registry.d.ts +10 -0
- package/dist/acp/registry.d.ts.map +1 -0
- package/dist/acp/registry.js +116 -0
- package/dist/cli/web/mcp_bridge.d.ts +7 -1
- package/dist/cli/web/mcp_bridge.d.ts.map +1 -1
- package/dist/cli/web/mcp_bridge.js +10 -6
- package/dist/cli/web/scheduler/memory_sweep.d.ts.map +1 -1
- package/dist/cli/web/scheduler/memory_sweep.js +1 -0
- package/dist/cli/web/scheduler/task_review.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_review.js +25 -0
- package/dist/cli/web/scheduler/task_roles.d.ts +1 -1
- package/dist/cli/web/scheduler/task_roles.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_roles.js +6 -6
- package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_strategy.js +23 -2
- package/dist/cli/web/server.d.ts +1 -1
- package/dist/cli/web/server.d.ts.map +1 -1
- package/dist/cli/web/server.js +27 -5
- package/dist/harness/acp_policy.d.ts +41 -0
- package/dist/harness/acp_policy.d.ts.map +1 -0
- package/dist/harness/acp_policy.js +59 -0
- package/dist/harness/acp_pool.d.ts +33 -0
- package/dist/harness/acp_pool.d.ts.map +1 -0
- package/dist/harness/acp_pool.js +148 -0
- package/dist/harness/acp_runner.d.ts +4 -0
- package/dist/harness/acp_runner.d.ts.map +1 -0
- package/dist/harness/acp_runner.js +347 -0
- package/dist/harness/claude_code_runner.d.ts +2 -0
- package/dist/harness/claude_code_runner.d.ts.map +1 -1
- package/dist/harness/claude_code_runner.js +1 -1
- package/dist/harness/confirm_gate.d.ts +12 -0
- package/dist/harness/confirm_gate.d.ts.map +1 -0
- package/dist/harness/confirm_gate.js +33 -0
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +1 -0
- package/dist/harness/loop.d.ts +3 -0
- package/dist/harness/loop.d.ts.map +1 -1
- package/dist/harness/loop.js +6 -0
- package/dist/harness/memory_recall.d.ts +8 -3
- package/dist/harness/memory_recall.d.ts.map +1 -1
- package/dist/harness/memory_recall.js +11 -7
- package/dist/harness/title.js +1 -1
- package/dist/mcp/builtin_server.d.ts +1 -0
- package/dist/mcp/builtin_server.d.ts.map +1 -1
- package/dist/mcp/builtin_server.js +3 -2
- package/dist/mcp/run_command_tool.d.ts +13 -0
- package/dist/mcp/run_command_tool.d.ts.map +1 -0
- package/dist/mcp/run_command_tool.js +51 -0
- package/dist/session/store.d.ts +1 -0
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js +6 -0
- package/dist/session/types.d.ts +3 -0
- package/dist/session/types.d.ts.map +1 -1
- package/dist/tui/agents.d.ts.map +1 -1
- package/dist/tui/agents.js +57 -23
- package/dist/tui/chat.d.ts.map +1 -1
- package/dist/tui/chat.js +7 -8
- package/dist/tui/providers.d.ts.map +1 -1
- package/dist/tui/providers.js +116 -17
- package/dist/webview/standalone.css +18 -0
- package/dist/webview/standalone.css.map +2 -2
- package/dist/webview/standalone.js +235 -25
- package/dist/webview/standalone.js.map +2 -2
- package/package.json +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude_code_runner.d.ts","sourceRoot":"","sources":["../../src/harness/claude_code_runner.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAM3E,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"claude_code_runner.d.ts","sourceRo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/F"}
|
|
@@ -113,7 +113,7 @@ async function buildMcpConfigFile(serverIds, extra) {
|
|
|
113
113
|
await writeFile(configPath, JSON.stringify({ mcpServers: servers }), { mode: 0o600 });
|
|
114
114
|
return { configPath, cleanup: () => rm(dir, { recursive: true, force: true }) };
|
|
115
115
|
}
|
|
116
|
-
function foldHistory(history, prompt) {
|
|
116
|
+
export function foldHistory(history, prompt) {
|
|
117
117
|
if (!history?.length)
|
|
118
118
|
return prompt;
|
|
119
119
|
const lines = history.filter((m) => m.role !== 'tool').map((m) => `[${m.role}] ${m.content}`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ConfirmDecision } from './tools/index.js';
|
|
2
|
+
export declare class ConfirmGateState {
|
|
3
|
+
private readonly isAcp;
|
|
4
|
+
/** Native mode: names that still prompt ("always" removes). */
|
|
5
|
+
private readonly confirmSet;
|
|
6
|
+
/** ACP mode: names the user already granted "always" (adds). */
|
|
7
|
+
private readonly acpAllowed;
|
|
8
|
+
constructor(providerType: string | undefined, confirmTools: string[] | undefined);
|
|
9
|
+
needsAsk(name: string): boolean;
|
|
10
|
+
remember(name: string, decision: ConfirmDecision): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=confirm_gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm_gate.d.ts","sourceRoot":"","sources":["../../src/harness/confirm_gate.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;IACzC,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;gBAEpC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,SAAS;IAKhF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI/B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI;CAKxD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Shared confirm-gate state for interactive chat surfaces (web, VSCode, TUI).
|
|
2
|
+
//
|
|
3
|
+
// Native and claude-code agents gate by the user's [!] picker selection
|
|
4
|
+
// (agent.confirmTools): only listed names prompt, and "always" un-lists the
|
|
5
|
+
// name for the rest of the controller's lifetime.
|
|
6
|
+
//
|
|
7
|
+
// ACP agents invert the rule: agent.confirmTools is always empty (the picker
|
|
8
|
+
// does not apply to external runners), and a session/request_permission means
|
|
9
|
+
// the agent's OWN permission model already decided this call was worth asking
|
|
10
|
+
// about — so every request surfaces a card, and "always" is remembered
|
|
11
|
+
// per tool name in-memory.
|
|
12
|
+
export class ConfirmGateState {
|
|
13
|
+
isAcp;
|
|
14
|
+
/** Native mode: names that still prompt ("always" removes). */
|
|
15
|
+
confirmSet;
|
|
16
|
+
/** ACP mode: names the user already granted "always" (adds). */
|
|
17
|
+
acpAllowed = new Set();
|
|
18
|
+
constructor(providerType, confirmTools) {
|
|
19
|
+
this.isAcp = providerType === 'acp';
|
|
20
|
+
this.confirmSet = new Set(confirmTools ?? []);
|
|
21
|
+
}
|
|
22
|
+
needsAsk(name) {
|
|
23
|
+
return this.isAcp ? !this.acpAllowed.has(name) : this.confirmSet.has(name);
|
|
24
|
+
}
|
|
25
|
+
remember(name, decision) {
|
|
26
|
+
if (decision !== 'always')
|
|
27
|
+
return;
|
|
28
|
+
if (this.isAcp)
|
|
29
|
+
this.acpAllowed.add(name);
|
|
30
|
+
else
|
|
31
|
+
this.confirmSet.delete(name);
|
|
32
|
+
}
|
|
33
|
+
}
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { run } from './loop.js';
|
|
2
|
+
export { ConfirmGateState } from './confirm_gate.js';
|
|
2
3
|
export type { RunOptions, RunCallbacks, RunResult, ConfirmDecision } from './loop.js';
|
|
3
4
|
export { resolveAgentTools, ToolRegistry, registerBuiltins, toOpenAiTool } from './tools/index.js';
|
|
4
5
|
export type { Tool, ToolContext, ToolResult, ConfirmGate, OpenAiFunctionTool, } from './tools/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnG,YAAY,EACV,IAAI,EACJ,WAAW,EACX,UAAU,EACV,WAAW,EACX,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnG,YAAY,EACV,IAAI,EACJ,WAAW,EACX,UAAU,EACV,WAAW,EACX,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/harness/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// keep importing their specific files; only this barrel is part of the
|
|
4
4
|
// stable surface exposed via `caretaker-cli/harness`.
|
|
5
5
|
export { run } from './loop.js';
|
|
6
|
+
export { ConfirmGateState } from './confirm_gate.js';
|
|
6
7
|
export { resolveAgentTools, ToolRegistry, registerBuiltins, toOpenAiTool } from './tools/index.js';
|
|
7
8
|
export { tools } from './tools/instance.js';
|
|
8
9
|
export { fetchOpenAiStyleModels } from './models.js';
|
package/dist/harness/loop.d.ts
CHANGED
|
@@ -57,6 +57,9 @@ export interface RunOptions {
|
|
|
57
57
|
/** claude-code runner extras (ignored by the native loop): permission
|
|
58
58
|
* mode override, tool allow/deny rules, extra per-run MCP servers. */
|
|
59
59
|
claudeCode?: import('./claude_code_runner.js').ClaudeCodeRunExtras;
|
|
60
|
+
/** acp runner extras (ignored by the native loop): permission policy mode,
|
|
61
|
+
* extra per-run MCP servers, docker confinement. */
|
|
62
|
+
acp?: import('./acp_policy.js').AcpRunExtras;
|
|
60
63
|
/** Native-loop only: run `bash` commands inside this docker container. */
|
|
61
64
|
dockerContainer?: string;
|
|
62
65
|
/** The turn came from voice conversation mode; append the spoken-reply
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../src/harness/loop.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAiB,aAAa,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAgC,KAAK,cAAc,EAAoB,MAAM,eAAe,CAAC;AAEpG,OAAO,EACL,KAAK,WAAW,EAChB,KA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AA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;mCAE+B;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC3C;2EACuE;IACvE,UAAU,CAAC,EAAE,OAAO,yBAAyB,EAAE,mBAAmB,CAAC;IACnE;yDACqD;IACrD,GAAG,CAAC,EAAE,OAAO,iBAAiB,EAAE,YAAY,CAAC;IAC7C,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;0EACsE;IACtE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;uEAEmE;IACnE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;kEAG8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,KAAK,EAAE,cAAc,CAAC;IACtB,qEAAqE;IACrE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CACxC;AAED,wBAAsB,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,GAAE,YAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,CAqWrF"}
|
package/dist/harness/loop.js
CHANGED
|
@@ -35,6 +35,12 @@ export async function run(opts, cb = {}) {
|
|
|
35
35
|
const { runClaudeCode } = await import('./claude_code_runner.js');
|
|
36
36
|
return runClaudeCode(opts, cb);
|
|
37
37
|
}
|
|
38
|
+
if (opts.provider.type === 'acp') {
|
|
39
|
+
// Same single-dispatch pattern: ACP providers get the whole loop replaced
|
|
40
|
+
// by an external ACP agent (see acp_runner.ts).
|
|
41
|
+
const { runAcp } = await import('./acp_runner.js');
|
|
42
|
+
return runAcp(opts, cb);
|
|
43
|
+
}
|
|
38
44
|
const { agent, provider, tools, prompt } = opts;
|
|
39
45
|
const baseUrl = provider.endpoint.replace(/\/+$/, '');
|
|
40
46
|
const endpoint = `${baseUrl}/v1/chat/completions`;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { Memory } from '../store/db.js';
|
|
2
2
|
export declare const RECALL_TOP_K = 5;
|
|
3
3
|
export declare const MIN_KEYWORD_LENGTH = 3;
|
|
4
|
-
/** Inverted lexical match — no query tokenization:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
/** Inverted lexical match — no query tokenization: keywords are split into
|
|
5
|
+
* their component words (deduped per memory), and each word contained in
|
|
6
|
+
* the lowercased prompt counts as a match. A multi-word keyword therefore
|
|
7
|
+
* fires on any of its words ("reaper linux" ← "reaper") and scores higher
|
|
8
|
+
* when the full phrase is present (every word matches) — graded for free,
|
|
9
|
+
* no phrase-special-casing. Generic components over-firing is mitigated by
|
|
10
|
+
* the scoring plus the top-K cut.
|
|
11
|
+
* score = matchedWords × importanceWeight × (1 + log2(1 + recallCount)):
|
|
7
12
|
* acquired strength weighs in — much-recalled memories surface more easily.
|
|
8
13
|
* Ties: lastRecalledAt desc, then createdAt desc. Top-K, score > 0 only. */
|
|
9
14
|
export declare function matchMemories(prompt: string, memories: Memory[]): Memory[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory_recall.d.ts","sourceRoot":"","sources":["../../src/harness/memory_recall.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAK7C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAOpC
|
|
1
|
+
{"version":3,"file":"memory_recall.d.ts","sourceRoot":"","sources":["../../src/harness/memory_recall.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAK7C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAOpC;;;;;;;;;6EAS6E;AAC7E,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAqB1E;AAED;;qEAEqE;AACrE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAS7D;AAED;;;;;;;iDAOiD;AACjD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC,CAajB"}
|
|
@@ -8,21 +8,25 @@ const IMPORTANCE_WEIGHT = {
|
|
|
8
8
|
normal: 1,
|
|
9
9
|
high: 2,
|
|
10
10
|
};
|
|
11
|
-
/** Inverted lexical match — no query tokenization:
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
/** Inverted lexical match — no query tokenization: keywords are split into
|
|
12
|
+
* their component words (deduped per memory), and each word contained in
|
|
13
|
+
* the lowercased prompt counts as a match. A multi-word keyword therefore
|
|
14
|
+
* fires on any of its words ("reaper linux" ← "reaper") and scores higher
|
|
15
|
+
* when the full phrase is present (every word matches) — graded for free,
|
|
16
|
+
* no phrase-special-casing. Generic components over-firing is mitigated by
|
|
17
|
+
* the scoring plus the top-K cut.
|
|
18
|
+
* score = matchedWords × importanceWeight × (1 + log2(1 + recallCount)):
|
|
14
19
|
* acquired strength weighs in — much-recalled memories surface more easily.
|
|
15
20
|
* Ties: lastRecalledAt desc, then createdAt desc. Top-K, score > 0 only. */
|
|
16
21
|
export function matchMemories(prompt, memories) {
|
|
17
22
|
const text = prompt.toLowerCase();
|
|
18
23
|
const scored = [];
|
|
19
24
|
for (const m of memories) {
|
|
25
|
+
const words = new Set(m.keywords.flatMap((k) => k.toLowerCase().split(/\s+/)).filter((w) => w.length >= MIN_KEYWORD_LENGTH));
|
|
20
26
|
let matched = 0;
|
|
21
|
-
for (const
|
|
22
|
-
|
|
23
|
-
if (kw.length >= MIN_KEYWORD_LENGTH && text.includes(kw))
|
|
27
|
+
for (const w of words)
|
|
28
|
+
if (text.includes(w))
|
|
24
29
|
matched++;
|
|
25
|
-
}
|
|
26
30
|
if (matched === 0)
|
|
27
31
|
continue;
|
|
28
32
|
const score = matched * IMPORTANCE_WEIGHT[m.importance] * (1 + Math.log2(1 + (m.recallCount ?? 0)));
|
package/dist/harness/title.js
CHANGED
|
@@ -10,7 +10,7 @@ const TITLE_INSTRUCTION = 'Summarize this conversation in 5–7 words for a chat
|
|
|
10
10
|
* that case — title generation is best-effort. */
|
|
11
11
|
export async function generateTitle(input) {
|
|
12
12
|
const { agent, provider, firstUserPrompt, firstAssistantText, signal } = input;
|
|
13
|
-
if (input.provider.type === 'claude-code')
|
|
13
|
+
if (input.provider.type === 'claude-code' || input.provider.type === 'acp')
|
|
14
14
|
return null; // no HTTP endpoint; keep fallback title
|
|
15
15
|
if (!firstUserPrompt.trim() && !firstAssistantText.trim())
|
|
16
16
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin_server.d.ts","sourceRoot":"","sources":["../../src/mcp/builtin_server.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAQ7C,wBAAgB,eAAe,IAAI,IAAI,EAAE,CAExC;AAED,wBAAgB,qBAAqB,CACnC,IAAI,GAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAiD,EACtF,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,
|
|
1
|
+
{"version":3,"file":"builtin_server.d.ts","sourceRoot":"","sources":["../../src/mcp/builtin_server.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAQ7C,wBAAgB,eAAe,IAAI,IAAI,EAAE,CAExC;AAED,wBAAgB,qBAAqB,CACnC,IAAI,GAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAiD,EACtF,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAA;CAAO,GACvD,MAAM,CAqCR"}
|
|
@@ -27,16 +27,17 @@ export function builtinMcpTools() {
|
|
|
27
27
|
return registry.list().filter((t) => SERVED_PREFIXES.some((p) => t.name.startsWith(p)));
|
|
28
28
|
}
|
|
29
29
|
export function buildBuiltinMcpServer(info = { name: 'caretaker-task', version: '0.0.0' }, opts = {}) {
|
|
30
|
+
const served = () => opts.tools ?? builtinMcpTools();
|
|
30
31
|
const server = new Server(info, { capabilities: { tools: {} } });
|
|
31
32
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
32
|
-
tools:
|
|
33
|
+
tools: served().map((t) => ({
|
|
33
34
|
name: externalName(t.name),
|
|
34
35
|
description: t.description,
|
|
35
36
|
inputSchema: t.parameters,
|
|
36
37
|
})),
|
|
37
38
|
}));
|
|
38
39
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
39
|
-
const tool =
|
|
40
|
+
const tool = served().find((t) => externalName(t.name) === req.params.name);
|
|
40
41
|
if (!tool) {
|
|
41
42
|
return {
|
|
42
43
|
content: [{ type: 'text', text: `Error: unknown tool "${req.params.name}"` }],
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Tool } from '../harness/tools/index.js';
|
|
2
|
+
type ExecFn = (cmd: string, args: string[], opts: object) => Promise<{
|
|
3
|
+
stdout: string;
|
|
4
|
+
stderr: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function __setExec(fn: ExecFn): void;
|
|
7
|
+
export declare function __resetExec(): void;
|
|
8
|
+
export declare function makeRunCommandTool(bind: {
|
|
9
|
+
container: string;
|
|
10
|
+
workdir: string;
|
|
11
|
+
}): Tool;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=run_command_tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_command_tool.d.ts","sourceRoot":"","sources":["../../src/mcp/run_command_tool.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAOtD,KAAK,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAGzG,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAE1C;AACD,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAMD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA+BrF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Per-task shell tool for ACP runs under Docker confinement: the ACP policy
|
|
2
|
+
// denies every kind:'execute' tool call, and this bridge-injected tool is the
|
|
3
|
+
// only shell path — confined to the task's container by construction. Built
|
|
4
|
+
// per token (bound container), so it is never part of the registry and never
|
|
5
|
+
// served by the stdio `caretaker-cli mcp` server (no container to bind there).
|
|
6
|
+
import { execFile } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
import { containerExecArgs } from '../lib/docker.js';
|
|
9
|
+
import { commandEnv } from '../harness/tools/builtin/shell-env.js';
|
|
10
|
+
const TIMEOUT_MS = 5 * 60_000;
|
|
11
|
+
const MAX_OUTPUT_CHARS = 30_000;
|
|
12
|
+
const realExec = promisify(execFile);
|
|
13
|
+
let execImpl = realExec;
|
|
14
|
+
export function __setExec(fn) {
|
|
15
|
+
execImpl = fn;
|
|
16
|
+
}
|
|
17
|
+
export function __resetExec() {
|
|
18
|
+
execImpl = realExec;
|
|
19
|
+
}
|
|
20
|
+
function cap(s) {
|
|
21
|
+
return s.length > MAX_OUTPUT_CHARS ? s.slice(0, MAX_OUTPUT_CHARS) + '\n…[truncated]' : s;
|
|
22
|
+
}
|
|
23
|
+
export function makeRunCommandTool(bind) {
|
|
24
|
+
return {
|
|
25
|
+
name: 'mcp__task__run_command',
|
|
26
|
+
description: "Run a shell command inside this task's Docker container (the only way to execute " +
|
|
27
|
+
'commands in this run — direct shell tool calls are denied). Runs from the task ' +
|
|
28
|
+
`working directory. 5-minute timeout, output capped at ${MAX_OUTPUT_CHARS} chars.`,
|
|
29
|
+
parameters: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
command: { type: 'string', description: 'The shell command to run (sh -c syntax).' },
|
|
33
|
+
},
|
|
34
|
+
required: ['command'],
|
|
35
|
+
},
|
|
36
|
+
execute: async (args) => {
|
|
37
|
+
const command = String(args?.command ?? '').trim();
|
|
38
|
+
if (!command)
|
|
39
|
+
return { content: 'Error: command is required' };
|
|
40
|
+
try {
|
|
41
|
+
const { stdout, stderr } = await execImpl('docker', containerExecArgs(bind.container, bind.workdir, command), { env: commandEnv(), timeout: TIMEOUT_MS, maxBuffer: 10 * 1024 * 1024 });
|
|
42
|
+
return { content: cap([stdout, stderr].filter(Boolean).join('\n')) || '(no output)' };
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
const out = [err?.stdout, err?.stderr].filter(Boolean).join('\n');
|
|
46
|
+
const code = err?.code ?? 'unknown';
|
|
47
|
+
return { content: cap(`Error: exit code ${code}\n${out || err?.message || ''}`) };
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
package/dist/session/store.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare function updateTitle(meta: Pick<SessionMetaRecord, 'agentId' | 'i
|
|
|
42
42
|
/** Persist the Claude Code session id by appending a fresh meta line
|
|
43
43
|
* (readSession picks the latest meta; listForAgent keeps using the first). */
|
|
44
44
|
export declare function updateClaudeSessionId(meta: Pick<SessionMetaRecord, 'agentId' | 'id'>, claudeSessionId: string): Promise<void>;
|
|
45
|
+
export declare function updateAcpSessionId(meta: Pick<SessionMetaRecord, 'agentId' | 'id'>, acpSessionId: string): Promise<void>;
|
|
45
46
|
export declare function deleteSession(agentId: string, sessionId: string): Promise<void>;
|
|
46
47
|
export declare function userMessage(content: string, opts?: {
|
|
47
48
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/session/store.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,iBAAS,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAA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MAAM,CAAC,CAGnF;AAED,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,oBAAoB,EAAE,EACpC,IAAI,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,aAAa,CAWf;AAID,eAAO,MAAM,YAAY;;;;CAA2C,CAAC"}
|
package/dist/session/store.js
CHANGED
|
@@ -205,6 +205,12 @@ export async function updateClaudeSessionId(meta, claudeSessionId) {
|
|
|
205
205
|
const path = sessionPath(meta.agentId, meta.id);
|
|
206
206
|
await appendFile(path, serialize(record), { mode: 0o600 });
|
|
207
207
|
}
|
|
208
|
+
export async function updateAcpSessionId(meta, acpSessionId) {
|
|
209
|
+
const current = await readSession(meta.agentId, meta.id);
|
|
210
|
+
const record = { ...current.meta, acpSessionId };
|
|
211
|
+
const path = sessionPath(meta.agentId, meta.id);
|
|
212
|
+
await appendFile(path, serialize(record), { mode: 0o600 });
|
|
213
|
+
}
|
|
208
214
|
export async function deleteSession(agentId, sessionId) {
|
|
209
215
|
const path = sessionPath(agentId, sessionId);
|
|
210
216
|
await rm(path, { force: true });
|
package/dist/session/types.d.ts
CHANGED
|
@@ -27,6 +27,9 @@ export interface SessionMetaRecord {
|
|
|
27
27
|
/** Claude Code CLI session id for claude-code runner agents; the next
|
|
28
28
|
* turn resumes it via `claude -p --resume <id>`. */
|
|
29
29
|
claudeSessionId?: string;
|
|
30
|
+
/** ACP session id for acp runner agents; reused across turns and offered
|
|
31
|
+
* to session/load when the agent supports it. */
|
|
32
|
+
acpSessionId?: string;
|
|
30
33
|
}
|
|
31
34
|
export type Role = 'user' | 'assistant' | 'tool';
|
|
32
35
|
export interface ToolAttachmentRecord {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/session/types.ts"],"names":[],"mappings":"AAWA,MAA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HANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/tui/agents.tsx"],"names":[],"mappings":"AAoCA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/tui/agents.tsx"],"names":[],"mappings":"AAoCA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,2CA+XhE"}
|
package/dist/tui/agents.js
CHANGED
|
@@ -195,8 +195,10 @@ export default function Agents({ onBack }) {
|
|
|
195
195
|
}
|
|
196
196
|
if (mode === 'detail' && selected) {
|
|
197
197
|
const managed = !!selected.pluginId;
|
|
198
|
-
const
|
|
199
|
-
|
|
198
|
+
const providerType = providers.find((p) => p.name === selected.provider)?.type ?? 'openai';
|
|
199
|
+
const isClaudeCode = providerType === 'claude-code';
|
|
200
|
+
const isAcp = providerType === 'acp';
|
|
201
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: selected.name }), managed && (_jsx(Text, { color: "cyan", children: "[managed by plugin \u00B7 name + system prompt come from the manifest]" })), _jsxs(Text, { children: ["provider: ", selected.provider] }), _jsxs(Text, { children: ["model: ", selected.model] }), isClaudeCode ? (_jsxs(_Fragment, { children: [_jsxs(Text, { children: ["permissionMode: ", selected.permissionMode || 'Auto (Claude Code default)'] }), _jsxs(Text, { children: ["strictMcp: ", selected.strictMcp ? 'on' : 'off (merge ~/.claude MCP)'] })] })) : isAcp ? (_jsxs(_Fragment, { children: [_jsxs(Text, { children: ["acpMode: ", selected.acpMode || '(none)'] }), _jsx(Text, { dimColor: true, children: "ACP agent \u2014 tools and permissions are the agent's own" })] })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { children: ["maxTurns: ", selected.maxTurns === 0 ? 'unlimited' : selected.maxTurns] }), _jsxs(Text, { children: ["tools:", ' ', selected.allowedTools.length === 0
|
|
200
202
|
? '(none)'
|
|
201
203
|
: formatToolsForDetail(selected.allowedTools, selected.confirmTools ?? [])] }), _jsxs(Text, { children: ["plugins:", ' ', (selected.plugins ?? []).length === 0 ? '(none)' : selected.plugins.join(', ')] })] })), _jsxs(Text, { children: ["mcp: ", (selected.mcpServers ?? []).length === 0 ? '(none)' : selected.mcpServers.length, ' ', "server(s)"] }), _jsxs(Text, { children: ["workDir: ", selected.workingDir || '(cwd)'] }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "system prompt:" }), _jsx(Text, { children: selected.systemPrompt || '(empty)' })] }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: [
|
|
202
204
|
{ label: 'New chat', value: 'new-chat' },
|
|
@@ -275,19 +277,24 @@ function namespacedToolList(allTools) {
|
|
|
275
277
|
})),
|
|
276
278
|
];
|
|
277
279
|
}
|
|
278
|
-
// Computes the step sequence for a given form flavor, so
|
|
279
|
-
// skip
|
|
280
|
-
// place instead of scattered across
|
|
281
|
-
|
|
280
|
+
// Computes the step sequence for a given form flavor, so the external-runner
|
|
281
|
+
// branching (claude-code, acp: skip tools/plugins/maxTurns; claude-code adds
|
|
282
|
+
// permissionMode/strictMcp) lives in one place instead of scattered across
|
|
283
|
+
// every transition.
|
|
284
|
+
function stepSequence(managed, flavor) {
|
|
282
285
|
const seq = [];
|
|
283
286
|
if (!managed)
|
|
284
287
|
seq.push('name');
|
|
285
288
|
seq.push('provider', 'model');
|
|
286
289
|
if (!managed)
|
|
287
290
|
seq.push('systemPrompt');
|
|
288
|
-
if (
|
|
291
|
+
if (flavor === 'claude-code') {
|
|
289
292
|
seq.push('mcpServers', 'workingDir', 'permissionMode', 'strictMcp');
|
|
290
293
|
}
|
|
294
|
+
else if (flavor === 'acp') {
|
|
295
|
+
// acp agents own their tools/permissions; acpMode is the last step.
|
|
296
|
+
seq.push('mcpServers', 'workingDir', 'acpMode');
|
|
297
|
+
}
|
|
291
298
|
else {
|
|
292
299
|
seq.push('tools', 'plugins', 'mcpServers', 'workingDir', 'maxTurns');
|
|
293
300
|
}
|
|
@@ -301,11 +308,15 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
301
308
|
const [step, setStep] = useState(managed ? 'provider' : 'name');
|
|
302
309
|
const [name, setName] = useState(initial?.name ?? '');
|
|
303
310
|
const [provider, setProvider] = useState(initial?.provider ?? '');
|
|
304
|
-
const
|
|
311
|
+
const providerType = providers.find((p) => p.name === provider)?.type ?? 'openai';
|
|
312
|
+
const isClaudeCode = providerType === 'claude-code';
|
|
313
|
+
const isAcp = providerType === 'acp';
|
|
314
|
+
const isExternalRunner = isClaudeCode || isAcp;
|
|
305
315
|
const [model, setModel] = useState(initial?.model ?? '');
|
|
306
316
|
const [systemPrompt, setSystemPrompt] = useState(initial?.systemPrompt ?? '');
|
|
307
317
|
const [permissionMode, setPermissionMode] = useState(initial?.permissionMode ?? '');
|
|
308
318
|
const [strictMcp, setStrictMcp] = useState(initial?.strictMcp ?? false);
|
|
319
|
+
const [acpMode, setAcpMode] = useState(initial?.acpMode ?? '');
|
|
309
320
|
// The picker offers one entry per `mcp__<ns>__` namespace (task, email, …),
|
|
310
321
|
// not the individual tools, so a stored per-tool selection is collapsed onto
|
|
311
322
|
// the wildcard. resolveAgentTools expands it back at run time.
|
|
@@ -341,16 +352,17 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
341
352
|
onCancel();
|
|
342
353
|
});
|
|
343
354
|
// Step sequence computed as a filtered array (rather than scattering
|
|
344
|
-
//
|
|
345
|
-
// tools/plugins/maxTurns
|
|
346
|
-
const steps = stepSequence(managed,
|
|
355
|
+
// provider-type conditionals across every transition): external runners skip
|
|
356
|
+
// tools/plugins/maxTurns; claude-code gets a permissionMode step instead.
|
|
357
|
+
const steps = stepSequence(managed, providerType);
|
|
347
358
|
const nextAfter = (s) => {
|
|
348
359
|
const idx = steps.indexOf(s);
|
|
349
360
|
return idx >= 0 && idx + 1 < steps.length ? steps[idx + 1] : s;
|
|
350
361
|
};
|
|
351
|
-
const finalize = (n, permissionModeOverride, strictMcpOverride) => {
|
|
362
|
+
const finalize = (n, permissionModeOverride, strictMcpOverride, acpModeOverride) => {
|
|
352
363
|
const pm = permissionModeOverride ?? permissionMode;
|
|
353
364
|
const sm = strictMcpOverride ?? strictMcp;
|
|
365
|
+
const am = acpModeOverride ?? acpMode;
|
|
354
366
|
const a = {
|
|
355
367
|
id: initial?.id ?? randomUUID(),
|
|
356
368
|
name: name.trim(),
|
|
@@ -365,6 +377,7 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
365
377
|
...(workingDir.trim() ? { workingDir: workingDir.trim() } : {}),
|
|
366
378
|
...(isClaudeCode && pm ? { permissionMode: pm } : {}),
|
|
367
379
|
...(isClaudeCode && sm ? { strictMcp: true } : {}),
|
|
380
|
+
...(isAcp && am.trim() ? { acpMode: am.trim() } : {}),
|
|
368
381
|
// Preserve plugin-managed origin tags so the next sync recognizes
|
|
369
382
|
// this row instead of orphaning it.
|
|
370
383
|
...(initial?.pluginId ? { pluginId: initial.pluginId } : {}),
|
|
@@ -403,8 +416,18 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
403
416
|
if (v && !isAbsolute(v))
|
|
404
417
|
return setError('workingDir must be an absolute path (or empty for cwd)');
|
|
405
418
|
setError(null);
|
|
419
|
+
if (steps[steps.length - 1] === 'workingDir') {
|
|
420
|
+
// acp flavor: workingDir is the last step — no maxTurns to collect.
|
|
421
|
+
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
422
|
+
finalize(Number.isFinite(n) && n >= 0 ? n : 30);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
406
425
|
setStep(nextAfter('workingDir'));
|
|
407
426
|
}
|
|
427
|
+
else if (step === 'acpMode') {
|
|
428
|
+
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
429
|
+
finalize(Number.isFinite(n) && n >= 0 ? n : 30);
|
|
430
|
+
}
|
|
408
431
|
else if (step === 'maxTurns') {
|
|
409
432
|
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
410
433
|
if (!Number.isFinite(n) || n < 0)
|
|
@@ -420,10 +443,10 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
420
443
|
setModel(id);
|
|
421
444
|
setError(null);
|
|
422
445
|
setStep(nextAfter('model'));
|
|
423
|
-
} })) : ['name', 'provider'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: model }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "prompt: " }), managed ? (_jsxs(Text, { children: [_jsxs(Text, { children: [(systemPrompt || '(empty)').slice(0, 80), systemPrompt.length > 80 ? '…' : ''] }), _jsx(Text, { dimColor: true, children: ' (managed by plugin)' })] })) : step === 'systemPrompt' ? (_jsx(TextInput, { value: systemPrompt, onChange: setSystemPrompt, onSubmit: advance, placeholder: isEdit ? '(enter to keep current)' : '(optional system prompt)' })) : ['name', 'provider', 'model'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: systemPrompt || '(empty)' }))] }), !
|
|
446
|
+
} })) : ['name', 'provider'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: model }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "prompt: " }), managed ? (_jsxs(Text, { children: [_jsxs(Text, { children: [(systemPrompt || '(empty)').slice(0, 80), systemPrompt.length > 80 ? '…' : ''] }), _jsx(Text, { dimColor: true, children: ' (managed by plugin)' })] })) : step === 'systemPrompt' ? (_jsx(TextInput, { value: systemPrompt, onChange: setSystemPrompt, onSubmit: advance, placeholder: isEdit ? '(enter to keep current)' : '(optional system prompt)' })) : ['name', 'provider', 'model'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: systemPrompt || '(empty)' }))] }), !isExternalRunner && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "tools:" }), step === 'tools' ? (_jsx(ToolPicker, { tools: namespacedToolList(toolRegistry.list()), allowed: allowedTools, confirm: confirmTools, onChange: (a, c) => {
|
|
424
447
|
setAllowedTools(a);
|
|
425
448
|
setConfirmTools(c);
|
|
426
|
-
}, onSubmit: advance })) : ['name', 'provider', 'model', 'systemPrompt'].includes(step) ? (_jsx(Text, { dimColor: true, children: " (pending)" })) : (_jsx(Text, { children: ` ${allowedTools.length === 0 ? '(none)' : formatToolsForDetail(allowedTools, confirmTools)}` }))] })), !
|
|
449
|
+
}, onSubmit: advance })) : ['name', 'provider', 'model', 'systemPrompt'].includes(step) ? (_jsx(Text, { dimColor: true, children: " (pending)" })) : (_jsx(Text, { children: ` ${allowedTools.length === 0 ? '(none)' : formatToolsForDetail(allowedTools, confirmTools)}` }))] })), !isExternalRunner && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "plugins:" }), step === 'plugins' ? (_jsx(PluginPicker, { plugins: discoveredPlugins, value: activePlugins, onChange: setActivePlugins, onSubmit: advance })) : ['name', 'provider', 'model', 'systemPrompt', 'tools'].includes(step) ? (_jsx(Text, { dimColor: true, children: " (pending)" })) : (_jsx(Text, { children: ` ${activePlugins.length === 0 ? '(none)' : activePlugins.join(', ')}` }))] })), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "mcp:" }), step === 'mcpServers' ? (_jsx(McpPicker, { servers: mcpServers, value: activeMcp, onChange: setActiveMcp, onSubmit: advance })) : ['name', 'provider', 'model', 'systemPrompt', 'tools', 'plugins'].includes(step) ? (_jsx(Text, { dimColor: true, children: " (pending)" })) : (_jsx(Text, { children: ` ${activeMcp.length === 0
|
|
427
450
|
? '(none)'
|
|
428
451
|
: activeMcp.map((id) => mcpServers.find((s) => s.id === id)?.name ?? id).join(', ')}` }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "workDir: " }), step === 'workingDir' ? (_jsx(TextInput, { value: workingDir, onChange: setWorkingDir, onSubmit: advance, placeholder: "(empty = process.cwd() \u2014 absolute path otherwise)" })) : [
|
|
429
452
|
'name',
|
|
@@ -433,7 +456,7 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
433
456
|
'tools',
|
|
434
457
|
'plugins',
|
|
435
458
|
'mcpServers',
|
|
436
|
-
].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: workingDir.trim() || '(cwd)' }))] }), !
|
|
459
|
+
].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: workingDir.trim() || '(cwd)' }))] }), !isExternalRunner && (_jsxs(Box, { children: [_jsx(Text, { children: "maxTurns: " }), step === 'maxTurns' ? (_jsx(TextInput, { value: maxTurns, onChange: setMaxTurns, onSubmit: advance, placeholder: "0 = unlimited" })) : (_jsx(Text, { dimColor: true, children: "(pending)" }))] })), isClaudeCode && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "permissionMode: " }), step === 'permissionMode' ? (_jsx(SelectInput, { items: [
|
|
437
460
|
{ label: 'Auto (Claude Code default)', value: '' },
|
|
438
461
|
...CLAUDE_CODE_PERMISSION_MODES.map((m) => ({ label: m, value: m })),
|
|
439
462
|
], initialIndex: permissionMode
|
|
@@ -451,16 +474,21 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
451
474
|
setError(null);
|
|
452
475
|
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
453
476
|
finalize(Number.isFinite(n) && n >= 0 ? n : 30, undefined, val);
|
|
454
|
-
} })) : step === 'permissionMode' ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: strictMcp ? 'on' : 'off' }))] })),
|
|
477
|
+
} })) : step === 'permissionMode' ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: strictMcp ? 'on' : 'off' }))] })), isAcp && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "acpMode: " }), step === 'acpMode' ? (_jsx(TextInput, { value: acpMode, onChange: setAcpMode, onSubmit: (val) => {
|
|
478
|
+
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
479
|
+
finalize(Number.isFinite(n) && n >= 0 ? n : 30, undefined, undefined, val);
|
|
480
|
+
}, placeholder: "optional \u2014 e.g. acceptEdits | bypassPermissions" })) : steps.indexOf(step) < steps.indexOf('acpMode') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: acpMode || '(none)' })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Pins the agent to one of its own session modes at start (session/set_mode)." }) })] })), error && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "red", children: error }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "(esc to cancel)" }) })] }));
|
|
455
481
|
}
|
|
456
482
|
function ModelStep({ provider, initialModel, onPick, }) {
|
|
457
483
|
const isClaudeCode = provider.type === 'claude-code';
|
|
458
|
-
const
|
|
484
|
+
const isAcp = provider.type === 'acp';
|
|
485
|
+
const isExternalRunner = isClaudeCode || isAcp;
|
|
486
|
+
const [state, setState] = useState(isExternalRunner ? { mode: 'manual', reason: null } : { mode: 'loading' });
|
|
459
487
|
const [manualValue, setManualValue] = useState(initialModel ?? '');
|
|
460
488
|
useEffect(() => {
|
|
461
|
-
// claude-code
|
|
462
|
-
// endpoint — always go straight to manual entry.
|
|
463
|
-
if (
|
|
489
|
+
// External-runner providers (claude-code, acp) never expose an OpenAI-style
|
|
490
|
+
// model-listing endpoint — always go straight to manual entry.
|
|
491
|
+
if (isExternalRunner)
|
|
464
492
|
return;
|
|
465
493
|
let cancelled = false;
|
|
466
494
|
void fetchOpenAiStyleModels(provider.endpoint, provider.apiKey ?? null).then((res) => {
|
|
@@ -479,16 +507,22 @@ function ModelStep({ provider, initialModel, onPick, }) {
|
|
|
479
507
|
return () => {
|
|
480
508
|
cancelled = true;
|
|
481
509
|
};
|
|
482
|
-
}, [
|
|
510
|
+
}, [isExternalRunner, provider.endpoint, provider.apiKey]);
|
|
483
511
|
if (state.mode === 'loading') {
|
|
484
512
|
return _jsxs(Text, { dimColor: true, children: ["fetching models from ", provider.name, "\u2026"] });
|
|
485
513
|
}
|
|
486
514
|
if (state.mode === 'manual') {
|
|
487
515
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(TextInput, { value: manualValue, onChange: setManualValue, onSubmit: () => {
|
|
488
516
|
const v = manualValue.trim();
|
|
489
|
-
|
|
517
|
+
// acp: the agent server picks its own model — the field is only an
|
|
518
|
+
// optional label (shown in task threads), so empty is fine.
|
|
519
|
+
if (v || isAcp)
|
|
490
520
|
onPick(v);
|
|
491
|
-
}, placeholder: isClaudeCode
|
|
521
|
+
}, placeholder: isClaudeCode
|
|
522
|
+
? 'sonnet | opus | haiku (or full model id)'
|
|
523
|
+
: isAcp
|
|
524
|
+
? 'optional — label shown in task threads'
|
|
525
|
+
: 'e.g. gpt-4o-mini' }), state.reason && (_jsx(Text, { dimColor: true, color: "yellow", children: state.reason.slice(0, 200) }))] }));
|
|
492
526
|
}
|
|
493
527
|
const items = [
|
|
494
528
|
...state.ids.map((id) => ({ label: id, value: `m:${id}` })),
|
package/dist/tui/chat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/tui/chat.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/tui/chat.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI/D,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,cAAc,EACd,MAAM,GACP,EAAE;IACD,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,8FAA8F;IAC9F,cAAc,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC1C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,2CAsSA"}
|