openfox 2.0.87 → 2.0.89

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +1062 -0
  2. package/dist/CHANGELOG.md +1062 -0
  3. package/dist/{chat-handler-AVGJQSYW.js → chat-handler-NOTXEOLF.js} +17 -17
  4. package/dist/{chunk-3JYPDZT2.js → chunk-2GQ7X2NP.js} +2 -2
  5. package/dist/{chunk-5W2FIWDH.js → chunk-3QHXJ3DJ.js} +2 -2
  6. package/dist/{chunk-WVMOGE7U.js → chunk-4S76VMPH.js} +3 -3
  7. package/dist/{chunk-VGYV5EH6.js → chunk-5OGOPB3I.js} +236 -98
  8. package/dist/{chunk-7PZBCATU.js → chunk-67AVIA5G.js} +29 -7
  9. package/dist/{chunk-SBVKT4GT.js → chunk-7JC5YWST.js} +15 -15
  10. package/dist/{chunk-FYYPQ27K.js → chunk-7TFKWFY3.js} +2 -2
  11. package/dist/{chunk-OHKBGMLO.js → chunk-AGYP7AUV.js} +2 -2
  12. package/dist/{chunk-W23S3TU5.js → chunk-ANYBIATF.js} +2 -2
  13. package/dist/{chunk-BKH4SIWV.js → chunk-E5D7V7XC.js} +7 -7
  14. package/dist/{chunk-RGUUZD5B.js → chunk-EZWSS7LG.js} +5 -1
  15. package/dist/{chunk-EYIWUONA.js → chunk-J2IVK667.js} +2 -2
  16. package/dist/{chunk-FY6FQTNN.js → chunk-J7R25K6N.js} +4 -4
  17. package/dist/{chunk-H765CIHN.js → chunk-NGIOAASU.js} +2 -2
  18. package/dist/{chunk-M6X72DYZ.js → chunk-NTYWC6PD.js} +3 -3
  19. package/dist/{chunk-CK7G2JLY.js → chunk-OVSB5SFF.js} +11 -11
  20. package/dist/{chunk-MTZ3PC6K.js → chunk-Q4OPCXV4.js} +2 -2
  21. package/dist/{chunk-6AE3JPDJ.js → chunk-Q6AKRIM2.js} +7 -2
  22. package/dist/{chunk-V5LOH363.js → chunk-RNXMN5QY.js} +4 -4
  23. package/dist/{chunk-ACL4YUJH.js → chunk-SYU5GNPN.js} +2 -2
  24. package/dist/{chunk-L4S5N3WV.js → chunk-TAHZHEJ4.js} +3 -3
  25. package/dist/chunk-TH4JF6XP.js +7 -0
  26. package/dist/{chunk-B6VZS5SC.js → chunk-U2ECZUAX.js} +10 -10
  27. package/dist/{chunk-STFIEU5F.js → chunk-VFMHWU3E.js} +4 -2
  28. package/dist/cli/dev.js +1 -1
  29. package/dist/cli/index.js +1 -1
  30. package/dist/{client-C2P67MA4.js → client-2KVPLIV4.js} +5 -5
  31. package/dist/{compactor-2YT66FDZ.js → compactor-W2CUKE22.js} +10 -10
  32. package/dist/{events-OEDAFNEI.js → events-OD7MN3FL.js} +7 -7
  33. package/dist/{folding-FGTCP73N.js → folding-TDDQ5CXT.js} +5 -5
  34. package/dist/http-client-IPJGJXNJ.js +11 -0
  35. package/dist/{inspect-proxy-DRYIIH4O.js → inspect-proxy-CN2MUFQ5.js} +4 -4
  36. package/dist/{manager-TD2UT62O.js → manager-6UIC3QKJ.js} +5 -5
  37. package/dist/{orchestrator-AGJ7EMFZ.js → orchestrator-NQDWCULY.js} +16 -16
  38. package/dist/package.json +3 -2
  39. package/dist/{path-security-DWL3R2SF.js → path-security-M2JDUBKK.js} +8 -8
  40. package/dist/{platform-OYKGQ7Z3.js → platform-55N6FRRU.js} +4 -4
  41. package/dist/{processor-VCDVG7RV.js → processor-FE4ZJ7GS.js} +17 -17
  42. package/dist/{project-creator-NNUITNUI.js → project-creator-W5VW22DC.js} +3 -3
  43. package/dist/{projects-ZGJGICGT.js → projects-HZ3WVTKG.js} +3 -3
  44. package/dist/{protocol-BzTZcNEh.d.ts → protocol-DKJPL2Ci.d.ts} +1 -1
  45. package/dist/provider/index.d.ts +4 -4
  46. package/dist/{provider-YNYYAR6C.js → provider-I2P3NYUI.js} +6 -6
  47. package/dist/{provider-manager-3DW3A2VC.js → provider-manager-OLDOHCR2.js} +6 -6
  48. package/dist/{serve-IGWUSQDZ.js → serve-UMPDBCVG.js} +23 -23
  49. package/dist/server/index.d.ts +16 -3
  50. package/dist/server/index.js +22 -22
  51. package/dist/{server-3X46OIYC.js → server-4PB7BNE6.js} +18 -18
  52. package/dist/{sessions-V3BF2OTU.js → sessions-Q6SYLG6U.js} +5 -5
  53. package/dist/{settings-AGNYWEIE.js → settings-PFZWX6VY.js} +3 -3
  54. package/dist/shared/index.d.ts +3 -3
  55. package/dist/{tools-X65P65KF.js → tools-NLKP65HF.js} +15 -15
  56. package/dist/{types-CrLD4iRS.d.ts → types-B97Fb4vm.d.ts} +1 -1
  57. package/dist/{types-B4wa_vGm.d.ts → types-C4NrLRR1.d.ts} +1 -0
  58. package/dist/{update-6GITMIFG.js → update-BHTE5TMY.js} +2 -2
  59. package/dist/web/assets/index-BQfVUhSC.css +32 -0
  60. package/dist/web/assets/index-C5sTYb--.js +306 -0
  61. package/dist/web/index.html +2 -2
  62. package/dist/web/sw.js +1 -1
  63. package/dist/{workspace-MMV6V5P4.js → workspace-N4QHV6J2.js} +4 -2
  64. package/package.json +3 -2
  65. package/dist/chunk-3USWJ6MR.js +0 -7
  66. package/dist/http-client-I52X7GQB.js +0 -11
  67. package/dist/web/assets/index-CsWZt1m8.css +0 -32
  68. package/dist/web/assets/index-D-r8G7Tf.js +0 -305
@@ -21,7 +21,7 @@ import {
21
21
  tokenFromPassword,
22
22
  verifyPassword,
23
23
  workflowExists
24
- } from "./chunk-CK7G2JLY.js";
24
+ } from "./chunk-OVSB5SFF.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-SBVKT4GT.js";
50
+ } from "./chunk-7JC5YWST.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-7PZBCATU.js";
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-H765CIHN.js";
79
+ } from "./chunk-NGIOAASU.js";
81
80
  import {
82
81
  getPathSeparator,
83
82
  isAbsolutePath
84
- } from "./chunk-W23S3TU5.js";
83
+ } from "./chunk-ANYBIATF.js";
85
84
  import {
86
- getProject
87
- } from "./chunk-6AE3JPDJ.js";
85
+ getProject,
86
+ getProjectByWorkdir,
87
+ updateProject
88
+ } from "./chunk-Q6AKRIM2.js";
88
89
  import {
89
90
  VERSION
90
- } from "./chunk-3USWJ6MR.js";
91
+ } from "./chunk-TH4JF6XP.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-V5LOH363.js";
107
+ } from "./chunk-RNXMN5QY.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-L4S5N3WV.js";
123
+ } from "./chunk-TAHZHEJ4.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-FYYPQ27K.js";
145
+ } from "./chunk-7TFKWFY3.js";
143
146
  import {
144
147
  createProviderManager,
145
148
  detectModel,
146
149
  getLlmStatus,
147
150
  parseDefaultModelSelection
148
- } from "./chunk-M6X72DYZ.js";
151
+ } from "./chunk-NTYWC6PD.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-ACL4YUJH.js";
165
+ } from "./chunk-SYU5GNPN.js";
163
166
  import {
164
167
  deleteSetting,
165
168
  getSetting,
166
169
  setSetting
167
- } from "./chunk-STFIEU5F.js";
170
+ } from "./chunk-VFMHWU3E.js";
168
171
  import {
169
172
  initDatabase
170
- } from "./chunk-RGUUZD5B.js";
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
- const sb = sourceBranch ?? await getDefaultBranch(projectDir);
3317
- const validated = sourceBranch ? await resolveAndValidateSourceBranch(wsPath, sourceBranch, projectDir) : sb;
3318
- await runGit(wsPath, ["checkout", "-b", branch, validated]);
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
- res.json({ config: config3 });
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
- config3.rootDir = trimmed;
4484
+ savedRootDir = trimmed;
4485
+ } else {
4486
+ savedRootDir = null;
4399
4487
  }
4400
4488
  }
4401
4489
  try {
4402
4490
  await saveWorkspaceConfig(workdir, config3);
4403
- res.json({ config: config3 });
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 currentConfig = await loadWorkspaceConfig(workdir);
4442
- const previousRootDir = currentConfig?.rootDir ? resolveRootDir(currentConfig.rootDir, workdir) : null;
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,14 +5516,14 @@ 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-3X46OIYC.js");
5519
+ const { signalMcpReady } = await import("./server-4PB7BNE6.js");
5426
5520
  signalMcpReady();
5427
5521
  });
5428
5522
  const app = express();
5429
5523
  app.use(cors());
5430
5524
  const authMiddleware = async (req, res, next) => {
5431
5525
  const path = req.path;
5432
- const publicPaths = ["/health", "/auth", "/auth/login", "/auto-update/check"];
5526
+ const publicPaths = ["/health", "/auth", "/auth/login", "/auto-update/check", "/changelog"];
5433
5527
  if (publicPaths.includes(path)) {
5434
5528
  return next();
5435
5529
  }
@@ -5448,6 +5542,22 @@ async function createServerHandle(config3) {
5448
5542
  app.get("/api/health", (_req, res) => {
5449
5543
  res.json({ status: "ok", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
5450
5544
  });
5545
+ app.get("/api/changelog", async (_req, res) => {
5546
+ try {
5547
+ const fs = await import("fs");
5548
+ const path = await import("path");
5549
+ const { fileURLToPath: fileURLToPath8 } = await import("url");
5550
+ const dirname9 = path.dirname(fileURLToPath8(import.meta.url));
5551
+ let changelogPath = path.resolve(dirname9, "../CHANGELOG.md");
5552
+ if (!fs.existsSync(changelogPath)) {
5553
+ changelogPath = path.resolve(dirname9, "../../CHANGELOG.md");
5554
+ }
5555
+ const content = fs.readFileSync(changelogPath, "utf-8");
5556
+ res.json({ content });
5557
+ } catch {
5558
+ res.json({ content: "# Changelog\n\nUnable to load changelog." });
5559
+ }
5560
+ });
5451
5561
  app.get("/api/auth", (_req, res) => {
5452
5562
  const authRequired = requiresAuth();
5453
5563
  const hasPwd = hasPassword();
@@ -5484,7 +5594,7 @@ async function createServerHandle(config3) {
5484
5594
  res.json({ tools });
5485
5595
  });
5486
5596
  app.get("/api/projects", async (_req, res) => {
5487
- const { listProjects } = await import("./projects-ZGJGICGT.js");
5597
+ const { listProjects } = await import("./projects-HZ3WVTKG.js");
5488
5598
  const projects = listProjects();
5489
5599
  res.json({ projects });
5490
5600
  });
@@ -5493,7 +5603,7 @@ async function createServerHandle(config3) {
5493
5603
  if (!name || !workdir) {
5494
5604
  return res.status(400).json({ error: "name and workdir are required" });
5495
5605
  }
5496
- const { createDirectoryWithGit } = await import("./project-creator-NNUITNUI.js");
5606
+ const { createDirectoryWithGit } = await import("./project-creator-W5VW22DC.js");
5497
5607
  try {
5498
5608
  const project = await createDirectoryWithGit(name, workdir);
5499
5609
  res.status(201).json({ project });
@@ -5538,7 +5648,7 @@ async function createServerHandle(config3) {
5538
5648
  }
5539
5649
  });
5540
5650
  app.get("/api/projects/:id", async (req, res) => {
5541
- const { getProject: getProject2 } = await import("./projects-ZGJGICGT.js");
5651
+ const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
5542
5652
  const project = getProject2(req.params.id);
5543
5653
  if (!project) {
5544
5654
  return res.status(404).json({ error: "Project not found" });
@@ -5546,20 +5656,20 @@ async function createServerHandle(config3) {
5546
5656
  res.json({ project });
5547
5657
  });
5548
5658
  app.put("/api/projects/:id", async (req, res) => {
5549
- const { updateProject } = await import("./projects-ZGJGICGT.js");
5659
+ const { updateProject: updateProject2 } = await import("./projects-HZ3WVTKG.js");
5550
5660
  const { name, customInstructions, dangerLevel } = req.body;
5551
5661
  const updates = {};
5552
5662
  if (name !== void 0) updates.name = name;
5553
5663
  if (customInstructions !== void 0) updates.customInstructions = customInstructions;
5554
5664
  if (dangerLevel !== void 0) updates.dangerLevel = dangerLevel;
5555
- const updated = updateProject(req.params.id, updates);
5665
+ const updated = updateProject2(req.params.id, updates);
5556
5666
  if (!updated) {
5557
5667
  return res.status(404).json({ error: "Project not found" });
5558
5668
  }
5559
5669
  res.json({ project: updated });
5560
5670
  });
5561
5671
  app.delete("/api/projects/:id", async (req, res) => {
5562
- const { getProject: getProject2, deleteProject } = await import("./projects-ZGJGICGT.js");
5672
+ const { getProject: getProject2, deleteProject } = await import("./projects-HZ3WVTKG.js");
5563
5673
  const project = getProject2(req.params.id);
5564
5674
  if (!project) {
5565
5675
  return res.status(404).json({ error: "Project not found" });
@@ -5568,7 +5678,7 @@ async function createServerHandle(config3) {
5568
5678
  res.json({ success: true });
5569
5679
  });
5570
5680
  app.put("/api/projects/:id/star", async (req, res) => {
5571
- const { toggleStar } = await import("./projects-ZGJGICGT.js");
5681
+ const { toggleStar } = await import("./projects-HZ3WVTKG.js");
5572
5682
  const { isStarred } = req.body;
5573
5683
  if (typeof isStarred !== "boolean") {
5574
5684
  return res.status(400).json({ error: "isStarred is required and must be a boolean" });
@@ -5580,26 +5690,26 @@ async function createServerHandle(config3) {
5580
5690
  res.json({ project });
5581
5691
  });
5582
5692
  app.get("/api/projects/:id/branches", async (req, res) => {
5583
- const { getProject: getProject2 } = await import("./projects-ZGJGICGT.js");
5693
+ const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
5584
5694
  const project = getProject2(req.params.id);
5585
5695
  if (!project) return res.status(404).json({ error: "Project not found" });
5586
- const { listBranches } = await import("./workspace-MMV6V5P4.js");
5696
+ const { listBranches } = await import("./workspace-N4QHV6J2.js");
5587
5697
  const branches = await listBranches(project.workdir);
5588
5698
  res.json({ branches });
5589
5699
  });
5590
5700
  app.post("/api/projects/:id/checkout", async (req, res) => {
5591
- const { getProject: getProject2 } = await import("./projects-ZGJGICGT.js");
5701
+ const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
5592
5702
  const project = getProject2(req.params.id);
5593
5703
  if (!project) return res.status(404).json({ error: "Project not found" });
5594
5704
  const { branch } = req.body;
5595
5705
  if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
5596
- const { checkoutBranch, isGitRepository } = await import("./workspace-MMV6V5P4.js");
5706
+ const { checkoutBranch, isGitRepository } = await import("./workspace-N4QHV6J2.js");
5597
5707
  if (!await isGitRepository(project.workdir)) {
5598
5708
  return res.status(400).json({ error: "Project is not a git repository" });
5599
5709
  }
5600
5710
  try {
5601
5711
  await checkoutBranch(project.workdir, branch);
5602
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-V3BF2OTU.js");
5712
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-Q6SYLG6U.js");
5603
5713
  const allSessions = sessionManager.listSessions();
5604
5714
  for (const s of allSessions) {
5605
5715
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -5613,12 +5723,12 @@ async function createServerHandle(config3) {
5613
5723
  }
5614
5724
  });
5615
5725
  app.post("/api/projects/:id/checkout-new", async (req, res) => {
5616
- const { getProject: getProject2 } = await import("./projects-ZGJGICGT.js");
5726
+ const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
5617
5727
  const project = getProject2(req.params.id);
5618
5728
  if (!project) return res.status(404).json({ error: "Project not found" });
5619
5729
  const { name, sourceBranch } = req.body;
5620
5730
  if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
5621
- const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch: getDefaultBranch2, isGitRepository } = await import("./workspace-MMV6V5P4.js");
5731
+ const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-N4QHV6J2.js");
5622
5732
  if (!await isGitRepository(project.workdir)) {
5623
5733
  return res.status(400).json({ error: "Project is not a git repository" });
5624
5734
  }
@@ -5630,12 +5740,12 @@ async function createServerHandle(config3) {
5630
5740
  } else {
5631
5741
  sb = await resolveAndValidateSourceBranch2(
5632
5742
  project.workdir,
5633
- await getDefaultBranch2(project.workdir),
5743
+ await getDefaultBranch(project.workdir),
5634
5744
  project.workdir
5635
5745
  );
5636
5746
  }
5637
5747
  await createBranch(project.workdir, name, sb);
5638
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-V3BF2OTU.js");
5748
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-Q6SYLG6U.js");
5639
5749
  const allSessions = sessionManager.listSessions();
5640
5750
  for (const s of allSessions) {
5641
5751
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -5652,10 +5762,10 @@ async function createServerHandle(config3) {
5652
5762
  const session = sessionManager.getSession(req.params.id);
5653
5763
  if (!session) return res.status(404).json({ error: "Session not found" });
5654
5764
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
5655
- const { listBranches, getDefaultBranch: getDefaultBranch2 } = await import("./workspace-MMV6V5P4.js");
5765
+ const { listBranches, getDefaultBranch } = await import("./workspace-N4QHV6J2.js");
5656
5766
  const [branches, defaultBranch] = await Promise.all([
5657
5767
  listBranches(effectiveWorkdir),
5658
- getDefaultBranch2(session.workdir)
5768
+ getDefaultBranch(session.workdir)
5659
5769
  // project root, not workspace, for real upstream origin/HEAD
5660
5770
  ]);
5661
5771
  res.json({ branches, defaultBranch });
@@ -5666,8 +5776,8 @@ async function createServerHandle(config3) {
5666
5776
  const { branch } = req.body;
5667
5777
  if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
5668
5778
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
5669
- const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-MMV6V5P4.js");
5670
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-V3BF2OTU.js");
5779
+ const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-N4QHV6J2.js");
5780
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-Q6SYLG6U.js");
5671
5781
  try {
5672
5782
  await validateRef2(effectiveWorkdir, branch);
5673
5783
  await checkoutBranch(effectiveWorkdir, branch);
@@ -5709,17 +5819,17 @@ All file and git operations should use this branch.
5709
5819
  const { name, sourceBranch } = req.body;
5710
5820
  if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
5711
5821
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
5712
- const { validateRef: validateRef2 } = await import("./workspace-MMV6V5P4.js");
5713
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-V3BF2OTU.js");
5822
+ const { validateRef: validateRef2 } = await import("./workspace-N4QHV6J2.js");
5823
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-Q6SYLG6U.js");
5714
5824
  try {
5715
5825
  await validateRef2(effectiveWorkdir, name);
5716
5826
  if (sourceBranch) {
5717
- const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-MMV6V5P4.js");
5827
+ const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-N4QHV6J2.js");
5718
5828
  const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, sourceBranch, session.workdir);
5719
5829
  await createBranch(effectiveWorkdir, name, sb);
5720
5830
  } else {
5721
- const { createBranch, getDefaultBranch: getDefaultBranch2, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-MMV6V5P4.js");
5722
- const defaultBranch = await getDefaultBranch2(session.workdir);
5831
+ const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-N4QHV6J2.js");
5832
+ const defaultBranch = await getDefaultBranch(session.workdir);
5723
5833
  const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, defaultBranch, session.workdir);
5724
5834
  await createBranch(effectiveWorkdir, name, sb);
5725
5835
  }
@@ -5756,17 +5866,17 @@ All file and git operations should use this branch.
5756
5866
  }
5757
5867
  });
5758
5868
  app.get("/api/projects/:id/workspaces", async (req, res) => {
5759
- const { getProject: getProject2 } = await import("./projects-ZGJGICGT.js");
5869
+ const { getProject: getProject2 } = await import("./projects-HZ3WVTKG.js");
5760
5870
  const project = getProject2(req.params.id);
5761
5871
  if (!project) return res.status(404).json({ error: "Project not found" });
5762
- const { listWorkspaces } = await import("./workspace-MMV6V5P4.js");
5872
+ const { listWorkspaces } = await import("./workspace-N4QHV6J2.js");
5763
5873
  const all = await listWorkspaces(project.name, project.workdir);
5764
5874
  const workspacesList = all.filter((ws) => ws.path !== project.workdir);
5765
5875
  res.json({ workspaces: workspacesList });
5766
5876
  });
5767
5877
  app.get("/api/sessions", async (req, res) => {
5768
- const { getRecentUserPromptsForSession } = await import("./events-OEDAFNEI.js");
5769
- const { getPendingConfirmationsBySession } = await import("./path-security-DWL3R2SF.js");
5878
+ const { getRecentUserPromptsForSession } = await import("./events-OD7MN3FL.js");
5879
+ const { getPendingConfirmationsBySession } = await import("./path-security-M2JDUBKK.js");
5770
5880
  const projectId = req.query["projectId"];
5771
5881
  const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
5772
5882
  const offset = parseInt(req.query["offset"]) || 0;
@@ -5836,7 +5946,7 @@ All file and git operations should use this branch.
5836
5946
  if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
5837
5947
  const project = sessionManager.getProject(session.projectId);
5838
5948
  if (!project) return res.status(404).json({ error: "Project not found" });
5839
- const { isGitRepository } = await import("./workspace-MMV6V5P4.js");
5949
+ const { isGitRepository } = await import("./workspace-N4QHV6J2.js");
5840
5950
  if (!await isGitRepository(project.workdir)) {
5841
5951
  return res.status(400).json({ error: "Project is not a git repository" });
5842
5952
  }
@@ -5854,7 +5964,7 @@ All file and git operations should use this branch.
5854
5964
  if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
5855
5965
  const project = sessionManager.getProject(session.projectId);
5856
5966
  if (!project) return res.status(404).json({ error: "Project not found" });
5857
- const { isGitRepository } = await import("./workspace-MMV6V5P4.js");
5967
+ const { isGitRepository } = await import("./workspace-N4QHV6J2.js");
5858
5968
  if (!await isGitRepository(project.workdir)) {
5859
5969
  return res.status(400).json({ error: "Project is not a git repository" });
5860
5970
  }
@@ -5872,10 +5982,10 @@ All file and git operations should use this branch.
5872
5982
  }
5873
5983
  });
5874
5984
  app.get("/api/sessions/:id", async (req, res) => {
5875
- const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-OEDAFNEI.js");
5876
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-FGTCP73N.js");
5877
- const { getPendingQuestionsForSession } = await import("./tools-X65P65KF.js");
5878
- const { getMaxVisibleItems } = await import("./settings-AGNYWEIE.js");
5985
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-OD7MN3FL.js");
5986
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-TDDQ5CXT.js");
5987
+ const { getPendingQuestionsForSession } = await import("./tools-NLKP65HF.js");
5988
+ const { getMaxVisibleItems } = await import("./settings-PFZWX6VY.js");
5879
5989
  const session = sessionManager.getSession(req.params.id);
5880
5990
  if (!session) {
5881
5991
  return res.status(404).json({ error: "Session not found" });
@@ -5905,8 +6015,8 @@ All file and git operations should use this branch.
5905
6015
  if (!session) {
5906
6016
  return res.status(404).json({ error: "Session not found" });
5907
6017
  }
5908
- const { stopSessionExecution } = await import("./chat-handler-AVGJQSYW.js");
5909
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-X65P65KF.js");
6018
+ const { stopSessionExecution } = await import("./chat-handler-NOTXEOLF.js");
6019
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-NLKP65HF.js");
5910
6020
  sessionManager.clearMessageQueue(sessionId);
5911
6021
  stopSessionExecution(sessionId, sessionManager);
5912
6022
  abortSession(sessionId);
@@ -5935,9 +6045,9 @@ All file and git operations should use this branch.
5935
6045
  res.json({ success: true });
5936
6046
  });
5937
6047
  app.post("/api/sessions/:id/provider", async (req, res) => {
5938
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-OEDAFNEI.js");
5939
- const { buildMessagesFromStoredEvents } = await import("./folding-FGTCP73N.js");
5940
- const { getMaxVisibleItems } = await import("./settings-AGNYWEIE.js");
6048
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-OD7MN3FL.js");
6049
+ const { buildMessagesFromStoredEvents } = await import("./folding-TDDQ5CXT.js");
6050
+ const { getMaxVisibleItems } = await import("./settings-PFZWX6VY.js");
5941
6051
  const sessionId = req.params.id;
5942
6052
  const session = sessionManager.getSession(sessionId);
5943
6053
  if (!session) {
@@ -6050,9 +6160,9 @@ All file and git operations should use this branch.
6050
6160
  res.json({ success: true });
6051
6161
  });
6052
6162
  app.put("/api/sessions/:id/mode", async (req, res) => {
6053
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-OEDAFNEI.js");
6054
- const { buildMessagesFromStoredEvents } = await import("./folding-FGTCP73N.js");
6055
- const { getMaxVisibleItems } = await import("./settings-AGNYWEIE.js");
6163
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-OD7MN3FL.js");
6164
+ const { buildMessagesFromStoredEvents } = await import("./folding-TDDQ5CXT.js");
6165
+ const { getMaxVisibleItems } = await import("./settings-PFZWX6VY.js");
6056
6166
  const sessionId = req.params.id;
6057
6167
  const session = sessionManager.getSession(sessionId);
6058
6168
  if (!session) {
@@ -6113,7 +6223,7 @@ All file and git operations should use this branch.
6113
6223
  if (alwaysAllow !== void 0 && typeof alwaysAllow !== "boolean") {
6114
6224
  return res.status(400).json({ error: "alwaysAllow must be a boolean if provided" });
6115
6225
  }
6116
- const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-X65P65KF.js");
6226
+ const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-NLKP65HF.js");
6117
6227
  const pendingSessionId = getConfirmationSessionId(callId);
6118
6228
  if (!pendingSessionId) {
6119
6229
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
@@ -6125,11 +6235,11 @@ All file and git operations should use this branch.
6125
6235
  if (!result.found) {
6126
6236
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
6127
6237
  }
6128
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-OEDAFNEI.js");
6129
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-FGTCP73N.js");
6238
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-OD7MN3FL.js");
6239
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-TDDQ5CXT.js");
6130
6240
  const { createSessionStateMessage } = await import("./protocol-BUA2W2KM.js");
6131
- const { getPendingQuestionsForSession } = await import("./tools-X65P65KF.js");
6132
- const { getMaxVisibleItems } = await import("./settings-AGNYWEIE.js");
6241
+ const { getPendingQuestionsForSession } = await import("./tools-NLKP65HF.js");
6242
+ const { getMaxVisibleItems } = await import("./settings-PFZWX6VY.js");
6133
6243
  const eventStore = getEventStore2();
6134
6244
  const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(sessionId);
6135
6245
  const events = combineEvents(sessionId, snapshot, eventsSinceSnapshot);
@@ -6165,7 +6275,7 @@ All file and git operations should use this branch.
6165
6275
  if (!skip && typeof answer !== "string") {
6166
6276
  return res.status(400).json({ error: "answer is required when not skipping" });
6167
6277
  }
6168
- const { provideAnswer } = await import("./tools-X65P65KF.js");
6278
+ const { provideAnswer } = await import("./tools-NLKP65HF.js");
6169
6279
  const found = provideAnswer(callId, answer ?? "", skip ?? false);
6170
6280
  if (!found) {
6171
6281
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -6193,7 +6303,7 @@ All file and git operations should use this branch.
6193
6303
  if (!session) {
6194
6304
  return res.status(404).json({ error: "Session not found" });
6195
6305
  }
6196
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-AGNYWEIE.js");
6306
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-PFZWX6VY.js");
6197
6307
  if (getSetting2(SETTINGS_KEYS.CACHE_WARMING) !== "true") {
6198
6308
  return res.json({ success: false, reason: "disabled" });
6199
6309
  }
@@ -6225,7 +6335,7 @@ All file and git operations should use this branch.
6225
6335
  backend: activeProvider?.backend ?? llmClient.getBackend(),
6226
6336
  model: llmClient.getModel()
6227
6337
  };
6228
- const { runAgentTurn, TurnMetrics } = await import("./orchestrator-AGJ7EMFZ.js");
6338
+ const { runAgentTurn, TurnMetrics } = await import("./orchestrator-NQDWCULY.js");
6229
6339
  runAgentTurn(
6230
6340
  {
6231
6341
  sessionManager,
@@ -6263,15 +6373,15 @@ All file and git operations should use this branch.
6263
6373
  if (!session) {
6264
6374
  return res.status(404).json({ error: "Session not found" });
6265
6375
  }
6266
- const { stopSessionExecution } = await import("./chat-handler-AVGJQSYW.js");
6267
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-X65P65KF.js");
6376
+ const { stopSessionExecution } = await import("./chat-handler-NOTXEOLF.js");
6377
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-NLKP65HF.js");
6268
6378
  const queuedMessages = sessionManager.getQueueState(sessionId);
6269
6379
  sessionManager.clearMessageQueue(sessionId);
6270
6380
  stopSessionExecution(sessionId, sessionManager);
6271
6381
  abortSession(sessionId);
6272
6382
  cancelQuestionsForSession(sessionId, "Session stopped by user");
6273
6383
  cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
6274
- const eventStore = (await import("./events-OEDAFNEI.js")).getEventStore();
6384
+ const eventStore = (await import("./events-OD7MN3FL.js")).getEventStore();
6275
6385
  eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
6276
6386
  res.json({ success: true, queuedMessages });
6277
6387
  });
@@ -6285,7 +6395,7 @@ All file and git operations should use this branch.
6285
6395
  if (typeof messageIndex !== "number" || messageIndex < 0) {
6286
6396
  return res.status(400).json({ error: "messageIndex must be a non-negative number" });
6287
6397
  }
6288
- const { truncateSessionMessages } = await import("./events-OEDAFNEI.js");
6398
+ const { truncateSessionMessages } = await import("./events-OD7MN3FL.js");
6289
6399
  truncateSessionMessages(sessionId, messageIndex);
6290
6400
  res.json({ success: true });
6291
6401
  });
@@ -6302,8 +6412,8 @@ All file and git operations should use this branch.
6302
6412
  if (content !== void 0 && (typeof content !== "string" || !content.trim())) {
6303
6413
  return res.status(400).json({ error: "content must be a non-empty string if provided" });
6304
6414
  }
6305
- const { getEventStore: getEventStore2 } = await import("./events-OEDAFNEI.js");
6306
- const { buildMessagesFromStoredEvents } = await import("./folding-FGTCP73N.js");
6415
+ const { getEventStore: getEventStore2 } = await import("./events-OD7MN3FL.js");
6416
+ const { buildMessagesFromStoredEvents } = await import("./folding-TDDQ5CXT.js");
6307
6417
  const eventStore = getEventStore2();
6308
6418
  const events = eventStore.getEvents(sessionId);
6309
6419
  const { messages } = buildMessagesFromStoredEvents(events);
@@ -6315,11 +6425,35 @@ All file and git operations should use this branch.
6315
6425
  if (msg.role !== "user" || msg.isSystemGenerated) {
6316
6426
  return res.status(400).json({ error: "Can only replay user messages" });
6317
6427
  }
6318
- const { truncateSessionMessages } = await import("./events-OEDAFNEI.js");
6428
+ const { truncateSessionMessages } = await import("./events-OD7MN3FL.js");
6319
6429
  truncateSessionMessages(sessionId, msgIndex - 1);
6320
6430
  sessionManager.queueMessage(sessionId, "asap", content ?? msg.content, msg.attachments, msg.messageKind);
6321
6431
  res.json({ success: true });
6322
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
+ });
6323
6457
  app.post("/api/sessions/:id/chat", async (req, res) => {
6324
6458
  const sessionId = req.params.id;
6325
6459
  const session = sessionManager.getSession(sessionId);
@@ -6347,7 +6481,7 @@ All file and git operations should use this branch.
6347
6481
  res.json({ accepted: true });
6348
6482
  });
6349
6483
  app.get("/api/settings", async (req, res) => {
6350
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-AGNYWEIE.js");
6484
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-PFZWX6VY.js");
6351
6485
  const keysParam = req.query["keys"];
6352
6486
  if (!keysParam) {
6353
6487
  return res.status(400).json({ error: "keys query parameter is required" });
@@ -6360,19 +6494,19 @@ All file and git operations should use this branch.
6360
6494
  res.json(result);
6361
6495
  });
6362
6496
  app.get("/api/settings/:key", async (req, res) => {
6363
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-AGNYWEIE.js");
6497
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-PFZWX6VY.js");
6364
6498
  const key = req.params.key;
6365
6499
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
6366
6500
  res.json({ key, value });
6367
6501
  });
6368
6502
  app.get("/api/settings/:key", async (req, res) => {
6369
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-AGNYWEIE.js");
6503
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-PFZWX6VY.js");
6370
6504
  const key = req.params.key;
6371
6505
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
6372
6506
  res.json({ key, value });
6373
6507
  });
6374
6508
  app.put("/api/settings/:key", async (req, res) => {
6375
- const { setSetting: setSetting2 } = await import("./settings-AGNYWEIE.js");
6509
+ const { setSetting: setSetting2 } = await import("./settings-PFZWX6VY.js");
6376
6510
  const key = req.params.key;
6377
6511
  const { value } = req.body;
6378
6512
  if (value === void 0) {
@@ -6399,7 +6533,7 @@ All file and git operations should use this branch.
6399
6533
  }
6400
6534
  });
6401
6535
  app.get("/api/tools/shells", async (_req, res) => {
6402
- const { listAvailableShells } = await import("./platform-OYKGQ7Z3.js");
6536
+ const { listAvailableShells } = await import("./platform-55N6FRRU.js");
6403
6537
  res.json({ shells: listAvailableShells() });
6404
6538
  });
6405
6539
  app.get("/api/config", async (_req, res) => {
@@ -6558,7 +6692,7 @@ All file and git operations should use this branch.
6558
6692
  }
6559
6693
  });
6560
6694
  app.post("/api/proxy/test", async (_req, res) => {
6561
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-AGNYWEIE.js");
6695
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-PFZWX6VY.js");
6562
6696
  const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
6563
6697
  if (!proxyUrl) {
6564
6698
  return res.status(400).json({ success: false, error: "No proxy URL configured" });
@@ -6585,7 +6719,7 @@ All file and git operations should use this branch.
6585
6719
  const backend = req.query["backend"];
6586
6720
  if (!url) return res.status(400).json({ error: "url is required" });
6587
6721
  try {
6588
- const { fetchModelsWithContext } = await import("./provider-manager-3DW3A2VC.js");
6722
+ const { fetchModelsWithContext } = await import("./provider-manager-OLDOHCR2.js");
6589
6723
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
6590
6724
  const models = await fetchModelsWithContext(
6591
6725
  url,
@@ -6656,7 +6790,7 @@ All file and git operations should use this branch.
6656
6790
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
6657
6791
  const { getBackendCapabilities } = await import("./backend-P3GHHLHJ.js");
6658
6792
  const { buildNonStreamingCreateParams } = await import("./client-pure-5YE5WFJP.js");
6659
- const { OpenAIHttpClient } = await import("./http-client-I52X7GQB.js");
6793
+ const { OpenAIHttpClient } = await import("./http-client-IPJGJXNJ.js");
6660
6794
  const { ensureVersionPrefix } = await import("./url-utils-SAJP7AEX.js");
6661
6795
  const profile = getModelProfile2(model);
6662
6796
  const capabilities = getBackendCapabilities(backend || "unknown");
@@ -6914,7 +7048,7 @@ All file and git operations should use this branch.
6914
7048
  });
6915
7049
  async function rebuildMcpTools() {
6916
7050
  const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-MOGEI6TP.js");
6917
- const { setMcpTools: setMcpTools2 } = await import("./tools-X65P65KF.js");
7051
+ const { setMcpTools: setMcpTools2 } = await import("./tools-NLKP65HF.js");
6918
7052
  const mcpTools = createMcpTools2(mcpManager);
6919
7053
  setMcpTools2(mcpTools);
6920
7054
  }
@@ -7161,13 +7295,13 @@ All file and git operations should use this branch.
7161
7295
  })
7162
7296
  );
7163
7297
  app.get("/api/sessions/:id/background-processes", async (req, res) => {
7164
- const { getSessionProcesses } = await import("./manager-TD2UT62O.js");
7298
+ const { getSessionProcesses } = await import("./manager-6UIC3QKJ.js");
7165
7299
  const sessionId = req.params.id;
7166
7300
  const processes = getSessionProcesses(sessionId);
7167
7301
  res.json({ processes });
7168
7302
  });
7169
7303
  app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
7170
- const { stopProcess } = await import("./manager-TD2UT62O.js");
7304
+ const { stopProcess } = await import("./manager-6UIC3QKJ.js");
7171
7305
  const sessionId = req.params.id;
7172
7306
  const processId = req.params.processId;
7173
7307
  const session = sessionManager.getSession(sessionId);
@@ -7310,7 +7444,7 @@ All file and git operations should use this branch.
7310
7444
  const state = sessionManager.getContextState(sessionId);
7311
7445
  wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
7312
7446
  });
7313
- const { QueueProcessor } = await import("./processor-VCDVG7RV.js");
7447
+ const { QueueProcessor } = await import("./processor-FE4ZJ7GS.js");
7314
7448
  const queueProcessor = new QueueProcessor({
7315
7449
  sessionManager,
7316
7450
  providerManager,
@@ -7352,7 +7486,7 @@ All file and git operations should use this branch.
7352
7486
  void (async () => {
7353
7487
  await devServerManager.stopAll();
7354
7488
  await mcpManager.disconnectAll();
7355
- const { stopAllInspectProxies } = await import("./inspect-proxy-DRYIIH4O.js");
7489
+ const { stopAllInspectProxies } = await import("./inspect-proxy-CN2MUFQ5.js");
7356
7490
  stopAllInspectProxies();
7357
7491
  const { cleanupAllProcesses } = await import("./store-SARB6V2N.js");
7358
7492
  cleanupAllProcesses();
@@ -7382,6 +7516,10 @@ async function createServer(config3) {
7382
7516
  forceExitTimer.unref();
7383
7517
  handle.close().then(() => process.exit(0));
7384
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
+ });
7385
7523
  process.on("SIGINT", shutdown);
7386
7524
  process.on("SIGTERM", shutdown);
7387
7525
  }
@@ -7390,4 +7528,4 @@ export {
7390
7528
  createServerHandle,
7391
7529
  createServer
7392
7530
  };
7393
- //# sourceMappingURL=chunk-VGYV5EH6.js.map
7531
+ //# sourceMappingURL=chunk-5OGOPB3I.js.map