openfox 2.0.81 → 2.0.82

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 (44) hide show
  1. package/dist/{chat-handler-NRJWHZB2.js → chat-handler-73HNN7TQ.js} +15 -15
  2. package/dist/{chunk-4GMRZU7A.js → chunk-3D3N2PXI.js} +4 -4
  3. package/dist/{chunk-EZDTCQMR.js → chunk-4VDEVDMG.js} +7 -19
  4. package/dist/{chunk-VZYC5OLW.js → chunk-5ZHVQOI3.js} +2 -2
  5. package/dist/{chunk-D25OSL6V.js → chunk-7QCJCIVB.js} +24 -24
  6. package/dist/{chunk-XW7BCI3O.js → chunk-ATU2X6EP.js} +4 -4
  7. package/dist/{chunk-WYJTY63G.js → chunk-CNJ63FXJ.js} +3 -2
  8. package/dist/{chunk-E3MS5CF7.js → chunk-DQP5HSDS.js} +2 -2
  9. package/dist/{chunk-QHLWWQRC.js → chunk-FVY2JOTO.js} +2 -2
  10. package/dist/{chunk-ZO5EXQMG.js → chunk-IIRXKSB5.js} +53 -2
  11. package/dist/{chunk-AIIFQYU5.js → chunk-JKZPMRH2.js} +2 -2
  12. package/dist/{chunk-PVO2XVLV.js → chunk-KC7NXZHK.js} +111 -70
  13. package/dist/{chunk-NLMT2HII.js → chunk-KSVE7RMK.js} +35 -31
  14. package/dist/{chunk-WL2WEJAK.js → chunk-SBSQD7MG.js} +2 -2
  15. package/dist/chunk-UFX46Z5J.js +7 -0
  16. package/dist/{chunk-CJDYSUU5.js → chunk-VB23QPW3.js} +9 -6
  17. package/dist/{chunk-3Q5WQMPA.js → chunk-WL6AOKRD.js} +8 -8
  18. package/dist/cli/dev.js +1 -1
  19. package/dist/cli/index.js +1 -1
  20. package/dist/{client-V5DZRO2D.js → client-TA2VD4LR.js} +5 -3
  21. package/dist/{compactor-3UHLN554.js → compactor-YKESKGHL.js} +6 -6
  22. package/dist/http-client-QZY7W36Q.js +11 -0
  23. package/dist/{manager-FIE2LCGJ.js → manager-WOUOQVLV.js} +4 -4
  24. package/dist/{orchestrator-KOL34NS2.js → orchestrator-CMKIFPOS.js} +10 -10
  25. package/dist/package.json +1 -1
  26. package/dist/{path-security-EKTUMDJW.js → path-security-AWDNKRZ4.js} +3 -3
  27. package/dist/{platform-KME5DVX5.js → platform-7AK5MB4K.js} +3 -3
  28. package/dist/{processor-S3SDZHQC.js → processor-XNFEP2DV.js} +14 -14
  29. package/dist/{provider-TIZV4IFE.js → provider-QVVJ6XNZ.js} +6 -4
  30. package/dist/{provider-manager-PD3BXUHY.js → provider-manager-7246YSJT.js} +6 -4
  31. package/dist/{serve-PESDYZZP.js → serve-PHRKCACD.js} +17 -17
  32. package/dist/server/index.d.ts +0 -5
  33. package/dist/server/index.js +16 -16
  34. package/dist/{server-LWXTOEIJ.js → server-OLE7676B.js} +12 -12
  35. package/dist/{settings-DMYBLBDQ.js → settings-6TJIHDVX.js} +2 -2
  36. package/dist/{tools-FZ7HWHOW.js → tools-NXEKDL2V.js} +9 -9
  37. package/dist/{update-SVJRA6YZ.js → update-BGQRA2UG.js} +2 -2
  38. package/dist/web/assets/{index-CO9RvnPX.css → index-DfmXvFVe.css} +1 -1
  39. package/dist/web/assets/{index-BkC11Dy_.js → index-V9yNKJy4.js} +76 -76
  40. package/dist/web/index.html +2 -2
  41. package/dist/web/sw.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-UP5CYTEC.js +0 -7
  44. package/dist/http-client-PIWB7BXK.js +0 -9
@@ -2,21 +2,25 @@ import {
2
2
  buildRunChatTurnParams,
3
3
  finalizeTurnCompletion,
4
4
  generateSessionNameForSession
5
- } from "./chunk-3Q5WQMPA.js";
5
+ } from "./chunk-WL6AOKRD.js";
6
6
  import {
7
7
  runChatTurn
8
- } from "./chunk-EZDTCQMR.js";
9
- import "./chunk-D25OSL6V.js";
10
- import "./chunk-AIIFQYU5.js";
8
+ } from "./chunk-4VDEVDMG.js";
9
+ import "./chunk-7QCJCIVB.js";
10
+ import "./chunk-JKZPMRH2.js";
11
11
  import "./chunk-NWO6GRYE.js";
12
12
  import "./chunk-VPFUXGMM.js";
13
13
  import "./chunk-37WF2Z3T.js";
14
14
  import "./chunk-WGMJCFCE.js";
15
- import "./chunk-4GMRZU7A.js";
15
+ import "./chunk-3D3N2PXI.js";
16
+ import {
17
+ createChatMessageMessage,
18
+ createPhaseChangedMessage,
19
+ createSessionRunningMessage
20
+ } from "./chunk-SJTG56CH.js";
16
21
  import "./chunk-EU3WWTFH.js";
17
- import "./chunk-QHLWWQRC.js";
18
- import "./chunk-VZYC5OLW.js";
19
- import "./chunk-WYJTY63G.js";
22
+ import "./chunk-FVY2JOTO.js";
23
+ import "./chunk-5ZHVQOI3.js";
20
24
  import "./chunk-EYIWUONA.js";
21
25
  import "./chunk-6AE3JPDJ.js";
22
26
  import "./chunk-I72ACQ6R.js";
@@ -25,16 +29,12 @@ import {
25
29
  } from "./chunk-BUXIESO5.js";
26
30
  import "./chunk-A2IZ4PWQ.js";
27
31
  import "./chunk-AANVMTYU.js";
28
- import "./chunk-RGUUZD5B.js";
29
- import {
30
- createChatMessageMessage,
31
- createPhaseChangedMessage,
32
- createSessionRunningMessage
33
- } from "./chunk-SJTG56CH.js";
34
32
  import "./chunk-J2GP3J3X.js";
35
33
  import "./chunk-V4IE7HJY.js";
36
34
  import "./chunk-YHEQTVFV.js";
37
35
  import "./chunk-RMXPVQP4.js";
36
+ import "./chunk-CNJ63FXJ.js";
37
+ import "./chunk-RGUUZD5B.js";
38
38
  import "./chunk-K44MW7JJ.js";
39
39
  import "./chunk-X6BXZFO7.js";
40
40
  import "./chunk-NH2PVB6R.js";
@@ -160,4 +160,4 @@ export {
160
160
  startChatSession,
161
161
  stopSessionExecution
162
162
  };
163
- //# sourceMappingURL=chat-handler-NRJWHZB2.js.map
163
+ //# sourceMappingURL=chat-handler-73HNN7TQ.js.map
@@ -1,9 +1,9 @@
1
- import {
2
- getEventStore
3
- } from "./chunk-BUXIESO5.js";
4
1
  import {
5
2
  createChatPathConfirmationMessage
6
3
  } from "./chunk-SJTG56CH.js";
4
+ import {
5
+ getEventStore
6
+ } from "./chunk-BUXIESO5.js";
7
7
 
8
8
  // src/server/tools/path-security.ts
9
9
  import { realpath } from "fs/promises";
@@ -494,4 +494,4 @@ export {
494
494
  getConfirmationSessionId,
495
495
  getPendingConfirmationsBySession
496
496
  };
497
- //# sourceMappingURL=chunk-4GMRZU7A.js.map
497
+ //# sourceMappingURL=chunk-3D3N2PXI.js.map
@@ -9,10 +9,10 @@ import {
9
9
  loadAllAgentsDefault,
10
10
  processEventsForConversation,
11
11
  runTopLevelAgentLoop
12
- } from "./chunk-D25OSL6V.js";
12
+ } from "./chunk-7QCJCIVB.js";
13
13
  import {
14
14
  PathAccessDeniedError
15
- } from "./chunk-4GMRZU7A.js";
15
+ } from "./chunk-3D3N2PXI.js";
16
16
  import {
17
17
  TurnMetrics,
18
18
  buildAgentReminder,
@@ -20,7 +20,7 @@ import {
20
20
  buildTopLevelSystemPrompt,
21
21
  createChatDoneEvent,
22
22
  createMessageStartEvent
23
- } from "./chunk-QHLWWQRC.js";
23
+ } from "./chunk-FVY2JOTO.js";
24
24
  import {
25
25
  getCurrentContextWindowId,
26
26
  getCurrentWindowMessageOptions,
@@ -66,7 +66,7 @@ function resolveAgentDef(sessionManager, sessionId) {
66
66
  }
67
67
  async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
68
68
  const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
69
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-FZ7HWHOW.js");
69
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-NXEKDL2V.js");
70
70
  const tools = getToolRegistryForAgent2(agentDef).definitions;
71
71
  const toolFingerprint = getToolFingerprint(tools);
72
72
  const allAgents = await loadAllAgentsDefault();
@@ -79,7 +79,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
79
79
  async function computeSessionHash(sessionManager, sessionId) {
80
80
  const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
81
81
  const agentDef = await resolveAgentDef(sessionManager, sessionId);
82
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-FZ7HWHOW.js");
82
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-NXEKDL2V.js");
83
83
  const tools = getToolRegistryForAgent2(agentDef).definitions;
84
84
  const toolFingerprint = getToolFingerprint(tools);
85
85
  return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
@@ -97,7 +97,7 @@ async function applyDynamicContext(sessionManager, sessionId) {
97
97
 
98
98
  // src/server/chat/orchestrator.ts
99
99
  async function buildRetryPatterns() {
100
- const { getSetting, SETTINGS_KEYS } = await import("./settings-DMYBLBDQ.js");
100
+ const { getSetting, SETTINGS_KEYS } = await import("./settings-6TJIHDVX.js");
101
101
  const raw = getSetting(SETTINGS_KEYS.RETRY_PATTERNS);
102
102
  if (!raw) {
103
103
  const oldXmlProtection = getSetting("llm.disableXmlProtection");
@@ -149,18 +149,6 @@ async function runChatTurn(options) {
149
149
  const mode = session.mode;
150
150
  logger.debug("Starting chat turn", { sessionId, mode });
151
151
  sessionManager.setRunning(sessionId, true);
152
- const branchWarning = await sessionManager.checkBranchConsistency(sessionId);
153
- if (branchWarning) {
154
- logger.warn("Branch consistency check failed", { sessionId, warning: branchWarning });
155
- sessionManager.addMessage(sessionId, {
156
- role: "user",
157
- content: `<system-reminder>
158
- ${branchWarning}
159
- </system-reminder>`,
160
- isSystemGenerated: true,
161
- messageKind: "auto-prompt"
162
- });
163
- }
164
152
  const append = (event) => {
165
153
  try {
166
154
  eventStore.append(sessionId, event);
@@ -371,4 +359,4 @@ export {
371
359
  runChatTurn,
372
360
  runAgentTurn
373
361
  };
374
- //# sourceMappingURL=chunk-EZDTCQMR.js.map
362
+ //# sourceMappingURL=chunk-4VDEVDMG.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SETTINGS_KEYS,
3
3
  getSetting
4
- } from "./chunk-WYJTY63G.js";
4
+ } from "./chunk-CNJ63FXJ.js";
5
5
 
6
6
  // src/server/utils/platform.ts
7
7
  import os from "os";
@@ -63,4 +63,4 @@ export {
63
63
  isWindowsPath,
64
64
  isAbsolutePath
65
65
  };
66
- //# sourceMappingURL=chunk-VZYC5OLW.js.map
66
+ //# sourceMappingURL=chunk-5ZHVQOI3.js.map
@@ -8,7 +8,7 @@ import {
8
8
  spawnShellProcess,
9
9
  startProcessCommand,
10
10
  stopProcess
11
- } from "./chunk-AIIFQYU5.js";
11
+ } from "./chunk-JKZPMRH2.js";
12
12
  import {
13
13
  createMcpTools
14
14
  } from "./chunk-NWO6GRYE.js";
@@ -25,7 +25,14 @@ import {
25
25
  extractSensitivePathsFromCommand,
26
26
  registerPathConfirmation,
27
27
  requestPathAccess
28
- } from "./chunk-4GMRZU7A.js";
28
+ } from "./chunk-3D3N2PXI.js";
29
+ import {
30
+ createChatDoneMessage,
31
+ createChatMessageMessage,
32
+ createChatMessageUpdatedMessage,
33
+ createChatPathConfirmationMessage,
34
+ createQueueStateMessage
35
+ } from "./chunk-SJTG56CH.js";
29
36
  import {
30
37
  AskUserInterrupt,
31
38
  askUserTool
@@ -42,13 +49,7 @@ import {
42
49
  createToolCallEvent,
43
50
  createToolResultEvent,
44
51
  streamLLMPure
45
- } from "./chunk-QHLWWQRC.js";
46
- import {
47
- SETTINGS_KEYS,
48
- deleteSetting,
49
- getSetting,
50
- setSetting
51
- } from "./chunk-WYJTY63G.js";
52
+ } from "./chunk-FVY2JOTO.js";
52
53
  import {
53
54
  startInspectProxy
54
55
  } from "./chunk-EYIWUONA.js";
@@ -76,13 +77,6 @@ import {
76
77
  reorderToolMessages,
77
78
  stripOrphanedToolCalls
78
79
  } from "./chunk-A2IZ4PWQ.js";
79
- import {
80
- createChatDoneMessage,
81
- createChatMessageMessage,
82
- createChatMessageUpdatedMessage,
83
- createChatPathConfirmationMessage,
84
- createQueueStateMessage
85
- } from "./chunk-SJTG56CH.js";
86
80
  import {
87
81
  modelSupportsVision
88
82
  } from "./chunk-V4IE7HJY.js";
@@ -97,6 +91,12 @@ import {
97
91
  isPdfBuffer,
98
92
  processPdfContent
99
93
  } from "./chunk-RMXPVQP4.js";
94
+ import {
95
+ SETTINGS_KEYS,
96
+ deleteSetting,
97
+ getSetting,
98
+ setSetting
99
+ } from "./chunk-CNJ63FXJ.js";
100
100
  import {
101
101
  logger
102
102
  } from "./chunk-K44MW7JJ.js";
@@ -120,7 +120,7 @@ async function requestUserConfirmation(context, toolLabel, desc) {
120
120
  if (context.dangerLevel === "dangerous") return Promise.resolve(true);
121
121
  if (toolLabel === "workspace" || toolLabel === "command") {
122
122
  try {
123
- const { getSetting: getSetting2, SETTINGS_KEYS: SETTINGS_KEYS2 } = await import("./settings-DMYBLBDQ.js");
123
+ const { getSetting: getSetting2, SETTINGS_KEYS: SETTINGS_KEYS2 } = await import("./settings-6TJIHDVX.js");
124
124
  if (getSetting2(SETTINGS_KEYS2.CONFIRM_ON_WORKSPACE_ACTIONS) !== "true") {
125
125
  return Promise.resolve(true);
126
126
  }
@@ -2576,7 +2576,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
2576
2576
  sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens, config.subAgentMetadata?.subAgentId);
2577
2577
  if (!compacting) {
2578
2578
  const contextState2 = sessionManager.getContextState(sessionId);
2579
- const { shouldCompact, appendCompactionPrompt } = await import("./compactor-3UHLN554.js");
2579
+ const { shouldCompact, appendCompactionPrompt } = await import("./compactor-YKESKGHL.js");
2580
2580
  if (shouldCompact(
2581
2581
  contextState2.currentTokens,
2582
2582
  contextState2.maxTokens,
@@ -2661,7 +2661,7 @@ ${COMPACTION_PROMPT}`,
2661
2661
  toolRegistry,
2662
2662
  sessionManager,
2663
2663
  sessionId,
2664
- workdir: session.workspace ?? session.workdir,
2664
+ workdir: sessionManager.getEffectiveWorkdir(sessionId),
2665
2665
  turnMetrics,
2666
2666
  signal,
2667
2667
  onMessage,
@@ -3400,7 +3400,7 @@ async function executeSubAgent(options) {
3400
3400
  })
3401
3401
  );
3402
3402
  }
3403
- const effectiveWorkdir = session.workspace ?? session.workdir;
3403
+ const effectiveWorkdir = sessionManager.getEffectiveWorkdir(session.id);
3404
3404
  const { content: instructionContent } = await getAllInstructions(effectiveWorkdir, session.projectId);
3405
3405
  const config = getRuntimeConfig();
3406
3406
  const configDir = getGlobalConfigDir(config.mode ?? "production");
@@ -3515,7 +3515,7 @@ var callSubAgentTool = {
3515
3515
  };
3516
3516
  }
3517
3517
  try {
3518
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-FZ7HWHOW.js");
3518
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-NXEKDL2V.js");
3519
3519
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3520
3520
  const turnMetrics = new TurnMetrics();
3521
3521
  const result = await executeSubAgent({
@@ -4518,7 +4518,7 @@ var mcpConfigTool = createTool(
4518
4518
  mcpNotifyChanged?.(sessionId);
4519
4519
  }
4520
4520
  async function rebuildTools() {
4521
- const { setMcpTools: setMcpTools2 } = await import("./tools-FZ7HWHOW.js");
4521
+ const { setMcpTools: setMcpTools2 } = await import("./tools-NXEKDL2V.js");
4522
4522
  const mcpTools = createMcpTools(mcpManagerForTools);
4523
4523
  setMcpTools2(mcpTools);
4524
4524
  }
@@ -4861,7 +4861,7 @@ var workspaceTool = createTool(
4861
4861
  if (!session) return helpers.error("Session not found");
4862
4862
  const project = sessionManager.getProject(session.projectId);
4863
4863
  if (!project) return helpers.error("Project not found");
4864
- const currentBranch = await getGitBranch(session.workspace ?? session.workdir);
4864
+ const currentBranch = await getGitBranch(sessionManager.getEffectiveWorkdir(session.id));
4865
4865
  const named = await listWorkspaces(project.name, project.workdir);
4866
4866
  const activeWsName = session.workspace?.split("/").pop() ?? null;
4867
4867
  const workspaces = [
@@ -5181,4 +5181,4 @@ export {
5181
5181
  getToolRegistryForAgent,
5182
5182
  createToolRegistry
5183
5183
  };
5184
- //# sourceMappingURL=chunk-D25OSL6V.js.map
5184
+ //# sourceMappingURL=chunk-7QCJCIVB.js.map
@@ -163,7 +163,7 @@ async function runCli(options) {
163
163
  break;
164
164
  }
165
165
  case "provider": {
166
- const { runProviderCommand } = await import("./provider-TIZV4IFE.js");
166
+ const { runProviderCommand } = await import("./provider-QVVJ6XNZ.js");
167
167
  const [, subcommand] = positionals;
168
168
  await runProviderCommand(mode, subcommand);
169
169
  break;
@@ -200,7 +200,7 @@ async function runCli(options) {
200
200
  break;
201
201
  }
202
202
  case "update": {
203
- const { runUpdate } = await import("./update-SVJRA6YZ.js");
203
+ const { runUpdate } = await import("./update-BGQRA2UG.js");
204
204
  const code = await runUpdate();
205
205
  if (code !== 0) {
206
206
  process.exit(code);
@@ -213,7 +213,7 @@ async function runCli(options) {
213
213
  if (!configExists) {
214
214
  await runNetworkSetup(mode);
215
215
  }
216
- const { runServe } = await import("./serve-PESDYZZP.js");
216
+ const { runServe } = await import("./serve-PHRKCACD.js");
217
217
  const serveOptions = { mode };
218
218
  if (values.port) serveOptions.port = parseInt(values.port);
219
219
  if (values["no-browser"] === true) serveOptions.openBrowser = false;
@@ -225,4 +225,4 @@ async function runCli(options) {
225
225
  export {
226
226
  runCli
227
227
  };
228
- //# sourceMappingURL=chunk-XW7BCI3O.js.map
228
+ //# sourceMappingURL=chunk-ATU2X6EP.js.map
@@ -27,7 +27,8 @@ var SETTINGS_KEYS = {
27
27
  SEARCH_SEARXNG_API_KEY: "search.searxngApiKey",
28
28
  TOOLS_USE_RTK: "tools.useRtk",
29
29
  TOOLS_SHELL: "tools.shell",
30
- CONFIRM_ON_WORKSPACE_ACTIONS: "tools.confirmOnWorkspaceActions"
30
+ CONFIRM_ON_WORKSPACE_ACTIONS: "tools.confirmOnWorkspaceActions",
31
+ PROXY_URL: "network.proxyUrl"
31
32
  };
32
33
  var SETTINGS_DEFAULTS = {
33
34
  [SETTINGS_KEYS.DISPLAY_SHOW_THINKING]: "true",
@@ -108,4 +109,4 @@ export {
108
109
  getAllSettings,
109
110
  getMaxVisibleItems
110
111
  };
111
- //# sourceMappingURL=chunk-WYJTY63G.js.map
112
+ //# sourceMappingURL=chunk-CNJ63FXJ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  COMPACTION_PROMPT,
3
3
  createMessageStartEvent
4
- } from "./chunk-QHLWWQRC.js";
4
+ } from "./chunk-FVY2JOTO.js";
5
5
  import {
6
6
  getCurrentWindowMessageOptions
7
7
  } from "./chunk-BUXIESO5.js";
@@ -34,4 +34,4 @@ export {
34
34
  COMPACTION_MAX_RATIO,
35
35
  shouldCompact
36
36
  };
37
- //# sourceMappingURL=chunk-E3MS5CF7.js.map
37
+ //# sourceMappingURL=chunk-DQP5HSDS.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getPlatformShell
3
- } from "./chunk-VZYC5OLW.js";
3
+ } from "./chunk-5ZHVQOI3.js";
4
4
  import {
5
5
  streamWithSegments
6
6
  } from "./chunk-J2GP3J3X.js";
@@ -680,4 +680,4 @@ export {
680
680
  createChatDoneEvent,
681
681
  consumeStreamGenerator
682
682
  };
683
- //# sourceMappingURL=chunk-QHLWWQRC.js.map
683
+ //# sourceMappingURL=chunk-FVY2JOTO.js.map
@@ -1,3 +1,7 @@
1
+ import {
2
+ SETTINGS_KEYS,
3
+ getSetting
4
+ } from "./chunk-CNJ63FXJ.js";
1
5
  import {
2
6
  logger
3
7
  } from "./chunk-K44MW7JJ.js";
@@ -24,6 +28,52 @@ var LLMError = class extends OpenFoxError {
24
28
  }
25
29
  };
26
30
 
31
+ // src/server/llm/proxy.ts
32
+ import { fetch as undiciFetch, ProxyAgent } from "undici";
33
+ var _cachedProxyUrl;
34
+ var _cachedAgent;
35
+ function getProxyAgent() {
36
+ const proxyUrl = getSetting(SETTINGS_KEYS.PROXY_URL) ?? void 0;
37
+ if (!proxyUrl) {
38
+ if (_cachedAgent) {
39
+ _cachedAgent.destroy().catch((err) => {
40
+ logger.warn("[proxy] Failed to destroy old proxy agent", { error: err });
41
+ });
42
+ _cachedAgent = void 0;
43
+ _cachedProxyUrl = void 0;
44
+ }
45
+ return void 0;
46
+ }
47
+ if (proxyUrl !== _cachedProxyUrl) {
48
+ if (_cachedAgent) {
49
+ _cachedAgent.destroy().catch((err) => {
50
+ logger.warn("[proxy] Failed to destroy old proxy agent", { error: err });
51
+ });
52
+ }
53
+ _cachedProxyUrl = proxyUrl;
54
+ try {
55
+ _cachedAgent = new ProxyAgent({
56
+ uri: proxyUrl,
57
+ requestTls: { rejectUnauthorized: true }
58
+ });
59
+ logger.info("[proxy] Proxy agent created", { proxyUrl });
60
+ } catch (err) {
61
+ logger.error("[proxy] Failed to create proxy agent", { proxyUrl, error: err });
62
+ _cachedAgent = void 0;
63
+ _cachedProxyUrl = void 0;
64
+ return void 0;
65
+ }
66
+ }
67
+ return _cachedAgent;
68
+ }
69
+ async function proxyFetch(url, options) {
70
+ const agent = getProxyAgent();
71
+ if (agent) {
72
+ return undiciFetch(url, { ...options, dispatcher: agent });
73
+ }
74
+ return fetch(url, options);
75
+ }
76
+
27
77
  // src/server/llm/http-client.ts
28
78
  var OpenAIHttpClient = class {
29
79
  baseURL;
@@ -40,7 +90,7 @@ var OpenAIHttpClient = class {
40
90
  };
41
91
  const bodyStr = JSON.stringify(params);
42
92
  logger.debug("HTTP request to LLM", { url, bodyKeys: Object.keys(params) });
43
- const response = await fetch(url, {
93
+ const response = await proxyFetch(url, {
44
94
  method: "POST",
45
95
  headers,
46
96
  body: bodyStr,
@@ -110,6 +160,7 @@ var OpenAIHttpClient = class {
110
160
  export {
111
161
  SessionNotFoundError,
112
162
  LLMError,
163
+ proxyFetch,
113
164
  OpenAIHttpClient
114
165
  };
115
- //# sourceMappingURL=chunk-ZO5EXQMG.js.map
166
+ //# sourceMappingURL=chunk-IIRXKSB5.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getPlatformShell
3
- } from "./chunk-VZYC5OLW.js";
3
+ } from "./chunk-5ZHVQOI3.js";
4
4
  import {
5
5
  appendLog,
6
6
  createProcess,
@@ -153,4 +153,4 @@ export {
153
153
  getSessionProcesses2 as getSessionProcesses,
154
154
  getProcessLogs
155
155
  };
156
- //# sourceMappingURL=chunk-AIIFQYU5.js.map
156
+ //# sourceMappingURL=chunk-JKZPMRH2.js.map