@remnic/core 9.69.50 → 9.69.52
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 +14 -14
- package/dist/access-admin-ops-surface.js +60 -60
- package/dist/access-audit.d.ts +1 -0
- package/dist/access-audit.js +2 -2
- package/dist/access-authorization-probe.d.ts +14 -14
- package/dist/access-authorization-probe.js +61 -61
- package/dist/access-boundary.d.ts +14 -14
- package/dist/access-boundary.js +60 -60
- package/dist/access-cli.js +121 -120
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +1 -1
- package/dist/access-extraction-force-flush.d.ts +14 -14
- package/dist/access-extraction-force-flush.js +60 -60
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-briefing.d.ts +14 -14
- package/dist/access-http-briefing.js +61 -61
- package/dist/access-http-lcm-compaction.d.ts +14 -14
- package/dist/access-http-lifecycle-flush.d.ts +14 -14
- package/dist/access-http-offline-stream.d.ts +14 -14
- package/dist/access-http-query.d.ts +2 -2
- package/dist/access-http-query.js +62 -62
- package/dist/access-http.d.ts +15 -15
- package/dist/access-http.js +80 -80
- package/dist/access-identity-continuity-surface.d.ts +11 -11
- package/dist/access-identity-continuity-surface.js +60 -60
- package/dist/access-lcm-surface.d.ts +14 -14
- package/dist/access-lcm-surface.js +60 -60
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp-shared-context-tools.d.ts +14 -14
- package/dist/access-mcp.d.ts +14 -14
- package/dist/access-mcp.js +71 -71
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-C1q3XuAc.d.ts → access-namespace-preflight-U9RAdxqZ.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +60 -60
- package/dist/access-observe-transcript.d.ts +11 -11
- package/dist/access-observe-write-category.d.ts +3 -3
- package/dist/access-observe-write-category.js +7 -7
- package/dist/access-observe-write-surface.d.ts +14 -14
- package/dist/access-observe-write-surface.js +60 -60
- package/dist/access-offline-manifest.d.ts +11 -11
- package/dist/access-offline-manifest.js +5 -5
- package/dist/access-operations-batch.js +62 -62
- package/dist/access-operations.d.ts +14 -14
- package/dist/access-operations.js +69 -69
- package/dist/access-recall-concurrency.d.ts +14 -14
- package/dist/access-recall-concurrency.js +60 -60
- package/dist/access-recall-response.d.ts +14 -14
- package/dist/access-recall-response.js +60 -60
- package/dist/access-recall-surface.d.ts +15 -15
- package/dist/access-recall-surface.js +60 -60
- package/dist/access-schema.d.ts +1 -1
- package/dist/access-schema.js +4 -4
- package/dist/{access-service-BZaC-RZw.d.ts → access-service-CUNM5RfA.d.ts} +9 -9
- package/dist/access-service-helpers.d.ts +14 -14
- package/dist/access-service.d.ts +14 -14
- package/dist/access-service.js +60 -60
- package/dist/access-surface-catalog.d.ts +14 -14
- package/dist/access-surface-catalog.js +62 -62
- package/dist/access-wearables-meetings-surface.d.ts +4 -4
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +73 -2
- package/dist/active-recall.js.map +1 -1
- package/dist/activity/digest.d.ts +1 -1
- package/dist/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/{auto-sync-DG5KEOF5.js → auto-sync-CWSZDLLW.js} +6 -6
- package/dist/background-generation.d.ts +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +11 -11
- package/dist/briefing-window.d.ts +2 -2
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +12 -12
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/buffer.js +4 -4
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/{catalog-DK2eHhax.d.ts → catalog-BuMyYPUn.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +19 -19
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-3SI3FFTW.js → chunk-2INZSV27.js} +2 -2
- package/dist/{chunk-PMLFPVYJ.js → chunk-2QZJ4P27.js} +2 -2
- package/dist/{chunk-3RZB7TYL.js → chunk-2UDAABV6.js} +2 -2
- package/dist/{chunk-4PXFLDMJ.js → chunk-35EH6KW4.js} +2 -2
- package/dist/{chunk-KOEDSRF5.js → chunk-43IQRLEF.js} +2 -2
- package/dist/{chunk-LBLXEFWK.js → chunk-4MN27537.js} +1 -1
- package/dist/chunk-4MN27537.js.map +1 -0
- package/dist/{chunk-PQWICTRO.js → chunk-4UVJ6EIT.js} +1 -1
- package/dist/chunk-4UVJ6EIT.js.map +1 -0
- package/dist/{chunk-56C7OO3N.js → chunk-6KCQNFDQ.js} +18 -18
- package/dist/chunk-6VITOSPL.js +69 -0
- package/dist/chunk-6VITOSPL.js.map +1 -0
- package/dist/{chunk-UD6W67JM.js → chunk-72AV2H3R.js} +76 -25
- package/dist/chunk-72AV2H3R.js.map +1 -0
- package/dist/{chunk-VBRS7Z3O.js → chunk-72N2P44O.js} +5 -5
- package/dist/{chunk-ZUNYFDI4.js → chunk-7QVYVSEH.js} +2 -2
- package/dist/{chunk-SRMBMMTK.js → chunk-7RKAE6Y4.js} +3 -3
- package/dist/{chunk-42BV46XS.js → chunk-AH44WTLJ.js} +2 -2
- package/dist/{chunk-TZ44E732.js → chunk-AIVRD66I.js} +2 -2
- package/dist/{chunk-AYGWJ2UK.js → chunk-AQWGCHIV.js} +6 -6
- package/dist/{chunk-EZV43XBD.js → chunk-AYHNTYVG.js} +2 -2
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-JHUODJRW.js → chunk-D2N3PMAE.js} +2 -2
- package/dist/{chunk-7SJCSDQ3.js → chunk-D7VT2LED.js} +2 -2
- package/dist/{chunk-TVVEYCNW.js → chunk-DAOMWGO2.js} +2 -2
- package/dist/{chunk-OQZYHCWM.js → chunk-DCRK7I5E.js} +72 -71
- package/dist/{chunk-OQZYHCWM.js.map → chunk-DCRK7I5E.js.map} +1 -1
- package/dist/{chunk-MVMNEU65.js → chunk-DI52XAKG.js} +2 -2
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-EUP4AXIW.js → chunk-DZP2XMZC.js} +2 -2
- package/dist/{chunk-PA5EOTRR.js → chunk-EVQ33D3N.js} +4 -4
- package/dist/{chunk-E64HBW7M.js → chunk-EW3Y73MN.js} +5 -5
- package/dist/{chunk-VSN2DMQK.js → chunk-G2DF5MI7.js} +4 -4
- package/dist/{chunk-JIWZVOQM.js → chunk-G7S37WD4.js} +2 -2
- package/dist/{chunk-AL7OLBL7.js → chunk-GRX6YH4E.js} +2 -2
- package/dist/{chunk-XTMABIFW.js → chunk-HG42J2EX.js} +2 -2
- package/dist/{chunk-MQMZO23A.js → chunk-HWT6KRGS.js} +2 -2
- package/dist/{chunk-LR7KUQ2W.js → chunk-IEOBAOA6.js} +6 -6
- package/dist/{chunk-UDAUULK2.js → chunk-IGEZE6QB.js} +5 -5
- package/dist/{chunk-SGHGCFVV.js → chunk-JE334SIA.js} +10 -10
- package/dist/{chunk-IC3PM3YO.js → chunk-JE4H2QBO.js} +2 -2
- package/dist/{chunk-E73SVGJA.js → chunk-JMZQS6OS.js} +2 -2
- package/dist/{chunk-3RABJOGD.js → chunk-KH2D26LQ.js} +5 -5
- package/dist/{chunk-3MIZ2EKQ.js → chunk-KQQEZTH6.js} +2 -2
- package/dist/{chunk-F5V7KRQS.js → chunk-LIAKZGOY.js} +2 -2
- package/dist/{chunk-A7GQBJP5.js → chunk-LVFI5LG7.js} +7 -7
- package/dist/{chunk-IST6MBYC.js → chunk-MSTKJI5T.js} +529 -376
- package/dist/chunk-MSTKJI5T.js.map +1 -0
- package/dist/{chunk-DH536WT2.js → chunk-MWVYHNSU.js} +12 -2
- package/dist/chunk-MWVYHNSU.js.map +1 -0
- package/dist/{chunk-D7QX26FF.js → chunk-O7OVWKT4.js} +2 -2
- package/dist/{chunk-JOP7W24J.js → chunk-PLJ2MQFT.js} +4 -4
- package/dist/{chunk-D2XUSZ24.js → chunk-QWQB7TOB.js} +20 -20
- package/dist/{chunk-HRCWDO6S.js → chunk-RSMNPYBM.js} +2 -2
- package/dist/{chunk-BOTSR5S3.js → chunk-RUUJXAGT.js} +2 -2
- package/dist/{chunk-FO6IK4IF.js → chunk-SEQ6DWXD.js} +11 -11
- package/dist/{chunk-ZBAQMSEY.js → chunk-SLGD36MM.js} +3 -3
- package/dist/{chunk-IYHHCSF6.js → chunk-SOFATSHJ.js} +61 -61
- package/dist/{chunk-JG4AP36X.js → chunk-SPFNGHHP.js} +2 -2
- package/dist/{chunk-DNO6QWCB.js → chunk-SPWNCGSM.js} +2 -2
- package/dist/{chunk-QSP4Y73Q.js → chunk-SVUUOLKM.js} +2 -2
- package/dist/{chunk-D6WX5FEF.js → chunk-SZ7IVZGD.js} +2 -2
- package/dist/{chunk-2IVHOQRY.js → chunk-TEQQQTQS.js} +5 -5
- package/dist/{chunk-UI6R2YUB.js → chunk-TQT4AOPO.js} +4 -4
- package/dist/{chunk-3UQIS2GC.js → chunk-TTFJQ5B5.js} +2 -2
- package/dist/{chunk-JTPAXDSX.js → chunk-U2SK45U3.js} +2 -2
- package/dist/{chunk-4FWNMN5R.js → chunk-U6CMLAP4.js} +5 -5
- package/dist/{chunk-6525YIYL.js → chunk-UCH2RWFX.js} +3 -3
- package/dist/{chunk-QZDUNK6V.js → chunk-UCY4EHAG.js} +6 -6
- package/dist/{chunk-OP5IBPHP.js → chunk-UDJMJNBK.js} +2 -2
- package/dist/{chunk-BHI5ILU5.js → chunk-ULQVG6G3.js} +2 -2
- package/dist/{chunk-X6B2QWXW.js → chunk-UQTXER7M.js} +2 -2
- package/dist/{chunk-OLJYDGGP.js → chunk-UVZBDIJX.js} +214 -4
- package/dist/chunk-UVZBDIJX.js.map +1 -0
- package/dist/{chunk-QXQCPNKA.js → chunk-V5BU5PVE.js} +7 -7
- package/dist/{chunk-IPLYGWQF.js → chunk-VDX2J7OX.js} +6 -6
- package/dist/{chunk-XUKUMBP3.js → chunk-VGO57TU7.js} +5 -5
- package/dist/{chunk-W6V7JN2E.js → chunk-VUV472VH.js} +12 -12
- package/dist/{chunk-ZHXSOMYH.js → chunk-VVX5PZFS.js} +2 -2
- package/dist/{chunk-ML5FW2RO.js → chunk-WBW34YCJ.js} +2 -2
- package/dist/{chunk-ECLY4NZA.js → chunk-WH7RINGG.js} +10 -4
- package/dist/chunk-WH7RINGG.js.map +1 -0
- package/dist/{chunk-FDDCZDBI.js → chunk-WN4HFL4K.js} +4 -4
- package/dist/{chunk-MECKA6G2.js → chunk-WUJD4CHZ.js} +4 -4
- package/dist/{chunk-HS75MCQF.js → chunk-WUUGE7QC.js} +4 -4
- package/dist/{chunk-UVEBBXB5.js → chunk-X7WAM3IY.js} +2 -2
- package/dist/{chunk-4SDO74N2.js → chunk-XPFJSUOR.js} +5 -5
- package/dist/{chunk-PPNFKQ6D.js → chunk-Y4G6LHJW.js} +2 -2
- package/dist/{chunk-C3PKRFZ4.js → chunk-Y7LZ5V7N.js} +2 -2
- package/dist/{chunk-WVI43D54.js → chunk-YEIKOBOW.js} +15 -2
- package/dist/chunk-YEIKOBOW.js.map +1 -0
- package/dist/{chunk-AYP2FZFA.js → chunk-YIIW2OH2.js} +2 -2
- package/dist/{chunk-YSBYNCCN.js → chunk-YLPCEUXP.js} +3 -3
- package/dist/{chunk-RFIJH2OE.js → chunk-YUHGJBQK.js} +2 -2
- package/dist/{cli-BHDMJqJS.d.ts → cli-CCc34xV7.d.ts} +5 -5
- package/dist/cli.d.ts +16 -16
- package/dist/cli.js +98 -98
- package/dist/coding/export-okf-codegraph.d.ts +1 -1
- package/dist/coding/export-okf-codegraph.js +12 -12
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +11 -11
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +73 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +15 -15
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +19 -19
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +4 -4
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +13 -13
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/corpus-watermark.d.ts +1 -1
- package/dist/corpus-watermark.js +13 -13
- package/dist/cross-lingual-recall.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/deep-recall-http-glue.d.ts +14 -14
- package/dist/deep-recall-http-glue.js +5 -5
- package/dist/deep-recall-mcp-tools.d.ts +14 -14
- package/dist/deep-recall-policy-llm.d.ts +2 -2
- package/dist/deep-recall-seeds.d.ts +1 -1
- package/dist/deep-recall.js +2 -2
- package/dist/delinearize.d.ts +1 -1
- package/dist/dependency-propagation-config.d.ts +1 -1
- package/dist/{dependency-propagation-delivery-BMkR4gmY.d.ts → dependency-propagation-delivery-BrhPjAHQ.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/directory-sidecars.d.ts +28 -2
- package/dist/directory-sidecars.js +9 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-origin-fields.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +2 -2
- package/dist/entity-retrieval.js +11 -11
- package/dist/entity-schema.d.ts +1 -1
- package/dist/episodic-context.d.ts +1 -1
- package/dist/eval-trajectory-contracts.d.ts +1 -1
- package/dist/eval-trajectory-store.d.ts +1 -1
- package/dist/eval-trajectory.d.ts +1 -1
- package/dist/explicit-capture.d.ts +11 -11
- package/dist/external-wiki-access.d.ts +14 -14
- package/dist/external-wiki-access.js +61 -61
- package/dist/external-wiki-collection-registration.d.ts +1 -1
- package/dist/external-wiki-collection.d.ts +1 -1
- package/dist/external-wiki-mcp-tools.d.ts +14 -14
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-evidence-class.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +2 -2
- package/dist/extraction-judge-telemetry.d.ts +2 -2
- package/dist/extraction-judge-training.d.ts +2 -2
- package/dist/extraction-judge.d.ts +2 -2
- package/dist/extraction-judge.js +2 -2
- package/dist/extraction-liveness.d.ts +1 -1
- package/dist/extraction-normalization.d.ts +1 -1
- package/dist/extraction-prompt.d.ts +1 -1
- package/dist/extraction-source-grounding-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction-span-config.d.ts +1 -1
- package/dist/extraction-span-materialize.d.ts +1 -1
- package/dist/extraction-span-wire.d.ts +1 -1
- package/dist/extraction.d.ts +2 -2
- package/dist/extraction.js +21 -21
- package/dist/fallback-llm-codex-subscription.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{generic-recall-paths-BCRtXU32.d.ts → generic-recall-paths-C0J1Oxb7.d.ts} +1 -1
- package/dist/graph-append-error.d.ts +1 -1
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-jsonl.d.ts +1 -1
- package/dist/graph-path-reconstruction.d.ts +1 -1
- package/dist/graph-path-scoring.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/harmonic-retrieval.js +2 -2
- package/dist/importance.d.ts +1 -1
- package/dist/importers/index.d.ts +1 -1
- package/dist/importers/test-utils.d.ts +1 -1
- package/dist/in-flight-reads.d.ts +1 -1
- package/dist/{index-DMNTW4W6.d.ts → index-B735x-tK.d.ts} +3 -3
- package/dist/index.d.ts +28 -26
- package/dist/index.js +208 -198
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +8 -8
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/{local-llm-BXYC-mbU.d.ts → local-llm-BkkEK9rn.d.ts} +1 -1
- package/dist/local-llm-helpers.d.ts +2 -2
- package/dist/local-llm.d.ts +2 -2
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/location/index.d.ts +5 -5
- package/dist/location/index.js +15 -15
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +11 -11
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -11
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +12 -12
- package/dist/{maintenance-zJiLsKBY.d.ts → maintenance-CLBIvVxg.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +14 -14
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-browse-http-glue.d.ts +14 -14
- package/dist/memory-browse-mcp-tools.d.ts +14 -14
- package/dist/memory-browse-operations.js +61 -61
- package/dist/memory-browse.d.ts +1 -1
- package/dist/memory-browse.js +5 -5
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-controller.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-snapshot.d.ts +1 -1
- package/dist/memory-subject-cli.d.ts +14 -14
- package/dist/memory-subject.d.ts +14 -14
- package/dist/memory-worth-outcomes.d.ts +2 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +12 -12
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +3 -3
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +11 -11
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/offline-sync-impression-drain.js +3 -3
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +16 -16
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +40 -40
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +22 -22
- package/dist/{orchestrator-BTqT3F6X.d.ts → orchestrator-iexgVLow.d.ts} +13 -11
- package/dist/orchestrator.d.ts +11 -11
- package/dist/orchestrator.js +121 -120
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-CgO2Sd4O.d.ts → pipeline-DvtDtyo9.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/proactive-contention.d.ts +2 -2
- package/dist/provenance.d.ts +1 -1
- package/dist/{public-http-Dk1EA9ix.d.ts → public-http-UWVcqMcb.d.ts} +1 -1
- package/dist/{qmd-CwxtVz64.d.ts → qmd-CBYBJ6HW.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-audit-anomaly.d.ts +1 -0
- package/dist/recall-audit.d.ts +4 -0
- package/dist/recall-audit.js +1 -1
- package/dist/recall-composition-decision.d.ts +41 -0
- package/dist/recall-composition-decision.js +17 -0
- package/dist/recall-composition-decision.js.map +1 -0
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +2 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +1 -1
- package/dist/recall-navigate-access.d.ts +1 -1
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.d.ts +1 -1
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate.d.ts +1 -1
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation-http-glue.d.ts +14 -14
- package/dist/recall-navigation-mcp-tools.d.ts +14 -14
- package/dist/recall-navigation-operations.js +61 -61
- package/dist/recall-navigation-renderer.d.ts +2 -1
- package/dist/recall-navigation.d.ts +2 -1
- package/dist/recall-navigation.js +60 -60
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state-view-admission.d.ts +2 -2
- package/dist/recall-state-view-admission.js +5 -5
- package/dist/recall-state-view-anchors.d.ts +1 -1
- package/dist/recall-state-view-anchors.js +2 -2
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +2 -1
- package/dist/recall-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +2 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +2 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +10 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/manifest.js +1 -1
- package/dist/reconcile/plan.d.ts +1 -1
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +73 -3
- package/dist/retrieval-agents.d.ts +2 -2
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/salvage-envelope.d.ts +1 -1
- package/dist/{scope-profiles-Bg1rB-Dp.d.ts → scope-profiles-BN1Dgfha.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +2 -2
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +4 -4
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-DEzRyeyn.d.ts → semantic-consolidation-D--qe0eE.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +16 -16
- package/dist/semantic-rule-promotion.js +11 -11
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +11 -11
- package/dist/{service-DGEIDOeD.d.ts → service-VealHeqO.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +20 -20
- package/dist/standup/build.js +12 -12
- package/dist/{storage-DNQWtOSM.d.ts → storage-CMm-3aD3.d.ts} +1 -1
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +10 -10
- package/dist/subject-config.d.ts +1 -1
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +17 -17
- package/dist/support-passport/index.js +63 -63
- package/dist/{tagging-CPVwgadt.d.ts → tagging-BjsNFKWz.d.ts} +2 -2
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-timeline-recall.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-okf.d.ts +1 -1
- package/dist/transfer/export-okf.js +11 -11
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-DCB90q3g.d.ts → types-Du6VdoAg.d.ts} +22 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +11 -11
- package/dist/who-knows-cli.d.ts +14 -14
- package/dist/who-knows-cli.js +12 -12
- package/dist/who-knows.d.ts +14 -14
- package/dist/who-knows.js +11 -11
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -2
- package/src/access-mcp-output-schemas.ts +14 -1
- package/src/access-recall-response.ts +3 -0
- package/src/config.ts +3 -4
- package/src/directory-sidecars.test.ts +119 -0
- package/src/directory-sidecars.ts +110 -25
- package/src/experience/session-experience-recall.test.ts +228 -0
- package/src/experience/session-experience-recall.ts +60 -0
- package/src/index.ts +1 -0
- package/src/lifecycle/seed-graduation-config-types.ts +22 -0
- package/src/lifecycle/seed-graduation.test.ts +160 -1
- package/src/lifecycle/seed-graduation.ts +7 -9
- package/src/orchestration/lifecycle-policy-coordinator.ts +12 -0
- package/src/orchestration/recall-entry.ts +16 -2
- package/src/orchestration/recall-internal.ts +21 -18
- package/src/orchestration/recall-recognition-search.test.ts +290 -0
- package/src/orchestration/recall-recognition-search.ts +160 -0
- package/src/orchestrator.ts +1 -0
- package/src/procedural/procedure-recall.ts +14 -3
- package/src/recall-audit.test.ts +34 -0
- package/src/recall-audit.ts +4 -0
- package/src/recall-composition-decision.test.ts +134 -0
- package/src/recall-composition-decision.ts +113 -0
- package/src/recall-xray-renderer.test.ts +17 -0
- package/src/recall-xray-renderer.ts +10 -0
- package/src/recall-xray.test.ts +28 -0
- package/src/recall-xray.ts +15 -0
- package/src/testing/subjects/recall-recognition-tier.test.ts +106 -0
- package/src/types.ts +4 -6
- package/dist/chunk-DH536WT2.js.map +0 -1
- package/dist/chunk-ECLY4NZA.js.map +0 -1
- package/dist/chunk-IST6MBYC.js.map +0 -1
- package/dist/chunk-LBLXEFWK.js.map +0 -1
- package/dist/chunk-OLJYDGGP.js.map +0 -1
- package/dist/chunk-PQWICTRO.js.map +0 -1
- package/dist/chunk-UD6W67JM.js.map +0 -1
- package/dist/chunk-WVI43D54.js.map +0 -1
- /package/dist/{auto-sync-DG5KEOF5.js.map → auto-sync-CWSZDLLW.js.map} +0 -0
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-3SI3FFTW.js.map → chunk-2INZSV27.js.map} +0 -0
- /package/dist/{chunk-PMLFPVYJ.js.map → chunk-2QZJ4P27.js.map} +0 -0
- /package/dist/{chunk-3RZB7TYL.js.map → chunk-2UDAABV6.js.map} +0 -0
- /package/dist/{chunk-4PXFLDMJ.js.map → chunk-35EH6KW4.js.map} +0 -0
- /package/dist/{chunk-KOEDSRF5.js.map → chunk-43IQRLEF.js.map} +0 -0
- /package/dist/{chunk-56C7OO3N.js.map → chunk-6KCQNFDQ.js.map} +0 -0
- /package/dist/{chunk-VBRS7Z3O.js.map → chunk-72N2P44O.js.map} +0 -0
- /package/dist/{chunk-ZUNYFDI4.js.map → chunk-7QVYVSEH.js.map} +0 -0
- /package/dist/{chunk-SRMBMMTK.js.map → chunk-7RKAE6Y4.js.map} +0 -0
- /package/dist/{chunk-42BV46XS.js.map → chunk-AH44WTLJ.js.map} +0 -0
- /package/dist/{chunk-TZ44E732.js.map → chunk-AIVRD66I.js.map} +0 -0
- /package/dist/{chunk-AYGWJ2UK.js.map → chunk-AQWGCHIV.js.map} +0 -0
- /package/dist/{chunk-EZV43XBD.js.map → chunk-AYHNTYVG.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-JHUODJRW.js.map → chunk-D2N3PMAE.js.map} +0 -0
- /package/dist/{chunk-7SJCSDQ3.js.map → chunk-D7VT2LED.js.map} +0 -0
- /package/dist/{chunk-TVVEYCNW.js.map → chunk-DAOMWGO2.js.map} +0 -0
- /package/dist/{chunk-MVMNEU65.js.map → chunk-DI52XAKG.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-EUP4AXIW.js.map → chunk-DZP2XMZC.js.map} +0 -0
- /package/dist/{chunk-PA5EOTRR.js.map → chunk-EVQ33D3N.js.map} +0 -0
- /package/dist/{chunk-E64HBW7M.js.map → chunk-EW3Y73MN.js.map} +0 -0
- /package/dist/{chunk-VSN2DMQK.js.map → chunk-G2DF5MI7.js.map} +0 -0
- /package/dist/{chunk-JIWZVOQM.js.map → chunk-G7S37WD4.js.map} +0 -0
- /package/dist/{chunk-AL7OLBL7.js.map → chunk-GRX6YH4E.js.map} +0 -0
- /package/dist/{chunk-XTMABIFW.js.map → chunk-HG42J2EX.js.map} +0 -0
- /package/dist/{chunk-MQMZO23A.js.map → chunk-HWT6KRGS.js.map} +0 -0
- /package/dist/{chunk-LR7KUQ2W.js.map → chunk-IEOBAOA6.js.map} +0 -0
- /package/dist/{chunk-UDAUULK2.js.map → chunk-IGEZE6QB.js.map} +0 -0
- /package/dist/{chunk-SGHGCFVV.js.map → chunk-JE334SIA.js.map} +0 -0
- /package/dist/{chunk-IC3PM3YO.js.map → chunk-JE4H2QBO.js.map} +0 -0
- /package/dist/{chunk-E73SVGJA.js.map → chunk-JMZQS6OS.js.map} +0 -0
- /package/dist/{chunk-3RABJOGD.js.map → chunk-KH2D26LQ.js.map} +0 -0
- /package/dist/{chunk-3MIZ2EKQ.js.map → chunk-KQQEZTH6.js.map} +0 -0
- /package/dist/{chunk-F5V7KRQS.js.map → chunk-LIAKZGOY.js.map} +0 -0
- /package/dist/{chunk-A7GQBJP5.js.map → chunk-LVFI5LG7.js.map} +0 -0
- /package/dist/{chunk-D7QX26FF.js.map → chunk-O7OVWKT4.js.map} +0 -0
- /package/dist/{chunk-JOP7W24J.js.map → chunk-PLJ2MQFT.js.map} +0 -0
- /package/dist/{chunk-D2XUSZ24.js.map → chunk-QWQB7TOB.js.map} +0 -0
- /package/dist/{chunk-HRCWDO6S.js.map → chunk-RSMNPYBM.js.map} +0 -0
- /package/dist/{chunk-BOTSR5S3.js.map → chunk-RUUJXAGT.js.map} +0 -0
- /package/dist/{chunk-FO6IK4IF.js.map → chunk-SEQ6DWXD.js.map} +0 -0
- /package/dist/{chunk-ZBAQMSEY.js.map → chunk-SLGD36MM.js.map} +0 -0
- /package/dist/{chunk-IYHHCSF6.js.map → chunk-SOFATSHJ.js.map} +0 -0
- /package/dist/{chunk-JG4AP36X.js.map → chunk-SPFNGHHP.js.map} +0 -0
- /package/dist/{chunk-DNO6QWCB.js.map → chunk-SPWNCGSM.js.map} +0 -0
- /package/dist/{chunk-QSP4Y73Q.js.map → chunk-SVUUOLKM.js.map} +0 -0
- /package/dist/{chunk-D6WX5FEF.js.map → chunk-SZ7IVZGD.js.map} +0 -0
- /package/dist/{chunk-2IVHOQRY.js.map → chunk-TEQQQTQS.js.map} +0 -0
- /package/dist/{chunk-UI6R2YUB.js.map → chunk-TQT4AOPO.js.map} +0 -0
- /package/dist/{chunk-3UQIS2GC.js.map → chunk-TTFJQ5B5.js.map} +0 -0
- /package/dist/{chunk-JTPAXDSX.js.map → chunk-U2SK45U3.js.map} +0 -0
- /package/dist/{chunk-4FWNMN5R.js.map → chunk-U6CMLAP4.js.map} +0 -0
- /package/dist/{chunk-6525YIYL.js.map → chunk-UCH2RWFX.js.map} +0 -0
- /package/dist/{chunk-QZDUNK6V.js.map → chunk-UCY4EHAG.js.map} +0 -0
- /package/dist/{chunk-OP5IBPHP.js.map → chunk-UDJMJNBK.js.map} +0 -0
- /package/dist/{chunk-BHI5ILU5.js.map → chunk-ULQVG6G3.js.map} +0 -0
- /package/dist/{chunk-X6B2QWXW.js.map → chunk-UQTXER7M.js.map} +0 -0
- /package/dist/{chunk-QXQCPNKA.js.map → chunk-V5BU5PVE.js.map} +0 -0
- /package/dist/{chunk-IPLYGWQF.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-XUKUMBP3.js.map → chunk-VGO57TU7.js.map} +0 -0
- /package/dist/{chunk-W6V7JN2E.js.map → chunk-VUV472VH.js.map} +0 -0
- /package/dist/{chunk-ZHXSOMYH.js.map → chunk-VVX5PZFS.js.map} +0 -0
- /package/dist/{chunk-ML5FW2RO.js.map → chunk-WBW34YCJ.js.map} +0 -0
- /package/dist/{chunk-FDDCZDBI.js.map → chunk-WN4HFL4K.js.map} +0 -0
- /package/dist/{chunk-MECKA6G2.js.map → chunk-WUJD4CHZ.js.map} +0 -0
- /package/dist/{chunk-HS75MCQF.js.map → chunk-WUUGE7QC.js.map} +0 -0
- /package/dist/{chunk-UVEBBXB5.js.map → chunk-X7WAM3IY.js.map} +0 -0
- /package/dist/{chunk-4SDO74N2.js.map → chunk-XPFJSUOR.js.map} +0 -0
- /package/dist/{chunk-PPNFKQ6D.js.map → chunk-Y4G6LHJW.js.map} +0 -0
- /package/dist/{chunk-C3PKRFZ4.js.map → chunk-Y7LZ5V7N.js.map} +0 -0
- /package/dist/{chunk-AYP2FZFA.js.map → chunk-YIIW2OH2.js.map} +0 -0
- /package/dist/{chunk-YSBYNCCN.js.map → chunk-YLPCEUXP.js.map} +0 -0
- /package/dist/{chunk-RFIJH2OE.js.map → chunk-YUHGJBQK.js.map} +0 -0
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
loadSyncState,
|
|
7
7
|
syncWearableSource,
|
|
8
8
|
wearableSourceLabel
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YLPCEUXP.js";
|
|
10
10
|
import {
|
|
11
11
|
CompressionGuidelineCoordinator
|
|
12
12
|
} from "./chunk-UXREWVW4.js";
|
|
13
13
|
import {
|
|
14
14
|
ActivityStore,
|
|
15
15
|
MaintenanceScheduler
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IEOBAOA6.js";
|
|
17
17
|
import {
|
|
18
18
|
runPeerProfileReasoner
|
|
19
19
|
} from "./chunk-I74SUMNI.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-VZAKYDMJ.js";
|
|
23
23
|
import {
|
|
24
24
|
LcmEngine
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LVFI5LG7.js";
|
|
26
26
|
import {
|
|
27
27
|
chunkTranscriptEntries
|
|
28
28
|
} from "./chunk-TECVW3JP.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
CompoundingEngine,
|
|
34
34
|
defaultTierMigrationCycleBudget
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-KQQEZTH6.js";
|
|
36
36
|
import {
|
|
37
37
|
SharedContextManager
|
|
38
38
|
} from "./chunk-Z22M4JCY.js";
|
|
@@ -44,6 +44,9 @@ import {
|
|
|
44
44
|
applyUtilityRankingRuntimeDelta,
|
|
45
45
|
loadUtilityRuntimeValues
|
|
46
46
|
} from "./chunk-SWIKABKI.js";
|
|
47
|
+
import {
|
|
48
|
+
TmtBuilder
|
|
49
|
+
} from "./chunk-ECZU5BJH.js";
|
|
47
50
|
import {
|
|
48
51
|
extractTopics
|
|
49
52
|
} from "./chunk-KVDUKH5E.js";
|
|
@@ -59,9 +62,6 @@ import {
|
|
|
59
62
|
import {
|
|
60
63
|
decideTierTransition
|
|
61
64
|
} from "./chunk-GCBIXUPT.js";
|
|
62
|
-
import {
|
|
63
|
-
TmtBuilder
|
|
64
|
-
} from "./chunk-ECZU5BJH.js";
|
|
65
65
|
import {
|
|
66
66
|
buildTargetedFactRecallSection,
|
|
67
67
|
shouldRecallTargetedFactEvidence
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
import {
|
|
112
112
|
indexStateViewAnnotatedResults,
|
|
113
113
|
resolveRecallStateViewActive
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-72N2P44O.js";
|
|
115
115
|
import {
|
|
116
116
|
applyRecallStateViews
|
|
117
117
|
} from "./chunk-DBB5JPSL.js";
|
|
@@ -119,7 +119,10 @@ import {
|
|
|
119
119
|
StateViewAnchorTracker,
|
|
120
120
|
filterRecentScanMemories,
|
|
121
121
|
stateViewPacketActive
|
|
122
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-G2DF5MI7.js";
|
|
123
|
+
import {
|
|
124
|
+
reorderRecallResultsWithMmr
|
|
125
|
+
} from "./chunk-YDBIWGNI.js";
|
|
123
126
|
import {
|
|
124
127
|
dedupeResultsByNamespace,
|
|
125
128
|
hasMemoryForResult,
|
|
@@ -129,8 +132,11 @@ import {
|
|
|
129
132
|
resultHasKey
|
|
130
133
|
} from "./chunk-D3V3UMET.js";
|
|
131
134
|
import {
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
compactRecallContextFromBuckets,
|
|
136
|
+
decideRecallContextComposition,
|
|
137
|
+
notifyContextComposition,
|
|
138
|
+
recallFailureComposition
|
|
139
|
+
} from "./chunk-6VITOSPL.js";
|
|
134
140
|
import {
|
|
135
141
|
applyReasoningTraceBoost
|
|
136
142
|
} from "./chunk-ZZTOURJI.js";
|
|
@@ -166,7 +172,7 @@ import {
|
|
|
166
172
|
} from "./chunk-LS2FHUML.js";
|
|
167
173
|
import {
|
|
168
174
|
ExtractionEngine
|
|
169
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-KH2D26LQ.js";
|
|
170
176
|
import {
|
|
171
177
|
parseMemoryActionEligibilityContext
|
|
172
178
|
} from "./chunk-JHU4EYDV.js";
|
|
@@ -183,7 +189,7 @@ import {
|
|
|
183
189
|
getVerdictKind,
|
|
184
190
|
judgeFactDurability,
|
|
185
191
|
validateProcedureExtraction
|
|
186
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-WN4HFL4K.js";
|
|
187
193
|
import {
|
|
188
194
|
buildExplicitCueRecallSection
|
|
189
195
|
} from "./chunk-TVIVY7KU.js";
|
|
@@ -201,7 +207,7 @@ import {
|
|
|
201
207
|
buildEntityRecallSection,
|
|
202
208
|
entityRecentTranscriptLookbackHours,
|
|
203
209
|
readRecentEntityTranscriptEntries
|
|
204
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-XPFJSUOR.js";
|
|
205
211
|
import {
|
|
206
212
|
planEpisodeWindowsWithFallback
|
|
207
213
|
} from "./chunk-T3GIETKV.js";
|
|
@@ -213,7 +219,7 @@ import {
|
|
|
213
219
|
} from "./chunk-V2HHAAPI.js";
|
|
214
220
|
import {
|
|
215
221
|
refreshConvergedNamespaces
|
|
216
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-Y4G6LHJW.js";
|
|
217
223
|
import {
|
|
218
224
|
formatDaySummaryMemories
|
|
219
225
|
} from "./chunk-LVXBC6YB.js";
|
|
@@ -225,7 +231,7 @@ import {
|
|
|
225
231
|
runTimelinePublishCli,
|
|
226
232
|
screenCandidateFact,
|
|
227
233
|
summarizeVaultPublish
|
|
228
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-SOFATSHJ.js";
|
|
229
235
|
import {
|
|
230
236
|
normalizeReplaySessionKey
|
|
231
237
|
} from "./chunk-AJVLDJU6.js";
|
|
@@ -235,14 +241,14 @@ import {
|
|
|
235
241
|
import {
|
|
236
242
|
compareVerifiedEpisodeResults,
|
|
237
243
|
searchVerifiedEpisodes
|
|
238
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-SZ7IVZGD.js";
|
|
239
245
|
import {
|
|
240
246
|
ThreadingManager
|
|
241
247
|
} from "./chunk-OJP3N7UK.js";
|
|
242
248
|
import {
|
|
243
249
|
compareVerifiedSemanticRuleResults,
|
|
244
250
|
searchVerifiedSemanticRules
|
|
245
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-RUUJXAGT.js";
|
|
246
252
|
import {
|
|
247
253
|
searchWorkProductLedgerEntries
|
|
248
254
|
} from "./chunk-G7NYVKD6.js";
|
|
@@ -255,10 +261,10 @@ import {
|
|
|
255
261
|
import {
|
|
256
262
|
runNamespaceMaintenanceFanout,
|
|
257
263
|
summarizeNamespaceMaintenanceHealth
|
|
258
|
-
} from "./chunk-
|
|
264
|
+
} from "./chunk-SEQ6DWXD.js";
|
|
259
265
|
import {
|
|
260
266
|
planNamespaceMaintenance
|
|
261
|
-
} from "./chunk-
|
|
267
|
+
} from "./chunk-7RKAE6Y4.js";
|
|
262
268
|
import {
|
|
263
269
|
isAboveImportanceThreshold,
|
|
264
270
|
scoreImportance
|
|
@@ -287,7 +293,7 @@ import {
|
|
|
287
293
|
materializeAfterSemanticConsolidation,
|
|
288
294
|
parseConsolidationResponse,
|
|
289
295
|
parseOperatorAwareConsolidationResponse
|
|
290
|
-
} from "./chunk-
|
|
296
|
+
} from "./chunk-DI52XAKG.js";
|
|
291
297
|
import {
|
|
292
298
|
semanticChunkContent
|
|
293
299
|
} from "./chunk-2GBFKHBZ.js";
|
|
@@ -296,7 +302,7 @@ import {
|
|
|
296
302
|
} from "./chunk-6TBIWIAG.js";
|
|
297
303
|
import {
|
|
298
304
|
SmartBuffer
|
|
299
|
-
} from "./chunk-
|
|
305
|
+
} from "./chunk-G7S37WD4.js";
|
|
300
306
|
import {
|
|
301
307
|
buildRecallQueryPolicy
|
|
302
308
|
} from "./chunk-C6WMSXCJ.js";
|
|
@@ -323,8 +329,9 @@ import {
|
|
|
323
329
|
decideSemanticMerge,
|
|
324
330
|
detectMeetings,
|
|
325
331
|
embeddingsFromCosineHits,
|
|
326
|
-
normalizeConnectorScope
|
|
327
|
-
|
|
332
|
+
normalizeConnectorScope,
|
|
333
|
+
runSeedGraduationPass
|
|
334
|
+
} from "./chunk-UVZBDIJX.js";
|
|
328
335
|
import {
|
|
329
336
|
compileCorrectionRule,
|
|
330
337
|
correctionsFilePath,
|
|
@@ -336,13 +343,18 @@ import {
|
|
|
336
343
|
resolveJournalSource,
|
|
337
344
|
resolveVaultNotePath
|
|
338
345
|
} from "./chunk-3KJTSCSX.js";
|
|
346
|
+
import {
|
|
347
|
+
decideRecognitionTier,
|
|
348
|
+
loadRecognitionIndex,
|
|
349
|
+
runRecognitionTier
|
|
350
|
+
} from "./chunk-4KQIWY4A.js";
|
|
339
351
|
import {
|
|
340
352
|
AMBIENT_CAPTURE_PROMPT_RULE,
|
|
341
353
|
isHighImpactPersonalFact
|
|
342
354
|
} from "./chunk-QW27DOHG.js";
|
|
343
355
|
import {
|
|
344
356
|
MeetingsInputError
|
|
345
|
-
} from "./chunk-
|
|
357
|
+
} from "./chunk-6KCQNFDQ.js";
|
|
346
358
|
import {
|
|
347
359
|
WearablesInputError,
|
|
348
360
|
describeErrorForOperator
|
|
@@ -360,20 +372,24 @@ import {
|
|
|
360
372
|
} from "./chunk-DGS34QSY.js";
|
|
361
373
|
import {
|
|
362
374
|
NamespaceCatalog
|
|
363
|
-
} from "./chunk-
|
|
375
|
+
} from "./chunk-U2SK45U3.js";
|
|
364
376
|
import {
|
|
365
377
|
RecallResultFormatter,
|
|
366
378
|
SessionContextCoordinator,
|
|
367
379
|
capturePassiveCorrections,
|
|
368
380
|
clusterByKey,
|
|
369
381
|
detectPassiveCorrections
|
|
370
|
-
} from "./chunk-
|
|
382
|
+
} from "./chunk-DCRK7I5E.js";
|
|
371
383
|
import {
|
|
372
384
|
importCapsule
|
|
373
|
-
} from "./chunk-
|
|
385
|
+
} from "./chunk-VVX5PZFS.js";
|
|
374
386
|
import {
|
|
375
387
|
isCodingGraphInstalled
|
|
376
388
|
} from "./chunk-VQ7B2Q6M.js";
|
|
389
|
+
import {
|
|
390
|
+
listTrustZoneRecords,
|
|
391
|
+
searchTrustZoneRecords
|
|
392
|
+
} from "./chunk-ROBHL3GL.js";
|
|
377
393
|
import {
|
|
378
394
|
applyTrustScoreStage,
|
|
379
395
|
buildTrustSignalsForRerank,
|
|
@@ -381,10 +397,6 @@ import {
|
|
|
381
397
|
trustResultFor,
|
|
382
398
|
trustResultKey
|
|
383
399
|
} from "./chunk-GNVZQ5JN.js";
|
|
384
|
-
import {
|
|
385
|
-
listTrustZoneRecords,
|
|
386
|
-
searchTrustZoneRecords
|
|
387
|
-
} from "./chunk-ROBHL3GL.js";
|
|
388
400
|
import {
|
|
389
401
|
HourlySummarizer
|
|
390
402
|
} from "./chunk-BXOPUJ3W.js";
|
|
@@ -396,7 +408,7 @@ import {
|
|
|
396
408
|
} from "./chunk-5UBH37SL.js";
|
|
397
409
|
import {
|
|
398
410
|
buildXraySnapshot
|
|
399
|
-
} from "./chunk-
|
|
411
|
+
} from "./chunk-WH7RINGG.js";
|
|
400
412
|
import {
|
|
401
413
|
objectiveStateStoreOverrideForNamespace,
|
|
402
414
|
searchObjectiveStateSnapshots
|
|
@@ -407,10 +419,10 @@ import {
|
|
|
407
419
|
isTopLevelArchivePath,
|
|
408
420
|
journalPath,
|
|
409
421
|
writeJournalFile
|
|
410
|
-
} from "./chunk-
|
|
422
|
+
} from "./chunk-TEQQQTQS.js";
|
|
411
423
|
import {
|
|
412
424
|
searchHarmonicRetrieval
|
|
413
|
-
} from "./chunk-
|
|
425
|
+
} from "./chunk-TQT4AOPO.js";
|
|
414
426
|
import {
|
|
415
427
|
ProfilingCollector
|
|
416
428
|
} from "./chunk-NLE6TSLG.js";
|
|
@@ -428,7 +440,6 @@ import {
|
|
|
428
440
|
shouldSkipImplicitExtraction
|
|
429
441
|
} from "./chunk-B4EGAHHS.js";
|
|
430
442
|
import {
|
|
431
|
-
boundRecallContextComposition,
|
|
432
443
|
composeRecallContext,
|
|
433
444
|
contextBudgetForFooter,
|
|
434
445
|
formatCuriosityFooter,
|
|
@@ -437,7 +448,7 @@ import {
|
|
|
437
448
|
} from "./chunk-IHOXK2I6.js";
|
|
438
449
|
import {
|
|
439
450
|
NamespaceStorageRouter
|
|
440
|
-
} from "./chunk-
|
|
451
|
+
} from "./chunk-AH44WTLJ.js";
|
|
441
452
|
import {
|
|
442
453
|
pruneOrphanCueAnchors
|
|
443
454
|
} from "./chunk-BMWN7B3Y.js";
|
|
@@ -451,7 +462,7 @@ import {
|
|
|
451
462
|
ExtractionDeadlineError,
|
|
452
463
|
ExtractionRunCoordinator,
|
|
453
464
|
classifyExtractionOrigin
|
|
454
|
-
} from "./chunk-
|
|
465
|
+
} from "./chunk-DZP2XMZC.js";
|
|
455
466
|
import {
|
|
456
467
|
ARTIFACT_STATUS_CACHE_TTL_MS,
|
|
457
468
|
BulkImportBatchPartialFailureError,
|
|
@@ -504,7 +515,28 @@ import {
|
|
|
504
515
|
} from "./chunk-TBBDFYXW.js";
|
|
505
516
|
import {
|
|
506
517
|
buildChainFollowupGenerator
|
|
507
|
-
} from "./chunk-
|
|
518
|
+
} from "./chunk-VGO57TU7.js";
|
|
519
|
+
import {
|
|
520
|
+
estimateTokenCount
|
|
521
|
+
} from "./chunk-TOTT6S2V.js";
|
|
522
|
+
import {
|
|
523
|
+
capStateViewPackets,
|
|
524
|
+
reconcileStateViewPairs,
|
|
525
|
+
resultStateViewKey,
|
|
526
|
+
stateViewPacketKeys
|
|
527
|
+
} from "./chunk-EH3HNCAM.js";
|
|
528
|
+
import {
|
|
529
|
+
shouldRecordRecallAuthorityHistory
|
|
530
|
+
} from "./chunk-LVTT5AUG.js";
|
|
531
|
+
import {
|
|
532
|
+
assertExternalWikiRootOutsideMemoryDirCanonical
|
|
533
|
+
} from "./chunk-JV3C2MNQ.js";
|
|
534
|
+
import {
|
|
535
|
+
buildProcedurePersistBody
|
|
536
|
+
} from "./chunk-QDW3E4RD.js";
|
|
537
|
+
import {
|
|
538
|
+
searchCausalTrajectories
|
|
539
|
+
} from "./chunk-L63GFNKL.js";
|
|
508
540
|
import {
|
|
509
541
|
QmdResultResolver,
|
|
510
542
|
StorageManager,
|
|
@@ -523,7 +555,7 @@ import {
|
|
|
523
555
|
reconstructFusionInputs,
|
|
524
556
|
selfDeps,
|
|
525
557
|
serializeFusionDay
|
|
526
|
-
} from "./chunk-
|
|
558
|
+
} from "./chunk-QWQB7TOB.js";
|
|
527
559
|
import {
|
|
528
560
|
bodyIsEscaped,
|
|
529
561
|
decodeTranscriptBody,
|
|
@@ -540,12 +572,12 @@ import {
|
|
|
540
572
|
import {
|
|
541
573
|
NamespaceSearchRouter,
|
|
542
574
|
namespaceCollectionName
|
|
543
|
-
} from "./chunk-
|
|
575
|
+
} from "./chunk-AIVRD66I.js";
|
|
544
576
|
import {
|
|
545
577
|
createConversationIndexRuntime,
|
|
546
578
|
createSearchBackend,
|
|
547
579
|
isSearchBackendEnabled
|
|
548
|
-
} from "./chunk-
|
|
580
|
+
} from "./chunk-PLJ2MQFT.js";
|
|
549
581
|
import {
|
|
550
582
|
NoopSearchBackend
|
|
551
583
|
} from "./chunk-CYEPCZN5.js";
|
|
@@ -559,7 +591,7 @@ import {
|
|
|
559
591
|
} from "./chunk-S2V7RUCL.js";
|
|
560
592
|
import {
|
|
561
593
|
confidenceTier
|
|
562
|
-
} from "./chunk-
|
|
594
|
+
} from "./chunk-4UVJ6EIT.js";
|
|
563
595
|
import {
|
|
564
596
|
lintWorkspaceFiles,
|
|
565
597
|
rotateMarkdownFileToArchive
|
|
@@ -618,6 +650,10 @@ import {
|
|
|
618
650
|
getCachedQmdRecall,
|
|
619
651
|
setCachedQmdRecall
|
|
620
652
|
} from "./chunk-42JKGUFJ.js";
|
|
653
|
+
import {
|
|
654
|
+
isUntrustedOrigin,
|
|
655
|
+
parseOriginClass
|
|
656
|
+
} from "./chunk-6Q3ZTEF6.js";
|
|
621
657
|
import {
|
|
622
658
|
FallbackLlmClient,
|
|
623
659
|
gatewayTaskChainOptions
|
|
@@ -625,31 +661,6 @@ import {
|
|
|
625
661
|
import {
|
|
626
662
|
fallbackLlmRuntimeContextFromConfig
|
|
627
663
|
} from "./chunk-EP6BA7VV.js";
|
|
628
|
-
import {
|
|
629
|
-
estimateTokenCount
|
|
630
|
-
} from "./chunk-TOTT6S2V.js";
|
|
631
|
-
import {
|
|
632
|
-
capStateViewPackets,
|
|
633
|
-
reconcileStateViewPairs,
|
|
634
|
-
resultStateViewKey,
|
|
635
|
-
stateViewPacketKeys
|
|
636
|
-
} from "./chunk-EH3HNCAM.js";
|
|
637
|
-
import {
|
|
638
|
-
shouldRecordRecallAuthorityHistory
|
|
639
|
-
} from "./chunk-LVTT5AUG.js";
|
|
640
|
-
import {
|
|
641
|
-
assertExternalWikiRootOutsideMemoryDirCanonical
|
|
642
|
-
} from "./chunk-JV3C2MNQ.js";
|
|
643
|
-
import {
|
|
644
|
-
buildProcedurePersistBody
|
|
645
|
-
} from "./chunk-QDW3E4RD.js";
|
|
646
|
-
import {
|
|
647
|
-
searchCausalTrajectories
|
|
648
|
-
} from "./chunk-L63GFNKL.js";
|
|
649
|
-
import {
|
|
650
|
-
isUntrustedOrigin,
|
|
651
|
-
parseOriginClass
|
|
652
|
-
} from "./chunk-6Q3ZTEF6.js";
|
|
653
664
|
import {
|
|
654
665
|
normalizeRecallTokenSet
|
|
655
666
|
} from "./chunk-YCVB7X56.js";
|
|
@@ -674,7 +685,14 @@ import {
|
|
|
674
685
|
import {
|
|
675
686
|
localDayKey,
|
|
676
687
|
renderDayLocationContext
|
|
677
|
-
} from "./chunk-
|
|
688
|
+
} from "./chunk-IGEZE6QB.js";
|
|
689
|
+
import {
|
|
690
|
+
activityDayWindow,
|
|
691
|
+
assertValidTimezone,
|
|
692
|
+
hashActivityBody,
|
|
693
|
+
isValidActivityDate,
|
|
694
|
+
timezoneOffsetIso
|
|
695
|
+
} from "./chunk-353C5UNV.js";
|
|
678
696
|
import {
|
|
679
697
|
TAG_LIMITS,
|
|
680
698
|
composeMemoryEnvelope,
|
|
@@ -683,13 +701,6 @@ import {
|
|
|
683
701
|
import {
|
|
684
702
|
normalizeTags
|
|
685
703
|
} from "./chunk-BT7NVCML.js";
|
|
686
|
-
import {
|
|
687
|
-
activityDayWindow,
|
|
688
|
-
assertValidTimezone,
|
|
689
|
-
hashActivityBody,
|
|
690
|
-
isValidActivityDate,
|
|
691
|
-
timezoneOffsetIso
|
|
692
|
-
} from "./chunk-353C5UNV.js";
|
|
693
704
|
import {
|
|
694
705
|
evaluateSubjectGuard,
|
|
695
706
|
isSharedPromotionTarget,
|
|
@@ -719,15 +730,15 @@ import {
|
|
|
719
730
|
stripCitationForTemplate,
|
|
720
731
|
stripRecognizedCitations
|
|
721
732
|
} from "./chunk-L272A5QW.js";
|
|
722
|
-
import {
|
|
723
|
-
excludeSupportPassportPrivateMemories,
|
|
724
|
-
isSupportPassportPrivateMemory
|
|
725
|
-
} from "./chunk-PWPIERBM.js";
|
|
726
733
|
import {
|
|
727
734
|
inferMemoryStatus,
|
|
728
735
|
isActiveMemoryStatus,
|
|
729
736
|
toMemoryPathRel
|
|
730
737
|
} from "./chunk-7RJUVTVF.js";
|
|
738
|
+
import {
|
|
739
|
+
excludeSupportPassportPrivateMemories,
|
|
740
|
+
isSupportPassportPrivateMemory
|
|
741
|
+
} from "./chunk-PWPIERBM.js";
|
|
731
742
|
import {
|
|
732
743
|
assertPathInsideRoot
|
|
733
744
|
} from "./chunk-C7HJ3NEI.js";
|
|
@@ -839,7 +850,7 @@ import {
|
|
|
839
850
|
} from "./chunk-3WCASNQZ.js";
|
|
840
851
|
|
|
841
852
|
// src/orchestrator.ts
|
|
842
|
-
import
|
|
853
|
+
import path22 from "path";
|
|
843
854
|
import { createHash as createHash9 } from "crypto";
|
|
844
855
|
|
|
845
856
|
// src/orchestration/tier-migration-coordinator.ts
|
|
@@ -1557,6 +1568,13 @@ var LifecyclePolicyCoordinator = class {
|
|
|
1557
1568
|
});
|
|
1558
1569
|
if (wrote) updatedCount += 1;
|
|
1559
1570
|
}
|
|
1571
|
+
const history = this.deps.getHandleHistory?.();
|
|
1572
|
+
await runSeedGraduationPass({
|
|
1573
|
+
memories: allMemories,
|
|
1574
|
+
storage,
|
|
1575
|
+
config: this.config.seedGraduation,
|
|
1576
|
+
recalledBySession: history ? (sessionKey) => history.recent(sessionKey) : void 0
|
|
1577
|
+
});
|
|
1560
1578
|
if (!lifecycleCaps.lifecycleMetrics) return updatedCount;
|
|
1561
1579
|
const total = evaluatedCount;
|
|
1562
1580
|
const metrics = {
|
|
@@ -2390,7 +2408,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
|
|
|
2390
2408
|
namespaces,
|
|
2391
2409
|
{
|
|
2392
2410
|
readNamespaceMemories: async (ns) => (await this.getStorage(ns)).readAllMemories(),
|
|
2393
|
-
readMemoryFrontmatter: async (
|
|
2411
|
+
readMemoryFrontmatter: async (path41, preferredNamespace) => {
|
|
2394
2412
|
if (!fallbackReader) {
|
|
2395
2413
|
for (const ns of namespaces) {
|
|
2396
2414
|
try {
|
|
@@ -2402,7 +2420,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
|
|
|
2402
2420
|
}
|
|
2403
2421
|
if (!fallbackReader) return null;
|
|
2404
2422
|
const memory = await this.readQmdResultMemory(
|
|
2405
|
-
|
|
2423
|
+
path41,
|
|
2406
2424
|
fallbackReader,
|
|
2407
2425
|
namespaces,
|
|
2408
2426
|
preferredNamespace
|
|
@@ -9195,7 +9213,7 @@ function createDependencyPropagationReplayReconciliation(host) {
|
|
|
9195
9213
|
// src/orchestration/recall-internal.ts
|
|
9196
9214
|
import { createHash as createHash6 } from "crypto";
|
|
9197
9215
|
import { readFile as readFile5, stat, unlink as unlink2 } from "fs/promises";
|
|
9198
|
-
import
|
|
9216
|
+
import path12 from "path";
|
|
9199
9217
|
|
|
9200
9218
|
// src/orchestration/graph-path-state-loader.ts
|
|
9201
9219
|
import { lstat, opendir, realpath } from "fs/promises";
|
|
@@ -9879,7 +9897,7 @@ var GraphRecallCoordinator = class {
|
|
|
9879
9897
|
}
|
|
9880
9898
|
};
|
|
9881
9899
|
|
|
9882
|
-
// src/
|
|
9900
|
+
// src/experience/session-experience-recall.ts
|
|
9883
9901
|
function tokenOverlapScore(prompt, memoryText) {
|
|
9884
9902
|
const norm = (s) => s.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2);
|
|
9885
9903
|
const promptTokens = new Set(norm(prompt));
|
|
@@ -9892,13 +9910,52 @@ function tokenOverlapScore(prompt, memoryText) {
|
|
|
9892
9910
|
const union = /* @__PURE__ */ new Set([...promptTokens, ...memTokens]);
|
|
9893
9911
|
return inter / Math.max(1, union.size);
|
|
9894
9912
|
}
|
|
9895
|
-
function
|
|
9913
|
+
function isSessionExperienceMemory(memory) {
|
|
9914
|
+
const hash = memory.frontmatter.structuredAttributes?.experience_session_hash;
|
|
9915
|
+
return typeof hash === "string" && hash.length > 0;
|
|
9916
|
+
}
|
|
9917
|
+
function scoreSessionExperienceForPrompt(memory, prompt) {
|
|
9918
|
+
if (!isSessionExperienceMemory(memory)) return null;
|
|
9919
|
+
const situation = memory.frontmatter.structuredAttributes?.experience_situation ?? "";
|
|
9920
|
+
const situationScore = tokenOverlapScore(prompt, situation);
|
|
9921
|
+
const bodyScore = tokenOverlapScore(prompt, memory.content);
|
|
9922
|
+
return Math.min(1, situationScore * 0.75 + bodyScore * 0.25);
|
|
9923
|
+
}
|
|
9924
|
+
function renderSessionExperiencePreview(memory) {
|
|
9925
|
+
if (!isSessionExperienceMemory(memory)) return null;
|
|
9926
|
+
const attrs = memory.frontmatter.structuredAttributes ?? {};
|
|
9927
|
+
const situation = (attrs.experience_situation ?? "").trim();
|
|
9928
|
+
const approach = (attrs.experience_approach ?? "").trim();
|
|
9929
|
+
const reflection = (attrs.experience_reflection ?? "").trim();
|
|
9930
|
+
if (situation.length === 0 && approach.length === 0 && reflection.length === 0) {
|
|
9931
|
+
return `Experience. ${memory.content.replace(/\s+/g, " ").trim()}`;
|
|
9932
|
+
}
|
|
9933
|
+
return `Experience. Situation: ${situation} Approach: ${approach} Reflection: ${reflection}`.replace(/\s+/g, " ").trim();
|
|
9934
|
+
}
|
|
9935
|
+
|
|
9936
|
+
// src/procedural/procedure-recall.ts
|
|
9937
|
+
function tokenOverlapScore2(prompt, memoryText) {
|
|
9938
|
+
const norm = (s) => s.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2);
|
|
9939
|
+
const promptTokens = new Set(norm(prompt));
|
|
9940
|
+
const memTokens = new Set(norm(memoryText));
|
|
9941
|
+
if (promptTokens.size === 0 || memTokens.size === 0) return 0;
|
|
9942
|
+
let inter = 0;
|
|
9943
|
+
for (const t of promptTokens) {
|
|
9944
|
+
if (memTokens.has(t)) inter++;
|
|
9945
|
+
}
|
|
9946
|
+
const union = /* @__PURE__ */ new Set([...promptTokens, ...memTokens]);
|
|
9947
|
+
return inter / Math.max(1, union.size);
|
|
9948
|
+
}
|
|
9949
|
+
function scoreProcedureForPrompt(m, prompt, queryIntent, experienceEnabled) {
|
|
9896
9950
|
const memText = `${m.content}
|
|
9897
9951
|
${(m.frontmatter.tags ?? []).join(" ")}`;
|
|
9898
|
-
const jaccard =
|
|
9952
|
+
const jaccard = tokenOverlapScore2(prompt, memText);
|
|
9899
9953
|
const memIntent = inferIntentFromText(m.content.slice(0, 2e3));
|
|
9900
9954
|
const intentScore = intentCompatibilityScore(queryIntent, memIntent);
|
|
9901
|
-
|
|
9955
|
+
const base = jaccard * 0.55 + intentScore * 0.45;
|
|
9956
|
+
if (!experienceEnabled) return base;
|
|
9957
|
+
const experience = scoreSessionExperienceForPrompt(m, prompt);
|
|
9958
|
+
return experience === null ? base : Math.max(base, experience);
|
|
9902
9959
|
}
|
|
9903
9960
|
async function buildProcedureRecallSection(storage, prompt, config, options) {
|
|
9904
9961
|
if (config.procedural?.enabled !== true) return null;
|
|
@@ -9914,9 +9971,10 @@ async function buildProcedureRecallSection(storage, prompt, config, options) {
|
|
|
9914
9971
|
)
|
|
9915
9972
|
);
|
|
9916
9973
|
const all = await storage.readAllMemories();
|
|
9974
|
+
const experienceEnabled = config.sessionExperience?.enabled === true;
|
|
9917
9975
|
const scored = all.filter(
|
|
9918
9976
|
(m) => m.frontmatter.category === "procedure" && isActiveMemoryStatus(m.frontmatter.status) && (options?.partitionToolScoped !== true || canRecallToolScopedMemory(m.frontmatter, options.requestingConnector))
|
|
9919
|
-
).map((m) => ({ m, score: scoreProcedureForPrompt(m, trimmed, queryIntent) })).filter((x) => x.score > 0.04).sort((a, b) => b.score - a.score).slice(0, maxN);
|
|
9977
|
+
).map((m) => ({ m, score: scoreProcedureForPrompt(m, trimmed, queryIntent, experienceEnabled) })).filter((x) => x.score > 0.04).sort((a, b) => b.score - a.score).slice(0, maxN);
|
|
9920
9978
|
if (scored.length === 0) return null;
|
|
9921
9979
|
if (options?.injectedMemories) {
|
|
9922
9980
|
for (const { m } of scored) {
|
|
@@ -9926,7 +9984,8 @@ async function buildProcedureRecallSection(storage, prompt, config, options) {
|
|
|
9926
9984
|
const security = resolveSecurityCapabilities(config);
|
|
9927
9985
|
const blocks = scored.map(({ m, score }) => {
|
|
9928
9986
|
const id = m.frontmatter.id;
|
|
9929
|
-
const
|
|
9987
|
+
const labeled = experienceEnabled ? renderSessionExperiencePreview(m) : null;
|
|
9988
|
+
const flat = (labeled ?? m.content).replace(/\s+/g, " ").trim();
|
|
9930
9989
|
const preview = flat.slice(0, 320);
|
|
9931
9990
|
const suffix = flat.length > 320 ? "\u2026" : "";
|
|
9932
9991
|
const body = renderAuthorityBoundContent(`${preview}${suffix}`, m.frontmatter.origin, {
|
|
@@ -10264,6 +10323,104 @@ function resolveCompositeProfileStorage(options) {
|
|
|
10264
10323
|
return { profileStorage, profileStorageDirs };
|
|
10265
10324
|
}
|
|
10266
10325
|
|
|
10326
|
+
// src/orchestration/recall-recognition-search.ts
|
|
10327
|
+
import path11 from "path";
|
|
10328
|
+
async function fetchQmdMemoryResultsWithRecognitionSwap(deps, prompt, qmdFetchLimit, qmdHybridFetchLimit, options) {
|
|
10329
|
+
if (deps.config.recallRecognitionTier !== true || options.collection || options.namespacesEnabled !== true) {
|
|
10330
|
+
return deps.fetchQmdMemoryResultsWithArtifactTopUp(
|
|
10331
|
+
prompt,
|
|
10332
|
+
qmdFetchLimit,
|
|
10333
|
+
qmdHybridFetchLimit,
|
|
10334
|
+
options
|
|
10335
|
+
);
|
|
10336
|
+
}
|
|
10337
|
+
const namespaces = options.recallNamespaces.filter(Boolean);
|
|
10338
|
+
if (namespaces.length === 0) {
|
|
10339
|
+
return deps.fetchQmdMemoryResultsWithArtifactTopUp(
|
|
10340
|
+
prompt,
|
|
10341
|
+
qmdFetchLimit,
|
|
10342
|
+
qmdHybridFetchLimit,
|
|
10343
|
+
options
|
|
10344
|
+
);
|
|
10345
|
+
}
|
|
10346
|
+
throwIfRecallAborted(options.abortSignal);
|
|
10347
|
+
const maxEntries = deps.config.recognitionIndexMaxEntries;
|
|
10348
|
+
const recognitionNs = [];
|
|
10349
|
+
const vectorNs = [];
|
|
10350
|
+
for (const namespace of namespaces) {
|
|
10351
|
+
throwIfRecallAborted(options.abortSignal);
|
|
10352
|
+
const storage = await deps.storageRouter.storageFor(namespace);
|
|
10353
|
+
const index = await loadRecognitionIndex(storage.dir);
|
|
10354
|
+
const decision = decideRecognitionTier(index, { maxEntries });
|
|
10355
|
+
if (index !== null && decision.tier === "recognition") {
|
|
10356
|
+
recognitionNs.push({ namespace, storage, index });
|
|
10357
|
+
} else {
|
|
10358
|
+
vectorNs.push(namespace);
|
|
10359
|
+
}
|
|
10360
|
+
}
|
|
10361
|
+
if (recognitionNs.length === 0) {
|
|
10362
|
+
return deps.fetchQmdMemoryResultsWithArtifactTopUp(
|
|
10363
|
+
prompt,
|
|
10364
|
+
qmdFetchLimit,
|
|
10365
|
+
qmdHybridFetchLimit,
|
|
10366
|
+
options
|
|
10367
|
+
);
|
|
10368
|
+
}
|
|
10369
|
+
const recognize = async (recognitionPrompt) => {
|
|
10370
|
+
const reply = await deps.fastLlmForRerank.chatCompletion(
|
|
10371
|
+
[{ role: "user", content: recognitionPrompt }],
|
|
10372
|
+
{ operation: "recognition-tier", priority: "recall-critical" }
|
|
10373
|
+
);
|
|
10374
|
+
return reply?.content;
|
|
10375
|
+
};
|
|
10376
|
+
const recognized = [];
|
|
10377
|
+
for (const { namespace, storage, index } of recognitionNs) {
|
|
10378
|
+
throwIfRecallAborted(options.abortSignal);
|
|
10379
|
+
try {
|
|
10380
|
+
const run = await runRecognitionTier(prompt, index.entries, recognize);
|
|
10381
|
+
recognized.push(
|
|
10382
|
+
...await hitsFromIds(namespace, storage, index, run.ids)
|
|
10383
|
+
);
|
|
10384
|
+
} catch (err) {
|
|
10385
|
+
log.warn(
|
|
10386
|
+
`recognition tier degraded to vector search: recognizer failed${err instanceof Error ? ` (${err.message})` : ""}`
|
|
10387
|
+
);
|
|
10388
|
+
vectorNs.push(namespace);
|
|
10389
|
+
}
|
|
10390
|
+
}
|
|
10391
|
+
const vectorResults = vectorNs.length === 0 ? [] : await deps.fetchQmdMemoryResultsWithArtifactTopUp(
|
|
10392
|
+
prompt,
|
|
10393
|
+
qmdFetchLimit,
|
|
10394
|
+
qmdHybridFetchLimit,
|
|
10395
|
+
{ ...options, recallNamespaces: vectorNs }
|
|
10396
|
+
);
|
|
10397
|
+
return dedupeResultsByNamespace(
|
|
10398
|
+
[...recognized, ...vectorResults],
|
|
10399
|
+
options.resolveNamespace,
|
|
10400
|
+
qmdFetchLimit
|
|
10401
|
+
);
|
|
10402
|
+
}
|
|
10403
|
+
async function hitsFromIds(namespace, storage, index, ids) {
|
|
10404
|
+
if (ids.length === 0) return [];
|
|
10405
|
+
const pathsById = await storage.findExistingMemoryPaths([...ids]);
|
|
10406
|
+
const descriptionById = new Map(index.entries.map((entry) => [entry.id, entry.description]));
|
|
10407
|
+
const hits = [];
|
|
10408
|
+
for (const [offset, id] of ids.entries()) {
|
|
10409
|
+
const absPath = pathsById.get(id)?.[0];
|
|
10410
|
+
if (!absPath) continue;
|
|
10411
|
+
const rel = path11.relative(storage.dir, absPath).split(path11.sep).join("/");
|
|
10412
|
+
if (!rel || rel.startsWith("..")) continue;
|
|
10413
|
+
hits.push({
|
|
10414
|
+
docid: `${namespace}:${rel}`,
|
|
10415
|
+
namespace,
|
|
10416
|
+
path: rel,
|
|
10417
|
+
score: ids.length - offset,
|
|
10418
|
+
snippet: descriptionById.get(id) ?? id
|
|
10419
|
+
});
|
|
10420
|
+
}
|
|
10421
|
+
return hits;
|
|
10422
|
+
}
|
|
10423
|
+
|
|
10267
10424
|
// src/orchestration/recall-internal.ts
|
|
10268
10425
|
var RecallInternalCoordinator = class {
|
|
10269
10426
|
constructor(deps) {
|
|
@@ -10498,7 +10655,7 @@ var RecallInternalCoordinator = class {
|
|
|
10498
10655
|
const graphExpandedResultPaths = /* @__PURE__ */ new Set();
|
|
10499
10656
|
const graphSourceLabelsForPath = (resultPath) => {
|
|
10500
10657
|
const labels = [];
|
|
10501
|
-
const normalizedPath = resultPath.split(
|
|
10658
|
+
const normalizedPath = resultPath.split(path12.sep).join("/");
|
|
10502
10659
|
const isEntityPath = normalizedPath.startsWith("entities/") || normalizedPath.includes("/entities/");
|
|
10503
10660
|
if (graphBaselinePaths.has(resultPath)) labels.push("baseline");
|
|
10504
10661
|
if (graphExpandedResultPaths.has(resultPath))
|
|
@@ -11824,7 +11981,8 @@ ${rows.join("\n")}
|
|
|
11824
11981
|
}) : Promise.resolve([])
|
|
11825
11982
|
]) : null;
|
|
11826
11983
|
try {
|
|
11827
|
-
const filteredResults = await
|
|
11984
|
+
const filteredResults = await fetchQmdMemoryResultsWithRecognitionSwap(
|
|
11985
|
+
this.deps,
|
|
11828
11986
|
retrievalQuery,
|
|
11829
11987
|
qmdFetchLimit,
|
|
11830
11988
|
qmdHybridFetchLimit,
|
|
@@ -12034,11 +12192,11 @@ ${formatted}`;
|
|
|
12034
12192
|
if (!resolveRecallAuxiliaryCapabilities(this.deps.config).compactionReset) return null;
|
|
12035
12193
|
const workspaceDir = compactionWorkspaceDir || this.deps.config.workspaceDir || defaultWorkspaceDir();
|
|
12036
12194
|
const safeSessionKey = sanitizeSessionKeyForFilename(effectiveSessionKey);
|
|
12037
|
-
const signalPath =
|
|
12195
|
+
const signalPath = path12.join(
|
|
12038
12196
|
workspaceDir,
|
|
12039
12197
|
`.compaction-reset-signal-${safeSessionKey}`
|
|
12040
12198
|
);
|
|
12041
|
-
const bootPath =
|
|
12199
|
+
const bootPath = path12.join(workspaceDir, "BOOT.md");
|
|
12042
12200
|
try {
|
|
12043
12201
|
const signalStat = await stat(signalPath).catch(() => null);
|
|
12044
12202
|
if (!signalStat) return null;
|
|
@@ -14015,27 +14173,15 @@ ${tmtNode.summary}`
|
|
|
14015
14173
|
recalledMemoryNamespaces
|
|
14016
14174
|
);
|
|
14017
14175
|
const recalledContext = assembledRecall.sections.join("\n\n---\n\n");
|
|
14018
|
-
const composition =
|
|
14176
|
+
const { composition, context, truncated: compositionTruncated } = decideRecallContextComposition({
|
|
14019
14177
|
context: recalledContext,
|
|
14178
|
+
compactContext: compactRecallContextFromBuckets(sectionBuckets),
|
|
14020
14179
|
footer: curiosityFooter,
|
|
14021
14180
|
maxChars: recallBudgetChars
|
|
14022
14181
|
});
|
|
14023
|
-
|
|
14024
|
-
try {
|
|
14025
|
-
const observerResult = options.onContextComposition?.(composition);
|
|
14026
|
-
if (observerResult && typeof observerResult.then === "function") {
|
|
14027
|
-
void Promise.resolve(observerResult).catch((err) => log.warn(
|
|
14028
|
-
"recall: context composition observer rejected",
|
|
14029
|
-
err
|
|
14030
|
-
));
|
|
14031
|
-
}
|
|
14032
|
-
} catch (err) {
|
|
14182
|
+
notifyContextComposition(options.onContextComposition, composition, (err) => {
|
|
14033
14183
|
log.warn("recall: context composition observer failed open", err);
|
|
14034
|
-
}
|
|
14035
|
-
const compositionTruncated = context.length < composeRecallContext({
|
|
14036
|
-
context: recalledContext,
|
|
14037
|
-
footer: curiosityFooter
|
|
14038
|
-
}).length;
|
|
14184
|
+
});
|
|
14039
14185
|
const includedSections = [...assembledRecall.includedIds];
|
|
14040
14186
|
const omittedSections = [...assembledRecall.omittedIds];
|
|
14041
14187
|
if (composition.footer && !includedSections.includes("questions")) includedSections.push("questions");
|
|
@@ -14203,6 +14349,7 @@ ${tmtNode.summary}`
|
|
|
14203
14349
|
chars: this.deps.getRecallBudgetChars(options.budgetCharsOverride),
|
|
14204
14350
|
used: context.length
|
|
14205
14351
|
},
|
|
14352
|
+
...composition.degradation ? { degradation: composition.degradation } : {},
|
|
14206
14353
|
sessionKey,
|
|
14207
14354
|
namespace: selfNamespace,
|
|
14208
14355
|
traceId,
|
|
@@ -14324,10 +14471,10 @@ ${tmtNode.summary}`
|
|
|
14324
14471
|
|
|
14325
14472
|
// src/orchestration/recall-search-pipeline.ts
|
|
14326
14473
|
import { createHash as createHash7 } from "crypto";
|
|
14327
|
-
import
|
|
14474
|
+
import path14 from "path";
|
|
14328
14475
|
|
|
14329
14476
|
// src/orchestration/recall-search-prefilter.ts
|
|
14330
|
-
import
|
|
14477
|
+
import path13 from "path";
|
|
14331
14478
|
async function fetchActiveArtifactsForNamespace(deps, namespace, prompt, targetCount, options = {}) {
|
|
14332
14479
|
const storage = await deps.storageRouter.storageFor(namespace);
|
|
14333
14480
|
let fetchLimit = computeArtifactCandidateFetchLimit(targetCount);
|
|
@@ -14456,7 +14603,7 @@ async function searchEmbeddingFallback(deps, query, limit) {
|
|
|
14456
14603
|
if (hits.length === 0) return [];
|
|
14457
14604
|
const results = [];
|
|
14458
14605
|
for (const hit of hits) {
|
|
14459
|
-
const fullPath =
|
|
14606
|
+
const fullPath = path13.isAbsolute(hit.path) ? hit.path : path13.join(deps.config.memoryDir, hit.path);
|
|
14460
14607
|
const memory = await deps.storage.readMemoryByPath(fullPath);
|
|
14461
14608
|
if (!memory) continue;
|
|
14462
14609
|
results.push({
|
|
@@ -14834,7 +14981,7 @@ var RecallSearchPipelineCoordinator = class {
|
|
|
14834
14981
|
const storage = await this.deps.storageRouter.storageFor(namespace);
|
|
14835
14982
|
const storageDir = typeof storage.dir === "string" && storage.dir ? storage.dir : null;
|
|
14836
14983
|
if (!storageDir) continue;
|
|
14837
|
-
const recallRoot =
|
|
14984
|
+
const recallRoot = path14.resolve(storageDir);
|
|
14838
14985
|
if (seenRecallRoots.has(recallRoot)) continue;
|
|
14839
14986
|
seenRecallRoots.add(recallRoot);
|
|
14840
14987
|
recallRoots.push(recallRoot);
|
|
@@ -14858,8 +15005,8 @@ var RecallSearchPipelineCoordinator = class {
|
|
|
14858
15005
|
if (resolvedCold) scopedResults.push(resolvedCold.result);
|
|
14859
15006
|
continue;
|
|
14860
15007
|
}
|
|
14861
|
-
if (
|
|
14862
|
-
if (recallRoots.some((recallRoot) => isPathInsideStorageRoot(recallRoot,
|
|
15008
|
+
if (path14.isAbsolute(result.path)) {
|
|
15009
|
+
if (recallRoots.some((recallRoot) => isPathInsideStorageRoot(recallRoot, path14.resolve(result.path)))) {
|
|
14863
15010
|
scopedResults.push(result);
|
|
14864
15011
|
}
|
|
14865
15012
|
continue;
|
|
@@ -16053,7 +16200,7 @@ var TurnIngestionCoordinator = class {
|
|
|
16053
16200
|
|
|
16054
16201
|
// src/orchestration/recall-introspection.ts
|
|
16055
16202
|
import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile5 } from "fs/promises";
|
|
16056
|
-
import
|
|
16203
|
+
import path16 from "path";
|
|
16057
16204
|
|
|
16058
16205
|
// src/taxonomy/default-taxonomy.ts
|
|
16059
16206
|
var DEFAULT_TAXONOMY = {
|
|
@@ -16176,7 +16323,7 @@ function generateResolverDocument(taxonomy) {
|
|
|
16176
16323
|
|
|
16177
16324
|
// src/taxonomy/taxonomy-loader.ts
|
|
16178
16325
|
import { readFile as readFile6, mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
16179
|
-
import
|
|
16326
|
+
import path15 from "path";
|
|
16180
16327
|
var TAXONOMY_DIR = ".taxonomy";
|
|
16181
16328
|
var TAXONOMY_FILE = "taxonomy.json";
|
|
16182
16329
|
var MAX_SLUG_LENGTH = 32;
|
|
@@ -16274,7 +16421,7 @@ function validateTaxonomy(taxonomy) {
|
|
|
16274
16421
|
}
|
|
16275
16422
|
}
|
|
16276
16423
|
async function loadTaxonomy(memoryDir) {
|
|
16277
|
-
const taxonomyPath =
|
|
16424
|
+
const taxonomyPath = path15.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
|
|
16278
16425
|
let raw;
|
|
16279
16426
|
try {
|
|
16280
16427
|
raw = await readFile6(taxonomyPath, "utf-8");
|
|
@@ -16324,16 +16471,16 @@ async function loadTaxonomy(memoryDir) {
|
|
|
16324
16471
|
}
|
|
16325
16472
|
async function saveTaxonomy(memoryDir, taxonomy) {
|
|
16326
16473
|
validateTaxonomy(taxonomy);
|
|
16327
|
-
const dir =
|
|
16474
|
+
const dir = path15.join(memoryDir, TAXONOMY_DIR);
|
|
16328
16475
|
await mkdir4(dir, { recursive: true });
|
|
16329
|
-
const filePath =
|
|
16476
|
+
const filePath = path15.join(dir, TAXONOMY_FILE);
|
|
16330
16477
|
await writeFile4(filePath, JSON.stringify(taxonomy, null, 2) + "\n", "utf-8");
|
|
16331
16478
|
}
|
|
16332
16479
|
function getTaxonomyDir(memoryDir) {
|
|
16333
|
-
return
|
|
16480
|
+
return path15.join(memoryDir, TAXONOMY_DIR);
|
|
16334
16481
|
}
|
|
16335
16482
|
function getTaxonomyFilePath(memoryDir) {
|
|
16336
|
-
return
|
|
16483
|
+
return path15.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
|
|
16337
16484
|
}
|
|
16338
16485
|
|
|
16339
16486
|
// src/orchestration/recall-introspection.ts
|
|
@@ -16357,7 +16504,7 @@ var RecallIntrospectionCoordinator = class {
|
|
|
16357
16504
|
}
|
|
16358
16505
|
async getLastGraphRecallSnapshot(namespace) {
|
|
16359
16506
|
const storage = await this.deps.getStorage(namespace);
|
|
16360
|
-
const snapshotPath =
|
|
16507
|
+
const snapshotPath = path16.join(
|
|
16361
16508
|
storage.dir,
|
|
16362
16509
|
"state",
|
|
16363
16510
|
"last_graph_recall.json"
|
|
@@ -16396,7 +16543,7 @@ var RecallIntrospectionCoordinator = class {
|
|
|
16396
16543
|
}
|
|
16397
16544
|
async getLastIntentSnapshot(namespace) {
|
|
16398
16545
|
const storage = await this.deps.getStorage(namespace);
|
|
16399
|
-
const snapshotPath =
|
|
16546
|
+
const snapshotPath = path16.join(storage.dir, "state", "last_intent.json");
|
|
16400
16547
|
try {
|
|
16401
16548
|
const raw = await readFile7(snapshotPath, "utf-8");
|
|
16402
16549
|
const parsed = JSON.parse(raw);
|
|
@@ -16429,7 +16576,7 @@ var RecallIntrospectionCoordinator = class {
|
|
|
16429
16576
|
}
|
|
16430
16577
|
async getLastQmdRecallSnapshot(namespace) {
|
|
16431
16578
|
const storage = await this.deps.getStorage(namespace);
|
|
16432
|
-
const snapshotPath =
|
|
16579
|
+
const snapshotPath = path16.join(
|
|
16433
16580
|
storage.dir,
|
|
16434
16581
|
"state",
|
|
16435
16582
|
"last_qmd_recall.json"
|
|
@@ -16721,12 +16868,12 @@ var RecallIntrospectionCoordinator = class {
|
|
|
16721
16868
|
}
|
|
16722
16869
|
async recordLastIntentSnapshot(options) {
|
|
16723
16870
|
try {
|
|
16724
|
-
const snapshotPath =
|
|
16871
|
+
const snapshotPath = path16.join(
|
|
16725
16872
|
options.storage.dir,
|
|
16726
16873
|
"state",
|
|
16727
16874
|
"last_intent.json"
|
|
16728
16875
|
);
|
|
16729
|
-
await mkdir5(
|
|
16876
|
+
await mkdir5(path16.dirname(snapshotPath), { recursive: true });
|
|
16730
16877
|
await writeFile5(
|
|
16731
16878
|
snapshotPath,
|
|
16732
16879
|
JSON.stringify(options.snapshot, null, 2),
|
|
@@ -16738,12 +16885,12 @@ var RecallIntrospectionCoordinator = class {
|
|
|
16738
16885
|
}
|
|
16739
16886
|
async recordLastQmdRecallSnapshot(options) {
|
|
16740
16887
|
try {
|
|
16741
|
-
const snapshotPath =
|
|
16888
|
+
const snapshotPath = path16.join(
|
|
16742
16889
|
options.storage.dir,
|
|
16743
16890
|
"state",
|
|
16744
16891
|
"last_qmd_recall.json"
|
|
16745
16892
|
);
|
|
16746
|
-
await mkdir5(
|
|
16893
|
+
await mkdir5(path16.dirname(snapshotPath), { recursive: true });
|
|
16747
16894
|
await writeFile5(
|
|
16748
16895
|
snapshotPath,
|
|
16749
16896
|
JSON.stringify(options.snapshot, null, 2),
|
|
@@ -16758,8 +16905,8 @@ var RecallIntrospectionCoordinator = class {
|
|
|
16758
16905
|
const stateDir = await this.deps.resolveStateDirForNamespace(
|
|
16759
16906
|
options.namespace
|
|
16760
16907
|
);
|
|
16761
|
-
const snapshotPath =
|
|
16762
|
-
await mkdir5(
|
|
16908
|
+
const snapshotPath = path16.join(stateDir, "last_intent.json");
|
|
16909
|
+
await mkdir5(path16.dirname(snapshotPath), { recursive: true });
|
|
16763
16910
|
await writeFile5(
|
|
16764
16911
|
snapshotPath,
|
|
16765
16912
|
JSON.stringify(options.snapshot, null, 2),
|
|
@@ -16773,7 +16920,7 @@ var RecallIntrospectionCoordinator = class {
|
|
|
16773
16920
|
|
|
16774
16921
|
// src/orchestration/orchestrator-init.ts
|
|
16775
16922
|
import { readdir as readdir2, stat as stat2, unlink as unlink3 } from "fs/promises";
|
|
16776
|
-
import
|
|
16923
|
+
import path17 from "path";
|
|
16777
16924
|
|
|
16778
16925
|
// src/orchestration/startup-collection-checks.ts
|
|
16779
16926
|
async function startupDiscoveryWithTimeout(discover, configuredFallback, timeoutMs = qmdStartupCollectionCheckTimeoutMs()) {
|
|
@@ -17089,7 +17236,7 @@ var OrchestratorInitCoordinator = class {
|
|
|
17089
17236
|
const files = await readdir2(wsDir).catch(() => []);
|
|
17090
17237
|
for (const f of files) {
|
|
17091
17238
|
if (!f.startsWith(".compaction-reset-signal-")) continue;
|
|
17092
|
-
const fp =
|
|
17239
|
+
const fp = path17.join(wsDir, f);
|
|
17093
17240
|
const s = await stat2(fp).catch(() => null);
|
|
17094
17241
|
if (s && Date.now() - s.mtimeMs >= COMPACTION_SIGNAL_MAX_AGE_MS) {
|
|
17095
17242
|
await unlink3(fp).catch(() => {
|
|
@@ -17335,7 +17482,7 @@ var OrchestratorInitCoordinator = class {
|
|
|
17335
17482
|
if (signal.aborted || !this.isCurrentStartupEpoch(epoch)) return;
|
|
17336
17483
|
if (!this.deps.wearablesAutoSyncHandle && this.deps.config.wearables.enabled && this.deps.config.wearables.autoSyncEnabled && Object.values(this.deps.config.wearables.sources).some((source) => source.enabled)) {
|
|
17337
17484
|
try {
|
|
17338
|
-
const { startWearablesAutoSync } = await import("./auto-sync-
|
|
17485
|
+
const { startWearablesAutoSync } = await import("./auto-sync-CWSZDLLW.js");
|
|
17339
17486
|
if (signal.aborted || !this.isCurrentStartupEpoch(epoch)) return;
|
|
17340
17487
|
this.deps.wearablesAutoSyncHandle = startWearablesAutoSync(
|
|
17341
17488
|
{
|
|
@@ -17508,7 +17655,7 @@ var OrchestratorInitCoordinator = class {
|
|
|
17508
17655
|
};
|
|
17509
17656
|
|
|
17510
17657
|
// src/orchestration/persistence-index.ts
|
|
17511
|
-
import
|
|
17658
|
+
import path18 from "path";
|
|
17512
17659
|
var PersistenceIndexCoordinator = class {
|
|
17513
17660
|
constructor(deps) {
|
|
17514
17661
|
this.deps = deps;
|
|
@@ -17700,7 +17847,7 @@ var PersistenceIndexCoordinator = class {
|
|
|
17700
17847
|
const allMems = allMemsForGraph ?? [];
|
|
17701
17848
|
for (const m of allMems) {
|
|
17702
17849
|
if (m.frontmatter.entityRef === entityRef) {
|
|
17703
|
-
const rel =
|
|
17850
|
+
const rel = path18.relative(storage.dir, m.path);
|
|
17704
17851
|
if (rel !== memoryRelPath) entitySiblings.push(rel);
|
|
17705
17852
|
}
|
|
17706
17853
|
}
|
|
@@ -17855,7 +18002,7 @@ var PersistenceIndexCoordinator = class {
|
|
|
17855
18002
|
|
|
17856
18003
|
// src/orchestration/workspace-ops.ts
|
|
17857
18004
|
import { lstat as lstat2, mkdir as mkdir6, readFile as readFile8, readdir as readdir3, realpath as realpath2, writeFile as writeFile6 } from "fs/promises";
|
|
17858
|
-
import
|
|
18005
|
+
import path19 from "path";
|
|
17859
18006
|
|
|
17860
18007
|
// src/maintenance/pattern-reinforcement.ts
|
|
17861
18008
|
function patternReinforcementKey(content) {
|
|
@@ -19759,8 +19906,8 @@ var MeetingsService = class {
|
|
|
19759
19906
|
// src/orchestration/workspace-ops.ts
|
|
19760
19907
|
var MEETINGS_BUILD_DEBOUNCE_MS = 5e3;
|
|
19761
19908
|
function matchesMemoryPath(candidatePath, requestedPath, memoryDir) {
|
|
19762
|
-
const normalizedCandidate =
|
|
19763
|
-
return normalizedCandidate ===
|
|
19909
|
+
const normalizedCandidate = path19.resolve(candidatePath);
|
|
19910
|
+
return normalizedCandidate === path19.resolve(requestedPath) || normalizedCandidate === path19.resolve(memoryDir, requestedPath);
|
|
19764
19911
|
}
|
|
19765
19912
|
function accessTrackingPathCandidates(storageDir, memoryPath) {
|
|
19766
19913
|
const candidates = qmdResultPathCandidates(storageDir, memoryPath);
|
|
@@ -19768,12 +19915,12 @@ function accessTrackingPathCandidates(storageDir, memoryPath) {
|
|
|
19768
19915
|
if (!parts) return candidates;
|
|
19769
19916
|
candidates.push(
|
|
19770
19917
|
...qmdResultPathCandidates(storageDir, parts.relativePath),
|
|
19771
|
-
...qmdResultPathCandidates(
|
|
19918
|
+
...qmdResultPathCandidates(path19.join(storageDir, "cold"), parts.relativePath)
|
|
19772
19919
|
);
|
|
19773
19920
|
return [...new Set(candidates)];
|
|
19774
19921
|
}
|
|
19775
19922
|
function canonicalMemoryPath(memoryPath, memoryDir) {
|
|
19776
|
-
return
|
|
19923
|
+
return path19.resolve(path19.isAbsolute(memoryPath) ? memoryPath : path19.resolve(memoryDir, memoryPath));
|
|
19777
19924
|
}
|
|
19778
19925
|
var WorkspaceOpsCoordinator = class {
|
|
19779
19926
|
constructor(deps) {
|
|
@@ -19855,15 +20002,15 @@ var WorkspaceOpsCoordinator = class {
|
|
|
19855
20002
|
this.deps.lastFileHygieneRunAtMs = now;
|
|
19856
20003
|
if (hygiene.rotateEnabled) {
|
|
19857
20004
|
for (const rel of hygiene.rotatePaths) {
|
|
19858
|
-
const abs =
|
|
20005
|
+
const abs = path19.isAbsolute(rel) ? rel : path19.join(this.deps.config.workspaceDir, rel);
|
|
19859
20006
|
try {
|
|
19860
20007
|
const raw = await readFile8(abs, "utf-8");
|
|
19861
20008
|
if (raw.length > hygiene.rotateMaxBytes) {
|
|
19862
|
-
const archiveDir =
|
|
20009
|
+
const archiveDir = path19.join(
|
|
19863
20010
|
this.deps.config.workspaceDir,
|
|
19864
20011
|
hygiene.archiveDir
|
|
19865
20012
|
);
|
|
19866
|
-
const base =
|
|
20013
|
+
const base = path19.basename(abs);
|
|
19867
20014
|
const prefix = base.toUpperCase().replace(/\.MD$/i, "").replace(/[^A-Z0-9]+/g, "-") || "FILE";
|
|
19868
20015
|
const { newContent } = await rotateMarkdownFileToArchive({
|
|
19869
20016
|
filePath: abs,
|
|
@@ -19888,8 +20035,8 @@ var WorkspaceOpsCoordinator = class {
|
|
|
19888
20035
|
log.warn(w.message);
|
|
19889
20036
|
}
|
|
19890
20037
|
if (hygiene.warningsLogEnabled && warnings.length > 0) {
|
|
19891
|
-
const fp =
|
|
19892
|
-
await mkdir6(
|
|
20038
|
+
const fp = path19.join(this.deps.config.memoryDir, hygiene.warningsLogPath);
|
|
20039
|
+
await mkdir6(path19.dirname(fp), { recursive: true });
|
|
19893
20040
|
const stamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
19894
20041
|
const block = `
|
|
19895
20042
|
|
|
@@ -19929,7 +20076,7 @@ var WorkspaceOpsCoordinator = class {
|
|
|
19929
20076
|
for (const categoryDir of RECALL_FALLBACK_DIRS) {
|
|
19930
20077
|
if (memoryRootReal === null) break;
|
|
19931
20078
|
for (const date of datesToScan) {
|
|
19932
|
-
const dateDir =
|
|
20079
|
+
const dateDir = path19.join(storage.dir, categoryDir, date);
|
|
19933
20080
|
try {
|
|
19934
20081
|
const dirStat = await lstat2(dateDir);
|
|
19935
20082
|
if (dirStat.isSymbolicLink() || !dirStat.isDirectory()) continue;
|
|
@@ -19938,7 +20085,7 @@ var WorkspaceOpsCoordinator = class {
|
|
|
19938
20085
|
for (const entry of entries) {
|
|
19939
20086
|
if (entry.isSymbolicLink()) continue;
|
|
19940
20087
|
if (!entry.name.endsWith(".md")) continue;
|
|
19941
|
-
const fullPath =
|
|
20088
|
+
const fullPath = path19.join(dateDir, entry.name);
|
|
19942
20089
|
try {
|
|
19943
20090
|
assertPathInsideRoot(memoryRootReal, await realpath2(fullPath), fullPath);
|
|
19944
20091
|
const memory = await storage.readMemoryByPath(fullPath);
|
|
@@ -19960,13 +20107,13 @@ var WorkspaceOpsCoordinator = class {
|
|
|
19960
20107
|
return a.frontmatter.created < b.frontmatter.created ? -1 : 1;
|
|
19961
20108
|
});
|
|
19962
20109
|
const hourlySummaries = [];
|
|
19963
|
-
const hourlyBaseDir =
|
|
20110
|
+
const hourlyBaseDir = path19.join(storage.dir, "summaries", "hourly");
|
|
19964
20111
|
try {
|
|
19965
20112
|
const sessionKeys = await readdir3(hourlyBaseDir, { withFileTypes: true });
|
|
19966
20113
|
for (const sk of sessionKeys) {
|
|
19967
20114
|
if (!sk.isDirectory()) continue;
|
|
19968
20115
|
for (const date of datesToScan) {
|
|
19969
|
-
const summaryFile =
|
|
20116
|
+
const summaryFile = path19.join(hourlyBaseDir, sk.name, `${date}.md`);
|
|
19970
20117
|
try {
|
|
19971
20118
|
const raw = await readFile8(summaryFile, "utf-8");
|
|
19972
20119
|
const filtered = filterHourlySummaryMarkdownForLocalDay(
|
|
@@ -20443,18 +20590,18 @@ ${reflectionsContent.trim()}
|
|
|
20443
20590
|
// src/orchestration/namespace-read-fanout.ts
|
|
20444
20591
|
import { existsSync, readFileSync } from "fs";
|
|
20445
20592
|
import { stat as stat3 } from "fs/promises";
|
|
20446
|
-
import
|
|
20593
|
+
import path21 from "path";
|
|
20447
20594
|
|
|
20448
20595
|
// src/orchestration/orchestrator-namespace-scope.ts
|
|
20449
|
-
import
|
|
20596
|
+
import path20 from "path";
|
|
20450
20597
|
function computeSemanticDedupScope(targetStorage, config) {
|
|
20451
20598
|
if (!resolveNamespaceCapabilities(config).namespaces) return {};
|
|
20452
|
-
const memoryDir =
|
|
20453
|
-
const storageDir =
|
|
20599
|
+
const memoryDir = path20.resolve(config.memoryDir);
|
|
20600
|
+
const storageDir = path20.resolve(targetStorage.dir);
|
|
20454
20601
|
if (storageDir === memoryDir) {
|
|
20455
20602
|
return { pathExcludePrefixes: ["namespaces/"] };
|
|
20456
20603
|
}
|
|
20457
|
-
let rel =
|
|
20604
|
+
let rel = path20.relative(memoryDir, storageDir);
|
|
20458
20605
|
if (!rel || rel.startsWith("..")) {
|
|
20459
20606
|
log.debug(
|
|
20460
20607
|
`semantic dedup: target storage dir ${storageDir} is outside memoryDir ${memoryDir}; scoping lookup to absolute path prefix`
|
|
@@ -20507,7 +20654,7 @@ var NamespaceReadFanoutCoordinator = class {
|
|
|
20507
20654
|
loadNamespaceStorageDirHintsFromCatalog() {
|
|
20508
20655
|
if (this.deps.namespaceStorageDirHintsLoaded || !this.deps.namespaceCatalog.enabled) return;
|
|
20509
20656
|
this.deps.namespaceStorageDirHintsLoaded = true;
|
|
20510
|
-
const catalogPath =
|
|
20657
|
+
const catalogPath = path21.join(this.deps.config.memoryDir, "state", "namespaces.jsonl");
|
|
20511
20658
|
if (!existsSync(catalogPath)) return;
|
|
20512
20659
|
let body;
|
|
20513
20660
|
try {
|
|
@@ -20544,7 +20691,7 @@ var NamespaceReadFanoutCoordinator = class {
|
|
|
20544
20691
|
if (!this.deps.storageDirMatchesNamespaceHint(record.namespace, record.storageDir)) {
|
|
20545
20692
|
continue;
|
|
20546
20693
|
}
|
|
20547
|
-
const resolvedStorageDir =
|
|
20694
|
+
const resolvedStorageDir = path21.resolve(record.storageDir);
|
|
20548
20695
|
const current = preferredByStorageDir.get(resolvedStorageDir);
|
|
20549
20696
|
preferredByStorageDir.set(
|
|
20550
20697
|
resolvedStorageDir,
|
|
@@ -20729,12 +20876,12 @@ var NamespaceReadFanoutCoordinator = class {
|
|
|
20729
20876
|
}
|
|
20730
20877
|
async resolveStateDirForNamespace(namespace) {
|
|
20731
20878
|
if (!resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
20732
|
-
return
|
|
20879
|
+
return path21.join(this.deps.config.memoryDir, "state");
|
|
20733
20880
|
}
|
|
20734
20881
|
if (namespace !== this.deps.config.defaultNamespace) {
|
|
20735
|
-
return
|
|
20882
|
+
return path21.join(this.deps.config.memoryDir, "namespaces", namespace, "state");
|
|
20736
20883
|
}
|
|
20737
|
-
const candidate =
|
|
20884
|
+
const candidate = path21.join(
|
|
20738
20885
|
this.deps.config.memoryDir,
|
|
20739
20886
|
"namespaces",
|
|
20740
20887
|
this.deps.config.defaultNamespace
|
|
@@ -20742,11 +20889,11 @@ var NamespaceReadFanoutCoordinator = class {
|
|
|
20742
20889
|
try {
|
|
20743
20890
|
const candidateStat = await stat3(candidate);
|
|
20744
20891
|
if (candidateStat.isDirectory()) {
|
|
20745
|
-
return
|
|
20892
|
+
return path21.join(candidate, "state");
|
|
20746
20893
|
}
|
|
20747
20894
|
} catch {
|
|
20748
20895
|
}
|
|
20749
|
-
return
|
|
20896
|
+
return path21.join(this.deps.config.memoryDir, "state");
|
|
20750
20897
|
}
|
|
20751
20898
|
namespaceFromPath(p) {
|
|
20752
20899
|
if (!resolveNamespaceCapabilities(this.deps.config).namespaces) return this.deps.config.defaultNamespace;
|
|
@@ -20878,7 +21025,12 @@ var RecallEntryCoordinator = class {
|
|
|
20878
21025
|
} catch (err) {
|
|
20879
21026
|
this.deps.logRecallFailure(err);
|
|
20880
21027
|
this.deps.profiler.endTrace();
|
|
20881
|
-
|
|
21028
|
+
const missing = options.abortSignal?.aborted ? null : recallFailureComposition(err);
|
|
21029
|
+
if (!missing) return "";
|
|
21030
|
+
notifyContextComposition(options.onContextComposition, missing, (observerErr) => {
|
|
21031
|
+
log.warn("recall: context composition observer failed open", observerErr);
|
|
21032
|
+
});
|
|
21033
|
+
return composeRecallContext(missing);
|
|
20882
21034
|
} finally {
|
|
20883
21035
|
options.abortSignal?.removeEventListener("abort", onAbort);
|
|
20884
21036
|
}
|
|
@@ -21196,7 +21348,7 @@ var Orchestrator = class {
|
|
|
21196
21348
|
if (this.destroyed) throw new Error("orchestrator has been destroyed");
|
|
21197
21349
|
if (!this._dependencyPropagationDelivery) {
|
|
21198
21350
|
this._dependencyPropagationDelivery = new DependencyPropagationDelivery({
|
|
21199
|
-
queueRoot:
|
|
21351
|
+
queueRoot: path22.join(this.config.memoryDir, "state", "dependency-propagation"),
|
|
21200
21352
|
config: this.config,
|
|
21201
21353
|
extraction: this.extraction,
|
|
21202
21354
|
getStorage: (namespace) => this.getStorage(namespace),
|
|
@@ -21551,7 +21703,7 @@ var Orchestrator = class {
|
|
|
21551
21703
|
const defaultNs = normalizeNamespaceIdentity(this.config.defaultNamespace);
|
|
21552
21704
|
if (ns !== defaultNs && !isSafeRouteNamespace(ns)) return;
|
|
21553
21705
|
if (!this.storageDirMatchesNamespaceHint(ns, storageDir)) return;
|
|
21554
|
-
const resolvedStorageDir =
|
|
21706
|
+
const resolvedStorageDir = path22.resolve(storageDir);
|
|
21555
21707
|
let hints = this.namespaceStorageDirHints.get(resolvedStorageDir);
|
|
21556
21708
|
if (!hints) {
|
|
21557
21709
|
hints = /* @__PURE__ */ new Set();
|
|
@@ -21562,21 +21714,21 @@ var Orchestrator = class {
|
|
|
21562
21714
|
storageDirMatchesNamespaceHint(namespace, storageDir) {
|
|
21563
21715
|
const ns = normalizeNamespaceIdentity(namespace);
|
|
21564
21716
|
if (!ns) return false;
|
|
21565
|
-
const resolvedStorageDir =
|
|
21566
|
-
const resolvedMemoryDir =
|
|
21717
|
+
const resolvedStorageDir = path22.resolve(storageDir);
|
|
21718
|
+
const resolvedMemoryDir = path22.resolve(this.config.memoryDir);
|
|
21567
21719
|
const defaultNs = normalizeNamespaceIdentity(this.config.defaultNamespace);
|
|
21568
21720
|
if (resolvedStorageDir === resolvedMemoryDir) return ns === defaultNs;
|
|
21569
|
-
const resolvedNamespacesDir =
|
|
21721
|
+
const resolvedNamespacesDir = path22.join(resolvedMemoryDir, "namespaces");
|
|
21570
21722
|
if (!isPathInsideStorageRoot(resolvedNamespacesDir, resolvedStorageDir)) return false;
|
|
21571
|
-
const rawRoot =
|
|
21572
|
-
const tokenRoot =
|
|
21723
|
+
const rawRoot = path22.resolve(resolvedNamespacesDir, ns);
|
|
21724
|
+
const tokenRoot = path22.resolve(resolvedNamespacesDir, namespaceIdentityToken(ns));
|
|
21573
21725
|
return resolvedStorageDir === rawRoot || resolvedStorageDir === tokenRoot;
|
|
21574
21726
|
}
|
|
21575
21727
|
namespaceStorageDirHintOwnershipRank(record, resolvedStorageDir, configured) {
|
|
21576
|
-
if (resolvedStorageDir ===
|
|
21728
|
+
if (resolvedStorageDir === path22.resolve(this.config.memoryDir)) {
|
|
21577
21729
|
return record.namespace === normalizeNamespaceIdentity(this.config.defaultNamespace) ? 0 : 3;
|
|
21578
21730
|
}
|
|
21579
|
-
const leaf =
|
|
21731
|
+
const leaf = path22.basename(resolvedStorageDir);
|
|
21580
21732
|
const tokenOwnsRoot = namespaceIdentityToken(record.namespace) === leaf;
|
|
21581
21733
|
if (tokenOwnsRoot && configured.has(record.namespace)) return 0;
|
|
21582
21734
|
if (record.namespace === leaf) return 1;
|
|
@@ -21717,7 +21869,7 @@ var Orchestrator = class {
|
|
|
21717
21869
|
StorageManager.setOkfConformanceDefault(config.memoryDir, config.okf?.conformanceEnabled);
|
|
21718
21870
|
this.profiler = new ProfilingCollector({
|
|
21719
21871
|
enabled: resolvePipelineProcessingCapabilities(this.config).profiling,
|
|
21720
|
-
storageDir: config.profilingStorageDir ||
|
|
21872
|
+
storageDir: config.profilingStorageDir || path22.join(config.memoryDir, "profiling"),
|
|
21721
21873
|
maxTraces: config.profilingMaxTraces
|
|
21722
21874
|
});
|
|
21723
21875
|
this.namespaceCatalog = new NamespaceCatalog(config);
|
|
@@ -21804,7 +21956,7 @@ var Orchestrator = class {
|
|
|
21804
21956
|
this.compounding = resolveConsolidationCapabilities(config).compounding ? new CompoundingEngine(config, this.storage) : void 0;
|
|
21805
21957
|
this.buffer = new SmartBuffer(config, this.storage);
|
|
21806
21958
|
this.transcript = new TranscriptManager(config);
|
|
21807
|
-
this.conversationIndexDir =
|
|
21959
|
+
this.conversationIndexDir = path22.join(
|
|
21808
21960
|
config.memoryDir,
|
|
21809
21961
|
"conversation-index",
|
|
21810
21962
|
"chunks"
|
|
@@ -21951,10 +22103,11 @@ var Orchestrator = class {
|
|
|
21951
22103
|
embeddingFallback: this.embeddingFallback,
|
|
21952
22104
|
getEffectiveLifecycleThresholds: () => this.effectiveLifecycleThresholds(),
|
|
21953
22105
|
removeContentHashForMemory: (targetStorage, memory, context) => this.removeContentHashForMemory(targetStorage, memory, context),
|
|
21954
|
-
saveContentHashIndexes: () => this.saveContentHashIndexes()
|
|
22106
|
+
saveContentHashIndexes: () => this.saveContentHashIndexes(),
|
|
22107
|
+
getHandleHistory: () => this.handleHistory
|
|
21955
22108
|
});
|
|
21956
22109
|
this.threading = new ThreadingManager(
|
|
21957
|
-
|
|
22110
|
+
path22.join(config.memoryDir, "threads"),
|
|
21958
22111
|
config.threadingGapMinutes
|
|
21959
22112
|
);
|
|
21960
22113
|
const lifecycleCaps = resolveMemoryLifecycleCapabilities(config);
|
|
@@ -24047,9 +24200,9 @@ function readStructuralSymbol(entry) {
|
|
|
24047
24200
|
const rec = entry;
|
|
24048
24201
|
const symbol = typeof rec.symbol === "string" ? rec.symbol.trim() : "";
|
|
24049
24202
|
if (!symbol) return null;
|
|
24050
|
-
const
|
|
24203
|
+
const path41 = typeof rec.path === "string" && rec.path.length > 0 ? rec.path : void 0;
|
|
24051
24204
|
const kind = typeof rec.kind === "string" && rec.kind.length > 0 ? rec.kind : void 0;
|
|
24052
|
-
const item =
|
|
24205
|
+
const item = path41 !== void 0 && kind !== void 0 ? { symbol, path: path41, kind } : path41 !== void 0 ? { symbol, path: path41 } : kind !== void 0 ? { symbol, kind } : { symbol };
|
|
24053
24206
|
return item;
|
|
24054
24207
|
}
|
|
24055
24208
|
function classifySpawnError(err) {
|
|
@@ -24123,7 +24276,7 @@ var DEFAULT_GRACE_PERIOD_DAYS = 7;
|
|
|
24123
24276
|
|
|
24124
24277
|
// src/binary-lifecycle/backend.ts
|
|
24125
24278
|
import fsp from "fs/promises";
|
|
24126
|
-
import
|
|
24279
|
+
import path23 from "path";
|
|
24127
24280
|
var FilesystemBackend = class {
|
|
24128
24281
|
type = "filesystem";
|
|
24129
24282
|
basePath;
|
|
@@ -24131,19 +24284,19 @@ var FilesystemBackend = class {
|
|
|
24131
24284
|
if (!basePath || basePath.trim().length === 0) {
|
|
24132
24285
|
throw new Error("FilesystemBackend requires a non-empty basePath");
|
|
24133
24286
|
}
|
|
24134
|
-
this.basePath =
|
|
24287
|
+
this.basePath = path23.resolve(basePath);
|
|
24135
24288
|
}
|
|
24136
24289
|
resolveRemotePath(remotePath) {
|
|
24137
|
-
const resolved =
|
|
24138
|
-
const relative =
|
|
24139
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
24290
|
+
const resolved = path23.isAbsolute(remotePath) ? path23.resolve(remotePath) : path23.resolve(this.basePath, remotePath);
|
|
24291
|
+
const relative = path23.relative(this.basePath, resolved);
|
|
24292
|
+
if (relative === ".." || relative.startsWith(`..${path23.sep}`) || path23.isAbsolute(relative)) {
|
|
24140
24293
|
throw new Error(`FilesystemBackend remotePath escapes basePath: ${JSON.stringify(remotePath)}`);
|
|
24141
24294
|
}
|
|
24142
24295
|
return resolved;
|
|
24143
24296
|
}
|
|
24144
24297
|
isInsideBase(candidate, realBase) {
|
|
24145
|
-
const relative =
|
|
24146
|
-
return relative === "" || relative !== ".." && !relative.startsWith(`..${
|
|
24298
|
+
const relative = path23.relative(realBase, candidate);
|
|
24299
|
+
return relative === "" || relative !== ".." && !relative.startsWith(`..${path23.sep}`) && !path23.isAbsolute(relative);
|
|
24147
24300
|
}
|
|
24148
24301
|
async realBasePathIfExists() {
|
|
24149
24302
|
try {
|
|
@@ -24172,13 +24325,13 @@ var FilesystemBackend = class {
|
|
|
24172
24325
|
}
|
|
24173
24326
|
async ensureSafeParentDirectory(dest) {
|
|
24174
24327
|
const realBase = await this.ensureBaseDirectory();
|
|
24175
|
-
const destDir =
|
|
24176
|
-
const relativeDir =
|
|
24177
|
-
const segments = relativeDir === "" ? [] : relativeDir.split(
|
|
24328
|
+
const destDir = path23.dirname(dest);
|
|
24329
|
+
const relativeDir = path23.relative(this.basePath, destDir);
|
|
24330
|
+
const segments = relativeDir === "" ? [] : relativeDir.split(path23.sep);
|
|
24178
24331
|
let current = this.basePath;
|
|
24179
24332
|
for (const segment of segments) {
|
|
24180
24333
|
if (segment === "." || segment === "") continue;
|
|
24181
|
-
current =
|
|
24334
|
+
current = path23.join(current, segment);
|
|
24182
24335
|
try {
|
|
24183
24336
|
const stat5 = await fsp.lstat(current);
|
|
24184
24337
|
if (stat5.isSymbolicLink()) {
|
|
@@ -24206,13 +24359,13 @@ var FilesystemBackend = class {
|
|
|
24206
24359
|
if (realBase === null) {
|
|
24207
24360
|
return null;
|
|
24208
24361
|
}
|
|
24209
|
-
const destDir =
|
|
24210
|
-
const relativeDir =
|
|
24211
|
-
const segments = relativeDir === "" ? [] : relativeDir.split(
|
|
24362
|
+
const destDir = path23.dirname(dest);
|
|
24363
|
+
const relativeDir = path23.relative(this.basePath, destDir);
|
|
24364
|
+
const segments = relativeDir === "" ? [] : relativeDir.split(path23.sep);
|
|
24212
24365
|
let current = this.basePath;
|
|
24213
24366
|
for (const segment of segments) {
|
|
24214
24367
|
if (segment === "." || segment === "") continue;
|
|
24215
|
-
current =
|
|
24368
|
+
current = path23.join(current, segment);
|
|
24216
24369
|
let stat5;
|
|
24217
24370
|
try {
|
|
24218
24371
|
stat5 = await fsp.lstat(current);
|
|
@@ -24260,7 +24413,7 @@ var FilesystemBackend = class {
|
|
|
24260
24413
|
return dest;
|
|
24261
24414
|
}
|
|
24262
24415
|
async upload(localPath, remotePath) {
|
|
24263
|
-
if (
|
|
24416
|
+
if (path23.isAbsolute(remotePath)) {
|
|
24264
24417
|
throw new Error(`FilesystemBackend upload remotePath must be relative: ${JSON.stringify(remotePath)}`);
|
|
24265
24418
|
}
|
|
24266
24419
|
const dest = this.resolveRemotePath(remotePath);
|
|
@@ -24333,7 +24486,7 @@ function createBackend(cfg) {
|
|
|
24333
24486
|
|
|
24334
24487
|
// src/binary-lifecycle/scanner.ts
|
|
24335
24488
|
import fsp2 from "fs/promises";
|
|
24336
|
-
import
|
|
24489
|
+
import path24 from "path";
|
|
24337
24490
|
import crypto from "crypto";
|
|
24338
24491
|
function matchesPatterns(filename, patterns) {
|
|
24339
24492
|
const lower = filename.toLowerCase();
|
|
@@ -24358,8 +24511,8 @@ async function scanForBinaries(memoryDir, config, manifest) {
|
|
|
24358
24511
|
return;
|
|
24359
24512
|
}
|
|
24360
24513
|
for (const entry of entries) {
|
|
24361
|
-
const fullPath =
|
|
24362
|
-
const relativePath =
|
|
24514
|
+
const fullPath = path24.join(dir, entry.name);
|
|
24515
|
+
const relativePath = path24.relative(memoryDir, fullPath).split(path24.sep).join("/");
|
|
24363
24516
|
if (entry.isDirectory()) {
|
|
24364
24517
|
if (entry.name === ".binary-lifecycle") continue;
|
|
24365
24518
|
await walk(fullPath);
|
|
@@ -24399,15 +24552,15 @@ async function hashFile(filePath) {
|
|
|
24399
24552
|
|
|
24400
24553
|
// src/binary-lifecycle/manifest.ts
|
|
24401
24554
|
import fsp3 from "fs/promises";
|
|
24402
|
-
import
|
|
24555
|
+
import path25 from "path";
|
|
24403
24556
|
import crypto2 from "crypto";
|
|
24404
24557
|
var MANIFEST_DIR = ".binary-lifecycle";
|
|
24405
24558
|
var MANIFEST_FILE = "manifest.json";
|
|
24406
24559
|
function manifestDir(memoryDir) {
|
|
24407
|
-
return
|
|
24560
|
+
return path25.join(memoryDir, MANIFEST_DIR);
|
|
24408
24561
|
}
|
|
24409
24562
|
function manifestPath(memoryDir) {
|
|
24410
|
-
return
|
|
24563
|
+
return path25.join(memoryDir, MANIFEST_DIR, MANIFEST_FILE);
|
|
24411
24564
|
}
|
|
24412
24565
|
async function readManifest(memoryDir) {
|
|
24413
24566
|
const filePath = manifestPath(memoryDir);
|
|
@@ -24459,13 +24612,13 @@ function emptyManifest() {
|
|
|
24459
24612
|
|
|
24460
24613
|
// src/binary-lifecycle/pipeline.ts
|
|
24461
24614
|
import fsp4 from "fs/promises";
|
|
24462
|
-
import
|
|
24615
|
+
import path26 from "path";
|
|
24463
24616
|
import crypto3 from "crypto";
|
|
24464
24617
|
var historicalIdCache = new HistoricalEntityCanonicalIdCache();
|
|
24465
24618
|
function isRecallCorpusMarkdown(mdPath, memoryDir) {
|
|
24466
|
-
const rel =
|
|
24467
|
-
if (rel.startsWith("..") ||
|
|
24468
|
-
const top = rel.split(
|
|
24619
|
+
const rel = path26.relative(memoryDir, mdPath);
|
|
24620
|
+
if (rel.startsWith("..") || path26.isAbsolute(rel)) return false;
|
|
24621
|
+
const top = rel.split(path26.sep)[0];
|
|
24469
24622
|
return RECALL_FALLBACK_DIRS.includes(top);
|
|
24470
24623
|
}
|
|
24471
24624
|
async function hashFile2(filePath) {
|
|
@@ -24489,13 +24642,13 @@ function escapeRegex(s) {
|
|
|
24489
24642
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
24490
24643
|
}
|
|
24491
24644
|
function resolveManifestAssetPath(memoryDir, originalPath) {
|
|
24492
|
-
if (originalPath.length === 0 || originalPath.includes("\0") || originalPath.includes("\\") ||
|
|
24645
|
+
if (originalPath.length === 0 || originalPath.includes("\0") || originalPath.includes("\\") || path26.isAbsolute(originalPath) || path26.win32.isAbsolute(originalPath)) {
|
|
24493
24646
|
return null;
|
|
24494
24647
|
}
|
|
24495
|
-
const memoryRoot =
|
|
24496
|
-
const fullPath =
|
|
24497
|
-
const relative =
|
|
24498
|
-
if (relative === "" || relative === ".." || relative.startsWith(`..${
|
|
24648
|
+
const memoryRoot = path26.resolve(memoryDir);
|
|
24649
|
+
const fullPath = path26.resolve(memoryRoot, originalPath);
|
|
24650
|
+
const relative = path26.relative(memoryRoot, fullPath);
|
|
24651
|
+
if (relative === "" || relative === ".." || relative.startsWith(`..${path26.sep}`) || path26.isAbsolute(relative)) {
|
|
24499
24652
|
return null;
|
|
24500
24653
|
}
|
|
24501
24654
|
return fullPath;
|
|
@@ -24506,7 +24659,7 @@ function validateBinaryLifecycleConfig(config) {
|
|
|
24506
24659
|
}
|
|
24507
24660
|
}
|
|
24508
24661
|
function remotePathForAsset(backend, relPath) {
|
|
24509
|
-
const normalized = relPath.split(
|
|
24662
|
+
const normalized = relPath.split(path26.sep).join("/");
|
|
24510
24663
|
if (backend.type === "filesystem") {
|
|
24511
24664
|
return `.binary-lifecycle/mirrors/${normalized}`;
|
|
24512
24665
|
}
|
|
@@ -24519,11 +24672,11 @@ async function stageMirror(memoryDir, newPaths, backend, assets, log2, dryRun) {
|
|
|
24519
24672
|
let mirrored = 0;
|
|
24520
24673
|
const errors = [];
|
|
24521
24674
|
for (const relPath of newPaths) {
|
|
24522
|
-
const fullPath =
|
|
24675
|
+
const fullPath = path26.join(memoryDir, relPath);
|
|
24523
24676
|
try {
|
|
24524
24677
|
const stat5 = await fsp4.stat(fullPath);
|
|
24525
24678
|
const contentHash = await hashFile2(fullPath);
|
|
24526
|
-
const ext =
|
|
24679
|
+
const ext = path26.extname(relPath);
|
|
24527
24680
|
const mimeType = guessMimeType(ext);
|
|
24528
24681
|
const remotePath = remotePathForAsset(backend, relPath);
|
|
24529
24682
|
let backendLocation = remotePath;
|
|
@@ -24674,7 +24827,7 @@ async function stageRedirect(memoryDir, assets, log2, dryRun, readMarkdownFile,
|
|
|
24674
24827
|
for (const update of updates) {
|
|
24675
24828
|
try {
|
|
24676
24829
|
await withRawEntityPageMutation(memoryDir, update.mdPath, async () => {
|
|
24677
|
-
const stateDir =
|
|
24830
|
+
const stateDir = path26.join(memoryDir, "state");
|
|
24678
24831
|
const kind = classifyEntityRefWritePath(memoryDir, update.mdPath);
|
|
24679
24832
|
if (kind === "memory") {
|
|
24680
24833
|
const idsAtWrite = historicalIdCache.get(stateDir);
|
|
@@ -24767,10 +24920,10 @@ async function countRemainingLocalReferences(memoryDir, asset, assetAbsolute, md
|
|
|
24767
24920
|
return { remaining, errors };
|
|
24768
24921
|
}
|
|
24769
24922
|
function markdownReferencePattern(asset, assetAbsolute, mdPath) {
|
|
24770
|
-
const mdDir =
|
|
24923
|
+
const mdDir = path26.dirname(mdPath);
|
|
24771
24924
|
const candidates = /* @__PURE__ */ new Set();
|
|
24772
24925
|
const addCandidate = (candidate) => {
|
|
24773
|
-
const normalized = candidate.split(
|
|
24926
|
+
const normalized = candidate.split(path26.sep).join("/");
|
|
24774
24927
|
if (normalized.length === 0) return;
|
|
24775
24928
|
candidates.add(normalized);
|
|
24776
24929
|
const isParentTraversal = normalized === ".." || normalized.startsWith("../");
|
|
@@ -24778,10 +24931,10 @@ function markdownReferencePattern(asset, assetAbsolute, mdPath) {
|
|
|
24778
24931
|
candidates.add(`./${normalized}`);
|
|
24779
24932
|
}
|
|
24780
24933
|
};
|
|
24781
|
-
addCandidate(
|
|
24782
|
-
const originalPath = asset.originalPath.split(
|
|
24783
|
-
const originalAsFileRelative =
|
|
24784
|
-
if (
|
|
24934
|
+
addCandidate(path26.relative(mdDir, assetAbsolute));
|
|
24935
|
+
const originalPath = asset.originalPath.split(path26.sep).join("/");
|
|
24936
|
+
const originalAsFileRelative = path26.resolve(mdDir, ...originalPath.split("/"));
|
|
24937
|
+
if (path26.resolve(originalAsFileRelative) === path26.resolve(assetAbsolute)) {
|
|
24785
24938
|
addCandidate(originalPath);
|
|
24786
24939
|
}
|
|
24787
24940
|
addCandidate(`/${originalPath}`);
|
|
@@ -24877,7 +25030,7 @@ async function findMarkdownFiles(dir) {
|
|
|
24877
25030
|
return;
|
|
24878
25031
|
}
|
|
24879
25032
|
for (const entry of entries) {
|
|
24880
|
-
const full =
|
|
25033
|
+
const full = path26.join(current, entry.name);
|
|
24881
25034
|
if (entry.isDirectory()) {
|
|
24882
25035
|
if (entry.name === ".binary-lifecycle") continue;
|
|
24883
25036
|
await walk(full);
|
|
@@ -24952,7 +25105,7 @@ async function runBinaryLifecyclePipeline(memoryDir, config, backend, log2, opts
|
|
|
24952
25105
|
|
|
24953
25106
|
// src/projection/index.ts
|
|
24954
25107
|
import fs from "fs";
|
|
24955
|
-
import
|
|
25108
|
+
import path27 from "path";
|
|
24956
25109
|
var VALID_PROJECTION_CATEGORIES = new Set(ALL_CATEGORY_KEYS);
|
|
24957
25110
|
async function generateContextTree(options) {
|
|
24958
25111
|
const startTime = Date.now();
|
|
@@ -24967,8 +25120,8 @@ async function generateContextTree(options) {
|
|
|
24967
25120
|
let nodesGenerated = 0;
|
|
24968
25121
|
let nodesSkipped = 0;
|
|
24969
25122
|
const categoryCounts = {};
|
|
24970
|
-
const resolvedMemoryDir =
|
|
24971
|
-
const resolvedOutputDir =
|
|
25123
|
+
const resolvedMemoryDir = path27.resolve(memoryDir);
|
|
25124
|
+
const resolvedOutputDir = path27.resolve(outputDir);
|
|
24972
25125
|
const requestedCategories = validateProjectionCategories(filterCategories);
|
|
24973
25126
|
const realMemoryDir = assertSafeMemoryRoot(resolvedMemoryDir);
|
|
24974
25127
|
assertNotSymlink(resolvedOutputDir, "context tree outputDir");
|
|
@@ -25006,7 +25159,7 @@ async function generateContextTree(options) {
|
|
|
25006
25159
|
}
|
|
25007
25160
|
}
|
|
25008
25161
|
if (includeEntities) {
|
|
25009
|
-
const entitiesDir =
|
|
25162
|
+
const entitiesDir = path27.join(memoryDir, "entities");
|
|
25010
25163
|
if (fs.existsSync(entitiesDir)) {
|
|
25011
25164
|
assertSafeInputRoot(realMemoryDir, entitiesDir, "entities root");
|
|
25012
25165
|
categoryCounts["entity"] = 0;
|
|
@@ -25018,7 +25171,7 @@ async function generateContextTree(options) {
|
|
|
25018
25171
|
continue;
|
|
25019
25172
|
}
|
|
25020
25173
|
const content = fs.readFileSync(filePath, "utf8");
|
|
25021
|
-
const fileName =
|
|
25174
|
+
const fileName = path27.basename(filePath, ".md");
|
|
25022
25175
|
const node = projectEntityNode(fileName, content);
|
|
25023
25176
|
const outputPath = resolveContainedOutputPath(realOutputDir, "entities", `${fileName}.md`);
|
|
25024
25177
|
writeProjectedContent(realOutputDir, outputPath, node.content);
|
|
@@ -25030,7 +25183,7 @@ async function generateContextTree(options) {
|
|
|
25030
25183
|
}
|
|
25031
25184
|
const shouldIncludeQuestions = includeQuestions && (requestedCategories === void 0 || requestedCategories.includes("question"));
|
|
25032
25185
|
if (shouldIncludeQuestions) {
|
|
25033
|
-
const questionsDir =
|
|
25186
|
+
const questionsDir = path27.join(memoryDir, "questions");
|
|
25034
25187
|
if (fs.existsSync(questionsDir)) {
|
|
25035
25188
|
assertSafeInputRoot(realMemoryDir, questionsDir, "questions root");
|
|
25036
25189
|
categoryCounts["question"] = 0;
|
|
@@ -25071,8 +25224,8 @@ async function generateContextTree(options) {
|
|
|
25071
25224
|
};
|
|
25072
25225
|
}
|
|
25073
25226
|
function isPathInside(root, candidate) {
|
|
25074
|
-
const relative =
|
|
25075
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
25227
|
+
const relative = path27.relative(root, candidate);
|
|
25228
|
+
return relative === "" || !relative.startsWith("..") && !path27.isAbsolute(relative);
|
|
25076
25229
|
}
|
|
25077
25230
|
function assertNotSymlink(targetPath, label) {
|
|
25078
25231
|
try {
|
|
@@ -25109,12 +25262,12 @@ function assertSafeInputRoot(realMemoryDir, targetPath, label) {
|
|
|
25109
25262
|
}
|
|
25110
25263
|
function assertSafeOutputTarget(realOutputDir, outputPath) {
|
|
25111
25264
|
let current = realOutputDir;
|
|
25112
|
-
const relative =
|
|
25113
|
-
if (relative.startsWith("..") ||
|
|
25265
|
+
const relative = path27.relative(realOutputDir, outputPath);
|
|
25266
|
+
if (relative.startsWith("..") || path27.isAbsolute(relative)) {
|
|
25114
25267
|
throw new Error(`context tree output path escapes outputDir: ${outputPath}`);
|
|
25115
25268
|
}
|
|
25116
|
-
for (const segment of relative.split(
|
|
25117
|
-
current =
|
|
25269
|
+
for (const segment of relative.split(path27.sep).filter(Boolean)) {
|
|
25270
|
+
current = path27.join(current, segment);
|
|
25118
25271
|
try {
|
|
25119
25272
|
const stat5 = fs.lstatSync(current);
|
|
25120
25273
|
if (stat5.isSymbolicLink()) {
|
|
@@ -25144,17 +25297,17 @@ function validateProjectionCategories(categories) {
|
|
|
25144
25297
|
return validated;
|
|
25145
25298
|
}
|
|
25146
25299
|
function resolveContainedOutputPath(outputRoot, ...segments) {
|
|
25147
|
-
const resolved =
|
|
25148
|
-
const relative =
|
|
25149
|
-
if (relative === "" || !relative.startsWith("..") && !
|
|
25300
|
+
const resolved = path27.resolve(outputRoot, ...segments);
|
|
25301
|
+
const relative = path27.relative(outputRoot, resolved);
|
|
25302
|
+
if (relative === "" || !relative.startsWith("..") && !path27.isAbsolute(relative)) {
|
|
25150
25303
|
return resolved;
|
|
25151
25304
|
}
|
|
25152
25305
|
throw new Error(`context tree output path escapes outputDir: ${segments.join("/")}`);
|
|
25153
25306
|
}
|
|
25154
25307
|
function writeProjectedContent(realOutputDir, outputPath, generatedContent) {
|
|
25155
25308
|
assertSafeOutputTarget(realOutputDir, outputPath);
|
|
25156
|
-
fs.mkdirSync(
|
|
25157
|
-
const realParent = fs.realpathSync(
|
|
25309
|
+
fs.mkdirSync(path27.dirname(outputPath), { recursive: true });
|
|
25310
|
+
const realParent = fs.realpathSync(path27.dirname(outputPath));
|
|
25158
25311
|
if (!isPathInside(realOutputDir, realParent)) {
|
|
25159
25312
|
throw new Error(`context tree output path escapes outputDir: ${outputPath}`);
|
|
25160
25313
|
}
|
|
@@ -25193,7 +25346,7 @@ function walkR(dir, realMemoryDir) {
|
|
|
25193
25346
|
const results = [];
|
|
25194
25347
|
function walk(directory) {
|
|
25195
25348
|
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
25196
|
-
const fullPath =
|
|
25349
|
+
const fullPath = path27.join(directory, entry.name);
|
|
25197
25350
|
if (entry.isSymbolicLink()) {
|
|
25198
25351
|
throw new Error(`context tree input path contains symlink: ${fullPath}`);
|
|
25199
25352
|
}
|
|
@@ -25246,13 +25399,13 @@ function extractBody(content) {
|
|
|
25246
25399
|
}
|
|
25247
25400
|
function projectNode(filePath, category, fm, rawContent) {
|
|
25248
25401
|
const body = extractBody(rawContent);
|
|
25249
|
-
const fileName =
|
|
25250
|
-
const dateDir =
|
|
25402
|
+
const fileName = path27.basename(filePath, ".md");
|
|
25403
|
+
const dateDir = path27.basename(path27.dirname(filePath));
|
|
25251
25404
|
let relPath;
|
|
25252
25405
|
if (/^\d{4}-\d{2}-\d{2}$/.test(dateDir)) {
|
|
25253
|
-
relPath =
|
|
25406
|
+
relPath = path27.join(category, dateDir, `${fileName}.md`);
|
|
25254
25407
|
} else {
|
|
25255
|
-
relPath =
|
|
25408
|
+
relPath = path27.join(category, `${fileName}.md`);
|
|
25256
25409
|
}
|
|
25257
25410
|
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
25258
25411
|
const md = `# ${fm.id}
|
|
@@ -25298,7 +25451,7 @@ function projectEntityNode(fileName, content) {
|
|
|
25298
25451
|
${content}
|
|
25299
25452
|
`;
|
|
25300
25453
|
return {
|
|
25301
|
-
path:
|
|
25454
|
+
path: path27.join("entities", `${fileName}.md`),
|
|
25302
25455
|
category: "entity",
|
|
25303
25456
|
title: fileName,
|
|
25304
25457
|
content: md,
|
|
@@ -25351,7 +25504,7 @@ function generateIndex(categoryCounts, outputDir) {
|
|
|
25351
25504
|
|
|
25352
25505
|
// src/onboarding/index.ts
|
|
25353
25506
|
import fs2 from "fs";
|
|
25354
|
-
import
|
|
25507
|
+
import path28 from "path";
|
|
25355
25508
|
var LANGUAGE_RULES = [
|
|
25356
25509
|
{
|
|
25357
25510
|
language: "TypeScript",
|
|
@@ -25453,7 +25606,7 @@ function onboard(options) {
|
|
|
25453
25606
|
maxDepth = 6,
|
|
25454
25607
|
excludeDirs = []
|
|
25455
25608
|
} = options;
|
|
25456
|
-
const directory =
|
|
25609
|
+
const directory = path28.resolve(options.directory ?? process.cwd());
|
|
25457
25610
|
let rootStat;
|
|
25458
25611
|
try {
|
|
25459
25612
|
rootStat = fs2.statSync(directory);
|
|
@@ -25495,7 +25648,7 @@ function walkDir(root, exclude, maxDepth) {
|
|
|
25495
25648
|
}
|
|
25496
25649
|
for (const entry of entries) {
|
|
25497
25650
|
if (exclude.has(entry.name)) continue;
|
|
25498
|
-
const fullPath =
|
|
25651
|
+
const fullPath = path28.join(dir, entry.name);
|
|
25499
25652
|
if (entry.isDirectory()) {
|
|
25500
25653
|
walk(fullPath, depth + 1);
|
|
25501
25654
|
} else if (entry.isFile()) {
|
|
@@ -25510,11 +25663,11 @@ function detectLanguages(files, root) {
|
|
|
25510
25663
|
const results = [];
|
|
25511
25664
|
const extCounts = /* @__PURE__ */ new Map();
|
|
25512
25665
|
for (const f of files) {
|
|
25513
|
-
const ext =
|
|
25666
|
+
const ext = path28.extname(f).toLowerCase();
|
|
25514
25667
|
if (ext) extCounts.set(ext, (extCounts.get(ext) ?? 0) + 1);
|
|
25515
25668
|
}
|
|
25516
25669
|
const rootFiles = new Set(
|
|
25517
|
-
files.filter((f) =>
|
|
25670
|
+
files.filter((f) => path28.dirname(f) === root).map((f) => path28.basename(f))
|
|
25518
25671
|
);
|
|
25519
25672
|
for (const rule of LANGUAGE_RULES) {
|
|
25520
25673
|
const evidence = [];
|
|
@@ -25558,7 +25711,7 @@ function detectLanguages(files, root) {
|
|
|
25558
25711
|
}
|
|
25559
25712
|
function detectShape(files, root) {
|
|
25560
25713
|
const rootFiles = new Set(
|
|
25561
|
-
files.filter((f) =>
|
|
25714
|
+
files.filter((f) => path28.dirname(f) === root).map((f) => path28.basename(f))
|
|
25562
25715
|
);
|
|
25563
25716
|
const rootDirs = /* @__PURE__ */ new Set();
|
|
25564
25717
|
try {
|
|
@@ -25569,7 +25722,7 @@ function detectShape(files, root) {
|
|
|
25569
25722
|
}
|
|
25570
25723
|
const evidence = [];
|
|
25571
25724
|
if (rootFiles.has("package.json")) {
|
|
25572
|
-
const pkg = readJsonSafe(
|
|
25725
|
+
const pkg = readJsonSafe(path28.join(root, "package.json"));
|
|
25573
25726
|
if (pkg?.workspaces) {
|
|
25574
25727
|
evidence.push("package.json has workspaces");
|
|
25575
25728
|
return { shape: "monorepo", evidence };
|
|
@@ -25583,13 +25736,13 @@ function detectShape(files, root) {
|
|
|
25583
25736
|
evidence.push("workspace manifest found");
|
|
25584
25737
|
return { shape: "workspace", evidence };
|
|
25585
25738
|
}
|
|
25586
|
-
const cargoToml = readTomlWorkspace(
|
|
25739
|
+
const cargoToml = readTomlWorkspace(path28.join(root, "Cargo.toml"));
|
|
25587
25740
|
if (cargoToml) {
|
|
25588
25741
|
evidence.push("Cargo.toml has workspace");
|
|
25589
25742
|
return { shape: "workspace", evidence };
|
|
25590
25743
|
}
|
|
25591
25744
|
if (rootFiles.has("package.json")) {
|
|
25592
|
-
const pkg = readJsonSafe(
|
|
25745
|
+
const pkg = readJsonSafe(path28.join(root, "package.json"));
|
|
25593
25746
|
if (pkg?.exports || pkg?.main) {
|
|
25594
25747
|
if (pkg?.bin) {
|
|
25595
25748
|
evidence.push("package.json has bin");
|
|
@@ -25623,8 +25776,8 @@ function discoverDocs(files, root) {
|
|
|
25623
25776
|
{ pattern: /^\.editorconfig$/i, kind: "config" }
|
|
25624
25777
|
];
|
|
25625
25778
|
for (const filePath of files) {
|
|
25626
|
-
const basename =
|
|
25627
|
-
const relPath =
|
|
25779
|
+
const basename = path28.basename(filePath).toLowerCase();
|
|
25780
|
+
const relPath = path28.relative(root, filePath);
|
|
25628
25781
|
let kind;
|
|
25629
25782
|
for (const { pattern, kind: k } of docPatterns) {
|
|
25630
25783
|
if (pattern.test(basename)) {
|
|
@@ -25636,7 +25789,7 @@ function discoverDocs(files, root) {
|
|
|
25636
25789
|
kind = "docs";
|
|
25637
25790
|
}
|
|
25638
25791
|
if (!kind && (basename.endsWith(".md") || basename.endsWith(".mdx"))) {
|
|
25639
|
-
if (
|
|
25792
|
+
if (path28.dirname(relPath) === "." || isUnderDocsDir(relPath)) {
|
|
25640
25793
|
kind = "docs";
|
|
25641
25794
|
}
|
|
25642
25795
|
}
|
|
@@ -25657,7 +25810,7 @@ function discoverDocs(files, root) {
|
|
|
25657
25810
|
return docs;
|
|
25658
25811
|
}
|
|
25659
25812
|
function isUnderDocsDir(relPath) {
|
|
25660
|
-
const parts = relPath.split(
|
|
25813
|
+
const parts = relPath.split(path28.sep);
|
|
25661
25814
|
return parts[0] === "docs" || parts[0] === "doc" || parts[0] === "documentation";
|
|
25662
25815
|
}
|
|
25663
25816
|
function buildPlan(languages, shape, docs, _root) {
|
|
@@ -25701,7 +25854,7 @@ function readTomlWorkspace(filePath) {
|
|
|
25701
25854
|
|
|
25702
25855
|
// src/curation/index.ts
|
|
25703
25856
|
import fs3 from "fs";
|
|
25704
|
-
import
|
|
25857
|
+
import path29 from "path";
|
|
25705
25858
|
import crypto4 from "crypto";
|
|
25706
25859
|
async function curate(options) {
|
|
25707
25860
|
const startTime = Date.now();
|
|
@@ -25792,12 +25945,12 @@ function resolveTargets(targetPath) {
|
|
|
25792
25945
|
const extensions = /* @__PURE__ */ new Set([".md", ".txt", ".mdx", ".rst"]);
|
|
25793
25946
|
function walk(dir) {
|
|
25794
25947
|
for (const entry of fs3.readdirSync(dir, { withFileTypes: true })) {
|
|
25795
|
-
const fullPath =
|
|
25948
|
+
const fullPath = path29.join(dir, entry.name);
|
|
25796
25949
|
if (entry.isDirectory()) {
|
|
25797
25950
|
if (entry.name !== "node_modules" && entry.name !== ".git") {
|
|
25798
25951
|
walk(fullPath);
|
|
25799
25952
|
}
|
|
25800
|
-
} else if (extensions.has(
|
|
25953
|
+
} else if (extensions.has(path29.extname(entry.name).toLowerCase())) {
|
|
25801
25954
|
results.push(fullPath);
|
|
25802
25955
|
}
|
|
25803
25956
|
}
|
|
@@ -25806,12 +25959,12 @@ function resolveTargets(targetPath) {
|
|
|
25806
25959
|
return results;
|
|
25807
25960
|
}
|
|
25808
25961
|
function resolveProvenanceRoot(targetPath) {
|
|
25809
|
-
const resolvedTarget =
|
|
25962
|
+
const resolvedTarget = path29.resolve(targetPath);
|
|
25810
25963
|
const stat5 = fs3.statSync(resolvedTarget);
|
|
25811
|
-
return stat5.isFile() ?
|
|
25964
|
+
return stat5.isFile() ? path29.dirname(resolvedTarget) : resolvedTarget;
|
|
25812
25965
|
}
|
|
25813
25966
|
function extractStatements(content, filePath, projectRoot, source, sourceFileHash, categoryOverride, confidence, entityRef, tags) {
|
|
25814
|
-
const relativePath =
|
|
25967
|
+
const relativePath = path29.relative(projectRoot, path29.resolve(filePath)) || path29.basename(filePath);
|
|
25815
25968
|
const statements = [];
|
|
25816
25969
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
25817
25970
|
const paragraphs = content.split(/\n{2,}/).map((p) => p.trim()).filter((p) => p.length > 20 && p.length < 2e3);
|
|
@@ -25905,7 +26058,7 @@ function loadExistingMemories(memoryDir) {
|
|
|
25905
26058
|
if (!fs3.existsSync(memoryDir)) return result;
|
|
25906
26059
|
const dirs = ALL_CATEGORY_DIRS;
|
|
25907
26060
|
for (const dir of dirs) {
|
|
25908
|
-
const fullDir =
|
|
26061
|
+
const fullDir = path29.join(memoryDir, dir);
|
|
25909
26062
|
if (!fs3.existsSync(fullDir)) continue;
|
|
25910
26063
|
walkFiles(fullDir, (filePath) => {
|
|
25911
26064
|
const content = readFileSafe(filePath);
|
|
@@ -25928,11 +26081,11 @@ function writeStatement(stmt, memoryDir) {
|
|
|
25928
26081
|
const now = /* @__PURE__ */ new Date();
|
|
25929
26082
|
const dateDir = now.toISOString().split("T")[0];
|
|
25930
26083
|
const categoryDir = getCategoryDir(memoryDir, stmt.category);
|
|
25931
|
-
const dir =
|
|
26084
|
+
const dir = path29.join(categoryDir, dateDir);
|
|
25932
26085
|
fs3.mkdirSync(dir, { recursive: true });
|
|
25933
26086
|
const fileName = `${stmt.category}-${Date.now()}-${stmt.id.slice(0, 8)}.md`;
|
|
25934
|
-
const filePath =
|
|
25935
|
-
const historicalIds = historicalIdCache2.get(
|
|
26087
|
+
const filePath = path29.join(dir, fileName);
|
|
26088
|
+
const historicalIds = historicalIdCache2.get(path29.join(memoryDir, "state"));
|
|
25936
26089
|
const rawBody = `${[
|
|
25937
26090
|
"---",
|
|
25938
26091
|
`id: ${stmt.id}`,
|
|
@@ -25955,7 +26108,7 @@ ${stmt.content}
|
|
|
25955
26108
|
fs3.writeFileSync(filePath, body);
|
|
25956
26109
|
try {
|
|
25957
26110
|
repairContentAfterJournalMoveSync({
|
|
25958
|
-
stateDir:
|
|
26111
|
+
stateDir: path29.join(memoryDir, "state"),
|
|
25959
26112
|
cache: historicalIdCache2,
|
|
25960
26113
|
idsAtWrite: historicalIds,
|
|
25961
26114
|
rawContent: rawBody,
|
|
@@ -26016,7 +26169,7 @@ function extractBody2(content) {
|
|
|
26016
26169
|
}
|
|
26017
26170
|
function walkFiles(dir, callback) {
|
|
26018
26171
|
for (const entry of fs3.readdirSync(dir, { withFileTypes: true })) {
|
|
26019
|
-
const fullPath =
|
|
26172
|
+
const fullPath = path29.join(dir, entry.name);
|
|
26020
26173
|
if (entry.isDirectory()) {
|
|
26021
26174
|
walkFiles(fullPath, callback);
|
|
26022
26175
|
} else if (entry.name.endsWith(".md")) {
|
|
@@ -26028,7 +26181,7 @@ function walkFiles(dir, callback) {
|
|
|
26028
26181
|
// src/dedup/index.ts
|
|
26029
26182
|
import crypto5 from "crypto";
|
|
26030
26183
|
import fs4 from "fs";
|
|
26031
|
-
import
|
|
26184
|
+
import path30 from "path";
|
|
26032
26185
|
var DEFAULT_DEDUP_THRESHOLD = 0.85;
|
|
26033
26186
|
var DEFAULT_MAX_LOAD = 1e4;
|
|
26034
26187
|
function normalizeThreshold(value, defaultValue) {
|
|
@@ -26235,7 +26388,7 @@ function loadMemories(memoryDir, categories, maxLoad = 1e4) {
|
|
|
26235
26388
|
const memoryRootReal = fs4.realpathSync(memoryDir);
|
|
26236
26389
|
for (const category of allCategories) {
|
|
26237
26390
|
if (result.length >= maxLoad) break;
|
|
26238
|
-
const dir =
|
|
26391
|
+
const dir = path30.join(memoryDir, category);
|
|
26239
26392
|
if (!fs4.existsSync(dir)) continue;
|
|
26240
26393
|
const categoryStat = fs4.lstatSync(dir);
|
|
26241
26394
|
if (categoryStat.isSymbolicLink()) {
|
|
@@ -26296,15 +26449,15 @@ function extractBody3(content) {
|
|
|
26296
26449
|
return match ? match[1].trim() : content.trim();
|
|
26297
26450
|
}
|
|
26298
26451
|
function assertPathInsideRoot2(rootReal, targetReal, sourcePath) {
|
|
26299
|
-
const rel =
|
|
26300
|
-
if (rel === "" || !rel.startsWith("..") && !
|
|
26452
|
+
const rel = path30.relative(rootReal, targetReal);
|
|
26453
|
+
if (rel === "" || !rel.startsWith("..") && !path30.isAbsolute(rel)) {
|
|
26301
26454
|
return;
|
|
26302
26455
|
}
|
|
26303
26456
|
throw new Error(`Refusing to scan memory path outside root: ${sourcePath}`);
|
|
26304
26457
|
}
|
|
26305
26458
|
function walkMdFiles(dir, memoryRootReal, categoryRootReal, callback) {
|
|
26306
26459
|
for (const entry of fs4.readdirSync(dir, { withFileTypes: true })) {
|
|
26307
|
-
const fullPath =
|
|
26460
|
+
const fullPath = path30.join(dir, entry.name);
|
|
26308
26461
|
const entryStat = fs4.lstatSync(fullPath);
|
|
26309
26462
|
if (entryStat.isSymbolicLink()) {
|
|
26310
26463
|
throw new Error(`Refusing to scan symlinked memory path: ${fullPath}`);
|
|
@@ -26322,7 +26475,7 @@ function walkMdFiles(dir, memoryRootReal, categoryRootReal, callback) {
|
|
|
26322
26475
|
|
|
26323
26476
|
// src/sync/index.ts
|
|
26324
26477
|
import fs5 from "fs";
|
|
26325
|
-
import
|
|
26478
|
+
import path31 from "path";
|
|
26326
26479
|
import crypto6 from "crypto";
|
|
26327
26480
|
var DEFAULT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".txt", ".mdx", ".rst"]);
|
|
26328
26481
|
var DEFAULT_EXCLUDE2 = /* @__PURE__ */ new Set([
|
|
@@ -26344,7 +26497,7 @@ function syncChanges(options) {
|
|
|
26344
26497
|
} = options;
|
|
26345
26498
|
const extSet = new Set(extensions);
|
|
26346
26499
|
const excludeSet = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE2, ...excludeDirs]);
|
|
26347
|
-
const stateFilePath = options.stateFile ??
|
|
26500
|
+
const stateFilePath = options.stateFile ?? path31.join(memoryDir, ".sync-state.json");
|
|
26348
26501
|
const prevState = loadState(stateFilePath);
|
|
26349
26502
|
const currentFiles = scanFiles(sourceDir, extSet, excludeSet);
|
|
26350
26503
|
const changes = computeDiff(currentFiles, prevState.fileHashes, sourceDir);
|
|
@@ -26360,7 +26513,7 @@ function syncChanges(options) {
|
|
|
26360
26513
|
for (const [relPath, hash] of Object.entries(currentFiles)) {
|
|
26361
26514
|
newState.fileHashes[relPath] = hash;
|
|
26362
26515
|
}
|
|
26363
|
-
fs5.mkdirSync(
|
|
26516
|
+
fs5.mkdirSync(path31.dirname(stateFilePath), { recursive: true });
|
|
26364
26517
|
fs5.writeFileSync(stateFilePath, JSON.stringify(newState, null, 2));
|
|
26365
26518
|
}
|
|
26366
26519
|
return {
|
|
@@ -26426,13 +26579,13 @@ function scanFiles(root, extensions, exclude) {
|
|
|
26426
26579
|
}
|
|
26427
26580
|
for (const entry of entries) {
|
|
26428
26581
|
if (exclude.has(entry.name)) continue;
|
|
26429
|
-
const fullPath =
|
|
26582
|
+
const fullPath = path31.join(dir, entry.name);
|
|
26430
26583
|
if (entry.isDirectory()) {
|
|
26431
26584
|
walk(fullPath);
|
|
26432
26585
|
} else if (entry.isFile()) {
|
|
26433
|
-
const ext =
|
|
26586
|
+
const ext = path31.extname(entry.name).toLowerCase();
|
|
26434
26587
|
if (!extensions.has(ext)) continue;
|
|
26435
|
-
const relPath =
|
|
26588
|
+
const relPath = path31.relative(root, fullPath);
|
|
26436
26589
|
try {
|
|
26437
26590
|
const content = fs5.readFileSync(fullPath, "utf8");
|
|
26438
26591
|
result[relPath] = hashContent3(content);
|
|
@@ -26447,7 +26600,7 @@ function scanFiles(root, extensions, exclude) {
|
|
|
26447
26600
|
function computeDiff(current, previous, sourceDir) {
|
|
26448
26601
|
const changes = [];
|
|
26449
26602
|
for (const [relPath, hash] of Object.entries(current)) {
|
|
26450
|
-
const fullPath =
|
|
26603
|
+
const fullPath = path31.join(sourceDir, relPath);
|
|
26451
26604
|
if (!(relPath in previous)) {
|
|
26452
26605
|
let size = 0;
|
|
26453
26606
|
try {
|
|
@@ -26480,7 +26633,7 @@ function computeDiff(current, previous, sourceDir) {
|
|
|
26480
26633
|
for (const relPath of Object.keys(previous)) {
|
|
26481
26634
|
if (!(relPath in current)) {
|
|
26482
26635
|
changes.push({
|
|
26483
|
-
filePath:
|
|
26636
|
+
filePath: path31.join(sourceDir, relPath),
|
|
26484
26637
|
relativePath: relPath,
|
|
26485
26638
|
type: "deleted",
|
|
26486
26639
|
currentHash: "",
|
|
@@ -26510,21 +26663,21 @@ function hashContent3(content) {
|
|
|
26510
26663
|
import { spawnSync } from "child_process";
|
|
26511
26664
|
import crypto7 from "crypto";
|
|
26512
26665
|
import fs6 from "fs";
|
|
26513
|
-
import
|
|
26666
|
+
import path32 from "path";
|
|
26514
26667
|
var historicalIdCache3 = new HistoricalEntityCanonicalIdCache();
|
|
26515
26668
|
var MANIFEST_VERSION = 1;
|
|
26516
26669
|
var MANIFEST_LOCK_STALE_MS = 3e4;
|
|
26517
26670
|
var MANIFEST_LOCK_TIMEOUT_MS = MANIFEST_LOCK_STALE_MS + 1e4;
|
|
26518
26671
|
var MANIFEST_LOCK_SLEEP_MS = 20;
|
|
26519
26672
|
function normalizeSpaceMemoryDir(memoryDir) {
|
|
26520
|
-
return
|
|
26673
|
+
return path32.resolve(memoryDir);
|
|
26521
26674
|
}
|
|
26522
26675
|
function getSpacesDir(baseDir) {
|
|
26523
26676
|
const homeDir = baseDir ?? resolveHomeDir();
|
|
26524
|
-
return
|
|
26677
|
+
return path32.join(homeDir, ".config", "engram", "spaces");
|
|
26525
26678
|
}
|
|
26526
26679
|
function getManifestPath(baseDir) {
|
|
26527
|
-
return
|
|
26680
|
+
return path32.join(getSpacesDir(baseDir), "manifest.json");
|
|
26528
26681
|
}
|
|
26529
26682
|
function loadManifest(baseDir, memoryDirOverride) {
|
|
26530
26683
|
if (fs6.existsSync(getManifestPath(baseDir))) {
|
|
@@ -26571,9 +26724,9 @@ function readManifestUnlocked(baseDir, memoryDirOverride, options = {}) {
|
|
|
26571
26724
|
}
|
|
26572
26725
|
function saveManifestUnlocked(manifest, baseDir) {
|
|
26573
26726
|
const manifestPath2 = getManifestPath(baseDir);
|
|
26574
|
-
const manifestDir2 =
|
|
26727
|
+
const manifestDir2 = path32.dirname(manifestPath2);
|
|
26575
26728
|
fs6.mkdirSync(manifestDir2, { recursive: true });
|
|
26576
|
-
const tempPath =
|
|
26729
|
+
const tempPath = path32.join(manifestDir2, `.manifest.${process.pid}.${Date.now()}.${crypto7.randomUUID()}.tmp`);
|
|
26577
26730
|
try {
|
|
26578
26731
|
fs6.writeFileSync(tempPath, `${JSON.stringify(manifest, null, 2)}
|
|
26579
26732
|
`, { flag: "wx" });
|
|
@@ -26588,7 +26741,7 @@ function saveManifestUnlocked(manifest, baseDir) {
|
|
|
26588
26741
|
}
|
|
26589
26742
|
function withManifestLock(baseDir, operation) {
|
|
26590
26743
|
const lockDir = `${getManifestPath(baseDir)}.lock`;
|
|
26591
|
-
fs6.mkdirSync(
|
|
26744
|
+
fs6.mkdirSync(path32.dirname(lockDir), { recursive: true });
|
|
26592
26745
|
const lockOwner = acquireManifestLock(lockDir);
|
|
26593
26746
|
try {
|
|
26594
26747
|
return operation();
|
|
@@ -26614,7 +26767,7 @@ function acquireManifestLock(lockDir) {
|
|
|
26614
26767
|
try {
|
|
26615
26768
|
fs6.mkdirSync(lockDir, { recursive: false });
|
|
26616
26769
|
try {
|
|
26617
|
-
fs6.writeFileSync(
|
|
26770
|
+
fs6.writeFileSync(path32.join(lockDir, "owner"), `${owner}
|
|
26618
26771
|
`, { flag: "wx" });
|
|
26619
26772
|
} catch (error) {
|
|
26620
26773
|
fs6.rmSync(lockDir, { recursive: true, force: true });
|
|
@@ -26644,7 +26797,7 @@ function acquireManifestLock(lockDir) {
|
|
|
26644
26797
|
}
|
|
26645
26798
|
function releaseManifestLock(lockDir, owner) {
|
|
26646
26799
|
try {
|
|
26647
|
-
const ownerPath =
|
|
26800
|
+
const ownerPath = path32.join(lockDir, "owner");
|
|
26648
26801
|
if (fs6.readFileSync(ownerPath, "utf8").trim() === owner) {
|
|
26649
26802
|
fs6.rmSync(lockDir, { recursive: true, force: true });
|
|
26650
26803
|
}
|
|
@@ -26660,7 +26813,7 @@ function removeStaleManifestLock(lockDir) {
|
|
|
26660
26813
|
try {
|
|
26661
26814
|
fs6.mkdirSync(reclaimDir, { recursive: false });
|
|
26662
26815
|
try {
|
|
26663
|
-
fs6.writeFileSync(
|
|
26816
|
+
fs6.writeFileSync(path32.join(reclaimDir, "owner"), `${reclaimOwner}
|
|
26664
26817
|
`, { flag: "wx" });
|
|
26665
26818
|
} catch (error) {
|
|
26666
26819
|
fs6.rmSync(reclaimDir, { recursive: true, force: true });
|
|
@@ -26735,7 +26888,7 @@ function readManifestLockSnapshot(lockDir) {
|
|
|
26735
26888
|
throw error;
|
|
26736
26889
|
}
|
|
26737
26890
|
try {
|
|
26738
|
-
const owner = fs6.readFileSync(
|
|
26891
|
+
const owner = fs6.readFileSync(path32.join(lockDir, "owner"), "utf8").trim();
|
|
26739
26892
|
return { mtimeMs: stat5.mtimeMs, owner };
|
|
26740
26893
|
} catch (error) {
|
|
26741
26894
|
if (error.code === "ENOENT") {
|
|
@@ -26807,8 +26960,8 @@ function sleepSync(ms) {
|
|
|
26807
26960
|
}
|
|
26808
26961
|
function createPersonalSpace(baseDir, memoryDirOverride) {
|
|
26809
26962
|
const homeDir = baseDir ?? resolveHomeDir();
|
|
26810
|
-
const standalonePath =
|
|
26811
|
-
const openclawPath =
|
|
26963
|
+
const standalonePath = path32.join(homeDir, ".engram", "memory");
|
|
26964
|
+
const openclawPath = path32.join(homeDir, ".openclaw", "workspace", "memory", "local");
|
|
26812
26965
|
const memoryDir = memoryDirOverride ?? readEnvVar("REMNIC_MEMORY_DIR") ?? readEnvVar("ENGRAM_MEMORY_DIR") ?? (fs6.existsSync(standalonePath) ? standalonePath : fs6.existsSync(openclawPath) ? openclawPath : standalonePath);
|
|
26813
26966
|
const normalizedMemoryDir = normalizeSpaceMemoryDir(memoryDir);
|
|
26814
26967
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -26837,7 +26990,7 @@ function createSpace(options) {
|
|
|
26837
26990
|
const id = options.name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
|
|
26838
26991
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
26839
26992
|
const memoryDir = normalizeSpaceMemoryDir(
|
|
26840
|
-
options.memoryDir ??
|
|
26993
|
+
options.memoryDir ?? path32.join(getSpacesDir(options.baseDir), id, "memory")
|
|
26841
26994
|
);
|
|
26842
26995
|
const space = updateManifest(options.baseDir, (manifest) => {
|
|
26843
26996
|
if (manifest.spaces.some((s) => s.id === id)) {
|
|
@@ -27083,14 +27236,14 @@ async function mergeSpaces(sourceSpaceId, targetSpaceId, options) {
|
|
|
27083
27236
|
};
|
|
27084
27237
|
}
|
|
27085
27238
|
function getAuditLog(baseDir) {
|
|
27086
|
-
const auditPath =
|
|
27239
|
+
const auditPath = path32.join(getSpacesDir(baseDir), "audit.jsonl");
|
|
27087
27240
|
if (!fs6.existsSync(auditPath)) return [];
|
|
27088
27241
|
const lines = fs6.readFileSync(auditPath, "utf8").trim().split("\n");
|
|
27089
27242
|
return lines.filter((l) => l.trim()).map((l) => JSON.parse(l));
|
|
27090
27243
|
}
|
|
27091
27244
|
function appendAudit(entry, baseDir) {
|
|
27092
|
-
const auditPath =
|
|
27093
|
-
fs6.mkdirSync(
|
|
27245
|
+
const auditPath = path32.join(getSpacesDir(baseDir), "audit.jsonl");
|
|
27246
|
+
fs6.mkdirSync(path32.dirname(auditPath), { recursive: true });
|
|
27094
27247
|
const full = {
|
|
27095
27248
|
id: crypto7.randomUUID(),
|
|
27096
27249
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -27111,11 +27264,11 @@ async function copyMemories(sourceDir, targetDir, options) {
|
|
|
27111
27264
|
sourceFiles.filter((p) => {
|
|
27112
27265
|
const rp = safeRealpath(p);
|
|
27113
27266
|
if (!rp || !isPathInsideRoot(rp, sourceRoot)) return false;
|
|
27114
|
-
const rel =
|
|
27115
|
-
const mapped =
|
|
27267
|
+
const rel = path32.relative(sourceRoot, rp);
|
|
27268
|
+
const mapped = path32.resolve(targetRoot, rel);
|
|
27116
27269
|
if (!isPathInsideRoot(mapped, targetRoot)) return false;
|
|
27117
27270
|
return classifyEntityRefWritePath(targetRoot, mapped) === "entity";
|
|
27118
|
-
}).map((p) =>
|
|
27271
|
+
}).map((p) => path32.basename(p, ".md"))
|
|
27119
27272
|
);
|
|
27120
27273
|
const firstEntityId = sourceEntityIds.values().next().value;
|
|
27121
27274
|
if (firstEntityId === void 0) {
|
|
@@ -27123,7 +27276,7 @@ async function copyMemories(sourceDir, targetDir, options) {
|
|
|
27123
27276
|
}
|
|
27124
27277
|
return withRawEntityPageMutation(
|
|
27125
27278
|
targetRoot,
|
|
27126
|
-
|
|
27279
|
+
path32.join(targetRoot, "entities", `${firstEntityId}.md`),
|
|
27127
27280
|
async () => copyPreparedMemories(
|
|
27128
27281
|
sourceFiles,
|
|
27129
27282
|
sourceRoot,
|
|
@@ -27150,14 +27303,14 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
|
|
|
27150
27303
|
continue;
|
|
27151
27304
|
}
|
|
27152
27305
|
const content = fs6.readFileSync(sourcePath, "utf8");
|
|
27153
|
-
const relativePath =
|
|
27154
|
-
const targetPath =
|
|
27306
|
+
const relativePath = path32.relative(sourceRoot, sourceRealPath);
|
|
27307
|
+
const targetPath = path32.resolve(targetRoot, relativePath);
|
|
27155
27308
|
if (!isPathInsideRoot(targetPath, targetRoot)) {
|
|
27156
27309
|
skipped++;
|
|
27157
27310
|
continue;
|
|
27158
27311
|
}
|
|
27159
27312
|
const targetKind = classifyEntityRefWritePath(targetRoot, targetPath);
|
|
27160
|
-
const idsAtCompare = historicalIdCache3.get(
|
|
27313
|
+
const idsAtCompare = historicalIdCache3.get(path32.join(targetRoot, "state"));
|
|
27161
27314
|
const sourceRef = targetKind === "memory" ? readEntityRefFromFrontmatter(content) : null;
|
|
27162
27315
|
const refHasSourceClaimant = sourceRef !== null && sourceEntityIds.has(sourceRef);
|
|
27163
27316
|
const canonicalContent = targetKind === "memory" && !refHasSourceClaimant ? canonicalizeEntityRefFrontmatter(content, idsAtCompare) : content;
|
|
@@ -27184,7 +27337,7 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
|
|
|
27184
27337
|
if (fs6.existsSync(targetPath) && !options?.force) {
|
|
27185
27338
|
const targetContent = fs6.readFileSync(targetPath, "utf8");
|
|
27186
27339
|
const targetHash = hashContent4(targetContent);
|
|
27187
|
-
if (hashContent4(canonicalContent) === targetHash && historicalIdCache3.get(
|
|
27340
|
+
if (hashContent4(canonicalContent) === targetHash && historicalIdCache3.get(path32.join(targetRoot, "state")) === idsAtCompare) {
|
|
27188
27341
|
skipped++;
|
|
27189
27342
|
continue;
|
|
27190
27343
|
}
|
|
@@ -27200,13 +27353,13 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
|
|
|
27200
27353
|
continue;
|
|
27201
27354
|
}
|
|
27202
27355
|
}
|
|
27203
|
-
fs6.mkdirSync(
|
|
27204
|
-
const targetParentRealPath = safeRealpath(
|
|
27356
|
+
fs6.mkdirSync(path32.dirname(targetPath), { recursive: true });
|
|
27357
|
+
const targetParentRealPath = safeRealpath(path32.dirname(targetPath));
|
|
27205
27358
|
if (!targetParentRealPath || !isPathInsideRoot(targetParentRealPath, targetRoot)) {
|
|
27206
27359
|
skipped++;
|
|
27207
27360
|
continue;
|
|
27208
27361
|
}
|
|
27209
|
-
const stateDir =
|
|
27362
|
+
const stateDir = path32.join(targetRoot, "state");
|
|
27210
27363
|
if (targetKind === "memory" && !refHasSourceClaimant) {
|
|
27211
27364
|
const idsAtWrite = historicalIdCache3.get(stateDir);
|
|
27212
27365
|
const written = canonicalizeEntityRefFrontmatter(content, idsAtWrite);
|
|
@@ -27250,7 +27403,7 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
|
|
|
27250
27403
|
bumpMemoryCorpusVersionForDir(targetRoot);
|
|
27251
27404
|
}
|
|
27252
27405
|
if (reconcileNeeded) {
|
|
27253
|
-
requestEntityCanonicalIdReconcileSync(
|
|
27406
|
+
requestEntityCanonicalIdReconcileSync(path32.join(targetRoot, "state"));
|
|
27254
27407
|
}
|
|
27255
27408
|
return { merged, conflicts, skipped };
|
|
27256
27409
|
}
|
|
@@ -27261,7 +27414,7 @@ function walkMd(dir) {
|
|
|
27261
27414
|
const results = [];
|
|
27262
27415
|
function walk(d) {
|
|
27263
27416
|
for (const entry of fs6.readdirSync(d, { withFileTypes: true })) {
|
|
27264
|
-
const fullPath =
|
|
27417
|
+
const fullPath = path32.join(d, entry.name);
|
|
27265
27418
|
if (entry.isSymbolicLink()) {
|
|
27266
27419
|
continue;
|
|
27267
27420
|
}
|
|
@@ -27290,8 +27443,8 @@ function safeRealpath(filePath) {
|
|
|
27290
27443
|
}
|
|
27291
27444
|
}
|
|
27292
27445
|
function isPathInsideRoot(candidatePath, rootPath) {
|
|
27293
|
-
const relative =
|
|
27294
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
27446
|
+
const relative = path32.relative(rootPath, candidatePath);
|
|
27447
|
+
return relative === "" || !relative.startsWith("..") && !path32.isAbsolute(relative);
|
|
27295
27448
|
}
|
|
27296
27449
|
function parseSimpleFrontmatter(content) {
|
|
27297
27450
|
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
@@ -27412,7 +27565,7 @@ var REMNIC_RECALL_DECISION_RULES = `## When to Use Recall vs Direct Read
|
|
|
27412
27565
|
// src/memory-extension/codex-publisher.ts
|
|
27413
27566
|
import fs7 from "fs";
|
|
27414
27567
|
import os from "os";
|
|
27415
|
-
import
|
|
27568
|
+
import path33 from "path";
|
|
27416
27569
|
var REMNIC_EXTENSION_DIR_NAME = "remnic";
|
|
27417
27570
|
function resolveEnvHome(env) {
|
|
27418
27571
|
if (env === void 0) return resolveHomeDir();
|
|
@@ -27421,12 +27574,12 @@ function resolveEnvHome(env) {
|
|
|
27421
27574
|
function expandTildeWithHome(input, homeDir) {
|
|
27422
27575
|
if (input === "~") return homeDir;
|
|
27423
27576
|
if (input.startsWith("~/") || input.startsWith("~\\")) {
|
|
27424
|
-
return
|
|
27577
|
+
return path33.join(homeDir, input.slice(2));
|
|
27425
27578
|
}
|
|
27426
27579
|
return input;
|
|
27427
27580
|
}
|
|
27428
27581
|
function normalizeHostRoot(input, homeDir) {
|
|
27429
|
-
return
|
|
27582
|
+
return path33.resolve(expandTildeWithHome(input.trim(), homeDir));
|
|
27430
27583
|
}
|
|
27431
27584
|
var CodexMemoryExtensionPublisher = class {
|
|
27432
27585
|
hostId = "codex";
|
|
@@ -27440,12 +27593,12 @@ var CodexMemoryExtensionPublisher = class {
|
|
|
27440
27593
|
async resolveExtensionRoot(env) {
|
|
27441
27594
|
const homeDir = resolveEnvHome(env);
|
|
27442
27595
|
const codexHomeInput = env === void 0 ? readEnvVar("CODEX_HOME")?.trim() : env.CODEX_HOME?.trim();
|
|
27443
|
-
const codexHome = codexHomeInput ? normalizeHostRoot(codexHomeInput, homeDir) :
|
|
27444
|
-
return
|
|
27596
|
+
const codexHome = codexHomeInput ? normalizeHostRoot(codexHomeInput, homeDir) : path33.resolve(homeDir, ".codex");
|
|
27597
|
+
return path33.join(codexHome, "memories_extensions", REMNIC_EXTENSION_DIR_NAME);
|
|
27445
27598
|
}
|
|
27446
27599
|
async isHostAvailable() {
|
|
27447
27600
|
try {
|
|
27448
|
-
const home = readEnvVar("CODEX_HOME")?.trim() ||
|
|
27601
|
+
const home = readEnvVar("CODEX_HOME")?.trim() || path33.join(resolveHomeDir(), ".codex");
|
|
27449
27602
|
return fs7.existsSync(home);
|
|
27450
27603
|
} catch {
|
|
27451
27604
|
return false;
|
|
@@ -27496,7 +27649,7 @@ When running inside the Codex phase-2 consolidation sandbox:
|
|
|
27496
27649
|
}
|
|
27497
27650
|
async publish(ctx) {
|
|
27498
27651
|
const extensionRoot = await this.resolveExtensionRoot();
|
|
27499
|
-
const instructionsPath =
|
|
27652
|
+
const instructionsPath = path33.join(extensionRoot, "instructions.md");
|
|
27500
27653
|
const filesWritten = [];
|
|
27501
27654
|
const skipped = [];
|
|
27502
27655
|
ctx.log.info(`Publishing Codex memory extension to ${extensionRoot}`);
|
|
@@ -28128,9 +28281,9 @@ function buildWeeklyActivitySummary(cards, options) {
|
|
|
28128
28281
|
// src/activity/timeline/weekly-persist.ts
|
|
28129
28282
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
28130
28283
|
import { mkdirSync, readFileSync as readFileSync2, renameSync, unlinkSync, writeFileSync } from "fs";
|
|
28131
|
-
import
|
|
28284
|
+
import path34 from "path";
|
|
28132
28285
|
var WEEKLY_SNAPSHOT_FORMAT_VERSION = 1;
|
|
28133
|
-
var WEEKLY_SNAPSHOT_DIR =
|
|
28286
|
+
var WEEKLY_SNAPSHOT_DIR = path34.join("activity", "weekly");
|
|
28134
28287
|
function requireToken(value, name) {
|
|
28135
28288
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
28136
28289
|
throw new TypeError(`${name} must be a non-empty string`);
|
|
@@ -28153,8 +28306,8 @@ function weeklySnapshotPath(input) {
|
|
|
28153
28306
|
const identity = hashActivityBody(
|
|
28154
28307
|
`${input.summary.weekStartUtc}\0${input.summary.weekEndUtc}\0${sourceRevision}\0${configHash}`
|
|
28155
28308
|
);
|
|
28156
|
-
return
|
|
28157
|
-
|
|
28309
|
+
return path34.join(
|
|
28310
|
+
path34.resolve(memoryDir),
|
|
28158
28311
|
WEEKLY_SNAPSHOT_DIR,
|
|
28159
28312
|
namespaceIdentityToken(namespace),
|
|
28160
28313
|
`${weekDate}--${identity}.json`
|
|
@@ -28184,7 +28337,7 @@ function persistWeeklySnapshot(input) {
|
|
|
28184
28337
|
throw error;
|
|
28185
28338
|
}
|
|
28186
28339
|
}
|
|
28187
|
-
mkdirSync(
|
|
28340
|
+
mkdirSync(path34.dirname(filePath), { recursive: true, mode: 448 });
|
|
28188
28341
|
const tmpPath = `${filePath}.${process.pid}.${randomBytes3(8).toString("hex")}.tmp`;
|
|
28189
28342
|
writeFileSync(tmpPath, text, { encoding: "utf8", mode: 384 });
|
|
28190
28343
|
try {
|
|
@@ -28689,7 +28842,7 @@ function selectRecapForDay(input) {
|
|
|
28689
28842
|
|
|
28690
28843
|
// src/activity/journal-read.ts
|
|
28691
28844
|
import { closeSync, constants as fsConstants, fstatSync, lstatSync, openSync, readFileSync as readFileSync3, realpathSync, statSync as statSync2 } from "fs";
|
|
28692
|
-
import
|
|
28845
|
+
import path35 from "path";
|
|
28693
28846
|
|
|
28694
28847
|
// src/activity/journal-section.ts
|
|
28695
28848
|
function parseAtxHeading(line) {
|
|
@@ -28880,8 +29033,8 @@ function readJournalForDate(input) {
|
|
|
28880
29033
|
const relative = resolveVaultNotePath(input.vault.dailyNotePath, input.date, {
|
|
28881
29034
|
timezone: input.timezone
|
|
28882
29035
|
});
|
|
28883
|
-
const root =
|
|
28884
|
-
const filePath =
|
|
29036
|
+
const root = path35.resolve(expandTildePath(input.vault.vaultPath));
|
|
29037
|
+
const filePath = path35.join(root, relative);
|
|
28885
29038
|
try {
|
|
28886
29039
|
const rootStat = lstatSync(root);
|
|
28887
29040
|
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
|
|
@@ -28890,8 +29043,8 @@ function readJournalForDate(input) {
|
|
|
28890
29043
|
} catch {
|
|
28891
29044
|
return { ok: true, exists: false, reason: "missing_file", filePath };
|
|
28892
29045
|
}
|
|
28893
|
-
const lexical =
|
|
28894
|
-
if (lexical.length === 0 || lexical === ".." || lexical.startsWith(`..${
|
|
29046
|
+
const lexical = path35.relative(root, filePath);
|
|
29047
|
+
if (lexical.length === 0 || lexical === ".." || lexical.startsWith(`..${path35.sep}`) || path35.isAbsolute(lexical)) {
|
|
28895
29048
|
return { ok: false, reason: "path_escape", filePath };
|
|
28896
29049
|
}
|
|
28897
29050
|
if (!containedBySymlinks(root, filePath)) {
|
|
@@ -28924,11 +29077,11 @@ function containedBySymlinks(root, dest) {
|
|
|
28924
29077
|
try {
|
|
28925
29078
|
if (statSync2(probe).isFile() || statSync2(probe).isDirectory()) {
|
|
28926
29079
|
const real = realpathSync(probe);
|
|
28927
|
-
return real === realRoot || real.startsWith(`${realRoot}${
|
|
29080
|
+
return real === realRoot || real.startsWith(`${realRoot}${path35.sep}`);
|
|
28928
29081
|
}
|
|
28929
29082
|
} catch {
|
|
28930
29083
|
}
|
|
28931
|
-
const parent =
|
|
29084
|
+
const parent = path35.dirname(probe);
|
|
28932
29085
|
if (parent === probe) return false;
|
|
28933
29086
|
probe = parent;
|
|
28934
29087
|
}
|
|
@@ -28939,15 +29092,15 @@ function symlinkRejected() {
|
|
|
28939
29092
|
return err;
|
|
28940
29093
|
}
|
|
28941
29094
|
function readVerifiedDailyNote(root, filePath) {
|
|
28942
|
-
const relative =
|
|
28943
|
-
const parts = relative.split(
|
|
29095
|
+
const relative = path35.relative(root, filePath);
|
|
29096
|
+
const parts = relative.split(path35.sep).filter((part) => part.length > 0 && part !== ".");
|
|
28944
29097
|
let cursor = root;
|
|
28945
29098
|
for (const part of parts) {
|
|
28946
|
-
cursor =
|
|
29099
|
+
cursor = path35.join(cursor, part);
|
|
28947
29100
|
const st = lstatSync(cursor);
|
|
28948
29101
|
if (st.isSymbolicLink()) throw symlinkRejected();
|
|
28949
29102
|
}
|
|
28950
|
-
const parent =
|
|
29103
|
+
const parent = path35.dirname(filePath);
|
|
28951
29104
|
const parentLstat = lstatSync(parent);
|
|
28952
29105
|
if (parentLstat.isSymbolicLink() || !parentLstat.isDirectory()) throw symlinkRejected();
|
|
28953
29106
|
const nofollow = fsConstants.O_NOFOLLOW ?? 0;
|
|
@@ -28971,7 +29124,7 @@ function readVerifiedDailyNote(root, filePath) {
|
|
|
28971
29124
|
try {
|
|
28972
29125
|
const fdPath = realpathSync(`/proc/self/fd/${fd}`);
|
|
28973
29126
|
const realRoot = realpathSync(root);
|
|
28974
|
-
if (fdPath !== realRoot && !fdPath.startsWith(`${realRoot}${
|
|
29127
|
+
if (fdPath !== realRoot && !fdPath.startsWith(`${realRoot}${path35.sep}`)) {
|
|
28975
29128
|
throw symlinkRejected();
|
|
28976
29129
|
}
|
|
28977
29130
|
} catch (err) {
|
|
@@ -28986,11 +29139,11 @@ function readVerifiedDailyNote(root, filePath) {
|
|
|
28986
29139
|
// src/activity/journal-state.ts
|
|
28987
29140
|
import { createHash as createHash10, randomBytes as randomBytes4 } from "crypto";
|
|
28988
29141
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
28989
|
-
import
|
|
29142
|
+
import path36 from "path";
|
|
28990
29143
|
var STATE_DIR_NAME = "state";
|
|
28991
29144
|
var STATE_FILE_NAME = "timeline.json";
|
|
28992
29145
|
function timelineStatePath(memoryDir) {
|
|
28993
|
-
return
|
|
29146
|
+
return path36.join(memoryDir, STATE_DIR_NAME, STATE_FILE_NAME);
|
|
28994
29147
|
}
|
|
28995
29148
|
function hashJournalText(text) {
|
|
28996
29149
|
return createHash10("sha256").update(text, "utf8").digest("hex");
|
|
@@ -29016,14 +29169,14 @@ function readTimelineState(memoryDir) {
|
|
|
29016
29169
|
}
|
|
29017
29170
|
function writeTimelineState(memoryDir, state) {
|
|
29018
29171
|
const filePath = timelineStatePath(memoryDir);
|
|
29019
|
-
mkdirSync2(
|
|
29172
|
+
mkdirSync2(path36.dirname(filePath), { recursive: true });
|
|
29020
29173
|
const tempPath = `${filePath}.${process.pid}.${randomBytes4(8).toString("hex")}.tmp`;
|
|
29021
29174
|
writeFileSync2(tempPath, `${JSON.stringify(state, null, 2)}
|
|
29022
29175
|
`);
|
|
29023
29176
|
renameSync2(tempPath, filePath);
|
|
29024
29177
|
}
|
|
29025
29178
|
function journalDateLockPath(memoryDir, date) {
|
|
29026
|
-
return
|
|
29179
|
+
return path36.join(memoryDir, STATE_DIR_NAME, `journal-extract-${date}.lock`);
|
|
29027
29180
|
}
|
|
29028
29181
|
function timelineStateLockPath(memoryDir) {
|
|
29029
29182
|
return `${timelineStatePath(memoryDir)}.lock`;
|
|
@@ -29715,7 +29868,7 @@ function filterPrivacyWindow(items, options) {
|
|
|
29715
29868
|
}
|
|
29716
29869
|
|
|
29717
29870
|
// src/activity/vault-wikilink.ts
|
|
29718
|
-
import
|
|
29871
|
+
import path37 from "path";
|
|
29719
29872
|
function formatVaultWikilink(notePath) {
|
|
29720
29873
|
if (typeof notePath !== "string" || notePath.trim().length === 0) {
|
|
29721
29874
|
throw new RangeError("Vault wikilink path must be a non-empty relative path.");
|
|
@@ -29723,7 +29876,7 @@ function formatVaultWikilink(notePath) {
|
|
|
29723
29876
|
if (notePath.includes("\n") || notePath.includes("\r")) {
|
|
29724
29877
|
throw new RangeError("Vault wikilink path must not contain newlines.");
|
|
29725
29878
|
}
|
|
29726
|
-
if (
|
|
29879
|
+
if (path37.posix.isAbsolute(notePath) || path37.win32.isAbsolute(notePath)) {
|
|
29727
29880
|
throw new RangeError("Vault wikilink path must be relative; absolute paths are rejected.");
|
|
29728
29881
|
}
|
|
29729
29882
|
if (notePath.split(/[\\/]/).some((segment) => segment === "..")) {
|
|
@@ -29745,7 +29898,7 @@ function stripVaultMdSuffix(notePath) {
|
|
|
29745
29898
|
}
|
|
29746
29899
|
|
|
29747
29900
|
// src/activity/vault-join.ts
|
|
29748
|
-
import
|
|
29901
|
+
import path38 from "path";
|
|
29749
29902
|
function joinVaultSegments(parts) {
|
|
29750
29903
|
if (parts.length === 0) {
|
|
29751
29904
|
throw new RangeError("Vault path parts must be a non-empty list.");
|
|
@@ -29760,7 +29913,7 @@ function joinVaultSegments(parts) {
|
|
|
29760
29913
|
if (part.includes("\n") || part.includes("\r")) {
|
|
29761
29914
|
throw new RangeError("Vault path part must not contain a newline.");
|
|
29762
29915
|
}
|
|
29763
|
-
if (
|
|
29916
|
+
if (path38.posix.isAbsolute(part) || path38.win32.isAbsolute(part)) {
|
|
29764
29917
|
throw new RangeError("Vault path part must be relative.");
|
|
29765
29918
|
}
|
|
29766
29919
|
if (part.split("/").includes("..")) {
|
|
@@ -29815,7 +29968,7 @@ function planVaultDryRun(inputs) {
|
|
|
29815
29968
|
// src/session-summaries/index.ts
|
|
29816
29969
|
import { createHash as createHash11 } from "crypto";
|
|
29817
29970
|
import { lstat as lstat3, mkdir as mkdir7, readFile as readFile9, readdir as readdir4, rename, rm, stat as stat4, writeFile as writeFile7 } from "fs/promises";
|
|
29818
|
-
import
|
|
29971
|
+
import path39 from "path";
|
|
29819
29972
|
|
|
29820
29973
|
// src/session-summaries/adapters.ts
|
|
29821
29974
|
var VALID_ROLES = /* @__PURE__ */ new Set(["user", "assistant", "tool", "system", "other"]);
|
|
@@ -30320,7 +30473,7 @@ function shortHash(value, length = 16) {
|
|
|
30320
30473
|
async function listTranscriptFiles(root, maxFiles) {
|
|
30321
30474
|
const out = [];
|
|
30322
30475
|
let truncated = false;
|
|
30323
|
-
const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${
|
|
30476
|
+
const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${path39.sep}` : entryName;
|
|
30324
30477
|
async function visit(dir) {
|
|
30325
30478
|
if (truncated) return;
|
|
30326
30479
|
const entries = (await readdir4(dir, { withFileTypes: true })).sort(
|
|
@@ -30330,13 +30483,13 @@ async function listTranscriptFiles(root, maxFiles) {
|
|
|
30330
30483
|
if (truncated) return;
|
|
30331
30484
|
if (entry.name.startsWith(".")) continue;
|
|
30332
30485
|
if (entry.isSymbolicLink()) continue;
|
|
30333
|
-
const fullPath =
|
|
30486
|
+
const fullPath = path39.join(dir, entry.name);
|
|
30334
30487
|
if (entry.isDirectory()) {
|
|
30335
30488
|
await visit(fullPath);
|
|
30336
30489
|
continue;
|
|
30337
30490
|
}
|
|
30338
30491
|
if (!entry.isFile()) continue;
|
|
30339
|
-
const ext =
|
|
30492
|
+
const ext = path39.extname(entry.name).toLowerCase();
|
|
30340
30493
|
if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
|
|
30341
30494
|
out.push(fullPath);
|
|
30342
30495
|
if (out.length > maxFiles) {
|
|
@@ -30363,7 +30516,7 @@ function normalizeInputDir(inputDir) {
|
|
|
30363
30516
|
if (typeof inputDir !== "string" || inputDir.trim().length === 0) {
|
|
30364
30517
|
throw new Error("inputDir must be a non-empty string");
|
|
30365
30518
|
}
|
|
30366
|
-
return
|
|
30519
|
+
return path39.resolve(expandTildePath(inputDir.trim()));
|
|
30367
30520
|
}
|
|
30368
30521
|
function initRoleCounts() {
|
|
30369
30522
|
return {
|
|
@@ -30520,11 +30673,11 @@ async function collectLocalSessionSummaries(options) {
|
|
|
30520
30673
|
continue;
|
|
30521
30674
|
}
|
|
30522
30675
|
seenFileHashes.add(fileHash);
|
|
30523
|
-
const fileExtension =
|
|
30676
|
+
const fileExtension = path39.extname(filePath).toLowerCase();
|
|
30524
30677
|
const parsed = await adapter.parseFile(
|
|
30525
30678
|
{
|
|
30526
30679
|
content,
|
|
30527
|
-
fileName:
|
|
30680
|
+
fileName: path39.basename(filePath),
|
|
30528
30681
|
fileExtension,
|
|
30529
30682
|
fileRef: fileHash
|
|
30530
30683
|
},
|
|
@@ -30580,7 +30733,7 @@ async function collectLocalSessionSummaries(options) {
|
|
|
30580
30733
|
}
|
|
30581
30734
|
async function readRedactionConfig(pathLike) {
|
|
30582
30735
|
if (!pathLike) return void 0;
|
|
30583
|
-
const raw = await readFile9(
|
|
30736
|
+
const raw = await readFile9(path39.resolve(expandTildePath(pathLike)), "utf-8");
|
|
30584
30737
|
const parsed = JSON.parse(raw);
|
|
30585
30738
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
30586
30739
|
throw new Error("redaction config must be a JSON object");
|
|
@@ -30593,15 +30746,15 @@ function toJsonl(drafts) {
|
|
|
30593
30746
|
}
|
|
30594
30747
|
function defaultDraftOutputPath(memoryDir, generatedAt) {
|
|
30595
30748
|
const stamp = generatedAt.replace(/[:.]/g, "-");
|
|
30596
|
-
return
|
|
30597
|
-
|
|
30749
|
+
return path39.join(
|
|
30750
|
+
path39.resolve(expandTildePath(memoryDir)),
|
|
30598
30751
|
"state",
|
|
30599
30752
|
"session-summary-drafts",
|
|
30600
30753
|
`session-summaries-${stamp}.jsonl`
|
|
30601
30754
|
);
|
|
30602
30755
|
}
|
|
30603
30756
|
async function writeDrafts(filePath, drafts) {
|
|
30604
|
-
await mkdir7(
|
|
30757
|
+
await mkdir7(path39.dirname(filePath), { recursive: true });
|
|
30605
30758
|
const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
30606
30759
|
try {
|
|
30607
30760
|
await writeFile7(tempPath, toJsonl(drafts), "utf-8");
|
|
@@ -30619,7 +30772,7 @@ async function runLocalSessionSummaryCliCommand(options) {
|
|
|
30619
30772
|
});
|
|
30620
30773
|
const wroteFiles = [];
|
|
30621
30774
|
if (options.output) {
|
|
30622
|
-
const outputPath =
|
|
30775
|
+
const outputPath = path39.resolve(expandTildePath(options.output));
|
|
30623
30776
|
await writeDrafts(outputPath, report.drafts);
|
|
30624
30777
|
wroteFiles.push(outputPath);
|
|
30625
30778
|
}
|
|
@@ -30654,19 +30807,19 @@ async function runLocalSessionSummaryCliCommand(options) {
|
|
|
30654
30807
|
|
|
30655
30808
|
// src/transfer/capsule-fork.ts
|
|
30656
30809
|
import { lstat as lstat4, mkdir as mkdir8, readFile as readFile10, realpath as realpath3, writeFile as writeFile8 } from "fs/promises";
|
|
30657
|
-
import
|
|
30810
|
+
import path40 from "path";
|
|
30658
30811
|
async function forkCapsule(opts) {
|
|
30659
30812
|
validateForkId(opts.forkId);
|
|
30660
|
-
const rootAbs =
|
|
30813
|
+
const rootAbs = path40.resolve(opts.targetRoot);
|
|
30661
30814
|
await assertIsDirectoryNotSymlink(rootAbs, "forkCapsule", "targetRoot");
|
|
30662
|
-
const forkDirAbs =
|
|
30815
|
+
const forkDirAbs = path40.join(rootAbs, "forks", opts.forkId);
|
|
30663
30816
|
const forkEntryExists = await pathEntryExists(forkDirAbs);
|
|
30664
30817
|
if (forkEntryExists) {
|
|
30665
30818
|
throw new Error(
|
|
30666
30819
|
`forkCapsule: fork path already exists \u2014 forkId "${opts.forkId}" is already in use at: ${forkDirAbs}`
|
|
30667
30820
|
);
|
|
30668
30821
|
}
|
|
30669
|
-
const archiveAbs =
|
|
30822
|
+
const archiveAbs = path40.resolve(opts.sourceArchive);
|
|
30670
30823
|
const importResult = await importCapsule({
|
|
30671
30824
|
archivePath: archiveAbs,
|
|
30672
30825
|
root: rootAbs,
|
|
@@ -30688,10 +30841,10 @@ async function forkCapsule(opts) {
|
|
|
30688
30841
|
importedRecords: importResult.imported.length,
|
|
30689
30842
|
skippedRecords: importResult.skipped.length
|
|
30690
30843
|
};
|
|
30691
|
-
const lineagePath =
|
|
30844
|
+
const lineagePath = path40.join(forkDirAbs, "lineage.json");
|
|
30692
30845
|
const rootReal = await realpath3(rootAbs);
|
|
30693
30846
|
await assertRealpathInsideRoot(rootReal, lineagePath, `forks/${opts.forkId}/lineage.json`, "forkCapsule");
|
|
30694
|
-
await mkdir8(
|
|
30847
|
+
await mkdir8(path40.dirname(lineagePath), { recursive: true });
|
|
30695
30848
|
await writeFile8(lineagePath, JSON.stringify(lineage, null, 2) + "\n", "utf-8");
|
|
30696
30849
|
return {
|
|
30697
30850
|
archivePath: archiveAbs,
|
|
@@ -30705,11 +30858,11 @@ async function readForkLineage(targetRoot, forkId) {
|
|
|
30705
30858
|
if (typeof forkId !== "string" || forkId.length === 0 || forkId.length > 64 || !CAPSULE_ID_PATTERN.test(forkId)) {
|
|
30706
30859
|
return null;
|
|
30707
30860
|
}
|
|
30708
|
-
const rootAbs =
|
|
30861
|
+
const rootAbs = path40.resolve(targetRoot);
|
|
30709
30862
|
const rootReal = await realpath3(rootAbs).catch(() => rootAbs);
|
|
30710
|
-
const lineagePath =
|
|
30711
|
-
const rel =
|
|
30712
|
-
if (rel.startsWith("..") ||
|
|
30863
|
+
const lineagePath = path40.join(rootReal, "forks", forkId, "lineage.json");
|
|
30864
|
+
const rel = path40.relative(rootReal, lineagePath);
|
|
30865
|
+
if (rel.startsWith("..") || path40.isAbsolute(rel)) {
|
|
30713
30866
|
return null;
|
|
30714
30867
|
}
|
|
30715
30868
|
if (!await isLineagePathContained(rootReal, lineagePath)) {
|
|
@@ -30750,19 +30903,19 @@ async function pathEntryExists(absPath) {
|
|
|
30750
30903
|
async function isLineagePathContained(rootReal, lineagePath) {
|
|
30751
30904
|
let existing = lineagePath;
|
|
30752
30905
|
const suffix = [];
|
|
30753
|
-
while (existing !==
|
|
30906
|
+
while (existing !== path40.dirname(existing)) {
|
|
30754
30907
|
const st = await lstat4(existing).catch(() => null);
|
|
30755
30908
|
if (st !== null) break;
|
|
30756
|
-
suffix.unshift(
|
|
30757
|
-
existing =
|
|
30909
|
+
suffix.unshift(path40.basename(existing));
|
|
30910
|
+
existing = path40.dirname(existing);
|
|
30758
30911
|
}
|
|
30759
30912
|
const existingReal = await realpath3(existing).catch(() => existing);
|
|
30760
|
-
const targetReal = suffix.length > 0 ?
|
|
30761
|
-
const rel =
|
|
30913
|
+
const targetReal = suffix.length > 0 ? path40.join(existingReal, ...suffix) : existingReal;
|
|
30914
|
+
const rel = path40.relative(rootReal, targetReal);
|
|
30762
30915
|
if (rel === "") return true;
|
|
30763
30916
|
if (rel === "..") return false;
|
|
30764
|
-
if (rel.startsWith(`..${
|
|
30765
|
-
if (
|
|
30917
|
+
if (rel.startsWith(`..${path40.sep}`)) return false;
|
|
30918
|
+
if (path40.isAbsolute(rel)) return false;
|
|
30766
30919
|
return true;
|
|
30767
30920
|
}
|
|
30768
30921
|
|
|
@@ -30951,4 +31104,4 @@ export {
|
|
|
30951
31104
|
qmdStartupCollectionChecksWithTimeout,
|
|
30952
31105
|
Orchestrator
|
|
30953
31106
|
};
|
|
30954
|
-
//# sourceMappingURL=chunk-
|
|
31107
|
+
//# sourceMappingURL=chunk-MSTKJI5T.js.map
|