sparkecoder 0.1.9 → 0.1.10

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 (146) hide show
  1. package/dist/agent/index.d.ts +3 -3
  2. package/dist/agent/index.js +26 -7
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/{bash-CGAqW7HR.d.ts → bash-C43A-o5X.d.ts} +4 -4
  5. package/dist/cli.js +21 -9
  6. package/dist/cli.js.map +1 -1
  7. package/dist/db/index.d.ts +1 -1
  8. package/dist/{index-BeKylVnB.d.ts → index-DuWb8kNN.d.ts} +6 -6
  9. package/dist/index.d.ts +7 -7
  10. package/dist/index.js +17 -9
  11. package/dist/index.js.map +1 -1
  12. package/dist/{schema-CkrIadxa.d.ts → schema-J6qYlHtl.d.ts} +3 -3
  13. package/dist/server/index.js +17 -9
  14. package/dist/server/index.js.map +1 -1
  15. package/dist/tools/index.d.ts +3 -3
  16. package/dist/tools/index.js +152 -118
  17. package/dist/tools/index.js.map +1 -1
  18. package/package.json +1 -1
  19. package/web/.next/BUILD_ID +1 -1
  20. package/web/.next/build-manifest.json +2 -2
  21. package/web/.next/cache/.previewinfo +1 -1
  22. package/web/.next/cache/.rscinfo +1 -1
  23. package/web/.next/cache/.tsbuildinfo +1 -1
  24. package/web/.next/cache/config.json +3 -3
  25. package/web/.next/dev/cache/.rscinfo +1 -1
  26. package/web/.next/dev/cache/config.json +3 -3
  27. package/web/.next/dev/cache/turbopack/731ace46/00000001.sst +0 -0
  28. package/web/.next/dev/cache/turbopack/731ace46/00000002.sst +0 -0
  29. package/web/.next/dev/cache/turbopack/731ace46/00000004.sst +0 -0
  30. package/web/.next/dev/cache/turbopack/731ace46/00000005.sst +0 -0
  31. package/web/.next/dev/cache/turbopack/731ace46/00000007.meta +0 -0
  32. package/web/.next/dev/cache/turbopack/731ace46/00000008.meta +0 -0
  33. package/web/.next/dev/cache/turbopack/731ace46/00000010.meta +0 -0
  34. package/web/.next/dev/cache/turbopack/731ace46/00000011.sst +0 -0
  35. package/web/.next/dev/cache/turbopack/731ace46/00000012.sst +0 -0
  36. package/web/.next/dev/cache/turbopack/731ace46/00000014.sst +0 -0
  37. package/web/.next/dev/cache/turbopack/731ace46/00000015.sst +0 -0
  38. package/web/.next/dev/cache/turbopack/731ace46/00000017.meta +0 -0
  39. package/web/.next/dev/cache/turbopack/731ace46/00000018.meta +0 -0
  40. package/web/.next/dev/cache/turbopack/731ace46/00000019.meta +0 -0
  41. package/web/.next/dev/cache/turbopack/731ace46/00000020.meta +0 -0
  42. package/web/.next/dev/cache/turbopack/731ace46/00000021.sst +0 -0
  43. package/web/.next/dev/cache/turbopack/731ace46/00000022.sst +0 -0
  44. package/web/.next/dev/cache/turbopack/731ace46/00000023.sst +0 -0
  45. package/web/.next/dev/cache/turbopack/731ace46/{00000040.meta → 00000025.meta} +0 -0
  46. package/web/.next/dev/cache/turbopack/731ace46/00000026.meta +0 -0
  47. package/web/.next/dev/cache/turbopack/731ace46/00000027.sst +0 -0
  48. package/web/.next/dev/cache/turbopack/731ace46/00000028.sst +0 -0
  49. package/web/.next/dev/cache/turbopack/731ace46/00000029.sst +0 -0
  50. package/web/.next/dev/cache/turbopack/731ace46/00000030.meta +0 -0
  51. package/web/.next/dev/cache/turbopack/731ace46/{00000045.meta → 00000031.meta} +0 -0
  52. package/web/.next/dev/cache/turbopack/731ace46/{00000029.meta → 00000032.meta} +0 -0
  53. package/web/.next/dev/cache/turbopack/731ace46/00000033.sst +0 -0
  54. package/web/.next/dev/cache/turbopack/731ace46/00000034.sst +0 -0
  55. package/web/.next/dev/cache/turbopack/731ace46/00000035.sst +0 -0
  56. package/web/.next/dev/cache/turbopack/731ace46/00000036.meta +0 -0
  57. package/web/.next/dev/cache/turbopack/731ace46/00000037.meta +0 -0
  58. package/web/.next/dev/cache/turbopack/731ace46/00000038.meta +0 -0
  59. package/web/.next/dev/cache/turbopack/731ace46/00000039.sst +0 -0
  60. package/web/.next/dev/cache/turbopack/731ace46/00000040.sst +0 -0
  61. package/web/.next/dev/cache/turbopack/731ace46/00000041.sst +0 -0
  62. package/web/.next/dev/cache/turbopack/731ace46/00000042.meta +0 -0
  63. package/web/.next/dev/cache/turbopack/731ace46/{00000039.meta → 00000043.meta} +0 -0
  64. package/web/.next/dev/cache/turbopack/731ace46/00000044.meta +0 -0
  65. package/web/.next/dev/cache/turbopack/731ace46/00000045.sst +0 -0
  66. package/web/.next/dev/cache/turbopack/731ace46/{00000042.sst → 00000046.sst} +0 -0
  67. package/web/.next/dev/cache/turbopack/731ace46/00000047.sst +0 -0
  68. package/web/.next/dev/cache/turbopack/731ace46/00000048.meta +0 -0
  69. package/web/.next/dev/cache/turbopack/731ace46/00000049.meta +0 -0
  70. package/web/.next/dev/cache/turbopack/731ace46/00000050.meta +0 -0
  71. package/web/.next/dev/cache/turbopack/731ace46/00000051.sst +0 -0
  72. package/web/.next/dev/cache/turbopack/731ace46/00000052.sst +0 -0
  73. package/web/.next/dev/cache/turbopack/731ace46/00000053.sst +0 -0
  74. package/web/.next/dev/cache/turbopack/731ace46/00000054.meta +0 -0
  75. package/web/.next/dev/cache/turbopack/731ace46/00000055.meta +0 -0
  76. package/web/.next/dev/cache/turbopack/731ace46/00000056.meta +0 -0
  77. package/web/.next/dev/cache/turbopack/731ace46/CURRENT +0 -0
  78. package/web/.next/dev/cache/turbopack/731ace46/LOG +44 -30
  79. package/web/.next/dev/prerender-manifest.json +3 -3
  80. package/web/.next/dev/server/server-reference-manifest.js +1 -1
  81. package/web/.next/dev/server/server-reference-manifest.json +1 -1
  82. package/web/.next/dev/trace +1 -1
  83. package/web/.next/fallback-build-manifest.json +2 -2
  84. package/web/.next/prerender-manifest.json +3 -3
  85. package/web/.next/server/app/(main)/session/[id]/page.js.nft.json +1 -1
  86. package/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
  87. package/web/.next/server/app/_global-error.html +2 -2
  88. package/web/.next/server/app/_global-error.rsc +1 -1
  89. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  90. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  91. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  92. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  93. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  94. package/web/.next/server/app/_not-found.html +1 -1
  95. package/web/.next/server/app/_not-found.rsc +1 -1
  96. package/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  97. package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  98. package/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  99. package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  100. package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  101. package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  102. package/web/.next/server/app/index.html +1 -1
  103. package/web/.next/server/app/index.rsc +1 -1
  104. package/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
  105. package/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
  106. package/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
  107. package/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  108. package/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
  109. package/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  110. package/web/.next/server/chunks/ssr/{2374f__pnpm_d7f11ceb._.js → 2374f__pnpm_2c066fc4._.js} +1 -1
  111. package/web/.next/server/chunks/ssr/{2374f__pnpm_e04ff5e3._.js → 2374f__pnpm_6c21de20._.js} +1 -1
  112. package/web/.next/server/chunks/ssr/{2374f__pnpm_f4abb025._.js → 2374f__pnpm_7261fee6._.js} +1 -1
  113. package/web/.next/server/chunks/ssr/{2374f__pnpm_c03e1359._.js → 2374f__pnpm_86153ae0._.js} +1 -1
  114. package/web/.next/server/chunks/ssr/{2374f__pnpm_eb87394d._.js → 2374f__pnpm_b316ce7b._.js} +2 -2
  115. package/web/.next/server/chunks/ssr/{2374f__pnpm_aa2ce93b._.js → 2374f__pnpm_e9578f61._.js} +1 -1
  116. package/web/.next/server/chunks/ssr/{2374f__pnpm_c7feb274._.js → 2374f__pnpm_ef13102d._.js} +1 -1
  117. package/web/.next/server/chunks/ssr/{2374f__pnpm_2f0d7c45._.js → 2374f__pnpm_f79c2825._.js} +1 -1
  118. package/web/.next/server/chunks/ssr/{[root-of-the-server]__2dfcd951._.js → [root-of-the-server]__02cdbf0f._.js} +2 -2
  119. package/web/.next/server/chunks/ssr/[root-of-the-server]__02cdbf0f._.js.map +1 -0
  120. package/web/.next/server/pages/404.html +1 -1
  121. package/web/.next/server/pages/500.html +2 -2
  122. package/web/.next/server/server-reference-manifest.js +1 -1
  123. package/web/.next/server/server-reference-manifest.json +1 -1
  124. package/web/.next/static/chunks/{bf853305cd7a9765.js → cffe148e9b82e836.js} +3 -3
  125. package/web/.next/trace +1 -1
  126. package/web/.next/trace-build +1 -1
  127. package/web/.next/dev/cache/turbopack/731ace46/00000024.sst +0 -0
  128. package/web/.next/dev/cache/turbopack/731ace46/00000025.sst +0 -0
  129. package/web/.next/dev/cache/turbopack/731ace46/00000028.meta +0 -0
  130. package/web/.next/dev/cache/turbopack/731ace46/00000031.sst +0 -0
  131. package/web/.next/dev/cache/turbopack/731ace46/00000032.sst +0 -0
  132. package/web/.next/dev/cache/turbopack/731ace46/00000043.sst +0 -0
  133. package/web/.next/dev/cache/turbopack/731ace46/00000046.meta +0 -0
  134. package/web/.next/server/chunks/ssr/[root-of-the-server]__2dfcd951._.js.map +0 -1
  135. /package/web/.next/dev/cache/turbopack/731ace46/{00000027.meta → 00000024.meta} +0 -0
  136. /package/web/.next/server/chunks/ssr/{2374f__pnpm_d7f11ceb._.js.map → 2374f__pnpm_2c066fc4._.js.map} +0 -0
  137. /package/web/.next/server/chunks/ssr/{2374f__pnpm_e04ff5e3._.js.map → 2374f__pnpm_6c21de20._.js.map} +0 -0
  138. /package/web/.next/server/chunks/ssr/{2374f__pnpm_f4abb025._.js.map → 2374f__pnpm_7261fee6._.js.map} +0 -0
  139. /package/web/.next/server/chunks/ssr/{2374f__pnpm_c03e1359._.js.map → 2374f__pnpm_86153ae0._.js.map} +0 -0
  140. /package/web/.next/server/chunks/ssr/{2374f__pnpm_eb87394d._.js.map → 2374f__pnpm_b316ce7b._.js.map} +0 -0
  141. /package/web/.next/server/chunks/ssr/{2374f__pnpm_aa2ce93b._.js.map → 2374f__pnpm_e9578f61._.js.map} +0 -0
  142. /package/web/.next/server/chunks/ssr/{2374f__pnpm_c7feb274._.js.map → 2374f__pnpm_ef13102d._.js.map} +0 -0
  143. /package/web/.next/server/chunks/ssr/{2374f__pnpm_2f0d7c45._.js.map → 2374f__pnpm_f79c2825._.js.map} +0 -0
  144. /package/web/.next/static/{O9K30qQQXDEvnesMUBQxo → YnBzwu6wdLNKy3zBf7w5K}/_buildManifest.js +0 -0
  145. /package/web/.next/static/{O9K30qQQXDEvnesMUBQxo → YnBzwu6wdLNKy3zBf7w5K}/_clientMiddlewareManifest.json +0 -0
  146. /package/web/.next/static/{O9K30qQQXDEvnesMUBQxo → YnBzwu6wdLNKy3zBf7w5K}/_ssgManifest.js +0 -0
@@ -18,7 +18,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
18
18
  command?: string | undefined;
19
19
  kill?: boolean | undefined;
20
20
  tail?: number | undefined;
21
- key?: "y" | "Enter" | "Escape" | "Up" | "Down" | "Left" | "Right" | "Tab" | "C-c" | "C-d" | "n" | undefined;
21
+ key?: "Enter" | "Escape" | "Up" | "Down" | "Left" | "Right" | "Tab" | "C-c" | "C-d" | "y" | "n" | undefined;
22
22
  }, {
23
23
  success: boolean;
24
24
  id: string;
@@ -39,7 +39,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
39
39
  success: boolean;
40
40
  id: string;
41
41
  output: string;
42
- status: "running" | "stopped" | "unknown";
42
+ status: "unknown" | "running" | "stopped";
43
43
  message: string;
44
44
  error?: undefined;
45
45
  exitCode?: undefined;
@@ -47,7 +47,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
47
47
  success: boolean;
48
48
  id: string;
49
49
  output: string;
50
- status: "running" | "stopped" | "unknown";
50
+ status: "unknown" | "running" | "stopped";
51
51
  message?: undefined;
52
52
  error?: undefined;
53
53
  exitCode?: undefined;
@@ -64,7 +64,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
64
64
  id: string;
65
65
  output: string;
66
66
  exitCode: number;
67
- status: "error" | "completed" | "running" | "stopped";
67
+ status: "completed" | "error" | "running" | "stopped";
68
68
  message?: undefined;
69
69
  error?: undefined;
70
70
  } | {
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ import { Hono as Hono5 } from "hono";
18
18
  import { serve } from "@hono/node-server";
19
19
  import { cors } from "hono/cors";
20
20
  import { logger } from "hono/logger";
21
- import { existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
21
+ import { existsSync as existsSync7, mkdirSync as mkdirSync3 } from "fs";
22
22
  import { resolve as resolve6, dirname as dirname4, join as join3 } from "path";
23
23
  import { spawn } from "child_process";
24
24
  import { createServer as createNetServer } from "net";
@@ -1013,12 +1013,12 @@ function calculateContextSize(messages2) {
1013
1013
  import { exec } from "child_process";
1014
1014
  import { promisify } from "util";
1015
1015
  import { mkdir, writeFile, readFile } from "fs/promises";
1016
- import { existsSync as existsSync2 } from "fs";
1016
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
1017
1017
  import { join as join2 } from "path";
1018
1018
  import { nanoid as nanoid2 } from "nanoid";
1019
1019
  var execAsync = promisify(exec);
1020
1020
  var SESSION_PREFIX = "spark_";
1021
- var LOG_BASE_DIR = ".sparkecoder/sessions";
1021
+ var LOG_BASE_DIR = "sessions";
1022
1022
  var tmuxAvailableCache = null;
1023
1023
  async function isTmuxAvailable() {
1024
1024
  if (tmuxAvailableCache !== null) {
@@ -1040,11 +1040,19 @@ function generateTerminalId() {
1040
1040
  function getSessionName(terminalId) {
1041
1041
  return `${SESSION_PREFIX}${terminalId}`;
1042
1042
  }
1043
- function getLogDir(terminalId, workingDirectory, sessionId) {
1043
+ function getTerminalDataDir() {
1044
+ const appDataDir = getAppDataDirectory();
1045
+ if (!existsSync2(appDataDir)) {
1046
+ mkdirSync2(appDataDir, { recursive: true });
1047
+ }
1048
+ return appDataDir;
1049
+ }
1050
+ function getLogDir(terminalId, _workingDirectory, sessionId) {
1051
+ const baseDir = getTerminalDataDir();
1044
1052
  if (sessionId) {
1045
- return join2(workingDirectory, LOG_BASE_DIR, sessionId, "terminals", terminalId);
1053
+ return join2(baseDir, LOG_BASE_DIR, sessionId, "terminals", terminalId);
1046
1054
  }
1047
- return join2(workingDirectory, ".sparkecoder/terminals", terminalId);
1055
+ return join2(baseDir, "terminals", terminalId);
1048
1056
  }
1049
1057
  function shellEscape(str) {
1050
1058
  return `'${str.replace(/'/g, "'\\''")}'`;
@@ -1408,7 +1416,7 @@ bash({ id: "abc123", input: "my text" }) // send text input
1408
1416
  - For npm: add --yes or -y to skip confirmation
1409
1417
  - If prompts are unavoidable, run in background mode and use input/key to respond
1410
1418
 
1411
- Logs are saved to .sparkecoder/terminals/{id}/output.log`,
1419
+ Terminal output is stored in the global SparkECoder data directory. Use the \`tail\` option to read recent output.`,
1412
1420
  inputSchema: bashInputSchema,
1413
1421
  execute: async (inputArgs) => {
1414
1422
  const { command, background, id, kill, tail, input: textInput, key } = inputArgs;
@@ -2396,7 +2404,7 @@ bash({ id: "abc123", input: "my text" }) // send text input
2396
2404
  - Use \`key: "y"\` or \`key: "n"\` for yes/no prompts
2397
2405
  - Use \`input: "text"\` for text input prompts
2398
2406
 
2399
- Logs are saved to \`.sparkecoder/terminals/{id}/output.log\` and can be read with \`read_file\` if needed.
2407
+ Terminal output is stored in the global SparkECoder data directory. Use the \`tail\` option to read recent output.
2400
2408
 
2401
2409
  ## Guidelines
2402
2410
 
@@ -4671,7 +4679,7 @@ async function startServer(options = {}) {
4671
4679
  config.resolvedWorkingDirectory = options.workingDirectory;
4672
4680
  }
4673
4681
  if (!existsSync7(config.resolvedWorkingDirectory)) {
4674
- mkdirSync2(config.resolvedWorkingDirectory, { recursive: true });
4682
+ mkdirSync3(config.resolvedWorkingDirectory, { recursive: true });
4675
4683
  if (!options.quiet) console.log(`\u{1F4C1} Created agent workspace: ${config.resolvedWorkingDirectory}`);
4676
4684
  }
4677
4685
  initDatabase(config.resolvedDatabasePath);
@@ -5462,8 +5470,12 @@ async function runChat(options) {
5462
5470
  const data = await response.json();
5463
5471
  sessionId = data.id;
5464
5472
  }
5473
+ const sessionInfo = await apiRequest(baseUrl, `/sessions/${sessionId}`);
5474
+ const sessionData = sessionInfo.ok ? await sessionInfo.json() : null;
5475
+ const workingDir = sessionData?.workingDirectory || process.cwd();
5465
5476
  console.log("");
5466
5477
  console.log(chalk.bold.cyan("\u{1F436} SparkECoder"));
5478
+ console.log(chalk.dim(`Working directory: ${workingDir}`));
5467
5479
  console.log(chalk.dim("Commands: /quit, /clear, /session, /tools, /help"));
5468
5480
  console.log("");
5469
5481
  const prompt = () => {