@atomicmemory/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/LICENSE +201 -0
- package/README.md +314 -0
- package/dist/app/bind-ephemeral.d.ts +18 -0
- package/dist/app/bind-ephemeral.js +22 -0
- package/dist/app/cors-headers.d.ts +12 -0
- package/dist/app/cors-headers.js +18 -0
- package/dist/app/create-app.d.ts +25 -0
- package/dist/app/create-app.js +156 -0
- package/dist/app/runtime-config-route-snapshot.d.ts +27 -0
- package/dist/app/runtime-config-route-snapshot.js +27 -0
- package/dist/app/runtime-container.d.ts +281 -0
- package/dist/app/runtime-container.js +297 -0
- package/dist/app/startup-checks.d.ts +28 -0
- package/dist/app/startup-checks.js +45 -0
- package/dist/bin.d.ts +17 -0
- package/dist/bin.js +128 -0
- package/dist/config.d.ts +680 -0
- package/dist/config.js +808 -0
- package/dist/db/agent-trust-repository.d.ts +49 -0
- package/dist/db/agent-trust-repository.js +66 -0
- package/dist/db/belief-edges-repository.d.ts +68 -0
- package/dist/db/belief-edges-repository.js +124 -0
- package/dist/db/claim-repository.d.ts +6 -0
- package/dist/db/claim-repository.js +4 -0
- package/dist/db/contradictions-repository.d.ts +56 -0
- package/dist/db/contradictions-repository.js +88 -0
- package/dist/db/document-chunk-repository.d.ts +48 -0
- package/dist/db/document-chunk-repository.js +145 -0
- package/dist/db/document-chunk-types.d.ts +35 -0
- package/dist/db/document-chunk-types.js +9 -0
- package/dist/db/document-list-cursor.d.ts +45 -0
- package/dist/db/document-list-cursor.js +111 -0
- package/dist/db/document-list-repository.d.ts +103 -0
- package/dist/db/document-list-repository.js +204 -0
- package/dist/db/entity-cards-repository.d.ts +37 -0
- package/dist/db/entity-cards-repository.js +46 -0
- package/dist/db/entity-values-repository.d.ts +26 -0
- package/dist/db/entity-values-repository.js +57 -0
- package/dist/db/link-repository.d.ts +30 -0
- package/dist/db/link-repository.js +54 -0
- package/dist/db/memory-repository.d.ts +163 -0
- package/dist/db/memory-repository.js +232 -0
- package/dist/db/migrate.d.ts +6 -0
- package/dist/db/migrate.js +36 -0
- package/dist/db/mmr.d.ts +14 -0
- package/dist/db/mmr.js +57 -0
- package/dist/db/passport-feed-repository.d.ts +91 -0
- package/dist/db/passport-feed-repository.js +198 -0
- package/dist/db/pg-episode-store.d.ts +19 -0
- package/dist/db/pg-episode-store.js +17 -0
- package/dist/db/pg-link-store.d.ts +17 -0
- package/dist/db/pg-link-store.js +14 -0
- package/dist/db/pg-memory-store.d.ts +68 -0
- package/dist/db/pg-memory-store.js +53 -0
- package/dist/db/pg-recap-store.d.ts +13 -0
- package/dist/db/pg-recap-store.js +19 -0
- package/dist/db/pg-representation-store.d.ts +17 -0
- package/dist/db/pg-representation-store.js +17 -0
- package/dist/db/pg-search-store.d.ts +29 -0
- package/dist/db/pg-search-store.js +47 -0
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +21 -0
- package/dist/db/ppr.d.ts +56 -0
- package/dist/db/ppr.js +178 -0
- package/dist/db/query-helpers.d.ts +44 -0
- package/dist/db/query-helpers.js +60 -0
- package/dist/db/raw-doc-artifact-sync.d.ts +128 -0
- package/dist/db/raw-doc-artifact-sync.js +259 -0
- package/dist/db/raw-document-blob-repository.d.ts +148 -0
- package/dist/db/raw-document-blob-repository.js +300 -0
- package/dist/db/raw-document-repository.d.ts +104 -0
- package/dist/db/raw-document-repository.js +410 -0
- package/dist/db/raw-document-status-repository.d.ts +122 -0
- package/dist/db/raw-document-status-repository.js +183 -0
- package/dist/db/raw-document-types.d.ts +236 -0
- package/dist/db/raw-document-types.js +10 -0
- package/dist/db/raw-storage-reconciliation-repository.d.ts +110 -0
- package/dist/db/raw-storage-reconciliation-repository.js +200 -0
- package/dist/db/reflection-jobs-repository.d.ts +33 -0
- package/dist/db/reflection-jobs-repository.js +48 -0
- package/dist/db/reflections-repository.d.ts +41 -0
- package/dist/db/reflections-repository.js +83 -0
- package/dist/db/repository-claims.d.ts +141 -0
- package/dist/db/repository-claims.js +376 -0
- package/dist/db/repository-deferred-audn.d.ts +33 -0
- package/dist/db/repository-deferred-audn.js +69 -0
- package/dist/db/repository-document-delete.d.ts +53 -0
- package/dist/db/repository-document-delete.js +156 -0
- package/dist/db/repository-entities.d.ts +114 -0
- package/dist/db/repository-entities.js +317 -0
- package/dist/db/repository-entity-attributes.d.ts +41 -0
- package/dist/db/repository-entity-attributes.js +65 -0
- package/dist/db/repository-entity-graph.d.ts +32 -0
- package/dist/db/repository-entity-graph.js +87 -0
- package/dist/db/repository-first-mentions.d.ts +41 -0
- package/dist/db/repository-first-mentions.js +79 -0
- package/dist/db/repository-lessons.d.ts +51 -0
- package/dist/db/repository-lessons.js +90 -0
- package/dist/db/repository-links.d.ts +26 -0
- package/dist/db/repository-links.js +105 -0
- package/dist/db/repository-observation.d.ts +26 -0
- package/dist/db/repository-observation.js +51 -0
- package/dist/db/repository-read.d.ts +56 -0
- package/dist/db/repository-read.js +271 -0
- package/dist/db/repository-recaps.d.ts +59 -0
- package/dist/db/repository-recaps.js +158 -0
- package/dist/db/repository-representations.d.ts +48 -0
- package/dist/db/repository-representations.js +162 -0
- package/dist/db/repository-temporal-state.d.ts +35 -0
- package/dist/db/repository-temporal-state.js +46 -0
- package/dist/db/repository-tll.d.ts +88 -0
- package/dist/db/repository-tll.js +179 -0
- package/dist/db/repository-types.d.ts +313 -0
- package/dist/db/repository-types.js +142 -0
- package/dist/db/repository-user-profiles.d.ts +17 -0
- package/dist/db/repository-user-profiles.js +28 -0
- package/dist/db/repository-vector-search.d.ts +33 -0
- package/dist/db/repository-vector-search.js +373 -0
- package/dist/db/repository-wipe.d.ts +34 -0
- package/dist/db/repository-wipe.js +94 -0
- package/dist/db/repository-write.d.ts +61 -0
- package/dist/db/repository-write.js +279 -0
- package/dist/db/schema.sql +1355 -0
- package/dist/db/storage-artifact-delete-tx.d.ts +56 -0
- package/dist/db/storage-artifact-delete-tx.js +123 -0
- package/dist/db/storage-artifact-providers.d.ts +21 -0
- package/dist/db/storage-artifact-providers.js +21 -0
- package/dist/db/storage-artifact-recovery-repository.d.ts +66 -0
- package/dist/db/storage-artifact-recovery-repository.js +58 -0
- package/dist/db/storage-artifact-repository.d.ts +329 -0
- package/dist/db/storage-artifact-repository.js +497 -0
- package/dist/db/stores.d.ts +220 -0
- package/dist/db/stores.js +12 -0
- package/dist/db/summaries-repository.d.ts +74 -0
- package/dist/db/summaries-repository.js +125 -0
- package/dist/eval/beam-10m-loader.d.ts +98 -0
- package/dist/eval/beam-10m-loader.js +128 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +17 -0
- package/dist/middleware/require-bearer.d.ts +27 -0
- package/dist/middleware/require-bearer.js +60 -0
- package/dist/middleware/validate-response.d.ts +33 -0
- package/dist/middleware/validate-response.js +55 -0
- package/dist/middleware/validate.d.ts +43 -0
- package/dist/middleware/validate.js +85 -0
- package/dist/routes/agents.d.ts +13 -0
- package/dist/routes/agents.js +89 -0
- package/dist/routes/document-response-formatters.d.ts +98 -0
- package/dist/routes/document-response-formatters.js +243 -0
- package/dist/routes/documents.d.ts +74 -0
- package/dist/routes/documents.js +425 -0
- package/dist/routes/memories.d.ts +29 -0
- package/dist/routes/memories.js +725 -0
- package/dist/routes/memory-response-formatters.d.ts +179 -0
- package/dist/routes/memory-response-formatters.js +210 -0
- package/dist/routes/public-raw-storage-metadata.d.ts +54 -0
- package/dist/routes/public-raw-storage-metadata.js +56 -0
- package/dist/routes/reflect.d.ts +14 -0
- package/dist/routes/reflect.js +19 -0
- package/dist/routes/response-schema-map.d.ts +14 -0
- package/dist/routes/response-schema-map.js +69 -0
- package/dist/routes/route-errors.d.ts +12 -0
- package/dist/routes/route-errors.js +30 -0
- package/dist/routes/storage-error-handlers.d.ts +34 -0
- package/dist/routes/storage-error-handlers.js +185 -0
- package/dist/routes/storage-response-formatters.d.ts +44 -0
- package/dist/routes/storage-response-formatters.js +155 -0
- package/dist/routes/storage.d.ts +38 -0
- package/dist/routes/storage.js +369 -0
- package/dist/routes/upstream-provider-errors.d.ts +19 -0
- package/dist/routes/upstream-provider-errors.js +95 -0
- package/dist/schemas/agents.d.ts +79 -0
- package/dist/schemas/agents.js +126 -0
- package/dist/schemas/common.d.ts +110 -0
- package/dist/schemas/common.js +190 -0
- package/dist/schemas/document-list-responses.d.ts +102 -0
- package/dist/schemas/document-list-responses.js +87 -0
- package/dist/schemas/document-list-schemas.d.ts +123 -0
- package/dist/schemas/document-list-schemas.js +174 -0
- package/dist/schemas/document-response-schemas.d.ts +610 -0
- package/dist/schemas/document-response-schemas.js +264 -0
- package/dist/schemas/document-status-envelope.d.ts +48 -0
- package/dist/schemas/document-status-envelope.js +54 -0
- package/dist/schemas/documents.d.ts +292 -0
- package/dist/schemas/documents.js +449 -0
- package/dist/schemas/errors.d.ts +75 -0
- package/dist/schemas/errors.js +105 -0
- package/dist/schemas/memories.d.ts +378 -0
- package/dist/schemas/memories.js +542 -0
- package/dist/schemas/openapi.d.ts +24 -0
- package/dist/schemas/openapi.js +1038 -0
- package/dist/schemas/response-scalars.d.ts +10 -0
- package/dist/schemas/response-scalars.js +10 -0
- package/dist/schemas/responses.d.ts +536 -0
- package/dist/schemas/responses.js +350 -0
- package/dist/schemas/search-response-parts.d.ts +97 -0
- package/dist/schemas/search-response-parts.js +103 -0
- package/dist/schemas/storage-schemas.d.ts +175 -0
- package/dist/schemas/storage-schemas.js +277 -0
- package/dist/schemas/zod-setup.d.ts +15 -0
- package/dist/schemas/zod-setup.js +17 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.js +57 -0
- package/dist/services/abstract-query-policy.d.ts +13 -0
- package/dist/services/abstract-query-policy.js +50 -0
- package/dist/services/affinity-clustering.d.ts +66 -0
- package/dist/services/affinity-clustering.js +125 -0
- package/dist/services/agentic-retrieval.d.ts +38 -0
- package/dist/services/agentic-retrieval.js +126 -0
- package/dist/services/answer-format.d.ts +56 -0
- package/dist/services/answer-format.js +118 -0
- package/dist/services/answer-rescue.d.ts +72 -0
- package/dist/services/answer-rescue.js +177 -0
- package/dist/services/answer-verifier.d.ts +24 -0
- package/dist/services/answer-verifier.js +73 -0
- package/dist/services/api-retry.d.ts +6 -0
- package/dist/services/api-retry.js +41 -0
- package/dist/services/assistant-turn-filter.d.ts +20 -0
- package/dist/services/assistant-turn-filter.js +69 -0
- package/dist/services/atomicmem-uri.d.ts +33 -0
- package/dist/services/atomicmem-uri.js +86 -0
- package/dist/services/audit-events.d.ts +54 -0
- package/dist/services/audit-events.js +56 -0
- package/dist/services/chunked-extraction.d.ts +21 -0
- package/dist/services/chunked-extraction.js +108 -0
- package/dist/services/claim-slotting.d.ts +27 -0
- package/dist/services/claim-slotting.js +38 -0
- package/dist/services/claude-code-llm.d.ts +19 -0
- package/dist/services/claude-code-llm.js +96 -0
- package/dist/services/composite-dedup.d.ts +50 -0
- package/dist/services/composite-dedup.js +153 -0
- package/dist/services/composite-grouping.d.ts +41 -0
- package/dist/services/composite-grouping.js +111 -0
- package/dist/services/composite-staleness.d.ts +20 -0
- package/dist/services/composite-staleness.js +50 -0
- package/dist/services/conciseness-preference.d.ts +14 -0
- package/dist/services/conciseness-preference.js +42 -0
- package/dist/services/conflict-policy.d.ts +20 -0
- package/dist/services/conflict-policy.js +335 -0
- package/dist/services/consensus-extraction.d.ts +39 -0
- package/dist/services/consensus-extraction.js +147 -0
- package/dist/services/consensus-validation.d.ts +52 -0
- package/dist/services/consensus-validation.js +206 -0
- package/dist/services/consolidation-service.d.ts +60 -0
- package/dist/services/consolidation-service.js +171 -0
- package/dist/services/content-detection.d.ts +18 -0
- package/dist/services/content-detection.js +25 -0
- package/dist/services/contradiction-surfacing.d.ts +62 -0
- package/dist/services/contradiction-surfacing.js +111 -0
- package/dist/services/cost-telemetry.d.ts +39 -0
- package/dist/services/cost-telemetry.js +58 -0
- package/dist/services/counter-evidence.d.ts +34 -0
- package/dist/services/counter-evidence.js +92 -0
- package/dist/services/current-state-ranking.d.ts +21 -0
- package/dist/services/current-state-ranking.js +152 -0
- package/dist/services/deferred-audn.d.ts +47 -0
- package/dist/services/deferred-audn.js +162 -0
- package/dist/services/document-chunker.d.ts +50 -0
- package/dist/services/document-chunker.js +153 -0
- package/dist/services/document-failure-markers.d.ts +91 -0
- package/dist/services/document-failure-markers.js +305 -0
- package/dist/services/document-indexer.d.ts +122 -0
- package/dist/services/document-indexer.js +405 -0
- package/dist/services/document-service.d.ts +245 -0
- package/dist/services/document-service.js +325 -0
- package/dist/services/document-upload-artifact-sync.d.ts +80 -0
- package/dist/services/document-upload-artifact-sync.js +162 -0
- package/dist/services/document-upload-beta2-recovery.d.ts +72 -0
- package/dist/services/document-upload-beta2-recovery.js +94 -0
- package/dist/services/document-upload.d.ts +44 -0
- package/dist/services/document-upload.js +353 -0
- package/dist/services/embedding.d.ts +57 -0
- package/dist/services/embedding.js +416 -0
- package/dist/services/entity-attribute-extractor.d.ts +34 -0
- package/dist/services/entity-attribute-extractor.js +117 -0
- package/dist/services/entity-card-synthesis.d.ts +54 -0
- package/dist/services/entity-card-synthesis.js +92 -0
- package/dist/services/entity-dedup.d.ts +9 -0
- package/dist/services/entity-dedup.js +14 -0
- package/dist/services/entity-graph.d.ts +17 -0
- package/dist/services/entity-graph.js +135 -0
- package/dist/services/entropy-gate.d.ts +52 -0
- package/dist/services/entropy-gate.js +56 -0
- package/dist/services/episode-fetcher.d.ts +47 -0
- package/dist/services/episode-fetcher.js +128 -0
- package/dist/services/event-anchor-facts.d.ts +8 -0
- package/dist/services/event-anchor-facts.js +205 -0
- package/dist/services/event-chain-detector.d.ts +52 -0
- package/dist/services/event-chain-detector.js +83 -0
- package/dist/services/extraction-cache.d.ts +9 -0
- package/dist/services/extraction-cache.js +54 -0
- package/dist/services/extraction-enrichment.d.ts +9 -0
- package/dist/services/extraction-enrichment.js +223 -0
- package/dist/services/extraction.d.ts +69 -0
- package/dist/services/extraction.js +596 -0
- package/dist/services/fact-normalization.d.ts +12 -0
- package/dist/services/fact-normalization.js +248 -0
- package/dist/services/filecoin-observability.d.ts +127 -0
- package/dist/services/filecoin-observability.js +200 -0
- package/dist/services/first-mention-service.d.ts +76 -0
- package/dist/services/first-mention-service.js +186 -0
- package/dist/services/hierarchical-retrieval.d.ts +49 -0
- package/dist/services/hierarchical-retrieval.js +50 -0
- package/dist/services/ingest-fact-pipeline.d.ts +32 -0
- package/dist/services/ingest-fact-pipeline.js +212 -0
- package/dist/services/ingest-post-write.d.ts +50 -0
- package/dist/services/ingest-post-write.js +117 -0
- package/dist/services/ingest-trace.d.ts +32 -0
- package/dist/services/ingest-trace.js +60 -0
- package/dist/services/input-sanitizer.d.ts +41 -0
- package/dist/services/input-sanitizer.js +135 -0
- package/dist/services/iterative-retrieval.d.ts +26 -0
- package/dist/services/iterative-retrieval.js +139 -0
- package/dist/services/keyword-expansion.d.ts +10 -0
- package/dist/services/keyword-expansion.js +26 -0
- package/dist/services/lesson-service.d.ts +68 -0
- package/dist/services/lesson-service.js +178 -0
- package/dist/services/literal-extractor.d.ts +16 -0
- package/dist/services/literal-extractor.js +74 -0
- package/dist/services/literal-list-protection.d.ts +17 -0
- package/dist/services/literal-list-protection.js +134 -0
- package/dist/services/literal-query-expansion.d.ts +20 -0
- package/dist/services/literal-query-expansion.js +181 -0
- package/dist/services/llm.d.ts +61 -0
- package/dist/services/llm.js +265 -0
- package/dist/services/memcell-projection.d.ts +17 -0
- package/dist/services/memcell-projection.js +41 -0
- package/dist/services/memory-audn.d.ts +43 -0
- package/dist/services/memory-audn.js +419 -0
- package/dist/services/memory-crud.d.ts +93 -0
- package/dist/services/memory-crud.js +255 -0
- package/dist/services/memory-ingest.d.ts +21 -0
- package/dist/services/memory-ingest.js +249 -0
- package/dist/services/memory-lifecycle.d.ts +75 -0
- package/dist/services/memory-lifecycle.js +108 -0
- package/dist/services/memory-lineage.d.ts +181 -0
- package/dist/services/memory-lineage.js +232 -0
- package/dist/services/memory-network.d.ts +40 -0
- package/dist/services/memory-network.js +75 -0
- package/dist/services/memory-search-types.d.ts +25 -0
- package/dist/services/memory-search-types.js +10 -0
- package/dist/services/memory-search.d.ts +48 -0
- package/dist/services/memory-search.js +505 -0
- package/dist/services/memory-service-types.d.ts +371 -0
- package/dist/services/memory-service-types.js +8 -0
- package/dist/services/memory-service.d.ts +152 -0
- package/dist/services/memory-service.js +225 -0
- package/dist/services/memory-storage.d.ts +33 -0
- package/dist/services/memory-storage.js +328 -0
- package/dist/services/msr-aggregator.d.ts +38 -0
- package/dist/services/msr-aggregator.js +97 -0
- package/dist/services/msr-detector.d.ts +35 -0
- package/dist/services/msr-detector.js +65 -0
- package/dist/services/namespace-retrieval.d.ts +60 -0
- package/dist/services/namespace-retrieval.js +180 -0
- package/dist/services/observation-date-extraction.d.ts +12 -0
- package/dist/services/observation-date-extraction.js +50 -0
- package/dist/services/observation-service.d.ts +27 -0
- package/dist/services/observation-service.js +84 -0
- package/dist/services/packaging-observability.d.ts +29 -0
- package/dist/services/packaging-observability.js +146 -0
- package/dist/services/query-expansion.d.ts +83 -0
- package/dist/services/query-expansion.js +242 -0
- package/dist/services/query-keyword-matches.d.ts +6 -0
- package/dist/services/query-keyword-matches.js +56 -0
- package/dist/services/query-term-visibility.d.ts +28 -0
- package/dist/services/query-term-visibility.js +100 -0
- package/dist/services/quick-extraction.d.ts +25 -0
- package/dist/services/quick-extraction.js +431 -0
- package/dist/services/quoted-entity-extraction.d.ts +10 -0
- package/dist/services/quoted-entity-extraction.js +161 -0
- package/dist/services/raw-storage-reconciler-backoff.d.ts +8 -0
- package/dist/services/raw-storage-reconciler-backoff.js +14 -0
- package/dist/services/raw-storage-reconciler-scheduler.d.ts +29 -0
- package/dist/services/raw-storage-reconciler-scheduler.js +43 -0
- package/dist/services/raw-storage-reconciler.d.ts +71 -0
- package/dist/services/raw-storage-reconciler.js +278 -0
- package/dist/services/recap-builder.d.ts +49 -0
- package/dist/services/recap-builder.js +157 -0
- package/dist/services/reflect-jobs.d.ts +23 -0
- package/dist/services/reflect-jobs.js +36 -0
- package/dist/services/reflect-prompts.d.ts +71 -0
- package/dist/services/reflect-prompts.js +99 -0
- package/dist/services/reflect-retrieval.d.ts +33 -0
- package/dist/services/reflect-retrieval.js +30 -0
- package/dist/services/reflect.d.ts +49 -0
- package/dist/services/reflect.js +84 -0
- package/dist/services/relative-temporal.d.ts +14 -0
- package/dist/services/relative-temporal.js +163 -0
- package/dist/services/relevance-policy.d.ts +37 -0
- package/dist/services/relevance-policy.js +109 -0
- package/dist/services/rerank.d.ts +32 -0
- package/dist/services/rerank.js +118 -0
- package/dist/services/reranker.d.ts +20 -0
- package/dist/services/reranker.js +99 -0
- package/dist/services/retrieval-channel-rules.d.ts +34 -0
- package/dist/services/retrieval-channel-rules.js +41 -0
- package/dist/services/retrieval-config-overlay.d.ts +36 -0
- package/dist/services/retrieval-config-overlay.js +44 -0
- package/dist/services/retrieval-format.d.ts +119 -0
- package/dist/services/retrieval-format.js +559 -0
- package/dist/services/retrieval-policy.d.ts +69 -0
- package/dist/services/retrieval-policy.js +275 -0
- package/dist/services/retrieval-profiles.d.ts +37 -0
- package/dist/services/retrieval-profiles.js +90 -0
- package/dist/services/retrieval-side-effects.d.ts +14 -0
- package/dist/services/retrieval-side-effects.js +26 -0
- package/dist/services/retrieval-trace.d.ts +108 -0
- package/dist/services/retrieval-trace.js +147 -0
- package/dist/services/rrf-fusion.d.ts +18 -0
- package/dist/services/rrf-fusion.js +34 -0
- package/dist/services/search-pipeline.d.ts +71 -0
- package/dist/services/search-pipeline.js +788 -0
- package/dist/services/session-date.d.ts +20 -0
- package/dist/services/session-date.js +61 -0
- package/dist/services/session-packaging.d.ts +53 -0
- package/dist/services/session-packaging.js +182 -0
- package/dist/services/session-summary-generator.d.ts +53 -0
- package/dist/services/session-summary-generator.js +134 -0
- package/dist/services/specialists/cr-specialist.d.ts +52 -0
- package/dist/services/specialists/cr-specialist.js +121 -0
- package/dist/services/specialists/dispatch.d.ts +53 -0
- package/dist/services/specialists/dispatch.js +102 -0
- package/dist/services/specialists/ie-ku-specialist.d.ts +37 -0
- package/dist/services/specialists/ie-ku-specialist.js +63 -0
- package/dist/services/specialists/msr-specialist.d.ts +61 -0
- package/dist/services/specialists/msr-specialist.js +162 -0
- package/dist/services/specialists/tr-specialist.d.ts +37 -0
- package/dist/services/specialists/tr-specialist.js +146 -0
- package/dist/services/storage-key-prefix.d.ts +42 -0
- package/dist/services/storage-key-prefix.js +45 -0
- package/dist/services/storage-put-recovery.d.ts +71 -0
- package/dist/services/storage-put-recovery.js +269 -0
- package/dist/services/storage-service-errors.d.ts +124 -0
- package/dist/services/storage-service-errors.js +189 -0
- package/dist/services/storage-service.d.ts +176 -0
- package/dist/services/storage-service.js +423 -0
- package/dist/services/subject-aware-ranking.d.ts +19 -0
- package/dist/services/subject-aware-ranking.js +161 -0
- package/dist/services/supplemental-extraction.d.ts +7 -0
- package/dist/services/supplemental-extraction.js +116 -0
- package/dist/services/tbc-execution.d.ts +49 -0
- package/dist/services/tbc-execution.js +284 -0
- package/dist/services/temporal-classifier.d.ts +56 -0
- package/dist/services/temporal-classifier.js +94 -0
- package/dist/services/temporal-endpoint-evidence.d.ts +12 -0
- package/dist/services/temporal-endpoint-evidence.js +313 -0
- package/dist/services/temporal-fingerprint.d.ts +6 -0
- package/dist/services/temporal-fingerprint.js +12 -0
- package/dist/services/temporal-format.d.ts +9 -0
- package/dist/services/temporal-format.js +21 -0
- package/dist/services/temporal-intent.d.ts +39 -0
- package/dist/services/temporal-intent.js +78 -0
- package/dist/services/temporal-query-constraints.d.ts +16 -0
- package/dist/services/temporal-query-constraints.js +107 -0
- package/dist/services/temporal-query-expansion.d.ts +14 -0
- package/dist/services/temporal-query-expansion.js +131 -0
- package/dist/services/temporal-rerank.d.ts +22 -0
- package/dist/services/temporal-rerank.js +47 -0
- package/dist/services/temporal-result-protection.d.ts +7 -0
- package/dist/services/temporal-result-protection.js +60 -0
- package/dist/services/temporal-state-write.d.ts +57 -0
- package/dist/services/temporal-state-write.js +45 -0
- package/dist/services/tiered-context.d.ts +87 -0
- package/dist/services/tiered-context.js +214 -0
- package/dist/services/tiered-loading.d.ts +88 -0
- package/dist/services/tiered-loading.js +263 -0
- package/dist/services/timeline-pack.d.ts +36 -0
- package/dist/services/timeline-pack.js +50 -0
- package/dist/services/timing.d.ts +13 -0
- package/dist/services/timing.js +72 -0
- package/dist/services/tll-augmentation.d.ts +20 -0
- package/dist/services/tll-augmentation.js +125 -0
- package/dist/services/tll-retrieval.d.ts +55 -0
- package/dist/services/tll-retrieval.js +101 -0
- package/dist/services/topic-abstraction.d.ts +36 -0
- package/dist/services/topic-abstraction.js +105 -0
- package/dist/services/trust-scoring.d.ts +43 -0
- package/dist/services/trust-scoring.js +89 -0
- package/dist/services/typed-belief-calculus.d.ts +126 -0
- package/dist/services/typed-belief-calculus.js +204 -0
- package/dist/services/upload-config.d.ts +34 -0
- package/dist/services/upload-config.js +23 -0
- package/dist/services/upload-decision.d.ts +65 -0
- package/dist/services/upload-decision.js +98 -0
- package/dist/services/upload-helpers.d.ts +107 -0
- package/dist/services/upload-helpers.js +148 -0
- package/dist/services/user-profile-builder.d.ts +22 -0
- package/dist/services/user-profile-builder.js +109 -0
- package/dist/services/voyage-embedding.d.ts +22 -0
- package/dist/services/voyage-embedding.js +77 -0
- package/dist/services/write-security.d.ts +31 -0
- package/dist/services/write-security.js +64 -0
- package/dist/storage/artifact-public-redaction.d.ts +34 -0
- package/dist/storage/artifact-public-redaction.js +83 -0
- package/dist/storage/cleanup.d.ts +103 -0
- package/dist/storage/cleanup.js +138 -0
- package/dist/storage/codec-factory.d.ts +17 -0
- package/dist/storage/codec-factory.js +33 -0
- package/dist/storage/codecs/aes-gcm-codec.d.ts +44 -0
- package/dist/storage/codecs/aes-gcm-codec.js +108 -0
- package/dist/storage/codecs/noop-codec.d.ts +16 -0
- package/dist/storage/codecs/noop-codec.js +23 -0
- package/dist/storage/factory.d.ts +44 -0
- package/dist/storage/factory.js +99 -0
- package/dist/storage/filecoin-cid-validation.d.ts +82 -0
- package/dist/storage/filecoin-cid-validation.js +122 -0
- package/dist/storage/filecoin-public-metadata.d.ts +73 -0
- package/dist/storage/filecoin-public-metadata.js +110 -0
- package/dist/storage/local-fs-store.d.ts +39 -0
- package/dist/storage/local-fs-store.js +145 -0
- package/dist/storage/pointer-uri-allowlist.d.ts +38 -0
- package/dist/storage/pointer-uri-allowlist.js +70 -0
- package/dist/storage/provider-metadata-projection.d.ts +27 -0
- package/dist/storage/provider-metadata-projection.js +68 -0
- package/dist/storage/providers/filecoin/backend.d.ts +42 -0
- package/dist/storage/providers/filecoin/backend.js +250 -0
- package/dist/storage/providers/filecoin/config.d.ts +70 -0
- package/dist/storage/providers/filecoin/config.js +275 -0
- package/dist/storage/providers/filecoin/errors.d.ts +45 -0
- package/dist/storage/providers/filecoin/errors.js +56 -0
- package/dist/storage/providers/filecoin/filecoin-pin-car.d.ts +78 -0
- package/dist/storage/providers/filecoin/filecoin-pin-car.js +155 -0
- package/dist/storage/providers/filecoin/filecoin-pin-client.d.ts +92 -0
- package/dist/storage/providers/filecoin/filecoin-pin-client.js +199 -0
- package/dist/storage/providers/filecoin/filecoin-pin-mapping.d.ts +58 -0
- package/dist/storage/providers/filecoin/filecoin-pin-mapping.js +103 -0
- package/dist/storage/providers/filecoin/filecoin-pin-timeout.d.ts +30 -0
- package/dist/storage/providers/filecoin/filecoin-pin-timeout.js +53 -0
- package/dist/storage/providers/filecoin/filecoin-pin-vendor.d.ts +111 -0
- package/dist/storage/providers/filecoin/filecoin-pin-vendor.js +87 -0
- package/dist/storage/providers/filecoin/hints.d.ts +71 -0
- package/dist/storage/providers/filecoin/hints.js +123 -0
- package/dist/storage/providers/filecoin/index.d.ts +51 -0
- package/dist/storage/providers/filecoin/index.js +103 -0
- package/dist/storage/providers/filecoin/ipfs-cid.d.ts +50 -0
- package/dist/storage/providers/filecoin/ipfs-cid.js +64 -0
- package/dist/storage/providers/filecoin/metadata.d.ts +72 -0
- package/dist/storage/providers/filecoin/metadata.js +137 -0
- package/dist/storage/providers/filecoin/piece-cid.d.ts +48 -0
- package/dist/storage/providers/filecoin/piece-cid.js +57 -0
- package/dist/storage/providers/filecoin/provider-client.d.ts +234 -0
- package/dist/storage/providers/filecoin/provider-client.js +27 -0
- package/dist/storage/providers/filecoin/readiness.d.ts +62 -0
- package/dist/storage/providers/filecoin/readiness.js +85 -0
- package/dist/storage/providers/filecoin/retriever.d.ts +82 -0
- package/dist/storage/providers/filecoin/retriever.js +63 -0
- package/dist/storage/providers/filecoin/skeleton-client.d.ts +36 -0
- package/dist/storage/providers/filecoin/skeleton-client.js +55 -0
- package/dist/storage/providers/filecoin/synapse-client.d.ts +169 -0
- package/dist/storage/providers/filecoin/synapse-client.js +343 -0
- package/dist/storage/providers/filecoin/synapse-construction.d.ts +26 -0
- package/dist/storage/providers/filecoin/synapse-construction.js +47 -0
- package/dist/storage/providers/filecoin/synapse-error-mapping.d.ts +23 -0
- package/dist/storage/providers/filecoin/synapse-error-mapping.js +49 -0
- package/dist/storage/providers/filecoin/synapse-readiness.d.ts +37 -0
- package/dist/storage/providers/filecoin/synapse-readiness.js +231 -0
- package/dist/storage/providers/filecoin/uri.d.ts +49 -0
- package/dist/storage/providers/filecoin/uri.js +84 -0
- package/dist/storage/providers/filecoin/verified-fetch-lifecycle.d.ts +77 -0
- package/dist/storage/providers/filecoin/verified-fetch-lifecycle.js +196 -0
- package/dist/storage/providers/filecoin/verified-fetch-retriever.d.ts +54 -0
- package/dist/storage/providers/filecoin/verified-fetch-retriever.js +81 -0
- package/dist/storage/providers/filecoin/verified-fetch-vendor.d.ts +71 -0
- package/dist/storage/providers/filecoin/verified-fetch-vendor.js +94 -0
- package/dist/storage/raw-content-codec.d.ts +89 -0
- package/dist/storage/raw-content-codec.js +47 -0
- package/dist/storage/raw-content-store-backend-adapter.d.ts +28 -0
- package/dist/storage/raw-content-store-backend-adapter.js +67 -0
- package/dist/storage/raw-content-store.d.ts +228 -0
- package/dist/storage/raw-content-store.js +27 -0
- package/dist/storage/s3-store.d.ts +42 -0
- package/dist/storage/s3-store.js +181 -0
- package/dist/storage/storage-backend-registry.d.ts +58 -0
- package/dist/storage/storage-backend-registry.js +56 -0
- package/dist/storage/storage-backend.d.ts +82 -0
- package/dist/storage/storage-backend.js +14 -0
- package/dist/storage/storage-capabilities.d.ts +56 -0
- package/dist/storage/storage-capabilities.js +170 -0
- package/dist/storage/store-registry.d.ts +67 -0
- package/dist/storage/store-registry.js +77 -0
- package/dist/vector-math.d.ts +15 -0
- package/dist/vector-math.js +31 -0
- package/dist/xml-escape.d.ts +5 -0
- package/dist/xml-escape.js +7 -0
- package/openapi.json +15395 -0
- package/openapi.yaml +10794 -0
- package/package.json +119 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Zod schemas for the 5 /v1/agents/* routes.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the inline parsers at `src/routes/agents.ts:86-109`
|
|
5
|
+
* byte-for-byte:
|
|
6
|
+
* - `requireString` accepts either a string OR an array (takes
|
|
7
|
+
* first element via `String(value[0])`) — this handles Express
|
|
8
|
+
* query strings with duplicate params. Throws
|
|
9
|
+
* `"${field} is required"` on missing/non-accepted input.
|
|
10
|
+
* - `requireTrustLevel` distinguishes type error ("trust_level must
|
|
11
|
+
* be a number between 0.0 and 1.0") from range error
|
|
12
|
+
* ("trust_level must be between 0.0 and 1.0").
|
|
13
|
+
* - `requireResolution` accepts the three enum variants; anything
|
|
14
|
+
* else throws the full list-of-valid-values message.
|
|
15
|
+
*
|
|
16
|
+
* Every error message matches the pre-refactor text exactly so HTTP
|
|
17
|
+
* clients that regex on `{ error }` continue to match.
|
|
18
|
+
*/
|
|
19
|
+
import { z } from './zod-setup.js';
|
|
20
|
+
/**
|
|
21
|
+
* Build a schema that produces `"${label} is required"` for every
|
|
22
|
+
* failure mode the old `requireString` threw on (missing, null,
|
|
23
|
+
* non-string non-array, empty string, empty array). Successful
|
|
24
|
+
* strings pass through; arrays yield `String(value[0])`.
|
|
25
|
+
*/
|
|
26
|
+
function requiredStringOrArray(label) {
|
|
27
|
+
const message = `${label} is required`;
|
|
28
|
+
return z
|
|
29
|
+
.unknown()
|
|
30
|
+
.transform(v => {
|
|
31
|
+
if (typeof v === 'string')
|
|
32
|
+
return v;
|
|
33
|
+
if (Array.isArray(v) && v.length > 0)
|
|
34
|
+
return String(v[0]);
|
|
35
|
+
return undefined;
|
|
36
|
+
})
|
|
37
|
+
.refine((v) => typeof v === 'string' && v.length > 0, {
|
|
38
|
+
message,
|
|
39
|
+
})
|
|
40
|
+
.transform(v => v)
|
|
41
|
+
.openapi({ type: 'string', minLength: 1, description: `Required. ${label}.` });
|
|
42
|
+
}
|
|
43
|
+
const TRUST_TYPE_MESSAGE = 'trust_level must be a number between 0.0 and 1.0';
|
|
44
|
+
const TRUST_RANGE_MESSAGE = 'trust_level must be between 0.0 and 1.0';
|
|
45
|
+
/** Finite number in [0.0, 1.0]. Separate messages for wrong-type vs out-of-range. */
|
|
46
|
+
const TrustLevelSchema = z
|
|
47
|
+
.unknown()
|
|
48
|
+
.superRefine((v, ctx) => {
|
|
49
|
+
if (typeof v !== 'number' || !Number.isFinite(v)) {
|
|
50
|
+
ctx.addIssue({ code: 'custom', message: TRUST_TYPE_MESSAGE });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (v < 0.0 || v > 1.0) {
|
|
54
|
+
ctx.addIssue({ code: 'custom', message: TRUST_RANGE_MESSAGE });
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.transform(v => v)
|
|
58
|
+
.openapi({
|
|
59
|
+
type: 'number',
|
|
60
|
+
minimum: 0.0,
|
|
61
|
+
maximum: 1.0,
|
|
62
|
+
description: 'Trust score in [0.0, 1.0].',
|
|
63
|
+
});
|
|
64
|
+
const VALID_RESOLUTIONS = ['resolved_new', 'resolved_existing', 'resolved_both'];
|
|
65
|
+
const RESOLUTION_MESSAGE = 'resolution must be "resolved_new", "resolved_existing", or "resolved_both"';
|
|
66
|
+
const ResolutionSchema = z
|
|
67
|
+
.unknown()
|
|
68
|
+
.refine((v) => typeof v === 'string' && VALID_RESOLUTIONS.includes(v), { message: RESOLUTION_MESSAGE })
|
|
69
|
+
.transform(v => v)
|
|
70
|
+
.openapi({
|
|
71
|
+
type: 'string',
|
|
72
|
+
enum: [...VALID_RESOLUTIONS],
|
|
73
|
+
});
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// PUT /trust
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
export const SetTrustBodySchema = z
|
|
78
|
+
.object({
|
|
79
|
+
agent_id: requiredStringOrArray('agent_id'),
|
|
80
|
+
user_id: requiredStringOrArray('user_id'),
|
|
81
|
+
trust_level: TrustLevelSchema,
|
|
82
|
+
display_name: z
|
|
83
|
+
.unknown()
|
|
84
|
+
.transform(v => (typeof v === 'string' ? v : undefined))
|
|
85
|
+
.openapi({ type: 'string' }),
|
|
86
|
+
})
|
|
87
|
+
.transform(b => ({
|
|
88
|
+
agentId: b.agent_id,
|
|
89
|
+
userId: b.user_id,
|
|
90
|
+
trustLevel: b.trust_level,
|
|
91
|
+
displayName: b.display_name,
|
|
92
|
+
}))
|
|
93
|
+
.openapi({
|
|
94
|
+
description: "Set the calling user's trust level for a given agent. trust_level in [0.0, 1.0].",
|
|
95
|
+
});
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
// GET /trust
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
export const GetTrustQuerySchema = z
|
|
100
|
+
.object({
|
|
101
|
+
agent_id: requiredStringOrArray('agent_id'),
|
|
102
|
+
user_id: requiredStringOrArray('user_id'),
|
|
103
|
+
})
|
|
104
|
+
.transform(q => ({ agentId: q.agent_id, userId: q.user_id }))
|
|
105
|
+
.openapi({ description: 'Look up the trust level for a (user, agent) pair.' });
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
// GET /conflicts + POST /conflicts/auto-resolve
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
export const UserIdFromQuerySchema = z
|
|
110
|
+
.object({ user_id: requiredStringOrArray('user_id') })
|
|
111
|
+
.transform(q => ({ userId: q.user_id }))
|
|
112
|
+
.openapi({ description: 'List open agent conflicts for a user.' });
|
|
113
|
+
export const UserIdFromBodySchema = z
|
|
114
|
+
.object({ user_id: requiredStringOrArray('user_id') })
|
|
115
|
+
.transform(b => ({ userId: b.user_id }))
|
|
116
|
+
.openapi({ description: 'Auto-resolve expired conflicts for a user.' });
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// PUT /conflicts/:id/resolve
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
export const ConflictIdParamSchema = z
|
|
121
|
+
.object({ id: z.string().min(1) })
|
|
122
|
+
.transform(p => ({ id: p.id }));
|
|
123
|
+
export const ResolveConflictBodySchema = z
|
|
124
|
+
.object({ resolution: ResolutionSchema })
|
|
125
|
+
.transform(b => ({ resolution: b.resolution }))
|
|
126
|
+
.openapi({ description: 'Resolve a specific conflict with one of the three enum variants.' });
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Shared Zod schemas reused across request/response bodies.
|
|
3
|
+
*
|
|
4
|
+
* All schemas author fields in **snake_case** (the wire format). The
|
|
5
|
+
* Phase-2 request schemas layer `.transform()` on top to emit the
|
|
6
|
+
* camelCase TypeScript shapes handlers expect, matching today's
|
|
7
|
+
* `parseIngestBody` / `parseSearchBody` behavior.
|
|
8
|
+
*
|
|
9
|
+
* Source-of-truth contracts:
|
|
10
|
+
* - WorkspaceContext / AgentScope: `src/db/repository-types.ts:186-199`
|
|
11
|
+
* - Body parsing shape: `src/routes/memories.ts:515-628`
|
|
12
|
+
*/
|
|
13
|
+
import { z } from './zod-setup.js';
|
|
14
|
+
export declare const MemoryVisibilitySchema: z.ZodEnum<{
|
|
15
|
+
agent_only: "agent_only";
|
|
16
|
+
restricted: "restricted";
|
|
17
|
+
workspace: "workspace";
|
|
18
|
+
}>;
|
|
19
|
+
export type MemoryVisibility = z.infer<typeof MemoryVisibilitySchema>;
|
|
20
|
+
export declare const WorkspaceIdField: z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | undefined, unknown>>;
|
|
21
|
+
export declare const AgentIdField: z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | undefined, unknown>>;
|
|
22
|
+
export declare const VisibilityField: z.ZodPipe<z.ZodUnknown, z.ZodTransform<"agent_only" | "restricted" | "workspace" | undefined, unknown>>;
|
|
23
|
+
/**
|
|
24
|
+
* Post-transform camelCase `WorkspaceContext` output shape consumed by
|
|
25
|
+
* services. Both fields are required here because this schema
|
|
26
|
+
* represents the "workspace is active" branch of the transform;
|
|
27
|
+
* absence is expressed at the parent level as `workspace: undefined`.
|
|
28
|
+
*
|
|
29
|
+
* Matches `WorkspaceContext` in `src/db/repository-types.ts:186`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const WorkspaceContextOutputSchema: z.ZodObject<{
|
|
32
|
+
workspaceId: z.ZodString;
|
|
33
|
+
agentId: z.ZodString;
|
|
34
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
agent_only: "agent_only";
|
|
36
|
+
restricted: "restricted";
|
|
37
|
+
workspace: "workspace";
|
|
38
|
+
}>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export type WorkspaceContext = z.infer<typeof WorkspaceContextOutputSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* Agent-scope filter for workspace searches.
|
|
43
|
+
* Accepts:
|
|
44
|
+
* - 'all' | 'self' | 'others' — enum variants
|
|
45
|
+
* - a concrete agent_id string — filter to that agent's memories
|
|
46
|
+
* - string[] — filter to any of the listed agent IDs
|
|
47
|
+
*
|
|
48
|
+
* ⚠️ Behavior must match `parseOptionalAgentScope`
|
|
49
|
+
* (`src/routes/memories.ts:617`): for values that are neither a
|
|
50
|
+
* string nor a string-only array, the parser returns `undefined`
|
|
51
|
+
* silently (no 400). `.catch(undefined)` preserves that tolerance so
|
|
52
|
+
* Phase 2 composition does not regress `agent_scope: 42` /
|
|
53
|
+
* `agent_scope: {}` from "ignored" to a 400.
|
|
54
|
+
*/
|
|
55
|
+
export declare const AgentScopeSchema: z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | string[] | undefined, unknown>>;
|
|
56
|
+
export type AgentScopeInput = z.infer<typeof AgentScopeSchema>;
|
|
57
|
+
/** Retrieval mode enum for POST /v1/memories/search body.retrieval_mode. */
|
|
58
|
+
export declare const RetrievalModeSchema: z.ZodEnum<{
|
|
59
|
+
flat: "flat";
|
|
60
|
+
tiered: "tiered";
|
|
61
|
+
"abstract-aware": "abstract-aware";
|
|
62
|
+
}>;
|
|
63
|
+
export type RetrievalMode = z.infer<typeof RetrievalModeSchema>;
|
|
64
|
+
/**
|
|
65
|
+
* Required string field — truthy string, no trimming. Exactly matches
|
|
66
|
+
* the contract of `requireBodyString` (`src/routes/memories.ts:571`):
|
|
67
|
+
*
|
|
68
|
+
* ```ts
|
|
69
|
+
* if (!value || typeof value !== 'string') throw new InputError(message);
|
|
70
|
+
* return value;
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* Note the absence of a trim: today's handlers pass through leading /
|
|
74
|
+
* trailing whitespace, and " " (whitespace-only) is truthy so it
|
|
75
|
+
* succeeds the current check. This schema preserves that exact
|
|
76
|
+
* behavior — do not add `.trim()` or a whitespace-only rejection here.
|
|
77
|
+
*/
|
|
78
|
+
export declare const NonEmptyString: z.ZodString;
|
|
79
|
+
/**
|
|
80
|
+
* Matches `optionalBodyString` (memories.ts:576): `typeof v === 'string'
|
|
81
|
+
* ? v : undefined`. Preserves empty string verbatim — callers may
|
|
82
|
+
* distinguish `""` from `undefined` downstream (e.g. search filters).
|
|
83
|
+
*
|
|
84
|
+
* Shared between every Zod request schema that accepts an optional
|
|
85
|
+
* string body field; do not redefine in resource-specific schema files.
|
|
86
|
+
*/
|
|
87
|
+
export declare const OptionalBodyString: z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | undefined, unknown>>;
|
|
88
|
+
/**
|
|
89
|
+
* Build a schema that produces the exact error message
|
|
90
|
+
* `"${label} (string) is required"` for every failure mode that
|
|
91
|
+
* `requireBodyString` threw on (missing, null, wrong type, empty
|
|
92
|
+
* string). Preserves wire-contract text clients may match against.
|
|
93
|
+
*
|
|
94
|
+
* Shared between every Zod request schema that requires a non-empty
|
|
95
|
+
* string body field; do not redefine in resource-specific schema files.
|
|
96
|
+
*/
|
|
97
|
+
export declare function requiredStringBody(label: string): z.ZodPipe<z.ZodUnknown & z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>, z.ZodTransform<string, string>>;
|
|
98
|
+
/**
|
|
99
|
+
* ISO-8601 timestamp accepted as a plain string on the wire. The
|
|
100
|
+
* memories/search route parses this via `parseOptionalIsoTimestamp`
|
|
101
|
+
* (`src/routes/memories.ts:641`):
|
|
102
|
+
* - `undefined`, `null`, or `''` → treated as absent (no 400).
|
|
103
|
+
* - Any other non-string or unparseable string → 400.
|
|
104
|
+
* - Parseable string → passed through unchanged.
|
|
105
|
+
*
|
|
106
|
+
* Preprocess strips the empty-string / null sentinels before the
|
|
107
|
+
* string+date check so composing `IsoTimestamp` into a route body
|
|
108
|
+
* preserves the "empty means absent" contract exactly.
|
|
109
|
+
*/
|
|
110
|
+
export declare const IsoTimestamp: z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | undefined, unknown>>;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Shared Zod schemas reused across request/response bodies.
|
|
3
|
+
*
|
|
4
|
+
* All schemas author fields in **snake_case** (the wire format). The
|
|
5
|
+
* Phase-2 request schemas layer `.transform()` on top to emit the
|
|
6
|
+
* camelCase TypeScript shapes handlers expect, matching today's
|
|
7
|
+
* `parseIngestBody` / `parseSearchBody` behavior.
|
|
8
|
+
*
|
|
9
|
+
* Source-of-truth contracts:
|
|
10
|
+
* - WorkspaceContext / AgentScope: `src/db/repository-types.ts:186-199`
|
|
11
|
+
* - Body parsing shape: `src/routes/memories.ts:515-628`
|
|
12
|
+
*/
|
|
13
|
+
import { z } from './zod-setup.js';
|
|
14
|
+
export const MemoryVisibilitySchema = z
|
|
15
|
+
.enum(['agent_only', 'restricted', 'workspace'])
|
|
16
|
+
.openapi({
|
|
17
|
+
description: 'Write-time visibility label controlling which agents in a workspace can read the memory.',
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Request-body-level schema for the three top-level workspace fields
|
|
21
|
+
* (`workspace_id`, `agent_id`, `visibility`).
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ Behavior must match `parseOptionalWorkspaceContext`
|
|
24
|
+
* (`src/routes/memories.ts:601-615`). Current parser calls
|
|
25
|
+
* `optionalBodyString`, which returns the value unchanged when it is
|
|
26
|
+
* a string and `undefined` otherwise — it **never 400s**. Then the
|
|
27
|
+
* parser treats missing `workspace_id` / `agent_id` (including empty
|
|
28
|
+
* string, which fails the `!workspaceId` truthy check) as "no
|
|
29
|
+
* workspace context" and falls back to user scope.
|
|
30
|
+
*
|
|
31
|
+
* Both field schemas therefore silently coerce any invalid or empty
|
|
32
|
+
* value to `undefined` via `.catch(undefined)`. Phase 2's route
|
|
33
|
+
* schemas compose these as top-level body fields and run a transform
|
|
34
|
+
* that emits the internal {@link WorkspaceContext} camelCase shape
|
|
35
|
+
* only when both are non-empty strings.
|
|
36
|
+
*/
|
|
37
|
+
// These use `.unknown().transform(...)` rather than `.optional().catch()`
|
|
38
|
+
// because zod-to-openapi's traversal fails on ZodCatch nodes. The
|
|
39
|
+
// runtime semantics are identical (non-string / empty → undefined).
|
|
40
|
+
const VALID_VISIBILITIES = ['agent_only', 'restricted', 'workspace'];
|
|
41
|
+
export const WorkspaceIdField = z
|
|
42
|
+
.unknown()
|
|
43
|
+
.transform(v => (typeof v === 'string' && v.length > 0 ? v : undefined))
|
|
44
|
+
.openapi({
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Optional workspace identifier. Silently dropped if empty / non-string.',
|
|
47
|
+
});
|
|
48
|
+
export const AgentIdField = z
|
|
49
|
+
.unknown()
|
|
50
|
+
.transform(v => (typeof v === 'string' && v.length > 0 ? v : undefined))
|
|
51
|
+
.openapi({
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'Optional agent identifier. Silently dropped if empty / non-string.',
|
|
54
|
+
});
|
|
55
|
+
export const VisibilityField = z
|
|
56
|
+
.unknown()
|
|
57
|
+
.transform(v => typeof v === 'string' && VALID_VISIBILITIES.includes(v)
|
|
58
|
+
? v
|
|
59
|
+
: undefined)
|
|
60
|
+
.openapi({
|
|
61
|
+
type: 'string',
|
|
62
|
+
enum: VALID_VISIBILITIES,
|
|
63
|
+
description: 'Visibility (one of agent_only / restricted / workspace). Invalid values silently drop to undefined.',
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Post-transform camelCase `WorkspaceContext` output shape consumed by
|
|
67
|
+
* services. Both fields are required here because this schema
|
|
68
|
+
* represents the "workspace is active" branch of the transform;
|
|
69
|
+
* absence is expressed at the parent level as `workspace: undefined`.
|
|
70
|
+
*
|
|
71
|
+
* Matches `WorkspaceContext` in `src/db/repository-types.ts:186`.
|
|
72
|
+
*/
|
|
73
|
+
export const WorkspaceContextOutputSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
workspaceId: z.string().min(1),
|
|
76
|
+
agentId: z.string().min(1),
|
|
77
|
+
visibility: MemoryVisibilitySchema.optional(),
|
|
78
|
+
})
|
|
79
|
+
.openapi({
|
|
80
|
+
description: 'Internal workspace-scope context. Emitted by request-body transforms when both workspace_id and agent_id are present on the wire.',
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Agent-scope filter for workspace searches.
|
|
84
|
+
* Accepts:
|
|
85
|
+
* - 'all' | 'self' | 'others' — enum variants
|
|
86
|
+
* - a concrete agent_id string — filter to that agent's memories
|
|
87
|
+
* - string[] — filter to any of the listed agent IDs
|
|
88
|
+
*
|
|
89
|
+
* ⚠️ Behavior must match `parseOptionalAgentScope`
|
|
90
|
+
* (`src/routes/memories.ts:617`): for values that are neither a
|
|
91
|
+
* string nor a string-only array, the parser returns `undefined`
|
|
92
|
+
* silently (no 400). `.catch(undefined)` preserves that tolerance so
|
|
93
|
+
* Phase 2 composition does not regress `agent_scope: 42` /
|
|
94
|
+
* `agent_scope: {}` from "ignored" to a 400.
|
|
95
|
+
*/
|
|
96
|
+
export const AgentScopeSchema = z
|
|
97
|
+
.unknown()
|
|
98
|
+
.transform(v => {
|
|
99
|
+
if (typeof v === 'string')
|
|
100
|
+
return v;
|
|
101
|
+
if (Array.isArray(v) && v.every((x) => typeof x === 'string')) {
|
|
102
|
+
return v;
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
})
|
|
106
|
+
.openapi({
|
|
107
|
+
description: "Agent-scope filter for workspace searches. String literal 'all' | 'self' | 'others' or a concrete agent_id. Array of agent_ids is also accepted. Any other value is silently ignored.",
|
|
108
|
+
example: 'all',
|
|
109
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
110
|
+
});
|
|
111
|
+
/** Retrieval mode enum for POST /v1/memories/search body.retrieval_mode. */
|
|
112
|
+
export const RetrievalModeSchema = z
|
|
113
|
+
.enum(['flat', 'tiered', 'abstract-aware'])
|
|
114
|
+
.openapi({
|
|
115
|
+
description: 'Retrieval pipeline mode. Defaults to flat when omitted.',
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Required string field — truthy string, no trimming. Exactly matches
|
|
119
|
+
* the contract of `requireBodyString` (`src/routes/memories.ts:571`):
|
|
120
|
+
*
|
|
121
|
+
* ```ts
|
|
122
|
+
* if (!value || typeof value !== 'string') throw new InputError(message);
|
|
123
|
+
* return value;
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* Note the absence of a trim: today's handlers pass through leading /
|
|
127
|
+
* trailing whitespace, and " " (whitespace-only) is truthy so it
|
|
128
|
+
* succeeds the current check. This schema preserves that exact
|
|
129
|
+
* behavior — do not add `.trim()` or a whitespace-only rejection here.
|
|
130
|
+
*/
|
|
131
|
+
export const NonEmptyString = z.string().min(1, 'must be a non-empty string');
|
|
132
|
+
/**
|
|
133
|
+
* Matches `optionalBodyString` (memories.ts:576): `typeof v === 'string'
|
|
134
|
+
* ? v : undefined`. Preserves empty string verbatim — callers may
|
|
135
|
+
* distinguish `""` from `undefined` downstream (e.g. search filters).
|
|
136
|
+
*
|
|
137
|
+
* Shared between every Zod request schema that accepts an optional
|
|
138
|
+
* string body field; do not redefine in resource-specific schema files.
|
|
139
|
+
*/
|
|
140
|
+
export const OptionalBodyString = z
|
|
141
|
+
.unknown()
|
|
142
|
+
.transform(v => (typeof v === 'string' ? v : undefined))
|
|
143
|
+
.openapi({ type: 'string' });
|
|
144
|
+
/**
|
|
145
|
+
* Build a schema that produces the exact error message
|
|
146
|
+
* `"${label} (string) is required"` for every failure mode that
|
|
147
|
+
* `requireBodyString` threw on (missing, null, wrong type, empty
|
|
148
|
+
* string). Preserves wire-contract text clients may match against.
|
|
149
|
+
*
|
|
150
|
+
* Shared between every Zod request schema that requires a non-empty
|
|
151
|
+
* string body field; do not redefine in resource-specific schema files.
|
|
152
|
+
*/
|
|
153
|
+
export function requiredStringBody(label) {
|
|
154
|
+
const message = `${label} (string) is required`;
|
|
155
|
+
return z
|
|
156
|
+
.unknown()
|
|
157
|
+
.refine((v) => typeof v === 'string' && v.length > 0, {
|
|
158
|
+
message,
|
|
159
|
+
})
|
|
160
|
+
.transform(v => v)
|
|
161
|
+
.openapi({ type: 'string', minLength: 1, description: `Required. ${label}.` });
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* ISO-8601 timestamp accepted as a plain string on the wire. The
|
|
165
|
+
* memories/search route parses this via `parseOptionalIsoTimestamp`
|
|
166
|
+
* (`src/routes/memories.ts:641`):
|
|
167
|
+
* - `undefined`, `null`, or `''` → treated as absent (no 400).
|
|
168
|
+
* - Any other non-string or unparseable string → 400.
|
|
169
|
+
* - Parseable string → passed through unchanged.
|
|
170
|
+
*
|
|
171
|
+
* Preprocess strips the empty-string / null sentinels before the
|
|
172
|
+
* string+date check so composing `IsoTimestamp` into a route body
|
|
173
|
+
* preserves the "empty means absent" contract exactly.
|
|
174
|
+
*/
|
|
175
|
+
export const IsoTimestamp = z
|
|
176
|
+
.unknown()
|
|
177
|
+
.superRefine((v, ctx) => {
|
|
178
|
+
if (v === undefined || v === null || v === '')
|
|
179
|
+
return;
|
|
180
|
+
if (typeof v !== 'string' || Number.isNaN(Date.parse(v))) {
|
|
181
|
+
ctx.addIssue({ code: 'custom', message: 'as_of must be a valid ISO timestamp' });
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
.transform(v => v === undefined || v === null || v === '' ? undefined : v)
|
|
185
|
+
.openapi({
|
|
186
|
+
type: 'string',
|
|
187
|
+
format: 'date-time',
|
|
188
|
+
description: 'ISO-8601 timestamp accepted by temporal search (as_of). Empty string or null means absent; any other non-ISO value is rejected with 400.',
|
|
189
|
+
example: '2026-01-15T12:00:00Z',
|
|
190
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file cursor-list — focused response schemas for the cursor-paginated
|
|
3
|
+
* document list / recovery / passport-feed endpoints.
|
|
4
|
+
*
|
|
5
|
+
* Split out from `schemas/responses.ts` (already at 456 non-comment
|
|
6
|
+
* LOC) so adding the cursor-list Slice 3 surface doesn't push the
|
|
7
|
+
* shared response-schema file further over the workspace's 400 LOC
|
|
8
|
+
* rule. The validate-response middleware imports these by name via
|
|
9
|
+
* `routes/response-schema-map.ts`.
|
|
10
|
+
*
|
|
11
|
+
* Wire format is snake_case end-to-end. The discriminated union on
|
|
12
|
+
* `kind` is the public shape — internal columns (embeddings, audit
|
|
13
|
+
* fields, internal metadata) are deliberately absent.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from './zod-setup.js';
|
|
16
|
+
export declare const PassportFeedResponseSchema: z.ZodObject<{
|
|
17
|
+
rows: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
|
+
kind: z.ZodLiteral<"document_grouped">;
|
|
19
|
+
document_id: z.ZodString;
|
|
20
|
+
sort_at: z.ZodString;
|
|
21
|
+
sort_id: z.ZodString;
|
|
22
|
+
representative: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
content: z.ZodString;
|
|
25
|
+
created_at: z.ZodString;
|
|
26
|
+
source_site: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
chunk_count: z.ZodNumber;
|
|
29
|
+
raw_storage_status: z.ZodEnum<{
|
|
30
|
+
blob_deleted: "blob_deleted";
|
|
31
|
+
blob_tombstoned: "blob_tombstoned";
|
|
32
|
+
blob_stored: "blob_stored";
|
|
33
|
+
blob_pending: "blob_pending";
|
|
34
|
+
blob_available: "blob_available";
|
|
35
|
+
pointer_recorded: "pointer_recorded";
|
|
36
|
+
inline_text_stored: "inline_text_stored";
|
|
37
|
+
raw_storage_failed: "raw_storage_failed";
|
|
38
|
+
blob_archival_failed: "blob_archival_failed";
|
|
39
|
+
}>;
|
|
40
|
+
extraction_status: z.ZodEnum<{
|
|
41
|
+
pending: "pending";
|
|
42
|
+
not_required: "not_required";
|
|
43
|
+
running: "running";
|
|
44
|
+
complete: "complete";
|
|
45
|
+
unsupported: "unsupported";
|
|
46
|
+
failed: "failed";
|
|
47
|
+
}>;
|
|
48
|
+
semantic_index_status: z.ZodEnum<{
|
|
49
|
+
pending: "pending";
|
|
50
|
+
not_required: "not_required";
|
|
51
|
+
running: "running";
|
|
52
|
+
complete: "complete";
|
|
53
|
+
failed: "failed";
|
|
54
|
+
stale: "stale";
|
|
55
|
+
}>;
|
|
56
|
+
last_error: z.ZodNullable<z.ZodObject<{
|
|
57
|
+
layer: z.ZodEnum<{
|
|
58
|
+
raw_storage: "raw_storage";
|
|
59
|
+
extraction: "extraction";
|
|
60
|
+
semantic_index: "semantic_index";
|
|
61
|
+
}>;
|
|
62
|
+
code: z.ZodString;
|
|
63
|
+
message: z.ZodString;
|
|
64
|
+
occurred_at: z.ZodString;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
67
|
+
mime_type: z.ZodNullable<z.ZodString>;
|
|
68
|
+
storage_provider: z.ZodNullable<z.ZodString>;
|
|
69
|
+
raw_storage_metadata: z.ZodObject<{
|
|
70
|
+
codec: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
name: z.ZodEnum<{
|
|
72
|
+
none: "none";
|
|
73
|
+
aes_gcm: "aes_gcm";
|
|
74
|
+
}>;
|
|
75
|
+
version: z.ZodNumber;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
filecoin: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
ipfs_cid: z.ZodOptional<z.ZodString>;
|
|
79
|
+
piece_cid: z.ZodOptional<z.ZodString>;
|
|
80
|
+
copy_count: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
provider_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
+
copy_statuses: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
}, z.core.$strict>>;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
delete_semantics: z.ZodNullable<z.ZodEnum<{
|
|
86
|
+
delete: "delete";
|
|
87
|
+
unpin: "unpin";
|
|
88
|
+
tombstone: "tombstone";
|
|
89
|
+
}>>;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
kind: z.ZodLiteral<"standalone_memory">;
|
|
92
|
+
sort_at: z.ZodString;
|
|
93
|
+
sort_id: z.ZodString;
|
|
94
|
+
memory: z.ZodObject<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
content: z.ZodString;
|
|
97
|
+
created_at: z.ZodString;
|
|
98
|
+
source_site: z.ZodNullable<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
}, z.core.$strip>], "kind">>;
|
|
101
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file cursor-list — focused response schemas for the cursor-paginated
|
|
3
|
+
* document list / recovery / passport-feed endpoints.
|
|
4
|
+
*
|
|
5
|
+
* Split out from `schemas/responses.ts` (already at 456 non-comment
|
|
6
|
+
* LOC) so adding the cursor-list Slice 3 surface doesn't push the
|
|
7
|
+
* shared response-schema file further over the workspace's 400 LOC
|
|
8
|
+
* rule. The validate-response middleware imports these by name via
|
|
9
|
+
* `routes/response-schema-map.ts`.
|
|
10
|
+
*
|
|
11
|
+
* Wire format is snake_case end-to-end. The discriminated union on
|
|
12
|
+
* `kind` is the public shape — internal columns (embeddings, audit
|
|
13
|
+
* fields, internal metadata) are deliberately absent.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from './zod-setup.js';
|
|
16
|
+
import { ExtractionStatusEnumSchema, LastErrorEnvelopeSchema, RawStorageStatusEnumSchema, SemanticIndexStatusEnumSchema, } from './document-status-envelope.js';
|
|
17
|
+
import { DeleteSemanticsEnumSchema, PublicRawStorageMetadataSchema, } from './document-response-schemas.js';
|
|
18
|
+
/**
|
|
19
|
+
* cursor-list — public passport-feed representative subset. Mirrors the
|
|
20
|
+
* fields a UI list-row card needs (id / content / created_at /
|
|
21
|
+
* source_site) without exposing embeddings, internal metadata, or
|
|
22
|
+
* soft-delete flags.
|
|
23
|
+
*/
|
|
24
|
+
const PassportFeedRepresentativeSchema = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
content: z.string(),
|
|
27
|
+
created_at: z.string(),
|
|
28
|
+
source_site: z.string().nullable(),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* cursor-list — `document_grouped` row: one per documentId-with-memories.
|
|
32
|
+
* Carries the chunk_count + the latest chunk as `representative` +
|
|
33
|
+
* the status-layer status envelope joined from `raw_documents`.
|
|
34
|
+
*/
|
|
35
|
+
const PassportFeedDocumentGroupedRowSchema = z.object({
|
|
36
|
+
kind: z.literal('document_grouped'),
|
|
37
|
+
document_id: z.string(),
|
|
38
|
+
sort_at: z.string(),
|
|
39
|
+
sort_id: z.string(),
|
|
40
|
+
representative: PassportFeedRepresentativeSchema,
|
|
41
|
+
chunk_count: z.number().int().nonnegative(),
|
|
42
|
+
raw_storage_status: RawStorageStatusEnumSchema,
|
|
43
|
+
extraction_status: ExtractionStatusEnumSchema,
|
|
44
|
+
semantic_index_status: SemanticIndexStatusEnumSchema,
|
|
45
|
+
last_error: LastErrorEnvelopeSchema,
|
|
46
|
+
display_name: z.string().nullable(),
|
|
47
|
+
mime_type: z.string().nullable(),
|
|
48
|
+
// public wire widening (public contract): grouped rows now carry
|
|
49
|
+
// `storage_provider` + the redacted `raw_storage_metadata` +
|
|
50
|
+
// per-row `delete_semantics` so the webapp can render
|
|
51
|
+
// provider-aware UI (CID chip, capability-driven delete copy)
|
|
52
|
+
// without an extra GET. Standalone-memory rows stay status-only.
|
|
53
|
+
storage_provider: z.string().nullable(),
|
|
54
|
+
raw_storage_metadata: PublicRawStorageMetadataSchema,
|
|
55
|
+
delete_semantics: DeleteSemanticsEnumSchema,
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* cursor-list — `standalone_memory` row: 1:1 the underlying memory
|
|
59
|
+
* (raw_document_id IS NULL). No status envelope (there is no
|
|
60
|
+
* document) and no `chunk_count` on the wire — the public shape
|
|
61
|
+
* exposes the memory verbatim so consumers branch on `kind`
|
|
62
|
+
* instead of trying to render the two row kinds with the same
|
|
63
|
+
* field set.
|
|
64
|
+
*/
|
|
65
|
+
const PassportFeedStandaloneMemoryRowSchema = z.object({
|
|
66
|
+
kind: z.literal('standalone_memory'),
|
|
67
|
+
sort_at: z.string(),
|
|
68
|
+
sort_id: z.string(),
|
|
69
|
+
memory: PassportFeedRepresentativeSchema,
|
|
70
|
+
});
|
|
71
|
+
const PassportFeedRowSchema = z
|
|
72
|
+
.discriminatedUnion('kind', [
|
|
73
|
+
PassportFeedDocumentGroupedRowSchema,
|
|
74
|
+
PassportFeedStandaloneMemoryRowSchema,
|
|
75
|
+
])
|
|
76
|
+
.openapi({ description: 'Passport-feed row (document_grouped or standalone_memory).' });
|
|
77
|
+
export const PassportFeedResponseSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
rows: z.array(PassportFeedRowSchema),
|
|
80
|
+
next_cursor: z.string().nullable(),
|
|
81
|
+
})
|
|
82
|
+
.openapi({
|
|
83
|
+
description: 'Passport feed: grouped memory-backed document rows + ' +
|
|
84
|
+
'1:1 standalone memory rows, unioned and ordered by ' +
|
|
85
|
+
'(sort_at DESC, sort_id DESC). `next_cursor` is the opaque ' +
|
|
86
|
+
'continuation cursor; null indicates the stream is exhausted.',
|
|
87
|
+
});
|