openfox 2.0.53 → 2.0.55
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/{chat-handler-FGRCJX76.js → chat-handler-C3NO5RY3.js} +5 -5
- package/dist/{chunk-QOHRXWK4.js → chunk-5UHSEVAP.js} +2 -2
- package/dist/{chunk-KUE7ASKH.js → chunk-7V3JBKYK.js} +20 -20
- package/dist/{chunk-VRGRAQDG.js → chunk-CYJEQF7U.js} +79 -9
- package/dist/{chunk-N3Z4SMEH.js → chunk-JQ4FVPIM.js} +2 -2
- package/dist/{chunk-PBGOZMVY.js → chunk-OCILP3SJ.js} +11 -39
- package/dist/{chunk-HVLNOTRE.js → chunk-PRYVRROH.js} +4 -4
- package/dist/{chunk-3KVWOPRN.js → chunk-ZIW47U5D.js} +22 -92
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{manager-R3EMNOPR.js → manager-FV4BDEVU.js} +3 -3
- package/dist/{orchestrator-5LSO63RB.js → orchestrator-2OPDGKLZ.js} +5 -5
- package/dist/package.json +3 -1
- package/dist/{processor-F5FMOPOQ.js → processor-VUAIB4Z6.js} +5 -5
- package/dist/{serve-DMHI2CWZ.js → serve-UX6YYIMR.js} +7 -7
- package/dist/server/index.js +6 -6
- package/dist/{server-ZQ5NGHPD.js → server-ILO7GYZE.js} +6 -6
- package/dist/{store-SF7CDOQT.js → store-TTU4UQQ7.js} +2 -2
- package/dist/{tools-2QMJFAXE.js → tools-32PBXC2S.js} +4 -4
- package/dist/web/assets/{index-Bc9jabDX.js → index-ByGymMJ1.js} +2 -2
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +3 -1
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
} from "./chunk-UOKVBO67.js";
|
|
6
6
|
import {
|
|
7
7
|
runChatTurn
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-JQ4FVPIM.js";
|
|
9
|
+
import "./chunk-ZIW47U5D.js";
|
|
10
10
|
import "./chunk-LBGHZLLH.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-OCILP3SJ.js";
|
|
12
|
+
import "./chunk-CYJEQF7U.js";
|
|
13
13
|
import "./chunk-NWO6GRYE.js";
|
|
14
14
|
import {
|
|
15
15
|
createChatMessageMessage,
|
|
@@ -154,4 +154,4 @@ export {
|
|
|
154
154
|
startChatSession,
|
|
155
155
|
stopSessionExecution
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=chat-handler-
|
|
157
|
+
//# sourceMappingURL=chat-handler-C3NO5RY3.js.map
|
|
@@ -208,7 +208,7 @@ async function runCli(options) {
|
|
|
208
208
|
if (!configExists) {
|
|
209
209
|
await runNetworkSetup(mode);
|
|
210
210
|
}
|
|
211
|
-
const { runServe } = await import("./serve-
|
|
211
|
+
const { runServe } = await import("./serve-UX6YYIMR.js");
|
|
212
212
|
const serveOptions = { mode };
|
|
213
213
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
214
214
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -220,4 +220,4 @@ async function runCli(options) {
|
|
|
220
220
|
export {
|
|
221
221
|
runCli
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-5UHSEVAP.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
tokenFromPassword,
|
|
22
22
|
verifyPassword,
|
|
23
23
|
workflowExists
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PRYVRROH.js";
|
|
25
25
|
import {
|
|
26
26
|
agentExists,
|
|
27
27
|
createToolRegistry,
|
|
@@ -61,11 +61,11 @@ import {
|
|
|
61
61
|
setMcpTools,
|
|
62
62
|
setNotifyMcpServersChanged,
|
|
63
63
|
skillExists
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-ZIW47U5D.js";
|
|
65
65
|
import {
|
|
66
66
|
getPathSeparator,
|
|
67
67
|
isAbsolutePath
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-OCILP3SJ.js";
|
|
69
69
|
import {
|
|
70
70
|
createMcpTools
|
|
71
71
|
} from "./chunk-NWO6GRYE.js";
|
|
@@ -3849,7 +3849,7 @@ import { Router as Router7 } from "express";
|
|
|
3849
3849
|
import { spawn as spawn2 } from "child_process";
|
|
3850
3850
|
|
|
3851
3851
|
// src/constants.ts
|
|
3852
|
-
var VERSION = "2.0.
|
|
3852
|
+
var VERSION = "2.0.55";
|
|
3853
3853
|
|
|
3854
3854
|
// src/server/routes/auto-update.ts
|
|
3855
3855
|
var updateInProgress = false;
|
|
@@ -4050,7 +4050,7 @@ async function createServerHandle(config4) {
|
|
|
4050
4050
|
setMcpTools(mcpTools);
|
|
4051
4051
|
logger.info("MCP tools registered", { count: mcpTools.length });
|
|
4052
4052
|
}
|
|
4053
|
-
const { signalMcpReady } = await import("./server-
|
|
4053
|
+
const { signalMcpReady } = await import("./server-ILO7GYZE.js");
|
|
4054
4054
|
signalMcpReady();
|
|
4055
4055
|
});
|
|
4056
4056
|
const app = express();
|
|
@@ -4243,7 +4243,7 @@ async function createServerHandle(config4) {
|
|
|
4243
4243
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
4244
4244
|
const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
|
|
4245
4245
|
const { buildMessagesFromStoredEvents } = await import("./folding-2BGFLV5J.js");
|
|
4246
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4246
|
+
const { getPendingQuestionsForSession } = await import("./tools-32PBXC2S.js");
|
|
4247
4247
|
const session = sessionManager.getSession(req.params.id);
|
|
4248
4248
|
if (!session) {
|
|
4249
4249
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -4262,8 +4262,8 @@ async function createServerHandle(config4) {
|
|
|
4262
4262
|
if (!session) {
|
|
4263
4263
|
return res.status(404).json({ error: "Session not found" });
|
|
4264
4264
|
}
|
|
4265
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
4266
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
4265
|
+
const { stopSessionExecution } = await import("./chat-handler-C3NO5RY3.js");
|
|
4266
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-32PBXC2S.js");
|
|
4267
4267
|
sessionManager.clearMessageQueue(sessionId);
|
|
4268
4268
|
stopSessionExecution(sessionId, sessionManager);
|
|
4269
4269
|
abortSession(sessionId);
|
|
@@ -4417,7 +4417,7 @@ async function createServerHandle(config4) {
|
|
|
4417
4417
|
if (!callId || approved === void 0) {
|
|
4418
4418
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
4419
4419
|
}
|
|
4420
|
-
const { providePathConfirmation } = await import("./tools-
|
|
4420
|
+
const { providePathConfirmation } = await import("./tools-32PBXC2S.js");
|
|
4421
4421
|
const result = providePathConfirmation(callId, approved, alwaysAllow);
|
|
4422
4422
|
if (!result.found) {
|
|
4423
4423
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
@@ -4425,7 +4425,7 @@ async function createServerHandle(config4) {
|
|
|
4425
4425
|
const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
|
|
4426
4426
|
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-2BGFLV5J.js");
|
|
4427
4427
|
const { createSessionStateMessage } = await import("./protocol-CTNE3ANP.js");
|
|
4428
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4428
|
+
const { getPendingQuestionsForSession } = await import("./tools-32PBXC2S.js");
|
|
4429
4429
|
const eventStore = getEventStore2();
|
|
4430
4430
|
const events = eventStore.getEvents(sessionId);
|
|
4431
4431
|
const messages = buildMessagesFromStoredEvents(events);
|
|
@@ -4446,7 +4446,7 @@ async function createServerHandle(config4) {
|
|
|
4446
4446
|
if (!skip && typeof answer !== "string") {
|
|
4447
4447
|
return res.status(400).json({ error: "answer is required when not skipping" });
|
|
4448
4448
|
}
|
|
4449
|
-
const { provideAnswer } = await import("./tools-
|
|
4449
|
+
const { provideAnswer } = await import("./tools-32PBXC2S.js");
|
|
4450
4450
|
const found = provideAnswer(callId, answer ?? "", skip ?? false);
|
|
4451
4451
|
if (!found) {
|
|
4452
4452
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -4482,7 +4482,7 @@ async function createServerHandle(config4) {
|
|
|
4482
4482
|
if (sessionManager.isWarmedUp(sessionId)) {
|
|
4483
4483
|
return res.json({ success: false, reason: "already_warmed" });
|
|
4484
4484
|
}
|
|
4485
|
-
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-
|
|
4485
|
+
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-2OPDGKLZ.js");
|
|
4486
4486
|
runAgentTurn(
|
|
4487
4487
|
{
|
|
4488
4488
|
sessionManager,
|
|
@@ -4525,8 +4525,8 @@ async function createServerHandle(config4) {
|
|
|
4525
4525
|
if (!session) {
|
|
4526
4526
|
return res.status(404).json({ error: "Session not found" });
|
|
4527
4527
|
}
|
|
4528
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
4529
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
4528
|
+
const { stopSessionExecution } = await import("./chat-handler-C3NO5RY3.js");
|
|
4529
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-32PBXC2S.js");
|
|
4530
4530
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
4531
4531
|
sessionManager.clearMessageQueue(sessionId);
|
|
4532
4532
|
stopSessionExecution(sessionId, sessionManager);
|
|
@@ -5036,7 +5036,7 @@ async function createServerHandle(config4) {
|
|
|
5036
5036
|
});
|
|
5037
5037
|
async function rebuildMcpTools() {
|
|
5038
5038
|
const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-MOGEI6TP.js");
|
|
5039
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
5039
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-32PBXC2S.js");
|
|
5040
5040
|
const mcpTools = createMcpTools2(mcpManager);
|
|
5041
5041
|
setMcpTools2(mcpTools);
|
|
5042
5042
|
}
|
|
@@ -5195,13 +5195,13 @@ async function createServerHandle(config4) {
|
|
|
5195
5195
|
})
|
|
5196
5196
|
);
|
|
5197
5197
|
app.get("/api/sessions/:id/background-processes", async (req, res) => {
|
|
5198
|
-
const { getSessionProcesses } = await import("./manager-
|
|
5198
|
+
const { getSessionProcesses } = await import("./manager-FV4BDEVU.js");
|
|
5199
5199
|
const sessionId = req.params.id;
|
|
5200
5200
|
const processes = getSessionProcesses(sessionId);
|
|
5201
5201
|
res.json({ processes });
|
|
5202
5202
|
});
|
|
5203
5203
|
app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
|
|
5204
|
-
const { stopProcess } = await import("./manager-
|
|
5204
|
+
const { stopProcess } = await import("./manager-FV4BDEVU.js");
|
|
5205
5205
|
const sessionId = req.params.id;
|
|
5206
5206
|
const processId = req.params.processId;
|
|
5207
5207
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -5344,7 +5344,7 @@ async function createServerHandle(config4) {
|
|
|
5344
5344
|
const state = sessionManager.getContextState(sessionId);
|
|
5345
5345
|
wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
|
|
5346
5346
|
});
|
|
5347
|
-
const { QueueProcessor } = await import("./processor-
|
|
5347
|
+
const { QueueProcessor } = await import("./processor-VUAIB4Z6.js");
|
|
5348
5348
|
const queueProcessor = new QueueProcessor({
|
|
5349
5349
|
sessionManager,
|
|
5350
5350
|
providerManager,
|
|
@@ -5387,7 +5387,7 @@ async function createServerHandle(config4) {
|
|
|
5387
5387
|
await mcpManager.disconnectAll();
|
|
5388
5388
|
const { stopAllInspectProxies } = await import("./inspect-proxy-BV25JERQ.js");
|
|
5389
5389
|
stopAllInspectProxies();
|
|
5390
|
-
const { cleanupAllProcesses } = await import("./store-
|
|
5390
|
+
const { cleanupAllProcesses } = await import("./store-TTU4UQQ7.js");
|
|
5391
5391
|
cleanupAllProcesses();
|
|
5392
5392
|
viteServer?.close();
|
|
5393
5393
|
for (const client of wss.clients) {
|
|
@@ -5419,4 +5419,4 @@ export {
|
|
|
5419
5419
|
createServerHandle,
|
|
5420
5420
|
createServer
|
|
5421
5421
|
};
|
|
5422
|
-
//# sourceMappingURL=chunk-
|
|
5422
|
+
//# sourceMappingURL=chunk-7V3JBKYK.js.map
|
|
@@ -1,3 +1,78 @@
|
|
|
1
|
+
// src/server/utils/process-tree.ts
|
|
2
|
+
import { spawn, execFile } from "child_process";
|
|
3
|
+
import { setTimeout as sleep } from "timers/promises";
|
|
4
|
+
var SIGKILL_TIMEOUT_MS = 200;
|
|
5
|
+
async function getDescendantPids(rootPid) {
|
|
6
|
+
try {
|
|
7
|
+
const { stdout } = await new Promise((resolve, reject) => {
|
|
8
|
+
execFile("ps", ["-eo", "pid=,ppid="], { timeout: 5e3 }, (err, stdout2) => {
|
|
9
|
+
if (err) reject(err);
|
|
10
|
+
else resolve({ stdout: stdout2 });
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
const children = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const line of stdout.trim().split("\n")) {
|
|
15
|
+
const parts = line.trim().split(/\s+/);
|
|
16
|
+
const pid = parseInt(parts[0], 10);
|
|
17
|
+
const ppid = parseInt(parts[1], 10);
|
|
18
|
+
if (!isNaN(pid) && !isNaN(ppid) && pid > 0 && ppid >= 0) {
|
|
19
|
+
if (!children.has(ppid)) children.set(ppid, []);
|
|
20
|
+
children.get(ppid).push(pid);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const descendants = [];
|
|
24
|
+
const queue = [rootPid];
|
|
25
|
+
while (queue.length > 0) {
|
|
26
|
+
const current = queue.shift();
|
|
27
|
+
const kids = children.get(current);
|
|
28
|
+
if (kids) {
|
|
29
|
+
for (const kid of kids) {
|
|
30
|
+
descendants.push(kid);
|
|
31
|
+
queue.push(kid);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return descendants;
|
|
36
|
+
} catch {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function killProcess(pid, signal) {
|
|
41
|
+
try {
|
|
42
|
+
process.kill(pid, signal);
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function killProcessTree(pid) {
|
|
47
|
+
if (process.platform === "win32") {
|
|
48
|
+
await new Promise((resolve) => {
|
|
49
|
+
const killer = spawn("taskkill", ["/pid", String(pid), "/f", "/t"], {
|
|
50
|
+
stdio: "ignore",
|
|
51
|
+
windowsHide: true
|
|
52
|
+
});
|
|
53
|
+
killer.once("exit", () => resolve());
|
|
54
|
+
killer.once("error", () => resolve());
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const allPids = await getDescendantPids(pid);
|
|
59
|
+
allPids.push(pid);
|
|
60
|
+
for (const p of allPids) {
|
|
61
|
+
killProcess(p, "SIGTERM");
|
|
62
|
+
}
|
|
63
|
+
await sleep(SIGKILL_TIMEOUT_MS);
|
|
64
|
+
for (const p of allPids) {
|
|
65
|
+
killProcess(p, "SIGKILL");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function terminateProcessTree(proc, options) {
|
|
69
|
+
const pid = proc.pid;
|
|
70
|
+
if (!pid || options?.exited?.()) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
await killProcessTree(pid);
|
|
74
|
+
}
|
|
75
|
+
|
|
1
76
|
// src/server/tools/background-process/store.ts
|
|
2
77
|
var MAX_PER_SESSION = 5;
|
|
3
78
|
var processesBySession = /* @__PURE__ */ new Map();
|
|
@@ -115,14 +190,7 @@ function cleanupAllProcesses() {
|
|
|
115
190
|
for (const sessionProcesses of processesBySession.values()) {
|
|
116
191
|
for (const proc of sessionProcesses.values()) {
|
|
117
192
|
if (proc.status === "running" && proc.pid) {
|
|
118
|
-
|
|
119
|
-
process.kill(-proc.pid, "SIGTERM");
|
|
120
|
-
} catch {
|
|
121
|
-
try {
|
|
122
|
-
process.kill(proc.pid, "SIGTERM");
|
|
123
|
-
} catch {
|
|
124
|
-
}
|
|
125
|
-
}
|
|
193
|
+
killProcessTree(proc.pid);
|
|
126
194
|
}
|
|
127
195
|
}
|
|
128
196
|
}
|
|
@@ -131,6 +199,8 @@ function cleanupAllProcesses() {
|
|
|
131
199
|
}
|
|
132
200
|
|
|
133
201
|
export {
|
|
202
|
+
killProcessTree,
|
|
203
|
+
terminateProcessTree,
|
|
134
204
|
getMaxPerSession,
|
|
135
205
|
getProcess,
|
|
136
206
|
getSessionProcesses,
|
|
@@ -146,4 +216,4 @@ export {
|
|
|
146
216
|
getProcessById,
|
|
147
217
|
cleanupAllProcesses
|
|
148
218
|
};
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
219
|
+
//# sourceMappingURL=chunk-CYJEQF7U.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
loadAllAgentsDefault,
|
|
13
13
|
processEventsForConversation,
|
|
14
14
|
runTopLevelAgentLoop
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZIW47U5D.js";
|
|
16
16
|
import {
|
|
17
17
|
TurnMetrics,
|
|
18
18
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -324,4 +324,4 @@ export {
|
|
|
324
324
|
runAgentTurn,
|
|
325
325
|
injectWorkflowKickoffIfNeeded
|
|
326
326
|
};
|
|
327
|
-
//# sourceMappingURL=chunk-
|
|
327
|
+
//# sourceMappingURL=chunk-JQ4FVPIM.js.map
|
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
getLogsPaginated,
|
|
5
5
|
getProcess,
|
|
6
6
|
getSessionProcesses,
|
|
7
|
+
killProcessTree,
|
|
7
8
|
removeProcess,
|
|
8
9
|
startProcess,
|
|
9
10
|
updateStatus
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CYJEQF7U.js";
|
|
11
12
|
|
|
12
13
|
// src/server/tools/background-process/manager.ts
|
|
13
14
|
import { spawn } from "child_process";
|
|
@@ -35,7 +36,6 @@ function isAbsolutePath(path) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
// src/server/tools/background-process/manager.ts
|
|
38
|
-
var STOP_SIGNAL_TIMEOUT = 5e3;
|
|
39
39
|
var listeners = /* @__PURE__ */ new Set();
|
|
40
40
|
function onProcessEvent(callback) {
|
|
41
41
|
listeners.add(callback);
|
|
@@ -122,42 +122,14 @@ async function stopProcess(processId, sessionId) {
|
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
updateStatus(processId, sessionId, "stopping");
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
setTimeout(() => {
|
|
134
|
-
try {
|
|
135
|
-
process.kill(-pid, "SIGKILL");
|
|
136
|
-
} catch {
|
|
137
|
-
try {
|
|
138
|
-
process.kill(pid, "SIGKILL");
|
|
139
|
-
} catch {
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
resolve();
|
|
143
|
-
}, STOP_SIGNAL_TIMEOUT);
|
|
144
|
-
});
|
|
145
|
-
updateStatus(processId, sessionId, "exited", null);
|
|
146
|
-
emitProcessEvent(processId, {
|
|
147
|
-
type: "backgroundProcess.removed",
|
|
148
|
-
payload: { processId },
|
|
149
|
-
sessionId
|
|
150
|
-
});
|
|
151
|
-
removeProcess(processId, sessionId);
|
|
152
|
-
} catch {
|
|
153
|
-
updateStatus(processId, sessionId, "exited", 1);
|
|
154
|
-
emitProcessEvent(processId, {
|
|
155
|
-
type: "backgroundProcess.removed",
|
|
156
|
-
payload: { processId },
|
|
157
|
-
sessionId
|
|
158
|
-
});
|
|
159
|
-
removeProcess(processId, sessionId);
|
|
160
|
-
}
|
|
125
|
+
await killProcessTree(proc.pid);
|
|
126
|
+
updateStatus(processId, sessionId, "exited", null);
|
|
127
|
+
emitProcessEvent(processId, {
|
|
128
|
+
type: "backgroundProcess.removed",
|
|
129
|
+
payload: { processId },
|
|
130
|
+
sessionId
|
|
131
|
+
});
|
|
132
|
+
removeProcess(processId, sessionId);
|
|
161
133
|
}
|
|
162
134
|
function getProcessStatus(processId, sessionId) {
|
|
163
135
|
return getProcess(processId, sessionId);
|
|
@@ -181,4 +153,4 @@ export {
|
|
|
181
153
|
getSessionProcesses2 as getSessionProcesses,
|
|
182
154
|
getProcessLogs
|
|
183
155
|
};
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-OCILP3SJ.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
injectWorkflowKickoffIfNeeded,
|
|
3
3
|
runAgentTurn,
|
|
4
4
|
runChatTurn
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JQ4FVPIM.js";
|
|
6
6
|
import {
|
|
7
7
|
applyDynamicContext,
|
|
8
8
|
checkAborted,
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
loadAllAgentsDefault,
|
|
17
17
|
saveItemToDir,
|
|
18
18
|
spawnShellProcess
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZIW47U5D.js";
|
|
20
20
|
import {
|
|
21
21
|
getPlatformShell,
|
|
22
22
|
onProcessEvent
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OCILP3SJ.js";
|
|
24
24
|
import {
|
|
25
25
|
createChatErrorMessage,
|
|
26
26
|
createChatMessageMessage,
|
|
@@ -2091,4 +2091,4 @@ export {
|
|
|
2091
2091
|
signalMcpReady,
|
|
2092
2092
|
createWebSocketServer
|
|
2093
2093
|
};
|
|
2094
|
-
//# sourceMappingURL=chunk-
|
|
2094
|
+
//# sourceMappingURL=chunk-PRYVRROH.js.map
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
getSessionProcesses,
|
|
10
10
|
startProcessCommand,
|
|
11
11
|
stopProcess
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OCILP3SJ.js";
|
|
13
13
|
import {
|
|
14
14
|
getMaxPerSession,
|
|
15
|
-
getSessionProcessCount
|
|
16
|
-
|
|
15
|
+
getSessionProcessCount,
|
|
16
|
+
terminateProcessTree
|
|
17
|
+
} from "./chunk-CYJEQF7U.js";
|
|
17
18
|
import {
|
|
18
19
|
createMcpTools
|
|
19
20
|
} from "./chunk-NWO6GRYE.js";
|
|
@@ -793,54 +794,18 @@ function stringToUtf32(str, littleEndian) {
|
|
|
793
794
|
}
|
|
794
795
|
|
|
795
796
|
// src/server/tools/read.ts
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
"
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
".bmp": "image/bmp",
|
|
803
|
-
".svg": "image/svg+xml"
|
|
804
|
-
};
|
|
805
|
-
var IMAGE_SIGNATURES = [
|
|
806
|
-
{
|
|
807
|
-
mimeType: "image/png",
|
|
808
|
-
signature: Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]),
|
|
809
|
-
extension: ".png"
|
|
810
|
-
},
|
|
811
|
-
{ mimeType: "image/jpeg", signature: Buffer.from([255, 216, 255]), extension: ".jpg" },
|
|
812
|
-
{ mimeType: "image/gif", signature: Buffer.from([71, 73, 70, 56]), extension: ".gif" },
|
|
813
|
-
{ mimeType: "image/webp", signature: Buffer.from([]), extension: ".webp" },
|
|
814
|
-
// WebP handled specially
|
|
815
|
-
{ mimeType: "image/bmp", signature: Buffer.from([66, 77]), extension: ".bmp" }
|
|
816
|
-
];
|
|
817
|
-
function detectImageType(buffer, filePath) {
|
|
818
|
-
for (const { mimeType: mimeType2, signature } of IMAGE_SIGNATURES) {
|
|
819
|
-
if (mimeType2 === "image/webp") {
|
|
820
|
-
if (buffer.length >= 12 && buffer[0] === 82 && buffer[1] === 73 && buffer[2] === 70 && buffer[3] === 70 && buffer[8] === 87 && buffer[9] === 69 && buffer[10] === 66 && buffer[11] === 80) {
|
|
821
|
-
return mimeType2;
|
|
822
|
-
}
|
|
823
|
-
} else if (buffer.length >= signature.length) {
|
|
824
|
-
let matches = true;
|
|
825
|
-
for (let i = 0; i < signature.length; i++) {
|
|
826
|
-
if (buffer[i] !== signature[i]) {
|
|
827
|
-
matches = false;
|
|
828
|
-
break;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
if (matches) {
|
|
832
|
-
return mimeType2;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
797
|
+
import { fileTypeFromBuffer } from "file-type";
|
|
798
|
+
async function detectImageType(buffer, filePath) {
|
|
799
|
+
const fileType = await fileTypeFromBuffer(buffer);
|
|
800
|
+
const imageMimeTypes = ["image/png", "image/jpeg", "image/gif", "image/webp", "image/bmp", "image/svg+xml"];
|
|
801
|
+
if (fileType?.mime && imageMimeTypes.includes(fileType.mime)) {
|
|
802
|
+
return fileType.mime;
|
|
835
803
|
}
|
|
836
804
|
const ext = extname(filePath).toLowerCase();
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
if (buffer.length > 0) {
|
|
842
|
-
const textStart = buffer.subarray(0, Math.min(100, buffer.length)).toString("utf-8");
|
|
843
|
-
if (textStart.includes("<svg")) {
|
|
805
|
+
if (ext === ".svg" && buffer.length > 0) {
|
|
806
|
+
const content = buffer.toString("utf-8");
|
|
807
|
+
const trimmedStart = content.trimStart();
|
|
808
|
+
if (trimmedStart.startsWith("<?xml") || trimmedStart.startsWith("<svg")) {
|
|
844
809
|
return "image/svg+xml";
|
|
845
810
|
}
|
|
846
811
|
}
|
|
@@ -924,7 +889,7 @@ var readFileTool = createTool(
|
|
|
924
889
|
return helpers.error(`File not found: ${args.path}`);
|
|
925
890
|
}
|
|
926
891
|
const rawBuffer = await readFile2(fullPath);
|
|
927
|
-
const mimeType = detectImageType(rawBuffer, args.path);
|
|
892
|
+
const mimeType = await detectImageType(rawBuffer, args.path);
|
|
928
893
|
if (mimeType) {
|
|
929
894
|
const base64Data = rawBuffer.toString("base64");
|
|
930
895
|
const dataUrl = `data:${mimeType};base64,${base64Data}`;
|
|
@@ -1356,41 +1321,6 @@ function spawnShellProcess(command, cwd, _signal, detached = false) {
|
|
|
1356
1321
|
});
|
|
1357
1322
|
}
|
|
1358
1323
|
|
|
1359
|
-
// src/server/utils/process-tree.ts
|
|
1360
|
-
import { spawn as spawn2 } from "child_process";
|
|
1361
|
-
import { setTimeout as sleep } from "timers/promises";
|
|
1362
|
-
var SIGKILL_TIMEOUT_MS = 200;
|
|
1363
|
-
async function terminateProcessTree(proc, options) {
|
|
1364
|
-
const pid = proc.pid;
|
|
1365
|
-
if (!pid || options?.exited?.()) {
|
|
1366
|
-
return;
|
|
1367
|
-
}
|
|
1368
|
-
if (process.platform === "win32") {
|
|
1369
|
-
await new Promise((resolve6) => {
|
|
1370
|
-
const killer = spawn2("taskkill", ["/pid", String(pid), "/f", "/t"], {
|
|
1371
|
-
stdio: "ignore",
|
|
1372
|
-
windowsHide: true
|
|
1373
|
-
});
|
|
1374
|
-
killer.once("exit", () => resolve6());
|
|
1375
|
-
killer.once("error", () => resolve6());
|
|
1376
|
-
});
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
try {
|
|
1380
|
-
process.kill(-pid, "SIGTERM");
|
|
1381
|
-
await sleep(SIGKILL_TIMEOUT_MS);
|
|
1382
|
-
if (!options?.exited?.()) {
|
|
1383
|
-
process.kill(-pid, "SIGKILL");
|
|
1384
|
-
}
|
|
1385
|
-
} catch {
|
|
1386
|
-
proc.kill("SIGTERM");
|
|
1387
|
-
await sleep(SIGKILL_TIMEOUT_MS);
|
|
1388
|
-
if (!options?.exited?.()) {
|
|
1389
|
-
proc.kill("SIGKILL");
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
1324
|
// src/server/tools/shell-tail.ts
|
|
1395
1325
|
var TAIL_END_RE = /^(.*?)\s*\|\s*tail\s+(?:-n\s+)?-?(\d+)\s*$/;
|
|
1396
1326
|
function stripTailPipe(command) {
|
|
@@ -3481,7 +3411,7 @@ var callSubAgentTool = {
|
|
|
3481
3411
|
};
|
|
3482
3412
|
}
|
|
3483
3413
|
try {
|
|
3484
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3414
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-32PBXC2S.js");
|
|
3485
3415
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3486
3416
|
const turnMetrics = new TurnMetrics();
|
|
3487
3417
|
const result = await executeSubAgent({
|
|
@@ -3731,7 +3661,7 @@ var webFetchTool = createTool(
|
|
|
3731
3661
|
);
|
|
3732
3662
|
|
|
3733
3663
|
// src/server/dev-server/manager.ts
|
|
3734
|
-
import { spawn as
|
|
3664
|
+
import { spawn as spawn2 } from "child_process";
|
|
3735
3665
|
import { readFile as readFile7, writeFile as writeFile6, mkdir as mkdir5 } from "fs/promises";
|
|
3736
3666
|
import { resolve as resolve5, join as join7 } from "path";
|
|
3737
3667
|
var MAX_LOG_LINES = 2e3;
|
|
@@ -3845,7 +3775,7 @@ var DevServerManager = class {
|
|
|
3845
3775
|
}
|
|
3846
3776
|
const resolved = this.resolveWorkdir(workdir);
|
|
3847
3777
|
const shell = getPlatformShell();
|
|
3848
|
-
const proc =
|
|
3778
|
+
const proc = spawn2(shell.command, [...shell.args, config.command], {
|
|
3849
3779
|
cwd: resolved,
|
|
3850
3780
|
env: { ...process.env, FORCE_COLOR: "1" },
|
|
3851
3781
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -4297,7 +4227,7 @@ function resolveAgentDef2(sessionManager, sessionId) {
|
|
|
4297
4227
|
}
|
|
4298
4228
|
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
4299
4229
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4300
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
4230
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-32PBXC2S.js");
|
|
4301
4231
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4302
4232
|
const toolFingerprint = getToolFingerprint(tools);
|
|
4303
4233
|
const allAgents = await loadAllAgentsDefault();
|
|
@@ -4310,7 +4240,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
|
4310
4240
|
async function computeSessionHash(sessionManager, sessionId) {
|
|
4311
4241
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4312
4242
|
const agentDef = await resolveAgentDef2(sessionManager, sessionId);
|
|
4313
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
4243
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-32PBXC2S.js");
|
|
4314
4244
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4315
4245
|
const toolFingerprint = getToolFingerprint(tools);
|
|
4316
4246
|
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -4417,7 +4347,7 @@ var mcpConfigTool = createTool(
|
|
|
4417
4347
|
await saveGlobalConfig(mcpConfigMode, { ...globalConfig, mcpServers: updated });
|
|
4418
4348
|
}
|
|
4419
4349
|
async function rebuildTools() {
|
|
4420
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4350
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-32PBXC2S.js");
|
|
4421
4351
|
const mcpTools = createMcpTools(mcpManagerForTools);
|
|
4422
4352
|
setMcpTools2(mcpTools);
|
|
4423
4353
|
}
|
|
@@ -5087,4 +5017,4 @@ export {
|
|
|
5087
5017
|
getToolRegistryForAgent,
|
|
5088
5018
|
createToolRegistry
|
|
5089
5019
|
};
|
|
5090
|
-
//# sourceMappingURL=chunk-
|
|
5020
|
+
//# sourceMappingURL=chunk-ZIW47U5D.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
onProcessEvent,
|
|
7
7
|
startProcessCommand,
|
|
8
8
|
stopProcess
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-OCILP3SJ.js";
|
|
10
|
+
import "./chunk-CYJEQF7U.js";
|
|
11
11
|
import "./chunk-5WRI5ZAA.js";
|
|
12
12
|
export {
|
|
13
13
|
createProcess,
|
|
@@ -18,4 +18,4 @@ export {
|
|
|
18
18
|
startProcessCommand,
|
|
19
19
|
stopProcess
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=manager-
|
|
21
|
+
//# sourceMappingURL=manager-FV4BDEVU.js.map
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
injectWorkflowKickoffIfNeeded,
|
|
3
3
|
runAgentTurn,
|
|
4
4
|
runChatTurn
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-JQ4FVPIM.js";
|
|
6
|
+
import "./chunk-ZIW47U5D.js";
|
|
7
7
|
import "./chunk-LBGHZLLH.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-OCILP3SJ.js";
|
|
9
|
+
import "./chunk-CYJEQF7U.js";
|
|
10
10
|
import "./chunk-NWO6GRYE.js";
|
|
11
11
|
import "./chunk-F4PMNP7S.js";
|
|
12
12
|
import "./chunk-EU3WWTFH.js";
|
|
@@ -43,4 +43,4 @@ export {
|
|
|
43
43
|
runAgentTurn,
|
|
44
44
|
runChatTurn
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=orchestrator-
|
|
46
|
+
//# sourceMappingURL=orchestrator-2OPDGKLZ.js.map
|