@hearsay-tools/squawk 0.18.0 → 0.19.0-dev.8638
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/README.md +57 -1436
- package/dist/activity/publisher.d.ts +6 -4
- package/dist/activity/publisher.js +7 -8
- package/dist/activity/publisher.js.map +1 -1
- package/dist/activity/read-model.d.ts +6 -2
- package/dist/activity/read-model.js +23 -21
- package/dist/activity/read-model.js.map +1 -1
- package/dist/activity/requests.d.ts +8 -2
- package/dist/activity/requests.js +3 -3
- package/dist/activity/requests.js.map +1 -1
- package/dist/activity/tool-activity.d.ts +6 -8
- package/dist/activity/tool-activity.js +10 -6
- package/dist/activity/tool-activity.js.map +1 -1
- package/dist/activity/wait.d.ts +5 -11
- package/dist/activity/wait.js +12 -8
- package/dist/activity/wait.js.map +1 -1
- package/dist/agent-config/catalog.d.ts +6 -62
- package/dist/agent-config/catalog.js +20 -376
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/files.d.ts +1 -1
- package/dist/agent-config/files.js.map +1 -1
- package/dist/agent-config/model-settings/shared.d.ts +2 -3
- package/dist/agent-config/model-settings/shared.js +2 -2
- package/dist/agent-config/model-settings/shared.js.map +1 -1
- package/dist/agent-config/models.d.ts +8 -5
- package/dist/agent-config/models.js +8 -27
- package/dist/agent-config/models.js.map +1 -1
- package/dist/agent-config/seed.d.ts +2 -2
- package/dist/agent-config/seed.js +7 -12
- package/dist/agent-config/seed.js.map +1 -1
- package/dist/agent-config/service.d.ts +8 -4
- package/dist/agent-config/service.js +12 -6
- package/dist/agent-config/service.js.map +1 -1
- package/dist/agent-config/validate.d.ts +1 -1
- package/dist/artifacts/cli.d.ts +2 -0
- package/dist/artifacts/cli.js +4 -3
- package/dist/artifacts/cli.js.map +1 -1
- package/dist/artifacts/removal-slot.d.ts +3 -0
- package/dist/artifacts/removal-slot.js +7 -0
- package/dist/artifacts/removal-slot.js.map +1 -0
- package/dist/artifacts/reports-index.d.ts +16 -6
- package/dist/artifacts/reports-index.js +38 -35
- package/dist/artifacts/reports-index.js.map +1 -1
- package/dist/artifacts/reports-watch.js +2 -3
- package/dist/artifacts/reports-watch.js.map +1 -1
- package/dist/artifacts/resolve.js +1 -2
- package/dist/artifacts/resolve.js.map +1 -1
- package/dist/artifacts/store.d.ts +1 -1
- package/dist/artifacts/store.js +4 -2
- package/dist/artifacts/store.js.map +1 -1
- package/dist/automations/agent-tools.d.ts +2 -0
- package/dist/automations/agent-tools.js +24 -0
- package/dist/automations/agent-tools.js.map +1 -0
- package/dist/automations/automation-cli.d.ts +2 -0
- package/dist/automations/automation-cli.js +15 -7
- package/dist/automations/automation-cli.js.map +1 -1
- package/dist/automations/coordinator.js +1 -2
- package/dist/automations/coordinator.js.map +1 -1
- package/dist/automations/enabled.d.ts +2 -0
- package/dist/automations/enabled.js +6 -0
- package/dist/automations/enabled.js.map +1 -0
- package/dist/automations/github-baseline.js +2 -0
- package/dist/automations/github-baseline.js.map +1 -1
- package/dist/automations/github-poller.d.ts +3 -0
- package/dist/automations/github-poller.js +6 -6
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/github-repository.d.ts +22 -0
- package/dist/automations/github-repository.js +46 -0
- package/dist/automations/github-repository.js.map +1 -0
- package/dist/automations/prompts.d.ts +1 -4
- package/dist/automations/prompts.js +23 -63
- package/dist/automations/prompts.js.map +1 -1
- package/dist/automations/schedule-runner.js +6 -7
- package/dist/automations/schedule-runner.js.map +1 -1
- package/dist/automations/scheduler.d.ts +5 -4
- package/dist/automations/scheduler.js +59 -14
- package/dist/automations/scheduler.js.map +1 -1
- package/dist/automations/service.d.ts +41 -16
- package/dist/automations/service.js +14 -9
- package/dist/automations/service.js.map +1 -1
- package/dist/automations/store.d.ts +2 -0
- package/dist/automations/store.js +42 -5
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/task-template.js +18 -13
- package/dist/automations/task-template.js.map +1 -1
- package/dist/automations/tool-adapter.d.ts +6 -1
- package/dist/automations/tool-adapter.js +104 -10
- package/dist/automations/tool-adapter.js.map +1 -1
- package/dist/automations/tool-catalog.d.ts +119 -0
- package/dist/automations/tool-catalog.js +48 -0
- package/dist/automations/tool-catalog.js.map +1 -0
- package/dist/automations/tool-client.d.ts +9 -0
- package/dist/automations/tool-client.js +19 -0
- package/dist/automations/tool-client.js.map +1 -0
- package/dist/automations/tool-env.d.ts +1 -0
- package/dist/automations/tool-env.js +3 -0
- package/dist/automations/tool-env.js.map +1 -0
- package/dist/automations/tool-errors.d.ts +9 -0
- package/dist/automations/tool-errors.js +34 -0
- package/dist/automations/tool-errors.js.map +1 -0
- package/dist/automations/tool-github.d.ts +9 -0
- package/dist/automations/tool-github.js +9 -0
- package/dist/automations/tool-github.js.map +1 -0
- package/dist/automations/tool-session.d.ts +5 -0
- package/dist/automations/tool-session.js +19 -0
- package/dist/automations/tool-session.js.map +1 -0
- package/dist/automations/tool-timeout.d.ts +2 -0
- package/dist/automations/tool-timeout.js +22 -0
- package/dist/automations/tool-timeout.js.map +1 -0
- package/dist/automations/tools.d.ts +325 -0
- package/dist/automations/tools.js +30 -0
- package/dist/automations/tools.js.map +1 -0
- package/dist/autosave-cleanup.d.ts +4 -2
- package/dist/autosave-cleanup.js +32 -9
- package/dist/autosave-cleanup.js.map +1 -1
- package/dist/autosave-commit.d.ts +52 -0
- package/dist/autosave-commit.js +408 -0
- package/dist/autosave-commit.js.map +1 -0
- package/dist/autosave-git.d.ts +16 -9
- package/dist/autosave-git.js +144 -50
- package/dist/autosave-git.js.map +1 -1
- package/dist/autosave-holders.d.ts +3 -1
- package/dist/autosave-holders.js +7 -4
- package/dist/autosave-holders.js.map +1 -1
- package/dist/autosave-removal-slots.d.ts +6 -0
- package/dist/autosave-removal-slots.js +13 -0
- package/dist/autosave-removal-slots.js.map +1 -0
- package/dist/boot.d.ts +36 -0
- package/dist/boot.js +81 -0
- package/dist/boot.js.map +1 -0
- package/dist/built-in-cli-commands.d.ts +6 -0
- package/dist/built-in-cli-commands.js +156 -0
- package/dist/built-in-cli-commands.js.map +1 -0
- package/dist/built-in-launch-parts.d.ts +14 -0
- package/dist/built-in-launch-parts.js +54 -0
- package/dist/built-in-launch-parts.js.map +1 -0
- package/dist/built-in-run-slots.d.ts +12 -0
- package/dist/built-in-run-slots.js +28 -0
- package/dist/built-in-run-slots.js.map +1 -0
- package/dist/built-in-tool-definitions.d.ts +2 -0
- package/dist/built-in-tool-definitions.js +29 -0
- package/dist/built-in-tool-definitions.js.map +1 -0
- package/dist/built-in-tools.d.ts +3 -0
- package/dist/built-in-tools.js +11 -0
- package/dist/built-in-tools.js.map +1 -0
- package/dist/built-in-wait-kinds.d.ts +4 -0
- package/dist/built-in-wait-kinds.js +14 -0
- package/dist/built-in-wait-kinds.js.map +1 -0
- package/dist/ci-wait/client.d.ts +80 -20
- package/dist/ci-wait/client.js +44 -40
- package/dist/ci-wait/client.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +74 -722
- package/dist/ci-wait/controller.js +62 -178
- package/dist/ci-wait/controller.js.map +1 -1
- package/dist/ci-wait/errors.d.ts +11 -15
- package/dist/ci-wait/errors.js +32 -81
- package/dist/ci-wait/errors.js.map +1 -1
- package/dist/ci-wait/github.d.ts +52 -36
- package/dist/ci-wait/github.js +97 -83
- package/dist/ci-wait/github.js.map +1 -1
- package/dist/ci-wait/mcp.d.ts +1 -1
- package/dist/ci-wait/mcp.js +8 -6
- package/dist/ci-wait/mcp.js.map +1 -1
- package/dist/ci-wait/pr-wait-kind.d.ts +66 -0
- package/dist/ci-wait/pr-wait-kind.js +121 -0
- package/dist/ci-wait/pr-wait-kind.js.map +1 -0
- package/dist/ci-wait/progress.d.ts +2 -28
- package/dist/ci-wait/progress.js +3 -42
- package/dist/ci-wait/progress.js.map +1 -1
- package/dist/ci-wait/queued-checks.d.ts +15 -0
- package/dist/ci-wait/queued-checks.js +44 -0
- package/dist/ci-wait/queued-checks.js.map +1 -0
- package/dist/ci-wait/resource-pool.d.ts +17 -0
- package/dist/ci-wait/resource-pool.js +50 -0
- package/dist/ci-wait/resource-pool.js.map +1 -0
- package/dist/ci-wait/resources.d.ts +5 -8
- package/dist/ci-wait/resources.js +8 -42
- package/dist/ci-wait/resources.js.map +1 -1
- package/dist/ci-wait/supervisor.d.ts +5 -12
- package/dist/ci-wait/supervisor.js +147 -76
- package/dist/ci-wait/supervisor.js.map +1 -1
- package/dist/ci-wait/tool-catalog.d.ts +260 -0
- package/dist/ci-wait/tool-catalog.js +77 -0
- package/dist/ci-wait/tool-catalog.js.map +1 -0
- package/dist/ci-wait/tool-definition.d.ts +21 -0
- package/dist/ci-wait/tool-definition.js +9 -0
- package/dist/ci-wait/tool-definition.js.map +1 -0
- package/dist/ci-wait/tool-names.d.ts +3 -0
- package/dist/ci-wait/tool-names.js +13 -0
- package/dist/ci-wait/tool-names.js.map +1 -0
- package/dist/ci-wait/tool-registry.d.ts +68 -0
- package/dist/ci-wait/tool-registry.js +34 -0
- package/dist/ci-wait/tool-registry.js.map +1 -0
- package/dist/ci-wait/tools.d.ts +334 -632
- package/dist/ci-wait/tools.js +28 -191
- package/dist/ci-wait/tools.js.map +1 -1
- package/dist/cli-dispatch.d.ts +9 -10
- package/dist/cli-dispatch.js +100 -142
- package/dist/cli-dispatch.js.map +1 -1
- package/dist/config.d.ts +6 -43
- package/dist/config.js +52 -65
- package/dist/config.js.map +1 -1
- package/dist/contract/activity.d.ts +71 -56
- package/dist/contract/agent-config.d.ts +2 -16
- package/dist/contract/agent-input.d.ts +56 -0
- package/dist/contract/agent-profiles.d.ts +33 -201
- package/dist/contract/agent-tools.d.ts +51 -0
- package/dist/contract/ask-schema.d.ts +4 -2
- package/dist/contract/attachments.d.ts +2 -2
- package/dist/contract/attention.d.ts +9 -1
- package/dist/contract/automation-requests.d.ts +18 -54
- package/dist/contract/automation-schedule.d.ts +9 -0
- package/dist/contract/automation-storage.d.ts +22 -48
- package/dist/contract/automation-tool.d.ts +293 -0
- package/dist/contract/automations.d.ts +76 -159
- package/dist/contract/ci-wait.d.ts +25 -0
- package/dist/contract/config-requests.d.ts +6 -16
- package/dist/contract/control-locations.d.ts +1 -1
- package/dist/contract/conversations.d.ts +31 -2
- package/dist/contract/create-run-input.d.ts +62 -0
- package/dist/contract/delegation.d.ts +376 -152
- package/dist/contract/discovery.d.ts +29 -96
- package/dist/contract/events.d.ts +7 -6
- package/dist/contract/github.d.ts +0 -18
- package/dist/contract/handoff.d.ts +2 -2
- package/dist/contract/health.d.ts +74 -64
- package/dist/contract/index.d.ts +14 -5
- package/dist/contract/index.js +3798 -3398
- package/dist/contract/live-coordination.d.ts +30 -12
- package/dist/contract/live.d.ts +29 -0
- package/dist/contract/model-choices.d.ts +40 -0
- package/dist/contract/own-lookup.d.ts +5 -0
- package/dist/contract/per-runner-optional-strings.d.ts +3 -9
- package/dist/contract/projects.d.ts +1 -9
- package/dist/contract/provider-requests.d.ts +12 -46
- package/dist/contract/query-requests.d.ts +5 -8
- package/dist/contract/queued-messages.d.ts +35 -0
- package/dist/contract/reference-status.d.ts +19 -0
- package/dist/contract/repo-info.d.ts +12 -0
- package/dist/contract/repo.d.ts +3 -2
- package/dist/contract/run-predicates.d.ts +47 -3
- package/dist/contract/run-requests.d.ts +1 -9
- package/dist/contract/run-search.d.ts +18 -20
- package/dist/contract/run-status.d.ts +33 -0
- package/dist/contract/runner-install.d.ts +41 -0
- package/dist/contract/runner-skills.d.ts +59 -0
- package/dist/contract/runner.d.ts +14 -0
- package/dist/contract/runners.d.ts +150 -0
- package/dist/contract/runs.d.ts +609 -321
- package/dist/contract/scheduled-tasks.d.ts +3 -3
- package/dist/contract/session-context.d.ts +140 -0
- package/dist/contract/skills.d.ts +1 -33
- package/dist/contract/task-options.d.ts +1 -1
- package/dist/contract/tool-display.d.ts +8 -2
- package/dist/contract/ui-state-requests.d.ts +0 -4
- package/dist/contract/usage-limit-hold.d.ts +22 -0
- package/dist/contract/utf8.d.ts +2 -0
- package/dist/contract/wait-limits.d.ts +25 -0
- package/dist/contract/wait-tools.d.ts +669 -0
- package/dist/contract/waiting-on.d.ts +46 -0
- package/dist/contract/waits.d.ts +150 -515
- package/dist/contract/worker-outcome.d.ts +24 -0
- package/dist/contract/workflow-file.d.ts +4 -8
- package/dist/contract/workflow-requests.d.ts +1 -0
- package/dist/contract/workflows.d.ts +29 -52
- package/dist/contract/workspace-events.d.ts +28 -32
- package/dist/contract/workspace.d.ts +56 -179
- package/dist/core/acp/events.d.ts +63 -0
- package/dist/core/acp/events.js +344 -0
- package/dist/core/acp/events.js.map +1 -0
- package/dist/core/acp/protocol.d.ts +86 -0
- package/dist/core/acp/protocol.js +14 -0
- package/dist/core/acp/protocol.js.map +1 -0
- package/dist/core/acp/session.d.ts +101 -0
- package/dist/core/acp/session.js +322 -0
- package/dist/core/acp/session.js.map +1 -0
- package/dist/core/acp/transport.d.ts +38 -0
- package/dist/core/acp/transport.js +144 -0
- package/dist/core/acp/transport.js.map +1 -0
- package/dist/core/acp/usage.d.ts +3 -0
- package/dist/core/acp/usage.js +12 -0
- package/dist/core/acp/usage.js.map +1 -0
- package/dist/core/agent-config-notes.d.ts +5 -0
- package/dist/core/agent-config-notes.js +6 -0
- package/dist/core/agent-config-notes.js.map +1 -0
- package/dist/core/agent-env.d.ts +5 -2
- package/dist/core/agent-env.js +11 -29
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.d.ts +16 -33
- package/dist/core/agent-profiles.js +30 -80
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner-values.d.ts +68 -0
- package/dist/core/agent-runner-values.js +111 -0
- package/dist/core/agent-runner-values.js.map +1 -0
- package/dist/core/agent-runner.d.ts +59 -71
- package/dist/core/agent-runner.js +3 -93
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +17 -4
- package/dist/core/backend-detect.js +86 -153
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/browser-sign-in-error.d.ts +6 -0
- package/dist/core/browser-sign-in-error.js +18 -0
- package/dist/core/browser-sign-in-error.js.map +1 -0
- package/dist/core/cli-registry.d.ts +57 -0
- package/dist/core/cli-registry.js +22 -0
- package/dist/core/cli-registry.js.map +1 -0
- package/dist/core/github-request-limits.d.ts +9 -0
- package/dist/core/github-request-limits.js +13 -0
- package/dist/core/github-request-limits.js.map +1 -0
- package/dist/core/host-model-catalog.d.ts +2 -2
- package/dist/core/host-model-catalog.js +7 -16
- package/dist/core/host-model-catalog.js.map +1 -1
- package/dist/core/host-path.d.ts +5 -0
- package/dist/core/host-path.js +9 -0
- package/dist/core/host-path.js.map +1 -0
- package/dist/core/host-skill-catalog.d.ts +7 -0
- package/dist/core/host-skill-catalog.js +12 -0
- package/dist/core/host-skill-catalog.js.map +1 -0
- package/dist/core/json-guards.d.ts +3 -0
- package/dist/core/json-guards.js +8 -0
- package/dist/core/json-guards.js.map +1 -0
- package/dist/core/launch-registry.d.ts +50 -0
- package/dist/core/launch-registry.js +60 -0
- package/dist/core/launch-registry.js.map +1 -0
- package/dist/core/login-output.d.ts +5 -0
- package/dist/core/login-output.js +14 -0
- package/dist/core/login-output.js.map +1 -0
- package/dist/core/managed-cli-source.d.ts +23 -0
- package/dist/core/managed-cli-source.js +2 -0
- package/dist/core/managed-cli-source.js.map +1 -0
- package/dist/core/managed-session.d.ts +5 -0
- package/dist/core/managed-session.js +45 -3
- package/dist/core/managed-session.js.map +1 -1
- package/dist/core/mock-prompts.d.ts +63 -0
- package/dist/core/mock-prompts.js +64 -0
- package/dist/core/mock-prompts.js.map +1 -0
- package/dist/core/model-identity.d.ts +15 -20
- package/dist/core/model-identity.js +21 -31
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.d.ts +3 -8
- package/dist/core/model-presets.js +16 -38
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/model-probe-spawn.d.ts +8 -0
- package/dist/core/model-probe-spawn.js +7 -0
- package/dist/core/model-probe-spawn.js.map +1 -0
- package/dist/core/model-probe-teardown.js +1 -1
- package/dist/core/model-probe-teardown.js.map +1 -1
- package/dist/core/native-mock.d.ts +6 -0
- package/dist/core/native-mock.js +26 -0
- package/dist/core/native-mock.js.map +1 -0
- package/dist/core/os-cgroup.d.ts +43 -0
- package/dist/core/os-cgroup.js +220 -0
- package/dist/core/os-cgroup.js.map +1 -0
- package/dist/core/os-win-job.d.ts +30 -0
- package/dist/core/os-win-job.js +80 -0
- package/dist/core/os-win-job.js.map +1 -0
- package/dist/core/own-lookup.d.ts +1 -0
- package/dist/core/own-lookup.js +2 -0
- package/dist/core/own-lookup.js.map +1 -0
- package/dist/core/pi-rpc-turn.d.ts +26 -11
- package/dist/core/pi-rpc-turn.js +49 -24
- package/dist/core/pi-rpc-turn.js.map +1 -1
- package/dist/core/pi-rpc-wire.d.ts +9 -4
- package/dist/core/pi-rpc-wire.js +29 -8
- package/dist/core/pi-rpc-wire.js.map +1 -1
- package/dist/core/process-ownership.d.ts +12 -0
- package/dist/core/process-ownership.js +33 -0
- package/dist/core/process-ownership.js.map +1 -0
- package/dist/core/process-stat.d.ts +51 -0
- package/dist/core/process-stat.js +141 -0
- package/dist/core/process-stat.js.map +1 -0
- package/dist/core/process-usage.d.ts +6 -1
- package/dist/core/process-usage.js +9 -3
- package/dist/core/process-usage.js.map +1 -1
- package/dist/core/product-env.d.ts +2 -6
- package/dist/core/product-env.js +3 -10
- package/dist/core/product-env.js.map +1 -1
- package/dist/core/project-agents-file.d.ts +6 -0
- package/dist/core/project-agents-file.js +18 -0
- package/dist/core/project-agents-file.js.map +1 -0
- package/dist/core/provider-auth.d.ts +10 -4
- package/dist/core/provider-auth.js +59 -220
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/provider-availability.d.ts +3 -1
- package/dist/core/provider-availability.js +1 -0
- package/dist/core/provider-availability.js.map +1 -1
- package/dist/core/provider-error.d.ts +21 -0
- package/dist/core/provider-error.js +32 -0
- package/dist/core/provider-error.js.map +1 -0
- package/dist/core/registry.d.ts +39 -0
- package/dist/core/registry.js +96 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/runner-cli.d.ts +10 -0
- package/dist/core/runner-cli.js +34 -0
- package/dist/core/runner-cli.js.map +1 -0
- package/dist/core/runner-config-files.d.ts +60 -0
- package/dist/core/runner-config-files.js +14 -0
- package/dist/core/runner-config-files.js.map +1 -0
- package/dist/core/runner-definition.d.ts +362 -0
- package/dist/core/runner-definition.js +5 -0
- package/dist/core/runner-definition.js.map +1 -0
- package/dist/core/runner-facts.d.ts +80 -111
- package/dist/core/runner-facts.js +32 -52
- package/dist/core/runner-facts.js.map +1 -1
- package/dist/core/runner-fields.d.ts +26 -0
- package/dist/core/runner-fields.js +52 -0
- package/dist/core/runner-fields.js.map +1 -0
- package/dist/core/runner-id-schema.d.ts +15 -0
- package/dist/core/runner-id-schema.js +30 -0
- package/dist/core/runner-id-schema.js.map +1 -0
- package/dist/core/runner-ids.d.ts +9 -0
- package/dist/core/runner-ids.js +10 -0
- package/dist/core/runner-ids.js.map +1 -0
- package/dist/core/runner-model-catalog.d.ts +11 -9
- package/dist/core/runner-model-catalog.js +46 -51
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/runner-model-settings.d.ts +10 -0
- package/dist/core/runner-model-settings.js +3 -0
- package/dist/core/runner-model-settings.js.map +1 -0
- package/dist/core/runner-registry.d.ts +60 -0
- package/dist/core/runner-registry.js +115 -0
- package/dist/core/runner-registry.js.map +1 -0
- package/dist/core/runner-runtime.d.ts +9 -0
- package/dist/core/runner-runtime.js +8 -1
- package/dist/core/runner-runtime.js.map +1 -1
- package/dist/core/runner-skill-catalog.d.ts +28 -0
- package/dist/core/runner-skill-catalog.js +91 -0
- package/dist/core/runner-skill-catalog.js.map +1 -0
- package/dist/core/runner-skill-reference.d.ts +26 -0
- package/dist/core/runner-skill-reference.js +43 -0
- package/dist/core/runner-skill-reference.js.map +1 -0
- package/dist/core/runner-tool-grants.d.ts +1 -1
- package/dist/core/runner-tool-grants.js +1 -1
- package/dist/core/runner-tool-grants.js.map +1 -1
- package/dist/core/secret-redaction.d.ts +2 -0
- package/dist/core/secret-redaction.js +11 -3
- package/dist/core/secret-redaction.js.map +1 -1
- package/dist/core/session-containment.d.ts +78 -0
- package/dist/core/session-containment.js +247 -0
- package/dist/core/session-containment.js.map +1 -0
- package/dist/core/session-descendants.d.ts +15 -0
- package/dist/core/session-descendants.js +95 -0
- package/dist/core/session-descendants.js.map +1 -0
- package/dist/core/session-process.d.ts +23 -7
- package/dist/core/session-process.js +158 -28
- package/dist/core/session-process.js.map +1 -1
- package/dist/core/skill-path-scope.d.ts +4 -0
- package/dist/core/skill-path-scope.js +28 -0
- package/dist/core/skill-path-scope.js.map +1 -0
- package/dist/core/skill-probe.d.ts +21 -0
- package/dist/core/skill-probe.js +105 -0
- package/dist/core/skill-probe.js.map +1 -0
- package/dist/core/skill-trigger.d.ts +14 -0
- package/dist/core/skill-trigger.js +38 -0
- package/dist/core/skill-trigger.js.map +1 -0
- package/dist/core/structured-output.d.ts +9 -0
- package/dist/core/structured-output.js +64 -0
- package/dist/core/structured-output.js.map +1 -0
- package/dist/core/ui-events.d.ts +15 -4
- package/dist/core/ui-events.js.map +1 -1
- package/dist/core/usage-limit.d.ts +3 -2
- package/dist/core/usage-limit.js +16 -2
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/core/v1-text-coalescer.d.ts +1 -1
- package/dist/core/v1-text-coalescer.js +1 -1
- package/dist/core/v1-text-coalescer.js.map +1 -1
- package/dist/data-gitignore.js +3 -6
- package/dist/data-gitignore.js.map +1 -1
- package/dist/delegation/capacity.d.ts +16 -1
- package/dist/delegation/capacity.js +36 -12
- package/dist/delegation/capacity.js.map +1 -1
- package/dist/delegation/cli.d.ts +4 -0
- package/dist/delegation/cli.js +63 -44
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/context.d.ts +40 -5
- package/dist/delegation/context.js +101 -85
- package/dist/delegation/context.js.map +1 -1
- package/dist/delegation/conversation-send.d.ts +9 -13
- package/dist/delegation/conversation-send.js +31 -17
- package/dist/delegation/conversation-send.js.map +1 -1
- package/dist/delegation/conversations.d.ts +41 -2129
- package/dist/delegation/conversations.js +108 -113
- package/dist/delegation/conversations.js.map +1 -1
- package/dist/delegation/execution-identity.d.ts +83 -67
- package/dist/delegation/execution-identity.js +244 -67
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/execution-settings.d.ts +1 -2
- package/dist/delegation/execution-settings.js.map +1 -1
- package/dist/delegation/family-end.d.ts +16 -0
- package/dist/delegation/family-end.js +114 -0
- package/dist/delegation/family-end.js.map +1 -0
- package/dist/delegation/identity-file-store.d.ts +1 -1
- package/dist/delegation/input.js.map +1 -1
- package/dist/delegation/owned-workspace-release.d.ts +8 -0
- package/dist/delegation/owned-workspace-release.js +9 -0
- package/dist/delegation/owned-workspace-release.js.map +1 -0
- package/dist/delegation/park-notice.d.ts +44 -10
- package/dist/delegation/park-notice.js +53 -17
- package/dist/delegation/park-notice.js.map +1 -1
- package/dist/delegation/policy.d.ts +26 -8
- package/dist/delegation/policy.js +60 -37
- package/dist/delegation/policy.js.map +1 -1
- package/dist/delegation/private-record-file.d.ts +7 -0
- package/dist/delegation/private-record-file.js +55 -0
- package/dist/delegation/private-record-file.js.map +1 -0
- package/dist/delegation/process-liveness.d.ts +9 -76
- package/dist/delegation/process-liveness.js +6 -145
- package/dist/delegation/process-liveness.js.map +1 -1
- package/dist/delegation/provision.d.ts +6 -4
- package/dist/delegation/provision.js +76 -46
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/questions.d.ts +16 -1
- package/dist/delegation/questions.js +31 -0
- package/dist/delegation/questions.js.map +1 -1
- package/dist/delegation/readiness.d.ts +4 -2
- package/dist/delegation/readiness.js +9 -7
- package/dist/delegation/readiness.js.map +1 -1
- package/dist/delegation/receipt-cache.d.ts +9 -0
- package/dist/delegation/receipt-cache.js +26 -0
- package/dist/delegation/receipt-cache.js.map +1 -0
- package/dist/delegation/removal-slot.d.ts +4 -0
- package/dist/delegation/removal-slot.js +20 -0
- package/dist/delegation/removal-slot.js.map +1 -0
- package/dist/delegation/results.d.ts +10 -2
- package/dist/delegation/results.js +40 -22
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/retry-backoff.d.ts +7 -1
- package/dist/delegation/retry-backoff.js +6 -0
- package/dist/delegation/retry-backoff.js.map +1 -1
- package/dist/delegation/routes.d.ts +149 -29
- package/dist/delegation/routes.js +6 -6
- package/dist/delegation/routes.js.map +1 -1
- package/dist/delegation/scratch-cleanup.d.ts +1 -1
- package/dist/delegation/scratch-cleanup.js +18 -18
- package/dist/delegation/scratch-cleanup.js.map +1 -1
- package/dist/delegation/service.d.ts +50 -19
- package/dist/delegation/service.js +326 -182
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/shared-workspace.d.ts +25 -0
- package/dist/delegation/shared-workspace.js +100 -0
- package/dist/delegation/shared-workspace.js.map +1 -0
- package/dist/delegation/task-discovery.js +9 -5
- package/dist/delegation/task-discovery.js.map +1 -1
- package/dist/delegation/transport.d.ts +141 -21
- package/dist/delegation/wait-kinds.d.ts +8 -0
- package/dist/delegation/wait-kinds.js +317 -0
- package/dist/delegation/wait-kinds.js.map +1 -0
- package/dist/delegation/windows-identity-store.d.ts +1 -1
- package/dist/delegation/windows-identity-store.js +1 -1
- package/dist/delegation/windows-identity-store.js.map +1 -1
- package/dist/delegation/worker-cleanup.d.ts +46 -11
- package/dist/delegation/worker-cleanup.js +260 -102
- package/dist/delegation/worker-cleanup.js.map +1 -1
- package/dist/delegation/worker-deletion-proof.d.ts +13 -0
- package/dist/delegation/worker-deletion-proof.js.map +1 -0
- package/dist/delegation/worker-executions.d.ts +72 -0
- package/dist/delegation/worker-executions.js +252 -0
- package/dist/delegation/worker-executions.js.map +1 -0
- package/dist/delegation/worker-resource-holders.d.ts +20 -0
- package/dist/delegation/worker-resource-holders.js +18 -0
- package/dist/delegation/worker-resource-holders.js.map +1 -0
- package/dist/delegation/workspace-git.d.ts +16 -0
- package/dist/delegation/workspace-git.js +61 -0
- package/dist/delegation/workspace-git.js.map +1 -0
- package/dist/delegation/workspace-kinds.d.ts +75 -0
- package/dist/delegation/workspace-kinds.js +122 -0
- package/dist/delegation/workspace-kinds.js.map +1 -0
- package/dist/delegation/workspace-record.d.ts +69 -0
- package/dist/delegation/workspace-record.js +124 -0
- package/dist/delegation/workspace-record.js.map +1 -0
- package/dist/delegation/workspace-removal.d.ts +28 -0
- package/dist/delegation/workspace-removal.js +376 -0
- package/dist/delegation/workspace-removal.js.map +1 -0
- package/dist/delegation/workspace-state.d.ts +65 -0
- package/dist/delegation/workspace-state.js +270 -0
- package/dist/delegation/workspace-state.js.map +1 -0
- package/dist/delegation/workspace-work.d.ts +35 -0
- package/dist/delegation/workspace-work.js +75 -0
- package/dist/delegation/workspace-work.js.map +1 -0
- package/dist/delegation/workspace.d.ts +5 -32
- package/dist/delegation/workspace.js +13 -417
- package/dist/delegation/workspace.js.map +1 -1
- package/dist/delegation/worktree-teardown.d.ts +8 -0
- package/dist/delegation/worktree-teardown.js +36 -0
- package/dist/delegation/worktree-teardown.js.map +1 -0
- package/dist/detached-process.d.ts +4 -43
- package/dist/detached-process.js +4 -210
- package/dist/detached-process.js.map +1 -1
- package/dist/discovery/catalog.d.ts +2 -9
- package/dist/discovery/catalog.js +1 -18
- package/dist/discovery/catalog.js.map +1 -1
- package/dist/discovery/choices.d.ts +10 -0
- package/dist/discovery/choices.js +21 -0
- package/dist/discovery/choices.js.map +1 -0
- package/dist/discovery/cli.d.ts +2 -0
- package/dist/discovery/cli.js +7 -2
- package/dist/discovery/cli.js.map +1 -1
- package/dist/features/jobs/cli.d.ts +4 -0
- package/dist/features/jobs/cli.js +79 -0
- package/dist/features/jobs/cli.js.map +1 -0
- package/dist/features/jobs/command.d.ts +9 -0
- package/dist/features/jobs/command.js +19 -0
- package/dist/features/jobs/command.js.map +1 -0
- package/dist/features/jobs/index.d.ts +11 -0
- package/dist/features/jobs/index.js +20 -0
- package/dist/features/jobs/index.js.map +1 -0
- package/dist/features/jobs/job.d.ts +107 -0
- package/dist/features/jobs/job.js +388 -0
- package/dist/features/jobs/job.js.map +1 -0
- package/dist/features/jobs/removal-slot.d.ts +14 -0
- package/dist/features/jobs/removal-slot.js +50 -0
- package/dist/features/jobs/removal-slot.js.map +1 -0
- package/dist/features/mcp/cli.d.ts +14 -0
- package/dist/features/mcp/cli.js +87 -0
- package/dist/features/mcp/cli.js.map +1 -0
- package/dist/features/mcp/index.d.ts +9 -0
- package/dist/features/mcp/index.js +13 -0
- package/dist/features/mcp/index.js.map +1 -0
- package/dist/features/mcp/stdio.d.ts +10 -0
- package/dist/features/mcp/stdio.js +41 -0
- package/dist/features/mcp/stdio.js.map +1 -0
- package/dist/features/mcp/tools.d.ts +19 -0
- package/dist/features/mcp/tools.js +476 -0
- package/dist/features/mcp/tools.js.map +1 -0
- package/dist/git-command.d.ts +43 -2
- package/dist/git-command.js +57 -4
- package/dist/git-command.js.map +1 -1
- package/dist/git-diff-base.d.ts +1 -1
- package/dist/git-private-index.js +1 -2
- package/dist/git-private-index.js.map +1 -1
- package/dist/git-refs.d.ts +1 -1
- package/dist/git-refs.js +1 -1
- package/dist/git-worktree-lock-helper.d.ts +23 -0
- package/dist/git-worktree-lock-helper.js +152 -30
- package/dist/git-worktree-lock-helper.js.map +1 -1
- package/dist/git-worktree-lock.d.ts +21 -4
- package/dist/git-worktree-lock.js +23 -14
- package/dist/git-worktree-lock.js.map +1 -1
- package/dist/git-worktree-release.d.ts +5 -9
- package/dist/git-worktree-release.js +5 -10
- package/dist/git-worktree-release.js.map +1 -1
- package/dist/git-worktree.d.ts +22 -55
- package/dist/git-worktree.js +225 -405
- package/dist/git-worktree.js.map +1 -1
- package/dist/handoff.d.ts +6 -6
- package/dist/handoff.js +18 -17
- package/dist/handoff.js.map +1 -1
- package/dist/headless-run.d.ts +4 -1
- package/dist/headless-run.js +27 -12
- package/dist/headless-run.js.map +1 -1
- package/dist/home/backup-args.d.ts +22 -0
- package/dist/home/backup-args.js +38 -0
- package/dist/home/backup-args.js.map +1 -0
- package/dist/home/boundary.js +4 -4
- package/dist/home/boundary.js.map +1 -1
- package/dist/home/command.d.ts +4 -4
- package/dist/home/command.js +9 -15
- package/dist/home/command.js.map +1 -1
- package/dist/home/deprecation.d.ts +2 -4
- package/dist/home/deprecation.js +2 -3
- package/dist/home/deprecation.js.map +1 -1
- package/dist/home/entry.d.ts +2 -4
- package/dist/home/entry.js +12 -12
- package/dist/home/entry.js.map +1 -1
- package/dist/home/home.d.ts +3 -4
- package/dist/home/home.js +5 -10
- package/dist/home/home.js.map +1 -1
- package/dist/home/identity.d.ts +5 -10
- package/dist/home/identity.js +3 -7
- package/dist/home/identity.js.map +1 -1
- package/dist/home/install-marker.js +6 -7
- package/dist/home/install-marker.js.map +1 -1
- package/dist/home/leases.js +1 -1
- package/dist/home/leases.js.map +1 -1
- package/dist/home/legacy-account-paths.js +0 -3
- package/dist/home/legacy-account-paths.js.map +1 -1
- package/dist/home/legacy-recovery.d.ts +2 -2
- package/dist/home/legacy-recovery.js +4 -9
- package/dist/home/legacy-recovery.js.map +1 -1
- package/dist/home/legacy-source.d.ts +2 -3
- package/dist/home/legacy-source.js +3 -6
- package/dist/home/legacy-source.js.map +1 -1
- package/dist/home/migrate.d.ts +1 -1
- package/dist/home/migrate.js +32 -19
- package/dist/home/migrate.js.map +1 -1
- package/dist/home/migration-accounts.d.ts +0 -2
- package/dist/home/migration-accounts.js +2 -11
- package/dist/home/migration-accounts.js.map +1 -1
- package/dist/home/migration-boot.d.ts +1 -2
- package/dist/home/migration-boot.js +5 -9
- package/dist/home/migration-boot.js.map +1 -1
- package/dist/home/migration-claim.js +1 -1
- package/dist/home/migration-claim.js.map +1 -1
- package/dist/home/migration-cli.js +4 -3
- package/dist/home/migration-cli.js.map +1 -1
- package/dist/home/migration-guard.js +1 -2
- package/dist/home/migration-guard.js.map +1 -1
- package/dist/home/migration-plan.d.ts +1 -1
- package/dist/home/migration-plan.js +5 -6
- package/dist/home/migration-plan.js.map +1 -1
- package/dist/home/private-files.js +3 -4
- package/dist/home/private-files.js.map +1 -1
- package/dist/home/process-identity.js +1 -1
- package/dist/home/process-identity.js.map +1 -1
- package/dist/home/protected-roots.d.ts +1 -1
- package/dist/home/protected-roots.js +3 -4
- package/dist/home/protected-roots.js.map +1 -1
- package/dist/home/recovery-watch.d.ts +1 -1
- package/dist/home/recovery-watch.js +3 -4
- package/dist/home/recovery-watch.js.map +1 -1
- package/dist/home/recovery.d.ts +3 -4
- package/dist/home/recovery.js +7 -9
- package/dist/home/recovery.js.map +1 -1
- package/dist/home/resolve.js +1 -2
- package/dist/home/resolve.js.map +1 -1
- package/dist/home/store.js +2 -2
- package/dist/home/store.js.map +1 -1
- package/dist/home/write-lock.js +1 -1
- package/dist/home/write-lock.js.map +1 -1
- package/dist/index.js +45 -30
- package/dist/index.js.map +1 -1
- package/dist/install-as-command.d.ts +1 -1
- package/dist/legacy-runs.d.ts +57 -0
- package/dist/legacy-runs.js +135 -0
- package/dist/legacy-runs.js.map +1 -0
- package/dist/managed-install/cli-archive.d.ts +4 -0
- package/dist/managed-install/cli-archive.js +89 -0
- package/dist/managed-install/cli-archive.js.map +1 -0
- package/dist/managed-install/cli-installation.d.ts +26 -0
- package/dist/managed-install/cli-installation.js +119 -0
- package/dist/managed-install/cli-installation.js.map +1 -0
- package/dist/managed-install/cli-manifest.d.ts +33 -0
- package/dist/managed-install/cli-manifest.js +57 -0
- package/dist/managed-install/cli-manifest.js.map +1 -0
- package/dist/managed-install/cli-storage.d.ts +45 -0
- package/dist/managed-install/cli-storage.js +212 -0
- package/dist/managed-install/cli-storage.js.map +1 -0
- package/dist/managed-install/launcher.d.ts +16 -0
- package/dist/managed-install/launcher.js +139 -0
- package/dist/managed-install/launcher.js.map +1 -0
- package/dist/managed-install/layout.d.ts +34 -0
- package/dist/managed-install/layout.js +43 -0
- package/dist/managed-install/layout.js.map +1 -0
- package/dist/managed-install/runtime-home.d.ts +8 -0
- package/dist/managed-install/runtime-home.js +14 -0
- package/dist/managed-install/runtime-home.js.map +1 -0
- package/dist/pack-check.d.ts +13 -1
- package/dist/pack-check.js +40 -1
- package/dist/pack-check.js.map +1 -1
- package/dist/paths.d.ts +16 -21
- package/dist/paths.js +38 -57
- package/dist/paths.js.map +1 -1
- package/dist/planner.d.ts +3 -10
- package/dist/planner.js +24 -78
- package/dist/planner.js.map +1 -1
- package/dist/plugin/acp.d.ts +15 -0
- package/dist/plugin/acp.js +12 -0
- package/dist/plugin/acp.js.map +1 -0
- package/dist/plugin/api.d.ts +46 -0
- package/dist/plugin/api.js +155 -0
- package/dist/plugin/api.js.map +1 -0
- package/dist/plugin/bundled-features.d.ts +11 -0
- package/dist/plugin/bundled-features.js +37 -0
- package/dist/plugin/bundled-features.js.map +1 -0
- package/dist/plugin/bundled-runners.d.ts +28 -0
- package/dist/plugin/bundled-runners.js +57 -0
- package/dist/plugin/bundled-runners.js.map +1 -0
- package/dist/plugin/cli.d.ts +5 -0
- package/dist/plugin/cli.js +55 -0
- package/dist/plugin/cli.js.map +1 -0
- package/dist/plugin/index.d.ts +14 -0
- package/dist/plugin/index.js +2 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/loader.d.ts +81 -0
- package/dist/plugin/loader.js +187 -0
- package/dist/plugin/loader.js.map +1 -0
- package/dist/plugin/managed-cli.d.ts +8 -0
- package/dist/plugin/managed-cli.js +9 -0
- package/dist/plugin/managed-cli.js.map +1 -0
- package/dist/plugin/model-settings.d.ts +8 -0
- package/dist/plugin/model-settings.js +8 -0
- package/dist/plugin/model-settings.js.map +1 -0
- package/dist/plugin/pi-rpc.d.ts +8 -0
- package/dist/plugin/pi-rpc.js +8 -0
- package/dist/plugin/pi-rpc.js.map +1 -0
- package/dist/plugin/resolve-hook.d.ts +21 -0
- package/dist/plugin/resolve-hook.js +53 -0
- package/dist/plugin/resolve-hook.js.map +1 -0
- package/dist/plugin/runner-kit.d.ts +41 -0
- package/dist/plugin/runner-kit.js +23 -0
- package/dist/plugin/runner-kit.js.map +1 -0
- package/dist/plugin/runtime.d.ts +38 -0
- package/dist/plugin/runtime.js +39 -0
- package/dist/plugin/runtime.js.map +1 -0
- package/dist/preview/agent-address.d.ts +1 -1
- package/dist/preview/agent-address.js +3 -3
- package/dist/preview/agent-address.js.map +1 -1
- package/dist/preview/agent-marker.js +11 -8
- package/dist/preview/agent-marker.js.map +1 -1
- package/dist/preview/agent-tools.d.ts +2 -0
- package/dist/preview/agent-tools.js +18 -0
- package/dist/preview/agent-tools.js.map +1 -0
- package/dist/preview/browser-launch.d.ts +2 -1
- package/dist/preview/browser-launch.js +16 -9
- package/dist/preview/browser-launch.js.map +1 -1
- package/dist/preview/cdp-proxy.d.ts +2 -2
- package/dist/preview/cdp-proxy.js +6 -7
- package/dist/preview/cdp-proxy.js.map +1 -1
- package/dist/preview/cdp.d.ts +4 -2
- package/dist/preview/cdp.js +43 -4
- package/dist/preview/cdp.js.map +1 -1
- package/dist/preview/chromium.d.ts +9 -5
- package/dist/preview/chromium.js +45 -14
- package/dist/preview/chromium.js.map +1 -1
- package/dist/preview/dev-server.d.ts +5 -2
- package/dist/preview/dev-server.js +84 -20
- package/dist/preview/dev-server.js.map +1 -1
- package/dist/preview/host.d.ts +17 -10
- package/dist/preview/host.js +31 -24
- package/dist/preview/host.js.map +1 -1
- package/dist/preview/registration.d.ts +1 -1
- package/dist/preview/registration.js +6 -6
- package/dist/preview/registration.js.map +1 -1
- package/dist/preview/run-tools.d.ts +3 -2
- package/dist/preview/run-tools.js +9 -8
- package/dist/preview/run-tools.js.map +1 -1
- package/dist/preview/session.js +13 -7
- package/dist/preview/session.js.map +1 -1
- package/dist/preview/tool-catalog.d.ts +146 -0
- package/dist/preview/tool-catalog.js +14 -0
- package/dist/preview/tool-catalog.js.map +1 -0
- package/dist/preview/tool-client.d.ts +8 -0
- package/dist/preview/tool-client.js +16 -0
- package/dist/preview/tool-client.js.map +1 -0
- package/dist/preview/tool-env.d.ts +2 -0
- package/dist/preview/tool-env.js +4 -0
- package/dist/preview/tool-env.js.map +1 -0
- package/dist/preview/tool-errors.d.ts +7 -0
- package/dist/preview/tool-errors.js +36 -0
- package/dist/preview/tool-errors.js.map +1 -0
- package/dist/preview/tool-session.d.ts +6 -0
- package/dist/preview/tool-session.js +9 -0
- package/dist/preview/tool-session.js.map +1 -0
- package/dist/preview/tools.d.ts +57 -0
- package/dist/preview/tools.js +18 -0
- package/dist/preview/tools.js.map +1 -0
- package/dist/process-wait/exit-file.d.ts +14 -9
- package/dist/process-wait/exit-file.js +23 -10
- package/dist/process-wait/exit-file.js.map +1 -1
- package/dist/process-wait/job-exit-file.d.ts +15 -0
- package/dist/process-wait/job-exit-file.js +49 -0
- package/dist/process-wait/job-exit-file.js.map +1 -0
- package/dist/process-wait/supervisor.d.ts +2 -2
- package/dist/process-wait/supervisor.js +12 -9
- package/dist/process-wait/supervisor.js.map +1 -1
- package/dist/project-commands.d.ts +1 -1
- package/dist/project-commands.js +4 -19
- package/dist/project-commands.js.map +1 -1
- package/dist/project-fence.d.ts +63 -0
- package/dist/project-fence.js +145 -0
- package/dist/project-fence.js.map +1 -0
- package/dist/project-migration/answer.d.ts +2 -0
- package/dist/project-migration/answer.js +7 -5
- package/dist/project-migration/answer.js.map +1 -1
- package/dist/project-migration/auto.d.ts +17 -14
- package/dist/project-migration/auto.js +72 -50
- package/dist/project-migration/auto.js.map +1 -1
- package/dist/project-migration/cli.js +3 -2
- package/dist/project-migration/cli.js.map +1 -1
- package/dist/project-migration/containment.d.ts +1 -1
- package/dist/project-migration/containment.js +7 -7
- package/dist/project-migration/containment.js.map +1 -1
- package/dist/project-migration/engine.d.ts +13 -1
- package/dist/project-migration/engine.js +19 -2
- package/dist/project-migration/engine.js.map +1 -1
- package/dist/project-migration/fresh.d.ts +1 -1
- package/dist/project-migration/fresh.js +2 -3
- package/dist/project-migration/fresh.js.map +1 -1
- package/dist/project-migration/journal.d.ts +8 -2
- package/dist/project-migration/journal.js +9 -2
- package/dist/project-migration/journal.js.map +1 -1
- package/dist/project-migration/live.d.ts +30 -5
- package/dist/project-migration/live.js +107 -8
- package/dist/project-migration/live.js.map +1 -1
- package/dist/project-migration/offline.d.ts +6 -4
- package/dist/project-migration/offline.js +8 -6
- package/dist/project-migration/offline.js.map +1 -1
- package/dist/project-migration/pending.d.ts +10 -0
- package/dist/project-migration/pending.js +57 -0
- package/dist/project-migration/pending.js.map +1 -0
- package/dist/project-migration/plan.d.ts +31 -2
- package/dist/project-migration/plan.js +154 -41
- package/dist/project-migration/plan.js.map +1 -1
- package/dist/project-migration/steps.js +63 -5
- package/dist/project-migration/steps.js.map +1 -1
- package/dist/project-paths.d.ts +10 -9
- package/dist/project-paths.js +24 -17
- package/dist/project-paths.js.map +1 -1
- package/dist/release/compatibility.d.ts +2 -2
- package/dist/release/compatibility.js +4 -4
- package/dist/release/compatibility.js.map +1 -1
- package/dist/release/manifests.d.ts +8 -18
- package/dist/release/manifests.js +14 -42
- package/dist/release/manifests.js.map +1 -1
- package/dist/release/publication.js +2 -2
- package/dist/release/publication.js.map +1 -1
- package/dist/release/snapshot.d.ts +3 -3
- package/dist/release/snapshot.js +3 -3
- package/dist/release/stable.d.ts +21 -2
- package/dist/release/stable.js +27 -2
- package/dist/release/stable.js.map +1 -1
- package/dist/remote-settings-cli.d.ts +5 -3
- package/dist/remote-settings-cli.js +10 -8
- package/dist/remote-settings-cli.js.map +1 -1
- package/dist/remote-settings.d.ts +1 -1
- package/dist/runners/antigravity/account-home.d.ts +3 -0
- package/dist/runners/antigravity/account-home.js +45 -0
- package/dist/runners/antigravity/account-home.js.map +1 -0
- package/dist/runners/antigravity/accounts.d.ts +14 -0
- package/dist/runners/antigravity/accounts.js +6 -0
- package/dist/runners/antigravity/accounts.js.map +1 -0
- package/dist/runners/antigravity/antigravity-model-catalog.d.ts +9 -0
- package/dist/runners/antigravity/antigravity-model-catalog.js +79 -0
- package/dist/runners/antigravity/antigravity-model-catalog.js.map +1 -0
- package/dist/runners/antigravity/antigravity-runner.d.ts +48 -0
- package/dist/runners/antigravity/antigravity-runner.js +29 -0
- package/dist/runners/antigravity/antigravity-runner.js.map +1 -0
- package/dist/runners/antigravity/antigravity-session.d.ts +115 -0
- package/dist/runners/antigravity/antigravity-session.js +702 -0
- package/dist/runners/antigravity/antigravity-session.js.map +1 -0
- package/dist/runners/antigravity/antigravity-skill-catalog.d.ts +9 -0
- package/dist/runners/antigravity/antigravity-skill-catalog.js +174 -0
- package/dist/runners/antigravity/antigravity-skill-catalog.js.map +1 -0
- package/dist/runners/antigravity/antigravity-ui-mapper.d.ts +17 -0
- package/dist/runners/antigravity/antigravity-ui-mapper.js +76 -0
- package/dist/runners/antigravity/antigravity-ui-mapper.js.map +1 -0
- package/dist/runners/antigravity/ask-question.d.ts +9 -0
- package/dist/runners/antigravity/ask-question.js +37 -0
- package/dist/runners/antigravity/ask-question.js.map +1 -0
- package/dist/runners/antigravity/browser-sign-in.d.ts +10 -0
- package/dist/runners/antigravity/browser-sign-in.js +127 -0
- package/dist/runners/antigravity/browser-sign-in.js.map +1 -0
- package/dist/runners/antigravity/cli.d.ts +23 -0
- package/dist/runners/antigravity/cli.js +31 -0
- package/dist/runners/antigravity/cli.js.map +1 -0
- package/dist/runners/antigravity/client-files.d.ts +5 -0
- package/dist/runners/antigravity/client-files.js +20 -0
- package/dist/runners/antigravity/client-files.js.map +1 -0
- package/dist/runners/antigravity/config-files.d.ts +2 -0
- package/dist/runners/antigravity/config-files.js +8 -0
- package/dist/runners/antigravity/config-files.js.map +1 -0
- package/dist/runners/antigravity/definition.d.ts +1 -0
- package/dist/runners/antigravity/definition.js +31 -0
- package/dist/runners/antigravity/definition.js.map +1 -0
- package/dist/runners/antigravity/detection.d.ts +14 -0
- package/dist/runners/antigravity/detection.js +12 -0
- package/dist/runners/antigravity/detection.js.map +1 -0
- package/dist/runners/antigravity/display.d.ts +11 -0
- package/dist/runners/antigravity/display.js +7 -0
- package/dist/runners/antigravity/display.js.map +1 -0
- package/dist/runners/antigravity/env.d.ts +3 -0
- package/dist/runners/antigravity/env.js +2 -0
- package/dist/runners/antigravity/env.js.map +1 -0
- package/dist/runners/antigravity/executable.d.ts +45 -0
- package/dist/runners/antigravity/executable.js +183 -0
- package/dist/runners/antigravity/executable.js.map +1 -0
- package/dist/runners/antigravity/extra-tools.d.ts +1 -0
- package/dist/runners/antigravity/extra-tools.js +2 -0
- package/dist/runners/antigravity/extra-tools.js.map +1 -0
- package/dist/runners/antigravity/facts.d.ts +26 -0
- package/dist/runners/antigravity/facts.js +25 -0
- package/dist/runners/antigravity/facts.js.map +1 -0
- package/dist/runners/antigravity/http-mcp.d.ts +14 -0
- package/dist/runners/antigravity/http-mcp.js +82 -0
- package/dist/runners/antigravity/http-mcp.js.map +1 -0
- package/dist/runners/antigravity/index.d.ts +6 -0
- package/dist/runners/antigravity/index.js +9 -0
- package/dist/runners/antigravity/index.js.map +1 -0
- package/dist/runners/antigravity/launch-args.d.ts +4 -0
- package/dist/runners/antigravity/launch-args.js +7 -0
- package/dist/runners/antigravity/launch-args.js.map +1 -0
- package/dist/runners/antigravity/login-probe.d.ts +9 -0
- package/dist/runners/antigravity/login-probe.js +55 -0
- package/dist/runners/antigravity/login-probe.js.map +1 -0
- package/dist/runners/antigravity/login.d.ts +5 -0
- package/dist/runners/antigravity/login.js +5 -0
- package/dist/runners/antigravity/login.js.map +1 -0
- package/dist/runners/antigravity/mcp-name.d.ts +2 -0
- package/dist/runners/antigravity/mcp-name.js +3 -0
- package/dist/runners/antigravity/mcp-name.js.map +1 -0
- package/dist/runners/antigravity/mock.d.ts +155 -0
- package/dist/runners/antigravity/mock.js +35 -0
- package/dist/runners/antigravity/mock.js.map +1 -0
- package/dist/runners/antigravity/model-settings.d.ts +2 -0
- package/dist/runners/antigravity/model-settings.js +4 -0
- package/dist/runners/antigravity/model-settings.js.map +1 -0
- package/dist/runners/antigravity/models.d.ts +5 -0
- package/dist/runners/antigravity/models.js +15 -0
- package/dist/runners/antigravity/models.js.map +1 -0
- package/dist/runners/antigravity/native-diagnostics.d.ts +4 -0
- package/dist/runners/antigravity/native-diagnostics.js +59 -0
- package/dist/runners/antigravity/native-diagnostics.js.map +1 -0
- package/dist/runners/antigravity/permissions.d.ts +4 -0
- package/dist/runners/antigravity/permissions.js +42 -0
- package/dist/runners/antigravity/permissions.js.map +1 -0
- package/dist/runners/antigravity/probe-process.d.ts +27 -0
- package/dist/runners/antigravity/probe-process.js +84 -0
- package/dist/runners/antigravity/probe-process.js.map +1 -0
- package/dist/runners/antigravity/runtime-env.d.ts +8 -0
- package/dist/runners/antigravity/runtime-env.js +30 -0
- package/dist/runners/antigravity/runtime-env.js.map +1 -0
- package/dist/runners/antigravity/spec-support.d.ts +2 -0
- package/dist/runners/antigravity/spec-support.js +23 -0
- package/dist/runners/antigravity/spec-support.js.map +1 -0
- package/dist/runners/antigravity/subagent-tracker.d.ts +50 -0
- package/dist/runners/antigravity/subagent-tracker.js +152 -0
- package/dist/runners/antigravity/subagent-tracker.js.map +1 -0
- package/dist/runners/antigravity/subagent-transcript.d.ts +41 -0
- package/dist/runners/antigravity/subagent-transcript.js +185 -0
- package/dist/runners/antigravity/subagent-transcript.js.map +1 -0
- package/dist/runners/antigravity/tool-normalization.d.ts +15 -0
- package/dist/runners/antigravity/tool-normalization.js +104 -0
- package/dist/runners/antigravity/tool-normalization.js.map +1 -0
- package/dist/runners/antigravity/tool-transcript.d.ts +85 -0
- package/dist/runners/antigravity/tool-transcript.js +274 -0
- package/dist/runners/antigravity/tool-transcript.js.map +1 -0
- package/dist/runners/antigravity/transcript-tailer.d.ts +56 -0
- package/dist/runners/antigravity/transcript-tailer.js +175 -0
- package/dist/runners/antigravity/transcript-tailer.js.map +1 -0
- package/dist/runners/antigravity/usage.d.ts +2 -0
- package/dist/runners/antigravity/usage.js +14 -0
- package/dist/runners/antigravity/usage.js.map +1 -0
- package/dist/runners/antigravity/wire-updates.d.ts +14 -0
- package/dist/runners/antigravity/wire-updates.js +50 -0
- package/dist/runners/antigravity/wire-updates.js.map +1 -0
- package/dist/runners/claude/accounts.d.ts +11 -0
- package/dist/runners/claude/accounts.js +10 -0
- package/dist/runners/claude/accounts.js.map +1 -0
- package/dist/runners/claude/claude-cli-runner.d.ts +89 -0
- package/dist/runners/claude/claude-cli-runner.js +895 -0
- package/dist/runners/claude/claude-cli-runner.js.map +1 -0
- package/dist/runners/claude/claude-executable.js +9 -0
- package/dist/runners/claude/claude-executable.js.map +1 -0
- package/dist/runners/claude/claude-forked-command.d.ts +36 -0
- package/dist/runners/claude/claude-forked-command.js +65 -0
- package/dist/runners/claude/claude-forked-command.js.map +1 -0
- package/dist/runners/claude/claude-model-catalog.d.ts +16 -0
- package/dist/runners/claude/claude-model-catalog.js +196 -0
- package/dist/runners/claude/claude-model-catalog.js.map +1 -0
- package/dist/runners/claude/claude-partial-messages.d.ts +32 -0
- package/dist/runners/claude/claude-partial-messages.js +129 -0
- package/dist/runners/claude/claude-partial-messages.js.map +1 -0
- package/dist/runners/claude/claude-setting-sources.d.ts +2 -0
- package/dist/runners/claude/claude-setting-sources.js +7 -0
- package/dist/runners/claude/claude-setting-sources.js.map +1 -0
- package/dist/runners/claude/claude-skill-catalog.d.ts +3 -0
- package/dist/runners/claude/claude-skill-catalog.js +30 -0
- package/dist/runners/claude/claude-skill-catalog.js.map +1 -0
- package/dist/runners/claude/claude-stream.d.ts +39 -0
- package/dist/runners/claude/claude-stream.js +108 -0
- package/dist/runners/claude/claude-stream.js.map +1 -0
- package/dist/runners/claude/claude-ui-mapper.d.ts +90 -0
- package/dist/runners/claude/claude-ui-mapper.js +878 -0
- package/dist/runners/claude/claude-ui-mapper.js.map +1 -0
- package/dist/runners/claude/cli.d.ts +15 -0
- package/dist/runners/claude/cli.js +8 -0
- package/dist/runners/claude/cli.js.map +1 -0
- package/dist/runners/claude/config-files.d.ts +10 -0
- package/dist/runners/claude/config-files.js +122 -0
- package/dist/runners/claude/config-files.js.map +1 -0
- package/dist/runners/claude/definition.d.ts +2 -0
- package/dist/runners/claude/definition.js +42 -0
- package/dist/runners/claude/definition.js.map +1 -0
- package/dist/runners/claude/detection.d.ts +12 -0
- package/dist/runners/claude/detection.js +17 -0
- package/dist/runners/claude/detection.js.map +1 -0
- package/dist/runners/claude/display.d.ts +12 -0
- package/dist/runners/claude/display.js +13 -0
- package/dist/runners/claude/display.js.map +1 -0
- package/dist/runners/claude/env.d.ts +4 -0
- package/dist/runners/claude/env.js +3 -0
- package/dist/runners/claude/env.js.map +1 -0
- package/dist/runners/claude/extra-tools.d.ts +3 -0
- package/dist/runners/claude/extra-tools.js +4 -0
- package/dist/runners/claude/extra-tools.js.map +1 -0
- package/dist/runners/claude/facts.d.ts +28 -0
- package/dist/runners/claude/facts.js +25 -0
- package/dist/runners/claude/facts.js.map +1 -0
- package/dist/runners/claude/index.d.ts +6 -0
- package/dist/runners/claude/index.js +9 -0
- package/dist/runners/claude/index.js.map +1 -0
- package/dist/runners/claude/login-probe.d.ts +4 -0
- package/dist/runners/claude/login-probe.js +16 -0
- package/dist/runners/claude/login-probe.js.map +1 -0
- package/dist/runners/claude/login.d.ts +7 -0
- package/dist/runners/claude/login.js +8 -0
- package/dist/runners/claude/login.js.map +1 -0
- package/dist/runners/claude/mock.d.ts +99 -0
- package/dist/runners/claude/mock.js +78 -0
- package/dist/runners/claude/mock.js.map +1 -0
- package/dist/runners/claude/model-settings.d.ts +2 -0
- package/dist/runners/claude/model-settings.js +11 -0
- package/dist/runners/claude/model-settings.js.map +1 -0
- package/dist/runners/claude/models.d.ts +3 -0
- package/dist/runners/claude/models.js +23 -0
- package/dist/runners/claude/models.js.map +1 -0
- package/dist/runners/claude/spec-support.d.ts +8 -0
- package/dist/runners/claude/spec-support.js +30 -0
- package/dist/runners/claude/spec-support.js.map +1 -0
- package/dist/runners/codex/accounts.d.ts +11 -0
- package/dist/runners/codex/accounts.js +8 -0
- package/dist/runners/codex/accounts.js.map +1 -0
- package/dist/runners/codex/cli.d.ts +15 -0
- package/dist/runners/codex/cli.js +8 -0
- package/dist/runners/codex/cli.js.map +1 -0
- package/dist/runners/codex/codex-app-server-runner.d.ts +62 -0
- package/dist/runners/codex/codex-app-server-runner.js +1230 -0
- package/dist/runners/codex/codex-app-server-runner.js.map +1 -0
- package/dist/runners/codex/codex-app-server-transport.d.ts +55 -0
- package/dist/runners/codex/codex-app-server-transport.js +198 -0
- package/dist/runners/codex/codex-app-server-transport.js.map +1 -0
- package/dist/runners/codex/codex-approvals.d.ts +12 -0
- package/dist/runners/codex/codex-approvals.js +180 -0
- package/dist/runners/codex/codex-approvals.js.map +1 -0
- package/dist/runners/codex/codex-hook-mapper.d.ts +15 -0
- package/dist/runners/codex/codex-hook-mapper.js +72 -0
- package/dist/runners/codex/codex-hook-mapper.js.map +1 -0
- package/dist/runners/codex/codex-model-catalog.d.ts +10 -0
- package/dist/runners/codex/codex-model-catalog.js +110 -0
- package/dist/runners/codex/codex-model-catalog.js.map +1 -0
- package/dist/runners/codex/codex-native-frames.d.ts +35 -0
- package/dist/runners/codex/codex-native-frames.js +80 -0
- package/dist/runners/codex/codex-native-frames.js.map +1 -0
- package/dist/runners/codex/codex-permissions.d.ts +13 -0
- package/dist/runners/codex/codex-permissions.js +34 -0
- package/dist/runners/codex/codex-permissions.js.map +1 -0
- package/dist/runners/codex/codex-skill-catalog.d.ts +3 -0
- package/dist/runners/codex/codex-skill-catalog.js +36 -0
- package/dist/runners/codex/codex-skill-catalog.js.map +1 -0
- package/dist/runners/codex/codex-stream-error.js.map +1 -0
- package/dist/runners/codex/codex-thread-config.d.ts +18 -0
- package/dist/runners/codex/codex-thread-config.js +30 -0
- package/dist/runners/codex/codex-thread-config.js.map +1 -0
- package/dist/runners/codex/codex-turn-config.d.ts +19 -0
- package/dist/runners/codex/codex-turn-config.js +30 -0
- package/dist/runners/codex/codex-turn-config.js.map +1 -0
- package/dist/runners/codex/codex-turn-outcome.d.ts +10 -0
- package/dist/runners/codex/codex-turn-outcome.js +35 -0
- package/dist/runners/codex/codex-turn-outcome.js.map +1 -0
- package/dist/runners/codex/codex-ui-mapper-state.d.ts +84 -0
- package/dist/runners/codex/codex-ui-mapper-state.js.map +1 -0
- package/dist/runners/codex/codex-ui-mapper.d.ts +44 -0
- package/dist/runners/codex/codex-ui-mapper.js +799 -0
- package/dist/runners/codex/codex-ui-mapper.js.map +1 -0
- package/dist/runners/codex/config-files.d.ts +10 -0
- package/dist/runners/codex/config-files.js +71 -0
- package/dist/runners/codex/config-files.js.map +1 -0
- package/dist/runners/codex/definition.d.ts +2 -0
- package/dist/runners/codex/definition.js +42 -0
- package/dist/runners/codex/definition.js.map +1 -0
- package/dist/runners/codex/detection.d.ts +8 -0
- package/dist/runners/codex/detection.js +14 -0
- package/dist/runners/codex/detection.js.map +1 -0
- package/dist/runners/codex/display.d.ts +12 -0
- package/dist/runners/codex/display.js +13 -0
- package/dist/runners/codex/display.js.map +1 -0
- package/dist/runners/codex/env.d.ts +4 -0
- package/dist/runners/codex/env.js +3 -0
- package/dist/runners/codex/env.js.map +1 -0
- package/dist/runners/codex/extra-tools.d.ts +3 -0
- package/dist/runners/codex/extra-tools.js +4 -0
- package/dist/runners/codex/extra-tools.js.map +1 -0
- package/dist/runners/codex/facts.d.ts +28 -0
- package/dist/runners/codex/facts.js +28 -0
- package/dist/runners/codex/facts.js.map +1 -0
- package/dist/runners/codex/index.d.ts +6 -0
- package/dist/runners/codex/index.js +9 -0
- package/dist/runners/codex/index.js.map +1 -0
- package/dist/runners/codex/login-probe.d.ts +4 -0
- package/dist/runners/codex/login-probe.js +30 -0
- package/dist/runners/codex/login-probe.js.map +1 -0
- package/dist/runners/codex/login.d.ts +7 -0
- package/dist/runners/codex/login.js +8 -0
- package/dist/runners/codex/login.js.map +1 -0
- package/dist/runners/codex/mock.d.ts +98 -0
- package/dist/runners/codex/mock.js +62 -0
- package/dist/runners/codex/mock.js.map +1 -0
- package/dist/runners/codex/model-settings.d.ts +2 -0
- package/dist/runners/codex/model-settings.js +16 -0
- package/dist/runners/codex/model-settings.js.map +1 -0
- package/dist/runners/codex/models.d.ts +3 -0
- package/dist/runners/codex/models.js +11 -0
- package/dist/runners/codex/models.js.map +1 -0
- package/dist/runners/codex/spec-support.d.ts +9 -0
- package/dist/runners/codex/spec-support.js +31 -0
- package/dist/runners/codex/spec-support.js.map +1 -0
- package/dist/runners/omp/accounts.d.ts +11 -0
- package/dist/runners/omp/accounts.js +11 -0
- package/dist/runners/omp/accounts.js.map +1 -0
- package/dist/runners/omp/agent-dir.d.ts +13 -0
- package/dist/runners/omp/agent-dir.js +33 -0
- package/dist/runners/omp/agent-dir.js.map +1 -0
- package/dist/runners/omp/cli.d.ts +13 -0
- package/dist/runners/omp/cli.js +9 -0
- package/dist/runners/omp/cli.js.map +1 -0
- package/dist/runners/omp/config-files.d.ts +10 -0
- package/dist/runners/omp/config-files.js +98 -0
- package/dist/runners/omp/config-files.js.map +1 -0
- package/dist/runners/omp/definition.d.ts +2 -0
- package/dist/runners/omp/definition.js +41 -0
- package/dist/runners/omp/definition.js.map +1 -0
- package/dist/runners/omp/detection.d.ts +8 -0
- package/dist/runners/omp/detection.js +12 -0
- package/dist/runners/omp/detection.js.map +1 -0
- package/dist/runners/omp/display.d.ts +11 -0
- package/dist/runners/omp/display.js +12 -0
- package/dist/runners/omp/display.js.map +1 -0
- package/dist/runners/omp/env.d.ts +4 -0
- package/dist/runners/omp/env.js +17 -0
- package/dist/runners/omp/env.js.map +1 -0
- package/dist/runners/omp/extra-tools.d.ts +3 -0
- package/dist/runners/omp/extra-tools.js +6 -0
- package/dist/runners/omp/extra-tools.js.map +1 -0
- package/dist/runners/omp/facts.d.ts +28 -0
- package/dist/runners/omp/facts.js +26 -0
- package/dist/runners/omp/facts.js.map +1 -0
- package/dist/runners/omp/index.d.ts +6 -0
- package/dist/runners/omp/index.js +9 -0
- package/dist/runners/omp/index.js.map +1 -0
- package/dist/runners/omp/login-probe.d.ts +13 -0
- package/dist/runners/omp/login-probe.js +25 -0
- package/dist/runners/omp/login-probe.js.map +1 -0
- package/dist/runners/omp/login.d.ts +8 -0
- package/dist/runners/omp/login.js +12 -0
- package/dist/runners/omp/login.js.map +1 -0
- package/dist/runners/omp/mock.d.ts +102 -0
- package/dist/runners/omp/mock.js +59 -0
- package/dist/runners/omp/mock.js.map +1 -0
- package/dist/runners/omp/models.d.ts +3 -0
- package/dist/runners/omp/models.js +11 -0
- package/dist/runners/omp/models.js.map +1 -0
- package/dist/runners/omp/omp-ci-wait.mjs +27 -0
- package/dist/runners/omp/omp-model-catalog.d.ts +35 -0
- package/dist/runners/omp/omp-model-catalog.js +176 -0
- package/dist/runners/omp/omp-model-catalog.js.map +1 -0
- package/dist/runners/omp/omp-runner.d.ts +92 -0
- package/dist/runners/omp/omp-runner.js +809 -0
- package/dist/runners/omp/omp-runner.js.map +1 -0
- package/dist/runners/omp/omp-skill-catalog.d.ts +3 -0
- package/dist/runners/omp/omp-skill-catalog.js +23 -0
- package/dist/runners/omp/omp-skill-catalog.js.map +1 -0
- package/dist/runners/omp/omp-subagent-rows.d.ts +21 -0
- package/dist/runners/omp/omp-subagent-rows.js +100 -0
- package/dist/runners/omp/omp-subagent-rows.js.map +1 -0
- package/dist/runners/omp/omp-ui-mapper.d.ts +112 -0
- package/dist/runners/omp/omp-ui-mapper.js +826 -0
- package/dist/runners/omp/omp-ui-mapper.js.map +1 -0
- package/dist/runners/omp/spec-support.d.ts +9 -0
- package/dist/runners/omp/spec-support.js +35 -0
- package/dist/runners/omp/spec-support.js.map +1 -0
- package/dist/runners/opencode/accounts.d.ts +11 -0
- package/dist/runners/opencode/accounts.js +10 -0
- package/dist/runners/opencode/accounts.js.map +1 -0
- package/dist/runners/opencode/cli.d.ts +16 -0
- package/dist/runners/opencode/cli.js +8 -0
- package/dist/runners/opencode/cli.js.map +1 -0
- package/dist/runners/opencode/config-files.d.ts +10 -0
- package/dist/runners/opencode/config-files.js +70 -0
- package/dist/runners/opencode/config-files.js.map +1 -0
- package/dist/runners/opencode/definition.d.ts +2 -0
- package/dist/runners/opencode/definition.js +42 -0
- package/dist/runners/opencode/definition.js.map +1 -0
- package/dist/runners/opencode/detection.d.ts +8 -0
- package/dist/runners/opencode/detection.js +12 -0
- package/dist/runners/opencode/detection.js.map +1 -0
- package/dist/runners/opencode/display.d.ts +11 -0
- package/dist/runners/opencode/display.js +12 -0
- package/dist/runners/opencode/display.js.map +1 -0
- package/dist/runners/opencode/env.d.ts +4 -0
- package/dist/runners/opencode/env.js +4 -0
- package/dist/runners/opencode/env.js.map +1 -0
- package/dist/runners/opencode/extra-tools.d.ts +3 -0
- package/dist/runners/opencode/extra-tools.js +4 -0
- package/dist/runners/opencode/extra-tools.js.map +1 -0
- package/dist/runners/opencode/facts.d.ts +28 -0
- package/dist/runners/opencode/facts.js +26 -0
- package/dist/runners/opencode/facts.js.map +1 -0
- package/dist/runners/opencode/index.d.ts +6 -0
- package/dist/runners/opencode/index.js +9 -0
- package/dist/runners/opencode/index.js.map +1 -0
- package/dist/runners/opencode/login-probe.d.ts +4 -0
- package/dist/runners/opencode/login-probe.js +31 -0
- package/dist/runners/opencode/login-probe.js.map +1 -0
- package/dist/runners/opencode/login.d.ts +7 -0
- package/dist/runners/opencode/login.js +8 -0
- package/dist/runners/opencode/login.js.map +1 -0
- package/dist/runners/opencode/mock.d.ts +111 -0
- package/dist/runners/opencode/mock.js +65 -0
- package/dist/runners/opencode/mock.js.map +1 -0
- package/dist/runners/opencode/model-settings.d.ts +2 -0
- package/dist/runners/opencode/model-settings.js +8 -0
- package/dist/runners/opencode/model-settings.js.map +1 -0
- package/dist/runners/opencode/models.d.ts +3 -0
- package/dist/runners/opencode/models.js +10 -0
- package/dist/runners/opencode/models.js.map +1 -0
- package/dist/runners/opencode/opencode-http.d.ts +3 -0
- package/dist/runners/opencode/opencode-http.js +32 -0
- package/dist/runners/opencode/opencode-http.js.map +1 -0
- package/dist/runners/opencode/opencode-minimal.d.ts +42 -0
- package/dist/runners/opencode/opencode-minimal.js +57 -0
- package/dist/runners/opencode/opencode-minimal.js.map +1 -0
- package/dist/runners/opencode/opencode-model-catalog.d.ts +26 -0
- package/dist/runners/opencode/opencode-model-catalog.js +188 -0
- package/dist/runners/opencode/opencode-model-catalog.js.map +1 -0
- package/dist/runners/opencode/opencode-permissions.d.ts +51 -0
- package/dist/runners/opencode/opencode-permissions.js +101 -0
- package/dist/runners/opencode/opencode-permissions.js.map +1 -0
- package/dist/runners/opencode/opencode-questions.d.ts +3 -0
- package/dist/runners/opencode/opencode-questions.js +66 -0
- package/dist/runners/opencode/opencode-questions.js.map +1 -0
- package/dist/runners/opencode/opencode-runtime-config.d.ts +12 -0
- package/dist/runners/opencode/opencode-runtime-config.js +37 -0
- package/dist/runners/opencode/opencode-runtime-config.js.map +1 -0
- package/dist/runners/opencode/opencode-server-runner.d.ts +78 -0
- package/dist/runners/opencode/opencode-server-runner.js +1623 -0
- package/dist/runners/opencode/opencode-server-runner.js.map +1 -0
- package/dist/runners/opencode/opencode-session-error.d.ts +28 -0
- package/dist/runners/opencode/opencode-session-error.js +87 -0
- package/dist/runners/opencode/opencode-session-error.js.map +1 -0
- package/dist/runners/opencode/opencode-skill-catalog.d.ts +3 -0
- package/dist/runners/opencode/opencode-skill-catalog.js +36 -0
- package/dist/runners/opencode/opencode-skill-catalog.js.map +1 -0
- package/dist/runners/opencode/opencode-task-scope.js +19 -0
- package/dist/runners/opencode/opencode-task-scope.js.map +1 -0
- package/dist/runners/opencode/opencode-task-scope.mjs +59 -0
- package/dist/runners/opencode/opencode-ui-mapper-state.d.ts +82 -0
- package/dist/runners/opencode/opencode-ui-mapper-state.js.map +1 -0
- package/dist/runners/opencode/opencode-ui-mapper.d.ts +23 -0
- package/dist/runners/opencode/opencode-ui-mapper.js +760 -0
- package/dist/runners/opencode/opencode-ui-mapper.js.map +1 -0
- package/dist/runners/opencode/opencode-usage.d.ts +32 -0
- package/dist/runners/opencode/opencode-usage.js.map +1 -0
- package/dist/runners/opencode/spec-support.d.ts +9 -0
- package/dist/runners/opencode/spec-support.js +31 -0
- package/dist/runners/opencode/spec-support.js.map +1 -0
- package/dist/runners/pi/accounts.d.ts +11 -0
- package/dist/runners/pi/accounts.js +8 -0
- package/dist/runners/pi/accounts.js.map +1 -0
- package/dist/runners/pi/cli.d.ts +13 -0
- package/dist/runners/pi/cli.js +8 -0
- package/dist/runners/pi/cli.js.map +1 -0
- package/dist/runners/pi/config-files.d.ts +10 -0
- package/dist/runners/pi/config-files.js +73 -0
- package/dist/runners/pi/config-files.js.map +1 -0
- package/dist/runners/pi/definition.d.ts +2 -0
- package/dist/runners/pi/definition.js +42 -0
- package/dist/runners/pi/definition.js.map +1 -0
- package/dist/runners/pi/detection.d.ts +8 -0
- package/dist/runners/pi/detection.js +13 -0
- package/dist/runners/pi/detection.js.map +1 -0
- package/dist/runners/pi/display.d.ts +12 -0
- package/dist/runners/pi/display.js +13 -0
- package/dist/runners/pi/display.js.map +1 -0
- package/dist/runners/pi/env.d.ts +4 -0
- package/dist/runners/pi/env.js +15 -0
- package/dist/runners/pi/env.js.map +1 -0
- package/dist/runners/pi/extensions/pi-ci-wait.mjs +10 -0
- package/dist/runners/pi/extensions/pi-default-tools.mjs +22 -0
- package/dist/runners/pi/extensions/pi-retry-degraded-service.mjs +26 -0
- package/dist/runners/pi/extensions/pi-runaway-reply-guard.mjs +34 -0
- package/dist/runners/pi/extra-tools.d.ts +3 -0
- package/dist/runners/pi/extra-tools.js +7 -0
- package/dist/runners/pi/extra-tools.js.map +1 -0
- package/dist/runners/pi/facts.d.ts +28 -0
- package/dist/runners/pi/facts.js +24 -0
- package/dist/runners/pi/facts.js.map +1 -0
- package/dist/runners/pi/index.d.ts +6 -0
- package/dist/runners/pi/index.js +9 -0
- package/dist/runners/pi/index.js.map +1 -0
- package/dist/runners/pi/login-probe.d.ts +4 -0
- package/dist/runners/pi/login-probe.js +17 -0
- package/dist/runners/pi/login-probe.js.map +1 -0
- package/dist/runners/pi/login.d.ts +7 -0
- package/dist/runners/pi/login.js +8 -0
- package/dist/runners/pi/login.js.map +1 -0
- package/dist/runners/pi/mock.d.ts +87 -0
- package/dist/runners/pi/mock.js +54 -0
- package/dist/runners/pi/mock.js.map +1 -0
- package/dist/runners/pi/model-settings.d.ts +2 -0
- package/dist/runners/pi/model-settings.js +38 -0
- package/dist/runners/pi/model-settings.js.map +1 -0
- package/dist/runners/pi/models.d.ts +3 -0
- package/dist/runners/pi/models.js +17 -0
- package/dist/runners/pi/models.js.map +1 -0
- package/dist/runners/pi/pi-args.d.ts +5 -0
- package/dist/runners/pi/pi-args.js +10 -0
- package/dist/runners/pi/pi-args.js.map +1 -0
- package/dist/runners/pi/pi-model-catalog.d.ts +30 -0
- package/dist/runners/pi/pi-model-catalog.js +242 -0
- package/dist/runners/pi/pi-model-catalog.js.map +1 -0
- package/dist/runners/pi/pi-runner.d.ts +53 -0
- package/dist/runners/pi/pi-runner.js +599 -0
- package/dist/runners/pi/pi-runner.js.map +1 -0
- package/dist/runners/pi/pi-skill-catalog.d.ts +3 -0
- package/dist/runners/pi/pi-skill-catalog.js +34 -0
- package/dist/runners/pi/pi-skill-catalog.js.map +1 -0
- package/dist/runners/pi/pi-ui-mapper.d.ts +46 -0
- package/dist/runners/pi/pi-ui-mapper.js +414 -0
- package/dist/runners/pi/pi-ui-mapper.js.map +1 -0
- package/dist/runners/pi/runaway-reply.d.ts +25 -0
- package/dist/runners/pi/runaway-reply.js +55 -0
- package/dist/runners/pi/runaway-reply.js.map +1 -0
- package/dist/runners/pi/spec-support.d.ts +21 -0
- package/dist/runners/pi/spec-support.js +44 -0
- package/dist/runners/pi/spec-support.js.map +1 -0
- package/dist/runs/agent-tmpdir.d.ts +6 -2
- package/dist/runs/agent-tmpdir.js +57 -8
- package/dist/runs/agent-tmpdir.js.map +1 -1
- package/dist/runs/archive-family.js +2 -2
- package/dist/runs/archive-family.js.map +1 -1
- package/dist/runs/arm-repo-handle.d.ts +18 -3
- package/dist/runs/arm-repo-handle.js +2 -3
- package/dist/runs/arm-repo-handle.js.map +1 -1
- package/dist/runs/auto-name.d.ts +7 -2
- package/dist/runs/auto-name.js +12 -7
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/automation-runs.d.ts +26 -0
- package/dist/runs/automation-runs.js +70 -0
- package/dist/runs/automation-runs.js.map +1 -0
- package/dist/runs/branch-owners.d.ts +30 -0
- package/dist/runs/branch-owners.js +81 -0
- package/dist/runs/branch-owners.js.map +1 -0
- package/dist/runs/claim-families.d.ts +1 -1
- package/dist/runs/claim-families.js +1 -1
- package/dist/runs/cold-reads.d.ts +1 -1
- package/dist/runs/cold-reads.js +1 -1
- package/dist/runs/conversation-archive.d.ts +48 -0
- package/dist/runs/conversation-archive.js +110 -0
- package/dist/runs/conversation-archive.js.map +1 -0
- package/dist/runs/conversation-compaction.d.ts +35 -0
- package/dist/runs/conversation-compaction.js +110 -0
- package/dist/runs/conversation-compaction.js.map +1 -0
- package/dist/runs/conversation-identity.d.ts +2 -1
- package/dist/runs/conversation-identity.js +4 -4
- package/dist/runs/conversation-identity.js.map +1 -1
- package/dist/runs/conversation-ledger.d.ts +60 -0
- package/dist/runs/conversation-ledger.js +64 -0
- package/dist/runs/conversation-ledger.js.map +1 -0
- package/dist/runs/conversation-members.d.ts +26 -0
- package/dist/runs/conversation-members.js +63 -0
- package/dist/runs/conversation-members.js.map +1 -0
- package/dist/runs/delegation-state.d.ts +37 -3
- package/dist/runs/delegation-state.js +6 -0
- package/dist/runs/delegation-state.js.map +1 -1
- package/dist/runs/event-log.d.ts +79 -0
- package/dist/runs/event-log.js +188 -0
- package/dist/runs/event-log.js.map +1 -0
- package/dist/runs/exit-events.d.ts +5 -0
- package/dist/runs/exit-events.js +1 -7
- package/dist/runs/exit-events.js.map +1 -1
- package/dist/runs/guarded-json-sql.d.ts +8 -0
- package/dist/runs/guarded-json-sql.js +11 -0
- package/dist/runs/guarded-json-sql.js.map +1 -0
- package/dist/runs/history-file.js +8 -6
- package/dist/runs/history-file.js.map +1 -1
- package/dist/runs/legacy-index.d.ts +2 -2
- package/dist/runs/legacy-index.js +4 -5
- package/dist/runs/legacy-index.js.map +1 -1
- package/dist/runs/legacy-run-rows.d.ts +51 -1
- package/dist/runs/legacy-run-rows.js +186 -2
- package/dist/runs/legacy-run-rows.js.map +1 -1
- package/dist/runs/legacy-waits.js +2 -2
- package/dist/runs/legacy-waits.js.map +1 -1
- package/dist/runs/lifecycle-registry.d.ts +16 -0
- package/dist/runs/lifecycle-registry.js +30 -0
- package/dist/runs/lifecycle-registry.js.map +1 -0
- package/dist/runs/lifecycle.d.ts +82 -0
- package/dist/runs/lifecycle.js +64 -0
- package/dist/runs/lifecycle.js.map +1 -0
- package/dist/runs/live-tasks.d.ts +10 -0
- package/dist/runs/live-tasks.js +33 -0
- package/dist/runs/live-tasks.js.map +1 -0
- package/dist/runs/loaded-run-exits.d.ts +29 -2
- package/dist/runs/loaded-run-exits.js +50 -2
- package/dist/runs/loaded-run-exits.js.map +1 -1
- package/dist/runs/loaded-run-healing.js +1 -1
- package/dist/runs/loaded-run-healing.js.map +1 -1
- package/dist/runs/outcome-commit.d.ts +27 -3
- package/dist/runs/outcome-commit.js +26 -7
- package/dist/runs/outcome-commit.js.map +1 -1
- package/dist/runs/owned-run-create.d.ts +6 -3
- package/dist/runs/owned-run-create.js +46 -16
- package/dist/runs/owned-run-create.js.map +1 -1
- package/dist/runs/ports.d.ts +295 -0
- package/dist/runs/ports.js +2 -0
- package/dist/runs/ports.js.map +1 -0
- package/dist/runs/project-run-connection.d.ts +6 -1
- package/dist/runs/project-run-connection.js +46 -5
- package/dist/runs/project-run-connection.js.map +1 -1
- package/dist/runs/project-run-sources.d.ts +2 -2
- package/dist/runs/project-run-sources.js +5 -5
- package/dist/runs/project-run-sources.js.map +1 -1
- package/dist/runs/record-write-rules.d.ts +16 -4
- package/dist/runs/record-write-rules.js +48 -17
- package/dist/runs/record-write-rules.js.map +1 -1
- package/dist/runs/removal-slots.d.ts +78 -0
- package/dist/runs/removal-slots.js +92 -0
- package/dist/runs/removal-slots.js.map +1 -0
- package/dist/runs/retention.d.ts +46 -22
- package/dist/runs/retention.js +87 -60
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/run-archive.d.ts +1276 -0
- package/dist/runs/run-archive.js +382 -0
- package/dist/runs/run-archive.js.map +1 -0
- package/dist/runs/run-claims-topic.d.ts +136 -0
- package/dist/runs/run-claims-topic.js +291 -0
- package/dist/runs/run-claims-topic.js.map +1 -0
- package/dist/runs/run-claims.d.ts +1 -1
- package/dist/runs/run-claims.js +2 -2
- package/dist/runs/run-claims.js.map +1 -1
- package/dist/runs/run-cold-reads.d.ts +98 -0
- package/dist/runs/run-cold-reads.js +199 -0
- package/dist/runs/run-cold-reads.js.map +1 -0
- package/dist/runs/run-database-migrations.d.ts +8 -0
- package/dist/runs/run-database-migrations.js +236 -0
- package/dist/runs/run-database-migrations.js.map +1 -0
- package/dist/runs/run-database-peer-page.js +3 -4
- package/dist/runs/run-database-peer-page.js.map +1 -1
- package/dist/runs/run-database-row.js +5 -0
- package/dist/runs/run-database-row.js.map +1 -1
- package/dist/runs/run-database-version.d.ts +6 -3
- package/dist/runs/run-database-version.js +17 -3
- package/dist/runs/run-database-version.js.map +1 -1
- package/dist/runs/run-database.d.ts +28 -3
- package/dist/runs/run-database.js +104 -246
- package/dist/runs/run-database.js.map +1 -1
- package/dist/runs/run-decode.d.ts +3274 -0
- package/dist/runs/run-decode.js +132 -0
- package/dist/runs/run-decode.js.map +1 -0
- package/dist/runs/run-derived-rows.d.ts +25 -0
- package/dist/runs/run-derived-rows.js +46 -0
- package/dist/runs/run-derived-rows.js.map +1 -0
- package/dist/runs/run-exits.d.ts +1913 -46
- package/dist/runs/run-exits.js +35 -10
- package/dist/runs/run-exits.js.map +1 -1
- package/dist/runs/run-index-cache.d.ts +10 -0
- package/dist/runs/run-index-cache.js +45 -0
- package/dist/runs/run-index-cache.js.map +1 -0
- package/dist/runs/run-index-rows.d.ts +35 -0
- package/dist/runs/run-index-rows.js +51 -0
- package/dist/runs/run-index-rows.js.map +1 -0
- package/dist/runs/run-index.d.ts +5 -11
- package/dist/runs/run-index.js +43 -81
- package/dist/runs/run-index.js.map +1 -1
- package/dist/runs/run-indexes.d.ts +7 -0
- package/dist/runs/run-indexes.js +8 -0
- package/dist/runs/run-indexes.js.map +1 -0
- package/dist/runs/run-persistence.d.ts +156 -0
- package/dist/runs/run-persistence.js +410 -0
- package/dist/runs/run-persistence.js.map +1 -0
- package/dist/runs/run-pins.d.ts +38 -0
- package/dist/runs/run-pins.js +45 -0
- package/dist/runs/run-pins.js.map +1 -0
- package/dist/runs/run-queries.d.ts +198 -0
- package/dist/runs/run-queries.js +530 -0
- package/dist/runs/run-queries.js.map +1 -0
- package/dist/runs/run-read-flags.d.ts +58 -0
- package/dist/runs/run-read-flags.js +87 -0
- package/dist/runs/run-read-flags.js.map +1 -0
- package/dist/runs/run-redaction.d.ts +21 -0
- package/dist/runs/run-redaction.js +47 -0
- package/dist/runs/run-redaction.js.map +1 -0
- package/dist/runs/run-references.d.ts +14 -4
- package/dist/runs/run-references.js +84 -18
- package/dist/runs/run-references.js.map +1 -1
- package/dist/runs/run-repo-scope.d.ts +42 -0
- package/dist/runs/run-repo-scope.js +110 -0
- package/dist/runs/run-repo-scope.js.map +1 -0
- package/dist/runs/run-retention.d.ts +85 -0
- package/dist/runs/run-retention.js +240 -0
- package/dist/runs/run-retention.js.map +1 -0
- package/dist/runs/run-row.d.ts +23 -0
- package/dist/runs/run-row.js +49 -4
- package/dist/runs/run-row.js.map +1 -1
- package/dist/runs/run-summary-page.js +2 -0
- package/dist/runs/run-summary-page.js.map +1 -1
- package/dist/runs/shared-hosts.d.ts +17 -0
- package/dist/runs/shared-hosts.js +30 -0
- package/dist/runs/shared-hosts.js.map +1 -0
- package/dist/runs/store-open-error.js +7 -8
- package/dist/runs/store-open-error.js.map +1 -1
- package/dist/runs/store-open.d.ts +54 -0
- package/dist/runs/store-open.js +104 -0
- package/dist/runs/store-open.js.map +1 -0
- package/dist/runs/store.d.ts +74 -3729
- package/dist/runs/store.js +295 -2952
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/supervised.d.ts +22 -0
- package/dist/runs/supervised.js +28 -0
- package/dist/runs/supervised.js.map +1 -0
- package/dist/runs/task-rights.d.ts +87 -0
- package/dist/runs/task-rights.js +153 -0
- package/dist/runs/task-rights.js.map +1 -0
- package/dist/runs/transcript-facts-fold.d.ts +1 -1
- package/dist/runs/transcript-facts-fold.js +1 -1
- package/dist/runs/transcript-facts-fold.js.map +1 -1
- package/dist/runs/transcript-facts-load.js +1 -1
- package/dist/runs/transcript-facts-load.js.map +1 -1
- package/dist/runs/transcript-facts-queue.d.ts +5 -1
- package/dist/runs/transcript-facts-queue.js +48 -9
- package/dist/runs/transcript-facts-queue.js.map +1 -1
- package/dist/runs/transcript-facts-topic.d.ts +45 -0
- package/dist/runs/transcript-facts-topic.js +101 -0
- package/dist/runs/transcript-facts-topic.js.map +1 -0
- package/dist/runs/transcript-facts.js +1 -2
- package/dist/runs/transcript-facts.js.map +1 -1
- package/dist/runs/wait-capacity.js.map +1 -1
- package/dist/runs/wait-helpers.d.ts +28 -0
- package/dist/runs/wait-helpers.js +34 -0
- package/dist/runs/wait-helpers.js.map +1 -0
- package/dist/runs/wait-phases.d.ts +9 -1
- package/dist/runs/wait-phases.js +17 -2
- package/dist/runs/wait-phases.js.map +1 -1
- package/dist/runs/wait-registration-write.js.map +1 -1
- package/dist/runs/webhook.d.ts +24 -14
- package/dist/runs/webhook.js +29 -44
- package/dist/runs/webhook.js.map +1 -1
- package/dist/runs/worker-execution.d.ts +24 -1
- package/dist/runs/worker-execution.js +66 -7
- package/dist/runs/worker-execution.js.map +1 -1
- package/dist/runs/worker-executions-registry.d.ts +33 -0
- package/dist/runs/worker-executions-registry.js +18 -0
- package/dist/runs/worker-executions-registry.js.map +1 -0
- package/dist/runs/worker-result-commit.js +1 -1
- package/dist/runs/worker-results.d.ts +38 -0
- package/dist/runs/worker-results.js +87 -0
- package/dist/runs/worker-results.js.map +1 -0
- package/dist/serve-boot.d.ts +12 -25
- package/dist/serve-boot.js +9 -52
- package/dist/serve-boot.js.map +1 -1
- package/dist/serve-command.d.ts +9 -9
- package/dist/serve-command.js +47 -41
- package/dist/serve-command.js.map +1 -1
- package/dist/serve-listener.d.ts +2 -2
- package/dist/serve-listener.js +2 -2
- package/dist/serve-stop.d.ts +40 -0
- package/dist/serve-stop.js +41 -0
- package/dist/serve-stop.js.map +1 -0
- package/dist/server/accept-negotiation.d.ts +17 -0
- package/dist/server/accept-negotiation.js +53 -0
- package/dist/server/accept-negotiation.js.map +1 -0
- package/dist/server/activity-routes.d.ts +22 -7
- package/dist/server/activity-routes.js +6 -9
- package/dist/server/activity-routes.js.map +1 -1
- package/dist/server/activity-sources.d.ts +2 -2
- package/dist/server/activity-sources.js +4 -4
- package/dist/server/activity-sources.js.map +1 -1
- package/dist/server/agent-profile-id.d.ts +8 -0
- package/dist/server/agent-profile-id.js +14 -0
- package/dist/server/agent-profile-id.js.map +1 -0
- package/dist/server/archive-on-merge.js +16 -11
- package/dist/server/archive-on-merge.js.map +1 -1
- package/dist/server/automations-routes.d.ts +1435 -0
- package/dist/server/automations-routes.js +192 -0
- package/dist/server/automations-routes.js.map +1 -0
- package/dist/server/backend-checks.d.ts +29 -0
- package/dist/server/backend-checks.js +53 -0
- package/dist/server/backend-checks.js.map +1 -0
- package/dist/server/bounded-read-cache.d.ts +10 -0
- package/dist/server/bounded-read-cache.js +54 -0
- package/dist/server/bounded-read-cache.js.map +1 -0
- package/dist/server/brand-file-routes.d.ts +7 -0
- package/dist/server/brand-file-routes.js +19 -0
- package/dist/server/brand-file-routes.js.map +1 -0
- package/dist/server/capabilities.d.ts +4 -7
- package/dist/server/capabilities.js +2 -5
- package/dist/server/capabilities.js.map +1 -1
- package/dist/server/checkout.js +7 -6
- package/dist/server/checkout.js.map +1 -1
- package/dist/server/cockpit-ownership.d.ts +2 -59
- package/dist/server/cockpit-ownership.js +4 -143
- package/dist/server/cockpit-ownership.js.map +1 -1
- package/dist/server/completion-actions.js +8 -8
- package/dist/server/completion-actions.js.map +1 -1
- package/dist/server/config-merge.js +7 -6
- package/dist/server/config-merge.js.map +1 -1
- package/dist/server/create-project.js +10 -10
- package/dist/server/create-project.js.map +1 -1
- package/dist/server/forge/draft-pr.d.ts +1 -1
- package/dist/server/forge/draft-pr.js +45 -30
- package/dist/server/forge/draft-pr.js.map +1 -1
- package/dist/server/forge/github-checks.d.ts +31 -0
- package/dist/server/forge/github-checks.js +155 -0
- package/dist/server/forge/github-checks.js.map +1 -0
- package/dist/server/forge/github-cli.d.ts +14 -0
- package/dist/server/forge/github-cli.js +25 -0
- package/dist/server/forge/github-cli.js.map +1 -0
- package/dist/server/forge/github-comments.d.ts +25 -0
- package/dist/server/forge/github-comments.js +486 -0
- package/dist/server/forge/github-comments.js.map +1 -0
- package/dist/server/forge/github-filters.js +2 -3
- package/dist/server/forge/github-filters.js.map +1 -1
- package/dist/server/forge/github-list.d.ts +77 -0
- package/dist/server/forge/github-list.js +541 -0
- package/dist/server/forge/github-list.js.map +1 -0
- package/dist/server/forge/github-merge-state.d.ts +1 -1
- package/dist/server/forge/github-merge-state.js +4 -9
- package/dist/server/forge/github-merge-state.js.map +1 -1
- package/dist/server/forge/github-merged-pr-chunk.d.ts +5 -0
- package/dist/server/forge/github-merged-pr-chunk.js +45 -0
- package/dist/server/forge/github-merged-pr-chunk.js.map +1 -0
- package/dist/server/forge/github-mutations.d.ts +19 -0
- package/dist/server/forge/github-mutations.js +295 -0
- package/dist/server/forge/github-mutations.js.map +1 -0
- package/dist/server/forge/github-pr-diff.d.ts +10 -0
- package/dist/server/forge/github-pr-diff.js +126 -0
- package/dist/server/forge/github-pr-diff.js.map +1 -0
- package/dist/server/forge/github-ref-status-derive.d.ts +54 -0
- package/dist/server/forge/github-ref-status-derive.js +202 -0
- package/dist/server/forge/github-ref-status-derive.js.map +1 -0
- package/dist/server/forge/github-ref-status-query.d.ts +5 -0
- package/dist/server/forge/github-ref-status-query.js +11 -0
- package/dist/server/forge/github-ref-status-query.js.map +1 -0
- package/dist/server/forge/github-ref-status.d.ts +23 -0
- package/dist/server/forge/github-ref-status.js +224 -0
- package/dist/server/forge/github-ref-status.js.map +1 -0
- package/dist/server/forge/github-repo-handle.d.ts +43 -0
- package/dist/server/forge/github-repo-handle.js +161 -0
- package/dist/server/forge/github-repo-handle.js.map +1 -0
- package/dist/server/forge/github-request-gate.d.ts +64 -0
- package/dist/server/forge/github-request-gate.js +152 -0
- package/dist/server/forge/github-request-gate.js.map +1 -0
- package/dist/server/forge/github-reviewer-ref.d.ts +11 -0
- package/dist/server/forge/github-reviewer-ref.js +17 -0
- package/dist/server/forge/github-reviewer-ref.js.map +1 -0
- package/dist/server/forge/github-shared.d.ts +119 -0
- package/dist/server/forge/github-shared.js +225 -0
- package/dist/server/forge/github-shared.js.map +1 -0
- package/dist/server/forge/github.d.ts +15 -386
- package/dist/server/forge/github.js +29 -2789
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/types.d.ts +3 -3
- package/dist/server/fs-browse.d.ts +1 -1
- package/dist/server/fs-browse.js +3 -5
- package/dist/server/fs-browse.js.map +1 -1
- package/dist/server/git-changes.d.ts +19 -1
- package/dist/server/git-changes.js +23 -18
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/git-dir-stamp.d.ts +35 -0
- package/dist/server/git-dir-stamp.js +158 -0
- package/dist/server/git-dir-stamp.js.map +1 -0
- package/dist/server/git.d.ts +7 -1
- package/dist/server/git.js +72 -10
- package/dist/server/git.js.map +1 -1
- package/dist/server/github-routes.d.ts +733 -0
- package/dist/server/github-routes.js +140 -0
- package/dist/server/github-routes.js.map +1 -0
- package/dist/server/health-cache.d.ts +39 -0
- package/dist/server/health-cache.js +66 -0
- package/dist/server/health-cache.js.map +1 -0
- package/dist/server/home-recovery-routes.d.ts +2 -3
- package/dist/server/home-recovery-routes.js +12 -12
- package/dist/server/home-recovery-routes.js.map +1 -1
- package/dist/server/host-authority.d.ts +20 -0
- package/dist/server/host-authority.js +46 -0
- package/dist/server/host-authority.js.map +1 -0
- package/dist/server/live-routes.d.ts +13 -6
- package/dist/server/live-routes.js +1 -0
- package/dist/server/live-routes.js.map +1 -1
- package/dist/server/models-routes.d.ts +60 -0
- package/dist/server/models-routes.js +24 -0
- package/dist/server/models-routes.js.map +1 -0
- package/dist/server/open-in-app.d.ts +5 -3
- package/dist/server/open-in-app.js +14 -18
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/open-in-targets.d.ts +6 -6
- package/dist/server/open-in-targets.js +20 -26
- package/dist/server/open-in-targets.js.map +1 -1
- package/dist/server/open-in-terminal.d.ts +3 -3
- package/dist/server/open-in-terminal.js +3 -3
- package/dist/server/preview-cdp-socket.js +1 -1
- package/dist/server/preview-cdp-socket.js.map +1 -1
- package/dist/server/preview-socket.js +1 -1
- package/dist/server/preview-socket.js.map +1 -1
- package/dist/server/probe-writable-dir.d.ts +5 -0
- package/dist/server/probe-writable-dir.js +25 -0
- package/dist/server/probe-writable-dir.js.map +1 -0
- package/dist/server/project-context.d.ts +40 -26
- package/dist/server/project-context.js +75 -78
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/project-run-files.d.ts +4 -2
- package/dist/server/project-run-files.js +4 -4
- package/dist/server/project-run-files.js.map +1 -1
- package/dist/server/project-settings-routes.d.ts +985 -0
- package/dist/server/project-settings-routes.js +346 -0
- package/dist/server/project-settings-routes.js.map +1 -0
- package/dist/server/projects-routes.d.ts +833 -0
- package/dist/server/projects-routes.js +423 -0
- package/dist/server/projects-routes.js.map +1 -0
- package/dist/server/provider-action-gate.d.ts +22 -3
- package/dist/server/provider-action-gate.js +40 -14
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/provider-auth-runtime.d.ts +2 -1
- package/dist/server/provider-auth-runtime.js +11 -8
- package/dist/server/provider-auth-runtime.js.map +1 -1
- package/dist/server/provider-sign-in-routes.d.ts +231 -0
- package/dist/server/provider-sign-in-routes.js +61 -0
- package/dist/server/provider-sign-in-routes.js.map +1 -0
- package/dist/server/provider-sign-ins.d.ts +12 -0
- package/dist/server/provider-sign-ins.js +61 -0
- package/dist/server/provider-sign-ins.js.map +1 -0
- package/dist/server/providers-routes.d.ts +666 -0
- package/dist/server/providers-routes.js +373 -0
- package/dist/server/providers-routes.js.map +1 -0
- package/dist/server/repo-branch-forge.js +38 -10
- package/dist/server/repo-branch-forge.js.map +1 -1
- package/dist/server/repo-branch-sweep.d.ts +23 -1
- package/dist/server/repo-branch-sweep.js +9 -1
- package/dist/server/repo-branch-sweep.js.map +1 -1
- package/dist/server/repo-branches.d.ts +18 -3
- package/dist/server/repo-branches.js +119 -53
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/repo-pull.js +3 -6
- package/dist/server/repo-pull.js.map +1 -1
- package/dist/server/repo-read-cache.d.ts +22 -0
- package/dist/server/repo-read-cache.js +51 -0
- package/dist/server/repo-read-cache.js.map +1 -0
- package/dist/server/repo-routes.d.ts +509 -0
- package/dist/server/repo-routes.js +243 -0
- package/dist/server/repo-routes.js.map +1 -0
- package/dist/server/reports-api.js +4 -3
- package/dist/server/reports-api.js.map +1 -1
- package/dist/server/reports-topic.d.ts +1 -1
- package/dist/server/reports-topic.js +2 -1
- package/dist/server/reports-topic.js.map +1 -1
- package/dist/server/run-accounts.d.ts +47 -0
- package/dist/server/run-accounts.js +89 -0
- package/dist/server/run-accounts.js.map +1 -0
- package/dist/server/run-checkout.d.ts +9 -2
- package/dist/server/run-checkout.js +50 -18
- package/dist/server/run-checkout.js.map +1 -1
- package/dist/server/run-event-feed.d.ts +7 -1
- package/dist/server/run-event-feed.js +87 -30
- package/dist/server/run-event-feed.js.map +1 -1
- package/dist/server/run-relationships.d.ts +19 -0
- package/dist/server/run-relationships.js +47 -0
- package/dist/server/run-relationships.js.map +1 -0
- package/dist/server/runner-install-routes.d.ts +106 -0
- package/dist/server/runner-install-routes.js +52 -0
- package/dist/server/runner-install-routes.js.map +1 -0
- package/dist/server/runner-skills.d.ts +13 -0
- package/dist/server/runner-skills.js +21 -0
- package/dist/server/runner-skills.js.map +1 -0
- package/dist/server/runners-routes.d.ts +156 -0
- package/dist/server/runners-routes.js +29 -0
- package/dist/server/runners-routes.js.map +1 -0
- package/dist/server/runs-routes.d.ts +13066 -0
- package/dist/server/runs-routes.js +834 -0
- package/dist/server/runs-routes.js.map +1 -0
- package/dist/server/server-deps.d.ts +8 -5
- package/dist/server/server-deps.js +25 -12
- package/dist/server/server-deps.js.map +1 -1
- package/dist/server/server-types.d.ts +40 -0
- package/dist/server/server-types.js +34 -0
- package/dist/server/server-types.js.map +1 -0
- package/dist/server/server.d.ts +6281 -4782
- package/dist/server/server.js +220 -4493
- package/dist/server/server.js.map +1 -1
- package/dist/server/session-context-routes.d.ts +108 -0
- package/dist/server/session-context-routes.js +26 -0
- package/dist/server/session-context-routes.js.map +1 -0
- package/dist/server/start-run-options.d.ts +15 -8
- package/dist/server/start-run-options.js +17 -7
- package/dist/server/start-run-options.js.map +1 -1
- package/dist/server/start-server.d.ts +6 -0
- package/dist/server/start-server.js +345 -0
- package/dist/server/start-server.js.map +1 -0
- package/dist/server/static-assets.d.ts +5 -0
- package/dist/server/static-assets.js +109 -0
- package/dist/server/static-assets.js.map +1 -0
- package/dist/server/static-ui.d.ts +1 -1
- package/dist/server/static-ui.js +8 -6
- package/dist/server/static-ui.js.map +1 -1
- package/dist/server/validators.d.ts +6 -3
- package/dist/server/validators.js +22 -13
- package/dist/server/validators.js.map +1 -1
- package/dist/server/web-app-manifest.d.ts +23 -0
- package/dist/server/web-app-manifest.js +27 -0
- package/dist/server/web-app-manifest.js.map +1 -0
- package/dist/server/workspace-config-patch.js +3 -3
- package/dist/server/workspace-config-patch.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +7 -0
- package/dist/server/workspace-projects.d.ts +3 -8
- package/dist/server/workspace-projects.js +5 -17
- package/dist/server/workspace-projects.js.map +1 -1
- package/dist/server/workspace-routes.d.ts +713 -0
- package/dist/server/workspace-routes.js +262 -0
- package/dist/server/workspace-routes.js.map +1 -0
- package/dist/server/workspace-run-feed.d.ts +15 -5
- package/dist/server/workspace-run-feed.js +14 -11
- package/dist/server/workspace-run-feed.js.map +1 -1
- package/dist/server/worktree-size-cache.d.ts +3 -0
- package/dist/server/worktree-size-cache.js +8 -0
- package/dist/server/worktree-size-cache.js.map +1 -0
- package/dist/server/ws.js +22 -9
- package/dist/server/ws.js.map +1 -1
- package/dist/server/wsl.js +1 -1
- package/dist/server-command.js +1 -2
- package/dist/server-command.js.map +1 -1
- package/dist/server-install/engine.d.ts +2 -2
- package/dist/server-install/engine.js +4 -5
- package/dist/server-install/engine.js.map +1 -1
- package/dist/server-install/group-migrate.js +35 -24
- package/dist/server-install/group-migrate.js.map +1 -1
- package/dist/server-install/migrate-journal.d.ts +1 -0
- package/dist/server-install/migrate-journal.js +4 -4
- package/dist/server-install/migrate-journal.js.map +1 -1
- package/dist/server-install/npx-cache.d.ts +1 -1
- package/dist/server-install/npx-cache.js +4 -5
- package/dist/server-install/npx-cache.js.map +1 -1
- package/dist/server-install/platforms/macosx-migration.d.ts +2 -2
- package/dist/server-install/platforms/macosx-migration.js +3 -7
- package/dist/server-install/platforms/macosx-migration.js.map +1 -1
- package/dist/server-install/platforms/macosx-ngrok.d.ts +6 -8
- package/dist/server-install/platforms/macosx-ngrok.js +64 -67
- package/dist/server-install/platforms/macosx-ngrok.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps-migration.d.ts +6 -6
- package/dist/server-install/platforms/ubuntu-vps-migration.js +22 -39
- package/dist/server-install/platforms/ubuntu-vps-migration.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps-names.d.ts +13 -11
- package/dist/server-install/platforms/ubuntu-vps-names.js +15 -17
- package/dist/server-install/platforms/ubuntu-vps-names.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps-redeploy.d.ts +1 -1
- package/dist/server-install/platforms/ubuntu-vps-redeploy.js +2 -3
- package/dist/server-install/platforms/ubuntu-vps-redeploy.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps.d.ts +9 -13
- package/dist/server-install/platforms/ubuntu-vps.js +95 -99
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
- package/dist/server-install/state.js +2 -3
- package/dist/server-install/state.js.map +1 -1
- package/dist/server-install/steps.js +29 -24
- package/dist/server-install/steps.js.map +1 -1
- package/dist/server-install/types.d.ts +9 -6
- package/dist/server-install/types.js +10 -7
- package/dist/server-install/types.js.map +1 -1
- package/dist/session-context-file.d.ts +11 -0
- package/dist/session-context-file.js +173 -0
- package/dist/session-context-file.js.map +1 -0
- package/dist/session-context.d.ts +61 -4
- package/dist/session-context.js +268 -36
- package/dist/session-context.js.map +1 -1
- package/dist/skills.d.ts +0 -69
- package/dist/skills.js +0 -205
- package/dist/skills.js.map +1 -1
- package/dist/subcommands.d.ts +8 -10
- package/dist/subcommands.js +23 -54
- package/dist/subcommands.js.map +1 -1
- package/dist/task-branch-head.d.ts +7 -0
- package/dist/task-branch-head.js +32 -0
- package/dist/task-branch-head.js.map +1 -0
- package/dist/task-cli/cli.js +64 -211
- package/dist/task-cli/cli.js.map +1 -1
- package/dist/task-cli/discovery.d.ts +22 -1
- package/dist/task-cli/discovery.js +79 -29
- package/dist/task-cli/discovery.js.map +1 -1
- package/dist/task-cli/http.d.ts +15 -16
- package/dist/task-cli/http.js +17 -7
- package/dist/task-cli/http.js.map +1 -1
- package/dist/task-cli/operations.d.ts +156 -0
- package/dist/task-cli/operations.js +388 -0
- package/dist/task-cli/operations.js.map +1 -0
- package/dist/task-cli/projections.d.ts +4 -2
- package/dist/task-cli/projections.js +2 -2
- package/dist/task-cli/projections.js.map +1 -1
- package/dist/task-cli/watch.d.ts +31 -8
- package/dist/task-cli/watch.js +159 -91
- package/dist/task-cli/watch.js.map +1 -1
- package/dist/ui-state.d.ts +11 -10
- package/dist/ui-state.js +36 -11
- package/dist/ui-state.js.map +1 -1
- package/dist/update-check.d.ts +1 -1
- package/dist/update-check.js +3 -4
- package/dist/update-check.js.map +1 -1
- package/dist/webhooks/cli.d.ts +2 -0
- package/dist/webhooks/cli.js +5 -2
- package/dist/webhooks/cli.js.map +1 -1
- package/dist/worker-scope/cgroup.d.ts +7 -0
- package/dist/worker-scope/cgroup.js +17 -0
- package/dist/worker-scope/cgroup.js.map +1 -0
- package/dist/worker-scope/groups.d.ts +15 -0
- package/dist/worker-scope/groups.js +45 -0
- package/dist/worker-scope/groups.js.map +1 -0
- package/dist/worker-scope/job.d.ts +7 -0
- package/dist/worker-scope/job.js +10 -0
- package/dist/worker-scope/job.js.map +1 -0
- package/dist/worker-scope/scope.d.ts +38 -0
- package/dist/worker-scope/scope.js +20 -0
- package/dist/worker-scope/scope.js.map +1 -0
- package/dist/worker-scope/worker-scopes.d.ts +75 -0
- package/dist/worker-scope/worker-scopes.js +254 -0
- package/dist/worker-scope/worker-scopes.js.map +1 -0
- package/dist/workflows/active-run.d.ts +2 -2
- package/dist/workflows/active-run.js +2 -2
- package/dist/workflows/attachment-path.d.ts +2 -0
- package/dist/workflows/attachment-path.js +23 -1
- package/dist/workflows/attachment-path.js.map +1 -1
- package/dist/workflows/completion-policy.d.ts +11 -3
- package/dist/workflows/completion-policy.js +13 -3
- package/dist/workflows/completion-policy.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +183 -41
- package/dist/workflows/continuation-admission.js +77 -42
- package/dist/workflows/continuation-admission.js.map +1 -1
- package/dist/workflows/execution-account.d.ts +2 -3
- package/dist/workflows/execution-account.js +6 -4
- package/dist/workflows/execution-account.js.map +1 -1
- package/dist/workflows/grouped-command.d.ts +3 -0
- package/dist/workflows/grouped-command.js +42 -6
- package/dist/workflows/grouped-command.js.map +1 -1
- package/dist/workflows/input-acknowledgement.d.ts +23 -3
- package/dist/workflows/input-acknowledgement.js.map +1 -1
- package/dist/workflows/load.js +15 -0
- package/dist/workflows/load.js.map +1 -1
- package/dist/workflows/outcome-batches.d.ts +5 -4
- package/dist/workflows/outcome-batches.js +4 -3
- package/dist/workflows/outcome-batches.js.map +1 -1
- package/dist/workflows/question-routing.d.ts +3 -1
- package/dist/workflows/question-routing.js +9 -3
- package/dist/workflows/question-routing.js.map +1 -1
- package/dist/workflows/run/attachment-writer.d.ts +5 -4
- package/dist/workflows/run/attachment-writer.js +12 -9
- package/dist/workflows/run/attachment-writer.js.map +1 -1
- package/dist/workflows/run/auto-resume.d.ts +38 -16
- package/dist/workflows/run/auto-resume.js +106 -68
- package/dist/workflows/run/auto-resume.js.map +1 -1
- package/dist/workflows/run/completion-gate.d.ts +4 -0
- package/dist/workflows/run/completion-gate.js +20 -16
- package/dist/workflows/run/completion-gate.js.map +1 -1
- package/dist/workflows/run/compose.d.ts +27 -21
- package/dist/workflows/run/compose.js +55 -46
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/constants.d.ts +2 -2
- package/dist/workflows/run/constants.js +2 -2
- package/dist/workflows/run/constants.js.map +1 -1
- package/dist/workflows/run/continuation-acceptance.d.ts +14 -11
- package/dist/workflows/run/continuation-acceptance.js +113 -36
- package/dist/workflows/run/continuation-acceptance.js.map +1 -1
- package/dist/workflows/run/continuation-session.d.ts +10 -12
- package/dist/workflows/run/continuation-session.js +110 -154
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/cut-off-work.d.ts +41 -0
- package/dist/workflows/run/cut-off-work.js +96 -0
- package/dist/workflows/run/cut-off-work.js.map +1 -0
- package/dist/workflows/run/done-accepted.d.ts +42 -0
- package/dist/workflows/run/done-accepted.js +142 -0
- package/dist/workflows/run/done-accepted.js.map +1 -0
- package/dist/workflows/run/family-reconciler.d.ts +26 -12
- package/dist/workflows/run/family-reconciler.js +76 -59
- package/dist/workflows/run/family-reconciler.js.map +1 -1
- package/dist/workflows/run/human-waits.d.ts +32 -12
- package/dist/workflows/run/human-waits.js +77 -31
- package/dist/workflows/run/human-waits.js.map +1 -1
- package/dist/workflows/run/inbox-claims.d.ts +3 -2
- package/dist/workflows/run/inbox-claims.js +8 -17
- package/dist/workflows/run/inbox-claims.js.map +1 -1
- package/dist/workflows/run/input-batch.d.ts +4 -2
- package/dist/workflows/run/input-batch.js +7 -6
- package/dist/workflows/run/input-batch.js.map +1 -1
- package/dist/workflows/run/input-delivery.d.ts +81 -12
- package/dist/workflows/run/input-delivery.js +275 -117
- package/dist/workflows/run/input-delivery.js.map +1 -1
- package/dist/workflows/run/input-receipts.d.ts +15 -7
- package/dist/workflows/run/input-receipts.js +21 -20
- package/dist/workflows/run/input-receipts.js.map +1 -1
- package/dist/workflows/run/input-timers.js +3 -2
- package/dist/workflows/run/input-timers.js.map +1 -1
- package/dist/workflows/run/launch-context.d.ts +7 -14
- package/dist/workflows/run/launch-context.js +17 -41
- package/dist/workflows/run/launch-context.js.map +1 -1
- package/dist/workflows/run/launch-read-resolver.d.ts +107 -54
- package/dist/workflows/run/launch-read-resolver.js +138 -79
- package/dist/workflows/run/launch-read-resolver.js.map +1 -1
- package/dist/workflows/run/launch-settings.d.ts +2 -2
- package/dist/workflows/run/launch-settings.js.map +1 -1
- package/dist/workflows/run/live-session-state.d.ts +8 -0
- package/dist/workflows/run/live-session-state.js +9 -0
- package/dist/workflows/run/live-session-state.js.map +1 -1
- package/dist/workflows/run/liveness-timers.d.ts +105 -0
- package/dist/workflows/run/liveness-timers.js +134 -0
- package/dist/workflows/run/liveness-timers.js.map +1 -0
- package/dist/workflows/run/maintenance-claims.d.ts +15 -1
- package/dist/workflows/run/maintenance-claims.js +57 -10
- package/dist/workflows/run/maintenance-claims.js.map +1 -1
- package/dist/workflows/run/memory-guard.d.ts +6 -6
- package/dist/workflows/run/memory-guard.js +10 -10
- package/dist/workflows/run/memory-guard.js.map +1 -1
- package/dist/workflows/run/native-skill-input-queue.d.ts +59 -0
- package/dist/workflows/run/native-skill-input-queue.js +157 -0
- package/dist/workflows/run/native-skill-input-queue.js.map +1 -0
- package/dist/workflows/run/opening.d.ts +2 -2
- package/dist/workflows/run/pending-ask-facts.d.ts +2 -2
- package/dist/workflows/run/pending-ask-facts.js.map +1 -1
- package/dist/workflows/run/prompts.d.ts +3 -42
- package/dist/workflows/run/prompts.js +18 -88
- package/dist/workflows/run/prompts.js.map +1 -1
- package/dist/workflows/run/queued-input.d.ts +12 -10
- package/dist/workflows/run/queued-input.js +28 -17
- package/dist/workflows/run/queued-input.js.map +1 -1
- package/dist/workflows/run/queued-revival.d.ts +5 -4
- package/dist/workflows/run/queued-revival.js +38 -18
- package/dist/workflows/run/queued-revival.js.map +1 -1
- package/dist/workflows/run/run-cancel.d.ts +12 -2
- package/dist/workflows/run/run-cancel.js +43 -21
- package/dist/workflows/run/run-cancel.js.map +1 -1
- package/dist/workflows/run/run-finish.d.ts +16 -11
- package/dist/workflows/run/run-finish.js +52 -28
- package/dist/workflows/run/run-finish.js.map +1 -1
- package/dist/workflows/run/run-guards.d.ts +8 -7
- package/dist/workflows/run/run-guards.js.map +1 -1
- package/dist/workflows/run/run-line.d.ts +11 -10
- package/dist/workflows/run/run-line.js +32 -22
- package/dist/workflows/run/run-line.js.map +1 -1
- package/dist/workflows/run/run-memory.d.ts +65 -0
- package/dist/workflows/run/run-memory.js +84 -0
- package/dist/workflows/run/run-memory.js.map +1 -0
- package/dist/workflows/run/run-recovery.d.ts +6 -4
- package/dist/workflows/run/run-recovery.js +48 -33
- package/dist/workflows/run/run-recovery.js.map +1 -1
- package/dist/workflows/run/run-settlement.d.ts +29 -12
- package/dist/workflows/run/run-settlement.js +120 -59
- package/dist/workflows/run/run-settlement.js.map +1 -1
- package/dist/workflows/run/run-skills.d.ts +23 -105
- package/dist/workflows/run/run-skills.js +83 -210
- package/dist/workflows/run/run-skills.js.map +1 -1
- package/dist/workflows/run/run-start.d.ts +5 -4
- package/dist/workflows/run/run-start.js +1 -1
- package/dist/workflows/run/run-start.js.map +1 -1
- package/dist/workflows/run/run-workspace.d.ts +11 -7
- package/dist/workflows/run/run-workspace.js +25 -21
- package/dist/workflows/run/run-workspace.js.map +1 -1
- package/dist/workflows/run/session-events.d.ts +40 -22
- package/dist/workflows/run/session-events.js +57 -38
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/squawk-tools.d.ts +43 -0
- package/dist/workflows/run/squawk-tools.js +113 -0
- package/dist/workflows/run/squawk-tools.js.map +1 -0
- package/dist/workflows/run/step-decisions.js +4 -3
- package/dist/workflows/run/step-decisions.js.map +1 -1
- package/dist/workflows/run/step-loop.d.ts +13 -7
- package/dist/workflows/run/step-loop.js +81 -47
- package/dist/workflows/run/step-loop.js.map +1 -1
- package/dist/workflows/run/step-session.d.ts +7 -5
- package/dist/workflows/run/step-session.js +70 -55
- package/dist/workflows/run/step-session.js.map +1 -1
- package/dist/workflows/run/steps.d.ts +1 -1
- package/dist/workflows/run/subagent-waits.d.ts +22 -12
- package/dist/workflows/run/subagent-waits.js +60 -43
- package/dist/workflows/run/subagent-waits.js.map +1 -1
- package/dist/workflows/run/turn-bookkeeping.d.ts +7 -7
- package/dist/workflows/run/turn-bookkeeping.js +13 -13
- package/dist/workflows/run/turn-bookkeeping.js.map +1 -1
- package/dist/workflows/run/turn-boundary.d.ts +25 -9
- package/dist/workflows/run/turn-boundary.js +14 -23
- package/dist/workflows/run/turn-boundary.js.map +1 -1
- package/dist/workflows/run/turn-markers.d.ts +3 -6
- package/dist/workflows/run/turn-markers.js +0 -11
- package/dist/workflows/run/turn-markers.js.map +1 -1
- package/dist/workflows/run/turn-nudges.d.ts +68 -22
- package/dist/workflows/run/turn-nudges.js +144 -30
- package/dist/workflows/run/turn-nudges.js.map +1 -1
- package/dist/workflows/run/turn-settler.d.ts +72 -12
- package/dist/workflows/run/turn-settler.js +165 -58
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/types.d.ts +19 -15
- package/dist/workflows/run/usage-accounting.d.ts +4 -4
- package/dist/workflows/run/usage-accounting.js +15 -11
- package/dist/workflows/run/usage-accounting.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +143 -48
- package/dist/workflows/run/wait-engine.js +134 -195
- package/dist/workflows/run/wait-engine.js.map +1 -1
- package/dist/workflows/run/wait-input-descriptors.d.ts +3 -0
- package/dist/workflows/run/wait-input-descriptors.js +40 -0
- package/dist/workflows/run/wait-input-descriptors.js.map +1 -0
- package/dist/workflows/run/wait-kind-registry.d.ts +151 -0
- package/dist/workflows/run/wait-kind-registry.js +40 -0
- package/dist/workflows/run/wait-kind-registry.js.map +1 -0
- package/dist/workflows/run/wait-kinds.d.ts +545 -130
- package/dist/workflows/run/wait-kinds.js +160 -205
- package/dist/workflows/run/wait-kinds.js.map +1 -1
- package/dist/workflows/run/wait-registration-tool.d.ts +3 -3
- package/dist/workflows/run/wait-registration-tool.js +6 -5
- package/dist/workflows/run/wait-registration-tool.js.map +1 -1
- package/dist/workflows/run/wait-registration.d.ts +10 -2
- package/dist/workflows/run/wait-registration.js +18 -10
- package/dist/workflows/run/wait-registration.js.map +1 -1
- package/dist/workflows/run/wait-registry.d.ts +34 -35
- package/dist/workflows/run/wait-registry.js +122 -160
- package/dist/workflows/run/wait-registry.js.map +1 -1
- package/dist/workflows/run/wake-admission.d.ts +19 -6
- package/dist/workflows/run/wake-admission.js +49 -15
- package/dist/workflows/run/wake-admission.js.map +1 -1
- package/dist/workflows/run/wake-ledger.d.ts +12 -5
- package/dist/workflows/run/wake-ledger.js +19 -9
- package/dist/workflows/run/wake-ledger.js.map +1 -1
- package/dist/workflows/run/wake-retries.d.ts +10 -8
- package/dist/workflows/run/wake-retries.js +26 -47
- package/dist/workflows/run/wake-retries.js.map +1 -1
- package/dist/workflows/run/worker-executions.d.ts +18 -5
- package/dist/workflows/run/worker-executions.js +52 -20
- package/dist/workflows/run/worker-executions.js.map +1 -1
- package/dist/workflows/run/worker-orphans.d.ts +19 -37
- package/dist/workflows/run/worker-orphans.js +78 -130
- package/dist/workflows/run/worker-orphans.js.map +1 -1
- package/dist/workflows/run/worker-questions.d.ts +36 -23
- package/dist/workflows/run/worker-questions.js +140 -84
- package/dist/workflows/run/worker-questions.js.map +1 -1
- package/dist/workflows/run/worker-workspace-port.d.ts +35 -0
- package/dist/workflows/run/worker-workspace-port.js +7 -0
- package/dist/workflows/run/worker-workspace-port.js.map +1 -0
- package/dist/workflows/run/workflow-position.d.ts +9 -6
- package/dist/workflows/run/workflow-position.js +1 -0
- package/dist/workflows/run/workflow-position.js.map +1 -1
- package/dist/workflows/run/worktree-autosave.d.ts +4 -3
- package/dist/workflows/run/worktree-autosave.js +9 -8
- package/dist/workflows/run/worktree-autosave.js.map +1 -1
- package/dist/workflows/run-scheduling.d.ts +24 -12
- package/dist/workflows/run-scheduling.js +84 -15
- package/dist/workflows/run-scheduling.js.map +1 -1
- package/dist/workflows/run-states.d.ts +2 -9
- package/dist/workflows/run-states.js +54 -60
- package/dist/workflows/run-states.js.map +1 -1
- package/dist/workflows/run.d.ts +57 -25
- package/dist/workflows/run.js +95 -44
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/step-kind-ids.d.ts +9 -0
- package/dist/workflows/step-kind-ids.js +10 -0
- package/dist/workflows/step-kind-ids.js.map +1 -0
- package/dist/workflows/step-kind-registry.d.ts +45 -0
- package/dist/workflows/step-kind-registry.js +48 -0
- package/dist/workflows/step-kind-registry.js.map +1 -0
- package/dist/workflows/turn-end.d.ts +17 -8
- package/dist/workflows/turn-end.js +11 -3
- package/dist/workflows/turn-end.js.map +1 -1
- package/dist/workflows/types.d.ts +7 -8
- package/dist/workflows/types.js +6 -19
- package/dist/workflows/types.js.map +1 -1
- package/dist/workflows/wait-kind-ids.d.ts +11 -0
- package/dist/workflows/wait-kind-ids.js +34 -0
- package/dist/workflows/wait-kind-ids.js.map +1 -0
- package/dist/workflows/wait-scope.d.ts +9 -10
- package/dist/workflows/wait-scope.js +20 -18
- package/dist/workflows/wait-scope.js.map +1 -1
- package/dist/workflows/waits.d.ts +12 -19
- package/dist/workflows/waits.js +21 -32
- package/dist/workflows/waits.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +18 -45
- package/dist/workspace/agent-accounts.js +115 -55
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.d.ts +6 -40
- package/dist/workspace/agent-profiles.js +7 -76
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/backup-cli.d.ts +1 -1
- package/dist/workspace/backup-cli.js +14 -17
- package/dist/workspace/backup-cli.js.map +1 -1
- package/dist/workspace/backups.d.ts +1 -18
- package/dist/workspace/backups.js +9 -42
- package/dist/workspace/backups.js.map +1 -1
- package/dist/workspace/config.d.ts +19 -24
- package/dist/workspace/config.js +50 -35
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/migrations.js +2 -3
- package/dist/workspace/migrations.js.map +1 -1
- package/dist/workspace/projects-cli.d.ts +10 -8
- package/dist/workspace/projects-cli.js +21 -45
- package/dist/workspace/projects-cli.js.map +1 -1
- package/dist/workspace/projects.d.ts +4 -7
- package/dist/workspace/projects.js +13 -12
- package/dist/workspace/projects.js.map +1 -1
- package/dist/workspace/registry-entry.d.ts +4 -0
- package/dist/workspace/registry-entry.js +11 -0
- package/dist/workspace/registry-entry.js.map +1 -0
- package/dist/workspace/semaphore.js +1 -1
- package/dist/workspace/ui-state.js +1 -1
- package/dist/workspace/ui-state.js.map +1 -1
- package/dist/worktree-manifest.d.ts +14 -14
- package/dist/worktree-manifest.js +22 -25
- package/dist/worktree-manifest.js.map +1 -1
- package/dist/worktree-paths.d.ts +3 -0
- package/dist/worktree-paths.js +52 -0
- package/dist/worktree-paths.js.map +1 -0
- package/dist/worktree-setup.d.ts +12 -1
- package/dist/worktree-setup.js +14 -5
- package/dist/worktree-setup.js.map +1 -1
- package/dist/worktree-skill-cleanup.d.ts +11 -0
- package/dist/worktree-skill-cleanup.js +53 -0
- package/dist/worktree-skill-cleanup.js.map +1 -0
- package/package.json +15 -6
- package/scripts/benchmark-automation-lookups.ts +97 -0
- package/scripts/benchmark-conversation-lookup.ts +105 -0
- package/scripts/benchmark-family-reconcile.ts +8 -7
- package/scripts/benchmark-home.ts +3 -3
- package/scripts/benchmark-project-probes.mjs +1 -1
- package/scripts/benchmark-project.ts +41 -0
- package/scripts/benchmark-run-store.ts +10 -9
- package/scripts/benchmark-runtime.ts +30 -0
- package/scripts/benchmark-store-fixture.ts +43 -0
- package/scripts/benchmark-stuck-destroys.ts +25 -42
- package/scripts/benchmark-worker-lifecycle.ts +156 -0
- package/scripts/benchmark-workspace-events.ts +10 -9
- package/scripts/benchmark-worktree-retention.ts +133 -0
- package/scripts/check-pack.mjs +11 -2
- package/scripts/copy-runner-assets.d.mts +2 -0
- package/scripts/copy-runner-assets.mjs +69 -0
- package/scripts/inline-contract.mjs +63 -5
- package/scripts/measure-transcript-facts-health.mjs +93 -15
- package/scripts/measure-transcript-facts-lag.mjs +16 -7
- package/scripts/mock-acp-login.mjs +20 -0
- package/scripts/mock-acp-sessions.mjs +30 -0
- package/scripts/mock-acp.mjs +589 -0
- package/scripts/mock-antigravity-auth.mjs +62 -0
- package/scripts/mock-ask-answer.d.mts +2 -0
- package/scripts/mock-ask-answer.mjs +19 -0
- package/scripts/mock-autonomous.mjs +8 -1
- package/scripts/mock-ci-tool.mjs +79 -34
- package/scripts/mock-claude-subagents.mjs +1 -1
- package/scripts/mock-claude.mjs +56 -25
- package/scripts/mock-codex-app-server.mjs +69 -23
- package/scripts/mock-codex-subagents.mjs +1 -1
- package/scripts/mock-deferred-turn-start.mjs +1 -1
- package/scripts/mock-fixture-runner.mjs +184 -0
- package/scripts/mock-lifecycle.d.mts +2 -0
- package/scripts/mock-lifecycle.mjs +6 -2
- package/scripts/mock-nudge.mjs +6 -4
- package/scripts/mock-omp-rpc.mjs +52 -19
- package/scripts/mock-opencode-questions.d.mts +14 -0
- package/scripts/mock-opencode-questions.mjs +89 -0
- package/scripts/mock-opencode-serve.mjs +68 -89
- package/scripts/mock-pi-rpc.mjs +39 -16
- package/scripts/mock-provider-failures.mjs +51 -0
- package/scripts/mock-scenario.d.mts +6 -2
- package/scripts/mock-scenario.mjs +58 -23
- package/scripts/mock-silent-tail.mjs +2 -10
- package/scripts/mock-skill-data/antigravity.mjs +66 -0
- package/scripts/mock-skill-data/claude.mjs +83 -0
- package/scripts/mock-skill-data/codex.mjs +73 -0
- package/scripts/mock-skill-data/omp.mjs +59 -0
- package/scripts/mock-skill-data/opencode.mjs +82 -0
- package/scripts/mock-skill-data/pi.mjs +64 -0
- package/scripts/mock-skill-data.mjs +13 -0
- package/scripts/mock-skill-fixtures.d.mts +11 -0
- package/scripts/mock-skill-fixtures.mjs +62 -0
- package/scripts/mock-skill-list-data.d.mts +1 -0
- package/scripts/mock-skill-list-data.mjs +4 -0
- package/scripts/mock-skill-list.d.mts +1 -0
- package/scripts/mock-skill-list.mjs +14 -0
- package/scripts/mock-skill-trigger-data.mjs +4 -0
- package/scripts/mock-skill-trigger.mjs +34 -0
- package/scripts/mock-wire-evidence.config.mjs +10 -0
- package/scripts/mock-wire-tools.mjs +7 -1
- package/scripts/parity-rows.ts +9 -3
- package/scripts/profile-lint-compare.ts +101 -0
- package/scripts/profile-lint.ts +234 -0
- package/scripts/record-wait-oracle.ts +68 -0
- package/scripts/seed-archive-profile.ts +4 -2
- package/scripts/transcript-facts-fixture.mjs +1 -1
- package/scripts/transcript-facts-timing.mjs +165 -9
- package/scripts/windows-worker-job.cs +221 -0
- package/scripts/windows-worker-job.ps1 +41 -0
- package/web/dist/app-icon.png +0 -0
- package/web/dist/assets/accounts-section-D7EK3_7b.js +1 -0
- package/web/dist/assets/activity-motion-2BQBW4lA.js +2 -0
- package/web/dist/assets/activity-motion-DcKVM8fM.css +1 -0
- package/web/dist/assets/activity-route-Ct06t8Y9.js +1 -0
- package/web/dist/assets/agent-config-section-D6Lcc7c5.js +7 -0
- package/web/dist/assets/agent-defaults-section-BnDBbzuG.js +1 -0
- package/web/dist/assets/agents-settings-path-7X6_cvUg.js +1 -0
- package/web/dist/assets/appearance-CM6ahUyy.js +1 -0
- package/web/dist/assets/archive-on-merge-field-C7_Fwy2A.js +1 -0
- package/web/dist/assets/arrow-up-right-DKGzsMqY.js +1 -0
- package/web/dist/assets/attention-CBCeJN5w.js +1 -0
- package/web/dist/assets/automation-format-DB34jUyF.js +1 -0
- package/web/dist/assets/automations-route-7B_DF4O1.js +2 -0
- package/web/dist/assets/automations-route-CzqZXK0W.css +1 -0
- package/web/dist/assets/badge-DQ3U69Ht.js +1 -0
- package/web/dist/assets/bot-TkDIw4y-.js +1 -0
- package/web/dist/assets/bundle-mjs-rHxsej31.js +1 -0
- package/web/dist/assets/button-B7MKxYjT.js +1 -0
- package/web/dist/assets/centered-state-V15AR_qo.js +1 -0
- package/web/dist/assets/cez-idle-CdswdDRd.js +1 -0
- package/web/dist/assets/change-counts-CW7O8g5Y.js +1 -0
- package/web/dist/assets/check-OP-CVgZG.js +1 -0
- package/web/dist/assets/chevron-down-CHGyCDBH.js +1 -0
- package/web/dist/assets/chevron-right-BENZ-1ZN.js +1 -0
- package/web/dist/assets/chunk-BO2N2NFS-DQrpGzb-.js +131 -0
- package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +3 -0
- package/web/dist/assets/circle-x-7nTlobAF.js +1 -0
- package/web/dist/assets/code-editor-B4baSOhz.js +4 -0
- package/web/dist/assets/collapsible-BEV4FO-1.js +1 -0
- package/web/dist/assets/command-KdW7aO0N.js +1 -0
- package/web/dist/assets/commit-list-O4ugJ12w.js +1 -0
- package/web/dist/assets/core-DzoyrHjB.js +12 -0
- package/web/dist/assets/design-icons-CzEoMH9c.js +1 -0
- package/web/dist/assets/dialog-B531GGAo.js +1 -0
- package/web/dist/assets/diff-DKZvZQ2G.js +3 -0
- package/web/dist/assets/diff-controls-BpTFu29H.js +1 -0
- package/web/dist/assets/diff-view-D4yXb2w7.js +11 -0
- package/web/dist/assets/dist-BAoXdNsT.js +1 -0
- package/web/dist/assets/dist-BW234Kg5.js +1 -0
- package/web/dist/assets/dist-C5mlVBmd.js +1 -0
- package/web/dist/assets/dist-Czz3Y5qH.js +1 -0
- package/web/dist/assets/dist-DXO3xwbC.js +1 -0
- package/web/dist/assets/dist-Da4ckcJG.js +1 -0
- package/web/dist/assets/dropdown-menu-4e2iKSMT.js +1 -0
- package/web/dist/assets/es2015-CQth82uv.js +41 -0
- package/web/dist/assets/external-link-BE6y205O.js +1 -0
- package/web/dist/assets/file-preview-CUhut4J9.js +2 -0
- package/web/dist/assets/folder-browser-B7IbnF0d.js +1 -0
- package/web/dist/assets/folder-o-AvL3y3.js +1 -0
- package/web/dist/assets/format-BU7D3IfE.js +1 -0
- package/web/dist/assets/git-toolbar-po0QJciG.js +1 -0
- package/web/dist/assets/github-TgLTixC7.js +1 -0
- package/web/dist/assets/global-activity-route-OHCmn0ZO.js +1 -0
- package/web/dist/assets/highlighted-body-OFNGDK62-Cx8MiNVZ.js +1 -0
- package/web/dist/assets/highlighter-DvLzHjjY.js +3 -0
- package/web/dist/assets/hourglass-CikYdGGQ.js +1 -0
- package/web/dist/assets/html-report-BX3msvci.js +3 -0
- package/web/dist/assets/html-report-frame-uuqkBC0u.js +1 -0
- package/web/dist/assets/image-preview-Sisptm3b.js +1 -0
- package/web/dist/assets/index-C69_Sk06.css +1 -0
- package/web/dist/assets/index-CvVmG4Yu.js +21 -0
- package/web/dist/assets/label-Bt8n7Spq.js +1 -0
- package/web/dist/assets/lib-DrPFkMXk.js +1 -0
- package/web/dist/assets/live-protocol-DMhTnCmf.js +64 -0
- package/web/dist/assets/live-reads-Crd6fVGH.js +1 -0
- package/web/dist/assets/live-worker-DBw-5jVE.ts +36 -0
- package/web/dist/assets/loader-circle-CPBhhDbB.js +1 -0
- package/web/dist/assets/markdown-jle_P0a2.js +2 -0
- package/web/dist/assets/mermaid-GHXKKRXX-lTc_AjAC.js +1 -0
- package/web/dist/assets/moon-CRE9nU5R.js +1 -0
- package/web/dist/assets/nav-row-styles-DKeXbc4N.js +1 -0
- package/web/dist/assets/notifications-section-Bhqr3yOz.js +1 -0
- package/web/dist/assets/open-in-menu-BPp88ouw.js +1 -0
- package/web/dist/assets/own-lookup-DS54wXvD.js +1 -0
- package/web/dist/assets/page-shell-7pLJMOgh.js +1 -0
- package/web/dist/assets/page-shell-DQPYcKyL.css +1 -0
- package/web/dist/assets/play-CmVAj_fu.js +1 -0
- package/web/dist/assets/plus-CxRU2X8C.js +1 -0
- package/web/dist/assets/popover-BPgUYFyu.js +1 -0
- package/web/dist/assets/preload-helper-Czpn1I53.js +1 -0
- package/web/dist/assets/preview-pane-connected-CBt_nlmX.js +3 -0
- package/web/dist/assets/project-location-BRxXN249.js +1 -0
- package/web/dist/assets/project-order-AcHI4Dcl.js +1 -0
- package/web/dist/assets/project-rail-sortable-BmVI4_-T.js +1 -0
- package/web/dist/assets/project-router-CLJTc7gv.js +1 -0
- package/web/dist/assets/project-scope-context-Rv6S_BXt.js +4 -0
- package/web/dist/assets/projects-section-DnGSWHZJ.js +1 -0
- package/web/dist/assets/prompt-templates-section-8kBTviSw.js +1 -0
- package/web/dist/assets/queries-qCF-eOqZ.js +1 -0
- package/web/dist/assets/reference-chip-D0v0keVC.js +1 -0
- package/web/dist/assets/remote-settings-notice-D7G8cXSx.js +1 -0
- package/web/dist/assets/repo-git-DqBUjQMh.js +1 -0
- package/web/dist/assets/report-reader-DtSBGt0O.js +1 -0
- package/web/dist/assets/reports-CgbU2SrW.css +1 -0
- package/web/dist/assets/reports-ea3-iuBm.js +1 -0
- package/web/dist/assets/resources-section-CpXFFHXl.js +1 -0
- package/web/dist/assets/run-header-BWTrj0_2.js +2 -0
- package/web/dist/assets/run-header-Ccnr9k0X.css +1 -0
- package/web/dist/assets/save-cue-Cd3ZAPBS.js +1 -0
- package/web/dist/assets/saved-draft-BwzBc-_Y.js +1 -0
- package/web/dist/assets/select-aiSr0uTB.js +1 -0
- package/web/dist/assets/session-context-section-BRaZbxVO.js +119 -0
- package/web/dist/assets/settings-agent-picker-DMIqQhkC.js +1 -0
- package/web/dist/assets/settings-field-DP9sYv5a.js +1 -0
- package/web/dist/assets/settings-select-CCIMGnyA.js +1 -0
- package/web/dist/assets/settings-shell-CqiAPuLq.css +1 -0
- package/web/dist/assets/settings-shell-DwMbZhxp.js +1 -0
- package/web/dist/assets/sidebar-section-ClrORHpO.js +1 -0
- package/web/dist/assets/skills-B97qjJ7j.js +1 -0
- package/web/dist/assets/skills-pM_PouEs.js +1 -0
- package/web/dist/assets/smartphone-Lr8Ug2z_.js +1 -0
- package/web/dist/assets/sortable.esm-CAVTYaA3.js +5 -0
- package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
- package/web/dist/assets/status-dot-BRzVlF2X.js +1 -0
- package/web/dist/assets/switch-SP8pw5uU.js +1 -0
- package/web/dist/assets/tab-link-Bu1g-ArE.js +1 -0
- package/web/dist/assets/task-changes-BEfLx9dF.js +1 -0
- package/web/dist/assets/task-commits-6f0GpNF7.js +1 -0
- package/web/dist/assets/task-files-CA2xTRaM.js +1 -0
- package/web/dist/assets/task-github-item-BWapcDJr.js +1 -0
- package/web/dist/assets/task-groups-4tzKGROI.js +1 -0
- package/web/dist/assets/task-thread-0rKVutjQ.js +9 -0
- package/web/dist/assets/task-thread-DzADOhZd.css +1 -0
- package/web/dist/assets/tasks-table-C5uoZMFs.js +1 -0
- package/web/dist/assets/textarea-vJt9undk.js +1 -0
- package/web/dist/assets/thread-state-C3eDWXYs.js +4 -0
- package/web/dist/assets/toaster-BXnLIU3z.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-Ch0ok71s.css +1 -0
- package/web/dist/assets/use-hand-to-agent-state-DrAmCxn8.js +1 -0
- package/web/dist/assets/utils-DSMR_WLb.js +1 -0
- package/web/dist/assets/workflows-CW-1K6tq.js +7 -0
- package/web/dist/assets/workflows-DsE0ExV6.css +1 -0
- package/web/dist/assets/workspace-tools-BzDQrP3y.js +1 -0
- package/web/dist/assets/worktrees-section-ay1jJn_w.js +4 -0
- package/web/dist/assets/zoomable-image-CIQl1Wpe.js +1 -0
- package/web/dist/index.html +67 -32
- package/web/dist/live-worker.js +2 -2
- package/dist/agent-config/account-identity.d.ts +0 -28
- package/dist/agent-config/account-identity.js +0 -132
- package/dist/agent-config/account-identity.js.map +0 -1
- package/dist/agent-config/model-settings/claude.d.ts +0 -2
- package/dist/agent-config/model-settings/claude.js +0 -11
- package/dist/agent-config/model-settings/claude.js.map +0 -1
- package/dist/agent-config/model-settings/codex.d.ts +0 -2
- package/dist/agent-config/model-settings/codex.js +0 -16
- package/dist/agent-config/model-settings/codex.js.map +0 -1
- package/dist/agent-config/model-settings/opencode.d.ts +0 -2
- package/dist/agent-config/model-settings/opencode.js +0 -8
- package/dist/agent-config/model-settings/opencode.js.map +0 -1
- package/dist/agent-config/model-settings/pi.d.ts +0 -2
- package/dist/agent-config/model-settings/pi.js +0 -38
- package/dist/agent-config/model-settings/pi.js.map +0 -1
- package/dist/agent-config/model-settings/types.d.ts +0 -9
- package/dist/agent-config/model-settings/types.js +0 -2
- package/dist/agent-config/model-settings/types.js.map +0 -1
- package/dist/application-update/bin-recovery.d.ts +0 -5
- package/dist/application-update/bin-recovery.js +0 -96
- package/dist/application-update/bin-recovery.js.map +0 -1
- package/dist/application-update/discovery.d.ts +0 -23
- package/dist/application-update/discovery.js +0 -139
- package/dist/application-update/discovery.js.map +0 -1
- package/dist/application-update/helper.d.ts +0 -58
- package/dist/application-update/helper.js +0 -363
- package/dist/application-update/helper.js.map +0 -1
- package/dist/application-update/launcher.d.ts +0 -12
- package/dist/application-update/launcher.js +0 -61
- package/dist/application-update/launcher.js.map +0 -1
- package/dist/application-update/lock.d.ts +0 -4
- package/dist/application-update/lock.js +0 -70
- package/dist/application-update/lock.js.map +0 -1
- package/dist/application-update/npm-process.d.ts +0 -17
- package/dist/application-update/npm-process.js +0 -156
- package/dist/application-update/npm-process.js.map +0 -1
- package/dist/application-update/runtime-layout.d.ts +0 -20
- package/dist/application-update/runtime-layout.js +0 -91
- package/dist/application-update/runtime-layout.js.map +0 -1
- package/dist/application-update/scoped-recovery.d.ts +0 -32
- package/dist/application-update/scoped-recovery.js +0 -210
- package/dist/application-update/scoped-recovery.js.map +0 -1
- package/dist/application-update/service.d.ts +0 -86
- package/dist/application-update/service.js +0 -523
- package/dist/application-update/service.js.map +0 -1
- package/dist/automations/builtin-skill.d.ts +0 -7
- package/dist/automations/builtin-skill.js +0 -14
- package/dist/automations/builtin-skill.js.map +0 -1
- package/dist/ci-wait/injection.d.ts +0 -3
- package/dist/ci-wait/injection.js +0 -13
- package/dist/ci-wait/injection.js.map +0 -1
- package/dist/contract/application-update.d.ts +0 -32
- package/dist/contract/self-update.d.ts +0 -255
- package/dist/contract/skill-sources.d.ts +0 -125
- package/dist/contract/team-skill-ref.d.ts +0 -10
- package/dist/contract/voice.d.ts +0 -213
- package/dist/core/claude-cli-runner.d.ts +0 -85
- package/dist/core/claude-cli-runner.js +0 -899
- package/dist/core/claude-cli-runner.js.map +0 -1
- package/dist/core/claude-executable.js +0 -15
- package/dist/core/claude-executable.js.map +0 -1
- package/dist/core/claude-model-catalog.d.ts +0 -16
- package/dist/core/claude-model-catalog.js +0 -198
- package/dist/core/claude-model-catalog.js.map +0 -1
- package/dist/core/claude-stream.d.ts +0 -38
- package/dist/core/claude-stream.js +0 -77
- package/dist/core/claude-stream.js.map +0 -1
- package/dist/core/claude-ui-mapper.d.ts +0 -88
- package/dist/core/claude-ui-mapper.js +0 -851
- package/dist/core/claude-ui-mapper.js.map +0 -1
- package/dist/core/codex-app-server-runner.d.ts +0 -76
- package/dist/core/codex-app-server-runner.js +0 -1271
- package/dist/core/codex-app-server-runner.js.map +0 -1
- package/dist/core/codex-app-server-transport.d.ts +0 -52
- package/dist/core/codex-app-server-transport.js +0 -200
- package/dist/core/codex-app-server-transport.js.map +0 -1
- package/dist/core/codex-approvals.d.ts +0 -12
- package/dist/core/codex-approvals.js +0 -180
- package/dist/core/codex-approvals.js.map +0 -1
- package/dist/core/codex-hook-mapper.d.ts +0 -15
- package/dist/core/codex-hook-mapper.js +0 -73
- package/dist/core/codex-hook-mapper.js.map +0 -1
- package/dist/core/codex-model-catalog.d.ts +0 -10
- package/dist/core/codex-model-catalog.js +0 -110
- package/dist/core/codex-model-catalog.js.map +0 -1
- package/dist/core/codex-native-frames.d.ts +0 -35
- package/dist/core/codex-native-frames.js +0 -80
- package/dist/core/codex-native-frames.js.map +0 -1
- package/dist/core/codex-permissions.d.ts +0 -6
- package/dist/core/codex-permissions.js +0 -27
- package/dist/core/codex-permissions.js.map +0 -1
- package/dist/core/codex-stream-error.js.map +0 -1
- package/dist/core/codex-turn-outcome.d.ts +0 -10
- package/dist/core/codex-turn-outcome.js +0 -35
- package/dist/core/codex-turn-outcome.js.map +0 -1
- package/dist/core/codex-ui-mapper-state.d.ts +0 -84
- package/dist/core/codex-ui-mapper-state.js.map +0 -1
- package/dist/core/codex-ui-mapper.d.ts +0 -44
- package/dist/core/codex-ui-mapper.js +0 -799
- package/dist/core/codex-ui-mapper.js.map +0 -1
- package/dist/core/cursor-cli-flags.d.ts +0 -19
- package/dist/core/cursor-cli-flags.js +0 -47
- package/dist/core/cursor-cli-flags.js.map +0 -1
- package/dist/core/cursor-config-options.d.ts +0 -18
- package/dist/core/cursor-config-options.js +0 -31
- package/dist/core/cursor-config-options.js.map +0 -1
- package/dist/core/cursor-model-catalog.d.ts +0 -50
- package/dist/core/cursor-model-catalog.js +0 -306
- package/dist/core/cursor-model-catalog.js.map +0 -1
- package/dist/core/cursor-print-capabilities.d.ts +0 -14
- package/dist/core/cursor-print-capabilities.js +0 -169
- package/dist/core/cursor-print-capabilities.js.map +0 -1
- package/dist/core/cursor-print-process.d.ts +0 -31
- package/dist/core/cursor-print-process.js +0 -117
- package/dist/core/cursor-print-process.js.map +0 -1
- package/dist/core/cursor-print-runner.d.ts +0 -43
- package/dist/core/cursor-print-runner.js +0 -574
- package/dist/core/cursor-print-runner.js.map +0 -1
- package/dist/core/cursor-print-tool-catalog.d.ts +0 -3
- package/dist/core/cursor-print-tool-catalog.js +0 -13
- package/dist/core/cursor-print-tool-catalog.js.map +0 -1
- package/dist/core/cursor-print-ui-mapper.d.ts +0 -47
- package/dist/core/cursor-print-ui-mapper.js +0 -574
- package/dist/core/cursor-print-ui-mapper.js.map +0 -1
- package/dist/core/cursor-provider-error.d.ts +0 -9
- package/dist/core/cursor-provider-error.js +0 -15
- package/dist/core/cursor-provider-error.js.map +0 -1
- package/dist/core/cursor-runner.d.ts +0 -46
- package/dist/core/cursor-runner.js +0 -144
- package/dist/core/cursor-runner.js.map +0 -1
- package/dist/core/disclaim-spawn.d.ts +0 -11
- package/dist/core/disclaim-spawn.js +0 -60
- package/dist/core/disclaim-spawn.js.map +0 -1
- package/dist/core/omp-model-catalog.d.ts +0 -39
- package/dist/core/omp-model-catalog.js +0 -183
- package/dist/core/omp-model-catalog.js.map +0 -1
- package/dist/core/omp-runner.d.ts +0 -86
- package/dist/core/omp-runner.js +0 -818
- package/dist/core/omp-runner.js.map +0 -1
- package/dist/core/omp-subagent-rows.d.ts +0 -21
- package/dist/core/omp-subagent-rows.js +0 -99
- package/dist/core/omp-subagent-rows.js.map +0 -1
- package/dist/core/omp-ui-mapper.d.ts +0 -112
- package/dist/core/omp-ui-mapper.js +0 -807
- package/dist/core/omp-ui-mapper.js.map +0 -1
- package/dist/core/opencode-model-catalog.d.ts +0 -27
- package/dist/core/opencode-model-catalog.js +0 -189
- package/dist/core/opencode-model-catalog.js.map +0 -1
- package/dist/core/opencode-permissions.d.ts +0 -52
- package/dist/core/opencode-permissions.js +0 -101
- package/dist/core/opencode-permissions.js.map +0 -1
- package/dist/core/opencode-runtime-config.d.ts +0 -9
- package/dist/core/opencode-runtime-config.js +0 -26
- package/dist/core/opencode-runtime-config.js.map +0 -1
- package/dist/core/opencode-server-runner.d.ts +0 -75
- package/dist/core/opencode-server-runner.js +0 -1690
- package/dist/core/opencode-server-runner.js.map +0 -1
- package/dist/core/opencode-session-error.d.ts +0 -19
- package/dist/core/opencode-session-error.js +0 -42
- package/dist/core/opencode-session-error.js.map +0 -1
- package/dist/core/opencode-task-scope.js +0 -19
- package/dist/core/opencode-task-scope.js.map +0 -1
- package/dist/core/opencode-ui-mapper-state.d.ts +0 -82
- package/dist/core/opencode-ui-mapper-state.js.map +0 -1
- package/dist/core/opencode-ui-mapper.d.ts +0 -59
- package/dist/core/opencode-ui-mapper.js +0 -724
- package/dist/core/opencode-ui-mapper.js.map +0 -1
- package/dist/core/opencode-usage.d.ts +0 -32
- package/dist/core/opencode-usage.js.map +0 -1
- package/dist/core/pi-model-catalog.d.ts +0 -34
- package/dist/core/pi-model-catalog.js +0 -247
- package/dist/core/pi-model-catalog.js.map +0 -1
- package/dist/core/pi-runner.d.ts +0 -58
- package/dist/core/pi-runner.js +0 -587
- package/dist/core/pi-runner.js.map +0 -1
- package/dist/core/pi-ui-mapper.d.ts +0 -52
- package/dist/core/pi-ui-mapper.js +0 -408
- package/dist/core/pi-ui-mapper.js.map +0 -1
- package/dist/core/runner-factory.d.ts +0 -11
- package/dist/core/runner-factory.js +0 -36
- package/dist/core/runner-factory.js.map +0 -1
- package/dist/delegation/destroy-observation.d.ts +0 -42
- package/dist/delegation/destroy-observation.js +0 -115
- package/dist/delegation/destroy-observation.js.map +0 -1
- package/dist/delegation/idle-test-app.d.ts +0 -4
- package/dist/delegation/idle-test-app.js +0 -186
- package/dist/delegation/idle-test-app.js.map +0 -1
- package/dist/delegation/windows-test-app.d.ts +0 -5
- package/dist/delegation/windows-test-app.js +0 -64
- package/dist/delegation/windows-test-app.js.map +0 -1
- package/dist/home/display.d.ts +0 -4
- package/dist/home/display.js +0 -11
- package/dist/home/display.js.map +0 -1
- package/dist/home/switch.d.ts +0 -2
- package/dist/home/switch.js +0 -3
- package/dist/home/switch.js.map +0 -1
- package/dist/jobs/cli.d.ts +0 -2
- package/dist/jobs/cli.js +0 -53
- package/dist/jobs/cli.js.map +0 -1
- package/dist/jobs/command.d.ts +0 -9
- package/dist/jobs/command.js +0 -19
- package/dist/jobs/command.js.map +0 -1
- package/dist/jobs/job.d.ts +0 -77
- package/dist/jobs/job.js +0 -252
- package/dist/jobs/job.js.map +0 -1
- package/dist/runs/worker-deletion-proof.d.ts +0 -13
- package/dist/runs/worker-deletion-proof.js.map +0 -1
- package/dist/runs/worker-resource-holders.d.ts +0 -17
- package/dist/runs/worker-resource-holders.js +0 -34
- package/dist/runs/worker-resource-holders.js.map +0 -1
- package/dist/self-update/checkouts.d.ts +0 -46
- package/dist/self-update/checkouts.js +0 -284
- package/dist/self-update/checkouts.js.map +0 -1
- package/dist/self-update/cli.d.ts +0 -19
- package/dist/self-update/cli.js +0 -243
- package/dist/self-update/cli.js.map +0 -1
- package/dist/self-update/installer.d.ts +0 -24
- package/dist/self-update/installer.js +0 -139
- package/dist/self-update/installer.js.map +0 -1
- package/dist/self-update/launcher.d.ts +0 -30
- package/dist/self-update/launcher.js +0 -172
- package/dist/self-update/launcher.js.map +0 -1
- package/dist/self-update/layout.d.ts +0 -108
- package/dist/self-update/layout.js +0 -276
- package/dist/self-update/layout.js.map +0 -1
- package/dist/self-update/pulls.d.ts +0 -30
- package/dist/self-update/pulls.js +0 -128
- package/dist/self-update/pulls.js.map +0 -1
- package/dist/self-update/registry.d.ts +0 -37
- package/dist/self-update/registry.js +0 -86
- package/dist/self-update/registry.js.map +0 -1
- package/dist/self-update/restart.d.ts +0 -25
- package/dist/self-update/restart.js +0 -79
- package/dist/self-update/restart.js.map +0 -1
- package/dist/self-update/semver.d.ts +0 -19
- package/dist/self-update/semver.js +0 -79
- package/dist/self-update/semver.js.map +0 -1
- package/dist/self-update/service.d.ts +0 -115
- package/dist/self-update/service.js +0 -332
- package/dist/self-update/service.js.map +0 -1
- package/dist/self-update/supervisor.d.ts +0 -10
- package/dist/self-update/supervisor.js +0 -52
- package/dist/self-update/supervisor.js.map +0 -1
- package/dist/server/launch-key.d.ts +0 -5
- package/dist/server/launch-key.js +0 -35
- package/dist/server/launch-key.js.map +0 -1
- package/dist/server/self-update-routes.d.ts +0 -308
- package/dist/server/self-update-routes.js +0 -80
- package/dist/server/self-update-routes.js.map +0 -1
- package/dist/server/skill-sources.d.ts +0 -264
- package/dist/server/skill-sources.js +0 -130
- package/dist/server/skill-sources.js.map +0 -1
- package/dist/skills-provision.d.ts +0 -64
- package/dist/skills-provision.js +0 -325
- package/dist/skills-provision.js.map +0 -1
- package/dist/skills-remote.d.ts +0 -144
- package/dist/skills-remote.js +0 -847
- package/dist/skills-remote.js.map +0 -1
- package/dist/voice/decide.d.ts +0 -35
- package/dist/voice/decide.js +0 -329
- package/dist/voice/decide.js.map +0 -1
- package/dist/voice/decision-log.d.ts +0 -48
- package/dist/voice/decision-log.js +0 -117
- package/dist/voice/decision-log.js.map +0 -1
- package/dist/voice/engine.d.ts +0 -119
- package/dist/voice/engine.js +0 -61
- package/dist/voice/engine.js.map +0 -1
- package/dist/voice/fake-engine.d.ts +0 -10
- package/dist/voice/fake-engine.js +0 -192
- package/dist/voice/fake-engine.js.map +0 -1
- package/dist/voice/jev-engine.d.ts +0 -17
- package/dist/voice/jev-engine.js +0 -110
- package/dist/voice/jev-engine.js.map +0 -1
- package/dist/voice/pending-ask.d.ts +0 -17
- package/dist/voice/pending-ask.js +0 -51
- package/dist/voice/pending-ask.js.map +0 -1
- package/dist/voice/routes.d.ts +0 -115
- package/dist/voice/routes.js +0 -92
- package/dist/voice/routes.js.map +0 -1
- package/dist/voice/sentence.d.ts +0 -21
- package/dist/voice/sentence.js +0 -61
- package/dist/voice/sentence.js.map +0 -1
- package/dist/voice/thresholds.d.ts +0 -28
- package/dist/voice/thresholds.js +0 -29
- package/dist/voice/thresholds.js.map +0 -1
- package/dist/workflows/run/cezar-tools.d.ts +0 -45
- package/dist/workflows/run/cezar-tools.js +0 -117
- package/dist/workflows/run/cezar-tools.js.map +0 -1
- package/scripts/mock-cursor-hang-stdin-late.mjs +0 -35
- package/scripts/mock-cursor-hang-stdin.mjs +0 -30
- package/scripts/mock-cursor-print.mjs +0 -237
- package/scripts/omp-ci-wait.mjs +0 -29
- package/scripts/opencode-task-scope.d.mts +0 -18
- package/scripts/opencode-task-scope.mjs +0 -59
- package/scripts/pi-ci-wait.mjs +0 -17
- package/scripts/pi-default-tools.mjs +0 -22
- package/scripts/pi-retry-degraded-service.mjs +0 -16
- package/scripts/probe-cursor-print.mjs +0 -699
- package/scripts/voice-replay.ts +0 -50
- package/web/dist/assets/activity-motion-0wHCeUs7.css +0 -1
- package/web/dist/assets/activity-motion-hhx0e841.js +0 -2
- package/web/dist/assets/activity-route-De0BnSrc.js +0 -1
- package/web/dist/assets/agent-accounts-BCg-578Q.js +0 -18
- package/web/dist/assets/alert-dialog-Dj464rjk.js +0 -1
- package/web/dist/assets/bundle-mjs-BT31bpU6.js +0 -1
- package/web/dist/assets/button-CHUAMTHK.js +0 -3
- package/web/dist/assets/centered-state-DGyy0SuA.js +0 -1
- package/web/dist/assets/cez-idle-BT0U4GN_.js +0 -1
- package/web/dist/assets/chunk-BO2N2NFS-DE6qKn3r.js +0 -131
- package/web/dist/assets/commit-diff-panel-DYtYc_dH.js +0 -1
- package/web/dist/assets/control-locations-CA9TMupq.js +0 -1
- package/web/dist/assets/core-BCsw8oQw.js +0 -12
- package/web/dist/assets/design-icons-DmYTv2r1.js +0 -1
- package/web/dist/assets/diff-controls-BR2uqhwG.js +0 -1
- package/web/dist/assets/diff-tVGVhYyc.js +0 -3
- package/web/dist/assets/diff-view-CNM3u77o.js +0 -11
- package/web/dist/assets/dropdown-menu-DhrBcVgr.js +0 -1
- package/web/dist/assets/es2015-D345RR4o.js +0 -41
- package/web/dist/assets/file-preview-C1eTdJLJ.js +0 -2
- package/web/dist/assets/git-toolbar-Dwz8p8GW.js +0 -1
- package/web/dist/assets/github-BSezqH6f.js +0 -1
- package/web/dist/assets/github-sidebar-model-Ct0DltOv.js +0 -1
- package/web/dist/assets/global-activity-route-BZiYz-B0.js +0 -1
- package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +0 -1
- package/web/dist/assets/hourglass-B0lPAJvT.js +0 -1
- package/web/dist/assets/image-preview-Cq1vDiEo.js +0 -1
- package/web/dist/assets/index-B18AqW0Z.css +0 -1
- package/web/dist/assets/index-D489J7QW.js +0 -14
- package/web/dist/assets/lib-BxQXEXDF.js +0 -1
- package/web/dist/assets/live-protocol-BDY7JJpT.js +0 -64
- package/web/dist/assets/live-refetch-C0kQc3-z.js +0 -1
- package/web/dist/assets/live-worker-BWdeGzQX.ts +0 -34
- package/web/dist/assets/loader-circle-CZkGEdoI.js +0 -1
- package/web/dist/assets/markdown-D7DUNWcJ.js +0 -6
- package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +0 -1
- package/web/dist/assets/nav-row-styles-BZUUavOF.js +0 -1
- package/web/dist/assets/popover-DRcRI46x.js +0 -1
- package/web/dist/assets/preview-pane-connected-DGkEs_L3.js +0 -3
- package/web/dist/assets/project-router-1m_VlC22.js +0 -1
- package/web/dist/assets/project-scope-context-CaUqlAd7.js +0 -4
- package/web/dist/assets/queries-DYfIpJ-d.js +0 -1
- package/web/dist/assets/repo-git-CU1S5P-y.js +0 -1
- package/web/dist/assets/report-reader-DlZol2Ux.js +0 -1
- package/web/dist/assets/reports-B7QAzibP.css +0 -1
- package/web/dist/assets/reports-DIGGjk7C.js +0 -1
- package/web/dist/assets/run-header-CC7VUTg9.css +0 -1
- package/web/dist/assets/run-header-DPjiPKRe.js +0 -2
- package/web/dist/assets/skill-empty-hint-YDmkqgo-.js +0 -1
- package/web/dist/assets/skills-BMwanop_.js +0 -1
- package/web/dist/assets/skills-DFBiAuJG.js +0 -1
- package/web/dist/assets/skills-workflows-C21NystW.css +0 -1
- package/web/dist/assets/sortable.esm-zp_qkYGV.js +0 -5
- package/web/dist/assets/tab-link-DCUifQ46.js +0 -1
- package/web/dist/assets/task-changes-BZXWvQN3.js +0 -1
- package/web/dist/assets/task-commits-ByI9MSfc.js +0 -1
- package/web/dist/assets/task-files-LJbenpiH.js +0 -1
- package/web/dist/assets/task-github-item-B0CU9lGR.js +0 -1
- package/web/dist/assets/task-thread-CXCN__1a.js +0 -9
- package/web/dist/assets/task-thread-DtQ6uGfQ.css +0 -1
- package/web/dist/assets/textarea-DlVUfdWG.js +0 -1
- package/web/dist/assets/thread-state-BLaCzqeX.js +0 -4
- package/web/dist/assets/toaster-B1MyeHiE.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-BkmKad8x.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-C7esPJ-N.css +0 -1
- package/web/dist/assets/useInfiniteQuery-qEY8OhKb.js +0 -1
- package/web/dist/assets/useQuery-DOJQOEBO.js +0 -1
- package/web/dist/assets/workflows-Dbxb-d-6.js +0 -7
- package/web/dist/assets/ws-DvGmrP4z.js +0 -1
- package/web/dist/assets/zoomable-image-5pOUaPEg.js +0 -1
- /package/dist/{runs → delegation}/worker-deletion-proof.js +0 -0
- /package/dist/{core → runners/claude}/claude-executable.d.ts +0 -0
- /package/dist/{core → runners/codex}/codex-stream-error.d.ts +0 -0
- /package/dist/{core → runners/codex}/codex-stream-error.js +0 -0
- /package/dist/{core → runners/codex}/codex-ui-mapper-state.js +0 -0
- /package/dist/{core → runners/opencode}/opencode-task-scope.d.ts +0 -0
- /package/dist/{core → runners/opencode}/opencode-ui-mapper-state.js +0 -0
- /package/dist/{core → runners/opencode}/opencode-usage.js +0 -0
- /package/{scripts → dist/runners/pi/extensions}/pi-project-skills.mjs +0 -0
package/dist/runs/store.js
CHANGED
|
@@ -1,359 +1,55 @@
|
|
|
1
1
|
import { legacyIndexRows } from './legacy-run-rows.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addRunSource,
|
|
4
|
-
import { productName, logPrefix } from '../home/display.js';
|
|
5
|
-
import { productEnv } from '../core/product-env.js';
|
|
2
|
+
import { decodeRunRow, parseRunRecords } from './run-decode.js';
|
|
3
|
+
import { addRunSource, fallbackRunSource } from './project-run-sources.js';
|
|
6
4
|
import { registeredWaitRecord, registeredReceiptRecord } from './wait-registration-write.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
export { parseStoredSummary } from './run-summary-page.js';
|
|
13
|
-
import { defined } from '../core/defined.js';
|
|
14
|
-
import { autosaveCleanupBlocker, clearAutosaveCleanup } from '../autosave-cleanup.js';
|
|
15
|
-
import { EventEmitter } from 'node:events';
|
|
16
|
-
import { workerEvidenceRunIds, workerExecutionSchema } from './worker-execution.js';
|
|
17
|
-
import { agentTmpDirLocations, agentTmpDirMayExist, agentTmpDirOwnershipProven, removeAgentTmpDir } from './agent-tmpdir.js';
|
|
18
|
-
import { removeArtifacts } from '../artifacts/lifecycle.js';
|
|
19
|
-
import { randomUUID, createHash } from 'node:crypto';
|
|
5
|
+
import { stageDurableUpdate, stageDebouncedUpdate, stageConversation, stageStepUpdate, stepTotals, redactPatch } from './record-write-rules.js';
|
|
6
|
+
import { RunLifecycle, snapshotRun } from './lifecycle.js';
|
|
7
|
+
import { attachRunLifecycleListeners } from './lifecycle-registry.js';
|
|
8
|
+
import { workerExecutionsFactory } from './worker-executions-registry.js';
|
|
9
|
+
import { randomUUID } from 'node:crypto';
|
|
20
10
|
import { isDeepStrictEqual } from 'node:util';
|
|
21
|
-
import {
|
|
22
|
-
import { join
|
|
11
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
23
13
|
import { z } from 'zod';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { isUsageLimitHold
|
|
28
|
-
import { UNREAD_RUN_RULE, SWEEPABLE_RUN_RULE, RETENTION_RUN_RULE, REFERENCED_RUN_RULE } from '../contract/index.js';
|
|
29
|
-
import { matchesRunSearch, sqlPrefilterTokens } from '../contract/index.js';
|
|
30
|
-
import { storedDelegationStateSchema } from './delegation-state.js';
|
|
31
|
-
import { HistoryCompressor } from './history-compressor.js';
|
|
14
|
+
import { delegationStateSchema, workerDestroyRetrySchema, } from '../contract/index.js';
|
|
15
|
+
import { agentInputSchema, inboxClaimSchema } from '../contract/index.js';
|
|
16
|
+
import { queuedMessageSchema } from '../contract/index.js';
|
|
17
|
+
import { isUsageLimitHold } from '../contract/index.js';
|
|
32
18
|
import { LiveItemSnapshots } from './live-item-snapshots.js';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { workerExecutionIdentitySchema } from '../delegation/execution-identity.js';
|
|
36
|
-
import { inspectGeneration, processStartToken } from '../delegation/process-liveness.js';
|
|
37
|
-
import { collectSecretValues, redactDeep } from '../core/secret-redaction.js';
|
|
38
|
-
// Pure, dependency-free reference helpers — the same sanity bound the marker parser applies.
|
|
39
|
-
import { archivePullRequests, pullRequestKey } from './pull-requests.js';
|
|
40
|
-
import { isRepoScopedRef, promptNamesRepo, refUrlRepo } from './task-refs.js';
|
|
19
|
+
import { RunTranscriptFacts } from './transcript-facts-topic.js';
|
|
20
|
+
import { restoreHistory } from './history-file.js';
|
|
41
21
|
// Type-only module (zod + nothing else), so this cannot cycle back into the store.
|
|
42
22
|
import { workflowDefSchema } from '../workflows/types.js';
|
|
43
23
|
import { applyOutcomes } from './outcome-commit.js';
|
|
44
|
-
import {
|
|
24
|
+
import { trackReferencedIssues, trackReferencedPrs } from './run-references.js';
|
|
45
25
|
import { applyExit, doneCommits, exitDurability, RUN_EXITS } from './run-exits.js';
|
|
46
26
|
import { assertConversationIdFree } from './conversation-identity.js';
|
|
47
27
|
export { ConversationIdInUseError } from './conversation-identity.js';
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import { failLoadedInterruptedRun, restoreLoadedUsageLimitHold, settleLoadedStop } from './loaded-run-exits.js';
|
|
52
|
-
import { hasLegacyWaitFields, upgradeLegacyWaits, UNREADABLE_WAIT } from './legacy-waits.js';
|
|
28
|
+
import { StoredConversationLedger } from './conversation-ledger.js';
|
|
29
|
+
import { compactConversation } from './conversation-compaction.js';
|
|
30
|
+
import { RUNS_DB_FILE, RUNS_IMPORT_COMPLETE_KEY, RunDatabase, RunDatabaseBusyError, } from './run-database.js';
|
|
53
31
|
export { ciWaitEntry, holdsWorkerWait, upgradeLegacyWaits, workerWaitEntry } from './legacy-waits.js';
|
|
54
32
|
import { ExitEvents } from './exit-events.js';
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import { ColdReadCache, storedRow } from './cold-reads.js';
|
|
58
|
-
import { assertNoLegacyCockpit, assertNoLegacyWriter, backUpLegacyIndex, LEGACY_INDEX_FILE, LegacyWriterError, readLegacyIndex } from './legacy-index.js';
|
|
33
|
+
import { RunRetentionTopic } from './run-retention.js';
|
|
34
|
+
import { LEGACY_INDEX_FILE, LegacyWriterError } from './legacy-index.js';
|
|
59
35
|
import { toRunStoreOpenError } from './store-open-error.js';
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
36
|
+
import { importLegacyIndex, OPEN_RETRY_DELAYS_MS, sleepSync } from './store-open.js';
|
|
37
|
+
import { RunClaimsTopic, RunWriteRefusedError } from './run-claims-topic.js';
|
|
38
|
+
import { RunPinsTopic } from './run-pins.js';
|
|
62
39
|
import { createStoreOwnedRun } from './owned-run-create.js';
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* WHOLE array, so one record carrying it would have dropped every run in the
|
|
74
|
-
* file.
|
|
75
|
-
*
|
|
76
|
-
* Parse-and-fold rather than widen: the legacy id is accepted on the way in and
|
|
77
|
-
* collapsed to `claude`, so no consumer, wire type or contract schema ever sees
|
|
78
|
-
* a fourth runner. The narrowing is one-way and permanent (the index is
|
|
79
|
-
* re-serialized from the parsed records), which is what "old run records
|
|
80
|
-
* normalise identically to `claude`" in `core/model-identity.ts` has always
|
|
81
|
-
* claimed. Use ONLY for read-back of stored state — request bodies, settings and
|
|
82
|
-
* workflow step defs stay the three selectable ids (`RunnerId`), because nothing
|
|
83
|
-
* should be able to ASK for the legacy spelling.
|
|
84
|
-
*/
|
|
85
|
-
const storedRunnerSchema = z
|
|
86
|
-
.enum([...RUNNER_IDS, 'claude-cli'])
|
|
87
|
-
.transform((id) => (id === 'claude-cli' ? 'claude' : id));
|
|
88
|
-
const stepStateSchema = contractStepStateSchema.extend({ backend: storedRunnerSchema.optional() });
|
|
89
|
-
/** Exported for `./run-index.ts`, the read-only reader of the same records. Nothing else should
|
|
90
|
-
* parse a stored run — see `reconcileLoadedRun` for why a second parser is a correctness risk. */
|
|
91
|
-
export const runRecordSchema = contractRunRecordSchema.extend({
|
|
92
|
-
delegation: storedDelegationStateSchema,
|
|
93
|
-
lastWaitsError: contractRunRecordSchema.shape.lastWaitsError.catch(undefined),
|
|
94
|
-
automaticWakes: contractRunRecordSchema.shape.automaticWakes.catch(undefined),
|
|
95
|
-
waitDeliveryFailures: contractRunRecordSchema.shape.waitDeliveryFailures.catch(undefined),
|
|
96
|
-
runner: storedRunnerSchema.optional(),
|
|
97
|
-
notify: z.boolean().optional().catch(undefined),
|
|
98
|
-
webhook: contractRunRecordSchema.shape.webhook.catch(undefined),
|
|
99
|
-
destroyRetry: contractRunRecordSchema.shape.destroyRetry.catch(undefined),
|
|
100
|
-
stopping: contractRunRecordSchema.shape.stopping.catch(undefined),
|
|
101
|
-
hasPendingPermission: contractRunRecordSchema.shape.hasPendingPermission.catch(undefined),
|
|
102
|
-
autoResumeAt: z.string().datetime().optional().catch(undefined),
|
|
103
|
-
autoResumeAttempts: z.number().int().min(0).optional().catch(undefined),
|
|
104
|
-
pullRequests: z.preprocess((value) => Array.isArray(value)
|
|
105
|
-
? value.flatMap((entry) => {
|
|
106
|
-
const parsed = runPullRequestSchema.safeParse(entry);
|
|
107
|
-
return parsed.success ? [parsed.data] : [];
|
|
108
|
-
})
|
|
109
|
-
: undefined, z.array(runPullRequestSchema).optional()),
|
|
110
|
-
worktreeSetup: contractRunRecordSchema.shape.worktreeSetup.catch(undefined),
|
|
111
|
-
archived: z.boolean().default(false),
|
|
112
|
-
workflowDef: workflowDefSchema.optional().catch(undefined),
|
|
113
|
-
steps: z.array(stepStateSchema),
|
|
114
|
-
automation: contractRunRecordSchema.shape.automation.unwrap().extend({
|
|
115
|
-
automationRevision: z.number().int().positive(),
|
|
116
|
-
githubUrl: z.string().url(),
|
|
117
|
-
}).optional(),
|
|
118
|
-
automationTrigger: contractRunRecordSchema.shape.automationTrigger.unwrap().extend({
|
|
119
|
-
automationRevision: z.number().int().positive(),
|
|
120
|
-
}).optional(),
|
|
121
|
-
/** The handoff file's autosave records (hearsay-tools/cezarion#1809); unreadable drops the field. */
|
|
122
|
-
handoffRecords: contractRunRecordSchema.shape.handoffRecords.catch(undefined),
|
|
123
|
-
});
|
|
124
|
-
/** Read legacy wait fields into the wait list and salvage per entry, identically for live stores
|
|
125
|
-
* and the read-only workspace index. */
|
|
126
|
-
export function parseRunRecords(raw) {
|
|
127
|
-
if (Array.isArray(raw))
|
|
128
|
-
for (const row of raw) {
|
|
129
|
-
if (!row || typeof row !== 'object')
|
|
130
|
-
continue;
|
|
131
|
-
upgradeLegacyWaits(row);
|
|
132
|
-
// One unreadable wait must not evict the run, nor its readable siblings.
|
|
133
|
-
for (const key of ['waits', 'lastWaits']) {
|
|
134
|
-
if (row[key] === undefined)
|
|
135
|
-
continue;
|
|
136
|
-
const entries = Array.isArray(row[key]) ? row[key] : [];
|
|
137
|
-
const readable = entries.filter((entry) => waitSchema.safeParse(entry).success);
|
|
138
|
-
if (!Array.isArray(row[key]) || readable.length !== entries.length)
|
|
139
|
-
row.lastWaitsError = UNREADABLE_WAIT;
|
|
140
|
-
if (readable.length)
|
|
141
|
-
row[key] = readable;
|
|
142
|
-
else
|
|
143
|
-
delete row[key];
|
|
144
|
-
}
|
|
145
|
-
// One unreadable registration must not evict the run, nor its readable siblings (#781).
|
|
146
|
-
if (row.previewServers !== undefined) {
|
|
147
|
-
if (Array.isArray(row.previewServers))
|
|
148
|
-
row.previewServers = row.previewServers.filter((entry) => previewServerSchema.safeParse(entry).success);
|
|
149
|
-
else
|
|
150
|
-
delete row.previewServers;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return z.array(runRecordSchema).safeParse(raw);
|
|
154
|
-
}
|
|
155
|
-
/** One stored record (a row's `data`) through `parseRunRecords`' salvage and schema, with what the
|
|
156
|
-
* schema dropped. Read after the salvage ran: what it removes (an unreadable CI wait, a preview
|
|
157
|
-
* server entry) the runtime has decided to drop, and keeps dropping on the next write, as it always
|
|
158
|
-
* has; only what the schema does not know is put back. */
|
|
159
|
-
function decodeStoredRecord(raw) {
|
|
160
|
-
const upgraded = hasLegacyWaitFields(raw);
|
|
161
|
-
const parsed = parseRunRecords([raw]);
|
|
162
|
-
if (!parsed.success)
|
|
163
|
-
return undefined;
|
|
164
|
-
const run = parsed.data[0];
|
|
165
|
-
return { run, extras: collectRawExtras(raw, run), ...(upgraded ? { upgraded: true } : {}) };
|
|
166
|
-
}
|
|
167
|
-
/** One database row's `data` back into a record and its extras. Undefined when it does not parse:
|
|
168
|
-
* one unreadable row costs that row only. */
|
|
169
|
-
export function decodeRunRow(data) {
|
|
170
|
-
try {
|
|
171
|
-
return decodeStoredRecord(JSON.parse(data));
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/** One database row's `data` back into a record, for a reader that never writes it back. */
|
|
178
|
-
export function decodeRunRecord(data) {
|
|
179
|
-
try {
|
|
180
|
-
const parsed = parseRunRecords([JSON.parse(data)]);
|
|
181
|
-
return parsed.success ? parsed.data[0] : undefined;
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
40
|
+
import { WorkerResultsTopic } from './worker-results.js';
|
|
41
|
+
import { RunEventLogTopic } from './event-log.js';
|
|
42
|
+
import { RunRedaction } from './run-redaction.js';
|
|
43
|
+
import { RunArchiveTopic } from './run-archive.js';
|
|
44
|
+
import { RunReadFlagsTopic } from './run-read-flags.js';
|
|
45
|
+
import { replaceRecord, RunPersistenceTopic } from './run-persistence.js';
|
|
46
|
+
import { closeClaimSession, openClaimSession } from './run-claims.js';
|
|
47
|
+
import { RunColdReadsTopic } from './run-cold-reads.js';
|
|
48
|
+
import { RunQueriesTopic, sortNewestFirst } from './run-queries.js';
|
|
49
|
+
import { RunRepoScopeTopic } from './run-repo-scope.js';
|
|
187
50
|
export { LEGACY_INDEX_BACKUP_FILE, LEGACY_INDEX_FILE } from './legacy-index.js';
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
* finish importing a large `runs.json`. */
|
|
191
|
-
const OPEN_RETRY_DELAYS_MS = [50, 100, 200, 400, 800, 1600];
|
|
192
|
-
/** Block this thread for `ms`. Only `open` does, at boot, when there is nothing else to run. */
|
|
193
|
-
function sleepSync(ms) {
|
|
194
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
195
|
-
}
|
|
196
|
-
/** Runs (and conversation roots, one family query each) the open-time facts warm-up enumerates
|
|
197
|
-
* per event-loop turn (hearsay-tools/cezarion#949), so each slice stays a few milliseconds. */
|
|
198
|
-
const WARM_IDS_PER_SLICE = 100;
|
|
199
|
-
const MAX_RUNS_KEPT = 300;
|
|
200
|
-
/** How many archived root runs the run lists carry per project (#864): `GET /run-summaries?archived=recent`
|
|
201
|
-
* and `GET /workspace/runs-index`. Unarchived runs are never cut; older archived runs page in
|
|
202
|
-
* through `GET /run-summaries/archived` and the workspace search. */
|
|
203
|
-
export const ARCHIVED_WINDOW = 200;
|
|
204
|
-
/**
|
|
205
|
-
* Reconcile one record just read off disk with the fact that whichever process wrote it is gone.
|
|
206
|
-
*
|
|
207
|
-
* Mutates and returns `run`. Extracted from `RunStore.open` so the read-only index reader
|
|
208
|
-
* (`./run-index.ts`) answers the SAME question about a `running` row on disk. Two parsers that
|
|
209
|
-
* disagree here is a visible bug, not an internal one: the cockpit would show a task as running
|
|
210
|
-
* in the ⌘K index and failed the moment you opened it.
|
|
211
|
-
*
|
|
212
|
-
* `keepLive` (#367): leave `queued`/`running`/`waiting` untouched so the caller can recover them
|
|
213
|
-
* (RunManager.recover re-queues queued runs, resumes interrupted ones). Without it — one-shot CLI
|
|
214
|
-
* paths that never recover, and the index reader, which has no manager at all — live-looking runs
|
|
215
|
-
* are marked failed so no ghost stays behind.
|
|
216
|
-
*/
|
|
217
|
-
export function reconcileLoadedRun(run, opts) {
|
|
218
|
-
settleLoadedStop(run);
|
|
219
|
-
restoreLoadedUsageLimitHold(run);
|
|
220
|
-
failLoadedInterruptedRun(run, opts);
|
|
221
|
-
clearLoadedStaleResume(run);
|
|
222
|
-
restoreLostReferencedPullRequest(run, referencedPrDeclaration, resolveReferencedRef);
|
|
223
|
-
restoreOriginatingIssue(run);
|
|
224
|
-
// Repository scoping follows reconciliation: stores arm a handle asynchronously, while
|
|
225
|
-
// the read-only index applies its cached handle to these fresh records (#97). This ordering
|
|
226
|
-
// also scopes any referenced PR restored above without filtering candidate evidence first.
|
|
227
|
-
return run;
|
|
228
|
-
}
|
|
229
|
-
function clearLoadedStaleResume(run) {
|
|
230
|
-
// Recovery owns waits; a usage-limit appointment survives while status is waiting.
|
|
231
|
-
stageLoaded(run);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Settle an adopted dead owner’s live run without starting work. Untouched runs cancel; started
|
|
235
|
-
* runs become interrupted. Stop explicitly cancels its target. Mutates run.
|
|
236
|
-
*/
|
|
237
|
-
export function settleOrphanedRun(run, opts = {}) {
|
|
238
|
-
if (opts.stop && (run.status === 'queued' || run.status === 'running' || run.status === 'waiting'))
|
|
239
|
-
run.stopping = true;
|
|
240
|
-
if (run.status === 'queued' && !run.startedAt && run.workflowDef !== undefined &&
|
|
241
|
-
run.steps.every((step) => step.status === 'pending' && !step.startedAt && !step.sessionId)) {
|
|
242
|
-
Object.assign(run, applyExit(run, 'cancel'));
|
|
243
|
-
}
|
|
244
|
-
return reconcileLoadedRun(run, { keepLive: false });
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Every field `RunStore.open` may rewrite while loading a record: what `reconcileLoadedRun`
|
|
248
|
-
* assigns. Compared before and after, it tells open() which rows normalization changed, so it
|
|
249
|
-
* marks those dirty and no others. Edit it together with that function, or a normalized row stays unsaved (the store tests pin each field).
|
|
250
|
-
*/
|
|
251
|
-
function loadNormalizedFields(run) {
|
|
252
|
-
return JSON.stringify([
|
|
253
|
-
run.stopping, run.status, run.finishedAt, run.error, run.autoResumeAt,
|
|
254
|
-
run.referencedPullRequestUrl, run.pullRequests,
|
|
255
|
-
run.issueNumber, run.referencedIssueUrl, run.referencedIssueNumberSeeded, run.hasPendingPermission, run.steps.map((step) => step.status),
|
|
256
|
-
]);
|
|
257
|
-
}
|
|
258
|
-
/** Test seam (#779): `beforeTransaction` runs once `runs.json` is read and parsed, before the
|
|
259
|
-
* import asks for the write lock; `beforeCommit` runs inside the import transaction, after every
|
|
260
|
-
* row is written and before the last check that no older cezar wrote `runs.json` meanwhile. */
|
|
261
|
-
let legacyImportHook;
|
|
262
|
-
export function __setLegacyImportHookForTests(hook) {
|
|
263
|
-
legacyImportHook = hook;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Import legacy rows and the completion marker atomically, once. Recheck live-writer evidence
|
|
267
|
-
* before commit and preserve exact input bytes in a synced backup. Leave runs.json untouched;
|
|
268
|
-
* invalid entries are skipped and reported.
|
|
269
|
-
*/
|
|
270
|
-
function importLegacyIndex(db, dataDir) {
|
|
271
|
-
assertNoLegacyCockpit(dataDir);
|
|
272
|
-
const snapshot = readLegacyIndex(join(dataDir, LEGACY_INDEX_FILE));
|
|
273
|
-
const parsed = snapshot ? legacyIndexRows(snapshot.bytes, parseRunRecords) : undefined;
|
|
274
|
-
const rows = parsed?.rows ?? [];
|
|
275
|
-
const skipped = parsed?.skipped ?? 0;
|
|
276
|
-
const source = !snapshot ? 'none' : parsed ? LEGACY_INDEX_FILE : `${LEGACY_INDEX_FILE} (unparseable)`;
|
|
277
|
-
assertNoLegacyWriter(dataDir, snapshot);
|
|
278
|
-
legacyImportHook?.beforeTransaction?.();
|
|
279
|
-
let backup;
|
|
280
|
-
const commit = db.transaction({
|
|
281
|
-
upserts: rows,
|
|
282
|
-
deletes: [],
|
|
283
|
-
onlyIfMetaAbsent: RUNS_IMPORT_COMPLETE_KEY,
|
|
284
|
-
beforeCommit: () => {
|
|
285
|
-
legacyImportHook?.beforeCommit?.();
|
|
286
|
-
assertNoLegacyWriter(dataDir, snapshot);
|
|
287
|
-
backup = snapshot ? backUpLegacyIndex(dataDir, snapshot) : undefined;
|
|
288
|
-
const read = snapshot ? { bytes: snapshot.bytes.length, sha256: snapshot.sha256, backup } : {};
|
|
289
|
-
return { [RUNS_IMPORT_COMPLETE_KEY]: JSON.stringify({ at: new Date().toISOString(), source, records: rows.length, ...(skipped > 0 ? { skipped } : {}), ...read }) };
|
|
290
|
-
},
|
|
291
|
-
});
|
|
292
|
-
// Told once, by the import that committed: the marker means no later open reads runs.json again.
|
|
293
|
-
if (commit.skipped || backup === undefined)
|
|
294
|
-
return;
|
|
295
|
-
const kept = `Its exact bytes are kept in ${join(dataDir, backup)}; https://github.com/hearsay-tools/cezarion/blob/main/docs/run-history-recovery.md says how to import it after a repair.`;
|
|
296
|
-
if (!parsed)
|
|
297
|
-
console.warn(`${logPrefix()} ${LEGACY_INDEX_FILE} could not be read; no run was imported, and this project starts with an empty history. ${kept}`);
|
|
298
|
-
else if (skipped > 0)
|
|
299
|
-
console.warn(`${logPrefix()} ${skipped} of ${parsed.total} runs in ${LEGACY_INDEX_FILE} could not be read and were not imported. ${kept}`);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Finished rows whose stored summary an open-time normalization would still change: a referenced
|
|
303
|
-
* PR an older cezar's created-PR declaration erased, or issue attribution displaced by a
|
|
304
|
-
* follow-up declaration (see `reconcileLoadedRun`). Not live, so not
|
|
305
|
-
* in the `live` column; open decodes these few and keeps the ones it actually repaired.
|
|
306
|
-
*/
|
|
307
|
-
const LEGACY_REFERENCE_HEAL_SQL = "(json_extract(summary, '$.markerRefs.pr') IS NOT NULL AND json_extract(summary, '$.referencedPullRequestUrl') IS NULL)" +
|
|
308
|
-
" OR (NOT EXISTS (SELECT 1 FROM meta WHERE key = 'issue-attribution:' || runs.id AND value = CAST(runs.revision AS TEXT)) AND json_extract(summary, '$.markerRefs.issue') IS NOT NULL)";
|
|
309
|
-
/**
|
|
310
|
-
* Rows whose record names the automation that launched it while the stored summary does not
|
|
311
|
-
* (hearsay-tools/cezarion#1332): summaries a cezar wrote before `RunSummary.automationId`
|
|
312
|
-
* existed. Open rewrites each one's summary once, so the sidebar's Automations tab classifies a
|
|
313
|
-
* finished task nobody has opened since the upgrade. `instr` keeps the JSON parse off every
|
|
314
|
-
* other row.
|
|
315
|
-
*/
|
|
316
|
-
const AUTOMATION_ORIGIN_HEAL_SQL = "instr(data, '\"automation') > 0 AND json_extract(summary, '$.automationId') IS NULL" +
|
|
317
|
-
" AND (json_extract(data, '$.automation.automationId') IS NOT NULL OR json_extract(data, '$.automationTrigger.automationId') IS NOT NULL)";
|
|
318
|
-
/** A record as a branch owner, or undefined when it owns no branch and created no PR: the
|
|
319
|
-
* projection `listBranchOwners` reads off a row's summary and columns, computed from memory. */
|
|
320
|
-
export function branchOwnerOf(run) {
|
|
321
|
-
const branch = encodeRunRow(run).branch;
|
|
322
|
-
if (!branch && run.pullRequestUrl === undefined)
|
|
323
|
-
return undefined;
|
|
324
|
-
return {
|
|
325
|
-
id: run.id, title: run.title, status: run.status, archived: run.archived, createdAt: run.createdAt,
|
|
326
|
-
...(branch ? { branch } : {}),
|
|
327
|
-
...(run.baseBranch === undefined ? {} : { baseBranch: run.baseBranch }),
|
|
328
|
-
...(run.pullRequestUrl === undefined ? {} : { pullRequestUrl: run.pullRequestUrl }),
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
/** The one answer every control gives for a run another cezar process owns (`409 { error }`). */
|
|
332
|
-
export const RUN_IN_USE_ELSEWHERE = `run is in use by another ${productName('cezar')} process`;
|
|
333
|
-
/** The answer for a run this process stopped writing after a conflicting write. */
|
|
334
|
-
export const RUN_QUARANTINED = `run changed under this ${productName('cezar')} process — restart ${productName('cezar')} to reload it`;
|
|
335
|
-
/** A write this store must not make: another process owns the run, its owner died with work
|
|
336
|
-
* still live (adopt it first), or a conflict quarantined it. Nothing was changed. */
|
|
337
|
-
export class RunWriteRefusedError extends Error {
|
|
338
|
-
runId;
|
|
339
|
-
ownership;
|
|
340
|
-
constructor(runId, ownership, fallbackError) {
|
|
341
|
-
super(ownership === 'fallback' ? fallbackError ?? `run ${runId} is read only in the fallback project directory`
|
|
342
|
-
: ownership === 'quarantined' ? `${RUN_QUARANTINED}: ${runId}`
|
|
343
|
-
: ownership === 'orphaned' ? `run ${runId} belongs to a ${productName('cezar')} process that exited; take it over before writing it`
|
|
344
|
-
: `${RUN_IN_USE_ELSEWHERE}: ${runId}`);
|
|
345
|
-
this.runId = runId;
|
|
346
|
-
this.ownership = ownership;
|
|
347
|
-
this.name = 'RunWriteRefusedError';
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
/** Make `target` hold exactly `source`'s fields, keeping the object every holder references. */
|
|
351
|
-
function replaceRecord(target, source) {
|
|
352
|
-
for (const key of Object.keys(target))
|
|
353
|
-
if (!(key in source))
|
|
354
|
-
delete target[key];
|
|
355
|
-
Object.assign(target, source);
|
|
356
|
-
}
|
|
51
|
+
export { decodeRunRecord, decodeRunRow, parseRunRecords, runRecordSchema } from './run-decode.js';
|
|
52
|
+
export { ARCHIVED_WINDOW } from './run-index.js';
|
|
357
53
|
/**
|
|
358
54
|
* A worker's destroy moving between two unfinished phases, and nothing else changing: nothing the
|
|
359
55
|
* family reconcile reads changed, so it may skip that pass (#880). The first request and the
|
|
@@ -366,79 +62,12 @@ function isDestroyProgress(before, after) {
|
|
|
366
62
|
return false;
|
|
367
63
|
return isDeepStrictEqual({ ...before, destroy: undefined }, { ...after, destroy: undefined });
|
|
368
64
|
}
|
|
369
|
-
/** NDJSON transcript text to events; a damaged line is skipped, never fatal. */
|
|
370
|
-
function parseEvents(raw) {
|
|
371
|
-
return raw
|
|
372
|
-
.split('\n')
|
|
373
|
-
.filter(Boolean)
|
|
374
|
-
.map((line) => {
|
|
375
|
-
try {
|
|
376
|
-
return JSON.parse(line);
|
|
377
|
-
}
|
|
378
|
-
catch {
|
|
379
|
-
return null;
|
|
380
|
-
}
|
|
381
|
-
})
|
|
382
|
-
.filter((e) => e !== null);
|
|
383
|
-
}
|
|
384
|
-
function newestFirst(a, b) {
|
|
385
|
-
if (a.createdAt !== b.createdAt)
|
|
386
|
-
return a.createdAt < b.createdAt ? 1 : -1;
|
|
387
|
-
return a.seq < b.seq ? -1 : a.seq > b.seq ? 1 : 0;
|
|
388
|
-
}
|
|
389
|
-
/** An archived page's cursor: the last row's order, opaque to clients. A held run with no row yet
|
|
390
|
-
* lists after every row (`seq` is infinite), which JSON cannot carry, so it travels as null. */
|
|
391
|
-
function encodeArchivedCursor(key) {
|
|
392
|
-
return Buffer.from(JSON.stringify({ c: key.createdAt, s: Number.isFinite(key.seq) ? key.seq : null })).toString('base64url');
|
|
393
|
-
}
|
|
394
|
-
function decodeArchivedCursor(cursor) {
|
|
395
|
-
try {
|
|
396
|
-
const parsed = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8'));
|
|
397
|
-
if (typeof parsed !== 'object' || parsed === null)
|
|
398
|
-
return undefined;
|
|
399
|
-
const { c, s } = parsed;
|
|
400
|
-
if (typeof c !== 'string' || !(s === null || (typeof s === 'number' && Number.isInteger(s))))
|
|
401
|
-
return undefined;
|
|
402
|
-
return { createdAt: c, seq: s ?? Number.POSITIVE_INFINITY };
|
|
403
|
-
}
|
|
404
|
-
catch {
|
|
405
|
-
return undefined;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
/** The items newest first, each by the order beside it. Stable: ties keep their input order. */
|
|
409
|
-
function sortNewestFirst(entries) {
|
|
410
|
-
return [...entries].sort(([, a], [, b]) => newestFirst(a, b)).map(([item]) => item);
|
|
411
|
-
}
|
|
412
|
-
/** The delegation family a run belongs to, by its root's id: a root is its own, a worker its
|
|
413
|
-
* parent's. Workers cannot delegate, so a family is one root and its direct workers, never more. */
|
|
414
|
-
function familyRootOf(run) {
|
|
415
|
-
if (run.delegation?.role === 'root')
|
|
416
|
-
return run.id;
|
|
417
|
-
if (run.delegation?.role === 'worker')
|
|
418
|
-
return run.delegation.parentRunId;
|
|
419
|
-
return undefined;
|
|
420
|
-
}
|
|
421
|
-
/** Tests freeze the copies of cold runs, so an in-place write to one throws instead of vanishing. */
|
|
422
|
-
function deepFreeze(value) {
|
|
423
|
-
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
424
|
-
Object.freeze(value);
|
|
425
|
-
for (const child of Object.values(value))
|
|
426
|
-
deepFreeze(child);
|
|
427
|
-
}
|
|
428
|
-
return value;
|
|
429
|
-
}
|
|
430
|
-
const WORKER_PROCESS_CAP = 32;
|
|
431
|
-
const recordedProcessSchema = z.object({ pid: z.number().int().positive(), startToken: z.string().min(1).max(128).optional(),
|
|
432
|
-
pgid: z.number().int().positive().optional() }).strict();
|
|
433
|
-
const workerProcessRecordSchema = z.object({ generation: z.string().uuid(), controller: recordedProcessSchema,
|
|
434
|
-
processes: z.array(recordedProcessSchema).max(WORKER_PROCESS_CAP) }).strict();
|
|
435
|
-
const startToken = (pid) => { const token = processStartToken(pid); return token === undefined ? {} : { startToken: token }; };
|
|
436
65
|
/**
|
|
437
66
|
* Run rows in runs.db plus append-only NDJSON events and an in-process event bus. Hold live,
|
|
438
67
|
* pinned, related and unsettled records only. Optimistic writes debounce; durable commits
|
|
439
68
|
* publish after persistence. Family claims fence every write.
|
|
440
69
|
*/
|
|
441
|
-
export class RunStore
|
|
70
|
+
export class RunStore {
|
|
442
71
|
dataDir;
|
|
443
72
|
/** The held set: every record this store keeps in memory, by id. */
|
|
444
73
|
held = new Map();
|
|
@@ -446,27 +75,25 @@ export class RunStore extends EventEmitter {
|
|
|
446
75
|
pins = new Map();
|
|
447
76
|
/** Staged ids while a durable commit installs and announces them: never evicted mid-commit. */
|
|
448
77
|
committing = new Set();
|
|
449
|
-
saveTimer = null;
|
|
450
78
|
/** `null` once the store is closed, and in a `RunStore.unavailable` store (nothing is written,
|
|
451
79
|
* nothing is evicted). */
|
|
452
80
|
db = null;
|
|
453
|
-
get reports() { return reportsIndex(this.db, this, this.dataDir, this.openFailure); }
|
|
454
81
|
/** Why `open` failed, in a `RunStore.unavailable` store. */
|
|
455
82
|
openFailure;
|
|
456
|
-
persistence;
|
|
457
83
|
/** Runs whose held record is ahead of its row; the next save or commit writes them. */
|
|
458
84
|
dirty = new Set();
|
|
85
|
+
/** The typed lifecycle events the store publishes after each write (lifecycle.ts). */
|
|
86
|
+
published = new RunLifecycle();
|
|
87
|
+
lifecycle = this.published;
|
|
88
|
+
/** Unsubscribe handles of the process-wide listeners (lifecycle-registry.ts), attached before any write can publish. */
|
|
89
|
+
listenerHandles = attachRunLifecycleListeners(this.published);
|
|
459
90
|
/** The lifecycle events run exits write (B12). */
|
|
460
|
-
exitEvents = new ExitEvents((id, event) => this.appendEvent(id, event));
|
|
91
|
+
exitEvents = new ExitEvents((id, event) => this.eventLog.appendEvent(id, event));
|
|
461
92
|
/** Runs gone from memory whose rows the next save or commit deletes. */
|
|
462
93
|
deleted = new Set();
|
|
463
94
|
/** Deleted runs whose history files (events, handoff, images, artifacts) go once the delete of
|
|
464
95
|
* their row commits: until then a conflict can undo the delete and bring the row back. */
|
|
465
96
|
historyOwed = new Set();
|
|
466
|
-
/** The repository this project IS (#945), armed after `open()` by `setRepoHandle`. Undefined
|
|
467
|
-
* until it arrives and `null` when it cannot be known — both mean "unscoped", which is
|
|
468
|
-
* exactly the pre-#945 behavior. */
|
|
469
|
-
repoHandle;
|
|
470
97
|
/** `open()`'s `keepLive`, which a run read later from `runs.db` is reconciled with too. */
|
|
471
98
|
keepLive = false;
|
|
472
99
|
/** This store's identity in `run_claims`; undefined without a database. */
|
|
@@ -481,35 +108,129 @@ export class RunStore extends EventEmitter {
|
|
|
481
108
|
* created the row and has not written it yet. `extras` is what that `data` holds beyond the
|
|
482
109
|
* schema, which the next write of the row puts back (raw-record.ts). */
|
|
483
110
|
base = new Map();
|
|
484
|
-
/** Rows read cold in the current synchronous turn, so a commit staged from one is fenced against
|
|
485
|
-
* the version it was computed from. `owned`: its family was already this store's when read.
|
|
486
|
-
* Cleared at the next microtask: no commit spans a turn. */
|
|
487
|
-
coldBase = new Map();
|
|
488
|
-
coldReads = new ColdReadCache();
|
|
489
|
-
/** The family of each pending deletion, whose claim the deleting write is fenced against. */
|
|
490
|
-
deletedFamilies = new Map();
|
|
491
111
|
/** Rows a conflicting write excluded: this store refuses to write them until it is reopened. */
|
|
492
112
|
quarantined = new Set();
|
|
493
|
-
/**
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
113
|
+
/** The archive flag, archive on merge, completion actions and the transcript compressor (hearsay-tools/squawk#4041). */
|
|
114
|
+
archive;
|
|
115
|
+
/** The pinned and read flags (hearsay-tools/squawk#4041). */
|
|
116
|
+
readFlags;
|
|
117
|
+
/** What the transcript says about a run (hearsay-tools/squawk#4036). */
|
|
118
|
+
transcriptFacts;
|
|
119
|
+
/** Whether a run may go, and its deletion; the count-based archive (hearsay-tools/squawk#4037). */
|
|
120
|
+
retention;
|
|
121
|
+
/** The saved snapshot of a worker's collected result (hearsay-tools/squawk#4038). */
|
|
122
|
+
workerResults;
|
|
123
|
+
/** The event log and reference markers (hearsay-tools/squawk#4040). */
|
|
124
|
+
eventLog;
|
|
125
|
+
/** The scrub of events and free text (hearsay-tools/squawk#4040). */
|
|
126
|
+
redaction;
|
|
127
|
+
/** Claims, ownership, sources and fallback (hearsay-tools/squawk#4042). */
|
|
128
|
+
claims;
|
|
129
|
+
/** The holds that keep a run loaded (hearsay-tools/squawk#4042). */
|
|
130
|
+
runPins;
|
|
131
|
+
/** Flush, persist, the fence, conflicts and the save debounce (hearsay-tools/squawk#4043). */
|
|
132
|
+
persistence;
|
|
133
|
+
/** The held set's cold reads, holds and eviction (hearsay-tools/squawk#4044). */
|
|
134
|
+
rows;
|
|
135
|
+
/** The list and find queries (hearsay-tools/squawk#4044). */
|
|
136
|
+
queries;
|
|
137
|
+
/** The repository this project is, and the repair of the runs it rescopes (hearsay-tools/squawk#4044). */
|
|
138
|
+
repoScope;
|
|
139
|
+
/** The family conversation ledgers, read by message and request ID (hearsay-tools/squawk#4192). */
|
|
140
|
+
conversations = new StoredConversationLedger((id) => this.getRun(id), () => this.db?.archive);
|
|
141
|
+
executions;
|
|
142
|
+
/** A worker's execution, process, identity and scope records (hearsay-tools/squawk#4039), built on
|
|
143
|
+
* first use by the factory this process registered; throws when none is registered. */
|
|
144
|
+
get workerExecutions() {
|
|
145
|
+
return this.executions ??= workerExecutionsFactory()(this.dataDir, {
|
|
146
|
+
peek: (id) => this.rows.peek(id), getRun: (id) => this.getRun(id), writeDir: (id) => this.claims.writeDir(id),
|
|
147
|
+
sourceDataDir: (id) => this.claims.sourceDataDir(id), commitIndex: (input) => this.persistence.commitIndex(input),
|
|
148
|
+
published: this.published, workerResults: this.workerResults,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
500
151
|
liveItems = new LiveItemSnapshots();
|
|
501
|
-
fallbackFacts;
|
|
502
|
-
factsFor(id) { return this.isFallbackRun(id) ? this.fallbackFacts ??= new TranscriptFactsIndex(this.sourceDataDir(id), true) : this.facts; }
|
|
503
152
|
/** Capture both sources on the same synchronous sequence boundary before history IO. */
|
|
504
153
|
liveReadSnapshot(runId) {
|
|
505
154
|
return { events: this.liveItems.read(runId), throughSeq: this.seqs.get(runId) ?? Infinity };
|
|
506
155
|
}
|
|
507
|
-
constructor(dataDir) {
|
|
508
|
-
super();
|
|
156
|
+
constructor(dataDir, persist) {
|
|
509
157
|
this.dataDir = dataDir;
|
|
510
|
-
this.
|
|
511
|
-
|
|
512
|
-
|
|
158
|
+
this.rows = new RunColdReadsTopic({
|
|
159
|
+
db: () => this.db, keepLive: () => this.keepLive, repoHandle: () => this.repoScope.repoHandle, held: this.held, pins: this.pins,
|
|
160
|
+
committing: this.committing, dirty: this.dirty, deleted: this.deleted, quarantined: this.quarantined, claimed: this.claimed,
|
|
161
|
+
pendingClaims: this.pendingClaims, base: this.base, claims: () => this.claims, persistence: () => this.persistence, decodeRunRow,
|
|
162
|
+
});
|
|
163
|
+
this.redaction = new RunRedaction();
|
|
164
|
+
this.claims = new RunClaimsTopic(dataDir, {
|
|
165
|
+
db: () => this.db, owner: () => this.owner, keepLive: () => this.keepLive, held: this.held, base: this.base, dirty: this.dirty,
|
|
166
|
+
deleted: this.deleted, quarantined: this.quarantined, unreadable: this.rows.unreadable, claimed: this.claimed, pendingClaims: this.pendingClaims,
|
|
167
|
+
exitEvents: this.exitEvents, coldReads: this.rows.coldReads, decodeRunRow, anchoredFamilies: () => this.rows.anchoredFamilies(), scheduleSave: () => this.persistence.scheduleSave(),
|
|
168
|
+
});
|
|
169
|
+
this.runPins = new RunPinsTopic({ pins: this.pins, published: this.published, record: (id) => this.rows.record(id), peek: (id) => this.rows.peek(id), sweepIfSettled: (ids) => this.persistence.sweepIfSettled(ids) });
|
|
170
|
+
this.transcriptFacts = new RunTranscriptFacts(dataDir, {
|
|
171
|
+
isFallbackRun: (id) => this.claims.isFallbackRun(id),
|
|
172
|
+
sourceDataDir: (id) => this.claims.sourceDataDir(id),
|
|
173
|
+
isOpen: () => this.db !== null,
|
|
174
|
+
held: this.held,
|
|
175
|
+
listFamilyRunIds: (rootId) => this.queries.listFamilyRunIds(rootId),
|
|
176
|
+
listConversationRootIds: () => this.queries.listConversationRootIds(),
|
|
177
|
+
listRunIds: () => this.queries.listRunIds(),
|
|
178
|
+
});
|
|
179
|
+
this.workerResults = new WorkerResultsTopic(dataDir, {
|
|
180
|
+
peek: (id) => this.rows.peek(id), hasRun: (id) => this.rows.hasRun(id), hasFallbackRun: (id) => this.claims.hasFallbackRun(id),
|
|
181
|
+
writeDir: (id) => this.claims.writeDir(id), sourceDataDir: (id) => this.claims.sourceDataDir(id),
|
|
182
|
+
redactResult: (result) => this.redaction.redact({ type: 'worker-result', seq: 0, ts: result.observedAt, result }).result,
|
|
183
|
+
redactText: (text) => this.redaction.redactText(text), commitDelegation: (patches) => this.commitDelegation(patches),
|
|
184
|
+
});
|
|
185
|
+
this.eventLog = new RunEventLogTopic(dataDir, {
|
|
186
|
+
seqs: this.seqs, published: this.published, liveItems: this.liveItems, transcriptFacts: this.transcriptFacts, redaction: this.redaction,
|
|
187
|
+
record: (id) => this.rows.record(id), missingRunError: (runId) => this.claims.missingRunError(runId), sourceDataDir: (id) => this.claims.sourceDataDir(id),
|
|
188
|
+
touch: (run, before) => this.persistence.touch(run, before), change: (id, apply) => this.change(id, apply), repoHandle: () => this.repoScope.repoHandle,
|
|
189
|
+
maybeEnqueueHistoryCompress: (run) => this.archive.maybeEnqueueHistoryCompress(run),
|
|
190
|
+
});
|
|
191
|
+
this.retention = new RunRetentionTopic(dataDir, {
|
|
192
|
+
db: () => this.db, held: this.held, deleted: this.deleted, quarantined: this.quarantined,
|
|
193
|
+
historyOwed: this.historyOwed, seqs: this.seqs, published: this.published, transcriptFacts: this.transcriptFacts,
|
|
194
|
+
peek: (id) => this.rows.peek(id), hasRun: (id) => this.rows.hasRun(id), record: (id) => this.rows.record(id),
|
|
195
|
+
listWorkersOf: (parentId) => this.queries.listWorkersOf(parentId), isFallbackRun: (id) => this.claims.isFallbackRun(id),
|
|
196
|
+
hasFallbackRun: (id) => this.claims.hasFallbackRun(id), listOrder: (run) => this.queries.listOrder(run),
|
|
197
|
+
claimFamilies: (families) => this.claims.claimFamilies(families), markDeleted: (id, family) => this.persistence.markDeleted(id, family),
|
|
198
|
+
scheduleSave: () => this.persistence.scheduleSave(), commitIndex: (input) => this.persistence.commitIndex(input),
|
|
199
|
+
commitDelegation: (patches) => this.commitDelegation(patches), applyArchived: (run, archived) => this.archive.applyArchived(run, archived),
|
|
200
|
+
workerDeletionEvidence: (id) => this.workerExecutions.workerDeletionEvidence(id),
|
|
201
|
+
workerResults: this.workerResults,
|
|
202
|
+
readWorkerExecution: (id) => this.workerExecutions.readWorkerExecution(id), identityPath: (id) => this.workerExecutions.identityPath(id),
|
|
203
|
+
processesPath: (id) => this.workerExecutions.processesPath(id), scopePath: (id) => this.workerExecutions.scopePath(id),
|
|
204
|
+
executionPath: (id) => this.workerExecutions.executionPath(id), sourceDataDir: (id) => this.claims.sourceDataDir(id),
|
|
205
|
+
});
|
|
206
|
+
this.archive = new RunArchiveTopic(dataDir, {
|
|
207
|
+
db: () => this.db, held: this.held, deleted: this.deleted, quarantined: this.quarantined, pins: this.pins,
|
|
208
|
+
claimed: this.claimed, base: this.base, owner: () => this.owner, transcriptFacts: this.transcriptFacts,
|
|
209
|
+
decodeRunRow, sortNewestFirst, peek: (id) => this.rows.peek(id), record: (id) => this.rows.record(id),
|
|
210
|
+
listWorkersOf: (parentId) => this.queries.listWorkersOf(parentId), familyOf: (id) => this.persistence.familyOf(id),
|
|
211
|
+
claimFamilies: (families, opts) => this.claims.claimFamilies(families, opts), writeRefusal: (id) => this.claims.writeRefusal(id),
|
|
212
|
+
assertWritable: (staged) => this.persistence.assertWritable(staged), decodeCold: (row) => this.rows.decodeCold(row),
|
|
213
|
+
listOrder: (run) => this.queries.listOrder(run), commitIndex: (input, source, write) => this.persistence.commitIndex(input, source, write),
|
|
214
|
+
touch: (run, before, exit) => this.persistence.touch(run, before, exit),
|
|
215
|
+
readWorkerExecution: (id) => this.workerExecutions.readWorkerExecution(id),
|
|
216
|
+
});
|
|
217
|
+
this.readFlags = new RunReadFlagsTopic({
|
|
218
|
+
db: () => this.db, held: this.held, deleted: this.deleted, record: (id) => this.rows.record(id),
|
|
219
|
+
claimFamilies: (families) => this.claims.claimFamilies(families), touch: (run, before) => this.persistence.touch(run, before),
|
|
220
|
+
change: (id, apply) => this.change(id, apply),
|
|
221
|
+
});
|
|
222
|
+
this.persistence = new RunPersistenceTopic(dataDir, persist, {
|
|
223
|
+
db: () => this.db, owner: () => this.owner, openFailure: () => this.openFailure, repoHandle: () => this.repoScope.repoHandle,
|
|
224
|
+
keepLive: () => this.keepLive,
|
|
225
|
+
held: this.held, committing: this.committing, dirty: this.dirty, deleted: this.deleted, historyOwed: this.historyOwed,
|
|
226
|
+
quarantined: this.quarantined, claimed: this.claimed, pendingClaims: this.pendingClaims, base: this.base, coldBase: this.rows.coldBase,
|
|
227
|
+
coldReads: this.rows.coldReads, liveItems: this.liveItems, published: this.published, archive: this.archive, claims: this.claims,
|
|
228
|
+
retention: this.retention, decodeRunRow, peek: (id) => this.rows.peek(id), isAnchor: (id, run) => this.rows.isAnchor(id, run),
|
|
229
|
+
evictSettled: () => this.rows.evictSettled(),
|
|
230
|
+
});
|
|
231
|
+
this.queries = new RunQueriesTopic({ dataDir, db: () => this.db, held: this.held, pins: this.pins, deleted: this.deleted, unreadable: this.rows.unreadable,
|
|
232
|
+
base: this.base, coldReads: this.rows.coldReads, rows: this.rows, getRun: (id) => this.getRun(id) });
|
|
233
|
+
this.repoScope = new RunRepoScopeTopic({ dataDir, db: () => this.db, held: this.held, dirty: this.dirty, deleted: this.deleted, claims: this.claims, persistence: this.persistence, rows: this.rows });
|
|
513
234
|
}
|
|
514
235
|
/**
|
|
515
236
|
* Open the project's run store. See `reconcileLoadedRun` for what `keepLive` (#367) decides
|
|
@@ -550,22 +271,21 @@ export class RunStore extends EventEmitter {
|
|
|
550
271
|
const deferred = source && !existsSync(path) && !existsSync(join(dataDir, LEGACY_INDEX_FILE));
|
|
551
272
|
if (!deferred)
|
|
552
273
|
mkdirSync(join(dataDir, 'runs'), { recursive: true });
|
|
553
|
-
const store = new RunStore(dataDir);
|
|
274
|
+
const store = new RunStore(dataDir, persist);
|
|
554
275
|
store.keepLive = keepLive;
|
|
555
|
-
store.persistence = persist;
|
|
556
276
|
let db = RunDatabase.open(deferred ? ':memory:' : path);
|
|
557
277
|
try {
|
|
558
278
|
if (deferred)
|
|
559
279
|
db.transaction({ upserts: [], deletes: [], meta: { [RUNS_IMPORT_COMPLETE_KEY]: 'none' } });
|
|
560
280
|
else if (db.getMeta(RUNS_IMPORT_COMPLETE_KEY) === undefined)
|
|
561
|
-
importLegacyIndex(db, dataDir);
|
|
281
|
+
importLegacyIndex(db, dataDir, parseRunRecords);
|
|
562
282
|
if (source)
|
|
563
283
|
db = addRunSource(db, dataDir, source);
|
|
564
284
|
store.db = db;
|
|
565
285
|
store.owner = openClaimSession();
|
|
566
286
|
if (!maintenance) {
|
|
567
|
-
store.loadHeldRows();
|
|
568
|
-
store.warmTranscriptFacts();
|
|
287
|
+
store.claims.loadHeldRows();
|
|
288
|
+
store.transcriptFacts.warmTranscriptFacts();
|
|
569
289
|
store.exitEvents.writeLoaded();
|
|
570
290
|
}
|
|
571
291
|
}
|
|
@@ -603,630 +323,6 @@ export class RunStore extends EventEmitter {
|
|
|
603
323
|
/** Why this store has no database, when it is `RunStore.unavailable`'s: its runs are unknown,
|
|
604
324
|
* not absent. */
|
|
605
325
|
get unavailable() { return this.openFailure; }
|
|
606
|
-
/** Every sidecar for a run follows the winning record, never file-by-file fallback. */
|
|
607
|
-
sourceDataDir(id) { return this.isFallbackRun(id) ? dataReadDirs(this.dataDir)[1] : this.dataDir; }
|
|
608
|
-
isFallbackRun(id) { return this.db?.isFallback(id) ?? false; }
|
|
609
|
-
hasFallbackRun(id) { return this.db?.hasFallback(id) ?? false; }
|
|
610
|
-
fallbackDeleteError(id, kind = 'record') { return fallbackRunDeleteError(this.dataDir, kind === 'record' ? this.hasFallbackRun(id) : this.isFallbackRun(id), this.peek(id)?.worktreePath); }
|
|
611
|
-
/**
|
|
612
|
-
* Open-time load: the live rows, the finished rows a load normalization repairs, then the
|
|
613
|
-
* delegation families of the live ones. A row that does not parse is skipped and left in the
|
|
614
|
-
* database untouched; one warning says how many.
|
|
615
|
-
*
|
|
616
|
-
* Only rows this store can claim are loaded (#779, plan step 3). A live row whose family another
|
|
617
|
-
* live process claims — `serve`'s parked run, seen by a headless `cez run` — is that process's:
|
|
618
|
-
* it is not loaded, normalized or recovered here, and stays readable through `getRun` and the
|
|
619
|
-
* list rows. A live row nobody alive claims is taken over, as before: this open recovers it
|
|
620
|
-
* (`keepLive`) or settles it as interrupted.
|
|
621
|
-
*/
|
|
622
|
-
loadHeldRows() {
|
|
623
|
-
let unreadable = 0;
|
|
624
|
-
const decode = (row) => {
|
|
625
|
-
const decoded = decodeRunRow(row.data);
|
|
626
|
-
if (!decoded) {
|
|
627
|
-
unreadable++;
|
|
628
|
-
this.unreadable.add(row.id);
|
|
629
|
-
}
|
|
630
|
-
return decoded;
|
|
631
|
-
};
|
|
632
|
-
const live = this.db.listLive();
|
|
633
|
-
const owned = this.claimFamilies(live.map(rowFamily), { allowLive: true, wait: true });
|
|
634
|
-
for (const row of live) {
|
|
635
|
-
if (!owned.has(rowFamily(row)))
|
|
636
|
-
continue;
|
|
637
|
-
const decoded = decode(row);
|
|
638
|
-
if (decoded)
|
|
639
|
-
this.adoptLoadedRun(decoded, { keepLive: this.keepLive }, row);
|
|
640
|
-
}
|
|
641
|
-
const heal = this.db.listWhere(LEGACY_REFERENCE_HEAL_SQL).filter((row) => !this.held.has(row.id));
|
|
642
|
-
const healable = this.claimFamilies(heal.map(rowFamily));
|
|
643
|
-
for (const row of heal) {
|
|
644
|
-
if (!healable.has(rowFamily(row)))
|
|
645
|
-
continue;
|
|
646
|
-
const decoded = decode(row);
|
|
647
|
-
// Held only when the repair changed it: the next save writes it, then it leaves.
|
|
648
|
-
if (decoded) {
|
|
649
|
-
// Persist verification once even when legacy issue attribution was already correct.
|
|
650
|
-
const needsIssueCheck = decoded.run.markerRefs?.issue !== undefined &&
|
|
651
|
-
this.db.getMeta(`issue-attribution:${row.id}`) !== String(row.revision);
|
|
652
|
-
this.adoptLoadedRun(decoded, { keepLive: this.keepLive, onlyIfChanged: !needsIssueCheck }, row);
|
|
653
|
-
if (needsIssueCheck)
|
|
654
|
-
this.dirty.add(row.id);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
const stale = this.db.listWhere(AUTOMATION_ORIGIN_HEAL_SQL).filter((row) => !this.held.has(row.id));
|
|
658
|
-
const restamp = this.claimFamilies(stale.map(rowFamily));
|
|
659
|
-
for (const row of stale) {
|
|
660
|
-
if (!restamp.has(rowFamily(row)))
|
|
661
|
-
continue;
|
|
662
|
-
const decoded = decode(row);
|
|
663
|
-
// Nothing in the record changes, only its summary: held dirty, the next save rewrites it.
|
|
664
|
-
if (decoded) {
|
|
665
|
-
this.adoptLoadedRun(decoded, { keepLive: this.keepLive }, row);
|
|
666
|
-
this.dirty.add(row.id);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
for (const rootId of this.anchoredFamilies())
|
|
670
|
-
this.holdFamily(rootId, decode);
|
|
671
|
-
this.releaseUnheldClaims();
|
|
672
|
-
if (unreadable > 0)
|
|
673
|
-
console.warn(`${logPrefix()} ${unreadable} run(s) in ${RUNS_DB_FILE} could not be read; they are left in the database untouched.`);
|
|
674
|
-
}
|
|
675
|
-
/** Normalize a record just read from `row` (see `reconcileLoadedRun`) and hold it. Marks the row
|
|
676
|
-
* dirty only when normalization changed it, so the next save persists exactly the runs open()
|
|
677
|
-
* rewrote. A row read up from schema-3 wait fields counts as changed: its rewrite drops them
|
|
678
|
-
* and recomputes its summary and live column (`upgradeLegacyWaits`). The caller has claimed
|
|
679
|
-
* the row's family. */
|
|
680
|
-
adoptLoadedRun({ run, extras, upgraded }, opts, row) {
|
|
681
|
-
if (this.db?.familyHasFallback(rowFamily(row)))
|
|
682
|
-
return;
|
|
683
|
-
const before = loadNormalizedFields(run);
|
|
684
|
-
const wasCancelled = run.status === 'cancelled';
|
|
685
|
-
if (opts.settle)
|
|
686
|
-
settleOrphanedRun(run, { stop: opts.stop });
|
|
687
|
-
else
|
|
688
|
-
reconcileLoadedRun(run, opts);
|
|
689
|
-
const changed = upgraded === true || loadNormalizedFields(run) !== before;
|
|
690
|
-
if (opts.onlyIfChanged && !changed)
|
|
691
|
-
return;
|
|
692
|
-
this.held.set(run.id, run);
|
|
693
|
-
this.base.set(run.id, { revision: row.revision, seq: row.seq, data: row.data, extras });
|
|
694
|
-
if (changed)
|
|
695
|
-
this.dirty.add(run.id);
|
|
696
|
-
if (!wasCancelled && run.status === 'cancelled')
|
|
697
|
-
this.exitEvents.loadCancelled(run.id);
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Hold one delegation family: its root and the root's direct workers, read through the
|
|
701
|
-
* `parent_run_id` index. No recursion: workers cannot delegate, so a worker's own id never
|
|
702
|
-
* names a family. The caller has claimed it. `settle` settles its live rows instead of keeping
|
|
703
|
-
* them for recovery (`settleOrphanedRun`); `stopId` is the run a Stop settles as cancelled.
|
|
704
|
-
*/
|
|
705
|
-
holdFamily(rootId, decode = (row) => decodeRunRow(row.data), settle = false, stopId) {
|
|
706
|
-
const rows = [this.db.get(rootId), ...this.db.listByParent(rootId)];
|
|
707
|
-
for (const row of rows) {
|
|
708
|
-
if (!row || this.held.has(row.id) || this.deleted.has(row.id))
|
|
709
|
-
continue;
|
|
710
|
-
const decoded = decode(row);
|
|
711
|
-
if (decoded)
|
|
712
|
-
this.adoptLoadedRun(decoded, { keepLive: this.keepLive, settle, stop: row.id === stopId }, row);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
/** Make sure this store claims each of `families`; `claimStoreFamilies` takes the free ones. */
|
|
716
|
-
claimFamilies(families, opts = {}) {
|
|
717
|
-
return projectWriteRefused(this.dataDir) ? new Set() : claimStoreFamilies({
|
|
718
|
-
claimed: this.claimed,
|
|
719
|
-
pendingClaims: this.pendingClaims,
|
|
720
|
-
db: this.db,
|
|
721
|
-
owner: this.owner,
|
|
722
|
-
scheduleSave: () => this.scheduleSave(),
|
|
723
|
-
}, families, opts);
|
|
724
|
-
}
|
|
725
|
-
/** Release the claim of every family with nothing left in memory, once nothing is pending: a
|
|
726
|
-
* failed save keeps its families claimed until it succeeds. A failed release retries at the
|
|
727
|
-
* next sweep; `close()` releases the rest. */
|
|
728
|
-
releaseUnheldClaims() {
|
|
729
|
-
if (!this.db || !this.owner || this.dirty.size > 0 || this.deleted.size > 0)
|
|
730
|
-
return;
|
|
731
|
-
const kept = new Set();
|
|
732
|
-
for (const run of this.held.values())
|
|
733
|
-
kept.add(familyKey(run));
|
|
734
|
-
// A claim never taken has nothing to release in the database.
|
|
735
|
-
for (const family of this.pendingClaims.keys())
|
|
736
|
-
if (!kept.has(family))
|
|
737
|
-
this.pendingClaims.delete(family);
|
|
738
|
-
const released = [...this.claimed.keys()].filter((family) => !kept.has(family));
|
|
739
|
-
if (released.length === 0)
|
|
740
|
-
return;
|
|
741
|
-
try {
|
|
742
|
-
this.db.releaseClaims(this.owner.session, released);
|
|
743
|
-
for (const family of released)
|
|
744
|
-
this.claimed.delete(family);
|
|
745
|
-
}
|
|
746
|
-
catch {
|
|
747
|
-
// Busy or failing: the next sweep tries again.
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Who may change this run right now (see `RunOwnership`), or undefined when there is no such
|
|
752
|
-
* run. Read-only: nothing is claimed. Controls ask this first, so a run another process owns is
|
|
753
|
-
* refused with `RUN_IN_USE_ELSEWHERE` and a dead process's run is adopted before it is changed.
|
|
754
|
-
*/
|
|
755
|
-
runOwnership(id) {
|
|
756
|
-
if (this.quarantined.has(id))
|
|
757
|
-
return 'quarantined';
|
|
758
|
-
const held = this.held.get(id);
|
|
759
|
-
if (!this.db)
|
|
760
|
-
return held ? 'held' : undefined;
|
|
761
|
-
const family = held ? familyKey(held) : this.deleted.has(id) ? undefined : this.db.familyOf(id);
|
|
762
|
-
if (family === undefined)
|
|
763
|
-
return undefined;
|
|
764
|
-
if (this.db.familyHasFallback(family))
|
|
765
|
-
return 'fallback';
|
|
766
|
-
if (this.claimed.has(family) || this.pendingClaims.has(family))
|
|
767
|
-
return 'held';
|
|
768
|
-
const claim = this.db.getClaim(family);
|
|
769
|
-
if (claim && claimOwnerLive(claim))
|
|
770
|
-
return 'foreign';
|
|
771
|
-
// The same rule `claimFamilies` writes by: a dead owner left only settled runs → free.
|
|
772
|
-
return this.db.familyHasLive(family) ? 'orphaned' : 'free';
|
|
773
|
-
}
|
|
774
|
-
/** Why a control on this run must be refused here, or undefined when this store may change it. */
|
|
775
|
-
writeRefusal(id) {
|
|
776
|
-
const ownership = this.runOwnership(id);
|
|
777
|
-
if (ownership === 'quarantined')
|
|
778
|
-
return RUN_QUARANTINED;
|
|
779
|
-
if (ownership === 'fallback')
|
|
780
|
-
return this.fallbackRefusal(id).message;
|
|
781
|
-
return ownership === 'foreign' || ownership === 'orphaned' ? RUN_IN_USE_ELSEWHERE : undefined;
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Claim an orphaned family before a control, then settle its live rows.
|
|
785
|
-
* Stop cancels its target. Return the root id, or undefined for a live owner or missing run.
|
|
786
|
-
*/
|
|
787
|
-
adoptFamily(id, opts = {}) {
|
|
788
|
-
const family = this.db?.familyOf(id);
|
|
789
|
-
if (family === undefined || !this.claimFamilies([family], { allowLive: true, wait: true }).has(family))
|
|
790
|
-
return undefined;
|
|
791
|
-
this.holdFamily(family, undefined, true, opts.stop ? id : undefined);
|
|
792
|
-
this.exitEvents.writeLoaded();
|
|
793
|
-
return family;
|
|
794
|
-
}
|
|
795
|
-
/** Explicit controls only (`requireRunControl`): copy a fallback family in so it can be written. */
|
|
796
|
-
adoptFallbackFamily(id) {
|
|
797
|
-
const members = copyFallbackFamily(this.db, id, this.owner);
|
|
798
|
-
for (const member of members)
|
|
799
|
-
this.coldReads.forget(member);
|
|
800
|
-
return members.length > 0;
|
|
801
|
-
}
|
|
802
|
-
fallbackRefusal(id) { return new RunWriteRefusedError(id, 'fallback', fallbackRunDeleteError(this.dataDir, true)); }
|
|
803
|
-
/** Run files are written only for a family this store may write, never a fallback family. */
|
|
804
|
-
writeDir(id) { if (this.runOwnership(id) === 'fallback')
|
|
805
|
-
throw this.fallbackRefusal(id); return this.dataDir; }
|
|
806
|
-
/** Every run whose family another process owns (`foreignClaimedRunIds`). */
|
|
807
|
-
listForeignClaimedRunIds() { return foreignClaimedRunIds(this.db, this.owner); }
|
|
808
|
-
/** Non-terminal rows in the database (both directories) and the runs of families another live store claims. */
|
|
809
|
-
persistedLiveRunIds() { return { live: this.db?.listLive().map((row) => row.id) ?? [], foreign: liveForeignClaimedRunIds(this.db, this.owner) }; }
|
|
810
|
-
/**
|
|
811
|
-
* Whether a held run anchors itself (and its family) in memory. Anything else held is a family
|
|
812
|
-
* member or a settled write, and leaves at the next sweep (`evictSettled`).
|
|
813
|
-
*
|
|
814
|
-
* The held set is: every run that is live (`isLiveRecord`), pinned by a RunManager (`pin`),
|
|
815
|
-
* dirty, or inside a durable commit; plus the whole delegation family (root and direct
|
|
816
|
-
* workers) of any such run. Families are held because the RunManager reads a live run's family
|
|
817
|
-
* on every run event — `GET /runs/:id/relationships`, the global `reconcileWorkerWaits` pass
|
|
818
|
-
* (about twenty call sites), completion blockers and conversations — and decoding a cold
|
|
819
|
-
* record costs about 200 µs (JSON.parse plus the schema). Measured on a copy of a real
|
|
820
|
-
* cockpit's `runs.json` (958 runs, 957 of them delegated): a running root with 26 workers
|
|
821
|
-
* paid about 5 ms per family read, and the live families together about 10 ms per global
|
|
822
|
-
* pass, all on the event loop. Holding them costs memory in proportion to active work, not to
|
|
823
|
-
* history.
|
|
824
|
-
*/
|
|
825
|
-
isAnchor(id, run) {
|
|
826
|
-
return isLiveRecord(run) || this.pins.has(id) || this.dirty.has(id) || this.committing.has(id);
|
|
827
|
-
}
|
|
828
|
-
/** The family roots with an anchoring member in memory. */
|
|
829
|
-
anchoredFamilies() {
|
|
830
|
-
const roots = new Set();
|
|
831
|
-
for (const [id, run] of this.held) {
|
|
832
|
-
const root = familyRootOf(run);
|
|
833
|
-
if (root !== undefined && this.isAnchor(id, run))
|
|
834
|
-
roots.add(root);
|
|
835
|
-
}
|
|
836
|
-
return roots;
|
|
837
|
-
}
|
|
838
|
-
/** Drop every held run that is neither an anchor nor in an anchored family. A store without a
|
|
839
|
-
* database keeps everything: memory is the only copy it has. */
|
|
840
|
-
evictSettled() {
|
|
841
|
-
if (!this.db)
|
|
842
|
-
return;
|
|
843
|
-
const families = this.anchoredFamilies();
|
|
844
|
-
for (const [id, run] of this.held) {
|
|
845
|
-
if (this.isAnchor(id, run))
|
|
846
|
-
continue;
|
|
847
|
-
const root = familyRootOf(run);
|
|
848
|
-
if (root !== undefined && families.has(root))
|
|
849
|
-
continue;
|
|
850
|
-
this.held.delete(id);
|
|
851
|
-
this.base.delete(id);
|
|
852
|
-
this.coldReads.forget(id);
|
|
853
|
-
}
|
|
854
|
-
this.releaseUnheldClaims();
|
|
855
|
-
}
|
|
856
|
-
/** A run read from `runs.db`, normalized like a loaded one (`reconcileLoadedRun`, then the
|
|
857
|
-
* repository scope) but held by nobody. Undefined when absent, deleted or unreadable. */
|
|
858
|
-
loadCold(id) {
|
|
859
|
-
if (!this.db || this.deleted.has(id))
|
|
860
|
-
return undefined;
|
|
861
|
-
const row = this.db.get(id);
|
|
862
|
-
return row ? this.decodeCold(row) : undefined;
|
|
863
|
-
}
|
|
864
|
-
decodeCold(row) {
|
|
865
|
-
this.coldReads.at(row.id, row.revision); // the fence below moves to this revision
|
|
866
|
-
const decoded = decodeRunRow(row.data);
|
|
867
|
-
if (!decoded) {
|
|
868
|
-
this.unreadable.add(row.id);
|
|
869
|
-
return undefined;
|
|
870
|
-
}
|
|
871
|
-
this.unreadable.delete(row.id);
|
|
872
|
-
const { run, extras } = decoded;
|
|
873
|
-
if (this.coldBase.size === 0)
|
|
874
|
-
queueMicrotask(() => this.coldBase.clear());
|
|
875
|
-
const family = rowFamily(row);
|
|
876
|
-
this.coldBase.set(row.id, { revision: row.revision, seq: row.seq, data: row.data, extras, owned: this.claimed.has(family) || this.pendingClaims.has(family) });
|
|
877
|
-
reconcileLoadedRun(run, { keepLive: this.keepLive });
|
|
878
|
-
rescopeRun(run, this.repoHandle);
|
|
879
|
-
return run;
|
|
880
|
-
}
|
|
881
|
-
/** Hold a writable row. A fallback family's reads stay detached (the cold-read contract). */
|
|
882
|
-
holdDecoded(run) {
|
|
883
|
-
if (this.db?.familyHasFallback(familyKey(run)))
|
|
884
|
-
return process.env.VITEST ? deepFreeze(run) : run;
|
|
885
|
-
const read = this.coldBase.get(run.id);
|
|
886
|
-
this.held.set(run.id, run);
|
|
887
|
-
if (read)
|
|
888
|
-
this.base.set(run.id, storedRow(read));
|
|
889
|
-
return run;
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Hold a claimed run for a write; leave after settlement unless anchored.
|
|
893
|
-
* Take the family claim before reading its row. Return undefined for a live foreign owner
|
|
894
|
-
* or a fallback family: neither claim is granted.
|
|
895
|
-
*/
|
|
896
|
-
hold(id) {
|
|
897
|
-
const held = this.held.get(id);
|
|
898
|
-
if (held)
|
|
899
|
-
return held;
|
|
900
|
-
const family = this.db && !this.deleted.has(id) ? this.db.familyOf(id) : undefined;
|
|
901
|
-
if (family === undefined || !this.claimFamilies([family]).has(family))
|
|
902
|
-
return undefined;
|
|
903
|
-
const run = this.coldReads.claimed(id, this.coldBase.get(id), () => this.db?.revisionOf(id)) ?? this.loadCold(id);
|
|
904
|
-
if (!run)
|
|
905
|
-
return undefined;
|
|
906
|
-
this.holdDecoded(run);
|
|
907
|
-
this.scheduleSave();
|
|
908
|
-
return run;
|
|
909
|
-
}
|
|
910
|
-
/** The record a store write changes in place: held, or loaded to be. Undefined for a run this
|
|
911
|
-
* store may not write (another process's, or quarantined), so the write changes nothing. */
|
|
912
|
-
record(id) {
|
|
913
|
-
if (this.quarantined.has(id))
|
|
914
|
-
return undefined;
|
|
915
|
-
return this.held.get(id) ?? this.hold(id);
|
|
916
|
-
}
|
|
917
|
-
/** Read held legacy family members, or a detached cold record. */
|
|
918
|
-
peek(id) {
|
|
919
|
-
const held = this.held.get(id);
|
|
920
|
-
if (held)
|
|
921
|
-
return held;
|
|
922
|
-
const run = this.loadCold(id);
|
|
923
|
-
return run && this.answerCold(run, false);
|
|
924
|
-
}
|
|
925
|
-
/**
|
|
926
|
-
* A run just read off its row, as reads answer it: held when its family is in memory (a live
|
|
927
|
-
* family's members are read on every run event), else a copy nobody holds — frozen under
|
|
928
|
-
* vitest when it leaves the store (`freeze`).
|
|
929
|
-
*/
|
|
930
|
-
answerCold(run, freeze) {
|
|
931
|
-
const root = familyRootOf(run);
|
|
932
|
-
if (root !== undefined && this.anchoredFamilies().has(root))
|
|
933
|
-
return this.holdDecoded(run);
|
|
934
|
-
return freeze && process.env.VITEST ? deepFreeze(run) : run;
|
|
935
|
-
}
|
|
936
|
-
/** `getRun` for a row a query already read: the held object, else decoded from `row`. */
|
|
937
|
-
fromRow(row) {
|
|
938
|
-
const held = this.held.get(row.id);
|
|
939
|
-
if (held)
|
|
940
|
-
return held;
|
|
941
|
-
if (this.deleted.has(row.id))
|
|
942
|
-
return undefined;
|
|
943
|
-
const cached = this.coldReads.at(row.id, row.revision);
|
|
944
|
-
if (cached)
|
|
945
|
-
return cached;
|
|
946
|
-
const run = this.decodeCold(row);
|
|
947
|
-
return run && this.coldReads.keep(this.answerCold(run, true), this.coldBase.get(row.id), this.held.has(row.id));
|
|
948
|
-
}
|
|
949
|
-
/** Run `fn` reading each run that is not held at most once (`ColdReadCache`, hearsay-tools/cezarion#2378). */
|
|
950
|
-
withReadCache(fn) { return this.coldReads.scope(fn); }
|
|
951
|
-
/** Whether the run exists, held or not, without decoding it. */
|
|
952
|
-
hasRun(id) {
|
|
953
|
-
return this.held.has(id) || (!!this.db && !this.deleted.has(id) && this.db.has(id));
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Keep a run in memory for `holder` until `unpin(id, holder)`: a RunManager pins the runs it is
|
|
957
|
-
* executing (`active`) and the run a Continue is admitting (`continue`). A finished run is
|
|
958
|
-
* loaded. Pins are per holder, so releasing one never releases another. Returns the held record.
|
|
959
|
-
*/
|
|
960
|
-
pin(id, holder) {
|
|
961
|
-
const run = this.record(id);
|
|
962
|
-
if (!run)
|
|
963
|
-
return undefined;
|
|
964
|
-
let holders = this.pins.get(id);
|
|
965
|
-
if (!holders)
|
|
966
|
-
this.pins.set(id, holders = new Set());
|
|
967
|
-
holders.add(holder);
|
|
968
|
-
return run;
|
|
969
|
-
}
|
|
970
|
-
/** Publish a run's current record again without a write: something read beside the record
|
|
971
|
-
* changed, such as the run leaving the manager's live registries, which a detail's finish
|
|
972
|
-
* verdict reads (hearsay-tools/cezarion#1301). */
|
|
973
|
-
republish(id) {
|
|
974
|
-
const run = this.peek(id);
|
|
975
|
-
if (run)
|
|
976
|
-
this.emit('run', run, 'live-release');
|
|
977
|
-
}
|
|
978
|
-
/** Release `holder`'s pin. The run leaves memory at the next sweep once nothing else holds it. */
|
|
979
|
-
unpin(id, holder) {
|
|
980
|
-
const holders = this.pins.get(id);
|
|
981
|
-
if (!holders?.delete(holder))
|
|
982
|
-
return;
|
|
983
|
-
if (holders.size === 0)
|
|
984
|
-
this.pins.delete(id);
|
|
985
|
-
this.sweepIfSettled([id]);
|
|
986
|
-
}
|
|
987
|
-
/**
|
|
988
|
-
* Set discovered repository identity without blocking boot. Recompute conclusions from retained
|
|
989
|
-
* evidence, including cold records; null retains unknown-handle behavior.
|
|
990
|
-
*/
|
|
991
|
-
setRepoHandle(handle) {
|
|
992
|
-
this.repoHandle = handle;
|
|
993
|
-
if (!handle)
|
|
994
|
-
return; // nothing to prove foreign against
|
|
995
|
-
// `touch` per healed run: the cockpit is already live when the handle lands, so a corrected
|
|
996
|
-
// chip has to reach the open page over SSE, not just the next `runs.json` write.
|
|
997
|
-
let healed = false;
|
|
998
|
-
const own = `${handle.owner}/${handle.name}`.toLowerCase();
|
|
999
|
-
const foreign = (url) => url !== undefined && refUrlRepo(url) !== own;
|
|
1000
|
-
const stored = this.db?.listWhere(REFERENCED_RUN_RULE.sql).filter((row) => {
|
|
1001
|
-
if (this.held.has(row.id) || this.deleted.has(row.id))
|
|
1002
|
-
return false;
|
|
1003
|
-
const summary = parseStoredSummary(row.summary);
|
|
1004
|
-
return !summary || foreign(summary.referencedPullRequestUrl) || foreign(summary.referencedIssueUrl);
|
|
1005
|
-
}) ?? [];
|
|
1006
|
-
for (const run of [...this.held.values()]) {
|
|
1007
|
-
if (rescopeRun(run, this.repoHandle)) {
|
|
1008
|
-
this.touch(run);
|
|
1009
|
-
healed = true;
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
// Only rows this store may write: another process's runs heal when their owner arms its handle.
|
|
1013
|
-
const writable = this.claimFamilies(stored.map(rowFamily));
|
|
1014
|
-
for (const row of stored) {
|
|
1015
|
-
if (!writable.has(rowFamily(row)))
|
|
1016
|
-
continue;
|
|
1017
|
-
const run = this.decodeCold(row);
|
|
1018
|
-
// `decodeCold` already scoped it with the handle just armed; write it when that changed it.
|
|
1019
|
-
if (!run || !this.storedScopeDiffers(row, run))
|
|
1020
|
-
continue;
|
|
1021
|
-
this.holdDecoded(run);
|
|
1022
|
-
this.touch(run);
|
|
1023
|
-
healed = true;
|
|
1024
|
-
}
|
|
1025
|
-
// Discovery may finish after headless shutdown's final flush. Persist repairs now: the
|
|
1026
|
-
// debounced save is unref'd, so it cannot keep the CLI alive once the lookup completes.
|
|
1027
|
-
if (healed)
|
|
1028
|
-
this.flush();
|
|
1029
|
-
}
|
|
1030
|
-
/** Whether the stored summary still names a reference the scoped record no longer has. */
|
|
1031
|
-
storedScopeDiffers(row, run) {
|
|
1032
|
-
const summary = parseStoredSummary(row.summary);
|
|
1033
|
-
return summary?.referencedPullRequestUrl !== run.referencedPullRequestUrl ||
|
|
1034
|
-
summary?.referencedIssueUrl !== run.referencedIssueUrl || summary?.issueNumber !== run.issueNumber;
|
|
1035
|
-
}
|
|
1036
|
-
/**
|
|
1037
|
-
* The live set, newest first: runs whose record is live (`isLiveRecord`) or that a RunManager
|
|
1038
|
-
* pins. Finished runs are not here — read one by id (`getRun`), by an indexed query
|
|
1039
|
-
* (`listWorkersOf`, `findRunByClientRequestId`, `listRunsWithWorktree`,
|
|
1040
|
-
* `listBranchOwners`), or as list rows (`listRunSummaries`).
|
|
1041
|
-
*/
|
|
1042
|
-
listRuns() {
|
|
1043
|
-
return sortNewestFirst([...this.held].filter(([id, run]) => isLiveRecord(run) || this.pins.has(id)).map(([, run]) => [run, this.listOrder(run)]));
|
|
1044
|
-
}
|
|
1045
|
-
/** Where a held run lists: its row's insertion order, or after every row while this store has
|
|
1046
|
-
* not written it yet. The held set keeps such runs in creation order, and so does every list
|
|
1047
|
-
* that sorts them in held-set order (`sortNewestFirst` is stable). */
|
|
1048
|
-
listOrder(run) {
|
|
1049
|
-
return { createdAt: run.createdAt, seq: this.base.get(run.id)?.seq ?? Number.POSITIVE_INFINITY };
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
* EVERY run as a full record, newest first — decoded row by row. Only the legacy `GET /runs`
|
|
1053
|
-
* (older clients; the cockpit reads `GET /run-summaries`) may call this: it is exactly the
|
|
1054
|
-
* whole-history parse #779 exists to remove from everything else.
|
|
1055
|
-
*/
|
|
1056
|
-
listAllRunsForLegacyRoute() {
|
|
1057
|
-
const runs = new Map();
|
|
1058
|
-
for (const row of this.db?.listAll() ?? []) {
|
|
1059
|
-
if (this.deleted.has(row.id) || this.held.has(row.id))
|
|
1060
|
-
continue;
|
|
1061
|
-
const run = this.decodeCold(row);
|
|
1062
|
-
if (run)
|
|
1063
|
-
runs.set(row.id, [run, row]);
|
|
1064
|
-
}
|
|
1065
|
-
for (const [id, run] of this.held)
|
|
1066
|
-
runs.set(id, [run, this.listOrder(run)]);
|
|
1067
|
-
return sortNewestFirst(runs.values());
|
|
1068
|
-
}
|
|
1069
|
-
/** A bounded page of discoverable peer roots, including the current held overlay. */
|
|
1070
|
-
listPeerTaskSummaries(options) {
|
|
1071
|
-
return listPeerTaskSummaries({ db: this.db, held: this.held, skipped: this.deleted,
|
|
1072
|
-
order: run => this.listOrder(run), cold: id => this.coldSummary(id) }, options);
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Every run as its list row, newest first: the stored `summary` column, with each held run's
|
|
1076
|
-
* own projection laid over it — a debounced save keeps memory up to 300 ms ahead of the row,
|
|
1077
|
-
* and a run created since the last save has no row yet. `usage` is the caller's to attach.
|
|
1078
|
-
*
|
|
1079
|
-
* With `archivedWindow` (#864), the window the cockpit's lists read: every unarchived run, plus
|
|
1080
|
-
* the newest `archivedWindow` archived ROOT runs, and whether older archived roots were left
|
|
1081
|
-
* out. Archived workers are never in it (see `RunDatabase.listWindowSummaries`); with `roots`,
|
|
1082
|
-
* no worker is — the runs index, whose readers list no workers. A held run
|
|
1083
|
-
* lists by its record, so one archived or unarchived since the last save is ranked as it is now.
|
|
1084
|
-
*
|
|
1085
|
-
* A row this store found unreadable is left out, as the cold reader leaves out a row it had to
|
|
1086
|
-
* decode and could not. A finished row nobody has decoded is served from its summary by both,
|
|
1087
|
-
* which decodes nothing; reading it is what finds out (`isUnreadable`).
|
|
1088
|
-
*/
|
|
1089
|
-
listRunSummaries(options = {}) {
|
|
1090
|
-
const { archivedWindow, roots = false } = options;
|
|
1091
|
-
// Every skipped row may be an archived root, so ask for that many more: one past the window
|
|
1092
|
-
// after skipping is how "older ones were left out" is known without counting them.
|
|
1093
|
-
const rows = (archivedWindow === undefined
|
|
1094
|
-
? this.db?.listSummaries()
|
|
1095
|
-
: this.db?.listWindowSummaries(archivedWindow + 1 + this.deleted.size + this.unreadable.size + this.held.size, { roots })) ?? [];
|
|
1096
|
-
const summaries = new Map();
|
|
1097
|
-
for (const row of rows) {
|
|
1098
|
-
if (this.deleted.has(row.id) || this.held.has(row.id) || this.unreadable.has(row.id))
|
|
1099
|
-
continue;
|
|
1100
|
-
const summary = parseStoredSummary(row.summary) ?? this.coldSummary(row.id);
|
|
1101
|
-
if (summary)
|
|
1102
|
-
summaries.set(row.id, [summary, row]);
|
|
1103
|
-
}
|
|
1104
|
-
for (const [id, run] of this.held) {
|
|
1105
|
-
if (archivedWindow !== undefined && (run.archived || roots) && run.delegation?.role === 'worker')
|
|
1106
|
-
continue;
|
|
1107
|
-
summaries.set(id, [toRunSummary(run), this.listOrder(run)]);
|
|
1108
|
-
}
|
|
1109
|
-
const runs = sortNewestFirst(summaries.values());
|
|
1110
|
-
if (archivedWindow === undefined)
|
|
1111
|
-
return { runs, truncated: false };
|
|
1112
|
-
let archived = 0;
|
|
1113
|
-
const kept = runs.filter((run) => !run.archived || ++archived <= archivedWindow);
|
|
1114
|
-
return { runs: kept, truncated: archived > archivedWindow };
|
|
1115
|
-
}
|
|
1116
|
-
/**
|
|
1117
|
-
* One page of archived ROOT runs, newest first (#864): `GET /run-summaries/archived`, the
|
|
1118
|
-
* archived runs past the window. Held runs list by their record, as in `listRunSummaries`.
|
|
1119
|
-
* `before` is the previous page's `nextCursor`; with `q`, only runs `matchesRunQuery` keeps, and
|
|
1120
|
-
* `total` counts those. `automationNames` lets `q` match a task by its automation's name, as the
|
|
1121
|
-
* list's origin line shows it (hearsay-tools/cezarion#1616). A cursor this store did not write
|
|
1122
|
-
* answers `{ error }`.
|
|
1123
|
-
*
|
|
1124
|
-
* Ranking reads every archived root's key (id, created_at, seq: no record, no summary), so the
|
|
1125
|
-
* page and `total` agree with the held overlay; only the page's own rows are read in full.
|
|
1126
|
-
*/
|
|
1127
|
-
listArchivedRuns(options) {
|
|
1128
|
-
let after;
|
|
1129
|
-
if (options.before !== undefined) {
|
|
1130
|
-
after = decodeArchivedCursor(options.before);
|
|
1131
|
-
if (!after)
|
|
1132
|
-
return { error: 'before is not a cursor this server wrote' };
|
|
1133
|
-
}
|
|
1134
|
-
const q = options.q?.trim() ?? '';
|
|
1135
|
-
const ranked = this.rankArchivedRows(q, options.automationNames);
|
|
1136
|
-
this.overlayHeldArchived(ranked, q, options.automationNames);
|
|
1137
|
-
const ordered = [...ranked.entries()].sort(([, a], [, b]) => newestFirst(a, b));
|
|
1138
|
-
return this.archivedPage(ordered, after, options.limit);
|
|
1139
|
-
}
|
|
1140
|
-
/** The archived roots in `runs.db`, each by its key: every one without `q` (no record, no
|
|
1141
|
-
* summary read), and with `q` the searched rows `matchesRunSearch` keeps, which carry the summary
|
|
1142
|
-
* the search read. A deleted, held or unreadable run's row is left out; a held run joins in
|
|
1143
|
-
* `overlayHeldArchived`. */
|
|
1144
|
-
rankArchivedRows(q, automationNames) {
|
|
1145
|
-
const skipped = (id) => this.deleted.has(id) || this.held.has(id) || this.unreadable.has(id);
|
|
1146
|
-
const ranked = new Map();
|
|
1147
|
-
if (q === '') {
|
|
1148
|
-
for (const key of this.db?.listKeysWhere(ARCHIVED_ROOT) ?? [])
|
|
1149
|
-
if (!skipped(key.id))
|
|
1150
|
-
ranked.set(key.id, key);
|
|
1151
|
-
}
|
|
1152
|
-
else {
|
|
1153
|
-
for (const row of this.db?.searchRootSummaries(sqlPrefilterTokens(q, { automationNames })) ?? []) {
|
|
1154
|
-
if (skipped(row.id))
|
|
1155
|
-
continue;
|
|
1156
|
-
const summary = parseStoredSummary(row.summary) ?? this.coldSummary(row.id);
|
|
1157
|
-
if (summary?.archived && matchesRunSearch(summary, q, { automationNames }))
|
|
1158
|
-
ranked.set(row.id, { ...row, summary });
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
return ranked;
|
|
1162
|
-
}
|
|
1163
|
-
/** Lay the held archived roots over `ranked`, each by its record: it replaces its stored row
|
|
1164
|
-
* (already left out of `ranked`), and with `q` it must match. A held worker never lists. */
|
|
1165
|
-
overlayHeldArchived(ranked, q, automationNames) {
|
|
1166
|
-
for (const [id, run] of this.held) {
|
|
1167
|
-
if (!run.archived || run.delegation?.role === 'worker')
|
|
1168
|
-
continue;
|
|
1169
|
-
const summary = toRunSummary(run);
|
|
1170
|
-
if (q === '' || matchesRunSearch(summary, q, { automationNames }))
|
|
1171
|
-
ranked.set(id, { ...this.listOrder(run), summary });
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
/** The page of `ordered` after the cursor `after`: its summaries, the cursor of the next page,
|
|
1175
|
-
* and `total`, the count of all of `ordered`. */
|
|
1176
|
-
archivedPage(ordered, after, limit) {
|
|
1177
|
-
const rest = after ? ordered.filter(([, key]) => newestFirst(key, after) > 0) : ordered;
|
|
1178
|
-
const page = rest.slice(0, limit);
|
|
1179
|
-
const runs = this.hydrateArchivedPage(page);
|
|
1180
|
-
const last = page.at(-1)?.[1];
|
|
1181
|
-
return {
|
|
1182
|
-
runs,
|
|
1183
|
-
nextCursor: last && rest.length > page.length ? encodeArchivedCursor(last) : null,
|
|
1184
|
-
total: ordered.length,
|
|
1185
|
-
};
|
|
1186
|
-
}
|
|
1187
|
-
/** The page's summaries: a ranked key's own, else its stored one, read for the rows that have
|
|
1188
|
-
* none in a single query. A row whose stored summary does not fit the contract is projected from
|
|
1189
|
-
* its record; a row that cannot be read at all is left out. */
|
|
1190
|
-
hydrateArchivedPage(page) {
|
|
1191
|
-
const cold = new Map((this.db?.getSummaries(page.filter(([, key]) => !key.summary).map(([id]) => id)) ?? [])
|
|
1192
|
-
.map((row) => [row.id, parseStoredSummary(row.summary) ?? this.coldSummary(row.id)]));
|
|
1193
|
-
return page.flatMap(([id, key]) => {
|
|
1194
|
-
const summary = key.summary ?? cold.get(id);
|
|
1195
|
-
return summary ? [summary] : [];
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
/**
|
|
1199
|
-
* The ROOT runs, archived or not, that match `query` (`matchesRunSearch`), newest first: at most
|
|
1200
|
-
* `limit`, and whether more matched. The owned half of the workspace search (#864); held runs
|
|
1201
|
-
* match by their record.
|
|
1202
|
-
*/
|
|
1203
|
-
searchRunSummaries(query, limit) {
|
|
1204
|
-
const matched = new Map();
|
|
1205
|
-
// Rows come newest first, so the newest `limit + 1` row matches are all a page can use; held
|
|
1206
|
-
// runs, which may be newer than any row, are ranked in below.
|
|
1207
|
-
this.db?.visitRootSummaries(sqlPrefilterTokens(query), (row) => {
|
|
1208
|
-
if (this.deleted.has(row.id) || this.held.has(row.id) || this.unreadable.has(row.id))
|
|
1209
|
-
return true;
|
|
1210
|
-
const summary = parseStoredSummary(row.summary) ?? this.coldSummary(row.id);
|
|
1211
|
-
if (summary && matchesRunSearch(summary, query))
|
|
1212
|
-
matched.set(row.id, [summary, row]);
|
|
1213
|
-
return matched.size <= limit;
|
|
1214
|
-
});
|
|
1215
|
-
for (const [id, run] of this.held) {
|
|
1216
|
-
if (run.delegation?.role === 'worker')
|
|
1217
|
-
continue;
|
|
1218
|
-
const summary = toRunSummary(run);
|
|
1219
|
-
if (matchesRunSearch(summary, query))
|
|
1220
|
-
matched.set(id, [summary, this.listOrder(run)]);
|
|
1221
|
-
}
|
|
1222
|
-
const runs = sortNewestFirst(matched.values());
|
|
1223
|
-
return { runs: runs.slice(0, limit), truncated: runs.length > limit };
|
|
1224
|
-
}
|
|
1225
|
-
/** A row whose stored summary does not fit the contract any more, projected from its record. */
|
|
1226
|
-
coldSummary(id) {
|
|
1227
|
-
const run = this.loadCold(id);
|
|
1228
|
-
return run ? toRunSummary(run) : undefined;
|
|
1229
|
-
}
|
|
1230
326
|
/**
|
|
1231
327
|
* The run, or undefined. A held run is the held object (writes install into it). Any other run
|
|
1232
328
|
* is a fresh copy of its row each call, normalized like a loaded record — frozen under vitest —
|
|
@@ -1236,265 +332,27 @@ export class RunStore extends EventEmitter {
|
|
|
1236
332
|
const held = this.held.get(id);
|
|
1237
333
|
if (held)
|
|
1238
334
|
return held;
|
|
1239
|
-
const cached = this.deleted.has(id) || !this.db ? undefined : this.coldReads.at(id, this.db.revisionOf(id));
|
|
335
|
+
const cached = this.deleted.has(id) || !this.db ? undefined : this.rows.coldReads.at(id, this.db.revisionOf(id));
|
|
1240
336
|
if (cached)
|
|
1241
337
|
return cached;
|
|
1242
|
-
const run = this.loadCold(id);
|
|
1243
|
-
return run && this.coldReads.keep(this.answerCold(run, true), this.coldBase.get(id), this.held.has(id));
|
|
338
|
+
const run = this.rows.loadCold(id);
|
|
339
|
+
return run && this.rows.coldReads.keep(this.rows.answerCold(run, true), this.rows.coldBase.get(id), this.held.has(id));
|
|
1244
340
|
}
|
|
1245
341
|
/** Whether the run's row is in `runs.db` but its record could not be read here: what tells a
|
|
1246
342
|
* run that cannot open from one that does not exist. Known once something tried to read it. */
|
|
1247
343
|
isUnreadable(id) {
|
|
1248
|
-
return this.unreadable.has(id) && !this.held.has(id) && !this.deleted.has(id);
|
|
1249
|
-
}
|
|
1250
|
-
/** The ids in memory right now: the held set, for diagnostics and the benchmark's heap pass. */
|
|
1251
|
-
heldIds() {
|
|
1252
|
-
return [...this.held.keys()];
|
|
1253
|
-
}
|
|
1254
|
-
/**
|
|
1255
|
-
* The workers a root run owns, newest first, read off its own `receipts` (#659). Every
|
|
1256
|
-
* `createOwnedRun` writes the receipt and the worker record in one transaction, and the
|
|
1257
|
-
* receipt list is capped at 1,024 creations (#816), so this is a bounded lookup rather than a walk of the whole
|
|
1258
|
-
* project index. An ordinary or worker run owns nothing and costs one map read; a receipt
|
|
1259
|
-
* whose record has been deleted is skipped, never invented. A parent quarantined to
|
|
1260
|
-
* `invalid` has no readable receipts and reports none, which is also what the cockpit
|
|
1261
|
-
* assumes for that role.
|
|
1262
|
-
*/
|
|
1263
|
-
listOwnedWorkers(parentId) {
|
|
1264
|
-
const parent = this.getRun(parentId);
|
|
1265
|
-
if (parent?.delegation?.role !== 'root')
|
|
1266
|
-
return [];
|
|
1267
|
-
const workers = [];
|
|
1268
|
-
for (const receipt of parent.delegation.receipts) {
|
|
1269
|
-
const worker = this.getRun(receipt.workerId);
|
|
1270
|
-
if (worker?.delegation?.role === 'worker' && worker.delegation.parentRunId === parentId)
|
|
1271
|
-
workers.push(worker);
|
|
1272
|
-
}
|
|
1273
|
-
return workers.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
1274
|
-
}
|
|
1275
|
-
/** Every worker filed under `parentId` (the `parent_run_id` index plus memory), newest first:
|
|
1276
|
-
* receipts or not, which is what the reconcile and deletion checks ask. */
|
|
1277
|
-
listWorkersOf(parentId) {
|
|
1278
|
-
const workers = new Map();
|
|
1279
|
-
for (const run of this.held.values()) {
|
|
1280
|
-
if (run.delegation?.role === 'worker' && run.delegation.parentRunId === parentId)
|
|
1281
|
-
workers.set(run.id, [run, this.listOrder(run)]);
|
|
1282
|
-
}
|
|
1283
|
-
// Ids first: a live family's workers are usually all held, and then no record is read at all.
|
|
1284
|
-
const cold = (this.db?.listIdsByParent(parentId) ?? []).filter((id) => !this.held.has(id) && !this.deleted.has(id));
|
|
1285
|
-
for (const row of cold.length > 0 ? this.db.getMany(cold) : []) {
|
|
1286
|
-
const run = this.fromRow(row);
|
|
1287
|
-
if (run?.delegation?.role === 'worker' && run.delegation.parentRunId === parentId)
|
|
1288
|
-
workers.set(row.id, [run, row]);
|
|
1289
|
-
}
|
|
1290
|
-
return sortNewestFirst(workers.values());
|
|
1291
|
-
}
|
|
1292
|
-
/** The id of every worker, held or stored, without decoding any (recovery's worker passes). */
|
|
1293
|
-
listWorkerIds() {
|
|
1294
|
-
const ids = new Set(this.db?.listWorkerIds() ?? []);
|
|
1295
|
-
for (const id of this.deleted)
|
|
1296
|
-
ids.delete(id);
|
|
1297
|
-
for (const run of this.held.values())
|
|
1298
|
-
if (run.delegation?.role === 'worker')
|
|
1299
|
-
ids.add(run.id);
|
|
1300
|
-
return [...ids];
|
|
1301
|
-
}
|
|
1302
|
-
/** The id of every run whose delegation is quarantined (`invalid`), held or stored: its stored
|
|
1303
|
-
* summary says so, so nothing is decoded (scratch cleanup). */
|
|
1304
|
-
listQuarantinedRunIds() {
|
|
1305
|
-
const ids = new Set((this.db?.listKeysWhere("json_extract(summary, '$.delegation.role') = 'invalid'") ?? []).map((key) => key.id));
|
|
1306
|
-
for (const id of this.deleted)
|
|
1307
|
-
ids.delete(id);
|
|
1308
|
-
for (const [id, run] of this.held) {
|
|
1309
|
-
if (run.delegation?.role === 'invalid')
|
|
1310
|
-
ids.add(id);
|
|
1311
|
-
else
|
|
1312
|
-
ids.delete(id);
|
|
1313
|
-
}
|
|
1314
|
-
return [...ids];
|
|
1315
|
-
}
|
|
1316
|
-
/** All retained tasks this automation started, including variants, finished and archived runs.
|
|
1317
|
-
* Logs and receipts may compact independently. Read only matching keys in SQLite and overlay
|
|
1318
|
-
* held records so a debounced provenance update or deletion is reflected immediately. */
|
|
1319
|
-
countAutomationRuns(automationId) {
|
|
1320
|
-
const where = "json_extract(data, '$.automation.automationId') = ? OR " +
|
|
1321
|
-
"json_extract(data, '$.automationTrigger.automationId') = ?";
|
|
1322
|
-
const ids = new Set((this.db?.listKeysWhere(where, [automationId, automationId]) ?? [])
|
|
1323
|
-
.map((key) => key.id));
|
|
1324
|
-
for (const id of this.deleted)
|
|
1325
|
-
ids.delete(id);
|
|
1326
|
-
for (const [id, run] of this.held) {
|
|
1327
|
-
if (run.automation?.automationId === automationId || run.automationTrigger?.automationId === automationId)
|
|
1328
|
-
ids.add(id);
|
|
1329
|
-
else
|
|
1330
|
-
ids.delete(id);
|
|
1331
|
-
}
|
|
1332
|
-
return ids.size;
|
|
1333
|
-
}
|
|
1334
|
-
/** First non-archived task referencing a project issue, including secondary references. */
|
|
1335
|
-
findNonArchivedRunByIssue(repo, number) {
|
|
1336
|
-
const url = `https://github.com/${repo}/issues/${number}`.toLowerCase();
|
|
1337
|
-
const matches = (run) => {
|
|
1338
|
-
if (run.archived)
|
|
1339
|
-
return false;
|
|
1340
|
-
const urls = [run.referencedIssueUrl, ...(run.referencedIssueCandidates ?? []),
|
|
1341
|
-
...(run.automation?.event.startsWith('issue.') ? [run.automation.githubUrl] : []),
|
|
1342
|
-
...[...run.task.matchAll(new RegExp(ISSUE_URL_RE.source, 'gi'))].map((match) => match[0])]
|
|
1343
|
-
.filter((value) => value !== undefined)
|
|
1344
|
-
.map((value) => value.replace(/\/+$/, '').toLowerCase())
|
|
1345
|
-
.filter((value) => value.endsWith(`/issues/${number}`));
|
|
1346
|
-
// The legacy issueNumber is display-only and cannot establish repository identity.
|
|
1347
|
-
// Explicit task markers remain project-scoped unless a qualified URL contradicts them.
|
|
1348
|
-
return urls.includes(url) || (urls.length === 0 && run.markerRefs?.issue === number);
|
|
1349
|
-
};
|
|
1350
|
-
for (const run of this.held.values())
|
|
1351
|
-
if (matches(run))
|
|
1352
|
-
return run.id;
|
|
1353
|
-
// Secondary references are record-only: query them in SQLite rather than hydrating every
|
|
1354
|
-
// finished transcript or relying on the slim summary's primary issue number.
|
|
1355
|
-
const where = `archived = 0 AND (
|
|
1356
|
-
json_extract(data, '$.issueNumber') = ? OR json_extract(data, '$.markerRefs.issue') = ?
|
|
1357
|
-
OR lower(rtrim(json_extract(data, '$.referencedIssueUrl'), '/')) = ?
|
|
1358
|
-
OR EXISTS (SELECT 1 FROM json_each(data, '$.referencedIssueCandidates') WHERE lower(rtrim(value, '/')) = ?)
|
|
1359
|
-
OR (json_extract(data, '$.automation.event') LIKE 'issue.%' AND lower(rtrim(json_extract(data, '$.automation.githubUrl'), '/')) = ?)
|
|
1360
|
-
OR instr(lower(json_extract(data, '$.task')), ?) > 0
|
|
1361
|
-
)`;
|
|
1362
|
-
for (const key of this.db?.listKeysWhere(where, [number, number, url, url, url, url]) ?? []) {
|
|
1363
|
-
if (this.held.has(key.id) || this.deleted.has(key.id) || this.unreadable.has(key.id))
|
|
1364
|
-
continue;
|
|
1365
|
-
const run = this.getRun(key.id);
|
|
1366
|
-
if (run && matches(run))
|
|
1367
|
-
return key.id;
|
|
1368
|
-
}
|
|
1369
|
-
return undefined;
|
|
1370
|
-
}
|
|
1371
|
-
/**
|
|
1372
|
-
* The runs automation receipts launched, by receipt id (`automation.receiptId` or
|
|
1373
|
-
* `automationTrigger.receiptId`). Memory answers first; a receipt it does not know costs one
|
|
1374
|
-
* pass over `runs.db` that reads the records' JSON in SQLite — only a crash leftover (a
|
|
1375
|
-
* receipt still `reserved` at startup) ever asks.
|
|
1376
|
-
*/
|
|
1377
|
-
findRunIdsByAutomationReceipt(receiptIds) {
|
|
1378
|
-
const wanted = new Set(receiptIds);
|
|
1379
|
-
const found = new Map();
|
|
1380
|
-
const receiptOf = (run) => run.automation?.receiptId ?? run.automationTrigger?.receiptId;
|
|
1381
|
-
for (const run of this.held.values()) {
|
|
1382
|
-
const receipt = receiptOf(run);
|
|
1383
|
-
if (receipt !== undefined && wanted.has(receipt))
|
|
1384
|
-
found.set(receipt, run.id);
|
|
1385
|
-
}
|
|
1386
|
-
const missing = [...wanted].filter((receipt) => !found.has(receipt));
|
|
1387
|
-
if (missing.length === 0 || !this.db)
|
|
1388
|
-
return found;
|
|
1389
|
-
const where = "json_extract(data, '$.automation.receiptId') IN (SELECT value FROM json_each(?))" +
|
|
1390
|
-
" OR json_extract(data, '$.automationTrigger.receiptId') IN (SELECT value FROM json_each(?))";
|
|
1391
|
-
for (const key of this.db.listKeysWhere(where, [JSON.stringify(missing), JSON.stringify(missing)])) {
|
|
1392
|
-
if (this.held.has(key.id) || this.deleted.has(key.id))
|
|
1393
|
-
continue;
|
|
1394
|
-
const run = this.getRun(key.id);
|
|
1395
|
-
const receipt = run && receiptOf(run);
|
|
1396
|
-
if (receipt !== undefined && wanted.has(receipt) && !found.has(receipt))
|
|
1397
|
-
found.set(receipt, key.id);
|
|
1398
|
-
}
|
|
1399
|
-
return found;
|
|
1400
|
-
}
|
|
1401
|
-
/** The id of every root whose delegation carries a conversation, held or stored: recovery's full
|
|
1402
|
-
* reconcile pass (#661). Only roots' records are read, in SQLite. `naming` keeps the ledgers whose
|
|
1403
|
-
* messages name that run id, filtered there too, so a deleted peer decodes no other root. */
|
|
1404
|
-
listConversationRootIds(naming) {
|
|
1405
|
-
const where = `json_extract(summary, '$.delegation.role') = 'root' AND json_extract(data, '$.delegation.conversation') IS NOT NULL${naming ? " AND instr(json_extract(data, '$.delegation.conversation.messages'), ?) > 0" : ''}`;
|
|
1406
|
-
const ids = new Set((this.db?.listKeysWhere(where, naming ? [naming] : []) ?? []).map((key) => key.id));
|
|
1407
|
-
for (const id of this.deleted)
|
|
1408
|
-
ids.delete(id);
|
|
1409
|
-
for (const [id, run] of this.held) {
|
|
1410
|
-
if (run.delegation?.role === 'root' && run.delegation.conversation && (!naming || run.delegation.conversation.messages.some(message => [message.senderRunId, message.recipientRunId].includes(naming))))
|
|
1411
|
-
ids.add(id);
|
|
1412
|
-
else
|
|
1413
|
-
ids.delete(id);
|
|
1414
|
-
}
|
|
1415
|
-
return [...ids];
|
|
1416
|
-
}
|
|
1417
|
-
/** The id of every run, held or stored, without decoding any (orphan-worktree sweeps). */
|
|
1418
|
-
listRunIds() {
|
|
1419
|
-
const ids = new Set(this.db?.listIds() ?? []);
|
|
1420
|
-
for (const id of this.deleted)
|
|
1421
|
-
ids.delete(id);
|
|
1422
|
-
for (const id of this.held.keys())
|
|
1423
|
-
ids.add(id);
|
|
1424
|
-
return [...ids];
|
|
1425
|
-
}
|
|
1426
|
-
/** Runs with a materialized worktree directory (`worktreePath`, not reclaimed), most recently
|
|
1427
|
-
* finished first, then newest first: worktree retention and the worktrees panel. */
|
|
1428
|
-
listRunsWithWorktree() {
|
|
1429
|
-
const runs = this.queryRuns(this.db?.listWithWorktree() ?? [], (run) => run.worktreePath !== undefined && run.worktreeReclaimedAt === undefined);
|
|
1430
|
-
const recency = ([run]) => run.finishedAt ?? run.createdAt;
|
|
1431
|
-
return runs.sort((a, b) => (recency(a) < recency(b) ? 1 : recency(a) > recency(b) ? -1 : newestFirst(a[1], b[1]))).map(([run]) => run);
|
|
1432
|
-
}
|
|
1433
|
-
/**
|
|
1434
|
-
* Every run that owns a branch or names the PR it created, as the few fields branch cleanup and
|
|
1435
|
-
* git-log attribution read (issue 08 §B3, §B5; a squash commit is attributed by its PR number):
|
|
1436
|
-
* the stored summary plus the `branch` and `base_branch` columns, so a Git-tab request decodes
|
|
1437
|
-
* no record. Held runs answer from memory.
|
|
1438
|
-
*/
|
|
1439
|
-
listBranchOwners() {
|
|
1440
|
-
const owners = new Map();
|
|
1441
|
-
for (const row of this.db?.listBranchOwners("branch IS NOT NULL OR json_extract(summary, '$.pullRequestUrl') IS NOT NULL") ?? []) {
|
|
1442
|
-
if (this.deleted.has(row.id) || this.held.has(row.id))
|
|
1443
|
-
continue;
|
|
1444
|
-
const summary = parseStoredSummary(row.summary);
|
|
1445
|
-
owners.set(row.id, {
|
|
1446
|
-
id: row.id, createdAt: row.createdAt, status: row.status, archived: row.archived,
|
|
1447
|
-
...(row.branch === null ? {} : { branch: row.branch }),
|
|
1448
|
-
...(row.baseBranch === null ? {} : { baseBranch: row.baseBranch }),
|
|
1449
|
-
title: summary?.title ?? row.id,
|
|
1450
|
-
...(summary?.pullRequestUrl === undefined ? {} : { pullRequestUrl: summary.pullRequestUrl }),
|
|
1451
|
-
});
|
|
1452
|
-
}
|
|
1453
|
-
for (const run of this.held.values()) {
|
|
1454
|
-
const owner = branchOwnerOf(run);
|
|
1455
|
-
if (owner)
|
|
1456
|
-
owners.set(run.id, owner);
|
|
1457
|
-
}
|
|
1458
|
-
return [...owners.values()];
|
|
1459
|
-
}
|
|
1460
|
-
/** The rows a column query returned, as records, with memory laid over them: a held run
|
|
1461
|
-
* answers from memory (matching `matches` there, not on its maybe-older row). */
|
|
1462
|
-
queryRuns(rows, matches) {
|
|
1463
|
-
const runs = new Map();
|
|
1464
|
-
for (const run of this.held.values())
|
|
1465
|
-
if (matches(run))
|
|
1466
|
-
runs.set(run.id, [run, this.listOrder(run)]);
|
|
1467
|
-
for (const row of rows) {
|
|
1468
|
-
if (runs.has(row.id) || this.held.has(row.id) || this.deleted.has(row.id))
|
|
1469
|
-
continue;
|
|
1470
|
-
const run = this.fromRow(row);
|
|
1471
|
-
if (run && matches(run))
|
|
1472
|
-
runs.set(row.id, [run, row]);
|
|
1473
|
-
}
|
|
1474
|
-
return [...runs.values()];
|
|
1475
|
-
}
|
|
1476
|
-
/** The run an idempotent start already created (#504), archived or not. A deleted run is gone
|
|
1477
|
-
* with its record, so a retry after deletion honestly creates a fresh one. */
|
|
1478
|
-
findRunByClientRequestId(clientRequestId) {
|
|
1479
|
-
for (const run of this.held.values())
|
|
1480
|
-
if (run.clientRequestId === clientRequestId)
|
|
1481
|
-
return run;
|
|
1482
|
-
const row = this.db?.findByClientRequestId(clientRequestId);
|
|
1483
|
-
if (!row || this.held.has(row.id))
|
|
1484
|
-
return undefined;
|
|
1485
|
-
const run = this.getRun(row.id);
|
|
1486
|
-
return run?.clientRequestId === clientRequestId ? run : undefined;
|
|
344
|
+
return this.rows.unreadable.has(id) && !this.held.has(id) && !this.deleted.has(id);
|
|
1487
345
|
}
|
|
1488
346
|
createRun(input) {
|
|
1489
347
|
if (this.openFailure)
|
|
1490
348
|
throw this.openFailure;
|
|
1491
349
|
const run = this.buildRun(input, randomUUID());
|
|
1492
350
|
// A new family, so nobody else can hold it; claimed before anything (an NDJSON event) is written.
|
|
1493
|
-
if (this.db && !this.claimFamilies([run.id]).has(run.id))
|
|
351
|
+
if (this.db && !this.claims.claimFamilies([run.id]).has(run.id))
|
|
1494
352
|
throw new RunWriteRefusedError(run.id, 'foreign');
|
|
1495
353
|
this.held.set(run.id, run);
|
|
1496
|
-
this.pruneOldRuns();
|
|
1497
|
-
this.touch(run);
|
|
354
|
+
this.retention.pruneOldRuns();
|
|
355
|
+
this.persistence.touch(run, undefined);
|
|
1498
356
|
return run;
|
|
1499
357
|
}
|
|
1500
358
|
/** Build without publishing: owned creation must commit its receipt and run together. */
|
|
@@ -1507,7 +365,7 @@ export class RunStore extends EventEmitter {
|
|
|
1507
365
|
// scrubbed: it is the user's own prompt and is replayed into `{{task}}`
|
|
1508
366
|
// when a queued run is revived after a restart (#367), so redacting it
|
|
1509
367
|
// would corrupt the revived run.
|
|
1510
|
-
title: this.redactText(input.title),
|
|
368
|
+
title: this.redaction.redactText(input.title),
|
|
1511
369
|
workflow: input.workflow,
|
|
1512
370
|
task: input.task,
|
|
1513
371
|
model: input.model,
|
|
@@ -1540,33 +398,66 @@ export class RunStore extends EventEmitter {
|
|
|
1540
398
|
// A prompt that pastes a PR or issue URL is already about that item — seed
|
|
1541
399
|
// both referenced tiers so queued runs can expose the reference before the
|
|
1542
400
|
// first agent event (#407, #554).
|
|
1543
|
-
trackReferencedPrs(run, input.task, this.repoHandle);
|
|
1544
|
-
trackReferencedIssues(run, input.task, this.repoHandle);
|
|
401
|
+
trackReferencedPrs(run, input.task, this.repoScope.repoHandle);
|
|
402
|
+
trackReferencedIssues(run, input.task, this.repoScope.repoHandle);
|
|
1545
403
|
return run;
|
|
1546
404
|
}
|
|
1547
405
|
/** Accept the family ledger and its recipient queue in a single durable index replacement. A new
|
|
1548
406
|
* message (`message`, or the delivered input) whose ID is in use writes nothing; `recipientDelegation`
|
|
1549
407
|
* makes a peer recipient with no delegation record a root task in the same write. */
|
|
1550
408
|
commitConversation(rootId, conversation, delivery, message) {
|
|
1551
|
-
const root = this.peek(rootId);
|
|
409
|
+
const root = this.rows.peek(rootId);
|
|
1552
410
|
if (root?.delegation?.role !== 'root')
|
|
1553
411
|
throw new Error('missing conversation root');
|
|
1554
|
-
assertConversationIdFree(root, message ?? delivery?.input, id => this.peek(id), (runId, id) => this.hasProjection(runId, id));
|
|
412
|
+
assertConversationIdFree(root, message ?? delivery?.input, this.conversations, id => this.rows.peek(id), (runId, id) => this.eventLog.hasProjection(runId, id));
|
|
1555
413
|
const staged = new Map();
|
|
1556
|
-
|
|
1557
|
-
this.
|
|
1558
|
-
|
|
414
|
+
const compacted = this.compactLedger(rootId, conversation);
|
|
415
|
+
stageConversation(staged, root, compacted.state, delivery, id => this.rows.peek(id), text => this.redaction.redactText(text));
|
|
416
|
+
this.persistence.commitIndex(staged, undefined, compacted.archive ? { archive: compacted.archive } : {});
|
|
417
|
+
}
|
|
418
|
+
/** Move root `rootId`'s settled ledger entries to the archive now, when any are eligible, so a row
|
|
419
|
+
* full of settled history compacts before a capacity check reads it. A root this store may not
|
|
420
|
+
* write stays as it is. */
|
|
421
|
+
compactConversation(rootId) {
|
|
422
|
+
const root = this.rows.peek(rootId);
|
|
423
|
+
const state = root?.delegation?.role === 'root' ? root.delegation.conversation : undefined;
|
|
424
|
+
if (!root || !state)
|
|
425
|
+
return;
|
|
426
|
+
const compacted = this.compactLedger(rootId, state);
|
|
427
|
+
if (!compacted.archive)
|
|
428
|
+
return;
|
|
429
|
+
const staged = new Map();
|
|
430
|
+
stageConversation(staged, root, compacted.state, undefined, id => this.rows.peek(id), text => this.redaction.redactText(text));
|
|
431
|
+
try {
|
|
432
|
+
this.persistence.commitIndex(staged, undefined, { archive: compacted.archive });
|
|
433
|
+
}
|
|
434
|
+
catch (error) {
|
|
435
|
+
if (!(error instanceof RunWriteRefusedError))
|
|
436
|
+
throw error;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/** The settled entries a ledger commit moves to `conversation_archive` in its own transaction
|
|
440
|
+
* (`compactConversation`, hearsay-tools/squawk#4192), their text scrubbed as the row's is. */
|
|
441
|
+
compactLedger(rootId, state) {
|
|
442
|
+
const archive = this.db?.archive;
|
|
443
|
+
if (!archive)
|
|
444
|
+
return { state };
|
|
445
|
+
const compacted = compactConversation(rootId, state, { now: Date.now(), peek: id => this.rows.peek(id),
|
|
446
|
+
hasProjection: (runId, id) => this.eventLog.hasProjection(runId, id), archivedMessage: (root, id) => archive.find(root, id)?.message,
|
|
447
|
+
routedAskOpen: (workerId, messageId) => this.transcriptFacts.transcriptFacts(workerId).pendingAsk?.routedMessageId === messageId });
|
|
448
|
+
return compacted.archive ? { state: compacted.state, archive: { ...compacted.archive, entries: compacted.archive.entries.map(entry => ({ ...entry, message: { ...entry.message, text: this.redaction.redactText(entry.message.text) } })) } } : compacted;
|
|
449
|
+
}
|
|
1559
450
|
/** Crash recovery (#505): input a harness accepted but was never seen reading goes
|
|
1560
451
|
* back to the queue. Returns the requeued IDs. */
|
|
1561
452
|
requeueAwaitingReadInputs(id) {
|
|
1562
|
-
const ids = (this.peek(id)?.agentInputs ?? []).filter(input => input.awaitingRead && input.deliveredAt && !input.consumedAt).map(input => input.id);
|
|
453
|
+
const ids = (this.rows.peek(id)?.agentInputs ?? []).filter(input => input.awaitingRead && input.deliveredAt && !input.consumedAt).map(input => input.id);
|
|
1563
454
|
if (ids.length)
|
|
1564
455
|
this.commitOutcome(id, { kind: 'requeued', inputIds: ids });
|
|
1565
456
|
return ids;
|
|
1566
457
|
}
|
|
1567
458
|
/** Delivered, but the harness never confirmed reading it (#505): stop awaiting a read. */
|
|
1568
459
|
commitAgentInputsUnconfirmed(id, ids) {
|
|
1569
|
-
const run = this.peek(id);
|
|
460
|
+
const run = this.rows.peek(id);
|
|
1570
461
|
if (!run?.agentInputs || !ids.length)
|
|
1571
462
|
return;
|
|
1572
463
|
this.commitAgentInputs(id, run.agentInputs.map(input => {
|
|
@@ -1579,7 +470,7 @@ export class RunStore extends EventEmitter {
|
|
|
1579
470
|
/** Observable atomic input checkpoint for the queue itself: enqueue, retire, reorder. Delivery
|
|
1580
471
|
* and reads are outcomes (`commitOutcome`). */
|
|
1581
472
|
commitAgentInputs(id, inputs) {
|
|
1582
|
-
const run = this.peek(id);
|
|
473
|
+
const run = this.rows.peek(id);
|
|
1583
474
|
if (!run)
|
|
1584
475
|
throw new Error('missing agent input target');
|
|
1585
476
|
const agentInputs = inputs.map(input => agentInputSchema.parse(input));
|
|
@@ -1598,11 +489,11 @@ export class RunStore extends EventEmitter {
|
|
|
1598
489
|
throw new Error('live inbox receipt changed');
|
|
1599
490
|
}
|
|
1600
491
|
}
|
|
1601
|
-
this.commitIndex(new Map([[id, { ...run, agentInputs }]]));
|
|
492
|
+
this.persistence.commitIndex(new Map([[id, { ...run, agentInputs }]]));
|
|
1602
493
|
}
|
|
1603
494
|
/** Reserve only unread conversation inputs in one durable index replacement. */
|
|
1604
495
|
claimInboxInputs(runId, ids, claim) {
|
|
1605
|
-
const run = this.peek(runId);
|
|
496
|
+
const run = this.rows.peek(runId);
|
|
1606
497
|
if (!run)
|
|
1607
498
|
throw new Error('missing inbox recipient');
|
|
1608
499
|
const selected = z.array(z.uuid()).min(1).max(32).refine(values => new Set(values).size === values.length).parse(ids);
|
|
@@ -1620,12 +511,12 @@ export class RunStore extends EventEmitter {
|
|
|
1620
511
|
}
|
|
1621
512
|
}
|
|
1622
513
|
const selectedIds = new Set(selected);
|
|
1623
|
-
this.commitIndex(new Map([[runId, { ...run, agentInputs: inputs.map(input => selectedIds.has(input.id)
|
|
514
|
+
this.persistence.commitIndex(new Map([[runId, { ...run, agentInputs: inputs.map(input => selectedIds.has(input.id)
|
|
1624
515
|
? agentInputSchema.parse({ ...input, inboxClaim: receipt }) : input) }]]));
|
|
1625
516
|
}
|
|
1626
517
|
/** A receipt owns every matching input or none; exact ACK retries preserve the first timestamp. */
|
|
1627
518
|
ackInboxInputs(runId, receiptId, generation, at) {
|
|
1628
|
-
const run = this.peek(runId);
|
|
519
|
+
const run = this.rows.peek(runId);
|
|
1629
520
|
if (!run)
|
|
1630
521
|
throw new Error('missing inbox recipient');
|
|
1631
522
|
inboxClaimSchema.shape.receiptId.parse(receiptId);
|
|
@@ -1650,7 +541,7 @@ export class RunStore extends EventEmitter {
|
|
|
1650
541
|
return 'acknowledged';
|
|
1651
542
|
}
|
|
1652
543
|
releaseInboxInputs(runId, receiptId, generation) {
|
|
1653
|
-
const run = this.peek(runId);
|
|
544
|
+
const run = this.rows.peek(runId);
|
|
1654
545
|
if (!run)
|
|
1655
546
|
throw new Error('missing inbox recipient');
|
|
1656
547
|
inboxClaimSchema.shape.receiptId.parse(receiptId);
|
|
@@ -1659,7 +550,7 @@ export class RunStore extends EventEmitter {
|
|
|
1659
550
|
if (!matching.length || matching.some(input => input.inboxClaim?.generation !== generation ||
|
|
1660
551
|
input.inboxClaim?.acknowledgedAt || input.deliveredAt))
|
|
1661
552
|
throw new Error('inbox receipt changed');
|
|
1662
|
-
this.commitIndex(new Map([[runId, { ...run, agentInputs: run.agentInputs.map(input => {
|
|
553
|
+
this.persistence.commitIndex(new Map([[runId, { ...run, agentInputs: run.agentInputs.map(input => {
|
|
1663
554
|
if (input.inboxClaim?.receiptId !== receiptId)
|
|
1664
555
|
return input;
|
|
1665
556
|
const { inboxClaim: _claim, ...unclaimed } = input;
|
|
@@ -1668,13 +559,13 @@ export class RunStore extends EventEmitter {
|
|
|
1668
559
|
return 'released';
|
|
1669
560
|
}
|
|
1670
561
|
clearExpiredInboxClaims(runId, now) {
|
|
1671
|
-
const run = this.peek(runId);
|
|
562
|
+
const run = this.rows.peek(runId);
|
|
1672
563
|
if (!run)
|
|
1673
564
|
throw new Error('missing inbox recipient');
|
|
1674
565
|
inboxClaimSchema.shape.expiresAt.parse(now);
|
|
1675
566
|
if (!run.agentInputs?.some(input => input.inboxClaim && !input.inboxClaim.acknowledgedAt && input.inboxClaim.expiresAt <= now))
|
|
1676
567
|
return;
|
|
1677
|
-
this.commitIndex(new Map([[runId, { ...run, agentInputs: run.agentInputs.map(input => {
|
|
568
|
+
this.persistence.commitIndex(new Map([[runId, { ...run, agentInputs: run.agentInputs.map(input => {
|
|
1678
569
|
if (!input.inboxClaim || input.inboxClaim.acknowledgedAt || input.inboxClaim.expiresAt > now)
|
|
1679
570
|
return input;
|
|
1680
571
|
const { inboxClaim: _claim, ...unclaimed } = input;
|
|
@@ -1689,40 +580,40 @@ export class RunStore extends EventEmitter {
|
|
|
1689
580
|
* past `WAIT_LIMIT` open ones is refused, so the list stays bounded whatever the caller checked.
|
|
1690
581
|
*/
|
|
1691
582
|
commitWait(id, wait, input, registration) {
|
|
1692
|
-
const run = this.peek(id);
|
|
583
|
+
const run = this.rows.peek(id);
|
|
1693
584
|
if (!run)
|
|
1694
585
|
throw new Error('missing wait target');
|
|
1695
|
-
this.commitIndex(new Map([[id, registeredWaitRecord(run, wait, input, registration)]]));
|
|
586
|
+
this.persistence.commitIndex(new Map([[id, registeredWaitRecord(run, wait, input, registration)]]));
|
|
1696
587
|
}
|
|
1697
588
|
/** Record a deduplicated registration without mutating its wait. */
|
|
1698
589
|
commitWaitRegistration(id, receipt) {
|
|
1699
|
-
const run = this.peek(id);
|
|
590
|
+
const run = this.rows.peek(id);
|
|
1700
591
|
if (!run)
|
|
1701
592
|
throw new Error('missing wait target');
|
|
1702
|
-
this.commitIndex(new Map([[id, registeredReceiptRecord(run, receipt)]]));
|
|
593
|
+
this.persistence.commitIndex(new Map([[id, registeredReceiptRecord(run, receipt)]]));
|
|
1703
594
|
}
|
|
1704
595
|
/** A usage-limit appointment withdrawn, committed at once instead of on the debounced save
|
|
1705
596
|
* (hearsay-tools/cezarion#1236): a crash right after the withdrawal must not find it on disk,
|
|
1706
597
|
* or recovery re-arms work the user cancelled. A run held for its resume settles `failed` by
|
|
1707
598
|
* the `withdraw-hold` exit; any other run only loses its resume fields. */
|
|
1708
599
|
commitAutoResumeWithdrawal(id) {
|
|
1709
|
-
const run = this.peek(id);
|
|
600
|
+
const run = this.rows.peek(id);
|
|
1710
601
|
if (!run || (run.autoResumeAt === undefined && run.autoResumeAttempts === undefined))
|
|
1711
602
|
return;
|
|
1712
603
|
if (isUsageLimitHold(run))
|
|
1713
604
|
this.move(id, 'withdraw-hold');
|
|
1714
605
|
else
|
|
1715
|
-
this.commitIndex(new Map([[id, { ...run, autoResumeAt: undefined, autoResumeAttempts: undefined }]]));
|
|
606
|
+
this.persistence.commitIndex(new Map([[id, { ...run, autoResumeAt: undefined, autoResumeAttempts: undefined, autoResumeReason: undefined }]]));
|
|
1716
607
|
}
|
|
1717
608
|
/** A human message beside a run's waits (hearsay-tools/cezarion#1235): accepted durably, and
|
|
1718
609
|
* every wait stays. A lifecycle opening becomes
|
|
1719
610
|
* the human's and keeps its wake text, so the message opens the continuation (and answers a
|
|
1720
611
|
* pending question) and the owed results still reach the agent. */
|
|
1721
612
|
commitHumanMessageBesideWaits(id, acceptedHumanMessage) {
|
|
1722
|
-
const run = this.peek(id);
|
|
613
|
+
const run = this.rows.peek(id);
|
|
1723
614
|
if (!run)
|
|
1724
615
|
throw new Error('missing queued message target');
|
|
1725
|
-
this.commitIndex(new Map([[id, { ...run, queuedMessages: [...(run.queuedMessages ?? []), queuedMessageSchema.parse(acceptedHumanMessage)],
|
|
616
|
+
this.persistence.commitIndex(new Map([[id, { ...run, queuedMessages: [...(run.queuedMessages ?? []), queuedMessageSchema.parse(acceptedHumanMessage)],
|
|
1726
617
|
...(run.continuationMessage ? { continuationMessage: { ...run.continuationMessage, origin: 'human' } } : {}),
|
|
1727
618
|
}]]));
|
|
1728
619
|
}
|
|
@@ -1737,34 +628,32 @@ export class RunStore extends EventEmitter {
|
|
|
1737
628
|
* A conversation request outcome is the other sanctioned write: `commitConversation`.
|
|
1738
629
|
*/
|
|
1739
630
|
commitOutcome(id, outcomes, deps = {}, opts = {}) {
|
|
1740
|
-
const run = this.peek(id);
|
|
631
|
+
const run = this.rows.peek(id);
|
|
1741
632
|
if (!run)
|
|
1742
633
|
return { committed: false, answered: [], settled: [] };
|
|
1743
634
|
const staged = applyOutcomes(run, Array.isArray(outcomes) ? outcomes : [outcomes], deps);
|
|
1744
635
|
if (!staged.changed)
|
|
1745
636
|
return { committed: false, answered: [], settled: [] };
|
|
1746
637
|
try {
|
|
1747
|
-
this.commitIndex(new Map([[id, staged.next]]));
|
|
638
|
+
this.persistence.commitIndex(new Map([[id, staged.next]]), undefined, { exits: new Map([[id, staged.exit]]) });
|
|
1748
639
|
}
|
|
1749
640
|
catch (error) {
|
|
1750
641
|
if (!opts.bestEffort)
|
|
1751
642
|
throw error;
|
|
1752
|
-
console.warn(
|
|
1753
|
-
const live = this.record(id);
|
|
643
|
+
console.warn(`[hsq] outcome checkpoint failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
644
|
+
const live = this.rows.record(id);
|
|
1754
645
|
if (!live)
|
|
1755
646
|
return { committed: false, answered: staged.answered, settled: staged.settled };
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
Object.assign(live, staged.next);
|
|
1760
|
-
this.touch(live);
|
|
647
|
+
const before = snapshotRun(live);
|
|
648
|
+
replaceRecord(live, staged.next);
|
|
649
|
+
this.persistence.touch(live, before, staged.exit);
|
|
1761
650
|
return { committed: false, answered: staged.answered, settled: staged.settled };
|
|
1762
651
|
}
|
|
1763
652
|
return { committed: true, answered: staged.answered, settled: staged.settled };
|
|
1764
653
|
}
|
|
1765
654
|
/** An acknowledged inactive-root Finish must survive the async diff and restart. */
|
|
1766
655
|
commitRootFinishIntent(id) {
|
|
1767
|
-
const run = this.peek(id);
|
|
656
|
+
const run = this.rows.peek(id);
|
|
1768
657
|
if (run?.status !== 'waiting' || run.delegation?.role !== 'root')
|
|
1769
658
|
throw new Error('root is not waiting');
|
|
1770
659
|
if (run.delegation.finishRequestedAt)
|
|
@@ -1778,7 +667,7 @@ export class RunStore extends EventEmitter {
|
|
|
1778
667
|
const staged = new Map();
|
|
1779
668
|
let destroyProgress = true;
|
|
1780
669
|
for (const patch of patches) {
|
|
1781
|
-
const run = this.peek(patch.id);
|
|
670
|
+
const run = this.rows.peek(patch.id);
|
|
1782
671
|
if (!run || staged.has(patch.id))
|
|
1783
672
|
throw new Error('missing or duplicate delegation patch target');
|
|
1784
673
|
const delegation = delegationStateSchema.parse(patch.delegation);
|
|
@@ -1788,28 +677,28 @@ export class RunStore extends EventEmitter {
|
|
|
1788
677
|
}
|
|
1789
678
|
// In-process cause only: consumers can skip metadata replay when delegation
|
|
1790
679
|
// is disabled without dropping real status or termination-proof notifications.
|
|
1791
|
-
this.commitIndex(staged, destroyProgress ? 'delegation-destroy-progress' : 'delegation-checkpoint');
|
|
680
|
+
this.persistence.commitIndex(staged, destroyProgress ? 'delegation-destroy-progress' : 'delegation-checkpoint');
|
|
1792
681
|
}
|
|
1793
682
|
/** A pending destroy's automatic retry state, or its removal (hearsay-tools/cezarion#879). Kept on
|
|
1794
|
-
* the record beside the strict delegation, so an older
|
|
683
|
+
* the record beside the strict delegation, so an older Squawk strips it rather than quarantining the
|
|
1795
684
|
* worker. Destroy progress: nothing the family reconcile reads changes. */
|
|
1796
685
|
commitDestroyRetry(id, retry) {
|
|
1797
|
-
const run = this.peek(id);
|
|
686
|
+
const run = this.rows.peek(id);
|
|
1798
687
|
if (run?.delegation?.role !== 'worker' || !run.delegation.destroy)
|
|
1799
688
|
throw new Error('missing pending destroy');
|
|
1800
689
|
if (!retry && !run.destroyRetry)
|
|
1801
690
|
return;
|
|
1802
691
|
// An explicit `undefined`, not an omitted key: commitIndex assigns onto the live record.
|
|
1803
|
-
this.commitIndex(new Map([[id, { ...run, destroyRetry: retry ? workerDestroyRetrySchema.parse(retry) : undefined }]]), 'delegation-destroy-progress');
|
|
692
|
+
this.persistence.commitIndex(new Map([[id, { ...run, destroyRetry: retry ? workerDestroyRetrySchema.parse(retry) : undefined }]]), 'delegation-destroy-progress');
|
|
1804
693
|
}
|
|
1805
694
|
/** Accepted execution revision is public lifecycle identity, separate from process generations. */
|
|
1806
695
|
commitWorkerContinuation(id, exit, patch = {}, step, conversation) {
|
|
1807
|
-
const run = this.peek(id);
|
|
696
|
+
const run = this.rows.peek(id);
|
|
1808
697
|
if (run?.delegation?.role !== 'worker')
|
|
1809
698
|
throw new Error('missing worker continuation target');
|
|
1810
699
|
const delegation = delegationStateSchema.parse({ ...run.delegation,
|
|
1811
700
|
executionRevision: (run.delegation.executionRevision ?? 0) + 1,
|
|
1812
|
-
executionStartSeq: this.transcriptFacts(id).lastSeq,
|
|
701
|
+
executionStartSeq: this.transcriptFacts.transcriptFacts(id).lastSeq,
|
|
1813
702
|
});
|
|
1814
703
|
const staged = new Map();
|
|
1815
704
|
this.exitEvents.started(id);
|
|
@@ -1818,243 +707,28 @@ export class RunStore extends EventEmitter {
|
|
|
1818
707
|
};
|
|
1819
708
|
staged.set(id, next);
|
|
1820
709
|
if (Object.prototype.hasOwnProperty.call(patch, 'archived'))
|
|
1821
|
-
this.syncTranscriptForm(id, next.archived);
|
|
710
|
+
this.archive.syncTranscriptForm(id, next.archived);
|
|
711
|
+
let compacted;
|
|
1822
712
|
if (conversation) {
|
|
1823
|
-
const root = this.peek(conversation.rootId);
|
|
713
|
+
const root = this.rows.peek(conversation.rootId);
|
|
1824
714
|
if (root?.delegation?.role !== 'root' || run.delegation.parentRunId !== root.id)
|
|
1825
715
|
throw new Error('missing conversation ownership');
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
this.commitIndex(staged);
|
|
1829
|
-
}
|
|
1830
|
-
workerResultsDir(parentId, write = false) { return workerResultsDirectory(write ? this.writeDir(parentId) : this.sourceDataDir(parentId), parentId, write); }
|
|
1831
|
-
workerResultSnapshotPath(parentId, workerId, snapshotId) {
|
|
1832
|
-
return join(this.dataDir, 'runs', `${z.uuid().parse(parentId)}-worker-results`, `${z.uuid().parse(workerId)}.${z.uuid().parse(snapshotId)}.json`);
|
|
1833
|
-
}
|
|
1834
|
-
readWorkerResultFile(parentId, workerId) {
|
|
1835
|
-
const parent = this.peek(parentId);
|
|
1836
|
-
if (parent?.delegation?.role !== 'root' || !parent.delegation.receipts.some(receipt => receipt.workerId === workerId))
|
|
1837
|
-
return undefined;
|
|
1838
|
-
const reference = parent.delegation.results?.find(result => result.workerId === workerId);
|
|
1839
|
-
if (!reference)
|
|
1840
|
-
return undefined;
|
|
1841
|
-
try {
|
|
1842
|
-
const path = join(this.workerResultsDir(parentId), `${z.uuid().parse(workerId)}.${z.uuid().parse(reference.snapshotId)}.json`);
|
|
1843
|
-
const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
1844
|
-
let raw;
|
|
1845
|
-
try {
|
|
1846
|
-
const info = fstatSync(fd);
|
|
1847
|
-
if (!info.isFile() || info.size > 3_145_728)
|
|
1848
|
-
return undefined;
|
|
1849
|
-
raw = readFileSync(fd, 'utf8');
|
|
1850
|
-
}
|
|
1851
|
-
finally {
|
|
1852
|
-
closeSync(fd);
|
|
1853
|
-
}
|
|
1854
|
-
const file = workerResultFileSchema.parse(JSON.parse(raw));
|
|
1855
|
-
if (!bindWorkerResultPath(file.result.diff, this.dataDir, this.hasFallbackRun(parentId), parentId, path))
|
|
1856
|
-
return undefined;
|
|
1857
|
-
if (file.result.parentRunId !== parentId || file.result.workerId !== workerId || file.result.workspace.ownerRunId !== workerId || file.result.revision !== reference.revision || file.result.observedAt !== reference.observedAt ||
|
|
1858
|
-
(file.result.diff.state === 'available' && (file.result.diff.snapshotId !== reference.snapshotId || file.diffSnapshot === undefined)))
|
|
1859
|
-
return undefined;
|
|
1860
|
-
return file;
|
|
716
|
+
compacted = this.compactLedger(root.id, conversation.state);
|
|
717
|
+
stageConversation(staged, root, compacted.state, { recipientRunId: id, input: conversation.input }, runId => this.rows.peek(runId), text => this.redaction.redactText(text));
|
|
1861
718
|
}
|
|
1862
|
-
|
|
1863
|
-
return undefined;
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
readWorkerResult(parentId, workerId) {
|
|
1867
|
-
return this.readWorkerResultFile(parentId, workerId)?.result;
|
|
1868
|
-
}
|
|
1869
|
-
readWorkerResultDiff(parentId, workerId) {
|
|
1870
|
-
return this.readWorkerResultFile(parentId, workerId)?.diffSnapshot;
|
|
1871
|
-
}
|
|
1872
|
-
/** Publish a pointer only after its redacted immutable snapshot reaches disk. */
|
|
1873
|
-
commitWorkerResult(parentId, value, diffSnapshot, opts = {}) {
|
|
1874
|
-
return commitStoreWorkerResult({
|
|
1875
|
-
redactResult: (result) => this.redact({ type: 'worker-result', seq: 0, ts: result.observedAt, result }).result,
|
|
1876
|
-
peek: (id) => this.peek(id),
|
|
1877
|
-
readWorkerResultFile: (id, workerId) => this.readWorkerResultFile(id, workerId),
|
|
1878
|
-
readWorkerResult: (id, workerId) => this.readWorkerResult(id, workerId),
|
|
1879
|
-
redactText: (text) => this.redactText(text),
|
|
1880
|
-
workerResultSnapshotPath: (id, workerId, snapshotId) => this.workerResultSnapshotPath(id, workerId, snapshotId),
|
|
1881
|
-
workerResultsDir: (id) => this.workerResultsDir(id, true),
|
|
1882
|
-
commitDelegation: (patches) => this.commitDelegation(patches),
|
|
1883
|
-
}, parentId, value, diffSnapshot, opts);
|
|
719
|
+
this.persistence.commitIndex(staged, undefined, { exits: new Map([[id, exit]]), ...(compacted?.archive ? { archive: compacted.archive } : {}) });
|
|
1884
720
|
}
|
|
1885
721
|
/** Create an owned worker run and its parent receipt; `createStoreOwnedRun` holds the checks. */
|
|
1886
|
-
createOwnedRun(input, parentId, requestId, worker, requestHash, executionIdentity = { kind: 'internal' }) {
|
|
722
|
+
createOwnedRun(input, parentId, requestId, worker, requestHash, spawnCapacityRefusal, executionIdentity = { kind: 'internal' }) {
|
|
1887
723
|
return createStoreOwnedRun({
|
|
1888
|
-
peek: (id) => this.peek(id),
|
|
1889
|
-
hasRun: (id) => this.hasRun(id),
|
|
724
|
+
peek: (id) => this.rows.peek(id),
|
|
725
|
+
hasRun: (id) => this.rows.hasRun(id),
|
|
1890
726
|
held: this.held, deleted: this.deleted, db: this.db,
|
|
1891
727
|
buildRun: (ownedInput, id) => this.buildRun(ownedInput, id),
|
|
1892
|
-
writeWorkerIdentity: (id, identity) => this.writeWorkerIdentity(id, identity),
|
|
1893
|
-
writeWorkerExecution: (id, proof, fresh) => this.writeWorkerExecution(id, proof, fresh),
|
|
1894
|
-
commitIndex: (owned) => this.commitIndex(owned),
|
|
1895
|
-
}, input, parentId, requestId, worker, requestHash, executionIdentity);
|
|
1896
|
-
}
|
|
1897
|
-
/**
|
|
1898
|
-
* Durably replace or delete staged rows together with pending dirty rows. Persist before
|
|
1899
|
-
* changing held objects or notifying subscribers. On failure retain all pending state; flush()
|
|
1900
|
-
* remains best-effort.
|
|
1901
|
-
*/
|
|
1902
|
-
commitIndex(input, source) {
|
|
1903
|
-
const staged = stageCommit(input, {
|
|
1904
|
-
peek: id => this.peek(id),
|
|
1905
|
-
completionArchiveBlocker: run => this.completionArchiveBlocker(run),
|
|
1906
|
-
stageArchive: (staged, run, archived) => this.stageArchive(staged, run, archived),
|
|
1907
|
-
});
|
|
1908
|
-
if (!this.db)
|
|
1909
|
-
throw this.openFailure ?? new Error('runs database unavailable: nothing can be saved');
|
|
1910
|
-
this.assertWritable(staged);
|
|
1911
|
-
this.persist(staged);
|
|
1912
|
-
// Preserve existing record references, but expose the entire transaction before its first event.
|
|
1913
|
-
// A finished run joins the held set for the commit and leaves at the next sweep.
|
|
1914
|
-
for (const [id, next] of staged) {
|
|
1915
|
-
this.coldReads.forget(id);
|
|
1916
|
-
if (!next) {
|
|
1917
|
-
this.held.delete(id);
|
|
1918
|
-
continue;
|
|
1919
|
-
}
|
|
1920
|
-
this.committing.add(id);
|
|
1921
|
-
const current = this.held.get(id);
|
|
1922
|
-
if (current) {
|
|
1923
|
-
for (const key of Object.keys(current)) {
|
|
1924
|
-
if (!(key in next))
|
|
1925
|
-
delete current[key];
|
|
1926
|
-
}
|
|
1927
|
-
Object.assign(current, next);
|
|
1928
|
-
}
|
|
1929
|
-
else
|
|
1930
|
-
this.held.set(id, next);
|
|
1931
|
-
}
|
|
1932
|
-
try {
|
|
1933
|
-
for (const id of staged.keys()) {
|
|
1934
|
-
const run = this.held.get(id);
|
|
1935
|
-
if (run)
|
|
1936
|
-
this.emit('run', run, source);
|
|
1937
|
-
else
|
|
1938
|
-
this.emit('deleted', id);
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
finally {
|
|
1942
|
-
for (const id of staged.keys())
|
|
1943
|
-
this.committing.delete(id);
|
|
1944
|
-
this.sweepIfSettled(staged.keys());
|
|
1945
|
-
}
|
|
1946
|
-
for (const [id, next] of staged)
|
|
1947
|
-
if (next?.archived)
|
|
1948
|
-
this.compressor.enqueue(id);
|
|
1949
|
-
}
|
|
1950
|
-
completionArchiveBlocker(root) {
|
|
1951
|
-
const family = [root, ...this.listWorkersOf(root.id)];
|
|
1952
|
-
for (const run of family) {
|
|
1953
|
-
const facts = this.factsFor(run.id).peek(run.id);
|
|
1954
|
-
if (!facts || !['done', 'review', 'failed', 'cancelled'].includes(run.status) || run.waits?.some(wait => wait.phase === 'open') ||
|
|
1955
|
-
run.hasPendingPermission || facts.pendingAsk !== undefined)
|
|
1956
|
-
return 'Task or worker work still needs attention. Open the task or archive manually.';
|
|
1957
|
-
if (run.delegation?.role === 'invalid' || (run.delegation?.role === 'worker' && this.readWorkerExecution(run.id)?.phase !== 'complete'))
|
|
1958
|
-
return 'Worker execution has not settled. Open the worker or archive manually.';
|
|
1959
|
-
}
|
|
1960
|
-
return undefined;
|
|
1961
|
-
}
|
|
1962
|
-
/** One archive write for manual actions, merge observations, completion, and sweeps.
|
|
1963
|
-
* Archiving files history away; it never stops a process or removes a worktree. */
|
|
1964
|
-
stageArchive(staged, root, archived) {
|
|
1965
|
-
const ids = root.delegation?.role === 'worker' ? [root.id] :
|
|
1966
|
-
[root.id, ...new Set([...(this.db?.listIdsByParent(root.id) ?? []), ...this.listWorkersOf(root.id).map(run => run.id)])];
|
|
1967
|
-
const now = new Date().toISOString();
|
|
1968
|
-
for (const id of ids) {
|
|
1969
|
-
const member = staged.get(id) ?? this.peek(id);
|
|
1970
|
-
if (!member)
|
|
1971
|
-
continue;
|
|
1972
|
-
if (!archived) {
|
|
1973
|
-
this.compressor.cancel(id);
|
|
1974
|
-
restoreHistory(this.dataDir, id);
|
|
1975
|
-
}
|
|
1976
|
-
const next = { ...member, archiveBlocker: undefined };
|
|
1977
|
-
archiveFields(next, archived, now);
|
|
1978
|
-
staged.set(id, next);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
/** A bounded persisted queue also covers projects without a live RunManager. */
|
|
1982
|
-
listCompletionCandidates(afterSeq = 0, limit = 32) {
|
|
1983
|
-
return this.db?.listCompletionCandidates(afterSeq, limit) ?? [];
|
|
1984
|
-
}
|
|
1985
|
-
canCompleteAction(id, token) {
|
|
1986
|
-
const run = this.record(id);
|
|
1987
|
-
return Boolean(run && run.status === 'done' && !run.archived && (run.autoMergePr || run.archiveWhenDone) &&
|
|
1988
|
-
run.completionAction?.id === token && run.completionAction.phase !== 'complete' && !this.writeRefusal(id));
|
|
1989
|
-
}
|
|
1990
|
-
claimCompletionAction(id, token) {
|
|
1991
|
-
if (!this.canCompleteAction(id, token))
|
|
1992
|
-
return false;
|
|
1993
|
-
const run = this.record(id);
|
|
1994
|
-
this.assertWritable(new Map([[id, run]]));
|
|
1995
|
-
// A normal write may defer its claim until the transaction. A remote mutation
|
|
1996
|
-
// needs the committed claim now, and must not act on a stale row read before it.
|
|
1997
|
-
const claim = this.db?.getClaim(familyKey(run));
|
|
1998
|
-
return Boolean(claim && claim.session === this.owner?.session &&
|
|
1999
|
-
claim.generation === this.claimed.get(familyKey(run)) &&
|
|
2000
|
-
this.db?.get(id)?.revision === this.base.get(id)?.revision);
|
|
2001
|
-
}
|
|
2002
|
-
completeAction(id, token, phase, message) {
|
|
2003
|
-
const run = this.record(id);
|
|
2004
|
-
if (!run || !this.canCompleteAction(id, token))
|
|
2005
|
-
return false;
|
|
2006
|
-
if (run.completionAction?.phase === phase && run.completionAction.message === message)
|
|
2007
|
-
return true;
|
|
2008
|
-
const next = { ...run, completionAction: { id: token, phase, ...(message ? { message } : {}) } };
|
|
2009
|
-
const staged = new Map([[id, next]]);
|
|
2010
|
-
if (phase === 'complete' && next.archiveWhenDone) {
|
|
2011
|
-
const blocker = this.completionArchiveBlocker(next);
|
|
2012
|
-
if (blocker)
|
|
2013
|
-
next.completionAction = { id: token, phase: 'blocked', message: blocker };
|
|
2014
|
-
else
|
|
2015
|
-
this.stageArchive(staged, next, true);
|
|
2016
|
-
}
|
|
2017
|
-
this.commitIndex(staged);
|
|
2018
|
-
return true;
|
|
2019
|
-
}
|
|
2020
|
-
/**
|
|
2021
|
-
* Refuse (throwing, with nothing changed) a commit that stages a quarantined run, or a run whose
|
|
2022
|
-
* family this store does not claim and cannot take: another process owns it, or a dead process
|
|
2023
|
-
* left it live and it has not been adopted.
|
|
2024
|
-
*/
|
|
2025
|
-
assertWritable(staged) {
|
|
2026
|
-
const families = new Map();
|
|
2027
|
-
const held = new Set();
|
|
2028
|
-
for (const [id, next] of staged) {
|
|
2029
|
-
if (this.quarantined.has(id))
|
|
2030
|
-
throw new RunWriteRefusedError(id, 'quarantined');
|
|
2031
|
-
const family = next ? familyKey(next) : this.familyOf(id);
|
|
2032
|
-
families.set(id, family);
|
|
2033
|
-
if (this.held.has(id))
|
|
2034
|
-
held.add(family);
|
|
2035
|
-
}
|
|
2036
|
-
// A run this store holds may move to a new family; any other row is claimed as a plain write.
|
|
2037
|
-
const owned = new Set([...this.claimFamilies(held, { allowLive: true }),
|
|
2038
|
-
...this.claimFamilies([...families.values()].filter((family) => !held.has(family)))]);
|
|
2039
|
-
for (const [id, family] of families) {
|
|
2040
|
-
if (!owned.has(family))
|
|
2041
|
-
throw this.runOwnership(id) === 'fallback' ? this.fallbackRefusal(id) : new RunWriteRefusedError(id, this.runOwnership(id) === 'orphaned' ? 'orphaned' : 'foreign');
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
/** The family of a run this store knows: held, else its row; a run nowhere is its own. */
|
|
2045
|
-
familyOf(id) {
|
|
2046
|
-
const held = this.held.get(id);
|
|
2047
|
-
return held ? familyKey(held) : this.deletedFamilies.get(id) ?? this.db?.familyOf(id) ?? id;
|
|
2048
|
-
}
|
|
2049
|
-
/** Schedule the sweep that lets any of `ids` leave memory, when one of them now can. */
|
|
2050
|
-
sweepIfSettled(ids) {
|
|
2051
|
-
for (const id of ids) {
|
|
2052
|
-
const run = this.held.get(id);
|
|
2053
|
-
if (run && !this.isAnchor(id, run)) {
|
|
2054
|
-
this.scheduleSave();
|
|
2055
|
-
return;
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
728
|
+
writeWorkerIdentity: (id, identity) => this.workerExecutions.writeWorkerIdentity(id, identity),
|
|
729
|
+
writeWorkerExecution: (id, proof, fresh) => this.workerExecutions.writeWorkerExecution(id, proof, fresh),
|
|
730
|
+
commitIndex: (owned) => this.persistence.commitIndex(owned),
|
|
731
|
+
}, input, parentId, requestId, worker, requestHash, spawnCapacityRefusal, executionIdentity);
|
|
2058
732
|
}
|
|
2059
733
|
/** Move run `id` by `exit` (ADR 0056): its status and `extras` in one write, checked against the
|
|
2060
734
|
* record that write changes. A run this store cannot write is neither checked nor written. The
|
|
@@ -2065,7 +739,7 @@ export class RunStore extends EventEmitter {
|
|
|
2065
739
|
move(id, exit, extras = {}, call = {}) {
|
|
2066
740
|
const spec = RUN_EXITS[exit];
|
|
2067
741
|
const guarded = Boolean(spec.guard || spec.settle);
|
|
2068
|
-
const run = guarded ? this.peek(id) : this.record(id);
|
|
742
|
+
const run = guarded ? this.rows.peek(id) : this.rows.record(id);
|
|
2069
743
|
if (!run || spec.guard?.(run) === false) {
|
|
2070
744
|
if (spec.refused)
|
|
2071
745
|
throw new Error(spec.refused);
|
|
@@ -2076,11 +750,11 @@ export class RunStore extends EventEmitter {
|
|
|
2076
750
|
const redacted = this.redactPatch(extras);
|
|
2077
751
|
let moved;
|
|
2078
752
|
if (!guarded)
|
|
2079
|
-
moved = this.writeRun(id, run, applyExit(run, exit, redacted, call), exitDurability(exit, run));
|
|
753
|
+
moved = this.writeRun(id, run, applyExit(run, exit, redacted, call), exitDurability(exit, run), exit);
|
|
2080
754
|
else {
|
|
2081
755
|
const input = { ...run, ...redacted };
|
|
2082
|
-
this.commitIndex(new Map([[id, { ...(spec.settle?.(input, { ...call, now: new Date().toISOString() }) ?? input), ...applyExit(run, exit, {}, call) }]]));
|
|
2083
|
-
moved = this.peek(id);
|
|
756
|
+
this.persistence.commitIndex(new Map([[id, { ...(spec.settle?.(input, { ...call, now: new Date().toISOString() }) ?? input), ...applyExit(run, exit, {}, call) }]]), undefined, { exits: new Map([[id, exit]]) });
|
|
757
|
+
moved = this.rows.peek(id);
|
|
2084
758
|
}
|
|
2085
759
|
if (event)
|
|
2086
760
|
this.exitEvents.write(id, event);
|
|
@@ -2090,7 +764,7 @@ export class RunStore extends EventEmitter {
|
|
|
2090
764
|
* completion option or task access, else the next save writes it. A status in the patch, which only test
|
|
2091
765
|
* fixtures still write, takes the exit's record rule (`doneCommits`). */
|
|
2092
766
|
updateRun(id, patch) {
|
|
2093
|
-
const run = this.record(id);
|
|
767
|
+
const run = this.rows.record(id);
|
|
2094
768
|
if (!run)
|
|
2095
769
|
return undefined;
|
|
2096
770
|
const committed = (patch.status === 'done' && doneCommits(run)) || patch.handoffRecords !== undefined ||
|
|
@@ -2099,1379 +773,57 @@ export class RunStore extends EventEmitter {
|
|
|
2099
773
|
}
|
|
2100
774
|
/** One update of the held record `run`: committed at once, or written to the record for the next
|
|
2101
775
|
* save. A debounced write is best-effort, so a locked database cannot stop cleanup. */
|
|
2102
|
-
writeRun(id, run, patch, durability) {
|
|
776
|
+
writeRun(id, run, patch, durability, exit) {
|
|
777
|
+
const before = snapshotRun(run);
|
|
2103
778
|
const hooks = {
|
|
2104
|
-
redact: (text) => this.redactText(text),
|
|
2105
|
-
repoHandle: this.repoHandle,
|
|
779
|
+
redact: (text) => this.redaction.redactText(text),
|
|
780
|
+
repoHandle: this.repoScope.repoHandle,
|
|
2106
781
|
restore: () => restoreHistory(this.dataDir, id),
|
|
2107
|
-
archive: (record, archived) => this.applyArchived(record, archived),
|
|
2108
|
-
touch: (record) => this.touch(record),
|
|
782
|
+
archive: (record, archived) => this.archive.applyArchived(record, archived, before, exit),
|
|
783
|
+
touch: (record) => this.persistence.touch(record, before, exit),
|
|
2109
784
|
};
|
|
2110
785
|
if (durability === 'committed') {
|
|
2111
|
-
|
|
2112
|
-
|
|
786
|
+
const staged = stageDurableUpdate(run, patch, hooks, exit);
|
|
787
|
+
this.persistence.commitIndex(new Map([[id, staged.run]]), undefined, { before: new Map([[id, before]]), exits: new Map([[id, staged.exit]]) });
|
|
788
|
+
return this.rows.record(id);
|
|
2113
789
|
}
|
|
2114
790
|
stageDebouncedUpdate(run, patch, hooks);
|
|
2115
791
|
return run;
|
|
2116
792
|
}
|
|
2117
793
|
redactPatch(patch) {
|
|
2118
|
-
return redactPatch(patch, text => this.redactText(text));
|
|
794
|
+
return redactPatch(patch, text => this.redaction.redactText(text));
|
|
2119
795
|
}
|
|
2120
796
|
/** Append a step to an existing run (used by "Continue" — spec 003). */
|
|
2121
797
|
addStep(runId, step) {
|
|
2122
|
-
const run = this.record(runId);
|
|
798
|
+
const run = this.rows.record(runId);
|
|
2123
799
|
if (!run || run.steps.some((s) => s.id === step.id))
|
|
2124
800
|
return;
|
|
2125
|
-
|
|
2126
|
-
|
|
801
|
+
const before = snapshotRun(run);
|
|
802
|
+
run.steps = [...run.steps, { ...step, status: 'pending', iterations: 0, tokensUsed: 0 }];
|
|
803
|
+
this.persistence.touch(run, before);
|
|
2127
804
|
}
|
|
2128
805
|
updateStep(runId, stepId, patch) {
|
|
2129
|
-
const run = this.record(runId);
|
|
806
|
+
const run = this.rows.record(runId);
|
|
2130
807
|
const step = run?.steps.find((s) => s.id === stepId);
|
|
2131
808
|
if (!run || !step)
|
|
2132
809
|
return;
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
candidate.usageTurnsRecorded !== undefined &&
|
|
2143
|
-
candidate.usageTurnsStarted > 0 &&
|
|
2144
|
-
candidate.usageTurnsStarted === candidate.usageTurnsRecorded &&
|
|
2145
|
-
candidate.inputTokens !== undefined &&
|
|
2146
|
-
candidate.outputTokens !== undefined);
|
|
2147
|
-
run.inputTokens = directionalComplete
|
|
2148
|
-
? startedAgentSteps.reduce((sum, candidate) => sum + (candidate.inputTokens ?? 0), 0)
|
|
2149
|
-
: undefined;
|
|
2150
|
-
run.outputTokens = directionalComplete
|
|
2151
|
-
? startedAgentSteps.reduce((sum, candidate) => sum + (candidate.outputTokens ?? 0), 0)
|
|
2152
|
-
: undefined;
|
|
2153
|
-
const cost = run.steps.reduce((sum, s) => sum + (s.costUsd ?? 0), 0);
|
|
2154
|
-
run.costUsd = run.steps.some((step) => step.costUsd !== undefined) ? cost : undefined;
|
|
2155
|
-
this.touch(run);
|
|
2156
|
-
}
|
|
2157
|
-
listArchiveOnMergeCandidates(afterSeq = 0, limit = 32) {
|
|
2158
|
-
return this.db?.listArchiveOnMergeCandidates(afterSeq, limit) ?? [];
|
|
2159
|
-
}
|
|
2160
|
-
/** Use unnormalized persisted evidence: cold reads must not turn interrupted work into safety. */
|
|
2161
|
-
archiveFamily(id, isActive) {
|
|
2162
|
-
return archiveStoreFamily({
|
|
2163
|
-
db: this.db,
|
|
2164
|
-
held: this.held,
|
|
2165
|
-
deleted: this.deleted,
|
|
2166
|
-
quarantined: this.quarantined,
|
|
2167
|
-
pins: this.pins,
|
|
2168
|
-
listWorkersOf: (parentId) => this.listWorkersOf(parentId),
|
|
2169
|
-
setArchiveBlocker: (runId, blocker) => this.setArchiveBlocker(runId, blocker),
|
|
2170
|
-
decodeRunRow,
|
|
2171
|
-
decodeCold: (row) => this.decodeCold(row),
|
|
2172
|
-
writeRefusal: (memberId) => this.writeRefusal(memberId),
|
|
2173
|
-
factsPeek: (memberId) => this.factsFor(memberId).peek(memberId),
|
|
2174
|
-
readWorkerExecution: (memberId) => this.readWorkerExecution(memberId),
|
|
2175
|
-
}, id, isActive);
|
|
2176
|
-
}
|
|
2177
|
-
/** Blockers are feedback, never archive authority or cleanup permission. */
|
|
2178
|
-
setArchiveBlocker(id, blocker) {
|
|
2179
|
-
const run = this.record(id);
|
|
2180
|
-
if (!run || run.archived || isDeepStrictEqual(run.archiveBlocker, blocker))
|
|
2181
|
-
return;
|
|
2182
|
-
this.commitIndex(new Map([[id, { ...run, archiveBlocker: blocker }]]));
|
|
2183
|
-
}
|
|
2184
|
-
archiveMergeBlocker(snapshot, missing, repoBase) {
|
|
2185
|
-
const url = `https://github.com/${missing.owner}/${missing.repo}/pull/${missing.number}`;
|
|
2186
|
-
const family = [snapshot.rootId, ...(this.db?.listIdsByParent(snapshot.rootId) ?? [])].flatMap(id => {
|
|
2187
|
-
const run = this.peek(id);
|
|
2188
|
-
return run ? [run] : [];
|
|
2189
|
-
});
|
|
2190
|
-
const member = family.find(run => archivePullRequests([run], repoBase)?.some(pr => pullRequestKey(pr) === pullRequestKey(missing)));
|
|
2191
|
-
this.setArchiveBlocker(snapshot.rootId, { message: `PR ${missing.owner}/${missing.repo}#${missing.number} is not confirmed merged. Check the PR association or archive manually.`,
|
|
2192
|
-
runId: member?.id ?? snapshot.rootId, pullRequestUrl: url });
|
|
2193
|
-
}
|
|
2194
|
-
hasArchiveOnMergeAssociations(id) {
|
|
2195
|
-
return this.db?.archiveFamilyHasPullRequests(id) ?? false;
|
|
2196
|
-
}
|
|
2197
|
-
async prepareArchiveOnMerge(id) {
|
|
2198
|
-
const ids = [id, ...(this.db?.listIdsByParent(id) ?? [])];
|
|
2199
|
-
if (ids.length > 1025)
|
|
2200
|
-
return;
|
|
2201
|
-
for (const memberId of ids)
|
|
2202
|
-
await this.factsFor(memberId).ready(memberId);
|
|
2203
|
-
}
|
|
2204
|
-
archiveOnMergeSnapshot(id, repoBase, isActive = () => false) {
|
|
2205
|
-
const family = this.archiveFamily(id, isActive);
|
|
2206
|
-
if (!family)
|
|
2207
|
-
return undefined;
|
|
2208
|
-
return this.archiveSnapshot(family, repoBase);
|
|
2209
|
-
}
|
|
2210
|
-
archiveSnapshot(family, repoBase) {
|
|
2211
|
-
const pullRequests = archivePullRequests(family, repoBase);
|
|
2212
|
-
if (!pullRequests) {
|
|
2213
|
-
this.setArchiveBlocker(family[0].id, { message: 'PR associations cannot be resolved. Check task and worker PRs, or archive manually.' });
|
|
2214
|
-
return undefined;
|
|
2215
|
-
}
|
|
2216
|
-
const fingerprint = archiveDigest(pullRequests);
|
|
2217
|
-
if (family[0].autoArchive?.fingerprint === fingerprint)
|
|
2218
|
-
return undefined;
|
|
2219
|
-
return { rootId: family[0].id, fingerprint, pullRequests, token: archiveDigest(family.map(({ archiveBlocker: _blocker, ...run }) => run)) };
|
|
2220
|
-
}
|
|
2221
|
-
/** No await between final revalidation and the fenced, all-or-nothing cascade. */
|
|
2222
|
-
archiveAfterMerge(snapshot, observations, repoBase, isActive = () => false) {
|
|
2223
|
-
const family = this.archiveFamily(snapshot.rootId, isActive);
|
|
2224
|
-
if (!family)
|
|
2225
|
-
return false;
|
|
2226
|
-
const current = this.archiveSnapshot(family, repoBase);
|
|
2227
|
-
if (!current || current.token !== snapshot.token || current.fingerprint !== snapshot.fingerprint)
|
|
2228
|
-
return false;
|
|
2229
|
-
const parsed = observations.map(observation => mergedPullRequestSchema.safeParse(observation));
|
|
2230
|
-
if (parsed.some(result => !result.success))
|
|
2231
|
-
return false;
|
|
2232
|
-
const merged = parsed.flatMap(result => result.success ? [result.data] : []);
|
|
2233
|
-
const byKey = new Map(merged.map(pr => [pullRequestKey(pr), pr]));
|
|
2234
|
-
if (byKey.size !== current.pullRequests.length || current.pullRequests.some(pr => !byKey.has(pullRequestKey(pr))))
|
|
2235
|
-
return false;
|
|
2236
|
-
const restoredAt = Math.max(0, ...family.map(run => run.manualUnarchivedAt ? Date.parse(run.manualUnarchivedAt) : 0));
|
|
2237
|
-
if (restoredAt && merged.every(pr => Date.parse(pr.mergedAt) <= restoredAt))
|
|
2238
|
-
return false;
|
|
2239
|
-
const now = new Date().toISOString();
|
|
2240
|
-
if (merged.some(pr => Date.parse(pr.mergedAt) > Date.parse(now)))
|
|
2241
|
-
return false;
|
|
2242
|
-
const staged = new Map();
|
|
2243
|
-
this.stageArchive(staged, family[0], true);
|
|
2244
|
-
staged.get(snapshot.rootId).autoArchive = { reason: 'pull-requests-merged', archivedAt: now, fingerprint: current.fingerprint, pullRequests: merged };
|
|
2245
|
-
this.commitIndex(staged);
|
|
2246
|
-
for (const id of staged.keys())
|
|
2247
|
-
this.compressor.enqueue(id);
|
|
2248
|
-
return true;
|
|
2249
|
-
}
|
|
2250
|
-
setArchived(id, archived) {
|
|
2251
|
-
const run = this.record(id);
|
|
810
|
+
const before = snapshotRun(run), next = { ...step, ...stageStepUpdate(patch, text => this.redaction.redactText(text)) };
|
|
811
|
+
// Replaced, never changed in place, so `before` keeps the steps as they were.
|
|
812
|
+
run.steps = run.steps.map((candidate) => candidate === step ? next : candidate);
|
|
813
|
+
Object.assign(run, stepTotals(run.steps));
|
|
814
|
+
this.persistence.touch(run, before);
|
|
815
|
+
}
|
|
816
|
+
/** A debounced write of the held record `id`: `apply` changes it in place, then `touch` saves it. */
|
|
817
|
+
change(id, apply) {
|
|
818
|
+
const run = this.rows.record(id), before = snapshotRun(run);
|
|
2252
819
|
if (!run)
|
|
2253
820
|
return undefined;
|
|
2254
|
-
|
|
821
|
+
apply(run);
|
|
822
|
+
this.persistence.touch(run, before);
|
|
2255
823
|
return run;
|
|
2256
824
|
}
|
|
2257
|
-
/** Parent + owned workers; returns how many records flipped `archived`. */
|
|
2258
|
-
applyArchivedCascade(run, archived) {
|
|
2259
|
-
const staged = new Map();
|
|
2260
|
-
this.stageArchive(staged, run, archived);
|
|
2261
|
-
let changed = 0;
|
|
2262
|
-
for (const [id, next] of staged) {
|
|
2263
|
-
if (next && this.peek(id)?.archived !== archived)
|
|
2264
|
-
changed++;
|
|
2265
|
-
if (next)
|
|
2266
|
-
next.completionAction = undefined; // an explicit filing/restoration retires pending work
|
|
2267
|
-
}
|
|
2268
|
-
this.commitIndex(staged);
|
|
2269
|
-
return changed;
|
|
2270
|
-
}
|
|
2271
|
-
applyArchived(run, archived) {
|
|
2272
|
-
const changed = run.archived !== archived;
|
|
2273
|
-
// Transcript first: a restore throw aborts with the record unchanged (#818 S3).
|
|
2274
|
-
this.syncTranscriptForm(run.id, archived);
|
|
2275
|
-
archiveFields(run, archived, new Date().toISOString());
|
|
2276
|
-
this.touch(run);
|
|
2277
|
-
return changed;
|
|
2278
|
-
}
|
|
2279
|
-
/** Transcript form follows `archived`: enqueue compression, or restore the plain file now. */
|
|
2280
|
-
syncTranscriptForm(id, archived) {
|
|
2281
|
-
if (archived)
|
|
2282
|
-
this.compressor.enqueue(id);
|
|
2283
|
-
else {
|
|
2284
|
-
this.compressor.cancel(id);
|
|
2285
|
-
restoreHistory(this.dataDir, id);
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
/**
|
|
2289
|
-
* Whether this store may compress `id`'s transcript: the run exists, is archived, is not in a
|
|
2290
|
-
* live status (queued/running/waiting), and this process holds the family's claim in `claimed`
|
|
2291
|
-
* (not merely `pendingClaims`). Two processes never both write a run (#779, #818 B1).
|
|
2292
|
-
*/
|
|
2293
|
-
isHistoryCompressEligible(id) {
|
|
2294
|
-
if (this.deleted.has(id))
|
|
2295
|
-
return false;
|
|
2296
|
-
try {
|
|
2297
|
-
const run = this.held.get(id) ?? this.peek(id);
|
|
2298
|
-
if (!run || run.archived !== true || isLiveStatus(run.status))
|
|
2299
|
-
return false;
|
|
2300
|
-
return this.holdsCompressClaim(id);
|
|
2301
|
-
}
|
|
2302
|
-
catch {
|
|
2303
|
-
return false;
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
|
-
/** Take the family claim if free and require it to be in `this.claimed`, not only pending. */
|
|
2307
|
-
holdsCompressClaim(id) {
|
|
2308
|
-
const family = this.familyOf(id);
|
|
2309
|
-
return this.claimFamilies([family]).has(family) && this.claimed.has(family);
|
|
2310
|
-
}
|
|
2311
|
-
/** Startup sweep: enqueue every archived non-live run that still has a plain transcript. */
|
|
2312
|
-
compressArchivedHistory() {
|
|
2313
|
-
try {
|
|
2314
|
-
const ids = new Set();
|
|
2315
|
-
for (const key of this.db?.listKeysWhere('archived = 1 AND live = 0') ?? []) {
|
|
2316
|
-
if (!this.deleted.has(key.id))
|
|
2317
|
-
ids.add(key.id);
|
|
2318
|
-
}
|
|
2319
|
-
for (const run of this.held.values()) {
|
|
2320
|
-
if (run.archived && !isLiveStatus(run.status) && !this.deleted.has(run.id))
|
|
2321
|
-
ids.add(run.id);
|
|
2322
|
-
}
|
|
2323
|
-
for (const id of ids) {
|
|
2324
|
-
try {
|
|
2325
|
-
const { plain } = historyPaths(this.dataDir, id);
|
|
2326
|
-
// Claim only ids with work: a plain file to compress, including both-present leftovers.
|
|
2327
|
-
if (!existsSync(plain))
|
|
2328
|
-
continue;
|
|
2329
|
-
if (!this.holdsCompressClaim(id))
|
|
2330
|
-
continue;
|
|
2331
|
-
if (hasPlainHistory(this.dataDir, id))
|
|
2332
|
-
this.compressor.enqueue(id);
|
|
2333
|
-
}
|
|
2334
|
-
catch {
|
|
2335
|
-
// Best effort: one id must not stop the sweep or boot (#818 S2).
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
catch {
|
|
2340
|
-
// listKeysWhere / open-time fs: never throw out of boot.
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
/** Resolves when the transcript compressor is idle (tests, shutdown). */
|
|
2344
|
-
historyIdle() {
|
|
2345
|
-
return this.compressor.idle();
|
|
2346
|
-
}
|
|
2347
|
-
/** Pin one run to the top of this project's task list, or unpin it (#935). Mirrors
|
|
2348
|
-
* `setArchived`: sets the fields, then persists + broadcasts via `touch`, so the updated
|
|
2349
|
-
* record rides the existing `run` SSE with no new event. Idempotent — re-pinning a pinned
|
|
2350
|
-
* run just re-stamps `pinnedAt`.
|
|
2351
|
-
*
|
|
2352
|
-
* Every active status is pinnable. Archived requests clear stale metadata instead, so a
|
|
2353
|
-
* late click racing archive cannot leave a hidden pin that reappears on unarchive. */
|
|
2354
|
-
setPinned(id, pinned) {
|
|
2355
|
-
const run = this.record(id);
|
|
2356
|
-
if (!run)
|
|
2357
|
-
return undefined;
|
|
2358
|
-
if (pinned && !run.archived) {
|
|
2359
|
-
run.pinned = true;
|
|
2360
|
-
run.pinnedAt = new Date().toISOString();
|
|
2361
|
-
}
|
|
2362
|
-
else {
|
|
2363
|
-
clearPin(run);
|
|
2364
|
-
}
|
|
2365
|
-
this.touch(run);
|
|
2366
|
-
return run;
|
|
2367
|
-
}
|
|
2368
|
-
/** Bulk-archive finished runs (#780). `isSweepable` decides which; `archived` counts every
|
|
2369
|
-
* record that flipped (cascaded workers included), `ids` lists the top-level runs picked and
|
|
2370
|
-
* `pinnedIds` the subset that carried a pin before `clearPin` dropped it. */
|
|
2371
|
-
archiveFinished(scope, automation) {
|
|
2372
|
-
let archived = 0;
|
|
2373
|
-
// Snapshot first: cascade may archive still-live workers, mutating the held set, and the pin
|
|
2374
|
-
// has to be read before `applyArchived` clears it. Runs not in memory are picked off their
|
|
2375
|
-
// stored summary, which carries every field `isSweepable` reads.
|
|
2376
|
-
const picked = [...this.held.values()].filter((run) => SWEEPABLE_RUN_RULE.matches({ ...run, automationId: automationIdOf(run) }, scope, automation))
|
|
2377
|
-
.map((run) => [run, this.listOrder(run)]);
|
|
2378
|
-
for (const row of this.db?.listWhere(SWEEPABLE_RUN_RULE.sql) ?? []) {
|
|
2379
|
-
if (this.held.has(row.id) || this.deleted.has(row.id))
|
|
2380
|
-
continue;
|
|
2381
|
-
const summary = parseStoredSummary(row.summary);
|
|
2382
|
-
if (summary && SWEEPABLE_RUN_RULE.matches(summary, scope, automation))
|
|
2383
|
-
picked.push([summary, row]);
|
|
2384
|
-
}
|
|
2385
|
-
// Another process's runs are not this store's to archive (#779, plan step 3): they stay out.
|
|
2386
|
-
// A sweepable run is never a worker (`isSweepable`), so each is its own family.
|
|
2387
|
-
const writable = this.claimFamilies(picked.map(([run]) => run.id));
|
|
2388
|
-
const mine = sortNewestFirst(picked.filter(([run]) => writable.has(run.id)));
|
|
2389
|
-
const ids = mine.map((run) => run.id);
|
|
2390
|
-
const pinnedIds = mine.filter((run) => run.pinned).map((run) => run.id);
|
|
2391
|
-
for (const id of ids) {
|
|
2392
|
-
// Re-check: a prior cascade may already have archived this id.
|
|
2393
|
-
const run = this.record(id);
|
|
2394
|
-
if (!run || run.archived)
|
|
2395
|
-
continue;
|
|
2396
|
-
archived += this.applyArchivedCascade(run, true);
|
|
2397
|
-
}
|
|
2398
|
-
return { archived, ids, pinnedIds };
|
|
2399
|
-
}
|
|
2400
|
-
/** Mark one run as read (#unread-done-items): stamp the read receipt now. Mirrors
|
|
2401
|
-
* `setArchived` — sets the field then persists + broadcasts via `touch`, so the
|
|
2402
|
-
* updated record rides the existing `run` SSE with no new event. Idempotent by
|
|
2403
|
-
* design: opening an already-read thread just re-stamps a later `seenAt`. */
|
|
2404
|
-
setRead(id) {
|
|
2405
|
-
const run = this.record(id);
|
|
2406
|
-
if (!run)
|
|
2407
|
-
return undefined;
|
|
2408
|
-
run.seenAt = new Date().toISOString();
|
|
2409
|
-
this.touch(run);
|
|
2410
|
-
return run;
|
|
2411
|
-
}
|
|
2412
|
-
/** Mark one run as UNread (#775): drop the read receipt so the run rejoins the unread
|
|
2413
|
-
* list. The inverse of `setRead` and, like it, `touch`es so the updated record rides the
|
|
2414
|
-
* existing `run` SSE.
|
|
2415
|
-
*
|
|
2416
|
-
* Deleting the field rather than adding a "manually unread" flag is the whole point:
|
|
2417
|
-
* absent `seenAt` is ALREADY what every reader treats as unread (`isUnread` in the
|
|
2418
|
-
* cockpit's read-state.ts, and `markAllRead`'s clause-for-clause copy of it below), so
|
|
2419
|
-
* clearing needs no new state and writes a shape any older cezar already parses.
|
|
2420
|
-
*
|
|
2421
|
-
* Deliberately unconditional: clearing a receipt is always a legal write, so this
|
|
2422
|
-
* succeeds for an already-unread run (idempotent) and for statuses that can never wear
|
|
2423
|
-
* the marker. WHETHER the action means anything for a given run is UI policy, and lives
|
|
2424
|
-
* in the cockpit's `runActionFlags` — the same split the rest of the store keeps. */
|
|
2425
|
-
setUnread(id) {
|
|
2426
|
-
const run = this.record(id);
|
|
2427
|
-
if (!run)
|
|
2428
|
-
return undefined;
|
|
2429
|
-
delete run.seenAt;
|
|
2430
|
-
this.touch(run);
|
|
2431
|
-
return run;
|
|
2432
|
-
}
|
|
2433
|
-
/**
|
|
2434
|
-
* Stamp unread finished runs in bulk and return the count. Keep the rule aligned with cockpit
|
|
2435
|
-
* isUnread: done/failed, finished since seen, not archived; cancelled and usage-limit waiting
|
|
2436
|
-
* runs are excluded. `automation` narrows it to one origin, as in `archiveFinished`
|
|
2437
|
-
* (hearsay-tools/cezarion#1616); absent stamps both.
|
|
2438
|
-
*/
|
|
2439
|
-
markAllRead(automation) {
|
|
2440
|
-
const now = new Date().toISOString();
|
|
2441
|
-
let count = 0;
|
|
2442
|
-
// Runs not in memory are picked by the same rule over their stored summary, then re-checked
|
|
2443
|
-
// on the record before they are stamped.
|
|
2444
|
-
const candidates = [...this.held.values()];
|
|
2445
|
-
const stored = (this.db?.listWhere(UNREAD_RUN_RULE.sql) ?? []).filter((row) => !this.held.has(row.id) && !this.deleted.has(row.id));
|
|
2446
|
-
// One claim transaction for them all; another process's runs are skipped (`record` refuses).
|
|
2447
|
-
this.claimFamilies(stored.map(rowFamily));
|
|
2448
|
-
for (const row of stored) {
|
|
2449
|
-
const run = this.record(row.id);
|
|
2450
|
-
if (run)
|
|
2451
|
-
candidates.push(run);
|
|
2452
|
-
}
|
|
2453
|
-
for (const run of candidates) {
|
|
2454
|
-
const unread = UNREAD_RUN_RULE.matches(run);
|
|
2455
|
-
if (!unread)
|
|
2456
|
-
continue;
|
|
2457
|
-
if (automation !== undefined && (automationIdOf(run) !== undefined) !== automation)
|
|
2458
|
-
continue;
|
|
2459
|
-
run.seenAt = now;
|
|
2460
|
-
this.touch(run);
|
|
2461
|
-
count++;
|
|
2462
|
-
}
|
|
2463
|
-
return count;
|
|
2464
|
-
}
|
|
2465
|
-
appendEvent(runId, event) {
|
|
2466
|
-
const run = this.record(runId);
|
|
2467
|
-
if (!run) {
|
|
2468
|
-
const ownership = this.runOwnership(runId);
|
|
2469
|
-
if (ownership === 'fallback')
|
|
2470
|
-
throw this.fallbackRefusal(runId);
|
|
2471
|
-
if (ownership === 'foreign' || ownership === 'orphaned' || ownership === 'quarantined')
|
|
2472
|
-
throw new RunWriteRefusedError(runId, ownership);
|
|
2473
|
-
throw new Error(`unknown run: ${runId}`);
|
|
2474
|
-
}
|
|
2475
|
-
const seq = this.nextSeq(runId);
|
|
2476
|
-
// Scrub credentials before the event touches disk or the live wire (#427):
|
|
2477
|
-
// tool-result output is persisted verbatim and served back over the API, so
|
|
2478
|
-
// a secret in an agent's command output would otherwise land in `.ai/cezar/`.
|
|
2479
|
-
const full = this.redact(defined({ ...event, seq, ts: new Date().toISOString() }));
|
|
2480
|
-
// Sync append keeps event order without a write queue; local NDJSON
|
|
2481
|
-
// appends at agent-event rates are effectively free.
|
|
2482
|
-
if (!hasPlainHistory(this.dataDir, runId))
|
|
2483
|
-
restoreHistory(this.dataDir, runId);
|
|
2484
|
-
const line = `${JSON.stringify(full)}\n`;
|
|
2485
|
-
appendFileSync(this.eventsPath(runId), line, 'utf8');
|
|
2486
|
-
this.facts.append(runId, full, Buffer.byteLength(line));
|
|
2487
|
-
this.maybeEnqueueHistoryCompress(run);
|
|
2488
|
-
this.liveItems.observe(runId, full, false);
|
|
2489
|
-
this.emit('event', { runId, event: full });
|
|
2490
|
-
// Reference discovery runs last, after the event is persisted, indexed and
|
|
2491
|
-
// published: the janitor reads the event text and may still update the run.
|
|
2492
|
-
scanEventReferences(run, full, this.repoHandle, (target, entries) => this.accumulatePullRequests(target, entries), (target) => this.touch(target));
|
|
2493
|
-
return full;
|
|
2494
|
-
}
|
|
2495
|
-
/**
|
|
2496
|
-
* Apply agent-declared reference markers (spec 2026-07-18-task-ref-markers).
|
|
2497
|
-
* Marker values are authoritative for the display tier: they overwrite the
|
|
2498
|
-
* regex/namer numbers unless the prompt identifies the originating issue, and a declared PR re-resolves the referenced URL
|
|
2499
|
-
* against the candidate working set — including down to `undefined` when no
|
|
2500
|
-
* candidate matches (a wrong chip is worse than no chip). The created tier
|
|
2501
|
-
* (`pullRequestUrl`) is deliberately untouched.
|
|
2502
|
-
*
|
|
2503
|
-
* One declaration is NOT a statement about the referenced tier: the number of the PR this run
|
|
2504
|
-
* itself created. See `referencedPrDeclaration` — the marker contract asks the agent to
|
|
2505
|
-
* re-declare after it opens a PR, and taking that literally cost the task the PR it was about.
|
|
2506
|
-
*/
|
|
2507
|
-
applyMarkerRefs(runId, refs) {
|
|
2508
|
-
const run = this.record(runId);
|
|
2509
|
-
if (!run || (refs.pr === undefined && refs.issue === undefined))
|
|
2510
|
-
return run;
|
|
2511
|
-
const numbers = [...new Set([...(run.markerRefs?.pr === undefined ? [] : [run.markerRefs.pr]),
|
|
2512
|
-
...(refs.prs ?? (refs.pr === undefined ? [] : [refs.pr]))])];
|
|
2513
|
-
if (numbers.length)
|
|
2514
|
-
this.accumulatePullRequests(run, numbers.flatMap((number) => {
|
|
2515
|
-
const matches = (run.referencedPrCandidates ?? []).filter((url) => refUrlNumber(url) === number &&
|
|
2516
|
-
(this.repoHandle ? isRepoScopedRef(url, run.task, this.repoHandle) : promptNamesRepo(url, run.task)));
|
|
2517
|
-
const url = matches.length === 1 ? matches[0] : matches.length === 0 && this.repoHandle
|
|
2518
|
-
? `https://github.com/${this.repoHandle.owner}/${this.repoHandle.name}/pull/${number}` : undefined;
|
|
2519
|
-
const parsed = runPullRequestSchema.safeParse({ number, ...(url ? { url } : {}), source: 'declared' });
|
|
2520
|
-
return parsed.success ? [parsed.data] : [];
|
|
2521
|
-
}));
|
|
2522
|
-
run.markerRefs = {
|
|
2523
|
-
...run.markerRefs,
|
|
2524
|
-
...(refs.pr !== undefined ? { pr: refs.pr } : {}),
|
|
2525
|
-
...(refs.issue !== undefined ? { issue: refs.issue } : {}),
|
|
2526
|
-
};
|
|
2527
|
-
// `prNumber` is the about-PR as well (it is what paints a numeric-only chip), so a
|
|
2528
|
-
// re-declaration naming the created PR only FILLS it — it never overwrites the number the
|
|
2529
|
-
// task came in with, which is still the PR this task is about.
|
|
2530
|
-
if (refs.pr !== undefined && (run.prNumber === undefined || refs.pr !== refUrlNumber(run.pullRequestUrl))) {
|
|
2531
|
-
run.prNumber = refs.pr;
|
|
2532
|
-
}
|
|
2533
|
-
if (refs.issue !== undefined) {
|
|
2534
|
-
run.issueNumber = originatingIssue(run) ?? refs.issue;
|
|
2535
|
-
delete run.referencedIssueNumberSeeded;
|
|
2536
|
-
}
|
|
2537
|
-
if (run.markerRefs.pr !== undefined) {
|
|
2538
|
-
run.referencedPullRequestUrl = resolveReferencedRef(run.referencedPrCandidates ?? [], run.task, referencedPrDeclaration(run), this.repoHandle);
|
|
2539
|
-
}
|
|
2540
|
-
if (run.markerRefs.issue !== undefined) {
|
|
2541
|
-
run.referencedIssueUrl = resolveIssueReference(run, this.repoHandle);
|
|
2542
|
-
}
|
|
2543
|
-
this.touch(run);
|
|
2544
|
-
return run;
|
|
2545
|
-
}
|
|
2546
|
-
/** Authoritative creation keeps the first scalar for publishing, plus every created identity. */
|
|
2547
|
-
recordCreatedPr(runId, url) {
|
|
2548
|
-
const run = this.record(runId);
|
|
2549
|
-
const parsed = runPullRequestSchema.safeParse({ number: refUrlNumber(url), url, source: 'created' });
|
|
2550
|
-
if (!run || !parsed.success)
|
|
2551
|
-
return run;
|
|
2552
|
-
let changed = this.accumulatePullRequests(run, [parsed.data]);
|
|
2553
|
-
if (!run.pullRequestUrl) {
|
|
2554
|
-
run.pullRequestUrl = url;
|
|
2555
|
-
changed = true;
|
|
2556
|
-
}
|
|
2557
|
-
if (changed)
|
|
2558
|
-
this.touch(run);
|
|
2559
|
-
return run;
|
|
2560
|
-
}
|
|
2561
|
-
accumulatePullRequests(run, entries) {
|
|
2562
|
-
return stagePullRequests(run, entries, this.repoHandle);
|
|
2563
|
-
}
|
|
2564
|
-
/**
|
|
2565
|
-
* Fan an event out to live subscribers WITHOUT writing it to the NDJSON
|
|
2566
|
-
* file — the channel for coalesced `item.delta` flushes (protocol-v2
|
|
2567
|
-
* performance guardrail: raw deltas never hit disk; replay = the persisted
|
|
2568
|
-
* snapshots). Stamped with `seq`/`ts` like persisted lines so the live
|
|
2569
|
-
* wire keeps one ordering axis. Finite polling coalesces active item content
|
|
2570
|
-
* into bounded in-memory snapshots on that clock; disk replay still has gaps
|
|
2571
|
-
* (dedup compares with `>`).
|
|
2572
|
-
*/
|
|
2573
|
-
emitEphemeral(runId, event) {
|
|
2574
|
-
const full = this.redact({ ...event, seq: this.nextSeq(runId), ts: new Date().toISOString() });
|
|
2575
|
-
this.liveItems.observe(runId, full, true);
|
|
2576
|
-
this.emit('event', { runId, event: full });
|
|
2577
|
-
return full;
|
|
2578
|
-
}
|
|
2579
|
-
/** Lazily-collected concrete secret values from the host env (#427). */
|
|
2580
|
-
secretValues = null;
|
|
2581
|
-
/** Controller-issued tokens never persist, including when host-secret redaction is disabled. */
|
|
2582
|
-
sessionSecrets = new Set();
|
|
2583
|
-
registerSessionSecret(value) { this.sessionSecrets.add(value); }
|
|
2584
|
-
containsSessionSecret(value) { return [...this.sessionSecrets].some(secret => value.includes(secret)); }
|
|
2585
|
-
/**
|
|
2586
|
-
* Scrub known credential values / token shapes from an event before it is
|
|
2587
|
-
* persisted or fanned out. On by default; `CEZ_REDACT_SECRETS=0` opts out.
|
|
2588
|
-
*/
|
|
2589
|
-
redact(event) {
|
|
2590
|
-
const safe = this.sessionSecrets.size ? redactDeep(event, [...this.sessionSecrets]) : event;
|
|
2591
|
-
if (productEnv('REDACT_SECRETS') === '0')
|
|
2592
|
-
return safe;
|
|
2593
|
-
return redactDeep(safe, this.hostSecrets());
|
|
2594
|
-
}
|
|
2595
|
-
/** Best-effort scrub of one free-text string bound for `runs.json`. Honors
|
|
2596
|
-
* the `CEZ_REDACT_SECRETS=0` opt-out itself so every caller inherits it. */
|
|
2597
|
-
redactText(text) {
|
|
2598
|
-
return redactText(text, [...this.sessionSecrets], () => this.hostSecrets());
|
|
2599
|
-
}
|
|
2600
|
-
hostSecrets() {
|
|
2601
|
-
if (this.secretValues === null)
|
|
2602
|
-
this.secretValues = collectSecretValues();
|
|
2603
|
-
return this.secretValues;
|
|
2604
|
-
}
|
|
2605
|
-
/** The run's indexed transcript facts (#880): a read-only view, never a transcript read once
|
|
2606
|
-
* the run's index is loaded. An unreadable transcript answers as empty, as readEvents does. */
|
|
2607
|
-
transcriptFacts(runId) {
|
|
2608
|
-
return this.factsFor(runId).get(runId) ?? emptyFacts();
|
|
2609
|
-
}
|
|
2610
|
-
/** The run's transcript facts when they are known: undefined when the transcript exists but its
|
|
2611
|
-
* facts are not current or cannot be read, so a caller can tell "no ask" from "no evidence". */
|
|
2612
|
-
knownTranscriptFacts(runId) {
|
|
2613
|
-
return this.factsFor(runId).peek(runId);
|
|
2614
|
-
}
|
|
2615
|
-
hasProjection(runId, projectionId) {
|
|
2616
|
-
return this.transcriptFacts(runId).projectionIds.includes(projectionId);
|
|
2617
|
-
}
|
|
2618
|
-
factsWarming = Promise.resolve();
|
|
2619
|
-
/** Indexed family enumeration, including members not yet flushed to SQLite. */
|
|
2620
|
-
listFamilyRunIds(rootId) {
|
|
2621
|
-
const ids = new Set([rootId, ...(this.db?.listIdsByParent(rootId) ?? [])]);
|
|
2622
|
-
for (const [id, run] of this.held) {
|
|
2623
|
-
if (familyRootOf(run) === rootId)
|
|
2624
|
-
ids.add(id);
|
|
2625
|
-
else if (id !== rootId)
|
|
2626
|
-
ids.delete(id);
|
|
2627
|
-
}
|
|
2628
|
-
for (const id of this.deleted)
|
|
2629
|
-
ids.delete(id);
|
|
2630
|
-
return [...ids];
|
|
2631
|
-
}
|
|
2632
|
-
recoveryFactIds(familyRootId) {
|
|
2633
|
-
if (familyRootId !== undefined)
|
|
2634
|
-
return this.listFamilyRunIds(familyRootId);
|
|
2635
|
-
const ids = new Set();
|
|
2636
|
-
for (const [id, run] of this.held) {
|
|
2637
|
-
if (!isLiveRecord(run))
|
|
2638
|
-
continue;
|
|
2639
|
-
const root = familyRootOf(run);
|
|
2640
|
-
for (const member of root === undefined ? [id] : this.listFamilyRunIds(root))
|
|
2641
|
-
ids.add(member);
|
|
2642
|
-
}
|
|
2643
|
-
return [...ids];
|
|
2644
|
-
}
|
|
2645
|
-
/** Readiness owns no run snapshot across an await: refresh only the currently held owner. */
|
|
2646
|
-
async prepareTranscriptFacts(runIds) {
|
|
2647
|
-
for (const id of new Set(runIds)) {
|
|
2648
|
-
// Exact sidecars resolve immediately too: recovery must yield to timers/I/O between IDs.
|
|
2649
|
-
await new Promise(resolve => setImmediate(resolve));
|
|
2650
|
-
await this.factsFor(id).ready(id);
|
|
2651
|
-
}
|
|
2652
|
-
}
|
|
2653
|
-
prepareRecoveryFacts(familyRootId) {
|
|
2654
|
-
return this.prepareTranscriptFacts(this.recoveryFactIds(familyRootId));
|
|
2655
|
-
}
|
|
2656
|
-
/** Register IDs only here; the index yields between cache reads and off-loop rebuilds. */
|
|
2657
|
-
warmTranscriptFacts() {
|
|
2658
|
-
this.factsWarming = Promise.resolve().then(async () => {
|
|
2659
|
-
if (!this.db)
|
|
2660
|
-
return;
|
|
2661
|
-
const ids = new Set(this.recoveryFactIds());
|
|
2662
|
-
// hearsay-tools/cezarion#949: this microtask ends open()'s synchronous slice, and on a
|
|
2663
|
-
// large history the JSON scan for conversation roots plus one family query per root cost
|
|
2664
|
-
// as much again. Past one slice's worth of runs, yield before the scan and between root
|
|
2665
|
-
// batches; a small store (every unit test) still registers in this one microtask.
|
|
2666
|
-
const large = this.listRunIds().length > WARM_IDS_PER_SLICE;
|
|
2667
|
-
const turn = async () => {
|
|
2668
|
-
await new Promise(resolve => setImmediate(resolve));
|
|
2669
|
-
return this.db !== null;
|
|
2670
|
-
};
|
|
2671
|
-
if (large && !await turn())
|
|
2672
|
-
return;
|
|
2673
|
-
const roots = this.listConversationRootIds();
|
|
2674
|
-
for (let i = 0; i < roots.length; i++) {
|
|
2675
|
-
if (large && i > 0 && i % WARM_IDS_PER_SLICE === 0 && !await turn())
|
|
2676
|
-
return;
|
|
2677
|
-
for (const id of this.listFamilyRunIds(roots[i]))
|
|
2678
|
-
ids.add(id);
|
|
2679
|
-
}
|
|
2680
|
-
if (large && !await turn())
|
|
2681
|
-
return;
|
|
2682
|
-
// Re-list after the yields: a run deleted meanwhile must not be registered again.
|
|
2683
|
-
const present = this.listRunIds();
|
|
2684
|
-
if (large) {
|
|
2685
|
-
const live = new Set(present);
|
|
2686
|
-
for (const id of ids)
|
|
2687
|
-
if (!live.has(id))
|
|
2688
|
-
ids.delete(id);
|
|
2689
|
-
}
|
|
2690
|
-
for (const id of present)
|
|
2691
|
-
ids.add(id);
|
|
2692
|
-
await this.facts.warm(ids);
|
|
2693
|
-
}).catch(() => undefined);
|
|
2694
|
-
}
|
|
2695
|
-
/** Resolves when the open-time warm-up is done (tests). */
|
|
2696
|
-
factsWarmIdle() {
|
|
2697
|
-
return this.factsWarming;
|
|
2698
|
-
}
|
|
2699
|
-
/** `readEvents` off the event loop (async read and async brotli), for collection paths. */
|
|
2700
|
-
async readEventsAsync(runId) {
|
|
2701
|
-
try {
|
|
2702
|
-
const raw = await readHistoryTextAsync(this.sourceDataDir(runId), runId);
|
|
2703
|
-
return raw === undefined ? [] : parseEvents(raw);
|
|
2704
|
-
}
|
|
2705
|
-
catch {
|
|
2706
|
-
return [];
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
readEvents(runId) {
|
|
2710
|
-
try {
|
|
2711
|
-
const raw = readHistoryText(this.sourceDataDir(runId), runId);
|
|
2712
|
-
if (raw === undefined)
|
|
2713
|
-
return [];
|
|
2714
|
-
return parseEvents(raw);
|
|
2715
|
-
}
|
|
2716
|
-
catch {
|
|
2717
|
-
return [];
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
/** Private process-generation evidence; never part of run JSON or SSE. */
|
|
2721
|
-
identityPath(id, write = false) {
|
|
2722
|
-
return this.executionPath(id, write).replace(/\.execution\.json$/, '.identity.json');
|
|
2723
|
-
}
|
|
2724
|
-
readWorkerIdentity(id) {
|
|
2725
|
-
try {
|
|
2726
|
-
const fd = openSync(this.identityPath(id), constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
2727
|
-
try {
|
|
2728
|
-
const info = fstatSync(fd);
|
|
2729
|
-
if (!info.isFile() || info.size > 16384 || (info.mode & 0o077))
|
|
2730
|
-
return undefined;
|
|
2731
|
-
const buffer = Buffer.alloc(16385);
|
|
2732
|
-
const count = readSync(fd, buffer, 0, buffer.length, 0);
|
|
2733
|
-
return workerExecutionIdentitySchema.parse(JSON.parse(buffer.subarray(0, count).toString('utf8')));
|
|
2734
|
-
}
|
|
2735
|
-
finally {
|
|
2736
|
-
closeSync(fd);
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
catch {
|
|
2740
|
-
return undefined;
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
writeWorkerIdentity(id, identity) {
|
|
2744
|
-
// Immutable acceptance evidence. An orphan from failed index publication cannot be adopted.
|
|
2745
|
-
const fd = openSync(this.identityPath(id, true), constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
2746
|
-
try {
|
|
2747
|
-
writeFileSync(fd, JSON.stringify(identity));
|
|
2748
|
-
fsyncSync(fd);
|
|
2749
|
-
}
|
|
2750
|
-
finally {
|
|
2751
|
-
closeSync(fd);
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
executionPath(id, write = false) {
|
|
2755
|
-
z.string().uuid().parse(id);
|
|
2756
|
-
const dir = join(write ? this.writeDir(id) : this.sourceDataDir(id), 'runs');
|
|
2757
|
-
if (write)
|
|
2758
|
-
mkdirSync(dir, { recursive: true });
|
|
2759
|
-
if (lstatSync(dir).isSymbolicLink() || realpathSync(dir) !== resolve(dir))
|
|
2760
|
-
throw new Error('Unsafe execution directory');
|
|
2761
|
-
return join(dir, `${id}.execution.json`);
|
|
2762
|
-
}
|
|
2763
|
-
readWorkerExecution(id) {
|
|
2764
|
-
try {
|
|
2765
|
-
const path = this.executionPath(id);
|
|
2766
|
-
const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
2767
|
-
try {
|
|
2768
|
-
const info = fstatSync(fd);
|
|
2769
|
-
if (!info.isFile() || info.size > 16384 || (info.mode & 0o077))
|
|
2770
|
-
return undefined;
|
|
2771
|
-
const buffer = Buffer.alloc(16385);
|
|
2772
|
-
const count = readSync(fd, buffer, 0, buffer.length, 0);
|
|
2773
|
-
return workerExecutionSchema.parse(JSON.parse(buffer.subarray(0, count).toString('utf8')));
|
|
2774
|
-
}
|
|
2775
|
-
finally {
|
|
2776
|
-
closeSync(fd);
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
catch {
|
|
2780
|
-
return undefined;
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
writeWorkerExecution(id, proof, fresh = false) {
|
|
2784
|
-
const path = this.executionPath(id, true);
|
|
2785
|
-
try {
|
|
2786
|
-
const existing = lstatSync(path);
|
|
2787
|
-
if (fresh || !existing.isFile() || existing.isSymbolicLink())
|
|
2788
|
-
throw new Error('Unsafe execution checkpoint');
|
|
2789
|
-
}
|
|
2790
|
-
catch (error) {
|
|
2791
|
-
if (error.code !== 'ENOENT')
|
|
2792
|
-
throw error;
|
|
2793
|
-
}
|
|
2794
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
2795
|
-
const fd = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
2796
|
-
try {
|
|
2797
|
-
writeFileSync(fd, JSON.stringify(proof));
|
|
2798
|
-
fsyncSync(fd);
|
|
2799
|
-
}
|
|
2800
|
-
finally {
|
|
2801
|
-
closeSync(fd);
|
|
2802
|
-
}
|
|
2803
|
-
try {
|
|
2804
|
-
renameSync(temporary, path);
|
|
2805
|
-
}
|
|
2806
|
-
finally {
|
|
2807
|
-
rmSync(temporary, { force: true });
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
/** Complete execution is not permission to reuse/delete persistent resources (#738).
|
|
2811
|
-
* Synchronous, fresh and generation/resource fenced; callers hold admission off across awaits. */
|
|
2812
|
-
workerResourcesSafe(id, generation, resourceId, admittingQueued = false) {
|
|
2813
|
-
return this.workerResourceHolders(id, generation, resourceId, { admittingQueued }) === 'safe';
|
|
2814
|
-
}
|
|
2815
|
-
/** `workerResourcesSafe` with the refusal's live PIDs (empty when no PID explains it). */
|
|
2816
|
-
workerResourceHolders(id, generation, resourceId, opts = {}) {
|
|
2817
|
-
if (autosaveCleanupBlocker(this.dataDir, id))
|
|
2818
|
-
return [];
|
|
2819
|
-
const run = this.peek(id);
|
|
2820
|
-
const proof = this.readWorkerExecution(id);
|
|
2821
|
-
if (!workerResourceAuthorized(run, proof, id, generation, resourceId, opts.admittingQueued))
|
|
2822
|
-
return [];
|
|
2823
|
-
const record = this.readWorkerProcesses(id, generation);
|
|
2824
|
-
if (record === 'unknown' || !agentTmpDirOwnershipProven(this.dataDir, id))
|
|
2825
|
-
return [];
|
|
2826
|
-
const paths = [run.delegation.workspace.path, ...agentTmpDirLocations(this.dataDir, id)];
|
|
2827
|
-
// Nothing can be deleted/reused at an absent path. This lets explicit history deletion
|
|
2828
|
-
// retire completed cleanup despite ambient denial, while recorded survivors/unknown evidence
|
|
2829
|
-
// still block. Only ENOENT proves absence; existsSync would also hide access errors.
|
|
2830
|
-
if (workerResourcePathsGone(paths))
|
|
2831
|
-
return workerResourceAbsentHolders(record);
|
|
2832
|
-
return workerResourceLiveHolders(inspectGeneration({ ...(record === 'absent' ? {} : { record }), paths, cwds: opts.cwds }));
|
|
2833
|
-
}
|
|
2834
|
-
/** Upgrade a legacy completed checkpoint while terminal task ownership is still known.
|
|
2835
|
-
* No holder scan here: settlement and scheduling must never wait on cleanup proof. */
|
|
2836
|
-
retainWorkerScratchCleanup(id) {
|
|
2837
|
-
const run = this.peek(id), proof = this.readWorkerExecution(id);
|
|
2838
|
-
if (run?.delegation?.role !== 'worker' || ['queued', 'running', 'waiting'].includes(run.status) || proof?.phase !== 'complete')
|
|
2839
|
-
return;
|
|
2840
|
-
const { resourceId, path } = run.delegation.workspace;
|
|
2841
|
-
if (proof.scratchCleanup?.resourceId === resourceId && proof.scratchCleanup.path === path)
|
|
2842
|
-
return;
|
|
2843
|
-
this.writeWorkerExecution(id, { ...proof, scratchCleanup: { resourceId, path } });
|
|
2844
|
-
}
|
|
2845
|
-
/** Cleanup can outlive its index row, but never its generation or terminal task intent.
|
|
2846
|
-
* `cwds` is the scratch reprobe tick's shared `/proc` snapshot (hearsay-tools/cezarion#879). */
|
|
2847
|
-
workerScratchResourcesSafe(id, generation, resourceId, cwds) {
|
|
2848
|
-
if (autosaveCleanupBlocker(this.dataDir, id))
|
|
2849
|
-
return false;
|
|
2850
|
-
const run = this.peek(id), proof = this.readWorkerExecution(id);
|
|
2851
|
-
if (proof?.phase !== 'complete' || proof.generation !== generation || proof.scratchCleanup?.resourceId !== resourceId ||
|
|
2852
|
-
(run && ['queued', 'running', 'waiting'].includes(run.status)))
|
|
2853
|
-
return false;
|
|
2854
|
-
if (run?.delegation?.role === 'worker')
|
|
2855
|
-
return run.delegation.workspace.path === proof.scratchCleanup.path &&
|
|
2856
|
-
this.workerResourceHolders(id, generation, resourceId, { cwds }) === 'safe';
|
|
2857
|
-
// A valid different role contradicts the retained intent. Quarantined/missing metadata
|
|
2858
|
-
// supplies no new authority; only the private terminal checkpoint authorizes scratch.
|
|
2859
|
-
if (run && run.delegation?.role !== 'invalid')
|
|
2860
|
-
return false;
|
|
2861
|
-
const record = this.readWorkerProcesses(id, generation);
|
|
2862
|
-
if (record === 'unknown' || !agentTmpDirOwnershipProven(this.dataDir, id))
|
|
2863
|
-
return false;
|
|
2864
|
-
return inspectGeneration({ ...(record === 'absent' ? {} : { record }),
|
|
2865
|
-
paths: [proof.scratchCleanup.path, ...agentTmpDirLocations(this.dataDir, id)], cwds }).liveness === 'gone';
|
|
2866
|
-
}
|
|
2867
|
-
commitWorkerExecutionStart(id) {
|
|
2868
|
-
const run = this.peek(id);
|
|
2869
|
-
if (run?.delegation?.role !== 'worker' || run.delegation.destroy)
|
|
2870
|
-
throw new Error('Worker cannot start');
|
|
2871
|
-
const prior = this.readWorkerExecution(id);
|
|
2872
|
-
if (prior?.abandoned)
|
|
2873
|
-
throw new Error('Worker execution was abandoned; spawn a new worker instead of resuming it');
|
|
2874
|
-
if (!prior || (prior.phase !== 'queued' && prior.phase !== 'complete')) {
|
|
2875
|
-
throw new Error('Worker execution checkpoint does not prove safe admission');
|
|
2876
|
-
}
|
|
2877
|
-
if (!this.workerResourcesSafe(id, prior.generation, run.delegation.workspace.resourceId, true)) {
|
|
2878
|
-
throw new Error('Worker resources may still be held by a process; reuse is not proven safe');
|
|
2879
|
-
}
|
|
2880
|
-
const generation = randomUUID();
|
|
2881
|
-
// #469: the controller is durable before `starting`, so a crash leaves a provable generation.
|
|
2882
|
-
this.writeWorkerProcesses(id, { generation, controller: { pid: process.pid, ...startToken(process.pid) }, processes: [] });
|
|
2883
|
-
this.writeWorkerExecution(id, { generation, phase: 'starting' });
|
|
2884
|
-
return generation;
|
|
2885
|
-
}
|
|
2886
|
-
/** Private process record (#469): which processes a generation spawned, never part of run JSON or SSE. */
|
|
2887
|
-
processesPath(id, write = false) {
|
|
2888
|
-
return this.executionPath(id, write).replace(/\.execution\.json$/, '.processes.json');
|
|
2889
|
-
}
|
|
2890
|
-
/** Tri-state: only ENOENT is `absent` (legacy, scan-only). A present record that is unreadable,
|
|
2891
|
-
* wrongly permissioned, malformed or of another generation is `unknown`: never finalized or reaped. */
|
|
2892
|
-
readWorkerProcesses(id, generation) {
|
|
2893
|
-
try {
|
|
2894
|
-
const fd = openSync(this.processesPath(id), constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
2895
|
-
try {
|
|
2896
|
-
const info = fstatSync(fd);
|
|
2897
|
-
if (!info.isFile() || info.size > 8192 || (info.mode & 0o077))
|
|
2898
|
-
return 'unknown';
|
|
2899
|
-
const buffer = Buffer.alloc(8193);
|
|
2900
|
-
const count = readSync(fd, buffer, 0, buffer.length, 0);
|
|
2901
|
-
const record = workerProcessRecordSchema.parse(JSON.parse(buffer.subarray(0, count).toString('utf8')));
|
|
2902
|
-
return record.generation === generation ? record : 'unknown';
|
|
2903
|
-
}
|
|
2904
|
-
finally {
|
|
2905
|
-
closeSync(fd);
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
catch (error) {
|
|
2909
|
-
return error.code === 'ENOENT' ? 'absent' : 'unknown';
|
|
2910
|
-
}
|
|
2911
|
-
}
|
|
2912
|
-
writeWorkerProcesses(id, record) {
|
|
2913
|
-
const path = this.processesPath(id, true);
|
|
2914
|
-
try {
|
|
2915
|
-
const existing = lstatSync(path);
|
|
2916
|
-
if (!existing.isFile() || existing.isSymbolicLink())
|
|
2917
|
-
throw new Error('Unsafe process record');
|
|
2918
|
-
}
|
|
2919
|
-
catch (error) {
|
|
2920
|
-
if (error.code !== 'ENOENT')
|
|
2921
|
-
throw error;
|
|
2922
|
-
}
|
|
2923
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
2924
|
-
const fd = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
2925
|
-
try {
|
|
2926
|
-
writeFileSync(fd, JSON.stringify(workerProcessRecordSchema.parse(record)));
|
|
2927
|
-
fsyncSync(fd);
|
|
2928
|
-
}
|
|
2929
|
-
finally {
|
|
2930
|
-
closeSync(fd);
|
|
2931
|
-
}
|
|
2932
|
-
try {
|
|
2933
|
-
renameSync(temporary, path);
|
|
2934
|
-
}
|
|
2935
|
-
finally {
|
|
2936
|
-
rmSync(temporary, { force: true });
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
/** Bound to the current generation. Past the cap the record never drops an entry: the
|
|
2940
|
-
* working-directory scan is the remaining evidence. */
|
|
2941
|
-
appendWorkerProcess(id, generation, pid, pgid) {
|
|
2942
|
-
const record = this.readWorkerProcesses(id, generation);
|
|
2943
|
-
if (typeof record === 'string' || this.readWorkerExecution(id)?.generation !== generation)
|
|
2944
|
-
return false;
|
|
2945
|
-
const entry = { pid, ...startToken(pid), ...(pgid === undefined ? {} : { pgid }) };
|
|
2946
|
-
if (record.processes.some(known => known.pid === entry.pid && known.startToken === entry.startToken))
|
|
2947
|
-
return true;
|
|
2948
|
-
if (record.processes.length >= WORKER_PROCESS_CAP)
|
|
2949
|
-
return false;
|
|
2950
|
-
this.writeWorkerProcesses(id, { ...record, processes: [...record.processes, entry] });
|
|
2951
|
-
return true;
|
|
2952
|
-
}
|
|
2953
|
-
commitWorkerExecutionComplete(id, generation) {
|
|
2954
|
-
const proof = this.readWorkerExecution(id);
|
|
2955
|
-
if (!proof || proof.generation !== generation)
|
|
2956
|
-
return false;
|
|
2957
|
-
if (proof.phase === 'queued' && this.peek(id)?.status !== 'cancelled')
|
|
2958
|
-
return false;
|
|
2959
|
-
try {
|
|
2960
|
-
const run = this.peek(id);
|
|
2961
|
-
if (run?.delegation?.role !== 'worker')
|
|
2962
|
-
return false;
|
|
2963
|
-
this.commitIndex(new Map([[id, run]]));
|
|
2964
|
-
if (this.readWorkerExecution(id)?.generation !== generation)
|
|
2965
|
-
return false;
|
|
2966
|
-
this.writeWorkerExecution(id, { generation, phase: 'complete',
|
|
2967
|
-
// Nothing abandons an execution any more (hearsay-tools/cezarion#889); keep a checkpoint that already was.
|
|
2968
|
-
...(proof.abandoned ? { abandoned: true } : {}),
|
|
2969
|
-
...(proof.phase === 'queued' || proof.neverMaterialized ? { neverMaterialized: true } : {}),
|
|
2970
|
-
...(!['queued', 'running', 'waiting'].includes(run.status) ? { scratchCleanup: {
|
|
2971
|
-
resourceId: run.delegation.workspace.resourceId, path: run.delegation.workspace.path
|
|
2972
|
-
} } : {}) });
|
|
2973
|
-
// The earlier index event cannot attest exit: subscribers must observe the
|
|
2974
|
-
// durable private proof before a terminal worker can satisfy a lifecycle wait.
|
|
2975
|
-
this.emit('run', this.peek(id));
|
|
2976
|
-
return true;
|
|
2977
|
-
}
|
|
2978
|
-
catch {
|
|
2979
|
-
return false;
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
/** Complete replacement evidence can stand in for absent child history, never for a present execution. */
|
|
2983
|
-
readDeletedWorkerResult(parentId, workerId) {
|
|
2984
|
-
if (this.hasRun(workerId))
|
|
2985
|
-
return undefined;
|
|
2986
|
-
const parent = this.peek(parentId);
|
|
2987
|
-
if (parent?.delegation?.role !== 'root' || parent.delegation.historyDeletion)
|
|
2988
|
-
return undefined;
|
|
2989
|
-
const deletion = parent.delegation.receipts.find(receipt => receipt.workerId === workerId)?.deletion;
|
|
2990
|
-
if (deletion?.phase !== 'complete')
|
|
2991
|
-
return undefined;
|
|
2992
|
-
const result = this.readWorkerResult(parentId, workerId);
|
|
2993
|
-
return result?.settled && ['review', 'done', 'failed', 'cancelled'].includes(result.status) &&
|
|
2994
|
-
result.cleanup === 'complete' && result.revision === deletion.revision &&
|
|
2995
|
-
result.workspace.resourceId === deletion.resourceId ? result : undefined;
|
|
2996
|
-
}
|
|
2997
|
-
/** A deleted child's receipt replaces the private proof only after the deletion checkpoint. */
|
|
2998
|
-
workerDeletionEvidence(id) {
|
|
2999
|
-
const child = this.peek(id);
|
|
3000
|
-
if (child?.delegation?.role !== 'worker' || child.delegation.workspace.ownerRunId !== id ||
|
|
3001
|
-
child.delegation.destroy?.phase !== 'complete' || child.delegation.destroy.remaining.length ||
|
|
3002
|
-
!['review', 'done', 'failed', 'cancelled'].includes(child.status))
|
|
3003
|
-
return false;
|
|
3004
|
-
return this.workerDeletionResult(id, child);
|
|
3005
|
-
}
|
|
3006
|
-
workerDeletionResult(id, child) {
|
|
3007
|
-
const parent = this.peek(child.delegation.parentRunId);
|
|
3008
|
-
if (parent?.delegation?.role !== 'root' || parent.delegation.historyDeletion)
|
|
3009
|
-
return false;
|
|
3010
|
-
const receipt = parent.delegation.receipts.find(entry => entry.workerId === id);
|
|
3011
|
-
const result = this.readWorkerResult(parent.id, id);
|
|
3012
|
-
if (!receipt || !result?.settled || result.cleanup !== 'complete' || result.status !== child.status ||
|
|
3013
|
-
result.revision !== (child.delegation.executionRevision ?? 0))
|
|
3014
|
-
return false;
|
|
3015
|
-
const { state: _state, ...workspace } = result.workspace;
|
|
3016
|
-
if (JSON.stringify(workspace) !== JSON.stringify(child.delegation.workspace))
|
|
3017
|
-
return false;
|
|
3018
|
-
return workerDeletionProof(receipt.deletion, result.revision, workspace.resourceId, {
|
|
3019
|
-
readProof: () => this.readWorkerExecution(id), resourcesSafe: generation => this.workerResourcesSafe(id, generation, workspace.resourceId),
|
|
3020
|
-
scratchMayExist: () => agentTmpDirMayExist(this.dataDir, id), executionExists: () => existsSync(this.executionPath(id)),
|
|
3021
|
-
});
|
|
3022
|
-
}
|
|
3023
|
-
canDeleteRun(id, kind = 'record') {
|
|
3024
|
-
if (this.fallbackDeleteError(id, kind))
|
|
3025
|
-
return false;
|
|
3026
|
-
if (autosaveCleanupBlocker(this.dataDir, id))
|
|
3027
|
-
return false;
|
|
3028
|
-
const run = this.peek(id);
|
|
3029
|
-
if (run?.delegation?.role === 'invalid')
|
|
3030
|
-
return false;
|
|
3031
|
-
if (run?.delegation?.role === 'worker')
|
|
3032
|
-
return this.workerDeletionEvidence(id);
|
|
3033
|
-
const privateWorkers = workerEvidenceRunIds(this.dataDir);
|
|
3034
|
-
if (!privateWorkers || privateWorkers.includes(id))
|
|
3035
|
-
return false;
|
|
3036
|
-
if (run?.delegation?.role === 'root') {
|
|
3037
|
-
if (run.delegation.finishRequestedAt && ['queued', 'running', 'waiting'].includes(run.status))
|
|
3038
|
-
return false;
|
|
3039
|
-
// Keep the parent's receipt and result ownership until each child history is explicitly removed.
|
|
3040
|
-
if (this.listWorkersOf(id).length > 0)
|
|
3041
|
-
return false;
|
|
3042
|
-
return run.delegation.receipts.every(receipt => {
|
|
3043
|
-
if (this.hasRun(receipt.workerId) || receipt.deletion?.phase !== 'complete')
|
|
3044
|
-
return false;
|
|
3045
|
-
// A pending parent deletion already validated the results before removing their bytes.
|
|
3046
|
-
if (run.delegation?.role === 'root' && run.delegation.historyDeletion === 'pending')
|
|
3047
|
-
return true;
|
|
3048
|
-
return this.readDeletedWorkerResult(id, receipt.workerId) !== undefined;
|
|
3049
|
-
});
|
|
3050
|
-
}
|
|
3051
|
-
return this.listWorkersOf(id).length === 0;
|
|
3052
|
-
}
|
|
3053
|
-
/** Delegated history deletion is synchronous and checkpointed; any failed byte/index removal remains retryable. */
|
|
3054
|
-
deleteDelegatedRun(id) {
|
|
3055
|
-
const run = this.peek(id);
|
|
3056
|
-
try {
|
|
3057
|
-
if (run.delegation?.role === 'worker') {
|
|
3058
|
-
const parent = this.peek(run.delegation.parentRunId);
|
|
3059
|
-
if (parent.delegation?.role !== 'root')
|
|
3060
|
-
return false;
|
|
3061
|
-
const receipt = parent.delegation.receipts.find(entry => entry.workerId === id);
|
|
3062
|
-
const result = this.readWorkerResult(parent.id, id);
|
|
3063
|
-
const deletion = receipt.deletion ?? { phase: 'pending', revision: result.revision,
|
|
3064
|
-
resourceId: run.delegation.workspace.resourceId, generation: this.readWorkerExecution(id).generation };
|
|
3065
|
-
this.commitDelegation([{ id: parent.id, delegation: { ...parent.delegation,
|
|
3066
|
-
receipts: parent.delegation.receipts.map(entry => entry.workerId === id ? { ...entry, deletion } : entry),
|
|
3067
|
-
} }]);
|
|
3068
|
-
// Do not advertise artifact bytes as retained while interrupted deletion is in progress.
|
|
3069
|
-
this.commitWorkerResult(parent.id, { ...result, observedAt: new Date().toISOString(),
|
|
3070
|
-
diff: result.diff.state === 'available' ? { ...result.diff, snapshotId: randomUUID() } : result.diff,
|
|
3071
|
-
artifacts: result.artifacts.state === 'available' ? { ...result.artifacts,
|
|
3072
|
-
items: result.artifacts.items.map(item => ({ state: 'unavailable', reason: 'unreadable',
|
|
3073
|
-
detail: 'History deletion is in progress', id: item.id, path: item.path })),
|
|
3074
|
-
} : result.artifacts,
|
|
3075
|
-
}, this.readWorkerResultDiff(parent.id, id));
|
|
3076
|
-
this.removeRunHistoryBytes(id);
|
|
3077
|
-
// Delete scratch while its generation evidence still exists; failed removal keeps it.
|
|
3078
|
-
removeAgentTmpDir(this.dataDir, id);
|
|
3079
|
-
if (agentTmpDirMayExist(this.dataDir, id))
|
|
3080
|
-
return false;
|
|
3081
|
-
// Private process/account evidence is now replaced by the exact parent receipt.
|
|
3082
|
-
rmSync(this.identityPath(id), { force: true });
|
|
3083
|
-
rmSync(this.processesPath(id), { force: true });
|
|
3084
|
-
rmSync(this.executionPath(id), { force: true });
|
|
3085
|
-
const retained = this.readWorkerResult(parent.id, id);
|
|
3086
|
-
this.commitWorkerResult(parent.id, { ...retained, observedAt: new Date().toISOString(),
|
|
3087
|
-
diff: retained.diff.state === 'available' ? { ...retained.diff, snapshotId: randomUUID() } : retained.diff,
|
|
3088
|
-
artifacts: retained.artifacts.state === 'available' ? { ...retained.artifacts,
|
|
3089
|
-
items: retained.artifacts.items.map(item => ({ state: 'deleted', reason: 'missing', id: item.id, path: item.path })),
|
|
3090
|
-
} : retained.artifacts,
|
|
3091
|
-
}, this.readWorkerResultDiff(parent.id, id));
|
|
3092
|
-
this.commitIndex(new Map([[parent.id, { ...parent, delegation: { ...parent.delegation,
|
|
3093
|
-
receipts: parent.delegation.receipts.map(entry => entry.workerId === id ? { ...entry, deletion: { ...deletion, phase: 'complete' } } : entry),
|
|
3094
|
-
} }], [id, null]]));
|
|
3095
|
-
}
|
|
3096
|
-
else if (run.delegation?.role === 'root') {
|
|
3097
|
-
this.commitDelegation([{ id, delegation: { ...run.delegation, historyDeletion: 'pending' } }]);
|
|
3098
|
-
this.removeRunHistoryBytes(id);
|
|
3099
|
-
rmSync(join(this.dataDir, 'runs', `${id}-worker-results`), { recursive: true, force: true });
|
|
3100
|
-
this.commitIndex(new Map([[id, null]]));
|
|
3101
|
-
}
|
|
3102
|
-
else
|
|
3103
|
-
return false;
|
|
3104
|
-
removeAgentTmpDir(this.dataDir, id);
|
|
3105
|
-
this.seqs.delete(id);
|
|
3106
|
-
return true;
|
|
3107
|
-
}
|
|
3108
|
-
catch {
|
|
3109
|
-
return false;
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
|
-
removeRunHistoryBytes(id) {
|
|
3113
|
-
// Fixed owned paths only: never follow context descriptors supplied in persisted metadata.
|
|
3114
|
-
z.uuid().parse(id);
|
|
3115
|
-
const dir = join(this.dataDir, 'runs');
|
|
3116
|
-
if (realpathSync(dir) !== resolve(dir))
|
|
3117
|
-
throw new Error('History storage redirected');
|
|
3118
|
-
this.facts.forget(id);
|
|
3119
|
-
removeHistory(this.dataDir, id);
|
|
3120
|
-
rmSync(this.handoffPath(id), { force: true });
|
|
3121
|
-
rmSync(this.imagesDir(id), { recursive: true, force: true });
|
|
3122
|
-
removeArtifacts(this.dataDir, id);
|
|
3123
|
-
clearAutosaveCleanup(this.dataDir, id);
|
|
3124
|
-
}
|
|
3125
|
-
deleteRun(id) {
|
|
3126
|
-
const refusal = this.fallbackDeleteError(id);
|
|
3127
|
-
if (refusal)
|
|
3128
|
-
throw new Error(refusal);
|
|
3129
|
-
if (!this.canDeleteRun(id))
|
|
3130
|
-
return false;
|
|
3131
|
-
const run = this.peek(id);
|
|
3132
|
-
if (run && this.db && (this.quarantined.has(id) || !this.claimFamilies([familyKey(run)]).size))
|
|
3133
|
-
return false;
|
|
3134
|
-
if (run?.delegation?.role === 'worker' || run?.delegation?.role === 'root')
|
|
3135
|
-
return this.deleteDelegatedRun(id);
|
|
3136
|
-
if (run)
|
|
3137
|
-
clearAutosaveCleanup(this.dataDir, id);
|
|
3138
|
-
const existed = run !== undefined;
|
|
3139
|
-
this.held.delete(id);
|
|
3140
|
-
if (existed) {
|
|
3141
|
-
this.markDeleted(id, familyKey(run));
|
|
3142
|
-
removeAgentTmpDir(this.dataDir, id);
|
|
3143
|
-
this.seqs.delete(id);
|
|
3144
|
-
this.scheduleSave();
|
|
3145
|
-
this.emit('deleted', id);
|
|
3146
|
-
}
|
|
3147
|
-
return existed;
|
|
3148
|
-
}
|
|
3149
|
-
/** Write the pending rows out now (used on shutdown). */
|
|
3150
|
-
flush() {
|
|
3151
|
-
if (this.saveTimer) {
|
|
3152
|
-
clearTimeout(this.saveTimer);
|
|
3153
|
-
this.saveTimer = null;
|
|
3154
|
-
}
|
|
3155
|
-
this.saveNow();
|
|
3156
|
-
}
|
|
3157
825
|
// ---- internals -----------------------------------------------------------
|
|
3158
826
|
seqs = new Map();
|
|
3159
|
-
nextSeq(runId) {
|
|
3160
|
-
const next = (this.seqs.get(runId) ?? this.rehydrateSeq(runId)) + 1;
|
|
3161
|
-
this.seqs.set(runId, next);
|
|
3162
|
-
return next;
|
|
3163
|
-
}
|
|
3164
|
-
/** After a restart the in-memory counter is empty while the run's NDJSON file
|
|
3165
|
-
* keeps the history. Restarting from 1 would collide with the seqs a client
|
|
3166
|
-
* already replayed — its `seq > maxSeq` dedup then silently drops every
|
|
3167
|
-
* resumed event, even across a reload (the frozen-transcript symptom class
|
|
3168
|
-
* of #424). One file read on the first post-restart append per run. */
|
|
3169
|
-
rehydrateSeq(runId) {
|
|
3170
|
-
return this.transcriptFacts(runId).lastSeq;
|
|
3171
|
-
}
|
|
3172
|
-
eventsPath(runId) {
|
|
3173
|
-
return historyPaths(this.sourceDataDir(runId), runId).plain;
|
|
3174
|
-
}
|
|
3175
|
-
/** Same location `handoffPath()` in handoff.ts produces — inlined to keep
|
|
3176
|
-
* the store free of upward imports. */
|
|
3177
|
-
handoffPath(runId) {
|
|
3178
|
-
return join(this.sourceDataDir(runId), 'runs', `${runId}.handoff.md`);
|
|
3179
|
-
}
|
|
3180
|
-
/** Agent screenshots persisted by the run manager (see persistImage). */
|
|
3181
|
-
imagesDir(runId) {
|
|
3182
|
-
return join(this.sourceDataDir(runId), 'runs', `${runId}-images`);
|
|
3183
|
-
}
|
|
3184
|
-
touch(run) {
|
|
3185
|
-
this.dirty.add(run.id);
|
|
3186
|
-
this.scheduleSave();
|
|
3187
|
-
this.emit('run', run);
|
|
3188
|
-
this.maybeEnqueueHistoryCompress(run);
|
|
3189
|
-
}
|
|
3190
|
-
/** Form follows archived: a terminal archived run with a plain transcript is queued again. */
|
|
3191
|
-
maybeEnqueueHistoryCompress(run) {
|
|
3192
|
-
if (run.archived && !isLiveStatus(run.status) && hasPlainHistory(this.dataDir, run.id)) {
|
|
3193
|
-
this.compressor.enqueue(run.id);
|
|
3194
|
-
}
|
|
3195
|
-
}
|
|
3196
|
-
/** The held record is gone; the next save or commit deletes its row, fenced by `family`'s claim
|
|
3197
|
-
* and by the revision this store last saw (kept in `base` until the delete is written). */
|
|
3198
|
-
markDeleted(id, family) {
|
|
3199
|
-
this.liveItems.forget(id);
|
|
3200
|
-
this.coldReads.forget(id);
|
|
3201
|
-
const read = this.coldBase.get(id);
|
|
3202
|
-
if (!this.base.has(id) && read)
|
|
3203
|
-
this.base.set(id, storedRow(read));
|
|
3204
|
-
this.dirty.delete(id);
|
|
3205
|
-
this.deleted.add(id);
|
|
3206
|
-
this.deletedFamilies.set(id, family);
|
|
3207
|
-
this.historyOwed.add(id);
|
|
3208
|
-
}
|
|
3209
|
-
/** A deleted run's history files, once the delete of its row has committed. Best effort, as
|
|
3210
|
-
* deletion always was. */
|
|
3211
|
-
removeOwedHistory(id) {
|
|
3212
|
-
if (!this.historyOwed.delete(id))
|
|
3213
|
-
return;
|
|
3214
|
-
try {
|
|
3215
|
-
this.facts.forget(id);
|
|
3216
|
-
removeHistory(this.dataDir, id);
|
|
3217
|
-
rmSync(this.handoffPath(id), { force: true });
|
|
3218
|
-
rmSync(this.imagesDir(id), { recursive: true, force: true });
|
|
3219
|
-
removeArtifacts(this.dataDir, id);
|
|
3220
|
-
}
|
|
3221
|
-
catch { /* best effort */ }
|
|
3222
|
-
}
|
|
3223
|
-
/**
|
|
3224
|
-
* Count-based history retention: of the runs past the newest `MAX_RUNS_KEPT` unarchived ones,
|
|
3225
|
-
* archive each finished run without delegation that is not pinned and whose family this store
|
|
3226
|
-
* can claim. Ranked over the row keys (the `created_at` index, no record decoded) with memory
|
|
3227
|
-
* laid over them, since a run created or archived since the last save has no row yet; the rows
|
|
3228
|
-
* past the cut are then filtered in `runs.db`, so only real candidates decode. Archived runs
|
|
3229
|
-
* are never deleted by retention — only an explicit delete, worker destruction, or history
|
|
3230
|
-
* deletion removes a run.
|
|
3231
|
-
*/
|
|
3232
|
-
pruneOldRuns() {
|
|
3233
|
-
const ranked = new Map();
|
|
3234
|
-
for (const key of this.db?.listKeysWhere('archived = ?', [0]) ?? []) {
|
|
3235
|
-
if (!this.held.has(key.id) && !this.deleted.has(key.id))
|
|
3236
|
-
ranked.set(key.id, key);
|
|
3237
|
-
}
|
|
3238
|
-
for (const run of this.held.values())
|
|
3239
|
-
if (!run.archived)
|
|
3240
|
-
ranked.set(run.id, { id: run.id, ...this.listOrder(run) });
|
|
3241
|
-
const overflow = [...ranked.values()].sort(newestFirst).slice(MAX_RUNS_KEPT).map((key) => key.id);
|
|
3242
|
-
if (overflow.length === 0)
|
|
3243
|
-
return;
|
|
3244
|
-
const stale = overflow.flatMap((id) => {
|
|
3245
|
-
const run = this.held.get(id);
|
|
3246
|
-
// Retention must not archive a live task between turns, a pinned run, or a delegation
|
|
3247
|
-
// family whose history is promised until explicit deletion.
|
|
3248
|
-
return run && !this.hasFallbackRun(id) && RETENTION_RUN_RULE.matches(run) ? [id] : [];
|
|
3249
|
-
});
|
|
3250
|
-
const skipped = overflow.filter(id => this.hasFallbackRun(id)).length;
|
|
3251
|
-
if (skipped)
|
|
3252
|
-
console.info(`${logPrefix()} Retention skipped ${skipped} read-only fallback run(s) under ${dataReadDirs(this.dataDir)[1]}.`);
|
|
3253
|
-
const cold = overflow.filter((id) => !this.held.has(id) && !this.hasFallbackRun(id));
|
|
3254
|
-
if (cold.length > 0) {
|
|
3255
|
-
// Another process's runs are its own to keep or archive (#779, plan step 3).
|
|
3256
|
-
const rows = this.db.listWhere(RETENTION_RUN_RULE.sql, [JSON.stringify(cold)]);
|
|
3257
|
-
const writable = this.claimFamilies(rows.map(rowFamily));
|
|
3258
|
-
for (const row of rows)
|
|
3259
|
-
if (writable.has(rowFamily(row)))
|
|
3260
|
-
stale.push(row.id);
|
|
3261
|
-
}
|
|
3262
|
-
for (const id of stale) {
|
|
3263
|
-
const run = this.record(id);
|
|
3264
|
-
if (!run || run.archived || !RETENTION_RUN_RULE.matches(run))
|
|
3265
|
-
continue;
|
|
3266
|
-
this.applyArchived(run, true);
|
|
3267
|
-
removeAgentTmpDir(this.dataDir, id);
|
|
3268
|
-
}
|
|
3269
|
-
}
|
|
3270
|
-
/** Debounced so token-usage updates don't rewrite a row per event. Nothing to schedule without
|
|
3271
|
-
* a database: a `RunStore.unavailable` store, or a closed one, writes nothing. */
|
|
3272
|
-
scheduleSave() {
|
|
3273
|
-
if (this.saveTimer || !this.db)
|
|
3274
|
-
return;
|
|
3275
|
-
this.saveTimer = setTimeout(() => {
|
|
3276
|
-
this.saveTimer = null;
|
|
3277
|
-
this.saveNow();
|
|
3278
|
-
}, 300);
|
|
3279
|
-
this.saveTimer.unref?.();
|
|
3280
|
-
}
|
|
3281
|
-
/** The single database write, so a test can fail it the way a full disk would. */
|
|
3282
|
-
writeIndex(changes) {
|
|
3283
|
-
const transaction = (changes) => { assertProjectWritable(this.dataDir); return this.db.transaction(changes); };
|
|
3284
|
-
return this.persistence ? this.persistence(changes, transaction) : transaction(changes);
|
|
3285
|
-
}
|
|
3286
|
-
/**
|
|
3287
|
-
* Write `staged` plus everything still pending — dirty rows from memory, deletions — in one
|
|
3288
|
-
* transaction, then clear the pending marks. Throws with nothing cleared when it fails.
|
|
3289
|
-
* Never copies or sorts the whole store: the cost is the rows that changed.
|
|
3290
|
-
*
|
|
3291
|
-
* Fenced (#779, plan step 3): the transaction commits only if every family it writes still
|
|
3292
|
-
* carries this store's claim and every row is at the revision this store last saw. Otherwise
|
|
3293
|
-
* nothing is written and `handleConflicts` deals with the rows that changed under it.
|
|
3294
|
-
*/
|
|
3295
|
-
persist(staged) {
|
|
3296
|
-
const upserts = [];
|
|
3297
|
-
const deletes = [];
|
|
3298
|
-
const families = new Map();
|
|
3299
|
-
const extras = new Map();
|
|
3300
|
-
const encode = (run) => {
|
|
3301
|
-
const encoded = encodeRawRecord(run, (this.base.get(run.id) ?? this.coldBase.get(run.id))?.extras);
|
|
3302
|
-
extras.set(run.id, encoded.extras);
|
|
3303
|
-
const projected = { ...run };
|
|
3304
|
-
restoreOriginatingIssue(projected);
|
|
3305
|
-
upserts.push({ ...encodeRunRow(run, encoded.data),
|
|
3306
|
-
issueAttributionCurrent: isDeepStrictEqual(projected, run) });
|
|
3307
|
-
};
|
|
3308
|
-
for (const [id, next] of staged) {
|
|
3309
|
-
if (next)
|
|
3310
|
-
encode(next);
|
|
3311
|
-
else
|
|
3312
|
-
deletes.push(id);
|
|
3313
|
-
families.set(id, next ? familyKey(next) : this.familyOf(id));
|
|
3314
|
-
}
|
|
3315
|
-
for (const id of this.dirty) {
|
|
3316
|
-
const run = this.held.get(id);
|
|
3317
|
-
if (!run || staged.has(id))
|
|
3318
|
-
continue;
|
|
3319
|
-
encode(run);
|
|
3320
|
-
families.set(id, familyKey(run));
|
|
3321
|
-
}
|
|
3322
|
-
for (const id of this.deleted) {
|
|
3323
|
-
if (staged.has(id))
|
|
3324
|
-
continue;
|
|
3325
|
-
deletes.push(id);
|
|
3326
|
-
families.set(id, this.familyOf(id));
|
|
3327
|
-
}
|
|
3328
|
-
// A row's insertion order (`seq`) is the order this write inserts it in, and it is where the
|
|
3329
|
-
// run lists among runs created in the same millisecond. Insert new runs in creation order (the
|
|
3330
|
-
// held set's, then staged runs not held yet), whether staged or dirty brought them here.
|
|
3331
|
-
if (upserts.filter((row) => !this.base.has(row.id)).length > 1) {
|
|
3332
|
-
const created = new Map();
|
|
3333
|
-
for (const id of [...this.held.keys(), ...staged.keys()])
|
|
3334
|
-
if (!created.has(id))
|
|
3335
|
-
created.set(id, created.size);
|
|
3336
|
-
upserts.sort((a, b) => created.get(a.id) - created.get(b.id));
|
|
3337
|
-
}
|
|
3338
|
-
// A held run whose write moved it into a new family (a worker quarantined to `invalid`) takes
|
|
3339
|
-
// that family's claim first; one it cannot take fails the fence below as claim-lost.
|
|
3340
|
-
const moved = [...new Set(families.values())].filter((family) => !this.claimed.has(family) && !this.pendingClaims.has(family));
|
|
3341
|
-
if (moved.length > 0)
|
|
3342
|
-
this.claimFamilies(moved, { allowLive: true });
|
|
3343
|
-
let commit;
|
|
3344
|
-
try {
|
|
3345
|
-
commit = this.writeIndex({ upserts, deletes, ...(this.owner ? { fence: this.fence(families) } : {}) });
|
|
3346
|
-
}
|
|
3347
|
-
catch (error) {
|
|
3348
|
-
if (error instanceof RunConflictError)
|
|
3349
|
-
this.handleConflicts(error, staged);
|
|
3350
|
-
throw error;
|
|
3351
|
-
}
|
|
3352
|
-
for (const [family, generation] of commit.claims) {
|
|
3353
|
-
this.claimed.set(family, generation);
|
|
3354
|
-
this.pendingClaims.delete(family);
|
|
3355
|
-
}
|
|
3356
|
-
for (const row of upserts) {
|
|
3357
|
-
this.base.set(row.id, { revision: commit.revisions.get(row.id), seq: commit.seqs.get(row.id), data: row.data, extras: extras.get(row.id) });
|
|
3358
|
-
}
|
|
3359
|
-
for (const id of deletes) {
|
|
3360
|
-
this.liveItems.forget(id);
|
|
3361
|
-
this.base.delete(id);
|
|
3362
|
-
this.deletedFamilies.delete(id);
|
|
3363
|
-
this.removeOwedHistory(id);
|
|
3364
|
-
}
|
|
3365
|
-
this.dirty.clear();
|
|
3366
|
-
this.deleted.clear();
|
|
3367
|
-
if (this.saveTimer) {
|
|
3368
|
-
clearTimeout(this.saveTimer);
|
|
3369
|
-
this.saveTimer = null;
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
/** What a write of these rows (id → family) must still find: this store's claims, at the
|
|
3373
|
-
* generations it took them, and each row at the revision it last saw (none for a new row). */
|
|
3374
|
-
fence(families) {
|
|
3375
|
-
const claims = new Map();
|
|
3376
|
-
const rows = new Map();
|
|
3377
|
-
for (const [id, family] of families) {
|
|
3378
|
-
const pending = this.pendingClaims.get(family);
|
|
3379
|
-
// Generations start at 1, so an unclaimed family's 0 fails the fence as claim-lost.
|
|
3380
|
-
claims.set(family, pending !== undefined ? { take: pending } : { generation: this.claimed.get(family) ?? 0 });
|
|
3381
|
-
rows.set(id, { revision: (this.base.get(id) ?? this.coldBase.get(id))?.revision ?? null, family });
|
|
3382
|
-
}
|
|
3383
|
-
return { owner: this.owner, claims, rows };
|
|
3384
|
-
}
|
|
3385
|
-
/**
|
|
3386
|
-
* Handle a fenced-write conflict. Save unexpected conflict evidence before clearing pending
|
|
3387
|
-
* state or quarantining the row. If evidence persistence fails, retain pending writes. Other
|
|
3388
|
-
* rows remain writable; stale unclaimed reads only fail their write.
|
|
3389
|
-
*/
|
|
3390
|
-
handleConflicts(error, staged) {
|
|
3391
|
-
const unexpected = error.conflicts.filter((conflict) => this.held.has(conflict.id) || this.deleted.has(conflict.id) || this.coldBase.get(conflict.id)?.owned === true);
|
|
3392
|
-
if (unexpected.length === 0 || !this.db || !this.owner)
|
|
3393
|
-
return;
|
|
3394
|
-
const evidence = unexpected.map((conflict) => {
|
|
3395
|
-
const seen = this.base.get(conflict.id) ?? this.coldBase.get(conflict.id);
|
|
3396
|
-
const local = staged.has(conflict.id) ? staged.get(conflict.id) : this.deleted.has(conflict.id) ? null : this.held.get(conflict.id) ?? null;
|
|
3397
|
-
return {
|
|
3398
|
-
runId: conflict.id, reason: conflict.reason,
|
|
3399
|
-
baseRevision: seen?.revision ?? null, baseData: seen?.data ?? null,
|
|
3400
|
-
localData: local === null ? null : JSON.stringify(local), localDeleted: local === null,
|
|
3401
|
-
currentRevision: conflict.current?.revision ?? null, currentData: conflict.current?.data ?? null,
|
|
3402
|
-
};
|
|
3403
|
-
});
|
|
3404
|
-
let seqs;
|
|
3405
|
-
try {
|
|
3406
|
-
seqs = this.db.recordConflicts(this.owner.session, evidence);
|
|
3407
|
-
}
|
|
3408
|
-
catch (evidenceError) {
|
|
3409
|
-
const message = evidenceError instanceof Error ? evidenceError.message : String(evidenceError);
|
|
3410
|
-
console.error(`${logPrefix()} ${RUNS_DB_FILE}: could not record the conflicting write on ${unexpected.map((c) => c.id).join(', ')}; it stays pending: ${message}`);
|
|
3411
|
-
return;
|
|
3412
|
-
}
|
|
3413
|
-
unexpected.forEach((conflict, index) => {
|
|
3414
|
-
const family = this.familyOf(conflict.id);
|
|
3415
|
-
this.liveItems.forget(conflict.id);
|
|
3416
|
-
this.quarantined.add(conflict.id);
|
|
3417
|
-
this.coldReads.forget(conflict.id);
|
|
3418
|
-
this.dirty.delete(conflict.id);
|
|
3419
|
-
this.deleted.delete(conflict.id);
|
|
3420
|
-
this.deletedFamilies.delete(conflict.id);
|
|
3421
|
-
// The delete did not happen, so the history stays with the row.
|
|
3422
|
-
this.historyOwed.delete(conflict.id);
|
|
3423
|
-
if (conflict.reason === 'claim-lost') {
|
|
3424
|
-
this.claimed.delete(family);
|
|
3425
|
-
this.pendingClaims.delete(family);
|
|
3426
|
-
}
|
|
3427
|
-
const decoded = conflict.current ? decodeRunRow(conflict.current.data) : undefined;
|
|
3428
|
-
const current = decoded?.run;
|
|
3429
|
-
if (this.isFallbackRun(conflict.id))
|
|
3430
|
-
this.held.delete(conflict.id);
|
|
3431
|
-
const held = this.held.get(conflict.id);
|
|
3432
|
-
if (current && conflict.current) {
|
|
3433
|
-
// The other writer's record as it stands, normalized only as a live owner's run would be.
|
|
3434
|
-
reconcileLoadedRun(current, { keepLive: true });
|
|
3435
|
-
rescopeRun(current, this.repoHandle);
|
|
3436
|
-
if (held)
|
|
3437
|
-
replaceRecord(held, current);
|
|
3438
|
-
this.base.set(conflict.id, { revision: conflict.current.revision, seq: conflict.current.seq, data: conflict.current.data, extras: decoded.extras });
|
|
3439
|
-
this.emit('run', held ?? current);
|
|
3440
|
-
}
|
|
3441
|
-
else {
|
|
3442
|
-
this.held.delete(conflict.id);
|
|
3443
|
-
this.base.delete(conflict.id);
|
|
3444
|
-
this.emit('deleted', conflict.id);
|
|
3445
|
-
}
|
|
3446
|
-
console.error(`${logPrefix()} run ${conflict.id} was changed by another writer (${conflict.reason}); this process will not write it again until ${productName('cezar')} restarts. Evidence: ${join(this.dataDir, RUNS_DB_FILE)}, table run_conflicts, seq ${seqs[index]}.`);
|
|
3447
|
-
});
|
|
3448
|
-
this.scheduleSave();
|
|
3449
|
-
}
|
|
3450
|
-
/** Write what is pending, then (unless closing) let every run whose write settled leave memory. */
|
|
3451
|
-
saveNow(evict = true) {
|
|
3452
|
-
if (!this.db || projectWriteRefused(this.dataDir))
|
|
3453
|
-
return;
|
|
3454
|
-
// A second attempt only after a conflict excluded its rows: the unrelated rest goes out at once.
|
|
3455
|
-
for (let attempt = 0; attempt < 2 && (this.dirty.size > 0 || this.deleted.size > 0); attempt++) {
|
|
3456
|
-
const quarantined = this.quarantined.size;
|
|
3457
|
-
try {
|
|
3458
|
-
this.persist(new Map());
|
|
3459
|
-
}
|
|
3460
|
-
catch (err) {
|
|
3461
|
-
if (err instanceof RunConflictError && this.quarantined.size > quarantined)
|
|
3462
|
-
continue;
|
|
3463
|
-
// A pending save may outlive its directory; never recreate it or hide live-directory
|
|
3464
|
-
// failures. The rows stay pending (and held), so the next save or commit retries them.
|
|
3465
|
-
if (existsSync(this.dataDir)) {
|
|
3466
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
3467
|
-
console.error(`${logPrefix()} failed to save ${RUNS_DB_FILE}: ${message}`);
|
|
3468
|
-
}
|
|
3469
|
-
break;
|
|
3470
|
-
}
|
|
3471
|
-
}
|
|
3472
|
-
if (evict)
|
|
3473
|
-
this.evictSettled();
|
|
3474
|
-
}
|
|
3475
827
|
/**
|
|
3476
828
|
* Write what is pending and release the database (store disposal, process shutdown).
|
|
3477
829
|
* Idempotent. A closed store keeps answering reads for what it holds — the final save evicts
|
|
@@ -3481,16 +833,13 @@ export class RunStore extends EventEmitter {
|
|
|
3481
833
|
close() {
|
|
3482
834
|
this.liveItems.clear();
|
|
3483
835
|
// Demand-bound feeds stop before storage disappears during project removal/shutdown.
|
|
3484
|
-
this.
|
|
3485
|
-
this.
|
|
3486
|
-
|
|
3487
|
-
this.
|
|
3488
|
-
this.
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
this.saveTimer = null;
|
|
3492
|
-
}
|
|
3493
|
-
this.saveNow(false);
|
|
836
|
+
this.published.publish('store.closed', {});
|
|
837
|
+
for (const unsubscribe of this.listenerHandles.splice(0))
|
|
838
|
+
unsubscribe();
|
|
839
|
+
this.archive.compressor.stop();
|
|
840
|
+
this.transcriptFacts.stop();
|
|
841
|
+
this.persistence.closeSave();
|
|
842
|
+
this.claims.flushHealMeta();
|
|
3494
843
|
if (this.db && this.owner) {
|
|
3495
844
|
// Every claim goes with the store. Should the release fail, the claims stay until this
|
|
3496
845
|
// process exits; from then on they are provably dead and the next opener takes them.
|
|
@@ -3507,10 +856,4 @@ export class RunStore extends EventEmitter {
|
|
|
3507
856
|
this.db = null;
|
|
3508
857
|
}
|
|
3509
858
|
}
|
|
3510
|
-
function archiveDigest(value) {
|
|
3511
|
-
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
3512
|
-
}
|
|
3513
|
-
function archiveFields(run, archived, now) {
|
|
3514
|
-
stageArchiveFields(run, archived, now);
|
|
3515
|
-
}
|
|
3516
859
|
//# sourceMappingURL=store.js.map
|