openfox 2.0.119 → 2.0.121

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 (87) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/CHANGELOG.md +27 -0
  3. package/dist/agent-defaults/code-reviewer.agent.md +3 -8
  4. package/dist/{chat-handler-M54IWF5Y.js → chat-handler-A5ORR5BB.js} +28 -29
  5. package/dist/{chunk-LNNBLB6G.js → chunk-2N7KFNMY.js} +3 -3
  6. package/dist/{chunk-XZGQZ42D.js → chunk-5A4YN6I7.js} +5 -5
  7. package/dist/{chunk-UNNCD7A3.js → chunk-5QTERLHH.js} +6 -6
  8. package/dist/{chunk-SE62ZBNX.js → chunk-62GUO2EG.js} +6 -4
  9. package/dist/{chunk-YHAE2SJI.js → chunk-6A2VIV36.js} +4 -4
  10. package/dist/{chunk-VUQCQXXJ.js → chunk-7OHXF5GW.js} +6 -3
  11. package/dist/{chunk-3PG65AXG.js → chunk-DIALH34K.js} +2 -2
  12. package/dist/{chunk-AESOGRFK.js → chunk-EZ67GBEO.js} +2 -2
  13. package/dist/{chunk-AIFZNTUJ.js → chunk-F2IM5J4I.js} +4 -4
  14. package/dist/{chunk-HD6Y77RO.js → chunk-FGVMRFDW.js} +2 -2
  15. package/dist/{chunk-W7VIYHPQ.js → chunk-GJL3QSMP.js} +3 -2
  16. package/dist/{chunk-ZTOG6LJD.js → chunk-I22B6KWV.js} +3 -3
  17. package/dist/{chunk-JOCR4CF4.js → chunk-J3IJJ55E.js} +5 -5
  18. package/dist/{chunk-J6KFWVZ3.js → chunk-J77SLE3M.js} +3 -3
  19. package/dist/{chunk-XZ2WAI66.js → chunk-KD7JTG42.js} +237 -199
  20. package/dist/{chunk-2FCLCUVR.js → chunk-LSEHJ2WI.js} +3 -3
  21. package/dist/{chunk-3KBRMBTP.js → chunk-LWXLNE6M.js} +2 -2
  22. package/dist/{chunk-5PT4UMRR.js → chunk-NYQKSKDB.js} +9 -1
  23. package/dist/{chunk-5FAPM2GM.js → chunk-O63CDVNI.js} +4 -4
  24. package/dist/chunk-OBB3JYMK.js +7 -0
  25. package/dist/{chunk-M6X6AIEG.js → chunk-OXANSWVZ.js} +2 -2
  26. package/dist/{chunk-LTYL6ZGH.js → chunk-POTCPZJF.js} +2 -2
  27. package/dist/{chunk-O6DU226D.js → chunk-RMOKNQAS.js} +2 -2
  28. package/dist/{chunk-KLQEL2DZ.js → chunk-SLW3KKPP.js} +26 -8
  29. package/dist/{chunk-V5XWUVF5.js → chunk-TR4DQZIG.js} +123 -49
  30. package/dist/{chunk-U6JMRMBW.js → chunk-UJRWYZHM.js} +9 -3
  31. package/dist/{chunk-6DDB67FN.js → chunk-VUANU5A5.js} +17 -17
  32. package/dist/{chunk-AVQCOSOF.js → chunk-W3WZ54KP.js} +16 -16
  33. package/dist/{chunk-27NABDXB.js → chunk-Y7FGHKBW.js} +2 -2
  34. package/dist/{chunk-EQ5CGNOT.js → chunk-YBOU4ZFD.js} +3 -3
  35. package/dist/{chunk-VFS7TFA7.js → chunk-YDDBPKVP.js} +21 -16
  36. package/dist/{chunk-XB7IXMUI.js → chunk-ZELEYSTY.js} +51 -46
  37. package/dist/cli/dev.js +1 -1
  38. package/dist/cli/index.js +1 -1
  39. package/dist/{client-R4PI64IL.js → client-JKPDMJ7S.js} +6 -6
  40. package/dist/{compactor-F6XMYVHL.js → compactor-MKD3CAFM.js} +13 -13
  41. package/dist/{dynamic-context-NXQ2TFAZ.js → dynamic-context-KPZECHZH.js} +9 -9
  42. package/dist/{events-KDFMBVP5.js → events-6P4TDTSD.js} +8 -8
  43. package/dist/{folding-RTGU63BW.js → folding-3LA2WX2B.js} +6 -6
  44. package/dist/http-client-IKOARXI7.js +11 -0
  45. package/dist/{inspect-proxy-WPEDMCG7.js → inspect-proxy-IDLUAQH5.js} +4 -4
  46. package/dist/launch-YWXQQWZN.js +52 -0
  47. package/dist/{manager-EMLSLMMT.js → manager-NFKTUR64.js} +5 -5
  48. package/dist/{orchestrator-MNON5G7R.js → orchestrator-SM3IHZFP.js} +31 -32
  49. package/dist/package.json +1 -1
  50. package/dist/{path-security-L4AJJN2V.js → path-security-JUF56IB6.js} +10 -10
  51. package/dist/{platform-ECDDYMAR.js → platform-FM57ZJHA.js} +4 -4
  52. package/dist/{processor-OZSK7RUD.js → processor-EUJRA5GW.js} +40 -41
  53. package/dist/{profiles-GYHXBWPV.js → profiles-3YLLEJ2B.js} +2 -2
  54. package/dist/{project-creator-PMQ65NKN.js → project-creator-J4ITWDZI.js} +3 -3
  55. package/dist/{projects-NDPNOV6D.js → projects-FHRTSV6N.js} +3 -3
  56. package/dist/{protocol-D5kJLGWy.d.ts → protocol-BLin669D.d.ts} +1 -1
  57. package/dist/provider/index.d.ts +4 -4
  58. package/dist/{provider-7YF42S7C.js → provider-TAFJCWVP.js} +7 -7
  59. package/dist/{provider-manager-FJIPQJMX.js → provider-manager-EDJN6ARI.js} +7 -7
  60. package/dist/{registry-5QL3BOWN.js → registry-37GL3DAP.js} +5 -5
  61. package/dist/{serve-V34QG72C.js → serve-DEY45HQS.js} +32 -33
  62. package/dist/server/index.d.ts +40 -8
  63. package/dist/server/index.js +31 -32
  64. package/dist/server-EIRLWSBZ.js +55 -0
  65. package/dist/{service-ZKH465DA.js → service-HX5NFX2D.js} +9 -9
  66. package/dist/{session-overrides-CWBKPHMF.js → session-overrides-EOKSZO2X.js} +7 -7
  67. package/dist/{sessions-I7ELDIIP.js → sessions-XFNU4DZ6.js} +8 -6
  68. package/dist/{settings-FGXQHKUH.js → settings-SYYDPV43.js} +3 -3
  69. package/dist/shared/index.d.ts +6 -5
  70. package/dist/shared/index.js +1 -1
  71. package/dist/{tasks-I766NBPW.js → tasks-A25JQ4TV.js} +9 -9
  72. package/dist/{tools-ZJXDZLRH.js → tools-YGJXEEBI.js} +23 -24
  73. package/dist/{types-B5CI_Ql3.d.ts → types-B5_9KtfJ.d.ts} +1 -1
  74. package/dist/{types-CZlj7ufS.d.ts → types-DeQIEC1U.d.ts} +2 -0
  75. package/dist/{update-C3YVPKCR.js → update-CE3XSZXE.js} +2 -2
  76. package/dist/web/assets/{index-BlYcAqzD.js → index-oiZlWLY7.js} +84 -84
  77. package/dist/web/index.html +1 -1
  78. package/dist/web/sw.js +1 -1
  79. package/dist/workflow-defaults/default.workflow.json +3 -3
  80. package/dist/{workspace-IQLLHMYR.js → workspace-ZNZFEONU.js} +4 -4
  81. package/package.json +1 -1
  82. package/dist/chunk-EW25UQG3.js +0 -7
  83. package/dist/chunk-JLAR2CMV.js +0 -72
  84. package/dist/http-client-IPUW2MSW.js +0 -11
  85. package/dist/launch-I5XBYRSJ.js +0 -53
  86. package/dist/model-overrides-7F2EOA4U.js +0 -21
  87. package/dist/server-XZQLWIVD.js +0 -56
@@ -5,13 +5,13 @@ import {
5
5
  } from "./chunk-OSXPQSLW.js";
6
6
  import {
7
7
  getProject
8
- } from "./chunk-3PG65AXG.js";
8
+ } from "./chunk-DIALH34K.js";
9
9
  import {
10
10
  SETTINGS_KEYS,
11
11
  deleteSetting,
12
12
  getSetting,
13
13
  setSetting
14
- } from "./chunk-HD6Y77RO.js";
14
+ } from "./chunk-FGVMRFDW.js";
15
15
 
16
16
  // src/server/context/instructions.ts
17
17
  import { readFile, access } from "fs/promises";
@@ -440,4 +440,4 @@ export {
440
440
  deleteSkill,
441
441
  deleteProjectSkill
442
442
  };
443
- //# sourceMappingURL=chunk-2FCLCUVR.js.map
443
+ //# sourceMappingURL=chunk-LSEHJ2WI.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-LCLH6ZUL.js";
4
4
  import {
5
5
  resolveDefaultAgentId
6
- } from "./chunk-LNNBLB6G.js";
6
+ } from "./chunk-2N7KFNMY.js";
7
7
 
8
8
  // src/server/events/apply-events.ts
9
9
  function markComplete(msg, reason) {
@@ -965,4 +965,4 @@ export {
965
965
  buildSnapshot,
966
966
  buildSnapshotFromSessionState
967
967
  };
968
- //# sourceMappingURL=chunk-3KBRMBTP.js.map
968
+ //# sourceMappingURL=chunk-LWXLNE6M.js.map
@@ -156,6 +156,14 @@ function runMigrations(db2) {
156
156
  logger.info("Migrating sessions table: adding provider_model column");
157
157
  db2.exec(`ALTER TABLE sessions ADD COLUMN provider_model TEXT`);
158
158
  }
159
+ if (!columnNames.includes("provider_manual")) {
160
+ logger.info("Migrating sessions table: adding provider_manual column");
161
+ db2.exec(`ALTER TABLE sessions ADD COLUMN provider_manual INTEGER NOT NULL DEFAULT 0`);
162
+ }
163
+ if (!columnNames.includes("provider_manual_active")) {
164
+ logger.info("Migrating sessions table: adding provider_manual_active column");
165
+ db2.exec(`ALTER TABLE sessions ADD COLUMN provider_manual_active INTEGER NOT NULL DEFAULT 1`);
166
+ }
159
167
  if (!columnNames.includes("message_count")) {
160
168
  logger.info("Migrating sessions table: adding message_count column");
161
169
  db2.exec(`ALTER TABLE sessions ADD COLUMN message_count INTEGER NOT NULL DEFAULT 0`);
@@ -324,4 +332,4 @@ export {
324
332
  initDatabase,
325
333
  getDatabase
326
334
  };
327
- //# sourceMappingURL=chunk-5PT4UMRR.js.map
335
+ //# sourceMappingURL=chunk-NYQKSKDB.js.map
@@ -8,13 +8,13 @@ import {
8
8
  } from "./chunk-OSXPQSLW.js";
9
9
  import {
10
10
  getProject
11
- } from "./chunk-3PG65AXG.js";
11
+ } from "./chunk-DIALH34K.js";
12
12
  import {
13
13
  parseDefaultModelSelection
14
- } from "./chunk-U6JMRMBW.js";
14
+ } from "./chunk-UJRWYZHM.js";
15
15
  import {
16
16
  getDatabase
17
- } from "./chunk-5PT4UMRR.js";
17
+ } from "./chunk-NYQKSKDB.js";
18
18
  import {
19
19
  logger
20
20
  } from "./chunk-K44MW7JJ.js";
@@ -1098,4 +1098,4 @@ export {
1098
1098
  isTaskGateError,
1099
1099
  createTasksService
1100
1100
  };
1101
- //# sourceMappingURL=chunk-5FAPM2GM.js.map
1101
+ //# sourceMappingURL=chunk-O63CDVNI.js.map
@@ -0,0 +1,7 @@
1
+ // src/constants.ts
2
+ var VERSION = "2.0.121";
3
+
4
+ export {
5
+ VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-OBB3JYMK.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getProjectByWorkdir
3
- } from "./chunk-3PG65AXG.js";
3
+ } from "./chunk-DIALH34K.js";
4
4
  import {
5
5
  logger
6
6
  } from "./chunk-K44MW7JJ.js";
@@ -345,4 +345,4 @@ export {
345
345
  startInspectProxy,
346
346
  stopAllInspectProxies
347
347
  };
348
- //# sourceMappingURL=chunk-M6X6AIEG.js.map
348
+ //# sourceMappingURL=chunk-OXANSWVZ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SETTINGS_KEYS,
3
3
  getSetting
4
- } from "./chunk-HD6Y77RO.js";
4
+ } from "./chunk-FGVMRFDW.js";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-K44MW7JJ.js";
@@ -164,4 +164,4 @@ export {
164
164
  WorkspaceInUseError,
165
165
  OpenAIHttpClient
166
166
  };
167
- //# sourceMappingURL=chunk-LTYL6ZGH.js.map
167
+ //# sourceMappingURL=chunk-POTCPZJF.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getProjectByWorkdir,
6
6
  updateProject
7
- } from "./chunk-3PG65AXG.js";
7
+ } from "./chunk-DIALH34K.js";
8
8
  import {
9
9
  logger
10
10
  } from "./chunk-K44MW7JJ.js";
@@ -333,4 +333,4 @@ export {
333
333
  deleteWorkspace,
334
334
  isGitRepository
335
335
  };
336
- //# sourceMappingURL=chunk-O6DU226D.js.map
336
+ //# sourceMappingURL=chunk-RMOKNQAS.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolveDefaultAgentId
3
- } from "./chunk-LNNBLB6G.js";
3
+ } from "./chunk-2N7KFNMY.js";
4
4
  import {
5
5
  getDatabase
6
- } from "./chunk-5PT4UMRR.js";
6
+ } from "./chunk-NYQKSKDB.js";
7
7
 
8
8
  // src/server/db/sessions.ts
9
9
  function getProjectDangerLevel(projectId) {
@@ -51,6 +51,8 @@ function createSession(projectId, workdir, title, providerId, providerModel, wor
51
51
  isRunning: false,
52
52
  providerId: providerId ?? null,
53
53
  providerModel: providerModel ?? null,
54
+ providerManual: false,
55
+ providerManualActive: true,
54
56
  createdAt: now,
55
57
  updatedAt: now,
56
58
  messages: [],
@@ -94,14 +96,27 @@ function getSession(id) {
94
96
  dangerLevel: row.danger_level ?? "normal"
95
97
  };
96
98
  }
97
- function updateSessionProvider(id, providerId, providerModel) {
99
+ function updateSessionProvider(id, providerId, providerModel, providerManual) {
98
100
  const db = getDatabase();
99
101
  const now = (/* @__PURE__ */ new Date()).toISOString();
100
- db.prepare(
102
+ if (providerManual !== void 0) {
103
+ db.prepare(
104
+ `
105
+ UPDATE sessions SET provider_id = ?, provider_model = ?, provider_manual = ?, updated_at = ? WHERE id = ?
101
106
  `
102
- UPDATE sessions SET provider_id = ?, provider_model = ?, updated_at = ? WHERE id = ?
103
- `
104
- ).run(providerId, providerModel, now, id);
107
+ ).run(providerId, providerModel, providerManual ? 1 : 0, now, id);
108
+ } else {
109
+ db.prepare(
110
+ `
111
+ UPDATE sessions SET provider_id = ?, provider_model = ?, updated_at = ? WHERE id = ?
112
+ `
113
+ ).run(providerId, providerModel, now, id);
114
+ }
115
+ }
116
+ function updateSessionProviderActive(id, active) {
117
+ const db = getDatabase();
118
+ const now = (/* @__PURE__ */ new Date()).toISOString();
119
+ db.prepare("UPDATE sessions SET provider_manual_active = ?, updated_at = ? WHERE id = ?").run(active ? 1 : 0, now, id);
105
120
  }
106
121
  function updateSessionMode(id, mode) {
107
122
  const db = getDatabase();
@@ -344,6 +359,8 @@ function mapSessionBase(row) {
344
359
  isRunning: Boolean(row.is_running),
345
360
  providerId: row.provider_id ?? null,
346
361
  providerModel: row.provider_model ?? null,
362
+ providerManual: Boolean(row.provider_manual),
363
+ providerManualActive: Boolean(row.provider_manual_active),
347
364
  createdAt: row.created_at,
348
365
  updatedAt: row.updated_at
349
366
  };
@@ -411,6 +428,7 @@ export {
411
428
  createSession,
412
429
  getSession,
413
430
  updateSessionProvider,
431
+ updateSessionProviderActive,
414
432
  updateSessionMode,
415
433
  updateSessionDangerLevel,
416
434
  updateSessionPhase,
@@ -435,4 +453,4 @@ export {
435
453
  getLatestWorkflowExecution,
436
454
  clearWorkflowExecution
437
455
  };
438
- //# sourceMappingURL=chunk-KLQEL2DZ.js.map
456
+ //# sourceMappingURL=chunk-SLW3KKPP.js.map
@@ -4,29 +4,10 @@ import {
4
4
  getEnabledSkillMetadata,
5
5
  isSkillEnabled,
6
6
  loadAllSkills
7
- } from "./chunk-2FCLCUVR.js";
8
- import {
9
- TurnMetrics,
10
- clearLLMFailure,
11
- consumeStreamGenerator,
12
- createChatDoneEvent,
13
- createMessageDoneEvent,
14
- createMessageStartEvent,
15
- createToolCallEvent,
16
- createToolResultEvent,
17
- evaluateLLMRetry,
18
- recordLLMFailure,
19
- sleepThroughRetryBackoff,
20
- streamLLMPure
21
- } from "./chunk-SE62ZBNX.js";
22
- import {
23
- COMPACTION_PROMPT,
24
- buildBasePrompt,
25
- computeEffectiveTools
26
- } from "./chunk-27NABDXB.js";
7
+ } from "./chunk-LSEHJ2WI.js";
27
8
  import {
28
9
  startInspectProxy
29
- } from "./chunk-M6X6AIEG.js";
10
+ } from "./chunk-OXANSWVZ.js";
30
11
  import {
31
12
  checkAborted,
32
13
  createProcess,
@@ -40,7 +21,7 @@ import {
40
21
  spawnShellProcess,
41
22
  startProcessCommand,
42
23
  stopProcess
43
- } from "./chunk-ZTOG6LJD.js";
24
+ } from "./chunk-I22B6KWV.js";
44
25
  import {
45
26
  getMaxPerSession,
46
27
  getSessionProcessCount,
@@ -56,27 +37,22 @@ import {
56
37
  getGitBranch,
57
38
  isGitRepository,
58
39
  listWorkspaces
59
- } from "./chunk-O6DU226D.js";
40
+ } from "./chunk-RMOKNQAS.js";
60
41
  import {
61
42
  getGateConfig,
62
43
  isTaskConflictError,
63
44
  isTaskGateError
64
- } from "./chunk-5FAPM2GM.js";
45
+ } from "./chunk-O63CDVNI.js";
65
46
  import {
66
47
  getSessionDisabledServers
67
- } from "./chunk-EQ5CGNOT.js";
48
+ } from "./chunk-YBOU4ZFD.js";
68
49
  import {
69
50
  PathAccessDeniedError,
70
51
  extractAbsolutePathsFromCommand,
71
52
  extractSensitivePathsFromCommand,
72
53
  registerPathConfirmation,
73
54
  requestPathAccess
74
- } from "./chunk-XZGQZ42D.js";
75
- import {
76
- getCurrentContextWindowId,
77
- getCurrentWindowMessageOptions,
78
- getEventStore
79
- } from "./chunk-JOCR4CF4.js";
55
+ } from "./chunk-5A4YN6I7.js";
80
56
  import {
81
57
  createChatDoneMessage,
82
58
  createChatLLMRetryFailedMessage,
@@ -91,8 +67,29 @@ import {
91
67
  askUserTool
92
68
  } from "./chunk-JURM3RPZ.js";
93
69
  import {
94
- resolveLLMClientForAgent
95
- } from "./chunk-JLAR2CMV.js";
70
+ TurnMetrics,
71
+ clearLLMFailure,
72
+ consumeStreamGenerator,
73
+ createChatDoneEvent,
74
+ createMessageDoneEvent,
75
+ createMessageStartEvent,
76
+ createToolCallEvent,
77
+ createToolResultEvent,
78
+ evaluateLLMRetry,
79
+ recordLLMFailure,
80
+ sleepThroughRetryBackoff,
81
+ streamLLMPure
82
+ } from "./chunk-62GUO2EG.js";
83
+ import {
84
+ COMPACTION_PROMPT,
85
+ buildBasePrompt,
86
+ computeEffectiveTools
87
+ } from "./chunk-Y7FGHKBW.js";
88
+ import {
89
+ getCurrentContextWindowId,
90
+ getCurrentWindowMessageOptions,
91
+ getEventStore
92
+ } from "./chunk-J3IJJ55E.js";
96
93
  import {
97
94
  buildContextMessagesFromEventHistory,
98
95
  foldContextState,
@@ -102,16 +99,16 @@ import {
102
99
  handleToolResult,
103
100
  reorderToolMessages,
104
101
  stripOrphanedToolCalls
105
- } from "./chunk-3KBRMBTP.js";
102
+ } from "./chunk-LWXLNE6M.js";
106
103
  import {
107
104
  findAgentById,
108
105
  getRuntimeConfig,
109
106
  getSubAgents,
110
107
  loadAllAgentsDefault
111
- } from "./chunk-LNNBLB6G.js";
108
+ } from "./chunk-2N7KFNMY.js";
112
109
  import {
113
110
  modelSupportsVision
114
- } from "./chunk-W7VIYHPQ.js";
111
+ } from "./chunk-GJL3QSMP.js";
115
112
  import {
116
113
  OUTPUT_LIMITS,
117
114
  cacheSet,
@@ -125,8 +122,9 @@ import {
125
122
  } from "./chunk-MIPQOHWS.js";
126
123
  import {
127
124
  SETTINGS_KEYS,
128
- getSetting
129
- } from "./chunk-HD6Y77RO.js";
125
+ getSetting,
126
+ setSetting
127
+ } from "./chunk-FGVMRFDW.js";
130
128
  import {
131
129
  logger
132
130
  } from "./chunk-K44MW7JJ.js";
@@ -150,7 +148,7 @@ async function requestUserConfirmation(context, toolLabel, desc) {
150
148
  if (context.dangerLevel === "dangerous") return Promise.resolve(true);
151
149
  if (toolLabel === "workspace" || toolLabel === "command") {
152
150
  try {
153
- const { getSetting: getSetting2, SETTINGS_KEYS: SETTINGS_KEYS2 } = await import("./settings-FGXQHKUH.js");
151
+ const { getSetting: getSetting2, SETTINGS_KEYS: SETTINGS_KEYS2 } = await import("./settings-SYYDPV43.js");
154
152
  if (getSetting2(SETTINGS_KEYS2.CONFIRM_ON_WORKSPACE_ACTIONS) !== "true") {
155
153
  return Promise.resolve(true);
156
154
  }
@@ -1528,6 +1526,63 @@ ${Object.entries(schema.fields).map(([f, t]) => ` ${f}: ${t}`).join("\n")}`
1528
1526
  import { readFile as readFile4, access as access2 } from "fs/promises";
1529
1527
  import { join as join2, dirname as dirname2, isAbsolute as isAbsolute2 } from "path";
1530
1528
 
1529
+ // src/server/agents/model-overrides.ts
1530
+ import { z } from "zod";
1531
+ var AGENT_MODEL_OVERRIDES_KEY = SETTINGS_KEYS.AGENT_MODEL_OVERRIDES;
1532
+ var overrideSchema = z.object({
1533
+ providerId: z.string().min(1),
1534
+ model: z.string().min(1)
1535
+ });
1536
+ function parseAgentModelOverrides(raw) {
1537
+ if (!raw) return {};
1538
+ let parsed;
1539
+ try {
1540
+ parsed = JSON.parse(raw);
1541
+ } catch {
1542
+ return {};
1543
+ }
1544
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return {};
1545
+ const result = {};
1546
+ for (const [agentId, value] of Object.entries(parsed)) {
1547
+ const validated = overrideSchema.safeParse(value);
1548
+ if (validated.success) {
1549
+ result[agentId] = validated.data;
1550
+ }
1551
+ }
1552
+ return result;
1553
+ }
1554
+ function getAgentModelOverrides() {
1555
+ return parseAgentModelOverrides(getSetting(AGENT_MODEL_OVERRIDES_KEY));
1556
+ }
1557
+ function getAgentModelOverride(agentId) {
1558
+ return getAgentModelOverrides()[agentId];
1559
+ }
1560
+ function setAgentModelOverride(agentId, override) {
1561
+ const overrides = getAgentModelOverrides();
1562
+ if (override === null) {
1563
+ delete overrides[agentId];
1564
+ } else {
1565
+ overrides[agentId] = override;
1566
+ }
1567
+ setSetting(AGENT_MODEL_OVERRIDES_KEY, JSON.stringify(overrides));
1568
+ }
1569
+ function resolveLLMClientForAgent(agentId, fallbackClient, providerManager) {
1570
+ const override = getAgentModelOverride(agentId);
1571
+ if (!override) {
1572
+ return { client: fallbackClient, usedOverride: false };
1573
+ }
1574
+ const client = providerManager.createClient(override.providerId, override.model);
1575
+ if (!client) {
1576
+ return {
1577
+ client: fallbackClient,
1578
+ usedOverride: false,
1579
+ override,
1580
+ warning: `Agent '${agentId}' is configured to use model '${override.model}' from provider '${override.providerId}', but it is no longer available. Falling back to the session model.`
1581
+ };
1582
+ }
1583
+ return { client, usedOverride: true, override };
1584
+ }
1585
+
1531
1586
  // src/server/chat/tool-streaming.ts
1532
1587
  function parseProgressMessage(message) {
1533
1588
  const match = message.match(/^\[(stdout|stderr)\] (.*)$/s);
@@ -1839,7 +1894,7 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
1839
1894
  ...instructionContent2 ? { customInstructions: instructionContent2 } : {},
1840
1895
  ...skills.length > 0 ? { skills } : {}
1841
1896
  });
1842
- const modelSettings = sessionManager.getCurrentModelSettings(sessionId);
1897
+ const modelSettings = sessionManager.getCurrentModelSettings(sessionId, config.mode);
1843
1898
  await resolveClient().complete({
1844
1899
  messages: [{ role: "system", content: assembledRequest.systemPrompt }],
1845
1900
  tools: assembledRequest.tools,
@@ -1916,9 +1971,9 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
1916
1971
  };
1917
1972
  const contextState = sessionManager.getContextState(sessionId);
1918
1973
  previousContextTokens = contextState.currentTokens;
1919
- const contextWindow = sessionManager.getCurrentModelContext();
1974
+ const contextWindow = sessionManager.getCurrentModelContext(sessionId, config.mode);
1920
1975
  const availableForOutput = Math.max(256, contextWindow - contextState.currentTokens - OUTPUT_RESERVE_TOKENS);
1921
- let modelSettings = config.modelSettings ?? (currentMaxTokensOverride !== void 0 ? { ...sessionManager.getCurrentModelSettings(sessionId), maxTokens: currentMaxTokensOverride } : sessionManager.getCurrentModelSettings(sessionId));
1976
+ let modelSettings = config.modelSettings ?? (currentMaxTokensOverride !== void 0 ? { ...sessionManager.getCurrentModelSettings(sessionId, config.mode), maxTokens: currentMaxTokensOverride } : sessionManager.getCurrentModelSettings(sessionId, config.mode));
1922
1977
  if (modelSettings) {
1923
1978
  const requestedMaxTokens = modelSettings.maxTokens ?? 16384;
1924
1979
  modelSettings = { ...modelSettings, maxTokens: Math.min(requestedMaxTokens, availableForOutput) };
@@ -2040,11 +2095,11 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
2040
2095
  );
2041
2096
  if (!compacting) {
2042
2097
  const contextState = sessionManager.getContextState(sessionId);
2043
- const { shouldCompact, appendCompactionPrompt } = await import("./compactor-F6XMYVHL.js");
2098
+ const { shouldCompact, appendCompactionPrompt } = await import("./compactor-MKD3CAFM.js");
2044
2099
  if (shouldCompact(
2045
2100
  contextState.currentTokens,
2046
2101
  contextState.maxTokens,
2047
- sessionManager.getModelCompactionThreshold(sessionId) ?? runtimeConfig.context.compactionThreshold
2102
+ sessionManager.getModelCompactionThreshold(sessionId, config.mode) ?? runtimeConfig.context.compactionThreshold
2048
2103
  )) {
2049
2104
  appendCompactionPrompt(sessionId, append);
2050
2105
  compacting = true;
@@ -2056,10 +2111,10 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
2056
2111
  truncationRetryCount += 1;
2057
2112
  const currentMaxTokens = result.modelParams?.maxTokens ?? 16384;
2058
2113
  const promptTokens = result.usage.promptTokens;
2059
- const contextWindow = sessionManager.getCurrentModelContext();
2114
+ const contextWindow = sessionManager.getCurrentModelContext(sessionId, config.mode);
2060
2115
  const newMaxTokens = Math.min(
2061
2116
  Math.floor(currentMaxTokens * 1.5),
2062
- contextWindow - promptTokens - OUTPUT_RESERVE_TOKENS
2117
+ Math.max(256, contextWindow - promptTokens - OUTPUT_RESERVE_TOKENS)
2063
2118
  );
2064
2119
  currentMaxTokensOverride = newMaxTokens;
2065
2120
  const interimStats = turnMetrics.buildStats(statsIdentity, mode);
@@ -2864,6 +2919,21 @@ async function executeSubAgent(options) {
2864
2919
  })
2865
2920
  );
2866
2921
  }
2922
+ } else {
2923
+ const effective = sessionManager.resolveEffectiveProviderModel(sessionId, subAgentType);
2924
+ if (effective.providerId && effective.model) {
2925
+ const effectiveClient = providerManager.createClient(effective.providerId, effective.model);
2926
+ if (effectiveClient) {
2927
+ llmClient = effectiveClient;
2928
+ const provider = providerManager.getProviders().find((p) => p.id === effective.providerId);
2929
+ statsIdentity = {
2930
+ providerId: effective.providerId,
2931
+ providerName: provider?.name ?? effective.providerId,
2932
+ backend: provider?.backend ?? effectiveClient.getBackend(),
2933
+ model: effective.model
2934
+ };
2935
+ }
2936
+ }
2867
2937
  }
2868
2938
  }
2869
2939
  logger.debug("Sub-agent starting", { subAgentType, subAgentId, sessionId });
@@ -3033,7 +3103,7 @@ var callSubAgentTool = {
3033
3103
  };
3034
3104
  }
3035
3105
  try {
3036
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-ZJXDZLRH.js");
3106
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-YGJXEEBI.js");
3037
3107
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3038
3108
  const turnMetrics = new TurnMetrics();
3039
3109
  const result = await executeSubAgent({
@@ -4055,7 +4125,7 @@ var mcpConfigTool = createTool(
4055
4125
  mcpNotifyChanged?.(sessionId);
4056
4126
  }
4057
4127
  async function rebuildTools() {
4058
- const { setMcpTools: setMcpTools2 } = await import("./tools-ZJXDZLRH.js");
4128
+ const { setMcpTools: setMcpTools2 } = await import("./tools-YGJXEEBI.js");
4059
4129
  const mcpTools = createMcpTools(mcpManagerForTools);
4060
4130
  setMcpTools2(mcpTools);
4061
4131
  }
@@ -4917,6 +4987,10 @@ function createToolRegistry() {
4917
4987
  }
4918
4988
 
4919
4989
  export {
4990
+ getAgentModelOverrides,
4991
+ getAgentModelOverride,
4992
+ setAgentModelOverride,
4993
+ resolveLLMClientForAgent,
4920
4994
  runTopLevelAgentLoop,
4921
4995
  createAssemblyResult,
4922
4996
  getConversationMessages,
@@ -4939,4 +5013,4 @@ export {
4939
5013
  getToolRegistryForAgent,
4940
5014
  createToolRegistry
4941
5015
  };
4942
- //# sourceMappingURL=chunk-V5XWUVF5.js.map
5016
+ //# sourceMappingURL=chunk-TR4DQZIG.js.map
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-K2QKX4ZJ.js";
4
4
  import {
5
5
  createLLMClient
6
- } from "./chunk-J6KFWVZ3.js";
6
+ } from "./chunk-J77SLE3M.js";
7
7
  import {
8
8
  getModelProfile
9
- } from "./chunk-W7VIYHPQ.js";
9
+ } from "./chunk-GJL3QSMP.js";
10
10
  import {
11
11
  getBackendCapabilities
12
12
  } from "./chunk-AZHWLLPP.js";
@@ -366,6 +366,7 @@ function createProviderManager(config, options = {}) {
366
366
  let providers = [...config.providers ?? []];
367
367
  providers = providers.map((p) => ({ ...p, models: p.models.map((m) => enrichWithProfileDefaults(m)) }));
368
368
  let defaultModelSelection = config.defaultModelSelection;
369
+ let configDefaultModelSelection = config.defaultModelSelection;
369
370
  let llmClient = createLLMClient(config);
370
371
  const providerStatus = /* @__PURE__ */ new Map();
371
372
  logger.debug("ProviderManager created", {
@@ -470,6 +471,9 @@ function createProviderManager(config, options = {}) {
470
471
  const { model } = parseDefaultModelSelection(defaultModelSelection);
471
472
  return model;
472
473
  },
474
+ getDefaultModelSelection() {
475
+ return configDefaultModelSelection;
476
+ },
473
477
  getLLMClient() {
474
478
  return llmClient;
475
479
  },
@@ -583,6 +587,7 @@ function createProviderManager(config, options = {}) {
583
587
  setProviders(newProviders, newDefaultModelSelection) {
584
588
  providers = [...newProviders];
585
589
  defaultModelSelection = newDefaultModelSelection;
590
+ configDefaultModelSelection = newDefaultModelSelection;
586
591
  providerStatus.clear();
587
592
  for (const p of providers) {
588
593
  providerStatus.set(p.id, "unknown");
@@ -622,6 +627,7 @@ function createProviderManager(config, options = {}) {
622
627
  logger.info("Setting default model selection", { providerId, model, providerName: provider.name });
623
628
  llmClient = createClientForProvider(provider, model);
624
629
  defaultModelSelection = `${providerId}/${model}`;
630
+ configDefaultModelSelection = `${providerId}/${model}`;
625
631
  providers = providers.map((p) => ({ ...p, isActive: p.id === providerId }));
626
632
  return { success: true };
627
633
  },
@@ -799,4 +805,4 @@ export {
799
805
  parseDefaultModelSelection,
800
806
  createProviderManager
801
807
  };
802
- //# sourceMappingURL=chunk-U6JMRMBW.js.map
808
+ //# sourceMappingURL=chunk-UJRWYZHM.js.map
@@ -1,45 +1,45 @@
1
+ import {
2
+ buildCachedPrompt,
3
+ computeDynamicContextHash,
4
+ getToolFingerprint
5
+ } from "./chunk-5QTERLHH.js";
1
6
  import {
2
7
  createAssemblyResult,
3
8
  getConversationMessages,
4
9
  getToolRegistryForAgent,
5
10
  processEventsForConversation,
6
11
  runTopLevelAgentLoop
7
- } from "./chunk-V5XWUVF5.js";
8
- import {
9
- buildCachedPrompt,
10
- computeDynamicContextHash,
11
- getToolFingerprint
12
- } from "./chunk-UNNCD7A3.js";
12
+ } from "./chunk-TR4DQZIG.js";
13
13
  import {
14
14
  getAllInstructions,
15
15
  getEnabledSkillMetadata
16
- } from "./chunk-2FCLCUVR.js";
16
+ } from "./chunk-LSEHJ2WI.js";
17
+ import {
18
+ PathAccessDeniedError
19
+ } from "./chunk-5A4YN6I7.js";
17
20
  import {
18
21
  TurnMetrics,
19
22
  createChatDoneEvent,
20
23
  createMessageStartEvent
21
- } from "./chunk-SE62ZBNX.js";
24
+ } from "./chunk-62GUO2EG.js";
22
25
  import {
23
26
  buildAgentReminder,
24
27
  buildAgentSmallReminder
25
- } from "./chunk-27NABDXB.js";
26
- import {
27
- PathAccessDeniedError
28
- } from "./chunk-XZGQZ42D.js";
28
+ } from "./chunk-Y7FGHKBW.js";
29
29
  import {
30
30
  getCurrentContextWindowId,
31
31
  getCurrentWindowMessageOptions,
32
32
  getEventStore
33
- } from "./chunk-JOCR4CF4.js";
33
+ } from "./chunk-J3IJJ55E.js";
34
34
  import {
35
35
  buildSnapshotFromSessionState
36
- } from "./chunk-3KBRMBTP.js";
36
+ } from "./chunk-LWXLNE6M.js";
37
37
  import {
38
38
  findAgentById,
39
39
  getRuntimeConfig,
40
40
  loadAllAgentsDefault,
41
41
  resolveDefaultAgentId
42
- } from "./chunk-LNNBLB6G.js";
42
+ } from "./chunk-2N7KFNMY.js";
43
43
  import {
44
44
  logger
45
45
  } from "./chunk-K44MW7JJ.js";
@@ -49,7 +49,7 @@ import {
49
49
 
50
50
  // src/server/chat/orchestrator.ts
51
51
  async function buildRetryPatterns() {
52
- const { getSetting, SETTINGS_KEYS } = await import("./settings-FGXQHKUH.js");
52
+ const { getSetting, SETTINGS_KEYS } = await import("./settings-SYYDPV43.js");
53
53
  const raw = getSetting(SETTINGS_KEYS.RETRY_PATTERNS);
54
54
  if (!raw) {
55
55
  const oldXmlProtection = getSetting("llm.disableXmlProtection");
@@ -325,4 +325,4 @@ export {
325
325
  runChatTurn,
326
326
  runAgentTurn
327
327
  };
328
- //# sourceMappingURL=chunk-6DDB67FN.js.map
328
+ //# sourceMappingURL=chunk-VUANU5A5.js.map