@remnic/core 9.69.56 → 9.69.57
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.d.ts +5 -6
- package/dist/abort-error.d.ts.map +1 -0
- package/dist/abstraction-nodes.d.ts +12 -13
- package/dist/abstraction-nodes.d.ts.map +1 -0
- package/dist/access-admin-ops-surface.d.ts +20 -153
- package/dist/access-admin-ops-surface.d.ts.map +1 -0
- package/dist/access-admin-ops-surface.js +65 -60
- package/dist/access-audit.d.ts +6 -10
- package/dist/access-audit.d.ts.map +1 -0
- package/dist/access-audit.js +2 -2
- package/dist/access-authorization-probe.d.ts +7 -152
- package/dist/access-authorization-probe.d.ts.map +1 -0
- package/dist/access-authorization-probe.js +66 -61
- package/dist/access-boundary.d.ts +156 -145
- package/dist/access-boundary.d.ts.map +1 -0
- package/dist/access-boundary.js +65 -60
- package/dist/access-citation-namespace.d.ts +3 -3
- package/dist/access-citation-namespace.d.ts.map +1 -0
- package/dist/access-citation.d.ts +6 -7
- package/dist/access-citation.d.ts.map +1 -0
- package/dist/access-cli.d.ts +7 -7
- package/dist/access-cli.d.ts.map +1 -0
- package/dist/access-cli.js +157 -152
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +4 -23
- package/dist/access-coding-context-resolution.d.ts.map +1 -0
- package/dist/access-errors.d.ts +57 -5
- package/dist/access-errors.d.ts.map +1 -0
- package/dist/access-errors.js +13 -3
- package/dist/access-extraction-force-flush.d.ts +5 -150
- package/dist/access-extraction-force-flush.d.ts.map +1 -0
- package/dist/access-extraction-force-flush.js +65 -60
- package/dist/access-health-types.d.ts +7 -30
- package/dist/access-health-types.d.ts.map +1 -0
- package/dist/access-http-briefing.d.ts +5 -150
- package/dist/access-http-briefing.d.ts.map +1 -0
- package/dist/access-http-briefing.js +66 -61
- package/dist/access-http-lcm-compaction.d.ts +12 -156
- package/dist/access-http-lcm-compaction.d.ts.map +1 -0
- package/dist/access-http-lifecycle-flush.d.ts +6 -150
- package/dist/access-http-lifecycle-flush.d.ts.map +1 -0
- package/dist/access-http-offline-stream.d.ts +6 -151
- package/dist/access-http-offline-stream.d.ts.map +1 -0
- package/dist/access-http-query.d.ts +6 -26
- package/dist/access-http-query.d.ts.map +1 -0
- package/dist/access-http-query.js +67 -62
- package/dist/access-http.d.ts +22 -189
- package/dist/access-http.d.ts.map +1 -0
- package/dist/access-http.js +93 -89
- package/dist/access-idempotency.d.ts +5 -5
- package/dist/access-idempotency.d.ts.map +1 -0
- package/dist/access-identity-continuity-surface.d.ts +4 -115
- package/dist/access-identity-continuity-surface.d.ts.map +1 -0
- package/dist/access-identity-continuity-surface.js +65 -60
- package/dist/access-lcm-surface.d.ts +5 -151
- package/dist/access-lcm-surface.d.ts.map +1 -0
- package/dist/access-lcm-surface.js +65 -60
- package/dist/access-mcp-admin-tools.d.ts +4 -5
- package/dist/access-mcp-admin-tools.d.ts.map +1 -0
- package/dist/access-mcp-output-schemas.d.ts +2 -3
- package/dist/access-mcp-output-schemas.d.ts.map +1 -0
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp-shared-context-tools.d.ts +3 -150
- package/dist/access-mcp-shared-context-tools.d.ts.map +1 -0
- package/dist/access-mcp-sse.d.ts +3 -5
- package/dist/access-mcp-sse.d.ts.map +1 -0
- package/dist/access-mcp-tool-names.d.ts +9 -10
- package/dist/access-mcp-tool-names.d.ts.map +1 -0
- package/dist/access-mcp.d.ts +178 -145
- package/dist/access-mcp.d.ts.map +1 -0
- package/dist/access-mcp.js +80 -76
- package/dist/access-memory-search-fanout.d.ts +18 -37
- package/dist/access-memory-search-fanout.d.ts.map +1 -0
- package/dist/access-memory-search-fanout.js +2 -2
- package/dist/access-namespace-preflight.d.ts +18 -22
- package/dist/access-namespace-preflight.d.ts.map +1 -0
- package/dist/access-namespace-preflight.js +65 -60
- package/dist/access-observe-helpers.d.ts +4 -5
- package/dist/access-observe-helpers.d.ts.map +1 -0
- package/dist/access-observe-transcript.d.ts +5 -115
- package/dist/access-observe-transcript.d.ts.map +1 -0
- package/dist/access-observe-write-category.d.ts +5 -42
- package/dist/access-observe-write-category.d.ts.map +1 -0
- package/dist/access-observe-write-category.js +7 -7
- package/dist/access-observe-write-surface.d.ts +6 -151
- package/dist/access-observe-write-surface.d.ts.map +1 -0
- package/dist/access-observe-write-surface.js +65 -60
- package/dist/access-offline-manifest.d.ts +10 -124
- package/dist/access-offline-manifest.d.ts.map +1 -0
- package/dist/access-offline-manifest.js +7 -7
- package/dist/access-operations-batch.d.ts +12 -2
- package/dist/access-operations-batch.d.ts.map +1 -0
- package/dist/access-operations-batch.js +69 -66
- package/dist/access-operations.d.ts +66 -188
- package/dist/access-operations.d.ts.map +1 -0
- package/dist/access-operations.js +76 -73
- package/dist/access-recall-concurrency.d.ts +11 -156
- package/dist/access-recall-concurrency.d.ts.map +1 -0
- package/dist/access-recall-concurrency.js +65 -60
- package/dist/access-recall-diagnostics.d.ts +64 -0
- package/dist/access-recall-diagnostics.d.ts.map +1 -0
- package/dist/access-recall-diagnostics.js +26 -0
- package/dist/access-recall-response.d.ts +7 -151
- package/dist/access-recall-response.d.ts.map +1 -0
- package/dist/access-recall-response.js +65 -60
- package/dist/access-recall-surface.d.ts +11 -152
- package/dist/access-recall-surface.d.ts.map +1 -0
- package/dist/access-recall-surface.js +65 -60
- package/dist/access-schema.d.ts +203 -221
- package/dist/access-schema.d.ts.map +1 -0
- package/dist/access-schema.js +3 -3
- package/dist/access-service-helpers.d.ts +33 -145
- package/dist/access-service-helpers.d.ts.map +1 -0
- package/dist/access-service.d.ts +1825 -145
- package/dist/access-service.d.ts.map +1 -0
- package/dist/access-service.js +65 -60
- package/dist/access-surface-catalog.d.ts +7 -154
- package/dist/access-surface-catalog.d.ts.map +1 -0
- package/dist/access-surface-catalog.js +69 -62
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-token-capabilities.d.ts +19 -22
- package/dist/access-token-capabilities.d.ts.map +1 -0
- package/dist/access-token-capabilities.js +2 -2
- package/dist/access-wearables-meetings-surface.d.ts +14 -54
- package/dist/access-wearables-meetings-surface.d.ts.map +1 -0
- package/dist/action-confidence.d.ts +19 -40
- package/dist/action-confidence.d.ts.map +1 -0
- package/dist/active-context-config.d.ts +7 -8
- package/dist/active-context-config.d.ts.map +1 -0
- package/dist/active-context-transform.d.ts +31 -33
- package/dist/active-context-transform.d.ts.map +1 -0
- package/dist/active-memory-bridge.d.ts +10 -28
- package/dist/active-memory-bridge.d.ts.map +1 -0
- package/dist/active-recall.d.ts +11 -30
- package/dist/active-recall.d.ts.map +1 -0
- package/dist/active-recall.js +23 -23
- package/dist/activity/config.d.ts +24 -0
- package/dist/activity/config.d.ts.map +1 -0
- package/dist/activity/digest.d.ts +15 -35
- package/dist/activity/digest.d.ts.map +1 -0
- package/dist/activity/dwell.d.ts +14 -0
- package/dist/activity/dwell.d.ts.map +1 -0
- package/dist/activity/from-ms.d.ts +7 -0
- package/dist/activity/from-ms.d.ts.map +1 -0
- package/dist/activity/heading-level.d.ts +15 -0
- package/dist/activity/heading-level.d.ts.map +1 -0
- package/dist/activity/heading-title.d.ts +15 -0
- package/dist/activity/heading-title.d.ts.map +1 -0
- package/dist/activity/index.d.ts +46 -0
- package/dist/activity/index.d.ts.map +1 -0
- package/dist/activity/journal-extract.d.ts +68 -0
- package/dist/activity/journal-extract.d.ts.map +1 -0
- package/dist/activity/journal-heading.d.ts +26 -0
- package/dist/activity/journal-heading.d.ts.map +1 -0
- package/dist/activity/journal-path.d.ts +9 -0
- package/dist/activity/journal-path.d.ts.map +1 -0
- package/dist/activity/journal-read.d.ts +31 -0
- package/dist/activity/journal-read.d.ts.map +1 -0
- package/dist/activity/journal-section.d.ts +17 -0
- package/dist/activity/journal-section.d.ts.map +1 -0
- package/dist/activity/journal-source.d.ts +25 -0
- package/dist/activity/journal-source.d.ts.map +1 -0
- package/dist/activity/journal-state.d.ts +21 -0
- package/dist/activity/journal-state.d.ts.map +1 -0
- package/dist/activity/journal-state.lock-worker.d.ts +2 -0
- package/dist/activity/journal-state.lock-worker.d.ts.map +1 -0
- package/dist/activity/journal-strip.d.ts +6 -0
- package/dist/activity/journal-strip.d.ts.map +1 -0
- package/dist/activity/journal-vault-prereq.d.ts +23 -0
- package/dist/activity/journal-vault-prereq.d.ts.map +1 -0
- package/dist/activity/journal-vault-provenance.d.ts +12 -0
- package/dist/activity/journal-vault-provenance.d.ts.map +1 -0
- package/dist/activity/journal-vault-read.d.ts +32 -0
- package/dist/activity/journal-vault-read.d.ts.map +1 -0
- package/dist/activity/journal.d.ts +29 -0
- package/dist/activity/journal.d.ts.map +1 -0
- package/dist/activity/memory-gen.d.ts +71 -0
- package/dist/activity/memory-gen.d.ts.map +1 -0
- package/dist/activity/pipeline.d.ts +44 -0
- package/dist/activity/pipeline.d.ts.map +1 -0
- package/dist/activity/privacy-delete-plan.d.ts +22 -0
- package/dist/activity/privacy-delete-plan.d.ts.map +1 -0
- package/dist/activity/privacy-enabled.d.ts +16 -0
- package/dist/activity/privacy-enabled.d.ts.map +1 -0
- package/dist/activity/privacy-gate-resolve.d.ts +17 -0
- package/dist/activity/privacy-gate-resolve.d.ts.map +1 -0
- package/dist/activity/privacy-keys.d.ts +8 -0
- package/dist/activity/privacy-keys.d.ts.map +1 -0
- package/dist/activity/privacy-redact.d.ts +13 -0
- package/dist/activity/privacy-redact.d.ts.map +1 -0
- package/dist/activity/privacy-status.d.ts +30 -0
- package/dist/activity/privacy-status.d.ts.map +1 -0
- package/dist/activity/privacy-window.d.ts +15 -0
- package/dist/activity/privacy-window.d.ts.map +1 -0
- package/dist/activity/privacy.d.ts +17 -0
- package/dist/activity/privacy.d.ts.map +1 -0
- package/dist/activity/reindex.d.ts +23 -0
- package/dist/activity/reindex.d.ts.map +1 -0
- package/dist/activity/retain-days.d.ts +8 -0
- package/dist/activity/retain-days.d.ts.map +1 -0
- package/dist/activity/runner.d.ts +100 -0
- package/dist/activity/runner.d.ts.map +1 -0
- package/dist/activity/scheduler.d.ts +90 -0
- package/dist/activity/scheduler.d.ts.map +1 -0
- package/dist/activity/source-client.d.ts +24 -0
- package/dist/activity/source-client.d.ts.map +1 -0
- package/dist/activity/store.d.ts +53 -0
- package/dist/activity/store.d.ts.map +1 -0
- package/dist/activity/sync-registration.d.ts +83 -0
- package/dist/activity/sync-registration.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-batch-empty.d.ts +8 -0
- package/dist/activity/timeline/analysis-batch-empty.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-batch.d.ts +12 -0
- package/dist/activity/timeline/analysis-batch.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-claim.d.ts +14 -0
- package/dist/activity/timeline/analysis-claim.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-dup.d.ts +8 -0
- package/dist/activity/timeline/analysis-dup.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-empty.d.ts +8 -0
- package/dist/activity/timeline/analysis-empty.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-evidence.d.ts +12 -0
- package/dist/activity/timeline/analysis-evidence.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-failure.d.ts +19 -0
- package/dist/activity/timeline/analysis-failure.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-max.d.ts +8 -0
- package/dist/activity/timeline/analysis-max.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-metadata.d.ts +30 -0
- package/dist/activity/timeline/analysis-metadata.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-order.d.ts +8 -0
- package/dist/activity/timeline/analysis-order.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-overlap.d.ts +8 -0
- package/dist/activity/timeline/analysis-overlap.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-prompt.d.ts +13 -0
- package/dist/activity/timeline/analysis-prompt.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-provider.d.ts +84 -0
- package/dist/activity/timeline/analysis-provider.d.ts.map +1 -0
- package/dist/activity/timeline/analysis-run.d.ts +40 -0
- package/dist/activity/timeline/analysis-run.d.ts.map +1 -0
- package/dist/activity/timeline/analysis.d.ts +63 -0
- package/dist/activity/timeline/analysis.d.ts.map +1 -0
- package/dist/activity/timeline/build.d.ts +50 -0
- package/dist/activity/timeline/build.d.ts.map +1 -0
- package/dist/activity/timeline/categories.d.ts +27 -0
- package/dist/activity/timeline/categories.d.ts.map +1 -0
- package/dist/activity/timeline/classify.d.ts +20 -0
- package/dist/activity/timeline/classify.d.ts.map +1 -0
- package/dist/activity/timeline/corrections.d.ts +37 -0
- package/dist/activity/timeline/corrections.d.ts.map +1 -0
- package/dist/activity/timeline/index.d.ts +35 -0
- package/dist/activity/timeline/index.d.ts.map +1 -0
- package/dist/activity/timeline/journal-recap-persist.d.ts +14 -0
- package/dist/activity/timeline/journal-recap-persist.d.ts.map +1 -0
- package/dist/activity/timeline/journal-recap.d.ts +21 -0
- package/dist/activity/timeline/journal-recap.d.ts.map +1 -0
- package/dist/activity/timeline/publish-cli.d.ts +17 -0
- package/dist/activity/timeline/publish-cli.d.ts.map +1 -0
- package/dist/activity/timeline/query.d.ts +86 -0
- package/dist/activity/timeline/query.d.ts.map +1 -0
- package/dist/activity/timeline/recap-card-count.d.ts +7 -0
- package/dist/activity/timeline/recap-card-count.d.ts.map +1 -0
- package/dist/activity/timeline/recap-card-id.d.ts +14 -0
- package/dist/activity/timeline/recap-card-id.d.ts.map +1 -0
- package/dist/activity/timeline/recap-date.d.ts +15 -0
- package/dist/activity/timeline/recap-date.d.ts.map +1 -0
- package/dist/activity/timeline/recap-empty.d.ts +8 -0
- package/dist/activity/timeline/recap-empty.d.ts.map +1 -0
- package/dist/activity/timeline/recap-export-range.d.ts +55 -0
- package/dist/activity/timeline/recap-export-range.d.ts.map +1 -0
- package/dist/activity/timeline/recap-export.d.ts +48 -0
- package/dist/activity/timeline/recap-export.d.ts.map +1 -0
- package/dist/activity/timeline/recap-fallback.d.ts +47 -0
- package/dist/activity/timeline/recap-fallback.d.ts.map +1 -0
- package/dist/activity/timeline/recap-id.d.ts +8 -0
- package/dist/activity/timeline/recap-id.d.ts.map +1 -0
- package/dist/activity/timeline/recap-markdown.d.ts +15 -0
- package/dist/activity/timeline/recap-markdown.d.ts.map +1 -0
- package/dist/activity/timeline/recap-merge-edits.d.ts +24 -0
- package/dist/activity/timeline/recap-merge-edits.d.ts.map +1 -0
- package/dist/activity/timeline/recap-sort-key.d.ts +9 -0
- package/dist/activity/timeline/recap-sort-key.d.ts.map +1 -0
- package/dist/activity/timeline/recap-tz.d.ts +15 -0
- package/dist/activity/timeline/recap-tz.d.ts.map +1 -0
- package/dist/activity/timeline/recap-window.d.ts +19 -0
- package/dist/activity/timeline/recap-window.d.ts.map +1 -0
- package/dist/activity/timeline/regenerate.d.ts +84 -0
- package/dist/activity/timeline/regenerate.d.ts.map +1 -0
- package/dist/activity/timeline/types.d.ts +98 -0
- package/dist/activity/timeline/types.d.ts.map +1 -0
- package/dist/activity/timeline/week-config-hash.d.ts +13 -0
- package/dist/activity/timeline/week-config-hash.d.ts.map +1 -0
- package/dist/activity/timeline/week-count.d.ts +7 -0
- package/dist/activity/timeline/week-count.d.ts.map +1 -0
- package/dist/activity/timeline/week-dashboard.d.ts +79 -0
- package/dist/activity/timeline/week-dashboard.d.ts.map +1 -0
- package/dist/activity/timeline/week-days.d.ts +6 -0
- package/dist/activity/timeline/week-days.d.ts.map +1 -0
- package/dist/activity/timeline/week-export.d.ts +27 -0
- package/dist/activity/timeline/week-export.d.ts.map +1 -0
- package/dist/activity/timeline/week-iso.d.ts +16 -0
- package/dist/activity/timeline/week-iso.d.ts.map +1 -0
- package/dist/activity/timeline/week-monday.d.ts +3 -0
- package/dist/activity/timeline/week-monday.d.ts.map +1 -0
- package/dist/activity/timeline/week-previous.d.ts +39 -0
- package/dist/activity/timeline/week-previous.d.ts.map +1 -0
- package/dist/activity/timeline/week-range.d.ts +10 -0
- package/dist/activity/timeline/week-range.d.ts.map +1 -0
- package/dist/activity/timeline/week-recurring.d.ts +21 -0
- package/dist/activity/timeline/week-recurring.d.ts.map +1 -0
- package/dist/activity/timeline/week-snapshot.d.ts +17 -0
- package/dist/activity/timeline/week-snapshot.d.ts.map +1 -0
- package/dist/activity/timeline/week-span.d.ts +2 -0
- package/dist/activity/timeline/week-span.d.ts.map +1 -0
- package/dist/activity/timeline/week-sunday.d.ts +3 -0
- package/dist/activity/timeline/week-sunday.d.ts.map +1 -0
- package/dist/activity/timeline/weekly-persist.d.ts +18 -0
- package/dist/activity/timeline/weekly-persist.d.ts.map +1 -0
- package/dist/activity/timeline/weekly.d.ts +42 -0
- package/dist/activity/timeline/weekly.d.ts.map +1 -0
- package/dist/activity/to-ms.d.ts +7 -0
- package/dist/activity/to-ms.d.ts.map +1 -0
- package/dist/activity/types.d.ts +208 -0
- package/dist/activity/types.d.ts.map +1 -0
- package/dist/activity/vault-begin.d.ts +8 -0
- package/dist/activity/vault-begin.d.ts.map +1 -0
- package/dist/activity/vault-body-trim.d.ts +7 -0
- package/dist/activity/vault-body-trim.d.ts.map +1 -0
- package/dist/activity/vault-dry-run.d.ts +13 -0
- package/dist/activity/vault-dry-run.d.ts.map +1 -0
- package/dist/activity/vault-end.d.ts +8 -0
- package/dist/activity/vault-end.d.ts.map +1 -0
- package/dist/activity/vault-frontmatter.d.ts +41 -0
- package/dist/activity/vault-frontmatter.d.ts.map +1 -0
- package/dist/activity/vault-insert.d.ts +24 -0
- package/dist/activity/vault-insert.d.ts.map +1 -0
- package/dist/activity/vault-join.d.ts +2 -0
- package/dist/activity/vault-join.d.ts.map +1 -0
- package/dist/activity/vault-marker.d.ts +12 -0
- package/dist/activity/vault-marker.d.ts.map +1 -0
- package/dist/activity/vault-name-trim.d.ts +7 -0
- package/dist/activity/vault-name-trim.d.ts.map +1 -0
- package/dist/activity/vault-path.d.ts +20 -0
- package/dist/activity/vault-path.d.ts.map +1 -0
- package/dist/activity/vault-publish.d.ts +71 -0
- package/dist/activity/vault-publish.d.ts.map +1 -0
- package/dist/activity/vault-publisher.d.ts +58 -0
- package/dist/activity/vault-publisher.d.ts.map +1 -0
- package/dist/activity/vault-region-pair.d.ts +17 -0
- package/dist/activity/vault-region-pair.d.ts.map +1 -0
- package/dist/activity/vault-region.d.ts +24 -0
- package/dist/activity/vault-region.d.ts.map +1 -0
- package/dist/activity/vault-status.d.ts +32 -0
- package/dist/activity/vault-status.d.ts.map +1 -0
- package/dist/activity/vault-suffix.d.ts +7 -0
- package/dist/activity/vault-suffix.d.ts.map +1 -0
- package/dist/activity/vault-wikilink.d.ts +2 -0
- package/dist/activity/vault-wikilink.d.ts.map +1 -0
- package/dist/activity/window-order.d.ts +17 -0
- package/dist/activity/window-order.d.ts.map +1 -0
- package/dist/adapters/claude-code.d.ts +3 -5
- package/dist/adapters/claude-code.d.ts.map +1 -0
- package/dist/adapters/codex.d.ts +3 -5
- package/dist/adapters/codex.d.ts.map +1 -0
- package/dist/adapters/grok.d.ts +23 -0
- package/dist/adapters/grok.d.ts.map +1 -0
- package/dist/adapters/hermes.d.ts +3 -5
- package/dist/adapters/hermes.d.ts.map +1 -0
- package/dist/adapters/index.d.ts +9 -51
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/opencode.d.ts +22 -0
- package/dist/adapters/opencode.d.ts.map +1 -0
- package/dist/adapters/registry.d.ts +3 -5
- package/dist/adapters/registry.d.ts.map +1 -0
- package/dist/adapters/registry.js +2 -2
- package/dist/adapters/replit.d.ts +3 -5
- package/dist/adapters/replit.d.ts.map +1 -0
- package/dist/adapters/types.d.ts +5 -6
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/admin/admin-surfaces.d.ts +362 -0
- package/dist/admin/admin-surfaces.d.ts.map +1 -0
- package/dist/ambient-provenance.d.ts +10 -30
- package/dist/ambient-provenance.d.ts.map +1 -0
- package/dist/archive-mutation-version.d.ts +8 -9
- package/dist/archive-mutation-version.d.ts.map +1 -0
- package/dist/artifact-search.d.ts +5 -25
- package/dist/artifact-search.d.ts.map +1 -0
- package/dist/auto-sync-CWSZDLLW.js +1 -1
- package/dist/background-generation-config.d.ts +3 -4
- package/dist/background-generation-config.d.ts.map +1 -0
- package/dist/background-generation.d.ts +5 -24
- package/dist/background-generation.d.ts.map +1 -0
- package/dist/behavior-learner.d.ts +6 -25
- package/dist/behavior-learner.d.ts.map +1 -0
- package/dist/behavior-signals.d.ts +5 -24
- package/dist/behavior-signals.d.ts.map +1 -0
- package/dist/binary-lifecycle/backend.d.ts +46 -0
- package/dist/binary-lifecycle/backend.d.ts.map +1 -0
- package/dist/binary-lifecycle/index.d.ts +13 -0
- package/dist/binary-lifecycle/index.d.ts.map +1 -0
- package/dist/binary-lifecycle/manifest.d.ts +22 -0
- package/dist/binary-lifecycle/manifest.d.ts.map +1 -0
- package/dist/binary-lifecycle/pipeline.d.ts +33 -0
- package/dist/binary-lifecycle/pipeline.d.ts.map +1 -0
- package/dist/binary-lifecycle/scanner.d.ts +21 -0
- package/dist/binary-lifecycle/scanner.d.ts.map +1 -0
- package/dist/binary-lifecycle/types.d.ts +70 -0
- package/dist/binary-lifecycle/types.d.ts.map +1 -0
- package/dist/bootstrap.d.ts +6 -115
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bounded-jsonl-state.d.ts +5 -5
- package/dist/bounded-jsonl-state.d.ts.map +1 -0
- package/dist/boxes.d.ts +9 -9
- package/dist/boxes.d.ts.map +1 -0
- package/dist/briefing-window.d.ts +8 -40
- package/dist/briefing-window.d.ts.map +1 -0
- package/dist/briefing.d.ts +28 -61
- package/dist/briefing.d.ts.map +1 -0
- package/dist/briefing.js +14 -14
- package/dist/buffer-surprise-report.d.ts +6 -26
- package/dist/buffer-surprise-report.d.ts.map +1 -0
- package/dist/buffer-surprise.d.ts +5 -6
- package/dist/buffer-surprise.d.ts.map +1 -0
- package/dist/buffer-turn-helpers.d.ts +32 -18
- package/dist/buffer-turn-helpers.d.ts.map +1 -0
- package/dist/buffer.d.ts +9 -41
- package/dist/buffer.d.ts.map +1 -0
- package/dist/buffer.js +3 -3
- package/dist/bulk-import/index.d.ts +4 -44
- package/dist/bulk-import/index.d.ts.map +1 -0
- package/dist/bulk-import/pipeline.d.ts +30 -0
- package/dist/bulk-import/pipeline.d.ts.map +1 -0
- package/dist/bulk-import/registry.d.ts +23 -0
- package/dist/bulk-import/registry.d.ts.map +1 -0
- package/dist/bulk-import/types.d.ts +83 -0
- package/dist/bulk-import/types.d.ts.map +1 -0
- package/dist/calibration.d.ts +14 -37
- package/dist/calibration.d.ts.map +1 -0
- package/dist/capabilities.d.ts +64 -84
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capsule-cli.d.ts +23 -24
- package/dist/capsule-cli.d.ts.map +1 -0
- package/dist/capsule-crypto-7FJQINUR.js +18 -0
- package/dist/causal-behavior.d.ts +9 -38
- package/dist/causal-behavior.d.ts.map +1 -0
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.d.ts +13 -17
- package/dist/causal-chain.d.ts.map +1 -0
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +10 -29
- package/dist/causal-consolidation.d.ts.map +1 -0
- package/dist/causal-consolidation.js +17 -17
- package/dist/causal-retrieval.d.ts +6 -11
- package/dist/causal-retrieval.d.ts.map +1 -0
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +7 -29
- package/dist/causal-trajectory-graph.d.ts.map +1 -0
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.d.ts +23 -25
- package/dist/causal-trajectory.d.ts.map +1 -0
- package/dist/causal-trajectory.js +1 -1
- package/dist/census-validation.d.ts +5 -6
- package/dist/census-validation.d.ts.map +1 -0
- package/dist/chat/chat-cli.d.ts +38 -0
- package/dist/chat/chat-cli.d.ts.map +1 -0
- package/dist/chat/chat-config.d.ts +25 -0
- package/dist/chat/chat-config.d.ts.map +1 -0
- package/dist/chat/chat-engine.d.ts +82 -0
- package/dist/chat/chat-engine.d.ts.map +1 -0
- package/dist/chat/chat-executor.d.ts +26 -0
- package/dist/chat/chat-executor.d.ts.map +1 -0
- package/dist/chat/chat-factory.d.ts +46 -0
- package/dist/chat/chat-factory.d.ts.map +1 -0
- package/dist/chat/chat-http.d.ts +83 -0
- package/dist/chat/chat-http.d.ts.map +1 -0
- package/dist/chat/chat-llm.d.ts +77 -0
- package/dist/chat/chat-llm.d.ts.map +1 -0
- package/dist/chat/chat-session.d.ts +118 -0
- package/dist/chat/chat-session.d.ts.map +1 -0
- package/dist/chat/chat-system-prompt.d.ts +23 -0
- package/dist/chat/chat-system-prompt.d.ts.map +1 -0
- package/dist/chat/chat-tools.d.ts +22 -0
- package/dist/chat/chat-tools.d.ts.map +1 -0
- package/dist/chat/chat-types.d.ts +134 -0
- package/dist/chat/chat-types.d.ts.map +1 -0
- package/dist/chunk-2CBWEIS4.js +1286 -0
- package/dist/chunk-2JQZSQXI.js +81 -0
- package/dist/chunk-2KHIBLO5.js +33 -0
- package/dist/chunk-2KHIBLO5.js.map +1 -0
- package/dist/chunk-2NLLXCJG.js +112 -0
- package/dist/chunk-2WMXZYMS.js +25 -0
- package/dist/chunk-34ZGBAGE.js +61 -0
- package/dist/chunk-36S7UHAW.js +623 -0
- package/dist/chunk-3JLWSFTV.js +801 -0
- package/dist/chunk-3MUKQQ7A.js +157 -0
- package/dist/chunk-3MUKQQ7A.js.map +1 -0
- package/dist/chunk-3RZOLUZT.js +140 -0
- package/dist/chunk-3SL52JKD.js +160 -0
- package/dist/chunk-4ALOINQ4.js +18512 -0
- package/dist/chunk-4ALOINQ4.js.map +1 -0
- package/dist/chunk-4QEZS7PK.js +502 -0
- package/dist/chunk-52VL6LCY.js +648 -0
- package/dist/chunk-52VL6LCY.js.map +1 -0
- package/dist/chunk-5HFVWYHL.js +111 -0
- package/dist/chunk-5HFVWYHL.js.map +1 -0
- package/dist/chunk-5QRYGLZN.js +35 -0
- package/dist/chunk-5R3C5LEZ.js +263 -0
- package/dist/chunk-634UKELB.js +77 -0
- package/dist/chunk-64JK4TL7.js +801 -0
- package/dist/chunk-6E5GYDIE.js +141 -0
- package/dist/chunk-6ISP2EN2.js +51 -0
- package/dist/chunk-6RD7MSIO.js +212 -0
- package/dist/chunk-6UDLN4IA.js +70 -0
- package/dist/chunk-754XN6LX.js +256 -0
- package/dist/chunk-7H2LEYYJ.js +256 -0
- package/dist/chunk-A7AISUJI.js +103 -0
- package/dist/chunk-AULKCNZW.js +727 -0
- package/dist/chunk-B7SSU55V.js +1686 -0
- package/dist/chunk-BICNRVEC.js +224 -0
- package/dist/chunk-BJI2D4SU.js +53 -0
- package/dist/chunk-BQB5ZMYO.js +28 -0
- package/dist/chunk-BSDBDFKZ.js +168 -0
- package/dist/chunk-BSDBDFKZ.js.map +1 -0
- package/dist/chunk-C5CPYMLX.js +315 -0
- package/dist/chunk-C6LRFPZL.js +4007 -0
- package/dist/chunk-C6LRFPZL.js.map +1 -0
- package/dist/chunk-CS2JO77A.js +95 -0
- package/dist/chunk-DTABICJ3.js +549 -0
- package/dist/chunk-DXODYQ7J.js +319 -0
- package/dist/chunk-DXODYQ7J.js.map +1 -0
- package/dist/chunk-E6UNM67F.js +432 -0
- package/dist/chunk-ENUI3IO7.js +271 -0
- package/dist/chunk-FF2XYADH.js +1084 -0
- package/dist/chunk-FF6N7BXC.js +389 -0
- package/dist/chunk-FNQEXI3D.js +22 -0
- package/dist/chunk-FNQEXI3D.js.map +1 -0
- package/dist/chunk-FSXD6Y4H.js +203 -0
- package/dist/chunk-GK6NOQE6.js +3400 -0
- package/dist/chunk-GRSFFLUY.js +43 -0
- package/dist/chunk-GWK7FEUL.js +761 -0
- package/dist/chunk-GWQVMKUJ.js +218 -0
- package/dist/chunk-H7O5L2IQ.js +3560 -0
- package/dist/chunk-H7O5L2IQ.js.map +1 -0
- package/dist/chunk-HKHZWJ3E.js +63 -0
- package/dist/chunk-IAZPYX6W.js +182 -0
- package/dist/chunk-IG747LRN.js +189 -0
- package/dist/chunk-IK63WA5A.js +30 -0
- package/dist/chunk-IRGQYQQ7.js +143 -0
- package/dist/chunk-IRGQYQQ7.js.map +1 -0
- package/dist/chunk-IUD6NLNM.js +24 -0
- package/dist/chunk-JSJZ2NXS.js +9782 -0
- package/dist/chunk-JUOJGZPV.js +566 -0
- package/dist/chunk-KA4U5GQN.js +960 -0
- package/dist/chunk-KQAFEZQX.js +264 -0
- package/dist/chunk-L4WBADKG.js +72 -0
- package/dist/chunk-LAL4B37X.js +275 -0
- package/dist/chunk-LELJRLPY.js +253 -0
- package/dist/chunk-LMMQKZK3.js +403 -0
- package/dist/chunk-LQ23DMTT.js +74 -0
- package/dist/chunk-LV6ZB6CA.js +285 -0
- package/dist/chunk-M5IJP3YW.js +5505 -0
- package/dist/chunk-MMMYRC7Q.js +606 -0
- package/dist/chunk-MMMYRC7Q.js.map +1 -0
- package/dist/chunk-MWZMVLXL.js +415 -0
- package/dist/chunk-MZUQVWVC.js +72 -0
- package/dist/chunk-MZUQVWVC.js.map +1 -0
- package/dist/chunk-N4VCHRLD.js +29 -0
- package/dist/chunk-NKXHCCLB.js +879 -0
- package/dist/chunk-NVCWA4QC.js +112 -0
- package/dist/chunk-ONWVMYHX.js +122 -0
- package/dist/chunk-P6P35FY4.js +54 -0
- package/dist/chunk-P7M22CYB.js +346 -0
- package/dist/chunk-QMWKENNK.js +111 -0
- package/dist/chunk-QOPB6KE3.js +1530 -0
- package/dist/chunk-RBULO7DO.js +223 -0
- package/dist/chunk-RDESQOEE.js +1008 -0
- package/dist/chunk-RMF763SX.js +115 -0
- package/dist/chunk-RN6ZCNM5.js +321 -0
- package/dist/chunk-S2OBXHMN.js +11341 -0
- package/dist/chunk-S3JPD4N7.js +216 -0
- package/dist/chunk-SF6RFI5Z.js +165 -0
- package/dist/chunk-SJV3AOZ2.js +2453 -0
- package/dist/chunk-SLULR4GC.js +202 -0
- package/dist/chunk-TFXXMTHV.js +1476 -0
- package/dist/chunk-TYP7GYRI.js +216 -0
- package/dist/chunk-TYZK56OA.js +2440 -0
- package/dist/chunk-VLDVNZQE.js +921 -0
- package/dist/chunk-W6YK672C.js +511 -0
- package/dist/chunk-X2NFFBTO.js +576 -0
- package/dist/chunk-X45KZOT2.js +1917 -0
- package/dist/chunk-X7Y7WX73.js +249 -0
- package/dist/chunk-XIXM6G7I.js +43 -0
- package/dist/chunk-XLXYARWC.js +210 -0
- package/dist/chunk-XVW52M6I.js +223 -0
- package/dist/chunk-YHU5XUF4.js +342 -0
- package/dist/chunk-YRH3C2OJ.js +73 -0
- package/dist/chunk-YXQE67A7.js +137 -0
- package/dist/chunk-ZHUVMSHI.js +731 -0
- package/dist/chunk-ZHXSOMYH.js +297 -0
- package/dist/chunk-ZIEZJMFW.js +768 -0
- package/dist/chunk-ZMT4ZVJU.js +31013 -0
- package/dist/chunk-ZMT4ZVJU.js.map +1 -0
- package/dist/chunk-ZOASYXBS.js +629 -0
- package/dist/chunk-ZOASYXBS.js.map +1 -0
- package/dist/chunk-ZSEFGDCI.js +98 -0
- package/dist/chunk-ZX5N5D6M.js +65 -0
- package/dist/chunking.d.ts +9 -10
- package/dist/chunking.d.ts.map +1 -0
- package/dist/citations.d.ts +8 -9
- package/dist/citations.d.ts.map +1 -0
- package/dist/cli/creation-ledger-commands.d.ts +24 -0
- package/dist/cli/creation-ledger-commands.d.ts.map +1 -0
- package/dist/cli/deep-recall-commands.d.ts +19 -0
- package/dist/cli/deep-recall-commands.d.ts.map +1 -0
- package/dist/cli/harmonic-search.d.ts +12 -0
- package/dist/cli/harmonic-search.d.ts.map +1 -0
- package/dist/cli/meetings-commands.d.ts +16 -0
- package/dist/cli/meetings-commands.d.ts.map +1 -0
- package/dist/cli/memory-browse-commands.d.ts +11 -0
- package/dist/cli/memory-browse-commands.d.ts.map +1 -0
- package/dist/cli/okf-commands.d.ts +5 -0
- package/dist/cli/okf-commands.d.ts.map +1 -0
- package/dist/cli/recall-navigation-commands.d.ts +11 -0
- package/dist/cli/recall-navigation-commands.d.ts.map +1 -0
- package/dist/cli/research-status-commands.d.ts +26 -0
- package/dist/cli/research-status-commands.d.ts.map +1 -0
- package/dist/cli/skills-commands.d.ts +14 -0
- package/dist/cli/skills-commands.d.ts.map +1 -0
- package/dist/cli/timeline-publish-commands.d.ts +11 -0
- package/dist/cli/timeline-publish-commands.d.ts.map +1 -0
- package/dist/cli-fallback.d.ts +13 -14
- package/dist/cli-fallback.d.ts.map +1 -0
- package/dist/cli.d.ts +1036 -165
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +120 -116
- package/dist/coding/action-gate.d.ts +176 -0
- package/dist/coding/action-gate.d.ts.map +1 -0
- package/dist/coding/architecture-card.d.ts +135 -0
- package/dist/coding/architecture-card.d.ts.map +1 -0
- package/dist/coding/architecture-surfaces.d.ts +166 -0
- package/dist/coding/architecture-surfaces.d.ts.map +1 -0
- package/dist/coding/codegraph-runtime.d.ts +321 -0
- package/dist/coding/codegraph-runtime.d.ts.map +1 -0
- package/dist/coding/codegraph-surfaces.d.ts +191 -0
- package/dist/coding/codegraph-surfaces.d.ts.map +1 -0
- package/dist/coding/coding-graph-types.d.ts +16 -17
- package/dist/coding/coding-graph-types.d.ts.map +1 -0
- package/dist/coding/coding-knowledge-config.d.ts +69 -0
- package/dist/coding/coding-knowledge-config.d.ts.map +1 -0
- package/dist/coding/coding-namespace.d.ts +214 -0
- package/dist/coding/coding-namespace.d.ts.map +1 -0
- package/dist/coding/decision-records.d.ts +120 -0
- package/dist/coding/decision-records.d.ts.map +1 -0
- package/dist/coding/decision-surfaces.d.ts +143 -0
- package/dist/coding/decision-surfaces.d.ts.map +1 -0
- package/dist/coding/export-okf-codegraph.d.ts +9 -28
- package/dist/coding/export-okf-codegraph.d.ts.map +1 -0
- package/dist/coding/export-okf-codegraph.js +13 -13
- package/dist/coding/git-context.d.ts +92 -0
- package/dist/coding/git-context.d.ts.map +1 -0
- package/dist/coding/optional-coding-graph.d.ts +9 -10
- package/dist/coding/optional-coding-graph.d.ts.map +1 -0
- package/dist/coding/pre-action-gate.d.ts +58 -18
- package/dist/coding/pre-action-gate.d.ts.map +1 -0
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/coding/review-context.d.ts +147 -0
- package/dist/coding/review-context.d.ts.map +1 -0
- package/dist/coding/session-delta-surfaces.d.ts +138 -0
- package/dist/coding/session-delta-surfaces.d.ts.map +1 -0
- package/dist/coding/session-delta.d.ts +201 -0
- package/dist/coding/session-delta.d.ts.map +1 -0
- package/dist/coding/structural-context.d.ts +194 -0
- package/dist/coding/structural-context.d.ts.map +1 -0
- package/dist/coding/structural-subprocess-provider.d.ts +50 -0
- package/dist/coding/structural-subprocess-provider.d.ts.map +1 -0
- package/dist/commitment-ledger.d.ts +13 -14
- package/dist/commitment-ledger.d.ts.map +1 -0
- package/dist/compat/checks.d.ts +3 -5
- package/dist/compat/checks.d.ts.map +1 -0
- package/dist/compat/codex-cli-fallback.d.ts +15 -1
- package/dist/compat/codex-cli-fallback.d.ts.map +1 -0
- package/dist/compat/codex-thread-key.d.ts +15 -1
- package/dist/compat/codex-thread-key.d.ts.map +1 -0
- package/dist/compat/types.d.ts +7 -8
- package/dist/compat/types.d.ts.map +1 -0
- package/dist/compounding/engine.d.ts +11 -44
- package/dist/compounding/engine.d.ts.map +1 -0
- package/dist/compounding/engine.js +14 -14
- package/dist/compounding/preference-consolidator.d.ts +10 -37
- package/dist/compounding/preference-consolidator.d.ts.map +1 -0
- package/dist/compression-optimizer.d.ts +10 -29
- package/dist/compression-optimizer.d.ts.map +1 -0
- package/dist/config-discovery.d.ts +4 -5
- package/dist/config-discovery.d.ts.map +1 -0
- package/dist/config-qmd.d.ts +7 -8
- package/dist/config-qmd.d.ts.map +1 -0
- package/dist/config-record.d.ts +2 -3
- package/dist/config-record.d.ts.map +1 -0
- package/dist/config-security.d.ts +2 -3
- package/dist/config-security.d.ts.map +1 -0
- package/dist/config.d.ts +7 -26
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +23 -23
- package/dist/connectors/codex-marketplace.d.ts +124 -0
- package/dist/connectors/codex-marketplace.d.ts.map +1 -0
- package/dist/connectors/codex-materialize-runner.d.ts +7 -27
- package/dist/connectors/codex-materialize-runner.d.ts.map +1 -0
- package/dist/connectors/codex-materialize-runner.js +14 -14
- package/dist/connectors/codex-materialize.d.ts +23 -41
- package/dist/connectors/codex-materialize.d.ts.map +1 -0
- package/dist/connectors/coerce.d.ts +73 -0
- package/dist/connectors/coerce.d.ts.map +1 -0
- package/dist/connectors/droid-mcp.d.ts +122 -0
- package/dist/connectors/droid-mcp.d.ts.map +1 -0
- package/dist/connectors/hermes-shim.d.ts +135 -0
- package/dist/connectors/hermes-shim.d.ts.map +1 -0
- package/dist/connectors/index.d.ts +42 -247
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/index.js +20 -20
- package/dist/connectors/label.d.ts +19 -0
- package/dist/connectors/label.d.ts.map +1 -0
- package/dist/connectors/live/framework.d.ts +169 -0
- package/dist/connectors/live/framework.d.ts.map +1 -0
- package/dist/connectors/live/github.d.ts +156 -0
- package/dist/connectors/live/github.d.ts.map +1 -0
- package/dist/connectors/live/gmail.d.ts +253 -0
- package/dist/connectors/live/gmail.d.ts.map +1 -0
- package/dist/connectors/live/google-drive.d.ts +198 -0
- package/dist/connectors/live/google-drive.d.ts.map +1 -0
- package/dist/connectors/live/index.d.ts +20 -0
- package/dist/connectors/live/index.d.ts.map +1 -0
- package/dist/connectors/live/notion.d.ts +146 -0
- package/dist/connectors/live/notion.d.ts.map +1 -0
- package/dist/connectors/live/registry.d.ts +53 -0
- package/dist/connectors/live/registry.d.ts.map +1 -0
- package/dist/connectors/live/state-store.d.ts +120 -0
- package/dist/connectors/live/state-store.d.ts.map +1 -0
- package/dist/connectors/live/transient-errors.d.ts +45 -0
- package/dist/connectors/live/transient-errors.d.ts.map +1 -0
- package/dist/connectors/materialize-paths.d.ts +15 -0
- package/dist/connectors/materialize-paths.d.ts.map +1 -0
- package/dist/connectors/materialize-skills.d.ts +52 -0
- package/dist/connectors/materialize-skills.d.ts.map +1 -0
- package/dist/connectors/paths.d.ts +78 -0
- package/dist/connectors/paths.d.ts.map +1 -0
- package/dist/connectors/prime-agent.d.ts +13 -0
- package/dist/connectors/prime-agent.d.ts.map +1 -0
- package/dist/connectors-cli.d.ts +170 -2
- package/dist/connectors-cli.d.ts.map +1 -0
- package/dist/console/state.d.ts +154 -0
- package/dist/console/state.d.ts.map +1 -0
- package/dist/console/trace.d.ts +199 -0
- package/dist/console/trace.d.ts.map +1 -0
- package/dist/console/tui.d.ts +106 -0
- package/dist/console/tui.d.ts.map +1 -0
- package/dist/consolidation-operator.d.ts +8 -9
- package/dist/consolidation-operator.d.ts.map +1 -0
- package/dist/consolidation-provenance-check.d.ts +5 -40
- package/dist/consolidation-provenance-check.d.ts.map +1 -0
- package/dist/consolidation-undo.d.ts +10 -44
- package/dist/consolidation-undo.d.ts.map +1 -0
- package/dist/content-hash.d.ts +6 -7
- package/dist/content-hash.d.ts.map +1 -0
- package/dist/context-summary.d.ts +8 -9
- package/dist/context-summary.d.ts.map +1 -0
- package/dist/contradiction/contradiction-judge.d.ts +65 -0
- package/dist/contradiction/contradiction-judge.d.ts.map +1 -0
- package/dist/contradiction/contradiction-review.d.ts +117 -0
- package/dist/contradiction/contradiction-review.d.ts.map +1 -0
- package/dist/contradiction/contradiction-scan.d.ts +74 -0
- package/dist/contradiction/contradiction-scan.d.ts.map +1 -0
- package/dist/contradiction/index.d.ts +12 -41
- package/dist/contradiction/index.d.ts.map +1 -0
- package/dist/contradiction/index.js +11 -11
- package/dist/contradiction/resolution.d.ts +57 -0
- package/dist/contradiction/resolution.d.ts.map +1 -0
- package/dist/contradiction-config.d.ts +5 -6
- package/dist/contradiction-config.d.ts.map +1 -0
- package/dist/converge-config.d.ts +9 -28
- package/dist/converge-config.d.ts.map +1 -0
- package/dist/convergence-refresh.d.ts +5 -40
- package/dist/convergence-refresh.d.ts.map +1 -0
- package/dist/convergence-refresh.js +16 -16
- package/dist/conversation-index/backend.d.ts +12 -31
- package/dist/conversation-index/backend.d.ts.map +1 -0
- package/dist/conversation-index/chunker.d.ts +4 -23
- package/dist/conversation-index/chunker.d.ts.map +1 -0
- package/dist/conversation-index/cleanup.d.ts +2 -3
- package/dist/conversation-index/cleanup.d.ts.map +1 -0
- package/dist/conversation-index/faiss-adapter.d.ts +63 -22
- package/dist/conversation-index/faiss-adapter.d.ts.map +1 -0
- package/dist/conversation-index/indexer.d.ts +9 -31
- package/dist/conversation-index/indexer.d.ts.map +1 -0
- package/dist/conversation-index/search.d.ts +10 -22
- package/dist/conversation-index/search.d.ts.map +1 -0
- package/dist/corpus-read-cancellation.d.ts +3 -4
- package/dist/corpus-read-cancellation.d.ts.map +1 -0
- package/dist/corpus-watermark.d.ts +19 -40
- package/dist/corpus-watermark.d.ts.map +1 -0
- package/dist/corpus-watermark.js +18 -18
- package/dist/correction/correction-access-wiring.d.ts +129 -0
- package/dist/correction/correction-access-wiring.d.ts.map +1 -0
- package/dist/correction/correction-contract.d.ts +220 -0
- package/dist/correction/correction-contract.d.ts.map +1 -0
- package/dist/correction/correction-executor.d.ts +174 -0
- package/dist/correction/correction-executor.d.ts.map +1 -0
- package/dist/correction/correction-planner.d.ts +162 -0
- package/dist/correction/correction-planner.d.ts.map +1 -0
- package/dist/correction/correction-service.d.ts +124 -0
- package/dist/correction/correction-service.d.ts.map +1 -0
- package/dist/correction/index.d.ts +23 -0
- package/dist/correction/index.d.ts.map +1 -0
- package/dist/correction/passive-capture.d.ts +107 -0
- package/dist/correction/passive-capture.d.ts.map +1 -0
- package/dist/correction/passive-correction-detector.d.ts +60 -0
- package/dist/correction/passive-correction-detector.d.ts.map +1 -0
- package/dist/correction/passive-correction-notifications.d.ts +36 -0
- package/dist/correction/passive-correction-notifications.d.ts.map +1 -0
- package/dist/cross-lingual-recall.d.ts +10 -29
- package/dist/cross-lingual-recall.d.ts.map +1 -0
- package/dist/cross-namespace-budget.d.ts +9 -10
- package/dist/cross-namespace-budget.d.ts.map +1 -0
- package/dist/cue-anchors.d.ts +11 -12
- package/dist/cue-anchors.d.ts.map +1 -0
- package/dist/curation/index.d.ts +98 -0
- package/dist/curation/index.d.ts.map +1 -0
- package/dist/dashboard-runtime.d.ts +4 -5
- package/dist/dashboard-runtime.d.ts.map +1 -0
- package/dist/day-summary.d.ts +5 -24
- package/dist/day-summary.d.ts.map +1 -0
- package/dist/dedup/connector-scope.d.ts +28 -0
- package/dist/dedup/connector-scope.d.ts.map +1 -0
- package/dist/dedup/index.d.ts +78 -0
- package/dist/dedup/index.d.ts.map +1 -0
- package/dist/dedup/merge-content.d.ts +24 -0
- package/dist/dedup/merge-content.d.ts.map +1 -0
- package/dist/dedup/merge-count.d.ts +7 -0
- package/dist/dedup/merge-count.d.ts.map +1 -0
- package/dist/dedup/merge-decision.d.ts +26 -0
- package/dist/dedup/merge-decision.d.ts.map +1 -0
- package/dist/dedup/merge-dup.d.ts +8 -0
- package/dist/dedup/merge-dup.d.ts.map +1 -0
- package/dist/dedup/merge-empty.d.ts +15 -0
- package/dist/dedup/merge-empty.d.ts.map +1 -0
- package/dist/dedup/merge-id.d.ts +8 -0
- package/dist/dedup/merge-id.d.ts.map +1 -0
- package/dist/dedup/merge-judge.d.ts +33 -0
- package/dist/dedup/merge-judge.d.ts.map +1 -0
- package/dist/dedup/merge-min-score.d.ts +2 -0
- package/dist/dedup/merge-min-score.d.ts.map +1 -0
- package/dist/dedup/merge-on-write-wire.d.ts +17 -0
- package/dist/dedup/merge-on-write-wire.d.ts.map +1 -0
- package/dist/dedup/merge-on-write.d.ts +32 -0
- package/dist/dedup/merge-on-write.d.ts.map +1 -0
- package/dist/dedup/merge-pair.d.ts +8 -0
- package/dist/dedup/merge-pair.d.ts.map +1 -0
- package/dist/dedup/merge-provenance.d.ts +43 -0
- package/dist/dedup/merge-provenance.d.ts.map +1 -0
- package/dist/dedup/merge-score.d.ts +7 -0
- package/dist/dedup/merge-score.d.ts.map +1 -0
- package/dist/dedup/merge-self.d.ts +13 -0
- package/dist/dedup/merge-self.d.ts.map +1 -0
- package/dist/dedup/merge-threshold.d.ts +13 -0
- package/dist/dedup/merge-threshold.d.ts.map +1 -0
- package/dist/dedup/merge-tie.d.ts +8 -0
- package/dist/dedup/merge-tie.d.ts.map +1 -0
- package/dist/dedup/merge-unique.d.ts +7 -0
- package/dist/dedup/merge-unique.d.ts.map +1 -0
- package/dist/dedup/merge-verdict.d.ts +19 -0
- package/dist/dedup/merge-verdict.d.ts.map +1 -0
- package/dist/dedup/merge.d.ts +122 -0
- package/dist/dedup/merge.d.ts.map +1 -0
- package/dist/dedup/novelty-gate.d.ts +60 -0
- package/dist/dedup/novelty-gate.d.ts.map +1 -0
- package/dist/dedup/semantic.d.ts +86 -0
- package/dist/dedup/semantic.d.ts.map +1 -0
- package/dist/deep-recall-config.d.ts +7 -8
- package/dist/deep-recall-config.d.ts.map +1 -0
- package/dist/deep-recall-config.js +2 -2
- package/dist/deep-recall-http-glue.d.ts +5 -151
- package/dist/deep-recall-http-glue.d.ts.map +1 -0
- package/dist/deep-recall-http-glue.js +6 -6
- package/dist/deep-recall-mcp-tools.d.ts +3 -150
- package/dist/deep-recall-mcp-tools.d.ts.map +1 -0
- package/dist/deep-recall-policy-llm.d.ts +6 -30
- package/dist/deep-recall-policy-llm.d.ts.map +1 -0
- package/dist/deep-recall-renderer.d.ts +3 -9
- package/dist/deep-recall-renderer.d.ts.map +1 -0
- package/dist/deep-recall-seeds.d.ts +7 -30
- package/dist/deep-recall-seeds.d.ts.map +1 -0
- package/dist/deep-recall.d.ts +15 -17
- package/dist/deep-recall.d.ts.map +1 -0
- package/dist/delinearize.d.ts +5 -25
- package/dist/delinearize.d.ts.map +1 -0
- package/dist/dependency-propagation-config.d.ts +3 -22
- package/dist/dependency-propagation-config.d.ts.map +1 -0
- package/dist/deterministic-order.d.ts +3 -4
- package/dist/deterministic-order.d.ts.map +1 -0
- package/dist/direct-answer-wiring.d.ts +8 -28
- package/dist/direct-answer-wiring.d.ts.map +1 -0
- package/dist/direct-answer.d.ts +10 -30
- package/dist/direct-answer.d.ts.map +1 -0
- package/dist/directory-sidecars.d.ts +17 -18
- package/dist/directory-sidecars.d.ts.map +1 -0
- package/dist/embedding-fallback.d.ts +6 -25
- package/dist/embedding-fallback.d.ts.map +1 -0
- package/dist/emit-legacy-tools.d.ts +3 -4
- package/dist/emit-legacy-tools.d.ts.map +1 -0
- package/dist/enrichment/audit.d.ts +27 -0
- package/dist/enrichment/audit.d.ts.map +1 -0
- package/dist/enrichment/index.d.ts +8 -177
- package/dist/enrichment/index.d.ts.map +1 -0
- package/dist/enrichment/pipeline.d.ts +15 -0
- package/dist/enrichment/pipeline.d.ts.map +1 -0
- package/dist/enrichment/provider-registry.d.ts +28 -0
- package/dist/enrichment/provider-registry.d.ts.map +1 -0
- package/dist/enrichment/types.d.ts +65 -0
- package/dist/enrichment/types.d.ts.map +1 -0
- package/dist/enrichment/web-search-provider.d.ts +26 -0
- package/dist/enrichment/web-search-provider.d.ts.map +1 -0
- package/dist/entity-id-normalization.d.ts +3 -4
- package/dist/entity-id-normalization.d.ts.map +1 -0
- package/dist/entity-origin-fields.d.ts +6 -24
- package/dist/entity-origin-fields.d.ts.map +1 -0
- package/dist/entity-recall-cancellation.d.ts +6 -7
- package/dist/entity-recall-cancellation.d.ts.map +1 -0
- package/dist/entity-retrieval-boundaries.d.ts +2 -3
- package/dist/entity-retrieval-boundaries.d.ts.map +1 -0
- package/dist/entity-retrieval-i18n.d.ts +5 -6
- package/dist/entity-retrieval-i18n.d.ts.map +1 -0
- package/dist/entity-retrieval.d.ts +8 -41
- package/dist/entity-retrieval.d.ts.map +1 -0
- package/dist/entity-retrieval.js +14 -14
- package/dist/entity-schema.d.ts +9 -28
- package/dist/entity-schema.d.ts.map +1 -0
- package/dist/episodic-context.d.ts +10 -30
- package/dist/episodic-context.d.ts.map +1 -0
- package/dist/eval-trajectory-contracts.d.ts +48 -68
- package/dist/eval-trajectory-contracts.d.ts.map +1 -0
- package/dist/eval-trajectory-store.d.ts +7 -28
- package/dist/eval-trajectory-store.d.ts.map +1 -0
- package/dist/eval-trajectory.d.ts +9 -30
- package/dist/eval-trajectory.d.ts.map +1 -0
- package/dist/evals.d.ts +29 -30
- package/dist/evals.d.ts.map +1 -0
- package/dist/event-order-query.d.ts +2 -3
- package/dist/event-order-query.d.ts.map +1 -0
- package/dist/event-order-recall.d.ts +6 -8
- package/dist/event-order-recall.d.ts.map +1 -0
- package/dist/event-time.d.ts +7 -8
- package/dist/event-time.d.ts.map +1 -0
- package/dist/evidence-pack.d.ts +7 -8
- package/dist/evidence-pack.d.ts.map +1 -0
- package/dist/experience/session-experience-config.d.ts +19 -0
- package/dist/experience/session-experience-config.d.ts.map +1 -0
- package/dist/experience/session-experience-mining.d.ts +31 -0
- package/dist/experience/session-experience-mining.d.ts.map +1 -0
- package/dist/experience/session-experience-recall.d.ts +19 -0
- package/dist/experience/session-experience-recall.d.ts.map +1 -0
- package/dist/experience/session-experience.d.ts +74 -0
- package/dist/experience/session-experience.d.ts.map +1 -0
- package/dist/explicit-capture.d.ts +20 -128
- package/dist/explicit-capture.d.ts.map +1 -0
- package/dist/explicit-capture.js +1 -1
- package/dist/explicit-cue-recall.d.ts +17 -19
- package/dist/explicit-cue-recall.d.ts.map +1 -0
- package/dist/external-wiki-access.d.ts +4 -152
- package/dist/external-wiki-access.d.ts.map +1 -0
- package/dist/external-wiki-access.js +66 -61
- package/dist/external-wiki-cli.d.ts +4 -5
- package/dist/external-wiki-cli.d.ts.map +1 -0
- package/dist/external-wiki-collection-registration.d.ts +7 -27
- package/dist/external-wiki-collection-registration.d.ts.map +1 -0
- package/dist/external-wiki-collection.d.ts +9 -29
- package/dist/external-wiki-collection.d.ts.map +1 -0
- package/dist/external-wiki-config.d.ts +3 -4
- package/dist/external-wiki-config.d.ts.map +1 -0
- package/dist/external-wiki-guard.d.ts +6 -7
- package/dist/external-wiki-guard.d.ts.map +1 -0
- package/dist/external-wiki-mcp-tools.d.ts +3 -149
- package/dist/external-wiki-mcp-tools.d.ts.map +1 -0
- package/dist/external-wiki-search.d.ts +12 -13
- package/dist/external-wiki-search.d.ts.map +1 -0
- package/dist/external-wiki.d.ts +12 -13
- package/dist/external-wiki.d.ts.map +1 -0
- package/dist/extraction-error-classification.d.ts +5 -24
- package/dist/extraction-error-classification.d.ts.map +1 -0
- package/dist/extraction-evidence-class.d.ts +13 -33
- package/dist/extraction-evidence-class.d.ts.map +1 -0
- package/dist/extraction-evidence-class.js +2 -2
- package/dist/extraction-faithfulness.d.ts +23 -46
- package/dist/extraction-faithfulness.d.ts.map +1 -0
- package/dist/extraction-judge-telemetry.d.ts +9 -36
- package/dist/extraction-judge-telemetry.d.ts.map +1 -0
- package/dist/extraction-judge-training.d.ts +9 -36
- package/dist/extraction-judge-training.d.ts.map +1 -0
- package/dist/extraction-judge.d.ts +20 -44
- package/dist/extraction-judge.d.ts.map +1 -0
- package/dist/extraction-liveness.d.ts +161 -18
- package/dist/extraction-liveness.d.ts.map +1 -0
- package/dist/extraction-normalization.d.ts +7 -26
- package/dist/extraction-normalization.d.ts.map +1 -0
- package/dist/extraction-prompt.d.ts +14 -34
- package/dist/extraction-prompt.d.ts.map +1 -0
- package/dist/extraction-redaction-rules.d.ts +6 -7
- package/dist/extraction-redaction-rules.d.ts.map +1 -0
- package/dist/extraction-source-grounding-helpers.d.ts +31 -32
- package/dist/extraction-source-grounding-helpers.d.ts.map +1 -0
- package/dist/extraction-source-grounding-rules.d.ts +6 -25
- package/dist/extraction-source-grounding-rules.d.ts.map +1 -0
- package/dist/extraction-source-grounding.d.ts +7 -25
- package/dist/extraction-source-grounding.d.ts.map +1 -0
- package/dist/extraction-source-grounding.js +3 -3
- package/dist/extraction-span-bench.d.ts +3 -4
- package/dist/extraction-span-bench.d.ts.map +1 -0
- package/dist/extraction-span-clip.d.ts +5 -6
- package/dist/extraction-span-clip.d.ts.map +1 -0
- package/dist/extraction-span-config.d.ts +40 -18
- package/dist/extraction-span-config.d.ts.map +1 -0
- package/dist/extraction-span-contains.d.ts +2 -3
- package/dist/extraction-span-contains.d.ts.map +1 -0
- package/dist/extraction-span-fallback.d.ts +5 -6
- package/dist/extraction-span-fallback.d.ts.map +1 -0
- package/dist/extraction-span-gap.d.ts +2 -3
- package/dist/extraction-span-gap.d.ts.map +1 -0
- package/dist/extraction-span-gate.d.ts +7 -8
- package/dist/extraction-span-gate.d.ts.map +1 -0
- package/dist/extraction-span-join.d.ts +5 -6
- package/dist/extraction-span-join.d.ts.map +1 -0
- package/dist/extraction-span-length.d.ts +2 -3
- package/dist/extraction-span-length.d.ts.map +1 -0
- package/dist/extraction-span-materialize.d.ts +18 -37
- package/dist/extraction-span-materialize.d.ts.map +1 -0
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction-span-overlap.d.ts +2 -3
- package/dist/extraction-span-overlap.d.ts.map +1 -0
- package/dist/extraction-span-provenance.d.ts +4 -5
- package/dist/extraction-span-provenance.d.ts.map +1 -0
- package/dist/extraction-span-shift.d.ts +2 -3
- package/dist/extraction-span-shift.d.ts.map +1 -0
- package/dist/extraction-span-slice.d.ts +2 -3
- package/dist/extraction-span-slice.d.ts.map +1 -0
- package/dist/extraction-span-source-hash.d.ts +5 -6
- package/dist/extraction-span-source-hash.d.ts.map +1 -0
- package/dist/extraction-span-tokens.d.ts +4 -5
- package/dist/extraction-span-tokens.d.ts.map +1 -0
- package/dist/extraction-span-validate.d.ts +5 -6
- package/dist/extraction-span-validate.d.ts.map +1 -0
- package/dist/extraction-span-wire.d.ts +5 -25
- package/dist/extraction-span-wire.d.ts.map +1 -0
- package/dist/extraction-span.d.ts +4 -5
- package/dist/extraction-span.d.ts.map +1 -0
- package/dist/extraction.d.ts +11 -44
- package/dist/extraction.d.ts.map +1 -0
- package/dist/extraction.js +26 -26
- package/dist/faithfulness-config.d.ts +3 -4
- package/dist/faithfulness-config.d.ts.map +1 -0
- package/dist/fallback-llm-codex-subscription.d.ts +23 -42
- package/dist/fallback-llm-codex-subscription.d.ts.map +1 -0
- package/dist/fallback-llm.d.ts +9 -30
- package/dist/fallback-llm.d.ts.map +1 -0
- package/dist/focused-list-recall.d.ts +5 -8
- package/dist/focused-list-recall.d.ts.map +1 -0
- package/dist/graph-append-error.d.ts +3 -27
- package/dist/graph-append-error.d.ts.map +1 -0
- package/dist/graph-dashboard-diff.d.ts +5 -28
- package/dist/graph-dashboard-diff.d.ts.map +1 -0
- package/dist/graph-dashboard-key.d.ts +3 -26
- package/dist/graph-dashboard-key.d.ts.map +1 -0
- package/dist/graph-dashboard-parser.d.ts +6 -29
- package/dist/graph-dashboard-parser.d.ts.map +1 -0
- package/dist/graph-edge-decay-ROSUPDX3.js +30 -0
- package/dist/graph-edge-reinforcement.d.ts +12 -36
- package/dist/graph-edge-reinforcement.d.ts.map +1 -0
- package/dist/graph-events.d.ts +13 -16
- package/dist/graph-events.d.ts.map +1 -0
- package/dist/graph-jsonl.d.ts +8 -31
- package/dist/graph-jsonl.d.ts.map +1 -0
- package/dist/graph-jsonl.js +3 -3
- package/dist/graph-path-reconstruction.d.ts +22 -22
- package/dist/graph-path-reconstruction.d.ts.map +1 -0
- package/dist/graph-path-scoring-config.d.ts +3 -4
- package/dist/graph-path-scoring-config.d.ts.map +1 -0
- package/dist/graph-path-scoring.d.ts +8 -30
- package/dist/graph-path-scoring.d.ts.map +1 -0
- package/dist/graph-recall.d.ts +7 -10
- package/dist/graph-recall.d.ts.map +1 -0
- package/dist/graph-retrieval.d.ts +19 -20
- package/dist/graph-retrieval.d.ts.map +1 -0
- package/dist/graph-snapshot.d.ts +14 -38
- package/dist/graph-snapshot.d.ts.map +1 -0
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph-write-lock.d.ts +7 -10
- package/dist/graph-write-lock.d.ts.map +1 -0
- package/dist/graph.d.ts +325 -22
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +2 -2
- package/dist/harmonic-construction.d.ts +11 -13
- package/dist/harmonic-construction.d.ts.map +1 -0
- package/dist/harmonic-retrieval.d.ts +10 -12
- package/dist/harmonic-retrieval.d.ts.map +1 -0
- package/dist/harmonic-retrieval.js +1 -1
- package/dist/himem.d.ts +3 -4
- package/dist/himem.d.ts.map +1 -0
- package/dist/host-embedding-provider.d.ts +7 -8
- package/dist/host-embedding-provider.d.ts.map +1 -0
- package/dist/http-retry.d.ts +9 -10
- package/dist/http-retry.d.ts.map +1 -0
- package/dist/hygiene.d.ts +4 -5
- package/dist/hygiene.d.ts.map +1 -0
- package/dist/identity-continuity.d.ts +9 -11
- package/dist/identity-continuity.d.ts.map +1 -0
- package/dist/importance.d.ts +6 -26
- package/dist/importance.d.ts.map +1 -0
- package/dist/importers/base.d.ts +261 -0
- package/dist/importers/base.d.ts.map +1 -0
- package/dist/importers/index.d.ts +3 -280
- package/dist/importers/index.d.ts.map +1 -0
- package/dist/importers/test-utils.d.ts +5 -24
- package/dist/importers/test-utils.d.ts.map +1 -0
- package/dist/in-flight-reads.d.ts +10 -29
- package/dist/in-flight-reads.d.ts.map +1 -0
- package/dist/included-memories.d.ts +6 -7
- package/dist/included-memories.d.ts.map +1 -0
- package/dist/index.d.ts +185 -9836
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +275 -229
- package/dist/inline-script.d.ts +2 -3
- package/dist/inline-script.d.ts.map +1 -0
- package/dist/intent.d.ts +7 -26
- package/dist/intent.d.ts.map +1 -0
- package/dist/json-extract.d.ts +3 -4
- package/dist/json-extract.d.ts.map +1 -0
- package/dist/json-store.d.ts +9 -9
- package/dist/json-store.d.ts.map +1 -0
- package/dist/lcm/archive.d.ts +11 -13
- package/dist/lcm/archive.d.ts.map +1 -0
- package/dist/lcm/dag.d.ts +5 -7
- package/dist/lcm/dag.d.ts.map +1 -0
- package/dist/lcm/engine.d.ts +10 -32
- package/dist/lcm/engine.d.ts.map +1 -0
- package/dist/lcm/engine.js +4 -4
- package/dist/lcm/evidence-identity.d.ts +20 -0
- package/dist/lcm/evidence-identity.d.ts.map +1 -0
- package/dist/lcm/index.d.ts +9 -52
- package/dist/lcm/index.d.ts.map +1 -0
- package/dist/lcm/index.js +13 -13
- package/dist/lcm/queue.d.ts +7 -10
- package/dist/lcm/queue.d.ts.map +1 -0
- package/dist/lcm/recall.d.ts +8 -13
- package/dist/lcm/recall.d.ts.map +1 -0
- package/dist/lcm/schema.d.ts +5 -8
- package/dist/lcm/schema.d.ts.map +1 -0
- package/dist/lcm/summarizer.d.ts +7 -11
- package/dist/lcm/summarizer.d.ts.map +1 -0
- package/dist/lcm/tools.d.ts +4 -30
- package/dist/lcm/tools.d.ts.map +1 -0
- package/dist/lcm-fallback-read.d.ts +4 -5
- package/dist/lcm-fallback-read.d.ts.map +1 -0
- package/dist/lifecycle/seed-graduation-config-types.d.ts +21 -0
- package/dist/lifecycle/seed-graduation-config-types.d.ts.map +1 -0
- package/dist/lifecycle/seed-graduation.d.ts +97 -0
- package/dist/lifecycle/seed-graduation.d.ts.map +1 -0
- package/dist/lifecycle/tombstones.d.ts +389 -0
- package/dist/lifecycle/tombstones.d.ts.map +1 -0
- package/dist/lifecycle.d.ts +14 -33
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/live-connectors-runner.d.ts +11 -29
- package/dist/live-connectors-runner.d.ts.map +1 -0
- package/dist/local-llm-config.d.ts +5 -7
- package/dist/local-llm-config.d.ts.map +1 -0
- package/dist/local-llm-config.js +1 -1
- package/dist/local-llm-helpers.d.ts +102 -20
- package/dist/local-llm-helpers.d.ts.map +1 -0
- package/dist/local-llm-transport.d.ts +4 -6
- package/dist/local-llm-transport.d.ts.map +1 -0
- package/dist/local-llm.d.ts +145 -20
- package/dist/local-llm.d.ts.map +1 -0
- package/dist/local-model-endpoint.d.ts +10 -29
- package/dist/local-model-endpoint.d.ts.map +1 -0
- package/dist/location/access-operations.d.ts +9 -0
- package/dist/location/access-operations.d.ts.map +1 -0
- package/dist/location/backfill.d.ts +57 -0
- package/dist/location/backfill.d.ts.map +1 -0
- package/dist/location/cli.d.ts +67 -0
- package/dist/location/cli.d.ts.map +1 -0
- package/dist/location/config.d.ts +11 -0
- package/dist/location/config.d.ts.map +1 -0
- package/dist/location/http-glue.d.ts +20 -0
- package/dist/location/http-glue.d.ts.map +1 -0
- package/dist/location/index.d.ts +21 -534
- package/dist/location/index.d.ts.map +1 -0
- package/dist/location/index.js +17 -17
- package/dist/location/intervals.d.ts +61 -0
- package/dist/location/intervals.d.ts.map +1 -0
- package/dist/location/matching.d.ts +124 -0
- package/dist/location/matching.d.ts.map +1 -0
- package/dist/location/mcp-tools.d.ts +12 -0
- package/dist/location/mcp-tools.d.ts.map +1 -0
- package/dist/location/parse-companions.d.ts +7 -0
- package/dist/location/parse-companions.d.ts.map +1 -0
- package/dist/location/pipeline.d.ts +44 -0
- package/dist/location/pipeline.d.ts.map +1 -0
- package/dist/location/provider-setup.d.ts +33 -0
- package/dist/location/provider-setup.d.ts.map +1 -0
- package/dist/location/registry.d.ts +15 -0
- package/dist/location/registry.d.ts.map +1 -0
- package/dist/location/scheduler.d.ts +48 -0
- package/dist/location/scheduler.d.ts.map +1 -0
- package/dist/location/store.d.ts +95 -0
- package/dist/location/store.d.ts.map +1 -0
- package/dist/location/surfaces.d.ts +76 -0
- package/dist/location/surfaces.d.ts.map +1 -0
- package/dist/location/tagging.d.ts +116 -0
- package/dist/location/tagging.d.ts.map +1 -0
- package/dist/location/types.d.ts +109 -0
- package/dist/location/types.d.ts.map +1 -0
- package/dist/logger.d.ts +7 -8
- package/dist/logger.d.ts.map +1 -0
- package/dist/maintenance/archive-observations.d.ts +5 -5
- package/dist/maintenance/archive-observations.d.ts.map +1 -0
- package/dist/maintenance/atomic-file.d.ts +4 -5
- package/dist/maintenance/atomic-file.d.ts.map +1 -0
- package/dist/maintenance/backup-stamp.d.ts +2 -3
- package/dist/maintenance/backup-stamp.d.ts.map +1 -0
- package/dist/maintenance/day-summary-cron.d.ts +20 -0
- package/dist/maintenance/day-summary-cron.d.ts.map +1 -0
- package/dist/maintenance/dreams-ledger.d.ts +172 -0
- package/dist/maintenance/dreams-ledger.d.ts.map +1 -0
- package/dist/maintenance/first-start-migration.d.ts +61 -0
- package/dist/maintenance/first-start-migration.d.ts.map +1 -0
- package/dist/maintenance/forget.d.ts +59 -0
- package/dist/maintenance/forget.d.ts.map +1 -0
- package/dist/maintenance/graph-edge-decay.d.ts +122 -0
- package/dist/maintenance/graph-edge-decay.d.ts.map +1 -0
- package/dist/maintenance/memory-governance-cron.d.ts +9 -10
- package/dist/maintenance/memory-governance-cron.d.ts.map +1 -0
- package/dist/maintenance/memory-governance.d.ts +25 -43
- package/dist/maintenance/memory-governance.d.ts.map +1 -0
- package/dist/maintenance/memory-governance.js +14 -14
- package/dist/maintenance/migrate-observations.d.ts +4 -5
- package/dist/maintenance/migrate-observations.d.ts.map +1 -0
- package/dist/maintenance/namespace-maintenance-fanout.d.ts +132 -0
- package/dist/maintenance/namespace-maintenance-fanout.d.ts.map +1 -0
- package/dist/maintenance/namespace-planner.d.ts +96 -0
- package/dist/maintenance/namespace-planner.d.ts.map +1 -0
- package/dist/maintenance/observation-ledger-utils.d.ts +5 -6
- package/dist/maintenance/observation-ledger-utils.d.ts.map +1 -0
- package/dist/maintenance/pattern-reinforcement.d.ts +129 -0
- package/dist/maintenance/pattern-reinforcement.d.ts.map +1 -0
- package/dist/maintenance/projection-support.d.ts +76 -0
- package/dist/maintenance/projection-support.d.ts.map +1 -0
- package/dist/maintenance/purge.d.ts +85 -0
- package/dist/maintenance/purge.d.ts.map +1 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger-cli.d.ts +24 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger-cli.d.ts.map +1 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +11 -43
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts.map +1 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -14
- package/dist/maintenance/rebuild-memory-projection.d.ts +14 -72
- package/dist/maintenance/rebuild-memory-projection.d.ts.map +1 -0
- package/dist/maintenance/rebuild-memory-projection.js +15 -15
- package/dist/maintenance/rebuild-observations.d.ts +4 -5
- package/dist/maintenance/rebuild-observations.d.ts.map +1 -0
- package/dist/maintenance/tier-stats.d.ts +59 -0
- package/dist/maintenance/tier-stats.d.ts.map +1 -0
- package/dist/mcp-memory-inspector-app.d.ts +15 -158
- package/dist/mcp-memory-inspector-app.d.ts.map +1 -0
- package/dist/mcp-read-only-tools.d.ts +2 -3
- package/dist/mcp-read-only-tools.d.ts.map +1 -0
- package/dist/mcp-read-only-tools.js +1 -1
- package/dist/meetings/build-scheduler.d.ts +43 -0
- package/dist/meetings/build-scheduler.d.ts.map +1 -0
- package/dist/meetings/build.d.ts +137 -0
- package/dist/meetings/build.d.ts.map +1 -0
- package/dist/meetings/cli.d.ts +37 -0
- package/dist/meetings/cli.d.ts.map +1 -0
- package/dist/meetings/config.d.ts +18 -0
- package/dist/meetings/config.d.ts.map +1 -0
- package/dist/meetings/day-source.d.ts +103 -0
- package/dist/meetings/day-source.d.ts.map +1 -0
- package/dist/meetings/detect.d.ts +33 -0
- package/dist/meetings/detect.d.ts.map +1 -0
- package/dist/meetings/errors.d.ts +10 -0
- package/dist/meetings/errors.d.ts.map +1 -0
- package/dist/meetings/fuse.d.ts +30 -0
- package/dist/meetings/fuse.d.ts.map +1 -0
- package/dist/meetings/http-glue.d.ts +37 -0
- package/dist/meetings/http-glue.d.ts.map +1 -0
- package/dist/meetings/index.d.ts +20 -0
- package/dist/meetings/index.d.ts.map +1 -0
- package/dist/meetings/mcp-tools.d.ts +10 -0
- package/dist/meetings/mcp-tools.d.ts.map +1 -0
- package/dist/meetings/memory-gen.d.ts +157 -0
- package/dist/meetings/memory-gen.d.ts.map +1 -0
- package/dist/meetings/memory-generator.d.ts +113 -0
- package/dist/meetings/memory-generator.d.ts.map +1 -0
- package/dist/meetings/service.d.ts +80 -0
- package/dist/meetings/service.d.ts.map +1 -0
- package/dist/meetings/store.d.ts +121 -0
- package/dist/meetings/store.d.ts.map +1 -0
- package/dist/meetings/summary-extractor.d.ts +96 -0
- package/dist/meetings/summary-extractor.d.ts.map +1 -0
- package/dist/meetings/types.d.ts +155 -0
- package/dist/meetings/types.d.ts.map +1 -0
- package/dist/memory-action-policy.d.ts +6 -25
- package/dist/memory-action-policy.d.ts.map +1 -0
- package/dist/memory-age.d.ts +16 -17
- package/dist/memory-age.d.ts.map +1 -0
- package/dist/memory-browse-http-glue.d.ts +5 -151
- package/dist/memory-browse-http-glue.d.ts.map +1 -0
- package/dist/memory-browse-http-glue.js +2 -2
- package/dist/memory-browse-mcp-tools.d.ts +3 -150
- package/dist/memory-browse-mcp-tools.d.ts.map +1 -0
- package/dist/memory-browse-operations.d.ts +11 -2
- package/dist/memory-browse-operations.d.ts.map +1 -0
- package/dist/memory-browse-operations.js +66 -61
- package/dist/memory-browse.d.ts +16 -36
- package/dist/memory-browse.d.ts.map +1 -0
- package/dist/memory-browse.js +4 -4
- package/dist/memory-cache.d.ts +27 -46
- package/dist/memory-cache.d.ts.map +1 -0
- package/dist/memory-controller.d.ts +29 -50
- package/dist/memory-controller.d.ts.map +1 -0
- package/dist/memory-corpus-version.d.ts +3 -4
- package/dist/memory-corpus-version.d.ts.map +1 -0
- package/dist/memory-extension/claude-code-publisher.d.ts +18 -0
- package/dist/memory-extension/claude-code-publisher.d.ts.map +1 -0
- package/dist/memory-extension/codex-publisher.d.ts +22 -0
- package/dist/memory-extension/codex-publisher.d.ts.map +1 -0
- package/dist/memory-extension/hermes-publisher.d.ts +18 -0
- package/dist/memory-extension/hermes-publisher.d.ts.map +1 -0
- package/dist/memory-extension/index.d.ts +57 -0
- package/dist/memory-extension/index.d.ts.map +1 -0
- package/dist/memory-extension/shared-instructions.d.ts +30 -0
- package/dist/memory-extension/shared-instructions.d.ts.map +1 -0
- package/dist/memory-extension/types.d.ts +88 -0
- package/dist/memory-extension/types.d.ts.map +1 -0
- package/dist/memory-extension-host/host-discovery.d.ts +38 -0
- package/dist/memory-extension-host/host-discovery.d.ts.map +1 -0
- package/dist/memory-extension-host/index.d.ts +7 -0
- package/dist/memory-extension-host/index.d.ts.map +1 -0
- package/dist/memory-extension-host/render-extensions-block.d.ts +23 -0
- package/dist/memory-extension-host/render-extensions-block.d.ts.map +1 -0
- package/dist/memory-extension-host/types.d.ts +20 -0
- package/dist/memory-extension-host/types.d.ts.map +1 -0
- package/dist/memory-lifecycle-ledger-utils.d.ts +19 -38
- package/dist/memory-lifecycle-ledger-utils.d.ts.map +1 -0
- package/dist/memory-projection-format.d.ts +3 -4
- package/dist/memory-projection-format.d.ts.map +1 -0
- package/dist/memory-projection-mutations.d.ts +3 -4
- package/dist/memory-projection-mutations.d.ts.map +1 -0
- package/dist/memory-projection-store.d.ts +35 -54
- package/dist/memory-projection-store.d.ts.map +1 -0
- package/dist/memory-provenance.d.ts +10 -29
- package/dist/memory-provenance.d.ts.map +1 -0
- package/dist/memory-snapshot.d.ts +3 -22
- package/dist/memory-snapshot.d.ts.map +1 -0
- package/dist/memory-subject-cli.d.ts +9 -156
- package/dist/memory-subject-cli.d.ts.map +1 -0
- package/dist/memory-subject.d.ts +132 -145
- package/dist/memory-subject.d.ts.map +1 -0
- package/dist/memory-worth-bench.d.ts +4 -5
- package/dist/memory-worth-bench.d.ts.map +1 -0
- package/dist/memory-worth-filter.d.ts +8 -11
- package/dist/memory-worth-filter.d.ts.map +1 -0
- package/dist/memory-worth-outcomes.d.ts +11 -45
- package/dist/memory-worth-outcomes.d.ts.map +1 -0
- package/dist/memory-worth.d.ts +4 -5
- package/dist/memory-worth.d.ts.map +1 -0
- package/dist/message-parts/index.d.ts +15 -16
- package/dist/message-parts/index.d.ts.map +1 -0
- package/dist/migrate/from-engram.d.ts +6 -7
- package/dist/migrate/from-engram.d.ts.map +1 -0
- package/dist/model-registry.d.ts +3 -4
- package/dist/model-registry.d.ts.map +1 -0
- package/dist/models-json.d.ts +5 -24
- package/dist/models-json.d.ts.map +1 -0
- package/dist/namespaces/catalog.d.ts +473 -0
- package/dist/namespaces/catalog.d.ts.map +1 -0
- package/dist/namespaces/identity.d.ts +5 -0
- package/dist/namespaces/identity.d.ts.map +1 -0
- package/dist/namespaces/migrate.d.ts +11 -46
- package/dist/namespaces/migrate.d.ts.map +1 -0
- package/dist/namespaces/migrate.js +15 -15
- package/dist/namespaces/path.d.ts +3 -0
- package/dist/namespaces/path.d.ts.map +1 -0
- package/dist/namespaces/principal.d.ts +9 -28
- package/dist/namespaces/principal.d.ts.map +1 -0
- package/dist/namespaces/scope-profile-config.d.ts +5 -0
- package/dist/namespaces/scope-profile-config.d.ts.map +1 -0
- package/dist/namespaces/scope-profiles.d.ts +46 -0
- package/dist/namespaces/scope-profiles.d.ts.map +1 -0
- package/dist/namespaces/search.d.ts +10 -28
- package/dist/namespaces/search.d.ts.map +1 -0
- package/dist/namespaces/search.js +5 -5
- package/dist/namespaces/storage.d.ts +8 -41
- package/dist/namespaces/storage.d.ts.map +1 -0
- package/dist/namespaces/storage.js +14 -14
- package/dist/native-binding-hint.d.ts +3 -4
- package/dist/native-binding-hint.d.ts.map +1 -0
- package/dist/native-knowledge.d.ts +15 -34
- package/dist/native-knowledge.d.ts.map +1 -0
- package/dist/negative.d.ts +3 -4
- package/dist/negative.d.ts.map +1 -0
- package/dist/network/tailscale.d.ts +7 -8
- package/dist/network/tailscale.d.ts.map +1 -0
- package/dist/network/webdav.d.ts +9 -10
- package/dist/network/webdav.d.ts.map +1 -0
- package/dist/objective-state-writers.d.ts +8 -9
- package/dist/objective-state-writers.d.ts.map +1 -0
- package/dist/objective-state.d.ts +15 -16
- package/dist/objective-state.d.ts.map +1 -0
- package/dist/offline-sync-exclude-globs.d.ts +3 -4
- package/dist/offline-sync-exclude-globs.d.ts.map +1 -0
- package/dist/offline-sync-file-io.d.ts +8 -9
- package/dist/offline-sync-file-io.d.ts.map +1 -0
- package/dist/offline-sync-impression-drain.d.ts +8 -26
- package/dist/offline-sync-impression-drain.d.ts.map +1 -0
- package/dist/offline-sync-impression-drain.js +2 -2
- package/dist/offline-sync.d.ts +57 -58
- package/dist/offline-sync.d.ts.map +1 -0
- package/dist/okf/cli.d.ts +10 -0
- package/dist/okf/cli.d.ts.map +1 -0
- package/dist/okf/config.d.ts +11 -0
- package/dist/okf/config.d.ts.map +1 -0
- package/dist/okf/index-files.d.ts +7 -0
- package/dist/okf/index-files.d.ts.map +1 -0
- package/dist/okf/lint.d.ts +12 -0
- package/dist/okf/lint.d.ts.map +1 -0
- package/dist/okf/render.d.ts +29 -0
- package/dist/okf/render.d.ts.map +1 -0
- package/dist/okf/sweep.d.ts +9 -0
- package/dist/okf/sweep.d.ts.map +1 -0
- package/dist/okf/type-mapping.d.ts +30 -0
- package/dist/okf/type-mapping.d.ts.map +1 -0
- package/dist/onboarding/index.d.ts +63 -0
- package/dist/onboarding/index.d.ts.map +1 -0
- package/dist/openai-chat-compat.d.ts +6 -7
- package/dist/openai-chat-compat.d.ts.map +1 -0
- package/dist/operator-doctor-corpus.d.ts +8 -29
- package/dist/operator-doctor-corpus.d.ts.map +1 -0
- package/dist/operator-doctor-corpus.js +21 -21
- package/dist/operator-doctor-replica.d.ts +8 -29
- package/dist/operator-doctor-replica.d.ts.map +1 -0
- package/dist/operator-doctor-replica.js +4 -4
- package/dist/operator-doctor-types.d.ts +2 -3
- package/dist/operator-doctor-types.d.ts.map +1 -0
- package/dist/operator-toolkit.d.ts +43 -75
- package/dist/operator-toolkit.d.ts.map +1 -0
- package/dist/operator-toolkit.js +37 -37
- package/dist/opik-exporter.d.ts +6 -8
- package/dist/opik-exporter.d.ts.map +1 -0
- package/dist/orchestration/compression-guideline-coordinator.d.ts +6 -40
- package/dist/orchestration/compression-guideline-coordinator.d.ts.map +1 -0
- package/dist/orchestration/consolidation-run.d.ts +93 -0
- package/dist/orchestration/consolidation-run.d.ts.map +1 -0
- package/dist/orchestration/contradiction-linking-coordinator.d.ts +102 -0
- package/dist/orchestration/contradiction-linking-coordinator.d.ts.map +1 -0
- package/dist/orchestration/conversation-index-coordinator.d.ts +99 -0
- package/dist/orchestration/conversation-index-coordinator.d.ts.map +1 -0
- package/dist/orchestration/dependency-propagation-delivery.d.ts +129 -0
- package/dist/orchestration/dependency-propagation-delivery.d.ts.map +1 -0
- package/dist/orchestration/dependency-propagation-queue-state.d.ts +15 -0
- package/dist/orchestration/dependency-propagation-queue-state.d.ts.map +1 -0
- package/dist/orchestration/dependency-propagation-recovery-replay.d.ts +49 -0
- package/dist/orchestration/dependency-propagation-recovery-replay.d.ts.map +1 -0
- package/dist/orchestration/dependency-propagation-replay-reconciliation.d.ts +25 -0
- package/dist/orchestration/dependency-propagation-replay-reconciliation.d.ts.map +1 -0
- package/dist/orchestration/dependency-propagation.d.ts +64 -0
- package/dist/orchestration/dependency-propagation.d.ts.map +1 -0
- package/dist/orchestration/dependency-revalidation.d.ts +45 -0
- package/dist/orchestration/dependency-revalidation.d.ts.map +1 -0
- package/dist/orchestration/entity-synthesis-coordinator.d.ts +64 -0
- package/dist/orchestration/entity-synthesis-coordinator.d.ts.map +1 -0
- package/dist/orchestration/episodic-context-section.d.ts +30 -0
- package/dist/orchestration/episodic-context-section.d.ts.map +1 -0
- package/dist/orchestration/extraction-anchor-snapshot.d.ts +20 -0
- package/dist/orchestration/extraction-anchor-snapshot.d.ts.map +1 -0
- package/dist/orchestration/extraction-envelope.d.ts +40 -0
- package/dist/orchestration/extraction-envelope.d.ts.map +1 -0
- package/dist/orchestration/extraction-injection-gate.d.ts +51 -0
- package/dist/orchestration/extraction-injection-gate.d.ts.map +1 -0
- package/dist/orchestration/extraction-origin-context.d.ts +19 -0
- package/dist/orchestration/extraction-origin-context.d.ts.map +1 -0
- package/dist/orchestration/extraction-persist-deps.d.ts +76 -0
- package/dist/orchestration/extraction-persist-deps.d.ts.map +1 -0
- package/dist/orchestration/extraction-persist-promotion.d.ts +203 -0
- package/dist/orchestration/extraction-persist-promotion.d.ts.map +1 -0
- package/dist/orchestration/extraction-persist.d.ts +19 -0
- package/dist/orchestration/extraction-persist.d.ts.map +1 -0
- package/dist/orchestration/extraction-queue-coordinator.d.ts +103 -0
- package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -0
- package/dist/orchestration/extraction-run-helpers.d.ts +123 -0
- package/dist/orchestration/extraction-run-helpers.d.ts.map +1 -0
- package/dist/orchestration/extraction-run.d.ts +174 -0
- package/dist/orchestration/extraction-run.d.ts.map +1 -0
- package/dist/orchestration/extraction-shutdown.d.ts +6 -0
- package/dist/orchestration/extraction-shutdown.d.ts.map +1 -0
- package/dist/orchestration/extraction-watermark.d.ts +28 -0
- package/dist/orchestration/extraction-watermark.d.ts.map +1 -0
- package/dist/orchestration/generic-recall-paths.d.ts +36 -0
- package/dist/orchestration/generic-recall-paths.d.ts.map +1 -0
- package/dist/orchestration/graph-path-state-loader.d.ts +15 -0
- package/dist/orchestration/graph-path-state-loader.d.ts.map +1 -0
- package/dist/orchestration/graph-recall-coordinator.d.ts +107 -0
- package/dist/orchestration/graph-recall-coordinator.d.ts.map +1 -0
- package/dist/orchestration/harmonic-construction-persist.d.ts +58 -0
- package/dist/orchestration/harmonic-construction-persist.d.ts.map +1 -0
- package/dist/orchestration/lifecycle-policy-coordinator.d.ts +81 -0
- package/dist/orchestration/lifecycle-policy-coordinator.d.ts.map +1 -0
- package/dist/orchestration/maintenance.d.ts +229 -37
- package/dist/orchestration/maintenance.d.ts.map +1 -0
- package/dist/orchestration/maintenance.js +25 -25
- package/dist/orchestration/namespace-read-fanout.d.ts +95 -0
- package/dist/orchestration/namespace-read-fanout.d.ts.map +1 -0
- package/dist/orchestration/orchestrator-helpers.d.ts +408 -0
- package/dist/orchestration/orchestrator-helpers.d.ts.map +1 -0
- package/dist/orchestration/orchestrator-init.d.ts +124 -0
- package/dist/orchestration/orchestrator-init.d.ts.map +1 -0
- package/dist/orchestration/orchestrator-namespace-scope.d.ts +19 -0
- package/dist/orchestration/orchestrator-namespace-scope.d.ts.map +1 -0
- package/dist/orchestration/persistence-index.d.ts +141 -0
- package/dist/orchestration/persistence-index.d.ts.map +1 -0
- package/dist/orchestration/projection-rebuild-schedule.d.ts +21 -0
- package/dist/orchestration/projection-rebuild-schedule.d.ts.map +1 -0
- package/dist/orchestration/qmd-result-resolver.d.ts +75 -0
- package/dist/orchestration/qmd-result-resolver.d.ts.map +1 -0
- package/dist/orchestration/recall-background-writes.d.ts +3 -0
- package/dist/orchestration/recall-background-writes.d.ts.map +1 -0
- package/dist/orchestration/recall-entry.d.ts +78 -0
- package/dist/orchestration/recall-entry.d.ts.map +1 -0
- package/dist/orchestration/recall-internal-deps.d.ts +311 -0
- package/dist/orchestration/recall-internal-deps.d.ts.map +1 -0
- package/dist/orchestration/recall-internal.d.ts +30 -0
- package/dist/orchestration/recall-internal.d.ts.map +1 -0
- package/dist/orchestration/recall-introspection.d.ts +108 -0
- package/dist/orchestration/recall-introspection.d.ts.map +1 -0
- package/dist/orchestration/recall-profile-storage.d.ts +20 -0
- package/dist/orchestration/recall-profile-storage.d.ts.map +1 -0
- package/dist/orchestration/recall-recognition-index.d.ts +23 -0
- package/dist/orchestration/recall-recognition-index.d.ts.map +1 -0
- package/dist/orchestration/recall-recognition-search.d.ts +7 -0
- package/dist/orchestration/recall-recognition-search.d.ts.map +1 -0
- package/dist/orchestration/recall-rerank-coordinator.d.ts +126 -0
- package/dist/orchestration/recall-rerank-coordinator.d.ts.map +1 -0
- package/dist/orchestration/recall-result-formatter.d.ts +128 -0
- package/dist/orchestration/recall-result-formatter.d.ts.map +1 -0
- package/dist/orchestration/recall-search-pipeline.d.ts +284 -0
- package/dist/orchestration/recall-search-pipeline.d.ts.map +1 -0
- package/dist/orchestration/recall-search-prefilter.d.ts +31 -0
- package/dist/orchestration/recall-search-prefilter.d.ts.map +1 -0
- package/dist/orchestration/recall-section-coordinator.d.ts +92 -0
- package/dist/orchestration/recall-section-coordinator.d.ts.map +1 -0
- package/dist/orchestration/self-deps.d.ts +27 -0
- package/dist/orchestration/self-deps.d.ts.map +1 -0
- package/dist/orchestration/semantic-consolidation-coordinator.d.ts +64 -0
- package/dist/orchestration/semantic-consolidation-coordinator.d.ts.map +1 -0
- package/dist/orchestration/semantic-merge-commit-effects.d.ts +193 -0
- package/dist/orchestration/semantic-merge-commit-effects.d.ts.map +1 -0
- package/dist/orchestration/semantic-merge-persist.d.ts +318 -0
- package/dist/orchestration/semantic-merge-persist.d.ts.map +1 -0
- package/dist/orchestration/semantic-merge-promotion-payload.d.ts +132 -0
- package/dist/orchestration/semantic-merge-promotion-payload.d.ts.map +1 -0
- package/dist/orchestration/session-context.d.ts +225 -0
- package/dist/orchestration/session-context.d.ts.map +1 -0
- package/dist/orchestration/startup-collection-checks.d.ts +23 -0
- package/dist/orchestration/startup-collection-checks.d.ts.map +1 -0
- package/dist/orchestration/tier-migration-coordinator.d.ts +65 -0
- package/dist/orchestration/tier-migration-coordinator.d.ts.map +1 -0
- package/dist/orchestration/turn-ingestion.d.ts +227 -0
- package/dist/orchestration/turn-ingestion.d.ts.map +1 -0
- package/dist/orchestration/update-localization.d.ts +37 -0
- package/dist/orchestration/update-localization.d.ts.map +1 -0
- package/dist/orchestration/workspace-ops.d.ts +154 -0
- package/dist/orchestration/workspace-ops.d.ts.map +1 -0
- package/dist/orchestration/xray-capture-queue.d.ts +17 -0
- package/dist/orchestration/xray-capture-queue.d.ts.map +1 -0
- package/dist/orchestrator.d.ts +867 -109
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +157 -152
- package/dist/page-versioning.d.ts +16 -17
- package/dist/page-versioning.d.ts.map +1 -0
- package/dist/patterns-cli.d.ts +20 -40
- package/dist/patterns-cli.d.ts.map +1 -0
- package/dist/peers/index.d.ts +17 -327
- package/dist/peers/index.d.ts.map +1 -0
- package/dist/peers/migrate-from-identity-anchor.d.ts +119 -0
- package/dist/peers/migrate-from-identity-anchor.d.ts.map +1 -0
- package/dist/peers/profile-reasoner.d.ts +204 -0
- package/dist/peers/profile-reasoner.d.ts.map +1 -0
- package/dist/peers/storage.d.ts +163 -0
- package/dist/peers/storage.d.ts.map +1 -0
- package/dist/peers/types.d.ts +125 -0
- package/dist/peers/types.d.ts.map +1 -0
- package/dist/plugin-entry-resolver.d.ts +3 -4
- package/dist/plugin-entry-resolver.d.ts.map +1 -0
- package/dist/plugin-id.d.ts +4 -5
- package/dist/plugin-id.d.ts.map +1 -0
- package/dist/policy-runtime.d.ts +7 -26
- package/dist/policy-runtime.d.ts.map +1 -0
- package/dist/preferences/drift-config.d.ts +27 -0
- package/dist/preferences/drift-config.d.ts.map +1 -0
- package/dist/preferences/drift-recall.d.ts +74 -0
- package/dist/preferences/drift-recall.d.ts.map +1 -0
- package/dist/preferences/drift-types.d.ts +59 -0
- package/dist/preferences/drift-types.d.ts.map +1 -0
- package/dist/preferences/index.d.ts +12 -0
- package/dist/preferences/index.d.ts.map +1 -0
- package/dist/preferences/preference-drift.d.ts +144 -0
- package/dist/preferences/preference-drift.d.ts.map +1 -0
- package/dist/prioritized-embed.d.ts +3 -4
- package/dist/prioritized-embed.d.ts.map +1 -0
- package/dist/proactive-contention.d.ts +4 -24
- package/dist/proactive-contention.d.ts.map +1 -0
- package/dist/procedural/library-maintenance.d.ts +102 -0
- package/dist/procedural/library-maintenance.d.ts.map +1 -0
- package/dist/procedural/maintenance-config.d.ts +9 -0
- package/dist/procedural/maintenance-config.d.ts.map +1 -0
- package/dist/procedural/procedure-miner.d.ts +20 -0
- package/dist/procedural/procedure-miner.d.ts.map +1 -0
- package/dist/procedural/procedure-recall.d.ts +30 -0
- package/dist/procedural/procedure-recall.d.ts.map +1 -0
- package/dist/procedural/procedure-stats.d.ts +68 -0
- package/dist/procedural/procedure-stats.d.ts.map +1 -0
- package/dist/procedural/procedure-types.d.ts +26 -0
- package/dist/procedural/procedure-types.d.ts.map +1 -0
- package/dist/procedural/reinforcement-core.d.ts +39 -0
- package/dist/procedural/reinforcement-core.d.ts.map +1 -0
- package/dist/procedural/skill-io.d.ts +70 -0
- package/dist/procedural/skill-io.d.ts.map +1 -0
- package/dist/procedural/skill-projection.d.ts +98 -0
- package/dist/procedural/skill-projection.d.ts.map +1 -0
- package/dist/profiling.d.ts +10 -11
- package/dist/profiling.d.ts.map +1 -0
- package/dist/projection/index.d.ts +62 -0
- package/dist/projection/index.d.ts.map +1 -0
- package/dist/provenance.d.ts +13 -33
- package/dist/provenance.d.ts.map +1 -0
- package/dist/provenance.js +2 -2
- package/dist/providers/codex-subscription.d.ts +115 -0
- package/dist/providers/codex-subscription.d.ts.map +1 -0
- package/dist/qmd-preflight.d.ts +31 -21
- package/dist/qmd-preflight.d.ts.map +1 -0
- package/dist/qmd-recall-cache.d.ts +11 -30
- package/dist/qmd-recall-cache.d.ts.map +1 -0
- package/dist/qmd-status.d.ts +10 -11
- package/dist/qmd-status.d.ts.map +1 -0
- package/dist/qmd.d.ts +325 -21
- package/dist/qmd.d.ts.map +1 -0
- package/dist/reasoning-trace-recall.d.ts +7 -8
- package/dist/reasoning-trace-recall.d.ts.map +1 -0
- package/dist/reasoning-trace-types.d.ts +9 -10
- package/dist/reasoning-trace-types.d.ts.map +1 -0
- package/dist/recall-audit-anomaly.d.ts +11 -15
- package/dist/recall-audit-anomaly.d.ts.map +1 -0
- package/dist/recall-audit.d.ts +6 -8
- package/dist/recall-audit.d.ts.map +1 -0
- package/dist/recall-composition-decision.d.ts +9 -12
- package/dist/recall-composition-decision.d.ts.map +1 -0
- package/dist/recall-concurrency-config.d.ts +3 -22
- package/dist/recall-concurrency-config.d.ts.map +1 -0
- package/dist/recall-context-composition.d.ts +21 -22
- package/dist/recall-context-composition.d.ts.map +1 -0
- package/dist/recall-deep-access.d.ts +9 -12
- package/dist/recall-deep-access.d.ts.map +1 -0
- package/dist/recall-deep-budget-left.d.ts +2 -3
- package/dist/recall-deep-budget-left.d.ts.map +1 -0
- package/dist/recall-deep-budget.d.ts +2 -3
- package/dist/recall-deep-budget.d.ts.map +1 -0
- package/dist/recall-deep-expand-select.d.ts +4 -5
- package/dist/recall-deep-expand-select.d.ts.map +1 -0
- package/dist/recall-deep-expand.d.ts +2 -3
- package/dist/recall-deep-expand.d.ts.map +1 -0
- package/dist/recall-deep-frontier.d.ts +4 -5
- package/dist/recall-deep-frontier.d.ts.map +1 -0
- package/dist/recall-deep-policy.d.ts +5 -6
- package/dist/recall-deep-policy.d.ts.map +1 -0
- package/dist/recall-deep-query.d.ts +3 -4
- package/dist/recall-deep-query.d.ts.map +1 -0
- package/dist/recall-deep-refine.d.ts +2 -3
- package/dist/recall-deep-refine.d.ts.map +1 -0
- package/dist/recall-deep-render.d.ts +3 -6
- package/dist/recall-deep-render.d.ts.map +1 -0
- package/dist/recall-deep-rewrite.d.ts +4 -5
- package/dist/recall-deep-rewrite.d.ts.map +1 -0
- package/dist/recall-deep-step-count.d.ts +2 -3
- package/dist/recall-deep-step-count.d.ts.map +1 -0
- package/dist/recall-deep-stop-reason.d.ts +5 -6
- package/dist/recall-deep-stop-reason.d.ts.map +1 -0
- package/dist/recall-deep-stop.d.ts +6 -7
- package/dist/recall-deep-stop.d.ts.map +1 -0
- package/dist/recall-deep-trace-empty.d.ts +2 -3
- package/dist/recall-deep-trace-empty.d.ts.map +1 -0
- package/dist/recall-deep-working-set.d.ts +2 -3
- package/dist/recall-deep-working-set.d.ts.map +1 -0
- package/dist/recall-deep.d.ts +11 -12
- package/dist/recall-deep.d.ts.map +1 -0
- package/dist/recall-disclosure-escalation.d.ts +9 -29
- package/dist/recall-disclosure-escalation.d.ts.map +1 -0
- package/dist/recall-explain-renderer.d.ts +12 -38
- package/dist/recall-explain-renderer.d.ts.map +1 -0
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-handles.d.ts +23 -24
- package/dist/recall-handles.d.ts.map +1 -0
- package/dist/recall-memory-map.d.ts +8 -27
- package/dist/recall-memory-map.d.ts.map +1 -0
- package/dist/recall-mmr.d.ts +13 -14
- package/dist/recall-mmr.d.ts.map +1 -0
- package/dist/recall-navigate-access.d.ts +6 -27
- package/dist/recall-navigate-access.d.ts.map +1 -0
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-action.d.ts +5 -5
- package/dist/recall-navigate-action.d.ts.map +1 -0
- package/dist/recall-navigate-budget.d.ts +3 -4
- package/dist/recall-navigate-budget.d.ts.map +1 -0
- package/dist/recall-navigate-cost.d.ts +2 -3
- package/dist/recall-navigate-cost.d.ts.map +1 -0
- package/dist/recall-navigate-depth.d.ts +2 -3
- package/dist/recall-navigate-depth.d.ts.map +1 -0
- package/dist/recall-navigate-disclosure.d.ts +5 -25
- package/dist/recall-navigate-disclosure.d.ts.map +1 -0
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate-link.d.ts +5 -5
- package/dist/recall-navigate-link.d.ts.map +1 -0
- package/dist/recall-navigate-max-children.d.ts +2 -3
- package/dist/recall-navigate-max-children.d.ts.map +1 -0
- package/dist/recall-navigate-node.d.ts +3 -4
- package/dist/recall-navigate-node.d.ts.map +1 -0
- package/dist/recall-navigate-path.d.ts +2 -3
- package/dist/recall-navigate-path.d.ts.map +1 -0
- package/dist/recall-navigate-render.d.ts +3 -4
- package/dist/recall-navigate-render.d.ts.map +1 -0
- package/dist/recall-navigate-traverse.d.ts +5 -6
- package/dist/recall-navigate-traverse.d.ts.map +1 -0
- package/dist/recall-navigate-window.d.ts +5 -6
- package/dist/recall-navigate-window.d.ts.map +1 -0
- package/dist/recall-navigate.d.ts +13 -33
- package/dist/recall-navigate.d.ts.map +1 -0
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation-config.d.ts +7 -8
- package/dist/recall-navigation-config.d.ts.map +1 -0
- package/dist/recall-navigation-http-glue.d.ts +5 -151
- package/dist/recall-navigation-http-glue.d.ts.map +1 -0
- package/dist/recall-navigation-http-glue.js +2 -2
- package/dist/recall-navigation-mcp-tools.d.ts +3 -150
- package/dist/recall-navigation-mcp-tools.d.ts.map +1 -0
- package/dist/recall-navigation-operations.d.ts +11 -2
- package/dist/recall-navigation-operations.d.ts.map +1 -0
- package/dist/recall-navigation-operations.js +66 -61
- package/dist/recall-navigation-renderer.d.ts +4 -28
- package/dist/recall-navigation-renderer.d.ts.map +1 -0
- package/dist/recall-navigation.d.ts +13 -34
- package/dist/recall-navigation.d.ts.map +1 -0
- package/dist/recall-navigation.js +65 -60
- package/dist/recall-pipeline-stages.d.ts +6 -9
- package/dist/recall-pipeline-stages.d.ts.map +1 -0
- package/dist/recall-planner-i18n.d.ts +13 -14
- package/dist/recall-planner-i18n.d.ts.map +1 -0
- package/dist/recall-planner-llm.d.ts +8 -30
- package/dist/recall-planner-llm.d.ts.map +1 -0
- package/dist/recall-qos.d.ts +13 -15
- package/dist/recall-qos.d.ts.map +1 -0
- package/dist/recall-query-policy.d.ts +9 -10
- package/dist/recall-query-policy.d.ts.map +1 -0
- package/dist/recall-recognition-tier.d.ts +27 -28
- package/dist/recall-recognition-tier.d.ts.map +1 -0
- package/dist/recall-state-view-admission.d.ts +7 -26
- package/dist/recall-state-view-admission.d.ts.map +1 -0
- package/dist/recall-state-view-admission.js +3 -3
- package/dist/recall-state-view-anchors.d.ts +10 -29
- package/dist/recall-state-view-anchors.d.ts.map +1 -0
- package/dist/recall-state-view-current.d.ts +4 -5
- package/dist/recall-state-view-current.d.ts.map +1 -0
- package/dist/recall-state-view-inject.d.ts +3 -7
- package/dist/recall-state-view-inject.d.ts.map +1 -0
- package/dist/recall-state-view-kind.d.ts +5 -5
- package/dist/recall-state-view-kind.d.ts.map +1 -0
- package/dist/recall-state-view-label.d.ts +3 -6
- package/dist/recall-state-view-label.d.ts.map +1 -0
- package/dist/recall-state-view-packet.d.ts +7 -9
- package/dist/recall-state-view-packet.d.ts.map +1 -0
- package/dist/recall-state-view-render.d.ts +4 -7
- package/dist/recall-state-view-render.d.ts.map +1 -0
- package/dist/recall-state-view-successor.d.ts +3 -4
- package/dist/recall-state-view-successor.d.ts.map +1 -0
- package/dist/recall-state-view-superseded.d.ts +3 -4
- package/dist/recall-state-view-superseded.d.ts.map +1 -0
- package/dist/recall-state-view-transition.d.ts +4 -5
- package/dist/recall-state-view-transition.d.ts.map +1 -0
- package/dist/recall-state-view-widen.d.ts +3 -6
- package/dist/recall-state-view-widen.d.ts.map +1 -0
- package/dist/recall-state-view-wire.d.ts +3 -6
- package/dist/recall-state-view-wire.d.ts.map +1 -0
- package/dist/recall-state-view-zero-diff.d.ts +4 -5
- package/dist/recall-state-view-zero-diff.d.ts.map +1 -0
- package/dist/recall-state-view.d.ts +16 -17
- package/dist/recall-state-view.d.ts.map +1 -0
- package/dist/recall-state.d.ts +17 -35
- package/dist/recall-state.d.ts.map +1 -0
- package/dist/recall-tag-filter.d.ts +10 -33
- package/dist/recall-tag-filter.d.ts.map +1 -0
- package/dist/recall-timings.d.ts +10 -29
- package/dist/recall-timings.d.ts.map +1 -0
- package/dist/recall-tokenization.d.ts +7 -8
- package/dist/recall-tokenization.d.ts.map +1 -0
- package/dist/recall-why-cli.d.ts +25 -0
- package/dist/recall-why-cli.d.ts.map +1 -0
- package/dist/recall-why-cli.js +9 -0
- package/dist/recall-why-cli.js.map +1 -0
- package/dist/recall-why-renderer.d.ts +25 -0
- package/dist/recall-why-renderer.d.ts.map +1 -0
- package/dist/recall-why-renderer.js +18 -0
- package/dist/recall-why-renderer.js.map +1 -0
- package/dist/recall-why-service.d.ts +49 -0
- package/dist/recall-why-service.d.ts.map +1 -0
- package/dist/recall-why-service.js +46 -0
- package/dist/recall-why-service.js.map +1 -0
- package/dist/recall-why.d.ts +175 -0
- package/dist/recall-why.d.ts.map +1 -0
- package/dist/recall-why.js +25 -0
- package/dist/recall-why.js.map +1 -0
- package/dist/recall-xray-cli.d.ts +7 -31
- package/dist/recall-xray-cli.d.ts.map +1 -0
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +9 -33
- package/dist/recall-xray-renderer.d.ts.map +1 -0
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +19 -39
- package/dist/recall-xray.d.ts.map +1 -0
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +15 -37
- package/dist/reconcile/cursor.d.ts.map +1 -0
- package/dist/reconcile/manifest.d.ts +19 -40
- package/dist/reconcile/manifest.d.ts.map +1 -0
- package/dist/reconcile/manifest.js +2 -2
- package/dist/reconcile/plan.d.ts +22 -42
- package/dist/reconcile/plan.d.ts.map +1 -0
- package/dist/reconstruct.d.ts +2 -3
- package/dist/reconstruct.d.ts.map +1 -0
- package/dist/relay/mission-access.d.ts +28 -0
- package/dist/relay/mission-access.d.ts.map +1 -0
- package/dist/relay/mission-fixture.d.ts +11 -0
- package/dist/relay/mission-fixture.d.ts.map +1 -0
- package/dist/relay/mission.d.ts +3952 -0
- package/dist/relay/mission.d.ts.map +1 -0
- package/dist/release-changelog.d.ts +3 -4
- package/dist/release-changelog.d.ts.map +1 -0
- package/dist/relevance.d.ts +3 -3
- package/dist/relevance.d.ts.map +1 -0
- package/dist/replay/normalizers/chatgpt.d.ts +3 -23
- package/dist/replay/normalizers/chatgpt.d.ts.map +1 -0
- package/dist/replay/normalizers/claude.d.ts +3 -23
- package/dist/replay/normalizers/claude.d.ts.map +1 -0
- package/dist/replay/normalizers/openclaw.d.ts +3 -23
- package/dist/replay/normalizers/openclaw.d.ts.map +1 -0
- package/dist/replay/normalizers/shared.d.ts +6 -25
- package/dist/replay/normalizers/shared.d.ts.map +1 -0
- package/dist/replay/runner.d.ts +10 -30
- package/dist/replay/runner.d.ts.map +1 -0
- package/dist/replay/types.d.ts +18 -37
- package/dist/replay/types.d.ts.map +1 -0
- package/dist/replica-divergence.d.ts +24 -45
- package/dist/replica-divergence.d.ts.map +1 -0
- package/dist/replica-divergence.js +3 -3
- package/dist/replica-peers-config.d.ts +50 -18
- package/dist/replica-peers-config.d.ts.map +1 -0
- package/dist/rerank.d.ts +8 -9
- package/dist/rerank.d.ts.map +1 -0
- package/dist/resolution-CHNISQJB.js +36 -0
- package/dist/resolution-CHNISQJB.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +9 -27
- package/dist/resolve-auth-token.d.ts.map +1 -0
- package/dist/resolve-provider-secret.d.ts +10 -11
- package/dist/resolve-provider-secret.d.ts.map +1 -0
- package/dist/response-guidance-recall.d.ts +5 -8
- package/dist/response-guidance-recall.d.ts.map +1 -0
- package/dist/resume-bundles.d.ts +9 -10
- package/dist/resume-bundles.d.ts.map +1 -0
- package/dist/resume-bundles.js +24 -24
- package/dist/retrieval-agents.d.ts +14 -36
- package/dist/retrieval-agents.d.ts.map +1 -0
- package/dist/retrieval-tiers.d.ts +4 -24
- package/dist/retrieval-tiers.d.ts.map +1 -0
- package/dist/retrieval.d.ts +5 -6
- package/dist/retrieval.d.ts.map +1 -0
- package/dist/review/frontmatter.d.ts +6 -0
- package/dist/review/frontmatter.d.ts.map +1 -0
- package/dist/review/index.d.ts +81 -0
- package/dist/review/index.d.ts.map +1 -0
- package/dist/review/review-deck-http-base.d.ts +10 -0
- package/dist/review/review-deck-http-base.d.ts.map +1 -0
- package/dist/review/review-deck-mutation.d.ts +51 -0
- package/dist/review/review-deck-mutation.d.ts.map +1 -0
- package/dist/review/review-deck-snapshot.d.ts +10 -0
- package/dist/review/review-deck-snapshot.d.ts.map +1 -0
- package/dist/review/review-deck-surface.d.ts +33 -0
- package/dist/review/review-deck-surface.d.ts.map +1 -0
- package/dist/review/review-deck.d.ts +107 -0
- package/dist/review/review-deck.d.ts.map +1 -0
- package/dist/routing/engine.d.ts +12 -31
- package/dist/routing/engine.d.ts.map +1 -0
- package/dist/routing/store.d.ts +3 -23
- package/dist/routing/store.d.ts.map +1 -0
- package/dist/runtime/better-sqlite.d.ts +9 -10
- package/dist/runtime/better-sqlite.d.ts.map +1 -0
- package/dist/runtime/child-process.d.ts +5 -5
- package/dist/runtime/child-process.d.ts.map +1 -0
- package/dist/runtime/daemon-health.d.ts +2 -0
- package/dist/runtime/daemon-health.d.ts.map +1 -0
- package/dist/runtime/env.d.ts +5 -6
- package/dist/runtime/env.d.ts.map +1 -0
- package/dist/runtime/http-transport.d.ts +3 -4
- package/dist/runtime/http-transport.d.ts.map +1 -0
- package/dist/salvage-envelope.d.ts +3 -23
- package/dist/salvage-envelope.d.ts.map +1 -0
- package/dist/sanitize.d.ts +5 -7
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/schemas.d.ts +205 -207
- package/dist/schemas.d.ts.map +1 -0
- package/dist/scopes/scope-plan.d.ts +258 -0
- package/dist/scopes/scope-plan.d.ts.map +1 -0
- package/dist/sdk-compat.d.ts +4 -5
- package/dist/sdk-compat.d.ts.map +1 -0
- package/dist/search/abort.d.ts +5 -0
- package/dist/search/abort.d.ts.map +1 -0
- package/dist/search/document-scanner.d.ts +3 -4
- package/dist/search/document-scanner.d.ts.map +1 -0
- package/dist/search/embed-helper.d.ts +8 -26
- package/dist/search/embed-helper.d.ts.map +1 -0
- package/dist/search/factory.d.ts +10 -31
- package/dist/search/factory.d.ts.map +1 -0
- package/dist/search/factory.js +4 -4
- package/dist/search/index.d.ts +11 -32
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +10 -10
- package/dist/search/lancedb-backend.d.ts +5 -26
- package/dist/search/lancedb-backend.d.ts.map +1 -0
- package/dist/search/meilisearch-backend.d.ts +4 -24
- package/dist/search/meilisearch-backend.d.ts.map +1 -0
- package/dist/search/noop-backend.d.ts +3 -23
- package/dist/search/noop-backend.d.ts.map +1 -0
- package/dist/search/orama-backend.d.ts +6 -27
- package/dist/search/orama-backend.d.ts.map +1 -0
- package/dist/search/orama-cjk-tokenizer.d.ts +53 -0
- package/dist/search/orama-cjk-tokenizer.d.ts.map +1 -0
- package/dist/search/port.d.ts +10 -29
- package/dist/search/port.d.ts.map +1 -0
- package/dist/search/remote-backend.d.ts +4 -24
- package/dist/search/remote-backend.d.ts.map +1 -0
- package/dist/secure-store/cipher.d.ts +127 -0
- package/dist/secure-store/cipher.d.ts.map +1 -0
- package/dist/secure-store/cli-handlers.d.ts +134 -0
- package/dist/secure-store/cli-handlers.d.ts.map +1 -0
- package/dist/secure-store/cli-renderer.d.ts +16 -0
- package/dist/secure-store/cli-renderer.d.ts.map +1 -0
- package/dist/secure-store/header.d.ts +137 -0
- package/dist/secure-store/header.d.ts.map +1 -0
- package/dist/secure-store/index.d.ts +23 -899
- package/dist/secure-store/index.d.ts.map +1 -0
- package/dist/secure-store/kdf.d.ts +101 -0
- package/dist/secure-store/kdf.d.ts.map +1 -0
- package/dist/secure-store/keyring.d.ts +58 -0
- package/dist/secure-store/keyring.d.ts.map +1 -0
- package/dist/secure-store/metadata.d.ts +104 -0
- package/dist/secure-store/metadata.d.ts.map +1 -0
- package/dist/secure-store/passphrase-reader.d.ts +40 -0
- package/dist/secure-store/passphrase-reader.d.ts.map +1 -0
- package/dist/secure-store/secure-fs.d.ts +227 -0
- package/dist/secure-store/secure-fs.d.ts.map +1 -0
- package/dist/security/audit-memory-cli.d.ts +9 -0
- package/dist/security/audit-memory-cli.d.ts.map +1 -0
- package/dist/security/audit-memory.d.ts +48 -0
- package/dist/security/audit-memory.d.ts.map +1 -0
- package/dist/security/injection-screen.d.ts +19 -0
- package/dist/security/injection-screen.d.ts.map +1 -0
- package/dist/security/origin-authority.d.ts +30 -0
- package/dist/security/origin-authority.d.ts.map +1 -0
- package/dist/security/types.d.ts +13 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/semantic-chunking.d.ts +13 -16
- package/dist/semantic-chunking.d.ts.map +1 -0
- package/dist/semantic-consolidation.d.ts +126 -22
- package/dist/semantic-consolidation.d.ts.map +1 -0
- package/dist/semantic-consolidation.js +15 -15
- package/dist/semantic-merge-config.d.ts +2 -3
- package/dist/semantic-merge-config.d.ts.map +1 -0
- package/dist/semantic-rule-promotion.d.ts +7 -7
- package/dist/semantic-rule-promotion.d.ts.map +1 -0
- package/dist/semantic-rule-promotion.js +14 -14
- package/dist/semantic-rule-verifier.d.ts +6 -25
- package/dist/semantic-rule-verifier.d.ts.map +1 -0
- package/dist/semantic-rule-verifier.js +14 -14
- package/dist/session-identity.d.ts +10 -11
- package/dist/session-identity.d.ts.map +1 -0
- package/dist/session-integrity.d.ts +14 -15
- package/dist/session-integrity.d.ts.map +1 -0
- package/dist/session-namespace-bindings.d.ts +10 -11
- package/dist/session-namespace-bindings.d.ts.map +1 -0
- package/dist/session-observer-bands.d.ts +4 -23
- package/dist/session-observer-bands.d.ts.map +1 -0
- package/dist/session-observer-state.d.ts +6 -25
- package/dist/session-observer-state.d.ts.map +1 -0
- package/dist/session-summaries/adapters.d.ts +5 -0
- package/dist/session-summaries/adapters.d.ts.map +1 -0
- package/dist/session-summaries/index.d.ts +7 -0
- package/dist/session-summaries/index.d.ts.map +1 -0
- package/dist/session-summaries/redaction.d.ts +8 -0
- package/dist/session-summaries/redaction.d.ts.map +1 -0
- package/dist/session-summaries/types.d.ts +113 -0
- package/dist/session-summaries/types.d.ts.map +1 -0
- package/dist/session-toggles.d.ts +4 -4
- package/dist/session-toggles.d.ts.map +1 -0
- package/dist/session-transcript-migration.d.ts +9 -10
- package/dist/session-transcript-migration.d.ts.map +1 -0
- package/dist/shared-context/authority-precedence.d.ts +22 -0
- package/dist/shared-context/authority-precedence.d.ts.map +1 -0
- package/dist/shared-context/authority.d.ts +18 -0
- package/dist/shared-context/authority.d.ts.map +1 -0
- package/dist/shared-context/claim-key.d.ts +14 -0
- package/dist/shared-context/claim-key.d.ts.map +1 -0
- package/dist/shared-context/contradictions.d.ts +20 -0
- package/dist/shared-context/contradictions.d.ts.map +1 -0
- package/dist/shared-context/curation-lint.d.ts +23 -0
- package/dist/shared-context/curation-lint.d.ts.map +1 -0
- package/dist/shared-context/envelope-actor.d.ts +14 -0
- package/dist/shared-context/envelope-actor.d.ts.map +1 -0
- package/dist/shared-context/envelope-at.d.ts +19 -0
- package/dist/shared-context/envelope-at.d.ts.map +1 -0
- package/dist/shared-context/envelope-id.d.ts +14 -0
- package/dist/shared-context/envelope-id.d.ts.map +1 -0
- package/dist/shared-context/envelope-io.d.ts +100 -0
- package/dist/shared-context/envelope-io.d.ts.map +1 -0
- package/dist/shared-context/envelope-required.d.ts +14 -0
- package/dist/shared-context/envelope-required.d.ts.map +1 -0
- package/dist/shared-context/envelope-ttl.d.ts +12 -0
- package/dist/shared-context/envelope-ttl.d.ts.map +1 -0
- package/dist/shared-context/governance.d.ts +28 -0
- package/dist/shared-context/governance.d.ts.map +1 -0
- package/dist/shared-context/iso-instant.d.ts +19 -0
- package/dist/shared-context/iso-instant.d.ts.map +1 -0
- package/dist/shared-context/manager.d.ts +21 -48
- package/dist/shared-context/manager.d.ts.map +1 -0
- package/dist/shared-context/provenance.d.ts +18 -0
- package/dist/shared-context/provenance.d.ts.map +1 -0
- package/dist/shared-context/staleness.d.ts +18 -0
- package/dist/shared-context/staleness.d.ts.map +1 -0
- package/dist/shared-context/supersession-chain.d.ts +41 -0
- package/dist/shared-context/supersession-chain.d.ts.map +1 -0
- package/dist/shared-context/trajectories.d.ts +24 -0
- package/dist/shared-context/trajectories.d.ts.map +1 -0
- package/dist/shared-context/write-output-controls.d.ts +4 -5
- package/dist/shared-context/write-output-controls.d.ts.map +1 -0
- package/dist/signal.d.ts +4 -23
- package/dist/signal.d.ts.map +1 -0
- package/dist/skills-registry.d.ts +4 -5
- package/dist/skills-registry.d.ts.map +1 -0
- package/dist/source-agent-qualifier.d.ts +8 -27
- package/dist/source-agent-qualifier.d.ts.map +1 -0
- package/dist/source-agent-qualifier.js +23 -23
- package/dist/source-attribution.d.ts +20 -21
- package/dist/source-attribution.d.ts.map +1 -0
- package/dist/spaces/index.d.ts +148 -0
- package/dist/spaces/index.d.ts.map +1 -0
- package/dist/standing-memory-block.d.ts +25 -26
- package/dist/standing-memory-block.d.ts.map +1 -0
- package/dist/standup/access-operations.d.ts +2 -0
- package/dist/standup/access-operations.d.ts.map +1 -0
- package/dist/standup/build.d.ts +6 -7
- package/dist/standup/build.d.ts.map +1 -0
- package/dist/standup/build.js +15 -15
- package/dist/standup/http-glue.d.ts +4 -0
- package/dist/standup/http-glue.d.ts.map +1 -0
- package/dist/standup/mcp-tools.d.ts +3 -0
- package/dist/standup/mcp-tools.d.ts.map +1 -0
- package/dist/storage/cas-revision-host.d.ts +34 -0
- package/dist/storage/cas-revision-host.d.ts.map +1 -0
- package/dist/storage/cas-revision-store.d.ts +176 -0
- package/dist/storage/cas-revision-store.d.ts.map +1 -0
- package/dist/storage/citation-hash-source.d.ts +3 -0
- package/dist/storage/citation-hash-source.d.ts.map +1 -0
- package/dist/storage/committed-invalidation.d.ts +9 -0
- package/dist/storage/committed-invalidation.d.ts.map +1 -0
- package/dist/storage/content-hash-index.d.ts +269 -0
- package/dist/storage/content-hash-index.d.ts.map +1 -0
- package/dist/storage/context-transform-ledger.d.ts +10 -0
- package/dist/storage/context-transform-ledger.d.ts.map +1 -0
- package/dist/storage/deletion-revision-store.d.ts +79 -0
- package/dist/storage/deletion-revision-store.d.ts.map +1 -0
- package/dist/storage/entity-alias-config.d.ts +2 -0
- package/dist/storage/entity-alias-config.d.ts.map +1 -0
- package/dist/storage/entity-canonical-id-lock.d.ts +4 -0
- package/dist/storage/entity-canonical-id-lock.d.ts.map +1 -0
- package/dist/storage/entity-canonical-id-migration-adapter.d.ts +24 -0
- package/dist/storage/entity-canonical-id-migration-adapter.d.ts.map +1 -0
- package/dist/storage/entity-canonical-id-migration-runner.d.ts +16 -0
- package/dist/storage/entity-canonical-id-migration-runner.d.ts.map +1 -0
- package/dist/storage/entity-canonical-id-migration.d.ts +44 -0
- package/dist/storage/entity-canonical-id-migration.d.ts.map +1 -0
- package/dist/storage/entity-canonical-id-references.d.ts +173 -0
- package/dist/storage/entity-canonical-id-references.d.ts.map +1 -0
- package/dist/storage/entity-id-safety.d.ts +2 -0
- package/dist/storage/entity-id-safety.d.ts.map +1 -0
- package/dist/storage/entity-ref-repair.d.ts +45 -0
- package/dist/storage/entity-ref-repair.d.ts.map +1 -0
- package/dist/storage/entity-store.d.ts +131 -0
- package/dist/storage/entity-store.d.ts.map +1 -0
- package/dist/storage/entity-timeline.d.ts +34 -0
- package/dist/storage/entity-timeline.d.ts.map +1 -0
- package/dist/storage/identity-continuity-store.d.ts +40 -0
- package/dist/storage/identity-continuity-store.d.ts.map +1 -0
- package/dist/storage/memory-frontmatter-metadata.d.ts +4 -0
- package/dist/storage/memory-frontmatter-metadata.d.ts.map +1 -0
- package/dist/storage/memory-lifecycle-ledger-access.d.ts +194 -0
- package/dist/storage/memory-lifecycle-ledger-access.d.ts.map +1 -0
- package/dist/storage/memory-migration-serialization.d.ts +5 -0
- package/dist/storage/memory-migration-serialization.d.ts.map +1 -0
- package/dist/storage/memory-read-store.d.ts +193 -0
- package/dist/storage/memory-read-store.d.ts.map +1 -0
- package/dist/storage/profile-header.d.ts +16 -0
- package/dist/storage/profile-header.d.ts.map +1 -0
- package/dist/storage/questions-file.d.ts +11 -0
- package/dist/storage/questions-file.d.ts.map +1 -0
- package/dist/storage/secure-line-reader.d.ts +53 -0
- package/dist/storage/secure-line-reader.d.ts.map +1 -0
- package/dist/storage/supersession-audit.d.ts +7 -0
- package/dist/storage/supersession-audit.d.ts.map +1 -0
- package/dist/storage/supersession-side-effects.d.ts +51 -0
- package/dist/storage/supersession-side-effects.d.ts.map +1 -0
- package/dist/storage/tombstone-blocked-capture-index.d.ts +93 -0
- package/dist/storage/tombstone-blocked-capture-index.d.ts.map +1 -0
- package/dist/storage/tombstone-blocked-capture-mutation.d.ts +53 -0
- package/dist/storage/tombstone-blocked-capture-mutation.d.ts.map +1 -0
- package/dist/storage/tombstone-blocked-capture-sync.d.ts +96 -0
- package/dist/storage/tombstone-blocked-capture-sync.d.ts.map +1 -0
- package/dist/storage/tombstone-migration-sources.d.ts +24 -0
- package/dist/storage/tombstone-migration-sources.d.ts.map +1 -0
- package/dist/storage/windowed-memory-read.d.ts +28 -0
- package/dist/storage/windowed-memory-read.d.ts.map +1 -0
- package/dist/storage-contract/harness.d.ts +59 -0
- package/dist/storage-contract/harness.d.ts.map +1 -0
- package/dist/storage-guards.d.ts +6 -7
- package/dist/storage-guards.d.ts.map +1 -0
- package/dist/storage-paths.d.ts +8 -9
- package/dist/storage-paths.d.ts.map +1 -0
- package/dist/storage.d.ts +1362 -33
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +15 -15
- package/dist/store-contract.d.ts +9 -10
- package/dist/store-contract.d.ts.map +1 -0
- package/dist/structured-attributes.d.ts +6 -7
- package/dist/structured-attributes.d.ts.map +1 -0
- package/dist/subject-config.d.ts +4 -24
- package/dist/subject-config.d.ts.map +1 -0
- package/dist/summarizer.d.ts +7 -27
- package/dist/summarizer.d.ts.map +1 -0
- package/dist/summarizer.js +3 -3
- package/dist/summary-snapshot.d.ts +6 -25
- package/dist/summary-snapshot.d.ts.map +1 -0
- package/dist/support-passport/access-http-base.d.ts +20 -0
- package/dist/support-passport/access-http-base.d.ts.map +1 -0
- package/dist/support-passport/access-http.d.ts +64 -0
- package/dist/support-passport/access-http.d.ts.map +1 -0
- package/dist/support-passport/access-operations.d.ts +197 -0
- package/dist/support-passport/access-operations.d.ts.map +1 -0
- package/dist/support-passport/access-service-base.d.ts +86 -0
- package/dist/support-passport/access-service-base.d.ts.map +1 -0
- package/dist/support-passport/access-surface.d.ts +118 -0
- package/dist/support-passport/access-surface.d.ts.map +1 -0
- package/dist/support-passport/card-projection.d.ts +83 -0
- package/dist/support-passport/card-projection.d.ts.map +1 -0
- package/dist/support-passport/card-replacement.d.ts +21 -0
- package/dist/support-passport/card-replacement.d.ts.map +1 -0
- package/dist/support-passport/card-service.d.ts +65 -0
- package/dist/support-passport/card-service.d.ts.map +1 -0
- package/dist/support-passport/card-state.d.ts +28 -0
- package/dist/support-passport/card-state.d.ts.map +1 -0
- package/dist/support-passport/config.d.ts +4 -0
- package/dist/support-passport/config.d.ts.map +1 -0
- package/dist/support-passport/contracts.d.ts +165 -0
- package/dist/support-passport/contracts.d.ts.map +1 -0
- package/dist/support-passport/errors.d.ts +7 -0
- package/dist/support-passport/errors.d.ts.map +1 -0
- package/dist/support-passport/generated-batch.d.ts +47 -0
- package/dist/support-passport/generated-batch.d.ts.map +1 -0
- package/dist/support-passport/grant-contracts.d.ts +443 -0
- package/dist/support-passport/grant-contracts.d.ts.map +1 -0
- package/dist/support-passport/grant-service.d.ts +48 -0
- package/dist/support-passport/grant-service.d.ts.map +1 -0
- package/dist/support-passport/grant-store.d.ts +84 -0
- package/dist/support-passport/grant-store.d.ts.map +1 -0
- package/dist/support-passport/index.d.ts +17 -571
- package/dist/support-passport/index.d.ts.map +1 -0
- package/dist/support-passport/index.js +75 -70
- package/dist/support-passport/mcp-tools.d.ts +16 -0
- package/dist/support-passport/mcp-tools.d.ts.map +1 -0
- package/dist/support-passport/model-adapter.d.ts +90 -0
- package/dist/support-passport/model-adapter.d.ts.map +1 -0
- package/dist/support-passport/model-audit.d.ts +115 -0
- package/dist/support-passport/model-audit.d.ts.map +1 -0
- package/dist/support-passport/model-bridge.d.ts +105 -0
- package/dist/support-passport/model-bridge.d.ts.map +1 -0
- package/dist/support-passport/model-contracts.d.ts +219 -0
- package/dist/support-passport/model-contracts.d.ts.map +1 -0
- package/dist/support-passport/model-service.d.ts +58 -0
- package/dist/support-passport/model-service.d.ts.map +1 -0
- package/dist/support-passport/offline-sync-guard.d.ts +46 -0
- package/dist/support-passport/offline-sync-guard.d.ts.map +1 -0
- package/dist/support-passport/owner-lock.d.ts +16 -0
- package/dist/support-passport/owner-lock.d.ts.map +1 -0
- package/dist/support-passport/private-file.d.ts +16 -0
- package/dist/support-passport/private-file.d.ts.map +1 -0
- package/dist/support-passport/public-http.d.ts +23 -0
- package/dist/support-passport/public-http.d.ts.map +1 -0
- package/dist/surfaces/dreams.d.ts +4 -5
- package/dist/surfaces/dreams.d.ts.map +1 -0
- package/dist/surfaces/heartbeat.d.ts +4 -5
- package/dist/surfaces/heartbeat.d.ts.map +1 -0
- package/dist/sync/index.d.ts +69 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/targeted-fact-recall.d.ts +5 -8
- package/dist/targeted-fact-recall.d.ts.map +1 -0
- package/dist/task-llm-config.d.ts +4 -5
- package/dist/task-llm-config.d.ts.map +1 -0
- package/dist/taxonomy/default-taxonomy.d.ts +7 -0
- package/dist/taxonomy/default-taxonomy.d.ts.map +1 -0
- package/dist/taxonomy/index.d.ts +11 -0
- package/dist/taxonomy/index.d.ts.map +1 -0
- package/dist/taxonomy/resolver-doc-generator.d.ts +17 -0
- package/dist/taxonomy/resolver-doc-generator.d.ts.map +1 -0
- package/dist/taxonomy/resolver.d.ts +25 -0
- package/dist/taxonomy/resolver.d.ts.map +1 -0
- package/dist/taxonomy/taxonomy-loader.d.ts +38 -0
- package/dist/taxonomy/taxonomy-loader.d.ts.map +1 -0
- package/dist/taxonomy/types.d.ts +49 -0
- package/dist/taxonomy/types.d.ts.map +1 -0
- package/dist/telemetry-transcript.d.ts +6 -7
- package/dist/telemetry-transcript.d.ts.map +1 -0
- package/dist/temporal-index-batch.d.ts +30 -1
- package/dist/temporal-index-batch.d.ts.map +1 -0
- package/dist/temporal-index-compat.d.ts +7 -267
- package/dist/temporal-index-compat.d.ts.map +1 -0
- package/dist/temporal-index.d.ts +230 -1
- package/dist/temporal-index.d.ts.map +1 -0
- package/dist/temporal-supersession.d.ts +14 -34
- package/dist/temporal-supersession.d.ts.map +1 -0
- package/dist/temporal-timeline-recall.d.ts +5 -24
- package/dist/temporal-timeline-recall.d.ts.map +1 -0
- package/dist/temporal-validity.d.ts +7 -27
- package/dist/temporal-validity.d.ts.map +1 -0
- package/dist/testing/lifecycle-matrix.d.ts +11 -12
- package/dist/testing/lifecycle-matrix.d.ts.map +1 -0
- package/dist/testing/orchestrator-lite.d.ts +80 -0
- package/dist/testing/orchestrator-lite.d.ts.map +1 -0
- package/dist/testing/subjects/meetings-namespace-harness.d.ts +32 -0
- package/dist/testing/subjects/meetings-namespace-harness.d.ts.map +1 -0
- package/dist/testing/tmp-dir.d.ts +9 -0
- package/dist/testing/tmp-dir.d.ts.map +1 -0
- package/dist/thread-key.d.ts +2 -3
- package/dist/thread-key.d.ts.map +1 -0
- package/dist/threading.d.ts +3 -23
- package/dist/threading.d.ts.map +1 -0
- package/dist/tier-migration.d.ts +10 -43
- package/dist/tier-migration.d.ts.map +1 -0
- package/dist/tier-routing.d.ts +8 -27
- package/dist/tier-routing.d.ts.map +1 -0
- package/dist/tmt.d.ts +18 -19
- package/dist/tmt.d.ts.map +1 -0
- package/dist/token-estimate.d.ts +2 -3
- package/dist/token-estimate.d.ts.map +1 -0
- package/dist/tokens.d.ts +15 -19
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +3 -3
- package/dist/tool-scoped-memory.d.ts +7 -8
- package/dist/tool-scoped-memory.d.ts.map +1 -0
- package/dist/topics.d.ts +4 -24
- package/dist/topics.d.ts.map +1 -0
- package/dist/training-export/converter.d.ts +18 -0
- package/dist/training-export/converter.d.ts.map +1 -0
- package/dist/training-export/date-parse.d.ts +38 -0
- package/dist/training-export/date-parse.d.ts.map +1 -0
- package/dist/training-export/index.d.ts +10 -0
- package/dist/training-export/index.d.ts.map +1 -0
- package/dist/training-export/registry.d.ts +27 -0
- package/dist/training-export/registry.d.ts.map +1 -0
- package/dist/training-export/types.d.ts +29 -0
- package/dist/training-export/types.d.ts.map +1 -0
- package/dist/transcript.d.ts +5 -24
- package/dist/transcript.d.ts.map +1 -0
- package/dist/transfer/autodetect.d.ts +3 -4
- package/dist/transfer/autodetect.d.ts.map +1 -0
- package/dist/transfer/backup.d.ts +3 -4
- package/dist/transfer/backup.d.ts.map +1 -0
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-crypto.d.ts +168 -0
- package/dist/transfer/capsule-crypto.d.ts.map +1 -0
- package/dist/transfer/capsule-export.d.ts +6 -9
- package/dist/transfer/capsule-export.d.ts.map +1 -0
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-fork.d.ts +117 -0
- package/dist/transfer/capsule-fork.d.ts.map +1 -0
- package/dist/transfer/capsule-import.d.ts +10 -13
- package/dist/transfer/capsule-import.d.ts.map +1 -0
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/capsule-merge.d.ts +124 -0
- package/dist/transfer/capsule-merge.d.ts.map +1 -0
- package/dist/transfer/conflict-policy.d.ts +5 -0
- package/dist/transfer/conflict-policy.d.ts.map +1 -0
- package/dist/transfer/constants.d.ts +4 -5
- package/dist/transfer/constants.d.ts.map +1 -0
- package/dist/transfer/exclusions.d.ts +8 -0
- package/dist/transfer/exclusions.d.ts.map +1 -0
- package/dist/transfer/export-json.d.ts +3 -4
- package/dist/transfer/export-json.d.ts.map +1 -0
- package/dist/transfer/export-md.d.ts +4 -5
- package/dist/transfer/export-md.d.ts.map +1 -0
- package/dist/transfer/export-okf.d.ts +11 -31
- package/dist/transfer/export-okf.d.ts.map +1 -0
- package/dist/transfer/export-okf.js +14 -14
- package/dist/transfer/export-sqlite.d.ts +3 -4
- package/dist/transfer/export-sqlite.d.ts.map +1 -0
- package/dist/transfer/fs-utils.d.ts +20 -21
- package/dist/transfer/fs-utils.d.ts.map +1 -0
- package/dist/transfer/import-json.d.ts +6 -7
- package/dist/transfer/import-json.d.ts.map +1 -0
- package/dist/transfer/import-md.d.ts +5 -6
- package/dist/transfer/import-md.d.ts.map +1 -0
- package/dist/transfer/import-sqlite.d.ts +5 -6
- package/dist/transfer/import-sqlite.d.ts.map +1 -0
- package/dist/transfer/integrity.d.ts +8 -0
- package/dist/transfer/integrity.d.ts.map +1 -0
- package/dist/transfer/sqlite-schema.d.ts +3 -4
- package/dist/transfer/sqlite-schema.d.ts.map +1 -0
- package/dist/transfer/types.d.ts +114 -116
- package/dist/transfer/types.d.ts.map +1 -0
- package/dist/trust-score-stage.d.ts +21 -40
- package/dist/trust-score-stage.d.ts.map +1 -0
- package/dist/trust-score.d.ts +15 -34
- package/dist/trust-score.d.ts.map +1 -0
- package/dist/trust-zones.d.ts +29 -30
- package/dist/trust-zones.d.ts.map +1 -0
- package/dist/types-continuity.d.ts +10 -11
- package/dist/types-continuity.d.ts.map +1 -0
- package/dist/types.d.ts +3500 -18
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -1
- package/dist/user-message-cleaning.d.ts +3 -4
- package/dist/user-message-cleaning.d.ts.map +1 -0
- package/dist/user-model.d.ts +17 -18
- package/dist/user-model.d.ts.map +1 -0
- package/dist/utility-learner.d.ts +10 -12
- package/dist/utility-learner.d.ts.map +1 -0
- package/dist/utility-runtime.d.ts +6 -27
- package/dist/utility-runtime.d.ts.map +1 -0
- package/dist/utility-telemetry.d.ts +12 -13
- package/dist/utility-telemetry.d.ts.map +1 -0
- package/dist/utils/category-dir.d.ts +45 -0
- package/dist/utils/category-dir.d.ts.map +1 -0
- package/dist/utils/errno.d.ts +4 -0
- package/dist/utils/errno.d.ts.map +1 -0
- package/dist/utils/iso-timestamp.d.ts +18 -0
- package/dist/utils/iso-timestamp.d.ts.map +1 -0
- package/dist/utils/path-containment.d.ts +50 -0
- package/dist/utils/path-containment.d.ts.map +1 -0
- package/dist/utils/path.d.ts +2 -3
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/script-aware-text.d.ts +27 -0
- package/dist/utils/script-aware-text.d.ts.map +1 -0
- package/dist/utils/serialize-mutations.d.ts +6 -7
- package/dist/utils/serialize-mutations.d.ts.map +1 -0
- package/dist/utils/yaml-scalar.d.ts +9 -0
- package/dist/utils/yaml-scalar.d.ts.map +1 -0
- package/dist/verified-recall.d.ts +5 -7
- package/dist/verified-recall.d.ts.map +1 -0
- package/dist/verified-recall.js +14 -14
- package/dist/version-utils.d.ts +3 -4
- package/dist/version-utils.d.ts.map +1 -0
- package/dist/wearables/auto-sync.d.ts +63 -0
- package/dist/wearables/auto-sync.d.ts.map +1 -0
- package/dist/wearables/cleanup.d.ts +39 -0
- package/dist/wearables/cleanup.d.ts.map +1 -0
- package/dist/wearables/cli.d.ts +24 -0
- package/dist/wearables/cli.d.ts.map +1 -0
- package/dist/wearables/config.d.ts +22 -0
- package/dist/wearables/config.d.ts.map +1 -0
- package/dist/wearables/corrections.d.ts +46 -0
- package/dist/wearables/corrections.d.ts.map +1 -0
- package/dist/wearables/day-store.d.ts +152 -0
- package/dist/wearables/day-store.d.ts.map +1 -0
- package/dist/wearables/errors.d.ts +19 -0
- package/dist/wearables/errors.d.ts.map +1 -0
- package/dist/wearables/fusion/cluster.d.ts +70 -0
- package/dist/wearables/fusion/cluster.d.ts.map +1 -0
- package/dist/wearables/fusion/fuse.d.ts +40 -0
- package/dist/wearables/fusion/fuse.d.ts.map +1 -0
- package/dist/wearables/fusion/index.d.ts +16 -0
- package/dist/wearables/fusion/index.d.ts.map +1 -0
- package/dist/wearables/fusion/reconcile.d.ts +52 -0
- package/dist/wearables/fusion/reconcile.d.ts.map +1 -0
- package/dist/wearables/fusion/reconstruct.d.ts +37 -0
- package/dist/wearables/fusion/reconstruct.d.ts.map +1 -0
- package/dist/wearables/fusion/store.d.ts +131 -0
- package/dist/wearables/fusion/store.d.ts.map +1 -0
- package/dist/wearables/fusion/types.d.ts +219 -0
- package/dist/wearables/fusion/types.d.ts.map +1 -0
- package/dist/wearables/http-glue.d.ts +12 -0
- package/dist/wearables/http-glue.d.ts.map +1 -0
- package/dist/wearables/index.d.ts +23 -0
- package/dist/wearables/index.d.ts.map +1 -0
- package/dist/wearables/mcp-tools.d.ts +12 -0
- package/dist/wearables/mcp-tools.d.ts.map +1 -0
- package/dist/wearables/memory-gen.d.ts +139 -0
- package/dist/wearables/memory-gen.d.ts.map +1 -0
- package/dist/wearables/pipeline.d.ts +81 -0
- package/dist/wearables/pipeline.d.ts.map +1 -0
- package/dist/wearables/redaction.d.ts +75 -0
- package/dist/wearables/redaction.d.ts.map +1 -0
- package/dist/wearables/registry.d.ts +47 -0
- package/dist/wearables/registry.d.ts.map +1 -0
- package/dist/wearables/service.d.ts +225 -0
- package/dist/wearables/service.d.ts.map +1 -0
- package/dist/wearables/speakers.d.ts +83 -0
- package/dist/wearables/speakers.d.ts.map +1 -0
- package/dist/wearables/sync-state.d.ts +52 -0
- package/dist/wearables/sync-state.d.ts.map +1 -0
- package/dist/wearables/text-language.d.ts +41 -0
- package/dist/wearables/text-language.d.ts.map +1 -0
- package/dist/wearables/trust.d.ts +93 -0
- package/dist/wearables/trust.d.ts.map +1 -0
- package/dist/wearables/types.d.ts +389 -0
- package/dist/wearables/types.d.ts.map +1 -0
- package/dist/whitespace.d.ts +7 -8
- package/dist/whitespace.d.ts.map +1 -0
- package/dist/who-knows-cli.d.ts +8 -155
- package/dist/who-knows-cli.d.ts.map +1 -0
- package/dist/who-knows-cli.js +16 -16
- package/dist/who-knows.d.ts +97 -145
- package/dist/who-knows.d.ts.map +1 -0
- package/dist/who-knows.js +15 -15
- package/dist/work/board.d.ts +8 -10
- package/dist/work/board.d.ts.map +1 -0
- package/dist/work/boundary.d.ts +5 -6
- package/dist/work/boundary.d.ts.map +1 -0
- package/dist/work/storage.d.ts +4 -6
- package/dist/work/storage.d.ts.map +1 -0
- package/dist/work/types.d.ts +11 -12
- package/dist/work/types.d.ts.map +1 -0
- package/dist/work-product-ledger.d.ts +12 -13
- package/dist/work-product-ledger.d.ts.map +1 -0
- package/dist/write-envelope.d.ts +23 -42
- package/dist/write-envelope.d.ts.map +1 -0
- package/dist/write-quarantine.d.ts +8 -9
- package/dist/write-quarantine.d.ts.map +1 -0
- package/dist/write-rate-limiter.d.ts +4 -4
- package/dist/write-rate-limiter.d.ts.map +1 -0
- package/package.json +2 -2
- package/scripts/build-with-heap.mjs +40 -19
- package/src/access-boundary.ts +1 -0
- package/src/access-errors.test.ts +182 -0
- package/src/access-errors.ts +252 -1
- package/src/access-http.ts +36 -103
- package/src/access-mcp-output-schemas.ts +1 -0
- package/src/access-mcp.ts +21 -2
- package/src/access-operations-batch.ts +8 -0
- package/src/access-recall-diagnostics.ts +236 -0
- package/src/access-service.ts +6 -0
- package/src/access-surface-catalog.ts +2 -0
- package/src/index.ts +11 -0
- package/src/mcp-read-only-tools.ts +1 -0
- package/src/orchestration/orchestrator-helpers.ts +7 -0
- package/src/orchestration/recall-internal.ts +1 -1
- package/src/recall-degradation-sink.test.ts +144 -0
- package/src/recall-why-cli.ts +59 -0
- package/src/recall-why-renderer.ts +142 -0
- package/src/recall-why-service.test.ts +306 -0
- package/src/recall-why-service.ts +218 -0
- package/src/recall-why.test.ts +511 -0
- package/src/recall-why.ts +568 -0
- package/src/types.ts +1 -0
- package/dist/access-namespace-preflight-U9RAdxqZ.d.ts +0 -146
- package/dist/access-service-CUNM5RfA.d.ts +0 -4700
- package/dist/capsule-crypto-YO5QJ6L3.js +0 -18
- package/dist/catalog-BuMyYPUn.d.ts +0 -473
- package/dist/chunk-27MKMTBY.js +0 -342
- package/dist/chunk-2HJKAVAS.js +0 -216
- package/dist/chunk-2QZJ4P27.js +0 -203
- package/dist/chunk-2SIKTXWX.js +0 -502
- package/dist/chunk-2Z24E5W2.js +0 -22
- package/dist/chunk-2Z24E5W2.js.map +0 -1
- package/dist/chunk-3R23DDD3.js +0 -9782
- package/dist/chunk-3S6URXEH.js +0 -63
- package/dist/chunk-43IQRLEF.js +0 -256
- package/dist/chunk-4UVJ6EIT.js +0 -22
- package/dist/chunk-4UVJ6EIT.js.map +0 -1
- package/dist/chunk-5FAGCOZD.js +0 -761
- package/dist/chunk-75YZ5VAI.js +0 -140
- package/dist/chunk-7IRZK6MM.js +0 -256
- package/dist/chunk-7QVYVSEH.js +0 -285
- package/dist/chunk-7RGX7BMF.js +0 -103
- package/dist/chunk-7RKAE6Y4.js +0 -727
- package/dist/chunk-AH44WTLJ.js +0 -415
- package/dist/chunk-AHVJ6GLL.js +0 -95
- package/dist/chunk-AIVRD66I.js +0 -511
- package/dist/chunk-AQ55YKEV.js +0 -29
- package/dist/chunk-AQWGCHIV.js +0 -263
- package/dist/chunk-ARRKSBQU.js +0 -72
- package/dist/chunk-AYHNTYVG.js +0 -43
- package/dist/chunk-BSCNBIF4.js +0 -24
- package/dist/chunk-BXLOS5AJ.js +0 -112
- package/dist/chunk-BXOPUJ3W.js +0 -801
- package/dist/chunk-CEO4DONG.js +0 -28
- package/dist/chunk-CVILPI77.js +0 -432
- package/dist/chunk-D2N3PMAE.js +0 -51
- package/dist/chunk-D7VT2LED.js +0 -253
- package/dist/chunk-DAOMWGO2.js +0 -65
- package/dist/chunk-DGS34QSY.js +0 -141
- package/dist/chunk-DI52XAKG.js +0 -223
- package/dist/chunk-DQEMWVMT.js +0 -249
- package/dist/chunk-DZP2XMZC.js +0 -1084
- package/dist/chunk-EVQ33D3N.js +0 -731
- package/dist/chunk-FPB5LQWW.js +0 -71
- package/dist/chunk-FPB5LQWW.js.map +0 -1
- package/dist/chunk-FROKVQQY.js +0 -3997
- package/dist/chunk-FROKVQQY.js.map +0 -1
- package/dist/chunk-G7S37WD4.js +0 -801
- package/dist/chunk-GRDRVYXJ.js +0 -1917
- package/dist/chunk-H6WOFMOV.js +0 -346
- package/dist/chunk-HMDYSGY6.js +0 -54
- package/dist/chunk-HNHIHXSD.js +0 -879
- package/dist/chunk-HWLIMQE2.js +0 -165
- package/dist/chunk-IWO6QXWJ.js +0 -224
- package/dist/chunk-IYNCJKBM.js +0 -3602
- package/dist/chunk-IYNCJKBM.js.map +0 -1
- package/dist/chunk-J54B5DGD.js +0 -1530
- package/dist/chunk-JMZQS6OS.js +0 -81
- package/dist/chunk-K4KE5MYE.js +0 -648
- package/dist/chunk-K4KE5MYE.js.map +0 -1
- package/dist/chunk-KH2D26LQ.js +0 -2440
- package/dist/chunk-KIGC55FQ.js +0 -5505
- package/dist/chunk-KQVBR7BC.js +0 -1286
- package/dist/chunk-L63GFNKL.js +0 -403
- package/dist/chunk-LIAKZGOY.js +0 -25
- package/dist/chunk-LVFI5LG7.js +0 -576
- package/dist/chunk-MTWD4KMM.js +0 -223
- package/dist/chunk-MWVYHNSU.js +0 -623
- package/dist/chunk-MZWSOLMT.js +0 -189
- package/dist/chunk-NNEWBRUL.js +0 -271
- package/dist/chunk-NPX6WMFJ.js +0 -1686
- package/dist/chunk-O7OVWKT4.js +0 -768
- package/dist/chunk-PLJ2MQFT.js +0 -182
- package/dist/chunk-Q4AUIFUA.js +0 -111
- package/dist/chunk-QWQB7TOB.js +0 -11341
- package/dist/chunk-QZ4U67KO.js +0 -98
- package/dist/chunk-RMMVQQA6.js +0 -70
- package/dist/chunk-RSMNPYBM.js +0 -61
- package/dist/chunk-RUUJXAGT.js +0 -122
- package/dist/chunk-S45INSV3.js +0 -389
- package/dist/chunk-SCXURCVT.js +0 -218
- package/dist/chunk-SGUDMW2K.js +0 -3400
- package/dist/chunk-SLGD36MM.js +0 -53
- package/dist/chunk-SMBWBEE7.js +0 -73
- package/dist/chunk-SPFNGHHP.js +0 -115
- package/dist/chunk-SPWNCGSM.js +0 -77
- package/dist/chunk-SZ7IVZGD.js +0 -112
- package/dist/chunk-TJNDFNCU.js +0 -597
- package/dist/chunk-TJNDFNCU.js.map +0 -1
- package/dist/chunk-TQT4AOPO.js +0 -321
- package/dist/chunk-TTFJQ5B5.js +0 -43
- package/dist/chunk-U2SK45U3.js +0 -1476
- package/dist/chunk-UCH2RWFX.js +0 -216
- package/dist/chunk-UDJMJNBK.js +0 -549
- package/dist/chunk-UJBIWY5M.js +0 -212
- package/dist/chunk-ULQVG6G3.js +0 -275
- package/dist/chunk-VDX2J7OX.js +0 -264
- package/dist/chunk-VGO57TU7.js +0 -960
- package/dist/chunk-VUV472VH.js +0 -1008
- package/dist/chunk-VVX5PZFS.js +0 -297
- package/dist/chunk-WH7RINGG.js +0 -315
- package/dist/chunk-WUJD4CHZ.js +0 -137
- package/dist/chunk-X7WAM3IY.js +0 -30
- package/dist/chunk-XPFJSUOR.js +0 -921
- package/dist/chunk-XVZA6VXC.js +0 -160
- package/dist/chunk-XZRZJHBW.js +0 -31013
- package/dist/chunk-XZRZJHBW.js.map +0 -1
- package/dist/chunk-Y4G6LHJW.js +0 -35
- package/dist/chunk-Y7LZ5V7N.js +0 -202
- package/dist/chunk-YEIKOBOW.js +0 -628
- package/dist/chunk-YEIKOBOW.js.map +0 -1
- package/dist/chunk-YIIW2OH2.js +0 -566
- package/dist/chunk-ZBYVR5W4.js +0 -18504
- package/dist/chunk-ZBYVR5W4.js.map +0 -1
- package/dist/chunk-ZN7SMKAK.js +0 -210
- package/dist/chunk-ZP73EM2X.js +0 -74
- package/dist/chunk-ZXQPAYCS.js +0 -2453
- package/dist/cli-CCc34xV7.d.ts +0 -1136
- package/dist/conflict-policy-DyJ2wd-h.d.ts +0 -4
- package/dist/connectors-cli-2iaQ5tX2.d.ts +0 -263
- package/dist/dependency-propagation-delivery-BrhPjAHQ.d.ts +0 -41
- package/dist/faiss-adapter-BHecI1fF.d.ts +0 -73
- package/dist/framework-CNDn2164.d.ts +0 -170
- package/dist/generic-recall-paths-C0J1Oxb7.d.ts +0 -23
- package/dist/graph-DRkl22KE.d.ts +0 -347
- package/dist/graph-edge-decay-MKIRZ762.js +0 -30
- package/dist/index-B735x-tK.d.ts +0 -284
- package/dist/local-llm-BkkEK9rn.d.ts +0 -247
- package/dist/maintenance-CLBIvVxg.d.ts +0 -749
- package/dist/orchestrator-iexgVLow.d.ts +0 -2701
- package/dist/pipeline-DvtDtyo9.d.ts +0 -32
- package/dist/public-http-UWVcqMcb.d.ts +0 -25
- package/dist/qmd-CBYBJ6HW.d.ts +0 -353
- package/dist/resolution-LXFQQ4AE.js +0 -36
- package/dist/scope-profiles-BN1Dgfha.d.ts +0 -30
- package/dist/semantic-BalR6EXU.d.ts +0 -87
- package/dist/semantic-consolidation-D--qe0eE.d.ts +0 -180
- package/dist/service-VealHeqO.d.ts +0 -846
- package/dist/storage-BhS9gUx3.d.ts +0 -166
- package/dist/storage-CMm-3aD3.d.ts +0 -2421
- package/dist/tagging-BjsNFKWz.d.ts +0 -240
- package/dist/types-B1VHaf2w.d.ts +0 -126
- package/dist/types-DJhqDJUV.d.ts +0 -50
- package/dist/types-Du6VdoAg.d.ts +0 -5482
- /package/dist/{capsule-crypto-YO5QJ6L3.js.map → access-recall-diagnostics.js.map} +0 -0
- /package/dist/{graph-edge-decay-MKIRZ762.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{chunk-KQVBR7BC.js.map → chunk-2CBWEIS4.js.map} +0 -0
- /package/dist/{chunk-JMZQS6OS.js.map → chunk-2JQZSQXI.js.map} +0 -0
- /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-LIAKZGOY.js.map → chunk-2WMXZYMS.js.map} +0 -0
- /package/dist/{chunk-RSMNPYBM.js.map → chunk-34ZGBAGE.js.map} +0 -0
- /package/dist/{chunk-MWVYHNSU.js.map → chunk-36S7UHAW.js.map} +0 -0
- /package/dist/{chunk-G7S37WD4.js.map → chunk-3JLWSFTV.js.map} +0 -0
- /package/dist/{chunk-75YZ5VAI.js.map → chunk-3RZOLUZT.js.map} +0 -0
- /package/dist/{chunk-XVZA6VXC.js.map → chunk-3SL52JKD.js.map} +0 -0
- /package/dist/{chunk-2SIKTXWX.js.map → chunk-4QEZS7PK.js.map} +0 -0
- /package/dist/{chunk-Y4G6LHJW.js.map → chunk-5QRYGLZN.js.map} +0 -0
- /package/dist/{chunk-AQWGCHIV.js.map → chunk-5R3C5LEZ.js.map} +0 -0
- /package/dist/{chunk-SPWNCGSM.js.map → chunk-634UKELB.js.map} +0 -0
- /package/dist/{chunk-BXOPUJ3W.js.map → chunk-64JK4TL7.js.map} +0 -0
- /package/dist/{chunk-DGS34QSY.js.map → chunk-6E5GYDIE.js.map} +0 -0
- /package/dist/{chunk-D2N3PMAE.js.map → chunk-6ISP2EN2.js.map} +0 -0
- /package/dist/{chunk-UJBIWY5M.js.map → chunk-6RD7MSIO.js.map} +0 -0
- /package/dist/{chunk-RMMVQQA6.js.map → chunk-6UDLN4IA.js.map} +0 -0
- /package/dist/{chunk-7IRZK6MM.js.map → chunk-754XN6LX.js.map} +0 -0
- /package/dist/{chunk-43IQRLEF.js.map → chunk-7H2LEYYJ.js.map} +0 -0
- /package/dist/{chunk-7RGX7BMF.js.map → chunk-A7AISUJI.js.map} +0 -0
- /package/dist/{chunk-7RKAE6Y4.js.map → chunk-AULKCNZW.js.map} +0 -0
- /package/dist/{chunk-NPX6WMFJ.js.map → chunk-B7SSU55V.js.map} +0 -0
- /package/dist/{chunk-IWO6QXWJ.js.map → chunk-BICNRVEC.js.map} +0 -0
- /package/dist/{chunk-SLGD36MM.js.map → chunk-BJI2D4SU.js.map} +0 -0
- /package/dist/{chunk-CEO4DONG.js.map → chunk-BQB5ZMYO.js.map} +0 -0
- /package/dist/{chunk-WH7RINGG.js.map → chunk-C5CPYMLX.js.map} +0 -0
- /package/dist/{chunk-AHVJ6GLL.js.map → chunk-CS2JO77A.js.map} +0 -0
- /package/dist/{chunk-UDJMJNBK.js.map → chunk-DTABICJ3.js.map} +0 -0
- /package/dist/{chunk-CVILPI77.js.map → chunk-E6UNM67F.js.map} +0 -0
- /package/dist/{chunk-NNEWBRUL.js.map → chunk-ENUI3IO7.js.map} +0 -0
- /package/dist/{chunk-DZP2XMZC.js.map → chunk-FF2XYADH.js.map} +0 -0
- /package/dist/{chunk-S45INSV3.js.map → chunk-FF6N7BXC.js.map} +0 -0
- /package/dist/{chunk-2QZJ4P27.js.map → chunk-FSXD6Y4H.js.map} +0 -0
- /package/dist/{chunk-SGUDMW2K.js.map → chunk-GK6NOQE6.js.map} +0 -0
- /package/dist/{chunk-TTFJQ5B5.js.map → chunk-GRSFFLUY.js.map} +0 -0
- /package/dist/{chunk-5FAGCOZD.js.map → chunk-GWK7FEUL.js.map} +0 -0
- /package/dist/{chunk-SCXURCVT.js.map → chunk-GWQVMKUJ.js.map} +0 -0
- /package/dist/{chunk-3S6URXEH.js.map → chunk-HKHZWJ3E.js.map} +0 -0
- /package/dist/{chunk-PLJ2MQFT.js.map → chunk-IAZPYX6W.js.map} +0 -0
- /package/dist/{chunk-MZWSOLMT.js.map → chunk-IG747LRN.js.map} +0 -0
- /package/dist/{chunk-X7WAM3IY.js.map → chunk-IK63WA5A.js.map} +0 -0
- /package/dist/{chunk-BSCNBIF4.js.map → chunk-IUD6NLNM.js.map} +0 -0
- /package/dist/{chunk-3R23DDD3.js.map → chunk-JSJZ2NXS.js.map} +0 -0
- /package/dist/{chunk-YIIW2OH2.js.map → chunk-JUOJGZPV.js.map} +0 -0
- /package/dist/{chunk-VGO57TU7.js.map → chunk-KA4U5GQN.js.map} +0 -0
- /package/dist/{chunk-VDX2J7OX.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-ARRKSBQU.js.map → chunk-L4WBADKG.js.map} +0 -0
- /package/dist/{chunk-ULQVG6G3.js.map → chunk-LAL4B37X.js.map} +0 -0
- /package/dist/{chunk-D7VT2LED.js.map → chunk-LELJRLPY.js.map} +0 -0
- /package/dist/{chunk-L63GFNKL.js.map → chunk-LMMQKZK3.js.map} +0 -0
- /package/dist/{chunk-ZP73EM2X.js.map → chunk-LQ23DMTT.js.map} +0 -0
- /package/dist/{chunk-7QVYVSEH.js.map → chunk-LV6ZB6CA.js.map} +0 -0
- /package/dist/{chunk-KIGC55FQ.js.map → chunk-M5IJP3YW.js.map} +0 -0
- /package/dist/{chunk-AH44WTLJ.js.map → chunk-MWZMVLXL.js.map} +0 -0
- /package/dist/{chunk-AQ55YKEV.js.map → chunk-N4VCHRLD.js.map} +0 -0
- /package/dist/{chunk-HNHIHXSD.js.map → chunk-NKXHCCLB.js.map} +0 -0
- /package/dist/{chunk-SZ7IVZGD.js.map → chunk-NVCWA4QC.js.map} +0 -0
- /package/dist/{chunk-RUUJXAGT.js.map → chunk-ONWVMYHX.js.map} +0 -0
- /package/dist/{chunk-HMDYSGY6.js.map → chunk-P6P35FY4.js.map} +0 -0
- /package/dist/{chunk-H6WOFMOV.js.map → chunk-P7M22CYB.js.map} +0 -0
- /package/dist/{chunk-Q4AUIFUA.js.map → chunk-QMWKENNK.js.map} +0 -0
- /package/dist/{chunk-J54B5DGD.js.map → chunk-QOPB6KE3.js.map} +0 -0
- /package/dist/{chunk-DI52XAKG.js.map → chunk-RBULO7DO.js.map} +0 -0
- /package/dist/{chunk-VUV472VH.js.map → chunk-RDESQOEE.js.map} +0 -0
- /package/dist/{chunk-SPFNGHHP.js.map → chunk-RMF763SX.js.map} +0 -0
- /package/dist/{chunk-TQT4AOPO.js.map → chunk-RN6ZCNM5.js.map} +0 -0
- /package/dist/{chunk-QWQB7TOB.js.map → chunk-S2OBXHMN.js.map} +0 -0
- /package/dist/{chunk-UCH2RWFX.js.map → chunk-S3JPD4N7.js.map} +0 -0
- /package/dist/{chunk-HWLIMQE2.js.map → chunk-SF6RFI5Z.js.map} +0 -0
- /package/dist/{chunk-ZXQPAYCS.js.map → chunk-SJV3AOZ2.js.map} +0 -0
- /package/dist/{chunk-Y7LZ5V7N.js.map → chunk-SLULR4GC.js.map} +0 -0
- /package/dist/{chunk-U2SK45U3.js.map → chunk-TFXXMTHV.js.map} +0 -0
- /package/dist/{chunk-2HJKAVAS.js.map → chunk-TYP7GYRI.js.map} +0 -0
- /package/dist/{chunk-KH2D26LQ.js.map → chunk-TYZK56OA.js.map} +0 -0
- /package/dist/{chunk-XPFJSUOR.js.map → chunk-VLDVNZQE.js.map} +0 -0
- /package/dist/{chunk-AIVRD66I.js.map → chunk-W6YK672C.js.map} +0 -0
- /package/dist/{chunk-LVFI5LG7.js.map → chunk-X2NFFBTO.js.map} +0 -0
- /package/dist/{chunk-GRDRVYXJ.js.map → chunk-X45KZOT2.js.map} +0 -0
- /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-AYHNTYVG.js.map → chunk-XIXM6G7I.js.map} +0 -0
- /package/dist/{chunk-ZN7SMKAK.js.map → chunk-XLXYARWC.js.map} +0 -0
- /package/dist/{chunk-MTWD4KMM.js.map → chunk-XVW52M6I.js.map} +0 -0
- /package/dist/{chunk-27MKMTBY.js.map → chunk-YHU5XUF4.js.map} +0 -0
- /package/dist/{chunk-SMBWBEE7.js.map → chunk-YRH3C2OJ.js.map} +0 -0
- /package/dist/{chunk-WUJD4CHZ.js.map → chunk-YXQE67A7.js.map} +0 -0
- /package/dist/{chunk-EVQ33D3N.js.map → chunk-ZHUVMSHI.js.map} +0 -0
- /package/dist/{chunk-VVX5PZFS.js.map → chunk-ZHXSOMYH.js.map} +0 -0
- /package/dist/{chunk-O7OVWKT4.js.map → chunk-ZIEZJMFW.js.map} +0 -0
- /package/dist/{chunk-QZ4U67KO.js.map → chunk-ZSEFGDCI.js.map} +0 -0
- /package/dist/{chunk-DAOMWGO2.js.map → chunk-ZX5N5D6M.js.map} +0 -0
- /package/dist/{resolution-LXFQQ4AE.js.map → graph-edge-decay-ROSUPDX3.js.map} +0 -0
package/dist/chunk-IYNCJKBM.js
DELETED
|
@@ -1,3602 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WearablesInputError
|
|
3
|
-
} from "./chunk-V7IZKJI3.js";
|
|
4
|
-
import {
|
|
5
|
-
WriteRateLimiter
|
|
6
|
-
} from "./chunk-TB6CBZ5V.js";
|
|
7
|
-
import {
|
|
8
|
-
AdapterRegistry
|
|
9
|
-
} from "./chunk-Q4AUIFUA.js";
|
|
10
|
-
import {
|
|
11
|
-
maybeRespondRecallNavigation
|
|
12
|
-
} from "./chunk-QZ4U67KO.js";
|
|
13
|
-
import {
|
|
14
|
-
maybeRespondMemoryBrowse
|
|
15
|
-
} from "./chunk-HMDYSGY6.js";
|
|
16
|
-
import {
|
|
17
|
-
serializeInlineScriptValue
|
|
18
|
-
} from "./chunk-3HSRWJTC.js";
|
|
19
|
-
import {
|
|
20
|
-
respondDeepRecall
|
|
21
|
-
} from "./chunk-TTFJQ5B5.js";
|
|
22
|
-
import {
|
|
23
|
-
handleSupportPassportOwnerHttp
|
|
24
|
-
} from "./chunk-75YZ5VAI.js";
|
|
25
|
-
import {
|
|
26
|
-
buildSupportPassportPublicRequestHandler
|
|
27
|
-
} from "./chunk-2SIKTXWX.js";
|
|
28
|
-
import {
|
|
29
|
-
handleMcpGetSse
|
|
30
|
-
} from "./chunk-SRT6SHVZ.js";
|
|
31
|
-
import {
|
|
32
|
-
EngramMcpServer,
|
|
33
|
-
MCP_SUPPORTED_PROTOCOL_VERSIONS,
|
|
34
|
-
cleanupExpiredChatSessions,
|
|
35
|
-
enforceChatSessionNamespace,
|
|
36
|
-
loadChatSession,
|
|
37
|
-
processChatMessage,
|
|
38
|
-
sessionBelongsToPrincipal,
|
|
39
|
-
subscribeChatTranscript
|
|
40
|
-
} from "./chunk-FROKVQQY.js";
|
|
41
|
-
import {
|
|
42
|
-
RelayMissionStoreError
|
|
43
|
-
} from "./chunk-GRDRVYXJ.js";
|
|
44
|
-
import {
|
|
45
|
-
executeResolution,
|
|
46
|
-
isValidResolutionVerb
|
|
47
|
-
} from "./chunk-HNHIHXSD.js";
|
|
48
|
-
import {
|
|
49
|
-
isDefaultReviewNamespace,
|
|
50
|
-
listPairs,
|
|
51
|
-
readPair
|
|
52
|
-
} from "./chunk-CTVWELNK.js";
|
|
53
|
-
import {
|
|
54
|
-
toDottedRemnicName
|
|
55
|
-
} from "./chunk-ZQUVBZI4.js";
|
|
56
|
-
import {
|
|
57
|
-
respondOfflineManifestStream,
|
|
58
|
-
respondOfflineSnapshotStream
|
|
59
|
-
} from "./chunk-CK5KOVHW.js";
|
|
60
|
-
import {
|
|
61
|
-
nonEmptyQueryParam,
|
|
62
|
-
optionalNamespaceKindQueryParam,
|
|
63
|
-
optionalQueryString,
|
|
64
|
-
positiveIntQueryParam
|
|
65
|
-
} from "./chunk-AYHNTYVG.js";
|
|
66
|
-
import {
|
|
67
|
-
respondBriefingHttp
|
|
68
|
-
} from "./chunk-BSCNBIF4.js";
|
|
69
|
-
import {
|
|
70
|
-
maybeHandleLifecycleFlush
|
|
71
|
-
} from "./chunk-TIDEL77O.js";
|
|
72
|
-
import {
|
|
73
|
-
respondAccessCapabilitiesHttp
|
|
74
|
-
} from "./chunk-GZ3R6XOE.js";
|
|
75
|
-
import {
|
|
76
|
-
authorizationProbeNamespaces,
|
|
77
|
-
authorizationProbeRequiresPrincipalNamespace,
|
|
78
|
-
probeOperationAuthorization
|
|
79
|
-
} from "./chunk-3S6URXEH.js";
|
|
80
|
-
import {
|
|
81
|
-
getOperation,
|
|
82
|
-
resolveQueryNamespaceWritablePreflight
|
|
83
|
-
} from "./chunk-ZBYVR5W4.js";
|
|
84
|
-
import {
|
|
85
|
-
handleWhoKnowsHttpQuery
|
|
86
|
-
} from "./chunk-43IQRLEF.js";
|
|
87
|
-
import {
|
|
88
|
-
isTrustZoneName
|
|
89
|
-
} from "./chunk-ROBHL3GL.js";
|
|
90
|
-
import {
|
|
91
|
-
subscribeGraphEvents
|
|
92
|
-
} from "./chunk-DEUNUKTD.js";
|
|
93
|
-
import {
|
|
94
|
-
CorrectionContractError
|
|
95
|
-
} from "./chunk-QLK3SL7Q.js";
|
|
96
|
-
import {
|
|
97
|
-
isRecallDisclosure
|
|
98
|
-
} from "./chunk-4UVJ6EIT.js";
|
|
99
|
-
import {
|
|
100
|
-
validateRequest
|
|
101
|
-
} from "./chunk-YIIW2OH2.js";
|
|
102
|
-
import {
|
|
103
|
-
peerManifestRevision
|
|
104
|
-
} from "./chunk-S3YM4SZQ.js";
|
|
105
|
-
import {
|
|
106
|
-
assertOperationAllowed,
|
|
107
|
-
capabilityAllowsOp,
|
|
108
|
-
enforceNamespaceAllowList,
|
|
109
|
-
isCapabilityRestricted,
|
|
110
|
-
tokenCapabilityStore
|
|
111
|
-
} from "./chunk-MZWSOLMT.js";
|
|
112
|
-
import {
|
|
113
|
-
OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
|
|
114
|
-
OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
|
|
115
|
-
OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES
|
|
116
|
-
} from "./chunk-WQZZDN5M.js";
|
|
117
|
-
import {
|
|
118
|
-
projectTagProjectId
|
|
119
|
-
} from "./chunk-3Q3N35W7.js";
|
|
120
|
-
import {
|
|
121
|
-
expandTildePath
|
|
122
|
-
} from "./chunk-6KH5NLQS.js";
|
|
123
|
-
import {
|
|
124
|
-
EngramAccessForbiddenError,
|
|
125
|
-
EngramAccessInputError
|
|
126
|
-
} from "./chunk-2Z24E5W2.js";
|
|
127
|
-
import {
|
|
128
|
-
abortError,
|
|
129
|
-
isAbortError
|
|
130
|
-
} from "./chunk-BTTPKDIL.js";
|
|
131
|
-
import {
|
|
132
|
-
log
|
|
133
|
-
} from "./chunk-3WCASNQZ.js";
|
|
134
|
-
|
|
135
|
-
// src/access-http.ts
|
|
136
|
-
import { createServer } from "http";
|
|
137
|
-
import { randomUUID, timingSafeEqual } from "crypto";
|
|
138
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
139
|
-
import { existsSync } from "fs";
|
|
140
|
-
import { readFile } from "fs/promises";
|
|
141
|
-
import path2 from "path";
|
|
142
|
-
import { fileURLToPath, URL as URL2 } from "url";
|
|
143
|
-
import { gunzipSync } from "zlib";
|
|
144
|
-
|
|
145
|
-
// src/wearables/http-glue.ts
|
|
146
|
-
function respondWearablesErrorGlue(respondJson2, res, err) {
|
|
147
|
-
if (err instanceof WearablesInputError) {
|
|
148
|
-
respondJson2(res, 400, {
|
|
149
|
-
error: "invalid_request",
|
|
150
|
-
code: "invalid_request",
|
|
151
|
-
message: err.message
|
|
152
|
-
});
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// src/meetings/errors.ts
|
|
159
|
-
var MeetingsInputError = class extends Error {
|
|
160
|
-
constructor(message) {
|
|
161
|
-
super(message);
|
|
162
|
-
this.name = "MeetingsInputError";
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// src/meetings/http-glue.ts
|
|
167
|
-
function respondMeetingsError(respondJson2, res, err) {
|
|
168
|
-
if (err instanceof MeetingsInputError) {
|
|
169
|
-
respondJson2(res, 400, { error: "invalid_request", code: "invalid_request", message: err.message });
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
function decodeMeetingIdSegment(raw) {
|
|
175
|
-
try {
|
|
176
|
-
return decodeURIComponent(raw);
|
|
177
|
-
} catch {
|
|
178
|
-
throw new MeetingsInputError("meeting id path segment is not valid percent-encoded input");
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
async function respondMeetingsList(res, respondJson2, service, date, scope) {
|
|
182
|
-
try {
|
|
183
|
-
respondJson2(res, 200, await service.meetingsList(date, scope));
|
|
184
|
-
} catch (err) {
|
|
185
|
-
if (respondMeetingsError(respondJson2, res, err)) return;
|
|
186
|
-
throw err;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
async function respondMeetingsGet(res, respondJson2, service, rawId, scope) {
|
|
190
|
-
try {
|
|
191
|
-
respondJson2(res, 200, await service.meetingsGet(decodeMeetingIdSegment(rawId), scope));
|
|
192
|
-
} catch (err) {
|
|
193
|
-
if (respondMeetingsError(respondJson2, res, err)) return;
|
|
194
|
-
throw err;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
async function respondMeetingsBuild(req, res, respondJson2, readJsonBody, service, quota, scopeFor) {
|
|
198
|
-
const body = await readJsonBody(req);
|
|
199
|
-
const raw = body.date;
|
|
200
|
-
if (raw !== void 0 && raw !== null && raw !== "" && typeof raw !== "string") {
|
|
201
|
-
throw new EngramAccessInputError(`date must be a string (got ${JSON.stringify(raw)})`);
|
|
202
|
-
}
|
|
203
|
-
const date = raw === void 0 || raw === null || raw === "" ? void 0 : raw;
|
|
204
|
-
if (date === void 0) {
|
|
205
|
-
throw new EngramAccessInputError("date is required (YYYY-MM-DD)");
|
|
206
|
-
}
|
|
207
|
-
quota.enforceQuota();
|
|
208
|
-
const scope = scopeFor?.(
|
|
209
|
-
typeof body.namespace === "string" ? body.namespace : void 0,
|
|
210
|
-
typeof body.sessionKey === "string" ? body.sessionKey : void 0
|
|
211
|
-
);
|
|
212
|
-
try {
|
|
213
|
-
const result = await service.meetingsBuild(date, scope);
|
|
214
|
-
quota.recordHit();
|
|
215
|
-
respondJson2(res, 200, result);
|
|
216
|
-
} catch (err) {
|
|
217
|
-
if (respondMeetingsError(respondJson2, res, err)) return;
|
|
218
|
-
throw err;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// src/location/http-glue.ts
|
|
223
|
-
function requireLocationOperation(name) {
|
|
224
|
-
const op = getOperation(name);
|
|
225
|
-
if (!op) {
|
|
226
|
-
throw new Error(`access-boundary: operation not registered: ${name}`);
|
|
227
|
-
}
|
|
228
|
-
return op;
|
|
229
|
-
}
|
|
230
|
-
async function respondLocationStatus(res, respondJson2, service) {
|
|
231
|
-
const output = await requireLocationOperation("location_status").run({}, { service });
|
|
232
|
-
respondJson2(res, 200, output.result);
|
|
233
|
-
}
|
|
234
|
-
async function respondLocationCheck(res, respondJson2, service) {
|
|
235
|
-
const output = await requireLocationOperation("location_check").run({}, { service });
|
|
236
|
-
respondJson2(res, 200, { results: output.result });
|
|
237
|
-
}
|
|
238
|
-
async function respondLocationSync(body, res, respondJson2, service) {
|
|
239
|
-
const output = await requireLocationOperation("location_sync").run(
|
|
240
|
-
{ date: body.date ?? null, days: body.days ?? null },
|
|
241
|
-
{ service }
|
|
242
|
-
);
|
|
243
|
-
respondJson2(res, 200, output.result);
|
|
244
|
-
}
|
|
245
|
-
async function respondLocationBackfill(body, res, respondJson2, service) {
|
|
246
|
-
const output = await requireLocationOperation("location_backfill").run(
|
|
247
|
-
{ from: body.from ?? null, to: body.to ?? null, dryRun: body.dryRun === true },
|
|
248
|
-
{ service }
|
|
249
|
-
);
|
|
250
|
-
respondJson2(res, 200, output.result);
|
|
251
|
-
}
|
|
252
|
-
async function respondLocationDay(date, res, respondJson2, service) {
|
|
253
|
-
const output = await requireLocationOperation("location_day").run(
|
|
254
|
-
{ date: date ?? null },
|
|
255
|
-
{ service }
|
|
256
|
-
);
|
|
257
|
-
respondJson2(res, output.result.found ? 200 : 404, output.result);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// src/standup/http-glue.ts
|
|
261
|
-
async function respondStandup(date, res, respondJson2, service) {
|
|
262
|
-
const op = getOperation("standup");
|
|
263
|
-
if (!op) throw new Error("access-boundary: operation not registered: standup");
|
|
264
|
-
const output = await op.run({ ...date === null ? {} : { date } }, { service });
|
|
265
|
-
respondJson2(res, 200, output.result);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// src/chat/chat-http.ts
|
|
269
|
-
import { createHash } from "crypto";
|
|
270
|
-
var chatInFlight = /* @__PURE__ */ new Map();
|
|
271
|
-
function principalFingerprintComponent(principal) {
|
|
272
|
-
return principal === void 0 ? "\0absent" : `${principal}`;
|
|
273
|
-
}
|
|
274
|
-
function chatDedupFingerprint(memoryDir, chatSessionId, principal, message) {
|
|
275
|
-
const messageHash = createHash("sha256").update(message, "utf8").digest("hex").slice(0, 32);
|
|
276
|
-
return `${memoryDir}:${chatSessionId}:${principalFingerprintComponent(principal)}:${messageHash}`;
|
|
277
|
-
}
|
|
278
|
-
function processChatMessageDedup(opts) {
|
|
279
|
-
if (!opts.chatSessionId) {
|
|
280
|
-
return processChatMessage(opts);
|
|
281
|
-
}
|
|
282
|
-
const fp = chatDedupFingerprint(opts.memoryDir, opts.chatSessionId, opts.principal, opts.message);
|
|
283
|
-
const existing = chatInFlight.get(fp);
|
|
284
|
-
if (existing) return existing;
|
|
285
|
-
const pending = processChatMessage(opts).finally(() => {
|
|
286
|
-
chatInFlight.delete(fp);
|
|
287
|
-
});
|
|
288
|
-
chatInFlight.set(fp, pending);
|
|
289
|
-
return pending;
|
|
290
|
-
}
|
|
291
|
-
async function handleChatMessage(req, res, body, opts, principal) {
|
|
292
|
-
if (!opts.config?.enabled) {
|
|
293
|
-
respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
const message = typeof body.message === "string" ? body.message : "";
|
|
297
|
-
if (!message) {
|
|
298
|
-
respondJson(res, 400, { error: "message is required", code: "input_error" });
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
if (!opts.service.fallbackLlmRef && !opts.service.localLlmRef) {
|
|
302
|
-
respondJson(res, 503, {
|
|
303
|
-
error: "No LLM model is available. Configure a local or cloud model.",
|
|
304
|
-
code: "no_llm"
|
|
305
|
-
});
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
const chatSessionId = typeof body.chatSessionId === "string" ? body.chatSessionId : void 0;
|
|
309
|
-
let result;
|
|
310
|
-
try {
|
|
311
|
-
result = await processChatMessageDedup({
|
|
312
|
-
service: opts.service,
|
|
313
|
-
config: opts.config,
|
|
314
|
-
memoryDir: opts.memoryDir,
|
|
315
|
-
message,
|
|
316
|
-
...chatSessionId ? { chatSessionId } : {},
|
|
317
|
-
...principal ? { principal } : {}
|
|
318
|
-
});
|
|
319
|
-
} catch (err) {
|
|
320
|
-
const code = err instanceof Error ? err.message : String(err);
|
|
321
|
-
if (code === "chat_session_not_found") {
|
|
322
|
-
respondJson(res, 404, { error: "chat_session_not_found", code: "chat_session_not_found" });
|
|
323
|
-
} else if (code === "access_denied") {
|
|
324
|
-
respondJson(res, 403, { error: "access_denied", code: "access_denied" });
|
|
325
|
-
} else if (code === "chat_session_expired") {
|
|
326
|
-
respondJson(res, 410, { error: "chat_session_expired", code: "chat_session_expired" });
|
|
327
|
-
} else if (code === "chat_disabled") {
|
|
328
|
-
respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
|
|
329
|
-
} else if (code === "no_llm_available" || code === "engine_unavailable") {
|
|
330
|
-
respondJson(res, 503, {
|
|
331
|
-
error: "No LLM model is available. Configure a local or cloud model.",
|
|
332
|
-
code: "no_llm"
|
|
333
|
-
});
|
|
334
|
-
} else {
|
|
335
|
-
respondJson(res, 500, { error: "internal_error", code: "internal_error" });
|
|
336
|
-
}
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const wireResult = {
|
|
340
|
-
reply: result.reply,
|
|
341
|
-
chatSessionId: result.chatSessionId,
|
|
342
|
-
...result.pendingPlan ? {
|
|
343
|
-
pendingPlan: {
|
|
344
|
-
planId: result.pendingPlan.planId,
|
|
345
|
-
preview: result.pendingPlan.preview
|
|
346
|
-
}
|
|
347
|
-
} : {},
|
|
348
|
-
...result.skippedTools ? { skippedTools: result.skippedTools.filter((name) => typeof name === "string") } : {}
|
|
349
|
-
};
|
|
350
|
-
respondJson(res, 200, wireResult);
|
|
351
|
-
}
|
|
352
|
-
async function handleChatEventsSSE(req, res, chatSessionId, opts, principal) {
|
|
353
|
-
if (!opts.config?.enabled) {
|
|
354
|
-
respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
let heartbeat;
|
|
358
|
-
let closed = false;
|
|
359
|
-
const writeSse = (chunk) => {
|
|
360
|
-
if (closed) return false;
|
|
361
|
-
try {
|
|
362
|
-
res.write(chunk);
|
|
363
|
-
return true;
|
|
364
|
-
} catch {
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
const pending = [];
|
|
369
|
-
let bursting = true;
|
|
370
|
-
const unsubscribe = subscribeChatTranscript(opts.memoryDir, chatSessionId, (entry) => {
|
|
371
|
-
if (closed) return;
|
|
372
|
-
if (bursting) {
|
|
373
|
-
pending.push(entry);
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
writeSse(`data: ${JSON.stringify(entry)}
|
|
377
|
-
|
|
378
|
-
`);
|
|
379
|
-
});
|
|
380
|
-
const doCleanup = () => {
|
|
381
|
-
closed = true;
|
|
382
|
-
clearInterval(heartbeat);
|
|
383
|
-
unsubscribe();
|
|
384
|
-
try {
|
|
385
|
-
res.end();
|
|
386
|
-
} catch {
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
const unregisterServerCleanup = opts.registerSseCleanup?.(doCleanup) ?? (() => {
|
|
390
|
-
});
|
|
391
|
-
req.on("close", () => {
|
|
392
|
-
doCleanup();
|
|
393
|
-
unregisterServerCleanup();
|
|
394
|
-
});
|
|
395
|
-
const session = await loadChatSession(opts.memoryDir, chatSessionId);
|
|
396
|
-
if (closed) return;
|
|
397
|
-
if (!session) {
|
|
398
|
-
unsubscribe();
|
|
399
|
-
unregisterServerCleanup();
|
|
400
|
-
respondJson(res, 404, { error: "chat_session_not_found", code: "chat_session_not_found" });
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
if (!sessionBelongsToPrincipal(session, principal)) {
|
|
404
|
-
unsubscribe();
|
|
405
|
-
unregisterServerCleanup();
|
|
406
|
-
respondJson(res, 403, { error: "access_denied", code: "access_denied" });
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
res.writeHead(200, {
|
|
410
|
-
"content-type": "text/event-stream",
|
|
411
|
-
"cache-control": "no-cache",
|
|
412
|
-
connection: "keep-alive"
|
|
413
|
-
});
|
|
414
|
-
writeSse("retry: 5000\n\n");
|
|
415
|
-
const deliveredSeqs = /* @__PURE__ */ new Set();
|
|
416
|
-
for (const entry of session.transcript) {
|
|
417
|
-
writeSse(`data: ${JSON.stringify(entry)}
|
|
418
|
-
|
|
419
|
-
`);
|
|
420
|
-
deliveredSeqs.add(entry.seq);
|
|
421
|
-
}
|
|
422
|
-
bursting = false;
|
|
423
|
-
for (const entry of pending) {
|
|
424
|
-
if (!deliveredSeqs.has(entry.seq)) {
|
|
425
|
-
writeSse(`data: ${JSON.stringify(entry)}
|
|
426
|
-
|
|
427
|
-
`);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
if (closed) return;
|
|
431
|
-
heartbeat = setInterval(() => {
|
|
432
|
-
writeSse(`data: ${JSON.stringify({ type: "heartbeat" })}
|
|
433
|
-
|
|
434
|
-
`);
|
|
435
|
-
}, 25e3);
|
|
436
|
-
heartbeat.unref?.();
|
|
437
|
-
}
|
|
438
|
-
function respondJson(res, status, body) {
|
|
439
|
-
const json = JSON.stringify(body);
|
|
440
|
-
res.writeHead(status, {
|
|
441
|
-
"content-type": "application/json; charset=utf-8",
|
|
442
|
-
"content-length": Buffer.byteLength(json, "utf8")
|
|
443
|
-
});
|
|
444
|
-
res.end(json);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// src/support-passport/access-http-base.ts
|
|
448
|
-
import path from "path";
|
|
449
|
-
var SUPPORT_PASSPORT_QUOTA_LIMITED_WRITE_TOOLS = /* @__PURE__ */ new Set([
|
|
450
|
-
"engram.support_passport_draft_create",
|
|
451
|
-
"remnic.support_passport_draft_create",
|
|
452
|
-
"engram.support_passport_drafts_generate",
|
|
453
|
-
"remnic.support_passport_drafts_generate",
|
|
454
|
-
"engram.support_passport_card_replace",
|
|
455
|
-
"remnic.support_passport_card_replace",
|
|
456
|
-
"engram.support_passport_card_approve",
|
|
457
|
-
"remnic.support_passport_card_approve",
|
|
458
|
-
"engram.support_passport_card_reject",
|
|
459
|
-
"remnic.support_passport_card_reject",
|
|
460
|
-
"engram.support_passport_card_withdraw",
|
|
461
|
-
"remnic.support_passport_card_withdraw",
|
|
462
|
-
"engram.support_passport_grant_create",
|
|
463
|
-
"remnic.support_passport_grant_create",
|
|
464
|
-
"engram.support_passport_grant_revoke",
|
|
465
|
-
"remnic.support_passport_grant_revoke"
|
|
466
|
-
]);
|
|
467
|
-
var SUPPORT_PASSPORT_ADMIN_CONSOLE_ASSETS = /* @__PURE__ */ new Map([
|
|
468
|
-
["what-helps-me.css", "text/css; charset=utf-8"],
|
|
469
|
-
["model.js", "application/javascript; charset=utf-8"],
|
|
470
|
-
["app.js", "application/javascript; charset=utf-8"]
|
|
471
|
-
]);
|
|
472
|
-
var SupportPassportAccessHttpBase = class {
|
|
473
|
-
supportPassportPublicHandler;
|
|
474
|
-
handleSupportPassportOwnerRequest(req, res, pathname, hasQuery, abortSignal) {
|
|
475
|
-
return handleSupportPassportOwnerHttp({
|
|
476
|
-
req,
|
|
477
|
-
res,
|
|
478
|
-
pathname,
|
|
479
|
-
hasQuery,
|
|
480
|
-
service: this.service,
|
|
481
|
-
principal: this.resolveRequestPrincipal(req),
|
|
482
|
-
abortSignal,
|
|
483
|
-
readJsonBody: () => this.readJsonBody(req),
|
|
484
|
-
respondJson: (status, payload) => {
|
|
485
|
-
res.setHeader("cache-control", "private, no-store");
|
|
486
|
-
res.setHeader("vary", "Authorization");
|
|
487
|
-
this.respondJson(res, status, payload);
|
|
488
|
-
},
|
|
489
|
-
reserveWriteRateLimitSlot: () => this.reserveWriteRateLimitSlot(req)
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
handleSupportPassportPublicRequest(req, res) {
|
|
493
|
-
this.supportPassportPublicHandler ??= buildSupportPassportPublicRequestHandler(this.service, {
|
|
494
|
-
trustedProxyAddresses: this.service.configRef?.supportPassport?.trustedProxyAddresses ?? []
|
|
495
|
-
});
|
|
496
|
-
return this.supportPassportPublicHandler(req, res, {
|
|
497
|
-
authorized: false,
|
|
498
|
-
tokenAuthorized: false
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
async enforceSupportPassportAuthorizationProbe(req) {
|
|
502
|
-
const principal = this.resolveRequestPrincipal(req)?.trim();
|
|
503
|
-
if (!principal) {
|
|
504
|
-
throw new EngramAccessForbiddenError("A trusted principal is required for support passport access.");
|
|
505
|
-
}
|
|
506
|
-
const owner = await this.service.getWritableStorageForNamespace(void 0, principal);
|
|
507
|
-
enforceNamespaceAllowList(
|
|
508
|
-
tokenCapabilityStore.getStore(),
|
|
509
|
-
owner.namespace,
|
|
510
|
-
this.service.configRef.defaultNamespace
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
isSupportPassportQuotaLimitedWriteTool(toolName) {
|
|
514
|
-
return SUPPORT_PASSPORT_QUOTA_LIMITED_WRITE_TOOLS.has(toolName);
|
|
515
|
-
}
|
|
516
|
-
async handleSupportPassportUi(req, res, pathname) {
|
|
517
|
-
if (req.method !== "GET") return false;
|
|
518
|
-
const isSupportPassportPath = pathname === "/remnic/ui/what-helps-me" || pathname === "/engram/ui/what-helps-me" || pathname.startsWith("/remnic/ui/what-helps-me/") || pathname.startsWith("/engram/ui/what-helps-me/");
|
|
519
|
-
if (!isSupportPassportPath) return false;
|
|
520
|
-
if (!this.service.supportPassportEnabled) {
|
|
521
|
-
this.respondJson(res, 404, { error: "not_found" });
|
|
522
|
-
return true;
|
|
523
|
-
}
|
|
524
|
-
if (pathname === "/remnic/ui/what-helps-me" || pathname === "/engram/ui/what-helps-me") {
|
|
525
|
-
const search = new URL(req.url ?? pathname, "http://placeholder").search;
|
|
526
|
-
res.statusCode = 301;
|
|
527
|
-
res.setHeader("location", `${pathname}/${search}`);
|
|
528
|
-
res.end();
|
|
529
|
-
return true;
|
|
530
|
-
}
|
|
531
|
-
if (pathname === "/remnic/ui/what-helps-me/" || pathname === "/engram/ui/what-helps-me/") {
|
|
532
|
-
const helperRequest = new URL(req.url ?? pathname, "http://placeholder").searchParams.has("grant");
|
|
533
|
-
res.setHeader("content-security-policy", "frame-ancestors 'none'");
|
|
534
|
-
res.setHeader("x-frame-options", "DENY");
|
|
535
|
-
await this.respondAdminConsoleShell(req, res, pathname, "what-helps-me/index.html", !helperRequest);
|
|
536
|
-
return true;
|
|
537
|
-
}
|
|
538
|
-
const fileName = pathname.split("/").at(-1) ?? "";
|
|
539
|
-
const assetType = SUPPORT_PASSPORT_ADMIN_CONSOLE_ASSETS.get(fileName);
|
|
540
|
-
if (assetType && pathname.split("/").length === 5) {
|
|
541
|
-
await this.respondStatic(res, path.join(this.adminConsolePublicDir, "what-helps-me", fileName), assetType);
|
|
542
|
-
return true;
|
|
543
|
-
}
|
|
544
|
-
this.respondJson(res, 404, { error: "not_found" });
|
|
545
|
-
return true;
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
// src/review/review-deck-http-base.ts
|
|
550
|
-
var LIST_PATHS = ["/remnic/v1/review/deck", "/engram/v1/review/deck"];
|
|
551
|
-
var ACTION_PATHS = ["/remnic/v1/review/deck/action", "/engram/v1/review/deck/action"];
|
|
552
|
-
var UNDO_PATHS = ["/remnic/v1/review/deck/undo", "/engram/v1/review/deck/undo"];
|
|
553
|
-
var LIMIT_MIN = 1;
|
|
554
|
-
var LIMIT_MAX = 100;
|
|
555
|
-
var CURSOR_RE = /^[^\s%]{1,2048}$/;
|
|
556
|
-
function requiredString(body, field) {
|
|
557
|
-
const value = body[field];
|
|
558
|
-
if (typeof value !== "string" || value.trim().length === 0) {
|
|
559
|
-
throw new EngramAccessInputError(`${field} is required`);
|
|
560
|
-
}
|
|
561
|
-
return value.trim();
|
|
562
|
-
}
|
|
563
|
-
function parseLimit(raw) {
|
|
564
|
-
if (raw === null || raw.length === 0) {
|
|
565
|
-
throw new EngramAccessInputError("limit is required and must be an integer");
|
|
566
|
-
}
|
|
567
|
-
if (!/^(?:0|[1-9]\d*)$/.test(raw)) {
|
|
568
|
-
throw new EngramAccessInputError("limit must be an integer");
|
|
569
|
-
}
|
|
570
|
-
const value = Number(raw);
|
|
571
|
-
if (!Number.isInteger(value) || value < LIMIT_MIN || value > LIMIT_MAX) {
|
|
572
|
-
throw new EngramAccessInputError(`limit must be an integer from ${LIMIT_MIN} to ${LIMIT_MAX}`);
|
|
573
|
-
}
|
|
574
|
-
return value;
|
|
575
|
-
}
|
|
576
|
-
function parseCursor(raw) {
|
|
577
|
-
if (raw === null) return void 0;
|
|
578
|
-
if (!CURSOR_RE.test(raw)) {
|
|
579
|
-
throw new EngramAccessInputError("cursor is malformed");
|
|
580
|
-
}
|
|
581
|
-
return raw;
|
|
582
|
-
}
|
|
583
|
-
function parseActionBody(body) {
|
|
584
|
-
const action = body.action;
|
|
585
|
-
if (action !== "keep" && action !== "not_true" && action !== "prepare_fix") {
|
|
586
|
-
throw new EngramAccessInputError("action must be one of: keep, not_true, prepare_fix");
|
|
587
|
-
}
|
|
588
|
-
const itemId = requiredString(body, "itemId");
|
|
589
|
-
const revision = requiredString(body, "revision");
|
|
590
|
-
const idempotencyKey = requiredString(body, "idempotencyKey");
|
|
591
|
-
if (action === "prepare_fix") {
|
|
592
|
-
const correctionText = requiredString(body, "correctionText");
|
|
593
|
-
return { schemaVersion: 1, itemId, revision, action, correctionText, idempotencyKey };
|
|
594
|
-
}
|
|
595
|
-
return { schemaVersion: 1, itemId, revision, action, idempotencyKey };
|
|
596
|
-
}
|
|
597
|
-
function parseUndoBody(body) {
|
|
598
|
-
return {
|
|
599
|
-
schemaVersion: 1,
|
|
600
|
-
receiptId: requiredString(body, "receiptId"),
|
|
601
|
-
expectedRevision: requiredString(body, "expectedRevision"),
|
|
602
|
-
idempotencyKey: requiredString(body, "idempotencyKey")
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
var ReviewDeckAccessHttpBase = class extends SupportPassportAccessHttpBase {
|
|
606
|
-
async handleReviewDeckRequest(req, res, pathname, abortSignal) {
|
|
607
|
-
const method = req.method;
|
|
608
|
-
const isList = method === "GET" && (pathname === LIST_PATHS[0] || pathname === LIST_PATHS[1]);
|
|
609
|
-
const isAction = method === "POST" && (pathname === ACTION_PATHS[0] || pathname === ACTION_PATHS[1]);
|
|
610
|
-
const isUndo = method === "POST" && (pathname === UNDO_PATHS[0] || pathname === UNDO_PATHS[1]);
|
|
611
|
-
if (!isList && !isAction && !isUndo) return false;
|
|
612
|
-
if (!this.service.reviewDeckEnabled) {
|
|
613
|
-
this.respondJson(res, 404, { error: "not_found", code: "not_found" });
|
|
614
|
-
return true;
|
|
615
|
-
}
|
|
616
|
-
const parsed = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
617
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
618
|
-
const principal = this.resolveRequestPrincipal(req);
|
|
619
|
-
if (isList) {
|
|
620
|
-
this.enforceTokenOp("review_deck_list");
|
|
621
|
-
const page = await this.service.reviewDeckList({
|
|
622
|
-
namespace,
|
|
623
|
-
principal,
|
|
624
|
-
cursor: parseCursor(parsed.searchParams.get("cursor")),
|
|
625
|
-
limit: parseLimit(parsed.searchParams.get("limit"))
|
|
626
|
-
});
|
|
627
|
-
this.respondJson(res, 200, page);
|
|
628
|
-
return true;
|
|
629
|
-
}
|
|
630
|
-
if (isAction) this.enforceTokenOp("review_deck_action");
|
|
631
|
-
else this.enforceTokenOp("review_deck_undo");
|
|
632
|
-
const writeQuota = this.reserveWriteRateLimitSlot(req);
|
|
633
|
-
try {
|
|
634
|
-
const body = await this.readJsonBody(req, this.maxBodyBytes);
|
|
635
|
-
const result = isAction ? await this.service.reviewDeckAction(parseActionBody(body), {
|
|
636
|
-
namespace,
|
|
637
|
-
principal,
|
|
638
|
-
signal: abortSignal
|
|
639
|
-
}) : await this.service.reviewDeckUndo(parseUndoBody(body), {
|
|
640
|
-
namespace,
|
|
641
|
-
principal,
|
|
642
|
-
signal: abortSignal
|
|
643
|
-
});
|
|
644
|
-
writeQuota.commit();
|
|
645
|
-
this.respondJson(res, 200, result);
|
|
646
|
-
} catch (error) {
|
|
647
|
-
writeQuota.release();
|
|
648
|
-
throw error;
|
|
649
|
-
}
|
|
650
|
-
return true;
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
|
|
654
|
-
// src/access-http.ts
|
|
655
|
-
function resolveDefaultAdminConsolePublicDir(sourceUrl = import.meta.url) {
|
|
656
|
-
const thisDir = path2.dirname(fileURLToPath(sourceUrl));
|
|
657
|
-
const candidates = [
|
|
658
|
-
path2.resolve(thisDir, "../../../admin-console/public"),
|
|
659
|
-
path2.resolve(thisDir, "../dist/admin-console/public"),
|
|
660
|
-
path2.resolve(thisDir, "./admin-console/public"),
|
|
661
|
-
path2.resolve(thisDir, "../../admin-console/public")
|
|
662
|
-
];
|
|
663
|
-
return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
|
|
664
|
-
}
|
|
665
|
-
var defaultAdminConsolePublicDir = resolveDefaultAdminConsolePublicDir();
|
|
666
|
-
var correlationIdStore = new AsyncLocalStorage();
|
|
667
|
-
var RELAY_ADMIN_CONSOLE_ASSETS = /* @__PURE__ */ new Map([
|
|
668
|
-
["relay.css", "text/css; charset=utf-8"],
|
|
669
|
-
["relay-model.js", "application/javascript; charset=utf-8"],
|
|
670
|
-
["relay.js", "application/javascript; charset=utf-8"],
|
|
671
|
-
["replay.json", "application/json; charset=utf-8"]
|
|
672
|
-
]);
|
|
673
|
-
var TRUST_ZONE_RECORD_KINDS = ["memory", "artifact", "state", "trajectory", "external"];
|
|
674
|
-
var TRUST_ZONE_SOURCE_CLASSES = ["tool_output", "web_content", "subagent_trace", "system_memory", "user_input", "manual"];
|
|
675
|
-
var HttpError = class extends Error {
|
|
676
|
-
constructor(status, message, code, details) {
|
|
677
|
-
super(message);
|
|
678
|
-
this.status = status;
|
|
679
|
-
this.code = code ?? `http_${status}`;
|
|
680
|
-
this.details = details;
|
|
681
|
-
}
|
|
682
|
-
status;
|
|
683
|
-
code;
|
|
684
|
-
details;
|
|
685
|
-
};
|
|
686
|
-
function hostToUrlAuthority(host) {
|
|
687
|
-
if (host.includes(":") && !host.startsWith("[") && !host.endsWith("]")) {
|
|
688
|
-
return `[${host}]`;
|
|
689
|
-
}
|
|
690
|
-
return host;
|
|
691
|
-
}
|
|
692
|
-
function parseHttpServerPort(port) {
|
|
693
|
-
if (port === void 0) return 0;
|
|
694
|
-
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
695
|
-
throw new Error("access HTTP port must be an integer from 0 to 65535");
|
|
696
|
-
}
|
|
697
|
-
return port;
|
|
698
|
-
}
|
|
699
|
-
function assertResourceMetadataUrl(value) {
|
|
700
|
-
if (value === void 0) return void 0;
|
|
701
|
-
let parsed;
|
|
702
|
-
try {
|
|
703
|
-
parsed = new URL2(value);
|
|
704
|
-
} catch {
|
|
705
|
-
throw new Error(
|
|
706
|
-
`access HTTP resourceMetadataUrl must be an absolute http(s) URL, got: ${value}`
|
|
707
|
-
);
|
|
708
|
-
}
|
|
709
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
710
|
-
throw new Error(
|
|
711
|
-
`access HTTP resourceMetadataUrl must use http or https, got: ${parsed.protocol}`
|
|
712
|
-
);
|
|
713
|
-
}
|
|
714
|
-
return value;
|
|
715
|
-
}
|
|
716
|
-
function parseTrustZoneKindFilter(raw) {
|
|
717
|
-
if (raw === null) return void 0;
|
|
718
|
-
if (TRUST_ZONE_RECORD_KINDS.includes(raw)) {
|
|
719
|
-
return raw;
|
|
720
|
-
}
|
|
721
|
-
throw new HttpError(400, `kind must be one of ${TRUST_ZONE_RECORD_KINDS.join("|")}`, "invalid_kind_filter");
|
|
722
|
-
}
|
|
723
|
-
function parseTrustZoneSourceClassFilter(raw) {
|
|
724
|
-
if (raw === null) return void 0;
|
|
725
|
-
if (TRUST_ZONE_SOURCE_CLASSES.includes(raw)) {
|
|
726
|
-
return raw;
|
|
727
|
-
}
|
|
728
|
-
throw new HttpError(400, `sourceClass must be one of ${TRUST_ZONE_SOURCE_CLASSES.join("|")}`, "invalid_source_class_filter");
|
|
729
|
-
}
|
|
730
|
-
function parseTrustZoneFilter(raw) {
|
|
731
|
-
if (raw === null) return void 0;
|
|
732
|
-
if (isTrustZoneName(raw)) {
|
|
733
|
-
return raw;
|
|
734
|
-
}
|
|
735
|
-
throw new HttpError(400, "zone must be one of quarantine|working|trusted", "invalid_zone_filter");
|
|
736
|
-
}
|
|
737
|
-
function summarizeHttpRequest(req) {
|
|
738
|
-
const method = req.method ?? "UNKNOWN";
|
|
739
|
-
try {
|
|
740
|
-
const parsed = new URL2(req.url ?? "/", "http://localhost");
|
|
741
|
-
return `${method} ${parsed.pathname}`;
|
|
742
|
-
} catch {
|
|
743
|
-
return `${method} ${(req.url ?? "/").split("?")[0]}`;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
function parseStrictIntegerQuery(raw, field, defaultValue, minValue) {
|
|
747
|
-
if (raw === null) return defaultValue;
|
|
748
|
-
if (!/^(?:0|[1-9]\d*)$/.test(raw)) {
|
|
749
|
-
throw new HttpError(400, `${field} must be an integer`, `invalid_${field}`);
|
|
750
|
-
}
|
|
751
|
-
const value = Number(raw);
|
|
752
|
-
if (!Number.isInteger(value) || value < minValue) {
|
|
753
|
-
throw new HttpError(400, `${field} must be an integer >= ${minValue}`, `invalid_${field}`);
|
|
754
|
-
}
|
|
755
|
-
return value;
|
|
756
|
-
}
|
|
757
|
-
function parseMemorySort(raw) {
|
|
758
|
-
if (raw === null) return void 0;
|
|
759
|
-
if (raw === "updated_desc" || raw === "updated_asc" || raw === "created_desc" || raw === "created_asc") {
|
|
760
|
-
return raw;
|
|
761
|
-
}
|
|
762
|
-
throw new HttpError(400, "sort must be one of updated_desc|updated_asc|created_desc|created_asc", "invalid_sort");
|
|
763
|
-
}
|
|
764
|
-
function decodePeerIdSegment(raw) {
|
|
765
|
-
try {
|
|
766
|
-
return decodeURIComponent(raw);
|
|
767
|
-
} catch {
|
|
768
|
-
throw new EngramAccessInputError("peerId path segment is not valid percent-encoded input");
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
function decodeRelayMissionIdSegment(raw) {
|
|
772
|
-
try {
|
|
773
|
-
return decodeURIComponent(raw);
|
|
774
|
-
} catch {
|
|
775
|
-
throw new EngramAccessInputError("missionId path segment is not valid percent-encoded input");
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
function rejectBlankRelayNamespace(value) {
|
|
779
|
-
if (value !== void 0 && value !== null && value.trim().length === 0) {
|
|
780
|
-
throw new EngramAccessInputError("Relay namespace must not be blank when provided");
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
function codingContextFromProjectTag(projectTag) {
|
|
784
|
-
const projectId = projectTagProjectId(projectTag);
|
|
785
|
-
return {
|
|
786
|
-
projectId,
|
|
787
|
-
branch: null,
|
|
788
|
-
rootPath: projectId,
|
|
789
|
-
defaultBranch: null
|
|
790
|
-
};
|
|
791
|
-
}
|
|
792
|
-
var EngramAccessHttpServer = class extends ReviewDeckAccessHttpBase {
|
|
793
|
-
service;
|
|
794
|
-
host;
|
|
795
|
-
requestedPort;
|
|
796
|
-
authToken;
|
|
797
|
-
authTokens;
|
|
798
|
-
authTokensGetter;
|
|
799
|
-
authTokenEntriesGetter;
|
|
800
|
-
tokenPathPolicy;
|
|
801
|
-
authenticatedPrincipal;
|
|
802
|
-
maxBodyBytes;
|
|
803
|
-
adminConsoleEnabled;
|
|
804
|
-
adminConsolePublicDir;
|
|
805
|
-
adminConsolePrefillToken;
|
|
806
|
-
adminControls;
|
|
807
|
-
trustPrincipalHeader;
|
|
808
|
-
adapterRegistry;
|
|
809
|
-
readiness;
|
|
810
|
-
resourceMetadataUrl;
|
|
811
|
-
externalRequestHandler;
|
|
812
|
-
writeLimiter;
|
|
813
|
-
mcpServer;
|
|
814
|
-
server = null;
|
|
815
|
-
boundPort = 0;
|
|
816
|
-
/** Active SSE response objects for /engram/v1/graph/events. */
|
|
817
|
-
sseClients = /* @__PURE__ */ new Set();
|
|
818
|
-
/** Throttle batch: pending SSE event batches per client. */
|
|
819
|
-
sseBatchTimers = /* @__PURE__ */ new Map();
|
|
820
|
-
ssePendingBatches = /* @__PURE__ */ new Map();
|
|
821
|
-
/**
|
|
822
|
-
* Per-client cleanup callbacks: clear heartbeat interval, flush timer,
|
|
823
|
-
* unsubscribe from bus, and end the response. Stored here so `stop()`
|
|
824
|
-
* can invoke them even when the client hasn't disconnected yet
|
|
825
|
-
* (Cursor review thread `access-http.ts:232`).
|
|
826
|
-
*/
|
|
827
|
-
sseCleanupFns = /* @__PURE__ */ new Set();
|
|
828
|
-
/**
|
|
829
|
-
* Periodic chat-session TTL sweep handle (issue #1685 item 1 /
|
|
830
|
-
* #1687 Thread 21). unref'd so it never blocks process exit
|
|
831
|
-
* (rule 47); cleared in `stop()`.
|
|
832
|
-
*/
|
|
833
|
-
chatTtlTimer = null;
|
|
834
|
-
constructor(options) {
|
|
835
|
-
super();
|
|
836
|
-
this.service = options.service;
|
|
837
|
-
this.host = options.host?.trim() || "127.0.0.1";
|
|
838
|
-
this.requestedPort = parseHttpServerPort(options.port);
|
|
839
|
-
this.authToken = options.authToken?.trim() || void 0;
|
|
840
|
-
this.authTokens = (options.authTokens ?? []).map((t) => t.trim()).filter(Boolean);
|
|
841
|
-
this.authTokensGetter = options.authTokensGetter;
|
|
842
|
-
this.authTokenEntriesGetter = options.authTokenEntriesGetter;
|
|
843
|
-
this.tokenPathPolicy = options.tokenPathPolicy;
|
|
844
|
-
this.authenticatedPrincipal = options.principal?.trim() || void 0;
|
|
845
|
-
this.maxBodyBytes = Number.isFinite(options.maxBodyBytes) ? Math.max(1, Math.floor(options.maxBodyBytes ?? 131072)) : 131072;
|
|
846
|
-
this.writeLimiter = new WriteRateLimiter(
|
|
847
|
-
options.writeRateLimitMaxRequests,
|
|
848
|
-
options.writeRateLimitWindowMs
|
|
849
|
-
);
|
|
850
|
-
this.adminConsoleEnabled = options.adminConsoleEnabled !== false;
|
|
851
|
-
this.adminConsolePublicDir = options.adminConsolePublicDir ?? defaultAdminConsolePublicDir;
|
|
852
|
-
this.adminConsolePrefillToken = options.adminConsolePrefillToken === true ? this.authToken : void 0;
|
|
853
|
-
this.adminControls = options.adminControls;
|
|
854
|
-
this.trustPrincipalHeader = options.trustPrincipalHeader === true;
|
|
855
|
-
this.readiness = options.readiness ?? (() => ({ ready: true, warmupAttempts: 0 }));
|
|
856
|
-
this.resourceMetadataUrl = assertResourceMetadataUrl(options.resourceMetadataUrl);
|
|
857
|
-
this.externalRequestHandler = options.externalRequestHandler;
|
|
858
|
-
this.adapterRegistry = options.enableAdapters !== false ? options.adapterRegistry ?? new AdapterRegistry() : null;
|
|
859
|
-
this.mcpServer = new EngramMcpServer(this.service, {
|
|
860
|
-
principal: options.principal,
|
|
861
|
-
citationsEnabled: options.citationsEnabled,
|
|
862
|
-
citationsAutoDetect: options.citationsAutoDetect,
|
|
863
|
-
emitLegacyTools: options.emitLegacyTools,
|
|
864
|
-
codingDecisionVisible: this.service.decisionRecordSurfaceVisible,
|
|
865
|
-
architectureCardVisible: this.service.architectureCardSurfaceVisible,
|
|
866
|
-
codegraphVisible: this.service.codegraphSurfaceVisible,
|
|
867
|
-
sessionDeltaVisible: this.service.sessionDeltaSurfaceVisible,
|
|
868
|
-
chatVisible: this.service.configRef?.chat?.enabled === true,
|
|
869
|
-
correctionVisible: this.service.correctionSurfaceVisible
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
async start() {
|
|
873
|
-
if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter && !this.authTokenEntriesGetter) {
|
|
874
|
-
throw new Error("engram access HTTP requires authToken or authTokens");
|
|
875
|
-
}
|
|
876
|
-
if (this.server) return this.status();
|
|
877
|
-
const server = createServer((req, res) => {
|
|
878
|
-
const correlationId = randomUUID();
|
|
879
|
-
const abortController = new AbortController();
|
|
880
|
-
const abortDisconnectedRequest = () => {
|
|
881
|
-
if (!res.writableFinished && !abortController.signal.aborted) {
|
|
882
|
-
abortController.abort(abortError("HTTP client disconnected"));
|
|
883
|
-
}
|
|
884
|
-
};
|
|
885
|
-
req.once("aborted", abortDisconnectedRequest);
|
|
886
|
-
res.once("close", abortDisconnectedRequest);
|
|
887
|
-
correlationIdStore.run(correlationId, () => {
|
|
888
|
-
void this.handle(req, res, correlationId, abortController.signal).catch((err) => {
|
|
889
|
-
if (isAbortError(err)) {
|
|
890
|
-
if (!res.destroyed && !res.writableEnded) {
|
|
891
|
-
res.end();
|
|
892
|
-
}
|
|
893
|
-
return;
|
|
894
|
-
}
|
|
895
|
-
log.debug(`engram access HTTP request failed [${correlationId}]: ${err}`);
|
|
896
|
-
if (err instanceof HttpError) {
|
|
897
|
-
const payload = { error: err.message, code: err.code };
|
|
898
|
-
if (err.details) payload.details = err.details;
|
|
899
|
-
this.respondJson(res, err.status, payload);
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
if (err instanceof EngramAccessInputError) {
|
|
903
|
-
this.respondJson(res, 400, { error: err.message, code: "input_error" });
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
if (err instanceof EngramAccessForbiddenError) {
|
|
907
|
-
this.respondJson(res, 403, { error: err.message, code: "forbidden" });
|
|
908
|
-
return;
|
|
909
|
-
}
|
|
910
|
-
if (err instanceof CorrectionContractError) {
|
|
911
|
-
this.respondJson(res, 400, { error: err.message, code: "correction_contract_error" });
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
if (err instanceof RelayMissionStoreError) {
|
|
915
|
-
const status = err.code === "idempotency_conflict" ? 409 : err.code === "limit_exceeded" ? 413 : err.code === "lock_unavailable" ? 503 : 500;
|
|
916
|
-
this.respondJson(res, status, {
|
|
917
|
-
error: status >= 500 ? "relay_backend_unavailable" : err.message,
|
|
918
|
-
code: `relay_${err.code}`
|
|
919
|
-
});
|
|
920
|
-
return;
|
|
921
|
-
}
|
|
922
|
-
if (res.headersSent) {
|
|
923
|
-
res.destroy(err);
|
|
924
|
-
return;
|
|
925
|
-
}
|
|
926
|
-
log.error(
|
|
927
|
-
`engram access HTTP internal error [${correlationId}] ${summarizeHttpRequest(req)}`,
|
|
928
|
-
err
|
|
929
|
-
);
|
|
930
|
-
this.respondJson(res, 500, { error: "internal_error", code: "internal_error" });
|
|
931
|
-
}).finally(() => {
|
|
932
|
-
req.off("aborted", abortDisconnectedRequest);
|
|
933
|
-
res.off("close", abortDisconnectedRequest);
|
|
934
|
-
});
|
|
935
|
-
});
|
|
936
|
-
});
|
|
937
|
-
try {
|
|
938
|
-
await new Promise((resolve, reject) => {
|
|
939
|
-
const onError = (err) => {
|
|
940
|
-
server.off("listening", onListening);
|
|
941
|
-
reject(err);
|
|
942
|
-
};
|
|
943
|
-
const onListening = () => {
|
|
944
|
-
server.off("error", onError);
|
|
945
|
-
resolve();
|
|
946
|
-
};
|
|
947
|
-
server.once("error", onError);
|
|
948
|
-
server.once("listening", onListening);
|
|
949
|
-
server.listen(this.requestedPort, this.host);
|
|
950
|
-
});
|
|
951
|
-
} catch (err) {
|
|
952
|
-
server.close();
|
|
953
|
-
throw err;
|
|
954
|
-
}
|
|
955
|
-
this.server = server;
|
|
956
|
-
const address = server.address();
|
|
957
|
-
this.boundPort = typeof address === "object" && address ? address.port : this.requestedPort;
|
|
958
|
-
this.scheduleChatSessionTtlSweep();
|
|
959
|
-
return this.status();
|
|
960
|
-
}
|
|
961
|
-
async stop() {
|
|
962
|
-
if (!this.server) return;
|
|
963
|
-
if (this.chatTtlTimer) {
|
|
964
|
-
clearInterval(this.chatTtlTimer);
|
|
965
|
-
this.chatTtlTimer = null;
|
|
966
|
-
}
|
|
967
|
-
const server = this.server;
|
|
968
|
-
this.server = null;
|
|
969
|
-
this.boundPort = 0;
|
|
970
|
-
for (const cleanup of this.sseCleanupFns) {
|
|
971
|
-
try {
|
|
972
|
-
cleanup();
|
|
973
|
-
} catch {
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
this.sseCleanupFns.clear();
|
|
977
|
-
for (const [res, timer] of this.sseBatchTimers.entries()) {
|
|
978
|
-
clearTimeout(timer);
|
|
979
|
-
this.sseBatchTimers.delete(res);
|
|
980
|
-
}
|
|
981
|
-
this.ssePendingBatches.clear();
|
|
982
|
-
for (const res of this.sseClients) {
|
|
983
|
-
try {
|
|
984
|
-
res.end();
|
|
985
|
-
} catch {
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
this.sseClients.clear();
|
|
989
|
-
await new Promise((resolve, reject) => {
|
|
990
|
-
server.close((err) => err ? reject(err) : resolve());
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
/**
|
|
994
|
-
* Schedule the chat-session TTL sweep: one immediate pass plus a
|
|
995
|
-
* recurring hourly pass (issue #1685 item 1 / #1687 Thread 21). Both
|
|
996
|
-
* are skipped when chat is disabled. The recurring timer is unref'd
|
|
997
|
-
* so it never keeps the event loop alive on its own (rule 47). The
|
|
998
|
-
* sweep itself is best-effort — cleanup failures are swallowed inside
|
|
999
|
-
* `cleanupExpiredChatSessions`.
|
|
1000
|
-
*/
|
|
1001
|
-
scheduleChatSessionTtlSweep() {
|
|
1002
|
-
if (this.chatTtlTimer) {
|
|
1003
|
-
clearInterval(this.chatTtlTimer);
|
|
1004
|
-
this.chatTtlTimer = null;
|
|
1005
|
-
}
|
|
1006
|
-
const chat = this.service.configRef?.chat;
|
|
1007
|
-
if (!chat?.enabled) return;
|
|
1008
|
-
const ttlHours = typeof chat.sessionTtlHours === "number" && chat.sessionTtlHours > 0 ? chat.sessionTtlHours : 72;
|
|
1009
|
-
void cleanupExpiredChatSessions(this.service.memoryDir, ttlHours).catch(() => {
|
|
1010
|
-
});
|
|
1011
|
-
const SWEEP_INTERVAL_MS = 60 * 60 * 1e3;
|
|
1012
|
-
this.chatTtlTimer = setInterval(() => {
|
|
1013
|
-
void cleanupExpiredChatSessions(this.service.memoryDir, ttlHours).catch(() => {
|
|
1014
|
-
});
|
|
1015
|
-
}, SWEEP_INTERVAL_MS);
|
|
1016
|
-
this.chatTtlTimer.unref?.();
|
|
1017
|
-
}
|
|
1018
|
-
status() {
|
|
1019
|
-
return {
|
|
1020
|
-
running: this.server !== null,
|
|
1021
|
-
host: this.host,
|
|
1022
|
-
port: this.boundPort,
|
|
1023
|
-
maxBodyBytes: this.maxBodyBytes
|
|
1024
|
-
};
|
|
1025
|
-
}
|
|
1026
|
-
/**
|
|
1027
|
-
* Resolve the adapter identity for the incoming request.
|
|
1028
|
-
* Includes MCP clientInfo from the last initialize handshake if available.
|
|
1029
|
-
* Returns null if no adapter matches or adapters are disabled.
|
|
1030
|
-
*/
|
|
1031
|
-
resolveAdapterIdentity(req) {
|
|
1032
|
-
if (!this.adapterRegistry) return null;
|
|
1033
|
-
const sessionId = (() => {
|
|
1034
|
-
const raw = req.headers["mcp-session-id"];
|
|
1035
|
-
return typeof raw === "string" ? raw.trim() : void 0;
|
|
1036
|
-
})();
|
|
1037
|
-
return this.adapterRegistry.resolve({
|
|
1038
|
-
headers: req.headers,
|
|
1039
|
-
clientInfo: this.mcpServer.getClientInfo(sessionId)
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
1042
|
-
/** Cache for per-request identity resolution (avoids double adapter resolution) */
|
|
1043
|
-
identityCache = /* @__PURE__ */ new WeakMap();
|
|
1044
|
-
/** Resolve principal, namespace, and session key from request headers and adapter identity */
|
|
1045
|
-
resolveRequestIdentity(req) {
|
|
1046
|
-
const cached = this.identityCache.get(req);
|
|
1047
|
-
if (cached) return cached;
|
|
1048
|
-
let principal;
|
|
1049
|
-
let namespace;
|
|
1050
|
-
let sessionKey;
|
|
1051
|
-
if (this.trustPrincipalHeader) {
|
|
1052
|
-
const headerVal = req.headers["x-engram-principal"];
|
|
1053
|
-
const raw = Array.isArray(headerVal) ? headerVal[0] : headerVal;
|
|
1054
|
-
if (typeof raw === "string") {
|
|
1055
|
-
const trimmed = raw.trim();
|
|
1056
|
-
if (trimmed.length > 0) {
|
|
1057
|
-
principal = trimmed;
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
if (!principal) {
|
|
1062
|
-
principal = this.authenticatedPrincipal;
|
|
1063
|
-
}
|
|
1064
|
-
const adapterIdentity = this.resolveAdapterIdentity(req);
|
|
1065
|
-
if (adapterIdentity) {
|
|
1066
|
-
if (!principal) {
|
|
1067
|
-
principal = adapterIdentity.principal;
|
|
1068
|
-
}
|
|
1069
|
-
namespace = adapterIdentity.namespace;
|
|
1070
|
-
sessionKey = adapterIdentity.sessionKey;
|
|
1071
|
-
}
|
|
1072
|
-
const result = { principal, namespace, sessionKey };
|
|
1073
|
-
this.identityCache.set(req, result);
|
|
1074
|
-
return result;
|
|
1075
|
-
}
|
|
1076
|
-
resolveRequestPrincipal(req) {
|
|
1077
|
-
return this.resolveRequestIdentity(req).principal;
|
|
1078
|
-
}
|
|
1079
|
-
/** Caller scope for wearables/meetings ops (issue #2123): request principal +
|
|
1080
|
-
* gated namespace + optional sessionKey, so reads/writes resolve to the caller
|
|
1081
|
-
* namespace instead of the machine default. */
|
|
1082
|
-
wearablesScope(req, namespace, sessionKey) {
|
|
1083
|
-
return { authenticatedPrincipal: this.resolveRequestPrincipal(req), namespace: this.resolveNamespace(req, namespace), ...sessionKey ? { sessionKey } : {} };
|
|
1084
|
-
}
|
|
1085
|
-
/** Resolve namespace: only use the explicit body value. Adapter-inferred namespace
|
|
1086
|
-
* is intentionally NOT used as a fallback for REST requests — omitting namespace
|
|
1087
|
-
* should default to the server's global namespace, not silently scope to an adapter. */
|
|
1088
|
-
resolveNamespace(_req, bodyNamespace) {
|
|
1089
|
-
const namespace = bodyNamespace || void 0;
|
|
1090
|
-
enforceNamespaceAllowList(tokenCapabilityStore.getStore(), namespace, this.service.configRef?.defaultNamespace);
|
|
1091
|
-
return namespace;
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Resolve + enforce the `namespace` field carried in a POST request body,
|
|
1095
|
-
* returning a shallow-copied envelope with the gated namespace stamped on.
|
|
1096
|
-
* Used by the coding/correction POST routes that pass `body` straight to
|
|
1097
|
-
* `op.run`: the body `namespace` is a user-controlled field that MUST flow
|
|
1098
|
-
* through the same effective-namespace allow-list gate as the query-param
|
|
1099
|
-
* routes, otherwise a scoped bearer can scope its call to another tenant
|
|
1100
|
-
* by setting `body.namespace` (issue #1850 finding 2). Throws 403 for a
|
|
1101
|
-
* scoped token whose allow-list does not cover the effective namespace.
|
|
1102
|
-
*
|
|
1103
|
-
* A `namespace` that is neither a string nor `null` is REJECTED here rather
|
|
1104
|
-
* than coerced to `undefined`: silently reinterpreting it would default the
|
|
1105
|
-
* request to the principal's namespace set and answer 200, hiding the
|
|
1106
|
-
* caller's mistake behind a plausible result (AGENTS.md pattern 39). `null`
|
|
1107
|
-
* and an absent field keep their documented "no explicit namespace" meaning.
|
|
1108
|
-
*/
|
|
1109
|
-
gatedBodyNamespace(req, body) {
|
|
1110
|
-
const requested = body.namespace;
|
|
1111
|
-
if (requested !== void 0 && requested !== null && typeof requested !== "string") {
|
|
1112
|
-
throw new EngramAccessInputError(
|
|
1113
|
-
`namespace must be a string or null (got: ${typeof requested})`
|
|
1114
|
-
);
|
|
1115
|
-
}
|
|
1116
|
-
const trimmed = typeof requested === "string" ? requested.trim() : void 0;
|
|
1117
|
-
const namespace = this.resolveNamespace(req, trimmed || void 0);
|
|
1118
|
-
return { ...body, namespace };
|
|
1119
|
-
}
|
|
1120
|
-
/**
|
|
1121
|
-
* Resolve the recall disclosure depth from the request (issue #677 PR
|
|
1122
|
-
* 2/4). Explicit body value wins; otherwise we accept a
|
|
1123
|
-
* `?disclosure=...` query parameter so curl/browser tooling can use the
|
|
1124
|
-
* three-tier surface without rewriting JSON. Invalid query values
|
|
1125
|
-
* throw `EngramAccessInputError` (CLAUDE.md rule 51 — no silent
|
|
1126
|
-
* fallback). An absent body field AND an absent query param yields
|
|
1127
|
-
* `undefined`, which the service maps to `DEFAULT_RECALL_DISCLOSURE`.
|
|
1128
|
-
*/
|
|
1129
|
-
resolveRecallDisclosure(bodyDisclosure, parsed) {
|
|
1130
|
-
if (bodyDisclosure !== void 0) {
|
|
1131
|
-
return bodyDisclosure;
|
|
1132
|
-
}
|
|
1133
|
-
const queryDisclosure = parsed.searchParams.get("disclosure");
|
|
1134
|
-
if (queryDisclosure === null) {
|
|
1135
|
-
return void 0;
|
|
1136
|
-
}
|
|
1137
|
-
if (!isRecallDisclosure(queryDisclosure)) {
|
|
1138
|
-
throw new EngramAccessInputError(
|
|
1139
|
-
`disclosure must be one of: chunk, section, raw (got: ${queryDisclosure})`
|
|
1140
|
-
);
|
|
1141
|
-
}
|
|
1142
|
-
return queryDisclosure;
|
|
1143
|
-
}
|
|
1144
|
-
async handle(req, res, correlationId, abortSignal) {
|
|
1145
|
-
const parsed = new URL2(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
|
|
1146
|
-
const pathname = parsed.pathname;
|
|
1147
|
-
if (await this.handleSupportPassportUi(req, res, pathname)) return;
|
|
1148
|
-
if (this.adminConsoleEnabled && await this.handleAdminConsole(req, res, pathname)) return;
|
|
1149
|
-
if (req.method === "GET" && (pathname === "/engram/v1/live" || pathname === "/engram/v1/health")) {
|
|
1150
|
-
const { ready, warmupAttempts, lastError } = this.readiness();
|
|
1151
|
-
if (!ready) {
|
|
1152
|
-
this.respondJson(res, 503, {
|
|
1153
|
-
ok: false,
|
|
1154
|
-
ready: false,
|
|
1155
|
-
warmupAttempts,
|
|
1156
|
-
lastError: lastError ?? null,
|
|
1157
|
-
code: "not_ready"
|
|
1158
|
-
});
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
if (await this.handleSupportPassportPublicRequest(req, res)) return;
|
|
1163
|
-
if (this.externalRequestHandler) {
|
|
1164
|
-
const tokenAuthorized = this.isAuthorized(req, pathname);
|
|
1165
|
-
const capabilities = this.resolveTokenCapabilities(req, pathname);
|
|
1166
|
-
const authorized = tokenAuthorized && !isCapabilityRestricted(capabilities);
|
|
1167
|
-
if (await this.externalRequestHandler(req, res, {
|
|
1168
|
-
authorized,
|
|
1169
|
-
tokenAuthorized
|
|
1170
|
-
})) return;
|
|
1171
|
-
}
|
|
1172
|
-
if (!this.isAuthorized(req, pathname)) {
|
|
1173
|
-
const body = JSON.stringify({ error: "unauthorized", code: "unauthorized" });
|
|
1174
|
-
res.writeHead(401, {
|
|
1175
|
-
"content-type": "application/json; charset=utf-8",
|
|
1176
|
-
"www-authenticate": this.bearerChallenge(),
|
|
1177
|
-
"x-request-id": correlationId
|
|
1178
|
-
});
|
|
1179
|
-
res.end(body);
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
const caps = this.resolveTokenCapabilities(req, pathname);
|
|
1183
|
-
await tokenCapabilityStore.run(caps, async () => {
|
|
1184
|
-
await this.dispatchAuthorizedRequest(req, res, parsed, pathname, correlationId, abortSignal);
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
async dispatchAuthorizedRequest(req, res, parsed, pathname, correlationId, abortSignal) {
|
|
1188
|
-
if (pathname === "/mcp" && req.method === "DELETE") {
|
|
1189
|
-
res.writeHead(204);
|
|
1190
|
-
res.end();
|
|
1191
|
-
return;
|
|
1192
|
-
}
|
|
1193
|
-
if (pathname === "/mcp" && req.method === "GET") {
|
|
1194
|
-
if ((req.headers.accept ?? "").includes("text/event-stream"))
|
|
1195
|
-
return handleMcpGetSse(req, res, this.sseCleanupFns);
|
|
1196
|
-
const body = JSON.stringify({ error: "method_not_allowed", code: "method_not_allowed" });
|
|
1197
|
-
res.writeHead(405, { "content-type": "application/json; charset=utf-8", allow: "GET, POST, DELETE", "x-request-id": correlationId });
|
|
1198
|
-
res.end(body);
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
if (req.method === "POST" && pathname === "/mcp") return this.handleMcpRequest(req, res, abortSignal);
|
|
1202
|
-
if (await this.handleSupportPassportOwnerRequest(req, res, pathname, parsed.search.length > 0, abortSignal)) return;
|
|
1203
|
-
if (await this.handleReviewDeckRequest(req, res, pathname, abortSignal)) return;
|
|
1204
|
-
if (req.method === "GET" && pathname === "/engram/v1/live") return this.respondJson(res, 200, { ok: true, ready: true });
|
|
1205
|
-
if (req.method === "GET" && pathname === "/engram/v1/health") {
|
|
1206
|
-
const { degraded, warmupAttempts, lastError } = this.readiness();
|
|
1207
|
-
const health = await this.service.health();
|
|
1208
|
-
this.respondJson(res, 200, degraded !== true ? health : {
|
|
1209
|
-
...health,
|
|
1210
|
-
degraded: true,
|
|
1211
|
-
warmupAttempts,
|
|
1212
|
-
lastError: lastError ?? null
|
|
1213
|
-
});
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
if (req.method === "GET" && pathname === "/engram/v1/capabilities") return respondAccessCapabilitiesHttp(res);
|
|
1217
|
-
if (req.method === "GET" && pathname === "/engram/v1/authorization") {
|
|
1218
|
-
res.setHeader("cache-control", "no-store");
|
|
1219
|
-
const probe = probeOperationAuthorization(tokenCapabilityStore.getStore(), parsed.searchParams.getAll("op"));
|
|
1220
|
-
for (const namespace of authorizationProbeNamespaces(probe.operations, parsed.searchParams.get("namespace") ?? void 0))
|
|
1221
|
-
this.resolveNamespace(req, namespace);
|
|
1222
|
-
if (authorizationProbeRequiresPrincipalNamespace(probe.operations))
|
|
1223
|
-
await this.enforceSupportPassportAuthorizationProbe(req);
|
|
1224
|
-
this.respondJson(res, 200, probe);
|
|
1225
|
-
return;
|
|
1226
|
-
}
|
|
1227
|
-
if (req.method === "GET" && pathname === "/engram/v1/adapters") {
|
|
1228
|
-
this.enforceTokenOp("adapters_status");
|
|
1229
|
-
const identity = this.resolveAdapterIdentity(req);
|
|
1230
|
-
this.respondJson(res, 200, {
|
|
1231
|
-
adaptersEnabled: this.adapterRegistry !== null,
|
|
1232
|
-
registered: this.adapterRegistry?.list() ?? [],
|
|
1233
|
-
resolved: identity
|
|
1234
|
-
});
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
if (req.method === "GET" && (pathname === "/engram/v1/admin/dashboard" || pathname === "/remnic/v1/admin/dashboard")) {
|
|
1238
|
-
this.requireOperatorToken();
|
|
1239
|
-
if (!this.adminControls) {
|
|
1240
|
-
this.respondJson(res, 404, { error: "admin_controls_unavailable", code: "admin_controls_unavailable" });
|
|
1241
|
-
return;
|
|
1242
|
-
}
|
|
1243
|
-
this.respondJson(res, 200, await this.adminControls.status());
|
|
1244
|
-
return;
|
|
1245
|
-
}
|
|
1246
|
-
if (req.method === "PATCH" && (pathname === "/engram/v1/admin/config" || pathname === "/remnic/v1/admin/config")) {
|
|
1247
|
-
this.requireOperatorToken();
|
|
1248
|
-
if (!this.adminControls?.update) {
|
|
1249
|
-
this.respondJson(res, 404, { error: "admin_controls_unavailable", code: "admin_controls_unavailable" });
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
try {
|
|
1253
|
-
this.respondJson(res, 200, await this.adminControls.update(await this.readJsonBody(req)));
|
|
1254
|
-
} catch (error) {
|
|
1255
|
-
throw new HttpError(
|
|
1256
|
-
400,
|
|
1257
|
-
error instanceof Error ? error.message : "invalid_admin_config_patch",
|
|
1258
|
-
"invalid_admin_config_patch"
|
|
1259
|
-
);
|
|
1260
|
-
}
|
|
1261
|
-
return;
|
|
1262
|
-
}
|
|
1263
|
-
if (req.method === "POST" && (pathname === "/engram/v1/external-wikis/search" || pathname === "/remnic/v1/external-wikis/search")) {
|
|
1264
|
-
this.enforceTokenOp("external_wiki_search");
|
|
1265
|
-
const operation = getOperation("external_wiki_search");
|
|
1266
|
-
if (!operation) throw new EngramAccessInputError("external_wiki_search operation is not registered");
|
|
1267
|
-
const output = await operation.run(await this.readJsonBody(req), { service: this.service });
|
|
1268
|
-
if (!output || typeof output !== "object" || !("result" in output)) {
|
|
1269
|
-
throw new Error("external_wiki_search returned an invalid operation result");
|
|
1270
|
-
}
|
|
1271
|
-
this.respondJson(res, 200, output.result);
|
|
1272
|
-
return;
|
|
1273
|
-
}
|
|
1274
|
-
if (req.method === "POST" && (pathname === "/engram/v1/memories/search" || pathname === "/remnic/v1/memories/search")) {
|
|
1275
|
-
this.enforceTokenOp("memory_search");
|
|
1276
|
-
const operation = getOperation("memory_search");
|
|
1277
|
-
if (!operation) throw new EngramAccessInputError("access-boundary: operation not registered: memory_search");
|
|
1278
|
-
const body = this.gatedBodyNamespace(req, await this.readJsonBody(req));
|
|
1279
|
-
if (body.namespace === void 0 && tokenCapabilityStore.getStore()?.namespaces !== void 0) {
|
|
1280
|
-
body.namespace = this.service.configRef?.defaultNamespace ?? "";
|
|
1281
|
-
}
|
|
1282
|
-
const output = await operation.run(body, {
|
|
1283
|
-
service: this.service,
|
|
1284
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
1285
|
-
});
|
|
1286
|
-
this.respondJson(res, 200, output.result);
|
|
1287
|
-
return;
|
|
1288
|
-
}
|
|
1289
|
-
if (req.method === "POST" && pathname === "/engram/v1/recall") {
|
|
1290
|
-
this.enforceTokenOp("recall");
|
|
1291
|
-
const body = await this.readValidatedBody(req, "recall");
|
|
1292
|
-
const disclosure = this.resolveRecallDisclosure(body.disclosure, parsed);
|
|
1293
|
-
const asOfQueryRaw = parsed.searchParams.get("as_of");
|
|
1294
|
-
const bodyHasAsOf = typeof body.asOf === "string" && body.asOf.length > 0;
|
|
1295
|
-
if (!bodyHasAsOf && asOfQueryRaw !== null && asOfQueryRaw.length === 0) {
|
|
1296
|
-
throw new EngramAccessInputError(
|
|
1297
|
-
"as_of must be a non-empty timestamp (got empty value)"
|
|
1298
|
-
);
|
|
1299
|
-
}
|
|
1300
|
-
const asOf = body.asOf ?? (asOfQueryRaw !== null && asOfQueryRaw.length > 0 ? asOfQueryRaw : void 0);
|
|
1301
|
-
const bodyHasTagsField = body !== null && typeof body === "object" && "tags" in body;
|
|
1302
|
-
const bodyTagsValue = bodyHasTagsField ? body.tags : void 0;
|
|
1303
|
-
const bodyTags = Array.isArray(bodyTagsValue) ? bodyTagsValue : void 0;
|
|
1304
|
-
const queryTags = parsed.searchParams.getAll("tag");
|
|
1305
|
-
const tags = bodyHasTagsField ? bodyTags : queryTags.length > 0 ? queryTags : void 0;
|
|
1306
|
-
const bodyTagMatch = body.tagMatch;
|
|
1307
|
-
let tagMatch;
|
|
1308
|
-
if (bodyTagMatch !== void 0) {
|
|
1309
|
-
if (bodyTagMatch === "any" || bodyTagMatch === "all") {
|
|
1310
|
-
tagMatch = bodyTagMatch;
|
|
1311
|
-
}
|
|
1312
|
-
} else {
|
|
1313
|
-
const queryTagMatch = parsed.searchParams.get("tag_match");
|
|
1314
|
-
if (queryTagMatch !== null) {
|
|
1315
|
-
if (queryTagMatch !== "any" && queryTagMatch !== "all") {
|
|
1316
|
-
throw new EngramAccessInputError(
|
|
1317
|
-
`tag_match must be one of: any, all (got: ${queryTagMatch})`
|
|
1318
|
-
);
|
|
1319
|
-
}
|
|
1320
|
-
tagMatch = queryTagMatch;
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
const bodyIncludeLowConfidence = body.includeLowConfidence;
|
|
1324
|
-
const queryIncludeLowConfidence = parsed.searchParams.get("include_low_confidence");
|
|
1325
|
-
if (bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence !== null && queryIncludeLowConfidence !== "true" && queryIncludeLowConfidence !== "false") {
|
|
1326
|
-
throw new EngramAccessInputError(
|
|
1327
|
-
`include_low_confidence must be one of: true, false (got: ${queryIncludeLowConfidence})`
|
|
1328
|
-
);
|
|
1329
|
-
}
|
|
1330
|
-
const includeLowConfidence = bodyIncludeLowConfidence === true || bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence === "true";
|
|
1331
|
-
const op = getOperation("recall");
|
|
1332
|
-
if (!op) {
|
|
1333
|
-
throw new EngramAccessInputError("access-boundary: operation not registered: recall");
|
|
1334
|
-
}
|
|
1335
|
-
const output = await op.run(
|
|
1336
|
-
{
|
|
1337
|
-
...body,
|
|
1338
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1339
|
-
...disclosure !== void 0 ? { disclosure } : {},
|
|
1340
|
-
...asOf !== void 0 ? { asOf } : {},
|
|
1341
|
-
...tags !== void 0 ? { tags } : {},
|
|
1342
|
-
...tagMatch !== void 0 ? { tagMatch } : {},
|
|
1343
|
-
...includeLowConfidence ? { includeLowConfidence: true } : {}
|
|
1344
|
-
},
|
|
1345
|
-
{
|
|
1346
|
-
service: this.service,
|
|
1347
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
1348
|
-
sourceConnector: this.resolveConnector(req),
|
|
1349
|
-
...abortSignal ? { abortSignal } : {}
|
|
1350
|
-
}
|
|
1351
|
-
);
|
|
1352
|
-
this.respondJson(res, 200, output.result);
|
|
1353
|
-
return;
|
|
1354
|
-
}
|
|
1355
|
-
if (req.method === "POST" && pathname === "/engram/v1/coding-context") {
|
|
1356
|
-
this.enforceTokenOp("set_coding_context");
|
|
1357
|
-
const body = await this.readValidatedBody(req, "setCodingContext");
|
|
1358
|
-
const codingContext = body.codingContext !== void 0 ? body.codingContext : typeof body.projectTag === "string" ? codingContextFromProjectTag(body.projectTag) : (() => {
|
|
1359
|
-
throw new EngramAccessInputError("codingContext or projectTag is required");
|
|
1360
|
-
})();
|
|
1361
|
-
this.service.setCodingContext({
|
|
1362
|
-
sessionKey: body.sessionKey,
|
|
1363
|
-
codingContext
|
|
1364
|
-
});
|
|
1365
|
-
this.respondJson(res, 200, { ok: true });
|
|
1366
|
-
return;
|
|
1367
|
-
}
|
|
1368
|
-
if (req.method === "POST" && (pathname === "/engram/v1/capsules/export" || pathname === "/remnic/v1/capsules/export")) {
|
|
1369
|
-
this.enforceTokenOp("capsule_export");
|
|
1370
|
-
const body = await this.readValidatedBody(req, "capsuleExport");
|
|
1371
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
1372
|
-
const result = await this.service.capsuleExport({
|
|
1373
|
-
name: body.name,
|
|
1374
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1375
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1376
|
-
since: body.since,
|
|
1377
|
-
includeKinds: body.includeKinds,
|
|
1378
|
-
peerIds: body.peerIds,
|
|
1379
|
-
includeTranscripts: body.includeTranscripts,
|
|
1380
|
-
encrypt: body.encrypt
|
|
1381
|
-
});
|
|
1382
|
-
this.recordWriteRateLimitHit(req);
|
|
1383
|
-
this.respondJson(res, 200, result);
|
|
1384
|
-
return;
|
|
1385
|
-
}
|
|
1386
|
-
if (req.method === "POST" && (pathname === "/engram/v1/capsules/import" || pathname === "/remnic/v1/capsules/import")) {
|
|
1387
|
-
this.enforceTokenOp("capsule_import");
|
|
1388
|
-
const body = await this.readValidatedBody(req, "capsuleImport");
|
|
1389
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
1390
|
-
const result = await this.service.capsuleImport({
|
|
1391
|
-
archivePath: expandTildePath(body.archivePath),
|
|
1392
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1393
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1394
|
-
mode: body.mode,
|
|
1395
|
-
passphrase: body.passphrase
|
|
1396
|
-
});
|
|
1397
|
-
this.recordWriteRateLimitHit(req);
|
|
1398
|
-
this.respondJson(res, 200, result);
|
|
1399
|
-
return;
|
|
1400
|
-
}
|
|
1401
|
-
if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/capabilities" || pathname === "/remnic/v1/offline-sync/capabilities")) {
|
|
1402
|
-
this.enforceTokenOp("offline_sync_snapshot");
|
|
1403
|
-
this.respondJson(res, 200, {
|
|
1404
|
-
version: 1,
|
|
1405
|
-
convergenceFinalization: true,
|
|
1406
|
-
manifestStream: true,
|
|
1407
|
-
manifestRevision: peerManifestRevision(this.service.configRef?.inlineSourceAttributionFormat)
|
|
1408
|
-
});
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/snapshot" || pathname === "/remnic/v1/offline-sync/snapshot")) {
|
|
1412
|
-
this.enforceTokenOp("offline_sync_snapshot");
|
|
1413
|
-
const includeTranscriptsRaw = parsed.searchParams.get("include_transcripts");
|
|
1414
|
-
const includeContentRaw = parsed.searchParams.get("content");
|
|
1415
|
-
if (includeTranscriptsRaw !== null && includeTranscriptsRaw !== "true" && includeTranscriptsRaw !== "false") {
|
|
1416
|
-
throw new EngramAccessInputError(
|
|
1417
|
-
`include_transcripts must be one of: true, false (got: ${includeTranscriptsRaw})`
|
|
1418
|
-
);
|
|
1419
|
-
}
|
|
1420
|
-
if (includeContentRaw !== null && includeContentRaw !== "true" && includeContentRaw !== "false") {
|
|
1421
|
-
throw new EngramAccessInputError(
|
|
1422
|
-
`content must be one of: true, false (got: ${includeContentRaw})`
|
|
1423
|
-
);
|
|
1424
|
-
}
|
|
1425
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1426
|
-
const result = await this.service.offlineSyncSnapshot({
|
|
1427
|
-
namespace: this.resolveNamespace(
|
|
1428
|
-
req,
|
|
1429
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
1430
|
-
),
|
|
1431
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1432
|
-
includeTranscripts: includeTranscriptsRaw !== "false",
|
|
1433
|
-
includeContent: includeContentRaw !== "false"
|
|
1434
|
-
});
|
|
1435
|
-
this.respondJson(res, 200, result);
|
|
1436
|
-
return;
|
|
1437
|
-
}
|
|
1438
|
-
if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/snapshot-stream" || pathname === "/remnic/v1/offline-sync/snapshot-stream")) {
|
|
1439
|
-
this.enforceTokenOp("offline_sync_snapshot_stream");
|
|
1440
|
-
const includeTranscriptsRaw = parsed.searchParams.get("include_transcripts");
|
|
1441
|
-
const includeContentRaw = parsed.searchParams.get("content");
|
|
1442
|
-
if (includeTranscriptsRaw !== null && includeTranscriptsRaw !== "true" && includeTranscriptsRaw !== "false") {
|
|
1443
|
-
throw new EngramAccessInputError(
|
|
1444
|
-
`include_transcripts must be one of: true, false (got: ${includeTranscriptsRaw})`
|
|
1445
|
-
);
|
|
1446
|
-
}
|
|
1447
|
-
if (includeContentRaw !== null && includeContentRaw !== "false") {
|
|
1448
|
-
throw new EngramAccessInputError("snapshot-stream content must be false");
|
|
1449
|
-
}
|
|
1450
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1451
|
-
const result = await this.service.offlineSyncSnapshotStream({
|
|
1452
|
-
namespace: this.resolveNamespace(
|
|
1453
|
-
req,
|
|
1454
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
1455
|
-
),
|
|
1456
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1457
|
-
includeTranscripts: includeTranscriptsRaw !== "false",
|
|
1458
|
-
includeContent: false,
|
|
1459
|
-
signal: this.createRequestAbortSignal(req, res)
|
|
1460
|
-
});
|
|
1461
|
-
await respondOfflineSnapshotStream(res, result, correlationIdStore.getStore());
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
1464
|
-
if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/manifest-stream" || pathname === "/remnic/v1/offline-sync/manifest-stream")) {
|
|
1465
|
-
this.enforceTokenOp("offline_sync_snapshot_stream");
|
|
1466
|
-
const includeTranscriptsRaw = parsed.searchParams.get("include_transcripts");
|
|
1467
|
-
const includeContentRaw = parsed.searchParams.get("content");
|
|
1468
|
-
if (includeTranscriptsRaw !== null && includeTranscriptsRaw !== "true" && includeTranscriptsRaw !== "false") {
|
|
1469
|
-
throw new EngramAccessInputError(
|
|
1470
|
-
`include_transcripts must be one of: true, false (got: ${includeTranscriptsRaw})`
|
|
1471
|
-
);
|
|
1472
|
-
}
|
|
1473
|
-
if (includeContentRaw !== null && includeContentRaw !== "false") {
|
|
1474
|
-
throw new EngramAccessInputError("manifest-stream content must be false");
|
|
1475
|
-
}
|
|
1476
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1477
|
-
const result = await this.service.offlineSyncManifestStream({
|
|
1478
|
-
namespace: this.resolveNamespace(
|
|
1479
|
-
req,
|
|
1480
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
1481
|
-
),
|
|
1482
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1483
|
-
includeTranscripts: includeTranscriptsRaw !== "false",
|
|
1484
|
-
signal: this.createRequestAbortSignal(req, res)
|
|
1485
|
-
});
|
|
1486
|
-
await respondOfflineManifestStream(res, result, correlationIdStore.getStore());
|
|
1487
|
-
return;
|
|
1488
|
-
}
|
|
1489
|
-
if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/snapshot" || pathname === "/remnic/v1/offline-sync/snapshot")) {
|
|
1490
|
-
this.enforceTokenOp("offline_sync_snapshot");
|
|
1491
|
-
const body = await this.readValidatedBody(
|
|
1492
|
-
req,
|
|
1493
|
-
"offlineSyncSnapshot",
|
|
1494
|
-
OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES
|
|
1495
|
-
);
|
|
1496
|
-
const result = await this.service.offlineSyncSnapshot({
|
|
1497
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1498
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1499
|
-
includeTranscripts: body.includeTranscripts,
|
|
1500
|
-
includeContent: body.includeContent,
|
|
1501
|
-
baseFiles: body.baseFiles,
|
|
1502
|
-
...body.baseCapturedAt ? { baseCapturedAt: new Date(body.baseCapturedAt) } : {},
|
|
1503
|
-
signal: this.createRequestAbortSignal(req, res)
|
|
1504
|
-
});
|
|
1505
|
-
this.respondJson(res, 200, result);
|
|
1506
|
-
return;
|
|
1507
|
-
}
|
|
1508
|
-
if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/files" || pathname === "/remnic/v1/offline-sync/files")) {
|
|
1509
|
-
this.enforceTokenOp("offline_sync_files");
|
|
1510
|
-
const body = await this.readValidatedBody(req, "offlineSyncFiles");
|
|
1511
|
-
const result = await this.service.offlineSyncFiles({
|
|
1512
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1513
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1514
|
-
includeTranscripts: body.includeTranscripts,
|
|
1515
|
-
paths: body.paths
|
|
1516
|
-
});
|
|
1517
|
-
this.respondJson(res, 200, result);
|
|
1518
|
-
return;
|
|
1519
|
-
}
|
|
1520
|
-
if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/file-content" || pathname === "/remnic/v1/offline-sync/file-content")) {
|
|
1521
|
-
this.enforceTokenOp("offline_sync_file_content");
|
|
1522
|
-
const body = await this.readValidatedBody(req, "offlineSyncFileContent");
|
|
1523
|
-
const result = await this.service.offlineSyncFileContent({
|
|
1524
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1525
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1526
|
-
includeTranscripts: body.includeTranscripts,
|
|
1527
|
-
path: body.path,
|
|
1528
|
-
offset: body.offset,
|
|
1529
|
-
length: body.length
|
|
1530
|
-
});
|
|
1531
|
-
this.respondBinary(res, 200, result.content, {
|
|
1532
|
-
"x-remnic-namespace": encodeURIComponent(result.namespace),
|
|
1533
|
-
"x-remnic-file-path": encodeURIComponent(result.path),
|
|
1534
|
-
"x-remnic-file-bytes": String(result.bytes),
|
|
1535
|
-
"x-remnic-file-mtime-ms": String(result.mtimeMs),
|
|
1536
|
-
"x-remnic-chunk-offset": String(result.offset),
|
|
1537
|
-
"x-remnic-chunk-bytes": String(result.chunkBytes),
|
|
1538
|
-
...result.sha256 ? { "x-remnic-file-sha256": result.sha256 } : {}
|
|
1539
|
-
});
|
|
1540
|
-
return;
|
|
1541
|
-
}
|
|
1542
|
-
if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/apply-file-content" || pathname === "/remnic/v1/offline-sync/apply-file-content")) {
|
|
1543
|
-
this.enforceTokenOp("offline_sync_apply_file_content");
|
|
1544
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1545
|
-
const bytes = this.readRequiredIntegerHeader(req, "x-remnic-file-bytes");
|
|
1546
|
-
const offset = this.readOptionalIntegerHeader(req, "x-remnic-chunk-offset") ?? 0;
|
|
1547
|
-
const content = await this.readBinaryBody(req, OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES);
|
|
1548
|
-
const result = await this.service.offlineSyncApplyFileContent({
|
|
1549
|
-
namespace: this.resolveNamespace(
|
|
1550
|
-
req,
|
|
1551
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
1552
|
-
),
|
|
1553
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1554
|
-
includeTranscripts: this.parseOptionalBooleanHeader(
|
|
1555
|
-
req,
|
|
1556
|
-
"x-remnic-include-transcripts",
|
|
1557
|
-
true
|
|
1558
|
-
),
|
|
1559
|
-
sourceId: this.readRequiredDecodedHeader(req, "x-remnic-source-id"),
|
|
1560
|
-
path: this.readRequiredDecodedHeader(req, "x-remnic-file-path"),
|
|
1561
|
-
sha256: this.readRequiredHeader(req, "x-remnic-file-sha256"),
|
|
1562
|
-
bytes,
|
|
1563
|
-
mtimeMs: this.readRequiredNumberHeader(req, "x-remnic-file-mtime-ms"),
|
|
1564
|
-
offset,
|
|
1565
|
-
baseSha256: this.readOptionalHeader(req, "x-remnic-base-sha256"),
|
|
1566
|
-
content
|
|
1567
|
-
});
|
|
1568
|
-
this.respondJson(res, 200, result);
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/convergence-complete" || pathname === "/remnic/v1/offline-sync/convergence-complete")) {
|
|
1572
|
-
void getOperation("offline_sync_apply_file_content");
|
|
1573
|
-
this.enforceTokenAnyOf(["offline_sync_apply_file_content", "offline_sync_apply"]);
|
|
1574
|
-
const namespaceParams = parsed.searchParams.getAll("namespace").filter(Boolean);
|
|
1575
|
-
const requestedNamespaces = namespaceParams.length > 0 ? namespaceParams : [void 0];
|
|
1576
|
-
const namespaces = requestedNamespaces.map((namespace) => this.resolveNamespace(req, namespace)).filter((namespace) => namespace !== void 0);
|
|
1577
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
1578
|
-
const result = await this.service.offlineSyncFinalizeConvergence({
|
|
1579
|
-
...namespaces.length > 0 ? { namespaces } : {},
|
|
1580
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1581
|
-
sourceId: this.readRequiredDecodedHeader(req, "x-remnic-source-id")
|
|
1582
|
-
});
|
|
1583
|
-
this.recordWriteRateLimitHit(req);
|
|
1584
|
-
this.respondJson(res, 200, result);
|
|
1585
|
-
return;
|
|
1586
|
-
}
|
|
1587
|
-
if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/apply" || pathname === "/remnic/v1/offline-sync/apply")) {
|
|
1588
|
-
this.enforceTokenOp("offline_sync_apply");
|
|
1589
|
-
const body = await this.readValidatedBody(req, "offlineSyncApply", OFFLINE_SYNC_APPLY_MAX_BODY_BYTES);
|
|
1590
|
-
const result = await this.service.offlineSyncApply({
|
|
1591
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1592
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1593
|
-
changeset: body.changeset,
|
|
1594
|
-
returnCurrentFiles: body.returnCurrentFiles
|
|
1595
|
-
});
|
|
1596
|
-
this.respondJson(res, 200, result);
|
|
1597
|
-
return;
|
|
1598
|
-
}
|
|
1599
|
-
if (req.method === "POST" && pathname === "/engram/v1/recall/explain") {
|
|
1600
|
-
this.enforceTokenOp("recall_explain");
|
|
1601
|
-
const body = await this.readValidatedBody(req, "recallExplain");
|
|
1602
|
-
const response = await this.service.recallExplain({
|
|
1603
|
-
sessionKey: body.sessionKey,
|
|
1604
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1605
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
1606
|
-
});
|
|
1607
|
-
this.respondJson(res, 200, response);
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
if (req.method === "POST" && (pathname === "/engram/v1/action-confidence" || pathname === "/remnic/v1/action-confidence")) {
|
|
1611
|
-
this.enforceTokenOp("action_confidence");
|
|
1612
|
-
const body = await this.readValidatedBody(req, "actionConfidence");
|
|
1613
|
-
this.respondJson(res, 200, await this.service.actionConfidence(body));
|
|
1614
|
-
return;
|
|
1615
|
-
}
|
|
1616
|
-
if (req.method === "GET" && pathname === "/engram/v1/recall/tier-explain") {
|
|
1617
|
-
this.enforceTokenOp("recall_tier_explain");
|
|
1618
|
-
const sessionParam = parsed.searchParams.get("session");
|
|
1619
|
-
const sessionKey = sessionParam && sessionParam.length > 0 ? sessionParam : void 0;
|
|
1620
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1621
|
-
const namespace = this.resolveNamespace(
|
|
1622
|
-
req,
|
|
1623
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
1624
|
-
);
|
|
1625
|
-
const payload = await this.service.recallTierExplain(sessionKey, namespace, this.resolveRequestPrincipal(req));
|
|
1626
|
-
this.respondJson(res, 200, payload);
|
|
1627
|
-
return;
|
|
1628
|
-
}
|
|
1629
|
-
if (req.method === "GET" && pathname === "/engram/v1/recall/xray") {
|
|
1630
|
-
this.enforceTokenOp("recall_xray");
|
|
1631
|
-
const queryParam = parsed.searchParams.get("q");
|
|
1632
|
-
if (!queryParam || queryParam.trim().length === 0) {
|
|
1633
|
-
this.respondJson(res, 400, {
|
|
1634
|
-
error: "missing_query",
|
|
1635
|
-
code: "missing_query",
|
|
1636
|
-
message: "q search parameter is required and must be non-empty"
|
|
1637
|
-
});
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
const sessionParam = parsed.searchParams.get("session");
|
|
1641
|
-
const sessionKey = sessionParam && sessionParam.length > 0 ? sessionParam : void 0;
|
|
1642
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
1643
|
-
const namespace = this.resolveNamespace(
|
|
1644
|
-
req,
|
|
1645
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
1646
|
-
);
|
|
1647
|
-
const budgetParam = parsed.searchParams.get("budget");
|
|
1648
|
-
let budget;
|
|
1649
|
-
if (budgetParam !== null && budgetParam !== "") {
|
|
1650
|
-
const parsedBudget = Number(budgetParam);
|
|
1651
|
-
if (!Number.isFinite(parsedBudget) || parsedBudget <= 0 || !Number.isInteger(parsedBudget)) {
|
|
1652
|
-
this.respondJson(res, 400, {
|
|
1653
|
-
error: "invalid_budget",
|
|
1654
|
-
code: "invalid_budget",
|
|
1655
|
-
message: "budget expects a positive integer"
|
|
1656
|
-
});
|
|
1657
|
-
return;
|
|
1658
|
-
}
|
|
1659
|
-
budget = parsedBudget;
|
|
1660
|
-
}
|
|
1661
|
-
const disclosureParam = parsed.searchParams.get("disclosure");
|
|
1662
|
-
let disclosure;
|
|
1663
|
-
if (disclosureParam !== null && disclosureParam.length > 0) {
|
|
1664
|
-
if (!isRecallDisclosure(disclosureParam)) {
|
|
1665
|
-
this.respondJson(res, 400, {
|
|
1666
|
-
error: "invalid_disclosure",
|
|
1667
|
-
code: "invalid_disclosure",
|
|
1668
|
-
message: "disclosure must be one of: chunk, section, raw"
|
|
1669
|
-
});
|
|
1670
|
-
return;
|
|
1671
|
-
}
|
|
1672
|
-
disclosure = disclosureParam;
|
|
1673
|
-
}
|
|
1674
|
-
let payload;
|
|
1675
|
-
try {
|
|
1676
|
-
payload = await this.service.recallXray({
|
|
1677
|
-
query: queryParam,
|
|
1678
|
-
sessionKey,
|
|
1679
|
-
namespace,
|
|
1680
|
-
budget,
|
|
1681
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
1682
|
-
sourceConnector: this.resolveConnector(req),
|
|
1683
|
-
...disclosure !== void 0 ? { disclosure } : {}
|
|
1684
|
-
});
|
|
1685
|
-
} catch (err) {
|
|
1686
|
-
if (err instanceof Error && err.message.startsWith("recallXray:")) {
|
|
1687
|
-
this.respondJson(res, 400, {
|
|
1688
|
-
error: "invalid_request",
|
|
1689
|
-
code: "invalid_request",
|
|
1690
|
-
message: err.message
|
|
1691
|
-
});
|
|
1692
|
-
return;
|
|
1693
|
-
}
|
|
1694
|
-
throw err;
|
|
1695
|
-
}
|
|
1696
|
-
this.respondJson(res, 200, payload);
|
|
1697
|
-
return;
|
|
1698
|
-
}
|
|
1699
|
-
if (req.method === "GET" && (pathname === "/engram/v1/who-knows" || pathname === "/remnic/v1/who-knows")) {
|
|
1700
|
-
this.enforceTokenOp("who_knows");
|
|
1701
|
-
const outcome = await handleWhoKnowsHttpQuery({
|
|
1702
|
-
getParam: (name) => parsed.searchParams.get(name),
|
|
1703
|
-
resolveNamespace: (namespace) => this.resolveNamespace(req, namespace),
|
|
1704
|
-
principal: this.resolveRequestPrincipal(req),
|
|
1705
|
-
run: (request) => this.service.whoKnows(request)
|
|
1706
|
-
});
|
|
1707
|
-
this.respondJson(res, outcome.status, outcome.body);
|
|
1708
|
-
return;
|
|
1709
|
-
}
|
|
1710
|
-
if (req.method === "GET" && pathname === "/engram/v1/namespace/writable") {
|
|
1711
|
-
if (!getOperation("namespace_writable")) throw new Error("namespace_writable operation is not registered");
|
|
1712
|
-
this.respondJson(
|
|
1713
|
-
res,
|
|
1714
|
-
200,
|
|
1715
|
-
await resolveQueryNamespaceWritablePreflight(
|
|
1716
|
-
tokenCapabilityStore.getStore(),
|
|
1717
|
-
parsed.searchParams,
|
|
1718
|
-
this.resolveRequestPrincipal(req),
|
|
1719
|
-
this.service.configRef.defaultNamespace,
|
|
1720
|
-
(request) => this.service.namespaceWritablePreflight(request)
|
|
1721
|
-
)
|
|
1722
|
-
);
|
|
1723
|
-
return;
|
|
1724
|
-
}
|
|
1725
|
-
if (req.method === "GET" && (pathname === "/engram/v1/wearables/status" || pathname === "/remnic/v1/wearables/status")) {
|
|
1726
|
-
this.enforceTokenOp("wearables_status");
|
|
1727
|
-
this.respondJson(res, 200, await this.service.wearablesStatus(this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0)));
|
|
1728
|
-
return;
|
|
1729
|
-
}
|
|
1730
|
-
if (req.method === "POST" && (pathname === "/engram/v1/wearables/sync" || pathname === "/remnic/v1/wearables/sync")) {
|
|
1731
|
-
this.enforceTokenOp("wearables_sync");
|
|
1732
|
-
const body = await this.readJsonBody(req);
|
|
1733
|
-
const source = optionalQueryString(body.source, "source");
|
|
1734
|
-
const date = optionalQueryString(body.date, "date");
|
|
1735
|
-
let days;
|
|
1736
|
-
if (body.days !== void 0 && body.days !== null) {
|
|
1737
|
-
if (typeof body.days !== "number" || !Number.isInteger(body.days) || body.days < 1) {
|
|
1738
|
-
throw new EngramAccessInputError(
|
|
1739
|
-
`days must be a positive integer (got ${JSON.stringify(body.days)})`
|
|
1740
|
-
);
|
|
1741
|
-
}
|
|
1742
|
-
days = body.days;
|
|
1743
|
-
}
|
|
1744
|
-
if (body.forceMemories !== void 0 && typeof body.forceMemories !== "boolean") {
|
|
1745
|
-
throw new EngramAccessInputError(
|
|
1746
|
-
`forceMemories must be a boolean (got ${JSON.stringify(body.forceMemories)})`
|
|
1747
|
-
);
|
|
1748
|
-
}
|
|
1749
|
-
try {
|
|
1750
|
-
const summaries = await this.service.wearablesSync({ source, date, days, forceMemories: body.forceMemories === true, ...this.wearablesScope(req, optionalQueryString(body.namespace, "namespace"), optionalQueryString(body.sessionKey, "sessionKey")) });
|
|
1751
|
-
this.respondJson(res, 200, { summaries });
|
|
1752
|
-
} catch (err) {
|
|
1753
|
-
if (this.respondWearablesError(res, err)) return;
|
|
1754
|
-
throw err;
|
|
1755
|
-
}
|
|
1756
|
-
return;
|
|
1757
|
-
}
|
|
1758
|
-
if (req.method === "GET" && (pathname === "/engram/v1/wearables/transcript" || pathname === "/remnic/v1/wearables/transcript")) {
|
|
1759
|
-
this.enforceTokenOp("transcript_day");
|
|
1760
|
-
const date = parsed.searchParams.get("date");
|
|
1761
|
-
if (!date || date.trim().length === 0) {
|
|
1762
|
-
throw new EngramAccessInputError(
|
|
1763
|
-
"date query parameter is required (YYYY-MM-DD)"
|
|
1764
|
-
);
|
|
1765
|
-
}
|
|
1766
|
-
const sourceParam = parsed.searchParams.get("source");
|
|
1767
|
-
try {
|
|
1768
|
-
const transcripts = await this.service.wearablesTranscriptDay({ date, source: sourceParam && sourceParam.length > 0 ? sourceParam : void 0, ...this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0) });
|
|
1769
|
-
this.respondJson(res, 200, { transcripts });
|
|
1770
|
-
} catch (err) {
|
|
1771
|
-
if (this.respondWearablesError(res, err)) return;
|
|
1772
|
-
throw err;
|
|
1773
|
-
}
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
if (req.method === "GET" && (pathname === "/engram/v1/wearables/transcripts/search" || pathname === "/remnic/v1/wearables/transcripts/search")) {
|
|
1777
|
-
this.enforceTokenOp("transcript_search");
|
|
1778
|
-
const queryParam = parsed.searchParams.get("q");
|
|
1779
|
-
if (!queryParam || queryParam.trim().length === 0) {
|
|
1780
|
-
throw new EngramAccessInputError(
|
|
1781
|
-
"q query parameter is required and must be non-empty"
|
|
1782
|
-
);
|
|
1783
|
-
}
|
|
1784
|
-
try {
|
|
1785
|
-
const results = await this.service.wearablesTranscriptSearch({ query: queryParam, source: nonEmptyQueryParam(parsed.searchParams.get("source")), from: nonEmptyQueryParam(parsed.searchParams.get("from")), to: nonEmptyQueryParam(parsed.searchParams.get("to")), limit: positiveIntQueryParam(parsed.searchParams.get("limit"), "limit"), ...this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0) });
|
|
1786
|
-
this.respondJson(res, 200, { results });
|
|
1787
|
-
} catch (err) {
|
|
1788
|
-
if (this.respondWearablesError(res, err)) return;
|
|
1789
|
-
throw err;
|
|
1790
|
-
}
|
|
1791
|
-
return;
|
|
1792
|
-
}
|
|
1793
|
-
if (req.method === "GET" && (pathname === "/engram/v1/wearables/memories" || pathname === "/remnic/v1/wearables/memories")) {
|
|
1794
|
-
this.enforceTokenOp("transcript_memories");
|
|
1795
|
-
try {
|
|
1796
|
-
const memories = await this.service.wearablesTranscriptMemories({ source: nonEmptyQueryParam(parsed.searchParams.get("source")), date: nonEmptyQueryParam(parsed.searchParams.get("date")), limit: positiveIntQueryParam(parsed.searchParams.get("limit"), "limit"), ...this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0) });
|
|
1797
|
-
this.respondJson(res, 200, { memories });
|
|
1798
|
-
} catch (err) {
|
|
1799
|
-
if (this.respondWearablesError(res, err)) return;
|
|
1800
|
-
throw err;
|
|
1801
|
-
}
|
|
1802
|
-
return;
|
|
1803
|
-
}
|
|
1804
|
-
if (req.method === "GET" && (pathname === "/engram/v1/meetings" || pathname === "/remnic/v1/meetings")) {
|
|
1805
|
-
this.enforceTokenOp("meetings_list");
|
|
1806
|
-
await respondMeetingsList(res, this.respondJson.bind(this), this.service, nonEmptyQueryParam(parsed.searchParams.get("date")), this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0));
|
|
1807
|
-
return;
|
|
1808
|
-
}
|
|
1809
|
-
if (req.method === "POST" && (pathname === "/engram/v1/meetings/build" || pathname === "/remnic/v1/meetings/build")) {
|
|
1810
|
-
this.enforceTokenOp("meetings_build");
|
|
1811
|
-
await respondMeetingsBuild(req, res, this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, { enforceQuota: () => this.ensureWriteRateLimitAvailable(req), recordHit: () => this.recordWriteRateLimitHit(req) }, (ns, sk) => this.wearablesScope(req, ns, sk));
|
|
1812
|
-
return;
|
|
1813
|
-
}
|
|
1814
|
-
const meetingGetEngram = /^\/engram\/v1\/meetings\/([^/]+)$/.exec(pathname);
|
|
1815
|
-
if (req.method === "GET" && meetingGetEngram) {
|
|
1816
|
-
this.enforceTokenOp("meetings_get");
|
|
1817
|
-
await respondMeetingsGet(res, this.respondJson.bind(this), this.service, meetingGetEngram[1] ?? "", this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0));
|
|
1818
|
-
return;
|
|
1819
|
-
}
|
|
1820
|
-
const meetingGetRemnic = /^\/remnic\/v1\/meetings\/([^/]+)$/.exec(pathname);
|
|
1821
|
-
if (req.method === "GET" && meetingGetRemnic) {
|
|
1822
|
-
this.enforceTokenOp("meetings_get");
|
|
1823
|
-
await respondMeetingsGet(res, this.respondJson.bind(this), this.service, meetingGetRemnic[1] ?? "", this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0));
|
|
1824
|
-
return;
|
|
1825
|
-
}
|
|
1826
|
-
if (req.method === "POST" && (pathname === "/engram/v1/recall/deep" || pathname === "/remnic/v1/recall/deep")) {
|
|
1827
|
-
this.enforceTokenOp("deep_recall");
|
|
1828
|
-
await respondDeepRecall(req, res, this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, (ns, sk) => this.wearablesScope(req, ns ?? parsed.searchParams.get("namespace") ?? void 0, sk ?? parsed.searchParams.get("sessionKey") ?? void 0), abortSignal);
|
|
1829
|
-
return;
|
|
1830
|
-
}
|
|
1831
|
-
if (await maybeRespondRecallNavigation(req, res, pathname, req.method, (op) => this.enforceTokenOp(op), this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, (ns, sk) => this.wearablesScope(req, ns ?? parsed.searchParams.get("namespace") ?? void 0, sk ?? parsed.searchParams.get("sessionKey") ?? void 0))) return;
|
|
1832
|
-
if (await maybeRespondMemoryBrowse(req, res, pathname, req.method, (op) => this.enforceTokenOp(op), this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, (ns) => this.wearablesScope(req, ns ?? parsed.searchParams.get("namespace") ?? void 0))) return;
|
|
1833
|
-
if (req.method === "GET" && (pathname === "/engram/v1/location/status" || pathname === "/remnic/v1/location/status")) {
|
|
1834
|
-
this.enforceTokenOp("location_status");
|
|
1835
|
-
await respondLocationStatus(res, this.respondJson.bind(this), this.service);
|
|
1836
|
-
return;
|
|
1837
|
-
}
|
|
1838
|
-
if (req.method === "GET" && (pathname === "/engram/v1/location/check" || pathname === "/remnic/v1/location/check")) {
|
|
1839
|
-
this.enforceTokenOp("location_check");
|
|
1840
|
-
await respondLocationCheck(res, this.respondJson.bind(this), this.service);
|
|
1841
|
-
return;
|
|
1842
|
-
}
|
|
1843
|
-
if (req.method === "POST" && (pathname === "/engram/v1/location/sync" || pathname === "/remnic/v1/location/sync")) {
|
|
1844
|
-
this.enforceTokenOp("location_sync");
|
|
1845
|
-
await respondLocationSync(await this.readJsonBody(req), res, this.respondJson.bind(this), this.service);
|
|
1846
|
-
return;
|
|
1847
|
-
}
|
|
1848
|
-
if (req.method === "POST" && (pathname === "/engram/v1/location/backfill" || pathname === "/remnic/v1/location/backfill")) {
|
|
1849
|
-
this.enforceTokenOp("location_backfill");
|
|
1850
|
-
await respondLocationBackfill(await this.readJsonBody(req), res, this.respondJson.bind(this), this.service);
|
|
1851
|
-
return;
|
|
1852
|
-
}
|
|
1853
|
-
if (req.method === "GET" && (pathname === "/engram/v1/location/day" || pathname === "/remnic/v1/location/day")) {
|
|
1854
|
-
this.enforceTokenOp("location_day");
|
|
1855
|
-
await respondLocationDay(parsed.searchParams.get("date"), res, this.respondJson.bind(this), this.service);
|
|
1856
|
-
return;
|
|
1857
|
-
}
|
|
1858
|
-
if (req.method === "GET" && (pathname === "/engram/v1/standup" || pathname === "/remnic/v1/standup")) {
|
|
1859
|
-
this.enforceTokenOp("standup");
|
|
1860
|
-
await respondStandup(parsed.searchParams.get("date"), res, this.respondJson.bind(this), this.service);
|
|
1861
|
-
return;
|
|
1862
|
-
}
|
|
1863
|
-
if (req.method === "POST" && pathname === "/engram/v1/observe") {
|
|
1864
|
-
this.enforceTokenOp("observe");
|
|
1865
|
-
const body = await this.readValidatedBody(req, "observe");
|
|
1866
|
-
const op = getOperation("observe");
|
|
1867
|
-
if (!op) {
|
|
1868
|
-
throw new EngramAccessInputError("access-boundary: operation not registered: observe");
|
|
1869
|
-
}
|
|
1870
|
-
const output = await op.run(
|
|
1871
|
-
{ ...body, namespace: this.resolveNamespace(req, body.namespace) },
|
|
1872
|
-
{
|
|
1873
|
-
service: this.service,
|
|
1874
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
1875
|
-
hooks: { enforceWriteQuota: () => this.ensureWriteRateLimitAvailable(req) },
|
|
1876
|
-
// Phase 1 provenance: server-resolved connector identity from the
|
|
1877
|
-
// bearer token (REST path, mirroring the MCP tools/call dispatch).
|
|
1878
|
-
sourceConnector: this.resolveConnector(req)
|
|
1879
|
-
}
|
|
1880
|
-
);
|
|
1881
|
-
if (this.shouldCountWriteRateLimit(output.result)) {
|
|
1882
|
-
this.recordWriteRateLimitHit(req);
|
|
1883
|
-
}
|
|
1884
|
-
this.respondJson(res, 202, output.result);
|
|
1885
|
-
return;
|
|
1886
|
-
}
|
|
1887
|
-
if (req.method === "POST" && pathname === "/engram/v1/lcm/search") {
|
|
1888
|
-
this.enforceTokenOp("lcm_search");
|
|
1889
|
-
const body = await this.readValidatedBody(req, "lcmSearch");
|
|
1890
|
-
const response = await this.service.lcmSearch({
|
|
1891
|
-
query: body.query,
|
|
1892
|
-
sessionKey: body.sessionKey,
|
|
1893
|
-
sessionPrefix: body.sessionPrefix,
|
|
1894
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
1895
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
1896
|
-
limit: body.limit
|
|
1897
|
-
});
|
|
1898
|
-
this.respondJson(res, 200, response);
|
|
1899
|
-
return;
|
|
1900
|
-
}
|
|
1901
|
-
if (await maybeHandleLifecycleFlush(
|
|
1902
|
-
this.lifecycleFlushDeps(req, res),
|
|
1903
|
-
req.method,
|
|
1904
|
-
pathname,
|
|
1905
|
-
abortSignal
|
|
1906
|
-
)) return;
|
|
1907
|
-
if (req.method === "GET" && pathname === "/engram/v1/lcm/status") {
|
|
1908
|
-
this.enforceTokenOp("lcm_status");
|
|
1909
|
-
this.respondJson(res, 200, await this.service.lcmStatus());
|
|
1910
|
-
return;
|
|
1911
|
-
}
|
|
1912
|
-
const relayEventMatch = /^\/engram\/v1\/relay\/missions\/([^/]+)\/events$/.exec(pathname);
|
|
1913
|
-
if (req.method === "POST" && relayEventMatch) {
|
|
1914
|
-
const missionId = decodeRelayMissionIdSegment(relayEventMatch[1] ?? "");
|
|
1915
|
-
const body = await this.readJsonBody(req);
|
|
1916
|
-
const unexpectedFields = Object.keys(body).filter(
|
|
1917
|
-
(key) => key !== "namespace" && key !== "event"
|
|
1918
|
-
);
|
|
1919
|
-
if (unexpectedFields.length > 0) {
|
|
1920
|
-
throw new EngramAccessInputError(
|
|
1921
|
-
`Relay append body contains unexpected field(s): ${unexpectedFields.sort().join(", ")}`
|
|
1922
|
-
);
|
|
1923
|
-
}
|
|
1924
|
-
if (!Object.prototype.hasOwnProperty.call(body, "event")) {
|
|
1925
|
-
throw new EngramAccessInputError("Relay append body must contain an event object");
|
|
1926
|
-
}
|
|
1927
|
-
if (Object.prototype.hasOwnProperty.call(body, "namespace") && body.namespace !== void 0 && body.namespace !== null && typeof body.namespace !== "string") {
|
|
1928
|
-
throw new EngramAccessInputError("namespace must be a string when provided");
|
|
1929
|
-
}
|
|
1930
|
-
rejectBlankRelayNamespace(
|
|
1931
|
-
typeof body.namespace === "string" ? body.namespace : void 0
|
|
1932
|
-
);
|
|
1933
|
-
const namespace = this.resolveNamespace(
|
|
1934
|
-
req,
|
|
1935
|
-
typeof body.namespace === "string" ? body.namespace : void 0
|
|
1936
|
-
);
|
|
1937
|
-
const op = getOperation("relay_mission_append");
|
|
1938
|
-
if (!op) {
|
|
1939
|
-
throw new Error("access-boundary: operation not registered: relay_mission_append");
|
|
1940
|
-
}
|
|
1941
|
-
let writeQuota;
|
|
1942
|
-
try {
|
|
1943
|
-
const output = await op.run(
|
|
1944
|
-
{ missionId, namespace, event: body.event },
|
|
1945
|
-
{
|
|
1946
|
-
service: this.service,
|
|
1947
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
1948
|
-
hooks: {
|
|
1949
|
-
enforceWriteQuota: () => {
|
|
1950
|
-
writeQuota ??= this.reserveWriteRateLimitSlot(req);
|
|
1951
|
-
}
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
);
|
|
1955
|
-
if (output.result.appended) {
|
|
1956
|
-
writeQuota?.commit();
|
|
1957
|
-
writeQuota = void 0;
|
|
1958
|
-
}
|
|
1959
|
-
this.respondJson(res, output.result.appended ? 201 : 200, output.result);
|
|
1960
|
-
} finally {
|
|
1961
|
-
writeQuota?.release();
|
|
1962
|
-
}
|
|
1963
|
-
return;
|
|
1964
|
-
}
|
|
1965
|
-
const relayMissionMatch = /^\/engram\/v1\/relay\/missions\/([^/]+)$/.exec(pathname);
|
|
1966
|
-
if (req.method === "GET" && relayMissionMatch) {
|
|
1967
|
-
const missionId = decodeRelayMissionIdSegment(relayMissionMatch[1] ?? "");
|
|
1968
|
-
rejectBlankRelayNamespace(parsed.searchParams.get("namespace"));
|
|
1969
|
-
const namespace = this.resolveNamespace(
|
|
1970
|
-
req,
|
|
1971
|
-
parsed.searchParams.get("namespace") ?? void 0
|
|
1972
|
-
);
|
|
1973
|
-
const op = getOperation("relay_mission_read");
|
|
1974
|
-
if (!op) {
|
|
1975
|
-
throw new Error("access-boundary: operation not registered: relay_mission_read");
|
|
1976
|
-
}
|
|
1977
|
-
const authenticatedPrincipal = this.resolveRequestPrincipal(req)?.trim() || void 0;
|
|
1978
|
-
const output = await op.run(
|
|
1979
|
-
{
|
|
1980
|
-
missionId,
|
|
1981
|
-
namespace,
|
|
1982
|
-
since: parsed.searchParams.get("since") ?? void 0,
|
|
1983
|
-
until: parsed.searchParams.get("until") ?? void 0,
|
|
1984
|
-
limit: parsed.searchParams.get("limit") ?? void 0
|
|
1985
|
-
},
|
|
1986
|
-
{
|
|
1987
|
-
service: this.service,
|
|
1988
|
-
authenticatedPrincipal
|
|
1989
|
-
}
|
|
1990
|
-
);
|
|
1991
|
-
res.setHeader("cache-control", "no-store");
|
|
1992
|
-
if (authenticatedPrincipal !== void 0) {
|
|
1993
|
-
try {
|
|
1994
|
-
res.setHeader("x-remnic-authenticated-principal", encodeURIComponent(authenticatedPrincipal));
|
|
1995
|
-
} catch {
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
this.respondJson(res, 200, output.result);
|
|
1999
|
-
return;
|
|
2000
|
-
}
|
|
2001
|
-
if (req.method === "POST" && pathname === "/engram/v1/memories") {
|
|
2002
|
-
const body = await this.readValidatedBody(req, "memoryStore");
|
|
2003
|
-
const envelope = {
|
|
2004
|
-
...body,
|
|
2005
|
-
namespace: this.resolveNamespace(req, body.namespace)
|
|
2006
|
-
};
|
|
2007
|
-
const op = getOperation("memory_store");
|
|
2008
|
-
if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: memory_store");
|
|
2009
|
-
const output = await op.run(envelope, {
|
|
2010
|
-
service: this.service,
|
|
2011
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
2012
|
-
hooks: { enforceWriteQuota: () => this.ensureWriteRateLimitAvailable(req) },
|
|
2013
|
-
// Phase 1 provenance: server-resolved connector identity from the
|
|
2014
|
-
// bearer token (REST path, mirroring the MCP tools/call dispatch).
|
|
2015
|
-
sourceConnector: this.resolveConnector(req)
|
|
2016
|
-
});
|
|
2017
|
-
const response = output.result;
|
|
2018
|
-
if (this.shouldCountWriteRateLimit(response)) {
|
|
2019
|
-
this.recordWriteRateLimitHit(req);
|
|
2020
|
-
}
|
|
2021
|
-
this.respondJson(res, this.writeResponseStatus(response), response);
|
|
2022
|
-
return;
|
|
2023
|
-
}
|
|
2024
|
-
if (req.method === "POST" && pathname === "/engram/v1/coding/decisions") {
|
|
2025
|
-
const body = await this.readJsonBody(req);
|
|
2026
|
-
const isWriteSubcommand = body.subcommand === "record" || body.subcommand === "supersede";
|
|
2027
|
-
if (isWriteSubcommand) {
|
|
2028
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2029
|
-
}
|
|
2030
|
-
const op = getOperation("coding_decision");
|
|
2031
|
-
if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: coding_decision");
|
|
2032
|
-
const output = await op.run(this.gatedBodyNamespace(req, body), {
|
|
2033
|
-
service: this.service,
|
|
2034
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
2035
|
-
sourceConnector: this.resolveConnector(req)
|
|
2036
|
-
});
|
|
2037
|
-
if (isWriteSubcommand) {
|
|
2038
|
-
this.recordWriteRateLimitHit(req);
|
|
2039
|
-
}
|
|
2040
|
-
this.respondJson(res, 200, output.result);
|
|
2041
|
-
return;
|
|
2042
|
-
}
|
|
2043
|
-
if (req.method === "POST" && pathname === "/engram/v1/coding/architecture") {
|
|
2044
|
-
const body = await this.readJsonBody(req);
|
|
2045
|
-
const isWriteSubcommand = body.subcommand === "refresh";
|
|
2046
|
-
if (isWriteSubcommand) {
|
|
2047
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2048
|
-
}
|
|
2049
|
-
const op = getOperation("coding_architecture");
|
|
2050
|
-
if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: coding_architecture");
|
|
2051
|
-
const output = await op.run(this.gatedBodyNamespace(req, body), {
|
|
2052
|
-
service: this.service,
|
|
2053
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
2054
|
-
sourceConnector: this.resolveConnector(req)
|
|
2055
|
-
});
|
|
2056
|
-
if (isWriteSubcommand) {
|
|
2057
|
-
this.recordWriteRateLimitHit(req);
|
|
2058
|
-
}
|
|
2059
|
-
this.respondJson(res, 200, output.result);
|
|
2060
|
-
return;
|
|
2061
|
-
}
|
|
2062
|
-
if (req.method === "POST" && pathname === "/engram/v1/coding/delta") {
|
|
2063
|
-
const body = await this.readJsonBody(req);
|
|
2064
|
-
const op = getOperation("coding_delta");
|
|
2065
|
-
if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: coding_delta");
|
|
2066
|
-
const output = await op.run(this.gatedBodyNamespace(req, body), {
|
|
2067
|
-
service: this.service,
|
|
2068
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
2069
|
-
});
|
|
2070
|
-
this.respondJson(res, 200, output.result);
|
|
2071
|
-
return;
|
|
2072
|
-
}
|
|
2073
|
-
if (req.method === "POST" && pathname === "/engram/v1/briefing") {
|
|
2074
|
-
await respondBriefingHttp({
|
|
2075
|
-
gatedBody: this.gatedBodyNamespace(req, await this.readJsonBody(req)),
|
|
2076
|
-
service: this.service,
|
|
2077
|
-
principal: this.resolveRequestPrincipal(req),
|
|
2078
|
-
respondJson: (status, payload) => this.respondJson(res, status, payload)
|
|
2079
|
-
});
|
|
2080
|
-
return;
|
|
2081
|
-
}
|
|
2082
|
-
if (req.method === "POST" && pathname === "/engram/v1/correction/plan") {
|
|
2083
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2084
|
-
const body = await this.readJsonBody(req);
|
|
2085
|
-
const op = getOperation("memory_correct_plan");
|
|
2086
|
-
if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: memory_correct_plan");
|
|
2087
|
-
const output = await op.run(this.gatedBodyNamespace(req, body), {
|
|
2088
|
-
service: this.service,
|
|
2089
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
2090
|
-
});
|
|
2091
|
-
this.recordWriteRateLimitHit(req);
|
|
2092
|
-
this.respondJson(res, 200, output.result);
|
|
2093
|
-
return;
|
|
2094
|
-
}
|
|
2095
|
-
if (req.method === "POST" && pathname === "/engram/v1/correction/apply") {
|
|
2096
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2097
|
-
const body = await this.readJsonBody(req);
|
|
2098
|
-
const op = getOperation("memory_correct_apply");
|
|
2099
|
-
if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: memory_correct_apply");
|
|
2100
|
-
const output = await op.run(this.gatedBodyNamespace(req, body), {
|
|
2101
|
-
service: this.service,
|
|
2102
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
2103
|
-
});
|
|
2104
|
-
this.recordWriteRateLimitHit(req);
|
|
2105
|
-
this.respondJson(res, 200, output.result);
|
|
2106
|
-
return;
|
|
2107
|
-
}
|
|
2108
|
-
if (req.method === "GET" && pathname === "/engram/v1/correction/pending") {
|
|
2109
|
-
const op = getOperation("correction_pending");
|
|
2110
|
-
if (op) {
|
|
2111
|
-
const output = await op.run(
|
|
2112
|
-
{ namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0), sessionKey: parsed.searchParams.get("sessionKey") ?? void 0 },
|
|
2113
|
-
{ service: this.service, authenticatedPrincipal: this.resolveRequestPrincipal(req) }
|
|
2114
|
-
);
|
|
2115
|
-
this.respondJson(res, 200, output.result);
|
|
2116
|
-
} else {
|
|
2117
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2118
|
-
const sessionKey = parsed.searchParams.get("sessionKey") ?? void 0;
|
|
2119
|
-
const plans = await this.service.correctionListPending({
|
|
2120
|
-
...namespace ? { namespace } : {},
|
|
2121
|
-
...sessionKey ? { sessionKey } : {},
|
|
2122
|
-
principal: this.resolveRequestPrincipal(req)
|
|
2123
|
-
});
|
|
2124
|
-
this.respondJson(res, 200, plans);
|
|
2125
|
-
}
|
|
2126
|
-
return;
|
|
2127
|
-
}
|
|
2128
|
-
if (req.method === "POST" && pathname === "/engram/v1/suggestions") {
|
|
2129
|
-
this.enforceTokenOp("suggestion_submit");
|
|
2130
|
-
const body = await this.readValidatedBody(req, "suggestionSubmit");
|
|
2131
|
-
const request = {
|
|
2132
|
-
schemaVersion: body.schemaVersion,
|
|
2133
|
-
idempotencyKey: body.idempotencyKey,
|
|
2134
|
-
dryRun: body.dryRun === true,
|
|
2135
|
-
sessionKey: body.sessionKey,
|
|
2136
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
2137
|
-
content: body.content,
|
|
2138
|
-
category: body.category,
|
|
2139
|
-
confidence: body.confidence,
|
|
2140
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
2141
|
-
tags: body.tags,
|
|
2142
|
-
entityRef: body.entityRef,
|
|
2143
|
-
ttl: body.ttl,
|
|
2144
|
-
sourceReason: body.sourceReason,
|
|
2145
|
-
cwd: body.cwd,
|
|
2146
|
-
projectTag: body.projectTag,
|
|
2147
|
-
// #2829: raw alias spelling retained by the schema transform.
|
|
2148
|
-
...body.rawCategory !== void 0 ? { rawCategory: body.rawCategory } : {},
|
|
2149
|
-
// Phase 1 provenance: server-resolved connector identity from the
|
|
2150
|
-
// bearer token (REST path, mirroring the MCP tools/call dispatch).
|
|
2151
|
-
sourceConnector: this.resolveConnector(req)
|
|
2152
|
-
};
|
|
2153
|
-
const response = await this.service.suggestionSubmit(request, {
|
|
2154
|
-
enforceWriteQuota: () => this.ensureWriteRateLimitAvailable(req)
|
|
2155
|
-
});
|
|
2156
|
-
if (this.shouldCountWriteRateLimit(response)) {
|
|
2157
|
-
this.recordWriteRateLimitHit(req);
|
|
2158
|
-
}
|
|
2159
|
-
this.respondJson(res, this.writeResponseStatus(response), response);
|
|
2160
|
-
return;
|
|
2161
|
-
}
|
|
2162
|
-
if (req.method === "GET" && pathname === "/engram/v1/memories") {
|
|
2163
|
-
this.enforceTokenOp("memory_list");
|
|
2164
|
-
const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 50, 1);
|
|
2165
|
-
const offset = parseStrictIntegerQuery(parsed.searchParams.get("offset"), "offset", 0, 0);
|
|
2166
|
-
const sort = parseMemorySort(parsed.searchParams.get("sort"));
|
|
2167
|
-
const response = await this.service.memoryBrowse({
|
|
2168
|
-
query: parsed.searchParams.get("q") ?? void 0,
|
|
2169
|
-
status: parsed.searchParams.get("status") ?? void 0,
|
|
2170
|
-
category: parsed.searchParams.get("category") ?? void 0,
|
|
2171
|
-
namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
|
|
2172
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
2173
|
-
sort,
|
|
2174
|
-
limit,
|
|
2175
|
-
offset
|
|
2176
|
-
});
|
|
2177
|
-
this.respondJson(res, 200, response);
|
|
2178
|
-
return;
|
|
2179
|
-
}
|
|
2180
|
-
if (req.method === "GET" && pathname === "/engram/v1/recall/timings") {
|
|
2181
|
-
const op = getOperation("recall_timings");
|
|
2182
|
-
if (!op) {
|
|
2183
|
-
throw new Error("access-boundary: operation not registered: recall_timings");
|
|
2184
|
-
}
|
|
2185
|
-
res.setHeader("cache-control", "no-store");
|
|
2186
|
-
const output = await op.run({}, {
|
|
2187
|
-
service: this.service,
|
|
2188
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
2189
|
-
operatorPrincipal: this.authenticatedPrincipal
|
|
2190
|
-
});
|
|
2191
|
-
this.respondJson(res, 200, output.result);
|
|
2192
|
-
return;
|
|
2193
|
-
}
|
|
2194
|
-
const memoryMatch = pathname.match(/^\/engram\/v1\/memories\/([^/]+)$/);
|
|
2195
|
-
if (req.method === "GET" && memoryMatch) {
|
|
2196
|
-
const memoryId = decodeURIComponent(memoryMatch[1] ?? "");
|
|
2197
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2198
|
-
const sessionKey = this.resolveRequestIdentity(req).sessionKey ?? parsed.searchParams.get("session") ?? parsed.searchParams.get("sessionKey") ?? void 0;
|
|
2199
|
-
const op = getOperation("memory_get");
|
|
2200
|
-
if (!op) {
|
|
2201
|
-
throw new EngramAccessInputError("access-boundary: operation not registered: memory_get");
|
|
2202
|
-
}
|
|
2203
|
-
const output = await op.run(
|
|
2204
|
-
{ memoryId, namespace: namespace ?? null, sessionKey: sessionKey ?? null },
|
|
2205
|
-
{ service: this.service, authenticatedPrincipal: this.resolveRequestPrincipal(req) }
|
|
2206
|
-
);
|
|
2207
|
-
const response = output.result;
|
|
2208
|
-
this.respondJson(res, response.found ? 200 : 404, response);
|
|
2209
|
-
return;
|
|
2210
|
-
}
|
|
2211
|
-
const timelineMatch = pathname.match(/^\/engram\/v1\/memories\/([^/]+)\/timeline$/);
|
|
2212
|
-
if (req.method === "GET" && timelineMatch) {
|
|
2213
|
-
this.enforceTokenOp("memory_timeline");
|
|
2214
|
-
const memoryId = decodeURIComponent(timelineMatch[1] ?? "");
|
|
2215
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2216
|
-
const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 200, 1);
|
|
2217
|
-
const response = await this.service.memoryTimeline(memoryId, namespace, limit, this.resolveRequestPrincipal(req));
|
|
2218
|
-
this.respondJson(res, response.found ? 200 : 404, response);
|
|
2219
|
-
return;
|
|
2220
|
-
}
|
|
2221
|
-
if (req.method === "GET" && pathname === "/engram/v1/entities") {
|
|
2222
|
-
this.enforceTokenOp("entity_list");
|
|
2223
|
-
const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 50, 1);
|
|
2224
|
-
const offset = parseStrictIntegerQuery(parsed.searchParams.get("offset"), "offset", 0, 0);
|
|
2225
|
-
const response = await this.service.entityList({
|
|
2226
|
-
namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
|
|
2227
|
-
query: parsed.searchParams.get("q") ?? void 0,
|
|
2228
|
-
limit,
|
|
2229
|
-
offset
|
|
2230
|
-
});
|
|
2231
|
-
this.respondJson(res, 200, response);
|
|
2232
|
-
return;
|
|
2233
|
-
}
|
|
2234
|
-
const entityMatch = pathname.match(/^\/engram\/v1\/entities\/([^/]+)$/);
|
|
2235
|
-
if (req.method === "GET" && entityMatch) {
|
|
2236
|
-
this.enforceTokenOp("entity_get");
|
|
2237
|
-
const entityName = decodeURIComponent(entityMatch[1] ?? "");
|
|
2238
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2239
|
-
const response = await this.service.entityGet(entityName, namespace);
|
|
2240
|
-
this.respondJson(res, response.found ? 200 : 404, response);
|
|
2241
|
-
return;
|
|
2242
|
-
}
|
|
2243
|
-
if (req.method === "GET" && pathname === "/engram/v1/review-queue") {
|
|
2244
|
-
this.enforceTokenOp("review_queue_list");
|
|
2245
|
-
const response = await this.service.reviewQueue(
|
|
2246
|
-
parsed.searchParams.get("runId") ?? void 0,
|
|
2247
|
-
this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
|
|
2248
|
-
this.resolveRequestPrincipal(req)
|
|
2249
|
-
);
|
|
2250
|
-
this.respondJson(res, 200, response);
|
|
2251
|
-
return;
|
|
2252
|
-
}
|
|
2253
|
-
if (req.method === "GET" && pathname === "/engram/v1/maintenance") {
|
|
2254
|
-
this.enforceTokenOp("maintenance_status");
|
|
2255
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2256
|
-
this.respondJson(res, 200, await this.service.maintenance(namespace, this.resolveRequestPrincipal(req)));
|
|
2257
|
-
return;
|
|
2258
|
-
}
|
|
2259
|
-
if (req.method === "GET" && pathname === "/engram/v1/quality") {
|
|
2260
|
-
this.enforceTokenOp("quality_status");
|
|
2261
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2262
|
-
this.respondJson(res, 200, await this.service.quality(namespace, this.resolveRequestPrincipal(req)));
|
|
2263
|
-
return;
|
|
2264
|
-
}
|
|
2265
|
-
if (req.method === "GET" && pathname === "/engram/v1/trust-zones/status") {
|
|
2266
|
-
this.enforceTokenOp("trust_zones_status");
|
|
2267
|
-
this.respondJson(
|
|
2268
|
-
res,
|
|
2269
|
-
200,
|
|
2270
|
-
await this.service.trustZoneStatus(this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0), this.resolveRequestPrincipal(req))
|
|
2271
|
-
);
|
|
2272
|
-
return;
|
|
2273
|
-
}
|
|
2274
|
-
if (req.method === "GET" && pathname === "/engram/v1/procedural/stats") {
|
|
2275
|
-
this.enforceTokenOp("procedural_stats");
|
|
2276
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
2277
|
-
this.respondJson(
|
|
2278
|
-
res,
|
|
2279
|
-
200,
|
|
2280
|
-
await this.service.procedureStats(
|
|
2281
|
-
{
|
|
2282
|
-
namespace: this.resolveNamespace(
|
|
2283
|
-
req,
|
|
2284
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
2285
|
-
)
|
|
2286
|
-
},
|
|
2287
|
-
this.resolveRequestPrincipal(req)
|
|
2288
|
-
)
|
|
2289
|
-
);
|
|
2290
|
-
return;
|
|
2291
|
-
}
|
|
2292
|
-
if (req.method === "GET" && pathname === "/engram/v1/trust-zones/records") {
|
|
2293
|
-
this.enforceTokenOp("trust_zones_records");
|
|
2294
|
-
const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 25, 1);
|
|
2295
|
-
const offset = parseStrictIntegerQuery(parsed.searchParams.get("offset"), "offset", 0, 0);
|
|
2296
|
-
const response = await this.service.trustZoneBrowse({
|
|
2297
|
-
query: parsed.searchParams.get("q") ?? void 0,
|
|
2298
|
-
zone: parseTrustZoneFilter(parsed.searchParams.get("zone")),
|
|
2299
|
-
kind: parseTrustZoneKindFilter(parsed.searchParams.get("kind")),
|
|
2300
|
-
sourceClass: parseTrustZoneSourceClassFilter(parsed.searchParams.get("sourceClass")),
|
|
2301
|
-
namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
|
|
2302
|
-
limit,
|
|
2303
|
-
offset
|
|
2304
|
-
}, this.resolveRequestPrincipal(req));
|
|
2305
|
-
this.respondJson(res, 200, response);
|
|
2306
|
-
return;
|
|
2307
|
-
}
|
|
2308
|
-
if (req.method === "POST" && pathname === "/engram/v1/review-disposition") {
|
|
2309
|
-
this.enforceTokenOp("review_disposition");
|
|
2310
|
-
const body = await this.readValidatedBody(req, "reviewDisposition");
|
|
2311
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2312
|
-
const response = await this.service.reviewDisposition({
|
|
2313
|
-
memoryId: body.memoryId,
|
|
2314
|
-
status: body.status,
|
|
2315
|
-
reasonCode: body.reasonCode,
|
|
2316
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
2317
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
2318
|
-
});
|
|
2319
|
-
if (this.shouldCountWriteRateLimit(response)) {
|
|
2320
|
-
this.recordWriteRateLimitHit(req);
|
|
2321
|
-
}
|
|
2322
|
-
this.respondJson(res, 200, response);
|
|
2323
|
-
return;
|
|
2324
|
-
}
|
|
2325
|
-
if (req.method === "POST" && pathname === "/engram/v1/trust-zones/promote") {
|
|
2326
|
-
this.enforceTokenOp("trust_zones_promote");
|
|
2327
|
-
const body = await this.readValidatedBody(req, "trustZonePromote");
|
|
2328
|
-
const dryRun = body.dryRun === true;
|
|
2329
|
-
if (!dryRun) {
|
|
2330
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2331
|
-
}
|
|
2332
|
-
const response = await this.service.trustZonePromote({
|
|
2333
|
-
recordId: body.recordId,
|
|
2334
|
-
targetZone: body.targetZone,
|
|
2335
|
-
promotionReason: body.promotionReason,
|
|
2336
|
-
recordedAt: body.recordedAt,
|
|
2337
|
-
summary: body.summary,
|
|
2338
|
-
dryRun,
|
|
2339
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
2340
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
2341
|
-
});
|
|
2342
|
-
if (this.shouldCountWriteRateLimit(response)) {
|
|
2343
|
-
this.recordWriteRateLimitHit(req);
|
|
2344
|
-
}
|
|
2345
|
-
this.respondJson(res, response.dryRun ? 200 : 201, response);
|
|
2346
|
-
return;
|
|
2347
|
-
}
|
|
2348
|
-
if (req.method === "POST" && pathname === "/engram/v1/trust-zones/demo-seed") {
|
|
2349
|
-
this.enforceTokenOp("trust_zones_demo_seed");
|
|
2350
|
-
const body = await this.readValidatedBody(req, "trustZoneDemoSeed");
|
|
2351
|
-
const dryRun = body.dryRun === true;
|
|
2352
|
-
if (!dryRun) {
|
|
2353
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2354
|
-
}
|
|
2355
|
-
const response = await this.service.trustZoneDemoSeed({
|
|
2356
|
-
scenario: body.scenario,
|
|
2357
|
-
recordedAt: body.recordedAt,
|
|
2358
|
-
dryRun,
|
|
2359
|
-
namespace: this.resolveNamespace(req, body.namespace),
|
|
2360
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
2361
|
-
});
|
|
2362
|
-
if (this.shouldCountWriteRateLimit(response)) {
|
|
2363
|
-
this.recordWriteRateLimitHit(req);
|
|
2364
|
-
}
|
|
2365
|
-
this.respondJson(res, response.dryRun ? 200 : 201, response);
|
|
2366
|
-
return;
|
|
2367
|
-
}
|
|
2368
|
-
if (req.method === "POST" && pathname === "/v1/citations/observed") {
|
|
2369
|
-
this.enforceTokenOp("citations_observed");
|
|
2370
|
-
const body = await this.readJsonBody(req);
|
|
2371
|
-
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
2372
|
-
throw new HttpError(400, "request body must be a JSON object", "invalid_body");
|
|
2373
|
-
}
|
|
2374
|
-
const payload = body;
|
|
2375
|
-
const sessionId = typeof payload.sessionId === "string" ? payload.sessionId : void 0;
|
|
2376
|
-
const namespace = typeof payload.namespace === "string" ? payload.namespace : void 0;
|
|
2377
|
-
const citationsRaw = payload.citations;
|
|
2378
|
-
if (!citationsRaw || typeof citationsRaw !== "object" || Array.isArray(citationsRaw)) {
|
|
2379
|
-
throw new HttpError(400, "citations must be a JSON object with entries and rolloutIds", "invalid_citations");
|
|
2380
|
-
}
|
|
2381
|
-
const citObj = citationsRaw;
|
|
2382
|
-
const entries = [];
|
|
2383
|
-
if (Array.isArray(citObj.entries)) {
|
|
2384
|
-
for (const raw of citObj.entries) {
|
|
2385
|
-
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
2386
|
-
const e = raw;
|
|
2387
|
-
if (typeof e.path === "string" && typeof e.lineStart === "number" && typeof e.lineEnd === "number") {
|
|
2388
|
-
entries.push({
|
|
2389
|
-
path: e.path,
|
|
2390
|
-
lineStart: e.lineStart,
|
|
2391
|
-
lineEnd: e.lineEnd,
|
|
2392
|
-
note: typeof e.note === "string" ? e.note : ""
|
|
2393
|
-
});
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
const rolloutIds = [];
|
|
2399
|
-
if (Array.isArray(citObj.rolloutIds)) {
|
|
2400
|
-
for (const id of citObj.rolloutIds) {
|
|
2401
|
-
if (typeof id === "string" && id.length > 0) {
|
|
2402
|
-
rolloutIds.push(id);
|
|
2403
|
-
}
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
let matched = 0;
|
|
2407
|
-
let submitted = 0;
|
|
2408
|
-
if (typeof this.service.recordCitationUsage === "function") {
|
|
2409
|
-
const result = await this.service.recordCitationUsage({
|
|
2410
|
-
sessionId,
|
|
2411
|
-
namespace: this.resolveNamespace(req, namespace),
|
|
2412
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
2413
|
-
entries,
|
|
2414
|
-
rolloutIds
|
|
2415
|
-
});
|
|
2416
|
-
submitted = result.submitted;
|
|
2417
|
-
matched = result.matched;
|
|
2418
|
-
}
|
|
2419
|
-
this.respondJson(res, 200, {
|
|
2420
|
-
ok: true,
|
|
2421
|
-
submitted,
|
|
2422
|
-
matched,
|
|
2423
|
-
entriesReceived: entries.length,
|
|
2424
|
-
rolloutIdsReceived: rolloutIds.length
|
|
2425
|
-
});
|
|
2426
|
-
return;
|
|
2427
|
-
}
|
|
2428
|
-
if (req.method === "GET" && pathname === "/engram/v1/review/contradictions") {
|
|
2429
|
-
this.enforceTokenOp("review_list");
|
|
2430
|
-
const VALID_FILTERS = /* @__PURE__ */ new Set(["all", "unresolved", "contradicts", "independent", "duplicates", "needs-user"]);
|
|
2431
|
-
const rawFilter = parsed.searchParams.get("filter") ?? "unresolved";
|
|
2432
|
-
if (!VALID_FILTERS.has(rawFilter)) {
|
|
2433
|
-
this.respondJson(res, 400, { error: `Invalid filter '${rawFilter}'. Valid: ${[...VALID_FILTERS].join(", ")}` });
|
|
2434
|
-
return;
|
|
2435
|
-
}
|
|
2436
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2437
|
-
const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 50, 1);
|
|
2438
|
-
const principal = this.resolveRequestPrincipal(req);
|
|
2439
|
-
const resolved = await this.service.getReadableStorageForNamespace(namespace, principal);
|
|
2440
|
-
const reviewNamespace = this.service.configRef.namespacesEnabled ? resolved.namespace : void 0;
|
|
2441
|
-
const includeUnscopedForNamespace = Boolean(
|
|
2442
|
-
reviewNamespace && isDefaultReviewNamespace(this.service.configRef.defaultNamespace, namespace, reviewNamespace)
|
|
2443
|
-
);
|
|
2444
|
-
const result = listPairs(this.service.memoryDir, {
|
|
2445
|
-
filter: rawFilter,
|
|
2446
|
-
namespace: reviewNamespace,
|
|
2447
|
-
includeUnscopedForNamespace,
|
|
2448
|
-
limit
|
|
2449
|
-
});
|
|
2450
|
-
this.respondJson(res, 200, result);
|
|
2451
|
-
return;
|
|
2452
|
-
}
|
|
2453
|
-
if (req.method === "GET" && pathname.startsWith("/engram/v1/review/contradictions/")) {
|
|
2454
|
-
this.enforceTokenOp("contradiction_detail");
|
|
2455
|
-
const pairId = pathname.split("/").pop() ?? "";
|
|
2456
|
-
const pair = readPair(this.service.memoryDir, pairId);
|
|
2457
|
-
if (!pair) {
|
|
2458
|
-
this.respondJson(res, 404, { error: "pair_not_found" });
|
|
2459
|
-
return;
|
|
2460
|
-
}
|
|
2461
|
-
enforceNamespaceAllowList(
|
|
2462
|
-
tokenCapabilityStore.getStore(),
|
|
2463
|
-
pair.namespace,
|
|
2464
|
-
this.service.configRef?.defaultNamespace
|
|
2465
|
-
);
|
|
2466
|
-
try {
|
|
2467
|
-
await this.service.getReadableStorageForNamespace(pair.namespace, this.resolveRequestPrincipal(req));
|
|
2468
|
-
} catch {
|
|
2469
|
-
this.respondJson(res, 404, { error: "pair_not_found" });
|
|
2470
|
-
return;
|
|
2471
|
-
}
|
|
2472
|
-
this.respondJson(res, 200, pair);
|
|
2473
|
-
return;
|
|
2474
|
-
}
|
|
2475
|
-
if (req.method === "POST" && pathname === "/engram/v1/review/resolve") {
|
|
2476
|
-
this.enforceTokenOp("review_resolve");
|
|
2477
|
-
const body = await this.readJsonBody(req);
|
|
2478
|
-
const pairId = typeof body.pairId === "string" ? body.pairId : "";
|
|
2479
|
-
const verb = typeof body.verb === "string" ? body.verb : "";
|
|
2480
|
-
if (!pairId || !verb) {
|
|
2481
|
-
this.respondJson(res, 400, { error: "pairId and verb are required" });
|
|
2482
|
-
return;
|
|
2483
|
-
}
|
|
2484
|
-
if (!isValidResolutionVerb(verb)) {
|
|
2485
|
-
this.respondJson(res, 400, { error: `Invalid verb: ${verb}. Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context` });
|
|
2486
|
-
return;
|
|
2487
|
-
}
|
|
2488
|
-
const targetPair = readPair(this.service.memoryDir, pairId);
|
|
2489
|
-
if (targetPair) {
|
|
2490
|
-
enforceNamespaceAllowList(
|
|
2491
|
-
tokenCapabilityStore.getStore(),
|
|
2492
|
-
targetPair.namespace,
|
|
2493
|
-
this.service.configRef?.defaultNamespace
|
|
2494
|
-
);
|
|
2495
|
-
}
|
|
2496
|
-
const principal = this.resolveRequestPrincipal(req);
|
|
2497
|
-
const result = await executeResolution(this.service.memoryDir, this.service.storageRef, pairId, verb, {
|
|
2498
|
-
mergedMemoryId: typeof body.mergedMemoryId === "string" ? body.mergedMemoryId : void 0,
|
|
2499
|
-
mergedContent: typeof body.mergedContent === "string" ? body.mergedContent : void 0,
|
|
2500
|
-
storageForNamespace: async (namespace) => {
|
|
2501
|
-
const resolved = await this.service.getWritableStorageForNamespace(namespace, principal);
|
|
2502
|
-
return resolved.storage;
|
|
2503
|
-
},
|
|
2504
|
-
// Catalog write touch (issue #1499 sweep): a contradiction merge writes a
|
|
2505
|
-
// new memory directly to the resolved namespace storage, bypassing the
|
|
2506
|
-
// extraction write path. Record it so QMD maintenance / writtenSince
|
|
2507
|
-
// don't miss the write. Best-effort and failure-tolerant.
|
|
2508
|
-
onMergedMemoryWritten: (namespace, storageDir) => {
|
|
2509
|
-
}
|
|
2510
|
-
});
|
|
2511
|
-
this.respondJson(res, 200, result);
|
|
2512
|
-
return;
|
|
2513
|
-
}
|
|
2514
|
-
if (req.method === "GET" && pathname === "/engram/v1/graph/snapshot") {
|
|
2515
|
-
this.enforceTokenOp("graph_snapshot");
|
|
2516
|
-
const limitRaw = parsed.searchParams.get("limit");
|
|
2517
|
-
let limit;
|
|
2518
|
-
if (limitRaw !== null && limitRaw.length > 0) {
|
|
2519
|
-
const parsedLimit = Number(limitRaw);
|
|
2520
|
-
if (!Number.isFinite(parsedLimit) || !Number.isInteger(parsedLimit) || parsedLimit <= 0) {
|
|
2521
|
-
this.respondJson(res, 400, {
|
|
2522
|
-
error: "invalid_limit",
|
|
2523
|
-
code: "invalid_limit",
|
|
2524
|
-
message: "limit must be a positive integer"
|
|
2525
|
-
});
|
|
2526
|
-
return;
|
|
2527
|
-
}
|
|
2528
|
-
limit = parsedLimit;
|
|
2529
|
-
}
|
|
2530
|
-
const sinceRaw = parsed.searchParams.get("since");
|
|
2531
|
-
let since;
|
|
2532
|
-
if (sinceRaw !== null && sinceRaw.length > 0) {
|
|
2533
|
-
if (!Number.isFinite(Date.parse(sinceRaw))) {
|
|
2534
|
-
this.respondJson(res, 400, {
|
|
2535
|
-
error: "invalid_since",
|
|
2536
|
-
code: "invalid_since",
|
|
2537
|
-
message: "since must be a parseable ISO timestamp"
|
|
2538
|
-
});
|
|
2539
|
-
return;
|
|
2540
|
-
}
|
|
2541
|
-
since = sinceRaw;
|
|
2542
|
-
}
|
|
2543
|
-
const focusNodeIdRaw = parsed.searchParams.get("focusNodeId");
|
|
2544
|
-
const focusNodeId = focusNodeIdRaw && focusNodeIdRaw.length > 0 ? focusNodeIdRaw : void 0;
|
|
2545
|
-
const categoriesRaw = parsed.searchParams.get("categories");
|
|
2546
|
-
let categories;
|
|
2547
|
-
if (categoriesRaw !== null && categoriesRaw.length > 0) {
|
|
2548
|
-
categories = categoriesRaw.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
|
|
2549
|
-
if (categories.length === 0) {
|
|
2550
|
-
this.respondJson(res, 400, {
|
|
2551
|
-
error: "invalid_categories",
|
|
2552
|
-
code: "invalid_categories",
|
|
2553
|
-
message: "categories must be a comma-separated list with at least one non-empty value"
|
|
2554
|
-
});
|
|
2555
|
-
return;
|
|
2556
|
-
}
|
|
2557
|
-
}
|
|
2558
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
2559
|
-
const namespace = this.resolveNamespace(
|
|
2560
|
-
req,
|
|
2561
|
-
namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
|
|
2562
|
-
);
|
|
2563
|
-
try {
|
|
2564
|
-
const snapshot = await this.service.graphSnapshot(
|
|
2565
|
-
{
|
|
2566
|
-
namespace,
|
|
2567
|
-
...limit !== void 0 ? { limit } : {},
|
|
2568
|
-
...since !== void 0 ? { since } : {},
|
|
2569
|
-
...focusNodeId !== void 0 ? { focusNodeId } : {},
|
|
2570
|
-
...categories !== void 0 ? { categories } : {}
|
|
2571
|
-
},
|
|
2572
|
-
this.resolveRequestPrincipal(req)
|
|
2573
|
-
);
|
|
2574
|
-
this.respondJson(res, 200, snapshot);
|
|
2575
|
-
} catch (err) {
|
|
2576
|
-
if (err instanceof Error && err.message.startsWith("graphSnapshot:")) {
|
|
2577
|
-
this.respondJson(res, 400, {
|
|
2578
|
-
error: "invalid_request",
|
|
2579
|
-
code: "invalid_request",
|
|
2580
|
-
message: err.message
|
|
2581
|
-
});
|
|
2582
|
-
return;
|
|
2583
|
-
}
|
|
2584
|
-
throw err;
|
|
2585
|
-
}
|
|
2586
|
-
return;
|
|
2587
|
-
}
|
|
2588
|
-
if (req.method === "POST" && pathname === "/engram/v1/contradiction-scan") {
|
|
2589
|
-
this.enforceTokenOp("contradiction_scan_run");
|
|
2590
|
-
const body = await this.readJsonBody(req);
|
|
2591
|
-
const { runContradictionScan } = await import("./contradiction-scan-GVD4JJ7B.js");
|
|
2592
|
-
const principal = this.resolveRequestPrincipal(req);
|
|
2593
|
-
const result = await runContradictionScan({
|
|
2594
|
-
storage: this.service.storageRef,
|
|
2595
|
-
config: this.service.configRef,
|
|
2596
|
-
memoryDir: this.service.memoryDir,
|
|
2597
|
-
embeddingLookupFactory: this.service.embeddingLookupFactoryRef,
|
|
2598
|
-
storageForNamespace: (namespace) => this.service.getWritableStorageForNamespace(namespace, principal),
|
|
2599
|
-
localLlm: this.service.localLlmRef,
|
|
2600
|
-
fallbackLlm: this.service.fallbackLlmRef,
|
|
2601
|
-
namespace: this.resolveNamespace(req, typeof body.namespace === "string" ? body.namespace : void 0)
|
|
2602
|
-
});
|
|
2603
|
-
this.respondJson(res, 200, result);
|
|
2604
|
-
return;
|
|
2605
|
-
}
|
|
2606
|
-
if (req.method === "GET" && pathname === "/engram/v1/graph/events") {
|
|
2607
|
-
this.enforceTokenOp("graph_events");
|
|
2608
|
-
await this.handleGraphEventsSSE(req, res);
|
|
2609
|
-
return;
|
|
2610
|
-
}
|
|
2611
|
-
if (req.method === "POST" && pathname === "/engram/v1/chat/message") {
|
|
2612
|
-
this.enforceTokenOp("chat_message");
|
|
2613
|
-
const body = await this.readJsonBody(req);
|
|
2614
|
-
const resumeChatSessionId = typeof body.chatSessionId === "string" ? body.chatSessionId : void 0;
|
|
2615
|
-
if (resumeChatSessionId) {
|
|
2616
|
-
await enforceChatSessionNamespace(this.service, resumeChatSessionId);
|
|
2617
|
-
} else {
|
|
2618
|
-
enforceNamespaceAllowList(
|
|
2619
|
-
tokenCapabilityStore.getStore(),
|
|
2620
|
-
void 0,
|
|
2621
|
-
this.service.configRef?.defaultNamespace
|
|
2622
|
-
);
|
|
2623
|
-
}
|
|
2624
|
-
await handleChatMessage(
|
|
2625
|
-
req,
|
|
2626
|
-
res,
|
|
2627
|
-
body,
|
|
2628
|
-
{ service: this.service, config: this.service.configRef?.chat, memoryDir: this.service.memoryDir },
|
|
2629
|
-
this.resolveRequestPrincipal(req)
|
|
2630
|
-
);
|
|
2631
|
-
return;
|
|
2632
|
-
}
|
|
2633
|
-
const chatEventsMatch = /^\/engram\/v1\/chat\/events\/([^/]+)$/.exec(pathname);
|
|
2634
|
-
if (req.method === "GET" && chatEventsMatch) {
|
|
2635
|
-
this.enforceTokenOp("chat_events");
|
|
2636
|
-
await enforceChatSessionNamespace(this.service, chatEventsMatch[1] ?? "");
|
|
2637
|
-
await handleChatEventsSSE(
|
|
2638
|
-
req,
|
|
2639
|
-
res,
|
|
2640
|
-
chatEventsMatch[1] ?? "",
|
|
2641
|
-
{
|
|
2642
|
-
service: this.service,
|
|
2643
|
-
config: this.service.configRef?.chat,
|
|
2644
|
-
memoryDir: this.service.memoryDir,
|
|
2645
|
-
// Register the chat-SSE disconnect cleanup with this server's
|
|
2646
|
-
// stop() set so an HTTP shutdown forcibly releases the heartbeat
|
|
2647
|
-
// and transcript subscription even when a lingering client never
|
|
2648
|
-
// emits 'close' (cursor Medium review; mirrors handleGraphEventsSSE
|
|
2649
|
-
// which registers in sseCleanupFns at access-http.ts:2604).
|
|
2650
|
-
registerSseCleanup: (cleanup) => {
|
|
2651
|
-
this.sseCleanupFns.add(cleanup);
|
|
2652
|
-
return () => {
|
|
2653
|
-
this.sseCleanupFns.delete(cleanup);
|
|
2654
|
-
};
|
|
2655
|
-
}
|
|
2656
|
-
},
|
|
2657
|
-
this.resolveRequestPrincipal(req)
|
|
2658
|
-
);
|
|
2659
|
-
return;
|
|
2660
|
-
}
|
|
2661
|
-
if (req.method === "GET" && pathname === "/engram/v1/console/state") {
|
|
2662
|
-
this.enforceTokenOp("console_state");
|
|
2663
|
-
const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
|
|
2664
|
-
const snapshot = await this.service.consoleState(namespace, this.resolveRequestPrincipal(req));
|
|
2665
|
-
this.respondJson(res, 200, snapshot);
|
|
2666
|
-
return;
|
|
2667
|
-
}
|
|
2668
|
-
if (req.method === "GET" && pathname === "/engram/v1/peers") {
|
|
2669
|
-
this.enforceTokenOp("peer_list");
|
|
2670
|
-
const result = await this.service.peerList();
|
|
2671
|
-
this.respondJson(res, 200, result);
|
|
2672
|
-
return;
|
|
2673
|
-
}
|
|
2674
|
-
const peerProfileMatch = /^\/engram\/v1\/peers\/([^/]+)\/profile$/.exec(pathname);
|
|
2675
|
-
if (peerProfileMatch) {
|
|
2676
|
-
this.enforceTokenOp("peer_profile_get");
|
|
2677
|
-
if (req.method !== "GET") {
|
|
2678
|
-
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
2679
|
-
return;
|
|
2680
|
-
}
|
|
2681
|
-
const peerId = decodePeerIdSegment(peerProfileMatch[1] ?? "");
|
|
2682
|
-
const result = await this.service.peerProfileGet(peerId);
|
|
2683
|
-
if (!result.found) {
|
|
2684
|
-
this.respondJson(res, 404, { error: "peer_profile_not_found", code: "peer_profile_not_found" });
|
|
2685
|
-
return;
|
|
2686
|
-
}
|
|
2687
|
-
this.respondJson(res, 200, result);
|
|
2688
|
-
return;
|
|
2689
|
-
}
|
|
2690
|
-
const peerIdMatch = /^\/engram\/v1\/peers\/([^/]+)$/.exec(pathname);
|
|
2691
|
-
if (peerIdMatch) {
|
|
2692
|
-
const peerId = decodePeerIdSegment(peerIdMatch[1] ?? "");
|
|
2693
|
-
if (req.method === "GET") {
|
|
2694
|
-
this.enforceTokenOp("peer_get");
|
|
2695
|
-
const result = await this.service.peerGet(peerId);
|
|
2696
|
-
if (!result.found) {
|
|
2697
|
-
this.respondJson(res, 404, { error: "peer_not_found", code: "peer_not_found" });
|
|
2698
|
-
return;
|
|
2699
|
-
}
|
|
2700
|
-
this.respondJson(res, 200, result);
|
|
2701
|
-
return;
|
|
2702
|
-
}
|
|
2703
|
-
if (req.method === "PUT") {
|
|
2704
|
-
this.enforceTokenOp("peer_set");
|
|
2705
|
-
const body = await this.readJsonBody(req);
|
|
2706
|
-
if ("kind" in body && body.kind !== void 0 && typeof body.kind !== "string") {
|
|
2707
|
-
throw new EngramAccessInputError("kind must be a string when provided");
|
|
2708
|
-
}
|
|
2709
|
-
if ("displayName" in body && body.displayName !== void 0 && typeof body.displayName !== "string") {
|
|
2710
|
-
throw new EngramAccessInputError("displayName must be a string when provided");
|
|
2711
|
-
}
|
|
2712
|
-
if ("notes" in body && body.notes !== void 0 && typeof body.notes !== "string") {
|
|
2713
|
-
throw new EngramAccessInputError("notes must be a string when provided");
|
|
2714
|
-
}
|
|
2715
|
-
const result = await this.service.peerSet({
|
|
2716
|
-
id: peerId,
|
|
2717
|
-
kind: typeof body.kind === "string" ? body.kind : void 0,
|
|
2718
|
-
displayName: typeof body.displayName === "string" ? body.displayName : void 0,
|
|
2719
|
-
notes: typeof body.notes === "string" ? body.notes : void 0
|
|
2720
|
-
});
|
|
2721
|
-
this.respondJson(res, result.created ? 201 : 200, result);
|
|
2722
|
-
return;
|
|
2723
|
-
}
|
|
2724
|
-
if (req.method === "DELETE") {
|
|
2725
|
-
this.enforceTokenOp("peer_delete");
|
|
2726
|
-
const forgetParam = parsed.searchParams.get("forget");
|
|
2727
|
-
if (forgetParam === "true") {
|
|
2728
|
-
const body = await this.readJsonBody(req);
|
|
2729
|
-
const confirm = typeof body.confirm === "string" ? body.confirm : "";
|
|
2730
|
-
if (confirm !== "yes") {
|
|
2731
|
-
this.respondJson(res, 400, {
|
|
2732
|
-
error: "confirm_required",
|
|
2733
|
-
code: "confirm_required",
|
|
2734
|
-
message: "DELETE ?forget=true requires { confirm: 'yes' } in the request body"
|
|
2735
|
-
});
|
|
2736
|
-
return;
|
|
2737
|
-
}
|
|
2738
|
-
const result2 = await this.service.peerForget(peerId, { confirm: "yes" });
|
|
2739
|
-
this.respondJson(res, 200, result2);
|
|
2740
|
-
return;
|
|
2741
|
-
}
|
|
2742
|
-
const result = await this.service.peerDelete(peerId);
|
|
2743
|
-
this.respondJson(res, 200, result);
|
|
2744
|
-
return;
|
|
2745
|
-
}
|
|
2746
|
-
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
2747
|
-
return;
|
|
2748
|
-
}
|
|
2749
|
-
if (req.method === "GET" && pathname === "/engram/v1/dreams/status") {
|
|
2750
|
-
this.enforceTokenOp("dreams_status");
|
|
2751
|
-
const { normalizeDreamsStatusWindowHours } = await import("./dreams-ledger-567VKVOU.js");
|
|
2752
|
-
const windowHoursRaw = parsed.searchParams.get("windowHours");
|
|
2753
|
-
let windowHours;
|
|
2754
|
-
try {
|
|
2755
|
-
windowHours = normalizeDreamsStatusWindowHours(
|
|
2756
|
-
windowHoursRaw !== null ? Number(windowHoursRaw) : void 0
|
|
2757
|
-
);
|
|
2758
|
-
} catch {
|
|
2759
|
-
this.respondJson(res, 400, { error: "windowHours must be a positive integer" });
|
|
2760
|
-
return;
|
|
2761
|
-
}
|
|
2762
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
2763
|
-
const namespace = this.resolveNamespace(req, namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0);
|
|
2764
|
-
const result = await this.service.dreamsStatus({
|
|
2765
|
-
windowHours,
|
|
2766
|
-
namespace,
|
|
2767
|
-
principal: this.resolveRequestPrincipal(req)
|
|
2768
|
-
});
|
|
2769
|
-
this.respondJson(res, 200, result);
|
|
2770
|
-
return;
|
|
2771
|
-
}
|
|
2772
|
-
if (req.method === "POST" && pathname === "/engram/v1/dreams/run") {
|
|
2773
|
-
this.enforceTokenOp("dreams_run");
|
|
2774
|
-
const body = await this.readJsonBody(req);
|
|
2775
|
-
const VALID_PHASES = ["lightSleep", "rem", "deepSleep"];
|
|
2776
|
-
const phase = typeof body.phase === "string" ? body.phase : void 0;
|
|
2777
|
-
if (!phase || !VALID_PHASES.includes(phase)) {
|
|
2778
|
-
this.respondJson(res, 400, {
|
|
2779
|
-
error: `phase is required and must be one of: ${VALID_PHASES.join(", ")}`
|
|
2780
|
-
});
|
|
2781
|
-
return;
|
|
2782
|
-
}
|
|
2783
|
-
if ("dryRun" in body && body.dryRun !== void 0 && typeof body.dryRun !== "boolean") {
|
|
2784
|
-
this.respondJson(res, 400, {
|
|
2785
|
-
error: "dryRun must be a boolean when provided"
|
|
2786
|
-
});
|
|
2787
|
-
return;
|
|
2788
|
-
}
|
|
2789
|
-
if ("namespace" in body && body.namespace !== void 0 && typeof body.namespace !== "string") {
|
|
2790
|
-
this.respondJson(res, 400, {
|
|
2791
|
-
error: "namespace must be a string when provided"
|
|
2792
|
-
});
|
|
2793
|
-
return;
|
|
2794
|
-
}
|
|
2795
|
-
const dryRun = body.dryRun === true;
|
|
2796
|
-
const namespace = this.resolveNamespace(req, typeof body.namespace === "string" ? body.namespace : void 0);
|
|
2797
|
-
if (!dryRun) {
|
|
2798
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2799
|
-
}
|
|
2800
|
-
const result = await this.service.dreamsRun({
|
|
2801
|
-
phase,
|
|
2802
|
-
dryRun,
|
|
2803
|
-
namespace,
|
|
2804
|
-
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
2805
|
-
});
|
|
2806
|
-
if (this.shouldCountWriteRateLimit(result)) {
|
|
2807
|
-
this.recordWriteRateLimitHit(req);
|
|
2808
|
-
}
|
|
2809
|
-
this.respondJson(res, 200, result);
|
|
2810
|
-
return;
|
|
2811
|
-
}
|
|
2812
|
-
if (pathname.startsWith("/engram/v1/admin/scope/inspect")) {
|
|
2813
|
-
if (req.method !== "GET" && req.method !== "POST") {
|
|
2814
|
-
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
2815
|
-
return;
|
|
2816
|
-
}
|
|
2817
|
-
this.requireOperatorToken();
|
|
2818
|
-
const principal = this.resolveRequestPrincipal(req);
|
|
2819
|
-
let sessionKey;
|
|
2820
|
-
let namespaceOverride;
|
|
2821
|
-
let operation;
|
|
2822
|
-
if (req.method === "GET") {
|
|
2823
|
-
sessionKey = parsed.searchParams.get("session") ?? void 0;
|
|
2824
|
-
namespaceOverride = parsed.searchParams.get("namespace") ?? void 0;
|
|
2825
|
-
operation = parsed.searchParams.get("operation") ?? void 0;
|
|
2826
|
-
} else {
|
|
2827
|
-
const body = await this.readJsonBody(req);
|
|
2828
|
-
sessionKey = typeof body.sessionKey === "string" ? body.sessionKey : void 0;
|
|
2829
|
-
namespaceOverride = typeof body.namespace === "string" ? body.namespace : void 0;
|
|
2830
|
-
operation = typeof body.operation === "string" ? body.operation : void 0;
|
|
2831
|
-
}
|
|
2832
|
-
const inspection = await this.service.adminInspectScope({
|
|
2833
|
-
sessionKey: sessionKey && sessionKey.length > 0 ? sessionKey : void 0,
|
|
2834
|
-
namespace: namespaceOverride && namespaceOverride.length > 0 ? namespaceOverride : void 0,
|
|
2835
|
-
principalOverride: principal,
|
|
2836
|
-
operation
|
|
2837
|
-
});
|
|
2838
|
-
this.respondJson(res, 200, inspection);
|
|
2839
|
-
return;
|
|
2840
|
-
}
|
|
2841
|
-
if (pathname === "/engram/v1/admin/namespaces") {
|
|
2842
|
-
if (req.method !== "GET") {
|
|
2843
|
-
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
2844
|
-
return;
|
|
2845
|
-
}
|
|
2846
|
-
this.requireOperatorToken();
|
|
2847
|
-
const kind = optionalNamespaceKindQueryParam(parsed.searchParams.get("kind"));
|
|
2848
|
-
const discoveredBy = parsed.searchParams.get("discoveredBy");
|
|
2849
|
-
const result = await this.service.adminListNamespaces({
|
|
2850
|
-
...kind ? { kind } : {},
|
|
2851
|
-
...discoveredBy ? { discoveredBy } : {}
|
|
2852
|
-
});
|
|
2853
|
-
this.respondJson(res, 200, result);
|
|
2854
|
-
return;
|
|
2855
|
-
}
|
|
2856
|
-
if (pathname === "/engram/v1/admin/maintenance-health") {
|
|
2857
|
-
if (req.method !== "GET") {
|
|
2858
|
-
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
2859
|
-
return;
|
|
2860
|
-
}
|
|
2861
|
-
this.requireOperatorToken();
|
|
2862
|
-
const report = await this.service.adminMaintenanceHealth();
|
|
2863
|
-
this.respondJson(res, 200, report);
|
|
2864
|
-
return;
|
|
2865
|
-
}
|
|
2866
|
-
if (pathname === "/engram/v1/admin/transcript-audit") {
|
|
2867
|
-
if (req.method !== "GET") {
|
|
2868
|
-
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
2869
|
-
return;
|
|
2870
|
-
}
|
|
2871
|
-
this.requireOperatorToken();
|
|
2872
|
-
const report = await this.service.adminTranscriptAudit();
|
|
2873
|
-
this.respondJson(res, 200, report);
|
|
2874
|
-
return;
|
|
2875
|
-
}
|
|
2876
|
-
if (pathname === "/engram/v1/admin/promote") {
|
|
2877
|
-
if (req.method !== "POST") {
|
|
2878
|
-
this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
|
|
2879
|
-
return;
|
|
2880
|
-
}
|
|
2881
|
-
this.requireOperatorToken();
|
|
2882
|
-
const body = await this.readJsonBody(req);
|
|
2883
|
-
if (typeof body.sourceMemoryId !== "string" || body.sourceMemoryId.trim().length === 0) {
|
|
2884
|
-
this.respondJson(res, 400, {
|
|
2885
|
-
error: "invalid_request",
|
|
2886
|
-
code: "invalid_request",
|
|
2887
|
-
message: "sourceMemoryId is required"
|
|
2888
|
-
});
|
|
2889
|
-
return;
|
|
2890
|
-
}
|
|
2891
|
-
if (typeof body.reason !== "string" || body.reason.trim().length === 0) {
|
|
2892
|
-
this.respondJson(res, 400, {
|
|
2893
|
-
error: "invalid_request",
|
|
2894
|
-
code: "invalid_request",
|
|
2895
|
-
message: "reason is required for promotion"
|
|
2896
|
-
});
|
|
2897
|
-
return;
|
|
2898
|
-
}
|
|
2899
|
-
if (!Array.isArray(body.targets) || body.targets.length === 0) {
|
|
2900
|
-
this.respondJson(res, 400, {
|
|
2901
|
-
error: "invalid_request",
|
|
2902
|
-
code: "invalid_request",
|
|
2903
|
-
message: "targets must be a non-empty array"
|
|
2904
|
-
});
|
|
2905
|
-
return;
|
|
2906
|
-
}
|
|
2907
|
-
const VALID_TARGETS = ["teamProject", "serverShared", "userProject", "userGlobal", "explicit"];
|
|
2908
|
-
const targets = [];
|
|
2909
|
-
for (const entry of body.targets) {
|
|
2910
|
-
if (typeof entry !== "object" || entry === null || typeof entry.kind !== "string") {
|
|
2911
|
-
this.respondJson(res, 400, {
|
|
2912
|
-
error: "invalid_request",
|
|
2913
|
-
code: "invalid_request",
|
|
2914
|
-
message: "each target must be an object with a 'kind' string"
|
|
2915
|
-
});
|
|
2916
|
-
return;
|
|
2917
|
-
}
|
|
2918
|
-
if (!VALID_TARGETS.includes(entry.kind)) {
|
|
2919
|
-
this.respondJson(res, 400, {
|
|
2920
|
-
error: "invalid_request",
|
|
2921
|
-
code: "invalid_request",
|
|
2922
|
-
message: `target.kind must be one of: ${VALID_TARGETS.join(", ")}`
|
|
2923
|
-
});
|
|
2924
|
-
return;
|
|
2925
|
-
}
|
|
2926
|
-
targets.push({
|
|
2927
|
-
kind: entry.kind,
|
|
2928
|
-
namespace: typeof entry.namespace === "string" ? entry.namespace : void 0
|
|
2929
|
-
});
|
|
2930
|
-
}
|
|
2931
|
-
try {
|
|
2932
|
-
this.ensureWriteRateLimitAvailable(req);
|
|
2933
|
-
const result = await this.service.adminPromoteMemory({
|
|
2934
|
-
sourceMemoryId: body.sourceMemoryId,
|
|
2935
|
-
namespace: typeof body.namespace === "string" ? body.namespace : void 0,
|
|
2936
|
-
principal: this.resolveRequestPrincipal(req),
|
|
2937
|
-
sessionKey: typeof body.sessionKey === "string" ? body.sessionKey : void 0,
|
|
2938
|
-
targets,
|
|
2939
|
-
reason: body.reason
|
|
2940
|
-
});
|
|
2941
|
-
this.recordWriteRateLimitHit(req);
|
|
2942
|
-
this.respondJson(res, 200, result);
|
|
2943
|
-
} catch (err) {
|
|
2944
|
-
if (err instanceof EngramAccessInputError) {
|
|
2945
|
-
this.respondJson(res, 400, {
|
|
2946
|
-
error: "invalid_request",
|
|
2947
|
-
code: "invalid_request",
|
|
2948
|
-
message: err.message
|
|
2949
|
-
});
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
throw err;
|
|
2953
|
-
}
|
|
2954
|
-
return;
|
|
2955
|
-
}
|
|
2956
|
-
this.respondJson(res, 404, { error: "not_found", code: "not_found" });
|
|
2957
|
-
}
|
|
2958
|
-
createRequestAbortSignal(req, res) {
|
|
2959
|
-
const controller = new AbortController();
|
|
2960
|
-
const abort = () => {
|
|
2961
|
-
if (!controller.signal.aborted) controller.abort();
|
|
2962
|
-
};
|
|
2963
|
-
req.once("aborted", abort);
|
|
2964
|
-
res.once("close", () => {
|
|
2965
|
-
if (!res.writableEnded) abort();
|
|
2966
|
-
});
|
|
2967
|
-
return controller.signal;
|
|
2968
|
-
}
|
|
2969
|
-
/**
|
|
2970
|
-
* SSE handler for /engram/v1/graph/events.
|
|
2971
|
-
*
|
|
2972
|
-
* Lifecycle:
|
|
2973
|
-
* 1. Write SSE headers (Content-Type: text/event-stream).
|
|
2974
|
-
* 2. Register this response in `sseClients`.
|
|
2975
|
-
* 3. Resolve the namespace from the request and subscribe to THAT
|
|
2976
|
-
* namespace's graph event bus (Codex P1: in multi-namespace
|
|
2977
|
-
* deployments each namespace has its own bus keyed by its storage
|
|
2978
|
-
* dir — subscribing to the global root leaks events across tenants).
|
|
2979
|
-
* 4. On each event, add to a 200 ms batch; flush batch as a single SSE frame.
|
|
2980
|
-
* 5. Send heartbeat every 25 s.
|
|
2981
|
-
* 6. On client disconnect (req "close"), clean up timers and unsubscribe.
|
|
2982
|
-
* 7. Register the cleanup callback in `sseCleanupFns` so `stop()` can
|
|
2983
|
-
* release the heartbeat interval and bus subscription even when the
|
|
2984
|
-
* client never disconnects (Cursor review thread `access-http.ts:232`).
|
|
2985
|
-
*/
|
|
2986
|
-
async handleGraphEventsSSE(req, res) {
|
|
2987
|
-
const parsed = new URL2(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
|
|
2988
|
-
const namespaceParam = parsed.searchParams.get("namespace");
|
|
2989
|
-
const namespace = this.resolveNamespace(req, namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0);
|
|
2990
|
-
const principal = this.resolveRequestPrincipal(req);
|
|
2991
|
-
const memoryDir = await this.service.getMemoryDirForNamespace(namespace, principal);
|
|
2992
|
-
res.writeHead(200, {
|
|
2993
|
-
"content-type": "text/event-stream; charset=utf-8",
|
|
2994
|
-
"cache-control": "no-cache, no-store, must-revalidate",
|
|
2995
|
-
"connection": "keep-alive",
|
|
2996
|
-
"x-accel-buffering": "no",
|
|
2997
|
-
// prevent nginx buffering
|
|
2998
|
-
"transfer-encoding": "chunked"
|
|
2999
|
-
});
|
|
3000
|
-
const writeSSE = (payload) => {
|
|
3001
|
-
try {
|
|
3002
|
-
res.write(`data: ${JSON.stringify(payload)}
|
|
3003
|
-
|
|
3004
|
-
`);
|
|
3005
|
-
} catch {
|
|
3006
|
-
}
|
|
3007
|
-
};
|
|
3008
|
-
writeSSE({ type: "connected" });
|
|
3009
|
-
this.sseClients.add(res);
|
|
3010
|
-
const flushBatch = () => {
|
|
3011
|
-
const batch = this.ssePendingBatches.get(res);
|
|
3012
|
-
if (!batch || batch.length === 0) return;
|
|
3013
|
-
this.ssePendingBatches.delete(res);
|
|
3014
|
-
this.sseBatchTimers.delete(res);
|
|
3015
|
-
writeSSE({ type: "batch", events: batch });
|
|
3016
|
-
};
|
|
3017
|
-
const unsubscribe = subscribeGraphEvents(memoryDir, (event) => {
|
|
3018
|
-
let batch = this.ssePendingBatches.get(res);
|
|
3019
|
-
if (!batch) {
|
|
3020
|
-
batch = [];
|
|
3021
|
-
this.ssePendingBatches.set(res, batch);
|
|
3022
|
-
}
|
|
3023
|
-
batch.push(event);
|
|
3024
|
-
if (!this.sseBatchTimers.has(res)) {
|
|
3025
|
-
this.sseBatchTimers.set(res, setTimeout(flushBatch, 200));
|
|
3026
|
-
}
|
|
3027
|
-
});
|
|
3028
|
-
const heartbeatInterval = setInterval(() => {
|
|
3029
|
-
writeSSE({ type: "heartbeat" });
|
|
3030
|
-
}, 25e3);
|
|
3031
|
-
const cleanup = () => {
|
|
3032
|
-
clearInterval(heartbeatInterval);
|
|
3033
|
-
const timer = this.sseBatchTimers.get(res);
|
|
3034
|
-
if (timer !== void 0) {
|
|
3035
|
-
clearTimeout(timer);
|
|
3036
|
-
this.sseBatchTimers.delete(res);
|
|
3037
|
-
}
|
|
3038
|
-
this.ssePendingBatches.delete(res);
|
|
3039
|
-
unsubscribe();
|
|
3040
|
-
this.sseClients.delete(res);
|
|
3041
|
-
this.sseCleanupFns.delete(cleanup);
|
|
3042
|
-
try {
|
|
3043
|
-
res.end();
|
|
3044
|
-
} catch {
|
|
3045
|
-
}
|
|
3046
|
-
};
|
|
3047
|
-
this.sseCleanupFns.add(cleanup);
|
|
3048
|
-
req.once("close", cleanup);
|
|
3049
|
-
req.once("error", cleanup);
|
|
3050
|
-
}
|
|
3051
|
-
async handleMcpRequest(req, res, abortSignal) {
|
|
3052
|
-
const headerVersion = req.headers["mcp-protocol-version"];
|
|
3053
|
-
if (typeof headerVersion === "string" && headerVersion.length > 0) {
|
|
3054
|
-
if (!MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(headerVersion)) {
|
|
3055
|
-
this.respondJson(res, 400, {
|
|
3056
|
-
jsonrpc: "2.0",
|
|
3057
|
-
id: null,
|
|
3058
|
-
error: {
|
|
3059
|
-
code: -32e3,
|
|
3060
|
-
message: `unsupported MCP-Protocol-Version: ${headerVersion}; supported: ${MCP_SUPPORTED_PROTOCOL_VERSIONS.join(", ")}`
|
|
3061
|
-
}
|
|
3062
|
-
});
|
|
3063
|
-
return;
|
|
3064
|
-
}
|
|
3065
|
-
}
|
|
3066
|
-
const body = await this.readJsonBody(req);
|
|
3067
|
-
const request = body;
|
|
3068
|
-
const toolName = toDottedRemnicName(typeof request.params?.name === "string" ? request.params.name : "");
|
|
3069
|
-
const toolArgs = request.params?.arguments;
|
|
3070
|
-
const dreamsRunDryRun = (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") && toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && toolArgs.dryRun === true;
|
|
3071
|
-
const memoryActionApplyDryRun = (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply") && toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && toolArgs.dryRun === true;
|
|
3072
|
-
const toolArgsSubcommand = toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && "subcommand" in toolArgs ? toolArgs.subcommand : void 0;
|
|
3073
|
-
const codingDecisionWrite = (toolName === "engram.coding_decision" || toolName === "remnic.coding_decision") && (toolArgsSubcommand === "record" || toolArgsSubcommand === "supersede");
|
|
3074
|
-
const codingArchitectureWrite = (toolName === "engram.coding_architecture" || toolName === "remnic.coding_architecture") && toolArgsSubcommand === "refresh";
|
|
3075
|
-
const CODEGRAPH_WRITE_TOOLS = /* @__PURE__ */ new Set([
|
|
3076
|
-
"engram.codegraph_index",
|
|
3077
|
-
"remnic.codegraph_index",
|
|
3078
|
-
"engram.codegraph_delete_project",
|
|
3079
|
-
"remnic.codegraph_delete_project",
|
|
3080
|
-
"engram.codegraph_ingest_traces",
|
|
3081
|
-
"remnic.codegraph_ingest_traces"
|
|
3082
|
-
]);
|
|
3083
|
-
const isCodegraphManageAdr = toolName === "engram.codegraph_manage_adr" || toolName === "remnic.codegraph_manage_adr";
|
|
3084
|
-
const codegraphWrite = CODEGRAPH_WRITE_TOOLS.has(toolName) || isCodegraphManageAdr && (toolArgsSubcommand === "record" || toolArgsSubcommand === "supersede");
|
|
3085
|
-
const supportPassportQuotaLimitedWrite = this.isSupportPassportQuotaLimitedWriteTool(toolName);
|
|
3086
|
-
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.lcm_compaction_flush" || toolName === "remnic.lcm_compaction_flush" || toolName === "engram.extraction_force_flush" || toolName === "remnic.extraction_force_flush" || toolName === "engram.lcm_compaction_record" || toolName === "remnic.lcm_compaction_record" || toolName === "engram.capsule_export" || toolName === "remnic.capsule_export" || toolName === "engram.capsule_import" || toolName === "remnic.capsule_import" || toolName === "engram.entity_synthesis_run" || toolName === "remnic.entity_synthesis_run" || !dreamsRunDryRun && (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") || !memoryActionApplyDryRun && (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply") || (toolName === "engram.memory_correct_apply" || toolName === "remnic.memory_correct_apply" || toolName === "engram.memory_correct_plan" || toolName === "remnic.memory_correct_plan") || codingDecisionWrite || codingArchitectureWrite || codegraphWrite || supportPassportQuotaLimitedWrite);
|
|
3087
|
-
const observeSelfEnforcesQuota = toolName === "engram.observe" || toolName === "remnic.observe";
|
|
3088
|
-
const extractionForceFlushWrite = toolName === "engram.extraction_force_flush" || toolName === "remnic.extraction_force_flush";
|
|
3089
|
-
let writeRateLimitRecorded = false;
|
|
3090
|
-
let supportPassportQuota;
|
|
3091
|
-
const recordCommittedMcpWrite = extractionForceFlushWrite ? () => {
|
|
3092
|
-
if (writeRateLimitRecorded) return;
|
|
3093
|
-
writeRateLimitRecorded = true;
|
|
3094
|
-
this.recordWriteRateLimitHit(req);
|
|
3095
|
-
} : supportPassportQuotaLimitedWrite ? () => {
|
|
3096
|
-
if (writeRateLimitRecorded) return;
|
|
3097
|
-
writeRateLimitRecorded = true;
|
|
3098
|
-
supportPassportQuota?.commit();
|
|
3099
|
-
supportPassportQuota = void 0;
|
|
3100
|
-
} : void 0;
|
|
3101
|
-
if (isMcpWrite && !observeSelfEnforcesQuota) {
|
|
3102
|
-
if (supportPassportQuotaLimitedWrite) supportPassportQuota = this.reserveWriteRateLimitSlot(req);
|
|
3103
|
-
else this.ensureWriteRateLimitAvailable(req);
|
|
3104
|
-
}
|
|
3105
|
-
const sessionId = (() => {
|
|
3106
|
-
const raw = req.headers["mcp-session-id"];
|
|
3107
|
-
return typeof raw === "string" ? raw.trim() : void 0;
|
|
3108
|
-
})();
|
|
3109
|
-
const mcpCorrelationId = correlationIdStore.getStore() ?? randomUUID();
|
|
3110
|
-
const requestIdentity = this.resolveRequestIdentity(req);
|
|
3111
|
-
if (request.method === "tools/call" && this.mcpServer.toolAcceptsNamespace(toolName)) {
|
|
3112
|
-
const mcpExplicitNamespace = toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && typeof toolArgs.namespace === "string" && toolArgs.namespace.length > 0 ? toolArgs.namespace : void 0;
|
|
3113
|
-
enforceNamespaceAllowList(
|
|
3114
|
-
tokenCapabilityStore.getStore(),
|
|
3115
|
-
mcpExplicitNamespace ?? requestIdentity.namespace,
|
|
3116
|
-
this.service.configRef?.defaultNamespace
|
|
3117
|
-
);
|
|
3118
|
-
}
|
|
3119
|
-
const response = await this.mcpServer.handleRequest(request, {
|
|
3120
|
-
principalOverride: requestIdentity.principal,
|
|
3121
|
-
namespaceOverride: requestIdentity.namespace,
|
|
3122
|
-
sessionKeyOverride: requestIdentity.sessionKey,
|
|
3123
|
-
sessionId,
|
|
3124
|
-
correlationId: mcpCorrelationId,
|
|
3125
|
-
enforceWriteQuota: observeSelfEnforcesQuota ? () => this.ensureWriteRateLimitAvailable(req) : void 0,
|
|
3126
|
-
recordWriteCommit: recordCommittedMcpWrite,
|
|
3127
|
-
sourceConnector: this.resolveConnector(req),
|
|
3128
|
-
abortSignal
|
|
3129
|
-
}).catch((error) => {
|
|
3130
|
-
supportPassportQuota?.release();
|
|
3131
|
-
throw error;
|
|
3132
|
-
});
|
|
3133
|
-
if (isMcpWrite && response !== null) {
|
|
3134
|
-
const result = response.result;
|
|
3135
|
-
const isError = result?.isError === true;
|
|
3136
|
-
const structured = result?.structuredContent;
|
|
3137
|
-
const isRejectedCodegraph = structured?.ok === false;
|
|
3138
|
-
const counts = structured ? this.shouldCountWriteRateLimit(structured) : true;
|
|
3139
|
-
if (!writeRateLimitRecorded && !isError && !isRejectedCodegraph && counts) {
|
|
3140
|
-
if (supportPassportQuota) {
|
|
3141
|
-
supportPassportQuota.commit();
|
|
3142
|
-
supportPassportQuota = void 0;
|
|
3143
|
-
} else {
|
|
3144
|
-
this.recordWriteRateLimitHit(req);
|
|
3145
|
-
}
|
|
3146
|
-
writeRateLimitRecorded = true;
|
|
3147
|
-
}
|
|
3148
|
-
}
|
|
3149
|
-
supportPassportQuota?.release();
|
|
3150
|
-
if (abortSignal.aborted) {
|
|
3151
|
-
throw isAbortError(abortSignal.reason) ? abortSignal.reason : abortError("HTTP client disconnected");
|
|
3152
|
-
}
|
|
3153
|
-
if (response === null) {
|
|
3154
|
-
res.statusCode = 202;
|
|
3155
|
-
res.end();
|
|
3156
|
-
return;
|
|
3157
|
-
}
|
|
3158
|
-
const assignedSessionId = this.mcpServer.popInitSessionId(mcpCorrelationId);
|
|
3159
|
-
if (assignedSessionId) {
|
|
3160
|
-
res.setHeader("mcp-session-id", assignedSessionId);
|
|
3161
|
-
}
|
|
3162
|
-
this.respondJson(res, 200, response);
|
|
3163
|
-
}
|
|
3164
|
-
respondJson(res, status, payload) {
|
|
3165
|
-
const body = JSON.stringify(payload, null, 2);
|
|
3166
|
-
res.statusCode = status;
|
|
3167
|
-
res.setHeader("content-type", "application/json; charset=utf-8");
|
|
3168
|
-
res.setHeader("content-length", String(Buffer.byteLength(body)));
|
|
3169
|
-
const cid = correlationIdStore.getStore();
|
|
3170
|
-
if (cid) {
|
|
3171
|
-
res.setHeader("x-request-id", cid);
|
|
3172
|
-
}
|
|
3173
|
-
res.end(body);
|
|
3174
|
-
}
|
|
3175
|
-
respondBinary(res, status, body, headers = {}) {
|
|
3176
|
-
res.statusCode = status;
|
|
3177
|
-
res.setHeader("content-type", "application/octet-stream");
|
|
3178
|
-
res.setHeader("content-length", String(body.length));
|
|
3179
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
3180
|
-
res.setHeader(key, value);
|
|
3181
|
-
}
|
|
3182
|
-
const cid = correlationIdStore.getStore();
|
|
3183
|
-
if (cid) {
|
|
3184
|
-
res.setHeader("x-request-id", cid);
|
|
3185
|
-
}
|
|
3186
|
-
res.end(body);
|
|
3187
|
-
}
|
|
3188
|
-
async handleAdminConsole(req, res, pathname) {
|
|
3189
|
-
if (req.method !== "GET") return false;
|
|
3190
|
-
if (pathname === "/remnic/ui" || pathname === "/engram/ui") {
|
|
3191
|
-
res.statusCode = 301;
|
|
3192
|
-
res.setHeader("location", pathname + "/");
|
|
3193
|
-
res.end();
|
|
3194
|
-
return true;
|
|
3195
|
-
}
|
|
3196
|
-
if (pathname === "/remnic/ui/relay" || pathname === "/engram/ui/relay") {
|
|
3197
|
-
res.statusCode = 301;
|
|
3198
|
-
res.setHeader("location", pathname + "/");
|
|
3199
|
-
res.end();
|
|
3200
|
-
return true;
|
|
3201
|
-
}
|
|
3202
|
-
if (pathname === "/remnic/ui/" || pathname === "/engram/ui/") {
|
|
3203
|
-
await this.respondAdminConsoleShell(req, res, pathname);
|
|
3204
|
-
return true;
|
|
3205
|
-
}
|
|
3206
|
-
if (pathname === "/remnic/ui/relay/" || pathname === "/engram/ui/relay/") {
|
|
3207
|
-
await this.respondAdminConsoleShell(req, res, pathname, "relay/index.html");
|
|
3208
|
-
return true;
|
|
3209
|
-
}
|
|
3210
|
-
if (pathname === "/remnic/ui/app.js" || pathname === "/engram/ui/app.js") {
|
|
3211
|
-
await this.respondStatic(res, path2.join(this.adminConsolePublicDir, "app.js"), "application/javascript; charset=utf-8");
|
|
3212
|
-
return true;
|
|
3213
|
-
}
|
|
3214
|
-
const relayAsset = RELAY_ADMIN_CONSOLE_ASSETS.get(pathname.split("/").at(-1) ?? "");
|
|
3215
|
-
const isRelayAsset = pathname.startsWith("/remnic/ui/relay/") || pathname.startsWith("/engram/ui/relay/");
|
|
3216
|
-
if (isRelayAsset && relayAsset && pathname.split("/").length === 5) {
|
|
3217
|
-
const fileName = pathname.split("/").at(-1);
|
|
3218
|
-
if (fileName) {
|
|
3219
|
-
await this.respondStatic(res, path2.join(this.adminConsolePublicDir, "relay", fileName), relayAsset);
|
|
3220
|
-
return true;
|
|
3221
|
-
}
|
|
3222
|
-
}
|
|
3223
|
-
return false;
|
|
3224
|
-
}
|
|
3225
|
-
async respondAdminConsoleShell(req, res, pathname, relativePath = "index.html", allowPrefill = true) {
|
|
3226
|
-
try {
|
|
3227
|
-
let body = await readFile(path2.join(this.adminConsolePublicDir, relativePath), "utf-8");
|
|
3228
|
-
const matched = this.resolveAuthorizedEntry(req, pathname);
|
|
3229
|
-
const canPrefillToken = allowPrefill && this.adminConsolePrefillToken && matched !== null && matched.capabilities === void 0 && this.timingSafeStringEqual(matched.token, this.adminConsolePrefillToken);
|
|
3230
|
-
if (canPrefillToken) {
|
|
3231
|
-
const serializedToken = serializeInlineScriptValue(this.adminConsolePrefillToken);
|
|
3232
|
-
const script = `<script>(function(token,script){const key="__REMNIC_ADMIN_CONSOLE_PREFILL_TOKEN__";const clear=function(){token="";try{delete window[key]}catch{window[key]=""}};window.addEventListener("pagehide",clear,{once:true});window.addEventListener("beforeunload",clear,{once:true});try{if(new URLSearchParams(location.hash.slice(1)).has("secret")){clear();return}Object.defineProperty(window,key,{configurable:true,get:function(){const value=token;clear();return value}})}finally{if(script){script.textContent="";script.remove()}}})(${serializedToken},document.currentScript);</script>`;
|
|
3233
|
-
body = body.includes("</head>") ? body.replace("</head>", `${script}</head>`) : `${script}${body}`;
|
|
3234
|
-
res.setHeader("cache-control", "private, no-store");
|
|
3235
|
-
}
|
|
3236
|
-
res.setHeader("vary", "authorization");
|
|
3237
|
-
res.statusCode = 200;
|
|
3238
|
-
res.setHeader("content-type", "text/html; charset=utf-8");
|
|
3239
|
-
res.setHeader("content-length", String(Buffer.byteLength(body)));
|
|
3240
|
-
res.end(body);
|
|
3241
|
-
} catch {
|
|
3242
|
-
this.respondJson(res, 404, { error: "not_found" });
|
|
3243
|
-
}
|
|
3244
|
-
}
|
|
3245
|
-
async respondStatic(res, filePath, contentType) {
|
|
3246
|
-
try {
|
|
3247
|
-
const body = await readFile(filePath, "utf-8");
|
|
3248
|
-
res.statusCode = 200;
|
|
3249
|
-
res.setHeader("content-type", contentType);
|
|
3250
|
-
res.setHeader("content-length", String(Buffer.byteLength(body)));
|
|
3251
|
-
res.end(body);
|
|
3252
|
-
} catch {
|
|
3253
|
-
this.respondJson(res, 404, { error: "not_found" });
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
async readJsonBody(req, maxBodyBytes = this.maxBodyBytes) {
|
|
3257
|
-
const encoding = (this.readOptionalHeader(req, "content-encoding") ?? "identity").toLowerCase();
|
|
3258
|
-
if (encoding !== "identity" && encoding !== "gzip") {
|
|
3259
|
-
throw new HttpError(415, "unsupported_content_encoding", "unsupported_content_encoding");
|
|
3260
|
-
}
|
|
3261
|
-
const chunks = [];
|
|
3262
|
-
let total = 0;
|
|
3263
|
-
for await (const chunk of req) {
|
|
3264
|
-
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
3265
|
-
total += buffer.length;
|
|
3266
|
-
if (total > maxBodyBytes) {
|
|
3267
|
-
throw new HttpError(413, "request_body_too_large", "request_body_too_large");
|
|
3268
|
-
}
|
|
3269
|
-
chunks.push(buffer);
|
|
3270
|
-
}
|
|
3271
|
-
if (chunks.length === 0) return {};
|
|
3272
|
-
let body = Buffer.concat(chunks, total);
|
|
3273
|
-
if (encoding === "gzip") {
|
|
3274
|
-
try {
|
|
3275
|
-
body = gunzipSync(body, { maxOutputLength: maxBodyBytes });
|
|
3276
|
-
} catch (error) {
|
|
3277
|
-
if (error.code === "ERR_BUFFER_TOO_LARGE") {
|
|
3278
|
-
throw new HttpError(413, "request_body_too_large", "request_body_too_large");
|
|
3279
|
-
}
|
|
3280
|
-
throw new HttpError(400, "invalid_gzip_body", "invalid_gzip_body");
|
|
3281
|
-
}
|
|
3282
|
-
if (body.byteLength > maxBodyBytes) {
|
|
3283
|
-
throw new HttpError(413, "request_body_too_large", "request_body_too_large");
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
const raw = body.toString("utf-8").trim();
|
|
3287
|
-
if (raw.length === 0) return {};
|
|
3288
|
-
let parsed;
|
|
3289
|
-
try {
|
|
3290
|
-
parsed = JSON.parse(raw);
|
|
3291
|
-
} catch {
|
|
3292
|
-
throw new HttpError(400, "invalid_json", "invalid_json");
|
|
3293
|
-
}
|
|
3294
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
3295
|
-
throw new HttpError(400, "invalid_json_object", "invalid_json_object");
|
|
3296
|
-
}
|
|
3297
|
-
return parsed;
|
|
3298
|
-
}
|
|
3299
|
-
async readBinaryBody(req, maxBytes) {
|
|
3300
|
-
const chunks = [];
|
|
3301
|
-
let total = 0;
|
|
3302
|
-
for await (const chunk of req) {
|
|
3303
|
-
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
3304
|
-
total += buffer.length;
|
|
3305
|
-
if (total > maxBytes) {
|
|
3306
|
-
throw new HttpError(413, "request_body_too_large", "request_body_too_large");
|
|
3307
|
-
}
|
|
3308
|
-
chunks.push(buffer);
|
|
3309
|
-
}
|
|
3310
|
-
return Buffer.concat(chunks, total);
|
|
3311
|
-
}
|
|
3312
|
-
readRequiredHeader(req, name) {
|
|
3313
|
-
const value = this.readOptionalHeader(req, name);
|
|
3314
|
-
if (value === void 0 || value.length === 0) {
|
|
3315
|
-
throw new EngramAccessInputError(`${name} header is required`);
|
|
3316
|
-
}
|
|
3317
|
-
return value;
|
|
3318
|
-
}
|
|
3319
|
-
readOptionalHeader(req, name) {
|
|
3320
|
-
const raw = req.headers[name.toLowerCase()];
|
|
3321
|
-
if (Array.isArray(raw)) return raw[0]?.trim() || void 0;
|
|
3322
|
-
return raw?.trim() || void 0;
|
|
3323
|
-
}
|
|
3324
|
-
readRequiredDecodedHeader(req, name) {
|
|
3325
|
-
const raw = this.readRequiredHeader(req, name);
|
|
3326
|
-
try {
|
|
3327
|
-
return decodeURIComponent(raw);
|
|
3328
|
-
} catch {
|
|
3329
|
-
throw new EngramAccessInputError(`${name} header is not valid percent-encoded input`);
|
|
3330
|
-
}
|
|
3331
|
-
}
|
|
3332
|
-
readRequiredIntegerHeader(req, name) {
|
|
3333
|
-
const raw = this.readRequiredHeader(req, name);
|
|
3334
|
-
const parsed = Number(raw);
|
|
3335
|
-
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
3336
|
-
throw new EngramAccessInputError(`${name} header must be a non-negative integer`);
|
|
3337
|
-
}
|
|
3338
|
-
return parsed;
|
|
3339
|
-
}
|
|
3340
|
-
readOptionalIntegerHeader(req, name) {
|
|
3341
|
-
const raw = this.readOptionalHeader(req, name);
|
|
3342
|
-
if (raw === void 0) return void 0;
|
|
3343
|
-
const parsed = Number(raw);
|
|
3344
|
-
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
3345
|
-
throw new EngramAccessInputError(`${name} header must be a non-negative integer`);
|
|
3346
|
-
}
|
|
3347
|
-
return parsed;
|
|
3348
|
-
}
|
|
3349
|
-
readRequiredNumberHeader(req, name) {
|
|
3350
|
-
const raw = this.readRequiredHeader(req, name);
|
|
3351
|
-
const parsed = Number(raw);
|
|
3352
|
-
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
3353
|
-
throw new EngramAccessInputError(`${name} header must be a non-negative finite number`);
|
|
3354
|
-
}
|
|
3355
|
-
return parsed;
|
|
3356
|
-
}
|
|
3357
|
-
parseOptionalBooleanHeader(req, name, defaultValue) {
|
|
3358
|
-
const raw = this.readOptionalHeader(req, name);
|
|
3359
|
-
if (raw === void 0) return defaultValue;
|
|
3360
|
-
if (raw === "true") return true;
|
|
3361
|
-
if (raw === "false") return false;
|
|
3362
|
-
throw new EngramAccessInputError(`${name} header must be one of: true, false`);
|
|
3363
|
-
}
|
|
3364
|
-
lifecycleFlushDeps(req, res) {
|
|
3365
|
-
const readValidatedBody = ((schemaName) => this.readValidatedBody(req, schemaName));
|
|
3366
|
-
return {
|
|
3367
|
-
service: this.service,
|
|
3368
|
-
defaultNamespace: this.service.configRef?.defaultNamespace,
|
|
3369
|
-
enforceTokenOp: (op) => this.enforceTokenOp(op),
|
|
3370
|
-
readValidatedBody,
|
|
3371
|
-
ensureWriteRateLimitAvailable: () => this.ensureWriteRateLimitAvailable(req),
|
|
3372
|
-
resolveNamespace: (namespace) => this.resolveNamespace(req, namespace),
|
|
3373
|
-
resolveRequestPrincipal: () => this.resolveRequestPrincipal(req),
|
|
3374
|
-
recordWriteRateLimitHit: () => this.recordWriteRateLimitHit(req),
|
|
3375
|
-
respondJson: (payload) => this.respondJson(res, 200, payload)
|
|
3376
|
-
};
|
|
3377
|
-
}
|
|
3378
|
-
async readValidatedBody(req, schemaName, maxBodyBytes) {
|
|
3379
|
-
const raw = await this.readJsonBody(req, maxBodyBytes);
|
|
3380
|
-
const result = validateRequest(schemaName, raw);
|
|
3381
|
-
if (!result.success) {
|
|
3382
|
-
throw new HttpError(400, result.error.error, "validation_error", result.error.details);
|
|
3383
|
-
}
|
|
3384
|
-
return result.data;
|
|
3385
|
-
}
|
|
3386
|
-
/**
|
|
3387
|
-
* Build the WWW-Authenticate challenge string for 401 responses.
|
|
3388
|
-
* When `resourceMetadataUrl` is configured, includes the RFC 9728
|
|
3389
|
-
* `resource_metadata` parameter so MCP clients (e.g. ChatGPT) can
|
|
3390
|
-
* discover the OAuth 2.0 protected-resource metadata document.
|
|
3391
|
-
* Otherwise the bare `Bearer` challenge is returned (unchanged).
|
|
3392
|
-
*/
|
|
3393
|
-
bearerChallenge() {
|
|
3394
|
-
if (this.resourceMetadataUrl) {
|
|
3395
|
-
return `Bearer resource_metadata="${this.resourceMetadataUrl}"`;
|
|
3396
|
-
}
|
|
3397
|
-
return "Bearer";
|
|
3398
|
-
}
|
|
3399
|
-
isAuthorized(req, pathname) {
|
|
3400
|
-
return this.resolveAuthorizedEntry(req, pathname) !== null;
|
|
3401
|
-
}
|
|
3402
|
-
/**
|
|
3403
|
-
* Per-request cache of the matched token entry (the entry whose token
|
|
3404
|
-
* matched the bearer credential, BEFORE any path-policy check). Pinning
|
|
3405
|
-
* the entry to the first read means authorization, capability
|
|
3406
|
-
* enforcement, and connector provenance all observe the SAME token-store
|
|
3407
|
-
* snapshot — a rotation between the auth check and the write handler can
|
|
3408
|
-
* no longer stamp the wrong connector (PR #1852 race).
|
|
3409
|
-
*/
|
|
3410
|
-
matchedEntryCache = /* @__PURE__ */ new WeakMap();
|
|
3411
|
-
/**
|
|
3412
|
-
* Resolve the matched token entry for this request, caching the result so
|
|
3413
|
-
* every downstream consumer (authorization, capability enforcement,
|
|
3414
|
-
* connector provenance) sees the same snapshot entry (PR #1852).
|
|
3415
|
-
*/
|
|
3416
|
-
resolveMatchedEntry(req, pathname) {
|
|
3417
|
-
if (this.matchedEntryCache.has(req)) {
|
|
3418
|
-
return this.matchedEntryCache.get(req) ?? null;
|
|
3419
|
-
}
|
|
3420
|
-
const entry = this.computeMatchedEntry(req, pathname);
|
|
3421
|
-
this.matchedEntryCache.set(req, entry);
|
|
3422
|
-
return entry;
|
|
3423
|
-
}
|
|
3424
|
-
/**
|
|
3425
|
-
* Find the entry whose token matches the request's bearer credential.
|
|
3426
|
-
* Static operator tokens (`authToken`/`authTokens`) and the string-token
|
|
3427
|
-
* getter carry no capabilities ⇒ unrestricted. Dynamic entry-based tokens
|
|
3428
|
-
* capture connector identity and capabilities. A corrupt or unreadable
|
|
3429
|
-
* token store returns null rather than propagating an error — provenance
|
|
3430
|
-
* must never block an already-authenticated request.
|
|
3431
|
-
*/
|
|
3432
|
-
computeMatchedEntry(req, pathname) {
|
|
3433
|
-
if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter && !this.authTokenEntriesGetter) {
|
|
3434
|
-
return null;
|
|
3435
|
-
}
|
|
3436
|
-
const raw = req.headers.authorization;
|
|
3437
|
-
let candidate = null;
|
|
3438
|
-
if (raw) {
|
|
3439
|
-
const separator = raw.indexOf(" ");
|
|
3440
|
-
if (separator > 0) {
|
|
3441
|
-
const scheme = raw.slice(0, separator).toLowerCase();
|
|
3442
|
-
if (scheme === "bearer") {
|
|
3443
|
-
candidate = raw.slice(separator + 1).trim();
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
|
-
if (!candidate && pathname === "/engram/v1/graph/events") {
|
|
3448
|
-
try {
|
|
3449
|
-
const parsed = new URL2(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
|
|
3450
|
-
const queryToken = parsed.searchParams.get("token");
|
|
3451
|
-
if (queryToken && queryToken.length > 0) {
|
|
3452
|
-
candidate = queryToken;
|
|
3453
|
-
}
|
|
3454
|
-
} catch {
|
|
3455
|
-
}
|
|
3456
|
-
}
|
|
3457
|
-
if (!candidate) return null;
|
|
3458
|
-
const token = candidate;
|
|
3459
|
-
if (this.authToken && this.timingSafeStringEqual(token, this.authToken)) {
|
|
3460
|
-
return { token };
|
|
3461
|
-
}
|
|
3462
|
-
for (const valid of this.authTokens) {
|
|
3463
|
-
if (this.timingSafeStringEqual(token, valid)) return { token: valid };
|
|
3464
|
-
}
|
|
3465
|
-
if (this.authTokenEntriesGetter) {
|
|
3466
|
-
try {
|
|
3467
|
-
for (const entry of this.authTokenEntriesGetter()) {
|
|
3468
|
-
if (!this.timingSafeStringEqual(token, entry.token)) continue;
|
|
3469
|
-
return { token: entry.token, connector: entry.connector, capabilities: entry.capabilities };
|
|
3470
|
-
}
|
|
3471
|
-
} catch {
|
|
3472
|
-
}
|
|
3473
|
-
return null;
|
|
3474
|
-
}
|
|
3475
|
-
if (this.authTokensGetter) {
|
|
3476
|
-
for (const valid of this.authTokensGetter()) {
|
|
3477
|
-
if (this.timingSafeStringEqual(token, valid)) return { token: valid };
|
|
3478
|
-
}
|
|
3479
|
-
}
|
|
3480
|
-
return null;
|
|
3481
|
-
}
|
|
3482
|
-
/**
|
|
3483
|
-
* Resolve the presenting token's entry for an authorized request, or null.
|
|
3484
|
-
* Applies the path-policy gate (if configured) on top of the per-request
|
|
3485
|
-
* cached matched entry so the identity that is authorized is the same one
|
|
3486
|
-
* whose connector later stamps frontmatter. Static operator tokens and the
|
|
3487
|
-
* string-token getter carry no capabilities ⇒ unrestricted.
|
|
3488
|
-
*/
|
|
3489
|
-
resolveAuthorizedEntry(req, pathname) {
|
|
3490
|
-
const matched = this.resolveMatchedEntry(req, pathname);
|
|
3491
|
-
if (!matched) return null;
|
|
3492
|
-
if ("connector" in matched && this.tokenPathPolicy) {
|
|
3493
|
-
if (typeof matched.connector !== "string" || matched.connector.length === 0) return null;
|
|
3494
|
-
return this.tokenPathPolicy(matched.connector, pathname) ? matched : null;
|
|
3495
|
-
}
|
|
3496
|
-
return matched;
|
|
3497
|
-
}
|
|
3498
|
-
/**
|
|
3499
|
-
* Resolve the presenting token's capabilities for this request, or
|
|
3500
|
-
* undefined when the token is unrestricted (legacy / static operator /
|
|
3501
|
-
* explicit-unrestricted record). Reads from the per-request cached matched
|
|
3502
|
-
* entry so capabilities come from the same snapshot as authorization and
|
|
3503
|
-
* connector provenance (PR #1852).
|
|
3504
|
-
*/
|
|
3505
|
-
resolveTokenCapabilities(req, pathname) {
|
|
3506
|
-
return this.resolveMatchedEntry(req, pathname)?.capabilities;
|
|
3507
|
-
}
|
|
3508
|
-
/**
|
|
3509
|
-
* Enforce the presenting token's ops allow-list for an HTTP route that
|
|
3510
|
-
* dispatches directly to the service (not through the boundary). Reads the
|
|
3511
|
-
* per-request capability context set in `handle`; unrestricted tokens
|
|
3512
|
-
* pass. Throws {@link EngramAccessForbiddenError} (→ 403) when a scoped
|
|
3513
|
-
* token calls a non-permitted op (issue #1837).
|
|
3514
|
-
*/
|
|
3515
|
-
enforceTokenOp(op) {
|
|
3516
|
-
void getOperation(op);
|
|
3517
|
-
assertOperationAllowed(tokenCapabilityStore.getStore(), op);
|
|
3518
|
-
}
|
|
3519
|
-
enforceTokenAnyOf(ops) {
|
|
3520
|
-
for (const op of ops) void getOperation(op);
|
|
3521
|
-
const capabilities = tokenCapabilityStore.getStore();
|
|
3522
|
-
if (ops.some((op) => capabilityAllowsOp(capabilities, op))) return;
|
|
3523
|
-
throw new EngramAccessForbiddenError(
|
|
3524
|
-
`token is not permitted to call any required operation: ${ops.join(", ")}`
|
|
3525
|
-
);
|
|
3526
|
-
}
|
|
3527
|
-
/**
|
|
3528
|
-
* Operator/admin routes are unrestricted-only surfaces: a scoped
|
|
3529
|
-
* (least-privileged) token must NOT reach them (issue #1837). Legacy and
|
|
3530
|
-
* explicit-unrestricted tokens pass. Throws EngramAccessForbiddenError (→403).
|
|
3531
|
-
*/
|
|
3532
|
-
requireOperatorToken() {
|
|
3533
|
-
if (isCapabilityRestricted(tokenCapabilityStore.getStore())) {
|
|
3534
|
-
throw new EngramAccessForbiddenError(
|
|
3535
|
-
"token is scoped and may not access operator/admin routes"
|
|
3536
|
-
);
|
|
3537
|
-
}
|
|
3538
|
-
}
|
|
3539
|
-
/**
|
|
3540
|
-
* Resolve the connector identity for the request's bearer token (Phase 1
|
|
3541
|
-
* provenance). Reuses the per-request cached matched entry so a token
|
|
3542
|
-
* rotation between the auth check and the write handler cannot stamp the
|
|
3543
|
-
* wrong connector (PR #1852 race). Returns `undefined` for operator-
|
|
3544
|
-
* supplied static tokens or when no entry getter is configured — those
|
|
3545
|
-
* writes are operator-initiated.
|
|
3546
|
-
*/
|
|
3547
|
-
resolveConnector(req) {
|
|
3548
|
-
return this.resolveMatchedEntry(req)?.connector;
|
|
3549
|
-
}
|
|
3550
|
-
timingSafeStringEqual(a, b) {
|
|
3551
|
-
const left = this.encodeSecret(a);
|
|
3552
|
-
const right = this.encodeSecret(b);
|
|
3553
|
-
if (!left || !right) return false;
|
|
3554
|
-
return timingSafeEqual(left, right);
|
|
3555
|
-
}
|
|
3556
|
-
encodeSecret(value) {
|
|
3557
|
-
const encoded = Buffer.from(value, "utf-8");
|
|
3558
|
-
if (encoded.length > 1024) return null;
|
|
3559
|
-
const out = Buffer.alloc(2 + 1024);
|
|
3560
|
-
out.writeUInt16BE(encoded.length, 0);
|
|
3561
|
-
encoded.copy(out, 2);
|
|
3562
|
-
return out;
|
|
3563
|
-
}
|
|
3564
|
-
writeResponseStatus(response) {
|
|
3565
|
-
if (response.dryRun === true) return 200;
|
|
3566
|
-
if (response.status === "stored" || response.status === "queued_for_review") return 201;
|
|
3567
|
-
return 200;
|
|
3568
|
-
}
|
|
3569
|
-
ensureWriteRateLimitAvailable(req) {
|
|
3570
|
-
if (!this.writeLimiter.hasCapacity(this.principalForRateLimit(req))) {
|
|
3571
|
-
throw new HttpError(429, "write_rate_limited", "write_rate_limited");
|
|
3572
|
-
}
|
|
3573
|
-
}
|
|
3574
|
-
recordWriteRateLimitHit(req) {
|
|
3575
|
-
this.writeLimiter.record(this.principalForRateLimit(req));
|
|
3576
|
-
}
|
|
3577
|
-
reserveWriteRateLimitSlot(req) {
|
|
3578
|
-
const reservation = this.writeLimiter.reserve(this.principalForRateLimit(req));
|
|
3579
|
-
if (!reservation) {
|
|
3580
|
-
throw new HttpError(429, "write_rate_limited", "write_rate_limited");
|
|
3581
|
-
}
|
|
3582
|
-
return reservation;
|
|
3583
|
-
}
|
|
3584
|
-
principalForRateLimit(req) {
|
|
3585
|
-
if (!req) return void 0;
|
|
3586
|
-
return this.resolveRequestPrincipal(req) ?? this.resolveConnector(req);
|
|
3587
|
-
}
|
|
3588
|
-
shouldCountWriteRateLimit(response) {
|
|
3589
|
-
return response.dryRun !== true && response.idempotencyReplay !== true;
|
|
3590
|
-
}
|
|
3591
|
-
/** Map wearables validation errors to 400 (body lives in wearables/http-glue.ts). */
|
|
3592
|
-
respondWearablesError(res, err) {
|
|
3593
|
-
return respondWearablesErrorGlue(this.respondJson.bind(this), res, err);
|
|
3594
|
-
}
|
|
3595
|
-
};
|
|
3596
|
-
|
|
3597
|
-
export {
|
|
3598
|
-
MeetingsInputError,
|
|
3599
|
-
resolveDefaultAdminConsolePublicDir,
|
|
3600
|
-
EngramAccessHttpServer
|
|
3601
|
-
};
|
|
3602
|
-
//# sourceMappingURL=chunk-IYNCJKBM.js.map
|