@linghun/tui 0.1.3 → 0.1.4

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 (94) hide show
  1. package/dist/background-control-runtime.js +29 -29
  2. package/dist/cache-command-runtime.js +3 -3
  3. package/dist/capability-runtime.js +17 -17
  4. package/dist/{chunk-QD4SCW4A.js → chunk-2JFSRRK7.js} +21 -21
  5. package/dist/{chunk-6JPUBF7B.js → chunk-2JZBPXHF.js} +12 -12
  6. package/dist/{chunk-J7AAPUTV.js → chunk-33WA4BDG.js} +4 -4
  7. package/dist/{chunk-NWZ44SFI.js → chunk-3KRRVLS4.js} +111 -78
  8. package/dist/{chunk-ZPFOP557.js → chunk-4UER2AKI.js} +0 -190
  9. package/dist/{chunk-YBTXLLO5.js → chunk-7ODJHN53.js} +1 -1
  10. package/dist/{chunk-6DBBXNEG.js → chunk-7VGFNZPN.js} +38 -2
  11. package/dist/{chunk-QXV2N4F2.js → chunk-AFNWUI6R.js} +1 -1
  12. package/dist/{chunk-G7O26P5X.js → chunk-BRNV6757.js} +1 -1
  13. package/dist/{chunk-7XAOTGHZ.js → chunk-CL3U56EI.js} +1 -1
  14. package/dist/{chunk-OH35XDD4.js → chunk-HMGGPN4J.js} +1 -1
  15. package/dist/{chunk-CQCJGMXG.js → chunk-IU7NZO6B.js} +2 -2
  16. package/dist/{chunk-3LT6OWQ2.js → chunk-IWBV4CEI.js} +1 -1
  17. package/dist/{chunk-DEIYY6NI.js → chunk-JY2DO7OF.js} +4 -155
  18. package/dist/{chunk-OV5OT66G.js → chunk-KI7NO6IF.js} +216 -5
  19. package/dist/{chunk-KKZBBCHK.js → chunk-NL4M3V5D.js} +1 -1
  20. package/dist/{chunk-IQS34W5A.js → chunk-NR3MFRPO.js} +1 -1
  21. package/dist/{chunk-ESAACKVG.js → chunk-R7BB45CP.js} +1 -1
  22. package/dist/{chunk-RDTVAQBD.js → chunk-RKFC3V6A.js} +112 -26
  23. package/dist/{chunk-PBIPV4LD.js → chunk-RMXEIZYR.js} +1 -1
  24. package/dist/{chunk-4TO2LDMP.js → chunk-SEVD3KES.js} +2 -2
  25. package/dist/{chunk-5OZEJQBH.js → chunk-T2V2USR3.js} +1 -1
  26. package/dist/{chunk-XYY5LRSF.js → chunk-T7LHFTVM.js} +3 -3
  27. package/dist/{chunk-7RZE45OT.js → chunk-UN3MMVE4.js} +1 -1
  28. package/dist/{chunk-TO6IN4LA.js → chunk-UUWG4VXV.js} +5 -195
  29. package/dist/{chunk-GYHEUVR2.js → chunk-UYEVRXUA.js} +3 -3
  30. package/dist/{chunk-RDGM4RUE.js → chunk-VZFP7NWI.js} +1 -1
  31. package/dist/{chunk-7ZMDQZ22.js → chunk-W6O7KDNM.js} +1 -1
  32. package/dist/{chunk-2YL5VKJ5.js → chunk-WO56RSMP.js} +1 -1
  33. package/dist/{chunk-BEDD7OFL.js → chunk-WRVHCSM2.js} +24 -8
  34. package/dist/{chunk-EGHM55EV.js → chunk-WXQSF2AS.js} +3 -3
  35. package/dist/{chunk-Q57WS7YZ.js → chunk-ZNAYWBBI.js} +2 -2
  36. package/dist/command-panel-runtime.js +16 -16
  37. package/dist/compact-cache-command-runtime.js +29 -29
  38. package/dist/compact-preflight-runtime.js +10 -10
  39. package/dist/connector-runtime.js +18 -18
  40. package/dist/deferred-tools-catalog.d.ts +2 -1
  41. package/dist/deferred-tools-catalog.d.ts.map +1 -1
  42. package/dist/deferred-tools-catalog.js +3 -1
  43. package/dist/details-status-runtime.js +16 -16
  44. package/dist/evidence-runtime.d.ts.map +1 -1
  45. package/dist/evidence-runtime.js +6 -6
  46. package/dist/extension-command-runtime.js +3 -3
  47. package/dist/extension-slash-runtime.js +17 -17
  48. package/dist/failure-learning-command-runtime.js +17 -17
  49. package/dist/final-answer-gate.d.ts +0 -1
  50. package/dist/final-answer-gate.d.ts.map +1 -1
  51. package/dist/final-answer-gate.js +2 -4
  52. package/dist/git-command-runtime.js +17 -17
  53. package/dist/handoff-session-runtime.js +3 -3
  54. package/dist/headless-bench-runtime.d.ts +1 -19
  55. package/dist/headless-bench-runtime.d.ts.map +1 -1
  56. package/dist/headless-bench-runtime.js +1 -3
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +32 -42
  59. package/dist/job-agent-command-runtime.js +16 -16
  60. package/dist/mcp-index-runtime.d.ts +8 -0
  61. package/dist/mcp-index-runtime.d.ts.map +1 -1
  62. package/dist/mcp-index-runtime.js +19 -17
  63. package/dist/memory-command-runtime.js +17 -17
  64. package/dist/meta-scheduler-runtime.js +2 -2
  65. package/dist/model-command-runtime.js +17 -17
  66. package/dist/model-doctor-runtime.d.ts +1 -0
  67. package/dist/model-doctor-runtime.d.ts.map +1 -1
  68. package/dist/model-doctor-runtime.js +1 -1
  69. package/dist/model-loop-runtime.d.ts +15 -1
  70. package/dist/model-loop-runtime.d.ts.map +1 -1
  71. package/dist/model-loop-runtime.js +29 -1
  72. package/dist/model-prompt-runtime.d.ts.map +1 -1
  73. package/dist/model-prompt-runtime.js +3 -3
  74. package/dist/model-stream-runtime.js +29 -29
  75. package/dist/model-tool-runtime.d.ts +7 -0
  76. package/dist/model-tool-runtime.d.ts.map +1 -1
  77. package/dist/model-tool-runtime.js +31 -29
  78. package/dist/permission-approval-runtime.js +29 -29
  79. package/dist/provider-loop-runtime.js +3 -3
  80. package/dist/remote-command-runtime.js +17 -17
  81. package/dist/shell/components/ProductBlock.js +2 -2
  82. package/dist/shell/components/ShellApp.js +12 -12
  83. package/dist/shell/ink-renderer.js +12 -12
  84. package/dist/shell/view-model.js +4 -4
  85. package/dist/slash-command-runtime.js +29 -29
  86. package/dist/terminal-readiness-runtime.js +3 -3
  87. package/dist/tui-agent-job-runtime.js +4 -4
  88. package/dist/tui-context-runtime.js +3 -3
  89. package/dist/tui-model-runtime.js +2 -2
  90. package/dist/tui-output-surface.js +5 -5
  91. package/dist/verification-command-runtime.js +5 -5
  92. package/dist/workflow-command-runtime.js +16 -16
  93. package/package.json +4 -4
  94. package/dist/{chunk-Z265MCGC.js → chunk-VWEAK3UV.js} +3 -3
@@ -26,10 +26,10 @@ import {
26
26
  } from "./chunk-6CHUZ2NF.js";
27
27
  import {
28
28
  showCommandPanel
29
- } from "./chunk-6JPUBF7B.js";
29
+ } from "./chunk-2JZBPXHF.js";
30
30
  import {
31
31
  writeDiagnosticLine
32
- } from "./chunk-OH35XDD4.js";
32
+ } from "./chunk-HMGGPN4J.js";
33
33
  import {
34
34
  redactedPath,
35
35
  runCommandCapture
@@ -44,7 +44,7 @@ import {
44
44
  searchDeferredTools,
45
45
  summarizeDeferredToolMatch,
46
46
  validateCodebaseMemoryToolExecution
47
- } from "./chunk-6DBBXNEG.js";
47
+ } from "./chunk-7VGFNZPN.js";
48
48
  import {
49
49
  findCurrentIndexProject,
50
50
  readLocalIndexArtifactState
@@ -65,6 +65,7 @@ import {
65
65
  } from "./chunk-UGYFQF6M.js";
66
66
 
67
67
  // src/mcp-index-runtime.ts
68
+ import { spawn } from "child_process";
68
69
  import { randomUUID } from "crypto";
69
70
  import { readFile } from "fs/promises";
70
71
  import { delimiter, dirname, join, resolve } from "path";
@@ -79,6 +80,7 @@ var CODEBASE_MEMORY_COMMAND = "codebase-memory-mcp";
79
80
  var CODEBASE_MEMORY_ENV = "LINGHUN_CODEBASE_MEMORY_MCP";
80
81
  var CLI_BUNDLED_ROOT_ENV = "LINGHUN_CLI_BUNDLED_ROOT";
81
82
  var CODEBASE_MEMORY_BUNDLED_ENV = "LINGHUN_CODEBASE_MEMORY_BUNDLED_DIR";
83
+ var PRE_ENGINE_BUNDLED_ENV = "LINGHUN_PRE_ENGINE_BUNDLED_DIR";
82
84
  var CODEBASE_MEMORY_BUNDLED_PLATFORM_ARCHES = /* @__PURE__ */ new Set([
83
85
  "win32-x64",
84
86
  "linux-x64",
@@ -422,6 +424,153 @@ function getCodebaseMemoryPlatformArch() {
422
424
  }
423
425
  return `${process.platform}-${process.arch}`;
424
426
  }
427
+ var PRE_ENGINE_COMMAND = "linghun-pre-engine";
428
+ var PreEngineDaemon = class {
429
+ constructor(binary, cwd) {
430
+ this.binary = binary;
431
+ this.cwd = cwd;
432
+ }
433
+ binary;
434
+ cwd;
435
+ proc = null;
436
+ queue = Promise.resolve();
437
+ idleTimer = null;
438
+ msgId = 1;
439
+ call(toolName, args) {
440
+ return new Promise((resolve2, reject) => {
441
+ this.queue = this.queue.then(() => this._doCall(toolName, args).then(resolve2, reject)).catch(() => {
442
+ });
443
+ });
444
+ }
445
+ _ensureProc() {
446
+ if (this.proc) return Promise.resolve(this.proc);
447
+ const proc = spawn(this.binary, [], { cwd: this.cwd, stdio: ["pipe", "pipe", "pipe"] });
448
+ this.proc = proc;
449
+ proc.on("exit", () => {
450
+ if (this.proc === proc) this.proc = null;
451
+ });
452
+ return new Promise((resolve2) => {
453
+ let buf = "";
454
+ const onData = (chunk) => {
455
+ buf += chunk.toString();
456
+ const lines = buf.split("\n");
457
+ buf = lines.pop() ?? "";
458
+ for (const line of lines) {
459
+ if (!line.trim()) continue;
460
+ try {
461
+ const msg = JSON.parse(line);
462
+ if (msg.id === 0) {
463
+ proc.stdout.off("data", onData);
464
+ proc.stdin.write(
465
+ JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized", params: {} }) + "\n"
466
+ );
467
+ resolve2(proc);
468
+ }
469
+ } catch {
470
+ }
471
+ }
472
+ };
473
+ proc.stdout.on("data", onData);
474
+ proc.stdin.write(
475
+ JSON.stringify({ jsonrpc: "2.0", id: 0, method: "initialize", params: { rootUri: this.cwd } }) + "\n"
476
+ );
477
+ });
478
+ }
479
+ _doCall(toolName, args) {
480
+ this._resetIdle();
481
+ return this._ensureProc().then(
482
+ (proc) => new Promise((resolve2) => {
483
+ const id = this.msgId++;
484
+ let buf = "";
485
+ const cleanup = () => {
486
+ proc.stdout.off("data", onData);
487
+ proc.off("exit", onExit);
488
+ };
489
+ const onExit = () => {
490
+ cleanup();
491
+ resolve2({ ok: false, summary: "pre-engine process exited unexpectedly" });
492
+ };
493
+ const onData = (chunk) => {
494
+ buf += chunk.toString();
495
+ const lines = buf.split("\n");
496
+ buf = lines.pop() ?? "";
497
+ for (const line of lines) {
498
+ if (!line.trim()) continue;
499
+ try {
500
+ const msg = JSON.parse(line);
501
+ if (msg.id === id) {
502
+ cleanup();
503
+ if (msg.error) {
504
+ resolve2({ ok: false, summary: msg.error.message ?? String(msg.error) });
505
+ } else {
506
+ const content = msg.result?.content;
507
+ const text = Array.isArray(content) ? content.map((c) => c.text ?? "").join("") : "";
508
+ resolve2({ ok: true, summary: text, data: msg.result });
509
+ }
510
+ }
511
+ } catch {
512
+ }
513
+ }
514
+ };
515
+ proc.stdout.on("data", onData);
516
+ proc.on("exit", onExit);
517
+ proc.stdin.write(
518
+ JSON.stringify({
519
+ jsonrpc: "2.0",
520
+ id,
521
+ method: "tools/call",
522
+ params: { name: toolName, arguments: args }
523
+ }) + "\n"
524
+ );
525
+ })
526
+ );
527
+ }
528
+ _resetIdle() {
529
+ if (this.idleTimer) clearTimeout(this.idleTimer);
530
+ this.idleTimer = setTimeout(() => {
531
+ this.proc?.kill();
532
+ this.proc = null;
533
+ }, 3e4);
534
+ }
535
+ };
536
+ var _preEngineDaemons = /* @__PURE__ */ new Map();
537
+ function getOrCreatePreEngineDaemon(binary, cwd) {
538
+ const key = `${binary}\0${cwd}`;
539
+ let d = _preEngineDaemons.get(key);
540
+ if (!d) {
541
+ d = new PreEngineDaemon(binary, cwd);
542
+ _preEngineDaemons.set(key, d);
543
+ }
544
+ return d;
545
+ }
546
+ async function resolvePreEngineBinary() {
547
+ const platformArch = `${process.platform}-${process.arch}`;
548
+ const fileName = platformArch.startsWith("win32") ? `${PRE_ENGINE_COMMAND}.exe` : PRE_ENGINE_COMMAND;
549
+ const roots = [];
550
+ if (process.env[PRE_ENGINE_BUNDLED_ENV]) {
551
+ roots.push(process.env[PRE_ENGINE_BUNDLED_ENV]);
552
+ }
553
+ if (process.env[CLI_BUNDLED_ROOT_ENV]) {
554
+ roots.push(join(process.env[CLI_BUNDLED_ROOT_ENV], "pre-engine"));
555
+ }
556
+ const moduleDir = dirname(fileURLToPath(import.meta.url));
557
+ roots.push(join(moduleDir, "..", "bundled", "pre-engine"));
558
+ roots.push(join(moduleDir, "bundled", "pre-engine"));
559
+ for (const root of roots) {
560
+ const candidate = join(root, platformArch, fileName);
561
+ if (await pathExists(candidate)) {
562
+ return candidate;
563
+ }
564
+ }
565
+ const pathDirs = (process.env.PATH ?? "").split(delimiter).filter(Boolean);
566
+ for (const dir of pathDirs) {
567
+ const candidate = join(dir, fileName);
568
+ if (await pathExists(candidate)) {
569
+ return candidate;
570
+ }
571
+ }
572
+ return void 0;
573
+ }
425
574
  async function findPathCodebaseMemoryBinary() {
426
575
  const pathDirs = (process.env.PATH ?? "").split(delimiter).filter(Boolean);
427
576
  const candidates = pathDirs.map((dir) => join(dir, CODEBASE_MEMORY_COMMAND));
@@ -1034,15 +1183,54 @@ async function runCodebaseMemoryCli(context, tool, input, cwd, timeoutMs = 3e4)
1034
1183
  function executeSearchExtraTools(query, context) {
1035
1184
  const all = listDeferredTools(context);
1036
1185
  const filtered = searchDeferredTools(query, all);
1186
+ const recommendedNext = recommendDeferredToolCall(query, context, filtered);
1037
1187
  for (const tool of filtered) {
1038
1188
  context.discoveredDeferredToolNames.add(tool.name);
1039
1189
  }
1190
+ const recommendationText = recommendedNext ? ` Recommended next: ExecuteExtraTool(${recommendedNext.tool_name}, ${JSON.stringify({
1191
+ params: recommendedNext.params
1192
+ })}) because ${recommendedNext.reason}.` : "";
1040
1193
  return {
1041
1194
  ok: true,
1042
- text: `SearchExtraTools matched ${filtered.length}/${all.length} deferred tools (query=${JSON.stringify(query)}).`,
1043
- data: { matches: filtered.map(summarizeDeferredToolMatch), total: filtered.length }
1195
+ text: `SearchExtraTools matched ${filtered.length}/${all.length} deferred tools (query=${JSON.stringify(query)}).${recommendationText}`,
1196
+ data: { matches: filtered.map(summarizeDeferredToolMatch), total: filtered.length, recommendedNext }
1044
1197
  };
1045
1198
  }
1199
+ function recommendDeferredToolCall(query, context, matches) {
1200
+ const has = (name) => matches.some((tool) => tool.name === name && tool.executable);
1201
+ const task = query.trim();
1202
+ if (context.index.status === "ready" && context.index.projectName) {
1203
+ if (has("get_architecture")) {
1204
+ return {
1205
+ tool_name: "get_architecture",
1206
+ params: { project: context.index.projectName },
1207
+ reason: "codebase-memory index is ready, so index-backed architecture is the broad repository discovery step"
1208
+ };
1209
+ }
1210
+ if (task && has("search_code")) {
1211
+ return {
1212
+ tool_name: "search_code",
1213
+ params: { project: context.index.projectName, pattern: task },
1214
+ reason: "codebase-memory index is ready, so indexed search should narrow the repository scope before AST precision"
1215
+ };
1216
+ }
1217
+ if (task && has("search_graph")) {
1218
+ return {
1219
+ tool_name: "search_graph",
1220
+ params: { project: context.index.projectName, query: task },
1221
+ reason: "codebase-memory index is ready, so graph search should narrow related symbols before AST precision"
1222
+ };
1223
+ }
1224
+ }
1225
+ if (task && has("pre_plan")) {
1226
+ return {
1227
+ tool_name: "pre_plan",
1228
+ params: { task },
1229
+ reason: "the codebase index is not ready, so pre-engine should provide the first structured repository-analysis pass"
1230
+ };
1231
+ }
1232
+ return void 0;
1233
+ }
1046
1234
  async function executeExtraTool(args, context) {
1047
1235
  if (typeof args.tool_name !== "string" || args.tool_name.trim() === "") {
1048
1236
  return {
@@ -1102,6 +1290,28 @@ async function executeExtraTool(args, context) {
1102
1290
  data: cliResult.data
1103
1291
  };
1104
1292
  }
1293
+ if (target.kind === "pre-engine") {
1294
+ const binary = await resolvePreEngineBinary();
1295
+ if (!binary) {
1296
+ return {
1297
+ ok: false,
1298
+ text: `ExecuteExtraTool(pre-engine:${target.name}) \u5931\u8D25\uFF1A\u627E\u4E0D\u5230 linghun-pre-engine \u4E8C\u8FDB\u5236\u6587\u4EF6\uFF08bundled \u6216 PATH \u5747\u672A\u547D\u4E2D\uFF09\u3002`
1299
+ };
1300
+ }
1301
+ const daemon = getOrCreatePreEngineDaemon(binary, context.projectPath);
1302
+ const result = await daemon.call(target.name, params);
1303
+ if (!result.ok) {
1304
+ return {
1305
+ ok: false,
1306
+ text: `ExecuteExtraTool(pre-engine:${target.name}) \u5931\u8D25\uFF1A${result.summary}`
1307
+ };
1308
+ }
1309
+ return {
1310
+ ok: true,
1311
+ text: `ExecuteExtraTool(pre-engine:${target.name}) \u5B8C\u6210\u3002`,
1312
+ data: result.data
1313
+ };
1314
+ }
1105
1315
  if (target.kind === "mcp") {
1106
1316
  const parsed = parseMcpDeferredToolName(target.name);
1107
1317
  if (!parsed) {
@@ -1169,6 +1379,7 @@ export {
1169
1379
  findBundledCodebaseMemoryBinary,
1170
1380
  getBundledCodebaseMemoryRoots,
1171
1381
  getCodebaseMemoryPlatformArch,
1382
+ resolvePreEngineBinary,
1172
1383
  findPathCodebaseMemoryBinary,
1173
1384
  findCodebaseMemoryBinaryCandidate,
1174
1385
  probeCodebaseMemoryBinary,
@@ -5,7 +5,7 @@ import {
5
5
  detectEngineeringArtifactTargets,
6
6
  formatEngineeringFailureBoundaryHint,
7
7
  formatEngineeringProfileStrategyHint
8
- } from "./chunk-ZPFOP557.js";
8
+ } from "./chunk-4UER2AKI.js";
9
9
  import {
10
10
  LINGHUN_AGENT_CHILD_TURNS_AGENT,
11
11
  LINGHUN_AGENT_CHILD_TURNS_BASE,
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-CFXB5SE5.js";
28
28
  import {
29
29
  showCommandPanel
30
- } from "./chunk-6JPUBF7B.js";
30
+ } from "./chunk-2JZBPXHF.js";
31
31
  import {
32
32
  redactRemoteSummary,
33
33
  remoteTranscriptSummary
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-VIJ7GDKI.js";
28
28
  import {
29
29
  sanitizeMainScreenLeakage
30
- } from "./chunk-BEDD7OFL.js";
30
+ } from "./chunk-WRVHCSM2.js";
31
31
  import {
32
32
  SLASH_COMMAND_REGISTRY
33
33
  } from "./chunk-PGNALDEH.js";
@@ -15,13 +15,13 @@ import {
15
15
  checkAndWriteProviderCooldown,
16
16
  recordProviderFallbackAttempt,
17
17
  resolveRuntimeFallback
18
- } from "./chunk-4TO2LDMP.js";
18
+ } from "./chunk-SEVD3KES.js";
19
19
  import {
20
20
  configureRemoteCommandRuntime,
21
21
  consumeRemoteInboundMessage,
22
22
  processRemoteInbound,
23
23
  validateRemotePairingEnvelope
24
- } from "./chunk-IQS34W5A.js";
24
+ } from "./chunk-NR3MFRPO.js";
25
25
  import {
26
26
  formatLocalToolPermissionPrompt,
27
27
  formatModelToolPermissionPrompt
@@ -36,18 +36,18 @@ import {
36
36
  executeMemoryMutation,
37
37
  resumeSessionWithHandoff,
38
38
  runAutoLearningOnTurnEnd
39
- } from "./chunk-GYHEUVR2.js";
39
+ } from "./chunk-UYEVRXUA.js";
40
40
  import {
41
41
  evaluateMetaScheduler,
42
42
  formatMetaSchedulerDirective,
43
43
  formatPolicyDecisionSummary,
44
44
  hasActiveProviderFailure,
45
45
  verifyFailureLearningContract
46
- } from "./chunk-KKZBBCHK.js";
46
+ } from "./chunk-NL4M3V5D.js";
47
47
  import {
48
48
  configureModelCommandRuntime,
49
49
  startModelSetup
50
- } from "./chunk-J7AAPUTV.js";
50
+ } from "./chunk-33WA4BDG.js";
51
51
  import {
52
52
  looksLikeModelSetupInput,
53
53
  parseModelSetupPrefill
@@ -59,7 +59,7 @@ import {
59
59
  refreshIndexStatus,
60
60
  runIndexRepository,
61
61
  stabilizeMcpToolList
62
- } from "./chunk-OV5OT66G.js";
62
+ } from "./chunk-KI7NO6IF.js";
63
63
  import {
64
64
  formatIndexRefreshSummary
65
65
  } from "./chunk-UYU4QN3P.js";
@@ -70,7 +70,7 @@ import {
70
70
  checkClaimSupport,
71
71
  formatClaimCheck,
72
72
  runArchitectureAndCompletenessFinalGate
73
- } from "./chunk-TO6IN4LA.js";
73
+ } from "./chunk-UUWG4VXV.js";
74
74
  import {
75
75
  executeGitToolUse,
76
76
  resolveStablePointApprove,
@@ -80,10 +80,10 @@ import {
80
80
  } from "./chunk-7ZE5JFAZ.js";
81
81
  import {
82
82
  configureExtensionSlashRuntime
83
- } from "./chunk-Q57WS7YZ.js";
83
+ } from "./chunk-ZNAYWBBI.js";
84
84
  import {
85
85
  configureFailureLearningCommandRuntime
86
- } from "./chunk-QXV2N4F2.js";
86
+ } from "./chunk-AFNWUI6R.js";
87
87
  import {
88
88
  startFeishuLongConnection
89
89
  } from "./chunk-WJWYRBWH.js";
@@ -97,7 +97,7 @@ import {
97
97
  inspectToolPairingSafety,
98
98
  prepareMessagesForProviderPreflight,
99
99
  recordCompactBoundary
100
- } from "./chunk-EGHM55EV.js";
100
+ } from "./chunk-WXQSF2AS.js";
101
101
  import {
102
102
  appendBreakCacheEvent,
103
103
  buildPromptCacheRequestFields,
@@ -113,7 +113,7 @@ import {
113
113
  formatCacheLog,
114
114
  formatCompactStatus,
115
115
  writeLightHints
116
- } from "./chunk-7RZE45OT.js";
116
+ } from "./chunk-UN3MMVE4.js";
117
117
  import {
118
118
  cancelAgentByRef,
119
119
  cancelAllAgents,
@@ -144,7 +144,7 @@ import {
144
144
  transitionDurableJob,
145
145
  upsertWorkflowBackgroundTask,
146
146
  writeStatus
147
- } from "./chunk-6JPUBF7B.js";
147
+ } from "./chunk-2JZBPXHF.js";
148
148
  import {
149
149
  addAllowRule,
150
150
  decidePermission,
@@ -160,7 +160,7 @@ import {
160
160
  formatVerificationTaskSummary,
161
161
  runVerificationCommand,
162
162
  runVerificationPlan
163
- } from "./chunk-7XAOTGHZ.js";
163
+ } from "./chunk-CL3U56EI.js";
164
164
  import {
165
165
  abortBackgroundTask,
166
166
  clearBackgroundAbortController,
@@ -175,7 +175,7 @@ import {
175
175
  listCancellableAgents,
176
176
  registerBackgroundAbortController,
177
177
  rememberBackgroundTask
178
- } from "./chunk-YBTXLLO5.js";
178
+ } from "./chunk-7ODJHN53.js";
179
179
  import {
180
180
  ShellBlockOutput,
181
181
  beginAssistantStream,
@@ -185,10 +185,10 @@ import {
185
185
  writeAssistantDelta,
186
186
  writeErrorLine,
187
187
  writeLocalCommandOutputLine
188
- } from "./chunk-OH35XDD4.js";
188
+ } from "./chunk-HMGGPN4J.js";
189
189
  import {
190
190
  createTerminalReadinessView
191
- } from "./chunk-PBIPV4LD.js";
191
+ } from "./chunk-RMXEIZYR.js";
192
192
  import {
193
193
  appendJobLog,
194
194
  parseJobRunOptions,
@@ -202,17 +202,17 @@ import {
202
202
  } from "./chunk-JMUAQUQQ.js";
203
203
  import {
204
204
  detectEngineeringTaskProfile
205
- } from "./chunk-ZPFOP557.js";
205
+ } from "./chunk-4UER2AKI.js";
206
206
  import {
207
207
  formatHooksDoctor
208
- } from "./chunk-5OZEJQBH.js";
208
+ } from "./chunk-T2V2USR3.js";
209
209
  import {
210
210
  runCommandCapture
211
211
  } from "./chunk-HMGYFENJ.js";
212
212
  import {
213
213
  createModelSystemPrompt,
214
214
  sanitizeMainScreenLeakage
215
- } from "./chunk-BEDD7OFL.js";
215
+ } from "./chunk-WRVHCSM2.js";
216
216
  import {
217
217
  collectInputFiles,
218
218
  createReportFinalReferenceReminder,
@@ -245,7 +245,7 @@ import {
245
245
  getCodebaseMemoryToolRisk,
246
246
  isCodebaseMemoryToolName,
247
247
  listDeferredTools
248
- } from "./chunk-6DBBXNEG.js";
248
+ } from "./chunk-7VGFNZPN.js";
249
249
  import {
250
250
  appendBackgroundTaskEvent,
251
251
  appendDeferredToolResultEvent,
@@ -269,7 +269,7 @@ import {
269
269
  recordVerificationEvidence,
270
270
  rememberEvidence,
271
271
  truncateRoundAssistantForProvider
272
- } from "./chunk-DEIYY6NI.js";
272
+ } from "./chunk-JY2DO7OF.js";
273
273
  import {
274
274
  BACKGROUND_KIND_CAPS,
275
275
  BACKGROUND_RUNNING_GLOBAL_CAP,
@@ -283,7 +283,7 @@ import {
283
283
  TODO_ONLY_KILL_GRACE,
284
284
  createSingleToolCallContinuation,
285
285
  runtimeFromContinuation
286
- } from "./chunk-RDGM4RUE.js";
286
+ } from "./chunk-VZFP7NWI.js";
287
287
  import {
288
288
  applyToolResultBudgetToMessages
289
289
  } from "./chunk-O7S3HYE6.js";
@@ -295,7 +295,7 @@ import {
295
295
  loadOrCreateHandoffPacket,
296
296
  validateHandoffPacket,
297
297
  writeHandoffPacket
298
- } from "./chunk-7ZMDQZ22.js";
298
+ } from "./chunk-W6O7KDNM.js";
299
299
  import {
300
300
  createLinghunMdTemplate
301
301
  } from "./chunk-OJTMM5CV.js";
@@ -318,9 +318,10 @@ import {
318
318
  createToolUseDriftSummary,
319
319
  evaluateFinalAnswerClaims,
320
320
  extractFileMentions,
321
+ isPreEngineToolName,
321
322
  sanitizeDeferredToolPrimaryText,
322
323
  stripStructuredFinalAnswerClaims
323
- } from "./chunk-NWZ44SFI.js";
324
+ } from "./chunk-3KRRVLS4.js";
324
325
  import {
325
326
  INDEX_REFRESH,
326
327
  INDEX_REPAIR,
@@ -366,10 +367,10 @@ import {
366
367
  getSelectedModelRuntime,
367
368
  resolveRoleRoute,
368
369
  shouldOfferUserScopedModelSetup
369
- } from "./chunk-3LT6OWQ2.js";
370
+ } from "./chunk-IWBV4CEI.js";
370
371
  import {
371
372
  getRoleRoute
372
- } from "./chunk-2YL5VKJ5.js";
373
+ } from "./chunk-WO56RSMP.js";
373
374
  import {
374
375
  clearProviderBreaker,
375
376
  withProviderRetry
@@ -6243,6 +6244,9 @@ async function executeModelToolUse(toolCall, context, sessionId, output, continu
6243
6244
  if (toolCall.name === SEARCH_EXTRA_TOOLS_NAME || toolCall.name === EXECUTE_EXTRA_TOOL_NAME || toolCall.name === COMMAND_PROPOSAL_TOOL_NAME) {
6244
6245
  return executeDeferredDispatchToolUse(toolCall, context, sessionId, output);
6245
6246
  }
6247
+ if (isPreEngineToolName(toolCall.name)) {
6248
+ return executePreEngineToolUse(toolCall, context, sessionId, output);
6249
+ }
6246
6250
  if (isGitToolName(toolCall.name)) {
6247
6251
  const gitResult = await executeGitToolUse(
6248
6252
  toolCall,
@@ -6882,6 +6886,87 @@ async function executeDeferredDispatchToolUse(toolCall, context, sessionId, outp
6882
6886
  return { ok: false, tool: dispatchName, text, evidenceId: evidence.id };
6883
6887
  }
6884
6888
  }
6889
+ async function executePreEngineToolUse(toolCall, context, sessionId, output) {
6890
+ const toolName = toolCall.name;
6891
+ startRequestActivity(output, context, "tool_running", {
6892
+ toolName,
6893
+ toolTarget: extractToolTarget(toolName, toolCall.input)
6894
+ });
6895
+ await context.store.appendEvent(sessionId, {
6896
+ type: "tool_call_start",
6897
+ id: toolCall.id,
6898
+ name: toolName,
6899
+ input: toolCall.input,
6900
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
6901
+ });
6902
+ try {
6903
+ context.discoveredDeferredToolNames.add(toolName);
6904
+ const params = toolCall.input && typeof toolCall.input === "object" && !Array.isArray(toolCall.input) ? toolCall.input : {};
6905
+ const result = await executeExtraTool({ tool_name: toolName, params }, context);
6906
+ if (!result.ok) {
6907
+ const evidence2 = await recordToolFailureEvidence(
6908
+ context,
6909
+ sessionId,
6910
+ "Read",
6911
+ `${toolName}: ${result.text}`
6912
+ );
6913
+ await appendDeferredToolResultEvent(
6914
+ context,
6915
+ sessionId,
6916
+ toolCall.id,
6917
+ toolName,
6918
+ result.text,
6919
+ true,
6920
+ evidence2.id
6921
+ );
6922
+ clearRequestActivity(context);
6923
+ writeLine(output, `pre-engine ${toolName} failed.`);
6924
+ return { ok: false, tool: toolName, text: result.text, evidenceId: evidence2.id };
6925
+ }
6926
+ rememberSourcePackCandidatesFromToolData(context, toolName, result.data);
6927
+ const evidence = await recordToolEvidence(context, sessionId, "Read", {
6928
+ text: result.text,
6929
+ data: result.data
6930
+ });
6931
+ await appendDeferredToolResultEvent(
6932
+ context,
6933
+ sessionId,
6934
+ toolCall.id,
6935
+ toolName,
6936
+ { text: result.text, data: result.data },
6937
+ false,
6938
+ evidence?.id
6939
+ );
6940
+ clearRequestActivity(context);
6941
+ writeLine(output, `pre-engine ${toolName} finished.`);
6942
+ return {
6943
+ ok: true,
6944
+ tool: toolName,
6945
+ text: result.text,
6946
+ data: result.data,
6947
+ evidenceId: evidence?.id
6948
+ };
6949
+ } catch (error) {
6950
+ clearRequestActivity(context);
6951
+ const text = formatError(error, context.language);
6952
+ const evidence = await recordToolFailureEvidence(
6953
+ context,
6954
+ sessionId,
6955
+ "Read",
6956
+ `${toolName}: ${text}`
6957
+ );
6958
+ await appendDeferredToolResultEvent(
6959
+ context,
6960
+ sessionId,
6961
+ toolCall.id,
6962
+ toolName,
6963
+ text,
6964
+ true,
6965
+ evidence.id
6966
+ );
6967
+ return { ok: false, tool: toolName, text, evidenceId: evidence.id };
6968
+ }
6969
+ }
6885
6970
  async function executeLinghunControlToolUse(toolCall, context, sessionId, output, continuation) {
6886
6971
  startRequestActivity(output, context, "tool_running", { toolName: toolCall.name, toolTarget: extractToolTarget(toolCall.name, toolCall.input) });
6887
6972
  const previousCommandPanelState = context.commandPanelState;
@@ -8291,6 +8376,7 @@ export {
8291
8376
  formatBoundaryEditPreflightPrompt,
8292
8377
  executeApprovedModelToolUse,
8293
8378
  executeDeferredDispatchToolUse,
8379
+ executePreEngineToolUse,
8294
8380
  executeLinghunControlToolUse,
8295
8381
  __testSelectWorkflowCurrentStepForToolResult,
8296
8382
  __testFormatStartAgentDidNotStartMessage,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-ZJK25VFP.js";
11
11
  import {
12
12
  getSelectedModelRuntime
13
- } from "./chunk-3LT6OWQ2.js";
13
+ } from "./chunk-IWBV4CEI.js";
14
14
  import {
15
15
  formatCooldownDoctorLine
16
16
  } from "./chunk-EBACIBJP.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  formatReasoningEffectiveState
3
- } from "./chunk-3LT6OWQ2.js";
3
+ } from "./chunk-IWBV4CEI.js";
4
4
  import {
5
5
  getRoleRoute,
6
6
  inferProviderForRouteModel
7
- } from "./chunk-2YL5VKJ5.js";
7
+ } from "./chunk-WO56RSMP.js";
8
8
  import {
9
9
  checkProviderCooldown,
10
10
  formatCooldownMessage
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-6JGRNES6.js";
15
15
  import {
16
16
  getRuntimeStatusProvider
17
- } from "./chunk-3LT6OWQ2.js";
17
+ } from "./chunk-IWBV4CEI.js";
18
18
  import {
19
19
  stableHash
20
20
  } from "./chunk-4T5DJW54.js";
@@ -4,14 +4,14 @@ import {
4
4
  registerCapabilityProvider,
5
5
  setCapabilityConnectionResolver,
6
6
  unregisterCapabilitiesByApp
7
- } from "./chunk-CQCJGMXG.js";
7
+ } from "./chunk-IU7NZO6B.js";
8
8
  import {
9
9
  ensureSession,
10
10
  showCommandPanel
11
- } from "./chunk-6JPUBF7B.js";
11
+ } from "./chunk-2JZBPXHF.js";
12
12
  import {
13
13
  budgetToolResultTranscriptContent
14
- } from "./chunk-DEIYY6NI.js";
14
+ } from "./chunk-JY2DO7OF.js";
15
15
  import {
16
16
  truncateDisplay,
17
17
  writeLine
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-K4FSYBSY.js";
9
9
  import {
10
10
  getSelectedModelRuntime
11
- } from "./chunk-3LT6OWQ2.js";
11
+ } from "./chunk-IWBV4CEI.js";
12
12
  import {
13
13
  diffFreshness
14
14
  } from "./chunk-4T5DJW54.js";