sparkecoder 0.1.79 → 0.1.81

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.
Files changed (95) hide show
  1. package/dist/agent/index.d.ts +2 -2
  2. package/dist/agent/index.js +21 -6
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/cli.js +75 -18
  5. package/dist/cli.js.map +1 -1
  6. package/dist/db/index.d.ts +2 -2
  7. package/dist/{index-DT1l57s0.d.ts → index-OhuTM4a0.d.ts} +6 -1
  8. package/dist/index.d.ts +4 -4
  9. package/dist/index.js +73 -17
  10. package/dist/index.js.map +1 -1
  11. package/dist/{schema-XcP0dedO.d.ts → schema-CohdIL13.d.ts} +1 -0
  12. package/dist/server/index.js +73 -17
  13. package/dist/server/index.js.map +1 -1
  14. package/dist/skills/default/browser.md +11 -2
  15. package/dist/tools/index.js +2 -1
  16. package/dist/tools/index.js.map +1 -1
  17. package/package.json +1 -1
  18. package/src/skills/default/browser.md +11 -2
  19. package/web/.next/BUILD_ID +1 -1
  20. package/web/.next/standalone/web/.next/BUILD_ID +1 -1
  21. package/web/.next/standalone/web/.next/build-manifest.json +2 -2
  22. package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
  23. package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
  24. package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
  25. package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  26. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  27. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  28. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  29. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  30. package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
  31. package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
  32. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  33. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  34. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  35. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  36. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  37. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  38. package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
  39. package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
  40. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
  41. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
  42. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
  43. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
  44. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
  45. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
  46. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
  47. package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
  48. package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
  49. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
  50. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
  51. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
  52. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
  53. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
  54. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
  55. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
  56. package/web/.next/standalone/web/.next/server/app/docs/tools.html +2 -2
  57. package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +1 -1
  58. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +1 -1
  59. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
  60. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
  61. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
  62. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +1 -1
  63. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
  64. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
  65. package/web/.next/standalone/web/.next/server/app/docs.html +2 -2
  66. package/web/.next/standalone/web/.next/server/app/docs.rsc +1 -1
  67. package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +1 -1
  68. package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  69. package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
  70. package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
  71. package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  72. package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  73. package/web/.next/standalone/web/.next/server/app/index.html +1 -1
  74. package/web/.next/standalone/web/.next/server/app/index.rsc +1 -1
  75. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
  76. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
  77. package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
  78. package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  79. package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
  80. package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  81. package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
  82. package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
  83. package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
  84. package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
  85. package/web/.next/standalone/web/package-lock.json +3 -3
  86. package/web/.next/standalone/web/src/lib/api.ts +1 -0
  87. /package/web/.next/standalone/web/.next/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_buildManifest.js +0 -0
  88. /package/web/.next/standalone/web/.next/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_clientMiddlewareManifest.json +0 -0
  89. /package/web/.next/standalone/web/.next/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_ssgManifest.js +0 -0
  90. /package/web/.next/standalone/web/.next/static/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_buildManifest.js +0 -0
  91. /package/web/.next/standalone/web/.next/static/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_clientMiddlewareManifest.json +0 -0
  92. /package/web/.next/standalone/web/.next/static/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_ssgManifest.js +0 -0
  93. /package/web/.next/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_buildManifest.js +0 -0
  94. /package/web/.next/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_clientMiddlewareManifest.json +0 -0
  95. /package/web/.next/static/{mEI-vdO1YIKdN2l_2MTLR → CAGGCb0khU_QcA3lh6Rk6}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
- import { C as Checkpoint, F as FileBackup, M as ModelMessage, a as Message, S as Session, L as LoadedSkill, T as TodoItem, b as ToolExecution, A as ActiveStream, I as IndexStatusRecord, c as IndexedChunk, d as SubagentExecution, e as SubagentStep, f as Terminal } from '../schema-XcP0dedO.js';
2
- export { N as NewActiveStream, g as NewCheckpoint, h as NewFileBackup, i as NewIndexStatusRecord, j as NewIndexedChunk, k as NewMessage, l as NewSession, m as NewSubagentExecution, n as NewTerminal, o as NewTodoItem, p as NewToolExecution, q as SessionConfig, r as TaskConfig, U as UserContentPart, s as UserFilePart, t as UserImagePart, u as UserModelMessage, v as UserTextPart } from '../schema-XcP0dedO.js';
1
+ import { C as Checkpoint, F as FileBackup, M as ModelMessage, a as Message, S as Session, L as LoadedSkill, T as TodoItem, b as ToolExecution, A as ActiveStream, I as IndexStatusRecord, c as IndexedChunk, d as SubagentExecution, e as SubagentStep, f as Terminal } from '../schema-CohdIL13.js';
2
+ export { N as NewActiveStream, g as NewCheckpoint, h as NewFileBackup, i as NewIndexStatusRecord, j as NewIndexedChunk, k as NewMessage, l as NewSession, m as NewSubagentExecution, n as NewTerminal, o as NewTodoItem, p as NewToolExecution, q as SessionConfig, r as TaskConfig, U as UserContentPart, s as UserFilePart, t as UserImagePart, u as UserModelMessage, v as UserTextPart } from '../schema-CohdIL13.js';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { ModelMessage, streamText } from 'ai';
2
- import { S as Session, b as ToolExecution, r as TaskConfig } from './schema-XcP0dedO.js';
2
+ import { S as Session, b as ToolExecution, r as TaskConfig } from './schema-CohdIL13.js';
3
3
  import { z } from 'zod';
4
4
  import { B as BashToolProgress, W as WriteFileProgress, S as SearchToolProgress } from './search-CCffrVJE.js';
5
5
 
@@ -36,6 +36,7 @@ declare const SessionConfigSchema: z.ZodObject<{
36
36
  result: z.ZodOptional<z.ZodUnknown>;
37
37
  error: z.ZodOptional<z.ZodString>;
38
38
  iterations: z.ZodOptional<z.ZodNumber>;
39
+ parentTaskId: z.ZodOptional<z.ZodString>;
39
40
  }, "strip", z.ZodTypeAny, {
40
41
  status: "completed" | "failed" | "running";
41
42
  outputSchema: Record<string, unknown>;
@@ -43,6 +44,7 @@ declare const SessionConfigSchema: z.ZodObject<{
43
44
  error?: string | undefined;
44
45
  maxIterations?: number | undefined;
45
46
  webhookUrl?: string | undefined;
47
+ parentTaskId?: string | undefined;
46
48
  result?: unknown;
47
49
  iterations?: number | undefined;
48
50
  }, {
@@ -52,6 +54,7 @@ declare const SessionConfigSchema: z.ZodObject<{
52
54
  error?: string | undefined;
53
55
  maxIterations?: number | undefined;
54
56
  webhookUrl?: string | undefined;
57
+ parentTaskId?: string | undefined;
55
58
  result?: unknown;
56
59
  iterations?: number | undefined;
57
60
  }>>;
@@ -66,6 +69,7 @@ declare const SessionConfigSchema: z.ZodObject<{
66
69
  error?: string | undefined;
67
70
  maxIterations?: number | undefined;
68
71
  webhookUrl?: string | undefined;
72
+ parentTaskId?: string | undefined;
69
73
  result?: unknown;
70
74
  iterations?: number | undefined;
71
75
  } | undefined;
@@ -80,6 +84,7 @@ declare const SessionConfigSchema: z.ZodObject<{
80
84
  error?: string | undefined;
81
85
  maxIterations?: number | undefined;
82
86
  webhookUrl?: string | undefined;
87
+ parentTaskId?: string | undefined;
83
88
  result?: unknown;
84
89
  iterations?: number | undefined;
85
90
  } | undefined;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { R as ResolvedConfig } from './index-DT1l57s0.js';
2
- export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, S as SparkcoderConfig, T as ToolApprovalConfig } from './index-DT1l57s0.js';
1
+ import { R as ResolvedConfig } from './index-OhuTM4a0.js';
2
+ export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, S as SparkcoderConfig, T as ToolApprovalConfig } from './index-OhuTM4a0.js';
3
3
  export { ServerOptions, createApp, startServer, stopServer } from './server/index.js';
4
4
  export { checkpointQueries, closeDatabase, fileBackupQueries, getDb, initDatabase, messageQueries, sessionQueries, skillQueries, todoQueries, toolExecutionQueries } from './db/index.js';
5
- import { F as FileBackup, C as Checkpoint } from './schema-XcP0dedO.js';
6
- export { a as Message, M as ModelMessage, S as Session, q as SessionConfig, f as Terminal, T as TodoItem, b as ToolExecution } from './schema-XcP0dedO.js';
5
+ import { F as FileBackup, C as Checkpoint } from './schema-CohdIL13.js';
6
+ export { a as Message, M as ModelMessage, S as Session, q as SessionConfig, f as Terminal, T as TodoItem, b as ToolExecution } from './schema-CohdIL13.js';
7
7
  export { createLoadSkillTool, createReadFileTool, createTodoTool, createTools } from './tools/index.js';
8
8
  export { c as createBashTool, a as createWriteFileTool } from './search-CCffrVJE.js';
9
9
  import 'ai';
package/dist/index.js CHANGED
@@ -37,7 +37,8 @@ var init_types = __esm({
37
37
  status: z.enum(["running", "completed", "failed"]),
38
38
  result: z.unknown().optional(),
39
39
  error: z.string().optional(),
40
- iterations: z.number().optional()
40
+ iterations: z.number().optional(),
41
+ parentTaskId: z.string().optional()
41
42
  });
42
43
  SessionConfigSchema = z.object({
43
44
  toolApprovals: z.record(z.string(), z.boolean()).optional(),
@@ -6325,11 +6326,25 @@ Before calling \`complete_task\`, you MUST verify your work completely. Do not j
6325
6326
  - If something doesn't look right, fix it \u2014 don't complete with known issues.
6326
6327
 
6327
6328
  **Screenshot your completed work:**
6328
- - 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.
6329
- - Save screenshots and generated artifacts under \`.sparkecode-artifacts/\` (git-ignored) instead of the repo root.
6330
- - Ensure \`.sparkecode-artifacts/\` is listed in \`.gitignore\`; if it is missing, add it before continuing.
6331
- - 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.
6332
- - In task results, never return local filesystem paths for screenshots/reports; return uploaded \`downloadUrl\` links only.
6329
+ - After completing a task, take a screenshot of the result when it makes sense (UI changes, browser pages, etc.).
6330
+ - All screenshots and artifacts go under \`.sparkecode-artifacts/\` **inside the working directory**. Create subdirectories as needed:
6331
+ \`\`\`bash
6332
+ mkdir -p .sparkecode-artifacts/screenshots
6333
+ \`\`\`
6334
+ - Before your first screenshot, check that \`.sparkecode-artifacts/\` is listed in the project's \`.gitignore\`. If it is missing, add it:
6335
+ \`\`\`bash
6336
+ grep -q "sparkecode-artifacts" .gitignore 2>/dev/null || echo ".sparkecode-artifacts/" >> .gitignore
6337
+ \`\`\`
6338
+ - Take screenshots with \`agent-browser\` using the full relative path from the working directory:
6339
+ \`\`\`bash
6340
+ agent-browser screenshot ".sparkecode-artifacts/screenshots/result.png"
6341
+ \`\`\`
6342
+ - After taking a screenshot, view it with \`read_file\` and then upload it with \`upload_file\`:
6343
+ \`\`\`
6344
+ read_file({ path: ".sparkecode-artifacts/screenshots/result.png" })
6345
+ upload_file({ path: ".sparkecode-artifacts/screenshots/result.png", name: "result.png" })
6346
+ \`\`\`
6347
+ - In task results, NEVER return local filesystem paths for screenshots/reports. Return only the \`downloadUrl\` from \`upload_file\`.
6333
6348
  - This is especially valuable for UI/visual changes, successful test runs, and browser verification \u2014 show, don't just tell.
6334
6349
 
6335
6350
  ### Use All Available Tools
@@ -10081,7 +10096,8 @@ var createTaskSchema = z19.object({
10081
10096
  model: z19.string().optional(),
10082
10097
  workingDirectory: z19.string().optional(),
10083
10098
  name: z19.string().optional(),
10084
- maxIterations: z19.number().int().min(1).max(500).optional()
10099
+ maxIterations: z19.number().int().min(1).max(500).optional(),
10100
+ parentTaskId: z19.string().optional()
10085
10101
  });
10086
10102
  tasks.post(
10087
10103
  "/",
@@ -10094,17 +10110,52 @@ tasks.post(
10094
10110
  outputSchema: body.outputSchema,
10095
10111
  webhookUrl: body.webhookUrl,
10096
10112
  maxIterations: body.maxIterations ?? 50,
10097
- status: "running"
10113
+ status: "running",
10114
+ parentTaskId: body.parentTaskId
10098
10115
  };
10099
- const agent = await Agent.create({
10100
- name: body.name || "Task",
10101
- workingDirectory: body.workingDirectory || config.resolvedWorkingDirectory,
10102
- model: body.model || config.defaultModel,
10103
- sessionConfig: {
10104
- toolApprovals: { bash: false, write_file: false, read_file: false },
10105
- task: taskConfig
10116
+ let agent;
10117
+ if (body.parentTaskId) {
10118
+ const parentSession = await sessionQueries.getById(body.parentTaskId);
10119
+ if (!parentSession) {
10120
+ return c.json({ error: "Parent task not found" }, 404);
10121
+ }
10122
+ const parentTask = parentSession.config?.task;
10123
+ if (!parentTask?.enabled) {
10124
+ return c.json({ error: "Parent session is not a task" }, 400);
10125
+ }
10126
+ if (parentTask.status === "running") {
10127
+ return c.json({ error: "Parent task is still running. Wait for it to complete before chaining." }, 409);
10128
+ }
10129
+ const parentStream = await activeStreamQueries.getBySessionId(body.parentTaskId);
10130
+ if (parentStream) {
10131
+ return c.json({ error: "Parent task has an active stream" }, 409);
10132
+ }
10133
+ agent = await Agent.create({
10134
+ name: body.name || "Task",
10135
+ workingDirectory: body.workingDirectory || parentSession.workingDirectory,
10136
+ model: body.model || parentSession.model,
10137
+ sessionConfig: {
10138
+ toolApprovals: { bash: false, write_file: false, read_file: false },
10139
+ task: taskConfig
10140
+ }
10141
+ });
10142
+ const parentMessages = await messageQueries.getBySession(body.parentTaskId);
10143
+ if (parentMessages.length > 0) {
10144
+ const modelMessages = parentMessages.map((m) => m.modelMessage);
10145
+ await messageQueries.addMany(agent.sessionId, modelMessages);
10146
+ console.log(`[TASK] Copied ${modelMessages.length} messages from parent ${body.parentTaskId} to ${agent.sessionId}`);
10106
10147
  }
10107
- });
10148
+ } else {
10149
+ agent = await Agent.create({
10150
+ name: body.name || "Task",
10151
+ workingDirectory: body.workingDirectory || config.resolvedWorkingDirectory,
10152
+ model: body.model || config.defaultModel,
10153
+ sessionConfig: {
10154
+ toolApprovals: { bash: false, write_file: false, read_file: false },
10155
+ task: taskConfig
10156
+ }
10157
+ });
10158
+ }
10108
10159
  const taskId = agent.sessionId;
10109
10160
  const abortController = new AbortController();
10110
10161
  taskAbortControllers.set(taskId, abortController);
@@ -10176,7 +10227,11 @@ tasks.post(
10176
10227
  return readable;
10177
10228
  };
10178
10229
  await streamContext.resumableStream(streamId, taskStreamProducer);
10179
- return c.json({ taskId, status: "running" }, 201);
10230
+ return c.json({
10231
+ taskId,
10232
+ status: "running",
10233
+ ...body.parentTaskId ? { parentTaskId: body.parentTaskId } : {}
10234
+ }, 201);
10180
10235
  }
10181
10236
  );
10182
10237
  tasks.get("/:id", async (c) => {
@@ -10206,6 +10261,7 @@ tasks.get("/:id", async (c) => {
10206
10261
  iterations: task.iterations,
10207
10262
  model: session.model,
10208
10263
  name: session.name,
10264
+ parentTaskId: task.parentTaskId,
10209
10265
  createdAt: session.createdAt.toISOString(),
10210
10266
  updatedAt: session.updatedAt.toISOString(),
10211
10267
  browserRecordings: browserRecordings.length > 0 ? browserRecordings : void 0