@remnic/core 9.65.8 → 9.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.d.ts +11 -12
- package/dist/access-admin-ops-surface.js +49 -46
- package/dist/access-authorization-probe.d.ts +11 -12
- package/dist/access-authorization-probe.js +50 -47
- package/dist/access-boundary.d.ts +11 -12
- package/dist/access-boundary.js +49 -46
- package/dist/access-citation-namespace.js +3 -3
- package/dist/access-cli.js +111 -106
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +1 -2
- package/dist/access-coding-context-resolution.js +2 -2
- package/dist/access-extraction-force-flush.d.ts +11 -12
- package/dist/access-extraction-force-flush.js +49 -46
- package/dist/access-health-types.d.ts +1 -2
- package/dist/access-http-lcm-compaction.d.ts +11 -12
- package/dist/access-http-lifecycle-flush.d.ts +11 -12
- package/dist/access-http-offline-stream.d.ts +11 -12
- package/dist/access-http-query.d.ts +2 -3
- package/dist/access-http-query.js +51 -48
- package/dist/access-http.d.ts +12 -13
- package/dist/access-http.js +68 -65
- package/dist/access-identity-continuity-surface.d.ts +9 -10
- package/dist/access-identity-continuity-surface.js +49 -46
- package/dist/access-lcm-surface.d.ts +11 -12
- package/dist/access-lcm-surface.js +49 -46
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp.d.ts +11 -12
- package/dist/access-mcp.js +62 -59
- package/dist/access-memory-search-fanout.d.ts +2 -3
- package/dist/{access-namespace-preflight-CpAOrS-9.d.ts → access-namespace-preflight-CLWUoMyW.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -4
- package/dist/access-namespace-preflight.js +49 -46
- package/dist/access-observe-write-surface.d.ts +11 -12
- package/dist/access-observe-write-surface.js +49 -46
- package/dist/access-offline-manifest.d.ts +9 -10
- package/dist/access-offline-manifest.js +15 -15
- package/dist/access-operations-batch.js +54 -51
- package/dist/access-operations.d.ts +17 -18
- package/dist/access-operations.js +59 -56
- package/dist/access-recall-concurrency.d.ts +11 -12
- package/dist/access-recall-concurrency.js +49 -46
- package/dist/access-recall-response.d.ts +11 -12
- package/dist/access-recall-response.js +49 -46
- package/dist/access-recall-surface.d.ts +11 -12
- package/dist/access-recall-surface.js +49 -46
- package/dist/access-schema.d.ts +83 -83
- package/dist/access-schema.js +7 -7
- package/dist/{access-service-Diu61Cfv.d.ts → access-service-CEUE1Isj.d.ts} +66 -66
- package/dist/access-service-helpers.d.ts +11 -12
- package/dist/access-service.d.ts +11 -12
- package/dist/access-service.js +49 -46
- package/dist/access-surface-catalog.d.ts +11 -12
- package/dist/access-surface-catalog.js +53 -48
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +3 -4
- package/dist/action-confidence.d.ts +1 -2
- package/dist/active-memory-bridge.d.ts +1 -2
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.d.ts +1 -2
- package/dist/active-recall.js +11 -11
- package/dist/ambient-provenance.d.ts +1 -2
- package/dist/artifact-search.d.ts +1 -2
- package/dist/{auto-sync-2YPITIWN.js → auto-sync-Q6Q2FVSC.js} +9 -9
- package/dist/behavior-learner.d.ts +1 -2
- package/dist/behavior-signals.d.ts +1 -2
- package/dist/bootstrap.d.ts +9 -10
- package/dist/briefing-window.d.ts +2 -3
- package/dist/briefing.d.ts +2 -3
- package/dist/briefing.js +23 -23
- package/dist/buffer-surprise-report.d.ts +1 -2
- package/dist/buffer-turn-helpers.d.ts +1 -2
- package/dist/buffer.d.ts +2 -3
- package/dist/buffer.js +20 -4
- package/dist/bulk-import/index.d.ts +3 -4
- package/dist/calibration.d.ts +1 -2
- package/dist/calibration.js +1 -1
- package/dist/capabilities.d.ts +1 -2
- package/dist/{capsule-merge-SGIVB3WA.js → capsule-merge-SEHERWWP.js} +4 -4
- package/dist/{catalog-9f-vEQLS.d.ts → catalog-D1HgugTA.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -2
- package/dist/causal-consolidation.d.ts +1 -2
- package/dist/causal-consolidation.js +24 -24
- package/dist/causal-trajectory-graph.d.ts +1 -2
- package/dist/{chunk-LEPOP46W.js → chunk-227UFSEQ.js} +4 -4
- package/dist/{chunk-NPFUNWNX.js → chunk-23CVL7HS.js} +2 -2
- package/dist/{chunk-PO7NXBG2.js → chunk-2GF27PGH.js} +5 -5
- package/dist/{chunk-MY2BC6UE.js → chunk-2LBAFHOQ.js} +11 -11
- package/dist/{chunk-AZMLH5UT.js → chunk-33MFRY25.js} +2 -2
- package/dist/{chunk-UEBDCMOO.js → chunk-3TSU662L.js} +3 -3
- package/dist/{chunk-CAMNRAJF.js → chunk-4FHRZD5T.js} +2 -2
- package/dist/{chunk-FP7YTTVO.js → chunk-4OFKZAJG.js} +2 -1
- package/dist/chunk-4OFKZAJG.js.map +1 -0
- package/dist/{chunk-S5XOSTYM.js → chunk-4STAANV7.js} +3 -3
- package/dist/{chunk-LKYIOCWL.js → chunk-56IV4J5W.js} +546 -96
- package/dist/chunk-56IV4J5W.js.map +1 -0
- package/dist/{chunk-4F4AQFWL.js → chunk-6CEGSTBD.js} +10 -10
- package/dist/{chunk-JYSN42VN.js → chunk-6QDXA26G.js} +235 -181
- package/dist/chunk-6QDXA26G.js.map +1 -0
- package/dist/{chunk-MDD2RINF.js → chunk-6RUHELWR.js} +3 -3
- package/dist/{chunk-WNXYT4MK.js → chunk-72OIT7KS.js} +4 -4
- package/dist/{chunk-KQAFEZQX.js → chunk-7LCGFUMB.js} +4 -4
- package/dist/{chunk-SNOIKAHM.js → chunk-7UTDHQZ5.js} +3 -3
- package/dist/{chunk-5HK3CJAR.js → chunk-7XOG75AU.js} +3 -3
- package/dist/{chunk-7BDZTALN.js → chunk-AJTG3CP7.js} +12 -2
- package/dist/chunk-AJTG3CP7.js.map +1 -0
- package/dist/{chunk-2LWQSV6A.js → chunk-AL3UYZ5N.js} +3 -2
- package/dist/chunk-AL3UYZ5N.js.map +1 -0
- package/dist/{chunk-UPFNQJC7.js → chunk-CN4VKV3S.js} +2 -2
- package/dist/{chunk-PMVPCZJZ.js → chunk-CTCGHNWN.js} +6 -6
- package/dist/{chunk-EGBDFJ36.js → chunk-DD5JFCWM.js} +2 -2
- package/dist/{chunk-XBGHAAKR.js → chunk-DDX6KIXF.js} +2 -2
- package/dist/{chunk-JIYDRBVZ.js → chunk-DJORULH3.js} +2 -2
- package/dist/{chunk-UENKPWCS.js → chunk-DMEHOEC7.js} +6 -6
- package/dist/{chunk-7KQB4EBS.js → chunk-DUAJKRR2.js} +2 -2
- package/dist/{chunk-XDL5CYZN.js → chunk-EEOUMG3J.js} +2 -1
- package/dist/{chunk-XDL5CYZN.js.map → chunk-EEOUMG3J.js.map} +1 -1
- package/dist/{chunk-SEEJOGQX.js → chunk-EFQCDJZ2.js} +4 -4
- package/dist/{chunk-Q57GOHLF.js → chunk-EGALNSZ4.js} +3 -3
- package/dist/{chunk-KCT36JAW.js → chunk-ESNFSSO4.js} +2 -2
- package/dist/{chunk-XQ3HXAQH.js → chunk-ET2CNMLD.js} +4 -4
- package/dist/{chunk-PU56CXZA.js → chunk-EZSCW4EM.js} +2 -2
- package/dist/{chunk-HMZKGHMD.js → chunk-FESUGFIL.js} +3 -3
- package/dist/{chunk-3A2NJP2U.js → chunk-FKKGCGYL.js} +3 -3
- package/dist/{chunk-BWGCOLEL.js → chunk-FTTJRVB7.js} +2 -2
- package/dist/{chunk-ODU2CNNX.js → chunk-FYWLSFFS.js} +2 -2
- package/dist/{chunk-W2BAGGEW.js → chunk-GEJKYA7D.js} +33 -24
- package/dist/{chunk-W2BAGGEW.js.map → chunk-GEJKYA7D.js.map} +1 -1
- package/dist/chunk-GSKINLAK.js +267 -0
- package/dist/chunk-GSKINLAK.js.map +1 -0
- package/dist/{chunk-3PKAS6VL.js → chunk-GX6FTSYH.js} +2 -2
- package/dist/{chunk-76DIF5KT.js → chunk-H7VDIF2V.js} +2 -2
- package/dist/{chunk-F7XUD3PL.js → chunk-HJXA6ZM7.js} +2 -2
- package/dist/{chunk-4QEYREAV.js → chunk-HNPE66LB.js} +2 -2
- package/dist/{chunk-P36Z4JRA.js → chunk-I5VB44ZK.js} +2 -2
- package/dist/{chunk-EUYWQ7TS.js → chunk-IEZ6CGTW.js} +2 -2
- package/dist/{chunk-OXRRJXPR.js → chunk-IHGMRDEE.js} +275 -1678
- package/dist/chunk-IHGMRDEE.js.map +1 -0
- package/dist/{chunk-5DHKCO52.js → chunk-IVIAHQBR.js} +2 -2
- package/dist/{chunk-TFR3HG4K.js → chunk-J3OND5QT.js} +4 -4
- package/dist/{chunk-UW5NPZJ2.js → chunk-JALOAKSZ.js} +59 -7
- package/dist/chunk-JALOAKSZ.js.map +1 -0
- package/dist/{chunk-5ACCD4L7.js → chunk-JRRQ747T.js} +7 -7
- package/dist/{chunk-V4IDF3EZ.js → chunk-JTWZKNUH.js} +5 -5
- package/dist/chunk-K66OY4EI.js +202 -0
- package/dist/chunk-K66OY4EI.js.map +1 -0
- package/dist/{chunk-XAB6STPO.js → chunk-KODXCHXJ.js} +17 -3
- package/dist/chunk-KODXCHXJ.js.map +1 -0
- package/dist/{chunk-KZIF6XHX.js → chunk-KXIXO76C.js} +28 -15
- package/dist/chunk-KXIXO76C.js.map +1 -0
- package/dist/{chunk-5RWZH6PH.js → chunk-L4X4PJYK.js} +2 -2
- package/dist/{chunk-UTQUEHC7.js → chunk-LUDBXTBJ.js} +8 -8
- package/dist/{chunk-XNWXSGHS.js → chunk-MAH64N55.js} +28 -10
- package/dist/chunk-MAH64N55.js.map +1 -0
- package/dist/{chunk-LDKPDODJ.js → chunk-ME35HVDJ.js} +2 -2
- package/dist/{chunk-DPCXDG7G.js → chunk-MJRGVXPQ.js} +2 -2
- package/dist/{chunk-773TRRGT.js → chunk-MJUCDM3C.js} +2 -2
- package/dist/{chunk-T6ILXUAH.js → chunk-MN5NOOI7.js} +2 -2
- package/dist/{chunk-AHPIFKNG.js → chunk-N4F7ZSSG.js} +2 -2
- package/dist/{chunk-JOZUBF4A.js → chunk-NACLNNFQ.js} +2 -2
- package/dist/{chunk-LC2BDILZ.js → chunk-NBP4EX5N.js} +2 -2
- package/dist/{chunk-ZVPVTPGI.js → chunk-NNZFPYYX.js} +4 -4
- package/dist/{chunk-DA7ITC5Z.js → chunk-O57GM3FR.js} +2 -2
- package/dist/{chunk-7VZFRUQU.js → chunk-O7ERGZDA.js} +5 -5
- package/dist/{chunk-3SZD4CYO.js → chunk-OAJMQKQR.js} +3 -3
- package/dist/{chunk-HSZMX3ZJ.js → chunk-ODW5GDFE.js} +2 -2
- package/dist/{chunk-7WOWGRAU.js → chunk-PEBH5DCK.js} +10 -7
- package/dist/{chunk-7WOWGRAU.js.map → chunk-PEBH5DCK.js.map} +1 -1
- package/dist/{chunk-J2WC5LF4.js → chunk-QBC33MPY.js} +2 -1
- package/dist/{chunk-T7XP6IZE.js → chunk-QCRJMU5V.js} +2 -2
- package/dist/chunk-QJCWK2A7.js +1466 -0
- package/dist/chunk-QJCWK2A7.js.map +1 -0
- package/dist/{chunk-YEUXERJ6.js → chunk-RDGKVH6T.js} +7 -3
- package/dist/{chunk-YEUXERJ6.js.map → chunk-RDGKVH6T.js.map} +1 -1
- package/dist/{chunk-OA2O2GJ4.js → chunk-RZ3IZIJG.js} +3 -3
- package/dist/{chunk-UL4MKZHI.js → chunk-SN4JXNLL.js} +2 -2
- package/dist/chunk-TB2MJRI6.js +866 -0
- package/dist/chunk-TB2MJRI6.js.map +1 -0
- package/dist/{chunk-7PHI6GUI.js → chunk-TEZ2HTC7.js} +42 -2
- package/dist/chunk-TEZ2HTC7.js.map +1 -0
- package/dist/{chunk-CPA5NBHN.js → chunk-TNGH4ZYI.js} +2 -2
- package/dist/{chunk-F3NVYTTA.js → chunk-TNXNECAN.js} +6 -6
- package/dist/{chunk-BEC4YBNA.js → chunk-TVW4C7PV.js} +2 -2
- package/dist/{chunk-UFKPQBXH.js → chunk-U62OK7BB.js} +2 -2
- package/dist/{chunk-AX7UXCHJ.js → chunk-UYA36DQ7.js} +2 -1
- package/dist/chunk-UYA36DQ7.js.map +1 -0
- package/dist/{chunk-DEACDKE3.js → chunk-VCKWULAK.js} +112 -87
- package/dist/chunk-VCKWULAK.js.map +1 -0
- package/dist/chunk-VOSWUO3K.js +100 -0
- package/dist/chunk-VOSWUO3K.js.map +1 -0
- package/dist/{chunk-TUHBYJXL.js → chunk-VQ4AMTGZ.js} +1 -1
- package/dist/{chunk-3BCULS4U.js → chunk-VQNRICAQ.js} +145 -507
- package/dist/chunk-VQNRICAQ.js.map +1 -0
- package/dist/{chunk-H2YSH3DG.js → chunk-WKAXBXVA.js} +2 -2
- package/dist/{chunk-HRHO3ZNG.js → chunk-WKJFIMVN.js} +2 -2
- package/dist/{chunk-SXIMQLGV.js → chunk-WVGXCBOC.js} +2 -2
- package/dist/{chunk-CRML27CO.js → chunk-X5YYSAZX.js} +4 -4
- package/dist/{chunk-FZEEWOI2.js → chunk-XJJYSX6F.js} +2 -2
- package/dist/{chunk-U7EW2W4W.js → chunk-XKNHFDTT.js} +26 -6
- package/dist/chunk-XKNHFDTT.js.map +1 -0
- package/dist/{chunk-UG6VXIOK.js → chunk-XSTNGNJP.js} +2 -2
- package/dist/{chunk-YDPAE2RD.js → chunk-YFLLGRXO.js} +2 -2
- package/dist/{chunk-LPNCR4QK.js → chunk-YXFCALVT.js} +12 -12
- package/dist/{chunk-Q4WONDMJ.js → chunk-YYGZJPOK.js} +2 -2
- package/dist/{chunk-GTO56JY5.js → chunk-ZJPM7GZ3.js} +2 -2
- package/dist/{chunk-LOXHYCVS.js → chunk-ZW4VXELZ.js} +2 -2
- package/dist/{cli-O3F-ht3i.d.ts → cli-BEkm2MEf.d.ts} +5 -5
- package/dist/cli.d.ts +13 -14
- package/dist/cli.js +90 -85
- package/dist/coding/export-okf-codegraph.d.ts +56 -0
- package/dist/coding/export-okf-codegraph.js +526 -0
- package/dist/coding/export-okf-codegraph.js.map +1 -0
- package/dist/coding/pre-action-gate.d.ts +1 -2
- package/dist/compounding/engine.d.ts +2 -3
- package/dist/compounding/engine.js +24 -24
- package/dist/compounding/preference-consolidator.d.ts +1 -2
- package/dist/compression-optimizer.d.ts +1 -2
- package/dist/config.d.ts +1 -2
- package/dist/config.js +11 -11
- package/dist/connectors/codex-materialize-runner.d.ts +1 -2
- package/dist/connectors/codex-materialize-runner.js +23 -23
- package/dist/connectors/codex-materialize.d.ts +1 -2
- package/dist/connectors/index.d.ts +1 -2
- package/dist/connectors/index.js +23 -23
- package/dist/consolidation-provenance-check.d.ts +2 -3
- package/dist/consolidation-provenance-check.js +4 -4
- package/dist/consolidation-undo.d.ts +2 -3
- package/dist/consolidation-undo.js +3 -3
- package/dist/contradiction/index.d.ts +3 -4
- package/dist/contradiction/index.js +9 -9
- package/dist/{contradiction-scan-AKUWPX5N.js → contradiction-scan-NOYMFG66.js} +3 -3
- package/dist/converge-config.d.ts +1 -2
- package/dist/convergence-refresh.d.ts +2 -3
- package/dist/convergence-refresh.js +25 -25
- package/dist/conversation-index/backend.d.ts +1 -2
- package/dist/conversation-index/backend.js +2 -2
- package/dist/conversation-index/chunker.d.ts +1 -2
- package/dist/conversation-index/faiss-adapter.d.ts +1 -2
- package/dist/conversation-index/indexer.d.ts +1 -2
- package/dist/conversation-index/search.d.ts +1 -2
- package/dist/corpus-watermark.d.ts +1 -2
- package/dist/corpus-watermark.js +25 -25
- package/dist/cross-lingual-recall.d.ts +1 -2
- package/dist/day-summary.d.ts +1 -2
- package/dist/delinearize.d.ts +1 -2
- package/dist/dependency-propagation-config.d.ts +1 -2
- package/dist/{dependency-propagation-delivery-CL6RWXTA.d.ts → dependency-propagation-delivery-BCpeo14F.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -2
- package/dist/direct-answer.d.ts +1 -2
- package/dist/embedding-fallback.d.ts +1 -2
- package/dist/enrichment/index.d.ts +1 -2
- package/dist/entity-origin-fields.d.ts +1 -2
- package/dist/entity-retrieval.d.ts +2 -3
- package/dist/entity-retrieval.js +23 -23
- package/dist/entity-schema.d.ts +1 -2
- package/dist/episodic-context.d.ts +1 -2
- package/dist/eval-trajectory-contracts.d.ts +1 -2
- package/dist/eval-trajectory-store.d.ts +1 -2
- package/dist/eval-trajectory.d.ts +1 -2
- package/dist/explicit-capture.d.ts +9 -10
- package/dist/explicit-capture.js +11 -11
- package/dist/external-wiki-access.d.ts +11 -12
- package/dist/external-wiki-access.js +50 -47
- package/dist/external-wiki-collection-registration.d.ts +1 -2
- package/dist/external-wiki-collection.d.ts +1 -2
- package/dist/external-wiki-mcp-tools.d.ts +11 -12
- package/dist/extraction-error-classification.d.ts +1 -2
- package/dist/extraction-faithfulness.d.ts +1 -2
- package/dist/extraction-faithfulness.js +2 -2
- package/dist/extraction-judge-telemetry.d.ts +1 -2
- package/dist/extraction-judge-training.d.ts +1 -2
- package/dist/extraction-judge.d.ts +1 -2
- package/dist/extraction-judge.js +2 -2
- package/dist/extraction-liveness.d.ts +1 -2
- package/dist/extraction-normalization.d.ts +1 -2
- package/dist/extraction-prompt.d.ts +1 -2
- package/dist/extraction-source-grounding-rules.d.ts +1 -2
- package/dist/extraction-source-grounding.d.ts +1 -2
- package/dist/extraction.d.ts +1 -2
- package/dist/extraction.js +32 -29
- package/dist/fallback-llm.d.ts +7 -2
- package/dist/fallback-llm.js +1 -1
- package/dist/{first-start-migration-4NETATFF.js → first-start-migration-KHIMCBIC.js} +3 -3
- package/dist/graph-dashboard-diff.d.ts +1 -2
- package/dist/graph-dashboard-key.d.ts +1 -2
- package/dist/graph-dashboard-parser.d.ts +1 -2
- package/dist/graph-edge-reinforcement.d.ts +1 -2
- package/dist/graph-path-reconstruction.d.ts +1 -2
- package/dist/graph-path-scoring.d.ts +1 -2
- package/dist/graph-snapshot.d.ts +1 -2
- package/dist/graph.d.ts +1 -2
- package/dist/harmonic-retrieval.js +1 -1
- package/dist/importance.d.ts +1 -2
- package/dist/importers/index.d.ts +1 -2
- package/dist/in-flight-reads.d.ts +1 -2
- package/dist/{index-C7Xep6S9.d.ts → index-D_pyMUaP.d.ts} +2 -2
- package/dist/index.d.ts +929 -700
- package/dist/index.js +167 -132
- package/dist/intent.d.ts +1 -2
- package/dist/lcm/engine.d.ts +1 -2
- package/dist/lcm/index.d.ts +1 -2
- package/dist/lcm/tools.d.ts +1 -2
- package/dist/lifecycle.d.ts +1 -2
- package/dist/live-connectors-runner.d.ts +1 -2
- package/dist/local-llm.d.ts +1 -2
- package/dist/local-model-endpoint.d.ts +1 -2
- package/dist/location/index.d.ts +315 -6
- package/dist/location/index.js +151 -19
- package/dist/maintenance/memory-governance.d.ts +1 -2
- package/dist/maintenance/memory-governance.js +23 -23
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +23 -23
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -3
- package/dist/maintenance/rebuild-memory-projection.js +24 -24
- package/dist/{maintenance-CJ-xqFp0.d.ts → maintenance-DDUX9d6D.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +11 -12
- package/dist/mcp-read-only-tools.js +1 -1
- package/dist/memory-action-policy.d.ts +1 -2
- package/dist/memory-cache.d.ts +1 -2
- package/dist/memory-controller.d.ts +1 -2
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -2
- package/dist/memory-projection-mutations.js +3 -3
- package/dist/memory-projection-store.d.ts +1 -2
- package/dist/memory-projection-store.js +1 -1
- package/dist/memory-provenance.d.ts +1 -2
- package/dist/memory-snapshot.d.ts +1 -2
- package/dist/memory-subject-cli.d.ts +11 -12
- package/dist/memory-subject.d.ts +11 -12
- package/dist/memory-subject.js +4 -4
- package/dist/memory-worth-outcomes.d.ts +2 -3
- package/dist/models-json.d.ts +1 -2
- package/dist/namespaces/migrate.d.ts +3 -4
- package/dist/namespaces/migrate.js +24 -24
- package/dist/namespaces/principal.d.ts +1 -2
- package/dist/namespaces/search.d.ts +1 -2
- package/dist/namespaces/search.js +5 -5
- package/dist/namespaces/storage.d.ts +3 -4
- package/dist/namespaces/storage.js +23 -23
- package/dist/native-knowledge.d.ts +1 -2
- package/dist/offline-sync-file-io.js +3 -3
- package/dist/offline-sync-impression-drain.d.ts +1 -2
- package/dist/offline-sync-impression-drain.js +9 -9
- package/dist/offline-sync.js +4 -4
- package/dist/operator-doctor-corpus.d.ts +1 -2
- package/dist/operator-doctor-corpus.js +26 -26
- package/dist/operator-doctor-replica.d.ts +1 -2
- package/dist/operator-toolkit.d.ts +3 -4
- package/dist/operator-toolkit.js +42 -42
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -3
- package/dist/orchestration/maintenance.d.ts +4 -5
- package/dist/orchestration/maintenance.js +37 -36
- package/dist/{orchestrator-BsntWxLy.d.ts → orchestrator-3F4jihCo.d.ts} +8 -8
- package/dist/orchestrator.d.ts +9 -10
- package/dist/orchestrator.js +111 -106
- package/dist/page-versioning.js +3 -3
- package/dist/patterns-cli.d.ts +1 -2
- package/dist/{pipeline-CVoysPm2.d.ts → pipeline-CB1dj6Uh.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -2
- package/dist/proactive-contention.d.ts +1 -2
- package/dist/provenance.d.ts +1 -2
- package/dist/{public-http-CuOxlTC2.d.ts → public-http-34-JIAGQ.d.ts} +1 -1
- package/dist/{purge-GB7PZHT2.js → purge-OP6BEDFY.js} +2 -2
- package/dist/{qmd-DWMAGA5l.d.ts → qmd-edLLZXc5.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -3
- package/dist/qmd-recall-cache.d.ts +1 -2
- package/dist/qmd.d.ts +2 -3
- package/dist/recall-concurrency-config.d.ts +1 -2
- package/dist/recall-disclosure-escalation.d.ts +1 -2
- package/dist/recall-explain-renderer.d.ts +1 -2
- package/dist/recall-memory-map.d.ts +1 -2
- package/dist/recall-planner-llm.d.ts +1 -2
- package/dist/recall-planner-llm.js +1 -1
- package/dist/recall-state.d.ts +1 -2
- package/dist/recall-tag-filter.d.ts +1 -2
- package/dist/recall-timings.d.ts +1 -2
- package/dist/recall-xray-cli.d.ts +1 -2
- package/dist/recall-xray-renderer.d.ts +1 -2
- package/dist/recall-xray.d.ts +1 -2
- package/dist/reconcile/cursor.d.ts +1 -2
- package/dist/reconcile/manifest.d.ts +1 -2
- package/dist/reconcile/manifest.js +4 -4
- package/dist/reconcile/plan.d.ts +1 -2
- package/dist/replay/normalizers/chatgpt.d.ts +1 -2
- package/dist/replay/normalizers/claude.d.ts +1 -2
- package/dist/replay/normalizers/openclaw.d.ts +1 -2
- package/dist/replay/normalizers/shared.d.ts +1 -2
- package/dist/replay/runner.d.ts +1 -2
- package/dist/replay/types.d.ts +1 -2
- package/dist/replica-divergence.d.ts +1 -2
- package/dist/replica-peers-config.d.ts +1 -2
- package/dist/{resolution-XWBPKYFB.js → resolution-4DLI3IOR.js} +10 -10
- package/dist/resolve-auth-token.d.ts +1 -2
- package/dist/resume-bundles.js +12 -12
- package/dist/retrieval-agents.d.ts +2 -3
- package/dist/retrieval-tiers.d.ts +1 -2
- package/dist/routing/engine.d.ts +1 -2
- package/dist/routing/store.d.ts +1 -2
- package/dist/salvage-envelope.d.ts +1 -2
- package/dist/salvage-envelope.js +6 -6
- package/dist/schemas.d.ts +639 -174
- package/dist/schemas.js +3 -1
- package/dist/{scope-profiles-CPWkW_dI.d.ts → scope-profiles-BF2lu81V.d.ts} +1 -1
- package/dist/search/document-scanner.js +1 -1
- package/dist/search/embed-helper.d.ts +1 -2
- package/dist/search/factory.d.ts +1 -2
- package/dist/search/factory.js +4 -4
- package/dist/search/index.d.ts +1 -2
- package/dist/search/index.js +4 -4
- package/dist/search/lancedb-backend.d.ts +1 -2
- package/dist/search/lancedb-backend.js +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -2
- package/dist/search/meilisearch-backend.js +1 -1
- package/dist/search/noop-backend.d.ts +1 -2
- package/dist/search/orama-backend.d.ts +1 -2
- package/dist/search/orama-backend.js +1 -1
- package/dist/search/port.d.ts +1 -2
- package/dist/search/remote-backend.d.ts +1 -2
- package/dist/secure-store/index.js +3 -3
- package/dist/{semantic-consolidation-CNFVBXFc.d.ts → semantic-consolidation-5OuWXBRt.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -3
- package/dist/semantic-consolidation.js +24 -24
- package/dist/semantic-rule-promotion.js +23 -23
- package/dist/semantic-rule-verifier.d.ts +1 -2
- package/dist/semantic-rule-verifier.js +23 -23
- package/dist/{service-Bb-JIdQ0.d.ts → service-CrqEhLXD.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +1 -2
- package/dist/session-observer-state.d.ts +1 -2
- package/dist/shared-context/manager.d.ts +7 -8
- package/dist/signal.d.ts +1 -2
- package/dist/source-agent-qualifier.d.ts +1 -2
- package/dist/source-agent-qualifier.js +30 -27
- package/dist/standup/build.d.ts +16 -0
- package/dist/standup/build.js +17 -0
- package/dist/standup/build.js.map +1 -0
- package/dist/{storage-CukrlNKk.d.ts → storage-BQn-xnxm.d.ts} +1 -1
- package/dist/storage.d.ts +2 -3
- package/dist/storage.js +22 -22
- package/dist/subject-config.d.ts +1 -2
- package/dist/subject-config.js +5 -5
- package/dist/summarizer.d.ts +1 -2
- package/dist/summarizer.js +2 -2
- package/dist/summary-snapshot.d.ts +1 -2
- package/dist/support-passport/index.d.ts +16 -17
- package/dist/support-passport/index.js +52 -49
- package/dist/temporal-supersession.d.ts +2 -3
- package/dist/temporal-timeline-recall.d.ts +1 -2
- package/dist/temporal-validity.d.ts +1 -2
- package/dist/threading.d.ts +1 -2
- package/dist/tier-migration.d.ts +2 -3
- package/dist/tier-routing.d.ts +1 -2
- package/dist/tier-routing.js +2 -2
- package/dist/{tier-stats-4B5IJ3NE.js → tier-stats-2TOW3QNL.js} +3 -3
- package/dist/topics.d.ts +1 -2
- package/dist/transcript.d.ts +1 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +5 -5
- package/dist/transfer/export-okf.d.ts +39 -0
- package/dist/transfer/export-okf.js +112 -0
- package/dist/transfer/export-okf.js.map +1 -0
- package/dist/transfer/types.d.ts +78 -78
- package/dist/trust-score-stage.d.ts +1 -2
- package/dist/trust-score.d.ts +1 -2
- package/dist/{types-djxQlxJ7.d.ts → types-BRpcNjHZ.d.ts} +117 -2
- package/dist/types.d.ts +1 -2
- package/dist/utility-runtime.d.ts +1 -2
- package/dist/verified-recall.js +23 -23
- package/dist/who-knows-cli.d.ts +11 -12
- package/dist/who-knows-cli.js +24 -24
- package/dist/who-knows.d.ts +11 -12
- package/dist/who-knows.js +23 -23
- package/dist/write-envelope.d.ts +1 -2
- package/dist/write-envelope.js +5 -5
- package/package.json +34 -3
- package/src/access-admin-ops-surface.ts +6 -1
- package/src/access-boundary.ts +1 -0
- package/src/access-http.ts +3 -1
- package/src/access-mcp-output-schemas.ts +1 -0
- package/src/access-mcp.ts +3 -3
- package/src/access-operations.ts +1 -0
- package/src/access-service-offline-file-content.test.ts +63 -0
- package/src/access-surface-catalog.ts +2 -0
- package/src/activity/config.test.ts +1 -0
- package/src/activity/config.ts +21 -1
- package/src/activity/index.ts +1 -0
- package/src/activity/timeline/build.ts +279 -0
- package/src/activity/timeline/categories.ts +111 -0
- package/src/activity/timeline/classify.ts +110 -0
- package/src/activity/timeline/corrections.ts +145 -0
- package/src/activity/timeline/index.ts +6 -0
- package/src/activity/timeline/timeline.test.ts +277 -0
- package/src/activity/timeline/types.ts +106 -0
- package/src/activity/types.ts +6 -0
- package/src/cli/okf-commands.ts +45 -0
- package/src/cli.ts +2 -2
- package/src/coding/export-okf-codegraph.test.ts +381 -0
- package/src/coding/export-okf-codegraph.ts +565 -0
- package/src/config.test.ts +1 -0
- package/src/extraction-prompt-safety.test.ts +14 -2
- package/src/extraction.ts +21 -1
- package/src/fallback-llm.test.ts +134 -0
- package/src/fallback-llm.ts +77 -5
- package/src/location/access-operations.ts +17 -8
- package/src/location/backfill.ts +137 -0
- package/src/location/config.test.ts +3 -0
- package/src/location/config.ts +46 -2
- package/src/location/http-glue.ts +1 -1
- package/src/location/index.ts +3 -0
- package/src/location/intervals.ts +1 -0
- package/src/location/matching.test.ts +65 -0
- package/src/location/matching.ts +354 -0
- package/src/location/mcp-tools.ts +2 -1
- package/src/location/surfaces.test.ts +15 -2
- package/src/location/surfaces.ts +95 -18
- package/src/location/tagging.test.ts +119 -0
- package/src/location/tagging.ts +277 -0
- package/src/location/types.ts +23 -1
- package/src/mcp-read-only-tools.ts +1 -0
- package/src/memory-projection-store.ts +3 -1
- package/src/okf/cli.ts +18 -5
- package/src/okf/config.ts +5 -0
- package/src/okf/index-files.test.ts +60 -0
- package/src/okf/index-files.ts +114 -0
- package/src/okf/render.ts +133 -0
- package/src/okf/type-mapping.test.ts +3 -0
- package/src/okf/type-mapping.ts +2 -0
- package/src/orchestration/extraction-run.ts +2 -1
- package/src/orchestration/generic-recall-paths.ts +4 -3
- package/src/schemas.ts +17 -1
- package/src/standup/access-operations.ts +14 -0
- package/src/standup/build.test.ts +34 -0
- package/src/standup/build.ts +115 -0
- package/src/standup/http-glue.ts +15 -0
- package/src/standup/mcp-tools.ts +16 -0
- package/src/support-passport/card-projection.ts +1 -0
- package/src/support-passport/card-service-commit-forwarding.test.ts +1 -0
- package/src/support-passport/card-service.test.ts +75 -1
- package/src/support-passport/card-service.ts +6 -3
- package/src/support-passport/card-state.ts +5 -1
- package/src/support-passport/offline-sync-guard.ts +14 -1
- package/src/transfer/export-okf.test.ts +164 -0
- package/src/transfer/export-okf.ts +286 -0
- package/dist/chunk-2LWQSV6A.js.map +0 -1
- package/dist/chunk-3BCULS4U.js.map +0 -1
- package/dist/chunk-7BDZTALN.js.map +0 -1
- package/dist/chunk-7PHI6GUI.js.map +0 -1
- package/dist/chunk-AX7UXCHJ.js.map +0 -1
- package/dist/chunk-DEACDKE3.js.map +0 -1
- package/dist/chunk-FP7YTTVO.js.map +0 -1
- package/dist/chunk-JYSN42VN.js.map +0 -1
- package/dist/chunk-KZIF6XHX.js.map +0 -1
- package/dist/chunk-LKYIOCWL.js.map +0 -1
- package/dist/chunk-OXRRJXPR.js.map +0 -1
- package/dist/chunk-U7EW2W4W.js.map +0 -1
- package/dist/chunk-UW5NPZJ2.js.map +0 -1
- package/dist/chunk-XAB6STPO.js.map +0 -1
- package/dist/chunk-XNWXSGHS.js.map +0 -1
- package/dist/types-CM86alG1.d.ts +0 -89
- /package/dist/{auto-sync-2YPITIWN.js.map → auto-sync-Q6Q2FVSC.js.map} +0 -0
- /package/dist/{capsule-merge-SGIVB3WA.js.map → capsule-merge-SEHERWWP.js.map} +0 -0
- /package/dist/{chunk-LEPOP46W.js.map → chunk-227UFSEQ.js.map} +0 -0
- /package/dist/{chunk-NPFUNWNX.js.map → chunk-23CVL7HS.js.map} +0 -0
- /package/dist/{chunk-PO7NXBG2.js.map → chunk-2GF27PGH.js.map} +0 -0
- /package/dist/{chunk-MY2BC6UE.js.map → chunk-2LBAFHOQ.js.map} +0 -0
- /package/dist/{chunk-AZMLH5UT.js.map → chunk-33MFRY25.js.map} +0 -0
- /package/dist/{chunk-UEBDCMOO.js.map → chunk-3TSU662L.js.map} +0 -0
- /package/dist/{chunk-CAMNRAJF.js.map → chunk-4FHRZD5T.js.map} +0 -0
- /package/dist/{chunk-S5XOSTYM.js.map → chunk-4STAANV7.js.map} +0 -0
- /package/dist/{chunk-4F4AQFWL.js.map → chunk-6CEGSTBD.js.map} +0 -0
- /package/dist/{chunk-MDD2RINF.js.map → chunk-6RUHELWR.js.map} +0 -0
- /package/dist/{chunk-WNXYT4MK.js.map → chunk-72OIT7KS.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-7LCGFUMB.js.map} +0 -0
- /package/dist/{chunk-SNOIKAHM.js.map → chunk-7UTDHQZ5.js.map} +0 -0
- /package/dist/{chunk-5HK3CJAR.js.map → chunk-7XOG75AU.js.map} +0 -0
- /package/dist/{chunk-UPFNQJC7.js.map → chunk-CN4VKV3S.js.map} +0 -0
- /package/dist/{chunk-PMVPCZJZ.js.map → chunk-CTCGHNWN.js.map} +0 -0
- /package/dist/{chunk-EGBDFJ36.js.map → chunk-DD5JFCWM.js.map} +0 -0
- /package/dist/{chunk-XBGHAAKR.js.map → chunk-DDX6KIXF.js.map} +0 -0
- /package/dist/{chunk-JIYDRBVZ.js.map → chunk-DJORULH3.js.map} +0 -0
- /package/dist/{chunk-UENKPWCS.js.map → chunk-DMEHOEC7.js.map} +0 -0
- /package/dist/{chunk-7KQB4EBS.js.map → chunk-DUAJKRR2.js.map} +0 -0
- /package/dist/{chunk-SEEJOGQX.js.map → chunk-EFQCDJZ2.js.map} +0 -0
- /package/dist/{chunk-Q57GOHLF.js.map → chunk-EGALNSZ4.js.map} +0 -0
- /package/dist/{chunk-KCT36JAW.js.map → chunk-ESNFSSO4.js.map} +0 -0
- /package/dist/{chunk-XQ3HXAQH.js.map → chunk-ET2CNMLD.js.map} +0 -0
- /package/dist/{chunk-PU56CXZA.js.map → chunk-EZSCW4EM.js.map} +0 -0
- /package/dist/{chunk-HMZKGHMD.js.map → chunk-FESUGFIL.js.map} +0 -0
- /package/dist/{chunk-3A2NJP2U.js.map → chunk-FKKGCGYL.js.map} +0 -0
- /package/dist/{chunk-BWGCOLEL.js.map → chunk-FTTJRVB7.js.map} +0 -0
- /package/dist/{chunk-ODU2CNNX.js.map → chunk-FYWLSFFS.js.map} +0 -0
- /package/dist/{chunk-3PKAS6VL.js.map → chunk-GX6FTSYH.js.map} +0 -0
- /package/dist/{chunk-76DIF5KT.js.map → chunk-H7VDIF2V.js.map} +0 -0
- /package/dist/{chunk-F7XUD3PL.js.map → chunk-HJXA6ZM7.js.map} +0 -0
- /package/dist/{chunk-4QEYREAV.js.map → chunk-HNPE66LB.js.map} +0 -0
- /package/dist/{chunk-P36Z4JRA.js.map → chunk-I5VB44ZK.js.map} +0 -0
- /package/dist/{chunk-EUYWQ7TS.js.map → chunk-IEZ6CGTW.js.map} +0 -0
- /package/dist/{chunk-5DHKCO52.js.map → chunk-IVIAHQBR.js.map} +0 -0
- /package/dist/{chunk-TFR3HG4K.js.map → chunk-J3OND5QT.js.map} +0 -0
- /package/dist/{chunk-5ACCD4L7.js.map → chunk-JRRQ747T.js.map} +0 -0
- /package/dist/{chunk-V4IDF3EZ.js.map → chunk-JTWZKNUH.js.map} +0 -0
- /package/dist/{chunk-5RWZH6PH.js.map → chunk-L4X4PJYK.js.map} +0 -0
- /package/dist/{chunk-UTQUEHC7.js.map → chunk-LUDBXTBJ.js.map} +0 -0
- /package/dist/{chunk-LDKPDODJ.js.map → chunk-ME35HVDJ.js.map} +0 -0
- /package/dist/{chunk-DPCXDG7G.js.map → chunk-MJRGVXPQ.js.map} +0 -0
- /package/dist/{chunk-773TRRGT.js.map → chunk-MJUCDM3C.js.map} +0 -0
- /package/dist/{chunk-T6ILXUAH.js.map → chunk-MN5NOOI7.js.map} +0 -0
- /package/dist/{chunk-AHPIFKNG.js.map → chunk-N4F7ZSSG.js.map} +0 -0
- /package/dist/{chunk-JOZUBF4A.js.map → chunk-NACLNNFQ.js.map} +0 -0
- /package/dist/{chunk-LC2BDILZ.js.map → chunk-NBP4EX5N.js.map} +0 -0
- /package/dist/{chunk-ZVPVTPGI.js.map → chunk-NNZFPYYX.js.map} +0 -0
- /package/dist/{chunk-DA7ITC5Z.js.map → chunk-O57GM3FR.js.map} +0 -0
- /package/dist/{chunk-7VZFRUQU.js.map → chunk-O7ERGZDA.js.map} +0 -0
- /package/dist/{chunk-3SZD4CYO.js.map → chunk-OAJMQKQR.js.map} +0 -0
- /package/dist/{chunk-HSZMX3ZJ.js.map → chunk-ODW5GDFE.js.map} +0 -0
- /package/dist/{chunk-J2WC5LF4.js.map → chunk-QBC33MPY.js.map} +0 -0
- /package/dist/{chunk-T7XP6IZE.js.map → chunk-QCRJMU5V.js.map} +0 -0
- /package/dist/{chunk-OA2O2GJ4.js.map → chunk-RZ3IZIJG.js.map} +0 -0
- /package/dist/{chunk-UL4MKZHI.js.map → chunk-SN4JXNLL.js.map} +0 -0
- /package/dist/{chunk-CPA5NBHN.js.map → chunk-TNGH4ZYI.js.map} +0 -0
- /package/dist/{chunk-F3NVYTTA.js.map → chunk-TNXNECAN.js.map} +0 -0
- /package/dist/{chunk-BEC4YBNA.js.map → chunk-TVW4C7PV.js.map} +0 -0
- /package/dist/{chunk-UFKPQBXH.js.map → chunk-U62OK7BB.js.map} +0 -0
- /package/dist/{chunk-TUHBYJXL.js.map → chunk-VQ4AMTGZ.js.map} +0 -0
- /package/dist/{chunk-H2YSH3DG.js.map → chunk-WKAXBXVA.js.map} +0 -0
- /package/dist/{chunk-HRHO3ZNG.js.map → chunk-WKJFIMVN.js.map} +0 -0
- /package/dist/{chunk-SXIMQLGV.js.map → chunk-WVGXCBOC.js.map} +0 -0
- /package/dist/{chunk-CRML27CO.js.map → chunk-X5YYSAZX.js.map} +0 -0
- /package/dist/{chunk-FZEEWOI2.js.map → chunk-XJJYSX6F.js.map} +0 -0
- /package/dist/{chunk-UG6VXIOK.js.map → chunk-XSTNGNJP.js.map} +0 -0
- /package/dist/{chunk-YDPAE2RD.js.map → chunk-YFLLGRXO.js.map} +0 -0
- /package/dist/{chunk-LPNCR4QK.js.map → chunk-YXFCALVT.js.map} +0 -0
- /package/dist/{chunk-Q4WONDMJ.js.map → chunk-YYGZJPOK.js.map} +0 -0
- /package/dist/{chunk-GTO56JY5.js.map → chunk-ZJPM7GZ3.js.map} +0 -0
- /package/dist/{chunk-LOXHYCVS.js.map → chunk-ZW4VXELZ.js.map} +0 -0
- /package/dist/{contradiction-scan-AKUWPX5N.js.map → contradiction-scan-NOYMFG66.js.map} +0 -0
- /package/dist/{first-start-migration-4NETATFF.js.map → first-start-migration-KHIMCBIC.js.map} +0 -0
- /package/dist/{purge-GB7PZHT2.js.map → purge-OP6BEDFY.js.map} +0 -0
- /package/dist/{resolution-XWBPKYFB.js.map → resolution-4DLI3IOR.js.map} +0 -0
- /package/dist/{tier-stats-4B5IJ3NE.js.map → tier-stats-2TOW3QNL.js.map} +0 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codegraph OKF projection (issue #1950).
|
|
3
|
+
*
|
|
4
|
+
* Read-only projection of one project's code-graph SQLite store into an
|
|
5
|
+
* OKF v0.1 knowledge bundle: the stored architecture card, decision
|
|
6
|
+
* records, and one `Code Module` concept per indexed source file with its
|
|
7
|
+
* symbols and outgoing edges. The store is NEVER opened for write — the
|
|
8
|
+
* SQLite file is opened `readonly`, so an export cannot mutate indexing
|
|
9
|
+
* state and the file's bytes are stable across runs.
|
|
10
|
+
*
|
|
11
|
+
* Rendering discipline mirrors architecture-card.ts (rule 38): byte-stable
|
|
12
|
+
* output for an unchanged graph; every list is sorted with a total order.
|
|
13
|
+
* Shared bundle mechanics come from ../okf/render.ts (one source of truth
|
|
14
|
+
* with the memory exporter, issue #1948).
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, readdirSync, rmSync, statSync } from "node:fs";
|
|
17
|
+
import { mkdtemp } from "node:fs/promises";
|
|
18
|
+
import os from "node:os";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
|
|
21
|
+
import { lintOkfDir } from "../okf/lint.js";
|
|
22
|
+
import {
|
|
23
|
+
OKF_ARCHITECTURE_CARD_TYPE,
|
|
24
|
+
OKF_CODE_MODULE_TYPE,
|
|
25
|
+
OKF_DECISION_RECORD_TYPE,
|
|
26
|
+
} from "../okf/type-mapping.js";
|
|
27
|
+
import {
|
|
28
|
+
OKF_EXPORT_VERSION,
|
|
29
|
+
publishBundle,
|
|
30
|
+
renderFrontmatter,
|
|
31
|
+
rejectSymlinkPath,
|
|
32
|
+
writeBundleFile,
|
|
33
|
+
} from "../okf/render.js";
|
|
34
|
+
import { openBetterSqlite3 } from "../runtime/better-sqlite.js";
|
|
35
|
+
import { StorageManager, stripAttributesSuffix } from "../storage.js";
|
|
36
|
+
import type { PluginConfig } from "../types.js";
|
|
37
|
+
import { findArchitectureCardMemory, type ArchitectureSurfaceStorage } from "./architecture-surfaces.js";
|
|
38
|
+
import {
|
|
39
|
+
CodegraphRuntimeError,
|
|
40
|
+
codegraphSurfaceVisible,
|
|
41
|
+
listCodegraphProjects,
|
|
42
|
+
resolveCodegraphDbPath,
|
|
43
|
+
} from "./codegraph-runtime.js";
|
|
44
|
+
import { defaultGitInvoker, normalizeOriginUrl } from "./git-context.js";
|
|
45
|
+
import { projectNamespaceName } from "./coding-namespace.js";
|
|
46
|
+
import {
|
|
47
|
+
ACTIVE_DECISION_STATUSES,
|
|
48
|
+
DECISION_STATUSES,
|
|
49
|
+
parseDecisionRecord,
|
|
50
|
+
type DecisionRecord,
|
|
51
|
+
} from "./decision-records.js";
|
|
52
|
+
import { buildCodingGraphInstallHint, isCodingGraphInstalled } from "./optional-coding-graph.js";
|
|
53
|
+
|
|
54
|
+
/** Default cap on rendered module concepts (`--max-module-concepts`). */
|
|
55
|
+
export const DEFAULT_OKF_CODEGRAPH_MAX_MODULE_CONCEPTS = 500;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Visible marker written into the root index when module concepts were
|
|
59
|
+
* truncated (mirrors `ARCHITECTURE_CARD_TRUNCATION_MARKER` — never
|
|
60
|
+
* silently incomplete).
|
|
61
|
+
*/
|
|
62
|
+
export const OKF_CODEGRAPH_TRUNCATION_MARKER = "<!-- okf-codegraph-truncated -->";
|
|
63
|
+
|
|
64
|
+
export type OkfCodegraphSymbolFilter = "none" | "exported" | "all";
|
|
65
|
+
|
|
66
|
+
const SYMBOL_FILTERS: readonly OkfCodegraphSymbolFilter[] = ["none", "exported", "all"];
|
|
67
|
+
|
|
68
|
+
export function parseOkfCodegraphSymbolFilter(raw: unknown): OkfCodegraphSymbolFilter {
|
|
69
|
+
const value = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
70
|
+
if (value.length === 0) return "exported";
|
|
71
|
+
if ((SYMBOL_FILTERS as readonly string[]).includes(value)) return value as OkfCodegraphSymbolFilter;
|
|
72
|
+
throw new Error(`invalid --symbols ${String(raw)}; allowed: ${SYMBOL_FILTERS.join(", ")}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ExportOkfCodegraphOptions {
|
|
76
|
+
readonly config: PluginConfig;
|
|
77
|
+
readonly memoryDir: string;
|
|
78
|
+
/** Store owner; defaults to `"default"` like the access-service principal key. */
|
|
79
|
+
readonly principal?: string;
|
|
80
|
+
readonly projectId: string;
|
|
81
|
+
readonly outDir: string;
|
|
82
|
+
/**
|
|
83
|
+
* Working directory used to resolve git context (repo root, origin URL).
|
|
84
|
+
* Defaults to `process.cwd()`.
|
|
85
|
+
*/
|
|
86
|
+
readonly cwd?: string;
|
|
87
|
+
readonly maxModuleConcepts?: number;
|
|
88
|
+
readonly symbols?: OkfCodegraphSymbolFilter;
|
|
89
|
+
/** Default ON; pass `false` for `--no-include-adrs`. */
|
|
90
|
+
readonly includeAdrs?: boolean;
|
|
91
|
+
readonly force?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Namespace holding the project's decision records + architecture card.
|
|
94
|
+
* Defaults to the project-scope coding namespace for the project id.
|
|
95
|
+
*/
|
|
96
|
+
readonly namespace?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ExportOkfCodegraphResult {
|
|
100
|
+
readonly projectId: string;
|
|
101
|
+
readonly moduleConcepts: number;
|
|
102
|
+
readonly moduleFilesInGraph: number;
|
|
103
|
+
readonly truncated: boolean;
|
|
104
|
+
readonly decisions: number;
|
|
105
|
+
readonly architectureCard: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface GraphFileRow {
|
|
109
|
+
readonly id: number;
|
|
110
|
+
readonly path: string;
|
|
111
|
+
readonly lang: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface GraphNodeRow {
|
|
115
|
+
readonly name: string;
|
|
116
|
+
readonly label: string;
|
|
117
|
+
readonly file_id: number;
|
|
118
|
+
readonly span_start: number;
|
|
119
|
+
readonly span_end: number;
|
|
120
|
+
readonly is_exported: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface GraphEdgeRow {
|
|
124
|
+
readonly type: string;
|
|
125
|
+
readonly confidence: number;
|
|
126
|
+
readonly src_file_id: number;
|
|
127
|
+
readonly dst_file_id: number;
|
|
128
|
+
readonly dst_name: string;
|
|
129
|
+
readonly dst_path: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export async function exportCodegraphOkfBundle(
|
|
133
|
+
opts: ExportOkfCodegraphOptions,
|
|
134
|
+
): Promise<ExportOkfCodegraphResult> {
|
|
135
|
+
if (!codegraphSurfaceVisible(opts.config)) {
|
|
136
|
+
throw new CodegraphRuntimeError(
|
|
137
|
+
"disabled",
|
|
138
|
+
"codegraph tools are disabled (codingKnowledge.enabled or codingKnowledge.codegraphTools is false)",
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
if (!(await isCodingGraphInstalled())) {
|
|
142
|
+
throw new CodegraphRuntimeError("package_missing", buildCodingGraphInstallHint());
|
|
143
|
+
}
|
|
144
|
+
const principal = opts.principal?.trim() || "default";
|
|
145
|
+
const projectId = opts.projectId.trim();
|
|
146
|
+
if (projectId.length === 0) {
|
|
147
|
+
throw new CodegraphRuntimeError(
|
|
148
|
+
"project_required",
|
|
149
|
+
"codegraph export-okf requires --project (or a cwd inside the project's git repo)",
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
rejectSymlinkPath(path.resolve(opts.outDir));
|
|
153
|
+
// Explicit option validation (config-coercion footgun): honor the given
|
|
154
|
+
// value or fail loudly — never silently default a bad input. `0` is a
|
|
155
|
+
// legitimate "no module concepts" cap and is honored.
|
|
156
|
+
const maxModules = opts.maxModuleConcepts ?? DEFAULT_OKF_CODEGRAPH_MAX_MODULE_CONCEPTS;
|
|
157
|
+
if (!Number.isInteger(maxModules) || maxModules < 0) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
`invalid --max-module-concepts ${String(opts.maxModuleConcepts)}; must be a non-negative integer`,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
const dbPath = resolveCodegraphDbPath({ config: opts.config, memoryDir: opts.memoryDir, principal, projectId });
|
|
163
|
+
if (!existsSync(dbPath)) {
|
|
164
|
+
const known = listCodegraphProjects({
|
|
165
|
+
config: opts.config,
|
|
166
|
+
memoryDir: opts.memoryDir,
|
|
167
|
+
principal,
|
|
168
|
+
listDir: (dir) => {
|
|
169
|
+
try {
|
|
170
|
+
return readdirSync(dir);
|
|
171
|
+
} catch {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
throw new CodegraphRuntimeError(
|
|
177
|
+
"project_not_found",
|
|
178
|
+
`no codegraph store for project '${projectId}' (principal '${principal}'); known projects: ${
|
|
179
|
+
known.length > 0 ? known.join(", ") : "(none)"
|
|
180
|
+
}`,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Read the graph through a readonly handle — bytes on disk are never
|
|
185
|
+
// touched, and the store cache (write-mode handles) is bypassed entirely.
|
|
186
|
+
const graphIndexedAt = statSync(dbPath).mtime.toISOString();
|
|
187
|
+
const db = openBetterSqlite3(dbPath, { readonly: true, fileMustExist: true });
|
|
188
|
+
let files: GraphFileRow[];
|
|
189
|
+
let nodes: GraphNodeRow[];
|
|
190
|
+
let edges: GraphEdgeRow[];
|
|
191
|
+
try {
|
|
192
|
+
files = db.prepare("SELECT id, path, lang FROM files ORDER BY path ASC").all() as GraphFileRow[];
|
|
193
|
+
nodes = db
|
|
194
|
+
.prepare(
|
|
195
|
+
`SELECT n.name, n.label, n.file_id, n.span_start, n.span_end,
|
|
196
|
+
COALESCE(na.is_exported, 0) AS is_exported
|
|
197
|
+
FROM nodes n LEFT JOIN node_attributes na ON na.node_id = n.id`,
|
|
198
|
+
)
|
|
199
|
+
.all() as GraphNodeRow[];
|
|
200
|
+
edges = db
|
|
201
|
+
.prepare(
|
|
202
|
+
`SELECT e.type, e.confidence, s.file_id AS src_file_id, d.file_id AS dst_file_id,
|
|
203
|
+
d.name AS dst_name, df.path AS dst_path
|
|
204
|
+
FROM edges e
|
|
205
|
+
JOIN nodes s ON s.id = e.src
|
|
206
|
+
JOIN nodes d ON d.id = e.dst
|
|
207
|
+
JOIN files df ON d.file_id = df.id`,
|
|
208
|
+
)
|
|
209
|
+
.all() as GraphEdgeRow[];
|
|
210
|
+
} finally {
|
|
211
|
+
db.close();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Trust boundary: file paths come from the indexed graph. Reject anything
|
|
215
|
+
// that is not a strict repo-relative POSIX path so a hostile row cannot
|
|
216
|
+
// escape the staging directory via writeBundleFile's path.join.
|
|
217
|
+
const safeFiles = files.filter(
|
|
218
|
+
(f) => f.path.length > 0 && !f.path.startsWith("/") && !f.path.split("/").includes(".."),
|
|
219
|
+
);
|
|
220
|
+
const fileIdToPath = new Map<number, string>(safeFiles.map((f) => [f.id, f.path]));
|
|
221
|
+
const nodesByFile = new Map<number, GraphNodeRow[]>();
|
|
222
|
+
for (const node of nodes) {
|
|
223
|
+
if (!fileIdToPath.has(node.file_id)) continue;
|
|
224
|
+
const list = nodesByFile.get(node.file_id) ?? [];
|
|
225
|
+
list.push(node);
|
|
226
|
+
nodesByFile.set(node.file_id, list);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Deterministic truncation: most symbols first, path ascending as the
|
|
230
|
+
// tie-break (issue acceptance: cap of 1 keeps the highest-symbol file).
|
|
231
|
+
const ranked = [...safeFiles].sort((a, b) => {
|
|
232
|
+
const aCount = (nodesByFile.get(a.id) ?? []).length;
|
|
233
|
+
const bCount = (nodesByFile.get(b.id) ?? []).length;
|
|
234
|
+
if (aCount !== bCount) return bCount - aCount;
|
|
235
|
+
return a.path.localeCompare(b.path);
|
|
236
|
+
});
|
|
237
|
+
const keptFiles = ranked.slice(0, maxModules);
|
|
238
|
+
const keptPaths = new Set<string>(keptFiles.map((f) => f.path));
|
|
239
|
+
const truncated = safeFiles.length > keptFiles.length;
|
|
240
|
+
|
|
241
|
+
const symbolFilter = parseOkfCodegraphSymbolFilter(opts.symbols);
|
|
242
|
+
const git = await resolveGitHints(opts.cwd ?? process.cwd());
|
|
243
|
+
const staging = await mkdtemp(path.join(os.tmpdir(), "remnic-okf-codegraph-"));
|
|
244
|
+
let decisions = 0;
|
|
245
|
+
let architectureCard = false;
|
|
246
|
+
try {
|
|
247
|
+
const namespace = opts.namespace?.trim() || projectNamespaceName(projectId);
|
|
248
|
+
const namespaceDir = path.join(opts.memoryDir, "namespaces", namespace);
|
|
249
|
+
if (opts.includeAdrs !== false && existsSync(namespaceDir)) {
|
|
250
|
+
const storage = new StorageManager(namespaceDir);
|
|
251
|
+
const memories = await storage.readAllMemories();
|
|
252
|
+
// Architecture card — reuse the surface's classification (rule 53).
|
|
253
|
+
const card = await findArchitectureCardMemory(readOnlyCardStorage(storage, namespaceDir, namespace));
|
|
254
|
+
if (card) {
|
|
255
|
+
architectureCard = true;
|
|
256
|
+
writeBundleFile(
|
|
257
|
+
staging,
|
|
258
|
+
"architecture.md",
|
|
259
|
+
renderFrontmatter({
|
|
260
|
+
type: OKF_ARCHITECTURE_CARD_TYPE,
|
|
261
|
+
title: git.repoName,
|
|
262
|
+
...(git.originUrl ? { resource: git.originUrl } : git.repoRoot ? { resource: git.repoRoot } : {}),
|
|
263
|
+
timestamp: card.frontmatter.updated ?? card.frontmatter.created,
|
|
264
|
+
}) +
|
|
265
|
+
stripAttributesSuffix(card.content.replace(/^\uFEFF/, "")).trimEnd() +
|
|
266
|
+
"\n",
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
const records: Array<{ record: DecisionRecord; timestamp: string }> = [];
|
|
270
|
+
for (const memory of memories) {
|
|
271
|
+
if (memory.frontmatter.category !== "decision") continue;
|
|
272
|
+
try {
|
|
273
|
+
const parsed = parseDecisionRecord(memory.content);
|
|
274
|
+
records.push({
|
|
275
|
+
// Production writes leave the ADR frontmatter id empty and use
|
|
276
|
+
// the memory id as the canonical identifier (decisionRecord
|
|
277
|
+
// surface path) — prefer the ADR id, fall back to the memory id.
|
|
278
|
+
record: parsed.id ? parsed : { ...parsed, id: memory.frontmatter.id },
|
|
279
|
+
timestamp: memory.frontmatter.updated ?? memory.frontmatter.created,
|
|
280
|
+
});
|
|
281
|
+
} catch {
|
|
282
|
+
// Unparseable decision bodies are skipped, mirroring the surface's
|
|
283
|
+
// safeParseDecisionRecord degradation.
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
records.sort((a, b) => a.record.title.localeCompare(b.record.title));
|
|
287
|
+
decisions = records.length;
|
|
288
|
+
for (const { record, timestamp } of records) {
|
|
289
|
+
writeBundleFile(staging, `decisions/${decisionFileStem(record)}.md`, renderDecision(record, timestamp));
|
|
290
|
+
}
|
|
291
|
+
if (records.length > 0 || architectureCard) {
|
|
292
|
+
writeBundleFile(staging, "decisions/index.md", renderDecisionsIndex(records));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
for (const file of keptFiles) {
|
|
297
|
+
writeBundleFile(
|
|
298
|
+
staging,
|
|
299
|
+
`modules/${file.path}.md`,
|
|
300
|
+
renderModule(
|
|
301
|
+
file,
|
|
302
|
+
nodesByFile.get(file.id) ?? [],
|
|
303
|
+
edges,
|
|
304
|
+
fileIdToPath,
|
|
305
|
+
keptPaths,
|
|
306
|
+
symbolFilter,
|
|
307
|
+
git,
|
|
308
|
+
graphIndexedAt,
|
|
309
|
+
),
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
if (keptFiles.length > 0) {
|
|
313
|
+
writeBundleFile(staging, "modules/index.md", renderModulesIndex(keptFiles));
|
|
314
|
+
}
|
|
315
|
+
writeBundleFile(
|
|
316
|
+
staging,
|
|
317
|
+
"index.md",
|
|
318
|
+
renderRootIndex(git.repoName, projectId, architectureCard, decisions, keptFiles, safeFiles, truncated),
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
// Self-validate with the #1946 conformance checker; non-conformant
|
|
322
|
+
// output fails the command. Reserved basenames (the bundle's own
|
|
323
|
+
// index.md files) are the documented exemption, as in the memory export.
|
|
324
|
+
const lint = lintOkfDir(staging);
|
|
325
|
+
const blocking = lint.findings.filter((f) => f.code !== "skipped_encrypted" && f.code !== "reserved_basename");
|
|
326
|
+
if (blocking.length > 0) {
|
|
327
|
+
throw new Error(`OKF codegraph export failed lint: ${blocking.map((f) => `${f.file}: ${f.message}`).join("; ")}`);
|
|
328
|
+
}
|
|
329
|
+
publishBundle(staging, path.resolve(opts.outDir), opts.force === true);
|
|
330
|
+
} catch (err) {
|
|
331
|
+
rmSync(staging, { recursive: true, force: true });
|
|
332
|
+
throw err;
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
projectId,
|
|
336
|
+
moduleConcepts: keptFiles.length,
|
|
337
|
+
moduleFilesInGraph: safeFiles.length,
|
|
338
|
+
truncated,
|
|
339
|
+
decisions,
|
|
340
|
+
architectureCard,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Read-only adapter over the namespace StorageManager for
|
|
346
|
+
* {@link findArchitectureCardMemory} — write arms throw so a future edit
|
|
347
|
+
* cannot silently turn the exporter into a mutating surface.
|
|
348
|
+
*/
|
|
349
|
+
function readOnlyCardStorage(
|
|
350
|
+
storage: StorageManager,
|
|
351
|
+
dir: string,
|
|
352
|
+
namespace: string,
|
|
353
|
+
): ArchitectureSurfaceStorage {
|
|
354
|
+
return {
|
|
355
|
+
dir,
|
|
356
|
+
namespace,
|
|
357
|
+
readAllMemories: () => storage.readAllMemories(),
|
|
358
|
+
updateMemory: () => {
|
|
359
|
+
throw new Error("codegraph export-okf is read-only");
|
|
360
|
+
},
|
|
361
|
+
writeSealedMemory: () => {
|
|
362
|
+
throw new Error("codegraph export-okf is read-only");
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
interface GitHints {
|
|
368
|
+
readonly repoRoot: string | null;
|
|
369
|
+
readonly repoName: string;
|
|
370
|
+
readonly originUrl: string | null;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
async function resolveGitHints(cwd: string): Promise<GitHints> {
|
|
374
|
+
try {
|
|
375
|
+
const invoker = defaultGitInvoker();
|
|
376
|
+
const topLevel = await invoker(cwd, ["rev-parse", "--show-toplevel"]);
|
|
377
|
+
if (topLevel.exitCode !== 0) {
|
|
378
|
+
return { repoRoot: null, repoName: "codegraph", originUrl: null };
|
|
379
|
+
}
|
|
380
|
+
const repoRoot = topLevel.stdout.trim();
|
|
381
|
+
const origin = await invoker(repoRoot, ["remote", "get-url", "origin"]);
|
|
382
|
+
const originUrl = origin.exitCode === 0 ? normalizeOriginUrl(origin.stdout) : null;
|
|
383
|
+
return {
|
|
384
|
+
repoRoot: repoRoot || null,
|
|
385
|
+
repoName: (repoRoot && path.basename(repoRoot)) || "codegraph",
|
|
386
|
+
originUrl: originUrl && originUrl.length > 0 ? originUrl : null,
|
|
387
|
+
};
|
|
388
|
+
} catch {
|
|
389
|
+
return { repoRoot: null, repoName: "codegraph", originUrl: null };
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function moduleResource(git: GitHints, filePath: string): string {
|
|
394
|
+
if (git.originUrl) return `${git.originUrl}/${filePath}`;
|
|
395
|
+
if (git.repoRoot) return path.join(git.repoRoot, filePath);
|
|
396
|
+
return filePath;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function confidenceTier(confidence: number): string {
|
|
400
|
+
if (confidence >= 0.9) return "high";
|
|
401
|
+
if (confidence >= 0.5) return "medium";
|
|
402
|
+
return "low";
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function decisionFileStem(record: Pick<DecisionRecord, "id">): string {
|
|
406
|
+
const safe = record.id.replace(/[^A-Za-z0-9._-]+/g, "_");
|
|
407
|
+
return safe.length > 0 ? safe : "decision";
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function renderModule(
|
|
411
|
+
file: GraphFileRow,
|
|
412
|
+
fileNodes: readonly GraphNodeRow[],
|
|
413
|
+
edges: readonly GraphEdgeRow[],
|
|
414
|
+
fileIdToPath: ReadonlyMap<number, string>,
|
|
415
|
+
keptPaths: ReadonlySet<string>,
|
|
416
|
+
symbolFilter: OkfCodegraphSymbolFilter,
|
|
417
|
+
git: GitHints,
|
|
418
|
+
graphIndexedAt: string,
|
|
419
|
+
): string {
|
|
420
|
+
const visible =
|
|
421
|
+
symbolFilter === "all"
|
|
422
|
+
? [...fileNodes]
|
|
423
|
+
: symbolFilter === "exported"
|
|
424
|
+
? fileNodes.filter((n) => n.is_exported === 1)
|
|
425
|
+
: [];
|
|
426
|
+
visible.sort((a, b) => (a.name !== b.name ? a.name.localeCompare(b.name) : a.span_start - b.span_start));
|
|
427
|
+
const outEdges = edges
|
|
428
|
+
.filter((e) => e.src_file_id === file.id && fileIdToPath.get(e.src_file_id) === file.path)
|
|
429
|
+
.map((e) => ({
|
|
430
|
+
type: e.type,
|
|
431
|
+
verb: e.type.toLowerCase(),
|
|
432
|
+
dstPath: e.dst_path,
|
|
433
|
+
dstName: e.dst_name,
|
|
434
|
+
tier: confidenceTier(e.confidence),
|
|
435
|
+
}))
|
|
436
|
+
.sort((a, b) =>
|
|
437
|
+
a.type !== b.type
|
|
438
|
+
? a.type.localeCompare(b.type)
|
|
439
|
+
: a.dstPath !== b.dstPath
|
|
440
|
+
? a.dstPath.localeCompare(b.dstPath)
|
|
441
|
+
: a.dstName.localeCompare(b.dstName),
|
|
442
|
+
);
|
|
443
|
+
const fields: Record<string, unknown> = {
|
|
444
|
+
type: OKF_CODE_MODULE_TYPE,
|
|
445
|
+
title: file.path,
|
|
446
|
+
description: `${fileNodes.length} symbols, ${file.lang}`,
|
|
447
|
+
resource: moduleResource(git, file.path),
|
|
448
|
+
tags: [file.lang],
|
|
449
|
+
timestamp: graphIndexedAt,
|
|
450
|
+
};
|
|
451
|
+
let body = "";
|
|
452
|
+
if (symbolFilter !== "none") {
|
|
453
|
+
const rows = visible.map((n) => `| ${n.name} | ${n.label} | ${n.span_start}-${n.span_end} |`).join("\n");
|
|
454
|
+
body += `# Symbols\n\n| Name | Kind | Span (bytes) |\n|---|---|---|\n${rows}\n\n`;
|
|
455
|
+
}
|
|
456
|
+
if (outEdges.length > 0) {
|
|
457
|
+
const lines = outEdges.map((e) => {
|
|
458
|
+
// Broken links (target truncated out of the bundle) are legal per OKF
|
|
459
|
+
// §5.3 — the link records the relationship regardless of target presence.
|
|
460
|
+
const href = `/modules/${e.dstPath}.md`;
|
|
461
|
+
const label = e.verb === "calls" ? `${e.dstName}() in ${e.dstPath}` : e.dstPath;
|
|
462
|
+
const broken = keptPaths.has(e.dstPath) ? "" : " (link target not exported)";
|
|
463
|
+
return `- ${e.verb}: [${label}](${href}) (confidence: ${e.tier})${broken}`;
|
|
464
|
+
});
|
|
465
|
+
body += `# Dependencies\n\n${lines.join("\n")}\n\n`;
|
|
466
|
+
}
|
|
467
|
+
return renderFrontmatter(fields) + body.trimEnd() + "\n";
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function renderModulesIndex(files: readonly GraphFileRow[]): string {
|
|
471
|
+
const groups = new Map<string, GraphFileRow[]>();
|
|
472
|
+
for (const file of files) {
|
|
473
|
+
const key = file.path.includes("/") ? (file.path.split("/")[0] ?? "") : "(root)";
|
|
474
|
+
const list = groups.get(key) ?? [];
|
|
475
|
+
list.push(file);
|
|
476
|
+
groups.set(key, list);
|
|
477
|
+
}
|
|
478
|
+
const sections = [...groups.keys()].sort().map((key) => {
|
|
479
|
+
const lines = (groups.get(key) ?? [])
|
|
480
|
+
.sort((a, b) => a.path.localeCompare(b.path))
|
|
481
|
+
.map((f) => `* [${f.path}](/modules/${f.path}.md)`);
|
|
482
|
+
return `## ${key}\n\n${lines.join("\n")}`;
|
|
483
|
+
});
|
|
484
|
+
return `---\nokf_version: "${OKF_EXPORT_VERSION}"\n---\n\n# Code Modules\n\n${sections.join("\n\n")}\n`;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function renderDecisionsIndex(records: ReadonlyArray<{ record: DecisionRecord }>): string {
|
|
488
|
+
// ACTIVE set first — the single classification source (rule 53), never a
|
|
489
|
+
// re-derived list.
|
|
490
|
+
const orderedStatuses = [
|
|
491
|
+
...DECISION_STATUSES.filter((s) => ACTIVE_DECISION_STATUSES.has(s)),
|
|
492
|
+
...DECISION_STATUSES.filter((s) => !ACTIVE_DECISION_STATUSES.has(s)),
|
|
493
|
+
];
|
|
494
|
+
const byStatus = new Map<string, { record: DecisionRecord }[]>();
|
|
495
|
+
for (const entry of records) {
|
|
496
|
+
const list = byStatus.get(entry.record.status) ?? [];
|
|
497
|
+
list.push(entry);
|
|
498
|
+
byStatus.set(entry.record.status, list);
|
|
499
|
+
}
|
|
500
|
+
const sections: string[] = [];
|
|
501
|
+
for (const status of orderedStatuses) {
|
|
502
|
+
const list = byStatus.get(status);
|
|
503
|
+
if (!list || list.length === 0) continue;
|
|
504
|
+
const lines = list
|
|
505
|
+
.map((e) => e.record)
|
|
506
|
+
.sort((a, b) => a.title.localeCompare(b.title))
|
|
507
|
+
.map((r) => `* [${r.title}](/decisions/${decisionFileStem(r)}.md)`);
|
|
508
|
+
sections.push(`## ${status[0]!.toUpperCase()}${status.slice(1)}\n\n${lines.join("\n")}`);
|
|
509
|
+
}
|
|
510
|
+
return `---\nokf_version: "${OKF_EXPORT_VERSION}"\n---\n\n# Decision Records\n\n${sections.join("\n\n")}\n`;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function renderDecision(record: DecisionRecord, timestamp: string): string {
|
|
514
|
+
const fields: Record<string, unknown> = {
|
|
515
|
+
id: record.id,
|
|
516
|
+
title: record.title,
|
|
517
|
+
status: record.status,
|
|
518
|
+
context: record.context,
|
|
519
|
+
decision: record.decision,
|
|
520
|
+
...(record.consequences !== undefined ? { consequences: record.consequences } : {}),
|
|
521
|
+
entityRefs: record.entityRefs,
|
|
522
|
+
...(record.supersedes !== undefined ? { supersedes: record.supersedes } : {}),
|
|
523
|
+
type: OKF_DECISION_RECORD_TYPE,
|
|
524
|
+
timestamp,
|
|
525
|
+
};
|
|
526
|
+
const lines: string[] = [];
|
|
527
|
+
if (record.context) lines.push(record.context, "");
|
|
528
|
+
lines.push("# Decision", "");
|
|
529
|
+
if (record.decision) lines.push(record.decision, "");
|
|
530
|
+
if (record.consequences && record.consequences.length > 0) {
|
|
531
|
+
lines.push("# Consequences", "", record.consequences, "");
|
|
532
|
+
}
|
|
533
|
+
if (record.supersedes !== undefined) {
|
|
534
|
+
lines.push(`- supersedes: [${record.supersedes}](/decisions/${decisionFileStem({ id: record.supersedes })}.md)`, "");
|
|
535
|
+
}
|
|
536
|
+
return renderFrontmatter(fields) + lines.join("\n").trimEnd() + "\n";
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function renderRootIndex(
|
|
540
|
+
repoName: string,
|
|
541
|
+
projectId: string,
|
|
542
|
+
architectureCard: boolean,
|
|
543
|
+
decisions: number,
|
|
544
|
+
keptFiles: readonly GraphFileRow[],
|
|
545
|
+
totalFiles: readonly GraphFileRow[],
|
|
546
|
+
truncated: boolean,
|
|
547
|
+
): string {
|
|
548
|
+
const lines: string[] = [
|
|
549
|
+
`# ${repoName} Code Graph`,
|
|
550
|
+
"",
|
|
551
|
+
`- project: ${projectId}`,
|
|
552
|
+
architectureCard ? "- [Architecture card](/architecture.md)" : "- architecture card: none stored",
|
|
553
|
+
`- decision records: ${decisions}`,
|
|
554
|
+
`- code modules: ${keptFiles.length} of ${totalFiles.length} indexed files`,
|
|
555
|
+
"",
|
|
556
|
+
];
|
|
557
|
+
if (truncated) {
|
|
558
|
+
lines.push(
|
|
559
|
+
OKF_CODEGRAPH_TRUNCATION_MARKER,
|
|
560
|
+
`Truncated to the ${keptFiles.length} files with the most symbols of ${totalFiles.length} in the graph; raise --max-module-concepts to widen.`,
|
|
561
|
+
"",
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
return `---\nokf_version: "${OKF_EXPORT_VERSION}"\n---\n\n${lines.join("\n")}\n`;
|
|
565
|
+
}
|
package/src/config.test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
|
+
import type { FallbackLlmOptions } from "./fallback-llm.js";
|
|
3
4
|
|
|
4
5
|
import { parseConfig } from "./config.js";
|
|
5
6
|
import { ExtractionEngine } from "./extraction.js";
|
|
@@ -111,7 +112,11 @@ type LocalLlmFixture = {
|
|
|
111
112
|
};
|
|
112
113
|
|
|
113
114
|
type GatewayFixture = {
|
|
114
|
-
parseWithSchemaDetailed(
|
|
115
|
+
parseWithSchemaDetailed(
|
|
116
|
+
messages: ChatMessage[],
|
|
117
|
+
schema: unknown,
|
|
118
|
+
options?: FallbackLlmOptions,
|
|
119
|
+
): Promise<unknown>;
|
|
115
120
|
};
|
|
116
121
|
|
|
117
122
|
type DirectClientFixture = {
|
|
@@ -283,11 +288,13 @@ test("gateway extraction prompt uses placeholders and accepts an empty question
|
|
|
283
288
|
const engine = new ExtractionEngine(parseConfig({ modelSource: "gateway" }));
|
|
284
289
|
let calls = 0;
|
|
285
290
|
let prompt = "";
|
|
291
|
+
let nativeSchema: Record<string, unknown> | undefined;
|
|
286
292
|
|
|
287
293
|
const fallbackLlm: GatewayFixture = {
|
|
288
|
-
async parseWithSchemaDetailed(messages: ChatMessage[]) {
|
|
294
|
+
async parseWithSchemaDetailed(messages: ChatMessage[], _schema, options) {
|
|
289
295
|
calls += 1;
|
|
290
296
|
prompt = messages[0]?.content ?? "";
|
|
297
|
+
nativeSchema = options?.jsonSchema?.schema;
|
|
291
298
|
return { modelUsed: "fixture-gateway", result: SOURCE_GROUNDED_EXTRACTION };
|
|
292
299
|
},
|
|
293
300
|
};
|
|
@@ -298,6 +305,11 @@ test("gateway extraction prompt uses placeholders and accepts an empty question
|
|
|
298
305
|
assert.equal(calls, 1);
|
|
299
306
|
assertSourceGroundedResult(result);
|
|
300
307
|
assertSafeExtractionPrompt(prompt);
|
|
308
|
+
assert.match(prompt, /Return only valid JSON matching this shape/);
|
|
309
|
+
assert.equal(nativeSchema?.type, "object");
|
|
310
|
+
const properties = nativeSchema?.properties as Record<string, Record<string, unknown>>;
|
|
311
|
+
assert.equal(properties.facts?.type, "array");
|
|
312
|
+
assert.equal((properties.facts?.items as Record<string, unknown>)?.type, "object");
|
|
301
313
|
});
|
|
302
314
|
|
|
303
315
|
test("direct extraction prompt uses placeholders and accepts an empty question list", async () => {
|
package/src/extraction.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { shouldRunProactivePass } from "./proactive-contention.js";
|
|
|
7
7
|
import { FallbackLlmClient, fallbackLlmRuntimeContextFromConfig, gatewayTaskChainOptions } from "./fallback-llm.js";
|
|
8
8
|
import { revalidateDependentsViaLlm, type RevalidationFastChatCompletion } from "./orchestration/dependency-revalidation.js";
|
|
9
9
|
import {
|
|
10
|
+
ExtractionProviderOutputSchema,
|
|
10
11
|
ExtractionResultSchema,
|
|
11
12
|
ConsolidationResultSchema,
|
|
12
13
|
IdentityConsolidationResultSchema,
|
|
@@ -60,6 +61,7 @@ import {
|
|
|
60
61
|
buildProfileConsolidationSystemPrompt,
|
|
61
62
|
eventTimePromptInstruction,
|
|
62
63
|
} from "./extraction-prompt.js";
|
|
64
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
63
65
|
import {
|
|
64
66
|
containsExtractionPlaceholder,
|
|
65
67
|
extractionAttributes,
|
|
@@ -77,6 +79,14 @@ type ExtractedRelationshipResult = NonNullable<ExtractionResult["relationships"]
|
|
|
77
79
|
|
|
78
80
|
const PROACTIVE_MIN_CONFIDENCE = 0.8;
|
|
79
81
|
|
|
82
|
+
const EXTRACTION_PROVIDER_JSON_SCHEMA = zodToJsonSchema(
|
|
83
|
+
ExtractionProviderOutputSchema,
|
|
84
|
+
{
|
|
85
|
+
$refStrategy: "none",
|
|
86
|
+
effectStrategy: "input",
|
|
87
|
+
},
|
|
88
|
+
) as Record<string, unknown>;
|
|
89
|
+
|
|
80
90
|
function extractionEntityType(value: unknown): ExtractedEntityResult["type"] | undefined {
|
|
81
91
|
const type = extractionText(value);
|
|
82
92
|
if (
|
|
@@ -1289,7 +1299,12 @@ export class ExtractionEngine {
|
|
|
1289
1299
|
this.profiler.startSpan("gateway-fallback", extractionTraceId);
|
|
1290
1300
|
try {
|
|
1291
1301
|
const messages = [
|
|
1292
|
-
{
|
|
1302
|
+
{
|
|
1303
|
+
role: "system" as const,
|
|
1304
|
+
content:
|
|
1305
|
+
buildExtractionInstructions(this.config, existingEntities, ambientCapture) +
|
|
1306
|
+
`\n\nReturn only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:\n${EXTRACTION_RESPONSE_SHAPE}`,
|
|
1307
|
+
},
|
|
1293
1308
|
{ role: "user" as const, content: conversation },
|
|
1294
1309
|
];
|
|
1295
1310
|
|
|
@@ -1302,6 +1317,11 @@ export class ExtractionEngine {
|
|
|
1302
1317
|
temperature: 0.3,
|
|
1303
1318
|
maxTokens: this.config.extractionMaxOutputTokens,
|
|
1304
1319
|
timeoutMs: this.config.localLlmTimeoutMs,
|
|
1320
|
+
jsonSchema: {
|
|
1321
|
+
name: "extraction_result",
|
|
1322
|
+
schema: EXTRACTION_PROVIDER_JSON_SCHEMA,
|
|
1323
|
+
strict: false,
|
|
1324
|
+
},
|
|
1305
1325
|
signal,
|
|
1306
1326
|
}),
|
|
1307
1327
|
);
|