@remnic/core 1.1.1 → 1.1.3
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 +76 -51
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +50 -5
- package/dist/access-http.js +38 -16
- package/dist/access-idempotency.js +1 -0
- package/dist/access-mcp.d.ts +10 -5
- package/dist/access-mcp.js +37 -14
- package/dist/access-schema.d.ts +133 -13
- package/dist/access-schema.js +20 -1
- package/dist/access-service-_AEUMVyX.d.ts +1981 -0
- package/dist/access-service.d.ts +11 -6
- package/dist/access-service.js +39 -14
- 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 -6
- 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-VDX363PS.js → chunk-34F3PLWZ.js} +10 -3
- package/dist/chunk-34F3PLWZ.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-KUB6JU6H.js → chunk-47WOM4YW.js} +2 -2
- package/dist/{chunk-HK3FGIEW.js → chunk-4PLGJRBV.js} +656 -20
- package/dist/chunk-4PLGJRBV.js.map +1 -0
- package/dist/{chunk-BGJGXLZ7.js → chunk-55FXRRSJ.js} +11 -8
- package/dist/chunk-55FXRRSJ.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-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-B5WXLVDY.js → chunk-7GCMLT7J.js} +245 -25
- package/dist/chunk-7GCMLT7J.js.map +1 -0
- package/dist/chunk-A6XUJE5D.js +126 -0
- package/dist/chunk-A6XUJE5D.js.map +1 -0
- package/dist/chunk-AJA46VX5.js +393 -0
- package/dist/chunk-AJA46VX5.js.map +1 -0
- package/dist/{chunk-DFTTJYSO.js → chunk-AKUCB2OG.js} +525 -24
- package/dist/chunk-AKUCB2OG.js.map +1 -0
- package/dist/chunk-ASIQZXYO.js +277 -0
- package/dist/chunk-ASIQZXYO.js.map +1 -0
- package/dist/{chunk-ZEM3OK2K.js → chunk-B2TL6GA2.js} +3 -3
- 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-3GXCSUXR.js → chunk-CRU27Q4J.js} +2 -2
- package/dist/{chunk-F5VP6YCB.js → chunk-DCE6SQLA.js} +572 -155
- package/dist/chunk-DCE6SQLA.js.map +1 -0
- package/dist/{chunk-CUPFXL3J.js → chunk-DHRQHX36.js} +4 -4
- package/dist/chunk-DHRQHX36.js.map +1 -0
- package/dist/{chunk-GKFXUTJ2.js → chunk-DR7MCMPS.js} +981 -61
- package/dist/chunk-DR7MCMPS.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-VYM3VWOF.js → chunk-IM3JSE73.js} +966 -329
- package/dist/chunk-IM3JSE73.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-BK2EFTE2.js → chunk-JWSENLQI.js} +508 -28
- 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-SPI27QT6.js → chunk-L5IIGA5V.js} +9 -4
- package/dist/chunk-L5IIGA5V.js.map +1 -0
- package/dist/{chunk-RGLL5SPU.js → chunk-LVYGDT5V.js} +56 -82
- package/dist/chunk-LVYGDT5V.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-3OGMS3PE.js → chunk-LZRYQK6L.js} +3 -2
- package/dist/chunk-LZRYQK6L.js.map +1 -0
- package/dist/chunk-MDYG7VI7.js +48 -0
- package/dist/chunk-MDYG7VI7.js.map +1 -0
- package/dist/chunk-MXC3AP5I.js +74 -0
- package/dist/chunk-MXC3AP5I.js.map +1 -0
- package/dist/{chunk-S3EEFKNY.js → chunk-N7X62G74.js} +26 -11
- package/dist/chunk-N7X62G74.js.map +1 -0
- package/dist/chunk-NN3TS5BM.js +147 -0
- package/dist/chunk-NN3TS5BM.js.map +1 -0
- package/dist/chunk-OA3L7BFR.js +183 -0
- package/dist/chunk-OA3L7BFR.js.map +1 -0
- package/dist/{chunk-LK6SGL53.js → chunk-OR64ZGRZ.js} +3 -2
- package/dist/chunk-OR64ZGRZ.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-XZ2TIKGC.js → chunk-Q7FJ5ZHM.js} +30 -10
- package/dist/chunk-Q7FJ5ZHM.js.map +1 -0
- package/dist/{chunk-7I7FKFZH.js → chunk-R2L7SUX2.js} +6 -6
- package/dist/{chunk-JL2PU6AI.js → chunk-R2XRID2N.js} +2 -2
- 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-WVVA7F5A.js → chunk-SS253RXF.js} +30 -16
- package/dist/chunk-SS253RXF.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-EPQJM2GC.js → chunk-VTJVUHRK.js} +22 -36
- package/dist/chunk-VTJVUHRK.js.map +1 -0
- package/dist/{chunk-O5ETUNBT.js → chunk-VTU2B4VF.js} +7 -3
- package/dist/chunk-VTU2B4VF.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-YNQKWQT4.js → chunk-WSZIHQBK.js} +31 -11
- package/dist/{chunk-YNQKWQT4.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-FVA6TGI3.js → chunk-Y3WQ4ZWK.js} +42 -2
- package/dist/chunk-Y3WQ4ZWK.js.map +1 -0
- package/dist/chunk-YNJHCGDT.js +309 -0
- package/dist/chunk-YNJHCGDT.js.map +1 -0
- package/dist/{chunk-ALXMCZEU.js → chunk-Z2E7VW55.js} +6 -3
- package/dist/chunk-Z2E7VW55.js.map +1 -0
- package/dist/{chunk-INXV5JBT.js → chunk-ZGXSCMQN.js} +1992 -410
- package/dist/chunk-ZGXSCMQN.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-x2APT9a6.d.ts} +26 -7
- package/dist/cli.d.ts +11 -6
- package/dist/cli.js +68 -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 +5 -2
- 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 +3 -1
- package/dist/{engine-F3GOXGE5.js → engine-ICC2DSQF.js} +10 -7
- package/dist/engine-ICC2DSQF.js.map +1 -0
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +9 -6
- 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 +9 -8
- 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 +562 -13
- package/dist/index.js +365 -96
- 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 +3 -2
- 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-KG52RITE.js +37 -0
- package/dist/memory-governance-KG52RITE.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-D3vBHS4J.d.ts} +1 -0
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-projection-store.js +1 -0
- 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 +58 -42
- 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 +13 -1
- package/dist/resolve-provider-secret.js +6 -1
- package/dist/resume-bundles.js +5 -4
- 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 -6
- package/dist/semantic-rule-promotion.d.ts +1 -1
- package/dist/semantic-rule-promotion.js +9 -6
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +9 -6
- 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 +8 -5
- package/dist/store-contract.js +1 -0
- package/dist/summarizer.js +6 -5
- 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 +3 -1
- 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 +9 -6
- package/dist/version-utils.js +1 -0
- package/dist/whitespace.js +1 -0
- package/dist/work-product-ledger.js +1 -0
- package/package.json +2 -1
- package/dist/access-service-Br8ZydTK.d.ts +0 -827
- package/dist/chunk-3OGMS3PE.js.map +0 -1
- package/dist/chunk-6PFRXT4K.js.map +0 -1
- package/dist/chunk-ALXMCZEU.js.map +0 -1
- package/dist/chunk-B5WXLVDY.js.map +0 -1
- package/dist/chunk-BGJGXLZ7.js.map +0 -1
- package/dist/chunk-BK2EFTE2.js.map +0 -1
- package/dist/chunk-C2EFFULQ.js.map +0 -1
- package/dist/chunk-CUPFXL3J.js.map +0 -1
- package/dist/chunk-DFTTJYSO.js.map +0 -1
- package/dist/chunk-EPQJM2GC.js.map +0 -1
- package/dist/chunk-F5VP6YCB.js.map +0 -1
- package/dist/chunk-FVA6TGI3.js.map +0 -1
- package/dist/chunk-GKFXUTJ2.js.map +0 -1
- package/dist/chunk-HK3FGIEW.js.map +0 -1
- package/dist/chunk-INXV5JBT.js.map +0 -1
- package/dist/chunk-KVBLZUKV.js.map +0 -1
- package/dist/chunk-LK6SGL53.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-O5ETUNBT.js.map +0 -1
- package/dist/chunk-PVPWZSSI.js.map +0 -1
- package/dist/chunk-RGLL5SPU.js.map +0 -1
- package/dist/chunk-S3EEFKNY.js.map +0 -1
- package/dist/chunk-SPI27QT6.js.map +0 -1
- package/dist/chunk-TP4FZJIZ.js.map +0 -1
- package/dist/chunk-ULYOGL6R.js.map +0 -1
- package/dist/chunk-VBVG2M5G.js.map +0 -1
- package/dist/chunk-VDX363PS.js.map +0 -1
- package/dist/chunk-VYM3VWOF.js.map +0 -1
- package/dist/chunk-WCLICCGB.js.map +0 -1
- package/dist/chunk-WVVA7F5A.js.map +0 -1
- package/dist/chunk-X6GF3FX2.js +0 -26
- package/dist/chunk-X6GF3FX2.js.map +0 -1
- package/dist/chunk-XZ2TIKGC.js.map +0 -1
- package/dist/chunk-ZAIM4TUE.js.map +0 -1
- /package/dist/{contradiction-review-WIUBAR52.js.map → capsule-cli.js.map} +0 -0
- /package/dist/{engine-F3GOXGE5.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
- /package/dist/{chunk-KUB6JU6H.js.map → chunk-47WOM4YW.js.map} +0 -0
- /package/dist/{chunk-ZEM3OK2K.js.map → chunk-B2TL6GA2.js.map} +0 -0
- /package/dist/{chunk-3GXCSUXR.js.map → chunk-CRU27Q4J.js.map} +0 -0
- /package/dist/{chunk-RBBWYEFJ.js.map → chunk-G2WADRQ3.js.map} +0 -0
- /package/dist/{chunk-7I7FKFZH.js.map → chunk-R2L7SUX2.js.map} +0 -0
- /package/dist/{chunk-JL2PU6AI.js.map → chunk-R2XRID2N.js.map} +0 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decryptMemoryDirToPlaintext,
|
|
3
|
+
migrateMemoryDirToEncrypted
|
|
4
|
+
} from "./chunk-YNJHCGDT.js";
|
|
5
|
+
import {
|
|
6
|
+
buildHeaderFromPassphrase,
|
|
7
|
+
deriveKeyFromHeader,
|
|
8
|
+
getKey,
|
|
9
|
+
headerPath,
|
|
10
|
+
lock,
|
|
11
|
+
readHeader,
|
|
12
|
+
secureStoreDir,
|
|
13
|
+
status,
|
|
14
|
+
unlock,
|
|
15
|
+
verifyKey,
|
|
16
|
+
writeHeader
|
|
17
|
+
} from "./chunk-BJMBJZ2Y.js";
|
|
18
|
+
import {
|
|
19
|
+
DEFAULT_ARGON2ID_PARAMS,
|
|
20
|
+
DEFAULT_SCRYPT_PARAMS,
|
|
21
|
+
KDF_SALT_LENGTH
|
|
22
|
+
} from "./chunk-FP2373TW.js";
|
|
23
|
+
import {
|
|
24
|
+
generateSalt
|
|
25
|
+
} from "./chunk-A6XUJE5D.js";
|
|
26
|
+
|
|
27
|
+
// src/secure-store/cli-handlers.ts
|
|
28
|
+
async function runSecureStoreInit(options) {
|
|
29
|
+
const { memoryDir, readPassphrase } = options;
|
|
30
|
+
if (typeof memoryDir !== "string" || memoryDir.length === 0) {
|
|
31
|
+
throw new Error("secure-store init: memoryDir is required");
|
|
32
|
+
}
|
|
33
|
+
const existing = await readHeader(memoryDir);
|
|
34
|
+
if (existing !== null) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`secure-store header already exists at ${headerPath(memoryDir)}. Run 'remnic secure-store status' to inspect, or remove the .secure-store directory explicitly to reinitialize.`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const passphrase = await readPassphrase("Enter new passphrase: ", { confirm: true });
|
|
40
|
+
validatePassphrase(passphrase);
|
|
41
|
+
const algorithm = options.algorithm ?? "argon2id";
|
|
42
|
+
const params = resolveParams(algorithm, options.params);
|
|
43
|
+
const salt = options.salt ?? generateSalt();
|
|
44
|
+
if (salt.length !== KDF_SALT_LENGTH) {
|
|
45
|
+
throw new Error(`salt must be ${KDF_SALT_LENGTH} bytes, got ${salt.length}`);
|
|
46
|
+
}
|
|
47
|
+
const built = buildHeaderFromPassphrase({
|
|
48
|
+
passphrase,
|
|
49
|
+
salt,
|
|
50
|
+
algorithm,
|
|
51
|
+
params,
|
|
52
|
+
...options.note !== void 0 ? { note: options.note } : {},
|
|
53
|
+
...options.now ? { createdAt: options.now().toISOString() } : {}
|
|
54
|
+
});
|
|
55
|
+
built.derivedKey.fill(0);
|
|
56
|
+
const writtenPath = await writeHeader(memoryDir, built.header);
|
|
57
|
+
return {
|
|
58
|
+
ok: true,
|
|
59
|
+
headerPath: writtenPath,
|
|
60
|
+
kdf: built.header.metadata.kdf,
|
|
61
|
+
createdAt: built.header.createdAt
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async function runSecureStoreUnlock(options) {
|
|
65
|
+
const { memoryDir, readPassphrase } = options;
|
|
66
|
+
const header = await readHeader(memoryDir);
|
|
67
|
+
if (!header) {
|
|
68
|
+
return { ok: false, reason: "not-initialized" };
|
|
69
|
+
}
|
|
70
|
+
const passphrase = await readPassphrase("Enter passphrase: ");
|
|
71
|
+
validatePassphrase(passphrase);
|
|
72
|
+
const candidateKey = deriveKeyFromHeader(header, passphrase);
|
|
73
|
+
if (!verifyKey(header, candidateKey)) {
|
|
74
|
+
candidateKey.fill(0);
|
|
75
|
+
return { ok: false, reason: "wrong-passphrase" };
|
|
76
|
+
}
|
|
77
|
+
const id = options.keyringId ?? secureStoreDir(memoryDir);
|
|
78
|
+
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
79
|
+
unlock(id, candidateKey, now);
|
|
80
|
+
const status2 = status(id);
|
|
81
|
+
return {
|
|
82
|
+
ok: true,
|
|
83
|
+
unlockedAt: status2.unlockedAt ?? now().toISOString(),
|
|
84
|
+
algorithm: header.metadata.kdf.algorithm
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function runSecureStoreLock(options) {
|
|
88
|
+
const id = options.keyringId ?? secureStoreDir(options.memoryDir);
|
|
89
|
+
const cleared = lock(id);
|
|
90
|
+
return { ok: true, cleared };
|
|
91
|
+
}
|
|
92
|
+
async function runSecureStoreMigrate(options) {
|
|
93
|
+
const { memoryDir } = options;
|
|
94
|
+
const header = await readHeader(memoryDir);
|
|
95
|
+
if (!header) {
|
|
96
|
+
return {
|
|
97
|
+
ok: false,
|
|
98
|
+
reason: "not-initialized",
|
|
99
|
+
encrypted: 0,
|
|
100
|
+
skipped: 0,
|
|
101
|
+
errors: []
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const id = options.keyringId ?? secureStoreDir(memoryDir);
|
|
105
|
+
const key = getKey(id);
|
|
106
|
+
if (key === null) {
|
|
107
|
+
return {
|
|
108
|
+
ok: false,
|
|
109
|
+
reason: "locked",
|
|
110
|
+
encrypted: 0,
|
|
111
|
+
skipped: 0,
|
|
112
|
+
errors: []
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const result = await migrateMemoryDirToEncrypted(memoryDir, key);
|
|
116
|
+
if (result.errors.length > 0) {
|
|
117
|
+
return { ok: false, reason: "file-errors", ...result };
|
|
118
|
+
}
|
|
119
|
+
return { ok: true, ...result };
|
|
120
|
+
}
|
|
121
|
+
async function runSecureStoreDisable(options) {
|
|
122
|
+
const { memoryDir } = options;
|
|
123
|
+
const header = await readHeader(memoryDir);
|
|
124
|
+
if (!header) {
|
|
125
|
+
return {
|
|
126
|
+
ok: false,
|
|
127
|
+
reason: "not-initialized",
|
|
128
|
+
decrypted: 0,
|
|
129
|
+
skipped: 0,
|
|
130
|
+
errors: []
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const id = options.keyringId ?? secureStoreDir(memoryDir);
|
|
134
|
+
const key = getKey(id);
|
|
135
|
+
if (key === null) {
|
|
136
|
+
return {
|
|
137
|
+
ok: false,
|
|
138
|
+
reason: "locked",
|
|
139
|
+
decrypted: 0,
|
|
140
|
+
skipped: 0,
|
|
141
|
+
errors: []
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const result = await decryptMemoryDirToPlaintext(memoryDir, key);
|
|
145
|
+
if (result.errors.length > 0) {
|
|
146
|
+
return { ok: false, reason: "file-errors", ...result };
|
|
147
|
+
}
|
|
148
|
+
return { ok: true, ...result };
|
|
149
|
+
}
|
|
150
|
+
async function runSecureStoreStatus(options) {
|
|
151
|
+
const { memoryDir } = options;
|
|
152
|
+
const id = options.keyringId ?? secureStoreDir(memoryDir);
|
|
153
|
+
const header = await readHeader(memoryDir);
|
|
154
|
+
const ks = status(id);
|
|
155
|
+
const target = headerPath(memoryDir);
|
|
156
|
+
if (!header) {
|
|
157
|
+
return {
|
|
158
|
+
initialized: false,
|
|
159
|
+
headerPath: target,
|
|
160
|
+
locked: !ks.unlocked,
|
|
161
|
+
unlockedAt: ks.unlockedAt,
|
|
162
|
+
kdf: null,
|
|
163
|
+
createdAt: null
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
initialized: true,
|
|
168
|
+
headerPath: target,
|
|
169
|
+
locked: !ks.unlocked,
|
|
170
|
+
unlockedAt: ks.unlockedAt,
|
|
171
|
+
kdf: header.metadata.kdf,
|
|
172
|
+
createdAt: header.createdAt
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
var MIN_PASSPHRASE_LENGTH = 8;
|
|
176
|
+
function validatePassphrase(passphrase) {
|
|
177
|
+
if (typeof passphrase !== "string") {
|
|
178
|
+
throw new Error("passphrase must be a string");
|
|
179
|
+
}
|
|
180
|
+
if (passphrase.length === 0) {
|
|
181
|
+
throw new Error("passphrase must not be empty");
|
|
182
|
+
}
|
|
183
|
+
if (passphrase.length < MIN_PASSPHRASE_LENGTH) {
|
|
184
|
+
throw new Error(`passphrase must be at least ${MIN_PASSPHRASE_LENGTH} characters`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function resolveParams(algorithm, override) {
|
|
188
|
+
if (override !== void 0) return override;
|
|
189
|
+
if (algorithm === "scrypt") return { ...DEFAULT_SCRYPT_PARAMS };
|
|
190
|
+
return { ...DEFAULT_ARGON2ID_PARAMS };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/secure-store/cli-renderer.ts
|
|
194
|
+
function renderInitReport(report) {
|
|
195
|
+
const lines = [];
|
|
196
|
+
lines.push("=== Remnic secure-store initialized ===");
|
|
197
|
+
lines.push("");
|
|
198
|
+
lines.push(`header: ${report.headerPath}`);
|
|
199
|
+
lines.push(`createdAt: ${report.createdAt}`);
|
|
200
|
+
lines.push(...renderKdfLines(report.kdf));
|
|
201
|
+
lines.push("");
|
|
202
|
+
lines.push("Note: init does NOT auto-unlock the store. Run");
|
|
203
|
+
lines.push(" remnic engram secure-store unlock");
|
|
204
|
+
lines.push("to register the master key with the running daemon.");
|
|
205
|
+
return lines.join("\n");
|
|
206
|
+
}
|
|
207
|
+
function renderUnlockReport(report) {
|
|
208
|
+
if (report.ok) {
|
|
209
|
+
return `OK \u2014 secure-store unlocked at ${report.unlockedAt} (algorithm=${report.algorithm}).`;
|
|
210
|
+
}
|
|
211
|
+
if (report.reason === "not-initialized") {
|
|
212
|
+
return "ERR \u2014 secure-store is not initialized. Run 'remnic engram secure-store init' first.";
|
|
213
|
+
}
|
|
214
|
+
return "ERR \u2014 wrong passphrase.";
|
|
215
|
+
}
|
|
216
|
+
function renderLockReport(report) {
|
|
217
|
+
if (report.cleared) {
|
|
218
|
+
return "OK \u2014 secure-store key cleared from in-memory keyring.";
|
|
219
|
+
}
|
|
220
|
+
return "OK \u2014 secure-store was already locked (no in-memory key to clear).";
|
|
221
|
+
}
|
|
222
|
+
function renderMigrateReport(report) {
|
|
223
|
+
if (!report.ok && report.reason === "not-initialized") {
|
|
224
|
+
return "ERR \u2014 secure-store is not initialized. Run 'remnic engram secure-store init' first.";
|
|
225
|
+
}
|
|
226
|
+
if (!report.ok && report.reason === "locked") {
|
|
227
|
+
return "ERR \u2014 secure-store is locked. Run 'remnic engram secure-store unlock' before migrate.";
|
|
228
|
+
}
|
|
229
|
+
const lines = [];
|
|
230
|
+
lines.push(report.ok ? "OK \u2014 secure-store migration complete." : "ERR \u2014 secure-store migration completed with file errors.");
|
|
231
|
+
lines.push(`encrypted: ${report.encrypted}`);
|
|
232
|
+
lines.push(`skipped: ${report.skipped}`);
|
|
233
|
+
lines.push(`errors: ${report.errors.length}`);
|
|
234
|
+
for (const entry of report.errors.slice(0, 10)) {
|
|
235
|
+
lines.push(`- ${entry.filePath}: ${entry.error}`);
|
|
236
|
+
}
|
|
237
|
+
if (report.errors.length > 10) {
|
|
238
|
+
lines.push(`- ... ${report.errors.length - 10} more error(s)`);
|
|
239
|
+
}
|
|
240
|
+
return lines.join("\n");
|
|
241
|
+
}
|
|
242
|
+
function renderDisableReport(report) {
|
|
243
|
+
if (!report.ok && report.reason === "not-initialized") {
|
|
244
|
+
return "ERR \u2014 secure-store is not initialized. Run 'remnic engram secure-store init' first.";
|
|
245
|
+
}
|
|
246
|
+
if (!report.ok && report.reason === "locked") {
|
|
247
|
+
return "ERR \u2014 secure-store is locked. Run 'remnic engram secure-store unlock' before disable.";
|
|
248
|
+
}
|
|
249
|
+
const lines = [];
|
|
250
|
+
lines.push(report.ok ? "OK \u2014 secure-store disable complete." : "ERR \u2014 secure-store disable completed with file errors.");
|
|
251
|
+
lines.push(`decrypted: ${report.decrypted}`);
|
|
252
|
+
lines.push(`skipped: ${report.skipped}`);
|
|
253
|
+
lines.push(`errors: ${report.errors.length}`);
|
|
254
|
+
for (const entry of report.errors.slice(0, 10)) {
|
|
255
|
+
lines.push(`- ${entry.filePath}: ${entry.error}`);
|
|
256
|
+
}
|
|
257
|
+
if (report.errors.length > 10) {
|
|
258
|
+
lines.push(`- ... ${report.errors.length - 10} more error(s)`);
|
|
259
|
+
}
|
|
260
|
+
lines.push("header: kept");
|
|
261
|
+
return lines.join("\n");
|
|
262
|
+
}
|
|
263
|
+
function renderStatusReport(report) {
|
|
264
|
+
const lines = [];
|
|
265
|
+
lines.push("=== Remnic secure-store status ===");
|
|
266
|
+
lines.push("");
|
|
267
|
+
lines.push(`header: ${report.headerPath}`);
|
|
268
|
+
lines.push(`initialized: ${report.initialized ? "yes" : "no"}`);
|
|
269
|
+
if (!report.initialized) {
|
|
270
|
+
lines.push("");
|
|
271
|
+
lines.push("Run 'remnic engram secure-store init' to initialize a new store.");
|
|
272
|
+
return lines.join("\n");
|
|
273
|
+
}
|
|
274
|
+
lines.push(`createdAt: ${report.createdAt ?? "n/a"}`);
|
|
275
|
+
lines.push(`locked: ${report.locked ? "yes" : "no"}`);
|
|
276
|
+
if (!report.locked) {
|
|
277
|
+
lines.push(`lastUnlockAt: ${report.unlockedAt ?? "n/a"}`);
|
|
278
|
+
}
|
|
279
|
+
if (report.kdf) {
|
|
280
|
+
lines.push(...renderKdfLines(report.kdf));
|
|
281
|
+
}
|
|
282
|
+
return lines.join("\n");
|
|
283
|
+
}
|
|
284
|
+
function renderKdfLines(kdf) {
|
|
285
|
+
const lines = [];
|
|
286
|
+
lines.push(`kdf.algorithm: ${kdf.algorithm}`);
|
|
287
|
+
if (kdf.algorithm === "scrypt") {
|
|
288
|
+
const { N, r, p, keyLength, maxmem } = kdf.params;
|
|
289
|
+
lines.push(`kdf.params: N=${N} r=${r} p=${p} keyLength=${keyLength} maxmem=${maxmem}`);
|
|
290
|
+
} else {
|
|
291
|
+
const { memoryKiB, iterations, parallelism, keyLength } = kdf.params;
|
|
292
|
+
lines.push(
|
|
293
|
+
`kdf.params: memoryKiB=${memoryKiB} iterations=${iterations} parallelism=${parallelism} keyLength=${keyLength}`
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
return lines;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// src/secure-store/passphrase-reader.ts
|
|
300
|
+
import { createInterface } from "readline";
|
|
301
|
+
import { StringDecoder } from "string_decoder";
|
|
302
|
+
function createPassphraseReader(options = {}) {
|
|
303
|
+
const input = options.input ?? process.stdin;
|
|
304
|
+
const output = options.output ?? process.stdout;
|
|
305
|
+
const errorStream = options.errorStream ?? process.stderr;
|
|
306
|
+
let nonTtyReader = null;
|
|
307
|
+
let nonTtyWarned = false;
|
|
308
|
+
return async function readPassphrase(prompt, readerOptions) {
|
|
309
|
+
const first = await readSinglePassphrase(prompt);
|
|
310
|
+
if (readerOptions?.confirm) {
|
|
311
|
+
const second = await readSinglePassphrase("Confirm passphrase: ");
|
|
312
|
+
if (first !== second) {
|
|
313
|
+
throw new Error("passphrases did not match");
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return first;
|
|
317
|
+
};
|
|
318
|
+
async function readSinglePassphrase(prompt) {
|
|
319
|
+
const inputAsAny = input;
|
|
320
|
+
if (inputAsAny.isTTY && typeof inputAsAny.setRawMode === "function") {
|
|
321
|
+
return readNoEcho(prompt, inputAsAny, output);
|
|
322
|
+
}
|
|
323
|
+
if (!nonTtyWarned) {
|
|
324
|
+
errorStream.write(
|
|
325
|
+
"[remnic secure-store] warning: stdin is not a TTY; reading passphrase as a plain line. Take care that the passphrase is not exposed in shell history.\n"
|
|
326
|
+
);
|
|
327
|
+
nonTtyWarned = true;
|
|
328
|
+
}
|
|
329
|
+
errorStream.write(prompt);
|
|
330
|
+
if (!nonTtyReader) nonTtyReader = createNonTtyLineReader(input);
|
|
331
|
+
return nonTtyReader.next();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function readNoEcho(prompt, input, output) {
|
|
335
|
+
return new Promise((resolve, reject) => {
|
|
336
|
+
output.write(prompt);
|
|
337
|
+
let buffer = "";
|
|
338
|
+
let settled = false;
|
|
339
|
+
const wasRaw = input.isRaw === true;
|
|
340
|
+
const decoder = new StringDecoder("utf8");
|
|
341
|
+
if (input.setRawMode) input.setRawMode(true);
|
|
342
|
+
input.resume();
|
|
343
|
+
const cleanup = () => {
|
|
344
|
+
input.pause();
|
|
345
|
+
input.removeListener("data", onData);
|
|
346
|
+
decoder.end();
|
|
347
|
+
if (input.setRawMode) input.setRawMode(wasRaw);
|
|
348
|
+
output.write("\n");
|
|
349
|
+
};
|
|
350
|
+
const onData = (chunk) => {
|
|
351
|
+
const str = decoder.write(chunk);
|
|
352
|
+
for (const ch of str) {
|
|
353
|
+
if (settled) return;
|
|
354
|
+
const code = ch.charCodeAt(0);
|
|
355
|
+
if (ch === "\n" || ch === "\r") {
|
|
356
|
+
settled = true;
|
|
357
|
+
cleanup();
|
|
358
|
+
resolve(buffer);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (code === 3) {
|
|
362
|
+
settled = true;
|
|
363
|
+
cleanup();
|
|
364
|
+
reject(new Error("passphrase entry aborted (Ctrl+C)"));
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (code === 4) {
|
|
368
|
+
settled = true;
|
|
369
|
+
cleanup();
|
|
370
|
+
if (buffer.length === 0) {
|
|
371
|
+
reject(new Error("passphrase entry aborted (EOF)"));
|
|
372
|
+
} else {
|
|
373
|
+
resolve(buffer);
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (code === 8 || code === 127) {
|
|
378
|
+
if (buffer.length > 0) {
|
|
379
|
+
const codePoints = Array.from(buffer);
|
|
380
|
+
buffer = codePoints.slice(0, -1).join("");
|
|
381
|
+
}
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (code < 32) {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
buffer += ch;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
input.on("data", onData);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
function createNonTtyLineReader(input) {
|
|
394
|
+
const rl = createInterface({ input, terminal: false });
|
|
395
|
+
const lineQueue = [];
|
|
396
|
+
const waiterQueue = [];
|
|
397
|
+
const errorQueue = [];
|
|
398
|
+
let closed = false;
|
|
399
|
+
let error = null;
|
|
400
|
+
rl.on("line", (line) => {
|
|
401
|
+
const waiter = waiterQueue.shift();
|
|
402
|
+
if (waiter) {
|
|
403
|
+
waiter(line);
|
|
404
|
+
} else {
|
|
405
|
+
lineQueue.push(line);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
rl.on("close", () => {
|
|
409
|
+
closed = true;
|
|
410
|
+
while (waiterQueue.length > 0) {
|
|
411
|
+
const w = waiterQueue.shift();
|
|
412
|
+
errorQueue.shift();
|
|
413
|
+
w("");
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
rl.on("error", (err) => {
|
|
417
|
+
error = err;
|
|
418
|
+
while (errorQueue.length > 0) {
|
|
419
|
+
const r = errorQueue.shift();
|
|
420
|
+
waiterQueue.shift();
|
|
421
|
+
r(err);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
return {
|
|
425
|
+
next() {
|
|
426
|
+
if (error) return Promise.reject(error);
|
|
427
|
+
const queued = lineQueue.shift();
|
|
428
|
+
if (queued !== void 0) return Promise.resolve(queued);
|
|
429
|
+
if (closed) return Promise.resolve("");
|
|
430
|
+
return new Promise((resolve, reject) => {
|
|
431
|
+
waiterQueue.push(resolve);
|
|
432
|
+
errorQueue.push(reject);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export {
|
|
439
|
+
runSecureStoreInit,
|
|
440
|
+
runSecureStoreUnlock,
|
|
441
|
+
runSecureStoreLock,
|
|
442
|
+
runSecureStoreMigrate,
|
|
443
|
+
runSecureStoreDisable,
|
|
444
|
+
runSecureStoreStatus,
|
|
445
|
+
MIN_PASSPHRASE_LENGTH,
|
|
446
|
+
renderInitReport,
|
|
447
|
+
renderUnlockReport,
|
|
448
|
+
renderLockReport,
|
|
449
|
+
renderMigrateReport,
|
|
450
|
+
renderDisableReport,
|
|
451
|
+
renderStatusReport,
|
|
452
|
+
createPassphraseReader
|
|
453
|
+
};
|
|
454
|
+
//# sourceMappingURL=chunk-CK5NTM2S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/secure-store/cli-handlers.ts","../src/secure-store/cli-renderer.ts","../src/secure-store/passphrase-reader.ts"],"sourcesContent":["/**\n * Pure handlers behind the `remnic secure-store {init,unlock,lock,\n * status,migrate,disable}` CLI surface (issue #690 PR 2/4 + #779/#780).\n *\n * Each handler:\n * - takes an explicit `memoryDir` (already `~`-expanded by the CLI),\n * - takes an injectable passphrase reader (so tests don't need a\n * real TTY and never touch real readline state),\n * - returns a structured report (no `console.log` inside),\n * - never logs the passphrase or any secret material.\n *\n * The actual `console.log` formatting lives in `cli-renderer.ts` so\n * tests can assert on the report shape without parsing text.\n */\n\nimport { generateSalt as generateEnvelopeSalt } from \"./cipher.js\";\nimport {\n buildHeaderFromPassphrase,\n deriveKeyFromHeader,\n headerPath,\n readHeader,\n secureStoreDir,\n verifyKey,\n writeHeader,\n type SecureStoreHeader,\n} from \"./header.js\";\nimport * as keyring from \"./keyring.js\";\nimport {\n DEFAULT_ARGON2ID_PARAMS,\n DEFAULT_SCRYPT_PARAMS,\n KDF_SALT_LENGTH,\n type Argon2idParams,\n type KdfAlgorithm,\n type ScryptParams,\n} from \"./kdf.js\";\nimport {\n decryptMemoryDirToPlaintext,\n migrateMemoryDirToEncrypted,\n type DecryptResult,\n type MigrateResult,\n} from \"./secure-fs.js\";\n\n/** Passphrase source — async so callers can read from a TTY without echo. */\nexport type PassphraseReader = (\n prompt: string,\n options?: { confirm?: boolean },\n) => Promise<string>;\n\n/** Common options accepted by every handler. */\nexport interface SecureStoreHandlerCommon {\n memoryDir: string;\n /**\n * Stable identifier for the in-memory keyring entry. Defaults to\n * the secure-store directory under `memoryDir`. Tests override\n * this to keep entries from leaking across cases.\n */\n keyringId?: string;\n /** Optional clock injection for deterministic tests. */\n now?: () => Date;\n}\n\n// ─── init ─────────────────────────────────────────────────────────────\n\nexport interface SecureStoreInitOptions extends SecureStoreHandlerCommon {\n /** Passphrase reader — called twice (entry + confirmation). */\n readPassphrase: PassphraseReader;\n /**\n * KDF algorithm. Defaults to `\"argon2id\"` for new stores.\n * `\"scrypt\"` remains supported for explicit compatibility cases.\n */\n algorithm?: KdfAlgorithm;\n /** KDF parameter override; defaults to OWASP-acceptable params for the selected KDF. */\n params?: ScryptParams | Argon2idParams;\n /** Pre-generated salt for tests; production callers should omit. */\n salt?: Buffer;\n /** Optional human-readable note recorded in metadata. Never persist secrets. */\n note?: string;\n}\n\nexport interface SecureStoreInitReport {\n ok: true;\n /** Absolute path of the header file that was written. */\n headerPath: string;\n /** Algorithm + params used for the master key derivation. */\n kdf: SecureStoreHeader[\"metadata\"][\"kdf\"];\n /** ISO-8601 timestamp recorded in the header. */\n createdAt: string;\n}\n\n/**\n * Initialize a new secure-store header. Refuses to overwrite an\n * existing header (use `header.ts:writeHeader` directly with explicit\n * intent if you need to reinitialize a destroyed store).\n */\nexport async function runSecureStoreInit(\n options: SecureStoreInitOptions,\n): Promise<SecureStoreInitReport> {\n const { memoryDir, readPassphrase } = options;\n if (typeof memoryDir !== \"string\" || memoryDir.length === 0) {\n throw new Error(\"secure-store init: memoryDir is required\");\n }\n // Fail fast if a header already exists, before we waste KDF time.\n const existing = await readHeader(memoryDir);\n if (existing !== null) {\n throw new Error(\n `secure-store header already exists at ${headerPath(memoryDir)}. Run 'remnic secure-store status' to inspect, or remove the .secure-store directory explicitly to reinitialize.`,\n );\n }\n const passphrase = await readPassphrase(\"Enter new passphrase: \", { confirm: true });\n validatePassphrase(passphrase);\n\n const algorithm: KdfAlgorithm = options.algorithm ?? \"argon2id\";\n const params = resolveParams(algorithm, options.params);\n const salt = options.salt ?? generateEnvelopeSalt();\n if (salt.length !== KDF_SALT_LENGTH) {\n throw new Error(`salt must be ${KDF_SALT_LENGTH} bytes, got ${salt.length}`);\n }\n\n const built = buildHeaderFromPassphrase({\n passphrase,\n salt,\n algorithm,\n params,\n ...(options.note !== undefined ? { note: options.note } : {}),\n ...(options.now ? { createdAt: options.now().toISOString() } : {}),\n });\n // Zero the derived key — init does NOT auto-unlock; the operator\n // must run `unlock` separately. This mirrors GnuPG-style hygiene\n // and keeps `init` safe to run from automation that should never\n // hold the master key in memory.\n built.derivedKey.fill(0);\n\n const writtenPath = await writeHeader(memoryDir, built.header);\n return {\n ok: true,\n headerPath: writtenPath,\n kdf: built.header.metadata.kdf,\n createdAt: built.header.createdAt,\n };\n}\n\n// ─── unlock ───────────────────────────────────────────────────────────\n\nexport interface SecureStoreUnlockOptions extends SecureStoreHandlerCommon {\n readPassphrase: PassphraseReader;\n}\n\nexport type SecureStoreUnlockReport =\n | { ok: true; unlockedAt: string; algorithm: KdfAlgorithm }\n | { ok: false; reason: \"not-initialized\" | \"wrong-passphrase\" };\n\nexport async function runSecureStoreUnlock(\n options: SecureStoreUnlockOptions,\n): Promise<SecureStoreUnlockReport> {\n const { memoryDir, readPassphrase } = options;\n const header = await readHeader(memoryDir);\n if (!header) {\n return { ok: false, reason: \"not-initialized\" };\n }\n const passphrase = await readPassphrase(\"Enter passphrase: \");\n validatePassphrase(passphrase);\n const candidateKey = deriveKeyFromHeader(header, passphrase);\n if (!verifyKey(header, candidateKey)) {\n candidateKey.fill(0);\n return { ok: false, reason: \"wrong-passphrase\" };\n }\n const id = options.keyringId ?? secureStoreDir(memoryDir);\n const now = options.now ?? (() => new Date());\n keyring.unlock(id, candidateKey, now);\n const status = keyring.status(id);\n return {\n ok: true,\n unlockedAt: status.unlockedAt ?? now().toISOString(),\n algorithm: header.metadata.kdf.algorithm,\n };\n}\n\n// ─── lock ─────────────────────────────────────────────────────────────\n\nexport interface SecureStoreLockOptions extends SecureStoreHandlerCommon {}\n\nexport interface SecureStoreLockReport {\n ok: true;\n /** True if a key was registered and is now cleared; false if it was already locked. */\n cleared: boolean;\n}\n\nexport function runSecureStoreLock(options: SecureStoreLockOptions): SecureStoreLockReport {\n const id = options.keyringId ?? secureStoreDir(options.memoryDir);\n const cleared = keyring.lock(id);\n return { ok: true, cleared };\n}\n\n// ─── migrate ─────────────────────────────────────────────────────────\n\nexport interface SecureStoreMigrateOptions extends SecureStoreHandlerCommon {}\n\nexport type SecureStoreMigrateReport =\n | ({ ok: true } & MigrateResult)\n | ({\n ok: false;\n reason: \"not-initialized\" | \"locked\" | \"file-errors\";\n } & MigrateResult);\n\nexport async function runSecureStoreMigrate(\n options: SecureStoreMigrateOptions,\n): Promise<SecureStoreMigrateReport> {\n const { memoryDir } = options;\n const header = await readHeader(memoryDir);\n if (!header) {\n return {\n ok: false,\n reason: \"not-initialized\",\n encrypted: 0,\n skipped: 0,\n errors: [],\n };\n }\n\n const id = options.keyringId ?? secureStoreDir(memoryDir);\n const key = keyring.getKey(id);\n if (key === null) {\n return {\n ok: false,\n reason: \"locked\",\n encrypted: 0,\n skipped: 0,\n errors: [],\n };\n }\n\n const result = await migrateMemoryDirToEncrypted(memoryDir, key);\n if (result.errors.length > 0) {\n return { ok: false, reason: \"file-errors\", ...result };\n }\n return { ok: true, ...result };\n}\n\n// ─── disable/decrypt ─────────────────────────────────────────────────\n\nexport interface SecureStoreDisableOptions extends SecureStoreHandlerCommon {}\n\nexport type SecureStoreDisableReport =\n | ({ ok: true } & DecryptResult)\n | ({\n ok: false;\n reason: \"not-initialized\" | \"locked\" | \"file-errors\";\n } & DecryptResult);\n\nexport async function runSecureStoreDisable(\n options: SecureStoreDisableOptions,\n): Promise<SecureStoreDisableReport> {\n const { memoryDir } = options;\n const header = await readHeader(memoryDir);\n if (!header) {\n return {\n ok: false,\n reason: \"not-initialized\",\n decrypted: 0,\n skipped: 0,\n errors: [],\n };\n }\n\n const id = options.keyringId ?? secureStoreDir(memoryDir);\n const key = keyring.getKey(id);\n if (key === null) {\n return {\n ok: false,\n reason: \"locked\",\n decrypted: 0,\n skipped: 0,\n errors: [],\n };\n }\n\n const result = await decryptMemoryDirToPlaintext(memoryDir, key);\n if (result.errors.length > 0) {\n return { ok: false, reason: \"file-errors\", ...result };\n }\n return { ok: true, ...result };\n}\n\n// ─── status ───────────────────────────────────────────────────────────\n\nexport interface SecureStoreStatusOptions extends SecureStoreHandlerCommon {}\n\nexport interface SecureStoreStatusReport {\n /** True iff a header file exists in `<memoryDir>/.secure-store/`. */\n initialized: boolean;\n /** Path the status check probed. Useful for operators. */\n headerPath: string;\n /** Locked/unlocked state of the in-memory keyring entry. */\n locked: boolean;\n /** ISO-8601 timestamp of the most recent unlock, or null when locked. */\n unlockedAt: string | null;\n /** Header metadata (algorithm + params + salt hex), or null when uninitialized. */\n kdf: SecureStoreHeader[\"metadata\"][\"kdf\"] | null;\n /** Header `createdAt`, or null when uninitialized. */\n createdAt: string | null;\n}\n\nexport async function runSecureStoreStatus(\n options: SecureStoreStatusOptions,\n): Promise<SecureStoreStatusReport> {\n const { memoryDir } = options;\n const id = options.keyringId ?? secureStoreDir(memoryDir);\n const header = await readHeader(memoryDir);\n const ks = keyring.status(id);\n const target = headerPath(memoryDir);\n if (!header) {\n return {\n initialized: false,\n headerPath: target,\n locked: !ks.unlocked,\n unlockedAt: ks.unlockedAt,\n kdf: null,\n createdAt: null,\n };\n }\n return {\n initialized: true,\n headerPath: target,\n locked: !ks.unlocked,\n unlockedAt: ks.unlockedAt,\n kdf: header.metadata.kdf,\n createdAt: header.createdAt,\n };\n}\n\n// ─── helpers ──────────────────────────────────────────────────────────\n\n/** Minimum passphrase length. 8 chars is intentionally permissive — operators may use phrase managers. */\nexport const MIN_PASSPHRASE_LENGTH = 8;\n\nfunction validatePassphrase(passphrase: string): void {\n if (typeof passphrase !== \"string\") {\n throw new Error(\"passphrase must be a string\");\n }\n if (passphrase.length === 0) {\n throw new Error(\"passphrase must not be empty\");\n }\n if (passphrase.length < MIN_PASSPHRASE_LENGTH) {\n throw new Error(`passphrase must be at least ${MIN_PASSPHRASE_LENGTH} characters`);\n }\n}\n\nfunction resolveParams(\n algorithm: KdfAlgorithm,\n override: ScryptParams | Argon2idParams | undefined,\n): ScryptParams | Argon2idParams {\n if (override !== undefined) return override;\n if (algorithm === \"scrypt\") return { ...DEFAULT_SCRYPT_PARAMS };\n return { ...DEFAULT_ARGON2ID_PARAMS };\n}\n","/**\n * Console-text renderers for the `remnic engram secure-store {init,unlock,\n * lock,status,migrate,disable}` CLI surface (issue #690 PR 2/4 + #779/#780).\n *\n * Pure: each `render*` function takes a typed report and returns a\n * string. CLI handlers do the `console.log`. Tests assert on the\n * returned text directly so behavior stays decoupled from stdout.\n */\n\nimport type {\n SecureStoreInitReport,\n SecureStoreLockReport,\n SecureStoreDisableReport,\n SecureStoreMigrateReport,\n SecureStoreStatusReport,\n SecureStoreUnlockReport,\n} from \"./cli-handlers.js\";\nimport type { SecureStoreHeader } from \"./header.js\";\n\nexport function renderInitReport(report: SecureStoreInitReport): string {\n const lines: string[] = [];\n lines.push(\"=== Remnic secure-store initialized ===\");\n lines.push(\"\");\n lines.push(`header: ${report.headerPath}`);\n lines.push(`createdAt: ${report.createdAt}`);\n lines.push(...renderKdfLines(report.kdf));\n lines.push(\"\");\n lines.push(\"Note: init does NOT auto-unlock the store. Run\");\n lines.push(\" remnic engram secure-store unlock\");\n lines.push(\"to register the master key with the running daemon.\");\n return lines.join(\"\\n\");\n}\n\nexport function renderUnlockReport(report: SecureStoreUnlockReport): string {\n if (report.ok) {\n return `OK — secure-store unlocked at ${report.unlockedAt} (algorithm=${report.algorithm}).`;\n }\n if (report.reason === \"not-initialized\") {\n return \"ERR — secure-store is not initialized. Run 'remnic engram secure-store init' first.\";\n }\n return \"ERR — wrong passphrase.\";\n}\n\nexport function renderLockReport(report: SecureStoreLockReport): string {\n if (report.cleared) {\n return \"OK — secure-store key cleared from in-memory keyring.\";\n }\n return \"OK — secure-store was already locked (no in-memory key to clear).\";\n}\n\nexport function renderMigrateReport(report: SecureStoreMigrateReport): string {\n if (!report.ok && report.reason === \"not-initialized\") {\n return \"ERR — secure-store is not initialized. Run 'remnic engram secure-store init' first.\";\n }\n if (!report.ok && report.reason === \"locked\") {\n return \"ERR — secure-store is locked. Run 'remnic engram secure-store unlock' before migrate.\";\n }\n\n const lines: string[] = [];\n lines.push(report.ok ? \"OK — secure-store migration complete.\" : \"ERR — secure-store migration completed with file errors.\");\n lines.push(`encrypted: ${report.encrypted}`);\n lines.push(`skipped: ${report.skipped}`);\n lines.push(`errors: ${report.errors.length}`);\n for (const entry of report.errors.slice(0, 10)) {\n lines.push(`- ${entry.filePath}: ${entry.error}`);\n }\n if (report.errors.length > 10) {\n lines.push(`- ... ${report.errors.length - 10} more error(s)`);\n }\n return lines.join(\"\\n\");\n}\n\nexport function renderDisableReport(report: SecureStoreDisableReport): string {\n if (!report.ok && report.reason === \"not-initialized\") {\n return \"ERR — secure-store is not initialized. Run 'remnic engram secure-store init' first.\";\n }\n if (!report.ok && report.reason === \"locked\") {\n return \"ERR — secure-store is locked. Run 'remnic engram secure-store unlock' before disable.\";\n }\n\n const lines: string[] = [];\n lines.push(report.ok ? \"OK — secure-store disable complete.\" : \"ERR — secure-store disable completed with file errors.\");\n lines.push(`decrypted: ${report.decrypted}`);\n lines.push(`skipped: ${report.skipped}`);\n lines.push(`errors: ${report.errors.length}`);\n for (const entry of report.errors.slice(0, 10)) {\n lines.push(`- ${entry.filePath}: ${entry.error}`);\n }\n if (report.errors.length > 10) {\n lines.push(`- ... ${report.errors.length - 10} more error(s)`);\n }\n lines.push(\"header: kept\");\n return lines.join(\"\\n\");\n}\n\nexport function renderStatusReport(report: SecureStoreStatusReport): string {\n const lines: string[] = [];\n lines.push(\"=== Remnic secure-store status ===\");\n lines.push(\"\");\n lines.push(`header: ${report.headerPath}`);\n lines.push(`initialized: ${report.initialized ? \"yes\" : \"no\"}`);\n if (!report.initialized) {\n lines.push(\"\");\n lines.push(\"Run 'remnic engram secure-store init' to initialize a new store.\");\n return lines.join(\"\\n\");\n }\n lines.push(`createdAt: ${report.createdAt ?? \"n/a\"}`);\n lines.push(`locked: ${report.locked ? \"yes\" : \"no\"}`);\n if (!report.locked) {\n lines.push(`lastUnlockAt: ${report.unlockedAt ?? \"n/a\"}`);\n }\n if (report.kdf) {\n lines.push(...renderKdfLines(report.kdf));\n }\n return lines.join(\"\\n\");\n}\n\nfunction renderKdfLines(kdf: SecureStoreHeader[\"metadata\"][\"kdf\"]): string[] {\n const lines: string[] = [];\n lines.push(`kdf.algorithm: ${kdf.algorithm}`);\n if (kdf.algorithm === \"scrypt\") {\n const { N, r, p, keyLength, maxmem } = kdf.params;\n lines.push(`kdf.params: N=${N} r=${r} p=${p} keyLength=${keyLength} maxmem=${maxmem}`);\n } else {\n const { memoryKiB, iterations, parallelism, keyLength } = kdf.params;\n lines.push(\n `kdf.params: memoryKiB=${memoryKiB} iterations=${iterations} parallelism=${parallelism} keyLength=${keyLength}`,\n );\n }\n return lines;\n}\n","/**\n * TTY passphrase reader (issue #690 PR 2/4).\n *\n * Reads a line from stdin without echoing it back to the terminal.\n * Disables echo by setting raw mode + manually buffering input until\n * Enter / EOT.\n *\n * Why not `readline.question`?\n * ----------------------------\n * `readline` echoes by default and has no clean \"no-echo\" toggle that\n * survives across Node versions. The raw-mode loop is the canonical\n * idiom for reading passwords on Node and matches what `npm` uses\n * internally.\n *\n * Security\n * --------\n * - Never log the passphrase (no `console.log`, no debug output).\n * - Never include it in a thrown error message.\n * - On Ctrl+C / Ctrl+D, abort with a clear error rather than\n * silently treating EOF as an empty submission.\n * - On non-TTY stdin (pipe, redirect), read a line via line-buffered\n * readline so automation (`echo \"passphrase\" | remnic ...`) works.\n * Operators are responsible for not piping plaintext passphrases\n * in shell history; we surface a stderr warning.\n */\n\nimport { createInterface } from \"node:readline\";\nimport type { Readable, Writable } from \"node:stream\";\nimport { StringDecoder } from \"node:string_decoder\";\n\nimport type { PassphraseReader } from \"./cli-handlers.js\";\n\nexport interface CreatePassphraseReaderOptions {\n input?: Readable;\n output?: Writable;\n /** Override stderr for warning surface; defaults to `process.stderr`. */\n errorStream?: Writable;\n}\n\n/**\n * Build a `PassphraseReader` bound to the given streams. Exported so\n * tests can construct one against in-memory streams without touching\n * the real TTY.\n */\nexport function createPassphraseReader(\n options: CreatePassphraseReaderOptions = {},\n): PassphraseReader {\n const input = options.input ?? process.stdin;\n const output = options.output ?? process.stdout;\n const errorStream = options.errorStream ?? process.stderr;\n // Codex/Cursor on PR #737: a fresh readline interface per call\n // breaks confirm-mode on piped non-TTY input — the first\n // `createInterface` consumes the entire prebuffered stream\n // (including the second line), so the second `createInterface`\n // sees an already-ended stream and resolves to \"\". Fix: maintain\n // ONE non-TTY line reader across both reads of a confirm-mode\n // session and pull lines on demand from a buffered queue.\n let nonTtyReader: NonTtyLineReader | null = null;\n let nonTtyWarned = false;\n return async function readPassphrase(\n prompt: string,\n readerOptions?: { confirm?: boolean },\n ): Promise<string> {\n const first = await readSinglePassphrase(prompt);\n if (readerOptions?.confirm) {\n const second = await readSinglePassphrase(\"Confirm passphrase: \");\n if (first !== second) {\n throw new Error(\"passphrases did not match\");\n }\n }\n return first;\n };\n\n async function readSinglePassphrase(prompt: string): Promise<string> {\n const inputAsAny = input as Readable & {\n isTTY?: boolean;\n setRawMode?: (raw: boolean) => Readable;\n };\n if (inputAsAny.isTTY && typeof inputAsAny.setRawMode === \"function\") {\n return readNoEcho(prompt, inputAsAny, output);\n }\n // Non-TTY: line-buffered fallback. Warn once per reader so\n // operators piping plaintext passphrases in shell pipelines are\n // aware their history may contain the secret.\n if (!nonTtyWarned) {\n errorStream.write(\n \"[remnic secure-store] warning: stdin is not a TTY; reading passphrase as a plain line. \" +\n \"Take care that the passphrase is not exposed in shell history.\\n\",\n );\n nonTtyWarned = true;\n }\n // Codex P1 on PR #737: write the prompt to stderr, not stdout.\n // When the surrounding command outputs JSON to stdout (e.g.\n // `remnic secure-store status --json`), injecting prompt text on\n // stdout corrupts the JSON output and breaks machine consumers.\n // The prompt is UI noise — it belongs on the error/diagnostics\n // stream regardless of whether we're in a TTY.\n errorStream.write(prompt);\n if (!nonTtyReader) nonTtyReader = createNonTtyLineReader(input);\n return nonTtyReader.next();\n }\n}\n\nfunction readNoEcho(\n prompt: string,\n input: Readable & { setRawMode?: (raw: boolean) => Readable },\n output: Writable,\n): Promise<string> {\n return new Promise((resolve, reject) => {\n output.write(prompt);\n let buffer = \"\";\n let settled = false;\n const wasRaw = (input as Readable & { isRaw?: boolean }).isRaw === true;\n // Codex P2 on PR #737: per-chunk `chunk.toString(\"utf8\")` corrupts\n // multibyte characters that straddle a chunk boundary (Node inserts\n // U+FFFD replacement characters for incomplete sequences). Use a\n // StringDecoder, which buffers partial sequences across chunks so\n // non-ASCII passphrases survive intact.\n const decoder = new StringDecoder(\"utf8\");\n if (input.setRawMode) input.setRawMode(true);\n input.resume();\n const cleanup = (): void => {\n input.pause();\n input.removeListener(\"data\", onData);\n // Flush any remaining bytes the decoder is holding so trailing\n // partial sequences are surfaced rather than silently swallowed.\n decoder.end();\n // Restore the prior raw-mode state so we don't strand the parent shell\n // in an unexpected configuration.\n if (input.setRawMode) input.setRawMode(wasRaw);\n output.write(\"\\n\");\n };\n const onData = (chunk: Buffer): void => {\n const str = decoder.write(chunk);\n for (const ch of str) {\n if (settled) return;\n const code = ch.charCodeAt(0);\n // Enter / newline: submit.\n if (ch === \"\\n\" || ch === \"\\r\") {\n settled = true;\n cleanup();\n resolve(buffer);\n return;\n }\n // Ctrl+C: abort.\n if (code === 0x03) {\n settled = true;\n cleanup();\n reject(new Error(\"passphrase entry aborted (Ctrl+C)\"));\n return;\n }\n // Ctrl+D / EOT: treat as abort if buffer is empty, else submit.\n if (code === 0x04) {\n settled = true;\n cleanup();\n if (buffer.length === 0) {\n reject(new Error(\"passphrase entry aborted (EOF)\"));\n } else {\n resolve(buffer);\n }\n return;\n }\n // Backspace / DEL.\n // Cursor on PR #737: `buffer.slice(0, -1)` deletes one UTF-16\n // code unit, which splits a surrogate pair when the last\n // character is a non-BMP code point (emoji, etc.). Fix: count\n // code points with `Array.from` and remove the last one. This\n // correctly handles both BMP (single code unit) and non-BMP\n // (surrogate pair) characters atomically.\n if (code === 0x08 || code === 0x7f) {\n if (buffer.length > 0) {\n const codePoints = Array.from(buffer);\n buffer = codePoints.slice(0, -1).join(\"\");\n }\n continue;\n }\n // Ignore other control bytes (escape sequences, etc.).\n if (code < 0x20) {\n continue;\n }\n buffer += ch;\n }\n };\n input.on(\"data\", onData);\n });\n}\n\n/**\n * One-shot line reader bound to a non-TTY input stream.\n *\n * Cursor medium on PR #737: a previous version constructed a fresh\n * `readline.createInterface` per `next()` call. On piped non-TTY\n * input, the first interface consumed the entire prebuffered stream\n * (including any subsequent lines) into its internal buffer. The\n * second interface saw an already-`end()`'d input and resolved to \"\".\n * Fix: construct ONE readline interface, queue every emitted `line`,\n * and let `next()` either return a queued line or wait for the next\n * one. Pending waiters at `close` time are resolved with \"\" (so an\n * abandoned-stream caller still sees a clean empty response).\n */\ninterface NonTtyLineReader {\n next(): Promise<string>;\n}\n\nfunction createNonTtyLineReader(input: Readable): NonTtyLineReader {\n const rl = createInterface({ input, terminal: false });\n const lineQueue: string[] = [];\n const waiterQueue: Array<(value: string) => void> = [];\n const errorQueue: Array<(err: Error) => void> = [];\n let closed = false;\n let error: Error | null = null;\n\n rl.on(\"line\", (line: string) => {\n const waiter = waiterQueue.shift();\n if (waiter) {\n waiter(line);\n } else {\n lineQueue.push(line);\n }\n });\n rl.on(\"close\", () => {\n closed = true;\n while (waiterQueue.length > 0) {\n const w = waiterQueue.shift()!;\n // Drop the matching error slot since we're settling cleanly.\n errorQueue.shift();\n w(\"\");\n }\n });\n rl.on(\"error\", (err: Error) => {\n error = err;\n while (errorQueue.length > 0) {\n const r = errorQueue.shift()!;\n // Drop the matching value slot.\n waiterQueue.shift();\n r(err);\n }\n });\n\n return {\n next(): Promise<string> {\n if (error) return Promise.reject(error);\n const queued = lineQueue.shift();\n if (queued !== undefined) return Promise.resolve(queued);\n if (closed) return Promise.resolve(\"\");\n return new Promise<string>((resolve, reject) => {\n waiterQueue.push(resolve);\n errorQueue.push(reject);\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,eAAsB,mBACpB,SACgC;AAChC,QAAM,EAAE,WAAW,eAAe,IAAI;AACtC,MAAI,OAAO,cAAc,YAAY,UAAU,WAAW,GAAG;AAC3D,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AAEA,Q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KAAG,GAAG,SAAS,CAAC,QAAe;AAC7B,YAAQ;AACR,WAAO,WAAW,SAAS,GAAG;AAC5B,YAAM,IAAI,WAAW,MAAM;AAE3B,kBAAY,MAAM;AAClB,QAAE,GAAG;AAAA,IACP;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,OAAwB;AACtB,UAAI,MAAO,QAAO,QAAQ,OAAO,KAAK;AACtC,YAAM,SAAS,UAAU,MAAM;AAC/B,UAAI,WAAW,OAAW,QAAO,QAAQ,QAAQ,MAAM;AACvD,UAAI,OAAQ,QAAO,QAAQ,QAAQ,EAAE;AACrC,aAAO,IAAI,QAAgB,CAAC,SAAS,WAAW;AAC9C,oBAAY,KAAK,OAAO;AACxB,mBAAW,KAAK,MAAM;AAAA,MACxB,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["status"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGatewayRuntimeAuthForModel,
|
|
3
3
|
resolveProviderApiKey
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q7FJ5ZHM.js";
|
|
5
5
|
import {
|
|
6
6
|
loadModelsJsonProviders
|
|
7
7
|
} from "./chunk-ODWDQNRE.js";
|
|
@@ -458,4 +458,4 @@ function extractResponsesOutputText(data) {
|
|
|
458
458
|
export {
|
|
459
459
|
FallbackLlmClient
|
|
460
460
|
};
|
|
461
|
-
//# sourceMappingURL=chunk-
|
|
461
|
+
//# sourceMappingURL=chunk-CRU27Q4J.js.map
|