@hoknie/aip 0.1.0 → 0.2.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/dist/app/agents.js +2 -0
- package/dist/app/agents.js.map +1 -1
- package/dist/app/application.js +41 -3
- package/dist/app/application.js.map +1 -1
- package/dist/app/lifecycle.js +5 -1
- package/dist/app/lifecycle.js.map +1 -1
- package/dist/app/timings.js +1 -0
- package/dist/app/timings.js.map +1 -1
- package/dist/app/wiring.js +1 -0
- package/dist/app/wiring.js.map +1 -1
- package/dist/cli/main.js +0 -0
- package/dist/feature/agents/clients/agy/guard.js +26 -8
- package/dist/feature/agents/clients/agy/guard.js.map +1 -1
- package/dist/feature/agents/clients/agy/permissions.js +9 -1
- package/dist/feature/agents/clients/agy/permissions.js.map +1 -1
- package/dist/feature/agents/clients/agy/runtime.js +8 -1
- package/dist/feature/agents/clients/agy/runtime.js.map +1 -1
- package/dist/feature/agents/clients/claude/index.js +1 -0
- package/dist/feature/agents/clients/claude/index.js.map +1 -1
- package/dist/feature/agents/clients/claude/models.js +8 -0
- package/dist/feature/agents/clients/claude/models.js.map +1 -0
- package/dist/feature/agents/clients/claude/parser.js +8 -0
- package/dist/feature/agents/clients/claude/parser.js.map +1 -1
- package/dist/feature/agents/clients/claude/runtime.js +2 -0
- package/dist/feature/agents/clients/claude/runtime.js.map +1 -1
- package/dist/feature/agents/clients/opencode/index.js +1 -0
- package/dist/feature/agents/clients/opencode/index.js.map +1 -1
- package/dist/feature/agents/clients/opencode/models.js +38 -0
- package/dist/feature/agents/clients/opencode/models.js.map +1 -0
- package/dist/feature/agents/clients/opencode/runtime.js +14 -1
- package/dist/feature/agents/clients/opencode/runtime.js.map +1 -1
- package/dist/feature/agents/ports/command.js +2 -0
- package/dist/feature/agents/ports/command.js.map +1 -0
- package/dist/feature/agents/services/agents.js +42 -1
- package/dist/feature/agents/services/agents.js.map +1 -1
- package/dist/feature/agents/services/catalog.js +1 -1
- package/dist/feature/agents/services/catalog.js.map +1 -1
- package/dist/feature/agents/types/index.js +2 -0
- package/dist/feature/agents/types/index.js.map +1 -1
- package/dist/feature/agents/types/mcp/env.js +54 -0
- package/dist/feature/agents/types/mcp/env.js.map +1 -0
- package/dist/feature/agents/types/message.js +1 -0
- package/dist/feature/agents/types/message.js.map +1 -1
- package/dist/feature/agents/types/models.js +2 -0
- package/dist/feature/agents/types/models.js.map +1 -0
- package/dist/feature/agents/types/runtime.js.map +1 -1
- package/dist/feature/agents/types/worker-tools.js +2 -0
- package/dist/feature/agents/types/worker-tools.js.map +1 -1
- package/dist/feature/network/ports/changed.js +2 -0
- package/dist/feature/network/ports/changed.js.map +1 -0
- package/dist/feature/network/ports/index.js +2 -0
- package/dist/feature/network/ports/index.js.map +1 -0
- package/dist/feature/network/services/create.js +5 -0
- package/dist/feature/network/services/create.js.map +1 -0
- package/dist/feature/network/services/index.js +3 -0
- package/dist/feature/network/services/index.js.map +1 -0
- package/dist/feature/network/services/monitor.js +140 -0
- package/dist/feature/network/services/monitor.js.map +1 -0
- package/dist/feature/network/types/index.js +4 -0
- package/dist/feature/network/types/index.js.map +1 -0
- package/dist/feature/network/types/network.js +8 -0
- package/dist/feature/network/types/network.js.map +1 -0
- package/dist/feature/network/types/proxy.js +95 -0
- package/dist/feature/network/types/proxy.js.map +1 -0
- package/dist/feature/network/types/state.js +36 -0
- package/dist/feature/network/types/state.js.map +1 -0
- package/dist/feature/observers/repositories/observers.js +7 -1
- package/dist/feature/observers/repositories/observers.js.map +1 -1
- package/dist/feature/observers/services/observers.js +33 -5
- package/dist/feature/observers/services/observers.js.map +1 -1
- package/dist/feature/observers/services/settings-check.js +1 -7
- package/dist/feature/observers/services/settings-check.js.map +1 -1
- package/dist/feature/observers/types/plan-repairs.js +48 -16
- package/dist/feature/observers/types/plan-repairs.js.map +1 -1
- package/dist/feature/observers/types/settings.js +0 -1
- package/dist/feature/observers/types/settings.js.map +1 -1
- package/dist/feature/queue/repositories/queues.js +28 -4
- package/dist/feature/queue/repositories/queues.js.map +1 -1
- package/dist/feature/queue/services/control.js +46 -8
- package/dist/feature/queue/services/control.js.map +1 -1
- package/dist/feature/queue/services/store.js +4 -0
- package/dist/feature/queue/services/store.js.map +1 -1
- package/dist/feature/queue/services/task-tags.js +4 -1
- package/dist/feature/queue/services/task-tags.js.map +1 -1
- package/dist/feature/queue/types/advance.js +29 -12
- package/dist/feature/queue/types/advance.js.map +1 -1
- package/dist/feature/queue/types/filter.js +36 -0
- package/dist/feature/queue/types/filter.js.map +1 -0
- package/dist/feature/queue/types/index.js +1 -0
- package/dist/feature/queue/types/index.js.map +1 -1
- package/dist/feature/queue/types/items.js +1 -0
- package/dist/feature/queue/types/items.js.map +1 -1
- package/dist/feature/queue/types/returns.js +18 -3
- package/dist/feature/queue/types/returns.js.map +1 -1
- package/dist/feature/queue/types/settings.js +14 -3
- package/dist/feature/queue/types/settings.js.map +1 -1
- package/dist/feature/runs/machine/exits.js +23 -1
- package/dist/feature/runs/machine/exits.js.map +1 -1
- package/dist/feature/runs/machine/plan.js +38 -16
- package/dist/feature/runs/machine/plan.js.map +1 -1
- package/dist/feature/runs/machine/repair.js +10 -3
- package/dist/feature/runs/machine/repair.js.map +1 -1
- package/dist/feature/runs/machine/scheduler.js +10 -3
- package/dist/feature/runs/machine/scheduler.js.map +1 -1
- package/dist/feature/runs/machine/steps.js +11 -11
- package/dist/feature/runs/machine/steps.js.map +1 -1
- package/dist/feature/runs/machine/transition.js +16 -2
- package/dist/feature/runs/machine/transition.js.map +1 -1
- package/dist/feature/runs/repositories/finished-runs.js +14 -10
- package/dist/feature/runs/repositories/finished-runs.js.map +1 -1
- package/dist/feature/runs/repositories/write.js +1 -1
- package/dist/feature/runs/repositories/write.js.map +1 -1
- package/dist/feature/runs/services/create.js +1 -0
- package/dist/feature/runs/services/create.js.map +1 -1
- package/dist/feature/runs/services/effects/actions.js +3 -2
- package/dist/feature/runs/services/effects/actions.js.map +1 -1
- package/dist/feature/runs/services/effects/attempts.js +61 -13
- package/dist/feature/runs/services/effects/attempts.js.map +1 -1
- package/dist/feature/runs/services/effects/context.js.map +1 -1
- package/dist/feature/runs/services/effects/effects.js +5 -0
- package/dist/feature/runs/services/effects/effects.js.map +1 -1
- package/dist/feature/runs/services/effects/naming.js +4 -1
- package/dist/feature/runs/services/effects/naming.js.map +1 -1
- package/dist/feature/runs/services/effects/proxy.js +5 -0
- package/dist/feature/runs/services/effects/proxy.js.map +1 -0
- package/dist/feature/runs/services/effects/runtime-check.js +20 -0
- package/dist/feature/runs/services/effects/runtime-check.js.map +1 -0
- package/dist/feature/runs/services/engine.js +14 -5
- package/dist/feature/runs/services/engine.js.map +1 -1
- package/dist/feature/runs/services/index.js.map +1 -1
- package/dist/feature/runs/services/reads.js +40 -1
- package/dist/feature/runs/services/reads.js.map +1 -1
- package/dist/feature/runs/services/requests.js +7 -1
- package/dist/feature/runs/services/requests.js.map +1 -1
- package/dist/feature/runs/services/states.js +2 -2
- package/dist/feature/runs/services/states.js.map +1 -1
- package/dist/feature/runs/types/attempt.js +8 -0
- package/dist/feature/runs/types/attempt.js.map +1 -1
- package/dist/feature/runs/types/group.js.map +1 -1
- package/dist/feature/runs/types/input.js +33 -0
- package/dist/feature/runs/types/input.js.map +1 -1
- package/dist/feature/runs/types/limits.js +13 -1
- package/dist/feature/runs/types/limits.js.map +1 -1
- package/dist/feature/stats/repositories/index.js +4 -0
- package/dist/feature/stats/repositories/index.js.map +1 -0
- package/dist/feature/stats/repositories/meta.js +19 -0
- package/dist/feature/stats/repositories/meta.js.map +1 -0
- package/dist/feature/stats/repositories/records.js +46 -0
- package/dist/feature/stats/repositories/records.js.map +1 -0
- package/dist/feature/stats/repositories/report.js +105 -0
- package/dist/feature/stats/repositories/report.js.map +1 -0
- package/dist/feature/stats/services/create.js +44 -0
- package/dist/feature/stats/services/create.js.map +1 -0
- package/dist/feature/stats/services/index.js +4 -0
- package/dist/feature/stats/services/index.js.map +1 -0
- package/dist/feature/stats/services/ledger.js +137 -0
- package/dist/feature/stats/services/ledger.js.map +1 -0
- package/dist/feature/stats/services/report.js +56 -0
- package/dist/feature/stats/services/report.js.map +1 -0
- package/dist/feature/stats/types/aggregate.js +179 -0
- package/dist/feature/stats/types/aggregate.js.map +1 -0
- package/dist/feature/stats/types/capture.js +79 -0
- package/dist/feature/stats/types/capture.js.map +1 -0
- package/dist/feature/stats/types/index.js +6 -0
- package/dist/feature/stats/types/index.js.map +1 -0
- package/dist/feature/stats/types/records.js +5 -0
- package/dist/feature/stats/types/records.js.map +1 -0
- package/dist/feature/stats/types/report.js +25 -0
- package/dist/feature/stats/types/report.js.map +1 -0
- package/dist/feature/stats/types/settings.js +2 -0
- package/dist/feature/stats/types/settings.js.map +1 -0
- package/dist/feature/swarm-config/services/assemble.js +1 -1
- package/dist/feature/swarm-config/services/assemble.js.map +1 -1
- package/dist/feature/swarm-config/services/index.js +4 -2
- package/dist/feature/swarm-config/services/index.js.map +1 -1
- package/dist/feature/swarm-config/services/load.js +17 -2
- package/dist/feature/swarm-config/services/load.js.map +1 -1
- package/dist/feature/swarm-config/services/sections/mcp-servers.js +128 -0
- package/dist/feature/swarm-config/services/sections/mcp-servers.js.map +1 -0
- package/dist/feature/swarm-config/services/sections/stats.js +28 -0
- package/dist/feature/swarm-config/services/sections/stats.js.map +1 -0
- package/dist/feature/swarm-config/services/settings.js +23 -1
- package/dist/feature/swarm-config/services/settings.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-actions.js +9 -1
- package/dist/feature/swarm-config/services/validate-actions.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-runtimes.js +3 -51
- package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-settings.js +65 -0
- package/dist/feature/swarm-config/services/validate-settings.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-specialists.js +5 -4
- package/dist/feature/swarm-config/services/validate-specialists.js.map +1 -1
- package/dist/feature/swarm-config/services/validate.js +24 -8
- package/dist/feature/swarm-config/services/validate.js.map +1 -1
- package/dist/feature/swarm-config/types/action.js +9 -0
- package/dist/feature/swarm-config/types/action.js.map +1 -1
- package/dist/feature/swarm-config/types/index.js +1 -0
- package/dist/feature/swarm-config/types/index.js.map +1 -1
- package/dist/feature/swarm-config/types/mcp/reference.js +40 -0
- package/dist/feature/swarm-config/types/mcp/reference.js.map +1 -0
- package/dist/feature/swarm-config/types/merge.js +1 -0
- package/dist/feature/swarm-config/types/merge.js.map +1 -1
- package/dist/feature/swarm-config/types/settings.js +37 -5
- package/dist/feature/swarm-config/types/settings.js.map +1 -1
- package/dist/feature/swarm-config/types/specialist.js.map +1 -1
- package/dist/feature/swarm-edit/services/config-edits.js +26 -1
- package/dist/feature/swarm-edit/services/config-edits.js.map +1 -1
- package/dist/feature/swarm-edit/services/editor-settings.js +36 -7
- package/dist/feature/swarm-edit/services/editor-settings.js.map +1 -1
- package/dist/feature/swarm-edit/services/editor-view.js +2 -0
- package/dist/feature/swarm-edit/services/editor-view.js.map +1 -1
- package/dist/feature/swarm-edit/services/index.js +1 -0
- package/dist/feature/swarm-edit/services/index.js.map +1 -1
- package/dist/feature/swarm-edit/services/mcp/editor-mcp.js +51 -0
- package/dist/feature/swarm-edit/services/mcp/editor-mcp.js.map +1 -0
- package/dist/feature/swarm-edit/services/mcp/plan-mcp-server.js +93 -0
- package/dist/feature/swarm-edit/services/mcp/plan-mcp-server.js.map +1 -0
- package/dist/feature/swarm-edit/services/plan-settings.js +3 -1
- package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -1
- package/dist/feature/swarm-edit/types/editor.js.map +1 -1
- package/dist/feature/swarm-edit/types/setting-fields.js +12 -0
- package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -1
- package/dist/platform/git/delivery.js +1 -1
- package/dist/platform/git/delivery.js.map +1 -1
- package/dist/platform/network/index.js +4 -0
- package/dist/platform/network/index.js.map +1 -0
- package/dist/platform/network/interfaces.js +7 -0
- package/dist/platform/network/interfaces.js.map +1 -0
- package/dist/platform/network/probe.js +128 -0
- package/dist/platform/network/probe.js.map +1 -0
- package/dist/platform/network/tunnel.js +87 -0
- package/dist/platform/network/tunnel.js.map +1 -0
- package/dist/platform/process/command.js +23 -0
- package/dist/platform/process/command.js.map +1 -0
- package/dist/platform/process/index.js +1 -0
- package/dist/platform/process/index.js.map +1 -1
- package/dist/platform/sqlite/migrations.js +3 -0
- package/dist/platform/sqlite/migrations.js.map +1 -1
- package/dist/platform/sqlite/stats-migration.js +42 -0
- package/dist/platform/sqlite/stats-migration.js.map +1 -0
- package/dist/presentation/cli/commands/queue-edit.js +23 -1
- package/dist/presentation/cli/commands/queue-edit.js.map +1 -1
- package/dist/presentation/cli/commands/stats.js +41 -0
- package/dist/presentation/cli/commands/stats.js.map +1 -0
- package/dist/presentation/cli/help.js +1 -1
- package/dist/presentation/cli/help.js.map +1 -1
- package/dist/presentation/cli/local/config-check.js +23 -5
- package/dist/presentation/cli/local/config-check.js.map +1 -1
- package/dist/presentation/cli/program.js +2 -0
- package/dist/presentation/cli/program.js.map +1 -1
- package/dist/presentation/format/index.js +1 -0
- package/dist/presentation/format/index.js.map +1 -1
- package/dist/presentation/format/queue.js +15 -2
- package/dist/presentation/format/queue.js.map +1 -1
- package/dist/presentation/format/runs.js +8 -1
- package/dist/presentation/format/runs.js.map +1 -1
- package/dist/presentation/format/stats.js +79 -0
- package/dist/presentation/format/stats.js.map +1 -0
- package/dist/presentation/ipc/contract/agents.js +18 -0
- package/dist/presentation/ipc/contract/agents.js.map +1 -1
- package/dist/presentation/ipc/contract/config.js +26 -0
- package/dist/presentation/ipc/contract/config.js.map +1 -1
- package/dist/presentation/ipc/contract/envelope.js +4 -1
- package/dist/presentation/ipc/contract/envelope.js.map +1 -1
- package/dist/presentation/ipc/contract/groups.js +9 -0
- package/dist/presentation/ipc/contract/groups.js.map +1 -1
- package/dist/presentation/ipc/contract/index.js +1 -0
- package/dist/presentation/ipc/contract/index.js.map +1 -1
- package/dist/presentation/ipc/contract/panel.js +11 -0
- package/dist/presentation/ipc/contract/panel.js.map +1 -1
- package/dist/presentation/ipc/contract/queue.js +11 -1
- package/dist/presentation/ipc/contract/queue.js.map +1 -1
- package/dist/presentation/ipc/contract/responses/index.js +1 -0
- package/dist/presentation/ipc/contract/responses/index.js.map +1 -1
- package/dist/presentation/ipc/contract/responses/stats.js +67 -0
- package/dist/presentation/ipc/contract/responses/stats.js.map +1 -0
- package/dist/presentation/ipc/contract/runs.js +10 -0
- package/dist/presentation/ipc/contract/runs.js.map +1 -1
- package/dist/presentation/ipc/contract/stats/stats.js +20 -0
- package/dist/presentation/ipc/contract/stats/stats.js.map +1 -0
- package/dist/presentation/ipc/handlers/config.js +7 -0
- package/dist/presentation/ipc/handlers/config.js.map +1 -1
- package/dist/presentation/ipc/handlers/groups.js +8 -0
- package/dist/presentation/ipc/handlers/groups.js.map +1 -1
- package/dist/presentation/ipc/handlers/runs.js +2 -1
- package/dist/presentation/ipc/handlers/runs.js.map +1 -1
- package/dist/presentation/ipc/handlers/stats.js +17 -0
- package/dist/presentation/ipc/handlers/stats.js.map +1 -0
- package/dist/presentation/ipc/handlers/system.js +2 -0
- package/dist/presentation/ipc/handlers/system.js.map +1 -1
- package/dist/presentation/ipc/handlers/table.js +2 -0
- package/dist/presentation/ipc/handlers/table.js.map +1 -1
- package/dist/presentation/ipc/publisher.js +1 -0
- package/dist/presentation/ipc/publisher.js.map +1 -1
- package/dist/presentation/ipc/snapshots.js +2 -2
- package/dist/presentation/ipc/snapshots.js.map +1 -1
- package/dist/presentation/ipc/views/catalog.js +3 -3
- package/dist/presentation/ipc/views/catalog.js.map +1 -1
- package/dist/presentation/ipc/views/index.js +1 -0
- package/dist/presentation/ipc/views/index.js.map +1 -1
- package/dist/presentation/ipc/views/observers.js +2 -2
- package/dist/presentation/ipc/views/observers.js.map +1 -1
- package/dist/presentation/ipc/views/queue.js +9 -2
- package/dist/presentation/ipc/views/queue.js.map +1 -1
- package/dist/presentation/ipc/views/runs.js +3 -4
- package/dist/presentation/ipc/views/runs.js.map +1 -1
- package/dist/presentation/ipc/views/stats.js +5 -0
- package/dist/presentation/ipc/views/stats.js.map +1 -0
- package/dist/presentation/mcp/host-queue-control.js +11 -2
- package/dist/presentation/mcp/host-queue-control.js.map +1 -1
- package/dist/presentation/mcp/worker-extra.js +2 -2
- package/dist/presentation/mcp/worker-extra.js.map +1 -1
- package/dist/presentation/mcp/worker-read.js +45 -0
- package/dist/presentation/mcp/worker-read.js.map +1 -0
- package/dist/presentation/mcp/worker.js +2 -0
- package/dist/presentation/mcp/worker.js.map +1 -1
- package/dist/presentation/web/hub.js +4 -0
- package/dist/presentation/web/hub.js.map +1 -1
- package/dist/presentation/web/panel/directories.js +1 -1
- package/dist/presentation/web/panel/directories.js.map +1 -1
- package/dist/presentation/web/panel/system.js +1 -0
- package/dist/presentation/web/panel/system.js.map +1 -1
- package/dist/presentation/web/request.js +28 -1
- package/dist/presentation/web/request.js.map +1 -1
- package/dist/presentation/web/routes/catalog/mcp-servers.js +50 -0
- package/dist/presentation/web/routes/catalog/mcp-servers.js.map +1 -0
- package/dist/presentation/web/routes/config.js +5 -0
- package/dist/presentation/web/routes/config.js.map +1 -1
- package/dist/presentation/web/routes/runs.js +5 -0
- package/dist/presentation/web/routes/runs.js.map +1 -1
- package/dist/presentation/web/routes/stats/stats.js +22 -0
- package/dist/presentation/web/routes/stats/stats.js.map +1 -0
- package/dist/presentation/web/server.js +5 -1
- package/dist/presentation/web/server.js.map +1 -1
- package/dist/web/assets/FilterColumn-BrQWIM5F.js +1 -0
- package/dist/web/assets/SharedPipelinesGroup-WFngQrqI.js +1 -0
- package/dist/web/assets/badge-B_khFsd6.js +1 -0
- package/dist/web/assets/{card-DkikoTxR.js → card-COXjnc-y.js} +1 -1
- package/dist/web/assets/empty-Eb-EZDPX.js +41 -0
- package/dist/web/assets/index-DEXoIe2a.js +21 -0
- package/dist/web/assets/index-DMlIe0VD.css +2 -0
- package/dist/web/assets/locales-BlBJo1PR.js +1 -0
- package/dist/web/assets/pipelines-B3cdeex_.js +10 -0
- package/dist/web/assets/queue-HMUImu0E.js +16 -0
- package/dist/web/assets/select-MHus_Unr.js +1 -0
- package/dist/web/assets/settingFields-DVg9TQK2.js +1 -0
- package/dist/web/assets/settings-CpeEsUXX.js +6 -0
- package/dist/web/assets/skeleton-CWY1nRvW.js +1 -0
- package/dist/web/assets/specialists-BkLXuqUd.js +1 -0
- package/dist/web/assets/stats-DRg_5vll.js +1 -0
- package/dist/web/assets/topology-DGTNdDHf.js +1 -0
- package/dist/web/assets/trash-CFJeuRuc.js +1 -0
- package/dist/web/assets/useListDrag-B7Wlt2u9.js +1 -0
- package/dist/web/index.html +7 -6
- package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/dist/cli/clean.js +0 -71
- package/dist/cli/clean.js.map +0 -1
- package/dist/cli/commands.js +0 -963
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/config-check.js +0 -173
- package/dist/cli/config-check.js.map +0 -1
- package/dist/cli/daemon.js +0 -199
- package/dist/cli/daemon.js.map +0 -1
- package/dist/cli/help.js +0 -50
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/init.js +0 -43
- package/dist/cli/init.js.map +0 -1
- package/dist/cli/io.js +0 -13
- package/dist/cli/io.js.map +0 -1
- package/dist/cli/probe.js +0 -12
- package/dist/cli/probe.js.map +0 -1
- package/dist/cli/program.js +0 -48
- package/dist/cli/program.js.map +0 -1
- package/dist/cli/setup.js +0 -406
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/version.js +0 -6
- package/dist/cli/version.js.map +0 -1
- package/dist/cli/watch.js +0 -24
- package/dist/cli/watch.js.map +0 -1
- package/dist/cli/web/daemon-panel.js +0 -185
- package/dist/cli/web/daemon-panel.js.map +0 -1
- package/dist/cli/web/default-repository.js +0 -12
- package/dist/cli/web/default-repository.js.map +0 -1
- package/dist/cli/web/errors.js +0 -60
- package/dist/cli/web/errors.js.map +0 -1
- package/dist/cli/web/open.js +0 -12
- package/dist/cli/web/open.js.map +0 -1
- package/dist/cli/web/page.js +0 -465
- package/dist/cli/web/page.js.map +0 -1
- package/dist/cli/web/server.js +0 -1191
- package/dist/cli/web/server.js.map +0 -1
- package/dist/cli/web/standby.js +0 -119
- package/dist/cli/web/standby.js.map +0 -1
- package/dist/cli/web/state.js +0 -69
- package/dist/cli/web/state.js.map +0 -1
- package/dist/cli/web/system.js +0 -66
- package/dist/cli/web/system.js.map +0 -1
- package/dist/cli/web-control.js +0 -173
- package/dist/cli/web-control.js.map +0 -1
- package/dist/config/discover.js +0 -25
- package/dist/config/discover.js.map +0 -1
- package/dist/config/duration.js +0 -17
- package/dist/config/duration.js.map +0 -1
- package/dist/config/edit.js +0 -966
- package/dist/config/edit.js.map +0 -1
- package/dist/config/errors.js +0 -29
- package/dist/config/errors.js.map +0 -1
- package/dist/config/index.js +0 -14
- package/dist/config/index.js.map +0 -1
- package/dist/config/load.js +0 -412
- package/dist/config/load.js.map +0 -1
- package/dist/config/merge.js +0 -45
- package/dist/config/merge.js.map +0 -1
- package/dist/config/model.js +0 -171
- package/dist/config/model.js.map +0 -1
- package/dist/config/paths.js +0 -31
- package/dist/config/paths.js.map +0 -1
- package/dist/config/prompt.js +0 -33
- package/dist/config/prompt.js.map +0 -1
- package/dist/config/shared-pipelines.js +0 -71
- package/dist/config/shared-pipelines.js.map +0 -1
- package/dist/config/shared-specialists.js +0 -68
- package/dist/config/shared-specialists.js.map +0 -1
- package/dist/config/shared-workflows.js +0 -71
- package/dist/config/shared-workflows.js.map +0 -1
- package/dist/config/specialist-tags.js +0 -214
- package/dist/config/specialist-tags.js.map +0 -1
- package/dist/config/tag-names.js +0 -43
- package/dist/config/tag-names.js.map +0 -1
- package/dist/config/validate.js +0 -872
- package/dist/config/validate.js.map +0 -1
- package/dist/core/artifacts.js +0 -37
- package/dist/core/artifacts.js.map +0 -1
- package/dist/core/create.js +0 -75
- package/dist/core/create.js.map +0 -1
- package/dist/core/delivery.js +0 -366
- package/dist/core/delivery.js.map +0 -1
- package/dist/core/errors.js +0 -7
- package/dist/core/errors.js.map +0 -1
- package/dist/core/ids.js +0 -99
- package/dist/core/ids.js.map +0 -1
- package/dist/core/index.js +0 -21
- package/dist/core/index.js.map +0 -1
- package/dist/core/input.js +0 -45
- package/dist/core/input.js.map +0 -1
- package/dist/core/machine.js +0 -1021
- package/dist/core/machine.js.map +0 -1
- package/dist/core/model.js +0 -460
- package/dist/core/model.js.map +0 -1
- package/dist/core/observer.js +0 -193
- package/dist/core/observer.js.map +0 -1
- package/dist/core/occupancy.js +0 -63
- package/dist/core/occupancy.js.map +0 -1
- package/dist/core/permissions.js +0 -222
- package/dist/core/permissions.js.map +0 -1
- package/dist/core/plan.js +0 -99
- package/dist/core/plan.js.map +0 -1
- package/dist/core/progress.js +0 -43
- package/dist/core/progress.js.map +0 -1
- package/dist/core/questions.js +0 -19
- package/dist/core/questions.js.map +0 -1
- package/dist/core/queue.js +0 -859
- package/dist/core/queue.js.map +0 -1
- package/dist/core/retryable.js +0 -8
- package/dist/core/retryable.js.map +0 -1
- package/dist/core/scheduler.js +0 -160
- package/dist/core/scheduler.js.map +0 -1
- package/dist/core/skip.js +0 -109
- package/dist/core/skip.js.map +0 -1
- package/dist/core/stages.js +0 -304
- package/dist/core/stages.js.map +0 -1
- package/dist/core/summary.js +0 -35
- package/dist/core/summary.js.map +0 -1
- package/dist/core/tags.js +0 -184
- package/dist/core/tags.js.map +0 -1
- package/dist/core/topology.js +0 -162
- package/dist/core/topology.js.map +0 -1
- package/dist/daemon/artifacts.js +0 -84
- package/dist/daemon/artifacts.js.map +0 -1
- package/dist/daemon/daemon.js +0 -1442
- package/dist/daemon/daemon.js.map +0 -1
- package/dist/daemon/executor.js +0 -749
- package/dist/daemon/executor.js.map +0 -1
- package/dist/daemon/helpers.js +0 -38
- package/dist/daemon/helpers.js.map +0 -1
- package/dist/daemon/index.js +0 -4
- package/dist/daemon/index.js.map +0 -1
- package/dist/daemon/logs.js +0 -69
- package/dist/daemon/logs.js.map +0 -1
- package/dist/daemon/observers.js +0 -93
- package/dist/daemon/observers.js.map +0 -1
- package/dist/daemon/patches.js +0 -76
- package/dist/daemon/patches.js.map +0 -1
- package/dist/daemon/ports.js +0 -2
- package/dist/daemon/ports.js.map +0 -1
- package/dist/daemon/processes.js +0 -98
- package/dist/daemon/processes.js.map +0 -1
- package/dist/daemon/repositories.js +0 -2
- package/dist/daemon/repositories.js.map +0 -1
- package/dist/daemon/server.js +0 -164
- package/dist/daemon/server.js.map +0 -1
- package/dist/daemon/supervisor.js +0 -140
- package/dist/daemon/supervisor.js.map +0 -1
- package/dist/daemon/timings.js +0 -23
- package/dist/daemon/timings.js.map +0 -1
- package/dist/git/delivery.js +0 -284
- package/dist/git/delivery.js.map +0 -1
- package/dist/git/index.js +0 -4
- package/dist/git/index.js.map +0 -1
- package/dist/git/runner.js +0 -60
- package/dist/git/runner.js.map +0 -1
- package/dist/git/workspace.js +0 -366
- package/dist/git/workspace.js.map +0 -1
- package/dist/mcp/host.js +0 -401
- package/dist/mcp/host.js.map +0 -1
- package/dist/mcp/index.js +0 -3
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/tools.js +0 -19
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/version.js +0 -5
- package/dist/mcp/version.js.map +0 -1
- package/dist/mcp/worker.js +0 -230
- package/dist/mcp/worker.js.map +0 -1
- package/dist/presentation/web/routes/directories.js +0 -60
- package/dist/presentation/web/routes/directories.js.map +0 -1
- package/dist/protocol/autostart.js +0 -171
- package/dist/protocol/autostart.js.map +0 -1
- package/dist/protocol/build.js +0 -38
- package/dist/protocol/build.js.map +0 -1
- package/dist/protocol/catalog.js +0 -18
- package/dist/protocol/catalog.js.map +0 -1
- package/dist/protocol/client.js +0 -83
- package/dist/protocol/client.js.map +0 -1
- package/dist/protocol/format.js +0 -477
- package/dist/protocol/format.js.map +0 -1
- package/dist/protocol/index.js +0 -11
- package/dist/protocol/index.js.map +0 -1
- package/dist/protocol/messages.js +0 -598
- package/dist/protocol/messages.js.map +0 -1
- package/dist/protocol/style.js +0 -81
- package/dist/protocol/style.js.map +0 -1
- package/dist/protocol/transcript.js +0 -49
- package/dist/protocol/transcript.js.map +0 -1
- package/dist/protocol/views.js +0 -696
- package/dist/protocol/views.js.map +0 -1
- package/dist/runtime/catalog.js +0 -117
- package/dist/runtime/catalog.js.map +0 -1
- package/dist/runtime/claude.js +0 -399
- package/dist/runtime/claude.js.map +0 -1
- package/dist/runtime/index.js +0 -34
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/message.js +0 -48
- package/dist/runtime/message.js.map +0 -1
- package/dist/runtime/naming.js +0 -69
- package/dist/runtime/naming.js.map +0 -1
- package/dist/runtime/opencode.js +0 -189
- package/dist/runtime/opencode.js.map +0 -1
- package/dist/runtime/skills.js +0 -17
- package/dist/runtime/skills.js.map +0 -1
- package/dist/runtime/transcript.js +0 -227
- package/dist/runtime/transcript.js.map +0 -1
- package/dist/runtime/types.js +0 -12
- package/dist/runtime/types.js.map +0 -1
- package/dist/runtime/which.js +0 -21
- package/dist/runtime/which.js.map +0 -1
- package/dist/store/index.js +0 -3
- package/dist/store/index.js.map +0 -1
- package/dist/store/schema.js +0 -286
- package/dist/store/schema.js.map +0 -1
- package/dist/store/store.js +0 -491
- package/dist/store/store.js.map +0 -1
- package/dist/web/assets/EntryList-CnfGgjEY.js +0 -1
- package/dist/web/assets/FilePath-C0X8-keS.js +0 -1
- package/dist/web/assets/SettingsForm-BcyBWJbn.js +0 -1
- package/dist/web/assets/SharedPipelinesGroup-a368-IQ0.js +0 -1
- package/dist/web/assets/index-B-oJ93zH.js +0 -22
- package/dist/web/assets/index-BZE36gYR.css +0 -2
- package/dist/web/assets/locales-DtRrxYzg.js +0 -1
- package/dist/web/assets/pipelines-D48ggDNe.js +0 -1
- package/dist/web/assets/queue-D8_RY4IY.js +0 -16
- package/dist/web/assets/select-J4oIrmYh.js +0 -1
- package/dist/web/assets/settings-B0-0Vaia.js +0 -2
- package/dist/web/assets/skeleton-CCKCQF5n.js +0 -1
- package/dist/web/assets/specialists-DH8tyluO.js +0 -1
- package/dist/web/assets/switch-CWFAgxG1.js +0 -41
- package/dist/web/assets/topology-CNQ28AB2.js +0 -7
- /package/dist/web/assets/{topology-DLioOiRN.css → pipelines-DLioOiRN.css} +0 -0
package/dist/daemon/executor.js
DELETED
|
@@ -1,749 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { appendFileSync, mkdirSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
4
|
-
import { isAbsolute, join, relative, sep } from 'node:path';
|
|
5
|
-
import { ConfigLoadError } from '../feature/swarm-config/types/index.js';
|
|
6
|
-
import { configPaths, loadRuntimeSettings } from '../feature/swarm-config/services/index.js';
|
|
7
|
-
import { REPAIR_GROUP, RESOLVE_GROUP, SPLIT_GROUP, findGroup, isRepairGroup, isResolveGroup, specialistOfStep, groupRef, runRef, isServiceGroup, actionGroupsOf, actionOf, actionPointOf, deliveryBranch, parseActionSlug, } from '../feature/runs/types/index.js';
|
|
8
|
-
import { RUN_WORKTREE, attemptDirectory, changedFiles, changedPaths, hashFiles, under, cleanRun, commitAll, commitResolve, deliver, filesWithMarkers, git, prepareResolve, commitMessage, ensureWorktree, mergeBranch, runWorktreeRoot, snapshotWorkingCopy, updateFromBranch, workspaceRoot, } from '../platform/git/index.js';
|
|
9
|
-
import { answerText, missingSkills, namingPrompt, parseNaming, runtimeFor, } from '../runtime/index.js';
|
|
10
|
-
import { findExecutable } from '../platform/process/index.js';
|
|
11
|
-
import { timesPath } from './logs.js';
|
|
12
|
-
import { launchProcess } from './supervisor.js';
|
|
13
|
-
export const NAMING_TIMEOUT_MS = 60_000;
|
|
14
|
-
/** The live usage of a run reaches its state at most once per interval. */
|
|
15
|
-
export const USAGE_INTERVAL_MS = 1_000;
|
|
16
|
-
function deliveredPaths(result) {
|
|
17
|
-
return result.kind === 'applied' ? [...new Set([...result.files, ...result.conflicts])] : [];
|
|
18
|
-
}
|
|
19
|
-
function keyOf(key) {
|
|
20
|
-
return `${key.run}/${key.group}/${key.seq}`;
|
|
21
|
-
}
|
|
22
|
-
export class Executor {
|
|
23
|
-
host;
|
|
24
|
-
entry;
|
|
25
|
-
graceMs;
|
|
26
|
-
timings;
|
|
27
|
-
tokens = new Map();
|
|
28
|
-
running = new Map();
|
|
29
|
-
keys = new Map();
|
|
30
|
-
naming = new Map();
|
|
31
|
-
/** Working copy of the repository as it was when each running attempt started. */
|
|
32
|
-
baselines = new Map();
|
|
33
|
-
/** Live usage of running attempts waiting for the next flush, by run. */
|
|
34
|
-
usageBuffers = new Map();
|
|
35
|
-
constructor(options) {
|
|
36
|
-
this.host = options.host;
|
|
37
|
-
this.entry = options.entry;
|
|
38
|
-
this.graceMs = options.graceMs;
|
|
39
|
-
this.timings = options.timings;
|
|
40
|
-
}
|
|
41
|
-
/** Agents that run now: running attempts and the naming of runs. */
|
|
42
|
-
agentRoots() {
|
|
43
|
-
const roots = [];
|
|
44
|
-
for (const [id, running] of this.running) {
|
|
45
|
-
const pid = running.process.pid;
|
|
46
|
-
if (pid === undefined)
|
|
47
|
-
continue;
|
|
48
|
-
const key = this.keys.get(id);
|
|
49
|
-
if (key)
|
|
50
|
-
roots.push({ pid, run: key.run, group: key.group, seq: key.seq });
|
|
51
|
-
}
|
|
52
|
-
for (const [process, run] of this.naming) {
|
|
53
|
-
if (process.pid !== undefined)
|
|
54
|
-
roots.push({ pid: process.pid, run, group: null, seq: null });
|
|
55
|
-
}
|
|
56
|
-
return roots;
|
|
57
|
-
}
|
|
58
|
-
attemptFor(token) {
|
|
59
|
-
return this.tokens.get(token);
|
|
60
|
-
}
|
|
61
|
-
workspace(state) {
|
|
62
|
-
return workspaceRoot(state.run.repository, state.run.config.workspaceDir);
|
|
63
|
-
}
|
|
64
|
-
worktreePath(state, group) {
|
|
65
|
-
// The repair group is checked first: it is a service group, but it never works in the run tree.
|
|
66
|
-
if (isRepairGroup(group) && state.run.pendingDelivery?.repair) {
|
|
67
|
-
return this.resolveWorktree(state);
|
|
68
|
-
}
|
|
69
|
-
const name = isRepairGroup(group)
|
|
70
|
-
? REPAIR_GROUP
|
|
71
|
-
: isResolveGroup(group)
|
|
72
|
-
? RESOLVE_GROUP
|
|
73
|
-
: isServiceGroup(group)
|
|
74
|
-
? RUN_WORKTREE
|
|
75
|
-
: group.slug;
|
|
76
|
-
return join(runWorktreeRoot(this.workspace(state), state.run.id), name);
|
|
77
|
-
}
|
|
78
|
-
logPath(state, group, seq) {
|
|
79
|
-
return join(attemptDirectory(this.workspace(state), state.run.id, group, seq), 'output.log');
|
|
80
|
-
}
|
|
81
|
-
/** A specialist or the naming of a run is running. */
|
|
82
|
-
busy() {
|
|
83
|
-
return this.running.size > 0 || this.naming.size > 0;
|
|
84
|
-
}
|
|
85
|
-
reportUsage(state, key, usage) {
|
|
86
|
-
if (this.host.stopping)
|
|
87
|
-
return;
|
|
88
|
-
let buffer = this.usageBuffers.get(key.run);
|
|
89
|
-
if (!buffer) {
|
|
90
|
-
buffer = { state, pending: new Map(), timer: null };
|
|
91
|
-
this.usageBuffers.set(key.run, buffer);
|
|
92
|
-
}
|
|
93
|
-
buffer.pending.set(keyOf(key), { group: key.group, seq: key.seq, usage });
|
|
94
|
-
// Leading edge: with no timer running the value goes at once; the timer holds back the rest.
|
|
95
|
-
if (buffer.timer === null)
|
|
96
|
-
this.flushUsage(key.run);
|
|
97
|
-
}
|
|
98
|
-
flushUsage(run) {
|
|
99
|
-
const buffer = this.usageBuffers.get(run);
|
|
100
|
-
if (!buffer)
|
|
101
|
-
return;
|
|
102
|
-
if (buffer.timer !== null) {
|
|
103
|
-
clearTimeout(buffer.timer);
|
|
104
|
-
buffer.timer = null;
|
|
105
|
-
}
|
|
106
|
-
if (buffer.pending.size === 0) {
|
|
107
|
-
this.usageBuffers.delete(run);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const updates = [...buffer.pending.values()];
|
|
111
|
-
buffer.pending.clear();
|
|
112
|
-
buffer.timer = setTimeout(() => this.flushUsage(run), this.timings.usageIntervalMs);
|
|
113
|
-
buffer.timer.unref();
|
|
114
|
-
void this.host
|
|
115
|
-
.serial(() => {
|
|
116
|
-
if (this.host.stopping)
|
|
117
|
-
return Promise.resolve();
|
|
118
|
-
return this.host.apply(buffer.state, { kind: 'attempt_usage', updates });
|
|
119
|
-
})
|
|
120
|
-
.catch(() => undefined);
|
|
121
|
-
}
|
|
122
|
-
dropUsage(key) {
|
|
123
|
-
const buffer = this.usageBuffers.get(key.run);
|
|
124
|
-
buffer?.pending.delete(keyOf(key));
|
|
125
|
-
}
|
|
126
|
-
async stopAll() {
|
|
127
|
-
for (const buffer of this.usageBuffers.values()) {
|
|
128
|
-
if (buffer.timer !== null)
|
|
129
|
-
clearTimeout(buffer.timer);
|
|
130
|
-
}
|
|
131
|
-
this.usageBuffers.clear();
|
|
132
|
-
const exits = [...this.running.values()].map((running) => {
|
|
133
|
-
clearTimeout(running.timer);
|
|
134
|
-
running.process.stop();
|
|
135
|
-
return running.process.exited;
|
|
136
|
-
});
|
|
137
|
-
for (const process of this.naming.keys()) {
|
|
138
|
-
process.stop();
|
|
139
|
-
exits.push(process.exited);
|
|
140
|
-
}
|
|
141
|
-
await Promise.allSettled(exits);
|
|
142
|
-
}
|
|
143
|
-
async perform(state, effects) {
|
|
144
|
-
for (const effect of effects) {
|
|
145
|
-
switch (effect.kind) {
|
|
146
|
-
case 'start_attempt':
|
|
147
|
-
await this.start(state, effect.group, effect.seq);
|
|
148
|
-
break;
|
|
149
|
-
case 'stop_attempt': {
|
|
150
|
-
const running = this.running.get(keyOf({ run: effect.run, group: effect.group, seq: effect.seq }));
|
|
151
|
-
if (running) {
|
|
152
|
-
clearTimeout(running.timer);
|
|
153
|
-
running.process.stop();
|
|
154
|
-
}
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
case 'run_action':
|
|
158
|
-
await this.runAction(state, effect.group, effect.seq);
|
|
159
|
-
break;
|
|
160
|
-
case 'commit':
|
|
161
|
-
await this.commit(state, effect.group, effect.stepId, effect.summary);
|
|
162
|
-
break;
|
|
163
|
-
case 'merge':
|
|
164
|
-
await this.merge(state, effect.group, effect.updateOnConflict);
|
|
165
|
-
break;
|
|
166
|
-
case 'deliver':
|
|
167
|
-
await this.deliver(state, effect.groups, effect.force, effect.message);
|
|
168
|
-
break;
|
|
169
|
-
case 'cleanup':
|
|
170
|
-
await this.cleanup(state);
|
|
171
|
-
break;
|
|
172
|
-
case 'prepare_resolve':
|
|
173
|
-
await this.prepareResolve(state, effect.groups);
|
|
174
|
-
break;
|
|
175
|
-
case 'finish_resolve':
|
|
176
|
-
await this.finishResolve(state, effect.message, effect.conflicts);
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/** The environment of a command action. */
|
|
182
|
-
actionEnvironment(state, group) {
|
|
183
|
-
const ref = parseActionSlug(group.slug);
|
|
184
|
-
const { run } = state;
|
|
185
|
-
const environment = {
|
|
186
|
-
AIP_RUN_ID: run.id,
|
|
187
|
-
AIP_RUN_TITLE: run.title ?? '',
|
|
188
|
-
AIP_PIPELINE: run.pipeline,
|
|
189
|
-
// The name before the term was unified; scripts in user repositories still read it.
|
|
190
|
-
AIP_WORKFLOW: run.pipeline,
|
|
191
|
-
AIP_STAGE: ref?.point ?? '',
|
|
192
|
-
AIP_ACTION: ref?.id ?? '',
|
|
193
|
-
AIP_REPOSITORY: run.repository,
|
|
194
|
-
};
|
|
195
|
-
if (ref?.point === 'after_delivery') {
|
|
196
|
-
const delivered = state.groups.filter((candidate) => candidate.status === 'merged' && candidate.delivery.state === 'applied');
|
|
197
|
-
const last = [...delivered]
|
|
198
|
-
.filter((candidate) => candidate.delivery.message)
|
|
199
|
-
.sort((left, right) => (right.delivery.finishedAt ?? 0) - (left.delivery.finishedAt ?? 0))[0];
|
|
200
|
-
environment.AIP_DELIVERY_MODE = run.config.delivery.mode;
|
|
201
|
-
environment.AIP_COMMIT_MESSAGE = last?.delivery.message ?? '';
|
|
202
|
-
environment.AIP_CHANGED_FILES = [
|
|
203
|
-
...new Set(delivered.flatMap((candidate) => candidate.delivery.files)),
|
|
204
|
-
].join('\n');
|
|
205
|
-
}
|
|
206
|
-
return environment;
|
|
207
|
-
}
|
|
208
|
-
/** Where a command action runs: the tree of the run, or the repository of the user after delivery. */
|
|
209
|
-
async actionDirectory(state, group) {
|
|
210
|
-
if (actionPointOf(group) === 'after_delivery')
|
|
211
|
-
return state.run.repository;
|
|
212
|
-
return this.ensureGroupWorktree(state, group);
|
|
213
|
-
}
|
|
214
|
-
/** The command of an action before delivery must not change the result: drop what it wrote. */
|
|
215
|
-
async discardChanges(state, group) {
|
|
216
|
-
// A repair works on a copy of the ref of the run: what it leaves there is dropped. The tree of
|
|
217
|
-
// a delivery repair is the resolver's and is kept for the delivery.
|
|
218
|
-
const repairCopy = isRepairGroup(group) && !state.run.pendingDelivery?.repair;
|
|
219
|
-
if (actionPointOf(group) !== 'before_delivery' && !repairCopy)
|
|
220
|
-
return;
|
|
221
|
-
try {
|
|
222
|
-
await this.resetRunTree(state, await this.ensureGroupWorktree(state, group));
|
|
223
|
-
}
|
|
224
|
-
catch {
|
|
225
|
-
// The tree may be gone with a cleaned run; there is nothing to drop then.
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
/** The tree sits on a detached HEAD: a commit of an action moves it, so reset to the ref of the run. */
|
|
229
|
-
async resetRunTree(state, tree) {
|
|
230
|
-
await git(tree, 'reset', '--hard', runRef(state.run));
|
|
231
|
-
await git(tree, 'clean', '-fd');
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* A merge goes on the ref of the run, never on what a check left in the tree: a stopped check
|
|
235
|
-
* may still be working there, and one cut off by a restart never dropped its changes.
|
|
236
|
-
*/
|
|
237
|
-
async settleChecks(state, tree) {
|
|
238
|
-
const checks = actionGroupsOf(state, 'before_delivery');
|
|
239
|
-
if (checks.length === 0)
|
|
240
|
-
return;
|
|
241
|
-
const keys = checks.flatMap((group) => group.attempts.map((attempt) => keyOf({ run: state.run.id, group: group.slug, seq: attempt.seq })));
|
|
242
|
-
// The process itself: its exit handler waits in the same queue as this merge.
|
|
243
|
-
await Promise.allSettled(keys.map((key) => this.running.get(key)?.process.exited));
|
|
244
|
-
await this.resetRunTree(state, tree);
|
|
245
|
-
}
|
|
246
|
-
async runAction(state, slug, seq) {
|
|
247
|
-
const group = findGroup(state, slug);
|
|
248
|
-
const attempt = group?.attempts.find((candidate) => candidate.seq === seq);
|
|
249
|
-
const action = group ? actionOf(state.run, group) : undefined;
|
|
250
|
-
if (!group || !attempt || !action || action.run === null)
|
|
251
|
-
return;
|
|
252
|
-
const key = { run: state.run.id, group: slug, seq };
|
|
253
|
-
const finish = async (outcome) => {
|
|
254
|
-
await this.discardChanges(state, group);
|
|
255
|
-
await this.host.apply(state, { kind: 'action_finished', group: slug, seq, outcome });
|
|
256
|
-
};
|
|
257
|
-
let directory;
|
|
258
|
-
try {
|
|
259
|
-
// Leftovers of an interrupted check must not reach this one.
|
|
260
|
-
await this.discardChanges(state, group);
|
|
261
|
-
directory = await this.actionDirectory(state, group);
|
|
262
|
-
}
|
|
263
|
-
catch (error) {
|
|
264
|
-
await finish({ kind: 'spawn', message: error.message });
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const logPath = this.logPath(state, slug, seq);
|
|
268
|
-
mkdirSync(attemptDirectory(this.workspace(state), state.run.id, slug, seq), {
|
|
269
|
-
recursive: true,
|
|
270
|
-
});
|
|
271
|
-
appendFileSync(logPath, `[aip] $ ${action.run}\n`);
|
|
272
|
-
const quiet = {
|
|
273
|
-
push() { },
|
|
274
|
-
usage: () => null,
|
|
275
|
-
outcome: () => ({ sessionId: null, usage: null, error: null, denials: [] }),
|
|
276
|
-
};
|
|
277
|
-
const process = launchProcess({
|
|
278
|
-
command: '/bin/sh',
|
|
279
|
-
args: ['-c', action.run],
|
|
280
|
-
env: this.actionEnvironment(state, group),
|
|
281
|
-
files: [],
|
|
282
|
-
sessionId: null,
|
|
283
|
-
}, {
|
|
284
|
-
cwd: directory,
|
|
285
|
-
logPath,
|
|
286
|
-
parser: quiet,
|
|
287
|
-
environment: this.host.environment,
|
|
288
|
-
graceMs: this.graceMs,
|
|
289
|
-
drainMs: this.timings.drainMs,
|
|
290
|
-
timesPath: timesPath(logPath),
|
|
291
|
-
});
|
|
292
|
-
let timedOut = false;
|
|
293
|
-
const timer = setTimeout(() => {
|
|
294
|
-
timedOut = true;
|
|
295
|
-
process.stop();
|
|
296
|
-
}, action.timeoutSeconds * this.timings.timeoutUnitMs);
|
|
297
|
-
this.running.set(keyOf(key), { process, timer });
|
|
298
|
-
this.keys.set(keyOf(key), key);
|
|
299
|
-
void process.exited.then((exit) => {
|
|
300
|
-
clearTimeout(timer);
|
|
301
|
-
this.running.delete(keyOf(key));
|
|
302
|
-
this.keys.delete(keyOf(key));
|
|
303
|
-
if (process.pid !== undefined) {
|
|
304
|
-
this.host.agentGone({ pid: process.pid, run: key.run, group: key.group, seq: key.seq });
|
|
305
|
-
}
|
|
306
|
-
// A stopping daemon leaves the attempt running: the next start marks it interrupted.
|
|
307
|
-
if (this.host.stopping)
|
|
308
|
-
return undefined;
|
|
309
|
-
const outcome = exit.spawnError
|
|
310
|
-
? { kind: 'spawn', message: exit.spawnError }
|
|
311
|
-
: timedOut
|
|
312
|
-
? { kind: 'timeout' }
|
|
313
|
-
: { kind: 'exit', code: exit.code ?? 1 };
|
|
314
|
-
return this.host.serial(() => finish(outcome));
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
/** Asks a cheap model for the title and the name of a run, in the background. */
|
|
318
|
-
async nameRun(state) {
|
|
319
|
-
const { naming } = state.run.config;
|
|
320
|
-
const settings = this.runtimeSettings(state);
|
|
321
|
-
if (typeof settings === 'string')
|
|
322
|
-
return;
|
|
323
|
-
const runtime = runtimeFor(naming.runtime, this.host.environment, settings);
|
|
324
|
-
if (!findExecutable(runtime.executable, this.host.environment.PATH))
|
|
325
|
-
return;
|
|
326
|
-
const directory = join(this.workspace(state), 'logs', state.run.id, '_naming');
|
|
327
|
-
const logPath = join(directory, 'output.log');
|
|
328
|
-
const task = state.split?.task ?? state.groups.map((group) => group.task).join('\n\n');
|
|
329
|
-
const launch = runtime.buildOneShot({
|
|
330
|
-
prompt: namingPrompt(task),
|
|
331
|
-
model: naming.model,
|
|
332
|
-
directory,
|
|
333
|
-
});
|
|
334
|
-
mkdirSync(directory, { recursive: true });
|
|
335
|
-
const process = launchProcess(launch, {
|
|
336
|
-
cwd: directory,
|
|
337
|
-
logPath,
|
|
338
|
-
parser: runtime.createParser(),
|
|
339
|
-
environment: this.host.environment,
|
|
340
|
-
graceMs: this.graceMs,
|
|
341
|
-
drainMs: this.timings.drainMs,
|
|
342
|
-
});
|
|
343
|
-
this.naming.set(process, state.run.id);
|
|
344
|
-
const timer = setTimeout(() => process.stop(), this.timings.namingTimeoutMs);
|
|
345
|
-
const exit = await process.exited;
|
|
346
|
-
clearTimeout(timer);
|
|
347
|
-
this.naming.delete(process);
|
|
348
|
-
if (process.pid !== undefined) {
|
|
349
|
-
this.host.agentGone({ pid: process.pid, run: state.run.id, group: null, seq: null });
|
|
350
|
-
}
|
|
351
|
-
if (this.host.stopping)
|
|
352
|
-
return;
|
|
353
|
-
let lines = [];
|
|
354
|
-
try {
|
|
355
|
-
lines = readFileSync(logPath, 'utf8').split('\n');
|
|
356
|
-
}
|
|
357
|
-
catch {
|
|
358
|
-
// no output
|
|
359
|
-
}
|
|
360
|
-
const named = exit.code === 0 ? parseNaming(answerText(runtime.transcript(lines))) : null;
|
|
361
|
-
await this.host.serial(() => this.host.apply(state, {
|
|
362
|
-
kind: 'run_named',
|
|
363
|
-
title: named?.title ?? null,
|
|
364
|
-
name: named?.name ?? null,
|
|
365
|
-
usage: exit.outcome.usage,
|
|
366
|
-
}));
|
|
367
|
-
}
|
|
368
|
-
async ensureGroupWorktree(state, group) {
|
|
369
|
-
const { repository } = state.run;
|
|
370
|
-
const branch = runRef(state.run);
|
|
371
|
-
const runTree = await ensureWorktree(repository, join(runWorktreeRoot(this.workspace(state), state.run.id), RUN_WORKTREE), branch, null);
|
|
372
|
-
if (isRepairGroup(group)) {
|
|
373
|
-
if (state.run.pendingDelivery?.repair)
|
|
374
|
-
return this.worktreePath(state, group);
|
|
375
|
-
return ensureWorktree(repository, this.worktreePath(state, group), branch, null);
|
|
376
|
-
}
|
|
377
|
-
if (isResolveGroup(group))
|
|
378
|
-
return this.worktreePath(state, group);
|
|
379
|
-
if (isServiceGroup(group))
|
|
380
|
-
return runTree;
|
|
381
|
-
return ensureWorktree(repository, this.worktreePath(state, group), groupRef(state.run, group.slug), branch);
|
|
382
|
-
}
|
|
383
|
-
/** Current `runtimes` of the shared settings.yaml, or the text of the error in it. */
|
|
384
|
-
runtimeSettings(state) {
|
|
385
|
-
const { XDG_CONFIG_HOME, HOME } = this.host.environment;
|
|
386
|
-
try {
|
|
387
|
-
return loadRuntimeSettings(configPaths(state.run.repository, XDG_CONFIG_HOME, HOME));
|
|
388
|
-
}
|
|
389
|
-
catch (error) {
|
|
390
|
-
if (!(error instanceof ConfigLoadError))
|
|
391
|
-
throw error;
|
|
392
|
-
return `invalid swarm.runtimes: ${error.message}`;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
async start(state, slug, seq) {
|
|
396
|
-
const group = findGroup(state, slug);
|
|
397
|
-
const attempt = group?.attempts.find((candidate) => candidate.seq === seq);
|
|
398
|
-
if (!group || !attempt || attempt.runtime === 'command')
|
|
399
|
-
return;
|
|
400
|
-
const key = { run: state.run.id, group: slug, seq };
|
|
401
|
-
const settings = this.runtimeSettings(state);
|
|
402
|
-
if (typeof settings === 'string') {
|
|
403
|
-
await this.exit(state, key, { kind: 'spawn', message: settings });
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
const runtime = runtimeFor(attempt.runtime, this.host.environment, settings);
|
|
407
|
-
if (!findExecutable(runtime.executable, this.host.environment.PATH)) {
|
|
408
|
-
await this.exit(state, key, { kind: 'runtime_not_found', runtime: attempt.runtime });
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
let worktree;
|
|
412
|
-
try {
|
|
413
|
-
worktree = await this.ensureGroupWorktree(state, group);
|
|
414
|
-
}
|
|
415
|
-
catch (error) {
|
|
416
|
-
await this.exit(state, key, { kind: 'git', message: error.message });
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
// Leftovers of an interrupted check must not reach this one.
|
|
420
|
-
await this.discardChanges(state, group);
|
|
421
|
-
// The observer works from the snapshot of its profile, which is not in the configuration.
|
|
422
|
-
const specialist = specialistOfStep(state.run, group, attempt.specialist);
|
|
423
|
-
if (!specialist) {
|
|
424
|
-
if (isRepairGroup(group)) {
|
|
425
|
-
await this.exit(state, key, { kind: 'spawn', message: 'the observer has no profile' });
|
|
426
|
-
}
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
const directory = attemptDirectory(this.workspace(state), state.run.id, slug, seq);
|
|
430
|
-
const logPath = this.logPath(state, slug, seq);
|
|
431
|
-
mkdirSync(directory, { recursive: true });
|
|
432
|
-
for (const skill of missingSkills(specialist.skills, runtime.skillDirectories(worktree, homedir()))) {
|
|
433
|
-
appendFileSync(logPath, `[aip] warning: skill not found: ${skill}\n`);
|
|
434
|
-
}
|
|
435
|
-
const token = randomUUID();
|
|
436
|
-
this.tokens.set(token, key);
|
|
437
|
-
const exclude = this.excluded(state);
|
|
438
|
-
const before = await this.snapshot(state, exclude);
|
|
439
|
-
if (before) {
|
|
440
|
-
this.baselines.set(keyOf(key), {
|
|
441
|
-
repository: state.run.repository,
|
|
442
|
-
exclude,
|
|
443
|
-
snapshot: before,
|
|
444
|
-
overrides: new Map(),
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
const launch = runtime.buildLaunch({
|
|
448
|
-
specialist,
|
|
449
|
-
input: attempt.input,
|
|
450
|
-
worktree,
|
|
451
|
-
attemptDirectory: directory,
|
|
452
|
-
workerCommand: [
|
|
453
|
-
...this.entry,
|
|
454
|
-
'mcp',
|
|
455
|
-
'--worker',
|
|
456
|
-
token,
|
|
457
|
-
'--socket',
|
|
458
|
-
this.host.socket,
|
|
459
|
-
...(slug === SPLIT_GROUP ? ['--split'] : []),
|
|
460
|
-
...(specialist.queue === true ? ['--queue'] : []),
|
|
461
|
-
...(isRepairGroup(group) ? ['--repair'] : []),
|
|
462
|
-
],
|
|
463
|
-
sessionId: randomUUID(),
|
|
464
|
-
resumeSession: attempt.resumeSession,
|
|
465
|
-
claudeEditMode: state.run.config.claude.editMode,
|
|
466
|
-
claudeMcp: state.run.config.claude.mcp,
|
|
467
|
-
claudeSettings: state.run.config.claude.settings,
|
|
468
|
-
});
|
|
469
|
-
if (launch.sessionId)
|
|
470
|
-
attempt.sessionId = launch.sessionId;
|
|
471
|
-
this.host.save(state);
|
|
472
|
-
const process = launchProcess(launch, {
|
|
473
|
-
cwd: worktree,
|
|
474
|
-
logPath,
|
|
475
|
-
parser: runtime.createParser(),
|
|
476
|
-
environment: this.host.environment,
|
|
477
|
-
graceMs: this.graceMs,
|
|
478
|
-
drainMs: this.timings.drainMs,
|
|
479
|
-
timesPath: timesPath(logPath),
|
|
480
|
-
onUsage: (usage) => this.reportUsage(state, key, usage),
|
|
481
|
-
});
|
|
482
|
-
const timer = setTimeout(() => {
|
|
483
|
-
if (this.host.stopping)
|
|
484
|
-
return;
|
|
485
|
-
void this.host.serial(() => this.host.apply(state, { kind: 'timed_out', group: slug, seq }));
|
|
486
|
-
}, specialist.timeoutSeconds * this.timings.timeoutUnitMs);
|
|
487
|
-
this.running.set(keyOf(key), { process, timer });
|
|
488
|
-
this.keys.set(keyOf(key), key);
|
|
489
|
-
void process.exited.then((exit) => {
|
|
490
|
-
clearTimeout(timer);
|
|
491
|
-
this.dropUsage(key);
|
|
492
|
-
this.running.delete(keyOf(key));
|
|
493
|
-
this.keys.delete(keyOf(key));
|
|
494
|
-
if (process.pid !== undefined) {
|
|
495
|
-
this.host.agentGone({ pid: process.pid, run: key.run, group: key.group, seq: key.seq });
|
|
496
|
-
}
|
|
497
|
-
this.tokens.delete(token);
|
|
498
|
-
if (this.host.stopping)
|
|
499
|
-
return undefined;
|
|
500
|
-
return this.host.serial(async () => {
|
|
501
|
-
await this.discardChanges(state, group);
|
|
502
|
-
const baseline = this.baselines.get(keyOf(key));
|
|
503
|
-
this.baselines.delete(keyOf(key));
|
|
504
|
-
const after = baseline ? await this.snapshot(state, baseline.exclude) : null;
|
|
505
|
-
let outsideChanges = [];
|
|
506
|
-
if (baseline && after) {
|
|
507
|
-
try {
|
|
508
|
-
outsideChanges = await changedPaths(baseline.repository, baseline.snapshot, after, baseline.overrides);
|
|
509
|
-
}
|
|
510
|
-
catch {
|
|
511
|
-
outsideChanges = [];
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
await this.host.apply(state, {
|
|
515
|
-
kind: 'attempt_exited',
|
|
516
|
-
group: slug,
|
|
517
|
-
seq,
|
|
518
|
-
exit: {
|
|
519
|
-
sessionId: exit.outcome.sessionId,
|
|
520
|
-
usage: exit.outcome.usage,
|
|
521
|
-
failure: exit.spawnError
|
|
522
|
-
? { kind: 'spawn', message: exit.spawnError }
|
|
523
|
-
: exit.outcome.usageLimit
|
|
524
|
-
? { kind: 'usage_limit', resetsAt: exit.outcome.usageLimit.resetsAt }
|
|
525
|
-
: null,
|
|
526
|
-
outsideChanges,
|
|
527
|
-
denials: exit.outcome.denials,
|
|
528
|
-
onLimit: this.host.onLimitOf(state.run.repository),
|
|
529
|
-
},
|
|
530
|
-
});
|
|
531
|
-
});
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
/** The directory of the working copies, when it lies inside the repository. */
|
|
535
|
-
excluded(state) {
|
|
536
|
-
const path = relative(state.run.repository, this.workspace(state));
|
|
537
|
-
if (path === '' || path.startsWith('..') || isAbsolute(path))
|
|
538
|
-
return [];
|
|
539
|
-
return [path.split(sep).join('/')];
|
|
540
|
-
}
|
|
541
|
-
async snapshot(state, exclude) {
|
|
542
|
-
if (state.run.config.outsideChanges === 'off')
|
|
543
|
-
return null;
|
|
544
|
-
try {
|
|
545
|
-
return await snapshotWorkingCopy(state.run.repository, { exclude });
|
|
546
|
-
}
|
|
547
|
-
catch {
|
|
548
|
-
return null;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
/** Accepts what a delivery wrote into the working copy: it is not a change from outside. */
|
|
552
|
-
async rebaseOutside(state, result) {
|
|
553
|
-
// The branch mode does not touch the working copy: nothing was written there.
|
|
554
|
-
if (state.run.config.delivery.mode === 'branch')
|
|
555
|
-
return;
|
|
556
|
-
const repository = state.run.repository;
|
|
557
|
-
const paths = deliveredPaths(result);
|
|
558
|
-
const baselines = [...this.baselines.values()].filter((baseline) => baseline.repository === repository);
|
|
559
|
-
if (baselines.length === 0 || paths.length === 0)
|
|
560
|
-
return;
|
|
561
|
-
try {
|
|
562
|
-
const current = await hashFiles(repository, paths);
|
|
563
|
-
for (const baseline of baselines) {
|
|
564
|
-
for (const [path, hash] of current) {
|
|
565
|
-
if (!under(path, baseline.exclude))
|
|
566
|
-
baseline.overrides.set(path, hash);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
catch {
|
|
571
|
-
// Without the content the paths stay as they are: at worst a warning is shown.
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
async exit(state, key, failure) {
|
|
575
|
-
this.baselines.delete(keyOf(key));
|
|
576
|
-
await this.host.apply(state, {
|
|
577
|
-
kind: 'attempt_exited',
|
|
578
|
-
group: key.group,
|
|
579
|
-
seq: key.seq,
|
|
580
|
-
exit: { sessionId: null, usage: null, failure, outsideChanges: [] },
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
async commit(state, slug, stepId, summary) {
|
|
584
|
-
const group = findGroup(state, slug);
|
|
585
|
-
if (!group)
|
|
586
|
-
return;
|
|
587
|
-
try {
|
|
588
|
-
// The actions around the split change the tree of the run itself, which the groups start from.
|
|
589
|
-
const actionPoint = actionPointOf(group);
|
|
590
|
-
await commitAll(this.worktreePath(state, group), commitMessage(slug, stepId, summary), actionPoint === undefined ? groupRef(state.run, slug) : runRef(state.run), state.run.config.workspace.include);
|
|
591
|
-
if (actionPoint === undefined)
|
|
592
|
-
void this.host.refreshDiff(state, slug);
|
|
593
|
-
}
|
|
594
|
-
catch (error) {
|
|
595
|
-
await this.host.apply(state, {
|
|
596
|
-
kind: 'commit_failed',
|
|
597
|
-
group: slug,
|
|
598
|
-
message: error.message,
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
async merge(state, slug, updateOnConflict) {
|
|
603
|
-
const group = findGroup(state, slug);
|
|
604
|
-
if (!group)
|
|
605
|
-
return;
|
|
606
|
-
let outcome;
|
|
607
|
-
try {
|
|
608
|
-
const runTree = await this.ensureGroupWorktree(state, { ...group, slug: SPLIT_GROUP });
|
|
609
|
-
await this.settleChecks(state, runTree);
|
|
610
|
-
const source = groupRef(state.run, slug);
|
|
611
|
-
const target = runRef(state.run);
|
|
612
|
-
const message = `aip: merge ${slug}`;
|
|
613
|
-
const first = await mergeBranch(runTree, source, message, target);
|
|
614
|
-
if (first.kind === 'merged')
|
|
615
|
-
outcome = first;
|
|
616
|
-
else if (!updateOnConflict)
|
|
617
|
-
outcome = first;
|
|
618
|
-
else {
|
|
619
|
-
const updated = await updateFromBranch(this.worktreePath(state, group), target, source);
|
|
620
|
-
if (updated.kind === 'conflict')
|
|
621
|
-
outcome = { kind: 'conflict_updated', files: updated.files };
|
|
622
|
-
else
|
|
623
|
-
outcome = await mergeBranch(runTree, source, message, target);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
catch (error) {
|
|
627
|
-
outcome = { kind: 'failed', message: error.message };
|
|
628
|
-
}
|
|
629
|
-
await this.host.apply(state, { kind: 'merge_finished', group: slug, outcome });
|
|
630
|
-
void this.host.refreshDiff(state, slug);
|
|
631
|
-
if (outcome.kind === 'merged')
|
|
632
|
-
void this.host.savePatch(state);
|
|
633
|
-
}
|
|
634
|
-
async changedFiles(state, slugs) {
|
|
635
|
-
const groups = state.groups.filter((group) => group.mergeCommit !== null &&
|
|
636
|
-
group.status === 'merged' &&
|
|
637
|
-
(slugs === null || slugs.length === 0
|
|
638
|
-
? group.delivery.state !== 'applied'
|
|
639
|
-
: slugs.includes(group.slug)));
|
|
640
|
-
const files = await Promise.all(groups.map((group) => changedFiles(state.run.repository, `${group.mergeCommit}^1`, group.mergeCommit)));
|
|
641
|
-
return [...new Set(files.flat())].sort();
|
|
642
|
-
}
|
|
643
|
-
groupChanges(state, slugs) {
|
|
644
|
-
return state.groups
|
|
645
|
-
.filter((group) => slugs.includes(group.slug) && group.mergeCommit !== null)
|
|
646
|
-
.sort((left, right) => (left.mergeSeq ?? 0) - (right.mergeSeq ?? 0))
|
|
647
|
-
.map((group) => ({
|
|
648
|
-
group: group.slug,
|
|
649
|
-
from: `${group.mergeCommit}^1`,
|
|
650
|
-
to: group.mergeCommit,
|
|
651
|
-
}));
|
|
652
|
-
}
|
|
653
|
-
resolveBaseRef(state) {
|
|
654
|
-
return `refs/aip/${state.run.id}/resolve-base`;
|
|
655
|
-
}
|
|
656
|
-
resolveWorktree(state) {
|
|
657
|
-
return join(runWorktreeRoot(this.workspace(state), state.run.id), RESOLVE_GROUP);
|
|
658
|
-
}
|
|
659
|
-
async prepareResolve(state, slugs) {
|
|
660
|
-
try {
|
|
661
|
-
const prepared = await prepareResolve({
|
|
662
|
-
repository: state.run.repository,
|
|
663
|
-
worktree: this.resolveWorktree(state),
|
|
664
|
-
changes: this.groupChanges(state, slugs),
|
|
665
|
-
include: state.run.config.workspace.include,
|
|
666
|
-
baseRef: this.resolveBaseRef(state),
|
|
667
|
-
});
|
|
668
|
-
await this.host.apply(state, { kind: 'resolve_prepared', conflicts: prepared.conflicts });
|
|
669
|
-
}
|
|
670
|
-
catch (error) {
|
|
671
|
-
const message = `could not prepare the resolver: ${error.message}`;
|
|
672
|
-
await this.host.apply(state, {
|
|
673
|
-
kind: 'delivery_finished',
|
|
674
|
-
result: { kind: 'failed', message },
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
async finishResolve(state, message, conflicts) {
|
|
679
|
-
let result;
|
|
680
|
-
try {
|
|
681
|
-
const worktree = this.resolveWorktree(state);
|
|
682
|
-
const left = filesWithMarkers(worktree, conflicts);
|
|
683
|
-
if (left.length > 0) {
|
|
684
|
-
result = { kind: 'failed', message: `conflict markers remain in: ${left.join(', ')}` };
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
const { repository } = state.run;
|
|
688
|
-
const { include } = state.run.config.workspace;
|
|
689
|
-
const base = await git(repository, 'rev-parse', this.resolveBaseRef(state));
|
|
690
|
-
const resolved = await commitResolve(worktree, base, include);
|
|
691
|
-
result = await deliver({
|
|
692
|
-
repository,
|
|
693
|
-
changes: [{ group: RESOLVE_GROUP, from: base, to: resolved }],
|
|
694
|
-
mode: state.run.config.delivery.mode,
|
|
695
|
-
force: false,
|
|
696
|
-
message,
|
|
697
|
-
branch: deliveryBranch(state.run),
|
|
698
|
-
runRef: runRef(state.run),
|
|
699
|
-
include,
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
catch (error) {
|
|
704
|
-
result = { kind: 'failed', message: error.message };
|
|
705
|
-
}
|
|
706
|
-
await this.rebaseOutside(state, result);
|
|
707
|
-
await this.host.apply(state, { kind: 'delivery_finished', result });
|
|
708
|
-
}
|
|
709
|
-
async deliver(state, slugs, force, message) {
|
|
710
|
-
let result;
|
|
711
|
-
try {
|
|
712
|
-
const changes = this.groupChanges(state, slugs);
|
|
713
|
-
result = await deliver({
|
|
714
|
-
repository: state.run.repository,
|
|
715
|
-
changes,
|
|
716
|
-
mode: state.run.config.delivery.mode,
|
|
717
|
-
force,
|
|
718
|
-
message,
|
|
719
|
-
branch: deliveryBranch(state.run),
|
|
720
|
-
runRef: runRef(state.run),
|
|
721
|
-
include: state.run.config.workspace.include,
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
catch (error) {
|
|
725
|
-
result = { kind: 'failed', message: error.message };
|
|
726
|
-
}
|
|
727
|
-
await this.rebaseOutside(state, result);
|
|
728
|
-
await this.host.apply(state, { kind: 'delivery_finished', result });
|
|
729
|
-
}
|
|
730
|
-
async cleanup(state) {
|
|
731
|
-
// The refs the patch is built from go away with the cleanup.
|
|
732
|
-
await this.host.savePatch(state);
|
|
733
|
-
try {
|
|
734
|
-
await cleanRun({
|
|
735
|
-
repository: state.run.repository,
|
|
736
|
-
root: runWorktreeRoot(this.workspace(state), state.run.id),
|
|
737
|
-
runBranch: deliveryBranch(state.run),
|
|
738
|
-
groupBranches: [],
|
|
739
|
-
refPrefix: `refs/aip/${state.run.id}/`,
|
|
740
|
-
all: false,
|
|
741
|
-
active: false,
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
catch {
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
//# sourceMappingURL=executor.js.map
|