@hoknie/aip 0.2.0 → 0.3.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/dist/app/application.js +34 -2
- package/dist/app/application.js.map +1 -1
- package/dist/app/lifecycle.js +8 -1
- package/dist/app/lifecycle.js.map +1 -1
- package/dist/app/wiring.js +1 -0
- package/dist/app/wiring.js.map +1 -1
- package/dist/cli/main.js +1 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/feature/agents/clients/agy/guard.js +40 -10
- package/dist/feature/agents/clients/agy/guard.js.map +1 -1
- package/dist/feature/agents/clients/agy/parser.js +1 -3
- package/dist/feature/agents/clients/agy/parser.js.map +1 -1
- package/dist/feature/agents/clients/agy/permissions.js +11 -1
- package/dist/feature/agents/clients/agy/permissions.js.map +1 -1
- package/dist/feature/agents/clients/agy/runtime.js +28 -3
- package/dist/feature/agents/clients/agy/runtime.js.map +1 -1
- package/dist/feature/agents/clients/agy/transcript.js +0 -1
- package/dist/feature/agents/clients/agy/transcript.js.map +1 -1
- package/dist/feature/agents/clients/claude/parser.js +2 -6
- package/dist/feature/agents/clients/claude/parser.js.map +1 -1
- package/dist/feature/agents/clients/claude/permissions.js +7 -1
- package/dist/feature/agents/clients/claude/permissions.js.map +1 -1
- package/dist/feature/agents/clients/claude/runtime.js +13 -2
- package/dist/feature/agents/clients/claude/runtime.js.map +1 -1
- package/dist/feature/agents/clients/claude/transcript.js +0 -1
- package/dist/feature/agents/clients/claude/transcript.js.map +1 -1
- package/dist/feature/agents/clients/opencode/parser.js +1 -3
- package/dist/feature/agents/clients/opencode/parser.js.map +1 -1
- package/dist/feature/agents/clients/opencode/runtime.js +36 -4
- package/dist/feature/agents/clients/opencode/runtime.js.map +1 -1
- package/dist/feature/agents/clients/opencode/transcript.js +0 -1
- package/dist/feature/agents/clients/opencode/transcript.js.map +1 -1
- package/dist/feature/agents/clients/opencode/user-servers.js +97 -0
- package/dist/feature/agents/clients/opencode/user-servers.js.map +1 -0
- package/dist/feature/agents/services/supervisor.js +1 -2
- package/dist/feature/agents/services/supervisor.js.map +1 -1
- package/dist/feature/agents/types/index.js +2 -1
- 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 +17 -1
- package/dist/feature/agents/types/message.js.map +1 -1
- package/dist/feature/agents/types/overlay.js +31 -0
- package/dist/feature/agents/types/overlay.js.map +1 -0
- package/dist/feature/agents/types/permissions.js +16 -0
- package/dist/feature/agents/types/permissions.js.map +1 -1
- package/dist/feature/agents/types/{run-naming.js → run-naming/run-naming.js} +1 -1
- package/dist/feature/agents/types/run-naming/run-naming.js.map +1 -0
- package/dist/feature/agents/types/runtime.js.map +1 -1
- package/dist/feature/agents/types/transcript.js.map +1 -1
- package/dist/feature/agents/types/usage.js +0 -3
- package/dist/feature/agents/types/usage.js.map +1 -1
- package/dist/feature/attachments/repositories/attachment-storage.js +84 -0
- package/dist/feature/attachments/repositories/attachment-storage.js.map +1 -0
- package/dist/feature/attachments/repositories/attachments.js +83 -0
- package/dist/feature/attachments/repositories/attachments.js.map +1 -0
- package/dist/feature/attachments/repositories/index.js +4 -0
- package/dist/feature/attachments/repositories/index.js.map +1 -0
- package/dist/feature/attachments/repositories/s3-attachment-storage.js +46 -0
- package/dist/feature/attachments/repositories/s3-attachment-storage.js.map +1 -0
- package/dist/feature/attachments/services/attachments.js +191 -0
- package/dist/feature/attachments/services/attachments.js.map +1 -0
- package/dist/feature/attachments/services/create.js +29 -0
- package/dist/feature/attachments/services/create.js.map +1 -0
- package/dist/feature/attachments/services/index.js +3 -0
- package/dist/feature/attachments/services/index.js.map +1 -0
- package/dist/feature/attachments/services/ingest.js +77 -0
- package/dist/feature/attachments/services/ingest.js.map +1 -0
- package/dist/feature/attachments/types/attachments.js +45 -0
- package/dist/feature/attachments/types/attachments.js.map +1 -0
- package/dist/feature/attachments/types/index.js +2 -0
- package/dist/feature/attachments/types/index.js.map +1 -0
- package/dist/feature/observers/services/observers.js +22 -3
- package/dist/feature/observers/services/observers.js.map +1 -1
- package/dist/feature/observers/types/plan-repairs.js +42 -13
- package/dist/feature/observers/types/plan-repairs.js.map +1 -1
- package/dist/feature/queue/repositories/index.js +1 -0
- package/dist/feature/queue/repositories/index.js.map +1 -1
- package/dist/feature/queue/repositories/links.js +117 -0
- package/dist/feature/queue/repositories/links.js.map +1 -0
- package/dist/feature/queue/repositories/queues.js +99 -13
- package/dist/feature/queue/repositories/queues.js.map +1 -1
- package/dist/feature/queue/services/advance.js +94 -38
- package/dist/feature/queue/services/advance.js.map +1 -1
- package/dist/feature/queue/services/control.js +77 -11
- package/dist/feature/queue/services/control.js.map +1 -1
- package/dist/feature/queue/services/create.js +40 -6
- package/dist/feature/queue/services/create.js.map +1 -1
- package/dist/feature/queue/services/edit.js +114 -30
- package/dist/feature/queue/services/edit.js.map +1 -1
- package/dist/feature/queue/services/index.js +1 -0
- package/dist/feature/queue/services/index.js.map +1 -1
- package/dist/feature/queue/services/items.js +85 -66
- package/dist/feature/queue/services/items.js.map +1 -1
- package/dist/feature/queue/services/link-index.js +88 -0
- package/dist/feature/queue/services/link-index.js.map +1 -0
- package/dist/feature/queue/services/links.js +252 -0
- package/dist/feature/queue/services/links.js.map +1 -0
- package/dist/feature/queue/services/projects.js +162 -0
- package/dist/feature/queue/services/projects.js.map +1 -0
- package/dist/feature/queue/services/scope.js +97 -0
- package/dist/feature/queue/services/scope.js.map +1 -0
- package/dist/feature/queue/services/store-lines.js +130 -0
- package/dist/feature/queue/services/store-lines.js.map +1 -0
- package/dist/feature/queue/services/store.js +65 -7
- package/dist/feature/queue/services/store.js.map +1 -1
- package/dist/feature/queue/services/task-tags.js +37 -4
- package/dist/feature/queue/services/task-tags.js.map +1 -1
- package/dist/feature/queue/types/advance.js +25 -12
- package/dist/feature/queue/types/advance.js.map +1 -1
- package/dist/feature/queue/types/dependencies.js +29 -12
- package/dist/feature/queue/types/dependencies.js.map +1 -1
- package/dist/feature/queue/types/edit.js +36 -8
- package/dist/feature/queue/types/edit.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/global/index.js +3 -0
- package/dist/feature/queue/types/global/index.js.map +1 -0
- package/dist/feature/queue/types/global/order.js +63 -0
- package/dist/feature/queue/types/global/order.js.map +1 -0
- package/dist/feature/queue/types/global/queue.js +79 -0
- package/dist/feature/queue/types/global/queue.js.map +1 -0
- package/dist/feature/queue/types/index.js +3 -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/links.js +104 -0
- package/dist/feature/queue/types/links.js.map +1 -0
- package/dist/feature/queue/types/returns.js +3 -1
- 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 +2 -1
- package/dist/feature/runs/machine/exits.js.map +1 -1
- package/dist/feature/runs/machine/plan.js +68 -42
- package/dist/feature/runs/machine/plan.js.map +1 -1
- package/dist/feature/runs/machine/repair.js +17 -3
- package/dist/feature/runs/machine/repair.js.map +1 -1
- package/dist/feature/runs/machine/run-control.js +8 -2
- package/dist/feature/runs/machine/run-control.js.map +1 -1
- package/dist/feature/runs/machine/scheduler.js +9 -19
- package/dist/feature/runs/machine/scheduler.js.map +1 -1
- package/dist/feature/runs/machine/steps.js +4 -4
- package/dist/feature/runs/machine/steps.js.map +1 -1
- package/dist/feature/runs/machine/transition.js +13 -1
- package/dist/feature/runs/machine/transition.js.map +1 -1
- package/dist/feature/runs/machine/variant/index.js +2 -0
- package/dist/feature/runs/machine/variant/index.js.map +1 -0
- package/dist/feature/runs/machine/variant/set-variant.js +134 -0
- package/dist/feature/runs/machine/variant/set-variant.js.map +1 -0
- package/dist/feature/runs/ports/attachments.js +2 -0
- package/dist/feature/runs/ports/attachments.js.map +1 -0
- package/dist/feature/runs/repositories/rows.js +2 -0
- package/dist/feature/runs/repositories/rows.js.map +1 -1
- package/dist/feature/runs/repositories/runs.js +6 -3
- package/dist/feature/runs/repositories/runs.js.map +1 -1
- package/dist/feature/runs/repositories/write.js +4 -4
- package/dist/feature/runs/repositories/write.js.map +1 -1
- package/dist/feature/runs/services/create.js +12 -0
- package/dist/feature/runs/services/create.js.map +1 -1
- package/dist/feature/runs/services/effects/attempts.js +52 -16
- 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/runtime-check.js +20 -0
- package/dist/feature/runs/services/effects/runtime-check.js.map +1 -0
- package/dist/feature/runs/services/engine.js +20 -8
- package/dist/feature/runs/services/engine.js.map +1 -1
- package/dist/feature/runs/services/index.js +1 -1
- package/dist/feature/runs/services/index.js.map +1 -1
- package/dist/feature/runs/services/refresh.js +21 -1
- package/dist/feature/runs/services/refresh.js.map +1 -1
- package/dist/feature/runs/services/requests.js +9 -1
- package/dist/feature/runs/services/requests.js.map +1 -1
- package/dist/feature/runs/services/states.js.map +1 -1
- package/dist/feature/runs/types/attempt.js +14 -0
- package/dist/feature/runs/types/attempt.js.map +1 -1
- package/dist/feature/runs/types/constants.js +2 -0
- package/dist/feature/runs/types/constants.js.map +1 -1
- package/dist/feature/runs/types/create.js +12 -3
- package/dist/feature/runs/types/create.js.map +1 -1
- package/dist/feature/runs/types/group.js +1 -0
- package/dist/feature/runs/types/group.js.map +1 -1
- package/dist/feature/runs/types/index.js +1 -0
- package/dist/feature/runs/types/index.js.map +1 -1
- package/dist/feature/runs/types/input.js +10 -1
- package/dist/feature/runs/types/input.js.map +1 -1
- package/dist/feature/runs/types/limits.js +22 -17
- package/dist/feature/runs/types/limits.js.map +1 -1
- package/dist/feature/runs/types/pools/pools.js +57 -0
- package/dist/feature/runs/types/pools/pools.js.map +1 -0
- package/dist/feature/runs/types/run.js +4 -3
- package/dist/feature/runs/types/run.js.map +1 -1
- package/dist/feature/runs/types/skip.js +2 -17
- package/dist/feature/runs/types/skip.js.map +1 -1
- package/dist/feature/runs/types/topology.js +32 -3
- package/dist/feature/runs/types/topology.js.map +1 -1
- package/dist/feature/stats/repositories/records.js +3 -3
- package/dist/feature/stats/repositories/records.js.map +1 -1
- package/dist/feature/stats/repositories/report.js +1 -2
- package/dist/feature/stats/repositories/report.js.map +1 -1
- package/dist/feature/stats/services/create.js +11 -0
- package/dist/feature/stats/services/create.js.map +1 -1
- package/dist/feature/stats/services/report.js +28 -8
- package/dist/feature/stats/services/report.js.map +1 -1
- package/dist/feature/stats/types/aggregate.js +9 -94
- package/dist/feature/stats/types/aggregate.js.map +1 -1
- package/dist/feature/stats/types/capture.js +0 -2
- package/dist/feature/stats/types/capture.js.map +1 -1
- package/dist/feature/stats/types/index.js +2 -0
- package/dist/feature/stats/types/index.js.map +1 -1
- package/dist/feature/stats/types/names.js +27 -0
- package/dist/feature/stats/types/names.js.map +1 -0
- package/dist/feature/stats/types/records.js.map +1 -1
- package/dist/feature/stats/types/report.js +2 -0
- package/dist/feature/stats/types/report.js.map +1 -1
- package/dist/feature/stats/types/series.js +139 -0
- package/dist/feature/stats/types/series.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 -1
- package/dist/feature/swarm-config/services/index.js.map +1 -1
- package/dist/feature/swarm-config/services/load.js +17 -1
- package/dist/feature/swarm-config/services/load.js.map +1 -1
- package/dist/feature/swarm-config/services/sections/attachments.js +64 -0
- package/dist/feature/swarm-config/services/sections/attachments.js.map +1 -0
- 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/queue.js +163 -0
- package/dist/feature/swarm-config/services/sections/queue.js.map +1 -0
- package/dist/feature/swarm-config/services/sections/runtime-sections.js +72 -0
- package/dist/feature/swarm-config/services/sections/runtime-sections.js.map +1 -0
- package/dist/feature/swarm-config/services/sections/stats.js +1 -2
- package/dist/feature/swarm-config/services/sections/stats.js.map +1 -1
- package/dist/feature/swarm-config/services/sections/variants.js +175 -0
- package/dist/feature/swarm-config/services/sections/variants.js.map +1 -0
- package/dist/feature/swarm-config/services/settings.js +31 -3
- package/dist/feature/swarm-config/services/settings.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-pipelines.js +12 -2
- package/dist/feature/swarm-config/services/validate-pipelines.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-runtimes.js +0 -50
- package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-settings.js +1 -21
- 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 +35 -11
- package/dist/feature/swarm-config/services/validate.js.map +1 -1
- package/dist/feature/swarm-config/types/index.js +2 -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 +3 -0
- package/dist/feature/swarm-config/types/merge.js.map +1 -1
- package/dist/feature/swarm-config/types/pipeline.js +2 -0
- package/dist/feature/swarm-config/types/pipeline.js.map +1 -1
- package/dist/feature/swarm-config/types/settings.js +26 -1
- 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-config/types/variants/apply.js +92 -0
- package/dist/feature/swarm-config/types/variants/apply.js.map +1 -0
- package/dist/feature/swarm-config/types/variants/index.js +3 -0
- package/dist/feature/swarm-config/types/variants/index.js.map +1 -0
- package/dist/feature/swarm-config/types/variants/lookup.js +85 -0
- package/dist/feature/swarm-config/types/variants/lookup.js.map +1 -0
- package/dist/feature/swarm-edit/services/config-edits.js +12 -0
- package/dist/feature/swarm-edit/services/config-edits.js.map +1 -1
- package/dist/feature/swarm-edit/services/editor-settings.js +20 -6
- 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 +11 -3
- package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -1
- package/dist/feature/swarm-edit/services/references.js +25 -0
- package/dist/feature/swarm-edit/services/references.js.map +1 -1
- package/dist/feature/swarm-edit/types/editor.js.map +1 -1
- package/dist/feature/swarm-edit/types/setting-fields.js +14 -2
- package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -1
- package/dist/feature/tags/services/catalog.js +11 -1
- package/dist/feature/tags/services/catalog.js.map +1 -1
- package/dist/feature/tags/types/tags.js +11 -4
- package/dist/feature/tags/types/tags.js.map +1 -1
- package/dist/platform/process/ps.js +1 -1
- package/dist/platform/process/ps.js.map +1 -1
- package/dist/platform/s3/client.js +73 -0
- package/dist/platform/s3/client.js.map +1 -0
- package/dist/platform/s3/sigv4.js +57 -0
- package/dist/platform/s3/sigv4.js.map +1 -0
- package/dist/platform/sqlite/attachments-migration.js +19 -0
- package/dist/platform/sqlite/attachments-migration.js.map +1 -0
- package/dist/platform/sqlite/links-migration.js +38 -0
- package/dist/platform/sqlite/links-migration.js.map +1 -0
- package/dist/platform/sqlite/migrations.js +2 -1
- package/dist/platform/sqlite/migrations.js.map +1 -1
- package/dist/platform/sqlite/parts.js +38 -0
- package/dist/platform/sqlite/parts.js.map +1 -0
- package/dist/presentation/cli/commands/overview/command.js +57 -0
- package/dist/presentation/cli/commands/overview/command.js.map +1 -0
- package/dist/presentation/cli/commands/overview/index.js +2 -0
- package/dist/presentation/cli/commands/overview/index.js.map +1 -0
- package/dist/presentation/cli/commands/queue-edit.js +64 -5
- package/dist/presentation/cli/commands/queue-edit.js.map +1 -1
- package/dist/presentation/cli/commands/queue.js +18 -62
- package/dist/presentation/cli/commands/queue.js.map +1 -1
- package/dist/presentation/cli/commands/run-delivery.js +17 -2
- package/dist/presentation/cli/commands/run-delivery.js.map +1 -1
- package/dist/presentation/cli/commands/run.js +16 -3
- package/dist/presentation/cli/commands/run.js.map +1 -1
- package/dist/presentation/cli/commands/stats.js +1 -1
- package/dist/presentation/cli/commands/stats.js.map +1 -1
- package/dist/presentation/cli/commands/web.js +1 -0
- package/dist/presentation/cli/commands/web.js.map +1 -1
- package/dist/presentation/cli/help.js +1 -1
- package/dist/presentation/cli/help.js.map +1 -1
- package/dist/presentation/cli/io.js.map +1 -1
- package/dist/presentation/cli/links.js +63 -0
- package/dist/presentation/cli/links.js.map +1 -0
- package/dist/presentation/cli/local/config-check.js +4 -0
- package/dist/presentation/cli/local/config-check.js.map +1 -1
- package/dist/presentation/cli/local/present-variants.js +34 -0
- package/dist/presentation/cli/local/present-variants.js.map +1 -0
- package/dist/presentation/cli/options.js +18 -0
- package/dist/presentation/cli/options.js.map +1 -1
- package/dist/presentation/cli/program.js +3 -1
- package/dist/presentation/cli/program.js.map +1 -1
- package/dist/presentation/cli/queue-add.js +101 -0
- package/dist/presentation/cli/queue-add.js.map +1 -0
- package/dist/presentation/cli/queue-print.js +25 -0
- package/dist/presentation/cli/queue-print.js.map +1 -0
- package/dist/presentation/cli/setup/run.js.map +1 -1
- package/dist/presentation/cli/watch.js +105 -8
- package/dist/presentation/cli/watch.js.map +1 -1
- package/dist/presentation/format/groups.js +4 -3
- package/dist/presentation/format/groups.js.map +1 -1
- package/dist/presentation/format/hints.js +33 -0
- package/dist/presentation/format/hints.js.map +1 -0
- package/dist/presentation/format/index.js +8 -3
- package/dist/presentation/format/index.js.map +1 -1
- package/dist/presentation/format/links.js +26 -0
- package/dist/presentation/format/links.js.map +1 -0
- package/dist/presentation/format/numbers.js +20 -0
- package/dist/presentation/format/numbers.js.map +1 -0
- package/dist/presentation/format/overview.js +210 -0
- package/dist/presentation/format/overview.js.map +1 -0
- package/dist/presentation/format/queue.js +89 -20
- package/dist/presentation/format/queue.js.map +1 -1
- package/dist/presentation/format/run-steps.js +56 -0
- package/dist/presentation/format/run-steps.js.map +1 -0
- package/dist/presentation/format/runs.js +46 -16
- package/dist/presentation/format/runs.js.map +1 -1
- package/dist/presentation/format/stats.js +4 -19
- package/dist/presentation/format/stats.js.map +1 -1
- package/dist/presentation/format/style.js +40 -2
- package/dist/presentation/format/style.js.map +1 -1
- package/dist/presentation/format/table.js +23 -11
- package/dist/presentation/format/table.js.map +1 -1
- package/dist/presentation/ipc/contract/agents.js +0 -1
- package/dist/presentation/ipc/contract/agents.js.map +1 -1
- package/dist/presentation/ipc/contract/artifacts.js +4 -0
- package/dist/presentation/ipc/contract/artifacts.js.map +1 -1
- package/dist/presentation/ipc/contract/config.js +43 -3
- package/dist/presentation/ipc/contract/config.js.map +1 -1
- package/dist/presentation/ipc/contract/envelope.js +7 -0
- package/dist/presentation/ipc/contract/envelope.js.map +1 -1
- package/dist/presentation/ipc/contract/panel.js +1 -0
- package/dist/presentation/ipc/contract/panel.js.map +1 -1
- package/dist/presentation/ipc/contract/queue.js +54 -2
- package/dist/presentation/ipc/contract/queue.js.map +1 -1
- package/dist/presentation/ipc/contract/responses/attachments.js +2 -0
- package/dist/presentation/ipc/contract/responses/attachments.js.map +1 -0
- 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 +10 -8
- package/dist/presentation/ipc/contract/responses/stats.js.map +1 -1
- package/dist/presentation/ipc/contract/runs.js +19 -0
- package/dist/presentation/ipc/contract/runs.js.map +1 -1
- package/dist/presentation/ipc/contract/stats/stats.js +1 -0
- package/dist/presentation/ipc/contract/stats/stats.js.map +1 -1
- package/dist/presentation/ipc/handlers/config.js +6 -0
- package/dist/presentation/ipc/handlers/config.js.map +1 -1
- package/dist/presentation/ipc/handlers/groups.js +9 -0
- package/dist/presentation/ipc/handlers/groups.js.map +1 -1
- package/dist/presentation/ipc/handlers/queue.js +44 -13
- package/dist/presentation/ipc/handlers/queue.js.map +1 -1
- package/dist/presentation/ipc/handlers/runs.js +7 -1
- package/dist/presentation/ipc/handlers/runs.js.map +1 -1
- package/dist/presentation/ipc/handlers/stats.js +1 -0
- package/dist/presentation/ipc/handlers/stats.js.map +1 -1
- package/dist/presentation/ipc/handlers/system.js +1 -0
- package/dist/presentation/ipc/handlers/system.js.map +1 -1
- package/dist/presentation/ipc/publisher.js +80 -3
- package/dist/presentation/ipc/publisher.js.map +1 -1
- package/dist/presentation/ipc/snapshots.js +35 -6
- package/dist/presentation/ipc/snapshots.js.map +1 -1
- package/dist/presentation/ipc/views/global-queue.js +48 -0
- package/dist/presentation/ipc/views/global-queue.js.map +1 -0
- package/dist/presentation/ipc/views/index.js +2 -1
- 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 +38 -10
- package/dist/presentation/ipc/views/queue.js.map +1 -1
- package/dist/presentation/ipc/views/runs.js +14 -5
- package/dist/presentation/ipc/views/runs.js.map +1 -1
- package/dist/presentation/mcp/host-kit.js +21 -2
- package/dist/presentation/mcp/host-kit.js.map +1 -1
- package/dist/presentation/mcp/host-links.js +48 -0
- package/dist/presentation/mcp/host-links.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/host-queue.js +21 -13
- package/dist/presentation/mcp/host-queue.js.map +1 -1
- package/dist/presentation/mcp/host-runs.js +17 -2
- package/dist/presentation/mcp/host-runs.js.map +1 -1
- package/dist/presentation/mcp/host.js +4 -1
- package/dist/presentation/mcp/host.js.map +1 -1
- package/dist/presentation/mcp/worker-extra.js +11 -3
- package/dist/presentation/mcp/worker-extra.js.map +1 -1
- package/dist/presentation/web/errors.js +1 -1
- package/dist/presentation/web/errors.js.map +1 -1
- package/dist/presentation/web/hub.js +9 -0
- package/dist/presentation/web/hub.js.map +1 -1
- package/dist/presentation/web/options.js +1 -0
- package/dist/presentation/web/options.js.map +1 -1
- package/dist/presentation/web/panel/daemon-panel.js +1 -0
- package/dist/presentation/web/panel/daemon-panel.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 +8 -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/downloads.js +38 -0
- package/dist/presentation/web/routes/downloads.js.map +1 -1
- package/dist/presentation/web/routes/queue.js +56 -10
- package/dist/presentation/web/routes/queue.js.map +1 -1
- package/dist/presentation/web/routes/runs.js +14 -0
- package/dist/presentation/web/routes/runs.js.map +1 -1
- package/dist/presentation/web/routes/settings.js +10 -0
- package/dist/presentation/web/routes/settings.js.map +1 -1
- package/dist/presentation/web/server.js +13 -2
- package/dist/presentation/web/server.js.map +1 -1
- package/dist/presentation/web/uploads.js +115 -0
- package/dist/presentation/web/uploads.js.map +1 -0
- package/dist/web/assets/FilterColumn-z60UZhkk.js +1 -0
- package/dist/web/assets/SharedPipelinesGroup-CDmnXmIK.js +1 -0
- package/dist/web/assets/card-4euJkmfJ.js +1 -0
- package/dist/web/assets/deliveryModes-BCAw5jcd.js +1 -0
- package/dist/web/assets/empty-OZRGgwa5.js +41 -0
- package/dist/web/assets/index-BAeOzr94.js +43 -0
- package/dist/web/assets/index-D3ty-b_t.css +2 -0
- package/dist/web/assets/locales-9kiK4pzD.js +1 -0
- package/dist/web/assets/pipelines-Bs3be_lB.js +14 -0
- package/dist/web/assets/settingFields-CjOFaEa6.js +1 -0
- package/dist/web/assets/settings-CeKVFMz7.js +6 -0
- package/dist/web/assets/specialists-BPyAYlk1.js +4 -0
- package/dist/web/assets/stats-CzMDDzr9.js +1 -0
- package/dist/web/assets/topology-5cpl0v2g.js +1 -0
- package/dist/web/assets/trash-xUZ90-AG.js +1 -0
- package/dist/web/index.html +7 -7
- package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
- package/integrations/claude-code/hooks/feed.ts +1 -11
- package/integrations/claude-code/hooks/pane.ts +3 -15
- package/integrations/claude-code/hooks/view.tsx +0 -1
- package/integrations/claude-code/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/feature/agents/types/run-naming.js.map +0 -1
- package/dist/web/assets/FilterColumn-BCMp-JO4.js +0 -1
- package/dist/web/assets/SharedPipelinesGroup-DJRGFtzx.js +0 -1
- package/dist/web/assets/badge-C_7kALlW.js +0 -1
- package/dist/web/assets/card-C9eXOVuF.js +0 -1
- package/dist/web/assets/deliveryModes-funlvXVC.js +0 -1
- package/dist/web/assets/empty-ACC2KkXk.js +0 -41
- package/dist/web/assets/index-CsVQUXJH.js +0 -21
- package/dist/web/assets/index-Ds1nt_qm.css +0 -2
- package/dist/web/assets/locales-fB1w2oER.js +0 -1
- package/dist/web/assets/pipelines-DQglwIkL.js +0 -10
- package/dist/web/assets/queue-CAuAo--6.js +0 -16
- package/dist/web/assets/select-BSqaxwh1.js +0 -1
- package/dist/web/assets/settingFields-DVg9TQK2.js +0 -1
- package/dist/web/assets/settings-6eHKYbS7.js +0 -2
- package/dist/web/assets/skeleton-CfLYGtNX.js +0 -1
- package/dist/web/assets/specialists-Durm0DgK.js +0 -1
- package/dist/web/assets/stats-67akPa3A.js +0 -1
- package/dist/web/assets/topology-DQu3su19.js +0 -1
- package/dist/web/assets/trash-ChYI9ms1.js +0 -1
- package/dist/web/assets/useListDrag-0GPS1X83.js +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { fillGlobalPositions, pauseQueue, restoreProjectOrder, } from '../types/index.js';
|
|
2
|
+
/** What the settings ask for: the mode of `queue.scope`, and `project` while the section is wrong. */
|
|
3
|
+
export function wantedScope(config) {
|
|
4
|
+
const settings = config.queueSettings();
|
|
5
|
+
return typeof settings === 'string' ? 'project' : settings.scope;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The mode of the queue: the daemon remembers the mode its queues are arranged for and compares it
|
|
9
|
+
* with `queue.scope` of the shared settings. A change pauses every queue, moves the runs that
|
|
10
|
+
* occupy places to the queues of the new mode and puts the waiting tasks in their order.
|
|
11
|
+
*/
|
|
12
|
+
export class QueueScope {
|
|
13
|
+
dependencies;
|
|
14
|
+
constructor(dependencies) {
|
|
15
|
+
this.dependencies = dependencies;
|
|
16
|
+
}
|
|
17
|
+
/** The mode the daemon works in now. */
|
|
18
|
+
current() {
|
|
19
|
+
return this.dependencies.store.scope();
|
|
20
|
+
}
|
|
21
|
+
/** Looks at the settings after a change of the shared settings.yaml. */
|
|
22
|
+
request() {
|
|
23
|
+
const { runs, config, store } = this.dependencies;
|
|
24
|
+
if (wantedScope(config) === store.scope())
|
|
25
|
+
return;
|
|
26
|
+
void runs.engine
|
|
27
|
+
.serial(async () => {
|
|
28
|
+
this.sync();
|
|
29
|
+
})
|
|
30
|
+
.catch(() => undefined);
|
|
31
|
+
}
|
|
32
|
+
/** Arranges the queues for the mode of the settings; true when the mode changed. */
|
|
33
|
+
sync() {
|
|
34
|
+
const { store, config, now } = this.dependencies;
|
|
35
|
+
const target = wantedScope(config);
|
|
36
|
+
const global = store.globalQueue();
|
|
37
|
+
if (target === global.appliedScope)
|
|
38
|
+
return false;
|
|
39
|
+
const moment = now();
|
|
40
|
+
const queues = store.all();
|
|
41
|
+
// Every queue goes on pause; the runs that work are not touched.
|
|
42
|
+
for (const queue of queues)
|
|
43
|
+
pauseQueue(queue, moment);
|
|
44
|
+
global.status = 'stopped';
|
|
45
|
+
if (global.stop?.kind === 'limit')
|
|
46
|
+
global.stop = { ...global.stop, autoResume: false };
|
|
47
|
+
if (target === 'global')
|
|
48
|
+
this.enableGlobal(global, queues);
|
|
49
|
+
else
|
|
50
|
+
this.disableGlobal(global, queues);
|
|
51
|
+
global.appliedScope = target;
|
|
52
|
+
global.updatedAt = moment;
|
|
53
|
+
store.saveEverything();
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
/** Waiting tasks get the order of the time they were added; the places of the runs join. */
|
|
57
|
+
enableGlobal(global, queues) {
|
|
58
|
+
fillGlobalPositions(queues);
|
|
59
|
+
for (const queue of queues) {
|
|
60
|
+
global.runs.push(...queue.runs.filter((id) => !global.runs.includes(id)));
|
|
61
|
+
global.priority.push(...queue.priority.filter((id) => !global.priority.includes(id)));
|
|
62
|
+
global.skipped.push(...queue.skipped.filter((id) => !global.skipped.includes(id)));
|
|
63
|
+
global.acknowledged.push(...queue.acknowledged);
|
|
64
|
+
queue.runs = [];
|
|
65
|
+
queue.priority = [];
|
|
66
|
+
queue.skipped = [];
|
|
67
|
+
queue.acknowledged = [];
|
|
68
|
+
}
|
|
69
|
+
global.acknowledged = [...new Set(global.acknowledged)];
|
|
70
|
+
}
|
|
71
|
+
/** Every project queue gets its tasks in their global order and the runs that held its places. */
|
|
72
|
+
disableGlobal(global, queues) {
|
|
73
|
+
const { store, runs } = this.dependencies;
|
|
74
|
+
restoreProjectOrder(queues);
|
|
75
|
+
const owner = (id) => {
|
|
76
|
+
const repository = runs.states.lookup(id)?.run.repository;
|
|
77
|
+
return repository === undefined ? undefined : store.of(repository);
|
|
78
|
+
};
|
|
79
|
+
for (const id of global.runs) {
|
|
80
|
+
const queue = owner(id);
|
|
81
|
+
if (!queue)
|
|
82
|
+
continue;
|
|
83
|
+
queue.runs.push(id);
|
|
84
|
+
queue.acknowledged.push(...global.acknowledged.filter((key) => key.startsWith(`${id}/`)));
|
|
85
|
+
}
|
|
86
|
+
for (const id of global.priority)
|
|
87
|
+
owner(id)?.priority.push(id);
|
|
88
|
+
for (const id of global.skipped)
|
|
89
|
+
owner(id)?.skipped.push(id);
|
|
90
|
+
global.runs = [];
|
|
91
|
+
global.priority = [];
|
|
92
|
+
global.skipped = [];
|
|
93
|
+
global.acknowledged = [];
|
|
94
|
+
global.stop = null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/scope.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,mBAAmB,GAGpB,MAAM,mBAAmB,CAAC;AAW3B,sGAAsG;AACtG,MAAM,UAAU,WAAW,CAAC,MAAqB;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;IACxC,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,UAAU;IACJ,YAAY,CAAyB;IAEtD,YAAY,YAAoC;QAC9C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,wCAAwC;IACxC,OAAO;QACL,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;IAED,wEAAwE;IACxE,OAAO;QACL,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,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ACF"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { absorbLine, globalOrder, lineOf, takesProject, } from '../types/index.js';
|
|
2
|
+
/** The lines of the global queue: a `Queue` that holds the global queue and the tasks of the projects. */
|
|
3
|
+
export class StoreLines {
|
|
4
|
+
store;
|
|
5
|
+
dependencies;
|
|
6
|
+
lines = new WeakMap();
|
|
7
|
+
constructor(store, dependencies) {
|
|
8
|
+
this.store = store;
|
|
9
|
+
this.dependencies = dependencies;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The queue that moves the runs of the repository: its own queue in the project mode, and in the
|
|
13
|
+
* global mode a line of the global queue (a `Queue` that holds the state of the global queue and
|
|
14
|
+
* the waiting tasks of all projects). `enabled` leaves out the tasks of projects the global
|
|
15
|
+
* queue does not take: a disabled project and a project the filter does not name.
|
|
16
|
+
*/
|
|
17
|
+
line(repository, enabled, matches) {
|
|
18
|
+
const { store } = this;
|
|
19
|
+
if (store.scope() === 'project')
|
|
20
|
+
return store.of(repository);
|
|
21
|
+
const filter = store.globalQueue().filter;
|
|
22
|
+
const entries = globalOrder(store.all()).filter((entry) => enabled === undefined ||
|
|
23
|
+
(enabled(entry.repository) &&
|
|
24
|
+
takesProject(filter, entry.repository) &&
|
|
25
|
+
(matches?.(entry.repository, entry.item) ?? true)));
|
|
26
|
+
const line = lineOf(store.globalQueue(), entries.map((entry) => entry.item));
|
|
27
|
+
this.lines.set(line, { ids: new Set(line.items.map((item) => item.id)), full: !enabled });
|
|
28
|
+
return line;
|
|
29
|
+
}
|
|
30
|
+
/** Queues whose items wait for `ref` (an item or a run), other than the queue of `repository`. */
|
|
31
|
+
waitingFor(ref, repository) {
|
|
32
|
+
return this.store
|
|
33
|
+
.all()
|
|
34
|
+
.filter((queue) => queue.repository !== repository && queue.items.some((item) => item.after.includes(ref)));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The queue that holds the item. In the global mode the item may stand in the queue of another
|
|
38
|
+
* project than `repository`; otherwise, or when nobody holds it, the queue of `repository`.
|
|
39
|
+
*/
|
|
40
|
+
ownerOf(repository, item) {
|
|
41
|
+
if (this.store.scope() === 'global') {
|
|
42
|
+
const owner = this.store
|
|
43
|
+
.all()
|
|
44
|
+
.find((queue) => queue.items.some((other) => other.id === item));
|
|
45
|
+
if (owner)
|
|
46
|
+
return owner;
|
|
47
|
+
}
|
|
48
|
+
return this.store.of(repository);
|
|
49
|
+
}
|
|
50
|
+
/** Tells the clients about the queue (a line or the queue of a project) when it looks different to them. */
|
|
51
|
+
check(queue) {
|
|
52
|
+
if (this.lines.has(queue))
|
|
53
|
+
this.dependencies.publish.globalQueueChecked();
|
|
54
|
+
else
|
|
55
|
+
this.dependencies.publish.queueChecked(queue);
|
|
56
|
+
}
|
|
57
|
+
/** Whether the queue is a line of the global queue. */
|
|
58
|
+
owns(queue) {
|
|
59
|
+
return this.lines.has(queue);
|
|
60
|
+
}
|
|
61
|
+
/** The repository whose queue holds the item: the queue itself, or the owner of a line's item. */
|
|
62
|
+
repositoryOf(queue, item) {
|
|
63
|
+
if (!this.lines.has(queue))
|
|
64
|
+
return queue.repository;
|
|
65
|
+
for (const candidate of this.store.all()) {
|
|
66
|
+
if (candidate.items.some((other) => other.id === item.id))
|
|
67
|
+
return candidate.repository;
|
|
68
|
+
}
|
|
69
|
+
const run = item.run === null ? undefined : this.dependencies.states.lookup(item.run);
|
|
70
|
+
return run?.run.repository ?? queue.repository;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Takes what a line was changed to back into the global queue and the queues of the projects:
|
|
74
|
+
* its state, the items that left it, the items that joined it and the order.
|
|
75
|
+
*/
|
|
76
|
+
commit(line, announce) {
|
|
77
|
+
const { store } = this;
|
|
78
|
+
const info = this.lines.get(line);
|
|
79
|
+
const { queues, states, publish } = this.dependencies;
|
|
80
|
+
absorbLine(store.globalQueue(), line);
|
|
81
|
+
const touched = new Set();
|
|
82
|
+
const present = new Set(line.items.map((item) => item.id));
|
|
83
|
+
for (const queue of store.all()) {
|
|
84
|
+
const kept = queue.items.filter((item) => !info.ids.has(item.id) || present.has(item.id));
|
|
85
|
+
if (kept.length !== queue.items.length) {
|
|
86
|
+
queue.items = kept;
|
|
87
|
+
touched.add(queue);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const owned = new Set(store.all().flatMap((queue) => queue.items.map((item) => item.id)));
|
|
91
|
+
const added = line.items.filter((item) => !info.ids.has(item.id) && !owned.has(item.id));
|
|
92
|
+
const firstOld = line.items.findIndex((item) => info.ids.has(item.id));
|
|
93
|
+
for (const item of added) {
|
|
94
|
+
const run = item.run === null ? undefined : states.lookup(item.run);
|
|
95
|
+
if (!run)
|
|
96
|
+
continue;
|
|
97
|
+
store.of(run.run.repository).items.push(item);
|
|
98
|
+
touched.add(store.of(run.run.repository));
|
|
99
|
+
if (!info.full) {
|
|
100
|
+
item.globalPosition = line.items.indexOf(item) < firstOld || firstOld < 0 ? -1 : Infinity;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const before = new Map(store.all().flatMap((queue) => queue.items.map((item) => [item.id, item.globalPosition])));
|
|
104
|
+
if (info.full) {
|
|
105
|
+
line.items.forEach((item, index) => {
|
|
106
|
+
item.globalPosition = index + 1;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
globalOrder(store.all()).forEach((entry, index) => {
|
|
111
|
+
entry.item.globalPosition = index + 1;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
for (const queue of store.all()) {
|
|
115
|
+
if (queue.items.some((item) => before.get(item.id) !== item.globalPosition)) {
|
|
116
|
+
touched.add(queue);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
for (const queue of touched)
|
|
120
|
+
queues.saveQueue(queue);
|
|
121
|
+
queues.saveGlobal(store.globalQueue());
|
|
122
|
+
info.ids = new Set(line.items.map((item) => item.id));
|
|
123
|
+
if (!announce)
|
|
124
|
+
return;
|
|
125
|
+
for (const queue of touched)
|
|
126
|
+
publish.queueSaved(queue);
|
|
127
|
+
publish.globalQueueSaved();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=store-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-lines.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/store-lines.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,WAAW,EACX,MAAM,EACN,YAAY,GAGb,MAAM,mBAAmB,CAAC;AAU3B,0GAA0G;AAC1G,MAAM,OAAO,UAAU;IACJ,KAAK,CAAa;IAClB,YAAY,CAAyB;IACrC,KAAK,GAAG,IAAI,OAAO,EAAmB,CAAC;IAExD,YAAY,KAAiB,EAAE,YAAoC;QACjE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,IAAI,CACF,UAAkB,EAClB,OAAyC,EACzC,OAA0D;QAE1D,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QACvB,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC;QAC1C,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAC7C,CAAC,KAAK,EAAE,EAAE,CACR,OAAO,KAAK,SAAS;YACrB,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;gBACxB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC;gBACtC,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CACvD,CAAC;QACF,MAAM,IAAI,GAAG,M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placeNewItems, } from '../types/index.js';
|
|
3
|
+
/** The queues of the repositories and the global queue, kept in memory and in the database. */
|
|
3
4
|
export class QueueStore {
|
|
4
5
|
dependencies;
|
|
5
6
|
queues = new Map();
|
|
7
|
+
/** The lines of the global queue. */
|
|
8
|
+
lines;
|
|
9
|
+
global;
|
|
6
10
|
constructor(dependencies) {
|
|
7
11
|
this.dependencies = dependencies;
|
|
12
|
+
this.lines = new StoreLines(this, dependencies);
|
|
13
|
+
this.global = emptyGlobalQueue(dependencies.now());
|
|
8
14
|
}
|
|
9
15
|
/** Reads the queues from the database; called once at the start. */
|
|
10
16
|
load() {
|
|
11
17
|
for (const queue of this.dependencies.queues.queues())
|
|
12
18
|
this.queues.set(queue.repository, queue);
|
|
19
|
+
this.global = this.dependencies.queues.loadGlobal(this.dependencies.now());
|
|
13
20
|
}
|
|
14
21
|
/** The queue of the repository when it is in memory. */
|
|
15
22
|
get(repository) {
|
|
@@ -18,6 +25,16 @@ export class QueueStore {
|
|
|
18
25
|
all() {
|
|
19
26
|
return [...this.queues.values()];
|
|
20
27
|
}
|
|
28
|
+
/** The global queue: its settings and state. */
|
|
29
|
+
globalQueue() {
|
|
30
|
+
return this.global;
|
|
31
|
+
}
|
|
32
|
+
/** The mode the daemon works in now. */
|
|
33
|
+
scope() {
|
|
34
|
+
return this.global.appliedScope;
|
|
35
|
+
}
|
|
36
|
+
/** Finds an item by id in the queues of every repository. */
|
|
37
|
+
findItem = (id) => lookupIn(...this.queues.values())(id);
|
|
21
38
|
/** The queue of the repository: from memory, the database, or a new empty one. */
|
|
22
39
|
of(repository) {
|
|
23
40
|
const cached = this.queues.get(repository);
|
|
@@ -29,23 +46,48 @@ export class QueueStore {
|
|
|
29
46
|
this.queues.set(repository, queue);
|
|
30
47
|
return queue;
|
|
31
48
|
}
|
|
49
|
+
/** The item became a run: items of other queues that waited for it wait for the run; those queues are saved and returned. */
|
|
50
|
+
itemStarted(queue, item, run) {
|
|
51
|
+
const touched = itemStarted(queue, item, run, this.dependencies.now(), this.all());
|
|
52
|
+
for (const other of touched)
|
|
53
|
+
this.save(other);
|
|
54
|
+
return touched;
|
|
55
|
+
}
|
|
32
56
|
/** Writes the queue and tells the clients. */
|
|
33
57
|
save(queue) {
|
|
58
|
+
if (this.lines.owns(queue)) {
|
|
59
|
+
this.lines.commit(queue, true);
|
|
60
|
+
return queue;
|
|
61
|
+
}
|
|
62
|
+
this.place(queue);
|
|
34
63
|
this.dependencies.queues.saveQueue(queue);
|
|
35
64
|
this.dependencies.publish.queueSaved(queue);
|
|
65
|
+
if (this.scope() === 'global')
|
|
66
|
+
this.dependencies.publish.globalQueueChecked();
|
|
36
67
|
return queue;
|
|
37
68
|
}
|
|
38
69
|
/** Writes the queue without telling the clients: a save that tells them comes later. */
|
|
39
70
|
write(queue) {
|
|
71
|
+
if (this.lines.owns(queue)) {
|
|
72
|
+
this.lines.commit(queue, false);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.place(queue);
|
|
40
76
|
this.dependencies.queues.saveQueue(queue);
|
|
41
77
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
this.
|
|
78
|
+
/** Writes the global queue and every queue without telling the clients, then tells them. */
|
|
79
|
+
saveEverything() {
|
|
80
|
+
for (const queue of this.queues.values())
|
|
81
|
+
this.dependencies.queues.saveQueue(queue);
|
|
82
|
+
this.dependencies.queues.saveGlobal(this.global);
|
|
83
|
+
for (const queue of this.queues.values())
|
|
84
|
+
this.dependencies.publish.queueSaved(queue);
|
|
85
|
+
this.dependencies.publish.globalQueueSaved();
|
|
45
86
|
}
|
|
46
|
-
/** Drops a removed tag from the stored items; no transaction of its own. */
|
|
47
|
-
|
|
87
|
+
/** Drops a removed tag from the stored items and filters; no transaction of its own. */
|
|
88
|
+
dropTag(repository, id) {
|
|
48
89
|
this.dependencies.queues.dropItemTag(repository, id);
|
|
90
|
+
this.dependencies.queues.dropFilterTag(repository, id);
|
|
49
91
|
}
|
|
50
92
|
/** The queue of a project that moved, stored and in memory; no transaction of its own. */
|
|
51
93
|
moveRepository(from, to) {
|
|
@@ -56,6 +98,22 @@ export class QueueStore {
|
|
|
56
98
|
return;
|
|
57
99
|
queue.repository = to;
|
|
58
100
|
this.queues.set(to, queue);
|
|
101
|
+
const projects = this.global.filter.projects;
|
|
102
|
+
if (projects.includes(from)) {
|
|
103
|
+
this.global.filter.projects = projects.map((path) => (path === from ? to : path));
|
|
104
|
+
this.dependencies.queues.saveGlobal(this.global);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** In the global mode a new task goes to the end of the global order, a returned run to its front. */
|
|
108
|
+
place(saved) {
|
|
109
|
+
if (this.scope() === 'project')
|
|
110
|
+
return;
|
|
111
|
+
if (!placeNewItems(this.all()))
|
|
112
|
+
return;
|
|
113
|
+
for (const queue of this.queues.values()) {
|
|
114
|
+
if (queue !== saved)
|
|
115
|
+
this.dependencies.queues.saveQueue(queue);
|
|
116
|
+
}
|
|
59
117
|
}
|
|
60
118
|
}
|
|
61
119
|
//# sourceMappingURL=store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,aAAa,GAKd,MAAM,mBAAmB,CAAC;AAS3B,+FAA+F;AAC/F,MAAM,OAAO,UAAU;IACJ,YAAY,CAAyB;IACrC,MAAM,GAAG,IAAI,GAAG,EAAiB,CAAC;IACnD,qCAAqC;IAC5B,KAAK,CAAa;IACnB,MAAM,CAAc;IAE5B,YAAY,YAAoC;QAC9C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,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Tags, resolveTags, } from '../../tags/types/index.js';
|
|
3
|
-
import { dependencyTags, spreadTags } from '../types/index.js';
|
|
3
|
+
import { dependencyTags, spreadTags, checkParentCycle } from '../types/index.js';
|
|
4
4
|
/** The tags of runs and queue items: the queue is the one feature that sees tags and runs. */
|
|
5
5
|
export class TaskTags {
|
|
6
6
|
dependencies;
|
|
@@ -19,7 +19,7 @@ export class TaskTags {
|
|
|
19
19
|
database.transaction(() => {
|
|
20
20
|
tags.deleteStored(repository, id);
|
|
21
21
|
runs.states.changeStored(repository, { dropTag: id });
|
|
22
|
-
store.
|
|
22
|
+
store.dropTag(repository, id);
|
|
23
23
|
});
|
|
24
24
|
tags.forget(id);
|
|
25
25
|
for (const state of runs.states.all()) {
|
|
@@ -31,10 +31,12 @@ export class TaskTags {
|
|
|
31
31
|
for (const queue of store.all()) {
|
|
32
32
|
if (queue.repository !== repository)
|
|
33
33
|
continue;
|
|
34
|
-
|
|
34
|
+
const inFilter = queue.filter.tags.includes(id);
|
|
35
|
+
if (!inFilter && !queue.items.some((item) => item.tags.includes(id)))
|
|
35
36
|
continue;
|
|
36
37
|
for (const item of queue.items)
|
|
37
38
|
item.tags = item.tags.filter((tag) => tag !== id);
|
|
39
|
+
queue.filter = { ...queue.filter, tags: queue.filter.tags.filter((tag) => tag !== id) };
|
|
38
40
|
queue.updatedAt = now();
|
|
39
41
|
store.save(queue);
|
|
40
42
|
}
|
|
@@ -44,7 +46,10 @@ export class TaskTags {
|
|
|
44
46
|
/** Own tags plus the tags of the predecessors in `after`, only those still in the catalog. */
|
|
45
47
|
inherit(queue, own, after) {
|
|
46
48
|
const { runs, tags } = this.dependencies;
|
|
47
|
-
const inherited = dependencyTags(queue, after, (id) =>
|
|
49
|
+
const inherited = dependencyTags(queue, after, (id) => {
|
|
50
|
+
const run = runs.states.lookup(id)?.run;
|
|
51
|
+
return run?.repository === queue.repository ? run.tags : undefined;
|
|
52
|
+
}, this.dependencies.store.findItem);
|
|
48
53
|
return knownTags(tags.of(queue.repository), mergeTags(own, inherited));
|
|
49
54
|
}
|
|
50
55
|
/** `run_tags`: adds and removes tags of a run; added tags spread to the tasks that wait for it. */
|
|
@@ -100,4 +105,32 @@ export class TaskTags {
|
|
|
100
105
|
return tag;
|
|
101
106
|
}
|
|
102
107
|
}
|
|
108
|
+
/** The parent of a run changes; the linked tag of the old parent goes, that of the new one comes first. */
|
|
109
|
+
export async function setRunParent(deps, index, run, parent) {
|
|
110
|
+
const { runs, store, tags, taskTags, links, now } = deps;
|
|
111
|
+
const state = runs.states.get(run);
|
|
112
|
+
if (parent !== null)
|
|
113
|
+
checkParentCycle((other) => index.parentOf(other), run, parent);
|
|
114
|
+
const old = index.parentOf(run);
|
|
115
|
+
const catalog = tags.of(state.run.repository);
|
|
116
|
+
let next = knownTags(catalog, state.run.tags);
|
|
117
|
+
const oldTag = old === undefined ? undefined : linkedTagOf(catalog, old);
|
|
118
|
+
if (oldTag)
|
|
119
|
+
next = next.filter((id) => id !== oldTag.id);
|
|
120
|
+
const target = parent === null ? undefined : runs.states.lookup(parent);
|
|
121
|
+
const added = [];
|
|
122
|
+
if (target && target.run.repository === state.run.repository) {
|
|
123
|
+
const tag = await taskTags.linkedTagFor(target);
|
|
124
|
+
next = mergeTags([tag.id], next);
|
|
125
|
+
added.push(tag.id);
|
|
126
|
+
}
|
|
127
|
+
const rows = parent === null ? [] : [{ kind: 'parent', target: parent }];
|
|
128
|
+
links.replaceSource(run, ['parent'], rows, now());
|
|
129
|
+
if (next.join() !== state.run.tags.join()) {
|
|
130
|
+
await runs.engine.apply(state, { kind: 'tags_set', tags: next });
|
|
131
|
+
}
|
|
132
|
+
const queue = store.of(state.run.repository);
|
|
133
|
+
if (spreadTags(queue, run, added, now()).length > 0)
|
|
134
|
+
store.save(queue);
|
|
135
|
+
}
|
|
103
136
|
//# sourceMappingURL=task-tags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-tags.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/task-tags.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAiB,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,WAAW,GAEZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAc,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"task-tags.js","sourceRoot":"","sources":["../../../../src/feature/queue/services/task-tags.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAiB,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,WAAW,GAEZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAc,MAAM,mBAAmB,CAAC;AAe7F,8FAA8F;AAC9F,MAAM,OAAO,QAAQ;IACF,YAAY,CAAuB;IAEpD,YAAY,YAAkC;QAC5C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,MAA2C;QACtD,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;QACzE,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1D,4FAA4F;QAC5F,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE;YACxB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,C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I,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { finishedApartFromRepair, retryableGroups, runProblems, } from '../../runs/types/index.js';
|
|
2
|
-
import { itemReadiness } from './dependencies.js';
|
|
2
|
+
import { itemReadiness, lookupIn } from './dependencies.js';
|
|
3
|
+
import { replaceRef } from './edit.js';
|
|
3
4
|
import { QUEUE_SKIPPED_MAX, newItemId, queueStates } from './items.js';
|
|
4
5
|
import { BLOCKING_REASONS, SKIPPED_REASONS, STOPPING_REASONS, limitHits } from './limit-hits.js';
|
|
6
|
+
import { matchesFilter } from './filter.js';
|
|
5
7
|
import { claimPlace, deferRun, occupiesSlot } from './returns.js';
|
|
6
8
|
import { queueWakeAt, startQueue } from './settings.js';
|
|
7
9
|
/** A new usage limit of a run of the queue stops it; every such attempt counts once. */
|
|
@@ -91,7 +93,7 @@ function stopOnProblem(queue, watched) {
|
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
/** The items of finished returned runs are no longer needed: what waited for them waits for the run. */
|
|
94
|
-
function dropFinishedReturns(queue, lookup) {
|
|
96
|
+
function dropFinishedReturns(queue, lookup, all, now, touched) {
|
|
95
97
|
for (const item of [...queue.items]) {
|
|
96
98
|
if (item.run === null)
|
|
97
99
|
continue;
|
|
@@ -106,6 +108,8 @@ function dropFinishedReturns(queue, lookup) {
|
|
|
106
108
|
...new Set(other.after.map((ref) => (ref === item.id ? item.run : ref))),
|
|
107
109
|
].filter((ref) => ref !== null);
|
|
108
110
|
}
|
|
111
|
+
for (const other of replaceRef(queue, all, item.id, item.run, now))
|
|
112
|
+
touched.add(other);
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
}
|
|
@@ -131,7 +135,7 @@ function takeFrozen(queue, lookup) {
|
|
|
131
135
|
return take;
|
|
132
136
|
}
|
|
133
137
|
/** Returned runs without a hold take a place at once, freezing the last run that took one. */
|
|
134
|
-
function takeReturned(queue, own, lookup, now, result, reserved) {
|
|
138
|
+
function takeReturned(queue, own, find, lookup, now, result, reserved) {
|
|
135
139
|
const live = () => own.filter((state) => queue.runs.includes(state.run.id));
|
|
136
140
|
for (const item of [...queue.items]) {
|
|
137
141
|
if (item.run === null || item.postponed || result.freeze.includes(item.run))
|
|
@@ -141,7 +145,7 @@ function takeReturned(queue, own, lookup, now, result, reserved) {
|
|
|
141
145
|
const state = lookup(item.run);
|
|
142
146
|
if (!state || state.run.hold !== null || retryableGroups(state).length === 0)
|
|
143
147
|
continue;
|
|
144
|
-
if (itemReadiness(
|
|
148
|
+
if (itemReadiness(find, item, lookup) !== 'ready')
|
|
145
149
|
continue;
|
|
146
150
|
const frozen = claimPlace(queue, live(), item.run, newItemId(queue, now), now, reserved);
|
|
147
151
|
if (frozen !== null)
|
|
@@ -150,21 +154,25 @@ function takeReturned(queue, own, lookup, now, result, reserved) {
|
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
/** The ready items that fit into the free places. */
|
|
153
|
-
function takeReady(queue, lookup, take, frozenTaken) {
|
|
157
|
+
function takeReady(queue, find, lookup, take, frozenTaken) {
|
|
154
158
|
const free = Math.max(0, queue.parallel - queue.runs.length - frozenTaken);
|
|
155
159
|
return queue.items
|
|
156
160
|
.filter((item) => !take.includes(item) &&
|
|
157
161
|
!item.postponed &&
|
|
162
|
+
matchesFilter(queue.filter, item) &&
|
|
158
163
|
!(item.run !== null && lookup(item.run)?.run.hold === 'paused') &&
|
|
159
164
|
!(queue.skipFailed && item.error !== null) &&
|
|
160
|
-
itemReadiness(
|
|
165
|
+
itemReadiness(find, item, lookup) === 'ready')
|
|
161
166
|
.slice(0, free);
|
|
162
167
|
}
|
|
163
168
|
/**
|
|
164
169
|
* Observes the runs of the queue and returns the items to start now. Items leave
|
|
165
170
|
* the queue only through `itemStarted`.
|
|
166
171
|
*/
|
|
167
|
-
export function advance(queue, states, lookup, now) {
|
|
172
|
+
export function advance(queue, states, lookup, now, all = []) {
|
|
173
|
+
const queues = all.includes(queue) ? all : [queue, ...all];
|
|
174
|
+
const find = lookupIn(...queues);
|
|
175
|
+
const touched = new Set();
|
|
168
176
|
let own = queueStates(queue, states);
|
|
169
177
|
const wake = queueWakeAt(queue);
|
|
170
178
|
if (wake !== null && now >= wake)
|
|
@@ -173,26 +181,31 @@ export function advance(queue, states, lookup, now) {
|
|
|
173
181
|
own = skipFailedRuns(queue, own);
|
|
174
182
|
const free = Math.max(0, queue.parallel - own.filter(occupiesSlot).length);
|
|
175
183
|
const revived = returnSkippedRuns(queue, lookup, now, free);
|
|
176
|
-
const result = {
|
|
184
|
+
const result = {
|
|
185
|
+
take: [],
|
|
186
|
+
freeze: revived.frozen.map((state) => state.run.id),
|
|
187
|
+
touched: [],
|
|
188
|
+
};
|
|
177
189
|
own = [...own, ...revived.returned];
|
|
178
190
|
const watched = own.filter((state) => state.run.hold === null);
|
|
179
191
|
stopOnLimit(queue, watched);
|
|
180
192
|
stopOnProblem(queue, watched);
|
|
181
|
-
dropFinishedReturns(queue, lookup);
|
|
193
|
+
dropFinishedReturns(queue, lookup, queues, now, touched);
|
|
182
194
|
releasePlaces(queue, own);
|
|
183
195
|
result.take = takeFrozen(queue, lookup);
|
|
184
196
|
const frozenTaken = result.take.length;
|
|
185
197
|
if (queue.status === 'running') {
|
|
186
|
-
takeReturned(queue, own, lookup, now, result, frozenTaken);
|
|
187
|
-
result.take.push(...takeReady(queue, lookup, result.take, frozenTaken));
|
|
198
|
+
takeReturned(queue, own, find, lookup, now, result, frozenTaken);
|
|
199
|
+
result.take.push(...takeReady(queue, find, lookup, result.take, frozenTaken));
|
|
188
200
|
if (!queue.autopilot &&
|
|
189
|
-
!queue.items.some((item) => !item.postponed) &&
|
|
201
|
+
!queue.items.some((item) => !item.postponed && matchesFilter(queue.filter, item)) &&
|
|
190
202
|
queue.runs.length === 0) {
|
|
191
203
|
queue.status = 'stopped';
|
|
192
204
|
}
|
|
193
205
|
}
|
|
194
206
|
queue.priority = queue.priority.filter((id) => queue.runs.includes(id));
|
|
195
207
|
queue.updatedAt = now;
|
|
208
|
+
result.touched = [...touched];
|
|
196
209
|
return result;
|
|
197
210
|
}
|
|
198
211
|
//# sourceMappingURL=advance.js.map
|