@remnic/core 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abort-error.js +1 -0
- package/dist/abstraction-nodes.js +1 -0
- package/dist/access-audit.js +1 -0
- package/dist/access-cli.js +72 -47
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +50 -5
- package/dist/access-http.js +39 -16
- package/dist/access-idempotency.js +1 -0
- package/dist/access-mcp.d.ts +10 -5
- package/dist/access-mcp.js +38 -14
- package/dist/access-schema.d.ts +133 -13
- package/dist/access-schema.js +20 -1
- package/dist/access-service-CtXFnprR.d.ts +2033 -0
- package/dist/access-service.d.ts +11 -6
- package/dist/access-service.js +40 -15
- package/dist/active-memory-bridge.js +1 -0
- package/dist/active-recall.js +1 -0
- package/dist/active-recall.js.map +1 -1
- package/dist/behavior-learner.js +1 -0
- package/dist/behavior-learner.js.map +1 -1
- package/dist/behavior-signals.js +1 -0
- package/dist/bootstrap.d.ts +6 -4
- package/dist/bootstrap.js +1 -0
- package/dist/boxes.js +1 -0
- package/dist/briefing.d.ts +9 -5
- package/dist/briefing.js +10 -7
- package/dist/buffer-surprise-report.js +1 -0
- package/dist/buffer-surprise.js +1 -0
- package/dist/buffer.d.ts +1 -1
- package/dist/buffer.js +1 -0
- package/dist/calibration.d.ts +8 -1
- package/dist/calibration.js +10 -2
- package/dist/calibration.js.map +1 -1
- package/dist/capsule-cli.d.ts +137 -0
- package/dist/capsule-cli.js +34 -0
- package/dist/capsule-crypto-5CYAGVC5.js +18 -0
- package/dist/capsule-export-NZQPOTQ4.js +17 -0
- package/dist/capsule-export-NZQPOTQ4.js.map +1 -0
- package/dist/capsule-import-SDCUXLEV.js +16 -0
- package/dist/capsule-import-SDCUXLEV.js.map +1 -0
- package/dist/capsule-merge-DI7PNQ2H.js +189 -0
- package/dist/capsule-merge-DI7PNQ2H.js.map +1 -0
- package/dist/causal-behavior.js +1 -0
- package/dist/causal-behavior.js.map +1 -1
- package/dist/causal-chain.js +1 -0
- package/dist/causal-consolidation.js +12 -9
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -1
- package/dist/causal-retrieval.js.map +1 -1
- package/dist/causal-trajectory-graph.js +4 -1
- package/dist/causal-trajectory-graph.js.map +1 -1
- package/dist/causal-trajectory.js +2 -1
- package/dist/chunk-2LSZVONP.js +67 -0
- package/dist/chunk-2LSZVONP.js.map +1 -0
- package/dist/chunk-32KD5IHZ.js +245 -0
- package/dist/chunk-32KD5IHZ.js.map +1 -0
- package/dist/chunk-3KIS4VGT.js +228 -0
- package/dist/chunk-3KIS4VGT.js.map +1 -0
- package/dist/chunk-3LCWFNVS.js +350 -0
- package/dist/chunk-3LCWFNVS.js.map +1 -0
- package/dist/chunk-43EKP2UK.js +26 -0
- package/dist/chunk-43EKP2UK.js.map +1 -0
- package/dist/chunk-457A4P3L.js +119 -0
- package/dist/chunk-457A4P3L.js.map +1 -0
- package/dist/{chunk-TMYO7B5P.js → chunk-47WOM4YW.js} +2 -2
- package/dist/{chunk-FVA6TGI3.js → chunk-52PDY6GD.js} +42 -2
- package/dist/chunk-52PDY6GD.js.map +1 -0
- package/dist/{chunk-ULYOGL6R.js → chunk-5HRY2WRF.js} +7 -3
- package/dist/chunk-5HRY2WRF.js.map +1 -0
- package/dist/{chunk-BOUYNNYD.js → chunk-67YLUWLG.js} +32 -13
- package/dist/{chunk-BOUYNNYD.js.map → chunk-67YLUWLG.js.map} +1 -1
- package/dist/chunk-6TBWYBJ3.js +236 -0
- package/dist/chunk-6TBWYBJ3.js.map +1 -0
- package/dist/chunk-74EMIVE4.js +329 -0
- package/dist/chunk-74EMIVE4.js.map +1 -0
- package/dist/chunk-74WWN7ZW.js +82 -0
- package/dist/chunk-74WWN7ZW.js.map +1 -0
- package/dist/chunk-A6XUJE5D.js +126 -0
- package/dist/chunk-A6XUJE5D.js.map +1 -0
- package/dist/{chunk-STGWEHYR.js → chunk-AEMBDV7M.js} +1187 -62
- package/dist/chunk-AEMBDV7M.js.map +1 -0
- package/dist/{chunk-PVICZTKG.js → chunk-AGZHRWPT.js} +5 -5
- package/dist/{chunk-PVICZTKG.js.map → chunk-AGZHRWPT.js.map} +1 -1
- package/dist/chunk-AJA46VX5.js +393 -0
- package/dist/chunk-AJA46VX5.js.map +1 -0
- package/dist/chunk-ASIQZXYO.js +277 -0
- package/dist/chunk-ASIQZXYO.js.map +1 -0
- package/dist/{chunk-DG6YMRDC.js → chunk-B2TL6GA2.js} +2 -2
- package/dist/chunk-BJMBJZ2Y.js +290 -0
- package/dist/chunk-BJMBJZ2Y.js.map +1 -0
- package/dist/chunk-BT7NVCML.js +79 -0
- package/dist/chunk-BT7NVCML.js.map +1 -0
- package/dist/chunk-CK5NTM2S.js +454 -0
- package/dist/chunk-CK5NTM2S.js.map +1 -0
- package/dist/{chunk-AYXIPSZO.js → chunk-CRU27Q4J.js} +2 -2
- package/dist/{chunk-UWB5LMWY.js → chunk-CUI2STX6.js} +526 -24
- package/dist/chunk-CUI2STX6.js.map +1 -0
- package/dist/{chunk-CUPFXL3J.js → chunk-EGEPUGN4.js} +4 -4
- package/dist/chunk-EGEPUGN4.js.map +1 -0
- package/dist/{chunk-3OGMS3PE.js → chunk-F5VQOQ2E.js} +3 -2
- package/dist/chunk-F5VQOQ2E.js.map +1 -0
- package/dist/chunk-FP2373TW.js +149 -0
- package/dist/chunk-FP2373TW.js.map +1 -0
- package/dist/{chunk-RBBWYEFJ.js → chunk-G2WADRQ3.js} +1 -1
- package/dist/chunk-G7D6GZ5J.js +48 -0
- package/dist/chunk-G7D6GZ5J.js.map +1 -0
- package/dist/chunk-H7XKCNR6.js +60 -0
- package/dist/chunk-H7XKCNR6.js.map +1 -0
- package/dist/{chunk-LOIMBRDE.js → chunk-HIRKCQGF.js} +1994 -412
- package/dist/chunk-HIRKCQGF.js.map +1 -0
- package/dist/chunk-IXEJRKCZ.js +18 -0
- package/dist/chunk-IXEJRKCZ.js.map +1 -0
- package/dist/chunk-IYY4MCPG.js +275 -0
- package/dist/chunk-IYY4MCPG.js.map +1 -0
- package/dist/{chunk-BECYBZLX.js → chunk-JWSENLQI.js} +502 -22
- package/dist/chunk-JWSENLQI.js.map +1 -0
- package/dist/chunk-KNKUID7G.js +183 -0
- package/dist/chunk-KNKUID7G.js.map +1 -0
- package/dist/chunk-L2IO2QPY.js +2036 -0
- package/dist/chunk-L2IO2QPY.js.map +1 -0
- package/dist/{chunk-ZAIM4TUE.js → chunk-LW2NMHDW.js} +46 -1
- package/dist/chunk-LW2NMHDW.js.map +1 -0
- package/dist/chunk-MDYG7VI7.js +48 -0
- package/dist/chunk-MDYG7VI7.js.map +1 -0
- package/dist/{chunk-VDX363PS.js → chunk-MUELDH4F.js} +10 -3
- package/dist/chunk-MUELDH4F.js.map +1 -0
- package/dist/chunk-MXC3AP5I.js +74 -0
- package/dist/chunk-MXC3AP5I.js.map +1 -0
- package/dist/chunk-NN3TS5BM.js +147 -0
- package/dist/chunk-NN3TS5BM.js.map +1 -0
- package/dist/{chunk-3YGHKTBF.js → chunk-NZS2BLTP.js} +963 -326
- package/dist/chunk-NZS2BLTP.js.map +1 -0
- package/dist/chunk-OA3L7BFR.js +183 -0
- package/dist/chunk-OA3L7BFR.js.map +1 -0
- package/dist/chunk-OZHRDTDX.js +240 -0
- package/dist/chunk-OZHRDTDX.js.map +1 -0
- package/dist/chunk-PCUKNJAZ.js +165 -0
- package/dist/chunk-PCUKNJAZ.js.map +1 -0
- package/dist/{chunk-6PFRXT4K.js → chunk-PFV5C235.js} +11 -6
- package/dist/chunk-PFV5C235.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-Y7R2XJ5Q.js → chunk-Q7FJ5ZHM.js} +6 -2
- package/dist/chunk-Q7FJ5ZHM.js.map +1 -0
- package/dist/{chunk-WCLICCGB.js → chunk-RILIVK4O.js} +91 -4
- package/dist/chunk-RILIVK4O.js.map +1 -0
- package/dist/{chunk-C2EFFULQ.js → chunk-RK2Y4XOM.js} +163 -20
- package/dist/chunk-RK2Y4XOM.js.map +1 -0
- package/dist/{chunk-TP4FZJIZ.js → chunk-RULE4VG5.js} +5 -1
- package/dist/chunk-RULE4VG5.js.map +1 -0
- package/dist/{chunk-PVPWZSSI.js → chunk-SMA4IMHV.js} +19 -3
- package/dist/chunk-SMA4IMHV.js.map +1 -0
- package/dist/{chunk-6YJHX2DL.js → chunk-TIFRGAKO.js} +242 -22
- package/dist/chunk-TIFRGAKO.js.map +1 -0
- package/dist/chunk-TUFG6VXY.js +875 -0
- package/dist/chunk-TUFG6VXY.js.map +1 -0
- package/dist/chunk-TYEOAFH3.js +251 -0
- package/dist/chunk-TYEOAFH3.js.map +1 -0
- package/dist/chunk-UKJAGEXH.js +260 -0
- package/dist/chunk-UKJAGEXH.js.map +1 -0
- package/dist/{chunk-KVBLZUKV.js → chunk-USFPPRAF.js} +93 -3
- package/dist/chunk-USFPPRAF.js.map +1 -0
- package/dist/{chunk-NBVAS5MT.js → chunk-V7TEH5I2.js} +6 -6
- package/dist/{chunk-GA5P7RST.js → chunk-VTJVUHRK.js} +22 -36
- package/dist/chunk-VTJVUHRK.js.map +1 -0
- package/dist/{chunk-SPI27QT6.js → chunk-W7WWT4FJ.js} +9 -4
- package/dist/chunk-W7WWT4FJ.js.map +1 -0
- package/dist/chunk-WIICJPET.js +45 -0
- package/dist/chunk-WIICJPET.js.map +1 -0
- package/dist/{chunk-VBVG2M5G.js → chunk-WPGJYVUH.js} +6 -2
- package/dist/chunk-WPGJYVUH.js.map +1 -0
- package/dist/{chunk-4HQS2HPX.js → chunk-WSZIHQBK.js} +29 -9
- package/dist/{chunk-4HQS2HPX.js.map → chunk-WSZIHQBK.js.map} +1 -1
- package/dist/{chunk-NZLQTHS5.js → chunk-WW3QQF4H.js} +4 -1
- package/dist/chunk-WW3QQF4H.js.map +1 -0
- package/dist/{chunk-DIXB44VE.js → chunk-X6VBWOVZ.js} +28 -13
- package/dist/chunk-X6VBWOVZ.js.map +1 -0
- package/dist/{chunk-XXVWLXSG.js → chunk-XQ4EJLUD.js} +64 -92
- package/dist/chunk-XQ4EJLUD.js.map +1 -0
- package/dist/{chunk-OC5OXUQ4.js → chunk-XRCYKJ3V.js} +780 -17
- package/dist/chunk-XRCYKJ3V.js.map +1 -0
- package/dist/{chunk-F5VP6YCB.js → chunk-Y4A6M3B6.js} +573 -156
- package/dist/chunk-Y4A6M3B6.js.map +1 -0
- package/dist/chunk-YNJHCGDT.js +309 -0
- package/dist/chunk-YNJHCGDT.js.map +1 -0
- package/dist/{chunk-L7IXWRYE.js → chunk-ZIBOQULP.js} +22 -13
- package/dist/chunk-ZIBOQULP.js.map +1 -0
- package/dist/{chunk-W6SL7OFG.js → chunk-ZTSE2ZJ6.js} +12 -2
- package/dist/{chunk-W6SL7OFG.js.map → chunk-ZTSE2ZJ6.js.map} +1 -1
- package/dist/chunking.js +1 -0
- package/dist/cipher-GVE2GQ5H.js +28 -0
- package/dist/cipher-GVE2GQ5H.js.map +1 -0
- package/dist/citations.js +1 -0
- package/dist/{cli-BkeRaYfk.d.ts → cli-lMql2FCr.d.ts} +26 -7
- package/dist/cli.d.ts +11 -6
- package/dist/cli.js +69 -34
- package/dist/codex-thread-key.js +1 -0
- package/dist/commitment-ledger.js +1 -0
- package/dist/compression-optimizer.js +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +4 -1
- package/dist/connectors-cli-DFGtY2DB.d.ts +257 -0
- package/dist/connectors-cli.d.ts +2 -0
- package/dist/connectors-cli.js +22 -0
- package/dist/connectors-cli.js.map +1 -0
- package/dist/consolidation-operator.d.ts +65 -5
- package/dist/consolidation-operator.js +6 -1
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-provenance-check.js +3 -2
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/consolidation-undo.js +1 -0
- package/dist/consolidation-undo.js.map +1 -1
- package/dist/{contradiction-review-WIUBAR52.js → contradiction-review-5LTTVDQV.js} +2 -1
- package/dist/contradiction-review-5LTTVDQV.js.map +1 -0
- package/dist/{contradiction-scan-E3GJTI4F.js → contradiction-scan-3Z6YW7YA.js} +2 -1
- package/dist/{contradiction-scan-E3GJTI4F.js.map → contradiction-scan-3Z6YW7YA.js.map} +1 -1
- package/dist/cross-namespace-budget.js +1 -0
- package/dist/cue-anchors.js +1 -0
- package/dist/dashboard-runtime.js +1 -0
- package/dist/day-summary.js +1 -0
- package/dist/delinearize.js +1 -0
- package/dist/direct-answer-wiring.js +1 -0
- package/dist/direct-answer.js +1 -0
- package/dist/dreams-ledger-LR2NBAZE.js +286 -0
- package/dist/dreams-ledger-LR2NBAZE.js.map +1 -0
- package/dist/embedding-fallback.js +1 -0
- package/dist/engine-O6YWKQM3.js +28 -0
- package/dist/engine-O6YWKQM3.js.map +1 -0
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +10 -7
- package/dist/entity-schema.js +1 -0
- package/dist/evals.js +1 -0
- package/dist/evidence-pack.d.ts +16 -0
- package/dist/evidence-pack.js +8 -0
- package/dist/evidence-pack.js.map +1 -0
- package/dist/explicit-capture.d.ts +6 -4
- package/dist/explicit-capture.js +1 -0
- package/dist/extraction-judge-telemetry.js +1 -0
- package/dist/extraction-judge-training.js +1 -0
- package/dist/extraction-judge.js +1 -0
- package/dist/extraction.js +8 -7
- package/dist/fallback-llm.js +3 -2
- package/dist/first-start-migration-4MHQEOSD.js +263 -0
- package/dist/first-start-migration-4MHQEOSD.js.map +1 -0
- package/dist/forget-PLR6J5DN.js +69 -0
- package/dist/forget-PLR6J5DN.js.map +1 -0
- package/dist/framework-CyHYDcri.d.ts +153 -0
- package/dist/fs-utils-IRVUFB6G.js +30 -0
- package/dist/fs-utils-IRVUFB6G.js.map +1 -0
- package/dist/graph-dashboard-diff.js +1 -0
- package/dist/graph-dashboard-key.js +1 -0
- package/dist/graph-dashboard-parser.js +1 -0
- package/dist/graph-edge-decay-PWB63GRE.js +207 -0
- package/dist/graph-edge-decay-PWB63GRE.js.map +1 -0
- package/dist/graph-edge-reinforcement.d.ts +81 -0
- package/dist/graph-edge-reinforcement.js +24 -0
- package/dist/graph-edge-reinforcement.js.map +1 -0
- package/dist/graph-events.d.ts +87 -0
- package/dist/graph-events.js +14 -0
- package/dist/graph-events.js.map +1 -0
- package/dist/graph-recall.js +1 -0
- package/dist/graph-retrieval.js +1 -0
- package/dist/graph-snapshot.d.ts +112 -0
- package/dist/graph-snapshot.js +19 -0
- package/dist/graph-snapshot.js.map +1 -0
- package/dist/graph.d.ts +105 -7
- package/dist/graph.js +20 -3
- package/dist/harmonic-retrieval.js +1 -0
- package/dist/himem.js +1 -0
- package/dist/hygiene.js +1 -0
- package/dist/identity-continuity.js +1 -0
- package/dist/importance.js +1 -0
- package/dist/index.d.ts +574 -13
- package/dist/index.js +337 -69
- package/dist/index.js.map +1 -1
- package/dist/intent.js +1 -0
- package/dist/json-extract.js +1 -0
- package/dist/json-store.js +1 -0
- package/dist/kdf-7S6RWKLZ.js +26 -0
- package/dist/kdf-7S6RWKLZ.js.map +1 -0
- package/dist/legacy-hook-compat.js +1 -0
- package/dist/legacy-hook-compat.js.map +1 -1
- package/dist/lifecycle.js +1 -0
- package/dist/live-connectors-runner.d.ts +48 -0
- package/dist/live-connectors-runner.js +17 -0
- package/dist/live-connectors-runner.js.map +1 -0
- package/dist/local-llm.js +1 -0
- package/dist/logger.js +1 -0
- package/dist/memory-action-policy.js +1 -0
- package/dist/memory-cache.d.ts +2 -1
- package/dist/memory-cache.js +4 -1
- package/dist/memory-governance-JZHZDOLN.js +37 -0
- package/dist/memory-governance-JZHZDOLN.js.map +1 -0
- package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
- package/dist/memory-lifecycle-ledger-utils.js +4 -1
- package/dist/memory-projection-format.js +1 -0
- package/dist/{memory-projection-store-DeSXPh1j.d.ts → memory-projection-store-CY8TU40w.d.ts} +2 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-projection-store.js +2 -1
- package/dist/memory-worth-bench.js +1 -0
- package/dist/memory-worth-bench.js.map +1 -1
- package/dist/memory-worth-filter.js +1 -0
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/memory-worth-outcomes.js +1 -0
- package/dist/memory-worth.js +1 -0
- package/dist/metadata-FC3XPDRQ.js +21 -0
- package/dist/metadata-FC3XPDRQ.js.map +1 -0
- package/dist/migrate-from-identity-anchor-TTEDEJGX.js +8 -0
- package/dist/migrate-from-identity-anchor-TTEDEJGX.js.map +1 -0
- package/dist/model-registry.js +1 -0
- package/dist/models-json.js +1 -0
- package/dist/native-knowledge.js +1 -0
- package/dist/negative.js +1 -0
- package/dist/objective-state-writers.js +1 -0
- package/dist/objective-state-writers.js.map +1 -1
- package/dist/objective-state.js +1 -0
- package/dist/openai-chat-compat.js +1 -0
- package/dist/operator-toolkit.d.ts +46 -2
- package/dist/operator-toolkit.js +29 -17
- package/dist/opik-exporter.js +1 -0
- package/dist/opik-exporter.js.map +1 -1
- package/dist/{orchestrator-CmJ-NTdJ.d.ts → orchestrator-ChkesB8U.d.ts} +177 -13
- package/dist/orchestrator.d.ts +6 -4
- package/dist/orchestrator.js +57 -41
- package/dist/page-versioning.js +1 -0
- package/dist/path-RMTY5Y5A.js +9 -0
- package/dist/path-RMTY5Y5A.js.map +1 -0
- package/dist/patterns-cli.d.ts +160 -0
- package/dist/patterns-cli.js +29 -0
- package/dist/patterns-cli.js.map +1 -0
- package/dist/peers-6OSQ3NK6.js +44 -0
- package/dist/peers-6OSQ3NK6.js.map +1 -0
- package/dist/plugin-id.js +1 -0
- package/dist/policy-runtime.js +1 -0
- package/dist/{port-BADbLZU5.d.ts → port-hqGnoStS.d.ts} +6 -0
- package/dist/profiling.js +1 -0
- package/dist/purge-6ATBGT77.js +205 -0
- package/dist/purge-6ATBGT77.js.map +1 -0
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd-recall-cache.js +1 -0
- package/dist/qmd.d.ts +2 -1
- package/dist/qmd.js +4 -3
- package/dist/reasoning-trace-recall.js +1 -0
- package/dist/reasoning-trace-types.js +1 -0
- package/dist/recall-audit-anomaly.js +1 -0
- package/dist/recall-audit.js +1 -0
- package/dist/recall-disclosure-escalation.d.ts +84 -0
- package/dist/recall-disclosure-escalation.js +14 -0
- package/dist/recall-disclosure-escalation.js.map +1 -0
- package/dist/recall-explain-renderer.js +4 -1
- package/dist/recall-mmr.js +1 -0
- package/dist/recall-qos.js +1 -0
- package/dist/recall-query-policy.js +1 -0
- package/dist/recall-state.d.ts +7 -0
- package/dist/recall-state.js +2 -1
- package/dist/recall-tag-filter.d.ts +56 -0
- package/dist/recall-tag-filter.js +14 -0
- package/dist/recall-tag-filter.js.map +1 -0
- package/dist/recall-tokenization.js +1 -0
- package/dist/recall-xray-cli.d.ts +9 -2
- package/dist/recall-xray-cli.js +9 -4
- package/dist/recall-xray-renderer.js +4 -1
- package/dist/recall-xray.d.ts +116 -2
- package/dist/recall-xray.js +9 -3
- package/dist/reconstruct.js +1 -0
- package/dist/release-changelog.js +2 -0
- package/dist/release-changelog.js.map +1 -1
- package/dist/relevance.js +1 -0
- package/dist/rerank.js +1 -0
- package/dist/{resolution-QBTDHTG7.js → resolution-YGIBORXI.js} +2 -1
- package/dist/{resolution-QBTDHTG7.js.map → resolution-YGIBORXI.js.map} +1 -1
- package/dist/resolve-auth-token.d.ts +51 -0
- package/dist/resolve-auth-token.js +12 -0
- package/dist/resolve-auth-token.js.map +1 -0
- package/dist/resolve-provider-secret.d.ts +9 -1
- package/dist/resolve-provider-secret.js +4 -1
- package/dist/resume-bundles.js +4 -3
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-agents.js +1 -0
- package/dist/retrieval-tiers.js +1 -0
- package/dist/retrieval.js +1 -0
- package/dist/sanitize.js +1 -0
- package/dist/schemas.d.ts +15 -2
- package/dist/schemas.js +2 -1
- package/dist/sdk-compat.js +1 -0
- package/dist/sdk-compat.js.map +1 -1
- package/dist/secure-store-4R2GSO7S.js +156 -0
- package/dist/secure-store-4R2GSO7S.js.map +1 -0
- package/dist/semantic-chunking.js +1 -0
- package/dist/{semantic-consolidation-CxJU6MJk.d.ts → semantic-consolidation-ByBXb-sf.d.ts} +3 -3
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +12 -7
- package/dist/semantic-rule-promotion.d.ts +1 -1
- package/dist/semantic-rule-promotion.js +10 -7
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +10 -7
- package/dist/session-integrity.js +1 -0
- package/dist/session-observer-bands.js +1 -0
- package/dist/session-observer-state.js +1 -0
- package/dist/session-toggles.js +2 -0
- package/dist/session-toggles.js.map +1 -1
- package/dist/signal.js +1 -0
- package/dist/skills-registry.js +2 -0
- package/dist/skills-registry.js.map +1 -1
- package/dist/source-attribution.js +1 -0
- package/dist/state-NCHQ4TRG.js +8 -0
- package/dist/state-NCHQ4TRG.js.map +1 -0
- package/dist/state-store-3EH7HYIN.js +16 -0
- package/dist/state-store-3EH7HYIN.js.map +1 -0
- package/dist/storage.d.ts +76 -2
- package/dist/storage.js +9 -6
- package/dist/store-contract.js +1 -0
- package/dist/summarizer.js +5 -4
- package/dist/summary-snapshot.js +1 -0
- package/dist/temporal-index.js +1 -0
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-supersession.js +2 -1
- package/dist/temporal-validity.d.ts +52 -0
- package/dist/temporal-validity.js +14 -0
- package/dist/temporal-validity.js.map +1 -0
- package/dist/threading.js +1 -0
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-migration.js +1 -0
- package/dist/tier-routing.js +1 -0
- package/dist/tier-stats-62ZVDFKS.js +152 -0
- package/dist/tier-stats-62ZVDFKS.js.map +1 -0
- package/dist/tmt.js +1 -0
- package/dist/tokens.js +1 -0
- package/dist/topics.js +1 -0
- package/dist/trace-C5ETWBEF.js +290 -0
- package/dist/trace-C5ETWBEF.js.map +1 -0
- package/dist/transcript.js +1 -0
- package/dist/trust-zones.js +1 -0
- package/dist/tui-RI7P6PBS.js +13 -0
- package/dist/tui-RI7P6PBS.js.map +1 -0
- package/dist/types-V3FJ26TF.js +30 -0
- package/dist/types-V3FJ26TF.js.map +1 -0
- package/dist/types.d.ts +634 -9
- package/dist/types.js +10 -3
- package/dist/utility-learner.js +1 -0
- package/dist/utility-runtime.js +1 -0
- package/dist/utility-telemetry.js +1 -0
- package/dist/verified-recall.js +10 -7
- package/dist/version-utils.js +1 -0
- package/dist/whitespace.js +1 -0
- package/dist/work-product-ledger.js +1 -0
- package/package.json +7 -3
- package/scripts/ensure-better-sqlite3.mjs +124 -0
- package/dist/access-service-Br8ZydTK.d.ts +0 -827
- package/dist/chunk-3OGMS3PE.js.map +0 -1
- package/dist/chunk-3YGHKTBF.js.map +0 -1
- package/dist/chunk-6PFRXT4K.js.map +0 -1
- package/dist/chunk-6YJHX2DL.js.map +0 -1
- package/dist/chunk-BECYBZLX.js.map +0 -1
- package/dist/chunk-C2EFFULQ.js.map +0 -1
- package/dist/chunk-CUPFXL3J.js.map +0 -1
- package/dist/chunk-DIXB44VE.js.map +0 -1
- package/dist/chunk-F5VP6YCB.js.map +0 -1
- package/dist/chunk-FVA6TGI3.js.map +0 -1
- package/dist/chunk-GA5P7RST.js.map +0 -1
- package/dist/chunk-KVBLZUKV.js.map +0 -1
- package/dist/chunk-L7IXWRYE.js.map +0 -1
- package/dist/chunk-LOIMBRDE.js.map +0 -1
- package/dist/chunk-LTCGGW2D.js +0 -14
- package/dist/chunk-LTCGGW2D.js.map +0 -1
- package/dist/chunk-NZLQTHS5.js.map +0 -1
- package/dist/chunk-OC5OXUQ4.js.map +0 -1
- package/dist/chunk-PVPWZSSI.js.map +0 -1
- package/dist/chunk-SPI27QT6.js.map +0 -1
- package/dist/chunk-STGWEHYR.js.map +0 -1
- package/dist/chunk-TP4FZJIZ.js.map +0 -1
- package/dist/chunk-ULYOGL6R.js.map +0 -1
- package/dist/chunk-UWB5LMWY.js.map +0 -1
- package/dist/chunk-VBVG2M5G.js.map +0 -1
- package/dist/chunk-VDX363PS.js.map +0 -1
- package/dist/chunk-WCLICCGB.js.map +0 -1
- package/dist/chunk-X6GF3FX2.js +0 -26
- package/dist/chunk-X6GF3FX2.js.map +0 -1
- package/dist/chunk-XXVWLXSG.js.map +0 -1
- package/dist/chunk-Y7R2XJ5Q.js.map +0 -1
- package/dist/chunk-ZAIM4TUE.js.map +0 -1
- package/dist/engine-72LSIWQP.js +0 -23
- /package/dist/{contradiction-review-WIUBAR52.js.map → capsule-cli.js.map} +0 -0
- /package/dist/{engine-72LSIWQP.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
- /package/dist/{chunk-TMYO7B5P.js.map → chunk-47WOM4YW.js.map} +0 -0
- /package/dist/{chunk-DG6YMRDC.js.map → chunk-B2TL6GA2.js.map} +0 -0
- /package/dist/{chunk-AYXIPSZO.js.map → chunk-CRU27Q4J.js.map} +0 -0
- /package/dist/{chunk-RBBWYEFJ.js.map → chunk-G2WADRQ3.js.map} +0 -0
- /package/dist/{chunk-NBVAS5MT.js.map → chunk-V7TEH5I2.js.map} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveHomeDir
|
|
3
|
+
} from "./chunk-MARWOCVP.js";
|
|
4
|
+
|
|
5
|
+
// src/utils/path.ts
|
|
6
|
+
import path from "path";
|
|
7
|
+
function expandTildePath(p) {
|
|
8
|
+
if (p === "~") return resolveHomeDir();
|
|
9
|
+
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
10
|
+
return path.join(resolveHomeDir(), p.slice(2));
|
|
11
|
+
}
|
|
12
|
+
return p;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
expandTildePath
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=chunk-IXEJRKCZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/path.ts"],"sourcesContent":["/**\n * Shared path helpers. CLAUDE.md #17 requires consistent `~` expansion across\n * every user-facing path input, but Node's `fs` does not expand `~`, so every\n * call site must go through this helper.\n */\n\nimport path from \"node:path\";\n\nimport { resolveHomeDir } from \"../runtime/env.js\";\n\n/**\n * Expand a leading `~` or `~/…` to the resolved home directory.\n *\n * Leaves paths without a leading `~` unchanged — including absolute paths,\n * relative paths, and paths that contain `~` in the middle.\n *\n * Accepts both `~/` (POSIX) and `~\\` (Windows) as separators so call sites\n * don't have to branch on platform.\n */\nexport function expandTildePath(p: string): string {\n if (p === \"~\") return resolveHomeDir();\n if (p.startsWith(\"~/\") || p.startsWith(\"~\\\\\")) {\n return path.join(resolveHomeDir(), p.slice(2));\n }\n return p;\n}\n"],"mappings":";;;;;AAMA,OAAO,UAAU;AAaV,SAAS,gBAAgB,GAAmB;AACjD,MAAI,MAAM,IAAK,QAAO,eAAe;AACrC,MAAI,EAAE,WAAW,IAAI,KAAK,EAAE,WAAW,KAAK,GAAG;AAC7C,WAAO,KAAK,KAAK,eAAe,GAAG,EAAE,MAAM,CAAC,CAAC;AAAA,EAC/C;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listFilesRecursive,
|
|
3
|
+
sha256File,
|
|
4
|
+
toPosixRelPath,
|
|
5
|
+
writeJsonFile
|
|
6
|
+
} from "./chunk-457A4P3L.js";
|
|
7
|
+
import {
|
|
8
|
+
CAPSULE_ID_PATTERN,
|
|
9
|
+
CapsuleBlockSchema,
|
|
10
|
+
ExportBundleV2Schema,
|
|
11
|
+
ExportManifestV2Schema
|
|
12
|
+
} from "./chunk-OA3L7BFR.js";
|
|
13
|
+
import {
|
|
14
|
+
encryptCapsuleFile
|
|
15
|
+
} from "./chunk-KNKUID7G.js";
|
|
16
|
+
|
|
17
|
+
// src/transfer/capsule-export.ts
|
|
18
|
+
import { mkdir, readFile, stat, writeFile } from "fs/promises";
|
|
19
|
+
import path from "path";
|
|
20
|
+
import { gzipSync } from "zlib";
|
|
21
|
+
|
|
22
|
+
// src/transfer/constants.ts
|
|
23
|
+
var EXPORT_FORMAT = "openclaw-engram-export";
|
|
24
|
+
var EXPORT_SCHEMA_VERSION = 1;
|
|
25
|
+
var CAPSULE_SCHEMA_VERSION = 2;
|
|
26
|
+
|
|
27
|
+
// src/transfer/capsule-export.ts
|
|
28
|
+
var DEFAULT_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
29
|
+
"node_modules",
|
|
30
|
+
".git",
|
|
31
|
+
// Never export the secure-store directory: it contains the encryption
|
|
32
|
+
// header (KDF params + verifier) which is security-sensitive and
|
|
33
|
+
// machine-specific. The passphrase is not stored here, but including
|
|
34
|
+
// the header in a capsule would let an attacker brute-force the
|
|
35
|
+
// passphrase offline if the capsule is intercepted.
|
|
36
|
+
".secure-store",
|
|
37
|
+
// Exclude .capsules to avoid recursive self-inclusion.
|
|
38
|
+
".capsules"
|
|
39
|
+
]);
|
|
40
|
+
var TRANSCRIPTS_DIR = "transcripts";
|
|
41
|
+
var PEERS_DIR = "peers";
|
|
42
|
+
async function exportCapsule(opts) {
|
|
43
|
+
validateName(opts.name);
|
|
44
|
+
const sinceMs = parseSince(opts.since);
|
|
45
|
+
const includeKinds = normalizeIncludeKinds(opts.includeKinds);
|
|
46
|
+
const peerFilter = normalizePeerIds(opts.peerIds);
|
|
47
|
+
const transcriptsOverride = opts.includeTranscripts === true;
|
|
48
|
+
const rootAbs = path.resolve(opts.root);
|
|
49
|
+
await assertIsDirectory(rootAbs);
|
|
50
|
+
const outDirAbs = path.resolve(opts.outDir ?? path.join(rootAbs, ".capsules"));
|
|
51
|
+
if (outDirAbs === rootAbs) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
"exportCapsule: 'outDir' must not equal 'root'. Choose a separate directory (default: <root>/.capsules) so the export does not overwrite or shadow the source tree."
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
await mkdir(outDirAbs, { recursive: true });
|
|
57
|
+
const outDirRelPosix = computeOutDirRel(rootAbs, outDirAbs);
|
|
58
|
+
const filesAbs = await listFilesRecursive(rootAbs);
|
|
59
|
+
const records = [];
|
|
60
|
+
const manifestFiles = [];
|
|
61
|
+
for (const abs of filesAbs) {
|
|
62
|
+
const relPosix = toPosixRelPath(abs, rootAbs);
|
|
63
|
+
if (!shouldInclude(relPosix, includeKinds, peerFilter, outDirRelPosix, transcriptsOverride)) continue;
|
|
64
|
+
if (sinceMs !== null) {
|
|
65
|
+
const st = await stat(abs);
|
|
66
|
+
if (st.mtimeMs < sinceMs) continue;
|
|
67
|
+
}
|
|
68
|
+
const content = await readFile(abs, "utf-8");
|
|
69
|
+
records.push({ path: relPosix, content });
|
|
70
|
+
const { sha256, bytes } = await sha256File(abs);
|
|
71
|
+
manifestFiles.push({ path: relPosix, sha256, bytes });
|
|
72
|
+
}
|
|
73
|
+
records.sort((a, b) => a.path.localeCompare(b.path));
|
|
74
|
+
manifestFiles.sort((a, b) => a.path.localeCompare(b.path));
|
|
75
|
+
const capsule = buildCapsuleBlock(opts.name, opts.capsule);
|
|
76
|
+
const includesTranscripts = transcriptsOverride || (includeKinds ?? /* @__PURE__ */ new Set()).has(TRANSCRIPTS_DIR);
|
|
77
|
+
const createdAtMs = opts.now ?? Date.now();
|
|
78
|
+
const manifest = ExportManifestV2Schema.parse({
|
|
79
|
+
format: EXPORT_FORMAT,
|
|
80
|
+
schemaVersion: CAPSULE_SCHEMA_VERSION,
|
|
81
|
+
createdAt: new Date(createdAtMs).toISOString(),
|
|
82
|
+
pluginVersion: opts.pluginVersion ?? "0.0.0",
|
|
83
|
+
includesTranscripts,
|
|
84
|
+
files: manifestFiles,
|
|
85
|
+
capsule
|
|
86
|
+
});
|
|
87
|
+
const bundle = ExportBundleV2Schema.parse({
|
|
88
|
+
manifest,
|
|
89
|
+
records
|
|
90
|
+
});
|
|
91
|
+
const archivePath = path.join(outDirAbs, `${opts.name}.capsule.json.gz`);
|
|
92
|
+
const manifestPath = path.join(outDirAbs, `${opts.name}.manifest.json`);
|
|
93
|
+
await writeJsonFile(manifestPath, manifest);
|
|
94
|
+
const json = JSON.stringify(bundle);
|
|
95
|
+
const gz = gzipSync(Buffer.from(json, "utf-8"));
|
|
96
|
+
await writeFile(archivePath, gz);
|
|
97
|
+
if (opts.encrypt === true) {
|
|
98
|
+
if (!opts.memoryDir) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
"exportCapsule: 'memoryDir' is required when 'encrypt' is true so the secure-store key can be retrieved."
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
const { encPath } = await encryptCapsuleFile({
|
|
104
|
+
sourceGzPath: archivePath,
|
|
105
|
+
memoryDir: opts.memoryDir
|
|
106
|
+
});
|
|
107
|
+
const { unlink } = await import("fs/promises");
|
|
108
|
+
await unlink(archivePath);
|
|
109
|
+
return { archivePath: encPath, manifestPath, manifest, encryptedArchivePath: encPath };
|
|
110
|
+
}
|
|
111
|
+
return { archivePath, manifestPath, manifest, encryptedArchivePath: null };
|
|
112
|
+
}
|
|
113
|
+
function validateName(name) {
|
|
114
|
+
if (typeof name !== "string" || !CAPSULE_ID_PATTERN.test(name)) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`exportCapsule: invalid capsule name. Expected /${CAPSULE_ID_PATTERN.source}/`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
if (name.length > 64) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
"exportCapsule: invalid capsule name. Must be 64 characters or fewer."
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
var ISO_8601_RE = /^\d{4}-\d{2}-\d{2}(?:[Tt]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:[Zz]|[+-]\d{2}:?\d{2}))?$/;
|
|
126
|
+
function parseSince(since) {
|
|
127
|
+
if (since === void 0) return null;
|
|
128
|
+
if (typeof since !== "string" || since.trim() === "") {
|
|
129
|
+
throw new Error("exportCapsule: 'since' must be a non-empty ISO-8601 string");
|
|
130
|
+
}
|
|
131
|
+
if (!ISO_8601_RE.test(since)) {
|
|
132
|
+
throw new Error(
|
|
133
|
+
`exportCapsule: 'since' is not a valid ISO-8601 timestamp: ${since}`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
const ms = Date.parse(since);
|
|
137
|
+
if (!Number.isFinite(ms)) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
`exportCapsule: 'since' is not a valid ISO-8601 timestamp: ${since}`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
assertCalendarRoundTrip(since, ms);
|
|
143
|
+
return ms;
|
|
144
|
+
}
|
|
145
|
+
function isValidCapsuleSince(since) {
|
|
146
|
+
try {
|
|
147
|
+
parseSince(since);
|
|
148
|
+
return true;
|
|
149
|
+
} catch {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function assertCalendarRoundTrip(since, ms) {
|
|
154
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(since);
|
|
155
|
+
if (!m) return;
|
|
156
|
+
const wantY = Number(m[1]);
|
|
157
|
+
const wantMo = Number(m[2]);
|
|
158
|
+
const wantD = Number(m[3]);
|
|
159
|
+
const offsetMatch = /([+-])(\d{2}):?(\d{2})$/.exec(since);
|
|
160
|
+
let displayMs = ms;
|
|
161
|
+
if (offsetMatch) {
|
|
162
|
+
const sign = offsetMatch[1] === "-" ? -1 : 1;
|
|
163
|
+
const offsetMin = sign * (Number(offsetMatch[2]) * 60 + Number(offsetMatch[3]));
|
|
164
|
+
displayMs = ms + offsetMin * 6e4;
|
|
165
|
+
}
|
|
166
|
+
const dd = new Date(displayMs);
|
|
167
|
+
const gotY = dd.getUTCFullYear();
|
|
168
|
+
const gotMo = dd.getUTCMonth() + 1;
|
|
169
|
+
const gotD = dd.getUTCDate();
|
|
170
|
+
if (gotY !== wantY || gotMo !== wantMo || gotD !== wantD) {
|
|
171
|
+
throw new Error(
|
|
172
|
+
`exportCapsule: 'since' is not a valid ISO-8601 timestamp: ${since}`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function normalizeIncludeKinds(kinds) {
|
|
177
|
+
if (kinds === void 0) return null;
|
|
178
|
+
const set = /* @__PURE__ */ new Set();
|
|
179
|
+
for (const raw of kinds) {
|
|
180
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
181
|
+
throw new Error("exportCapsule: 'includeKinds' entries must be non-empty strings");
|
|
182
|
+
}
|
|
183
|
+
if (raw.includes("/") || raw.includes("\\")) {
|
|
184
|
+
throw new Error(
|
|
185
|
+
`exportCapsule: 'includeKinds' entries must be top-level segment names, got: ${raw}`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
set.add(raw);
|
|
189
|
+
}
|
|
190
|
+
return set;
|
|
191
|
+
}
|
|
192
|
+
function normalizePeerIds(peerIds) {
|
|
193
|
+
if (peerIds === void 0) return null;
|
|
194
|
+
const set = /* @__PURE__ */ new Set();
|
|
195
|
+
for (const raw of peerIds) {
|
|
196
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
197
|
+
throw new Error("exportCapsule: 'peerIds' entries must be non-empty strings");
|
|
198
|
+
}
|
|
199
|
+
if (raw.includes("/") || raw.includes("\\") || raw === "." || raw === "..") {
|
|
200
|
+
throw new Error(
|
|
201
|
+
`exportCapsule: 'peerIds' entries must be plain segment names, got: ${raw}`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
set.add(raw);
|
|
205
|
+
}
|
|
206
|
+
return set;
|
|
207
|
+
}
|
|
208
|
+
function computeOutDirRel(rootAbs, outDirAbs) {
|
|
209
|
+
const rel = path.relative(rootAbs, outDirAbs);
|
|
210
|
+
if (rel === "") return null;
|
|
211
|
+
if (rel === ".." || rel.startsWith(`..${path.sep}`)) return null;
|
|
212
|
+
if (path.isAbsolute(rel)) return null;
|
|
213
|
+
return rel.split(path.sep).join("/");
|
|
214
|
+
}
|
|
215
|
+
async function assertIsDirectory(absPath) {
|
|
216
|
+
const st = await stat(absPath).catch(() => null);
|
|
217
|
+
if (!st || !st.isDirectory()) {
|
|
218
|
+
throw new Error(
|
|
219
|
+
`exportCapsule: 'root' must be an existing directory: ${absPath}`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function shouldInclude(relPosix, includeKinds, peerFilter, outDirRelPosix, transcriptsOverride = false) {
|
|
224
|
+
const parts = relPosix.split("/");
|
|
225
|
+
if (parts.some((p) => DEFAULT_EXCLUDE_DIRS.has(p))) return false;
|
|
226
|
+
if (outDirRelPosix !== null) {
|
|
227
|
+
if (relPosix === outDirRelPosix) return false;
|
|
228
|
+
if (relPosix.startsWith(`${outDirRelPosix}/`)) return false;
|
|
229
|
+
}
|
|
230
|
+
const top = parts[0];
|
|
231
|
+
if (top === TRANSCRIPTS_DIR && !transcriptsOverride && (includeKinds === null || !includeKinds.has(TRANSCRIPTS_DIR))) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
if (includeKinds !== null) {
|
|
235
|
+
if (parts.length < 2) return false;
|
|
236
|
+
if (!includeKinds.has(top)) return false;
|
|
237
|
+
}
|
|
238
|
+
if (top === PEERS_DIR && peerFilter !== null) {
|
|
239
|
+
if (peerFilter.size === 0) return false;
|
|
240
|
+
if (parts.length < 2) return false;
|
|
241
|
+
if (!peerFilter.has(parts[1])) return false;
|
|
242
|
+
}
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
function buildCapsuleBlock(name, override) {
|
|
246
|
+
const parent = override?.parent ?? null;
|
|
247
|
+
const parentCapsule = override && Object.prototype.hasOwnProperty.call(override, "parentCapsule") ? override.parentCapsule ?? null : parent?.capsuleId ?? null;
|
|
248
|
+
const merged = {
|
|
249
|
+
id: name,
|
|
250
|
+
version: override?.version ?? "0.1.0",
|
|
251
|
+
schemaVersion: override?.schemaVersion ?? "taxonomy-v1",
|
|
252
|
+
parentCapsule,
|
|
253
|
+
parent,
|
|
254
|
+
description: override?.description ?? "",
|
|
255
|
+
retrievalPolicy: override?.retrievalPolicy ?? {
|
|
256
|
+
tierWeights: {},
|
|
257
|
+
directAnswerEnabled: false
|
|
258
|
+
},
|
|
259
|
+
includes: override?.includes ?? {
|
|
260
|
+
taxonomy: false,
|
|
261
|
+
identityAnchors: false,
|
|
262
|
+
peerProfiles: false,
|
|
263
|
+
procedural: false
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
return CapsuleBlockSchema.parse(merged);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export {
|
|
270
|
+
EXPORT_FORMAT,
|
|
271
|
+
EXPORT_SCHEMA_VERSION,
|
|
272
|
+
exportCapsule,
|
|
273
|
+
isValidCapsuleSince
|
|
274
|
+
};
|
|
275
|
+
//# sourceMappingURL=chunk-IYY4MCPG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transfer/capsule-export.ts","../src/transfer/constants.ts"],"sourcesContent":["import { mkdir, readFile, stat, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { gzipSync } from \"node:zlib\";\nimport { CAPSULE_SCHEMA_VERSION, EXPORT_FORMAT } from \"./constants.js\";\nimport {\n listFilesRecursive,\n sha256File,\n toPosixRelPath,\n writeJsonFile,\n} from \"./fs-utils.js\";\nimport {\n CAPSULE_ID_PATTERN,\n CapsuleBlockSchema,\n ExportBundleV2Schema,\n ExportManifestV2Schema,\n type CapsuleBlock,\n type ExportBundleV2,\n type ExportManifestV2,\n type ExportMemoryRecordV1,\n} from \"./types.js\";\nimport { encryptCapsuleFile } from \"./capsule-crypto.js\";\n\n/**\n * Default subdirectory excludes applied to every capsule export. These match\n * the existing `export-json` / `export-md` exclusions plus the `transcripts`\n * directory, which is excluded by default and only included when the caller\n * explicitly passes `transcripts` in {@link ExportCapsuleOptions.includeKinds}.\n */\nconst DEFAULT_EXCLUDE_DIRS: ReadonlySet<string> = new Set([\n \"node_modules\",\n \".git\",\n // Never export the secure-store directory: it contains the encryption\n // header (KDF params + verifier) which is security-sensitive and\n // machine-specific. The passphrase is not stored here, but including\n // the header in a capsule would let an attacker brute-force the\n // passphrase offline if the capsule is intercepted.\n \".secure-store\",\n // Exclude .capsules to avoid recursive self-inclusion.\n \".capsules\",\n]);\n\nconst TRANSCRIPTS_DIR = \"transcripts\" as const;\n\n/**\n * Top-level directory under {@link ExportCapsuleOptions.root} that holds\n * per-peer profile bundles. When {@link ExportCapsuleOptions.peerIds} is\n * provided, only files under `peers/<peerId>/...` for the listed ids are\n * included; the rest of the `peers/` tree is excluded.\n */\nconst PEERS_DIR = \"peers\" as const;\n\n/**\n * Options accepted by {@link exportCapsule}.\n *\n * `name` — capsule id, validated against {@link CAPSULE_ID_PATTERN}. The id\n * also forms the manifest's `capsule.id` and the archive filename.\n *\n * `root` — absolute or cwd-relative path to the memory directory to export.\n *\n * `since` — optional ISO-8601 timestamp; only files with `mtime >= since`\n * are included.\n *\n * `includeKinds` — optional allow-list of top-level subdirectory names\n * (e.g. `facts`, `entities`, `corrections`, `transcripts`). When set, files\n * directly under {@link root} are excluded and only files whose first path\n * segment is in the allow-list are kept. Pass `transcripts` here explicitly\n * to opt-in transcripts (they are excluded by default).\n *\n * `peerIds` — optional allow-list restricting the `peers/` tree to files\n * under `peers/<peerId>/...`. When omitted the entire `peers/` tree is\n * included (subject to {@link includeKinds}). When set to an empty array\n * the `peers/` tree is excluded entirely.\n *\n * `outDir` — optional output directory. Defaults to `<root>/.capsules`.\n *\n * `pluginVersion` — recorded in the manifest. Defaults to `\"0.0.0\"` so\n * tests do not need to thread a version through; production callers SHOULD\n * pass the running plugin version.\n *\n * `capsule` — optional overrides for the manifest's `capsule` block. The\n * caller may pass any subset; remaining fields are filled with conservative\n * defaults documented inline below.\n *\n * `now` — optional clock override (ms epoch) used for `manifest.createdAt`.\n * Tests pass a fixed value for deterministic output.\n *\n * `encrypt` — when `true`, encrypt the output archive using the secure-store\n * master key for `memoryDir`. The keyring must be unlocked before calling\n * (`remnic secure-store unlock`). The plaintext `.capsule.json.gz` is written\n * first, then encrypted to `<name>.capsule.json.gz.enc`; the plaintext is\n * removed after successful encryption. Requires `memoryDir` to be provided.\n *\n * `memoryDir` — required when `encrypt` is `true`. The memory directory whose\n * secure-store keyring holds the master key.\n */\nexport interface ExportCapsuleOptions {\n name: string;\n root: string;\n since?: string;\n includeKinds?: readonly string[];\n peerIds?: readonly string[];\n outDir?: string;\n pluginVersion?: string;\n capsule?: Partial<Omit<CapsuleBlock, \"id\">>;\n now?: number;\n /**\n * When `true`, encrypt the output archive. Requires the secure-store to be\n * unlocked and `memoryDir` to be set. The plaintext `.capsule.json.gz` is\n * replaced by `<name>.capsule.json.gz.enc` on success.\n */\n encrypt?: boolean;\n /**\n * Memory directory whose secure-store keyring holds the master key. Required\n * when `encrypt` is `true`; ignored otherwise.\n */\n memoryDir?: string;\n /**\n * When `true`, include the `transcripts/` directory in the export even\n * though it is excluded by default. Using this flag avoids hard-coding an\n * explicit `includeKinds` allow-list that would inadvertently drop other\n * valid memory directories (`peers/`, `forks/`, etc.). (Cursor / #747)\n *\n * Ignored when `includeKinds` is provided and already contains\n * `\"transcripts\"`.\n */\n includeTranscripts?: boolean;\n}\n\nexport interface ExportCapsuleResult {\n archivePath: string;\n manifestPath: string;\n manifest: ExportManifestV2;\n /** When the export was encrypted, the `.enc` path. `null` when unencrypted. */\n encryptedArchivePath: string | null;\n}\n\n/**\n * Pure function that exports a memory directory as a portable, capsule-aware\n * V2 bundle.\n *\n * The output is a single `.capsule.json.gz` archive containing the entire\n * `ExportBundleV2` (manifest + records) plus a sidecar `manifest.json` for\n * cheap inspection. The bundle format is intentionally identical to the\n * existing `export-json` shape so PR 3/6's importer can reuse the V1 code\n * path with only a manifest version-dispatch.\n *\n * Determinism guarantees:\n * - `manifest.files` and `bundle.records` are sorted by posix path.\n * - `manifest.createdAt` is taken from {@link ExportCapsuleOptions.now}\n * when provided.\n * - The archive is gzip-compressed with default settings; no timestamp is\n * embedded (Node's `gzipSync` does not write a header timestamp when\n * using the synchronous helper, so byte-identical outputs are possible\n * given identical inputs).\n *\n * Empty result handling: a capsule with zero matching files is still a\n * valid capsule and produces a well-formed manifest with an empty `files`\n * array and an archive containing the empty bundle.\n */\nexport async function exportCapsule(\n opts: ExportCapsuleOptions,\n): Promise<ExportCapsuleResult> {\n validateName(opts.name);\n const sinceMs = parseSince(opts.since);\n const includeKinds = normalizeIncludeKinds(opts.includeKinds);\n const peerFilter = normalizePeerIds(opts.peerIds);\n // `includeTranscripts: true` overrides the default transcripts exclusion\n // without requiring an explicit `includeKinds` list — so callers that want\n // all memory dirs + transcripts don't need to hard-code a list that would\n // inadvertently drop new dirs like `peers/` or `forks/`. (Cursor / #747)\n const transcriptsOverride = opts.includeTranscripts === true;\n\n const rootAbs = path.resolve(opts.root);\n await assertIsDirectory(rootAbs);\n\n const outDirAbs = path.resolve(opts.outDir ?? path.join(rootAbs, \".capsules\"));\n // Reject outDir === root: the input scan would otherwise be entirely\n // skipped by `shouldInclude` (outDirRelPosix === \".\") and the export would\n // silently succeed with an empty manifest/archive — a Rule 51 violation\n // and a data-loss footgun for callers that point outDir at the root.\n if (outDirAbs === rootAbs) {\n throw new Error(\n \"exportCapsule: 'outDir' must not equal 'root'. \" +\n \"Choose a separate directory (default: <root>/.capsules) so the \" +\n \"export does not overwrite or shadow the source tree.\",\n );\n }\n await mkdir(outDirAbs, { recursive: true });\n\n // If the output directory lives inside the export root, scan results would\n // re-import previous capsule archives on subsequent runs. Compute the\n // posix-relative path of the outDir under rootAbs (or `null` when it sits\n // outside) so {@link shouldInclude} can skip the entire subtree.\n const outDirRelPosix = computeOutDirRel(rootAbs, outDirAbs);\n\n const filesAbs = await listFilesRecursive(rootAbs);\n\n const records: ExportMemoryRecordV1[] = [];\n const manifestFiles: ExportManifestV2[\"files\"] = [];\n\n for (const abs of filesAbs) {\n const relPosix = toPosixRelPath(abs, rootAbs);\n if (!shouldInclude(relPosix, includeKinds, peerFilter, outDirRelPosix, transcriptsOverride)) continue;\n\n if (sinceMs !== null) {\n const st = await stat(abs);\n if (st.mtimeMs < sinceMs) continue;\n }\n\n const content = await readFile(abs, \"utf-8\");\n records.push({ path: relPosix, content });\n const { sha256, bytes } = await sha256File(abs);\n manifestFiles.push({ path: relPosix, sha256, bytes });\n }\n\n records.sort((a, b) => a.path.localeCompare(b.path));\n manifestFiles.sort((a, b) => a.path.localeCompare(b.path));\n\n const capsule = buildCapsuleBlock(opts.name, opts.capsule);\n const includesTranscripts =\n transcriptsOverride || (includeKinds ?? new Set<string>()).has(TRANSCRIPTS_DIR);\n\n const createdAtMs = opts.now ?? Date.now();\n const manifest = ExportManifestV2Schema.parse({\n format: EXPORT_FORMAT,\n schemaVersion: CAPSULE_SCHEMA_VERSION,\n createdAt: new Date(createdAtMs).toISOString(),\n pluginVersion: opts.pluginVersion ?? \"0.0.0\",\n includesTranscripts,\n files: manifestFiles,\n capsule,\n } satisfies ExportManifestV2);\n\n const bundle: ExportBundleV2 = ExportBundleV2Schema.parse({\n manifest,\n records,\n });\n\n const archivePath = path.join(outDirAbs, `${opts.name}.capsule.json.gz`);\n const manifestPath = path.join(outDirAbs, `${opts.name}.manifest.json`);\n\n // Sidecar manifest for cheap inspection without decompressing the archive.\n await writeJsonFile(manifestPath, manifest);\n\n // Single-artifact gzip archive containing the whole bundle. JSON encoded\n // before gzip so the archive is opaque to file-tree filtering. Using the\n // sync helper keeps the function pure async (no filesystem callback chain)\n // and matches the existing transfer modules' style.\n const json = JSON.stringify(bundle);\n const gz = gzipSync(Buffer.from(json, \"utf-8\"));\n await writeFile(archivePath, gz);\n\n // Optional encryption (PR 4/4). When opts.encrypt is true, wrap the\n // plaintext gzip in a REMNIC-ENC sealed envelope and remove the plaintext.\n // Per gotcha #54: write the encrypted file before removing the plaintext so\n // a crash mid-encrypt does not destroy the only copy.\n if (opts.encrypt === true) {\n if (!opts.memoryDir) {\n throw new Error(\n \"exportCapsule: 'memoryDir' is required when 'encrypt' is true so the \" +\n \"secure-store key can be retrieved.\",\n );\n }\n const { encPath } = await encryptCapsuleFile({\n sourceGzPath: archivePath,\n memoryDir: opts.memoryDir,\n });\n // Remove the plaintext only after the encrypted file was written successfully.\n const { unlink } = await import(\"node:fs/promises\");\n await unlink(archivePath);\n return { archivePath: encPath, manifestPath, manifest, encryptedArchivePath: encPath };\n }\n\n return { archivePath, manifestPath, manifest, encryptedArchivePath: null };\n}\n\n// ---------------------------------------------------------------------------\n// Validation helpers\n// ---------------------------------------------------------------------------\n\nfunction validateName(name: unknown): void {\n if (typeof name !== \"string\" || !CAPSULE_ID_PATTERN.test(name)) {\n throw new Error(\n `exportCapsule: invalid capsule name. Expected /${CAPSULE_ID_PATTERN.source}/`,\n );\n }\n if (name.length > 64) {\n throw new Error(\n \"exportCapsule: invalid capsule name. Must be 64 characters or fewer.\",\n );\n }\n}\n\n/**\n * Strict ISO-8601 form accepted by {@link parseSince}. We accept exactly two\n * shapes:\n *\n * 1. Date-only: `YYYY-MM-DD` — interpreted as UTC midnight per ECMAScript.\n * 2. Date+time with an explicit timezone designator:\n * `YYYY-MM-DDTHH:MM(:SS(.fff)?)?(Z|±HH:MM)`.\n *\n * Notably **rejected**: date+time **without** a timezone (e.g.\n * `2026-02-28T00:00:00`). ECMAScript treats this as local time, which makes\n * acceptance and the resulting cutoff depend on the host's `TZ` and silently\n * shifts incremental-export windows for users outside UTC. Rule 51: reject\n * inputs that silently coerce to a host-dependent meaning.\n */\nconst ISO_8601_RE =\n /^\\d{4}-\\d{2}-\\d{2}(?:[Tt]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?(?:[Zz]|[+-]\\d{2}:?\\d{2}))?$/;\n\nfunction parseSince(since: string | undefined): number | null {\n if (since === undefined) return null;\n if (typeof since !== \"string\" || since.trim() === \"\") {\n throw new Error(\"exportCapsule: 'since' must be a non-empty ISO-8601 string\");\n }\n if (!ISO_8601_RE.test(since)) {\n throw new Error(\n `exportCapsule: 'since' is not a valid ISO-8601 timestamp: ${since}`,\n );\n }\n const ms = Date.parse(since);\n if (!Number.isFinite(ms)) {\n throw new Error(\n `exportCapsule: 'since' is not a valid ISO-8601 timestamp: ${since}`,\n );\n }\n // Reject calendar overflow: `Date.parse(\"2026-02-31\")` returns a finite ms\n // for March 3 because the JS Date constructor silently normalizes invalid\n // calendar values. Round-trip through `Date` and compare the year/month/day\n // components against the input prefix to catch this. Rule 51: silent\n // coercion of an exact time boundary is a Rule 51 violation that breaks\n // incremental exports.\n assertCalendarRoundTrip(since, ms);\n return ms;\n}\n\nexport function isValidCapsuleSince(since: string): boolean {\n try {\n parseSince(since);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Verify that parsing {@link since} did not silently normalize an invalid\n * calendar date (e.g. `2026-02-31` → `2026-03-03`). We extract the\n * year/month/day from the input string (regex-validated above) and compare\n * against the parsed Date's UTC components. Both date-only forms and forms\n * with an explicit Z/offset are normalized to UTC by `Date.parse`; for the\n * non-Z case where the offset shifts the calendar day across midnight, we\n * re-derive the input's intended UTC instant by accounting for the offset\n * before the comparison.\n */\nfunction assertCalendarRoundTrip(since: string, ms: number): void {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(since);\n if (!m) return;\n const wantY = Number(m[1]);\n const wantMo = Number(m[2]);\n const wantD = Number(m[3]);\n\n // For inputs with an explicit non-zero offset, compare against the\n // wall-clock components of that offset instead of UTC. Date.parse maps to\n // UTC, so 2026-02-31T00:00:00-05:00 and 2026-02-31T00:00:00Z both fail the\n // calendar check; the wall-clock comparison via `m[1..3]` is still the\n // right reference because the input's stated calendar day must exist.\n const offsetMatch = /([+-])(\\d{2}):?(\\d{2})$/.exec(since);\n let displayMs = ms;\n if (offsetMatch) {\n const sign = offsetMatch[1] === \"-\" ? -1 : 1;\n const offsetMin = sign * (Number(offsetMatch[2]) * 60 + Number(offsetMatch[3]));\n displayMs = ms + offsetMin * 60_000;\n }\n const dd = new Date(displayMs);\n const gotY = dd.getUTCFullYear();\n const gotMo = dd.getUTCMonth() + 1;\n const gotD = dd.getUTCDate();\n if (gotY !== wantY || gotMo !== wantMo || gotD !== wantD) {\n throw new Error(\n `exportCapsule: 'since' is not a valid ISO-8601 timestamp: ${since}`,\n );\n }\n}\n\nfunction normalizeIncludeKinds(\n kinds: readonly string[] | undefined,\n): ReadonlySet<string> | null {\n if (kinds === undefined) return null;\n // Empty array is treated as \"include nothing\" rather than \"include all\"\n // so callers cannot accidentally widen the filter by passing []. This\n // mirrors PR-1/6 Rule 51: reject ambiguous input — but here we model it\n // as \"explicit empty allow-list\" rather than throwing, because empty\n // capsules ARE valid (see acceptance criteria).\n const set = new Set<string>();\n for (const raw of kinds) {\n if (typeof raw !== \"string\" || raw.trim() === \"\") {\n throw new Error(\"exportCapsule: 'includeKinds' entries must be non-empty strings\");\n }\n if (raw.includes(\"/\") || raw.includes(\"\\\\\")) {\n throw new Error(\n `exportCapsule: 'includeKinds' entries must be top-level segment names, got: ${raw}`,\n );\n }\n set.add(raw);\n }\n return set;\n}\n\nfunction normalizePeerIds(\n peerIds: readonly string[] | undefined,\n): ReadonlySet<string> | null {\n if (peerIds === undefined) return null;\n const set = new Set<string>();\n for (const raw of peerIds) {\n if (typeof raw !== \"string\" || raw.trim() === \"\") {\n throw new Error(\"exportCapsule: 'peerIds' entries must be non-empty strings\");\n }\n if (raw.includes(\"/\") || raw.includes(\"\\\\\") || raw === \".\" || raw === \"..\") {\n throw new Error(\n `exportCapsule: 'peerIds' entries must be plain segment names, got: ${raw}`,\n );\n }\n set.add(raw);\n }\n return set;\n}\n\n/**\n * Return the posix-relative path of {@link outDirAbs} under {@link rootAbs},\n * or `null` if the output directory sits outside the export root. Used to\n * exclude the output directory's subtree from the input scan so re-running\n * the export does not package prior archives back into the new bundle.\n *\n * Both inputs are expected to be absolute paths already (post-`path.resolve`).\n */\nfunction computeOutDirRel(rootAbs: string, outDirAbs: string): string | null {\n const rel = path.relative(rootAbs, outDirAbs);\n // outDir == root: degenerate. {@link exportCapsule} rejects this case\n // before calling us; this branch is defensive only. Returning `\".\"` would\n // make `shouldInclude` drop every file, masking the misuse — return `null`\n // instead so any direct caller that bypasses the check still produces a\n // populated manifest rather than a silent empty export.\n if (rel === \"\") return null;\n // outDir outside root: nothing to exclude. Match real parent-traversal\n // segments only — `rel.startsWith(\"..\")` would also match valid in-tree\n // names like `..capsules` and would skip excluding that subtree. The\n // boundary check (`rel === \"..\"` or `rel` starts with `\"..\" + sep`) is\n // platform-aware via `path.sep` so Windows backslashes are respected.\n if (rel === \"..\" || rel.startsWith(`..${path.sep}`)) return null;\n if (path.isAbsolute(rel)) return null;\n return rel.split(path.sep).join(\"/\");\n}\n\nasync function assertIsDirectory(absPath: string): Promise<void> {\n // Mirror gotcha #24: existsSync returns true for files. The export root\n // MUST be a directory or the walk silently succeeds with zero entries.\n const st = await stat(absPath).catch(() => null);\n if (!st || !st.isDirectory()) {\n throw new Error(\n `exportCapsule: 'root' must be an existing directory: ${absPath}`,\n );\n }\n}\n\nfunction shouldInclude(\n relPosix: string,\n includeKinds: ReadonlySet<string> | null,\n peerFilter: ReadonlySet<string> | null,\n outDirRelPosix: string | null,\n transcriptsOverride = false,\n): boolean {\n const parts = relPosix.split(\"/\");\n if (parts.some((p) => DEFAULT_EXCLUDE_DIRS.has(p))) return false;\n\n // Exclude the output directory subtree. Without this, re-running against\n // the same root packages prior `.capsule.json.gz` archives and sidecar\n // manifests as records, causing bundle bloat and leaking stale exports.\n // `outDir === root` is rejected at the entrypoint (`exportCapsule`), so\n // {@link computeOutDirRel} never returns `\".\"` for the in-tree case here.\n if (outDirRelPosix !== null) {\n if (relPosix === outDirRelPosix) return false;\n if (relPosix.startsWith(`${outDirRelPosix}/`)) return false;\n }\n\n const top = parts[0];\n\n // Transcripts are opt-in: excluded unless caller explicitly listed them\n // in includeKinds OR passed `includeTranscripts: true`. The override flag\n // avoids the footgun of having the CLI build a hard-coded kinds list that\n // inadvertently drops valid memory dirs like `peers/` or `forks/`. (Cursor / #747)\n if (\n top === TRANSCRIPTS_DIR &&\n !transcriptsOverride &&\n (includeKinds === null || !includeKinds.has(TRANSCRIPTS_DIR))\n ) {\n return false;\n }\n\n if (includeKinds !== null) {\n // includeKinds restricts to whitelisted top-level segments. Files at\n // the repo root (no top-level dir) are excluded under an explicit\n // allow-list because they are not categorized.\n if (parts.length < 2) return false;\n if (!includeKinds.has(top)) return false;\n }\n\n if (top === PEERS_DIR && peerFilter !== null) {\n if (peerFilter.size === 0) return false;\n if (parts.length < 2) return false;\n if (!peerFilter.has(parts[1])) return false;\n }\n\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Capsule-block defaults\n// ---------------------------------------------------------------------------\n\n/**\n * Build a {@link CapsuleBlock} for the manifest. PR 2/6 ships a minimal\n * snapshot: tier-weights and `directAnswerEnabled` default to zod-passing\n * placeholders so the bundle parses cleanly. PRs 3/6+ will wire real\n * retrieval-policy and identity-anchor snapshots into the override path.\n *\n * Defaults (chosen to be safe + least-surprising):\n * - `version` — `0.1.0` (capsule authors override per release).\n * - `schemaVersion` — `taxonomy-v1` until the taxonomy registry stabilizes.\n * - `parentCapsule` — `null` (explicit \"no parent\" sentinel).\n * - `description` — empty string. Capsule authors override.\n * - `retrievalPolicy` — empty `tierWeights` map + `directAnswerEnabled: false`.\n * Empty weights mean \"no overrides\"; importers fall back to their local\n * policy. `false` is the least-privileged default per Rule 48.\n * - `includes` — all flags `false` until later PRs wire the\n * sub-bundles in.\n */\nfunction buildCapsuleBlock(\n name: string,\n override: Partial<Omit<CapsuleBlock, \"id\">> | undefined,\n): CapsuleBlock {\n // `parent` (structured, PR 4/6) and `parentCapsule` (legacy string) carry\n // overlapping information. The schema documents the invariant: when\n // `parent` is non-null, `parentCapsule` SHOULD equal `parent.capsuleId`.\n // We derive the legacy field from the structured field whenever the\n // caller supplies `parent` but omits `parentCapsule`, so a single-source\n // override path produces a manifest that satisfies the documented\n // invariant for legacy V2 readers (Cursor medium #751 round 3).\n // An explicit `parentCapsule` override still wins — including an explicit\n // `null` — so callers can intentionally diverge from the structured field\n // for migration scenarios.\n const parent = override?.parent ?? null;\n const parentCapsule =\n override && Object.prototype.hasOwnProperty.call(override, \"parentCapsule\")\n ? (override.parentCapsule ?? null)\n : (parent?.capsuleId ?? null);\n\n const merged: CapsuleBlock = {\n id: name,\n version: override?.version ?? \"0.1.0\",\n schemaVersion: override?.schemaVersion ?? \"taxonomy-v1\",\n parentCapsule,\n parent,\n description: override?.description ?? \"\",\n retrievalPolicy: override?.retrievalPolicy ?? {\n tierWeights: {},\n directAnswerEnabled: false,\n },\n includes: override?.includes ?? {\n taxonomy: false,\n identityAnchors: false,\n peerProfiles: false,\n procedural: false,\n },\n };\n // Re-parse to surface invalid overrides with the same zod errors a caller\n // would get when constructing a CapsuleBlock by hand.\n return CapsuleBlockSchema.parse(merged);\n}\n","export const EXPORT_FORMAT = \"openclaw-engram-export\" as const;\nexport const EXPORT_SCHEMA_VERSION = 1 as const;\n\n/**\n * Schema version for capsule-aware (V2) export manifests. See\n * {@link ../types.ts} `ExportManifestV2Schema` for the wire format.\n *\n * V1 manifests remain the default for non-capsule exports\n * (`exportJsonBundle` / `exportMarkdownBundle`). V2 is emitted by the\n * capsule export pipeline only.\n */\nexport const CAPSULE_SCHEMA_VERSION = 2 as const;\n\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,UAAU,MAAM,iBAAiB;AACjD,OAAO,UAAU;AACjB,SAAS,gBAAgB;;;ACFlB,IAAM,gBAAgB;AACtB,IAAM,wBAAwB;AAU9B,IAAM,yBAAyB;;;ADiBtC,IAAM,uBAA4C,oBAAI,IAAI;AAAA,EACxD;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA;AAAA,EAEA;AACF,CAAC;AAED,IAAM,kBAAkB;AAQxB,IAAM,YAAY;AA8GlB,eAAsB,cACpB,MAC8B;AAC9B,eAAa,KAAK,IAAI;AACt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