jinzd-ai-cli 0.4.150 → 0.4.153
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/{auth-7KK5BOCA.js → auth-OI4YRVRG.js} +1 -1
- package/dist/{batch-KGBSTQU3.js → batch-DBRN4MCC.js} +2 -2
- package/dist/{chat-index-MY3DJTV3.js → chat-index-BE4TPLFH.js} +1 -1
- package/dist/{chat-index-JBF4ZIQI.js → chat-index-LUQWWLKO.js} +1 -1
- package/dist/{chunk-ONOVJIL2.js → chunk-AIZOARZY.js} +1 -1
- package/dist/{chunk-QXRDETAI.js → chunk-D62BVFP7.js} +1 -1
- package/dist/{chunk-PASCDYMH.js → chunk-D6U75FHP.js} +14 -10
- package/dist/{chunk-D5KUERWQ.js → chunk-EIIMBVXN.js} +3 -3
- package/dist/{chunk-V6L44Y3F.js → chunk-EYJQJZJ6.js} +1 -1
- package/dist/{chunk-O7NM4WTS.js → chunk-GXB7YKF2.js} +3 -1
- package/dist/{chunk-UQQJWHRV.js → chunk-HDSKW7Q3.js} +1 -1
- package/dist/{chunk-TUGKYLIV.js → chunk-LJPB4ZER.js} +1 -1
- package/dist/{chunk-YJ2CUK5O.js → chunk-M4GJOBWN.js} +2 -1
- package/dist/{chunk-OWPFDHKC.js → chunk-NXXNLLSG.js} +1 -0
- package/dist/{chunk-PCDBAZJK.js → chunk-OP3I24WL.js} +99 -24
- package/dist/{chunk-XYM3PCVR.js → chunk-OT2HLGSO.js} +1 -1
- package/dist/{chunk-7ZJN4KLV.js → chunk-RXM76HB7.js} +1 -2
- package/dist/{chunk-WJ32NAW3.js → chunk-T5VKNPLD.js} +1 -2
- package/dist/{chunk-G6LBSAVY.js → chunk-TURORFH2.js} +1 -1
- package/dist/{chunk-RCDS54ZC.js → chunk-UWW3EWER.js} +1 -1
- package/dist/{chunk-NKR53CPL.js → chunk-YKVFZLSI.js} +1 -1
- package/dist/{chunk-2DXY7UGF.js → chunk-ZWVIDFGY.js} +14 -10
- package/dist/{ci-XHNSTENI.js → ci-UEEUSELV.js} +4 -4
- package/dist/{constants-U2QQSUYK.js → constants-43EVHE2E.js} +1 -1
- package/dist/{doctor-cli-5LFGU2TS.js → doctor-cli-ZT674MCQ.js} +6 -6
- package/dist/electron-server.js +121 -39
- package/dist/{hub-OGEDS4X7.js → hub-MDQNJOMV.js} +61 -3
- package/dist/{hub-server-AUMVPNU6.js → hub-server-VPXCBWLA.js} +1 -1
- package/dist/index.js +28 -26
- package/dist/{run-tests-YSHH37SS.js → run-tests-DCT5LWBB.js} +1 -1
- package/dist/{run-tests-Q7COBDVK.js → run-tests-EYZ2JZ4X.js} +2 -2
- package/dist/{semantic-V37U4MCW.js → semantic-FKOEXY75.js} +2 -2
- package/dist/{semantic-IJKF5ZZC.js → semantic-GJJWTI3A.js} +2 -2
- package/dist/{server-J2GQRZP3.js → server-MQWFO2GJ.js} +8 -8
- package/dist/{server-5HDA5MNI.js → server-OIYBFKS2.js} +25 -21
- package/dist/{task-orchestrator-XBPAOLYD.js → task-orchestrator-BGQBNKAI.js} +8 -8
- package/dist/{vector-store-AK6J3RIA.js → vector-store-PLDSXF3V.js} +1 -1
- package/dist/{vector-store-MCQ77OOJ.js → vector-store-Z5OF4WWJ.js} +1 -1
- package/dist/web/client/app.js +2 -1
- package/dist/web/client/index.html +10 -6
- package/dist/web/client/sw.js +15 -26
- package/dist/web/client/vendor/daisyui-full.min.css +20 -0
- package/dist/web/client/vendor/github-dark.min.css +10 -0
- package/dist/web/client/vendor/github.min.css +10 -0
- package/dist/web/client/vendor/highlight.min.js +1213 -0
- package/dist/web/client/vendor/marked.min.js +69 -0
- package/dist/web/client/vendor/tailwind.js +83 -0
- package/package.json +172 -172
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UWW3EWER.js";
|
|
5
5
|
import "./chunk-2ZD3YTVM.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-D62BVFP7.js";
|
|
7
7
|
import "./chunk-PDX44BCA.js";
|
|
8
8
|
|
|
9
9
|
// src/cli/batch.ts
|
|
@@ -91,14 +91,12 @@ function searchVectorStore(store, queryVec, k) {
|
|
|
91
91
|
throw new Error(`searchVectorStore: dim mismatch (query=${queryVec.length}, store=${store.dim})`);
|
|
92
92
|
}
|
|
93
93
|
const { count, dim, vectors, symbolIdx } = store;
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
heap[0] = hit;
|
|
101
|
-
heap.sort((a, b) => a.score - b.score);
|
|
94
|
+
const top = [];
|
|
95
|
+
let minSlot = -1;
|
|
96
|
+
const recomputeMin = () => {
|
|
97
|
+
minSlot = 0;
|
|
98
|
+
for (let i = 1; i < top.length; i++) {
|
|
99
|
+
if (top[i].score < top[minSlot].score) minSlot = i;
|
|
102
100
|
}
|
|
103
101
|
};
|
|
104
102
|
for (let row = 0; row < count; row++) {
|
|
@@ -107,9 +105,15 @@ function searchVectorStore(store, queryVec, k) {
|
|
|
107
105
|
for (let d = 0; d < dim; d++) {
|
|
108
106
|
score += vectors[base + d] * queryVec[d];
|
|
109
107
|
}
|
|
110
|
-
|
|
108
|
+
if (top.length < k) {
|
|
109
|
+
top.push({ row, symbolIdx: symbolIdx[row], score });
|
|
110
|
+
if (top.length === k) recomputeMin();
|
|
111
|
+
} else if (score > top[minSlot].score) {
|
|
112
|
+
top[minSlot] = { row, symbolIdx: symbolIdx[row], score };
|
|
113
|
+
recomputeMin();
|
|
114
|
+
}
|
|
111
115
|
}
|
|
112
|
-
return
|
|
116
|
+
return top.sort((a, b) => b.score - a.score);
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OP3I24WL.js";
|
|
5
5
|
import {
|
|
6
6
|
APP_NAME,
|
|
7
7
|
CONFIG_DIR_NAME,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
MCP_PROTOCOL_VERSION,
|
|
12
12
|
MCP_TOOL_PREFIX,
|
|
13
13
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-D62BVFP7.js";
|
|
15
15
|
import {
|
|
16
16
|
redactJson
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RXM76HB7.js";
|
|
18
18
|
|
|
19
19
|
// src/session/session-manager.ts
|
|
20
20
|
import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync, unlinkSync, renameSync, openSync, readSync, closeSync } from "fs";
|
|
@@ -132,7 +132,9 @@ var AuthManager = class {
|
|
|
132
132
|
if (parts.length !== 2) return null;
|
|
133
133
|
const [payloadB64, signature] = parts;
|
|
134
134
|
const expectedSig = this.sign(payloadB64);
|
|
135
|
-
|
|
135
|
+
const sigBuf = Buffer.from(signature ?? "", "utf-8");
|
|
136
|
+
const expBuf = Buffer.from(expectedSig, "utf-8");
|
|
137
|
+
if (sigBuf.length !== expBuf.length || !timingSafeEqual(sigBuf, expBuf)) return null;
|
|
136
138
|
const payload = JSON.parse(
|
|
137
139
|
Buffer.from(payloadB64, "base64url").toString("utf-8")
|
|
138
140
|
);
|
|
@@ -232,7 +232,8 @@ function renderHubBanner(topic, roles, maxRounds, contextFiles) {
|
|
|
232
232
|
console.log(chalk.bold.white(" \u2551") + chalk.dim(" Participants:".padEnd(62)) + chalk.bold.white("\u2551"));
|
|
233
233
|
for (const role of roles) {
|
|
234
234
|
const color = colorMap.get(role.id) ?? chalk.white;
|
|
235
|
-
const
|
|
235
|
+
const backend = role.provider ? chalk.dim(` \xB7 ${role.provider}${role.model ? `:${role.model}` : ""}`) : "";
|
|
236
|
+
const line = ` ${color("\u25CF")} ${color.bold(role.name)} ${chalk.dim(`(${role.id})`)}${backend}`;
|
|
236
237
|
console.log(chalk.bold.white(" \u2551") + line + " ".repeat(Math.max(0, 62 - stripAnsi(line).length)) + chalk.bold.white("\u2551"));
|
|
237
238
|
}
|
|
238
239
|
console.log(chalk.bold.white(" \u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"));
|
|
@@ -21,6 +21,7 @@ function getDangerLevel(toolName, args) {
|
|
|
21
21
|
if (/\btee\b|\bcp\b|\bmv\b|\bln\s+-s/.test(cmd)) return "write";
|
|
22
22
|
if (/\bchmod\b|\bchown\b/.test(cmd)) return "write";
|
|
23
23
|
if (/\bSet-Content\b|\bOut-File\b|\bAdd-Content\b|\bCopy-Item\b|\bMove-Item\b|\bSet-ItemProperty\b|\bNew-ItemProperty\b/i.test(cmd)) return "write";
|
|
24
|
+
if (/\b(python3?|node|deno|bun|perl|ruby|php)\b[^\n]*?\s-(?:c|e|p|r)\b/i.test(cmd)) return "write";
|
|
24
25
|
return "safe";
|
|
25
26
|
}
|
|
26
27
|
if (toolName === "write_file") return "write";
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
hasSemanticIndex,
|
|
4
4
|
semanticSearch
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HDSKW7Q3.js";
|
|
6
6
|
import {
|
|
7
7
|
runTestsTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OT2HLGSO.js";
|
|
9
9
|
import {
|
|
10
10
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EYJQJZJ6.js";
|
|
12
12
|
import {
|
|
13
13
|
getDangerLevel,
|
|
14
14
|
isFileWriteTool
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NXXNLLSG.js";
|
|
16
16
|
import {
|
|
17
17
|
EnvLoader,
|
|
18
18
|
NetworkError,
|
|
@@ -25,14 +25,14 @@ import {
|
|
|
25
25
|
SUBAGENT_ALLOWED_TOOLS,
|
|
26
26
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
27
27
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-D62BVFP7.js";
|
|
29
29
|
import {
|
|
30
30
|
fileCheckpoints
|
|
31
31
|
} from "./chunk-4BKXL7SM.js";
|
|
32
32
|
import {
|
|
33
33
|
loadChatIndex,
|
|
34
34
|
searchChatMemory
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-RXM76HB7.js";
|
|
36
36
|
import {
|
|
37
37
|
indexProject
|
|
38
38
|
} from "./chunk-VNNYHW6N.js";
|
|
@@ -1225,7 +1225,7 @@ function checkPermission(toolName, args, dangerLevel, rules, defaultAction = "co
|
|
|
1225
1225
|
if (rule.when.pathPattern) {
|
|
1226
1226
|
if (toolName === "bash" && rule.action === "auto-approve") {
|
|
1227
1227
|
const cmd = String(args["command"] ?? "").trim();
|
|
1228
|
-
if (/[
|
|
1228
|
+
if (/[;&|`$<>\n\r]/.test(cmd) || /\$\(/.test(cmd)) continue;
|
|
1229
1229
|
if (!cmd.startsWith(rule.when.pathPattern)) continue;
|
|
1230
1230
|
} else {
|
|
1231
1231
|
const path3 = String(args["path"] ?? args["command"] ?? "");
|
|
@@ -3203,6 +3203,8 @@ ${stderr}`);
|
|
|
3203
3203
|
|
|
3204
3204
|
// src/tools/builtin/web-fetch.ts
|
|
3205
3205
|
import { promises as dnsPromises } from "dns";
|
|
3206
|
+
import net from "net";
|
|
3207
|
+
import { Agent } from "undici";
|
|
3206
3208
|
function htmlToText(html) {
|
|
3207
3209
|
let text = html.replace(/<script[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "").replace(/<noscript[\s\S]*?<\/noscript>/gi, "").replace(/<svg[\s\S]*?<\/svg>/gi, "");
|
|
3208
3210
|
const HTML_REGEX_LIMIT = 2e5;
|
|
@@ -3246,34 +3248,100 @@ function extractDescription(html) {
|
|
|
3246
3248
|
return m ? m[1].trim() : "";
|
|
3247
3249
|
}
|
|
3248
3250
|
var MAX_OUTPUT = 16e3;
|
|
3251
|
+
function parseIpPart(s) {
|
|
3252
|
+
if (/^0x[0-9a-f]+$/i.test(s)) return parseInt(s, 16);
|
|
3253
|
+
if (/^0[0-7]+$/.test(s)) return parseInt(s, 8);
|
|
3254
|
+
if (/^[1-9]\d*$/.test(s) || s === "0") return parseInt(s, 10);
|
|
3255
|
+
return null;
|
|
3256
|
+
}
|
|
3257
|
+
function normalizeIpv4(h) {
|
|
3258
|
+
const parts = h.split(".");
|
|
3259
|
+
if (parts.length === 1) {
|
|
3260
|
+
const n = parseIpPart(parts[0]);
|
|
3261
|
+
if (n === null || n < 0 || n > 4294967295) return null;
|
|
3262
|
+
return [n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, n & 255].join(".");
|
|
3263
|
+
}
|
|
3264
|
+
if (parts.length === 4) {
|
|
3265
|
+
const nums = parts.map(parseIpPart);
|
|
3266
|
+
if (nums.some((n) => n === null || n < 0 || n > 255)) return null;
|
|
3267
|
+
return nums.join(".");
|
|
3268
|
+
}
|
|
3269
|
+
return null;
|
|
3270
|
+
}
|
|
3271
|
+
function isPrivateIpv4(ip) {
|
|
3272
|
+
const m = ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
3273
|
+
if (!m) return false;
|
|
3274
|
+
const [o1, o2] = [Number(m[1]), Number(m[2])];
|
|
3275
|
+
if (o1 === 127) return true;
|
|
3276
|
+
if (o1 === 10) return true;
|
|
3277
|
+
if (o1 === 172 && o2 >= 16 && o2 <= 31) return true;
|
|
3278
|
+
if (o1 === 192 && o2 === 168) return true;
|
|
3279
|
+
if (o1 === 169 && o2 === 254) return true;
|
|
3280
|
+
if (o1 === 0) return true;
|
|
3281
|
+
if (o1 >= 224) return true;
|
|
3282
|
+
return false;
|
|
3283
|
+
}
|
|
3284
|
+
function isPrivateIpv6(ip) {
|
|
3285
|
+
const h = ip.toLowerCase().replace(/%.*$/, "");
|
|
3286
|
+
if (h === "::1" || h === "::") return true;
|
|
3287
|
+
const first = h.split(":")[0] ?? "";
|
|
3288
|
+
if (/^f[cd]/.test(first)) return true;
|
|
3289
|
+
if (/^fe[89ab]/.test(first)) return true;
|
|
3290
|
+
const mapped = h.match(/::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
|
|
3291
|
+
if (mapped) return isPrivateIpv4(mapped[1]);
|
|
3292
|
+
const mappedHex = h.match(/::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);
|
|
3293
|
+
if (mappedHex) {
|
|
3294
|
+
const hi = parseInt(mappedHex[1], 16), lo = parseInt(mappedHex[2], 16);
|
|
3295
|
+
const v4 = [hi >> 8 & 255, hi & 255, lo >> 8 & 255, lo & 255].join(".");
|
|
3296
|
+
return isPrivateIpv4(v4);
|
|
3297
|
+
}
|
|
3298
|
+
return false;
|
|
3299
|
+
}
|
|
3300
|
+
function isPrivateAddr(ip) {
|
|
3301
|
+
if (net.isIPv4(ip)) return isPrivateIpv4(ip);
|
|
3302
|
+
if (net.isIPv6(ip)) return isPrivateIpv6(ip);
|
|
3303
|
+
return false;
|
|
3304
|
+
}
|
|
3249
3305
|
function isPrivateHost(hostname) {
|
|
3250
3306
|
const h = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
3251
|
-
if (h === "localhost" || h === "
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
if (
|
|
3255
|
-
const [o1, o2] = [Number(m[1]), Number(m[2])];
|
|
3256
|
-
if (o1 === 127) return true;
|
|
3257
|
-
if (o1 === 10) return true;
|
|
3258
|
-
if (o1 === 172 && o2 >= 16 && o2 <= 31) return true;
|
|
3259
|
-
if (o1 === 192 && o2 === 168) return true;
|
|
3260
|
-
if (o1 === 169 && o2 === 254) return true;
|
|
3261
|
-
if (o1 === 0) return true;
|
|
3262
|
-
}
|
|
3307
|
+
if (h === "localhost" || h === "") return true;
|
|
3308
|
+
const v4 = normalizeIpv4(h);
|
|
3309
|
+
if (v4) return isPrivateIpv4(v4);
|
|
3310
|
+
if (net.isIPv6(h)) return isPrivateIpv6(h);
|
|
3263
3311
|
return false;
|
|
3264
3312
|
}
|
|
3265
3313
|
async function resolveAndCheck(hostname) {
|
|
3266
3314
|
const h = hostname.replace(/^\[|\]$/g, "");
|
|
3267
|
-
if (
|
|
3315
|
+
if (net.isIP(h) !== 0 || normalizeIpv4(h)) return;
|
|
3268
3316
|
try {
|
|
3269
|
-
const
|
|
3270
|
-
|
|
3271
|
-
|
|
3317
|
+
const addrs = await dnsPromises.lookup(h, { all: true, verbatim: true });
|
|
3318
|
+
for (const { address } of addrs) {
|
|
3319
|
+
if (isPrivateAddr(address)) {
|
|
3320
|
+
throw new NetworkError(`Blocked: "${hostname}" resolves to private address ${address}. web_fetch is restricted to public URLs.`);
|
|
3321
|
+
}
|
|
3272
3322
|
}
|
|
3273
3323
|
} catch (e) {
|
|
3274
3324
|
if (e.message.startsWith("Blocked:")) throw e;
|
|
3275
3325
|
}
|
|
3276
3326
|
}
|
|
3327
|
+
function ssrfSafeDispatcher() {
|
|
3328
|
+
return new Agent({
|
|
3329
|
+
connect: {
|
|
3330
|
+
lookup: (hostname, options, cb) => {
|
|
3331
|
+
dnsPromises.lookup(hostname, { all: true, verbatim: true }).then((addrs) => {
|
|
3332
|
+
for (const a of addrs) {
|
|
3333
|
+
if (isPrivateAddr(a.address)) {
|
|
3334
|
+
cb(new NetworkError(`Blocked: "${hostname}" resolves to private address ${a.address}.`), null);
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
if (options && options.all) cb(null, addrs);
|
|
3339
|
+
else cb(null, addrs[0].address, addrs[0].family);
|
|
3340
|
+
}).catch((err) => cb(err, null));
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
});
|
|
3344
|
+
}
|
|
3277
3345
|
var webFetchTool = {
|
|
3278
3346
|
definition: {
|
|
3279
3347
|
name: "web_fetch",
|
|
@@ -3318,6 +3386,7 @@ var webFetchTool = {
|
|
|
3318
3386
|
Accept: "text/html,application/xhtml+xml,text/plain,*/*",
|
|
3319
3387
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8"
|
|
3320
3388
|
};
|
|
3389
|
+
const dispatcher = ssrfSafeDispatcher();
|
|
3321
3390
|
try {
|
|
3322
3391
|
let currentUrl = url;
|
|
3323
3392
|
let resp = null;
|
|
@@ -3330,8 +3399,9 @@ var webFetchTool = {
|
|
|
3330
3399
|
const r = await fetch(currentUrl, {
|
|
3331
3400
|
signal: controller2.signal,
|
|
3332
3401
|
headers: FETCH_HEADERS,
|
|
3333
|
-
redirect: "manual"
|
|
3402
|
+
redirect: "manual",
|
|
3334
3403
|
// 手动控制重定向
|
|
3404
|
+
dispatcher
|
|
3335
3405
|
});
|
|
3336
3406
|
if (r.status >= 300 && r.status < 400) {
|
|
3337
3407
|
if (hop >= MAX_REDIRECTS) {
|
|
@@ -3362,7 +3432,12 @@ var webFetchTool = {
|
|
|
3362
3432
|
if (err.name === "AbortError") {
|
|
3363
3433
|
throw new NetworkError(`Request timed out after 20s: ${url}`, void 0, err);
|
|
3364
3434
|
}
|
|
3435
|
+
const cause = err.cause;
|
|
3436
|
+
if (cause?.message?.startsWith("Blocked:")) throw new NetworkError(cause.message);
|
|
3365
3437
|
throw err;
|
|
3438
|
+
} finally {
|
|
3439
|
+
void dispatcher.close().catch(() => {
|
|
3440
|
+
});
|
|
3366
3441
|
}
|
|
3367
3442
|
let text;
|
|
3368
3443
|
if (contentType.includes("text/plain") || contentType.includes("application/json")) {
|
|
@@ -80,10 +80,9 @@ function redactString(input, options) {
|
|
|
80
80
|
const hits = [];
|
|
81
81
|
for (const { kind, regex } of patterns) {
|
|
82
82
|
const rx = new RegExp(regex.source, regex.flags);
|
|
83
|
+
const captureCount = new RegExp(rx.source + "|").exec("").length - 1;
|
|
83
84
|
redacted = redacted.replace(rx, (...args) => {
|
|
84
85
|
const match = args[0];
|
|
85
|
-
const probe = new RegExp(rx.source).exec(match);
|
|
86
|
-
const captureCount = probe ? probe.length - 1 : 0;
|
|
87
86
|
const g1 = captureCount >= 1 ? args[1] : void 0;
|
|
88
87
|
const g2 = captureCount >= 2 ? args[2] : void 0;
|
|
89
88
|
const offset = args[1 + captureCount];
|
|
@@ -79,10 +79,9 @@ function redactString(input, options) {
|
|
|
79
79
|
const hits = [];
|
|
80
80
|
for (const { kind, regex } of patterns) {
|
|
81
81
|
const rx = new RegExp(regex.source, regex.flags);
|
|
82
|
+
const captureCount = new RegExp(rx.source + "|").exec("").length - 1;
|
|
82
83
|
redacted = redacted.replace(rx, (...args) => {
|
|
83
84
|
const match = args[0];
|
|
84
|
-
const probe = new RegExp(rx.source).exec(match);
|
|
85
|
-
const captureCount = probe ? probe.length - 1 : 0;
|
|
86
85
|
const g1 = captureCount >= 1 ? args[1] : void 0;
|
|
87
86
|
const g2 = captureCount >= 2 ? args[2] : void 0;
|
|
88
87
|
const offset = args[1 + captureCount];
|
|
@@ -92,14 +92,12 @@ function searchVectorStore(store, queryVec, k) {
|
|
|
92
92
|
throw new Error(`searchVectorStore: dim mismatch (query=${queryVec.length}, store=${store.dim})`);
|
|
93
93
|
}
|
|
94
94
|
const { count, dim, vectors, symbolIdx } = store;
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
heap[0] = hit;
|
|
102
|
-
heap.sort((a, b) => a.score - b.score);
|
|
95
|
+
const top = [];
|
|
96
|
+
let minSlot = -1;
|
|
97
|
+
const recomputeMin = () => {
|
|
98
|
+
minSlot = 0;
|
|
99
|
+
for (let i = 1; i < top.length; i++) {
|
|
100
|
+
if (top[i].score < top[minSlot].score) minSlot = i;
|
|
103
101
|
}
|
|
104
102
|
};
|
|
105
103
|
for (let row = 0; row < count; row++) {
|
|
@@ -108,9 +106,15 @@ function searchVectorStore(store, queryVec, k) {
|
|
|
108
106
|
for (let d = 0; d < dim; d++) {
|
|
109
107
|
score += vectors[base + d] * queryVec[d];
|
|
110
108
|
}
|
|
111
|
-
|
|
109
|
+
if (top.length < k) {
|
|
110
|
+
top.push({ row, symbolIdx: symbolIdx[row], score });
|
|
111
|
+
if (top.length === k) recomputeMin();
|
|
112
|
+
} else if (score > top[minSlot].score) {
|
|
113
|
+
top[minSlot] = { row, symbolIdx: symbolIdx[row], score };
|
|
114
|
+
recomputeMin();
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
|
-
return
|
|
117
|
+
return top.sort((a, b) => b.score - a.score);
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
export {
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-HLWUDRBO.js";
|
|
7
7
|
import {
|
|
8
8
|
ProviderRegistry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AIZOARZY.js";
|
|
10
10
|
import {
|
|
11
11
|
ConfigManager
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-UWW3EWER.js";
|
|
13
|
+
import "./chunk-NXXNLLSG.js";
|
|
14
14
|
import "./chunk-2ZD3YTVM.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-D62BVFP7.js";
|
|
18
18
|
import "./chunk-PDX44BCA.js";
|
|
19
19
|
|
|
20
20
|
// src/cli/ci.ts
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TURORFH2.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AIZOARZY.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UWW3EWER.js";
|
|
12
12
|
import {
|
|
13
13
|
getStatsSnapshot,
|
|
14
14
|
getTopFailingTools,
|
|
15
15
|
getTopUsedTools,
|
|
16
16
|
resetStats
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-EYJQJZJ6.js";
|
|
18
|
+
import "./chunk-NXXNLLSG.js";
|
|
19
19
|
import "./chunk-2ZD3YTVM.js";
|
|
20
20
|
import {
|
|
21
21
|
DEV_STATE_FILE_NAME,
|
|
22
22
|
MEMORY_FILE_NAME,
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-D62BVFP7.js";
|
|
25
25
|
import "./chunk-PDX44BCA.js";
|
|
26
26
|
|
|
27
27
|
// src/diagnostics/doctor-cli.ts
|