openfox 1.3.3 → 1.4.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 (29) hide show
  1. package/dist/auth-JF2HDJ6P.js +53 -0
  2. package/dist/{auto-compaction-RRFGQDQN.js → auto-compaction-C7URGBG3.js} +4 -4
  3. package/dist/{chat-handler-34PPF43W.js → chat-handler-BUCN7QJG.js} +6 -6
  4. package/dist/{chunk-O7O3XMWO.js → chunk-7POE2HLF.js} +2 -2
  5. package/dist/{chunk-4JBBQQOD.js → chunk-G5U2OBHQ.js} +8 -8
  6. package/dist/{chunk-IBA3NQAD.js → chunk-JVAYCY76.js} +1 -1
  7. package/dist/{chunk-NGSSEMII.js → chunk-L46YMTF2.js} +4 -4
  8. package/dist/{chunk-ON2IR3E4.js → chunk-M6HB2O3B.js} +127 -25
  9. package/dist/{chunk-D3C4Z53N.js → chunk-NJ24TM3O.js} +69 -44
  10. package/dist/{chunk-YSPC6TQJ.js → chunk-TXTPA76S.js} +2 -2
  11. package/dist/{chunk-BNK5N227.js → chunk-UZ6LHPX7.js} +2 -2
  12. package/dist/cli/dev.js +1 -1
  13. package/dist/cli/index.js +1 -1
  14. package/dist/config-ONC2MTDE.js +3 -3
  15. package/dist/{orchestrator-K6PLFOVY.js → orchestrator-L3MBTPG2.js} +5 -5
  16. package/dist/package.json +1 -1
  17. package/dist/{processor-V57VGPXZ.js → processor-77Z5BZPK.js} +2 -2
  18. package/dist/{provider-FAO4R2GH.js → provider-K4HAXILY.js} +7 -7
  19. package/dist/{serve-SK5FZJXJ.js → serve-6QG3HSOL.js} +17 -17
  20. package/dist/server/index.js +8 -8
  21. package/dist/{tools-KTY6SVMF.js → tools-G6PT5NJO.js} +4 -4
  22. package/dist/{vision-fallback-MGSC5SWE.js → vision-fallback-P7WM3UGQ.js} +2 -2
  23. package/dist/web/assets/{index-BW3T98H-.css → index-BBtTirUQ.css} +1 -1
  24. package/dist/web/assets/index-D8PVAl5p.js +142 -0
  25. package/dist/web/index.html +2 -2
  26. package/dist/web/sw.js +1 -1
  27. package/package.json +1 -1
  28. package/dist/init-TLQQLRGQ.js +0 -294
  29. 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-G5U2OBHQ.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-C7URGBG3.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-7POE2HLF.js";
4
+ import "./chunk-G5U2OBHQ.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-C7URGBG3.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-BUCN7QJG.js.map
@@ -13,7 +13,7 @@ import {
13
13
  getToolRegistryForAgent,
14
14
  loadAllAgentsDefault,
15
15
  runTopLevelAgentLoop
16
- } from "./chunk-4JBBQQOD.js";
16
+ } from "./chunk-G5U2OBHQ.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-7POE2HLF.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-G6PT5NJO.js");
3612
3612
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3613
3613
  const turnMetrics = new TurnMetrics();
3614
3614
  const result = await executeSubAgent({
@@ -4606,4 +4606,4 @@ export {
4606
4606
  getToolRegistryForAgent,
4607
4607
  createToolRegistry
4608
4608
  };
4609
- //# sourceMappingURL=chunk-4JBBQQOD.js.map
4609
+ //# sourceMappingURL=chunk-G5U2OBHQ.js.map
@@ -134,4 +134,4 @@ export {
134
134
  describeImage,
135
135
  describeImageFromDataUrl
136
136
  };
137
- //# sourceMappingURL=chunk-IBA3NQAD.js.map
137
+ //# sourceMappingURL=chunk-JVAYCY76.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  describeImageFromDataUrl,
3
3
  ensureVisionFallbackConfigLoaded
4
- } from "./chunk-IBA3NQAD.js";
4
+ } from "./chunk-JVAYCY76.js";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-PNBH3RAX.js";
@@ -818,7 +818,7 @@ function createLLMClient(config, initialBackend = "unknown") {
818
818
  try {
819
819
  const shouldDisableThinking = disableThinking || request.disableThinking === true;
820
820
  await ensureVisionFallbackConfigLoaded();
821
- const { isVisionFallbackEnabled } = await import("./vision-fallback-MGSC5SWE.js");
821
+ const { isVisionFallbackEnabled } = await import("./vision-fallback-P7WM3UGQ.js");
822
822
  const paramsOptions = {
823
823
  model,
824
824
  request,
@@ -896,7 +896,7 @@ function createLLMClient(config, initialBackend = "unknown") {
896
896
  });
897
897
  try {
898
898
  await ensureVisionFallbackConfigLoaded();
899
- const { isVisionFallbackEnabled } = await import("./vision-fallback-MGSC5SWE.js");
899
+ const { isVisionFallbackEnabled } = await import("./vision-fallback-P7WM3UGQ.js");
900
900
  const shouldDisableThinking = disableThinking || request.disableThinking === true;
901
901
  const createParams = await buildStreamingCreateParams({
902
902
  model,
@@ -1111,4 +1111,4 @@ export {
1111
1111
  getLlmStatus,
1112
1112
  clearModelCache
1113
1113
  };
1114
- //# sourceMappingURL=chunk-NGSSEMII.js.map
1114
+ //# sourceMappingURL=chunk-L46YMTF2.js.map
@@ -2,7 +2,7 @@ import {
2
2
  createVerifierNudgeConfig,
3
3
  runBuilderTurn,
4
4
  runChatTurn
5
- } from "./chunk-O7O3XMWO.js";
5
+ } from "./chunk-7POE2HLF.js";
6
6
  import {
7
7
  TurnMetrics,
8
8
  agentExists,
@@ -40,7 +40,7 @@ import {
40
40
  saveSkill,
41
41
  setSkillEnabled,
42
42
  skillExists
43
- } from "./chunk-4JBBQQOD.js";
43
+ } from "./chunk-G5U2OBHQ.js";
44
44
  import {
45
45
  generateSessionName,
46
46
  needsNameGeneration
@@ -48,7 +48,16 @@ import {
48
48
  import {
49
49
  createProviderManager,
50
50
  parseDefaultModelSelection
51
- } from "./chunk-YSPC6TQJ.js";
51
+ } from "./chunk-TXTPA76S.js";
52
+ import {
53
+ SessionNotFoundError,
54
+ createLLMClient,
55
+ detectBackend,
56
+ detectModel,
57
+ getBackendDisplayName,
58
+ getLlmStatus,
59
+ getModelProfile
60
+ } from "./chunk-L46YMTF2.js";
52
61
  import {
53
62
  createSession,
54
63
  deleteSession,
@@ -112,22 +121,13 @@ import {
112
121
  import {
113
122
  createServerMessage
114
123
  } from "./chunk-TPT6HP4H.js";
124
+ import {
125
+ getGlobalConfigDir
126
+ } from "./chunk-R4HADRYO.js";
115
127
  import {
116
128
  getRuntimeConfig,
117
129
  setRuntimeConfig
118
130
  } from "./chunk-TVQOONDR.js";
119
- import {
120
- SessionNotFoundError,
121
- createLLMClient,
122
- detectBackend,
123
- detectModel,
124
- getBackendDisplayName,
125
- getLlmStatus,
126
- getModelProfile
127
- } from "./chunk-NGSSEMII.js";
128
- import {
129
- getGlobalConfigDir
130
- } from "./chunk-R4HADRYO.js";
131
131
  import {
132
132
  logger,
133
133
  setLogLevel
@@ -5853,7 +5853,7 @@ async function createServerHandle(config) {
5853
5853
  if (!callId || approved === void 0) {
5854
5854
  return res.status(400).json({ error: "callId and approved are required" });
5855
5855
  }
5856
- const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-KTY6SVMF.js");
5856
+ const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-G6PT5NJO.js");
5857
5857
  const result = providePathConfirmation2(callId, approved, alwaysAllow);
5858
5858
  if (!result.found) {
5859
5859
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
@@ -5878,7 +5878,7 @@ async function createServerHandle(config) {
5878
5878
  if (!callId || !answer) {
5879
5879
  return res.status(400).json({ error: "callId and answer are required" });
5880
5880
  }
5881
- const { provideAnswer: provideAnswer2 } = await import("./tools-KTY6SVMF.js");
5881
+ const { provideAnswer: provideAnswer2 } = await import("./tools-G6PT5NJO.js");
5882
5882
  const found = provideAnswer2(callId, answer);
5883
5883
  if (!found) {
5884
5884
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -5914,8 +5914,8 @@ async function createServerHandle(config) {
5914
5914
  if (!session) {
5915
5915
  return res.status(404).json({ error: "Session not found" });
5916
5916
  }
5917
- const { stopSessionExecution } = await import("./chat-handler-34PPF43W.js");
5918
- const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-KTY6SVMF.js");
5917
+ const { stopSessionExecution } = await import("./chat-handler-BUCN7QJG.js");
5918
+ const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-G6PT5NJO.js");
5919
5919
  stopSessionExecution(sessionId, sessionManager);
5920
5920
  abortSession(sessionId);
5921
5921
  cancelQuestionsForSession2(sessionId, "Session stopped by user");
@@ -5967,20 +5967,37 @@ async function createServerHandle(config) {
5967
5967
  setSetting(key, value);
5968
5968
  res.json({ key, value });
5969
5969
  });
5970
- app.get("/api/config", (_req, res) => {
5970
+ app.get("/api/config", async (_req, res) => {
5971
5971
  const llmClient = getLLMClient();
5972
5972
  const activeProvider = providerManager.getActiveProvider();
5973
+ let visionFallback;
5974
+ let globalWorkdir;
5975
+ try {
5976
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-ONC2MTDE.js");
5977
+ const globalConfig = await loadGlobalConfig(config.mode ?? "production");
5978
+ const fallback = getVisionFallback(globalConfig);
5979
+ if (fallback) {
5980
+ visionFallback = {
5981
+ enabled: fallback.enabled ?? false,
5982
+ url: fallback.url ?? "http://localhost:11434",
5983
+ model: fallback.model ?? "qwen3-vl:2b",
5984
+ timeout: fallback.timeout ?? 120
5985
+ };
5986
+ }
5987
+ globalWorkdir = globalConfig.workspace?.workdir;
5988
+ } catch {
5989
+ }
5973
5990
  res.json({
5974
5991
  model: llmClient.getModel(),
5975
5992
  maxContext: providerManager.getCurrentModelContext(),
5976
5993
  llmUrl: activeProvider?.url ?? config.llm.baseUrl,
5977
5994
  llmStatus: getLlmStatus(),
5978
5995
  backend: llmClient.getBackend(),
5979
- workdir: config.workdir,
5980
- // Include provider info
5996
+ workdir: globalWorkdir ?? config.workdir,
5981
5997
  providers: providerManager.getProviders(),
5982
5998
  activeProviderId: providerManager.getActiveProviderId(),
5983
- defaultModelSelection: config.defaultModelSelection
5999
+ defaultModelSelection: config.defaultModelSelection,
6000
+ visionFallback
5984
6001
  });
5985
6002
  });
5986
6003
  app.post("/api/model/refresh", async (_req, res) => {
@@ -6007,6 +6024,82 @@ async function createServerHandle(config) {
6007
6024
  backend: llmClient.getBackend()
6008
6025
  });
6009
6026
  });
6027
+ app.post("/api/providers/test", async (req, res) => {
6028
+ const { url } = req.body;
6029
+ if (!url) {
6030
+ return res.status(400).json({ error: "url is required" });
6031
+ }
6032
+ try {
6033
+ const backend = await detectBackend(url);
6034
+ const model = await detectModel(url);
6035
+ res.json({
6036
+ success: true,
6037
+ url,
6038
+ backend,
6039
+ model
6040
+ });
6041
+ } catch (error) {
6042
+ res.status(400).json({
6043
+ success: false,
6044
+ error: error instanceof Error ? error.message : "Connection failed"
6045
+ });
6046
+ }
6047
+ });
6048
+ app.post("/api/providers", async (req, res) => {
6049
+ const { name, url, backend, apiKey, model } = req.body;
6050
+ if (!name || !url || !backend) {
6051
+ return res.status(400).json({ error: "name, url, and backend are required" });
6052
+ }
6053
+ try {
6054
+ const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-ONC2MTDE.js");
6055
+ const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6056
+ const providerBackend = backend;
6057
+ const configWithProvider = addProvider(globalConfig, {
6058
+ name,
6059
+ url,
6060
+ backend: providerBackend,
6061
+ apiKey,
6062
+ models: model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [],
6063
+ isActive: true
6064
+ });
6065
+ const finalConfig = setDefaultModelSelection(
6066
+ configWithProvider,
6067
+ configWithProvider.providers[configWithProvider.providers.length - 1].id,
6068
+ model ?? "auto"
6069
+ );
6070
+ await saveGlobalConfig(config.mode ?? "production", finalConfig);
6071
+ providerManager.setProviders(finalConfig.providers, finalConfig.defaultModelSelection ?? void 0);
6072
+ const newProvider = finalConfig.providers[finalConfig.providers.length - 1];
6073
+ res.status(201).json({
6074
+ success: true,
6075
+ provider: newProvider
6076
+ });
6077
+ } catch (error) {
6078
+ res.status(500).json({
6079
+ success: false,
6080
+ error: error instanceof Error ? error.message : "Failed to create provider"
6081
+ });
6082
+ }
6083
+ });
6084
+ app.post("/api/init/config", async (req, res) => {
6085
+ const { workdir, visionFallback } = req.body;
6086
+ try {
6087
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-ONC2MTDE.js");
6088
+ const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6089
+ const updatedConfig = {
6090
+ ...globalConfig,
6091
+ workspace: workdir ? { workdir } : globalConfig.workspace,
6092
+ visionFallback: visionFallback ?? globalConfig.visionFallback
6093
+ };
6094
+ await saveGlobalConfig(config.mode ?? "production", updatedConfig);
6095
+ res.json({ success: true });
6096
+ } catch (error) {
6097
+ res.status(500).json({
6098
+ success: false,
6099
+ error: error instanceof Error ? error.message : "Failed to save config"
6100
+ });
6101
+ }
6102
+ });
6010
6103
  app.get("/api/providers", (_req, res) => {
6011
6104
  const providers = providerManager.getProviders().map((p) => ({
6012
6105
  ...p,
@@ -6017,6 +6110,15 @@ async function createServerHandle(config) {
6017
6110
  activeProviderId: providerManager.getActiveProviderId()
6018
6111
  });
6019
6112
  });
6113
+ app.delete("/api/providers/:id", async (req, res) => {
6114
+ const { id } = req.params;
6115
+ const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-ONC2MTDE.js");
6116
+ const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6117
+ const updatedConfig = removeProvider(globalConfig, id);
6118
+ await saveGlobalConfig(config.mode ?? "production", updatedConfig);
6119
+ providerManager.setProviders(updatedConfig.providers, updatedConfig.defaultModelSelection ?? void 0);
6120
+ res.json({ success: true });
6121
+ });
6020
6122
  app.get("/api/providers/:id/models", async (req, res) => {
6021
6123
  const { id } = req.params;
6022
6124
  const models = await providerManager.getProviderModels(id);
@@ -6239,7 +6341,7 @@ async function createServerHandle(config) {
6239
6341
  providerManager
6240
6342
  );
6241
6343
  const wss = wssExports.wss;
6242
- const { QueueProcessor } = await import("./processor-V57VGPXZ.js");
6344
+ const { QueueProcessor } = await import("./processor-77Z5BZPK.js");
6243
6345
  const queueProcessor = new QueueProcessor({
6244
6346
  sessionManager,
6245
6347
  providerManager,
@@ -6309,4 +6411,4 @@ export {
6309
6411
  createServerHandle,
6310
6412
  createServer
6311
6413
  };
6312
- //# sourceMappingURL=chunk-ON2IR3E4.js.map
6414
+ //# sourceMappingURL=chunk-M6HB2O3B.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,6 +25,68 @@ 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-ONC2MTDE.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
91
  const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-ONC2MTDE.js");
28
92
  const { getGlobalConfigPath } = await import("./paths-ZRI56O63.js");
@@ -74,24 +138,12 @@ 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-K4HAXILY.js");
95
147
  const [, subcommand] = positionals;
96
148
  await runProviderCommand(mode, subcommand);
97
149
  break;
@@ -100,36 +152,9 @@ async function runCli(options) {
100
152
  const { configFileExists } = await import("./config-ONC2MTDE.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-6QG3HSOL.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-NJ24TM3O.js.map
@@ -3,7 +3,7 @@ import {
3
3
  createLLMClient,
4
4
  detectBackend,
5
5
  detectModel
6
- } from "./chunk-NGSSEMII.js";
6
+ } from "./chunk-L46YMTF2.js";
7
7
  import {
8
8
  logger
9
9
  } from "./chunk-PNBH3RAX.js";
@@ -441,4 +441,4 @@ export {
441
441
  parseDefaultModelSelection,
442
442
  createProviderManager
443
443
  };
444
- //# sourceMappingURL=chunk-YSPC6TQJ.js.map
444
+ //# sourceMappingURL=chunk-TXTPA76S.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  detectBackend,
3
3
  detectModel
4
- } from "./chunk-NGSSEMII.js";
4
+ } from "./chunk-L46YMTF2.js";
5
5
  import {
6
6
  getGlobalConfigPath
7
7
  } from "./chunk-R4HADRYO.js";
@@ -380,4 +380,4 @@ export {
380
380
  activateProvider,
381
381
  mergeConfigs
382
382
  };
383
- //# sourceMappingURL=chunk-BNK5N227.js.map
383
+ //# sourceMappingURL=chunk-UZ6LHPX7.js.map
package/dist/cli/dev.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-D3C4Z53N.js";
4
+ } from "../chunk-NJ24TM3O.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-PNBH3RAX.js";
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-D3C4Z53N.js";
4
+ } from "../chunk-NJ24TM3O.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-PNBH3RAX.js";
@@ -13,11 +13,11 @@ import {
13
13
  saveGlobalConfig,
14
14
  setDefaultModelSelection,
15
15
  trySmartDefaults
16
- } from "./chunk-BNK5N227.js";
17
- import "./chunk-NGSSEMII.js";
16
+ } from "./chunk-UZ6LHPX7.js";
17
+ import "./chunk-L46YMTF2.js";
18
18
  import "./chunk-XFXOSPYH.js";
19
19
  import "./chunk-R4HADRYO.js";
20
- import "./chunk-IBA3NQAD.js";
20
+ import "./chunk-JVAYCY76.js";
21
21
  import "./chunk-PNBH3RAX.js";
22
22
  export {
23
23
  activateProvider,