openfox 1.3.3 → 1.5.0

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 (32) hide show
  1. package/dist/auth-JF2HDJ6P.js +53 -0
  2. package/dist/{auto-compaction-RRFGQDQN.js → auto-compaction-PLUVACIZ.js} +4 -4
  3. package/dist/{chat-handler-34PPF43W.js → chat-handler-WH2DZLWN.js} +6 -6
  4. package/dist/{chunk-O7O3XMWO.js → chunk-CGUR45BP.js} +2 -2
  5. package/dist/{chunk-D3C4Z53N.js → chunk-DGYNNFLS.js} +71 -46
  6. package/dist/{chunk-BNK5N227.js → chunk-ICPQDI4L.js} +3 -3
  7. package/dist/{chunk-IBA3NQAD.js → chunk-LJRH7ICU.js} +2 -2
  8. package/dist/{chunk-YSPC6TQJ.js → chunk-PJRARONG.js} +26 -5
  9. package/dist/{chunk-4JBBQQOD.js → chunk-SDRFMWBP.js} +9 -24
  10. package/dist/{chunk-NGSSEMII.js → chunk-UNCPQRFP.js} +12 -6
  11. package/dist/{chunk-ON2IR3E4.js → chunk-ZY3YGCDZ.js} +130 -28
  12. package/dist/cli/dev.js +1 -1
  13. package/dist/cli/index.js +1 -1
  14. package/dist/{config-ONC2MTDE.js → config-NITYYKDA.js} +4 -4
  15. package/dist/{orchestrator-K6PLFOVY.js → orchestrator-545FRLUM.js} +5 -5
  16. package/dist/package.json +1 -1
  17. package/dist/{processor-V57VGPXZ.js → processor-GFCR73FQ.js} +2 -2
  18. package/dist/{protocol-BZ6OIASP.d.ts → protocol-CLWtTnMd.d.ts} +3 -1
  19. package/dist/{provider-FAO4R2GH.js → provider-ES2JTHXK.js} +8 -8
  20. package/dist/{serve-SK5FZJXJ.js → serve-XX2UY3ID.js} +17 -17
  21. package/dist/server/index.d.ts +2 -2
  22. package/dist/server/index.js +8 -8
  23. package/dist/shared/index.d.ts +2 -2
  24. package/dist/{tools-KTY6SVMF.js → tools-DGYGRPUZ.js} +4 -4
  25. package/dist/{vision-fallback-MGSC5SWE.js → vision-fallback-KM6LRAXF.js} +2 -2
  26. package/dist/web/assets/index-DItewd-V.js +142 -0
  27. package/dist/web/assets/{index-BW3T98H-.css → index-DwL8X9JS.css} +1 -1
  28. package/dist/web/index.html +2 -2
  29. package/dist/web/sw.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/init-TLQQLRGQ.js +0 -294
  32. package/dist/web/assets/index-MxvFVrSK.js +0 -142
@@ -0,0 +1,53 @@
1
+ import {
2
+ getAuthConfigPath
3
+ } from "./chunk-R4HADRYO.js";
4
+
5
+ // src/cli/auth.ts
6
+ import { readFile, writeFile, mkdir, access } from "fs/promises";
7
+ import { dirname } from "path";
8
+ import { createHash, publicEncrypt } from "crypto";
9
+ async function saveAuthConfig(mode, auth) {
10
+ const authPath = getAuthConfigPath(mode);
11
+ await mkdir(dirname(authPath), { recursive: true });
12
+ await writeFile(authPath, JSON.stringify(auth, null, 2));
13
+ }
14
+ async function loadAuthConfig(mode) {
15
+ const authPath = getAuthConfigPath(mode);
16
+ try {
17
+ const data = await readFile(authPath, "utf-8");
18
+ return JSON.parse(data);
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+ async function authConfigExists(mode) {
24
+ const authPath = getAuthConfigPath(mode);
25
+ try {
26
+ await access(authPath);
27
+ return true;
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+ function encryptPassword(password, publicKey) {
33
+ const encrypted = publicEncrypt(
34
+ { key: publicKey, padding: 1 },
35
+ Buffer.from(password)
36
+ );
37
+ return encrypted.toString("base64");
38
+ }
39
+ function hashPassword(password) {
40
+ return createHash("sha256").update(password).digest("hex");
41
+ }
42
+ function verifyPassword(password, hash) {
43
+ return hashPassword(password) === hash;
44
+ }
45
+ export {
46
+ authConfigExists,
47
+ encryptPassword,
48
+ hashPassword,
49
+ loadAuthConfig,
50
+ saveAuthConfig,
51
+ verifyPassword
52
+ };
53
+ //# sourceMappingURL=auth-JF2HDJ6P.js.map
@@ -2,7 +2,8 @@ import {
2
2
  maybeAutoCompactContext,
3
3
  performManualContextCompaction,
4
4
  resolveCompactionStatsIdentity
5
- } from "./chunk-4JBBQQOD.js";
5
+ } from "./chunk-SDRFMWBP.js";
6
+ import "./chunk-XFXOSPYH.js";
6
7
  import "./chunk-NW7PIZH3.js";
7
8
  import "./chunk-WQ4W5H6A.js";
8
9
  import "./chunk-S4QKTRGJ.js";
@@ -11,13 +12,12 @@ import "./chunk-7IOZFJBW.js";
11
12
  import "./chunk-XKFPU2FA.js";
12
13
  import "./chunk-3EHGGBWE.js";
13
14
  import "./chunk-TPT6HP4H.js";
14
- import "./chunk-TVQOONDR.js";
15
- import "./chunk-XFXOSPYH.js";
16
15
  import "./chunk-R4HADRYO.js";
16
+ import "./chunk-TVQOONDR.js";
17
17
  import "./chunk-PNBH3RAX.js";
18
18
  export {
19
19
  maybeAutoCompactContext,
20
20
  performManualContextCompaction,
21
21
  resolveCompactionStatsIdentity
22
22
  };
23
- //# sourceMappingURL=auto-compaction-RRFGQDQN.js.map
23
+ //# sourceMappingURL=auto-compaction-PLUVACIZ.js.map
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  runChatTurn
3
- } from "./chunk-O7O3XMWO.js";
4
- import "./chunk-4JBBQQOD.js";
3
+ } from "./chunk-CGUR45BP.js";
4
+ import "./chunk-SDRFMWBP.js";
5
5
  import {
6
6
  generateSessionName,
7
7
  needsNameGeneration
8
8
  } from "./chunk-QDEKU5RL.js";
9
+ import "./chunk-XFXOSPYH.js";
9
10
  import {
10
11
  getEventStore,
11
12
  updateSessionMetadata
@@ -26,9 +27,8 @@ import "./chunk-7IOZFJBW.js";
26
27
  import "./chunk-XKFPU2FA.js";
27
28
  import "./chunk-3EHGGBWE.js";
28
29
  import "./chunk-TPT6HP4H.js";
29
- import "./chunk-TVQOONDR.js";
30
- import "./chunk-XFXOSPYH.js";
31
30
  import "./chunk-R4HADRYO.js";
31
+ import "./chunk-TVQOONDR.js";
32
32
  import {
33
33
  logger
34
34
  } from "./chunk-PNBH3RAX.js";
@@ -59,7 +59,7 @@ async function startChatSession(sessionId, content, deps, options) {
59
59
  sessionManager.setRunning(sessionId, true);
60
60
  broadcastForSession(sessionId, createSessionRunningMessage(true));
61
61
  try {
62
- const { maybeAutoCompactContext } = await import("./auto-compaction-RRFGQDQN.js");
62
+ const { maybeAutoCompactContext } = await import("./auto-compaction-PLUVACIZ.js");
63
63
  await maybeAutoCompactContext({
64
64
  sessionManager,
65
65
  sessionId,
@@ -198,4 +198,4 @@ export {
198
198
  startChatSession,
199
199
  stopSessionExecution
200
200
  };
201
- //# sourceMappingURL=chat-handler-34PPF43W.js.map
201
+ //# sourceMappingURL=chat-handler-WH2DZLWN.js.map
@@ -13,7 +13,7 @@ import {
13
13
  getToolRegistryForAgent,
14
14
  loadAllAgentsDefault,
15
15
  runTopLevelAgentLoop
16
- } from "./chunk-4JBBQQOD.js";
16
+ } from "./chunk-SDRFMWBP.js";
17
17
  import {
18
18
  getCurrentContextWindowId,
19
19
  getEventStore
@@ -311,4 +311,4 @@ export {
311
311
  runBuilderTurn,
312
312
  runVerifierTurn
313
313
  };
314
- //# sourceMappingURL=chunk-O7O3XMWO.js.map
314
+ //# sourceMappingURL=chunk-CGUR45BP.js.map
@@ -1,5 +1,8 @@
1
1
  // src/cli/main.ts
2
2
  import { parseArgs } from "util";
3
+ import { select, password, isCancel, cancel } from "@clack/prompts";
4
+ import { generateKeyPairSync } from "crypto";
5
+ import { writeFile } from "fs/promises";
3
6
  function printHelp() {
4
7
  console.log(`
5
8
  OpenFox - Local LLM coding assistant
@@ -9,7 +12,6 @@ Usage:
9
12
 
10
13
  Commands:
11
14
  (none) Start server for current project
12
- init Interactive configuration setup
13
15
  config Show current configuration
14
16
  provider add Add a new LLM provider
15
17
  provider list List configured providers
@@ -23,8 +25,70 @@ Options:
23
25
  -v, --version Show version number
24
26
  `);
25
27
  }
28
+ async function runNetworkSetup(mode) {
29
+ const { loadAuthConfig, saveAuthConfig, encryptPassword } = await import("./auth-JF2HDJ6P.js");
30
+ const { saveGlobalConfig } = await import("./config-NITYYKDA.js");
31
+ const { getAuthKeyPath } = await import("./paths-ZRI56O63.js");
32
+ const existingAuth = await loadAuthConfig(mode);
33
+ if (existingAuth) {
34
+ return;
35
+ }
36
+ console.log("\nOpenFox Setup\n");
37
+ const networkChoice = await select({
38
+ message: "How should OpenFox be accessible?",
39
+ options: [
40
+ { value: "localhost", label: "Secure (localhost only)" },
41
+ { value: "network", label: "Accessible from local network" }
42
+ ]
43
+ });
44
+ if (isCancel(networkChoice)) {
45
+ cancel();
46
+ process.exit(1);
47
+ }
48
+ const isNetwork = networkChoice === "network";
49
+ const host = isNetwork ? "0.0.0.0" : "127.0.0.1";
50
+ let passwordValue;
51
+ if (isNetwork) {
52
+ const pwd = await password({
53
+ message: "Set a password? (optional, press Enter to skip)"
54
+ });
55
+ if (isCancel(pwd)) {
56
+ cancel();
57
+ process.exit(1);
58
+ }
59
+ passwordValue = typeof pwd === "string" ? pwd : void 0;
60
+ }
61
+ if (passwordValue && passwordValue.length > 0) {
62
+ const { publicKey, privateKey } = generateKeyPairSync("rsa", {
63
+ modulusLength: 2048,
64
+ privateKeyEncoding: { type: "pkcs8", format: "pem" },
65
+ publicKeyEncoding: { type: "spki", format: "pem" }
66
+ });
67
+ const keyPath = getAuthKeyPath(mode);
68
+ await writeFile(keyPath, privateKey, { mode: 384 });
69
+ const encryptedPassword = encryptPassword(passwordValue, publicKey);
70
+ await saveAuthConfig(mode, {
71
+ strategy: "network",
72
+ encryptedPassword
73
+ });
74
+ } else {
75
+ await saveAuthConfig(mode, {
76
+ strategy: isNetwork ? "network" : "local",
77
+ encryptedPassword: null
78
+ });
79
+ }
80
+ await saveGlobalConfig(mode, {
81
+ providers: [],
82
+ server: { port: mode === "development" ? 10469 : 10369, host, openBrowser: true },
83
+ logging: { level: "error" },
84
+ database: { path: "" },
85
+ workspace: { workdir: process.cwd() },
86
+ visionFallback: { enabled: false, url: "http://localhost:11434", model: "qwen3-vl:2b", timeout: 120 }
87
+ });
88
+ console.log("\u2713 Configuration saved!\n");
89
+ }
26
90
  async function runConfig(mode) {
27
- const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-ONC2MTDE.js");
91
+ const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-NITYYKDA.js");
28
92
  const { getGlobalConfigPath } = await import("./paths-ZRI56O63.js");
29
93
  const config = await loadGlobalConfig(mode);
30
94
  const configPath = getGlobalConfigPath(mode);
@@ -74,62 +138,23 @@ async function runCli(options) {
74
138
  }
75
139
  const [command] = positionals;
76
140
  switch (command) {
77
- case "init": {
78
- const { runInitWithSelect } = await import("./init-TLQQLRGQ.js");
79
- const { loadGlobalConfig, getActiveProvider } = await import("./config-ONC2MTDE.js");
80
- const config = await loadGlobalConfig(mode);
81
- const activeProvider = getActiveProvider(config);
82
- if (activeProvider) {
83
- console.log(`Current provider: ${activeProvider.name} (${activeProvider.url})
84
- `);
85
- }
86
- await runInitWithSelect(mode, config);
87
- break;
88
- }
89
141
  case "config": {
90
142
  await runConfig(mode);
91
143
  break;
92
144
  }
93
145
  case "provider": {
94
- const { runProviderCommand } = await import("./provider-FAO4R2GH.js");
146
+ const { runProviderCommand } = await import("./provider-ES2JTHXK.js");
95
147
  const [, subcommand] = positionals;
96
148
  await runProviderCommand(mode, subcommand);
97
149
  break;
98
150
  }
99
151
  default: {
100
- const { configFileExists } = await import("./config-ONC2MTDE.js");
152
+ const { configFileExists } = await import("./config-NITYYKDA.js");
101
153
  const configExists = await configFileExists(mode);
102
154
  if (!configExists) {
103
- console.log("Welcome to OpenFox!\n");
104
- const { trySmartDefaults, saveGlobalConfig, addProvider } = await import("./config-ONC2MTDE.js");
105
- const detected = await trySmartDefaults(mode);
106
- if (detected) {
107
- console.log(`\u2713 Found ${detected.backend} (${detected.model}) at ${detected.url}`);
108
- const baseConfig = {
109
- providers: [],
110
- server: { port: 10369, host: "127.0.0.1", openBrowser: true },
111
- logging: { level: "error" },
112
- database: { path: "" },
113
- workspace: { workdir: process.cwd() }
114
- };
115
- const configWithProvider = addProvider(baseConfig, {
116
- name: "Default",
117
- url: detected.url,
118
- backend: detected.backend,
119
- models: [],
120
- isActive: true
121
- });
122
- const { setDefaultModelSelection } = await import("./config-ONC2MTDE.js");
123
- const finalConfig = setDefaultModelSelection(configWithProvider, configWithProvider.providers[0].id, detected.model);
124
- await saveGlobalConfig(mode, finalConfig);
125
- console.log("Configuration saved!\n");
126
- } else {
127
- console.log("\u2717 No LLM server detected\n");
128
- const { runInitWithSelect } = await import("./init-TLQQLRGQ.js");
129
- await runInitWithSelect(mode);
130
- }
155
+ await runNetworkSetup(mode);
131
156
  }
132
- const { runServe } = await import("./serve-SK5FZJXJ.js");
157
+ const { runServe } = await import("./serve-XX2UY3ID.js");
133
158
  await runServe({
134
159
  mode,
135
160
  port: values.port ? parseInt(values.port) : void 0,
@@ -142,4 +167,4 @@ async function runCli(options) {
142
167
  export {
143
168
  runCli
144
169
  };
145
- //# sourceMappingURL=chunk-D3C4Z53N.js.map
170
+ //# sourceMappingURL=chunk-DGYNNFLS.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  detectBackend,
3
3
  detectModel
4
- } from "./chunk-NGSSEMII.js";
4
+ } from "./chunk-UNCPQRFP.js";
5
5
  import {
6
6
  getGlobalConfigPath
7
7
  } from "./chunk-R4HADRYO.js";
@@ -44,7 +44,7 @@ async function configFileExists(mode) {
44
44
  return false;
45
45
  }
46
46
  }
47
- var backendSchema = z.enum(["auto", "vllm", "sglang", "ollama", "llamacpp", "openai", "anthropic", "unknown"]);
47
+ var backendSchema = z.enum(["auto", "vllm", "sglang", "ollama", "llamacpp", "openai", "anthropic", "opencode-go", "unknown"]);
48
48
  var modelConfigSchema = z.object({
49
49
  id: z.string(),
50
50
  contextWindow: z.number(),
@@ -380,4 +380,4 @@ export {
380
380
  activateProvider,
381
381
  mergeConfigs
382
382
  };
383
- //# sourceMappingURL=chunk-BNK5N227.js.map
383
+ //# sourceMappingURL=chunk-ICPQDI4L.js.map
@@ -29,7 +29,7 @@ function isVisionFallbackEnabled() {
29
29
  async function ensureVisionFallbackConfigLoaded() {
30
30
  if (configLoaded) return;
31
31
  try {
32
- const { loadGlobalConfig, getVisionFallback } = await import("./config-ONC2MTDE.js");
32
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-NITYYKDA.js");
33
33
  const { getRuntimeConfig } = await import("./runtime-config-2XJJIMSC.js");
34
34
  const runtimeConfig = getRuntimeConfig();
35
35
  const mode = runtimeConfig.mode ?? "production";
@@ -134,4 +134,4 @@ export {
134
134
  describeImage,
135
135
  describeImageFromDataUrl
136
136
  };
137
- //# sourceMappingURL=chunk-IBA3NQAD.js.map
137
+ //# sourceMappingURL=chunk-LJRH7ICU.js.map
@@ -3,7 +3,7 @@ import {
3
3
  createLLMClient,
4
4
  detectBackend,
5
5
  detectModel
6
- } from "./chunk-NGSSEMII.js";
6
+ } from "./chunk-UNCPQRFP.js";
7
7
  import {
8
8
  logger
9
9
  } from "./chunk-PNBH3RAX.js";
@@ -43,7 +43,14 @@ async function fetchModelsWithContext(baseUrl, apiKey, backend) {
43
43
  logger.info("Fetching Ollama models via /api/tags and /api/show");
44
44
  return fetchOllamaModelsWithContext(baseUrl, apiKey);
45
45
  }
46
- const url = baseUrl.includes("/v1") ? `${baseUrl}/models` : `${baseUrl}/v1/models`;
46
+ const isOpenCodeGo = baseUrl.includes("opencode.ai/zen/go");
47
+ let url;
48
+ if (isOpenCodeGo) {
49
+ url = baseUrl.replace("/zen/go", "/zen").replace(/\/v1$/, "") + "/v1/models";
50
+ logger.info("OpenCode Go detected, using alternate models endpoint", { original: baseUrl, modelsUrl: url });
51
+ } else {
52
+ url = baseUrl.includes("/v1") ? `${baseUrl}/models` : `${baseUrl}/v1/models`;
53
+ }
47
54
  logger.info("Fetching models via /v1/models", { url });
48
55
  try {
49
56
  const headers = {
@@ -144,7 +151,6 @@ function parseDefaultModelSelection(selection) {
144
151
  }
145
152
  function createProviderManager(config) {
146
153
  let providers = [...config.providers ?? []];
147
- const { providerId: initialProviderId, model: initialModel } = parseDefaultModelSelection(config.defaultModelSelection);
148
154
  let defaultModelSelection = config.defaultModelSelection;
149
155
  let llmClient = createLLMClient(config);
150
156
  const providerStatus = /* @__PURE__ */ new Map();
@@ -159,7 +165,8 @@ function createProviderManager(config) {
159
165
  ...config.llm,
160
166
  baseUrl: provider.url.includes("/v1") ? provider.url : `${provider.url}/v1`,
161
167
  model,
162
- backend: provider.backend
168
+ backend: provider.backend,
169
+ ...provider.apiKey && { apiKey: provider.apiKey }
163
170
  }
164
171
  };
165
172
  }
@@ -309,12 +316,26 @@ function createProviderManager(config) {
309
316
  return true;
310
317
  },
311
318
  setProviders(newProviders, newDefaultModelSelection) {
319
+ const wasActiveProviderId = this.getActiveProviderId();
312
320
  providers = [...newProviders];
313
321
  defaultModelSelection = newDefaultModelSelection;
314
322
  providerStatus.clear();
315
323
  for (const p of providers) {
316
324
  providerStatus.set(p.id, "unknown");
317
325
  }
326
+ const newActiveProviderId = this.getActiveProviderId();
327
+ if (newActiveProviderId && newActiveProviderId !== wasActiveProviderId) {
328
+ const activeProvider = providers.find((p) => p.id === newActiveProviderId);
329
+ if (activeProvider) {
330
+ const providerConfig = createConfigForProvider(activeProvider, this.getCurrentModel() ?? "auto");
331
+ llmClient = createLLMClient(providerConfig);
332
+ logger.info("setProviders: recreated LLM client for new active provider", {
333
+ providerId: newActiveProviderId,
334
+ url: activeProvider.url,
335
+ hasApiKey: !!activeProvider.apiKey
336
+ });
337
+ }
338
+ }
318
339
  },
319
340
  getProviderStatus(providerId) {
320
341
  return providerStatus.get(providerId) ?? "unknown";
@@ -441,4 +462,4 @@ export {
441
462
  parseDefaultModelSelection,
442
463
  createProviderManager
443
464
  };
444
- //# sourceMappingURL=chunk-YSPC6TQJ.js.map
465
+ //# sourceMappingURL=chunk-PJRARONG.js.map
@@ -1,3 +1,6 @@
1
+ import {
2
+ streamWithSegments
3
+ } from "./chunk-XFXOSPYH.js";
1
4
  import {
2
5
  getContextMessages,
3
6
  getCurrentContextWindowId,
@@ -22,15 +25,12 @@ import {
22
25
  import {
23
26
  getProject
24
27
  } from "./chunk-XKFPU2FA.js";
25
- import {
26
- getRuntimeConfig
27
- } from "./chunk-TVQOONDR.js";
28
- import {
29
- streamWithSegments
30
- } from "./chunk-XFXOSPYH.js";
31
28
  import {
32
29
  getGlobalConfigDir
33
30
  } from "./chunk-R4HADRYO.js";
31
+ import {
32
+ getRuntimeConfig
33
+ } from "./chunk-TVQOONDR.js";
34
34
  import {
35
35
  logger
36
36
  } from "./chunk-PNBH3RAX.js";
@@ -3608,7 +3608,7 @@ var callSubAgentTool = {
3608
3608
  };
3609
3609
  }
3610
3610
  try {
3611
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-KTY6SVMF.js");
3611
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-DGYGRPUZ.js");
3612
3612
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3613
3613
  const turnMetrics = new TurnMetrics();
3614
3614
  const result = await executeSubAgent({
@@ -4437,23 +4437,8 @@ async function performContextCompaction(options) {
4437
4437
  content: file.content ?? "",
4438
4438
  source: file.source
4439
4439
  }));
4440
- let requestMessages = toRequestContextMessages2(getContextMessages(sessionId));
4440
+ const requestMessages = toRequestContextMessages2(getContextMessages(sessionId));
4441
4441
  const config = getRuntimeConfig();
4442
- const safeInputLimit = Math.floor(config.context.maxTokens * 0.75);
4443
- if (tokenCountAtClose > safeInputLimit && requestMessages.length > 4) {
4444
- const avgTokensPerMessage = tokenCountAtClose / requestMessages.length;
4445
- const messagesToDrop = Math.ceil((tokenCountAtClose - safeInputLimit) / avgTokensPerMessage);
4446
- if (messagesToDrop > 0 && messagesToDrop < requestMessages.length - 2) {
4447
- const kept = requestMessages.length - messagesToDrop;
4448
- logger.info("Truncating compaction input to fit model context", {
4449
- sessionId,
4450
- originalMessages: requestMessages.length,
4451
- keptMessages: kept,
4452
- estimatedTokensSaved: Math.round(messagesToDrop * avgTokensPerMessage)
4453
- });
4454
- requestMessages = [requestMessages[0], ...requestMessages.slice(-kept + 1)];
4455
- }
4456
- }
4457
4442
  const allAgents = await loadAllAgentsDefault();
4458
4443
  const plannerDef = findAgentById("planner", allAgents);
4459
4444
  const subAgentDefs = getSubAgents(allAgents);
@@ -4606,4 +4591,4 @@ export {
4606
4591
  getToolRegistryForAgent,
4607
4592
  createToolRegistry
4608
4593
  };
4609
- //# sourceMappingURL=chunk-4JBBQQOD.js.map
4594
+ //# sourceMappingURL=chunk-SDRFMWBP.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  describeImageFromDataUrl,
3
3
  ensureVisionFallbackConfigLoaded
4
- } from "./chunk-IBA3NQAD.js";
4
+ } from "./chunk-LJRH7ICU.js";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-PNBH3RAX.js";
@@ -28,6 +28,11 @@ var BACKEND_CAPABILITIES = {
28
28
  supportsChatTemplateKwargs: false,
29
29
  supportsTopK: true
30
30
  },
31
+ "opencode-go": {
32
+ supportsReasoningField: false,
33
+ supportsChatTemplateKwargs: false,
34
+ supportsTopK: true
35
+ },
31
36
  unknown: {
32
37
  // Assume vLLM-like for unknown backends
33
38
  supportsReasoningField: true,
@@ -155,6 +160,8 @@ function getBackendDisplayName(backend) {
155
160
  return "Ollama";
156
161
  case "llamacpp":
157
162
  return "llama.cpp";
163
+ case "opencode-go":
164
+ return "OpenCode Go";
158
165
  case "unknown":
159
166
  return "Unknown";
160
167
  }
@@ -772,8 +779,7 @@ function createLLMClient(config, initialBackend = "unknown") {
772
779
  const baseURL = config.llm.baseUrl.includes("/v1") ? config.llm.baseUrl : `${config.llm.baseUrl}/v1`;
773
780
  const openai = new OpenAI({
774
781
  baseURL,
775
- apiKey: "not-needed"
776
- // Most local backends don't require API key
782
+ apiKey: config.llm.apiKey ?? "not-needed"
777
783
  });
778
784
  let model = config.llm.model;
779
785
  let profile = getModelProfile(model);
@@ -818,7 +824,7 @@ function createLLMClient(config, initialBackend = "unknown") {
818
824
  try {
819
825
  const shouldDisableThinking = disableThinking || request.disableThinking === true;
820
826
  await ensureVisionFallbackConfigLoaded();
821
- const { isVisionFallbackEnabled } = await import("./vision-fallback-MGSC5SWE.js");
827
+ const { isVisionFallbackEnabled } = await import("./vision-fallback-KM6LRAXF.js");
822
828
  const paramsOptions = {
823
829
  model,
824
830
  request,
@@ -896,7 +902,7 @@ function createLLMClient(config, initialBackend = "unknown") {
896
902
  });
897
903
  try {
898
904
  await ensureVisionFallbackConfigLoaded();
899
- const { isVisionFallbackEnabled } = await import("./vision-fallback-MGSC5SWE.js");
905
+ const { isVisionFallbackEnabled } = await import("./vision-fallback-KM6LRAXF.js");
900
906
  const shouldDisableThinking = disableThinking || request.disableThinking === true;
901
907
  const createParams = await buildStreamingCreateParams({
902
908
  model,
@@ -1111,4 +1117,4 @@ export {
1111
1117
  getLlmStatus,
1112
1118
  clearModelCache
1113
1119
  };
1114
- //# sourceMappingURL=chunk-NGSSEMII.js.map
1120
+ //# sourceMappingURL=chunk-UNCPQRFP.js.map