openfox 1.5.3 → 1.6.1
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/{auto-compaction-DDQPVS7Z.js → auto-compaction-BRT6SDEP.js} +4 -4
- package/dist/{chat-handler-S3LRWAEV.js → chat-handler-55LA4LI2.js} +6 -6
- package/dist/{chunk-NW7PIZH3.js → chunk-CIXMZ73F.js} +82 -3
- package/dist/{chunk-QJIHXG4P.js → chunk-GBBTJ6ND.js} +21 -14
- package/dist/{chunk-KUHCFENT.js → chunk-GX4FO6UV.js} +2 -2
- package/dist/{chunk-JHL5ZO3K.js → chunk-NBU6KIOD.js} +30 -2
- package/dist/{chunk-TWUJFSH6.js → chunk-S73ATBSR.js} +3 -3
- package/dist/{chunk-AL7KUHBF.js → chunk-UMRXS66I.js} +54 -45
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{events-B7S4U4DB.js → events-OZKDX6XE.js} +2 -2
- package/dist/{manager-TMIDRUVA.js → manager-HM2J5VMW.js} +2 -2
- package/dist/{orchestrator-6VETL3Z7.js → orchestrator-IEYZSNVH.js} +5 -5
- package/dist/package.json +6 -2
- package/dist/{processor-HYEPZECF.js → processor-I4BGYK3T.js} +3 -3
- package/dist/{serve-DCCIXC4Q.js → serve-CO6WHGYG.js} +7 -11
- package/dist/server/index.js +5 -5
- package/dist/{tools-XSK3J4II.js → tools-GQ3PJL6N.js} +4 -4
- package/dist/web/assets/{index-CglBHzrV.js → index-BgQD0NJB.js} +52 -44
- package/dist/web/assets/{index-DteeMapx.css → index-Dc2TJUUt.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +6 -2
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
maybeAutoCompactContext,
|
|
3
3
|
performManualContextCompaction,
|
|
4
4
|
resolveCompactionStatsIdentity
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-GBBTJ6ND.js";
|
|
6
|
+
import "./chunk-NBU6KIOD.js";
|
|
7
7
|
import "./chunk-574HZVLE.js";
|
|
8
8
|
import "./chunk-XFXOSPYH.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-CIXMZ73F.js";
|
|
10
10
|
import "./chunk-WQ4W5H6A.js";
|
|
11
11
|
import "./chunk-EBOKO2PW.js";
|
|
12
12
|
import "./chunk-22CTURMH.js";
|
|
@@ -22,4 +22,4 @@ export {
|
|
|
22
22
|
performManualContextCompaction,
|
|
23
23
|
resolveCompactionStatsIdentity
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=auto-compaction-
|
|
25
|
+
//# sourceMappingURL=auto-compaction-BRT6SDEP.js.map
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
} from "./chunk-QDEKU5RL.js";
|
|
5
5
|
import {
|
|
6
6
|
runChatTurn
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-S73ATBSR.js";
|
|
8
|
+
import "./chunk-GBBTJ6ND.js";
|
|
9
|
+
import "./chunk-NBU6KIOD.js";
|
|
10
10
|
import "./chunk-574HZVLE.js";
|
|
11
11
|
import "./chunk-XFXOSPYH.js";
|
|
12
12
|
import {
|
|
13
13
|
getEventStore,
|
|
14
14
|
updateSessionMetadata
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CIXMZ73F.js";
|
|
16
16
|
import {
|
|
17
17
|
buildMessagesFromStoredEvents,
|
|
18
18
|
foldPendingConfirmations
|
|
@@ -61,7 +61,7 @@ async function startChatSession(sessionId, content, deps, options) {
|
|
|
61
61
|
sessionManager.setRunning(sessionId, true);
|
|
62
62
|
broadcastForSession(sessionId, createSessionRunningMessage(true));
|
|
63
63
|
try {
|
|
64
|
-
const { maybeAutoCompactContext } = await import("./auto-compaction-
|
|
64
|
+
const { maybeAutoCompactContext } = await import("./auto-compaction-BRT6SDEP.js");
|
|
65
65
|
await maybeAutoCompactContext({
|
|
66
66
|
sessionManager,
|
|
67
67
|
sessionId,
|
|
@@ -200,4 +200,4 @@ export {
|
|
|
200
200
|
startChatSession,
|
|
201
201
|
stopSessionExecution
|
|
202
202
|
};
|
|
203
|
-
//# sourceMappingURL=chat-handler-
|
|
203
|
+
//# sourceMappingURL=chat-handler-55LA4LI2.js.map
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
var EventStore = class {
|
|
19
19
|
db;
|
|
20
20
|
subscribers = /* @__PURE__ */ new Map();
|
|
21
|
+
globalSubscribers = /* @__PURE__ */ new Map();
|
|
22
|
+
globalSubscriberIdCounter = 0;
|
|
21
23
|
constructor(db) {
|
|
22
24
|
this.db = db;
|
|
23
25
|
this.initSchema();
|
|
@@ -239,13 +241,82 @@ var EventStore = class {
|
|
|
239
241
|
}
|
|
240
242
|
notifySubscribers(sessionId, event) {
|
|
241
243
|
const sessionSubs = this.subscribers.get(sessionId);
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
+
if (sessionSubs) {
|
|
245
|
+
for (const subscriber of sessionSubs) {
|
|
246
|
+
if (!subscriber.closed) {
|
|
247
|
+
subscriber.callback(event);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
for (const subscriber of this.globalSubscribers.values()) {
|
|
244
252
|
if (!subscriber.closed) {
|
|
245
253
|
subscriber.callback(event);
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Subscribe to ALL events across ALL sessions.
|
|
259
|
+
* Unlike subscribe() which is session-specific, this receives every event.
|
|
260
|
+
* Used by WebSocket clients to receive real-time updates for all sessions.
|
|
261
|
+
*
|
|
262
|
+
* Returns an async iterator that yields events and an unsubscribe function
|
|
263
|
+
*/
|
|
264
|
+
subscribeAll() {
|
|
265
|
+
const queue = [];
|
|
266
|
+
let resolveNext = null;
|
|
267
|
+
let closed = false;
|
|
268
|
+
const closeIterator = () => {
|
|
269
|
+
closed = true;
|
|
270
|
+
if (resolveNext) {
|
|
271
|
+
resolveNext({ value: void 0, done: true });
|
|
272
|
+
resolveNext = null;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
const wsId = ++this.globalSubscriberIdCounter;
|
|
276
|
+
const subscriber = {
|
|
277
|
+
wsId,
|
|
278
|
+
callback: (event) => {
|
|
279
|
+
if (closed) return;
|
|
280
|
+
if (resolveNext) {
|
|
281
|
+
resolveNext({ value: event, done: false });
|
|
282
|
+
resolveNext = null;
|
|
283
|
+
} else {
|
|
284
|
+
queue.push(event);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
close: closeIterator,
|
|
288
|
+
closed: false
|
|
289
|
+
};
|
|
290
|
+
this.globalSubscribers.set(wsId, subscriber);
|
|
291
|
+
const iterator = {
|
|
292
|
+
[Symbol.asyncIterator]() {
|
|
293
|
+
return this;
|
|
294
|
+
},
|
|
295
|
+
async next() {
|
|
296
|
+
if (closed) {
|
|
297
|
+
return { value: void 0, done: true };
|
|
298
|
+
}
|
|
299
|
+
const queued = queue.shift();
|
|
300
|
+
if (queued) {
|
|
301
|
+
return { value: queued, done: false };
|
|
302
|
+
}
|
|
303
|
+
return new Promise((resolve) => {
|
|
304
|
+
resolveNext = resolve;
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
async return() {
|
|
308
|
+
closed = true;
|
|
309
|
+
subscriber.closed = true;
|
|
310
|
+
return { value: void 0, done: true };
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
const unsubscribe = () => {
|
|
314
|
+
subscriber.closed = true;
|
|
315
|
+
closeIterator();
|
|
316
|
+
this.globalSubscribers.delete(wsId);
|
|
317
|
+
};
|
|
318
|
+
return { iterator, unsubscribe };
|
|
319
|
+
}
|
|
249
320
|
// --------------------------------------------------------------------------
|
|
250
321
|
// Cleanup
|
|
251
322
|
// --------------------------------------------------------------------------
|
|
@@ -506,6 +577,13 @@ function updateSessionDangerLevel(id, dangerLevel) {
|
|
|
506
577
|
UPDATE sessions SET danger_level = ?, updated_at = ? WHERE id = ?
|
|
507
578
|
`).run(dangerLevel, now, id);
|
|
508
579
|
}
|
|
580
|
+
function updateSessionRunning(id, isRunning) {
|
|
581
|
+
const db = getDatabase();
|
|
582
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
583
|
+
db.prepare(`
|
|
584
|
+
UPDATE sessions SET is_running = ?, updated_at = ? WHERE id = ?
|
|
585
|
+
`).run(isRunning ? 1 : 0, now, id);
|
|
586
|
+
}
|
|
509
587
|
function updateSessionSummary(id, summary) {
|
|
510
588
|
const db = getDatabase();
|
|
511
589
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -1027,6 +1105,7 @@ export {
|
|
|
1027
1105
|
getSession,
|
|
1028
1106
|
updateSessionProvider,
|
|
1029
1107
|
updateSessionDangerLevel,
|
|
1108
|
+
updateSessionRunning,
|
|
1030
1109
|
updateSessionSummary,
|
|
1031
1110
|
updateSessionMetadata,
|
|
1032
1111
|
listSessions,
|
|
@@ -1064,4 +1143,4 @@ export {
|
|
|
1064
1143
|
compactContext,
|
|
1065
1144
|
getRecentUserPromptsForSession
|
|
1066
1145
|
};
|
|
1067
|
-
//# sourceMappingURL=chunk-
|
|
1146
|
+
//# sourceMappingURL=chunk-CIXMZ73F.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProcess,
|
|
3
|
+
getPlatformShell,
|
|
3
4
|
getProcessLogs,
|
|
4
5
|
getProcessStatus,
|
|
5
6
|
getSessionProcesses,
|
|
6
7
|
startProcessCommand,
|
|
7
8
|
stopProcess
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NBU6KIOD.js";
|
|
9
10
|
import {
|
|
10
11
|
getMaxPerSession,
|
|
11
12
|
getSessionProcessCount
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
getContextMessages,
|
|
18
19
|
getCurrentContextWindowId,
|
|
19
20
|
getEventStore
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-CIXMZ73F.js";
|
|
21
22
|
import {
|
|
22
23
|
createChatMessageMessage,
|
|
23
24
|
createChatPathConfirmationMessage,
|
|
@@ -1133,8 +1134,8 @@ import { resolve as resolve2, isAbsolute } from "path";
|
|
|
1133
1134
|
|
|
1134
1135
|
// src/server/tools/path-security.ts
|
|
1135
1136
|
import { realpath } from "fs/promises";
|
|
1136
|
-
import { resolve, normalize, join as join3 } from "path";
|
|
1137
|
-
import { homedir } from "os";
|
|
1137
|
+
import { resolve, normalize, join as join3, basename, sep } from "path";
|
|
1138
|
+
import { homedir, tmpdir } from "os";
|
|
1138
1139
|
var SAFE_PATHS = /* @__PURE__ */ new Set([
|
|
1139
1140
|
"/dev/null",
|
|
1140
1141
|
"/dev/zero",
|
|
@@ -1147,7 +1148,11 @@ var SAFE_PATHS = /* @__PURE__ */ new Set([
|
|
|
1147
1148
|
"/dev/fd/1",
|
|
1148
1149
|
"/dev/fd/2"
|
|
1149
1150
|
]);
|
|
1150
|
-
var ALLOWED_ROOTS = [
|
|
1151
|
+
var ALLOWED_ROOTS = [
|
|
1152
|
+
"/tmp",
|
|
1153
|
+
"/var/tmp",
|
|
1154
|
+
tmpdir()
|
|
1155
|
+
];
|
|
1151
1156
|
var SENSITIVE_FILE_PATTERNS = [
|
|
1152
1157
|
// Dotenv files (but not .envrc, .env-example, .env.example)
|
|
1153
1158
|
/^\.env$/,
|
|
@@ -1168,9 +1173,9 @@ var SENSITIVE_FILE_PATTERNS = [
|
|
|
1168
1173
|
/^\.netrc$/
|
|
1169
1174
|
];
|
|
1170
1175
|
function isSensitivePath(path) {
|
|
1171
|
-
const
|
|
1172
|
-
if (!
|
|
1173
|
-
return SENSITIVE_FILE_PATTERNS.some((pattern) => pattern.test(
|
|
1176
|
+
const fileName = basename(path);
|
|
1177
|
+
if (!fileName) return false;
|
|
1178
|
+
return SENSITIVE_FILE_PATTERNS.some((pattern) => pattern.test(fileName));
|
|
1174
1179
|
}
|
|
1175
1180
|
var sessionAllowedPaths = /* @__PURE__ */ new Map();
|
|
1176
1181
|
function addAllowedPath(sessionId, path) {
|
|
@@ -1212,12 +1217,12 @@ async function isPathWithinSandbox(path, workdir, sessionId) {
|
|
|
1212
1217
|
}
|
|
1213
1218
|
}
|
|
1214
1219
|
resolvedPath = resolvedPath.replace(/\/+$/, "");
|
|
1215
|
-
if (resolvedPath === normalizedWorkdir || resolvedPath.startsWith(normalizedWorkdir +
|
|
1220
|
+
if (resolvedPath === normalizedWorkdir || resolvedPath.startsWith(normalizedWorkdir + sep)) {
|
|
1216
1221
|
return { allowed: true, resolvedPath };
|
|
1217
1222
|
}
|
|
1218
1223
|
for (const root of ALLOWED_ROOTS) {
|
|
1219
1224
|
const normalizedRoot = normalize(root);
|
|
1220
|
-
if (resolvedPath === normalizedRoot || resolvedPath.startsWith(normalizedRoot +
|
|
1225
|
+
if (resolvedPath === normalizedRoot || resolvedPath.startsWith(normalizedRoot + sep)) {
|
|
1221
1226
|
return { allowed: true, resolvedPath };
|
|
1222
1227
|
}
|
|
1223
1228
|
}
|
|
@@ -2123,7 +2128,8 @@ function executeCommand(command, cwd, timeout, signal, onProgress) {
|
|
|
2123
2128
|
reject(new Error("Command aborted before execution"));
|
|
2124
2129
|
return;
|
|
2125
2130
|
}
|
|
2126
|
-
const
|
|
2131
|
+
const shell = getPlatformShell();
|
|
2132
|
+
const proc = spawn2(shell.command, [...shell.args, command], {
|
|
2127
2133
|
cwd,
|
|
2128
2134
|
env: { ...process.env, FORCE_COLOR: "0" },
|
|
2129
2135
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -3619,7 +3625,7 @@ var callSubAgentTool = {
|
|
|
3619
3625
|
};
|
|
3620
3626
|
}
|
|
3621
3627
|
try {
|
|
3622
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3628
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-GQ3PJL6N.js");
|
|
3623
3629
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3624
3630
|
const turnMetrics = new TurnMetrics();
|
|
3625
3631
|
const result = await executeSubAgent({
|
|
@@ -3966,7 +3972,8 @@ var DevServerManager = class {
|
|
|
3966
3972
|
instance.errorMessage = void 0;
|
|
3967
3973
|
instance.exited = false;
|
|
3968
3974
|
const resolved = this.resolveWorkdir(workdir);
|
|
3969
|
-
const
|
|
3975
|
+
const shell = getPlatformShell();
|
|
3976
|
+
const proc = spawn3(shell.command, [...shell.args, config.command], {
|
|
3970
3977
|
cwd: resolved,
|
|
3971
3978
|
env: { ...process.env, FORCE_COLOR: "1" },
|
|
3972
3979
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -4751,4 +4758,4 @@ export {
|
|
|
4751
4758
|
getToolRegistryForAgent,
|
|
4752
4759
|
createToolRegistry
|
|
4753
4760
|
};
|
|
4754
|
-
//# sourceMappingURL=chunk-
|
|
4761
|
+
//# sourceMappingURL=chunk-GBBTJ6ND.js.map
|
|
@@ -154,7 +154,7 @@ async function runCli(options) {
|
|
|
154
154
|
if (!configExists) {
|
|
155
155
|
await runNetworkSetup(mode);
|
|
156
156
|
}
|
|
157
|
-
const { runServe } = await import("./serve-
|
|
157
|
+
const { runServe } = await import("./serve-CO6WHGYG.js");
|
|
158
158
|
await runServe({
|
|
159
159
|
mode,
|
|
160
160
|
port: values.port ? parseInt(values.port) : void 0,
|
|
@@ -167,4 +167,4 @@ async function runCli(options) {
|
|
|
167
167
|
export {
|
|
168
168
|
runCli
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-GX4FO6UV.js.map
|
|
@@ -11,6 +11,30 @@ import {
|
|
|
11
11
|
|
|
12
12
|
// src/server/tools/background-process/manager.ts
|
|
13
13
|
import { spawn } from "child_process";
|
|
14
|
+
|
|
15
|
+
// src/server/utils/platform.ts
|
|
16
|
+
import os from "os";
|
|
17
|
+
function getPlatformShell() {
|
|
18
|
+
if (process.platform === "win32") {
|
|
19
|
+
return { command: "cmd.exe", args: ["/c"] };
|
|
20
|
+
}
|
|
21
|
+
const userShell = os.userInfo().shell;
|
|
22
|
+
if (userShell) {
|
|
23
|
+
return { command: userShell, args: ["-c"] };
|
|
24
|
+
}
|
|
25
|
+
return { command: "sh", args: ["-c"] };
|
|
26
|
+
}
|
|
27
|
+
function getPathSeparator() {
|
|
28
|
+
return process.platform === "win32" ? ";" : ":";
|
|
29
|
+
}
|
|
30
|
+
function isWindowsPath(path) {
|
|
31
|
+
return /^[A-Za-z]:[/\\]/.test(path);
|
|
32
|
+
}
|
|
33
|
+
function isAbsolutePath(path) {
|
|
34
|
+
return path.startsWith("/") || isWindowsPath(path);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/server/tools/background-process/manager.ts
|
|
14
38
|
var STOP_SIGNAL_TIMEOUT = 5e3;
|
|
15
39
|
var listeners = /* @__PURE__ */ new Set();
|
|
16
40
|
function onProcessEvent(callback) {
|
|
@@ -40,7 +64,8 @@ function createProcess2(sessionId, name, command, cwd, timeout) {
|
|
|
40
64
|
function startProcessCommand(processId, sessionId, command, cwd) {
|
|
41
65
|
const proc = startProcess(processId, sessionId, 0);
|
|
42
66
|
if (!proc) return null;
|
|
43
|
-
const
|
|
67
|
+
const shell = getPlatformShell();
|
|
68
|
+
const child = spawn(shell.command, [...shell.args, command], {
|
|
44
69
|
cwd,
|
|
45
70
|
env: { ...process.env, FORCE_COLOR: "1" },
|
|
46
71
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -145,6 +170,9 @@ function getProcessLogs(processId, since = 0, maxLines) {
|
|
|
145
170
|
}
|
|
146
171
|
|
|
147
172
|
export {
|
|
173
|
+
getPlatformShell,
|
|
174
|
+
getPathSeparator,
|
|
175
|
+
isAbsolutePath,
|
|
148
176
|
onProcessEvent,
|
|
149
177
|
createProcess2 as createProcess,
|
|
150
178
|
startProcessCommand,
|
|
@@ -153,4 +181,4 @@ export {
|
|
|
153
181
|
getSessionProcesses2 as getSessionProcesses,
|
|
154
182
|
getProcessLogs
|
|
155
183
|
};
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
184
|
+
//# sourceMappingURL=chunk-NBU6KIOD.js.map
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
getToolRegistryForAgent,
|
|
14
14
|
loadAllAgentsDefault,
|
|
15
15
|
runTopLevelAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GBBTJ6ND.js";
|
|
17
17
|
import {
|
|
18
18
|
getCurrentContextWindowId,
|
|
19
19
|
getEventStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CIXMZ73F.js";
|
|
21
21
|
import {
|
|
22
22
|
buildSnapshotFromSessionState
|
|
23
23
|
} from "./chunk-WQ4W5H6A.js";
|
|
@@ -311,4 +311,4 @@ export {
|
|
|
311
311
|
runBuilderTurn,
|
|
312
312
|
runVerifierTurn
|
|
313
313
|
};
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-S73ATBSR.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
createVerifierNudgeConfig,
|
|
7
7
|
runBuilderTurn,
|
|
8
8
|
runChatTurn
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S73ATBSR.js";
|
|
10
10
|
import {
|
|
11
11
|
TurnMetrics,
|
|
12
12
|
agentExists,
|
|
@@ -44,10 +44,13 @@ import {
|
|
|
44
44
|
saveSkill,
|
|
45
45
|
setSkillEnabled,
|
|
46
46
|
skillExists
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-GBBTJ6ND.js";
|
|
48
48
|
import {
|
|
49
|
+
getPathSeparator,
|
|
50
|
+
getPlatformShell,
|
|
51
|
+
isAbsolutePath,
|
|
49
52
|
onProcessEvent
|
|
50
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-NBU6KIOD.js";
|
|
51
54
|
import {
|
|
52
55
|
createProviderManager,
|
|
53
56
|
parseDefaultModelSelection
|
|
@@ -84,8 +87,9 @@ import {
|
|
|
84
87
|
updateSessionDangerLevel,
|
|
85
88
|
updateSessionMetadata,
|
|
86
89
|
updateSessionProvider,
|
|
90
|
+
updateSessionRunning,
|
|
87
91
|
updateSessionSummary
|
|
88
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-CIXMZ73F.js";
|
|
89
93
|
import {
|
|
90
94
|
buildContextMessagesFromEventHistory,
|
|
91
95
|
buildMessagesFromStoredEvents,
|
|
@@ -1197,8 +1201,7 @@ var TerminalManager = class {
|
|
|
1197
1201
|
return `term_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
|
|
1198
1202
|
}
|
|
1199
1203
|
getShell() {
|
|
1200
|
-
|
|
1201
|
-
return shell;
|
|
1204
|
+
return getPlatformShell().command;
|
|
1202
1205
|
}
|
|
1203
1206
|
resolveWorkdir(workdir) {
|
|
1204
1207
|
if (workdir && workdir.length > 0) {
|
|
@@ -1583,7 +1586,8 @@ function executeShellCommand(command, cwd, timeout, signal) {
|
|
|
1583
1586
|
reject(new Error("Aborted"));
|
|
1584
1587
|
return;
|
|
1585
1588
|
}
|
|
1586
|
-
const
|
|
1589
|
+
const shell = getPlatformShell();
|
|
1590
|
+
const proc = spawn2(shell.command, [...shell.args, command], {
|
|
1587
1591
|
cwd,
|
|
1588
1592
|
env: { ...process.env, FORCE_COLOR: "0" },
|
|
1589
1593
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -2515,7 +2519,23 @@ function createWebSocketServer(httpServer, config, getLLMClient, getActiveProvid
|
|
|
2515
2519
|
}
|
|
2516
2520
|
}
|
|
2517
2521
|
logger.debug("WebSocket client connected");
|
|
2518
|
-
clients.set(ws, { ws, activeSessionId: null, subscribedSessions: /* @__PURE__ */ new Map(), eventStoreSubscriptions: /* @__PURE__ */ new Map() });
|
|
2522
|
+
clients.set(ws, { ws, activeSessionId: null, subscribedSessions: /* @__PURE__ */ new Map(), eventStoreSubscriptions: /* @__PURE__ */ new Map(), globalSubscription: null });
|
|
2523
|
+
const eventStore = getEventStore();
|
|
2524
|
+
const { iterator: globalIterator, unsubscribe: globalUnsubscribe } = eventStore.subscribeAll();
|
|
2525
|
+
clients.get(ws).globalSubscription = globalUnsubscribe;
|
|
2526
|
+
(async () => {
|
|
2527
|
+
try {
|
|
2528
|
+
for await (const storedEvent of globalIterator) {
|
|
2529
|
+
if (ws.readyState !== WebSocket2.OPEN) break;
|
|
2530
|
+
const serverMsg = storedEventToServerMessage(storedEvent);
|
|
2531
|
+
if (serverMsg) {
|
|
2532
|
+
ws.send(serializeServerMessage({ ...serverMsg, seq: storedEvent.seq, sessionId: storedEvent.sessionId }));
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
} catch (error) {
|
|
2536
|
+
logger.debug("Global event subscription ended", { error });
|
|
2537
|
+
}
|
|
2538
|
+
})();
|
|
2519
2539
|
ws.on("message", async (data) => {
|
|
2520
2540
|
const message = parseClientMessage(data.toString());
|
|
2521
2541
|
if (!message) {
|
|
@@ -2550,6 +2570,9 @@ function createWebSocketServer(httpServer, config, getLLMClient, getActiveProvid
|
|
|
2550
2570
|
for (const unsubscribe of client.eventStoreSubscriptions.values()) {
|
|
2551
2571
|
unsubscribe();
|
|
2552
2572
|
}
|
|
2573
|
+
if (client.globalSubscription) {
|
|
2574
|
+
client.globalSubscription();
|
|
2575
|
+
}
|
|
2553
2576
|
}
|
|
2554
2577
|
unsubscribeAllFromTerminal(ws);
|
|
2555
2578
|
clients.delete(ws);
|
|
@@ -2598,27 +2621,7 @@ async function handleClientMessage(ws, client, message, getLLMClient, getActiveP
|
|
|
2598
2621
|
sendForSession(sessionId, createContextStateMessage(contextState));
|
|
2599
2622
|
return true;
|
|
2600
2623
|
};
|
|
2601
|
-
const ensureEventStoreSubscription = (
|
|
2602
|
-
if (client.eventStoreSubscriptions.has(sessionId)) {
|
|
2603
|
-
return;
|
|
2604
|
-
}
|
|
2605
|
-
const sid = sessionId;
|
|
2606
|
-
const eventStore = getEventStore();
|
|
2607
|
-
const { iterator, unsubscribe } = eventStore.subscribe(sid);
|
|
2608
|
-
client.eventStoreSubscriptions.set(sessionId, unsubscribe);
|
|
2609
|
-
(async () => {
|
|
2610
|
-
try {
|
|
2611
|
-
for await (const storedEvent of iterator) {
|
|
2612
|
-
const serverMsg = storedEventToServerMessage(storedEvent);
|
|
2613
|
-
if (serverMsg && ws.readyState === WebSocket2.OPEN) {
|
|
2614
|
-
ws.send(serializeServerMessage({ ...serverMsg, seq: storedEvent.seq, sessionId: sid }));
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
} catch (error) {
|
|
2618
|
-
logger.debug("EventStore subscription ended", { sessionId: sid, error });
|
|
2619
|
-
}
|
|
2620
|
-
})();
|
|
2621
|
-
logger.debug("Subscribed to EventStore", { sessionId });
|
|
2624
|
+
const ensureEventStoreSubscription = (_sessionId) => {
|
|
2622
2625
|
};
|
|
2623
2626
|
switch (message.type) {
|
|
2624
2627
|
// =========================================================================
|
|
@@ -3549,7 +3552,7 @@ async function existsExecutable(path) {
|
|
|
3549
3552
|
}
|
|
3550
3553
|
}
|
|
3551
3554
|
async function which(command, workdir) {
|
|
3552
|
-
if (command
|
|
3555
|
+
if (isAbsolutePath(command)) {
|
|
3553
3556
|
if (await existsExecutable(command)) {
|
|
3554
3557
|
return command;
|
|
3555
3558
|
}
|
|
@@ -3568,7 +3571,7 @@ async function which(command, workdir) {
|
|
|
3568
3571
|
}
|
|
3569
3572
|
}
|
|
3570
3573
|
const pathEnv = process.env["PATH"] ?? "";
|
|
3571
|
-
const paths = pathEnv.split(
|
|
3574
|
+
const paths = pathEnv.split(getPathSeparator());
|
|
3572
3575
|
for (const dir of paths) {
|
|
3573
3576
|
if (!dir) continue;
|
|
3574
3577
|
const fullPath = join3(dir, command);
|
|
@@ -4393,6 +4396,7 @@ var SessionManager = class {
|
|
|
4393
4396
|
return session;
|
|
4394
4397
|
}
|
|
4395
4398
|
logger.debug("Setting session running state", { sessionId, isRunning });
|
|
4399
|
+
updateSessionRunning(sessionId, isRunning);
|
|
4396
4400
|
emitRunningChanged(sessionId, isRunning);
|
|
4397
4401
|
const updatedSession = this.requireSession(sessionId);
|
|
4398
4402
|
this.emit({ type: "session_updated", session: updatedSession });
|
|
@@ -5563,6 +5567,9 @@ function createTerminalRoutes() {
|
|
|
5563
5567
|
return router;
|
|
5564
5568
|
}
|
|
5565
5569
|
|
|
5570
|
+
// src/constants.ts
|
|
5571
|
+
var VERSION = "1.6.1";
|
|
5572
|
+
|
|
5566
5573
|
// src/server/index.ts
|
|
5567
5574
|
var __dirname2 = dirname5(fileURLToPath4(import.meta.url));
|
|
5568
5575
|
async function createServerHandle(config) {
|
|
@@ -5726,7 +5733,7 @@ async function createServerHandle(config) {
|
|
|
5726
5733
|
res.json({ success: true });
|
|
5727
5734
|
});
|
|
5728
5735
|
app.get("/api/sessions", async (req, res) => {
|
|
5729
|
-
const { getRecentUserPromptsForSession } = await import("./events-
|
|
5736
|
+
const { getRecentUserPromptsForSession } = await import("./events-OZKDX6XE.js");
|
|
5730
5737
|
const projectId = req.query["projectId"];
|
|
5731
5738
|
const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
|
|
5732
5739
|
const offset = parseInt(req.query["offset"]) || 0;
|
|
@@ -5759,7 +5766,7 @@ async function createServerHandle(config) {
|
|
|
5759
5766
|
res.status(201).json({ session });
|
|
5760
5767
|
});
|
|
5761
5768
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
5762
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
5769
|
+
const { getEventStore: getEventStore2 } = await import("./events-OZKDX6XE.js");
|
|
5763
5770
|
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NZYOXNKK.js");
|
|
5764
5771
|
const session = sessionManager.getSession(req.params.id);
|
|
5765
5772
|
if (!session) {
|
|
@@ -5790,7 +5797,7 @@ async function createServerHandle(config) {
|
|
|
5790
5797
|
res.json({ success: true });
|
|
5791
5798
|
});
|
|
5792
5799
|
app.post("/api/sessions/:id/provider", async (req, res) => {
|
|
5793
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
5800
|
+
const { getEventStore: getEventStore2 } = await import("./events-OZKDX6XE.js");
|
|
5794
5801
|
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NZYOXNKK.js");
|
|
5795
5802
|
const sessionId = req.params.id;
|
|
5796
5803
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -5828,7 +5835,7 @@ async function createServerHandle(config) {
|
|
|
5828
5835
|
res.json({ success: true });
|
|
5829
5836
|
});
|
|
5830
5837
|
app.put("/api/sessions/:id/mode", async (req, res) => {
|
|
5831
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
5838
|
+
const { getEventStore: getEventStore2 } = await import("./events-OZKDX6XE.js");
|
|
5832
5839
|
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NZYOXNKK.js");
|
|
5833
5840
|
const sessionId = req.params.id;
|
|
5834
5841
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -5867,12 +5874,12 @@ async function createServerHandle(config) {
|
|
|
5867
5874
|
if (!callId || approved === void 0) {
|
|
5868
5875
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
5869
5876
|
}
|
|
5870
|
-
const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-
|
|
5877
|
+
const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-GQ3PJL6N.js");
|
|
5871
5878
|
const result = providePathConfirmation2(callId, approved, alwaysAllow);
|
|
5872
5879
|
if (!result.found) {
|
|
5873
5880
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
5874
5881
|
}
|
|
5875
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
5882
|
+
const { getEventStore: getEventStore2 } = await import("./events-OZKDX6XE.js");
|
|
5876
5883
|
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-NZYOXNKK.js");
|
|
5877
5884
|
const { createSessionStateMessage: createSessionStateMessage2 } = await import("./protocol-ODKD7QJO.js");
|
|
5878
5885
|
const eventStore = getEventStore2();
|
|
@@ -5892,7 +5899,7 @@ async function createServerHandle(config) {
|
|
|
5892
5899
|
if (!callId || !answer) {
|
|
5893
5900
|
return res.status(400).json({ error: "callId and answer are required" });
|
|
5894
5901
|
}
|
|
5895
|
-
const { provideAnswer: provideAnswer2 } = await import("./tools-
|
|
5902
|
+
const { provideAnswer: provideAnswer2 } = await import("./tools-GQ3PJL6N.js");
|
|
5896
5903
|
const found = provideAnswer2(callId, answer);
|
|
5897
5904
|
if (!found) {
|
|
5898
5905
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -5928,14 +5935,14 @@ async function createServerHandle(config) {
|
|
|
5928
5935
|
if (!session) {
|
|
5929
5936
|
return res.status(404).json({ error: "Session not found" });
|
|
5930
5937
|
}
|
|
5931
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
5932
|
-
const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-
|
|
5938
|
+
const { stopSessionExecution } = await import("./chat-handler-55LA4LI2.js");
|
|
5939
|
+
const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-GQ3PJL6N.js");
|
|
5933
5940
|
stopSessionExecution(sessionId, sessionManager);
|
|
5934
5941
|
abortSession(sessionId);
|
|
5935
5942
|
cancelQuestionsForSession2(sessionId, "Session stopped by user");
|
|
5936
5943
|
cancelPathConfirmationsForSession2(sessionId, "Session stopped by user");
|
|
5937
5944
|
sessionManager.clearMessageQueue(sessionId);
|
|
5938
|
-
const eventStore = (await import("./events-
|
|
5945
|
+
const eventStore = (await import("./events-OZKDX6XE.js")).getEventStore();
|
|
5939
5946
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
5940
5947
|
res.json({ success: true });
|
|
5941
5948
|
});
|
|
@@ -6002,6 +6009,7 @@ async function createServerHandle(config) {
|
|
|
6002
6009
|
} catch {
|
|
6003
6010
|
}
|
|
6004
6011
|
res.json({
|
|
6012
|
+
version: VERSION,
|
|
6005
6013
|
model: llmClient.getModel(),
|
|
6006
6014
|
maxContext: providerManager.getCurrentModelContext(),
|
|
6007
6015
|
llmUrl: activeProvider?.url ?? config.llm.baseUrl,
|
|
@@ -6216,13 +6224,13 @@ async function createServerHandle(config) {
|
|
|
6216
6224
|
app.use("/api/dev-server", createDevServerRoutes());
|
|
6217
6225
|
app.use("/api/terminals", createTerminalRoutes());
|
|
6218
6226
|
app.get("/api/sessions/:id/background-processes", async (req, res) => {
|
|
6219
|
-
const { getSessionProcesses } = await import("./manager-
|
|
6227
|
+
const { getSessionProcesses } = await import("./manager-HM2J5VMW.js");
|
|
6220
6228
|
const sessionId = req.params.id;
|
|
6221
6229
|
const processes = getSessionProcesses(sessionId);
|
|
6222
6230
|
res.json({ processes });
|
|
6223
6231
|
});
|
|
6224
6232
|
app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
|
|
6225
|
-
const { stopProcess } = await import("./manager-
|
|
6233
|
+
const { stopProcess } = await import("./manager-HM2J5VMW.js");
|
|
6226
6234
|
const sessionId = req.params.id;
|
|
6227
6235
|
const processId = req.params.processId;
|
|
6228
6236
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -6376,7 +6384,7 @@ async function createServerHandle(config) {
|
|
|
6376
6384
|
providerManager
|
|
6377
6385
|
);
|
|
6378
6386
|
const wss = wssExports.wss;
|
|
6379
|
-
const { QueueProcessor } = await import("./processor-
|
|
6387
|
+
const { QueueProcessor } = await import("./processor-I4BGYK3T.js");
|
|
6380
6388
|
const queueProcessor = new QueueProcessor({
|
|
6381
6389
|
sessionManager,
|
|
6382
6390
|
providerManager,
|
|
@@ -6445,7 +6453,8 @@ function basename2(path) {
|
|
|
6445
6453
|
}
|
|
6446
6454
|
|
|
6447
6455
|
export {
|
|
6456
|
+
VERSION,
|
|
6448
6457
|
createServerHandle,
|
|
6449
6458
|
createServer
|
|
6450
6459
|
};
|
|
6451
|
-
//# sourceMappingURL=chunk-
|
|
6460
|
+
//# sourceMappingURL=chunk-UMRXS66I.js.map
|
package/dist/cli/dev.js
CHANGED