@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
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngramMcpServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XRCYKJ3V.js";
|
|
4
4
|
import {
|
|
5
5
|
EngramAccessInputError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AEMBDV7M.js";
|
|
7
7
|
import {
|
|
8
8
|
isTrustZoneName
|
|
9
9
|
} from "./chunk-EQINRHYR.js";
|
|
10
|
+
import {
|
|
11
|
+
expandTildePath
|
|
12
|
+
} from "./chunk-IXEJRKCZ.js";
|
|
13
|
+
import {
|
|
14
|
+
subscribeGraphEvents
|
|
15
|
+
} from "./chunk-WIICJPET.js";
|
|
16
|
+
import {
|
|
17
|
+
isRecallDisclosure
|
|
18
|
+
} from "./chunk-43EKP2UK.js";
|
|
10
19
|
import {
|
|
11
20
|
log
|
|
12
21
|
} from "./chunk-2ODBA7MQ.js";
|
|
13
22
|
import {
|
|
14
23
|
validateRequest
|
|
15
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RILIVK4O.js";
|
|
16
25
|
|
|
17
26
|
// src/access-http.ts
|
|
18
27
|
import { createServer } from "http";
|
|
@@ -156,9 +165,14 @@ var AdapterRegistry = class {
|
|
|
156
165
|
|
|
157
166
|
// src/access-http.ts
|
|
158
167
|
function resolveDefaultAdminConsolePublicDir() {
|
|
168
|
+
const thisDir = path.dirname(fileURLToPath(import.meta.url));
|
|
159
169
|
const candidates = [
|
|
160
|
-
|
|
161
|
-
|
|
170
|
+
// Standard: admin-console sibling to src/ (development layout)
|
|
171
|
+
path.resolve(thisDir, "../admin-console/public"),
|
|
172
|
+
// Bundled: admin-console inside dist/ alongside the bundle
|
|
173
|
+
path.resolve(thisDir, "./admin-console/public"),
|
|
174
|
+
// Package root: walk up from dist/ to the package root
|
|
175
|
+
path.resolve(thisDir, "../../admin-console/public")
|
|
162
176
|
];
|
|
163
177
|
return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
|
|
164
178
|
}
|
|
@@ -206,6 +220,13 @@ function parseTrustZoneFilter(raw) {
|
|
|
206
220
|
}
|
|
207
221
|
throw new HttpError(400, "zone must be one of quarantine|working|trusted", "invalid_zone_filter");
|
|
208
222
|
}
|
|
223
|
+
function decodePeerIdSegment(raw) {
|
|
224
|
+
try {
|
|
225
|
+
return decodeURIComponent(raw);
|
|
226
|
+
} catch {
|
|
227
|
+
throw new EngramAccessInputError("peerId path segment is not valid percent-encoded input");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
209
230
|
var EngramAccessHttpServer = class {
|
|
210
231
|
service;
|
|
211
232
|
host;
|
|
@@ -223,6 +244,18 @@ var EngramAccessHttpServer = class {
|
|
|
223
244
|
mcpServer;
|
|
224
245
|
server = null;
|
|
225
246
|
boundPort = 0;
|
|
247
|
+
/** Active SSE response objects for /engram/v1/graph/events. */
|
|
248
|
+
sseClients = /* @__PURE__ */ new Set();
|
|
249
|
+
/** Throttle batch: pending SSE event batches per client. */
|
|
250
|
+
sseBatchTimers = /* @__PURE__ */ new Map();
|
|
251
|
+
ssePendingBatches = /* @__PURE__ */ new Map();
|
|
252
|
+
/**
|
|
253
|
+
* Per-client cleanup callbacks: clear heartbeat interval, flush timer,
|
|
254
|
+
* unsubscribe from bus, and end the response. Stored here so `stop()`
|
|
255
|
+
* can invoke them even when the client hasn't disconnected yet
|
|
256
|
+
* (Cursor review thread `access-http.ts:232`).
|
|
257
|
+
*/
|
|
258
|
+
sseCleanupFns = /* @__PURE__ */ new Set();
|
|
226
259
|
constructor(options) {
|
|
227
260
|
this.service = options.service;
|
|
228
261
|
this.host = options.host?.trim() || "127.0.0.1";
|
|
@@ -298,6 +331,25 @@ var EngramAccessHttpServer = class {
|
|
|
298
331
|
const server = this.server;
|
|
299
332
|
this.server = null;
|
|
300
333
|
this.boundPort = 0;
|
|
334
|
+
for (const cleanup of this.sseCleanupFns) {
|
|
335
|
+
try {
|
|
336
|
+
cleanup();
|
|
337
|
+
} catch {
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
this.sseCleanupFns.clear();
|
|
341
|
+
for (const [res, timer] of this.sseBatchTimers.entries()) {
|
|
342
|
+
clearTimeout(timer);
|
|
343
|
+
this.sseBatchTimers.delete(res);
|
|
344
|
+
}
|
|
345
|
+
this.ssePendingBatches.clear();
|
|
346
|
+
for (const res of this.sseClients) {
|
|
347
|
+
try {
|
|
348
|
+
res.end();
|
|
349
|
+
} catch {
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
this.sseClients.clear();
|
|
301
353
|
await new Promise((resolve, reject) => {
|
|
302
354
|
server.close((err) => err ? reject(err) : resolve());
|
|
303
355
|
});
|
|
@@ -367,13 +419,37 @@ var EngramAccessHttpServer = class {
|
|
|
367
419
|
resolveNamespace(_req, bodyNamespace) {
|
|
368
420
|
return bodyNamespace || void 0;
|
|
369
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* Resolve the recall disclosure depth from the request (issue #677 PR
|
|
424
|
+
* 2/4). Explicit body value wins; otherwise we accept a
|
|
425
|
+
* `?disclosure=...` query parameter so curl/browser tooling can use the
|
|
426
|
+
* three-tier surface without rewriting JSON. Invalid query values
|
|
427
|
+
* throw `EngramAccessInputError` (CLAUDE.md rule 51 — no silent
|
|
428
|
+
* fallback). An absent body field AND an absent query param yields
|
|
429
|
+
* `undefined`, which the service maps to `DEFAULT_RECALL_DISCLOSURE`.
|
|
430
|
+
*/
|
|
431
|
+
resolveRecallDisclosure(bodyDisclosure, parsed) {
|
|
432
|
+
if (bodyDisclosure !== void 0) {
|
|
433
|
+
return bodyDisclosure;
|
|
434
|
+
}
|
|
435
|
+
const queryDisclosure = parsed.searchParams.get("disclosure");
|
|
436
|
+
if (queryDisclosure === null) {
|
|
437
|
+
return void 0;
|
|
438
|
+
}
|
|
439
|
+
if (!isRecallDisclosure(queryDisclosure)) {
|
|
440
|
+
throw new EngramAccessInputError(
|
|
441
|
+
`disclosure must be one of: chunk, section, raw (got: ${queryDisclosure})`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
return queryDisclosure;
|
|
445
|
+
}
|
|
370
446
|
async handle(req, res, correlationId) {
|
|
371
447
|
const parsed = new URL(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
|
|
372
448
|
const pathname = parsed.pathname;
|
|
373
449
|
if (this.adminConsoleEnabled && await this.handleAdminConsole(req, res, pathname)) {
|
|
374
450
|
return;
|
|
375
451
|
}
|
|
376
|
-
if (!this.isAuthorized(req)) {
|
|
452
|
+
if (!this.isAuthorized(req, pathname)) {
|
|
377
453
|
const body = JSON.stringify({ error: "unauthorized", code: "unauthorized" });
|
|
378
454
|
res.writeHead(401, {
|
|
379
455
|
"content-type": "application/json; charset=utf-8",
|
|
@@ -403,6 +479,45 @@ var EngramAccessHttpServer = class {
|
|
|
403
479
|
if (req.method === "POST" && pathname === "/engram/v1/recall") {
|
|
404
480
|
const body = await this.readValidatedBody(req, "recall");
|
|
405
481
|
const codingContext = "codingContext" in body ? body.codingContext : void 0;
|
|
482
|
+
const disclosure = this.resolveRecallDisclosure(body.disclosure, parsed);
|
|
483
|
+
const asOfQueryRaw = parsed.searchParams.get("as_of");
|
|
484
|
+
const bodyHasAsOf = typeof body.asOf === "string" && body.asOf.length > 0;
|
|
485
|
+
if (!bodyHasAsOf && asOfQueryRaw !== null && asOfQueryRaw.length === 0) {
|
|
486
|
+
throw new EngramAccessInputError(
|
|
487
|
+
"as_of must be a non-empty timestamp (got empty value)"
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
const asOf = body.asOf ?? (asOfQueryRaw !== null && asOfQueryRaw.length > 0 ? asOfQueryRaw : void 0);
|
|
491
|
+
const bodyHasTagsField = body !== null && typeof body === "object" && "tags" in body;
|
|
492
|
+
const bodyTagsValue = bodyHasTagsField ? body.tags : void 0;
|
|
493
|
+
const bodyTags = Array.isArray(bodyTagsValue) ? bodyTagsValue : void 0;
|
|
494
|
+
const queryTags = parsed.searchParams.getAll("tag");
|
|
495
|
+
const tags = bodyHasTagsField ? bodyTags : queryTags.length > 0 ? queryTags : void 0;
|
|
496
|
+
const bodyTagMatch = body.tagMatch;
|
|
497
|
+
let tagMatch;
|
|
498
|
+
if (bodyTagMatch !== void 0) {
|
|
499
|
+
if (bodyTagMatch === "any" || bodyTagMatch === "all") {
|
|
500
|
+
tagMatch = bodyTagMatch;
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
const queryTagMatch = parsed.searchParams.get("tag_match");
|
|
504
|
+
if (queryTagMatch !== null) {
|
|
505
|
+
if (queryTagMatch !== "any" && queryTagMatch !== "all") {
|
|
506
|
+
throw new EngramAccessInputError(
|
|
507
|
+
`tag_match must be one of: any, all (got: ${queryTagMatch})`
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
tagMatch = queryTagMatch;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
const bodyIncludeLowConfidence = body.includeLowConfidence;
|
|
514
|
+
const queryIncludeLowConfidence = parsed.searchParams.get("include_low_confidence");
|
|
515
|
+
if (bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence !== null && queryIncludeLowConfidence !== "true" && queryIncludeLowConfidence !== "false") {
|
|
516
|
+
throw new EngramAccessInputError(
|
|
517
|
+
`include_low_confidence must be one of: true, false (got: ${queryIncludeLowConfidence})`
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
const includeLowConfidence = bodyIncludeLowConfidence === true || bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence === "true";
|
|
406
521
|
const response = await this.service.recall({
|
|
407
522
|
query: body.query ?? "",
|
|
408
523
|
sessionKey: body.sessionKey,
|
|
@@ -410,7 +525,18 @@ var EngramAccessHttpServer = class {
|
|
|
410
525
|
topK: body.topK,
|
|
411
526
|
mode: body.mode,
|
|
412
527
|
includeDebug: body.includeDebug === true,
|
|
413
|
-
|
|
528
|
+
// Forward the validated disclosure depth to the service layer
|
|
529
|
+
// (issue #677). The zod schema accepts/rejects body values;
|
|
530
|
+
// `resolveRecallDisclosure()` validates the query-param fallback.
|
|
531
|
+
disclosure,
|
|
532
|
+
codingContext,
|
|
533
|
+
// Forward cwd/projectTag for auto git-context resolution (issue #569).
|
|
534
|
+
cwd: body.cwd,
|
|
535
|
+
projectTag: body.projectTag,
|
|
536
|
+
...asOf !== void 0 ? { asOf } : {},
|
|
537
|
+
...tags !== void 0 ? { tags } : {},
|
|
538
|
+
...tagMatch !== void 0 ? { tagMatch } : {},
|
|
539
|
+
...includeLowConfidence ? { includeLowConfidence: true } : {}
|
|
414
540
|
});
|
|
415
541
|
this.respondJson(res, 200, response);
|
|
416
542
|
return;
|
|
@@ -424,6 +550,36 @@ var EngramAccessHttpServer = class {
|
|
|
424
550
|
this.respondJson(res, 200, { ok: true });
|
|
425
551
|
return;
|
|
426
552
|
}
|
|
553
|
+
if (req.method === "POST" && (pathname === "/engram/v1/capsules/export" || pathname === "/remnic/v1/capsules/export")) {
|
|
554
|
+
const body = await this.readValidatedBody(req, "capsuleExport");
|
|
555
|
+
this.ensureWriteRateLimitAvailable();
|
|
556
|
+
const result = await this.service.capsuleExport({
|
|
557
|
+
name: body.name,
|
|
558
|
+
namespace: this.resolveNamespace(req, body.namespace),
|
|
559
|
+
principal: this.resolveRequestPrincipal(req),
|
|
560
|
+
since: body.since,
|
|
561
|
+
includeKinds: body.includeKinds,
|
|
562
|
+
peerIds: body.peerIds,
|
|
563
|
+
includeTranscripts: body.includeTranscripts,
|
|
564
|
+
encrypt: body.encrypt
|
|
565
|
+
});
|
|
566
|
+
this.recordWriteRateLimitHit();
|
|
567
|
+
this.respondJson(res, 200, result);
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (req.method === "POST" && (pathname === "/engram/v1/capsules/import" || pathname === "/remnic/v1/capsules/import")) {
|
|
571
|
+
const body = await this.readValidatedBody(req, "capsuleImport");
|
|
572
|
+
this.ensureWriteRateLimitAvailable();
|
|
573
|
+
const result = await this.service.capsuleImport({
|
|
574
|
+
archivePath: expandTildePath(body.archivePath),
|
|
575
|
+
namespace: this.resolveNamespace(req, body.namespace),
|
|
576
|
+
principal: this.resolveRequestPrincipal(req),
|
|
577
|
+
mode: body.mode
|
|
578
|
+
});
|
|
579
|
+
this.recordWriteRateLimitHit();
|
|
580
|
+
this.respondJson(res, 200, result);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
427
583
|
if (req.method === "POST" && pathname === "/engram/v1/recall/explain") {
|
|
428
584
|
const body = await this.readValidatedBody(req, "recallExplain");
|
|
429
585
|
const response = await this.service.recallExplain({
|
|
@@ -480,6 +636,19 @@ var EngramAccessHttpServer = class {
|
|
|
480
636
|
}
|
|
481
637
|
budget = parsedBudget;
|
|
482
638
|
}
|
|
639
|
+
const disclosureParam = parsed.searchParams.get("disclosure");
|
|
640
|
+
let disclosure;
|
|
641
|
+
if (disclosureParam !== null && disclosureParam.length > 0) {
|
|
642
|
+
if (!isRecallDisclosure(disclosureParam)) {
|
|
643
|
+
this.respondJson(res, 400, {
|
|
644
|
+
error: "invalid_disclosure",
|
|
645
|
+
code: "invalid_disclosure",
|
|
646
|
+
message: "disclosure must be one of: chunk, section, raw"
|
|
647
|
+
});
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
disclosure = disclosureParam;
|
|
651
|
+
}
|
|
483
652
|
let payload;
|
|
484
653
|
try {
|
|
485
654
|
payload = await this.service.recallXray({
|
|
@@ -487,7 +656,8 @@ var EngramAccessHttpServer = class {
|
|
|
487
656
|
sessionKey,
|
|
488
657
|
namespace,
|
|
489
658
|
budget,
|
|
490
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
659
|
+
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
660
|
+
...disclosure !== void 0 ? { disclosure } : {}
|
|
491
661
|
});
|
|
492
662
|
} catch (err) {
|
|
493
663
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -512,7 +682,10 @@ var EngramAccessHttpServer = class {
|
|
|
512
682
|
messages: body.messages,
|
|
513
683
|
namespace: this.resolveNamespace(req, body.namespace),
|
|
514
684
|
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
515
|
-
skipExtraction: body.skipExtraction === true
|
|
685
|
+
skipExtraction: body.skipExtraction === true,
|
|
686
|
+
// Forward cwd/projectTag for auto git-context resolution (issue #569).
|
|
687
|
+
cwd: body.cwd,
|
|
688
|
+
projectTag: body.projectTag
|
|
516
689
|
});
|
|
517
690
|
this.recordWriteRateLimitHit();
|
|
518
691
|
this.respondJson(res, 202, response);
|
|
@@ -827,7 +1000,7 @@ var EngramAccessHttpServer = class {
|
|
|
827
1000
|
}
|
|
828
1001
|
const namespace = parsed.searchParams.get("namespace") ?? void 0;
|
|
829
1002
|
const limitRaw = parseInt(parsed.searchParams.get("limit") ?? "50", 10);
|
|
830
|
-
const { listPairs } = await import("./contradiction-review-
|
|
1003
|
+
const { listPairs } = await import("./contradiction-review-5LTTVDQV.js");
|
|
831
1004
|
const result = listPairs(this.service.memoryDir, {
|
|
832
1005
|
filter: rawFilter,
|
|
833
1006
|
namespace,
|
|
@@ -838,7 +1011,7 @@ var EngramAccessHttpServer = class {
|
|
|
838
1011
|
}
|
|
839
1012
|
if (req.method === "GET" && pathname.startsWith("/engram/v1/review/contradictions/")) {
|
|
840
1013
|
const pairId = pathname.split("/").pop() ?? "";
|
|
841
|
-
const { readPair } = await import("./contradiction-review-
|
|
1014
|
+
const { readPair } = await import("./contradiction-review-5LTTVDQV.js");
|
|
842
1015
|
const pair = readPair(this.service.memoryDir, pairId);
|
|
843
1016
|
if (!pair) {
|
|
844
1017
|
this.respondJson(res, 404, { error: "pair_not_found" });
|
|
@@ -855,7 +1028,7 @@ var EngramAccessHttpServer = class {
|
|
|
855
1028
|
this.respondJson(res, 400, { error: "pairId and verb are required" });
|
|
856
1029
|
return;
|
|
857
1030
|
}
|
|
858
|
-
const { isValidResolutionVerb, executeResolution } = await import("./resolution-
|
|
1031
|
+
const { isValidResolutionVerb, executeResolution } = await import("./resolution-YGIBORXI.js");
|
|
859
1032
|
if (!isValidResolutionVerb(verb)) {
|
|
860
1033
|
this.respondJson(res, 400, { error: `Invalid verb: ${verb}. Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context` });
|
|
861
1034
|
return;
|
|
@@ -864,9 +1037,83 @@ var EngramAccessHttpServer = class {
|
|
|
864
1037
|
this.respondJson(res, 200, result);
|
|
865
1038
|
return;
|
|
866
1039
|
}
|
|
1040
|
+
if (req.method === "GET" && pathname === "/engram/v1/graph/snapshot") {
|
|
1041
|
+
const limitRaw = parsed.searchParams.get("limit");
|
|
1042
|
+
let limit;
|
|
1043
|
+
if (limitRaw !== null && limitRaw.length > 0) {
|
|
1044
|
+
const parsedLimit = Number(limitRaw);
|
|
1045
|
+
if (!Number.isFinite(parsedLimit) || !Number.isInteger(parsedLimit) || parsedLimit <= 0) {
|
|
1046
|
+
this.respondJson(res, 400, {
|
|
1047
|
+
error: "invalid_limit",
|
|
1048
|
+
code: "invalid_limit",
|
|
1049
|
+
message: "limit must be a positive integer"
|
|
1050
|
+
});
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
limit = parsedLimit;
|
|
1054
|
+
}
|
|
1055
|
+
const sinceRaw = parsed.searchParams.get("since");
|
|
1056
|
+
let since;
|
|
1057
|
+
if (sinceRaw !== null && sinceRaw.length > 0) {
|
|
1058
|
+
if (!Number.isFinite(Date.parse(sinceRaw))) {
|
|
1059
|
+
this.respondJson(res, 400, {
|
|
1060
|
+
error: "invalid_since",
|
|
1061
|
+
code: "invalid_since",
|
|
1062
|
+
message: "since must be a parseable ISO timestamp"
|
|
1063
|
+
});
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
since = sinceRaw;
|
|
1067
|
+
}
|
|
1068
|
+
const focusNodeIdRaw = parsed.searchParams.get("focusNodeId");
|
|
1069
|
+
const focusNodeId = focusNodeIdRaw && focusNodeIdRaw.length > 0 ? focusNodeIdRaw : void 0;
|
|
1070
|
+
const categoriesRaw = parsed.searchParams.get("categories");
|
|
1071
|
+
let categories;
|
|
1072
|
+
if (categoriesRaw !== null && categoriesRaw.length > 0) {
|
|
1073
|
+
categories = categoriesRaw.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
|
|
1074
|
+
if (categories.length === 0) {
|
|
1075
|
+
this.respondJson(res, 400, {
|
|
1076
|
+
error: "invalid_categories",
|
|
1077
|
+
code: "invalid_categories",
|
|
1078
|
+
message: "categories must be a comma-separated list with at least one non-empty value"
|
|
1079
|
+
});
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1084
|
+
const namespace = this.resolveNamespace(
|
|
1085
|
+
req,
|
|
1086
|
+
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
1087
|
+
);
|
|
1088
|
+
try {
|
|
1089
|
+
const snapshot = await this.service.graphSnapshot(
|
|
1090
|
+
{
|
|
1091
|
+
namespace,
|
|
1092
|
+
...limit !== void 0 ? { limit } : {},
|
|
1093
|
+
...since !== void 0 ? { since } : {},
|
|
1094
|
+
...focusNodeId !== void 0 ? { focusNodeId } : {},
|
|
1095
|
+
...categories !== void 0 ? { categories } : {}
|
|
1096
|
+
},
|
|
1097
|
+
this.resolveRequestPrincipal(req)
|
|
1098
|
+
);
|
|
1099
|
+
this.respondJson(res, 200, snapshot);
|
|
1100
|
+
} catch (err) {
|
|
1101
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1102
|
+
if (message.startsWith("graphSnapshot:")) {
|
|
1103
|
+
this.respondJson(res, 400, {
|
|
1104
|
+
error: "invalid_request",
|
|
1105
|
+
code: "invalid_request",
|
|
1106
|
+
message
|
|
1107
|
+
});
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
throw err;
|
|
1111
|
+
}
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
867
1114
|
if (req.method === "POST" && pathname === "/engram/v1/contradiction-scan") {
|
|
868
1115
|
const body = await this.readJsonBody(req);
|
|
869
|
-
const { runContradictionScan } = await import("./contradiction-scan-
|
|
1116
|
+
const { runContradictionScan } = await import("./contradiction-scan-3Z6YW7YA.js");
|
|
870
1117
|
const result = await runContradictionScan({
|
|
871
1118
|
storage: this.service.storageRef,
|
|
872
1119
|
config: this.service.configRef,
|
|
@@ -879,12 +1126,245 @@ var EngramAccessHttpServer = class {
|
|
|
879
1126
|
this.respondJson(res, 200, result);
|
|
880
1127
|
return;
|
|
881
1128
|
}
|
|
1129
|
+
if (req.method === "GET" && pathname === "/engram/v1/graph/events") {
|
|
1130
|
+
await this.handleGraphEventsSSE(req, res);
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
if (req.method === "GET" && pathname === "/engram/v1/console/state") {
|
|
1134
|
+
const namespace = parsed.searchParams.get("namespace") ?? void 0;
|
|
1135
|
+
const snapshot = await this.service.consoleState(namespace, this.resolveRequestPrincipal(req));
|
|
1136
|
+
this.respondJson(res, 200, snapshot);
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
if (req.method === "GET" && pathname === "/engram/v1/peers") {
|
|
1140
|
+
const result = await this.service.peerList();
|
|
1141
|
+
this.respondJson(res, 200, result);
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
const peerProfileMatch = /^\/engram\/v1\/peers\/([^/]+)\/profile$/.exec(pathname);
|
|
1145
|
+
if (peerProfileMatch) {
|
|
1146
|
+
if (req.method !== "GET") {
|
|
1147
|
+
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
const peerId = decodePeerIdSegment(peerProfileMatch[1] ?? "");
|
|
1151
|
+
const result = await this.service.peerProfileGet(peerId);
|
|
1152
|
+
if (!result.found) {
|
|
1153
|
+
this.respondJson(res, 404, { error: "peer_profile_not_found", code: "peer_profile_not_found" });
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
this.respondJson(res, 200, result);
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
const peerIdMatch = /^\/engram\/v1\/peers\/([^/]+)$/.exec(pathname);
|
|
1160
|
+
if (peerIdMatch) {
|
|
1161
|
+
const peerId = decodePeerIdSegment(peerIdMatch[1] ?? "");
|
|
1162
|
+
if (req.method === "GET") {
|
|
1163
|
+
const result = await this.service.peerGet(peerId);
|
|
1164
|
+
if (!result.found) {
|
|
1165
|
+
this.respondJson(res, 404, { error: "peer_not_found", code: "peer_not_found" });
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
this.respondJson(res, 200, result);
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
if (req.method === "PUT") {
|
|
1172
|
+
const body = await this.readJsonBody(req);
|
|
1173
|
+
if ("kind" in body && body.kind !== void 0 && typeof body.kind !== "string") {
|
|
1174
|
+
throw new EngramAccessInputError("kind must be a string when provided");
|
|
1175
|
+
}
|
|
1176
|
+
if ("displayName" in body && body.displayName !== void 0 && typeof body.displayName !== "string") {
|
|
1177
|
+
throw new EngramAccessInputError("displayName must be a string when provided");
|
|
1178
|
+
}
|
|
1179
|
+
if ("notes" in body && body.notes !== void 0 && typeof body.notes !== "string") {
|
|
1180
|
+
throw new EngramAccessInputError("notes must be a string when provided");
|
|
1181
|
+
}
|
|
1182
|
+
const result = await this.service.peerSet({
|
|
1183
|
+
id: peerId,
|
|
1184
|
+
kind: typeof body.kind === "string" ? body.kind : void 0,
|
|
1185
|
+
displayName: typeof body.displayName === "string" ? body.displayName : void 0,
|
|
1186
|
+
notes: typeof body.notes === "string" ? body.notes : void 0
|
|
1187
|
+
});
|
|
1188
|
+
this.respondJson(res, result.created ? 201 : 200, result);
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
if (req.method === "DELETE") {
|
|
1192
|
+
const forgetParam = parsed.searchParams.get("forget");
|
|
1193
|
+
if (forgetParam === "true") {
|
|
1194
|
+
const body = await this.readJsonBody(req);
|
|
1195
|
+
const confirm = typeof body.confirm === "string" ? body.confirm : "";
|
|
1196
|
+
if (confirm !== "yes") {
|
|
1197
|
+
this.respondJson(res, 400, {
|
|
1198
|
+
error: "confirm_required",
|
|
1199
|
+
code: "confirm_required",
|
|
1200
|
+
message: "DELETE ?forget=true requires { confirm: 'yes' } in the request body"
|
|
1201
|
+
});
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
const result2 = await this.service.peerForget(peerId, { confirm: "yes" });
|
|
1205
|
+
this.respondJson(res, 200, result2);
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const result = await this.service.peerDelete(peerId);
|
|
1209
|
+
this.respondJson(res, 200, result);
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
if (req.method === "GET" && pathname === "/engram/v1/dreams/status") {
|
|
1216
|
+
const { normalizeDreamsStatusWindowHours } = await import("./dreams-ledger-LR2NBAZE.js");
|
|
1217
|
+
const windowHoursRaw = parsed.searchParams.get("windowHours");
|
|
1218
|
+
let windowHours;
|
|
1219
|
+
try {
|
|
1220
|
+
windowHours = normalizeDreamsStatusWindowHours(
|
|
1221
|
+
windowHoursRaw !== null ? Number(windowHoursRaw) : void 0
|
|
1222
|
+
);
|
|
1223
|
+
} catch {
|
|
1224
|
+
this.respondJson(res, 400, { error: "windowHours must be a positive integer" });
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1228
|
+
const namespace = namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0;
|
|
1229
|
+
const result = await this.service.dreamsStatus({
|
|
1230
|
+
windowHours,
|
|
1231
|
+
namespace,
|
|
1232
|
+
principal: this.resolveRequestPrincipal(req)
|
|
1233
|
+
});
|
|
1234
|
+
this.respondJson(res, 200, result);
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
if (req.method === "POST" && pathname === "/engram/v1/dreams/run") {
|
|
1238
|
+
const body = await this.readJsonBody(req);
|
|
1239
|
+
const VALID_PHASES = ["lightSleep", "rem", "deepSleep"];
|
|
1240
|
+
const phase = typeof body.phase === "string" ? body.phase : void 0;
|
|
1241
|
+
if (!phase || !VALID_PHASES.includes(phase)) {
|
|
1242
|
+
this.respondJson(res, 400, {
|
|
1243
|
+
error: `phase is required and must be one of: ${VALID_PHASES.join(", ")}`
|
|
1244
|
+
});
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
if ("dryRun" in body && body.dryRun !== void 0 && typeof body.dryRun !== "boolean") {
|
|
1248
|
+
this.respondJson(res, 400, {
|
|
1249
|
+
error: "dryRun must be a boolean when provided"
|
|
1250
|
+
});
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
if ("namespace" in body && body.namespace !== void 0 && typeof body.namespace !== "string") {
|
|
1254
|
+
this.respondJson(res, 400, {
|
|
1255
|
+
error: "namespace must be a string when provided"
|
|
1256
|
+
});
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
const dryRun = body.dryRun === true;
|
|
1260
|
+
const namespace = typeof body.namespace === "string" ? body.namespace : void 0;
|
|
1261
|
+
if (!dryRun) {
|
|
1262
|
+
this.ensureWriteRateLimitAvailable();
|
|
1263
|
+
}
|
|
1264
|
+
const result = await this.service.dreamsRun({
|
|
1265
|
+
phase,
|
|
1266
|
+
dryRun,
|
|
1267
|
+
namespace,
|
|
1268
|
+
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
1269
|
+
});
|
|
1270
|
+
if (this.shouldCountWriteRateLimit(result)) {
|
|
1271
|
+
this.recordWriteRateLimitHit();
|
|
1272
|
+
}
|
|
1273
|
+
this.respondJson(res, 200, result);
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
882
1276
|
this.respondJson(res, 404, { error: "not_found", code: "not_found" });
|
|
883
1277
|
}
|
|
1278
|
+
/**
|
|
1279
|
+
* SSE handler for /engram/v1/graph/events.
|
|
1280
|
+
*
|
|
1281
|
+
* Lifecycle:
|
|
1282
|
+
* 1. Write SSE headers (Content-Type: text/event-stream).
|
|
1283
|
+
* 2. Register this response in `sseClients`.
|
|
1284
|
+
* 3. Resolve the namespace from the request and subscribe to THAT
|
|
1285
|
+
* namespace's graph event bus (Codex P1: in multi-namespace
|
|
1286
|
+
* deployments each namespace has its own bus keyed by its storage
|
|
1287
|
+
* dir — subscribing to the global root leaks events across tenants).
|
|
1288
|
+
* 4. On each event, add to a 200 ms batch; flush batch as a single SSE frame.
|
|
1289
|
+
* 5. Send heartbeat every 25 s.
|
|
1290
|
+
* 6. On client disconnect (req "close"), clean up timers and unsubscribe.
|
|
1291
|
+
* 7. Register the cleanup callback in `sseCleanupFns` so `stop()` can
|
|
1292
|
+
* release the heartbeat interval and bus subscription even when the
|
|
1293
|
+
* client never disconnects (Cursor review thread `access-http.ts:232`).
|
|
1294
|
+
*/
|
|
1295
|
+
async handleGraphEventsSSE(req, res) {
|
|
1296
|
+
const parsed = new URL(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
|
|
1297
|
+
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1298
|
+
const namespace = namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0;
|
|
1299
|
+
const principal = this.resolveRequestPrincipal(req);
|
|
1300
|
+
const memoryDir = await this.service.getMemoryDirForNamespace(namespace, principal);
|
|
1301
|
+
res.writeHead(200, {
|
|
1302
|
+
"content-type": "text/event-stream; charset=utf-8",
|
|
1303
|
+
"cache-control": "no-cache, no-store, must-revalidate",
|
|
1304
|
+
"connection": "keep-alive",
|
|
1305
|
+
"x-accel-buffering": "no",
|
|
1306
|
+
// prevent nginx buffering
|
|
1307
|
+
"transfer-encoding": "chunked"
|
|
1308
|
+
});
|
|
1309
|
+
const writeSSE = (payload) => {
|
|
1310
|
+
try {
|
|
1311
|
+
res.write(`data: ${JSON.stringify(payload)}
|
|
1312
|
+
|
|
1313
|
+
`);
|
|
1314
|
+
} catch {
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
writeSSE({ type: "connected" });
|
|
1318
|
+
this.sseClients.add(res);
|
|
1319
|
+
const flushBatch = () => {
|
|
1320
|
+
const batch = this.ssePendingBatches.get(res);
|
|
1321
|
+
if (!batch || batch.length === 0) return;
|
|
1322
|
+
this.ssePendingBatches.delete(res);
|
|
1323
|
+
this.sseBatchTimers.delete(res);
|
|
1324
|
+
writeSSE({ type: "batch", events: batch });
|
|
1325
|
+
};
|
|
1326
|
+
const unsubscribe = subscribeGraphEvents(memoryDir, (event) => {
|
|
1327
|
+
let batch = this.ssePendingBatches.get(res);
|
|
1328
|
+
if (!batch) {
|
|
1329
|
+
batch = [];
|
|
1330
|
+
this.ssePendingBatches.set(res, batch);
|
|
1331
|
+
}
|
|
1332
|
+
batch.push(event);
|
|
1333
|
+
if (!this.sseBatchTimers.has(res)) {
|
|
1334
|
+
this.sseBatchTimers.set(res, setTimeout(flushBatch, 200));
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
const heartbeatInterval = setInterval(() => {
|
|
1338
|
+
writeSSE({ type: "heartbeat" });
|
|
1339
|
+
}, 25e3);
|
|
1340
|
+
const cleanup = () => {
|
|
1341
|
+
clearInterval(heartbeatInterval);
|
|
1342
|
+
const timer = this.sseBatchTimers.get(res);
|
|
1343
|
+
if (timer !== void 0) {
|
|
1344
|
+
clearTimeout(timer);
|
|
1345
|
+
this.sseBatchTimers.delete(res);
|
|
1346
|
+
}
|
|
1347
|
+
this.ssePendingBatches.delete(res);
|
|
1348
|
+
unsubscribe();
|
|
1349
|
+
this.sseClients.delete(res);
|
|
1350
|
+
this.sseCleanupFns.delete(cleanup);
|
|
1351
|
+
try {
|
|
1352
|
+
res.end();
|
|
1353
|
+
} catch {
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
this.sseCleanupFns.add(cleanup);
|
|
1357
|
+
req.once("close", cleanup);
|
|
1358
|
+
req.once("error", cleanup);
|
|
1359
|
+
}
|
|
884
1360
|
async handleMcpRequest(req, res) {
|
|
885
1361
|
const body = await this.readJsonBody(req);
|
|
886
1362
|
const request = body;
|
|
887
|
-
const
|
|
1363
|
+
const toolName = typeof request.params?.name === "string" ? request.params.name : "";
|
|
1364
|
+
const toolArgs = request.params?.arguments;
|
|
1365
|
+
const dreamsRunDryRun = (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") && toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && toolArgs.dryRun === true;
|
|
1366
|
+
const memoryActionApplyDryRun = (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply") && toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && toolArgs.dryRun === true;
|
|
1367
|
+
const isMcpWrite = request.method === "tools/call" && (toolName === "engram.memory_store" || toolName === "remnic.memory_store" || toolName === "engram.suggestion_submit" || toolName === "remnic.suggestion_submit" || toolName === "engram.observe" || toolName === "remnic.observe" || toolName === "engram.capsule_export" || toolName === "remnic.capsule_export" || toolName === "engram.capsule_import" || toolName === "remnic.capsule_import" || !dreamsRunDryRun && (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") || !memoryActionApplyDryRun && (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply"));
|
|
888
1368
|
if (isMcpWrite) {
|
|
889
1369
|
this.ensureWriteRateLimitAvailable();
|
|
890
1370
|
}
|
|
@@ -930,11 +1410,17 @@ var EngramAccessHttpServer = class {
|
|
|
930
1410
|
}
|
|
931
1411
|
async handleAdminConsole(req, res, pathname) {
|
|
932
1412
|
if (req.method !== "GET") return false;
|
|
933
|
-
if (pathname === "/
|
|
1413
|
+
if (pathname === "/remnic/ui" || pathname === "/engram/ui") {
|
|
1414
|
+
res.statusCode = 301;
|
|
1415
|
+
res.setHeader("location", pathname + "/");
|
|
1416
|
+
res.end();
|
|
1417
|
+
return true;
|
|
1418
|
+
}
|
|
1419
|
+
if (pathname === "/remnic/ui/" || pathname === "/engram/ui/") {
|
|
934
1420
|
await this.respondStatic(res, path.join(this.adminConsolePublicDir, "index.html"), "text/html; charset=utf-8");
|
|
935
1421
|
return true;
|
|
936
1422
|
}
|
|
937
|
-
if (pathname === "/engram/ui/app.js") {
|
|
1423
|
+
if (pathname === "/remnic/ui/app.js" || pathname === "/engram/ui/app.js") {
|
|
938
1424
|
await this.respondStatic(res, path.join(this.adminConsolePublicDir, "app.js"), "application/javascript; charset=utf-8");
|
|
939
1425
|
return true;
|
|
940
1426
|
}
|
|
@@ -984,15 +1470,31 @@ var EngramAccessHttpServer = class {
|
|
|
984
1470
|
}
|
|
985
1471
|
return result.data;
|
|
986
1472
|
}
|
|
987
|
-
isAuthorized(req) {
|
|
1473
|
+
isAuthorized(req, pathname) {
|
|
988
1474
|
if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter) return false;
|
|
989
1475
|
const raw = req.headers.authorization;
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1476
|
+
let candidate = null;
|
|
1477
|
+
if (raw) {
|
|
1478
|
+
const separator = raw.indexOf(" ");
|
|
1479
|
+
if (separator > 0) {
|
|
1480
|
+
const scheme = raw.slice(0, separator).toLowerCase();
|
|
1481
|
+
if (scheme === "bearer") {
|
|
1482
|
+
candidate = raw.slice(separator + 1).trim();
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
if (!candidate && pathname === "/engram/v1/graph/events") {
|
|
1487
|
+
try {
|
|
1488
|
+
const parsed = new URL(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
|
|
1489
|
+
const queryToken = parsed.searchParams.get("token");
|
|
1490
|
+
if (queryToken && queryToken.length > 0) {
|
|
1491
|
+
candidate = queryToken;
|
|
1492
|
+
}
|
|
1493
|
+
} catch {
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
if (!candidate) return false;
|
|
1497
|
+
const token = candidate;
|
|
996
1498
|
if (this.authToken && this.timingSafeStringEqual(token, this.authToken)) return true;
|
|
997
1499
|
for (const valid of this.authTokens) {
|
|
998
1500
|
if (this.timingSafeStringEqual(token, valid)) return true;
|
|
@@ -1043,4 +1545,4 @@ var EngramAccessHttpServer = class {
|
|
|
1043
1545
|
export {
|
|
1044
1546
|
EngramAccessHttpServer
|
|
1045
1547
|
};
|
|
1046
|
-
//# sourceMappingURL=chunk-
|
|
1548
|
+
//# sourceMappingURL=chunk-CUI2STX6.js.map
|