sparkecoder 0.1.66 → 0.1.68
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/agent/index.d.ts +3 -3
- package/dist/agent/index.js +141 -13
- package/dist/agent/index.js.map +1 -1
- package/dist/cli.js +206 -48
- package/dist/cli.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/{index-Db23cukG.d.ts → index-Dm6wGcYv.d.ts} +26 -25
- package/dist/index.d.ts +5 -5
- package/dist/index.js +206 -48
- package/dist/index.js.map +1 -1
- package/dist/{schema-C7Mm4Ykn.d.ts → schema-XcP0dedO.d.ts} +3 -3
- package/dist/{search-CVVfuBPZ.d.ts → search-CCffrVJE.d.ts} +4 -4
- package/dist/server/index.js +206 -48
- package/dist/server/index.js.map +1 -1
- package/dist/tools/index.d.ts +3 -3
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/build-manifest.json +2 -2
- package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
- package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.html +1 -1
- package/web/.next/standalone/web/.next/server/app/index.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
- package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
- package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
- /package/web/.next/standalone/web/.next/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_ssgManifest.js +0 -0
- /package/web/.next/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_buildManifest.js +0 -0
- /package/web/.next/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{UMGGmtMDTCI6fL-AIFkiM → 6Dlxqhgk8Mki7q7L-gDbl}/_ssgManifest.js +0 -0
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'ai';
|
|
2
|
-
import '../schema-
|
|
3
|
-
export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, M as MessageAttachment, d as buildSystemPrompt, e as buildTaskPromptAddendum } from '../index-
|
|
4
|
-
import '../search-
|
|
2
|
+
import '../schema-XcP0dedO.js';
|
|
3
|
+
export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, M as MessageAttachment, d as buildSystemPrompt, e as buildTaskPromptAddendum } from '../index-Dm6wGcYv.js';
|
|
4
|
+
import '../search-CCffrVJE.js';
|
|
5
5
|
import 'drizzle-orm/sqlite-core';
|
|
6
6
|
import 'zod';
|
package/dist/agent/index.js
CHANGED
|
@@ -5617,12 +5617,18 @@ Before calling \`complete_task\`, you MUST verify your work completely. Do not j
|
|
|
5617
5617
|
- If the task asked for multiple things, verify EACH one individually.
|
|
5618
5618
|
- If something doesn't look right, fix it \u2014 don't complete with known issues.
|
|
5619
5619
|
|
|
5620
|
+
**Screenshot your completed work:**
|
|
5621
|
+
- After completing a task, take a screenshot of the result when it makes sense (UI changes browser pages, etc.). You can use the browser skill to do this.
|
|
5622
|
+
- Use \`upload_file\` to upload the screenshot and include the download URL in your task result so the user can see proof of what was done.
|
|
5623
|
+
- This is especially valuable for UI/visual changes, successful test runs, and browser verification \u2014 show, don't just tell.
|
|
5624
|
+
|
|
5620
5625
|
### Use All Available Tools
|
|
5621
5626
|
- **load_skill**: Load specialized skills/knowledge relevant to the task. Check what skills are available and use them.
|
|
5622
5627
|
- **explore_agent**: Use for codebase exploration and understanding before making changes.
|
|
5623
5628
|
- **code_graph**: Use to understand type hierarchies, references, and impact before refactoring.
|
|
5624
5629
|
- **todo**: Track your progress on multi-step tasks so you don't miss steps.
|
|
5625
5630
|
- **bash**: Full shell access \u2014 run builds, tests, dev servers, open browsers, curl endpoints, anything.
|
|
5631
|
+
- **upload_file**: Upload files (screenshots, reports, exports) to cloud storage. Use this to include screenshots of completed work in your task result \u2014 visual proof is very helpful.
|
|
5626
5632
|
|
|
5627
5633
|
### Output Schema
|
|
5628
5634
|
The \`complete_task\` tool expects a \`result\` object matching this JSON Schema:
|
|
@@ -5916,6 +5922,21 @@ async function sendWebhook(url, event) {
|
|
|
5916
5922
|
}
|
|
5917
5923
|
|
|
5918
5924
|
// src/agent/index.ts
|
|
5925
|
+
var MAX_SSE_FIELD_LENGTH = 8 * 1024;
|
|
5926
|
+
var SSE_PREVIEW_LENGTH = 2 * 1024;
|
|
5927
|
+
function truncateWriteFileInput(input) {
|
|
5928
|
+
const out = { ...input };
|
|
5929
|
+
for (const key of ["content", "old_string", "new_string"]) {
|
|
5930
|
+
const val = out[key];
|
|
5931
|
+
if (typeof val === "string" && val.length > MAX_SSE_FIELD_LENGTH) {
|
|
5932
|
+
out[key] = `${val.slice(0, SSE_PREVIEW_LENGTH)}
|
|
5933
|
+
... (truncated)`;
|
|
5934
|
+
out[`${key}Truncated`] = true;
|
|
5935
|
+
out[`${key}Length`] = val.length;
|
|
5936
|
+
}
|
|
5937
|
+
}
|
|
5938
|
+
return out;
|
|
5939
|
+
}
|
|
5919
5940
|
var approvalResolvers = /* @__PURE__ */ new Map();
|
|
5920
5941
|
var Agent = class _Agent {
|
|
5921
5942
|
session;
|
|
@@ -6159,8 +6180,11 @@ ${prompt}` });
|
|
|
6159
6180
|
};
|
|
6160
6181
|
let taskRecorder = null;
|
|
6161
6182
|
const sessionId = this.session.id;
|
|
6183
|
+
const emit = options.writeSSE;
|
|
6162
6184
|
const bashProgressHandler = (progress) => {
|
|
6163
6185
|
options.onToolProgress?.({ toolName: "bash", data: progress });
|
|
6186
|
+
if (emit) emit(JSON.stringify({ type: "tool-progress", toolName: "bash", data: progress })).catch(() => {
|
|
6187
|
+
});
|
|
6164
6188
|
const port = progress.browserStreamPort;
|
|
6165
6189
|
if (port && progress.status === "started") {
|
|
6166
6190
|
Promise.resolve().then(() => (init_stream_proxy(), stream_proxy_exports)).then(({ getOrCreateProxy: getOrCreateProxy2 }) => {
|
|
@@ -6169,7 +6193,17 @@ ${prompt}` });
|
|
|
6169
6193
|
Promise.resolve().then(() => (init_recorder(), recorder_exports)).then(({ FrameRecorder: FrameRecorder2 }) => {
|
|
6170
6194
|
taskRecorder = new FrameRecorder2(sessionId);
|
|
6171
6195
|
taskRecorder.start();
|
|
6172
|
-
|
|
6196
|
+
});
|
|
6197
|
+
}
|
|
6198
|
+
if (proxy.listenerCount("frame") === 0) {
|
|
6199
|
+
proxy.on("frame", (frame) => {
|
|
6200
|
+
taskRecorder?.addFrame(frame);
|
|
6201
|
+
if (emit) emit(JSON.stringify({ type: "browser-frame", data: frame.data, metadata: frame.metadata })).catch(() => {
|
|
6202
|
+
});
|
|
6203
|
+
});
|
|
6204
|
+
proxy.on("status", (s) => {
|
|
6205
|
+
if (emit) emit(JSON.stringify({ type: "browser-status", ...s })).catch(() => {
|
|
6206
|
+
});
|
|
6173
6207
|
});
|
|
6174
6208
|
}
|
|
6175
6209
|
});
|
|
@@ -6180,8 +6214,16 @@ ${prompt}` });
|
|
|
6180
6214
|
workingDirectory: this.session.workingDirectory,
|
|
6181
6215
|
skillsDirectories: config.resolvedSkillsDirectories,
|
|
6182
6216
|
onBashProgress: bashProgressHandler,
|
|
6183
|
-
onWriteFileProgress:
|
|
6184
|
-
|
|
6217
|
+
onWriteFileProgress: (progress) => {
|
|
6218
|
+
options.onToolProgress?.({ toolName: "write_file", data: progress });
|
|
6219
|
+
if (emit) emit(JSON.stringify({ type: "tool-progress", toolName: "write_file", data: progress })).catch(() => {
|
|
6220
|
+
});
|
|
6221
|
+
},
|
|
6222
|
+
onSearchProgress: (progress) => {
|
|
6223
|
+
options.onToolProgress?.({ toolName: "explore_agent", data: progress });
|
|
6224
|
+
if (emit) emit(JSON.stringify({ type: "tool-progress", toolName: "explore_agent", data: progress })).catch(() => {
|
|
6225
|
+
});
|
|
6226
|
+
},
|
|
6185
6227
|
taskTools: {
|
|
6186
6228
|
outputSchema: options.taskConfig.outputSchema,
|
|
6187
6229
|
onComplete
|
|
@@ -6199,6 +6241,9 @@ ${prompt}` });
|
|
|
6199
6241
|
|
|
6200
6242
|
${taskAddendum}`;
|
|
6201
6243
|
fireWebhook("task.started", { prompt: options.prompt });
|
|
6244
|
+
if (emit) {
|
|
6245
|
+
await emit(JSON.stringify({ type: "data-user-message", data: { id: `user_${Date.now()}`, content: options.prompt } }));
|
|
6246
|
+
}
|
|
6202
6247
|
await this.context.addUserMessage(options.prompt);
|
|
6203
6248
|
let iteration = 0;
|
|
6204
6249
|
while (iteration < maxIterations) {
|
|
@@ -6210,7 +6255,15 @@ ${taskAddendum}`;
|
|
|
6210
6255
|
}
|
|
6211
6256
|
const messages = await this.context.getMessages();
|
|
6212
6257
|
const useAnthropic = isAnthropicModel(this.session.model);
|
|
6213
|
-
|
|
6258
|
+
if (emit) {
|
|
6259
|
+
await emit(JSON.stringify({ type: "start", messageId: `msg_${Date.now()}` }));
|
|
6260
|
+
}
|
|
6261
|
+
let textStarted = false;
|
|
6262
|
+
let textId = `text_${Date.now()}`;
|
|
6263
|
+
let reasoningId = `reasoning_${Date.now()}`;
|
|
6264
|
+
let reasoningStarted = false;
|
|
6265
|
+
const toolCallStarts = /* @__PURE__ */ new Set();
|
|
6266
|
+
const iterStream = streamText2({
|
|
6214
6267
|
model: resolveModel(this.session.model),
|
|
6215
6268
|
system: systemPrompt,
|
|
6216
6269
|
messages,
|
|
@@ -6219,21 +6272,94 @@ ${taskAddendum}`;
|
|
|
6219
6272
|
abortSignal: options.abortSignal,
|
|
6220
6273
|
providerOptions: useAnthropic ? {
|
|
6221
6274
|
anthropic: {
|
|
6275
|
+
toolStreaming: true,
|
|
6222
6276
|
thinking: { type: "enabled", budgetTokens: 1e4 }
|
|
6223
6277
|
}
|
|
6224
6278
|
} : void 0,
|
|
6225
|
-
onStepFinish: (step) => {
|
|
6279
|
+
onStepFinish: async (step) => {
|
|
6226
6280
|
options.onStepFinish?.(step);
|
|
6227
6281
|
fireWebhook("task.step_finished", { iteration, text: step.text });
|
|
6282
|
+
if (emit) {
|
|
6283
|
+
if (textStarted) {
|
|
6284
|
+
await emit(JSON.stringify({ type: "text-end", id: textId }));
|
|
6285
|
+
textStarted = false;
|
|
6286
|
+
textId = `text_${Date.now()}`;
|
|
6287
|
+
}
|
|
6288
|
+
await emit(JSON.stringify({ type: "finish-step" }));
|
|
6289
|
+
}
|
|
6228
6290
|
}
|
|
6229
6291
|
});
|
|
6230
|
-
const
|
|
6292
|
+
for await (const part of iterStream.fullStream) {
|
|
6293
|
+
if (part.type === "text-delta") {
|
|
6294
|
+
if (emit) {
|
|
6295
|
+
if (!textStarted) {
|
|
6296
|
+
await emit(JSON.stringify({ type: "text-start", id: textId }));
|
|
6297
|
+
textStarted = true;
|
|
6298
|
+
}
|
|
6299
|
+
await emit(JSON.stringify({ type: "text-delta", id: textId, delta: part.text }));
|
|
6300
|
+
}
|
|
6301
|
+
} else if (part.type === "reasoning-start") {
|
|
6302
|
+
if (emit) {
|
|
6303
|
+
await emit(JSON.stringify({ type: "reasoning-start", id: reasoningId }));
|
|
6304
|
+
reasoningStarted = true;
|
|
6305
|
+
}
|
|
6306
|
+
} else if (part.type === "reasoning-delta") {
|
|
6307
|
+
if (emit) {
|
|
6308
|
+
await emit(JSON.stringify({ type: "reasoning-delta", id: reasoningId, delta: part.text }));
|
|
6309
|
+
}
|
|
6310
|
+
} else if (part.type === "reasoning-end") {
|
|
6311
|
+
if (emit && reasoningStarted) {
|
|
6312
|
+
await emit(JSON.stringify({ type: "reasoning-end", id: reasoningId }));
|
|
6313
|
+
reasoningStarted = false;
|
|
6314
|
+
reasoningId = `reasoning_${Date.now()}`;
|
|
6315
|
+
}
|
|
6316
|
+
} else if (part.type === "tool-call-streaming-start") {
|
|
6317
|
+
if (emit) {
|
|
6318
|
+
const p = part;
|
|
6319
|
+
await emit(JSON.stringify({ type: "tool-input-start", toolCallId: p.toolCallId, toolName: p.toolName }));
|
|
6320
|
+
toolCallStarts.add(p.toolCallId);
|
|
6321
|
+
}
|
|
6322
|
+
} else if (part.type === "tool-call-delta") {
|
|
6323
|
+
if (emit) {
|
|
6324
|
+
const p = part;
|
|
6325
|
+
await emit(JSON.stringify({ type: "tool-input-delta", toolCallId: p.toolCallId, argsTextDelta: p.argsTextDelta }));
|
|
6326
|
+
}
|
|
6327
|
+
} else if (part.type === "tool-call") {
|
|
6328
|
+
if (emit) {
|
|
6329
|
+
if (!toolCallStarts.has(part.toolCallId)) {
|
|
6330
|
+
await emit(JSON.stringify({ type: "tool-input-start", toolCallId: part.toolCallId, toolName: part.toolName }));
|
|
6331
|
+
toolCallStarts.add(part.toolCallId);
|
|
6332
|
+
}
|
|
6333
|
+
const safeInput = part.toolName === "write_file" && part.input && typeof part.input === "object" ? truncateWriteFileInput(part.input) : part.input;
|
|
6334
|
+
await emit(JSON.stringify({ type: "tool-input-available", toolCallId: part.toolCallId, toolName: part.toolName, input: safeInput }));
|
|
6335
|
+
}
|
|
6336
|
+
} else if (part.type === "tool-result") {
|
|
6337
|
+
if (emit) {
|
|
6338
|
+
await emit(JSON.stringify({ type: "tool-output-available", toolCallId: part.toolCallId, output: part.output }));
|
|
6339
|
+
}
|
|
6340
|
+
} else if (part.type === "error") {
|
|
6341
|
+
console.error("Task stream error:", part.error);
|
|
6342
|
+
if (emit) {
|
|
6343
|
+
await emit(JSON.stringify({ type: "error", errorText: String(part.error) }));
|
|
6344
|
+
}
|
|
6345
|
+
}
|
|
6346
|
+
}
|
|
6347
|
+
if (emit && textStarted) {
|
|
6348
|
+
await emit(JSON.stringify({ type: "text-end", id: textId }));
|
|
6349
|
+
}
|
|
6350
|
+
if (emit && reasoningStarted) {
|
|
6351
|
+
await emit(JSON.stringify({ type: "reasoning-end", id: reasoningId }));
|
|
6352
|
+
}
|
|
6353
|
+
const iterResponse = await iterStream.response;
|
|
6354
|
+
const responseMessages = iterResponse.messages;
|
|
6231
6355
|
await this.context.addResponseMessages(responseMessages);
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6356
|
+
const resultText = await iterStream.text;
|
|
6357
|
+
const resultSteps = await iterStream.steps;
|
|
6358
|
+
if (resultText) {
|
|
6359
|
+
options.onText?.(resultText);
|
|
6360
|
+
fireWebhook("task.message", { iteration, text: resultText });
|
|
6235
6361
|
}
|
|
6236
|
-
for (const step of
|
|
6362
|
+
for (const step of resultSteps) {
|
|
6237
6363
|
if (step.toolCalls) {
|
|
6238
6364
|
for (const tc of step.toolCalls) {
|
|
6239
6365
|
options.onToolCall?.({ toolCallId: tc.toolCallId, toolName: tc.toolName, input: tc.args });
|
|
@@ -6286,9 +6412,11 @@ ${taskAddendum}`;
|
|
|
6286
6412
|
iterations: iteration
|
|
6287
6413
|
};
|
|
6288
6414
|
}
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6415
|
+
const continuationPrompt = "Continue working on the task. Before calling `complete_task`, VERIFY your work is correct \u2014 re-read edited files, run the linter, run tests if applicable, and check the browser/server if you made UI or API changes. Make sure you searched the right directories and found everything relevant. When fully verified, call `complete_task` with the result. If you cannot complete it, call `task_failed` with a reason.";
|
|
6416
|
+
if (emit) {
|
|
6417
|
+
await emit(JSON.stringify({ type: "data-user-message", data: { id: `user_${Date.now()}`, content: continuationPrompt } }));
|
|
6418
|
+
}
|
|
6419
|
+
await this.context.addUserMessage(continuationPrompt);
|
|
6292
6420
|
}
|
|
6293
6421
|
const timeoutError = `Task did not complete within ${maxIterations} iterations`;
|
|
6294
6422
|
const timeoutRecordingUrls = await this.finishTaskRecording(taskRecorder);
|