@segmentstream/ontology 0.0.0-stage → 0.92.1
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/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +1655 -2
- package/dist/action.d.ts +193 -0
- package/dist/action.js +41 -0
- package/dist/agent-chat.d.ts +44 -0
- package/dist/agent-chat.js +91 -0
- package/dist/agent-task-contract.d.ts +64 -0
- package/dist/agent-task-contract.js +15 -0
- package/dist/agent-task.d.ts +39 -0
- package/dist/agent-task.js +112 -0
- package/dist/analyze.d.ts +215 -0
- package/dist/analyze.js +2438 -0
- package/dist/app-feedback.d.ts +167 -0
- package/dist/app-feedback.js +176 -0
- package/dist/authoring-input.d.ts +3 -0
- package/dist/authoring-input.js +107 -0
- package/dist/authoring-names.d.ts +4 -0
- package/dist/authoring-names.js +13 -0
- package/dist/authoring-records.d.ts +35 -0
- package/dist/authoring-records.js +264 -0
- package/dist/authoring.d.ts +15 -0
- package/dist/authoring.js +331 -0
- package/dist/bin/check.d.ts +30 -0
- package/dist/bin/check.js +99 -0
- package/dist/bin/load.d.ts +48 -0
- package/dist/bin/load.js +139 -0
- package/dist/bin/main.d.ts +31 -0
- package/dist/bin/main.js +121 -0
- package/dist/bin/migrate.d.ts +57 -0
- package/dist/bin/migrate.js +170 -0
- package/dist/bin/output.d.ts +31 -0
- package/dist/bin/output.js +84 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +31 -0
- package/dist/blob.d.ts +52 -0
- package/dist/blob.js +87 -0
- package/dist/channel-session.d.ts +16 -0
- package/dist/channel-session.js +16 -0
- package/dist/chat.d.ts +43 -0
- package/dist/chat.js +34 -0
- package/dist/confirmation.d.ts +46 -0
- package/dist/confirmation.js +41 -0
- package/dist/connection.d.ts +213 -0
- package/dist/connection.js +289 -0
- package/dist/deployment.d.ts +35 -0
- package/dist/deployment.js +76 -0
- package/dist/diagnostics.d.ts +27 -0
- package/dist/diagnostics.js +106 -0
- package/dist/emails.d.ts +70 -0
- package/dist/emails.js +221 -0
- package/dist/entity.d.ts +331 -0
- package/dist/entity.js +153 -0
- package/dist/errors.d.ts +154 -0
- package/dist/errors.js +109 -0
- package/dist/feedback-config.d.ts +24 -0
- package/dist/feedback-config.js +126 -0
- package/dist/files.d.ts +39 -0
- package/dist/files.js +4 -0
- package/dist/groups.d.ts +95 -0
- package/dist/groups.js +280 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +70 -0
- package/dist/internal/diagnostics.js +594 -0
- package/dist/legacy.d.ts +160 -0
- package/dist/legacy.js +270 -0
- package/dist/manifest-compatibility.d.ts +8 -0
- package/dist/manifest-compatibility.js +87 -0
- package/dist/manifest.d.ts +3329 -0
- package/dist/manifest.js +757 -0
- package/dist/me.d.ts +46 -0
- package/dist/me.js +109 -0
- package/dist/metric-filters.d.ts +48 -0
- package/dist/metric-filters.js +252 -0
- package/dist/metric-routes.d.ts +132 -0
- package/dist/metric-routes.js +498 -0
- package/dist/metric.d.ts +172 -0
- package/dist/metric.js +132 -0
- package/dist/migrate/apply.d.ts +94 -0
- package/dist/migrate/apply.js +526 -0
- package/dist/migrate/errors.d.ts +46 -0
- package/dist/migrate/errors.js +38 -0
- package/dist/migrate/index.d.ts +10 -0
- package/dist/migrate/index.js +7 -0
- package/dist/migrate/model.d.ts +2311 -0
- package/dist/migrate/model.js +148 -0
- package/dist/migrate/plan.d.ts +51 -0
- package/dist/migrate/plan.js +1856 -0
- package/dist/migrate/preview.d.ts +13 -0
- package/dist/migrate/preview.js +65 -0
- package/dist/migrate/storage.d.ts +226 -0
- package/dist/migrate/storage.js +774 -0
- package/dist/model-metrics.d.ts +22 -0
- package/dist/model-metrics.js +545 -0
- package/dist/names.d.ts +49 -0
- package/dist/names.js +110 -0
- package/dist/navigation-artifact.d.ts +13 -0
- package/dist/navigation-artifact.js +11 -0
- package/dist/navigation-catalog.d.ts +55 -0
- package/dist/navigation-catalog.js +297 -0
- package/dist/nitro-navigation.d.ts +3 -0
- package/dist/nitro-navigation.js +64 -0
- package/dist/nitro-workflows.d.ts +108 -0
- package/dist/nitro-workflows.js +286 -0
- package/dist/nitro.d.ts +40 -0
- package/dist/nitro.js +50 -0
- package/dist/ontology.d.ts +41 -0
- package/dist/ontology.js +46 -0
- package/dist/permissions.d.ts +198 -0
- package/dist/permissions.js +272 -0
- package/dist/property.d.ts +188 -0
- package/dist/property.js +301 -0
- package/dist/query.d.ts +245 -0
- package/dist/query.js +615 -0
- package/dist/relationship.d.ts +99 -0
- package/dist/relationship.js +33 -0
- package/dist/render.d.ts +81 -0
- package/dist/render.js +512 -0
- package/dist/replication/baseline.d.ts +51 -0
- package/dist/replication/baseline.js +215 -0
- package/dist/replication/bigquery.d.ts +37 -0
- package/dist/replication/bigquery.js +211 -0
- package/dist/replication/coverage.d.ts +14 -0
- package/dist/replication/coverage.js +53 -0
- package/dist/replication/evolution.d.ts +25 -0
- package/dist/replication/evolution.js +184 -0
- package/dist/replication/identities.d.ts +6 -0
- package/dist/replication/identities.js +47 -0
- package/dist/replication/legacy-baseline.d.ts +27 -0
- package/dist/replication/legacy-baseline.js +109 -0
- package/dist/replication/legacy-store.d.ts +19 -0
- package/dist/replication/legacy-store.js +63 -0
- package/dist/replication/lineage.d.ts +36 -0
- package/dist/replication/lineage.js +72 -0
- package/dist/replication/migrate.d.ts +21 -0
- package/dist/replication/migrate.js +84 -0
- package/dist/replication/model.d.ts +52 -0
- package/dist/replication/model.js +99 -0
- package/dist/replication/scans.d.ts +34 -0
- package/dist/replication/scans.js +158 -0
- package/dist/replication/schema.d.ts +11 -0
- package/dist/replication/schema.js +226 -0
- package/dist/replication/shadow-schema.d.ts +4 -0
- package/dist/replication/shadow-schema.js +61 -0
- package/dist/replication/shadow.d.ts +127 -0
- package/dist/replication/shadow.js +614 -0
- package/dist/replication/source-replacement.d.ts +33 -0
- package/dist/replication/source-replacement.js +76 -0
- package/dist/replication/store.d.ts +36 -0
- package/dist/replication/store.js +382 -0
- package/dist/replication/transaction.d.ts +23 -0
- package/dist/replication/transaction.js +88 -0
- package/dist/role.d.ts +61 -0
- package/dist/role.js +76 -0
- package/dist/runtime/action-deadlocks.d.ts +21 -0
- package/dist/runtime/action-deadlocks.js +130 -0
- package/dist/runtime/action-transactions.d.ts +35 -0
- package/dist/runtime/action-transactions.js +54 -0
- package/dist/runtime/agent-counters.d.ts +26 -0
- package/dist/runtime/agent-counters.js +98 -0
- package/dist/runtime/agent-tasks.d.ts +63 -0
- package/dist/runtime/agent-tasks.js +120 -0
- package/dist/runtime/agents.d.ts +15 -0
- package/dist/runtime/agents.js +457 -0
- package/dist/runtime/batch-diagnostics.d.ts +22 -0
- package/dist/runtime/batch-diagnostics.js +89 -0
- package/dist/runtime/batch.d.ts +52 -0
- package/dist/runtime/batch.js +534 -0
- package/dist/runtime/channel-session-revocation.d.ts +3 -0
- package/dist/runtime/channel-session-revocation.js +5 -0
- package/dist/runtime/channel-sessions.d.ts +4 -0
- package/dist/runtime/channel-sessions.js +61 -0
- package/dist/runtime/confirmations.d.ts +29 -0
- package/dist/runtime/confirmations.js +57 -0
- package/dist/runtime/cursor.d.ts +23 -0
- package/dist/runtime/cursor.js +100 -0
- package/dist/runtime/deployment.d.ts +7 -0
- package/dist/runtime/deployment.js +4 -0
- package/dist/runtime/errors.d.ts +118 -0
- package/dist/runtime/errors.js +109 -0
- package/dist/runtime/federation-tables.d.ts +2 -0
- package/dist/runtime/federation-tables.js +20 -0
- package/dist/runtime/federation.d.ts +42 -0
- package/dist/runtime/federation.js +222 -0
- package/dist/runtime/files.d.ts +39 -0
- package/dist/runtime/files.js +44 -0
- package/dist/runtime/generated-actions.d.ts +37 -0
- package/dist/runtime/generated-actions.js +307 -0
- package/dist/runtime/history.d.ts +91 -0
- package/dist/runtime/history.js +77 -0
- package/dist/runtime/ids.d.ts +6 -0
- package/dist/runtime/ids.js +39 -0
- package/dist/runtime/member-tables.d.ts +8 -0
- package/dist/runtime/member-tables.js +33 -0
- package/dist/runtime/member-writes.d.ts +78 -0
- package/dist/runtime/member-writes.js +202 -0
- package/dist/runtime/metric-query.d.ts +19 -0
- package/dist/runtime/metric-query.js +411 -0
- package/dist/runtime/model.d.ts +67 -0
- package/dist/runtime/model.js +150 -0
- package/dist/runtime/new-user-hook.d.ts +6 -0
- package/dist/runtime/new-user-hook.js +37 -0
- package/dist/runtime/oauth.d.ts +9 -0
- package/dist/runtime/oauth.js +299 -0
- package/dist/runtime/pipeline.d.ts +155 -0
- package/dist/runtime/pipeline.js +597 -0
- package/dist/runtime/postgres-tls.d.ts +10 -0
- package/dist/runtime/postgres-tls.js +14 -0
- package/dist/runtime/principals.d.ts +302 -0
- package/dist/runtime/principals.js +1307 -0
- package/dist/runtime/reads.d.ts +55 -0
- package/dist/runtime/reads.js +313 -0
- package/dist/runtime/records.d.ts +42 -0
- package/dist/runtime/records.js +245 -0
- package/dist/runtime/resolve-agent-identity.d.ts +6 -0
- package/dist/runtime/resolve-agent-identity.js +181 -0
- package/dist/runtime/service-binding.d.ts +18 -0
- package/dist/runtime/service-binding.js +266 -0
- package/dist/runtime/sign-in-links.d.ts +68 -0
- package/dist/runtime/sign-in-links.js +147 -0
- package/dist/runtime/sql-runtime.d.ts +131 -0
- package/dist/runtime/sql-runtime.js +362 -0
- package/dist/runtime/statement.d.ts +18 -0
- package/dist/runtime/statement.js +31 -0
- package/dist/runtime/user-identities.d.ts +66 -0
- package/dist/runtime/user-identities.js +106 -0
- package/dist/runtime/user-identity-sql.d.ts +86 -0
- package/dist/runtime/user-identity-sql.js +297 -0
- package/dist/runtime/user-roles.d.ts +16 -0
- package/dist/runtime/user-roles.js +32 -0
- package/dist/runtime/validation.d.ts +16 -0
- package/dist/runtime/validation.js +26 -0
- package/dist/runtime/where.d.ts +57 -0
- package/dist/runtime/where.js +404 -0
- package/dist/runtime/workflow-admission.d.ts +49 -0
- package/dist/runtime/workflow-admission.js +92 -0
- package/dist/runtime/workflow-argument-codec.d.ts +10 -0
- package/dist/runtime/workflow-argument-codec.js +120 -0
- package/dist/runtime/workflow-arguments.d.ts +17 -0
- package/dist/runtime/workflow-arguments.js +99 -0
- package/dist/runtime/workflow-starts.d.ts +203 -0
- package/dist/runtime/workflow-starts.js +493 -0
- package/dist/runtime/workflow-users.d.ts +9 -0
- package/dist/runtime/workflow-users.js +17 -0
- package/dist/runtime/workload.d.ts +25 -0
- package/dist/runtime/workload.js +24 -0
- package/dist/runtime/writes.d.ts +108 -0
- package/dist/runtime/writes.js +491 -0
- package/dist/runtime-source.d.ts +22 -0
- package/dist/runtime-source.js +28 -0
- package/dist/runtime.d.ts +310 -0
- package/dist/runtime.js +31 -0
- package/dist/server.d.ts +23 -0
- package/dist/server.js +107 -0
- package/dist/service/agent/attachments.d.ts +33 -0
- package/dist/service/agent/attachments.js +228 -0
- package/dist/service/agent/authentication.d.ts +22 -0
- package/dist/service/agent/authentication.js +58 -0
- package/dist/service/agent/confirmations.d.ts +5 -0
- package/dist/service/agent/confirmations.js +73 -0
- package/dist/service/agent/conversation-routes.d.ts +14 -0
- package/dist/service/agent/conversation-routes.js +45 -0
- package/dist/service/agent/conversations.d.ts +40 -0
- package/dist/service/agent/conversations.js +69 -0
- package/dist/service/agent/files.d.ts +12 -0
- package/dist/service/agent/files.js +69 -0
- package/dist/service/agent/protocol.d.ts +90 -0
- package/dist/service/agent/protocol.js +114 -0
- package/dist/service/agent/server.d.ts +28 -0
- package/dist/service/agent/server.js +374 -0
- package/dist/service/agent/task-caller.d.ts +21 -0
- package/dist/service/agent/task-caller.js +35 -0
- package/dist/service/agent/task-start.d.ts +53 -0
- package/dist/service/agent/task-start.js +161 -0
- package/dist/service/agent/tasks.d.ts +40 -0
- package/dist/service/agent/tasks.js +155 -0
- package/dist/service/api.d.ts +50 -0
- package/dist/service/api.js +288 -0
- package/dist/service/authentication.d.ts +227 -0
- package/dist/service/authentication.js +767 -0
- package/dist/service/caller-context.d.ts +24 -0
- package/dist/service/caller-context.js +6 -0
- package/dist/service/catalog.d.ts +42 -0
- package/dist/service/catalog.js +66 -0
- package/dist/service/channel/provider.d.ts +10 -0
- package/dist/service/channel/provider.js +1 -0
- package/dist/service/channel/providers/telegram.d.ts +18 -0
- package/dist/service/channel/providers/telegram.js +108 -0
- package/dist/service/channel/sessions.d.ts +5 -0
- package/dist/service/channel/sessions.js +53 -0
- package/dist/service/channel/sign-in.d.ts +7 -0
- package/dist/service/channel/sign-in.js +78 -0
- package/dist/service/chat/archive.d.ts +64 -0
- package/dist/service/chat/archive.js +62 -0
- package/dist/service/chat/attribution.d.ts +26 -0
- package/dist/service/chat/attribution.js +28 -0
- package/dist/service/chat/delivery.d.ts +18 -0
- package/dist/service/chat/delivery.js +251 -0
- package/dist/service/chat/diagnostics.d.ts +2 -0
- package/dist/service/chat/diagnostics.js +35 -0
- package/dist/service/chat/envelope.d.ts +96 -0
- package/dist/service/chat/envelope.js +39 -0
- package/dist/service/chat/idempotency.d.ts +19 -0
- package/dist/service/chat/idempotency.js +37 -0
- package/dist/service/chat/providers/telegram.d.ts +36 -0
- package/dist/service/chat/providers/telegram.js +133 -0
- package/dist/service/chat/reads.d.ts +25 -0
- package/dist/service/chat/reads.js +75 -0
- package/dist/service/chat/resolve.d.ts +34 -0
- package/dist/service/chat/resolve.js +150 -0
- package/dist/service/chat/routes.d.ts +23 -0
- package/dist/service/chat/routes.js +75 -0
- package/dist/service/chat/schemas.d.ts +43 -0
- package/dist/service/chat/schemas.js +31 -0
- package/dist/service/config.d.ts +218 -0
- package/dist/service/config.js +265 -0
- package/dist/service/connection-stream.d.ts +10 -0
- package/dist/service/connection-stream.js +191 -0
- package/dist/service/connections.d.ts +60 -0
- package/dist/service/connections.js +271 -0
- package/dist/service/decisions.d.ts +35 -0
- package/dist/service/decisions.js +63 -0
- package/dist/service/descriptions.d.ts +8 -0
- package/dist/service/descriptions.js +20 -0
- package/dist/service/discovery-schemas.d.ts +92 -0
- package/dist/service/discovery-schemas.js +59 -0
- package/dist/service/discovery-search.d.ts +30 -0
- package/dist/service/discovery-search.js +95 -0
- package/dist/service/discovery.d.ts +37 -0
- package/dist/service/discovery.js +436 -0
- package/dist/service/docs.d.ts +9 -0
- package/dist/service/docs.js +197 -0
- package/dist/service/errors.d.ts +145 -0
- package/dist/service/errors.js +704 -0
- package/dist/service/federation-provider.d.ts +36 -0
- package/dist/service/federation-provider.js +110 -0
- package/dist/service/federation-server.d.ts +20 -0
- package/dist/service/federation-server.js +249 -0
- package/dist/service/federation-status.d.ts +40 -0
- package/dist/service/federation-status.js +151 -0
- package/dist/service/handlers.d.ts +18 -0
- package/dist/service/handlers.js +287 -0
- package/dist/service/mcp/confirmation.d.ts +68 -0
- package/dist/service/mcp/confirmation.js +178 -0
- package/dist/service/mcp/find-input.d.ts +12 -0
- package/dist/service/mcp/find-input.js +122 -0
- package/dist/service/mcp/input-schema.d.ts +6 -0
- package/dist/service/mcp/input-schema.js +126 -0
- package/dist/service/mcp/listing.d.ts +26 -0
- package/dist/service/mcp/listing.js +92 -0
- package/dist/service/mcp/metric-tools.d.ts +85 -0
- package/dist/service/mcp/metric-tools.js +258 -0
- package/dist/service/mcp/request-log.d.ts +5 -0
- package/dist/service/mcp/request-log.js +53 -0
- package/dist/service/mcp/runtime-policy.d.ts +27 -0
- package/dist/service/mcp/runtime-policy.js +62 -0
- package/dist/service/mcp/server.d.ts +52 -0
- package/dist/service/mcp/server.js +861 -0
- package/dist/service/mcp/tools.d.ts +99 -0
- package/dist/service/mcp/tools.js +938 -0
- package/dist/service/member-file-routes.d.ts +22 -0
- package/dist/service/member-file-routes.js +52 -0
- package/dist/service/member-files.d.ts +245 -0
- package/dist/service/member-files.js +258 -0
- package/dist/service/metric-query-platform.d.ts +77 -0
- package/dist/service/metric-query-platform.js +198 -0
- package/dist/service/metric-query-scopes.d.ts +43 -0
- package/dist/service/metric-query-scopes.js +147 -0
- package/dist/service/metric-query.d.ts +48 -0
- package/dist/service/metric-query.js +200 -0
- package/dist/service/name-suggestions.d.ts +3 -0
- package/dist/service/name-suggestions.js +38 -0
- package/dist/service/navigation-schemas.d.ts +80 -0
- package/dist/service/navigation-schemas.js +49 -0
- package/dist/service/navigation.d.ts +20 -0
- package/dist/service/navigation.js +165 -0
- package/dist/service/oauth/protocol.d.ts +70 -0
- package/dist/service/oauth/protocol.js +157 -0
- package/dist/service/oauth/refresh-replay.d.ts +2 -0
- package/dist/service/oauth/refresh-replay.js +20 -0
- package/dist/service/oauth/server.d.ts +28 -0
- package/dist/service/oauth/server.js +769 -0
- package/dist/service/operations.d.ts +170 -0
- package/dist/service/operations.js +392 -0
- package/dist/service/plan.d.ts +57 -0
- package/dist/service/plan.js +96 -0
- package/dist/service/rate-limit.d.ts +22 -0
- package/dist/service/rate-limit.js +52 -0
- package/dist/service/record-reads.d.ts +21 -0
- package/dist/service/record-reads.js +155 -0
- package/dist/service/replication.d.ts +5 -0
- package/dist/service/replication.js +39 -0
- package/dist/service/runtime-contract.d.ts +508 -0
- package/dist/service/runtime-contract.js +18 -0
- package/dist/service/runtime-identity.d.ts +71 -0
- package/dist/service/runtime-identity.js +122 -0
- package/dist/service/schemas.d.ts +961 -0
- package/dist/service/schemas.js +639 -0
- package/dist/service/service.d.ts +21 -0
- package/dist/service/service.js +526 -0
- package/dist/service/warehouse-platform.d.ts +17 -0
- package/dist/service/warehouse-platform.js +122 -0
- package/dist/service/warehouse-query.d.ts +24 -0
- package/dist/service/warehouse-query.js +280 -0
- package/dist/service/webhooks.d.ts +106 -0
- package/dist/service/webhooks.js +233 -0
- package/dist/service/workflow-admission-provider.d.ts +31 -0
- package/dist/service/workflow-admission-provider.js +205 -0
- package/dist/service/workflow-argument-serialization.d.ts +2 -0
- package/dist/service/workflow-argument-serialization.js +14 -0
- package/dist/service/workflow-callback.d.ts +22 -0
- package/dist/service/workflow-callback.js +75 -0
- package/dist/service/workflow-deployment.d.ts +8 -0
- package/dist/service/workflow-deployment.js +131 -0
- package/dist/service/workflow-diagnostics.d.ts +23 -0
- package/dist/service/workflow-diagnostics.js +263 -0
- package/dist/service/workflow-errors.d.ts +26 -0
- package/dist/service/workflow-errors.js +181 -0
- package/dist/service/workflow-logging.d.ts +2 -0
- package/dist/service/workflow-logging.js +50 -0
- package/dist/service/workflow-queue-fence.d.ts +6 -0
- package/dist/service/workflow-queue-fence.js +66 -0
- package/dist/service/workflows.d.ts +200 -0
- package/dist/service/workflows.js +1549 -0
- package/dist/sign-in.d.ts +58 -0
- package/dist/sign-in.js +57 -0
- package/dist/source.d.ts +30 -0
- package/dist/source.js +107 -0
- package/dist/start-recovery-contract.d.ts +49 -0
- package/dist/start-recovery-contract.js +26 -0
- package/dist/start-recovery.d.ts +27 -0
- package/dist/start-recovery.js +81 -0
- package/dist/storage/api.d.ts +4 -0
- package/dist/storage/api.js +40 -0
- package/dist/storage/attachments.d.ts +146 -0
- package/dist/storage/attachments.js +733 -0
- package/dist/storage/authorization.d.ts +38 -0
- package/dist/storage/authorization.js +83 -0
- package/dist/storage/file-access.d.ts +17 -0
- package/dist/storage/file-access.js +8 -0
- package/dist/storage/limits.d.ts +12 -0
- package/dist/storage/limits.js +17 -0
- package/dist/storage/maintenance-auth.d.ts +20 -0
- package/dist/storage/maintenance-auth.js +24 -0
- package/dist/storage/maintenance.d.ts +11 -0
- package/dist/storage/maintenance.js +67 -0
- package/dist/storage/neon.d.ts +4 -0
- package/dist/storage/neon.js +318 -0
- package/dist/storage/operator.d.ts +11 -0
- package/dist/storage/operator.js +30 -0
- package/dist/storage/provider.d.ts +93 -0
- package/dist/storage/provider.js +36 -0
- package/dist/storage/sessions.d.ts +184 -0
- package/dist/storage/sessions.js +688 -0
- package/dist/storage/tables.d.ts +54 -0
- package/dist/storage/tables.js +205 -0
- package/dist/storage/transfers.d.ts +16 -0
- package/dist/storage/transfers.js +153 -0
- package/dist/storage/writes.d.ts +7 -0
- package/dist/storage/writes.js +88 -0
- package/dist/telegram.d.ts +35 -0
- package/dist/telegram.js +173 -0
- package/dist/user-identity.d.ts +28 -0
- package/dist/user-identity.js +106 -0
- package/dist/user.d.ts +75 -0
- package/dist/user.js +111 -0
- package/dist/warehouse-backed.d.ts +6 -0
- package/dist/warehouse-backed.js +495 -0
- package/dist/webhook-token.d.ts +11 -0
- package/dist/webhook-token.js +18 -0
- package/dist/webhooks.d.ts +40 -0
- package/dist/webhooks.js +55 -0
- package/dist/wire.d.ts +10 -0
- package/dist/wire.js +35 -0
- package/dist/workflow-runtime.d.ts +116 -0
- package/dist/workflow-runtime.js +109 -0
- package/dist/workflow-topics.d.ts +28 -0
- package/dist/workflow-topics.js +28 -0
- package/dist/workflow.d.ts +284 -0
- package/dist/workflow.js +259 -0
- package/dist/workflows.d.ts +24 -0
- package/dist/workflows.js +18 -0
- package/package.json +127 -4
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import type { ActionRuntime } from "../runtime-source.js";
|
|
2
|
+
import type { ConfirmationStore } from "../runtime/confirmations.js";
|
|
3
|
+
import { Context, Schema, type Effect, type Layer, type Redacted } from "effect";
|
|
4
|
+
import type { AttachmentRuntime } from "../storage/attachments.js";
|
|
5
|
+
import type { BlobRuntime } from "../storage/sessions.js";
|
|
6
|
+
import type { BlobStorageBinding } from "../storage/provider.js";
|
|
7
|
+
import type { AnyAction } from "../action.js";
|
|
8
|
+
import type { ResolvedEntity } from "../analyze.js";
|
|
9
|
+
import type { ConnectionError, ConnectionTransport } from "../connection.js";
|
|
10
|
+
import type { ActionError, DeploymentInterrupted, NotFound } from "../errors.js";
|
|
11
|
+
import type { Ontology } from "../ontology.js";
|
|
12
|
+
import type { Query, QueryResult } from "../query.js";
|
|
13
|
+
import type { AgentTaskStore } from "../runtime/agent-tasks.js";
|
|
14
|
+
import type { InvalidQuery, TriggerInputInvalid, WorkflowRecoveryUnavailable } from "../runtime/errors.js";
|
|
15
|
+
import type { InvalidStartsCursor, SweepResult, WorkflowStarter, WorkflowStartsPage } from "../runtime/workflow-starts.js";
|
|
16
|
+
import type { HistoryEntry } from "../runtime/history.js";
|
|
17
|
+
import type { ActionOutcome, CommittedAction } from "../runtime/pipeline.js";
|
|
18
|
+
import type { Principal, StoredRecord } from "../runtime.js";
|
|
19
|
+
import type { SignInCheck } from "../sign-in.js";
|
|
20
|
+
/**
|
|
21
|
+
* What the HTTP service needs from the SQL runtime in `src/runtime`, bound to one ontology and one
|
|
22
|
+
* database. `src/runtime/service-binding.ts` implements it; the service only calls it, and tests
|
|
23
|
+
* substitute it.
|
|
24
|
+
*/
|
|
25
|
+
export interface RunActionInput {
|
|
26
|
+
readonly runtime?: ActionRuntime;
|
|
27
|
+
readonly entity: string;
|
|
28
|
+
readonly action: string;
|
|
29
|
+
/** The input as the caller sent it. `runAction` validates it against the action's input schema. */
|
|
30
|
+
readonly input: unknown;
|
|
31
|
+
readonly principal: Principal;
|
|
32
|
+
readonly options: {
|
|
33
|
+
readonly validateOnly?: boolean;
|
|
34
|
+
readonly idempotencyKey?: string;
|
|
35
|
+
readonly createIntent?: string;
|
|
36
|
+
/** Describe the action's confirmation in this chat language instead of running it. */
|
|
37
|
+
readonly confirm?: {
|
|
38
|
+
readonly locale: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Runs once the action has committed, outside its transaction, before `runAction` returns. It
|
|
43
|
+
* reports its own failures: the action stays committed whatever it does.
|
|
44
|
+
*/
|
|
45
|
+
readonly afterCommit?: (committed: CommittedAction) => Effect.Effect<void>;
|
|
46
|
+
/** The request id, which `prepare` and the handler receive for logs. */
|
|
47
|
+
readonly requestId?: string;
|
|
48
|
+
/** Sends the calls of the action's `prepare` to its declared connections, bound to this request. */
|
|
49
|
+
readonly connections?: ConnectionTransport["Service"];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `generatedActions(entity, ontology)`: `create`, `update`, `delete`, `upsert_by_<property>`, `link`
|
|
53
|
+
* and `unlink`, as `src/runtime/generated-actions.ts` derives them.
|
|
54
|
+
*/
|
|
55
|
+
export type GeneratedActionsProvider = (entity: ResolvedEntity, ontology: Ontology) => Readonly<Record<string, AnyAction>>;
|
|
56
|
+
/**
|
|
57
|
+
* Who verified a member's token: the workspace's Neon Auth, or SegmentStream, whose app tokens stay
|
|
58
|
+
* accepted while workspaces move to Neon Auth.
|
|
59
|
+
*/
|
|
60
|
+
export type IdentityProvider = "neon-auth" | "segmentstream";
|
|
61
|
+
/** A member verified by their token. */
|
|
62
|
+
export interface SignInIdentity {
|
|
63
|
+
readonly provider: IdentityProvider;
|
|
64
|
+
readonly oidcIdentity?: {
|
|
65
|
+
readonly issuer: string;
|
|
66
|
+
readonly subject: string;
|
|
67
|
+
};
|
|
68
|
+
/** The token's subject: the member's Neon Auth user id, or their WorkOS user id. */
|
|
69
|
+
readonly subject: string;
|
|
70
|
+
/** An address the provider verified; sign-in links the member invited with it. */
|
|
71
|
+
readonly email?: string;
|
|
72
|
+
readonly name?: string;
|
|
73
|
+
}
|
|
74
|
+
declare const NotInvited_base: Schema.Class<NotInvited, Schema.TaggedStruct<"NotInvited", {
|
|
75
|
+
readonly message: Schema.String;
|
|
76
|
+
}>, import("effect/Cause").YieldableError>;
|
|
77
|
+
/**
|
|
78
|
+
* The sign-in policy is `invited` and nobody invited this person: no user has their identity or
|
|
79
|
+
* their email. Unlike other rejections the caller is told, so that the app can say what to do.
|
|
80
|
+
*/
|
|
81
|
+
export declare class NotInvited extends NotInvited_base {
|
|
82
|
+
}
|
|
83
|
+
/** How a client proves itself at the token endpoint; `none` for a public client, with PKCE only. */
|
|
84
|
+
export type OAuthClientAuthMethod = "none" | "client_secret_post" | "client_secret_basic";
|
|
85
|
+
/** A client that registered itself to connect an agent (RFC 7591 dynamic registration). */
|
|
86
|
+
export interface OAuthClient {
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly redirectUris: ReadonlyArray<string>;
|
|
90
|
+
readonly authMethod: OAuthClientAuthMethod;
|
|
91
|
+
/** SHA-256 of a confidential client's secret; null for a public client. */
|
|
92
|
+
readonly secretHash: string | null;
|
|
93
|
+
readonly clientUri: string | null;
|
|
94
|
+
}
|
|
95
|
+
/** An authorization request waiting, for a few minutes, for a member's consent. */
|
|
96
|
+
export interface OAuthRequest {
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly clientId: string;
|
|
99
|
+
readonly redirectUri: string;
|
|
100
|
+
readonly state: string | null;
|
|
101
|
+
/** The PKCE S256 challenge the token request must answer. */
|
|
102
|
+
readonly codeChallenge: string;
|
|
103
|
+
readonly scope: string;
|
|
104
|
+
/** The MCP server the tokens are for (RFC 8707). */
|
|
105
|
+
readonly resource: string;
|
|
106
|
+
readonly expiresAt: Date;
|
|
107
|
+
}
|
|
108
|
+
/** RFC 8628 authorization. Both codes are stored as hashes. */
|
|
109
|
+
export interface OAuthDevice {
|
|
110
|
+
readonly hash: string;
|
|
111
|
+
readonly userCodeHash: string;
|
|
112
|
+
readonly clientId: string;
|
|
113
|
+
readonly scope: string;
|
|
114
|
+
readonly resource: string;
|
|
115
|
+
readonly expiresAt: Date;
|
|
116
|
+
readonly interval: number;
|
|
117
|
+
readonly status: "pending" | "approved" | "denied" | "consumed";
|
|
118
|
+
readonly userId: string | null;
|
|
119
|
+
}
|
|
120
|
+
export type DevicePoll = {
|
|
121
|
+
readonly status: "approved";
|
|
122
|
+
readonly device: OAuthDevice;
|
|
123
|
+
} | {
|
|
124
|
+
readonly status: "authorization_pending" | "slow_down" | "access_denied" | "expired_token" | "invalid_grant";
|
|
125
|
+
};
|
|
126
|
+
/** What a member allowed a client to do. Its tokens stop working once it is revoked. */
|
|
127
|
+
export interface OAuthGrant {
|
|
128
|
+
readonly id: string;
|
|
129
|
+
readonly clientId: string;
|
|
130
|
+
readonly userId: string;
|
|
131
|
+
readonly scope: string;
|
|
132
|
+
readonly resource: string;
|
|
133
|
+
/** Present on access-token lookup, for absolute session expiry. */
|
|
134
|
+
readonly expiresAt?: Date;
|
|
135
|
+
/** Verified live identity binding, never client-supplied provenance. */
|
|
136
|
+
readonly identityProvider?: string;
|
|
137
|
+
}
|
|
138
|
+
export type OAuthTokenKind = "code" | "access" | "refresh";
|
|
139
|
+
/** A code or token of a grant, stored only as the SHA-256 of its value. */
|
|
140
|
+
export interface OAuthToken {
|
|
141
|
+
readonly hash: string;
|
|
142
|
+
readonly grantId: string;
|
|
143
|
+
readonly kind: OAuthTokenKind;
|
|
144
|
+
readonly expiresAt: Date;
|
|
145
|
+
/** For a code: the redirect URI it was sent to, which the token request must repeat. */
|
|
146
|
+
readonly redirectUri?: string;
|
|
147
|
+
/** For a code: the PKCE challenge the token request's verifier must answer. */
|
|
148
|
+
readonly codeChallenge?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* A consumed code or refresh token. An unused immediate successor can be recovered; consumption
|
|
152
|
+
* of that successor proves reuse of an older generation.
|
|
153
|
+
*/
|
|
154
|
+
export type UsedOAuthToken = {
|
|
155
|
+
readonly status: "valid";
|
|
156
|
+
readonly token: OAuthToken;
|
|
157
|
+
readonly grant: OAuthGrant;
|
|
158
|
+
} | {
|
|
159
|
+
readonly status: "reused";
|
|
160
|
+
readonly grant: OAuthGrant;
|
|
161
|
+
/** True only with evidence of a consumed successor; missing recovery state is inconclusive. */
|
|
162
|
+
readonly successorUsed?: boolean;
|
|
163
|
+
} | {
|
|
164
|
+
readonly status: "invalid";
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Where the MCP server's authorization server keeps clients, pending requests, grants and tokens:
|
|
168
|
+
* the runtime's OAuth tables in the workspace database. Expiry is checked against the database's
|
|
169
|
+
* clock; failures are defects.
|
|
170
|
+
*/
|
|
171
|
+
export interface OAuthStore {
|
|
172
|
+
/** Locks a token row and commits consuming it, saving successors and replay together. */
|
|
173
|
+
readonly withTokenLock: <A>(hash: string, effect: Effect.Effect<A>) => Effect.Effect<A>;
|
|
174
|
+
/** Recovers an unexpired predecessor's unused successor, locking it until the transaction ends. */
|
|
175
|
+
readonly refreshReplay: (hash: string, graceMs: number) => Effect.Effect<string | undefined>;
|
|
176
|
+
readonly saveRefreshReplay: (hash: string, encrypted: string, successorHash: string) => Effect.Effect<void>;
|
|
177
|
+
readonly saveDevice: (device: OAuthDevice) => Effect.Effect<boolean>;
|
|
178
|
+
/** The device for a user code, whatever its status or expiry, until cleanup removes it. */
|
|
179
|
+
readonly findDevice: (userCodeHash: string) => Effect.Effect<OAuthDevice | undefined>;
|
|
180
|
+
/** Durable per-member verification budget, including invalid codes. */
|
|
181
|
+
readonly deviceAttempt: (memberId: string) => Effect.Effect<boolean>;
|
|
182
|
+
readonly decideDevice: (userCodeHash: string, userId: string, scope: string | undefined, decision: "approve" | "deny") => Effect.Effect<boolean>;
|
|
183
|
+
/** Serializes interval checks, backoff and single-use consumption. */
|
|
184
|
+
readonly pollDevice: (hash: string, clientId: string, resource: string | undefined) => Effect.Effect<DevicePoll>;
|
|
185
|
+
readonly saveClient: (client: OAuthClient) => Effect.Effect<void>;
|
|
186
|
+
/** Read on every access-token authentication; only ID/name become caller provenance. */
|
|
187
|
+
readonly findClient: (id: string) => Effect.Effect<OAuthClient | undefined>;
|
|
188
|
+
/** Stores a request, and forgets the expired ones. */
|
|
189
|
+
readonly saveRequest: (request: OAuthRequest) => Effect.Effect<void>;
|
|
190
|
+
/** A request that has not expired. */
|
|
191
|
+
readonly findRequest: (id: string) => Effect.Effect<OAuthRequest | undefined>;
|
|
192
|
+
/** Removes a request that has not expired and returns it: a request is decided once. */
|
|
193
|
+
readonly takeRequest: (id: string) => Effect.Effect<OAuthRequest | undefined>;
|
|
194
|
+
/** Records a grant, with its PKCE code when using browser authorization. */
|
|
195
|
+
readonly saveGrant: (grant: OAuthGrant, code?: OAuthToken) => Effect.Effect<void>;
|
|
196
|
+
/** Uses a code or refresh token, once, before it expires and while its grant stands. */
|
|
197
|
+
readonly useToken: (hash: string, kind: "code" | "refresh") => Effect.Effect<UsedOAuthToken>;
|
|
198
|
+
/** Stores new tokens, and forgets the expired ones. */
|
|
199
|
+
readonly saveTokens: (tokens: ReadonlyArray<OAuthToken>) => Effect.Effect<void>;
|
|
200
|
+
/** The grant of an access token that has not expired, unless the grant was revoked. */
|
|
201
|
+
readonly findAccess: (hash: string) => Effect.Effect<OAuthGrant | undefined>;
|
|
202
|
+
/** The grant of a token of any kind, revoked or not. */
|
|
203
|
+
readonly findGrantOfToken: (hash: string) => Effect.Effect<OAuthGrant | undefined>;
|
|
204
|
+
readonly revokeGrant: (id: string) => Effect.Effect<void>;
|
|
205
|
+
/** The member a grant acts for, with the roles they hold now; undefined once they may not sign in. */
|
|
206
|
+
readonly memberPrincipal: (userId: string) => Effect.Effect<Principal | undefined>;
|
|
207
|
+
}
|
|
208
|
+
/** A channel account waiting, for ten minutes, for a member to claim it with its pairing code. */
|
|
209
|
+
export interface AgentPairing {
|
|
210
|
+
readonly id: string;
|
|
211
|
+
/** The channel, such as `telegram`. */
|
|
212
|
+
readonly provider: string;
|
|
213
|
+
/** The account's id on the channel. */
|
|
214
|
+
readonly externalId: string;
|
|
215
|
+
/** How the channel names the account, shown on the connect page. */
|
|
216
|
+
readonly display: string | null;
|
|
217
|
+
readonly expiresAt: Date;
|
|
218
|
+
}
|
|
219
|
+
/** A channel account paired with a member: the app's agent acts as the member for its messages. */
|
|
220
|
+
export interface AgentIdentity {
|
|
221
|
+
readonly id: string;
|
|
222
|
+
readonly provider: string;
|
|
223
|
+
readonly externalId: string;
|
|
224
|
+
readonly userId: string;
|
|
225
|
+
readonly display: string | null;
|
|
226
|
+
readonly username?: string;
|
|
227
|
+
readonly createdAt: Date;
|
|
228
|
+
/** When the identity stopped working; null while it is live. */
|
|
229
|
+
readonly revokedAt: Date | null;
|
|
230
|
+
readonly origin: "paired" | "provisioned";
|
|
231
|
+
readonly noticedAt: Date | null;
|
|
232
|
+
readonly noticeSha256: string | null;
|
|
233
|
+
readonly noticeVersion: string | null;
|
|
234
|
+
}
|
|
235
|
+
/** A member as the agent names them: their user's name and the roles they hold now. */
|
|
236
|
+
export interface AgentMember {
|
|
237
|
+
readonly name: string;
|
|
238
|
+
readonly principal: Principal;
|
|
239
|
+
}
|
|
240
|
+
/** Limits supplied only by the trusted runtime; fixed windows use the database clock. */
|
|
241
|
+
export interface AgentLimits {
|
|
242
|
+
readonly perSender: {
|
|
243
|
+
readonly turnsPerMinute: number;
|
|
244
|
+
readonly turnsPerDay: number;
|
|
245
|
+
};
|
|
246
|
+
readonly newUsersPerHour: number;
|
|
247
|
+
readonly workspaceTurnsPerDay: number;
|
|
248
|
+
}
|
|
249
|
+
export type AgentLimitScope = "turnsPerMinute" | "turnsPerDay" | "newUsersPerHour" | "workspaceTurnsPerDay";
|
|
250
|
+
export interface ResolveIdentityInput {
|
|
251
|
+
readonly provider: string;
|
|
252
|
+
readonly externalId: string;
|
|
253
|
+
readonly chat: "private" | "group";
|
|
254
|
+
readonly turn: boolean;
|
|
255
|
+
readonly display?: string | null;
|
|
256
|
+
readonly username?: string;
|
|
257
|
+
readonly noticeVersion?: string;
|
|
258
|
+
readonly noticeSha256?: string;
|
|
259
|
+
readonly limits?: {
|
|
260
|
+
readonly perSender?: Partial<AgentLimits["perSender"]>;
|
|
261
|
+
readonly newUsersPerHour?: number;
|
|
262
|
+
readonly workspaceTurnsPerDay?: number;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/** Verified provider facts only; channel-app callers cannot submit policy or bot-turn fields. */
|
|
266
|
+
export type ChannelSignInInput = Pick<ResolveIdentityInput, "provider" | "externalId" | "display" | "username">;
|
|
267
|
+
/** Admission runs before the issuer transaction, including shared limits and onNewUser. */
|
|
268
|
+
export interface ChannelSessionStore {
|
|
269
|
+
readonly create: (input: ChannelSignInInput & {
|
|
270
|
+
readonly resource: string;
|
|
271
|
+
}) => Effect.Effect<AgentResolution | {
|
|
272
|
+
readonly status: "signed_in";
|
|
273
|
+
readonly token: string;
|
|
274
|
+
readonly expiresAt: Date;
|
|
275
|
+
}>;
|
|
276
|
+
}
|
|
277
|
+
export type AgentResolution = {
|
|
278
|
+
readonly status: "existing" | "created";
|
|
279
|
+
readonly member: AgentMember;
|
|
280
|
+
readonly provisioned: boolean;
|
|
281
|
+
readonly noticeDue: boolean;
|
|
282
|
+
readonly onNewUserPending: boolean;
|
|
283
|
+
} | {
|
|
284
|
+
readonly status: "pairing_required";
|
|
285
|
+
} | {
|
|
286
|
+
readonly status: "refused";
|
|
287
|
+
readonly reason: "blocked" | "inactive";
|
|
288
|
+
} | {
|
|
289
|
+
readonly status: "limited";
|
|
290
|
+
readonly scope: AgentLimitScope;
|
|
291
|
+
readonly retryAfterSeconds: number;
|
|
292
|
+
readonly notify: boolean;
|
|
293
|
+
readonly notificationId?: string;
|
|
294
|
+
};
|
|
295
|
+
declare const IdentityInUse_base: Schema.Class<IdentityInUse, Schema.TaggedStruct<"IdentityInUse", {}>, import("effect/Cause").YieldableError>;
|
|
296
|
+
/** An account already belongs to another member; approval must roll back without consuming the code. */
|
|
297
|
+
export declare class IdentityInUse extends IdentityInUse_base {
|
|
298
|
+
}
|
|
299
|
+
/** A group chat the agent saw, as `POST /api/ontology/agent/chats/seen` answers. */
|
|
300
|
+
export interface SeenChat {
|
|
301
|
+
readonly id: string;
|
|
302
|
+
readonly title: string;
|
|
303
|
+
readonly purpose: string | null;
|
|
304
|
+
readonly whenToUse: string | null;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Where the app's agent keeps pairing codes and the identities they create: the runtime's agent
|
|
308
|
+
* tables in the workspace database. Codes are stored only as SHA-256 hashes. Expiry is checked
|
|
309
|
+
* against the database's clock; failures are defects.
|
|
310
|
+
*/
|
|
311
|
+
export interface AgentStore {
|
|
312
|
+
readonly confirmations?: ConfirmationStore;
|
|
313
|
+
/** Stores a pairing under its code's hash and forgets expired ones; false when the hash is taken. */
|
|
314
|
+
readonly savePairing: (pairing: AgentPairing & {
|
|
315
|
+
readonly codeHash: string;
|
|
316
|
+
}) => Effect.Effect<boolean>;
|
|
317
|
+
/** A pairing that has neither expired nor been approved. */
|
|
318
|
+
readonly findPairing: (codeHash: string) => Effect.Effect<AgentPairing | undefined>;
|
|
319
|
+
/**
|
|
320
|
+
* Consumes a live pairing once. The same account on the same member is idempotent; another
|
|
321
|
+
* member's live account fails without consuming the code. Replaces the member's own previous
|
|
322
|
+
* account on that provider. `undefined` when the pairing expired or was already approved.
|
|
323
|
+
*/
|
|
324
|
+
readonly approvePairing: (input: {
|
|
325
|
+
readonly codeHash: string;
|
|
326
|
+
readonly userId: string;
|
|
327
|
+
readonly identityId: string;
|
|
328
|
+
}) => Effect.Effect<AgentIdentity | undefined, IdentityInUse>;
|
|
329
|
+
/** Finds an active identity, or provisions a private sender when the channel admits strangers. */
|
|
330
|
+
readonly resolveIdentity: (input: ResolveIdentityInput) => Effect.Effect<AgentResolution>;
|
|
331
|
+
/** Complete the leased limit-reply claim only after delivery, or release it after failure. */
|
|
332
|
+
readonly completeLimitNotice: (input: {
|
|
333
|
+
readonly notificationId: string;
|
|
334
|
+
readonly delivered: boolean;
|
|
335
|
+
}) => Effect.Effect<boolean>;
|
|
336
|
+
/** Trusted member management; false for an unknown member id. Revokes sessions when blocking. */
|
|
337
|
+
readonly setMemberBlocked: (input: {
|
|
338
|
+
readonly id: string;
|
|
339
|
+
readonly blocked: boolean;
|
|
340
|
+
}) => Effect.Effect<boolean>;
|
|
341
|
+
/** Acknowledges first-contact notice delivery on a live provisioned identity. */
|
|
342
|
+
readonly recordNotice: (input: {
|
|
343
|
+
readonly provider: string;
|
|
344
|
+
readonly externalId: string;
|
|
345
|
+
readonly sha256: string;
|
|
346
|
+
readonly version?: string;
|
|
347
|
+
}) => Effect.Effect<boolean>;
|
|
348
|
+
/** The account's live identity, else its latest revoked one, else `undefined`. */
|
|
349
|
+
readonly findIdentity: (input: {
|
|
350
|
+
readonly provider: string;
|
|
351
|
+
readonly externalId: string;
|
|
352
|
+
}) => Effect.Effect<AgentIdentity | undefined>;
|
|
353
|
+
/** The member's live identities, oldest first. */
|
|
354
|
+
readonly listIdentities: (userId: string) => Effect.Effect<ReadonlyArray<AgentIdentity>>;
|
|
355
|
+
/** Revokes one of the member's live identities; false when they have no such identity. */
|
|
356
|
+
readonly revokeIdentity: (input: {
|
|
357
|
+
readonly id: string;
|
|
358
|
+
readonly userId: string;
|
|
359
|
+
}) => Effect.Effect<boolean>;
|
|
360
|
+
/** An active member by user id; `undefined` for an unknown user, a service or an inactive member. */
|
|
361
|
+
readonly member: (userId: string) => Effect.Effect<AgentMember | undefined>;
|
|
362
|
+
/** The member a runtime caller acts for: active, and with a live identity. */
|
|
363
|
+
readonly actingMember: (userId: string, provider?: string) => Effect.Effect<Principal | undefined>;
|
|
364
|
+
/**
|
|
365
|
+
* Records a message the agent saw in a group chat: creates the `agent_chat` or keeps its title
|
|
366
|
+
* current, records when the chat last had a message (at most every 15 minutes, so that history
|
|
367
|
+
* keeps it without a row per message), links the writer to its members when they are an active
|
|
368
|
+
* member, and unlinks `leftMemberId`, a member who left, when linked. With `agentLeft`, the agent
|
|
369
|
+
* itself left the chat: every member is unlinked, and the chat stays. With `migratedFrom`, the
|
|
370
|
+
* chat had that id before it became a supergroup: its record moves to `externalId`, or, when both
|
|
371
|
+
* ids have one, the new record takes the old one's members, and its purpose and when to use where
|
|
372
|
+
* it has none. Concurrent calls for one chat leave one record.
|
|
373
|
+
*/
|
|
374
|
+
readonly seeChat: (input: {
|
|
375
|
+
readonly provider: string;
|
|
376
|
+
readonly externalId: string;
|
|
377
|
+
readonly title: string;
|
|
378
|
+
readonly memberId?: string;
|
|
379
|
+
readonly leftMemberId?: string;
|
|
380
|
+
readonly agentLeft?: true;
|
|
381
|
+
readonly migratedFrom?: string;
|
|
382
|
+
}) => Effect.Effect<SeenChat>;
|
|
383
|
+
}
|
|
384
|
+
declare const OntologyBackend_base: Context.ServiceClass<OntologyBackend, "@segmentstream/ontology/OntologyBackend", {
|
|
385
|
+
readonly workflowAdmissions?: {
|
|
386
|
+
readonly ensureRecovery: (commitBy: number) => Effect.Effect<number, WorkflowRecoveryUnavailable>;
|
|
387
|
+
readonly reserve: (start: import("../runtime/workflow-admission.js").AdmittedWorkflowStart) => Effect.Effect<import("../runtime/workflow-admission.js").AdmittedWorkflowStart, import("../errors.js").DeploymentSwitching | DeploymentInterrupted | WorkflowRecoveryUnavailable>;
|
|
388
|
+
readonly submitted: (start: import("../runtime/workflow-admission.js").AdmittedWorkflowStart) => Effect.Effect<void>;
|
|
389
|
+
};
|
|
390
|
+
readonly blobs?: BlobRuntime;
|
|
391
|
+
/** The agent's temporary attachments, on deployments with file storage. */
|
|
392
|
+
readonly attachments?: AttachmentRuntime;
|
|
393
|
+
readonly maintainBlobs?: Effect.Effect<{
|
|
394
|
+
readonly removed: number;
|
|
395
|
+
}, unknown>;
|
|
396
|
+
readonly runAction: (input: RunActionInput) => Effect.Effect<ActionOutcome, ActionError | ConnectionError | TriggerInputInvalid | WorkflowRecoveryUnavailable>;
|
|
397
|
+
/**
|
|
398
|
+
* The starts action triggers decided, in `_workflow_starts`: the sweep that starts the pending
|
|
399
|
+
* ones, and a workflow's listing. Absent on a backend without the table's runtime.
|
|
400
|
+
*/
|
|
401
|
+
readonly workflowStarts?: {
|
|
402
|
+
readonly sweep: (input: {
|
|
403
|
+
/** Also retry the rows the automatic sweep gave up on. */
|
|
404
|
+
readonly retryAbandoned: boolean;
|
|
405
|
+
readonly requestId: string;
|
|
406
|
+
/** The recovery run's horizon: count as waiting only the rows created before it. */
|
|
407
|
+
readonly before?: string | undefined;
|
|
408
|
+
}) => Effect.Effect<SweepResult>;
|
|
409
|
+
readonly list: (input: {
|
|
410
|
+
/** The workflow's wire name. */
|
|
411
|
+
readonly workflow: string;
|
|
412
|
+
/** Only the pending, or only the started, starts; all when absent. */
|
|
413
|
+
readonly pending?: boolean | undefined;
|
|
414
|
+
readonly limit: number;
|
|
415
|
+
readonly after?: string | undefined;
|
|
416
|
+
}) => Effect.Effect<WorkflowStartsPage, InvalidStartsCursor>;
|
|
417
|
+
};
|
|
418
|
+
/** The tasks workflows hand the app's agent, in `_agent_tasks`. */
|
|
419
|
+
readonly agentTasks?: AgentTaskStore;
|
|
420
|
+
/**
|
|
421
|
+
* One record. With a `reader` holding scoped permissions, a record outside its read scope is
|
|
422
|
+
* NotFound; the reads, gets and histories of `find` and `history` honour the reader the same way.
|
|
423
|
+
*/
|
|
424
|
+
readonly get: (input: {
|
|
425
|
+
readonly entity: string;
|
|
426
|
+
readonly id: string;
|
|
427
|
+
readonly reader?: Principal;
|
|
428
|
+
}) => Effect.Effect<StoredRecord, NotFound>;
|
|
429
|
+
/** A page of records; `InvalidQuery` for a query the entity cannot answer, such as a stale cursor. */
|
|
430
|
+
readonly find: (input: {
|
|
431
|
+
readonly entity: string;
|
|
432
|
+
readonly query: Query;
|
|
433
|
+
readonly reader?: Principal;
|
|
434
|
+
}) => Effect.Effect<QueryResult<StoredRecord>, InvalidQuery>;
|
|
435
|
+
/**
|
|
436
|
+
* A page of a record's history, newest first. A deleted record keeps its history, which a reader
|
|
437
|
+
* with a read scope of the entity no longer reads: they read the history of a record they can
|
|
438
|
+
* read now.
|
|
439
|
+
*/
|
|
440
|
+
readonly history: (input: {
|
|
441
|
+
readonly entity: string;
|
|
442
|
+
readonly id: string;
|
|
443
|
+
readonly after?: string;
|
|
444
|
+
readonly limit?: number;
|
|
445
|
+
readonly reader?: Principal;
|
|
446
|
+
}) => Effect.Effect<QueryResult<HistoryEntry>, NotFound | InvalidQuery>;
|
|
447
|
+
/**
|
|
448
|
+
* The workspace's keyless pipeline worker, for a verified workload token whose subject is
|
|
449
|
+
* `pipeline-workers:<workspace id>`. `undefined` when it may not act.
|
|
450
|
+
*/
|
|
451
|
+
readonly resolveHookService?: (heldRole: string) => Effect.Effect<Principal | undefined>;
|
|
452
|
+
readonly resolvePipelineWorker?: (execution: import("../runtime/workload.js").WorkloadExecution) => Effect.Effect<Principal | undefined>;
|
|
453
|
+
/**
|
|
454
|
+
* A workflow's keyless service user, `workflows:<workspace id>:<workflow name>`, which the
|
|
455
|
+
* workflow's runs act as in this process. `undefined` for a workflow the ontology does not
|
|
456
|
+
* declare and for an inactive user. No token resolves it.
|
|
457
|
+
*/
|
|
458
|
+
readonly resolveWorkflowUser?: (input: {
|
|
459
|
+
readonly workspaceId: string;
|
|
460
|
+
readonly workflow: string;
|
|
461
|
+
}) => Effect.Effect<Principal | undefined>;
|
|
462
|
+
/**
|
|
463
|
+
* Finds, links or creates the member's user. `undefined` when the user may not sign in, and
|
|
464
|
+
* {@link NotInvited} when the sign-in policy turns away a person nobody invited.
|
|
465
|
+
*/
|
|
466
|
+
readonly resolvePrincipal: (identity: SignInIdentity) => Effect.Effect<Principal | undefined, NotInvited>;
|
|
467
|
+
/**
|
|
468
|
+
* Whether a person may sign in with this address, and how, read before the app emails them.
|
|
469
|
+
* It changes nothing, and unlike `resolvePrincipal` it needs no token.
|
|
470
|
+
*/
|
|
471
|
+
readonly checkSignIn: (email: string) => Effect.Effect<SignInCheck>;
|
|
472
|
+
/** The user holding an `ssk_` key, or `undefined` for an unknown or revoked key. */
|
|
473
|
+
readonly resolveApiKey: (key: Redacted.Redacted<string>) => Effect.Effect<Principal | undefined>;
|
|
474
|
+
/** The manifest hash recorded in the `_ontology` catalog table, or `undefined` before the first. */
|
|
475
|
+
readonly appliedHash: Effect.Effect<string | undefined>;
|
|
476
|
+
readonly replicationEnabled?: Effect.Effect<boolean>;
|
|
477
|
+
/** The OAuth tables, for members who connect agents; without it, agents use API keys. */
|
|
478
|
+
readonly oauth?: OAuthStore;
|
|
479
|
+
readonly channelSessions?: ChannelSessionStore;
|
|
480
|
+
readonly federation?: import("../runtime/federation.js").FederationStore;
|
|
481
|
+
/** The agent tables, which pair channel accounts with members for the app's own agent. */
|
|
482
|
+
readonly agents?: AgentStore;
|
|
483
|
+
}>;
|
|
484
|
+
/**
|
|
485
|
+
* The runtime as the HTTP service sees it, with its database and ontology already bound. Failures
|
|
486
|
+
* outside the declared errors are defects and become a sanitized 500.
|
|
487
|
+
*/
|
|
488
|
+
export declare class OntologyBackend extends OntologyBackend_base {
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* The runtime binding `createOntologyService` runs against: the generated actions, and a layer that
|
|
492
|
+
* connects the runtime to the workspace database as `ontology_app`. `sqlServiceRuntime` is the
|
|
493
|
+
* default.
|
|
494
|
+
*/
|
|
495
|
+
export interface OntologyServiceRuntime {
|
|
496
|
+
readonly generatedActions: GeneratedActionsProvider;
|
|
497
|
+
readonly connect: (input: {
|
|
498
|
+
readonly deployment?: import("../deployment.js").DeploymentObservation;
|
|
499
|
+
readonly ontology: Ontology;
|
|
500
|
+
readonly databaseUrl: Redacted.Redacted<string>;
|
|
501
|
+
readonly blobStorage?: Redacted.Redacted<BlobStorageBinding>;
|
|
502
|
+
/** Starts the runs action triggers decide, after each action's commit and in the sweep. */
|
|
503
|
+
readonly workflowStarter?: WorkflowStarter["Service"];
|
|
504
|
+
/** Requests the sign-in links actions queue, after each action's commit. */
|
|
505
|
+
readonly signInLinks?: import("../runtime/sign-in-links.js").SignInLinks["Service"];
|
|
506
|
+
}) => Layer.Layer<OntologyBackend, unknown>;
|
|
507
|
+
}
|
|
508
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Context, Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The sign-in policy is `invited` and nobody invited this person: no user has their identity or
|
|
4
|
+
* their email. Unlike other rejections the caller is told, so that the app can say what to do.
|
|
5
|
+
*/
|
|
6
|
+
export class NotInvited extends Schema.TaggedError()("NotInvited", {
|
|
7
|
+
message: Schema.String,
|
|
8
|
+
}) {
|
|
9
|
+
}
|
|
10
|
+
/** An account already belongs to another member; approval must roll back without consuming the code. */
|
|
11
|
+
export class IdentityInUse extends Schema.TaggedError()("IdentityInUse", {}) {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The runtime as the HTTP service sees it, with its database and ontology already bound. Failures
|
|
15
|
+
* outside the declared errors are defects and become a sanitized 500.
|
|
16
|
+
*/
|
|
17
|
+
export class OntologyBackend extends Context.Service()("@segmentstream/ontology/OntologyBackend") {
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Effect, Redacted } from "effect";
|
|
2
|
+
import type { HttpServerRequest } from "effect/unstable/http";
|
|
3
|
+
import { type JWTVerifyGetKey } from "jose";
|
|
4
|
+
/**
|
|
5
|
+
* The header in which a runtime caller names the member it acts for: the member's user id. The
|
|
6
|
+
* service honours it only with a verified runtime token, so nobody else can claim a member with it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ACT_AS_HEADER = "x-segmentstream-act-as";
|
|
9
|
+
/**
|
|
10
|
+
* The header in which the app's agent, running a task a workflow handed it, presents the task's
|
|
11
|
+
* secret instead of naming a member. With a verified runtime token it authenticates as the task's
|
|
12
|
+
* workflow user, on `/mcp` and the task routes only; every other route refuses it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const AGENT_TASK_HEADER = "x-segmentstream-agent-task";
|
|
15
|
+
/**
|
|
16
|
+
* Whom the service trusts as its runtime caller: Vercel OIDC tokens of the functions of this
|
|
17
|
+
* deployment's own project. The app's agent is a service of the same Vercel project as the ontology
|
|
18
|
+
* service, so `VERCEL_PROJECT_ID` pins exactly the deployment's own functions.
|
|
19
|
+
*/
|
|
20
|
+
export interface RuntimeIdentityConfig {
|
|
21
|
+
/** The team's issuer: `https://oidc.vercel.com/<team slug>` in team issuer mode. */
|
|
22
|
+
readonly issuer: string;
|
|
23
|
+
/** The audience Vercel issues function tokens for: `https://vercel.com/<team slug>`. */
|
|
24
|
+
readonly audience: string;
|
|
25
|
+
/** The project the token must name, from `VERCEL_PROJECT_ID`. */
|
|
26
|
+
readonly projectId: string;
|
|
27
|
+
}
|
|
28
|
+
export type RuntimeVerification = {
|
|
29
|
+
readonly status: "valid";
|
|
30
|
+
}
|
|
31
|
+
/** The token claims the runtime issuer but fails verification; `reason` names what failed. */
|
|
32
|
+
| {
|
|
33
|
+
readonly status: "invalid";
|
|
34
|
+
readonly reason: string;
|
|
35
|
+
} | {
|
|
36
|
+
readonly status: "unavailable";
|
|
37
|
+
}
|
|
38
|
+
/** The token does not claim the runtime issuer: it is some other credential. */
|
|
39
|
+
| {
|
|
40
|
+
readonly status: "other";
|
|
41
|
+
};
|
|
42
|
+
/** Verifies a bearer token as the deployment's own runtime token. */
|
|
43
|
+
export type RuntimeTokenVerifier = (token: string) => Promise<RuntimeVerification>;
|
|
44
|
+
/** The issuer's key set, at `<issuer>/.well-known/jwks` as Vercel publishes it. */
|
|
45
|
+
export declare function runtimeKeySet(issuer: string): JWTVerifyGetKey;
|
|
46
|
+
/**
|
|
47
|
+
* Verifies the Vercel OIDC token of a function of this deployment's project, as backend-next
|
|
48
|
+
* verifies the ontology service's own: RS256 from the team's issuer, for the team's audience,
|
|
49
|
+
* unexpired, with `project_id` equal to the configured project and `environment` `production`.
|
|
50
|
+
* The issuer and the audience name the team, so no further owner check is needed. A token that
|
|
51
|
+
* claims another issuer is `other`, without a key-set fetch.
|
|
52
|
+
*/
|
|
53
|
+
export declare function makeRuntimeTokenVerifier(config: RuntimeIdentityConfig, keySet: JWTVerifyGetKey): RuntimeTokenVerifier;
|
|
54
|
+
/** The runtime verifier on the issuer's remote key set, which jose caches between requests. */
|
|
55
|
+
export declare function runtimeTokenVerifier(config: RuntimeIdentityConfig): RuntimeTokenVerifier;
|
|
56
|
+
/** A runtime token that failed verification: the reason is logged, the token never. */
|
|
57
|
+
export declare function logRuntimeRejection(reason: string): Effect.Effect<void>;
|
|
58
|
+
/** How a request may authenticate as the runtime: the verifier and the member it names, if any. */
|
|
59
|
+
export declare const ACT_AS_PROVIDER_HEADER = "x-segmentstream-identity-provider";
|
|
60
|
+
export interface RuntimeCredential {
|
|
61
|
+
readonly verify: RuntimeTokenVerifier;
|
|
62
|
+
/** The user id in `X-SegmentStream-Act-As`; `undefined` without the header. */
|
|
63
|
+
readonly actAs: string | undefined;
|
|
64
|
+
readonly provider?: string;
|
|
65
|
+
/** The task secret in `X-SegmentStream-Agent-Task`; `undefined` without the header. */
|
|
66
|
+
readonly agentTask?: Redacted.Redacted<string>;
|
|
67
|
+
}
|
|
68
|
+
/** The task secret a request presents; `undefined` without the header. */
|
|
69
|
+
export declare function agentTaskSecret(request: HttpServerRequest.HttpServerRequest): Redacted.Redacted<string> | undefined;
|
|
70
|
+
/** The request's runtime credential, or `undefined` while runtime authentication is disabled. */
|
|
71
|
+
export declare function runtimeCredential(verify: RuntimeTokenVerifier | undefined, request: HttpServerRequest.HttpServerRequest): RuntimeCredential | undefined;
|