@vibgrate/cli 2026.722.1 → 2026.727.1

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 (125) hide show
  1. package/DOCS.md +418 -196
  2. package/README.md +34 -7
  3. package/dist/baseline-K7YBFKZI.js +7 -0
  4. package/dist/{baseline-J44M7MWP.js.map → baseline-K7YBFKZI.js.map} +1 -1
  5. package/dist/chunk-3BVSDMHV.js +2496 -0
  6. package/dist/chunk-3BVSDMHV.js.map +1 -0
  7. package/dist/{chunk-PY3DNX5H.js → chunk-3Q7QBWFW.js} +13 -2
  8. package/dist/chunk-3Q7QBWFW.js.map +1 -0
  9. package/dist/chunk-4CQ3MGNN.js +136 -0
  10. package/dist/chunk-4CQ3MGNN.js.map +1 -0
  11. package/dist/chunk-5I4VSBWQ.js +764 -0
  12. package/dist/chunk-5I4VSBWQ.js.map +1 -0
  13. package/dist/chunk-5Q54GEHM.js +29 -0
  14. package/dist/chunk-5Q54GEHM.js.map +1 -0
  15. package/dist/{chunk-XKXKWYJF.js → chunk-65MEOA4E.js} +21 -18
  16. package/dist/chunk-65MEOA4E.js.map +1 -0
  17. package/dist/{chunk-WNIIKCNF.js → chunk-6IOQJGFT.js} +29 -238
  18. package/dist/chunk-6IOQJGFT.js.map +1 -0
  19. package/dist/{chunk-CS37OBE3.js → chunk-7JHPQ6WF.js} +791 -783
  20. package/dist/chunk-7JHPQ6WF.js.map +1 -0
  21. package/dist/chunk-BPF3YX2U.js +64 -0
  22. package/dist/chunk-BPF3YX2U.js.map +1 -0
  23. package/dist/chunk-BWPBB45M.js +88 -0
  24. package/dist/chunk-BWPBB45M.js.map +1 -0
  25. package/dist/chunk-C4CKTAZP.js +1695 -0
  26. package/dist/chunk-C4CKTAZP.js.map +1 -0
  27. package/dist/chunk-EDAAG7BL.js +612 -0
  28. package/dist/chunk-EDAAG7BL.js.map +1 -0
  29. package/dist/chunk-EDBV33B7.js +57 -0
  30. package/dist/chunk-EDBV33B7.js.map +1 -0
  31. package/dist/chunk-HABUT7HW.js +233 -0
  32. package/dist/chunk-HABUT7HW.js.map +1 -0
  33. package/dist/{chunk-EXQV26MF.js → chunk-HYZVHJ3Q.js} +3 -3
  34. package/dist/{chunk-EXQV26MF.js.map → chunk-HYZVHJ3Q.js.map} +1 -1
  35. package/dist/chunk-IS7VTH2Q.js +627 -0
  36. package/dist/chunk-IS7VTH2Q.js.map +1 -0
  37. package/dist/chunk-IZDH67DX.js +289 -0
  38. package/dist/chunk-IZDH67DX.js.map +1 -0
  39. package/dist/chunk-J7LKEB2R.js +51 -0
  40. package/dist/chunk-J7LKEB2R.js.map +1 -0
  41. package/dist/chunk-JIBOJTGS.js +313 -0
  42. package/dist/chunk-JIBOJTGS.js.map +1 -0
  43. package/dist/chunk-JZYGEZTU.js +82 -0
  44. package/dist/chunk-JZYGEZTU.js.map +1 -0
  45. package/dist/chunk-K7REHDQS.js +776 -0
  46. package/dist/chunk-K7REHDQS.js.map +1 -0
  47. package/dist/chunk-KHJO4D5N.js +108 -0
  48. package/dist/chunk-KHJO4D5N.js.map +1 -0
  49. package/dist/chunk-NDMDSPFX.js +69 -0
  50. package/dist/chunk-NDMDSPFX.js.map +1 -0
  51. package/dist/chunk-OOIG3RUM.js +276 -0
  52. package/dist/chunk-OOIG3RUM.js.map +1 -0
  53. package/dist/{chunk-6CXTPC74.js → chunk-OXQNQW5J.js} +27 -6
  54. package/dist/chunk-OXQNQW5J.js.map +1 -0
  55. package/dist/chunk-PMYWZRRS.js +62 -0
  56. package/dist/chunk-PMYWZRRS.js.map +1 -0
  57. package/dist/chunk-PXHNTC6D.js +382 -0
  58. package/dist/chunk-PXHNTC6D.js.map +1 -0
  59. package/dist/{chunk-VXT6LUGP.js → chunk-S6CYDZEW.js} +1395 -1975
  60. package/dist/chunk-S6CYDZEW.js.map +1 -0
  61. package/dist/chunk-SZLF66FJ.js +843 -0
  62. package/dist/chunk-SZLF66FJ.js.map +1 -0
  63. package/dist/chunk-VXGV6NTD.js +476 -0
  64. package/dist/chunk-VXGV6NTD.js.map +1 -0
  65. package/dist/{chunk-JSNHZCIV.js → chunk-WLETRGAC.js} +16 -9
  66. package/dist/chunk-WLETRGAC.js.map +1 -0
  67. package/dist/{chunk-2EVQKZTO.js → chunk-YDAT7LD2.js} +190 -13
  68. package/dist/chunk-YDAT7LD2.js.map +1 -0
  69. package/dist/cli.js +3451 -509
  70. package/dist/cli.js.map +1 -1
  71. package/dist/execution-env-3BN7Z737.js +3 -0
  72. package/dist/execution-env-3BN7Z737.js.map +1 -0
  73. package/dist/federation-EPZDUWCK.js +6 -0
  74. package/dist/federation-EPZDUWCK.js.map +1 -0
  75. package/dist/git-ref-HPRLUFFW.js +3 -0
  76. package/dist/git-ref-HPRLUFFW.js.map +1 -0
  77. package/dist/graph-backend-ZMSYOZMW.js +10 -0
  78. package/dist/graph-backend-ZMSYOZMW.js.map +1 -0
  79. package/dist/index.d.ts +432 -126
  80. package/dist/index.js +14 -7
  81. package/dist/index.js.map +1 -1
  82. package/dist/{interactive-736PBC7J.js → interactive-ICL7D7LO.js} +185 -365
  83. package/dist/interactive-ICL7D7LO.js.map +1 -0
  84. package/dist/llm-host-2RAYQSDQ.js +8 -0
  85. package/dist/llm-host-2RAYQSDQ.js.map +1 -0
  86. package/dist/load-OHVKDX4R.js +7 -0
  87. package/dist/load-OHVKDX4R.js.map +1 -0
  88. package/dist/local-runtime-OJFLX2HI.js +4 -0
  89. package/dist/local-runtime-OJFLX2HI.js.map +1 -0
  90. package/dist/model-execution-profile-MQ2QCP24.js +3 -0
  91. package/dist/model-execution-profile-MQ2QCP24.js.map +1 -0
  92. package/dist/model-orchestrator-FFTZI3U2.js +8 -0
  93. package/dist/model-orchestrator-FFTZI3U2.js.map +1 -0
  94. package/dist/parse-worker.d.ts +1 -1
  95. package/dist/parse-worker.js +1 -1
  96. package/dist/paths-MCH75O3G.js +5 -0
  97. package/dist/paths-MCH75O3G.js.map +1 -0
  98. package/dist/resolve-gguf-4UPIGPEE.js +7 -0
  99. package/dist/resolve-gguf-4UPIGPEE.js.map +1 -0
  100. package/dist/runtime-session-IDU5BDUJ.js +17 -0
  101. package/dist/runtime-session-IDU5BDUJ.js.map +1 -0
  102. package/dist/session-L2OSDRPI.js +10 -0
  103. package/dist/{session-POJUDFPH.js.map → session-L2OSDRPI.js.map} +1 -1
  104. package/dist/{stream-json-Q2JGWPHB.js → stream-json-F74W5FCK.js} +16 -6
  105. package/dist/stream-json-F74W5FCK.js.map +1 -0
  106. package/dist/{types-Jl6RJ175.d.ts → types-ZMg1mSuu.d.ts} +3 -1
  107. package/dist/vgd-EGBQD7BW.js +16 -0
  108. package/dist/vgd-EGBQD7BW.js.map +1 -0
  109. package/package.json +9 -6
  110. package/dist/baseline-J44M7MWP.js +0 -7
  111. package/dist/chunk-2EVQKZTO.js.map +0 -1
  112. package/dist/chunk-6CXTPC74.js.map +0 -1
  113. package/dist/chunk-CS37OBE3.js.map +0 -1
  114. package/dist/chunk-GGJZA3Q6.js +0 -961
  115. package/dist/chunk-GGJZA3Q6.js.map +0 -1
  116. package/dist/chunk-JBXNQCGE.js +0 -484
  117. package/dist/chunk-JBXNQCGE.js.map +0 -1
  118. package/dist/chunk-JSNHZCIV.js.map +0 -1
  119. package/dist/chunk-PY3DNX5H.js.map +0 -1
  120. package/dist/chunk-VXT6LUGP.js.map +0 -1
  121. package/dist/chunk-WNIIKCNF.js.map +0 -1
  122. package/dist/chunk-XKXKWYJF.js.map +0 -1
  123. package/dist/interactive-736PBC7J.js.map +0 -1
  124. package/dist/session-POJUDFPH.js +0 -6
  125. package/dist/stream-json-Q2JGWPHB.js.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/engine/push.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,SAAS,aAAA,CAAc,IAAA,EAAc,KAAA,EAAgB,YAAA,EAA4C;AACtG,EAAA,MAAM,MAAM,GAAA,CAAI,IAAA,EAAM,CAAC,WAAA,EAAa,MAAM,CAAC,CAAA,IAAK,0CAAA;AAChD,EAAA,MAAM,MAAA,GAAS,IAAI,IAAA,EAAM,CAAC,aAAa,cAAA,EAAgB,MAAM,CAAC,CAAA,IAAK,MAAA;AACnE,EAAA,MAAM,SAAA,GAAY,IAAI,IAAA,EAAM,CAAC,UAAU,OAAA,EAAS,mBAAmB,CAAC,CAAA,IAAK,MAAA;AACzE,EAAA,OAAO;AAAA,IACL,aAAA,EAAe,cAAA;AAAA,IACf,YAAA,EAAc,OAAA;AAAA,IACd,YAAA;AAAA,IACA,GAAA,EAAK,EAAE,GAAA,EAAK,QAAA,EAAU,IAAI,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA,EAAG,MAAA,EAAO;AAAA,IAC/C,YAAY,SAAA,GAAY,EAAE,WAAW,oBAAA,CAAqB,SAAS,GAAE,GAAI,MAAA;AAAA,IACzE,aAAa,KAAA,CAAM,WAAA;AAAA,IACnB,KAAA,EAAO,YAAY,KAAK;AAAA,GAC1B;AACF;AAOO,SAAS,YAAY,KAAA,EAAyB;AACnD,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,KAAA,EAAO,KAAA,CAAM,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,KAAM;AAC5B,MAAA,MAAM,YAAY,CAAA,CAAE,SAAA,GAAY,cAAc,CAAA,CAAE,SAAS,IAAI,CAAA,CAAE,SAAA;AAC/D,MAAA,MAAM,MAAM,CAAA,CAAE,GAAA,GAAM,cAAc,CAAA,CAAE,GAAG,IAAI,CAAA,CAAE,GAAA;AAC7C,MAAA,OAAO,SAAA,KAAc,CAAA,CAAE,SAAA,IAAa,GAAA,KAAQ,CAAA,CAAE,GAAA,GAAM,EAAE,GAAG,CAAA,EAAG,SAAA,EAAW,GAAA,EAAI,GAAI,CAAA;AAAA,IACjF,CAAC;AAAA,GACH;AACF;AAEA,SAAS,GAAA,CAAI,MAAc,IAAA,EAA+B;AACxD,EAAA,IAAI;AACF,IAAA,OAAO,YAAA,CAAa,KAAA,EAAO,IAAA,EAAM,EAAE,GAAA,EAAK,IAAA,EAAM,QAAA,EAAU,MAAA,EAAQ,CAAA,CAAE,IAAA,EAAK,IAAK,IAAA;AAAA,EAC9E,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["import { execFileSync } from 'node:child_process';\nimport { redactSecrets, redactUrlCredentials } from '../core-open/utils/redact.js';\nimport type { VgGraph } from '../schema.js';\n\n/**\n * The deferred, decoupled push envelope (VG-PACKAGE-AND-SCHEMA §7). In the open\n * CLI `vg push` is **specified but not built**: it assembles and redacts the\n * envelope and prints a notice, but performs **no network upload**. Nothing in\n * the free path depends on it. Drift-over-time/governance is the separate\n * commercial product.\n */\n\nexport interface GraphUploadEnvelope {\n schemaVersion: 'vg-graph/1.0';\n artifactType: 'graph';\n scanIngestId?: string;\n vcs: { sha: string; shortSha: string; branch: string };\n repository?: { name?: string; remoteUrl?: string };\n generatedAt: string;\n graph: VgGraph;\n}\n\nexport function buildEnvelope(root: string, graph: VgGraph, scanIngestId?: string): GraphUploadEnvelope {\n const sha = git(root, ['rev-parse', 'HEAD']) ?? '0000000000000000000000000000000000000000';\n const branch = git(root, ['rev-parse', '--abbrev-ref', 'HEAD']) ?? 'HEAD';\n const remoteUrl = git(root, ['config', '--get', 'remote.origin.url']) ?? undefined;\n return {\n schemaVersion: 'vg-graph/1.0',\n artifactType: 'graph',\n scanIngestId,\n vcs: { sha, shortSha: sha.slice(0, 12), branch },\n repository: remoteUrl ? { remoteUrl: redactUrlCredentials(remoteUrl) } : undefined,\n generatedAt: graph.generatedAt,\n graph: redactGraph(graph),\n };\n}\n\n/**\n * Redaction pass (GUARDRAILS §1: redact before storage). The graph is structure,\n * not content, but we defensively scrub any signature/name that matches a\n * credential-shaped pattern, and strip credentials from the remote URL.\n */\nexport function redactGraph(graph: VgGraph): VgGraph {\n return {\n ...graph,\n nodes: graph.nodes.map((n) => {\n const signature = n.signature ? redactSecrets(n.signature) : n.signature;\n const doc = n.doc ? redactSecrets(n.doc) : n.doc;\n return signature !== n.signature || doc !== n.doc ? { ...n, signature, doc } : n;\n }),\n };\n}\n\nfunction git(root: string, args: string[]): string | null {\n try {\n return execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim() || null;\n } catch {\n return null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/engine/push.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsBO,SAAS,aAAA,CAAc,IAAA,EAAc,KAAA,EAAgB,YAAA,EAA4C;AACtG,EAAA,MAAM,MAAM,GAAA,CAAI,IAAA,EAAM,CAAC,WAAA,EAAa,MAAM,CAAC,CAAA,IAAK,0CAAA;AAChD,EAAA,MAAM,MAAA,GAAS,IAAI,IAAA,EAAM,CAAC,aAAa,cAAA,EAAgB,MAAM,CAAC,CAAA,IAAK,MAAA;AACnE,EAAA,MAAM,SAAA,GAAY,IAAI,IAAA,EAAM,CAAC,UAAU,OAAA,EAAS,mBAAmB,CAAC,CAAA,IAAK,MAAA;AACzE,EAAA,OAAO;AAAA,IACL,aAAA,EAAe,cAAA;AAAA,IACf,YAAA,EAAc,OAAA;AAAA,IACd,YAAA;AAAA,IACA,GAAA,EAAK,EAAE,GAAA,EAAK,QAAA,EAAU,IAAI,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA,EAAG,MAAA,EAAO;AAAA,IAC/C,YAAY,SAAA,GAAY,EAAE,WAAW,oBAAA,CAAqB,SAAS,GAAE,GAAI,MAAA;AAAA,IACzE,aAAa,KAAA,CAAM,WAAA;AAAA,IACnB,KAAA,EAAO,YAAY,KAAK;AAAA,GAC1B;AACF;AAOO,SAAS,YAAY,KAAA,EAAyB;AACnD,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,KAAA,EAAO,KAAA,CAAM,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,KAAM;AAC5B,MAAA,MAAM,YAAY,CAAA,CAAE,SAAA,GAAY,cAAc,CAAA,CAAE,SAAS,IAAI,CAAA,CAAE,SAAA;AAC/D,MAAA,MAAM,MAAM,CAAA,CAAE,GAAA,GAAM,cAAc,CAAA,CAAE,GAAG,IAAI,CAAA,CAAE,GAAA;AAC7C,MAAA,OAAO,SAAA,KAAc,CAAA,CAAE,SAAA,IAAa,GAAA,KAAQ,CAAA,CAAE,GAAA,GAAM,EAAE,GAAG,CAAA,EAAG,SAAA,EAAW,GAAA,EAAI,GAAI,CAAA;AAAA,IACjF,CAAC;AAAA,GACH;AACF;AAEA,SAAS,GAAA,CAAI,MAAc,IAAA,EAA+B;AACxD,EAAA,IAAI;AACF,IAAA,OAAO,YAAA,CAAa,KAAA,EAAO,IAAA,EAAM,EAAE,GAAA,EAAK,IAAA,EAAM,QAAA,EAAU,MAAA,EAAQ,CAAA,CAAE,IAAA,EAAK,IAAK,IAAA;AAAA,EAC9E,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["import { execFileSync } from 'node:child_process';\nimport { redactSecrets, redactUrlCredentials } from '../core-open/utils/redact.js';\nimport type { VgGraph } from '../schema.js';\n\n/**\n * The deferred, decoupled push envelope (VG-PACKAGE-AND-SCHEMA §7). In the open\n * CLI `vg push` is **specified but not built**: it assembles and redacts the\n * envelope and prints a notice, but performs **no network upload**. Nothing in\n * the free path depends on it. Drift-over-time/governance is the separate\n * commercial product.\n */\n\nexport interface GraphUploadEnvelope {\n schemaVersion: 'vg-graph/1.0';\n artifactType: 'graph';\n scanIngestId?: string;\n vcs: { sha: string; shortSha: string; branch: string };\n repository?: { name?: string; remoteUrl?: string };\n generatedAt: string;\n graph: VgGraph;\n}\n\nexport function buildEnvelope(root: string, graph: VgGraph, scanIngestId?: string): GraphUploadEnvelope {\n const sha = git(root, ['rev-parse', 'HEAD']) ?? '0000000000000000000000000000000000000000';\n const branch = git(root, ['rev-parse', '--abbrev-ref', 'HEAD']) ?? 'HEAD';\n const remoteUrl = git(root, ['config', '--get', 'remote.origin.url']) ?? undefined;\n return {\n schemaVersion: 'vg-graph/1.0',\n artifactType: 'graph',\n scanIngestId,\n vcs: { sha, shortSha: sha.slice(0, 12), branch },\n repository: remoteUrl ? { remoteUrl: redactUrlCredentials(remoteUrl) } : undefined,\n generatedAt: graph.generatedAt,\n graph: redactGraph(graph),\n };\n}\n\n/**\n * Redaction pass (GUARDRAILS §1: redact before storage). The graph is structure,\n * not content, but we defensively scrub any signature/name that matches a\n * credential-shaped pattern, and strip credentials from the remote URL.\n */\nexport function redactGraph(graph: VgGraph): VgGraph {\n return {\n ...graph,\n nodes: graph.nodes.map((n) => {\n const signature = n.signature ? redactSecrets(n.signature) : n.signature;\n const doc = n.doc ? redactSecrets(n.doc) : n.doc;\n return signature !== n.signature || doc !== n.doc ? { ...n, signature, doc } : n;\n }),\n };\n}\n\nfunction git(root: string, args: string[]): string | null {\n try {\n return execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim() || null;\n } catch {\n return null;\n }\n}\n"]}
@@ -1,161 +1,40 @@
1
+ import { McpToolset, defaultMcpConnect } from './chunk-LEPTUB4H.js';
1
2
  import { newSession, loadLatestSession, summarizeSession, saveSession, recordTask } from './chunk-K3SLGULW.js';
2
- import { runAgent } from './chunk-JBXNQCGE.js';
3
- import { printCodeLogo, runBuild, resolveProviders } from './chunk-2EVQKZTO.js';
4
- import { loadGraph, refreshIfStale, discoverModels, detectServeLaunch } from './chunk-VXT6LUGP.js';
5
- import './chunk-GGJZA3Q6.js';
6
- import './chunk-JSNHZCIV.js';
7
- import './chunk-PY3DNX5H.js';
3
+ import { startCodeRuntimeSession } from './chunk-JZYGEZTU.js';
4
+ import { TtyPrompter, PromptCancelled } from './chunk-JYS4OBN2.js';
5
+ import { printCodeLogo, runBuild, fetchCatalog, resolveProviders, topProviders } from './chunk-YDAT7LD2.js';
6
+ import { BranchGraphSession } from './chunk-SZLF66FJ.js';
7
+ import { loadOrDiscoverFederation } from './chunk-5I4VSBWQ.js';
8
+ import { resolveExecutionEnv } from './chunk-IS7VTH2Q.js';
9
+ import { runAgent } from './chunk-3BVSDMHV.js';
10
+ import { hasOllama, gatherSystemMemory, stopModel, pullModelClean } from './chunk-EDBV33B7.js';
11
+ import { estimateModelBytes, assessCapability, fmt } from './chunk-KHJO4D5N.js';
12
+ import { mergeModelExecutionProfile, resolveModelExecutionProfile } from './chunk-IZDH67DX.js';
13
+ import { resolveGraphBackend } from './chunk-4CQ3MGNN.js';
14
+ import { vgdIsRunning, vgdRequest } from './chunk-PMYWZRRS.js';
15
+ import './chunk-K7REHDQS.js';
16
+ import './chunk-JIBOJTGS.js';
17
+ import './chunk-NDMDSPFX.js';
18
+ import { nodeCodeFs, undoChanges } from './chunk-OXQNQW5J.js';
19
+ import { summarizeDiffs } from './chunk-7JHPQ6WF.js';
20
+ import { info, c, out } from './chunk-CT5BS56U.js';
21
+ import { refreshIfStale } from './chunk-S6CYDZEW.js';
22
+ import './chunk-WLETRGAC.js';
23
+ import './chunk-C4CKTAZP.js';
24
+ import './chunk-J7LKEB2R.js';
25
+ import { discoverModels } from './chunk-OOIG3RUM.js';
26
+ import { readModelSavings } from './chunk-EDAAG7BL.js';
27
+ import './chunk-6IOQJGFT.js';
28
+ import './chunk-3Q7QBWFW.js';
8
29
  import './chunk-RXP66R2E.js';
30
+ import { loadGraph, resolveGraphPath } from './chunk-HABUT7HW.js';
31
+ import './chunk-5Q54GEHM.js';
32
+ import './chunk-BWPBB45M.js';
33
+ import './chunk-JFGYT6BI.js';
34
+ import './chunk-BPF3YX2U.js';
9
35
  import './chunk-GI6W53LM.js';
10
36
  import './chunk-CRAMOEBE.js';
11
- import { nodeCodeFs, undoChanges } from './chunk-6CXTPC74.js';
12
- import { summarizeDiffs } from './chunk-CS37OBE3.js';
13
- import { readModelSavings } from './chunk-WNIIKCNF.js';
14
- import './chunk-JFGYT6BI.js';
15
- import { TtyPrompter, PromptCancelled } from './chunk-JYS4OBN2.js';
16
- import { info, c, out } from './chunk-CT5BS56U.js';
17
- import { McpToolset, defaultMcpConnect } from './chunk-LEPTUB4H.js';
18
- import * as fs from 'fs';
19
- import * as os2 from 'os';
20
- import * as path from 'path';
21
- import { spawnSync, spawn } from 'child_process';
22
-
23
- var PROVIDER_LABELS = {
24
- anthropic: "Anthropic (Claude)",
25
- openai: "OpenAI (GPT)",
26
- "x-ai": "xAI (Grok)",
27
- google: "Google (Gemini)",
28
- "meta-llama": "Meta (Llama)",
29
- deepseek: "DeepSeek",
30
- mistralai: "Mistral",
31
- qwen: "Qwen"
32
- };
33
- var FEATURED_ORDER = Object.keys(PROVIDER_LABELS);
34
- var OPENROUTER_MODELS_URL = "https://openrouter.ai/api/v1/models";
35
- var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
36
- function catalogCachePath() {
37
- const base = process.env.XDG_CACHE_HOME || path.join(os2.homedir(), ".cache");
38
- return path.join(base, "vibgrate", "catalog", "openrouter-models.json");
39
- }
40
- async function fetchCatalog(options = {}) {
41
- const now = options.now ?? (() => 0);
42
- const fetchImpl = options.fetchImpl ?? fetch;
43
- if (!options.noCache) {
44
- const cached = readCache();
45
- if (cached && (options.offline || now() - cached.ts < CACHE_TTL_MS)) {
46
- return { providers: groupModels(cached.models), fresh: false, source: "cache" };
47
- }
48
- }
49
- if (options.offline) {
50
- const cached = readCache();
51
- if (cached) return { providers: groupModels(cached.models), fresh: false, source: "cache" };
52
- return { providers: curatedFallback(), fresh: false, source: "fallback" };
53
- }
54
- try {
55
- const controller = new AbortController();
56
- const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? 8e3);
57
- let raw;
58
- try {
59
- const res = await fetchImpl(OPENROUTER_MODELS_URL, { signal: controller.signal });
60
- if (!res.ok) throw new Error(`HTTP ${res.status}`);
61
- raw = await res.json();
62
- } finally {
63
- clearTimeout(timer);
64
- }
65
- const models = parseModels(raw);
66
- if (models.length === 0) throw new Error("empty catalog");
67
- writeCache(models, now());
68
- return { providers: groupModels(models), fresh: true, source: "network" };
69
- } catch {
70
- const cached = readCache();
71
- if (cached) return { providers: groupModels(cached.models), fresh: false, source: "cache" };
72
- return { providers: curatedFallback(), fresh: false, source: "fallback" };
73
- }
74
- }
75
- function parseModels(raw) {
76
- const data = raw?.data;
77
- if (!Array.isArray(data)) return [];
78
- const out2 = [];
79
- for (const entry of data) {
80
- const e = entry;
81
- if (typeof e.id !== "string" || !e.id.includes("/")) continue;
82
- const provider = e.id.split("/")[0];
83
- out2.push({
84
- id: e.id,
85
- name: typeof e.name === "string" ? e.name : e.id,
86
- provider,
87
- contextLength: numeric(e.context_length),
88
- promptPricePerM: perMillion(e.pricing?.prompt),
89
- completionPricePerM: perMillion(e.pricing?.completion)
90
- });
91
- }
92
- return out2;
93
- }
94
- function groupModels(models) {
95
- const byProvider = /* @__PURE__ */ new Map();
96
- for (const m of models) {
97
- const list = byProvider.get(m.provider) ?? [];
98
- list.push(m);
99
- byProvider.set(m.provider, list);
100
- }
101
- const groups = [];
102
- for (const [id, list] of byProvider) {
103
- groups.push({ id, label: PROVIDER_LABELS[id] ?? titleCase(id), models: list.sort(rankModels) });
104
- }
105
- groups.sort((a, b) => {
106
- const ia = FEATURED_ORDER.indexOf(a.id);
107
- const ib = FEATURED_ORDER.indexOf(b.id);
108
- if (ia !== -1 || ib !== -1) return (ia === -1 ? 1e9 : ia) - (ib === -1 ? 1e9 : ib);
109
- return a.label.localeCompare(b.label);
110
- });
111
- return groups;
112
- }
113
- function rankModels(a, b) {
114
- const ca = isCoding(a) ? 0 : 1;
115
- const cb = isCoding(b) ? 0 : 1;
116
- if (ca !== cb) return ca - cb;
117
- const la = a.contextLength ?? 0;
118
- const lb = b.contextLength ?? 0;
119
- if (la !== lb) return lb - la;
120
- return a.id.localeCompare(b.id);
121
- }
122
- function isCoding(m) {
123
- return /cod(e|er|ing)/i.test(m.id) || /cod(e|er|ing)/i.test(m.name);
124
- }
125
- function topProviders(catalog, n = 6) {
126
- return catalog.providers.slice(0, n);
127
- }
128
- function readCache() {
129
- try {
130
- const parsed = JSON.parse(fs.readFileSync(catalogCachePath(), "utf8"));
131
- if (Array.isArray(parsed.models) && typeof parsed.ts === "number") return parsed;
132
- } catch {
133
- }
134
- return null;
135
- }
136
- function writeCache(models, ts) {
137
- try {
138
- const file = catalogCachePath();
139
- fs.mkdirSync(path.dirname(file), { recursive: true });
140
- fs.writeFileSync(file, JSON.stringify({ ts, models }));
141
- } catch {
142
- }
143
- }
144
- function curatedFallback() {
145
- return FEATURED_ORDER.map((id) => ({ id, label: PROVIDER_LABELS[id], models: [] }));
146
- }
147
- function numeric(v) {
148
- const n = typeof v === "string" ? Number(v) : typeof v === "number" ? v : NaN;
149
- return Number.isFinite(n) ? n : void 0;
150
- }
151
- function perMillion(v) {
152
- const n = numeric(v);
153
- if (n === void 0) return void 0;
154
- return Math.round(n * 1e6 * 1e3) / 1e3;
155
- }
156
- function titleCase(id) {
157
- return id.replace(/[-_]/g, " ").replace(/\b\w/g, (ch) => ch.toUpperCase());
158
- }
37
+ import { spawnSync } from 'child_process';
159
38
 
160
39
  // src/code/wizard.ts
161
40
  var ENTER_SLUG = "__enter_slug__";
@@ -238,160 +117,6 @@ function modelHint(contextLength, pricePerM) {
238
117
  return parts.join(" \xB7 ");
239
118
  }
240
119
 
241
- // src/code/capability.ts
242
- var GiB = 1024 ** 3;
243
- var QUANT_BYTES_PER_PARAM = {
244
- f16: 2,
245
- fp16: 2,
246
- f32: 4,
247
- q8: 1.06,
248
- q8_0: 1.06,
249
- q6: 0.82,
250
- q6_k: 0.82,
251
- q5: 0.7,
252
- q5_k_m: 0.72,
253
- q5_k_s: 0.68,
254
- q5_0: 0.71,
255
- q5_1: 0.77,
256
- q4: 0.58,
257
- q4_k_m: 0.6,
258
- q4_k_s: 0.56,
259
- q4_0: 0.56,
260
- q4_1: 0.63,
261
- q3: 0.46,
262
- q3_k_m: 0.48,
263
- q3_k_s: 0.44,
264
- q2: 0.36,
265
- q2_k: 0.4
266
- };
267
- var DEFAULT_QUANT = "q4_k_m";
268
- var RUNTIME_OVERHEAD = 1.2;
269
- function estimateModelBytes(slug, defaultParamsB = 7) {
270
- const lower = slug.toLowerCase();
271
- const paramMatch = lower.match(/(\d+(?:\.\d+)?)\s*b\b/);
272
- const paramsB = paramMatch ? Number(paramMatch[1]) : void 0;
273
- const quant = detectQuant(lower);
274
- const bytesPerParam = QUANT_BYTES_PER_PARAM[quant] ?? QUANT_BYTES_PER_PARAM[DEFAULT_QUANT];
275
- const effectiveParams = (paramsB ?? defaultParamsB) * 1e9;
276
- const bytes = Math.round(effectiveParams * bytesPerParam * RUNTIME_OVERHEAD);
277
- return { paramsB, quant, bytes, guessed: paramsB === void 0 };
278
- }
279
- function detectQuant(lower) {
280
- const keys = Object.keys(QUANT_BYTES_PER_PARAM).sort((a, b) => b.length - a.length);
281
- for (const k of keys) if (lower.includes(k)) return k;
282
- return DEFAULT_QUANT;
283
- }
284
- function parseOllamaPs(stdout) {
285
- const lines = stdout.split("\n").map((l) => l.trim()).filter(Boolean);
286
- const out2 = [];
287
- for (const line of lines) {
288
- if (/^NAME\b/i.test(line)) continue;
289
- const sizeMatch = line.match(/(\d+(?:\.\d+)?)\s*(GB|GiB|MB|MiB|TB)/i);
290
- const name = line.split(/\s+/)[0];
291
- if (!name || !sizeMatch) continue;
292
- out2.push({ name, bytes: toBytes(Number(sizeMatch[1]), sizeMatch[2]) });
293
- }
294
- return out2;
295
- }
296
- function parseNvidiaSmi(stdout) {
297
- const line = stdout.split("\n").map((l) => l.trim()).find(Boolean);
298
- if (!line) return null;
299
- const parts = line.split(",").map((p) => Number(p.trim()));
300
- if (parts.length < 2 || !Number.isFinite(parts[0]) || !Number.isFinite(parts[1])) return null;
301
- return { totalBytes: parts[0] * 1024 * 1024, usedBytes: parts[1] * 1024 * 1024 };
302
- }
303
- function assessCapability(model, sys) {
304
- const useVram = typeof sys.vramTotalBytes === "number" && sys.vramTotalBytes > 0;
305
- const free = useVram ? sys.vramFreeBytes ?? 0 : sys.freeRamBytes;
306
- const loadedBytes = sys.loaded.reduce((n, m) => n + m.bytes, 0);
307
- const margin = Math.min(2 * GiB, (useVram ? sys.vramTotalBytes : sys.totalRamBytes) * 0.1);
308
- const available = Math.max(0, free - margin);
309
- const availableIfUnloaded = Math.max(0, free + loadedBytes - margin);
310
- const need = model.bytes;
311
- const canRunNow = available >= need;
312
- const canRunUnloaded = availableIfUnloaded >= need;
313
- const suggestions = [];
314
- if (!canRunNow && canRunUnloaded && sys.loaded.length) {
315
- const biggest = [...sys.loaded].sort((a, b) => b.bytes - a.bytes);
316
- suggestions.push(`unload a loaded model to free memory (e.g. \`ollama stop ${biggest[0].name}\` frees ~${fmt(biggest[0].bytes)})`);
317
- }
318
- if (!canRunUnloaded) {
319
- suggestions.push(`this model needs ~${fmt(need)} but only ~${fmt(availableIfUnloaded)} is available \u2014 choose a smaller model or a lower quant (e.g. q4_K_M)`);
320
- }
321
- if (model.guessed) {
322
- suggestions.push(`couldn't read the parameter count from the name \u2014 this estimate assumes a ~${(model.bytes / GiB).toFixed(1)} GiB model; verify before pulling`);
323
- }
324
- return {
325
- model,
326
- availableBytes: available,
327
- availableIfUnloadedBytes: availableIfUnloaded,
328
- canRun: canRunNow || canRunUnloaded,
329
- needsUnload: !canRunNow && canRunUnloaded,
330
- suggestions,
331
- loaded: sys.loaded
332
- };
333
- }
334
- function fmt(bytes) {
335
- if (bytes >= GiB) return `${(bytes / GiB).toFixed(1)} GiB`;
336
- return `${(bytes / (1024 * 1024)).toFixed(0)} MiB`;
337
- }
338
- function toBytes(n, unit) {
339
- const u = unit.toLowerCase();
340
- if (u.startsWith("t")) return n * 1e3 ** 4;
341
- if (u.startsWith("g")) return n * (u.includes("i") ? GiB : 1e9);
342
- if (u.startsWith("m")) return n * (u.includes("i") ? 1024 * 1024 : 1e6);
343
- return n;
344
- }
345
- function gatherSystemMemory() {
346
- const loaded = safeRun("ollama", ["ps"]).map(parseOllamaPs).flat();
347
- const smi = safeRun("nvidia-smi", ["--query-gpu=memory.total,memory.used", "--format=csv,noheader,nounits"]).map(parseNvidiaSmi).find(Boolean);
348
- const sys = {
349
- totalRamBytes: os2.totalmem(),
350
- freeRamBytes: os2.freemem(),
351
- loaded
352
- };
353
- if (smi) {
354
- sys.vramTotalBytes = smi.totalBytes;
355
- sys.vramFreeBytes = Math.max(0, smi.totalBytes - smi.usedBytes);
356
- }
357
- return sys;
358
- }
359
- function hasOllama() {
360
- return spawnSync(process.platform === "win32" ? "where" : "which", ["ollama"], { stdio: "ignore" }).status === 0;
361
- }
362
- function stopModel(name) {
363
- return spawnSync("ollama", ["stop", name], { stdio: "ignore" }).status === 0;
364
- }
365
- function pullModelClean(name, spinner) {
366
- return new Promise((resolve) => {
367
- const child = spawn("ollama", ["pull", name]);
368
- const onData = (buf) => {
369
- const line = lastMeaningfulLine(buf.toString());
370
- if (line) spinner.update(`pulling ${name} \u2014 ${line}`);
371
- };
372
- child.stdout?.on("data", onData);
373
- child.stderr?.on("data", onData);
374
- child.on("error", () => resolve(false));
375
- child.on("close", (code) => resolve(code === 0));
376
- });
377
- }
378
- function lastMeaningfulLine(chunk) {
379
- const lines = chunk.split(/[\r\n]+/).map((l) => l.trim()).map((l) => l.replace(/\x1b\[[0-9;]*[A-Za-z]/g, "").replace(/[▏▎▍▌▋▊▉█░▒▓⣀-⣿]/g, "").trim()).filter(Boolean);
380
- const last = lines[lines.length - 1] ?? "";
381
- const pct = last.match(/(\d+)\s*%/);
382
- const status = last.replace(/\s{2,}.*$/, "").slice(0, 48);
383
- return pct ? `${status} ${pct[1]}%`.trim() : status;
384
- }
385
- function safeRun(bin, args) {
386
- try {
387
- const res = spawnSync(bin, args, { encoding: "utf8", timeout: 5e3 });
388
- if (res.status !== 0 || typeof res.stdout !== "string") return [];
389
- return [res.stdout];
390
- } catch {
391
- return [];
392
- }
393
- }
394
-
395
120
  // src/code/cost.ts
396
121
  function costOf(usage, pricing) {
397
122
  const inCost = (usage.promptTokens ?? 0) / 1e6 * (pricing.promptPerM ?? 0);
@@ -439,54 +164,23 @@ function fmtTokens(n) {
439
164
  function round4(x) {
440
165
  return Math.round(x * 1e4) / 1e4;
441
166
  }
442
- var GraphProcess = class _GraphProcess {
443
- child;
444
- disposed = false;
445
- command;
446
- args;
447
- constructor(child, command, args) {
448
- this.child = child;
449
- this.command = command;
450
- this.args = args;
451
- child.once("exit", () => {
452
- this.child = null;
453
- });
454
- }
455
- static start(options) {
456
- const launch = options.launch ?? detectServeLaunch();
457
- const client = options.client ?? "vg-code";
458
- const args = [...launch.args, "--client", client];
459
- const spawnImpl = options.spawnImpl ?? spawn;
460
- try {
461
- const child = spawnImpl(launch.command, args, { cwd: options.root, stdio: "ignore", detached: false });
462
- if (!child || typeof child.pid !== "number") return null;
463
- child.on("error", () => {
464
- });
465
- return new _GraphProcess(child, launch.command, args);
466
- } catch {
467
- return null;
468
- }
469
- }
470
- get pid() {
471
- return this.child?.pid;
472
- }
473
- /** True while the child is believed to be running. */
474
- get running() {
475
- return this.child !== null && !this.disposed;
476
- }
477
- /** Kill the child. Idempotent and safe to call after the child already exited. */
478
- dispose() {
479
- if (this.disposed) return;
480
- this.disposed = true;
481
- const child = this.child;
482
- this.child = null;
483
- if (!child || child.killed) return;
484
- try {
485
- child.kill("SIGTERM");
486
- } catch {
487
- }
488
- }
489
- };
167
+
168
+ // src/runtime/bridge-facts.ts
169
+ function bridgePinnedFacts(bridges, options = {}) {
170
+ if (!bridges?.length) return [];
171
+ const min = options.minConfidence ?? 0.8;
172
+ const max = options.maxFacts ?? 12;
173
+ return bridges.filter((b) => b.confidence >= min).map((b) => {
174
+ const from = shortLabel(b.fromRoot);
175
+ const to = shortLabel(b.toRoot);
176
+ const via = b.packageName ? ` package ${b.packageName}` : "";
177
+ return `bridge ${b.kind}: ${from} \u2192 ${to}${via} (${b.confidence.toFixed(2)})`;
178
+ }).sort((a, b) => a.localeCompare(b)).slice(0, max);
179
+ }
180
+ function shortLabel(root) {
181
+ const parts = root.replace(/\\/g, "/").split("/").filter(Boolean);
182
+ return parts[parts.length - 1] || root;
183
+ }
490
184
 
491
185
  // src/code/interactive.ts
492
186
  async function runInteractive(root, global, opts, prompter = new TtyPrompter()) {
@@ -518,7 +212,8 @@ async function ensureMap(root, global, prompter) {
518
212
  return;
519
213
  }
520
214
  const sp = prompter.spinner("Checking the code map is up to date\u2026");
521
- const refreshed = await refreshIfStale(root).catch(() => null);
215
+ const graphPath = resolveGraphPath(root);
216
+ const refreshed = await refreshIfStale(root, { graphPath }).catch(() => null);
522
217
  if (refreshed?.status === "refreshed") sp.stop("Code map refreshed");
523
218
  else sp.stop("Code map ready");
524
219
  }
@@ -593,14 +288,58 @@ async function codingRepl(root, global, opts, selection, prompter) {
593
288
  sp.stop(`MCP tools: ${toolset.specs().length} from ${Object.keys(opts.mcpServers).length} server(s)${from}`);
594
289
  for (const w of warnings) prompter.note(c.yellow(` ${w}`));
595
290
  }
596
- const graphProc = GraphProcess.start({ root });
291
+ const runtime = await startCodeRuntimeSession({ root });
292
+ const branchGraphs = new BranchGraphSession({ root, graphPath: global.graph });
293
+ const federation = loadOrDiscoverFederation(root);
294
+ const extraPinnedFacts = bridgePinnedFacts(federation.bridges);
295
+ if (federation.members.length > 1 && await vgdIsRunning({ socketPath: runtime.socketPath })) {
296
+ try {
297
+ await vgdRequest(
298
+ {
299
+ op: "register-federation",
300
+ primaryRoot: federation.primaryRoot,
301
+ members: federation.members.map((m) => ({ root: m.root, label: m.label, role: m.role }))
302
+ },
303
+ { socketPath: runtime.socketPath }
304
+ );
305
+ const bridgeN = federation.bridges?.length ?? 0;
306
+ prompter.note(
307
+ c.dim(
308
+ `federation \xB7 ${federation.members.length} workspace(s) registered with vgd` + (bridgeN ? ` \xB7 ${bridgeN} bridge edge(s)` : "")
309
+ )
310
+ );
311
+ } catch {
312
+ }
313
+ } else if ((federation.bridges?.length ?? 0) > 0) {
314
+ prompter.note(
315
+ c.dim(
316
+ `federation \xB7 ${federation.members.length} member(s) \xB7 ${federation.bridges.length} bridge edge(s) (discovery)`
317
+ )
318
+ );
319
+ }
320
+ let modelProfile = mergeModelExecutionProfile(
321
+ resolveModelExecutionProfile({
322
+ providerId: sel.providerSlug,
323
+ model: sel.model,
324
+ budget: opts.budget ? Number(opts.budget) : void 0,
325
+ maxRepairRounds: opts.verify?.maxRounds,
326
+ securityTier: opts.securityTier
327
+ }),
328
+ opts.modelProfile
329
+ );
330
+ const securityTier = opts.securityTier ?? modelProfile.securityTier ?? (opts.auto ? "L1" : "L0");
331
+ const writableRoots = federation?.members.map((m) => m.root) ?? [root];
332
+ const executionEnv = resolveExecutionEnv(securityTier, { writableRoots });
597
333
  const cleanup = () => {
598
- graphProc?.dispose();
334
+ void runtime.dispose();
599
335
  void mcp?.dispose();
600
336
  };
601
337
  process.once("SIGINT", cleanup);
602
338
  const autoNote = opts.auto ? c.yellow(" \xB7 auto-approve ON") : "";
603
- prompter.intro(`Ready \u2014 ${sel.providerSlug}/${sel.model}${graphProc ? c.dim(" \xB7 graph " + graphProc.pid) : ""}${autoNote}. Describe a task, or /help. Empty line to exit.`);
339
+ const runtimeNote = runtime.kind !== "none" ? c.dim(` \xB7 ${runtime.label}`) : "";
340
+ const securityNote = c.dim(` \xB7 ${executionEnv.tier}/${executionEnv.label}`);
341
+ const mepNote = c.dim(` \xB7 mep ${modelProfile.mode}`);
342
+ prompter.intro(`Ready \u2014 ${sel.providerSlug}/${sel.model}${runtimeNote}${securityNote}${mepNote}${autoNote}. Describe a task, or /help. Empty line to exit.`);
604
343
  try {
605
344
  for (; ; ) {
606
345
  const line = (await prompter.input("code \u203A")).trim();
@@ -638,11 +377,47 @@ async function codingRepl(root, global, opts, selection, prompter) {
638
377
  }
639
378
  continue;
640
379
  }
641
- const graph = loadGraph(root, global.graph);
380
+ const branchLoad = branchGraphs.ensureCurrent();
381
+ const graph = branchLoad.graph;
642
382
  if (!graph) {
643
383
  prompter.note(c.red("the code map disappeared \u2014 run `vg` to rebuild"));
644
384
  break;
645
385
  }
386
+ if (branchLoad.switched) {
387
+ prompter.note(
388
+ c.dim(
389
+ `branch \xB7 ${branchLoad.gitRef}${branchLoad.fromCache ? " (warm cache)" : " (loaded map)"}`
390
+ )
391
+ );
392
+ }
393
+ if (runtime.socketPath && graph && branchLoad.gitRef && branchLoad.gitRef !== "unknown") {
394
+ void vgdRequest(
395
+ {
396
+ op: "put-graph",
397
+ repositoryId: branchLoad.repositoryId,
398
+ gitRef: branchLoad.gitRef,
399
+ graph
400
+ },
401
+ { socketPath: runtime.socketPath }
402
+ ).catch(() => {
403
+ });
404
+ }
405
+ const graphBackend = resolveGraphBackend({
406
+ graph,
407
+ repositoryId: branchLoad.repositoryId,
408
+ gitRef: branchLoad.gitRef !== "unknown" ? branchLoad.gitRef : null,
409
+ socketPath: runtime.socketPath
410
+ });
411
+ modelProfile = mergeModelExecutionProfile(
412
+ resolveModelExecutionProfile({
413
+ providerId: sel.providerSlug,
414
+ model: sel.model,
415
+ budget: opts.budget ? Number(opts.budget) : void 0,
416
+ maxRepairRounds: opts.verify?.maxRounds,
417
+ securityTier
418
+ }),
419
+ opts.modelProfile
420
+ );
646
421
  const result = await agentTask({
647
422
  root,
648
423
  graph,
@@ -652,15 +427,21 @@ async function codingRepl(root, global, opts, selection, prompter) {
652
427
  attribution: { client: "vg-code", provider: sel.providerSlug, model: sel.model },
653
428
  auto: !!opts.auto,
654
429
  maxSteps: opts.maxSteps,
430
+ budget: modelProfile.capsuleBudgetTokens,
655
431
  denyCommands: opts.denyCommands,
656
432
  testCommand: opts.testCommand,
657
433
  contextBudget: opts.contextBudget,
658
434
  stream: opts.stream,
659
- verify: opts.verify,
435
+ verify: opts.verify ? { ...opts.verify, maxRounds: opts.verify.maxRounds ?? modelProfile.maxRepairRounds } : void 0,
660
436
  priorSummary,
661
437
  externalTools: mcp ? mcpExternalTools(mcp, agentApprove(opts, prompter)) : void 0,
662
438
  meter,
663
- prompter
439
+ prompter,
440
+ capsule: opts.capsule,
441
+ executionEnv,
442
+ graphBackend,
443
+ modelProfile,
444
+ extraPinnedFacts
664
445
  });
665
446
  priorSummary = void 0;
666
447
  if (result.changes.length) {
@@ -680,6 +461,12 @@ function agentApprove(opts, prompter) {
680
461
  return async (action) => {
681
462
  if (opts.auto) return true;
682
463
  if (action.kind === "tool") return prompter.confirm(`Call ${action.name}?`, false);
464
+ if (action.kind === "patch") {
465
+ const n = action.files.length;
466
+ const names = action.files.slice(0, 6).map((f) => f.file).join(", ");
467
+ const more = n > 6 ? ` (+${n - 6} more)` : "";
468
+ return prompter.confirm(`Apply patch to ${n} file(s): ${names}${more}?`, false);
469
+ }
683
470
  return true;
684
471
  };
685
472
  }
@@ -736,6 +523,16 @@ async function agentTask(params) {
736
523
  return prompter.confirm(`Run \`${action.command}\`?`, false);
737
524
  case "tool":
738
525
  return prompter.confirm(`Call ${action.name}(${briefArgs(action.args)})?`, false);
526
+ case "patch": {
527
+ const n = action.files.length;
528
+ for (const f of action.files) {
529
+ if (f.diff) out(f.diff);
530
+ else out(`${f.op} ${f.file}`);
531
+ }
532
+ const names = action.files.slice(0, 6).map((f) => f.file).join(", ");
533
+ const more = n > 6 ? ` (+${n - 6} more)` : "";
534
+ return prompter.confirm(`Apply patch to ${n} file(s): ${names}${more}?`, false);
535
+ }
739
536
  }
740
537
  };
741
538
  let streaming = false;
@@ -762,6 +559,20 @@ async function agentTask(params) {
762
559
  info(c.dim(` \xB7 compacted context (${e.droppedRounds} earlier round(s) summarized)`));
763
560
  } else if (e.type === "verify") {
764
561
  info(e.passed ? c.green(` \u2714 ${e.command} passed`) : c.yellow(` \u2717 ${e.command} failed \u2014 asking the model to fix it`));
562
+ } else if (e.type === "ladder") {
563
+ info(e.ok ? c.green(" \u2714 verification ladder passed") : c.yellow(" \u2717 verification ladder failed \u2014 asking the model to fix it"));
564
+ if (!e.ok && e.summary.trim()) {
565
+ for (const line of e.summary.split("\n").slice(0, 6)) info(c.dim(` ${line}`));
566
+ }
567
+ } else if (e.type === "session-graph") {
568
+ info(c.dim(` \xB7 session graph updated (${e.reparsed} reparsed, ${e.dirty} dirty)`));
569
+ } else if (e.type === "capsule") {
570
+ info(c.dim(` \xB7 Task Capsule \xB7 ${e.summary.primary.length} primary \xB7 ${e.summary.sourceSliceCount} source slice(s) \xB7 ~${e.summary.tokensEstimate} tokens`));
571
+ } else if (e.type === "failure-capsule") {
572
+ info(c.yellow(` \xB7 Failure Capsule \xB7 ${e.capsule.failedStep.type}${e.capsule.failedStep.command ? ` \xB7 ${e.capsule.failedStep.command}` : ""}`));
573
+ } else if (e.type === "metrics") {
574
+ const m = e.metrics;
575
+ info(c.dim(` \xB7 metrics \xB7 discovery ${m.discoveryToolCalls} \xB7 mutations ${m.mutationToolCalls}${m.znsAt1 ? " \xB7 ZNS@1" : ""}`));
765
576
  }
766
577
  };
767
578
  const result = await runAgent({
@@ -771,6 +582,13 @@ async function agentTask(params) {
771
582
  providers: params.providers,
772
583
  fsImpl: params.fsImpl,
773
584
  run: shellRunner(params.root),
585
+ executionEnv: params.executionEnv,
586
+ graphBackend: params.graphBackend,
587
+ modelProfile: params.modelProfile,
588
+ advancedMode: params.advancedMode,
589
+ // Interactive sessions always prefer a worktree-correct map unless disabled.
590
+ worktreeOverlay: params.worktreeOverlay ?? true,
591
+ extraPinnedFacts: params.extraPinnedFacts,
774
592
  approve,
775
593
  onEvent,
776
594
  attribution: params.attribution,
@@ -784,6 +602,8 @@ async function agentTask(params) {
784
602
  verify: params.verify,
785
603
  priorSummary: params.priorSummary,
786
604
  externalTools: params.externalTools,
605
+ capsule: params.capsule,
606
+ files: params.files,
787
607
  now: () => Date.now()
788
608
  });
789
609
  closeStream();
@@ -816,5 +636,5 @@ ${res.stderr}` : "");
816
636
  }
817
637
 
818
638
  export { agentTask, runInteractive };
819
- //# sourceMappingURL=interactive-736PBC7J.js.map
820
- //# sourceMappingURL=interactive-736PBC7J.js.map
639
+ //# sourceMappingURL=interactive-ICL7D7LO.js.map
640
+ //# sourceMappingURL=interactive-ICL7D7LO.js.map