pi-better-server 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -3
- package/scripts/copy-pi-test-providers.mjs +10 -0
- package/scripts/event-publication/README.md +26 -0
- package/scripts/event-publication/commit.mjs +21 -0
- package/scripts/event-publication/measure.mjs +37 -5
- package/scripts/event-publication/writer.mjs +3 -8
- package/scripts/measure-full-runtime/frontend.ts +10 -2
- package/scripts/measure-full-runtime/probe.mjs +4 -2
- package/scripts/measure-full-runtime/recovery-trace-loader.mjs +51 -0
- package/scripts/measure-full-runtime/recovery-trace.mjs +16 -0
- package/scripts/measure-full-runtime.mjs +2 -0
- package/scripts/measure-shared-reads.mjs +2 -1
- package/scripts/private-runtime/package-lock.json +18 -0
- package/scripts/private-runtime/package.json +4 -1
- package/scripts/source-provenance.mjs +2 -2
- package/scripts/test-on-pi.sh +2 -9
- package/src/handshake.ts +1 -1
- package/src/hosted-session.ts +32 -4
- package/src/maintenance.ts +35 -7
- package/src/registry.ts +28 -4
- package/src/runtime/attempt-invalidation.ts +54 -0
- package/src/runtime/background-history.ts +151 -45
- package/src/runtime/background-policy.ts +9 -4
- package/src/runtime/background-tools.ts +181 -27
- package/src/runtime/background.ts +365 -70
- package/src/runtime/cancellation.ts +28 -7
- package/src/runtime/catalog-sources.ts +199 -0
- package/src/runtime/catalog.ts +53 -21
- package/src/runtime/client.ts +22 -2
- package/src/runtime/domain/assignment-inbox.mjs +119 -0
- package/src/runtime/domain/assignment-observation.d.mts +1 -1
- package/src/runtime/domain/assignment-observation.mjs +43 -35
- package/src/runtime/domain/background/process-identity.mjs +20 -2
- package/src/runtime/domain/background/process.mjs +52 -14
- package/src/runtime/domain/background/registry.mjs +61 -3
- package/src/runtime/domain/background/supervisor/store.mjs +3 -3
- package/src/runtime/domain/background/supervisor/supervisor.mjs +9 -3
- package/src/runtime/domain/background/types.mjs +1 -0
- package/src/runtime/domain/background-service/adapter-contract.domain.mjs +1 -1
- package/src/runtime/domain/background-service/adapter-contract.ts +1 -1
- package/src/runtime/domain/background-service/goal-provider.domain.mjs +35 -16
- package/src/runtime/domain/background-service/goal-provider.ts +31 -16
- package/src/runtime/domain/background-service/index.domain.mjs +25 -9
- package/src/runtime/domain/background-service/index.ts +25 -9
- package/src/runtime/domain/background-service/managed-authority.domain.mjs +6 -3
- package/src/runtime/domain/background-service/managed-authority.ts +5 -3
- package/src/runtime/domain/background-service/managed-client.domain.mjs +21 -7
- package/src/runtime/domain/background-service/managed-client.ts +20 -7
- package/src/runtime/domain/background-service/managed-frontend.domain.mjs +159 -19
- package/src/runtime/domain/background-service/managed-frontend.ts +135 -19
- package/src/runtime/domain/background-service/navigator-provider.domain.mjs +21 -5
- package/src/runtime/domain/background-service/navigator-provider.ts +19 -5
- package/src/runtime/domain/background-service/observed-wait-client.domain.mjs +6 -0
- package/src/runtime/domain/background-service/observed-wait-client.ts +10 -0
- package/src/runtime/domain/background-service/observed-waits.domain.mjs +372 -57
- package/src/runtime/domain/background-service/observed-waits.ts +321 -53
- package/src/runtime/domain/background-service/process-identity.domain.mjs +20 -2
- package/src/runtime/domain/background-service/process-identity.ts +18 -2
- package/src/runtime/domain/background-service/process.domain.mjs +52 -14
- package/src/runtime/domain/background-service/process.ts +48 -14
- package/src/runtime/domain/background-service/registry.domain.mjs +61 -3
- package/src/runtime/domain/background-service/registry.ts +53 -5
- package/src/runtime/domain/background-service/review-settings.domain.mjs +16 -0
- package/src/runtime/domain/background-service/review-settings.ts +18 -0
- package/src/runtime/domain/background-service/runtime.domain.mjs +40 -86
- package/src/runtime/domain/background-service/runtime.ts +27 -82
- package/src/runtime/domain/background-service/sandbox.domain.mjs +14 -15
- package/src/runtime/domain/background-service/sandbox.ts +14 -11
- package/src/runtime/domain/background-service/shared-callback-batcher.domain.mjs +8 -1
- package/src/runtime/domain/background-service/shared-callback-batcher.ts +11 -2
- package/src/runtime/domain/background-service/shared-navigator-panels.domain.mjs +24 -2
- package/src/runtime/domain/background-service/shared-navigator-panels.ts +26 -4
- package/src/runtime/domain/background-service/shared-navigator.domain.mjs +273 -41
- package/src/runtime/domain/background-service/shared-navigator.ts +244 -40
- package/src/runtime/domain/background-service/shared-operation-coordinator/assignment-inbox.mjs +144 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/assignment-observation.mjs +53 -41
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/assignment-changes.domain.mjs +75 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/assignment-changes.ts +73 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/assignment-outcomes.domain.mjs +2 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/assignment-outcomes.ts +2 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/background-requests.domain.mjs +11 -2
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/background-requests.ts +14 -3
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/discovery.domain.mjs +4 -2
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/discovery.ts +5 -3
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/operations.domain.mjs +44 -4
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/operations.ts +50 -2
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/outbox.domain.mjs +7 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/outbox.ts +9 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/result-supervision.domain.mjs +12 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/result-supervision.ts +12 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/rows.domain.mjs +2 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/rows.ts +2 -0
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/schema.domain.mjs +42 -21
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/schema.ts +40 -24
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/store.domain.mjs +26 -4
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/store.ts +40 -8
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/subagent-launch.domain.mjs +23 -1
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/subagent-launch.ts +24 -1
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/types.domain.mjs +1 -1
- package/src/runtime/domain/background-service/shared-operation-coordinator/src/types.ts +5 -1
- package/src/runtime/domain/background-service/shared-sandbox-core.ts +1 -1
- package/src/runtime/domain/background-service/shared-work-client.mjs +174 -7
- package/src/runtime/domain/background-service/stall.domain.mjs +5 -3
- package/src/runtime/domain/background-service/stall.ts +7 -4
- package/src/runtime/domain/background-service/supervised-progress.domain.mjs +42 -0
- package/src/runtime/domain/background-service/supervised-progress.ts +43 -0
- package/src/runtime/domain/background-service/supervisor/README.md +1 -4
- package/src/runtime/domain/background-service/supervisor/emit-runner.mjs +1 -0
- package/src/runtime/domain/background-service/supervisor/generated/process-identity.mjs +20 -2
- package/src/runtime/domain/background-service/supervisor/generated/process.mjs +52 -14
- package/src/runtime/domain/background-service/supervisor/generated/runner.mjs +47 -4
- package/src/runtime/domain/background-service/supervisor/generated/store.mjs +3 -3
- package/src/runtime/domain/background-service/supervisor/generated/watch-fingerprint.mjs +69 -0
- package/src/runtime/domain/background-service/supervisor/runner.domain.mjs +47 -4
- package/src/runtime/domain/background-service/supervisor/runner.ts +38 -3
- package/src/runtime/domain/background-service/supervisor/store.domain.mjs +3 -3
- package/src/runtime/domain/background-service/supervisor/store.ts +3 -3
- package/src/runtime/domain/background-service/supervisor/supervisor.domain.mjs +9 -3
- package/src/runtime/domain/background-service/supervisor/supervisor.ts +6 -3
- package/src/runtime/domain/background-service/task-diagnostics.domain.mjs +1 -1
- package/src/runtime/domain/background-service/task-diagnostics.ts +1 -1
- package/src/runtime/domain/background-service/tools.domain.mjs +53 -40
- package/src/runtime/domain/background-service/tools.ts +67 -54
- package/src/runtime/domain/background-service/types.domain.mjs +1 -0
- package/src/runtime/domain/background-service/types.ts +7 -3
- package/src/runtime/domain/background-service/watch-fingerprint.domain.mjs +67 -0
- package/src/runtime/domain/background-service/watch-fingerprint.ts +70 -0
- package/src/runtime/domain/background-service/work-observation.domain.mjs +46 -20
- package/src/runtime/domain/background-service/work-observation.ts +46 -19
- package/src/runtime/domain/catalog/catalog-store.d.mts +9 -1
- package/src/runtime/domain/catalog/catalog-store.mjs +20 -22
- package/src/runtime/domain/coordinator/src/assignment-changes.mjs +75 -0
- package/src/runtime/domain/coordinator/src/assignment-outcomes.mjs +2 -0
- package/src/runtime/domain/coordinator/src/background-requests.mjs +11 -2
- package/src/runtime/domain/coordinator/src/discovery.mjs +4 -2
- package/src/runtime/domain/coordinator/src/operations.mjs +44 -4
- package/src/runtime/domain/coordinator/src/outbox.mjs +7 -0
- package/src/runtime/domain/coordinator/src/result-supervision.mjs +12 -0
- package/src/runtime/domain/coordinator/src/rows.mjs +2 -0
- package/src/runtime/domain/coordinator/src/schema.mjs +42 -21
- package/src/runtime/domain/coordinator/src/store.mjs +26 -4
- package/src/runtime/domain/coordinator/src/subagent-launch.mjs +23 -1
- package/src/runtime/domain/coordinator/src/types.mjs +1 -1
- package/src/runtime/domain/health-observation.d.mts +3 -1
- package/src/runtime/domain/health-observation.mjs +189 -190
- package/src/runtime/domain/log-cursor.d.mts +2 -0
- package/src/runtime/domain/log-cursor.mjs +85 -16
- package/src/runtime/domain/log-paths.mjs +8 -1
- package/src/runtime/domain/parse.d.mts +4 -1
- package/src/runtime/domain/parse.mjs +58 -9
- package/src/runtime/domain/sandbox-policy/README.md +63 -65
- package/src/runtime/domain/sandbox-policy/commands.domain.mjs +11 -8
- package/src/runtime/domain/sandbox-policy/commands.ts +12 -7
- package/src/runtime/domain/sandbox-policy/index.domain.mjs +53 -9
- package/src/runtime/domain/sandbox-policy/index.ts +52 -9
- package/src/runtime/domain/sandbox-policy/package.json +1 -1
- package/src/runtime/domain/sandbox-policy/permission-settings.domain.mjs +5 -2
- package/src/runtime/domain/sandbox-policy/permission-settings.ts +9 -2
- package/src/runtime/domain/sandbox-policy/permissions-page.domain.mjs +56 -137
- package/src/runtime/domain/sandbox-policy/permissions-page.ts +52 -130
- package/src/runtime/domain/sandbox-policy/permissions.domain.mjs +1 -6
- package/src/runtime/domain/sandbox-policy/permissions.ts +1 -6
- package/src/runtime/domain/sandbox-policy/shared-sandbox-core.ts +1 -1
- package/src/runtime/domain/sandbox-policy/shared-task-exec.domain.mjs +14 -1
- package/src/runtime/domain/sandbox-policy/shared-task-exec.ts +12 -1
- package/src/runtime/domain/sandbox-policy/shared-task-process-identity.domain.mjs +140 -0
- package/src/runtime/domain/sandbox-policy/shared-task-process-identity.ts +126 -0
- package/src/runtime/domain/sandbox-policy/shared-task-process-list.domain.mjs +3 -2
- package/src/runtime/domain/sandbox-policy/shared-task-process-list.ts +8 -2
- package/src/runtime/domain/sandbox-policy/shared-task-sandbox.domain.mjs +4 -3
- package/src/runtime/domain/sandbox-policy/shared-task-sandbox.ts +5 -3
- package/src/runtime/domain/sandbox-policy/shared-task-tools.domain.mjs +8 -5
- package/src/runtime/domain/sandbox-policy/shared-task-tools.ts +8 -5
- package/src/runtime/domain/session-store.mjs +7 -0
- package/src/runtime/domain/subagents/README.md +13 -11
- package/src/runtime/domain/subagents/assignment-outcomes.domain.mjs +10 -7
- package/src/runtime/domain/subagents/assignment-outcomes.ts +9 -6
- package/src/runtime/domain/subagents/assignment-report.domain.mjs +109 -24
- package/src/runtime/domain/subagents/assignment-report.ts +103 -19
- package/src/runtime/domain/subagents/batch.mjs +13 -5
- package/src/runtime/domain/subagents/catalog-host-admission.domain.mjs +21 -3
- package/src/runtime/domain/subagents/catalog-host-admission.ts +19 -3
- package/src/runtime/domain/subagents/catalog-preferences.ts +1 -1
- package/src/runtime/domain/subagents/catalog-resolver.domain.mjs +35 -1
- package/src/runtime/domain/subagents/catalog-resolver.ts +35 -1
- package/src/runtime/domain/subagents/catalog-store.domain.mjs +20 -22
- package/src/runtime/domain/subagents/catalog-store.ts +27 -20
- package/src/runtime/domain/subagents/child-apply-patch.domain.mjs +13 -0
- package/src/runtime/domain/subagents/child-apply-patch.ts +13 -0
- package/src/runtime/domain/subagents/child-dependencies.mjs +27 -15
- package/src/runtime/domain/subagents/child-operations.domain.mjs +80 -2
- package/src/runtime/domain/subagents/child-operations.ts +80 -1
- package/src/runtime/domain/subagents/child-preflight.mjs +9 -2
- package/src/runtime/domain/subagents/child-process-list.domain.mjs +7 -0
- package/src/runtime/domain/subagents/child-process-list.ts +8 -0
- package/src/runtime/domain/subagents/cleanup.domain.mjs +11 -2
- package/src/runtime/domain/subagents/cleanup.ts +10 -2
- package/src/runtime/domain/subagents/config.domain.mjs +54 -2
- package/src/runtime/domain/subagents/config.ts +53 -3
- package/src/runtime/domain/subagents/continuation-authority.domain.mjs +5 -1
- package/src/runtime/domain/subagents/continuation-authority.ts +3 -1
- package/src/runtime/domain/subagents/continuation-runtime.domain.mjs +89 -0
- package/src/runtime/domain/subagents/continuation-runtime.ts +88 -0
- package/src/runtime/domain/subagents/continuation.domain.mjs +4 -2
- package/src/runtime/domain/subagents/continuation.ts +4 -2
- package/src/runtime/domain/subagents/extensions.mjs +11 -13
- package/src/runtime/domain/subagents/failures.domain.mjs +11 -2
- package/src/runtime/domain/subagents/failures.ts +10 -2
- package/src/runtime/domain/subagents/finalization.domain.mjs +16 -1
- package/src/runtime/domain/subagents/finalization.ts +21 -1
- package/src/runtime/domain/subagents/goal-provider.domain.mjs +44 -2
- package/src/runtime/domain/subagents/goal-provider.ts +44 -2
- package/src/runtime/domain/subagents/health-observation.domain.mjs +189 -190
- package/src/runtime/domain/subagents/health-observation.ts +43 -48
- package/src/runtime/domain/subagents/index.domain.mjs +457 -182
- package/src/runtime/domain/subagents/index.ts +417 -155
- package/src/runtime/domain/subagents/isolated-workspace.domain.mjs +515 -0
- package/src/runtime/domain/subagents/isolated-workspace.ts +557 -0
- package/src/runtime/domain/subagents/launch-context.domain.mjs +24 -0
- package/src/runtime/domain/subagents/launch-context.ts +23 -0
- package/src/runtime/domain/subagents/launch-digest.mjs +6 -0
- package/src/runtime/domain/subagents/list.mjs +2 -2
- package/src/runtime/domain/subagents/log-cursor.domain.mjs +85 -16
- package/src/runtime/domain/subagents/log-cursor.ts +91 -15
- package/src/runtime/domain/subagents/managed-launch-bootstrap.mjs +2 -2
- package/src/runtime/domain/subagents/managed-launch-client.domain.mjs +27 -7
- package/src/runtime/domain/subagents/managed-launch-client.ts +28 -8
- package/src/runtime/domain/subagents/managed-launch-host.domain.mjs +222 -14
- package/src/runtime/domain/subagents/managed-launch-host.ts +168 -15
- package/src/runtime/domain/subagents/managed-launch-journal.mjs +1 -5
- package/src/runtime/domain/subagents/managed-launch-port.ts +4 -0
- package/src/runtime/domain/subagents/operation-bridge-types.domain.mjs +27 -2
- package/src/runtime/domain/subagents/operation-bridge-types.ts +27 -2
- package/src/runtime/domain/subagents/output-payload.domain.mjs +24 -9
- package/src/runtime/domain/subagents/output-payload.ts +26 -12
- package/src/runtime/domain/subagents/owned-exit.domain.mjs +12 -0
- package/src/runtime/domain/subagents/owned-exit.ts +12 -0
- package/src/runtime/domain/subagents/package.json +4 -2
- package/src/runtime/domain/subagents/parse.domain.mjs +58 -9
- package/src/runtime/domain/subagents/parse.ts +57 -10
- package/src/runtime/domain/subagents/permission-policy.domain.mjs +32 -8
- package/src/runtime/domain/subagents/permission-policy.ts +41 -8
- package/src/runtime/domain/subagents/process-identity.mjs +33 -0
- package/src/runtime/domain/subagents/registry.domain.mjs +71 -51
- package/src/runtime/domain/subagents/registry.ts +77 -38
- package/src/runtime/domain/subagents/retained-result.domain.mjs +56 -0
- package/src/runtime/domain/subagents/retained-result.ts +65 -0
- package/src/runtime/domain/subagents/session-selection.domain.mjs +3 -1
- package/src/runtime/domain/subagents/session-selection.ts +2 -1
- package/src/runtime/domain/subagents/session-store.domain.mjs +7 -0
- package/src/runtime/domain/subagents/session-store.ts +9 -0
- package/src/runtime/domain/subagents/settings-page.domain.mjs +151 -107
- package/src/runtime/domain/subagents/settings-page.ts +147 -108
- package/src/runtime/domain/subagents/shared-callback-batcher.domain.mjs +8 -1
- package/src/runtime/domain/subagents/shared-callback-batcher.ts +11 -2
- package/src/runtime/domain/subagents/shared-catalog.domain.mjs +28 -29
- package/src/runtime/domain/subagents/shared-catalog.ts +29 -21
- package/src/runtime/domain/subagents/shared-navigator-panels.domain.mjs +24 -2
- package/src/runtime/domain/subagents/shared-navigator-panels.ts +26 -4
- package/src/runtime/domain/subagents/shared-navigator.domain.mjs +273 -41
- package/src/runtime/domain/subagents/shared-navigator.ts +244 -40
- package/src/runtime/domain/subagents/shared-operation-coordinator/assignment-inbox.mjs +144 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/assignment-observation.mjs +53 -41
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/assignment-changes.domain.mjs +75 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/assignment-changes.ts +73 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/assignment-outcomes.domain.mjs +2 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/assignment-outcomes.ts +2 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/background-requests.domain.mjs +11 -2
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/background-requests.ts +14 -3
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/discovery.domain.mjs +4 -2
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/discovery.ts +5 -3
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/operations.domain.mjs +44 -4
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/operations.ts +50 -2
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/outbox.domain.mjs +7 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/outbox.ts +9 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/result-supervision.domain.mjs +12 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/result-supervision.ts +12 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/rows.domain.mjs +2 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/rows.ts +2 -0
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/schema.domain.mjs +42 -21
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/schema.ts +40 -24
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/store.domain.mjs +26 -4
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/store.ts +40 -8
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/subagent-launch.domain.mjs +23 -1
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/subagent-launch.ts +24 -1
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/types.domain.mjs +1 -1
- package/src/runtime/domain/subagents/shared-operation-coordinator/src/types.ts +5 -1
- package/src/runtime/domain/subagents/shared-sandbox-core.ts +1 -1
- package/src/runtime/domain/subagents/shared-task-exec.domain.mjs +14 -1
- package/src/runtime/domain/subagents/shared-task-exec.ts +12 -1
- package/src/runtime/domain/subagents/shared-task-process-identity.domain.mjs +140 -0
- package/src/runtime/domain/subagents/shared-task-process-identity.ts +126 -0
- package/src/runtime/domain/subagents/shared-task-process-list.domain.mjs +3 -2
- package/src/runtime/domain/subagents/shared-task-process-list.ts +8 -2
- package/src/runtime/domain/subagents/shared-task-sandbox.domain.mjs +4 -3
- package/src/runtime/domain/subagents/shared-task-sandbox.ts +5 -3
- package/src/runtime/domain/subagents/shared-task-tools.domain.mjs +8 -5
- package/src/runtime/domain/subagents/shared-task-tools.ts +8 -5
- package/src/runtime/domain/subagents/shared-work-client.mjs +174 -7
- package/src/runtime/domain/subagents/subagent-tools.domain.mjs +22 -38
- package/src/runtime/domain/subagents/subagent-tools.ts +28 -34
- package/src/runtime/domain/subagents/task-guard.domain.mjs +14 -1
- package/src/runtime/domain/subagents/task-guard.ts +13 -1
- package/src/runtime/domain/subagents/task-policy.domain.mjs +3 -2
- package/src/runtime/domain/subagents/task-policy.ts +8 -2
- package/src/runtime/domain/subagents/timing.domain.mjs +10 -1
- package/src/runtime/domain/subagents/timing.ts +10 -1
- package/src/runtime/domain/subagents/tools.domain.mjs +4 -8
- package/src/runtime/domain/subagents/tools.ts +4 -7
- package/src/runtime/domain/subagents/work-observation.domain.mjs +102 -17
- package/src/runtime/domain/subagents/work-observation.ts +91 -17
- package/src/runtime/domain/subagents/worker-operations-host.domain.mjs +9 -4
- package/src/runtime/domain/subagents/worker-operations-host.ts +12 -4
- package/src/runtime/domain/subagents/worker-waits.domain.mjs +89 -35
- package/src/runtime/domain/subagents/worker-waits.ts +93 -34
- package/src/runtime/domain/subagents/workspace-files.domain.mjs +103 -0
- package/src/runtime/domain/subagents/workspace-files.ts +114 -0
- package/src/runtime/domain/subagents/workspace-scope.domain.d.mts +38 -0
- package/src/runtime/domain/subagents/workspace-scope.domain.mjs +5 -0
- package/src/runtime/domain/subagents/workspace-scope.ts +6 -0
- package/src/runtime/domain/subagents/worktree-feedback.domain.mjs +55 -0
- package/src/runtime/domain/subagents/worktree-feedback.ts +77 -0
- package/src/runtime/health-config.ts +27 -11
- package/src/runtime/log-checkpoints.ts +117 -0
- package/src/runtime/mutation-store.ts +5 -4
- package/src/runtime/queries.ts +25 -2
- package/src/runtime/query-executor.ts +149 -28
- package/src/runtime/query-worker.mjs +106 -21
- package/src/runtime/read-model.ts +849 -121
- package/src/runtime/read-watchdog-probe.ts +4 -0
- package/src/runtime/result-supervision.ts +188 -16
- package/src/runtime/root.ts +5 -2
- package/src/runtime/source-watch.ts +175 -0
- package/src/runtime/subagent-launch.ts +11 -4
- package/src/runtime/work-budget.ts +130 -0
- package/src/runtime/work-client.d.mts +8 -0
- package/src/runtime/work-client.mjs +150 -7
- package/src/server.ts +104 -23
- package/src/session-activity.ts +26 -4
- package/src/version.ts +1 -1
|
@@ -464,13 +464,19 @@ class Supervisor {
|
|
|
464
464
|
}
|
|
465
465
|
applyReconciliation(launch, options) {
|
|
466
466
|
return withStateFence(this.directory, launch.taskId, () => {
|
|
467
|
-
const result = readTerminalRecord(this.directory, launch.taskId)
|
|
467
|
+
const { value: result, error: resultError } = readTerminalRecord(this.directory, launch.taskId);
|
|
468
|
+
if (resultError)
|
|
469
|
+
throw new Error(`Unreadable supervisor result record for ${launch.taskId}: ${resultError}`);
|
|
468
470
|
if (result)
|
|
469
471
|
return { status: result.status, terminal: true, result };
|
|
470
|
-
const existingLost = readLostRecord(this.directory, launch.taskId)
|
|
472
|
+
const { value: existingLost, error: lostError } = readLostRecord(this.directory, launch.taskId);
|
|
473
|
+
if (lostError)
|
|
474
|
+
throw new Error(`Unreadable supervisor loss record for ${launch.taskId}: ${lostError}`);
|
|
471
475
|
if (existingLost)
|
|
472
476
|
return { status: "lost", terminal: true, lost: existingLost };
|
|
473
|
-
const claim = readClaimRecord(this.directory, launch.taskId)
|
|
477
|
+
const { value: claim, error: claimError } = readClaimRecord(this.directory, launch.taskId);
|
|
478
|
+
if (claimError)
|
|
479
|
+
throw new Error(`Unreadable supervisor claim record for ${launch.taskId}: ${claimError}`);
|
|
474
480
|
if (claim) {
|
|
475
481
|
if (identityAlive(claim.pid, claim.pidStartTime, claim.claimedAt, this.readToken)) {
|
|
476
482
|
return { status: "running", terminal: false };
|
|
@@ -527,13 +527,16 @@ class Supervisor implements LocalSupervisor {
|
|
|
527
527
|
options: SupervisorInspectOptions,
|
|
528
528
|
): { status: SupervisorTaskStatus; terminal: boolean; result?: SupervisorTerminalRecord; lost?: SupervisorLostRecord } {
|
|
529
529
|
return withStateFence(this.directory, launch.taskId, () => {
|
|
530
|
-
const result = readTerminalRecord(this.directory, launch.taskId)
|
|
530
|
+
const { value: result, error: resultError } = readTerminalRecord(this.directory, launch.taskId);
|
|
531
|
+
if (resultError) throw new Error(`Unreadable supervisor result record for ${launch.taskId}: ${resultError}`);
|
|
531
532
|
if (result) return { status: result.status as SupervisorTaskStatus, terminal: true, result };
|
|
532
533
|
|
|
533
|
-
const existingLost = readLostRecord(this.directory, launch.taskId)
|
|
534
|
+
const { value: existingLost, error: lostError } = readLostRecord(this.directory, launch.taskId);
|
|
535
|
+
if (lostError) throw new Error(`Unreadable supervisor loss record for ${launch.taskId}: ${lostError}`);
|
|
534
536
|
if (existingLost) return { status: "lost" as const, terminal: true, lost: existingLost };
|
|
535
537
|
|
|
536
|
-
const claim = readClaimRecord(this.directory, launch.taskId)
|
|
538
|
+
const { value: claim, error: claimError } = readClaimRecord(this.directory, launch.taskId);
|
|
539
|
+
if (claimError) throw new Error(`Unreadable supervisor claim record for ${launch.taskId}: ${claimError}`);
|
|
537
540
|
if (claim) {
|
|
538
541
|
if (identityAlive(claim.pid, claim.pidStartTime, claim.claimedAt, this.readToken)) {
|
|
539
542
|
return { status: "running" as const, terminal: false };
|
|
@@ -33,7 +33,7 @@ export function inspectTaskProcess(meta, access, probe = sampleProcess) {
|
|
|
33
33
|
return unavailable("Process activity adapter is unavailable under Main confinement; no unconfined process probe was run. Process access Read does not bypass kernel rules.");
|
|
34
34
|
if (access !== "read")
|
|
35
35
|
return { availability: "blocked", reason: access === "off"
|
|
36
|
-
? "
|
|
36
|
+
? "An active Main or Background tasks profile denies process reads. Check Process access in /sandbox; this does not describe task confinement."
|
|
37
37
|
: "Current process-access policy is unavailable; no process probe was run.", limit: LIMIT };
|
|
38
38
|
if (meta.ssh)
|
|
39
39
|
return unavailable("Remote activity is unavailable; no remote diagnostic command was run.");
|
|
@@ -52,7 +52,7 @@ export function inspectTaskProcess(
|
|
|
52
52
|
({ availability: "unavailable", reason, ...(identity ? { identity } : {}), limit: LIMIT });
|
|
53
53
|
if (access === "confined") return unavailable("Process activity adapter is unavailable under Main confinement; no unconfined process probe was run. Process access Read does not bypass kernel rules.");
|
|
54
54
|
if (access !== "read") return { availability: "blocked", reason: access === "off"
|
|
55
|
-
? "
|
|
55
|
+
? "An active Main or Background tasks profile denies process reads. Check Process access in /sandbox; this does not describe task confinement."
|
|
56
56
|
: "Current process-access policy is unavailable; no process probe was run.", limit: LIMIT };
|
|
57
57
|
if (meta.ssh) return unavailable("Remote activity is unavailable; no remote diagnostic command was run.");
|
|
58
58
|
if (meta.kind !== "process") return unavailable("Watch poll PID is not retained; last completed check is progress evidence only.");
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
// Generated fixed launch domain from packages/pi-better-background-tasks/src/tools.ts. Do not edit directly.
|
|
2
2
|
import { Type } from "typebox";
|
|
3
|
+
import { truncateToWidth as piTruncateToWidth, visibleWidth as piVisibleWidth, wrapTextWithAnsi as piWrapTextWithAnsi, } from "@earendil-works/pi-tui";
|
|
3
4
|
import { advertiseBackgroundAdapter } from "./adapter-contract.domain.mjs";
|
|
4
|
-
import { formatBatchLaunch, spawnTaskBatch } from "./batch.domain.mjs";
|
|
5
5
|
import { refreshBackgroundTasksNavigator } from "./navigator-provider.domain.mjs";
|
|
6
6
|
import { classifyOwnership, formatLaunch, formatList, formatLog, formatMissingTask, formatMutationRefusal, formatStatus, formatDurableStatusMetadata, formatStopResult, } from "./output.domain.mjs";
|
|
7
7
|
import { cursorKind, readOutputControls } from "./shared-log-utils.domain.mjs";
|
|
8
8
|
import { cancelCallbackBatch, getCallbackBatcher, setCallbackBatchContext } from "./shared-callback-batcher.domain.mjs";
|
|
9
9
|
import { registerDeliveryObserver } from "./delivery-observer.domain.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import { backgroundObservation } from "./work-observation.domain.mjs";
|
|
10
|
+
import { getObservedWaitHost } from "./observed-wait-client.domain.mjs";
|
|
11
|
+
import { backgroundListNeedsHistory, backgroundObservation } from "./work-observation.domain.mjs";
|
|
12
12
|
import { inspectMeta, listMetasForOrigin, readMeta, writeMeta } from "./registry.domain.mjs";
|
|
13
|
-
import { awaitFirstWatchCheck, FIRST_WATCH_CHECK_WAIT_MS, resumeRunningTask, spawnTask, startWatchTask, stopTask } from "./runtime.domain.mjs";
|
|
14
|
-
import { runTaskMaintenance } from "./maintenance.domain.mjs";
|
|
15
13
|
import { backgroundProcessDiagnosticsAccess, ForegroundSandboxBlockedError } from "./sandbox.domain.mjs";
|
|
16
14
|
import { inspectTaskProcess } from "./task-diagnostics.domain.mjs";
|
|
17
|
-
import { isTerminalStatus } from "./types.domain.mjs";
|
|
15
|
+
import { FIRST_WATCH_CHECK_WAIT_MS, isTerminalStatus } from "./types.domain.mjs";
|
|
18
16
|
export { formatLaunch } from "./output.domain.mjs";
|
|
19
|
-
const defaultRuntime = { awaitFirstWatchCheck, resumeRunningTask, spawnTask, startWatchTask, stopTask };
|
|
20
17
|
const JsonPathSchema = Type.String({
|
|
21
18
|
pattern: "^\\$",
|
|
22
19
|
description: "Root-prefixed JSON path, e.g. $.status, $.terminalFailure, or $.steps[0].status. Bare keys and wildcards are unsupported.",
|
|
@@ -136,7 +133,7 @@ const IdParams = Type.Object({
|
|
|
136
133
|
...CursorFields,
|
|
137
134
|
});
|
|
138
135
|
const HistoryField = {
|
|
139
|
-
diagnostics: Type.Optional(Type.Boolean({ description: "For status: sample registered task process identity, CPU time, state and wait evidence. Requires
|
|
136
|
+
diagnostics: Type.Optional(Type.Boolean({ description: "For status: sample registered task process identity, CPU time, state and wait evidence. Requires Process access Read in each enabled sandbox profile (Main and Background tasks); unavailable under Main confinement. No arguments, environment or remote probes; a snapshot cannot prove useful work or a hang." })),
|
|
140
137
|
history: Type.Optional(Type.Boolean({ description: "If true, return an incident page that also lists failure history: expected failures and recovered or superseded incidents. Default output lists only failures that need action and counts the rest." })),
|
|
141
138
|
};
|
|
142
139
|
const StatusParams = Type.Object({
|
|
@@ -247,8 +244,7 @@ const BACKGROUND_ORCHESTRATION_GUIDELINES = [
|
|
|
247
244
|
"When a structured plan is active, keep it as the coordinator ledger: launch relevant background work early, continue unblocked foreground work without polling, and update the plan after inspecting each terminal result or failure.",
|
|
248
245
|
"Do not treat launch as completion of the parent milestone; relevant background work must be terminal, inspected, and integrated before verification or completion.",
|
|
249
246
|
];
|
|
250
|
-
export function registerTools(pi, runtime
|
|
251
|
-
const { resumeRunningTask, spawnTask } = runtime;
|
|
247
|
+
export function registerTools(pi, runtime, refreshNavigator = refreshBackgroundTasksNavigator, options = {}) {
|
|
252
248
|
let activeSession;
|
|
253
249
|
const getActiveSession = () => activeSession;
|
|
254
250
|
const schemas = new Map();
|
|
@@ -263,6 +259,8 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
263
259
|
setCallbackBatchContext(pi, ctx);
|
|
264
260
|
activeSession = getCallbackOrigin(ctx);
|
|
265
261
|
if (options.resumeLocal !== false) {
|
|
262
|
+
const { resumeRunningTask } = runtime ?? await import("./runtime.domain.mjs");
|
|
263
|
+
const { runTaskMaintenance } = await import("./maintenance.domain.mjs");
|
|
266
264
|
for (const meta of listMetasForOrigin(activeSession)) {
|
|
267
265
|
if (meta.status === "running" || (meta.callback !== false && !meta.callbackSentAt && !meta.callbackSuppressedAt)) {
|
|
268
266
|
resumeRunningTask(pi, meta, getActiveSession);
|
|
@@ -306,6 +304,7 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
306
304
|
refreshNavigator(ctx);
|
|
307
305
|
return text(durable, launchReceipt(receipt));
|
|
308
306
|
}
|
|
307
|
+
const { spawnTask } = runtime ?? await import("./runtime.domain.mjs");
|
|
309
308
|
const launched = reportLaunch(() => spawnTask(pi, params, ctx.cwd, origin, getActiveSession));
|
|
310
309
|
refreshNavigator(ctx);
|
|
311
310
|
return text(launched);
|
|
@@ -319,6 +318,7 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
319
318
|
parameters: BatchParams,
|
|
320
319
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
321
320
|
activeSession = getCallbackOrigin(ctx);
|
|
321
|
+
const { formatBatchLaunch, spawnTaskBatch } = await import("./batch.domain.mjs");
|
|
322
322
|
const launched = spawnTaskBatch(pi, params, ctx.cwd, activeSession, getActiveSession, {}, runtime);
|
|
323
323
|
refreshNavigator(ctx);
|
|
324
324
|
return text(formatBatchLaunch(launched), launched);
|
|
@@ -398,7 +398,7 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
398
398
|
refreshNavigator(ctx);
|
|
399
399
|
return text(durable);
|
|
400
400
|
}
|
|
401
|
-
const result = await formatStop(pi, params.id, ctx, getActiveSession, statusOptions(params, origin), runtime);
|
|
401
|
+
const result = await formatStop(pi, params.id, ctx, getActiveSession, statusOptions(params, origin), runtime ?? await import("./runtime.domain.mjs"));
|
|
402
402
|
refreshNavigator(ctx);
|
|
403
403
|
return text(result);
|
|
404
404
|
},
|
|
@@ -414,7 +414,7 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
414
414
|
},
|
|
415
415
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
416
416
|
activeSession = getCallbackOrigin(ctx);
|
|
417
|
-
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, signal, runtime, refreshNavigator);
|
|
417
|
+
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, signal, runtime ?? await import("./runtime.domain.mjs"), refreshNavigator);
|
|
418
418
|
},
|
|
419
419
|
});
|
|
420
420
|
register({
|
|
@@ -427,7 +427,7 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
427
427
|
},
|
|
428
428
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
429
429
|
activeSession = getCallbackOrigin(ctx);
|
|
430
|
-
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, undefined, runtime, refreshNavigator);
|
|
430
|
+
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, undefined, runtime ?? await import("./runtime.domain.mjs"), refreshNavigator);
|
|
431
431
|
},
|
|
432
432
|
});
|
|
433
433
|
register({
|
|
@@ -442,14 +442,14 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
442
442
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
443
443
|
const host = getObservedWaitHost(pi);
|
|
444
444
|
if (!host?.available) {
|
|
445
|
-
return text(observedWaitServiceUnavailableReason(pi)
|
|
445
|
+
return text((await import("./observed-waits.domain.mjs")).observedWaitServiceUnavailableReason(pi)
|
|
446
446
|
?? "Observed waits are unavailable in this session; inspect tasks directly and continue without a durable wait.");
|
|
447
447
|
}
|
|
448
448
|
try {
|
|
449
449
|
const wait = host.usesServerResults
|
|
450
450
|
? await host.superviseParentWait(ctx, params.task_ids, params.continuation_note)
|
|
451
451
|
: host.waitForParent(ctx, params.task_ids, params.continuation_note);
|
|
452
|
-
return text(formatWaitView(wait), wait);
|
|
452
|
+
return text((await import("./observed-waits.domain.mjs")).formatWaitView(wait), wait);
|
|
453
453
|
}
|
|
454
454
|
catch (error) {
|
|
455
455
|
return text(`Wait was not registered: ${readableError(error)}`);
|
|
@@ -464,7 +464,7 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
464
464
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
465
465
|
const host = getObservedWaitHost(pi);
|
|
466
466
|
if (!host?.available) {
|
|
467
|
-
return text(observedWaitServiceUnavailableReason(pi)
|
|
467
|
+
return text((await import("./observed-waits.domain.mjs")).observedWaitServiceUnavailableReason(pi)
|
|
468
468
|
?? "Observed waits are unavailable in this session; no wait was consumed.");
|
|
469
469
|
}
|
|
470
470
|
try {
|
|
@@ -513,6 +513,7 @@ export function registerTools(pi, runtime = defaultRuntime, refreshNavigator = r
|
|
|
513
513
|
const waits = host.listWaitsForParent(ctx, { pendingOnly: params.pending_only === true });
|
|
514
514
|
if (waits.length === 0)
|
|
515
515
|
return text("No durable waits for this session.");
|
|
516
|
+
const { formatWaitView } = await import("./observed-waits.domain.mjs");
|
|
516
517
|
return text(waits.map((wait) => formatWaitView(wait)).join("\n\n"), waits);
|
|
517
518
|
}
|
|
518
519
|
catch (error) {
|
|
@@ -669,13 +670,19 @@ async function runAction(pi, params, ctx, callbackOrigin, getActiveSession, sign
|
|
|
669
670
|
return `Unknown action: ${String(params.action)}`;
|
|
670
671
|
}
|
|
671
672
|
}
|
|
672
|
-
/**
|
|
673
|
+
/** Ordinary lists reuse retained activity; explicit filtered/paged lists open history. */
|
|
673
674
|
async function durableAwareList(pi, params, origin, ctx) {
|
|
674
675
|
const options = listOptions(params, origin);
|
|
675
|
-
const
|
|
676
|
+
const history = backgroundListNeedsHistory(params);
|
|
677
|
+
const snapshot = origin && !unavailableSessionOrigins.has(origin) ? await backgroundObservation(pi, ctx, history, params.all === true, { limit: options.limit, statuses: options.statuses, cursor: options.cursor }) : undefined;
|
|
676
678
|
if (snapshot && snapshot.status !== "ready")
|
|
677
679
|
throw new Error(snapshot.reason ?? "Background activity is unverified");
|
|
678
|
-
const
|
|
680
|
+
const index = snapshot?.backgroundIndex ?? (snapshot ? { records: snapshot.rows
|
|
681
|
+
.map((row) => ({ found: true, meta: row.meta.durable ? { ...row.meta,
|
|
682
|
+
callbackOrigin: { cwd: row.meta.owner.workspace, sessionId: row.meta.owner.sessionId },
|
|
683
|
+
logPath: row.meta.logPaths?.stdout ?? "" } : row.meta }))
|
|
684
|
+
.sort((a, b) => b.meta.startedAt - a.meta.startedAt || b.meta.id.localeCompare(a.meta.id)) } : undefined);
|
|
685
|
+
const legacy = formatList(options, index);
|
|
679
686
|
if (snapshot)
|
|
680
687
|
return legacy;
|
|
681
688
|
const host = getObservedWaitHost(pi);
|
|
@@ -833,8 +840,8 @@ function reportLaunch(launch) {
|
|
|
833
840
|
* Start a watch and wait, bounded by `waitMs`, for its first check, so the launch result
|
|
834
841
|
* shows what the check really prints (#359). Local and SSH watches share this path.
|
|
835
842
|
*/
|
|
836
|
-
export async function launchWatch(pi, params, cwd, callbackOrigin, getActiveSession, waitMs = FIRST_WATCH_CHECK_WAIT_MS, signal, runtime
|
|
837
|
-
const { startWatchTask, awaitFirstWatchCheck } = runtime;
|
|
843
|
+
export async function launchWatch(pi, params, cwd, callbackOrigin, getActiveSession, waitMs = FIRST_WATCH_CHECK_WAIT_MS, signal, runtime) {
|
|
844
|
+
const { startWatchTask, awaitFirstWatchCheck } = runtime ?? await import("./runtime.domain.mjs");
|
|
838
845
|
let meta;
|
|
839
846
|
try {
|
|
840
847
|
meta = startWatchTask(pi, params, cwd, callbackOrigin, getActiveSession);
|
|
@@ -863,7 +870,8 @@ function getCallbackOrigin(ctx) {
|
|
|
863
870
|
sessionId = undefined;
|
|
864
871
|
unavailable = true;
|
|
865
872
|
}
|
|
866
|
-
const origin = { cwd: ctx?.cwd ?? "", sessionId
|
|
873
|
+
const origin = { cwd: ctx?.cwd ?? "", sessionId,
|
|
874
|
+
branchId: ctx?.sessionManager?.getLeafId?.() ?? null };
|
|
867
875
|
if (unavailable)
|
|
868
876
|
unavailableSessionOrigins.add(origin);
|
|
869
877
|
return origin;
|
|
@@ -944,32 +952,37 @@ function renderLines(lines, mode = "truncate") {
|
|
|
944
952
|
invalidate() { },
|
|
945
953
|
};
|
|
946
954
|
}
|
|
955
|
+
/**
|
|
956
|
+
* Split one display line into rows of at most `width` terminal columns.
|
|
957
|
+
*
|
|
958
|
+
* Measures columns rather than characters: a CJK grapheme or emoji occupies two,
|
|
959
|
+
* so counting characters emitted rows wider than the width Pi asked for. Pi
|
|
960
|
+
* asserts every rendered line fits the terminal and exits the process when one
|
|
961
|
+
* does not, which turned any log holding double-width text into a crash that
|
|
962
|
+
* replayed on resume, because the tool result stays in session history.
|
|
963
|
+
*/
|
|
947
964
|
function wrapLineToVisibleWidth(line, width) {
|
|
948
965
|
const str = String(line ?? "");
|
|
949
966
|
const max = Math.max(1, Number(width) || 80);
|
|
950
|
-
if (
|
|
967
|
+
if (piVisibleWidth(str) <= max)
|
|
951
968
|
return [str];
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
let visible = 0;
|
|
955
|
-
for (const char of str) {
|
|
956
|
-
if (visible >= max) {
|
|
957
|
-
out.push(current);
|
|
958
|
-
current = "";
|
|
959
|
-
visible = 0;
|
|
960
|
-
}
|
|
961
|
-
current += char;
|
|
962
|
-
visible += 1;
|
|
963
|
-
}
|
|
964
|
-
out.push(current);
|
|
965
|
-
return out;
|
|
969
|
+
const wrapped = piWrapTextWithAnsi(str, max);
|
|
970
|
+
return (wrapped.length > 0 ? wrapped : [str]).map((row) => fitToVisibleWidth(row, max));
|
|
966
971
|
}
|
|
967
972
|
function truncateToVisibleWidth(value, width) {
|
|
968
973
|
const max = Math.max(0, Math.floor(width || 0));
|
|
969
|
-
return String(value ?? "")
|
|
974
|
+
return fitToVisibleWidth(String(value ?? ""), max);
|
|
975
|
+
}
|
|
976
|
+
/** Last resort for anything a wrap missed: never return a line wider than `max`. */
|
|
977
|
+
function fitToVisibleWidth(value, max) {
|
|
978
|
+
const str = String(value ?? "");
|
|
979
|
+
const limit = Math.max(0, Math.floor(max || 0));
|
|
980
|
+
if (piVisibleWidth(str) <= limit)
|
|
981
|
+
return str;
|
|
982
|
+
return piTruncateToWidth(str, limit, "");
|
|
970
983
|
}
|
|
971
|
-
async function formatStop(pi, id, _ctx, getActiveSession, options = {}, runtime
|
|
972
|
-
const { stopTask } = runtime;
|
|
984
|
+
async function formatStop(pi, id, _ctx, getActiveSession, options = {}, runtime) {
|
|
985
|
+
const { stopTask } = runtime ?? await import("./runtime.domain.mjs");
|
|
973
986
|
const existing = inspectMeta(id);
|
|
974
987
|
if (!existing.meta && !existing.found)
|
|
975
988
|
return formatStopResult(existing, options);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import {
|
|
4
|
+
truncateToWidth as piTruncateToWidth,
|
|
5
|
+
visibleWidth as piVisibleWidth,
|
|
6
|
+
wrapTextWithAnsi as piWrapTextWithAnsi,
|
|
7
|
+
} from "@earendil-works/pi-tui";
|
|
3
8
|
import { advertiseBackgroundAdapter } from "./adapter-contract.js";
|
|
4
|
-
import { formatBatchLaunch, spawnTaskBatch } from "./batch.js";
|
|
5
9
|
import { refreshBackgroundTasksNavigator } from "./navigator-provider.js";
|
|
6
10
|
import {
|
|
7
11
|
classifyOwnership,
|
|
@@ -18,26 +22,19 @@ import {
|
|
|
18
22
|
import { cursorKind, readOutputControls } from "./shared-log-utils.js";
|
|
19
23
|
import { cancelCallbackBatch, getCallbackBatcher, setCallbackBatchContext } from "./shared-callback-batcher.js";
|
|
20
24
|
import { registerDeliveryObserver } from "./delivery-observer.js";
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
observedWaitServiceUnavailableReason,
|
|
25
|
-
type DurableTaskKind,
|
|
26
|
-
type DurableLaunch,
|
|
27
|
-
type WaitView,
|
|
28
|
-
} from "./observed-waits.js";
|
|
29
|
-
import { backgroundObservation } from "./work-observation.js";
|
|
25
|
+
import { getObservedWaitHost } from "./observed-wait-client.js";
|
|
26
|
+
import type { DurableTaskKind, DurableLaunch, WaitView } from "./observed-waits.js";
|
|
27
|
+
import { backgroundListNeedsHistory, backgroundObservation } from "./work-observation.js";
|
|
30
28
|
import { inspectMeta, listMetasForOrigin, readMeta, writeMeta } from "./registry.js";
|
|
31
|
-
import {
|
|
32
|
-
import { runTaskMaintenance } from "./maintenance.js";
|
|
29
|
+
import type { WatchTaskParams, BackgroundTaskRuntime } from "./runtime.js";
|
|
33
30
|
import { backgroundProcessDiagnosticsAccess, ForegroundSandboxBlockedError } from "./sandbox.js";
|
|
34
31
|
import { inspectTaskProcess } from "./task-diagnostics.js";
|
|
35
32
|
import type { BackgroundTaskCallbackOrigin, BackgroundTaskMeta } from "./types.js";
|
|
36
|
-
import { isTerminalStatus } from "./types.js";
|
|
33
|
+
import { FIRST_WATCH_CHECK_WAIT_MS, isTerminalStatus } from "./types.js";
|
|
37
34
|
|
|
38
35
|
export { formatLaunch } from "./output.js";
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
type ToolRuntime = Pick<BackgroundTaskRuntime, "awaitFirstWatchCheck" | "resumeRunningTask" | "spawnTask" | "startWatchTask" | "stopTask">;
|
|
41
38
|
|
|
42
39
|
const JsonPathSchema = Type.String({
|
|
43
40
|
pattern: "^\\$",
|
|
@@ -178,7 +175,7 @@ const IdParams = Type.Object({
|
|
|
178
175
|
...CursorFields,
|
|
179
176
|
});
|
|
180
177
|
const HistoryField = {
|
|
181
|
-
diagnostics: Type.Optional(Type.Boolean({ description: "For status: sample registered task process identity, CPU time, state and wait evidence. Requires
|
|
178
|
+
diagnostics: Type.Optional(Type.Boolean({ description: "For status: sample registered task process identity, CPU time, state and wait evidence. Requires Process access Read in each enabled sandbox profile (Main and Background tasks); unavailable under Main confinement. No arguments, environment or remote probes; a snapshot cannot prove useful work or a hang." })),
|
|
182
179
|
history: Type.Optional(Type.Boolean({ description: "If true, return an incident page that also lists failure history: expected failures and recovered or superseded incidents. Default output lists only failures that need action and counts the rest." })),
|
|
183
180
|
};
|
|
184
181
|
const StatusParams = Type.Object({
|
|
@@ -299,8 +296,7 @@ const BACKGROUND_ORCHESTRATION_GUIDELINES = [
|
|
|
299
296
|
"Do not treat launch as completion of the parent milestone; relevant background work must be terminal, inspected, and integrated before verification or completion.",
|
|
300
297
|
];
|
|
301
298
|
|
|
302
|
-
export function registerTools(pi: ExtensionAPI, runtime
|
|
303
|
-
const { resumeRunningTask, spawnTask } = runtime;
|
|
299
|
+
export function registerTools(pi: ExtensionAPI, runtime?: ToolRuntime, refreshNavigator = refreshBackgroundTasksNavigator, options: { resumeLocal?: boolean } = {}): void {
|
|
304
300
|
let activeSession: BackgroundTaskCallbackOrigin | undefined;
|
|
305
301
|
const getActiveSession = () => activeSession;
|
|
306
302
|
const schemas = new Map<string, object>();
|
|
@@ -316,12 +312,14 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
316
312
|
setCallbackBatchContext(pi, ctx);
|
|
317
313
|
activeSession = getCallbackOrigin(ctx);
|
|
318
314
|
if (options.resumeLocal !== false) {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
315
|
+
const { resumeRunningTask } = runtime ?? await import("./runtime.js");
|
|
316
|
+
const { runTaskMaintenance } = await import("./maintenance.js");
|
|
317
|
+
for (const meta of listMetasForOrigin(activeSession)) {
|
|
318
|
+
if (meta.status === "running" || (meta.callback !== false && !meta.callbackSentAt && !meta.callbackSuppressedAt)) {
|
|
319
|
+
resumeRunningTask(pi, meta, getActiveSession);
|
|
320
|
+
}
|
|
322
321
|
}
|
|
323
|
-
|
|
324
|
-
runTaskMaintenance({ activeOrigin: activeSession });
|
|
322
|
+
runTaskMaintenance({ activeOrigin: activeSession });
|
|
325
323
|
}
|
|
326
324
|
});
|
|
327
325
|
pi.on("agent_start", (_event, ctx) => {
|
|
@@ -360,6 +358,7 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
360
358
|
refreshNavigator(ctx);
|
|
361
359
|
return text(durable, launchReceipt(receipt));
|
|
362
360
|
}
|
|
361
|
+
const { spawnTask } = runtime ?? await import("./runtime.js");
|
|
363
362
|
const launched = reportLaunch(() => spawnTask(pi, params, ctx.cwd, origin, getActiveSession));
|
|
364
363
|
refreshNavigator(ctx);
|
|
365
364
|
return text(launched);
|
|
@@ -374,6 +373,7 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
374
373
|
parameters: BatchParams,
|
|
375
374
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
376
375
|
activeSession = getCallbackOrigin(ctx);
|
|
376
|
+
const { formatBatchLaunch, spawnTaskBatch } = await import("./batch.js");
|
|
377
377
|
const launched = spawnTaskBatch(pi, params, ctx.cwd, activeSession, getActiveSession, {}, runtime);
|
|
378
378
|
refreshNavigator(ctx);
|
|
379
379
|
return text(formatBatchLaunch(launched), launched);
|
|
@@ -456,7 +456,7 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
456
456
|
refreshNavigator(ctx);
|
|
457
457
|
return text(durable);
|
|
458
458
|
}
|
|
459
|
-
const result = await formatStop(pi, params.id, ctx, getActiveSession, statusOptions(params, origin), runtime);
|
|
459
|
+
const result = await formatStop(pi, params.id, ctx, getActiveSession, statusOptions(params, origin), runtime ?? await import("./runtime.js"));
|
|
460
460
|
refreshNavigator(ctx);
|
|
461
461
|
return text(result);
|
|
462
462
|
},
|
|
@@ -473,7 +473,7 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
473
473
|
},
|
|
474
474
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
475
475
|
activeSession = getCallbackOrigin(ctx);
|
|
476
|
-
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, signal, runtime, refreshNavigator);
|
|
476
|
+
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, signal, runtime ?? await import("./runtime.js"), refreshNavigator);
|
|
477
477
|
},
|
|
478
478
|
});
|
|
479
479
|
|
|
@@ -487,7 +487,7 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
487
487
|
},
|
|
488
488
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
489
489
|
activeSession = getCallbackOrigin(ctx);
|
|
490
|
-
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, undefined, runtime, refreshNavigator);
|
|
490
|
+
return actionText(pi, { ...params, request_id: params.request_id ?? toolCallId }, ctx, activeSession, getActiveSession, undefined, runtime ?? await import("./runtime.js"), refreshNavigator);
|
|
491
491
|
},
|
|
492
492
|
});
|
|
493
493
|
|
|
@@ -503,14 +503,14 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
503
503
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
504
504
|
const host = getObservedWaitHost(pi);
|
|
505
505
|
if (!host?.available) {
|
|
506
|
-
return text(observedWaitServiceUnavailableReason(pi)
|
|
506
|
+
return text((await import("./observed-waits.js")).observedWaitServiceUnavailableReason(pi)
|
|
507
507
|
?? "Observed waits are unavailable in this session; inspect tasks directly and continue without a durable wait.");
|
|
508
508
|
}
|
|
509
509
|
try {
|
|
510
510
|
const wait = host.usesServerResults
|
|
511
511
|
? await host.superviseParentWait(ctx, params.task_ids, params.continuation_note)
|
|
512
512
|
: host.waitForParent(ctx, params.task_ids, params.continuation_note);
|
|
513
|
-
return text(formatWaitView(wait), wait);
|
|
513
|
+
return text((await import("./observed-waits.js")).formatWaitView(wait), wait);
|
|
514
514
|
} catch (error) {
|
|
515
515
|
return text(`Wait was not registered: ${readableError(error)}`);
|
|
516
516
|
}
|
|
@@ -525,7 +525,7 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
525
525
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
526
526
|
const host = getObservedWaitHost(pi);
|
|
527
527
|
if (!host?.available) {
|
|
528
|
-
return text(observedWaitServiceUnavailableReason(pi)
|
|
528
|
+
return text((await import("./observed-waits.js")).observedWaitServiceUnavailableReason(pi)
|
|
529
529
|
?? "Observed waits are unavailable in this session; no wait was consumed.");
|
|
530
530
|
}
|
|
531
531
|
try {
|
|
@@ -571,6 +571,7 @@ export function registerTools(pi: ExtensionAPI, runtime: Pick<BackgroundTaskRunt
|
|
|
571
571
|
try {
|
|
572
572
|
const waits = host.listWaitsForParent(ctx, { pendingOnly: params.pending_only === true });
|
|
573
573
|
if (waits.length === 0) return text("No durable waits for this session.");
|
|
574
|
+
const { formatWaitView } = await import("./observed-waits.js");
|
|
574
575
|
return text(waits.map((wait: WaitView) => formatWaitView(wait)).join("\n\n"), waits);
|
|
575
576
|
} catch (error) {
|
|
576
577
|
return text(`Waits could not be listed: ${readableError(error)}`);
|
|
@@ -671,7 +672,7 @@ async function actionText(
|
|
|
671
672
|
callbackOrigin: BackgroundTaskCallbackOrigin,
|
|
672
673
|
getActiveSession: () => BackgroundTaskCallbackOrigin | undefined,
|
|
673
674
|
signal: AbortSignal | undefined,
|
|
674
|
-
runtime:
|
|
675
|
+
runtime: ToolRuntime,
|
|
675
676
|
refreshNavigator: typeof refreshBackgroundTasksNavigator,
|
|
676
677
|
) {
|
|
677
678
|
if (params.action === "log" && params.id) {
|
|
@@ -691,7 +692,7 @@ async function runAction(
|
|
|
691
692
|
callbackOrigin: BackgroundTaskCallbackOrigin,
|
|
692
693
|
getActiveSession: () => BackgroundTaskCallbackOrigin | undefined,
|
|
693
694
|
signal: AbortSignal | undefined,
|
|
694
|
-
runtime:
|
|
695
|
+
runtime: ToolRuntime,
|
|
695
696
|
refreshNavigator: typeof refreshBackgroundTasksNavigator,
|
|
696
697
|
onLaunch?: (launch: DurableLaunch) => void,
|
|
697
698
|
): Promise<string> {
|
|
@@ -746,7 +747,7 @@ async function runAction(
|
|
|
746
747
|
}
|
|
747
748
|
}
|
|
748
749
|
|
|
749
|
-
/**
|
|
750
|
+
/** Ordinary lists reuse retained activity; explicit filtered/paged lists open history. */
|
|
750
751
|
async function durableAwareList(
|
|
751
752
|
pi: ExtensionAPI,
|
|
752
753
|
params: Record<string, unknown>,
|
|
@@ -754,10 +755,16 @@ async function durableAwareList(
|
|
|
754
755
|
ctx: ExtensionContext,
|
|
755
756
|
): Promise<string> {
|
|
756
757
|
const options = listOptions(params, origin);
|
|
757
|
-
const
|
|
758
|
+
const history = backgroundListNeedsHistory(params);
|
|
759
|
+
const snapshot = origin && !unavailableSessionOrigins.has(origin) ? await backgroundObservation(pi, ctx, history, params.all === true,
|
|
758
760
|
{ limit: options.limit, statuses: options.statuses, cursor: options.cursor }) : undefined;
|
|
759
761
|
if (snapshot && snapshot.status !== "ready") throw new Error(snapshot.reason ?? "Background activity is unverified");
|
|
760
|
-
const
|
|
762
|
+
const index = snapshot?.backgroundIndex ?? (snapshot ? { records: snapshot.rows
|
|
763
|
+
.map((row: any) => ({ found: true, meta: row.meta.durable ? { ...row.meta,
|
|
764
|
+
callbackOrigin: { cwd: row.meta.owner.workspace, sessionId: row.meta.owner.sessionId },
|
|
765
|
+
logPath: row.meta.logPaths?.stdout ?? "" } : row.meta }))
|
|
766
|
+
.sort((a: any, b: any) => b.meta.startedAt - a.meta.startedAt || b.meta.id.localeCompare(a.meta.id)) } : undefined);
|
|
767
|
+
const legacy = formatList(options, index);
|
|
761
768
|
if (snapshot) return legacy;
|
|
762
769
|
const host = getObservedWaitHost(pi);
|
|
763
770
|
if ((!snapshot && !host?.available) || !origin || typeof params.cursor === "string") return legacy;
|
|
@@ -925,9 +932,9 @@ export async function launchWatch(
|
|
|
925
932
|
getActiveSession: () => BackgroundTaskCallbackOrigin | undefined,
|
|
926
933
|
waitMs = FIRST_WATCH_CHECK_WAIT_MS,
|
|
927
934
|
signal?: AbortSignal,
|
|
928
|
-
runtime
|
|
935
|
+
runtime?: ToolRuntime,
|
|
929
936
|
): Promise<string> {
|
|
930
|
-
const { startWatchTask, awaitFirstWatchCheck } = runtime;
|
|
937
|
+
const { startWatchTask, awaitFirstWatchCheck } = runtime ?? await import("./runtime.js");
|
|
931
938
|
let meta: BackgroundTaskMeta;
|
|
932
939
|
try {
|
|
933
940
|
meta = startWatchTask(pi, params, cwd, callbackOrigin, getActiveSession);
|
|
@@ -954,7 +961,8 @@ function getCallbackOrigin(ctx: ExtensionContext | undefined): BackgroundTaskCal
|
|
|
954
961
|
sessionId = undefined;
|
|
955
962
|
unavailable = true;
|
|
956
963
|
}
|
|
957
|
-
const origin = { cwd: ctx?.cwd ?? "", sessionId
|
|
964
|
+
const origin: BackgroundTaskCallbackOrigin = { cwd: ctx?.cwd ?? "", sessionId,
|
|
965
|
+
branchId: ctx?.sessionManager?.getLeafId?.() ?? null };
|
|
958
966
|
if (unavailable) unavailableSessionOrigins.add(origin);
|
|
959
967
|
return origin;
|
|
960
968
|
}
|
|
@@ -1042,29 +1050,34 @@ function renderLines(lines: string[], mode: "truncate" | "wrap" = "truncate") {
|
|
|
1042
1050
|
};
|
|
1043
1051
|
}
|
|
1044
1052
|
|
|
1053
|
+
/**
|
|
1054
|
+
* Split one display line into rows of at most `width` terminal columns.
|
|
1055
|
+
*
|
|
1056
|
+
* Measures columns rather than characters: a CJK grapheme or emoji occupies two,
|
|
1057
|
+
* so counting characters emitted rows wider than the width Pi asked for. Pi
|
|
1058
|
+
* asserts every rendered line fits the terminal and exits the process when one
|
|
1059
|
+
* does not, which turned any log holding double-width text into a crash that
|
|
1060
|
+
* replayed on resume, because the tool result stays in session history.
|
|
1061
|
+
*/
|
|
1045
1062
|
function wrapLineToVisibleWidth(line: string, width: number): string[] {
|
|
1046
1063
|
const str = String(line ?? "");
|
|
1047
1064
|
const max = Math.max(1, Number(width) || 80);
|
|
1048
|
-
if (
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
let visible = 0;
|
|
1052
|
-
for (const char of str) {
|
|
1053
|
-
if (visible >= max) {
|
|
1054
|
-
out.push(current);
|
|
1055
|
-
current = "";
|
|
1056
|
-
visible = 0;
|
|
1057
|
-
}
|
|
1058
|
-
current += char;
|
|
1059
|
-
visible += 1;
|
|
1060
|
-
}
|
|
1061
|
-
out.push(current);
|
|
1062
|
-
return out;
|
|
1065
|
+
if (piVisibleWidth(str) <= max) return [str];
|
|
1066
|
+
const wrapped = piWrapTextWithAnsi(str, max);
|
|
1067
|
+
return (wrapped.length > 0 ? wrapped : [str]).map((row) => fitToVisibleWidth(row, max));
|
|
1063
1068
|
}
|
|
1064
1069
|
|
|
1065
1070
|
function truncateToVisibleWidth(value: string, width: number): string {
|
|
1066
1071
|
const max = Math.max(0, Math.floor(width || 0));
|
|
1067
|
-
return String(value ?? "")
|
|
1072
|
+
return fitToVisibleWidth(String(value ?? ""), max);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
/** Last resort for anything a wrap missed: never return a line wider than `max`. */
|
|
1076
|
+
function fitToVisibleWidth(value: string, max: number): string {
|
|
1077
|
+
const str = String(value ?? "");
|
|
1078
|
+
const limit = Math.max(0, Math.floor(max || 0));
|
|
1079
|
+
if (piVisibleWidth(str) <= limit) return str;
|
|
1080
|
+
return piTruncateToWidth(str, limit, "");
|
|
1068
1081
|
}
|
|
1069
1082
|
|
|
1070
1083
|
async function formatStop(
|
|
@@ -1073,9 +1086,9 @@ async function formatStop(
|
|
|
1073
1086
|
_ctx: ExtensionContext,
|
|
1074
1087
|
getActiveSession?: () => BackgroundTaskCallbackOrigin | undefined,
|
|
1075
1088
|
options: OutputOptions = {},
|
|
1076
|
-
runtime
|
|
1089
|
+
runtime?: Pick<BackgroundTaskRuntime, "stopTask">,
|
|
1077
1090
|
): Promise<string> {
|
|
1078
|
-
const { stopTask } = runtime;
|
|
1091
|
+
const { stopTask } = runtime ?? await import("./runtime.js");
|
|
1079
1092
|
const existing = inspectMeta(id);
|
|
1080
1093
|
if (!existing.meta && !existing.found) return formatStopResult(existing, options);
|
|
1081
1094
|
if (!existing.meta) return formatMissingTask(existing, options);
|
|
@@ -24,6 +24,8 @@ export interface CommandSpec {
|
|
|
24
24
|
shell?: boolean;
|
|
25
25
|
/** Run the shell as a login shell (`bash -lc`, the default). False runs `bash -c`, skipping profile sourcing. */
|
|
26
26
|
loginShell?: boolean;
|
|
27
|
+
/** Internal executable selected by the host for a Windows shell or log trampoline. */
|
|
28
|
+
resolvedWindowsShell?: string;
|
|
27
29
|
cwd?: string;
|
|
28
30
|
env?: Record<string, string>;
|
|
29
31
|
}
|
|
@@ -93,6 +95,7 @@ export interface ResolvedRemoteTaskMetadata {
|
|
|
93
95
|
export interface BackgroundTaskCallbackOrigin {
|
|
94
96
|
cwd: string;
|
|
95
97
|
sessionId?: string;
|
|
98
|
+
branchId?: string | null;
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
export interface TaskSandboxProvenance {
|
|
@@ -159,8 +162,8 @@ export interface BackgroundTaskMeta {
|
|
|
159
162
|
env?: Record<string, string>;
|
|
160
163
|
/**
|
|
161
164
|
* The executable and argv this task was actually launched with, when that
|
|
162
|
-
* differs from `command`/`argv` above
|
|
163
|
-
*
|
|
165
|
+
* differs from `command`/`argv` above, such as an OS write-sandbox wrapper
|
|
166
|
+
* or a Windows watch shell selected at launch. Re-running a watch poll uses
|
|
164
167
|
* it verbatim, which is how a running task keeps the policy it started under
|
|
165
168
|
* even after the foreground policy changes. `command`/`argv` stay the operator's
|
|
166
169
|
* own request, so status, navigator, and goal surfaces read unchanged.
|
|
@@ -231,4 +234,5 @@ export interface TerminalResult {
|
|
|
231
234
|
|
|
232
235
|
export function isTerminalStatus(status: BackgroundTaskStatus): boolean {
|
|
233
236
|
return status !== "running";
|
|
234
|
-
}
|
|
237
|
+
}
|
|
238
|
+
export const FIRST_WATCH_CHECK_WAIT_MS = 15_000;
|