@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,458 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Bridge Cognitive Modules — CognitiveModule implementations extracted from
|
|
4
|
+
* the monolithic cognitive-provider.ts inline loop.
|
|
5
|
+
*
|
|
6
|
+
* BridgeReasonerActorModule: extracts the inner while-loop (multi-tool cycle)
|
|
7
|
+
* BridgeMonitorModule: extracts the inline monitor block (anomaly, write gate, etc.)
|
|
8
|
+
*
|
|
9
|
+
* All 11 behavioral fixes from PRDs 033/040/041 remain intact inside these modules.
|
|
10
|
+
* The refactor is structural, not behavioral.
|
|
11
|
+
*
|
|
12
|
+
* PRD 042 Phase 1-3: Module Type Definitions + Factories
|
|
13
|
+
*/
|
|
14
|
+
import { moduleId } from '@methodts/pacta';
|
|
15
|
+
// ── Constants (duplicated from cognitive-provider.ts — forbidden to import) ──
|
|
16
|
+
const FORMAT_INSTRUCTION = `You MUST respond with exactly three XML sections. No other text outside these tags.
|
|
17
|
+
|
|
18
|
+
<plan>Brief 2-3 step plan.</plan>
|
|
19
|
+
<reasoning>Your analysis and rationale.</reasoning>
|
|
20
|
+
<action>{"tool":"ToolName","input":{"key":"value"}}</action>
|
|
21
|
+
|
|
22
|
+
The <action> tag MUST contain valid JSON with a "tool" field matching one of the available tools.
|
|
23
|
+
When the task is complete, use: <action>{"tool":"done","input":{"result":"your final answer here"}}</action>
|
|
24
|
+
|
|
25
|
+
CRITICAL RULE — If you see "[\\u2713 DELIVERABLE WRITTEN" anywhere in your context, the task output is already saved. Your ONLY valid next action is done. Do not read, write, or research further.
|
|
26
|
+
|
|
27
|
+
IMPORTANT — For Write operations with large or multi-line content, use a <content> block INSTEAD of putting content in the JSON. This avoids JSON escaping issues:
|
|
28
|
+
<action>{"tool":"Write","input":{"path":"output.md"}}</action>
|
|
29
|
+
<content>
|
|
30
|
+
...your multi-line content here, no escaping needed...
|
|
31
|
+
</content>
|
|
32
|
+
|
|
33
|
+
Example response:
|
|
34
|
+
<plan>1. Read the file. 2. Report the contents.</plan>
|
|
35
|
+
<reasoning>I need to read the file to answer the question.</reasoning>
|
|
36
|
+
<action>{"tool":"Read","input":{"path":"package.json"}}</action>`;
|
|
37
|
+
export const READ_ONLY_ACTIONS = new Set(['Read', 'Glob', 'Grep', 'Search', 'List']);
|
|
38
|
+
const MAX_CONSECUTIVE_FAILED_PARSES = 3;
|
|
39
|
+
// ── Helper ─────────────────────────────────────────────────────────
|
|
40
|
+
/** Returns the default monitor control (no interventions). */
|
|
41
|
+
export function defaultBridgeMonitorControl() {
|
|
42
|
+
return {
|
|
43
|
+
target: moduleId('reasoner-actor'),
|
|
44
|
+
timestamp: Date.now(),
|
|
45
|
+
forceReplan: false,
|
|
46
|
+
restricted: [],
|
|
47
|
+
interventionMessage: null,
|
|
48
|
+
writeGateFired: false,
|
|
49
|
+
prevCycleAction: null,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// ── BridgeReasonerActorModule Factory ──────────────────────────────
|
|
53
|
+
/**
|
|
54
|
+
* Creates a BridgeReasonerActorModule that extracts the inner while-loop
|
|
55
|
+
* from cognitive-provider.ts into a CognitiveModule implementation.
|
|
56
|
+
*
|
|
57
|
+
* All 11 behavioral fixes remain inside:
|
|
58
|
+
* - Write-completion hint (salience 1.0 after successful Write)
|
|
59
|
+
* - Write gate counters (promptSuccessfulReads/Writes, writeGateFired)
|
|
60
|
+
* - Impasse detection (exact-match semantic key, within-step local)
|
|
61
|
+
* - Parse failure circuit-breaker (consecutiveFailedParses >= 3)
|
|
62
|
+
* - Content block handling (<content> tag for Write)
|
|
63
|
+
* - Truncation hint (Read result truncation message)
|
|
64
|
+
*/
|
|
65
|
+
export function createBridgeReasonerActorModule(adapter, tools, ws, raWritePort, raReadPort, obsPort, config, onEvent, cognitiveSink, onChunk) {
|
|
66
|
+
const raModuleId = moduleId('reasoner-actor');
|
|
67
|
+
return {
|
|
68
|
+
id: raModuleId,
|
|
69
|
+
initialState() {
|
|
70
|
+
return {
|
|
71
|
+
foldedCtx: [],
|
|
72
|
+
promptSuccessfulReads: 0,
|
|
73
|
+
promptSuccessfulWrites: 0,
|
|
74
|
+
writeGateFired: false,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
async step(prompt, state, control) {
|
|
78
|
+
// Clone state for immutability
|
|
79
|
+
const foldedCtx = [...state.foldedCtx];
|
|
80
|
+
let promptSuccessfulReads = state.promptSuccessfulReads;
|
|
81
|
+
let promptSuccessfulWrites = state.promptSuccessfulWrites;
|
|
82
|
+
let writeGateFired = state.writeGateFired;
|
|
83
|
+
// Per-cycle locals
|
|
84
|
+
let prevSemanticKey = null;
|
|
85
|
+
let consecutiveFailedParses = 0;
|
|
86
|
+
let cycleDone = false;
|
|
87
|
+
let lastOutput = '';
|
|
88
|
+
let prevConf = 1.0;
|
|
89
|
+
let prevAction = null;
|
|
90
|
+
let cycleInputTokens = 0;
|
|
91
|
+
let cycleOutputTokens = 0;
|
|
92
|
+
const { maxToolsPerCycle, maxOutputTokens, wsCapacity, cycleNumber, maxCycles } = config;
|
|
93
|
+
// Bug 1 fix: propagate writeGateFired from monitor control into RA state
|
|
94
|
+
if (control.writeGateFired)
|
|
95
|
+
writeGateFired = true;
|
|
96
|
+
const forceReplan = control.forceReplan;
|
|
97
|
+
const restricted = control.restricted;
|
|
98
|
+
// ── Context injection ──
|
|
99
|
+
if (foldedCtx.length > 0 || forceReplan) {
|
|
100
|
+
const parts = [`[Cycle ${cycleNumber}/${maxCycles}]`];
|
|
101
|
+
if (foldedCtx.length > 0)
|
|
102
|
+
parts.push(`## Completed Actions\n${foldedCtx.join('\n')}`);
|
|
103
|
+
if (forceReplan) {
|
|
104
|
+
const noActionStall = control.prevCycleAction === 'no-action' || control.prevCycleAction === 'parse-error';
|
|
105
|
+
parts.push(noActionStall
|
|
106
|
+
? 'Your last response had NO <action> block. You MUST end with <action>{"tool":"ToolName","input":{...}}</action>. Do not describe what you would do — call the tool directly NOW.'
|
|
107
|
+
: 'MUST try a different strategy. Previous approach is stagnating.');
|
|
108
|
+
}
|
|
109
|
+
if (restricted.length > 0)
|
|
110
|
+
parts.push(`RESTRICTED actions: ${restricted.join(', ')}`);
|
|
111
|
+
if (control.interventionMessage)
|
|
112
|
+
parts.push(control.interventionMessage);
|
|
113
|
+
obsPort.write({ source: moduleId('observer'), content: parts.join('\n\n'), salience: 0.9, timestamp: Date.now() });
|
|
114
|
+
}
|
|
115
|
+
// ── Multi-tool inner loop ──
|
|
116
|
+
let toolsThisCycle = 0;
|
|
117
|
+
while (toolsThisCycle < maxToolsPerCycle) {
|
|
118
|
+
const wsEntries = raReadPort.read();
|
|
119
|
+
const strat = forceReplan && toolsThisCycle === 0
|
|
120
|
+
? 'Consider the problem deeply. Weigh alternatives and identify the strongest path.'
|
|
121
|
+
: 'Produce a structured plan with numbered steps. Identify dependencies and risks.';
|
|
122
|
+
const toolList = tools.list().map((t) => `- ${t.name}: ${t.description ?? ''}`).join('\n');
|
|
123
|
+
const now = Date.now();
|
|
124
|
+
const syntheticSnapshot = [
|
|
125
|
+
{ source: moduleId('observer'), content: strat, salience: 1.0, timestamp: now },
|
|
126
|
+
{ source: moduleId('observer'), content: `Available tools:\n${toolList}`, salience: 0.95, timestamp: now },
|
|
127
|
+
{ source: moduleId('observer'), content: FORMAT_INSTRUCTION, salience: 0.95, timestamp: now },
|
|
128
|
+
...wsEntries,
|
|
129
|
+
];
|
|
130
|
+
try {
|
|
131
|
+
const res = await adapter.invoke(syntheticSnapshot, {
|
|
132
|
+
pactTemplate: { mode: { type: 'oneshot' }, budget: { maxOutputTokens } },
|
|
133
|
+
});
|
|
134
|
+
const text = String(res.output);
|
|
135
|
+
const inTok = res.usage.inputTokens;
|
|
136
|
+
const outTok = res.usage.outputTokens;
|
|
137
|
+
cycleInputTokens += inTok;
|
|
138
|
+
cycleOutputTokens += outTok;
|
|
139
|
+
if (!text.trim()) {
|
|
140
|
+
onEvent({ type: 'cycle-action', cycle: cycleNumber, action: 'empty-response', confidence: 0.1, tokens: res.usage.totalTokens });
|
|
141
|
+
cognitiveSink?.handle({ type: 'cognitive:module_step', moduleId: raModuleId, phase: 'empty-response', durationMs: 0, hasError: true, timestamp: Date.now() });
|
|
142
|
+
prevConf = 0.1;
|
|
143
|
+
prevAction = 'empty-response';
|
|
144
|
+
foldedCtx.push(`[c${cycleNumber}] empty-response`);
|
|
145
|
+
if (foldedCtx.length > 15)
|
|
146
|
+
foldedCtx.shift();
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
const plan = text.match(/<plan>([\s\S]*?)<\/plan>/)?.[1]?.trim() ?? '';
|
|
150
|
+
const reasoning = text.match(/<reasoning>([\s\S]*?)<\/reasoning>/)?.[1]?.trim() ?? '';
|
|
151
|
+
const actionRaw = text.match(/<action>([\s\S]*?)<\/action>/)?.[1]?.trim() ?? '';
|
|
152
|
+
const contentBlock = text.match(/<content>([\s\S]*?)<\/content>/)?.[1] ?? null;
|
|
153
|
+
if (reasoning) {
|
|
154
|
+
const chunk = `**[Cycle ${cycleNumber}/${maxCycles} | Tool ${toolsThisCycle + 1}]** ${reasoning}\n`;
|
|
155
|
+
onEvent({ type: 'text', content: chunk });
|
|
156
|
+
onChunk?.(chunk);
|
|
157
|
+
}
|
|
158
|
+
let actionName = 'unknown';
|
|
159
|
+
let confidence = 0.5;
|
|
160
|
+
let parsed;
|
|
161
|
+
try {
|
|
162
|
+
parsed = JSON.parse(actionRaw);
|
|
163
|
+
consecutiveFailedParses = 0;
|
|
164
|
+
if (contentBlock !== null && parsed.tool === 'Write') {
|
|
165
|
+
parsed.input = parsed.input ?? {};
|
|
166
|
+
parsed.input.content = contentBlock;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
actionName = actionRaw ? 'parse-error' : 'no-action';
|
|
171
|
+
confidence = 0.2;
|
|
172
|
+
prevConf = confidence;
|
|
173
|
+
prevAction = actionName;
|
|
174
|
+
consecutiveFailedParses++;
|
|
175
|
+
onEvent({ type: 'cycle-action', cycle: cycleNumber, action: actionName, confidence, tokens: res.usage.totalTokens });
|
|
176
|
+
cognitiveSink?.handle({ type: 'cognitive:module_step', moduleId: raModuleId, phase: actionName, durationMs: 0, hasError: true, timestamp: Date.now() });
|
|
177
|
+
foldedCtx.push(`[c${cycleNumber}] ${actionName}: ${(plan || reasoning).slice(0, 80)}`);
|
|
178
|
+
if (foldedCtx.length > 15)
|
|
179
|
+
foldedCtx.shift();
|
|
180
|
+
// Early bail-out: circuit-breaker
|
|
181
|
+
if (consecutiveFailedParses >= MAX_CONSECUTIVE_FAILED_PARSES) {
|
|
182
|
+
lastOutput = reasoning || plan || `Model could not produce a valid action after ${MAX_CONSECUTIVE_FAILED_PARSES} attempts. Last response:\n${text.slice(0, 500)}`;
|
|
183
|
+
const cbMsg = `\n[cognitive] Stopping: ${MAX_CONSECUTIVE_FAILED_PARSES} consecutive parse failures. The model may not support the required output format.\n`;
|
|
184
|
+
onEvent({ type: 'text', content: cbMsg });
|
|
185
|
+
onChunk?.(cbMsg);
|
|
186
|
+
cognitiveSink?.handle({ type: 'cognitive:cycle_aborted', reason: `${MAX_CONSECUTIVE_FAILED_PARSES} consecutive parse failures`, phase: 'action', cycleNumber, timestamp: Date.now() });
|
|
187
|
+
cycleDone = true;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
// Continue the while-loop to allow consecutive failures to accumulate
|
|
191
|
+
// toward the circuit-breaker threshold. Each failed parse still counts
|
|
192
|
+
// as a tool slot consumed.
|
|
193
|
+
toolsThisCycle++;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
actionName = parsed.tool ?? 'unknown';
|
|
197
|
+
if (actionName === 'done') {
|
|
198
|
+
lastOutput = parsed.input?.result ?? reasoning ?? plan;
|
|
199
|
+
onEvent({ type: 'cycle-action', cycle: cycleNumber, action: 'done', confidence: 1.0, tokens: res.usage.totalTokens });
|
|
200
|
+
cognitiveSink?.handle({ type: 'cognitive:cycle_phase', phase: 'done', cycleNumber, timestamp: Date.now() });
|
|
201
|
+
cycleDone = true;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
// ── Impasse detection (exact match) ──
|
|
205
|
+
const semanticKey = `${actionName}:${JSON.stringify(parsed.input ?? {})}`;
|
|
206
|
+
if (prevSemanticKey === semanticKey) {
|
|
207
|
+
raWritePort.write({
|
|
208
|
+
source: raModuleId,
|
|
209
|
+
content: '[IMPASSE] You are repeating the same action with identical input. Try a fundamentally different approach.',
|
|
210
|
+
salience: 0.95, timestamp: Date.now(),
|
|
211
|
+
});
|
|
212
|
+
onEvent({
|
|
213
|
+
type: 'monitor', cycle: cycleNumber,
|
|
214
|
+
intervention: 'impasse-detected',
|
|
215
|
+
action: actionName,
|
|
216
|
+
});
|
|
217
|
+
cognitiveSink?.handle({
|
|
218
|
+
type: 'cognitive:control_policy_violation',
|
|
219
|
+
directive: { target: raModuleId, timestamp: Date.now() },
|
|
220
|
+
reason: `impasse: repeated action ${actionName} with identical input`,
|
|
221
|
+
timestamp: Date.now(),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
prevSemanticKey = semanticKey;
|
|
225
|
+
try {
|
|
226
|
+
const toolRes = await tools.execute(actionName, parsed.input ?? {});
|
|
227
|
+
confidence = toolRes.isError ? 0.3 : 0.7;
|
|
228
|
+
const resStr = typeof toolRes.output === 'string' ? toolRes.output : JSON.stringify(toolRes.output);
|
|
229
|
+
raWritePort.write({
|
|
230
|
+
source: raModuleId,
|
|
231
|
+
content: `[${actionName}] Result:\n${resStr}`,
|
|
232
|
+
salience: 0.8, timestamp: Date.now(),
|
|
233
|
+
});
|
|
234
|
+
// Truncation hint
|
|
235
|
+
if (actionName === 'Read' && resStr.endsWith('... (truncated)')) {
|
|
236
|
+
const readPath = parsed.input?.path;
|
|
237
|
+
raWritePort.write({
|
|
238
|
+
source: moduleId('observer'),
|
|
239
|
+
content: `[READ TRUNCATED] Output was cut at 8000 chars. To read the rest, use: Read({"path":"${readPath}","offset":<next_line_number>,"limit":100}). First, estimate the line number from the truncated content.`,
|
|
240
|
+
salience: 0.88, timestamp: Date.now(),
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
// Write-completion hint
|
|
244
|
+
if (actionName === 'Write' && !toolRes.isError) {
|
|
245
|
+
const writePath = parsed.input?.path ?? 'file';
|
|
246
|
+
obsPort.write({
|
|
247
|
+
source: moduleId('observer'),
|
|
248
|
+
content: `[\u2713 DELIVERABLE WRITTEN \u2192 ${writePath}]\nTask output is saved. Execute this action immediately:\n<action>{"tool":"done","input":{"result":"Output written to ${writePath}"}}</action>`,
|
|
249
|
+
salience: 1.0, timestamp: Date.now(),
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
// Write gate counters
|
|
253
|
+
if (!toolRes.isError) {
|
|
254
|
+
if (READ_ONLY_ACTIONS.has(actionName))
|
|
255
|
+
promptSuccessfulReads++;
|
|
256
|
+
if (actionName === 'Write') {
|
|
257
|
+
promptSuccessfulWrites++;
|
|
258
|
+
promptSuccessfulReads = 0;
|
|
259
|
+
writeGateFired = false;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
catch (toolErr) {
|
|
264
|
+
const msg = toolErr instanceof Error ? toolErr.message : String(toolErr);
|
|
265
|
+
confidence = 0.1;
|
|
266
|
+
raWritePort.write({
|
|
267
|
+
source: raModuleId,
|
|
268
|
+
content: `[${actionName}] Tool error: ${msg}`,
|
|
269
|
+
salience: 0.8, timestamp: Date.now(),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
prevConf = confidence;
|
|
273
|
+
prevAction = actionName;
|
|
274
|
+
onEvent({ type: 'cycle-action', cycle: cycleNumber, action: actionName, confidence, tokens: res.usage.totalTokens });
|
|
275
|
+
cognitiveSink?.handle({ type: 'cognitive:module_step', moduleId: raModuleId, phase: actionName, durationMs: 0, hasError: confidence < 0.5, timestamp: Date.now() });
|
|
276
|
+
foldedCtx.push(`[c${cycleNumber}] ${actionName}: ${(plan || reasoning).slice(0, 80)}`);
|
|
277
|
+
if (foldedCtx.length > 15)
|
|
278
|
+
foldedCtx.shift();
|
|
279
|
+
toolsThisCycle++;
|
|
280
|
+
}
|
|
281
|
+
catch (err) {
|
|
282
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
283
|
+
onEvent({ type: 'cycle-action', cycle: cycleNumber, action: 'error', confidence: 0, tokens: 0 });
|
|
284
|
+
const errMsg = `\n[cycle ${cycleNumber}] Error: ${msg}\n`;
|
|
285
|
+
onEvent({ type: 'text', content: errMsg });
|
|
286
|
+
onChunk?.(errMsg);
|
|
287
|
+
cognitiveSink?.handle({ type: 'cognitive:cycle_aborted', reason: msg, phase: 'action', cycleNumber, timestamp: Date.now() });
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// Compute workspace utilization
|
|
292
|
+
const wsSnapshot = ws.snapshot();
|
|
293
|
+
const wsUtilization = wsSnapshot.length / wsCapacity;
|
|
294
|
+
const newState = {
|
|
295
|
+
foldedCtx,
|
|
296
|
+
promptSuccessfulReads,
|
|
297
|
+
promptSuccessfulWrites,
|
|
298
|
+
writeGateFired,
|
|
299
|
+
};
|
|
300
|
+
const monitoring = {
|
|
301
|
+
source: raModuleId,
|
|
302
|
+
timestamp: Date.now(),
|
|
303
|
+
type: 'bridge-reasoner-actor',
|
|
304
|
+
prevConf,
|
|
305
|
+
prevAction,
|
|
306
|
+
consecutiveFailedParses,
|
|
307
|
+
wsUtilization,
|
|
308
|
+
promptInputTokens: cycleInputTokens,
|
|
309
|
+
promptOutputTokens: cycleOutputTokens,
|
|
310
|
+
writeGateFired,
|
|
311
|
+
promptSuccessfulReads,
|
|
312
|
+
promptSuccessfulWrites,
|
|
313
|
+
cycleDone,
|
|
314
|
+
lastOutput,
|
|
315
|
+
};
|
|
316
|
+
return {
|
|
317
|
+
output: monitoring,
|
|
318
|
+
state: newState,
|
|
319
|
+
monitoring,
|
|
320
|
+
};
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
// ── BridgeMonitorModule Factory ────────────────────────────────────
|
|
325
|
+
/**
|
|
326
|
+
* Creates a BridgeMonitorModule that extracts the inline monitor block
|
|
327
|
+
* from cognitive-provider.ts into a CognitiveModule implementation.
|
|
328
|
+
*
|
|
329
|
+
* Reads the previous cycle's RA monitoring signal and produces control
|
|
330
|
+
* directives for the current cycle's RA.
|
|
331
|
+
*
|
|
332
|
+
* Workspace writes use source: moduleId('monitor') (identity fix per PRD 042).
|
|
333
|
+
*/
|
|
334
|
+
export function createBridgeMonitorModule(ws, monitorPort, wsCapacity, config, onEvent, cognitiveSink) {
|
|
335
|
+
const monModuleId = moduleId('monitor');
|
|
336
|
+
return {
|
|
337
|
+
id: monModuleId,
|
|
338
|
+
initialState() {
|
|
339
|
+
return {
|
|
340
|
+
readOnlyRun: 0,
|
|
341
|
+
interventions: 0,
|
|
342
|
+
accumulatedInputTokens: 0,
|
|
343
|
+
};
|
|
344
|
+
},
|
|
345
|
+
async step(monitoring, state, _noControl) {
|
|
346
|
+
// First cycle: no monitoring available yet — return default control
|
|
347
|
+
if (monitoring === null) {
|
|
348
|
+
return {
|
|
349
|
+
output: defaultBridgeMonitorControl(),
|
|
350
|
+
state: { ...state },
|
|
351
|
+
monitoring: {
|
|
352
|
+
source: monModuleId,
|
|
353
|
+
timestamp: Date.now(),
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
const { confThreshold, stagThreshold, intBudget } = config;
|
|
358
|
+
// Clone state for immutability
|
|
359
|
+
let readOnlyRun = state.readOnlyRun;
|
|
360
|
+
let interventions = state.interventions;
|
|
361
|
+
let accumulatedInputTokens = state.accumulatedInputTokens + monitoring.promptInputTokens;
|
|
362
|
+
// Track read-only runs
|
|
363
|
+
if (monitoring.prevAction && READ_ONLY_ACTIONS.has(monitoring.prevAction)) {
|
|
364
|
+
readOnlyRun++;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
readOnlyRun = 0;
|
|
368
|
+
}
|
|
369
|
+
let forceReplan = false;
|
|
370
|
+
const restricted = [];
|
|
371
|
+
let interventionMessage = null;
|
|
372
|
+
// ── Anomaly detection ──
|
|
373
|
+
const anomaly = monitoring.prevConf < confThreshold || readOnlyRun >= stagThreshold;
|
|
374
|
+
if (anomaly && interventions < intBudget) {
|
|
375
|
+
interventions++;
|
|
376
|
+
forceReplan = true;
|
|
377
|
+
if (interventions < 3 && monitoring.prevAction)
|
|
378
|
+
restricted.push(monitoring.prevAction);
|
|
379
|
+
const interventionKind = interventions >= 3 ? 'reframe' : 'constrain';
|
|
380
|
+
onEvent({
|
|
381
|
+
type: 'monitor', cycle: 0, // cycle number not available in monitor — caller sets context
|
|
382
|
+
intervention: interventionKind,
|
|
383
|
+
restricted: restricted.length > 0 ? restricted : undefined,
|
|
384
|
+
});
|
|
385
|
+
cognitiveSink?.handle({
|
|
386
|
+
type: 'cognitive:control_directive',
|
|
387
|
+
directive: {
|
|
388
|
+
target: moduleId('reasoner-actor'),
|
|
389
|
+
timestamp: Date.now(),
|
|
390
|
+
},
|
|
391
|
+
timestamp: Date.now(),
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
// ── Workspace saturation intervention ──
|
|
395
|
+
const wsEntries = ws.snapshot();
|
|
396
|
+
const wsUtilization = wsEntries.length / wsCapacity;
|
|
397
|
+
if (wsUtilization >= 0.8) {
|
|
398
|
+
monitorPort.write({
|
|
399
|
+
source: monModuleId,
|
|
400
|
+
content: `[WORKSPACE ${wsEntries.length}/${wsCapacity} entries \u2014 near capacity] Context entries are being evicted. Stop accumulating information. Summarize what you know and produce your final output NOW.`,
|
|
401
|
+
salience: 0.92,
|
|
402
|
+
timestamp: Date.now(),
|
|
403
|
+
});
|
|
404
|
+
onEvent({ type: 'monitor', cycle: 0, intervention: 'workspace-saturation' });
|
|
405
|
+
}
|
|
406
|
+
// ── Token budget intervention ──
|
|
407
|
+
if (accumulatedInputTokens > 100_000) {
|
|
408
|
+
monitorPort.write({
|
|
409
|
+
source: monModuleId,
|
|
410
|
+
content: `[TOKEN BUDGET ALERT: ~${Math.round(accumulatedInputTokens / 1000)}k input tokens used] Context window pressure is high. Do NOT read more files. Use what you already know to produce your final Write + done action immediately.`,
|
|
411
|
+
salience: 0.95,
|
|
412
|
+
timestamp: Date.now(),
|
|
413
|
+
});
|
|
414
|
+
onEvent({ type: 'monitor', cycle: 0, intervention: 'token-budget-pressure' });
|
|
415
|
+
}
|
|
416
|
+
// ── Write gate intervention ──
|
|
417
|
+
let writeGateJustFired = false;
|
|
418
|
+
if (monitoring.promptSuccessfulReads >= 3 && monitoring.promptSuccessfulWrites === 0 && !monitoring.writeGateFired) {
|
|
419
|
+
forceReplan = true;
|
|
420
|
+
writeGateJustFired = true;
|
|
421
|
+
for (const tool of READ_ONLY_ACTIONS) {
|
|
422
|
+
if (!restricted.includes(tool))
|
|
423
|
+
restricted.push(tool);
|
|
424
|
+
}
|
|
425
|
+
monitorPort.write({
|
|
426
|
+
source: monModuleId,
|
|
427
|
+
content: `[WRITE GATE] You have gathered enough information (${monitoring.promptSuccessfulReads} reads). Read, Glob, Grep, Search, and List are strongly DISCOURAGED. You should produce a Write action to save your output or call done if the task is complete.`,
|
|
428
|
+
salience: 0.85,
|
|
429
|
+
timestamp: Date.now(),
|
|
430
|
+
});
|
|
431
|
+
onEvent({ type: 'monitor', cycle: 0, intervention: 'write-gate' });
|
|
432
|
+
}
|
|
433
|
+
const newState = {
|
|
434
|
+
readOnlyRun,
|
|
435
|
+
interventions,
|
|
436
|
+
accumulatedInputTokens,
|
|
437
|
+
};
|
|
438
|
+
const output = {
|
|
439
|
+
target: moduleId('reasoner-actor'),
|
|
440
|
+
timestamp: Date.now(),
|
|
441
|
+
forceReplan,
|
|
442
|
+
restricted,
|
|
443
|
+
interventionMessage,
|
|
444
|
+
writeGateFired: writeGateJustFired,
|
|
445
|
+
prevCycleAction: monitoring.prevAction,
|
|
446
|
+
};
|
|
447
|
+
return {
|
|
448
|
+
output,
|
|
449
|
+
state: newState,
|
|
450
|
+
monitoring: {
|
|
451
|
+
source: monModuleId,
|
|
452
|
+
timestamp: Date.now(),
|
|
453
|
+
},
|
|
454
|
+
};
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=cognitive-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive-modules.js","sourceRoot":"","sources":["../../src/sessions/cognitive-modules.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;;;;;GAWG;AAcH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK3C,gFAAgF;AAEhF,MAAM,kBAAkB,GACxB;;;;;;;;;;;;;;;;;;;;iEAoBiE,CAAC;AAElE,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAErF,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAiFxC,sEAAsE;AAEtE,8DAA8D;AAC9D,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC;QAClC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,W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BACtB;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Agent Provider v3 — manual module composition (PRD 042 Phase 4).
|
|
3
|
+
*
|
|
4
|
+
* Architecture: BridgeMonitorModule + BridgeReasonerActorModule composed in a
|
|
5
|
+
* manual for-loop with monitor-first execution order. Module factories from
|
|
6
|
+
* cognitive-modules.ts encapsulate all behavioral logic (11 fixes from PRDs
|
|
7
|
+
* 033/040/041). This file owns the outer cycle engine and session lifecycle.
|
|
8
|
+
*
|
|
9
|
+
* Execution order per cycle:
|
|
10
|
+
* 1. Monitor reads last cycle's RA monitoring -> produces BridgeMonitorControl
|
|
11
|
+
* 2. RA runs inner while-loop with monitor's control applied immediately
|
|
12
|
+
*
|
|
13
|
+
* External interface unchanged: createCognitiveSession returning PtySession.
|
|
14
|
+
*/
|
|
15
|
+
import type { ProviderAdapter, ToolProvider } from '@methodts/pacta';
|
|
16
|
+
import type { PtySession } from './print-session.js';
|
|
17
|
+
import type { StreamEvent } from './pool.js';
|
|
18
|
+
import type { CognitiveEventBusSink as CognitiveSink } from './cognitive-sink.js';
|
|
19
|
+
export interface CognitiveSessionConfig {
|
|
20
|
+
name?: string;
|
|
21
|
+
patterns?: string[];
|
|
22
|
+
maxCycles?: number;
|
|
23
|
+
maxToolsPerCycle?: number;
|
|
24
|
+
workspaceCapacity?: number;
|
|
25
|
+
confidenceThreshold?: number;
|
|
26
|
+
stagnationThreshold?: number;
|
|
27
|
+
interventionBudget?: number;
|
|
28
|
+
maxOutputTokens?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface CognitiveSessionOptions {
|
|
31
|
+
id: string;
|
|
32
|
+
workdir: string;
|
|
33
|
+
onEvent: (event: StreamEvent) => void;
|
|
34
|
+
adapter: ProviderAdapter;
|
|
35
|
+
tools: ToolProvider;
|
|
36
|
+
config?: CognitiveSessionConfig;
|
|
37
|
+
initialPrompt?: string;
|
|
38
|
+
/** Optional CognitiveSink for emitting typed CognitiveEvents to the bridge event bus (PRD 026). */
|
|
39
|
+
cognitiveSink?: CognitiveSink;
|
|
40
|
+
}
|
|
41
|
+
export declare function createCognitiveSession(options: CognitiveSessionOptions): PtySession;
|
|
42
|
+
//# sourceMappingURL=cognitive-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive-provider.d.ts","sourceRoot":"","sources":["../../src/sessions/cognitive-provider.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAEV,eAAe,EAEf,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,oBAAoB,CAAC;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYlF,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mGAAmG;IACnG,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AASD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU,CA2MnF"}
|