@hyperwindmill/caretaker-cli 0.16.0 → 0.17.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/cli/web/server.d.ts +1 -1
- package/dist/cli/web/server.d.ts.map +1 -1
- package/dist/cli/web/server.js +57 -2
- package/dist/harness/claude_code_runner.d.ts.map +1 -1
- package/dist/harness/claude_code_runner.js +6 -1
- package/dist/harness/loop.d.ts +3 -0
- package/dist/harness/loop.d.ts.map +1 -1
- package/dist/harness/loop.js +6 -1
- package/dist/harness/prelude.d.ts +6 -0
- package/dist/harness/prelude.d.ts.map +1 -1
- package/dist/harness/prelude.js +16 -0
- package/dist/harness/tools/builtin/index.d.ts +2 -2
- package/dist/harness/tools/builtin/index.d.ts.map +1 -1
- package/dist/harness/tools/builtin/index.js +3 -2
- package/dist/harness/tools/builtin/task_tools.d.ts +1 -0
- package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -1
- package/dist/harness/tools/builtin/task_tools.js +68 -0
- package/dist/webview/standalone.js +166 -25
- package/dist/webview/standalone.js.map +3 -3
- package/package.json +3 -3
package/dist/cli/web/server.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class WebSessionController {
|
|
|
31
31
|
name: string;
|
|
32
32
|
mime: string;
|
|
33
33
|
base64: string;
|
|
34
|
-
}
|
|
34
|
+
}>, voiceConversation?: boolean): Promise<void>;
|
|
35
35
|
abort(): void;
|
|
36
36
|
}
|
|
37
37
|
export declare function startServer(port: number, host: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/cli/web/server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAwClD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAgC,MAAM,gBAAgB,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAC;AAg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CAAC,SAAS,CAAC,CAAS;gBAGjB,IAAI,EAAE;QACrB,KAAK,EAAE,WAAW,CAAC;QACnB,QAAQ,EAAE,cAAc,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAMH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,eAAe,IAAI,GAAG;IAIhB,KAAK,CACT,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,aAAa,EACjB,cAAc,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EACtE,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,IAAI,CAAC;IAgFhB,KAAK,IAAI,IAAI;CAGd;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAu/B3E"}
|
package/dist/cli/web/server.js
CHANGED
|
@@ -47,7 +47,7 @@ export class WebSessionController {
|
|
|
47
47
|
getContextUsage() {
|
|
48
48
|
return computeContextUsage(this.history, this.opts.agent.model);
|
|
49
49
|
}
|
|
50
|
-
async start(prompt, cb, rawAttachments) {
|
|
50
|
+
async start(prompt, cb, rawAttachments, voiceConversation) {
|
|
51
51
|
if (this.inflight) {
|
|
52
52
|
cb.onError('A turn is already in progress.');
|
|
53
53
|
return;
|
|
@@ -95,6 +95,7 @@ export class WebSessionController {
|
|
|
95
95
|
workingDir: this.opts.workingDir,
|
|
96
96
|
sessionId: meta.id,
|
|
97
97
|
promptAttachments: attachmentRecords.length > 0 ? attachmentRecords : undefined,
|
|
98
|
+
voiceConversation,
|
|
98
99
|
}, {
|
|
99
100
|
onChunk: cb.onChunk,
|
|
100
101
|
onThinking: cb.onThinking,
|
|
@@ -550,6 +551,60 @@ export async function startServer(port, host) {
|
|
|
550
551
|
maxRunSeconds: task.maxRunSeconds ?? null,
|
|
551
552
|
});
|
|
552
553
|
});
|
|
554
|
+
// Rewrite a task's title/objective. Absent key = leave unchanged. No running
|
|
555
|
+
// guard (unlike …/agent): the objective is read at the start of each cycle, so
|
|
556
|
+
// an edit simply lands on the next one — no reason to force a pause for a typo.
|
|
557
|
+
app.patch('/api/tasks/:id', async (c) => {
|
|
558
|
+
const taskId = Number(c.req.param('id'));
|
|
559
|
+
const body = await c.req.json();
|
|
560
|
+
const hasTitle = 'title' in body;
|
|
561
|
+
const hasObjective = 'objective' in body;
|
|
562
|
+
if (!hasTitle && !hasObjective) {
|
|
563
|
+
return c.json({ ok: false, error: 'Nothing to update: pass title, objective, or both.' }, 400);
|
|
564
|
+
}
|
|
565
|
+
if (hasTitle && typeof body.title !== 'string') {
|
|
566
|
+
return c.json({ ok: false, error: 'title must be a string.' }, 400);
|
|
567
|
+
}
|
|
568
|
+
if (hasObjective && typeof body.objective !== 'string') {
|
|
569
|
+
return c.json({ ok: false, error: 'objective must be a string.' }, 400);
|
|
570
|
+
}
|
|
571
|
+
const title = hasTitle ? body.title.trim() : null;
|
|
572
|
+
if (hasTitle && !title) {
|
|
573
|
+
return c.json({ ok: false, error: 'Title cannot be empty.' }, 400);
|
|
574
|
+
}
|
|
575
|
+
const task = await getTaskById(taskId);
|
|
576
|
+
if (!task)
|
|
577
|
+
return c.json({ ok: false, error: 'not found' }, 404);
|
|
578
|
+
// Capture old values for the audit trail — the objective is what the
|
|
579
|
+
// review gate grades against, so a silent rewrite would move the
|
|
580
|
+
// goalposts with no trace. The system message is human-visible only
|
|
581
|
+
// (not replayed into agent history — same rationale as the tool path).
|
|
582
|
+
const oldTitle = task.title;
|
|
583
|
+
const oldObjective = task.objective;
|
|
584
|
+
if (title !== null)
|
|
585
|
+
task.title = title;
|
|
586
|
+
if (hasObjective)
|
|
587
|
+
task.objective = body.objective.trim();
|
|
588
|
+
task.updatedAt = new Date().toISOString();
|
|
589
|
+
await saveTask(task);
|
|
590
|
+
const changes = [];
|
|
591
|
+
if (title !== null && title !== oldTitle) {
|
|
592
|
+
changes.push(`Title:\n ${oldTitle}\n →\n ${task.title}`);
|
|
593
|
+
}
|
|
594
|
+
if (hasObjective && task.objective !== oldObjective) {
|
|
595
|
+
changes.push(`Objective:\n ${oldObjective || '(empty)'}\n →\n ${task.objective || '(empty)'}`);
|
|
596
|
+
}
|
|
597
|
+
if (changes.length > 0) {
|
|
598
|
+
await addTaskMessage({
|
|
599
|
+
taskId,
|
|
600
|
+
role: 'assistant',
|
|
601
|
+
messageType: 'system',
|
|
602
|
+
content: `Task details updated.\n\n${changes.join('\n\n')}`,
|
|
603
|
+
agentId: null,
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
return c.json({ ok: true, title: task.title, objective: task.objective });
|
|
607
|
+
});
|
|
553
608
|
const nodeServer = serve({
|
|
554
609
|
fetch: app.fetch,
|
|
555
610
|
port,
|
|
@@ -794,7 +849,7 @@ export async function startServer(port, host) {
|
|
|
794
849
|
currentSessionId = sessionId;
|
|
795
850
|
void loadSessionsAndSend(currentAgent.id);
|
|
796
851
|
},
|
|
797
|
-
}, msg.attachments);
|
|
852
|
+
}, msg.attachments, msg.voice);
|
|
798
853
|
return;
|
|
799
854
|
}
|
|
800
855
|
case 'abort':
|
|
@@ -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","sourceRoot":"","sources":["../../src/harness/claude_code_runner.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,YAAY,EAAE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EAAE,EAAE,OAAO,GAAG,IAAI,CAE5C;AACD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,wBAAgB,iCAAiC,CAC/C,YAAY,GAAE,MAA4D,GACzE,MAAM,GAAG,IAAI,CAQf;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;kFAC8E;IAC9E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CAe5D;AAED,uEAAuE;AACvE,wBAAgB,oBAAoB,CAAC,CAAC,EAAE;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC,GAAG,mBAAmB,CAoBtB;AAsMD,wBAAsB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,GAAE,YAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,CAuI/F"}
|
|
@@ -11,6 +11,7 @@ import os from 'node:os';
|
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { parseClaudeStreamLine } from './claude_code_stream.js';
|
|
13
13
|
import { loadContextFiles, formatContextBlock, resolveFileReferences } from './context_files.js';
|
|
14
|
+
import { VOICE_CONVERSATION_PRELUDE } from './prelude.js';
|
|
14
15
|
import { readSession, updateClaudeSessionId, assistantMessage, toolMessage, } from '../session/store.js';
|
|
15
16
|
import { loadMcpServers } from '../store/json.js';
|
|
16
17
|
import { resolvedServerRuntime } from '../mcp/client.js';
|
|
@@ -266,7 +267,11 @@ export async function runClaudeCode(opts, cb = {}) {
|
|
|
266
267
|
// ~/.caretaker/AGENTS.md it does not — verified on CLI 2.1.207).
|
|
267
268
|
const sys = await resolveFileReferences(agent.systemPrompt ?? '', workingDir);
|
|
268
269
|
const ctxEntries = (await loadContextFiles(workingDir)).filter((e) => path.basename(e.path) !== 'CLAUDE.md');
|
|
269
|
-
const appendSystemPrompt = [
|
|
270
|
+
const appendSystemPrompt = [
|
|
271
|
+
sys,
|
|
272
|
+
ctxEntries.length ? formatContextBlock(ctxEntries) : '',
|
|
273
|
+
opts.voiceConversation ? VOICE_CONVERSATION_PRELUDE : '',
|
|
274
|
+
]
|
|
270
275
|
.filter(Boolean)
|
|
271
276
|
.join('\n\n');
|
|
272
277
|
// 3. Per-run mcp-config temp file (agent's servers + injected bridge).
|
package/dist/harness/loop.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ export interface RunOptions {
|
|
|
59
59
|
claudeCode?: import('./claude_code_runner.js').ClaudeCodeRunExtras;
|
|
60
60
|
/** Native-loop only: run `bash` commands inside this docker container. */
|
|
61
61
|
dockerContainer?: string;
|
|
62
|
+
/** The turn came from voice conversation mode; append the spoken-reply
|
|
63
|
+
* block to the system prompt so the agent writes speakable prose. */
|
|
64
|
+
voiceConversation?: boolean;
|
|
62
65
|
}
|
|
63
66
|
export interface RunResult {
|
|
64
67
|
/** Concatenated assistant text across all turns. */
|
|
@@ -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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M,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,CAqVrF"}
|
package/dist/harness/loop.js
CHANGED
|
@@ -16,7 +16,7 @@ import { assistantMessage, toolMessage, saveAttachment, attachmentsDir } from '.
|
|
|
16
16
|
import { buildRequestBody, readStream } from './provider.js';
|
|
17
17
|
import { mapMessagesToChat } from './history.js';
|
|
18
18
|
import { toOpenAiTool, } from './tools/index.js';
|
|
19
|
-
import { withHarnessPrelude } from './prelude.js';
|
|
19
|
+
import { withHarnessPrelude, VOICE_CONVERSATION_PRELUDE } from './prelude.js';
|
|
20
20
|
import { formatRuntimeInfoBlock } from './runtime_info.js';
|
|
21
21
|
import { loadContextFiles, formatContextBlock, resolveFileReferences } from './context_files.js';
|
|
22
22
|
let fetchImpl = globalThis.fetch.bind(globalThis);
|
|
@@ -78,6 +78,11 @@ export async function run(opts, cb = {}) {
|
|
|
78
78
|
workingDir: toolCtx.workingDir,
|
|
79
79
|
});
|
|
80
80
|
effectiveSystemPrompt = `${effectiveSystemPrompt}\n\n${runtimeBlock}`.trim();
|
|
81
|
+
// Voice-conversation block is appended last (strongest recency) and only
|
|
82
|
+
// on voice turns — the same session mixes typed and spoken turns.
|
|
83
|
+
if (opts.voiceConversation) {
|
|
84
|
+
effectiveSystemPrompt = `${effectiveSystemPrompt}\n\n${VOICE_CONVERSATION_PRELUDE}`.trim();
|
|
85
|
+
}
|
|
81
86
|
// Plugin skills are no longer injected here. Agents with active plugins
|
|
82
87
|
// get the `list_skills` / `read_skill` tools (added by resolveAgentTools
|
|
83
88
|
// at the call site) and pull the SKILL.md content on demand.
|
|
@@ -18,4 +18,10 @@ export declare const HARNESS_PRELUDE: string;
|
|
|
18
18
|
* If the agent prompt is empty, return the prelude alone.
|
|
19
19
|
*/
|
|
20
20
|
export declare function withHarnessPrelude(agentSystemPrompt: string | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* Appended per-turn when the turn arrived as speech and the reply will be
|
|
23
|
+
* read aloud. Per-turn on purpose: the same session mixes typed and spoken
|
|
24
|
+
* turns, so the block must be present only on voice turns.
|
|
25
|
+
*/
|
|
26
|
+
export declare const VOICE_CONVERSATION_PRELUDE: string;
|
|
21
27
|
//# sourceMappingURL=prelude.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prelude.d.ts","sourceRoot":"","sources":["../../src/harness/prelude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,QAgBhB,CAAC;AAEb;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAIhF"}
|
|
1
|
+
{"version":3,"file":"prelude.d.ts","sourceRoot":"","sources":["../../src/harness/prelude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,QAgBhB,CAAC;AAEb;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAIhF;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAU3B,CAAC"}
|
package/dist/harness/prelude.js
CHANGED
|
@@ -39,3 +39,19 @@ export function withHarnessPrelude(agentSystemPrompt) {
|
|
|
39
39
|
return HARNESS_PRELUDE;
|
|
40
40
|
return `${HARNESS_PRELUDE}\n\n${base}`;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Appended per-turn when the turn arrived as speech and the reply will be
|
|
44
|
+
* read aloud. Per-turn on purpose: the same session mixes typed and spoken
|
|
45
|
+
* turns, so the block must be present only on voice turns.
|
|
46
|
+
*/
|
|
47
|
+
export const VOICE_CONVERSATION_PRELUDE = [
|
|
48
|
+
'<voice-conversation>',
|
|
49
|
+
'This message arrived as speech, and your reply will be read aloud by a text-to-speech engine. Write for the ear:',
|
|
50
|
+
'',
|
|
51
|
+
'- Complete, well-punctuated sentences — punctuation is what gives the synthesized voice its rhythm.',
|
|
52
|
+
'- Short and conversational: a couple of sentences per message, no headings, no bullet lists, no tables, no code fences, no emoji, no raw URLs.',
|
|
53
|
+
'- Describe code, paths and long listings instead of dictating them; offer to show them on screen if the user needs the detail.',
|
|
54
|
+
'- Write numbers, units and acronyms the way they should be heard when the written form would be mispronounced.',
|
|
55
|
+
'- Each message of yours is spoken as soon as it is finalized, which happens when you make a tool call. A one-line "let me check that file" before a tool call is heard immediately, so it is worth saying.',
|
|
56
|
+
'</voice-conversation>',
|
|
57
|
+
].join('\n');
|
|
@@ -17,7 +17,7 @@ import { invokeAgentTool } from './invoke_agent.js';
|
|
|
17
17
|
import { listCommandsTool } from './list_commands.js';
|
|
18
18
|
import { invokeCommandTool } from './invoke_command.js';
|
|
19
19
|
import { getAgentContextTool } from './get_agent_context.js';
|
|
20
|
-
import { getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool } from './task_tools.js';
|
|
20
|
+
import { getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool } from './task_tools.js';
|
|
21
21
|
export declare function registerBuiltins(registry: ToolRegistry): void;
|
|
22
|
-
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, };
|
|
22
|
+
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, };
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,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ACb,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,cAAc,EACd,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,qBAAqB,GACtB,CAAC"}
|
|
@@ -19,7 +19,7 @@ import { invokeAgentTool } from './invoke_agent.js';
|
|
|
19
19
|
import { listCommandsTool } from './list_commands.js';
|
|
20
20
|
import { invokeCommandTool } from './invoke_command.js';
|
|
21
21
|
import { getAgentContextTool } from './get_agent_context.js';
|
|
22
|
-
import { getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, } from './task_tools.js';
|
|
22
|
+
import { getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, } from './task_tools.js';
|
|
23
23
|
export function registerBuiltins(registry) {
|
|
24
24
|
// Filesystem (sandboxed to ctx.workingDir).
|
|
25
25
|
registry.register(readFileTool);
|
|
@@ -70,5 +70,6 @@ export function registerBuiltins(registry) {
|
|
|
70
70
|
registry.register(taskDeleteTool);
|
|
71
71
|
registry.register(taskSetAgentTool);
|
|
72
72
|
registry.register(submitPlanTool);
|
|
73
|
+
registry.register(taskUpdateDetailsTool);
|
|
73
74
|
}
|
|
74
|
-
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, };
|
|
75
|
+
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, };
|
|
@@ -2,6 +2,7 @@ import type { Tool } from '../types.js';
|
|
|
2
2
|
export declare const getTaskStateTool: Tool;
|
|
3
3
|
export declare const updateChecklistItemTool: Tool;
|
|
4
4
|
export declare const updateChecklistTool: Tool;
|
|
5
|
+
export declare const taskUpdateDetailsTool: Tool;
|
|
5
6
|
export declare const addMessageTool: Tool;
|
|
6
7
|
export declare const completeTaskTool: Tool;
|
|
7
8
|
export declare const blockTaskTool: Tool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task_tools.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/task_tools.ts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F,eAAO,MAAM,qBAAqB,EAAE,IAmEnC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAiC5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAgD9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAoC3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAoC3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAa7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAgG5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IA+B5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAwC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAoC9B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAwC7B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,IA4BrC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAkC7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,IA8B/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IA4C5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAgD9B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAuC5B,CAAC"}
|
|
@@ -140,6 +140,74 @@ export const updateChecklistTool = {
|
|
|
140
140
|
return ok();
|
|
141
141
|
},
|
|
142
142
|
};
|
|
143
|
+
export const taskUpdateDetailsTool = {
|
|
144
|
+
name: 'mcp__task__task_update_details',
|
|
145
|
+
description: 'Rewrite a task\'s title and/or objective. Omit a field to leave it unchanged. The title cannot be blank; the objective may be empty.',
|
|
146
|
+
parameters: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
task_id: { type: 'number' },
|
|
150
|
+
title: { type: 'string' },
|
|
151
|
+
objective: { type: 'string' },
|
|
152
|
+
},
|
|
153
|
+
required: ['task_id'],
|
|
154
|
+
},
|
|
155
|
+
execute: async (args) => {
|
|
156
|
+
const taskId = Number(args.task_id);
|
|
157
|
+
const hasTitle = args.title !== undefined;
|
|
158
|
+
const hasObjective = args.objective !== undefined;
|
|
159
|
+
if (!hasTitle && !hasObjective)
|
|
160
|
+
return err('Nothing to update: pass title, objective, or both.');
|
|
161
|
+
if (hasTitle && typeof args.title !== 'string')
|
|
162
|
+
return err('title must be a string.');
|
|
163
|
+
if (hasObjective && typeof args.objective !== 'string')
|
|
164
|
+
return err('objective must be a string.');
|
|
165
|
+
// A blank title leaves the task unidentifiable in the list; an empty
|
|
166
|
+
// objective is fine (task_create already allows one).
|
|
167
|
+
const title = hasTitle ? String(args.title).trim() : null;
|
|
168
|
+
if (hasTitle && !title)
|
|
169
|
+
return err('title cannot be empty.');
|
|
170
|
+
const task = await getTaskById(taskId);
|
|
171
|
+
if (!task)
|
|
172
|
+
return err(`Task ${taskId} not found`);
|
|
173
|
+
// Capture the old values before overwriting so we can leave an audit
|
|
174
|
+
// trail in the task thread. The objective is what the review gate grades
|
|
175
|
+
// against (task_strategy.ts → runDoneReview interpolates task.objective),
|
|
176
|
+
// so a silent rewrite would let a stalling agent move its own goalposts
|
|
177
|
+
// with no trace. A system message makes the change visible to humans in
|
|
178
|
+
// the web GUI — note that system messages are NOT replayed into agent
|
|
179
|
+
// history (task_strategy.ts:370 filters to chat/heartbeat/tool_call/
|
|
180
|
+
// review/plan), so the next-cycle agent and reviewer don't see this; it's
|
|
181
|
+
// a human-visible audit trail, not an agent-visible one.
|
|
182
|
+
const oldTitle = task.title;
|
|
183
|
+
const oldObjective = task.objective;
|
|
184
|
+
if (title !== null)
|
|
185
|
+
task.title = title;
|
|
186
|
+
if (hasObjective)
|
|
187
|
+
task.objective = String(args.objective).trim();
|
|
188
|
+
task.updatedAt = new Date().toISOString();
|
|
189
|
+
await saveTask(task);
|
|
190
|
+
// Record what changed in the thread. A title-only rewrite is cosmetically
|
|
191
|
+
// visible but still worth logging; the objective change is the critical one.
|
|
192
|
+
const changes = [];
|
|
193
|
+
if (title !== null && title !== oldTitle) {
|
|
194
|
+
changes.push(`Title:\n ${oldTitle}\n →\n ${task.title}`);
|
|
195
|
+
}
|
|
196
|
+
if (hasObjective && task.objective !== oldObjective) {
|
|
197
|
+
changes.push(`Objective:\n ${oldObjective || '(empty)'}\n →\n ${task.objective || '(empty)'}`);
|
|
198
|
+
}
|
|
199
|
+
if (changes.length > 0) {
|
|
200
|
+
await addTaskMessage({
|
|
201
|
+
taskId,
|
|
202
|
+
role: 'assistant',
|
|
203
|
+
messageType: 'system',
|
|
204
|
+
content: `Task details updated.\n\n${changes.join('\n\n')}`,
|
|
205
|
+
agentId: null,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return ok({ title: task.title, objective: task.objective });
|
|
209
|
+
},
|
|
210
|
+
};
|
|
143
211
|
export const addMessageTool = {
|
|
144
212
|
name: 'mcp__task__task_add_message',
|
|
145
213
|
description: 'Add a message to the task thread. Use this to document what you did in this session.',
|