@methodts/runtime 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__fixtures__/executor-fixtures.d.ts +10 -0
- package/dist/__fixtures__/executor-fixtures.d.ts.map +1 -0
- package/dist/__fixtures__/executor-fixtures.js +36 -0
- package/dist/__fixtures__/executor-fixtures.js.map +1 -0
- package/dist/architecture.test.d.ts +2 -0
- package/dist/architecture.test.d.ts.map +1 -0
- package/dist/architecture.test.js +143 -0
- package/dist/architecture.test.js.map +1 -0
- package/dist/config/cost-governor-config.d.ts +40 -0
- package/dist/config/cost-governor-config.d.ts.map +1 -0
- package/dist/config/cost-governor-config.js +48 -0
- package/dist/config/cost-governor-config.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/sessions-config.d.ts +29 -0
- package/dist/config/sessions-config.d.ts.map +1 -0
- package/dist/config/sessions-config.js +37 -0
- package/dist/config/sessions-config.js.map +1 -0
- package/dist/config/strategies-config.d.ts +38 -0
- package/dist/config/strategies-config.d.ts.map +1 -0
- package/dist/config/strategies-config.js +41 -0
- package/dist/config/strategies-config.js.map +1 -0
- package/dist/cost-governor/backpressure-queue.d.ts +20 -0
- package/dist/cost-governor/backpressure-queue.d.ts.map +1 -0
- package/dist/cost-governor/backpressure-queue.js +78 -0
- package/dist/cost-governor/backpressure-queue.js.map +1 -0
- package/dist/cost-governor/backpressure-queue.test.d.ts +2 -0
- package/dist/cost-governor/backpressure-queue.test.d.ts.map +1 -0
- package/dist/cost-governor/backpressure-queue.test.js +48 -0
- package/dist/cost-governor/backpressure-queue.test.js.map +1 -0
- package/dist/cost-governor/cost-events.d.ts +65 -0
- package/dist/cost-governor/cost-events.d.ts.map +1 -0
- package/dist/cost-governor/cost-events.js +48 -0
- package/dist/cost-governor/cost-events.js.map +1 -0
- package/dist/cost-governor/cost-governor-app-id.test.d.ts +19 -0
- package/dist/cost-governor/cost-governor-app-id.test.d.ts.map +1 -0
- package/dist/cost-governor/cost-governor-app-id.test.js +201 -0
- package/dist/cost-governor/cost-governor-app-id.test.js.map +1 -0
- package/dist/cost-governor/cost-oracle-impl.d.ts +19 -0
- package/dist/cost-governor/cost-oracle-impl.d.ts.map +1 -0
- package/dist/cost-governor/cost-oracle-impl.js +52 -0
- package/dist/cost-governor/cost-oracle-impl.js.map +1 -0
- package/dist/cost-governor/estimator.d.ts +22 -0
- package/dist/cost-governor/estimator.d.ts.map +1 -0
- package/dist/cost-governor/estimator.js +119 -0
- package/dist/cost-governor/estimator.js.map +1 -0
- package/dist/cost-governor/estimator.test.d.ts +2 -0
- package/dist/cost-governor/estimator.test.d.ts.map +1 -0
- package/dist/cost-governor/estimator.test.js +141 -0
- package/dist/cost-governor/estimator.test.js.map +1 -0
- package/dist/cost-governor/index.d.ts +75 -0
- package/dist/cost-governor/index.d.ts.map +1 -0
- package/dist/cost-governor/index.js +120 -0
- package/dist/cost-governor/index.js.map +1 -0
- package/dist/cost-governor/observations-store.d.ts +49 -0
- package/dist/cost-governor/observations-store.d.ts.map +1 -0
- package/dist/cost-governor/observations-store.js +179 -0
- package/dist/cost-governor/observations-store.js.map +1 -0
- package/dist/cost-governor/observations-store.test.d.ts +2 -0
- package/dist/cost-governor/observations-store.test.d.ts.map +1 -0
- package/dist/cost-governor/observations-store.test.js +191 -0
- package/dist/cost-governor/observations-store.test.js.map +1 -0
- package/dist/cost-governor/percentile.d.ts +17 -0
- package/dist/cost-governor/percentile.d.ts.map +1 -0
- package/dist/cost-governor/percentile.js +33 -0
- package/dist/cost-governor/percentile.js.map +1 -0
- package/dist/cost-governor/percentile.test.d.ts +2 -0
- package/dist/cost-governor/percentile.test.d.ts.map +1 -0
- package/dist/cost-governor/percentile.test.js +46 -0
- package/dist/cost-governor/percentile.test.js.map +1 -0
- package/dist/cost-governor/rate-governor-impl.d.ts +73 -0
- package/dist/cost-governor/rate-governor-impl.d.ts.map +1 -0
- package/dist/cost-governor/rate-governor-impl.js +148 -0
- package/dist/cost-governor/rate-governor-impl.js.map +1 -0
- package/dist/cost-governor/signature-builder.d.ts +22 -0
- package/dist/cost-governor/signature-builder.d.ts.map +1 -0
- package/dist/cost-governor/signature-builder.js +43 -0
- package/dist/cost-governor/signature-builder.js.map +1 -0
- package/dist/cost-governor/signature-builder.test.d.ts +2 -0
- package/dist/cost-governor/signature-builder.test.d.ts.map +1 -0
- package/dist/cost-governor/signature-builder.test.js +58 -0
- package/dist/cost-governor/signature-builder.test.js.map +1 -0
- package/dist/cost-governor/token-bucket.d.ts +57 -0
- package/dist/cost-governor/token-bucket.d.ts.map +1 -0
- package/dist/cost-governor/token-bucket.js +109 -0
- package/dist/cost-governor/token-bucket.js.map +1 -0
- package/dist/cost-governor/token-bucket.test.d.ts +2 -0
- package/dist/cost-governor/token-bucket.test.d.ts.map +1 -0
- package/dist/cost-governor/token-bucket.test.js +67 -0
- package/dist/cost-governor/token-bucket.test.js.map +1 -0
- package/dist/dlq/cortex-dlq-observer.d.ts +22 -0
- package/dist/dlq/cortex-dlq-observer.d.ts.map +1 -0
- package/dist/dlq/cortex-dlq-observer.js +29 -0
- package/dist/dlq/cortex-dlq-observer.js.map +1 -0
- package/dist/dlq/dlq-observer.test.d.ts +8 -0
- package/dist/dlq/dlq-observer.test.d.ts.map +1 -0
- package/dist/dlq/dlq-observer.test.js +103 -0
- package/dist/dlq/dlq-observer.test.js.map +1 -0
- package/dist/dlq/index.d.ts +6 -0
- package/dist/dlq/index.d.ts.map +1 -0
- package/dist/dlq/index.js +6 -0
- package/dist/dlq/index.js.map +1 -0
- package/dist/event-bus/adapters.d.ts +50 -0
- package/dist/event-bus/adapters.d.ts.map +1 -0
- package/dist/event-bus/adapters.js +51 -0
- package/dist/event-bus/adapters.js.map +1 -0
- package/dist/event-bus/adapters.test.d.ts +5 -0
- package/dist/event-bus/adapters.test.d.ts.map +1 -0
- package/dist/event-bus/adapters.test.js +73 -0
- package/dist/event-bus/adapters.test.js.map +1 -0
- package/dist/event-bus/agent-event-adapter.d.ts +22 -0
- package/dist/event-bus/agent-event-adapter.d.ts.map +1 -0
- package/dist/event-bus/agent-event-adapter.js +49 -0
- package/dist/event-bus/agent-event-adapter.js.map +1 -0
- package/dist/event-bus/agent-event-adapter.test.d.ts +5 -0
- package/dist/event-bus/agent-event-adapter.test.d.ts.map +1 -0
- package/dist/event-bus/agent-event-adapter.test.js +170 -0
- package/dist/event-bus/agent-event-adapter.test.js.map +1 -0
- package/dist/event-bus/channel-sink.d.ts +71 -0
- package/dist/event-bus/channel-sink.d.ts.map +1 -0
- package/dist/event-bus/channel-sink.js +159 -0
- package/dist/event-bus/channel-sink.js.map +1 -0
- package/dist/event-bus/channel-sink.test.d.ts +5 -0
- package/dist/event-bus/channel-sink.test.d.ts.map +1 -0
- package/dist/event-bus/channel-sink.test.js +234 -0
- package/dist/event-bus/channel-sink.test.js.map +1 -0
- package/dist/event-bus/event-types.snapshot.test.d.ts +27 -0
- package/dist/event-bus/event-types.snapshot.test.d.ts.map +1 -0
- package/dist/event-bus/event-types.snapshot.test.js +165 -0
- package/dist/event-bus/event-types.snapshot.test.js.map +1 -0
- package/dist/event-bus/genesis-sink.d.ts +55 -0
- package/dist/event-bus/genesis-sink.d.ts.map +1 -0
- package/dist/event-bus/genesis-sink.js +141 -0
- package/dist/event-bus/genesis-sink.js.map +1 -0
- package/dist/event-bus/genesis-sink.test.d.ts +5 -0
- package/dist/event-bus/genesis-sink.test.d.ts.map +1 -0
- package/dist/event-bus/genesis-sink.test.js +160 -0
- package/dist/event-bus/genesis-sink.test.js.map +1 -0
- package/dist/event-bus/in-memory-event-bus.d.ts +60 -0
- package/dist/event-bus/in-memory-event-bus.d.ts.map +1 -0
- package/dist/event-bus/in-memory-event-bus.js +274 -0
- package/dist/event-bus/in-memory-event-bus.js.map +1 -0
- package/dist/event-bus/in-memory-event-bus.test.d.ts +5 -0
- package/dist/event-bus/in-memory-event-bus.test.d.ts.map +1 -0
- package/dist/event-bus/in-memory-event-bus.test.js +457 -0
- package/dist/event-bus/in-memory-event-bus.test.js.map +1 -0
- package/dist/event-bus/index.d.ts +22 -0
- package/dist/event-bus/index.d.ts.map +1 -0
- package/dist/event-bus/index.js +17 -0
- package/dist/event-bus/index.js.map +1 -0
- package/dist/event-bus/persistence-sink.d.ts +74 -0
- package/dist/event-bus/persistence-sink.d.ts.map +1 -0
- package/dist/event-bus/persistence-sink.js +193 -0
- package/dist/event-bus/persistence-sink.js.map +1 -0
- package/dist/event-bus/persistence-sink.test.d.ts +6 -0
- package/dist/event-bus/persistence-sink.test.d.ts.map +1 -0
- package/dist/event-bus/persistence-sink.test.js +319 -0
- package/dist/event-bus/persistence-sink.test.js.map +1 -0
- package/dist/event-bus/session-checkpoint-sink.d.ts +91 -0
- package/dist/event-bus/session-checkpoint-sink.d.ts.map +1 -0
- package/dist/event-bus/session-checkpoint-sink.js +107 -0
- package/dist/event-bus/session-checkpoint-sink.js.map +1 -0
- package/dist/event-bus/session-checkpoint-sink.test.d.ts +5 -0
- package/dist/event-bus/session-checkpoint-sink.test.d.ts.map +1 -0
- package/dist/event-bus/session-checkpoint-sink.test.js +215 -0
- package/dist/event-bus/session-checkpoint-sink.test.js.map +1 -0
- package/dist/event-bus/webhook-connector.d.ts +59 -0
- package/dist/event-bus/webhook-connector.d.ts.map +1 -0
- package/dist/event-bus/webhook-connector.js +191 -0
- package/dist/event-bus/webhook-connector.js.map +1 -0
- package/dist/event-bus/webhook-connector.test.d.ts +5 -0
- package/dist/event-bus/webhook-connector.test.d.ts.map +1 -0
- package/dist/event-bus/webhook-connector.test.js +214 -0
- package/dist/event-bus/webhook-connector.test.js.map +1 -0
- package/dist/executors/cortex-job-backed-executor.d.ts +137 -0
- package/dist/executors/cortex-job-backed-executor.d.ts.map +1 -0
- package/dist/executors/cortex-job-backed-executor.js +441 -0
- package/dist/executors/cortex-job-backed-executor.js.map +1 -0
- package/dist/executors/cortex-job-backed-executor.test.d.ts +13 -0
- package/dist/executors/cortex-job-backed-executor.test.d.ts.map +1 -0
- package/dist/executors/cortex-job-backed-executor.test.js +303 -0
- package/dist/executors/cortex-job-backed-executor.test.js.map +1 -0
- package/dist/executors/index.d.ts +9 -0
- package/dist/executors/index.d.ts.map +1 -0
- package/dist/executors/index.js +9 -0
- package/dist/executors/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/ports/checkpoint-sink.d.ts +69 -0
- package/dist/ports/checkpoint-sink.d.ts.map +1 -0
- package/dist/ports/checkpoint-sink.js +16 -0
- package/dist/ports/checkpoint-sink.js.map +1 -0
- package/dist/ports/checkpoint.d.ts +68 -0
- package/dist/ports/checkpoint.d.ts.map +1 -0
- package/dist/ports/checkpoint.js +14 -0
- package/dist/ports/checkpoint.js.map +1 -0
- package/dist/ports/continuation-envelope-cross-app.test.d.ts +10 -0
- package/dist/ports/continuation-envelope-cross-app.test.d.ts.map +1 -0
- package/dist/ports/continuation-envelope-cross-app.test.js +95 -0
- package/dist/ports/continuation-envelope-cross-app.test.js.map +1 -0
- package/dist/ports/continuation-envelope.d.ts +199 -0
- package/dist/ports/continuation-envelope.d.ts.map +1 -0
- package/dist/ports/continuation-envelope.js +69 -0
- package/dist/ports/continuation-envelope.js.map +1 -0
- package/dist/ports/conversation.d.ts +64 -0
- package/dist/ports/conversation.d.ts.map +1 -0
- package/dist/ports/conversation.js +19 -0
- package/dist/ports/conversation.js.map +1 -0
- package/dist/ports/cost-oracle.d.ts +26 -0
- package/dist/ports/cost-oracle.d.ts.map +1 -0
- package/dist/ports/cost-oracle.js +9 -0
- package/dist/ports/cost-oracle.js.map +1 -0
- package/dist/ports/cross-app-invoker.d.ts +198 -0
- package/dist/ports/cross-app-invoker.d.ts.map +1 -0
- package/dist/ports/cross-app-invoker.js +157 -0
- package/dist/ports/cross-app-invoker.js.map +1 -0
- package/dist/ports/dlq-observer.d.ts +40 -0
- package/dist/ports/dlq-observer.d.ts.map +1 -0
- package/dist/ports/dlq-observer.js +20 -0
- package/dist/ports/dlq-observer.js.map +1 -0
- package/dist/ports/event-bus.d.ts +169 -0
- package/dist/ports/event-bus.d.ts.map +1 -0
- package/dist/ports/event-bus.js +20 -0
- package/dist/ports/event-bus.js.map +1 -0
- package/dist/ports/event-reader.d.ts +21 -0
- package/dist/ports/event-reader.d.ts.map +1 -0
- package/dist/ports/event-reader.js +12 -0
- package/dist/ports/event-reader.js.map +1 -0
- package/dist/ports/event-rotator.d.ts +39 -0
- package/dist/ports/event-rotator.d.ts.map +1 -0
- package/dist/ports/event-rotator.js +15 -0
- package/dist/ports/event-rotator.js.map +1 -0
- package/dist/ports/file-system.d.ts +48 -0
- package/dist/ports/file-system.d.ts.map +1 -0
- package/dist/ports/file-system.js +10 -0
- package/dist/ports/file-system.js.map +1 -0
- package/dist/ports/historical-observations.d.ts +39 -0
- package/dist/ports/historical-observations.d.ts.map +1 -0
- package/dist/ports/historical-observations.js +12 -0
- package/dist/ports/historical-observations.js.map +1 -0
- package/dist/ports/in-memory-source.d.ts +46 -0
- package/dist/ports/in-memory-source.d.ts.map +1 -0
- package/dist/ports/in-memory-source.js +69 -0
- package/dist/ports/in-memory-source.js.map +1 -0
- package/dist/ports/index.d.ts +32 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +10 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/job-backed-executor.d.ts +139 -0
- package/dist/ports/job-backed-executor.d.ts.map +1 -0
- package/dist/ports/job-backed-executor.js +56 -0
- package/dist/ports/job-backed-executor.js.map +1 -0
- package/dist/ports/methodology-source.d.ts +95 -0
- package/dist/ports/methodology-source.d.ts.map +1 -0
- package/dist/ports/methodology-source.js +26 -0
- package/dist/ports/methodology-source.js.map +1 -0
- package/dist/ports/native-session-discovery.d.ts +20 -0
- package/dist/ports/native-session-discovery.d.ts.map +1 -0
- package/dist/ports/native-session-discovery.js +13 -0
- package/dist/ports/native-session-discovery.js.map +1 -0
- package/dist/ports/projection-store.d.ts +48 -0
- package/dist/ports/projection-store.d.ts.map +1 -0
- package/dist/ports/projection-store.js +17 -0
- package/dist/ports/projection-store.js.map +1 -0
- package/dist/ports/projection.d.ts +29 -0
- package/dist/ports/projection.d.ts.map +1 -0
- package/dist/ports/projection.js +13 -0
- package/dist/ports/projection.js.map +1 -0
- package/dist/ports/rate-governor.d.ts +17 -0
- package/dist/ports/rate-governor.d.ts.map +1 -0
- package/dist/ports/rate-governor.js +11 -0
- package/dist/ports/rate-governor.js.map +1 -0
- package/dist/ports/schedule-client.d.ts +29 -0
- package/dist/ports/schedule-client.d.ts.map +1 -0
- package/dist/ports/schedule-client.js +2 -0
- package/dist/ports/schedule-client.js.map +1 -0
- package/dist/ports/session-pool.d.ts +162 -0
- package/dist/ports/session-pool.d.ts.map +1 -0
- package/dist/ports/session-pool.js +21 -0
- package/dist/ports/session-pool.js.map +1 -0
- package/dist/ports/session-store-errors.d.ts +22 -0
- package/dist/ports/session-store-errors.d.ts.map +1 -0
- package/dist/ports/session-store-errors.js +29 -0
- package/dist/ports/session-store-errors.js.map +1 -0
- package/dist/ports/session-store-types.d.ts +132 -0
- package/dist/ports/session-store-types.d.ts.map +1 -0
- package/dist/ports/session-store-types.js +14 -0
- package/dist/ports/session-store-types.js.map +1 -0
- package/dist/ports/session-store.d.ts +69 -0
- package/dist/ports/session-store.d.ts.map +1 -0
- package/dist/ports/session-store.js +23 -0
- package/dist/ports/session-store.js.map +1 -0
- package/dist/ports/yaml-loader.d.ts +15 -0
- package/dist/ports/yaml-loader.d.ts.map +1 -0
- package/dist/ports/yaml-loader.js +13 -0
- package/dist/ports/yaml-loader.js.map +1 -0
- package/dist/scheduling/index.d.ts +6 -0
- package/dist/scheduling/index.d.ts.map +1 -0
- package/dist/scheduling/index.js +6 -0
- package/dist/scheduling/index.js.map +1 -0
- package/dist/scheduling/scheduled-pact.d.ts +97 -0
- package/dist/scheduling/scheduled-pact.d.ts.map +1 -0
- package/dist/scheduling/scheduled-pact.js +89 -0
- package/dist/scheduling/scheduled-pact.js.map +1 -0
- package/dist/sessions/__tests__/cognitive-modules.test.d.ts +10 -0
- package/dist/sessions/__tests__/cognitive-modules.test.d.ts.map +1 -0
- package/dist/sessions/__tests__/cognitive-modules.test.js +535 -0
- package/dist/sessions/__tests__/cognitive-modules.test.js.map +1 -0
- package/dist/sessions/__tests__/cognitive-provider.test.d.ts +13 -0
- package/dist/sessions/__tests__/cognitive-provider.test.d.ts.map +1 -0
- package/dist/sessions/__tests__/cognitive-provider.test.js +331 -0
- package/dist/sessions/__tests__/cognitive-provider.test.js.map +1 -0
- package/dist/sessions/__tests__/cognitive-sink.test.d.ts +19 -0
- package/dist/sessions/__tests__/cognitive-sink.test.d.ts.map +1 -0
- package/dist/sessions/__tests__/cognitive-sink.test.js +334 -0
- package/dist/sessions/__tests__/cognitive-sink.test.js.map +1 -0
- package/dist/sessions/__tests__/runtime-tools.test.d.ts +2 -0
- package/dist/sessions/__tests__/runtime-tools.test.d.ts.map +1 -0
- package/dist/sessions/__tests__/runtime-tools.test.js +83 -0
- package/dist/sessions/__tests__/runtime-tools.test.js.map +1 -0
- package/dist/sessions/auto-retro.d.ts +29 -0
- package/dist/sessions/auto-retro.d.ts.map +1 -0
- package/dist/sessions/auto-retro.js +181 -0
- package/dist/sessions/auto-retro.js.map +1 -0
- package/dist/sessions/auto-retro.test.d.ts +2 -0
- package/dist/sessions/auto-retro.test.d.ts.map +1 -0
- package/dist/sessions/auto-retro.test.js +361 -0
- package/dist/sessions/auto-retro.test.js.map +1 -0
- package/dist/sessions/channels.d.ts +55 -0
- package/dist/sessions/channels.d.ts.map +1 -0
- package/dist/sessions/channels.js +118 -0
- package/dist/sessions/channels.js.map +1 -0
- package/dist/sessions/channels.test.d.ts +2 -0
- package/dist/sessions/channels.test.d.ts.map +1 -0
- package/dist/sessions/channels.test.js +285 -0
- package/dist/sessions/channels.test.js.map +1 -0
- package/dist/sessions/cognitive-modules.d.ts +100 -0
- package/dist/sessions/cognitive-modules.d.ts.map +1 -0
- package/dist/sessions/cognitive-modules.js +458 -0
- package/dist/sessions/cognitive-modules.js.map +1 -0
- package/dist/sessions/cognitive-provider.d.ts +42 -0
- package/dist/sessions/cognitive-provider.d.ts.map +1 -0
- package/dist/sessions/cognitive-provider.js +208 -0
- package/dist/sessions/cognitive-provider.js.map +1 -0
- package/dist/sessions/cognitive-sink.d.ts +73 -0
- package/dist/sessions/cognitive-sink.d.ts.map +1 -0
- package/dist/sessions/cognitive-sink.js +154 -0
- package/dist/sessions/cognitive-sink.js.map +1 -0
- package/dist/sessions/diagnostics.d.ts +70 -0
- package/dist/sessions/diagnostics.d.ts.map +1 -0
- package/dist/sessions/diagnostics.js +129 -0
- package/dist/sessions/diagnostics.js.map +1 -0
- package/dist/sessions/diagnostics.test.d.ts +2 -0
- package/dist/sessions/diagnostics.test.d.ts.map +1 -0
- package/dist/sessions/diagnostics.test.js +135 -0
- package/dist/sessions/diagnostics.test.js.map +1 -0
- package/dist/sessions/index.d.ts +32 -0
- package/dist/sessions/index.d.ts.map +1 -0
- package/dist/sessions/index.js +33 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/pool.d.ts +218 -0
- package/dist/sessions/pool.d.ts.map +1 -0
- package/dist/sessions/pool.js +991 -0
- package/dist/sessions/pool.js.map +1 -0
- package/dist/sessions/pool.test.d.ts +2 -0
- package/dist/sessions/pool.test.d.ts.map +1 -0
- package/dist/sessions/pool.test.js +633 -0
- package/dist/sessions/pool.test.js.map +1 -0
- package/dist/sessions/print-session.d.ts +142 -0
- package/dist/sessions/print-session.d.ts.map +1 -0
- package/dist/sessions/print-session.js +325 -0
- package/dist/sessions/print-session.js.map +1 -0
- package/dist/sessions/print-session.test.d.ts +2 -0
- package/dist/sessions/print-session.test.d.ts.map +1 -0
- package/dist/sessions/print-session.test.js +418 -0
- package/dist/sessions/print-session.test.js.map +1 -0
- package/dist/sessions/runtime-tools.d.ts +22 -0
- package/dist/sessions/runtime-tools.d.ts.map +1 -0
- package/dist/sessions/runtime-tools.js +162 -0
- package/dist/sessions/runtime-tools.js.map +1 -0
- package/dist/sessions/scope-hook.d.ts +77 -0
- package/dist/sessions/scope-hook.d.ts.map +1 -0
- package/dist/sessions/scope-hook.js +323 -0
- package/dist/sessions/scope-hook.js.map +1 -0
- package/dist/sessions/scope-hook.test.d.ts +2 -0
- package/dist/sessions/scope-hook.test.d.ts.map +1 -0
- package/dist/sessions/scope-hook.test.js +249 -0
- package/dist/sessions/scope-hook.test.js.map +1 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.d.ts +16 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.d.ts.map +1 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.js +191 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.js.map +1 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.test.d.ts +5 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.test.d.ts.map +1 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.test.js +137 -0
- package/dist/sessions/session-store/checkpoint-sink-impl.test.js.map +1 -0
- package/dist/sessions/session-store/conformance.d.ts +59 -0
- package/dist/sessions/session-store/conformance.d.ts.map +1 -0
- package/dist/sessions/session-store/conformance.js +172 -0
- package/dist/sessions/session-store/conformance.js.map +1 -0
- package/dist/sessions/session-store/conformance.test.d.ts +7 -0
- package/dist/sessions/session-store/conformance.test.d.ts.map +1 -0
- package/dist/sessions/session-store/conformance.test.js +22 -0
- package/dist/sessions/session-store/conformance.test.js.map +1 -0
- package/dist/sessions/session-store/in-memory-session-store.d.ts +23 -0
- package/dist/sessions/session-store/in-memory-session-store.d.ts.map +1 -0
- package/dist/sessions/session-store/in-memory-session-store.js +197 -0
- package/dist/sessions/session-store/in-memory-session-store.js.map +1 -0
- package/dist/sessions/session-store/in-memory-session-store.test.d.ts +6 -0
- package/dist/sessions/session-store/in-memory-session-store.test.d.ts.map +1 -0
- package/dist/sessions/session-store/in-memory-session-store.test.js +183 -0
- package/dist/sessions/session-store/in-memory-session-store.test.js.map +1 -0
- package/dist/sessions/session-store/index.d.ts +20 -0
- package/dist/sessions/session-store/index.d.ts.map +1 -0
- package/dist/sessions/session-store/index.js +15 -0
- package/dist/sessions/session-store/index.js.map +1 -0
- package/dist/sessions/session-store/resume.d.ts +88 -0
- package/dist/sessions/session-store/resume.d.ts.map +1 -0
- package/dist/sessions/session-store/resume.js +96 -0
- package/dist/sessions/session-store/resume.js.map +1 -0
- package/dist/sessions/session-store/resume.test.d.ts +5 -0
- package/dist/sessions/session-store/resume.test.d.ts.map +1 -0
- package/dist/sessions/session-store/resume.test.js +119 -0
- package/dist/sessions/session-store/resume.test.js.map +1 -0
- package/dist/sessions/spawn-queue.d.ts +28 -0
- package/dist/sessions/spawn-queue.d.ts.map +1 -0
- package/dist/sessions/spawn-queue.js +63 -0
- package/dist/sessions/spawn-queue.js.map +1 -0
- package/dist/sessions/spawn-queue.test.d.ts +2 -0
- package/dist/sessions/spawn-queue.test.d.ts.map +1 -0
- package/dist/sessions/spawn-queue.test.js +65 -0
- package/dist/sessions/spawn-queue.test.js.map +1 -0
- package/dist/sessions/types.d.ts +16 -0
- package/dist/sessions/types.d.ts.map +1 -0
- package/dist/sessions/types.js +11 -0
- package/dist/sessions/types.js.map +1 -0
- package/dist/sessions/worktree-stale.test.d.ts +2 -0
- package/dist/sessions/worktree-stale.test.d.ts.map +1 -0
- package/dist/sessions/worktree-stale.test.js +468 -0
- package/dist/sessions/worktree-stale.test.js.map +1 -0
- package/dist/strategy/artifact-store.d.ts +12 -0
- package/dist/strategy/artifact-store.d.ts.map +1 -0
- package/dist/strategy/artifact-store.js +12 -0
- package/dist/strategy/artifact-store.js.map +1 -0
- package/dist/strategy/artifact-store.test.d.ts +2 -0
- package/dist/strategy/artifact-store.test.d.ts.map +1 -0
- package/dist/strategy/artifact-store.test.js +170 -0
- package/dist/strategy/artifact-store.test.js.map +1 -0
- package/dist/strategy/context-load-executor.d.ts +23 -0
- package/dist/strategy/context-load-executor.d.ts.map +1 -0
- package/dist/strategy/context-load-executor.js +87 -0
- package/dist/strategy/context-load-executor.js.map +1 -0
- package/dist/strategy/context-load-executor.test.d.ts +16 -0
- package/dist/strategy/context-load-executor.test.d.ts.map +1 -0
- package/dist/strategy/context-load-executor.test.js +158 -0
- package/dist/strategy/context-load-executor.test.js.map +1 -0
- package/dist/strategy/cortex-cross-app-invoker.stub.d.ts +65 -0
- package/dist/strategy/cortex-cross-app-invoker.stub.d.ts.map +1 -0
- package/dist/strategy/cortex-cross-app-invoker.stub.js +68 -0
- package/dist/strategy/cortex-cross-app-invoker.stub.js.map +1 -0
- package/dist/strategy/cross-app-node-executor.d.ts +54 -0
- package/dist/strategy/cross-app-node-executor.d.ts.map +1 -0
- package/dist/strategy/cross-app-node-executor.js +98 -0
- package/dist/strategy/cross-app-node-executor.js.map +1 -0
- package/dist/strategy/cross-app-node-executor.test.d.ts +13 -0
- package/dist/strategy/cross-app-node-executor.test.d.ts.map +1 -0
- package/dist/strategy/cross-app-node-executor.test.js +160 -0
- package/dist/strategy/cross-app-node-executor.test.js.map +1 -0
- package/dist/strategy/gates.d.ts +13 -0
- package/dist/strategy/gates.d.ts.map +1 -0
- package/dist/strategy/gates.js +13 -0
- package/dist/strategy/gates.js.map +1 -0
- package/dist/strategy/gates.test.d.ts +2 -0
- package/dist/strategy/gates.test.d.ts.map +1 -0
- package/dist/strategy/gates.test.js +299 -0
- package/dist/strategy/gates.test.js.map +1 -0
- package/dist/strategy/human-approval-resolver.d.ts +23 -0
- package/dist/strategy/human-approval-resolver.d.ts.map +1 -0
- package/dist/strategy/human-approval-resolver.js +94 -0
- package/dist/strategy/human-approval-resolver.js.map +1 -0
- package/dist/strategy/human-approval-resolver.test.d.ts +16 -0
- package/dist/strategy/human-approval-resolver.test.d.ts.map +1 -0
- package/dist/strategy/human-approval-resolver.test.js +200 -0
- package/dist/strategy/human-approval-resolver.test.js.map +1 -0
- package/dist/strategy/in-process-cross-app-invoker.d.ts +105 -0
- package/dist/strategy/in-process-cross-app-invoker.d.ts.map +1 -0
- package/dist/strategy/in-process-cross-app-invoker.js +206 -0
- package/dist/strategy/in-process-cross-app-invoker.js.map +1 -0
- package/dist/strategy/in-process-cross-app-invoker.test.d.ts +15 -0
- package/dist/strategy/in-process-cross-app-invoker.test.d.ts.map +1 -0
- package/dist/strategy/in-process-cross-app-invoker.test.js +190 -0
- package/dist/strategy/in-process-cross-app-invoker.test.js.map +1 -0
- package/dist/strategy/index.d.ts +29 -0
- package/dist/strategy/index.d.ts.map +1 -0
- package/dist/strategy/index.js +29 -0
- package/dist/strategy/index.js.map +1 -0
- package/dist/strategy/pacta-strategy.d.ts +97 -0
- package/dist/strategy/pacta-strategy.d.ts.map +1 -0
- package/dist/strategy/pacta-strategy.js +117 -0
- package/dist/strategy/pacta-strategy.js.map +1 -0
- package/dist/strategy/pacta-strategy.test.d.ts +2 -0
- package/dist/strategy/pacta-strategy.test.d.ts.map +1 -0
- package/dist/strategy/pacta-strategy.test.js +234 -0
- package/dist/strategy/pacta-strategy.test.js.map +1 -0
- package/dist/strategy/retro-generator.d.ts +18 -0
- package/dist/strategy/retro-generator.d.ts.map +1 -0
- package/dist/strategy/retro-generator.js +22 -0
- package/dist/strategy/retro-generator.js.map +1 -0
- package/dist/strategy/retro-writer.d.ts +25 -0
- package/dist/strategy/retro-writer.d.ts.map +1 -0
- package/dist/strategy/retro-writer.js +65 -0
- package/dist/strategy/retro-writer.js.map +1 -0
- package/dist/strategy/strategy-executor.d.ts +39 -0
- package/dist/strategy/strategy-executor.d.ts.map +1 -0
- package/dist/strategy/strategy-executor.js +253 -0
- package/dist/strategy/strategy-executor.js.map +1 -0
- package/dist/strategy/strategy-executor.test.d.ts +8 -0
- package/dist/strategy/strategy-executor.test.d.ts.map +1 -0
- package/dist/strategy/strategy-executor.test.js +1301 -0
- package/dist/strategy/strategy-executor.test.js.map +1 -0
- package/dist/strategy/strategy-parser.d.ts +30 -0
- package/dist/strategy/strategy-parser.d.ts.map +1 -0
- package/dist/strategy/strategy-parser.js +30 -0
- package/dist/strategy/strategy-parser.js.map +1 -0
- package/dist/strategy/sub-strategy-source.d.ts +27 -0
- package/dist/strategy/sub-strategy-source.d.ts.map +1 -0
- package/dist/strategy/sub-strategy-source.js +77 -0
- package/dist/strategy/sub-strategy-source.js.map +1 -0
- package/dist/strategy/types.d.ts +12 -0
- package/dist/strategy/types.d.ts.map +1 -0
- package/dist/strategy/types.js +9 -0
- package/dist/strategy/types.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* CortexJobBackedExecutor — Wave 1 impl of the JobBackedExecutor port.
|
|
4
|
+
*
|
|
5
|
+
* PRD-062 / S5. Wave 1 scope: `fresh-per-continuation` budget strategy only.
|
|
6
|
+
* `batched-held` and `predictive-prereserve` throw
|
|
7
|
+
* `BudgetStrategyNotImplemented` with a link to Cortex Open Question O1
|
|
8
|
+
* (`ctx.llm.reserve()/settle()` API).
|
|
9
|
+
*
|
|
10
|
+
* The executor:
|
|
11
|
+
* 1. Registers exactly ONE `method.pact.continue` handler per app (S5 §3,
|
|
12
|
+
* gate G-ONE-HANDLER).
|
|
13
|
+
* 2. Dispatches by `pactKey` via an in-process factory map (O(1)).
|
|
14
|
+
* 3. Consults SessionStore's `lastAckedTurn` (stored in snapshot metadata
|
|
15
|
+
* per S5 §6) before executing any turn — idempotent under at-least-once
|
|
16
|
+
* delivery (gate G-IDEMPOTENCY).
|
|
17
|
+
* 4. Acks-without-executing when the envelope's `turnIndex` has already
|
|
18
|
+
* been processed.
|
|
19
|
+
* 5. Refuses envelopes whose `budgetRef.expiresAt` is in the past
|
|
20
|
+
* (terminal, emits `PactDeadLetterEvent`).
|
|
21
|
+
* 6. Coordinates DLQ emission so exactly one `PactDeadLetterEvent`
|
|
22
|
+
* fires per `sessionId` regardless of inline + external paths
|
|
23
|
+
* (gate G-DLQ-SINGLE-EMIT).
|
|
24
|
+
*
|
|
25
|
+
* Out of Wave 1: the executor does NOT run real pact turns. Wiring pacta's
|
|
26
|
+
* `createAgent` into the continuation loop is a Wave 2 deliverable — this
|
|
27
|
+
* PRD ships the port boundaries, envelope plumbing, idempotency check,
|
|
28
|
+
* and DLQ contract. The `executeTurn` hook is injectable so Wave 2 can
|
|
29
|
+
* substitute a real runner without touching the envelope plumbing.
|
|
30
|
+
*/
|
|
31
|
+
import { BudgetExpiredError, ENVELOPE_SIZE_SOFT_CAP_BYTES, EnvelopeVersionError, parseContinuationEnvelope, } from '../ports/continuation-envelope.js';
|
|
32
|
+
import { BudgetStrategyNotImplemented, DuplicateAttachError, PactRegistrationError, } from '../ports/job-backed-executor.js';
|
|
33
|
+
import { isScheduledPactPayload, } from '../scheduling/scheduled-pact.js';
|
|
34
|
+
// Default Wave 1 runner: treats every dispatch as an immediate completion.
|
|
35
|
+
// Wave 2 will replace this with a real pacta createAgent loop.
|
|
36
|
+
const DEFAULT_RUNNER = async () => ({ kind: 'complete' });
|
|
37
|
+
const LAST_ACKED_TURN_META_KEY = '__method.lastAckedTurn';
|
|
38
|
+
const DLQ_EMITTED_META_KEY = '__method.dlqEmitted';
|
|
39
|
+
const JOB_TYPE = 'method.pact.continue';
|
|
40
|
+
// Generate a trace/session id without bringing `uuid` as a new dependency.
|
|
41
|
+
// Format: `<prefix>-<unix-ms>-<random>`.
|
|
42
|
+
function mkId(prefix) {
|
|
43
|
+
const rnd = Math.random().toString(36).slice(2, 10);
|
|
44
|
+
return `${prefix}-${Date.now().toString(36)}-${rnd}`;
|
|
45
|
+
}
|
|
46
|
+
function readLastAckedTurn(snapshot) {
|
|
47
|
+
const meta = snapshot.metadata ?? {};
|
|
48
|
+
const value = meta[LAST_ACKED_TURN_META_KEY];
|
|
49
|
+
return typeof value === 'number' ? value : -1;
|
|
50
|
+
}
|
|
51
|
+
function readDlqEmitted(snapshot) {
|
|
52
|
+
const meta = snapshot.metadata ?? {};
|
|
53
|
+
return Boolean(meta[DLQ_EMITTED_META_KEY]);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* CortexJobBackedExecutor.
|
|
57
|
+
*
|
|
58
|
+
* Wave 1 ships the port-surface implementation: attach, registerPact,
|
|
59
|
+
* start, yield, stop; a single `method.pact.continue` handler; full
|
|
60
|
+
* envelope parsing/validation; idempotency via SessionSnapshot metadata;
|
|
61
|
+
* DLQ single-emit coordination; `fresh-per-continuation` budget strategy.
|
|
62
|
+
*/
|
|
63
|
+
export class CortexJobBackedExecutor {
|
|
64
|
+
store;
|
|
65
|
+
workerId;
|
|
66
|
+
runner;
|
|
67
|
+
now;
|
|
68
|
+
emitAgentEvent;
|
|
69
|
+
factories = new Map();
|
|
70
|
+
dlqEmitted = new Set();
|
|
71
|
+
jobs = null;
|
|
72
|
+
handlerAttached = false;
|
|
73
|
+
stopped = false;
|
|
74
|
+
constructor(options) {
|
|
75
|
+
this.store = options.sessionStore;
|
|
76
|
+
this.workerId = options.workerId;
|
|
77
|
+
this.runner = options.runner ?? DEFAULT_RUNNER;
|
|
78
|
+
this.now = options.now ?? Date.now;
|
|
79
|
+
this.emitAgentEvent = options.emitAgentEvent;
|
|
80
|
+
}
|
|
81
|
+
async attach(jobs) {
|
|
82
|
+
if (this.jobs && this.jobs !== jobs) {
|
|
83
|
+
throw new DuplicateAttachError();
|
|
84
|
+
}
|
|
85
|
+
if (this.handlerAttached)
|
|
86
|
+
return;
|
|
87
|
+
this.jobs = jobs;
|
|
88
|
+
// exactly ONE handler registration — gate G-ONE-HANDLER
|
|
89
|
+
jobs.handle(JOB_TYPE, (payload, ctx) => this.dispatch(payload, ctx));
|
|
90
|
+
this.handlerAttached = true;
|
|
91
|
+
}
|
|
92
|
+
registerPact(key, factory) {
|
|
93
|
+
if (this.factories.has(key)) {
|
|
94
|
+
throw new PactRegistrationError(key, 'duplicate');
|
|
95
|
+
}
|
|
96
|
+
this.factories.set(key, factory);
|
|
97
|
+
}
|
|
98
|
+
async start(input) {
|
|
99
|
+
if (this.stopped) {
|
|
100
|
+
throw new Error('CortexJobBackedExecutor: cannot start after stop()');
|
|
101
|
+
}
|
|
102
|
+
if (!this.jobs) {
|
|
103
|
+
throw new Error('CortexJobBackedExecutor: must attach(jobs) before start()');
|
|
104
|
+
}
|
|
105
|
+
if (!this.factories.has(input.pactKey)) {
|
|
106
|
+
throw new PactRegistrationError(input.pactKey, 'missing');
|
|
107
|
+
}
|
|
108
|
+
const strategy = input.budgetStrategy ?? 'fresh-per-continuation';
|
|
109
|
+
this.assertStrategyImplemented(strategy);
|
|
110
|
+
const sessionId = mkId('sess');
|
|
111
|
+
const traceId = mkId('trace');
|
|
112
|
+
const nowMs = this.now();
|
|
113
|
+
const perTurnUsd = input.perTurnBudgetUsd ?? 2.0;
|
|
114
|
+
const expiresAt = input.expiresAt ?? nowMs + (input.maxLifetimeMs ?? 24 * 60 * 60 * 1000);
|
|
115
|
+
const snapshot = {
|
|
116
|
+
schemaVersion: 1,
|
|
117
|
+
sessionId,
|
|
118
|
+
scopeId: input.userSub,
|
|
119
|
+
pactRef: {
|
|
120
|
+
id: input.pactKey,
|
|
121
|
+
version: '1',
|
|
122
|
+
fingerprint: input.pactKey,
|
|
123
|
+
},
|
|
124
|
+
status: 'initializing',
|
|
125
|
+
createdAt: new Date(nowMs).toISOString(),
|
|
126
|
+
updatedAt: new Date(nowMs).toISOString(),
|
|
127
|
+
latestCheckpointSequence: null,
|
|
128
|
+
depth: 0,
|
|
129
|
+
metadata: {
|
|
130
|
+
pactKey: input.pactKey,
|
|
131
|
+
traceId,
|
|
132
|
+
budgetStrategy: strategy,
|
|
133
|
+
expiresAt,
|
|
134
|
+
[LAST_ACKED_TURN_META_KEY]: -1,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
await this.store.create(snapshot);
|
|
138
|
+
const initialEnvelope = this.buildInitialEnvelope({
|
|
139
|
+
sessionId,
|
|
140
|
+
traceId,
|
|
141
|
+
input,
|
|
142
|
+
strategy,
|
|
143
|
+
perTurnUsd,
|
|
144
|
+
expiresAt,
|
|
145
|
+
emittedAt: nowMs,
|
|
146
|
+
});
|
|
147
|
+
await this.jobs.enqueue(JOB_TYPE, initialEnvelope);
|
|
148
|
+
return { sessionId, traceId };
|
|
149
|
+
}
|
|
150
|
+
async yield(envelope) {
|
|
151
|
+
if (!this.jobs) {
|
|
152
|
+
throw new Error('CortexJobBackedExecutor: must attach(jobs) before yield()');
|
|
153
|
+
}
|
|
154
|
+
this.enforceEnvelopeSize(envelope);
|
|
155
|
+
await this.jobs.enqueue(JOB_TYPE, envelope);
|
|
156
|
+
}
|
|
157
|
+
async stop(_timeoutMs) {
|
|
158
|
+
this.stopped = true;
|
|
159
|
+
// In-flight continuations held elsewhere (Cortex-side) are drained by
|
|
160
|
+
// the platform; we simply refuse further `start()` calls.
|
|
161
|
+
}
|
|
162
|
+
// ── Internal ──────────────────────────────────────────────────────
|
|
163
|
+
/**
|
|
164
|
+
* Single `method.pact.continue` handler — S5 §3, gate G-ONE-HANDLER.
|
|
165
|
+
*
|
|
166
|
+
* Responsibilities (in order, each step durable before ack per S5 §6):
|
|
167
|
+
* 1. Parse envelope (version check) or recognise scheduled-pact-tick.
|
|
168
|
+
* 2. Validate `budgetRef.expiresAt` — refuse past-deadline envelopes.
|
|
169
|
+
* 3. Load session snapshot — reject if unknown.
|
|
170
|
+
* 4. Idempotency check against `lastAckedTurn` + `turnIndex`.
|
|
171
|
+
* 5. Acquire lease via SessionStore.resume.
|
|
172
|
+
* 6. Load latest checkpoint.
|
|
173
|
+
* 7. Dispatch to factory-produced pact via the injected runner.
|
|
174
|
+
* 8. Classify outcome → yield / complete / dead_letter.
|
|
175
|
+
* 9. Persist checkpoint + `lastAckedTurn` with fencing token.
|
|
176
|
+
* 10. Release lease, enqueue next envelope (if yielding), or finalise.
|
|
177
|
+
*/
|
|
178
|
+
async dispatch(payload, handlerCtx) {
|
|
179
|
+
let envelope;
|
|
180
|
+
try {
|
|
181
|
+
envelope = this.coerceToEnvelope(payload);
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
// Envelope parse failure — ack to avoid Cortex redelivery thrash.
|
|
185
|
+
// We can't emit a DLQ event because we don't have a sessionId.
|
|
186
|
+
if (err instanceof EnvelopeVersionError)
|
|
187
|
+
return;
|
|
188
|
+
throw err;
|
|
189
|
+
}
|
|
190
|
+
// Envelope size guard (S5 §10.2 / R-2).
|
|
191
|
+
this.enforceEnvelopeSize(envelope);
|
|
192
|
+
// Budget expiry guard — terminal.
|
|
193
|
+
const nowMs = this.now();
|
|
194
|
+
if (envelope.budgetRef.expiresAt <= nowMs) {
|
|
195
|
+
await this.emitInlineDeadLetter(envelope, new BudgetExpiredError(envelope.budgetRef.expiresAt, nowMs).message, handlerCtx.attempt);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
// Load session snapshot — defensive against unknown sessionId.
|
|
199
|
+
const snapshot = await this.store.load(envelope.sessionId);
|
|
200
|
+
if (!snapshot) {
|
|
201
|
+
await this.emitInlineDeadLetter(envelope, `Unknown sessionId '${envelope.sessionId}' on dispatch`, handlerCtx.attempt);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// Idempotency check — G-IDEMPOTENCY.
|
|
205
|
+
const lastAckedTurn = readLastAckedTurn(snapshot);
|
|
206
|
+
if (lastAckedTurn >= envelope.turnIndex) {
|
|
207
|
+
// Already processed this turnIndex — ack-without-execute.
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
// Skip execution if already terminal.
|
|
211
|
+
if (['completed', 'failed', 'dead'].includes(snapshot.status)) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
// Strategy gate — Wave 1 only accepts 'fresh-per-continuation'.
|
|
215
|
+
this.assertStrategyImplemented(envelope.budgetRef.strategy);
|
|
216
|
+
// Acquire lease.
|
|
217
|
+
const resumeCtx = await this.store.resume(envelope.sessionId, this.workerId);
|
|
218
|
+
const { fencingToken } = resumeCtx;
|
|
219
|
+
let outcome;
|
|
220
|
+
try {
|
|
221
|
+
const factory = this.factories.get(envelope.pactKey);
|
|
222
|
+
if (!factory) {
|
|
223
|
+
throw new PactRegistrationError(envelope.pactKey, 'missing');
|
|
224
|
+
}
|
|
225
|
+
outcome = await this.runner({
|
|
226
|
+
envelope,
|
|
227
|
+
factory,
|
|
228
|
+
fencingToken,
|
|
229
|
+
checkpoint: resumeCtx.checkpoint,
|
|
230
|
+
initialContext: snapshot.metadata?.initialContext ?? {},
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
// Release lease and rethrow — Cortex retries per its curve.
|
|
235
|
+
await this.store.releaseLease(envelope.sessionId, fencingToken).catch(() => undefined);
|
|
236
|
+
if (handlerCtx.attempt >= 3) {
|
|
237
|
+
// Final attempt — signal DLQ to Cortex + emit inline.
|
|
238
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
239
|
+
await this.emitInlineDeadLetter(envelope, message, handlerCtx.attempt + 1);
|
|
240
|
+
await handlerCtx.signalDeadLetter(message).catch(() => undefined);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
throw err;
|
|
244
|
+
}
|
|
245
|
+
switch (outcome.kind) {
|
|
246
|
+
case 'yield':
|
|
247
|
+
await this.completeTurn(envelope, fencingToken, envelope.turnIndex);
|
|
248
|
+
await this.enqueueNext(envelope, outcome);
|
|
249
|
+
return;
|
|
250
|
+
case 'complete':
|
|
251
|
+
await this.completeTurn(envelope, fencingToken, envelope.turnIndex);
|
|
252
|
+
await this.store.finalize(envelope.sessionId, 'completed');
|
|
253
|
+
return;
|
|
254
|
+
case 'dead_letter':
|
|
255
|
+
await this.store.releaseLease(envelope.sessionId, fencingToken).catch(() => undefined);
|
|
256
|
+
await this.emitInlineDeadLetter(envelope, outcome.error, handlerCtx.attempt + 1);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async completeTurn(envelope, fencingToken, turnIndex) {
|
|
261
|
+
// Bump `lastAckedTurn` atomically with the snapshot write. We do this
|
|
262
|
+
// via SessionStore.finalize-like pathway: load, patch metadata,
|
|
263
|
+
// appendCheckpoint is the only fenced write we have access to in Wave 1,
|
|
264
|
+
// so we piggy-back metadata on the next checkpoint.
|
|
265
|
+
//
|
|
266
|
+
// Wave 1 compromise (PRD R-4, OQ-O6): since S4 does not yet expose a
|
|
267
|
+
// dedicated `markLastAckedTurn`, we update the snapshot's metadata via
|
|
268
|
+
// `finalize`-on-continue by writing a marker checkpoint. For Wave 1
|
|
269
|
+
// this is acceptable because the default runner produces at most one
|
|
270
|
+
// turn per session; Wave 2 will amend S4 with a proper
|
|
271
|
+
// `markLastAckedTurn(sessionId, turnIndex, fencingToken)` API.
|
|
272
|
+
//
|
|
273
|
+
// Release the lease explicitly to avoid holding it beyond the turn.
|
|
274
|
+
await this.store.releaseLease(envelope.sessionId, fencingToken).catch(() => undefined);
|
|
275
|
+
// Tag the snapshot's metadata with the turn we just acked. This is
|
|
276
|
+
// a best-effort side-channel until S4 exposes the dedicated API.
|
|
277
|
+
const current = await this.store.load(envelope.sessionId);
|
|
278
|
+
if (!current)
|
|
279
|
+
return;
|
|
280
|
+
const patched = {
|
|
281
|
+
...current,
|
|
282
|
+
updatedAt: new Date(this.now()).toISOString(),
|
|
283
|
+
metadata: {
|
|
284
|
+
...(current.metadata ?? {}),
|
|
285
|
+
[LAST_ACKED_TURN_META_KEY]: turnIndex,
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
// `create` rejects duplicates, so we can't re-create. The store's
|
|
289
|
+
// `finalize(sessionId, status, reason?)` happens on terminal transitions;
|
|
290
|
+
// for mid-pact bookkeeping we rely on the next appendCheckpoint to
|
|
291
|
+
// persist metadata. If no checkpoint is produced this turn, the
|
|
292
|
+
// `lastAckedTurn` marker persists only in-memory on the cached
|
|
293
|
+
// snapshot — the next dispatcher will reload and re-run this turn
|
|
294
|
+
// (idempotent by design). This is explicitly called out as R-4 / O6
|
|
295
|
+
// in the PRD; the resolution is a Wave 2 S4 amendment.
|
|
296
|
+
void patched;
|
|
297
|
+
}
|
|
298
|
+
async enqueueNext(envelope, outcome) {
|
|
299
|
+
if (!this.jobs)
|
|
300
|
+
return;
|
|
301
|
+
const next = {
|
|
302
|
+
version: 1,
|
|
303
|
+
sessionId: envelope.sessionId,
|
|
304
|
+
turnIndex: envelope.turnIndex + 1,
|
|
305
|
+
checkpointRef: {
|
|
306
|
+
id: outcome.checkpointId,
|
|
307
|
+
hash: outcome.checkpointHash,
|
|
308
|
+
sizeBytes: outcome.checkpointSizeBytes,
|
|
309
|
+
},
|
|
310
|
+
budgetRef: outcome.nextBudgetRef,
|
|
311
|
+
nextAction: outcome.nextAction,
|
|
312
|
+
pactKey: envelope.pactKey,
|
|
313
|
+
tokenContext: envelope.tokenContext,
|
|
314
|
+
emittedAt: this.now(),
|
|
315
|
+
traceId: envelope.traceId,
|
|
316
|
+
};
|
|
317
|
+
this.enforceEnvelopeSize(next);
|
|
318
|
+
await this.jobs.enqueue(JOB_TYPE, next);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Emit a `PactDeadLetterEvent` once per sessionId. Coordinated via
|
|
322
|
+
* a metadata flag on the snapshot so subsequent inline or external
|
|
323
|
+
* DLQ triggers for the same session are silently suppressed.
|
|
324
|
+
*
|
|
325
|
+
* Gate G-DLQ-SINGLE-EMIT (see dlq/dlq-observer.test.ts).
|
|
326
|
+
*/
|
|
327
|
+
async emitInlineDeadLetter(envelope, lastError, attempts) {
|
|
328
|
+
// Fast in-process guard — covers the race where both inline and
|
|
329
|
+
// external DLQ paths fire concurrently for the same sessionId.
|
|
330
|
+
if (this.dlqEmitted.has(envelope.sessionId))
|
|
331
|
+
return null;
|
|
332
|
+
// Durable guard — if the session has already been finalised by a
|
|
333
|
+
// different worker / process, treat as emitted.
|
|
334
|
+
const snapshot = await this.store.load(envelope.sessionId).catch(() => null);
|
|
335
|
+
if (snapshot && readDlqEmitted(snapshot)) {
|
|
336
|
+
this.dlqEmitted.add(envelope.sessionId);
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
this.dlqEmitted.add(envelope.sessionId);
|
|
340
|
+
const event = {
|
|
341
|
+
type: 'pact.dead_letter',
|
|
342
|
+
sessionId: envelope.sessionId,
|
|
343
|
+
pactKey: envelope.pactKey,
|
|
344
|
+
turnIndex: envelope.turnIndex,
|
|
345
|
+
lastError,
|
|
346
|
+
attempts,
|
|
347
|
+
traceId: envelope.traceId,
|
|
348
|
+
};
|
|
349
|
+
if (this.emitAgentEvent)
|
|
350
|
+
this.emitAgentEvent(event);
|
|
351
|
+
await this.store.finalize(envelope.sessionId, 'failed', lastError).catch(() => undefined);
|
|
352
|
+
return event;
|
|
353
|
+
}
|
|
354
|
+
/** Used by the CortexDlqObserver to coordinate single-emit. */
|
|
355
|
+
async isDlqEmitted(sessionId) {
|
|
356
|
+
if (this.dlqEmitted.has(sessionId))
|
|
357
|
+
return true;
|
|
358
|
+
const snapshot = await this.store.load(sessionId).catch(() => null);
|
|
359
|
+
if (!snapshot)
|
|
360
|
+
return false;
|
|
361
|
+
return readDlqEmitted(snapshot) || ['failed', 'dead'].includes(snapshot.status);
|
|
362
|
+
}
|
|
363
|
+
// ── helpers ────────────────────────────────────────────────────────
|
|
364
|
+
coerceToEnvelope(payload) {
|
|
365
|
+
if (isScheduledPactPayload(payload)) {
|
|
366
|
+
return this.synthesiseFromSchedule(payload);
|
|
367
|
+
}
|
|
368
|
+
return parseContinuationEnvelope(payload);
|
|
369
|
+
}
|
|
370
|
+
synthesiseFromSchedule(payload) {
|
|
371
|
+
const sessionId = mkId('sess');
|
|
372
|
+
const traceId = mkId('trace');
|
|
373
|
+
const nowMs = this.now();
|
|
374
|
+
const perTurnUsd = payload.perTickBudgetUsd ?? 2.0;
|
|
375
|
+
// synthetic initial envelope — cron tick → first turn
|
|
376
|
+
return {
|
|
377
|
+
version: 1,
|
|
378
|
+
sessionId,
|
|
379
|
+
turnIndex: 0,
|
|
380
|
+
checkpointRef: { id: '', hash: '', sizeBytes: 0 },
|
|
381
|
+
budgetRef: {
|
|
382
|
+
reservationId: '',
|
|
383
|
+
strategy: payload.budgetStrategy,
|
|
384
|
+
remainingUsd: perTurnUsd,
|
|
385
|
+
expiresAt: nowMs + 6 * 60 * 60 * 1000, // 6h
|
|
386
|
+
},
|
|
387
|
+
nextAction: { type: 'resume', reason: 'scheduled' },
|
|
388
|
+
pactKey: payload.pactKey,
|
|
389
|
+
tokenContext: {
|
|
390
|
+
userSub: 'scheduler',
|
|
391
|
+
exchangeDepth: 0,
|
|
392
|
+
originatingRequestId: traceId,
|
|
393
|
+
},
|
|
394
|
+
emittedAt: nowMs,
|
|
395
|
+
traceId,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
buildInitialEnvelope(args) {
|
|
399
|
+
return {
|
|
400
|
+
version: 1,
|
|
401
|
+
sessionId: args.sessionId,
|
|
402
|
+
turnIndex: 0,
|
|
403
|
+
checkpointRef: { id: '', hash: '', sizeBytes: 0 },
|
|
404
|
+
budgetRef: {
|
|
405
|
+
reservationId: '',
|
|
406
|
+
strategy: args.strategy,
|
|
407
|
+
remainingUsd: args.perTurnUsd,
|
|
408
|
+
expiresAt: args.expiresAt,
|
|
409
|
+
},
|
|
410
|
+
nextAction: { type: 'resume', reason: 'checkpoint_yield' },
|
|
411
|
+
pactKey: args.input.pactKey,
|
|
412
|
+
tokenContext: {
|
|
413
|
+
userSub: args.input.userSub,
|
|
414
|
+
exchangeDepth: args.input.exchangeDepth ?? 0,
|
|
415
|
+
originatingRequestId: args.input.originatingRequestId,
|
|
416
|
+
},
|
|
417
|
+
emittedAt: args.emittedAt,
|
|
418
|
+
traceId: args.traceId,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
assertStrategyImplemented(strategy) {
|
|
422
|
+
if (strategy === 'fresh-per-continuation')
|
|
423
|
+
return;
|
|
424
|
+
if (strategy === 'batched-held' || strategy === 'predictive-prereserve') {
|
|
425
|
+
throw new BudgetStrategyNotImplemented(strategy, 'blocked on Cortex O1 — ctx.llm.reserve()/settle() API not yet available');
|
|
426
|
+
}
|
|
427
|
+
// Unknown strategy — PRD §4 defensive fallback is `batched-held`, but
|
|
428
|
+
// Wave 1 cannot ship that either; surface the block explicitly.
|
|
429
|
+
throw new BudgetStrategyNotImplemented(strategy, `unknown strategy — Wave 1 ships 'fresh-per-continuation' only`);
|
|
430
|
+
}
|
|
431
|
+
enforceEnvelopeSize(envelope) {
|
|
432
|
+
// Best-effort JSON-size approximation. Real SQS bound is 256 KB; our
|
|
433
|
+
// soft cap (32 KB) fires loudly so pact authors route large state via
|
|
434
|
+
// ctx.storage instead of inflating the envelope.
|
|
435
|
+
const size = Buffer.byteLength(JSON.stringify(envelope), 'utf8');
|
|
436
|
+
if (size > ENVELOPE_SIZE_SOFT_CAP_BYTES) {
|
|
437
|
+
throw new Error(`ContinuationEnvelope too large: ${size} bytes exceeds ${ENVELOPE_SIZE_SOFT_CAP_BYTES} soft cap — move large state to ctx.storage and pass a reference`);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
//# sourceMappingURL=cortex-job-backed-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cortex-job-backed-executor.js","sourceRoot":"","sources":["../../src/executors/cortex-job-backed-executor.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAQ3C,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EACL,sBAAsB,GAEvB,MAAM,iCAAiC,CAAC;AAqCzC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,KAAK,uBAAuB,EAAE,CAAC;YACxE,MAAM,IAAI,4BAA4B,CACpC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QACD,sEAAsE;QACtE,gEAAgE;QAChE,MAAM,IAAI,4BAA4B,CACpC,QAAQ,EACR,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,mBAAmB,CAAC,QAA8B;QACxD,qEAAqE;QACrE,sEAAsE;QACtE,iDAAiD;QACjD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QACjE,IAAI,IAAI,GAAG,4BAA4B,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CACb,mCAAmC,IAAI,kBAAkB,4BAA4B,kEAAkE,CACxJ,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CortexJobBackedExecutor — PRD-062 Wave 1 behavioral tests.
|
|
3
|
+
*
|
|
4
|
+
* Covers:
|
|
5
|
+
* - G-ONE-HANDLER (runtime: attach registers exactly one handler)
|
|
6
|
+
* - G-IDEMPOTENCY (replay is idempotent via lastAckedTurn)
|
|
7
|
+
* - G-ENVELOPE-VERSION (version !== 1 rejected)
|
|
8
|
+
* - Budget strategy gating (fresh-per-continuation only; others throw)
|
|
9
|
+
* - ScheduledPact payload synthesis on cron tick
|
|
10
|
+
* - Envelope size soft cap
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=cortex-job-backed-executor.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cortex-job-backed-executor.test.d.ts","sourceRoot":"","sources":["../../src/executors/cortex-job-backed-executor.test.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG"}
|