openfox 2.0.57 → 2.0.59

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 (47) hide show
  1. package/dist/agent-defaults/explorer.agent.md +4 -0
  2. package/dist/{auto-config-F5Y6KAQ6.js → auto-config-T5GR2N6X.js} +20 -1
  3. package/dist/{backend-B23GIKKD.js → backend-P3GHHLHJ.js} +2 -2
  4. package/dist/{branch.api-5DMEAIBI.js → branch.api-LAN42BA5.js} +3 -2
  5. package/dist/{chat-handler-QO4XB66I.js → chat-handler-AS44EMQE.js} +9 -9
  6. package/dist/{chunk-QQ5XY6BH.js → chunk-43UFGATL.js} +16 -6
  7. package/dist/{chunk-DQCEXCDD.js → chunk-5MDIKIMG.js} +23 -12
  8. package/dist/{chunk-VZHN46NW.js → chunk-6VDCH5ML.js} +2 -2
  9. package/dist/{chunk-BIWVYBIE.js → chunk-BGTEIA2S.js} +4 -3
  10. package/dist/{chunk-WI6HGJ27.js → chunk-EKI5SZC7.js} +3 -3
  11. package/dist/{chunk-AGXBUC4M.js → chunk-FRU2X3IZ.js} +71 -31
  12. package/dist/{chunk-4566MTWM.js → chunk-GJU35MDV.js} +2 -2
  13. package/dist/{chunk-R2QCDYYR.js → chunk-H774GQJW.js} +53 -2
  14. package/dist/{chunk-ZZLCX7YT.js → chunk-JKLPWTUN.js} +2 -2
  15. package/dist/{chunk-5HOP4QF7.js → chunk-LQFCQ6PY.js} +107 -79
  16. package/dist/{chunk-UOKVBO67.js → chunk-NVPVDDQZ.js} +2 -2
  17. package/dist/{chunk-F7M2W46Q.js → chunk-P7C6KF2H.js} +9 -9
  18. package/dist/{chunk-ADOXTORQ.js → chunk-PK2RMVMB.js} +2 -2
  19. package/dist/{chunk-PSJON33Y.js → chunk-YHEQTVFV.js} +7 -1
  20. package/dist/cli/dev.js +2 -2
  21. package/dist/cli/index.js +2 -2
  22. package/dist/{client-Y3ESMMZA.js → client-KRFGMNGN.js} +3 -3
  23. package/dist/{compactor-ZKZYSNMD.js → compactor-Q33AJPCQ.js} +4 -4
  24. package/dist/{config-5ZHFKWOW.js → config-GMQUPNBY.js} +2 -2
  25. package/dist/{manager-CZOVNTSN.js → manager-344C5JLZ.js} +3 -3
  26. package/dist/{orchestrator-YMNKXVDF.js → orchestrator-MH7J2YVP.js} +8 -8
  27. package/dist/package.json +1 -1
  28. package/dist/{permissions-QLHZUEGW.js → permissions-CGEK3DGZ.js} +21 -17
  29. package/dist/{processor-2BB65JWR.js → processor-34MVJZTD.js} +9 -9
  30. package/dist/{project-creator-7RBHP6K6.js → project-creator-IDW7RACH.js} +4 -4
  31. package/dist/{protocol-DRe5K6Id.d.ts → protocol-J7khRG62.d.ts} +3 -1
  32. package/dist/{provider-V6Q6WJAF.js → provider-LBYBC5AG.js} +6 -6
  33. package/dist/{provider-manager-PR64DEN2.js → provider-manager-ABEUYU3K.js} +4 -4
  34. package/dist/{pwa-M6QZ52ZO.js → pwa-T6JRAYJB.js} +11 -10
  35. package/dist/{serve-WFQT6BP6.js → serve-NHF6B5RQ.js} +13 -13
  36. package/dist/server/index.d.ts +2 -2
  37. package/dist/server/index.js +12 -12
  38. package/dist/{server-V32ZOVU4.js → server-KDGQZNYQ.js} +11 -11
  39. package/dist/{service-YYJ5Y7CN.js → service-6DL3MJZD.js} +7 -5
  40. package/dist/shared/index.d.ts +2 -2
  41. package/dist/{store-NS2RMRA7.js → store-FXTCHBI4.js} +2 -2
  42. package/dist/{tools-L2SMYKJZ.js → tools-FQ54IAYG.js} +7 -7
  43. package/dist/web/assets/{index-CvIUuius.css → index-DjfRXOO7.css} +1 -1
  44. package/dist/web/assets/{index-CRW5qofP.js → index-Dqqp_j-f.js} +71 -71
  45. package/dist/web/index.html +2 -2
  46. package/dist/web/sw.js +1 -1
  47. package/package.json +1 -1
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-M3RB4IF6.js";
4
4
  import {
5
5
  createLLMClient
6
- } from "./chunk-ZZLCX7YT.js";
6
+ } from "./chunk-JKLPWTUN.js";
7
7
  import {
8
8
  buildModelsUrl,
9
9
  ensureVersionPrefix,
@@ -82,6 +82,12 @@ async function fetchModelsWithContext(baseUrl, apiKey, backend) {
82
82
  logger.info("Fetching Ollama models via /api/tags and /api/show");
83
83
  return fetchOllamaModelsWithContext(baseUrl, apiKey);
84
84
  }
85
+ if (backend === "lmstudio") {
86
+ logger.info("Fetching LM Studio models via /api/v1/models");
87
+ const lmStudioModels = await fetchLmStudioModelsWithContext(baseUrl, apiKey);
88
+ if (lmStudioModels.length > 0) return lmStudioModels;
89
+ logger.info("LM Studio native endpoint unavailable, falling back to /v1/models");
90
+ }
85
91
  const isOpenCodeGo = baseUrl.includes("opencode.ai/zen/go");
86
92
  const url = isOpenCodeGo ? buildModelsUrl(baseUrl.replace("/zen/go", "/zen")) : buildModelsUrl(baseUrl);
87
93
  logger.info("Fetching models via /v1/models", { url });
@@ -154,6 +160,51 @@ async function fetchOllamaModelsWithContext(baseUrl, _apiKey) {
154
160
  return [];
155
161
  }
156
162
  }
163
+ async function fetchLmStudioModelsWithContext(baseUrl, _apiKey) {
164
+ const base = baseUrl.replace(/\/+$/, "");
165
+ const nativeUrl = `${base.replace(/\/v\d+\/?$/, "")}/api/v1/models`;
166
+ try {
167
+ logger.info("Fetching LM Studio native models", { url: nativeUrl });
168
+ const response = await fetch(nativeUrl, {
169
+ signal: AbortSignal.timeout(1e4)
170
+ });
171
+ if (!response.ok) {
172
+ logger.info("LM Studio native endpoint returned error", { url: nativeUrl, status: response.status });
173
+ return [];
174
+ }
175
+ const raw = await response.json();
176
+ const rawArray = Array.isArray(raw) ? raw : Array.isArray(raw.models) ? raw.models : Array.isArray(raw.data) ? raw.data : [];
177
+ const modelList = rawArray;
178
+ if (modelList.length === 0) {
179
+ logger.info("LM Studio native endpoint returned no models", { url: nativeUrl });
180
+ return [];
181
+ }
182
+ logger.info("LM Studio native models found", { count: modelList.length });
183
+ return modelList.map((model) => {
184
+ const modelId = model.key ?? model.id ?? "";
185
+ const loadedContext = model.loaded_instances?.[0]?.config?.context_length;
186
+ const maxContext = model.max_context_length;
187
+ const contextWindow = loadedContext ?? maxContext ?? 2e5;
188
+ logger.info("LM Studio model detected", {
189
+ modelId,
190
+ loadedContext,
191
+ maxContext,
192
+ contextWindow
193
+ });
194
+ return {
195
+ id: modelId,
196
+ contextWindow,
197
+ source: loadedContext || maxContext ? "backend" : "default"
198
+ };
199
+ });
200
+ } catch (error) {
201
+ logger.info("Error fetching LM Studio native models", {
202
+ url: nativeUrl,
203
+ error: error instanceof Error ? error.message : String(error)
204
+ });
205
+ return [];
206
+ }
207
+ }
157
208
  function parseDefaultModelSelection(selection) {
158
209
  if (!selection) return { providerId: void 0, model: void 0 };
159
210
  const slashIndex = selection.indexOf("/");
@@ -551,4 +602,4 @@ export {
551
602
  parseDefaultModelSelection,
552
603
  createProviderManager
553
604
  };
554
- //# sourceMappingURL=chunk-R2QCDYYR.js.map
605
+ //# sourceMappingURL=chunk-H774GQJW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getBackendCapabilities
3
- } from "./chunk-PSJON33Y.js";
3
+ } from "./chunk-YHEQTVFV.js";
4
4
  import {
5
5
  ensureVersionPrefix
6
6
  } from "./chunk-HNCM3D7Y.js";
@@ -259,4 +259,4 @@ function createLLMClient(config, initialBackend = "unknown") {
259
259
  export {
260
260
  createLLMClient
261
261
  };
262
- //# sourceMappingURL=chunk-ZZLCX7YT.js.map
262
+ //# sourceMappingURL=chunk-JKLPWTUN.js.map
@@ -21,7 +21,7 @@ import {
21
21
  tokenFromPassword,
22
22
  verifyPassword,
23
23
  workflowExists
24
- } from "./chunk-DQCEXCDD.js";
24
+ } from "./chunk-5MDIKIMG.js";
25
25
  import {
26
26
  agentExists,
27
27
  createToolRegistry,
@@ -57,15 +57,16 @@ import {
57
57
  saveSkill,
58
58
  saveSkillToProject,
59
59
  setMcpConfigMode,
60
+ setMcpConfigPath,
60
61
  setMcpManagerForTools,
61
62
  setMcpTools,
62
63
  setNotifyMcpServersChanged,
63
64
  skillExists
64
- } from "./chunk-AGXBUC4M.js";
65
+ } from "./chunk-FRU2X3IZ.js";
65
66
  import {
66
67
  getPathSeparator,
67
68
  isAbsolutePath
68
- } from "./chunk-BIWVYBIE.js";
69
+ } from "./chunk-BGTEIA2S.js";
69
70
  import {
70
71
  createMcpTools
71
72
  } from "./chunk-NWO6GRYE.js";
@@ -82,7 +83,7 @@ import {
82
83
  ALWAYS_ALLOWED,
83
84
  ALWAYS_ALLOWED_FOR_SUBAGENTS,
84
85
  TOP_LEVEL_ONLY_TOOLS
85
- } from "./chunk-VZHN46NW.js";
86
+ } from "./chunk-6VDCH5ML.js";
86
87
  import {
87
88
  createSession,
88
89
  deleteSession,
@@ -116,14 +117,14 @@ import {
116
117
  import {
117
118
  createProviderManager,
118
119
  parseDefaultModelSelection
119
- } from "./chunk-R2QCDYYR.js";
120
+ } from "./chunk-H774GQJW.js";
120
121
  import {
121
122
  detectModel,
122
123
  getLlmStatus
123
124
  } from "./chunk-M3RB4IF6.js";
124
125
  import {
125
126
  getBackendDisplayName
126
- } from "./chunk-PSJON33Y.js";
127
+ } from "./chunk-YHEQTVFV.js";
127
128
  import {
128
129
  buildModelsUrl
129
130
  } from "./chunk-HNCM3D7Y.js";
@@ -1698,7 +1699,8 @@ var LspServer = class {
1698
1699
  ...process.env,
1699
1700
  HOME: process.env["HOME"],
1700
1701
  PATH: process.env["PATH"]
1701
- }
1702
+ },
1703
+ windowsHide: true
1702
1704
  });
1703
1705
  if (!this.process.stdin || !this.process.stdout) {
1704
1706
  throw new Error("Failed to get stdio streams from language server process");
@@ -3860,7 +3862,7 @@ import { Router as Router7 } from "express";
3860
3862
  import { spawn as spawn2 } from "child_process";
3861
3863
 
3862
3864
  // src/constants.ts
3863
- var VERSION = "2.0.57";
3865
+ var VERSION = "2.0.59";
3864
3866
 
3865
3867
  // src/server/routes/auto-update.ts
3866
3868
  var updateInProgress = false;
@@ -3885,7 +3887,8 @@ function createAutoUpdateRoutes(options = {}) {
3885
3887
  try {
3886
3888
  const latest = await new Promise((resolve4, reject) => {
3887
3889
  const child = spawn2("npm", ["view", "openfox", "version"], {
3888
- stdio: ["ignore", "pipe", "pipe"]
3890
+ stdio: ["ignore", "pipe", "pipe"],
3891
+ windowsHide: true
3889
3892
  });
3890
3893
  let stdout = "";
3891
3894
  child.stdout?.on("data", (data) => {
@@ -3923,7 +3926,8 @@ function createAutoUpdateRoutes(options = {}) {
3923
3926
  try {
3924
3927
  const isService = isRunningAsService();
3925
3928
  const child = spawn2("bash", ["-c", "openfox update"], {
3926
- stdio: ["ignore", "pipe", "pipe"]
3929
+ stdio: ["ignore", "pipe", "pipe"],
3930
+ windowsHide: true
3927
3931
  });
3928
3932
  let stdout = "";
3929
3933
  let stderr = "";
@@ -3963,7 +3967,8 @@ function createAutoUpdateRoutes(options = {}) {
3963
3967
  try {
3964
3968
  const child = spawn2("bash", ["-c", "openfox service restart"], {
3965
3969
  detached: true,
3966
- stdio: "ignore"
3970
+ stdio: "ignore",
3971
+ windowsHide: true
3967
3972
  });
3968
3973
  child.unref();
3969
3974
  res.json({ success: true });
@@ -4031,15 +4036,15 @@ async function createServerHandle(config4) {
4031
4036
  const mcpManager = new McpManager({
4032
4037
  onToolsDiscovered: async (name, tools) => {
4033
4038
  try {
4034
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-5ZHFKWOW.js");
4039
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-GMQUPNBY.js");
4035
4040
  const mode = config4.mode ?? "production";
4036
- const globalConfig = await loadGlobalConfig(mode);
4041
+ const globalConfig = await loadGlobalConfig(mode, config4.globalConfigPath);
4037
4042
  const mcpServers2 = {
4038
4043
  ...globalConfig.mcpServers ?? {}
4039
4044
  };
4040
4045
  if (mcpServers2[name]) {
4041
4046
  mcpServers2[name] = { ...mcpServers2[name], cachedTools: tools };
4042
- await saveGlobalConfig(mode, { ...globalConfig, mcpServers: mcpServers2 });
4047
+ await saveGlobalConfig(mode, { ...globalConfig, mcpServers: mcpServers2 }, config4.globalConfigPath);
4043
4048
  }
4044
4049
  } catch (err) {
4045
4050
  logger.warn("Failed to persist MCP tool cache", { name, error: String(err) });
@@ -4048,6 +4053,7 @@ async function createServerHandle(config4) {
4048
4053
  });
4049
4054
  setMcpManagerForTools(mcpManager);
4050
4055
  setMcpConfigMode(config4.mode ?? "production");
4056
+ setMcpConfigPath(config4.globalConfigPath);
4051
4057
  const mcpServers = config4.mcpServers ?? {};
4052
4058
  Promise.all(
4053
4059
  Object.entries(mcpServers).map(
@@ -4061,7 +4067,7 @@ async function createServerHandle(config4) {
4061
4067
  setMcpTools(mcpTools);
4062
4068
  logger.info("MCP tools registered", { count: mcpTools.length });
4063
4069
  }
4064
- const { signalMcpReady } = await import("./server-V32ZOVU4.js");
4070
+ const { signalMcpReady } = await import("./server-KDGQZNYQ.js");
4065
4071
  signalMcpReady();
4066
4072
  });
4067
4073
  const app = express();
@@ -4132,7 +4138,7 @@ async function createServerHandle(config4) {
4132
4138
  if (!name || !workdir) {
4133
4139
  return res.status(400).json({ error: "name and workdir are required" });
4134
4140
  }
4135
- const { createDirectoryWithGit } = await import("./project-creator-7RBHP6K6.js");
4141
+ const { createDirectoryWithGit } = await import("./project-creator-IDW7RACH.js");
4136
4142
  try {
4137
4143
  const project = await createDirectoryWithGit(name, workdir);
4138
4144
  res.status(201).json({ project });
@@ -4150,7 +4156,7 @@ async function createServerHandle(config4) {
4150
4156
  if (!targetPath) {
4151
4157
  return res.status(400).json({ error: "path is required" });
4152
4158
  }
4153
- const { checkPermissions } = await import("./permissions-QLHZUEGW.js");
4159
+ const { checkPermissions } = await import("./permissions-CGEK3DGZ.js");
4154
4160
  const result = await checkPermissions(targetPath);
4155
4161
  if (result.success) {
4156
4162
  res.json(result);
@@ -4167,7 +4173,7 @@ async function createServerHandle(config4) {
4167
4173
  if (!["group", "ownership", "join_group", "join_group_and_group"].includes(action)) {
4168
4174
  return res.status(400).json({ error: 'action must be "group", "ownership", "join_group", or "join_group_and_group"' });
4169
4175
  }
4170
- const { fixPermissions } = await import("./permissions-QLHZUEGW.js");
4176
+ const { fixPermissions } = await import("./permissions-CGEK3DGZ.js");
4171
4177
  const result = await fixPermissions(targetPath, action);
4172
4178
  if (result.success) {
4173
4179
  res.json(result);
@@ -4254,7 +4260,7 @@ async function createServerHandle(config4) {
4254
4260
  app.get("/api/sessions/:id", async (req, res) => {
4255
4261
  const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
4256
4262
  const { buildMessagesFromStoredEvents } = await import("./folding-2BGFLV5J.js");
4257
- const { getPendingQuestionsForSession } = await import("./tools-L2SMYKJZ.js");
4263
+ const { getPendingQuestionsForSession } = await import("./tools-FQ54IAYG.js");
4258
4264
  const session = sessionManager.getSession(req.params.id);
4259
4265
  if (!session) {
4260
4266
  return res.status(404).json({ error: "Session not found" });
@@ -4273,8 +4279,8 @@ async function createServerHandle(config4) {
4273
4279
  if (!session) {
4274
4280
  return res.status(404).json({ error: "Session not found" });
4275
4281
  }
4276
- const { stopSessionExecution } = await import("./chat-handler-QO4XB66I.js");
4277
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-L2SMYKJZ.js");
4282
+ const { stopSessionExecution } = await import("./chat-handler-AS44EMQE.js");
4283
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-FQ54IAYG.js");
4278
4284
  sessionManager.clearMessageQueue(sessionId);
4279
4285
  stopSessionExecution(sessionId, sessionManager);
4280
4286
  abortSession(sessionId);
@@ -4327,10 +4333,10 @@ async function createServerHandle(config4) {
4327
4333
  if (!result.success) {
4328
4334
  return res.status(500).json({ error: result.error ?? "Failed to set default model" });
4329
4335
  }
4330
- const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-5ZHFKWOW.js");
4331
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
4336
+ const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-GMQUPNBY.js");
4337
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
4332
4338
  const updatedConfig = setDefaultModelSelection(globalConfig, providerId, model);
4333
- await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
4339
+ await saveGlobalConfig(config4.mode ?? "production", updatedConfig, config4.globalConfigPath);
4334
4340
  config4.defaultModelSelection = updatedConfig.defaultModelSelection;
4335
4341
  res.json({ success: true, defaultModelSelection: config4.defaultModelSelection });
4336
4342
  });
@@ -4428,7 +4434,7 @@ async function createServerHandle(config4) {
4428
4434
  if (!callId || approved === void 0) {
4429
4435
  return res.status(400).json({ error: "callId and approved are required" });
4430
4436
  }
4431
- const { providePathConfirmation } = await import("./tools-L2SMYKJZ.js");
4437
+ const { providePathConfirmation } = await import("./tools-FQ54IAYG.js");
4432
4438
  const result = providePathConfirmation(callId, approved, alwaysAllow);
4433
4439
  if (!result.found) {
4434
4440
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
@@ -4436,7 +4442,7 @@ async function createServerHandle(config4) {
4436
4442
  const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
4437
4443
  const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-2BGFLV5J.js");
4438
4444
  const { createSessionStateMessage } = await import("./protocol-CTNE3ANP.js");
4439
- const { getPendingQuestionsForSession } = await import("./tools-L2SMYKJZ.js");
4445
+ const { getPendingQuestionsForSession } = await import("./tools-FQ54IAYG.js");
4440
4446
  const eventStore = getEventStore2();
4441
4447
  const events = eventStore.getEvents(sessionId);
4442
4448
  const messages = buildMessagesFromStoredEvents(events);
@@ -4457,7 +4463,7 @@ async function createServerHandle(config4) {
4457
4463
  if (!skip && typeof answer !== "string") {
4458
4464
  return res.status(400).json({ error: "answer is required when not skipping" });
4459
4465
  }
4460
- const { provideAnswer } = await import("./tools-L2SMYKJZ.js");
4466
+ const { provideAnswer } = await import("./tools-FQ54IAYG.js");
4461
4467
  const found = provideAnswer(callId, answer ?? "", skip ?? false);
4462
4468
  if (!found) {
4463
4469
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -4517,7 +4523,7 @@ async function createServerHandle(config4) {
4517
4523
  backend: activeProvider?.backend ?? llmClient.getBackend(),
4518
4524
  model: llmClient.getModel()
4519
4525
  };
4520
- const { runAgentTurn, TurnMetrics } = await import("./orchestrator-YMNKXVDF.js");
4526
+ const { runAgentTurn, TurnMetrics } = await import("./orchestrator-MH7J2YVP.js");
4521
4527
  runAgentTurn(
4522
4528
  {
4523
4529
  sessionManager,
@@ -4555,8 +4561,8 @@ async function createServerHandle(config4) {
4555
4561
  if (!session) {
4556
4562
  return res.status(404).json({ error: "Session not found" });
4557
4563
  }
4558
- const { stopSessionExecution } = await import("./chat-handler-QO4XB66I.js");
4559
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-L2SMYKJZ.js");
4564
+ const { stopSessionExecution } = await import("./chat-handler-AS44EMQE.js");
4565
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-FQ54IAYG.js");
4560
4566
  const queuedMessages = sessionManager.getQueueState(sessionId);
4561
4567
  sessionManager.clearMessageQueue(sessionId);
4562
4568
  stopSessionExecution(sessionId, sessionManager);
@@ -4676,8 +4682,8 @@ async function createServerHandle(config4) {
4676
4682
  let visionFallback;
4677
4683
  let globalWorkdir;
4678
4684
  try {
4679
- const { loadGlobalConfig, getVisionFallback } = await import("./config-5ZHFKWOW.js");
4680
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
4685
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-GMQUPNBY.js");
4686
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
4681
4687
  const fallback = getVisionFallback(globalConfig);
4682
4688
  if (fallback) {
4683
4689
  visionFallback = {
@@ -4772,11 +4778,16 @@ async function createServerHandle(config4) {
4772
4778
  app.get("/api/providers/models", async (req, res) => {
4773
4779
  const url = req.query["url"];
4774
4780
  const apiKey = req.query["apiKey"];
4781
+ const backend = req.query["backend"];
4775
4782
  if (!url) return res.status(400).json({ error: "url is required" });
4776
4783
  try {
4777
- const { fetchModelsWithContext } = await import("./provider-manager-PR64DEN2.js");
4784
+ const { fetchModelsWithContext } = await import("./provider-manager-ABEUYU3K.js");
4778
4785
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
4779
- const models = await fetchModelsWithContext(url, apiKey);
4786
+ const models = await fetchModelsWithContext(
4787
+ url,
4788
+ apiKey,
4789
+ backend
4790
+ );
4780
4791
  if (models.length === 0) {
4781
4792
  return res.status(404).json({ error: `No models found at ${buildModelsUrl(url)}`, url });
4782
4793
  }
@@ -4806,7 +4817,7 @@ async function createServerHandle(config4) {
4806
4817
  if (!url) return res.status(400).json({ error: "url is required" });
4807
4818
  if (!models?.length) return res.status(400).json({ error: "models is required" });
4808
4819
  try {
4809
- const { autoConfig } = await import("./auto-config-F5Y6KAQ6.js");
4820
+ const { autoConfig } = await import("./auto-config-T5GR2N6X.js");
4810
4821
  const result = await autoConfig({
4811
4822
  url,
4812
4823
  ...apiKey ? { apiKey } : {},
@@ -4825,7 +4836,7 @@ async function createServerHandle(config4) {
4825
4836
  if (!mode) return res.status(400).json({ error: "mode is required" });
4826
4837
  try {
4827
4838
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
4828
- const { getBackendCapabilities } = await import("./backend-B23GIKKD.js");
4839
+ const { getBackendCapabilities } = await import("./backend-P3GHHLHJ.js");
4829
4840
  const { buildNonStreamingCreateParams } = await import("./client-pure-DO3S675T.js");
4830
4841
  const { OpenAIHttpClient } = await import("./http-client-PIWB7BXK.js");
4831
4842
  const { ensureVersionPrefix } = await import("./url-utils-SAJP7AEX.js");
@@ -4894,8 +4905,8 @@ async function createServerHandle(config4) {
4894
4905
  return res.status(400).json({ error: "name, url, and backend are required" });
4895
4906
  }
4896
4907
  try {
4897
- const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-5ZHFKWOW.js");
4898
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
4908
+ const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-GMQUPNBY.js");
4909
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
4899
4910
  const providerBackend = backend;
4900
4911
  const providerModels = modelConfigs?.length ? buildModelConfigs(modelConfigs) : model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [];
4901
4912
  const configWithProvider = addProvider(globalConfig, {
@@ -4914,7 +4925,7 @@ async function createServerHandle(config4) {
4914
4925
  configWithProvider.providers[configWithProvider.providers.length - 1].id,
4915
4926
  firstModelId
4916
4927
  );
4917
- await saveGlobalConfig(config4.mode ?? "production", finalConfig);
4928
+ await saveGlobalConfig(config4.mode ?? "production", finalConfig, config4.globalConfigPath);
4918
4929
  providerManager.setProviders(finalConfig.providers, finalConfig.defaultModelSelection ?? void 0);
4919
4930
  config4.defaultModelSelection = finalConfig.defaultModelSelection;
4920
4931
  const newProvider = finalConfig.providers[finalConfig.providers.length - 1];
@@ -4932,14 +4943,14 @@ async function createServerHandle(config4) {
4932
4943
  app.post("/api/init/config", async (req, res) => {
4933
4944
  const { workdir, visionFallback } = req.body;
4934
4945
  try {
4935
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-5ZHFKWOW.js");
4936
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
4946
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-GMQUPNBY.js");
4947
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
4937
4948
  const updatedConfig = {
4938
4949
  ...globalConfig,
4939
4950
  workspace: workdir ? { workdir } : globalConfig.workspace,
4940
4951
  visionFallback: visionFallback ?? globalConfig.visionFallback
4941
4952
  };
4942
- await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
4953
+ await saveGlobalConfig(config4.mode ?? "production", updatedConfig, config4.globalConfigPath);
4943
4954
  res.json({ success: true });
4944
4955
  } catch (error) {
4945
4956
  res.status(500).json({
@@ -4960,10 +4971,10 @@ async function createServerHandle(config4) {
4960
4971
  });
4961
4972
  app.delete("/api/providers/:id", async (req, res) => {
4962
4973
  const { id } = req.params;
4963
- const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-5ZHFKWOW.js");
4964
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
4974
+ const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-GMQUPNBY.js");
4975
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
4965
4976
  const updatedConfig = removeProvider(globalConfig, id);
4966
- await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
4977
+ await saveGlobalConfig(config4.mode ?? "production", updatedConfig, config4.globalConfigPath);
4967
4978
  providerManager.setProviders(updatedConfig.providers, updatedConfig.defaultModelSelection ?? void 0);
4968
4979
  config4.defaultModelSelection = updatedConfig.defaultModelSelection;
4969
4980
  res.json({ success: true });
@@ -4972,8 +4983,8 @@ async function createServerHandle(config4) {
4972
4983
  const { id } = req.params;
4973
4984
  const { isLocal } = req.body;
4974
4985
  try {
4975
- const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-5ZHFKWOW.js");
4976
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
4986
+ const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-GMQUPNBY.js");
4987
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
4977
4988
  const provider = globalConfig.providers.find((p) => p.id === id);
4978
4989
  if (!provider) {
4979
4990
  return res.status(404).json({ error: "Provider not found" });
@@ -4981,7 +4992,7 @@ async function createServerHandle(config4) {
4981
4992
  const updates = {};
4982
4993
  if (isLocal !== void 0) updates["isLocal"] = isLocal;
4983
4994
  const updatedConfig = updateProvider(globalConfig, id, updates);
4984
- await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
4995
+ await saveGlobalConfig(config4.mode ?? "production", updatedConfig, config4.globalConfigPath);
4985
4996
  providerManager.setProviders(updatedConfig.providers, updatedConfig.defaultModelSelection ?? void 0);
4986
4997
  config4.defaultModelSelection = updatedConfig.defaultModelSelection;
4987
4998
  res.json({ success: true, provider: updatedConfig.providers.find((p) => p.id === id) });
@@ -5001,8 +5012,8 @@ async function createServerHandle(config4) {
5001
5012
  models: modelConfigs
5002
5013
  } = req.body;
5003
5014
  try {
5004
- const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-5ZHFKWOW.js");
5005
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
5015
+ const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-GMQUPNBY.js");
5016
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
5006
5017
  const provider = globalConfig.providers.find((p) => p.id === id);
5007
5018
  if (!provider) {
5008
5019
  return res.status(404).json({ error: "Provider not found" });
@@ -5018,7 +5029,7 @@ async function createServerHandle(config4) {
5018
5029
  updates["models"] = buildModelConfigs(modelConfigs);
5019
5030
  }
5020
5031
  const updatedConfig = updateProvider(globalConfig, id, updates);
5021
- await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
5032
+ await saveGlobalConfig(config4.mode ?? "production", updatedConfig, config4.globalConfigPath);
5022
5033
  providerManager.setProviders(updatedConfig.providers, updatedConfig.defaultModelSelection ?? void 0);
5023
5034
  config4.defaultModelSelection = updatedConfig.defaultModelSelection;
5024
5035
  res.json({ success: true, provider: updatedConfig.providers.find((p) => p.id === id) });
@@ -5039,10 +5050,10 @@ async function createServerHandle(config4) {
5039
5050
  return res.status(400).json({ error: result.error });
5040
5051
  }
5041
5052
  const llmClient = getLLMClient();
5042
- const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-5ZHFKWOW.js");
5043
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
5053
+ const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-GMQUPNBY.js");
5054
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
5044
5055
  const updatedConfig = setDefaultModelSelection(globalConfig, id, llmClient.getModel());
5045
- await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
5056
+ await saveGlobalConfig(config4.mode ?? "production", updatedConfig, config4.globalConfigPath);
5046
5057
  res.json({
5047
5058
  success: true,
5048
5059
  activeProviderId: id,
@@ -5066,7 +5077,7 @@ async function createServerHandle(config4) {
5066
5077
  });
5067
5078
  async function rebuildMcpTools() {
5068
5079
  const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-MOGEI6TP.js");
5069
- const { setMcpTools: setMcpTools2 } = await import("./tools-L2SMYKJZ.js");
5080
+ const { setMcpTools: setMcpTools2 } = await import("./tools-FQ54IAYG.js");
5070
5081
  const mcpTools = createMcpTools2(mcpManager);
5071
5082
  setMcpTools2(mcpTools);
5072
5083
  }
@@ -5128,13 +5139,17 @@ async function createServerHandle(config4) {
5128
5139
  };
5129
5140
  await mcpManager.addServer(name, serverCfg);
5130
5141
  const server = mcpManager.getServer(name);
5131
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-5ZHFKWOW.js");
5132
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
5142
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-GMQUPNBY.js");
5143
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
5133
5144
  const updatedMcpServers = { ...globalConfig.mcpServers ?? {}, [name]: serverCfg };
5134
- await saveGlobalConfig(config4.mode ?? "production", {
5135
- ...globalConfig,
5136
- mcpServers: updatedMcpServers
5137
- });
5145
+ await saveGlobalConfig(
5146
+ config4.mode ?? "production",
5147
+ {
5148
+ ...globalConfig,
5149
+ mcpServers: updatedMcpServers
5150
+ },
5151
+ config4.globalConfigPath
5152
+ );
5138
5153
  await rebuildMcpTools();
5139
5154
  if (server) {
5140
5155
  const sessions = sessionManager.listSessions();
@@ -5154,14 +5169,18 @@ async function createServerHandle(config4) {
5154
5169
  return res.status(404).json({ error: `MCP server '${name}' not found` });
5155
5170
  }
5156
5171
  mcpManager.removeServer(name);
5157
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-5ZHFKWOW.js");
5158
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
5172
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-GMQUPNBY.js");
5173
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
5159
5174
  const updatedMcpServers = { ...globalConfig.mcpServers ?? {} };
5160
5175
  delete updatedMcpServers[name];
5161
- await saveGlobalConfig(config4.mode ?? "production", {
5162
- ...globalConfig,
5163
- mcpServers: updatedMcpServers
5164
- });
5176
+ await saveGlobalConfig(
5177
+ config4.mode ?? "production",
5178
+ {
5179
+ ...globalConfig,
5180
+ mcpServers: updatedMcpServers
5181
+ },
5182
+ config4.globalConfigPath
5183
+ );
5165
5184
  await rebuildMcpTools();
5166
5185
  const sessions = sessionManager.listSessions();
5167
5186
  for (const s of sessions) {
@@ -5179,18 +5198,22 @@ async function createServerHandle(config4) {
5179
5198
  await mcpManager.setToolEnabled(name, toolName, enabled);
5180
5199
  const server = mcpManager.getServer(name);
5181
5200
  if (server) {
5182
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-5ZHFKWOW.js");
5183
- const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
5201
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-GMQUPNBY.js");
5202
+ const globalConfig = await loadGlobalConfig(config4.mode ?? "production", config4.globalConfigPath);
5184
5203
  const mcpServers2 = { ...globalConfig.mcpServers ?? {} };
5185
5204
  const serverCfg = mcpServers2[name];
5186
5205
  if (serverCfg) {
5187
5206
  const disabledTools = server.tools.filter((t) => !t.enabled).map((t) => t.name);
5188
5207
  const cfg = { ...serverCfg, ...disabledTools.length > 0 ? { disabledTools } : { disabledTools: void 0 } };
5189
5208
  mcpServers2[name] = cfg;
5190
- await saveGlobalConfig(config4.mode ?? "production", {
5191
- ...globalConfig,
5192
- mcpServers: mcpServers2
5193
- });
5209
+ await saveGlobalConfig(
5210
+ config4.mode ?? "production",
5211
+ {
5212
+ ...globalConfig,
5213
+ mcpServers: mcpServers2
5214
+ },
5215
+ config4.globalConfigPath
5216
+ );
5194
5217
  }
5195
5218
  }
5196
5219
  await rebuildMcpTools();
@@ -5225,13 +5248,13 @@ async function createServerHandle(config4) {
5225
5248
  })
5226
5249
  );
5227
5250
  app.get("/api/sessions/:id/background-processes", async (req, res) => {
5228
- const { getSessionProcesses } = await import("./manager-CZOVNTSN.js");
5251
+ const { getSessionProcesses } = await import("./manager-344C5JLZ.js");
5229
5252
  const sessionId = req.params.id;
5230
5253
  const processes = getSessionProcesses(sessionId);
5231
5254
  res.json({ processes });
5232
5255
  });
5233
5256
  app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
5234
- const { stopProcess } = await import("./manager-CZOVNTSN.js");
5257
+ const { stopProcess } = await import("./manager-344C5JLZ.js");
5235
5258
  const sessionId = req.params.id;
5236
5259
  const processId = req.params.processId;
5237
5260
  const session = sessionManager.getSession(sessionId);
@@ -5245,7 +5268,7 @@ async function createServerHandle(config4) {
5245
5268
  res.status(500).json({ error: err instanceof Error ? err.message : "Failed to stop process" });
5246
5269
  }
5247
5270
  });
5248
- const { getCurrentBranch } = await import("./branch.api-5DMEAIBI.js");
5271
+ const { getCurrentBranch } = await import("./branch.api-LAN42BA5.js");
5249
5272
  app.get("/api/branch", async (req, res) => {
5250
5273
  await getCurrentBranch(req, res);
5251
5274
  });
@@ -5374,7 +5397,7 @@ async function createServerHandle(config4) {
5374
5397
  const state = sessionManager.getContextState(sessionId);
5375
5398
  wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
5376
5399
  });
5377
- const { QueueProcessor } = await import("./processor-2BB65JWR.js");
5400
+ const { QueueProcessor } = await import("./processor-34MVJZTD.js");
5378
5401
  const queueProcessor = new QueueProcessor({
5379
5402
  sessionManager,
5380
5403
  providerManager,
@@ -5417,9 +5440,14 @@ async function createServerHandle(config4) {
5417
5440
  await mcpManager.disconnectAll();
5418
5441
  const { stopAllInspectProxies } = await import("./inspect-proxy-BV25JERQ.js");
5419
5442
  stopAllInspectProxies();
5420
- const { cleanupAllProcesses } = await import("./store-NS2RMRA7.js");
5443
+ const { cleanupAllProcesses } = await import("./store-FXTCHBI4.js");
5421
5444
  cleanupAllProcesses();
5422
5445
  viteServer?.close();
5446
+ if (config4.globalConfigPath) {
5447
+ const { unlink: unlink2 } = await import("fs/promises");
5448
+ unlink2(config4.globalConfigPath).catch(() => {
5449
+ });
5450
+ }
5423
5451
  for (const client of wss.clients) {
5424
5452
  client.terminate();
5425
5453
  }
@@ -5449,4 +5477,4 @@ export {
5449
5477
  createServerHandle,
5450
5478
  createServer
5451
5479
  };
5452
- //# sourceMappingURL=chunk-5HOP4QF7.js.map
5480
+ //# sourceMappingURL=chunk-LQFCQ6PY.js.map
@@ -131,7 +131,7 @@ async function generateSessionNameForSession(sessionId, userMessage, deps, signa
131
131
  client = deps.getLLMClient();
132
132
  client.setModel(providerConfig.model);
133
133
  } else if (providerConfig) {
134
- const { createLLMClient } = await import("./client-Y3ESMMZA.js");
134
+ const { createLLMClient } = await import("./client-KRFGMNGN.js");
135
135
  client = createLLMClient({
136
136
  llm: {
137
137
  baseUrl: providerConfig.baseUrl,
@@ -180,4 +180,4 @@ export {
180
180
  buildRunChatTurnParams,
181
181
  generateSessionNameForSession
182
182
  };
183
- //# sourceMappingURL=chunk-UOKVBO67.js.map
183
+ //# sourceMappingURL=chunk-NVPVDDQZ.js.map