@leitwerk-dev/server 0.2.0 → 0.3.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/app-4QSV4FUQ.js +8 -0
- package/dist/{app-D4XHIbwA.d.ts → app-WfwKzrVk.d.ts} +2029 -410
- package/dist/app.d.ts +55 -12
- package/dist/app.d.ts.map +1 -1
- package/dist/{chunk-AGC2ND53.js → chunk-KIOQNNG6.js} +1645 -750
- package/dist/chunk-KIOQNNG6.js.map +1 -0
- package/dist/{chunk-XTXH6623.js → chunk-LK3RO6C7.js} +1543 -2111
- package/dist/chunk-LK3RO6C7.js.map +1 -0
- package/dist/config/config-loader.d.ts +11 -0
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-types.d.ts +152 -51
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/db/api-token-repo.d.ts +24 -0
- package/dist/db/api-token-repo.d.ts.map +1 -1
- package/dist/db/auth-repo.d.ts +30 -0
- package/dist/db/auth-repo.d.ts.map +1 -1
- package/dist/db/credential-cipher.d.ts +8 -3
- package/dist/db/credential-cipher.d.ts.map +1 -1
- package/dist/db/database.d.ts +19 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/external-write-log-repo.d.ts +6 -1
- package/dist/db/external-write-log-repo.d.ts.map +1 -1
- package/dist/db/future-execution-repo.d.ts +47 -0
- package/dist/db/future-execution-repo.d.ts.map +1 -1
- package/dist/db/launch-run-repo.d.ts +17 -0
- package/dist/db/launch-run-repo.d.ts.map +1 -1
- package/dist/db/launcher-recent-value-repo.d.ts +15 -0
- package/dist/db/launcher-recent-value-repo.d.ts.map +1 -1
- package/dist/db/pending-external-source-fire-repo.d.ts +33 -0
- package/dist/db/pending-external-source-fire-repo.d.ts.map +1 -1
- package/dist/db/process-event-repo.d.ts +17 -0
- package/dist/db/process-event-repo.d.ts.map +1 -1
- package/dist/db/process-handoff-dedup-key-repo.d.ts +8 -0
- package/dist/db/process-handoff-dedup-key-repo.d.ts.map +1 -1
- package/dist/db/process-input-repo.d.ts +15 -0
- package/dist/db/process-input-repo.d.ts.map +1 -1
- package/dist/db/process-instance-repo.d.ts +49 -0
- package/dist/db/process-instance-repo.d.ts.map +1 -1
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts +18 -0
- package/dist/db/process-leaf-outcome-snapshot-repo.d.ts.map +1 -1
- package/dist/db/process-project-repo.d.ts +20 -0
- package/dist/db/process-project-repo.d.ts.map +1 -1
- package/dist/db/process-question-request-repo.d.ts +19 -0
- package/dist/db/process-question-request-repo.d.ts.map +1 -1
- package/dist/db/process-relation-repo.d.ts +5 -0
- package/dist/db/process-relation-repo.d.ts.map +1 -1
- package/dist/db/process-skill-repo.d.ts +4 -0
- package/dist/db/process-skill-repo.d.ts.map +1 -1
- package/dist/db/process-title-job-repo.d.ts +22 -0
- package/dist/db/process-title-job-repo.d.ts.map +1 -1
- package/dist/db/process-tool-approval-request-repo.d.ts +20 -0
- package/dist/db/process-tool-approval-request-repo.d.ts.map +1 -1
- package/dist/db/process-turn-annotation-repo.d.ts +22 -2
- package/dist/db/process-turn-annotation-repo.d.ts.map +1 -1
- package/dist/db/process-turn-record-repo.d.ts +27 -0
- package/dist/db/process-turn-record-repo.d.ts.map +1 -1
- package/dist/db/provider-credential-repo.d.ts +16 -0
- package/dist/db/provider-credential-repo.d.ts.map +1 -1
- package/dist/db/repositories.d.ts +33 -0
- package/dist/db/repositories.d.ts.map +1 -1
- package/dist/db/session-transfer-repo.d.ts +49 -1
- package/dist/db/session-transfer-repo.d.ts.map +1 -1
- package/dist/db/skill-repo.d.ts +20 -0
- package/dist/db/skill-repo.d.ts.map +1 -1
- package/dist/db/startup-observation-repo.d.ts +3 -0
- package/dist/db/startup-observation-repo.d.ts.map +1 -1
- package/dist/db/ticket-destination-recent-repo.d.ts +14 -0
- package/dist/db/ticket-destination-recent-repo.d.ts.map +1 -1
- package/dist/db/turn-start-record-repo.d.ts +9 -0
- package/dist/db/turn-start-record-repo.d.ts.map +1 -1
- package/dist/db/turn-summary-repo.d.ts +18 -0
- package/dist/db/turn-summary-repo.d.ts.map +1 -1
- package/dist/db/worker-lease-repo.d.ts +31 -1
- package/dist/db/worker-lease-repo.d.ts.map +1 -1
- package/dist/effects/post-commit-effect.d.ts +29 -0
- package/dist/effects/post-commit-effect.d.ts.map +1 -1
- package/dist/effects/post-commit-runner.d.ts +1 -0
- package/dist/effects/post-commit-runner.d.ts.map +1 -1
- package/dist/entry-ref-patch.d.ts +3 -0
- package/dist/entry-ref-patch.d.ts.map +1 -1
- package/dist/extension-ui/catalog.d.ts +15 -0
- package/dist/extension-ui/catalog.d.ts.map +1 -1
- package/dist/extensions/extension-host.d.ts +6 -0
- package/dist/extensions/extension-host.d.ts.map +1 -1
- package/dist/external-source-service.d.ts +8 -0
- package/dist/external-source-service.d.ts.map +1 -1
- package/dist/future-execution/execution.d.ts +23 -1
- package/dist/future-execution/execution.d.ts.map +1 -1
- package/dist/future-execution/launch-lifecycle.d.ts +76 -0
- package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
- package/dist/future-execution/lifecycle.d.ts +99 -0
- package/dist/future-execution/lifecycle.d.ts.map +1 -1
- package/dist/future-execution/model-projection.d.ts +6 -0
- package/dist/future-execution/model-projection.d.ts.map +1 -1
- package/dist/future-execution/transition-planner.d.ts +25 -0
- package/dist/future-execution/transition-planner.d.ts.map +1 -1
- package/dist/future-execution-scheduler.d.ts +1 -1
- package/dist/future-execution-scheduler.d.ts.map +1 -1
- package/dist/index.d.ts +3 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -239
- package/dist/index.js.map +1 -1
- package/dist/instance-tree.d.ts +3 -0
- package/dist/instance-tree.d.ts.map +1 -1
- package/dist/integration-tool-registry.d.ts +4 -1
- package/dist/integration-tool-registry.d.ts.map +1 -1
- package/dist/launch-coordinator.d.ts +33 -0
- package/dist/launch-coordinator.d.ts.map +1 -1
- package/dist/launch-pipeline.d.ts +60 -0
- package/dist/launch-pipeline.d.ts.map +1 -1
- package/dist/launcher-recent-values-service.d.ts +3 -0
- package/dist/launcher-recent-values-service.d.ts.map +1 -1
- package/dist/main.js +7 -14
- package/dist/main.js.map +1 -1
- package/dist/model-providers/builtin-server-adapter.d.ts +1 -0
- package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
- package/dist/model-providers/credentials.d.ts +17 -0
- package/dist/model-providers/credentials.d.ts.map +1 -1
- package/dist/model-providers/model-status-cache.d.ts +30 -1
- package/dist/model-providers/model-status-cache.d.ts.map +1 -1
- package/dist/model-providers/provider-options.d.ts +21 -1
- package/dist/model-providers/provider-options.d.ts.map +1 -1
- package/dist/model-providers/registry.d.ts +22 -2
- package/dist/model-providers/registry.d.ts.map +1 -1
- package/dist/model-providers/server-adapters.d.ts +19 -0
- package/dist/model-providers/server-adapters.d.ts.map +1 -1
- package/dist/pi-resources/assemble.d.ts +24 -4
- package/dist/pi-resources/assemble.d.ts.map +1 -1
- package/dist/pi-resources/bundle-cache.d.ts +20 -1
- package/dist/pi-resources/bundle-cache.d.ts.map +1 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts +5 -1
- package/dist/pi-resources/bundle-pin-lifecycle.d.ts.map +1 -1
- package/dist/pi-resources/resource-collector.d.ts +11 -0
- package/dist/pi-resources/resource-collector.d.ts.map +1 -1
- package/dist/pi-session-tree.d.ts +13 -1
- package/dist/pi-session-tree.d.ts.map +1 -1
- package/dist/process-action-registry.d.ts +47 -0
- package/dist/process-action-registry.d.ts.map +1 -1
- package/dist/process-deletion-service.d.ts +12 -0
- package/dist/process-deletion-service.d.ts.map +1 -1
- package/dist/process-engine/decision.d.ts +12 -0
- package/dist/process-engine/decision.d.ts.map +1 -1
- package/dist/process-engine/engine.d.ts +1 -0
- package/dist/process-engine/engine.d.ts.map +1 -1
- package/dist/process-engine/operation.d.ts +23 -2
- package/dist/process-engine/operation.d.ts.map +1 -1
- package/dist/process-engine/startup-reconciliation.d.ts +14 -0
- package/dist/process-engine/startup-reconciliation.d.ts.map +1 -1
- package/dist/process-engine/types.d.ts +112 -1
- package/dist/process-engine/types.d.ts.map +1 -1
- package/dist/process-engine/writes/build-process-park-writes.d.ts +3 -0
- package/dist/process-engine/writes/build-process-park-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts +4 -0
- package/dist/process-engine/writes/build-recovery-start-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-retry-writes.d.ts +3 -0
- package/dist/process-engine/writes/build-retry-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-failed-writes.d.ts +6 -0
- package/dist/process-engine/writes/build-turn-failed-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts +8 -0
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts +8 -0
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/commit-writes.d.ts +14 -0
- package/dist/process-engine/writes/commit-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/deferred-extension-events.d.ts +4 -0
- package/dist/process-engine/writes/deferred-extension-events.d.ts.map +1 -1
- package/dist/process-engine/writes/writes.d.ts +67 -0
- package/dist/process-engine/writes/writes.d.ts.map +1 -1
- package/dist/process-graph.d.ts +1 -1
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-input-dispatch.d.ts +1 -0
- package/dist/process-input-dispatch.d.ts.map +1 -1
- package/dist/process-launch-executor.d.ts +1 -0
- package/dist/process-launch-executor.d.ts.map +1 -1
- package/dist/process-model-policy/types.d.ts +157 -1
- package/dist/process-model-policy/types.d.ts.map +1 -1
- package/dist/process-operation-coordinator.d.ts +3 -0
- package/dist/process-operation-coordinator.d.ts.map +1 -1
- package/dist/process-question-service.d.ts +36 -20
- package/dist/process-question-service.d.ts.map +1 -1
- package/dist/process-runtime-availability.d.ts +2 -1
- package/dist/process-runtime-availability.d.ts.map +1 -1
- package/dist/process-session-store.d.ts +15 -4
- package/dist/process-session-store.d.ts.map +1 -1
- package/dist/process-title-generator.d.ts +53 -0
- package/dist/process-title-generator.d.ts.map +1 -1
- package/dist/process-turn-navigation.d.ts +1 -30
- package/dist/process-turn-navigation.d.ts.map +1 -1
- package/dist/process-turn-trace.d.ts +7 -0
- package/dist/process-turn-trace.d.ts.map +1 -1
- package/dist/process-ui-registry.d.ts +2 -0
- package/dist/process-ui-registry.d.ts.map +1 -1
- package/dist/process-ui-snapshot-presenter.d.ts +68 -1
- package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
- package/dist/process-watcher-registry.d.ts +5 -0
- package/dist/process-watcher-registry.d.ts.map +1 -1
- package/dist/product-ref-state.d.ts +1 -0
- package/dist/product-ref-state.d.ts.map +1 -1
- package/dist/project-mutation-service.d.ts +19 -0
- package/dist/project-mutation-service.d.ts.map +1 -1
- package/dist/result-image-store.d.ts +20 -0
- package/dist/result-image-store.d.ts.map +1 -1
- package/dist/routes/process-route-helpers.d.ts +30 -0
- package/dist/routes/process-route-helpers.d.ts.map +1 -1
- package/dist/routes/ui-renderers.d.ts +4 -0
- package/dist/routes/ui-renderers.d.ts.map +1 -1
- package/dist/routes/watchers.d.ts +3 -0
- package/dist/routes/watchers.d.ts.map +1 -1
- package/dist/semantic-entry-ref-state.d.ts +1 -0
- package/dist/semantic-entry-ref-state.d.ts.map +1 -1
- package/dist/server-bootstrap/app-lifecycle.d.ts +24 -0
- package/dist/server-bootstrap/app-lifecycle.d.ts.map +1 -0
- package/dist/server-bootstrap/build-host-capabilities.d.ts +5 -1
- package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
- package/dist/server-topology.d.ts +8 -1
- package/dist/server-topology.d.ts.map +1 -1
- package/dist/session-transfer-helper-relays.d.ts +24 -0
- package/dist/session-transfer-helper-relays.d.ts.map +1 -1
- package/dist/session-transfer-service.d.ts +63 -1
- package/dist/session-transfer-service.d.ts.map +1 -1
- package/dist/skills/catalog-service.d.ts +7 -0
- package/dist/skills/catalog-service.d.ts.map +1 -1
- package/dist/skills/source-importer.d.ts +8 -0
- package/dist/skills/source-importer.d.ts.map +1 -1
- package/dist/startup-evidence.d.ts.map +1 -1
- package/dist/supervisor/ipc-handler.d.ts +28 -0
- package/dist/supervisor/ipc-handler.d.ts.map +1 -1
- package/dist/supervisor/worker-event-ingestor.d.ts +10 -0
- package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.d.ts +13 -0
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/supervisor/worker-storage-layout.d.ts +12 -0
- package/dist/supervisor/worker-storage-layout.d.ts.map +1 -1
- package/dist/supervisor/worker-supervisor.d.ts +47 -3
- package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts +19 -0
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
- package/dist/supervisor/worker-unit-reclaimer.d.ts +3 -0
- package/dist/supervisor/worker-unit-reclaimer.d.ts.map +1 -1
- package/dist/supervisor/worker-websocket-ipc.d.ts +37 -0
- package/dist/supervisor/worker-websocket-ipc.d.ts.map +1 -1
- package/dist/test-helpers/accepted-turn-start.d.ts +22 -0
- package/dist/test-helpers/accepted-turn-start.d.ts.map +1 -1
- package/dist/test-helpers/prepared-fixture-start.d.ts +14 -0
- package/dist/test-helpers/prepared-fixture-start.d.ts.map +1 -0
- package/dist/test-helpers/session-snapshot-fixtures.d.ts +1 -1
- package/dist/test-helpers/session-snapshot-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.d.ts +8 -1
- package/dist/test-helpers/turn-start-preflight-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/unit-deps.d.ts +8 -0
- package/dist/test-helpers/unit-deps.d.ts.map +1 -1
- package/dist/testing.d.ts +5 -7
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +60 -53
- package/dist/testing.js.map +1 -1
- package/dist/tool-approval-gate.d.ts +21 -0
- package/dist/tool-approval-gate.d.ts.map +1 -1
- package/dist/turn-result-markdown.d.ts +2 -0
- package/dist/turn-result-markdown.d.ts.map +1 -1
- package/dist/worker-runtime-profile-selection.d.ts +20 -4
- package/dist/worker-runtime-profile-selection.d.ts.map +1 -1
- package/dist/ws/broadcast.d.ts +10 -0
- package/dist/ws/broadcast.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/app.ts +916 -892
- package/src/config/config-loader.ts +12 -0
- package/src/config/config-types.ts +166 -66
- package/src/db/api-token-repo.ts +35 -2
- package/src/db/auth-repo.ts +35 -1
- package/src/db/credential-cipher.ts +8 -3
- package/src/db/database.ts +14 -0
- package/src/db/external-write-log-repo.ts +6 -1
- package/src/db/future-execution-repo.ts +51 -1
- package/src/db/launch-run-repo.ts +17 -0
- package/src/db/launcher-recent-value-repo.ts +15 -0
- package/src/db/pending-external-source-fire-repo.ts +33 -0
- package/src/db/process-event-repo.ts +21 -1
- package/src/db/process-handoff-dedup-key-repo.ts +8 -0
- package/src/db/process-input-repo.ts +15 -0
- package/src/db/process-instance-repo.ts +57 -2
- package/src/db/process-leaf-outcome-snapshot-repo.ts +18 -0
- package/src/db/process-project-repo.ts +20 -0
- package/src/db/process-question-request-repo.ts +19 -0
- package/src/db/process-relation-repo.ts +8 -1
- package/src/db/process-skill-repo.ts +4 -0
- package/src/db/process-title-job-repo.ts +30 -2
- package/src/db/process-tool-approval-request-repo.ts +24 -1
- package/src/db/process-turn-annotation-repo.ts +22 -2
- package/src/db/process-turn-record-repo.ts +27 -0
- package/src/db/provider-credential-repo.ts +20 -1
- package/src/db/repositories.ts +36 -1
- package/src/db/session-transfer-repo.ts +71 -9
- package/src/db/skill-repo.ts +24 -1
- package/src/db/startup-observation-repo.ts +3 -0
- package/src/db/ticket-destination-recent-repo.ts +14 -0
- package/src/db/turn-start-record-repo.ts +12 -1
- package/src/db/turn-summary-repo.ts +29 -2
- package/src/db/worker-lease-repo.ts +31 -1
- package/src/deployment-preflight.ts +1 -1
- package/src/effects/post-commit-effect.ts +42 -3
- package/src/effects/post-commit-runner.ts +1 -0
- package/src/entry-ref-patch.ts +9 -1
- package/src/extension-ui/catalog.ts +15 -0
- package/src/extensions/extension-host.ts +6 -0
- package/src/external-source-service.ts +12 -1
- package/src/future-execution/execution.ts +45 -8
- package/src/future-execution/launch-lifecycle.ts +145 -17
- package/src/future-execution/lifecycle.ts +124 -13
- package/src/future-execution/model-projection.ts +6 -0
- package/src/future-execution/transition-planner.ts +25 -0
- package/src/future-execution-scheduler.ts +7 -6
- package/src/index.ts +5 -153
- package/src/instance-tree.ts +3 -0
- package/src/integration-tool-registry.ts +17 -8
- package/src/launch-coordinator.ts +55 -5
- package/src/launch-pipeline.ts +103 -12
- package/src/launcher-recent-values-service.ts +3 -0
- package/src/main.ts +3 -10
- package/src/model-providers/builtin-server-adapter.ts +1 -0
- package/src/model-providers/credentials.ts +17 -0
- package/src/model-providers/model-status-cache.ts +30 -1
- package/src/model-providers/provider-options.ts +25 -2
- package/src/model-providers/registry.ts +22 -2
- package/src/model-providers/server-adapters.ts +19 -0
- package/src/pi-resources/assemble.ts +24 -4
- package/src/pi-resources/bundle-cache.ts +20 -1
- package/src/pi-resources/bundle-pin-lifecycle.ts +8 -2
- package/src/pi-resources/resource-collector.ts +11 -0
- package/src/pi-session-tree.ts +13 -1
- package/src/process-action-registry.ts +53 -1
- package/src/process-deletion-service.ts +29 -4
- package/src/process-engine/decision.ts +12 -0
- package/src/process-engine/engine.ts +1 -0
- package/src/process-engine/operation.ts +23 -2
- package/src/process-engine/startup-reconciliation.ts +14 -0
- package/src/process-engine/types.ts +176 -14
- package/src/process-engine/writes/build-process-park-writes.ts +3 -0
- package/src/process-engine/writes/build-recovery-start-writes.ts +4 -0
- package/src/process-engine/writes/build-retry-writes.ts +3 -0
- package/src/process-engine/writes/build-turn-failed-writes.ts +6 -0
- package/src/process-engine/writes/build-turn-outcome-writes.ts +8 -0
- package/src/process-engine/writes/build-turn-selection-writes.ts +8 -0
- package/src/process-engine/writes/commit-writes.ts +14 -0
- package/src/process-engine/writes/deferred-extension-events.ts +4 -0
- package/src/process-engine/writes/writes.ts +104 -10
- package/src/process-graph.ts +0 -3
- package/src/process-input-dispatch.ts +1 -0
- package/src/process-launch-executor.ts +1 -0
- package/src/process-model-policy/types.ts +195 -11
- package/src/process-operation-coordinator.ts +3 -0
- package/src/process-question-service.ts +53 -11
- package/src/process-runtime-availability.ts +4 -3
- package/src/process-session-store.ts +15 -4
- package/src/process-title-generator.ts +71 -5
- package/src/process-turn-navigation.ts +4 -1
- package/src/process-turn-trace.ts +7 -0
- package/src/process-ui-registry.ts +2 -0
- package/src/process-ui-snapshot-presenter.ts +75 -3
- package/src/process-watcher-registry.ts +5 -0
- package/src/product-ref-state.ts +1 -0
- package/src/project-mutation-service.ts +22 -1
- package/src/result-image-store.ts +27 -2
- package/src/routes/process-route-helpers.ts +30 -0
- package/src/routes/ui-renderers.ts +4 -0
- package/src/routes/watchers.ts +3 -0
- package/src/semantic-entry-ref-state.ts +1 -0
- package/src/server-bootstrap/app-lifecycle.ts +150 -0
- package/src/server-topology.ts +8 -1
- package/src/session-transfer-helper-relays.ts +33 -2
- package/src/session-transfer-service.ts +75 -7
- package/src/skills/catalog-service.ts +7 -0
- package/src/skills/source-importer.ts +8 -0
- package/src/startup-evidence.ts +23 -41
- package/src/supervisor/ipc-handler.ts +33 -1
- package/src/supervisor/worker-event-ingestor.ts +10 -0
- package/src/supervisor/worker-start-payload-builder.ts +16 -1
- package/src/supervisor/worker-storage-layout.ts +12 -0
- package/src/supervisor/worker-supervisor.ts +119 -133
- package/src/supervisor/worker-turn-ipc-recorder.ts +19 -0
- package/src/supervisor/worker-unit-reclaimer.ts +3 -0
- package/src/supervisor/worker-websocket-ipc.ts +57 -3
- package/src/test-helpers/accepted-turn-start.ts +32 -3
- package/src/test-helpers/prepared-fixture-start.ts +74 -0
- package/src/test-helpers/session-snapshot-fixtures.ts +1 -1
- package/src/test-helpers/turn-start-preflight-fixtures.ts +8 -1
- package/src/test-helpers/unit-deps.ts +13 -1
- package/src/testing.ts +5 -23
- package/src/tool-approval-gate.ts +32 -3
- package/src/turn-result-markdown.ts +2 -0
- package/src/worker-runtime-profile-selection.ts +24 -5
- package/src/ws/broadcast.ts +20 -1
- package/dist/app-I4QQUL5B.js +0 -10
- package/dist/chunk-AGC2ND53.js.map +0 -1
- package/dist/chunk-XTXH6623.js.map +0 -1
- /package/dist/{app-I4QQUL5B.js.map → app-4QSV4FUQ.js.map} +0 -0
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import type { ResolvedTurnStart } from "@leitwerk-dev/domain";
|
|
1
2
|
import type { AppContext } from "../app.js";
|
|
2
3
|
|
|
4
|
+
/** @internal */
|
|
3
5
|
export function createAcceptedLlmTurn(
|
|
4
6
|
ctx: AppContext | null,
|
|
5
7
|
input: Parameters<AppContext["deps"]["turnRecords"]["create"]>[0] & {
|
|
8
|
+
/** @internal */
|
|
6
9
|
id: string;
|
|
10
|
+
/** @internal */
|
|
7
11
|
turnType: "llm";
|
|
8
12
|
},
|
|
9
13
|
options: Parameters<typeof createAcceptedLlmTurnStart>[3] & {
|
|
14
|
+
/** @internal */
|
|
10
15
|
current?: boolean;
|
|
16
|
+
/** @internal */
|
|
11
17
|
workerId?: string;
|
|
12
18
|
} = {},
|
|
13
19
|
) {
|
|
@@ -36,14 +42,37 @@ export function createAcceptedLlmTurn(
|
|
|
36
42
|
return record;
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
/** @internal */
|
|
39
46
|
export function createAcceptedLlmTurnStart(
|
|
40
47
|
ctx: AppContext,
|
|
41
|
-
input: {
|
|
48
|
+
input: {
|
|
49
|
+
/** @internal */
|
|
50
|
+
id: string;
|
|
51
|
+
/** @internal */
|
|
52
|
+
instanceId: string;
|
|
53
|
+
/** @internal */
|
|
54
|
+
turnId: string;
|
|
55
|
+
},
|
|
42
56
|
acceptedWorkerLeaseId: string,
|
|
43
57
|
options: {
|
|
58
|
+
/** @internal */
|
|
44
59
|
id?: string;
|
|
45
|
-
|
|
60
|
+
/** @internal */
|
|
61
|
+
preparedStart?: Extract<ResolvedTurnStart, { kind: "llm" }>;
|
|
62
|
+
/** @internal */
|
|
63
|
+
model?: {
|
|
64
|
+
/** @internal */
|
|
65
|
+
profileId: string;
|
|
66
|
+
/** @internal */
|
|
67
|
+
providerId: string;
|
|
68
|
+
/** @internal */
|
|
69
|
+
modelId: string;
|
|
70
|
+
/** @internal */
|
|
71
|
+
thinkingLevel: "off";
|
|
72
|
+
};
|
|
73
|
+
/** @internal */
|
|
46
74
|
piResourceSnapshotDigest?: string;
|
|
75
|
+
/** @internal */
|
|
47
76
|
workerRuntimeProfileId?: string;
|
|
48
77
|
} = {},
|
|
49
78
|
) {
|
|
@@ -58,7 +87,7 @@ export function createAcceptedLlmTurnStart(
|
|
|
58
87
|
continuation: null,
|
|
59
88
|
state: {
|
|
60
89
|
kind: "accepted",
|
|
61
|
-
start: {
|
|
90
|
+
start: options.preparedStart ?? {
|
|
62
91
|
kind: "llm",
|
|
63
92
|
model: options.model ?? {
|
|
64
93
|
profileId: "fixture-profile",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ProcessInstance, ResolvedTurnStart } from "@leitwerk-dev/domain";
|
|
2
|
+
import type { ExtensionCatalog } from "@leitwerk-dev/extension-runtime";
|
|
3
|
+
import type { PiResourceBundle } from "@leitwerk-dev/worker-protocol";
|
|
4
|
+
import type { AppContext } from "../app.js";
|
|
5
|
+
import { createPiResourceBundleCache } from "../pi-resources/index.js";
|
|
6
|
+
import { prepareCreatedTurnStarts } from "../process-engine/turn-start-preflight.js";
|
|
7
|
+
import { createWrites, type TurnStartWrite } from "../process-engine/writes/writes.js";
|
|
8
|
+
|
|
9
|
+
/** Prepare fixture resources through the same provider preflight as admitted work. @internal */
|
|
10
|
+
export async function prepareAcceptedFixtureStart(
|
|
11
|
+
ctx: AppContext,
|
|
12
|
+
process: ProcessInstance,
|
|
13
|
+
turnId: string,
|
|
14
|
+
contributions: ExtensionCatalog["piContributions"],
|
|
15
|
+
): Promise<{
|
|
16
|
+
/** @internal */
|
|
17
|
+
start: Extract<ResolvedTurnStart, { kind: "llm" }>;
|
|
18
|
+
/** @internal */
|
|
19
|
+
bundle: PiResourceBundle;
|
|
20
|
+
}> {
|
|
21
|
+
const profileId =
|
|
22
|
+
process.selectedTurnModelProfileId ??
|
|
23
|
+
process.defaultModelProfileId ??
|
|
24
|
+
ctx.config.process_configs?.[process.processId]?.default_model_profile;
|
|
25
|
+
const write: Extract<TurnStartWrite, { kind: "create" }> = {
|
|
26
|
+
kind: "create",
|
|
27
|
+
input: {
|
|
28
|
+
instanceId: process.id,
|
|
29
|
+
turnId,
|
|
30
|
+
turnType: "llm",
|
|
31
|
+
proposedTurnRecordId: "fixture-preflight",
|
|
32
|
+
startKind: "selected_turn",
|
|
33
|
+
recoveryTurnRecordId: null,
|
|
34
|
+
continuation: null,
|
|
35
|
+
state: {
|
|
36
|
+
kind: "preparation_failed",
|
|
37
|
+
requestedModelProfileId: profileId ?? null,
|
|
38
|
+
providerOptions: {},
|
|
39
|
+
code: "model_required",
|
|
40
|
+
safeSummary: "Fixture preparation",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const writes = createWrites({ turnStartWrites: [write] });
|
|
45
|
+
const bundleCache = createPiResourceBundleCache();
|
|
46
|
+
const result = await prepareCreatedTurnStarts(
|
|
47
|
+
{
|
|
48
|
+
config: ctx.config,
|
|
49
|
+
registry: ctx.modelProviderRegistry,
|
|
50
|
+
modelStatusCache: ctx.modelStatusCache,
|
|
51
|
+
piContributions: contributions,
|
|
52
|
+
bundleCache,
|
|
53
|
+
projects: ctx.deps.projects,
|
|
54
|
+
processSkills: ctx.deps.processSkills,
|
|
55
|
+
},
|
|
56
|
+
{ ...process, selectedTurnId: turnId, selectedTurnModelProfileId: profileId ?? null },
|
|
57
|
+
writes,
|
|
58
|
+
);
|
|
59
|
+
if (!result.ok) throw new Error(`Cannot prepare accepted fixture: ${result.message}`);
|
|
60
|
+
const state = write.input.state;
|
|
61
|
+
if (state.kind !== "starting" || state.start.kind !== "llm") {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Cannot prepare accepted fixture: ${state.kind === "preparation_failed" ? state.safeSummary : state.kind}`,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const bundle = bundleCache.get(state.start.piResourceSnapshotDigest);
|
|
67
|
+
if (!bundle) throw new Error("Prepared fixture resource bundle is missing");
|
|
68
|
+
return {
|
|
69
|
+
/** @internal */
|
|
70
|
+
start: state.start,
|
|
71
|
+
/** @internal */
|
|
72
|
+
bundle,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -3,7 +3,7 @@ import { createAllRepos } from "../db/repositories.js";
|
|
|
3
3
|
import { createFileBackedProcessSessionSnapshotStore } from "../process-session-store.js";
|
|
4
4
|
import { createProjectedSessionSnapshotStore } from "../session-summary-projection.js";
|
|
5
5
|
|
|
6
|
-
/** Accept fixture snapshots through the same persisted projection as worker uploads. */
|
|
6
|
+
/** Accept fixture snapshots through the same persisted projection as worker uploads. @internal */
|
|
7
7
|
export async function writeProcessSessionSnapshot(
|
|
8
8
|
ctx: Pick<AppContext, "db" | "config">,
|
|
9
9
|
instanceId: string,
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import type { ProcessEngineDeps } from "../process-engine/types.js";
|
|
2
2
|
|
|
3
|
+
/** @internal */
|
|
3
4
|
export interface SuccessfulLlmTurnStartOptions {
|
|
5
|
+
/** @internal */
|
|
4
6
|
profileId?: string;
|
|
7
|
+
/** @internal */
|
|
5
8
|
providerId?: string;
|
|
9
|
+
/** @internal */
|
|
6
10
|
modelId?: string;
|
|
11
|
+
/** @internal */
|
|
7
12
|
thinkingLevel?: string;
|
|
13
|
+
/** @internal */
|
|
8
14
|
piResourceSnapshotDigest?: string;
|
|
15
|
+
/** @internal */
|
|
9
16
|
workerRuntimeProfileId?: string;
|
|
10
17
|
}
|
|
11
18
|
|
|
12
|
-
/** Creates a preflight double that successfully prepares every new LLM turn start. */
|
|
19
|
+
/** Creates a preflight double that successfully prepares every new LLM turn start. @internal */
|
|
13
20
|
export function prepareSuccessfulLlmTurnStarts(
|
|
14
21
|
options: SuccessfulLlmTurnStartOptions = {},
|
|
15
22
|
): NonNullable<ProcessEngineDeps["prepareTurnStarts"]> {
|
|
@@ -10,11 +10,17 @@ import {
|
|
|
10
10
|
import { type Broadcaster, createBroadcaster } from "../ws/broadcast.js";
|
|
11
11
|
import { createDefaultTestProcessGraphRegistry } from "./process-fixtures.js";
|
|
12
12
|
|
|
13
|
+
/** @internal */
|
|
13
14
|
export interface TestDeps extends RepositoryBundle {
|
|
15
|
+
/** @internal */
|
|
14
16
|
db: LeitwerkDb;
|
|
17
|
+
/** @internal */
|
|
15
18
|
broadcaster: Broadcaster;
|
|
19
|
+
/** @internal */
|
|
16
20
|
processModelPolicy: ServerProcessModelPolicy;
|
|
21
|
+
/** @internal */
|
|
17
22
|
launchPlans: ProcessLaunchPlanServiceLike;
|
|
23
|
+
/** @internal */
|
|
18
24
|
getModelAvailabilitySnapshot: () => ModelStatusCacheSnapshot;
|
|
19
25
|
}
|
|
20
26
|
|
|
@@ -38,7 +44,13 @@ export function createSelectedTurnStart(
|
|
|
38
44
|
return record;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
/** @internal */
|
|
48
|
+
export function createTestDeps(
|
|
49
|
+
options: {
|
|
50
|
+
/** @internal */
|
|
51
|
+
sqlitePath?: string;
|
|
52
|
+
} = {},
|
|
53
|
+
): TestDeps {
|
|
42
54
|
const db = options.sqlitePath
|
|
43
55
|
? createDatabase({ sqlitePath: options.sqlitePath, enableWAL: false })
|
|
44
56
|
: createInMemoryDatabase();
|
package/src/testing.ts
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
export type { ReadonlyPiSessionTree } from "./pi-session-tree.js";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
buildTurnTracePreview,
|
|
7
|
-
} from "./process-turn-trace.js";
|
|
8
|
-
export {
|
|
9
|
-
buildCurrentProcessError,
|
|
10
|
-
buildCurrentTurnRecovery,
|
|
11
|
-
buildExternalTriggerSignals,
|
|
12
|
-
buildProcessUiSnapshotProjections,
|
|
13
|
-
buildUsageEstimate,
|
|
14
|
-
presentProcessTimelineTurns,
|
|
15
|
-
} from "./process-ui-snapshot-presenter.js";
|
|
16
|
-
export {
|
|
17
|
-
createAcceptedLlmTurn,
|
|
18
|
-
createAcceptedLlmTurnStart,
|
|
19
|
-
} from "./test-helpers/accepted-turn-start.js";
|
|
2
|
+
export { buildTurnTraceIndexFromSession } from "./process-turn-trace.js";
|
|
3
|
+
export { buildProcessUiSnapshotProjections } from "./process-ui-snapshot-presenter.js";
|
|
4
|
+
export { createAcceptedLlmTurn } from "./test-helpers/accepted-turn-start.js";
|
|
5
|
+
export { prepareAcceptedFixtureStart } from "./test-helpers/prepared-fixture-start.js";
|
|
20
6
|
export { writeProcessSessionSnapshot } from "./test-helpers/session-snapshot-fixtures.js";
|
|
21
|
-
export {
|
|
22
|
-
prepareSuccessfulLlmTurnStarts,
|
|
23
|
-
type SuccessfulLlmTurnStartOptions,
|
|
24
|
-
} from "./test-helpers/turn-start-preflight-fixtures.js";
|
|
25
|
-
export { createTestDeps, type TestDeps } from "./test-helpers/unit-deps.js";
|
|
7
|
+
export { createTestDeps } from "./test-helpers/unit-deps.js";
|
|
@@ -6,11 +6,24 @@ import type {
|
|
|
6
6
|
import type { RepositoryBundle } from "./db/repositories.js";
|
|
7
7
|
import type { ProcessOperationCoordinator } from "./process-operation-coordinator.js";
|
|
8
8
|
|
|
9
|
+
/** @internal */
|
|
9
10
|
export type ToolApprovalDecision =
|
|
10
|
-
| {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
| {
|
|
12
|
+
/** @internal */
|
|
13
|
+
kind: "accepted";
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
/** @internal */
|
|
17
|
+
kind: "feedback";
|
|
18
|
+
/** @internal */
|
|
19
|
+
feedback: string;
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
/** @internal */
|
|
23
|
+
kind: "declined";
|
|
24
|
+
};
|
|
13
25
|
|
|
26
|
+
/** @internal */
|
|
14
27
|
type ToolApprovalRepos = Pick<
|
|
15
28
|
RepositoryBundle,
|
|
16
29
|
"processes" | "turnRecords" | "turnStarts" | "toolApprovalRequests" | "transaction"
|
|
@@ -43,11 +56,15 @@ function resolvedDecision(request: ProcessToolApprovalRequest): ToolApprovalDeci
|
|
|
43
56
|
return { kind: "declined" };
|
|
44
57
|
}
|
|
45
58
|
|
|
59
|
+
/** @internal */
|
|
46
60
|
export function createToolApprovalGate(input: {
|
|
61
|
+
/** @internal */
|
|
47
62
|
repos: ToolApprovalRepos;
|
|
63
|
+
/** @internal */
|
|
48
64
|
processOperations: ProcessOperationCoordinator;
|
|
49
65
|
}) {
|
|
50
66
|
const waiters = new Map<string, Set<(decision: ToolApprovalDecision) => void>>();
|
|
67
|
+
/** @internal */
|
|
51
68
|
function reconcile(instanceId: string): void {
|
|
52
69
|
for (const request of input.repos.toolApprovalRequests.listByInstance(instanceId)) {
|
|
53
70
|
const decision = resolvedDecision(request);
|
|
@@ -57,13 +74,21 @@ export function createToolApprovalGate(input: {
|
|
|
57
74
|
}
|
|
58
75
|
}
|
|
59
76
|
return {
|
|
77
|
+
/** @internal */
|
|
60
78
|
reconcile,
|
|
79
|
+
/** @internal */
|
|
61
80
|
async review(requestInput: {
|
|
81
|
+
/** @internal */
|
|
62
82
|
instanceId: string;
|
|
83
|
+
/** @internal */
|
|
63
84
|
turnRecordId: string;
|
|
85
|
+
/** @internal */
|
|
64
86
|
toolCallId: string;
|
|
87
|
+
/** @internal */
|
|
65
88
|
toolName: string;
|
|
89
|
+
/** @internal */
|
|
66
90
|
arguments: Record<string, unknown>;
|
|
91
|
+
/** @internal */
|
|
67
92
|
destination?: ProcessToolApprovalDestination;
|
|
68
93
|
}): Promise<ToolApprovalDecision> {
|
|
69
94
|
if (!isCurrentTurn(input.repos, requestInput)) return { kind: "declined" };
|
|
@@ -76,9 +101,11 @@ export function createToolApprovalGate(input: {
|
|
|
76
101
|
waiters.set(result.request.id, pending);
|
|
77
102
|
});
|
|
78
103
|
},
|
|
104
|
+
/** @internal */
|
|
79
105
|
listOpen(instanceId?: string): ProcessToolApprovalRequest[] {
|
|
80
106
|
return input.repos.toolApprovalRequests.listOpen(instanceId);
|
|
81
107
|
},
|
|
108
|
+
/** @internal */
|
|
82
109
|
async resolve(
|
|
83
110
|
instanceId: string,
|
|
84
111
|
requestId: string,
|
|
@@ -106,6 +133,7 @@ export function createToolApprovalGate(input: {
|
|
|
106
133
|
reconcile(instanceId);
|
|
107
134
|
return resolved;
|
|
108
135
|
},
|
|
136
|
+
/** @internal */
|
|
109
137
|
cancelTurn(instanceId: string, turnRecordId: string): number {
|
|
110
138
|
const changed = input.repos.toolApprovalRequests.cancelOpenByTurn(instanceId, turnRecordId);
|
|
111
139
|
reconcile(instanceId);
|
|
@@ -113,4 +141,5 @@ export function createToolApprovalGate(input: {
|
|
|
113
141
|
},
|
|
114
142
|
};
|
|
115
143
|
}
|
|
144
|
+
/** @internal */
|
|
116
145
|
export type ToolApprovalGate = ReturnType<typeof createToolApprovalGate>;
|
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
type TurnStartRecord,
|
|
10
10
|
} from "@leitwerk-dev/domain";
|
|
11
11
|
|
|
12
|
+
/** @internal */
|
|
12
13
|
export interface TurnRecordMarkdownLookup {
|
|
14
|
+
/** @internal */
|
|
13
15
|
getById(
|
|
14
16
|
id: string,
|
|
15
17
|
): Pick<ProcessTurnRecord, "instanceId" | "resultPiEntryId" | "turnResultMarkdown"> | null;
|
|
@@ -5,30 +5,44 @@ import type { LeitwerkConfig, WorkerRuntimeProfileConfig } from "./config/config
|
|
|
5
5
|
* Per-component runtime profile selection input. `profile` is the component's
|
|
6
6
|
* configured `worker_runtime_profile`, or `undefined` when it declares none.
|
|
7
7
|
*/
|
|
8
|
+
/** @internal */
|
|
8
9
|
export interface ComponentRuntimeProfileSelection {
|
|
10
|
+
/** @internal */
|
|
9
11
|
component: string;
|
|
12
|
+
/** @internal */
|
|
10
13
|
profile?: string;
|
|
11
14
|
}
|
|
12
15
|
|
|
16
|
+
/** @internal */
|
|
13
17
|
export interface RuntimeProfileSelectionInput {
|
|
18
|
+
/** @internal */
|
|
14
19
|
processId: string;
|
|
15
|
-
/** `process_configs.<processId>.worker_runtime_profile`, if set. */
|
|
20
|
+
/** `process_configs.<processId>.worker_runtime_profile`, if set. @internal */
|
|
16
21
|
processOverride?: string;
|
|
17
|
-
/** Per-component profile selections for the process's projects. */
|
|
22
|
+
/** Per-component profile selections for the process's projects. @internal */
|
|
18
23
|
componentProfiles: ComponentRuntimeProfileSelection[];
|
|
19
|
-
/** Runner-specific default profile (`kubernetes.default_worker_runtime_profile` wins in Kubernetes mode). */
|
|
24
|
+
/** Runner-specific default profile (`kubernetes.default_worker_runtime_profile` wins in Kubernetes mode). @internal */
|
|
20
25
|
defaultProfile?: string;
|
|
21
|
-
/** Configured `worker_runtime_profiles` keyed by id. */
|
|
26
|
+
/** Configured `worker_runtime_profiles` keyed by id. @internal */
|
|
22
27
|
profiles: Record<string, WorkerRuntimeProfileConfig>;
|
|
23
28
|
}
|
|
24
29
|
|
|
30
|
+
/** @internal */
|
|
25
31
|
export type RuntimeProfileSelectionResult =
|
|
26
32
|
| {
|
|
33
|
+
/** @internal */
|
|
27
34
|
ok: true;
|
|
35
|
+
/** @internal */
|
|
28
36
|
runtimeProfile: string;
|
|
37
|
+
/** @internal */
|
|
29
38
|
image: ResolvedWorkerImage;
|
|
30
39
|
}
|
|
31
|
-
| {
|
|
40
|
+
| {
|
|
41
|
+
/** @internal */
|
|
42
|
+
ok: false;
|
|
43
|
+
/** @internal */
|
|
44
|
+
error: string;
|
|
45
|
+
};
|
|
32
46
|
|
|
33
47
|
function trimToUndefined(value: string | undefined): string | undefined {
|
|
34
48
|
if (typeof value !== "string") {
|
|
@@ -65,6 +79,7 @@ export function defaultWorkerRuntimeProfile(config: LeitwerkConfig): string | nu
|
|
|
65
79
|
* Repository branch content never reaches this function; image authority lives
|
|
66
80
|
* entirely in leitwerk config.
|
|
67
81
|
*/
|
|
82
|
+
/** @internal */
|
|
68
83
|
export function selectWorkerRuntimeProfile(
|
|
69
84
|
input: RuntimeProfileSelectionInput,
|
|
70
85
|
): RuntimeProfileSelectionResult {
|
|
@@ -128,9 +143,13 @@ function resolveProfileImage(
|
|
|
128
143
|
* Builds {@link RuntimeProfileSelectionInput} from leitwerk config for a
|
|
129
144
|
* process and the components it spans.
|
|
130
145
|
*/
|
|
146
|
+
/** @internal */
|
|
131
147
|
export function buildRuntimeProfileSelectionInput(args: {
|
|
148
|
+
/** @internal */
|
|
132
149
|
config: LeitwerkConfig;
|
|
150
|
+
/** @internal */
|
|
133
151
|
processId: string;
|
|
152
|
+
/** @internal */
|
|
134
153
|
componentKeys: string[];
|
|
135
154
|
}): RuntimeProfileSelectionInput {
|
|
136
155
|
const { config, processId, componentKeys } = args;
|
package/src/ws/broadcast.ts
CHANGED
|
@@ -10,22 +10,29 @@ import {
|
|
|
10
10
|
type WsPayloadByType,
|
|
11
11
|
} from "@leitwerk-dev/protocol";
|
|
12
12
|
|
|
13
|
+
/** @internal */
|
|
13
14
|
export interface WsClientLike {
|
|
15
|
+
/** @internal */
|
|
14
16
|
readyState: number;
|
|
17
|
+
/** @internal */
|
|
15
18
|
send(data: string): void;
|
|
19
|
+
/** @internal */
|
|
16
20
|
on(event: string, handler: () => void): void;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
export type { WsDurability, WsFrame };
|
|
20
24
|
|
|
25
|
+
/** @internal */
|
|
21
26
|
export function createBroadcaster() {
|
|
22
27
|
const clients = new Set<WsClientLike>();
|
|
23
28
|
|
|
29
|
+
/** @internal */
|
|
24
30
|
function addClient(ws: WsClientLike) {
|
|
25
31
|
clients.add(ws);
|
|
26
32
|
ws.on("close", () => clients.delete(ws));
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
/** @internal */
|
|
29
36
|
function broadcast(frame: WsFrame) {
|
|
30
37
|
const data = JSON.stringify(frame);
|
|
31
38
|
for (const client of clients) {
|
|
@@ -35,6 +42,7 @@ export function createBroadcaster() {
|
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
|
|
45
|
+
/** @internal */
|
|
38
46
|
function sendDurable<T extends KnownDurableWsFrameType>(
|
|
39
47
|
type: T,
|
|
40
48
|
payload: WsPayloadByType[T],
|
|
@@ -48,6 +56,7 @@ export function createBroadcaster() {
|
|
|
48
56
|
broadcast(frame);
|
|
49
57
|
}
|
|
50
58
|
|
|
59
|
+
/** @internal */
|
|
51
60
|
function sendEphemeral<T extends KnownEphemeralWsFrameType>(
|
|
52
61
|
type: T,
|
|
53
62
|
payload: WsPayloadByType[T],
|
|
@@ -61,7 +70,17 @@ export function createBroadcaster() {
|
|
|
61
70
|
broadcast(frame);
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
return {
|
|
73
|
+
return {
|
|
74
|
+
/** @internal */
|
|
75
|
+
addClient,
|
|
76
|
+
/** @internal */
|
|
77
|
+
broadcast,
|
|
78
|
+
/** @internal */
|
|
79
|
+
sendDurable,
|
|
80
|
+
/** @internal */
|
|
81
|
+
sendEphemeral,
|
|
82
|
+
};
|
|
65
83
|
}
|
|
66
84
|
|
|
85
|
+
/** @internal */
|
|
67
86
|
export type Broadcaster = ReturnType<typeof createBroadcaster>;
|