@rikalabs/akter 0.1.0-alpha.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 +15 -0
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +116 -0
- package/dist/actor/codecs.d.ts +77 -0
- package/dist/actor/codecs.js +87 -0
- package/dist/actor/connections.d.ts +34 -0
- package/dist/actor/connections.js +145 -0
- package/dist/actor/definition.d.ts +893 -0
- package/dist/actor/definition.js +147 -0
- package/dist/actor/descriptor.d.ts +172 -0
- package/dist/actor/descriptor.js +367 -0
- package/dist/actor/handles.d.ts +77 -0
- package/dist/actor/handles.js +265 -0
- package/dist/actor/jobs.d.ts +10 -0
- package/dist/actor/jobs.js +137 -0
- package/dist/actor/layers.d.ts +41 -0
- package/dist/actor/layers.js +177 -0
- package/dist/actor/reads.d.ts +47 -0
- package/dist/actor/reads.js +224 -0
- package/dist/actor/served.d.ts +120 -0
- package/dist/actor/served.js +72 -0
- package/dist/actor/turns.d.ts +13 -0
- package/dist/actor/turns.js +332 -0
- package/dist/actor/workflows.d.ts +16 -0
- package/dist/actor/workflows.js +37 -0
- package/dist/client/calls.d.ts +47 -0
- package/dist/client/calls.js +425 -0
- package/dist/client/clock.d.ts +56 -0
- package/dist/client/clock.js +119 -0
- package/dist/client/fleet-page.d.ts +15 -0
- package/dist/client/fleet-page.js +13 -0
- package/dist/client/fleet.d.ts +29 -0
- package/dist/client/fleet.js +51 -0
- package/dist/client/index.d.ts +17 -0
- package/dist/client/index.js +6 -0
- package/dist/client/make.d.ts +157 -0
- package/dist/client/make.js +221 -0
- package/dist/client/offline/queue.d.ts +118 -0
- package/dist/client/offline/queue.js +292 -0
- package/dist/client/offline/store.d.ts +74 -0
- package/dist/client/offline/store.js +78 -0
- package/dist/client/optimistic.d.ts +57 -0
- package/dist/client/optimistic.js +136 -0
- package/dist/client/report.d.ts +2 -0
- package/dist/client/report.js +8 -0
- package/dist/client/sessions/connection.d.ts +118 -0
- package/dist/client/sessions/connection.js +162 -0
- package/dist/client/sessions/feed.d.ts +42 -0
- package/dist/client/sessions/feed.js +43 -0
- package/dist/client/sessions/sse.d.ts +47 -0
- package/dist/client/sessions/sse.js +112 -0
- package/dist/client/sessions/stream.d.ts +28 -0
- package/dist/client/sessions/stream.js +35 -0
- package/dist/client/sessions/watch.d.ts +34 -0
- package/dist/client/sessions/watch.js +40 -0
- package/dist/client/transport.d.ts +37 -0
- package/dist/client/transport.js +66 -0
- package/dist/contexts/command.d.ts +132 -0
- package/dist/contexts/command.js +20 -0
- package/dist/contexts/connection.d.ts +68 -0
- package/dist/contexts/connection.js +0 -0
- package/dist/contexts/job.d.ts +49 -0
- package/dist/contexts/job.js +0 -0
- package/dist/contexts/workflow.d.ts +147 -0
- package/dist/contexts/workflow.js +22 -0
- package/dist/errors/actor.d.ts +200 -0
- package/dist/errors/actor.js +271 -0
- package/dist/errors/content.d.ts +19 -0
- package/dist/errors/content.js +14 -0
- package/dist/errors/database.d.ts +22 -0
- package/dist/errors/database.js +23 -0
- package/dist/errors/events.d.ts +17 -0
- package/dist/errors/events.js +14 -0
- package/dist/errors/subscription.d.ts +12 -0
- package/dist/errors/subscription.js +8 -0
- package/dist/errors/workflow.d.ts +28 -0
- package/dist/errors/workflow.js +17 -0
- package/dist/handles/actors.d.ts +17 -0
- package/dist/handles/actors.js +7 -0
- package/dist/handles/content.d.ts +59 -0
- package/dist/handles/content.js +36 -0
- package/dist/handles/intents.d.ts +164 -0
- package/dist/handles/intents.js +214 -0
- package/dist/handles/run.d.ts +31 -0
- package/dist/handles/run.js +21 -0
- package/dist/handles/workflow.d.ts +27 -0
- package/dist/handles/workflow.js +23 -0
- package/dist/identity/caller.d.ts +105 -0
- package/dist/identity/caller.js +68 -0
- package/dist/identity/child.d.ts +18 -0
- package/dist/identity/child.js +39 -0
- package/dist/identity/command.d.ts +19 -0
- package/dist/identity/command.js +21 -0
- package/dist/identity/connection.d.ts +24 -0
- package/dist/identity/connection.js +29 -0
- package/dist/identity/content.d.ts +18 -0
- package/dist/identity/content.js +12 -0
- package/dist/identity/digest.d.ts +4 -0
- package/dist/identity/digest.js +5 -0
- package/dist/identity/execution.d.ts +32 -0
- package/dist/identity/execution.js +63 -0
- package/dist/identity/mint.d.ts +51 -0
- package/dist/identity/mint.js +76 -0
- package/dist/identity/version.d.ts +2 -0
- package/dist/identity/version.js +3 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.js +97 -0
- package/dist/members/blob.d.ts +43 -0
- package/dist/members/blob.js +29 -0
- package/dist/members/command.d.ts +109 -0
- package/dist/members/command.js +61 -0
- package/dist/members/connection.d.ts +55 -0
- package/dist/members/connection.js +49 -0
- package/dist/members/event.d.ts +36 -0
- package/dist/members/event.js +24 -0
- package/dist/members/job.d.ts +157 -0
- package/dist/members/job.js +67 -0
- package/dist/members/payload.d.ts +93 -0
- package/dist/members/payload.js +145 -0
- package/dist/members/reducer.d.ts +64 -0
- package/dist/members/reducer.js +27 -0
- package/dist/members/stream.d.ts +36 -0
- package/dist/members/stream.js +14 -0
- package/dist/members/subscription.d.ts +182 -0
- package/dist/members/subscription.js +91 -0
- package/dist/members/workflow.d.ts +99 -0
- package/dist/members/workflow.js +2 -0
- package/dist/policies/access.d.ts +35 -0
- package/dist/policies/access.js +6 -0
- package/dist/policies/command.d.ts +127 -0
- package/dist/policies/command.js +45 -0
- package/dist/policies/job.d.ts +28 -0
- package/dist/policies/job.js +60 -0
- package/dist/policies/schedules.d.ts +33 -0
- package/dist/policies/schedules.js +131 -0
- package/dist/protocol/frames.d.ts +66 -0
- package/dist/protocol/frames.js +55 -0
- package/dist/protocol/inspection.d.ts +807 -0
- package/dist/protocol/inspection.js +243 -0
- package/dist/protocol/wire.d.ts +184 -0
- package/dist/protocol/wire.js +150 -0
- package/dist/runtime/actors.d.ts +155 -0
- package/dist/runtime/actors.js +4 -0
- package/dist/runtime/admission.d.ts +34 -0
- package/dist/runtime/admission.js +72 -0
- package/dist/runtime/adoption/backfill.d.ts +27 -0
- package/dist/runtime/adoption/backfill.js +144 -0
- package/dist/runtime/adoption/enforce.d.ts +55 -0
- package/dist/runtime/adoption/enforce.js +241 -0
- package/dist/runtime/adoption/observe.d.ts +43 -0
- package/dist/runtime/adoption/observe.js +139 -0
- package/dist/runtime/adoption/plan.d.ts +45 -0
- package/dist/runtime/adoption/plan.js +192 -0
- package/dist/runtime/adoption/startup.d.ts +32 -0
- package/dist/runtime/adoption/startup.js +76 -0
- package/dist/runtime/adoption/status.d.ts +23 -0
- package/dist/runtime/adoption/status.js +47 -0
- package/dist/runtime/adoption/target.d.ts +33 -0
- package/dist/runtime/adoption/target.js +49 -0
- package/dist/runtime/connections/holder.d.ts +221 -0
- package/dist/runtime/connections/holder.js +816 -0
- package/dist/runtime/connections/owner.d.ts +263 -0
- package/dist/runtime/connections/owner.js +896 -0
- package/dist/runtime/connections/protocol.d.ts +441 -0
- package/dist/runtime/connections/protocol.js +222 -0
- package/dist/runtime/connections/reads.d.ts +24 -0
- package/dist/runtime/connections/reads.js +19 -0
- package/dist/runtime/connections/streams.d.ts +62 -0
- package/dist/runtime/connections/streams.js +128 -0
- package/dist/runtime/connections/transport.d.ts +40 -0
- package/dist/runtime/connections/transport.js +68 -0
- package/dist/runtime/connections/watch.d.ts +52 -0
- package/dist/runtime/connections/watch.js +159 -0
- package/dist/runtime/content/grant.d.ts +34 -0
- package/dist/runtime/content/grant.js +58 -0
- package/dist/runtime/content/store.d.ts +63 -0
- package/dist/runtime/content/store.js +294 -0
- package/dist/runtime/cron/key.d.ts +2 -0
- package/dist/runtime/cron/key.js +2 -0
- package/dist/runtime/cron/schedule.d.ts +69 -0
- package/dist/runtime/cron/schedule.js +144 -0
- package/dist/runtime/database/bounded.d.ts +43 -0
- package/dist/runtime/database/bounded.js +108 -0
- package/dist/runtime/database/connection.d.ts +8 -0
- package/dist/runtime/database/connection.js +18 -0
- package/dist/runtime/database/coordination.d.ts +19 -0
- package/dist/runtime/database/coordination.js +72 -0
- package/dist/runtime/database/flock.d.ts +10 -0
- package/dist/runtime/database/flock.js +60 -0
- package/dist/runtime/database/gate.d.ts +26 -0
- package/dist/runtime/database/gate.js +54 -0
- package/dist/runtime/database/keepalive.d.ts +11 -0
- package/dist/runtime/database/keepalive.js +22 -0
- package/dist/runtime/database/migrations.d.ts +177 -0
- package/dist/runtime/database/migrations.js +1018 -0
- package/dist/runtime/database/neki/migrations.d.ts +31 -0
- package/dist/runtime/database/neki/migrations.js +276 -0
- package/dist/runtime/database/neki/session.d.ts +23 -0
- package/dist/runtime/database/neki/session.js +31 -0
- package/dist/runtime/database/pglite.d.ts +21 -0
- package/dist/runtime/database/pglite.js +74 -0
- package/dist/runtime/database/replica.d.ts +41 -0
- package/dist/runtime/database/replica.js +51 -0
- package/dist/runtime/database/shards.d.ts +21 -0
- package/dist/runtime/database/shards.js +37 -0
- package/dist/runtime/database/snapshot.d.ts +7 -0
- package/dist/runtime/database/snapshot.js +7 -0
- package/dist/runtime/database/tenancy.d.ts +69 -0
- package/dist/runtime/database/tenancy.js +145 -0
- package/dist/runtime/database/transient.d.ts +10 -0
- package/dist/runtime/database/transient.js +25 -0
- package/dist/runtime/drain.d.ts +132 -0
- package/dist/runtime/drain.js +109 -0
- package/dist/runtime/entity/mailbox.d.ts +86 -0
- package/dist/runtime/entity/mailbox.js +121 -0
- package/dist/runtime/entity/register.d.ts +424 -0
- package/dist/runtime/entity/register.js +669 -0
- package/dist/runtime/events/append.d.ts +192 -0
- package/dist/runtime/events/append.js +128 -0
- package/dist/runtime/events/cursor.d.ts +2 -0
- package/dist/runtime/events/cursor.js +5 -0
- package/dist/runtime/events/replay.d.ts +20 -0
- package/dist/runtime/events/replay.js +45 -0
- package/dist/runtime/feeds.d.ts +26 -0
- package/dist/runtime/feeds.js +100 -0
- package/dist/runtime/fleet/checks.d.ts +17 -0
- package/dist/runtime/fleet/checks.js +106 -0
- package/dist/runtime/fleet/maintainer.d.ts +38 -0
- package/dist/runtime/fleet/maintainer.js +383 -0
- package/dist/runtime/fleet/pgoutput.d.ts +41 -0
- package/dist/runtime/fleet/pgoutput.js +102 -0
- package/dist/runtime/fleet/setup.d.ts +36 -0
- package/dist/runtime/fleet/setup.js +58 -0
- package/dist/runtime/fleet/subscribe.d.ts +42 -0
- package/dist/runtime/fleet/subscribe.js +147 -0
- package/dist/runtime/index.d.ts +66 -0
- package/dist/runtime/index.js +37 -0
- package/dist/runtime/inspector/http.d.ts +19 -0
- package/dist/runtime/inspector/http.js +36 -0
- package/dist/runtime/inspector/layer.d.ts +46 -0
- package/dist/runtime/inspector/layer.js +180 -0
- package/dist/runtime/inspector/queries.d.ts +711 -0
- package/dist/runtime/inspector/queries.js +494 -0
- package/dist/runtime/jobs/attempt.d.ts +254 -0
- package/dist/runtime/jobs/attempt.js +413 -0
- package/dist/runtime/jobs/isolation.d.ts +20 -0
- package/dist/runtime/jobs/isolation.js +10 -0
- package/dist/runtime/jobs/progress.d.ts +95 -0
- package/dist/runtime/jobs/progress.js +144 -0
- package/dist/runtime/layer.d.ts +260 -0
- package/dist/runtime/layer.js +876 -0
- package/dist/runtime/members.d.ts +381 -0
- package/dist/runtime/members.js +8 -0
- package/dist/runtime/operators/audit.d.ts +64 -0
- package/dist/runtime/operators/audit.js +56 -0
- package/dist/runtime/operators/auth.d.ts +29 -0
- package/dist/runtime/operators/auth.js +42 -0
- package/dist/runtime/operators/export.d.ts +68 -0
- package/dist/runtime/operators/export.js +137 -0
- package/dist/runtime/operators/grants.d.ts +45 -0
- package/dist/runtime/operators/grants.js +40 -0
- package/dist/runtime/operators/repair.d.ts +206 -0
- package/dist/runtime/operators/repair.js +226 -0
- package/dist/runtime/operators/routes.d.ts +35 -0
- package/dist/runtime/operators/routes.js +190 -0
- package/dist/runtime/operators/seed.d.ts +123 -0
- package/dist/runtime/operators/seed.js +123 -0
- package/dist/runtime/payloads/versions.d.ts +65 -0
- package/dist/runtime/payloads/versions.js +240 -0
- package/dist/runtime/peering/authority.d.ts +42 -0
- package/dist/runtime/peering/authority.js +132 -0
- package/dist/runtime/peering/credentials.d.ts +21 -0
- package/dist/runtime/peering/credentials.js +13 -0
- package/dist/runtime/peering/transport.d.ts +51 -0
- package/dist/runtime/peering/transport.js +175 -0
- package/dist/runtime/queries.d.ts +18 -0
- package/dist/runtime/queries.js +169 -0
- package/dist/runtime/readiness.d.ts +36 -0
- package/dist/runtime/readiness.js +44 -0
- package/dist/runtime/registration.d.ts +58 -0
- package/dist/runtime/registration.js +186 -0
- package/dist/runtime/request.d.ts +158 -0
- package/dist/runtime/request.js +102 -0
- package/dist/runtime/retry.d.ts +8 -0
- package/dist/runtime/retry.js +11 -0
- package/dist/runtime/runner.d.ts +93 -0
- package/dist/runtime/runner.js +122 -0
- package/dist/runtime/storage/codec.d.ts +39 -0
- package/dist/runtime/storage/codec.js +41 -0
- package/dist/runtime/storage/generation.d.ts +69 -0
- package/dist/runtime/storage/generation.js +49 -0
- package/dist/runtime/storage/placements.d.ts +15 -0
- package/dist/runtime/storage/placements.js +38 -0
- package/dist/runtime/storage/platform.d.ts +6 -0
- package/dist/runtime/storage/platform.js +9 -0
- package/dist/runtime/storage/retention.d.ts +73 -0
- package/dist/runtime/storage/retention.js +158 -0
- package/dist/runtime/subscriptions/identity.d.ts +31 -0
- package/dist/runtime/subscriptions/identity.js +45 -0
- package/dist/runtime/subscriptions/relay.d.ts +175 -0
- package/dist/runtime/subscriptions/relay.js +763 -0
- package/dist/runtime/subscriptions/storage.d.ts +40 -0
- package/dist/runtime/subscriptions/storage.js +98 -0
- package/dist/runtime/sweeps.d.ts +39 -0
- package/dist/runtime/sweeps.js +54 -0
- package/dist/runtime/telemetry/defects.d.ts +57 -0
- package/dist/runtime/telemetry/defects.js +43 -0
- package/dist/runtime/telemetry/metrics.d.ts +52 -0
- package/dist/runtime/telemetry/metrics.js +138 -0
- package/dist/runtime/telemetry/routes.d.ts +19 -0
- package/dist/runtime/telemetry/routes.js +18 -0
- package/dist/runtime/telemetry/sampler.d.ts +26 -0
- package/dist/runtime/telemetry/sampler.js +101 -0
- package/dist/runtime/telemetry/spans.d.ts +38 -0
- package/dist/runtime/telemetry/spans.js +44 -0
- package/dist/runtime/telemetry/usage.d.ts +52 -0
- package/dist/runtime/telemetry/usage.js +30 -0
- package/dist/runtime/topology/admission.d.ts +13 -0
- package/dist/runtime/topology/admission.js +36 -0
- package/dist/runtime/topology/locks.d.ts +56 -0
- package/dist/runtime/topology/locks.js +81 -0
- package/dist/runtime/topology/messages.d.ts +15 -0
- package/dist/runtime/topology/messages.js +32 -0
- package/dist/runtime/turn/admission.d.ts +22 -0
- package/dist/runtime/turn/admission.js +41 -0
- package/dist/runtime/turn/blobs.d.ts +38 -0
- package/dist/runtime/turn/blobs.js +215 -0
- package/dist/runtime/turn/execute.d.ts +208 -0
- package/dist/runtime/turn/execute.js +972 -0
- package/dist/runtime/turn/group.d.ts +165 -0
- package/dist/runtime/turn/group.js +326 -0
- package/dist/runtime/turn/hooks.d.ts +44 -0
- package/dist/runtime/turn/hooks.js +28 -0
- package/dist/runtime/turn/outbox.d.ts +159 -0
- package/dist/runtime/turn/outbox.js +269 -0
- package/dist/runtime/turn/pipeline.d.ts +68 -0
- package/dist/runtime/turn/pipeline.js +83 -0
- package/dist/runtime/turn/receipt.d.ts +81 -0
- package/dist/runtime/turn/receipt.js +32 -0
- package/dist/runtime/turn/relay.d.ts +179 -0
- package/dist/runtime/turn/relay.js +685 -0
- package/dist/runtime/turn/rows.d.ts +43 -0
- package/dist/runtime/turn/rows.js +592 -0
- package/dist/runtime/workflows/compatibility.d.ts +125 -0
- package/dist/runtime/workflows/compatibility.js +285 -0
- package/dist/runtime/workflows/engine.d.ts +107 -0
- package/dist/runtime/workflows/engine.js +826 -0
- package/dist/runtime/workflows/manifest.d.ts +34 -0
- package/dist/runtime/workflows/manifest.js +39 -0
- package/dist/runtime/workflows/steps.d.ts +33 -0
- package/dist/runtime/workflows/steps.js +152 -0
- package/dist/serve/api.d.ts +99 -0
- package/dist/serve/api.js +403 -0
- package/dist/serve/assertion/binding.d.ts +41 -0
- package/dist/serve/assertion/binding.js +92 -0
- package/dist/serve/assertion/verify.d.ts +93 -0
- package/dist/serve/assertion/verify.js +189 -0
- package/dist/serve/auth.d.ts +200 -0
- package/dist/serve/auth.js +92 -0
- package/dist/serve/clock.d.ts +10 -0
- package/dist/serve/clock.js +25 -0
- package/dist/serve/jwt.d.ts +65 -0
- package/dist/serve/jwt.js +202 -0
- package/dist/serve/layer.d.ts +98 -0
- package/dist/serve/layer.js +809 -0
- package/dist/serve/mcp/endpoint.d.ts +39 -0
- package/dist/serve/mcp/endpoint.js +187 -0
- package/dist/serve/mcp/tools.d.ts +37 -0
- package/dist/serve/mcp/tools.js +125 -0
- package/dist/serve/origin.d.ts +6 -0
- package/dist/serve/origin.js +21 -0
- package/dist/serve/sessions/feed.d.ts +79 -0
- package/dist/serve/sessions/feed.js +115 -0
- package/dist/serve/sessions/socket.d.ts +56 -0
- package/dist/serve/sessions/socket.js +212 -0
- package/dist/serve/sessions/sse.d.ts +27 -0
- package/dist/serve/sessions/sse.js +26 -0
- package/dist/serve/sessions/stream.d.ts +9 -0
- package/dist/serve/sessions/stream.js +9 -0
- package/dist/serve/sessions/watch.d.ts +12 -0
- package/dist/serve/sessions/watch.js +11 -0
- package/dist/serve/wire.d.ts +16 -0
- package/dist/serve/wire.js +50 -0
- package/dist/state/blob.d.ts +71 -0
- package/dist/state/blob.js +0 -0
- package/dist/state/migration.d.ts +53 -0
- package/dist/state/migration.js +29 -0
- package/dist/tables/fleet.d.ts +170 -0
- package/dist/tables/fleet.js +214 -0
- package/dist/tables/owned.d.ts +250 -0
- package/dist/tables/owned.js +233 -0
- package/dist/testing/actor-test.d.ts +360 -0
- package/dist/testing/actor-test.js +337 -0
- package/dist/testing/cluster.d.ts +93 -0
- package/dist/testing/cluster.js +296 -0
- package/dist/testing/conformance/access.d.ts +5 -0
- package/dist/testing/conformance/access.js +531 -0
- package/dist/testing/conformance/admission.d.ts +11 -0
- package/dist/testing/conformance/admission.js +182 -0
- package/dist/testing/conformance/adoption.d.ts +2 -0
- package/dist/testing/conformance/adoption.js +1019 -0
- package/dist/testing/conformance/assertions.d.ts +202 -0
- package/dist/testing/conformance/assertions.js +849 -0
- package/dist/testing/conformance/batches.d.ts +41 -0
- package/dist/testing/conformance/batches.js +388 -0
- package/dist/testing/conformance/blobs.d.ts +14 -0
- package/dist/testing/conformance/blobs.js +405 -0
- package/dist/testing/conformance/capacity.d.ts +8 -0
- package/dist/testing/conformance/capacity.js +433 -0
- package/dist/testing/conformance/client.d.ts +5 -0
- package/dist/testing/conformance/client.js +719 -0
- package/dist/testing/conformance/cold-serve.d.ts +16 -0
- package/dist/testing/conformance/cold-serve.js +254 -0
- package/dist/testing/conformance/connections/actors.d.ts +1143 -0
- package/dist/testing/conformance/connections/actors.js +180 -0
- package/dist/testing/conformance/connections/harness.d.ts +1754 -0
- package/dist/testing/conformance/connections/harness.js +142 -0
- package/dist/testing/conformance/connections/holders.d.ts +4 -0
- package/dist/testing/conformance/connections/holders.js +165 -0
- package/dist/testing/conformance/connections/lifecycle.d.ts +4 -0
- package/dist/testing/conformance/connections/lifecycle.js +113 -0
- package/dist/testing/conformance/connections/limits.d.ts +4 -0
- package/dist/testing/conformance/connections/limits.js +127 -0
- package/dist/testing/conformance/connections/reauthorization.d.ts +4 -0
- package/dist/testing/conformance/connections/reauthorization.js +170 -0
- package/dist/testing/conformance/connections/resync.d.ts +4 -0
- package/dist/testing/conformance/connections/resync.js +360 -0
- package/dist/testing/conformance/connections/takeover.d.ts +4 -0
- package/dist/testing/conformance/connections/takeover.js +287 -0
- package/dist/testing/conformance/connections.d.ts +4 -0
- package/dist/testing/conformance/connections.js +15 -0
- package/dist/testing/conformance/content-blobs.d.ts +16 -0
- package/dist/testing/conformance/content-blobs.js +534 -0
- package/dist/testing/conformance/counter.d.ts +16 -0
- package/dist/testing/conformance/counter.js +813 -0
- package/dist/testing/conformance/cron.d.ts +5 -0
- package/dist/testing/conformance/cron.js +665 -0
- package/dist/testing/conformance/drain.d.ts +26 -0
- package/dist/testing/conformance/drain.js +540 -0
- package/dist/testing/conformance/effect-control.d.ts +38 -0
- package/dist/testing/conformance/effect-control.js +1059 -0
- package/dist/testing/conformance/effects.d.ts +23 -0
- package/dist/testing/conformance/effects.js +432 -0
- package/dist/testing/conformance/events.d.ts +28 -0
- package/dist/testing/conformance/events.js +335 -0
- package/dist/testing/conformance/export.d.ts +2 -0
- package/dist/testing/conformance/export.js +368 -0
- package/dist/testing/conformance/fleet.d.ts +444 -0
- package/dist/testing/conformance/fleet.js +1009 -0
- package/dist/testing/conformance/groups.d.ts +7 -0
- package/dist/testing/conformance/groups.js +353 -0
- package/dist/testing/conformance/heap.d.ts +3 -0
- package/dist/testing/conformance/heap.js +149 -0
- package/dist/testing/conformance/http.d.ts +2809 -0
- package/dist/testing/conformance/http.js +1234 -0
- package/dist/testing/conformance/inspection-views.d.ts +8 -0
- package/dist/testing/conformance/inspection-views.js +272 -0
- package/dist/testing/conformance/inspector.d.ts +7 -0
- package/dist/testing/conformance/inspector.js +650 -0
- package/dist/testing/conformance/mint.d.ts +58 -0
- package/dist/testing/conformance/mint.js +692 -0
- package/dist/testing/conformance/multi-runner.d.ts +8 -0
- package/dist/testing/conformance/multi-runner.js +403 -0
- package/dist/testing/conformance/neki/plan.d.ts +19 -0
- package/dist/testing/conformance/neki/plan.js +30 -0
- package/dist/testing/conformance/observability.d.ts +3 -0
- package/dist/testing/conformance/observability.js +343 -0
- package/dist/testing/conformance/offline.d.ts +4 -0
- package/dist/testing/conformance/offline.js +474 -0
- package/dist/testing/conformance/operator-harness.d.ts +57 -0
- package/dist/testing/conformance/operator-harness.js +78 -0
- package/dist/testing/conformance/operator.d.ts +3 -0
- package/dist/testing/conformance/operator.js +379 -0
- package/dist/testing/conformance/outbox-cross-shard.d.ts +14 -0
- package/dist/testing/conformance/outbox-cross-shard.js +160 -0
- package/dist/testing/conformance/outbox.d.ts +36 -0
- package/dist/testing/conformance/outbox.js +437 -0
- package/dist/testing/conformance/payload-migrations.d.ts +3 -0
- package/dist/testing/conformance/payload-migrations.js +612 -0
- package/dist/testing/conformance/pipeline.d.ts +3 -0
- package/dist/testing/conformance/pipeline.js +1040 -0
- package/dist/testing/conformance/placement.d.ts +22 -0
- package/dist/testing/conformance/placement.js +539 -0
- package/dist/testing/conformance/platform.d.ts +40 -0
- package/dist/testing/conformance/platform.js +101 -0
- package/dist/testing/conformance/progress.d.ts +39 -0
- package/dist/testing/conformance/progress.js +666 -0
- package/dist/testing/conformance/properties.d.ts +6 -0
- package/dist/testing/conformance/properties.js +295 -0
- package/dist/testing/conformance/protocols.d.ts +4 -0
- package/dist/testing/conformance/protocols.js +618 -0
- package/dist/testing/conformance/provider/advertise.d.ts +21 -0
- package/dist/testing/conformance/provider/advertise.js +44 -0
- package/dist/testing/conformance/read-your-writes.d.ts +20 -0
- package/dist/testing/conformance/read-your-writes.js +192 -0
- package/dist/testing/conformance/reducers.d.ts +8 -0
- package/dist/testing/conformance/reducers.js +258 -0
- package/dist/testing/conformance/relay.d.ts +42 -0
- package/dist/testing/conformance/relay.js +1115 -0
- package/dist/testing/conformance/restore.d.ts +43 -0
- package/dist/testing/conformance/restore.js +341 -0
- package/dist/testing/conformance/retention.d.ts +14 -0
- package/dist/testing/conformance/retention.js +463 -0
- package/dist/testing/conformance/rls.d.ts +24 -0
- package/dist/testing/conformance/rls.js +576 -0
- package/dist/testing/conformance/simulation.d.ts +31 -0
- package/dist/testing/conformance/simulation.js +167 -0
- package/dist/testing/conformance/single-shard.d.ts +2 -0
- package/dist/testing/conformance/single-shard.js +125 -0
- package/dist/testing/conformance/singleton.d.ts +3 -0
- package/dist/testing/conformance/singleton.js +293 -0
- package/dist/testing/conformance/statements.d.ts +60 -0
- package/dist/testing/conformance/statements.js +108 -0
- package/dist/testing/conformance/streams.d.ts +7 -0
- package/dist/testing/conformance/streams.js +280 -0
- package/dist/testing/conformance/subscriptions/access.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/access.js +98 -0
- package/dist/testing/conformance/subscriptions/actors.d.ts +4910 -0
- package/dist/testing/conformance/subscriptions/actors.js +372 -0
- package/dist/testing/conformance/subscriptions/cluster.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/cluster.js +89 -0
- package/dist/testing/conformance/subscriptions/delivery.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/delivery.js +253 -0
- package/dist/testing/conformance/subscriptions/deploys.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/deploys.js +162 -0
- package/dist/testing/conformance/subscriptions/epochs.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/epochs.js +169 -0
- package/dist/testing/conformance/subscriptions/failures.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/failures.js +108 -0
- package/dist/testing/conformance/subscriptions/feeds.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/feeds.js +218 -0
- package/dist/testing/conformance/subscriptions/harness.d.ts +124 -0
- package/dist/testing/conformance/subscriptions/harness.js +143 -0
- package/dist/testing/conformance/subscriptions/operator.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/operator.js +128 -0
- package/dist/testing/conformance/subscriptions/retention.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/retention.js +288 -0
- package/dist/testing/conformance/subscriptions/routing.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/routing.js +179 -0
- package/dist/testing/conformance/subscriptions.d.ts +4 -0
- package/dist/testing/conformance/subscriptions.js +19 -0
- package/dist/testing/conformance/tables.d.ts +125 -0
- package/dist/testing/conformance/tables.js +664 -0
- package/dist/testing/conformance/transports/actors.d.ts +1907 -0
- package/dist/testing/conformance/transports/actors.js +163 -0
- package/dist/testing/conformance/transports/client.d.ts +3 -0
- package/dist/testing/conformance/transports/client.js +237 -0
- package/dist/testing/conformance/transports/feeds.d.ts +3 -0
- package/dist/testing/conformance/transports/feeds.js +232 -0
- package/dist/testing/conformance/transports/harness.d.ts +93 -0
- package/dist/testing/conformance/transports/harness.js +84 -0
- package/dist/testing/conformance/transports/streams.d.ts +3 -0
- package/dist/testing/conformance/transports/streams.js +96 -0
- package/dist/testing/conformance/transports/websocket.d.ts +3 -0
- package/dist/testing/conformance/transports/websocket.js +384 -0
- package/dist/testing/conformance/transports/wire.d.ts +141 -0
- package/dist/testing/conformance/transports/wire.js +204 -0
- package/dist/testing/conformance/transports.d.ts +3 -0
- package/dist/testing/conformance/transports.js +11 -0
- package/dist/testing/conformance/watch.d.ts +59 -0
- package/dist/testing/conformance/watch.js +879 -0
- package/dist/testing/conformance/workflow-engine.d.ts +97 -0
- package/dist/testing/conformance/workflow-engine.js +253 -0
- package/dist/testing/conformance/workflow-versions.d.ts +3 -0
- package/dist/testing/conformance/workflow-versions.js +545 -0
- package/dist/testing/conformance/workflows/access.d.ts +4 -0
- package/dist/testing/conformance/workflows/access.js +147 -0
- package/dist/testing/conformance/workflows/actors.d.ts +2317 -0
- package/dist/testing/conformance/workflows/actors.js +305 -0
- package/dist/testing/conformance/workflows/basics.d.ts +4 -0
- package/dist/testing/conformance/workflows/basics.js +144 -0
- package/dist/testing/conformance/workflows/engine.d.ts +4 -0
- package/dist/testing/conformance/workflows/engine.js +80 -0
- package/dist/testing/conformance/workflows/guards.d.ts +4 -0
- package/dist/testing/conformance/workflows/guards.js +172 -0
- package/dist/testing/conformance/workflows/harness.d.ts +14 -0
- package/dist/testing/conformance/workflows/harness.js +44 -0
- package/dist/testing/conformance/workflows/recovery.d.ts +4 -0
- package/dist/testing/conformance/workflows/recovery.js +181 -0
- package/dist/testing/conformance/workflows/starts.d.ts +4 -0
- package/dist/testing/conformance/workflows/starts.js +57 -0
- package/dist/testing/conformance/workflows/suspension.d.ts +4 -0
- package/dist/testing/conformance/workflows/suspension.js +106 -0
- package/dist/testing/conformance/workflows/waits.d.ts +4 -0
- package/dist/testing/conformance/workflows/waits.js +284 -0
- package/dist/testing/conformance/workflows.d.ts +4 -0
- package/dist/testing/conformance/workflows.js +19 -0
- package/dist/testing/conformance.d.ts +330 -0
- package/dist/testing/conformance.js +364 -0
- package/dist/testing/database.d.ts +31 -0
- package/dist/testing/database.js +70 -0
- package/dist/testing/foundation.d.ts +41 -0
- package/dist/testing/foundation.js +517 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/property.d.ts +40 -0
- package/dist/testing/property.js +95 -0
- package/dist/testing/simulate-cluster.d.ts +112 -0
- package/dist/testing/simulate-cluster.js +257 -0
- package/dist/testing/simulate.d.ts +90 -0
- package/dist/testing/simulate.js +127 -0
- package/package.json +1 -0
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
import { Cause, Effect, Exit, Layer, Schema } from "effect";
|
|
2
|
+
import { Base64 } from "effect/encoding";
|
|
3
|
+
import { HttpRouter } from "effect/http";
|
|
4
|
+
import { Unauthorized } from "../../index.js";
|
|
5
|
+
import { InvalidInput } from "../../errors/actor.js";
|
|
6
|
+
import { CommandConflict, CommandExpired } from "../../errors/actor.js";
|
|
7
|
+
import { InternalActors } from "../../runtime/actors.js";
|
|
8
|
+
import { MCP_VERSION } from "../../serve/mcp/endpoint.js";
|
|
9
|
+
import { envelope, HttpLobby, HttpRoom, isDefectBody, reasonOf, receipts, runs, serveHttp, tenantOf, tokens, httpSuite, } from "./http.js";
|
|
10
|
+
import { serve } from "../../serve/layer.js";
|
|
11
|
+
const options = { openapi: { path: "/openapi.json" }, mcp: { path: "/mcp" } };
|
|
12
|
+
const META = {
|
|
13
|
+
"io.modelcontextprotocol/protocolVersion": MCP_VERSION,
|
|
14
|
+
"io.modelcontextprotocol/clientCapabilities": {},
|
|
15
|
+
};
|
|
16
|
+
const decodeJson = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Json));
|
|
17
|
+
const Content = Schema.Struct({
|
|
18
|
+
"application/json": Schema.optionalKey(Schema.Struct({ schema: Schema.Json })),
|
|
19
|
+
});
|
|
20
|
+
const Spec = Schema.Struct({
|
|
21
|
+
paths: Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Struct({
|
|
22
|
+
operationId: Schema.String,
|
|
23
|
+
"x-durable-transport": Schema.optionalKey(Schema.String),
|
|
24
|
+
parameters: Schema.optionalKey(Schema.Array(Schema.Struct({ name: Schema.String, in: Schema.String }))),
|
|
25
|
+
requestBody: Schema.optionalKey(Schema.Struct({ content: Content })),
|
|
26
|
+
responses: Schema.Struct({
|
|
27
|
+
"200": Schema.optionalKey(Schema.Struct({ content: Schema.optionalKey(Content) })),
|
|
28
|
+
}),
|
|
29
|
+
}))),
|
|
30
|
+
components: Schema.Struct({ schemas: Schema.Record(Schema.String, Schema.Json) }),
|
|
31
|
+
});
|
|
32
|
+
const ToolList = Schema.Struct({
|
|
33
|
+
result: Schema.Struct({
|
|
34
|
+
resultType: Schema.String,
|
|
35
|
+
ttlMs: Schema.Int,
|
|
36
|
+
cacheScope: Schema.String,
|
|
37
|
+
tools: Schema.Array(Schema.Struct({
|
|
38
|
+
name: Schema.String,
|
|
39
|
+
description: Schema.String,
|
|
40
|
+
inputSchema: Schema.Struct({
|
|
41
|
+
type: Schema.String,
|
|
42
|
+
properties: Schema.Record(Schema.String, Schema.Json),
|
|
43
|
+
required: Schema.Array(Schema.String),
|
|
44
|
+
additionalProperties: Schema.Boolean,
|
|
45
|
+
$defs: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),
|
|
46
|
+
}),
|
|
47
|
+
outputSchema: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),
|
|
48
|
+
annotations: Schema.Struct({
|
|
49
|
+
readOnlyHint: Schema.Boolean,
|
|
50
|
+
idempotentHint: Schema.Boolean,
|
|
51
|
+
}),
|
|
52
|
+
})),
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
const ToolReply = Schema.Struct({
|
|
56
|
+
result: Schema.Struct({
|
|
57
|
+
resultType: Schema.Literal("complete"),
|
|
58
|
+
content: Schema.Array(Schema.Struct({ type: Schema.Literal("text"), text: Schema.String })),
|
|
59
|
+
isError: Schema.optionalKey(Schema.Boolean),
|
|
60
|
+
structuredContent: Schema.optionalKey(Schema.Json),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
const RpcError = Schema.Struct({
|
|
64
|
+
error: Schema.Struct({
|
|
65
|
+
code: Schema.Int,
|
|
66
|
+
message: Schema.String,
|
|
67
|
+
data: Schema.optionalKey(Schema.Json),
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
const rpc = (server, call) => server.send("/mcp", {
|
|
71
|
+
token: call.token,
|
|
72
|
+
body: {
|
|
73
|
+
jsonrpc: "2.0",
|
|
74
|
+
id: 1,
|
|
75
|
+
method: call.method,
|
|
76
|
+
params: Object.assign({}, call.params, { _meta: META }),
|
|
77
|
+
},
|
|
78
|
+
headers: { "mcp-protocol-version": MCP_VERSION, "mcp-method": call.method, ...call.headers },
|
|
79
|
+
});
|
|
80
|
+
/** One `tools/call`, with its text content decoded as the JSON it carries. */
|
|
81
|
+
const callTool = Effect.fnUntraced(function* (server, token, name, args) {
|
|
82
|
+
const reply = yield* rpc(server, {
|
|
83
|
+
token,
|
|
84
|
+
method: "tools/call",
|
|
85
|
+
params: { name, arguments: args },
|
|
86
|
+
headers: { "mcp-name": name },
|
|
87
|
+
});
|
|
88
|
+
const { result } = yield* Schema.decodeUnknownEffect(ToolReply)(reply.body).pipe(Effect.orDie);
|
|
89
|
+
const text = result.content[0]?.text;
|
|
90
|
+
return {
|
|
91
|
+
status: reply.status,
|
|
92
|
+
isError: result.isError === true,
|
|
93
|
+
empty: result.content.length === 0,
|
|
94
|
+
text,
|
|
95
|
+
body: text === undefined ? undefined : yield* decodeJson(text).pipe(Effect.orDie),
|
|
96
|
+
structured: result.structuredContent,
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
const rpcError = Effect.fnUntraced(function* (reply) {
|
|
100
|
+
const { error } = yield* Schema.decodeUnknownEffect(RpcError)(reply.body).pipe(Effect.orDie);
|
|
101
|
+
return error;
|
|
102
|
+
});
|
|
103
|
+
const mint = Effect.fnUntraced(function* (server, token) {
|
|
104
|
+
const minted = yield* callTool(server, token, "durable.commandIds", {});
|
|
105
|
+
return yield* Schema.decodeUnknownEffect(Schema.Struct({ commandId: Schema.String }))(minted.body).pipe(Effect.map(({ commandId }) => commandId), Effect.orDie);
|
|
106
|
+
});
|
|
107
|
+
const mcpConformanceOptions = options;
|
|
108
|
+
export const protocolsConformance = [
|
|
109
|
+
{
|
|
110
|
+
name: "lists every public command, reducer, and query as a tool with its OpenAPI operation's parameters and schemas, and no internal member",
|
|
111
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
112
|
+
const server = yield* serveHttp(mcpConformanceOptions);
|
|
113
|
+
const token = `${yield* tenantOf}:alice`;
|
|
114
|
+
const spec = yield* server.send("/openapi.json", { method: "GET" }).pipe(Effect.flatMap((reply) => Schema.decodeUnknownEffect(Spec)(reply.body)), Effect.orDie);
|
|
115
|
+
const listed = yield* rpc(server, { token, method: "tools/list" }).pipe(Effect.flatMap((reply) => Schema.decodeUnknownEffect(ToolList)(reply.body)), Effect.orDie);
|
|
116
|
+
expect(listed.result).toMatchObject({ resultType: "complete", ttlMs: 0 });
|
|
117
|
+
expect(listed.result.cacheScope).toBe("public");
|
|
118
|
+
const operations = Object.entries(spec.paths).flatMap(([path, methods]) => methods["post"] !== undefined &&
|
|
119
|
+
methods["post"]["x-durable-transport"] === undefined &&
|
|
120
|
+
(path.startsWith("/actors/") || methods["post"].operationId === "durable.commandIds")
|
|
121
|
+
? [{ path, operation: methods["post"] }]
|
|
122
|
+
: []);
|
|
123
|
+
expect(listed.result.tools.map((tool) => tool.name)).toEqual(operations.map(({ operation }) => operation.operationId));
|
|
124
|
+
expect(listed.result.tools.map((tool) => tool.name)).not.toContain("HttpRoom.Secret");
|
|
125
|
+
for (const { path, operation } of operations) {
|
|
126
|
+
const tool = listed.result.tools.find((candidate) => candidate.name === operation.operationId);
|
|
127
|
+
const parameters = operation.parameters ?? [];
|
|
128
|
+
const body = operation.requestBody?.content["application/json"]?.schema;
|
|
129
|
+
const success = operation.responses["200"]?.content?.["application/json"]?.schema;
|
|
130
|
+
expect(Object.keys(tool.inputSchema.properties).sort()).toEqual([
|
|
131
|
+
...(path.includes("{id}") ? ["id"] : []),
|
|
132
|
+
...(parameters.some((parameter) => parameter.name === "idempotency-key")
|
|
133
|
+
? ["commandId"]
|
|
134
|
+
: []),
|
|
135
|
+
...(body === undefined ? [] : ["input"]),
|
|
136
|
+
].sort());
|
|
137
|
+
expect(tool.inputSchema.type).toBe("object");
|
|
138
|
+
expect(tool.inputSchema.additionalProperties).toBe(false);
|
|
139
|
+
expect(tool.inputSchema.required).toEqual([
|
|
140
|
+
...(path.includes("{id}") ? ["id"] : []),
|
|
141
|
+
...(parameters.some((parameter) => parameter.name === "idempotency-key")
|
|
142
|
+
? ["commandId"]
|
|
143
|
+
: []),
|
|
144
|
+
...(body === undefined ? [] : ["input"]),
|
|
145
|
+
]);
|
|
146
|
+
if (body !== undefined && tool.inputSchema.$defs === undefined)
|
|
147
|
+
expect(tool.inputSchema.properties["input"]).toEqual(body);
|
|
148
|
+
if (success !== undefined &&
|
|
149
|
+
tool.outputSchema !== undefined &&
|
|
150
|
+
tool.outputSchema["$defs"] === undefined)
|
|
151
|
+
expect(tool.outputSchema).toEqual(success);
|
|
152
|
+
expect(tool.outputSchema === undefined).toBe(success === undefined);
|
|
153
|
+
expect(tool.annotations.readOnlyHint).toBe(path.endsWith("/Count") ||
|
|
154
|
+
path.endsWith("/Peek") ||
|
|
155
|
+
path.endsWith("/Snapshot") ||
|
|
156
|
+
path.endsWith("/Level"));
|
|
157
|
+
}
|
|
158
|
+
const named = listed.result.tools.find((tool) => tool.name === "HttpRoom.Post");
|
|
159
|
+
expect(named.inputSchema.required).toEqual(["id", "commandId", "input"]);
|
|
160
|
+
expect(named.annotations).toEqual({ readOnlyHint: false, idempotentHint: true });
|
|
161
|
+
const lobby = listed.result.tools.find((tool) => tool.name === "HttpLobby.Join");
|
|
162
|
+
expect(lobby.inputSchema.required).toEqual(["commandId"]);
|
|
163
|
+
const mintTool = listed.result.tools.find((tool) => tool.name === "durable.commandIds");
|
|
164
|
+
expect(mintTool.inputSchema.properties).toEqual({});
|
|
165
|
+
expect(mintTool.annotations).toEqual({ readOnlyHint: false, idempotentHint: false });
|
|
166
|
+
})),
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "answers server/discover with the supported revision and the tools capability",
|
|
170
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
171
|
+
const server = yield* serveHttp({ mcp: { path: "/mcp", name: "rooms", version: "7" } });
|
|
172
|
+
const token = `${yield* tenantOf}:alice`;
|
|
173
|
+
const reply = yield* rpc(server, { token, method: "server/discover" });
|
|
174
|
+
expect(reply.status).toBe(200);
|
|
175
|
+
expect(reply.body).toMatchObject({
|
|
176
|
+
jsonrpc: "2.0",
|
|
177
|
+
id: 1,
|
|
178
|
+
result: {
|
|
179
|
+
resultType: "complete",
|
|
180
|
+
supportedVersions: [MCP_VERSION],
|
|
181
|
+
capabilities: { tools: {} },
|
|
182
|
+
cacheScope: "public",
|
|
183
|
+
_meta: { "io.modelcontextprotocol/serverInfo": { name: "rooms", version: "7" } },
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
})),
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "runs a command once per command id across MCP and HTTP, and refuses a reused id with other input on either",
|
|
190
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
191
|
+
const server = yield* serveHttp(mcpConformanceOptions);
|
|
192
|
+
const tenant = yield* tenantOf;
|
|
193
|
+
const token = `${tenant}:alice`;
|
|
194
|
+
const commandId = yield* mint(server, token);
|
|
195
|
+
const before = runs.count;
|
|
196
|
+
const first = yield* callTool(server, token, "HttpRoom.Post", {
|
|
197
|
+
id: "shared",
|
|
198
|
+
commandId,
|
|
199
|
+
input: { text: "a" },
|
|
200
|
+
});
|
|
201
|
+
expect(first).toMatchObject({ isError: false, body: 1, structured: 1 });
|
|
202
|
+
expect(runs.count).toBe(before + 1);
|
|
203
|
+
const overHttp = yield* server.send("/actors/HttpRoom/shared/Post", {
|
|
204
|
+
token,
|
|
205
|
+
key: commandId,
|
|
206
|
+
body: { text: "a" },
|
|
207
|
+
});
|
|
208
|
+
expect(overHttp).toMatchObject({ status: 200, body: 1 });
|
|
209
|
+
const again = yield* callTool(server, token, "HttpRoom.Post", {
|
|
210
|
+
id: "shared",
|
|
211
|
+
commandId,
|
|
212
|
+
input: { text: "a" },
|
|
213
|
+
});
|
|
214
|
+
expect(again).toMatchObject({ isError: false, body: 1 });
|
|
215
|
+
expect(runs.count).toBe(before + 1);
|
|
216
|
+
expect(yield* receipts(tenant, "HttpRoom", "shared")).toBe(1);
|
|
217
|
+
const conflict = yield* callTool(server, token, "HttpRoom.Post", {
|
|
218
|
+
id: "shared",
|
|
219
|
+
commandId,
|
|
220
|
+
input: { text: "b" },
|
|
221
|
+
});
|
|
222
|
+
const conflictOverHttp = yield* server.send("/actors/HttpRoom/shared/Post", {
|
|
223
|
+
token,
|
|
224
|
+
key: commandId,
|
|
225
|
+
body: { text: "b" },
|
|
226
|
+
});
|
|
227
|
+
expect(conflict.isError).toBe(true);
|
|
228
|
+
expect(conflict.body).toEqual(yield* envelope(CommandConflict.make({ commandId })));
|
|
229
|
+
expect(conflict.body).toEqual(conflictOverHttp.body);
|
|
230
|
+
expect(runs.count).toBe(before + 1);
|
|
231
|
+
})),
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "answers declared and framework failures with the same bodies as HTTP, and never mints a replacement for an expired id",
|
|
235
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
236
|
+
const server = yield* serveHttp(mcpConformanceOptions);
|
|
237
|
+
const actors = yield* InternalActors;
|
|
238
|
+
const tenant = yield* tenantOf;
|
|
239
|
+
const token = `${tenant}:alice`;
|
|
240
|
+
for (const [text, status] of [
|
|
241
|
+
["full", 422],
|
|
242
|
+
["closed", 423],
|
|
243
|
+
]) {
|
|
244
|
+
const overHttp = yield* server.send(`/actors/HttpRoom/${text}-http/Post`, {
|
|
245
|
+
token,
|
|
246
|
+
key: yield* server.mint(),
|
|
247
|
+
body: { text },
|
|
248
|
+
});
|
|
249
|
+
const overMcp = yield* callTool(server, token, "HttpRoom.Post", {
|
|
250
|
+
id: `${text}-mcp`,
|
|
251
|
+
commandId: yield* mint(server, token),
|
|
252
|
+
input: { text },
|
|
253
|
+
});
|
|
254
|
+
expect(overHttp.status).toBe(status);
|
|
255
|
+
expect(overMcp.isError).toBe(true);
|
|
256
|
+
expect(overMcp.body).toEqual(overHttp.body);
|
|
257
|
+
}
|
|
258
|
+
const before = runs.count;
|
|
259
|
+
const expired = yield* server.mint(-actors.retryWindowMs - 1);
|
|
260
|
+
const cases = [
|
|
261
|
+
{ id: "failures", commandId: expired, input: { text: "a" } },
|
|
262
|
+
{ id: "failures", commandId: "v1.not-an-id", input: { text: "a" } },
|
|
263
|
+
{ id: "failures", commandId: yield* server.mint(60 * 60_000), input: { text: "a" } },
|
|
264
|
+
{ id: "failures", commandId: yield* server.mint(), input: { text: 5 } },
|
|
265
|
+
{ id: "failures", commandId: yield* server.mint(), input: {} },
|
|
266
|
+
];
|
|
267
|
+
for (const arguments_ of cases) {
|
|
268
|
+
const overHttp = yield* server.send(`/actors/HttpRoom/${arguments_.id}/Post`, {
|
|
269
|
+
token,
|
|
270
|
+
key: arguments_.commandId,
|
|
271
|
+
body: arguments_.input,
|
|
272
|
+
});
|
|
273
|
+
const overMcp = yield* callTool(server, token, "HttpRoom.Post", arguments_);
|
|
274
|
+
expect(overHttp.status >= 400).toBe(true);
|
|
275
|
+
expect(overMcp.isError).toBe(true);
|
|
276
|
+
expect(overMcp.body).toEqual(overHttp.body);
|
|
277
|
+
}
|
|
278
|
+
const expiredOverMcp = yield* callTool(server, token, "HttpRoom.Post", cases[0]);
|
|
279
|
+
expect(expiredOverMcp.body).toEqual(yield* envelope(CommandExpired.make({ commandId: expired })));
|
|
280
|
+
const withoutId = yield* callTool(server, token, "HttpRoom.Post", {
|
|
281
|
+
id: "failures",
|
|
282
|
+
input: { text: "a" },
|
|
283
|
+
});
|
|
284
|
+
const withoutKey = yield* server.send("/actors/HttpRoom/failures/Post", {
|
|
285
|
+
token,
|
|
286
|
+
body: { text: "a" },
|
|
287
|
+
});
|
|
288
|
+
expect(withoutId.body).toEqual(withoutKey.body);
|
|
289
|
+
expect(yield* reasonOf(withoutId.body)).toEqual({
|
|
290
|
+
tag: "InvalidInput",
|
|
291
|
+
code: "missing_command_id",
|
|
292
|
+
});
|
|
293
|
+
expect(runs.count).toBe(before);
|
|
294
|
+
expect(yield* receipts(tenant, "HttpRoom", "failures")).toBe(0);
|
|
295
|
+
})),
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "answers a defect with the opaque Defect body, and a caller's own principal is the only one a tool call runs as",
|
|
299
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
300
|
+
const server = yield* serveHttp(mcpConformanceOptions);
|
|
301
|
+
const tenant = yield* tenantOf;
|
|
302
|
+
const crash = yield* callTool(server, `${tenant}:alice`, "HttpRoom.Crash", {
|
|
303
|
+
id: "defect",
|
|
304
|
+
commandId: yield* mint(server, `${tenant}:alice`),
|
|
305
|
+
});
|
|
306
|
+
expect(crash.isError).toBe(true);
|
|
307
|
+
expect(isDefectBody(crash.body)).toBe(true);
|
|
308
|
+
expect(Object.keys(crash.body).sort()).toEqual(["_tag", "traceId"]);
|
|
309
|
+
expect(crash.text?.includes("secret")).toBe(false);
|
|
310
|
+
expect(yield* receipts(tenant, "HttpRoom", "defect")).toBe(0);
|
|
311
|
+
for (const subject of ["alice", "bob"]) {
|
|
312
|
+
const token = `${tenant}:${subject}`;
|
|
313
|
+
const whoami = yield* callTool(server, token, "HttpRoom.Whoami", {
|
|
314
|
+
id: "principals",
|
|
315
|
+
commandId: yield* mint(server, token),
|
|
316
|
+
});
|
|
317
|
+
expect(whoami.body).toBe(`${tenant}/${subject}`);
|
|
318
|
+
}
|
|
319
|
+
const smuggled = yield* callTool(server, `${tenant}:alice`, "HttpRoom.Whoami", {
|
|
320
|
+
id: "principals",
|
|
321
|
+
commandId: yield* mint(server, `${tenant}:alice`),
|
|
322
|
+
tenant: "other",
|
|
323
|
+
});
|
|
324
|
+
expect(smuggled.isError).toBe(true);
|
|
325
|
+
expect(smuggled.body).toEqual(yield* envelope(InvalidInput.make({
|
|
326
|
+
code: "decode",
|
|
327
|
+
issues: [{ path: "tenant", message: "Unexpected key" }],
|
|
328
|
+
})));
|
|
329
|
+
})),
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "fails missing, invalid, and expired credentials with the HTTP body before any JSON-RPC, and applies authorize to tool calls",
|
|
333
|
+
run: ({ expect, environment, access }) => environment.run(Effect.gen(function* () {
|
|
334
|
+
const server = yield* serveHttp(mcpConformanceOptions);
|
|
335
|
+
const tenant = yield* tenantOf;
|
|
336
|
+
const token = `${tenant}:alice`;
|
|
337
|
+
const before = runs.count;
|
|
338
|
+
for (const [credential, code] of [
|
|
339
|
+
[undefined, "missing_credentials"],
|
|
340
|
+
["no-colon", "invalid_credentials"],
|
|
341
|
+
["expired", "expired"],
|
|
342
|
+
]) {
|
|
343
|
+
const reply = yield* rpc(server, { token: credential, method: "server/discover" });
|
|
344
|
+
expect(reply.status).toBe(401);
|
|
345
|
+
expect(reply.headers.get("www-authenticate")).toBe("Bearer");
|
|
346
|
+
expect(reply.body).toEqual(yield* envelope(Unauthorized.make({ code })));
|
|
347
|
+
}
|
|
348
|
+
expect(runs.count).toBe(before);
|
|
349
|
+
const commandId = yield* mint(server, token);
|
|
350
|
+
access.denied.add("Post");
|
|
351
|
+
access.denied.add("Count");
|
|
352
|
+
const denied = yield* Effect.gen(function* () {
|
|
353
|
+
const command = yield* callTool(server, token, "HttpRoom.Post", {
|
|
354
|
+
id: "denied",
|
|
355
|
+
commandId,
|
|
356
|
+
input: { text: "a" },
|
|
357
|
+
});
|
|
358
|
+
const overHttp = yield* server.send("/actors/HttpRoom/denied/Post", {
|
|
359
|
+
token,
|
|
360
|
+
key: commandId,
|
|
361
|
+
body: { text: "a" },
|
|
362
|
+
});
|
|
363
|
+
const query = yield* callTool(server, token, "HttpRoom.Count", { id: "denied" });
|
|
364
|
+
return { command, overHttp, query };
|
|
365
|
+
}).pipe(Effect.ensuring(Effect.sync(() => {
|
|
366
|
+
access.denied.clear();
|
|
367
|
+
})));
|
|
368
|
+
const accessDenied = yield* envelope(Unauthorized.make({ code: "access_denied" }));
|
|
369
|
+
expect(denied.command).toMatchObject({ isError: true, body: accessDenied });
|
|
370
|
+
expect(denied.overHttp.body).toEqual(accessDenied);
|
|
371
|
+
expect(denied.query).toMatchObject({ isError: true, body: accessDenied });
|
|
372
|
+
expect(runs.count).toBe(before);
|
|
373
|
+
expect(yield* receipts(tenant, "HttpRoom", "denied")).toBe(0);
|
|
374
|
+
})),
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: "refuses a request whose protocol headers are missing or disagree with its body, an unsupported revision, or an unknown method, tool, or internal member, before any turn",
|
|
378
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
379
|
+
const server = yield* serveHttp(mcpConformanceOptions);
|
|
380
|
+
const tenant = yield* tenantOf;
|
|
381
|
+
const token = `${tenant}:alice`;
|
|
382
|
+
const before = runs.count;
|
|
383
|
+
const call = (name, extra = {}) => ({
|
|
384
|
+
jsonrpc: "2.0",
|
|
385
|
+
id: 1,
|
|
386
|
+
method: "tools/call",
|
|
387
|
+
params: Object.assign({ name, arguments: { id: "headers" }, _meta: META }, extra),
|
|
388
|
+
});
|
|
389
|
+
const headers = {
|
|
390
|
+
"mcp-protocol-version": MCP_VERSION,
|
|
391
|
+
"mcp-method": "tools/call",
|
|
392
|
+
"mcp-name": "HttpRoom.Count",
|
|
393
|
+
};
|
|
394
|
+
const refusals = [
|
|
395
|
+
[{ "mcp-method": headers["mcp-method"], "mcp-name": headers["mcp-name"] }, -32020],
|
|
396
|
+
[{ ...headers, "mcp-protocol-version": "2025-11-25" }, -32020],
|
|
397
|
+
[{ ...headers, "mcp-method": "tools/list" }, -32020],
|
|
398
|
+
[{ ...headers, "mcp-name": "HttpRoom.Peek" }, -32020],
|
|
399
|
+
[{ "mcp-protocol-version": MCP_VERSION, "mcp-method": "tools/call" }, -32020],
|
|
400
|
+
];
|
|
401
|
+
for (const [sent, code] of refusals) {
|
|
402
|
+
const reply = yield* server.send("/mcp", {
|
|
403
|
+
token,
|
|
404
|
+
body: call("HttpRoom.Count"),
|
|
405
|
+
headers: sent,
|
|
406
|
+
});
|
|
407
|
+
expect(reply.status).toBe(400);
|
|
408
|
+
expect((yield* rpcError(reply)).code).toBe(code);
|
|
409
|
+
}
|
|
410
|
+
const unsupported = yield* server.send("/mcp", {
|
|
411
|
+
token,
|
|
412
|
+
body: call("HttpRoom.Count", {
|
|
413
|
+
_meta: { ...META, "io.modelcontextprotocol/protocolVersion": "2099-01-01" },
|
|
414
|
+
}),
|
|
415
|
+
headers: { ...headers, "mcp-protocol-version": "2099-01-01" },
|
|
416
|
+
});
|
|
417
|
+
expect(unsupported.status).toBe(400);
|
|
418
|
+
expect(yield* rpcError(unsupported)).toMatchObject({
|
|
419
|
+
code: -32022,
|
|
420
|
+
data: { supported: [MCP_VERSION], requested: "2099-01-01" },
|
|
421
|
+
});
|
|
422
|
+
const incomplete = [
|
|
423
|
+
{ name: "HttpRoom.Count" },
|
|
424
|
+
{
|
|
425
|
+
name: "HttpRoom.Count",
|
|
426
|
+
_meta: { "io.modelcontextprotocol/protocolVersion": MCP_VERSION },
|
|
427
|
+
},
|
|
428
|
+
];
|
|
429
|
+
for (const params of incomplete) {
|
|
430
|
+
const reply = yield* server.send("/mcp", {
|
|
431
|
+
token,
|
|
432
|
+
body: { jsonrpc: "2.0", id: 1, method: "tools/call", params },
|
|
433
|
+
headers,
|
|
434
|
+
});
|
|
435
|
+
expect(reply.status).toBe(400);
|
|
436
|
+
expect((yield* rpcError(reply)).code).toBe(-32602);
|
|
437
|
+
}
|
|
438
|
+
const unknownMethod = yield* rpc(server, { token, method: "resources/list" });
|
|
439
|
+
expect(unknownMethod.status).toBe(404);
|
|
440
|
+
expect((yield* rpcError(unknownMethod)).code).toBe(-32601);
|
|
441
|
+
const paged = yield* rpc(server, { token, method: "tools/list", params: { cursor: "x" } });
|
|
442
|
+
expect(paged.status).toBe(400);
|
|
443
|
+
expect((yield* rpcError(paged)).code).toBe(-32602);
|
|
444
|
+
for (const name of ["HttpRoom.Secret", "HttpRoom.Nope"]) {
|
|
445
|
+
const reply = yield* server.send("/mcp", {
|
|
446
|
+
token,
|
|
447
|
+
body: call(name),
|
|
448
|
+
headers: { ...headers, "mcp-name": name },
|
|
449
|
+
});
|
|
450
|
+
expect(reply.status).toBe(400);
|
|
451
|
+
expect(yield* rpcError(reply)).toEqual({
|
|
452
|
+
code: -32602,
|
|
453
|
+
message: `Unknown tool: ${name}`,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
const encoded = yield* server.send("/mcp", {
|
|
457
|
+
token,
|
|
458
|
+
body: call("HttpRoom.Count"),
|
|
459
|
+
headers: {
|
|
460
|
+
...headers,
|
|
461
|
+
"mcp-name": `=?base64?${Base64.encode("HttpRoom.Count")}?=`,
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
expect(encoded.status).toBe(200);
|
|
465
|
+
expect(runs.count).toBe(before);
|
|
466
|
+
expect(yield* receipts(tenant, "HttpRoom", "headers")).toBe(0);
|
|
467
|
+
})),
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
name: "accepts a notification with 202, refuses GET and DELETE with 405, and answers a body that is not one JSON-RPC request with a JSON-RPC error",
|
|
471
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
472
|
+
const server = yield* serveHttp({
|
|
473
|
+
...mcpConformanceOptions,
|
|
474
|
+
limits: { requestBytes: 4096 },
|
|
475
|
+
});
|
|
476
|
+
const token = `${yield* tenantOf}:alice`;
|
|
477
|
+
const notification = yield* server.send("/mcp", {
|
|
478
|
+
token,
|
|
479
|
+
body: { jsonrpc: "2.0", method: "notifications/initialized" },
|
|
480
|
+
});
|
|
481
|
+
expect(notification.status).toBe(202);
|
|
482
|
+
expect(notification.text).toBe("");
|
|
483
|
+
for (const method of ["GET", "DELETE"]) {
|
|
484
|
+
const reply = yield* server.send("/mcp", { method, token });
|
|
485
|
+
expect(reply.status).toBe(405);
|
|
486
|
+
expect(reply.headers.get("allow")).toBe("POST");
|
|
487
|
+
}
|
|
488
|
+
const malformed = [
|
|
489
|
+
[{ raw: "{not json" }, -32700],
|
|
490
|
+
[{ raw: "" }, -32700],
|
|
491
|
+
[{ bytes: new Uint8Array([0xff, 0xfe, 0x7b]) }, -32700],
|
|
492
|
+
[{ raw: "[]" }, -32600],
|
|
493
|
+
[{ raw: '{"jsonrpc":"1.0","id":1,"method":"tools/list"}' }, -32600],
|
|
494
|
+
[{ raw: '{"jsonrpc":"2.0","id":1}' }, -32600],
|
|
495
|
+
];
|
|
496
|
+
for (const [body, code] of malformed) {
|
|
497
|
+
const reply = yield* server.send("/mcp", { token, ...body });
|
|
498
|
+
expect(reply.status).toBe(400);
|
|
499
|
+
expect((yield* rpcError(reply)).code).toBe(code);
|
|
500
|
+
}
|
|
501
|
+
const other = yield* server.send("/mcp", {
|
|
502
|
+
token,
|
|
503
|
+
raw: "{}",
|
|
504
|
+
headers: { "content-type": "text/plain" },
|
|
505
|
+
});
|
|
506
|
+
expect(other.status).toBe(415);
|
|
507
|
+
expect(yield* reasonOf(other.body)).toEqual({
|
|
508
|
+
tag: "InvalidInput",
|
|
509
|
+
code: "unsupported_media_type",
|
|
510
|
+
});
|
|
511
|
+
const large = yield* server.send("/mcp", {
|
|
512
|
+
token,
|
|
513
|
+
raw: `{"pad":"${"x".repeat(5000)}"}`,
|
|
514
|
+
});
|
|
515
|
+
expect(large.status).toBe(413);
|
|
516
|
+
const foreign = yield* server.send("/mcp", {
|
|
517
|
+
token,
|
|
518
|
+
body: { jsonrpc: "2.0", id: 1, method: "server/discover" },
|
|
519
|
+
headers: { origin: "https://evil.example" },
|
|
520
|
+
});
|
|
521
|
+
expect(foreign.status).toBe(403);
|
|
522
|
+
expect(yield* reasonOf(foreign.body)).toEqual({
|
|
523
|
+
tag: "InvalidInput",
|
|
524
|
+
code: "origin_not_allowed",
|
|
525
|
+
});
|
|
526
|
+
})),
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
name: "answers queries, void commands, singletons, and minted actors like their routes, and refuses arguments a tool does not take",
|
|
530
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
531
|
+
const server = yield* serveHttp(mcpConformanceOptions);
|
|
532
|
+
const tenant = yield* tenantOf;
|
|
533
|
+
const token = `${tenant}:alice`;
|
|
534
|
+
const peek = yield* callTool(server, token, "HttpRoom.Peek", { id: "reads" });
|
|
535
|
+
const peekOverHttp = yield* server.send("/actors/HttpRoom/reads/Peek", { token });
|
|
536
|
+
expect(peekOverHttp.body).toBe(null);
|
|
537
|
+
expect(peek).toMatchObject({ isError: false, body: null, structured: null });
|
|
538
|
+
const snapshot = yield* callTool(server, token, "HttpTally.Snapshot", { id: "reads" });
|
|
539
|
+
const snapshotOverHttp = yield* server.send("/actors/HttpTally/reads/Snapshot", { token });
|
|
540
|
+
expect(snapshot.structured).toEqual(snapshotOverHttp.body);
|
|
541
|
+
expect(snapshot.body).toEqual(snapshotOverHttp.body);
|
|
542
|
+
const join = yield* callTool(server, token, "HttpLobby.Join", {
|
|
543
|
+
commandId: yield* mint(server, token),
|
|
544
|
+
});
|
|
545
|
+
expect(join).toMatchObject({ isError: false, body: 1, structured: 1 });
|
|
546
|
+
const leave = yield* callTool(server, token, "HttpLobby.Leave", {
|
|
547
|
+
commandId: yield* mint(server, token),
|
|
548
|
+
});
|
|
549
|
+
expect(leave).toMatchObject({ isError: false, empty: true, structured: undefined });
|
|
550
|
+
const leaveOverHttp = yield* server.send("/actors/HttpLobby/Leave", {
|
|
551
|
+
token,
|
|
552
|
+
key: yield* server.mint(),
|
|
553
|
+
});
|
|
554
|
+
expect(leaveOverHttp.status).toBe(204);
|
|
555
|
+
const unexpected = [
|
|
556
|
+
["HttpLobby.Join", { id: "x", commandId: yield* mint(server, token) }, "id"],
|
|
557
|
+
["HttpRoom.Count", { id: "reads", commandId: yield* mint(server, token) }, "commandId"],
|
|
558
|
+
[
|
|
559
|
+
"HttpRoom.Crash",
|
|
560
|
+
{ id: "reads", commandId: yield* mint(server, token), input: {} },
|
|
561
|
+
"input",
|
|
562
|
+
],
|
|
563
|
+
["durable.commandIds", { id: "x" }, "id"],
|
|
564
|
+
];
|
|
565
|
+
for (const [name, args, path] of unexpected) {
|
|
566
|
+
const reply = yield* callTool(server, token, name, args);
|
|
567
|
+
expect(reply.isError).toBe(true);
|
|
568
|
+
expect(reply.body).toEqual(yield* envelope(InvalidInput.make({
|
|
569
|
+
code: "decode",
|
|
570
|
+
issues: [{ path, message: "Unexpected key" }],
|
|
571
|
+
})));
|
|
572
|
+
}
|
|
573
|
+
const missing = [
|
|
574
|
+
["HttpRoom.Count", {}, "id"],
|
|
575
|
+
["HttpRoom.Post", { id: "reads", commandId: yield* mint(server, token) }, "input"],
|
|
576
|
+
];
|
|
577
|
+
for (const [name, args, path] of missing) {
|
|
578
|
+
const reply = yield* callTool(server, token, name, args);
|
|
579
|
+
expect(reply.body).toEqual(yield* envelope(InvalidInput.make({ code: "decode", issues: [{ path, message: "Missing key" }] })));
|
|
580
|
+
}
|
|
581
|
+
const dots = yield* callTool(server, token, "HttpRoom.Count", { id: ".." });
|
|
582
|
+
expect(yield* reasonOf(dots.body)).toEqual({ tag: "InvalidInput", code: "unservable_id" });
|
|
583
|
+
const ticket = yield* callTool(server, token, "HttpTicket.Join", {
|
|
584
|
+
id: "not-a-uuid",
|
|
585
|
+
commandId: yield* mint(server, token),
|
|
586
|
+
});
|
|
587
|
+
const ticketOverHttp = yield* server.send("/actors/HttpTicket/not-a-uuid/Join", {
|
|
588
|
+
token,
|
|
589
|
+
key: yield* server.mint(),
|
|
590
|
+
});
|
|
591
|
+
expect(ticket.isError).toBe(true);
|
|
592
|
+
expect(ticket.body).toEqual(ticketOverHttp.body);
|
|
593
|
+
})),
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: "fails Actor.serve at startup when mcp.path collides with a protocol route or the OpenAPI path",
|
|
597
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
598
|
+
const internal = Layer.succeed(InternalActors, yield* InternalActors);
|
|
599
|
+
for (const path of ["/protocol", "/command-ids", "/ready", "/actors/Room"]) {
|
|
600
|
+
const exit = yield* HttpRouter.toHttpEffect(serve({ actors: [HttpRoom], auth: tokens, mcp: { path } }).pipe(Layer.provide(internal))).pipe(Effect.exit);
|
|
601
|
+
expect(Exit.isFailure(exit) && Cause.pretty(exit.cause)).toContain(`mcp.path ${path} collides with a protocol route`);
|
|
602
|
+
}
|
|
603
|
+
const same = yield* HttpRouter.toHttpEffect(serve({
|
|
604
|
+
actors: [HttpRoom],
|
|
605
|
+
auth: tokens,
|
|
606
|
+
openapi: { path: "/docs" },
|
|
607
|
+
mcp: { path: "/docs" },
|
|
608
|
+
}).pipe(Layer.provide(internal))).pipe(Effect.exit);
|
|
609
|
+
expect(Exit.isFailure(same) && Cause.pretty(same.cause)).toContain("mcp.path and openapi.path are both /docs");
|
|
610
|
+
const lobby = yield* HttpRouter.toHttpEffect(serve({ actors: [HttpLobby], auth: tokens, mcp: { path: "/mcp" } }).pipe(Layer.provide(internal))).pipe(Effect.exit);
|
|
611
|
+
expect(Exit.isSuccess(lobby)).toBe(true);
|
|
612
|
+
})),
|
|
613
|
+
},
|
|
614
|
+
];
|
|
615
|
+
/** Protocol cases call the served HTTP actors. */
|
|
616
|
+
export const protocolsSuite = {
|
|
617
|
+
uses: [httpSuite],
|
|
618
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Duration, Effect, Schema } from "effect";
|
|
2
|
+
declare const BadAdvertised_base: Schema.Class<BadAdvertised, Schema.TaggedStruct<"BadAdvertised", {
|
|
3
|
+
readonly reason: Schema.String;
|
|
4
|
+
}>, import("effect/Cause").YieldableError>;
|
|
5
|
+
/** An advertised-address list that cannot be read. */
|
|
6
|
+
export declare class BadAdvertised extends BadAdvertised_base {
|
|
7
|
+
}
|
|
8
|
+
/** A runner's advertised address, as `host:port`. */
|
|
9
|
+
export interface AdvertisedAddress {
|
|
10
|
+
readonly host: string;
|
|
11
|
+
readonly port: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Parses a comma-separated list of `host:port`, where `host` may be a name,
|
|
15
|
+
* an IPv4 address, or a bracketed IPv6 address. A malformed entry fails
|
|
16
|
+
* instead of being dropped, so a typo cannot pass as "every address reached".
|
|
17
|
+
*/
|
|
18
|
+
export declare const parseAdvertised: (list: string) => Effect.Effect<ReadonlyArray<AdvertisedAddress>, BadAdvertised>;
|
|
19
|
+
/** The `host:port` of every address this process cannot connect to. */
|
|
20
|
+
export declare const unreachable: (addresses: readonly AdvertisedAddress[], timeout: Duration.Input) => Effect.Effect<string[], never, never>;
|
|
21
|
+
export {};
|