sparkecoder 0.1.78 → 0.1.80
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 +2 -2
- package/dist/agent/index.js +19 -3
- package/dist/agent/index.js.map +1 -1
- package/dist/cli.js +73 -15
- package/dist/cli.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/{index-DT1l57s0.d.ts → index-OhuTM4a0.d.ts} +6 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +71 -14
- package/dist/index.js.map +1 -1
- package/dist/{schema-XcP0dedO.d.ts → schema-CohdIL13.d.ts} +1 -0
- package/dist/server/index.js +71 -14
- package/dist/server/index.js.map +1 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/index.js.map +1 -1
- 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/package-lock.json +3 -3
- package/web/.next/standalone/web/src/lib/api.ts +1 -0
- /package/web/.next/standalone/web/.next/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_ssgManifest.js +0 -0
- /package/web/.next/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_buildManifest.js +0 -0
- /package/web/.next/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{q5xKLVzzjdkOykOwVu4eK → 439i-2Qg2oTm0bHSvJXp-}/_ssgManifest.js +0 -0
package/dist/server/index.js
CHANGED
|
@@ -522,7 +522,8 @@ var init_types = __esm({
|
|
|
522
522
|
status: z.enum(["running", "completed", "failed"]),
|
|
523
523
|
result: z.unknown().optional(),
|
|
524
524
|
error: z.string().optional(),
|
|
525
|
-
iterations: z.number().optional()
|
|
525
|
+
iterations: z.number().optional(),
|
|
526
|
+
parentTaskId: z.string().optional()
|
|
526
527
|
});
|
|
527
528
|
SessionConfigSchema = z.object({
|
|
528
529
|
toolApprovals: z.record(z.string(), z.boolean()).optional(),
|
|
@@ -6806,7 +6807,7 @@ function repairToolPairing(messages) {
|
|
|
6806
6807
|
const orphanedResults = new Set([...toolResultIds].filter((id) => !toolCallIds.has(id)));
|
|
6807
6808
|
if (orphanedCalls.size === 0 && orphanedResults.size === 0) return messages;
|
|
6808
6809
|
if (orphanedCalls.size > 0) {
|
|
6809
|
-
console.warn(`[tool-repair]
|
|
6810
|
+
console.warn(`[tool-repair] Injecting ${orphanedCalls.size} synthetic tool-result(s) for orphaned call(s): ${[...orphanedCalls].join(", ")}`);
|
|
6810
6811
|
}
|
|
6811
6812
|
if (orphanedResults.size > 0) {
|
|
6812
6813
|
console.warn(`[tool-repair] Removing ${orphanedResults.size} orphaned tool-result(s) with no matching call`);
|
|
@@ -6818,12 +6819,27 @@ function repairToolPairing(messages) {
|
|
|
6818
6819
|
continue;
|
|
6819
6820
|
}
|
|
6820
6821
|
const parts = msg.content.filter((part) => {
|
|
6821
|
-
if (part.type === "tool-call" && orphanedCalls.has(part.toolCallId)) return false;
|
|
6822
6822
|
if (part.type === "tool-result" && orphanedResults.has(part.toolCallId)) return false;
|
|
6823
6823
|
return true;
|
|
6824
6824
|
});
|
|
6825
6825
|
if (parts.length === 0) continue;
|
|
6826
6826
|
repaired.push({ ...msg, content: parts });
|
|
6827
|
+
if (msg.role === "assistant") {
|
|
6828
|
+
const callsNeedingResults = parts.filter(
|
|
6829
|
+
(part) => part.type === "tool-call" && orphanedCalls.has(part.toolCallId)
|
|
6830
|
+
);
|
|
6831
|
+
if (callsNeedingResults.length > 0) {
|
|
6832
|
+
repaired.push({
|
|
6833
|
+
role: "tool",
|
|
6834
|
+
content: callsNeedingResults.map((call) => ({
|
|
6835
|
+
type: "tool-result",
|
|
6836
|
+
toolCallId: call.toolCallId,
|
|
6837
|
+
toolName: call.toolName || "unknown",
|
|
6838
|
+
output: { type: "text", value: "[No result \u2014 tool execution was interrupted, never completed, or was stripped for brevity]" }
|
|
6839
|
+
}))
|
|
6840
|
+
});
|
|
6841
|
+
}
|
|
6842
|
+
}
|
|
6827
6843
|
}
|
|
6828
6844
|
return repaired;
|
|
6829
6845
|
}
|
|
@@ -10051,7 +10067,8 @@ var createTaskSchema = z19.object({
|
|
|
10051
10067
|
model: z19.string().optional(),
|
|
10052
10068
|
workingDirectory: z19.string().optional(),
|
|
10053
10069
|
name: z19.string().optional(),
|
|
10054
|
-
maxIterations: z19.number().int().min(1).max(500).optional()
|
|
10070
|
+
maxIterations: z19.number().int().min(1).max(500).optional(),
|
|
10071
|
+
parentTaskId: z19.string().optional()
|
|
10055
10072
|
});
|
|
10056
10073
|
tasks.post(
|
|
10057
10074
|
"/",
|
|
@@ -10064,17 +10081,52 @@ tasks.post(
|
|
|
10064
10081
|
outputSchema: body.outputSchema,
|
|
10065
10082
|
webhookUrl: body.webhookUrl,
|
|
10066
10083
|
maxIterations: body.maxIterations ?? 50,
|
|
10067
|
-
status: "running"
|
|
10084
|
+
status: "running",
|
|
10085
|
+
parentTaskId: body.parentTaskId
|
|
10068
10086
|
};
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10087
|
+
let agent;
|
|
10088
|
+
if (body.parentTaskId) {
|
|
10089
|
+
const parentSession = await sessionQueries.getById(body.parentTaskId);
|
|
10090
|
+
if (!parentSession) {
|
|
10091
|
+
return c.json({ error: "Parent task not found" }, 404);
|
|
10092
|
+
}
|
|
10093
|
+
const parentTask = parentSession.config?.task;
|
|
10094
|
+
if (!parentTask?.enabled) {
|
|
10095
|
+
return c.json({ error: "Parent session is not a task" }, 400);
|
|
10096
|
+
}
|
|
10097
|
+
if (parentTask.status === "running") {
|
|
10098
|
+
return c.json({ error: "Parent task is still running. Wait for it to complete before chaining." }, 409);
|
|
10099
|
+
}
|
|
10100
|
+
const parentStream = await activeStreamQueries.getBySessionId(body.parentTaskId);
|
|
10101
|
+
if (parentStream) {
|
|
10102
|
+
return c.json({ error: "Parent task has an active stream" }, 409);
|
|
10103
|
+
}
|
|
10104
|
+
agent = await Agent.create({
|
|
10105
|
+
name: body.name || "Task",
|
|
10106
|
+
workingDirectory: body.workingDirectory || parentSession.workingDirectory,
|
|
10107
|
+
model: body.model || parentSession.model,
|
|
10108
|
+
sessionConfig: {
|
|
10109
|
+
toolApprovals: { bash: false, write_file: false, read_file: false },
|
|
10110
|
+
task: taskConfig
|
|
10111
|
+
}
|
|
10112
|
+
});
|
|
10113
|
+
const parentMessages = await messageQueries.getBySession(body.parentTaskId);
|
|
10114
|
+
if (parentMessages.length > 0) {
|
|
10115
|
+
const modelMessages = parentMessages.map((m) => m.modelMessage);
|
|
10116
|
+
await messageQueries.addMany(agent.sessionId, modelMessages);
|
|
10117
|
+
console.log(`[TASK] Copied ${modelMessages.length} messages from parent ${body.parentTaskId} to ${agent.sessionId}`);
|
|
10076
10118
|
}
|
|
10077
|
-
}
|
|
10119
|
+
} else {
|
|
10120
|
+
agent = await Agent.create({
|
|
10121
|
+
name: body.name || "Task",
|
|
10122
|
+
workingDirectory: body.workingDirectory || config.resolvedWorkingDirectory,
|
|
10123
|
+
model: body.model || config.defaultModel,
|
|
10124
|
+
sessionConfig: {
|
|
10125
|
+
toolApprovals: { bash: false, write_file: false, read_file: false },
|
|
10126
|
+
task: taskConfig
|
|
10127
|
+
}
|
|
10128
|
+
});
|
|
10129
|
+
}
|
|
10078
10130
|
const taskId = agent.sessionId;
|
|
10079
10131
|
const abortController = new AbortController();
|
|
10080
10132
|
taskAbortControllers.set(taskId, abortController);
|
|
@@ -10146,7 +10198,11 @@ tasks.post(
|
|
|
10146
10198
|
return readable;
|
|
10147
10199
|
};
|
|
10148
10200
|
await streamContext.resumableStream(streamId, taskStreamProducer);
|
|
10149
|
-
return c.json({
|
|
10201
|
+
return c.json({
|
|
10202
|
+
taskId,
|
|
10203
|
+
status: "running",
|
|
10204
|
+
...body.parentTaskId ? { parentTaskId: body.parentTaskId } : {}
|
|
10205
|
+
}, 201);
|
|
10150
10206
|
}
|
|
10151
10207
|
);
|
|
10152
10208
|
tasks.get("/:id", async (c) => {
|
|
@@ -10176,6 +10232,7 @@ tasks.get("/:id", async (c) => {
|
|
|
10176
10232
|
iterations: task.iterations,
|
|
10177
10233
|
model: session.model,
|
|
10178
10234
|
name: session.name,
|
|
10235
|
+
parentTaskId: task.parentTaskId,
|
|
10179
10236
|
createdAt: session.createdAt.toISOString(),
|
|
10180
10237
|
updatedAt: session.updatedAt.toISOString(),
|
|
10181
10238
|
browserRecordings: browserRecordings.length > 0 ? browserRecordings : void 0
|