jinzd-ai-cli 0.4.268 → 0.4.270
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/dist/{batch-2N2YMRX2.js → batch-IMLMUXJL.js} +2 -2
- package/dist/{chunk-UT2WAJJG.js → chunk-75SPJKDY.js} +1 -1
- package/dist/{chunk-RRQZRSXW.js → chunk-BOMB6XCF.js} +1 -1
- package/dist/{chunk-74BK22BM.js → chunk-DIJIYWQE.js} +4 -4
- package/dist/{chunk-VGVKJTHF.js → chunk-F26YTEMB.js} +9 -1
- package/dist/{chunk-Z7CZ72RP.js → chunk-FXCDD7JS.js} +3 -3
- package/dist/{chunk-YLSM7RF6.js → chunk-HOT76ATM.js} +3 -3
- package/dist/{chunk-EPVJS4F6.js → chunk-JJVVCWO4.js} +1 -1
- package/dist/{chunk-R7GERZDA.js → chunk-JT6UN5C6.js} +26 -5
- package/dist/{chunk-2FQGMR34.js → chunk-M3GDYEUH.js} +1 -1
- package/dist/{chunk-7US7K3CD.js → chunk-PLFXDRNX.js} +1 -1
- package/dist/{chunk-WWLXW4SY.js → chunk-TG4PF7FZ.js} +1 -1
- package/dist/{chunk-XDITAGE5.js → chunk-UDUE4DAE.js} +1 -1
- package/dist/{chunk-VNCBY4KY.js → chunk-X3JPBJ6C.js} +163 -3
- package/dist/{chunk-WNG3YVZX.js → chunk-YHLTSZVH.js} +1 -1
- package/dist/{ci-3RWVJSZ3.js → ci-HQVXWJ53.js} +4 -4
- package/dist/{ci-format-M6HVCXCG.js → ci-format-762IL4OM.js} +2 -2
- package/dist/{constants-G6VN7SJL.js → constants-4TPE3JSV.js} +1 -1
- package/dist/{doctor-cli-Y3SVVJBO.js → doctor-cli-3ES6NFVL.js} +4 -4
- package/dist/electron-server.js +300 -55
- package/dist/{hub-5T5HKOAR.js → hub-QXRWPBJP.js} +1 -1
- package/dist/index.js +68 -155
- package/dist/{persistent-memory-XVSSR277.js → persistent-memory-F4JPWYZJ.js} +2 -2
- package/dist/{persistent-memory-YBWIZWQP.js → persistent-memory-URIJJJ3N.js} +2 -2
- package/dist/{pr-NF5IWLH3.js → pr-HVVHZOJ2.js} +4 -4
- package/dist/{run-tests-Y44SCLIO.js → run-tests-UZG6SVJ5.js} +2 -2
- package/dist/{run-tests-33X3D7PV.js → run-tests-WM7TMO2N.js} +2 -2
- package/dist/{server-3LERX42X.js → server-E5OBXT33.js} +5 -5
- package/dist/{server-NJ3ZNPQW.js → server-HPRLFLOI.js} +112 -35
- package/dist/{task-orchestrator-JN2WFZSF.js → task-orchestrator-HJUUL55Y.js} +5 -5
- package/dist/{usage-IFTNXTWC.js → usage-L3DUPHD6.js} +11 -4
- package/dist/web/client/actions.js.br +0 -0
- package/dist/web/client/actions.js.gz +0 -0
- package/dist/web/client/api.js.br +0 -0
- package/dist/web/client/api.js.gz +0 -0
- package/dist/web/client/app.js +3 -6
- package/dist/web/client/app.js.br +0 -0
- package/dist/web/client/app.js.gz +0 -0
- package/dist/web/client/dom.js.br +0 -0
- package/dist/web/client/dom.js.gz +0 -0
- package/dist/web/client/icon.svg.br +0 -0
- package/dist/web/client/icon.svg.gz +0 -0
- package/dist/web/client/index.html.br +0 -0
- package/dist/web/client/index.html.gz +0 -0
- package/dist/web/client/sidebar-tabs.js.br +0 -0
- package/dist/web/client/sidebar-tabs.js.gz +0 -0
- package/dist/web/client/state.js.br +0 -0
- package/dist/web/client/state.js.gz +0 -0
- package/dist/web/client/style.css.br +0 -0
- package/dist/web/client/style.css.gz +0 -0
- package/dist/web/client/sw.js.br +0 -0
- package/dist/web/client/sw.js.gz +0 -0
- package/dist/web/client/templates.js.br +0 -0
- package/dist/web/client/templates.js.gz +0 -0
- package/dist/web/client/util.js +22 -0
- package/dist/web/client/util.js.br +0 -0
- package/dist/web/client/util.js.gz +0 -0
- package/dist/web/client/vendor/daisyui-full.min.css.br +0 -0
- package/dist/web/client/vendor/daisyui-full.min.css.gz +0 -0
- package/dist/web/client/vendor/github-dark.min.css.br +0 -0
- package/dist/web/client/vendor/github-dark.min.css.gz +0 -0
- package/dist/web/client/vendor/github.min.css.br +0 -0
- package/dist/web/client/vendor/github.min.css.gz +0 -0
- package/dist/web/client/vendor/highlight.min.js.br +0 -0
- package/dist/web/client/vendor/highlight.min.js.gz +0 -0
- package/dist/web/client/vendor/marked.min.js.br +0 -0
- package/dist/web/client/vendor/marked.min.js.gz +0 -0
- package/dist/web/client/vendor/tailwind.js.br +0 -0
- package/dist/web/client/vendor/tailwind.js.gz +0 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F26YTEMB.js";
|
|
5
5
|
import "./chunk-TU3L3PW7.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-75SPJKDY.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFileSync
|
|
9
9
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
searchPersistentMemories,
|
|
8
8
|
touchMemoryReferences,
|
|
9
9
|
updateMemoryEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YHLTSZVH.js";
|
|
11
11
|
import {
|
|
12
12
|
indexProject
|
|
13
13
|
} from "./chunk-GLSR2NR3.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runHook,
|
|
27
27
|
runLifecycleHooks,
|
|
28
28
|
runTool
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-M3GDYEUH.js";
|
|
30
30
|
import {
|
|
31
31
|
buildTruncatedArgumentsError,
|
|
32
32
|
getDangerLevel,
|
|
@@ -43,14 +43,14 @@ import {
|
|
|
43
43
|
} from "./chunk-4BKXL7SM.js";
|
|
44
44
|
import {
|
|
45
45
|
runTestsTool
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-TG4PF7FZ.js";
|
|
47
47
|
import {
|
|
48
48
|
CONFIG_DIR_NAME,
|
|
49
49
|
DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
|
|
50
50
|
SUBAGENT_ALLOWED_TOOLS,
|
|
51
51
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
52
52
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-75SPJKDY.js";
|
|
54
54
|
import {
|
|
55
55
|
loadChatIndex,
|
|
56
56
|
searchChatMemory
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
CONFIG_FILE_NAME,
|
|
9
9
|
HISTORY_DIR_NAME,
|
|
10
10
|
PLUGINS_DIR_NAME
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-75SPJKDY.js";
|
|
12
12
|
import {
|
|
13
13
|
atomicWriteFileSync
|
|
14
14
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -102,6 +102,14 @@ var ConfigSchema = z.object({
|
|
|
102
102
|
wordWrap: z.number().int().min(0).default(0),
|
|
103
103
|
/** Skill 文件过大警告阈值(字符数)。超过此值的 skill 在启动加载时打印警告。0 = 静默。默认 10000 */
|
|
104
104
|
skillSizeWarn: z.number().int().min(0).default(1e4),
|
|
105
|
+
/**
|
|
106
|
+
* 成本显示币种:usd(默认)| cny。
|
|
107
|
+
*
|
|
108
|
+
* 只影响**展示**——存储、monthlyBudget、cost-history.json 恒为美元。
|
|
109
|
+
* 人民币按 pricing.ts 的记账汇率换算并在输出里标注,避免造出一个
|
|
110
|
+
* 看起来像实时汇率的假数字(2026-08-14 审计 P3-02)。
|
|
111
|
+
*/
|
|
112
|
+
currency: z.enum(["usd", "cny"]).default("usd"),
|
|
105
113
|
/** 颜色主题:'dark'(默认)| 'light' | 'custom' */
|
|
106
114
|
theme: z.enum(["dark", "light", "custom"]).default("dark"),
|
|
107
115
|
/** 自定义颜色覆盖(仅在 theme='custom' 时生效)。值为 chalk 颜色名或 '#hex',支持 'bold.cyan' 组合 */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
evaluateCiGate,
|
|
4
4
|
normalizeCiThresholds
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PLFXDRNX.js";
|
|
6
6
|
import {
|
|
7
7
|
buildReviewPrompt,
|
|
8
8
|
buildSecurityReviewPrompt,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from "./chunk-AUEX6RNY.js";
|
|
17
17
|
import {
|
|
18
18
|
ConfigManager
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-F26YTEMB.js";
|
|
20
20
|
import {
|
|
21
21
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-75SPJKDY.js";
|
|
23
23
|
|
|
24
24
|
// src/cli/ci.ts
|
|
25
25
|
import { execFileSync } from "child_process";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-AUEX6RNY.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfigManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-F26YTEMB.js";
|
|
8
8
|
import {
|
|
9
9
|
getActivePluginAssets,
|
|
10
10
|
getPendingHookTrust,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
listHooks,
|
|
15
15
|
listInstalledPlugins,
|
|
16
16
|
resetStats
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-M3GDYEUH.js";
|
|
18
18
|
import {
|
|
19
19
|
getGitRoot
|
|
20
20
|
} from "./chunk-HOSJZMQS.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
MCP_PROJECT_CONFIG_NAME,
|
|
27
27
|
MEMORY_FILE_NAME,
|
|
28
28
|
VERSION
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-75SPJKDY.js";
|
|
30
30
|
|
|
31
31
|
// src/diagnostics/doctor-report.ts
|
|
32
32
|
import { existsSync as existsSync3, statSync as statSync2 } from "fs";
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./chunk-IW3Q7AE5.js";
|
|
5
5
|
|
|
6
6
|
// src/core/pricing.ts
|
|
7
|
-
var
|
|
7
|
+
var CNY_PER_USD = 6.9;
|
|
8
8
|
var DEEPSEEK_TIME_PRICING_EFFECTIVE_AT = /* @__PURE__ */ new Date("2026-08-16T16:00:00.000Z");
|
|
9
9
|
function deepSeekCnyPricing(cacheRead, input, output) {
|
|
10
10
|
return {
|
|
11
|
-
cacheRead: cacheRead /
|
|
12
|
-
input: input /
|
|
13
|
-
output: output /
|
|
11
|
+
cacheRead: cacheRead / CNY_PER_USD,
|
|
12
|
+
input: input / CNY_PER_USD,
|
|
13
|
+
output: output / CNY_PER_USD
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
function getDeepSeekV4Pricing(model, at) {
|
|
@@ -138,12 +138,29 @@ function computeCost(provider, model, usage, at = /* @__PURE__ */ new Date()) {
|
|
|
138
138
|
const cacheRead = (usage.cacheReadTokens ?? 0) * (p.cacheRead ?? p.input);
|
|
139
139
|
return (input + output + cacheWrite + cacheRead) / 1e6;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
var displayCurrency = "usd";
|
|
142
|
+
function setCostCurrency(currency) {
|
|
143
|
+
displayCurrency = currency === "cny" ? "cny" : "usd";
|
|
144
|
+
}
|
|
145
|
+
function getCostCurrency() {
|
|
146
|
+
return displayCurrency;
|
|
147
|
+
}
|
|
148
|
+
function formatCost(amount, currency = displayCurrency) {
|
|
149
|
+
if (currency === "cny") {
|
|
150
|
+
const cny = amount * CNY_PER_USD;
|
|
151
|
+
if (cny === 0) return "\xA50.0000";
|
|
152
|
+
if (cny < 0.01) return `\xA5${cny.toFixed(4)}`;
|
|
153
|
+
if (cny < 1) return `\xA5${cny.toFixed(3)}`;
|
|
154
|
+
return `\xA5${cny.toFixed(2)}`;
|
|
155
|
+
}
|
|
142
156
|
if (amount === 0) return "$0.0000";
|
|
143
157
|
if (amount < 0.01) return `$${amount.toFixed(4)}`;
|
|
144
158
|
if (amount < 1) return `$${amount.toFixed(3)}`;
|
|
145
159
|
return `$${amount.toFixed(2)}`;
|
|
146
160
|
}
|
|
161
|
+
function currencyNote(currency = displayCurrency) {
|
|
162
|
+
return currency === "cny" ? `converted at \xA5${CNY_PER_USD}/$1 (accounting rate, not live FX)` : null;
|
|
163
|
+
}
|
|
147
164
|
|
|
148
165
|
// src/core/cost-tracker.ts
|
|
149
166
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -399,8 +416,12 @@ var CostTracker = class _CostTracker {
|
|
|
399
416
|
};
|
|
400
417
|
|
|
401
418
|
export {
|
|
419
|
+
CNY_PER_USD,
|
|
402
420
|
getPricing,
|
|
403
421
|
computeCost,
|
|
422
|
+
setCostCurrency,
|
|
423
|
+
getCostCurrency,
|
|
404
424
|
formatCost,
|
|
425
|
+
currencyNote,
|
|
405
426
|
CostTracker
|
|
406
427
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
computeCost
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JT6UN5C6.js";
|
|
5
5
|
import {
|
|
6
6
|
estimateTokens,
|
|
7
7
|
truncateForPersist
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DIJIYWQE.js";
|
|
9
|
+
import {
|
|
10
|
+
isMemoryExpired,
|
|
11
|
+
isMemoryStale
|
|
12
|
+
} from "./chunk-YHLTSZVH.js";
|
|
9
13
|
import {
|
|
10
14
|
APP_NAME,
|
|
11
15
|
CONFIG_DIR_NAME,
|
|
@@ -16,7 +20,7 @@ import {
|
|
|
16
20
|
MCP_PROTOCOL_VERSION,
|
|
17
21
|
MCP_TOOL_PREFIX,
|
|
18
22
|
VERSION
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-75SPJKDY.js";
|
|
20
24
|
import {
|
|
21
25
|
atomicWriteFileSync
|
|
22
26
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -893,6 +897,84 @@ Output the Markdown content directly, do not wrap the entire file in a code bloc
|
|
|
893
897
|
return parts.join("\n");
|
|
894
898
|
}
|
|
895
899
|
|
|
900
|
+
// src/core/memory-filters.ts
|
|
901
|
+
function parseFlags(items) {
|
|
902
|
+
const flags = {};
|
|
903
|
+
const text = [];
|
|
904
|
+
for (let i = 0; i < items.length; i++) {
|
|
905
|
+
const item = items[i];
|
|
906
|
+
if (item.startsWith("--")) {
|
|
907
|
+
const key = item.slice(2);
|
|
908
|
+
const next = items[i + 1];
|
|
909
|
+
if (next && !next.startsWith("--")) {
|
|
910
|
+
flags[key] = next;
|
|
911
|
+
i++;
|
|
912
|
+
} else {
|
|
913
|
+
flags[key] = true;
|
|
914
|
+
}
|
|
915
|
+
} else {
|
|
916
|
+
text.push(item);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return { flags, text: text.join(" ").trim() };
|
|
920
|
+
}
|
|
921
|
+
var SCOPES = /* @__PURE__ */ new Set(["personal", "project", "session", "team"]);
|
|
922
|
+
var BOOLEAN_FLAGS = ["pending", "orphaned"];
|
|
923
|
+
function parseMemoryShowFilters(args) {
|
|
924
|
+
const { flags, text } = parseFlags(args);
|
|
925
|
+
const strayTerms = [];
|
|
926
|
+
for (const key of BOOLEAN_FLAGS) {
|
|
927
|
+
const v = flags[key];
|
|
928
|
+
if (typeof v === "string") {
|
|
929
|
+
strayTerms.push(v);
|
|
930
|
+
flags[key] = true;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
const scopeRaw = flags["scope"];
|
|
934
|
+
const freeText = [text, ...strayTerms].filter(Boolean).join(" ").trim();
|
|
935
|
+
const searchRaw = typeof flags["search"] === "string" ? flags["search"] : freeText || void 0;
|
|
936
|
+
const staleRaw = flags["stale"];
|
|
937
|
+
let staleDays;
|
|
938
|
+
let invalidStale = false;
|
|
939
|
+
if (staleRaw !== void 0) {
|
|
940
|
+
const n = typeof staleRaw === "string" ? Number(staleRaw) : NaN;
|
|
941
|
+
if (!Number.isFinite(n) || n <= 0) invalidStale = true;
|
|
942
|
+
else staleDays = n;
|
|
943
|
+
}
|
|
944
|
+
return {
|
|
945
|
+
pending: flags["pending"] === true,
|
|
946
|
+
orphaned: flags["orphaned"] === true,
|
|
947
|
+
scope: typeof scopeRaw === "string" && SCOPES.has(scopeRaw) ? scopeRaw : void 0,
|
|
948
|
+
search: searchRaw?.toLowerCase(),
|
|
949
|
+
staleDays,
|
|
950
|
+
invalidStale
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
function filterMemoryEntries(entries, filters) {
|
|
954
|
+
let out = entries;
|
|
955
|
+
const applied = [];
|
|
956
|
+
if (filters.orphaned) applied.push("orphaned");
|
|
957
|
+
if (filters.pending) {
|
|
958
|
+
out = out.filter((m) => !m.approved && !isMemoryExpired(m));
|
|
959
|
+
applied.push("pending");
|
|
960
|
+
}
|
|
961
|
+
if (filters.scope) {
|
|
962
|
+
out = out.filter((m) => m.scope === filters.scope);
|
|
963
|
+
applied.push(`scope:${filters.scope}`);
|
|
964
|
+
}
|
|
965
|
+
if (filters.search) {
|
|
966
|
+
const q = filters.search;
|
|
967
|
+
out = out.filter((m) => m.content.toLowerCase().includes(q) || m.id.startsWith(q));
|
|
968
|
+
applied.push(`search:"${q}"`);
|
|
969
|
+
}
|
|
970
|
+
if (filters.staleDays !== void 0) {
|
|
971
|
+
const days = filters.staleDays;
|
|
972
|
+
out = out.filter((m) => isMemoryStale(m, days));
|
|
973
|
+
applied.push(`stale>${days}d`);
|
|
974
|
+
}
|
|
975
|
+
return { entries: out, applied };
|
|
976
|
+
}
|
|
977
|
+
|
|
896
978
|
// src/session/tool-history.ts
|
|
897
979
|
var SESSION_SIZE_LIMIT = 2 * 1024 * 1024;
|
|
898
980
|
function persistToolRound(session, toolCalls, toolResults, opts) {
|
|
@@ -1012,6 +1094,80 @@ function evaluateContextPressure(input) {
|
|
|
1012
1094
|
}
|
|
1013
1095
|
var AUTO_COMPACT_INSTRUCTION = "Preserve key context, compress old content, ensure seamless continuation";
|
|
1014
1096
|
|
|
1097
|
+
// src/core/model-router.ts
|
|
1098
|
+
var TAG_REGEX = /(?:^|\s)#([a-zA-Z][\w-]{0,31})\b/g;
|
|
1099
|
+
function extractTags(message) {
|
|
1100
|
+
const tags = /* @__PURE__ */ new Set();
|
|
1101
|
+
let m;
|
|
1102
|
+
TAG_REGEX.lastIndex = 0;
|
|
1103
|
+
while ((m = TAG_REGEX.exec(message)) !== null) {
|
|
1104
|
+
tags.add(m[1].toLowerCase());
|
|
1105
|
+
}
|
|
1106
|
+
return tags;
|
|
1107
|
+
}
|
|
1108
|
+
function matches(message, matcher) {
|
|
1109
|
+
const trimmed = message.trim();
|
|
1110
|
+
const lower = trimmed.toLowerCase();
|
|
1111
|
+
if (matcher.tag) {
|
|
1112
|
+
const tags = extractTags(trimmed);
|
|
1113
|
+
if (!tags.has(matcher.tag.toLowerCase())) return false;
|
|
1114
|
+
}
|
|
1115
|
+
if (matcher.contains && matcher.contains.length > 0) {
|
|
1116
|
+
const hit = matcher.contains.some((kw) => lower.includes(kw.toLowerCase()));
|
|
1117
|
+
if (!hit) return false;
|
|
1118
|
+
}
|
|
1119
|
+
if (typeof matcher.maxLength === "number") {
|
|
1120
|
+
if (trimmed.length > matcher.maxLength) return false;
|
|
1121
|
+
}
|
|
1122
|
+
if (typeof matcher.minLength === "number") {
|
|
1123
|
+
if (trimmed.length < matcher.minLength) return false;
|
|
1124
|
+
}
|
|
1125
|
+
const hasAnyCondition = !!matcher.tag || matcher.contains && matcher.contains.length > 0 || typeof matcher.maxLength === "number" || typeof matcher.minLength === "number";
|
|
1126
|
+
return !!hasAnyCondition;
|
|
1127
|
+
}
|
|
1128
|
+
function pickModel(message, currentModel, config, availableModels = []) {
|
|
1129
|
+
if (!config.enabled || config.rules.length === 0) {
|
|
1130
|
+
return { model: currentModel, reason: "routing disabled", overridden: false };
|
|
1131
|
+
}
|
|
1132
|
+
const isAvailable = (m) => availableModels.length === 0 || availableModels.includes(m);
|
|
1133
|
+
for (let i = 0; i < config.rules.length; i++) {
|
|
1134
|
+
const rule = config.rules[i];
|
|
1135
|
+
if (!matches(message, rule.match)) continue;
|
|
1136
|
+
if (!isAvailable(rule.model)) continue;
|
|
1137
|
+
if (rule.model === currentModel) {
|
|
1138
|
+
return {
|
|
1139
|
+
model: currentModel,
|
|
1140
|
+
reason: `rule "${rule.name ?? `#${i}`}" matched (same as current)`,
|
|
1141
|
+
overridden: false,
|
|
1142
|
+
ruleIdx: i
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
return {
|
|
1146
|
+
model: rule.model,
|
|
1147
|
+
reason: `rule "${rule.name ?? `#${i}`}" matched`,
|
|
1148
|
+
overridden: true,
|
|
1149
|
+
ruleIdx: i
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
if (config.fallback && config.fallback !== currentModel && isAvailable(config.fallback)) {
|
|
1153
|
+
return {
|
|
1154
|
+
model: config.fallback,
|
|
1155
|
+
reason: "fallback",
|
|
1156
|
+
overridden: true
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
return { model: currentModel, reason: "no rule matched", overridden: false };
|
|
1160
|
+
}
|
|
1161
|
+
function stripRoutingTags(message) {
|
|
1162
|
+
return message.replace(/(?:^|\s)#(fast|deep|default)\b/gi, " ").replace(/\s{2,}/g, " ").trim();
|
|
1163
|
+
}
|
|
1164
|
+
function decideModel(input) {
|
|
1165
|
+
if (!input.routingConfig || !input.routingConfig.enabled) {
|
|
1166
|
+
return { model: input.currentModel, reason: "routing disabled", overridden: false };
|
|
1167
|
+
}
|
|
1168
|
+
return pickModel(input.userInput, input.currentModel, input.routingConfig, input.availableModels);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1015
1171
|
// src/repl/dev-state.ts
|
|
1016
1172
|
import { existsSync as existsSync3, readFileSync as readFileSync3, unlinkSync, mkdirSync as mkdirSync2 } from "fs";
|
|
1017
1173
|
import { join as join3 } from "path";
|
|
@@ -1330,6 +1486,8 @@ export {
|
|
|
1330
1486
|
scanDirTree,
|
|
1331
1487
|
scanProject,
|
|
1332
1488
|
buildInitPrompt,
|
|
1489
|
+
parseMemoryShowFilters,
|
|
1490
|
+
filterMemoryEntries,
|
|
1333
1491
|
buildSessionCostReport,
|
|
1334
1492
|
costSourceNote,
|
|
1335
1493
|
parseSimpleYaml,
|
|
@@ -1338,6 +1496,8 @@ export {
|
|
|
1338
1496
|
estimateConversationTokens,
|
|
1339
1497
|
evaluateContextPressure,
|
|
1340
1498
|
AUTO_COMPACT_INSTRUCTION,
|
|
1499
|
+
stripRoutingTags,
|
|
1500
|
+
decideModel,
|
|
1341
1501
|
SNAPSHOT_PROMPT,
|
|
1342
1502
|
sessionHasMeaningfulContent,
|
|
1343
1503
|
saveDevState,
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
CI_COMMENT_MARKER,
|
|
4
4
|
countSeverity,
|
|
5
5
|
runCi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-FXCDD7JS.js";
|
|
7
|
+
import "./chunk-PLFXDRNX.js";
|
|
8
8
|
import "./chunk-HLWUDRBO.js";
|
|
9
9
|
import "./chunk-6YZEZFX5.js";
|
|
10
10
|
import "./chunk-AUEX6RNY.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-F26YTEMB.js";
|
|
12
12
|
import "./chunk-3OBY7WSS.js";
|
|
13
13
|
import "./chunk-TU3L3PW7.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-75SPJKDY.js";
|
|
15
15
|
import "./chunk-IW3Q7AE5.js";
|
|
16
16
|
export {
|
|
17
17
|
CI_COMMENT_MARKER,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatDoctorReport,
|
|
4
4
|
runDoctorCli
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HOT76ATM.js";
|
|
6
6
|
import "./chunk-AUEX6RNY.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-F26YTEMB.js";
|
|
8
|
+
import "./chunk-M3GDYEUH.js";
|
|
9
9
|
import "./chunk-3OBY7WSS.js";
|
|
10
10
|
import "./chunk-TU3L3PW7.js";
|
|
11
11
|
import "./chunk-HOSJZMQS.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-75SPJKDY.js";
|
|
13
13
|
import "./chunk-IW3Q7AE5.js";
|
|
14
14
|
export {
|
|
15
15
|
formatDoctorReport,
|