@cjhyy/code-shell 0.1.0-alpha.3 → 0.1.5
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.
- package/CHANGELOG.md +77 -0
- package/dist/anthropic-IBTI4WL2.cjs +10 -0
- package/dist/anthropic-PRZZKHEZ.js +10 -0
- package/dist/arena/index.cjs +7 -6
- package/dist/arena/index.js +6 -5
- package/dist/arena/model-presets.d.ts +10 -1
- package/dist/{arena-HHDYYVHJ.cjs → arena-KBQOPLFV.cjs} +25 -23
- package/dist/{arena-ENHBHB2W.js → arena-O2L4TN6A.js} +9 -7
- package/dist/{chunk-SW3L7HIM.js → chunk-2EP3CLEN.js} +2 -2
- package/dist/{chunk-EL2RL5DG.cjs → chunk-2YW4FPFG.cjs} +2 -2
- package/dist/chunk-3OA5G4TM.js +47 -0
- package/dist/chunk-52LGZKT3.cjs +47 -0
- package/dist/{chunk-KOGV6PDQ.cjs → chunk-55XGPMAP.cjs} +44 -9
- package/dist/chunk-5ECBT4YA.js +450 -0
- package/dist/{chunk-YD7XTI7T.cjs → chunk-6QVAYW7C.cjs} +116 -28
- package/dist/{chunk-SCDKLTN3.js → chunk-6S4BJ65N.js} +5 -4
- package/dist/{chunk-ZLPJJZUW.js → chunk-76HYEPDM.js} +2 -2
- package/dist/{chunk-TDXBHD24.js → chunk-76W334S4.js} +2 -2
- package/dist/{chunk-GZBD6QRS.cjs → chunk-7EG3V4JY.cjs} +13 -12
- package/dist/{chunk-LMEKCQX4.js → chunk-7JVTYEEC.js} +6 -6
- package/dist/{chunk-ID6EJUHP.js → chunk-7K6SDRRF.js} +1262 -212
- package/dist/{chunk-5C5HIOML.js → chunk-7Y6S3OCX.js} +109 -21
- package/dist/{chunk-VIPLU4RY.cjs → chunk-A5LCRPDP.cjs} +4 -4
- package/dist/{chunk-F5BS3GUC.js → chunk-BSW22MPA.js} +39 -4
- package/dist/{chunk-VWFET3MG.cjs → chunk-BUU5PZK2.cjs} +1474 -423
- package/dist/{chunk-HOXQLX5R.cjs → chunk-BWTOS5BH.cjs} +444 -103
- package/dist/{chunk-ZRVPCXI7.js → chunk-BXCY2FSE.js} +2 -1
- package/dist/{chunk-Y7TSCDF6.js → chunk-C5YQBIRK.js} +347 -6
- package/dist/{chunk-C7C7ZZY4.cjs → chunk-HEKQCI7B.cjs} +10 -10
- package/dist/{chunk-JHXNOB5G.cjs → chunk-HS2MFNUC.cjs} +6 -6
- package/dist/{chunk-JHNCK7JP.cjs → chunk-IK4EWJBP.cjs} +4 -3
- package/dist/{chunk-M2QI5X3X.cjs → chunk-JMR33QVF.cjs} +2 -2
- package/dist/{chunk-YAFCN7ZW.cjs → chunk-KOVYSDHZ.cjs} +15 -15
- package/dist/{chunk-IJSHQGMP.cjs → chunk-KS3RYAYL.cjs} +4 -4
- package/dist/{chunk-DI7RDLOS.js → chunk-MD32R22I.js} +7 -4
- package/dist/chunk-MY5XHADU.cjs +216 -0
- package/dist/{chunk-OP57WUWQ.cjs → chunk-NUNC3VFB.cjs} +6 -6
- package/dist/{chunk-BF4LXLQV.cjs → chunk-QRM7IF2S.cjs} +133 -175
- package/dist/chunk-R47ROHGL.cjs +298 -0
- package/dist/{chunk-OUC2DFA7.js → chunk-RMYKO74M.js} +3 -3
- package/dist/{chunk-FUOKLKR2.js → chunk-SFXHZSRF.js} +1 -1
- package/dist/{chunk-2EUAE7AY.js → chunk-SIHHIQLO.js} +2 -2
- package/dist/{chunk-3CAZIWUA.cjs → chunk-SNT563K3.cjs} +9 -9
- package/dist/{chunk-SK62UVS6.js → chunk-T6VYG46N.js} +1 -1
- package/dist/{chunk-3QR52LL5.cjs → chunk-TUY2T5KP.cjs} +2 -2
- package/dist/{chunk-I57ZD5IQ.js → chunk-VIAGTYYW.js} +1 -1
- package/dist/{chunk-X2DNIMPC.cjs → chunk-VYL4EFRC.cjs} +32 -32
- package/dist/chunk-W22P377T.js +299 -0
- package/dist/chunk-WASS5YWB.js +215 -0
- package/dist/{chunk-FPFTIKEJ.js → chunk-XDIQWQJ4.js} +132 -174
- package/dist/{chunk-BUJ5KYCI.cjs → chunk-YIQBXAYU.cjs} +13 -13
- package/dist/{chunk-REFCCVDM.js → chunk-YJ77GQK5.js} +2 -2
- package/dist/chunk-YUI524OE.cjs +450 -0
- package/dist/{chunk-M2SVOKC6.js → chunk-ZBPSQCPU.js} +6 -6
- package/dist/cli/commands/builtin/export-md.d.ts +19 -0
- package/dist/cli/commands/builtin/init/detect.d.ts +25 -0
- package/dist/cli/commands/builtin/init/index.d.ts +19 -0
- package/dist/cli/main.cjs +2343 -1447
- package/dist/cli/main.js +2476 -1580
- package/dist/cli/migrate-models.d.ts +45 -0
- package/dist/cli/onboarding.d.ts +110 -5
- package/dist/cli/updater.d.ts +51 -4
- package/dist/client-base-HTF236ZD.cjs +9 -0
- package/dist/client-base-QKRKCOWB.js +9 -0
- package/dist/{compaction-YNWCEF7B.js → compaction-6VU2T643.js} +4 -2
- package/dist/compaction-OKUNTCA7.cjs +33 -0
- package/dist/context/compaction.d.ts +35 -3
- package/dist/context/manager.d.ts +40 -3
- package/dist/context/tool-result-storage.d.ts +96 -0
- package/dist/devtools-T2NIZBJK.cjs +6 -0
- package/dist/{devtools-IRQQPIRY.js → devtools-YXWHOVKR.js} +1 -1
- package/dist/engine/engine.d.ts +40 -0
- package/dist/engine/turn-loop.d.ts +6 -0
- package/dist/export-md-RXDW6F5W.cjs +135 -0
- package/dist/export-md-XXKZANW5.js +135 -0
- package/dist/file-history-KYPE3ECT.cjs +7 -0
- package/dist/file-history-LF4F7X26.js +7 -0
- package/dist/index.cjs +42 -22
- package/dist/index.d.ts +5 -2
- package/dist/index.js +40 -20
- package/dist/llm/client-base.d.ts +1 -1
- package/dist/llm/model-cache.d.ts +21 -0
- package/dist/llm/model-fetcher.d.ts +29 -0
- package/dist/llm/model-pool.d.ts +13 -0
- package/dist/llm/provider-catalog.d.ts +30 -0
- package/dist/llm/provider-kinds.d.ts +21 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/session-recorder.d.ts +77 -0
- package/dist/manager-C2IUXKRC.js +7 -0
- package/dist/manager-YYKWYTRM.cjs +7 -0
- package/dist/mcp-manager-QMKWPBZ4.js +8 -0
- package/dist/mcp-manager-Z3OKI74O.cjs +8 -0
- package/dist/memory-5LWZ6FI2.cjs +9 -0
- package/dist/{memory-EPFDBPII.js → memory-VIJLBAMQ.js} +2 -2
- package/dist/model-cache-5KIYL5SL.js +13 -0
- package/dist/model-cache-OED3IM4R.cjs +13 -0
- package/dist/model-fetcher-HKGICACL.js +8 -0
- package/dist/model-fetcher-UR6WJOQP.cjs +8 -0
- package/dist/openai-JR2WEKOF.js +10 -0
- package/dist/openai-YBTOET4O.cjs +10 -0
- package/dist/openrouter-models-OU4GRZQY.cjs +15 -0
- package/dist/{openrouter-models-2FM3H4SQ.js → openrouter-models-TGKDKY52.js} +2 -2
- package/dist/openrouter-sync-BBHUM3R6.cjs +11 -0
- package/dist/{openrouter-sync-SO3AWEAM.js → openrouter-sync-UXUSJCIR.js} +3 -3
- package/dist/product/index.cjs +17 -15
- package/dist/product/index.js +16 -14
- package/dist/protocol/server.d.ts +3 -1
- package/dist/protocol/types.d.ts +36 -2
- package/dist/run/index.cjs +17 -15
- package/dist/run/index.js +16 -14
- package/dist/services/index.d.ts +0 -1
- package/dist/session-manager-Q22BBMD3.js +8 -0
- package/dist/session-manager-XODQVL3C.cjs +8 -0
- package/dist/settings/schema.d.ts +267 -42
- package/dist/{tool-summary-RYNR4DDB.cjs → tool-summary-63DPIS7G.cjs} +4 -4
- package/dist/{tool-summary-2RUFL5QK.js → tool-summary-NP5CDBKG.js} +2 -2
- package/dist/tool-system/builtin/ask-user.d.ts +9 -1
- package/dist/tool-system/context.d.ts +31 -2
- package/dist/tool-system/executor.d.ts +4 -0
- package/dist/tool-system/investigation-guard.d.ts +37 -0
- package/dist/types.d.ts +13 -2
- package/dist/ui/components/AskUserPrompt.d.ts +8 -1
- package/dist/ui/components/DiffLine.d.ts +33 -0
- package/dist/ui/components/ModelManager.d.ts +34 -1
- package/dist/ui/components/OnboardingPrompt.d.ts +10 -1
- package/dist/ui/components/ProviderModelFlow.d.ts +58 -0
- package/dist/ui/components/UpdateBanner.d.ts +1 -0
- package/dist/updater-QW473OF4.cjs +17 -0
- package/dist/updater-VFUAHCVY.js +17 -0
- package/dist/utils/semver.d.ts +1 -0
- package/dist/utils/task-sanitizer.d.ts +6 -0
- package/package.json +1 -1
- package/dist/anthropic-P5VETAFI.cjs +0 -10
- package/dist/anthropic-W2GU3D76.js +0 -10
- package/dist/chunk-75E4BBFC.js +0 -224
- package/dist/chunk-FV2ARONZ.cjs +0 -224
- package/dist/client-base-TOVE25FA.js +0 -9
- package/dist/client-base-VDDIADAC.cjs +0 -9
- package/dist/compaction-D3KV2NWY.cjs +0 -31
- package/dist/devtools-WTC3NFNE.cjs +0 -6
- package/dist/file-history-HZWO2WQ5.js +0 -7
- package/dist/file-history-UQQILIY7.cjs +0 -7
- package/dist/manager-FWLOVEEK.cjs +0 -7
- package/dist/manager-GEXJLOIS.js +0 -7
- package/dist/mcp-manager-37GQLFGX.js +0 -8
- package/dist/mcp-manager-U77NEXBY.cjs +0 -8
- package/dist/memory-ADGOWADP.cjs +0 -9
- package/dist/openai-RXU5URYI.js +0 -10
- package/dist/openai-SQW4H2K4.cjs +0 -10
- package/dist/openrouter-models-PLCWZZYE.cjs +0 -15
- package/dist/openrouter-sync-K2WK3A2A.cjs +0 -11
- package/dist/services/compact.d.ts +0 -56
- package/dist/session-manager-HRSKENKB.cjs +0 -8
- package/dist/session-manager-NEKFEHF3.js +0 -8
- package/dist/updater-J7L7R6BY.cjs +0 -185
- package/dist/updater-LDBNYCAO.js +0 -185
|
@@ -11,9 +11,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
11
11
|
var __esm = (fn, res) => function __init() {
|
|
12
12
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
13
|
};
|
|
14
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
-
};
|
|
17
14
|
var __export = (target, all) => {
|
|
18
15
|
for (var name in all)
|
|
19
16
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -31,17 +28,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
28
|
// node_modules/.pnpm/tsup@8.5.1_postcss@8.5.8_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js
|
|
32
29
|
import path from "path";
|
|
33
30
|
import { fileURLToPath } from "url";
|
|
31
|
+
var getFilename, getDirname, __dirname, __filename;
|
|
34
32
|
var init_esm_shims = __esm({
|
|
35
33
|
"node_modules/.pnpm/tsup@8.5.1_postcss@8.5.8_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js"() {
|
|
36
34
|
"use strict";
|
|
35
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
36
|
+
getDirname = () => path.dirname(getFilename());
|
|
37
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
38
|
+
__filename = /* @__PURE__ */ getFilename();
|
|
37
39
|
}
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
export {
|
|
41
43
|
__require,
|
|
42
44
|
__esm,
|
|
43
|
-
__commonJS,
|
|
44
45
|
__export,
|
|
45
46
|
__toCommonJS,
|
|
47
|
+
__dirname,
|
|
48
|
+
__filename,
|
|
46
49
|
init_esm_shims
|
|
47
50
|
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk52LGZKT3cjs = require('./chunk-52LGZKT3.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
|
|
10
|
+
|
|
11
|
+
// src/llm/model-fetcher.ts
|
|
12
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
13
|
+
var _fs = require('fs');
|
|
14
|
+
var _url = require('url');
|
|
15
|
+
var _path = require('path');
|
|
16
|
+
|
|
17
|
+
// src/llm/provider-kinds.ts
|
|
18
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
19
|
+
var NON_CHAT_PATTERNS = /(?:^|[-_/])(?:embed(?:ding)?|whisper|tts|audio|image|dall-?e|moderation|rerank|guard|vision-only)(?:$|[-_/])/i;
|
|
20
|
+
var isChatLike = (id) => !NON_CHAT_PATTERNS.test(id);
|
|
21
|
+
var bearer = (k) => k ? { Authorization: `Bearer ${k}` } : {};
|
|
22
|
+
var PROVIDER_KINDS = {
|
|
23
|
+
openai: {
|
|
24
|
+
label: "OpenAI",
|
|
25
|
+
defaultBaseUrl: "https://api.openai.com/v1",
|
|
26
|
+
modelsPath: "/models",
|
|
27
|
+
protocol: "openai-compat",
|
|
28
|
+
authHeader: bearer,
|
|
29
|
+
chatFilter: isChatLike
|
|
30
|
+
},
|
|
31
|
+
anthropic: {
|
|
32
|
+
label: "Anthropic",
|
|
33
|
+
defaultBaseUrl: "https://api.anthropic.com/v1",
|
|
34
|
+
modelsPath: "/models",
|
|
35
|
+
protocol: "anthropic-style",
|
|
36
|
+
authHeader: (k) => k ? { "x-api-key": k, "anthropic-version": "2023-06-01" } : { "anthropic-version": "2023-06-01" },
|
|
37
|
+
chatFilter: isChatLike
|
|
38
|
+
},
|
|
39
|
+
deepseek: {
|
|
40
|
+
label: "DeepSeek",
|
|
41
|
+
defaultBaseUrl: "https://api.deepseek.com/v1",
|
|
42
|
+
modelsPath: "/models",
|
|
43
|
+
protocol: "openai-compat",
|
|
44
|
+
authHeader: bearer,
|
|
45
|
+
chatFilter: isChatLike
|
|
46
|
+
},
|
|
47
|
+
xai: {
|
|
48
|
+
label: "xAI (Grok)",
|
|
49
|
+
defaultBaseUrl: "https://api.x.ai/v1",
|
|
50
|
+
modelsPath: "/models",
|
|
51
|
+
protocol: "openai-compat",
|
|
52
|
+
authHeader: bearer,
|
|
53
|
+
chatFilter: isChatLike
|
|
54
|
+
},
|
|
55
|
+
mistral: {
|
|
56
|
+
label: "Mistral",
|
|
57
|
+
defaultBaseUrl: "https://api.mistral.ai/v1",
|
|
58
|
+
modelsPath: "/models",
|
|
59
|
+
protocol: "openai-compat",
|
|
60
|
+
authHeader: bearer,
|
|
61
|
+
chatFilter: isChatLike
|
|
62
|
+
},
|
|
63
|
+
groq: {
|
|
64
|
+
label: "Groq",
|
|
65
|
+
defaultBaseUrl: "https://api.groq.com/openai/v1",
|
|
66
|
+
modelsPath: "/models",
|
|
67
|
+
protocol: "openai-compat",
|
|
68
|
+
authHeader: bearer,
|
|
69
|
+
chatFilter: isChatLike
|
|
70
|
+
},
|
|
71
|
+
google: {
|
|
72
|
+
label: "Google Gemini",
|
|
73
|
+
defaultBaseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
74
|
+
modelsPath: "/models",
|
|
75
|
+
protocol: "gemini",
|
|
76
|
+
authHeader: () => ({}),
|
|
77
|
+
authQuery: (k) => k ? { key: k } : {},
|
|
78
|
+
chatFilter: (id) => isChatLike(id) && /gemini/i.test(id)
|
|
79
|
+
},
|
|
80
|
+
openrouter: {
|
|
81
|
+
label: "OpenRouter",
|
|
82
|
+
defaultBaseUrl: "https://openrouter.ai/api/v1",
|
|
83
|
+
modelsPath: "/models",
|
|
84
|
+
protocol: "openai-compat",
|
|
85
|
+
authHeader: bearer,
|
|
86
|
+
chatFilter: isChatLike
|
|
87
|
+
},
|
|
88
|
+
ollama: {
|
|
89
|
+
label: "Ollama (local)",
|
|
90
|
+
defaultBaseUrl: "http://localhost:11434",
|
|
91
|
+
modelsPath: "/api/tags",
|
|
92
|
+
protocol: "ollama",
|
|
93
|
+
authHeader: () => ({}),
|
|
94
|
+
chatFilter: isChatLike
|
|
95
|
+
},
|
|
96
|
+
custom: {
|
|
97
|
+
label: "Custom",
|
|
98
|
+
defaultBaseUrl: "",
|
|
99
|
+
modelsPath: "/models",
|
|
100
|
+
protocol: "openai-compat",
|
|
101
|
+
authHeader: bearer,
|
|
102
|
+
chatFilter: isChatLike
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
function getKindMeta(kind) {
|
|
106
|
+
return _nullishCoalesce(PROVIDER_KINDS[kind], () => ( PROVIDER_KINDS.custom));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// src/llm/model-fetcher.ts
|
|
110
|
+
var HERE = _path.dirname.call(void 0, _url.fileURLToPath.call(void 0, _chunkKS3RYAYLcjs.importMetaUrl));
|
|
111
|
+
var OPENROUTER_SNAPSHOT = _path.join.call(void 0, HERE, "..", "data", "openrouter-models.json");
|
|
112
|
+
async function fetchModelList(provider, opts) {
|
|
113
|
+
const meta = getKindMeta(provider.kind);
|
|
114
|
+
if (!opts.refresh) {
|
|
115
|
+
const cached = _chunk52LGZKT3cjs.readCache.call(void 0, opts.cacheDir, provider.key);
|
|
116
|
+
if (cached && !_chunk52LGZKT3cjs.isStale.call(void 0, cached)) return { ...cached, fromCache: true };
|
|
117
|
+
}
|
|
118
|
+
if (provider.kind === "openrouter") {
|
|
119
|
+
return loadOpenRouterSnapshot(provider.key, opts.cacheDir);
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
const path = _nullishCoalesce(provider.modelsPath, () => ( meta.modelsPath));
|
|
123
|
+
const url = new URL(joinUrl(provider.baseUrl, path));
|
|
124
|
+
const headers = meta.authHeader(_nullishCoalesce(provider.apiKey, () => ( "")));
|
|
125
|
+
if (meta.authQuery) {
|
|
126
|
+
const q = meta.authQuery(_nullishCoalesce(provider.apiKey, () => ( "")));
|
|
127
|
+
for (const [k, v] of Object.entries(q)) url.searchParams.set(k, v);
|
|
128
|
+
}
|
|
129
|
+
const res = await fetch(url.toString(), {
|
|
130
|
+
headers: { Accept: "application/json", ...headers },
|
|
131
|
+
signal: AbortSignal.timeout(_nullishCoalesce(opts.timeoutMs, () => ( 2e4)))
|
|
132
|
+
});
|
|
133
|
+
if (!res.ok) {
|
|
134
|
+
return errorResult(provider.key, opts.cacheDir, `HTTP ${res.status}`);
|
|
135
|
+
}
|
|
136
|
+
const payload = await res.json();
|
|
137
|
+
const raw = normalize(payload, meta.protocol);
|
|
138
|
+
const filtered = raw.filter((m) => meta.chatFilter(m.id));
|
|
139
|
+
const file = _chunk52LGZKT3cjs.writeCache.call(void 0, opts.cacheDir, provider.key, filtered);
|
|
140
|
+
return file;
|
|
141
|
+
} catch (err) {
|
|
142
|
+
const msg = err.message || String(err);
|
|
143
|
+
return errorResult(provider.key, opts.cacheDir, msg);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function normalize(payload, protocol) {
|
|
147
|
+
switch (protocol) {
|
|
148
|
+
case "ollama": {
|
|
149
|
+
const p = payload;
|
|
150
|
+
return (_nullishCoalesce(p.models, () => ( []))).map((m) => ({ id: m.name, contextLength: 0, maxOutputTokens: 0 }));
|
|
151
|
+
}
|
|
152
|
+
case "anthropic-style": {
|
|
153
|
+
const p = payload;
|
|
154
|
+
return (_nullishCoalesce(p.data, () => ( []))).map((m) => ({
|
|
155
|
+
id: m.id,
|
|
156
|
+
contextLength: _nullishCoalesce(m.context_window, () => ( 2e5)),
|
|
157
|
+
maxOutputTokens: _nullishCoalesce(m.max_output_tokens, () => ( 0))
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
case "gemini": {
|
|
161
|
+
const p = payload;
|
|
162
|
+
return (_nullishCoalesce(p.models, () => ( []))).map((m) => ({
|
|
163
|
+
id: m.name.replace(/^models\//, ""),
|
|
164
|
+
contextLength: _nullishCoalesce(m.inputTokenLimit, () => ( 0)),
|
|
165
|
+
maxOutputTokens: _nullishCoalesce(m.outputTokenLimit, () => ( 0))
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
case "openai-compat": {
|
|
169
|
+
const p = payload;
|
|
170
|
+
return (_nullishCoalesce(p.data, () => ( []))).map((m) => ({
|
|
171
|
+
id: m.id,
|
|
172
|
+
contextLength: _nullishCoalesce(_nullishCoalesce(m.context_window, () => ( m.context_length)), () => ( 0)),
|
|
173
|
+
maxOutputTokens: _nullishCoalesce(m.max_completion_tokens, () => ( 0))
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const _exhaustive = protocol;
|
|
178
|
+
return _exhaustive;
|
|
179
|
+
}
|
|
180
|
+
function loadOpenRouterSnapshot(providerKey, cacheDir) {
|
|
181
|
+
if (!_fs.existsSync.call(void 0, OPENROUTER_SNAPSHOT)) {
|
|
182
|
+
return errorResult(providerKey, cacheDir, "openrouter snapshot missing");
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
const snapshot = JSON.parse(
|
|
186
|
+
_fs.readFileSync.call(void 0, OPENROUTER_SNAPSHOT, "utf-8")
|
|
187
|
+
);
|
|
188
|
+
const models = (_nullishCoalesce(snapshot.models, () => ( []))).map((m) => ({
|
|
189
|
+
id: m.id,
|
|
190
|
+
contextLength: _nullishCoalesce(m.contextLength, () => ( 0)),
|
|
191
|
+
maxOutputTokens: _nullishCoalesce(m.maxOutputTokens, () => ( 0))
|
|
192
|
+
}));
|
|
193
|
+
return _chunk52LGZKT3cjs.writeCache.call(void 0, cacheDir, providerKey, models);
|
|
194
|
+
} catch (err) {
|
|
195
|
+
return errorResult(providerKey, cacheDir, err.message);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function errorResult(providerKey, cacheDir, error) {
|
|
199
|
+
const stale = _chunk52LGZKT3cjs.readCache.call(void 0, cacheDir, providerKey);
|
|
200
|
+
if (stale) return { ...stale, error, fromCache: true };
|
|
201
|
+
return {
|
|
202
|
+
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
203
|
+
providerKey,
|
|
204
|
+
models: [],
|
|
205
|
+
error
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function joinUrl(base, path) {
|
|
209
|
+
if (!base) return path;
|
|
210
|
+
return `${base.replace(/\/$/, "")}${path.startsWith("/") ? "" : "/"}${path}`;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
exports.PROVIDER_KINDS = PROVIDER_KINDS; exports.fetchModelList = fetchModelList;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2YW4FPFGcjs = require('./chunk-2YW4FPFG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
|
|
7
7
|
|
|
8
8
|
// src/session/session-manager.ts
|
|
9
|
-
|
|
9
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
10
10
|
var _fs = require('fs');
|
|
11
11
|
var _path = require('path');
|
|
12
12
|
var _os = require('os');
|
|
13
13
|
var _nanoid = require('nanoid');
|
|
14
14
|
|
|
15
15
|
// src/session/transcript.ts
|
|
16
|
-
|
|
16
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -218,11 +218,11 @@ var SessionManager = class {
|
|
|
218
218
|
resume(sessionId) {
|
|
219
219
|
const sessionDir = _path.join.call(void 0, this.sessionsDir, sessionId);
|
|
220
220
|
if (!_fs.existsSync.call(void 0, sessionDir)) {
|
|
221
|
-
throw new (0,
|
|
221
|
+
throw new (0, _chunk2YW4FPFGcjs.SessionError)(`Session not found: ${sessionId}`);
|
|
222
222
|
}
|
|
223
223
|
const stateFile = _path.join.call(void 0, sessionDir, "state.json");
|
|
224
224
|
if (!_fs.existsSync.call(void 0, stateFile)) {
|
|
225
|
-
throw new (0,
|
|
225
|
+
throw new (0, _chunk2YW4FPFGcjs.SessionError)(`Session state file not found: ${sessionId}`);
|
|
226
226
|
}
|
|
227
227
|
const state = JSON.parse(_fs.readFileSync.call(void 0, stateFile, "utf-8"));
|
|
228
228
|
const transcriptFile = _path.join.call(void 0, sessionDir, "transcript.jsonl");
|