@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,296 @@
|
|
|
1
|
+
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
2
|
+
import type { CodeHostBindingId, CodeHostProviderId, CodeHostRepositoryId, PullRequestReceipt } from '../code-host.js';
|
|
3
|
+
import type { NotificationEvent } from '../notification.js';
|
|
4
|
+
import type { ReadinessGeneration, TrackerBindingId, TrackerCommentId, TrackerIssueId, TrackerProviderId } from '../tracker.js';
|
|
5
|
+
declare const runIdBrand: unique symbol;
|
|
6
|
+
export type RunId = string & {
|
|
7
|
+
readonly [runIdBrand]: true;
|
|
8
|
+
};
|
|
9
|
+
export type AdmissionSource = 'manual' | 'scheduled' | 'startup' | 'webhook';
|
|
10
|
+
export type SchedulerMode = 'enabled' | 'draining' | 'disabled';
|
|
11
|
+
export interface SchedulerSnapshot {
|
|
12
|
+
readonly mode: SchedulerMode;
|
|
13
|
+
readonly changedAt: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ReconcileRequest {
|
|
16
|
+
source: AdmissionSource;
|
|
17
|
+
deliveryId?: string;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
/** Bounded core failure proving that tracker ingress was not durably accepted. */
|
|
21
|
+
export declare class AdmissionIngressError extends Error {
|
|
22
|
+
readonly code: 'queue-capacity' | 'not-accepting';
|
|
23
|
+
/** Construct a caller-safe ingress failure; this operation has no side effects or cancellation point. */
|
|
24
|
+
constructor(code: 'queue-capacity' | 'not-accepting');
|
|
25
|
+
}
|
|
26
|
+
export type AdmissionRejectionReason = 'missing-brief' | 'ambiguous-brief' | 'invalid-brief' | 'brief-too-large' | 'summary-too-large' | 'not-ready' | 'dependencies-incomplete' | 'dependency-unknown' | 'human-readiness-required';
|
|
27
|
+
export type AdmissionDecision = {
|
|
28
|
+
displayKey: string;
|
|
29
|
+
outcome: 'queued' | 'duplicate';
|
|
30
|
+
} | {
|
|
31
|
+
displayKey: string;
|
|
32
|
+
outcome: 'deferred';
|
|
33
|
+
reason: 'queue-capacity';
|
|
34
|
+
} | {
|
|
35
|
+
displayKey: string;
|
|
36
|
+
outcome: 'rejected';
|
|
37
|
+
reason: AdmissionRejectionReason;
|
|
38
|
+
};
|
|
39
|
+
export interface AgentBriefSnapshot {
|
|
40
|
+
readonly commentId: TrackerCommentId;
|
|
41
|
+
readonly updatedAt: string;
|
|
42
|
+
readonly digest: string;
|
|
43
|
+
readonly content: string;
|
|
44
|
+
}
|
|
45
|
+
export interface QueuedRun {
|
|
46
|
+
readonly runId: RunId;
|
|
47
|
+
readonly providerId: TrackerProviderId;
|
|
48
|
+
readonly bindingId: TrackerBindingId;
|
|
49
|
+
readonly issueId: TrackerIssueId;
|
|
50
|
+
readonly displayKey: string;
|
|
51
|
+
readonly summary: string;
|
|
52
|
+
readonly priorityRank: number;
|
|
53
|
+
readonly readinessGeneration: ReadinessGeneration;
|
|
54
|
+
readonly brief: AgentBriefSnapshot;
|
|
55
|
+
readonly deliveries: DeliveryRecord[];
|
|
56
|
+
readonly state: 'queued';
|
|
57
|
+
readonly queueClass: 'new' | 'resumption';
|
|
58
|
+
readonly queuedAt: string;
|
|
59
|
+
readonly queueSequence: number;
|
|
60
|
+
}
|
|
61
|
+
export interface PausedQueuedRun extends Omit<QueuedRun, 'state' | 'queueClass'> {
|
|
62
|
+
readonly state: 'paused';
|
|
63
|
+
readonly queueClass: 'resumption';
|
|
64
|
+
readonly pause: {
|
|
65
|
+
readonly kind: 'queued';
|
|
66
|
+
readonly reason: 'operator';
|
|
67
|
+
readonly operatorHold: true;
|
|
68
|
+
readonly continuationTarget: 'implementing';
|
|
69
|
+
readonly pausedAt: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export type ActivePauseReason = 'operator' | 'scheduler' | 'service-withdrawal';
|
|
73
|
+
export type ActiveResumeAuthorization = 'operator' | 'scheduler';
|
|
74
|
+
export interface ActivePauseSnapshot {
|
|
75
|
+
readonly kind: 'active';
|
|
76
|
+
readonly reason: ActivePauseReason;
|
|
77
|
+
readonly operatorHold: boolean;
|
|
78
|
+
readonly continuationTarget: 'implementing';
|
|
79
|
+
readonly requestedAt: string;
|
|
80
|
+
readonly interruptedOperation: 'agent-turn';
|
|
81
|
+
}
|
|
82
|
+
/** Exact DSH composition captured for a run before it leaves the queue. */
|
|
83
|
+
export interface AgentExecutionComposition {
|
|
84
|
+
readonly presetId: string;
|
|
85
|
+
readonly presetFingerprint: string;
|
|
86
|
+
readonly permission: {
|
|
87
|
+
readonly presetId: string;
|
|
88
|
+
readonly sandbox: 'read-only' | 'workspace-write' | 'danger-full-access';
|
|
89
|
+
readonly approval: 'never';
|
|
90
|
+
};
|
|
91
|
+
readonly model: {
|
|
92
|
+
readonly provider: string;
|
|
93
|
+
readonly model: string;
|
|
94
|
+
readonly reasoningEffort?: string | undefined;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export interface RunExecutionSnapshot {
|
|
98
|
+
readonly attempt: number;
|
|
99
|
+
readonly sessionId: SessionId;
|
|
100
|
+
readonly targetRepository: string;
|
|
101
|
+
readonly baseBranch: string;
|
|
102
|
+
readonly worktreePath: string;
|
|
103
|
+
readonly branch: string;
|
|
104
|
+
/** Absent only on durable records created before native DSH composition was captured. */
|
|
105
|
+
readonly agent?: AgentExecutionComposition | undefined;
|
|
106
|
+
readonly codeHost: {
|
|
107
|
+
readonly providerId: CodeHostProviderId;
|
|
108
|
+
readonly bindingId: CodeHostBindingId;
|
|
109
|
+
readonly repositoryId: CodeHostRepositoryId;
|
|
110
|
+
readonly repository: string;
|
|
111
|
+
readonly allowWorkflowChanges: boolean;
|
|
112
|
+
};
|
|
113
|
+
readonly startedAt: string;
|
|
114
|
+
readonly git?: GitExecutionSnapshot | undefined;
|
|
115
|
+
readonly recovery?: RunRecoverySnapshot | undefined;
|
|
116
|
+
}
|
|
117
|
+
export interface GitExecutionSnapshot {
|
|
118
|
+
readonly baseHead: string;
|
|
119
|
+
readonly head: string;
|
|
120
|
+
readonly status: string;
|
|
121
|
+
}
|
|
122
|
+
export interface RunRecoverySnapshot {
|
|
123
|
+
readonly kind: 'required';
|
|
124
|
+
readonly reason: 'host-restart' | 'composition-unavailable' | 'session-unavailable' | 'workspace-unavailable' | 'worktree-mismatch';
|
|
125
|
+
readonly interruptedAt: string;
|
|
126
|
+
}
|
|
127
|
+
export type ActiveRecoveryReason = Exclude<RunRecoverySnapshot['reason'], 'host-restart'>;
|
|
128
|
+
export interface RunBudgetSnapshot {
|
|
129
|
+
readonly capTokens: number;
|
|
130
|
+
readonly allowanceTokens: number;
|
|
131
|
+
readonly reservedTokens: number;
|
|
132
|
+
readonly settledTokens: number;
|
|
133
|
+
readonly usageUncertain: boolean;
|
|
134
|
+
readonly usageUncertaintyReason?: string | undefined;
|
|
135
|
+
}
|
|
136
|
+
export interface ImplementingRun extends Omit<QueuedRun, 'state'> {
|
|
137
|
+
readonly state: 'implementing';
|
|
138
|
+
readonly execution: RunExecutionSnapshot;
|
|
139
|
+
readonly budget: RunBudgetSnapshot;
|
|
140
|
+
}
|
|
141
|
+
export interface PausingRun extends Omit<ImplementingRun, 'state'> {
|
|
142
|
+
readonly state: 'pausing';
|
|
143
|
+
readonly pause: ActivePauseSnapshot;
|
|
144
|
+
}
|
|
145
|
+
export interface PausedActiveRun extends Omit<ImplementingRun, 'state'> {
|
|
146
|
+
readonly state: 'paused';
|
|
147
|
+
readonly pause: ActivePauseSnapshot & {
|
|
148
|
+
readonly pausedAt: string;
|
|
149
|
+
readonly lastCompletedPhase: 'agent-quiescent';
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export type ExecutionOutcome = {
|
|
153
|
+
readonly kind: 'verified';
|
|
154
|
+
readonly summary: string;
|
|
155
|
+
readonly evidence: string[];
|
|
156
|
+
readonly reportedGit: Pick<GitExecutionSnapshot, 'head' | 'status'>;
|
|
157
|
+
readonly verification: VerificationResult[];
|
|
158
|
+
readonly suggestedPullRequest: SuggestedPullRequest;
|
|
159
|
+
} | {
|
|
160
|
+
readonly kind: 'blocked';
|
|
161
|
+
readonly summary: string;
|
|
162
|
+
readonly evidence: string[];
|
|
163
|
+
} | {
|
|
164
|
+
readonly kind: 'failed';
|
|
165
|
+
readonly summary: string;
|
|
166
|
+
readonly evidence: string[];
|
|
167
|
+
};
|
|
168
|
+
export interface TerminalRun extends Omit<QueuedRun, 'state'> {
|
|
169
|
+
readonly state: 'publishing' | 'completed' | 'blocked' | 'failed';
|
|
170
|
+
readonly execution: RunExecutionSnapshot;
|
|
171
|
+
readonly budget: RunBudgetSnapshot;
|
|
172
|
+
readonly outcome: ExecutionOutcome;
|
|
173
|
+
readonly completedAt: string;
|
|
174
|
+
readonly publication?: PublicationIntent | undefined;
|
|
175
|
+
}
|
|
176
|
+
export type RunCancellationSource = 'queued' | 'paused-queued' | 'paused-active' | 'blocked';
|
|
177
|
+
export interface RunCancellationSnapshot<Source extends RunCancellationSource = RunCancellationSource> {
|
|
178
|
+
readonly requestId: string;
|
|
179
|
+
readonly cancelledAt: string;
|
|
180
|
+
readonly from: Source;
|
|
181
|
+
}
|
|
182
|
+
export interface CancelledQueuedRun extends Omit<QueuedRun, 'state'> {
|
|
183
|
+
readonly state: 'cancelled';
|
|
184
|
+
readonly cancellation: RunCancellationSnapshot<'queued'>;
|
|
185
|
+
}
|
|
186
|
+
export interface CancelledPausedQueuedRun extends Omit<PausedQueuedRun, 'state'> {
|
|
187
|
+
readonly state: 'cancelled';
|
|
188
|
+
readonly cancellation: RunCancellationSnapshot<'paused-queued'>;
|
|
189
|
+
}
|
|
190
|
+
export interface CancelledPausedActiveRun extends Omit<PausedActiveRun, 'state'> {
|
|
191
|
+
readonly state: 'cancelled';
|
|
192
|
+
readonly cancellation: RunCancellationSnapshot<'paused-active'>;
|
|
193
|
+
}
|
|
194
|
+
export interface CancelledBlockedRun extends Omit<TerminalRun, 'state' | 'outcome'> {
|
|
195
|
+
readonly state: 'cancelled';
|
|
196
|
+
readonly outcome: Extract<ExecutionOutcome, {
|
|
197
|
+
kind: 'blocked';
|
|
198
|
+
}>;
|
|
199
|
+
readonly cancellation: RunCancellationSnapshot<'blocked'>;
|
|
200
|
+
}
|
|
201
|
+
export type CancelledRun = CancelledQueuedRun | CancelledPausedQueuedRun | CancelledPausedActiveRun | CancelledBlockedRun;
|
|
202
|
+
export type AutopilotRun = QueuedRun | PausedQueuedRun | ImplementingRun | PausingRun | PausedActiveRun | TerminalRun | CancelledRun;
|
|
203
|
+
export type RunUsageSettlement = {
|
|
204
|
+
readonly kind: 'known';
|
|
205
|
+
readonly tokens: number;
|
|
206
|
+
} | {
|
|
207
|
+
readonly kind: 'uncertain';
|
|
208
|
+
readonly reason: string;
|
|
209
|
+
};
|
|
210
|
+
export interface AdmissionBudgetSnapshot {
|
|
211
|
+
readonly reservedTokens: number;
|
|
212
|
+
readonly settledTokens: number;
|
|
213
|
+
readonly usageUncertain: boolean;
|
|
214
|
+
}
|
|
215
|
+
export interface AdmissionSnapshot {
|
|
216
|
+
revision: number;
|
|
217
|
+
runs: readonly AutopilotRun[];
|
|
218
|
+
acceptedIngress: readonly string[];
|
|
219
|
+
budget: AdmissionBudgetSnapshot;
|
|
220
|
+
scheduler: SchedulerSnapshot;
|
|
221
|
+
}
|
|
222
|
+
export interface VerificationResult {
|
|
223
|
+
readonly command: string;
|
|
224
|
+
readonly status: 'passed' | 'failed' | 'skipped';
|
|
225
|
+
readonly summary: string;
|
|
226
|
+
readonly reason?: string | undefined;
|
|
227
|
+
}
|
|
228
|
+
export interface SuggestedPullRequest {
|
|
229
|
+
readonly title: string;
|
|
230
|
+
readonly body: string;
|
|
231
|
+
}
|
|
232
|
+
export interface PublicationIntent {
|
|
233
|
+
readonly id: string;
|
|
234
|
+
readonly revision: number;
|
|
235
|
+
readonly providerId: CodeHostProviderId;
|
|
236
|
+
readonly bindingId: CodeHostBindingId;
|
|
237
|
+
readonly repositoryId: CodeHostRepositoryId;
|
|
238
|
+
readonly repository: string;
|
|
239
|
+
readonly baseBranch: string;
|
|
240
|
+
readonly headBranch: string;
|
|
241
|
+
readonly baseHead: string;
|
|
242
|
+
readonly localHead: string;
|
|
243
|
+
readonly marker: string;
|
|
244
|
+
readonly title: string;
|
|
245
|
+
readonly body: string;
|
|
246
|
+
readonly status: 'pending' | 'in-flight' | 'uncertain' | 'retryable-failure' | 'exhausted' | 'failed' | 'succeeded';
|
|
247
|
+
readonly attempts: number;
|
|
248
|
+
readonly owner?: string | undefined;
|
|
249
|
+
readonly nextRetryAt?: string | undefined;
|
|
250
|
+
readonly exhaustedFrom?: 'uncertain' | 'retryable-failure' | undefined;
|
|
251
|
+
readonly lastError?: string | undefined;
|
|
252
|
+
readonly branchReceipt?: {
|
|
253
|
+
readonly remoteHead: string;
|
|
254
|
+
readonly receivedAt: string;
|
|
255
|
+
} | undefined;
|
|
256
|
+
readonly receipt?: PullRequestReceipt | undefined;
|
|
257
|
+
}
|
|
258
|
+
export interface DeliveryRecordBase {
|
|
259
|
+
readonly id: string;
|
|
260
|
+
readonly eventId: string;
|
|
261
|
+
readonly revision: number;
|
|
262
|
+
readonly status: 'pending' | 'in-flight' | 'uncertain' | 'retryable-failure' | 'exhausted' | 'permanent-failure' | 'succeeded' | 'retired';
|
|
263
|
+
readonly attempts: number;
|
|
264
|
+
readonly owner?: string | undefined;
|
|
265
|
+
readonly nextRetryAt?: string | undefined;
|
|
266
|
+
readonly exhaustedFrom?: 'uncertain' | 'retryable-failure' | undefined;
|
|
267
|
+
readonly lastError?: string | undefined;
|
|
268
|
+
readonly receiptId?: string | undefined;
|
|
269
|
+
readonly receivedAt?: string | undefined;
|
|
270
|
+
}
|
|
271
|
+
export type DeliveryRecord = (DeliveryRecordBase & {
|
|
272
|
+
readonly kind: 'tracker-report';
|
|
273
|
+
readonly providerId: TrackerProviderId;
|
|
274
|
+
readonly payload: Extract<import('../tracker.js').TrackerOutboundDelivery, {
|
|
275
|
+
kind: 'report';
|
|
276
|
+
}>;
|
|
277
|
+
}) | (DeliveryRecordBase & {
|
|
278
|
+
readonly kind: 'tracker-projection';
|
|
279
|
+
readonly providerId: TrackerProviderId;
|
|
280
|
+
readonly payload: Extract<import('../tracker.js').TrackerOutboundDelivery, {
|
|
281
|
+
kind: 'projection';
|
|
282
|
+
}>;
|
|
283
|
+
}) | (DeliveryRecordBase & {
|
|
284
|
+
readonly kind: 'notification';
|
|
285
|
+
readonly providerId: import('../notification.js').NotificationProviderId;
|
|
286
|
+
readonly destinationId: import('../notification.js').NotificationDestinationId;
|
|
287
|
+
readonly payload: NotificationEvent;
|
|
288
|
+
});
|
|
289
|
+
export interface ReconcileResult extends AdmissionSnapshot {
|
|
290
|
+
decisions: readonly AdmissionDecision[];
|
|
291
|
+
}
|
|
292
|
+
export interface SchedulerDisableResult {
|
|
293
|
+
readonly snapshot: AdmissionSnapshot;
|
|
294
|
+
readonly pausingRunIds: readonly RunId[];
|
|
295
|
+
}
|
|
296
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Bounded core failure proving that tracker ingress was not durably accepted. */
|
|
2
|
+
export class AdmissionIngressError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
/** Construct a caller-safe ingress failure; this operation has no side effects or cancellation point. */
|
|
5
|
+
constructor(code) {
|
|
6
|
+
super(code === 'queue-capacity'
|
|
7
|
+
? 'Admission queue capacity deferred eligible tracker work.'
|
|
8
|
+
: 'Admission is not accepting tracker ingress.');
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.name = 'AdmissionIngressError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/admission/model.ts"],"names":[],"mappings":"AA4BA,kFAAkF;AAClF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAEzB,IAAI;IADzB,yGAAyG;IACzG,YAAqB,IAAwC;QAC3D,KAAK,CACH,IAAI,KAAK,gBAAgB;YACvB,CAAC,CAAC,0DAA0D;YAC5D,CAAC,CAAC,6CAA6C,CAClD,CAAA;oBALkB,IAAI;QAMvB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AdmissionSnapshot, GitExecutionSnapshot, PausedActiveRun, PausedQueuedRun, PausingRun, RunId, RunUsageSettlement, SchedulerDisableResult, SchedulerMode } from './model.js';
|
|
2
|
+
import type { AdmissionDependencies } from './ports.js';
|
|
3
|
+
export declare class PauseControl {
|
|
4
|
+
private readonly dependencies;
|
|
5
|
+
constructor(dependencies: AdmissionDependencies);
|
|
6
|
+
/**
|
|
7
|
+
* Atomically persist the scheduler admission/claim gate and return a detached aggregate snapshot. Draining permits
|
|
8
|
+
* implementing runs to settle; disabling rejects while any run is implementing. Invalid input or durable-write
|
|
9
|
+
* failure leaves the previous mode unchanged. The command accepts no caller cancellation signal.
|
|
10
|
+
*/
|
|
11
|
+
setSchedulerMode(mode: SchedulerMode): Promise<AdmissionSnapshot>;
|
|
12
|
+
/**
|
|
13
|
+
* Atomically disable admission/dequeue and move every implementing run to `pausing`. The returned run ids identify
|
|
14
|
+
* live executions whose owner must request cancellation and checkpoint only after quiescence. Existing pause requests
|
|
15
|
+
* retain their operator-hold intent. Durable-write failure leaves both scheduler and runs unchanged. This operation
|
|
16
|
+
* requests lifecycle work but does not itself own or cancel an Agent.
|
|
17
|
+
*/
|
|
18
|
+
requestSchedulerDisable(): Promise<SchedulerDisableResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Atomically move implementing runs to `pausing` before the dispatcher loses a required execution service. Scheduler
|
|
21
|
+
* mode and existing operator/scheduler pause intent are retained. The returned ids identify every pausing execution
|
|
22
|
+
* whose retiring dispatcher owner must cancel and checkpoint before its disposer completes.
|
|
23
|
+
*/
|
|
24
|
+
requestServiceWithdrawalPause(): Promise<RunId[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Atomically request an operator pause for one allocated run. An implementing run becomes `pausing`; an existing
|
|
27
|
+
* scheduler pause is upgraded to an operator hold without losing its original checkpoint facts. Queued runs use
|
|
28
|
+
* `holdQueued` instead. The request owns no Agent cancellation and accepts no caller cancellation signal.
|
|
29
|
+
*/
|
|
30
|
+
requestRunPause(runId: RunId): Promise<PausingRun | PausedActiveRun>;
|
|
31
|
+
/**
|
|
32
|
+
* Commit a pause only after the execution owner has proven its root idle, flushed the Session, and inspected Git.
|
|
33
|
+
* Known usage releases the reservation and advances settled usage. Missing, malformed, or excessive usage retains the
|
|
34
|
+
* reservation and marks deployment usage uncertain for later reconciliation. A lost pause race or write failure leaves
|
|
35
|
+
* the `pausing` checkpoint unchanged. The method accepts no caller cancellation signal.
|
|
36
|
+
*/
|
|
37
|
+
checkpointPaused(runId: RunId, git: GitExecutionSnapshot, usage: RunUsageSettlement): Promise<PausedActiveRun>;
|
|
38
|
+
/**
|
|
39
|
+
* Atomically place one queued run on a durable operator hold before Session or worktree allocation.
|
|
40
|
+
* The run must exist and still be queued. Invalid input, a different lifecycle state, or durable-write failure leaves
|
|
41
|
+
* the run unchanged. The returned paused run is detached; this operation has no external effects or cancellation point.
|
|
42
|
+
*/
|
|
43
|
+
holdQueued(runId: RunId): Promise<PausedQueuedRun>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { STATE_KEY } from './constants.js';
|
|
2
|
+
import { appendLifecycleDeliveries } from './deliveries.js';
|
|
3
|
+
import { activePause, isPausedActiveRun, usageUncertaintyReason, validUsageSettlement } from './policy.js';
|
|
4
|
+
import { executionSchema, runIdSchema, schedulerModeSchema, stateSchema } from './state.js';
|
|
5
|
+
import { snapshotOf } from './state-domain.js';
|
|
6
|
+
export class PauseControl {
|
|
7
|
+
dependencies;
|
|
8
|
+
constructor(dependencies) {
|
|
9
|
+
this.dependencies = dependencies;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Atomically persist the scheduler admission/claim gate and return a detached aggregate snapshot. Draining permits
|
|
13
|
+
* implementing runs to settle; disabling rejects while any run is implementing. Invalid input or durable-write
|
|
14
|
+
* failure leaves the previous mode unchanged. The command accepts no caller cancellation signal.
|
|
15
|
+
*/
|
|
16
|
+
async setSchedulerMode(mode) {
|
|
17
|
+
const parsedMode = schedulerModeSchema.parse(mode);
|
|
18
|
+
const committed = await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
19
|
+
if (parsedMode === 'disabled' && current.runs.some((run) => run.state === 'implementing')) {
|
|
20
|
+
throw new Error('scheduler cannot be disabled while an implementing run exists');
|
|
21
|
+
}
|
|
22
|
+
if (parsedMode === 'enabled' && current.runs.some((run) => run.state === 'pausing')) {
|
|
23
|
+
throw new Error('scheduler cannot be enabled while a run is still pausing');
|
|
24
|
+
}
|
|
25
|
+
if (current.scheduler.mode === parsedMode)
|
|
26
|
+
return current;
|
|
27
|
+
const next = structuredClone(current);
|
|
28
|
+
next.scheduler = { mode: parsedMode, changedAt: new Date().toISOString() };
|
|
29
|
+
next.revision += 1;
|
|
30
|
+
return stateSchema.parse(next);
|
|
31
|
+
});
|
|
32
|
+
return snapshotOf(committed);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Atomically disable admission/dequeue and move every implementing run to `pausing`. The returned run ids identify
|
|
36
|
+
* live executions whose owner must request cancellation and checkpoint only after quiescence. Existing pause requests
|
|
37
|
+
* retain their operator-hold intent. Durable-write failure leaves both scheduler and runs unchanged. This operation
|
|
38
|
+
* requests lifecycle work but does not itself own or cancel an Agent.
|
|
39
|
+
*/
|
|
40
|
+
async requestSchedulerDisable() {
|
|
41
|
+
let pausingRunIds = [];
|
|
42
|
+
const committed = await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
43
|
+
const requestedAt = new Date().toISOString();
|
|
44
|
+
const next = structuredClone(current);
|
|
45
|
+
next.scheduler = { mode: 'disabled', changedAt: requestedAt };
|
|
46
|
+
next.runs = next.runs.map((run) => run.state === 'implementing'
|
|
47
|
+
? {
|
|
48
|
+
...run,
|
|
49
|
+
state: 'pausing',
|
|
50
|
+
pause: activePause('scheduler', requestedAt),
|
|
51
|
+
}
|
|
52
|
+
: run);
|
|
53
|
+
pausingRunIds = next.runs.filter((run) => run.state === 'pausing').map((run) => run.runId);
|
|
54
|
+
if (current.scheduler.mode === 'disabled' && !current.runs.some((run) => run.state === 'implementing')) {
|
|
55
|
+
return current;
|
|
56
|
+
}
|
|
57
|
+
next.revision += 1;
|
|
58
|
+
return stateSchema.parse(next);
|
|
59
|
+
});
|
|
60
|
+
return { snapshot: snapshotOf(committed), pausingRunIds: [...pausingRunIds] };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Atomically move implementing runs to `pausing` before the dispatcher loses a required execution service. Scheduler
|
|
64
|
+
* mode and existing operator/scheduler pause intent are retained. The returned ids identify every pausing execution
|
|
65
|
+
* whose retiring dispatcher owner must cancel and checkpoint before its disposer completes.
|
|
66
|
+
*/
|
|
67
|
+
async requestServiceWithdrawalPause() {
|
|
68
|
+
let pausingRunIds = [];
|
|
69
|
+
await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
70
|
+
const requestedAt = new Date().toISOString();
|
|
71
|
+
const next = structuredClone(current);
|
|
72
|
+
next.runs = next.runs.map((run) => run.state === 'implementing'
|
|
73
|
+
? {
|
|
74
|
+
...run,
|
|
75
|
+
state: 'pausing',
|
|
76
|
+
pause: activePause('service-withdrawal', requestedAt),
|
|
77
|
+
}
|
|
78
|
+
: run);
|
|
79
|
+
pausingRunIds = next.runs.filter((run) => run.state === 'pausing').map((run) => run.runId);
|
|
80
|
+
if (!current.runs.some((run) => run.state === 'implementing'))
|
|
81
|
+
return current;
|
|
82
|
+
next.revision += 1;
|
|
83
|
+
return stateSchema.parse(next);
|
|
84
|
+
});
|
|
85
|
+
return [...pausingRunIds];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Atomically request an operator pause for one allocated run. An implementing run becomes `pausing`; an existing
|
|
89
|
+
* scheduler pause is upgraded to an operator hold without losing its original checkpoint facts. Queued runs use
|
|
90
|
+
* `holdQueued` instead. The request owns no Agent cancellation and accepts no caller cancellation signal.
|
|
91
|
+
*/
|
|
92
|
+
async requestRunPause(runId) {
|
|
93
|
+
const parsedRunId = runIdSchema.parse(runId);
|
|
94
|
+
let requested;
|
|
95
|
+
await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
96
|
+
const index = current.runs.findIndex((run) => run.runId === parsedRunId);
|
|
97
|
+
const run = current.runs[index];
|
|
98
|
+
if (run === undefined)
|
|
99
|
+
throw new Error(`run "${parsedRunId}" does not exist`);
|
|
100
|
+
if (isPausedActiveRun(run) && run.pause.operatorHold) {
|
|
101
|
+
requested = structuredClone(run);
|
|
102
|
+
return current;
|
|
103
|
+
}
|
|
104
|
+
const next = structuredClone(current);
|
|
105
|
+
let nextRun;
|
|
106
|
+
if (run.state === 'implementing') {
|
|
107
|
+
nextRun = { ...run, state: 'pausing', pause: activePause('operator', new Date().toISOString()) };
|
|
108
|
+
}
|
|
109
|
+
else if (run.state === 'pausing') {
|
|
110
|
+
nextRun = {
|
|
111
|
+
...run,
|
|
112
|
+
pause: { ...run.pause, reason: 'operator', operatorHold: true },
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
else if (isPausedActiveRun(run)) {
|
|
116
|
+
nextRun = {
|
|
117
|
+
...run,
|
|
118
|
+
pause: { ...run.pause, reason: 'operator', operatorHold: true },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw new Error(`run "${parsedRunId}" is not an allocated active or paused run`);
|
|
123
|
+
}
|
|
124
|
+
requested = nextRun;
|
|
125
|
+
next.runs[index] = nextRun;
|
|
126
|
+
next.revision += 1;
|
|
127
|
+
return stateSchema.parse(next);
|
|
128
|
+
});
|
|
129
|
+
if (requested === undefined)
|
|
130
|
+
throw new Error(`run "${parsedRunId}" pause was not requested`);
|
|
131
|
+
return structuredClone(requested);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Commit a pause only after the execution owner has proven its root idle, flushed the Session, and inspected Git.
|
|
135
|
+
* Known usage releases the reservation and advances settled usage. Missing, malformed, or excessive usage retains the
|
|
136
|
+
* reservation and marks deployment usage uncertain for later reconciliation. A lost pause race or write failure leaves
|
|
137
|
+
* the `pausing` checkpoint unchanged. The method accepts no caller cancellation signal.
|
|
138
|
+
*/
|
|
139
|
+
async checkpointPaused(runId, git, usage) {
|
|
140
|
+
const parsedRunId = runIdSchema.parse(runId);
|
|
141
|
+
const parsedGit = executionSchema.shape.git.unwrap().parse(git);
|
|
142
|
+
let paused;
|
|
143
|
+
await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
144
|
+
const next = structuredClone(current);
|
|
145
|
+
const index = next.runs.findIndex((run) => run.runId === parsedRunId);
|
|
146
|
+
const run = next.runs[index];
|
|
147
|
+
if (run?.state !== 'pausing')
|
|
148
|
+
throw new Error(`run "${parsedRunId}" is not pausing`);
|
|
149
|
+
const usageKnown = validUsageSettlement(run, usage);
|
|
150
|
+
const pausedAt = new Date().toISOString();
|
|
151
|
+
const pausedWithoutDeliveries = {
|
|
152
|
+
...run,
|
|
153
|
+
state: 'paused',
|
|
154
|
+
execution: { ...run.execution, git: parsedGit },
|
|
155
|
+
budget: {
|
|
156
|
+
...run.budget,
|
|
157
|
+
reservedTokens: usageKnown ? 0 : run.budget.reservedTokens,
|
|
158
|
+
settledTokens: usageKnown ? run.budget.settledTokens + usage.tokens : run.budget.settledTokens,
|
|
159
|
+
usageUncertain: !usageKnown,
|
|
160
|
+
...(usageKnown ? {} : { usageUncertaintyReason: usageUncertaintyReason(run, usage) }),
|
|
161
|
+
},
|
|
162
|
+
pause: { ...run.pause, pausedAt, lastCompletedPhase: 'agent-quiescent' },
|
|
163
|
+
};
|
|
164
|
+
paused = {
|
|
165
|
+
...pausedWithoutDeliveries,
|
|
166
|
+
deliveries: appendLifecycleDeliveries(pausedWithoutDeliveries, this.dependencies.settings(), 'paused', current.revision + 1, pausedAt),
|
|
167
|
+
};
|
|
168
|
+
next.runs[index] = paused;
|
|
169
|
+
if (usageKnown) {
|
|
170
|
+
next.budget.reservedTokens -= run.budget.reservedTokens;
|
|
171
|
+
next.budget.settledTokens += usage.tokens;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
next.budget.usageUncertain = true;
|
|
175
|
+
}
|
|
176
|
+
next.revision += 1;
|
|
177
|
+
return stateSchema.parse(next);
|
|
178
|
+
});
|
|
179
|
+
if (paused === undefined)
|
|
180
|
+
throw new Error(`run "${parsedRunId}" pause checkpoint was not recorded`);
|
|
181
|
+
return structuredClone(paused);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Atomically place one queued run on a durable operator hold before Session or worktree allocation.
|
|
185
|
+
* The run must exist and still be queued. Invalid input, a different lifecycle state, or durable-write failure leaves
|
|
186
|
+
* the run unchanged. The returned paused run is detached; this operation has no external effects or cancellation point.
|
|
187
|
+
*/
|
|
188
|
+
async holdQueued(runId) {
|
|
189
|
+
const parsedRunId = runIdSchema.parse(runId);
|
|
190
|
+
let held;
|
|
191
|
+
await this.dependencies.table().update(STATE_KEY, (current) => {
|
|
192
|
+
const index = current.runs.findIndex((run) => run.runId === parsedRunId);
|
|
193
|
+
const run = current.runs[index];
|
|
194
|
+
if (run === undefined)
|
|
195
|
+
throw new Error(`run "${parsedRunId}" does not exist`);
|
|
196
|
+
if (run.state !== 'queued')
|
|
197
|
+
throw new Error(`run "${parsedRunId}" is not queued`);
|
|
198
|
+
held = {
|
|
199
|
+
...structuredClone(run),
|
|
200
|
+
state: 'paused',
|
|
201
|
+
queueClass: 'resumption',
|
|
202
|
+
pause: {
|
|
203
|
+
kind: 'queued',
|
|
204
|
+
reason: 'operator',
|
|
205
|
+
operatorHold: true,
|
|
206
|
+
continuationTarget: 'implementing',
|
|
207
|
+
pausedAt: new Date().toISOString(),
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
const next = structuredClone(current);
|
|
211
|
+
next.runs[index] = held;
|
|
212
|
+
next.revision += 1;
|
|
213
|
+
return stateSchema.parse(next);
|
|
214
|
+
});
|
|
215
|
+
if (held === undefined)
|
|
216
|
+
throw new Error(`run "${parsedRunId}" was not held`);
|
|
217
|
+
return structuredClone(held);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=pause-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pause-control.js","sourceRoot":"","sources":["../../src/admission/pause-control.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C,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,WAAW,CAAC,CAAA;YACxE,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAC/B,IAAI,GAAG,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,WAAW,kBAAkB,CAAC,CAAA;YAC7E,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,WAAW,iBAAiB,CAAC,CAAA;YAEjF,IAAI,GAAG;gBACL,GAAG,eAAe,CAAC,GAAG,CAAC;gBACvB,KAAK,EAAE,QAAQ;gBACf,UAAU,EAAE,YAAY;gBACxB,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE,UAAU;oBAClB,YAAY,EAAE,IAAI;oBAClB,kBAAkB,EAAE,cAAc;oBAClC,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACnC;aACF,CAAA;YACD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;YACrC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;YACvB,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA;YAClB,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC,CAAC,CAAA;QACF,IAAI,IAAI,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,WAAW,gBAAgB,CAAC,CAAA;QAC5E,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CodeHostBinding } from '../code-host.js';
|
|
3
|
+
import type { AutopilotSettings } from '../config.js';
|
|
4
|
+
import type { TrackerIssueSnapshot, TrackerProviderId } from '../tracker.js';
|
|
5
|
+
import type { ActivePauseReason, ActivePauseSnapshot, ActiveResumeAuthorization, AdmissionRejectionReason, AgentBriefSnapshot, AgentExecutionComposition, AutopilotRun, GitExecutionSnapshot, ImplementingRun, PausedActiveRun, PausedQueuedRun, PausingRun, QueuedRun, ReconcileRequest, RunExecutionSnapshot, RunId, RunUsageSettlement } from './model.js';
|
|
6
|
+
export interface EligibleIssue {
|
|
7
|
+
issue: TrackerIssueSnapshot & {
|
|
8
|
+
readiness: Extract<TrackerIssueSnapshot['readiness'], {
|
|
9
|
+
kind: 'transition';
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
brief: AgentBriefSnapshot;
|
|
13
|
+
}
|
|
14
|
+
export declare function activePause(reason: ActivePauseReason, requestedAt: string): ActivePauseSnapshot;
|
|
15
|
+
export declare function isPausedActiveRun(run: AutopilotRun | undefined): run is PausedActiveRun;
|
|
16
|
+
export declare function isPausedQueuedRun(run: AutopilotRun | undefined): run is PausedQueuedRun;
|
|
17
|
+
export declare function validUsageSettlement(run: ImplementingRun | PausingRun, usage: RunUsageSettlement): usage is Extract<RunUsageSettlement, {
|
|
18
|
+
kind: 'known';
|
|
19
|
+
}>;
|
|
20
|
+
export declare function usageUncertaintyReason(run: ImplementingRun | PausingRun, usage: RunUsageSettlement): string;
|
|
21
|
+
export declare function boundedExternalRetry(retryAfterMs: number | undefined, attempts: number): number;
|
|
22
|
+
export declare function validateActiveResumeFacts(run: PausedActiveRun, observedGit: GitExecutionSnapshot, settings: AutopilotSettings, authorization: ActiveResumeAuthorization): void;
|
|
23
|
+
export declare function evaluateIssue(issue: TrackerIssueSnapshot, maxBriefBytes: number): EligibleIssue | {
|
|
24
|
+
displayKey: string;
|
|
25
|
+
reason: AdmissionRejectionReason;
|
|
26
|
+
};
|
|
27
|
+
export declare function runIdentity(providerId: TrackerProviderId, issue: EligibleIssue['issue']): string;
|
|
28
|
+
export declare function runIdentityFromRun(run: Pick<AutopilotRun, 'providerId' | 'bindingId' | 'issueId' | 'readinessGeneration'>): string;
|
|
29
|
+
export declare function matchesRetainedIssue(run: Pick<AutopilotRun, 'providerId' | 'bindingId' | 'issueId' | 'readinessGeneration' | 'brief'>, providerId: TrackerProviderId, evaluation: EligibleIssue): boolean;
|
|
30
|
+
export declare function sameRetainedRun(current: PausedQueuedRun, expected: PausedQueuedRun): boolean;
|
|
31
|
+
export declare function runId(identity: string): RunId;
|
|
32
|
+
export declare function compareQueuedRuns(left: QueuedRun, right: QueuedRun): number;
|
|
33
|
+
export declare function occupiesQueueCapacity(run: AutopilotRun): boolean;
|
|
34
|
+
export declare function compareSnapshotRuns(left: AutopilotRun, right: AutopilotRun): number;
|
|
35
|
+
export declare function executionFor(run: QueuedRun, settings: AutopilotSettings, codeHost: CodeHostBinding, agent: AgentExecutionComposition): RunExecutionSnapshot;
|
|
36
|
+
export declare function assertStateSize(state: object): void;
|
|
37
|
+
export declare function boundedNonEmptyString(maxBytes: number, label: string): z.ZodString;
|
|
38
|
+
export declare function truncateUtf8(value: string, maxBytes: number): string;
|
|
39
|
+
export declare function validateRequest(request: ReconcileRequest): void;
|