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.
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +26 -7
- package/dist/agent/index.js.map +1 -1
- package/dist/{bash-CGAqW7HR.d.ts → bash-C43A-o5X.d.ts} +4 -4
- package/dist/cli.js +21 -9
- package/dist/cli.js.map +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/{index-BeKylVnB.d.ts → index-DuWb8kNN.d.ts} +6 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/{schema-CkrIadxa.d.ts → schema-J6qYlHtl.d.ts} +3 -3
- package/dist/server/index.js +17 -9
- package/dist/server/index.js.map +1 -1
- package/dist/tools/index.d.ts +3 -3
- package/dist/tools/index.js +152 -118
- package/dist/tools/index.js.map +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/cache/.previewinfo +1 -1
- package/web/.next/cache/.rscinfo +1 -1
- package/web/.next/cache/.tsbuildinfo +1 -1
- package/web/.next/cache/config.json +3 -3
- package/web/.next/dev/cache/.rscinfo +1 -1
- package/web/.next/dev/cache/config.json +3 -3
- package/web/.next/dev/cache/turbopack/731ace46/00000001.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000002.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000004.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000005.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000007.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000008.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000010.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000011.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000012.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000014.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000015.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000017.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000018.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000019.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000020.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000021.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000022.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000023.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/{00000040.meta → 00000025.meta} +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000026.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000027.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000028.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000029.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000030.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/{00000045.meta → 00000031.meta} +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/{00000029.meta → 00000032.meta} +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000033.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000034.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000035.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000036.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000037.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000038.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000039.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000040.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000041.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000042.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/{00000039.meta → 00000043.meta} +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000044.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000045.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/{00000042.sst → 00000046.sst} +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000047.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000048.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000049.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000050.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000051.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000052.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000053.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000054.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000055.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000056.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/CURRENT +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/LOG +44 -30
- package/web/.next/dev/prerender-manifest.json +3 -3
- package/web/.next/dev/server/server-reference-manifest.js +1 -1
- package/web/.next/dev/server/server-reference-manifest.json +1 -1
- package/web/.next/dev/trace +1 -1
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/server/app/(main)/session/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/index.html +1 -1
- package/web/.next/server/app/index.rsc +1 -1
- package/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/chunks/ssr/{2374f__pnpm_d7f11ceb._.js → 2374f__pnpm_2c066fc4._.js} +1 -1
- package/web/.next/server/chunks/ssr/{2374f__pnpm_e04ff5e3._.js → 2374f__pnpm_6c21de20._.js} +1 -1
- package/web/.next/server/chunks/ssr/{2374f__pnpm_f4abb025._.js → 2374f__pnpm_7261fee6._.js} +1 -1
- package/web/.next/server/chunks/ssr/{2374f__pnpm_c03e1359._.js → 2374f__pnpm_86153ae0._.js} +1 -1
- package/web/.next/server/chunks/ssr/{2374f__pnpm_eb87394d._.js → 2374f__pnpm_b316ce7b._.js} +2 -2
- package/web/.next/server/chunks/ssr/{2374f__pnpm_aa2ce93b._.js → 2374f__pnpm_e9578f61._.js} +1 -1
- package/web/.next/server/chunks/ssr/{2374f__pnpm_c7feb274._.js → 2374f__pnpm_ef13102d._.js} +1 -1
- package/web/.next/server/chunks/ssr/{2374f__pnpm_2f0d7c45._.js → 2374f__pnpm_f79c2825._.js} +1 -1
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__2dfcd951._.js → [root-of-the-server]__02cdbf0f._.js} +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__02cdbf0f._.js.map +1 -0
- package/web/.next/server/pages/404.html +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/static/chunks/{bf853305cd7a9765.js → cffe148e9b82e836.js} +3 -3
- package/web/.next/trace +1 -1
- package/web/.next/trace-build +1 -1
- package/web/.next/dev/cache/turbopack/731ace46/00000024.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000025.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000028.meta +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000031.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000032.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000043.sst +0 -0
- package/web/.next/dev/cache/turbopack/731ace46/00000046.meta +0 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2dfcd951._.js.map +0 -1
- /package/web/.next/dev/cache/turbopack/731ace46/{00000027.meta → 00000024.meta} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_d7f11ceb._.js.map → 2374f__pnpm_2c066fc4._.js.map} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_e04ff5e3._.js.map → 2374f__pnpm_6c21de20._.js.map} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_f4abb025._.js.map → 2374f__pnpm_7261fee6._.js.map} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_c03e1359._.js.map → 2374f__pnpm_86153ae0._.js.map} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_eb87394d._.js.map → 2374f__pnpm_b316ce7b._.js.map} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_aa2ce93b._.js.map → 2374f__pnpm_e9578f61._.js.map} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_c7feb274._.js.map → 2374f__pnpm_ef13102d._.js.map} +0 -0
- /package/web/.next/server/chunks/ssr/{2374f__pnpm_2f0d7c45._.js.map → 2374f__pnpm_f79c2825._.js.map} +0 -0
- /package/web/.next/static/{O9K30qQQXDEvnesMUBQxo → YnBzwu6wdLNKy3zBf7w5K}/_buildManifest.js +0 -0
- /package/web/.next/static/{O9K30qQQXDEvnesMUBQxo → YnBzwu6wdLNKy3zBf7w5K}/_clientMiddlewareManifest.json +0 -0
- /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?: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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 = "
|
|
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
|
|
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(
|
|
1053
|
+
return join2(baseDir, LOG_BASE_DIR, sessionId, "terminals", terminalId);
|
|
1046
1054
|
}
|
|
1047
|
-
return join2(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 = () => {
|