sparkecoder 0.1.136 → 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 +8 -3
- 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/{BS3vhcmrlRmT39qDuhaJP → static/wvsSqSLuE0FvQYeAvnmPm}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{BS3vhcmrlRmT39qDuhaJP → static/wvsSqSLuE0FvQYeAvnmPm}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{BS3vhcmrlRmT39qDuhaJP → static/wvsSqSLuE0FvQYeAvnmPm}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{static/BS3vhcmrlRmT39qDuhaJP → wvsSqSLuE0FvQYeAvnmPm}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{static/BS3vhcmrlRmT39qDuhaJP → wvsSqSLuE0FvQYeAvnmPm}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{static/BS3vhcmrlRmT39qDuhaJP → wvsSqSLuE0FvQYeAvnmPm}/_ssgManifest.js +0 -0
- /package/web/.next/static/{BS3vhcmrlRmT39qDuhaJP → wvsSqSLuE0FvQYeAvnmPm}/_buildManifest.js +0 -0
- /package/web/.next/static/{BS3vhcmrlRmT39qDuhaJP → wvsSqSLuE0FvQYeAvnmPm}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{BS3vhcmrlRmT39qDuhaJP → wvsSqSLuE0FvQYeAvnmPm}/_ssgManifest.js +0 -0
|
@@ -85,7 +85,7 @@ declare const sessions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
85
85
|
tableName: "sessions";
|
|
86
86
|
dataType: "string";
|
|
87
87
|
columnType: "SQLiteText";
|
|
88
|
-
data: "
|
|
88
|
+
data: "completed" | "error" | "active" | "waiting";
|
|
89
89
|
driverParam: string;
|
|
90
90
|
notNull: true;
|
|
91
91
|
hasDefault: true;
|
|
@@ -814,7 +814,7 @@ declare const terminals: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
814
814
|
tableName: "terminals";
|
|
815
815
|
dataType: "string";
|
|
816
816
|
columnType: "SQLiteText";
|
|
817
|
-
data: "
|
|
817
|
+
data: "running" | "error" | "stopped";
|
|
818
818
|
driverParam: string;
|
|
819
819
|
notNull: true;
|
|
820
820
|
hasDefault: true;
|
|
@@ -967,7 +967,7 @@ declare const activeStreams: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
967
967
|
tableName: "active_streams";
|
|
968
968
|
dataType: "string";
|
|
969
969
|
columnType: "SQLiteText";
|
|
970
|
-
data: "
|
|
970
|
+
data: "error" | "active" | "finished";
|
|
971
971
|
driverParam: string;
|
|
972
972
|
notNull: true;
|
|
973
973
|
hasDefault: true;
|
|
@@ -41,7 +41,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
|
|
|
41
41
|
success: boolean;
|
|
42
42
|
id: string;
|
|
43
43
|
output: string;
|
|
44
|
-
status: "
|
|
44
|
+
status: "unknown" | "running" | "stopped";
|
|
45
45
|
message: string;
|
|
46
46
|
error?: undefined;
|
|
47
47
|
exitCode?: undefined;
|
|
@@ -49,7 +49,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
|
|
|
49
49
|
success: boolean;
|
|
50
50
|
id: string;
|
|
51
51
|
output: string;
|
|
52
|
-
status: "
|
|
52
|
+
status: "unknown" | "running" | "stopped";
|
|
53
53
|
message?: undefined;
|
|
54
54
|
error?: undefined;
|
|
55
55
|
exitCode?: undefined;
|
|
@@ -66,7 +66,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
|
|
|
66
66
|
id: string;
|
|
67
67
|
output: string;
|
|
68
68
|
exitCode: number;
|
|
69
|
-
status: "
|
|
69
|
+
status: "running" | "completed" | "error" | "stopped";
|
|
70
70
|
message?: undefined;
|
|
71
71
|
error?: undefined;
|
|
72
72
|
} | {
|
|
@@ -116,8 +116,8 @@ interface WriteFileToolOptions {
|
|
|
116
116
|
onProgress?: (progress: WriteFileProgress) => void;
|
|
117
117
|
}
|
|
118
118
|
declare function createWriteFileTool(options: WriteFileToolOptions): ai.Tool<{
|
|
119
|
-
mode: "full" | "str_replace";
|
|
120
119
|
path: string;
|
|
120
|
+
mode: "full" | "str_replace";
|
|
121
121
|
content?: string | undefined;
|
|
122
122
|
old_string?: string | undefined;
|
|
123
123
|
new_string?: string | undefined;
|
package/dist/server/index.js
CHANGED
|
@@ -11684,11 +11684,11 @@ ${p.text}` : p.text;
|
|
|
11684
11684
|
const { isRemoteConfigured: isRemoteConfigured2, storageQueries: storageQueries2 } = await Promise.resolve().then(() => (init_remote(), remote_exports));
|
|
11685
11685
|
if (!isRemoteConfigured2()) return [];
|
|
11686
11686
|
const { readFile: readFile13 } = await import("fs/promises");
|
|
11687
|
-
const { join:
|
|
11687
|
+
const { join: join21, basename: basename7 } = await import("path");
|
|
11688
11688
|
const urls = [];
|
|
11689
11689
|
for (const filePath of filePaths) {
|
|
11690
11690
|
try {
|
|
11691
|
-
const fullPath = filePath.startsWith("/") ? filePath :
|
|
11691
|
+
const fullPath = filePath.startsWith("/") ? filePath : join21(this.session.workingDirectory, filePath);
|
|
11692
11692
|
const fileName = basename7(fullPath);
|
|
11693
11693
|
const ext = fileName.split(".").pop()?.toLowerCase() || "";
|
|
11694
11694
|
const mimeMap = {
|
|
@@ -12067,19 +12067,19 @@ __export(self_update_exports, {
|
|
|
12067
12067
|
stopSelfUpdater: () => stopSelfUpdater
|
|
12068
12068
|
});
|
|
12069
12069
|
import { spawn as spawn2, execFile } from "child_process";
|
|
12070
|
-
import { readFileSync as
|
|
12071
|
-
import { dirname as
|
|
12072
|
-
import { fileURLToPath as
|
|
12070
|
+
import { readFileSync as readFileSync12, writeFileSync as writeFileSync7, mkdirSync as mkdirSync10 } from "fs";
|
|
12071
|
+
import { dirname as dirname11, join as join19 } from "path";
|
|
12072
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
12073
12073
|
function currentVersion2() {
|
|
12074
|
-
const here =
|
|
12074
|
+
const here = dirname11(fileURLToPath5(import.meta.url));
|
|
12075
12075
|
const candidates = [
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12076
|
+
join19(here, "..", "..", "package.json"),
|
|
12077
|
+
join19(here, "..", "package.json"),
|
|
12078
|
+
join19(process.cwd(), "package.json")
|
|
12079
12079
|
];
|
|
12080
12080
|
for (const p of candidates) {
|
|
12081
12081
|
try {
|
|
12082
|
-
const pkg = JSON.parse(
|
|
12082
|
+
const pkg = JSON.parse(readFileSync12(p, "utf8"));
|
|
12083
12083
|
if (pkg.name === "sparkecoder" && pkg.version) return pkg.version;
|
|
12084
12084
|
} catch {
|
|
12085
12085
|
}
|
|
@@ -12087,7 +12087,7 @@ function currentVersion2() {
|
|
|
12087
12087
|
return "0.0.0";
|
|
12088
12088
|
}
|
|
12089
12089
|
function isLikelyGlobalInstall() {
|
|
12090
|
-
const here =
|
|
12090
|
+
const here = dirname11(fileURLToPath5(import.meta.url));
|
|
12091
12091
|
return here.includes("/node_modules/sparkecoder/") || here.includes("\\node_modules\\sparkecoder\\");
|
|
12092
12092
|
}
|
|
12093
12093
|
function isEnabled() {
|
|
@@ -12130,7 +12130,7 @@ function semverGt(a, b) {
|
|
|
12130
12130
|
}
|
|
12131
12131
|
function statePath() {
|
|
12132
12132
|
try {
|
|
12133
|
-
return
|
|
12133
|
+
return join19(getAppDataDirectory(), "self-update-state.json");
|
|
12134
12134
|
} catch {
|
|
12135
12135
|
return null;
|
|
12136
12136
|
}
|
|
@@ -12139,7 +12139,7 @@ function readState() {
|
|
|
12139
12139
|
const p = statePath();
|
|
12140
12140
|
if (!p) return {};
|
|
12141
12141
|
try {
|
|
12142
|
-
return JSON.parse(
|
|
12142
|
+
return JSON.parse(readFileSync12(p, "utf8"));
|
|
12143
12143
|
} catch {
|
|
12144
12144
|
return {};
|
|
12145
12145
|
}
|
|
@@ -12148,7 +12148,7 @@ function writeState(s) {
|
|
|
12148
12148
|
const p = statePath();
|
|
12149
12149
|
if (!p) return;
|
|
12150
12150
|
try {
|
|
12151
|
-
mkdirSync10(
|
|
12151
|
+
mkdirSync10(dirname11(p), { recursive: true });
|
|
12152
12152
|
writeFileSync7(p, JSON.stringify(s));
|
|
12153
12153
|
} catch {
|
|
12154
12154
|
}
|
|
@@ -12370,10 +12370,10 @@ import { serve } from "@hono/node-server";
|
|
|
12370
12370
|
import { cors } from "hono/cors";
|
|
12371
12371
|
import { logger } from "hono/logger";
|
|
12372
12372
|
import { existsSync as existsSync22, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
12373
|
-
import { resolve as resolve12, dirname as
|
|
12373
|
+
import { resolve as resolve12, dirname as dirname12, join as join20 } from "path";
|
|
12374
12374
|
import { spawn as spawn3 } from "child_process";
|
|
12375
12375
|
import { createServer as createNetServer } from "net";
|
|
12376
|
-
import { fileURLToPath as
|
|
12376
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
12377
12377
|
|
|
12378
12378
|
// src/server/routes/sessions.ts
|
|
12379
12379
|
init_db();
|
|
@@ -16670,6 +16670,36 @@ function cfAccessMiddleware() {
|
|
|
16670
16670
|
// src/server/index.ts
|
|
16671
16671
|
init_tmux();
|
|
16672
16672
|
init_config();
|
|
16673
|
+
|
|
16674
|
+
// src/version.ts
|
|
16675
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
16676
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
16677
|
+
import { dirname as dirname10, join as join18 } from "path";
|
|
16678
|
+
function resolveVersion() {
|
|
16679
|
+
let here;
|
|
16680
|
+
try {
|
|
16681
|
+
here = dirname10(fileURLToPath4(import.meta.url));
|
|
16682
|
+
} catch {
|
|
16683
|
+
here = process.cwd();
|
|
16684
|
+
}
|
|
16685
|
+
const candidates = [
|
|
16686
|
+
join18(here, "../package.json"),
|
|
16687
|
+
join18(here, "../../package.json"),
|
|
16688
|
+
join18(here, "../../../package.json"),
|
|
16689
|
+
join18(process.cwd(), "package.json")
|
|
16690
|
+
];
|
|
16691
|
+
for (const p of candidates) {
|
|
16692
|
+
try {
|
|
16693
|
+
const pkg = JSON.parse(readFileSync11(p, "utf-8"));
|
|
16694
|
+
if (pkg.name === "sparkecoder") return pkg.version || "0.0.0";
|
|
16695
|
+
} catch {
|
|
16696
|
+
}
|
|
16697
|
+
}
|
|
16698
|
+
return "0.0.0";
|
|
16699
|
+
}
|
|
16700
|
+
var SPARKECODER_VERSION = resolveVersion();
|
|
16701
|
+
|
|
16702
|
+
// src/server/index.ts
|
|
16673
16703
|
init_db();
|
|
16674
16704
|
|
|
16675
16705
|
// src/utils/dependencies.ts
|
|
@@ -16756,13 +16786,13 @@ var DEFAULT_WEB_PORT = 6969;
|
|
|
16756
16786
|
var WEB_PORT_SEQUENCE = [6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978];
|
|
16757
16787
|
function getWebDirectory() {
|
|
16758
16788
|
try {
|
|
16759
|
-
const currentDir =
|
|
16789
|
+
const currentDir = dirname12(fileURLToPath6(import.meta.url));
|
|
16760
16790
|
const webDir = resolve12(currentDir, "..", "web");
|
|
16761
|
-
if (existsSync22(webDir) && existsSync22(
|
|
16791
|
+
if (existsSync22(webDir) && existsSync22(join20(webDir, "package.json"))) {
|
|
16762
16792
|
return webDir;
|
|
16763
16793
|
}
|
|
16764
16794
|
const altWebDir = resolve12(currentDir, "..", "..", "web");
|
|
16765
|
-
if (existsSync22(altWebDir) && existsSync22(
|
|
16795
|
+
if (existsSync22(altWebDir) && existsSync22(join20(altWebDir, "package.json"))) {
|
|
16766
16796
|
return altWebDir;
|
|
16767
16797
|
}
|
|
16768
16798
|
return null;
|
|
@@ -16820,20 +16850,20 @@ async function findWebPort(preferredPort) {
|
|
|
16820
16850
|
return { port: preferredPort, alreadyRunning: false };
|
|
16821
16851
|
}
|
|
16822
16852
|
function hasProductionBuild(webDir) {
|
|
16823
|
-
const buildIdPath =
|
|
16853
|
+
const buildIdPath = join20(webDir, ".next", "BUILD_ID");
|
|
16824
16854
|
return existsSync22(buildIdPath);
|
|
16825
16855
|
}
|
|
16826
16856
|
function hasSourceFiles(webDir) {
|
|
16827
|
-
const appDir =
|
|
16828
|
-
const pagesDir =
|
|
16829
|
-
const rootAppDir =
|
|
16830
|
-
const rootPagesDir =
|
|
16857
|
+
const appDir = join20(webDir, "src", "app");
|
|
16858
|
+
const pagesDir = join20(webDir, "src", "pages");
|
|
16859
|
+
const rootAppDir = join20(webDir, "app");
|
|
16860
|
+
const rootPagesDir = join20(webDir, "pages");
|
|
16831
16861
|
return existsSync22(appDir) || existsSync22(pagesDir) || existsSync22(rootAppDir) || existsSync22(rootPagesDir);
|
|
16832
16862
|
}
|
|
16833
16863
|
function getStandaloneServerPath(webDir) {
|
|
16834
16864
|
const possiblePaths2 = [
|
|
16835
|
-
|
|
16836
|
-
|
|
16865
|
+
join20(webDir, ".next", "standalone", "server.js"),
|
|
16866
|
+
join20(webDir, ".next", "standalone", "web", "server.js")
|
|
16837
16867
|
];
|
|
16838
16868
|
for (const serverPath of possiblePaths2) {
|
|
16839
16869
|
if (existsSync22(serverPath)) {
|
|
@@ -16876,13 +16906,19 @@ async function startWebUI(apiPort, webPort = DEFAULT_WEB_PORT, quiet = false, pu
|
|
|
16876
16906
|
if (!quiet) console.log(` \u2713 Web UI already running at http://localhost:${actualPort}`);
|
|
16877
16907
|
return { process: null, port: actualPort };
|
|
16878
16908
|
}
|
|
16879
|
-
const usePnpm = existsSync22(
|
|
16880
|
-
const useNpm = !usePnpm && existsSync22(
|
|
16909
|
+
const usePnpm = existsSync22(join20(webDir, "pnpm-lock.yaml"));
|
|
16910
|
+
const useNpm = !usePnpm && existsSync22(join20(webDir, "package-lock.json"));
|
|
16881
16911
|
const pkgManager = usePnpm ? "pnpm" : useNpm ? "npm" : "npx";
|
|
16882
16912
|
const { NODE_OPTIONS, TSX_TSCONFIG_PATH, ...cleanEnv } = process.env;
|
|
16883
16913
|
const apiUrl = publicUrl || `http://127.0.0.1:${apiPort}`;
|
|
16884
|
-
const runtimeConfig = {
|
|
16885
|
-
|
|
16914
|
+
const runtimeConfig = {
|
|
16915
|
+
apiBaseUrl: apiUrl,
|
|
16916
|
+
localApiBaseUrl: `http://127.0.0.1:${apiPort}`,
|
|
16917
|
+
version: SPARKECODER_VERSION,
|
|
16918
|
+
apiPort,
|
|
16919
|
+
writtenAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
16920
|
+
};
|
|
16921
|
+
const runtimeConfigPath = join20(webDir, "runtime-config.json");
|
|
16886
16922
|
try {
|
|
16887
16923
|
writeFileSync8(runtimeConfigPath, JSON.stringify(runtimeConfig, null, 2));
|
|
16888
16924
|
if (!quiet) console.log(` \u{1F4DD} Runtime config written to ${runtimeConfigPath}`);
|
|
@@ -16904,7 +16940,7 @@ async function startWebUI(apiPort, webPort = DEFAULT_WEB_PORT, quiet = false, pu
|
|
|
16904
16940
|
if (standaloneServerPath) {
|
|
16905
16941
|
command = "node";
|
|
16906
16942
|
args = ["server.js"];
|
|
16907
|
-
cwd =
|
|
16943
|
+
cwd = dirname12(standaloneServerPath);
|
|
16908
16944
|
webEnv.PORT = String(actualPort);
|
|
16909
16945
|
webEnv.HOSTNAME = "0.0.0.0";
|
|
16910
16946
|
if (!quiet) console.log(" \u{1F4E6} Starting Web UI from standalone build...");
|