jinzd-ai-cli 0.4.142 → 0.4.144
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/README.md +2 -2
- package/README.zh-CN.md +1 -1
- package/dist/{batch-MJUH762U.js → batch-64YESATH.js} +2 -2
- package/dist/{chunk-KSLJCZCE.js → chunk-2JPLV25X.js} +1 -1
- package/dist/{chunk-BJAT4GNC.js → chunk-DQ2OHJNF.js} +15 -0
- package/dist/{chunk-INPG2HXR.js → chunk-EHLHWFZP.js} +1 -1
- package/dist/{chunk-3UZBSMNI.js → chunk-HUILGJNB.js} +1 -1
- package/dist/{chunk-DES5NNPU.js → chunk-IGZVCNGE.js} +2 -2
- package/dist/{chunk-MO7MWNWC.js → chunk-NKR53CPL.js} +1 -1
- package/dist/{chunk-6VRJGH25.js → chunk-OVWE4E46.js} +15 -0
- package/dist/{chunk-Q3ZEZHSU.js → chunk-PWCPOHZ4.js} +7 -7
- package/dist/{chunk-G3CH252E.js → chunk-QSGDXXE6.js} +1 -1
- package/dist/{chunk-RFQVUMDB.js → chunk-SEFOKYYP.js} +276 -5
- package/dist/{chunk-3BICTI5M.js → chunk-UQQJWHRV.js} +1 -1
- package/dist/{chunk-NHNWUBXB.js → chunk-VNNYHW6N.js} +276 -5
- package/dist/{chunk-WLZJANJO.js → chunk-WPYKTLP2.js} +22 -2
- package/dist/{chunk-NSTXHD33.js → chunk-XW4EP5IE.js} +1 -1
- package/dist/{chunk-UXGHSFGB.js → chunk-YGGW2D2V.js} +1 -1
- package/dist/{constants-QDFO3IJP.js → constants-7Q5DB2X6.js} +1 -1
- package/dist/{doctor-cli-CLKZYOOI.js → doctor-cli-RHGMQVCU.js} +5 -5
- package/dist/electron-server.js +30 -10
- package/dist/{hub-X4ISNM7B.js → hub-SXNKYCN7.js} +1 -1
- package/dist/index.js +234 -33
- package/dist/{indexer-Z6AQTGBK.js → indexer-ISSNIFQY.js} +2 -2
- package/dist/{indexer-XGY7XGJM.js → indexer-S6UMGQKA.js} +2 -2
- package/dist/{run-tests-3AYPKO5U.js → run-tests-SUYREW3B.js} +1 -1
- package/dist/{run-tests-QER6ETNZ.js → run-tests-X4YQXIGP.js} +2 -2
- package/dist/{semantic-FR2ZSQLY.js → semantic-IJKF5ZZC.js} +2 -2
- package/dist/{semantic-UFKVYKFE.js → semantic-V37U4MCW.js} +2 -2
- package/dist/{server-PBOIZFFD.js → server-MGKTVVAR.js} +7 -7
- package/dist/{server-FFPJP2GQ.js → server-X24SIKZE.js} +14 -14
- package/dist/{store-Q7NMUCPP.js → store-A3TZM6PS.js} +1 -1
- package/dist/{store-JDEW743P.js → store-VMK543OQ.js} +1 -1
- package/dist/{task-orchestrator-O4FTLSHK.js → task-orchestrator-R6VOCA4V.js} +7 -7
- package/dist/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/wasm/tree-sitter-go.wasm +0 -0
- package/dist/wasm/tree-sitter-java.wasm +0 -0
- package/dist/wasm/tree-sitter-rust.wasm +0 -0
- package/package.json +6 -2
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
removeFile,
|
|
7
7
|
saveIndex,
|
|
8
8
|
upsertFileSymbols
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OVWE4E46.js";
|
|
10
10
|
|
|
11
11
|
// src/symbols/indexer.ts
|
|
12
12
|
import fs2 from "fs";
|
|
@@ -30,7 +30,11 @@ var GRAMMAR_FILE = {
|
|
|
30
30
|
typescript: "tree-sitter-typescript.wasm",
|
|
31
31
|
tsx: "tree-sitter-tsx.wasm",
|
|
32
32
|
javascript: "tree-sitter-javascript.wasm",
|
|
33
|
-
python: "tree-sitter-python.wasm"
|
|
33
|
+
python: "tree-sitter-python.wasm",
|
|
34
|
+
go: "tree-sitter-go.wasm",
|
|
35
|
+
rust: "tree-sitter-rust.wasm",
|
|
36
|
+
java: "tree-sitter-java.wasm",
|
|
37
|
+
cpp: "tree-sitter-cpp.wasm"
|
|
34
38
|
};
|
|
35
39
|
var RUNTIME_WASM = "web-tree-sitter.wasm";
|
|
36
40
|
var parserInitPromise = null;
|
|
@@ -271,6 +275,253 @@ function extractPython(root, file) {
|
|
|
271
275
|
visit(root, void 0, true);
|
|
272
276
|
return out;
|
|
273
277
|
}
|
|
278
|
+
function extractGo(root, file) {
|
|
279
|
+
const out = [];
|
|
280
|
+
const isExported = (name) => /^[A-Z]/.test(name);
|
|
281
|
+
const pushTypeSpec = (spec) => {
|
|
282
|
+
const name = nameOf(spec);
|
|
283
|
+
if (!name) return;
|
|
284
|
+
const typeNode = childByFieldName(spec, "type");
|
|
285
|
+
let kind = "type";
|
|
286
|
+
if (typeNode?.type === "struct_type") kind = "class";
|
|
287
|
+
else if (typeNode?.type === "interface_type") kind = "interface";
|
|
288
|
+
out.push({
|
|
289
|
+
name,
|
|
290
|
+
kind,
|
|
291
|
+
language: "go",
|
|
292
|
+
location: locationOf(file, spec),
|
|
293
|
+
signature: firstLine(spec.text),
|
|
294
|
+
exported: isExported(name)
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
for (const child of root.children) {
|
|
298
|
+
if (!child) continue;
|
|
299
|
+
if (child.type === "function_declaration") {
|
|
300
|
+
const name = nameOf(child);
|
|
301
|
+
if (name) out.push({ name, kind: "function", language: "go", location: locationOf(file, child), signature: firstLine(child.text), exported: isExported(name) });
|
|
302
|
+
} else if (child.type === "method_declaration") {
|
|
303
|
+
const name = nameOf(child);
|
|
304
|
+
if (!name) continue;
|
|
305
|
+
const receiver = childByFieldName(child, "receiver");
|
|
306
|
+
let container;
|
|
307
|
+
if (receiver) {
|
|
308
|
+
const paramDecl = receiver.children.find((c) => c?.type === "parameter_declaration");
|
|
309
|
+
const typeNode = paramDecl ? childByFieldName(paramDecl, "type") : null;
|
|
310
|
+
if (typeNode) {
|
|
311
|
+
container = typeNode.text.replace(/^\*/, "").trim();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
out.push({ name, kind: "method", language: "go", location: locationOf(file, child), signature: firstLine(child.text), container, exported: isExported(name) });
|
|
315
|
+
} else if (child.type === "type_declaration") {
|
|
316
|
+
for (const spec of child.children) {
|
|
317
|
+
if (spec?.type === "type_spec" || spec?.type === "type_alias") pushTypeSpec(spec);
|
|
318
|
+
}
|
|
319
|
+
} else if (child.type === "const_declaration" || child.type === "var_declaration") {
|
|
320
|
+
for (const spec of child.children) {
|
|
321
|
+
if (spec?.type !== "const_spec" && spec?.type !== "var_spec") continue;
|
|
322
|
+
for (const id of spec.children) {
|
|
323
|
+
if (id?.type !== "identifier") continue;
|
|
324
|
+
out.push({ name: id.text, kind: "variable", language: "go", location: locationOf(file, spec), signature: firstLine(spec.text), exported: isExported(id.text) });
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return out;
|
|
330
|
+
}
|
|
331
|
+
function extractRust(root, file) {
|
|
332
|
+
const out = [];
|
|
333
|
+
const isPub = (node) => node.children.some((c) => c?.type === "visibility_modifier" && c.text.startsWith("pub"));
|
|
334
|
+
const visit = (node, container) => {
|
|
335
|
+
const kindMap = {
|
|
336
|
+
function_item: container ? "method" : "function",
|
|
337
|
+
struct_item: "class",
|
|
338
|
+
union_item: "class",
|
|
339
|
+
enum_item: "enum",
|
|
340
|
+
trait_item: "interface",
|
|
341
|
+
type_item: "type",
|
|
342
|
+
const_item: "variable",
|
|
343
|
+
static_item: "variable",
|
|
344
|
+
macro_definition: "function",
|
|
345
|
+
mod_item: "module"
|
|
346
|
+
};
|
|
347
|
+
const kind = kindMap[node.type];
|
|
348
|
+
if (kind) {
|
|
349
|
+
const name = nameOf(node);
|
|
350
|
+
if (name) {
|
|
351
|
+
out.push({ name, kind, language: "rust", location: locationOf(file, node), signature: firstLine(node.text), container, exported: isPub(node) });
|
|
352
|
+
if (node.type === "mod_item") {
|
|
353
|
+
const body = childByFieldName(node, "body");
|
|
354
|
+
if (body) for (const c of body.children) {
|
|
355
|
+
if (c) visit(c, name);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (node.type === "impl_item") {
|
|
362
|
+
const typeNode = childByFieldName(node, "type");
|
|
363
|
+
const implContainer = typeNode?.text.trim();
|
|
364
|
+
const body = childByFieldName(node, "body");
|
|
365
|
+
if (body) for (const c of body.children) {
|
|
366
|
+
if (c) visit(c, implContainer);
|
|
367
|
+
}
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (node.type === "source_file" || node.type === "declaration_list") {
|
|
371
|
+
for (const c of node.children) {
|
|
372
|
+
if (c) visit(c, container);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
visit(root, void 0);
|
|
377
|
+
return out;
|
|
378
|
+
}
|
|
379
|
+
function extractJava(root, file) {
|
|
380
|
+
const out = [];
|
|
381
|
+
const isPublic = (node) => {
|
|
382
|
+
const mods = node.children.find((c) => c?.type === "modifiers");
|
|
383
|
+
return !!mods && mods.children.some((c) => c?.type === "public" || c?.text === "public");
|
|
384
|
+
};
|
|
385
|
+
const visit = (node, container) => {
|
|
386
|
+
const containerKindMap = {
|
|
387
|
+
class_declaration: "class",
|
|
388
|
+
interface_declaration: "interface",
|
|
389
|
+
enum_declaration: "enum",
|
|
390
|
+
record_declaration: "class",
|
|
391
|
+
annotation_type_declaration: "interface"
|
|
392
|
+
};
|
|
393
|
+
const containerKind = containerKindMap[node.type];
|
|
394
|
+
if (containerKind) {
|
|
395
|
+
const name = nameOf(node);
|
|
396
|
+
if (name) {
|
|
397
|
+
out.push({ name, kind: containerKind, language: "java", location: locationOf(file, node), signature: firstLine(node.text), container, exported: isPublic(node) });
|
|
398
|
+
const body = node.children.find((c) => c?.type === "class_body" || c?.type === "interface_body" || c?.type === "enum_body" || c?.type === "record_body" || c?.type === "annotation_type_body");
|
|
399
|
+
if (body) for (const c of body.children) {
|
|
400
|
+
if (c) visit(c, name);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (node.type === "method_declaration" || node.type === "constructor_declaration" || node.type === "compact_constructor_declaration") {
|
|
406
|
+
const name = nameOf(node);
|
|
407
|
+
if (name) out.push({ name, kind: "method", language: "java", location: locationOf(file, node), signature: firstLine(node.text), container, exported: isPublic(node) });
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (node.type === "field_declaration") {
|
|
411
|
+
const exported = isPublic(node);
|
|
412
|
+
for (const c of node.children) {
|
|
413
|
+
if (c?.type !== "variable_declarator") continue;
|
|
414
|
+
const id = childByFieldName(c, "name");
|
|
415
|
+
if (id?.type === "identifier") out.push({ name: id.text, kind: "property", language: "java", location: locationOf(file, c), signature: firstLine(node.text), container, exported });
|
|
416
|
+
}
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (node.type === "program") {
|
|
420
|
+
for (const c of node.children) {
|
|
421
|
+
if (c) visit(c, container);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
visit(root, void 0);
|
|
426
|
+
return out;
|
|
427
|
+
}
|
|
428
|
+
function extractCpp(root, file) {
|
|
429
|
+
const out = [];
|
|
430
|
+
const declaratorName = (decl) => {
|
|
431
|
+
if (!decl) return null;
|
|
432
|
+
if (decl.type === "identifier" || decl.type === "field_identifier" || decl.type === "type_identifier") {
|
|
433
|
+
return { name: decl.text };
|
|
434
|
+
}
|
|
435
|
+
if (decl.type === "qualified_identifier") {
|
|
436
|
+
const text = decl.text;
|
|
437
|
+
const idx = text.lastIndexOf("::");
|
|
438
|
+
if (idx >= 0) return { name: text.slice(idx + 2), container: text.slice(0, idx) };
|
|
439
|
+
return { name: text };
|
|
440
|
+
}
|
|
441
|
+
if (decl.type === "destructor_name" || decl.type === "operator_name") {
|
|
442
|
+
return { name: decl.text };
|
|
443
|
+
}
|
|
444
|
+
const inner = childByFieldName(decl, "declarator");
|
|
445
|
+
if (inner) return declaratorName(inner);
|
|
446
|
+
return null;
|
|
447
|
+
};
|
|
448
|
+
const visit = (node, container) => {
|
|
449
|
+
if (node.type === "template_declaration") {
|
|
450
|
+
for (const c of node.children) {
|
|
451
|
+
if (c && (c.type === "function_definition" || c.type === "class_specifier" || c.type === "struct_specifier" || c.type === "declaration")) {
|
|
452
|
+
visit(c, container);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (node.type === "function_definition") {
|
|
458
|
+
const decl = childByFieldName(node, "declarator");
|
|
459
|
+
const info = declaratorName(decl);
|
|
460
|
+
if (info) {
|
|
461
|
+
const finalContainer = info.container ?? container;
|
|
462
|
+
out.push({
|
|
463
|
+
name: info.name,
|
|
464
|
+
kind: finalContainer ? "method" : "function",
|
|
465
|
+
language: "cpp",
|
|
466
|
+
location: locationOf(file, node),
|
|
467
|
+
signature: firstLine(node.text),
|
|
468
|
+
container: finalContainer
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const specMap = {
|
|
474
|
+
class_specifier: "class",
|
|
475
|
+
struct_specifier: "class",
|
|
476
|
+
union_specifier: "class",
|
|
477
|
+
enum_specifier: "enum"
|
|
478
|
+
};
|
|
479
|
+
const specKind = specMap[node.type];
|
|
480
|
+
if (specKind) {
|
|
481
|
+
const name = nameOf(node);
|
|
482
|
+
if (name) {
|
|
483
|
+
out.push({ name, kind: specKind, language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
484
|
+
const body = node.children.find((c) => c?.type === "field_declaration_list" || c?.type === "enumerator_list");
|
|
485
|
+
if (body) for (const c of body.children) {
|
|
486
|
+
if (c) visit(c, name);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (node.type === "namespace_definition") {
|
|
492
|
+
const name = nameOf(node) ?? "<anonymous>";
|
|
493
|
+
out.push({ name, kind: "module", language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
494
|
+
const body = childByFieldName(node, "body");
|
|
495
|
+
if (body) for (const c of body.children) {
|
|
496
|
+
if (c) visit(c, name);
|
|
497
|
+
}
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (node.type === "type_definition" || node.type === "alias_declaration") {
|
|
501
|
+
const decl = node.children[node.children.length - 1];
|
|
502
|
+
const info = decl ? declaratorName(decl) : null;
|
|
503
|
+
if (info) out.push({ name: info.name, kind: "type", language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (node.type === "field_declaration" && container) {
|
|
507
|
+
const hasFn = node.children.some((c) => c?.type === "function_declarator" || c?.type === "pointer_declarator" && c.children.some((x) => x?.type === "function_declarator"));
|
|
508
|
+
if (hasFn) return;
|
|
509
|
+
for (const c of node.children) {
|
|
510
|
+
if (c?.type === "field_identifier") {
|
|
511
|
+
out.push({ name: c.text, kind: "property", language: "cpp", location: locationOf(file, node), signature: firstLine(node.text), container });
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (node.type === "translation_unit" || node.type === "declaration_list" || node.type === "linkage_specification") {
|
|
517
|
+
for (const c of node.children) {
|
|
518
|
+
if (c) visit(c, container);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
visit(root, void 0);
|
|
523
|
+
return out;
|
|
524
|
+
}
|
|
274
525
|
async function parseSource(file, source, language) {
|
|
275
526
|
const lang = language ?? detectLanguage(path2.extname(file).slice(1));
|
|
276
527
|
if (!lang) return [];
|
|
@@ -279,8 +530,20 @@ async function parseSource(file, source, language) {
|
|
|
279
530
|
const tree = parser.parse(source);
|
|
280
531
|
if (!tree) return [];
|
|
281
532
|
const root = tree.rootNode;
|
|
282
|
-
|
|
283
|
-
|
|
533
|
+
switch (lang) {
|
|
534
|
+
case "python":
|
|
535
|
+
return extractPython(root, file);
|
|
536
|
+
case "go":
|
|
537
|
+
return extractGo(root, file);
|
|
538
|
+
case "rust":
|
|
539
|
+
return extractRust(root, file);
|
|
540
|
+
case "java":
|
|
541
|
+
return extractJava(root, file);
|
|
542
|
+
case "cpp":
|
|
543
|
+
return extractCpp(root, file);
|
|
544
|
+
default:
|
|
545
|
+
return extractTsJs(root, file, lang);
|
|
546
|
+
}
|
|
284
547
|
} catch (err) {
|
|
285
548
|
return [];
|
|
286
549
|
}
|
|
@@ -304,7 +567,15 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
|
304
567
|
"venv",
|
|
305
568
|
".idea",
|
|
306
569
|
".vscode",
|
|
307
|
-
"release"
|
|
570
|
+
"release",
|
|
571
|
+
"target",
|
|
572
|
+
// Rust (cargo build) + Java (Maven)
|
|
573
|
+
"vendor",
|
|
574
|
+
// Go (vendored deps)
|
|
575
|
+
".gradle",
|
|
576
|
+
// Java (Gradle)
|
|
577
|
+
"cmake-build-debug",
|
|
578
|
+
"cmake-build-release"
|
|
308
579
|
]);
|
|
309
580
|
var MAX_FILE_BYTES = 2 * 1024 * 1024;
|
|
310
581
|
function collectFiles(root, maxFiles) {
|
|
@@ -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-XW4EP5IE.js";
|
|
12
12
|
|
|
13
13
|
// src/config/config-manager.ts
|
|
14
14
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -235,7 +235,27 @@ var ConfigSchema = z.object({
|
|
|
235
235
|
name: z.string().optional()
|
|
236
236
|
})).default([]),
|
|
237
237
|
fallback: z.string().optional()
|
|
238
|
-
}).default({ enabled: false, rules: [] })
|
|
238
|
+
}).default({ enabled: false, rules: [] }),
|
|
239
|
+
// Provider 容错(v0.4.144+):网络抖动 / 5xx / 429 时,先在当前 provider 上做指数退避重试,
|
|
240
|
+
// 仍失败则按顺序尝试 chain 里的 fallback provider。auth / 400 / 422 等"硬失败"直接跳过同
|
|
241
|
+
// provider 重试,但仍会尝试 chain(不同 key/schema 可能能成功)。
|
|
242
|
+
// 关键约束:流式 API 一旦已经向终端 yield 过 chunk,错误立刻向上抛 —— 不能"已经吐了一半"再
|
|
243
|
+
// 重新发起请求,会撕裂用户看到的输出。
|
|
244
|
+
// enabled 默认 false:保持向前兼容,未配置 chain 的用户行为不变。
|
|
245
|
+
fallback: z.object({
|
|
246
|
+
enabled: z.boolean().default(false),
|
|
247
|
+
/** 同 provider 重试次数(不含首次调用)。0 = 不重试,直接走 chain。 */
|
|
248
|
+
retries: z.number().int().min(0).max(10).default(2),
|
|
249
|
+
/** 首次退避等待(ms),后续按 2 的幂指数增长。 */
|
|
250
|
+
initialBackoffMs: z.number().int().positive().default(500),
|
|
251
|
+
/** 单次退避的硬上限(ms)。 */
|
|
252
|
+
maxBackoffMs: z.number().int().positive().default(8e3),
|
|
253
|
+
/** 兜底 provider 链,每个 entry 仅尝试 1 次。model 省略则使用 provider 的 defaultModel。 */
|
|
254
|
+
chain: z.array(z.object({
|
|
255
|
+
provider: z.string(),
|
|
256
|
+
model: z.string().optional()
|
|
257
|
+
})).default([])
|
|
258
|
+
}).default({ enabled: false, retries: 2, initialBackoffMs: 500, maxBackoffMs: 8e3, chain: [] })
|
|
239
259
|
});
|
|
240
260
|
|
|
241
261
|
// src/config/config-manager.ts
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HUILGJNB.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EHLHWFZP.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WPYKTLP2.js";
|
|
12
12
|
import {
|
|
13
13
|
getStatsSnapshot,
|
|
14
14
|
getTopFailingTools,
|
|
15
15
|
getTopUsedTools,
|
|
16
16
|
resetStats
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QSGDXXE6.js";
|
|
18
18
|
import "./chunk-2ZD3YTVM.js";
|
|
19
19
|
import {
|
|
20
20
|
DEV_STATE_FILE_NAME,
|
|
21
21
|
MEMORY_FILE_NAME,
|
|
22
22
|
VERSION
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XW4EP5IE.js";
|
|
24
24
|
import "./chunk-PDX44BCA.js";
|
|
25
25
|
|
|
26
26
|
// src/diagnostics/doctor-cli.ts
|
package/dist/electron-server.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-SKET65WZ.js";
|
|
4
4
|
import {
|
|
5
5
|
indexProject
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SEFOKYYP.js";
|
|
7
7
|
import {
|
|
8
8
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
9
9
|
APP_NAME,
|
|
@@ -36,14 +36,14 @@ import {
|
|
|
36
36
|
VERSION,
|
|
37
37
|
buildUserIdentityPrompt,
|
|
38
38
|
runTestsTool
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-YGGW2D2V.js";
|
|
40
40
|
import {
|
|
41
41
|
hasSemanticIndex,
|
|
42
42
|
semanticSearch
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-NKR53CPL.js";
|
|
44
44
|
import {
|
|
45
45
|
loadIndex
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-DQ2OHJNF.js";
|
|
47
47
|
import "./chunk-PASCDYMH.js";
|
|
48
48
|
import {
|
|
49
49
|
loadChatIndex,
|
|
@@ -286,7 +286,27 @@ var ConfigSchema = z.object({
|
|
|
286
286
|
name: z.string().optional()
|
|
287
287
|
})).default([]),
|
|
288
288
|
fallback: z.string().optional()
|
|
289
|
-
}).default({ enabled: false, rules: [] })
|
|
289
|
+
}).default({ enabled: false, rules: [] }),
|
|
290
|
+
// Provider 容错(v0.4.144+):网络抖动 / 5xx / 429 时,先在当前 provider 上做指数退避重试,
|
|
291
|
+
// 仍失败则按顺序尝试 chain 里的 fallback provider。auth / 400 / 422 等"硬失败"直接跳过同
|
|
292
|
+
// provider 重试,但仍会尝试 chain(不同 key/schema 可能能成功)。
|
|
293
|
+
// 关键约束:流式 API 一旦已经向终端 yield 过 chunk,错误立刻向上抛 —— 不能"已经吐了一半"再
|
|
294
|
+
// 重新发起请求,会撕裂用户看到的输出。
|
|
295
|
+
// enabled 默认 false:保持向前兼容,未配置 chain 的用户行为不变。
|
|
296
|
+
fallback: z.object({
|
|
297
|
+
enabled: z.boolean().default(false),
|
|
298
|
+
/** 同 provider 重试次数(不含首次调用)。0 = 不重试,直接走 chain。 */
|
|
299
|
+
retries: z.number().int().min(0).max(10).default(2),
|
|
300
|
+
/** 首次退避等待(ms),后续按 2 的幂指数增长。 */
|
|
301
|
+
initialBackoffMs: z.number().int().positive().default(500),
|
|
302
|
+
/** 单次退避的硬上限(ms)。 */
|
|
303
|
+
maxBackoffMs: z.number().int().positive().default(8e3),
|
|
304
|
+
/** 兜底 provider 链,每个 entry 仅尝试 1 次。model 省略则使用 provider 的 defaultModel。 */
|
|
305
|
+
chain: z.array(z.object({
|
|
306
|
+
provider: z.string(),
|
|
307
|
+
model: z.string().optional()
|
|
308
|
+
})).default([])
|
|
309
|
+
}).default({ enabled: false, retries: 2, initialBackoffMs: 500, maxBackoffMs: 8e3, chain: [] })
|
|
290
310
|
});
|
|
291
311
|
|
|
292
312
|
// src/config/env-loader.ts
|
|
@@ -5789,7 +5809,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
5789
5809
|
const mode = appendMode ? "appended" : "written";
|
|
5790
5810
|
void (async () => {
|
|
5791
5811
|
try {
|
|
5792
|
-
const { updateFile } = await import("./indexer-
|
|
5812
|
+
const { updateFile } = await import("./indexer-ISSNIFQY.js");
|
|
5793
5813
|
await updateFile(process.cwd(), filePath);
|
|
5794
5814
|
} catch {
|
|
5795
5815
|
}
|
|
@@ -12310,8 +12330,8 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
12310
12330
|
case "index": {
|
|
12311
12331
|
const sub = (args[0] ?? "status").toLowerCase();
|
|
12312
12332
|
const root = process.cwd();
|
|
12313
|
-
const { loadIndex: loadIndex2, clearIndex } = await import("./store-
|
|
12314
|
-
const { indexProject: indexProject2 } = await import("./indexer-
|
|
12333
|
+
const { loadIndex: loadIndex2, clearIndex } = await import("./store-A3TZM6PS.js");
|
|
12334
|
+
const { indexProject: indexProject2 } = await import("./indexer-ISSNIFQY.js");
|
|
12315
12335
|
const { loadVectorStore, clearVectorStore } = await import("./vector-store-AK6J3RIA.js");
|
|
12316
12336
|
if (sub === "status") {
|
|
12317
12337
|
const idx = loadIndex2(root);
|
|
@@ -12361,7 +12381,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
12361
12381
|
message: `Building semantic index for ${idx.symbolCount} symbols\u2026 (first run downloads ~117 MB model)`
|
|
12362
12382
|
});
|
|
12363
12383
|
try {
|
|
12364
|
-
const { rebuildSemanticIndex } = await import("./semantic-
|
|
12384
|
+
const { rebuildSemanticIndex } = await import("./semantic-IJKF5ZZC.js");
|
|
12365
12385
|
const stats = await rebuildSemanticIndex(root);
|
|
12366
12386
|
const first = stats.modelFirstLoadMs ? ` (model load+first batch ${stats.modelFirstLoadMs}ms)` : "";
|
|
12367
12387
|
this.send({
|
|
@@ -12548,7 +12568,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
12548
12568
|
case "test": {
|
|
12549
12569
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
12550
12570
|
try {
|
|
12551
|
-
const { executeTests } = await import("./run-tests-
|
|
12571
|
+
const { executeTests } = await import("./run-tests-SUYREW3B.js");
|
|
12552
12572
|
const argStr = args.join(" ").trim();
|
|
12553
12573
|
let testArgs = {};
|
|
12554
12574
|
if (argStr) {
|
|
@@ -386,7 +386,7 @@ ${content}`);
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
389
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
389
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-R6VOCA4V.js");
|
|
390
390
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
391
391
|
let interrupted = false;
|
|
392
392
|
const onSigint = () => {
|