@hoknie/aip 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +13 -0
- package/README.md +74 -2
- package/dist/app/agents.js +18 -0
- package/dist/app/agents.js.map +1 -0
- package/dist/app/application.js +173 -0
- package/dist/app/application.js.map +1 -0
- package/dist/app/daemon.js +71 -0
- package/dist/app/daemon.js.map +1 -0
- package/dist/app/index.js +5 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/lifecycle.js +30 -0
- package/dist/app/lifecycle.js.map +1 -0
- package/dist/app/maintenance.js +27 -0
- package/dist/app/maintenance.js.map +1 -0
- package/dist/app/timings.js +23 -0
- package/dist/app/timings.js.map +1 -0
- package/dist/app/wiring.js +57 -0
- package/dist/app/wiring.js.map +1 -0
- package/dist/cli/clean.js +71 -0
- package/dist/cli/clean.js.map +1 -0
- package/dist/cli/commands.js +963 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/config-check.js +173 -0
- package/dist/cli/config-check.js.map +1 -0
- package/dist/cli/daemon.js +199 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/help.js +50 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/init.js +43 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/io.js +13 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/main.js +31 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/probe.js +12 -0
- package/dist/cli/probe.js.map +1 -0
- package/dist/cli/program.js +48 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/setup.js +406 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/version.js +6 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/cli/watch.js +24 -0
- package/dist/cli/watch.js.map +1 -0
- package/dist/cli/web/daemon-panel.js +185 -0
- package/dist/cli/web/daemon-panel.js.map +1 -0
- package/dist/cli/web/default-repository.js +12 -0
- package/dist/cli/web/default-repository.js.map +1 -0
- package/dist/cli/web/errors.js +60 -0
- package/dist/cli/web/errors.js.map +1 -0
- package/dist/cli/web/open.js +12 -0
- package/dist/cli/web/open.js.map +1 -0
- package/dist/cli/web/page.js +465 -0
- package/dist/cli/web/page.js.map +1 -0
- package/dist/cli/web/server.js +1191 -0
- package/dist/cli/web/server.js.map +1 -0
- package/dist/cli/web/standby.js +119 -0
- package/dist/cli/web/standby.js.map +1 -0
- package/dist/cli/web/state.js +69 -0
- package/dist/cli/web/state.js.map +1 -0
- package/dist/cli/web/system.js +66 -0
- package/dist/cli/web/system.js.map +1 -0
- package/dist/cli/web-control.js +173 -0
- package/dist/cli/web-control.js.map +1 -0
- package/dist/config/discover.js +25 -0
- package/dist/config/discover.js.map +1 -0
- package/dist/config/duration.js +17 -0
- package/dist/config/duration.js.map +1 -0
- package/dist/config/edit.js +966 -0
- package/dist/config/edit.js.map +1 -0
- package/dist/config/errors.js +29 -0
- package/dist/config/errors.js.map +1 -0
- package/dist/config/index.js +14 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.js +412 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/merge.js +45 -0
- package/dist/config/merge.js.map +1 -0
- package/dist/config/model.js +171 -0
- package/dist/config/model.js.map +1 -0
- package/dist/config/paths.js +31 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/prompt.js +33 -0
- package/dist/config/prompt.js.map +1 -0
- package/dist/config/shared-pipelines.js +71 -0
- package/dist/config/shared-pipelines.js.map +1 -0
- package/dist/config/shared-specialists.js +68 -0
- package/dist/config/shared-specialists.js.map +1 -0
- package/dist/config/shared-workflows.js +71 -0
- package/dist/config/shared-workflows.js.map +1 -0
- package/dist/config/specialist-tags.js +214 -0
- package/dist/config/specialist-tags.js.map +1 -0
- package/dist/config/tag-names.js +43 -0
- package/dist/config/tag-names.js.map +1 -0
- package/dist/config/validate.js +872 -0
- package/dist/config/validate.js.map +1 -0
- package/dist/core/artifacts.js +37 -0
- package/dist/core/artifacts.js.map +1 -0
- package/dist/core/create.js +75 -0
- package/dist/core/create.js.map +1 -0
- package/dist/core/delivery.js +366 -0
- package/dist/core/delivery.js.map +1 -0
- package/dist/core/errors.js +7 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/ids.js +99 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/index.js +21 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/input.js +45 -0
- package/dist/core/input.js.map +1 -0
- package/dist/core/machine.js +1021 -0
- package/dist/core/machine.js.map +1 -0
- package/dist/core/model.js +460 -0
- package/dist/core/model.js.map +1 -0
- package/dist/core/observer.js +193 -0
- package/dist/core/observer.js.map +1 -0
- package/dist/core/occupancy.js +63 -0
- package/dist/core/occupancy.js.map +1 -0
- package/dist/core/permissions.js +222 -0
- package/dist/core/permissions.js.map +1 -0
- package/dist/core/plan.js +99 -0
- package/dist/core/plan.js.map +1 -0
- package/dist/core/progress.js +43 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/questions.js +19 -0
- package/dist/core/questions.js.map +1 -0
- package/dist/core/queue.js +859 -0
- package/dist/core/queue.js.map +1 -0
- package/dist/core/retryable.js +8 -0
- package/dist/core/retryable.js.map +1 -0
- package/dist/core/scheduler.js +160 -0
- package/dist/core/scheduler.js.map +1 -0
- package/dist/core/skip.js +109 -0
- package/dist/core/skip.js.map +1 -0
- package/dist/core/stages.js +304 -0
- package/dist/core/stages.js.map +1 -0
- package/dist/core/summary.js +35 -0
- package/dist/core/summary.js.map +1 -0
- package/dist/core/tags.js +184 -0
- package/dist/core/tags.js.map +1 -0
- package/dist/core/topology.js +162 -0
- package/dist/core/topology.js.map +1 -0
- package/dist/daemon/artifacts.js +84 -0
- package/dist/daemon/artifacts.js.map +1 -0
- package/dist/daemon/daemon.js +1442 -0
- package/dist/daemon/daemon.js.map +1 -0
- package/dist/daemon/executor.js +749 -0
- package/dist/daemon/executor.js.map +1 -0
- package/dist/daemon/helpers.js +38 -0
- package/dist/daemon/helpers.js.map +1 -0
- package/dist/daemon/index.js +4 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/logs.js +69 -0
- package/dist/daemon/logs.js.map +1 -0
- package/dist/daemon/observers.js +93 -0
- package/dist/daemon/observers.js.map +1 -0
- package/dist/daemon/patches.js +76 -0
- package/dist/daemon/patches.js.map +1 -0
- package/dist/daemon/ports.js +2 -0
- package/dist/daemon/ports.js.map +1 -0
- package/dist/daemon/processes.js +98 -0
- package/dist/daemon/processes.js.map +1 -0
- package/dist/daemon/repositories.js +2 -0
- package/dist/daemon/repositories.js.map +1 -0
- package/dist/daemon/server.js +164 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/supervisor.js +140 -0
- package/dist/daemon/supervisor.js.map +1 -0
- package/dist/daemon/timings.js +23 -0
- package/dist/daemon/timings.js.map +1 -0
- package/dist/feature/agents/clients/agy/events.js +36 -0
- package/dist/feature/agents/clients/agy/events.js.map +1 -0
- package/dist/feature/agents/clients/agy/guard-commands.js +29 -0
- package/dist/feature/agents/clients/agy/guard-commands.js.map +1 -0
- package/dist/feature/agents/clients/agy/guard-paths.js +36 -0
- package/dist/feature/agents/clients/agy/guard-paths.js.map +1 -0
- package/dist/feature/agents/clients/agy/guard.js +77 -0
- package/dist/feature/agents/clients/agy/guard.js.map +1 -0
- package/dist/feature/agents/clients/agy/hooks.js +46 -0
- package/dist/feature/agents/clients/agy/hooks.js.map +1 -0
- package/dist/feature/agents/clients/agy/index.js +5 -0
- package/dist/feature/agents/clients/agy/index.js.map +1 -0
- package/dist/feature/agents/clients/agy/parser.js +63 -0
- package/dist/feature/agents/clients/agy/parser.js.map +1 -0
- package/dist/feature/agents/clients/agy/permissions.js +40 -0
- package/dist/feature/agents/clients/agy/permissions.js.map +1 -0
- package/dist/feature/agents/clients/agy/runtime.js +114 -0
- package/dist/feature/agents/clients/agy/runtime.js.map +1 -0
- package/dist/feature/agents/clients/agy/transcript.js +65 -0
- package/dist/feature/agents/clients/agy/transcript.js.map +1 -0
- package/dist/feature/agents/clients/claude/index.js +5 -0
- package/dist/feature/agents/clients/claude/index.js.map +1 -0
- package/dist/feature/agents/clients/claude/parser.js +221 -0
- package/dist/feature/agents/clients/claude/parser.js.map +1 -0
- package/dist/feature/agents/clients/claude/permissions.js +70 -0
- package/dist/feature/agents/clients/claude/permissions.js.map +1 -0
- package/dist/feature/agents/clients/claude/runtime.js +116 -0
- package/dist/feature/agents/clients/claude/runtime.js.map +1 -0
- package/dist/feature/agents/clients/claude/transcript.js +105 -0
- package/dist/feature/agents/clients/claude/transcript.js.map +1 -0
- package/dist/feature/agents/clients/naming/index.js +2 -0
- package/dist/feature/agents/clients/naming/index.js.map +1 -0
- package/dist/feature/agents/clients/naming/naming.js +15 -0
- package/dist/feature/agents/clients/naming/naming.js.map +1 -0
- package/dist/feature/agents/clients/opencode/index.js +4 -0
- package/dist/feature/agents/clients/opencode/index.js.map +1 -0
- package/dist/feature/agents/clients/opencode/parser.js +84 -0
- package/dist/feature/agents/clients/opencode/parser.js.map +1 -0
- package/dist/feature/agents/clients/opencode/runtime.js +129 -0
- package/dist/feature/agents/clients/opencode/runtime.js.map +1 -0
- package/dist/feature/agents/clients/opencode/transcript.js +77 -0
- package/dist/feature/agents/clients/opencode/transcript.js.map +1 -0
- package/dist/feature/agents/ports/index.js +2 -0
- package/dist/feature/agents/ports/index.js.map +1 -0
- package/dist/feature/agents/ports/naming.js +2 -0
- package/dist/feature/agents/ports/naming.js.map +1 -0
- package/dist/feature/agents/ports/runtime-factory.js +2 -0
- package/dist/feature/agents/ports/runtime-factory.js.map +1 -0
- package/dist/feature/agents/services/agents.js +38 -0
- package/dist/feature/agents/services/agents.js.map +1 -0
- package/dist/feature/agents/services/catalog.js +117 -0
- package/dist/feature/agents/services/catalog.js.map +1 -0
- package/dist/feature/agents/services/create.js +5 -0
- package/dist/feature/agents/services/create.js.map +1 -0
- package/dist/feature/agents/services/index.js +7 -0
- package/dist/feature/agents/services/index.js.map +1 -0
- package/dist/feature/agents/services/logs.js +69 -0
- package/dist/feature/agents/services/logs.js.map +1 -0
- package/dist/feature/agents/services/skills.js +17 -0
- package/dist/feature/agents/services/skills.js.map +1 -0
- package/dist/feature/agents/services/supervisor.js +160 -0
- package/dist/feature/agents/services/supervisor.js.map +1 -0
- package/dist/feature/agents/types/catalog.js +2 -0
- package/dist/feature/agents/types/catalog.js.map +1 -0
- package/dist/feature/agents/types/index.js +12 -0
- package/dist/feature/agents/types/index.js.map +1 -0
- package/dist/feature/agents/types/message.js +48 -0
- package/dist/feature/agents/types/message.js.map +1 -0
- package/dist/feature/agents/types/naming.js +4 -0
- package/dist/feature/agents/types/naming.js.map +1 -0
- package/dist/feature/agents/types/permissions.js +235 -0
- package/dist/feature/agents/types/permissions.js.map +1 -0
- package/dist/feature/agents/types/run-naming.js +66 -0
- package/dist/feature/agents/types/run-naming.js.map +1 -0
- package/dist/feature/agents/types/runtime.js +18 -0
- package/dist/feature/agents/types/runtime.js.map +1 -0
- package/dist/feature/agents/types/step-input.js +2 -0
- package/dist/feature/agents/types/step-input.js.map +1 -0
- package/dist/feature/agents/types/transcript-parts.js +62 -0
- package/dist/feature/agents/types/transcript-parts.js.map +1 -0
- package/dist/feature/agents/types/transcript.js +8 -0
- package/dist/feature/agents/types/transcript.js.map +1 -0
- package/dist/feature/agents/types/usage.js +14 -0
- package/dist/feature/agents/types/usage.js.map +1 -0
- package/dist/feature/agents/types/worker-tools.js +20 -0
- package/dist/feature/agents/types/worker-tools.js.map +1 -0
- package/dist/feature/artifacts/ports/index.js +2 -0
- package/dist/feature/artifacts/ports/index.js.map +1 -0
- package/dist/feature/artifacts/ports/publish.js +2 -0
- package/dist/feature/artifacts/ports/publish.js.map +1 -0
- package/dist/feature/artifacts/repositories/artifact-storage.js +84 -0
- package/dist/feature/artifacts/repositories/artifact-storage.js.map +1 -0
- package/dist/feature/artifacts/repositories/artifacts.js +85 -0
- package/dist/feature/artifacts/repositories/artifacts.js.map +1 -0
- package/dist/feature/artifacts/repositories/index.js +3 -0
- package/dist/feature/artifacts/repositories/index.js.map +1 -0
- package/dist/feature/artifacts/services/artifacts.js +105 -0
- package/dist/feature/artifacts/services/artifacts.js.map +1 -0
- package/dist/feature/artifacts/services/create.js +14 -0
- package/dist/feature/artifacts/services/create.js.map +1 -0
- package/dist/feature/artifacts/services/files.js +42 -0
- package/dist/feature/artifacts/services/files.js.map +1 -0
- package/dist/feature/artifacts/services/index.js +3 -0
- package/dist/feature/artifacts/services/index.js.map +1 -0
- package/dist/feature/artifacts/types/artifacts.js +36 -0
- package/dist/feature/artifacts/types/artifacts.js.map +1 -0
- package/dist/feature/artifacts/types/index.js +2 -0
- package/dist/feature/artifacts/types/index.js.map +1 -0
- package/dist/feature/artifacts/types/views.js +2 -0
- package/dist/feature/artifacts/types/views.js.map +1 -0
- package/dist/feature/compose/services/create.js +11 -0
- package/dist/feature/compose/services/create.js.map +1 -0
- package/dist/feature/compose/services/index.js +5 -0
- package/dist/feature/compose/services/index.js.map +1 -0
- package/dist/feature/compose/services/repository-edit.js +20 -0
- package/dist/feature/compose/services/repository-edit.js.map +1 -0
- package/dist/feature/compose/services/repository-move.js +35 -0
- package/dist/feature/compose/services/repository-move.js.map +1 -0
- package/dist/feature/compose/services/repository-removal.js +38 -0
- package/dist/feature/compose/services/repository-removal.js.map +1 -0
- package/dist/feature/delivery/ports/index.js +2 -0
- package/dist/feature/delivery/ports/index.js.map +1 -0
- package/dist/feature/delivery/ports/publish.js +2 -0
- package/dist/feature/delivery/ports/publish.js.map +1 -0
- package/dist/feature/delivery/repositories/index.js +3 -0
- package/dist/feature/delivery/repositories/index.js.map +1 -0
- package/dist/feature/delivery/repositories/patch-storage.js +76 -0
- package/dist/feature/delivery/repositories/patch-storage.js.map +1 -0
- package/dist/feature/delivery/repositories/patches.js +28 -0
- package/dist/feature/delivery/repositories/patches.js.map +1 -0
- package/dist/feature/delivery/services/create.js +21 -0
- package/dist/feature/delivery/services/create.js.map +1 -0
- package/dist/feature/delivery/services/deliver.js +67 -0
- package/dist/feature/delivery/services/deliver.js.map +1 -0
- package/dist/feature/delivery/services/diffs.js +153 -0
- package/dist/feature/delivery/services/diffs.js.map +1 -0
- package/dist/feature/delivery/services/index.js +5 -0
- package/dist/feature/delivery/services/index.js.map +1 -0
- package/dist/feature/delivery/services/patches.js +96 -0
- package/dist/feature/delivery/services/patches.js.map +1 -0
- package/dist/feature/delivery/types/index.js +3 -0
- package/dist/feature/delivery/types/index.js.map +1 -0
- package/dist/feature/delivery/types/outcomes.js +2 -0
- package/dist/feature/delivery/types/outcomes.js.map +1 -0
- package/dist/feature/delivery/types/spec-change.js +18 -0
- package/dist/feature/delivery/types/spec-change.js.map +1 -0
- package/dist/feature/observers/ports/index.js +2 -0
- package/dist/feature/observers/ports/index.js.map +1 -0
- package/dist/feature/observers/ports/publish.js +2 -0
- package/dist/feature/observers/ports/publish.js.map +1 -0
- package/dist/feature/observers/repositories/index.js +2 -0
- package/dist/feature/observers/repositories/index.js.map +1 -0
- package/dist/feature/observers/repositories/observers.js +28 -0
- package/dist/feature/observers/repositories/observers.js.map +1 -0
- package/dist/feature/observers/services/create.js +11 -0
- package/dist/feature/observers/services/create.js.map +1 -0
- package/dist/feature/observers/services/history.js +76 -0
- package/dist/feature/observers/services/history.js.map +1 -0
- package/dist/feature/observers/services/index.js +5 -0
- package/dist/feature/observers/services/index.js.map +1 -0
- package/dist/feature/observers/services/observers.js +178 -0
- package/dist/feature/observers/services/observers.js.map +1 -0
- package/dist/feature/observers/services/settings-check.js +93 -0
- package/dist/feature/observers/services/settings-check.js.map +1 -0
- package/dist/feature/observers/types/actions.js +2 -0
- package/dist/feature/observers/types/actions.js.map +1 -0
- package/dist/feature/observers/types/index.js +4 -0
- package/dist/feature/observers/types/index.js.map +1 -0
- package/dist/feature/observers/types/plan-repairs.js +109 -0
- package/dist/feature/observers/types/plan-repairs.js.map +1 -0
- package/dist/feature/observers/types/settings.js +13 -0
- package/dist/feature/observers/types/settings.js.map +1 -0
- package/dist/feature/processes/ports/index.js +2 -0
- package/dist/feature/processes/ports/index.js.map +1 -0
- package/dist/feature/processes/ports/publish.js +2 -0
- package/dist/feature/processes/ports/publish.js.map +1 -0
- package/dist/feature/processes/services/create.js +5 -0
- package/dist/feature/processes/services/create.js.map +1 -0
- package/dist/feature/processes/services/index.js +4 -0
- package/dist/feature/processes/services/index.js.map +1 -0
- package/dist/feature/processes/services/processes.js +131 -0
- package/dist/feature/processes/services/processes.js.map +1 -0
- package/dist/feature/processes/services/tree.js +98 -0
- package/dist/feature/processes/services/tree.js.map +1 -0
- package/dist/feature/processes/types/background.js +2 -0
- package/dist/feature/processes/types/background.js.map +1 -0
- package/dist/feature/processes/types/index.js +2 -0
- package/dist/feature/processes/types/index.js.map +1 -0
- package/dist/feature/queue/ports/index.js +2 -0
- package/dist/feature/queue/ports/index.js.map +1 -0
- package/dist/feature/queue/ports/observe.js +2 -0
- package/dist/feature/queue/ports/observe.js.map +1 -0
- package/dist/feature/queue/ports/publish.js +2 -0
- package/dist/feature/queue/ports/publish.js.map +1 -0
- package/dist/feature/queue/ports/repair-policy.js +2 -0
- package/dist/feature/queue/ports/repair-policy.js.map +1 -0
- package/dist/feature/queue/repositories/index.js +2 -0
- package/dist/feature/queue/repositories/index.js.map +1 -0
- package/dist/feature/queue/repositories/queues.js +100 -0
- package/dist/feature/queue/repositories/queues.js.map +1 -0
- package/dist/feature/queue/services/advance.js +214 -0
- package/dist/feature/queue/services/advance.js.map +1 -0
- package/dist/feature/queue/services/control.js +153 -0
- package/dist/feature/queue/services/control.js.map +1 -0
- package/dist/feature/queue/services/create.js +26 -0
- package/dist/feature/queue/services/create.js.map +1 -0
- package/dist/feature/queue/services/edit.js +126 -0
- package/dist/feature/queue/services/edit.js.map +1 -0
- package/dist/feature/queue/services/index.js +8 -0
- package/dist/feature/queue/services/index.js.map +1 -0
- package/dist/feature/queue/services/items.js +173 -0
- package/dist/feature/queue/services/items.js.map +1 -0
- package/dist/feature/queue/services/store.js +61 -0
- package/dist/feature/queue/services/store.js.map +1 -0
- package/dist/feature/queue/services/task-tags.js +103 -0
- package/dist/feature/queue/services/task-tags.js.map +1 -0
- package/dist/feature/queue/types/advance.js +183 -0
- package/dist/feature/queue/types/advance.js.map +1 -0
- package/dist/feature/queue/types/dependencies.js +98 -0
- package/dist/feature/queue/types/dependencies.js.map +1 -0
- package/dist/feature/queue/types/edit.js +180 -0
- package/dist/feature/queue/types/edit.js.map +1 -0
- package/dist/feature/queue/types/ids.js +7 -0
- package/dist/feature/queue/types/ids.js.map +1 -0
- package/dist/feature/queue/types/index.js +10 -0
- package/dist/feature/queue/types/index.js.map +1 -0
- package/dist/feature/queue/types/items.js +46 -0
- package/dist/feature/queue/types/items.js.map +1 -0
- package/dist/feature/queue/types/limit-hits.js +50 -0
- package/dist/feature/queue/types/limit-hits.js.map +1 -0
- package/dist/feature/queue/types/requests.js +2 -0
- package/dist/feature/queue/types/requests.js.map +1 -0
- package/dist/feature/queue/types/returns.js +182 -0
- package/dist/feature/queue/types/returns.js.map +1 -0
- package/dist/feature/queue/types/settings.js +117 -0
- package/dist/feature/queue/types/settings.js.map +1 -0
- package/dist/feature/repos/ports/index.js +2 -0
- package/dist/feature/repos/ports/index.js.map +1 -0
- package/dist/feature/repos/ports/publish.js +2 -0
- package/dist/feature/repos/ports/publish.js.map +1 -0
- package/dist/feature/repos/repositories/index.js +2 -0
- package/dist/feature/repos/repositories/index.js.map +1 -0
- package/dist/feature/repos/repositories/known.js +41 -0
- package/dist/feature/repos/repositories/known.js.map +1 -0
- package/dist/feature/repos/services/create.js +13 -0
- package/dist/feature/repos/services/create.js.map +1 -0
- package/dist/feature/repos/services/index.js +4 -0
- package/dist/feature/repos/services/index.js.map +1 -0
- package/dist/feature/repos/services/projects.js +50 -0
- package/dist/feature/repos/services/projects.js.map +1 -0
- package/dist/feature/repos/services/registry.js +138 -0
- package/dist/feature/repos/services/registry.js.map +1 -0
- package/dist/feature/repos/types/index.js +2 -0
- package/dist/feature/repos/types/index.js.map +1 -0
- package/dist/feature/repos/types/project.js +80 -0
- package/dist/feature/repos/types/project.js.map +1 -0
- package/dist/feature/repos/types/registry.js +2 -0
- package/dist/feature/repos/types/registry.js.map +1 -0
- package/dist/feature/runs/machine/answers.js +112 -0
- package/dist/feature/runs/machine/answers.js.map +1 -0
- package/dist/feature/runs/machine/delivery-checks.js +91 -0
- package/dist/feature/runs/machine/delivery-checks.js.map +1 -0
- package/dist/feature/runs/machine/delivery-flow.js +211 -0
- package/dist/feature/runs/machine/delivery-flow.js.map +1 -0
- package/dist/feature/runs/machine/events.js +2 -0
- package/dist/feature/runs/machine/events.js.map +1 -0
- package/dist/feature/runs/machine/exits.js +207 -0
- package/dist/feature/runs/machine/exits.js.map +1 -0
- package/dist/feature/runs/machine/index.js +7 -0
- package/dist/feature/runs/machine/index.js.map +1 -0
- package/dist/feature/runs/machine/plan.js +111 -0
- package/dist/feature/runs/machine/plan.js.map +1 -0
- package/dist/feature/runs/machine/repair.js +155 -0
- package/dist/feature/runs/machine/repair.js.map +1 -0
- package/dist/feature/runs/machine/run-control.js +276 -0
- package/dist/feature/runs/machine/run-control.js.map +1 -0
- package/dist/feature/runs/machine/scheduler.js +119 -0
- package/dist/feature/runs/machine/scheduler.js.map +1 -0
- package/dist/feature/runs/machine/steps.js +275 -0
- package/dist/feature/runs/machine/steps.js.map +1 -0
- package/dist/feature/runs/machine/texts.js +69 -0
- package/dist/feature/runs/machine/texts.js.map +1 -0
- package/dist/feature/runs/machine/transition.js +113 -0
- package/dist/feature/runs/machine/transition.js.map +1 -0
- package/dist/feature/runs/ports/agent-exit.js +2 -0
- package/dist/feature/runs/ports/agent-exit.js.map +1 -0
- package/dist/feature/runs/ports/diff.js +2 -0
- package/dist/feature/runs/ports/diff.js.map +1 -0
- package/dist/feature/runs/ports/index.js +2 -0
- package/dist/feature/runs/ports/index.js.map +1 -0
- package/dist/feature/runs/ports/observe.js +2 -0
- package/dist/feature/runs/ports/observe.js.map +1 -0
- package/dist/feature/runs/ports/publish.js +2 -0
- package/dist/feature/runs/ports/publish.js.map +1 -0
- package/dist/feature/runs/ports/queue-advance.js +2 -0
- package/dist/feature/runs/ports/queue-advance.js.map +1 -0
- package/dist/feature/runs/repositories/attempt-history.js +116 -0
- package/dist/feature/runs/repositories/attempt-history.js.map +1 -0
- package/dist/feature/runs/repositories/finished-runs.js +42 -0
- package/dist/feature/runs/repositories/finished-runs.js.map +1 -0
- package/dist/feature/runs/repositories/index.js +4 -0
- package/dist/feature/runs/repositories/index.js.map +1 -0
- package/dist/feature/runs/repositories/rows.js +110 -0
- package/dist/feature/runs/repositories/rows.js.map +1 -0
- package/dist/feature/runs/repositories/runs.js +76 -0
- package/dist/feature/runs/repositories/runs.js.map +1 -0
- package/dist/feature/runs/repositories/write.js +31 -0
- package/dist/feature/runs/repositories/write.js.map +1 -0
- package/dist/feature/runs/services/archive.js +17 -0
- package/dist/feature/runs/services/archive.js.map +1 -0
- package/dist/feature/runs/services/attempt-history.js +11 -0
- package/dist/feature/runs/services/attempt-history.js.map +1 -0
- package/dist/feature/runs/services/create.js +43 -0
- package/dist/feature/runs/services/create.js.map +1 -0
- package/dist/feature/runs/services/effects/actions.js +150 -0
- package/dist/feature/runs/services/effects/actions.js.map +1 -0
- package/dist/feature/runs/services/effects/attempts.js +179 -0
- package/dist/feature/runs/services/effects/attempts.js.map +1 -0
- package/dist/feature/runs/services/effects/context.js +7 -0
- package/dist/feature/runs/services/effects/context.js.map +1 -0
- package/dist/feature/runs/services/effects/effects.js +82 -0
- package/dist/feature/runs/services/effects/effects.js.map +1 -0
- package/dist/feature/runs/services/effects/git.js +168 -0
- package/dist/feature/runs/services/effects/git.js.map +1 -0
- package/dist/feature/runs/services/effects/naming.js +62 -0
- package/dist/feature/runs/services/effects/naming.js.map +1 -0
- package/dist/feature/runs/services/effects/outside.js +83 -0
- package/dist/feature/runs/services/effects/outside.js.map +1 -0
- package/dist/feature/runs/services/effects/running.js +76 -0
- package/dist/feature/runs/services/effects/running.js.map +1 -0
- package/dist/feature/runs/services/effects/usage.js +61 -0
- package/dist/feature/runs/services/effects/usage.js.map +1 -0
- package/dist/feature/runs/services/effects/worktrees.js +49 -0
- package/dist/feature/runs/services/effects/worktrees.js.map +1 -0
- package/dist/feature/runs/services/engine.js +163 -0
- package/dist/feature/runs/services/engine.js.map +1 -0
- package/dist/feature/runs/services/index.js +15 -0
- package/dist/feature/runs/services/index.js.map +1 -0
- package/dist/feature/runs/services/occupancy.js +62 -0
- package/dist/feature/runs/services/occupancy.js.map +1 -0
- package/dist/feature/runs/services/progress.js +42 -0
- package/dist/feature/runs/services/progress.js.map +1 -0
- package/dist/feature/runs/services/reads.js +54 -0
- package/dist/feature/runs/services/reads.js.map +1 -0
- package/dist/feature/runs/services/recovery.js +17 -0
- package/dist/feature/runs/services/recovery.js.map +1 -0
- package/dist/feature/runs/services/refresh.js +29 -0
- package/dist/feature/runs/services/refresh.js.map +1 -0
- package/dist/feature/runs/services/requests.js +88 -0
- package/dist/feature/runs/services/requests.js.map +1 -0
- package/dist/feature/runs/services/states.js +112 -0
- package/dist/feature/runs/services/states.js.map +1 -0
- package/dist/feature/runs/services/summary.js +38 -0
- package/dist/feature/runs/services/summary.js.map +1 -0
- package/dist/feature/runs/types/attempt.js +102 -0
- package/dist/feature/runs/types/attempt.js.map +1 -0
- package/dist/feature/runs/types/constants.js +45 -0
- package/dist/feature/runs/types/constants.js.map +1 -0
- package/dist/feature/runs/types/create.js +177 -0
- package/dist/feature/runs/types/create.js.map +1 -0
- package/dist/feature/runs/types/group.js +152 -0
- package/dist/feature/runs/types/group.js.map +1 -0
- package/dist/feature/runs/types/history/attempt-history.js +16 -0
- package/dist/feature/runs/types/history/attempt-history.js.map +1 -0
- package/dist/feature/runs/types/index.js +15 -0
- package/dist/feature/runs/types/index.js.map +1 -0
- package/dist/feature/runs/types/input.js +57 -0
- package/dist/feature/runs/types/input.js.map +1 -0
- package/dist/feature/runs/types/limits.js +151 -0
- package/dist/feature/runs/types/limits.js.map +1 -0
- package/dist/feature/runs/types/problems.js +74 -0
- package/dist/feature/runs/types/problems.js.map +1 -0
- package/dist/feature/runs/types/run.js +162 -0
- package/dist/feature/runs/types/run.js.map +1 -0
- package/dist/feature/runs/types/skip.js +110 -0
- package/dist/feature/runs/types/skip.js.map +1 -0
- package/dist/feature/runs/types/stage-status.js +156 -0
- package/dist/feature/runs/types/stage-status.js.map +1 -0
- package/dist/feature/runs/types/stages.js +158 -0
- package/dist/feature/runs/types/stages.js.map +1 -0
- package/dist/feature/runs/types/topology.js +165 -0
- package/dist/feature/runs/types/topology.js.map +1 -0
- package/dist/feature/swarm-config/repositories/config-files.js +141 -0
- package/dist/feature/swarm-config/repositories/config-files.js.map +1 -0
- package/dist/feature/swarm-config/services/assemble.js +212 -0
- package/dist/feature/swarm-config/services/assemble.js.map +1 -0
- package/dist/feature/swarm-config/services/create.js +5 -0
- package/dist/feature/swarm-config/services/create.js.map +1 -0
- package/dist/feature/swarm-config/services/discover.js +19 -0
- package/dist/feature/swarm-config/services/discover.js.map +1 -0
- package/dist/feature/swarm-config/services/index.js +9 -0
- package/dist/feature/swarm-config/services/index.js.map +1 -0
- package/dist/feature/swarm-config/services/load.js +86 -0
- package/dist/feature/swarm-config/services/load.js.map +1 -0
- package/dist/feature/swarm-config/services/settings.js +50 -0
- package/dist/feature/swarm-config/services/settings.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-actions.js +117 -0
- package/dist/feature/swarm-config/services/validate-actions.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-context.js +91 -0
- package/dist/feature/swarm-config/services/validate-context.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-pipelines.js +170 -0
- package/dist/feature/swarm-config/services/validate-pipelines.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-runtimes.js +212 -0
- package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-settings.js +177 -0
- package/dist/feature/swarm-config/services/validate-settings.js.map +1 -0
- package/dist/feature/swarm-config/services/validate-specialists.js +152 -0
- package/dist/feature/swarm-config/services/validate-specialists.js.map +1 -0
- package/dist/feature/swarm-config/services/validate.js +174 -0
- package/dist/feature/swarm-config/services/validate.js.map +1 -0
- package/dist/feature/swarm-config/types/action.js +11 -0
- package/dist/feature/swarm-config/types/action.js.map +1 -0
- package/dist/feature/swarm-config/types/chain.js +2 -0
- package/dist/feature/swarm-config/types/chain.js.map +1 -0
- package/dist/feature/swarm-config/types/duration.js +17 -0
- package/dist/feature/swarm-config/types/duration.js.map +1 -0
- package/dist/feature/swarm-config/types/errors.js +57 -0
- package/dist/feature/swarm-config/types/errors.js.map +1 -0
- package/dist/feature/swarm-config/types/index.js +13 -0
- package/dist/feature/swarm-config/types/index.js.map +1 -0
- package/dist/feature/swarm-config/types/levels.js +16 -0
- package/dist/feature/swarm-config/types/levels.js.map +1 -0
- package/dist/feature/swarm-config/types/lookups.js +53 -0
- package/dist/feature/swarm-config/types/lookups.js.map +1 -0
- package/dist/feature/swarm-config/types/merge.js +46 -0
- package/dist/feature/swarm-config/types/merge.js.map +1 -0
- package/dist/feature/swarm-config/types/pipeline.js +5 -0
- package/dist/feature/swarm-config/types/pipeline.js.map +1 -0
- package/dist/feature/swarm-config/types/prompt.js +33 -0
- package/dist/feature/swarm-config/types/prompt.js.map +1 -0
- package/dist/feature/swarm-config/types/settings.js +116 -0
- package/dist/feature/swarm-config/types/settings.js.map +1 -0
- package/dist/feature/swarm-config/types/specialist.js +38 -0
- package/dist/feature/swarm-config/types/specialist.js.map +1 -0
- package/dist/feature/swarm-config/types/tag-names.js +43 -0
- package/dist/feature/swarm-config/types/tag-names.js.map +1 -0
- package/dist/feature/swarm-edit/ports/config-changed.js +2 -0
- package/dist/feature/swarm-edit/ports/config-changed.js.map +1 -0
- package/dist/feature/swarm-edit/ports/index.js +2 -0
- package/dist/feature/swarm-edit/ports/index.js.map +1 -0
- package/dist/feature/swarm-edit/repositories/documents.js +144 -0
- package/dist/feature/swarm-edit/repositories/documents.js.map +1 -0
- package/dist/feature/swarm-edit/services/config-edits.js +116 -0
- package/dist/feature/swarm-edit/services/config-edits.js.map +1 -0
- package/dist/feature/swarm-edit/services/create.js +7 -0
- package/dist/feature/swarm-edit/services/create.js.map +1 -0
- package/dist/feature/swarm-edit/services/editor-settings.js +143 -0
- package/dist/feature/swarm-edit/services/editor-settings.js.map +1 -0
- package/dist/feature/swarm-edit/services/editor-view.js +144 -0
- package/dist/feature/swarm-edit/services/editor-view.js.map +1 -0
- package/dist/feature/swarm-edit/services/index.js +12 -0
- package/dist/feature/swarm-edit/services/index.js.map +1 -0
- package/dist/feature/swarm-edit/services/levels.js +30 -0
- package/dist/feature/swarm-edit/services/levels.js.map +1 -0
- package/dist/feature/swarm-edit/services/plan-edit.js +217 -0
- package/dist/feature/swarm-edit/services/plan-edit.js.map +1 -0
- package/dist/feature/swarm-edit/services/plan-settings.js +198 -0
- package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -0
- package/dist/feature/swarm-edit/services/references.js +85 -0
- package/dist/feature/swarm-edit/services/references.js.map +1 -0
- package/dist/feature/swarm-edit/services/shared-config.js +128 -0
- package/dist/feature/swarm-edit/services/shared-config.js.map +1 -0
- package/dist/feature/swarm-edit/services/shared-pipelines.js +72 -0
- package/dist/feature/swarm-edit/services/shared-pipelines.js.map +1 -0
- package/dist/feature/swarm-edit/services/shared-specialists.js +70 -0
- package/dist/feature/swarm-edit/services/shared-specialists.js.map +1 -0
- package/dist/feature/swarm-edit/services/specialist-tags.js +215 -0
- package/dist/feature/swarm-edit/services/specialist-tags.js.map +1 -0
- package/dist/feature/swarm-edit/types/editor.js +27 -0
- package/dist/feature/swarm-edit/types/editor.js.map +1 -0
- package/dist/feature/swarm-edit/types/index.js +7 -0
- package/dist/feature/swarm-edit/types/index.js.map +1 -0
- package/dist/feature/swarm-edit/types/setting-fields.js +64 -0
- package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -0
- package/dist/feature/swarm-edit/types/shared.js +2 -0
- package/dist/feature/swarm-edit/types/shared.js.map +1 -0
- package/dist/feature/swarm-edit/types/stages.js +69 -0
- package/dist/feature/swarm-edit/types/stages.js.map +1 -0
- package/dist/feature/swarm-edit/types/tag-folders.js +2 -0
- package/dist/feature/swarm-edit/types/tag-folders.js.map +1 -0
- package/dist/feature/swarm-edit/types/views.js +2 -0
- package/dist/feature/swarm-edit/types/views.js.map +1 -0
- package/dist/feature/tags/ports/index.js +2 -0
- package/dist/feature/tags/ports/index.js.map +1 -0
- package/dist/feature/tags/ports/publish.js +2 -0
- package/dist/feature/tags/ports/publish.js.map +1 -0
- package/dist/feature/tags/repositories/index.js +2 -0
- package/dist/feature/tags/repositories/index.js.map +1 -0
- package/dist/feature/tags/repositories/tags.js +36 -0
- package/dist/feature/tags/repositories/tags.js.map +1 -0
- package/dist/feature/tags/services/catalog.js +73 -0
- package/dist/feature/tags/services/catalog.js.map +1 -0
- package/dist/feature/tags/services/create.js +7 -0
- package/dist/feature/tags/services/create.js.map +1 -0
- package/dist/feature/tags/services/index.js +3 -0
- package/dist/feature/tags/services/index.js.map +1 -0
- package/dist/feature/tags/types/ids.js +7 -0
- package/dist/feature/tags/types/ids.js.map +1 -0
- package/dist/feature/tags/types/index.js +3 -0
- package/dist/feature/tags/types/index.js.map +1 -0
- package/dist/feature/tags/types/tags.js +184 -0
- package/dist/feature/tags/types/tags.js.map +1 -0
- package/dist/git/delivery.js +284 -0
- package/dist/git/delivery.js.map +1 -0
- package/dist/git/index.js +4 -0
- package/dist/git/index.js.map +1 -0
- package/dist/git/runner.js +60 -0
- package/dist/git/runner.js.map +1 -0
- package/dist/git/workspace.js +366 -0
- package/dist/git/workspace.js.map +1 -0
- package/dist/mcp/host.js +401 -0
- package/dist/mcp/host.js.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/tools.js +19 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/version.js +5 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/mcp/worker.js +230 -0
- package/dist/mcp/worker.js.map +1 -0
- package/dist/platform/build/fingerprint.js +36 -0
- package/dist/platform/build/fingerprint.js.map +1 -0
- package/dist/platform/build/index.js +3 -0
- package/dist/platform/build/index.js.map +1 -0
- package/dist/platform/build/locations.js +16 -0
- package/dist/platform/build/locations.js.map +1 -0
- package/dist/platform/errors/app-error.js +39 -0
- package/dist/platform/errors/app-error.js.map +1 -0
- package/dist/platform/errors/index.js +2 -0
- package/dist/platform/errors/index.js.map +1 -0
- package/dist/platform/git/delivery.js +284 -0
- package/dist/platform/git/delivery.js.map +1 -0
- package/dist/platform/git/index.js +4 -0
- package/dist/platform/git/index.js.map +1 -0
- package/dist/platform/git/runner.js +65 -0
- package/dist/platform/git/runner.js.map +1 -0
- package/dist/platform/git/workspace.js +366 -0
- package/dist/platform/git/workspace.js.map +1 -0
- package/dist/platform/paths/index.js +2 -0
- package/dist/platform/paths/index.js.map +1 -0
- package/dist/platform/paths/paths.js +39 -0
- package/dist/platform/paths/paths.js.map +1 -0
- package/dist/platform/process/index.js +3 -0
- package/dist/platform/process/index.js.map +1 -0
- package/dist/platform/process/ps.js +42 -0
- package/dist/platform/process/ps.js.map +1 -0
- package/dist/platform/process/which.js +21 -0
- package/dist/platform/process/which.js.map +1 -0
- package/dist/platform/sqlite/database.js +36 -0
- package/dist/platform/sqlite/database.js.map +1 -0
- package/dist/platform/sqlite/index.js +4 -0
- package/dist/platform/sqlite/index.js.map +1 -0
- package/dist/platform/sqlite/migrations.js +297 -0
- package/dist/platform/sqlite/migrations.js.map +1 -0
- package/dist/platform/sqlite/rows.js +13 -0
- package/dist/platform/sqlite/rows.js.map +1 -0
- package/dist/presentation/cli/commands/daemon.js +216 -0
- package/dist/presentation/cli/commands/daemon.js.map +1 -0
- package/dist/presentation/cli/commands/group.js +88 -0
- package/dist/presentation/cli/commands/group.js.map +1 -0
- package/dist/presentation/cli/commands/mcp.js +44 -0
- package/dist/presentation/cli/commands/mcp.js.map +1 -0
- package/dist/presentation/cli/commands/queue-edit.js +155 -0
- package/dist/presentation/cli/commands/queue-edit.js.map +1 -0
- package/dist/presentation/cli/commands/queue.js +222 -0
- package/dist/presentation/cli/commands/queue.js.map +1 -0
- package/dist/presentation/cli/commands/repositories.js +129 -0
- package/dist/presentation/cli/commands/repositories.js.map +1 -0
- package/dist/presentation/cli/commands/run-delivery.js +116 -0
- package/dist/presentation/cli/commands/run-delivery.js.map +1 -0
- package/dist/presentation/cli/commands/run.js +156 -0
- package/dist/presentation/cli/commands/run.js.map +1 -0
- package/dist/presentation/cli/commands/setup.js +97 -0
- package/dist/presentation/cli/commands/setup.js.map +1 -0
- package/dist/presentation/cli/commands/tag.js +92 -0
- package/dist/presentation/cli/commands/tag.js.map +1 -0
- package/dist/presentation/cli/commands/web.js +100 -0
- package/dist/presentation/cli/commands/web.js.map +1 -0
- package/dist/presentation/cli/context.js +49 -0
- package/dist/presentation/cli/context.js.map +1 -0
- package/dist/presentation/cli/help.js +49 -0
- package/dist/presentation/cli/help.js.map +1 -0
- package/dist/presentation/cli/io.js +13 -0
- package/dist/presentation/cli/io.js.map +1 -0
- package/dist/presentation/cli/local/clean.js +72 -0
- package/dist/presentation/cli/local/clean.js.map +1 -0
- package/dist/presentation/cli/local/config-check.js +207 -0
- package/dist/presentation/cli/local/config-check.js.map +1 -0
- package/dist/presentation/cli/local/init.js +44 -0
- package/dist/presentation/cli/local/init.js.map +1 -0
- package/dist/presentation/cli/options.js +34 -0
- package/dist/presentation/cli/options.js.map +1 -0
- package/dist/presentation/cli/probe.js +12 -0
- package/dist/presentation/cli/probe.js.map +1 -0
- package/dist/presentation/cli/program.js +76 -0
- package/dist/presentation/cli/program.js.map +1 -0
- package/dist/presentation/cli/setup/actions.js +206 -0
- package/dist/presentation/cli/setup/actions.js.map +1 -0
- package/dist/presentation/cli/setup/command.js +80 -0
- package/dist/presentation/cli/setup/command.js.map +1 -0
- package/dist/presentation/cli/setup/host.js +20 -0
- package/dist/presentation/cli/setup/host.js.map +1 -0
- package/dist/presentation/cli/setup/index.js +5 -0
- package/dist/presentation/cli/setup/index.js.map +1 -0
- package/dist/presentation/cli/setup/run.js +63 -0
- package/dist/presentation/cli/setup/run.js.map +1 -0
- package/dist/presentation/cli/setup/system.js +53 -0
- package/dist/presentation/cli/setup/system.js.map +1 -0
- package/dist/presentation/cli/setup/types.js +3 -0
- package/dist/presentation/cli/setup/types.js.map +1 -0
- package/dist/presentation/cli/watch.js +24 -0
- package/dist/presentation/cli/watch.js.map +1 -0
- package/dist/presentation/cli/web-control.js +172 -0
- package/dist/presentation/cli/web-control.js.map +1 -0
- package/dist/presentation/format/groups.js +99 -0
- package/dist/presentation/format/groups.js.map +1 -0
- package/dist/presentation/format/index.js +7 -0
- package/dist/presentation/format/index.js.map +1 -0
- package/dist/presentation/format/queue.js +109 -0
- package/dist/presentation/format/queue.js.map +1 -0
- package/dist/presentation/format/runs.js +202 -0
- package/dist/presentation/format/runs.js.map +1 -0
- package/dist/presentation/format/style.js +81 -0
- package/dist/presentation/format/style.js.map +1 -0
- package/dist/presentation/format/table.js +62 -0
- package/dist/presentation/format/table.js.map +1 -0
- package/dist/presentation/format/tags.js +26 -0
- package/dist/presentation/format/tags.js.map +1 -0
- package/dist/presentation/ipc/client/autostart.js +171 -0
- package/dist/presentation/ipc/client/autostart.js.map +1 -0
- package/dist/presentation/ipc/client/client.js +83 -0
- package/dist/presentation/ipc/client/client.js.map +1 -0
- package/dist/presentation/ipc/client/index.js +4 -0
- package/dist/presentation/ipc/client/index.js.map +1 -0
- package/dist/presentation/ipc/client/repository-argument.js +13 -0
- package/dist/presentation/ipc/client/repository-argument.js.map +1 -0
- package/dist/presentation/ipc/contract/agents.js +79 -0
- package/dist/presentation/ipc/contract/agents.js.map +1 -0
- package/dist/presentation/ipc/contract/artifacts.js +27 -0
- package/dist/presentation/ipc/contract/artifacts.js.map +1 -0
- package/dist/presentation/ipc/contract/config.js +141 -0
- package/dist/presentation/ipc/contract/config.js.map +1 -0
- package/dist/presentation/ipc/contract/envelope.js +97 -0
- package/dist/presentation/ipc/contract/envelope.js.map +1 -0
- package/dist/presentation/ipc/contract/groups.js +48 -0
- package/dist/presentation/ipc/contract/groups.js.map +1 -0
- package/dist/presentation/ipc/contract/index.js +14 -0
- package/dist/presentation/ipc/contract/index.js.map +1 -0
- package/dist/presentation/ipc/contract/observers/history.js +26 -0
- package/dist/presentation/ipc/contract/observers/history.js.map +1 -0
- package/dist/presentation/ipc/contract/observers.js +16 -0
- package/dist/presentation/ipc/contract/observers.js.map +1 -0
- package/dist/presentation/ipc/contract/panel.js +53 -0
- package/dist/presentation/ipc/contract/panel.js.map +1 -0
- package/dist/presentation/ipc/contract/processes.js +9 -0
- package/dist/presentation/ipc/contract/processes.js.map +1 -0
- package/dist/presentation/ipc/contract/queue.js +115 -0
- package/dist/presentation/ipc/contract/queue.js.map +1 -0
- package/dist/presentation/ipc/contract/repositories.js +33 -0
- package/dist/presentation/ipc/contract/repositories.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/artifacts.js +2 -0
- package/dist/presentation/ipc/contract/responses/artifacts.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/config.js +2 -0
- package/dist/presentation/ipc/contract/responses/config.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/groups.js +2 -0
- package/dist/presentation/ipc/contract/responses/groups.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/index.js +11 -0
- package/dist/presentation/ipc/contract/responses/index.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/observer-history.js +2 -0
- package/dist/presentation/ipc/contract/responses/observer-history.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/observers.js +2 -0
- package/dist/presentation/ipc/contract/responses/observers.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/processes.js +2 -0
- package/dist/presentation/ipc/contract/responses/processes.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/queue.js +2 -0
- package/dist/presentation/ipc/contract/responses/queue.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/repositories.js +2 -0
- package/dist/presentation/ipc/contract/responses/repositories.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/runs.js +2 -0
- package/dist/presentation/ipc/contract/responses/runs.js.map +1 -0
- package/dist/presentation/ipc/contract/responses/tags.js +2 -0
- package/dist/presentation/ipc/contract/responses/tags.js.map +1 -0
- package/dist/presentation/ipc/contract/runs.js +112 -0
- package/dist/presentation/ipc/contract/runs.js.map +1 -0
- package/dist/presentation/ipc/contract/tags.js +40 -0
- package/dist/presentation/ipc/contract/tags.js.map +1 -0
- package/dist/presentation/ipc/handlers/config.js +38 -0
- package/dist/presentation/ipc/handlers/config.js.map +1 -0
- package/dist/presentation/ipc/handlers/groups.js +14 -0
- package/dist/presentation/ipc/handlers/groups.js.map +1 -0
- package/dist/presentation/ipc/handlers/index.js +2 -0
- package/dist/presentation/ipc/handlers/index.js.map +1 -0
- package/dist/presentation/ipc/handlers/observers.js +14 -0
- package/dist/presentation/ipc/handlers/observers.js.map +1 -0
- package/dist/presentation/ipc/handlers/queue.js +36 -0
- package/dist/presentation/ipc/handlers/queue.js.map +1 -0
- package/dist/presentation/ipc/handlers/repositories.js +26 -0
- package/dist/presentation/ipc/handlers/repositories.js.map +1 -0
- package/dist/presentation/ipc/handlers/runs.js +55 -0
- package/dist/presentation/ipc/handlers/runs.js.map +1 -0
- package/dist/presentation/ipc/handlers/system.js +38 -0
- package/dist/presentation/ipc/handlers/system.js.map +1 -0
- package/dist/presentation/ipc/handlers/table.js +23 -0
- package/dist/presentation/ipc/handlers/table.js.map +1 -0
- package/dist/presentation/ipc/handlers/types.js +2 -0
- package/dist/presentation/ipc/handlers/types.js.map +1 -0
- package/dist/presentation/ipc/publisher.js +175 -0
- package/dist/presentation/ipc/publisher.js.map +1 -0
- package/dist/presentation/ipc/server.js +164 -0
- package/dist/presentation/ipc/server.js.map +1 -0
- package/dist/presentation/ipc/services.js +2 -0
- package/dist/presentation/ipc/services.js.map +1 -0
- package/dist/presentation/ipc/snapshots.js +60 -0
- package/dist/presentation/ipc/snapshots.js.map +1 -0
- package/dist/presentation/ipc/views/catalog.js +9 -0
- package/dist/presentation/ipc/views/catalog.js.map +1 -0
- package/dist/presentation/ipc/views/groups.js +112 -0
- package/dist/presentation/ipc/views/groups.js.map +1 -0
- package/dist/presentation/ipc/views/index.js +10 -0
- package/dist/presentation/ipc/views/index.js.map +1 -0
- package/dist/presentation/ipc/views/observer-history.js +26 -0
- package/dist/presentation/ipc/views/observer-history.js.map +1 -0
- package/dist/presentation/ipc/views/observers.js +16 -0
- package/dist/presentation/ipc/views/observers.js.map +1 -0
- package/dist/presentation/ipc/views/queue.js +151 -0
- package/dist/presentation/ipc/views/queue.js.map +1 -0
- package/dist/presentation/ipc/views/repositories.js +34 -0
- package/dist/presentation/ipc/views/repositories.js.map +1 -0
- package/dist/presentation/ipc/views/rows.js +117 -0
- package/dist/presentation/ipc/views/rows.js.map +1 -0
- package/dist/presentation/ipc/views/run-stages.js +66 -0
- package/dist/presentation/ipc/views/run-stages.js.map +1 -0
- package/dist/presentation/ipc/views/runs.js +201 -0
- package/dist/presentation/ipc/views/runs.js.map +1 -0
- package/dist/presentation/ipc/views/tags.js +19 -0
- package/dist/presentation/ipc/views/tags.js.map +1 -0
- package/dist/presentation/mcp/host-kit.js +67 -0
- package/dist/presentation/mcp/host-kit.js.map +1 -0
- package/dist/presentation/mcp/host-queue-control.js +135 -0
- package/dist/presentation/mcp/host-queue-control.js.map +1 -0
- package/dist/presentation/mcp/host-queue.js +124 -0
- package/dist/presentation/mcp/host-queue.js.map +1 -0
- package/dist/presentation/mcp/host-runs.js +173 -0
- package/dist/presentation/mcp/host-runs.js.map +1 -0
- package/dist/presentation/mcp/host.js +34 -0
- package/dist/presentation/mcp/host.js.map +1 -0
- package/dist/presentation/mcp/index.js +3 -0
- package/dist/presentation/mcp/index.js.map +1 -0
- package/dist/presentation/mcp/tools.js +19 -0
- package/dist/presentation/mcp/tools.js.map +1 -0
- package/dist/presentation/mcp/worker-extra.js +144 -0
- package/dist/presentation/mcp/worker-extra.js.map +1 -0
- package/dist/presentation/mcp/worker-tools.js +107 -0
- package/dist/presentation/mcp/worker-tools.js.map +1 -0
- package/dist/presentation/mcp/worker.js +12 -0
- package/dist/presentation/mcp/worker.js.map +1 -0
- package/dist/presentation/web/errors.js +60 -0
- package/dist/presentation/web/errors.js.map +1 -0
- package/dist/presentation/web/http.js +130 -0
- package/dist/presentation/web/http.js.map +1 -0
- package/dist/presentation/web/hub.js +164 -0
- package/dist/presentation/web/hub.js.map +1 -0
- package/dist/presentation/web/index.js +7 -0
- package/dist/presentation/web/index.js.map +1 -0
- package/dist/presentation/web/options.js +7 -0
- package/dist/presentation/web/options.js.map +1 -0
- package/dist/presentation/web/pages.js +44 -0
- package/dist/presentation/web/pages.js.map +1 -0
- package/dist/presentation/web/panel/daemon-panel.js +207 -0
- package/dist/presentation/web/panel/daemon-panel.js.map +1 -0
- package/dist/presentation/web/panel/default-repository.js +14 -0
- package/dist/presentation/web/panel/default-repository.js.map +1 -0
- package/dist/presentation/web/panel/directories.js +48 -0
- package/dist/presentation/web/panel/directories.js.map +1 -0
- package/dist/presentation/web/panel/open.js +12 -0
- package/dist/presentation/web/panel/open.js.map +1 -0
- package/dist/presentation/web/panel/standby.js +119 -0
- package/dist/presentation/web/panel/standby.js.map +1 -0
- package/dist/presentation/web/panel/state.js +69 -0
- package/dist/presentation/web/panel/state.js.map +1 -0
- package/dist/presentation/web/panel/system.js +66 -0
- package/dist/presentation/web/panel/system.js.map +1 -0
- package/dist/presentation/web/request.js +123 -0
- package/dist/presentation/web/request.js.map +1 -0
- package/dist/presentation/web/routes/config.js +166 -0
- package/dist/presentation/web/routes/config.js.map +1 -0
- package/dist/presentation/web/routes/directories.js +60 -0
- package/dist/presentation/web/routes/directories.js.map +1 -0
- package/dist/presentation/web/routes/downloads.js +65 -0
- package/dist/presentation/web/routes/downloads.js.map +1 -0
- package/dist/presentation/web/routes/groups.js +85 -0
- package/dist/presentation/web/routes/groups.js.map +1 -0
- package/dist/presentation/web/routes/observers/history.js +19 -0
- package/dist/presentation/web/routes/observers/history.js.map +1 -0
- package/dist/presentation/web/routes/processes.js +21 -0
- package/dist/presentation/web/routes/processes.js.map +1 -0
- package/dist/presentation/web/routes/queue.js +80 -0
- package/dist/presentation/web/routes/queue.js.map +1 -0
- package/dist/presentation/web/routes/repositories.js +66 -0
- package/dist/presentation/web/routes/repositories.js.map +1 -0
- package/dist/presentation/web/routes/runs.js +76 -0
- package/dist/presentation/web/routes/runs.js.map +1 -0
- package/dist/presentation/web/routes/settings.js +74 -0
- package/dist/presentation/web/routes/settings.js.map +1 -0
- package/dist/presentation/web/routes/specialists.js +74 -0
- package/dist/presentation/web/routes/specialists.js.map +1 -0
- package/dist/presentation/web/routes/system.js +96 -0
- package/dist/presentation/web/routes/system.js.map +1 -0
- package/dist/presentation/web/routes/tags.js +46 -0
- package/dist/presentation/web/routes/tags.js.map +1 -0
- package/dist/presentation/web/routes/types.js +2 -0
- package/dist/presentation/web/routes/types.js.map +1 -0
- package/dist/presentation/web/server.js +185 -0
- package/dist/presentation/web/server.js.map +1 -0
- package/dist/protocol/autostart.js +171 -0
- package/dist/protocol/autostart.js.map +1 -0
- package/dist/protocol/build.js +38 -0
- package/dist/protocol/build.js.map +1 -0
- package/dist/protocol/catalog.js +18 -0
- package/dist/protocol/catalog.js.map +1 -0
- package/dist/protocol/client.js +83 -0
- package/dist/protocol/client.js.map +1 -0
- package/dist/protocol/format.js +477 -0
- package/dist/protocol/format.js.map +1 -0
- package/dist/protocol/index.js +11 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/messages.js +598 -0
- package/dist/protocol/messages.js.map +1 -0
- package/dist/protocol/style.js +81 -0
- package/dist/protocol/style.js.map +1 -0
- package/dist/protocol/transcript.js +49 -0
- package/dist/protocol/transcript.js.map +1 -0
- package/dist/protocol/views.js +696 -0
- package/dist/protocol/views.js.map +1 -0
- package/dist/runtime/catalog.js +117 -0
- package/dist/runtime/catalog.js.map +1 -0
- package/dist/runtime/claude.js +399 -0
- package/dist/runtime/claude.js.map +1 -0
- package/dist/runtime/index.js +34 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/message.js +48 -0
- package/dist/runtime/message.js.map +1 -0
- package/dist/runtime/naming.js +69 -0
- package/dist/runtime/naming.js.map +1 -0
- package/dist/runtime/opencode.js +189 -0
- package/dist/runtime/opencode.js.map +1 -0
- package/dist/runtime/skills.js +17 -0
- package/dist/runtime/skills.js.map +1 -0
- package/dist/runtime/transcript.js +227 -0
- package/dist/runtime/transcript.js.map +1 -0
- package/dist/runtime/types.js +12 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/which.js +21 -0
- package/dist/runtime/which.js.map +1 -0
- package/dist/store/index.js +3 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/schema.js +286 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/store.js +491 -0
- package/dist/store/store.js.map +1 -0
- package/dist/web/assets/EntryList-CnfGgjEY.js +1 -0
- package/dist/web/assets/FilePath-C0X8-keS.js +1 -0
- package/dist/web/assets/SettingsForm-BcyBWJbn.js +1 -0
- package/dist/web/assets/SharedPipelinesGroup-a368-IQ0.js +1 -0
- package/dist/web/assets/card-DkikoTxR.js +1 -0
- package/dist/web/assets/deliveryModes-funlvXVC.js +1 -0
- package/dist/web/assets/index-B-oJ93zH.js +22 -0
- package/dist/web/assets/index-BZE36gYR.css +2 -0
- package/dist/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/web/assets/locales-DtRrxYzg.js +1 -0
- package/dist/web/assets/pipelines-D48ggDNe.js +1 -0
- package/dist/web/assets/queue-D8_RY4IY.js +16 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/select-J4oIrmYh.js +1 -0
- package/dist/web/assets/settings-B0-0Vaia.js +2 -0
- package/dist/web/assets/skeleton-CCKCQF5n.js +1 -0
- package/dist/web/assets/specialists-DH8tyluO.js +1 -0
- package/dist/web/assets/switch-CWFAgxG1.js +41 -0
- package/dist/web/assets/topology-CNQ28AB2.js +7 -0
- package/dist/web/assets/topology-DLioOiRN.css +1 -0
- package/dist/web/assets/vendor-markdown-DwXfjc7L.js +32 -0
- package/dist/web/assets/vendor-react-C1iE8mnY.js +9 -0
- package/dist/web/index.html +21 -0
- package/integrations/claude-code/.claude-plugin/plugin.json +19 -0
- package/integrations/claude-code/commands/apply.md +6 -0
- package/integrations/claude-code/commands/panel.md +6 -0
- package/integrations/claude-code/commands/run.md +6 -0
- package/integrations/claude-code/commands/status.md +6 -0
- package/integrations/claude-code/commands/web.md +6 -0
- package/integrations/claude-code/hooks/aip.ts +365 -0
- package/integrations/claude-code/hooks/feed.ts +923 -0
- package/integrations/claude-code/hooks/hooks.json +1 -0
- package/integrations/claude-code/hooks/pane.ts +396 -0
- package/integrations/claude-code/hooks/register.tsx +156 -0
- package/integrations/claude-code/hooks/theme.ts +59 -0
- package/integrations/claude-code/hooks/transcript.tsx +44 -0
- package/integrations/claude-code/hooks/view.tsx +378 -0
- package/integrations/claude-code/hooks/web.ts +162 -0
- package/integrations/claude-code/tsconfig.json +18 -0
- package/integrations/claude-code/types/index.d.ts +89 -0
- package/package.json +70 -4
- package/templates/aip/pipelines/feature.yaml +4 -0
- package/templates/aip/settings.yaml +10 -0
- package/templates/aip/specialists/coder.yaml +4 -0
- package/templates/aip/specialists/reviewer.yaml +5 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { currentBuild } from '../../../platform/build/index.js';
|
|
3
|
+
import { pingDaemon } from '../../ipc/client/index.js';
|
|
4
|
+
import { panel } from '../errors.js';
|
|
5
|
+
import { json, parseBody, readJson } from '../http.js';
|
|
6
|
+
import { systemView } from '../panel/system.js';
|
|
7
|
+
const SYSTEM_ACTIONS = {
|
|
8
|
+
'/api/system/web/restart': 'web_restart',
|
|
9
|
+
'/api/system/daemon/restart': 'daemon_restart',
|
|
10
|
+
'/api/system/daemon/stop': 'daemon_stop',
|
|
11
|
+
'/api/system/daemon/start': 'daemon_start',
|
|
12
|
+
};
|
|
13
|
+
const forceBody = z.object({ force: z.boolean().optional() });
|
|
14
|
+
/** Runs `action` once the response is on its way: the restart closes this very server. */
|
|
15
|
+
function afterResponse(kit, response, label, action) {
|
|
16
|
+
response.once('finish', () => {
|
|
17
|
+
setImmediate(() => {
|
|
18
|
+
action().catch((error) => {
|
|
19
|
+
kit.options.log?.(`aip web: ${label} failed: ${error.message}`);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async function showSystem(kit, response) {
|
|
25
|
+
const hooks = kit.options.system;
|
|
26
|
+
const ping = await pingDaemon(kit.options.socket).catch(() => null);
|
|
27
|
+
const check = ping === null ? null : await kit.ensureDaemon().catch(() => null);
|
|
28
|
+
json(response, 200, systemView({
|
|
29
|
+
ping,
|
|
30
|
+
check,
|
|
31
|
+
panelBuild: currentBuild(),
|
|
32
|
+
servedBy: hooks === undefined ? 'standalone' : (hooks.servedBy ?? 'daemon'),
|
|
33
|
+
panel: {
|
|
34
|
+
pid: process.pid,
|
|
35
|
+
host: kit.host,
|
|
36
|
+
port: kit.port(),
|
|
37
|
+
auth: kit.open ? 'none' : 'token',
|
|
38
|
+
},
|
|
39
|
+
logPath: hooks?.logPath ?? null,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
function hookOf(kit, action) {
|
|
43
|
+
const hooks = kit.options.system;
|
|
44
|
+
if (hooks === undefined) {
|
|
45
|
+
throw panel('conflict', 'this panel was started by `aip web`: control the daemon in the terminal', 'web_standalone');
|
|
46
|
+
}
|
|
47
|
+
const hook = action === 'web_restart'
|
|
48
|
+
? hooks.restartWeb
|
|
49
|
+
: action === 'daemon_restart'
|
|
50
|
+
? hooks.restartDaemon
|
|
51
|
+
: action === 'daemon_stop'
|
|
52
|
+
? hooks.stopDaemon
|
|
53
|
+
: hooks.startDaemon;
|
|
54
|
+
if (hook === undefined) {
|
|
55
|
+
if (action === 'daemon_start')
|
|
56
|
+
throw panel('conflict', 'the daemon is already running', 'daemon_running');
|
|
57
|
+
throw panel('conflict', 'the daemon is stopped: start it first', 'daemon_stopped');
|
|
58
|
+
}
|
|
59
|
+
return hook;
|
|
60
|
+
}
|
|
61
|
+
async function refuseWhileBusy(kit, action) {
|
|
62
|
+
const ping = await pingDaemon(kit.options.socket).catch(() => null);
|
|
63
|
+
if (ping?.busy === true)
|
|
64
|
+
throw panel('conflict', `agents are running: ${action === 'daemon_stop' ? 'stop' : 'restart'} anyway to stop them`, 'daemon_busy');
|
|
65
|
+
}
|
|
66
|
+
const STATES = { daemon_stop: 'stopping', daemon_start: 'starting' };
|
|
67
|
+
async function runAction(kit, incoming, response, action) {
|
|
68
|
+
const body = parseBody(action === 'web_restart' ? z.object({}) : forceBody, await readJson(incoming));
|
|
69
|
+
const force = body.force === true;
|
|
70
|
+
const hook = hookOf(kit, action);
|
|
71
|
+
if ((action === 'daemon_restart' || action === 'daemon_stop') && !force) {
|
|
72
|
+
await refuseWhileBusy(kit, action);
|
|
73
|
+
}
|
|
74
|
+
afterResponse(kit, response, action.replace('_', ' '), () => hook(force));
|
|
75
|
+
json(response, 202, { state: STATES[action] ?? 'restarting' });
|
|
76
|
+
}
|
|
77
|
+
/** `/api/system` and the restart and stop actions under `/api/system/`. */
|
|
78
|
+
export function systemRoute(kit) {
|
|
79
|
+
return {
|
|
80
|
+
pattern: /^\/api\/system(\/.*)?$/,
|
|
81
|
+
async handle({ incoming, response, url, verb }) {
|
|
82
|
+
if (url.pathname === '/api/system') {
|
|
83
|
+
if (verb !== 'GET')
|
|
84
|
+
throw panel('method_not_allowed', 'method not allowed');
|
|
85
|
+
return showSystem(kit, response);
|
|
86
|
+
}
|
|
87
|
+
const action = SYSTEM_ACTIONS[url.pathname];
|
|
88
|
+
if (action === undefined)
|
|
89
|
+
throw panel('not_found', 'not found');
|
|
90
|
+
if (verb !== 'POST')
|
|
91
|
+
throw panel('method_not_allowed', 'method not allowed');
|
|
92
|
+
return runAction(kit, incoming, response, action);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../../src/presentation/web/routes/system.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD,MAAM,cAAc,GAA6C;IAC/D,yBAAyB,EAAE,aAAa;IACxC,4BAA4B,EAAE,gBAAgB;IAC9C,yBAAyB,EAAE,aAAa;IACxC,0BAA0B,EAAE,cAAc;CAC3C,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE9D,0FAA0F;AAC1F,S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C,CAAC;gBAC5E,OAAO,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACnC,CAAC;YACD,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAM,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAChE,IAAI,IAAI,KAAK,MAAM;gBAAE,MAAM,KAAK,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;YAC7E,OAAO,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { parseBody } from '../http.js';
|
|
3
|
+
import { segment } from './types.js';
|
|
4
|
+
const tagName = z.string().trim().min(1);
|
|
5
|
+
const tagAddBody = z.object({ name: tagName, color: z.string().optional() });
|
|
6
|
+
const tagEditBody = z
|
|
7
|
+
.object({ tag: tagName, name: tagName.optional(), color: z.string().optional() })
|
|
8
|
+
.refine((body) => body.name !== undefined || body.color !== undefined, {
|
|
9
|
+
message: 'pass a new name or a new color',
|
|
10
|
+
});
|
|
11
|
+
const tagRemoveBody = z.object({ tag: tagName });
|
|
12
|
+
const runTagsBody = z
|
|
13
|
+
.object({ add: z.array(tagName).max(20).optional(), remove: z.array(tagName).max(20).optional() })
|
|
14
|
+
.refine((body) => (body.add?.length ?? 0) + (body.remove?.length ?? 0) > 0, {
|
|
15
|
+
message: 'pass tags to add or remove',
|
|
16
|
+
});
|
|
17
|
+
export function tagsRoutes({ call }) {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
method: 'GET',
|
|
21
|
+
pattern: /^\/api\/tags$/,
|
|
22
|
+
handle: (_match, _body, repository) => call('tags', { repository }),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
method: 'POST',
|
|
26
|
+
pattern: /^\/api\/tags$/,
|
|
27
|
+
handle: async (_, body, repository) => call('tag_add', { repository, ...parseBody(tagAddBody, body) }),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
method: 'POST',
|
|
31
|
+
pattern: /^\/api\/tags\/edit$/,
|
|
32
|
+
handle: async (_, body, repository) => call('tag_edit', { repository, ...parseBody(tagEditBody, body) }),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
method: 'POST',
|
|
36
|
+
pattern: /^\/api\/tags\/remove$/,
|
|
37
|
+
handle: async (_, body, repository) => call('tag_remove', { repository, ...parseBody(tagRemoveBody, body) }),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
method: 'POST',
|
|
41
|
+
pattern: new RegExp(`^/api/runs/${segment}/tags$`),
|
|
42
|
+
handle: async ([runId], body) => call('run_tags', { runId: runId ?? '', ...parseBody(runTagsBody, body) }),
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../src/presentation/web/routes/tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAA6B,MAAM,YAAY,CAAC;AAEhE,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEzC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE7E,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC,EAAE,GAAG,EAAE,OA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CACpC,IAAI,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;SAClE;QACD;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,qBAAqB;YAC9B,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CACpC,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;SACpE;QACD;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,uBAAuB;YAChC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CACpC,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC;SACxE;QACD;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,IAAI,MAAM,CAAC,cAAc,OAAO,QAAQ,CAAC;YAClD,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,CAC9B,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,EAAE,GAAG,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;SAC5E;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/presentation/web/routes/types.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { createServer } from 'node:http';
|
|
3
|
+
import { normalize } from 'node:path';
|
|
4
|
+
import { checkDaemon, request } from '../ipc/client/index.js';
|
|
5
|
+
import { TOKEN_HINT, configError, panel, renderPanelError } from './errors.js';
|
|
6
|
+
import { Hub } from './hub.js';
|
|
7
|
+
import { cookieToken, decodeParts, hostAllowed, json, parseBody, Reply, sameToken, } from './http.js';
|
|
8
|
+
import { DEFAULT_ASSETS } from './options.js';
|
|
9
|
+
import { serveAsset, servePage } from './pages.js';
|
|
10
|
+
import { requestBody, requestRepository } from './request.js';
|
|
11
|
+
import { configRoutes } from './routes/config.js';
|
|
12
|
+
import { artifactRoute, patchRoute } from './routes/downloads.js';
|
|
13
|
+
import { groupsRoutes } from './routes/groups.js';
|
|
14
|
+
import { processesRoutes } from './routes/processes.js';
|
|
15
|
+
import { queueRoutes } from './routes/queue.js';
|
|
16
|
+
import { directoriesRoute, repositoriesRoute } from './routes/repositories.js';
|
|
17
|
+
import { runsRoutes } from './routes/runs.js';
|
|
18
|
+
import { settingsRoutes } from './routes/settings.js';
|
|
19
|
+
import { observerHistoryRoutes } from './routes/observers/history.js';
|
|
20
|
+
import { specialistsRoutes } from './routes/specialists.js';
|
|
21
|
+
import { systemRoute } from './routes/system.js';
|
|
22
|
+
import { tagsRoutes } from './routes/tags.js';
|
|
23
|
+
export { DEFAULT_ASSETS, RECHECK_MS } from './options.js';
|
|
24
|
+
export function assertLoopbackHost(host) {
|
|
25
|
+
if (!['127.0.0.1', 'localhost', '::1'].includes(host))
|
|
26
|
+
throw configError('the web panel only listens on loopback: use 127.0.0.1, localhost or ::1');
|
|
27
|
+
}
|
|
28
|
+
const TOKEN_PATTERN = /^[A-Za-z0-9_-]{16,128}$/;
|
|
29
|
+
/** The fixed access token from `AIP_WEB_TOKEN`, or undefined when the variable is not set. */
|
|
30
|
+
export function webTokenFromEnv(env) {
|
|
31
|
+
const value = env.AIP_WEB_TOKEN;
|
|
32
|
+
if (value === undefined || value === '')
|
|
33
|
+
return undefined;
|
|
34
|
+
if (!TOKEN_PATTERN.test(value))
|
|
35
|
+
throw configError('AIP_WEB_TOKEN must be 16-128 characters of A-Z, a-z, 0-9, - and _');
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
/** The routes of the panel in the order they are tried: the raw ones, then the JSON table. */
|
|
39
|
+
function routeTable(kit) {
|
|
40
|
+
return {
|
|
41
|
+
raw: [
|
|
42
|
+
repositoriesRoute(kit),
|
|
43
|
+
directoriesRoute(),
|
|
44
|
+
systemRoute(kit),
|
|
45
|
+
patchRoute(kit),
|
|
46
|
+
artifactRoute(kit),
|
|
47
|
+
],
|
|
48
|
+
table: [
|
|
49
|
+
runsRoutes,
|
|
50
|
+
groupsRoutes,
|
|
51
|
+
queueRoutes,
|
|
52
|
+
configRoutes,
|
|
53
|
+
settingsRoutes,
|
|
54
|
+
observerHistoryRoutes,
|
|
55
|
+
specialistsRoutes,
|
|
56
|
+
tagsRoutes,
|
|
57
|
+
processesRoutes,
|
|
58
|
+
].flatMap((routes) => routes(kit)),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** The JSON route that matches the request; a path that matches with another verb is a 405. */
|
|
62
|
+
async function runTable(d, incoming, response, url) {
|
|
63
|
+
const verb = incoming.method ?? 'GET';
|
|
64
|
+
let wrongMethod = false;
|
|
65
|
+
for (const route of d.table) {
|
|
66
|
+
const match = route.pattern.exec(url.pathname);
|
|
67
|
+
if (!match)
|
|
68
|
+
continue;
|
|
69
|
+
if (route.method !== verb) {
|
|
70
|
+
wrongMethod = true;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const parts = decodeParts(match.slice(1));
|
|
74
|
+
const body = await requestBody(incoming, url);
|
|
75
|
+
const repository = await requestRepository(url, d.kit.options);
|
|
76
|
+
const result = await route.handle(parts, body, repository);
|
|
77
|
+
if (result instanceof Reply)
|
|
78
|
+
json(response, result.status, result.value);
|
|
79
|
+
else
|
|
80
|
+
json(response, 200, result);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (wrongMethod)
|
|
84
|
+
throw panel('method_not_allowed', 'method not allowed');
|
|
85
|
+
throw panel('not_found', 'not found');
|
|
86
|
+
}
|
|
87
|
+
async function handleApi(d, incoming, response, url) {
|
|
88
|
+
const verb = incoming.method ?? 'GET';
|
|
89
|
+
if (d.token !== null) {
|
|
90
|
+
const given = incoming.headers['x-aip-token'] ??
|
|
91
|
+
cookieToken(incoming.headers.cookie);
|
|
92
|
+
if (!sameToken(given, d.token))
|
|
93
|
+
throw panel('unauthorized', 'missing or invalid token');
|
|
94
|
+
}
|
|
95
|
+
if (url.pathname === '/api/events') {
|
|
96
|
+
if (verb !== 'GET')
|
|
97
|
+
throw panel('method_not_allowed', 'method not allowed');
|
|
98
|
+
d.hub.attach(incoming, response);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
for (const route of d.raw) {
|
|
102
|
+
const match = route.pattern.exec(url.pathname);
|
|
103
|
+
if (match)
|
|
104
|
+
return route.handle({ incoming, response, url, match, verb });
|
|
105
|
+
}
|
|
106
|
+
return runTable(d, incoming, response, url);
|
|
107
|
+
}
|
|
108
|
+
async function handle(d, port, incoming, response) {
|
|
109
|
+
if (!hostAllowed(incoming, port))
|
|
110
|
+
throw panel('forbidden', 'forbidden host or origin');
|
|
111
|
+
const url = new URL(incoming.url ?? '/', `http://${incoming.headers.host}`);
|
|
112
|
+
const verb = incoming.method ?? 'GET';
|
|
113
|
+
const isPage = url.pathname === '/' || url.pathname === '/index.html';
|
|
114
|
+
const isAsset = url.pathname.startsWith('/assets/');
|
|
115
|
+
if (isPage || isAsset) {
|
|
116
|
+
if (verb !== 'GET')
|
|
117
|
+
throw panel('method_not_allowed', 'method not allowed');
|
|
118
|
+
if (isAsset)
|
|
119
|
+
return serveAsset(response, d.assets, url.pathname);
|
|
120
|
+
const fromQuery = url.searchParams.get('token') ?? undefined;
|
|
121
|
+
return servePage(response, d.assets, d.token, fromQuery, incoming.headers.cookie);
|
|
122
|
+
}
|
|
123
|
+
if (!url.pathname.startsWith('/api/'))
|
|
124
|
+
throw panel('not_found', 'not found');
|
|
125
|
+
return handleApi(d, incoming, response, url);
|
|
126
|
+
}
|
|
127
|
+
export async function startWebServer(options) {
|
|
128
|
+
const open = options.auth === 'none';
|
|
129
|
+
const token = open ? null : (options.token ?? randomBytes(24).toString('base64url'));
|
|
130
|
+
const host = options.host ?? '127.0.0.1';
|
|
131
|
+
assertLoopbackHost(host);
|
|
132
|
+
const ensureDaemon = options.ensureDaemon ?? (() => checkDaemon(options.socket));
|
|
133
|
+
const hub = new Hub(options.socket, ensureDaemon);
|
|
134
|
+
let port = options.port ?? 0;
|
|
135
|
+
const kit = {
|
|
136
|
+
call: (method, params) => request(options.socket, method, params),
|
|
137
|
+
options,
|
|
138
|
+
host,
|
|
139
|
+
port: () => port,
|
|
140
|
+
open,
|
|
141
|
+
ensureDaemon,
|
|
142
|
+
};
|
|
143
|
+
const dispatch = {
|
|
144
|
+
token,
|
|
145
|
+
assets: normalize(options.assets ?? DEFAULT_ASSETS),
|
|
146
|
+
hub,
|
|
147
|
+
kit,
|
|
148
|
+
...routeTable(kit),
|
|
149
|
+
};
|
|
150
|
+
const server = createServer((incoming, response) => {
|
|
151
|
+
handle(dispatch, port, incoming, response).catch((error) => {
|
|
152
|
+
if (response.headersSent) {
|
|
153
|
+
response.end();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const rendered = renderPanelError(error);
|
|
157
|
+
json(response, rendered.status, rendered.body);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
try {
|
|
161
|
+
await new Promise((resolve, reject) => {
|
|
162
|
+
server.once('error', reject);
|
|
163
|
+
server.listen(port, host, () => resolve());
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
hub.stop();
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
port = server.address().port;
|
|
171
|
+
const shown = host.includes(':') ? `[${host}]` : host;
|
|
172
|
+
return {
|
|
173
|
+
server,
|
|
174
|
+
token,
|
|
175
|
+
host,
|
|
176
|
+
port,
|
|
177
|
+
url: `http://${shown}:${port}/${token === null ? '' : `?token=${token}`}`,
|
|
178
|
+
close: () => new Promise((resolve) => {
|
|
179
|
+
hub.stop();
|
|
180
|
+
server.close(() => resolve());
|
|
181
|
+
server.closeAllConnections();
|
|
182
|
+
}),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/presentation/web/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AAEpF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,IAAI,EACJ,SAAS,EACT,KAAK,EACL,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAmC,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE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,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9B,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC/B,CAAC,CAAC;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { mkdirSync, openSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
import { currentBuild } from './build.js';
|
|
5
|
+
import { DaemonUnavailable, request } from './client.js';
|
|
6
|
+
import { pingResultSchema, shutdownIdleResultSchema } from './messages.js';
|
|
7
|
+
import { unavailable } from '../platform/errors/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Makes sure a daemon of the client's build listens at the socket: starts one when none answers,
|
|
10
|
+
* and replaces an older idle daemon. A busy or newer daemon is left running and reported.
|
|
11
|
+
*/
|
|
12
|
+
export async function ensureDaemon(socket, command, options = {}) {
|
|
13
|
+
const client = options.build ?? currentBuild();
|
|
14
|
+
const ping = await pingDaemon(socket);
|
|
15
|
+
if (ping === null) {
|
|
16
|
+
await spawnDaemon(socket, command, options);
|
|
17
|
+
return { started: true, restarted: false, mismatch: null };
|
|
18
|
+
}
|
|
19
|
+
const mismatch = compare(ping, client);
|
|
20
|
+
if (!mismatch)
|
|
21
|
+
return { started: false, restarted: false, mismatch: null };
|
|
22
|
+
// Only a daemon that knows the build check is asked to stop: an older one stops on any
|
|
23
|
+
// shutdown, with its agents.
|
|
24
|
+
if (mismatch.outdated === 'client' || !ping.build)
|
|
25
|
+
return { started: false, restarted: false, mismatch };
|
|
26
|
+
const stopped = await request(socket, 'shutdown_idle', {}, 5000).then((result) => shutdownIdleResultSchema.safeParse(result).data?.stopping ?? false, () => false);
|
|
27
|
+
if (!stopped)
|
|
28
|
+
return { started: false, restarted: false, mismatch: { ...mismatch, busy: true } };
|
|
29
|
+
await waitGone(socket, ping.pid ?? null, options);
|
|
30
|
+
await spawnDaemon(socket, command, options);
|
|
31
|
+
return { started: true, restarted: true, mismatch: null };
|
|
32
|
+
}
|
|
33
|
+
/** Compares the daemon with the client without starting or stopping anything. */
|
|
34
|
+
export async function checkDaemon(socket, build) {
|
|
35
|
+
const ping = await pingDaemon(socket);
|
|
36
|
+
return {
|
|
37
|
+
started: false,
|
|
38
|
+
restarted: false,
|
|
39
|
+
mismatch: ping === null ? null : compare(ping, build ?? currentBuild()),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function compare(ping, client) {
|
|
43
|
+
if (ping.build?.fingerprint === client.fingerprint)
|
|
44
|
+
return null;
|
|
45
|
+
return {
|
|
46
|
+
// A daemon too old to report its build is older than any client that checks it.
|
|
47
|
+
outdated: ping.build && ping.build.builtAt >= client.builtAt ? 'client' : 'daemon',
|
|
48
|
+
pid: ping.pid ?? null,
|
|
49
|
+
daemon: ping.build ?? null,
|
|
50
|
+
client,
|
|
51
|
+
busy: ping.busy ?? false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** One line for the user about a daemon of another build, or null when the builds match. */
|
|
55
|
+
export function daemonMismatchMessage(check, client) {
|
|
56
|
+
const mismatch = check.mismatch;
|
|
57
|
+
if (!mismatch)
|
|
58
|
+
return null;
|
|
59
|
+
const pid = mismatch.pid === null ? '' : ` (pid ${mismatch.pid})`;
|
|
60
|
+
const daemon = mismatch.daemon
|
|
61
|
+
? `${mismatch.daemon.version}, build ${mismatch.daemon.fingerprint}`
|
|
62
|
+
: 'a build without the version check';
|
|
63
|
+
const own = `${mismatch.client.version}, build ${mismatch.client.fingerprint}`;
|
|
64
|
+
if (mismatch.outdated === 'client') {
|
|
65
|
+
return `the aip daemon${pid} runs a newer build (${daemon}) than this ${client} (${own}); restart ${client}`;
|
|
66
|
+
}
|
|
67
|
+
const restart = '`aip daemon restart --force`';
|
|
68
|
+
const older = `the aip daemon${pid} runs an older build (${daemon}) than this ${client} (${own})`;
|
|
69
|
+
if (!mismatch.daemon)
|
|
70
|
+
return `${older}; it cannot be restarted automatically: run ${restart} (running agents are stopped)`;
|
|
71
|
+
return `${older}; the next aip command restarts it once its agents finish, or run ${restart} now (running agents are stopped)`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Stops the daemon at the socket and waits until it is gone. Without `force` only an idle
|
|
75
|
+
* daemon stops (a daemon too old to know `shutdown_idle` counts as busy).
|
|
76
|
+
*/
|
|
77
|
+
export async function stopDaemon(socket, options = {}) {
|
|
78
|
+
const ping = await pingDaemon(socket);
|
|
79
|
+
if (ping === null)
|
|
80
|
+
return { state: 'not_running' };
|
|
81
|
+
const pid = ping.pid ?? null;
|
|
82
|
+
if (options.force) {
|
|
83
|
+
await request(socket, 'shutdown', {}, 5000).catch(() => undefined);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const stopping = ping.build
|
|
87
|
+
? await request(socket, 'shutdown_idle', {}, 5000).then((result) => shutdownIdleResultSchema.safeParse(result).data?.stopping ?? false, () => false)
|
|
88
|
+
: false;
|
|
89
|
+
if (!stopping)
|
|
90
|
+
return { state: 'busy', pid };
|
|
91
|
+
}
|
|
92
|
+
await waitGone(socket, pid, options);
|
|
93
|
+
return { state: 'stopped', pid };
|
|
94
|
+
}
|
|
95
|
+
/** The answer of the daemon to `ping`, or null when no daemon listens at the socket. */
|
|
96
|
+
export async function pingDaemon(socket) {
|
|
97
|
+
try {
|
|
98
|
+
const result = pingResultSchema.safeParse(await request(socket, 'ping', {}, 2000));
|
|
99
|
+
return result.success ? result.data : { pong: true };
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (error instanceof DaemonUnavailable)
|
|
103
|
+
return null;
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export async function spawnDaemon(socket, command, options) {
|
|
108
|
+
const [executable, ...args] = command;
|
|
109
|
+
if (!executable)
|
|
110
|
+
throw unavailable('daemon.autostart', 'no command to start the aip daemon');
|
|
111
|
+
let output = 'ignore';
|
|
112
|
+
if (options.logPath) {
|
|
113
|
+
mkdirSync(dirname(options.logPath), { recursive: true, mode: 0o700 });
|
|
114
|
+
output = openSync(options.logPath, 'a');
|
|
115
|
+
}
|
|
116
|
+
const child = spawn(executable, [...args, 'daemon'], {
|
|
117
|
+
detached: true,
|
|
118
|
+
stdio: ['ignore', output, output],
|
|
119
|
+
env: options.environment,
|
|
120
|
+
});
|
|
121
|
+
child.unref();
|
|
122
|
+
const deadline = Date.now() + (options.timeoutMs ?? 5000);
|
|
123
|
+
while (Date.now() < deadline) {
|
|
124
|
+
await sleep(POLL_MS);
|
|
125
|
+
if ((await pingDaemon(socket)) !== null)
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
throw unavailable('daemon.autostart', `aip daemon did not start within ${options.timeoutMs ?? 5000} ms${options.logPath ? `; see ${options.logPath}` : ''}`);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Waits until the stopped daemon has released its lock (or exited): a new daemon started before
|
|
132
|
+
* that refuses to run, and the old one would remove its socket on the way out.
|
|
133
|
+
*/
|
|
134
|
+
async function waitGone(socket, pid, options) {
|
|
135
|
+
const deadline = Date.now() + 15_000;
|
|
136
|
+
while (Date.now() < deadline) {
|
|
137
|
+
// A daemon that is shutting down may stop answering before it exits.
|
|
138
|
+
const unreachable = (await pingDaemon(socket).catch(() => undefined)) === null;
|
|
139
|
+
if (unreachable && (pid === null || !holdsLock(pid, options.lockPath)))
|
|
140
|
+
return;
|
|
141
|
+
await sleep(POLL_MS);
|
|
142
|
+
}
|
|
143
|
+
throw unavailable('daemon.autostart', `the old aip daemon${pid === null ? '' : ` (pid ${pid})`} did not stop in time`);
|
|
144
|
+
}
|
|
145
|
+
function holdsLock(pid, lockPath) {
|
|
146
|
+
if (!alive(pid))
|
|
147
|
+
return false;
|
|
148
|
+
if (!lockPath)
|
|
149
|
+
return true;
|
|
150
|
+
try {
|
|
151
|
+
return readFileSync(lockPath, 'utf8').trim() === String(pid);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function alive(pid) {
|
|
158
|
+
try {
|
|
159
|
+
process.kill(pid, 0);
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
return error.code === 'EPERM';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/** How often the client checks a daemon it starts or stops: the socket is cheap to ping. */
|
|
167
|
+
const POLL_MS = 25;
|
|
168
|
+
function sleep(ms) {
|
|
169
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=autostart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autostart.js","sourceRoot":"","sources":["../../src/protocol/autostart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAmB,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AA6B1D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,OAAiB,EACjB,OAAO,GAAkB,EAAE;IAE3B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,EAAE,CAAC;IAC/C,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,WAAW,CAAC,MAAM,EAA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@@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { join, relative } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
/** Hashes a code tree: the relative path and the contents of every file, in a stable order. */
|
|
8
|
+
export function fingerprintTree(root) {
|
|
9
|
+
const hash = createHash('sha256');
|
|
10
|
+
let builtAt = 0;
|
|
11
|
+
const visit = (directory) => {
|
|
12
|
+
const entries = readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
13
|
+
for (const entry of entries) {
|
|
14
|
+
const path = join(directory, entry.name);
|
|
15
|
+
if (entry.isDirectory())
|
|
16
|
+
visit(path);
|
|
17
|
+
else if (entry.isFile()) {
|
|
18
|
+
hash.update(relative(root, path)).update('\0').update(readFileSync(path)).update('\0');
|
|
19
|
+
builtAt = Math.max(builtAt, statSync(path).mtimeMs);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
visit(root);
|
|
24
|
+
return { fingerprint: hash.digest('hex').slice(0, 16), builtAt: Math.floor(builtAt) };
|
|
25
|
+
}
|
|
26
|
+
let current;
|
|
27
|
+
/**
|
|
28
|
+
* Build of this process, computed once on first use: a daemon keeps the build it started with
|
|
29
|
+
* even when the files are rebuilt under it.
|
|
30
|
+
*/
|
|
31
|
+
export function currentBuild() {
|
|
32
|
+
current ??= {
|
|
33
|
+
version: require('../../package.json').version,
|
|
34
|
+
...fingerprintTree(fileURLToPath(new URL('..', import.meta.url))),
|
|
35
|
+
};
|
|
36
|
+
return current;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/protocol/build.ts"],"names":[],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M,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACvF,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,CAAC;IACZ,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,IAAI,OAA8B,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,KAAK;QACV,OAAO,EAAG,OAAO,CAAC,oBAAoB,CAAyB,CAAC,OAAO;QACvE,GAAG,eAAe,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KAClE,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const catalogEntrySchema = z.object({
|
|
3
|
+
name: z.string(),
|
|
4
|
+
source: z.enum(['builtin', 'project', 'global']),
|
|
5
|
+
file: z.string().optional(),
|
|
6
|
+
description: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
export const runtimeCatalogSchema = z.object({
|
|
9
|
+
tools: z.array(catalogEntrySchema),
|
|
10
|
+
skills: z.array(catalogEntrySchema),
|
|
11
|
+
});
|
|
12
|
+
export const configCatalogResponseSchema = z.object({
|
|
13
|
+
repository: z.string(),
|
|
14
|
+
/** `claude.mcp: inherit` — the MCP servers of the user are available to specialists. */
|
|
15
|
+
mcpInherited: z.boolean(),
|
|
16
|
+
runtimes: z.object({ claude: runtimeCatalogSchema, opencode: runtimeCatalogSchema }),
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/protocol/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CACpC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,wFAAwF;IACxF,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;CACrF,CAAC,CAAC"}
|