@canhta/dsh-autopilot 0.1.0-alpha.1
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/AGENTS.md +41 -0
- package/CONTEXT.md +39 -0
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/cordis.patch.yml +13 -0
- package/deploy/dsh-autopilot.service +26 -0
- package/docs/CONTRIBUTING.md +60 -0
- package/docs/README.md +34 -0
- package/docs/agents/domain.md +7 -0
- package/docs/agents/issue-tracker.md +21 -0
- package/docs/agents/triage-labels.md +13 -0
- package/docs/assets/banner.png +0 -0
- package/docs/deployment.md +138 -0
- package/docs/engineering.md +43 -0
- package/docs/specs/execution.md +65 -0
- package/docs/specs/integrations.md +89 -0
- package/docs/specs/lifecycle.md +81 -0
- package/docs/specs/operations.md +89 -0
- package/docs/specs/plugin.md +49 -0
- package/docs/specs/providers.md +62 -0
- package/docs/specs/scope.md +35 -0
- package/docs/specs/ui-components.md +96 -0
- package/docs/specs/web-ui.md +64 -0
- package/lib/admission/cancellation-control.d.ts +11 -0
- package/lib/admission/cancellation-control.js +72 -0
- package/lib/admission/cancellation-control.js.map +1 -0
- package/lib/admission/candidates.d.ts +2 -0
- package/lib/admission/candidates.js +23 -0
- package/lib/admission/candidates.js.map +1 -0
- package/lib/admission/composition-claim.d.ts +10 -0
- package/lib/admission/composition-claim.js +13 -0
- package/lib/admission/composition-claim.js.map +1 -0
- package/lib/admission/constants.d.ts +12 -0
- package/lib/admission/constants.js +13 -0
- package/lib/admission/constants.js.map +1 -0
- package/lib/admission/deliveries.d.ts +6 -0
- package/lib/admission/deliveries.js +175 -0
- package/lib/admission/deliveries.js.map +1 -0
- package/lib/admission/delivery-control.d.ts +28 -0
- package/lib/admission/delivery-control.js +294 -0
- package/lib/admission/delivery-control.js.map +1 -0
- package/lib/admission/execution-control.d.ts +29 -0
- package/lib/admission/execution-control.js +177 -0
- package/lib/admission/execution-control.js.map +1 -0
- package/lib/admission/index.d.ts +4 -0
- package/lib/admission/index.js +4 -0
- package/lib/admission/index.js.map +1 -0
- package/lib/admission/model.d.ts +296 -0
- package/lib/admission/model.js +13 -0
- package/lib/admission/model.js.map +1 -0
- package/lib/admission/pause-control.d.ts +44 -0
- package/lib/admission/pause-control.js +220 -0
- package/lib/admission/pause-control.js.map +1 -0
- package/lib/admission/policy.d.ts +39 -0
- package/lib/admission/policy.js +238 -0
- package/lib/admission/policy.js.map +1 -0
- package/lib/admission/ports.d.ts +13 -0
- package/lib/admission/ports.js +2 -0
- package/lib/admission/ports.js.map +1 -0
- package/lib/admission/publication-control.d.ts +16 -0
- package/lib/admission/publication-control.js +153 -0
- package/lib/admission/publication-control.js.map +1 -0
- package/lib/admission/reconciler.d.ts +7 -0
- package/lib/admission/reconciler.js +121 -0
- package/lib/admission/reconciler.js.map +1 -0
- package/lib/admission/resume-control.d.ts +27 -0
- package/lib/admission/resume-control.js +213 -0
- package/lib/admission/resume-control.js.map +1 -0
- package/lib/admission/run-fence.d.ts +11 -0
- package/lib/admission/run-fence.js +49 -0
- package/lib/admission/run-fence.js.map +1 -0
- package/lib/admission/service.d.ts +130 -0
- package/lib/admission/service.js +415 -0
- package/lib/admission/service.js.map +1 -0
- package/lib/admission/state-domain.d.ts +11 -0
- package/lib/admission/state-domain.js +33 -0
- package/lib/admission/state-domain.js.map +1 -0
- package/lib/admission/state-integrity.d.ts +19 -0
- package/lib/admission/state-integrity.js +102 -0
- package/lib/admission/state-integrity.js.map +1 -0
- package/lib/admission/state-migration.d.ts +4 -0
- package/lib/admission/state-migration.js +46 -0
- package/lib/admission/state-migration.js.map +1 -0
- package/lib/admission/state.d.ts +4524 -0
- package/lib/admission/state.js +394 -0
- package/lib/admission/state.js.map +1 -0
- package/lib/admission.d.ts +1 -0
- package/lib/admission.js +2 -0
- package/lib/admission.js.map +1 -0
- package/lib/client-types/client/OperationsAtoms.d.ts +30 -0
- package/lib/client-types/client/OperationsPanel.d.ts +34 -0
- package/lib/client-types/client/RunsView.d.ts +14 -0
- package/lib/client-types/client/SettingsCapabilitySections.d.ts +16 -0
- package/lib/client-types/client/SettingsPanel.d.ts +40 -0
- package/lib/client-types/client/SettingsPolicySections.d.ts +13 -0
- package/lib/client-types/client/SettingsProviderSection.d.ts +21 -0
- package/lib/client-types/client/SummaryView.d.ts +10 -0
- package/lib/client-types/client/WorktreesView.d.ts +9 -0
- package/lib/client-types/client/index.d.ts +9 -0
- package/lib/client-types/client/locales/en.d.ts +154 -0
- package/lib/client-types/client/locales/index.d.ts +9 -0
- package/lib/client-types/client/locales/zh.d.ts +155 -0
- package/lib/client-types/client/settings-draft.d.ts +29 -0
- package/lib/client-types/client/state.d.ts +63 -0
- package/lib/client-types/code-host/index.d.ts +2 -0
- package/lib/client-types/code-host/model.d.ts +118 -0
- package/lib/client-types/code-host/registry.d.ts +23 -0
- package/lib/client-types/code-host/validation.d.ts +51 -0
- package/lib/client-types/code-host.d.ts +2 -0
- package/lib/client-types/config/index.d.ts +2 -0
- package/lib/client-types/config/settings.d.ts +51 -0
- package/lib/client-types/config.d.ts +2 -0
- package/lib/client-types/notification/index.d.ts +2 -0
- package/lib/client-types/notification/model.d.ts +57 -0
- package/lib/client-types/notification/registry.d.ts +16 -0
- package/lib/client-types/notification.d.ts +2 -0
- package/lib/client-types/providers/generation-registry.d.ts +20 -0
- package/lib/client-types/remote.d.ts +65 -0
- package/lib/client-types/tracker/index.d.ts +2 -0
- package/lib/client-types/tracker/model.d.ts +222 -0
- package/lib/client-types/tracker/registry.d.ts +49 -0
- package/lib/client-types/tracker/validation.d.ts +60 -0
- package/lib/client-types/tracker.d.ts +2 -0
- package/lib/client-types/web/contract.d.ts +958 -0
- package/lib/client.js +7961 -0
- package/lib/client.js.map +1 -0
- package/lib/code-host/index.d.ts +2 -0
- package/lib/code-host/index.js +3 -0
- package/lib/code-host/index.js.map +1 -0
- package/lib/code-host/model.d.ts +118 -0
- package/lib/code-host/model.js +23 -0
- package/lib/code-host/model.js.map +1 -0
- package/lib/code-host/registry.d.ts +23 -0
- package/lib/code-host/registry.js +90 -0
- package/lib/code-host/registry.js.map +1 -0
- package/lib/code-host/validation.d.ts +51 -0
- package/lib/code-host/validation.js +30 -0
- package/lib/code-host/validation.js.map +1 -0
- package/lib/code-host.d.ts +2 -0
- package/lib/code-host.js +3 -0
- package/lib/code-host.js.map +1 -0
- package/lib/config/index.d.ts +2 -0
- package/lib/config/index.js +3 -0
- package/lib/config/index.js.map +1 -0
- package/lib/config/settings.d.ts +51 -0
- package/lib/config/settings.js +195 -0
- package/lib/config/settings.js.map +1 -0
- package/lib/config.d.ts +2 -0
- package/lib/config.js +3 -0
- package/lib/config.js.map +1 -0
- package/lib/delivery/index.d.ts +1 -0
- package/lib/delivery/index.js +2 -0
- package/lib/delivery/index.js.map +1 -0
- package/lib/delivery/service.d.ts +29 -0
- package/lib/delivery/service.js +140 -0
- package/lib/delivery/service.js.map +1 -0
- package/lib/delivery.d.ts +2 -0
- package/lib/delivery.js +3 -0
- package/lib/delivery.js.map +1 -0
- package/lib/dispatch/composition.d.ts +18 -0
- package/lib/dispatch/composition.js +109 -0
- package/lib/dispatch/composition.js.map +1 -0
- package/lib/dispatch/contract.d.ts +2 -0
- package/lib/dispatch/contract.js +2 -0
- package/lib/dispatch/contract.js.map +1 -0
- package/lib/dispatch/execute.d.ts +10 -0
- package/lib/dispatch/execute.js +138 -0
- package/lib/dispatch/execute.js.map +1 -0
- package/lib/dispatch/execution-state.d.ts +12 -0
- package/lib/dispatch/execution-state.js +24 -0
- package/lib/dispatch/execution-state.js.map +1 -0
- package/lib/dispatch/git.d.ts +5 -0
- package/lib/dispatch/git.js +95 -0
- package/lib/dispatch/git.js.map +1 -0
- package/lib/dispatch/index.d.ts +2 -0
- package/lib/dispatch/index.js +2 -0
- package/lib/dispatch/index.js.map +1 -0
- package/lib/dispatch/report.d.ts +11 -0
- package/lib/dispatch/report.js +141 -0
- package/lib/dispatch/report.js.map +1 -0
- package/lib/dispatch/resume.d.ts +17 -0
- package/lib/dispatch/resume.js +89 -0
- package/lib/dispatch/resume.js.map +1 -0
- package/lib/dispatch/service.d.ts +56 -0
- package/lib/dispatch/service.js +231 -0
- package/lib/dispatch/service.js.map +1 -0
- package/lib/dispatch/usage.d.ts +10 -0
- package/lib/dispatch/usage.js +47 -0
- package/lib/dispatch/usage.js.map +1 -0
- package/lib/dispatch.d.ts +2 -0
- package/lib/dispatch.js +3 -0
- package/lib/dispatch.js.map +1 -0
- package/lib/github-code-host.d.ts +1 -0
- package/lib/github-code-host.js +2 -0
- package/lib/github-code-host.js.map +1 -0
- package/lib/github-issues.d.ts +1 -0
- package/lib/github-issues.js +2 -0
- package/lib/github-issues.js.map +1 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +48 -0
- package/lib/index.js.map +1 -0
- package/lib/ingress.d.ts +2 -0
- package/lib/ingress.js +3 -0
- package/lib/ingress.js.map +1 -0
- package/lib/jira.d.ts +1 -0
- package/lib/jira.js +2 -0
- package/lib/jira.js.map +1 -0
- package/lib/mcp/contracts.d.ts +21 -0
- package/lib/mcp/contracts.js +33 -0
- package/lib/mcp/contracts.js.map +1 -0
- package/lib/mcp/cursor.d.ts +10 -0
- package/lib/mcp/cursor.js +68 -0
- package/lib/mcp/cursor.js.map +1 -0
- package/lib/mcp/definition.d.ts +8 -0
- package/lib/mcp/definition.js +43 -0
- package/lib/mcp/definition.js.map +1 -0
- package/lib/mcp/index.d.ts +6 -0
- package/lib/mcp/index.js +7 -0
- package/lib/mcp/index.js.map +1 -0
- package/lib/mcp/json.d.ts +4 -0
- package/lib/mcp/json.js +20 -0
- package/lib/mcp/json.js.map +1 -0
- package/lib/mcp/mount.d.ts +17 -0
- package/lib/mcp/mount.js +79 -0
- package/lib/mcp/mount.js.map +1 -0
- package/lib/mcp/read-tools.d.ts +27 -0
- package/lib/mcp/read-tools.js +149 -0
- package/lib/mcp/read-tools.js.map +1 -0
- package/lib/notification/index.d.ts +2 -0
- package/lib/notification/index.js +3 -0
- package/lib/notification/index.js.map +1 -0
- package/lib/notification/model.d.ts +57 -0
- package/lib/notification/model.js +20 -0
- package/lib/notification/model.js.map +1 -0
- package/lib/notification/registry.d.ts +16 -0
- package/lib/notification/registry.js +67 -0
- package/lib/notification/registry.js.map +1 -0
- package/lib/notification.d.ts +2 -0
- package/lib/notification.js +3 -0
- package/lib/notification.js.map +1 -0
- package/lib/ntfy-notification.d.ts +1 -0
- package/lib/ntfy-notification.js +2 -0
- package/lib/ntfy-notification.js.map +1 -0
- package/lib/operations/cleanup-inspector.d.ts +16 -0
- package/lib/operations/cleanup-inspector.js +132 -0
- package/lib/operations/cleanup-inspector.js.map +1 -0
- package/lib/operations/cleanup.d.ts +25 -0
- package/lib/operations/cleanup.js +151 -0
- package/lib/operations/cleanup.js.map +1 -0
- package/lib/operations/disposition.d.ts +46 -0
- package/lib/operations/disposition.js +89 -0
- package/lib/operations/disposition.js.map +1 -0
- package/lib/operations/health.d.ts +6 -0
- package/lib/operations/health.js +41 -0
- package/lib/operations/health.js.map +1 -0
- package/lib/operations/index.d.ts +6 -0
- package/lib/operations/index.js +7 -0
- package/lib/operations/index.js.map +1 -0
- package/lib/operations/inspection.d.ts +35 -0
- package/lib/operations/inspection.js +183 -0
- package/lib/operations/inspection.js.map +1 -0
- package/lib/operations/model.d.ts +77 -0
- package/lib/operations/model.js +2 -0
- package/lib/operations/model.js.map +1 -0
- package/lib/operations/recovery.d.ts +11 -0
- package/lib/operations/recovery.js +101 -0
- package/lib/operations/recovery.js.map +1 -0
- package/lib/operations/retention.d.ts +28 -0
- package/lib/operations/retention.js +105 -0
- package/lib/operations/retention.js.map +1 -0
- package/lib/operations/runtime-owner.d.ts +54 -0
- package/lib/operations/runtime-owner.js +281 -0
- package/lib/operations/runtime-owner.js.map +1 -0
- package/lib/operations/service.d.ts +55 -0
- package/lib/operations/service.js +154 -0
- package/lib/operations/service.js.map +1 -0
- package/lib/operations/state.d.ts +79 -0
- package/lib/operations/state.js +51 -0
- package/lib/operations/state.js.map +1 -0
- package/lib/operations/storage-composition.d.ts +16 -0
- package/lib/operations/storage-composition.js +61 -0
- package/lib/operations/storage-composition.js.map +1 -0
- package/lib/operations/store.d.ts +16 -0
- package/lib/operations/store.js +84 -0
- package/lib/operations/store.js.map +1 -0
- package/lib/operations.d.ts +2 -0
- package/lib/operations.js +3 -0
- package/lib/operations.js.map +1 -0
- package/lib/providers/generation-registry.d.ts +20 -0
- package/lib/providers/generation-registry.js +72 -0
- package/lib/providers/generation-registry.js.map +1 -0
- package/lib/providers/github-code-host/contracts.d.ts +224 -0
- package/lib/providers/github-code-host/contracts.js +144 -0
- package/lib/providers/github-code-host/contracts.js.map +1 -0
- package/lib/providers/github-code-host/index.d.ts +2 -0
- package/lib/providers/github-code-host/index.js +2 -0
- package/lib/providers/github-code-host/index.js.map +1 -0
- package/lib/providers/github-code-host/provider.d.ts +5 -0
- package/lib/providers/github-code-host/provider.js +289 -0
- package/lib/providers/github-code-host/provider.js.map +1 -0
- package/lib/providers/github-code-host/schemas.d.ts +81 -0
- package/lib/providers/github-code-host/schemas.js +39 -0
- package/lib/providers/github-code-host/schemas.js.map +1 -0
- package/lib/providers/github-code-host/settings.d.ts +16 -0
- package/lib/providers/github-code-host/settings.js +65 -0
- package/lib/providers/github-code-host/settings.js.map +1 -0
- package/lib/providers/github-issues/contracts.d.ts +151 -0
- package/lib/providers/github-issues/contracts.js +141 -0
- package/lib/providers/github-issues/contracts.js.map +1 -0
- package/lib/providers/github-issues/index.d.ts +1 -0
- package/lib/providers/github-issues/index.js +2 -0
- package/lib/providers/github-issues/index.js.map +1 -0
- package/lib/providers/github-issues/ingress.d.ts +8 -0
- package/lib/providers/github-issues/ingress.js +80 -0
- package/lib/providers/github-issues/ingress.js.map +1 -0
- package/lib/providers/github-issues/normalization.d.ts +11 -0
- package/lib/providers/github-issues/normalization.js +115 -0
- package/lib/providers/github-issues/normalization.js.map +1 -0
- package/lib/providers/github-issues/provider.d.ts +6 -0
- package/lib/providers/github-issues/provider.js +235 -0
- package/lib/providers/github-issues/provider.js.map +1 -0
- package/lib/providers/github-issues/schemas.d.ts +123 -0
- package/lib/providers/github-issues/schemas.js +58 -0
- package/lib/providers/github-issues/schemas.js.map +1 -0
- package/lib/providers/github-issues/settings.d.ts +27 -0
- package/lib/providers/github-issues/settings.js +154 -0
- package/lib/providers/github-issues/settings.js.map +1 -0
- package/lib/providers/jira/contracts.d.ts +193 -0
- package/lib/providers/jira/contracts.js +133 -0
- package/lib/providers/jira/contracts.js.map +1 -0
- package/lib/providers/jira/index.d.ts +1 -0
- package/lib/providers/jira/index.js +2 -0
- package/lib/providers/jira/index.js.map +1 -0
- package/lib/providers/jira/ingress.d.ts +4 -0
- package/lib/providers/jira/ingress.js +60 -0
- package/lib/providers/jira/ingress.js.map +1 -0
- package/lib/providers/jira/normalization.d.ts +8 -0
- package/lib/providers/jira/normalization.js +121 -0
- package/lib/providers/jira/normalization.js.map +1 -0
- package/lib/providers/jira/provider.d.ts +6 -0
- package/lib/providers/jira/provider.js +317 -0
- package/lib/providers/jira/provider.js.map +1 -0
- package/lib/providers/jira/schemas.d.ts +134 -0
- package/lib/providers/jira/schemas.js +76 -0
- package/lib/providers/jira/schemas.js.map +1 -0
- package/lib/providers/jira/settings.d.ts +32 -0
- package/lib/providers/jira/settings.js +163 -0
- package/lib/providers/jira/settings.js.map +1 -0
- package/lib/providers/notification-http.d.ts +13 -0
- package/lib/providers/notification-http.js +136 -0
- package/lib/providers/notification-http.js.map +1 -0
- package/lib/providers/ntfy-notification/index.d.ts +2 -0
- package/lib/providers/ntfy-notification/index.js +2 -0
- package/lib/providers/ntfy-notification/index.js.map +1 -0
- package/lib/providers/ntfy-notification/provider.d.ts +4 -0
- package/lib/providers/ntfy-notification/provider.js +89 -0
- package/lib/providers/ntfy-notification/provider.js.map +1 -0
- package/lib/providers/ntfy-notification/settings.d.ts +12 -0
- package/lib/providers/ntfy-notification/settings.js +34 -0
- package/lib/providers/ntfy-notification/settings.js.map +1 -0
- package/lib/providers/webhook-notification/index.d.ts +2 -0
- package/lib/providers/webhook-notification/index.js +2 -0
- package/lib/providers/webhook-notification/index.js.map +1 -0
- package/lib/providers/webhook-notification/provider.d.ts +4 -0
- package/lib/providers/webhook-notification/provider.js +57 -0
- package/lib/providers/webhook-notification/provider.js.map +1 -0
- package/lib/providers/webhook-notification/settings.d.ts +11 -0
- package/lib/providers/webhook-notification/settings.js +31 -0
- package/lib/providers/webhook-notification/settings.js.map +1 -0
- package/lib/publication/git.d.ts +7 -0
- package/lib/publication/git.js +154 -0
- package/lib/publication/git.js.map +1 -0
- package/lib/publication/index.d.ts +1 -0
- package/lib/publication/index.js +2 -0
- package/lib/publication/index.js.map +1 -0
- package/lib/publication/service.d.ts +27 -0
- package/lib/publication/service.js +166 -0
- package/lib/publication/service.js.map +1 -0
- package/lib/publication.d.ts +2 -0
- package/lib/publication.js +3 -0
- package/lib/publication.js.map +1 -0
- package/lib/reconciliation/index.d.ts +3 -0
- package/lib/reconciliation/index.js +4 -0
- package/lib/reconciliation/index.js.map +1 -0
- package/lib/reconciliation/ingress.d.ts +21 -0
- package/lib/reconciliation/ingress.js +168 -0
- package/lib/reconciliation/ingress.js.map +1 -0
- package/lib/reconciliation/service.d.ts +75 -0
- package/lib/reconciliation/service.js +228 -0
- package/lib/reconciliation/service.js.map +1 -0
- package/lib/reconciliation.d.ts +2 -0
- package/lib/reconciliation.js +3 -0
- package/lib/reconciliation.js.map +1 -0
- package/lib/remote.d.ts +65 -0
- package/lib/remote.js +135 -0
- package/lib/remote.js.map +1 -0
- package/lib/tracker/index.d.ts +2 -0
- package/lib/tracker/index.js +3 -0
- package/lib/tracker/index.js.map +1 -0
- package/lib/tracker/model.d.ts +222 -0
- package/lib/tracker/model.js +66 -0
- package/lib/tracker/model.js.map +1 -0
- package/lib/tracker/registry.d.ts +49 -0
- package/lib/tracker/registry.js +213 -0
- package/lib/tracker/registry.js.map +1 -0
- package/lib/tracker/validation.d.ts +60 -0
- package/lib/tracker/validation.js +52 -0
- package/lib/tracker/validation.js.map +1 -0
- package/lib/tracker.d.ts +2 -0
- package/lib/tracker.js +3 -0
- package/lib/tracker.js.map +1 -0
- package/lib/typert.d.ts +1 -0
- package/lib/typert.js +2 -0
- package/lib/typert.js.map +1 -0
- package/lib/web/commands.d.ts +18 -0
- package/lib/web/commands.js +231 -0
- package/lib/web/commands.js.map +1 -0
- package/lib/web/contract.d.ts +958 -0
- package/lib/web/contract.js +230 -0
- package/lib/web/contract.js.map +1 -0
- package/lib/web/contributions.d.ts +41 -0
- package/lib/web/contributions.js +61 -0
- package/lib/web/contributions.js.map +1 -0
- package/lib/web/integrations.d.ts +13 -0
- package/lib/web/integrations.js +95 -0
- package/lib/web/integrations.js.map +1 -0
- package/lib/web/projection.d.ts +10 -0
- package/lib/web/projection.js +192 -0
- package/lib/web/projection.js.map +1 -0
- package/lib/web/service.d.ts +31 -0
- package/lib/web/service.js +141 -0
- package/lib/web/service.js.map +1 -0
- package/lib/web.d.ts +5 -0
- package/lib/web.js +6 -0
- package/lib/web.js.map +1 -0
- package/lib/webhook-notification.d.ts +1 -0
- package/lib/webhook-notification.js +2 -0
- package/lib/webhook-notification.js.map +1 -0
- package/lib/workflow/index.d.ts +1 -0
- package/lib/workflow/index.js +2 -0
- package/lib/workflow/index.js.map +1 -0
- package/lib/workflow/service.d.ts +31 -0
- package/lib/workflow/service.js +220 -0
- package/lib/workflow/service.js.map +1 -0
- package/lib/workflow.d.ts +2 -0
- package/lib/workflow.js +3 -0
- package/lib/workflow.js.map +1 -0
- package/package.json +276 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { validateExecutionSettings } from '../config.js';
|
|
3
|
+
import { trackerProviderId } from '../tracker.js';
|
|
4
|
+
import { readEveryCandidate } from './candidates.js';
|
|
5
|
+
import { STATE_KEY } from './constants.js';
|
|
6
|
+
import { evaluateIssue, isPausedActiveRun, isPausedQueuedRun, matchesRetainedIssue, sameRetainedRun, validateActiveResumeFacts, } from './policy.js';
|
|
7
|
+
import { executionSchema, runIdSchema, stateSchema } from './state.js';
|
|
8
|
+
export class ResumeControl {
|
|
9
|
+
dependencies;
|
|
10
|
+
constructor(dependencies) {
|
|
11
|
+
this.dependencies = dependencies;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Revalidate an operator-held queued run against the current tracker issue and return it to the resumption queue.
|
|
15
|
+
* Requires an enabled scheduler, certain deployment usage, the selected tracker provider, one currently eligible issue,
|
|
16
|
+
* and an unchanged readiness generation and Agent Brief. Provider/read/validation failures or a concurrent durable
|
|
17
|
+
* state change preserve the hold. Success clears only the hold, keeps the run identity, and allocates no Session or
|
|
18
|
+
* worktree. Provider withdrawal owns cancellation of its read; callers cannot independently cancel this operation.
|
|
19
|
+
*/
|
|
20
|
+
async resumeRun(runId) {
|
|
21
|
+
const parsedRunId = runIdSchema.parse(runId);
|
|
22
|
+
const settings = this.dependencies.settings();
|
|
23
|
+
const providerId = trackerProviderId(settings.trackerProvider);
|
|
24
|
+
const beforeRead = this.dependencies.state();
|
|
25
|
+
if (beforeRead.scheduler.mode !== 'enabled') {
|
|
26
|
+
throw new Error('scheduler must be enabled to resume a run');
|
|
27
|
+
}
|
|
28
|
+
if (beforeRead.budget.usageUncertain) {
|
|
29
|
+
throw new Error('deployment token usage is uncertain; reconcile it before resuming');
|
|
30
|
+
}
|
|
31
|
+
const retained = beforeRead.runs.find((run) => run.runId === parsedRunId);
|
|
32
|
+
if (retained === undefined)
|
|
33
|
+
throw new Error(`run "${parsedRunId}" does not exist`);
|
|
34
|
+
if (!isPausedQueuedRun(retained) || !retained.pause.operatorHold) {
|
|
35
|
+
throw new Error(`run "${parsedRunId}" is not paused on an operator hold`);
|
|
36
|
+
}
|
|
37
|
+
if (retained.providerId !== providerId) {
|
|
38
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed from tracker provider "${providerId}"`);
|
|
39
|
+
}
|
|
40
|
+
return this.dependencies.tracker.withProvider(providerId, async (reader) => {
|
|
41
|
+
const candidates = await readEveryCandidate(reader, providerId);
|
|
42
|
+
const matches = candidates.filter((issue) => issue.bindingId === retained.bindingId && issue.issueId === retained.issueId);
|
|
43
|
+
if (matches.length !== 1) {
|
|
44
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because its tracker issue is not uniquely current`);
|
|
45
|
+
}
|
|
46
|
+
const issue = matches[0];
|
|
47
|
+
if (issue === undefined)
|
|
48
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed without its tracker issue`);
|
|
49
|
+
const evaluation = evaluateIssue(issue, settings.maxBriefBytes);
|
|
50
|
+
if ('reason' in evaluation) {
|
|
51
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because tracker eligibility is ${evaluation.reason}`);
|
|
52
|
+
}
|
|
53
|
+
if (!matchesRetainedIssue(retained, providerId, evaluation)) {
|
|
54
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because its tracker authorization changed`);
|
|
55
|
+
}
|
|
56
|
+
let resumed;
|
|
57
|
+
await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
58
|
+
if (current.scheduler.mode !== 'enabled') {
|
|
59
|
+
throw new Error('scheduler must be enabled to resume a run');
|
|
60
|
+
}
|
|
61
|
+
if (current.budget.usageUncertain) {
|
|
62
|
+
throw new Error('deployment token usage is uncertain; reconcile it before resuming');
|
|
63
|
+
}
|
|
64
|
+
const currentSettings = this.dependencies.settings();
|
|
65
|
+
if (trackerProviderId(currentSettings.trackerProvider) !== providerId) {
|
|
66
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because the selected tracker provider changed`);
|
|
67
|
+
}
|
|
68
|
+
const currentEvaluation = evaluateIssue(issue, currentSettings.maxBriefBytes);
|
|
69
|
+
if ('reason' in currentEvaluation) {
|
|
70
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because current tracker eligibility is ${currentEvaluation.reason}`);
|
|
71
|
+
}
|
|
72
|
+
const index = current.runs.findIndex((run) => run.runId === parsedRunId);
|
|
73
|
+
const run = current.runs[index];
|
|
74
|
+
if (!isPausedQueuedRun(run) || !run.pause.operatorHold) {
|
|
75
|
+
throw new Error(`run "${parsedRunId}" is not paused on an operator hold`);
|
|
76
|
+
}
|
|
77
|
+
if (!sameRetainedRun(run, retained) || !matchesRetainedIssue(run, providerId, currentEvaluation)) {
|
|
78
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because its retained identity changed`);
|
|
79
|
+
}
|
|
80
|
+
const { pause: _pause, ...queued } = structuredClone(run);
|
|
81
|
+
resumed = { ...queued, state: 'queued', queueClass: 'resumption' };
|
|
82
|
+
const next = structuredClone(current);
|
|
83
|
+
next.runs[index] = resumed;
|
|
84
|
+
next.revision += 1;
|
|
85
|
+
return stateSchema.parse(next);
|
|
86
|
+
});
|
|
87
|
+
if (resumed === undefined)
|
|
88
|
+
throw new Error(`run "${parsedRunId}" was not resumed`);
|
|
89
|
+
return structuredClone(resumed);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Revalidate an allocated pause against the current tracker and execution policy, then atomically reserve the retained
|
|
94
|
+
* run's remaining token cap and return it to `implementing`. The caller must first prove the retained Session readable
|
|
95
|
+
* and supply exact current Git facts. Scheduler authorization cannot clear an operator hold; explicit operator
|
|
96
|
+
* authorization can. Any failed or concurrent check leaves the pause unchanged.
|
|
97
|
+
*/
|
|
98
|
+
async resumeActiveRun(runId, observedGit, authorization) {
|
|
99
|
+
const parsedRunId = runIdSchema.parse(runId);
|
|
100
|
+
const parsedGit = executionSchema.shape.git.unwrap().parse(observedGit);
|
|
101
|
+
const settings = this.dependencies.settings();
|
|
102
|
+
validateExecutionSettings(settings);
|
|
103
|
+
const providerId = trackerProviderId(settings.trackerProvider);
|
|
104
|
+
const beforeRead = this.dependencies.state();
|
|
105
|
+
if (beforeRead.scheduler.mode !== 'enabled')
|
|
106
|
+
throw new Error('scheduler must be enabled to resume a run');
|
|
107
|
+
if (beforeRead.budget.usageUncertain) {
|
|
108
|
+
throw new Error('deployment token usage is uncertain; reconcile it before resuming');
|
|
109
|
+
}
|
|
110
|
+
const retained = beforeRead.runs.find((run) => run.runId === parsedRunId);
|
|
111
|
+
if (!isPausedActiveRun(retained))
|
|
112
|
+
throw new Error(`run "${parsedRunId}" is not an allocated paused run`);
|
|
113
|
+
validateActiveResumeFacts(retained, parsedGit, settings, authorization);
|
|
114
|
+
return this.dependencies.tracker.withProvider(providerId, async (reader) => {
|
|
115
|
+
const candidates = await readEveryCandidate(reader, providerId);
|
|
116
|
+
const matches = candidates.filter((issue) => issue.bindingId === retained.bindingId && issue.issueId === retained.issueId);
|
|
117
|
+
if (matches.length !== 1) {
|
|
118
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because its tracker issue is not uniquely current`);
|
|
119
|
+
}
|
|
120
|
+
const issue = matches[0];
|
|
121
|
+
if (issue === undefined)
|
|
122
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed without its tracker issue`);
|
|
123
|
+
const evaluation = evaluateIssue(issue, settings.maxBriefBytes);
|
|
124
|
+
if ('reason' in evaluation || !matchesRetainedIssue(retained, providerId, evaluation)) {
|
|
125
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because its tracker authorization changed`);
|
|
126
|
+
}
|
|
127
|
+
let resumed;
|
|
128
|
+
await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
129
|
+
const currentSettings = this.dependencies.settings();
|
|
130
|
+
if (current.scheduler.mode !== 'enabled')
|
|
131
|
+
throw new Error('scheduler must be enabled to resume a run');
|
|
132
|
+
if (current.budget.usageUncertain) {
|
|
133
|
+
throw new Error('deployment token usage is uncertain; reconcile it before resuming');
|
|
134
|
+
}
|
|
135
|
+
if (trackerProviderId(currentSettings.trackerProvider) !== providerId) {
|
|
136
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because the selected tracker provider changed`);
|
|
137
|
+
}
|
|
138
|
+
const currentEvaluation = evaluateIssue(issue, currentSettings.maxBriefBytes);
|
|
139
|
+
const index = current.runs.findIndex((run) => run.runId === parsedRunId);
|
|
140
|
+
const run = current.runs[index];
|
|
141
|
+
if (!isPausedActiveRun(run))
|
|
142
|
+
throw new Error(`run "${parsedRunId}" is no longer paused`);
|
|
143
|
+
if ('reason' in currentEvaluation ||
|
|
144
|
+
!matchesRetainedIssue(run, providerId, currentEvaluation) ||
|
|
145
|
+
JSON.stringify(run) !== JSON.stringify(retained)) {
|
|
146
|
+
throw new Error(`run "${parsedRunId}" cannot be resumed because its retained authorization changed`);
|
|
147
|
+
}
|
|
148
|
+
validateActiveResumeFacts(run, parsedGit, currentSettings, authorization);
|
|
149
|
+
const reservation = Math.min(run.budget.allowanceTokens, run.budget.capTokens - run.budget.settledTokens);
|
|
150
|
+
if (current.budget.settledTokens + current.budget.reservedTokens + reservation >
|
|
151
|
+
currentSettings.deploymentTokenCap) {
|
|
152
|
+
throw new Error('deployment token cap cannot cover the retained run continuation');
|
|
153
|
+
}
|
|
154
|
+
const { pause: _pause, ...allocated } = structuredClone(run);
|
|
155
|
+
resumed = {
|
|
156
|
+
...allocated,
|
|
157
|
+
state: 'implementing',
|
|
158
|
+
queueClass: 'resumption',
|
|
159
|
+
execution: { ...allocated.execution, attempt: allocated.execution.attempt + 1 },
|
|
160
|
+
budget: { ...allocated.budget, reservedTokens: reservation },
|
|
161
|
+
};
|
|
162
|
+
const next = structuredClone(current);
|
|
163
|
+
next.runs[index] = resumed;
|
|
164
|
+
next.budget.reservedTokens += reservation;
|
|
165
|
+
next.revision += 1;
|
|
166
|
+
return stateSchema.parse(next);
|
|
167
|
+
});
|
|
168
|
+
if (resumed === undefined)
|
|
169
|
+
throw new Error(`run "${parsedRunId}" was not resumed`);
|
|
170
|
+
return structuredClone(resumed);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Persist a definite retained-resource incompatibility discovered before an allocated pause can resume. The run must
|
|
175
|
+
* still be the same durable active pause; an identical recovery reason is idempotent. This operation starts no Agent,
|
|
176
|
+
* releases no retained identity, and accepts no caller cancellation signal.
|
|
177
|
+
*/
|
|
178
|
+
async requireActiveRecovery(runId, reason) {
|
|
179
|
+
const parsedRunId = runIdSchema.parse(runId);
|
|
180
|
+
const parsedReason = z
|
|
181
|
+
.enum(['composition-unavailable', 'session-unavailable', 'workspace-unavailable', 'worktree-mismatch'])
|
|
182
|
+
.parse(reason);
|
|
183
|
+
let recovery;
|
|
184
|
+
await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
185
|
+
const index = current.runs.findIndex((run) => run.runId === parsedRunId);
|
|
186
|
+
const run = current.runs[index];
|
|
187
|
+
if (!isPausedActiveRun(run))
|
|
188
|
+
throw new Error(`run "${parsedRunId}" is no longer an allocated pause`);
|
|
189
|
+
if (run.execution.recovery?.reason === parsedReason) {
|
|
190
|
+
recovery = structuredClone(run);
|
|
191
|
+
return current;
|
|
192
|
+
}
|
|
193
|
+
if (run.execution.recovery !== undefined) {
|
|
194
|
+
throw new Error(`run "${parsedRunId}" already requires ${run.execution.recovery.reason} recovery`);
|
|
195
|
+
}
|
|
196
|
+
recovery = {
|
|
197
|
+
...structuredClone(run),
|
|
198
|
+
execution: {
|
|
199
|
+
...structuredClone(run.execution),
|
|
200
|
+
recovery: { kind: 'required', reason: parsedReason, interruptedAt: new Date().toISOString() },
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
const next = structuredClone(current);
|
|
204
|
+
next.runs[index] = recovery;
|
|
205
|
+
next.revision += 1;
|
|
206
|
+
return stateSchema.parse(next);
|
|
207
|
+
});
|
|
208
|
+
if (recovery === undefined)
|
|
209
|
+
throw new Error(`run "${parsedRunId}" recovery requirement was not recorded`);
|
|
210
|
+
return structuredClone(recovery);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=resume-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-control.js","sourceRoot":"","sources":["../../src/admission/resume-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,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,KAAK,CAAC,QAAQ,WAAW,mCAAmC,CAAC,CAAA;YACpG,IAAI,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,KAAK,YAAY,EAAE,CAAC;gBACpD,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;gBAC/B,OAAO,OAAO,CAAA;YAChB,CAAC;YACD,IAAI,GAAG,CAAC,SAAS,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,QAAQ,WAAW,sBAAsB,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,WAAW,CAAC,CAAA;YACpG,CAAC;YAED,QAAQ,GAAG;gBACT,GAAG,eAAe,CAAC,GAAG,CAAC;gBACvB,SAAS,EAAE;oBACT,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC;oBACjC,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;iBAC9F;aACF,CAAA;YACD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;YACrC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAA;YAC3B,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA;YAClB,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC,CAAC,CAAA;QACF,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,WAAW,yCAAyC,CAAC,CAAA;QACzG,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RunId } from './model.js';
|
|
2
|
+
/** Serialize lifecycle and maintenance work for one run and fence stale observations with a process-local generation. */
|
|
3
|
+
export declare class RunOperationFence {
|
|
4
|
+
private readonly entries;
|
|
5
|
+
generation(runId: RunId): number;
|
|
6
|
+
exclusive<T>(runId: RunId, operation: () => Promise<T>): Promise<T>;
|
|
7
|
+
mutate<T>(runId: RunId, operation: () => Promise<T>): Promise<T>;
|
|
8
|
+
mutateMany<T>(runIds: readonly RunId[], operation: () => Promise<T>): Promise<T>;
|
|
9
|
+
private lock;
|
|
10
|
+
private entry;
|
|
11
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Serialize lifecycle and maintenance work for one run and fence stale observations with a process-local generation. */
|
|
2
|
+
export class RunOperationFence {
|
|
3
|
+
entries = new Map();
|
|
4
|
+
generation(runId) {
|
|
5
|
+
return this.entry(runId).generation;
|
|
6
|
+
}
|
|
7
|
+
exclusive(runId, operation) {
|
|
8
|
+
return this.lock(runId, operation, false);
|
|
9
|
+
}
|
|
10
|
+
mutate(runId, operation) {
|
|
11
|
+
return this.lock(runId, operation, true);
|
|
12
|
+
}
|
|
13
|
+
async mutateMany(runIds, operation) {
|
|
14
|
+
const ordered = [...new Set(runIds)].sort();
|
|
15
|
+
const lockAt = async (index) => {
|
|
16
|
+
const runId = ordered[index];
|
|
17
|
+
return runId === undefined ? await operation() : await this.lock(runId, () => lockAt(index + 1), true);
|
|
18
|
+
};
|
|
19
|
+
return await lockAt(0);
|
|
20
|
+
}
|
|
21
|
+
async lock(runId, operation, mutate) {
|
|
22
|
+
const entry = this.entry(runId);
|
|
23
|
+
const previous = entry.tail;
|
|
24
|
+
let release;
|
|
25
|
+
const current = new Promise((resolve) => {
|
|
26
|
+
release = resolve;
|
|
27
|
+
});
|
|
28
|
+
entry.tail = previous.catch(() => undefined).then(() => current);
|
|
29
|
+
await previous.catch(() => undefined);
|
|
30
|
+
try {
|
|
31
|
+
const result = await operation();
|
|
32
|
+
if (mutate)
|
|
33
|
+
entry.generation += 1;
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
release?.();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
entry(runId) {
|
|
41
|
+
let entry = this.entries.get(runId);
|
|
42
|
+
if (entry === undefined) {
|
|
43
|
+
entry = { generation: 0, tail: Promise.resolve() };
|
|
44
|
+
this.entries.set(runId, entry);
|
|
45
|
+
}
|
|
46
|
+
return entry;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=run-fence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-fence.js","sourceRoot":"","sources":["../../src/admission/run-fence.ts"],"names":[],"mappings":"AAOA,yHAAyH;AACzH,MAAM,OAAO,iBAAiB;IACX,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAA;IAE1D,UAAU,CAAC,KAAY;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,UAAU,CAAA;IACrC,CAAC;IAED,SAAS,CAAI,KAAY,EAAE,SAA2B;QACpD,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,CAAI,KAAY,EAAE,SAA2B;QACjD,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,UAAU,CAAI,MAAwB,EAAE,SAA2B;QACvE,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC3C,MAAM,MAAM,GAAG,KAAK,EAAE,KAAa,EAAc,EAAE;YACjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;YAC5B,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,IAA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,0 +1,130 @@
|
|
|
1
|
+
import { type Context, Service } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { PullRequestReceipt } from '../code-host.js';
|
|
3
|
+
import type { NotificationReceipt } from '../notification.js';
|
|
4
|
+
import type { TrackerIngressRequest, TrackerOutboundReceipt } from '../tracker.js';
|
|
5
|
+
import { type PreparedAgentComposition } from './composition-claim.js';
|
|
6
|
+
import type { ActiveRecoveryReason, ActiveResumeAuthorization, AdmissionSnapshot, CancelledRun, DeliveryRecord, ExecutionOutcome, GitExecutionSnapshot, ImplementingRun, PausedActiveRun, PausedQueuedRun, PausingRun, QueuedRun, ReconcileRequest, ReconcileResult, RunId, RunUsageSettlement, SchedulerDisableResult, SchedulerMode, TerminalRun } from './model.js';
|
|
7
|
+
import { RunOperationFence } from './run-fence.js';
|
|
8
|
+
import { type OperatorCommandKind, type OperatorCommandRecord } from './state.js';
|
|
9
|
+
export interface OperatorCommandRequest {
|
|
10
|
+
readonly requestId: string;
|
|
11
|
+
readonly kind: OperatorCommandKind;
|
|
12
|
+
readonly runId?: string | undefined;
|
|
13
|
+
readonly deliveryId?: string | undefined;
|
|
14
|
+
readonly previewId?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
declare module '@deepseek-ai/cordis' {
|
|
17
|
+
interface Context {
|
|
18
|
+
admission: Admission;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export declare class Admission extends Service {
|
|
22
|
+
static readonly inject: string[];
|
|
23
|
+
private state?;
|
|
24
|
+
readonly runOperations: RunOperationFence;
|
|
25
|
+
constructor(ctx: Context);
|
|
26
|
+
[Service.init](): AsyncGenerator<() => Promise<void>, void, void>;
|
|
27
|
+
/**
|
|
28
|
+
* Return a detached view with active work first, then queued work in dispatch order, then retained inactive runs.
|
|
29
|
+
* Throws if the service has not finished initialization; it performs no I/O and has no cancellation point.
|
|
30
|
+
*/
|
|
31
|
+
snapshot(): AdmissionSnapshot;
|
|
32
|
+
/** Atomically retain one accepted operator command before its effect starts, deduplicated by caller request id. */
|
|
33
|
+
acceptOperatorCommand(request: OperatorCommandRequest): Promise<{
|
|
34
|
+
readonly command: OperatorCommandRecord;
|
|
35
|
+
readonly created: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
/** Persist a command transition in the same authoritative aggregate as the run/scheduler effect. */
|
|
38
|
+
updateOperatorCommand(requestId: string, patch: Pick<OperatorCommandRecord, 'status'> & Partial<Pick<OperatorCommandRecord, 'finishedAt' | 'message' | 'revision'>>): Promise<OperatorCommandRecord>;
|
|
39
|
+
operatorCommand(requestId: string): OperatorCommandRecord | undefined;
|
|
40
|
+
operatorCommands(): OperatorCommandRecord[];
|
|
41
|
+
/** Explain whether durable runs or outbound intents still depend on one tracker configuration. */
|
|
42
|
+
trackerSwitchBlocker(providerId: string): string | undefined;
|
|
43
|
+
/** Explain whether admitted runs still depend on one code-host provider selection. */
|
|
44
|
+
codeHostSwitchBlocker(providerId: string): string | undefined;
|
|
45
|
+
/** Prevent one provider id from being rebound while queued work or durable run history still names that binding. */
|
|
46
|
+
codeHostBindingSwitchBlocker(providerId: string): string | undefined;
|
|
47
|
+
/** Explain whether unallocated admitted work would be redirected by an execution-routing Settings change. */
|
|
48
|
+
executionRoutingSwitchBlocker(): string | undefined;
|
|
49
|
+
/** Atomically change the admission/dequeue gate; rejects invalid modes or unsafe disable and has no cancellation point. */
|
|
50
|
+
setSchedulerMode(mode: SchedulerMode): Promise<AdmissionSnapshot>;
|
|
51
|
+
/**
|
|
52
|
+
* Persist a draining/disabled transition and pause requests for active work.
|
|
53
|
+
* Rejects storage/schema failures; returned run ids still require the dispatcher to reach quiescence.
|
|
54
|
+
*/
|
|
55
|
+
requestSchedulerDisable(): Promise<SchedulerDisableResult>;
|
|
56
|
+
/** Persist service-withdrawal pause requests for active runs; it does not itself cancel agents or accept cancellation. */
|
|
57
|
+
requestServiceWithdrawalPause(): Promise<RunId[]>;
|
|
58
|
+
/** Request an operator pause for one active run; rejects missing/terminal runs and performs no agent cancellation itself. */
|
|
59
|
+
requestRunPause(runId: RunId): Promise<PausingRun | PausedActiveRun>;
|
|
60
|
+
/**
|
|
61
|
+
* Commit a quiescent active-run pause after the dispatcher has observed Git and usage.
|
|
62
|
+
* Rejects stale/non-pausing runs, invalid facts, or durable-write failures; no caller cancellation is accepted.
|
|
63
|
+
*/
|
|
64
|
+
checkpointPaused(runId: RunId, git: GitExecutionSnapshot, usage: RunUsageSettlement): Promise<PausedActiveRun>;
|
|
65
|
+
/** Persist an operator hold for queued work before resources are allocated; rejects non-queued runs. */
|
|
66
|
+
holdQueued(runId: RunId): Promise<PausedQueuedRun>;
|
|
67
|
+
/** End one quiescent queued, paused, or blocked run without authorizing tracker or resource side effects. */
|
|
68
|
+
cancelRun(runId: RunId, requestId: string): Promise<CancelledRun>;
|
|
69
|
+
/** Revalidate and return operator-held queued work to dispatch order; rejects changed eligibility or disabled admission. */
|
|
70
|
+
resumeRun(runId: RunId): Promise<QueuedRun>;
|
|
71
|
+
/**
|
|
72
|
+
* Revalidate retained issue, Session/worktree Git facts, scheduler and budget before active continuation.
|
|
73
|
+
* Rejects unauthorized/stale recovery and durable failures; it allocates no external resource and has no cancellation.
|
|
74
|
+
*/
|
|
75
|
+
resumeActiveRun(runId: RunId, observedGit: GitExecutionSnapshot, authorization: ActiveResumeAuthorization): Promise<ImplementingRun>;
|
|
76
|
+
/** Persist a bounded explicit-recovery requirement for an allocated paused run; rejects incompatible lifecycle state. */
|
|
77
|
+
requireActiveRecovery(runId: RunId, reason: ActiveRecoveryReason): Promise<PausedActiveRun>;
|
|
78
|
+
/** Atomically claim and reserve the next eligible queued run, or return undefined; rejects invalid settings/state. */
|
|
79
|
+
claimNext(preparedAgent: PreparedAgentComposition): Promise<ImplementingRun | undefined>;
|
|
80
|
+
/** Persist verified worktree ownership facts for the claimed run; rejects stale identity, invalid Git facts or writes. */
|
|
81
|
+
recordWorktree(runId: RunId, git: GitExecutionSnapshot): Promise<ImplementingRun | PausingRun>;
|
|
82
|
+
/** Atomically settle one implementing run and its usage reservation; rejects mismatched outcomes or stale state. */
|
|
83
|
+
settle(runId: RunId, outcome: ExecutionOutcome, usage: RunUsageSettlement): Promise<TerminalRun>;
|
|
84
|
+
/** Claim one persisted publication intent for the sole Host publisher; no external side effect occurs. */
|
|
85
|
+
claimPublication(runId: RunId): Promise<{
|
|
86
|
+
run: TerminalRun;
|
|
87
|
+
owner: string;
|
|
88
|
+
}>;
|
|
89
|
+
/** Fail if a publication worker no longer owns the current durable intent; this check performs no I/O. */
|
|
90
|
+
assertPublicationOwner(runId: RunId, owner: string): void;
|
|
91
|
+
/** Persist a reconciled remote branch receipt while retaining publication ownership. */
|
|
92
|
+
recordPublicationBranch(runId: RunId, owner: string, remoteHead: string): Promise<TerminalRun>;
|
|
93
|
+
/** Commit the confirmed ready PR and completed lifecycle event atomically. */
|
|
94
|
+
completePublication(runId: RunId, owner: string, receipt: PullRequestReceipt): Promise<TerminalRun>;
|
|
95
|
+
/** Persist a sanitized permanent, retryable, or ambiguous publication failure without changing verified work. */
|
|
96
|
+
failPublication(runId: RunId, owner: string, error: unknown, status: 'uncertain' | 'retryable-failure' | 'failed', retryAfterMs?: number): Promise<TerminalRun>;
|
|
97
|
+
claimDelivery(deliveryId: string): Promise<{
|
|
98
|
+
runId: RunId;
|
|
99
|
+
delivery: DeliveryRecord;
|
|
100
|
+
owner: string;
|
|
101
|
+
}>;
|
|
102
|
+
assertDeliveryOwner(runId: RunId, deliveryId: string, owner: string): void;
|
|
103
|
+
succeedDelivery(runId: RunId, deliveryId: string, owner: string, receipt: TrackerOutboundReceipt | NotificationReceipt): Promise<DeliveryRecord>;
|
|
104
|
+
failDelivery(runId: RunId, deliveryId: string, owner: string, error: unknown, status: 'uncertain' | 'retryable-failure' | 'permanent-failure', retryAfterMs?: number): Promise<DeliveryRecord>;
|
|
105
|
+
retryDelivery(deliveryId: string): Promise<DeliveryRecord>;
|
|
106
|
+
/** Replace one settled failed tracker projection after its provider mapping has been corrected. */
|
|
107
|
+
repairTrackerProjection(deliveryId: string): Promise<DeliveryRecord>;
|
|
108
|
+
/**
|
|
109
|
+
* Read the selected tracker provider and atomically admit every currently eligible issue.
|
|
110
|
+
* When the scheduler is not enabled, returns an unchanged detached snapshot without reading the provider or retaining
|
|
111
|
+
* an ingress receipt. Provider, validation, capacity, or durable-write failures reject without advancing admission
|
|
112
|
+
* state. Provider withdrawal cancels its owned reads; a caller signal fences mutation after cancellation.
|
|
113
|
+
*/
|
|
114
|
+
reconcile(request: ReconcileRequest): Promise<ReconcileResult>;
|
|
115
|
+
/** Authenticate raw tracker ingress and keep that provider generation alive through its durable admission commit. */
|
|
116
|
+
reconcileIngress(request: TrackerIngressRequest, signal?: AbortSignal): Promise<ReconcileResult>;
|
|
117
|
+
private pauseControl;
|
|
118
|
+
private cancellationControl;
|
|
119
|
+
private resumeControl;
|
|
120
|
+
private executionControl;
|
|
121
|
+
private publicationControl;
|
|
122
|
+
private deliveryControl;
|
|
123
|
+
private deliveryRunId;
|
|
124
|
+
private dependencies;
|
|
125
|
+
private currentSettings;
|
|
126
|
+
private currentTable;
|
|
127
|
+
private currentState;
|
|
128
|
+
private markInterruptedRunsForRecovery;
|
|
129
|
+
}
|
|
130
|
+
export default Admission;
|