openfox 2.0.88 → 2.0.90
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/CHANGELOG.md +41 -14
- package/dist/CHANGELOG.md +41 -14
- package/dist/{chat-handler-HB3XN6YE.js → chat-handler-JJQ3JBNF.js} +17 -17
- package/dist/{chunk-BNQTJFHQ.js → chunk-2J7SLQXL.js} +4 -2
- package/dist/{chunk-DZGVDT2F.js → chunk-2QIYPQQH.js} +4 -4
- package/dist/{chunk-76ADL7EV.js → chunk-3HH5UDVQ.js} +7 -7
- package/dist/{chunk-V4V6UGZZ.js → chunk-54LPSOO3.js} +3 -3
- package/dist/{chunk-7PZBCATU.js → chunk-67AVIA5G.js} +29 -7
- package/dist/{chunk-6YJ5W4KV.js → chunk-6PHUBUVH.js} +219 -97
- package/dist/{chunk-B53QORTX.js → chunk-74P4DTCU.js} +2 -2
- package/dist/{chunk-EWUDWUE3.js → chunk-7GF45BJV.js} +10 -10
- package/dist/{chunk-SUT4OSXR.js → chunk-BCVM2SPJ.js} +3 -3
- package/dist/{chunk-RGUUZD5B.js → chunk-EZWSS7LG.js} +5 -1
- package/dist/{chunk-XNPVKFOJ.js → chunk-FIXFSGGZ.js} +2 -2
- package/dist/{chunk-5UHHGQ7Q.js → chunk-GJN622K4.js} +4 -4
- package/dist/{chunk-LD46ASP5.js → chunk-GR63QQFE.js} +2 -2
- package/dist/{chunk-EYIWUONA.js → chunk-J2IVK667.js} +2 -2
- package/dist/{chunk-QMSTCWYK.js → chunk-KFKDFZJB.js} +15 -15
- package/dist/{chunk-BOO6VR2T.js → chunk-L6B6R5SN.js} +2 -2
- package/dist/{chunk-GO54OTGE.js → chunk-LRTHLIRH.js} +11 -11
- package/dist/{chunk-TW3PNLMA.js → chunk-NJ3XNK3V.js} +2 -2
- package/dist/{chunk-GLRBRQGJ.js → chunk-OTKOSY6B.js} +2 -2
- package/dist/{chunk-6AE3JPDJ.js → chunk-Q6AKRIM2.js} +7 -2
- package/dist/{chunk-2DWWLQVQ.js → chunk-VX5NASLY.js} +3 -3
- package/dist/{chunk-TXGW36XL.js → chunk-VXKY7J7W.js} +2 -2
- package/dist/{chunk-WWOZHM6D.js → chunk-XKZZHAEZ.js} +2 -2
- package/dist/chunk-XMJLSFY5.js +7 -0
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-W3AYWMJM.js → client-2JELOQF7.js} +5 -5
- package/dist/{compactor-7JU5CXSG.js → compactor-OW343YIO.js} +10 -10
- package/dist/{events-Z3AJVFSP.js → events-U2BYC5MN.js} +7 -7
- package/dist/{folding-LWKKC4RQ.js → folding-RE7ZL7H7.js} +5 -5
- package/dist/http-client-7QCN2R44.js +11 -0
- package/dist/{inspect-proxy-DRYIIH4O.js → inspect-proxy-CN2MUFQ5.js} +4 -4
- package/dist/{manager-657CWC5Z.js → manager-X665RYDA.js} +5 -5
- package/dist/{orchestrator-KTOC65UU.js → orchestrator-BMU7DZ6F.js} +16 -16
- package/dist/package.json +1 -1
- package/dist/{path-security-XXWK5ZCL.js → path-security-3BTT5ZCM.js} +8 -8
- package/dist/{platform-MVVEGKPE.js → platform-2XTX4MRW.js} +4 -4
- package/dist/{processor-3UTJE7EQ.js → processor-YIVQO2OY.js} +17 -17
- package/dist/{project-creator-NNUITNUI.js → project-creator-W5VW22DC.js} +3 -3
- package/dist/{projects-ZGJGICGT.js → projects-HZ3WVTKG.js} +3 -3
- package/dist/{protocol-BzTZcNEh.d.ts → protocol-DKJPL2Ci.d.ts} +1 -1
- package/dist/provider/index.d.ts +4 -4
- package/dist/{provider-YRNABOCC.js → provider-IKKXQW6S.js} +6 -6
- package/dist/{provider-manager-W4MEPXB5.js → provider-manager-I35NHMOO.js} +6 -6
- package/dist/{serve-AZ5QSSHE.js → serve-Q45HTS4J.js} +23 -23
- package/dist/server/index.d.ts +16 -3
- package/dist/server/index.js +22 -22
- package/dist/{server-T4YPLZDF.js → server-OP2Q2F3S.js} +18 -18
- package/dist/{sessions-KDQ5TMHX.js → sessions-SFM7XA3R.js} +5 -5
- package/dist/{settings-SM3K6S74.js → settings-TCNHSYFX.js} +3 -3
- package/dist/shared/index.d.ts +3 -3
- package/dist/{tools-A2XBFPRO.js → tools-X7NAB4LZ.js} +15 -15
- package/dist/{types-CrLD4iRS.d.ts → types-B97Fb4vm.d.ts} +1 -1
- package/dist/{types-B4wa_vGm.d.ts → types-C4NrLRR1.d.ts} +1 -0
- package/dist/{update-4D76LEVO.js → update-HHQGMX7P.js} +2 -2
- package/dist/web/assets/{index-BRy1cx3_.js → index-BB8bp4oL.js} +89 -79
- package/dist/web/assets/{index-D8gCHkwE.css → index-flzB-55v.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/{workspace-MMV6V5P4.js → workspace-N4QHV6J2.js} +4 -2
- package/package.json +1 -1
- package/dist/chunk-FGK7QLCZ.js +0 -7
- package/dist/http-client-LITXNO6R.js +0 -11
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
tokenFromPassword,
|
|
22
22
|
verifyPassword,
|
|
23
23
|
workflowExists
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LRTHLIRH.js";
|
|
25
25
|
import {
|
|
26
26
|
createToolRegistry,
|
|
27
27
|
deleteOwnedSkill,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
setSkillEnabled,
|
|
48
48
|
skillExists,
|
|
49
49
|
updateOwnedSkill
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-KFKDFZJB.js";
|
|
51
51
|
import {
|
|
52
52
|
createMcpTools
|
|
53
53
|
} from "./chunk-NWO6GRYE.js";
|
|
@@ -55,7 +55,6 @@ import {
|
|
|
55
55
|
deleteWorkspace,
|
|
56
56
|
ensureWorkspace,
|
|
57
57
|
getCommitsBehind,
|
|
58
|
-
getDefaultBranch,
|
|
59
58
|
getGitBranch,
|
|
60
59
|
getGlobalDataDir,
|
|
61
60
|
getWorkspacesDir,
|
|
@@ -66,7 +65,7 @@ import {
|
|
|
66
65
|
validateRef,
|
|
67
66
|
validateWorkspaceName,
|
|
68
67
|
workspaceExists
|
|
69
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-67AVIA5G.js";
|
|
70
69
|
import {
|
|
71
70
|
createContextStateMessage
|
|
72
71
|
} from "./chunk-47WNBFDO.js";
|
|
@@ -77,17 +76,19 @@ import {
|
|
|
77
76
|
ALWAYS_ALLOWED,
|
|
78
77
|
ALWAYS_ALLOWED_FOR_SUBAGENTS,
|
|
79
78
|
TOP_LEVEL_ONLY_TOOLS
|
|
80
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-VXKY7J7W.js";
|
|
81
80
|
import {
|
|
82
81
|
getPathSeparator,
|
|
83
82
|
isAbsolutePath
|
|
84
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-FIXFSGGZ.js";
|
|
85
84
|
import {
|
|
86
|
-
getProject
|
|
87
|
-
|
|
85
|
+
getProject,
|
|
86
|
+
getProjectByWorkdir,
|
|
87
|
+
updateProject
|
|
88
|
+
} from "./chunk-Q6AKRIM2.js";
|
|
88
89
|
import {
|
|
89
90
|
VERSION
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-XMJLSFY5.js";
|
|
91
92
|
import {
|
|
92
93
|
emitAssistantMessageStart,
|
|
93
94
|
emitContextState,
|
|
@@ -99,10 +100,11 @@ import {
|
|
|
99
100
|
emitRunningChanged,
|
|
100
101
|
emitSessionInitialized,
|
|
101
102
|
emitUserMessage,
|
|
103
|
+
getCurrentContextWindowId,
|
|
102
104
|
getEventStore,
|
|
103
105
|
getSessionState,
|
|
104
106
|
initEventStore
|
|
105
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-2QIYPQQH.js";
|
|
106
108
|
import {
|
|
107
109
|
createSession,
|
|
108
110
|
deleteSession,
|
|
@@ -113,11 +115,12 @@ import {
|
|
|
113
115
|
updateSessionBranch,
|
|
114
116
|
updateSessionCachedPrompt,
|
|
115
117
|
updateSessionDangerLevel,
|
|
118
|
+
updateSessionMessageCount,
|
|
116
119
|
updateSessionMetadata,
|
|
117
120
|
updateSessionProvider,
|
|
118
121
|
updateSessionRunning,
|
|
119
122
|
updateSessionWorkdir
|
|
120
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-VX5NASLY.js";
|
|
121
124
|
import {
|
|
122
125
|
agentExists,
|
|
123
126
|
deleteAgent,
|
|
@@ -139,13 +142,13 @@ import {
|
|
|
139
142
|
saveAgentToProject,
|
|
140
143
|
saveItemToDir,
|
|
141
144
|
setRuntimeConfig
|
|
142
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-L6B6R5SN.js";
|
|
143
146
|
import {
|
|
144
147
|
createProviderManager,
|
|
145
148
|
detectModel,
|
|
146
149
|
getLlmStatus,
|
|
147
150
|
parseDefaultModelSelection
|
|
148
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-BCVM2SPJ.js";
|
|
149
152
|
import {
|
|
150
153
|
getModelProfile
|
|
151
154
|
} from "./chunk-V4IE7HJY.js";
|
|
@@ -159,15 +162,15 @@ import {
|
|
|
159
162
|
SessionNotFoundError,
|
|
160
163
|
WorkspaceInUseError,
|
|
161
164
|
proxyFetch
|
|
162
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-GR63QQFE.js";
|
|
163
166
|
import {
|
|
164
167
|
deleteSetting,
|
|
165
168
|
getSetting,
|
|
166
169
|
setSetting
|
|
167
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-2J7SLQXL.js";
|
|
168
171
|
import {
|
|
169
172
|
initDatabase
|
|
170
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-EZWSS7LG.js";
|
|
171
174
|
import {
|
|
172
175
|
logger,
|
|
173
176
|
setLogLevel
|
|
@@ -2697,6 +2700,76 @@ var SessionManager = class {
|
|
|
2697
2700
|
this.emit({ type: "session_created", session });
|
|
2698
2701
|
return session;
|
|
2699
2702
|
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Fork a session from a specific message.
|
|
2705
|
+
* Creates a new session with all messages up to (and including) the target message,
|
|
2706
|
+
* preserving the conversation history. Copies the cached system prompt to avoid
|
|
2707
|
+
* recomputation and marks the new session as warmed up for KV cache benefits.
|
|
2708
|
+
*
|
|
2709
|
+
* @param originalSessionId - Source session ID
|
|
2710
|
+
* @param messageId - Target message ID to fork at
|
|
2711
|
+
* @param title - Optional title for the new session (default: "Fork of <original title>")
|
|
2712
|
+
* @returns The new session
|
|
2713
|
+
* @throws Error if the original session or message is not found
|
|
2714
|
+
*/
|
|
2715
|
+
forkSession(originalSessionId, messageId, title) {
|
|
2716
|
+
const originalSession = this.requireSession(originalSessionId);
|
|
2717
|
+
const projectId = originalSession.projectId;
|
|
2718
|
+
const effectiveTitle = title ?? `Fork of ${originalSession.metadata?.title ?? "Untitled"}`;
|
|
2719
|
+
const state = getSessionState(originalSessionId);
|
|
2720
|
+
if (!state) throw new Error(`Session ${originalSessionId} has no state`);
|
|
2721
|
+
const msgIndex = state.messages.findIndex((m) => m.id === messageId);
|
|
2722
|
+
if (msgIndex === -1) throw new Error(`Message ${messageId} not found`);
|
|
2723
|
+
const newSession = this.createSession(
|
|
2724
|
+
projectId,
|
|
2725
|
+
effectiveTitle,
|
|
2726
|
+
originalSession.providerId,
|
|
2727
|
+
originalSession.providerModel,
|
|
2728
|
+
originalSession.workspace
|
|
2729
|
+
);
|
|
2730
|
+
const newWindowId = getCurrentContextWindowId(newSession.id) ?? crypto.randomUUID();
|
|
2731
|
+
const messages = state.messages.slice(0, msgIndex + 1);
|
|
2732
|
+
const snapshot = {
|
|
2733
|
+
mode: state.mode,
|
|
2734
|
+
phase: state.phase,
|
|
2735
|
+
isRunning: false,
|
|
2736
|
+
messages: messages.map((m) => ({
|
|
2737
|
+
...m,
|
|
2738
|
+
timestamp: typeof m.timestamp === "string" ? new Date(m.timestamp).getTime() : m.timestamp,
|
|
2739
|
+
contextWindowId: newWindowId
|
|
2740
|
+
})),
|
|
2741
|
+
criteria: state.criteria,
|
|
2742
|
+
metadataEntries: state.metadataEntries,
|
|
2743
|
+
contextState: {
|
|
2744
|
+
currentTokens: 0,
|
|
2745
|
+
maxTokens: state.contextState.maxTokens,
|
|
2746
|
+
compactionCount: 0,
|
|
2747
|
+
dangerZone: false,
|
|
2748
|
+
canCompact: false,
|
|
2749
|
+
dynamicContextChanged: false
|
|
2750
|
+
},
|
|
2751
|
+
currentContextWindowId: newWindowId,
|
|
2752
|
+
todos: state.todos,
|
|
2753
|
+
readFiles: state.readFiles,
|
|
2754
|
+
snapshotSeq: 0,
|
|
2755
|
+
snapshotAt: Date.now(),
|
|
2756
|
+
sessionInit: {
|
|
2757
|
+
projectId: originalSession.projectId,
|
|
2758
|
+
workdir: originalSession.workdir,
|
|
2759
|
+
contextWindowId: newWindowId
|
|
2760
|
+
}
|
|
2761
|
+
};
|
|
2762
|
+
const eventStore = getEventStore();
|
|
2763
|
+
eventStore.append(newSession.id, { type: "turn.snapshot", data: snapshot });
|
|
2764
|
+
updateSessionMessageCount(newSession.id, messages.length);
|
|
2765
|
+
const cached2 = getSessionCachedPrompt(originalSessionId);
|
|
2766
|
+
if (cached2) {
|
|
2767
|
+
updateSessionCachedPrompt(newSession.id, cached2.systemPrompt, cached2.tools, cached2.hash);
|
|
2768
|
+
this.markWarmedUp(newSession.id);
|
|
2769
|
+
}
|
|
2770
|
+
this.emit({ type: "session_updated", session: this.requireSession(newSession.id) });
|
|
2771
|
+
return this.requireSession(newSession.id);
|
|
2772
|
+
}
|
|
2700
2773
|
/**
|
|
2701
2774
|
* Get a session by ID. Returns null if not found.
|
|
2702
2775
|
* Session state is derived from EventStore.
|
|
@@ -3313,9 +3386,18 @@ var SessionManager = class {
|
|
|
3313
3386
|
try {
|
|
3314
3387
|
await validateRef(wsPath, branch);
|
|
3315
3388
|
await runGit(wsPath, ["checkout", branch]).catch(async () => {
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3389
|
+
try {
|
|
3390
|
+
if (sourceBranch) {
|
|
3391
|
+
const validated = await resolveAndValidateSourceBranch(wsPath, sourceBranch, projectDir);
|
|
3392
|
+
await runGit(wsPath, ["checkout", "-b", branch, validated]);
|
|
3393
|
+
} else {
|
|
3394
|
+
await runGit(wsPath, ["checkout", "-b", branch]);
|
|
3395
|
+
}
|
|
3396
|
+
} catch (innerErr) {
|
|
3397
|
+
throw new Error(
|
|
3398
|
+
`Failed to create branch "${branch}" in workspace "${workspaceName}": ${innerErr instanceof Error ? innerErr.message : String(innerErr)}`
|
|
3399
|
+
);
|
|
3400
|
+
}
|
|
3319
3401
|
});
|
|
3320
3402
|
} catch (err) {
|
|
3321
3403
|
throw new Error(
|
|
@@ -4362,7 +4444,10 @@ function createWorkspaceConfigRoutes() {
|
|
|
4362
4444
|
const workdir = req.query["workdir"];
|
|
4363
4445
|
if (!workdir) return res.status(400).json({ error: "workdir required" });
|
|
4364
4446
|
const config3 = await loadWorkspaceConfig(workdir);
|
|
4365
|
-
|
|
4447
|
+
const project = getProjectByWorkdir(workdir);
|
|
4448
|
+
const rootDir = project?.workspaceRootDir ?? void 0;
|
|
4449
|
+
if (!config3 && !rootDir) return res.json({ config: null });
|
|
4450
|
+
res.json({ config: { ...config3, rootDir } });
|
|
4366
4451
|
});
|
|
4367
4452
|
router.post("/config", async (req, res) => {
|
|
4368
4453
|
const workdir = req.query["workdir"];
|
|
@@ -4378,6 +4463,7 @@ function createWorkspaceConfigRoutes() {
|
|
|
4378
4463
|
if (Array.isArray(setup)) {
|
|
4379
4464
|
config3.setup = setup;
|
|
4380
4465
|
}
|
|
4466
|
+
let savedRootDir;
|
|
4381
4467
|
if (typeof rootDir === "string") {
|
|
4382
4468
|
const trimmed = rootDir.trim();
|
|
4383
4469
|
if (trimmed) {
|
|
@@ -4395,12 +4481,20 @@ function createWorkspaceConfigRoutes() {
|
|
|
4395
4481
|
const writableErr = await validatePathWritable(resolvedPath);
|
|
4396
4482
|
if (writableErr) return res.status(400).json({ error: writableErr });
|
|
4397
4483
|
}
|
|
4398
|
-
|
|
4484
|
+
savedRootDir = trimmed;
|
|
4485
|
+
} else {
|
|
4486
|
+
savedRootDir = null;
|
|
4399
4487
|
}
|
|
4400
4488
|
}
|
|
4401
4489
|
try {
|
|
4402
4490
|
await saveWorkspaceConfig(workdir, config3);
|
|
4403
|
-
|
|
4491
|
+
if (savedRootDir !== void 0) {
|
|
4492
|
+
const project = getProjectByWorkdir(workdir);
|
|
4493
|
+
if (project) {
|
|
4494
|
+
updateProject(project.id, { workspaceRootDir: savedRootDir });
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
res.json({ config: { ...config3, rootDir: savedRootDir ?? void 0 } });
|
|
4404
4498
|
} catch (err) {
|
|
4405
4499
|
res.status(500).json({ error: err instanceof Error ? err.message : "Failed to save config" });
|
|
4406
4500
|
}
|
|
@@ -4438,8 +4532,8 @@ function createWorkspaceConfigRoutes() {
|
|
|
4438
4532
|
}
|
|
4439
4533
|
const workspaces = [];
|
|
4440
4534
|
try {
|
|
4441
|
-
const
|
|
4442
|
-
const previousRootDir =
|
|
4535
|
+
const project = getProjectByWorkdir(workdir);
|
|
4536
|
+
const previousRootDir = project?.workspaceRootDir ? resolveRootDir(project.workspaceRootDir, workdir) : null;
|
|
4443
4537
|
if (previousRootDir && previousRootDir !== resolvedPath) {
|
|
4444
4538
|
const orphans = await findOrphanedWorkspaces(previousRootDir);
|
|
4445
4539
|
workspaces.push(...orphans);
|
|
@@ -5422,7 +5516,7 @@ async function createServerHandle(config3) {
|
|
|
5422
5516
|
setMcpTools(mcpTools);
|
|
5423
5517
|
logger.info("MCP tools registered", { count: mcpTools.length });
|
|
5424
5518
|
}
|
|
5425
|
-
const { signalMcpReady } = await import("./server-
|
|
5519
|
+
const { signalMcpReady } = await import("./server-OP2Q2F3S.js");
|
|
5426
5520
|
signalMcpReady();
|
|
5427
5521
|
});
|
|
5428
5522
|
const app = express();
|
|
@@ -5500,7 +5594,7 @@ async function createServerHandle(config3) {
|
|
|
5500
5594
|
res.json({ tools });
|
|
5501
5595
|
});
|
|
5502
5596
|
app.get("/api/projects", async (_req, res) => {
|
|
5503
|
-
const { listProjects } = await import("./projects-
|
|
5597
|
+
const { listProjects } = await import("./projects-HZ3WVTKG.js");
|
|
5504
5598
|
const projects = listProjects();
|
|
5505
5599
|
res.json({ projects });
|
|
5506
5600
|
});
|
|
@@ -5509,7 +5603,7 @@ async function createServerHandle(config3) {
|
|
|
5509
5603
|
if (!name || !workdir) {
|
|
5510
5604
|
return res.status(400).json({ error: "name and workdir are required" });
|
|
5511
5605
|
}
|
|
5512
|
-
const { createDirectoryWithGit } = await import("./project-creator-
|
|
5606
|
+
const { createDirectoryWithGit } = await import("./project-creator-W5VW22DC.js");
|
|
5513
5607
|
try {
|
|
5514
5608
|
const project = await createDirectoryWithGit(name, workdir);
|
|
5515
5609
|
res.status(201).json({ project });
|
|
@@ -5554,7 +5648,7 @@ async function createServerHandle(config3) {
|
|
|
5554
5648
|
}
|
|
5555
5649
|
});
|
|
5556
5650
|
app.get("/api/projects/:id", async (req, res) => {
|
|
5557
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
5651
|
+
const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
|
|
5558
5652
|
const project = getProject2(req.params.id);
|
|
5559
5653
|
if (!project) {
|
|
5560
5654
|
return res.status(404).json({ error: "Project not found" });
|
|
@@ -5562,20 +5656,20 @@ async function createServerHandle(config3) {
|
|
|
5562
5656
|
res.json({ project });
|
|
5563
5657
|
});
|
|
5564
5658
|
app.put("/api/projects/:id", async (req, res) => {
|
|
5565
|
-
const { updateProject } = await import("./projects-
|
|
5659
|
+
const { updateProject: updateProject2 } = await import("./projects-HZ3WVTKG.js");
|
|
5566
5660
|
const { name, customInstructions, dangerLevel } = req.body;
|
|
5567
5661
|
const updates = {};
|
|
5568
5662
|
if (name !== void 0) updates.name = name;
|
|
5569
5663
|
if (customInstructions !== void 0) updates.customInstructions = customInstructions;
|
|
5570
5664
|
if (dangerLevel !== void 0) updates.dangerLevel = dangerLevel;
|
|
5571
|
-
const updated =
|
|
5665
|
+
const updated = updateProject2(req.params.id, updates);
|
|
5572
5666
|
if (!updated) {
|
|
5573
5667
|
return res.status(404).json({ error: "Project not found" });
|
|
5574
5668
|
}
|
|
5575
5669
|
res.json({ project: updated });
|
|
5576
5670
|
});
|
|
5577
5671
|
app.delete("/api/projects/:id", async (req, res) => {
|
|
5578
|
-
const { getProject: getProject2, deleteProject } = await import("./projects-
|
|
5672
|
+
const { getProject: getProject2, deleteProject } = await import("./projects-HZ3WVTKG.js");
|
|
5579
5673
|
const project = getProject2(req.params.id);
|
|
5580
5674
|
if (!project) {
|
|
5581
5675
|
return res.status(404).json({ error: "Project not found" });
|
|
@@ -5584,7 +5678,7 @@ async function createServerHandle(config3) {
|
|
|
5584
5678
|
res.json({ success: true });
|
|
5585
5679
|
});
|
|
5586
5680
|
app.put("/api/projects/:id/star", async (req, res) => {
|
|
5587
|
-
const { toggleStar } = await import("./projects-
|
|
5681
|
+
const { toggleStar } = await import("./projects-HZ3WVTKG.js");
|
|
5588
5682
|
const { isStarred } = req.body;
|
|
5589
5683
|
if (typeof isStarred !== "boolean") {
|
|
5590
5684
|
return res.status(400).json({ error: "isStarred is required and must be a boolean" });
|
|
@@ -5596,26 +5690,26 @@ async function createServerHandle(config3) {
|
|
|
5596
5690
|
res.json({ project });
|
|
5597
5691
|
});
|
|
5598
5692
|
app.get("/api/projects/:id/branches", async (req, res) => {
|
|
5599
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
5693
|
+
const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
|
|
5600
5694
|
const project = getProject2(req.params.id);
|
|
5601
5695
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
5602
|
-
const { listBranches } = await import("./workspace-
|
|
5696
|
+
const { listBranches } = await import("./workspace-N4QHV6J2.js");
|
|
5603
5697
|
const branches = await listBranches(project.workdir);
|
|
5604
5698
|
res.json({ branches });
|
|
5605
5699
|
});
|
|
5606
5700
|
app.post("/api/projects/:id/checkout", async (req, res) => {
|
|
5607
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
5701
|
+
const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
|
|
5608
5702
|
const project = getProject2(req.params.id);
|
|
5609
5703
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
5610
5704
|
const { branch } = req.body;
|
|
5611
5705
|
if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
|
|
5612
|
-
const { checkoutBranch, isGitRepository } = await import("./workspace-
|
|
5706
|
+
const { checkoutBranch, isGitRepository } = await import("./workspace-N4QHV6J2.js");
|
|
5613
5707
|
if (!await isGitRepository(project.workdir)) {
|
|
5614
5708
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
5615
5709
|
}
|
|
5616
5710
|
try {
|
|
5617
5711
|
await checkoutBranch(project.workdir, branch);
|
|
5618
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
5712
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-SFM7XA3R.js");
|
|
5619
5713
|
const allSessions = sessionManager.listSessions();
|
|
5620
5714
|
for (const s of allSessions) {
|
|
5621
5715
|
if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
|
|
@@ -5629,12 +5723,12 @@ async function createServerHandle(config3) {
|
|
|
5629
5723
|
}
|
|
5630
5724
|
});
|
|
5631
5725
|
app.post("/api/projects/:id/checkout-new", async (req, res) => {
|
|
5632
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
5726
|
+
const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
|
|
5633
5727
|
const project = getProject2(req.params.id);
|
|
5634
5728
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
5635
5729
|
const { name, sourceBranch } = req.body;
|
|
5636
5730
|
if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
|
|
5637
|
-
const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch
|
|
5731
|
+
const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-N4QHV6J2.js");
|
|
5638
5732
|
if (!await isGitRepository(project.workdir)) {
|
|
5639
5733
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
5640
5734
|
}
|
|
@@ -5646,12 +5740,12 @@ async function createServerHandle(config3) {
|
|
|
5646
5740
|
} else {
|
|
5647
5741
|
sb = await resolveAndValidateSourceBranch2(
|
|
5648
5742
|
project.workdir,
|
|
5649
|
-
await
|
|
5743
|
+
await getDefaultBranch(project.workdir),
|
|
5650
5744
|
project.workdir
|
|
5651
5745
|
);
|
|
5652
5746
|
}
|
|
5653
5747
|
await createBranch(project.workdir, name, sb);
|
|
5654
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
5748
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-SFM7XA3R.js");
|
|
5655
5749
|
const allSessions = sessionManager.listSessions();
|
|
5656
5750
|
for (const s of allSessions) {
|
|
5657
5751
|
if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
|
|
@@ -5668,10 +5762,10 @@ async function createServerHandle(config3) {
|
|
|
5668
5762
|
const session = sessionManager.getSession(req.params.id);
|
|
5669
5763
|
if (!session) return res.status(404).json({ error: "Session not found" });
|
|
5670
5764
|
const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
|
|
5671
|
-
const { listBranches, getDefaultBranch
|
|
5765
|
+
const { listBranches, getDefaultBranch } = await import("./workspace-N4QHV6J2.js");
|
|
5672
5766
|
const [branches, defaultBranch] = await Promise.all([
|
|
5673
5767
|
listBranches(effectiveWorkdir),
|
|
5674
|
-
|
|
5768
|
+
getDefaultBranch(session.workdir)
|
|
5675
5769
|
// project root, not workspace, for real upstream origin/HEAD
|
|
5676
5770
|
]);
|
|
5677
5771
|
res.json({ branches, defaultBranch });
|
|
@@ -5682,8 +5776,8 @@ async function createServerHandle(config3) {
|
|
|
5682
5776
|
const { branch } = req.body;
|
|
5683
5777
|
if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
|
|
5684
5778
|
const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
|
|
5685
|
-
const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-
|
|
5686
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
5779
|
+
const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-N4QHV6J2.js");
|
|
5780
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-SFM7XA3R.js");
|
|
5687
5781
|
try {
|
|
5688
5782
|
await validateRef2(effectiveWorkdir, branch);
|
|
5689
5783
|
await checkoutBranch(effectiveWorkdir, branch);
|
|
@@ -5725,17 +5819,17 @@ All file and git operations should use this branch.
|
|
|
5725
5819
|
const { name, sourceBranch } = req.body;
|
|
5726
5820
|
if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
|
|
5727
5821
|
const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
|
|
5728
|
-
const { validateRef: validateRef2 } = await import("./workspace-
|
|
5729
|
-
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-
|
|
5822
|
+
const { validateRef: validateRef2 } = await import("./workspace-N4QHV6J2.js");
|
|
5823
|
+
const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-SFM7XA3R.js");
|
|
5730
5824
|
try {
|
|
5731
5825
|
await validateRef2(effectiveWorkdir, name);
|
|
5732
5826
|
if (sourceBranch) {
|
|
5733
|
-
const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-
|
|
5827
|
+
const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-N4QHV6J2.js");
|
|
5734
5828
|
const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, sourceBranch, session.workdir);
|
|
5735
5829
|
await createBranch(effectiveWorkdir, name, sb);
|
|
5736
5830
|
} else {
|
|
5737
|
-
const { createBranch, getDefaultBranch
|
|
5738
|
-
const defaultBranch = await
|
|
5831
|
+
const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-N4QHV6J2.js");
|
|
5832
|
+
const defaultBranch = await getDefaultBranch(session.workdir);
|
|
5739
5833
|
const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, defaultBranch, session.workdir);
|
|
5740
5834
|
await createBranch(effectiveWorkdir, name, sb);
|
|
5741
5835
|
}
|
|
@@ -5772,17 +5866,17 @@ All file and git operations should use this branch.
|
|
|
5772
5866
|
}
|
|
5773
5867
|
});
|
|
5774
5868
|
app.get("/api/projects/:id/workspaces", async (req, res) => {
|
|
5775
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
5869
|
+
const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
|
|
5776
5870
|
const project = getProject2(req.params.id);
|
|
5777
5871
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
5778
|
-
const { listWorkspaces } = await import("./workspace-
|
|
5872
|
+
const { listWorkspaces } = await import("./workspace-N4QHV6J2.js");
|
|
5779
5873
|
const all = await listWorkspaces(project.name, project.workdir);
|
|
5780
5874
|
const workspacesList = all.filter((ws) => ws.path !== project.workdir);
|
|
5781
5875
|
res.json({ workspaces: workspacesList });
|
|
5782
5876
|
});
|
|
5783
5877
|
app.get("/api/sessions", async (req, res) => {
|
|
5784
|
-
const { getRecentUserPromptsForSession } = await import("./events-
|
|
5785
|
-
const { getPendingConfirmationsBySession } = await import("./path-security-
|
|
5878
|
+
const { getRecentUserPromptsForSession } = await import("./events-U2BYC5MN.js");
|
|
5879
|
+
const { getPendingConfirmationsBySession } = await import("./path-security-3BTT5ZCM.js");
|
|
5786
5880
|
const projectId = req.query["projectId"];
|
|
5787
5881
|
const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
|
|
5788
5882
|
const offset = parseInt(req.query["offset"]) || 0;
|
|
@@ -5852,7 +5946,7 @@ All file and git operations should use this branch.
|
|
|
5852
5946
|
if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
|
|
5853
5947
|
const project = sessionManager.getProject(session.projectId);
|
|
5854
5948
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
5855
|
-
const { isGitRepository } = await import("./workspace-
|
|
5949
|
+
const { isGitRepository } = await import("./workspace-N4QHV6J2.js");
|
|
5856
5950
|
if (!await isGitRepository(project.workdir)) {
|
|
5857
5951
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
5858
5952
|
}
|
|
@@ -5870,7 +5964,7 @@ All file and git operations should use this branch.
|
|
|
5870
5964
|
if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
|
|
5871
5965
|
const project = sessionManager.getProject(session.projectId);
|
|
5872
5966
|
if (!project) return res.status(404).json({ error: "Project not found" });
|
|
5873
|
-
const { isGitRepository } = await import("./workspace-
|
|
5967
|
+
const { isGitRepository } = await import("./workspace-N4QHV6J2.js");
|
|
5874
5968
|
if (!await isGitRepository(project.workdir)) {
|
|
5875
5969
|
return res.status(400).json({ error: "Project is not a git repository" });
|
|
5876
5970
|
}
|
|
@@ -5888,10 +5982,10 @@ All file and git operations should use this branch.
|
|
|
5888
5982
|
}
|
|
5889
5983
|
});
|
|
5890
5984
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
5891
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-
|
|
5892
|
-
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-
|
|
5893
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
5894
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
5985
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-U2BYC5MN.js");
|
|
5986
|
+
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-RE7ZL7H7.js");
|
|
5987
|
+
const { getPendingQuestionsForSession } = await import("./tools-X7NAB4LZ.js");
|
|
5988
|
+
const { getMaxVisibleItems } = await import("./settings-TCNHSYFX.js");
|
|
5895
5989
|
const session = sessionManager.getSession(req.params.id);
|
|
5896
5990
|
if (!session) {
|
|
5897
5991
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -5921,8 +6015,8 @@ All file and git operations should use this branch.
|
|
|
5921
6015
|
if (!session) {
|
|
5922
6016
|
return res.status(404).json({ error: "Session not found" });
|
|
5923
6017
|
}
|
|
5924
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
5925
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
6018
|
+
const { stopSessionExecution } = await import("./chat-handler-JJQ3JBNF.js");
|
|
6019
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-X7NAB4LZ.js");
|
|
5926
6020
|
sessionManager.clearMessageQueue(sessionId);
|
|
5927
6021
|
stopSessionExecution(sessionId, sessionManager);
|
|
5928
6022
|
abortSession(sessionId);
|
|
@@ -5951,9 +6045,9 @@ All file and git operations should use this branch.
|
|
|
5951
6045
|
res.json({ success: true });
|
|
5952
6046
|
});
|
|
5953
6047
|
app.post("/api/sessions/:id/provider", async (req, res) => {
|
|
5954
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-
|
|
5955
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
5956
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
6048
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-U2BYC5MN.js");
|
|
6049
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-RE7ZL7H7.js");
|
|
6050
|
+
const { getMaxVisibleItems } = await import("./settings-TCNHSYFX.js");
|
|
5957
6051
|
const sessionId = req.params.id;
|
|
5958
6052
|
const session = sessionManager.getSession(sessionId);
|
|
5959
6053
|
if (!session) {
|
|
@@ -6066,9 +6160,9 @@ All file and git operations should use this branch.
|
|
|
6066
6160
|
res.json({ success: true });
|
|
6067
6161
|
});
|
|
6068
6162
|
app.put("/api/sessions/:id/mode", async (req, res) => {
|
|
6069
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-
|
|
6070
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
6071
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
6163
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-U2BYC5MN.js");
|
|
6164
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-RE7ZL7H7.js");
|
|
6165
|
+
const { getMaxVisibleItems } = await import("./settings-TCNHSYFX.js");
|
|
6072
6166
|
const sessionId = req.params.id;
|
|
6073
6167
|
const session = sessionManager.getSession(sessionId);
|
|
6074
6168
|
if (!session) {
|
|
@@ -6129,7 +6223,7 @@ All file and git operations should use this branch.
|
|
|
6129
6223
|
if (alwaysAllow !== void 0 && typeof alwaysAllow !== "boolean") {
|
|
6130
6224
|
return res.status(400).json({ error: "alwaysAllow must be a boolean if provided" });
|
|
6131
6225
|
}
|
|
6132
|
-
const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-
|
|
6226
|
+
const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-X7NAB4LZ.js");
|
|
6133
6227
|
const pendingSessionId = getConfirmationSessionId(callId);
|
|
6134
6228
|
if (!pendingSessionId) {
|
|
6135
6229
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
@@ -6141,11 +6235,11 @@ All file and git operations should use this branch.
|
|
|
6141
6235
|
if (!result.found) {
|
|
6142
6236
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
6143
6237
|
}
|
|
6144
|
-
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-
|
|
6145
|
-
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-
|
|
6238
|
+
const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-U2BYC5MN.js");
|
|
6239
|
+
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-RE7ZL7H7.js");
|
|
6146
6240
|
const { createSessionStateMessage } = await import("./protocol-BUA2W2KM.js");
|
|
6147
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
6148
|
-
const { getMaxVisibleItems } = await import("./settings-
|
|
6241
|
+
const { getPendingQuestionsForSession } = await import("./tools-X7NAB4LZ.js");
|
|
6242
|
+
const { getMaxVisibleItems } = await import("./settings-TCNHSYFX.js");
|
|
6149
6243
|
const eventStore = getEventStore2();
|
|
6150
6244
|
const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(sessionId);
|
|
6151
6245
|
const events = combineEvents(sessionId, snapshot, eventsSinceSnapshot);
|
|
@@ -6181,7 +6275,7 @@ All file and git operations should use this branch.
|
|
|
6181
6275
|
if (!skip && typeof answer !== "string") {
|
|
6182
6276
|
return res.status(400).json({ error: "answer is required when not skipping" });
|
|
6183
6277
|
}
|
|
6184
|
-
const { provideAnswer } = await import("./tools-
|
|
6278
|
+
const { provideAnswer } = await import("./tools-X7NAB4LZ.js");
|
|
6185
6279
|
const found = provideAnswer(callId, answer ?? "", skip ?? false);
|
|
6186
6280
|
if (!found) {
|
|
6187
6281
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -6209,7 +6303,7 @@ All file and git operations should use this branch.
|
|
|
6209
6303
|
if (!session) {
|
|
6210
6304
|
return res.status(404).json({ error: "Session not found" });
|
|
6211
6305
|
}
|
|
6212
|
-
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-
|
|
6306
|
+
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-TCNHSYFX.js");
|
|
6213
6307
|
if (getSetting2(SETTINGS_KEYS.CACHE_WARMING) !== "true") {
|
|
6214
6308
|
return res.json({ success: false, reason: "disabled" });
|
|
6215
6309
|
}
|
|
@@ -6241,7 +6335,7 @@ All file and git operations should use this branch.
|
|
|
6241
6335
|
backend: activeProvider?.backend ?? llmClient.getBackend(),
|
|
6242
6336
|
model: llmClient.getModel()
|
|
6243
6337
|
};
|
|
6244
|
-
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-
|
|
6338
|
+
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-BMU7DZ6F.js");
|
|
6245
6339
|
runAgentTurn(
|
|
6246
6340
|
{
|
|
6247
6341
|
sessionManager,
|
|
@@ -6279,15 +6373,15 @@ All file and git operations should use this branch.
|
|
|
6279
6373
|
if (!session) {
|
|
6280
6374
|
return res.status(404).json({ error: "Session not found" });
|
|
6281
6375
|
}
|
|
6282
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
6283
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
6376
|
+
const { stopSessionExecution } = await import("./chat-handler-JJQ3JBNF.js");
|
|
6377
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-X7NAB4LZ.js");
|
|
6284
6378
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
6285
6379
|
sessionManager.clearMessageQueue(sessionId);
|
|
6286
6380
|
stopSessionExecution(sessionId, sessionManager);
|
|
6287
6381
|
abortSession(sessionId);
|
|
6288
6382
|
cancelQuestionsForSession(sessionId, "Session stopped by user");
|
|
6289
6383
|
cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
|
|
6290
|
-
const eventStore = (await import("./events-
|
|
6384
|
+
const eventStore = (await import("./events-U2BYC5MN.js")).getEventStore();
|
|
6291
6385
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
6292
6386
|
res.json({ success: true, queuedMessages });
|
|
6293
6387
|
});
|
|
@@ -6301,7 +6395,7 @@ All file and git operations should use this branch.
|
|
|
6301
6395
|
if (typeof messageIndex !== "number" || messageIndex < 0) {
|
|
6302
6396
|
return res.status(400).json({ error: "messageIndex must be a non-negative number" });
|
|
6303
6397
|
}
|
|
6304
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6398
|
+
const { truncateSessionMessages } = await import("./events-U2BYC5MN.js");
|
|
6305
6399
|
truncateSessionMessages(sessionId, messageIndex);
|
|
6306
6400
|
res.json({ success: true });
|
|
6307
6401
|
});
|
|
@@ -6318,8 +6412,8 @@ All file and git operations should use this branch.
|
|
|
6318
6412
|
if (content !== void 0 && (typeof content !== "string" || !content.trim())) {
|
|
6319
6413
|
return res.status(400).json({ error: "content must be a non-empty string if provided" });
|
|
6320
6414
|
}
|
|
6321
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6322
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
6415
|
+
const { getEventStore: getEventStore2 } = await import("./events-U2BYC5MN.js");
|
|
6416
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-RE7ZL7H7.js");
|
|
6323
6417
|
const eventStore = getEventStore2();
|
|
6324
6418
|
const events = eventStore.getEvents(sessionId);
|
|
6325
6419
|
const { messages } = buildMessagesFromStoredEvents(events);
|
|
@@ -6331,11 +6425,35 @@ All file and git operations should use this branch.
|
|
|
6331
6425
|
if (msg.role !== "user" || msg.isSystemGenerated) {
|
|
6332
6426
|
return res.status(400).json({ error: "Can only replay user messages" });
|
|
6333
6427
|
}
|
|
6334
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6428
|
+
const { truncateSessionMessages } = await import("./events-U2BYC5MN.js");
|
|
6335
6429
|
truncateSessionMessages(sessionId, msgIndex - 1);
|
|
6336
6430
|
sessionManager.queueMessage(sessionId, "asap", content ?? msg.content, msg.attachments, msg.messageKind);
|
|
6337
6431
|
res.json({ success: true });
|
|
6338
6432
|
});
|
|
6433
|
+
app.post("/api/sessions/:id/fork", async (req, res) => {
|
|
6434
|
+
const sessionId = req.params.id;
|
|
6435
|
+
const session = sessionManager.getSession(sessionId);
|
|
6436
|
+
if (!session) {
|
|
6437
|
+
return res.status(404).json({ error: "Session not found" });
|
|
6438
|
+
}
|
|
6439
|
+
const { messageId, title } = req.body;
|
|
6440
|
+
if (typeof messageId !== "string" || !messageId) {
|
|
6441
|
+
return res.status(400).json({ error: "messageId is required" });
|
|
6442
|
+
}
|
|
6443
|
+
if (title !== void 0 && typeof title !== "string") {
|
|
6444
|
+
return res.status(400).json({ error: "title must be a string if provided" });
|
|
6445
|
+
}
|
|
6446
|
+
try {
|
|
6447
|
+
const newSession = sessionManager.forkSession(sessionId, messageId, title);
|
|
6448
|
+
return res.status(201).json({ session: newSession });
|
|
6449
|
+
} catch (err) {
|
|
6450
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
6451
|
+
if (message.includes("not found")) {
|
|
6452
|
+
return res.status(404).json({ error: message });
|
|
6453
|
+
}
|
|
6454
|
+
return res.status(500).json({ error: message });
|
|
6455
|
+
}
|
|
6456
|
+
});
|
|
6339
6457
|
app.post("/api/sessions/:id/chat", async (req, res) => {
|
|
6340
6458
|
const sessionId = req.params.id;
|
|
6341
6459
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -6363,7 +6481,7 @@ All file and git operations should use this branch.
|
|
|
6363
6481
|
res.json({ accepted: true });
|
|
6364
6482
|
});
|
|
6365
6483
|
app.get("/api/settings", async (req, res) => {
|
|
6366
|
-
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-
|
|
6484
|
+
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-TCNHSYFX.js");
|
|
6367
6485
|
const keysParam = req.query["keys"];
|
|
6368
6486
|
if (!keysParam) {
|
|
6369
6487
|
return res.status(400).json({ error: "keys query parameter is required" });
|
|
@@ -6376,19 +6494,19 @@ All file and git operations should use this branch.
|
|
|
6376
6494
|
res.json(result);
|
|
6377
6495
|
});
|
|
6378
6496
|
app.get("/api/settings/:key", async (req, res) => {
|
|
6379
|
-
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-
|
|
6497
|
+
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-TCNHSYFX.js");
|
|
6380
6498
|
const key = req.params.key;
|
|
6381
6499
|
const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
|
|
6382
6500
|
res.json({ key, value });
|
|
6383
6501
|
});
|
|
6384
6502
|
app.get("/api/settings/:key", async (req, res) => {
|
|
6385
|
-
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-
|
|
6503
|
+
const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-TCNHSYFX.js");
|
|
6386
6504
|
const key = req.params.key;
|
|
6387
6505
|
const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
|
|
6388
6506
|
res.json({ key, value });
|
|
6389
6507
|
});
|
|
6390
6508
|
app.put("/api/settings/:key", async (req, res) => {
|
|
6391
|
-
const { setSetting: setSetting2 } = await import("./settings-
|
|
6509
|
+
const { setSetting: setSetting2 } = await import("./settings-TCNHSYFX.js");
|
|
6392
6510
|
const key = req.params.key;
|
|
6393
6511
|
const { value } = req.body;
|
|
6394
6512
|
if (value === void 0) {
|
|
@@ -6415,7 +6533,7 @@ All file and git operations should use this branch.
|
|
|
6415
6533
|
}
|
|
6416
6534
|
});
|
|
6417
6535
|
app.get("/api/tools/shells", async (_req, res) => {
|
|
6418
|
-
const { listAvailableShells } = await import("./platform-
|
|
6536
|
+
const { listAvailableShells } = await import("./platform-2XTX4MRW.js");
|
|
6419
6537
|
res.json({ shells: listAvailableShells() });
|
|
6420
6538
|
});
|
|
6421
6539
|
app.get("/api/config", async (_req, res) => {
|
|
@@ -6574,7 +6692,7 @@ All file and git operations should use this branch.
|
|
|
6574
6692
|
}
|
|
6575
6693
|
});
|
|
6576
6694
|
app.post("/api/proxy/test", async (_req, res) => {
|
|
6577
|
-
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-
|
|
6695
|
+
const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-TCNHSYFX.js");
|
|
6578
6696
|
const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
|
|
6579
6697
|
if (!proxyUrl) {
|
|
6580
6698
|
return res.status(400).json({ success: false, error: "No proxy URL configured" });
|
|
@@ -6601,7 +6719,7 @@ All file and git operations should use this branch.
|
|
|
6601
6719
|
const backend = req.query["backend"];
|
|
6602
6720
|
if (!url) return res.status(400).json({ error: "url is required" });
|
|
6603
6721
|
try {
|
|
6604
|
-
const { fetchModelsWithContext } = await import("./provider-manager-
|
|
6722
|
+
const { fetchModelsWithContext } = await import("./provider-manager-I35NHMOO.js");
|
|
6605
6723
|
const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
|
|
6606
6724
|
const models = await fetchModelsWithContext(
|
|
6607
6725
|
url,
|
|
@@ -6672,7 +6790,7 @@ All file and git operations should use this branch.
|
|
|
6672
6790
|
const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
|
|
6673
6791
|
const { getBackendCapabilities } = await import("./backend-P3GHHLHJ.js");
|
|
6674
6792
|
const { buildNonStreamingCreateParams } = await import("./client-pure-5YE5WFJP.js");
|
|
6675
|
-
const { OpenAIHttpClient } = await import("./http-client-
|
|
6793
|
+
const { OpenAIHttpClient } = await import("./http-client-7QCN2R44.js");
|
|
6676
6794
|
const { ensureVersionPrefix } = await import("./url-utils-SAJP7AEX.js");
|
|
6677
6795
|
const profile = getModelProfile2(model);
|
|
6678
6796
|
const capabilities = getBackendCapabilities(backend || "unknown");
|
|
@@ -6930,7 +7048,7 @@ All file and git operations should use this branch.
|
|
|
6930
7048
|
});
|
|
6931
7049
|
async function rebuildMcpTools() {
|
|
6932
7050
|
const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-MOGEI6TP.js");
|
|
6933
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
7051
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-X7NAB4LZ.js");
|
|
6934
7052
|
const mcpTools = createMcpTools2(mcpManager);
|
|
6935
7053
|
setMcpTools2(mcpTools);
|
|
6936
7054
|
}
|
|
@@ -7177,13 +7295,13 @@ All file and git operations should use this branch.
|
|
|
7177
7295
|
})
|
|
7178
7296
|
);
|
|
7179
7297
|
app.get("/api/sessions/:id/background-processes", async (req, res) => {
|
|
7180
|
-
const { getSessionProcesses } = await import("./manager-
|
|
7298
|
+
const { getSessionProcesses } = await import("./manager-X665RYDA.js");
|
|
7181
7299
|
const sessionId = req.params.id;
|
|
7182
7300
|
const processes = getSessionProcesses(sessionId);
|
|
7183
7301
|
res.json({ processes });
|
|
7184
7302
|
});
|
|
7185
7303
|
app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
|
|
7186
|
-
const { stopProcess } = await import("./manager-
|
|
7304
|
+
const { stopProcess } = await import("./manager-X665RYDA.js");
|
|
7187
7305
|
const sessionId = req.params.id;
|
|
7188
7306
|
const processId = req.params.processId;
|
|
7189
7307
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -7326,7 +7444,7 @@ All file and git operations should use this branch.
|
|
|
7326
7444
|
const state = sessionManager.getContextState(sessionId);
|
|
7327
7445
|
wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
|
|
7328
7446
|
});
|
|
7329
|
-
const { QueueProcessor } = await import("./processor-
|
|
7447
|
+
const { QueueProcessor } = await import("./processor-YIVQO2OY.js");
|
|
7330
7448
|
const queueProcessor = new QueueProcessor({
|
|
7331
7449
|
sessionManager,
|
|
7332
7450
|
providerManager,
|
|
@@ -7368,7 +7486,7 @@ All file and git operations should use this branch.
|
|
|
7368
7486
|
void (async () => {
|
|
7369
7487
|
await devServerManager.stopAll();
|
|
7370
7488
|
await mcpManager.disconnectAll();
|
|
7371
|
-
const { stopAllInspectProxies } = await import("./inspect-proxy-
|
|
7489
|
+
const { stopAllInspectProxies } = await import("./inspect-proxy-CN2MUFQ5.js");
|
|
7372
7490
|
stopAllInspectProxies();
|
|
7373
7491
|
const { cleanupAllProcesses } = await import("./store-SARB6V2N.js");
|
|
7374
7492
|
cleanupAllProcesses();
|
|
@@ -7398,6 +7516,10 @@ async function createServer(config3) {
|
|
|
7398
7516
|
forceExitTimer.unref();
|
|
7399
7517
|
handle.close().then(() => process.exit(0));
|
|
7400
7518
|
};
|
|
7519
|
+
process.on("unhandledRejection", (reason) => {
|
|
7520
|
+
const errorInfo = reason instanceof Error ? { message: reason.message, stack: reason.stack } : { message: String(reason) };
|
|
7521
|
+
logger.error("Unhandled promise rejection", errorInfo);
|
|
7522
|
+
});
|
|
7401
7523
|
process.on("SIGINT", shutdown);
|
|
7402
7524
|
process.on("SIGTERM", shutdown);
|
|
7403
7525
|
}
|
|
@@ -7406,4 +7528,4 @@ export {
|
|
|
7406
7528
|
createServerHandle,
|
|
7407
7529
|
createServer
|
|
7408
7530
|
};
|
|
7409
|
-
//# sourceMappingURL=chunk-
|
|
7531
|
+
//# sourceMappingURL=chunk-6PHUBUVH.js.map
|