sparkecoder 0.1.135 → 0.1.137
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/cli.js +92 -56
- package/dist/cli.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/{index-UtOo3D9f.d.ts → index-BM99kjgq.d.ts} +51 -51
- package/dist/index.d.ts +5 -5
- package/dist/index.js +67 -31
- package/dist/index.js.map +1 -1
- package/dist/{schema-BTrvqaJL.d.ts → schema-Dz-wABVY.d.ts} +3 -3
- package/dist/{search-BRnGaIl-.d.ts → search-CVVfuBPZ.d.ts} +4 -4
- package/dist/server/index.js +67 -31
- package/dist/server/index.js.map +1 -1
- package/dist/tools/index.d.ts +3 -3
- 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/app-path-routes-manifest.json +1 -0
- 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/routes-manifest.json +6 -0
- package/web/.next/standalone/web/.next/server/app/(main)/agents/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/app/(main)/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/app/(main)/settings/page_client-reference-manifest.js +1 -1
- 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/page_client-reference-manifest.js +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 +2 -2
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- 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 +2 -2
- package/web/.next/standalone/web/.next/server/app/agents.html +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_full.segment.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/agents.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_index.segment.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/agents.segments/_tree.segment.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/api/config/route.js.nft.json +1 -1
- package/web/.next/standalone/web/.next/server/app/api/diag/route/app-paths-manifest.json +3 -0
- package/web/.next/standalone/web/.next/server/app/api/diag/route/build-manifest.json +11 -0
- package/web/.next/standalone/web/.next/server/app/api/diag/route/server-reference-manifest.json +4 -0
- package/web/.next/standalone/web/.next/server/app/api/diag/route.js +7 -0
- package/web/.next/standalone/web/.next/server/app/api/diag/route.js.map +5 -0
- package/web/.next/standalone/web/.next/server/app/api/diag/route.js.nft.json +1 -0
- package/web/.next/standalone/web/.next/server/app/api/diag/route_client-reference-manifest.js +2 -0
- package/web/.next/standalone/web/.next/server/app/api/health/route.js.nft.json +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation/page_client-reference-manifest.js +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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +2 -2
- 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/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills/page_client-reference-manifest.js +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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +2 -2
- 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/page_client-reference-manifest.js +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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +2 -2
- 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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/settings.html +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_full.segment.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/web/.next/standalone/web/.next/server/app/sfapi/[...path]/route.js.nft.json +1 -1
- package/web/.next/standalone/web/.next/server/app-paths-manifest.json +1 -0
- package/web/.next/standalone/web/.next/server/chunks/[root-of-the-server]__5b38d1a5._.js +3 -0
- package/web/.next/standalone/web/.next/server/chunks/[root-of-the-server]__78517719._.js +1 -1
- package/web/.next/standalone/web/.next/server/chunks/[root-of-the-server]__9d50fe63._.js +1 -1
- package/web/.next/standalone/web/.next/server/chunks/[root-of-the-server]__ce44139a._.js +1 -1
- package/web/.next/standalone/web/.next/server/chunks/web__next-internal_server_app_api_diag_route_actions_3a4a3b84.js +3 -0
- 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/.next/static/chunks/ca84b9a1165bcda5.css +1 -0
- package/web/.next/standalone/web/.next/static/static/chunks/ca84b9a1165bcda5.css +1 -0
- package/web/.next/standalone/web/runtime-config.json +4 -1
- package/web/.next/standalone/web/src/app/api/config/route.ts +4 -1
- package/web/.next/standalone/web/src/app/api/diag/route.ts +134 -0
- package/web/.next/standalone/web/src/app/api/health/route.ts +12 -4
- package/web/.next/standalone/web/src/lib/local-api.ts +18 -6
- package/web/.next/static/chunks/ca84b9a1165bcda5.css +1 -0
- package/web/.next/standalone/web/.next/static/chunks/acb0fc66f5414af6.css +0 -1
- package/web/.next/standalone/web/.next/static/static/chunks/acb0fc66f5414af6.css +0 -1
- package/web/.next/static/chunks/acb0fc66f5414af6.css +0 -1
- /package/web/.next/standalone/web/.next/static/{X_TnGNSMsK4hjzA1W-_Gz → static/wvsSqSLuE0FvQYeAvnmPm}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{X_TnGNSMsK4hjzA1W-_Gz → static/wvsSqSLuE0FvQYeAvnmPm}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{X_TnGNSMsK4hjzA1W-_Gz → static/wvsSqSLuE0FvQYeAvnmPm}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{static/X_TnGNSMsK4hjzA1W-_Gz → wvsSqSLuE0FvQYeAvnmPm}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{static/X_TnGNSMsK4hjzA1W-_Gz → wvsSqSLuE0FvQYeAvnmPm}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{static/X_TnGNSMsK4hjzA1W-_Gz → wvsSqSLuE0FvQYeAvnmPm}/_ssgManifest.js +0 -0
- /package/web/.next/static/{X_TnGNSMsK4hjzA1W-_Gz → wvsSqSLuE0FvQYeAvnmPm}/_buildManifest.js +0 -0
- /package/web/.next/static/{X_TnGNSMsK4hjzA1W-_Gz → wvsSqSLuE0FvQYeAvnmPm}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{X_TnGNSMsK4hjzA1W-_Gz → wvsSqSLuE0FvQYeAvnmPm}/_ssgManifest.js +0 -0
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'ai';
|
|
2
|
-
import '../schema-
|
|
3
|
-
export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, M as MessageAttachment, d as buildSystemPrompt, e as buildTaskPromptAddendum } from '../index-
|
|
4
|
-
import '../search-
|
|
2
|
+
import '../schema-Dz-wABVY.js';
|
|
3
|
+
export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, M as MessageAttachment, d as buildSystemPrompt, e as buildTaskPromptAddendum } from '../index-BM99kjgq.js';
|
|
4
|
+
import '../search-CVVfuBPZ.js';
|
|
5
5
|
import 'drizzle-orm/sqlite-core';
|
|
6
6
|
import 'zod';
|
package/dist/cli.js
CHANGED
|
@@ -5497,7 +5497,7 @@ function isPathExcluded(relativePath, exclude) {
|
|
|
5497
5497
|
}
|
|
5498
5498
|
async function walkDirectory(dir, include, exclude, baseDir) {
|
|
5499
5499
|
const { readdirSync: readdirSync4 } = await import("fs");
|
|
5500
|
-
const { join:
|
|
5500
|
+
const { join: join22, relative: relative10 } = await import("path");
|
|
5501
5501
|
const files = [];
|
|
5502
5502
|
function walk(currentDir) {
|
|
5503
5503
|
let entries;
|
|
@@ -5507,7 +5507,7 @@ async function walkDirectory(dir, include, exclude, baseDir) {
|
|
|
5507
5507
|
return;
|
|
5508
5508
|
}
|
|
5509
5509
|
for (const entry2 of entries) {
|
|
5510
|
-
const fullPath =
|
|
5510
|
+
const fullPath = join22(currentDir, entry2.name);
|
|
5511
5511
|
const relativePath = relative10(baseDir, fullPath);
|
|
5512
5512
|
if (isPathExcluded(relativePath, exclude)) {
|
|
5513
5513
|
continue;
|
|
@@ -12427,11 +12427,11 @@ ${p.text}` : p.text;
|
|
|
12427
12427
|
const { isRemoteConfigured: isRemoteConfigured2, storageQueries: storageQueries2 } = await Promise.resolve().then(() => (init_remote(), remote_exports));
|
|
12428
12428
|
if (!isRemoteConfigured2()) return [];
|
|
12429
12429
|
const { readFile: readFile13 } = await import("fs/promises");
|
|
12430
|
-
const { join:
|
|
12430
|
+
const { join: join22, basename: basename7 } = await import("path");
|
|
12431
12431
|
const urls = [];
|
|
12432
12432
|
for (const filePath of filePaths) {
|
|
12433
12433
|
try {
|
|
12434
|
-
const fullPath = filePath.startsWith("/") ? filePath :
|
|
12434
|
+
const fullPath = filePath.startsWith("/") ? filePath : join22(this.session.workingDirectory, filePath);
|
|
12435
12435
|
const fileName = basename7(fullPath);
|
|
12436
12436
|
const ext = fileName.split(".").pop()?.toLowerCase() || "";
|
|
12437
12437
|
const mimeMap = {
|
|
@@ -12810,19 +12810,19 @@ __export(self_update_exports, {
|
|
|
12810
12810
|
stopSelfUpdater: () => stopSelfUpdater
|
|
12811
12811
|
});
|
|
12812
12812
|
import { spawn as spawn2, execFile } from "child_process";
|
|
12813
|
-
import { readFileSync as
|
|
12814
|
-
import { dirname as
|
|
12815
|
-
import { fileURLToPath as
|
|
12813
|
+
import { readFileSync as readFileSync12, writeFileSync as writeFileSync7, mkdirSync as mkdirSync10 } from "fs";
|
|
12814
|
+
import { dirname as dirname11, join as join19 } from "path";
|
|
12815
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
12816
12816
|
function currentVersion2() {
|
|
12817
|
-
const here =
|
|
12817
|
+
const here = dirname11(fileURLToPath5(import.meta.url));
|
|
12818
12818
|
const candidates = [
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12819
|
+
join19(here, "..", "..", "package.json"),
|
|
12820
|
+
join19(here, "..", "package.json"),
|
|
12821
|
+
join19(process.cwd(), "package.json")
|
|
12822
12822
|
];
|
|
12823
12823
|
for (const p of candidates) {
|
|
12824
12824
|
try {
|
|
12825
|
-
const pkg = JSON.parse(
|
|
12825
|
+
const pkg = JSON.parse(readFileSync12(p, "utf8"));
|
|
12826
12826
|
if (pkg.name === "sparkecoder" && pkg.version) return pkg.version;
|
|
12827
12827
|
} catch {
|
|
12828
12828
|
}
|
|
@@ -12830,7 +12830,7 @@ function currentVersion2() {
|
|
|
12830
12830
|
return "0.0.0";
|
|
12831
12831
|
}
|
|
12832
12832
|
function isLikelyGlobalInstall() {
|
|
12833
|
-
const here =
|
|
12833
|
+
const here = dirname11(fileURLToPath5(import.meta.url));
|
|
12834
12834
|
return here.includes("/node_modules/sparkecoder/") || here.includes("\\node_modules\\sparkecoder\\");
|
|
12835
12835
|
}
|
|
12836
12836
|
function isEnabled() {
|
|
@@ -12873,7 +12873,7 @@ function semverGt(a, b) {
|
|
|
12873
12873
|
}
|
|
12874
12874
|
function statePath() {
|
|
12875
12875
|
try {
|
|
12876
|
-
return
|
|
12876
|
+
return join19(getAppDataDirectory(), "self-update-state.json");
|
|
12877
12877
|
} catch {
|
|
12878
12878
|
return null;
|
|
12879
12879
|
}
|
|
@@ -12882,7 +12882,7 @@ function readState() {
|
|
|
12882
12882
|
const p = statePath();
|
|
12883
12883
|
if (!p) return {};
|
|
12884
12884
|
try {
|
|
12885
|
-
return JSON.parse(
|
|
12885
|
+
return JSON.parse(readFileSync12(p, "utf8"));
|
|
12886
12886
|
} catch {
|
|
12887
12887
|
return {};
|
|
12888
12888
|
}
|
|
@@ -12891,7 +12891,7 @@ function writeState(s) {
|
|
|
12891
12891
|
const p = statePath();
|
|
12892
12892
|
if (!p) return;
|
|
12893
12893
|
try {
|
|
12894
|
-
mkdirSync10(
|
|
12894
|
+
mkdirSync10(dirname11(p), { recursive: true });
|
|
12895
12895
|
writeFileSync7(p, JSON.stringify(s));
|
|
12896
12896
|
} catch {
|
|
12897
12897
|
}
|
|
@@ -13331,8 +13331,8 @@ import chalk from "chalk";
|
|
|
13331
13331
|
import ora from "ora";
|
|
13332
13332
|
import "dotenv/config";
|
|
13333
13333
|
import { createInterface } from "readline";
|
|
13334
|
-
import { dirname as
|
|
13335
|
-
import { fileURLToPath as
|
|
13334
|
+
import { dirname as dirname13 } from "path";
|
|
13335
|
+
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
13336
13336
|
|
|
13337
13337
|
// src/server/index.ts
|
|
13338
13338
|
import "dotenv/config";
|
|
@@ -13341,10 +13341,10 @@ import { serve } from "@hono/node-server";
|
|
|
13341
13341
|
import { cors } from "hono/cors";
|
|
13342
13342
|
import { logger } from "hono/logger";
|
|
13343
13343
|
import { existsSync as existsSync22, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
13344
|
-
import { resolve as resolve12, dirname as
|
|
13344
|
+
import { resolve as resolve12, dirname as dirname12, join as join20 } from "path";
|
|
13345
13345
|
import { spawn as spawn3 } from "child_process";
|
|
13346
13346
|
import { createServer as createNetServer } from "net";
|
|
13347
|
-
import { fileURLToPath as
|
|
13347
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
13348
13348
|
|
|
13349
13349
|
// src/server/routes/sessions.ts
|
|
13350
13350
|
init_db();
|
|
@@ -17641,6 +17641,36 @@ function cfAccessMiddleware() {
|
|
|
17641
17641
|
// src/server/index.ts
|
|
17642
17642
|
init_tmux();
|
|
17643
17643
|
init_config();
|
|
17644
|
+
|
|
17645
|
+
// src/version.ts
|
|
17646
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
17647
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
17648
|
+
import { dirname as dirname10, join as join18 } from "path";
|
|
17649
|
+
function resolveVersion() {
|
|
17650
|
+
let here;
|
|
17651
|
+
try {
|
|
17652
|
+
here = dirname10(fileURLToPath4(import.meta.url));
|
|
17653
|
+
} catch {
|
|
17654
|
+
here = process.cwd();
|
|
17655
|
+
}
|
|
17656
|
+
const candidates = [
|
|
17657
|
+
join18(here, "../package.json"),
|
|
17658
|
+
join18(here, "../../package.json"),
|
|
17659
|
+
join18(here, "../../../package.json"),
|
|
17660
|
+
join18(process.cwd(), "package.json")
|
|
17661
|
+
];
|
|
17662
|
+
for (const p of candidates) {
|
|
17663
|
+
try {
|
|
17664
|
+
const pkg = JSON.parse(readFileSync11(p, "utf-8"));
|
|
17665
|
+
if (pkg.name === "sparkecoder") return pkg.version || "0.0.0";
|
|
17666
|
+
} catch {
|
|
17667
|
+
}
|
|
17668
|
+
}
|
|
17669
|
+
return "0.0.0";
|
|
17670
|
+
}
|
|
17671
|
+
var SPARKECODER_VERSION = resolveVersion();
|
|
17672
|
+
|
|
17673
|
+
// src/server/index.ts
|
|
17644
17674
|
init_db();
|
|
17645
17675
|
|
|
17646
17676
|
// src/utils/dependencies.ts
|
|
@@ -17823,13 +17853,13 @@ var DEFAULT_WEB_PORT = 6969;
|
|
|
17823
17853
|
var WEB_PORT_SEQUENCE = [6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978];
|
|
17824
17854
|
function getWebDirectory() {
|
|
17825
17855
|
try {
|
|
17826
|
-
const currentDir =
|
|
17856
|
+
const currentDir = dirname12(fileURLToPath6(import.meta.url));
|
|
17827
17857
|
const webDir = resolve12(currentDir, "..", "web");
|
|
17828
|
-
if (existsSync22(webDir) && existsSync22(
|
|
17858
|
+
if (existsSync22(webDir) && existsSync22(join20(webDir, "package.json"))) {
|
|
17829
17859
|
return webDir;
|
|
17830
17860
|
}
|
|
17831
17861
|
const altWebDir = resolve12(currentDir, "..", "..", "web");
|
|
17832
|
-
if (existsSync22(altWebDir) && existsSync22(
|
|
17862
|
+
if (existsSync22(altWebDir) && existsSync22(join20(altWebDir, "package.json"))) {
|
|
17833
17863
|
return altWebDir;
|
|
17834
17864
|
}
|
|
17835
17865
|
return null;
|
|
@@ -17887,20 +17917,20 @@ async function findWebPort(preferredPort) {
|
|
|
17887
17917
|
return { port: preferredPort, alreadyRunning: false };
|
|
17888
17918
|
}
|
|
17889
17919
|
function hasProductionBuild(webDir) {
|
|
17890
|
-
const buildIdPath =
|
|
17920
|
+
const buildIdPath = join20(webDir, ".next", "BUILD_ID");
|
|
17891
17921
|
return existsSync22(buildIdPath);
|
|
17892
17922
|
}
|
|
17893
17923
|
function hasSourceFiles(webDir) {
|
|
17894
|
-
const appDir =
|
|
17895
|
-
const pagesDir =
|
|
17896
|
-
const rootAppDir =
|
|
17897
|
-
const rootPagesDir =
|
|
17924
|
+
const appDir = join20(webDir, "src", "app");
|
|
17925
|
+
const pagesDir = join20(webDir, "src", "pages");
|
|
17926
|
+
const rootAppDir = join20(webDir, "app");
|
|
17927
|
+
const rootPagesDir = join20(webDir, "pages");
|
|
17898
17928
|
return existsSync22(appDir) || existsSync22(pagesDir) || existsSync22(rootAppDir) || existsSync22(rootPagesDir);
|
|
17899
17929
|
}
|
|
17900
17930
|
function getStandaloneServerPath(webDir) {
|
|
17901
17931
|
const possiblePaths2 = [
|
|
17902
|
-
|
|
17903
|
-
|
|
17932
|
+
join20(webDir, ".next", "standalone", "server.js"),
|
|
17933
|
+
join20(webDir, ".next", "standalone", "web", "server.js")
|
|
17904
17934
|
];
|
|
17905
17935
|
for (const serverPath of possiblePaths2) {
|
|
17906
17936
|
if (existsSync22(serverPath)) {
|
|
@@ -17943,13 +17973,19 @@ async function startWebUI(apiPort, webPort = DEFAULT_WEB_PORT, quiet = false, pu
|
|
|
17943
17973
|
if (!quiet) console.log(` \u2713 Web UI already running at http://localhost:${actualPort}`);
|
|
17944
17974
|
return { process: null, port: actualPort };
|
|
17945
17975
|
}
|
|
17946
|
-
const usePnpm = existsSync22(
|
|
17947
|
-
const useNpm = !usePnpm && existsSync22(
|
|
17976
|
+
const usePnpm = existsSync22(join20(webDir, "pnpm-lock.yaml"));
|
|
17977
|
+
const useNpm = !usePnpm && existsSync22(join20(webDir, "package-lock.json"));
|
|
17948
17978
|
const pkgManager = usePnpm ? "pnpm" : useNpm ? "npm" : "npx";
|
|
17949
17979
|
const { NODE_OPTIONS, TSX_TSCONFIG_PATH, ...cleanEnv } = process.env;
|
|
17950
17980
|
const apiUrl = publicUrl || `http://127.0.0.1:${apiPort}`;
|
|
17951
|
-
const runtimeConfig = {
|
|
17952
|
-
|
|
17981
|
+
const runtimeConfig = {
|
|
17982
|
+
apiBaseUrl: apiUrl,
|
|
17983
|
+
localApiBaseUrl: `http://127.0.0.1:${apiPort}`,
|
|
17984
|
+
version: SPARKECODER_VERSION,
|
|
17985
|
+
apiPort,
|
|
17986
|
+
writtenAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
17987
|
+
};
|
|
17988
|
+
const runtimeConfigPath = join20(webDir, "runtime-config.json");
|
|
17953
17989
|
try {
|
|
17954
17990
|
writeFileSync8(runtimeConfigPath, JSON.stringify(runtimeConfig, null, 2));
|
|
17955
17991
|
if (!quiet) console.log(` \u{1F4DD} Runtime config written to ${runtimeConfigPath}`);
|
|
@@ -17971,7 +18007,7 @@ async function startWebUI(apiPort, webPort = DEFAULT_WEB_PORT, quiet = false, pu
|
|
|
17971
18007
|
if (standaloneServerPath) {
|
|
17972
18008
|
command = "node";
|
|
17973
18009
|
args = ["server.js"];
|
|
17974
|
-
cwd =
|
|
18010
|
+
cwd = dirname12(standaloneServerPath);
|
|
17975
18011
|
webEnv.PORT = String(actualPort);
|
|
17976
18012
|
webEnv.HOSTNAME = "0.0.0.0";
|
|
17977
18013
|
if (!quiet) console.log(" \u{1F4E6} Starting Web UI from standalone build...");
|
|
@@ -18732,18 +18768,18 @@ function generateOpenAPISpec() {
|
|
|
18732
18768
|
init_config();
|
|
18733
18769
|
init_semantic();
|
|
18734
18770
|
init_db();
|
|
18735
|
-
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync9, readFileSync as
|
|
18736
|
-
import { resolve as resolve13, join as
|
|
18771
|
+
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync9, readFileSync as readFileSync13, existsSync as existsSync23, statSync as statSync4, unlinkSync as unlinkSync3 } from "fs";
|
|
18772
|
+
import { resolve as resolve13, join as join21 } from "path";
|
|
18737
18773
|
function getCliVersion() {
|
|
18738
|
-
const here =
|
|
18774
|
+
const here = dirname13(fileURLToPath7(import.meta.url));
|
|
18739
18775
|
const candidates = [
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18776
|
+
join21(here, "..", "package.json"),
|
|
18777
|
+
join21(here, "..", "..", "package.json"),
|
|
18778
|
+
join21(process.cwd(), "package.json")
|
|
18743
18779
|
];
|
|
18744
18780
|
for (const p of candidates) {
|
|
18745
18781
|
try {
|
|
18746
|
-
const pkg = JSON.parse(
|
|
18782
|
+
const pkg = JSON.parse(readFileSync13(p, "utf8"));
|
|
18747
18783
|
if (pkg.name === "sparkecoder" && pkg.version) return pkg.version;
|
|
18748
18784
|
} catch {
|
|
18749
18785
|
}
|
|
@@ -19391,7 +19427,7 @@ program.command("task").description("Run an autonomous task that completes witho
|
|
|
19391
19427
|
try {
|
|
19392
19428
|
const schemaStr = options.schema;
|
|
19393
19429
|
if (existsSync23(schemaStr)) {
|
|
19394
|
-
outputSchema = JSON.parse(
|
|
19430
|
+
outputSchema = JSON.parse(readFileSync13(schemaStr, "utf-8"));
|
|
19395
19431
|
} else {
|
|
19396
19432
|
outputSchema = JSON.parse(schemaStr);
|
|
19397
19433
|
}
|
|
@@ -19411,7 +19447,7 @@ program.command("task").description("Run an autonomous task that completes witho
|
|
|
19411
19447
|
if (options.name) body.name = options.name;
|
|
19412
19448
|
if (options.parentTask) body.parentTaskId = options.parentTask;
|
|
19413
19449
|
const parseJsonArrayOption = (raw, label) => {
|
|
19414
|
-
const text = existsSync23(raw) ?
|
|
19450
|
+
const text = existsSync23(raw) ? readFileSync13(raw, "utf-8") : raw;
|
|
19415
19451
|
const parsed = JSON.parse(text);
|
|
19416
19452
|
if (!Array.isArray(parsed)) {
|
|
19417
19453
|
throw new Error(`${label} must be a JSON array`);
|
|
@@ -19482,7 +19518,7 @@ program.command("init").description("Create a sparkecoder.config.json file").opt
|
|
|
19482
19518
|
let configLocation;
|
|
19483
19519
|
if (options.global) {
|
|
19484
19520
|
const appDataDir = ensureAppDataDirectory();
|
|
19485
|
-
configPath =
|
|
19521
|
+
configPath = join21(appDataDir, "sparkecoder.config.json");
|
|
19486
19522
|
configLocation = "global";
|
|
19487
19523
|
} else {
|
|
19488
19524
|
configPath = resolve13(process.cwd(), "sparkecoder.config.json");
|
|
@@ -19513,11 +19549,11 @@ program.command("slack-setup").description("Interactively configure Slack integr
|
|
|
19513
19549
|
console.error(chalk.red("Both bot token and signing secret are required."));
|
|
19514
19550
|
process.exit(1);
|
|
19515
19551
|
}
|
|
19516
|
-
const configPath = options.global ?
|
|
19552
|
+
const configPath = options.global ? join21(ensureAppDataDirectory(), "sparkecoder.config.json") : resolve13(process.cwd(), "sparkecoder.config.json");
|
|
19517
19553
|
let existing = {};
|
|
19518
19554
|
if (existsSync23(configPath)) {
|
|
19519
19555
|
try {
|
|
19520
|
-
existing = JSON.parse(
|
|
19556
|
+
existing = JSON.parse(readFileSync13(configPath, "utf-8"));
|
|
19521
19557
|
} catch {
|
|
19522
19558
|
}
|
|
19523
19559
|
} else {
|
|
@@ -19795,8 +19831,8 @@ program.command("cloudflared-setup").description("Auto-detect cloudflared + set
|
|
|
19795
19831
|
}
|
|
19796
19832
|
const verOut = run("cloudflared", ["--version"]).stdout?.toString().split("\n")[0] || "installed";
|
|
19797
19833
|
console.log(chalk.green("\u2713"), "cloudflared:", chalk.dim(verOut));
|
|
19798
|
-
const cfDir =
|
|
19799
|
-
const certPath =
|
|
19834
|
+
const cfDir = join21(homedir2(), ".cloudflared");
|
|
19835
|
+
const certPath = join21(cfDir, "cert.pem");
|
|
19800
19836
|
if (!existsSync23(certPath)) {
|
|
19801
19837
|
console.log(chalk.yellow("No Cloudflare login cert found."));
|
|
19802
19838
|
if (await confirm("Run `cloudflared tunnel login` now (opens a browser)?", true)) {
|
|
@@ -19841,7 +19877,7 @@ program.command("cloudflared-setup").description("Auto-detect cloudflared + set
|
|
|
19841
19877
|
return;
|
|
19842
19878
|
}
|
|
19843
19879
|
}
|
|
19844
|
-
const credsFile = tunnel.credentials_file ||
|
|
19880
|
+
const credsFile = tunnel.credentials_file || join21(cfDir, `${tunnel.id}.json`);
|
|
19845
19881
|
if (!existsSync23(credsFile)) {
|
|
19846
19882
|
console.log(chalk.yellow(`Credentials file not found at ${credsFile}. The tunnel may still work via cert.pem.`));
|
|
19847
19883
|
}
|
|
@@ -19865,7 +19901,7 @@ program.command("cloudflared-setup").description("Auto-detect cloudflared + set
|
|
|
19865
19901
|
console.log(chalk.yellow("DNS route warning:"), err.trim().split("\n").slice(-2).join(" "));
|
|
19866
19902
|
}
|
|
19867
19903
|
}
|
|
19868
|
-
const configPath =
|
|
19904
|
+
const configPath = join21(cfDir, "config.yml");
|
|
19869
19905
|
const configBody = `tunnel: ${tunnel.id}
|
|
19870
19906
|
credentials-file: ${credsFile}
|
|
19871
19907
|
ingress:
|
|
@@ -19877,7 +19913,7 @@ ingress:
|
|
|
19877
19913
|
`;
|
|
19878
19914
|
let wroteConfig = false;
|
|
19879
19915
|
if (existsSync23(configPath)) {
|
|
19880
|
-
const existing =
|
|
19916
|
+
const existing = readFileSync13(configPath, "utf8");
|
|
19881
19917
|
if (existing.trim() === configBody.trim()) {
|
|
19882
19918
|
console.log(chalk.green("\u2713"), `config.yml already up to date: ${configPath}`);
|
|
19883
19919
|
wroteConfig = true;
|
|
@@ -20383,12 +20419,12 @@ program.command("request-permissions").description("Open System Settings to the
|
|
|
20383
20419
|
let shellEscape2 = function(str) {
|
|
20384
20420
|
return `'${str.replace(/'/g, "'\\''")}'`;
|
|
20385
20421
|
}, stateFilePath = function() {
|
|
20386
|
-
return
|
|
20422
|
+
return join21(ensureAppDataDirectory(), "recordings.json");
|
|
20387
20423
|
}, readState2 = function() {
|
|
20388
20424
|
const p = stateFilePath();
|
|
20389
20425
|
if (!existsSync23(p)) return [];
|
|
20390
20426
|
try {
|
|
20391
|
-
return JSON.parse(
|
|
20427
|
+
return JSON.parse(readFileSync13(p, "utf-8"));
|
|
20392
20428
|
} catch {
|
|
20393
20429
|
return [];
|
|
20394
20430
|
}
|
|
@@ -20466,12 +20502,12 @@ program.command("request-permissions").description("Open System Settings to the
|
|
|
20466
20502
|
const record = program.command("record").description("Start/stop screen recordings");
|
|
20467
20503
|
record.command("start").description("Start a screen recording (returns id, path, pid as JSON)").option("--name <slug>", "Optional human-readable label for the recording").option("--dir <path>", "Output directory (default: ~/recordings)").action(async (opts) => {
|
|
20468
20504
|
const { homedir: homedir2, platform: osPlatform } = await import("os");
|
|
20469
|
-
const outDir = opts.dir ? resolve13(opts.dir.replace(/^~/, homedir2())) :
|
|
20505
|
+
const outDir = opts.dir ? resolve13(opts.dir.replace(/^~/, homedir2())) : join21(homedir2(), "recordings");
|
|
20470
20506
|
mkdirSync12(outDir, { recursive: true });
|
|
20471
20507
|
const id = `rec-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
20472
20508
|
const ext = "mp4";
|
|
20473
20509
|
const filename = `${id}${opts.name ? `-${String(opts.name).replace(/[^a-z0-9-]+/gi, "-").toLowerCase()}` : ""}.${ext}`;
|
|
20474
|
-
const path =
|
|
20510
|
+
const path = join21(outDir, filename);
|
|
20475
20511
|
let cmd;
|
|
20476
20512
|
let args;
|
|
20477
20513
|
let capturePath;
|