@hoknie/aip 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +13 -0
- package/README.md +74 -2
- package/dist/app/agents.js +18 -0
- package/dist/app/agents.js.map +1 -0
- package/dist/app/application.js +173 -0
- package/dist/app/application.js.map +1 -0
- package/dist/app/daemon.js +71 -0
- package/dist/app/daemon.js.map +1 -0
- package/dist/app/index.js +5 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/lifecycle.js +30 -0
- package/dist/app/lifecycle.js.map +1 -0
- package/dist/app/maintenance.js +27 -0
- package/dist/app/maintenance.js.map +1 -0
- package/dist/app/timings.js +23 -0
- package/dist/app/timings.js.map +1 -0
- package/dist/app/wiring.js +57 -0
- package/dist/app/wiring.js.map +1 -0
- package/dist/cli/clean.js +71 -0
- package/dist/cli/clean.js.map +1 -0
- package/dist/cli/commands.js +963 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/config-check.js +173 -0
- package/dist/cli/config-check.js.map +1 -0
- package/dist/cli/daemon.js +199 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/help.js +50 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/init.js +43 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/io.js +13 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/main.js +31 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/probe.js +12 -0
- package/dist/cli/probe.js.map +1 -0
- package/dist/cli/program.js +48 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/setup.js +406 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/version.js +6 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/cli/watch.js +24 -0
- package/dist/cli/watch.js.map +1 -0
- package/dist/cli/web/daemon-panel.js +185 -0
- package/dist/cli/web/daemon-panel.js.map +1 -0
- package/dist/cli/web/default-repository.js +12 -0
- package/dist/cli/web/default-repository.js.map +1 -0
- package/dist/cli/web/errors.js +60 -0
- package/dist/cli/web/errors.js.map +1 -0
- package/dist/cli/web/open.js +12 -0
- package/dist/cli/web/open.js.map +1 -0
- package/dist/cli/web/page.js +465 -0
- package/dist/cli/web/page.js.map +1 -0
- package/dist/cli/web/server.js +1191 -0
- package/dist/cli/web/server.js.map +1 -0
- package/dist/cli/web/standby.js +119 -0
- package/dist/cli/web/standby.js.map +1 -0
- package/dist/cli/web/state.js +69 -0
- package/dist/cli/web/state.js.map +1 -0
- package/dist/cli/web/system.js +66 -0
- package/dist/cli/web/system.js.map +1 -0
- package/dist/cli/web-control.js +173 -0
- package/dist/cli/web-control.js.map +1 -0
- package/dist/config/discover.js +25 -0
- package/dist/config/discover.js.map +1 -0
- package/dist/config/duration.js +17 -0
- package/dist/config/duration.js.map +1 -0
- package/dist/config/edit.js +966 -0
- package/dist/config/edit.js.map +1 -0
- package/dist/config/errors.js +29 -0
- package/dist/config/errors.js.map +1 -0
- package/dist/config/index.js +14 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.js +412 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/merge.js +45 -0
- package/dist/config/merge.js.map +1 -0
- package/dist/config/model.js +171 -0
- package/dist/config/model.js.map +1 -0
- package/dist/config/paths.js +31 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/prompt.js +33 -0
- package/dist/config/prompt.js.map +1 -0
- package/dist/config/shared-pipelines.js +71 -0
- package/dist/config/shared-pipelines.js.map +1 -0
- package/dist/config/shared-specialists.js +68 -0
- package/dist/config/shared-specialists.js.map +1 -0
- package/dist/config/shared-workflows.js +71 -0
- package/dist/config/shared-workflows.js.map +1 -0
- package/dist/config/specialist-tags.js +214 -0
- package/dist/config/specialist-tags.js.map +1 -0
- package/dist/config/tag-names.js +43 -0
- package/dist/config/tag-names.js.map +1 -0
- package/dist/config/validate.js +872 -0
- package/dist/config/validate.js.map +1 -0
- package/dist/core/artifacts.js +37 -0
- package/dist/core/artifacts.js.map +1 -0
- package/dist/core/create.js +75 -0
- package/dist/core/create.js.map +1 -0
- package/dist/core/delivery.js +366 -0
- package/dist/core/delivery.js.map +1 -0
- package/dist/core/errors.js +7 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/ids.js +99 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/index.js +21 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/input.js +45 -0
- package/dist/core/input.js.map +1 -0
- package/dist/core/machine.js +1021 -0
- package/dist/core/machine.js.map +1 -0
- package/dist/core/model.js +460 -0
- package/dist/core/model.js.map +1 -0
- package/dist/core/observer.js +193 -0
- package/dist/core/observer.js.map +1 -0
- package/dist/core/occupancy.js +63 -0
- package/dist/core/occupancy.js.map +1 -0
- package/dist/core/permissions.js +222 -0
- package/dist/core/permissions.js.map +1 -0
- package/dist/core/plan.js +99 -0
- package/dist/core/plan.js.map +1 -0
- package/dist/core/progress.js +43 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/questions.js +19 -0
- package/dist/core/questions.js.map +1 -0
- package/dist/core/queue.js +859 -0
- package/dist/core/queue.js.map +1 -0
- package/dist/core/retryable.js +8 -0
- package/dist/core/retryable.js.map +1 -0
- package/dist/core/scheduler.js +160 -0
- package/dist/core/scheduler.js.map +1 -0
- package/dist/core/skip.js +109 -0
- package/dist/core/skip.js.map +1 -0
- package/dist/core/stages.js +304 -0
- package/dist/core/stages.js.map +1 -0
- package/dist/core/summary.js +35 -0
- package/dist/core/summary.js.map +1 -0
- package/dist/core/tags.js +184 -0
- package/dist/core/tags.js.map +1 -0
- package/dist/core/topology.js +162 -0
- package/dist/core/topology.js.map +1 -0
- package/dist/daemon/artifacts.js +84 -0
- package/dist/daemon/artifacts.js.map +1 -0
- package/dist/daemon/daemon.js +1442 -0
- package/dist/daemon/daemon.js.map +1 -0
- package/dist/daemon/executor.js +749 -0
- package/dist/daemon/executor.js.map +1 -0
- package/dist/daemon/helpers.js +38 -0
- package/dist/daemon/helpers.js.map +1 -0
- package/dist/daemon/index.js +4 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/logs.js +69 -0
- package/dist/daemon/logs.js.map +1 -0
- package/dist/daemon/observers.js +93 -0
- package/dist/daemon/observers.js.map +1 -0
- package/dist/daemon/patches.js +76 -0
- package/dist/daemon/patches.js.map +1 -0
- package/dist/daemon/ports.js +2 -0
- package/dist/daemon/ports.js.map +1 -0
- package/dist/daemon/processes.js +98 -0
- package/dist/daemon/processes.js.map +1 -0
- package/dist/daemon/repositories.js +2 -0
- package/dist/daemon/repositories.js.map +1 -0
- package/dist/daemon/server.js +164 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/supervisor.js +140 -0
- package/dist/daemon/supervisor.js.map +1 -0
- package/dist/daemon/timings.js +23 -0
- package/dist/daemon/timings.js.map +1 -0
- package/dist/feature/agents/clients/agy/events.js +36 -0
- package/dist/feature/agents/clients/agy/events.js.map +1 -0
- package/dist/feature/agents/clients/agy/guard-commands.js +29 -0
- package/dist/feature/agents/clients/agy/guard-commands.js.map +1 -0
- package/dist/feature/agents/clients/agy/guard-paths.js +36 -0
- package/dist/feature/agents/clients/agy/guard-paths.js.map +1 -0
- package/dist/feature/agents/clients/agy/guard.js +77 -0
- package/dist/feature/agents/clients/agy/guard.js.map +1 -0
- package/dist/feature/agents/clients/agy/hooks.js +46 -0
- package/dist/feature/agents/clients/agy/hooks.js.map +1 -0
- package/dist/feature/agents/clients/agy/index.js +5 -0
- package/dist/feature/agents/clients/agy/index.js.map +1 -0
- package/dist/feature/agents/clients/agy/parser.js +63 -0
- package/dist/feature/agents/clients/agy/parser.js.map +1 -0
- package/dist/feature/agents/clients/agy/permissions.js +40 -0
- package/dist/feature/agents/clients/agy/permissions.js.map +1 -0
- package/dist/feature/agents/clients/agy/runtime.js +114 -0
- package/dist/feature/agents/clients/agy/runtime.js.map +1 -0
- package/dist/feature/agents/clients/agy/transcript.js +65 -0
- package/dist/feature/agents/clients/agy/transcript.js.map +1 -0
- package/dist/feature/agents/clients/claude/index.js +5 -0
- package/dist/feature/agents/clients/claude/index.js.map +1 -0
- package/dist/feature/agents/clients/claude/parser.js +221 -0
- package/dist/feature/agents/clients/claude/parser.js.map +1 -0
- package/dist/feature/agents/clients/claude/permissions.js +70 -0
- package/dist/feature/agents/clients/claude/permissions.js.map +1 -0
- package/dist/feature/agents/clients/claude/runtime.js +116 -0
- package/dist/feature/agents/clients/claude/runtime.js.map +1 -0
- package/dist/feature/agents/clients/claude/transcript.js +105 -0
- package/dist/feature/agents/clients/claude/transcript.js.map +1 -0
- package/dist/feature/agents/clients/naming/index.js +2 -0
- package/dist/feature/agents/clients/naming/index.js.map +1 -0
- package/dist/feature/agents/clients/naming/naming.js +15 -0
- package/dist/feature/agents/clients/naming/naming.js.map +1 -0
- package/dist/feature/agents/clients/opencode/index.js +4 -0
- package/dist/feature/agents/clients/opencode/index.js.map +1 -0
- package/dist/feature/agents/clients/opencode/parser.js +84 -0
- package/dist/feature/agents/clients/opencode/parser.js.map +1 -0
- package/dist/feature/agents/clients/opencode/runtime.js +129 -0
- package/dist/feature/agents/clients/opencode/runtime.js.map +1 -0
- package/dist/feature/agents/clients/opencode/transcript.js +77 -0
- package/dist/feature/agents/clients/opencode/transcript.js.map +1 -0
- package/dist/feature/agents/ports/index.js +2 -0
- package/dist/feature/agents/ports/index.js.map +1 -0
- package/dist/feature/agents/ports/naming.js +2 -0
- package/dist/feature/agents/ports/naming.js.map +1 -0
- package/dist/feature/agents/ports/runtime-factory.js +2 -0
- package/dist/feature/agents/ports/runtime-factory.js.map +1 -0
- package/dist/feature/agents/services/agents.js +38 -0
- package/dist/feature/agents/services/agents.js.map +1 -0
- package/dist/feature/agents/services/catalog.js +117 -0
- package/dist/feature/agents/services/catalog.js.map +1 -0
- package/dist/feature/agents/services/create.js +5 -0
- package/dist/feature/agents/services/create.js.map +1 -0
- package/dist/feature/agents/services/index.js +7 -0
- package/dist/feature/agents/services/index.js.map +1 -0
- package/dist/feature/agents/services/logs.js +69 -0
- package/dist/feature/agents/services/logs.js.map +1 -0
- package/dist/feature/agents/services/skills.js +17 -0
- package/dist/feature/agents/services/skills.js.map +1 -0
- package/dist/feature/agents/services/supervisor.js +160 -0
- package/dist/feature/agents/services/supervisor.js.map +1 -0
- package/dist/feature/agents/types/catalog.js +2 -0
- package/dist/feature/agents/types/catalog.js.map +1 -0
- package/dist/feature/agents/types/index.js +12 -0
- package/dist/feature/agents/types/index.js.map +1 -0
- package/dist/feature/agents/types/message.js +48 -0
- package/dist/feature/agents/types/message.js.map +1 -0
- package/dist/feature/agents/types/naming.js +4 -0
- package/dist/feature/agents/types/naming.js.map +1 -0
- package/dist/feature/agents/types/permissions.js +235 -0
- package/dist/feature/agents/types/permissions.js.map +1 -0
- package/dist/feature/agents/types/run-naming.js +66 -0
- package/dist/feature/agents/types/run-naming.js.map +1 -0
- package/dist/feature/agents/types/runtime.js +18 -0
- package/dist/feature/agents/types/runtime.js.map +1 -0
- package/dist/feature/agents/types/step-input.js +2 -0
- package/dist/feature/agents/types/step-input.js.map +1 -0
- package/dist/feature/agents/types/transcript-parts.js +62 -0
- package/dist/feature/agents/types/transcript-parts.js.map +1 -0
- package/dist/feature/agents/types/transcript.js +8 -0
- package/dist/feature/agents/types/transcript.js.map +1 -0
- package/dist/feature/agents/types/usage.js +14 -0
- package/dist/feature/agents/types/usage.js.map +1 -0
- package/dist/feature/agents/types/worker-tools.js +20 -0
- package/dist/feature/agents/types/worker-tools.js.map +1 -0
- package/dist/feature/artifacts/ports/index.js +2 -0
- package/dist/feature/artifacts/ports/index.js.map +1 -0
- package/dist/feature/artifacts/ports/publish.js +2 -0
- package/dist/feature/artifacts/ports/publish.js.map +1 -0
- package/dist/feature/artifacts/repositories/artifact-storage.js +84 -0
- package/dist/feature/artifacts/repositories/artifact-storage.js.map +1 -0
- package/dist/feature/artifacts/repositories/artifacts.js +85 -0
- package/dist/feature/artifacts/repositories/artifacts.js.map +1 -0
- package/dist/feature/artifacts/repositories/index.js +3 -0
- package/dist/feature/artifacts/repositories/index.js.map +1 -0
- package/dist/feature/artifacts/services/artifacts.js +105 -0
- package/dist/feature/artifacts/services/artifacts.js.map +1 -0
- package/dist/feature/artifacts/services/create.js +14 -0
- package/dist/feature/artifacts/services/create.js.map +1 -0
- package/dist/feature/artifacts/services/files.js +42 -0
- package/dist/feature/artifacts/services/files.js.map +1 -0
- package/dist/feature/artifacts/services/index.js +3 -0
- package/dist/feature/artifacts/services/index.js.map +1 -0
- package/dist/feature/artifacts/types/artifacts.js +36 -0
- package/dist/feature/artifacts/types/artifacts.js.map +1 -0
- package/dist/feature/artifacts/types/index.js +2 -0
- package/dist/feature/artifacts/types/index.js.map +1 -0
- package/dist/feature/artifacts/types/views.js +2 -0
- package/dist/feature/artifacts/types/views.js.map +1 -0
- package/dist/feature/compose/services/create.js +11 -0
- package/dist/feature/compose/services/create.js.map +1 -0
- package/dist/feature/compose/services/index.js +5 -0
- package/dist/feature/compose/services/index.js.map +1 -0
- package/dist/feature/compose/services/repository-edit.js +20 -0
- package/dist/feature/compose/services/repository-edit.js.map +1 -0
- package/dist/feature/compose/services/repository-move.js +35 -0
- package/dist/feature/compose/services/repository-move.js.map +1 -0
- package/dist/feature/compose/services/repository-removal.js +38 -0
- package/dist/feature/compose/services/repository-removal.js.map +1 -0
- package/dist/feature/delivery/ports/index.js +2 -0
- package/dist/feature/delivery/ports/index.js.map +1 -0
- package/dist/feature/delivery/ports/publish.js +2 -0
- package/dist/feature/delivery/ports/publish.js.map +1 -0
- package/dist/feature/delivery/repositories/index.js +3 -0
- package/dist/feature/delivery/repositories/index.js.map +1 -0
- package/dist/feature/delivery/repositories/patch-storage.js +76 -0
- package/dist/feature/delivery/repositories/patch-storage.js.map +1 -0
- package/dist/feature/delivery/repositories/patches.js +28 -0
- package/dist/feature/delivery/repositories/patches.js.map +1 -0
- package/dist/feature/delivery/services/create.js +21 -0
- package/dist/feature/delivery/services/create.js.map +1 -0
- package/dist/feature/delivery/services/deliver.js +67 -0
- package/dist/feature/delivery/services/deliver.js.map +1 -0
- package/dist/feature/delivery/services/diffs.js +153 -0
- package/dist/feature/delivery/services/diffs.js.map +1 -0
- package/dist/feature/delivery/services/index.js +5 -0
- package/dist/feature/delivery/services/index.js.map +1 -0
- package/dist/feature/delivery/services/patches.js +96 -0
- package/dist/feature/delivery/services/patches.js.map +1 -0
- package/dist/feature/delivery/types/index.js +3 -0
- package/dist/feature/delivery/types/index.js.map +1 -0
- package/dist/feature/delivery/types/outcomes.js +2 -0
- package/dist/feature/delivery/types/outcomes.js.map +1 -0
- package/dist/feature/delivery/types/spec-change.js +18 -0
- package/dist/feature/delivery/types/spec-change.js.map +1 -0
- package/dist/feature/observers/ports/index.js +2 -0
- package/dist/feature/observers/ports/index.js.map +1 -0
- package/dist/feature/observers/ports/publish.js +2 -0
- package/dist/feature/observers/ports/publish.js.map +1 -0
- package/dist/feature/observers/repositories/index.js +2 -0
- package/dist/feature/observers/repositories/index.js.map +1 -0
- package/dist/feature/observers/repositories/observers.js +28 -0
- package/dist/feature/observers/repositories/observers.js.map +1 -0
- package/dist/feature/observers/services/create.js +11 -0
- package/dist/feature/observers/services/create.js.map +1 -0
- package/dist/feature/observers/services/history.js +76 -0
- package/dist/feature/observers/services/history.js.map +1 -0
- package/dist/feature/observers/services/index.js +5 -0
- package/dist/feature/observers/services/index.js.map +1 -0
- package/dist/feature/observers/services/observers.js +178 -0
- package/dist/feature/observers/services/observers.js.map +1 -0
- package/dist/feature/observers/services/settings-check.js +93 -0
- package/dist/feature/observers/services/settings-check.js.map +1 -0
- package/dist/feature/observers/types/actions.js +2 -0
- package/dist/feature/observers/types/actions.js.map +1 -0
- package/dist/feature/observers/types/index.js +4 -0
- package/dist/feature/observers/types/index.js.map +1 -0
- package/dist/feature/observers/types/plan-repairs.js +109 -0
- package/dist/feature/observers/types/plan-repairs.js.map +1 -0
- package/dist/feature/observers/types/settings.js +13 -0
- package/dist/feature/observers/types/settings.js.map +1 -0
- package/dist/feature/processes/ports/index.js +2 -0
- package/dist/feature/processes/ports/index.js.map +1 -0
- package/dist/feature/processes/ports/publish.js +2 -0
- package/dist/feature/processes/ports/publish.js.map +1 -0
- package/dist/feature/processes/services/create.js +5 -0
- package/dist/feature/processes/services/create.js.map +1 -0
- package/dist/feature/processes/services/index.js +4 -0
- package/dist/feature/processes/services/index.js.map +1 -0
- package/dist/feature/processes/services/processes.js +131 -0
- package/dist/feature/processes/services/processes.js.map +1 -0
- package/dist/feature/processes/services/tree.js +98 -0
- package/dist/feature/processes/services/tree.js.map +1 -0
- package/dist/feature/processes/types/background.js +2 -0
- package/dist/feature/processes/types/background.js.map +1 -0
- package/dist/feature/processes/types/index.js +2 -0
- package/dist/feature/processes/types/index.js.map +1 -0
- package/dist/feature/queue/ports/index.js +2 -0
- package/dist/feature/queue/ports/index.js.map +1 -0
- package/dist/feature/queue/ports/observe.js +2 -0
- package/dist/feature/queue/ports/observe.js.map +1 -0
- package/dist/feature/queue/ports/publish.js +2 -0
- package/dist/feature/queue/ports/publish.js.map +1 -0
- package/dist/feature/queue/ports/repair-policy.js +2 -0
- package/dist/feature/queue/ports/repair-policy.js.map +1 -0
- package/dist/feature/queue/repositories/index.js +2 -0
- package/dist/feature/queue/repositories/index.js.map +1 -0
- package/dist/feature/queue/repositories/queues.js +100 -0
- package/dist/feature/queue/repositories/queues.js.map +1 -0
- package/dist/feature/queue/services/advance.js +214 -0
- package/dist/feature/queue/services/advance.js.map +1 -0
- package/dist/feature/queue/services/control.js +153 -0
- package/dist/feature/queue/services/control.js.map +1 -0
- package/dist/feature/queue/services/create.js +26 -0
- package/dist/feature/queue/services/create.js.map +1 -0
- package/dist/feature/queue/services/edit.js +126 -0
- package/dist/feature/queue/services/edit.js.map +1 -0
- package/dist/feature/queue/services/index.js +8 -0
- package/dist/feature/queue/services/index.js.map +1 -0
- package/dist/feature/queue/services/items.js +173 -0
- package/dist/feature/queue/services/items.js.map +1 -0
- package/dist/feature/queue/services/store.js +61 -0
- package/dist/feature/queue/services/store.js.map +1 -0
- package/dist/feature/queue/services/task-tags.js +103 -0
- package/dist/feature/queue/services/task-tags.js.map +1 -0
- package/dist/feature/queue/types/advance.js +183 -0
- package/dist/feature/queue/types/advance.js.map +1 -0
- package/dist/feature/queue/types/dependencies.js +98 -0
- package/dist/feature/queue/types/dependencies.js.map +1 -0
- package/dist/feature/queue/types/edit.js +180 -0
- package/dist/feature/queue/types/edit.js.map +1 -0
- package/dist/feature/queue/types/ids.js +7 -0
- package/dist/feature/queue/types/ids.js.map +1 -0
- package/dist/feature/queue/types/index.js +10 -0
- package/dist/feature/queue/types/index.js.map +1 -0
- package/dist/feature/queue/types/items.js +46 -0
- package/dist/feature/queue/types/items.js.map +1 -0
- package/dist/feature/queue/types/limit-hits.js +50 -0
- package/dist/feature/queue/types/limit-hits.js.map +1 -0
- package/dist/feature/queue/types/requests.js +2 -0
- package/dist/feature/queue/types/requests.js.map +1 -0
- package/dist/feature/queue/types/returns.js +182 -0
- package/dist/feature/queue/types/returns.js.map +1 -0
- package/dist/feature/queue/types/settings.js +117 -0
- package/dist/feature/queue/types/settings.js.map +1 -0
- package/dist/feature/repos/ports/index.js +2 -0
- package/dist/feature/repos/ports/index.js.map +1 -0
- package/dist/feature/repos/ports/publish.js +2 -0
- package/dist/feature/repos/ports/publish.js.map +1 -0
- package/dist/feature/repos/repositories/index.js +2 -0
- package/dist/feature/repos/repositories/index.js.map +1 -0
- package/dist/feature/repos/repositories/known.js +41 -0
- package/dist/feature/repos/repositories/known.js.map +1 -0
- package/dist/feature/repos/services/create.js +13 -0
- package/dist/feature/repos/services/create.js.map +1 -0
- package/dist/feature/repos/services/index.js +4 -0
- package/dist/feature/repos/services/index.js.map +1 -0
- package/dist/feature/repos/services/projects.js +50 -0
- package/dist/feature/repos/services/projects.js.map +1 -0
- package/dist/feature/repos/services/registry.js +138 -0
- package/dist/feature/repos/services/registry.js.map +1 -0
- package/dist/feature/repos/types/index.js +2 -0
- package/dist/feature/repos/types/index.js.map +1 -0
- package/dist/feature/repos/types/project.js +80 -0
- package/dist/feature/repos/types/project.js.map +1 -0
- package/dist/feature/repos/types/registry.js +2 -0
- package/dist/feature/repos/types/registry.js.map +1 -0
- package/dist/feature/runs/machine/answers.js +112 -0
- package/dist/feature/runs/machine/answers.js.map +1 -0
- package/dist/feature/runs/machine/delivery-checks.js +91 -0
- package/dist/feature/runs/machine/delivery-checks.js.map +1 -0
- package/dist/feature/runs/machine/delivery-flow.js +211 -0
- package/dist/feature/runs/machine/delivery-flow.js.map +1 -0
- package/dist/feature/runs/machine/events.js +2 -0
- package/dist/feature/runs/machine/events.js.map +1 -0
- package/dist/feature/runs/machine/exits.js +207 -0
- package/dist/feature/runs/machine/exits.js.map +1 -0
- package/dist/feature/runs/machine/index.js +7 -0
- package/dist/feature/runs/machine/index.js.map +1 -0
- package/dist/feature/runs/machine/plan.js +111 -0
- package/dist/feature/runs/machine/plan.js.map +1 -0
- package/dist/feature/runs/machine/repair.js +155 -0
- package/dist/feature/runs/machine/repair.js.map +1 -0
- package/dist/feature/runs/machine/run-control.js +276 -0
- package/dist/feature/runs/machine/run-control.js.map +1 -0
- package/dist/feature/runs/machine/scheduler.js +119 -0
- package/dist/feature/runs/machine/scheduler.js.map +1 -0
- package/dist/feature/runs/machine/steps.js +275 -0
- package/dist/feature/runs/machine/steps.js.map +1 -0
- package/dist/feature/runs/machine/texts.js +69 -0
- package/dist/feature/runs/machine/texts.js.map +1 -0
- package/dist/feature/runs/machine/transition.js +113 -0
- package/dist/feature/runs/machine/transition.js.map +1 -0
- package/dist/feature/runs/ports/agent-exit.js +2 -0
- package/dist/feature/runs/ports/agent-exit.js.map +1 -0
- package/dist/feature/runs/ports/diff.js +2 -0
- package/dist/feature/runs/ports/diff.js.map +1 -0
- package/dist/feature/runs/ports/index.js +2 -0
- package/dist/feature/runs/ports/index.js.map +1 -0
- package/dist/feature/runs/ports/observe.js +2 -0
- package/dist/feature/runs/ports/observe.js.map +1 -0
- package/dist/feature/runs/ports/publish.js +2 -0
- package/dist/feature/runs/ports/publish.js.map +1 -0
- package/dist/feature/runs/ports/queue-advance.js +2 -0
- package/dist/feature/runs/ports/queue-advance.js.map +1 -0
- package/dist/feature/runs/repositories/attempt-history.js +116 -0
- package/dist/feature/runs/repositories/attempt-history.js.map +1 -0
- package/dist/feature/runs/repositories/finished-runs.js +42 -0
- package/dist/feature/runs/repositories/finished-runs.js.map +1 -0
- package/dist/feature/runs/repositories/index.js +4 -0
- package/dist/feature/runs/repositories/index.js.map +1 -0
- package/dist/feature/runs/repositories/rows.js +110 -0
- package/dist/feature/runs/repositories/rows.js.map +1 -0
- package/dist/feature/runs/repositories/runs.js +76 -0
- package/dist/feature/runs/repositories/runs.js.map +1 -0
- package/dist/feature/runs/repositories/write.js +31 -0
- package/dist/feature/runs/repositories/write.js.map +1 -0
- package/dist/feature/runs/services/archive.js +17 -0
- package/dist/feature/runs/services/archive.js.map +1 -0
- package/dist/feature/runs/services/attempt-history.js +11 -0
- package/dist/feature/runs/services/attempt-history.js.map +1 -0
- package/dist/feature/runs/services/create.js +43 -0
- package/dist/feature/runs/services/create.js.map +1 -0
- package/dist/feature/runs/services/effects/actions.js +150 -0
- package/dist/feature/runs/services/effects/actions.js.map +1 -0
- package/dist/feature/runs/services/effects/attempts.js +179 -0
- package/dist/feature/runs/services/effects/attempts.js.map +1 -0
- package/dist/feature/runs/services/effects/context.js +7 -0
- package/dist/feature/runs/services/effects/context.js.map +1 -0
- package/dist/feature/runs/services/effects/effects.js +82 -0
- package/dist/feature/runs/services/effects/effects.js.map +1 -0
- package/dist/feature/runs/services/effects/git.js +168 -0
- package/dist/feature/runs/services/effects/git.js.map +1 -0
- package/dist/feature/runs/services/effects/naming.js +62 -0
- package/dist/feature/runs/services/effects/naming.js.map +1 -0
- package/dist/feature/runs/services/effects/outside.js +83 -0
- package/dist/feature/runs/services/effects/outside.js.map +1 -0
- package/dist/feature/runs/services/effects/running.js +76 -0
- package/dist/feature/runs/services/effects/running.js.map +1 -0
- package/dist/feature/runs/services/effects/usage.js +61 -0
- package/dist/feature/runs/services/effects/usage.js.map +1 -0
- package/dist/feature/runs/services/effects/worktrees.js +49 -0
- package/dist/feature/runs/services/effects/worktrees.js.map +1 -0
- package/dist/feature/runs/services/engine.js +163 -0
- package/dist/feature/runs/services/engine.js.map +1 -0
- package/dist/feature/runs/services/index.js +15 -0
- package/dist/feature/runs/services/index.js.map +1 -0
- package/dist/feature/runs/services/occupancy.js +62 -0
- package/dist/feature/runs/services/occupancy.js.map +1 -0
- package/dist/feature/runs/services/progress.js +42 -0
- package/dist/feature/runs/services/progress.js.map +1 -0
- package/dist/feature/runs/services/reads.js +54 -0
- package/dist/feature/runs/services/reads.js.map +1 -0
- package/dist/feature/runs/services/recovery.js +17 -0
- package/dist/feature/runs/services/recovery.js.map +1 -0
- package/dist/feature/runs/services/refresh.js +29 -0
- package/dist/feature/runs/services/refresh.js.map +1 -0
- package/dist/feature/runs/services/requests.js +88 -0
- package/dist/feature/runs/services/requests.js.map +1 -0
- package/dist/feature/runs/services/states.js +112 -0
- package/dist/feature/runs/services/states.js.map +1 -0
- package/dist/feature/runs/services/summary.js +38 -0
- package/dist/feature/runs/services/summary.js.map +1 -0
- package/dist/feature/runs/types/attempt.js +102 -0
- package/dist/feature/runs/types/attempt.js.map +1 -0
- package/dist/feature/runs/types/constants.js +45 -0
- package/dist/feature/runs/types/constants.js.map +1 -0
- package/dist/feature/runs/types/create.js +177 -0
- package/dist/feature/runs/types/create.js.map +1 -0
- package/dist/feature/runs/types/group.js +152 -0
- package/dist/feature/runs/types/group.js.map +1 -0
- package/dist/feature/runs/types/history/attempt-history.js +16 -0
- package/dist/feature/runs/types/history/attempt-history.js.map +1 -0
- package/dist/feature/runs/types/index.js +15 -0
- package/dist/feature/runs/types/index.js.map +1 -0
- package/dist/feature/runs/types/input.js +57 -0
- package/dist/feature/runs/types/input.js.map +1 -0
- package/dist/feature/runs/types/limits.js +151 -0
- package/dist/feature/runs/types/limits.js.map +1 -0
- package/dist/feature/runs/types/problems.js +74 -0
- package/dist/feature/runs/types/problems.js.map +1 -0
- package/dist/feature/runs/types/run.js +162 -0
- package/dist/feature/runs/types/run.js.map +1 -0
- package/dist/feature/runs/types/skip.js +110 -0
- package/dist/feature/runs/types/skip.js.map +1 -0
- package/dist/feature/runs/types/stage-status.js +156 -0
- package/dist/feature/runs/types/stage-status.js.map +1 -0
- package/dist/feature/runs/types/stages.js +158 -0
- package/dist/feature/runs/types/stages.js.map +1 -0
- package/dist/feature/runs/types/topology.js +165 -0
- package/dist/feature/runs/types/topology.js.map +1 -0
- package/dist/feature/swarm-config/repositories/config-files.js +141 -0
- package/dist/feature/swarm-config/repositories/config-files.js.map +1 -0
- package/dist/feature/swarm-config/services/assemble.js +212 -0
- package/dist/feature/swarm-config/services/assemble.js.map +1 -0
- package/dist/feature/swarm-config/services/create.js +5 -0
- package/dist/feature/swarm-config/services/create.js.map +1 -0
- package/dist/feature/swarm-config/services/discover.js +19 -0
- package/dist/feature/swarm-config/services/discover.js.map +1 -0
- package/dist/feature/swarm-config/services/index.js +9 -0
- package/dist/feature/swarm-config/services/index.js.map +1 -0
- package/dist/feature/swarm-config/services/load.js +86 -0
- package/dist/feature/swarm-config/services/load.js.map +1 -0
- package/dist/feature/swarm-config/services/settings.js +50 -0
- package/dist/feature/swarm-config/services/settings.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-actions.js +117 -0
- package/dist/feature/swarm-config/services/validate-actions.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-context.js +91 -0
- package/dist/feature/swarm-config/services/validate-context.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-pipelines.js +170 -0
- package/dist/feature/swarm-config/services/validate-pipelines.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-runtimes.js +212 -0
- package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-settings.js +177 -0
- package/dist/feature/swarm-config/services/validate-settings.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-specialists.js +152 -0
- package/dist/feature/swarm-config/services/validate-specialists.js.map +1 -0
- package/dist/feature/swarm-config/services/validate.js +174 -0
- package/dist/feature/swarm-config/services/validate.js.map +1 -0
- package/dist/feature/swarm-config/types/action.js +11 -0
- package/dist/feature/swarm-config/types/action.js.map +1 -0
- package/dist/feature/swarm-config/types/chain.js +2 -0
- package/dist/feature/swarm-config/types/chain.js.map +1 -0
- package/dist/feature/swarm-config/types/duration.js +17 -0
- package/dist/feature/swarm-config/types/duration.js.map +1 -0
- package/dist/feature/swarm-config/types/errors.js +57 -0
- package/dist/feature/swarm-config/types/errors.js.map +1 -0
- package/dist/feature/swarm-config/types/index.js +13 -0
- package/dist/feature/swarm-config/types/index.js.map +1 -0
- package/dist/feature/swarm-config/types/levels.js +16 -0
- package/dist/feature/swarm-config/types/levels.js.map +1 -0
- package/dist/feature/swarm-config/types/lookups.js +53 -0
- package/dist/feature/swarm-config/types/lookups.js.map +1 -0
- package/dist/feature/swarm-config/types/merge.js +46 -0
- package/dist/feature/swarm-config/types/merge.js.map +1 -0
- package/dist/feature/swarm-config/types/pipeline.js +5 -0
- package/dist/feature/swarm-config/types/pipeline.js.map +1 -0
- package/dist/feature/swarm-config/types/prompt.js +33 -0
- package/dist/feature/swarm-config/types/prompt.js.map +1 -0
- package/dist/feature/swarm-config/types/settings.js +116 -0
- package/dist/feature/swarm-config/types/settings.js.map +1 -0
- package/dist/feature/swarm-config/types/specialist.js +38 -0
- package/dist/feature/swarm-config/types/specialist.js.map +1 -0
- package/dist/feature/swarm-config/types/tag-names.js +43 -0
- package/dist/feature/swarm-config/types/tag-names.js.map +1 -0
- package/dist/feature/swarm-edit/ports/config-changed.js +2 -0
- package/dist/feature/swarm-edit/ports/config-changed.js.map +1 -0
- package/dist/feature/swarm-edit/ports/index.js +2 -0
- package/dist/feature/swarm-edit/ports/index.js.map +1 -0
- package/dist/feature/swarm-edit/repositories/documents.js +144 -0
- package/dist/feature/swarm-edit/repositories/documents.js.map +1 -0
- package/dist/feature/swarm-edit/services/config-edits.js +116 -0
- package/dist/feature/swarm-edit/services/config-edits.js.map +1 -0
- package/dist/feature/swarm-edit/services/create.js +7 -0
- package/dist/feature/swarm-edit/services/create.js.map +1 -0
- package/dist/feature/swarm-edit/services/editor-settings.js +143 -0
- package/dist/feature/swarm-edit/services/editor-settings.js.map +1 -0
- package/dist/feature/swarm-edit/services/editor-view.js +144 -0
- package/dist/feature/swarm-edit/services/editor-view.js.map +1 -0
- package/dist/feature/swarm-edit/services/index.js +12 -0
- package/dist/feature/swarm-edit/services/index.js.map +1 -0
- package/dist/feature/swarm-edit/services/levels.js +30 -0
- package/dist/feature/swarm-edit/services/levels.js.map +1 -0
- package/dist/feature/swarm-edit/services/plan-edit.js +217 -0
- package/dist/feature/swarm-edit/services/plan-edit.js.map +1 -0
- package/dist/feature/swarm-edit/services/plan-settings.js +198 -0
- package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -0
- package/dist/feature/swarm-edit/services/references.js +85 -0
- package/dist/feature/swarm-edit/services/references.js.map +1 -0
- package/dist/feature/swarm-edit/services/shared-config.js +128 -0
- package/dist/feature/swarm-edit/services/shared-config.js.map +1 -0
- package/dist/feature/swarm-edit/services/shared-pipelines.js +72 -0
- package/dist/feature/swarm-edit/services/shared-pipelines.js.map +1 -0
- package/dist/feature/swarm-edit/services/shared-specialists.js +70 -0
- package/dist/feature/swarm-edit/services/shared-specialists.js.map +1 -0
- package/dist/feature/swarm-edit/services/specialist-tags.js +215 -0
- package/dist/feature/swarm-edit/services/specialist-tags.js.map +1 -0
- package/dist/feature/swarm-edit/types/editor.js +27 -0
- package/dist/feature/swarm-edit/types/editor.js.map +1 -0
- package/dist/feature/swarm-edit/types/index.js +7 -0
- package/dist/feature/swarm-edit/types/index.js.map +1 -0
- package/dist/feature/swarm-edit/types/setting-fields.js +64 -0
- package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -0
- package/dist/feature/swarm-edit/types/shared.js +2 -0
- package/dist/feature/swarm-edit/types/shared.js.map +1 -0
- package/dist/feature/swarm-edit/types/stages.js +69 -0
- package/dist/feature/swarm-edit/types/stages.js.map +1 -0
- package/dist/feature/swarm-edit/types/tag-folders.js +2 -0
- package/dist/feature/swarm-edit/types/tag-folders.js.map +1 -0
- package/dist/feature/swarm-edit/types/views.js +2 -0
- package/dist/feature/swarm-edit/types/views.js.map +1 -0
- package/dist/feature/tags/ports/index.js +2 -0
- package/dist/feature/tags/ports/index.js.map +1 -0
- package/dist/feature/tags/ports/publish.js +2 -0
- package/dist/feature/tags/ports/publish.js.map +1 -0
- package/dist/feature/tags/repositories/index.js +2 -0
- package/dist/feature/tags/repositories/index.js.map +1 -0
- package/dist/feature/tags/repositories/tags.js +36 -0
- package/dist/feature/tags/repositories/tags.js.map +1 -0
- package/dist/feature/tags/services/catalog.js +73 -0
- package/dist/feature/tags/services/catalog.js.map +1 -0
- package/dist/feature/tags/services/create.js +7 -0
- package/dist/feature/tags/services/create.js.map +1 -0
- package/dist/feature/tags/services/index.js +3 -0
- package/dist/feature/tags/services/index.js.map +1 -0
- package/dist/feature/tags/types/ids.js +7 -0
- package/dist/feature/tags/types/ids.js.map +1 -0
- package/dist/feature/tags/types/index.js +3 -0
- package/dist/feature/tags/types/index.js.map +1 -0
- package/dist/feature/tags/types/tags.js +184 -0
- package/dist/feature/tags/types/tags.js.map +1 -0
- package/dist/git/delivery.js +284 -0
- package/dist/git/delivery.js.map +1 -0
- package/dist/git/index.js +4 -0
- package/dist/git/index.js.map +1 -0
- package/dist/git/runner.js +60 -0
- package/dist/git/runner.js.map +1 -0
- package/dist/git/workspace.js +366 -0
- package/dist/git/workspace.js.map +1 -0
- package/dist/mcp/host.js +401 -0
- package/dist/mcp/host.js.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/tools.js +19 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/version.js +5 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/mcp/worker.js +230 -0
- package/dist/mcp/worker.js.map +1 -0
- package/dist/platform/build/fingerprint.js +36 -0
- package/dist/platform/build/fingerprint.js.map +1 -0
- package/dist/platform/build/index.js +3 -0
- package/dist/platform/build/index.js.map +1 -0
- package/dist/platform/build/locations.js +16 -0
- package/dist/platform/build/locations.js.map +1 -0
- package/dist/platform/errors/app-error.js +39 -0
- package/dist/platform/errors/app-error.js.map +1 -0
- package/dist/platform/errors/index.js +2 -0
- package/dist/platform/errors/index.js.map +1 -0
- package/dist/platform/git/delivery.js +284 -0
- package/dist/platform/git/delivery.js.map +1 -0
- package/dist/platform/git/index.js +4 -0
- package/dist/platform/git/index.js.map +1 -0
- package/dist/platform/git/runner.js +65 -0
- package/dist/platform/git/runner.js.map +1 -0
- package/dist/platform/git/workspace.js +366 -0
- package/dist/platform/git/workspace.js.map +1 -0
- package/dist/platform/paths/index.js +2 -0
- package/dist/platform/paths/index.js.map +1 -0
- package/dist/platform/paths/paths.js +39 -0
- package/dist/platform/paths/paths.js.map +1 -0
- package/dist/platform/process/index.js +3 -0
- package/dist/platform/process/index.js.map +1 -0
- package/dist/platform/process/ps.js +42 -0
- package/dist/platform/process/ps.js.map +1 -0
- package/dist/platform/process/which.js +21 -0
- package/dist/platform/process/which.js.map +1 -0
- package/dist/platform/sqlite/database.js +36 -0
- package/dist/platform/sqlite/database.js.map +1 -0
- package/dist/platform/sqlite/index.js +4 -0
- package/dist/platform/sqlite/index.js.map +1 -0
- package/dist/platform/sqlite/migrations.js +297 -0
- package/dist/platform/sqlite/migrations.js.map +1 -0
- package/dist/platform/sqlite/rows.js +13 -0
- package/dist/platform/sqlite/rows.js.map +1 -0
- package/dist/presentation/cli/commands/daemon.js +216 -0
- package/dist/presentation/cli/commands/daemon.js.map +1 -0
- package/dist/presentation/cli/commands/group.js +88 -0
- package/dist/presentation/cli/commands/group.js.map +1 -0
- package/dist/presentation/cli/commands/mcp.js +44 -0
- package/dist/presentation/cli/commands/mcp.js.map +1 -0
- package/dist/presentation/cli/commands/queue-edit.js +155 -0
- package/dist/presentation/cli/commands/queue-edit.js.map +1 -0
- package/dist/presentation/cli/commands/queue.js +222 -0
- package/dist/presentation/cli/commands/queue.js.map +1 -0
- package/dist/presentation/cli/commands/repositories.js +129 -0
- package/dist/presentation/cli/commands/repositories.js.map +1 -0
- package/dist/presentation/cli/commands/run-delivery.js +116 -0
- package/dist/presentation/cli/commands/run-delivery.js.map +1 -0
- package/dist/presentation/cli/commands/run.js +156 -0
- package/dist/presentation/cli/commands/run.js.map +1 -0
- package/dist/presentation/cli/commands/setup.js +97 -0
- package/dist/presentation/cli/commands/setup.js.map +1 -0
- package/dist/presentation/cli/commands/tag.js +92 -0
- package/dist/presentation/cli/commands/tag.js.map +1 -0
- package/dist/presentation/cli/commands/web.js +100 -0
- package/dist/presentation/cli/commands/web.js.map +1 -0
- package/dist/presentation/cli/context.js +49 -0
- package/dist/presentation/cli/context.js.map +1 -0
- package/dist/presentation/cli/help.js +49 -0
- package/dist/presentation/cli/help.js.map +1 -0
- package/dist/presentation/cli/io.js +13 -0
- package/dist/presentation/cli/io.js.map +1 -0
- package/dist/presentation/cli/local/clean.js +72 -0
- package/dist/presentation/cli/local/clean.js.map +1 -0
- package/dist/presentation/cli/local/config-check.js +207 -0
- package/dist/presentation/cli/local/config-check.js.map +1 -0
- package/dist/presentation/cli/local/init.js +44 -0
- package/dist/presentation/cli/local/init.js.map +1 -0
- package/dist/presentation/cli/options.js +34 -0
- package/dist/presentation/cli/options.js.map +1 -0
- package/dist/presentation/cli/probe.js +12 -0
- package/dist/presentation/cli/probe.js.map +1 -0
- package/dist/presentation/cli/program.js +76 -0
- package/dist/presentation/cli/program.js.map +1 -0
- package/dist/presentation/cli/setup/actions.js +206 -0
- package/dist/presentation/cli/setup/actions.js.map +1 -0
- package/dist/presentation/cli/setup/command.js +80 -0
- package/dist/presentation/cli/setup/command.js.map +1 -0
- package/dist/presentation/cli/setup/host.js +20 -0
- package/dist/presentation/cli/setup/host.js.map +1 -0
- package/dist/presentation/cli/setup/index.js +5 -0
- package/dist/presentation/cli/setup/index.js.map +1 -0
- package/dist/presentation/cli/setup/run.js +63 -0
- package/dist/presentation/cli/setup/run.js.map +1 -0
- package/dist/presentation/cli/setup/system.js +53 -0
- package/dist/presentation/cli/setup/system.js.map +1 -0
- package/dist/presentation/cli/setup/types.js +3 -0
- package/dist/presentation/cli/setup/types.js.map +1 -0
- package/dist/presentation/cli/watch.js +24 -0
- package/dist/presentation/cli/watch.js.map +1 -0
- package/dist/presentation/cli/web-control.js +172 -0
- package/dist/presentation/cli/web-control.js.map +1 -0
- package/dist/presentation/format/groups.js +99 -0
- package/dist/presentation/format/groups.js.map +1 -0
- package/dist/presentation/format/index.js +7 -0
- package/dist/presentation/format/index.js.map +1 -0
- package/dist/presentation/format/queue.js +109 -0
- package/dist/presentation/format/queue.js.map +1 -0
- package/dist/presentation/format/runs.js +202 -0
- package/dist/presentation/format/runs.js.map +1 -0
- package/dist/presentation/format/style.js +81 -0
- package/dist/presentation/format/style.js.map +1 -0
- package/dist/presentation/format/table.js +62 -0
- package/dist/presentation/format/table.js.map +1 -0
- package/dist/presentation/format/tags.js +26 -0
- package/dist/presentation/format/tags.js.map +1 -0
- package/dist/presentation/ipc/client/autostart.js +171 -0
- package/dist/presentation/ipc/client/autostart.js.map +1 -0
- package/dist/presentation/ipc/client/client.js +83 -0
- package/dist/presentation/ipc/client/client.js.map +1 -0
- package/dist/presentation/ipc/client/index.js +4 -0
- package/dist/presentation/ipc/client/index.js.map +1 -0
- package/dist/presentation/ipc/client/repository-argument.js +13 -0
- package/dist/presentation/ipc/client/repository-argument.js.map +1 -0
- package/dist/presentation/ipc/contract/agents.js +79 -0
- package/dist/presentation/ipc/contract/agents.js.map +1 -0
- package/dist/presentation/ipc/contract/artifacts.js +27 -0
- package/dist/presentation/ipc/contract/artifacts.js.map +1 -0
- package/dist/presentation/ipc/contract/config.js +141 -0
- package/dist/presentation/ipc/contract/config.js.map +1 -0
- package/dist/presentation/ipc/contract/envelope.js +97 -0
- package/dist/presentation/ipc/contract/envelope.js.map +1 -0
- package/dist/presentation/ipc/contract/groups.js +48 -0
- package/dist/presentation/ipc/contract/groups.js.map +1 -0
- package/dist/presentation/ipc/contract/index.js +14 -0
- package/dist/presentation/ipc/contract/index.js.map +1 -0
- package/dist/presentation/ipc/contract/observers/history.js +26 -0
- package/dist/presentation/ipc/contract/observers/history.js.map +1 -0
- package/dist/presentation/ipc/contract/observers.js +16 -0
- package/dist/presentation/ipc/contract/observers.js.map +1 -0
- package/dist/presentation/ipc/contract/panel.js +53 -0
- package/dist/presentation/ipc/contract/panel.js.map +1 -0
- package/dist/presentation/ipc/contract/processes.js +9 -0
- package/dist/presentation/ipc/contract/processes.js.map +1 -0
- package/dist/presentation/ipc/contract/queue.js +115 -0
- package/dist/presentation/ipc/contract/queue.js.map +1 -0
- package/dist/presentation/ipc/contract/repositories.js +33 -0
- package/dist/presentation/ipc/contract/repositories.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/artifacts.js +2 -0
- package/dist/presentation/ipc/contract/responses/artifacts.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/config.js +2 -0
- package/dist/presentation/ipc/contract/responses/config.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/groups.js +2 -0
- package/dist/presentation/ipc/contract/responses/groups.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/index.js +11 -0
- package/dist/presentation/ipc/contract/responses/index.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/observer-history.js +2 -0
- package/dist/presentation/ipc/contract/responses/observer-history.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/observers.js +2 -0
- package/dist/presentation/ipc/contract/responses/observers.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/processes.js +2 -0
- package/dist/presentation/ipc/contract/responses/processes.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/queue.js +2 -0
- package/dist/presentation/ipc/contract/responses/queue.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/repositories.js +2 -0
- package/dist/presentation/ipc/contract/responses/repositories.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/runs.js +2 -0
- package/dist/presentation/ipc/contract/responses/runs.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/tags.js +2 -0
- package/dist/presentation/ipc/contract/responses/tags.js.map +1 -0
- package/dist/presentation/ipc/contract/runs.js +112 -0
- package/dist/presentation/ipc/contract/runs.js.map +1 -0
- package/dist/presentation/ipc/contract/tags.js +40 -0
- package/dist/presentation/ipc/contract/tags.js.map +1 -0
- package/dist/presentation/ipc/handlers/config.js +38 -0
- package/dist/presentation/ipc/handlers/config.js.map +1 -0
- package/dist/presentation/ipc/handlers/groups.js +14 -0
- package/dist/presentation/ipc/handlers/groups.js.map +1 -0
- package/dist/presentation/ipc/handlers/index.js +2 -0
- package/dist/presentation/ipc/handlers/index.js.map +1 -0
- package/dist/presentation/ipc/handlers/observers.js +14 -0
- package/dist/presentation/ipc/handlers/observers.js.map +1 -0
- package/dist/presentation/ipc/handlers/queue.js +36 -0
- package/dist/presentation/ipc/handlers/queue.js.map +1 -0
- package/dist/presentation/ipc/handlers/repositories.js +26 -0
- package/dist/presentation/ipc/handlers/repositories.js.map +1 -0
- package/dist/presentation/ipc/handlers/runs.js +55 -0
- package/dist/presentation/ipc/handlers/runs.js.map +1 -0
- package/dist/presentation/ipc/handlers/system.js +38 -0
- package/dist/presentation/ipc/handlers/system.js.map +1 -0
- package/dist/presentation/ipc/handlers/table.js +23 -0
- package/dist/presentation/ipc/handlers/table.js.map +1 -0
- package/dist/presentation/ipc/handlers/types.js +2 -0
- package/dist/presentation/ipc/handlers/types.js.map +1 -0
- package/dist/presentation/ipc/publisher.js +175 -0
- package/dist/presentation/ipc/publisher.js.map +1 -0
- package/dist/presentation/ipc/server.js +164 -0
- package/dist/presentation/ipc/server.js.map +1 -0
- package/dist/presentation/ipc/services.js +2 -0
- package/dist/presentation/ipc/services.js.map +1 -0
- package/dist/presentation/ipc/snapshots.js +60 -0
- package/dist/presentation/ipc/snapshots.js.map +1 -0
- package/dist/presentation/ipc/views/catalog.js +9 -0
- package/dist/presentation/ipc/views/catalog.js.map +1 -0
- package/dist/presentation/ipc/views/groups.js +112 -0
- package/dist/presentation/ipc/views/groups.js.map +1 -0
- package/dist/presentation/ipc/views/index.js +10 -0
- package/dist/presentation/ipc/views/index.js.map +1 -0
- package/dist/presentation/ipc/views/observer-history.js +26 -0
- package/dist/presentation/ipc/views/observer-history.js.map +1 -0
- package/dist/presentation/ipc/views/observers.js +16 -0
- package/dist/presentation/ipc/views/observers.js.map +1 -0
- package/dist/presentation/ipc/views/queue.js +151 -0
- package/dist/presentation/ipc/views/queue.js.map +1 -0
- package/dist/presentation/ipc/views/repositories.js +34 -0
- package/dist/presentation/ipc/views/repositories.js.map +1 -0
- package/dist/presentation/ipc/views/rows.js +117 -0
- package/dist/presentation/ipc/views/rows.js.map +1 -0
- package/dist/presentation/ipc/views/run-stages.js +66 -0
- package/dist/presentation/ipc/views/run-stages.js.map +1 -0
- package/dist/presentation/ipc/views/runs.js +201 -0
- package/dist/presentation/ipc/views/runs.js.map +1 -0
- package/dist/presentation/ipc/views/tags.js +19 -0
- package/dist/presentation/ipc/views/tags.js.map +1 -0
- package/dist/presentation/mcp/host-kit.js +67 -0
- package/dist/presentation/mcp/host-kit.js.map +1 -0
- package/dist/presentation/mcp/host-queue-control.js +135 -0
- package/dist/presentation/mcp/host-queue-control.js.map +1 -0
- package/dist/presentation/mcp/host-queue.js +124 -0
- package/dist/presentation/mcp/host-queue.js.map +1 -0
- package/dist/presentation/mcp/host-runs.js +173 -0
- package/dist/presentation/mcp/host-runs.js.map +1 -0
- package/dist/presentation/mcp/host.js +34 -0
- package/dist/presentation/mcp/host.js.map +1 -0
- package/dist/presentation/mcp/index.js +3 -0
- package/dist/presentation/mcp/index.js.map +1 -0
- package/dist/presentation/mcp/tools.js +19 -0
- package/dist/presentation/mcp/tools.js.map +1 -0
- package/dist/presentation/mcp/worker-extra.js +144 -0
- package/dist/presentation/mcp/worker-extra.js.map +1 -0
- package/dist/presentation/mcp/worker-tools.js +107 -0
- package/dist/presentation/mcp/worker-tools.js.map +1 -0
- package/dist/presentation/mcp/worker.js +12 -0
- package/dist/presentation/mcp/worker.js.map +1 -0
- package/dist/presentation/web/errors.js +60 -0
- package/dist/presentation/web/errors.js.map +1 -0
- package/dist/presentation/web/http.js +130 -0
- package/dist/presentation/web/http.js.map +1 -0
- package/dist/presentation/web/hub.js +164 -0
- package/dist/presentation/web/hub.js.map +1 -0
- package/dist/presentation/web/index.js +7 -0
- package/dist/presentation/web/index.js.map +1 -0
- package/dist/presentation/web/options.js +7 -0
- package/dist/presentation/web/options.js.map +1 -0
- package/dist/presentation/web/pages.js +44 -0
- package/dist/presentation/web/pages.js.map +1 -0
- package/dist/presentation/web/panel/daemon-panel.js +207 -0
- package/dist/presentation/web/panel/daemon-panel.js.map +1 -0
- package/dist/presentation/web/panel/default-repository.js +14 -0
- package/dist/presentation/web/panel/default-repository.js.map +1 -0
- package/dist/presentation/web/panel/directories.js +48 -0
- package/dist/presentation/web/panel/directories.js.map +1 -0
- package/dist/presentation/web/panel/open.js +12 -0
- package/dist/presentation/web/panel/open.js.map +1 -0
- package/dist/presentation/web/panel/standby.js +119 -0
- package/dist/presentation/web/panel/standby.js.map +1 -0
- package/dist/presentation/web/panel/state.js +69 -0
- package/dist/presentation/web/panel/state.js.map +1 -0
- package/dist/presentation/web/panel/system.js +66 -0
- package/dist/presentation/web/panel/system.js.map +1 -0
- package/dist/presentation/web/request.js +123 -0
- package/dist/presentation/web/request.js.map +1 -0
- package/dist/presentation/web/routes/config.js +166 -0
- package/dist/presentation/web/routes/config.js.map +1 -0
- package/dist/presentation/web/routes/directories.js +60 -0
- package/dist/presentation/web/routes/directories.js.map +1 -0
- package/dist/presentation/web/routes/downloads.js +65 -0
- package/dist/presentation/web/routes/downloads.js.map +1 -0
- package/dist/presentation/web/routes/groups.js +85 -0
- package/dist/presentation/web/routes/groups.js.map +1 -0
- package/dist/presentation/web/routes/observers/history.js +19 -0
- package/dist/presentation/web/routes/observers/history.js.map +1 -0
- package/dist/presentation/web/routes/processes.js +21 -0
- package/dist/presentation/web/routes/processes.js.map +1 -0
- package/dist/presentation/web/routes/queue.js +80 -0
- package/dist/presentation/web/routes/queue.js.map +1 -0
- package/dist/presentation/web/routes/repositories.js +66 -0
- package/dist/presentation/web/routes/repositories.js.map +1 -0
- package/dist/presentation/web/routes/runs.js +76 -0
- package/dist/presentation/web/routes/runs.js.map +1 -0
- package/dist/presentation/web/routes/settings.js +74 -0
- package/dist/presentation/web/routes/settings.js.map +1 -0
- package/dist/presentation/web/routes/specialists.js +74 -0
- package/dist/presentation/web/routes/specialists.js.map +1 -0
- package/dist/presentation/web/routes/system.js +96 -0
- package/dist/presentation/web/routes/system.js.map +1 -0
- package/dist/presentation/web/routes/tags.js +46 -0
- package/dist/presentation/web/routes/tags.js.map +1 -0
- package/dist/presentation/web/routes/types.js +2 -0
- package/dist/presentation/web/routes/types.js.map +1 -0
- package/dist/presentation/web/server.js +185 -0
- package/dist/presentation/web/server.js.map +1 -0
- package/dist/protocol/autostart.js +171 -0
- package/dist/protocol/autostart.js.map +1 -0
- package/dist/protocol/build.js +38 -0
- package/dist/protocol/build.js.map +1 -0
- package/dist/protocol/catalog.js +18 -0
- package/dist/protocol/catalog.js.map +1 -0
- package/dist/protocol/client.js +83 -0
- package/dist/protocol/client.js.map +1 -0
- package/dist/protocol/format.js +477 -0
- package/dist/protocol/format.js.map +1 -0
- package/dist/protocol/index.js +11 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/messages.js +598 -0
- package/dist/protocol/messages.js.map +1 -0
- package/dist/protocol/style.js +81 -0
- package/dist/protocol/style.js.map +1 -0
- package/dist/protocol/transcript.js +49 -0
- package/dist/protocol/transcript.js.map +1 -0
- package/dist/protocol/views.js +696 -0
- package/dist/protocol/views.js.map +1 -0
- package/dist/runtime/catalog.js +117 -0
- package/dist/runtime/catalog.js.map +1 -0
- package/dist/runtime/claude.js +399 -0
- package/dist/runtime/claude.js.map +1 -0
- package/dist/runtime/index.js +34 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/message.js +48 -0
- package/dist/runtime/message.js.map +1 -0
- package/dist/runtime/naming.js +69 -0
- package/dist/runtime/naming.js.map +1 -0
- package/dist/runtime/opencode.js +189 -0
- package/dist/runtime/opencode.js.map +1 -0
- package/dist/runtime/skills.js +17 -0
- package/dist/runtime/skills.js.map +1 -0
- package/dist/runtime/transcript.js +227 -0
- package/dist/runtime/transcript.js.map +1 -0
- package/dist/runtime/types.js +12 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/which.js +21 -0
- package/dist/runtime/which.js.map +1 -0
- package/dist/store/index.js +3 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/schema.js +286 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/store.js +491 -0
- package/dist/store/store.js.map +1 -0
- package/dist/web/assets/EntryList-CnfGgjEY.js +1 -0
- package/dist/web/assets/FilePath-C0X8-keS.js +1 -0
- package/dist/web/assets/SettingsForm-BcyBWJbn.js +1 -0
- package/dist/web/assets/SharedPipelinesGroup-a368-IQ0.js +1 -0
- package/dist/web/assets/card-DkikoTxR.js +1 -0
- package/dist/web/assets/deliveryModes-funlvXVC.js +1 -0
- package/dist/web/assets/index-B-oJ93zH.js +22 -0
- package/dist/web/assets/index-BZE36gYR.css +2 -0
- package/dist/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/web/assets/locales-DtRrxYzg.js +1 -0
- package/dist/web/assets/pipelines-D48ggDNe.js +1 -0
- package/dist/web/assets/queue-D8_RY4IY.js +16 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/select-J4oIrmYh.js +1 -0
- package/dist/web/assets/settings-B0-0Vaia.js +2 -0
- package/dist/web/assets/skeleton-CCKCQF5n.js +1 -0
- package/dist/web/assets/specialists-DH8tyluO.js +1 -0
- package/dist/web/assets/switch-CWFAgxG1.js +41 -0
- package/dist/web/assets/topology-CNQ28AB2.js +7 -0
- package/dist/web/assets/topology-DLioOiRN.css +1 -0
- package/dist/web/assets/vendor-markdown-DwXfjc7L.js +32 -0
- package/dist/web/assets/vendor-react-C1iE8mnY.js +9 -0
- package/dist/web/index.html +21 -0
- package/integrations/claude-code/.claude-plugin/plugin.json +19 -0
- package/integrations/claude-code/commands/apply.md +6 -0
- package/integrations/claude-code/commands/panel.md +6 -0
- package/integrations/claude-code/commands/run.md +6 -0
- package/integrations/claude-code/commands/status.md +6 -0
- package/integrations/claude-code/commands/web.md +6 -0
- package/integrations/claude-code/hooks/aip.ts +365 -0
- package/integrations/claude-code/hooks/feed.ts +923 -0
- package/integrations/claude-code/hooks/hooks.json +1 -0
- package/integrations/claude-code/hooks/pane.ts +396 -0
- package/integrations/claude-code/hooks/register.tsx +156 -0
- package/integrations/claude-code/hooks/theme.ts +59 -0
- package/integrations/claude-code/hooks/transcript.tsx +44 -0
- package/integrations/claude-code/hooks/view.tsx +378 -0
- package/integrations/claude-code/hooks/web.ts +162 -0
- package/integrations/claude-code/tsconfig.json +18 -0
- package/integrations/claude-code/types/index.d.ts +89 -0
- package/package.json +70 -4
- package/templates/aip/pipelines/feature.yaml +4 -0
- package/templates/aip/settings.yaml +10 -0
- package/templates/aip/specialists/coder.yaml +4 -0
- package/templates/aip/specialists/reviewer.yaml +5 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { randomInt } from 'node:crypto';
|
|
2
|
+
import { rejected } from '../../../platform/errors/index.js';
|
|
3
|
+
import { currentPermissions, currentSpecialists, } from '../../runs/services/index.js';
|
|
4
|
+
import { retryableGroups, } from '../../runs/types/index.js';
|
|
5
|
+
import { adoptRun, dismissRun, itemStarted, pauseQueue, pauseRun, problemKeys, queueItemId, returnRun, setParallel, setQueueSettings, startQueue, } from '../types/index.js';
|
|
6
|
+
/** Starting, pausing and setting up a queue; returning, pausing and retrying its runs. */
|
|
7
|
+
export class QueueControl {
|
|
8
|
+
dependencies;
|
|
9
|
+
constructor(dependencies) {
|
|
10
|
+
this.dependencies = dependencies;
|
|
11
|
+
}
|
|
12
|
+
/** The queue of the repository that holds `path`. */
|
|
13
|
+
async queueOf(path) {
|
|
14
|
+
return this.dependencies.store.of(await this.dependencies.registry.rootOf(path));
|
|
15
|
+
}
|
|
16
|
+
async start(params) {
|
|
17
|
+
const { store, advance, registry, now } = this.dependencies;
|
|
18
|
+
const queue = await this.queueOf(params.repository);
|
|
19
|
+
registry.requireEnabled(queue.repository);
|
|
20
|
+
if (params.parallel !== undefined)
|
|
21
|
+
setParallel(queue, params.parallel, now());
|
|
22
|
+
startQueue(queue, this.statesOf(queue), now());
|
|
23
|
+
store.save(queue);
|
|
24
|
+
await advance.advance(queue.repository);
|
|
25
|
+
return queue;
|
|
26
|
+
}
|
|
27
|
+
async pause(params) {
|
|
28
|
+
const queue = await this.queueOf(params.repository);
|
|
29
|
+
pauseQueue(queue, this.dependencies.now());
|
|
30
|
+
return this.dependencies.store.save(queue);
|
|
31
|
+
}
|
|
32
|
+
async settings(params) {
|
|
33
|
+
const { store, advance, now } = this.dependencies;
|
|
34
|
+
const queue = await this.queueOf(params.repository);
|
|
35
|
+
const { parallel, autopilot, autoAnswer, skipFailed, autopilotAnswer } = params;
|
|
36
|
+
const onLimit = params.onLimit;
|
|
37
|
+
const enablesAutopilot = autopilot === true && !queue.autopilot;
|
|
38
|
+
setQueueSettings(queue, { parallel, autopilot, autoAnswer, skipFailed, autopilotAnswer, onLimit }, now());
|
|
39
|
+
const enabled = this.dependencies.registry.entry(queue.repository)?.enabled !== false;
|
|
40
|
+
if (enablesAutopilot && enabled && queue.status === 'stopped' && queue.stop === null) {
|
|
41
|
+
startQueue(queue, this.statesOf(queue), now());
|
|
42
|
+
}
|
|
43
|
+
store.save(queue);
|
|
44
|
+
await advance.advance(queue.repository);
|
|
45
|
+
return queue;
|
|
46
|
+
}
|
|
47
|
+
/** `queue_run_now`: the item starts at once, taking a place a lower run may give up. */
|
|
48
|
+
async runNow(params) {
|
|
49
|
+
const { store, advance, runs, registry, now } = this.dependencies;
|
|
50
|
+
const queue = await this.queueOf(params.repository);
|
|
51
|
+
registry.requireEnabled(queue.repository);
|
|
52
|
+
const item = queue.items.find((candidate) => candidate.id === params.item);
|
|
53
|
+
if (!item)
|
|
54
|
+
throw rejected('unknown queue item');
|
|
55
|
+
if (item.run !== null) {
|
|
56
|
+
const target = runs.states.lookup(item.run);
|
|
57
|
+
if (!target)
|
|
58
|
+
throw rejected(`unknown run \`${item.run}\``);
|
|
59
|
+
if (target.run.hold === null && retryableGroups(target).length === 0) {
|
|
60
|
+
throw rejected('run has no failed or cancelled groups');
|
|
61
|
+
}
|
|
62
|
+
await advance.claimPlace(queue, item.run);
|
|
63
|
+
const resumed = await advance.takeReturned(queue, item);
|
|
64
|
+
store.save(queue);
|
|
65
|
+
return resumed;
|
|
66
|
+
}
|
|
67
|
+
const created = await advance.createRun(queue, item);
|
|
68
|
+
await advance.claimPlace(queue, created.runId);
|
|
69
|
+
itemStarted(queue, item.id, created.runId, now());
|
|
70
|
+
store.save(queue);
|
|
71
|
+
return created;
|
|
72
|
+
}
|
|
73
|
+
/** `queue_return`: the run goes back to the queue as its first item. */
|
|
74
|
+
returnRun(params) {
|
|
75
|
+
return this.withQueue(params, (queue, state, id, moment) => {
|
|
76
|
+
this.dependencies.registry.requireEnabled(queue.repository);
|
|
77
|
+
return returnRun(queue, state, id, moment);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* `run_pause`: the run keeps `hold: paused` and becomes the last item of the queue; the running
|
|
82
|
+
* agents are stopped by the `hold` event, and after run-now the step continues in the same session.
|
|
83
|
+
*/
|
|
84
|
+
pauseRun(params) {
|
|
85
|
+
return this.withQueue(params, async (queue, state, id, moment) => {
|
|
86
|
+
const item = pauseRun(queue, state, id, moment);
|
|
87
|
+
await this.dependencies.runs.engine.apply(state, { kind: 'hold', hold: 'paused' });
|
|
88
|
+
return item;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** `queue_dismiss`: a skipped run leaves the skipped list. */
|
|
92
|
+
async dismiss(params) {
|
|
93
|
+
const { queue } = await this.withQueue(params, (queue, state, _id, moment) => {
|
|
94
|
+
dismissRun(queue, state, moment);
|
|
95
|
+
return { id: '' };
|
|
96
|
+
});
|
|
97
|
+
return queue;
|
|
98
|
+
}
|
|
99
|
+
/** `retry`: a direct retry works at once, and the revived run holds a place in the queue. */
|
|
100
|
+
retry(params) {
|
|
101
|
+
const { runs } = this.dependencies;
|
|
102
|
+
return runs.engine.serial(() => this.retryNow(runs.states.get(params.runId), params));
|
|
103
|
+
}
|
|
104
|
+
/** The retry itself, for callers that already run inside `serial`. */
|
|
105
|
+
async retryNow(state, params) {
|
|
106
|
+
const { store, advance, config, runs, registry, now } = this.dependencies;
|
|
107
|
+
registry.requireEnabled(state.run.repository);
|
|
108
|
+
const keys = problemKeys(state);
|
|
109
|
+
// Loaded before the event: a broken configuration refuses the retry with nothing changed.
|
|
110
|
+
const refresh = params.refreshConfig === true
|
|
111
|
+
? { specialists: currentSpecialists(config, state) }
|
|
112
|
+
: { permissions: currentPermissions(config, state) };
|
|
113
|
+
// A rejected retry leaves the hold in place; the hold is released only after it succeeds.
|
|
114
|
+
await runs.engine.apply(state, { kind: 'retry', group: params.group, ...refresh });
|
|
115
|
+
if (state.run.hold !== null)
|
|
116
|
+
await runs.engine.apply(state, { kind: 'hold', hold: null });
|
|
117
|
+
const queue = store.of(state.run.repository);
|
|
118
|
+
const moment = now();
|
|
119
|
+
const adopted = adoptRun(queue, state, keys, moment, {
|
|
120
|
+
states: this.statesOf(queue),
|
|
121
|
+
itemId: queueItemId(moment, randomInt(36 ** 3)),
|
|
122
|
+
});
|
|
123
|
+
if (adopted) {
|
|
124
|
+
if (adopted.frozen !== null)
|
|
125
|
+
await advance.freeze(adopted.frozen);
|
|
126
|
+
store.save(queue);
|
|
127
|
+
advance.request(state.run.repository);
|
|
128
|
+
}
|
|
129
|
+
return state;
|
|
130
|
+
}
|
|
131
|
+
statesOf(queue) {
|
|
132
|
+
return queue.runs.flatMap((id) => this.dependencies.runs.states.lookup(id) ?? []);
|
|
133
|
+
}
|
|
134
|
+
/** A change of a run in its queue: checked, saved, then the queue advances. */
|
|
135
|
+
withQueue(params, change) {
|
|
136
|
+
const { store, advance, registry, runs, now } = this.dependencies;
|
|
137
|
+
return runs.engine.serial(async () => {
|
|
138
|
+
const state = runs.states.get(params.runId);
|
|
139
|
+
if (params.repository !== undefined) {
|
|
140
|
+
const root = await registry.rootOf(params.repository);
|
|
141
|
+
if (root !== state.run.repository)
|
|
142
|
+
throw rejected('run belongs to another repository');
|
|
143
|
+
}
|
|
144
|
+
const queue = store.of(state.run.repository);
|
|
145
|
+
const moment = now();
|
|
146
|
+
const item = await change(queue, state, queueItemId(moment, randomInt(36 ** 3)), moment);
|
|
147
|
+
store.save(queue);
|
|
148
|
+
await advance.advance(state.run.repository);
|
|
149
|
+
return { queue, item: item.id };
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,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1
|
+
import { QueueRepository } from '../repositories/index.js';
|
|
2
|
+
import { QueueAdvance } from './advance.js';
|
|
3
|
+
import { QueueControl } from './control.js';
|
|
4
|
+
import { QueueEdit } from './edit.js';
|
|
5
|
+
import { QueueItems } from './items.js';
|
|
6
|
+
import { QueueStore } from './store.js';
|
|
7
|
+
import { TaskTags } from './task-tags.js';
|
|
8
|
+
export function createQueueServices(dependencies) {
|
|
9
|
+
const { database, runs, tags, registry, config, now } = dependencies;
|
|
10
|
+
const queues = new QueueRepository(database);
|
|
11
|
+
const store = new QueueStore({ queues, states: runs.states, now, publish: dependencies.publish });
|
|
12
|
+
const { repair, observe } = dependencies;
|
|
13
|
+
const advance = new QueueAdvance({ store, runs, tags, config, repair, observe, now });
|
|
14
|
+
const taskTags = new TaskTags({ database, store, tags, registry, runs, now });
|
|
15
|
+
const shared = { store, advance, taskTags, tags, registry, config, runs, now };
|
|
16
|
+
const items = new QueueItems(shared);
|
|
17
|
+
return {
|
|
18
|
+
store,
|
|
19
|
+
advance,
|
|
20
|
+
items,
|
|
21
|
+
edit: new QueueEdit({ ...shared, items }),
|
|
22
|
+
control: new QueueControl(shared),
|
|
23
|
+
taskTags,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/create.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,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types/index.js';
|
|
3
|
+
import { keepLinkedTags, knownTags, mergeTags, resolveManualTags, withoutLinkedTags, } from '../../tags/types/index.js';
|
|
4
|
+
import { checkDependencies, checkPosition, checkReturnedPatch, dependencyTags, editItem, spreadTags, } from '../types/index.js';
|
|
5
|
+
/** `queue_edit`: the fields of an item change; a returned run changes its own skipped steps. */
|
|
6
|
+
export class QueueEdit {
|
|
7
|
+
dependencies;
|
|
8
|
+
constructor(dependencies) {
|
|
9
|
+
this.dependencies = dependencies;
|
|
10
|
+
}
|
|
11
|
+
async edit(params) {
|
|
12
|
+
const { store, advance, registry, items, now } = this.dependencies;
|
|
13
|
+
const repository = await registry.rootOf(params.repository);
|
|
14
|
+
const queue = store.of(repository);
|
|
15
|
+
const moment = now();
|
|
16
|
+
const existing = queue.items.find((candidate) => candidate.id === params.item);
|
|
17
|
+
// The tags before the edit: those added by it spread to the items that wait for this one.
|
|
18
|
+
const before = existing?.tags ?? [];
|
|
19
|
+
if (existing?.run && params.parent !== undefined) {
|
|
20
|
+
throw rejected('a returned run keeps its own task');
|
|
21
|
+
}
|
|
22
|
+
const parentState = params.parent === undefined || params.parent === null
|
|
23
|
+
? null
|
|
24
|
+
: items.resolveParent(repository, params.parent);
|
|
25
|
+
let skip = params.skip;
|
|
26
|
+
if (existing?.run && skip !== undefined) {
|
|
27
|
+
await this.skipInRun(queue, existing, params);
|
|
28
|
+
skip = undefined;
|
|
29
|
+
}
|
|
30
|
+
if (params.pipeline !== undefined || skip !== undefined) {
|
|
31
|
+
if (existing) {
|
|
32
|
+
await items.ensureItem(repository, params.pipeline ?? existing.pipeline, skip ?? existing.skip);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const after = params.after === undefined ? undefined : items.resolveDependencies(queue, params.after);
|
|
36
|
+
const { pipeline, task, groups, title, position, autoDeliver, deliveryMode, postponed } = params;
|
|
37
|
+
const patch = { pipeline, task, groups, title, position, autoDeliver, deliveryMode };
|
|
38
|
+
const fields = { ...patch, skip, after, postponed };
|
|
39
|
+
const tags = await this.tagsOf(queue, existing, params, parentState, fields, moment);
|
|
40
|
+
editItem(queue, params.item, { ...fields, tags }, moment);
|
|
41
|
+
const edited = queue.items.find((candidate) => candidate.id === params.item);
|
|
42
|
+
if (edited) {
|
|
43
|
+
const added = edited.tags.filter((id) => !before.includes(id));
|
|
44
|
+
spreadTags(queue, params.item, added, moment);
|
|
45
|
+
}
|
|
46
|
+
store.save(queue);
|
|
47
|
+
await advance.advance(repository);
|
|
48
|
+
return queue;
|
|
49
|
+
}
|
|
50
|
+
/** A returned run has no item-level skip: the steps are skipped in the run itself. */
|
|
51
|
+
async skipInRun(queue, item, params) {
|
|
52
|
+
const { runs, items } = this.dependencies;
|
|
53
|
+
const { pipeline, task, groups, title, autoDeliver, deliveryMode, postponed, skip } = params;
|
|
54
|
+
checkReturnedPatch({
|
|
55
|
+
pipeline,
|
|
56
|
+
task,
|
|
57
|
+
groups,
|
|
58
|
+
title,
|
|
59
|
+
tags: params.tags,
|
|
60
|
+
autoDeliver,
|
|
61
|
+
deliveryMode,
|
|
62
|
+
postponed,
|
|
63
|
+
skip,
|
|
64
|
+
}, true);
|
|
65
|
+
const state = runs.states.lookup(item.run);
|
|
66
|
+
if (!state)
|
|
67
|
+
throw rejected(`unknown run \`${item.run}\``);
|
|
68
|
+
const changes = this.skipChanges(state, new Set(skip));
|
|
69
|
+
if (params.position !== undefined)
|
|
70
|
+
checkPosition(queue, params.position);
|
|
71
|
+
if (params.after !== undefined) {
|
|
72
|
+
const after = [...new Set(items.resolveDependencies(queue, params.after))];
|
|
73
|
+
checkDependencies(queue, params.item, after);
|
|
74
|
+
}
|
|
75
|
+
for (const [step, on] of changes) {
|
|
76
|
+
await runs.engine.apply(state, { kind: 'step_skip', step, skip: on });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** The steps to skip and to bring back; a step every group has passed cannot change. */
|
|
80
|
+
skipChanges(state, wanted) {
|
|
81
|
+
const current = new Set(state.run.skippedSteps);
|
|
82
|
+
const skipError = checkSkip(state.run.config, state.run.pipeline, [...wanted]);
|
|
83
|
+
if (skipError !== null)
|
|
84
|
+
throw rejected(skipError);
|
|
85
|
+
const changes = [
|
|
86
|
+
...[...current].filter((step) => !wanted.has(step)).map((step) => [step, false]),
|
|
87
|
+
...[...wanted].filter((step) => !current.has(step)).map((step) => [step, true]),
|
|
88
|
+
];
|
|
89
|
+
for (const [step] of changes) {
|
|
90
|
+
if (stepStates(state).find((entry) => entry.id === step)?.state === 'done') {
|
|
91
|
+
throw rejected(`step \`${step}\` is already passed by every group`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return changes;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The tags of the edited item: the named ones keep the linked tags, a new parent replaces its
|
|
98
|
+
* linked tag, new predecessors give theirs. Every check of the edit runs on a copy before the
|
|
99
|
+
* tag of the parent is created.
|
|
100
|
+
*/
|
|
101
|
+
async tagsOf(queue, existing, params, parentState, fields, moment) {
|
|
102
|
+
const { tags: catalogs, taskTags, runs } = this.dependencies;
|
|
103
|
+
const catalog = () => catalogs.of(queue.repository);
|
|
104
|
+
let tags = params.tags === undefined ? undefined : resolveManualTags(catalog(), params.tags);
|
|
105
|
+
if (existing && tags !== undefined) {
|
|
106
|
+
tags = keepLinkedTags(catalog(), knownTags(catalog(), existing.tags), tags);
|
|
107
|
+
}
|
|
108
|
+
if (existing && parentState)
|
|
109
|
+
editItem(structuredClone(queue), params.item, fields, moment);
|
|
110
|
+
if (existing && params.parent !== undefined) {
|
|
111
|
+
const parentTag = parentState
|
|
112
|
+
? await taskTags.parentTagFor(queue.repository, parentState)
|
|
113
|
+
: null;
|
|
114
|
+
const rest = withoutLinkedTags(catalog(), tags ?? existing.tags);
|
|
115
|
+
tags = mergeTags(parentTag ? [parentTag.id] : [], rest);
|
|
116
|
+
}
|
|
117
|
+
if (existing && fields.after !== undefined) {
|
|
118
|
+
const fresh = fields.after.filter((ref) => !existing.after.includes(ref));
|
|
119
|
+
const inherited = knownTags(catalog(), dependencyTags(queue, fresh, (id) => runs.states.lookup(id)?.run.tags));
|
|
120
|
+
if (inherited.length > 0)
|
|
121
|
+
tags = mergeTags(tags ?? existing.tags, inherited);
|
|
122
|
+
}
|
|
123
|
+
return tags;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAiB,MAAM,2BAA2B,CAAC;AAEjF,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,UAAU,GAIX,MAAM,mBAAmB,CAAC;AAkB3B,gGAAgG;AAChG,MAAM,OAAO,SAAS;IACH,YAAY,CAAwB;IAErD,YAAY,YAAmC;QAC7C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAwB;QACjC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;QACnE,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,E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C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1E,MAAM,SAAS,GAAG,SAAS,CACzB,OAAO,EAAE,EACT,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CACvE,CAAC;YACF,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;gBAAE,IAAI,GAAG,SAAS,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { QueueAdvance } from './advance.js';
|
|
2
|
+
export { QueueControl } from './control.js';
|
|
3
|
+
export { createQueueServices } from './create.js';
|
|
4
|
+
export { QueueEdit } from './edit.js';
|
|
5
|
+
export { QueueItems } from './items.js';
|
|
6
|
+
export { QueueStore } from './store.js';
|
|
7
|
+
export { TaskTags } from './task-tags.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAsB,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { randomInt } from 'node:crypto';
|
|
2
|
+
import { rejected } from '../../../platform/errors/index.js';
|
|
3
|
+
import { checkSkip } from '../../runs/types/index.js';
|
|
4
|
+
import { findPipeline, findSpecialist } from '../../swarm-config/types/index.js';
|
|
5
|
+
import { knownTags, mergeTags, parseParentRef, resolveManualTags } from '../../tags/types/index.js';
|
|
6
|
+
import { addItem, queueItemId, removeItem, startQueue, } from '../types/index.js';
|
|
7
|
+
/** The fields of a new item without the tags, which are resolved separately. */
|
|
8
|
+
function fields(request) {
|
|
9
|
+
const { pipeline, task, groups, title, autoDeliver, deliveryMode, skip, after } = request;
|
|
10
|
+
return {
|
|
11
|
+
pipeline,
|
|
12
|
+
task,
|
|
13
|
+
groups,
|
|
14
|
+
title,
|
|
15
|
+
autoDeliver,
|
|
16
|
+
deliveryMode,
|
|
17
|
+
skip,
|
|
18
|
+
after,
|
|
19
|
+
...(request.postponed !== undefined ? { postponed: request.postponed } : {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** The tasks of a queue: added by the user or a specialist, and removed. */
|
|
23
|
+
export class QueueItems {
|
|
24
|
+
dependencies;
|
|
25
|
+
constructor(dependencies) {
|
|
26
|
+
this.dependencies = dependencies;
|
|
27
|
+
}
|
|
28
|
+
/** `run`: the task goes to the end of the queue, a stopped queue is started, then the queue advances. */
|
|
29
|
+
async enqueue(params) {
|
|
30
|
+
const { store, advance, registry, tags, taskTags, runs, now } = this.dependencies;
|
|
31
|
+
const repository = await registry.rootOf(params.repository);
|
|
32
|
+
registry.requireEnabled(repository);
|
|
33
|
+
const queue = store.of(repository);
|
|
34
|
+
const moment = now();
|
|
35
|
+
await this.ensureItem(repository, params.pipeline, params.skip);
|
|
36
|
+
const after = this.resolveDependencies(queue, params.after ?? []);
|
|
37
|
+
const manual = resolveManualTags(tags.of(repository), params.tags ?? []);
|
|
38
|
+
const parent = params.parent === undefined ? null : this.resolveParent(repository, params.parent);
|
|
39
|
+
const { postponed: _postponed, ...task } = fields({ ...params, after });
|
|
40
|
+
if (parent)
|
|
41
|
+
this.checkNewItem(queue, task, moment);
|
|
42
|
+
const parentTag = parent ? await taskTags.parentTagFor(repository, parent) : null;
|
|
43
|
+
const own = mergeTags(parentTag ? [parentTag.id] : [], manual);
|
|
44
|
+
const item = addItem(queue, { ...task, tags: taskTags.inherit(queue, own, after) }, queueItemId(moment, randomInt(36 ** 3)), moment);
|
|
45
|
+
if (queue.status === 'stopped') {
|
|
46
|
+
startQueue(queue, queue.runs.flatMap((id) => runs.states.lookup(id) ?? []), moment);
|
|
47
|
+
}
|
|
48
|
+
store.save(queue);
|
|
49
|
+
const started = await advance.advance(repository);
|
|
50
|
+
const run = started.get(item.id) ?? null;
|
|
51
|
+
if (!run && queue.stop?.kind === 'item' && queue.stop.item === item.id) {
|
|
52
|
+
throw rejected(queue.stop.error);
|
|
53
|
+
}
|
|
54
|
+
return { item: item.id, number: item.number, run, queue };
|
|
55
|
+
}
|
|
56
|
+
/** `queue_add`: the task goes to the queue, which advances. */
|
|
57
|
+
async add(params) {
|
|
58
|
+
const repository = await this.dependencies.registry.rootOf(params.repository);
|
|
59
|
+
return this.addTo(repository, params);
|
|
60
|
+
}
|
|
61
|
+
/** `queue_remove`: the item leaves the queue; a returned run it stood for is released. */
|
|
62
|
+
async remove(params) {
|
|
63
|
+
const { store, registry, runs, now } = this.dependencies;
|
|
64
|
+
const queue = store.of(await registry.rootOf(params.repository));
|
|
65
|
+
const removed = queue.items.find((candidate) => candidate.id === params.item);
|
|
66
|
+
removeItem(queue, params.item, now(), (id) => runs.states.lookup(id));
|
|
67
|
+
const held = removed?.run ? runs.states.lookup(removed.run) : undefined;
|
|
68
|
+
if (held && held.run.hold !== null) {
|
|
69
|
+
await runs.engine.apply(held, { kind: 'hold', hold: null });
|
|
70
|
+
}
|
|
71
|
+
return store.save(queue);
|
|
72
|
+
}
|
|
73
|
+
/** A task from a specialist with `queue: true` goes to the queue of the repository of its run. */
|
|
74
|
+
workerAdd(params) {
|
|
75
|
+
const { runs, store, taskTags, tags, now } = this.dependencies;
|
|
76
|
+
return runs.engine.serial(async () => {
|
|
77
|
+
const key = runs.effects.attemptFor(params.token);
|
|
78
|
+
if (!key)
|
|
79
|
+
throw rejected('unknown or expired report token');
|
|
80
|
+
const state = runs.states.get(key.run);
|
|
81
|
+
const attempt = state.groups
|
|
82
|
+
.find((group) => group.slug === key.group)
|
|
83
|
+
?.attempts.find((candidate) => candidate.seq === key.seq);
|
|
84
|
+
if (!attempt || attempt.status !== 'running') {
|
|
85
|
+
throw rejected('unknown or expired report token');
|
|
86
|
+
}
|
|
87
|
+
if (findSpecialist(state.run.config, attempt.specialist)?.queue !== true) {
|
|
88
|
+
throw rejected(`specialist \`${attempt.specialist}\` may not add tasks to the queue`);
|
|
89
|
+
}
|
|
90
|
+
// Every task carries the linked task tag of its run, then the other tags of the run.
|
|
91
|
+
const repository = state.run.repository;
|
|
92
|
+
this.dependencies.registry.requireEnabled(repository);
|
|
93
|
+
await this.ensureItem(repository, params.pipeline, params.skip);
|
|
94
|
+
const queue = store.of(repository);
|
|
95
|
+
const after = this.resolveDependencies(queue, params.after ?? []);
|
|
96
|
+
this.checkNewItem(queue, fields({ ...params, after }), now());
|
|
97
|
+
const tag = await taskTags.linkedTagFor(state);
|
|
98
|
+
const inherited = mergeTags([tag.id], knownTags(tags.of(repository), state.run.tags));
|
|
99
|
+
return this.addTo(repository, params, inherited);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** Rejects an unknown pipeline or a `skip` that does not fit it. */
|
|
103
|
+
async ensureItem(repository, pipeline, skip = []) {
|
|
104
|
+
const config = this.dependencies.config.load(repository);
|
|
105
|
+
if (!findPipeline(config, pipeline)) {
|
|
106
|
+
const known = config.pipelines.map((candidate) => candidate.id).join(', ') || 'none';
|
|
107
|
+
throw rejected(`unknown pipeline \`${pipeline}\`; known: ${known}`);
|
|
108
|
+
}
|
|
109
|
+
const error = checkSkip(config, pipeline, skip);
|
|
110
|
+
if (error !== null)
|
|
111
|
+
throw rejected(error);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Turns the ids a task waits for into ids of queue items or runs of the repository.
|
|
115
|
+
* An item that already became a run is replaced by that run.
|
|
116
|
+
*/
|
|
117
|
+
resolveDependencies(queue, ids) {
|
|
118
|
+
const { states } = this.dependencies.runs;
|
|
119
|
+
return [...new Set(ids)].map((id) => {
|
|
120
|
+
if (queue.items.some((item) => item.id === id))
|
|
121
|
+
return id;
|
|
122
|
+
const own = states.lookup(id);
|
|
123
|
+
if (own?.run.repository === queue.repository)
|
|
124
|
+
return id;
|
|
125
|
+
const started = states.runOfQueueItem(queue.repository, id);
|
|
126
|
+
if (started)
|
|
127
|
+
return started.run.id;
|
|
128
|
+
throw rejected(`unknown dependency \`${id}\``);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/** The run a `parent` refers to: a run id first, then a task number of the repository. */
|
|
132
|
+
resolveParent(repository, ref) {
|
|
133
|
+
const { states } = this.dependencies.runs;
|
|
134
|
+
const parsed = parseParentRef(ref);
|
|
135
|
+
if (parsed.id !== null) {
|
|
136
|
+
const state = states.lookup(parsed.id);
|
|
137
|
+
if (state)
|
|
138
|
+
return state;
|
|
139
|
+
}
|
|
140
|
+
if (parsed.number !== null) {
|
|
141
|
+
const id = states.idByNumber(repository, parsed.number);
|
|
142
|
+
const state = id === null ? undefined : states.lookup(id);
|
|
143
|
+
if (state)
|
|
144
|
+
return state;
|
|
145
|
+
}
|
|
146
|
+
throw rejected(`unknown parent \`${ref}\``);
|
|
147
|
+
}
|
|
148
|
+
async addTo(repository, params, inherited) {
|
|
149
|
+
const { store, advance, tags, taskTags, now } = this.dependencies;
|
|
150
|
+
this.dependencies.registry.requireEnabled(repository);
|
|
151
|
+
const queue = store.of(repository);
|
|
152
|
+
const moment = now();
|
|
153
|
+
await this.ensureItem(repository, params.pipeline, params.skip);
|
|
154
|
+
const after = this.resolveDependencies(queue, params.after ?? []);
|
|
155
|
+
let own = inherited ?? resolveManualTags(tags.of(repository), params.tags ?? []);
|
|
156
|
+
const task = fields({ ...params, after });
|
|
157
|
+
if (params.parent !== undefined) {
|
|
158
|
+
const parent = this.resolveParent(repository, params.parent);
|
|
159
|
+
this.checkNewItem(queue, task, moment);
|
|
160
|
+
const parentTag = await taskTags.parentTagFor(repository, parent);
|
|
161
|
+
own = mergeTags(parentTag ? [parentTag.id] : [], own);
|
|
162
|
+
}
|
|
163
|
+
const item = addItem(queue, { ...task, tags: taskTags.inherit(queue, own, after) }, queueItemId(moment, randomInt(36 ** 3)), moment);
|
|
164
|
+
store.save(queue);
|
|
165
|
+
await advance.advance(repository);
|
|
166
|
+
return { queue, item: item.id };
|
|
167
|
+
}
|
|
168
|
+
/** Runs the checks of `addItem` on a copy of the queue: nothing changes. */
|
|
169
|
+
checkNewItem(queue, fields, now) {
|
|
170
|
+
addItem(structuredClone(queue), fields, queueItemId(now, 0), now);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/items.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAiB,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,OAAO,EACP,WAAW,EACX,UAAU,EACV,UAAU,GAQX,MAAM,mBAAmB,CAAC;AAiB3B,gFAAgF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D,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EACvC,MAAM,CACP,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAClC,CAAC;IAED,4EAA4E;IACpE,YAAY,CAAC,KAAY,EAAE,MAAkB,EAAE,GAAW;QAChE,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { emptyQueue } from '../types/index.js';
|
|
2
|
+
/** The queues of the repositories, kept in memory and in the database. */
|
|
3
|
+
export class QueueStore {
|
|
4
|
+
dependencies;
|
|
5
|
+
queues = new Map();
|
|
6
|
+
constructor(dependencies) {
|
|
7
|
+
this.dependencies = dependencies;
|
|
8
|
+
}
|
|
9
|
+
/** Reads the queues from the database; called once at the start. */
|
|
10
|
+
load() {
|
|
11
|
+
for (const queue of this.dependencies.queues.queues())
|
|
12
|
+
this.queues.set(queue.repository, queue);
|
|
13
|
+
}
|
|
14
|
+
/** The queue of the repository when it is in memory. */
|
|
15
|
+
get(repository) {
|
|
16
|
+
return this.queues.get(repository);
|
|
17
|
+
}
|
|
18
|
+
all() {
|
|
19
|
+
return [...this.queues.values()];
|
|
20
|
+
}
|
|
21
|
+
/** The queue of the repository: from memory, the database, or a new empty one. */
|
|
22
|
+
of(repository) {
|
|
23
|
+
const cached = this.queues.get(repository);
|
|
24
|
+
if (cached)
|
|
25
|
+
return cached;
|
|
26
|
+
const { queues, states, now } = this.dependencies;
|
|
27
|
+
const next = Math.max(states.maxNumber(repository), queues.maxItemNumber(repository)) + 1;
|
|
28
|
+
const queue = queues.loadQueue(repository) ?? emptyQueue(repository, now(), next);
|
|
29
|
+
this.queues.set(repository, queue);
|
|
30
|
+
return queue;
|
|
31
|
+
}
|
|
32
|
+
/** Writes the queue and tells the clients. */
|
|
33
|
+
save(queue) {
|
|
34
|
+
this.dependencies.queues.saveQueue(queue);
|
|
35
|
+
this.dependencies.publish.queueSaved(queue);
|
|
36
|
+
return queue;
|
|
37
|
+
}
|
|
38
|
+
/** Writes the queue without telling the clients: a save that tells them comes later. */
|
|
39
|
+
write(queue) {
|
|
40
|
+
this.dependencies.queues.saveQueue(queue);
|
|
41
|
+
}
|
|
42
|
+
/** Tells the clients about the queue when it looks different to them. */
|
|
43
|
+
check(queue) {
|
|
44
|
+
this.dependencies.publish.queueChecked(queue);
|
|
45
|
+
}
|
|
46
|
+
/** Drops a removed tag from the stored items; no transaction of its own. */
|
|
47
|
+
dropItemTag(repository, id) {
|
|
48
|
+
this.dependencies.queues.dropItemTag(repository, id);
|
|
49
|
+
}
|
|
50
|
+
/** The queue of a project that moved, stored and in memory; no transaction of its own. */
|
|
51
|
+
moveRepository(from, to) {
|
|
52
|
+
this.dependencies.queues.moveQueue(from, to);
|
|
53
|
+
const queue = this.queues.get(from);
|
|
54
|
+
this.queues.delete(from);
|
|
55
|
+
if (queue === undefined)
|
|
56
|
+
return;
|
|
57
|
+
queue.repository = to;
|
|
58
|
+
this.queues.set(to, queue);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAc,MAAM,mBAAmB,CAAC;AAS3D,0EAA0E;AAC1E,MAAM,OAAO,UAAU;IACJ,YAAY,CAAyB;IACrC,MAAM,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEnD,YAAY,YAAoC;QAC9C,IAAI,CAAC,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