openfox 2.0.104 → 2.0.106

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 (86) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/CHANGELOG.md +41 -0
  3. package/dist/agent-defaults/planner.agent.md +2 -1
  4. package/dist/{chat-handler-G2ZJNAVB.js → chat-handler-A22X22VZ.js} +24 -24
  5. package/dist/{chunk-YXIDKMBJ.js → chunk-26DEYDYV.js} +4 -4
  6. package/dist/{chunk-6SIX7P6O.js → chunk-2GM6SUIQ.js} +2 -2
  7. package/dist/{chunk-ZASSAZ73.js → chunk-33Q7LCVD.js} +2 -2
  8. package/dist/{chunk-S5HDT5RQ.js → chunk-3C73IUUL.js} +2 -2
  9. package/dist/{chunk-F766OIDT.js → chunk-46KNPXY6.js} +3 -3
  10. package/dist/{chunk-5ZJYEINJ.js → chunk-5M45NHQ2.js} +2 -2
  11. package/dist/{chunk-WWFH5GAR.js → chunk-6FPGJR7O.js} +2 -2
  12. package/dist/{chunk-PKLWSTDB.js → chunk-6M44ZHQA.js} +32 -32
  13. package/dist/{chunk-TFQSCHVU.js → chunk-6VNB4L4V.js} +3 -3
  14. package/dist/{chunk-3NVISPE7.js → chunk-AYUUGKZU.js} +14 -16
  15. package/dist/chunk-C5YV3EA4.js +7 -0
  16. package/dist/{chunk-B56G5OEF.js → chunk-D6ODGTSZ.js} +5 -3
  17. package/dist/{chunk-XWW7LOU4.js → chunk-G2VLGZ3Y.js} +256 -164
  18. package/dist/{chunk-DMI2BXHA.js → chunk-GXW4CRR5.js} +7 -6
  19. package/dist/{chunk-W2KZ7H55.js → chunk-HU22EVEM.js} +7 -7
  20. package/dist/{chunk-OUMHR7LR.js → chunk-IA4Y3CKA.js} +7 -6
  21. package/dist/{chunk-SPA7PQPJ.js → chunk-KIAKWUZ3.js} +2 -2
  22. package/dist/{chunk-GLF65XDS.js → chunk-LCQ5AN6Y.js} +8 -1
  23. package/dist/{chunk-B76OP3OE.js → chunk-LOHVZGCM.js} +4 -4
  24. package/dist/{chunk-UADZ2LZJ.js → chunk-OEPRHAIO.js} +3 -3
  25. package/dist/{chunk-HZXWVD5A.js → chunk-P4APMCTX.js} +85 -25
  26. package/dist/{chunk-EFIC3TUX.js → chunk-QBKAW5H4.js} +7 -7
  27. package/dist/{chunk-D3SXT3BL.js → chunk-RRTKVJMF.js} +5 -10
  28. package/dist/{chunk-J27BLIPY.js → chunk-SGJ3LSVA.js} +3 -2
  29. package/dist/{chunk-WHJ67MO2.js → chunk-SUTJJWUK.js} +7 -7
  30. package/dist/{chunk-ERKPMNC7.js → chunk-TB7TTPYQ.js} +2 -2
  31. package/dist/{chunk-2COWPTSJ.js → chunk-UCIZV76E.js} +4 -8
  32. package/dist/{chunk-EF7KGWF6.js → chunk-UXQN7FGB.js} +2 -2
  33. package/dist/{chunk-5VKT34HE.js → chunk-V6Y6OLB4.js} +2 -2
  34. package/dist/{chunk-KCED2X4H.js → chunk-WDJOSRIB.js} +12 -5
  35. package/dist/{chunk-62QCBNPE.js → chunk-WLJJRX22.js} +10 -3
  36. package/dist/{chunk-ERTTKKCE.js → chunk-X3USQHHK.js} +2 -2
  37. package/dist/cli/dev.js +1 -1
  38. package/dist/cli/index.js +1 -1
  39. package/dist/{client-2EAJAGPC.js → client-MP3FSNN7.js} +6 -6
  40. package/dist/{client-pure-ONSVWEG5.js → client-pure-USVHN4WG.js} +2 -2
  41. package/dist/{compactor-IEYTUHYX.js → compactor-KK2BVJK5.js} +12 -12
  42. package/dist/{config-3FKJV3KI.js → config-HX7FDKGJ.js} +2 -2
  43. package/dist/{dynamic-context-Z5BU2RVP.js → dynamic-context-ZUXI5UTW.js} +9 -9
  44. package/dist/{events-BGVLDGLK.js → events-OJ2R6OEM.js} +7 -7
  45. package/dist/{folding-AJMZBHNR.js → folding-DUZSKCZF.js} +5 -5
  46. package/dist/http-client-KJXFSK7A.js +11 -0
  47. package/dist/{inspect-proxy-GF6OI7MR.js → inspect-proxy-N42Z5TOG.js} +4 -4
  48. package/dist/{manager-GGIIENDX.js → manager-N27WNW5B.js} +5 -5
  49. package/dist/{model-overrides-BLEFI7FQ.js → model-overrides-36SQR3JR.js} +4 -4
  50. package/dist/{openFolder-Z27FEM5M.js → openFolder-HX7X356L.js} +2 -2
  51. package/dist/{orchestrator-SYAYO6NS.js → orchestrator-VZORJ7KF.js} +23 -23
  52. package/dist/package.json +4 -2
  53. package/dist/{path-security-JCDBLFIE.js → path-security-QCIA6YFV.js} +8 -8
  54. package/dist/{permissions-CGEK3DGZ.js → permissions-K6YEA2ZZ.js} +12 -1
  55. package/dist/{platform-GZ2WIDS5.js → platform-Q6T3AUHA.js} +4 -4
  56. package/dist/{processor-CBGV2K4E.js → processor-QYVHKRIV.js} +23 -23
  57. package/dist/{project-creator-SMWFMIU5.js → project-creator-BVA55HY6.js} +4 -4
  58. package/dist/{projects-M5XKC7O6.js → projects-PQXME5S4.js} +3 -3
  59. package/dist/{protocol-rfiBDoXm.d.ts → protocol-zRSsysOe.d.ts} +1 -1
  60. package/dist/provider/index.d.ts +4 -4
  61. package/dist/{provider-XCVHKXPS.js → provider-RQQ5JN34.js} +9 -9
  62. package/dist/{provider-manager-AUYP3QAM.js → provider-manager-RUC5QQ75.js} +7 -7
  63. package/dist/{registry-M2QVGRNK.js → registry-BDSTPV65.js} +4 -4
  64. package/dist/{serve-NPS4GJWH.js → serve-2O7G2WZF.js} +32 -32
  65. package/dist/server/index.d.ts +33 -4
  66. package/dist/server/index.js +31 -31
  67. package/dist/server-CYE6XY7J.js +47 -0
  68. package/dist/{session-overrides-HA5IQYLI.js → session-overrides-SFWPS5CT.js} +6 -6
  69. package/dist/{sessions-ZV2WRC6K.js → sessions-TZNUQJ2I.js} +5 -5
  70. package/dist/{settings-TGCITCVA.js → settings-5LG7IB3K.js} +3 -3
  71. package/dist/shared/index.d.ts +3 -3
  72. package/dist/skill-defaults/browser/SKILL.md +36 -22
  73. package/dist/{tools-KKALZLKX.js → tools-Y4F4HJPO.js} +21 -21
  74. package/dist/{types-o0v5xVxu.d.ts → types-CTl70hba.d.ts} +12 -1
  75. package/dist/{types-o-YQ3Bfq.d.ts → types-_uF_PRaD.d.ts} +1 -1
  76. package/dist/{update-7BEZMI4R.js → update-QEZIUJHR.js} +2 -2
  77. package/dist/web/assets/index-BxI3Y9C7.js +323 -0
  78. package/dist/web/index.html +1 -1
  79. package/dist/web/sw.js +1 -1
  80. package/dist/workflow-defaults/default.workflow.json +3 -3
  81. package/dist/{workspace-2NDXTCVR.js → workspace-2OG5VQG6.js} +4 -4
  82. package/package.json +4 -2
  83. package/dist/chunk-MLOCSFIW.js +0 -7
  84. package/dist/http-client-A7A4XWNK.js +0 -11
  85. package/dist/server-FKM4FQKD.js +0 -47
  86. package/dist/web/assets/index-BoWCT9PC.js +0 -323
@@ -21,10 +21,10 @@ import {
21
21
  tokenFromPassword,
22
22
  verifyPassword,
23
23
  workflowExists
24
- } from "./chunk-HZXWVD5A.js";
24
+ } from "./chunk-P4APMCTX.js";
25
25
  import {
26
26
  openFolder
27
- } from "./chunk-62QCBNPE.js";
27
+ } from "./chunk-WLJJRX22.js";
28
28
  import {
29
29
  createToolRegistry,
30
30
  devServerManager,
@@ -34,7 +34,7 @@ import {
34
34
  setMcpManagerForTools,
35
35
  setMcpTools,
36
36
  setNotifyMcpServersChanged
37
- } from "./chunk-PKLWSTDB.js";
37
+ } from "./chunk-6M44ZHQA.js";
38
38
  import {
39
39
  deleteOwnedSkill,
40
40
  deleteProjectSkill,
@@ -53,12 +53,12 @@ import {
53
53
  setSkillEnabled,
54
54
  skillExists,
55
55
  updateOwnedSkill
56
- } from "./chunk-B76OP3OE.js";
56
+ } from "./chunk-LOHVZGCM.js";
57
57
  import {
58
58
  ALWAYS_ALLOWED,
59
59
  ALWAYS_ALLOWED_FOR_SUBAGENTS,
60
60
  TOP_LEVEL_ONLY_TOOLS
61
- } from "./chunk-J27BLIPY.js";
61
+ } from "./chunk-SGJ3LSVA.js";
62
62
  import {
63
63
  createMcpTools
64
64
  } from "./chunk-JE7LW7Y6.js";
@@ -76,11 +76,11 @@ import {
76
76
  validateRef,
77
77
  validateWorkspaceName,
78
78
  workspaceExists
79
- } from "./chunk-D3SXT3BL.js";
79
+ } from "./chunk-RRTKVJMF.js";
80
80
  import {
81
81
  getSessionDisabledServers,
82
82
  setSessionDisabledServers
83
- } from "./chunk-UADZ2LZJ.js";
83
+ } from "./chunk-OEPRHAIO.js";
84
84
  import {
85
85
  emitAssistantMessageStart,
86
86
  emitContextState,
@@ -97,7 +97,7 @@ import {
97
97
  getEventStore,
98
98
  getSessionState,
99
99
  initEventStore
100
- } from "./chunk-DMI2BXHA.js";
100
+ } from "./chunk-GXW4CRR5.js";
101
101
  import {
102
102
  createContextStateMessage
103
103
  } from "./chunk-27SDWNKL.js";
@@ -107,21 +107,21 @@ import {
107
107
  import {
108
108
  getPathSeparator,
109
109
  isAbsolutePath
110
- } from "./chunk-EF7KGWF6.js";
110
+ } from "./chunk-UXQN7FGB.js";
111
111
  import {
112
112
  getAgentModelOverride,
113
113
  getAgentModelOverrides,
114
114
  resolveLLMClientForAgent,
115
115
  setAgentModelOverride
116
- } from "./chunk-5VKT34HE.js";
116
+ } from "./chunk-V6Y6OLB4.js";
117
117
  import {
118
118
  getProject,
119
119
  getProjectByWorkdir,
120
120
  updateProject
121
- } from "./chunk-WWFH5GAR.js";
121
+ } from "./chunk-6FPGJR7O.js";
122
122
  import {
123
123
  VERSION
124
- } from "./chunk-MLOCSFIW.js";
124
+ } from "./chunk-C5YV3EA4.js";
125
125
  import {
126
126
  clearWorkflowExecution,
127
127
  createSession,
@@ -141,7 +141,7 @@ import {
141
141
  updateSessionRunning,
142
142
  updateSessionWorkdir,
143
143
  updateWorkflowExecutionStatus
144
- } from "./chunk-OUMHR7LR.js";
144
+ } from "./chunk-IA4Y3CKA.js";
145
145
  import {
146
146
  agentExists,
147
147
  deleteAgent,
@@ -164,13 +164,13 @@ import {
164
164
  saveAgentToProject,
165
165
  saveItemToDir,
166
166
  setRuntimeConfig
167
- } from "./chunk-6SIX7P6O.js";
167
+ } from "./chunk-2GM6SUIQ.js";
168
168
  import {
169
169
  createProviderManager,
170
170
  detectModel,
171
171
  getLlmStatus,
172
172
  parseDefaultModelSelection
173
- } from "./chunk-2COWPTSJ.js";
173
+ } from "./chunk-UCIZV76E.js";
174
174
  import {
175
175
  getModelProfile
176
176
  } from "./chunk-V4IE7HJY.js";
@@ -183,15 +183,15 @@ import {
183
183
  import {
184
184
  SessionNotFoundError,
185
185
  WorkspaceInUseError
186
- } from "./chunk-ERKPMNC7.js";
186
+ } from "./chunk-TB7TTPYQ.js";
187
187
  import {
188
188
  deleteSetting,
189
189
  getSetting,
190
190
  setSetting
191
- } from "./chunk-SPA7PQPJ.js";
191
+ } from "./chunk-KIAKWUZ3.js";
192
192
  import {
193
193
  initDatabase
194
- } from "./chunk-GLF65XDS.js";
194
+ } from "./chunk-LCQ5AN6Y.js";
195
195
  import {
196
196
  logger,
197
197
  setLogLevel
@@ -2786,6 +2786,50 @@ var SessionManager = class {
2786
2786
  const branch = await getGitBranch(effectiveWorkdir);
2787
2787
  return { workdir: effectiveWorkdir, branch };
2788
2788
  }
2789
+ /**
2790
+ * Verify the session's effective workdir is on the branch the session was
2791
+ * bound to. Used as an early gate before any agent step of a workflow
2792
+ * execution, so we never run against the wrong tree when the session branch
2793
+ * and the actual git branch have diverged (#183).
2794
+ *
2795
+ * Decision matrix (fail-closed):
2796
+ * - expectedBranch null → ok, regardless of actualBranch.
2797
+ * - expectedBranch set, actualBranch set, equal → ok.
2798
+ * - expectedBranch set, actualBranch set, differ → BLOCKED.
2799
+ * - expectedBranch set, actualBranch null → BLOCKED (we cannot
2800
+ * verify the workdir is on the right branch — detached HEAD, broken
2801
+ * repository, missing .git, etc.).
2802
+ *
2803
+ * Returning `{ ok: true }` for a session that has a branch expectation but
2804
+ * no resolvable actual branch would be fail-open and is forbidden.
2805
+ */
2806
+ async assertExecutionGitContext(sessionId) {
2807
+ const session = this.requireSession(sessionId);
2808
+ const expectedBranch = session.branch ?? null;
2809
+ const { workdir, branch: actualBranch } = await this.getActualBranchPair(sessionId);
2810
+ if (!expectedBranch) {
2811
+ return { ok: true, workdir, actualBranch, expectedBranch };
2812
+ }
2813
+ if (actualBranch && expectedBranch === actualBranch) {
2814
+ return { ok: true, workdir, actualBranch, expectedBranch };
2815
+ }
2816
+ if (!actualBranch) {
2817
+ return {
2818
+ ok: false,
2819
+ reason: `Cannot verify Git context for workdir '${workdir}': expected branch '${expectedBranch}' but the actual branch is unavailable (detached HEAD, missing .git, or unreadable repository). Refusing to write \u2014 no agent was run, no checkout was performed. Use the workspace tool to switch to branch '${expectedBranch}' (or repair the workdir) and retry.`,
2820
+ workdir,
2821
+ expectedBranch,
2822
+ actualBranch: null
2823
+ };
2824
+ }
2825
+ return {
2826
+ ok: false,
2827
+ reason: `Git context mismatch before Dev & Verify: session branch is '${expectedBranch}' but workdir '${workdir}' is actually on '${actualBranch}'. Refusing to write \u2014 no agent was run, no checkout was performed. Use the workspace tool to switch to branch '${expectedBranch}' (or update the session branch) and retry.`,
2828
+ workdir,
2829
+ expectedBranch,
2830
+ actualBranch
2831
+ };
2832
+ }
2789
2833
  // ============================================================================
2790
2834
  // Session Lifecycle
2791
2835
  // ============================================================================
@@ -3095,8 +3139,8 @@ var SessionManager = class {
3095
3139
  /**
3096
3140
  * Pause at a user step. Sets status to 'waiting' and records step output.
3097
3141
  */
3098
- waitAtStep(sessionId, executionId, stepId, stepName, stepOutput, workflowId, workflowName, workflowColor) {
3099
- updateWorkflowExecutionStatus(executionId, "waiting", stepId, stepName, stepOutput);
3142
+ waitAtStep(sessionId, executionId, stepId, stepName, stepOutput, workflowId, workflowName, workflowColor, pendingChoices) {
3143
+ updateWorkflowExecutionStatus(executionId, "waiting", stepId, stepName, stepOutput, pendingChoices);
3100
3144
  emitWorkflowExecutionChanged(
3101
3145
  sessionId,
3102
3146
  executionId,
@@ -3105,7 +3149,8 @@ var SessionManager = class {
3105
3149
  workflowColor,
3106
3150
  "waiting",
3107
3151
  stepId,
3108
- stepName
3152
+ stepName,
3153
+ pendingChoices
3109
3154
  );
3110
3155
  this.setPhase(sessionId, "waiting");
3111
3156
  const updatedSession = this.requireSession(sessionId);
@@ -3117,7 +3162,7 @@ var SessionManager = class {
3117
3162
  resumeWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor) {
3118
3163
  const row = getActiveWorkflowExecution(sessionId);
3119
3164
  if (!row || row.id !== executionId) return null;
3120
- updateWorkflowExecutionStatus(executionId, "running");
3165
+ updateWorkflowExecutionStatus(executionId, "running", void 0, void 0, void 0, []);
3121
3166
  emitWorkflowExecutionChanged(
3122
3167
  sessionId,
3123
3168
  executionId,
@@ -3126,7 +3171,8 @@ var SessionManager = class {
3126
3171
  workflowColor,
3127
3172
  "running",
3128
3173
  row.current_step_id ?? void 0,
3129
- row.current_step_name ?? void 0
3174
+ row.current_step_name ?? void 0,
3175
+ []
3130
3176
  );
3131
3177
  const updatedSession = this.requireSession(sessionId);
3132
3178
  this.emit({ type: "session_updated", session: updatedSession });
@@ -3139,9 +3185,19 @@ var SessionManager = class {
3139
3185
  * Mark workflow as completed and clean up.
3140
3186
  */
3141
3187
  completeWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor) {
3142
- updateWorkflowExecutionStatus(executionId, "completed");
3188
+ updateWorkflowExecutionStatus(executionId, "completed", void 0, void 0, void 0, []);
3143
3189
  clearWorkflowExecution(executionId);
3144
- emitWorkflowExecutionChanged(sessionId, executionId, workflowId, workflowName, workflowColor, "completed");
3190
+ emitWorkflowExecutionChanged(
3191
+ sessionId,
3192
+ executionId,
3193
+ workflowId,
3194
+ workflowName,
3195
+ workflowColor,
3196
+ "completed",
3197
+ void 0,
3198
+ void 0,
3199
+ []
3200
+ );
3145
3201
  this.setPhase(sessionId, "done");
3146
3202
  const updatedSession = this.requireSession(sessionId);
3147
3203
  this.emit({ type: "session_updated", session: updatedSession });
@@ -3150,9 +3206,19 @@ var SessionManager = class {
3150
3206
  * Cancel/exit a workflow execution.
3151
3207
  */
3152
3208
  cancelWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor) {
3153
- updateWorkflowExecutionStatus(executionId, "cancelled");
3209
+ updateWorkflowExecutionStatus(executionId, "cancelled", void 0, void 0, void 0, []);
3154
3210
  clearWorkflowExecution(executionId);
3155
- emitWorkflowExecutionChanged(sessionId, executionId, workflowId, workflowName, workflowColor, "cancelled");
3211
+ emitWorkflowExecutionChanged(
3212
+ sessionId,
3213
+ executionId,
3214
+ workflowId,
3215
+ workflowName,
3216
+ workflowColor,
3217
+ "cancelled",
3218
+ void 0,
3219
+ void 0,
3220
+ []
3221
+ );
3156
3222
  this.setPhase(sessionId, "build");
3157
3223
  const updatedSession = this.requireSession(sessionId);
3158
3224
  this.emit({ type: "session_updated", session: updatedSession });
@@ -3161,9 +3227,19 @@ var SessionManager = class {
3161
3227
  * Mark workflow as blocked.
3162
3228
  */
3163
3229
  blockWorkflow(sessionId, executionId, workflowId, workflowName, workflowColor) {
3164
- updateWorkflowExecutionStatus(executionId, "blocked");
3230
+ updateWorkflowExecutionStatus(executionId, "blocked", void 0, void 0, void 0, []);
3165
3231
  clearWorkflowExecution(executionId);
3166
- emitWorkflowExecutionChanged(sessionId, executionId, workflowId, workflowName, workflowColor, "blocked");
3232
+ emitWorkflowExecutionChanged(
3233
+ sessionId,
3234
+ executionId,
3235
+ workflowId,
3236
+ workflowName,
3237
+ workflowColor,
3238
+ "blocked",
3239
+ void 0,
3240
+ void 0,
3241
+ []
3242
+ );
3167
3243
  this.setPhase(sessionId, "blocked");
3168
3244
  const updatedSession = this.requireSession(sessionId);
3169
3245
  this.emit({ type: "session_updated", session: updatedSession });
@@ -3185,6 +3261,7 @@ var SessionManager = class {
3185
3261
  ...row.current_step_name ? { currentStepName: row.current_step_name } : {},
3186
3262
  stepOutput: JSON.parse(row.step_output ?? "{}"),
3187
3263
  params: JSON.parse(row.params ?? "{}"),
3264
+ ...row.pending_choices ? { pendingChoices: JSON.parse(row.pending_choices) } : {},
3188
3265
  createdAt: row.created_at,
3189
3266
  updatedAt: row.updated_at
3190
3267
  };
@@ -4016,6 +4093,12 @@ import { join as join3 } from "path";
4016
4093
  function computeOverrideIds(defaults, userItems) {
4017
4094
  return userItems.filter((u) => defaults.some((d) => d.metadata.id === u.metadata.id)).map((u) => u.metadata.id);
4018
4095
  }
4096
+ function resolveProjectDir(req, fallback) {
4097
+ const workdir = req.query["workdir"];
4098
+ if (typeof workdir !== "string") return fallback;
4099
+ const trimmed = workdir.trim();
4100
+ return trimmed ? trimmed : fallback;
4101
+ }
4019
4102
  var ID_REGEX = /^[a-z0-9-]+$/;
4020
4103
  function validateNameIdPrompt(body) {
4021
4104
  const meta = body["metadata"];
@@ -4035,15 +4118,16 @@ async function isProjectItem(projectDir, dirName, id, ext) {
4035
4118
  }
4036
4119
  function createCrudRoutes(config3, configDir, projectDir) {
4037
4120
  const router = Router();
4038
- router.get("/", async (_req, res) => {
4121
+ router.get("/", async (req, res) => {
4122
+ const effectiveProjectDir = resolveProjectDir(req, projectDir);
4039
4123
  const [defaults, userItems, projectItems] = await Promise.all([
4040
4124
  config3.loadDefaults(),
4041
4125
  config3.loadUser(configDir),
4042
- projectDir ? config3.loadProject(projectDir) : []
4126
+ effectiveProjectDir ? config3.loadProject(effectiveProjectDir) : []
4043
4127
  ]);
4044
4128
  const userOverrideIds = computeOverrideIds(defaults, userItems);
4045
4129
  const projectOverrideIds = computeOverrideIds(defaults, projectItems);
4046
- const extra = config3.extraGetData ? await config3.extraGetData() : {};
4130
+ const extra = config3.extraGetData ? await config3.extraGetData(effectiveProjectDir) : {};
4047
4131
  res.json({
4048
4132
  defaults: defaults.map(config3.mapToResponse),
4049
4133
  userItems: userItems.map(config3.mapToResponse),
@@ -4067,7 +4151,8 @@ function createCrudRoutes(config3, configDir, projectDir) {
4067
4151
  });
4068
4152
  router.get("/:id", async (req, res) => {
4069
4153
  const { id } = req.params;
4070
- const items = await config3.loadAll(configDir, projectDir);
4154
+ const effectiveProjectDir = resolveProjectDir(req, projectDir);
4155
+ const items = await config3.loadAll(configDir, effectiveProjectDir);
4071
4156
  const item = config3.findById(id, items);
4072
4157
  if (!item) {
4073
4158
  return res.status(404).json({ error: "Not found" });
@@ -4083,15 +4168,16 @@ function createCrudRoutes(config3, configDir, projectDir) {
4083
4168
  }
4084
4169
  const id = String(meta["id"]);
4085
4170
  const destination = body["destination"] ?? "user";
4086
- if (destination === "project" && !projectDir) {
4171
+ const effectiveProjectDir = resolveProjectDir(req, projectDir);
4172
+ if (destination === "project" && !effectiveProjectDir) {
4087
4173
  return res.status(400).json({ error: "No project directory configured" });
4088
4174
  }
4089
- const exists = await config3.exists(configDir, id, projectDir);
4175
+ const exists = await config3.exists(configDir, id, effectiveProjectDir);
4090
4176
  if (exists) {
4091
4177
  return res.status(409).json({ error: "An item with this ID already exists" });
4092
4178
  }
4093
4179
  if (destination === "project") {
4094
- await config3.saveToProject(projectDir, body);
4180
+ await config3.saveToProject(effectiveProjectDir, body);
4095
4181
  } else {
4096
4182
  await config3.save(configDir, body);
4097
4183
  }
@@ -4099,7 +4185,8 @@ function createCrudRoutes(config3, configDir, projectDir) {
4099
4185
  });
4100
4186
  router.put("/:id", async (req, res) => {
4101
4187
  const { id } = req.params;
4102
- const items = await config3.loadAll(configDir, projectDir);
4188
+ const effectiveProjectDir = resolveProjectDir(req, projectDir);
4189
+ const items = await config3.loadAll(configDir, effectiveProjectDir);
4103
4190
  const existing = config3.findById(id, items);
4104
4191
  if (!existing) {
4105
4192
  return res.status(404).json({ error: "Not found" });
@@ -4111,9 +4198,9 @@ function createCrudRoutes(config3, configDir, projectDir) {
4111
4198
  ...body,
4112
4199
  metadata: { ...existing.metadata, ...meta, id }
4113
4200
  };
4114
- const isProject = await isProjectItem(projectDir, config3.dirName, id, config3.ext);
4201
+ const isProject = await isProjectItem(effectiveProjectDir, config3.dirName, id, config3.ext);
4115
4202
  if (isProject) {
4116
- await config3.saveToProject(projectDir, updated);
4203
+ await config3.saveToProject(effectiveProjectDir, updated);
4117
4204
  } else {
4118
4205
  await config3.save(configDir, updated);
4119
4206
  }
@@ -4121,18 +4208,15 @@ function createCrudRoutes(config3, configDir, projectDir) {
4121
4208
  });
4122
4209
  router.delete("/:id", async (req, res) => {
4123
4210
  const { id } = req.params;
4124
- const isProject = await isProjectItem(projectDir, config3.dirName, id, config3.ext);
4211
+ const effectiveProjectDir = resolveProjectDir(req, projectDir);
4212
+ const isProject = await isProjectItem(effectiveProjectDir, config3.dirName, id, config3.ext);
4125
4213
  if (isProject) {
4126
- const result2 = await config3.deleteProject(projectDir, id);
4214
+ const result2 = await config3.deleteProject(effectiveProjectDir, id);
4127
4215
  if (!result2.success) {
4128
4216
  return res.status(500).json({ error: "Failed to delete project item" });
4129
4217
  }
4130
4218
  return res.json({ success: true });
4131
4219
  }
4132
- const isDefault = await config3.isDefault(id);
4133
- if (isDefault) {
4134
- return res.status(403).json({ error: "Cannot delete built-in defaults" });
4135
- }
4136
4220
  const result = await config3.delete(configDir, id);
4137
4221
  if (!result.success) {
4138
4222
  return res.status(403).json({ error: result.reason ?? "Cannot delete this item" });
@@ -4141,7 +4225,8 @@ function createCrudRoutes(config3, configDir, projectDir) {
4141
4225
  });
4142
4226
  router.post("/:id/duplicate", async (req, res) => {
4143
4227
  const { id } = req.params;
4144
- const items = await config3.loadAll(configDir, projectDir);
4228
+ const effectiveProjectDir = resolveProjectDir(req, projectDir);
4229
+ const items = await config3.loadAll(configDir, effectiveProjectDir);
4145
4230
  const source = config3.findById(id, items);
4146
4231
  if (!source) {
4147
4232
  return res.status(404).json({ error: "Not found" });
@@ -4153,8 +4238,8 @@ function createCrudRoutes(config3, configDir, projectDir) {
4153
4238
  };
4154
4239
  const destination = req.body.destination ?? "user";
4155
4240
  if (destination === "project") {
4156
- if (!projectDir) return res.status(400).json({ error: "No project directory configured" });
4157
- await config3.saveToProject(projectDir, duplicated);
4241
+ if (!effectiveProjectDir) return res.status(400).json({ error: "No project directory configured" });
4242
+ await config3.saveToProject(effectiveProjectDir, duplicated);
4158
4243
  } else {
4159
4244
  await config3.save(configDir, duplicated);
4160
4245
  }
@@ -4218,6 +4303,11 @@ function validateSkillCreate(body) {
4218
4303
  }
4219
4304
  return null;
4220
4305
  }
4306
+ async function findSkillByIdForRequest(req, configDir, projectDir) {
4307
+ const effectiveProjectDir = resolveProjectDir(req, projectDir);
4308
+ const skills = await loadAllSkills(configDir, effectiveProjectDir);
4309
+ return findSkillById(req.params["id"], skills);
4310
+ }
4221
4311
  function createConfig(configDir, projectDir) {
4222
4312
  return {
4223
4313
  dirName: "skills",
@@ -4236,8 +4326,9 @@ function createConfig(configDir, projectDir) {
4236
4326
  getDefaultIds: getDefaultSkillIds,
4237
4327
  validateCreate: validateSkillCreate,
4238
4328
  mapToResponse,
4239
- extraGetData: async () => {
4240
- const discovery = await loadAllSkillsWithDiagnostics(configDir, projectDir);
4329
+ extraGetData: async (effectiveProjectDir) => {
4330
+ const projectDirParam = effectiveProjectDir ?? projectDir;
4331
+ const discovery = await loadAllSkillsWithDiagnostics(configDir, projectDirParam);
4241
4332
  const items = discovery.skills;
4242
4333
  const configured = configuredDirectory();
4243
4334
  let selectedDirectory = configured ? { configuredPath: configured, resolvedPath: null, available: false, custom: true } : defaultLibrary(configDir);
@@ -4302,24 +4393,21 @@ function createSkillRoutes(configDir, projectDir) {
4302
4393
  });
4303
4394
  });
4304
4395
  router.post("/:id/toggle", async (req, res) => {
4305
- const skills = await loadAllSkills(configDir, projectDir);
4306
- const existing = findSkillById(req.params["id"], skills);
4396
+ const existing = await findSkillByIdForRequest(req, configDir, projectDir);
4307
4397
  if (!existing) return res.status(404).json({ error: "Not found" });
4308
4398
  const enabled = !isSkillEnabled(existing.metadata.id);
4309
4399
  setSkillEnabled(existing.metadata.id, enabled);
4310
4400
  res.json({ enabled });
4311
4401
  });
4312
4402
  router.put("/:id", async (req, res) => {
4313
- const skills = await loadAllSkills(configDir, projectDir);
4314
- const existing = findSkillById(req.params["id"], skills);
4403
+ const existing = await findSkillByIdForRequest(req, configDir, projectDir);
4315
4404
  if (!existing) return res.status(404).json({ error: "Not found" });
4316
4405
  const updated = await updateOwnedSkill(existing, req.body);
4317
4406
  if (!updated) return res.status(403).json({ error: "This skill is read-only" });
4318
4407
  res.json(updated);
4319
4408
  });
4320
4409
  router.delete("/:id", async (req, res) => {
4321
- const skills = await loadAllSkills(configDir, projectDir);
4322
- const existing = findSkillById(req.params["id"], skills);
4410
+ const existing = await findSkillByIdForRequest(req, configDir, projectDir);
4323
4411
  if (!existing) return res.status(404).json({ error: "Not found" });
4324
4412
  const result = await deleteOwnedSkill(existing);
4325
4413
  if (!result.success) return res.status(403).json({ error: result.reason ?? "Cannot delete this skill" });
@@ -4425,16 +4513,18 @@ async function deleteProjectCommand(projectDir, commandId) {
4425
4513
  return deleteItemFromDir(getProjectCommandsDir(projectDir), commandId, COMMAND_EXTENSION);
4426
4514
  }
4427
4515
  async function deleteCommand(configDir, commandId) {
4428
- const isDefault = await isDefaultCommand(commandId);
4429
- if (isDefault) {
4430
- return { success: false, reason: "Cannot delete built-in defaults" };
4431
- }
4432
4516
  const filePath = join5(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`);
4517
+ if (!await pathExists(filePath)) {
4518
+ if (await isDefaultCommand(commandId)) {
4519
+ return { success: false, reason: "Cannot delete built-in defaults" };
4520
+ }
4521
+ return { success: false };
4522
+ }
4433
4523
  try {
4434
4524
  await unlink(filePath);
4435
4525
  return { success: true };
4436
4526
  } catch {
4437
- return { success: false };
4527
+ return { success: false, reason: "Failed to delete command" };
4438
4528
  }
4439
4529
  }
4440
4530
 
@@ -4993,8 +5083,8 @@ function createFileSearchRoutes() {
4993
5083
  return router;
4994
5084
  }
4995
5085
  async function searchFiles(query, workdir) {
4996
- if (query.endsWith("/")) {
4997
- return listDirectoryContents(query, workdir);
5086
+ if (/[\\/]$/.test(query)) {
5087
+ return listDirectoryContents(query.replace(/\\/g, "/"), workdir);
4998
5088
  }
4999
5089
  const entries = await fg(["**/*"], {
5000
5090
  cwd: workdir,
@@ -5307,7 +5397,7 @@ function createProviderAuthRoutes(config3, providerManager, registry) {
5307
5397
  try {
5308
5398
  const { challenge, completion } = await adapter.beginLogin({ providerId: provider.id });
5309
5399
  void completion.then(async ({ credentialRef }) => {
5310
- const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-3FKJV3KI.js");
5400
+ const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-HX7FDKGJ.js");
5311
5401
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
5312
5402
  const updatedConfig = updateProvider(globalConfig, provider.id, { credentialRef, authAdapter: adapter.id });
5313
5403
  await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
@@ -5344,7 +5434,7 @@ function createProviderAuthRoutes(config3, providerManager, registry) {
5344
5434
  const ref = provider.credentialRef ?? provider.id;
5345
5435
  await adapter.logout(ref);
5346
5436
  }
5347
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
5437
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
5348
5438
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
5349
5439
  const updatedConfig = {
5350
5440
  ...globalConfig,
@@ -5822,7 +5912,7 @@ async function createServerHandle(config3) {
5822
5912
  const mcpManager = new McpManager({
5823
5913
  onToolsDiscovered: async (name, tools) => {
5824
5914
  try {
5825
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
5915
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
5826
5916
  const mode = config3.mode ?? "production";
5827
5917
  const globalConfig = await loadGlobalConfig(mode, config3.globalConfigPath);
5828
5918
  const mcpServers2 = {
@@ -5854,7 +5944,7 @@ async function createServerHandle(config3) {
5854
5944
  toolRegistry = createToolRegistry();
5855
5945
  logger.info("MCP tools registered", { count: mcpTools.length });
5856
5946
  }
5857
- const { signalMcpReady } = await import("./server-FKM4FQKD.js");
5947
+ const { signalMcpReady } = await import("./server-CYE6XY7J.js");
5858
5948
  signalMcpReady();
5859
5949
  });
5860
5950
  const app = express();
@@ -5935,7 +6025,7 @@ async function createServerHandle(config3) {
5935
6025
  res.json({ tools });
5936
6026
  });
5937
6027
  app.get("/api/projects", async (_req, res) => {
5938
- const { listProjects: listProjects2 } = await import("./projects-M5XKC7O6.js");
6028
+ const { listProjects: listProjects2 } = await import("./projects-PQXME5S4.js");
5939
6029
  const projects = listProjects2();
5940
6030
  res.json({ projects });
5941
6031
  });
@@ -5944,7 +6034,7 @@ async function createServerHandle(config3) {
5944
6034
  if (!name || !workdir) {
5945
6035
  return res.status(400).json({ error: "name and workdir are required" });
5946
6036
  }
5947
- const { createDirectoryWithGit } = await import("./project-creator-SMWFMIU5.js");
6037
+ const { createDirectoryWithGit } = await import("./project-creator-BVA55HY6.js");
5948
6038
  try {
5949
6039
  const project = await createDirectoryWithGit(name, workdir);
5950
6040
  res.status(201).json({ project });
@@ -5962,7 +6052,7 @@ async function createServerHandle(config3) {
5962
6052
  if (!targetPath) {
5963
6053
  return res.status(400).json({ error: "path is required" });
5964
6054
  }
5965
- const { checkPermissions } = await import("./permissions-CGEK3DGZ.js");
6055
+ const { checkPermissions } = await import("./permissions-K6YEA2ZZ.js");
5966
6056
  const result = await checkPermissions(targetPath);
5967
6057
  if (result.success) {
5968
6058
  res.json(result);
@@ -5979,7 +6069,7 @@ async function createServerHandle(config3) {
5979
6069
  if (!["group", "ownership", "join_group", "join_group_and_group"].includes(action)) {
5980
6070
  return res.status(400).json({ error: 'action must be "group", "ownership", "join_group", or "join_group_and_group"' });
5981
6071
  }
5982
- const { fixPermissions } = await import("./permissions-CGEK3DGZ.js");
6072
+ const { fixPermissions } = await import("./permissions-K6YEA2ZZ.js");
5983
6073
  const result = await fixPermissions(targetPath, action);
5984
6074
  if (result.success) {
5985
6075
  res.json(result);
@@ -5989,7 +6079,7 @@ async function createServerHandle(config3) {
5989
6079
  }
5990
6080
  });
5991
6081
  app.get("/api/projects/:id", async (req, res) => {
5992
- const { getProject: getProject2 } = await import("./projects-M5XKC7O6.js");
6082
+ const { getProject: getProject2 } = await import("./projects-PQXME5S4.js");
5993
6083
  const project = getProject2(req.params.id);
5994
6084
  if (!project) {
5995
6085
  return res.status(404).json({ error: "Project not found" });
@@ -5997,13 +6087,13 @@ async function createServerHandle(config3) {
5997
6087
  res.json({ project });
5998
6088
  });
5999
6089
  app.get("/api/projects/:id/open-folder", async (req, res) => {
6000
- const { getProject: getProject2 } = await import("./projects-M5XKC7O6.js");
6090
+ const { getProject: getProject2 } = await import("./projects-PQXME5S4.js");
6001
6091
  const project = getProject2(req.params.id);
6002
6092
  if (!project) {
6003
6093
  return res.status(404).json({ error: "Project not found" });
6004
6094
  }
6005
6095
  try {
6006
- const { openFolder: openFolder2 } = await import("./openFolder-Z27FEM5M.js");
6096
+ const { openFolder: openFolder2 } = await import("./openFolder-HX7X356L.js");
6007
6097
  await openFolder2(project.workdir);
6008
6098
  res.json({ success: true });
6009
6099
  } catch (err) {
@@ -6011,7 +6101,7 @@ async function createServerHandle(config3) {
6011
6101
  }
6012
6102
  });
6013
6103
  app.put("/api/projects/:id", async (req, res) => {
6014
- const { updateProject: updateProject2 } = await import("./projects-M5XKC7O6.js");
6104
+ const { updateProject: updateProject2 } = await import("./projects-PQXME5S4.js");
6015
6105
  const { name, customInstructions, dangerLevel } = req.body;
6016
6106
  const updates = {};
6017
6107
  if (name !== void 0) updates.name = name;
@@ -6024,7 +6114,7 @@ async function createServerHandle(config3) {
6024
6114
  res.json({ project: updated });
6025
6115
  });
6026
6116
  app.delete("/api/projects/:id", async (req, res) => {
6027
- const { getProject: getProject2, deleteProject } = await import("./projects-M5XKC7O6.js");
6117
+ const { getProject: getProject2, deleteProject } = await import("./projects-PQXME5S4.js");
6028
6118
  const project = getProject2(req.params.id);
6029
6119
  if (!project) {
6030
6120
  return res.status(404).json({ error: "Project not found" });
@@ -6033,7 +6123,7 @@ async function createServerHandle(config3) {
6033
6123
  res.json({ success: true });
6034
6124
  });
6035
6125
  app.put("/api/projects/:id/star", async (req, res) => {
6036
- const { toggleStar } = await import("./projects-M5XKC7O6.js");
6126
+ const { toggleStar } = await import("./projects-PQXME5S4.js");
6037
6127
  const { isStarred } = req.body;
6038
6128
  if (typeof isStarred !== "boolean") {
6039
6129
  return res.status(400).json({ error: "isStarred is required and must be a boolean" });
@@ -6045,26 +6135,26 @@ async function createServerHandle(config3) {
6045
6135
  res.json({ project });
6046
6136
  });
6047
6137
  app.get("/api/projects/:id/branches", async (req, res) => {
6048
- const { getProject: getProject2 } = await import("./projects-M5XKC7O6.js");
6138
+ const { getProject: getProject2 } = await import("./projects-PQXME5S4.js");
6049
6139
  const project = getProject2(req.params.id);
6050
6140
  if (!project) return res.status(404).json({ error: "Project not found" });
6051
- const { listBranches } = await import("./workspace-2NDXTCVR.js");
6141
+ const { listBranches } = await import("./workspace-2OG5VQG6.js");
6052
6142
  const branches = await listBranches(project.workdir);
6053
6143
  res.json({ branches });
6054
6144
  });
6055
6145
  app.post("/api/projects/:id/checkout", async (req, res) => {
6056
- const { getProject: getProject2 } = await import("./projects-M5XKC7O6.js");
6146
+ const { getProject: getProject2 } = await import("./projects-PQXME5S4.js");
6057
6147
  const project = getProject2(req.params.id);
6058
6148
  if (!project) return res.status(404).json({ error: "Project not found" });
6059
6149
  const { branch } = req.body;
6060
6150
  if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
6061
- const { checkoutBranch, isGitRepository } = await import("./workspace-2NDXTCVR.js");
6151
+ const { checkoutBranch, isGitRepository } = await import("./workspace-2OG5VQG6.js");
6062
6152
  if (!await isGitRepository(project.workdir)) {
6063
6153
  return res.status(400).json({ error: "Project is not a git repository" });
6064
6154
  }
6065
6155
  try {
6066
6156
  await checkoutBranch(project.workdir, branch);
6067
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-ZV2WRC6K.js");
6157
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-TZNUQJ2I.js");
6068
6158
  const allSessions = sessionManager.listSessions();
6069
6159
  for (const s of allSessions) {
6070
6160
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -6078,12 +6168,12 @@ async function createServerHandle(config3) {
6078
6168
  }
6079
6169
  });
6080
6170
  app.post("/api/projects/:id/checkout-new", async (req, res) => {
6081
- const { getProject: getProject2 } = await import("./projects-M5XKC7O6.js");
6171
+ const { getProject: getProject2 } = await import("./projects-PQXME5S4.js");
6082
6172
  const project = getProject2(req.params.id);
6083
6173
  if (!project) return res.status(404).json({ error: "Project not found" });
6084
6174
  const { name, sourceBranch } = req.body;
6085
6175
  if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
6086
- const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-2NDXTCVR.js");
6176
+ const { createBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, validateRef: validateRef2, getDefaultBranch, isGitRepository } = await import("./workspace-2OG5VQG6.js");
6087
6177
  if (!await isGitRepository(project.workdir)) {
6088
6178
  return res.status(400).json({ error: "Project is not a git repository" });
6089
6179
  }
@@ -6100,7 +6190,7 @@ async function createServerHandle(config3) {
6100
6190
  );
6101
6191
  }
6102
6192
  await createBranch(project.workdir, name, sb);
6103
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-ZV2WRC6K.js");
6193
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-TZNUQJ2I.js");
6104
6194
  const allSessions = sessionManager.listSessions();
6105
6195
  for (const s of allSessions) {
6106
6196
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -6117,7 +6207,7 @@ async function createServerHandle(config3) {
6117
6207
  const session = sessionManager.getSession(req.params.id);
6118
6208
  if (!session) return res.status(404).json({ error: "Session not found" });
6119
6209
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6120
- const { listBranches, getDefaultBranch } = await import("./workspace-2NDXTCVR.js");
6210
+ const { listBranches, getDefaultBranch } = await import("./workspace-2OG5VQG6.js");
6121
6211
  const [branches, defaultBranch] = await Promise.all([
6122
6212
  listBranches(effectiveWorkdir),
6123
6213
  getDefaultBranch(session.workdir)
@@ -6131,8 +6221,8 @@ async function createServerHandle(config3) {
6131
6221
  const { branch } = req.body;
6132
6222
  if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
6133
6223
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6134
- const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-2NDXTCVR.js");
6135
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-ZV2WRC6K.js");
6224
+ const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-2OG5VQG6.js");
6225
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-TZNUQJ2I.js");
6136
6226
  try {
6137
6227
  await validateRef2(effectiveWorkdir, branch);
6138
6228
  await checkoutBranch(effectiveWorkdir, branch);
@@ -6174,16 +6264,16 @@ All file and git operations should use this branch.
6174
6264
  const { name, sourceBranch } = req.body;
6175
6265
  if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
6176
6266
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6177
- const { validateRef: validateRef2 } = await import("./workspace-2NDXTCVR.js");
6178
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-ZV2WRC6K.js");
6267
+ const { validateRef: validateRef2 } = await import("./workspace-2OG5VQG6.js");
6268
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-TZNUQJ2I.js");
6179
6269
  try {
6180
6270
  await validateRef2(effectiveWorkdir, name);
6181
6271
  if (sourceBranch) {
6182
- const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-2NDXTCVR.js");
6272
+ const { resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2, createBranch } = await import("./workspace-2OG5VQG6.js");
6183
6273
  const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, sourceBranch, session.workdir);
6184
6274
  await createBranch(effectiveWorkdir, name, sb);
6185
6275
  } else {
6186
- const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-2NDXTCVR.js");
6276
+ const { createBranch, getDefaultBranch, resolveAndValidateSourceBranch: resolveAndValidateSourceBranch2 } = await import("./workspace-2OG5VQG6.js");
6187
6277
  const defaultBranch = await getDefaultBranch(session.workdir);
6188
6278
  const sb = await resolveAndValidateSourceBranch2(effectiveWorkdir, defaultBranch, session.workdir);
6189
6279
  await createBranch(effectiveWorkdir, name, sb);
@@ -6221,17 +6311,17 @@ All file and git operations should use this branch.
6221
6311
  }
6222
6312
  });
6223
6313
  app.get("/api/projects/:id/workspaces", async (req, res) => {
6224
- const { getProject: getProject2 } = await import("./projects-M5XKC7O6.js");
6314
+ const { getProject: getProject2 } = await import("./projects-PQXME5S4.js");
6225
6315
  const project = getProject2(req.params.id);
6226
6316
  if (!project) return res.status(404).json({ error: "Project not found" });
6227
- const { listWorkspaces } = await import("./workspace-2NDXTCVR.js");
6317
+ const { listWorkspaces } = await import("./workspace-2OG5VQG6.js");
6228
6318
  const all = await listWorkspaces(project.name, project.workdir);
6229
6319
  const workspacesList = all.filter((ws) => ws.path !== project.workdir);
6230
6320
  res.json({ workspaces: workspacesList });
6231
6321
  });
6232
6322
  app.get("/api/sessions", async (req, res) => {
6233
- const { getRecentUserPromptsForSession } = await import("./events-BGVLDGLK.js");
6234
- const { getPendingConfirmationsBySession } = await import("./path-security-JCDBLFIE.js");
6323
+ const { getRecentUserPromptsForSession } = await import("./events-OJ2R6OEM.js");
6324
+ const { getPendingConfirmationsBySession } = await import("./path-security-QCIA6YFV.js");
6235
6325
  const projectId = req.query["projectId"];
6236
6326
  const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
6237
6327
  const offset = parseInt(req.query["offset"]) || 0;
@@ -6277,7 +6367,7 @@ All file and git operations should use this branch.
6277
6367
  disabledServers = mcpManager.getAllServers().filter((s) => s.config.disabled).map((s) => s.name);
6278
6368
  }
6279
6369
  if (disabledServers.length > 0) {
6280
- const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-HA5IQYLI.js");
6370
+ const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-SFWPS5CT.js");
6281
6371
  setSessionDisabledServers2(session.id, disabledServers);
6282
6372
  }
6283
6373
  } catch {
@@ -6314,7 +6404,7 @@ All file and git operations should use this branch.
6314
6404
  if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
6315
6405
  const project = sessionManager.getProject(session.projectId);
6316
6406
  if (!project) return res.status(404).json({ error: "Project not found" });
6317
- const { isGitRepository } = await import("./workspace-2NDXTCVR.js");
6407
+ const { isGitRepository } = await import("./workspace-2OG5VQG6.js");
6318
6408
  if (!await isGitRepository(project.workdir)) {
6319
6409
  return res.status(400).json({ error: "Project is not a git repository" });
6320
6410
  }
@@ -6332,7 +6422,7 @@ All file and git operations should use this branch.
6332
6422
  if (!target || typeof target !== "string") return res.status(400).json({ error: "target is required" });
6333
6423
  const project = sessionManager.getProject(session.projectId);
6334
6424
  if (!project) return res.status(404).json({ error: "Project not found" });
6335
- const { isGitRepository } = await import("./workspace-2NDXTCVR.js");
6425
+ const { isGitRepository } = await import("./workspace-2OG5VQG6.js");
6336
6426
  if (!await isGitRepository(project.workdir)) {
6337
6427
  return res.status(400).json({ error: "Project is not a git repository" });
6338
6428
  }
@@ -6350,12 +6440,12 @@ All file and git operations should use this branch.
6350
6440
  }
6351
6441
  });
6352
6442
  app.get("/api/sessions/:id", async (req, res) => {
6353
- const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-BGVLDGLK.js");
6354
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-AJMZBHNR.js");
6355
- const { getPendingQuestionsForSession } = await import("./tools-KKALZLKX.js");
6356
- const { getMaxVisibleItems } = await import("./settings-TGCITCVA.js");
6357
- const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-BLEFI7FQ.js");
6358
- const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-ZV2WRC6K.js");
6443
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-OJ2R6OEM.js");
6444
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-DUZSKCZF.js");
6445
+ const { getPendingQuestionsForSession } = await import("./tools-Y4F4HJPO.js");
6446
+ const { getMaxVisibleItems } = await import("./settings-5LG7IB3K.js");
6447
+ const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-36SQR3JR.js");
6448
+ const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-TZNUQJ2I.js");
6359
6449
  let session = sessionManager.getSession(req.params.id);
6360
6450
  if (!session) {
6361
6451
  return res.status(404).json({ error: "Session not found" });
@@ -6394,8 +6484,8 @@ All file and git operations should use this branch.
6394
6484
  if (!session) {
6395
6485
  return res.status(404).json({ error: "Session not found" });
6396
6486
  }
6397
- const { stopSessionExecution } = await import("./chat-handler-G2ZJNAVB.js");
6398
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-KKALZLKX.js");
6487
+ const { stopSessionExecution } = await import("./chat-handler-A22X22VZ.js");
6488
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-Y4F4HJPO.js");
6399
6489
  sessionManager.clearMessageQueue(sessionId);
6400
6490
  stopSessionExecution(sessionId, sessionManager);
6401
6491
  abortSession(sessionId);
@@ -6424,9 +6514,9 @@ All file and git operations should use this branch.
6424
6514
  res.json({ success: true });
6425
6515
  });
6426
6516
  app.post("/api/sessions/:id/provider", async (req, res) => {
6427
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-BGVLDGLK.js");
6428
- const { buildMessagesFromStoredEvents } = await import("./folding-AJMZBHNR.js");
6429
- const { getMaxVisibleItems } = await import("./settings-TGCITCVA.js");
6517
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-OJ2R6OEM.js");
6518
+ const { buildMessagesFromStoredEvents } = await import("./folding-DUZSKCZF.js");
6519
+ const { getMaxVisibleItems } = await import("./settings-5LG7IB3K.js");
6430
6520
  const sessionId = req.params.id;
6431
6521
  const session = sessionManager.getSession(sessionId);
6432
6522
  if (!session) {
@@ -6461,7 +6551,7 @@ All file and git operations should use this branch.
6461
6551
  if (!result.success) {
6462
6552
  return res.status(500).json({ error: result.error ?? "Failed to set default model" });
6463
6553
  }
6464
- const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-3FKJV3KI.js");
6554
+ const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-HX7FDKGJ.js");
6465
6555
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
6466
6556
  const updatedConfig = setDefaultModelSelection(globalConfig, providerId, model);
6467
6557
  await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
@@ -6539,11 +6629,11 @@ All file and git operations should use this branch.
6539
6629
  res.json({ success: true });
6540
6630
  });
6541
6631
  app.put("/api/sessions/:id/mode", async (req, res) => {
6542
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-BGVLDGLK.js");
6543
- const { buildMessagesFromStoredEvents } = await import("./folding-AJMZBHNR.js");
6544
- const { getMaxVisibleItems } = await import("./settings-TGCITCVA.js");
6545
- const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-BLEFI7FQ.js");
6546
- const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-ZV2WRC6K.js");
6632
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-OJ2R6OEM.js");
6633
+ const { buildMessagesFromStoredEvents } = await import("./folding-DUZSKCZF.js");
6634
+ const { getMaxVisibleItems } = await import("./settings-5LG7IB3K.js");
6635
+ const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-36SQR3JR.js");
6636
+ const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-TZNUQJ2I.js");
6547
6637
  const sessionId = req.params.id;
6548
6638
  const session = sessionManager.getSession(sessionId);
6549
6639
  if (!session) {
@@ -6645,7 +6735,7 @@ All file and git operations should use this branch.
6645
6735
  if (alwaysAllow !== void 0 && typeof alwaysAllow !== "boolean") {
6646
6736
  return res.status(400).json({ error: "alwaysAllow must be a boolean if provided" });
6647
6737
  }
6648
- const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-KKALZLKX.js");
6738
+ const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-Y4F4HJPO.js");
6649
6739
  const pendingSessionId = getConfirmationSessionId(callId);
6650
6740
  if (!pendingSessionId) {
6651
6741
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
@@ -6657,11 +6747,11 @@ All file and git operations should use this branch.
6657
6747
  if (!result.found) {
6658
6748
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
6659
6749
  }
6660
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-BGVLDGLK.js");
6661
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-AJMZBHNR.js");
6750
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-OJ2R6OEM.js");
6751
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-DUZSKCZF.js");
6662
6752
  const { createSessionStateMessage } = await import("./protocol-YDNGGADL.js");
6663
- const { getPendingQuestionsForSession } = await import("./tools-KKALZLKX.js");
6664
- const { getMaxVisibleItems } = await import("./settings-TGCITCVA.js");
6753
+ const { getPendingQuestionsForSession } = await import("./tools-Y4F4HJPO.js");
6754
+ const { getMaxVisibleItems } = await import("./settings-5LG7IB3K.js");
6665
6755
  const eventStore = getEventStore2();
6666
6756
  const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(sessionId);
6667
6757
  const events = combineEvents(sessionId, snapshot, eventsSinceSnapshot);
@@ -6697,7 +6787,7 @@ All file and git operations should use this branch.
6697
6787
  if (!skip && typeof answer !== "string") {
6698
6788
  return res.status(400).json({ error: "answer is required when not skipping" });
6699
6789
  }
6700
- const { provideAnswer } = await import("./tools-KKALZLKX.js");
6790
+ const { provideAnswer } = await import("./tools-Y4F4HJPO.js");
6701
6791
  const found = provideAnswer(callId, answer ?? "", skip ?? false);
6702
6792
  if (!found) {
6703
6793
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -6730,7 +6820,7 @@ All file and git operations should use this branch.
6730
6820
  if (!session) {
6731
6821
  return res.status(404).json({ error: "Session not found" });
6732
6822
  }
6733
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-TGCITCVA.js");
6823
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-5LG7IB3K.js");
6734
6824
  if (getSetting2(SETTINGS_KEYS.CACHE_WARMING) !== "true") {
6735
6825
  return res.json({ success: false, reason: "disabled" });
6736
6826
  }
@@ -6762,7 +6852,7 @@ All file and git operations should use this branch.
6762
6852
  backend: activeProvider?.backend ?? llmClient.getBackend(),
6763
6853
  model: llmClient.getModel()
6764
6854
  };
6765
- const { runAgentTurn, TurnMetrics } = await import("./orchestrator-SYAYO6NS.js");
6855
+ const { runAgentTurn, TurnMetrics } = await import("./orchestrator-VZORJ7KF.js");
6766
6856
  runAgentTurn(
6767
6857
  {
6768
6858
  sessionManager,
@@ -6800,15 +6890,15 @@ All file and git operations should use this branch.
6800
6890
  if (!session) {
6801
6891
  return res.status(404).json({ error: "Session not found" });
6802
6892
  }
6803
- const { stopSessionExecution } = await import("./chat-handler-G2ZJNAVB.js");
6804
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-KKALZLKX.js");
6893
+ const { stopSessionExecution } = await import("./chat-handler-A22X22VZ.js");
6894
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-Y4F4HJPO.js");
6805
6895
  const queuedMessages = sessionManager.getQueueState(sessionId);
6806
6896
  sessionManager.clearMessageQueue(sessionId);
6807
6897
  stopSessionExecution(sessionId, sessionManager);
6808
6898
  abortSession(sessionId);
6809
6899
  cancelQuestionsForSession(sessionId, "Session stopped by user");
6810
6900
  cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
6811
- const eventStore = (await import("./events-BGVLDGLK.js")).getEventStore();
6901
+ const eventStore = (await import("./events-OJ2R6OEM.js")).getEventStore();
6812
6902
  eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
6813
6903
  res.json({ success: true, queuedMessages });
6814
6904
  });
@@ -6822,7 +6912,7 @@ All file and git operations should use this branch.
6822
6912
  if (typeof messageIndex !== "number" || messageIndex < 0) {
6823
6913
  return res.status(400).json({ error: "messageIndex must be a non-negative number" });
6824
6914
  }
6825
- const { truncateSessionMessages } = await import("./events-BGVLDGLK.js");
6915
+ const { truncateSessionMessages } = await import("./events-OJ2R6OEM.js");
6826
6916
  truncateSessionMessages(sessionId, messageIndex);
6827
6917
  res.json({ success: true });
6828
6918
  });
@@ -6839,8 +6929,8 @@ All file and git operations should use this branch.
6839
6929
  if (content !== void 0 && (typeof content !== "string" || !content.trim())) {
6840
6930
  return res.status(400).json({ error: "content must be a non-empty string if provided" });
6841
6931
  }
6842
- const { getEventStore: getEventStore2 } = await import("./events-BGVLDGLK.js");
6843
- const { buildMessagesFromStoredEvents } = await import("./folding-AJMZBHNR.js");
6932
+ const { getEventStore: getEventStore2 } = await import("./events-OJ2R6OEM.js");
6933
+ const { buildMessagesFromStoredEvents } = await import("./folding-DUZSKCZF.js");
6844
6934
  const eventStore = getEventStore2();
6845
6935
  const events = eventStore.getEvents(sessionId);
6846
6936
  const { messages } = buildMessagesFromStoredEvents(events);
@@ -6852,7 +6942,7 @@ All file and git operations should use this branch.
6852
6942
  if (msg.role !== "user" || msg.isSystemGenerated) {
6853
6943
  return res.status(400).json({ error: "Can only replay user messages" });
6854
6944
  }
6855
- const { truncateSessionMessages } = await import("./events-BGVLDGLK.js");
6945
+ const { truncateSessionMessages } = await import("./events-OJ2R6OEM.js");
6856
6946
  truncateSessionMessages(sessionId, msgIndex - 1);
6857
6947
  sessionManager.queueMessage(sessionId, "asap", content ?? msg.content, msg.attachments, msg.messageKind);
6858
6948
  res.json({ success: true });
@@ -6908,7 +6998,7 @@ All file and git operations should use this branch.
6908
6998
  res.json({ accepted: true });
6909
6999
  });
6910
7000
  app.get("/api/settings", async (req, res) => {
6911
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-TGCITCVA.js");
7001
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-5LG7IB3K.js");
6912
7002
  const keysParam = req.query["keys"];
6913
7003
  if (!keysParam) {
6914
7004
  return res.status(400).json({ error: "keys query parameter is required" });
@@ -6921,19 +7011,19 @@ All file and git operations should use this branch.
6921
7011
  res.json(result);
6922
7012
  });
6923
7013
  app.get("/api/settings/:key", async (req, res) => {
6924
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-TGCITCVA.js");
7014
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-5LG7IB3K.js");
6925
7015
  const key = req.params.key;
6926
7016
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
6927
7017
  res.json({ key, value });
6928
7018
  });
6929
7019
  app.get("/api/settings/:key", async (req, res) => {
6930
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-TGCITCVA.js");
7020
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-5LG7IB3K.js");
6931
7021
  const key = req.params.key;
6932
7022
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
6933
7023
  res.json({ key, value });
6934
7024
  });
6935
7025
  app.put("/api/settings/:key", async (req, res) => {
6936
- const { setSetting: setSetting2 } = await import("./settings-TGCITCVA.js");
7026
+ const { setSetting: setSetting2 } = await import("./settings-5LG7IB3K.js");
6937
7027
  const key = req.params.key;
6938
7028
  const { value } = req.body;
6939
7029
  if (value === void 0) {
@@ -6960,7 +7050,7 @@ All file and git operations should use this branch.
6960
7050
  }
6961
7051
  });
6962
7052
  app.get("/api/tools/shells", async (_req, res) => {
6963
- const { listAvailableShells } = await import("./platform-GZ2WIDS5.js");
7053
+ const { listAvailableShells } = await import("./platform-Q6T3AUHA.js");
6964
7054
  res.json({ shells: listAvailableShells() });
6965
7055
  });
6966
7056
  app.get("/api/config", async (_req, res) => {
@@ -6969,7 +7059,7 @@ All file and git operations should use this branch.
6969
7059
  let visionFallback;
6970
7060
  let globalWorkdir;
6971
7061
  try {
6972
- const { loadGlobalConfig, getVisionFallback } = await import("./config-3FKJV3KI.js");
7062
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-HX7FDKGJ.js");
6973
7063
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
6974
7064
  const fallback = getVisionFallback(globalConfig);
6975
7065
  if (fallback) {
@@ -7050,7 +7140,7 @@ All file and git operations should use this branch.
7050
7140
  }));
7051
7141
  }
7052
7142
  app.post("/api/proxy/test", async (_req, res) => {
7053
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-TGCITCVA.js");
7143
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-5LG7IB3K.js");
7054
7144
  const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
7055
7145
  if (!proxyUrl) {
7056
7146
  return res.status(400).json({ success: false, error: "No proxy URL configured" });
@@ -7142,7 +7232,7 @@ All file and git operations should use this branch.
7142
7232
  }
7143
7233
  });
7144
7234
  app.post("/api/proxy/test", async (_req, res) => {
7145
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-TGCITCVA.js");
7235
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-5LG7IB3K.js");
7146
7236
  const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
7147
7237
  if (!proxyUrl) {
7148
7238
  return res.status(400).json({ success: false, error: "No proxy URL configured" });
@@ -7169,7 +7259,7 @@ All file and git operations should use this branch.
7169
7259
  const backend = req.query["backend"];
7170
7260
  if (!url) return res.status(400).json({ error: "url is required" });
7171
7261
  try {
7172
- const { fetchModelsWithContext } = await import("./provider-manager-AUYP3QAM.js");
7262
+ const { fetchModelsWithContext } = await import("./provider-manager-RUC5QQ75.js");
7173
7263
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
7174
7264
  const models = await fetchModelsWithContext(
7175
7265
  url,
@@ -7239,8 +7329,8 @@ All file and git operations should use this branch.
7239
7329
  }
7240
7330
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
7241
7331
  const { getBackendCapabilities } = await import("./backend-P3GHHLHJ.js");
7242
- const { buildNonStreamingCreateParams } = await import("./client-pure-ONSVWEG5.js");
7243
- const { OpenAIHttpClient } = await import("./http-client-A7A4XWNK.js");
7332
+ const { buildNonStreamingCreateParams } = await import("./client-pure-USVHN4WG.js");
7333
+ const { OpenAIHttpClient } = await import("./http-client-KJXFSK7A.js");
7244
7334
  const { ensureVersionPrefix } = await import("./url-utils-SAJP7AEX.js");
7245
7335
  const profile = getModelProfile2(model);
7246
7336
  const capabilities = getBackendCapabilities(backend || "unknown");
@@ -7310,7 +7400,7 @@ All file and git operations should use this branch.
7310
7400
  return res.status(400).json({ error: "name, url, and backend are required" });
7311
7401
  }
7312
7402
  try {
7313
- const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-3FKJV3KI.js");
7403
+ const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-HX7FDKGJ.js");
7314
7404
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7315
7405
  const providerBackend = backend;
7316
7406
  const providerModels = modelConfigs?.length ? buildModelConfigs(modelConfigs) : model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [];
@@ -7351,7 +7441,7 @@ All file and git operations should use this branch.
7351
7441
  app.post("/api/init/config", async (req, res) => {
7352
7442
  const { workdir, visionFallback } = req.body;
7353
7443
  try {
7354
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
7444
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
7355
7445
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7356
7446
  const updatedVf = visionFallback ? { ...globalConfig.visionFallback, ...visionFallback } : globalConfig.visionFallback;
7357
7447
  const updatedConfig = {
@@ -7376,7 +7466,8 @@ All file and git operations should use this branch.
7376
7466
  model: z.string().optional(),
7377
7467
  timeout: z.number().positive().optional(),
7378
7468
  backend: z.enum(["ollama", "openai"]).optional(),
7379
- providerModelRef: z.string().optional()
7469
+ providerModelRef: z.string().optional(),
7470
+ apiKey: z.string().optional()
7380
7471
  });
7381
7472
  const parsed = visionFallbackUpdateSchema.safeParse(req.body);
7382
7473
  if (!parsed.success) {
@@ -7385,7 +7476,7 @@ All file and git operations should use this branch.
7385
7476
  }
7386
7477
  const updates = parsed.data;
7387
7478
  try {
7388
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
7479
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
7389
7480
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7390
7481
  const filteredUpdates = Object.fromEntries(Object.entries(updates).filter(([, v]) => v !== void 0));
7391
7482
  const updatedConfig = {
@@ -7417,7 +7508,8 @@ All file and git operations should use this branch.
7417
7508
  model: z.string().optional(),
7418
7509
  backend: z.enum(["ollama", "openai"]).optional(),
7419
7510
  providerModelRef: z.string().optional(),
7420
- timeout: z.number().positive().optional()
7511
+ timeout: z.number().positive().optional(),
7512
+ apiKey: z.string().optional()
7421
7513
  });
7422
7514
  const parsed = testSchema.safeParse(req.body);
7423
7515
  if (!parsed.success) {
@@ -7426,8 +7518,8 @@ All file and git operations should use this branch.
7426
7518
  }
7427
7519
  const testConfig = parsed.data;
7428
7520
  try {
7429
- const { resolveVisionFallback } = await import("./config-3FKJV3KI.js");
7430
- const { loadGlobalConfig } = await import("./config-3FKJV3KI.js");
7521
+ const { resolveVisionFallback } = await import("./config-HX7FDKGJ.js");
7522
+ const { loadGlobalConfig } = await import("./config-HX7FDKGJ.js");
7431
7523
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7432
7524
  const filteredTestConfig = Object.fromEntries(Object.entries(testConfig).filter(([, v]) => v !== void 0));
7433
7525
  const testVisionFallback = {
@@ -7478,7 +7570,7 @@ All file and git operations should use this branch.
7478
7570
  });
7479
7571
  app.delete("/api/providers/:id", async (req, res) => {
7480
7572
  const { id } = req.params;
7481
- const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-3FKJV3KI.js");
7573
+ const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-HX7FDKGJ.js");
7482
7574
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7483
7575
  const updatedConfig = removeProvider(globalConfig, id);
7484
7576
  await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
@@ -7490,7 +7582,7 @@ All file and git operations should use this branch.
7490
7582
  const { id } = req.params;
7491
7583
  const { isLocal } = req.body;
7492
7584
  try {
7493
- const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-3FKJV3KI.js");
7585
+ const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-HX7FDKGJ.js");
7494
7586
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7495
7587
  const provider = globalConfig.providers.find((p) => p.id === id);
7496
7588
  if (!provider) {
@@ -7522,7 +7614,7 @@ All file and git operations should use this branch.
7522
7614
  transportAdapter
7523
7615
  } = req.body;
7524
7616
  try {
7525
- const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-3FKJV3KI.js");
7617
+ const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-HX7FDKGJ.js");
7526
7618
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7527
7619
  const provider = globalConfig.providers.find((p) => p.id === id);
7528
7620
  if (!provider) {
@@ -7563,7 +7655,7 @@ All file and git operations should use this branch.
7563
7655
  return res.status(400).json({ error: result.error });
7564
7656
  }
7565
7657
  const llmClient = getLLMClient();
7566
- const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-3FKJV3KI.js");
7658
+ const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-HX7FDKGJ.js");
7567
7659
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7568
7660
  const updatedConfig = setDefaultModelSelection(globalConfig, id, llmClient.getModel());
7569
7661
  await saveGlobalConfig(config3.mode ?? "production", updatedConfig, config3.globalConfigPath);
@@ -7590,7 +7682,7 @@ All file and git operations should use this branch.
7590
7682
  });
7591
7683
  async function rebuildMcpTools() {
7592
7684
  const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-FEAHWU5C.js");
7593
- const { setMcpTools: setMcpTools2 } = await import("./tools-KKALZLKX.js");
7685
+ const { setMcpTools: setMcpTools2 } = await import("./tools-Y4F4HJPO.js");
7594
7686
  const mcpTools = createMcpTools2(mcpManager);
7595
7687
  setMcpTools2(mcpTools);
7596
7688
  toolRegistry = createToolRegistry();
@@ -7661,7 +7753,7 @@ All file and git operations should use this branch.
7661
7753
  };
7662
7754
  await mcpManager.addServer(name, serverCfg);
7663
7755
  const server = mcpManager.getServer(name);
7664
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
7756
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
7665
7757
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7666
7758
  const updatedMcpServers = { ...globalConfig.mcpServers ?? {}, [name]: serverCfg };
7667
7759
  await saveGlobalConfig(
@@ -7719,7 +7811,7 @@ All file and git operations should use this branch.
7719
7811
  return res.status(400).json({ error: "disabled must be a boolean" });
7720
7812
  }
7721
7813
  try {
7722
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
7814
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
7723
7815
  const { applyMcpServerUpdate } = await import("./update-server-4I6LXE5K.js");
7724
7816
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7725
7817
  const mcpServers2 = { ...globalConfig.mcpServers ?? {} };
@@ -7765,7 +7857,7 @@ All file and git operations should use this branch.
7765
7857
  return res.status(404).json({ error: `MCP server '${name}' not found` });
7766
7858
  }
7767
7859
  mcpManager.removeServer(name);
7768
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
7860
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
7769
7861
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7770
7862
  const updatedMcpServers = { ...globalConfig.mcpServers ?? {} };
7771
7863
  delete updatedMcpServers[name];
@@ -7795,7 +7887,7 @@ All file and git operations should use this branch.
7795
7887
  await mcpManager.setToolEnabled(name, toolName, enabled);
7796
7888
  const server = mcpManager.getServer(name);
7797
7889
  if (server) {
7798
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-3FKJV3KI.js");
7890
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-HX7FDKGJ.js");
7799
7891
  const globalConfig = await loadGlobalConfig(config3.mode ?? "production", config3.globalConfigPath);
7800
7892
  const mcpServers2 = { ...globalConfig.mcpServers ?? {} };
7801
7893
  const serverCfg = mcpServers2[name];
@@ -7824,7 +7916,7 @@ All file and git operations should use this branch.
7824
7916
  res.status(400).json({ error: error instanceof Error ? error.message : String(error) });
7825
7917
  }
7826
7918
  });
7827
- const { listProjects } = await import("./projects-M5XKC7O6.js");
7919
+ const { listProjects } = await import("./projects-PQXME5S4.js");
7828
7920
  const allProjects = listProjects();
7829
7921
  const projectDir = allProjects.find(
7830
7922
  (p) => p.workdir === config3.workdir || config3.workdir && p.workdir.startsWith(config3.workdir + "/")
@@ -7851,13 +7943,13 @@ All file and git operations should use this branch.
7851
7943
  })
7852
7944
  );
7853
7945
  app.get("/api/sessions/:id/background-processes", async (req, res) => {
7854
- const { getSessionProcesses } = await import("./manager-GGIIENDX.js");
7946
+ const { getSessionProcesses } = await import("./manager-N27WNW5B.js");
7855
7947
  const sessionId = req.params.id;
7856
7948
  const processes = getSessionProcesses(sessionId);
7857
7949
  res.json({ processes });
7858
7950
  });
7859
7951
  app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
7860
- const { stopProcess } = await import("./manager-GGIIENDX.js");
7952
+ const { stopProcess } = await import("./manager-N27WNW5B.js");
7861
7953
  const sessionId = req.params.id;
7862
7954
  const processId = req.params.processId;
7863
7955
  const session = sessionManager.getSession(sessionId);
@@ -8002,7 +8094,7 @@ All file and git operations should use this branch.
8002
8094
  const state = sessionManager.getContextState(sessionId);
8003
8095
  wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
8004
8096
  });
8005
- const { QueueProcessor } = await import("./processor-CBGV2K4E.js");
8097
+ const { QueueProcessor } = await import("./processor-QYVHKRIV.js");
8006
8098
  const queueProcessor = new QueueProcessor({
8007
8099
  sessionManager,
8008
8100
  providerManager,
@@ -8044,7 +8136,7 @@ All file and git operations should use this branch.
8044
8136
  void (async () => {
8045
8137
  await devServerManager.stopAll();
8046
8138
  await mcpManager.disconnectAll();
8047
- const { stopAllInspectProxies } = await import("./inspect-proxy-GF6OI7MR.js");
8139
+ const { stopAllInspectProxies } = await import("./inspect-proxy-N42Z5TOG.js");
8048
8140
  stopAllInspectProxies();
8049
8141
  const { cleanupAllProcesses } = await import("./store-SARB6V2N.js");
8050
8142
  cleanupAllProcesses();
@@ -8086,4 +8178,4 @@ export {
8086
8178
  createServerHandle,
8087
8179
  createServer
8088
8180
  };
8089
- //# sourceMappingURL=chunk-XWW7LOU4.js.map
8181
+ //# sourceMappingURL=chunk-G2VLGZ3Y.js.map