@vibgrate/cli 2026.818.2 → 2026.819.2
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/DOCS.md +3 -3
- package/dist/agent-ZJRWCMR6.js +30 -0
- package/dist/{agent-X6VYCE63.js.map → agent-ZJRWCMR6.js.map} +1 -1
- package/dist/{approvals-TPQFQSWG.js → approvals-YTUXBZWQ.js} +7 -7
- package/dist/{approvals-TPQFQSWG.js.map → approvals-YTUXBZWQ.js.map} +1 -1
- package/dist/attach-WOA25VNH.js +10 -0
- package/dist/{attach-G5JUIWIT.js.map → attach-WOA25VNH.js.map} +1 -1
- package/dist/baseline-TVRRUZGA.js +9 -0
- package/dist/{baseline-DXI64VLW.js.map → baseline-TVRRUZGA.js.map} +1 -1
- package/dist/{chunk-V6WONSIK.js → chunk-24HKTTFV.js} +5 -5
- package/dist/{chunk-V6WONSIK.js.map → chunk-24HKTTFV.js.map} +1 -1
- package/dist/{chunk-VMAIDM4K.js → chunk-2C4QT5D7.js} +5 -5
- package/dist/{chunk-VMAIDM4K.js.map → chunk-2C4QT5D7.js.map} +1 -1
- package/dist/{chunk-JGA63RGF.js → chunk-2ZBLZ2S3.js} +13 -13
- package/dist/{chunk-JGA63RGF.js.map → chunk-2ZBLZ2S3.js.map} +1 -1
- package/dist/{chunk-OV4KGXPD.js → chunk-57ZRSCHY.js} +3 -3
- package/dist/{chunk-OV4KGXPD.js.map → chunk-57ZRSCHY.js.map} +1 -1
- package/dist/{chunk-NDNNOAS6.js → chunk-6H2QV5DR.js} +3 -3
- package/dist/{chunk-NDNNOAS6.js.map → chunk-6H2QV5DR.js.map} +1 -1
- package/dist/{chunk-2C33WR5O.js → chunk-7BSUPHX6.js} +3 -3
- package/dist/{chunk-2C33WR5O.js.map → chunk-7BSUPHX6.js.map} +1 -1
- package/dist/{chunk-LJSJX6U4.js → chunk-A3WWRW7U.js} +3 -3
- package/dist/{chunk-LJSJX6U4.js.map → chunk-A3WWRW7U.js.map} +1 -1
- package/dist/{chunk-X2MQ7UFL.js → chunk-AP3JN33O.js} +12 -12
- package/dist/{chunk-X2MQ7UFL.js.map → chunk-AP3JN33O.js.map} +1 -1
- package/dist/{chunk-O5IJDMTB.js → chunk-AQZYDFEK.js} +4 -4
- package/dist/{chunk-O5IJDMTB.js.map → chunk-AQZYDFEK.js.map} +1 -1
- package/dist/{chunk-VQ5KMHW6.js → chunk-BQ6NTRRK.js} +44 -15
- package/dist/chunk-BQ6NTRRK.js.map +1 -0
- package/dist/{chunk-HF6R73UC.js → chunk-C2EZIAA3.js} +27 -13
- package/dist/chunk-C2EZIAA3.js.map +1 -0
- package/dist/{chunk-MRZHNUN7.js → chunk-CA4YQBA7.js} +4 -4
- package/dist/{chunk-MRZHNUN7.js.map → chunk-CA4YQBA7.js.map} +1 -1
- package/dist/{chunk-YF54UMOU.js → chunk-CBL3VY7J.js} +3 -3
- package/dist/{chunk-YF54UMOU.js.map → chunk-CBL3VY7J.js.map} +1 -1
- package/dist/{chunk-PRHH4DVO.js → chunk-FCMWHSQ6.js} +3 -3
- package/dist/{chunk-PRHH4DVO.js.map → chunk-FCMWHSQ6.js.map} +1 -1
- package/dist/{chunk-V2UGRUTL.js → chunk-GBXOAO5V.js} +176 -37
- package/dist/chunk-GBXOAO5V.js.map +1 -0
- package/dist/{chunk-JFE7XCAE.js → chunk-IASO2HCI.js} +3 -3
- package/dist/{chunk-JFE7XCAE.js.map → chunk-IASO2HCI.js.map} +1 -1
- package/dist/{chunk-ZUOBPKVK.js → chunk-IMI2VHHZ.js} +3 -3
- package/dist/{chunk-ZUOBPKVK.js.map → chunk-IMI2VHHZ.js.map} +1 -1
- package/dist/{chunk-NKLYDSB7.js → chunk-JPOYXG7Z.js} +10 -10
- package/dist/{chunk-NKLYDSB7.js.map → chunk-JPOYXG7Z.js.map} +1 -1
- package/dist/{chunk-L2OS4WHT.js → chunk-MMJFHEZ4.js} +4 -4
- package/dist/{chunk-L2OS4WHT.js.map → chunk-MMJFHEZ4.js.map} +1 -1
- package/dist/{chunk-E3O5UKNA.js → chunk-NKKOGJ63.js} +35 -17
- package/dist/chunk-NKKOGJ63.js.map +1 -0
- package/dist/{chunk-7AVYKZEM.js → chunk-NV7XNBX4.js} +4 -4
- package/dist/{chunk-7AVYKZEM.js.map → chunk-NV7XNBX4.js.map} +1 -1
- package/dist/{chunk-NJQZRM55.js → chunk-OGFOJG4H.js} +6 -6
- package/dist/{chunk-NJQZRM55.js.map → chunk-OGFOJG4H.js.map} +1 -1
- package/dist/{chunk-NZELMYT4.js → chunk-OLIMW4PQ.js} +8 -56
- package/dist/chunk-OLIMW4PQ.js.map +1 -0
- package/dist/{chunk-B4EXD5LK.js → chunk-PJRPSYFQ.js} +9 -7
- package/dist/chunk-PJRPSYFQ.js.map +1 -0
- package/dist/{chunk-NG4KIJW6.js → chunk-PVNALGTG.js} +10 -6
- package/dist/chunk-PVNALGTG.js.map +1 -0
- package/dist/{chunk-BMOFJIMG.js → chunk-QE6F62FR.js} +3 -3
- package/dist/{chunk-BMOFJIMG.js.map → chunk-QE6F62FR.js.map} +1 -1
- package/dist/{chunk-6ABMV74F.js → chunk-R5TQBIR6.js} +4 -4
- package/dist/{chunk-6ABMV74F.js.map → chunk-R5TQBIR6.js.map} +1 -1
- package/dist/{chunk-5I4VSBWQ.js → chunk-RTURQXQL.js} +372 -113
- package/dist/chunk-RTURQXQL.js.map +1 -0
- package/dist/{chunk-74UBGF4P.js → chunk-SHD5TCZ5.js} +3 -3
- package/dist/{chunk-74UBGF4P.js.map → chunk-SHD5TCZ5.js.map} +1 -1
- package/dist/{chunk-KU7FI5EV.js → chunk-USPMMVNH.js} +3 -3
- package/dist/{chunk-KU7FI5EV.js.map → chunk-USPMMVNH.js.map} +1 -1
- package/dist/{chunk-E53WBVUQ.js → chunk-VHRSG6CF.js} +3 -3
- package/dist/{chunk-E53WBVUQ.js.map → chunk-VHRSG6CF.js.map} +1 -1
- package/dist/{chunk-I5LP55B6.js → chunk-W44THEXF.js} +3 -3
- package/dist/{chunk-I5LP55B6.js.map → chunk-W44THEXF.js.map} +1 -1
- package/dist/{chunk-AEJYA6HZ.js → chunk-W6ASIMG5.js} +7 -7
- package/dist/{chunk-AEJYA6HZ.js.map → chunk-W6ASIMG5.js.map} +1 -1
- package/dist/{chunk-CQDUBAQY.js → chunk-WNKGRXUA.js} +3 -3
- package/dist/{chunk-CQDUBAQY.js.map → chunk-WNKGRXUA.js.map} +1 -1
- package/dist/{chunk-RHKOUPWT.js → chunk-WPLOEFZU.js} +7 -5
- package/dist/chunk-WPLOEFZU.js.map +1 -0
- package/dist/{chunk-FJG5AXKZ.js → chunk-WUFIXAEJ.js} +22 -6
- package/dist/chunk-WUFIXAEJ.js.map +1 -0
- package/dist/{chunk-6PFHDHOL.js → chunk-XLQ4YHS3.js} +16 -14
- package/dist/chunk-XLQ4YHS3.js.map +1 -0
- package/dist/{chunk-BWPBB45M.js → chunk-XP6UUCZZ.js} +3 -3
- package/dist/{chunk-BWPBB45M.js.map → chunk-XP6UUCZZ.js.map} +1 -1
- package/dist/{chunk-BPF3YX2U.js → chunk-XQNKCA2J.js} +6 -3
- package/dist/chunk-XQNKCA2J.js.map +1 -0
- package/dist/{chunk-FFXGWFAE.js → chunk-XW2XQM3C.js} +7 -7
- package/dist/{chunk-FFXGWFAE.js.map → chunk-XW2XQM3C.js.map} +1 -1
- package/dist/{chunk-7N4Y3E47.js → chunk-YJYEPYB2.js} +13 -18
- package/dist/chunk-YJYEPYB2.js.map +1 -0
- package/dist/chunk-ZUZHYAJK.js +6 -0
- package/dist/{chunk-4NTNMT6T.js.map → chunk-ZUZHYAJK.js.map} +1 -1
- package/dist/cli.js +112 -108
- package/dist/cli.js.map +1 -1
- package/dist/client-P5XSRFV4.js +8 -0
- package/dist/{client-UQIELEEZ.js.map → client-P5XSRFV4.js.map} +1 -1
- package/dist/daemon-YKOEP3XA.js +30 -0
- package/dist/{daemon-GUMWMKCA.js.map → daemon-YKOEP3XA.js.map} +1 -1
- package/dist/embed-worker-main.js +5 -5
- package/dist/ensure-map-BLRJDO2Y.js +40 -0
- package/dist/{ensure-map-FHDJTO7Y.js.map → ensure-map-BLRJDO2Y.js.map} +1 -1
- package/dist/federation-M4ZNXOPX.js +8 -0
- package/dist/{federation-MDQPO3PW.js.map → federation-M4ZNXOPX.js.map} +1 -1
- package/dist/fs-FO3NQHPT.js +4 -0
- package/dist/fs-FO3NQHPT.js.map +1 -0
- package/dist/git-ref-LMT3EXYY.js +4 -0
- package/dist/{git-ref-RSRAN4OH.js.map → git-ref-LMT3EXYY.js.map} +1 -1
- package/dist/graph-backend-NTYONTWW.js +16 -0
- package/dist/{graph-backend-W2D3HRRD.js.map → graph-backend-NTYONTWW.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -25
- package/dist/index.js.map +1 -1
- package/dist/{interactive-2MK4TLRD.js → interactive-B3WTC7LB.js} +41 -42
- package/dist/interactive-B3WTC7LB.js.map +1 -0
- package/dist/{llm-host-XFYFOAAX.js → llm-host-QVTJJVER.js} +5 -5
- package/dist/{llm-host-XFYFOAAX.js.map → llm-host-QVTJJVER.js.map} +1 -1
- package/dist/load-AJROS77R.js +11 -0
- package/dist/{load-4R4HYMBB.js.map → load-AJROS77R.js.map} +1 -1
- package/dist/local-runtime-GA43KYS5.js +6 -0
- package/dist/{local-runtime-6SNWKSA7.js.map → local-runtime-GA43KYS5.js.map} +1 -1
- package/dist/model-manager-6H3TMZKK.js +10 -0
- package/dist/{model-manager-SXHZ5VD4.js.map → model-manager-6H3TMZKK.js.map} +1 -1
- package/dist/{model-orchestrator-LHYPJBFH.js → model-orchestrator-X3NE3Y2G.js} +6 -6
- package/dist/{model-orchestrator-LHYPJBFH.js.map → model-orchestrator-X3NE3Y2G.js.map} +1 -1
- package/dist/parse-worker.js +2 -2
- package/dist/{paths-62AKTFSR.js → paths-RVK6FKRN.js} +4 -4
- package/dist/{paths-62AKTFSR.js.map → paths-RVK6FKRN.js.map} +1 -1
- package/dist/publish-27S66NOW.js +9 -0
- package/dist/{publish-7YHRTBRA.js.map → publish-27S66NOW.js.map} +1 -1
- package/dist/resolve-gguf-WVKVDN45.js +9 -0
- package/dist/{resolve-gguf-SDIYGGI6.js.map → resolve-gguf-WVKVDN45.js.map} +1 -1
- package/dist/{run-outcome-H5GVDDZJ.js → run-outcome-SBBSTSH3.js} +7 -7
- package/dist/{run-outcome-H5GVDDZJ.js.map → run-outcome-SBBSTSH3.js.map} +1 -1
- package/dist/runtime-session-JYYKQVDX.js +26 -0
- package/dist/{runtime-session-JBIHHH5N.js.map → runtime-session-JYYKQVDX.js.map} +1 -1
- package/dist/session-2ZMHZ2O6.js +17 -0
- package/dist/{session-N5IU4K5Q.js.map → session-2ZMHZ2O6.js.map} +1 -1
- package/dist/{slot-subscription-25GOARW5.js → slot-subscription-C2ZUJED6.js} +5 -5
- package/dist/{slot-subscription-25GOARW5.js.map → slot-subscription-C2ZUJED6.js.map} +1 -1
- package/dist/{stream-json-4WLSUF6I.js → stream-json-ZWGB4C47.js} +17 -17
- package/dist/{stream-json-4WLSUF6I.js.map → stream-json-ZWGB4C47.js.map} +1 -1
- package/dist/version-5QIEUXU6.js +4 -0
- package/dist/{version-DTEU3SQD.js.map → version-5QIEUXU6.js.map} +1 -1
- package/dist/{vg-mcp-bridge-KDVYIMFX.js → vg-mcp-bridge-4FETMJ6M.js} +16 -15
- package/dist/vg-mcp-bridge-4FETMJ6M.js.map +1 -0
- package/dist/{vgd-M7UOPWLB.js → vgd-R524P5BJ.js} +13 -14
- package/dist/vgd-R524P5BJ.js.map +1 -0
- package/package.json +1 -1
- package/dist/agent-X6VYCE63.js +0 -30
- package/dist/attach-G5JUIWIT.js +0 -10
- package/dist/baseline-DXI64VLW.js +0 -9
- package/dist/chunk-4NTNMT6T.js +0 -6
- package/dist/chunk-5I4VSBWQ.js.map +0 -1
- package/dist/chunk-6PFHDHOL.js.map +0 -1
- package/dist/chunk-7N4Y3E47.js.map +0 -1
- package/dist/chunk-B4EXD5LK.js.map +0 -1
- package/dist/chunk-BPF3YX2U.js.map +0 -1
- package/dist/chunk-E3O5UKNA.js.map +0 -1
- package/dist/chunk-FJG5AXKZ.js.map +0 -1
- package/dist/chunk-HF6R73UC.js.map +0 -1
- package/dist/chunk-NG4KIJW6.js.map +0 -1
- package/dist/chunk-NZELMYT4.js.map +0 -1
- package/dist/chunk-POOL355F.js +0 -237
- package/dist/chunk-POOL355F.js.map +0 -1
- package/dist/chunk-RHKOUPWT.js.map +0 -1
- package/dist/chunk-V2UGRUTL.js.map +0 -1
- package/dist/chunk-VQ5KMHW6.js.map +0 -1
- package/dist/client-UQIELEEZ.js +0 -8
- package/dist/daemon-GUMWMKCA.js +0 -31
- package/dist/ensure-map-FHDJTO7Y.js +0 -41
- package/dist/federation-MDQPO3PW.js +0 -7
- package/dist/fs-TLPOWC2D.js +0 -4
- package/dist/fs-TLPOWC2D.js.map +0 -1
- package/dist/git-ref-RSRAN4OH.js +0 -4
- package/dist/graph-backend-W2D3HRRD.js +0 -16
- package/dist/interactive-2MK4TLRD.js.map +0 -1
- package/dist/load-4R4HYMBB.js +0 -11
- package/dist/local-runtime-6SNWKSA7.js +0 -6
- package/dist/model-manager-SXHZ5VD4.js +0 -10
- package/dist/publish-7YHRTBRA.js +0 -9
- package/dist/resolve-gguf-SDIYGGI6.js +0 -9
- package/dist/runtime-session-JBIHHH5N.js +0 -27
- package/dist/session-N5IU4K5Q.js +0 -17
- package/dist/version-DTEU3SQD.js +0 -4
- package/dist/vg-mcp-bridge-KDVYIMFX.js.map +0 -1
- package/dist/vgd-M7UOPWLB.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/vgd/protocol.ts","../src/runtime/active-graph-cache.ts","../src/runtime/vgd/registry.ts","../src/runtime/vgd/host-broker.ts","../src/runtime/vgd/embed-broker.ts","../src/lsp/manifest-positions.ts","../src/lsp/scan-cache.ts","../src/runtime/vgd/freshness.ts","../src/runtime/vgd/dep-cache.ts","../src/runtime/vgd/server.ts","../src/runtime/branch-graph-session.ts"],"names":["path","dropped","resolve","idx","path2","fs","fs2","path4","fs3","spawn","path5","graph"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAOO,IAAM,oBAAA,GAAuB;AA4Q7B,SAAS,aAAa,IAAA,EAA8C;AACzE,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,EACvB,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,OAAO,cAAA,EAAe;AAAA,EACjC;AACA,EAAA,IAAI,CAAC,OAAO,OAAO,GAAA,KAAQ,UAAU,OAAO,EAAE,OAAO,2BAAA,EAA4B;AACjF,EAAA,MAAM,KAAM,GAAA,CAAyB,EAAA;AACrC,EAAA,IAAI,EAAA,KAAO,MAAA,IAAU,EAAA,KAAO,QAAA,IAAY,EAAA,KAAO,cAAc,EAAA,KAAO,MAAA,EAAQ,OAAO,EAAE,EAAA,EAAG;AACxF,EAAA,IAAI,OAAO,kBAAA,EAAoB;AAC7B,IAAA,MAAM,eAAgB,GAAA,CAAmC,YAAA;AACzD,IAAA,OAAO;AAAA,MACL,EAAA,EAAI,kBAAA;AAAA,MACJ,YAAA,EAAc,OAAO,YAAA,KAAiB,QAAA,IAAY,aAAa,IAAA,EAAK,GAAI,YAAA,CAAa,IAAA,EAAK,GAAI;AAAA,KAChG;AAAA,EACF;AACA,EAAA,IAAI,OAAO,gBAAA,EAAkB;AAC3B,IAAA,MAAM,eAAgB,GAAA,CAAmC,YAAA;AACzD,IAAA,MAAM,SAAU,GAAA,CAA6B,MAAA;AAC7C,IAAA,IAAI,OAAO,YAAA,KAAiB,QAAA,IAAY,CAAC,YAAA,CAAa,MAAK,EAAG,OAAO,EAAE,KAAA,EAAO,sCAAA,EAAuC;AACrH,IAAA,IAAI,OAAO,MAAA,KAAW,QAAA,IAAY,CAAC,MAAA,CAAO,MAA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AO;AAAA,MACL,KAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,QAAA;AAAA,MACA,SAAA,EAAW,KAAA;AAAA,MACX,cAAc,IAAA,CAAK;AAAA,KACrB;AAAA,EACF;AAAA;AAAA,EAGA,SAAA,GAAY;AACV,IAAA,OAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,YAAY,CAAA;AAAA,EAC1C;AACF","file":"chunk-VQ5KMHW6.js","sourcesContent":["/**\n * Wire protocol for the lightweight Vibgrate daemon (`vgd`) — Fusion Runtime Phase 2 prototype.\n *\n * Line-delimited JSON over a local Unix domain socket (named pipe on Windows).\n * No credentials leave this process; the socket is local-only.\n */\n\nexport const VGD_PROTOCOL_VERSION = 'vgd/0' as const;\n\nexport interface WorkspaceRecord {\n /** Stable repository id (same as global store key). */\n id: string;\n /** Absolute repository root. */\n root: string;\n /** Absolute path to the current graph snapshot (may not exist yet). */\n graphPath: string;\n /** ISO timestamp when this workspace was last registered / refreshed. */\n registeredAt: string;\n /** Optional federation label. */\n label?: string;\n /** Optional federation role. */\n role?: 'primary' | 'member';\n /** Git branch or detached SHA at registration (multi-branch ActiveGraph). */\n gitRef?: string;\n}\n\n/** Lightweight ActiveGraph slot summary (no full graph payload). */\nexport interface GraphSlotSummary {\n repositoryId: string;\n gitRef: string;\n loadedAt: number;\n lastAccessAt: number;\n nodeCount: number;\n current: boolean;\n idleMs: number;\n evictable: boolean;\n}\n\nexport type VgdRequest =\n | { op: 'ping' }\n | { op: 'status' }\n /** Ask the daemon to exit cleanly (honoured only by a standalone `vg daemon start`). */\n | { op: 'shutdown' }\n | { op: 'list' }\n | { op: 'register'; root: string; label?: string; role?: 'primary' | 'member' }\n | { op: 'unregister'; root: string }\n | {\n op: 'register-federation';\n primaryRoot: string;\n members: Array<{ root: string; label?: string; role?: 'primary' | 'member' }>;\n }\n | { op: 'list-graph-slots'; repositoryId?: string }\n | { op: 'select-git-ref'; repositoryId: string; gitRef: string }\n | { op: 'put-graph'; repositoryId: string; gitRef: string; graph: unknown }\n /**\n * Load the workspace's on-disk code map into ActiveGraph inside the daemon\n * (binary snapshot first, JSON fallback). The fast-path alternative to\n * shipping the whole graph over the socket with put-graph — use it whenever\n * the map already exists on disk.\n */\n | { op: 'load-graph'; root: string; gitRef?: string; graphPath?: string }\n /** Lexical/structural query against the ActiveGraph for a repository. */\n | { op: 'query-graph'; repositoryId: string; query: string; limit?: number; gitRef?: string; semantic?: boolean }\n /** Blast-radius impact for a symbol id or qualified name. */\n | { op: 'impact-of'; repositoryId: string; symbol: string; depth?: number; gitRef?: string }\n /** Compact graph meta for the current (or named) slot — not the full graph. */\n | { op: 'graph-summary'; repositoryId: string; gitRef?: string }\n /** Semantic warm (docs/VGD-SEMANTIC-WARM-SPEC.md): worker + per-slot index state. */\n | { op: 'embed-status'; repositoryId?: string }\n /** Embed one string in the daemon's warm worker; the caller ranks locally. */\n | { op: 'embed-query'; text: string }\n /** Ensure the slot's vector index exists, building it if needed. */\n | { op: 'embed-index'; repositoryId: string; gitRef?: string; wait?: boolean }\n | { op: 'embed-rank'; repositoryId: string; gitRef?: string; text: string; limit?: number }\n | { op: 'dep-context'; repositoryId: string }\n /**\n * Hold this connection open and stream slot changes on it. The only op that\n * does not answer once and stop — everything else is request/response.\n */\n | { op: 'watch-slots'; repositoryId?: string }\n /** Approach B host broker: warm model status inside vgd. */\n | { op: 'host-status' }\n | { op: 'host-load'; modelPath: string }\n | { op: 'host-unload'; modelPath?: string }\n | {\n op: 'host-generate';\n modelPath: string;\n messages: Array<{ role: string; content: string }>;\n grammar?: string;\n requireGrammar?: boolean;\n maxTokens?: number;\n temperature?: number;\n };\n\n/** Semantic warm state: the worker, and one row per resident slot index. */\nexport interface EmbedStatusPayload {\n worker: 'stopped' | 'starting' | 'ready' | 'unavailable';\n pid?: number;\n model?: string;\n crashes: number;\n reason?: string;\n slots: Array<{\n repositoryId: string;\n gitRef: string;\n state: string;\n vectors: number;\n nodeCount: number;\n /** Targets still missing a vector on a slot that is not ready. */\n pending?: number;\n builtAt?: number;\n buildMs?: number;\n error?: string;\n }>;\n}\n\n/** Compact match row for query-graph (no full node payloads). */\nexport interface VgdQueryMatch {\n id: string;\n qualifiedName: string;\n kind: string;\n file: string;\n line: number;\n score: number;\n why: string;\n}\n\nexport interface VgdImpactItem {\n id: string;\n name: string;\n kind: string;\n file: string;\n line: number;\n depth: number;\n confidence: number;\n}\n\nexport type VgdResponse =\n | { ok: true; pong: true; version: typeof VGD_PROTOCOL_VERSION }\n | {\n ok: true;\n pid: number;\n uptimeMs: number;\n workspaces: number;\n /** Resident multi-branch ActiveGraph slots (Fusion §4.1.1). */\n graphSlots?: number;\n version: typeof VGD_PROTOCOL_VERSION;\n socketPath: string;\n /** Calendar version of the CLI process serving this socket. */\n cliVersion?: string;\n /** What the daemon is watching, and what it is mid-rebuild on. */\n freshness?: Array<{\n repositoryId: string;\n root: string;\n gitRef: string;\n watching: boolean;\n pending: number;\n building: boolean;\n lastRebuildAt?: number;\n }>;\n }\n | { ok: true; workspaces: WorkspaceRecord[] }\n | { ok: true; workspace: WorkspaceRecord }\n | { ok: true; workspaces: WorkspaceRecord[]; federation: true }\n | { ok: true; removed: boolean }\n | { ok: true; stopping: true }\n | { ok: true; slots: GraphSlotSummary[] }\n | { ok: true; watching: true; repositoryId?: string }\n /**\n * An unsolicited frame on a `watch-slots` connection: this repo's map\n * changed and the subscriber should reload it. Carries the corpus hash so a\n * subscriber that already has that map can ignore the event.\n */\n | { ok: true; event: 'slot-changed'; repositoryId: string; gitRef: string; nodeCount: number; corpusHash: string | null }\n | { ok: true; semantic: EmbedStatusPayload }\n | {\n ok: true;\n repositoryId: string;\n /** Digest of every manifest and lockfile in the tree. */\n manifestHash: string;\n /** Declared/installed dependency records, as `engine/drift.ts` builds them. */\n dependencies: Array<{\n name: string;\n ecosystem: string;\n declared: string;\n installed?: string;\n }>;\n builtAt: number;\n }\n | { ok: true; vector: number[]; model?: string }\n | {\n ok: true;\n ranked: Array<{ id: string; score: number }>;\n repositoryId: string;\n gitRef: string;\n state: string;\n vectors: number;\n model?: string;\n rankMs: number;\n }\n | {\n ok: true;\n indexed: true;\n repositoryId: string;\n gitRef: string;\n state: string;\n vectors: number;\n buildMs?: number;\n }\n | { ok: true; selected: true; repositoryId: string; gitRef: string }\n | { ok: true; stored: true; repositoryId: string; gitRef: string; nodeCount: number }\n | {\n ok: true;\n query: string;\n repositoryId: string;\n gitRef: string;\n /** How the ranking was produced — `lexical` when semantic was not available. */\n mode?: string;\n matches: VgdQueryMatch[];\n tokensEstimate: number;\n }\n | {\n ok: true;\n repositoryId: string;\n gitRef: string;\n symbol: string;\n root: { id: string; name: string };\n depth: number;\n affected: VgdImpactItem[];\n direct: number;\n transitive: number;\n }\n | {\n ok: true;\n repositoryId: string;\n gitRef: string;\n summary: {\n nodeCount: number;\n edgeCount: number;\n languages: string[];\n corpusHash: string | null;\n root: string | null;\n };\n }\n | {\n ok: true;\n host: {\n poolSize: number;\n loadedModels: string[];\n bindingReady: boolean;\n };\n }\n | { ok: true; hostLoaded: true; modelPath: string }\n | { ok: true; hostUnloaded: true; cleared: number }\n | {\n ok: true;\n hostGenerated: true;\n text: string;\n model: string;\n constrained: boolean;\n grammarApplied?: boolean;\n draftAcceptedChars?: number;\n latencyMs?: number;\n unknownIdentifiers?: string[];\n }\n | {\n ok: false;\n error: string;\n code?: string;\n /** Present when `code` is `semantic_warming` so the client can show progress. */\n state?: string;\n vectors?: number;\n pending?: number;\n nodeCount?: number;\n };\n\nexport function parseRequest(line: string): VgdRequest | { error: string } {\n let raw: unknown;\n try {\n raw = JSON.parse(line);\n } catch {\n return { error: 'invalid JSON' };\n }\n if (!raw || typeof raw !== 'object') return { error: 'request must be an object' };\n const op = (raw as { op?: unknown }).op;\n if (op === 'ping' || op === 'status' || op === 'shutdown' || op === 'list') return { op };\n if (op === 'list-graph-slots') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n return {\n op: 'list-graph-slots',\n repositoryId: typeof repositoryId === 'string' && repositoryId.trim() ? repositoryId.trim() : undefined,\n };\n }\n if (op === 'select-git-ref') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'select-git-ref requires repositoryId' };\n if (typeof gitRef !== 'string' || !gitRef.trim()) return { error: 'select-git-ref requires gitRef' };\n return { op: 'select-git-ref', repositoryId: repositoryId.trim(), gitRef: gitRef.trim() };\n }\n if (op === 'put-graph') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n const graph = (raw as { graph?: unknown }).graph;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'put-graph requires repositoryId' };\n if (typeof gitRef !== 'string' || !gitRef.trim()) return { error: 'put-graph requires gitRef' };\n if (!graph || typeof graph !== 'object') return { error: 'put-graph requires graph object' };\n return { op: 'put-graph', repositoryId: repositoryId.trim(), gitRef: gitRef.trim(), graph };\n }\n if (op === 'load-graph') {\n const root = (raw as { root?: unknown }).root;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n const graphPath = (raw as { graphPath?: unknown }).graphPath;\n if (typeof root !== 'string' || !root.trim()) return { error: 'load-graph requires a non-empty root' };\n return {\n op: 'load-graph',\n root: root.trim(),\n gitRef: typeof gitRef === 'string' && gitRef.trim() ? gitRef.trim() : undefined,\n graphPath: typeof graphPath === 'string' && graphPath.trim() ? graphPath.trim() : undefined,\n };\n }\n if (op === 'embed-status') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n return {\n op: 'embed-status',\n repositoryId: typeof repositoryId === 'string' && repositoryId.trim() ? repositoryId.trim() : undefined,\n };\n }\n if (op === 'embed-query') {\n const text = (raw as { text?: unknown }).text;\n if (typeof text !== 'string' || !text.trim()) return { error: 'embed-query requires text' };\n // Socket input is untrusted like every other op's; bound it so one caller\n // cannot make the worker chew on an arbitrarily large string.\n return { op: 'embed-query', text: text.trim().slice(0, 8_000) };\n }\n if (op === 'embed-index') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'embed-index requires repositoryId' };\n return {\n op: 'embed-index',\n repositoryId: repositoryId.trim(),\n gitRef: typeof gitRef === 'string' && gitRef.trim() ? gitRef.trim() : undefined,\n wait: (raw as { wait?: unknown }).wait === false ? false : undefined,\n };\n }\n if (op === 'embed-rank') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n const text = (raw as { text?: unknown }).text;\n const limit = (raw as { limit?: unknown }).limit;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'embed-rank requires repositoryId' };\n if (typeof text !== 'string' || !text.trim()) return { error: 'embed-rank requires text' };\n return {\n op: 'embed-rank',\n repositoryId: repositoryId.trim(),\n gitRef: typeof gitRef === 'string' && gitRef.trim() ? gitRef.trim() : undefined,\n // Same bound as embed-query: untrusted socket input, one worker.\n text: text.trim().slice(0, 8_000),\n // Only the ORDER of this list reaches the caller's rank fusion, and a\n // candidate past a few hundred can never surface in a 12-row answer —\n // so a generous cap costs nothing and a huge one buys nothing.\n limit: typeof limit === 'number' && limit > 0 ? Math.min(Math.floor(limit), 1000) : undefined,\n };\n }\n if (op === 'watch-slots') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n return {\n op: 'watch-slots',\n repositoryId: typeof repositoryId === 'string' && repositoryId.trim() ? repositoryId.trim() : undefined,\n };\n }\n if (op === 'dep-context') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'dep-context requires repositoryId' };\n return { op: 'dep-context', repositoryId: repositoryId.trim() };\n }\n if (op === 'query-graph') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n const query = (raw as { query?: unknown }).query;\n const limit = (raw as { limit?: unknown }).limit;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'query-graph requires repositoryId' };\n if (typeof query !== 'string' || !query.trim()) return { error: 'query-graph requires query' };\n return {\n op: 'query-graph',\n repositoryId: repositoryId.trim(),\n query: query.trim(),\n limit: typeof limit === 'number' && limit > 0 ? Math.min(Math.floor(limit), 50) : undefined,\n gitRef: typeof gitRef === 'string' && gitRef.trim() ? gitRef.trim() : undefined,\n // Opt-in, and left off the parsed request entirely when not asked: a\n // client that asks for semantic gets the fused ranking when the slot's\n // index is ready, and the lexical answer when it is not. Ranking and\n // fusion both happen here, so the caller needs neither the graph nor the\n // embedder — which is the whole reason a panel can afford to ask.\n semantic: (raw as { semantic?: unknown }).semantic === true ? true : undefined,\n };\n }\n if (op === 'impact-of') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n const symbol = (raw as { symbol?: unknown }).symbol;\n const depth = (raw as { depth?: unknown }).depth;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'impact-of requires repositoryId' };\n if (typeof symbol !== 'string' || !symbol.trim()) return { error: 'impact-of requires symbol' };\n return {\n op: 'impact-of',\n repositoryId: repositoryId.trim(),\n symbol: symbol.trim(),\n depth: typeof depth === 'number' && depth > 0 ? Math.min(Math.floor(depth), 12) : undefined,\n gitRef: typeof gitRef === 'string' && gitRef.trim() ? gitRef.trim() : undefined,\n };\n }\n if (op === 'graph-summary') {\n const repositoryId = (raw as { repositoryId?: unknown }).repositoryId;\n const gitRef = (raw as { gitRef?: unknown }).gitRef;\n if (typeof repositoryId !== 'string' || !repositoryId.trim()) return { error: 'graph-summary requires repositoryId' };\n return {\n op: 'graph-summary',\n repositoryId: repositoryId.trim(),\n gitRef: typeof gitRef === 'string' && gitRef.trim() ? gitRef.trim() : undefined,\n };\n }\n if (op === 'register' || op === 'unregister') {\n const root = (raw as { root?: unknown }).root;\n if (typeof root !== 'string' || !root.trim()) return { error: `${op} requires a non-empty root` };\n const label = (raw as { label?: unknown }).label;\n const role = (raw as { role?: unknown }).role;\n if (op === 'register') {\n return {\n op: 'register',\n root: root.trim(),\n label: typeof label === 'string' ? label : undefined,\n role: role === 'primary' || role === 'member' ? role : undefined,\n };\n }\n return { op: 'unregister', root: root.trim() };\n }\n if (op === 'register-federation') {\n const primaryRoot = (raw as { primaryRoot?: unknown }).primaryRoot;\n const members = (raw as { members?: unknown }).members;\n if (typeof primaryRoot !== 'string' || !primaryRoot.trim()) return { error: 'register-federation requires primaryRoot' };\n if (!Array.isArray(members) || members.length === 0) return { error: 'register-federation requires members[]' };\n const parsed: Array<{ root: string; label?: string; role?: 'primary' | 'member' }> = [];\n for (const m of members) {\n if (!m || typeof m !== 'object') continue;\n const root = (m as { root?: unknown }).root;\n if (typeof root !== 'string' || !root.trim()) continue;\n const label = (m as { label?: unknown }).label;\n const role = (m as { role?: unknown }).role;\n parsed.push({\n root: root.trim(),\n label: typeof label === 'string' ? label : undefined,\n role: role === 'primary' || role === 'member' ? role : undefined,\n });\n }\n if (!parsed.length) return { error: 'register-federation members must include at least one root' };\n return { op: 'register-federation', primaryRoot: primaryRoot.trim(), members: parsed };\n }\n if (op === 'host-status') return { op: 'host-status' };\n if (op === 'host-load') {\n const modelPath = (raw as { modelPath?: unknown }).modelPath;\n if (typeof modelPath !== 'string' || !modelPath.trim()) return { error: 'host-load requires modelPath' };\n return { op: 'host-load', modelPath: modelPath.trim() };\n }\n if (op === 'host-unload') {\n const modelPath = (raw as { modelPath?: unknown }).modelPath;\n return {\n op: 'host-unload',\n modelPath: typeof modelPath === 'string' && modelPath.trim() ? modelPath.trim() : undefined,\n };\n }\n if (op === 'host-generate') {\n const modelPath = (raw as { modelPath?: unknown }).modelPath;\n const messages = (raw as { messages?: unknown }).messages;\n if (typeof modelPath !== 'string' || !modelPath.trim()) return { error: 'host-generate requires modelPath' };\n if (!Array.isArray(messages) || messages.length === 0) return { error: 'host-generate requires messages[]' };\n const parsed: Array<{ role: string; content: string }> = [];\n for (const m of messages) {\n if (!m || typeof m !== 'object') continue;\n const role = (m as { role?: unknown }).role;\n const content = (m as { content?: unknown }).content;\n if (typeof role !== 'string' || typeof content !== 'string') continue;\n parsed.push({ role, content });\n }\n if (!parsed.length) return { error: 'host-generate messages must include role+content' };\n const grammar = (raw as { grammar?: unknown }).grammar;\n const requireGrammar = (raw as { requireGrammar?: unknown }).requireGrammar;\n const maxTokens = (raw as { maxTokens?: unknown }).maxTokens;\n const temperature = (raw as { temperature?: unknown }).temperature;\n return {\n op: 'host-generate',\n modelPath: modelPath.trim(),\n messages: parsed,\n grammar: typeof grammar === 'string' ? grammar : undefined,\n requireGrammar: requireGrammar === true,\n maxTokens: typeof maxTokens === 'number' ? maxTokens : undefined,\n temperature: typeof temperature === 'number' ? temperature : undefined,\n };\n }\n return { error: `unknown op: ${String(op)}` };\n}\n","/**\n * Multi-branch ActiveGraph cache (Fusion plan §4.1.1).\n *\n * Holds several in-memory graphs for the same repository — one per gitRef\n * (branch or detached SHA). Memory management: after an idle timeout, slots\n * become evictable; among idle slots, LILO (last-in, last-out ≡ FIFO by\n * load order) reclaims the oldest-loaded idle graph first. The currently\n * selected slot for a repository is never evicted.\n */\n\nimport type { VgGraph } from '../schema.js';\nimport { activeGraphSlotKey } from './git-ref.js';\n\n/** Default idle timeout: 20 minutes (within the 15–30 min plan band). */\nexport const DEFAULT_ACTIVE_GRAPH_IDLE_MS = 20 * 60 * 1000;\n\nexport interface ActiveGraphSlot {\n repositoryId: string;\n gitRef: string;\n graph: VgGraph;\n /** When this slot was first loaded into the cache. */\n loadedAt: number;\n /** Last access / select time. */\n lastAccessAt: number;\n /** Approximate size hint for diagnostics (node count). */\n nodeCount: number;\n}\n\nexport interface ActiveGraphCacheOptions {\n /** Idle duration before a non-selected slot is evictable (default 20 min). */\n idleTimeoutMs?: number;\n /** Max resident graphs per repositoryId (default 8). */\n maxPerRepo?: number;\n /** Max resident graphs process-wide (default 32). */\n maxTotal?: number;\n now?: () => number;\n /**\n * Called for every slot leaving the cache, whatever removed it (idle\n * timeout, overflow, clear). Anything keyed by the same slot — the semantic\n * index in vgd — hangs off this so it can never outlive the graph it\n * describes. Must not throw; a listener error is swallowed rather than\n * corrupting eviction.\n */\n onEvict?: (slot: { repositoryId: string; gitRef: string }) => void;\n}\n\nexport interface ActiveGraphSlotSummary {\n repositoryId: string;\n gitRef: string;\n loadedAt: number;\n lastAccessAt: number;\n nodeCount: number;\n current: boolean;\n idleMs: number;\n evictable: boolean;\n}\n\n/**\n * In-memory multi-branch graph cache. Pure structure — does not load/save disk.\n */\nexport class ActiveGraphCache {\n private readonly slots = new Map<string, ActiveGraphSlot>();\n /** repositoryId → currently selected gitRef */\n private readonly currentRef = new Map<string, string>();\n private readonly idleTimeoutMs: number;\n private readonly maxPerRepo: number;\n private readonly maxTotal: number;\n private readonly now: () => number;\n private readonly onEvict?: (slot: { repositoryId: string; gitRef: string }) => void;\n\n constructor(options: ActiveGraphCacheOptions = {}) {\n this.onEvict = options.onEvict;\n this.idleTimeoutMs = options.idleTimeoutMs ?? DEFAULT_ACTIVE_GRAPH_IDLE_MS;\n this.maxPerRepo = options.maxPerRepo ?? 8;\n this.maxTotal = options.maxTotal ?? 32;\n this.now = options.now ?? (() => Date.now());\n }\n\n size(): number {\n return this.slots.size;\n }\n\n get(repositoryId: string, gitRef: string): ActiveGraphSlot | undefined {\n const slot = this.slots.get(activeGraphSlotKey(repositoryId, gitRef));\n if (slot) {\n slot.lastAccessAt = this.now();\n }\n return slot;\n }\n\n /**\n * Insert or replace a graph for (repositoryId, gitRef). Touches access time.\n * Runs eviction if over cap.\n */\n put(repositoryId: string, gitRef: string, graph: VgGraph): ActiveGraphSlot {\n const key = activeGraphSlotKey(repositoryId, gitRef);\n const t = this.now();\n const existing = this.slots.get(key);\n const slot: ActiveGraphSlot = {\n repositoryId,\n gitRef,\n graph,\n loadedAt: existing?.loadedAt ?? t,\n lastAccessAt: t,\n nodeCount: graph.nodes?.length ?? 0,\n };\n this.slots.set(key, slot);\n if (!this.currentRef.has(repositoryId)) {\n this.currentRef.set(repositoryId, gitRef);\n }\n this.evictIfNeeded();\n return slot;\n }\n\n /**\n * Mark gitRef as the current branch for this repository and touch it.\n * Returns the slot if present.\n */\n select(repositoryId: string, gitRef: string): ActiveGraphSlot | undefined {\n this.currentRef.set(repositoryId, gitRef);\n return this.get(repositoryId, gitRef);\n }\n\n /** Currently selected gitRef for a repository, if any. */\n selectedRef(repositoryId: string): string | undefined {\n return this.currentRef.get(repositoryId);\n }\n\n current(repositoryId: string): ActiveGraphSlot | undefined {\n const ref = this.currentRef.get(repositoryId);\n if (!ref) return undefined;\n return this.get(repositoryId, ref);\n }\n\n /**\n * Drop idle slots past the timeout (LILO among idle).\n * Returns keys of removed slots.\n */\n evictIdle(now: number = this.now()): string[] {\n return this.evict(now, false);\n }\n\n /** Force eviction of idle slots when over caps (timeout may be ignored for overflow). */\n evictIfNeeded(): string[] {\n return this.evict(this.now(), true);\n }\n\n list(repositoryId?: string): ActiveGraphSlotSummary[] {\n const t = this.now();\n const out: ActiveGraphSlotSummary[] = [];\n for (const slot of this.slots.values()) {\n if (repositoryId && slot.repositoryId !== repositoryId) continue;\n const current = this.currentRef.get(slot.repositoryId) === slot.gitRef;\n const idleMs = t - slot.lastAccessAt;\n out.push({\n repositoryId: slot.repositoryId,\n gitRef: slot.gitRef,\n loadedAt: slot.loadedAt,\n lastAccessAt: slot.lastAccessAt,\n nodeCount: slot.nodeCount,\n current,\n idleMs,\n evictable: !current && idleMs >= this.idleTimeoutMs,\n });\n }\n return out.sort(\n (a, b) => a.repositoryId.localeCompare(b.repositoryId) || a.gitRef.localeCompare(b.gitRef),\n );\n }\n\n clear(): void {\n for (const slot of this.slots.values()) this.notifyEvict(slot);\n this.slots.clear();\n this.currentRef.clear();\n }\n\n private notifyEvict(slot: { repositoryId: string; gitRef: string }): void {\n if (!this.onEvict) return;\n try {\n this.onEvict({ repositoryId: slot.repositoryId, gitRef: slot.gitRef });\n } catch {\n // A listener problem must never break cache maintenance.\n }\n }\n\n private evict(now: number, forceOverflow: boolean): string[] {\n const removed: string[] = [];\n\n const removeKey = (key: string): void => {\n const slot = this.slots.get(key);\n if (!slot) return;\n this.slots.delete(key);\n removed.push(key);\n this.notifyEvict(slot);\n };\n\n // 1) Idle timeout: LILO among idle (earliest loadedAt first).\n const idle = this.idleCandidates(now, this.idleTimeoutMs);\n idle.sort((a, b) => a.loadedAt - b.loadedAt);\n for (const slot of idle) {\n removeKey(activeGraphSlotKey(slot.repositoryId, slot.gitRef));\n }\n\n // 2) Overflow: if still over maxPerRepo or maxTotal, LILO among any non-current idle-or-all-non-current.\n if (forceOverflow) {\n while (this.slots.size > this.maxTotal) {\n const victim = this.pickLiloVictim(now, /* requireIdleTimeout */ false);\n if (!victim) break;\n removeKey(activeGraphSlotKey(victim.repositoryId, victim.gitRef));\n }\n // Per-repo caps\n const byRepo = new Map<string, ActiveGraphSlot[]>();\n for (const s of this.slots.values()) {\n const list = byRepo.get(s.repositoryId) ?? [];\n list.push(s);\n byRepo.set(s.repositoryId, list);\n }\n for (const [repoId, list] of byRepo) {\n if (list.length <= this.maxPerRepo) continue;\n const nonCurrent = list\n .filter((s) => this.currentRef.get(repoId) !== s.gitRef)\n .sort((a, b) => a.loadedAt - b.loadedAt);\n let excess = list.length - this.maxPerRepo;\n for (const s of nonCurrent) {\n if (excess <= 0) break;\n removeKey(activeGraphSlotKey(s.repositoryId, s.gitRef));\n excess--;\n }\n }\n }\n\n return removed;\n }\n\n private idleCandidates(now: number, timeoutMs: number): ActiveGraphSlot[] {\n const out: ActiveGraphSlot[] = [];\n for (const slot of this.slots.values()) {\n if (this.currentRef.get(slot.repositoryId) === slot.gitRef) continue;\n if (now - slot.lastAccessAt >= timeoutMs) out.push(slot);\n }\n return out;\n }\n\n private pickLiloVictim(now: number, requireIdleTimeout: boolean): ActiveGraphSlot | null {\n let best: ActiveGraphSlot | null = null;\n for (const slot of this.slots.values()) {\n if (this.currentRef.get(slot.repositoryId) === slot.gitRef) continue;\n if (requireIdleTimeout && now - slot.lastAccessAt < this.idleTimeoutMs) continue;\n if (!best || slot.loadedAt < best.loadedAt) best = slot;\n }\n return best;\n }\n}\n","import * as path from 'node:path';\nimport { repositoryIdFromRoot, globalGraphPathForRef, globalGraphPath } from '../paths.js';\nimport { detectGitRef } from '../git-ref.js';\nimport { ActiveGraphCache } from '../active-graph-cache.js';\nimport type { WorkspaceRecord } from './protocol.js';\nimport type { VgGraph } from '../../schema.js';\n\n/** Slot-scoped resource that must track the graph cache exactly. */\nexport interface GraphSlotListener {\n onGraphPut(repositoryId: string, gitRef: string, graph: VgGraph): void;\n onGraphSelect(repositoryId: string, gitRef: string): void;\n onGraphEvict(repositoryId: string, gitRef: string): void;\n}\n\n/**\n * In-memory workspace registry for the vgd prototype.\n *\n * Tracks which repository roots the daemon knows about and where their\n * graphs live. Holds a multi-branch {@link ActiveGraphCache} so several\n * git refs of the same repo can stay warm (Fusion §4.1.1).\n */\nexport class WorkspaceRegistry {\n private readonly byId = new Map<string, WorkspaceRecord>();\n /**\n * Anything keyed by the same (repositoryId, gitRef) slot as the graph — the\n * semantic index — attaches here. Wiring it through the registry rather than\n * the cache directly means every put/select/evict passes one funnel, so an\n * index can never describe a ref its graph no longer holds.\n */\n private slotListener?: GraphSlotListener;\n /** Told after a graph is stored, so the daemon can push to subscribers. */\n private publishListener?: (repositoryId: string, gitRef: string, graph: VgGraph) => void;\n /** Multi-branch in-memory graphs (shared across registered workspaces). */\n readonly graphs = new ActiveGraphCache({\n onEvict: (slot) => this.slotListener?.onGraphEvict(slot.repositoryId, slot.gitRef),\n });\n\n /** Attach the semantic index (or any slot-scoped resource) to graph lifecycle. */\n setSlotListener(listener: GraphSlotListener | undefined): void {\n this.slotListener = listener;\n }\n\n /**\n * Attach the push channel. Separate from {@link GraphSlotListener} on\n * purpose: that one keeps *slot-scoped resources* in step and must run\n * before anyone can query, while this one notifies *other processes* and\n * must run after the store is complete.\n */\n setPublishListener(listener: (repositoryId: string, gitRef: string, graph: VgGraph) => void): void {\n this.publishListener = listener;\n }\n\n register(\n root: string,\n now: () => Date = () => new Date(),\n meta: { label?: string; role?: 'primary' | 'member'; gitRef?: string } = {},\n ): WorkspaceRecord {\n const resolved = path.resolve(root);\n const id = repositoryIdFromRoot(resolved);\n const git = meta.gitRef ? { ref: meta.gitRef, kind: 'branch' as const } : detectGitRef(resolved);\n const graphPath =\n git.kind !== 'none' && git.ref ? globalGraphPathForRef(resolved, git.ref) : globalGraphPath(resolved);\n const record: WorkspaceRecord = {\n id,\n root: resolved,\n graphPath,\n registeredAt: now().toISOString(),\n label: meta.label,\n role: meta.role,\n gitRef: git.ref || undefined,\n };\n this.byId.set(id, record);\n // Through `selectGitRef`, not `graphs.select`: every select must reach the\n // slot listener, or a re-registration after a branch change would move the\n // current slot without the semantic index following it. This was the one\n // path that escaped the funnel the whole design rests on. Registering a\n // repo with no warm slot is still a no-op for the listener — the broker\n // finds no graph and returns.\n if (git.ref) this.selectGitRef(id, git.ref);\n return record;\n }\n\n /**\n * Activate or insert an in-memory graph for a workspace branch.\n * Call after load/build; runs LILO idle eviction as needed.\n */\n putGraph(repositoryId: string, gitRef: string, graph: VgGraph): void {\n this.graphs.put(repositoryId, gitRef, graph);\n this.graphs.select(repositoryId, gitRef);\n // Invalidate before anyone can query: the old vectors describe the old graph.\n this.slotListener?.onGraphPut(repositoryId, gitRef, graph);\n this.slotListener?.onGraphSelect(repositoryId, gitRef);\n // After the store and the invalidation: a subscriber that reacts by\n // reloading must never observe a slot mid-swap.\n this.publishListener?.(repositoryId, gitRef, graph);\n }\n\n /** Switch the current branch slot for a repository (no load). */\n selectGitRef(repositoryId: string, gitRef: string): void {\n this.graphs.select(repositoryId, gitRef);\n this.slotListener?.onGraphSelect(repositoryId, gitRef);\n }\n\n /** Register every member of a federation (primary + members). */\n registerFederation(\n members: Array<{ root: string; label?: string; role?: 'primary' | 'member' }>,\n now: () => Date = () => new Date(),\n ): WorkspaceRecord[] {\n return members.map((m) => this.register(m.root, now, { label: m.label, role: m.role }));\n }\n\n unregister(root: string): boolean {\n const id = repositoryIdFromRoot(path.resolve(root));\n return this.byId.delete(id);\n }\n\n list(): WorkspaceRecord[] {\n return [...this.byId.values()].sort((a, b) => a.root.localeCompare(b.root));\n }\n\n get(root: string): WorkspaceRecord | undefined {\n return this.byId.get(repositoryIdFromRoot(path.resolve(root)));\n }\n\n /** Lookup by stable repository id. */\n getById(repositoryId: string): WorkspaceRecord | undefined {\n return this.byId.get(repositoryId);\n }\n\n size(): number {\n return this.byId.size;\n }\n\n /**\n * Resolve an ActiveGraph for query/impact: prefer the named gitRef, else the\n * selected current slot, else any warm slot for the repository.\n */\n resolveGraph(repositoryId: string, gitRef?: string): { graph: VgGraph; gitRef: string } | null {\n if (gitRef) {\n const slot = this.graphs.get(repositoryId, gitRef);\n if (slot) return { graph: slot.graph, gitRef: slot.gitRef };\n }\n const current = this.graphs.current(repositoryId);\n if (current) return { graph: current.graph, gitRef: current.gitRef };\n // Fall back to any warm slot for this repo (deterministic: earliest loaded).\n const any = this.graphs\n .list(repositoryId)\n .slice()\n .sort((a, b) => a.loadedAt - b.loadedAt)[0];\n if (any) {\n const slot = this.graphs.get(repositoryId, any.gitRef);\n if (slot) return { graph: slot.graph, gitRef: slot.gitRef };\n }\n return null;\n }\n}\n","/**\n * Model host broker inside vgd (Approach B / B4 + P4 multi-client).\n *\n * Long-lived daemon process can keep warm llama.cpp sessions so CLI and IDE\n * clients share one loaded model. Management (which pack/mode) stays in the\n * client/orchestrator; vgd only loads paths the client requests and generates.\n *\n * P4: clients acquire/release leases per model path so unload is refcounted\n * (one IDE + CLI can share a warm model without the first exit killing it).\n *\n * Binding is injected (never static node-llama-cpp import).\n */\n\nimport {\n acquireHostSession,\n clearHostSessionPool,\n dropHostSession,\n evictIdleSessions,\n generateOnSession,\n hostSessionPoolSize,\n listHostSessions,\n type HostGenerateReport,\n type HostSessionInfo,\n} from '../llm-host/session.js';\nimport type { LlmChatMessage, LlmGenerateOptions } from '../llm-host/types.js';\n\nexport interface HostBrokerStatus {\n poolSize: number;\n loadedModels: string[];\n bindingReady: boolean;\n /** Per-path client lease counts (P4). */\n leases: Record<string, number>;\n sessions: HostSessionInfo[];\n}\n\nexport interface HostClientLease {\n clientId: string;\n modelPath: string;\n}\n\nexport class VgdHostBroker {\n private binding: unknown | null = null;\n private readonly loaded = new Set<string>();\n /** modelPath → set of client ids holding a lease. */\n private readonly leases = new Map<string, Set<string>>();\n\n setBinding(lib: unknown | null): void {\n this.binding = lib;\n }\n\n hasBinding(): boolean {\n return this.binding != null;\n }\n\n status(): HostBrokerStatus {\n const leases: Record<string, number> = {};\n for (const [path, clients] of this.leases) {\n leases[path] = clients.size;\n }\n return {\n poolSize: hostSessionPoolSize(),\n loadedModels: [...this.loaded],\n bindingReady: this.binding != null,\n leases,\n sessions: listHostSessions(),\n };\n }\n\n /**\n * Load weights and optionally register a client lease (P4 multi-client).\n * When clientId is omitted, behaves like a one-shot load (no lease bookkeeping).\n */\n async load(\n modelPath: string,\n clientId?: string,\n ): Promise<{ ok: true; modelPath: string; leases: number } | { ok: false; error: string }> {\n if (!this.binding) {\n return { ok: false, error: 'host binding not configured — start vgd with llama runtime or attach binding' };\n }\n try {\n await acquireHostSession(this.binding, modelPath);\n this.loaded.add(modelPath);\n if (clientId) {\n let set = this.leases.get(modelPath);\n if (!set) {\n set = new Set();\n this.leases.set(modelPath, set);\n }\n set.add(clientId);\n }\n evictIdleSessions(4);\n return { ok: true, modelPath, leases: this.leases.get(modelPath)?.size ?? 0 };\n } catch (e) {\n return { ok: false, error: e instanceof Error ? e.message : String(e) };\n }\n }\n\n /**\n * Release a client lease. When the last lease is released, drop the warm\n * session for that path. Without clientId, clears all leases for the path\n * (or entire pool if modelPath omitted).\n */\n async unload(\n modelPath?: string,\n clientId?: string,\n ): Promise<{ ok: true; cleared: number; remainingLeases: number }> {\n if (!modelPath) {\n const n = hostSessionPoolSize();\n clearHostSessionPool();\n this.loaded.clear();\n this.leases.clear();\n return { ok: true, cleared: n, remainingLeases: 0 };\n }\n\n if (clientId) {\n const set = this.leases.get(modelPath);\n if (set) {\n set.delete(clientId);\n if (set.size === 0) this.leases.delete(modelPath);\n }\n const remaining = this.leases.get(modelPath)?.size ?? 0;\n if (remaining === 0) {\n const dropped = dropHostSession(modelPath) ? 1 : 0;\n this.loaded.delete(modelPath);\n return { ok: true, cleared: dropped, remainingLeases: 0 };\n }\n return { ok: true, cleared: 0, remainingLeases: remaining };\n }\n\n // No clientId: force drop path (all leases).\n this.leases.delete(modelPath);\n const dropped = dropHostSession(modelPath) ? 1 : 0;\n this.loaded.delete(modelPath);\n return { ok: true, cleared: dropped, remainingLeases: 0 };\n }\n\n /** How many clients hold a lease on modelPath. */\n leaseCount(modelPath: string): number {\n return this.leases.get(modelPath)?.size ?? 0;\n }\n\n async generate(\n modelPath: string,\n messages: LlmChatMessage[],\n opts?: LlmGenerateOptions,\n ): Promise<{ ok: true; result: HostGenerateReport } | { ok: false; error: string }> {\n if (!this.binding) {\n return { ok: false, error: 'host binding not configured' };\n }\n try {\n const session = await acquireHostSession(this.binding, modelPath);\n this.loaded.add(modelPath);\n const result = await generateOnSession(session, messages, {\n grammar: opts?.grammar,\n requireGrammar: opts?.requireGrammar,\n identifierTrie: opts?.identifierTrie,\n annotateUnknownIdentifiers: opts?.annotateUnknownIdentifiers,\n draftCandidates: opts?.draftCandidates,\n maxTokens: opts?.maxTokens,\n temperature: opts?.temperature,\n promptSegments: opts?.promptSegments,\n });\n return { ok: true, result };\n } catch (e) {\n return { ok: false, error: e instanceof Error ? e.message : String(e) };\n }\n }\n}\n\n/** Process-wide broker for the running vgd (tests may replace). */\nlet defaultBroker: VgdHostBroker | null = null;\n\nexport function getVgdHostBroker(): VgdHostBroker {\n if (!defaultBroker) defaultBroker = new VgdHostBroker();\n return defaultBroker;\n}\n\nexport function resetVgdHostBroker(): void {\n defaultBroker = null;\n clearHostSessionPool();\n}\n","/**\n * Semantic warm inside vgd (docs/VGD-SEMANTIC-WARM-SPEC.md).\n *\n * vgd already keeps the code map warm per repo-and-ref and local LLM weights\n * warm per path. The embedding model and the vector index were the gap: every\n * consumer — `vg lsp`, `vg code`, the CLI — loaded its own copy, so\n * `vg daemon status` could report a warm graph slot while the editor announced\n * \"warming semantic search\" on a fresh process, again.\n *\n * Two invariants shape everything here.\n *\n * **The addon lives in a child.** {@link EmbedBroker} never imports the\n * embedding backend; it talks NDJSON to `embed-worker.ts`. The backend can\n * abort its process (see `engine/embed-health.ts`) and no try/catch survives a\n * signal — so the worst case must be a dead worker vgd can restart, not a dead\n * daemon. A worker that dies repeatedly is given up on, and every caller falls\n * back to lexical exactly as it does when vgd is absent.\n *\n * **The index follows the graph slot.** Vectors are keyed by the same\n * `(repositoryId, gitRef)` slot key the graph uses, and the cache's eviction\n * hook drops them together. A branch switch selects a different index the same\n * moment it selects a different graph; a re-published graph invalidates the\n * vectors for exactly that slot and nothing else. Ranking against vectors that\n * belong to another ref would be a silent correctness bug, so the two are\n * never allowed to drift apart.\n */\nimport { spawn, type ChildProcess } from 'node:child_process';\nimport * as fs from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport * as path from 'node:path';\nimport { activeGraphSlotKey } from '../git-ref.js';\n// Pure helpers only: `embeddings.ts` loads the native backend lazily, inside\n// `loadEmbedder`, so importing the target/cache side of it here does not pull\n// the addon into the daemon. The worker remains the only thing that loads it.\nimport { cosine, embedTargets, readCachedVectors, type EmbedTarget } from '../../engine/embeddings.js';\nimport type { VgGraph } from '../../schema.js';\n\n/** How a slot's index is doing — surfaced by `embed-status` and the daemon log. */\nexport type SlotIndexState = 'absent' | 'building' | 'ready' | 'stale' | 'failed';\n\nexport interface SlotIndex {\n repositoryId: string;\n gitRef: string;\n state: SlotIndexState;\n /** nodeId → vector. Empty until the first build completes. */\n vectors: Map<string, number[]>;\n nodeCount: number;\n /** Targets still missing a vector — non-zero on a slot that stopped short. */\n pending?: number;\n builtAt?: number;\n buildMs?: number;\n error?: string;\n}\n\nexport interface SlotIndexSummary {\n repositoryId: string;\n gitRef: string;\n state: SlotIndexState;\n vectors: number;\n nodeCount: number;\n pending?: number;\n builtAt?: number;\n buildMs?: number;\n error?: string;\n}\n\nexport interface EmbedBrokerStatus {\n /** Worker process state. */\n worker: 'stopped' | 'starting' | 'ready' | 'unavailable';\n pid?: number;\n model?: string;\n /** Consecutive worker deaths; at the cap the broker stops restarting. */\n crashes: number;\n reason?: string;\n slots: SlotIndexSummary[];\n}\n\nexport type EmbedBrokerLog = (message: string) => void;\n\nexport interface EmbedBrokerOptions {\n /** Diagnostic sink — the daemon's log. */\n log?: EmbedBrokerLog;\n /** Injected worker spawn (tests). */\n spawnWorker?: () => ChildProcess;\n /** Consecutive crashes tolerated before the broker gives up (default 3). */\n maxCrashes?: number;\n /** Per-request timeout in ms (default 120s — a cold model load is slow). */\n requestTimeoutMs?: number;\n /** Documents per embed request (default 256). */\n batchSize?: number;\n now?: () => number;\n /** Injected delay (tests). Used while waiting for another process's cache lock. */\n sleep?: (ms: number) => Promise<void>;\n}\n\n/** Options for a blocking {@link EmbedBroker.ensureIndex} (embed-rank / embed-index). */\nexport interface EnsureIndexOptions {\n /**\n * Wait for another process that holds the on-disk cache lock (the `vg embed`\n * warm-up child) instead of standing down with an empty index. Background\n * warms leave this off so they do not race that writer; a caller that is\n * about to answer a question turns it on so `vg ask` does not re-embed the\n * whole map in-process.\n */\n waitForWriter?: boolean;\n /** How long to wait for the writer (default 5 minutes). */\n waitForWriterMs?: number;\n}\n\ninterface Pending {\n resolve: (vectors: number[][]) => void;\n reject: (err: Error) => void;\n timer: ReturnType<typeof setTimeout>;\n}\n\nexport class EmbedBroker {\n private child: ChildProcess | null = null;\n private starting = false;\n private gaveUp = false;\n private crashes = 0;\n private reason: string | undefined;\n private model: string | undefined;\n private nextId = 1;\n private buffer = '';\n private readonly pending = new Map<number, Pending>();\n private readonly indexes = new Map<string, SlotIndex>();\n /** In-flight builds, so a second caller waits for the same work instead of seeing an empty slot. */\n private readonly inflight = new Map<string, Promise<SlotIndex>>();\n /** One deferred retry per slot after standing down for an on-disk writer. */\n private readonly rewarmTimers = new Map<string, ReturnType<typeof setTimeout>>();\n /** The slot most recently made current — logged on change. */\n private currentKey: string | undefined;\n private graphProvider?: (repositoryId: string, gitRef: string) => VgGraph | undefined;\n private rootProvider?: (repositoryId: string) => string | undefined;\n\n private readonly log: EmbedBrokerLog;\n private readonly spawnWorker: () => ChildProcess;\n private readonly maxCrashes: number;\n private readonly requestTimeoutMs: number;\n private readonly batchSize: number;\n private readonly now: () => number;\n private readonly sleepImpl: (ms: number) => Promise<void>;\n\n constructor(options: EmbedBrokerOptions = {}) {\n this.log = options.log ?? ((): void => {});\n this.spawnWorker = options.spawnWorker ?? defaultSpawnWorker;\n this.maxCrashes = options.maxCrashes ?? 3;\n this.requestTimeoutMs = options.requestTimeoutMs ?? 120_000;\n this.batchSize = options.batchSize ?? 256;\n this.now = options.now ?? ((): number => Date.now());\n this.sleepImpl = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));\n }\n\n status(): EmbedBrokerStatus {\n return {\n worker: this.gaveUp ? 'unavailable' : this.child ? 'ready' : this.starting ? 'starting' : 'stopped',\n pid: this.child?.pid,\n model: this.model,\n crashes: this.crashes,\n reason: this.reason,\n slots: this.listSlots(),\n };\n }\n\n listSlots(repositoryId?: string): SlotIndexSummary[] {\n const out: SlotIndexSummary[] = [];\n for (const idx of this.indexes.values()) {\n if (repositoryId && idx.repositoryId !== repositoryId) continue;\n out.push({\n repositoryId: idx.repositoryId,\n gitRef: idx.gitRef,\n state: idx.state,\n vectors: idx.vectors.size,\n nodeCount: idx.nodeCount,\n pending: idx.pending,\n builtAt: idx.builtAt,\n buildMs: idx.buildMs,\n error: idx.error,\n });\n }\n return out.sort((a, b) => a.repositoryId.localeCompare(b.repositoryId) || a.gitRef.localeCompare(b.gitRef));\n }\n\n slot(repositoryId: string, gitRef: string): SlotIndex | undefined {\n return this.indexes.get(activeGraphSlotKey(repositoryId, gitRef));\n }\n\n /** True once the broker has stopped trying — callers should go lexical. */\n unavailable(): boolean {\n return this.gaveUp;\n }\n\n /**\n * A graph slot was published or replaced. The vectors for that slot no\n * longer describe its graph, so they are dropped and a rebuild is queued.\n * Called from the same funnel that stores the graph, so the two can never\n * disagree about which ref they belong to.\n */\n onGraphPut(repositoryId: string, gitRef: string, graph: VgGraph): void {\n const key = activeGraphSlotKey(repositoryId, gitRef);\n const existing = this.indexes.get(key);\n const nodeCount = graph.nodes?.length ?? 0;\n // Keep the previous vectors rankable until the rebuild finishes. Dropping\n // them made every ask during a republish fall back to embedding the whole\n // map in-process — the spec already says a stale index is safe (unknown\n // ids are ignored).\n const kept = existing?.vectors.size ? new Map(existing.vectors) : new Map<string, number[]>();\n if (existing && existing.vectors.size > 0) {\n this.log(`semantic: ${repositoryId}@${gitRef} graph republished — index stale (${existing.vectors.size} vectors kept until rebuild)`);\n }\n this.indexes.set(key, {\n repositoryId,\n gitRef,\n state: 'stale',\n vectors: kept,\n nodeCount,\n });\n }\n\n /**\n * Supplies the graph for a slot so a select can warm without the caller\n * threading it through. Set by the daemon to read its own cache.\n */\n setGraphProvider(provider: (repositoryId: string, gitRef: string) => VgGraph | undefined): void {\n this.graphProvider = provider;\n }\n\n /**\n * Supplies the absolute repository root for a slot, so the broker can read\n * that repo's on-disk vector cache. It cannot come from the graph:\n * `meta.root` is deliberately relative (`.`) so snapshots stay portable\n * across machines. The registry holds the real path.\n */\n setRootProvider(provider: (repositoryId: string) => string | undefined): void {\n this.rootProvider = provider;\n }\n\n /**\n * A slot became current — a branch switch, a new repo, a fresh publish.\n * The matching index is swapped in, and warmed in the background if it is\n * not ready, so the first Ask after a switch is not the one that pays.\n */\n onGraphSelect(repositoryId: string, gitRef: string): void {\n const key = activeGraphSlotKey(repositoryId, gitRef);\n if (this.currentKey !== key) {\n this.currentKey = key;\n const idx = this.indexes.get(key);\n this.log(\n `semantic: current slot → ${repositoryId}@${gitRef} · index ${idx ? `${idx.state} (${idx.vectors.size} vectors)` : 'absent'}`,\n );\n }\n if (this.gaveUp) return;\n const idx = this.indexes.get(key);\n if (idx?.state === 'ready' || this.inflight.has(key)) return;\n const graph = this.graphProvider?.(repositoryId, gitRef);\n if (!graph) return;\n // Fire and forget: warming must never block the op that triggered it.\n void this.ensureIndex(repositoryId, gitRef, graph);\n }\n\n /** A graph slot was evicted — its index goes with it, never outliving it. */\n onGraphEvict(repositoryId: string, gitRef: string): void {\n const key = activeGraphSlotKey(repositoryId, gitRef);\n const idx = this.indexes.get(key);\n if (!idx) return;\n this.indexes.delete(key);\n this.clearRewarm(key);\n this.log(`semantic: ${repositoryId}@${gitRef} index evicted with its graph slot (${idx.vectors.size} vectors freed)`);\n }\n\n /** Drop everything (daemon shutdown / registry clear). */\n clear(): void {\n this.indexes.clear();\n this.inflight.clear();\n for (const timer of this.rewarmTimers.values()) clearTimeout(timer);\n this.rewarmTimers.clear();\n }\n\n /**\n * Ensure the slot has vectors, building them if needed. Resolves when the\n * index is ready or has definitively failed; never throws.\n *\n * A second caller for the same slot waits for the in-flight build instead of\n * returning the empty placeholder — that empty return is what made `vg ask`\n * re-embed tens of thousands of nodes in-process while vgd was already doing\n * the same work.\n */\n async ensureIndex(\n repositoryId: string,\n gitRef: string,\n graph: VgGraph,\n options?: EnsureIndexOptions,\n ): Promise<SlotIndex> {\n const key = activeGraphSlotKey(repositoryId, gitRef);\n let idx = this.indexes.get(key);\n if (!idx) {\n idx = { repositoryId, gitRef, state: 'stale', vectors: new Map(), nodeCount: graph.nodes?.length ?? 0 };\n this.indexes.set(key, idx);\n }\n if (idx.state === 'ready') return idx;\n if (this.gaveUp) {\n idx.state = 'failed';\n idx.error = this.reason ?? 'embedding worker unavailable';\n return idx;\n }\n const pending = this.inflight.get(key);\n if (pending) return pending;\n\n const work = this.buildIndex(key, idx, repositoryId, gitRef, graph, options).finally(() => {\n if (this.inflight.get(key) === work) this.inflight.delete(key);\n });\n this.inflight.set(key, work);\n return work;\n }\n\n private async buildIndex(\n key: string,\n idx: SlotIndex,\n repositoryId: string,\n gitRef: string,\n graph: VgGraph,\n options?: EnsureIndexOptions,\n ): Promise<SlotIndex> {\n idx.state = 'building';\n const started = this.now();\n\n // Seed from the on-disk vector cache first. `vg embed` (and the `vg build`\n // warm-up child) already wrote vectors for this repo, over the same\n // targets and the same embed-text, so re-deriving them here would be pure\n // duplicated work — usually the *whole* index. A repo that is already\n // warm on disk therefore goes `ready` in milliseconds, with no worker.\n let seeded = this.seedFromDisk(repositoryId, graph);\n if (seeded?.writerBusy && seeded.pending.length && options?.waitForWriter) {\n this.log(`semantic: ${repositoryId}@${gitRef} waiting for another process to finish the on-disk index…`);\n await this.waitWhileWriterBusy(repositoryId, graph, options.waitForWriterMs ?? 300_000);\n seeded = this.seedFromDisk(repositoryId, graph);\n }\n const targets = seeded?.pending ?? embedTargets(graph);\n const vectors = seeded ? seeded.vectors : new Map<string, number[]>();\n const nodeCount = seeded ? seeded.vectors.size + seeded.pending.length : targets.length;\n idx.nodeCount = nodeCount;\n\n if (seeded && seeded.vectors.size) {\n this.log(\n `semantic: seeded ${repositoryId}@${gitRef} from the on-disk index — ${seeded.vectors.size} vectors, ${seeded.pending.length} pending`,\n );\n }\n\n // Another process is mid-write on this repo's cache (the `vg build`\n // warm-up child). Background warms take what is there and stand down\n // rather than embedding the same nodes a second time. A blocking caller\n // already waited above; if the writer is still going we still stand down\n // and retry shortly, so the slot cannot stay empty forever.\n if (seeded?.writerBusy && targets.length) {\n idx.vectors = vectors;\n idx.pending = targets.length;\n idx.state = vectors.size ? 'stale' : 'absent';\n this.log(\n `semantic: ${repositoryId}@${gitRef} left at ${targets.length} pending — another process is writing the on-disk index; re-warming when it reports in`,\n );\n this.scheduleRewarm(repositoryId, gitRef);\n return idx;\n }\n\n this.log(`semantic: building index for ${repositoryId}@${gitRef} (${targets.length} of ${nodeCount} nodes)…`);\n\n try {\n for (let i = 0; i < targets.length; i += this.batchSize) {\n const batch = targets.slice(i, i + this.batchSize);\n const out = await this.embed(batch.map((t: EmbedTarget) => t.text));\n batch.forEach((t: EmbedTarget, j: number) => {\n const v = out[j];\n if (v) vectors.set(t.id, v);\n });\n // Publish counts as we go so `embed-status` (and the ask spinner) stay\n // current. Only share the growing map when we have nothing rankable yet\n // — a republish keeps its previous vectors until this build finishes.\n if (idx.vectors.size === 0 || idx.vectors === vectors) idx.vectors = vectors;\n idx.pending = Math.max(0, nodeCount - vectors.size);\n // A slot evicted or republished mid-build must not be resurrected with\n // vectors describing the graph it no longer has.\n const live = this.indexes.get(key);\n if (!live || live !== idx) {\n this.log(`semantic: index build for ${repositoryId}@${gitRef} abandoned — slot changed underneath it`);\n this.inflight.delete(key);\n if (live && live !== idx) {\n const nextGraph = this.graphProvider?.(repositoryId, gitRef) ?? graph;\n return this.ensureIndex(repositoryId, gitRef, nextGraph, options);\n }\n return idx;\n }\n }\n idx.vectors = vectors;\n idx.pending = undefined;\n idx.state = 'ready';\n idx.builtAt = this.now();\n idx.buildMs = idx.builtAt - started;\n idx.error = undefined;\n this.clearRewarm(key);\n this.log(`semantic: index ready for ${repositoryId}@${gitRef} — ${vectors.size} vectors in ${idx.buildMs}ms`);\n } catch (err) {\n // Vectors seeded from disk stay usable even when the worker never ran:\n // a partial index still ranks better than nothing.\n idx.vectors = vectors;\n idx.pending = targets.length;\n idx.state = 'failed';\n idx.error = err instanceof Error ? err.message : String(err);\n this.log(`semantic: index build failed for ${repositoryId}@${gitRef} — ${idx.error}; callers fall back to lexical`);\n }\n return idx;\n }\n\n /** Poll the on-disk lock until the writer is gone or `timeoutMs` elapses. */\n private async waitWhileWriterBusy(repositoryId: string, graph: VgGraph, timeoutMs: number): Promise<void> {\n const deadline = Date.now() + timeoutMs;\n while (Date.now() < deadline) {\n const read = this.seedFromDisk(repositoryId, graph);\n if (!read?.writerBusy) return;\n await this.sleepImpl(250);\n }\n }\n\n /** Retry a slot that stood down for an on-disk writer, once the writer should have moved. */\n private scheduleRewarm(repositoryId: string, gitRef: string): void {\n const key = activeGraphSlotKey(repositoryId, gitRef);\n if (this.rewarmTimers.has(key)) return;\n const timer = setTimeout(() => {\n this.rewarmTimers.delete(key);\n const idx = this.indexes.get(key);\n if (!idx || idx.state === 'ready' || this.inflight.has(key)) return;\n const graph = this.graphProvider?.(repositoryId, gitRef);\n if (!graph) return;\n void this.ensureIndex(repositoryId, gitRef, graph);\n }, 2_000);\n (timer as unknown as { unref?: () => void }).unref?.();\n this.rewarmTimers.set(key, timer);\n }\n\n private clearRewarm(key: string): void {\n const timer = this.rewarmTimers.get(key);\n if (!timer) return;\n clearTimeout(timer);\n this.rewarmTimers.delete(key);\n }\n\n /**\n * Read this slot's vectors out of the repo's on-disk cache. Needs the repo\n * root from the registry; a repository the daemon has no root for (a\n * synthetic publish in a test) simply builds from scratch.\n */\n private seedFromDisk(\n repositoryId: string,\n graph: VgGraph,\n ): { vectors: Map<string, number[]>; pending: EmbedTarget[]; writerBusy: boolean } | null {\n const root = this.rootProvider?.(repositoryId);\n if (!root) return null;\n try {\n const read = readCachedVectors(graph, root);\n if (!this.model) this.model = read.model;\n return { vectors: read.vectors, pending: read.pending, writerBusy: read.writerBusy };\n } catch (err) {\n this.log(`semantic: could not read the on-disk index — ${err instanceof Error ? err.message : String(err)}; embedding from scratch`);\n return null;\n }\n }\n\n /**\n * Rank a slot's nodes against one question, inside the daemon.\n *\n * This is the op that makes the resident index worth holding. The\n * alternative — shipping the vectors to the caller so it can rank locally —\n * moves tens of megabytes over a socket per ask; ranking here moves one\n * question in and a few hundred (id, score) pairs out.\n *\n * Only the *order* of this list reaches the caller's rank fusion, so\n * truncating at `limit` is not an approximation of the answer: a candidate\n * ranked past a few hundred cannot reach a 12-row result under RRF.\n *\n * Returns null whenever semantic is unavailable — a caller that gets null\n * runs its own in-process pass, exactly as it does with no daemon at all.\n */\n async rank(\n repositoryId: string,\n gitRef: string,\n text: string,\n limit = 200,\n ): Promise<{ ranked: Array<{ id: string; score: number }>; state: SlotIndexState; vectors: number } | null> {\n const idx = this.slot(repositoryId, gitRef);\n if (!idx || idx.vectors.size === 0) return null;\n const queryVec = await this.embedQuery(text);\n if (!queryVec) return null;\n const scored: Array<{ id: string; score: number }> = [];\n for (const [id, vec] of idx.vectors) {\n const score = cosine(queryVec, vec);\n if (score > 0) scored.push({ id, score });\n }\n // Deterministic: ties break on node id, never on Map insertion order.\n scored.sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));\n return { ranked: scored.slice(0, limit), state: idx.state, vectors: idx.vectors.size };\n }\n\n /** Embed one query string. Returns null when semantic is not available. */\n async embedQuery(text: string): Promise<number[] | null> {\n if (this.gaveUp) return null;\n try {\n const [vector] = await this.embed([text], true);\n return vector ?? null;\n } catch (err) {\n this.log(`semantic: query embedding failed — ${err instanceof Error ? err.message : String(err)}; using lexical`);\n return null;\n }\n }\n\n /** Stop the worker (daemon shutdown). Safe to call when already stopped. */\n stop(): void {\n for (const timer of this.rewarmTimers.values()) clearTimeout(timer);\n this.rewarmTimers.clear();\n const child = this.child;\n this.child = null;\n this.starting = false;\n for (const [, p] of this.pending) {\n clearTimeout(p.timer);\n p.reject(new Error('embedding worker stopped'));\n }\n this.pending.clear();\n if (child) {\n try {\n child.kill();\n } catch {\n /* already gone */\n }\n }\n }\n\n // ── worker plumbing ────────────────────────────────────────────────────\n\n private ensureWorker(): ChildProcess {\n if (this.child) return this.child;\n this.starting = true;\n const child = this.spawnWorker();\n this.child = child;\n this.starting = false;\n this.buffer = '';\n this.log(`semantic: embedding worker started (pid ${child.pid ?? '?'})`);\n\n child.stdout?.setEncoding('utf8');\n child.stdout?.on('data', (chunk: string) => this.onData(chunk));\n // The worker's stderr is diagnostic only; surface it so a failing backend\n // is visible in the daemon log rather than silently swallowed.\n child.stderr?.setEncoding('utf8');\n child.stderr?.on('data', (chunk: string) => {\n const text = String(chunk).trim();\n if (text) this.log(`semantic worker: ${text.slice(0, 500)}`);\n });\n child.on('exit', (code, signal) => this.onExit(code, signal));\n child.on('error', (err: Error) => {\n this.log(`semantic: embedding worker could not start — ${err.message}`);\n this.onExit(null, null);\n });\n return child;\n }\n\n private onData(chunk: string): void {\n this.buffer += chunk;\n let nl: number;\n while ((nl = this.buffer.indexOf('\\n')) >= 0) {\n const line = this.buffer.slice(0, nl).trim();\n this.buffer = this.buffer.slice(nl + 1);\n if (!line) continue;\n let res: { id?: number; ok?: boolean; vectors?: number[][]; error?: string; model?: string };\n try {\n res = JSON.parse(line) as typeof res;\n } catch {\n continue; // a corrupt frame is not fatal to the stream\n }\n if (typeof res.model === 'string') this.model = res.model;\n const id = res.id;\n if (typeof id !== 'number') continue;\n const p = this.pending.get(id);\n if (!p) continue;\n this.pending.delete(id);\n clearTimeout(p.timer);\n if (res.ok && Array.isArray(res.vectors)) p.resolve(res.vectors);\n else p.reject(new Error(res.error || 'embedding worker returned no vectors'));\n }\n }\n\n private onExit(code: number | null, signal: NodeJS.Signals | null): void {\n const wasRunning = !!this.child;\n this.child = null;\n if (!wasRunning) return;\n\n this.crashes++;\n const how = signal ? `signal ${signal}` : `code ${code ?? 'null'}`;\n // Fail every in-flight request rather than letting callers hang: each one\n // has a lexical fallback waiting.\n for (const [, p] of this.pending) {\n clearTimeout(p.timer);\n p.reject(new Error(`embedding worker exited (${how})`));\n }\n this.pending.clear();\n\n if (this.crashes >= this.maxCrashes) {\n this.gaveUp = true;\n this.reason =\n `the embedding worker exited (${how}) ${this.crashes} times — semantic search is off for this daemon; ` +\n `everything falls back to lexical. A native backend that aborts like this is usually a blocked ` +\n `onnxruntime-node postinstall (see \\`vg embed --where\\`).`;\n this.log(`semantic: ${this.reason}`);\n return;\n }\n this.log(`semantic: embedding worker exited (${how}) — restarting on next use (${this.crashes}/${this.maxCrashes})`);\n }\n\n private embed(texts: string[], query = false): Promise<number[][]> {\n if (this.gaveUp) return Promise.reject(new Error(this.reason ?? 'embedding worker unavailable'));\n if (!texts.length) return Promise.resolve([]);\n let child: ChildProcess;\n try {\n child = this.ensureWorker();\n } catch (err) {\n // A worker that cannot even be spawned counts against the crash budget,\n // so a permanently broken install settles into \"lexical\" instead of\n // retrying (and re-logging) on every request.\n const error = err instanceof Error ? err : new Error(String(err));\n this.crashes++;\n if (this.crashes >= this.maxCrashes) {\n this.gaveUp = true;\n this.reason = `the embedding worker could not start (${error.message}) — semantic search is off for this daemon`;\n this.log(`semantic: ${this.reason}`);\n } else {\n this.log(`semantic: embedding worker could not start — ${error.message} (${this.crashes}/${this.maxCrashes})`);\n }\n return Promise.reject(error);\n }\n const id = this.nextId++;\n return new Promise<number[][]>((resolve, reject) => {\n const timer = setTimeout(() => {\n this.pending.delete(id);\n reject(new Error(`embedding request timed out after ${this.requestTimeoutMs}ms`));\n }, this.requestTimeoutMs);\n // Do not hold the daemon open on this timer.\n (timer as unknown as { unref?: () => void }).unref?.();\n this.pending.set(id, { resolve, reject, timer });\n try {\n child.stdin?.write(JSON.stringify({ id, op: 'embed', texts, query }) + '\\n');\n } catch (err) {\n this.pending.delete(id);\n clearTimeout(timer);\n reject(err instanceof Error ? err : new Error(String(err)));\n }\n });\n }\n\n /** A successful exchange clears the crash streak — used after a good build. */\n noteHealthy(): void {\n this.crashes = 0;\n }\n}\n\n/**\n * Spawn the real worker: the compiled sibling entry (a tsup entry point, like\n * `parse-worker`), run by the same Node binary. Under a TS-only runner the\n * compiled file does not exist — the same situation `engine/pool.ts` handles —\n * so this throws rather than spawning something that cannot start, and the\n * broker reports the failure like any other and callers go lexical.\n */\nfunction defaultSpawnWorker(): ChildProcess {\n const here = path.dirname(fileURLToPath(import.meta.url));\n const entry = path.join(here, 'embed-worker-main.js');\n if (!fs.existsSync(entry)) {\n throw new Error(`embedding worker not found at ${entry} — semantic runs lexically`);\n }\n return spawn(process.execPath, [entry], {\n stdio: ['pipe', 'pipe', 'pipe'],\n // Never inherit loader flags or a debugger port: this child exists to be\n // expendable, and anything that changes how it loads defeats the point.\n env: { ...process.env, NODE_OPTIONS: '' },\n });\n}\n","/**\n * Maps a dependency name to the line it is declared on, inside a manifest.\n *\n * This is the one thing the scan engine cannot tell us: it reports *what* is\n * drifted, not *where the text is*. The editor needs a line to hang a\n * decoration, a hover, or a diagnostic on.\n *\n * Deliberately lexical, not a full parse. We are matching a declaration line in\n * a file the user is looking at; a tolerant regex over the exact text in the\n * editor buffer beats a parser that fails on a half-typed edit. If we can't\n * find a line, we return nothing and the surface silently doesn't render —\n * which is the correct failure mode for an ambient feature.\n */\n\nexport type ManifestKind =\n | 'package.json'\n | 'go.mod'\n | 'requirements.txt'\n | 'pyproject.toml'\n | 'Cargo.toml'\n | 'pom.xml'\n | 'build.gradle'\n | 'Gemfile'\n | 'composer.json'\n | 'pubspec.yaml'\n | 'mix.exs'\n | 'csproj'\n | 'Dockerfile'\n | 'unknown';\n\n/** Classify a path so we know which matcher to use. Case-insensitive on the basename. */\nexport function manifestKind(filePath: string): ManifestKind {\n const base = (filePath.split(/[\\\\/]/).pop() ?? '').toLowerCase();\n if (base === 'package.json') return 'package.json';\n if (base === 'go.mod') return 'go.mod';\n if (base === 'requirements.txt' || /^requirements.*\\.txt$/.test(base)) return 'requirements.txt';\n if (base === 'pyproject.toml') return 'pyproject.toml';\n if (base === 'cargo.toml') return 'Cargo.toml';\n if (base === 'pom.xml') return 'pom.xml';\n if (base === 'build.gradle' || base === 'build.gradle.kts') return 'build.gradle';\n if (base === 'gemfile') return 'Gemfile';\n if (base === 'composer.json') return 'composer.json';\n if (base === 'pubspec.yaml') return 'pubspec.yaml';\n if (base === 'mix.exs') return 'mix.exs';\n if (base.endsWith('.csproj') || base.endsWith('.fsproj') || base.endsWith('.vbproj')) return 'csproj';\n if (base === 'dockerfile' || base.startsWith('dockerfile.')) return 'Dockerfile';\n return 'unknown';\n}\n\n/** True when this file is one the LSP should attach surfaces to. */\nexport function isManifest(filePath: string): boolean {\n return manifestKind(filePath) !== 'unknown';\n}\n\n/** Escape a package name for safe embedding in a RegExp. */\nfunction esc(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Find the 0-based line index on which `pkg` is declared in `text`.\n * Returns -1 when not found.\n */\nexport function findPackageLine(text: string, pkg: string, kind: ManifestKind): number {\n const lines = text.split(/\\r?\\n/);\n const p = esc(pkg);\n\n // Ordered candidate matchers. The first that hits wins.\n const patterns: RegExp[] = (() => {\n switch (kind) {\n case 'package.json':\n case 'composer.json':\n // \"react\": \"^17.0.2\" — the key, quoted, followed by a colon\n return [new RegExp(`^\\\\s*\"${p}\"\\\\s*:`)];\n\n case 'go.mod':\n // \tgithub.com/foo/bar v1.2.3 (inside a require block, or `require x v1`)\n return [new RegExp(`^\\\\s*(?:require\\\\s+)?${p}\\\\s+v?\\\\d`)];\n\n case 'requirements.txt':\n // requests==2.31.0 · requests>=2 · requests[security]==2 · requests\n return [new RegExp(`^\\\\s*${p}\\\\s*(?:\\\\[[^\\\\]]*\\\\])?\\\\s*(?:[=<>!~]|$)`, 'i')];\n\n case 'pyproject.toml':\n case 'Cargo.toml':\n // foo = \"1.2\" · foo = { version = \"1.2\" } · \"foo>=1.2\" (poetry/pep621 arrays)\n return [\n new RegExp(`^\\\\s*${p}\\\\s*=`),\n new RegExp(`^\\\\s*\"${p}\\\\s*(?:[=<>!~\\\\[]|\")`),\n ];\n\n case 'pom.xml':\n // <artifactId>spring-boot</artifactId>\n return [new RegExp(`<artifactId>\\\\s*${p}\\\\s*</artifactId>`)];\n\n case 'build.gradle':\n // implementation 'com.foo:bar:1.2' · implementation(\"com.foo:bar:1.2\")\n return [new RegExp(`[\"']${p}(?:[\"':])`)];\n\n case 'Gemfile':\n // gem 'rails', '~> 7.0'\n return [new RegExp(`^\\\\s*gem\\\\s+[\"']${p}[\"']`)];\n\n case 'pubspec.yaml':\n return [new RegExp(`^\\\\s*${p}\\\\s*:`)];\n\n case 'mix.exs':\n // {:phoenix, \"~> 1.7\"}\n return [new RegExp(`\\\\{\\\\s*:${p}\\\\s*,`)];\n\n case 'csproj':\n // <PackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.1\" />\n return [new RegExp(`Include\\\\s*=\\\\s*\"${p}\"`, 'i')];\n\n case 'Dockerfile':\n // FROM node:18-alpine — the \"package\" here is the base image\n return [new RegExp(`^\\\\s*FROM\\\\s+.*${p}`, 'i')];\n\n default:\n return [];\n }\n })();\n\n for (const re of patterns) {\n for (let i = 0; i < lines.length; i++) {\n if (re.test(lines[i])) return i;\n }\n }\n\n return -1;\n}\n\n/**\n * The line a *runtime* constraint sits on — `engines.node`, `go 1.21`,\n * `<java.version>`, `FROM node:18`. Used to place the EOL-runtime diagnostic on\n * the actual offending line instead of dumping it at the top of the file.\n * Returns -1 when we can't place it (caller falls back to line 0).\n */\nexport function findRuntimeLine(text: string, kind: ManifestKind): number {\n const lines = text.split(/\\r?\\n/);\n const patterns: RegExp[] = (() => {\n switch (kind) {\n case 'package.json':\n return [/^\\s*\"node\"\\s*:/, /^\\s*\"engines\"\\s*:/];\n case 'go.mod':\n return [/^\\s*go\\s+\\d/];\n case 'pyproject.toml':\n return [/^\\s*(?:requires-python|python)\\s*=/];\n case 'pom.xml':\n return [/<(?:java\\.version|maven\\.compiler\\.(?:source|target|release))>/];\n case 'build.gradle':\n return [/(?:sourceCompatibility|targetCompatibility|JavaVersion)/];\n case 'csproj':\n return [/<TargetFrameworks?>/i];\n case 'Dockerfile':\n return [/^\\s*FROM\\s+/i];\n default:\n return [];\n }\n })();\n\n for (const re of patterns) {\n for (let i = 0; i < lines.length; i++) {\n if (re.test(lines[i])) return i;\n }\n }\n\n return -1;\n}\n\n/** The end-of-line column for a given line — where an `after` decoration lands. */\nexport function endOfLine(text: string, line: number): number {\n const lines = text.split(/\\r?\\n/);\n return (lines[line] ?? '').length;\n}\n","/**\n * Drift-scan result cache for `vg lsp`.\n *\n * `runCoreScan` is the expensive part of a scan (per-package registry lookups),\n * not reading the manifest/lockfile — so on every editor activation, hashing\n * just the manifest+lockfile bytes first and comparing to the last successful\n * scan's hash lets an unchanged repo skip `runCoreScan` entirely and replay the\n * cached result instantly. Only a real dependency change (any manifest or\n * lockfile byte differs) pays for a fresh scan.\n *\n * Lives under `.vibgrate/cache/` (gitignored, machine-local) alongside the\n * graph's parse cache and freshness snapshot — same convention, same directory.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { hashBytes, hashString, canonicalize } from '../engine/hash.js';\nimport { cacheDir } from '../engine/cache.js';\nimport { stableStringify } from '../engine/serialize.js';\nimport { isSkippedDirName, SKIP_FILES } from '../engine/discover.js';\nimport { isManifest } from './manifest-positions.js';\nimport type { ScanArtifact } from '../core-open/index.js';\n\n// Bumped: v1 caches carried no `toolVersion`/`offline` guard, so a scan cached\n// under an older engine build (or under `--local`, before registry access was\n// available) replayed forever once the manifest stopped changing — even after\n// an upgrade or the network came back. Bumping discards every v1 cache on read.\nconst CACHE_VERSION = 'vg-lsp-scan-cache/2';\n\nfunction cachePath(root: string): string {\n return path.join(cacheDir(root), 'lsp-scan.json');\n}\n\n/**\n * Hash every manifest (`package.json`, `go.mod`, …) and lockfile\n * (`package-lock.json`, `go.sum`, …) under `root`, combined into one stable\n * digest. A cheap stat+read walk — no registry calls, no dependency\n * resolution — so it is safe to run before every scan as a gate.\n */\nexport function manifestHash(root: string): string {\n const files: { rel: string; hash: string }[] = [];\n\n const walk = (dir: string): void => {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return; // unreadable dir — skip rather than crash the probe\n }\n for (const entry of entries) {\n const abs = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (isSkippedDirName(entry.name)) continue;\n walk(abs);\n continue;\n }\n if (!entry.isFile()) continue;\n const base = entry.name.toLowerCase();\n if (!isManifest(abs) && !SKIP_FILES.has(base)) continue;\n try {\n const rel = path.relative(root, abs).split(path.sep).join('/');\n files.push({ rel, hash: hashBytes(fs.readFileSync(abs)) });\n } catch {\n // Unreadable/raced-away file — leave it out; worst case is an extra\n // rescan next time, never a wrong cache hit.\n }\n }\n };\n walk(root);\n\n files.sort((a, b) => (a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0));\n return hashString(canonicalize(files));\n}\n\n/**\n * Is this a file a drift scan actually reads — a manifest (`package.json`,\n * `go.mod`, `*.csproj`, …) or a lockfile (`package-lock.json`,\n * `packages.lock.json`, …) — sitting outside every skipped tree\n * (`node_modules`, `bin`/`obj`, `.git`, …)? Exactly the population\n * {@link manifestHash} digests, applied to a single path, so \"would this\n * change flip the cache key?\" and \"should this change trigger a rescan?\"\n * cannot drift apart. Paths outside `root` are never scan input: false.\n */\nexport function isDependencyFile(root: string, filePath: string): boolean {\n const rel = path.relative(path.resolve(root), path.resolve(filePath));\n if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) return false;\n const parts = rel.split(path.sep);\n if (parts.slice(0, -1).some((dir) => isSkippedDirName(dir))) return false;\n const base = parts[parts.length - 1]!.toLowerCase();\n return isManifest(filePath) || SKIP_FILES.has(base);\n}\n\nexport interface ScanCacheEntry {\n manifestHash: string;\n artifact: ScanArtifact;\n}\n\n/**\n * A cache hit must match on more than the manifest bytes: `toolVersion` guards\n * against an engine upgrade changing what a scan produces (mirrors the parse\n * cache's `toolVersion` invalidation in `engine/cache.ts`), and `offline`\n * guards against replaying an offline scan's unresolved drift once the\n * network — or `vibgrate.offline` — changes. Both are cheap to compare and\n * cheap to get wrong, so they are required, not optional.\n */\nexport interface ScanCacheKey {\n manifestHash: string;\n toolVersion: string;\n offline: boolean;\n}\n\n/** Best-effort read. Returns null on a missing, corrupt, stale-version, or non-matching-key cache. */\nexport function loadScanCache(root: string, key: ScanCacheKey): ScanCacheEntry | null {\n try {\n const raw = JSON.parse(fs.readFileSync(cachePath(root), 'utf8')) as {\n version?: string;\n manifestHash?: string;\n toolVersion?: string;\n offline?: boolean;\n artifact?: ScanArtifact;\n };\n if (\n raw.version === CACHE_VERSION &&\n raw.manifestHash === key.manifestHash &&\n raw.toolVersion === key.toolVersion &&\n raw.offline === key.offline &&\n raw.artifact\n ) {\n return { manifestHash: raw.manifestHash, artifact: raw.artifact };\n }\n } catch {\n /* missing/corrupt — treat as no cache */\n }\n return null;\n}\n\n/** Best-effort write (a read-only checkout etc. just means no cache next time). */\nexport function writeScanCache(root: string, key: ScanCacheKey, artifact: ScanArtifact): void {\n try {\n fs.mkdirSync(cacheDir(root), { recursive: true });\n fs.writeFileSync(\n cachePath(root),\n stableStringify(\n { version: CACHE_VERSION, manifestHash: key.manifestHash, toolVersion: key.toolVersion, offline: key.offline, artifact },\n 0,\n ),\n );\n } catch {\n /* best-effort only */\n }\n}\n","import { spawn, type ChildProcess } from 'node:child_process';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { isRelevantChange } from '../../engine/watch-filter.js';\nimport { isDependencyFile } from '../../lsp/scan-cache.js';\nimport { clearDetectGitRefCache, detectGitRef } from '../git-ref.js';\n\n/**\n * Keeping the daemon's maps current, inside the daemon.\n *\n * Freshness used to live in every consumer instead: `vg serve` and `vg lsp`\n * each ran their own recursive `fs.watch` and their own `RefreshScheduler`, and\n * `vg ask` probed inline on each invocation. vgd — the one process actually\n * holding the graphs — had none of it, so its slots aged out silently while\n * three other processes duplicated the work of noticing.\n *\n * **Rebuilds run in a child, never here.** This is the load-bearing constraint.\n * `buildGraph` on a large repo blocks for seconds, and vgd is single-threaded:\n * the protocol already carries a scar from this (`put-graph` re-encoding a\n * graph \"blocked the daemon's event loop for seconds, timing out every\n * concurrent client\"). Now that `vg ask` ranks through the daemon, an inline\n * rebuild would stall every ask and every editor call for its whole duration.\n * So a rebuild is `vg build` in a detached child, and the daemon only reloads\n * the finished snapshot from disk — work it already does in microseconds.\n *\n * **Three triggers, one path.** Source edits, dependency-manifest/lockfile\n * edits, and branch switches all converge on \"rebuild this repo, then reload\n * the slot\". Branch switches additionally re-select the slot first, because a\n * branch's snapshot may already be warm and need no build at all.\n */\n\n/** Settle window after the last change before a rebuild starts. */\nexport const DEFAULT_SETTLE_MS = 600;\n/** Floor between two rebuilds of the same repo, however noisy the tree is. */\nexport const DEFAULT_MIN_REBUILD_GAP_MS = 5_000;\n/** A rebuild child that outlives this is abandoned (never left to wedge a slot). */\nexport const DEFAULT_REBUILD_TIMEOUT_MS = 10 * 60_000;\n\nexport type FreshnessLog = (message: string) => void;\n\nexport interface FreshnessReload {\n /** Reload this repo's map from disk into its slot. Returns node count, or null. */\n (repositoryId: string, root: string, gitRef: string): Promise<number | null>;\n}\n\nexport interface FreshnessSelect {\n /** Point the repo at a different ref's slot (branch switch). */\n (repositoryId: string, gitRef: string): void;\n}\n\nexport interface FreshnessOptions {\n log?: FreshnessLog;\n reload: FreshnessReload;\n select: FreshnessSelect;\n settleMs?: number;\n minRebuildGapMs?: number;\n rebuildTimeoutMs?: number;\n /** Injected watcher (tests). Must return something with `close()`. */\n watch?: (dir: string, onChange: (filename: string) => void) => { close(): void } | null;\n /** Injected rebuild (tests). Resolves when the child finishes. */\n rebuild?: (root: string) => Promise<{ ok: boolean; error?: string }>;\n /** Injected ref detection (tests). Default re-reads git, bypassing the memo. */\n detectRef?: (root: string) => string;\n now?: () => number;\n}\n\ninterface Watched {\n repositoryId: string;\n root: string;\n gitRef: string;\n source: { close(): void } | null;\n head: { close(): void } | null;\n timer: ReturnType<typeof setTimeout> | null;\n /** Files seen since the last rebuild — reported, then cleared. */\n pending: Set<string>;\n /** A rebuild is in flight; further changes coalesce into the next one. */\n building: boolean;\n /** Another change arrived while building — rebuild again when it lands. */\n again: boolean;\n lastRebuildAt: number;\n}\n\nexport interface FreshnessSummary {\n repositoryId: string;\n root: string;\n gitRef: string;\n watching: boolean;\n pending: number;\n building: boolean;\n lastRebuildAt?: number;\n}\n\nexport class FreshnessSupervisor {\n private readonly watched = new Map<string, Watched>();\n /** Told when a manifest or lockfile is written — the shared dependency cache. */\n private manifestListener?: (repositoryId: string) => void;\n private readonly log: FreshnessLog;\n private readonly reload: FreshnessReload;\n private readonly select: FreshnessSelect;\n private readonly settleMs: number;\n private readonly minRebuildGapMs: number;\n private readonly rebuildTimeoutMs: number;\n private readonly watchImpl: NonNullable<FreshnessOptions['watch']>;\n private readonly rebuildImpl: NonNullable<FreshnessOptions['rebuild']>;\n private readonly detectRef: (root: string) => string;\n private readonly now: () => number;\n\n constructor(options: FreshnessOptions) {\n this.log = options.log ?? ((): void => {});\n this.reload = options.reload;\n this.select = options.select;\n this.settleMs = options.settleMs ?? DEFAULT_SETTLE_MS;\n this.minRebuildGapMs = options.minRebuildGapMs ?? DEFAULT_MIN_REBUILD_GAP_MS;\n this.rebuildTimeoutMs = options.rebuildTimeoutMs ?? DEFAULT_REBUILD_TIMEOUT_MS;\n this.watchImpl = options.watch ?? defaultWatch;\n this.rebuildImpl = options.rebuild ?? ((root) => spawnRebuild(root, this.rebuildTimeoutMs));\n this.detectRef = options.detectRef ?? defaultDetectRef;\n this.now = options.now ?? ((): number => Date.now());\n }\n\n /**\n * Attach something that must forget derived state when a manifest or\n * lockfile changes. The watcher is already looking at exactly these files,\n * so a cache hung off this has no staleness window — unlike a TTL.\n */\n setManifestListener(listener: (repositoryId: string) => void): void {\n this.manifestListener = listener;\n }\n\n list(): FreshnessSummary[] {\n return [...this.watched.values()]\n .map((w) => ({\n repositoryId: w.repositoryId,\n root: w.root,\n gitRef: w.gitRef,\n watching: !!w.source,\n pending: w.pending.size,\n building: w.building,\n lastRebuildAt: w.lastRebuildAt || undefined,\n }))\n .sort((a, b) => a.repositoryId.localeCompare(b.repositoryId));\n }\n\n /**\n * Start watching a repository. Idempotent: re-registering the same root only\n * updates the ref it believes is current.\n */\n start(repositoryId: string, root: string, gitRef: string): void {\n const existing = this.watched.get(repositoryId);\n if (existing) {\n existing.gitRef = gitRef;\n return;\n }\n const entry: Watched = {\n repositoryId,\n root,\n gitRef,\n source: null,\n head: null,\n timer: null,\n pending: new Set(),\n building: false,\n again: false,\n lastRebuildAt: 0,\n };\n this.watched.set(repositoryId, entry);\n\n entry.source = this.watchImpl(root, (filename) => {\n // `isRelevantChange` also filters vg's own artifacts — without it every\n // rebuild would observe its own output and trigger the next one.\n if (!isRelevantChange(filename)) return;\n entry.pending.add(filename);\n const manifest = isDependencyFile(root, path.join(root, filename));\n if (manifest) this.manifestListener?.(entry.repositoryId);\n this.schedule(entry, manifest ? 'manifest' : 'source');\n });\n\n // `.git` is excluded from the source watcher by design (its churn is not\n // source change), so branch detection needs its own narrow watch on HEAD.\n const gitDir = path.join(root, '.git');\n if (fs.existsSync(gitDir)) {\n entry.head = this.watchImpl(gitDir, (filename) => {\n if (path.basename(filename) !== 'HEAD') return;\n this.onHeadChanged(entry);\n });\n }\n\n this.log(\n `freshness: watching ${repositoryId} @${gitRef} (${entry.source ? 'source' : 'no source watcher'}${entry.head ? ' + HEAD' : ''})`,\n );\n }\n\n /** Stop watching one repository — its slot is gone or was unregistered. */\n stop(repositoryId: string): void {\n const entry = this.watched.get(repositoryId);\n if (!entry) return;\n this.watched.delete(repositoryId);\n if (entry.timer) clearTimeout(entry.timer);\n entry.source?.close();\n entry.head?.close();\n this.log(`freshness: stopped watching ${repositoryId}`);\n }\n\n /** Daemon shutdown. */\n stopAll(): void {\n for (const id of [...this.watched.keys()]) this.stop(id);\n }\n\n /**\n * A branch switch: re-select first, and rebuild only when that ref has no\n * usable snapshot. Checking out a branch you were on ten minutes ago should\n * be instant, not a full rebuild.\n */\n private onHeadChanged(entry: Watched): void {\n const ref = this.detectRef(entry.root);\n if (!ref || ref === entry.gitRef) return;\n const from = entry.gitRef;\n entry.gitRef = ref;\n entry.pending.clear();\n this.log(`freshness: ${entry.repositoryId} branch ${from} → ${ref}`);\n this.select(entry.repositoryId, ref);\n void this.reload(entry.repositoryId, entry.root, ref).then((nodes) => {\n if (nodes != null) {\n this.log(`freshness: ${entry.repositoryId}@${ref} slot warm from disk — ${nodes} nodes`);\n } else {\n this.log(`freshness: ${entry.repositoryId}@${ref} has no snapshot yet — rebuilding`);\n this.schedule(entry, 'branch');\n }\n });\n }\n\n private schedule(entry: Watched, reason: 'source' | 'manifest' | 'branch'): void {\n if (entry.building) {\n entry.again = true;\n return;\n }\n if (entry.timer) clearTimeout(entry.timer);\n // Hold a noisy tree to one rebuild per gap, measured from the last one.\n const sinceLast = this.now() - entry.lastRebuildAt;\n const wait = Math.max(this.settleMs, entry.lastRebuildAt ? this.minRebuildGapMs - sinceLast : 0);\n entry.timer = setTimeout(() => {\n entry.timer = null;\n void this.rebuild(entry, reason);\n }, wait);\n entry.timer.unref?.();\n }\n\n private async rebuild(entry: Watched, reason: string): Promise<void> {\n if (entry.building) {\n entry.again = true;\n return;\n }\n entry.building = true;\n const changed = entry.pending.size;\n const names = [...entry.pending].sort().slice(0, 3).join(', ');\n entry.pending.clear();\n const started = this.now();\n this.log(\n `freshness: rebuilding ${entry.repositoryId}@${entry.gitRef} (${reason}${changed ? `, ${changed} file(s): ${names}` : ''})…`,\n );\n try {\n const result = await this.rebuildImpl(entry.root);\n entry.lastRebuildAt = this.now();\n if (!result.ok) {\n this.log(`freshness: rebuild failed for ${entry.repositoryId} — ${result.error ?? 'unknown'}; slot keeps its previous map`);\n return;\n }\n const nodes = await this.reload(entry.repositoryId, entry.root, entry.gitRef);\n this.log(\n nodes != null\n ? `freshness: ${entry.repositoryId}@${entry.gitRef} reloaded — ${nodes} nodes in ${this.now() - started}ms`\n : `freshness: ${entry.repositoryId}@${entry.gitRef} rebuilt but no snapshot to reload`,\n );\n } catch (err) {\n this.log(`freshness: rebuild errored for ${entry.repositoryId} — ${err instanceof Error ? err.message : String(err)}`);\n } finally {\n entry.building = false;\n if (entry.again) {\n entry.again = false;\n this.schedule(entry, 'source');\n }\n }\n }\n}\n\n/**\n * Read the current ref, defeating the module-level memo first: `detectGitRef`\n * caches per root for the life of the process, which is exactly wrong in a\n * daemon that outlives many checkouts.\n */\nfunction defaultDetectRef(root: string): string {\n clearDetectGitRefCache(root);\n return detectGitRef(root).ref;\n}\n\nfunction defaultWatch(dir: string, onChange: (filename: string) => void): { close(): void } | null {\n try {\n const w = fs.watch(dir, { recursive: true }, (_event, filename) => {\n if (filename) onChange(String(filename));\n });\n w.unref?.();\n return w;\n } catch {\n // A platform without recursive watch, or a root that vanished: freshness\n // degrades to \"whatever the next command publishes\", never to a crash.\n return null;\n }\n}\n\n/**\n * Rebuild in a detached child running the CLI's own `build`.\n *\n * `--no-daemon` matters: without it the child would attach and publish back\n * into the daemon that spawned it, which is both circular and racy — the\n * daemon reloads from disk itself once the child exits.\n */\nfunction spawnRebuild(root: string, timeoutMs: number): Promise<{ ok: boolean; error?: string }> {\n return new Promise((resolve) => {\n let child: ChildProcess;\n try {\n child = spawn(process.execPath, [process.argv[1] ?? '', 'build', '-C', root, '--json', '--no-daemon', '--no-warm'], {\n stdio: 'ignore',\n env: { ...process.env, NODE_OPTIONS: '' },\n });\n } catch (e) {\n resolve({ ok: false, error: e instanceof Error ? e.message : String(e) });\n return;\n }\n const timer = setTimeout(() => {\n try {\n child.kill();\n } catch {\n /* already gone */\n }\n resolve({ ok: false, error: `rebuild exceeded ${Math.round(timeoutMs / 1000)}s` });\n }, timeoutMs);\n timer.unref?.();\n child.on('error', (err) => {\n clearTimeout(timer);\n resolve({ ok: false, error: err.message });\n });\n child.on('exit', (code) => {\n clearTimeout(timer);\n resolve(code === 0 ? { ok: true } : { ok: false, error: `vg build exited ${code ?? 'null'}` });\n });\n });\n}\n","import { inventory, type DriftInventory } from '../../engine/drift.js';\nimport { manifestHash } from '../../lsp/scan-cache.js';\n\n/**\n * The repository's dependency context, computed once per daemon rather than\n * once per process, per call.\n *\n * Two things read the same manifests from the same tree and neither knew about\n * the other: `manifestHash(root)` (the language server's scan-cache key) walks\n * every manifest and hashes its bytes, and `inventory(root)` walks the same\n * tree and parses them. Measured on this repository: 12.6ms and 10.5ms, each\n * paid independently, in each process that wants them.\n *\n * Deliberately *not* on a timer. The daemon already watches these files —\n * `FreshnessSupervisor` classifies a manifest or lockfile write and rebuilds\n * for it — so the entry is dropped by the component that knows it moved. A\n * cache invalidated by an actual filesystem event has no staleness window to\n * argue about, which a TTL cannot say.\n *\n * Not everything under \"shared caching\" belongs here, and measurement decided\n * which: lockfile→version resolution is 0.10ms a call (there is nothing to\n * share), and the hosted-docs TTL cache is already a file under\n * `.vibgrate/cache/`, so it is already shared by every process on the machine.\n */\n\nexport interface DepContext {\n /** Digest of every manifest and lockfile in the tree — the LSP's scan key. */\n manifestHash: string;\n /** Declared/installed dependency records. */\n inventory: DriftInventory;\n /** When this was computed, for diagnostics. */\n builtAt: number;\n}\n\nexport interface DepCacheOptions {\n log?: (message: string) => void;\n now?: () => number;\n /** Injected (tests). */\n computeHash?: (root: string) => string;\n computeInventory?: (root: string) => DriftInventory;\n}\n\nexport class DepContextCache {\n private readonly entries = new Map<string, DepContext>();\n private readonly log: (message: string) => void;\n private readonly now: () => number;\n private readonly computeHash: (root: string) => string;\n private readonly computeInventory: (root: string) => DriftInventory;\n\n constructor(options: DepCacheOptions = {}) {\n this.log = options.log ?? ((): void => {});\n this.now = options.now ?? ((): number => Date.now());\n this.computeHash = options.computeHash ?? manifestHash;\n this.computeInventory = options.computeInventory ?? inventory;\n }\n\n /** Compute or reuse the context for a repository root. Never throws. */\n get(repositoryId: string, root: string): DepContext | null {\n const hit = this.entries.get(repositoryId);\n if (hit) return hit;\n const started = this.now();\n try {\n const context: DepContext = {\n manifestHash: this.computeHash(root),\n inventory: this.computeInventory(root),\n builtAt: this.now(),\n };\n this.entries.set(repositoryId, context);\n this.log(\n `deps: context for ${repositoryId} built in ${context.builtAt - started}ms — ${context.inventory.records.length} dependency(ies)`,\n );\n return context;\n } catch (err) {\n this.log(`deps: could not build context for ${repositoryId} — ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n }\n\n /**\n * Forget a repository's context. Called from the freshness watcher when a\n * manifest or lockfile is written, so the next reader recomputes.\n */\n invalidate(repositoryId: string): void {\n if (this.entries.delete(repositoryId)) this.log(`deps: context for ${repositoryId} invalidated by a manifest change`);\n }\n\n clear(): void {\n this.entries.clear();\n }\n\n size(): number {\n return this.entries.size;\n }\n}\n","import * as fs from 'node:fs';\nimport * as net from 'node:net';\nimport * as path from 'node:path';\nimport { VGD_PROTOCOL_VERSION, parseRequest, type VgdResponse } from './protocol.js';\nimport { VERSION } from '../../version.js';\nimport { WorkspaceRegistry } from './registry.js';\nimport { vgdPidPath, vgdSocketPath } from './paths.js';\nimport { queryGraph, queryGraphSemantic } from '../../engine/query.js';\nimport { loadGraph } from '../../engine/load.js';\nimport { impactOf } from '../../engine/impact.js';\nimport { resolveOne } from '../../engine/lookup.js';\nimport { getVgdHostBroker, type VgdHostBroker } from './host-broker.js';\nimport { EmbedBroker } from './embed-broker.js';\nimport { FreshnessSupervisor } from './freshness.js';\nimport { DepContextCache } from './dep-cache.js';\nimport type { VgGraph } from '../../schema.js';\n\nexport interface VgdServerOptions {\n /** Override socket path (tests). */\n socketPath?: string;\n /** Override PID path (tests). */\n pidPath?: string;\n registry?: WorkspaceRegistry;\n now?: () => Date;\n /** Process id recorded in status / pid file (tests). */\n pid?: number;\n /** Inject host broker (tests); default process-wide broker. */\n hostBroker?: VgdHostBroker;\n /** Inject the semantic broker (tests); default owns a worker child. */\n embedBroker?: EmbedBroker;\n /** Inject the freshness supervisor (tests); default watches every registered root. */\n freshness?: FreshnessSupervisor;\n /** Inject the shared dependency-context cache (tests). */\n depCache?: DepContextCache;\n /** Watch registered workspaces and rebuild on drift (default true). */\n watch?: boolean;\n /**\n * Diagnostic sink. `vg daemon start` points this at stdout so the daemon's\n * work — graph publishes, branch switches, index builds — is visible while\n * it happens instead of being inferred after the fact.\n */\n log?: (message: string) => void;\n /**\n * Invoked (shortly after the reply is written) when a client sends the\n * `shutdown` op. Only a standalone `vg daemon start` passes this — a\n * listener started without the hook refuses the op so another process\n * cannot take down the owning process.\n */\n onShutdownRequest?: () => void;\n}\n\nexport interface VgdServer {\n readonly socketPath: string;\n readonly registry: WorkspaceRegistry;\n /** Wall time when the server started listening. */\n readonly startedAt: number;\n close(): Promise<void>;\n}\n\n/**\n * Start a line-delimited JSON daemon on the local vgd socket.\n * Creates the daemon directory; removes a stale Unix socket file if present.\n */\nexport async function startVgdServer(options: VgdServerOptions = {}): Promise<VgdServer> {\n const socketPath = options.socketPath ?? vgdSocketPath();\n const pidPath = options.pidPath ?? vgdPidPath();\n const registry = options.registry ?? new WorkspaceRegistry();\n const hostBroker = options.hostBroker ?? getVgdHostBroker();\n const log = options.log ?? ((): void => {});\n // Semantic warm: the index is slot-scoped like the graph, so it attaches to\n // the registry's lifecycle rather than being managed alongside it by hand.\n const embedBroker = options.embedBroker ?? new EmbedBroker({ log });\n embedBroker.setGraphProvider((repositoryId, gitRef) => registry.graphs.get(repositoryId, gitRef)?.graph);\n // Freshness belongs where the graphs are. Reloading is the daemon's own\n // cheap disk read; the expensive rebuild happens in a child (see freshness.ts).\n const freshness =\n options.freshness ??\n new FreshnessSupervisor({\n log,\n reload: (repositoryId, root, gitRef) => {\n const graph = loadGraph(root);\n if (!graph) return Promise.resolve(null);\n registry.putGraph(repositoryId, gitRef, graph);\n return Promise.resolve(graph.nodes?.length ?? 0);\n },\n select: (repositoryId, gitRef) => registry.selectGitRef(repositoryId, gitRef),\n });\n const watchEnabled = options.watch !== false;\n // Shared dependency context: one manifest walk per daemon instead of one per\n // process, per call. Invalidated by the freshness watcher below, which is\n // already the component that notices a manifest write.\n const depCache = options.depCache ?? new DepContextCache({ log });\n freshness.setManifestListener((repositoryId) => depCache.invalidate(repositoryId));\n // The repo root lives in the registry, never on the graph (`meta.root` is\n // relative so snapshots stay portable) — the broker needs it to reuse the\n // on-disk vectors `vg embed` already wrote instead of re-deriving them.\n embedBroker.setRootProvider((repositoryId) => registry.getById(repositoryId)?.root);\n registry.setSlotListener(embedBroker);\n const onShutdownRequest = options.onShutdownRequest;\n const now = options.now ?? (() => new Date());\n const pid = options.pid ?? process.pid;\n const startedAt = Date.now();\n\n // Unix sockets need a free path; named pipes on Windows are cleaned by the OS.\n if (!socketPath.startsWith('\\\\\\\\.\\\\pipe')) {\n fs.mkdirSync(path.dirname(socketPath), { recursive: true });\n try {\n fs.unlinkSync(socketPath);\n } catch {\n /* nothing to remove */\n }\n } else {\n fs.mkdirSync(path.dirname(pidPath), { recursive: true });\n }\n\n /**\n * Sockets holding an open `watch-slots` subscription, with the repository\n * they care about (undefined = every repository). This is the one place the\n * daemon speaks unprompted: it exists so a long-lived client can retire its\n * own filesystem watcher instead of duplicating the daemon's.\n */\n const subscribers = new Map<net.Socket, { repositoryId?: string }>();\n\n const broadcastSlot = (repositoryId: string, gitRef: string, graph: VgGraph): void => {\n if (!subscribers.size) return;\n const frame =\n JSON.stringify({\n ok: true,\n event: 'slot-changed',\n repositoryId,\n gitRef,\n nodeCount: graph.nodes?.length ?? 0,\n corpusHash: graph.provenance?.corpusHash ?? null,\n }) + '\\n';\n for (const [socket, filter] of subscribers) {\n if (filter.repositoryId && filter.repositoryId !== repositoryId) continue;\n try {\n socket.write(frame);\n } catch {\n subscribers.delete(socket);\n }\n }\n };\n registry.setPublishListener(broadcastSlot);\n\n const server = net.createServer((socket) => {\n let buffer = '';\n socket.setEncoding('utf8');\n socket.on('close', () => subscribers.delete(socket));\n socket.on('error', () => subscribers.delete(socket));\n socket.on('data', (chunk: string) => {\n buffer += chunk;\n let nl: number;\n while ((nl = buffer.indexOf('\\n')) >= 0) {\n const line = buffer.slice(0, nl).trim();\n buffer = buffer.slice(nl + 1);\n if (!line) continue;\n void Promise.resolve(\n handleLine(line, {\n registry,\n hostBroker,\n embedBroker,\n freshness: watchEnabled ? freshness : undefined,\n depCache,\n subscribe: (repositoryId) => {\n subscribers.set(socket, { repositoryId });\n log(`watch-slots: subscriber attached${repositoryId ? ` for ${repositoryId}` : ' (all repositories)'}`);\n },\n now,\n pid,\n startedAt,\n socketPath,\n onShutdownRequest,\n log,\n }),\n ).then(\n (response) => {\n socket.write(JSON.stringify(response) + '\\n');\n },\n );\n }\n });\n });\n\n await new Promise<void>((resolve, reject) => {\n server.once('error', reject);\n server.listen(socketPath, () => {\n server.off('error', reject);\n resolve();\n });\n });\n\n try {\n fs.mkdirSync(path.dirname(pidPath), { recursive: true });\n fs.writeFileSync(pidPath, `${pid}\\n`, 'utf8');\n } catch {\n /* pid file is best-effort */\n }\n\n return {\n socketPath,\n registry,\n startedAt,\n async close() {\n // The worker is a child of this process — never leave it orphaned.\n embedBroker.stop();\n freshness.stopAll();\n depCache.clear();\n subscribers.clear();\n await new Promise<void>((resolve) => server.close(() => resolve()));\n try {\n fs.unlinkSync(pidPath);\n } catch {\n /* gone */\n }\n if (!socketPath.startsWith('\\\\\\\\.\\\\pipe')) {\n try {\n fs.unlinkSync(socketPath);\n } catch {\n /* gone */\n }\n }\n },\n };\n}\n\nasync function handleLine(\n line: string,\n ctx: {\n registry: WorkspaceRegistry;\n hostBroker: VgdHostBroker;\n embedBroker: EmbedBroker;\n freshness?: FreshnessSupervisor;\n depCache: DepContextCache;\n /** Hold this connection open as a slot subscriber. */\n subscribe?: (repositoryId?: string) => void;\n log: (message: string) => void;\n now: () => Date;\n pid: number;\n startedAt: number;\n socketPath: string;\n onShutdownRequest?: () => void;\n },\n): Promise<VgdResponse> {\n const req = parseRequest(line);\n if ('error' in req) return { ok: false, error: req.error, code: 'bad_request' };\n\n switch (req.op) {\n case 'ping':\n return { ok: true, pong: true, version: VGD_PROTOCOL_VERSION };\n case 'status':\n return {\n ok: true,\n pid: ctx.pid,\n uptimeMs: Date.now() - ctx.startedAt,\n workspaces: ctx.registry.size(),\n graphSlots: ctx.registry.graphs.size(),\n version: VGD_PROTOCOL_VERSION,\n socketPath: ctx.socketPath,\n cliVersion: VERSION,\n freshness: ctx.freshness?.list() ?? [],\n };\n case 'shutdown': {\n if (!ctx.onShutdownRequest) {\n return {\n ok: false,\n error:\n 'this vgd cannot be stopped remotely — it is running inside another process; stop that process instead',\n code: 'shutdown_unsupported',\n };\n }\n // Let the reply flush to the client before the listener goes away.\n const hook = ctx.onShutdownRequest;\n setTimeout(() => hook(), 150);\n return { ok: true, stopping: true };\n }\n case 'embed-status':\n return { ok: true, semantic: ctx.embedBroker.status() };\n case 'embed-query': {\n const vector = await ctx.embedBroker.embedQuery(req.text);\n if (!vector) {\n return {\n ok: false,\n error: 'semantic unavailable — rank lexically',\n code: 'semantic_unavailable',\n };\n }\n return { ok: true, vector, model: ctx.embedBroker.status().model };\n }\n case 'embed-index': {\n const gitRef = req.gitRef ?? ctx.registry.graphs.selectedRef(req.repositoryId);\n if (!gitRef) return { ok: false, error: 'no current gitRef for this repository', code: 'no_slot' };\n const slot = ctx.registry.graphs.get(req.repositoryId, gitRef);\n if (!slot) {\n return { ok: false, error: `no graph slot for ${req.repositoryId}@${gitRef} — publish the map first`, code: 'no_slot' };\n }\n if (req.wait === false) {\n void ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph, { waitForWriter: true });\n const kicked = ctx.embedBroker.slot(req.repositoryId, gitRef);\n return {\n ok: true,\n indexed: true,\n repositoryId: req.repositoryId,\n gitRef,\n state: kicked?.state ?? 'building',\n vectors: kicked?.vectors.size ?? 0,\n buildMs: kicked?.buildMs,\n };\n }\n const idx = await ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph, { waitForWriter: true });\n return {\n ok: true,\n indexed: true,\n repositoryId: req.repositoryId,\n gitRef,\n state: idx.state,\n vectors: idx.vectors.size,\n buildMs: idx.buildMs,\n };\n }\n case 'embed-rank': {\n const gitRef = req.gitRef ?? ctx.registry.graphs.selectedRef(req.repositoryId);\n if (!gitRef) return { ok: false, error: 'no current gitRef for this repository', code: 'no_slot' };\n const slot = ctx.registry.graphs.get(req.repositoryId, gitRef);\n if (!slot) {\n return { ok: false, error: `no graph slot for ${req.repositoryId}@${gitRef} — publish the map first`, code: 'no_slot' };\n }\n // Rank immediately when any vectors are resident (including a stale copy\n // kept across republish). If the slot is empty, kick a background build\n // and tell the caller it is warming — blocking here is what made\n // `vg ask` sit silent for tens of seconds.\n const existing = ctx.embedBroker.slot(req.repositoryId, gitRef);\n if (existing && existing.vectors.size > 0) {\n if (existing.state !== 'ready') {\n void ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph);\n }\n } else {\n void ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph, { waitForWriter: true });\n const warming = ctx.embedBroker.slot(req.repositoryId, gitRef);\n return {\n ok: false,\n error: 'semantic index is warming — retry shortly',\n code: 'semantic_warming',\n state: warming?.state ?? 'building',\n vectors: warming?.vectors.size ?? 0,\n pending: warming?.pending,\n nodeCount: warming?.nodeCount,\n };\n }\n const started = Date.now();\n const result = await ctx.embedBroker.rank(req.repositoryId, gitRef, req.text, req.limit);\n if (!result) {\n return { ok: false, error: 'semantic unavailable — rank lexically', code: 'semantic_unavailable' };\n }\n return {\n ok: true,\n ranked: result.ranked,\n repositoryId: req.repositoryId,\n gitRef,\n state: result.state,\n vectors: result.vectors,\n model: ctx.embedBroker.status().model,\n rankMs: Date.now() - started,\n };\n }\n case 'watch-slots': {\n if (!ctx.subscribe) {\n return { ok: false, error: 'this listener does not support subscriptions', code: 'unsupported' };\n }\n ctx.subscribe(req.repositoryId);\n return { ok: true, watching: true, repositoryId: req.repositoryId };\n }\n case 'dep-context': {\n const record = ctx.registry.getById(req.repositoryId);\n if (!record) {\n return { ok: false, error: `unknown repository ${req.repositoryId} — register it first`, code: 'not_found' };\n }\n const context = ctx.depCache.get(req.repositoryId, record.root);\n if (!context) {\n return { ok: false, error: 'could not read this repository’s manifests', code: 'no_deps' };\n }\n return {\n ok: true,\n repositoryId: req.repositoryId,\n manifestHash: context.manifestHash,\n dependencies: context.inventory.records.map((r) => ({\n name: r.name,\n ecosystem: r.ecosystem,\n declared: r.declared,\n installed: r.installed,\n })),\n builtAt: context.builtAt,\n };\n }\n case 'host-status':\n return { ok: true, host: ctx.hostBroker.status() };\n case 'host-load': {\n const r = await ctx.hostBroker.load(req.modelPath);\n if (!r.ok) return { ok: false, error: r.error, code: 'host_error' };\n return { ok: true, hostLoaded: true, modelPath: r.modelPath };\n }\n case 'host-unload': {\n const r = await ctx.hostBroker.unload(req.modelPath);\n return { ok: true, hostUnloaded: true, cleared: r.cleared };\n }\n case 'host-generate': {\n const r = await ctx.hostBroker.generate(\n req.modelPath,\n req.messages.map((m) => ({\n role: (m.role === 'system' || m.role === 'assistant' ? m.role : 'user') as 'system' | 'user' | 'assistant',\n content: m.content,\n })),\n {\n grammar: req.grammar,\n requireGrammar: req.requireGrammar,\n maxTokens: req.maxTokens,\n temperature: req.temperature,\n },\n );\n if (!r.ok) return { ok: false, error: r.error, code: 'host_error' };\n return {\n ok: true,\n hostGenerated: true,\n text: r.result.text,\n model: r.result.model,\n constrained: r.result.constrained,\n grammarApplied: r.result.grammarApplied,\n draftAcceptedChars: r.result.draftAcceptedChars,\n latencyMs: r.result.latencyMs,\n unknownIdentifiers: r.result.unknownIdentifiers,\n };\n }\n case 'list':\n return { ok: true, workspaces: ctx.registry.list() };\n case 'register': {\n const known = ctx.registry.size();\n const workspace = ctx.registry.register(req.root, ctx.now, { label: req.label, role: req.role });\n // A repo the daemon has not seen before is the interesting case — that is\n // when a warm daemon still has cold work to do.\n if (ctx.registry.size() > known) {\n ctx.log(`register: new workspace ${workspace.id} (${workspace.root}${workspace.gitRef ? ` @${workspace.gitRef}` : ''})`);\n }\n return { ok: true, workspace };\n }\n case 'unregister': {\n const record = ctx.registry.get(req.root);\n if (record) ctx.freshness?.stop(record.id);\n return { ok: true, removed: ctx.registry.unregister(req.root) };\n }\n case 'register-federation': {\n const workspaces = ctx.registry.registerFederation(req.members, ctx.now);\n return { ok: true, workspaces, federation: true };\n }\n case 'list-graph-slots': {\n ctx.registry.graphs.evictIdle();\n return { ok: true, slots: ctx.registry.graphs.list(req.repositoryId) };\n }\n case 'select-git-ref': {\n const before = ctx.registry.graphs.selectedRef(req.repositoryId);\n if (before !== req.gitRef) {\n ctx.log(`select-git-ref: ${req.repositoryId} ${before ?? '(none)'} → ${req.gitRef}`);\n }\n ctx.registry.selectGitRef(req.repositoryId, req.gitRef);\n return { ok: true, selected: true, repositoryId: req.repositoryId, gitRef: req.gitRef };\n }\n case 'put-graph': {\n try {\n // The wire line was already JSON.parse'd by parseRequest — re-encoding a\n // large repo's graph (`parseGraph(JSON.stringify(...))`) blocked the\n // daemon's event loop for seconds, timing out every concurrent client.\n const graph = req.graph as VgGraph;\n ctx.log(`put-graph: ${req.repositoryId}@${req.gitRef} · ${graph.nodes?.length ?? 0} nodes`);\n ctx.registry.putGraph(req.repositoryId, req.gitRef, graph);\n startWatching(ctx, req.repositoryId, req.gitRef);\n return {\n ok: true,\n stored: true,\n repositoryId: req.repositoryId,\n gitRef: req.gitRef,\n nodeCount: graph.nodes?.length ?? 0,\n };\n } catch (e) {\n return { ok: false, error: e instanceof Error ? e.message : 'invalid graph', code: 'bad_graph' };\n }\n }\n case 'load-graph': {\n // Load from disk inside the daemon: the snapshot-first loader decodes\n // the binary sidecar (msgpack) when fresh — no multi-MB JSON line ever\n // crosses the socket, which is what made put-graph publishes slow on\n // large repos.\n const record = ctx.registry.register(req.root, ctx.now, { gitRef: req.gitRef });\n const gitRef = req.gitRef ?? record.gitRef ?? 'HEAD';\n ctx.log(`load-graph: ${record.id}@${gitRef} from ${req.root}`);\n const graph = loadGraph(req.root, req.graphPath);\n if (!graph) {\n return {\n ok: false,\n error: `no code map found for ${req.root} — run \\`vg build\\` (or bare \\`vg\\`) first`,\n code: 'no_map',\n };\n }\n ctx.registry.putGraph(record.id, gitRef, graph);\n startWatching(ctx, record.id, gitRef);\n return {\n ok: true,\n stored: true,\n repositoryId: record.id,\n gitRef,\n nodeCount: graph.nodes?.length ?? 0,\n };\n }\n case 'query-graph': {\n const resolved = ctx.registry.resolveGraph(req.repositoryId, req.gitRef);\n if (!resolved) {\n return { ok: false, error: 'no ActiveGraph loaded for repository — put-graph first', code: 'no_graph' };\n }\n const limit = req.limit ?? 12;\n let mode = 'lexical';\n let result = queryGraph(resolved.graph, req.query, { limit, budget: 2000 });\n if (req.semantic) {\n // Rank and fuse here: the caller asked for semantic precisely because\n // it holds neither the graph nor the embedder. A slot whose index is\n // not ready answers lexically rather than making the caller wait.\n const ranking = await ctx.embedBroker.rank(req.repositoryId, resolved.gitRef, req.query);\n if (ranking && ranking.ranked.length) {\n result = await queryGraphSemantic(resolved.graph, req.query, {\n limit,\n budget: 2000,\n semanticRanked: ranking.ranked,\n });\n mode = `semantic (vgd${ctx.embedBroker.status().model ? `, ${ctx.embedBroker.status().model}` : ''})`;\n }\n }\n return {\n ok: true,\n query: req.query,\n repositoryId: req.repositoryId,\n gitRef: resolved.gitRef,\n mode,\n matches: result.matches.slice(0, limit).map((m) => ({\n id: m.node.id,\n qualifiedName: m.node.qualifiedName,\n kind: m.node.kind,\n file: m.node.file,\n line: m.node.span?.start ?? 0,\n score: m.score,\n why: m.why,\n })),\n tokensEstimate: result.tokensEstimate,\n };\n }\n case 'impact-of': {\n const resolved = ctx.registry.resolveGraph(req.repositoryId, req.gitRef);\n if (!resolved) {\n return { ok: false, error: 'no ActiveGraph loaded for repository — put-graph first', code: 'no_graph' };\n }\n const node = resolveSymbol(resolved.graph, req.symbol);\n if (!node) {\n return { ok: false, error: `symbol not found: ${req.symbol}`, code: 'not_found' };\n }\n const impact = impactOf(resolved.graph, node.id, { depth: req.depth ?? 4 });\n return {\n ok: true,\n repositoryId: req.repositoryId,\n gitRef: resolved.gitRef,\n symbol: req.symbol,\n root: impact.root,\n depth: impact.depth,\n affected: impact.affected.slice(0, 40).map((a) => ({\n id: a.id,\n name: a.name,\n kind: a.kind,\n file: a.file,\n line: a.line,\n depth: a.depth,\n confidence: a.confidence,\n })),\n direct: impact.direct,\n transitive: impact.transitive,\n };\n }\n case 'graph-summary': {\n const resolved = ctx.registry.resolveGraph(req.repositoryId, req.gitRef);\n if (!resolved) {\n return { ok: false, error: 'no ActiveGraph loaded for repository — put-graph first', code: 'no_graph' };\n }\n const g = resolved.graph;\n return {\n ok: true,\n repositoryId: req.repositoryId,\n gitRef: resolved.gitRef,\n summary: {\n nodeCount: g.nodes?.length ?? 0,\n edgeCount: g.edges?.length ?? 0,\n languages: g.meta?.languages ?? [],\n corpusHash: g.provenance?.corpusHash ?? null,\n root: g.meta?.root ?? null,\n },\n };\n }\n }\n}\n\n/**\n * Begin watching a repository the moment the daemon actually holds its map.\n * Registration alone is not enough: a root with no slot has nothing to keep\n * fresh, and the VS Code extension registers roots it never publishes.\n */\nfunction startWatching(\n ctx: { registry: WorkspaceRegistry; freshness?: FreshnessSupervisor },\n repositoryId: string,\n gitRef: string,\n): void {\n const record = ctx.registry.getById(repositoryId);\n if (record) ctx.freshness?.start(repositoryId, record.root, gitRef);\n}\n\nfunction resolveSymbol(graph: VgGraph, symbol: string): { id: string } | null {\n // Prefer exact id, then qualified-name / short-name lookup.\n if (graph.nodes.some((n) => n.id === symbol)) return { id: symbol };\n const hit = resolveOne(graph, symbol);\n if (hit.node?.id) return { id: hit.node.id };\n if (hit.candidates.length === 1 && hit.candidates[0]?.id) return { id: hit.candidates[0].id };\n const q = symbol.toLowerCase();\n const byQn = graph.nodes.find((n) => n.qualifiedName?.toLowerCase() === q || n.name?.toLowerCase() === q);\n return byQn ? { id: byQn.id } : null;\n}\n","/**\n * Branch-aware graph loading for a single repository worktree (Fusion §4.1.1).\n *\n * Combines {@link detectGitRef}, disk load via {@link loadGraph}, and an\n * {@link ActiveGraphCache} so checkout A → B → A reuses a warm in-memory map\n * when the branch is still resident (LILO idle eviction applies).\n */\n\nimport { loadGraph } from '../engine/load.js';\nimport { repositoryIdFromRoot } from './paths.js';\nimport { detectGitRef, type GitRunner } from './git-ref.js';\nimport { ActiveGraphCache } from './active-graph-cache.js';\nimport type { VgGraph } from '../schema.js';\n\nexport interface BranchGraphLoadResult {\n graph: VgGraph | null;\n gitRef: string;\n kind: 'branch' | 'detached' | 'none';\n /** True when the selected ActiveGraph slot changed since the previous ensure. */\n switched: boolean;\n /** True when the graph was served from the in-memory cache. */\n fromCache: boolean;\n repositoryId: string;\n}\n\nexport interface BranchGraphSessionOptions {\n root: string;\n cache?: ActiveGraphCache;\n /** Optional explicit graph path (CLI `--graph`); bypasses branch keying for disk. */\n graphPath?: string;\n detectGit?: typeof detectGitRef;\n load?: typeof loadGraph;\n gitRun?: GitRunner;\n}\n\n/**\n * Stateful helper: call {@link ensureCurrent} at session start and before each\n * agent turn so a mid-session `git checkout` picks up the correct map.\n */\nexport class BranchGraphSession {\n readonly root: string;\n readonly repositoryId: string;\n readonly cache: ActiveGraphCache;\n private readonly graphPath?: string;\n private readonly detectGit: typeof detectGitRef;\n private readonly load: typeof loadGraph;\n private readonly gitRun?: GitRunner;\n private lastRef = '';\n\n constructor(options: BranchGraphSessionOptions) {\n this.root = options.root;\n this.repositoryId = repositoryIdFromRoot(options.root);\n this.cache = options.cache ?? new ActiveGraphCache();\n this.graphPath = options.graphPath;\n this.detectGit = options.detectGit ?? detectGitRef;\n this.load = options.load ?? loadGraph;\n this.gitRun = options.gitRun;\n }\n\n /**\n * Resolve HEAD, activate the matching cache slot (or load from disk), and\n * run idle eviction. Returns null graph when no map exists for this ref.\n */\n ensureCurrent(): BranchGraphLoadResult {\n this.cache.evictIdle();\n const info = this.gitRun ? this.detectGit(this.root, this.gitRun) : this.detectGit(this.root);\n const gitRef = info.ref || 'unknown';\n const switched = this.lastRef !== '' && this.lastRef !== gitRef;\n this.lastRef = gitRef;\n\n // Explicit --graph path: still track ref for cache identity but load that file.\n if (this.graphPath) {\n const graph = this.load(this.root, this.graphPath);\n if (graph) {\n this.cache.put(this.repositoryId, gitRef, graph);\n this.cache.select(this.repositoryId, gitRef);\n }\n return {\n graph,\n gitRef,\n kind: info.kind,\n switched,\n fromCache: false,\n repositoryId: this.repositoryId,\n };\n }\n\n const warm = this.cache.get(this.repositoryId, gitRef);\n if (warm) {\n this.cache.select(this.repositoryId, gitRef);\n return {\n graph: warm.graph,\n gitRef,\n kind: info.kind,\n switched,\n fromCache: true,\n repositoryId: this.repositoryId,\n };\n }\n\n const graph = this.load(this.root);\n if (graph) {\n this.cache.put(this.repositoryId, gitRef, graph);\n this.cache.select(this.repositoryId, gitRef);\n }\n return {\n graph,\n gitRef,\n kind: info.kind,\n switched,\n fromCache: false,\n repositoryId: this.repositoryId,\n };\n }\n\n /** Diagnostics for daemon status / tests. */\n listSlots() {\n return this.cache.list(this.repositoryId);\n }\n}\n"]}
|
package/dist/client-UQIELEEZ.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { defaultVgdTimeoutMs, vgdIsRunning, vgdRequest } from './chunk-E53WBVUQ.js';
|
|
2
|
-
import './chunk-NDNNOAS6.js';
|
|
3
|
-
import './chunk-BWPBB45M.js';
|
|
4
|
-
import './chunk-JFGYT6BI.js';
|
|
5
|
-
import './chunk-BPF3YX2U.js';
|
|
6
|
-
import './chunk-Z6ZWNWWR.js';
|
|
7
|
-
//# sourceMappingURL=client-UQIELEEZ.js.map
|
|
8
|
-
//# sourceMappingURL=client-UQIELEEZ.js.map
|
package/dist/daemon-GUMWMKCA.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export { compareDaemonVersion, ensureVgd, ensureVgdSoft, registerDaemon, restartVgdIfRunning, stopVgd, vgdCliVersion, vgdVersionSkew } from './chunk-E3O5UKNA.js';
|
|
2
|
-
import './chunk-YENM3HT7.js';
|
|
3
|
-
import './chunk-CT5BS56U.js';
|
|
4
|
-
import './chunk-VQ5KMHW6.js';
|
|
5
|
-
import './chunk-3LOWJSAF.js';
|
|
6
|
-
import './chunk-5HYCB55P.js';
|
|
7
|
-
import './chunk-IS7VTH2Q.js';
|
|
8
|
-
import './chunk-IZDH67DX.js';
|
|
9
|
-
import './chunk-MS6V5XKB.js';
|
|
10
|
-
import './chunk-EZ7UC5Y5.js';
|
|
11
|
-
import './chunk-DBX3DL27.js';
|
|
12
|
-
import './chunk-POOL355F.js';
|
|
13
|
-
import './chunk-6BEBJCK4.js';
|
|
14
|
-
import './chunk-J7LKEB2R.js';
|
|
15
|
-
import './chunk-MRZHNUN7.js';
|
|
16
|
-
import './chunk-KU7FI5EV.js';
|
|
17
|
-
import './chunk-E53WBVUQ.js';
|
|
18
|
-
import './chunk-NDNNOAS6.js';
|
|
19
|
-
import './chunk-5I4VSBWQ.js';
|
|
20
|
-
import './chunk-6WRG7VDO.js';
|
|
21
|
-
import './chunk-2C33WR5O.js';
|
|
22
|
-
import './chunk-VMAIDM4K.js';
|
|
23
|
-
import './chunk-MVPRPSXU.js';
|
|
24
|
-
import './chunk-O3LABX6I.js';
|
|
25
|
-
import './chunk-4NTNMT6T.js';
|
|
26
|
-
import './chunk-BWPBB45M.js';
|
|
27
|
-
import './chunk-JFGYT6BI.js';
|
|
28
|
-
import './chunk-BPF3YX2U.js';
|
|
29
|
-
import './chunk-Z6ZWNWWR.js';
|
|
30
|
-
//# sourceMappingURL=daemon-GUMWMKCA.js.map
|
|
31
|
-
//# sourceMappingURL=daemon-GUMWMKCA.js.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export { ensureCodeMap } from './chunk-L2OS4WHT.js';
|
|
2
|
-
import './chunk-HF6R73UC.js';
|
|
3
|
-
import './chunk-YENM3HT7.js';
|
|
4
|
-
import './chunk-H5Q4JUY4.js';
|
|
5
|
-
import './chunk-CT5BS56U.js';
|
|
6
|
-
import './chunk-6PFHDHOL.js';
|
|
7
|
-
import './chunk-NKLYDSB7.js';
|
|
8
|
-
import './chunk-HTLDXEHW.js';
|
|
9
|
-
import './chunk-V2UGRUTL.js';
|
|
10
|
-
import './chunk-VIWZ4QT7.js';
|
|
11
|
-
import './chunk-RHKOUPWT.js';
|
|
12
|
-
import './chunk-CQDUBAQY.js';
|
|
13
|
-
import './chunk-OV4KGXPD.js';
|
|
14
|
-
import './chunk-MS6V5XKB.js';
|
|
15
|
-
import './chunk-NJQZRM55.js';
|
|
16
|
-
import './chunk-NG4KIJW6.js';
|
|
17
|
-
import './chunk-CRAMOEBE.js';
|
|
18
|
-
import './chunk-EZ7UC5Y5.js';
|
|
19
|
-
import './chunk-LJSJX6U4.js';
|
|
20
|
-
import './chunk-POOL355F.js';
|
|
21
|
-
import './chunk-6BEBJCK4.js';
|
|
22
|
-
import './chunk-J7LKEB2R.js';
|
|
23
|
-
import './chunk-MRZHNUN7.js';
|
|
24
|
-
import './chunk-KU7FI5EV.js';
|
|
25
|
-
import './chunk-E53WBVUQ.js';
|
|
26
|
-
import './chunk-NDNNOAS6.js';
|
|
27
|
-
import './chunk-5I4VSBWQ.js';
|
|
28
|
-
import './chunk-PRHH4DVO.js';
|
|
29
|
-
import './chunk-T7RSQ5WD.js';
|
|
30
|
-
import './chunk-6WRG7VDO.js';
|
|
31
|
-
import './chunk-2C33WR5O.js';
|
|
32
|
-
import './chunk-VMAIDM4K.js';
|
|
33
|
-
import './chunk-MVPRPSXU.js';
|
|
34
|
-
import './chunk-O3LABX6I.js';
|
|
35
|
-
import './chunk-4NTNMT6T.js';
|
|
36
|
-
import './chunk-BWPBB45M.js';
|
|
37
|
-
import './chunk-JFGYT6BI.js';
|
|
38
|
-
import './chunk-BPF3YX2U.js';
|
|
39
|
-
import './chunk-Z6ZWNWWR.js';
|
|
40
|
-
//# sourceMappingURL=ensure-map-FHDJTO7Y.js.map
|
|
41
|
-
//# sourceMappingURL=ensure-map-FHDJTO7Y.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { FEDERATION_SCHEMA_VERSION, federationFromWorkspaceRoots, federationPath, highConfidenceBridges, loadFederation, loadOrDiscoverFederation, parseFederationFile, singleMemberFederation, writeFederationFile } from './chunk-5I4VSBWQ.js';
|
|
2
|
-
import './chunk-BWPBB45M.js';
|
|
3
|
-
import './chunk-JFGYT6BI.js';
|
|
4
|
-
import './chunk-BPF3YX2U.js';
|
|
5
|
-
import './chunk-Z6ZWNWWR.js';
|
|
6
|
-
//# sourceMappingURL=federation-MDQPO3PW.js.map
|
|
7
|
-
//# sourceMappingURL=federation-MDQPO3PW.js.map
|