openfox 2.0.62 → 2.0.64

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 (40) hide show
  1. package/README.md +14 -0
  2. package/dist/{chat-handler-TRAITVLO.js → chat-handler-LI4R4Z2E.js} +11 -11
  3. package/dist/{chunk-L4WACPUX.js → chunk-73N5CJH3.js} +5 -5
  4. package/dist/{chunk-BKTBHEPY.js → chunk-HZNY77HZ.js} +32 -42
  5. package/dist/{chunk-QZRS2RF5.js → chunk-JFQSQO2N.js} +362 -92
  6. package/dist/{chunk-3WL5YCP6.js → chunk-O3G6X5CT.js} +6 -6
  7. package/dist/{chunk-GJU35MDV.js → chunk-OESYKZCM.js} +2 -2
  8. package/dist/{chunk-JKLPWTUN.js → chunk-QBYQ7KDX.js} +9 -4
  9. package/dist/{chunk-NVPVDDQZ.js → chunk-QJ5FH5DP.js} +14 -10
  10. package/dist/{chunk-H774GQJW.js → chunk-RYIREJAW.js} +234 -40
  11. package/dist/{chunk-WEB4WBUF.js → chunk-WD75RSGR.js} +149 -117
  12. package/dist/{chunk-43UFGATL.js → chunk-WGAAQASA.js} +31 -9
  13. package/dist/{chunk-6VDCH5ML.js → chunk-X5YCWKNS.js} +4 -4
  14. package/dist/cli/dev.js +1 -1
  15. package/dist/cli/index.js +1 -1
  16. package/dist/{client-KRFGMNGN.js → client-LAKW7TA5.js} +3 -3
  17. package/dist/{compactor-Q33AJPCQ.js → compactor-I3N56PSJ.js} +4 -4
  18. package/dist/{config-GMQUPNBY.js → config-EUMVEFHU.js} +2 -2
  19. package/dist/{orchestrator-TQ23BAFQ.js → orchestrator-PFN7C5JI.js} +14 -14
  20. package/dist/package.json +5 -1
  21. package/dist/{processor-3ZOFGZP5.js → processor-AYYXP5NS.js} +13 -12
  22. package/dist/protocol-Cq66hdDX.d.ts +375 -0
  23. package/dist/provider/index.d.ts +129 -0
  24. package/dist/provider/index.js +1 -0
  25. package/dist/{provider-LBYBC5AG.js → provider-GYOW4OWQ.js} +7 -9
  26. package/dist/{provider-manager-ABEUYU3K.js → provider-manager-HRHNF73A.js} +4 -5
  27. package/dist/{serve-CNA5NKOR.js → serve-54KALE6R.js} +15 -16
  28. package/dist/server/index.d.ts +6 -87
  29. package/dist/server/index.js +12 -13
  30. package/dist/{server-CI5IEBOC.js → server-Z2A5YZM6.js} +10 -14
  31. package/dist/shared/index.d.ts +3 -2
  32. package/dist/{tools-33FQNFKC.js → tools-R6LPK6OS.js} +7 -7
  33. package/dist/types-CDZakn7f.d.ts +89 -0
  34. package/dist/{protocol-J7khRG62.d.ts → types-akHmgvBk.d.ts} +17 -373
  35. package/dist/web/assets/{index-CETZPQXr.js → index-CkE65FP4.js} +74 -73
  36. package/dist/web/assets/{index-BGkyTfuQ.css → index-DvPmgi8F.css} +1 -1
  37. package/dist/web/index.html +2 -2
  38. package/dist/web/sw.js +1 -1
  39. package/package.json +5 -1
  40. package/dist/chunk-M3RB4IF6.js +0 -114
@@ -1,114 +0,0 @@
1
- import {
2
- buildModelsUrl,
3
- stripVersionPrefix
4
- } from "./chunk-HNCM3D7Y.js";
5
- import {
6
- logger
7
- } from "./chunk-K44MW7JJ.js";
8
-
9
- // src/server/llm/models.ts
10
- var modelCache = /* @__PURE__ */ new Map();
11
- var llmStatus = "unknown";
12
- var lastActiveUrl = null;
13
- var CACHE_TTL_MS = 3e4;
14
- function getCacheKey(url) {
15
- return stripVersionPrefix(url);
16
- }
17
- async function detectModel(llmBaseUrl, retries = 3, silent = false) {
18
- const cacheKey = getCacheKey(llmBaseUrl);
19
- const now = Date.now();
20
- const cached = modelCache.get(cacheKey);
21
- if (cached && now - cached.timestamp < CACHE_TTL_MS) {
22
- lastActiveUrl = cacheKey;
23
- llmStatus = "connected";
24
- return cached.model;
25
- }
26
- const url = buildModelsUrl(llmBaseUrl);
27
- for (let attempt = 1; attempt <= retries; attempt++) {
28
- try {
29
- if (silent) {
30
- logger.debug("Fetching models from LLM server", { url, attempt });
31
- }
32
- const response = await fetch(url, {
33
- signal: AbortSignal.timeout(1e4)
34
- });
35
- if (!response.ok) {
36
- if (silent) {
37
- logger.debug("Failed to fetch models from LLM server", { status: response.status, attempt });
38
- } else {
39
- logger.warn("Failed to fetch models from LLM server", { status: response.status, attempt });
40
- }
41
- if (attempt < retries) {
42
- await new Promise((r) => setTimeout(r, 1e3 * attempt));
43
- continue;
44
- }
45
- llmStatus = "disconnected";
46
- return cached?.model ?? null;
47
- }
48
- const data = await response.json();
49
- if (data.data && data.data.length > 0) {
50
- const modelData = data.data[0];
51
- const modelId = modelData.id;
52
- modelCache.set(cacheKey, {
53
- model: modelId,
54
- modelInfo: modelData,
55
- timestamp: now
56
- });
57
- lastActiveUrl = cacheKey;
58
- llmStatus = "connected";
59
- if (silent) {
60
- logger.debug("Detected LLM model", {
61
- model: modelId,
62
- maxLen: modelData.max_model_len,
63
- root: modelData.root
64
- });
65
- } else {
66
- logger.info("Detected LLM model", {
67
- model: modelId,
68
- maxLen: modelData.max_model_len,
69
- root: modelData.root
70
- });
71
- }
72
- return modelId;
73
- }
74
- if (silent) {
75
- logger.debug("LLM server returned empty models list");
76
- } else {
77
- logger.warn("LLM server returned empty models list");
78
- }
79
- llmStatus = "disconnected";
80
- return null;
81
- } catch (error) {
82
- const errMsg = error instanceof Error ? error.message : String(error);
83
- if (silent) {
84
- logger.debug("Could not detect model from LLM server", { error: errMsg, attempt });
85
- } else {
86
- logger.warn("Could not detect model from LLM server", { error: errMsg, attempt });
87
- }
88
- if (attempt < retries) {
89
- await new Promise((r) => setTimeout(r, 1e3 * attempt));
90
- continue;
91
- }
92
- }
93
- }
94
- llmStatus = "disconnected";
95
- return cached?.model ?? null;
96
- }
97
- function getLlmStatus() {
98
- return llmStatus;
99
- }
100
- function clearModelCache(url) {
101
- if (url) {
102
- modelCache.delete(getCacheKey(url));
103
- } else {
104
- modelCache.clear();
105
- }
106
- llmStatus = "unknown";
107
- }
108
-
109
- export {
110
- detectModel,
111
- getLlmStatus,
112
- clearModelCache
113
- };
114
- //# sourceMappingURL=chunk-M3RB4IF6.js.map