@hoknie/aip 0.1.0 → 0.2.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/agents.js +2 -0
- package/dist/app/agents.js.map +1 -1
- package/dist/app/application.js +34 -2
- package/dist/app/application.js.map +1 -1
- package/dist/app/lifecycle.js +5 -1
- package/dist/app/lifecycle.js.map +1 -1
- package/dist/app/timings.js +1 -0
- package/dist/app/timings.js.map +1 -1
- package/dist/app/wiring.js +1 -0
- package/dist/app/wiring.js.map +1 -1
- package/dist/cli/main.js +0 -0
- package/dist/feature/agents/clients/agy/runtime.js +1 -0
- package/dist/feature/agents/clients/agy/runtime.js.map +1 -1
- package/dist/feature/agents/clients/claude/index.js +1 -0
- package/dist/feature/agents/clients/claude/index.js.map +1 -1
- package/dist/feature/agents/clients/claude/models.js +8 -0
- package/dist/feature/agents/clients/claude/models.js.map +1 -0
- package/dist/feature/agents/clients/claude/parser.js +8 -0
- package/dist/feature/agents/clients/claude/parser.js.map +1 -1
- package/dist/feature/agents/clients/claude/runtime.js +2 -0
- package/dist/feature/agents/clients/claude/runtime.js.map +1 -1
- package/dist/feature/agents/clients/opencode/index.js +1 -0
- package/dist/feature/agents/clients/opencode/index.js.map +1 -1
- package/dist/feature/agents/clients/opencode/models.js +38 -0
- package/dist/feature/agents/clients/opencode/models.js.map +1 -0
- package/dist/feature/agents/clients/opencode/runtime.js +2 -0
- package/dist/feature/agents/clients/opencode/runtime.js.map +1 -1
- package/dist/feature/agents/ports/command.js +2 -0
- package/dist/feature/agents/ports/command.js.map +1 -0
- package/dist/feature/agents/services/agents.js +42 -1
- package/dist/feature/agents/services/agents.js.map +1 -1
- package/dist/feature/agents/services/catalog.js +1 -1
- package/dist/feature/agents/services/catalog.js.map +1 -1
- package/dist/feature/agents/types/index.js +1 -0
- package/dist/feature/agents/types/index.js.map +1 -1
- package/dist/feature/agents/types/message.js +1 -0
- package/dist/feature/agents/types/message.js.map +1 -1
- package/dist/feature/agents/types/models.js +2 -0
- package/dist/feature/agents/types/models.js.map +1 -0
- package/dist/feature/agents/types/runtime.js.map +1 -1
- package/dist/feature/agents/types/worker-tools.js +2 -0
- package/dist/feature/agents/types/worker-tools.js.map +1 -1
- package/dist/feature/network/ports/changed.js +2 -0
- package/dist/feature/network/ports/changed.js.map +1 -0
- package/dist/feature/network/ports/index.js +2 -0
- package/dist/feature/network/ports/index.js.map +1 -0
- package/dist/feature/network/services/create.js +5 -0
- package/dist/feature/network/services/create.js.map +1 -0
- package/dist/feature/network/services/index.js +3 -0
- package/dist/feature/network/services/index.js.map +1 -0
- package/dist/feature/network/services/monitor.js +140 -0
- package/dist/feature/network/services/monitor.js.map +1 -0
- package/dist/feature/network/types/index.js +4 -0
- package/dist/feature/network/types/index.js.map +1 -0
- package/dist/feature/network/types/network.js +8 -0
- package/dist/feature/network/types/network.js.map +1 -0
- package/dist/feature/network/types/proxy.js +95 -0
- package/dist/feature/network/types/proxy.js.map +1 -0
- package/dist/feature/network/types/state.js +36 -0
- package/dist/feature/network/types/state.js.map +1 -0
- package/dist/feature/observers/repositories/observers.js +7 -1
- package/dist/feature/observers/repositories/observers.js.map +1 -1
- package/dist/feature/observers/services/observers.js +14 -4
- package/dist/feature/observers/services/observers.js.map +1 -1
- package/dist/feature/observers/services/settings-check.js +1 -7
- package/dist/feature/observers/services/settings-check.js.map +1 -1
- package/dist/feature/observers/types/plan-repairs.js +14 -7
- package/dist/feature/observers/types/plan-repairs.js.map +1 -1
- package/dist/feature/observers/types/settings.js +0 -1
- package/dist/feature/observers/types/settings.js.map +1 -1
- package/dist/feature/queue/services/control.js +23 -7
- package/dist/feature/queue/services/control.js.map +1 -1
- package/dist/feature/queue/types/advance.js +26 -11
- package/dist/feature/queue/types/advance.js.map +1 -1
- package/dist/feature/queue/types/returns.js +18 -3
- package/dist/feature/queue/types/returns.js.map +1 -1
- package/dist/feature/runs/machine/exits.js +23 -1
- package/dist/feature/runs/machine/exits.js.map +1 -1
- package/dist/feature/runs/machine/plan.js +38 -16
- package/dist/feature/runs/machine/plan.js.map +1 -1
- package/dist/feature/runs/machine/repair.js +5 -2
- package/dist/feature/runs/machine/repair.js.map +1 -1
- package/dist/feature/runs/machine/scheduler.js +10 -3
- package/dist/feature/runs/machine/scheduler.js.map +1 -1
- package/dist/feature/runs/machine/steps.js +7 -7
- package/dist/feature/runs/machine/steps.js.map +1 -1
- package/dist/feature/runs/machine/transition.js +5 -1
- package/dist/feature/runs/machine/transition.js.map +1 -1
- package/dist/feature/runs/repositories/finished-runs.js +14 -10
- package/dist/feature/runs/repositories/finished-runs.js.map +1 -1
- package/dist/feature/runs/services/create.js +1 -0
- package/dist/feature/runs/services/create.js.map +1 -1
- package/dist/feature/runs/services/effects/actions.js +3 -2
- package/dist/feature/runs/services/effects/actions.js.map +1 -1
- package/dist/feature/runs/services/effects/attempts.js +44 -4
- 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/naming.js +4 -1
- package/dist/feature/runs/services/effects/naming.js.map +1 -1
- package/dist/feature/runs/services/effects/proxy.js +5 -0
- package/dist/feature/runs/services/effects/proxy.js.map +1 -0
- package/dist/feature/runs/services/engine.js +14 -5
- package/dist/feature/runs/services/engine.js.map +1 -1
- package/dist/feature/runs/services/index.js.map +1 -1
- package/dist/feature/runs/services/reads.js +40 -1
- package/dist/feature/runs/services/reads.js.map +1 -1
- package/dist/feature/runs/services/states.js +2 -2
- package/dist/feature/runs/services/states.js.map +1 -1
- package/dist/feature/runs/types/attempt.js +4 -0
- package/dist/feature/runs/types/attempt.js.map +1 -1
- package/dist/feature/runs/types/group.js.map +1 -1
- package/dist/feature/runs/types/input.js +33 -0
- package/dist/feature/runs/types/input.js.map +1 -1
- package/dist/feature/runs/types/limits.js +13 -1
- package/dist/feature/runs/types/limits.js.map +1 -1
- package/dist/feature/stats/repositories/index.js +4 -0
- package/dist/feature/stats/repositories/index.js.map +1 -0
- package/dist/feature/stats/repositories/meta.js +19 -0
- package/dist/feature/stats/repositories/meta.js.map +1 -0
- package/dist/feature/stats/repositories/records.js +46 -0
- package/dist/feature/stats/repositories/records.js.map +1 -0
- package/dist/feature/stats/repositories/report.js +105 -0
- package/dist/feature/stats/repositories/report.js.map +1 -0
- package/dist/feature/stats/services/create.js +44 -0
- package/dist/feature/stats/services/create.js.map +1 -0
- package/dist/feature/stats/services/index.js +4 -0
- package/dist/feature/stats/services/index.js.map +1 -0
- package/dist/feature/stats/services/ledger.js +137 -0
- package/dist/feature/stats/services/ledger.js.map +1 -0
- package/dist/feature/stats/services/report.js +56 -0
- package/dist/feature/stats/services/report.js.map +1 -0
- package/dist/feature/stats/types/aggregate.js +179 -0
- package/dist/feature/stats/types/aggregate.js.map +1 -0
- package/dist/feature/stats/types/capture.js +79 -0
- package/dist/feature/stats/types/capture.js.map +1 -0
- package/dist/feature/stats/types/index.js +6 -0
- package/dist/feature/stats/types/index.js.map +1 -0
- package/dist/feature/stats/types/records.js +5 -0
- package/dist/feature/stats/types/records.js.map +1 -0
- package/dist/feature/stats/types/report.js +25 -0
- package/dist/feature/stats/types/report.js.map +1 -0
- package/dist/feature/stats/types/settings.js +2 -0
- package/dist/feature/stats/types/settings.js.map +1 -0
- package/dist/feature/swarm-config/services/assemble.js +1 -1
- package/dist/feature/swarm-config/services/assemble.js.map +1 -1
- package/dist/feature/swarm-config/services/index.js +3 -2
- package/dist/feature/swarm-config/services/index.js.map +1 -1
- package/dist/feature/swarm-config/services/load.js +17 -2
- package/dist/feature/swarm-config/services/load.js.map +1 -1
- package/dist/feature/swarm-config/services/sections/stats.js +28 -0
- package/dist/feature/swarm-config/services/sections/stats.js.map +1 -0
- package/dist/feature/swarm-config/services/settings.js +23 -1
- package/dist/feature/swarm-config/services/settings.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-actions.js +9 -1
- package/dist/feature/swarm-config/services/validate-actions.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-runtimes.js +3 -1
- package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-settings.js +65 -0
- package/dist/feature/swarm-config/services/validate-settings.js.map +1 -1
- package/dist/feature/swarm-config/services/validate.js +17 -2
- package/dist/feature/swarm-config/services/validate.js.map +1 -1
- package/dist/feature/swarm-config/types/action.js +9 -0
- package/dist/feature/swarm-config/types/action.js.map +1 -1
- package/dist/feature/swarm-config/types/settings.js +35 -5
- package/dist/feature/swarm-config/types/settings.js.map +1 -1
- package/dist/feature/swarm-edit/services/config-edits.js +14 -1
- package/dist/feature/swarm-edit/services/config-edits.js.map +1 -1
- package/dist/feature/swarm-edit/services/editor-settings.js +36 -7
- package/dist/feature/swarm-edit/services/editor-settings.js.map +1 -1
- package/dist/feature/swarm-edit/services/plan-settings.js +3 -1
- package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -1
- package/dist/feature/swarm-edit/types/editor.js.map +1 -1
- package/dist/feature/swarm-edit/types/setting-fields.js +12 -0
- package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -1
- package/dist/platform/git/delivery.js +1 -1
- package/dist/platform/git/delivery.js.map +1 -1
- package/dist/platform/network/index.js +4 -0
- package/dist/platform/network/index.js.map +1 -0
- package/dist/platform/network/interfaces.js +7 -0
- package/dist/platform/network/interfaces.js.map +1 -0
- package/dist/platform/network/probe.js +128 -0
- package/dist/platform/network/probe.js.map +1 -0
- package/dist/platform/network/tunnel.js +87 -0
- package/dist/platform/network/tunnel.js.map +1 -0
- package/dist/platform/process/command.js +23 -0
- package/dist/platform/process/command.js.map +1 -0
- package/dist/platform/process/index.js +1 -0
- package/dist/platform/process/index.js.map +1 -1
- package/dist/platform/sqlite/migrations.js +2 -0
- package/dist/platform/sqlite/migrations.js.map +1 -1
- package/dist/platform/sqlite/stats-migration.js +42 -0
- package/dist/platform/sqlite/stats-migration.js.map +1 -0
- package/dist/presentation/cli/commands/stats.js +41 -0
- package/dist/presentation/cli/commands/stats.js.map +1 -0
- package/dist/presentation/cli/help.js +1 -1
- package/dist/presentation/cli/help.js.map +1 -1
- package/dist/presentation/cli/local/config-check.js +23 -5
- package/dist/presentation/cli/local/config-check.js.map +1 -1
- package/dist/presentation/cli/program.js +2 -0
- package/dist/presentation/cli/program.js.map +1 -1
- package/dist/presentation/format/index.js +1 -0
- package/dist/presentation/format/index.js.map +1 -1
- package/dist/presentation/format/queue.js +1 -1
- package/dist/presentation/format/queue.js.map +1 -1
- package/dist/presentation/format/runs.js +8 -1
- package/dist/presentation/format/runs.js.map +1 -1
- package/dist/presentation/format/stats.js +79 -0
- package/dist/presentation/format/stats.js.map +1 -0
- package/dist/presentation/ipc/contract/agents.js +18 -0
- package/dist/presentation/ipc/contract/agents.js.map +1 -1
- package/dist/presentation/ipc/contract/config.js +4 -0
- package/dist/presentation/ipc/contract/config.js.map +1 -1
- package/dist/presentation/ipc/contract/envelope.js +4 -1
- package/dist/presentation/ipc/contract/envelope.js.map +1 -1
- package/dist/presentation/ipc/contract/groups.js +9 -0
- package/dist/presentation/ipc/contract/groups.js.map +1 -1
- package/dist/presentation/ipc/contract/index.js +1 -0
- package/dist/presentation/ipc/contract/index.js.map +1 -1
- package/dist/presentation/ipc/contract/panel.js +11 -0
- package/dist/presentation/ipc/contract/panel.js.map +1 -1
- package/dist/presentation/ipc/contract/responses/index.js +1 -0
- package/dist/presentation/ipc/contract/responses/index.js.map +1 -1
- package/dist/presentation/ipc/contract/responses/stats.js +67 -0
- package/dist/presentation/ipc/contract/responses/stats.js.map +1 -0
- package/dist/presentation/ipc/contract/runs.js +6 -0
- package/dist/presentation/ipc/contract/runs.js.map +1 -1
- package/dist/presentation/ipc/contract/stats/stats.js +20 -0
- package/dist/presentation/ipc/contract/stats/stats.js.map +1 -0
- package/dist/presentation/ipc/handlers/config.js +1 -0
- package/dist/presentation/ipc/handlers/config.js.map +1 -1
- package/dist/presentation/ipc/handlers/groups.js +8 -0
- package/dist/presentation/ipc/handlers/groups.js.map +1 -1
- package/dist/presentation/ipc/handlers/runs.js +1 -1
- package/dist/presentation/ipc/handlers/runs.js.map +1 -1
- package/dist/presentation/ipc/handlers/stats.js +17 -0
- package/dist/presentation/ipc/handlers/stats.js.map +1 -0
- package/dist/presentation/ipc/handlers/system.js +2 -0
- package/dist/presentation/ipc/handlers/system.js.map +1 -1
- package/dist/presentation/ipc/handlers/table.js +2 -0
- package/dist/presentation/ipc/handlers/table.js.map +1 -1
- package/dist/presentation/ipc/publisher.js +1 -0
- package/dist/presentation/ipc/publisher.js.map +1 -1
- package/dist/presentation/ipc/views/catalog.js +3 -3
- package/dist/presentation/ipc/views/catalog.js.map +1 -1
- package/dist/presentation/ipc/views/index.js +1 -0
- package/dist/presentation/ipc/views/index.js.map +1 -1
- package/dist/presentation/ipc/views/queue.js +5 -1
- package/dist/presentation/ipc/views/queue.js.map +1 -1
- package/dist/presentation/ipc/views/runs.js +1 -1
- package/dist/presentation/ipc/views/runs.js.map +1 -1
- package/dist/presentation/ipc/views/stats.js +5 -0
- package/dist/presentation/ipc/views/stats.js.map +1 -0
- package/dist/presentation/mcp/worker-extra.js +2 -2
- package/dist/presentation/mcp/worker-extra.js.map +1 -1
- package/dist/presentation/mcp/worker-read.js +45 -0
- package/dist/presentation/mcp/worker-read.js.map +1 -0
- package/dist/presentation/mcp/worker.js +2 -0
- package/dist/presentation/mcp/worker.js.map +1 -1
- package/dist/presentation/web/hub.js +4 -0
- package/dist/presentation/web/hub.js.map +1 -1
- package/dist/presentation/web/panel/directories.js +1 -1
- package/dist/presentation/web/panel/directories.js.map +1 -1
- package/dist/presentation/web/panel/system.js +1 -0
- package/dist/presentation/web/panel/system.js.map +1 -1
- package/dist/presentation/web/request.js +28 -1
- package/dist/presentation/web/request.js.map +1 -1
- package/dist/presentation/web/routes/config.js +5 -0
- package/dist/presentation/web/routes/config.js.map +1 -1
- package/dist/presentation/web/routes/runs.js.map +1 -1
- package/dist/presentation/web/routes/stats/stats.js +22 -0
- package/dist/presentation/web/routes/stats/stats.js.map +1 -0
- package/dist/presentation/web/server.js +3 -1
- package/dist/presentation/web/server.js.map +1 -1
- package/dist/web/assets/FilterColumn-BCMp-JO4.js +1 -0
- package/dist/web/assets/SharedPipelinesGroup-DJRGFtzx.js +1 -0
- package/dist/web/assets/badge-C_7kALlW.js +1 -0
- package/dist/web/assets/{card-DkikoTxR.js → card-C9eXOVuF.js} +1 -1
- package/dist/web/assets/empty-ACC2KkXk.js +41 -0
- package/dist/web/assets/index-CsVQUXJH.js +21 -0
- package/dist/web/assets/index-Ds1nt_qm.css +2 -0
- package/dist/web/assets/locales-fB1w2oER.js +1 -0
- package/dist/web/assets/pipelines-DQglwIkL.js +10 -0
- package/dist/web/assets/queue-CAuAo--6.js +16 -0
- package/dist/web/assets/select-BSqaxwh1.js +1 -0
- package/dist/web/assets/settingFields-DVg9TQK2.js +1 -0
- package/dist/web/assets/settings-6eHKYbS7.js +2 -0
- package/dist/web/assets/skeleton-CfLYGtNX.js +1 -0
- package/dist/web/assets/specialists-Durm0DgK.js +1 -0
- package/dist/web/assets/stats-67akPa3A.js +1 -0
- package/dist/web/assets/topology-DQu3su19.js +1 -0
- package/dist/web/assets/trash-ChYI9ms1.js +1 -0
- package/dist/web/assets/useListDrag-0GPS1X83.js +1 -0
- package/dist/web/index.html +7 -6
- package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/dist/cli/clean.js +0 -71
- package/dist/cli/clean.js.map +0 -1
- package/dist/cli/commands.js +0 -963
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/config-check.js +0 -173
- package/dist/cli/config-check.js.map +0 -1
- package/dist/cli/daemon.js +0 -199
- package/dist/cli/daemon.js.map +0 -1
- package/dist/cli/help.js +0 -50
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/init.js +0 -43
- package/dist/cli/init.js.map +0 -1
- package/dist/cli/io.js +0 -13
- package/dist/cli/io.js.map +0 -1
- package/dist/cli/probe.js +0 -12
- package/dist/cli/probe.js.map +0 -1
- package/dist/cli/program.js +0 -48
- package/dist/cli/program.js.map +0 -1
- package/dist/cli/setup.js +0 -406
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/version.js +0 -6
- package/dist/cli/version.js.map +0 -1
- package/dist/cli/watch.js +0 -24
- package/dist/cli/watch.js.map +0 -1
- package/dist/cli/web/daemon-panel.js +0 -185
- package/dist/cli/web/daemon-panel.js.map +0 -1
- package/dist/cli/web/default-repository.js +0 -12
- package/dist/cli/web/default-repository.js.map +0 -1
- package/dist/cli/web/errors.js +0 -60
- package/dist/cli/web/errors.js.map +0 -1
- package/dist/cli/web/open.js +0 -12
- package/dist/cli/web/open.js.map +0 -1
- package/dist/cli/web/page.js +0 -465
- package/dist/cli/web/page.js.map +0 -1
- package/dist/cli/web/server.js +0 -1191
- package/dist/cli/web/server.js.map +0 -1
- package/dist/cli/web/standby.js +0 -119
- package/dist/cli/web/standby.js.map +0 -1
- package/dist/cli/web/state.js +0 -69
- package/dist/cli/web/state.js.map +0 -1
- package/dist/cli/web/system.js +0 -66
- package/dist/cli/web/system.js.map +0 -1
- package/dist/cli/web-control.js +0 -173
- package/dist/cli/web-control.js.map +0 -1
- package/dist/config/discover.js +0 -25
- package/dist/config/discover.js.map +0 -1
- package/dist/config/duration.js +0 -17
- package/dist/config/duration.js.map +0 -1
- package/dist/config/edit.js +0 -966
- package/dist/config/edit.js.map +0 -1
- package/dist/config/errors.js +0 -29
- package/dist/config/errors.js.map +0 -1
- package/dist/config/index.js +0 -14
- package/dist/config/index.js.map +0 -1
- package/dist/config/load.js +0 -412
- package/dist/config/load.js.map +0 -1
- package/dist/config/merge.js +0 -45
- package/dist/config/merge.js.map +0 -1
- package/dist/config/model.js +0 -171
- package/dist/config/model.js.map +0 -1
- package/dist/config/paths.js +0 -31
- package/dist/config/paths.js.map +0 -1
- package/dist/config/prompt.js +0 -33
- package/dist/config/prompt.js.map +0 -1
- package/dist/config/shared-pipelines.js +0 -71
- package/dist/config/shared-pipelines.js.map +0 -1
- package/dist/config/shared-specialists.js +0 -68
- package/dist/config/shared-specialists.js.map +0 -1
- package/dist/config/shared-workflows.js +0 -71
- package/dist/config/shared-workflows.js.map +0 -1
- package/dist/config/specialist-tags.js +0 -214
- package/dist/config/specialist-tags.js.map +0 -1
- package/dist/config/tag-names.js +0 -43
- package/dist/config/tag-names.js.map +0 -1
- package/dist/config/validate.js +0 -872
- package/dist/config/validate.js.map +0 -1
- package/dist/core/artifacts.js +0 -37
- package/dist/core/artifacts.js.map +0 -1
- package/dist/core/create.js +0 -75
- package/dist/core/create.js.map +0 -1
- package/dist/core/delivery.js +0 -366
- package/dist/core/delivery.js.map +0 -1
- package/dist/core/errors.js +0 -7
- package/dist/core/errors.js.map +0 -1
- package/dist/core/ids.js +0 -99
- package/dist/core/ids.js.map +0 -1
- package/dist/core/index.js +0 -21
- package/dist/core/index.js.map +0 -1
- package/dist/core/input.js +0 -45
- package/dist/core/input.js.map +0 -1
- package/dist/core/machine.js +0 -1021
- package/dist/core/machine.js.map +0 -1
- package/dist/core/model.js +0 -460
- package/dist/core/model.js.map +0 -1
- package/dist/core/observer.js +0 -193
- package/dist/core/observer.js.map +0 -1
- package/dist/core/occupancy.js +0 -63
- package/dist/core/occupancy.js.map +0 -1
- package/dist/core/permissions.js +0 -222
- package/dist/core/permissions.js.map +0 -1
- package/dist/core/plan.js +0 -99
- package/dist/core/plan.js.map +0 -1
- package/dist/core/progress.js +0 -43
- package/dist/core/progress.js.map +0 -1
- package/dist/core/questions.js +0 -19
- package/dist/core/questions.js.map +0 -1
- package/dist/core/queue.js +0 -859
- package/dist/core/queue.js.map +0 -1
- package/dist/core/retryable.js +0 -8
- package/dist/core/retryable.js.map +0 -1
- package/dist/core/scheduler.js +0 -160
- package/dist/core/scheduler.js.map +0 -1
- package/dist/core/skip.js +0 -109
- package/dist/core/skip.js.map +0 -1
- package/dist/core/stages.js +0 -304
- package/dist/core/stages.js.map +0 -1
- package/dist/core/summary.js +0 -35
- package/dist/core/summary.js.map +0 -1
- package/dist/core/tags.js +0 -184
- package/dist/core/tags.js.map +0 -1
- package/dist/core/topology.js +0 -162
- package/dist/core/topology.js.map +0 -1
- package/dist/daemon/artifacts.js +0 -84
- package/dist/daemon/artifacts.js.map +0 -1
- package/dist/daemon/daemon.js +0 -1442
- package/dist/daemon/daemon.js.map +0 -1
- package/dist/daemon/executor.js +0 -749
- package/dist/daemon/executor.js.map +0 -1
- package/dist/daemon/helpers.js +0 -38
- package/dist/daemon/helpers.js.map +0 -1
- package/dist/daemon/index.js +0 -4
- package/dist/daemon/index.js.map +0 -1
- package/dist/daemon/logs.js +0 -69
- package/dist/daemon/logs.js.map +0 -1
- package/dist/daemon/observers.js +0 -93
- package/dist/daemon/observers.js.map +0 -1
- package/dist/daemon/patches.js +0 -76
- package/dist/daemon/patches.js.map +0 -1
- package/dist/daemon/ports.js +0 -2
- package/dist/daemon/ports.js.map +0 -1
- package/dist/daemon/processes.js +0 -98
- package/dist/daemon/processes.js.map +0 -1
- package/dist/daemon/repositories.js +0 -2
- package/dist/daemon/repositories.js.map +0 -1
- package/dist/daemon/server.js +0 -164
- package/dist/daemon/server.js.map +0 -1
- package/dist/daemon/supervisor.js +0 -140
- package/dist/daemon/supervisor.js.map +0 -1
- package/dist/daemon/timings.js +0 -23
- package/dist/daemon/timings.js.map +0 -1
- package/dist/git/delivery.js +0 -284
- package/dist/git/delivery.js.map +0 -1
- package/dist/git/index.js +0 -4
- package/dist/git/index.js.map +0 -1
- package/dist/git/runner.js +0 -60
- package/dist/git/runner.js.map +0 -1
- package/dist/git/workspace.js +0 -366
- package/dist/git/workspace.js.map +0 -1
- package/dist/mcp/host.js +0 -401
- package/dist/mcp/host.js.map +0 -1
- package/dist/mcp/index.js +0 -3
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/tools.js +0 -19
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/version.js +0 -5
- package/dist/mcp/version.js.map +0 -1
- package/dist/mcp/worker.js +0 -230
- package/dist/mcp/worker.js.map +0 -1
- package/dist/presentation/web/routes/directories.js +0 -60
- package/dist/presentation/web/routes/directories.js.map +0 -1
- package/dist/protocol/autostart.js +0 -171
- package/dist/protocol/autostart.js.map +0 -1
- package/dist/protocol/build.js +0 -38
- package/dist/protocol/build.js.map +0 -1
- package/dist/protocol/catalog.js +0 -18
- package/dist/protocol/catalog.js.map +0 -1
- package/dist/protocol/client.js +0 -83
- package/dist/protocol/client.js.map +0 -1
- package/dist/protocol/format.js +0 -477
- package/dist/protocol/format.js.map +0 -1
- package/dist/protocol/index.js +0 -11
- package/dist/protocol/index.js.map +0 -1
- package/dist/protocol/messages.js +0 -598
- package/dist/protocol/messages.js.map +0 -1
- package/dist/protocol/style.js +0 -81
- package/dist/protocol/style.js.map +0 -1
- package/dist/protocol/transcript.js +0 -49
- package/dist/protocol/transcript.js.map +0 -1
- package/dist/protocol/views.js +0 -696
- package/dist/protocol/views.js.map +0 -1
- package/dist/runtime/catalog.js +0 -117
- package/dist/runtime/catalog.js.map +0 -1
- package/dist/runtime/claude.js +0 -399
- package/dist/runtime/claude.js.map +0 -1
- package/dist/runtime/index.js +0 -34
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/message.js +0 -48
- package/dist/runtime/message.js.map +0 -1
- package/dist/runtime/naming.js +0 -69
- package/dist/runtime/naming.js.map +0 -1
- package/dist/runtime/opencode.js +0 -189
- package/dist/runtime/opencode.js.map +0 -1
- package/dist/runtime/skills.js +0 -17
- package/dist/runtime/skills.js.map +0 -1
- package/dist/runtime/transcript.js +0 -227
- package/dist/runtime/transcript.js.map +0 -1
- package/dist/runtime/types.js +0 -12
- package/dist/runtime/types.js.map +0 -1
- package/dist/runtime/which.js +0 -21
- package/dist/runtime/which.js.map +0 -1
- package/dist/store/index.js +0 -3
- package/dist/store/index.js.map +0 -1
- package/dist/store/schema.js +0 -286
- package/dist/store/schema.js.map +0 -1
- package/dist/store/store.js +0 -491
- package/dist/store/store.js.map +0 -1
- package/dist/web/assets/EntryList-CnfGgjEY.js +0 -1
- package/dist/web/assets/FilePath-C0X8-keS.js +0 -1
- package/dist/web/assets/SettingsForm-BcyBWJbn.js +0 -1
- package/dist/web/assets/SharedPipelinesGroup-a368-IQ0.js +0 -1
- package/dist/web/assets/index-B-oJ93zH.js +0 -22
- package/dist/web/assets/index-BZE36gYR.css +0 -2
- package/dist/web/assets/locales-DtRrxYzg.js +0 -1
- package/dist/web/assets/pipelines-D48ggDNe.js +0 -1
- package/dist/web/assets/queue-D8_RY4IY.js +0 -16
- package/dist/web/assets/select-J4oIrmYh.js +0 -1
- package/dist/web/assets/settings-B0-0Vaia.js +0 -2
- package/dist/web/assets/skeleton-CCKCQF5n.js +0 -1
- package/dist/web/assets/specialists-DH8tyluO.js +0 -1
- package/dist/web/assets/switch-CWFAgxG1.js +0 -41
- package/dist/web/assets/topology-CNQ28AB2.js +0 -7
- /package/dist/web/assets/{topology-DLioOiRN.css → pipelines-DLioOiRN.css} +0 -0
package/dist/daemon/server.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { errorMessage } from '../platform/errors/index.js';
|
|
2
|
-
import { chmodSync, existsSync, readFileSync, renameSync, rmSync, statSync, } from 'node:fs';
|
|
3
|
-
import { createServer } from 'node:net';
|
|
4
|
-
import { parseRequest } from '../presentation/ipc/contract/index.js';
|
|
5
|
-
const SUBSCRIBER_BUFFER_LIMIT = 4 * 1024 * 1024;
|
|
6
|
-
/** How often the daemon checks that its socket file and its lock are still in place. */
|
|
7
|
-
export const SOCKET_CHECK_MS = 5_000;
|
|
8
|
-
/** The file at `path` is the socket the daemon listens on (not removed, not replaced). */
|
|
9
|
-
function sameFile(path, own) {
|
|
10
|
-
try {
|
|
11
|
-
const current = statSync(path);
|
|
12
|
-
return current.dev === own.dev && current.ino === own.ino;
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/** The lock at `path` holds the pid of this process. */
|
|
19
|
-
function ownLock(path) {
|
|
20
|
-
try {
|
|
21
|
-
return readFileSync(path, 'utf8').trim() === String(process.pid);
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function answer(daemon, line) {
|
|
28
|
-
const parsed = parseRequest(line);
|
|
29
|
-
if ('error' in parsed)
|
|
30
|
-
return { id: parsed.id, ok: false, error: parsed.error };
|
|
31
|
-
try {
|
|
32
|
-
return { id: parsed.id, ok: true, result: await daemon.handle(parsed.request) };
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
return { id: parsed.id, ok: false, error: errorMessage(error) };
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/** Sends events to a subscribed connection; a connection that falls behind is dropped. */
|
|
39
|
-
function subscribeConnection(serving, connection) {
|
|
40
|
-
const unsubscribe = serving.daemon.subscribe((event) => {
|
|
41
|
-
if (connection.destroyed)
|
|
42
|
-
return;
|
|
43
|
-
if (connection.writableLength > SUBSCRIBER_BUFFER_LIMIT) {
|
|
44
|
-
connection.destroy();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
connection.write(`${event}\n`);
|
|
48
|
-
});
|
|
49
|
-
serving.subscriptions.add(connection);
|
|
50
|
-
connection.once('close', () => {
|
|
51
|
-
unsubscribe();
|
|
52
|
-
serving.subscriptions.delete(connection);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function handleLine(serving, connection, line, close) {
|
|
56
|
-
const parsed = parseRequest(line);
|
|
57
|
-
if ('request' in parsed && parsed.request.method === 'subscribe') {
|
|
58
|
-
subscribeConnection(serving, connection);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
void answer(serving.daemon, line).then((response) => {
|
|
62
|
-
if (!connection.destroyed)
|
|
63
|
-
connection.write(`${JSON.stringify(response)}\n`);
|
|
64
|
-
if (response.ok && response.result?.stopping)
|
|
65
|
-
close();
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function handleConnection(serving, connection, close) {
|
|
69
|
-
connection.setEncoding('utf8');
|
|
70
|
-
let buffer = '';
|
|
71
|
-
connection.on('data', (chunk) => {
|
|
72
|
-
buffer += chunk;
|
|
73
|
-
let end = buffer.indexOf('\n');
|
|
74
|
-
while (end !== -1) {
|
|
75
|
-
const line = buffer.slice(0, end);
|
|
76
|
-
buffer = buffer.slice(end + 1);
|
|
77
|
-
handleLine(serving, connection, line, close);
|
|
78
|
-
end = buffer.indexOf('\n');
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
connection.on('error', () => undefined);
|
|
82
|
-
}
|
|
83
|
-
async function shutdown(serving) {
|
|
84
|
-
const { daemon, server, lockPath, own } = serving;
|
|
85
|
-
if (serving.socketCheck)
|
|
86
|
-
clearInterval(serving.socketCheck);
|
|
87
|
-
for (const connection of serving.subscriptions)
|
|
88
|
-
connection.destroy();
|
|
89
|
-
// Closing a listening Unix socket unlinks its path, whatever file is there now: a file put in
|
|
90
|
-
// place of the socket by someone else is moved aside for the close and then put back.
|
|
91
|
-
const foreign = own !== null && existsSync(daemon.socket) && !sameFile(daemon.socket, own);
|
|
92
|
-
const aside = `${daemon.socket}.${process.pid}.keep`;
|
|
93
|
-
if (foreign)
|
|
94
|
-
renameSync(daemon.socket, aside);
|
|
95
|
-
await new Promise((resolve) => server.close(() => resolve()));
|
|
96
|
-
if (foreign)
|
|
97
|
-
renameSync(aside, daemon.socket);
|
|
98
|
-
await daemon.stop();
|
|
99
|
-
if (own && sameFile(daemon.socket, own))
|
|
100
|
-
rmSync(daemon.socket, { force: true });
|
|
101
|
-
if (existsSync(lockPath) && readFileSync(lockPath, 'utf8').trim() === String(process.pid)) {
|
|
102
|
-
rmSync(lockPath, { force: true });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Without its socket nobody can reach the daemon; without its lock the next client starts
|
|
107
|
-
* another one. Either is gone when the state directory is removed (the socket may live in the
|
|
108
|
-
* temporary directory, see `socketPath`): the daemon then stops by itself.
|
|
109
|
-
*/
|
|
110
|
-
function watchSocket(serving, socketStat, intervalMs, close) {
|
|
111
|
-
const { daemon, lockPath } = serving;
|
|
112
|
-
serving.socketCheck = setInterval(() => {
|
|
113
|
-
if (serving.closing)
|
|
114
|
-
return;
|
|
115
|
-
const lost = !sameFile(daemon.socket, socketStat)
|
|
116
|
-
? `socket ${daemon.socket}`
|
|
117
|
-
: !ownLock(lockPath)
|
|
118
|
-
? `lock ${lockPath}`
|
|
119
|
-
: null;
|
|
120
|
-
if (lost === null)
|
|
121
|
-
return;
|
|
122
|
-
process.stderr.write(`aip daemon: ${lost} is gone; stopping\n`);
|
|
123
|
-
close();
|
|
124
|
-
}, intervalMs);
|
|
125
|
-
serving.socketCheck.unref();
|
|
126
|
-
}
|
|
127
|
-
/** Listens on the socket of the daemon and starts it; the caller holds the lock. */
|
|
128
|
-
export async function serveDaemon(daemon, options) {
|
|
129
|
-
rmSync(daemon.socket, { force: true });
|
|
130
|
-
let resolveClosed = () => undefined;
|
|
131
|
-
const closed = new Promise((resolve) => {
|
|
132
|
-
resolveClosed = resolve;
|
|
133
|
-
});
|
|
134
|
-
const serving = {
|
|
135
|
-
daemon,
|
|
136
|
-
server: createServer((connection) => handleConnection(serving, connection, () => void close())),
|
|
137
|
-
lockPath: options.lockPath,
|
|
138
|
-
subscriptions: new Set(),
|
|
139
|
-
own: null,
|
|
140
|
-
socketCheck: null,
|
|
141
|
-
closing: null,
|
|
142
|
-
};
|
|
143
|
-
const close = () => {
|
|
144
|
-
serving.closing ??= shutdown(serving).then(resolveClosed);
|
|
145
|
-
return serving.closing;
|
|
146
|
-
};
|
|
147
|
-
try {
|
|
148
|
-
await new Promise((resolve, reject) => {
|
|
149
|
-
serving.server.once('error', reject);
|
|
150
|
-
serving.server.listen(daemon.socket, () => resolve());
|
|
151
|
-
});
|
|
152
|
-
chmodSync(daemon.socket, 0o600);
|
|
153
|
-
const socketStat = statSync(daemon.socket);
|
|
154
|
-
serving.own = socketStat;
|
|
155
|
-
await daemon.start();
|
|
156
|
-
watchSocket(serving, socketStat, options.socketCheckMs ?? SOCKET_CHECK_MS, () => void close());
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
serving.server.close();
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
return { close, closed };
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/daemon/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,GAET,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAA4B,MAAM,UAAU,CAAC;AAElE,OAAO,EAAE,YAAY,EAAiB,MAAM,uCAAuC,CAAC;AAIpF,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAChD,wFAAwF;AACxF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,0FAA0F;AAC1F,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAU;IACxC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,wDAAwD;AACxD,SAAS,OAAO,CAAC,IAAY;IAC3B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,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AAU,EAAE,OAAO,CAAC,aAAa,IAAI,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IACjG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import { appendFileSync, createWriteStream, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { dirname } from 'node:path';
|
|
4
|
-
import { createInterface } from 'node:readline';
|
|
5
|
-
export const STOP_GRACE_MS = 10_000;
|
|
6
|
-
export const DRAIN_MS = 2_000;
|
|
7
|
-
export function launchProcess(launch, options) {
|
|
8
|
-
for (const file of launch.files) {
|
|
9
|
-
mkdirSync(dirname(file.path), { recursive: true });
|
|
10
|
-
writeFileSync(file.path, file.content, { mode: 0o600 });
|
|
11
|
-
}
|
|
12
|
-
mkdirSync(dirname(options.logPath), { recursive: true });
|
|
13
|
-
// Lines already in the log (an executor may have added some) keep their numbers.
|
|
14
|
-
let lineCount = 0;
|
|
15
|
-
if (options.timesPath) {
|
|
16
|
-
try {
|
|
17
|
-
for (const char of readFileSync(options.logPath, 'utf8'))
|
|
18
|
-
if (char === '\n')
|
|
19
|
-
lineCount += 1;
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
lineCount = 0;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const stamp = (lines) => {
|
|
26
|
-
if (!options.timesPath || lines <= 0)
|
|
27
|
-
return;
|
|
28
|
-
const now = Date.now();
|
|
29
|
-
let text = '';
|
|
30
|
-
for (let index = 0; index < lines; index += 1)
|
|
31
|
-
text += `${lineCount + index}\t${now}\n`;
|
|
32
|
-
lineCount += lines;
|
|
33
|
-
try {
|
|
34
|
-
appendFileSync(options.timesPath, text);
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
// the journal works without times
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const log = createWriteStream(options.logPath, { flags: 'a' });
|
|
41
|
-
let child;
|
|
42
|
-
let spawnError = null;
|
|
43
|
-
try {
|
|
44
|
-
child = spawn(launch.command, launch.args, {
|
|
45
|
-
cwd: options.cwd,
|
|
46
|
-
env: { ...options.environment, ...launch.env },
|
|
47
|
-
detached: true,
|
|
48
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
spawnError = error.message;
|
|
53
|
-
stamp(1);
|
|
54
|
-
const failure = {
|
|
55
|
-
code: null,
|
|
56
|
-
signal: null,
|
|
57
|
-
outcome: options.parser.outcome(),
|
|
58
|
-
spawnError,
|
|
59
|
-
};
|
|
60
|
-
return {
|
|
61
|
-
pid: undefined,
|
|
62
|
-
stop() { },
|
|
63
|
-
exited: new Promise((resolve) => {
|
|
64
|
-
log.end(`[aip] spawn failed: ${spawnError}\n`, () => resolve(failure));
|
|
65
|
-
}),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
const stdout = createInterface({ input: child.stdout });
|
|
69
|
-
let reported = null;
|
|
70
|
-
stdout.on('line', (line) => {
|
|
71
|
-
log.write(`${line}\n`);
|
|
72
|
-
stamp(1);
|
|
73
|
-
options.parser.push(line);
|
|
74
|
-
if (options.onUsage) {
|
|
75
|
-
const usage = options.parser.usage();
|
|
76
|
-
if (usage !== null &&
|
|
77
|
-
(reported === null ||
|
|
78
|
-
reported.inputTokens !== usage.inputTokens ||
|
|
79
|
-
reported.outputTokens !== usage.outputTokens ||
|
|
80
|
-
reported.costUsd !== usage.costUsd)) {
|
|
81
|
-
reported = usage;
|
|
82
|
-
options.onUsage(usage);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
child.stderr.on('data', (chunk) => {
|
|
87
|
-
log.write(chunk);
|
|
88
|
-
stamp(chunk.filter((byte) => byte === 10).length);
|
|
89
|
-
});
|
|
90
|
-
let killTimer = null;
|
|
91
|
-
const signalGroup = (signal) => {
|
|
92
|
-
if (child.pid === undefined)
|
|
93
|
-
return;
|
|
94
|
-
try {
|
|
95
|
-
process.kill(-child.pid, signal);
|
|
96
|
-
}
|
|
97
|
-
catch {
|
|
98
|
-
try {
|
|
99
|
-
child.kill(signal);
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const exited = new Promise((resolve) => {
|
|
107
|
-
let settled = false;
|
|
108
|
-
const finish = (code, signal) => {
|
|
109
|
-
if (settled)
|
|
110
|
-
return;
|
|
111
|
-
settled = true;
|
|
112
|
-
if (killTimer)
|
|
113
|
-
clearTimeout(killTimer);
|
|
114
|
-
stdout.close();
|
|
115
|
-
stamp(1);
|
|
116
|
-
const exit = { code, signal, outcome: options.parser.outcome(), spawnError };
|
|
117
|
-
// Resolved once the log is on disk: a reader after the exit sees its last line.
|
|
118
|
-
log.end(`[aip] exited code=${code} signal=${signal}${spawnError ? ` error=${spawnError}` : ''}\n`, () => resolve(exit));
|
|
119
|
-
};
|
|
120
|
-
child.once('error', (error) => {
|
|
121
|
-
spawnError = error.message;
|
|
122
|
-
finish(null, null);
|
|
123
|
-
});
|
|
124
|
-
child.once('exit', (code, signal) => {
|
|
125
|
-
signalGroup('SIGTERM');
|
|
126
|
-
setTimeout(() => finish(code, signal), options.drainMs ?? DRAIN_MS).unref();
|
|
127
|
-
});
|
|
128
|
-
child.once('close', finish);
|
|
129
|
-
});
|
|
130
|
-
return {
|
|
131
|
-
pid: child.pid,
|
|
132
|
-
stop() {
|
|
133
|
-
signalGroup('SIGTERM');
|
|
134
|
-
killTimer ??= setTimeout(() => signalGroup('SIGKILL'), options.graceMs ?? STOP_GRACE_MS);
|
|
135
|
-
killTimer.unref();
|
|
136
|
-
},
|
|
137
|
-
exited,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=supervisor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../../src/daemon/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKhD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC;AAe9B,MAAM,UAAU,aAAa,CAC3B,MAAc,EACd,OAYC;IAED,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,iFAAiF;IACjF,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC;YACH,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC;gBAAE,IAAI,IAAI,KAAK,IAAI;oBA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BAAqB,IAAI,WAAW,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EACzF,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CACpB,CAAC;QACJ,CAAC,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC;YAC3B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YAClC,WAAW,CAAC,SAAS,CAAC,CAAC;YACvB,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9E,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,OAAO;QACL,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI;YACF,WAAW,CAAC,SAAS,CAAC,CAAC;YACvB,SAAS,KAAK,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC;YACzF,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;QACD,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/daemon/timings.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { NAMING_TIMEOUT_MS, USAGE_INTERVAL_MS } from '../feature/runs/services/index.js';
|
|
2
|
-
import { KILL_GRACE_MS } from '../feature/processes/services/index.js';
|
|
3
|
-
import { DRAIN_MS, STOP_GRACE_MS } from '../feature/agents/services/index.js';
|
|
4
|
-
/** A timer fires this long after a usage limit resets, so the reset has surely passed. */
|
|
5
|
-
const WAKE_MARGIN_MS = 1000;
|
|
6
|
-
/** How often the daemon looks at background processes while someone is subscribed. */
|
|
7
|
-
const PROCESS_STREAM_MS = 2000;
|
|
8
|
-
/** Pause between a SIGTERM and the extra look at background processes. */
|
|
9
|
-
const PROCESS_KILL_LOOK_MS = 250;
|
|
10
|
-
/** The durations of a daemon without overrides. */
|
|
11
|
-
export const DEFAULT_TIMINGS = {
|
|
12
|
-
timeoutUnitMs: 1000,
|
|
13
|
-
drainMs: DRAIN_MS,
|
|
14
|
-
stopGraceMs: STOP_GRACE_MS,
|
|
15
|
-
killGraceMs: KILL_GRACE_MS,
|
|
16
|
-
wakeMarginMs: WAKE_MARGIN_MS,
|
|
17
|
-
usageIntervalMs: USAGE_INTERVAL_MS,
|
|
18
|
-
namingTimeoutMs: NAMING_TIMEOUT_MS,
|
|
19
|
-
processStreamMs: PROCESS_STREAM_MS,
|
|
20
|
-
processKillLookMs: PROCESS_KILL_LOOK_MS,
|
|
21
|
-
processCacheMs: 1_000,
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=timings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timings.js","sourceRoot":"","sources":["../../src/daemon/timings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAE9E,0FAA0F;AAC1F,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,sFAAsF;AACtF,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,0EAA0E;AAC1E,MAAM,oBAAoB,GAAG,GAAG,CAAC;AA0BjC,mDAAmD;AACnD,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,iBAAiB,EAAE,oBAAoB;IACvC,cAAc,EAAE,KAAK;CACtB,CAAC"}
|
package/dist/git/delivery.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { git, runGit, runGitBuffer } from './runner.js';
|
|
5
|
-
import { commitAll, existingPaths, snapshotCommit } from './workspace.js';
|
|
6
|
-
export const CONFLICT_REASON = 'the changes conflict with your working tree';
|
|
7
|
-
function underInclude(file, include) {
|
|
8
|
-
return include.some((entry) => {
|
|
9
|
-
const path = entry.replace(/\/+$/, '');
|
|
10
|
-
return file === path || file.startsWith(`${path}/`);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
function lines(text) {
|
|
14
|
-
return text === '' ? [] : text.split('\n');
|
|
15
|
-
}
|
|
16
|
-
export async function changedFiles(repository, from, to) {
|
|
17
|
-
const output = await git(repository, 'diff', '--name-status', '-M', '-z', from, to);
|
|
18
|
-
const parts = output.split('\0').filter((part) => part !== '');
|
|
19
|
-
const files = [];
|
|
20
|
-
for (let index = 0; index < parts.length; index += 1) {
|
|
21
|
-
const status = parts[index] ?? '';
|
|
22
|
-
if (status.startsWith('R') || status.startsWith('C')) {
|
|
23
|
-
files.push(parts[index + 1] ?? '', parts[index + 2] ?? '');
|
|
24
|
-
index += 2;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
files.push(parts[index + 1] ?? '');
|
|
28
|
-
index += 1;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return [...new Set(files.filter((file) => file !== ''))].sort();
|
|
32
|
-
}
|
|
33
|
-
export async function dirtyPaths(repository) {
|
|
34
|
-
const output = (await runGit(repository, ['status', '--porcelain=v1', '-z', '--untracked-files=all'])).stdout;
|
|
35
|
-
const entries = output.split('\0');
|
|
36
|
-
const paths = [];
|
|
37
|
-
for (let index = 0; index < entries.length; index += 1) {
|
|
38
|
-
const entry = entries[index] ?? '';
|
|
39
|
-
if (entry.length < 4)
|
|
40
|
-
continue;
|
|
41
|
-
paths.push(entry.slice(3));
|
|
42
|
-
if (entry.startsWith('R') || entry.startsWith('C')) {
|
|
43
|
-
paths.push(entries[index + 1] ?? '');
|
|
44
|
-
index += 1;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return paths.filter((path) => path !== '');
|
|
48
|
-
}
|
|
49
|
-
async function patchFile(repository, change, directory) {
|
|
50
|
-
const patch = (await runGit(repository, ['diff', '--binary', '-M', change.from, change.to]))
|
|
51
|
-
.stdout;
|
|
52
|
-
const path = join(directory, `${change.group}.patch`);
|
|
53
|
-
writeFileSync(path, patch);
|
|
54
|
-
return path;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* One patch with the changes of every group, stacked in order on the base of the first one in a
|
|
58
|
-
* temporary index. Applying the groups one by one to the user's tree loses every group after a
|
|
59
|
-
* conflict: `git apply --3way` refuses a whole patch while the index holds an unmerged path.
|
|
60
|
-
*/
|
|
61
|
-
async function combinedPatch(repository, changes, directory) {
|
|
62
|
-
const [first] = changes;
|
|
63
|
-
if (!first)
|
|
64
|
-
throw new Error('no changes to combine');
|
|
65
|
-
if (changes.length === 1)
|
|
66
|
-
return patchFile(repository, first, directory);
|
|
67
|
-
const environment = { GIT_INDEX_FILE: join(directory, 'combined.index') };
|
|
68
|
-
await runGitWith(repository, ['read-tree', first.from], environment);
|
|
69
|
-
for (const change of changes) {
|
|
70
|
-
const patch = await patchFile(repository, change, directory);
|
|
71
|
-
const result = await runGitWith(repository, ['apply', '--cached', '--3way', patch], environment, true);
|
|
72
|
-
if (result.code !== 0) {
|
|
73
|
-
throw new Error(`the changes of group ${change.group} do not apply on top of the groups before it: ${result.stderr.trim()}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const tree = (await runGitWith(repository, ['write-tree'], environment)).stdout.trim();
|
|
77
|
-
const patch = (await runGit(repository, ['diff', '--binary', '-M', first.from, tree])).stdout;
|
|
78
|
-
const path = join(directory, 'combined.patch');
|
|
79
|
-
writeFileSync(path, patch);
|
|
80
|
-
return path;
|
|
81
|
-
}
|
|
82
|
-
async function snapshotIndex(repository, path, include) {
|
|
83
|
-
const environment = { GIT_INDEX_FILE: path };
|
|
84
|
-
await runGitWith(repository, ['read-tree', 'HEAD'], environment);
|
|
85
|
-
await runGitWith(repository, ['add', '-A'], environment);
|
|
86
|
-
const extra = existingPaths(repository, include);
|
|
87
|
-
if (extra.length > 0)
|
|
88
|
-
await runGitWith(repository, ['add', '-A', '-f', '--', ...extra], environment);
|
|
89
|
-
return environment;
|
|
90
|
-
}
|
|
91
|
-
async function runGitWith(repository, args, env, allowFailure = false) {
|
|
92
|
-
return runGit(repository, args, { allowFailure, env });
|
|
93
|
-
}
|
|
94
|
-
async function unmerged(repository, env) {
|
|
95
|
-
const output = (await runGitWith(repository, ['ls-files', '-u'], env)).stdout.trim();
|
|
96
|
-
return [...new Set(lines(output).map((line) => line.split('\t')[1] ?? ''))]
|
|
97
|
-
.filter(Boolean)
|
|
98
|
-
.sort();
|
|
99
|
-
}
|
|
100
|
-
export async function probe(repository, patches, directory, include = []) {
|
|
101
|
-
const environment = await snapshotIndex(repository, join(directory, 'probe.index'), include);
|
|
102
|
-
const conflicts = new Set();
|
|
103
|
-
for (const patch of patches) {
|
|
104
|
-
const result = await runGitWith(repository, ['apply', '--3way', '--cached', patch], environment, true);
|
|
105
|
-
if (result.code !== 0) {
|
|
106
|
-
const files = await unmerged(repository, environment);
|
|
107
|
-
if (files.length === 0)
|
|
108
|
-
throw new Error(`patch does not apply: ${result.stderr.trim()}`);
|
|
109
|
-
for (const file of files)
|
|
110
|
-
conflicts.add(file);
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return [...conflicts].sort();
|
|
115
|
-
}
|
|
116
|
-
async function applyToWorktree(repository, patches, directory, include) {
|
|
117
|
-
const conflicts = new Set();
|
|
118
|
-
for (const [index, patch] of patches.entries()) {
|
|
119
|
-
const environment = await snapshotIndex(repository, join(directory, `apply-${index}.index`), include);
|
|
120
|
-
const result = await runGitWith(repository, ['apply', '--3way', patch], environment, true);
|
|
121
|
-
if (result.code !== 0) {
|
|
122
|
-
const files = await unmerged(repository, environment);
|
|
123
|
-
if (files.length === 0)
|
|
124
|
-
throw new Error(`patch does not apply: ${result.stderr.trim()}`);
|
|
125
|
-
for (const file of files)
|
|
126
|
-
conflicts.add(file);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return [...conflicts].sort();
|
|
130
|
-
}
|
|
131
|
-
export async function deliver(request) {
|
|
132
|
-
const { repository } = request;
|
|
133
|
-
const include = request.include ?? [];
|
|
134
|
-
const changes = request.changes.filter((change) => change.from !== change.to);
|
|
135
|
-
const files = [
|
|
136
|
-
...new Set((await Promise.all(changes.map((change) => changedFiles(repository, change.from, change.to)))).flat()),
|
|
137
|
-
].sort();
|
|
138
|
-
if (request.mode === 'branch') {
|
|
139
|
-
await git(repository, 'branch', '-f', request.branch, request.runRef);
|
|
140
|
-
return { kind: 'applied', files, conflicts: [], commit: null, userEdits: [] };
|
|
141
|
-
}
|
|
142
|
-
if (request.mode === 'commit') {
|
|
143
|
-
const staged = await runGit(repository, ['diff', '--cached', '--quiet'], {
|
|
144
|
-
allowFailure: true,
|
|
145
|
-
});
|
|
146
|
-
if (staged.code !== 0) {
|
|
147
|
-
return {
|
|
148
|
-
kind: 'refused',
|
|
149
|
-
reason: 'the index has staged changes; commit or unstage them first',
|
|
150
|
-
files: [],
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (files.length === 0) {
|
|
155
|
-
return { kind: 'applied', files, conflicts: [], commit: null, userEdits: [] };
|
|
156
|
-
}
|
|
157
|
-
const directory = mkdtempSync(join(tmpdir(), 'aip-deliver-'));
|
|
158
|
-
try {
|
|
159
|
-
const patches = [await combinedPatch(repository, changes, directory)];
|
|
160
|
-
const committed = request.mode === 'commit' ? files.filter((file) => !underInclude(file, include)) : [];
|
|
161
|
-
const dirty = new Set(await dirtyPaths(repository));
|
|
162
|
-
const userEdits = committed.filter((file) => dirty.has(file));
|
|
163
|
-
if (!request.force) {
|
|
164
|
-
const conflicts = await probe(repository, patches, directory, include);
|
|
165
|
-
if (conflicts.length > 0) {
|
|
166
|
-
return { kind: 'refused', reason: CONFLICT_REASON, files: conflicts, conflict: true };
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const conflicts = await applyToWorktree(repository, patches, directory, include);
|
|
170
|
-
let commit = null;
|
|
171
|
-
if (request.mode === 'commit' && conflicts.length === 0 && committed.length > 0) {
|
|
172
|
-
await git(repository, 'add', '-A', '--', ...committed);
|
|
173
|
-
await git(repository, 'commit', '--no-verify', '-m', request.message, '--', ...committed);
|
|
174
|
-
commit = await git(repository, 'rev-parse', 'HEAD');
|
|
175
|
-
}
|
|
176
|
-
return { kind: 'applied', files, conflicts, commit, userEdits };
|
|
177
|
-
}
|
|
178
|
-
finally {
|
|
179
|
-
rmSync(directory, { recursive: true, force: true });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Snapshots the current working tree of the user, checks it out in the resolver worktree and
|
|
184
|
-
* applies the changes there with a three-way merge, leaving conflict markers in place.
|
|
185
|
-
*/
|
|
186
|
-
export async function prepareResolve(request) {
|
|
187
|
-
const { repository, worktree } = request;
|
|
188
|
-
const base = await snapshotCommit(repository, true, request.include);
|
|
189
|
-
await git(repository, 'update-ref', request.baseRef, base);
|
|
190
|
-
if (existsSync(worktree)) {
|
|
191
|
-
await runGit(repository, ['worktree', 'remove', '--force', worktree], { allowFailure: true });
|
|
192
|
-
rmSync(worktree, { recursive: true, force: true });
|
|
193
|
-
await git(repository, 'worktree', 'prune');
|
|
194
|
-
}
|
|
195
|
-
await git(repository, 'worktree', 'add', '--detach', worktree, base);
|
|
196
|
-
const directory = mkdtempSync(join(tmpdir(), 'aip-resolve-'));
|
|
197
|
-
try {
|
|
198
|
-
const changes = request.changes.filter((change) => change.from !== change.to);
|
|
199
|
-
if (changes.length > 0) {
|
|
200
|
-
const patch = await combinedPatch(repository, changes, directory);
|
|
201
|
-
const result = await runGit(worktree, ['apply', '--3way', patch], { allowFailure: true });
|
|
202
|
-
if (result.code !== 0 && (await unmergedIn(worktree)).length === 0) {
|
|
203
|
-
throw new Error(`patch does not apply: ${result.stderr.trim()}`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return { base, conflicts: await unmergedIn(worktree) };
|
|
207
|
-
}
|
|
208
|
-
finally {
|
|
209
|
-
rmSync(directory, { recursive: true, force: true });
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
async function unmergedIn(worktree) {
|
|
213
|
-
return lines(await git(worktree, 'diff', '--name-only', '--diff-filter=U')).sort();
|
|
214
|
-
}
|
|
215
|
-
const MARKER = /^(<{7}|>{7})( |$)|^={7}$/m;
|
|
216
|
-
/** Files among `files` of the worktree that still contain conflict markers. */
|
|
217
|
-
export function filesWithMarkers(worktree, files) {
|
|
218
|
-
return files.filter((file) => {
|
|
219
|
-
const path = join(worktree, file);
|
|
220
|
-
return existsSync(path) && MARKER.test(readFileSync(path, 'utf8'));
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
/** Commits what the resolver left in its worktree; returns the commit, or `base` without changes. */
|
|
224
|
-
export async function commitResolve(worktree, base, include) {
|
|
225
|
-
return (await commitAll(worktree, 'aip: resolve delivery conflicts', null, include)) ?? base;
|
|
226
|
-
}
|
|
227
|
-
/** Changed files between two commits with added and removed lines (`git diff --numstat`). */
|
|
228
|
-
export async function diffStat(repository, from, to) {
|
|
229
|
-
const output = (await runGit(repository, ['diff', '--numstat', '-z', '-M', from, to])).stdout;
|
|
230
|
-
const parts = output.split('\0');
|
|
231
|
-
const files = [];
|
|
232
|
-
for (let index = 0; index < parts.length; index += 1) {
|
|
233
|
-
const head = parts[index] ?? '';
|
|
234
|
-
if (head === '')
|
|
235
|
-
continue;
|
|
236
|
-
const [added = '-', removed = '-', path = ''] = head.split('\t');
|
|
237
|
-
// A rename prints an empty path followed by the old and the new path.
|
|
238
|
-
let name = path;
|
|
239
|
-
let previousPath;
|
|
240
|
-
if (path === '') {
|
|
241
|
-
previousPath = parts[index + 1] ?? '';
|
|
242
|
-
name = parts[index + 2] ?? '';
|
|
243
|
-
index += 2;
|
|
244
|
-
}
|
|
245
|
-
files.push({
|
|
246
|
-
path: name,
|
|
247
|
-
added: added === '-' ? null : Number(added),
|
|
248
|
-
removed: removed === '-' ? null : Number(removed),
|
|
249
|
-
...(previousPath ? { previousPath } : {}),
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
files.sort((left, right) => left.path.localeCompare(right.path));
|
|
253
|
-
return {
|
|
254
|
-
files,
|
|
255
|
-
added: files.reduce((sum, file) => sum + (file.added ?? 0), 0),
|
|
256
|
-
removed: files.reduce((sum, file) => sum + (file.removed ?? 0), 0),
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
/** Diff of the given paths (a renamed file needs both) with `context` lines around each change. */
|
|
260
|
-
export async function fileDiff(repository, from, to, paths, options) {
|
|
261
|
-
const output = (await runGit(repository, [
|
|
262
|
-
'diff',
|
|
263
|
-
`-U${options.context}`,
|
|
264
|
-
'-M',
|
|
265
|
-
'--no-color',
|
|
266
|
-
from,
|
|
267
|
-
to,
|
|
268
|
-
'--',
|
|
269
|
-
...paths,
|
|
270
|
-
])).stdout;
|
|
271
|
-
const all = lines(output.replace(/\n$/, ''));
|
|
272
|
-
const start = all.findIndex((line) => line.startsWith('@@'));
|
|
273
|
-
const body = start < 0 ? [] : all.slice(start);
|
|
274
|
-
return {
|
|
275
|
-
lines: body.slice(0, options.maxLines),
|
|
276
|
-
totalLines: body.length,
|
|
277
|
-
truncated: body.length > options.maxLines,
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
/** Patch of `from..to` for `git apply`, binary files included, as raw bytes. */
|
|
281
|
-
export async function rangePatch(repository, from, to) {
|
|
282
|
-
return runGitBuffer(repository, ['diff', '--binary', '-M', from, to]);
|
|
283
|
-
}
|
|
284
|
-
//# sourceMappingURL=delivery.js.map
|