sparkecoder 0.1.21 → 0.1.22

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 (87) hide show
  1. package/dist/agent/index.d.ts +2 -2
  2. package/dist/agent/index.js +53 -3
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/cli.js +397 -46
  5. package/dist/cli.js.map +1 -1
  6. package/dist/db/index.d.ts +2 -1
  7. package/dist/db/index.js.map +1 -1
  8. package/dist/{index-BzedNBK-.d.ts → index-CNwLFGiZ.d.ts} +24 -3
  9. package/dist/index.d.ts +4 -4
  10. package/dist/index.js +392 -41
  11. package/dist/index.js.map +1 -1
  12. package/dist/{schema-CkrIadxa.d.ts → schema-Df7MU3nM.d.ts} +26 -3
  13. package/dist/server/index.js +392 -41
  14. package/dist/server/index.js.map +1 -1
  15. package/dist/tools/index.js.map +1 -1
  16. package/package.json +1 -1
  17. package/web/.next/BUILD_ID +1 -1
  18. package/web/.next/standalone/web/.next/BUILD_ID +1 -1
  19. package/web/.next/standalone/web/.next/build-manifest.json +2 -2
  20. package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
  21. package/web/.next/standalone/web/.next/server/app/(main)/page.js.nft.json +1 -1
  22. package/web/.next/standalone/web/.next/server/app/(main)/page_client-reference-manifest.js +1 -1
  23. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page.js.nft.json +1 -1
  24. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
  25. package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
  26. package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
  27. package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  28. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  29. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  30. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  31. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  32. package/web/.next/standalone/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  33. package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
  34. package/web/.next/standalone/web/.next/server/app/_not-found.rsc +2 -2
  35. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  36. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  37. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  38. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  39. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  40. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  41. package/web/.next/standalone/web/.next/server/app/index.html +1 -1
  42. package/web/.next/standalone/web/.next/server/app/index.rsc +4 -4
  43. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +2 -2
  44. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +2 -2
  45. package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +4 -4
  46. package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  47. package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +2 -2
  48. package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  49. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_1d78db71._.js → 2374f_387a1437._.js} +1 -1
  50. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_378282b1._.js → 2374f_5f58fd73._.js} +1 -1
  51. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_30f9df13._.js → 2374f_65fcfd95._.js} +1 -1
  52. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_8825dcc9._.js → 2374f_741f6b67._.js} +1 -1
  53. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_9bf3c7f3._.js → 2374f_814be2c9._.js} +2 -2
  54. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_5de336d2._.js → 2374f_84859a94._.js} +1 -1
  55. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_bbc99511._.js → 2374f_cfd0137a._.js} +1 -1
  56. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_d94c2b70._.js → 2374f_f1038f7c._.js} +1 -1
  57. package/web/.next/standalone/web/.next/server/chunks/ssr/{[root-of-the-server]__a984d933._.js → [root-of-the-server]__3ec22171._.js} +2 -2
  58. package/web/.next/standalone/web/.next/server/chunks/ssr/web_c7618534._.js +8 -0
  59. package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
  60. package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
  61. package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
  62. package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
  63. package/web/.next/standalone/web/.next/static/chunks/{a86053f0894587f2.js → 3bb454ca848ec78e.js} +3 -3
  64. package/web/.next/standalone/web/.next/static/chunks/{5ec82ce8f3aabaf0.js → 5e5b485d77ac0d8f.js} +1 -1
  65. package/web/.next/standalone/web/.next/static/chunks/cb355fac10c6ad11.css +1 -0
  66. package/web/.next/standalone/web/.next/static/static/chunks/{a86053f0894587f2.js → 3bb454ca848ec78e.js} +3 -3
  67. package/web/.next/{static/chunks/5ec82ce8f3aabaf0.js → standalone/web/.next/static/static/chunks/5e5b485d77ac0d8f.js} +1 -1
  68. package/web/.next/standalone/web/.next/static/static/chunks/cb355fac10c6ad11.css +1 -0
  69. package/web/.next/standalone/web/src/components/ai-elements/speech-input.tsx +89 -36
  70. package/web/.next/standalone/web/src/components/chat-interface.tsx +353 -37
  71. package/web/.next/standalone/web/src/lib/api.ts +133 -2
  72. package/web/.next/static/chunks/{a86053f0894587f2.js → 3bb454ca848ec78e.js} +3 -3
  73. package/web/.next/{standalone/web/.next/static/static/chunks/5ec82ce8f3aabaf0.js → static/chunks/5e5b485d77ac0d8f.js} +1 -1
  74. package/web/.next/static/chunks/cb355fac10c6ad11.css +1 -0
  75. package/web/.next/standalone/web/.next/server/chunks/ssr/web_19b6934c._.js +0 -8
  76. package/web/.next/standalone/web/.next/static/chunks/d0a69c59b1c0d99c.css +0 -1
  77. package/web/.next/standalone/web/.next/static/static/chunks/d0a69c59b1c0d99c.css +0 -1
  78. package/web/.next/static/chunks/d0a69c59b1c0d99c.css +0 -1
  79. /package/web/.next/standalone/web/.next/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_buildManifest.js +0 -0
  80. /package/web/.next/standalone/web/.next/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_clientMiddlewareManifest.json +0 -0
  81. /package/web/.next/standalone/web/.next/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_ssgManifest.js +0 -0
  82. /package/web/.next/standalone/web/.next/static/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_buildManifest.js +0 -0
  83. /package/web/.next/standalone/web/.next/static/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_clientMiddlewareManifest.json +0 -0
  84. /package/web/.next/standalone/web/.next/static/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_ssgManifest.js +0 -0
  85. /package/web/.next/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_buildManifest.js +0 -0
  86. /package/web/.next/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_clientMiddlewareManifest.json +0 -0
  87. /package/web/.next/static/{kABnAk0Y1tlcrUKDlM8UT → n86r6x1RoUipFp6nLIk-R}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
1
  import 'ai';
2
- import '../schema-CkrIadxa.js';
3
- export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, d as buildSystemPrompt } from '../index-BzedNBK-.js';
2
+ import '../schema-Df7MU3nM.js';
3
+ export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, M as MessageAttachment, d as buildSystemPrompt } from '../index-CNwLFGiZ.js';
4
4
  import '../bash-CGAqW7HR.js';
5
5
  import 'drizzle-orm/sqlite-core';
6
6
  import 'zod';
@@ -2649,11 +2649,12 @@ ${this.summary}`
2649
2649
  }
2650
2650
  /**
2651
2651
  * Add a user message to the context
2652
+ * Content can be a string or an array of content parts (for messages with images/files)
2652
2653
  */
2653
- addUserMessage(text2) {
2654
+ addUserMessage(content) {
2654
2655
  const userMessage = {
2655
2656
  role: "user",
2656
- content: text2
2657
+ content
2657
2658
  };
2658
2659
  messageQueries.create(this.sessionId, userMessage);
2659
2660
  }
@@ -2753,13 +2754,62 @@ var Agent = class _Agent {
2753
2754
  getSession() {
2754
2755
  return this.session;
2755
2756
  }
2757
+ /**
2758
+ * Build user message content from prompt and attachments
2759
+ */
2760
+ buildUserMessageContent(prompt, attachments) {
2761
+ if (!attachments || attachments.length === 0) {
2762
+ return prompt;
2763
+ }
2764
+ const contentParts = [];
2765
+ const attachmentDescriptions = attachments.map((a, i) => {
2766
+ const name = a.filename || `attachment_${i + 1}`;
2767
+ const typeLabel = a.type === "image" ? "Image" : "File";
2768
+ const location = a.savedPath || "(path unknown)";
2769
+ return `${i + 1}. ${typeLabel}: "${name}" saved at: ${location}`;
2770
+ }).join("\n");
2771
+ contentParts.push({
2772
+ type: "text",
2773
+ text: `[FILE ATTACHMENTS - The user has attached the following files which are saved on disk]
2774
+ ${attachmentDescriptions}
2775
+
2776
+ You can reference these files by their paths above. The file contents are also shown inline below.`
2777
+ });
2778
+ if (prompt) {
2779
+ contentParts.push({ type: "text", text: `
2780
+ [USER MESSAGE]
2781
+ ${prompt}` });
2782
+ }
2783
+ for (const attachment of attachments) {
2784
+ if (attachment.type === "image") {
2785
+ contentParts.push({
2786
+ type: "image",
2787
+ image: attachment.data,
2788
+ // base64 data URL or raw base64
2789
+ mediaType: attachment.mediaType,
2790
+ filename: attachment.filename,
2791
+ savedPath: attachment.savedPath
2792
+ });
2793
+ } else {
2794
+ contentParts.push({
2795
+ type: "file",
2796
+ data: attachment.data,
2797
+ mediaType: attachment.mediaType || "application/octet-stream",
2798
+ filename: attachment.filename,
2799
+ savedPath: attachment.savedPath
2800
+ });
2801
+ }
2802
+ }
2803
+ return contentParts;
2804
+ }
2756
2805
  /**
2757
2806
  * Run the agent with a prompt (streaming)
2758
2807
  */
2759
2808
  async stream(options) {
2760
2809
  const config = getConfig();
2810
+ const userContent = this.buildUserMessageContent(options.prompt, options.attachments);
2761
2811
  if (!options.skipSaveUserMessage) {
2762
- this.context.addUserMessage(options.prompt);
2812
+ this.context.addUserMessage(userContent);
2763
2813
  }
2764
2814
  sessionQueries.updateStatus(this.session.id, "active");
2765
2815
  const systemPrompt = await buildSystemPrompt({