openfox 2.0.101 → 2.0.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/CHANGELOG.md +18 -0
  3. package/dist/{chat-handler-YPWT4MAQ.js → chat-handler-IBFSBSGV.js} +22 -21
  4. package/dist/{chunk-O2PLNJIU.js → chunk-2EYTYXWN.js} +2 -2
  5. package/dist/{chunk-MRWR3SIT.js → chunk-4Z2ARCY3.js} +2 -2
  6. package/dist/{chunk-AY37NB76.js → chunk-5ZJYEINJ.js} +2 -2
  7. package/dist/{chunk-7GBFQ2PE.js → chunk-6ZV3NYEE.js} +201 -103
  8. package/dist/{chunk-XTKLA4AK.js → chunk-73EV6QYX.js} +4 -4
  9. package/dist/{chunk-XLI6PDJG.js → chunk-7HIJP4PC.js} +2 -2
  10. package/dist/{chunk-W77HIJGH.js → chunk-AI27N57J.js} +3 -3
  11. package/dist/{chunk-VJILJ22N.js → chunk-BJDQPILB.js} +3 -3
  12. package/dist/{chunk-MO3GJIT3.js → chunk-DPRJYQ5U.js} +132 -43
  13. package/dist/{chunk-3LRYZ7R3.js → chunk-FQS7A5M4.js} +2 -2
  14. package/dist/{chunk-NWO6GRYE.js → chunk-JE7LW7Y6.js} +2 -1
  15. package/dist/{chunk-C6QW2IDH.js → chunk-K6VVTE6C.js} +30 -28
  16. package/dist/{chunk-UIK6GA3P.js → chunk-KCED2X4H.js} +2 -2
  17. package/dist/{chunk-NLN5LPQ4.js → chunk-KKEBXFB3.js} +2 -2
  18. package/dist/{chunk-HAFRPV7I.js → chunk-KLK5N4OX.js} +3 -3
  19. package/dist/{chunk-KQPDU65K.js → chunk-MGKS2NG2.js} +3 -3
  20. package/dist/{chunk-TDHDLDGQ.js → chunk-MR7ZEGOF.js} +2 -2
  21. package/dist/{chunk-MBYXZ5V5.js → chunk-QGWS2EBU.js} +5 -5
  22. package/dist/{chunk-CFTT46KH.js → chunk-QL2G5UWE.js} +26 -24
  23. package/dist/{chunk-ZIMGU5ZH.js → chunk-RZC6DAT2.js} +2 -2
  24. package/dist/chunk-SV3I2YNO.js +7 -0
  25. package/dist/chunk-W5FTCTGY.js +72 -0
  26. package/dist/{chunk-E2CSSHSI.js → chunk-W5RC44R6.js} +10 -10
  27. package/dist/{chunk-KNYPBXPW.js → chunk-WPCYFH6X.js} +4 -4
  28. package/dist/{chunk-UEOEA6BB.js → chunk-YZSBJUGC.js} +3 -2
  29. package/dist/{chunk-IXFEXEUL.js → chunk-Z753S3X7.js} +6 -6
  30. package/dist/{chunk-G5JFKTSR.js → chunk-ZLCPNTRT.js} +4 -4
  31. package/dist/cli/dev.js +1 -1
  32. package/dist/cli/index.js +1 -1
  33. package/dist/{client-CFTJH6BY.js → client-Q7BHKOCD.js} +5 -5
  34. package/dist/{client-pure-DCEZBFKW.js → client-pure-ONSVWEG5.js} +2 -2
  35. package/dist/{compactor-B4V75Q3A.js → compactor-43P3LGDU.js} +11 -11
  36. package/dist/{dynamic-context-MA5BIJ52.js → dynamic-context-AMPVZXUU.js} +7 -7
  37. package/dist/{events-4THEZWVL.js → events-RCC32JOA.js} +6 -6
  38. package/dist/{folding-OYBO2NTH.js → folding-ZNUXPQUD.js} +4 -4
  39. package/dist/{http-client-U6DVFL7F.js → http-client-WGNBG7PC.js} +3 -3
  40. package/dist/{manager-53J5P4EZ.js → manager-HFGJLW7Q.js} +4 -4
  41. package/dist/model-overrides-DQDT5Y7R.js +21 -0
  42. package/dist/{orchestrator-DHBU7LRB.js → orchestrator-QDXKDLOW.js} +26 -25
  43. package/dist/package.json +1 -1
  44. package/dist/{path-security-6GYETPWN.js → path-security-SUFEIBTC.js} +7 -7
  45. package/dist/{platform-7KXP3VVA.js → platform-2RLL7RAE.js} +3 -3
  46. package/dist/{processor-RC3IBY2J.js → processor-YWNLWAZW.js} +21 -20
  47. package/dist/{provider-PEJ27FBM.js → provider-FX3QCGAF.js} +6 -6
  48. package/dist/{provider-manager-EJGPSLOZ.js → provider-manager-GLG6BA32.js} +6 -6
  49. package/dist/{registry-QEOTM3IG.js → registry-GBNLVWYQ.js} +3 -3
  50. package/dist/{serve-KM2RVX2U.js → serve-RKHLNGEV.js} +27 -26
  51. package/dist/server/index.d.ts +15 -0
  52. package/dist/server/index.js +26 -25
  53. package/dist/server-QGQGSHW6.js +47 -0
  54. package/dist/{service-2PW2V25M.js → service-CXWJQFOZ.js} +62 -20
  55. package/dist/{session-overrides-BQSE3V3F.js → session-overrides-MBGBX6TM.js} +5 -5
  56. package/dist/{sessions-AUDWMF55.js → sessions-FEIFYGH7.js} +4 -4
  57. package/dist/{settings-2WVGUPYV.js → settings-FT7HF7ZB.js} +2 -2
  58. package/dist/skill-defaults/browser/SKILL.md +8 -1
  59. package/dist/{tool-adapter-MOGEI6TP.js → tool-adapter-FEAHWU5C.js} +2 -2
  60. package/dist/{tools-X5FONL4Q.js → tools-M5DKWCJJ.js} +19 -16
  61. package/dist/{update-GHS75L7T.js → update-N4GD5IUX.js} +2 -2
  62. package/dist/web/assets/{index-BG5sD2ez.css → index-B0CNNl1k.css} +1 -1
  63. package/dist/web/assets/{index-CCBacuE6.js → index-FWViKQkM.js} +83 -83
  64. package/dist/web/index.html +2 -2
  65. package/dist/web/sw.js +1 -1
  66. package/package.json +1 -1
  67. package/dist/chunk-UCNMVJXD.js +0 -7
  68. package/dist/server-ORYMG5HD.js +0 -46
@@ -21,37 +21,20 @@ import {
21
21
  tokenFromPassword,
22
22
  verifyPassword,
23
23
  workflowExists
24
- } from "./chunk-C6QW2IDH.js";
24
+ } from "./chunk-K6VVTE6C.js";
25
25
  import {
26
26
  openFolder
27
27
  } from "./chunk-62QCBNPE.js";
28
28
  import {
29
29
  createToolRegistry,
30
30
  devServerManager,
31
+ getBuiltInToolNames,
31
32
  setMcpConfigMode,
32
33
  setMcpConfigPath,
33
34
  setMcpManagerForTools,
34
35
  setMcpTools,
35
36
  setNotifyMcpServersChanged
36
- } from "./chunk-MO3GJIT3.js";
37
- import {
38
- createMcpTools
39
- } from "./chunk-NWO6GRYE.js";
40
- import {
41
- deleteWorkspace,
42
- ensureWorkspace,
43
- getCommitsBehind,
44
- getGitBranch,
45
- getGlobalDataDir,
46
- getWorkspacesDir,
47
- loadWorkspaceConfig,
48
- resolveAndValidateSourceBranch,
49
- runGit,
50
- saveWorkspaceConfig,
51
- validateRef,
52
- validateWorkspaceName,
53
- workspaceExists
54
- } from "./chunk-D3SXT3BL.js";
37
+ } from "./chunk-DPRJYQ5U.js";
55
38
  import {
56
39
  deleteOwnedSkill,
57
40
  deleteProjectSkill,
@@ -70,27 +53,34 @@ import {
70
53
  setSkillEnabled,
71
54
  skillExists,
72
55
  updateOwnedSkill
73
- } from "./chunk-KQPDU65K.js";
74
- import {
75
- getSessionDisabledServers,
76
- setSessionDisabledServers
77
- } from "./chunk-XLI6PDJG.js";
78
- import {
79
- createContextStateMessage
80
- } from "./chunk-27SDWNKL.js";
81
- import {
82
- EventEmitter
83
- } from "./chunk-EU3WWTFH.js";
84
- import {
85
- getProject,
86
- getProjectByWorkdir,
87
- updateProject
88
- } from "./chunk-WWFH5GAR.js";
56
+ } from "./chunk-MGKS2NG2.js";
89
57
  import {
90
58
  ALWAYS_ALLOWED,
91
59
  ALWAYS_ALLOWED_FOR_SUBAGENTS,
92
60
  TOP_LEVEL_ONLY_TOOLS
93
- } from "./chunk-MRWR3SIT.js";
61
+ } from "./chunk-4Z2ARCY3.js";
62
+ import {
63
+ createMcpTools
64
+ } from "./chunk-JE7LW7Y6.js";
65
+ import {
66
+ deleteWorkspace,
67
+ ensureWorkspace,
68
+ getCommitsBehind,
69
+ getGitBranch,
70
+ getGlobalDataDir,
71
+ getWorkspacesDir,
72
+ loadWorkspaceConfig,
73
+ resolveAndValidateSourceBranch,
74
+ runGit,
75
+ saveWorkspaceConfig,
76
+ validateRef,
77
+ validateWorkspaceName,
78
+ workspaceExists
79
+ } from "./chunk-D3SXT3BL.js";
80
+ import {
81
+ getSessionDisabledServers,
82
+ setSessionDisabledServers
83
+ } from "./chunk-7HIJP4PC.js";
94
84
  import {
95
85
  emitAssistantMessageStart,
96
86
  emitContextState,
@@ -107,14 +97,31 @@ import {
107
97
  getEventStore,
108
98
  getSessionState,
109
99
  initEventStore
110
- } from "./chunk-KNYPBXPW.js";
100
+ } from "./chunk-WPCYFH6X.js";
101
+ import {
102
+ createContextStateMessage
103
+ } from "./chunk-27SDWNKL.js";
104
+ import {
105
+ EventEmitter
106
+ } from "./chunk-EU3WWTFH.js";
111
107
  import {
112
108
  getPathSeparator,
113
109
  isAbsolutePath
114
- } from "./chunk-NLN5LPQ4.js";
110
+ } from "./chunk-KKEBXFB3.js";
111
+ import {
112
+ getAgentModelOverride,
113
+ getAgentModelOverrides,
114
+ resolveLLMClientForAgent,
115
+ setAgentModelOverride
116
+ } from "./chunk-W5FTCTGY.js";
117
+ import {
118
+ getProject,
119
+ getProjectByWorkdir,
120
+ updateProject
121
+ } from "./chunk-WWFH5GAR.js";
115
122
  import {
116
123
  VERSION
117
- } from "./chunk-UCNMVJXD.js";
124
+ } from "./chunk-SV3I2YNO.js";
118
125
  import {
119
126
  clearWorkflowExecution,
120
127
  createSession,
@@ -134,7 +141,7 @@ import {
134
141
  updateSessionRunning,
135
142
  updateSessionWorkdir,
136
143
  updateWorkflowExecutionStatus
137
- } from "./chunk-ZIMGU5ZH.js";
144
+ } from "./chunk-RZC6DAT2.js";
138
145
  import {
139
146
  agentExists,
140
147
  deleteAgent,
@@ -157,13 +164,13 @@ import {
157
164
  saveAgentToProject,
158
165
  saveItemToDir,
159
166
  setRuntimeConfig
160
- } from "./chunk-3LRYZ7R3.js";
167
+ } from "./chunk-FQS7A5M4.js";
161
168
  import {
162
169
  createProviderManager,
163
170
  detectModel,
164
171
  getLlmStatus,
165
172
  parseDefaultModelSelection
166
- } from "./chunk-W77HIJGH.js";
173
+ } from "./chunk-AI27N57J.js";
167
174
  import {
168
175
  getModelProfile
169
176
  } from "./chunk-V4IE7HJY.js";
@@ -176,12 +183,12 @@ import {
176
183
  import {
177
184
  SessionNotFoundError,
178
185
  WorkspaceInUseError
179
- } from "./chunk-TDHDLDGQ.js";
186
+ } from "./chunk-MR7ZEGOF.js";
180
187
  import {
181
188
  deleteSetting,
182
189
  getSetting,
183
190
  setSetting
184
- } from "./chunk-UEOEA6BB.js";
191
+ } from "./chunk-YZSBJUGC.js";
185
192
  import {
186
193
  initDatabase
187
194
  } from "./chunk-GLF65XDS.js";
@@ -2675,6 +2682,31 @@ var SessionManager = class {
2675
2682
  constructor(providerManager) {
2676
2683
  this.providerManager = providerManager;
2677
2684
  }
2685
+ getProviderManager() {
2686
+ return this.providerManager;
2687
+ }
2688
+ /**
2689
+ * Create an LLM client for a specific agent, respecting its model override.
2690
+ *
2691
+ * If the agent has a model override stored in settings, creates a dedicated
2692
+ * client for that provider+model. Falls back to the global client if no
2693
+ * override is set or the provider no longer exists.
2694
+ *
2695
+ * @param preferredFallback - When provided, used as fallback instead of
2696
+ * providerManager.getLLMClient(). This is important in mock/test mode
2697
+ * where the caller already has a mock client that should be preserved.
2698
+ */
2699
+ createClientForAgent(agentId, preferredFallback) {
2700
+ const fallback = preferredFallback ?? this.providerManager.getLLMClient();
2701
+ const resolved = resolveLLMClientForAgent(agentId, fallback, this.providerManager);
2702
+ if (resolved.warning) {
2703
+ logger.warn("Agent model override unavailable, falling back", {
2704
+ agentId,
2705
+ warning: resolved.warning
2706
+ });
2707
+ }
2708
+ return resolved.client;
2709
+ }
2678
2710
  getCurrentModelSettings(sessionId) {
2679
2711
  let providerId;
2680
2712
  let model;
@@ -4426,7 +4458,37 @@ var config2 = {
4426
4458
  }
4427
4459
  return null;
4428
4460
  },
4429
- mapToResponse: (a) => a.metadata
4461
+ mapToResponse: (a) => a.metadata,
4462
+ extraGetData: async () => {
4463
+ const overrides = getAgentModelOverrides();
4464
+ const modelOverrides = {};
4465
+ for (const [agentId, override] of Object.entries(overrides)) {
4466
+ modelOverrides[agentId] = `${override.providerId}/${override.model}`;
4467
+ }
4468
+ return { modelOverrides };
4469
+ },
4470
+ extraRoutes: (router) => {
4471
+ router.get("/:id/model", (req, res) => {
4472
+ const { id } = req.params;
4473
+ const override = getAgentModelOverride(id);
4474
+ res.json(override ?? { providerId: null, model: null });
4475
+ });
4476
+ router.put("/:id/model", (req, res) => {
4477
+ const { id } = req.params;
4478
+ const { providerId, model } = req.body;
4479
+ if (providerId && model) {
4480
+ setAgentModelOverride(id, { providerId, model });
4481
+ } else {
4482
+ setAgentModelOverride(id, null);
4483
+ }
4484
+ res.json({ success: true });
4485
+ });
4486
+ router.delete("/:id/model", (req, res) => {
4487
+ const { id } = req.params;
4488
+ setAgentModelOverride(id, null);
4489
+ res.json({ success: true });
4490
+ });
4491
+ }
4430
4492
  };
4431
4493
  function createAgentRoutes(configDir, projectDir) {
4432
4494
  return createCrudRoutes(config2, configDir, projectDir);
@@ -5715,7 +5777,7 @@ async function createServerHandle(config3) {
5715
5777
  initLLM().catch(
5716
5778
  (err) => logger.error("LLM initialization failed", { error: err instanceof Error ? err.message : String(err) })
5717
5779
  );
5718
- const toolRegistry = createToolRegistry();
5780
+ let toolRegistry = createToolRegistry();
5719
5781
  const mcpManager = new McpManager({
5720
5782
  onToolsDiscovered: async (name, tools) => {
5721
5783
  try {
@@ -5748,9 +5810,10 @@ async function createServerHandle(config3) {
5748
5810
  const mcpTools = createMcpTools(mcpManager);
5749
5811
  if (mcpTools.length > 0) {
5750
5812
  setMcpTools(mcpTools);
5813
+ toolRegistry = createToolRegistry();
5751
5814
  logger.info("MCP tools registered", { count: mcpTools.length });
5752
5815
  }
5753
- const { signalMcpReady } = await import("./server-ORYMG5HD.js");
5816
+ const { signalMcpReady } = await import("./server-QGQGSHW6.js");
5754
5817
  signalMcpReady();
5755
5818
  });
5756
5819
  const app = express();
@@ -5819,17 +5882,20 @@ async function createServerHandle(config3) {
5819
5882
  res.json({ token });
5820
5883
  });
5821
5884
  app.get("/api/tools", (_req, res) => {
5885
+ const builtInNames = getBuiltInToolNames();
5822
5886
  const tools = toolRegistry.tools.map((t) => ({
5823
5887
  name: t.name,
5824
5888
  actions: t.permittedActions || [],
5825
5889
  alwaysAllowed: ALWAYS_ALLOWED.has(t.name) || ALWAYS_ALLOWED_FOR_SUBAGENTS.has(t.name),
5826
- topLevelOnly: TOP_LEVEL_ONLY_TOOLS.has(t.name)
5890
+ topLevelOnly: TOP_LEVEL_ONLY_TOOLS.has(t.name),
5891
+ isMcp: !builtInNames.has(t.name),
5892
+ mcpServer: t.mcpServer
5827
5893
  }));
5828
5894
  res.json({ tools });
5829
5895
  });
5830
5896
  app.get("/api/projects", async (_req, res) => {
5831
- const { listProjects } = await import("./projects-M5XKC7O6.js");
5832
- const projects = listProjects();
5897
+ const { listProjects: listProjects2 } = await import("./projects-M5XKC7O6.js");
5898
+ const projects = listProjects2();
5833
5899
  res.json({ projects });
5834
5900
  });
5835
5901
  app.post("/api/projects", async (req, res) => {
@@ -5957,7 +6023,7 @@ async function createServerHandle(config3) {
5957
6023
  }
5958
6024
  try {
5959
6025
  await checkoutBranch(project.workdir, branch);
5960
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-AUDWMF55.js");
6026
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-FEIFYGH7.js");
5961
6027
  const allSessions = sessionManager.listSessions();
5962
6028
  for (const s of allSessions) {
5963
6029
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -5993,7 +6059,7 @@ async function createServerHandle(config3) {
5993
6059
  );
5994
6060
  }
5995
6061
  await createBranch(project.workdir, name, sb);
5996
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-AUDWMF55.js");
6062
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-FEIFYGH7.js");
5997
6063
  const allSessions = sessionManager.listSessions();
5998
6064
  for (const s of allSessions) {
5999
6065
  if (sessionManager.getEffectiveWorkdir(s.id) === project.workdir) {
@@ -6025,7 +6091,7 @@ async function createServerHandle(config3) {
6025
6091
  if (!branch || typeof branch !== "string") return res.status(400).json({ error: "branch is required" });
6026
6092
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6027
6093
  const { checkoutBranch, validateRef: validateRef2 } = await import("./workspace-2NDXTCVR.js");
6028
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-AUDWMF55.js");
6094
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-FEIFYGH7.js");
6029
6095
  try {
6030
6096
  await validateRef2(effectiveWorkdir, branch);
6031
6097
  await checkoutBranch(effectiveWorkdir, branch);
@@ -6068,7 +6134,7 @@ All file and git operations should use this branch.
6068
6134
  if (!name || typeof name !== "string") return res.status(400).json({ error: "name is required" });
6069
6135
  const effectiveWorkdir = sessionManager.getEffectiveWorkdir(req.params.id);
6070
6136
  const { validateRef: validateRef2 } = await import("./workspace-2NDXTCVR.js");
6071
- const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-AUDWMF55.js");
6137
+ const { updateSessionBranch: updateSessionBranch2 } = await import("./sessions-FEIFYGH7.js");
6072
6138
  try {
6073
6139
  await validateRef2(effectiveWorkdir, name);
6074
6140
  if (sourceBranch) {
@@ -6123,8 +6189,8 @@ All file and git operations should use this branch.
6123
6189
  res.json({ workspaces: workspacesList });
6124
6190
  });
6125
6191
  app.get("/api/sessions", async (req, res) => {
6126
- const { getRecentUserPromptsForSession } = await import("./events-4THEZWVL.js");
6127
- const { getPendingConfirmationsBySession } = await import("./path-security-6GYETPWN.js");
6192
+ const { getRecentUserPromptsForSession } = await import("./events-RCC32JOA.js");
6193
+ const { getPendingConfirmationsBySession } = await import("./path-security-SUFEIBTC.js");
6128
6194
  const projectId = req.query["projectId"];
6129
6195
  const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
6130
6196
  const offset = parseInt(req.query["offset"]) || 0;
@@ -6170,7 +6236,7 @@ All file and git operations should use this branch.
6170
6236
  disabledServers = mcpManager.getAllServers().filter((s) => s.config.disabled).map((s) => s.name);
6171
6237
  }
6172
6238
  if (disabledServers.length > 0) {
6173
- const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-BQSE3V3F.js");
6239
+ const { setSessionDisabledServers: setSessionDisabledServers2 } = await import("./session-overrides-MBGBX6TM.js");
6174
6240
  setSessionDisabledServers2(session.id, disabledServers);
6175
6241
  }
6176
6242
  } catch {
@@ -6243,14 +6309,23 @@ All file and git operations should use this branch.
6243
6309
  }
6244
6310
  });
6245
6311
  app.get("/api/sessions/:id", async (req, res) => {
6246
- const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-4THEZWVL.js");
6247
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-OYBO2NTH.js");
6248
- const { getPendingQuestionsForSession } = await import("./tools-X5FONL4Q.js");
6249
- const { getMaxVisibleItems } = await import("./settings-2WVGUPYV.js");
6250
- const session = sessionManager.getSession(req.params.id);
6312
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot } = await import("./events-RCC32JOA.js");
6313
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-ZNUXPQUD.js");
6314
+ const { getPendingQuestionsForSession } = await import("./tools-M5DKWCJJ.js");
6315
+ const { getMaxVisibleItems } = await import("./settings-FT7HF7ZB.js");
6316
+ const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-DQDT5Y7R.js");
6317
+ const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-FEIFYGH7.js");
6318
+ let session = sessionManager.getSession(req.params.id);
6251
6319
  if (!session) {
6252
6320
  return res.status(404).json({ error: "Session not found" });
6253
6321
  }
6322
+ if (!session.providerId && session.mode) {
6323
+ const override = getAgentModelOverride2(session.mode);
6324
+ if (override) {
6325
+ updateSessionProvider2(session.id, override.providerId, override.model);
6326
+ session = sessionManager.getSession(session.id);
6327
+ }
6328
+ }
6254
6329
  const eventStore = getEventStore2();
6255
6330
  const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(req.params.id);
6256
6331
  const events = combineEventsWithSnapshot(req.params.id, snapshot, eventsSinceSnapshot);
@@ -6278,8 +6353,8 @@ All file and git operations should use this branch.
6278
6353
  if (!session) {
6279
6354
  return res.status(404).json({ error: "Session not found" });
6280
6355
  }
6281
- const { stopSessionExecution } = await import("./chat-handler-YPWT4MAQ.js");
6282
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-X5FONL4Q.js");
6356
+ const { stopSessionExecution } = await import("./chat-handler-IBFSBSGV.js");
6357
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-M5DKWCJJ.js");
6283
6358
  sessionManager.clearMessageQueue(sessionId);
6284
6359
  stopSessionExecution(sessionId, sessionManager);
6285
6360
  abortSession(sessionId);
@@ -6308,9 +6383,9 @@ All file and git operations should use this branch.
6308
6383
  res.json({ success: true });
6309
6384
  });
6310
6385
  app.post("/api/sessions/:id/provider", async (req, res) => {
6311
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-4THEZWVL.js");
6312
- const { buildMessagesFromStoredEvents } = await import("./folding-OYBO2NTH.js");
6313
- const { getMaxVisibleItems } = await import("./settings-2WVGUPYV.js");
6386
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-RCC32JOA.js");
6387
+ const { buildMessagesFromStoredEvents } = await import("./folding-ZNUXPQUD.js");
6388
+ const { getMaxVisibleItems } = await import("./settings-FT7HF7ZB.js");
6314
6389
  const sessionId = req.params.id;
6315
6390
  const session = sessionManager.getSession(sessionId);
6316
6391
  if (!session) {
@@ -6423,9 +6498,11 @@ All file and git operations should use this branch.
6423
6498
  res.json({ success: true });
6424
6499
  });
6425
6500
  app.put("/api/sessions/:id/mode", async (req, res) => {
6426
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-4THEZWVL.js");
6427
- const { buildMessagesFromStoredEvents } = await import("./folding-OYBO2NTH.js");
6428
- const { getMaxVisibleItems } = await import("./settings-2WVGUPYV.js");
6501
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEv } = await import("./events-RCC32JOA.js");
6502
+ const { buildMessagesFromStoredEvents } = await import("./folding-ZNUXPQUD.js");
6503
+ const { getMaxVisibleItems } = await import("./settings-FT7HF7ZB.js");
6504
+ const { getAgentModelOverride: getAgentModelOverride2 } = await import("./model-overrides-DQDT5Y7R.js");
6505
+ const { updateSessionProvider: updateSessionProvider2 } = await import("./sessions-FEIFYGH7.js");
6429
6506
  const sessionId = req.params.id;
6430
6507
  const session = sessionManager.getSession(sessionId);
6431
6508
  if (!session) {
@@ -6441,6 +6518,22 @@ All file and git operations should use this branch.
6441
6518
  return res.status(400).json({ error: `Invalid mode. Must be one of: ${topLevelIds.join(", ")}` });
6442
6519
  }
6443
6520
  sessionManager.setMode(sessionId, mode);
6521
+ const override = getAgentModelOverride2(mode);
6522
+ if (override) {
6523
+ updateSessionProvider2(sessionId, override.providerId, override.model);
6524
+ } else {
6525
+ updateSessionProvider2(sessionId, null, null);
6526
+ const { providerId: defaultProviderId, model: defaultModel } = parseDefaultModelSelection(
6527
+ config3.defaultModelSelection
6528
+ );
6529
+ if (defaultProviderId && defaultModel) {
6530
+ const currentActiveProviderId = providerManager.getActiveProviderId();
6531
+ const currentModel = providerManager.getCurrentModel();
6532
+ if (currentActiveProviderId !== defaultProviderId || currentModel !== defaultModel) {
6533
+ await providerManager.activateProvider(defaultProviderId, { model: defaultModel });
6534
+ }
6535
+ }
6536
+ }
6444
6537
  const eventStore = getEventStore2();
6445
6538
  const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(sessionId);
6446
6539
  const events = combineEv(sessionId, snapshot, eventsSinceSnapshot);
@@ -6511,7 +6604,7 @@ All file and git operations should use this branch.
6511
6604
  if (alwaysAllow !== void 0 && typeof alwaysAllow !== "boolean") {
6512
6605
  return res.status(400).json({ error: "alwaysAllow must be a boolean if provided" });
6513
6606
  }
6514
- const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-X5FONL4Q.js");
6607
+ const { providePathConfirmation, getConfirmationSessionId } = await import("./tools-M5DKWCJJ.js");
6515
6608
  const pendingSessionId = getConfirmationSessionId(callId);
6516
6609
  if (!pendingSessionId) {
6517
6610
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
@@ -6523,11 +6616,11 @@ All file and git operations should use this branch.
6523
6616
  if (!result.found) {
6524
6617
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
6525
6618
  }
6526
- const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-4THEZWVL.js");
6527
- const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-OYBO2NTH.js");
6619
+ const { getEventStore: getEventStore2, combineEventsWithSnapshot: combineEvents } = await import("./events-RCC32JOA.js");
6620
+ const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-ZNUXPQUD.js");
6528
6621
  const { createSessionStateMessage } = await import("./protocol-YDNGGADL.js");
6529
- const { getPendingQuestionsForSession } = await import("./tools-X5FONL4Q.js");
6530
- const { getMaxVisibleItems } = await import("./settings-2WVGUPYV.js");
6622
+ const { getPendingQuestionsForSession } = await import("./tools-M5DKWCJJ.js");
6623
+ const { getMaxVisibleItems } = await import("./settings-FT7HF7ZB.js");
6531
6624
  const eventStore = getEventStore2();
6532
6625
  const { snapshot, events: eventsSinceSnapshot } = eventStore.getEventsSinceSnapshot(sessionId);
6533
6626
  const events = combineEvents(sessionId, snapshot, eventsSinceSnapshot);
@@ -6563,7 +6656,7 @@ All file and git operations should use this branch.
6563
6656
  if (!skip && typeof answer !== "string") {
6564
6657
  return res.status(400).json({ error: "answer is required when not skipping" });
6565
6658
  }
6566
- const { provideAnswer } = await import("./tools-X5FONL4Q.js");
6659
+ const { provideAnswer } = await import("./tools-M5DKWCJJ.js");
6567
6660
  const found = provideAnswer(callId, answer ?? "", skip ?? false);
6568
6661
  if (!found) {
6569
6662
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -6596,7 +6689,7 @@ All file and git operations should use this branch.
6596
6689
  if (!session) {
6597
6690
  return res.status(404).json({ error: "Session not found" });
6598
6691
  }
6599
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-2WVGUPYV.js");
6692
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-FT7HF7ZB.js");
6600
6693
  if (getSetting2(SETTINGS_KEYS.CACHE_WARMING) !== "true") {
6601
6694
  return res.json({ success: false, reason: "disabled" });
6602
6695
  }
@@ -6628,7 +6721,7 @@ All file and git operations should use this branch.
6628
6721
  backend: activeProvider?.backend ?? llmClient.getBackend(),
6629
6722
  model: llmClient.getModel()
6630
6723
  };
6631
- const { runAgentTurn, TurnMetrics } = await import("./orchestrator-DHBU7LRB.js");
6724
+ const { runAgentTurn, TurnMetrics } = await import("./orchestrator-QDXKDLOW.js");
6632
6725
  runAgentTurn(
6633
6726
  {
6634
6727
  sessionManager,
@@ -6666,15 +6759,15 @@ All file and git operations should use this branch.
6666
6759
  if (!session) {
6667
6760
  return res.status(404).json({ error: "Session not found" });
6668
6761
  }
6669
- const { stopSessionExecution } = await import("./chat-handler-YPWT4MAQ.js");
6670
- const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-X5FONL4Q.js");
6762
+ const { stopSessionExecution } = await import("./chat-handler-IBFSBSGV.js");
6763
+ const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-M5DKWCJJ.js");
6671
6764
  const queuedMessages = sessionManager.getQueueState(sessionId);
6672
6765
  sessionManager.clearMessageQueue(sessionId);
6673
6766
  stopSessionExecution(sessionId, sessionManager);
6674
6767
  abortSession(sessionId);
6675
6768
  cancelQuestionsForSession(sessionId, "Session stopped by user");
6676
6769
  cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
6677
- const eventStore = (await import("./events-4THEZWVL.js")).getEventStore();
6770
+ const eventStore = (await import("./events-RCC32JOA.js")).getEventStore();
6678
6771
  eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
6679
6772
  res.json({ success: true, queuedMessages });
6680
6773
  });
@@ -6688,7 +6781,7 @@ All file and git operations should use this branch.
6688
6781
  if (typeof messageIndex !== "number" || messageIndex < 0) {
6689
6782
  return res.status(400).json({ error: "messageIndex must be a non-negative number" });
6690
6783
  }
6691
- const { truncateSessionMessages } = await import("./events-4THEZWVL.js");
6784
+ const { truncateSessionMessages } = await import("./events-RCC32JOA.js");
6692
6785
  truncateSessionMessages(sessionId, messageIndex);
6693
6786
  res.json({ success: true });
6694
6787
  });
@@ -6705,8 +6798,8 @@ All file and git operations should use this branch.
6705
6798
  if (content !== void 0 && (typeof content !== "string" || !content.trim())) {
6706
6799
  return res.status(400).json({ error: "content must be a non-empty string if provided" });
6707
6800
  }
6708
- const { getEventStore: getEventStore2 } = await import("./events-4THEZWVL.js");
6709
- const { buildMessagesFromStoredEvents } = await import("./folding-OYBO2NTH.js");
6801
+ const { getEventStore: getEventStore2 } = await import("./events-RCC32JOA.js");
6802
+ const { buildMessagesFromStoredEvents } = await import("./folding-ZNUXPQUD.js");
6710
6803
  const eventStore = getEventStore2();
6711
6804
  const events = eventStore.getEvents(sessionId);
6712
6805
  const { messages } = buildMessagesFromStoredEvents(events);
@@ -6718,7 +6811,7 @@ All file and git operations should use this branch.
6718
6811
  if (msg.role !== "user" || msg.isSystemGenerated) {
6719
6812
  return res.status(400).json({ error: "Can only replay user messages" });
6720
6813
  }
6721
- const { truncateSessionMessages } = await import("./events-4THEZWVL.js");
6814
+ const { truncateSessionMessages } = await import("./events-RCC32JOA.js");
6722
6815
  truncateSessionMessages(sessionId, msgIndex - 1);
6723
6816
  sessionManager.queueMessage(sessionId, "asap", content ?? msg.content, msg.attachments, msg.messageKind);
6724
6817
  res.json({ success: true });
@@ -6774,7 +6867,7 @@ All file and git operations should use this branch.
6774
6867
  res.json({ accepted: true });
6775
6868
  });
6776
6869
  app.get("/api/settings", async (req, res) => {
6777
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-2WVGUPYV.js");
6870
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-FT7HF7ZB.js");
6778
6871
  const keysParam = req.query["keys"];
6779
6872
  if (!keysParam) {
6780
6873
  return res.status(400).json({ error: "keys query parameter is required" });
@@ -6787,19 +6880,19 @@ All file and git operations should use this branch.
6787
6880
  res.json(result);
6788
6881
  });
6789
6882
  app.get("/api/settings/:key", async (req, res) => {
6790
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-2WVGUPYV.js");
6883
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-FT7HF7ZB.js");
6791
6884
  const key = req.params.key;
6792
6885
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
6793
6886
  res.json({ key, value });
6794
6887
  });
6795
6888
  app.get("/api/settings/:key", async (req, res) => {
6796
- const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-2WVGUPYV.js");
6889
+ const { getSetting: getSetting2, SETTINGS_DEFAULTS } = await import("./settings-FT7HF7ZB.js");
6797
6890
  const key = req.params.key;
6798
6891
  const value = getSetting2(key) ?? SETTINGS_DEFAULTS[key] ?? null;
6799
6892
  res.json({ key, value });
6800
6893
  });
6801
6894
  app.put("/api/settings/:key", async (req, res) => {
6802
- const { setSetting: setSetting2 } = await import("./settings-2WVGUPYV.js");
6895
+ const { setSetting: setSetting2 } = await import("./settings-FT7HF7ZB.js");
6803
6896
  const key = req.params.key;
6804
6897
  const { value } = req.body;
6805
6898
  if (value === void 0) {
@@ -6826,7 +6919,7 @@ All file and git operations should use this branch.
6826
6919
  }
6827
6920
  });
6828
6921
  app.get("/api/tools/shells", async (_req, res) => {
6829
- const { listAvailableShells } = await import("./platform-7KXP3VVA.js");
6922
+ const { listAvailableShells } = await import("./platform-2RLL7RAE.js");
6830
6923
  res.json({ shells: listAvailableShells() });
6831
6924
  });
6832
6925
  app.get("/api/config", async (_req, res) => {
@@ -6916,7 +7009,7 @@ All file and git operations should use this branch.
6916
7009
  }));
6917
7010
  }
6918
7011
  app.post("/api/proxy/test", async (_req, res) => {
6919
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-2WVGUPYV.js");
7012
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-FT7HF7ZB.js");
6920
7013
  const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
6921
7014
  if (!proxyUrl) {
6922
7015
  return res.status(400).json({ success: false, error: "No proxy URL configured" });
@@ -7008,7 +7101,7 @@ All file and git operations should use this branch.
7008
7101
  }
7009
7102
  });
7010
7103
  app.post("/api/proxy/test", async (_req, res) => {
7011
- const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-2WVGUPYV.js");
7104
+ const { getSetting: getSetting2, SETTINGS_KEYS } = await import("./settings-FT7HF7ZB.js");
7012
7105
  const proxyUrl = getSetting2(SETTINGS_KEYS.PROXY_URL);
7013
7106
  if (!proxyUrl) {
7014
7107
  return res.status(400).json({ success: false, error: "No proxy URL configured" });
@@ -7035,7 +7128,7 @@ All file and git operations should use this branch.
7035
7128
  const backend = req.query["backend"];
7036
7129
  if (!url) return res.status(400).json({ error: "url is required" });
7037
7130
  try {
7038
- const { fetchModelsWithContext } = await import("./provider-manager-EJGPSLOZ.js");
7131
+ const { fetchModelsWithContext } = await import("./provider-manager-GLG6BA32.js");
7039
7132
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
7040
7133
  const models = await fetchModelsWithContext(
7041
7134
  url,
@@ -7105,8 +7198,8 @@ All file and git operations should use this branch.
7105
7198
  }
7106
7199
  const { getModelProfile: getModelProfile2 } = await import("./profiles-5J7F4BML.js");
7107
7200
  const { getBackendCapabilities } = await import("./backend-P3GHHLHJ.js");
7108
- const { buildNonStreamingCreateParams } = await import("./client-pure-DCEZBFKW.js");
7109
- const { OpenAIHttpClient } = await import("./http-client-U6DVFL7F.js");
7201
+ const { buildNonStreamingCreateParams } = await import("./client-pure-ONSVWEG5.js");
7202
+ const { OpenAIHttpClient } = await import("./http-client-WGNBG7PC.js");
7110
7203
  const { ensureVersionPrefix } = await import("./url-utils-SAJP7AEX.js");
7111
7204
  const profile = getModelProfile2(model);
7112
7205
  const capabilities = getBackendCapabilities(backend || "unknown");
@@ -7455,10 +7548,11 @@ All file and git operations should use this branch.
7455
7548
  });
7456
7549
  });
7457
7550
  async function rebuildMcpTools() {
7458
- const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-MOGEI6TP.js");
7459
- const { setMcpTools: setMcpTools2 } = await import("./tools-X5FONL4Q.js");
7551
+ const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-FEAHWU5C.js");
7552
+ const { setMcpTools: setMcpTools2 } = await import("./tools-M5DKWCJJ.js");
7460
7553
  const mcpTools = createMcpTools2(mcpManager);
7461
7554
  setMcpTools2(mcpTools);
7555
+ toolRegistry = createToolRegistry();
7462
7556
  }
7463
7557
  app.get("/api/mcp/servers", (_req, res) => {
7464
7558
  const servers = mcpManager.getAllServers();
@@ -7689,7 +7783,11 @@ All file and git operations should use this branch.
7689
7783
  res.status(400).json({ error: error instanceof Error ? error.message : String(error) });
7690
7784
  }
7691
7785
  });
7692
- const projectDir = config3.workdir;
7786
+ const { listProjects } = await import("./projects-M5XKC7O6.js");
7787
+ const allProjects = listProjects();
7788
+ const projectDir = allProjects.find(
7789
+ (p) => p.workdir === config3.workdir || config3.workdir && p.workdir.startsWith(config3.workdir + "/")
7790
+ )?.workdir ?? config3.workdir;
7693
7791
  app.use("/api/skills", createSkillRoutes(configDir, projectDir));
7694
7792
  app.use("/api/commands", createCommandRoutes(configDir, projectDir));
7695
7793
  app.use("/api/agents", createAgentRoutes(configDir, projectDir));
@@ -7712,13 +7810,13 @@ All file and git operations should use this branch.
7712
7810
  })
7713
7811
  );
7714
7812
  app.get("/api/sessions/:id/background-processes", async (req, res) => {
7715
- const { getSessionProcesses } = await import("./manager-53J5P4EZ.js");
7813
+ const { getSessionProcesses } = await import("./manager-HFGJLW7Q.js");
7716
7814
  const sessionId = req.params.id;
7717
7815
  const processes = getSessionProcesses(sessionId);
7718
7816
  res.json({ processes });
7719
7817
  });
7720
7818
  app.post("/api/sessions/:id/background-process/:processId/stop", async (req, res) => {
7721
- const { stopProcess } = await import("./manager-53J5P4EZ.js");
7819
+ const { stopProcess } = await import("./manager-HFGJLW7Q.js");
7722
7820
  const sessionId = req.params.id;
7723
7821
  const processId = req.params.processId;
7724
7822
  const session = sessionManager.getSession(sessionId);
@@ -7863,7 +7961,7 @@ All file and git operations should use this branch.
7863
7961
  const state = sessionManager.getContextState(sessionId);
7864
7962
  wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
7865
7963
  });
7866
- const { QueueProcessor } = await import("./processor-RC3IBY2J.js");
7964
+ const { QueueProcessor } = await import("./processor-YWNLWAZW.js");
7867
7965
  const queueProcessor = new QueueProcessor({
7868
7966
  sessionManager,
7869
7967
  providerManager,
@@ -7947,4 +8045,4 @@ export {
7947
8045
  createServerHandle,
7948
8046
  createServer
7949
8047
  };
7950
- //# sourceMappingURL=chunk-7GBFQ2PE.js.map
8048
+ //# sourceMappingURL=chunk-6ZV3NYEE.js.map