@atolis-hq/wake 0.4.2 → 0.4.7
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/README.md +9 -0
- package/dist/src/activities/agent/agent-activity-definition.d.ts +9 -0
- package/dist/src/activities/agent/agent-activity.d.ts +51 -0
- package/dist/src/activities/agent/agent-result.d.ts +43 -0
- package/dist/src/activities/contracts/activity.d.ts +184 -0
- package/dist/src/activities/contracts/config.d.ts +3 -0
- package/dist/src/activities/contracts/decision-claim-schema.d.ts +35 -0
- package/dist/src/activities/contracts/decision-claim-schema.js +42 -0
- package/dist/src/activities/contracts/event-factory.d.ts +6 -0
- package/dist/src/activities/contracts/event-factory.js +40 -0
- package/dist/src/activities/contracts/event-integrity.d.ts +61 -0
- package/dist/src/activities/contracts/event-integrity.js +50 -0
- package/dist/src/activities/contracts/event-schema.d.ts +2803 -0
- package/dist/src/activities/contracts/event-schema.js +67 -121
- package/dist/src/activities/contracts/events.d.ts +153 -0
- package/dist/src/activities/contracts/events.js +4 -4
- package/dist/src/activities/contracts/identifiers.d.ts +5 -0
- package/dist/src/activities/contracts/registry.d.ts +19 -0
- package/dist/src/activities/contracts/streams.d.ts +13 -0
- package/dist/src/activities/contracts/vocabulary.d.ts +69 -0
- package/dist/src/activities/index.d.ts +23 -0
- package/dist/src/activities/index.js +1 -0
- package/dist/src/activities/issue/complete.d.ts +26 -0
- package/dist/src/activities/issue/complete.js +5 -5
- package/dist/src/activities/pr/activity-support.d.ts +38 -0
- package/dist/src/activities/pr/activity-support.js +1 -1
- package/dist/src/activities/pr/application.d.ts +17 -0
- package/dist/src/activities/pr/application.js +6 -6
- package/dist/src/activities/pr/approve.d.ts +7 -0
- package/dist/src/activities/pr/approve.js +8 -3
- package/dist/src/activities/pr/capability.d.ts +2 -0
- package/dist/src/activities/pr/contracts.d.ts +133 -0
- package/dist/src/activities/pr/decision-claim.d.ts +26 -0
- package/dist/src/activities/pr/decision-claim.js +50 -30
- package/dist/src/activities/pr/event-data.d.ts +21 -0
- package/dist/src/activities/pr/event-data.js +101 -0
- package/dist/src/activities/pr/intent.d.ts +12 -0
- package/dist/src/activities/pr/intent.js +5 -5
- package/dist/src/activities/pr/merge-authority-gate.d.ts +13 -0
- package/dist/src/activities/pr/merge-authority-gate.js +1 -1
- package/dist/src/activities/pr/merge.d.ts +7 -0
- package/dist/src/activities/pr/merge.js +8 -3
- package/dist/src/activities/pr/policy.d.ts +13 -0
- package/dist/src/activities/pr/projection.d.ts +5 -0
- package/dist/src/activities/pr/projection.js +18 -17
- package/dist/src/activities/pr/vocabulary.d.ts +34 -0
- package/dist/src/activities/review/authorization.d.ts +9 -0
- package/dist/src/activities/review/contracts.d.ts +46 -0
- package/dist/src/activities/review/signals.d.ts +2 -0
- package/dist/src/bootstrap/activation-scheduler-serialiser.d.ts +3 -0
- package/dist/src/bootstrap/activation-scheduler-serialiser.js +8 -0
- package/dist/src/bootstrap/activity-registry.d.ts +4 -0
- package/dist/src/bootstrap/analytics-projection.d.ts +12 -0
- package/dist/src/bootstrap/analytics-projection.js +3 -3
- package/dist/src/bootstrap/board-projection.d.ts +56 -0
- package/dist/src/bootstrap/board-projection.js +156 -71
- package/dist/src/bootstrap/composition-root.d.ts +76 -0
- package/dist/src/bootstrap/composition-root.js +20 -13
- package/dist/src/bootstrap/config/load-config.d.ts +6 -0
- package/dist/src/bootstrap/config/root-schema.d.ts +443 -0
- package/dist/src/bootstrap/event-processor-runtime.d.ts +22 -0
- package/dist/src/bootstrap/event-processor-runtime.js +88 -0
- package/dist/src/bootstrap/external-ref.d.ts +3 -0
- package/dist/src/bootstrap/fake-provider-files.d.ts +3 -0
- package/dist/src/bootstrap/fake-scenarios.d.ts +3 -0
- package/dist/src/bootstrap/index.d.ts +27 -0
- package/dist/src/bootstrap/index.js +2 -28
- package/dist/src/bootstrap/initialise.d.ts +4 -0
- package/dist/src/bootstrap/initialise.js +8 -16
- package/dist/src/bootstrap/integration-runtime.d.ts +48 -0
- package/dist/src/bootstrap/integration-runtime.js +36 -54
- package/dist/src/bootstrap/paths.d.ts +12 -0
- package/dist/src/bootstrap/persistence-composition.d.ts +21 -0
- package/dist/src/bootstrap/persistence-composition.js +12 -4
- package/dist/src/bootstrap/projection-runtime.d.ts +16 -0
- package/dist/src/bootstrap/projection-runtime.js +50 -23
- package/dist/src/bootstrap/resource-transition-evidence.d.ts +11 -0
- package/dist/src/bootstrap/runner-quota-reporter.d.ts +6 -0
- package/dist/src/bootstrap/runner-quota-reporter.js +16 -11
- package/dist/src/bootstrap/runner-registry.d.ts +3 -0
- package/dist/src/bootstrap/runner-tick-adapter.d.ts +16 -0
- package/dist/src/bootstrap/runner-tick-adapter.js +57 -0
- package/dist/src/bootstrap/schedule-checkpoint-store.d.ts +9 -0
- package/dist/src/bootstrap/self-update-application.d.ts +54 -0
- package/dist/src/bootstrap/self-update-failure-log.d.ts +17 -0
- package/dist/src/bootstrap/source-update-port.d.ts +8 -0
- package/dist/src/bootstrap/status-publish-activity.d.ts +7 -0
- package/dist/src/bootstrap/status-publish-activity.js +4 -5
- package/dist/src/bootstrap/surface-api-applications.d.ts +18 -0
- package/dist/src/bootstrap/surface-api-applications.js +104 -57
- package/dist/src/bootstrap/surface-api-execution-applications.d.ts +3 -0
- package/dist/src/bootstrap/surface-api-execution-applications.js +3 -3
- package/dist/src/bootstrap/surface-api-metadata.d.ts +4 -0
- package/dist/src/bootstrap/surface-api-metadata.js +1 -1
- package/dist/src/bootstrap/surface-api-projection-pages.d.ts +12 -0
- package/dist/src/bootstrap/surface-api-run-context.d.ts +12 -0
- package/dist/src/bootstrap/surface-api-transcripts.d.ts +10 -0
- package/dist/src/bootstrap/surface-api-work-applications.d.ts +3 -0
- package/dist/src/bootstrap/surface-api-work-applications.js +3 -3
- package/dist/src/bootstrap/surface-api-workflow-diagrams.d.ts +11 -0
- package/dist/src/bootstrap/surface-api-workflow-diagrams.js +2 -2
- package/dist/src/bootstrap/surface-applications.d.ts +10 -0
- package/dist/src/bootstrap/surface-cli-applications.d.ts +33 -0
- package/dist/src/bootstrap/surface-cli-applications.js +151 -65
- package/dist/src/bootstrap/transcript-retention.d.ts +11 -0
- package/dist/src/bootstrap/update-ledger.d.ts +9 -0
- package/dist/src/bootstrap/update-maintenance-lease.d.ts +24 -0
- package/dist/src/bootstrap/update-maintenance-lease.js +1 -1
- package/dist/src/bootstrap/version.d.ts +13 -0
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +71 -0
- package/dist/src/control-plane/application/activation-scheduler-subscriber.d.ts +42 -0
- package/dist/src/control-plane/application/activation-scheduler-subscriber.js +111 -0
- package/dist/src/control-plane/application/activation-scheduler.d.ts +8 -0
- package/dist/src/control-plane/application/activation-scheduler.js +165 -0
- package/dist/src/control-plane/application/advance-once-dispatch.d.ts +46 -0
- package/dist/src/control-plane/application/advance-once-dispatch.js +6 -7
- package/dist/src/control-plane/application/advance-once.d.ts +5 -0
- package/dist/src/control-plane/application/advance-once.js +4 -158
- package/dist/src/control-plane/application/control-plane-projection.d.ts +21 -0
- package/dist/src/control-plane/application/control-plane-projection.js +27 -5
- package/dist/src/control-plane/application/control-plane-service.d.ts +12 -0
- package/dist/src/control-plane/application/control-plane-service.js +28 -9
- package/dist/src/control-plane/application/execution-reconciliation.d.ts +21 -0
- package/dist/src/control-plane/application/intake-pipeline.d.ts +18 -0
- package/dist/src/control-plane/application/intake-pipeline.js +8 -18
- package/dist/src/control-plane/application/runner-control-service.d.ts +12 -0
- package/dist/src/control-plane/application/runner-control-service.js +35 -13
- package/dist/src/control-plane/application/runner-pipeline.d.ts +24 -0
- package/dist/src/control-plane/application/runner-pipeline.js +23 -41
- package/dist/src/control-plane/application/schedule-service.d.ts +31 -0
- package/dist/src/control-plane/application/schedule-service.js +1 -1
- package/dist/src/control-plane/application/work-cancellation-policy.d.ts +20 -0
- package/dist/src/control-plane/application/work-cancellation-policy.js +1 -1
- package/dist/src/control-plane/contracts/commands.d.ts +20 -0
- package/dist/src/control-plane/contracts/config.d.ts +30 -0
- package/dist/src/control-plane/contracts/config.js +7 -1
- package/dist/src/control-plane/contracts/event-factory.d.ts +6 -0
- package/dist/src/control-plane/contracts/event-factory.js +14 -0
- package/dist/src/control-plane/contracts/events.d.ts +36 -0
- package/dist/src/control-plane/contracts/events.js +42 -47
- package/dist/src/control-plane/contracts/streams.d.ts +6 -0
- package/dist/src/control-plane/contracts/views.d.ts +28 -0
- package/dist/src/control-plane/domain/dispatch-policy.d.ts +18 -0
- package/dist/src/control-plane/domain/quota-policy.d.ts +21 -0
- package/dist/src/control-plane/domain/runner-quota.d.ts +2 -0
- package/dist/src/control-plane/domain/schedule-policy.d.ts +8 -0
- package/dist/src/control-plane/index.d.ts +24 -0
- package/dist/src/control-plane/index.js +3 -0
- package/dist/src/control-plane/infrastructure/intake-host.d.ts +19 -0
- package/dist/src/control-plane/infrastructure/intake-host.js +2 -3
- package/dist/src/control-plane/infrastructure/resident-host.d.ts +16 -0
- package/dist/src/control-plane/infrastructure/resident-host.js +3 -1
- package/dist/src/control-plane/infrastructure/tick-host.d.ts +6 -0
- package/dist/src/control-plane/infrastructure/tick-host.js +2 -2
- package/dist/src/conversations/application/conversation-projection.d.ts +3 -0
- package/dist/src/conversations/application/conversation-repository.d.ts +13 -0
- package/dist/src/conversations/application/conversation-repository.js +1 -1
- package/dist/src/conversations/application/conversation-service.d.ts +16 -0
- package/dist/src/conversations/application/conversation-service.js +32 -27
- package/dist/src/conversations/contracts/commands.d.ts +33 -0
- package/dist/src/conversations/contracts/event-factory.d.ts +6 -0
- package/dist/src/conversations/contracts/event-factory.js +18 -0
- package/dist/src/conversations/contracts/events.d.ts +42 -0
- package/dist/src/conversations/contracts/events.js +37 -24
- package/dist/src/conversations/contracts/identifiers.d.ts +5 -0
- package/dist/src/conversations/contracts/streams.d.ts +7 -0
- package/dist/src/conversations/contracts/views.d.ts +49 -0
- package/dist/src/conversations/contracts/vocabulary.d.ts +5 -0
- package/dist/src/conversations/domain/conversation.d.ts +4 -0
- package/dist/src/conversations/domain/conversation.js +8 -7
- package/dist/src/conversations/index.d.ts +9 -0
- package/dist/src/conversations/index.js +1 -0
- package/dist/src/execution/application/activation-claim.d.ts +23 -0
- package/dist/src/execution/application/activation-claim.js +8 -9
- package/dist/src/execution/application/active-run-cancellation.d.ts +4 -0
- package/dist/src/execution/application/active-run-cancellation.js +2 -2
- package/dist/src/execution/application/execution-activity.d.ts +61 -0
- package/dist/src/execution/application/execution-activity.js +4 -1
- package/dist/src/execution/application/execution-projection.d.ts +11 -0
- package/dist/src/execution/application/execution-projection.js +8 -4
- package/dist/src/execution/application/execution-service.d.ts +33 -0
- package/dist/src/execution/application/execution-service.js +288 -59
- package/dist/src/execution/application/execution-validation.d.ts +8 -0
- package/dist/src/execution/application/execution-validation.js +3 -2
- package/dist/src/execution/application/recovery-service.d.ts +52 -0
- package/dist/src/execution/application/recovery-service.js +32 -17
- package/dist/src/execution/application/run-lifecycle.d.ts +75 -0
- package/dist/src/execution/application/run-lifecycle.js +130 -62
- package/dist/src/execution/application/run-liveness-service.d.ts +14 -0
- package/dist/src/execution/application/run-liveness-service.js +68 -30
- package/dist/src/execution/application/run-repository.d.ts +18 -0
- package/dist/src/execution/application/run-repository.js +2 -2
- package/dist/src/execution/contracts/commands.d.ts +30 -0
- package/dist/src/execution/contracts/config.d.ts +94 -0
- package/dist/src/execution/contracts/control-plane.d.ts +10 -0
- package/dist/src/execution/contracts/event-factory.d.ts +10 -0
- package/dist/src/execution/contracts/event-factory.js +20 -31
- package/dist/src/execution/contracts/events.d.ts +198 -0
- package/dist/src/execution/contracts/events.js +152 -129
- package/dist/src/execution/contracts/identifiers.d.ts +3 -0
- package/dist/src/execution/contracts/liveness.d.ts +17 -0
- package/dist/src/execution/contracts/results.d.ts +23 -0
- package/dist/src/execution/contracts/runner.d.ts +78 -0
- package/dist/src/execution/contracts/streams.d.ts +12 -0
- package/dist/src/execution/contracts/views.d.ts +42 -0
- package/dist/src/execution/contracts/vocabulary.d.ts +50 -0
- package/dist/src/execution/contracts/vocabulary.js +4 -0
- package/dist/src/execution/contracts/workspace.d.ts +48 -0
- package/dist/src/execution/domain/run-result.d.ts +2 -0
- package/dist/src/execution/domain/run.d.ts +3 -0
- package/dist/src/execution/domain/run.js +72 -22
- package/dist/src/execution/index.d.ts +34 -0
- package/dist/src/execution/infrastructure/agent-runner-adapter.d.ts +2 -0
- package/dist/src/execution/infrastructure/codex-stop-hook.d.ts +13 -0
- package/dist/src/execution/infrastructure/process-execution.d.ts +23 -0
- package/dist/src/execution/infrastructure/prompt-templates.d.ts +15 -0
- package/dist/src/execution/infrastructure/runner-memory-profile.d.ts +11 -0
- package/dist/src/execution/infrastructure/runners/claude.d.ts +34 -0
- package/dist/src/execution/infrastructure/runners/codex.d.ts +13 -0
- package/dist/src/execution/infrastructure/runners/command.d.ts +3 -0
- package/dist/src/execution/infrastructure/runners/cursor.d.ts +12 -0
- package/dist/src/execution/infrastructure/runners/fake-scenarios.d.ts +35 -0
- package/dist/src/execution/infrastructure/runners/fake.d.ts +8 -0
- package/dist/src/execution/infrastructure/runners/registry.d.ts +14 -0
- package/dist/src/execution/infrastructure/transcript-store.d.ts +48 -0
- package/dist/src/execution/infrastructure/transcripts.d.ts +1 -0
- package/dist/src/execution/infrastructure/workspace/fake-workspace.d.ts +36 -0
- package/dist/src/execution/infrastructure/workspace/fake-workspace.js +2 -0
- package/dist/src/execution/infrastructure/workspace/git-workspace.d.ts +29 -0
- package/dist/src/execution/infrastructure/workspace/git-workspace.js +21 -11
- package/dist/src/execution/infrastructure/workspace/prepare-workspace.d.ts +3 -0
- package/dist/src/execution/infrastructure/workspace/prepare-workspace.js +4 -2
- package/dist/src/integrations/application/adapter-health-tracker.d.ts +17 -0
- package/dist/src/integrations/application/agent-run-publication-reactor.d.ts +25 -0
- package/dist/src/integrations/application/agent-run-publication-reactor.js +36 -20
- package/dist/src/integrations/application/artifact-registration-reactor.d.ts +32 -0
- package/dist/src/integrations/application/artifact-registration-reactor.js +43 -35
- package/dist/src/integrations/application/poll-service.d.ts +13 -0
- package/dist/src/integrations/application/poll-service.js +2 -2
- package/dist/src/integrations/application/terminal-agent-run-report.d.ts +33 -0
- package/dist/src/integrations/application/work-admission.d.ts +30 -0
- package/dist/src/integrations/application/work-conclusion.d.ts +13 -0
- package/dist/src/integrations/contracts/artifact-event-factory.d.ts +6 -0
- package/dist/src/integrations/contracts/artifact-event-factory.js +8 -0
- package/dist/src/integrations/contracts/artifact-events.d.ts +31 -0
- package/dist/src/integrations/contracts/artifact-events.js +24 -24
- package/dist/src/integrations/contracts/artifact-vocabulary.d.ts +11 -0
- package/dist/src/integrations/contracts/config.d.ts +13 -0
- package/dist/src/integrations/contracts/identifiers.d.ts +3 -0
- package/dist/src/integrations/contracts/intake-rules.d.ts +15 -0
- package/dist/src/integrations/contracts/intake.d.ts +15 -0
- package/dist/src/integrations/contracts/outcome-vocabulary.d.ts +6 -0
- package/dist/src/integrations/contracts/provider.d.ts +105 -0
- package/dist/src/integrations/contracts/reply-routing.d.ts +31 -0
- package/dist/src/integrations/contracts/streams.d.ts +12 -0
- package/dist/src/integrations/delivery/application/delivery-outcome-reactor.d.ts +24 -0
- package/dist/src/integrations/delivery/application/delivery-outcome-reactor.js +151 -73
- package/dist/src/integrations/delivery/application/delivery-projector.d.ts +5 -0
- package/dist/src/integrations/delivery/application/delivery-projector.js +52 -52
- package/dist/src/integrations/delivery/application/delivery-service.d.ts +40 -0
- package/dist/src/integrations/delivery/application/delivery-service.js +15 -16
- package/dist/src/integrations/delivery/contracts/commands.d.ts +7 -0
- package/dist/src/integrations/delivery/contracts/config.d.ts +25 -0
- package/dist/src/integrations/delivery/contracts/event-factory.d.ts +11 -0
- package/dist/src/integrations/delivery/contracts/event-factory.js +20 -9
- package/dist/src/integrations/delivery/contracts/events.d.ts +46 -0
- package/dist/src/integrations/delivery/contracts/events.js +33 -18
- package/dist/src/integrations/delivery/contracts/intents.d.ts +54 -0
- package/dist/src/integrations/delivery/contracts/intents.js +21 -14
- package/dist/src/integrations/delivery/contracts/views.d.ts +47 -0
- package/dist/src/integrations/delivery/contracts/vocabulary.d.ts +25 -0
- package/dist/src/integrations/fake/durable-delivery-provider.d.ts +29 -0
- package/dist/src/integrations/fake/external-sink.d.ts +5 -0
- package/dist/src/integrations/fake/external-source.d.ts +30 -0
- package/dist/src/integrations/fake/external-source.js +1 -3
- package/dist/src/integrations/fake/inbound-translator.d.ts +16 -0
- package/dist/src/integrations/fake/inbound-translator.js +22 -10
- package/dist/src/integrations/fake/provider.d.ts +38 -0
- package/dist/src/integrations/fake/provider.js +3 -1
- package/dist/src/integrations/github/application/agent-context-reader.d.ts +6 -0
- package/dist/src/integrations/github/application/agent-context-reader.js +10 -7
- package/dist/src/integrations/github/application/agent-run-comment.d.ts +22 -0
- package/dist/src/integrations/github/application/comment-history-reader.d.ts +25 -0
- package/dist/src/integrations/github/application/comment-history-reader.js +36 -32
- package/dist/src/integrations/github/application/delivery-marker.d.ts +2 -0
- package/dist/src/integrations/github/application/inbound-comment-syntax.d.ts +8 -0
- package/dist/src/integrations/github/application/inbound-context.d.ts +3 -0
- package/dist/src/integrations/github/application/inbound-context.js +4 -4
- package/dist/src/integrations/github/application/inbound-review-signals.d.ts +21 -0
- package/dist/src/integrations/github/application/inbound-review-signals.js +30 -25
- package/dist/src/integrations/github/application/inbound-translator.d.ts +103 -0
- package/dist/src/integrations/github/application/inbound-translator.js +149 -160
- package/dist/src/integrations/github/application/inbound-watch-gate-signals.d.ts +10 -0
- package/dist/src/integrations/github/application/inbound-watch-gate-signals.js +4 -4
- package/dist/src/integrations/github/application/intake-policy.d.ts +7 -0
- package/dist/src/integrations/github/application/operator-retry-command.d.ts +1 -0
- package/dist/src/integrations/github/application/outbound-translator.d.ts +19 -0
- package/dist/src/integrations/github/application/poll-service.d.ts +11 -0
- package/dist/src/integrations/github/application/poll-service.js +11 -2
- package/dist/src/integrations/github/application/pull-request-translation.d.ts +5 -0
- package/dist/src/integrations/github/application/reply-target-selector.d.ts +8 -0
- package/dist/src/integrations/github/application/resource-links.d.ts +2 -0
- package/dist/src/integrations/github/application/review-command-translator.d.ts +14 -0
- package/dist/src/integrations/github/application/wake-labels.d.ts +29 -0
- package/dist/src/integrations/github/contracts/check-evidence.d.ts +1 -0
- package/dist/src/integrations/github/contracts/config.d.ts +81 -0
- package/dist/src/integrations/github/contracts/event-factory.d.ts +6 -0
- package/dist/src/integrations/github/contracts/event-factory.js +26 -0
- package/dist/src/integrations/github/contracts/events.d.ts +135 -0
- package/dist/src/integrations/github/contracts/events.js +118 -132
- package/dist/src/integrations/github/contracts/external-key.d.ts +8 -0
- package/dist/src/integrations/github/contracts/issue-query.d.ts +5 -0
- package/dist/src/integrations/github/contracts/payloads.d.ts +74 -0
- package/dist/src/integrations/github/contracts/vocabulary.d.ts +64 -0
- package/dist/src/integrations/github/index.d.ts +34 -0
- package/dist/src/integrations/github/index.js +1 -0
- package/dist/src/integrations/github/infrastructure/adapter-health-registry.d.ts +11 -0
- package/dist/src/integrations/github/infrastructure/bounded-fetch.d.ts +10 -0
- package/dist/src/integrations/github/infrastructure/client-reads.d.ts +255 -0
- package/dist/src/integrations/github/infrastructure/client.d.ts +263 -0
- package/dist/src/integrations/github/infrastructure/comment-source.d.ts +7 -0
- package/dist/src/integrations/github/infrastructure/content-fingerprint.d.ts +2 -0
- package/dist/src/integrations/github/infrastructure/delivery.d.ts +6 -0
- package/dist/src/integrations/github/infrastructure/etag-cache.d.ts +29 -0
- package/dist/src/integrations/github/infrastructure/gh-auth.d.ts +4 -0
- package/dist/src/integrations/github/infrastructure/issue-source.d.ts +20 -0
- package/dist/src/integrations/github/infrastructure/issue-source.js +10 -6
- package/dist/src/integrations/github/infrastructure/poll-watermark.d.ts +12 -0
- package/dist/src/integrations/github/infrastructure/pr-source.d.ts +16 -0
- package/dist/src/integrations/github/infrastructure/pr-source.js +6 -4
- package/dist/src/integrations/github/infrastructure/request-coordinator.d.ts +13 -0
- package/dist/src/integrations/github/infrastructure/review-source.d.ts +10 -0
- package/dist/src/integrations/github/infrastructure/review-source.js +29 -25
- package/dist/src/integrations/github/infrastructure/source-contracts.d.ts +22 -0
- package/dist/src/integrations/github/infrastructure/source.d.ts +12 -0
- package/dist/src/integrations/github/infrastructure/source.js +3 -5
- package/dist/src/integrations/github/provider.d.ts +3 -0
- package/dist/src/integrations/github/provider.js +14 -12
- package/dist/src/integrations/index.d.ts +32 -0
- package/dist/src/integrations/index.js +1 -0
- package/dist/src/kernel/contracts/clock.d.ts +3 -0
- package/dist/src/kernel/contracts/id-generator.d.ts +3 -0
- package/dist/src/kernel/contracts/identifiers.d.ts +7 -0
- package/dist/src/kernel/contracts/identifiers.js +1 -8
- package/dist/src/kernel/contracts/relations.d.ts +14 -0
- package/dist/src/kernel/contracts/schema.d.ts +3 -0
- package/dist/src/kernel/contracts/vocabulary.d.ts +7 -0
- package/dist/src/kernel/domain/match-mode.d.ts +2 -0
- package/dist/src/kernel/domain/relation.d.ts +9 -0
- package/dist/src/kernel/index.d.ts +10 -0
- package/dist/src/kernel/index.js +0 -11
- package/dist/src/kernel/infrastructure/system-clock.d.ts +4 -0
- package/dist/src/kernel/infrastructure/ulid-id-generator.d.ts +4 -0
- package/dist/src/main.d.ts +14 -0
- package/dist/src/node_modules/@atolis-hq/eventing/LICENSE +201 -0
- package/dist/src/node_modules/@atolis-hq/eventing/README.md +41 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/commands.d.ts +9 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/commands.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-envelope.d.ts +13 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-envelope.d.ts.map +1 -0
- package/dist/src/{kernel/domain → node_modules/@atolis-hq/eventing/dist/contracts}/event-envelope.js +4 -4
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-schema.d.ts +83 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-schema.d.ts.map +1 -0
- package/dist/src/{kernel → node_modules/@atolis-hq/eventing/dist}/contracts/event-schema.js +21 -5
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/events.d.ts +46 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/events.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/events.js +10 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/identifiers.d.ts +11 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/identifiers.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/identifiers.js +8 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/processor-state-store.d.ts +11 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/processor-state-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts +19 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/index.js +17 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-checkpoint-store.d.ts +8 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-checkpoint-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-event-journal.d.ts +19 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-event-journal.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-event-journal.js +82 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-run-serialiser.d.ts +6 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-run-serialiser.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-run-serialiser.js +26 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-state-store.d.ts +8 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-state-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-state-store.js +20 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-projection-store.d.ts +9 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-projection-store.d.ts.map +1 -0
- package/dist/src/{persistence → node_modules/@atolis-hq/eventing/dist}/memory/in-memory-projection-store.js +2 -1
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-process-journal-change-signal.d.ts +10 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-process-journal-change-signal.d.ts.map +1 -0
- package/dist/src/{kernel/infrastructure/journal-change-signal.js → node_modules/@atolis-hq/eventing/dist/memory/in-process-journal-change-signal.js} +5 -2
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory.d.ts +7 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/memory.js +6 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts +20 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.js +83 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-store.d.ts +22 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts +8 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.js +24 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/clock.d.ts +4 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/clock.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/event-processor-host.d.ts +39 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/event-processor-host.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/event-processor-host.js +168 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-health.d.ts +43 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-health.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-health.js +66 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-run-serialiser.d.ts +2 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-run-serialiser.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-run-serialiser.js +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-validation.d.ts +7 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-validation.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-validation.js +43 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/store/checkpoint-store.d.ts +6 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/store/checkpoint-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/store/checkpoint-store.js +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/store/event-journal.d.ts +14 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/store/event-journal.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/event-processor.d.ts +49 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/event-processor.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/event-processor.js +17 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/journal-change-signal.d.ts +6 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/journal-change-signal.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/journal-change-signal.js +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing/package.json +42 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/LICENSE +201 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/README.md +40 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/atomic-write.d.ts +23 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/atomic-write.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/atomic-write.js +54 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/event-record-codec.d.ts +4 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/event-record-codec.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/event-record-codec.js +50 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-checkpoint-store.d.ts +17 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-checkpoint-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-checkpoint-store.js +99 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts +51 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts.map +1 -0
- package/dist/src/{persistence/filesystem → node_modules/@atolis-hq/eventing-filesystem/dist}/file-event-journal.js +185 -103
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-lock.d.ts +34 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-lock.d.ts.map +1 -0
- package/dist/src/{persistence/filesystem → node_modules/@atolis-hq/eventing-filesystem/dist}/file-lock.js +10 -1
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.d.ts +9 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.js +82 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-state-store.d.ts +12 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-state-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-state-store.js +127 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-projection-store.d.ts +19 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-projection-store.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-projection-store.js +219 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/index.d.ts +7 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/index.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/index.js +6 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-paths.d.ts +10 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-paths.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-paths.js +27 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-record.d.ts +8 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-record.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-record.js +28 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/storage-name.d.ts +6 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/storage-name.d.ts.map +1 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/storage-name.js +34 -0
- package/dist/src/node_modules/@atolis-hq/eventing-filesystem/package.json +38 -0
- package/dist/src/orchestration/application/accept-activity-outcome.d.ts +18 -0
- package/dist/src/orchestration/application/accept-signal.d.ts +14 -0
- package/dist/src/orchestration/application/advance-workflow.d.ts +50 -0
- package/dist/src/orchestration/application/advance-workflow.js +7 -12
- package/dist/src/orchestration/application/coordination-claims.d.ts +17 -0
- package/dist/src/orchestration/application/coordination-claims.js +17 -20
- package/dist/src/orchestration/application/durable-append.d.ts +17 -0
- package/dist/src/orchestration/application/durable-append.js +1 -1
- package/dist/src/orchestration/application/group-budget-recorder.d.ts +9 -0
- package/dist/src/orchestration/application/group-budget-recorder.js +9 -6
- package/dist/src/orchestration/application/orchestration-projection.d.ts +6 -0
- package/dist/src/orchestration/application/orchestration-projection.js +6 -7
- package/dist/src/orchestration/application/orchestration-repository.d.ts +23 -0
- package/dist/src/orchestration/application/orchestration-repository.js +2 -2
- package/dist/src/orchestration/application/orchestration-service.d.ts +93 -0
- package/dist/src/orchestration/application/orchestration-service.js +10 -1
- package/dist/src/orchestration/application/pull-request-transition-evidence.d.ts +3 -0
- package/dist/src/orchestration/application/pull-request-transition-evidence.js +10 -10
- package/dist/src/orchestration/application/reactor-command-context.d.ts +5 -0
- package/dist/src/orchestration/application/reactor-command-context.js +9 -0
- package/dist/src/orchestration/application/request-child.d.ts +29 -0
- package/dist/src/orchestration/application/request-child.js +26 -10
- package/dist/src/orchestration/application/resource-transition-evidence.d.ts +18 -0
- package/dist/src/orchestration/application/resource-transition-matching.d.ts +19 -0
- package/dist/src/orchestration/application/resource-transition-matching.js +9 -3
- package/dist/src/orchestration/application/resource-transition-reactor.d.ts +16 -0
- package/dist/src/orchestration/application/resource-transition-reactor.js +21 -42
- package/dist/src/orchestration/application/signal-reactor.d.ts +11 -0
- package/dist/src/orchestration/application/start-workflow.d.ts +18 -0
- package/dist/src/orchestration/application/start-workflow.js +3 -4
- package/dist/src/orchestration/application/trigger-workflow-instance.d.ts +12 -0
- package/dist/src/orchestration/application/trigger-workflow-instance.js +1 -1
- package/dist/src/orchestration/application/watch-child-transitions.d.ts +2 -0
- package/dist/src/orchestration/application/watch-matching.d.ts +13 -0
- package/dist/src/orchestration/application/watch-matching.js +3 -3
- package/dist/src/orchestration/application/watch-reactor.d.ts +42 -0
- package/dist/src/orchestration/application/watch-reactor.js +36 -35
- package/dist/src/orchestration/application/workflow-definition-registry.d.ts +32 -0
- package/dist/src/orchestration/application/workflow-definition-registry.js +13 -11
- package/dist/src/orchestration/contracts/activity-outcome.d.ts +15 -0
- package/dist/src/orchestration/contracts/commands.d.ts +30 -0
- package/dist/src/orchestration/contracts/config.d.ts +356 -0
- package/dist/src/orchestration/contracts/event-decoder.d.ts +262 -0
- package/dist/src/orchestration/contracts/event-decoder.js +88 -64
- package/dist/src/orchestration/contracts/event-factory.d.ts +6 -0
- package/dist/src/orchestration/contracts/event-factory.js +64 -0
- package/dist/src/orchestration/contracts/events.d.ts +233 -0
- package/dist/src/orchestration/contracts/identifiers.d.ts +15 -0
- package/dist/src/orchestration/contracts/streams.d.ts +28 -0
- package/dist/src/orchestration/contracts/views.d.ts +68 -0
- package/dist/src/orchestration/contracts/vocabulary.d.ts +34 -0
- package/dist/src/orchestration/domain/activation-policy.d.ts +60 -0
- package/dist/src/orchestration/domain/activation-policy.js +34 -19
- package/dist/src/orchestration/domain/approval-defaults.d.ts +8 -0
- package/dist/src/orchestration/domain/child-policy.d.ts +20 -0
- package/dist/src/orchestration/domain/compiler.d.ts +3 -0
- package/dist/src/orchestration/domain/coordination-events.d.ts +18 -0
- package/dist/src/orchestration/domain/coordination-events.js +25 -11
- package/dist/src/orchestration/domain/decision-events.d.ts +33 -0
- package/dist/src/orchestration/domain/decision-events.js +26 -15
- package/dist/src/orchestration/domain/interpreter.d.ts +14 -0
- package/dist/src/orchestration/domain/interpreter.js +4 -1
- package/dist/src/orchestration/domain/operator-retry-policy.d.ts +14 -0
- package/dist/src/orchestration/domain/operator-retry-policy.js +29 -11
- package/dist/src/orchestration/domain/resource-transition-compiler.d.ts +8 -0
- package/dist/src/orchestration/domain/retry-policy.d.ts +7 -0
- package/dist/src/orchestration/domain/retry-policy.js +7 -4
- package/dist/src/orchestration/domain/runner-quota-retry-policy.d.ts +10 -0
- package/dist/src/orchestration/domain/runner-quota-retry-policy.js +21 -15
- package/dist/src/orchestration/domain/signal-policy.d.ts +11 -0
- package/dist/src/orchestration/domain/signal-policy.js +18 -7
- package/dist/src/orchestration/domain/supplemental-policy.d.ts +11 -0
- package/dist/src/orchestration/domain/supplemental-policy.js +29 -14
- package/dist/src/orchestration/domain/transition.d.ts +16 -0
- package/dist/src/orchestration/domain/transition.js +46 -28
- package/dist/src/orchestration/domain/workflow-graph.d.ts +4 -0
- package/dist/src/orchestration/domain/workflow-instance-events.d.ts +44 -0
- package/dist/src/orchestration/domain/workflow-instance.d.ts +7 -0
- package/dist/src/orchestration/domain/workflow-instance.js +29 -9
- package/dist/src/orchestration/domain/workflow-selector.d.ts +15 -0
- package/dist/src/orchestration/index.d.ts +27 -0
- package/dist/src/orchestration/index.js +1 -0
- package/dist/src/resources/application/lookup-projections.d.ts +6 -0
- package/dist/src/resources/application/lookup-projections.js +15 -15
- package/dist/src/resources/application/resource-correlation-retry.d.ts +16 -0
- package/dist/src/resources/application/resource-correlation-retry.js +39 -44
- package/dist/src/resources/application/resource-event-support.d.ts +12 -0
- package/dist/src/resources/application/resource-event-support.js +17 -0
- package/dist/src/resources/application/resource-lookup.d.ts +17 -0
- package/dist/src/resources/application/resource-lookup.js +9 -9
- package/dist/src/resources/application/resource-projections.d.ts +4 -0
- package/dist/src/resources/application/resource-projections.js +32 -24
- package/dist/src/resources/application/resource-repository.d.ts +16 -0
- package/dist/src/resources/application/resource-repository.js +3 -3
- package/dist/src/resources/application/resource-service.d.ts +34 -0
- package/dist/src/resources/application/resource-service.js +73 -52
- package/dist/src/resources/contracts/commands.d.ts +23 -0
- package/dist/src/resources/contracts/config.d.ts +3 -0
- package/dist/src/resources/contracts/event-factory.d.ts +6 -0
- package/dist/src/resources/contracts/event-factory.js +32 -0
- package/dist/src/resources/contracts/events.d.ts +79 -0
- package/dist/src/resources/contracts/events.js +94 -102
- package/dist/src/resources/contracts/identifiers.d.ts +7 -0
- package/dist/src/resources/contracts/streams.d.ts +8 -0
- package/dist/src/resources/contracts/views.d.ts +35 -0
- package/dist/src/resources/contracts/vocabulary.d.ts +50 -0
- package/dist/src/resources/domain/correlation.d.ts +6 -0
- package/dist/src/resources/domain/resource.d.ts +8 -0
- package/dist/src/resources/domain/resource.js +24 -21
- package/dist/src/resources/index.d.ts +15 -0
- package/dist/src/resources/index.js +1 -0
- package/dist/src/surfaces/api/contracts/activities.d.ts +1 -0
- package/dist/src/surfaces/api/contracts/board.d.ts +46 -0
- package/dist/src/surfaces/api/contracts/board.js +1 -1
- package/dist/src/surfaces/api/contracts/common.d.ts +43 -0
- package/dist/src/surfaces/api/contracts/control-plane.d.ts +37 -0
- package/dist/src/surfaces/api/contracts/events.d.ts +13 -0
- package/dist/src/surfaces/api/contracts/execution.d.ts +67 -0
- package/dist/src/surfaces/api/contracts/index.d.ts +14 -0
- package/dist/src/surfaces/api/contracts/observability.d.ts +10 -0
- package/dist/src/surfaces/api/contracts/orchestration.d.ts +16 -0
- package/dist/src/surfaces/api/contracts/resources.d.ts +10 -0
- package/dist/src/surfaces/api/contracts/status.d.ts +4 -0
- package/dist/src/surfaces/api/contracts/system.d.ts +32 -0
- package/dist/src/surfaces/api/contracts/transport-values.d.ts +50 -0
- package/dist/src/surfaces/api/contracts/transport-values.js +6 -0
- package/dist/src/surfaces/api/contracts/work.d.ts +74 -0
- package/dist/src/surfaces/api/contracts/workflow-diagram.d.ts +64 -0
- package/dist/src/surfaces/api/http-server.d.ts +33 -0
- package/dist/src/surfaces/api/http-server.js +2 -2
- package/dist/src/surfaces/api/presenters/activities.d.ts +1 -0
- package/dist/src/surfaces/api/presenters/board.d.ts +2 -0
- package/dist/src/surfaces/api/presenters/control-plane.d.ts +1 -0
- package/dist/src/surfaces/api/presenters/events.d.ts +1 -0
- package/dist/src/surfaces/api/presenters/execution.d.ts +3 -0
- package/dist/src/surfaces/api/presenters/execution.js +5 -2
- package/dist/src/surfaces/api/presenters/observability.d.ts +1 -0
- package/dist/src/surfaces/api/presenters/orchestration.d.ts +3 -0
- package/dist/src/surfaces/api/presenters/resources.d.ts +3 -0
- package/dist/src/surfaces/api/presenters/status.d.ts +2 -0
- package/dist/src/surfaces/api/presenters/system.d.ts +2 -0
- package/dist/src/surfaces/api/presenters/work.d.ts +4 -0
- package/dist/src/surfaces/api/problem-details.d.ts +2 -0
- package/dist/src/surfaces/api/router.d.ts +8 -0
- package/dist/src/surfaces/api/routes/activities.d.ts +1 -0
- package/dist/src/surfaces/api/routes/applications.d.ts +88 -0
- package/dist/src/surfaces/api/routes/commands.d.ts +3 -0
- package/dist/src/surfaces/api/routes/commands.js +1 -3
- package/dist/src/surfaces/api/routes/control-plane.d.ts +1 -0
- package/dist/src/surfaces/api/routes/control-plane.js +0 -1
- package/dist/src/surfaces/api/routes/events.d.ts +1 -0
- package/dist/src/surfaces/api/routes/execution.d.ts +1 -0
- package/dist/src/surfaces/api/routes/index.d.ts +4 -0
- package/dist/src/surfaces/api/routes/observability.d.ts +1 -0
- package/dist/src/surfaces/api/routes/orchestration.d.ts +1 -0
- package/dist/src/surfaces/api/routes/pagination.d.ts +5 -0
- package/dist/src/surfaces/api/routes/read.d.ts +3 -0
- package/dist/src/surfaces/api/routes/resources.d.ts +1 -0
- package/dist/src/surfaces/api/routes/responses.d.ts +15 -0
- package/dist/src/surfaces/api/routes/system.d.ts +1 -0
- package/dist/src/surfaces/api/routes/work.d.ts +1 -0
- package/dist/src/surfaces/auth/credentials.d.ts +22 -0
- package/dist/src/surfaces/auth/credentials.js +8 -12
- package/dist/src/surfaces/auth/vocabulary.d.ts +9 -0
- package/dist/src/surfaces/cli/commands/api.d.ts +4 -0
- package/dist/src/surfaces/cli/commands/audit.d.ts +16 -0
- package/dist/src/surfaces/cli/commands/audit.js +11 -2
- package/dist/src/surfaces/cli/commands/correlate.d.ts +7 -0
- package/dist/src/surfaces/cli/commands/doctor.d.ts +24 -0
- package/dist/src/surfaces/cli/commands/init.d.ts +2 -0
- package/dist/src/surfaces/cli/commands/sandbox-entrypoint.d.ts +43 -0
- package/dist/src/surfaces/cli/commands/sandbox-setup.d.ts +9 -0
- package/dist/src/surfaces/cli/commands/sandbox.d.ts +16 -0
- package/dist/src/surfaces/cli/commands/self-update.d.ts +15 -0
- package/dist/src/surfaces/cli/commands/smoke.d.ts +14 -0
- package/dist/src/surfaces/cli/commands/start.d.ts +5 -0
- package/dist/src/surfaces/cli/commands/stop.d.ts +11 -0
- package/dist/src/surfaces/cli/commands/tick.d.ts +5 -0
- package/dist/src/surfaces/cli/commands/ui.d.ts +5 -0
- package/dist/src/surfaces/cli/commands/validate-state.d.ts +13 -0
- package/dist/src/surfaces/cli/infrastructure/docker-cli.d.ts +66 -0
- package/dist/src/surfaces/cli/infrastructure/docker-invocation.d.ts +14 -0
- package/dist/src/surfaces/cli/infrastructure/process-log.d.ts +35 -0
- package/dist/src/surfaces/cli/infrastructure/resident-start.d.ts +10 -0
- package/dist/src/surfaces/cli/main.d.ts +115 -0
- package/dist/src/surfaces/cli/usage.d.ts +1 -0
- package/dist/src/surfaces/contracts/config.d.ts +51 -0
- package/dist/src/surfaces/index.d.ts +49 -0
- package/dist/src/surfaces/web-assets/assets/index-D9xGa5tD.css +1 -0
- package/dist/src/surfaces/web-assets/assets/index-qai1Ymhv.js +1179 -0
- package/dist/src/surfaces/web-assets/index.html +2 -2
- package/dist/src/surfaces/web-host/asset-source.d.ts +9 -0
- package/dist/src/surfaces/web-host/packaged-assets.d.ts +8 -0
- package/dist/src/work/application/work-projection.d.ts +3 -0
- package/dist/src/work/application/work-projection.js +4 -4
- package/dist/src/work/application/work-repository.d.ts +15 -0
- package/dist/src/work/application/work-repository.js +2 -2
- package/dist/src/work/application/work-service.d.ts +18 -0
- package/dist/src/work/application/work-service.js +70 -31
- package/dist/src/work/contracts/commands.d.ts +15 -0
- package/dist/src/work/contracts/config.d.ts +3 -0
- package/dist/src/work/contracts/event-factory.d.ts +6 -0
- package/dist/src/work/contracts/event-factory.js +26 -0
- package/dist/src/work/contracts/events.d.ts +46 -0
- package/dist/src/work/contracts/events.js +54 -60
- package/dist/src/work/contracts/identifiers.d.ts +3 -0
- package/dist/src/work/contracts/streams.d.ts +8 -0
- package/dist/src/work/contracts/views.d.ts +18 -0
- package/dist/src/work/contracts/vocabulary.d.ts +7 -0
- package/dist/src/work/domain/work-item.d.ts +3 -0
- package/dist/src/work/domain/work-item.js +10 -7
- package/dist/src/work/index.d.ts +12 -0
- package/dist/src/work/index.js +1 -0
- package/docker/Dockerfile +9 -7
- package/docker/Dockerfile.packaged +4 -6
- package/package.json +24 -24
- package/dist/src/activities/pr/event-drafts.js +0 -66
- package/dist/src/kernel/contracts/events.js +0 -11
- package/dist/src/kernel/infrastructure/cached-journal-view.js +0 -27
- package/dist/src/persistence/application/projection-runner.js +0 -128
- package/dist/src/persistence/filesystem/file-checkpoint-store.js +0 -50
- package/dist/src/persistence/filesystem/file-projection-store.js +0 -137
- package/dist/src/persistence/index.js +0 -8
- package/dist/src/persistence/memory/in-memory-event-journal.js +0 -99
- package/dist/src/surfaces/web-assets/assets/index-B0ofn_L5.css +0 -1
- package/dist/src/surfaces/web-assets/assets/index-DFBhpSSX.js +0 -1179
- /package/dist/src/control-plane/application/{advance-once-ports.js → activation-scheduler-ports.js} +0 -0
- /package/dist/src/{kernel → node_modules/@atolis-hq/eventing/dist}/contracts/commands.js +0 -0
- /package/dist/src/{kernel/contracts/checkpoint-store.js → node_modules/@atolis-hq/eventing/dist/contracts/processor-state-store.js} +0 -0
- /package/dist/src/{persistence → node_modules/@atolis-hq/eventing/dist}/memory/in-memory-checkpoint-store.js +0 -0
- /package/dist/src/{kernel/contracts → node_modules/@atolis-hq/eventing/dist/projections}/projection-store.js +0 -0
- /package/dist/src/{kernel/contracts/journal-change-signal.js → node_modules/@atolis-hq/eventing/dist/runtime/clock.js} +0 -0
- /package/dist/src/{kernel/contracts → node_modules/@atolis-hq/eventing/dist/store}/event-journal.js +0 -0
|
@@ -1,95 +1,96 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decodeEventEnvelope, WrongExpectedSequenceError } from '@atolis-hq/eventing';
|
|
2
|
+
import { InProcessJournalChangeSignal } from '@atolis-hq/eventing/memory';
|
|
3
|
+
import { watch } from 'node:fs';
|
|
4
|
+
import { mkdir, open, readdir, readFile, rm, stat } from 'node:fs/promises';
|
|
2
5
|
import { join } from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
6
|
+
import { performance } from 'node:perf_hooks';
|
|
7
|
+
import { writeFileAtomically } from './atomic-write.js';
|
|
8
|
+
import { decodeEventRecord, encodeEventRecord } from './event-record-codec.js';
|
|
5
9
|
import { withFileLock } from './file-lock.js';
|
|
10
|
+
const createFileSystemWatcher = async (directory, notify) => watch(directory, { persistent: false }, notify);
|
|
11
|
+
const entryValidationTtlMs = 30_000;
|
|
6
12
|
export class FileEventJournal {
|
|
7
13
|
root;
|
|
8
14
|
clock;
|
|
9
|
-
|
|
15
|
+
options;
|
|
16
|
+
validationNow;
|
|
17
|
+
constructor(root, clock, options = {}) {
|
|
10
18
|
this.root = root;
|
|
11
19
|
this.clock = clock;
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.validationNow = options.validationNow ?? (() => performance.now());
|
|
12
22
|
}
|
|
13
23
|
changeSignalSource = new InProcessJournalChangeSignal();
|
|
24
|
+
changeWatcher;
|
|
25
|
+
startingChangeWatcher;
|
|
14
26
|
get changeSignal() {
|
|
15
27
|
return this.changeSignalSource;
|
|
16
28
|
}
|
|
17
29
|
cached;
|
|
18
|
-
// The manifest is written after every successful local append. Its file
|
|
19
|
-
// revision is therefore a constant-cost freshness signal for the warm
|
|
20
|
-
// cache, avoiding a stat of every historical segment on every read while
|
|
21
|
-
// still detecting an append made by another journal process immediately.
|
|
22
|
-
manifestRevision;
|
|
23
30
|
// Every read (readStream/readAll/readLatest/latestGlobalPosition) reaches
|
|
24
31
|
// scan(), and the resident host's tick loop calls those many times a
|
|
25
32
|
// second while work is progressing. Without coalescing, calls that land
|
|
26
33
|
// concurrently each independently decide the cache is stale and each
|
|
27
34
|
// re-read and re-parse the entire on-disk journal — under I/O pressure
|
|
28
35
|
// (e.g. a concurrently running build/test process competing for disk),
|
|
29
|
-
// enough of these can overlap at once to exhaust the heap. Sharing
|
|
30
|
-
//
|
|
36
|
+
// enough of these can overlap at once to exhaust the heap. Sharing a decode
|
|
37
|
+
// only for the same segment fingerprints keeps that protection without
|
|
38
|
+
// letting an append reuse a scan from before another process wrote.
|
|
31
39
|
inFlightScan;
|
|
32
|
-
|
|
40
|
+
scanGeneration = 0;
|
|
41
|
+
validatedEntries;
|
|
42
|
+
inFlightEntryRefresh;
|
|
43
|
+
entryValidationGeneration = 0;
|
|
44
|
+
async appendToStream(stream, expectedSequence, drafts) {
|
|
45
|
+
if (drafts.length === 0)
|
|
46
|
+
throw new Error('appendToStream requires at least one event');
|
|
33
47
|
return withFileLock(join(this.root, 'locks', 'event-journal.lock'), async () => {
|
|
48
|
+
await reclaimStaleSegmentTemps(join(this.root, 'events'));
|
|
34
49
|
const current = await this.scan();
|
|
35
|
-
const byId = new Map(current.map((event) => [event.eventId, event]));
|
|
36
|
-
const batchIds = new Set();
|
|
37
|
-
for (const draft of drafts) {
|
|
38
|
-
if (batchIds.has(draft.eventId))
|
|
39
|
-
throw new Error(`Event id ${draft.eventId} is repeated in one append`);
|
|
40
|
-
batchIds.add(draft.eventId);
|
|
41
|
-
}
|
|
42
|
-
const existing = drafts.map((draft) => byId.get(draft.eventId));
|
|
43
|
-
for (const [index, event] of existing.entries())
|
|
44
|
-
if (event !== undefined && !sameDraft(event, drafts[index]))
|
|
45
|
-
throw new Error(`Event id ${event.eventId} has already been used with different content`);
|
|
46
|
-
if (drafts.length > 0 && existing.every(isDefined))
|
|
47
|
-
return existing.filter(isDefined);
|
|
48
50
|
const streamEvents = this.cachedEventsForStream(stream);
|
|
49
51
|
if (streamEvents.length !== expectedSequence)
|
|
50
52
|
throw new WrongExpectedSequenceError(`Expected sequence ${expectedSequence} for ${key(stream)}, actual ${streamEvents.length}`);
|
|
51
|
-
for (const draft of drafts)
|
|
52
|
-
if (key(draft.stream) !== key(stream))
|
|
53
|
-
throw new Error('Event stream mismatch');
|
|
54
53
|
const recordedAt = this.clock.now().toISOString();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...draft,
|
|
63
|
-
recordedAt,
|
|
64
|
-
sequence: streamEvents.length + newCount,
|
|
65
|
-
globalPosition: current.length + newCount,
|
|
66
|
-
};
|
|
67
|
-
});
|
|
54
|
+
const envelopes = drafts.map((draft, index) => ({
|
|
55
|
+
event: draft,
|
|
56
|
+
stream,
|
|
57
|
+
recordedAt,
|
|
58
|
+
sequence: streamEvents.length + index + 1,
|
|
59
|
+
globalPosition: current.length + index + 1,
|
|
60
|
+
}));
|
|
68
61
|
const finalizedEnvelopes = envelopes.map((event) => decodeEventEnvelope(event));
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// into a failed append.
|
|
80
|
-
await this.persistManifest().catch(() => {
|
|
81
|
-
this.manifestRevision = undefined;
|
|
82
|
-
});
|
|
83
|
-
this.changeSignalSource.notify();
|
|
84
|
-
}
|
|
62
|
+
const directory = join(this.root, 'events');
|
|
63
|
+
await mkdir(directory, { recursive: true });
|
|
64
|
+
const file = await this.nextSegmentFile(directory, recordedAt, current.length + 1);
|
|
65
|
+
await writeSegmentAtomically(join(directory, file), finalizedEnvelopes.map(encodeEventRecord).join('\n') + '\n');
|
|
66
|
+
await this.extendCache(file, current, finalizedEnvelopes);
|
|
67
|
+
// The manifest is derived data. The event append is authoritative, so
|
|
68
|
+
// an index-write failure must not turn a successfully recorded event
|
|
69
|
+
// into a failed append.
|
|
70
|
+
await this.persistManifest().catch(() => undefined);
|
|
71
|
+
this.changeSignalSource.notify();
|
|
85
72
|
return finalizedEnvelopes;
|
|
86
73
|
}, { waitMs: 5_000, retryIntervalMs: 25 });
|
|
87
74
|
}
|
|
75
|
+
async nextSegmentFile(directory, recordedAt, firstGlobalPosition) {
|
|
76
|
+
const day = recordedAt.slice(0, 10);
|
|
77
|
+
const daily = `${day}.jsonl`;
|
|
78
|
+
try {
|
|
79
|
+
await stat(join(directory, daily));
|
|
80
|
+
return `${day}~${String(firstGlobalPosition).padStart(20, '0')}.jsonl`;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
if (error.code === 'ENOENT')
|
|
84
|
+
return daily;
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
88
|
// Reads via the persisted per-segment manifest when the in-memory cache is
|
|
89
89
|
// cold (fresh process, or an on-disk change this instance didn't make),
|
|
90
90
|
// parsing only the segment files that can hold matching events instead of
|
|
91
91
|
// the entire history. A missing or stale manifest degrades to scan()'s
|
|
92
|
-
// full parse rather than to incorrect data
|
|
92
|
+
// full parse rather than to incorrect data. The next successful append
|
|
93
|
+
// rebuilds the derived manifest.
|
|
93
94
|
async readStream(stream) {
|
|
94
95
|
const streamKey = key(stream);
|
|
95
96
|
const entries = await this.readEntriesForRead();
|
|
@@ -136,6 +137,10 @@ export class FileEventJournal {
|
|
|
136
137
|
.slice(0, limit);
|
|
137
138
|
}
|
|
138
139
|
async readLatest(beforeGlobalPosition, limit = Number.POSITIVE_INFINITY) {
|
|
140
|
+
if (beforeGlobalPosition !== undefined && beforeGlobalPosition <= 0)
|
|
141
|
+
return [];
|
|
142
|
+
if (limit <= 0)
|
|
143
|
+
return [];
|
|
139
144
|
const events = await this.scan(await this.readEntriesForRead());
|
|
140
145
|
const before = beforeGlobalPosition ?? events.length + 1;
|
|
141
146
|
return events
|
|
@@ -147,6 +152,43 @@ export class FileEventJournal {
|
|
|
147
152
|
const events = await this.scan(await this.readEntriesForRead());
|
|
148
153
|
return events.at(-1)?.globalPosition ?? 0;
|
|
149
154
|
}
|
|
155
|
+
async waitForEventsAfter(afterGlobalPosition, signal, fallbackMs) {
|
|
156
|
+
await this.ensureChangeWatcher();
|
|
157
|
+
await waitForEventsAfter(() => this.latestGlobalPosition(), this.changeSignalSource, afterGlobalPosition, signal, fallbackMs);
|
|
158
|
+
}
|
|
159
|
+
ensureChangeWatcher() {
|
|
160
|
+
if (this.changeWatcher !== undefined)
|
|
161
|
+
return Promise.resolve();
|
|
162
|
+
if (this.startingChangeWatcher !== undefined)
|
|
163
|
+
return this.startingChangeWatcher;
|
|
164
|
+
const starting = this.startChangeWatcher().finally(() => {
|
|
165
|
+
if (this.startingChangeWatcher === starting)
|
|
166
|
+
this.startingChangeWatcher = undefined;
|
|
167
|
+
});
|
|
168
|
+
this.startingChangeWatcher = starting;
|
|
169
|
+
return starting;
|
|
170
|
+
}
|
|
171
|
+
async startChangeWatcher() {
|
|
172
|
+
const directory = join(this.root, 'events');
|
|
173
|
+
try {
|
|
174
|
+
await mkdir(directory, { recursive: true });
|
|
175
|
+
const watcher = await (this.options.watcherFactory ?? createFileSystemWatcher)(directory, () => {
|
|
176
|
+
this.invalidateValidatedEntries();
|
|
177
|
+
this.changeSignalSource.notify();
|
|
178
|
+
});
|
|
179
|
+
watcher.unref();
|
|
180
|
+
watcher.once('error', () => {
|
|
181
|
+
if (this.changeWatcher === watcher)
|
|
182
|
+
this.changeWatcher = undefined;
|
|
183
|
+
watcher.close();
|
|
184
|
+
void this.ensureChangeWatcher();
|
|
185
|
+
});
|
|
186
|
+
this.changeWatcher = watcher;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// This advisory accelerator is optional; fallback rereads stay correct.
|
|
190
|
+
}
|
|
191
|
+
}
|
|
150
192
|
// Extends the cache in place rather than invalidating it, so a self-caused
|
|
151
193
|
// write doesn't force the next read (by this call or any other reader
|
|
152
194
|
// sharing this instance) to re-parse the entire on-disk history. Only a
|
|
@@ -163,7 +205,7 @@ export class FileEventJournal {
|
|
|
163
205
|
const existingSegment = priorSegments.find((segment) => segment.file === file);
|
|
164
206
|
let offset = existingSegment?.size ?? 0;
|
|
165
207
|
const indexedEvents = newEnvelopes.map((event) => {
|
|
166
|
-
const length = Buffer.byteLength(`${
|
|
208
|
+
const length = Buffer.byteLength(`${encodeEventRecord(event)}\n`);
|
|
167
209
|
const indexed = {
|
|
168
210
|
globalPosition: event.globalPosition,
|
|
169
211
|
stream: key(event.stream),
|
|
@@ -193,6 +235,7 @@ export class FileEventJournal {
|
|
|
193
235
|
];
|
|
194
236
|
const events = [...priorEvents, ...newEnvelopes];
|
|
195
237
|
this.cached = { entries, events, eventsByStream: indexEventsByStream(events), segments };
|
|
238
|
+
this.rememberValidatedEntries(entries, true);
|
|
196
239
|
}
|
|
197
240
|
manifestPath() {
|
|
198
241
|
return join(this.root, 'events', 'index-manifest.json');
|
|
@@ -202,14 +245,13 @@ export class FileEventJournal {
|
|
|
202
245
|
}
|
|
203
246
|
// Persisted alongside the segments, so any reader of the same on-disk
|
|
204
247
|
// journal — not just this instance — can skip straight to the segments
|
|
205
|
-
// that can hold what it's looking for on a cold cache.
|
|
248
|
+
// that can hold what it's looking for on a cold cache. appendToStream() extends its
|
|
206
249
|
// contents from the concrete envelopes it has just written while locked.
|
|
207
250
|
async persistManifest() {
|
|
208
251
|
if (this.cached === undefined)
|
|
209
252
|
return;
|
|
210
253
|
const manifest = { segments: this.cached.segments };
|
|
211
|
-
await
|
|
212
|
-
this.manifestRevision = await this.readManifestRevision();
|
|
254
|
+
await writeFileAtomically(this.manifestPath(), JSON.stringify(manifest));
|
|
213
255
|
}
|
|
214
256
|
async loadManifest() {
|
|
215
257
|
try {
|
|
@@ -223,14 +265,17 @@ export class FileEventJournal {
|
|
|
223
265
|
return undefined;
|
|
224
266
|
}
|
|
225
267
|
}
|
|
226
|
-
scan(precomputedEntries) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
268
|
+
async scan(precomputedEntries) {
|
|
269
|
+
const entries = precomputedEntries ?? (await this.readCurrentEntries());
|
|
270
|
+
const inFlight = this.inFlightScan;
|
|
271
|
+
if (inFlight !== undefined && sameEntries(inFlight.entries, entries))
|
|
272
|
+
return inFlight.run;
|
|
273
|
+
const generation = ++this.scanGeneration;
|
|
274
|
+
const run = this.scanUncoalesced(entries, generation).finally(() => {
|
|
275
|
+
if (this.inFlightScan?.run === run)
|
|
231
276
|
this.inFlightScan = undefined;
|
|
232
277
|
});
|
|
233
|
-
this.inFlightScan = run;
|
|
278
|
+
this.inFlightScan = { entries, run };
|
|
234
279
|
return run;
|
|
235
280
|
}
|
|
236
281
|
async readCurrentEntries() {
|
|
@@ -238,7 +283,7 @@ export class FileEventJournal {
|
|
|
238
283
|
let files;
|
|
239
284
|
try {
|
|
240
285
|
files = (await readdir(directory))
|
|
241
|
-
.filter((file) => /^\d{4}-\d{2}-\d{2}
|
|
286
|
+
.filter((file) => /^\d{4}-\d{2}-\d{2}(?:~\d{20})?\.jsonl$/.test(file))
|
|
242
287
|
.sort();
|
|
243
288
|
}
|
|
244
289
|
catch (error) {
|
|
@@ -252,21 +297,38 @@ export class FileEventJournal {
|
|
|
252
297
|
}));
|
|
253
298
|
}
|
|
254
299
|
async readEntriesForRead() {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
300
|
+
const now = this.validationNow();
|
|
301
|
+
if (this.validatedEntries !== undefined && this.validatedEntries.expiresAt > now)
|
|
302
|
+
return this.validatedEntries.entries;
|
|
303
|
+
if (this.inFlightEntryRefresh !== undefined)
|
|
304
|
+
return this.inFlightEntryRefresh;
|
|
305
|
+
const generation = this.entryValidationGeneration;
|
|
306
|
+
const refresh = this.readCurrentEntries()
|
|
307
|
+
.then((entries) => {
|
|
308
|
+
if (generation === this.entryValidationGeneration)
|
|
309
|
+
this.rememberValidatedEntries(entries);
|
|
310
|
+
return entries;
|
|
311
|
+
})
|
|
312
|
+
.finally(() => {
|
|
313
|
+
if (this.inFlightEntryRefresh === refresh)
|
|
314
|
+
this.inFlightEntryRefresh = undefined;
|
|
315
|
+
});
|
|
316
|
+
this.inFlightEntryRefresh = refresh;
|
|
317
|
+
return refresh;
|
|
259
318
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
319
|
+
rememberValidatedEntries(entries, replacesInFlightRefresh = false) {
|
|
320
|
+
this.entryValidationGeneration += 1;
|
|
321
|
+
this.validatedEntries = {
|
|
322
|
+
entries,
|
|
323
|
+
expiresAt: this.validationNow() + entryValidationTtlMs,
|
|
324
|
+
};
|
|
325
|
+
if (replacesInFlightRefresh)
|
|
326
|
+
this.inFlightEntryRefresh = undefined;
|
|
327
|
+
}
|
|
328
|
+
invalidateValidatedEntries() {
|
|
329
|
+
this.entryValidationGeneration += 1;
|
|
330
|
+
this.validatedEntries = undefined;
|
|
331
|
+
this.inFlightEntryRefresh = undefined;
|
|
270
332
|
}
|
|
271
333
|
// Reads exactly the indexed JSONL records. Byte offsets make tail reads and
|
|
272
334
|
// stream reads proportional to the matching events, not segment size.
|
|
@@ -300,7 +362,7 @@ export class FileEventJournal {
|
|
|
300
362
|
let input;
|
|
301
363
|
try {
|
|
302
364
|
input = JSON.parse(buffer.toString('utf8'));
|
|
303
|
-
const event =
|
|
365
|
+
const event = decodeEventRecord(input);
|
|
304
366
|
validateEnvelope(event, indexed.globalPosition);
|
|
305
367
|
if (key(event.stream) !== indexed.stream)
|
|
306
368
|
throw new Error('Indexed stream mismatch');
|
|
@@ -311,9 +373,8 @@ export class FileEventJournal {
|
|
|
311
373
|
throw new Error(`Corrupt indexed event at ${file}:${indexed.globalPosition}${context}: ${error.message}`, { cause: error });
|
|
312
374
|
}
|
|
313
375
|
}
|
|
314
|
-
async scanUncoalesced(
|
|
376
|
+
async scanUncoalesced(entries, generation) {
|
|
315
377
|
const directory = join(this.root, 'events');
|
|
316
|
-
const entries = precomputedEntries ?? (await this.readCurrentEntries());
|
|
317
378
|
if (this.cached !== undefined && sameEntries(this.cached.entries, entries))
|
|
318
379
|
return this.cached.events;
|
|
319
380
|
const events = [];
|
|
@@ -330,7 +391,7 @@ export class FileEventJournal {
|
|
|
330
391
|
let input;
|
|
331
392
|
try {
|
|
332
393
|
input = JSON.parse(line);
|
|
333
|
-
const event =
|
|
394
|
+
const event = decodeEventRecord(input);
|
|
334
395
|
validateEnvelope(event, events.length + 1);
|
|
335
396
|
events.push(event);
|
|
336
397
|
indexedEvents.push({
|
|
@@ -353,8 +414,8 @@ export class FileEventJournal {
|
|
|
353
414
|
events: indexedEvents,
|
|
354
415
|
});
|
|
355
416
|
}
|
|
356
|
-
|
|
357
|
-
|
|
417
|
+
if (generation === this.scanGeneration)
|
|
418
|
+
this.cached = { entries, events, eventsByStream: indexEventsByStream(events), segments };
|
|
358
419
|
return events;
|
|
359
420
|
}
|
|
360
421
|
}
|
|
@@ -426,18 +487,6 @@ function indexEventsByStream(events) {
|
|
|
426
487
|
}
|
|
427
488
|
return indexed;
|
|
428
489
|
}
|
|
429
|
-
const sameDraft = (event, draft) => isDeepStrictEqual({
|
|
430
|
-
eventId: event.eventId,
|
|
431
|
-
eventType: event.eventType,
|
|
432
|
-
schemaVersion: event.schemaVersion,
|
|
433
|
-
occurredAt: event.occurredAt,
|
|
434
|
-
correlationId: event.correlationId,
|
|
435
|
-
causationId: event.causationId,
|
|
436
|
-
actor: event.actor,
|
|
437
|
-
source: event.source,
|
|
438
|
-
stream: event.stream,
|
|
439
|
-
payload: event.payload,
|
|
440
|
-
}, draft);
|
|
441
490
|
function validateEnvelope(event, expectedPosition) {
|
|
442
491
|
if (event.globalPosition !== expectedPosition)
|
|
443
492
|
throw new Error('Invalid event envelope position');
|
|
@@ -448,6 +497,39 @@ function eventContext(input) {
|
|
|
448
497
|
const eventId = input.eventId;
|
|
449
498
|
return typeof eventId === 'string' && eventId.length > 0 ? ` event ${eventId}` : '';
|
|
450
499
|
}
|
|
451
|
-
function
|
|
452
|
-
|
|
500
|
+
async function waitForEventsAfter(latestGlobalPosition, changeSignal, afterGlobalPosition, signal, fallbackMs) {
|
|
501
|
+
if (signal.aborted)
|
|
502
|
+
return;
|
|
503
|
+
const observedGeneration = changeSignal.revision();
|
|
504
|
+
const waiting = new AbortController();
|
|
505
|
+
const abort = () => waiting.abort();
|
|
506
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
507
|
+
try {
|
|
508
|
+
const wake = changeSignal.waitForChangeAfter(observedGeneration, waiting.signal, fallbackMs);
|
|
509
|
+
if ((await latestGlobalPosition()) > afterGlobalPosition)
|
|
510
|
+
return;
|
|
511
|
+
await wake;
|
|
512
|
+
}
|
|
513
|
+
finally {
|
|
514
|
+
waiting.abort();
|
|
515
|
+
signal.removeEventListener('abort', abort);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
async function writeSegmentAtomically(path, contents) {
|
|
519
|
+
await writeFileAtomically(path, contents);
|
|
520
|
+
}
|
|
521
|
+
const staleSegmentTempName = /^\d{4}-\d{2}-\d{2}(?:~\d{20})?\.jsonl\.\d+\.\d+\.[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.tmp$/;
|
|
522
|
+
async function reclaimStaleSegmentTemps(directory) {
|
|
523
|
+
let entries;
|
|
524
|
+
try {
|
|
525
|
+
entries = await readdir(directory, { withFileTypes: true });
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
if (error.code === 'ENOENT')
|
|
529
|
+
return;
|
|
530
|
+
throw error;
|
|
531
|
+
}
|
|
532
|
+
await Promise.all(entries
|
|
533
|
+
.filter((entry) => entry.isFile() && staleSegmentTempName.test(entry.name))
|
|
534
|
+
.map((entry) => rm(join(directory, entry.name), { force: true }).catch(() => undefined)));
|
|
453
535
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface FileLockMetadata {
|
|
2
|
+
readonly pid: number;
|
|
3
|
+
readonly acquiredAt: string;
|
|
4
|
+
readonly lockId: string;
|
|
5
|
+
/** Linux process start-ticks when available, preventing PID/TID reuse from blocking recovery. */
|
|
6
|
+
readonly processIdentity?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FileLockOptions {
|
|
9
|
+
readonly staleAfterMs?: number;
|
|
10
|
+
readonly now?: Date;
|
|
11
|
+
/** A stale owner may be ignored only when this probe proves its process dead. */
|
|
12
|
+
readonly staleRequiresDeadProcess?: boolean;
|
|
13
|
+
readonly isProcessAlive?: (pid: number) => boolean;
|
|
14
|
+
readonly processIdentity?: (pid: number) => Promise<string | null>;
|
|
15
|
+
readonly processStartedAt?: (pid: number) => Promise<Date | null>;
|
|
16
|
+
}
|
|
17
|
+
export interface WithFileLockOptions extends FileLockOptions {
|
|
18
|
+
/** Wait for a contended lock for at most this long before reporting contention. */
|
|
19
|
+
readonly waitMs?: number;
|
|
20
|
+
/** Delay between acquisition attempts while waiting for a contended lock. */
|
|
21
|
+
readonly retryIntervalMs?: number;
|
|
22
|
+
}
|
|
23
|
+
interface UnavailableFileLock {
|
|
24
|
+
readonly acquired: false;
|
|
25
|
+
readonly release: () => Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export declare function acquireFileLock(path: string, options?: FileLockOptions): Promise<UnavailableFileLock | {
|
|
28
|
+
acquired: true;
|
|
29
|
+
metadata: FileLockMetadata;
|
|
30
|
+
release(): Promise<void>;
|
|
31
|
+
}>;
|
|
32
|
+
export declare function withFileLock<Value>(path: string, operation: () => Promise<Value>, options?: WithFileLockOptions): Promise<Value>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=file-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-lock.d.ts","sourceRoot":"","sources":["../src/file-lock.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iGAAiG;IACjG,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IACpB,iFAAiF;IACjF,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACnD,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACnE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,mFAAmF;IACnF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAUD,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe;;;;GAY5E;AAoUD,wBAAsB,YAAY,CAAC,KAAK,EACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,EAC/B,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,KAAK,CAAC,CAYhB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { mkdir, open, readdir, readFile, rm, rmdir } from 'node:fs/promises';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
|
+
import { syncParentDirectory } from './atomic-write.js';
|
|
4
5
|
const maximumOwnerRecords = 1024;
|
|
5
6
|
const compatibilityAcquiredAt = '9999-12-31T23:59:59.999Z';
|
|
6
7
|
export async function acquireFileLock(path, options) {
|
|
@@ -206,6 +207,7 @@ async function createOwnerRecord(path, metadata) {
|
|
|
206
207
|
finally {
|
|
207
208
|
await handle.close();
|
|
208
209
|
}
|
|
210
|
+
await syncParentDirectory(dirname(path));
|
|
209
211
|
}
|
|
210
212
|
async function ownerBlocksAcquisition(path, options) {
|
|
211
213
|
let owner;
|
|
@@ -340,10 +342,17 @@ async function acquireFileLockWithWait(path, options) {
|
|
|
340
342
|
const lock = await acquireFileLock(path, options);
|
|
341
343
|
if (lock.acquired || Date.now() >= deadline)
|
|
342
344
|
return lock;
|
|
343
|
-
await delay(
|
|
345
|
+
await delay(nextRetryDelay(retryIntervalMs, deadline - Date.now()));
|
|
344
346
|
} while (Date.now() < deadline);
|
|
345
347
|
return acquireFileLock(path, options);
|
|
346
348
|
}
|
|
349
|
+
function nextRetryDelay(retryIntervalMs, remainingMs) {
|
|
350
|
+
if (retryIntervalMs <= 0 || remainingMs <= 0)
|
|
351
|
+
return 0;
|
|
352
|
+
const maximumDelay = Math.max(1, Math.floor(retryIntervalMs));
|
|
353
|
+
const jitter = Number.parseInt(randomUUID().slice(0, 2), 16) % maximumDelay;
|
|
354
|
+
return Math.min(maximumDelay + jitter, remainingMs);
|
|
355
|
+
}
|
|
347
356
|
function delay(milliseconds) {
|
|
348
357
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
349
358
|
}
|
package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProcessorRunSerialiser } from '@atolis-hq/eventing';
|
|
2
|
+
export declare function createFileProcessorRunSerialiser(dataRoot: string): ProcessorRunSerialiser;
|
|
3
|
+
export declare function processorRunRetryDelayMs(contentions: number): number;
|
|
4
|
+
export declare function encodeProcessorConsumer(consumer: string): string;
|
|
5
|
+
export declare function waitForRetry(signal: AbortSignal, milliseconds: number): Promise<void>;
|
|
6
|
+
export declare class ProcessorRunAbortedError extends Error {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=file-processor-run-serialiser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-processor-run-serialiser.d.ts","sourceRoot":"","sources":["../src/file-processor-run-serialiser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAQlE,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAoCzF;AAED,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGhE;AAMD,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBrF;AAED,qBAAa,wBAAyB,SAAQ,KAAK;;CAIlD"}
|
package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { acquireFileLock } from './file-lock.js';
|
|
3
|
+
import { assertWellFormedUtf16 } from './storage-name.js';
|
|
4
|
+
const firstProcessorRetryDelayMs = 10;
|
|
5
|
+
const maximumProcessorRetryDelayMs = 250;
|
|
6
|
+
export function createFileProcessorRunSerialiser(dataRoot) {
|
|
7
|
+
let acquireTail = Promise.resolve();
|
|
8
|
+
const acquire = async (path) => {
|
|
9
|
+
const prior = acquireTail;
|
|
10
|
+
let release;
|
|
11
|
+
acquireTail = new Promise((resolve) => {
|
|
12
|
+
release = resolve;
|
|
13
|
+
});
|
|
14
|
+
await prior;
|
|
15
|
+
try {
|
|
16
|
+
return await acquireFileLock(path, {
|
|
17
|
+
staleAfterMs: 60_000,
|
|
18
|
+
staleRequiresDeadProcess: true,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
release();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return async (consumer, signal, operation) => {
|
|
26
|
+
const path = join(dataRoot, 'locks', `subscription-${encodeProcessorConsumer(consumer)}.lock`);
|
|
27
|
+
let contentions = 0;
|
|
28
|
+
while (true) {
|
|
29
|
+
throwIfAborted(signal);
|
|
30
|
+
const lock = await acquire(path);
|
|
31
|
+
if (lock.acquired) {
|
|
32
|
+
try {
|
|
33
|
+
throwIfAborted(signal);
|
|
34
|
+
return await operation();
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
await lock.release();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
contentions += 1;
|
|
41
|
+
await waitForRetry(signal, processorRunRetryDelayMs(contentions));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function processorRunRetryDelayMs(contentions) {
|
|
46
|
+
return Math.min(maximumProcessorRetryDelayMs, firstProcessorRetryDelayMs * 2 ** Math.max(0, contentions - 1));
|
|
47
|
+
}
|
|
48
|
+
export function encodeProcessorConsumer(consumer) {
|
|
49
|
+
assertWellFormedUtf16(consumer, 'Processor consumer');
|
|
50
|
+
return Buffer.from(consumer, 'utf8').toString('base64url');
|
|
51
|
+
}
|
|
52
|
+
function throwIfAborted(signal) {
|
|
53
|
+
if (signal.aborted)
|
|
54
|
+
throw new ProcessorRunAbortedError();
|
|
55
|
+
}
|
|
56
|
+
export function waitForRetry(signal, milliseconds) {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
if (signal.aborted) {
|
|
59
|
+
reject(new ProcessorRunAbortedError());
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const timer = setTimeout(completed, milliseconds);
|
|
63
|
+
signal.addEventListener('abort', aborted, { once: true });
|
|
64
|
+
if (signal.aborted)
|
|
65
|
+
aborted();
|
|
66
|
+
function completed() {
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
signal.removeEventListener('abort', aborted);
|
|
69
|
+
resolve();
|
|
70
|
+
}
|
|
71
|
+
function aborted() {
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
signal.removeEventListener('abort', aborted);
|
|
74
|
+
reject(new ProcessorRunAbortedError());
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export class ProcessorRunAbortedError extends Error {
|
|
79
|
+
constructor() {
|
|
80
|
+
super('Processor run aborted');
|
|
81
|
+
}
|
|
82
|
+
}
|
package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-state-store.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProcessorStateStore, StoredProcessorState } from '@atolis-hq/eventing';
|
|
2
|
+
export declare class FileProcessorStateStore implements ProcessorStateStore {
|
|
3
|
+
private readonly root;
|
|
4
|
+
constructor(root: string);
|
|
5
|
+
read<Value>(consumer: string, key: string): Promise<StoredProcessorState<Value> | null>;
|
|
6
|
+
write<Value>(state: StoredProcessorState<Value>): Promise<void>;
|
|
7
|
+
delete(consumer: string, key: string): Promise<void>;
|
|
8
|
+
private paths;
|
|
9
|
+
private withStateLocks;
|
|
10
|
+
private readCandidates;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=file-processor-state-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-processor-state-store.d.ts","sourceRoot":"","sources":["../src/file-processor-state-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAcrF,qBAAa,uBAAwB,YAAW,mBAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,MAAM;IAEnC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAWvF,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB/D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU1D,OAAO,CAAC,KAAK;YAIC,cAAc;YAOd,cAAc;CAY7B"}
|