@remnic/core 9.4.2 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.d.ts +6 -6
- package/dist/access-admin-ops-surface.js +28 -28
- package/dist/access-boundary.d.ts +27 -8
- package/dist/access-boundary.js +33 -29
- package/dist/access-cli.js +83 -81
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +52 -6
- package/dist/access-http.js +40 -38
- package/dist/access-identity-continuity-surface.d.ts +5 -5
- package/dist/access-identity-continuity-surface.js +28 -28
- package/dist/access-lcm-surface.d.ts +6 -6
- package/dist/access-lcm-surface.js +28 -28
- package/dist/access-mcp.d.ts +16 -6
- package/dist/access-mcp.js +37 -35
- package/dist/access-observe-write-surface.d.ts +6 -6
- package/dist/access-observe-write-surface.js +28 -28
- package/dist/access-operations-batch.js +33 -32
- package/dist/access-operations.d.ts +9 -9
- package/dist/access-operations.js +35 -34
- package/dist/access-recall-surface.d.ts +6 -6
- package/dist/access-recall-surface.js +28 -28
- package/dist/access-schema.d.ts +4 -4
- package/dist/access-schema.js +4 -4
- package/dist/{access-service-m-2VO_Ig.d.ts → access-service-CXJaql3A.d.ts} +4 -4
- package/dist/access-service.d.ts +6 -6
- package/dist/access-service.js +28 -28
- package/dist/access-surface-catalog.d.ts +6 -6
- package/dist/access-surface-catalog.js +1 -0
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-token-capabilities.d.ts +174 -0
- package/dist/access-token-capabilities.js +33 -0
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +2 -2
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/{auto-sync-HMHQHUAG.js → auto-sync-4A5YBWYO.js} +4 -4
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +5 -5
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +9 -9
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{capsule-crypto-CZJSLEFG.js → capsule-crypto-RAARDY3M.js} +2 -2
- package/dist/capsule-crypto-RAARDY3M.js.map +1 -0
- package/dist/{catalog-BxWokdC2.d.ts → catalog-C9cu67Ig.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-behavior.js +5 -5
- package/dist/causal-chain.js +3 -3
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +13 -13
- package/dist/causal-retrieval.js +3 -3
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-6ZIETXZ2.js → chunk-23JFRB73.js} +2 -2
- package/dist/{chunk-IC6QX5TC.js → chunk-3XIY7MDQ.js} +6 -6
- package/dist/{chunk-FZGGZAAU.js → chunk-4GNEDXDI.js} +146 -2
- package/dist/chunk-4GNEDXDI.js.map +1 -0
- package/dist/{chunk-LOR6ZM5R.js → chunk-4LV23CHK.js} +2 -2
- package/dist/{chunk-E2SPGGUI.js → chunk-4OKLXWDZ.js} +13 -6
- package/dist/chunk-4OKLXWDZ.js.map +1 -0
- package/dist/{chunk-AER6MT24.js → chunk-6SXVCD7W.js} +2 -2
- package/dist/{chunk-OHDJ34CC.js → chunk-72WG5QKN.js} +2 -2
- package/dist/{chunk-CZAZX7JP.js → chunk-7MW3CVLD.js} +4 -4
- package/dist/{chunk-CXLNZXG5.js → chunk-7XGSIUP5.js} +1 -1
- package/dist/{chunk-CZAA5N5S.js → chunk-AYZJID4S.js} +2 -2
- package/dist/{chunk-M7XQSUBB.js → chunk-B3ABVQ36.js} +116 -9
- package/dist/chunk-B3ABVQ36.js.map +1 -0
- package/dist/{chunk-6BISDEN6.js → chunk-BEM4D2QG.js} +14 -14
- package/dist/{chunk-ZPOROUTX.js → chunk-CYWA2CXR.js} +5 -5
- package/dist/{chunk-M5QKGHCR.js → chunk-CYWCKFCL.js} +5 -5
- package/dist/chunk-D7FOKIY5.js +173 -0
- package/dist/chunk-D7FOKIY5.js.map +1 -0
- package/dist/{chunk-4BFRBP45.js → chunk-DEG5ULFJ.js} +2 -2
- package/dist/{chunk-JLR3JSTL.js → chunk-DS7MM2ES.js} +3 -3
- package/dist/{chunk-2BFLDH5F.js → chunk-EEIROWEG.js} +2 -2
- package/dist/{chunk-5QZDMSSN.js → chunk-FKCRGLRD.js} +237 -82
- package/dist/{chunk-5QZDMSSN.js.map → chunk-FKCRGLRD.js.map} +1 -1
- package/dist/{chunk-X4A62ET7.js → chunk-H2DXDQCQ.js} +17 -17
- package/dist/{chunk-27FLVMDC.js → chunk-HLN7RROI.js} +7 -7
- package/dist/chunk-IC2TCZJ2.js +54 -0
- package/dist/chunk-IC2TCZJ2.js.map +1 -0
- package/dist/{chunk-2U2A5HF4.js → chunk-J3XHPFEU.js} +6 -6
- package/dist/{chunk-AKUCU7CI.js → chunk-JI5AVXYO.js} +5 -5
- package/dist/{chunk-KCJ5H6XQ.js → chunk-JSNVWNGX.js} +2 -2
- package/dist/{chunk-7Z2DZNWN.js → chunk-KL4UAXUY.js} +43 -2
- package/dist/{chunk-7Z2DZNWN.js.map → chunk-KL4UAXUY.js.map} +1 -1
- package/dist/{chunk-FLVL4L3L.js → chunk-KTULX4YO.js} +4 -4
- package/dist/{chunk-ILFJ7AVS.js → chunk-LADFWYHY.js} +35 -21
- package/dist/chunk-LADFWYHY.js.map +1 -0
- package/dist/{chunk-437S3G37.js → chunk-LNQUAJNC.js} +1 -1
- package/dist/{chunk-EPGWWCZF.js → chunk-LR5DZ56F.js} +6 -6
- package/dist/{chunk-YDSWRD33.js → chunk-N3JDIRBW.js} +4 -4
- package/dist/{chunk-OUMTBFSQ.js → chunk-NKCPUHCI.js} +5 -5
- package/dist/{chunk-7QWMTOIF.js → chunk-P454KXD6.js} +112 -34
- package/dist/chunk-P454KXD6.js.map +1 -0
- package/dist/{chunk-DR6PEJU3.js → chunk-PCLIWBGD.js} +44 -59
- package/dist/chunk-PCLIWBGD.js.map +1 -0
- package/dist/{chunk-BGTAL46Y.js → chunk-PNLFN2PZ.js} +2 -2
- package/dist/{chunk-P6SYWE4G.js → chunk-PVUJ6WVV.js} +10 -10
- package/dist/{chunk-YPEMNNNY.js → chunk-RGK27ELN.js} +6 -6
- package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
- package/dist/{chunk-66FLU5BT.js → chunk-SIRPLF54.js} +6 -6
- package/dist/{chunk-M7GGMGMZ.js → chunk-SVOHGUMI.js} +1202 -126
- package/dist/chunk-SVOHGUMI.js.map +1 -0
- package/dist/{chunk-HRCACVHL.js → chunk-TLUDFPZL.js} +2 -2
- package/dist/{chunk-2FOD2YY3.js → chunk-UFUKHGZD.js} +236 -103
- package/dist/chunk-UFUKHGZD.js.map +1 -0
- package/dist/{chunk-2MR3MFQB.js → chunk-UPSAT4PY.js} +2 -2
- package/dist/{chunk-4P4626RY.js → chunk-UTRJFDP2.js} +4 -4
- package/dist/{chunk-CGS7UKWM.js → chunk-VCW74PNH.js} +2 -2
- package/dist/{chunk-5GPPACXK.js → chunk-VSMRDBFT.js} +2 -1
- package/dist/{chunk-NG7YBCJO.js → chunk-XCL57M6Q.js} +4 -4
- package/dist/{chunk-CLX5VDNY.js → chunk-Y4RKAQZ7.js} +4 -4
- package/dist/{chunk-DGYCWCQ7.js → chunk-Y7UNNAZD.js} +2 -2
- package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
- package/dist/{chunk-XN3TUUX2.js → chunk-YQB32INI.js} +2 -2
- package/dist/{cli-EiBBOt3r.d.ts → cli-CqdPA6z9.d.ts} +3 -3
- package/dist/cli.d.ts +7 -7
- package/dist/cli.js +61 -59
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +9 -9
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +2 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +9 -9
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +13 -11
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +2 -2
- package/dist/contradiction/index.js +4 -4
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/backend.js +2 -2
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/dashboard-runtime.js +2 -2
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +2 -2
- package/dist/entity-retrieval.js +9 -9
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +5 -5
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{first-start-migration-DY6YCRC2.js → first-start-migration-VBJQL6OI.js} +5 -5
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +271 -17
- package/dist/index.js +163 -99
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +2 -2
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +10 -10
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +9 -9
- package/dist/maintenance/rebuild-memory-projection.js +11 -11
- package/dist/mcp-memory-inspector-app.d.ts +6 -6
- package/dist/mcp-read-only-tools.d.ts +16 -0
- package/dist/mcp-read-only-tools.js +8 -0
- package/dist/mcp-read-only-tools.js.map +1 -0
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +2 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +19 -19
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +10 -10
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +9 -9
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +2 -2
- package/dist/operator-toolkit.js +25 -25
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +11 -11
- package/dist/{orchestrator-B2Y28Z9t.d.ts → orchestrator-CWFrT8AF.d.ts} +91 -60
- package/dist/orchestrator.d.ts +5 -5
- package/dist/orchestrator.js +85 -83
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/{qmd-Db9mOkzB.d.ts → qmd--fnPMK60.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +4 -4
- package/dist/retrieval-agents.d.ts +2 -2
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/search/document-scanner.js +2 -2
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +9 -9
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +13 -13
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/lancedb-backend.js +3 -3
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.js +3 -3
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/orama-backend.js +3 -3
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-BDVIbLRw.d.ts → semantic-consolidation-O5lMZ4LG.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +11 -11
- package/dist/semantic-rule-promotion.js +9 -9
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +10 -10
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage-C1maCNbc.d.ts +1591 -0
- package/dist/storage.d.ts +5 -1239
- package/dist/storage.js +8 -8
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/{tier-stats-TG6GUZ6N.js → tier-stats-5XF4UBRQ.js} +4 -4
- package/dist/tokens.d.ts +17 -2
- package/dist/tokens.js +3 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +3 -3
- package/dist/transfer/types.d.ts +12 -12
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-ljkd82rn.d.ts → types-CGgcNWCG.d.ts} +31 -1
- package/dist/types.d.ts +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +10 -10
- package/package.json +2 -2
- package/src/access-boundary.test.ts +62 -0
- package/src/access-boundary.ts +165 -126
- package/src/access-http.test.ts +781 -0
- package/src/access-http.ts +334 -108
- package/src/access-mcp.test.ts +264 -0
- package/src/access-mcp.ts +45 -70
- package/src/access-operations-batch.ts +35 -12
- package/src/access-surface-catalog.test.ts +22 -14
- package/src/access-surface-catalog.ts +6 -3
- package/src/access-token-capabilities.test.ts +844 -0
- package/src/access-token-capabilities.ts +391 -0
- package/src/chat/chat-mcp.test.ts +232 -0
- package/src/chat/chat-session.ts +34 -0
- package/src/cli-wearables-fuse.test.ts +197 -0
- package/src/cli.ts +25 -0
- package/src/index.ts +14 -0
- package/src/mcp-read-only-tools.ts +61 -0
- package/src/storage.ts +16 -0
- package/src/tokens.ts +32 -3
- package/src/wearables/cli.test.ts +102 -0
- package/src/wearables/cli.ts +65 -0
- package/src/wearables/config.test.ts +32 -0
- package/src/wearables/config.ts +52 -0
- package/src/wearables/day-store.test.ts +246 -0
- package/src/wearables/day-store.ts +272 -3
- package/src/wearables/fusion/cluster.ts +230 -0
- package/src/wearables/fusion/fuse.ts +218 -0
- package/src/wearables/fusion/fusion.test.ts +2575 -0
- package/src/wearables/fusion/index.ts +50 -0
- package/src/wearables/fusion/reconcile.ts +831 -0
- package/src/wearables/fusion/reconstruct.ts +251 -0
- package/src/wearables/fusion/store.ts +480 -0
- package/src/wearables/fusion/types.ts +228 -0
- package/src/wearables/index.ts +41 -0
- package/src/wearables/service.test.ts +1030 -2
- package/src/wearables/service.ts +258 -16
- package/src/wearables/speakers.test.ts +128 -0
- package/src/wearables/speakers.ts +58 -4
- package/src/wearables/storage-io.test.ts +146 -0
- package/src/wearables/types.ts +31 -0
- package/dist/chunk-2FOD2YY3.js.map +0 -1
- package/dist/chunk-7QWMTOIF.js.map +0 -1
- package/dist/chunk-DR6PEJU3.js.map +0 -1
- package/dist/chunk-E2SPGGUI.js.map +0 -1
- package/dist/chunk-FZGGZAAU.js.map +0 -1
- package/dist/chunk-ILFJ7AVS.js.map +0 -1
- package/dist/chunk-M7GGMGMZ.js.map +0 -1
- package/dist/chunk-M7XQSUBB.js.map +0 -1
- /package/dist/{capsule-crypto-CZJSLEFG.js.map → access-token-capabilities.js.map} +0 -0
- /package/dist/{auto-sync-HMHQHUAG.js.map → auto-sync-4A5YBWYO.js.map} +0 -0
- /package/dist/{chunk-6ZIETXZ2.js.map → chunk-23JFRB73.js.map} +0 -0
- /package/dist/{chunk-IC6QX5TC.js.map → chunk-3XIY7MDQ.js.map} +0 -0
- /package/dist/{chunk-LOR6ZM5R.js.map → chunk-4LV23CHK.js.map} +0 -0
- /package/dist/{chunk-AER6MT24.js.map → chunk-6SXVCD7W.js.map} +0 -0
- /package/dist/{chunk-OHDJ34CC.js.map → chunk-72WG5QKN.js.map} +0 -0
- /package/dist/{chunk-CZAZX7JP.js.map → chunk-7MW3CVLD.js.map} +0 -0
- /package/dist/{chunk-CXLNZXG5.js.map → chunk-7XGSIUP5.js.map} +0 -0
- /package/dist/{chunk-CZAA5N5S.js.map → chunk-AYZJID4S.js.map} +0 -0
- /package/dist/{chunk-6BISDEN6.js.map → chunk-BEM4D2QG.js.map} +0 -0
- /package/dist/{chunk-ZPOROUTX.js.map → chunk-CYWA2CXR.js.map} +0 -0
- /package/dist/{chunk-M5QKGHCR.js.map → chunk-CYWCKFCL.js.map} +0 -0
- /package/dist/{chunk-4BFRBP45.js.map → chunk-DEG5ULFJ.js.map} +0 -0
- /package/dist/{chunk-JLR3JSTL.js.map → chunk-DS7MM2ES.js.map} +0 -0
- /package/dist/{chunk-2BFLDH5F.js.map → chunk-EEIROWEG.js.map} +0 -0
- /package/dist/{chunk-X4A62ET7.js.map → chunk-H2DXDQCQ.js.map} +0 -0
- /package/dist/{chunk-27FLVMDC.js.map → chunk-HLN7RROI.js.map} +0 -0
- /package/dist/{chunk-2U2A5HF4.js.map → chunk-J3XHPFEU.js.map} +0 -0
- /package/dist/{chunk-AKUCU7CI.js.map → chunk-JI5AVXYO.js.map} +0 -0
- /package/dist/{chunk-KCJ5H6XQ.js.map → chunk-JSNVWNGX.js.map} +0 -0
- /package/dist/{chunk-FLVL4L3L.js.map → chunk-KTULX4YO.js.map} +0 -0
- /package/dist/{chunk-437S3G37.js.map → chunk-LNQUAJNC.js.map} +0 -0
- /package/dist/{chunk-EPGWWCZF.js.map → chunk-LR5DZ56F.js.map} +0 -0
- /package/dist/{chunk-YDSWRD33.js.map → chunk-N3JDIRBW.js.map} +0 -0
- /package/dist/{chunk-OUMTBFSQ.js.map → chunk-NKCPUHCI.js.map} +0 -0
- /package/dist/{chunk-BGTAL46Y.js.map → chunk-PNLFN2PZ.js.map} +0 -0
- /package/dist/{chunk-P6SYWE4G.js.map → chunk-PVUJ6WVV.js.map} +0 -0
- /package/dist/{chunk-YPEMNNNY.js.map → chunk-RGK27ELN.js.map} +0 -0
- /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
- /package/dist/{chunk-66FLU5BT.js.map → chunk-SIRPLF54.js.map} +0 -0
- /package/dist/{chunk-HRCACVHL.js.map → chunk-TLUDFPZL.js.map} +0 -0
- /package/dist/{chunk-2MR3MFQB.js.map → chunk-UPSAT4PY.js.map} +0 -0
- /package/dist/{chunk-4P4626RY.js.map → chunk-UTRJFDP2.js.map} +0 -0
- /package/dist/{chunk-CGS7UKWM.js.map → chunk-VCW74PNH.js.map} +0 -0
- /package/dist/{chunk-5GPPACXK.js.map → chunk-VSMRDBFT.js.map} +0 -0
- /package/dist/{chunk-NG7YBCJO.js.map → chunk-XCL57M6Q.js.map} +0 -0
- /package/dist/{chunk-CLX5VDNY.js.map → chunk-Y4RKAQZ7.js.map} +0 -0
- /package/dist/{chunk-DGYCWCQ7.js.map → chunk-Y7UNNAZD.js.map} +0 -0
- /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
- /package/dist/{chunk-XN3TUUX2.js.map → chunk-YQB32INI.js.map} +0 -0
- /package/dist/{first-start-migration-DY6YCRC2.js.map → first-start-migration-VBJQL6OI.js.map} +0 -0
- /package/dist/{tier-stats-TG6GUZ6N.js.map → tier-stats-5XF4UBRQ.js.map} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVersion
|
|
3
3
|
} from "./chunk-VF4XKTX3.js";
|
|
4
|
-
import {
|
|
5
|
-
parseExportBundle
|
|
6
|
-
} from "./chunk-WEHSQBFR.js";
|
|
7
4
|
import {
|
|
8
5
|
decryptCapsuleFileInMemory,
|
|
9
6
|
isEncryptedCapsuleFile
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LNQUAJNC.js";
|
|
8
|
+
import {
|
|
9
|
+
parseExportBundle
|
|
10
|
+
} from "./chunk-WEHSQBFR.js";
|
|
11
11
|
import {
|
|
12
12
|
assertIsDirectoryNotSymlink,
|
|
13
13
|
assertRealpathInsideRoot,
|
|
@@ -227,4 +227,4 @@ function mintForkId(capsuleId, originalId, now) {
|
|
|
227
227
|
export {
|
|
228
228
|
importCapsule
|
|
229
229
|
};
|
|
230
|
-
//# sourceMappingURL=chunk-
|
|
230
|
+
//# sourceMappingURL=chunk-CYWCKFCL.js.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EngramAccessForbiddenError
|
|
3
|
+
} from "./chunk-RANHFI3P.js";
|
|
4
|
+
|
|
5
|
+
// src/access-token-capabilities.ts
|
|
6
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
7
|
+
var TOKEN_CAPABILITIES_VERSION = 1;
|
|
8
|
+
var NAMESPACE_VALUE_MAX_LENGTH = 128;
|
|
9
|
+
var NAMESPACE_VALUE_PATTERN = /^[^\s\/\\\x00-\x1F]+$/;
|
|
10
|
+
function isValidNamespaceValue(value) {
|
|
11
|
+
if (typeof value !== "string" || value.length === 0 || value.length > NAMESPACE_VALUE_MAX_LENGTH) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (!NAMESPACE_VALUE_PATTERN.test(value)) return false;
|
|
15
|
+
if (value === "." || value === "..") return false;
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
function isStringArray(value) {
|
|
19
|
+
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
20
|
+
}
|
|
21
|
+
function dedupeSort(values) {
|
|
22
|
+
return [...new Set(values)].sort();
|
|
23
|
+
}
|
|
24
|
+
function parseAxis(obj, key, validateValue, valueLabel) {
|
|
25
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) return void 0;
|
|
26
|
+
const value = obj[key];
|
|
27
|
+
if (value === void 0 || value === null) return void 0;
|
|
28
|
+
if (!isStringArray(value)) {
|
|
29
|
+
throw new Error(`capabilities ${key} must be an array of non-empty strings`);
|
|
30
|
+
}
|
|
31
|
+
const cleaned = [];
|
|
32
|
+
for (const v of value) {
|
|
33
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
34
|
+
throw new Error(`capabilities ${key} must be an array of non-empty strings`);
|
|
35
|
+
}
|
|
36
|
+
if (!validateValue(v)) {
|
|
37
|
+
throw new Error(`capabilities ${key} contains a malformed ${valueLabel}: ${JSON.stringify(v)}`);
|
|
38
|
+
}
|
|
39
|
+
cleaned.push(v);
|
|
40
|
+
}
|
|
41
|
+
return dedupeSort(cleaned);
|
|
42
|
+
}
|
|
43
|
+
function normalizeCapabilities(raw) {
|
|
44
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
45
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
46
|
+
throw new Error("capabilities must be an object with a version marker");
|
|
47
|
+
}
|
|
48
|
+
const obj = raw;
|
|
49
|
+
if (obj.version !== void 0 && obj.version !== TOKEN_CAPABILITIES_VERSION) {
|
|
50
|
+
throw new Error(`capabilities.version must be ${TOKEN_CAPABILITIES_VERSION}`);
|
|
51
|
+
}
|
|
52
|
+
const ops = parseAxis(obj, "ops", () => true, "operation");
|
|
53
|
+
const namespaces = parseAxis(obj, "namespaces", isValidNamespaceValue, "namespace");
|
|
54
|
+
const result = { version: TOKEN_CAPABILITIES_VERSION };
|
|
55
|
+
if (ops !== void 0) result.ops = ops;
|
|
56
|
+
if (namespaces !== void 0) result.namespaces = namespaces;
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
function validateCapabilitiesForMint(raw, validOps) {
|
|
60
|
+
const result = { version: TOKEN_CAPABILITIES_VERSION };
|
|
61
|
+
if (raw === void 0 || raw === null) {
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
65
|
+
throw new Error("capabilities must be an object with optional ops/namespaces arrays");
|
|
66
|
+
}
|
|
67
|
+
const obj = raw;
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(obj, "version") && obj.version !== void 0) {
|
|
69
|
+
if (obj.version !== TOKEN_CAPABILITIES_VERSION) {
|
|
70
|
+
throw new Error(`capabilities.version must be ${TOKEN_CAPABILITIES_VERSION}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const validOpSet = new Set(validOps);
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(obj, "ops") && obj.ops !== void 0 && obj.ops !== null) {
|
|
75
|
+
if (!isStringArray(obj.ops)) {
|
|
76
|
+
throw new Error("capabilities ops must be an array of non-empty strings");
|
|
77
|
+
}
|
|
78
|
+
const ops = obj.ops;
|
|
79
|
+
for (const v of ops) {
|
|
80
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
81
|
+
throw new Error("capabilities ops must be an array of non-empty strings");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const unknown = ops.filter((op) => typeof op === "string" && !validOpSet.has(op));
|
|
85
|
+
if (unknown.length > 0) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
`capabilities ops contains unknown operation name(s): ${unknown.map((o) => JSON.stringify(o)).join(", ")}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
result.ops = dedupeSort(ops);
|
|
91
|
+
}
|
|
92
|
+
if (Object.prototype.hasOwnProperty.call(obj, "namespaces") && obj.namespaces !== void 0 && obj.namespaces !== null) {
|
|
93
|
+
if (!isStringArray(obj.namespaces)) {
|
|
94
|
+
throw new Error("capabilities namespaces must be an array of non-empty strings");
|
|
95
|
+
}
|
|
96
|
+
const namespaces = obj.namespaces;
|
|
97
|
+
for (const v of namespaces) {
|
|
98
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
99
|
+
throw new Error("capabilities namespaces must be an array of non-empty strings");
|
|
100
|
+
}
|
|
101
|
+
if (!isValidNamespaceValue(v)) {
|
|
102
|
+
throw new Error(`capabilities namespaces contains a malformed namespace: ${JSON.stringify(v)}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
result.namespaces = dedupeSort(namespaces);
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
function isCapabilityRestricted(caps) {
|
|
110
|
+
if (!caps) return false;
|
|
111
|
+
return caps.ops !== void 0 || caps.namespaces !== void 0;
|
|
112
|
+
}
|
|
113
|
+
function capabilityAllowsOp(caps, op) {
|
|
114
|
+
if (caps?.ops === void 0) return true;
|
|
115
|
+
return caps.ops.includes(op);
|
|
116
|
+
}
|
|
117
|
+
function capabilityAllowsNamespace(caps, namespace) {
|
|
118
|
+
if (caps?.namespaces === void 0) return true;
|
|
119
|
+
if (namespace === void 0) return false;
|
|
120
|
+
return caps.namespaces.includes(namespace);
|
|
121
|
+
}
|
|
122
|
+
function assertOperationAllowed(caps, op) {
|
|
123
|
+
if (!capabilityAllowsOp(caps, op)) {
|
|
124
|
+
throw new EngramAccessForbiddenError(
|
|
125
|
+
`token is not permitted to call operation: ${op}`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function assertNamespaceAllowed(caps, namespace) {
|
|
130
|
+
if (!capabilityAllowsNamespace(caps, namespace)) {
|
|
131
|
+
throw new EngramAccessForbiddenError(
|
|
132
|
+
namespace === void 0 ? "token is scoped to specific namespaces and this operation requires an explicit namespace" : `token is not permitted to access namespace: ${namespace}`
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function resolveEffectiveNamespace(namespace, defaultNamespace) {
|
|
137
|
+
const normalized = namespace !== void 0 && namespace.length > 0 ? namespace : void 0;
|
|
138
|
+
return normalized ?? defaultNamespace;
|
|
139
|
+
}
|
|
140
|
+
function enforceNamespaceAllowList(caps, namespace, defaultNamespace) {
|
|
141
|
+
if (caps?.namespaces === void 0) return;
|
|
142
|
+
const effective = resolveEffectiveNamespace(namespace, defaultNamespace);
|
|
143
|
+
if (effective === void 0 || !caps.namespaces.includes(effective)) {
|
|
144
|
+
throw new EngramAccessForbiddenError(
|
|
145
|
+
namespace === void 0 ? "token is scoped to specific namespaces; the server default namespace is not permitted \u2014 supply an allowed namespace" : `token is not permitted to access namespace: ${namespace}`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function assertFleetWideOperationAllowed(caps) {
|
|
150
|
+
if (!capabilityAllowsNamespace(caps, void 0)) {
|
|
151
|
+
throw new EngramAccessForbiddenError(
|
|
152
|
+
"token is scoped to specific namespaces; this maintenance operation runs across all namespaces and is not permitted for a namespace-scoped token"
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
var tokenCapabilityStore = new AsyncLocalStorage();
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
TOKEN_CAPABILITIES_VERSION,
|
|
160
|
+
isValidNamespaceValue,
|
|
161
|
+
normalizeCapabilities,
|
|
162
|
+
validateCapabilitiesForMint,
|
|
163
|
+
isCapabilityRestricted,
|
|
164
|
+
capabilityAllowsOp,
|
|
165
|
+
capabilityAllowsNamespace,
|
|
166
|
+
assertOperationAllowed,
|
|
167
|
+
assertNamespaceAllowed,
|
|
168
|
+
resolveEffectiveNamespace,
|
|
169
|
+
enforceNamespaceAllowList,
|
|
170
|
+
assertFleetWideOperationAllowed,
|
|
171
|
+
tokenCapabilityStore
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=chunk-D7FOKIY5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/access-token-capabilities.ts"],"sourcesContent":["/**\n * Per-token capabilities (issue #1837).\n *\n * A token entry MAY carry an explicit, versioned capabilities record. The\n * record's PRESENCE is mechanically detectable, which is load-bearing for\n * security:\n *\n * - ABSENT `capabilities` field ⇒ a PRE-FEATURE legacy entry (minted\n * before this feature). It is UNRESTRICTED — full access — purely for\n * backward compatibility. This is the ONLY path by which \"full access\"\n * is granted by omission.\n *\n * - PRESENT `capabilities` record (always carries a `version` marker) ⇒ a\n * token minted by the capability-aware path. Even a new token minted\n * without `--ops`/`--namespaces` records an EXPLICIT unrestricted record\n * (`{ version: 1 }`) — a deliberate, auditable choice, never an\n * accidentally-omitted field. Within the record, the two axes follow\n * absent-vs-present semantics:\n * * axis ABSENT (e.g. no `ops` key) ⇒ unrestricted on that axis.\n * * axis PRESENT and empty (`ops: []`) ⇒ deny all (fail-closed).\n * * axis PRESENT and non-empty ⇒ allow only the listed values.\n *\n * Malformed capability input at mint time (bad version, non-array axes,\n * non-string elements, unknown op names against the catalog, malformed\n * namespace values) is REJECTED — a token is never created from invalid\n * input (rule: invalid input rejected, not defaulted).\n *\n * This module owns the pure capability logic (shape validation, allow-list\n * checks) and the per-request AsyncLocalStorage carrying the presenting\n * token's resolved capabilities down to the access boundary. It imports\n * nothing else in the package except the forbidden-error class, so it can be\n * reused by the token store, the boundary, and the HTTP/MCP surfaces without\n * cycles.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { EngramAccessForbiddenError } from \"./access-errors.js\";\n\n/** Current capability-record schema version. */\nexport const TOKEN_CAPABILITIES_VERSION = 1 as const;\n\n/**\n * Versioned capabilities record stored on a token entry. Presence of this\n * record (vs. an absent field) is what distinguishes a capability-aware\n * token from a pre-feature legacy entry.\n */\nexport interface TokenCapabilities {\n readonly version: typeof TOKEN_CAPABILITIES_VERSION;\n /**\n * Operations allow-list. `undefined` (key absent) ⇒ unrestricted on this\n * axis. `[]` ⇒ deny all ops (fail-closed). Non-empty ⇒ allow only listed.\n */\n ops?: string[];\n /**\n * Namespaces allow-list. `undefined` ⇒ unrestricted. `[]` ⇒ deny all.\n * Non-empty ⇒ allow only listed.\n */\n namespaces?: string[];\n}\n\n/**\n * Namespace value validation. Namespace identifiers are flexible (default,\n * team, self, principal-prefixed, project-prefixed) but must never contain\n * whitespace, path separators, traversal segments, or control characters —\n * such values are malformed at mint time and rejected, never silently\n * coerced.\n */\nconst NAMESPACE_VALUE_MAX_LENGTH = 128;\n// Non-empty, no whitespace, no path separators, no control chars. `.` and\n// `..` are rejected separately so legitimate dotted names (e.g. a domain)\n// remain allowed while traversal is not.\nconst NAMESPACE_VALUE_PATTERN = /^[^\\s\\/\\\\\\x00-\\x1F]+$/;\n\n/** True when `value` is an acceptable namespace allow-list entry. */\nexport function isValidNamespaceValue(value: unknown): value is string {\n if (typeof value !== \"string\" || value.length === 0 || value.length > NAMESPACE_VALUE_MAX_LENGTH) {\n return false;\n }\n if (!NAMESPACE_VALUE_PATTERN.test(value)) return false;\n if (value === \".\" || value === \"..\") return false;\n return true;\n}\n\nfunction isStringArray(value: unknown): value is unknown[] {\n return Array.isArray(value) && value.every((v) => typeof v === \"string\");\n}\n\nfunction dedupeSort(values: string[]): string[] {\n return [...new Set(values)].sort();\n}\n\n/**\n * Parse one axis (ops or namespaces) for PERSISTENCE/LOAD. Returns the\n * cleaned array (deduped, sorted; possibly empty to preserve \"present ⇒\n * fail-closed\") or `undefined` when the key is absent. Throws on a malformed\n * shape (non-array, non-string elements, malformed namespace values). Op\n * validation against the catalog happens only at mint time.\n */\nfunction parseAxis(\n obj: Record<string, unknown>,\n key: \"ops\" | \"namespaces\",\n validateValue: (v: unknown) => boolean,\n valueLabel: string,\n): string[] | undefined {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) return undefined;\n const value = obj[key];\n if (value === undefined || value === null) return undefined;\n if (!isStringArray(value)) {\n throw new Error(`capabilities ${key} must be an array of non-empty strings`);\n }\n const cleaned: string[] = [];\n for (const v of value) {\n if (typeof v !== \"string\" || v.length === 0) {\n throw new Error(`capabilities ${key} must be an array of non-empty strings`);\n }\n if (!validateValue(v)) {\n throw new Error(`capabilities ${key} contains a malformed ${valueLabel}: ${JSON.stringify(v)}`);\n }\n cleaned.push(v);\n }\n // Preserve presence: an explicitly empty array stays [] (fail-closed),\n // NOT coerced to undefined (which would mean unrestricted).\n return dedupeSort(cleaned);\n}\n\n/**\n * Normalize a capabilities record for PERSISTENCE/LOAD. Returns `undefined`\n * ONLY when the record is entirely absent (a pre-feature legacy entry ⇒\n * unrestricted). When present, an absent/`undefined` `version` is COERCED to\n * the current default (1) — mirroring {@link validateCapabilitiesForMint} — so\n * a record that mint-validated also load-normalizes without a schema throw.\n * An explicitly-present WRONG version (not 1) is still rejected. Throws on a\n * malformed record (non-object, explicitly-wrong version, malformed axes).\n */\nexport function normalizeCapabilities(raw: unknown): TokenCapabilities | undefined {\n if (raw === undefined || raw === null) return undefined;\n if (typeof raw !== \"object\" || Array.isArray(raw)) {\n throw new Error(\"capabilities must be an object with a version marker\");\n }\n const obj = raw as Record<string, unknown>;\n // Coerce absent/undefined version → 1, mirroring validateCapabilitiesForMint\n // (version 1 is the only schema version; coercing keeps mint-validated\n // records reloadable). Only an explicitly-present WRONG version throws.\n if (obj.version !== undefined && obj.version !== TOKEN_CAPABILITIES_VERSION) {\n throw new Error(`capabilities.version must be ${TOKEN_CAPABILITIES_VERSION}`);\n }\n const ops = parseAxis(obj, \"ops\", () => true, \"operation\");\n const namespaces = parseAxis(obj, \"namespaces\", isValidNamespaceValue, \"namespace\");\n const result: TokenCapabilities = { version: TOKEN_CAPABILITIES_VERSION };\n if (ops !== undefined) result.ops = ops;\n if (namespaces !== undefined) result.namespaces = namespaces;\n return result;\n}\n\n/**\n * Validate a capabilities record at MINT time. ALWAYS returns a versioned\n * record (never `undefined`) so every newly-minted token carries an explicit\n * capability decision — a new token can never gain full access by OMITTING\n * the field. When `raw` is absent/null, the result is an explicit\n * unrestricted record (`{ version: 1 }`), a deliberate/auditable choice. A\n * present-but-`undefined` (or absent) `version` is coerced to the current\n * default (1); an explicitly-wrong version is rejected. This version rule is\n * identical to {@link normalizeCapabilities} (mint/load symmetry). Rejects\n * unknown op names against the catalog and malformed namespace values;\n * throws a plain Error — the caller must NOT create a token when this throws.\n */\nexport function validateCapabilitiesForMint(\n raw: unknown,\n validOps: readonly string[],\n): TokenCapabilities {\n const result: TokenCapabilities = { version: TOKEN_CAPABILITIES_VERSION };\n if (raw === undefined || raw === null) {\n return result;\n }\n if (typeof raw !== \"object\" || Array.isArray(raw)) {\n throw new Error(\"capabilities must be an object with optional ops/namespaces arrays\");\n }\n const obj = raw as Record<string, unknown>;\n if (Object.prototype.hasOwnProperty.call(obj, \"version\") && obj.version !== undefined) {\n if (obj.version !== TOKEN_CAPABILITIES_VERSION) {\n throw new Error(`capabilities.version must be ${TOKEN_CAPABILITIES_VERSION}`);\n }\n }\n const validOpSet = new Set(validOps);\n\n if (Object.prototype.hasOwnProperty.call(obj, \"ops\") && obj.ops !== undefined && obj.ops !== null) {\n if (!isStringArray(obj.ops)) {\n throw new Error(\"capabilities ops must be an array of non-empty strings\");\n }\n const ops = obj.ops as unknown[];\n for (const v of ops) {\n if (typeof v !== \"string\" || v.length === 0) {\n throw new Error(\"capabilities ops must be an array of non-empty strings\");\n }\n }\n // Reject unknown op names against the catalog (unknown ⇒ reject, never drop).\n const unknown = ops.filter((op) => typeof op === \"string\" && !validOpSet.has(op));\n if (unknown.length > 0) {\n throw new Error(\n `capabilities ops contains unknown operation name(s): ${unknown.map((o) => JSON.stringify(o)).join(\", \")}`,\n );\n }\n // Preserve presence (empty stays [] ⇒ deny all ops).\n result.ops = dedupeSort(ops as string[]);\n }\n\n if (\n Object.prototype.hasOwnProperty.call(obj, \"namespaces\") &&\n obj.namespaces !== undefined &&\n obj.namespaces !== null\n ) {\n if (!isStringArray(obj.namespaces)) {\n throw new Error(\"capabilities namespaces must be an array of non-empty strings\");\n }\n const namespaces = obj.namespaces as unknown[];\n for (const v of namespaces) {\n if (typeof v !== \"string\" || v.length === 0) {\n throw new Error(\"capabilities namespaces must be an array of non-empty strings\");\n }\n if (!isValidNamespaceValue(v)) {\n throw new Error(`capabilities namespaces contains a malformed namespace: ${JSON.stringify(v)}`);\n }\n }\n result.namespaces = dedupeSort(namespaces as string[]);\n }\n\n return result;\n}\n\n/**\n * True when `caps` imposes any restriction (a present record with at least\n * one axis key). `undefined` (legacy / absent record) ⇒ unrestricted. A\n * present `{ version: 1 }` record with no axes ⇒ also unrestricted (but\n * auditable — it is a deliberate new-token decision, not omission).\n */\nexport function isCapabilityRestricted(caps: TokenCapabilities | undefined | null): boolean {\n if (!caps) return false;\n return caps.ops !== undefined || caps.namespaces !== undefined;\n}\n\n/**\n * True when `caps` permits `op`.\n * - record ABSENT (legacy) ⇒ unrestricted (true).\n * - ops axis ABSENT ⇒ unrestricted on this axis (true).\n * - ops axis PRESENT ⇒ `op` must be listed; `[]` ⇒ false (deny all).\n */\nexport function capabilityAllowsOp(caps: TokenCapabilities | undefined | null, op: string): boolean {\n if (caps?.ops === undefined) return true;\n return caps.ops.includes(op);\n}\n\n/**\n * True when `caps` permits `namespace`.\n * - record ABSENT / namespaces axis ABSENT ⇒ unrestricted (true).\n * - namespaces axis PRESENT ⇒ `namespace` must be listed; undefined\n * namespace ⇒ false; `[]` ⇒ false (deny all).\n */\nexport function capabilityAllowsNamespace(\n caps: TokenCapabilities | undefined | null,\n namespace: string | undefined,\n): boolean {\n if (caps?.namespaces === undefined) return true;\n if (namespace === undefined) return false;\n return caps.namespaces.includes(namespace);\n}\n\n/**\n * Throw {@link EngramAccessForbiddenError} when `caps` restricts ops and\n * `op` is not permitted. No-op for unrestricted tokens.\n */\nexport function assertOperationAllowed(\n caps: TokenCapabilities | undefined | null,\n op: string,\n): void {\n if (!capabilityAllowsOp(caps, op)) {\n throw new EngramAccessForbiddenError(\n `token is not permitted to call operation: ${op}`,\n );\n }\n}\n\n/**\n * Throw {@link EngramAccessForbiddenError} when `caps` restricts namespaces\n * and `namespace` is not permitted. No-op for unrestricted tokens.\n */\nexport function assertNamespaceAllowed(\n caps: TokenCapabilities | undefined | null,\n namespace: string | undefined,\n): void {\n if (!capabilityAllowsNamespace(caps, namespace)) {\n throw new EngramAccessForbiddenError(\n namespace === undefined\n ? \"token is scoped to specific namespaces and this operation requires an explicit namespace\"\n : `token is not permitted to access namespace: ${namespace}`,\n );\n }\n}\n\n/**\n * Resolve the EFFECTIVE namespace an operation runs against: a present,\n * non-empty request namespace wins, otherwise the server default — the same\n * resolution downstream storage applies\n * (`getWritableStorageForNamespace(undefined)` → `defaultNamespace`). Empty\n * strings are treated as absent. Centralized so every invocation surface\n * (HTTP query/body, MCP `tools/call`, id-loaded records, legacy pairs that\n * carry no namespace) applies ONE rule and none can dodge the check by\n * dropping the param. (issue #1850)\n */\nexport function resolveEffectiveNamespace(\n namespace: string | undefined,\n defaultNamespace: string | undefined,\n): string | undefined {\n const normalized = namespace !== undefined && namespace.length > 0 ? namespace : undefined;\n return normalized ?? defaultNamespace;\n}\n\n/**\n * The single effective-namespace allow-list chokepoint (issues #1837/#1850).\n * Throws {@link EngramAccessForbiddenError} when `caps` carries a namespaces\n * allow-list and the EFFECTIVE namespace (request value OR server default) is\n * not a member. FAIL CLOSED:\n * - a scoped token whose allow-list does not cover the effective namespace\n * (explicit OR defaulted) is rejected;\n * - an absent server default (unconfigured) is also rejected for scoped\n * tokens, so omitting `?namespace=` can never bypass the allow-list.\n * No-op for unrestricted tokens (no namespaces axis) so legacy/unrestricted\n * behavior is unchanged. Both the HTTP transport (`resolveNamespace`) and the\n * MCP dispatch route through this ONE function so no surface is missed.\n */\nexport function enforceNamespaceAllowList(\n caps: TokenCapabilities | undefined | null,\n namespace: string | undefined,\n defaultNamespace: string | undefined,\n): void {\n if (caps?.namespaces === undefined) return; // unrestricted token — unchanged\n const effective = resolveEffectiveNamespace(namespace, defaultNamespace);\n if (effective === undefined || !caps.namespaces.includes(effective)) {\n throw new EngramAccessForbiddenError(\n namespace === undefined\n ? \"token is scoped to specific namespaces; the server default namespace is not permitted — supply an allowed namespace\"\n : `token is not permitted to access namespace: ${namespace}`,\n );\n }\n}\n\n/**\n * Fleet-wide / global maintenance operation guard (issue #1850 round 10).\n *\n * A distinct escalation class from the id-addressed routes (round 9) and the\n * param-namespace ops (round 4): some boundary operations inherently run\n * ACROSS ALL namespaces — or against a single global layer (compression\n * guidelines, shared context, compounding) that is not namespace-partitioned\n * — and carry NO `namespace` argument, so the MCP `tools/call` effective-\n * namespace chokepoint ({@link enforceNamespaceAllowList}, which only fires\n * when `toolAcceptsNamespace`) never applies. Without this guard a bearer\n * scoped to ONE tenant could trigger maintenance that mutates state in EVERY\n * namespace (privilege escalation).\n *\n * Fail CLOSED exactly like the other shared guards: a namespace-SCOPED token\n * (namespaces axis present) is rejected; unrestricted / legacy tokens (absent\n * record or no namespaces axis — i.e. cron and internal callers that never\n * bind a capability record) are unaffected. Reuses the EXISTING capability\n * model via {@link capabilityAllowsNamespace} — no new \"all\"/\"*\" scope concept.\n * Must run BEFORE any side effect so a denial never leaks a partial mutation.\n */\nexport function assertFleetWideOperationAllowed(\n caps: TokenCapabilities | undefined | null,\n): void {\n // capabilityAllowsNamespace returns false for ANY scoped token when the\n // namespace is undefined (a fleet-wide op has no single namespace), and\n // true for unrestricted/legacy tokens — exactly the desired policy.\n if (!capabilityAllowsNamespace(caps, undefined)) {\n throw new EngramAccessForbiddenError(\n \"token is scoped to specific namespaces; this maintenance operation runs across all namespaces and is not permitted for a namespace-scoped token\",\n );\n }\n}\n\n/**\n * Per-request AsyncLocalStorage carrying the presenting token's resolved\n * capabilities. The HTTP surface binds the resolved capabilities with\n * `.run(caps, handler)` for the WHOLE authorized request dispatch (NOT\n * `.enterWith()`, which mutates the current async resource and does not\n * reliably isolate the store across the handler's awaits / concurrent\n * requests — risking a fail-open read of undefined mid-handler); the\n * access boundary reads `.getStore()` to enforce the ops allow-list for\n * every boundary operation without each dispatch site threading the value\n * explicitly. Unset (CLI, direct boundary callers, tests) ⇒ undefined ⇒\n * unrestricted (issue #1850 round 7).\n */\nexport const tokenCapabilityStore = new AsyncLocal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S,uBACd,MACA,IACM;AACN,MAAI,CAAC,mBAAmB,MAAM,EAAE,GAAG;AACjC,UAAM,IAAI;AAAA,MACR,6CAA6C,EAAE;AAAA,IACjD;AAAA,EACF;AACF;AAMO,SAAS,uBACd,MACA,WACM;AACN,MAAI,CAAC,0BAA0B,MAAM,SAAS,GAAG;AAC/C,UAAM,IAAI;AAAA,MACR,cAAc,SACV,6FACA,+CAA+C,SAAS;AAAA,IAC9D;AAAA,EACF;AACF;AAYO,SAAS,0BACd,WACA,kBACoB;AACpB,QAAM,aAAa,cAAc,UAAa,UAAU,SAAS,IAAI,YAAY;AACjF,SAAO,cAAc;AACvB;AAeO,SAAS,0BACd,MACA,WACA,kBACM;AACN,MAAI,MAAM,eAAe,OAAW;AACpC,QAAM,YAAY,0BAA0B,WAAW,gBAAgB;AACvE,MAAI,cAAc,UAAa,CAAC,KAAK,WAAW,SAAS,SAAS,GAAG;AACnE,UAAM,IAAI;AAAA,MACR,cAAc,SACV,6HACA,+CAA+C,SAAS;AAAA,IAC9D;AAAA,EACF;AACF;AAsBO,SAAS,gCACd,MACM;AAIN,MAAI,CAAC,0BAA0B,MAAM,MAAS,GAAG;AAC/C,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;AAcO,IAAM,uBAAuB,IAAI,kBAAiD;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSearchBackend
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HLN7RROI.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceIdentityToken,
|
|
6
6
|
normalizeNamespaceIdentity
|
|
@@ -404,4 +404,4 @@ export {
|
|
|
404
404
|
namespaceCollectionName,
|
|
405
405
|
NamespaceSearchRouter
|
|
406
406
|
};
|
|
407
|
-
//# sourceMappingURL=chunk-
|
|
407
|
+
//# sourceMappingURL=chunk-DEG5ULFJ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NamespaceStorageRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PNLFN2PZ.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceCollectionName
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DEG5ULFJ.js";
|
|
7
7
|
import {
|
|
8
8
|
namespaceIdentityFromToken,
|
|
9
9
|
namespaceIdentityToken
|
|
@@ -207,4 +207,4 @@ export {
|
|
|
207
207
|
verifyNamespaces,
|
|
208
208
|
runNamespaceMigration
|
|
209
209
|
};
|
|
210
|
-
//# sourceMappingURL=chunk-
|
|
210
|
+
//# sourceMappingURL=chunk-DS7MM2ES.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-765K3SAT.js";
|
|
4
4
|
import {
|
|
5
5
|
encryptCapsuleFile
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LNQUAJNC.js";
|
|
7
7
|
import {
|
|
8
8
|
computeTransferOutputRel,
|
|
9
9
|
isTransferPathExcluded
|
|
@@ -109,4 +109,4 @@ async function enforceRetention(outDirAbs, retentionDays) {
|
|
|
109
109
|
export {
|
|
110
110
|
backupMemoryDir
|
|
111
111
|
};
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-EEIROWEG.js.map
|