@hyperwindmill/caretaker-cli 0.23.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_extract.d.ts +55 -0
- package/dist/cli/web/scheduler/memory_extract.d.ts.map +1 -0
- package/dist/cli/web/scheduler/memory_extract.js +112 -0
- package/dist/cli/web/scheduler/memory_sweep.d.ts +68 -0
- package/dist/cli/web/scheduler/memory_sweep.d.ts.map +1 -0
- package/dist/cli/web/scheduler/memory_sweep.js +330 -0
- package/dist/cli/web/scheduler/task_review.d.ts +3 -0
- package/dist/cli/web/scheduler/task_review.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_review.js +26 -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 +27 -2
- package/dist/cli/web/scheduler.d.ts.map +1 -1
- package/dist/cli/web/scheduler.js +5 -0
- 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 +33 -6
- 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 +6 -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 +12 -0
- package/dist/harness/loop.d.ts.map +1 -1
- package/dist/harness/loop.js +16 -0
- package/dist/harness/memory_recall.d.ts +28 -0
- package/dist/harness/memory_recall.d.ts.map +1 -0
- package/dist/harness/memory_recall.js +74 -0
- package/dist/harness/title.js +1 -1
- package/dist/harness/tools/builtin/index.d.ts +2 -1
- package/dist/harness/tools/builtin/index.d.ts.map +1 -1
- package/dist/harness/tools/builtin/index.js +4 -1
- package/dist/harness/tools/builtin/memory_tools.d.ts +3 -0
- package/dist/harness/tools/builtin/memory_tools.d.ts.map +1 -0
- package/dist/harness/tools/builtin/memory_tools.js +60 -0
- package/dist/harness/tools/resolve.d.ts.map +1 -1
- package/dist/harness/tools/resolve.js +15 -0
- package/dist/harness/tools/types.d.ts +6 -0
- package/dist/harness/tools/types.d.ts.map +1 -1
- package/dist/lib/project_resolve.d.ts +5 -0
- package/dist/lib/project_resolve.d.ts.map +1 -0
- package/dist/lib/project_resolve.js +23 -0
- package/dist/mcp/builtin_server.d.ts +2 -0
- package/dist/mcp/builtin_server.d.ts.map +1 -1
- package/dist/mcp/builtin_server.js +9 -7
- 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/store/db.d.ts +66 -0
- package/dist/store/db.d.ts.map +1 -1
- package/dist/store/db.js +68 -0
- package/dist/tui/agents.d.ts.map +1 -1
- package/dist/tui/agents.js +62 -25
- 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 +792 -440
- package/dist/webview/standalone.js.map +4 -4
- package/package.json +8 -3
package/dist/store/db.js
CHANGED
|
@@ -149,3 +149,71 @@ export async function deleteTask(taskId) {
|
|
|
149
149
|
await runQuery(`DELETE FROM task_messages WHERE taskId = '${taskId}'`);
|
|
150
150
|
await runQuery(`DELETE FROM tasks WHERE id = '${taskId}'`);
|
|
151
151
|
}
|
|
152
|
+
export async function getSessionDigest(sessionId) {
|
|
153
|
+
if (!safeId(sessionId))
|
|
154
|
+
return null;
|
|
155
|
+
try {
|
|
156
|
+
const rows = (await runQuery(`SELECT * FROM session_digests WHERE id = '${sessionId}'`));
|
|
157
|
+
return rows[0] || null;
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export async function listSessionDigests() {
|
|
164
|
+
try {
|
|
165
|
+
return (await runQuery('SELECT * FROM session_digests'));
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export async function saveSessionDigest(d) {
|
|
172
|
+
if (!safeId(d.id))
|
|
173
|
+
throw new Error(`Invalid session id: ${d.id}`);
|
|
174
|
+
// Delete + insert = upsert; summary goes through JSON.stringify, so quotes
|
|
175
|
+
// and newlines never touch the interpolated SQL string.
|
|
176
|
+
await runQuery(`DELETE FROM session_digests WHERE id = '${d.id}'`);
|
|
177
|
+
await runQuery(`INSERT INTO session_digests ${JSON.stringify({ ...d, updatedAt: new Date().toISOString() })}`);
|
|
178
|
+
}
|
|
179
|
+
export async function deleteSessionDigest(sessionId) {
|
|
180
|
+
if (!safeId(sessionId))
|
|
181
|
+
return;
|
|
182
|
+
await runQuery(`DELETE FROM session_digests WHERE id = '${sessionId}'`);
|
|
183
|
+
}
|
|
184
|
+
export async function saveMemory(m) {
|
|
185
|
+
if (!safeId(m.id))
|
|
186
|
+
throw new Error(`Invalid memory id: ${m.id}`);
|
|
187
|
+
// Insert-only: memories are append-only; there is deliberately no upsert.
|
|
188
|
+
await runQuery(`INSERT INTO memories ${JSON.stringify(m)}`);
|
|
189
|
+
}
|
|
190
|
+
export async function listMemories() {
|
|
191
|
+
try {
|
|
192
|
+
return (await runQuery('SELECT * FROM memories'));
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
export async function deleteMemory(id) {
|
|
199
|
+
if (!safeId(id))
|
|
200
|
+
return;
|
|
201
|
+
await runQuery(`DELETE FROM memories WHERE id = '${id}'`);
|
|
202
|
+
}
|
|
203
|
+
/** Recall event: memory_read delivered this memory to an agent. Delete +
|
|
204
|
+
* insert (saveSessionDigest pattern — the store has no UPDATE). No-op on
|
|
205
|
+
* unknown ids: a stale id in a prelude block is not an error. */
|
|
206
|
+
export async function bumpMemoryRecall(id) {
|
|
207
|
+
if (!safeId(id))
|
|
208
|
+
return;
|
|
209
|
+
const rows = (await runQuery(`SELECT * FROM memories WHERE id = '${id}'`));
|
|
210
|
+
const m = rows[0];
|
|
211
|
+
if (!m)
|
|
212
|
+
return;
|
|
213
|
+
await runQuery(`DELETE FROM memories WHERE id = '${id}'`);
|
|
214
|
+
await runQuery(`INSERT INTO memories ${JSON.stringify({
|
|
215
|
+
...m,
|
|
216
|
+
recallCount: (m.recallCount ?? 0) + 1,
|
|
217
|
+
lastRecalledAt: new Date().toISOString(),
|
|
218
|
+
})}`);
|
|
219
|
+
}
|
package/dist/tui/agents.d.ts.map
CHANGED
|
@@ -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' },
|
|
@@ -257,8 +259,11 @@ const NAMESPACE_DESCRIPTIONS = {
|
|
|
257
259
|
mcp__email__: 'List the configured email accounts and send mail',
|
|
258
260
|
};
|
|
259
261
|
/** The picker's tool list: one synthetic entry per `mcp__<ns>__` namespace in
|
|
260
|
-
* place of its individual tools, everything else as-is.
|
|
261
|
-
|
|
262
|
+
* place of its individual tools, everything else as-is. Hidden tools
|
|
263
|
+
* (memory_read) are harness infrastructure, auto-included by
|
|
264
|
+
* resolveAgentTools behind their own gate — never a picker choice. */
|
|
265
|
+
function namespacedToolList(allTools) {
|
|
266
|
+
const tools = allTools.filter((t) => !t.hidden);
|
|
262
267
|
const namespaces = [
|
|
263
268
|
...new Set(tools.map((t) => /^mcp__[a-z]+__/.exec(t.name)?.[0]).filter((p) => !!p)),
|
|
264
269
|
];
|
|
@@ -272,19 +277,24 @@ function namespacedToolList(tools) {
|
|
|
272
277
|
})),
|
|
273
278
|
];
|
|
274
279
|
}
|
|
275
|
-
// Computes the step sequence for a given form flavor, so
|
|
276
|
-
// skip
|
|
277
|
-
// place instead of scattered across
|
|
278
|
-
|
|
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) {
|
|
279
285
|
const seq = [];
|
|
280
286
|
if (!managed)
|
|
281
287
|
seq.push('name');
|
|
282
288
|
seq.push('provider', 'model');
|
|
283
289
|
if (!managed)
|
|
284
290
|
seq.push('systemPrompt');
|
|
285
|
-
if (
|
|
291
|
+
if (flavor === 'claude-code') {
|
|
286
292
|
seq.push('mcpServers', 'workingDir', 'permissionMode', 'strictMcp');
|
|
287
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
|
+
}
|
|
288
298
|
else {
|
|
289
299
|
seq.push('tools', 'plugins', 'mcpServers', 'workingDir', 'maxTurns');
|
|
290
300
|
}
|
|
@@ -298,11 +308,15 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
298
308
|
const [step, setStep] = useState(managed ? 'provider' : 'name');
|
|
299
309
|
const [name, setName] = useState(initial?.name ?? '');
|
|
300
310
|
const [provider, setProvider] = useState(initial?.provider ?? '');
|
|
301
|
-
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;
|
|
302
315
|
const [model, setModel] = useState(initial?.model ?? '');
|
|
303
316
|
const [systemPrompt, setSystemPrompt] = useState(initial?.systemPrompt ?? '');
|
|
304
317
|
const [permissionMode, setPermissionMode] = useState(initial?.permissionMode ?? '');
|
|
305
318
|
const [strictMcp, setStrictMcp] = useState(initial?.strictMcp ?? false);
|
|
319
|
+
const [acpMode, setAcpMode] = useState(initial?.acpMode ?? '');
|
|
306
320
|
// The picker offers one entry per `mcp__<ns>__` namespace (task, email, …),
|
|
307
321
|
// not the individual tools, so a stored per-tool selection is collapsed onto
|
|
308
322
|
// the wildcard. resolveAgentTools expands it back at run time.
|
|
@@ -338,16 +352,17 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
338
352
|
onCancel();
|
|
339
353
|
});
|
|
340
354
|
// Step sequence computed as a filtered array (rather than scattering
|
|
341
|
-
//
|
|
342
|
-
// tools/plugins/maxTurns
|
|
343
|
-
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);
|
|
344
358
|
const nextAfter = (s) => {
|
|
345
359
|
const idx = steps.indexOf(s);
|
|
346
360
|
return idx >= 0 && idx + 1 < steps.length ? steps[idx + 1] : s;
|
|
347
361
|
};
|
|
348
|
-
const finalize = (n, permissionModeOverride, strictMcpOverride) => {
|
|
362
|
+
const finalize = (n, permissionModeOverride, strictMcpOverride, acpModeOverride) => {
|
|
349
363
|
const pm = permissionModeOverride ?? permissionMode;
|
|
350
364
|
const sm = strictMcpOverride ?? strictMcp;
|
|
365
|
+
const am = acpModeOverride ?? acpMode;
|
|
351
366
|
const a = {
|
|
352
367
|
id: initial?.id ?? randomUUID(),
|
|
353
368
|
name: name.trim(),
|
|
@@ -362,6 +377,7 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
362
377
|
...(workingDir.trim() ? { workingDir: workingDir.trim() } : {}),
|
|
363
378
|
...(isClaudeCode && pm ? { permissionMode: pm } : {}),
|
|
364
379
|
...(isClaudeCode && sm ? { strictMcp: true } : {}),
|
|
380
|
+
...(isAcp && am.trim() ? { acpMode: am.trim() } : {}),
|
|
365
381
|
// Preserve plugin-managed origin tags so the next sync recognizes
|
|
366
382
|
// this row instead of orphaning it.
|
|
367
383
|
...(initial?.pluginId ? { pluginId: initial.pluginId } : {}),
|
|
@@ -400,8 +416,18 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
400
416
|
if (v && !isAbsolute(v))
|
|
401
417
|
return setError('workingDir must be an absolute path (or empty for cwd)');
|
|
402
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
|
+
}
|
|
403
425
|
setStep(nextAfter('workingDir'));
|
|
404
426
|
}
|
|
427
|
+
else if (step === 'acpMode') {
|
|
428
|
+
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
429
|
+
finalize(Number.isFinite(n) && n >= 0 ? n : 30);
|
|
430
|
+
}
|
|
405
431
|
else if (step === 'maxTurns') {
|
|
406
432
|
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
407
433
|
if (!Number.isFinite(n) || n < 0)
|
|
@@ -417,10 +443,10 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
417
443
|
setModel(id);
|
|
418
444
|
setError(null);
|
|
419
445
|
setStep(nextAfter('model'));
|
|
420
|
-
} })) : ['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) => {
|
|
421
447
|
setAllowedTools(a);
|
|
422
448
|
setConfirmTools(c);
|
|
423
|
-
}, 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
|
|
424
450
|
? '(none)'
|
|
425
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)" })) : [
|
|
426
452
|
'name',
|
|
@@ -430,7 +456,7 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
430
456
|
'tools',
|
|
431
457
|
'plugins',
|
|
432
458
|
'mcpServers',
|
|
433
|
-
].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: [
|
|
434
460
|
{ label: 'Auto (Claude Code default)', value: '' },
|
|
435
461
|
...CLAUDE_CODE_PERMISSION_MODES.map((m) => ({ label: m, value: m })),
|
|
436
462
|
], initialIndex: permissionMode
|
|
@@ -448,16 +474,21 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
448
474
|
setError(null);
|
|
449
475
|
const n = Number.parseInt(maxTurns.trim(), 10);
|
|
450
476
|
finalize(Number.isFinite(n) && n >= 0 ? n : 30, undefined, val);
|
|
451
|
-
} })) : 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)" }) })] }));
|
|
452
481
|
}
|
|
453
482
|
function ModelStep({ provider, initialModel, onPick, }) {
|
|
454
483
|
const isClaudeCode = provider.type === 'claude-code';
|
|
455
|
-
const
|
|
484
|
+
const isAcp = provider.type === 'acp';
|
|
485
|
+
const isExternalRunner = isClaudeCode || isAcp;
|
|
486
|
+
const [state, setState] = useState(isExternalRunner ? { mode: 'manual', reason: null } : { mode: 'loading' });
|
|
456
487
|
const [manualValue, setManualValue] = useState(initialModel ?? '');
|
|
457
488
|
useEffect(() => {
|
|
458
|
-
// claude-code
|
|
459
|
-
// endpoint — always go straight to manual entry.
|
|
460
|
-
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)
|
|
461
492
|
return;
|
|
462
493
|
let cancelled = false;
|
|
463
494
|
void fetchOpenAiStyleModels(provider.endpoint, provider.apiKey ?? null).then((res) => {
|
|
@@ -476,16 +507,22 @@ function ModelStep({ provider, initialModel, onPick, }) {
|
|
|
476
507
|
return () => {
|
|
477
508
|
cancelled = true;
|
|
478
509
|
};
|
|
479
|
-
}, [
|
|
510
|
+
}, [isExternalRunner, provider.endpoint, provider.apiKey]);
|
|
480
511
|
if (state.mode === 'loading') {
|
|
481
512
|
return _jsxs(Text, { dimColor: true, children: ["fetching models from ", provider.name, "\u2026"] });
|
|
482
513
|
}
|
|
483
514
|
if (state.mode === 'manual') {
|
|
484
515
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(TextInput, { value: manualValue, onChange: setManualValue, onSubmit: () => {
|
|
485
516
|
const v = manualValue.trim();
|
|
486
|
-
|
|
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)
|
|
487
520
|
onPick(v);
|
|
488
|
-
}, 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) }))] }));
|
|
489
526
|
}
|
|
490
527
|
const items = [
|
|
491
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"}
|
package/dist/tui/chat.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Box, Text, useInput } from 'ink';
|
|
|
4
4
|
import SelectInput from 'ink-select-input';
|
|
5
5
|
import TextInput from 'ink-text-input';
|
|
6
6
|
import { run } from '../harness/loop.js';
|
|
7
|
+
import { ConfirmGateState } from '../harness/confirm_gate.js';
|
|
7
8
|
import { tools as toolRegistry } from '../harness/tools/instance.js';
|
|
8
9
|
import { resolveAgentTools } from '../harness/tools/index.js';
|
|
9
10
|
import { expandTemplate, parseSlashInvocation, resolveCommand } from '../commands/loader.js';
|
|
@@ -21,10 +22,10 @@ export default function ChatScreen({ agent, provider, initialSession, onBack, })
|
|
|
21
22
|
const abortRef = useRef(null);
|
|
22
23
|
const titleAbortRef = useRef(null);
|
|
23
24
|
const titlePendingRef = useRef(false);
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
const
|
|
25
|
+
// Confirm-gate state: native/claude-code agents prompt only for
|
|
26
|
+
// agent.confirmTools names; ACP agents prompt on every permission request
|
|
27
|
+
// the agent raises. "always" is remembered in-memory only.
|
|
28
|
+
const confirmGateRef = useRef(new ConfirmGateState(provider.type, agent.confirmTools));
|
|
28
29
|
const [pendingConfirm, setPendingConfirm] = useState(null);
|
|
29
30
|
useEffect(() => {
|
|
30
31
|
if (!initialSession)
|
|
@@ -133,7 +134,7 @@ export default function ChatScreen({ agent, provider, initialSession, onBack, })
|
|
|
133
134
|
onChunk: (s) => setLiveText((prev) => prev + s),
|
|
134
135
|
onThinking: (s) => setLiveThinking((prev) => prev + s),
|
|
135
136
|
confirmTool: (id, name, args) => new Promise((resolve) => {
|
|
136
|
-
if (!
|
|
137
|
+
if (!confirmGateRef.current.needsAsk(name)) {
|
|
137
138
|
resolve('once');
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
@@ -208,9 +209,7 @@ export default function ChatScreen({ agent, provider, initialSession, onBack, })
|
|
|
208
209
|
{ label: 'Reject', value: 'reject' },
|
|
209
210
|
], onSelect: (item) => {
|
|
210
211
|
const decision = item.value;
|
|
211
|
-
|
|
212
|
-
confirmSetRef.current.delete(pendingConfirm.name);
|
|
213
|
-
}
|
|
212
|
+
confirmGateRef.current.remember(pendingConfirm.name, decision);
|
|
214
213
|
pendingConfirm.resolve(decision);
|
|
215
214
|
setPendingConfirm(null);
|
|
216
215
|
} }) })] })), mode === 'running' && !pendingConfirm && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "(running\u2026 esc to abort)" }) })), _jsx(ContextBar, { messages: messages, model: agent.model })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/tui/providers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/tui/providers.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,2CAmLnE"}
|
package/dist/tui/providers.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Box, Text, useInput } from 'ink';
|
|
|
4
4
|
import SelectInput from 'ink-select-input';
|
|
5
5
|
import TextInput from 'ink-text-input';
|
|
6
6
|
import { loadAgents, loadConfig, saveConfig } from '../store/json.js';
|
|
7
|
+
import { fetchAcpRegistry } from '../acp/index.js';
|
|
7
8
|
export default function Providers({ onBack }) {
|
|
8
9
|
const [providers, setProviders] = useState([]);
|
|
9
10
|
const [loaded, setLoaded] = useState(false);
|
|
@@ -67,8 +68,7 @@ export default function Providers({ onBack }) {
|
|
|
67
68
|
} }) })] }));
|
|
68
69
|
}
|
|
69
70
|
if (mode === 'detail' && selected) {
|
|
70
|
-
|
|
71
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: selected.name }), isClaudeCode ? (_jsxs(_Fragment, { children: [_jsx(Text, { children: "type: claude-code" }), _jsxs(Text, { children: ["command: ", selected.command || '(default: claude on PATH)'] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { children: ["endpoint: ", selected.endpoint] }), _jsxs(Text, { children: ["apiKey: ", selected.apiKey ? '(set)' : '(none)'] })] })), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: [
|
|
71
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: selected.name }), selected.type === 'acp' ? (_jsxs(_Fragment, { children: [_jsx(Text, { children: "type: External agent (ACP)" }), _jsxs(Text, { children: ["command: ", selected.command || '(none)'] }), _jsxs(Text, { children: ["args: ", (selected.args ?? []).join(' ') || '(none)'] })] })) : selected.type === 'claude-code' ? (_jsxs(_Fragment, { children: [_jsx(Text, { children: "type: claude-code" }), _jsxs(Text, { children: ["command: ", selected.command || '(default: claude on PATH)'] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { children: ["endpoint: ", selected.endpoint] }), _jsxs(Text, { children: ["apiKey: ", selected.apiKey ? '(set)' : '(none)'] })] })), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: [
|
|
72
72
|
{ label: 'Edit', value: 'edit' },
|
|
73
73
|
{ label: 'Delete', value: 'delete' },
|
|
74
74
|
{ label: '← Back', value: 'back' },
|
|
@@ -85,25 +85,24 @@ export default function Providers({ onBack }) {
|
|
|
85
85
|
}
|
|
86
86
|
const items = [
|
|
87
87
|
...providers.map((p) => ({
|
|
88
|
-
label: p.type === '
|
|
89
|
-
? `${p.name} —
|
|
90
|
-
:
|
|
88
|
+
label: p.type === 'acp'
|
|
89
|
+
? `${p.name} — External agent (ACP) — ${p.command ?? ''} ${(p.args ?? []).join(' ')}`.trim()
|
|
90
|
+
: p.type === 'claude-code'
|
|
91
|
+
? `${p.name} — Claude Code (local CLI)${p.command ? ` — ${p.command}` : ''}`
|
|
92
|
+
: `${p.name} — ${p.endpoint}`,
|
|
91
93
|
value: `p:${p.name}`,
|
|
92
94
|
})),
|
|
93
95
|
{ label: '+ Create new', value: '__new__' },
|
|
94
96
|
{ label: '← Back', value: '__back__' },
|
|
95
97
|
];
|
|
96
|
-
return (_jsxs(Box, { flexDirection: "column", children: [
|
|
98
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Providers" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: items, onSelect: (item) => {
|
|
97
99
|
if (item.value === '__back__')
|
|
98
100
|
return onBack();
|
|
99
101
|
if (item.value === '__new__')
|
|
100
102
|
return setMode('create');
|
|
101
|
-
const name = item.value.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
setSelected(p);
|
|
105
|
-
setMode('detail');
|
|
106
|
-
}
|
|
103
|
+
const name = item.value.slice(2);
|
|
104
|
+
setSelected(providers.find((p) => p.name === name) ?? null);
|
|
105
|
+
setMode('detail');
|
|
107
106
|
} }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "(esc to go back)" }) })] }));
|
|
108
107
|
}
|
|
109
108
|
function ProviderForm({ existingNames, initial, onSave, onCancel, }) {
|
|
@@ -112,17 +111,87 @@ function ProviderForm({ existingNames, initial, onSave, onCancel, }) {
|
|
|
112
111
|
// providers by name, so switching type out from under them is a footgun
|
|
113
112
|
// (same rationale as the webview form).
|
|
114
113
|
const [type, setType] = useState(initial?.type ?? 'openai');
|
|
115
|
-
const [step, setStep] = useState(isEdit ? (type === 'claude-code' ? 'command' : 'endpoint') : 'type');
|
|
114
|
+
const [step, setStep] = useState(isEdit ? (type === 'acp' || type === 'claude-code' ? 'command' : 'endpoint') : 'type');
|
|
116
115
|
const [name, setName] = useState(initial?.name ?? '');
|
|
117
116
|
const [endpoint, setEndpoint] = useState(initial?.endpoint ?? '');
|
|
118
117
|
const [apiKey, setApiKey] = useState(initial?.apiKey ?? '');
|
|
119
118
|
const [command, setCommand] = useState(initial?.command ?? '');
|
|
119
|
+
const [args, setArgs] = useState((initial?.args ?? []).join(' '));
|
|
120
|
+
const [presets, setPresets] = useState([]);
|
|
121
|
+
const [presetError, setPresetError] = useState(null);
|
|
122
|
+
const [presetLabel, setPresetLabel] = useState('Custom (manual command)');
|
|
123
|
+
const [selfLoaded, setSelfLoaded] = useState(initial?.selfLoadedContextFiles ?? []);
|
|
124
|
+
const [env, setEnv] = useState(initial?.env);
|
|
120
125
|
const [error, setError] = useState(null);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (step === 'preset') {
|
|
128
|
+
void fetchAcpRegistry()
|
|
129
|
+
.then(setPresets)
|
|
130
|
+
.catch((e) => {
|
|
131
|
+
setPresetError(String(e));
|
|
132
|
+
setStep('command');
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, [step]);
|
|
121
136
|
useInput((_input, key) => {
|
|
122
137
|
if (key.escape)
|
|
123
138
|
onCancel();
|
|
124
139
|
});
|
|
140
|
+
const presetItems = [
|
|
141
|
+
{ label: 'Custom (manual command)', value: 'custom' },
|
|
142
|
+
...presets.map((p) => ({
|
|
143
|
+
label: p.dist
|
|
144
|
+
? p.dist.kind === 'binary'
|
|
145
|
+
? `${p.name} (binary — install from the web GUI, or enter the path manually)`
|
|
146
|
+
: p.name
|
|
147
|
+
: `${p.name} (not available on this platform)`,
|
|
148
|
+
value: p.id,
|
|
149
|
+
})),
|
|
150
|
+
];
|
|
151
|
+
const handleSelectPreset = (item) => {
|
|
152
|
+
if (item.value === 'custom') {
|
|
153
|
+
setPresetLabel('Custom (manual command)');
|
|
154
|
+
setSelfLoaded([]);
|
|
155
|
+
setEnv(undefined);
|
|
156
|
+
setStep('command');
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const chosen = presets.find((p) => p.id === item.value);
|
|
160
|
+
if (!chosen) {
|
|
161
|
+
setStep('command');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
setPresetLabel(chosen.name);
|
|
165
|
+
setSelfLoaded(chosen.selfLoadedContextFiles);
|
|
166
|
+
if (chosen.dist?.env)
|
|
167
|
+
setEnv(chosen.dist.env);
|
|
168
|
+
// Prefill only — the user reviews command/args before saving (binary
|
|
169
|
+
// presets have nothing to prefill: install from the web GUI or type the path).
|
|
170
|
+
const prefill = chosen.dist && chosen.dist.kind !== 'binary' ? chosen.dist : null;
|
|
171
|
+
setCommand(prefill ? prefill.command : '');
|
|
172
|
+
setArgs(prefill ? prefill.args.join(' ') : '');
|
|
173
|
+
setStep('command');
|
|
174
|
+
};
|
|
125
175
|
const finalize = () => {
|
|
176
|
+
if (type === 'acp') {
|
|
177
|
+
const p = {
|
|
178
|
+
name: name.trim(),
|
|
179
|
+
type: 'acp',
|
|
180
|
+
endpoint: '',
|
|
181
|
+
command: command.trim(),
|
|
182
|
+
};
|
|
183
|
+
const argList = args.trim() ? args.trim().split(/\s+/) : [];
|
|
184
|
+
if (argList.length)
|
|
185
|
+
p.args = argList;
|
|
186
|
+
const envToSave = env ?? initial?.env;
|
|
187
|
+
if (envToSave)
|
|
188
|
+
p.env = envToSave;
|
|
189
|
+
const selfLoadedToSave = selfLoaded.length ? selfLoaded : initial?.selfLoadedContextFiles;
|
|
190
|
+
if (selfLoadedToSave?.length)
|
|
191
|
+
p.selfLoadedContextFiles = selfLoadedToSave;
|
|
192
|
+
void onSave(p);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
126
195
|
if (type === 'claude-code') {
|
|
127
196
|
const p = { name: name.trim(), type: 'claude-code', endpoint: '' };
|
|
128
197
|
if (command.trim())
|
|
@@ -147,7 +216,15 @@ function ProviderForm({ existingNames, initial, onSave, onCancel, }) {
|
|
|
147
216
|
if (existingNames.includes(v))
|
|
148
217
|
return setError('name already exists');
|
|
149
218
|
setError(null);
|
|
150
|
-
|
|
219
|
+
if (type === 'acp') {
|
|
220
|
+
setStep('preset');
|
|
221
|
+
}
|
|
222
|
+
else if (type === 'claude-code') {
|
|
223
|
+
setStep('command');
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
setStep('endpoint');
|
|
227
|
+
}
|
|
151
228
|
}
|
|
152
229
|
else if (step === 'endpoint') {
|
|
153
230
|
const v = endpoint.trim();
|
|
@@ -157,6 +234,19 @@ function ProviderForm({ existingNames, initial, onSave, onCancel, }) {
|
|
|
157
234
|
setStep('apiKey');
|
|
158
235
|
}
|
|
159
236
|
else if (step === 'command') {
|
|
237
|
+
if (type === 'acp') {
|
|
238
|
+
const v = command.trim();
|
|
239
|
+
if (!v)
|
|
240
|
+
return setError('command is required (e.g. npx or binary path)');
|
|
241
|
+
setError(null);
|
|
242
|
+
setStep('args');
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
setError(null);
|
|
246
|
+
finalize();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else if (step === 'args') {
|
|
160
250
|
setError(null);
|
|
161
251
|
finalize();
|
|
162
252
|
}
|
|
@@ -164,15 +254,24 @@ function ProviderForm({ existingNames, initial, onSave, onCancel, }) {
|
|
|
164
254
|
finalize();
|
|
165
255
|
}
|
|
166
256
|
};
|
|
167
|
-
const stepOrder = type === '
|
|
257
|
+
const stepOrder = type === 'acp'
|
|
258
|
+
? ['type', 'name', 'preset', 'command', 'args']
|
|
259
|
+
: type === 'claude-code'
|
|
260
|
+
? ['type', 'name', 'command']
|
|
261
|
+
: ['type', 'name', 'endpoint', 'apiKey'];
|
|
168
262
|
const currentIdx = stepOrder.indexOf(step);
|
|
169
263
|
const isPending = (s) => stepOrder.indexOf(s) > currentIdx;
|
|
170
264
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: isEdit ? `Edit provider "${initial.name}"` : 'New provider' }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { children: "type: " }), !isEdit && step === 'type' ? (_jsx(SelectInput, { items: [
|
|
171
265
|
{ label: 'OpenAI-compatible endpoint', value: 'openai' },
|
|
172
266
|
{ label: 'Claude Code (local CLI)', value: 'claude-code' },
|
|
173
|
-
|
|
267
|
+
{ label: 'External agent (ACP)', value: 'acp' },
|
|
268
|
+
], initialIndex: type === 'acp' ? 2 : type === 'claude-code' ? 1 : 0, onSelect: (item) => {
|
|
174
269
|
setType(item.value);
|
|
175
270
|
setError(null);
|
|
176
271
|
setStep('name');
|
|
177
|
-
} })) : (_jsx(Text, { children: type === '
|
|
272
|
+
} })) : (_jsx(Text, { children: type === 'acp'
|
|
273
|
+
? 'External agent (ACP)'
|
|
274
|
+
: type === 'claude-code'
|
|
275
|
+
? 'Claude Code (local CLI)'
|
|
276
|
+
: 'OpenAI-compatible endpoint' }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "name: " }), !isEdit && step === 'name' ? (_jsx(TextInput, { value: name, onChange: setName, onSubmit: submit })) : isPending('name') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: name }))] }), type === 'acp' ? (_jsxs(_Fragment, { children: [!isEdit && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { children: "preset: " }), step === 'preset' ? (presets.length === 0 && !presetError ? (_jsx(Text, { dimColor: true, children: "loading presets\u2026" })) : (_jsx(SelectInput, { items: presetItems, onSelect: handleSelectPreset }))) : isPending('preset') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: presetLabel }))] }), presetError && (_jsx(Box, { children: _jsxs(Text, { dimColor: true, children: ["Registry unavailable (", presetError, ") \u2014 enter command manually"] }) }))] })), _jsxs(Box, { children: [_jsx(Text, { children: "command: " }), step === 'command' ? (_jsx(TextInput, { value: command, onChange: setCommand, onSubmit: submit, placeholder: "npx or /path/to/binary" })) : isPending('command') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: command }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "arguments: " }), step === 'args' ? (_jsx(TextInput, { value: args, onChange: setArgs, onSubmit: submit, placeholder: "@agentclientprotocol/claude-agent-acp" })) : isPending('args') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: args || '(none)' }))] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Space-separated arguments for the agent server. Edit caretaker.json for env vars." }) })] })) : type === 'claude-code' ? (_jsxs(_Fragment, { children: [_jsxs(Box, { children: [_jsx(Text, { children: "command: " }), step === 'command' ? (_jsx(TextInput, { value: command, onChange: setCommand, onSubmit: submit, placeholder: "claude (default: resolved from PATH)" })) : isPending('command') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: command || '(default: claude on PATH)' }))] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Uses your local Claude Code session; Anthropic may bill programmatic use as extra usage." }) })] })) : (_jsxs(_Fragment, { children: [_jsxs(Box, { children: [_jsx(Text, { children: "endpoint: " }), step === 'endpoint' ? (_jsx(TextInput, { value: endpoint, onChange: setEndpoint, onSubmit: submit, placeholder: "https://api.openai.com" })) : isPending('endpoint') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: endpoint }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "apiKey: " }), step === 'apiKey' ? (_jsx(TextInput, { value: apiKey, onChange: setApiKey, onSubmit: submit, placeholder: isEdit ? '(enter to keep current)' : '(optional, enter to skip)', mask: "*" })) : isPending('apiKey') ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: apiKey ? '(set)' : '(none)' }))] })] })), 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)" }) })] }));
|
|
178
277
|
}
|
|
@@ -1815,6 +1815,24 @@ body.vscode-light .settings-panel__tab-btn--active {
|
|
|
1815
1815
|
.input-with-action button {
|
|
1816
1816
|
flex-shrink: 0;
|
|
1817
1817
|
}
|
|
1818
|
+
.form-error {
|
|
1819
|
+
color: var(--danger-red, #f87171);
|
|
1820
|
+
font-size: 11px;
|
|
1821
|
+
line-height: 1.4;
|
|
1822
|
+
margin: 4px 0 0;
|
|
1823
|
+
}
|
|
1824
|
+
.install-log {
|
|
1825
|
+
margin-top: 8px;
|
|
1826
|
+
padding: 8px;
|
|
1827
|
+
font-family: monospace;
|
|
1828
|
+
font-size: 11px;
|
|
1829
|
+
white-space: pre-wrap;
|
|
1830
|
+
word-break: break-all;
|
|
1831
|
+
background: rgba(0, 0, 0, 0.2);
|
|
1832
|
+
border-radius: 4px;
|
|
1833
|
+
max-height: 150px;
|
|
1834
|
+
overflow-y: auto;
|
|
1835
|
+
}
|
|
1818
1836
|
.voice-backend-status {
|
|
1819
1837
|
display: flex;
|
|
1820
1838
|
align-items: center;
|