@hyperwindmill/caretaker-cli 0.16.0 → 0.18.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 +59 -4
- package/dist/cli/web/voice_backend.d.ts +17 -5
- package/dist/cli/web/voice_backend.d.ts.map +1 -1
- package/dist/cli/web/voice_backend.js +253 -114
- package/dist/cli/web/voice_proxy.d.ts +16 -0
- package/dist/cli/web/voice_proxy.d.ts.map +1 -1
- package/dist/cli/web/voice_proxy.js +103 -8
- 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/store/json.d.ts.map +1 -1
- package/dist/store/json.js +3 -0
- package/dist/webview/standalone.js +1132 -786
- package/dist/webview/standalone.js.map +4 -4
- package/package.json +3 -3
|
@@ -35,9 +35,23 @@ function plainKey(apiKey) {
|
|
|
35
35
|
return isEncrypted(apiKey) ? decrypt(apiKey) : apiKey;
|
|
36
36
|
}
|
|
37
37
|
export function voiceAuthHeaders(voice) {
|
|
38
|
-
|
|
38
|
+
return authHeaders(voice.apiKey);
|
|
39
|
+
}
|
|
40
|
+
/** Build auth headers from an explicit key (which may be stored encrypted).
|
|
41
|
+
* Used so the synthesis leg can send its own key — or none at all. */
|
|
42
|
+
export function authHeaders(apiKey) {
|
|
43
|
+
const key = plainKey(apiKey);
|
|
39
44
|
return key ? { authorization: `Bearer ${key}` } : {};
|
|
40
45
|
}
|
|
46
|
+
/** Where synthesis goes. A configured `ttsEndpoint` takes its own key — or
|
|
47
|
+
* none at all: the transcription key belongs to a different host and must
|
|
48
|
+
* not leak to a third-party TTS service. */
|
|
49
|
+
export function ttsTarget(voice) {
|
|
50
|
+
const tts = voice.ttsEndpoint?.trim();
|
|
51
|
+
if (!tts)
|
|
52
|
+
return { endpoint: voice.endpoint, apiKey: voice.apiKey };
|
|
53
|
+
return { endpoint: tts, ...(voice.ttsApiKey ? { apiKey: voice.ttsApiKey } : {}) };
|
|
54
|
+
}
|
|
41
55
|
/** Join a base URL and a path without doubling or dropping the slash. */
|
|
42
56
|
function url(endpoint, suffix) {
|
|
43
57
|
return `${endpoint.replace(/\/+$/, '')}${suffix}`;
|
|
@@ -99,9 +113,10 @@ export function registerVoiceProxy(app) {
|
|
|
99
113
|
}
|
|
100
114
|
let upstream;
|
|
101
115
|
try {
|
|
102
|
-
|
|
116
|
+
const target = ttsTarget(voice);
|
|
117
|
+
upstream = await fetch(url(target.endpoint, '/audio/speech'), {
|
|
103
118
|
method: 'POST',
|
|
104
|
-
headers: { ...
|
|
119
|
+
headers: { ...authHeaders(target.apiKey), 'content-type': 'application/json' },
|
|
105
120
|
body: JSON.stringify(payload),
|
|
106
121
|
});
|
|
107
122
|
}
|
|
@@ -126,17 +141,28 @@ export function registerVoiceProxy(app) {
|
|
|
126
141
|
* those are correctly scoped, unlike the global /v1/audio/voices catalogue, which
|
|
127
142
|
* ignores its model_id parameter. A plain OpenAI-compatible endpoint reports
|
|
128
143
|
* neither, so every id is offered for both tasks and the voice stays free text.
|
|
144
|
+
*
|
|
145
|
+
* openai-edge-tts reports models under `{"models": [...]}` (not `{"data": [...]}`),
|
|
146
|
+
* with no task metadata, and publishes its voice list at `/voices/all` rather than
|
|
147
|
+
* per model — voice ids are under the `"name"` key, not `"id"`. When no TTS entry
|
|
148
|
+
* carries its own voices, a best-effort `/voices/all` fetch fills them in; failure
|
|
149
|
+
* degrades to the free-text voice field, which already works.
|
|
129
150
|
*/
|
|
130
151
|
export async function fetchVoiceCatalog(endpoint, apiKey) {
|
|
131
152
|
const key = plainKey(apiKey);
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
});
|
|
153
|
+
const headers = authHeaders(key);
|
|
154
|
+
const res = await fetch(url(endpoint, '/models'), { headers });
|
|
135
155
|
if (!res.ok) {
|
|
136
156
|
throw new Error(`${res.status} ${res.statusText}: ${(await res.text()).slice(0, 300)}`);
|
|
137
157
|
}
|
|
138
158
|
const body = (await res.json());
|
|
139
|
-
|
|
159
|
+
// Accept both { "data": [...] } (OpenAI/Speaches) and { "models": [...] }
|
|
160
|
+
// (openai-edge-tts) — the latter uses a non-standard envelope key.
|
|
161
|
+
const rows = Array.isArray(body?.data)
|
|
162
|
+
? body.data
|
|
163
|
+
: Array.isArray(body?.models)
|
|
164
|
+
? body.models
|
|
165
|
+
: [];
|
|
140
166
|
const stt = [];
|
|
141
167
|
const tts = [];
|
|
142
168
|
const untasked = [];
|
|
@@ -173,8 +199,77 @@ export async function fetchVoiceCatalog(endpoint, apiKey) {
|
|
|
173
199
|
}
|
|
174
200
|
// No task metadata anywhere: offer everything for both, voices unknown.
|
|
175
201
|
if (stt.length === 0 && tts.length === 0) {
|
|
176
|
-
|
|
202
|
+
const ttsModels = untasked.map((id) => ({ id, voices: [] }));
|
|
203
|
+
await fillVoicesFromCatalog(endpoint, headers, ttsModels);
|
|
204
|
+
return { stt: untasked, tts: ttsModels };
|
|
177
205
|
}
|
|
178
206
|
// Mixed: keep the untasked ids selectable for transcription, the likelier use.
|
|
207
|
+
if (tts.length > 0 && tts.every((m) => m.voices.length === 0)) {
|
|
208
|
+
await fillVoicesFromCatalog(endpoint, headers, tts);
|
|
209
|
+
}
|
|
179
210
|
return { stt: [...stt, ...untasked], tts };
|
|
180
211
|
}
|
|
212
|
+
/** Best-effort GET <endpoint>/voices/all — openai-edge-tts publishes its voice
|
|
213
|
+
* list here rather than per model. Voice ids are under the `"name"` key (not
|
|
214
|
+
* `"id"`), the route defaults to en-US only on `/voices` (not `/voices/all`),
|
|
215
|
+
* and it may require auth. Failure is silent: an endpoint without the route
|
|
216
|
+
* degrades to the free-text voice field, which already works. */
|
|
217
|
+
async function fillVoicesFromCatalog(endpoint, headers, ttsModels) {
|
|
218
|
+
if (ttsModels.length === 0)
|
|
219
|
+
return;
|
|
220
|
+
let res;
|
|
221
|
+
try {
|
|
222
|
+
res = await fetch(url(endpoint, '/voices/all'), { headers });
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (!res.ok)
|
|
228
|
+
return;
|
|
229
|
+
let body;
|
|
230
|
+
try {
|
|
231
|
+
body = await res.json();
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
// Accept both a bare array and a { "voices": [...] } envelope. The edge-tts
|
|
237
|
+
// shape is { "voices": [{ "name": "it-IT-ElsaNeural", "gender": "Female",
|
|
238
|
+
// "language": "it-IT" }, ...] }.
|
|
239
|
+
const voiceRows = Array.isArray(body)
|
|
240
|
+
? body
|
|
241
|
+
: Array.isArray(body?.voices)
|
|
242
|
+
? body.voices
|
|
243
|
+
: [];
|
|
244
|
+
if (voiceRows.length === 0)
|
|
245
|
+
return;
|
|
246
|
+
const voices = voiceRows.flatMap((v) => {
|
|
247
|
+
if (!v || typeof v !== 'object')
|
|
248
|
+
return [];
|
|
249
|
+
const voice = v;
|
|
250
|
+
// edge-tts uses "name" for the voice id; Speaches uses "id"; some APIs use
|
|
251
|
+
// "ShortName". Accept any, preferring "name" first for edge-tts.
|
|
252
|
+
const id = typeof voice.name === 'string'
|
|
253
|
+
? voice.name
|
|
254
|
+
: typeof voice.id === 'string'
|
|
255
|
+
? voice.id
|
|
256
|
+
: typeof voice.ShortName === 'string'
|
|
257
|
+
? voice.ShortName
|
|
258
|
+
: null;
|
|
259
|
+
if (!id)
|
|
260
|
+
return [];
|
|
261
|
+
const language = voice.language ?? voice.Locale;
|
|
262
|
+
const gender = voice.gender ?? voice.Gender;
|
|
263
|
+
return [
|
|
264
|
+
{
|
|
265
|
+
id,
|
|
266
|
+
...(typeof language === 'string' ? { language } : {}),
|
|
267
|
+
...(typeof gender === 'string' ? { gender } : {}),
|
|
268
|
+
},
|
|
269
|
+
];
|
|
270
|
+
});
|
|
271
|
+
if (voices.length > 0) {
|
|
272
|
+
for (const model of ttsModels)
|
|
273
|
+
model.voices = voices;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
@@ -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,MAAM,oBAAoB,CAAC;AAM3E,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAiBrE,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,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AC9E,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;AAC9F,OAAO,EAAgC,KAAK,cAAc,EAAoB,MAAM,eAAe,CAAC;AAEpG,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,IAAI,EAGV,MAAM,kBAAkB,CAAC;AAK1B,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEzE,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,CAE7C;AACD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,MAAM,MAAM,eAAe,GAAG,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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,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,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gentTool } 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"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;AAcpD,eAAO,MAAM,gBAAgB,EAAE,IAmD9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,IAqCrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,IAoDjC,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,IAa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,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.',
|
package/dist/store/json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/store/json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK7F,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AACD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AACD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AACD,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AACD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,eAAO,MAAM,aAAa,EAAE,eAG3B,CAAC;AAqDF,wBAAsB,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,CAE3D;AAED,wBAAsB,UAAU,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/store/json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK7F,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AACD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AACD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AACD,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AACD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,eAAO,MAAM,aAAa,EAAE,eAG3B,CAAC;AAqDF,wBAAsB,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,CAE3D;AAED,wBAAsB,UAAU,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlE;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAEzD;AAED,wBAAsB,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CASxD;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElE;AAMD,wBAAsB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CAO9D;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE;AAID;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAO5E"}
|
package/dist/store/json.js
CHANGED
|
@@ -91,6 +91,9 @@ export async function saveConfig(c) {
|
|
|
91
91
|
if (c.voice?.apiKey && !isEncrypted(c.voice.apiKey)) {
|
|
92
92
|
c.voice.apiKey = encrypt(c.voice.apiKey);
|
|
93
93
|
}
|
|
94
|
+
if (c.voice?.ttsApiKey && !isEncrypted(c.voice.ttsApiKey)) {
|
|
95
|
+
c.voice.ttsApiKey = encrypt(c.voice.ttsApiKey);
|
|
96
|
+
}
|
|
94
97
|
await writeJson(configPath(), c);
|
|
95
98
|
}
|
|
96
99
|
export async function loadAgents() {
|