tmux-ide 2.7.0 → 2.9.0-beta.5
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 +95 -115
- package/bin/cli.js +69987 -11819
- package/bin/cli.ts +772 -114
- package/package.json +64 -30
- package/packages/contracts/package.json +3 -2
- package/packages/contracts/src/__tests__/actions-contract.test.ts +119 -0
- package/packages/contracts/src/__tests__/agent-graph-overlay.test.ts +428 -0
- package/packages/contracts/src/__tests__/app-window-mutation.test.ts +51 -0
- package/packages/contracts/src/__tests__/app-window-state.test.ts +34 -0
- package/packages/contracts/src/__tests__/application-shell.test.ts +635 -0
- package/packages/contracts/src/__tests__/causal-cell.test.ts +47 -0
- package/packages/contracts/src/__tests__/client-view-state.test.ts +115 -0
- package/packages/contracts/src/__tests__/cohesion-fixture.test.ts +106 -0
- package/packages/contracts/src/__tests__/commands.test.ts +86 -0
- package/packages/contracts/src/__tests__/control.test.ts +154 -0
- package/packages/contracts/src/__tests__/daemon-events.test.ts +400 -0
- package/packages/contracts/src/__tests__/daemon-resources.test.ts +143 -0
- package/packages/contracts/src/__tests__/daemon-wire.test.ts +117 -0
- package/packages/contracts/src/__tests__/desktop-host.test.ts +269 -0
- package/packages/contracts/src/__tests__/desktop-missions.test.ts +211 -0
- package/packages/contracts/src/__tests__/experience-conformance.test.ts +153 -0
- package/packages/contracts/src/__tests__/experience-kernel-boundary.test.ts +109 -0
- package/packages/contracts/src/__tests__/experience-shell.test.ts +65 -0
- package/packages/contracts/src/__tests__/fixtures/daemon-wire-v2.json +35 -0
- package/packages/contracts/src/__tests__/fleet-agent-graph.test.ts +231 -0
- package/packages/contracts/src/__tests__/fleet-catalog.test.ts +268 -0
- package/packages/contracts/src/__tests__/fleet-lifecycle.test.ts +62 -0
- package/packages/contracts/src/__tests__/focus-overlay.test.ts +110 -0
- package/packages/contracts/src/__tests__/ide-config.test.ts +18 -0
- package/packages/contracts/src/__tests__/issue-error.test.ts +78 -0
- package/packages/contracts/src/__tests__/mission-projections.test.ts +186 -0
- package/packages/contracts/src/__tests__/missions.test.ts +272 -0
- package/packages/contracts/src/__tests__/multiplexer-verbs.test.ts +240 -0
- package/packages/contracts/src/__tests__/pane-appearance.test.ts +146 -0
- package/packages/contracts/src/__tests__/pane-stream.test.ts +466 -0
- package/packages/contracts/src/__tests__/pane-widget-marker.test.ts +327 -0
- package/packages/contracts/src/__tests__/performance-metrics.test.ts +73 -0
- package/packages/contracts/src/__tests__/performance-qualification.test.ts +137 -0
- package/packages/contracts/src/__tests__/rich-card-widget.test.ts +29 -0
- package/packages/contracts/src/__tests__/session-runtime.test.ts +490 -0
- package/packages/contracts/src/__tests__/startup-readiness.test.ts +409 -0
- package/packages/contracts/src/__tests__/terminal-attachment-stream.test.ts +72 -0
- package/packages/contracts/src/__tests__/terminal-attachments.test.ts +329 -0
- package/packages/contracts/src/__tests__/terminal-delivery.test.ts +88 -0
- package/packages/contracts/src/__tests__/terminal-runtime-inventory.test.ts +68 -0
- package/packages/contracts/src/__tests__/visual-tokens.test.ts +224 -0
- package/packages/contracts/src/__tests__/workspace-changes-resource.test.ts +317 -0
- package/packages/contracts/src/__tests__/workspace-changes-view.test.ts +122 -0
- package/packages/contracts/src/__tests__/workspace-config.test.ts +294 -0
- package/packages/contracts/src/__tests__/workspace-files-resource.test.ts +261 -0
- package/packages/contracts/src/__tests__/workspace-files-tree.test.ts +147 -0
- package/packages/contracts/src/__tests__/workspace-pane-creation.test.ts +249 -0
- package/packages/contracts/src/__tests__/workspace-promotion.test.ts +94 -0
- package/packages/contracts/src/__tests__/workspace-resource-identity.test.ts +90 -0
- package/packages/contracts/src/actions-contract.ts +205 -0
- package/packages/contracts/src/actions-errors.ts +20 -0
- package/packages/contracts/src/agent-graph-overlay.ts +425 -0
- package/packages/contracts/src/app-window-mutation.ts +103 -0
- package/packages/contracts/src/app-window-state.ts +446 -0
- package/packages/contracts/src/application-shell-resource.ts +54 -0
- package/packages/contracts/src/application-shell.ts +1094 -0
- package/packages/contracts/src/causal-cell.ts +168 -0
- package/packages/contracts/src/client-view-state.ts +156 -0
- package/packages/contracts/src/cohesion-fixture.ts +647 -0
- package/packages/contracts/src/commands.ts +153 -0
- package/packages/contracts/src/control.ts +217 -0
- package/packages/contracts/src/daemon-events.ts +374 -0
- package/packages/contracts/src/daemon-resource-request.test.ts +192 -0
- package/packages/contracts/src/daemon-resource-request.ts +397 -0
- package/packages/contracts/src/daemon-resources.ts +108 -0
- package/packages/contracts/src/daemon-wire.ts +100 -0
- package/packages/contracts/src/desktop-daemon-issue.ts +83 -0
- package/packages/contracts/src/desktop-host.ts +746 -0
- package/packages/contracts/src/desktop-missions.ts +159 -0
- package/packages/contracts/src/desktop-update.ts +48 -0
- package/packages/contracts/src/desktop-workspace-name.ts +18 -0
- package/packages/contracts/src/domain.ts +493 -0
- package/packages/contracts/src/experience-identifiers.ts +53 -0
- package/packages/contracts/src/experience-shell.ts +249 -0
- package/packages/contracts/src/fleet-agent-graph.ts +171 -0
- package/packages/contracts/src/fleet-catalog.ts +190 -0
- package/packages/contracts/src/fleet-lifecycle.ts +136 -0
- package/packages/contracts/src/focus-overlay.ts +175 -0
- package/packages/contracts/src/ide-config.ts +40 -20
- package/packages/contracts/src/index.ts +60 -0
- package/packages/contracts/src/interaction-receipts.ts +438 -0
- package/packages/contracts/src/issue-error.ts +107 -0
- package/packages/contracts/src/mission-projections.ts +269 -0
- package/packages/contracts/src/multiplexer-verbs.ts +447 -0
- package/packages/contracts/src/pane-appearance.ts +248 -0
- package/packages/contracts/src/pane-stream.ts +709 -0
- package/packages/contracts/src/pane-widget-descriptor.ts +62 -0
- package/packages/contracts/src/pane-widget-marker.ts +301 -0
- package/packages/contracts/src/performance-metrics.ts +128 -0
- package/packages/contracts/src/performance-qualification.ts +276 -0
- package/packages/contracts/src/rich-card-widget.ts +72 -0
- package/packages/contracts/src/semantic-identity.ts +39 -0
- package/packages/contracts/src/session-runtime.ts +351 -0
- package/packages/contracts/src/shared-monotonic-clock.ts +18 -0
- package/packages/contracts/src/startup-readiness.ts +432 -0
- package/packages/contracts/src/terminal-attachment-stream.ts +119 -0
- package/packages/contracts/src/terminal-attachments.ts +347 -0
- package/packages/contracts/src/terminal-delivery.ts +245 -0
- package/packages/contracts/src/terminal-replica.ts +133 -0
- package/packages/contracts/src/terminal-runtime-inventory.ts +42 -0
- package/packages/contracts/src/visual-recipes.ts +126 -0
- package/packages/contracts/src/visual-tokens.ts +883 -0
- package/packages/contracts/src/widget-asset.ts +43 -0
- package/packages/contracts/src/workspace-catalog-resource.test.ts +146 -0
- package/packages/contracts/src/workspace-catalog-resource.ts +180 -0
- package/packages/contracts/src/workspace-changes-resource.ts +405 -0
- package/packages/contracts/src/workspace-changes-view.ts +195 -0
- package/packages/contracts/src/workspace-config.ts +303 -0
- package/packages/contracts/src/workspace-files-resource.ts +310 -0
- package/packages/contracts/src/workspace-files-tree.ts +167 -0
- package/packages/contracts/src/workspace-missions-resource.ts +32 -0
- package/packages/contracts/src/workspace-multiplexer.ts +373 -0
- package/packages/contracts/src/workspace-open-handoff.ts +99 -0
- package/packages/contracts/src/workspace-open.ts +64 -0
- package/packages/contracts/src/workspace-pane-creation.ts +223 -0
- package/packages/contracts/src/workspace-promotion.ts +109 -0
- package/packages/contracts/src/workspace-resource-identity.ts +81 -0
- package/packages/contracts/src/workspace-state.ts +530 -0
- package/packages/contracts/src/workspace.ts +14 -2
- package/packages/core/package.json +35 -0
- package/packages/core/src/agent-provisioning.test.ts +42 -0
- package/packages/core/src/agent-provisioning.ts +112 -0
- package/packages/core/src/app-window-identity.ts +33 -0
- package/packages/core/src/application-shell-session.test.ts +105 -0
- package/packages/core/src/application-shell-session.ts +195 -0
- package/packages/core/src/index.ts +15 -0
- package/packages/core/src/interaction-flow.test.ts +66 -0
- package/packages/core/src/interaction-flow.ts +159 -0
- package/packages/core/src/interaction-receipts.test.ts +361 -0
- package/packages/core/src/interaction-receipts.ts +335 -0
- package/packages/core/src/navigator.test.ts +34 -0
- package/packages/core/src/navigator.ts +74 -0
- package/packages/core/src/optimistic-projection-conformance.test.ts +75 -0
- package/packages/core/src/optimistic-projection-conformance.ts +61 -0
- package/packages/core/src/optimistic-projection-store.ts +71 -0
- package/packages/core/src/optimistic-projection.test.ts +118 -0
- package/packages/core/src/optimistic-projection.ts +194 -0
- package/packages/core/src/performance-metrics.test.ts +121 -0
- package/packages/core/src/performance-metrics.ts +241 -0
- package/packages/core/src/performance-qualification.test.ts +283 -0
- package/packages/core/src/performance-qualification.ts +360 -0
- package/packages/core/src/terminal-compact-capability.ts +31 -0
- package/packages/core/src/terminal-compact-cold.test.ts +87 -0
- package/packages/core/src/terminal-conformance.test.ts +48 -0
- package/packages/core/src/terminal-conformance.ts +405 -0
- package/packages/core/src/terminal-delivery.test.ts +1196 -0
- package/packages/core/src/terminal-delivery.ts +2918 -0
- package/packages/core/src/terminal-replica-cold.test.ts +31 -0
- package/packages/core/src/terminal-replica-hash-cache.test.ts +201 -0
- package/packages/core/src/terminal-replica-hash-cache.ts +367 -0
- package/packages/core/src/terminal-replica.test.ts +282 -0
- package/packages/core/src/terminal-replica.ts +943 -0
- package/packages/core/src/workspace-selection.test.ts +63 -0
- package/packages/core/src/workspace-selection.ts +97 -0
- package/packages/daemon/dist/attach.js +2 -2
- package/packages/daemon/dist/canonical.d.ts +2 -2
- package/packages/daemon/dist/canonical.js +1 -1
- package/packages/daemon/dist/cli.js +37 -36
- package/packages/daemon/dist/command-center/actions/command-definitions.d.ts +4 -0
- package/packages/daemon/dist/command-center/actions/command-definitions.js +70 -0
- package/packages/daemon/dist/command-center/actions/dispatcher.d.ts +29 -0
- package/packages/daemon/dist/command-center/actions/dispatcher.js +228 -10
- package/packages/daemon/dist/command-center/actions/errors.d.ts +1 -1
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.d.ts +1 -1
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.js +3 -4
- package/packages/daemon/dist/command-center/actions/handlers/app-window-mutate.d.ts +8 -0
- package/packages/daemon/dist/command-center/actions/handlers/app-window-mutate.js +39 -0
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.d.ts +6 -6
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.js +44 -20
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.d.ts +2 -1
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.js +11 -1
- package/packages/daemon/dist/command-center/actions/handlers/fleet-lifecycle.d.ts +10 -0
- package/packages/daemon/dist/command-center/actions/handlers/fleet-lifecycle.js +56 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-launch.js +16 -4
- package/packages/daemon/dist/command-center/actions/handlers/workspace-multiplexer.d.ts +186 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-multiplexer.js +55 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-open.d.ts +16 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-open.js +89 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-pane-create.d.ts +8 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-pane-create.js +34 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-promote.d.ts +8 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-promote.js +34 -0
- package/packages/daemon/dist/command-center/actions/registry.d.ts +33 -2
- package/packages/daemon/dist/command-center/actions/registry.js +126 -0
- package/packages/daemon/dist/command-center/actions/semantic-multiplexer-actions.d.ts +3 -0
- package/packages/daemon/dist/command-center/actions/semantic-multiplexer-actions.js +16 -0
- package/packages/daemon/dist/command-center/agent-status-watch.d.ts +100 -0
- package/packages/daemon/dist/command-center/agent-status-watch.js +170 -0
- package/packages/daemon/dist/command-center/daemon-fleet-facts-observer.d.ts +57 -0
- package/packages/daemon/dist/command-center/daemon-fleet-facts-observer.js +395 -0
- package/packages/daemon/dist/command-center/discovery.d.ts +98 -1
- package/packages/daemon/dist/command-center/discovery.js +262 -3
- package/packages/daemon/dist/command-center/owner-authority.d.ts +71 -0
- package/packages/daemon/dist/command-center/owner-authority.js +46 -0
- package/packages/daemon/dist/command-center/pane-stream-issue.d.ts +26 -0
- package/packages/daemon/dist/command-center/pane-stream-issue.js +185 -0
- package/packages/daemon/dist/command-center/resources/agent-graph-overlay.d.ts +45 -0
- package/packages/daemon/dist/command-center/resources/agent-graph-overlay.js +234 -0
- package/packages/daemon/dist/command-center/resources/application-shell.d.ts +201 -0
- package/packages/daemon/dist/command-center/resources/application-shell.js +641 -0
- package/packages/daemon/dist/command-center/resources/desktop-missions.d.ts +10 -0
- package/packages/daemon/dist/command-center/resources/desktop-missions.js +132 -0
- package/packages/daemon/dist/command-center/resources/fleet-catalog.d.ts +25 -0
- package/packages/daemon/dist/command-center/resources/fleet-catalog.js +163 -0
- package/packages/daemon/dist/command-center/resources/fleet-resource-route.d.ts +25 -0
- package/packages/daemon/dist/command-center/resources/fleet-resource-route.js +46 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness-route.d.ts +38 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness-route.js +121 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness.d.ts +57 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness.js +183 -0
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.d.ts +5 -0
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.js +24 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-authority.d.ts +39 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-authority.js +451 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-git.d.ts +63 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-git.js +222 -0
- package/packages/daemon/dist/command-center/resources/workspace-files-authority.d.ts +44 -0
- package/packages/daemon/dist/command-center/resources/workspace-files-authority.js +493 -0
- package/packages/daemon/dist/command-center/resources/workspace-missions-route.d.ts +22 -0
- package/packages/daemon/dist/command-center/resources/workspace-missions-route.js +75 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-ids.d.ts +24 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-ids.js +69 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-routes.d.ts +17 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-routes.js +116 -0
- package/packages/daemon/dist/command-center/schemas.d.ts +1 -1
- package/packages/daemon/dist/command-center/server.d.ts +57 -1
- package/packages/daemon/dist/command-center/server.js +540 -51
- package/packages/daemon/dist/command-center/terminal-attachment-issue.d.ts +22 -0
- package/packages/daemon/dist/command-center/terminal-attachment-issue.js +191 -0
- package/packages/daemon/dist/command-center/workspace-resource-observer.d.ts +50 -0
- package/packages/daemon/dist/command-center/workspace-resource-observer.js +453 -0
- package/packages/daemon/dist/command-center/ws-events.d.ts +82 -7
- package/packages/daemon/dist/command-center/ws-events.js +681 -63
- package/packages/daemon/dist/config.js +31 -25
- package/packages/daemon/dist/control/client.d.ts +23 -0
- package/packages/daemon/dist/control/client.js +105 -0
- package/packages/daemon/dist/control/dispatch.d.ts +34 -0
- package/packages/daemon/dist/control/dispatch.js +83 -0
- package/packages/daemon/dist/control/fanout.d.ts +19 -0
- package/packages/daemon/dist/control/fanout.js +37 -0
- package/packages/daemon/dist/control/frames.d.ts +23 -0
- package/packages/daemon/dist/control/frames.js +37 -0
- package/packages/daemon/dist/control/lifecycle.d.ts +45 -0
- package/packages/daemon/dist/control/lifecycle.js +124 -0
- package/packages/daemon/dist/control/server.d.ts +16 -0
- package/packages/daemon/dist/control/server.js +214 -0
- package/packages/daemon/dist/control/verbs.d.ts +11 -0
- package/packages/daemon/dist/control/verbs.js +91 -0
- package/packages/daemon/dist/detect.js +23 -20
- package/packages/daemon/dist/doctor.d.ts +18 -0
- package/packages/daemon/dist/doctor.js +127 -21
- package/packages/daemon/dist/index.d.ts +21 -2
- package/packages/daemon/dist/index.js +20 -1
- package/packages/daemon/dist/init.js +24 -22
- package/packages/daemon/dist/inspect.d.ts +7 -1
- package/packages/daemon/dist/inspect.js +33 -8
- package/packages/daemon/dist/launch.d.ts +2 -0
- package/packages/daemon/dist/launch.js +38 -26
- package/packages/daemon/dist/lib/__tests__/fixtures/workspace-state-writer.js +58 -0
- package/packages/daemon/dist/lib/agent-discovery.d.ts +27 -2
- package/packages/daemon/dist/lib/agent-discovery.js +29 -14
- package/packages/daemon/dist/lib/agent-kind.d.ts +7 -0
- package/packages/daemon/dist/lib/agent-kind.js +24 -0
- package/packages/daemon/dist/lib/app-config.d.ts +111 -0
- package/packages/daemon/dist/lib/app-config.js +130 -5
- package/packages/daemon/dist/lib/app-window-kernel.d.ts +64 -0
- package/packages/daemon/dist/lib/app-window-kernel.js +556 -0
- package/packages/daemon/dist/lib/app-window-mutation.d.ts +28 -0
- package/packages/daemon/dist/lib/app-window-mutation.js +139 -0
- package/packages/daemon/dist/lib/app-window-repository.d.ts +81 -0
- package/packages/daemon/dist/lib/app-window-repository.js +368 -0
- package/packages/daemon/dist/lib/app-window-state.d.ts +57 -0
- package/packages/daemon/dist/lib/app-window-state.js +415 -0
- package/packages/daemon/dist/lib/application-shell-app-windows.d.ts +16 -0
- package/packages/daemon/dist/lib/application-shell-app-windows.js +285 -0
- package/packages/daemon/dist/lib/auth/middleware.d.ts +1 -1
- package/packages/daemon/dist/lib/auth/middleware.js +7 -3
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.d.ts +25 -0
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.js +174 -0
- package/packages/daemon/dist/lib/canonical-daemon.d.ts +80 -14
- package/packages/daemon/dist/lib/canonical-daemon.js +507 -70
- package/packages/daemon/dist/lib/chrome-front-door.d.ts +7 -0
- package/packages/daemon/dist/lib/chrome-front-door.js +13 -0
- package/packages/daemon/dist/lib/cli-action-bridge.d.ts +8 -3
- package/packages/daemon/dist/lib/cli-action-bridge.js +112 -82
- package/packages/daemon/dist/lib/command-registry.d.ts +37 -0
- package/packages/daemon/dist/lib/command-registry.js +107 -0
- package/packages/daemon/dist/lib/config-context.d.ts +18 -0
- package/packages/daemon/dist/lib/config-context.js +34 -0
- package/packages/daemon/dist/lib/daemon-embed.d.ts +30 -0
- package/packages/daemon/dist/lib/daemon-embed.js +1060 -356
- package/packages/daemon/dist/lib/daemon-session-monitor.d.ts +50 -0
- package/packages/daemon/dist/lib/daemon-session-monitor.js +194 -0
- package/packages/daemon/dist/lib/daemon.js +3 -47
- package/packages/daemon/dist/lib/directory-watcher.d.ts +12 -0
- package/packages/daemon/dist/lib/directory-watcher.js +118 -0
- package/packages/daemon/dist/lib/environment-identity.d.ts +9 -0
- package/packages/daemon/dist/lib/environment-identity.js +79 -0
- package/packages/daemon/dist/lib/errors.d.ts +1 -1
- package/packages/daemon/dist/lib/fleet-agent-lifecycle.d.ts +8 -0
- package/packages/daemon/dist/lib/fleet-agent-lifecycle.js +65 -0
- package/packages/daemon/dist/lib/fleet-lifecycle-authority.d.ts +21 -0
- package/packages/daemon/dist/lib/fleet-lifecycle-authority.js +437 -0
- package/packages/daemon/dist/lib/headless-daemon.d.ts +33 -0
- package/packages/daemon/dist/lib/headless-daemon.js +306 -0
- package/packages/daemon/dist/lib/launch-plan.d.ts +20 -1
- package/packages/daemon/dist/lib/launch-plan.js +96 -1
- package/packages/daemon/dist/lib/legacy-config-adapter.d.ts +12 -0
- package/packages/daemon/dist/lib/legacy-config-adapter.js +19 -0
- package/packages/daemon/dist/lib/legacy-config-migration.d.ts +15 -0
- package/packages/daemon/dist/lib/legacy-config-migration.js +110 -0
- package/packages/daemon/dist/lib/legacy-theme-compat.d.ts +14 -0
- package/packages/daemon/dist/lib/legacy-theme-compat.js +25 -0
- package/packages/daemon/dist/lib/manifest-pack.d.ts +79 -0
- package/packages/daemon/dist/lib/manifest-pack.js +232 -0
- package/packages/daemon/dist/lib/mission-projections.d.ts +24 -0
- package/packages/daemon/dist/lib/mission-projections.js +615 -0
- package/packages/daemon/dist/lib/mission-repository.d.ts +941 -0
- package/packages/daemon/dist/lib/mission-repository.js +775 -0
- package/packages/daemon/dist/lib/onboarding-marker.d.ts +13 -0
- package/packages/daemon/dist/lib/onboarding-marker.js +51 -0
- package/packages/daemon/dist/lib/pane-chrome.d.ts +12 -0
- package/packages/daemon/dist/lib/pane-chrome.js +12 -0
- package/packages/daemon/dist/lib/pane-source-credentials.d.ts +32 -0
- package/packages/daemon/dist/lib/pane-source-credentials.js +178 -0
- package/packages/daemon/dist/lib/pane-widget.d.ts +61 -0
- package/packages/daemon/dist/lib/pane-widget.js +126 -0
- package/packages/daemon/dist/lib/project-inspect.js +4 -0
- package/packages/daemon/dist/lib/project-onboard.d.ts +5 -5
- package/packages/daemon/dist/lib/project-onboard.js +17 -21
- package/packages/daemon/dist/lib/project-probe.d.ts +9 -3
- package/packages/daemon/dist/lib/project-probe.js +28 -22
- package/packages/daemon/dist/lib/project-readiness-probe.d.ts +60 -0
- package/packages/daemon/dist/lib/project-readiness-probe.js +425 -0
- package/packages/daemon/dist/lib/project-readiness.d.ts +157 -0
- package/packages/daemon/dist/lib/project-readiness.js +680 -0
- package/packages/daemon/dist/lib/project-registry.d.ts +8 -0
- package/packages/daemon/dist/lib/project-registry.js +42 -9
- package/packages/daemon/dist/lib/project-resolver.d.ts +77 -0
- package/packages/daemon/dist/lib/project-resolver.js +245 -0
- package/packages/daemon/dist/lib/project-runtime-errors.d.ts +13 -0
- package/packages/daemon/dist/lib/project-runtime-errors.js +21 -0
- package/packages/daemon/dist/lib/project-runtime-repository.d.ts +193 -0
- package/packages/daemon/dist/lib/project-runtime-repository.js +876 -0
- package/packages/daemon/dist/lib/resolved-config.d.ts +48 -0
- package/packages/daemon/dist/lib/resolved-config.js +318 -0
- package/packages/daemon/dist/lib/runtime-namespace.d.ts +34 -0
- package/packages/daemon/dist/lib/runtime-namespace.js +136 -0
- package/packages/daemon/dist/lib/semantic-resource-id.d.ts +7 -0
- package/packages/daemon/dist/lib/semantic-resource-id.js +14 -0
- package/packages/daemon/dist/lib/session-monitor.d.ts +2 -0
- package/packages/daemon/dist/lib/session-monitor.js +29 -23
- package/packages/daemon/dist/lib/session-options.js +3 -10
- package/packages/daemon/dist/lib/state-home.d.ts +2 -0
- package/packages/daemon/dist/lib/state-home.js +11 -0
- package/packages/daemon/dist/lib/theme-mode.d.ts +10 -0
- package/packages/daemon/dist/lib/theme-mode.js +9 -0
- package/packages/daemon/dist/lib/tmux-external-interaction-observer.d.ts +88 -0
- package/packages/daemon/dist/lib/tmux-external-interaction-observer.js +534 -0
- package/packages/daemon/dist/lib/tmux-interaction-options.d.ts +34 -0
- package/packages/daemon/dist/lib/tmux-interaction-options.js +126 -0
- package/packages/daemon/dist/lib/tmux-terminal-color.d.ts +18 -0
- package/packages/daemon/dist/lib/tmux-terminal-color.js +37 -0
- package/packages/daemon/dist/lib/tui-binary.d.ts +30 -5
- package/packages/daemon/dist/lib/tui-binary.js +291 -28
- package/packages/daemon/dist/lib/unix-socket-authority.d.ts +9 -0
- package/packages/daemon/dist/lib/unix-socket-authority.js +48 -0
- package/packages/daemon/dist/lib/update-check.js +5 -0
- package/packages/daemon/dist/lib/widget-asset-policy.d.ts +3 -0
- package/packages/daemon/dist/lib/widget-asset-policy.js +3 -0
- package/packages/daemon/dist/lib/widget-asset-store.d.ts +22 -0
- package/packages/daemon/dist/lib/widget-asset-store.js +166 -0
- package/packages/daemon/dist/lib/workspace-config-loader.d.ts +68 -0
- package/packages/daemon/dist/lib/workspace-config-loader.js +280 -0
- package/packages/daemon/dist/lib/workspace-multiplexer-verbs.d.ts +109 -0
- package/packages/daemon/dist/lib/workspace-multiplexer-verbs.js +1138 -0
- package/packages/daemon/dist/lib/workspace-open-handoff.d.ts +41 -0
- package/packages/daemon/dist/lib/workspace-open-handoff.js +219 -0
- package/packages/daemon/dist/lib/workspace-open.d.ts +44 -0
- package/packages/daemon/dist/lib/workspace-open.js +740 -0
- package/packages/daemon/dist/lib/workspace-pane-creation.d.ts +64 -0
- package/packages/daemon/dist/lib/workspace-pane-creation.js +1107 -0
- package/packages/daemon/dist/lib/workspace-promotion.d.ts +41 -0
- package/packages/daemon/dist/lib/workspace-promotion.js +804 -0
- package/packages/daemon/dist/lib/workspace-registry.d.ts +49 -2
- package/packages/daemon/dist/lib/workspace-registry.js +150 -23
- package/packages/daemon/dist/lib/workspace-state-repository.d.ts +139 -0
- package/packages/daemon/dist/lib/workspace-state-repository.js +790 -0
- package/packages/daemon/dist/lib/workspace-state.d.ts +37 -0
- package/packages/daemon/dist/lib/workspace-state.js +765 -0
- package/packages/daemon/dist/lib/yaml-io.js +4 -18
- package/packages/daemon/dist/migrate.d.ts +11 -0
- package/packages/daemon/dist/migrate.js +105 -0
- package/packages/daemon/dist/restart.js +2 -2
- package/packages/daemon/dist/restore.d.ts +40 -13
- package/packages/daemon/dist/restore.js +62 -21
- package/packages/daemon/dist/schemas/inspect.d.ts +8 -0
- package/packages/daemon/dist/schemas/inspect.js +9 -1
- package/packages/daemon/dist/schemas/registry.d.ts +18 -4
- package/packages/daemon/dist/schemas/registry.js +5 -19
- package/packages/daemon/dist/schemas/ws-events.d.ts +5 -69
- package/packages/daemon/dist/schemas/ws-events.js +4 -107
- package/packages/daemon/dist/send.d.ts +41 -1
- package/packages/daemon/dist/send.js +136 -20
- package/packages/daemon/dist/server/pane-stream-upgrade.d.ts +12 -0
- package/packages/daemon/dist/server/pane-stream-upgrade.js +117 -0
- package/packages/daemon/dist/server/terminal-attachment-upgrade.d.ts +11 -0
- package/packages/daemon/dist/server/terminal-attachment-upgrade.js +121 -0
- package/packages/daemon/dist/status.js +11 -8
- package/packages/daemon/dist/stop.js +2 -2
- package/packages/daemon/dist/terminal/MonotonicPtyInput.d.ts +30 -0
- package/packages/daemon/dist/terminal/MonotonicPtyInput.js +130 -0
- package/packages/daemon/dist/terminal/NodePtyAdapter.d.ts +9 -3
- package/packages/daemon/dist/terminal/NodePtyAdapter.js +37 -10
- package/packages/daemon/dist/terminal/PtyAdapter.d.ts +93 -3
- package/packages/daemon/dist/terminal/PtyAdapter.js +18 -0
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.d.ts +14 -4
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.js +33 -6
- package/packages/daemon/dist/terminal/attachments/admission-util.d.ts +14 -0
- package/packages/daemon/dist/terminal/attachments/admission-util.js +87 -0
- package/packages/daemon/dist/terminal/attachments/agent-status-probe.d.ts +102 -0
- package/packages/daemon/dist/terminal/attachments/agent-status-probe.js +325 -0
- package/packages/daemon/dist/terminal/attachments/direct-websocket.d.ts +141 -0
- package/packages/daemon/dist/terminal/attachments/direct-websocket.js +1069 -0
- package/packages/daemon/dist/terminal/attachments/grouped-tmux.d.ts +106 -0
- package/packages/daemon/dist/terminal/attachments/grouped-tmux.js +213 -0
- package/packages/daemon/dist/terminal/attachments/lease-manager.d.ts +188 -0
- package/packages/daemon/dist/terminal/attachments/lease-manager.js +655 -0
- package/packages/daemon/dist/terminal/attachments/native-runtime.d.ts +196 -0
- package/packages/daemon/dist/terminal/attachments/native-runtime.js +1564 -0
- package/packages/daemon/dist/terminal/attachments/pty-tmux-attachment-launcher.d.ts +66 -0
- package/packages/daemon/dist/terminal/attachments/pty-tmux-attachment-launcher.js +607 -0
- package/packages/daemon/dist/terminal/attachments/semantic-pane-catalog.d.ts +81 -0
- package/packages/daemon/dist/terminal/attachments/semantic-pane-catalog.js +208 -0
- package/packages/daemon/dist/terminal/attachments/tmux-view-executor.d.ts +111 -0
- package/packages/daemon/dist/terminal/attachments/tmux-view-executor.js +825 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/scripted-channel.d.ts +25 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/scripted-channel.js +80 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/simulated-channel.d.ts +66 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/simulated-channel.js +133 -0
- package/packages/daemon/dist/terminal/mirror/control-channel.d.ts +188 -0
- package/packages/daemon/dist/terminal/mirror/control-channel.js +624 -0
- package/packages/daemon/dist/terminal/mirror/control-mode-ownership.d.ts +14 -0
- package/packages/daemon/dist/terminal/mirror/control-mode-ownership.js +30 -0
- package/packages/daemon/dist/terminal/mirror/events.d.ts +115 -0
- package/packages/daemon/dist/terminal/mirror/events.js +18 -0
- package/packages/daemon/dist/terminal/mirror/flow-ledger.d.ts +40 -0
- package/packages/daemon/dist/terminal/mirror/flow-ledger.js +56 -0
- package/packages/daemon/dist/terminal/mirror/mirror-service.d.ts +137 -0
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +329 -0
- package/packages/daemon/dist/terminal/mirror/pane-feed.d.ts +90 -0
- package/packages/daemon/dist/terminal/mirror/pane-feed.js +140 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.d.ts +216 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.js +2301 -0
- package/packages/daemon/dist/terminal/mirror/trusted-inventory.d.ts +28 -0
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.d.ts +72 -0
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +245 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.d.ts +208 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +2058 -0
- package/packages/daemon/dist/terminal/pane-stream/runtime.d.ts +26 -0
- package/packages/daemon/dist/terminal/pane-stream/runtime.js +53 -0
- package/packages/daemon/dist/terminal/pane-stream/wire-ledger.d.ts +59 -0
- package/packages/daemon/dist/terminal/pane-stream/wire-ledger.js +110 -0
- package/packages/daemon/dist/terminal/protocol/chunk-bytes.d.ts +3 -0
- package/packages/daemon/dist/terminal/protocol/chunk-bytes.js +21 -0
- package/packages/daemon/dist/terminal/protocol/control.d.ts +66 -0
- package/packages/daemon/dist/terminal/protocol/control.js +111 -0
- package/packages/daemon/dist/terminal/protocol/input-coalescer.d.ts +55 -0
- package/packages/daemon/dist/terminal/protocol/input-coalescer.js +111 -0
- package/packages/daemon/dist/terminal/protocol/layout-parse.d.ts +68 -0
- package/packages/daemon/dist/terminal/protocol/layout-parse.js +127 -0
- package/packages/daemon/dist/terminal/protocol/pane-display-name.d.ts +16 -0
- package/packages/daemon/dist/terminal/protocol/pane-display-name.js +153 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.d.ts +78 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +294 -0
- package/packages/daemon/dist/terminal/protocol/workspace-tmux-adapter.d.ts +90 -0
- package/packages/daemon/dist/terminal/protocol/workspace-tmux-adapter.js +213 -0
- package/packages/daemon/dist/terminal/session-runtime/authority-arbiter.d.ts +36 -0
- package/packages/daemon/dist/terminal/session-runtime/authority-arbiter.js +260 -0
- package/packages/daemon/dist/terminal/session-runtime/causal-cell-ledger.d.ts +29 -0
- package/packages/daemon/dist/terminal/session-runtime/causal-cell-ledger.js +278 -0
- package/packages/daemon/dist/terminal/session-runtime/interaction-receipt-facts.d.ts +12 -0
- package/packages/daemon/dist/terminal/session-runtime/interaction-receipt-facts.js +147 -0
- package/packages/daemon/dist/terminal/session-runtime/multiplexer-backend.d.ts +16 -0
- package/packages/daemon/dist/terminal/session-runtime/multiplexer-backend.js +116 -0
- package/packages/daemon/dist/terminal/session-runtime/registry.d.ts +148 -0
- package/packages/daemon/dist/terminal/session-runtime/registry.js +1368 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-observability.d.ts +118 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-observability.js +72 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-scheduler.d.ts +11 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-scheduler.js +10 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-trace-correlator.d.ts +18 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-trace-correlator.js +48 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-executor.d.ts +69 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-executor.js +353 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-resource-changes.d.ts +8 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-resource-changes.js +32 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.d.ts +91 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +1362 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-observation-identity.d.ts +3 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-observation-identity.js +9 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-interpreter-backend.d.ts +55 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.d.ts +91 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +528 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.d.ts +50 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.js +387 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-shadow-projections.d.ts +37 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-shadow-projections.js +21 -0
- package/packages/daemon/dist/terminal/session-runtime/transport-binding.d.ts +75 -0
- package/packages/daemon/dist/terminal/session-runtime/transport-binding.js +474 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.d.ts +26 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +276 -0
- package/packages/daemon/dist/tui/async-disposable-slot.d.ts +18 -0
- package/packages/daemon/dist/tui/async-disposable-slot.js +57 -0
- package/packages/daemon/dist/tui/chrome/cheatsheet.d.ts +59 -0
- package/packages/daemon/dist/tui/chrome/cheatsheet.js +211 -0
- package/packages/daemon/dist/tui/chrome/chip.d.ts +21 -0
- package/packages/daemon/dist/tui/chrome/chip.js +25 -0
- package/packages/daemon/dist/tui/chrome/events.d.ts +51 -0
- package/packages/daemon/dist/tui/chrome/events.js +94 -0
- package/packages/daemon/dist/tui/chrome/front-door.d.ts +16 -0
- package/packages/daemon/dist/tui/chrome/front-door.js +16 -0
- package/packages/daemon/dist/tui/chrome/kitty-keys.d.ts +41 -0
- package/packages/daemon/dist/tui/chrome/kitty-keys.js +54 -0
- package/packages/daemon/dist/tui/chrome/menu.d.ts +92 -0
- package/packages/daemon/dist/tui/chrome/menu.js +251 -0
- package/packages/daemon/dist/tui/chrome/notify-prefs.d.ts +47 -0
- package/packages/daemon/dist/tui/chrome/notify-prefs.js +13 -0
- package/packages/daemon/dist/tui/chrome/notify-state.d.ts +13 -0
- package/packages/daemon/dist/tui/chrome/notify-state.js +77 -0
- package/packages/daemon/dist/tui/chrome/notify.d.ts +361 -0
- package/packages/daemon/dist/tui/chrome/notify.js +711 -0
- package/packages/daemon/dist/tui/chrome/panels.d.ts +72 -0
- package/packages/daemon/dist/tui/chrome/panels.js +60 -0
- package/packages/daemon/dist/tui/chrome/sidebar.d.ts +77 -0
- package/packages/daemon/dist/tui/chrome/sidebar.js +183 -0
- package/packages/daemon/dist/tui/chrome/snapshot.d.ts +110 -0
- package/packages/daemon/dist/tui/chrome/snapshot.js +290 -0
- package/packages/daemon/dist/tui/chrome/statusline.d.ts +237 -0
- package/packages/daemon/dist/tui/chrome/statusline.js +552 -0
- package/packages/daemon/dist/tui/chrome/updater.d.ts +230 -0
- package/packages/daemon/dist/tui/chrome/updater.js +651 -0
- package/packages/daemon/dist/tui/chrome/welcome.d.ts +41 -0
- package/packages/daemon/dist/tui/chrome/welcome.js +117 -0
- package/packages/daemon/dist/tui/compiled.d.ts +86 -0
- package/packages/daemon/dist/tui/compiled.js +165 -0
- package/packages/daemon/dist/tui/detect/agent-resolution.d.ts +56 -0
- package/packages/daemon/dist/tui/detect/agent-resolution.js +60 -0
- package/packages/daemon/dist/tui/detect/classify.d.ts +107 -0
- package/packages/daemon/dist/tui/detect/classify.js +184 -0
- package/packages/daemon/dist/tui/detect/manifest-loader.d.ts +54 -0
- package/packages/daemon/dist/tui/detect/manifest-loader.js +242 -0
- package/packages/daemon/dist/tui/detect/manifest.d.ts +111 -0
- package/packages/daemon/dist/tui/detect/manifest.js +126 -0
- package/packages/daemon/dist/tui/detect/manifests.d.ts +40 -0
- package/packages/daemon/dist/tui/detect/manifests.js +535 -0
- package/packages/daemon/dist/tui/detect/process-tree.d.ts +96 -0
- package/packages/daemon/dist/tui/detect/process-tree.js +194 -0
- package/packages/daemon/dist/tui/detect/session-id.d.ts +110 -0
- package/packages/daemon/dist/tui/detect/session-id.js +414 -0
- package/packages/daemon/dist/tui/detect/snapshot.d.ts +27 -0
- package/packages/daemon/dist/tui/detect/snapshot.js +81 -0
- package/packages/daemon/dist/tui/integrations/claude.d.ts +65 -0
- package/packages/daemon/dist/tui/integrations/claude.js +151 -0
- package/packages/daemon/dist/tui/integrations/offer.d.ts +47 -0
- package/packages/daemon/dist/tui/integrations/offer.js +134 -0
- package/packages/daemon/dist/tui/integrations/opencode.d.ts +37 -0
- package/packages/daemon/dist/tui/integrations/opencode.js +117 -0
- package/packages/daemon/dist/tui/mirror/ack-writer.d.ts +36 -0
- package/packages/daemon/dist/tui/mirror/ack-writer.js +78 -0
- package/packages/daemon/dist/tui/mirror/activity-surface-view.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/activity-surface-view.jsx +69 -0
- package/packages/daemon/dist/tui/mirror/activity-surface.d.ts +103 -0
- package/packages/daemon/dist/tui/mirror/activity-surface.js +271 -0
- package/packages/daemon/dist/tui/mirror/agent-chip.d.ts +76 -0
- package/packages/daemon/dist/tui/mirror/agent-chip.js +84 -0
- package/packages/daemon/dist/tui/mirror/agent-lifecycle.d.ts +217 -0
- package/packages/daemon/dist/tui/mirror/agent-lifecycle.js +372 -0
- package/packages/daemon/dist/tui/mirror/agent-provisioning-executor.d.ts +42 -0
- package/packages/daemon/dist/tui/mirror/agent-provisioning-executor.js +86 -0
- package/packages/daemon/dist/tui/mirror/agent-rows.d.ts +119 -0
- package/packages/daemon/dist/tui/mirror/agent-rows.js +126 -0
- package/packages/daemon/dist/tui/mirror/ansi-palette.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/ansi-palette.js +3 -0
- package/packages/daemon/dist/tui/mirror/app-state.d.ts +114 -0
- package/packages/daemon/dist/tui/mirror/app-state.js +294 -0
- package/packages/daemon/dist/tui/mirror/application-keybindings.d.ts +18 -0
- package/packages/daemon/dist/tui/mirror/application-keybindings.js +33 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-connection.d.ts +53 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-connection.js +253 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-session.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-session.js +45 -0
- package/packages/daemon/dist/tui/mirror/attention.d.ts +63 -0
- package/packages/daemon/dist/tui/mirror/attention.js +59 -0
- package/packages/daemon/dist/tui/mirror/blit.d.ts +82 -0
- package/packages/daemon/dist/tui/mirror/blit.js +120 -0
- package/packages/daemon/dist/tui/mirror/canonical-workspace-routing.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/canonical-workspace-routing.js +45 -0
- package/packages/daemon/dist/tui/mirror/changes-surface-view.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/changes-surface-view.jsx +92 -0
- package/packages/daemon/dist/tui/mirror/changes-surface.d.ts +115 -0
- package/packages/daemon/dist/tui/mirror/changes-surface.js +210 -0
- package/packages/daemon/dist/tui/mirror/composite-layout.d.ts +91 -0
- package/packages/daemon/dist/tui/mirror/composite-layout.js +539 -0
- package/packages/daemon/dist/tui/mirror/configless-session-bootstrap.d.ts +39 -0
- package/packages/daemon/dist/tui/mirror/configless-session-bootstrap.js +133 -0
- package/packages/daemon/dist/tui/mirror/dialog-model.d.ts +154 -0
- package/packages/daemon/dist/tui/mirror/dialog-model.js +183 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack-core.d.ts +45 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack-core.js +232 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack.d.ts +2 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack.js +2 -0
- package/packages/daemon/dist/tui/mirror/diff-model.d.ts +169 -0
- package/packages/daemon/dist/tui/mirror/diff-model.js +332 -0
- package/packages/daemon/dist/tui/mirror/editor-buffer.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/editor-buffer.js +47 -0
- package/packages/daemon/dist/tui/mirror/editor-open-policy.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/editor-open-policy.js +9 -0
- package/packages/daemon/dist/tui/mirror/features/changes/contract.d.ts +75 -0
- package/packages/daemon/dist/tui/mirror/features/changes/controller.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/features/changes/controller.js +454 -0
- package/packages/daemon/dist/tui/mirror/features/changes/feature.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/features/changes/feature.jsx +9 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/contract.d.ts +47 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/feature.d.ts +12 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/feature.jsx +123 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/session.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/session.js +160 -0
- package/packages/daemon/dist/tui/mirror/features/files/feature.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/features/files/feature.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/features/files/session.d.ts +133 -0
- package/packages/daemon/dist/tui/mirror/features/files/session.js +617 -0
- package/packages/daemon/dist/tui/mirror/features/home/feature.d.ts +28 -0
- package/packages/daemon/dist/tui/mirror/features/home/feature.jsx +122 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/contract.d.ts +84 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/contract.js +3 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/feature.d.ts +6 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/feature.jsx +5 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/session.d.ts +5 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/session.js +377 -0
- package/packages/daemon/dist/tui/mirror/features/palette/contract.d.ts +116 -0
- package/packages/daemon/dist/tui/mirror/features/palette/contract.js +9 -0
- package/packages/daemon/dist/tui/mirror/features/palette/feature.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/features/palette/feature.js +3 -0
- package/packages/daemon/dist/tui/mirror/features/palette/session.d.ts +2 -0
- package/packages/daemon/dist/tui/mirror/features/palette/session.js +393 -0
- package/packages/daemon/dist/tui/mirror/features/palette/surface.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/features/palette/surface.jsx +48 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/contract.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/feature.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/feature.jsx +2 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/session.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/session.js +148 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/surface.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/surface.jsx +64 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/asset-loader.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/asset-loader.js +125 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/contract.d.ts +71 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/feature.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/feature.jsx +103 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/session.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/session.js +310 -0
- package/packages/daemon/dist/tui/mirror/features/settings/catalog.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/features/settings/catalog.js +10 -0
- package/packages/daemon/dist/tui/mirror/features/settings/contract.d.ts +35 -0
- package/packages/daemon/dist/tui/mirror/features/settings/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/settings/feature.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/features/settings/feature.js +2 -0
- package/packages/daemon/dist/tui/mirror/features/settings/session.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/features/settings/session.js +309 -0
- package/packages/daemon/dist/tui/mirror/file-tree.d.ts +142 -0
- package/packages/daemon/dist/tui/mirror/file-tree.js +283 -0
- package/packages/daemon/dist/tui/mirror/files-surface-view.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/files-surface-view.jsx +92 -0
- package/packages/daemon/dist/tui/mirror/files-surface.d.ts +123 -0
- package/packages/daemon/dist/tui/mirror/files-surface.js +237 -0
- package/packages/daemon/dist/tui/mirror/focus-projection.d.ts +20 -0
- package/packages/daemon/dist/tui/mirror/focus-projection.js +80 -0
- package/packages/daemon/dist/tui/mirror/folder-picker.d.ts +38 -0
- package/packages/daemon/dist/tui/mirror/folder-picker.js +114 -0
- package/packages/daemon/dist/tui/mirror/frame-coalescer.d.ts +29 -0
- package/packages/daemon/dist/tui/mirror/frame-coalescer.js +74 -0
- package/packages/daemon/dist/tui/mirror/home-model.d.ts +81 -0
- package/packages/daemon/dist/tui/mirror/home-model.js +125 -0
- package/packages/daemon/dist/tui/mirror/home-surface-model.d.ts +113 -0
- package/packages/daemon/dist/tui/mirror/home-surface-model.js +297 -0
- package/packages/daemon/dist/tui/mirror/home-surface.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/home-surface.jsx +110 -0
- package/packages/daemon/dist/tui/mirror/host-terminal.d.ts +28 -0
- package/packages/daemon/dist/tui/mirror/host-terminal.js +33 -0
- package/packages/daemon/dist/tui/mirror/hosted.d.ts +179 -0
- package/packages/daemon/dist/tui/mirror/hosted.js +239 -0
- package/packages/daemon/dist/tui/mirror/input-lifecycle.d.ts +140 -0
- package/packages/daemon/dist/tui/mirror/input-lifecycle.js +147 -0
- package/packages/daemon/dist/tui/mirror/interaction-flow.d.ts +30 -0
- package/packages/daemon/dist/tui/mirror/interaction-flow.js +41 -0
- package/packages/daemon/dist/tui/mirror/legacy/missions-workspace-loader.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/legacy/missions-workspace-loader.js +84 -0
- package/packages/daemon/dist/tui/mirror/menu-model.d.ts +89 -0
- package/packages/daemon/dist/tui/mirror/menu-model.js +143 -0
- package/packages/daemon/dist/tui/mirror/missions-dashboard.d.ts +68 -0
- package/packages/daemon/dist/tui/mirror/missions-dashboard.js +261 -0
- package/packages/daemon/dist/tui/mirror/missions-render-fixtures.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/missions-render-fixtures.js +330 -0
- package/packages/daemon/dist/tui/mirror/missions-surface-controller.d.ts +84 -0
- package/packages/daemon/dist/tui/mirror/missions-surface-controller.js +314 -0
- package/packages/daemon/dist/tui/mirror/missions-surface.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/missions-surface.jsx +239 -0
- package/packages/daemon/dist/tui/mirror/missions-workspace.d.ts +341 -0
- package/packages/daemon/dist/tui/mirror/missions-workspace.js +1399 -0
- package/packages/daemon/dist/tui/mirror/multiplexer-action-executor.d.ts +71 -0
- package/packages/daemon/dist/tui/mirror/multiplexer-action-executor.js +233 -0
- package/packages/daemon/dist/tui/mirror/open-tui-pane-stream-socket.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/open-tui-pane-stream-socket.js +32 -0
- package/packages/daemon/dist/tui/mirror/open-tui-verified-routing.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/open-tui-verified-routing.js +45 -0
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.d.ts +36 -0
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.js +1069 -0
- package/packages/daemon/dist/tui/mirror/palette-surface-adapter.d.ts +58 -0
- package/packages/daemon/dist/tui/mirror/palette-surface-adapter.js +384 -0
- package/packages/daemon/dist/tui/mirror/palette.d.ts +315 -0
- package/packages/daemon/dist/tui/mirror/palette.js +522 -0
- package/packages/daemon/dist/tui/mirror/pane-frame-state.d.ts +68 -0
- package/packages/daemon/dist/tui/mirror/pane-frame-state.js +124 -0
- package/packages/daemon/dist/tui/mirror/pane-mirror.d.ts +205 -0
- package/packages/daemon/dist/tui/mirror/pane-mirror.js +584 -0
- package/packages/daemon/dist/tui/mirror/pane-surface.d.ts +257 -0
- package/packages/daemon/dist/tui/mirror/pane-surface.jsx +855 -0
- package/packages/daemon/dist/tui/mirror/panel-host-reactive.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/panel-host-reactive.js +13 -0
- package/packages/daemon/dist/tui/mirror/panel-host.d.ts +69 -0
- package/packages/daemon/dist/tui/mirror/panel-host.js +242 -0
- package/packages/daemon/dist/tui/mirror/perf-tap.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/perf-tap.js +32 -0
- package/packages/daemon/dist/tui/mirror/performance-events.d.ts +404 -0
- package/packages/daemon/dist/tui/mirror/performance-events.js +46 -0
- package/packages/daemon/dist/tui/mirror/recipe-components.d.ts +93 -0
- package/packages/daemon/dist/tui/mirror/recipe-components.jsx +135 -0
- package/packages/daemon/dist/tui/mirror/recipes.d.ts +90 -0
- package/packages/daemon/dist/tui/mirror/recipes.js +395 -0
- package/packages/daemon/dist/tui/mirror/reference-performance-trace.d.ts +80 -0
- package/packages/daemon/dist/tui/mirror/reference-performance-trace.js +597 -0
- package/packages/daemon/dist/tui/mirror/renderer-commands.d.ts +60 -0
- package/packages/daemon/dist/tui/mirror/renderer-commands.js +250 -0
- package/packages/daemon/dist/tui/mirror/resize-model.d.ts +76 -0
- package/packages/daemon/dist/tui/mirror/resize-model.js +105 -0
- package/packages/daemon/dist/tui/mirror/resize-transaction.d.ts +102 -0
- package/packages/daemon/dist/tui/mirror/resize-transaction.js +221 -0
- package/packages/daemon/dist/tui/mirror/rich-placement-projection.d.ts +64 -0
- package/packages/daemon/dist/tui/mirror/rich-placement-projection.js +80 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-appearance-owner.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-appearance-owner.js +79 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-bootstrap.d.ts +61 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-bootstrap.js +51 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-generation-starter.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-generation-starter.js +80 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog-owner.d.ts +21 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog-owner.js +88 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog.d.ts +60 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog.js +320 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-binding.d.ts +28 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-binding.js +111 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-capability.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-capability.js +25 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-presentation.d.ts +38 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-presentation.js +129 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-test-control.d.ts +43 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-test-control.js +242 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-input-readiness.d.ts +5 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-input-readiness.js +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-lifecycle.d.ts +72 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-lifecycle.js +297 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-optional-features.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-optional-features.js +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-command-owner.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-command-owner.js +61 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-input.d.ts +31 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-input.js +60 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-input.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-input.js +30 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-owner.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-owner.js +38 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pending-terminal-input.d.ts +53 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pending-terminal-input.js +74 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-performance-log.d.ts +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-performance-log.js +81 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-post-render-runtime.d.ts +37 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-post-render-runtime.js +117 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-configuration.d.ts +21 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-configuration.js +21 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-renderer.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-renderer.js +27 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-session-focus-owner.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-session-focus-owner.js +65 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-binding.d.ts +34 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-binding.js +307 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-viewport.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-viewport.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-frame-readiness-owner.d.ts +6 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-frame-readiness-owner.js +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-host-focus-owner.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-host-focus-owner.js +25 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-input-ingress.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-input-ingress.js +96 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.d.ts +65 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +1326 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-palette-owner.d.ts +65 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-palette-owner.js +217 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-paste.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-paste.js +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-renderer-sources.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-renderer-sources.js +31 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-selection-owner.d.ts +47 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-selection-owner.js +161 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace-policy.d.ts +44 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace-policy.js +177 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace.d.ts +103 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace.jsx +720 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-theme-repaint.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-theme-repaint.js +34 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-transient-note-owner.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-transient-note-owner.js +29 -0
- package/packages/daemon/dist/tui/mirror/runtime/bounded-performance-record-writer.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/bounded-performance-record-writer.js +67 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-client-ledger.d.ts +64 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-client-ledger.js +271 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-input-fixture.d.ts +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-input-fixture.js +43 -0
- package/packages/daemon/dist/tui/mirror/runtime/changes-deferred-identity.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/changes-deferred-identity.js +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/daemon-authority-rebind.d.ts +29 -0
- package/packages/daemon/dist/tui/mirror/runtime/daemon-authority-rebind.js +128 -0
- package/packages/daemon/dist/tui/mirror/runtime/deferred-intent-queue.d.ts +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/deferred-intent-queue.js +40 -0
- package/packages/daemon/dist/tui/mirror/runtime/editor-primitives.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/editor-primitives.js +39 -0
- package/packages/daemon/dist/tui/mirror/runtime/file-content-primitives.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/file-content-primitives.js +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/fleet-lifecycle-client.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/fleet-lifecycle-client.js +27 -0
- package/packages/daemon/dist/tui/mirror/runtime/focus-framebuffer-projection.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/runtime/focus-framebuffer-projection.js +53 -0
- package/packages/daemon/dist/tui/mirror/runtime/generation-bound-slot.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/runtime/generation-bound-slot.js +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/host-local-tmux-adapter.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/host-local-tmux-adapter.js +90 -0
- package/packages/daemon/dist/tui/mirror/runtime/hosted-tty-size-bridge.d.ts +55 -0
- package/packages/daemon/dist/tui/mirror/runtime/hosted-tty-size-bridge.js +166 -0
- package/packages/daemon/dist/tui/mirror/runtime/latest-intent-fence.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/latest-intent-fence.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/local-view-controller.d.ts +30 -0
- package/packages/daemon/dist/tui/mirror/runtime/local-view-controller.js +58 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-admission-coordinator.d.ts +44 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-admission-coordinator.js +118 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-pointer-capture.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-pointer-capture.js +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-generation-host.d.ts +68 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-generation-host.js +834 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-session-owner.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-session-owner.js +146 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.d.ts +45 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.js +178 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.typecheck.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.typecheck.js +1 -0
- package/packages/daemon/dist/tui/mirror/runtime/palette-production-controller.d.ts +55 -0
- package/packages/daemon/dist/tui/mirror/runtime/palette-production-controller.js +126 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-resize-geometry.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-resize-geometry.js +13 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-scoped-terminal-surface.d.ts +42 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-scoped-terminal-surface.jsx +67 -0
- package/packages/daemon/dist/tui/mirror/runtime/product-surface-policy.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/product-surface-policy.js +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/renderer-cadence.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/renderer-cadence.js +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/resize-terminal-pane.d.ts +35 -0
- package/packages/daemon/dist/tui/mirror/runtime/resize-terminal-pane.js +91 -0
- package/packages/daemon/dist/tui/mirror/runtime/rich-preview-demand.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/rich-preview-demand.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/runtime-layout-presentation.d.ts +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/runtime-layout-presentation.js +111 -0
- package/packages/daemon/dist/tui/mirror/runtime/select-terminal-pane.d.ts +25 -0
- package/packages/daemon/dist/tui/mirror/runtime/select-terminal-pane.js +90 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-pane-publication.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-pane-publication.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-shell-viewport-resize.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-shell-viewport-resize.js +56 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-dimensions-owner.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-dimensions-owner.js +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.d.ts +52 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.js +610 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-frame-readiness.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-frame-readiness.js +84 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-focus.d.ts +41 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-focus.js +347 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-frame-diagnostics.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-frame-diagnostics.js +37 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-input-adapter.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-input-adapter.js +50 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-layout-projection.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-layout-projection.js +28 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-pane-input-router.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-pane-input-router.js +82 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-selection.d.ts +66 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-selection.js +141 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-session-handoff.d.ts +50 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-session-handoff.js +89 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-tool-readiness.d.ts +31 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-tool-readiness.js +64 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-controller.d.ts +92 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-controller.js +636 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-projection.d.ts +59 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-projection.js +169 -0
- package/packages/daemon/dist/tui/mirror/runtime/viewport-fit-coordinator.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/runtime/viewport-fit-coordinator.js +7 -0
- package/packages/daemon/dist/tui/mirror/runtime/workspace-terminal-fast-lane.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/workspace-terminal-fast-lane.js +498 -0
- package/packages/daemon/dist/tui/mirror/scrollbar-model.d.ts +35 -0
- package/packages/daemon/dist/tui/mirror/scrollbar-model.js +64 -0
- package/packages/daemon/dist/tui/mirror/search-model.d.ts +41 -0
- package/packages/daemon/dist/tui/mirror/search-model.js +62 -0
- package/packages/daemon/dist/tui/mirror/selection.d.ts +175 -0
- package/packages/daemon/dist/tui/mirror/selection.js +264 -0
- package/packages/daemon/dist/tui/mirror/semantic-pane-render-source.d.ts +147 -0
- package/packages/daemon/dist/tui/mirror/semantic-pane-render-source.js +562 -0
- package/packages/daemon/dist/tui/mirror/semantic-session-view.d.ts +86 -0
- package/packages/daemon/dist/tui/mirror/semantic-session-view.js +269 -0
- package/packages/daemon/dist/tui/mirror/settings-model.d.ts +108 -0
- package/packages/daemon/dist/tui/mirror/settings-model.js +304 -0
- package/packages/daemon/dist/tui/mirror/shell-chrome.d.ts +151 -0
- package/packages/daemon/dist/tui/mirror/shell-chrome.js +313 -0
- package/packages/daemon/dist/tui/mirror/size-truth.d.ts +92 -0
- package/packages/daemon/dist/tui/mirror/size-truth.js +104 -0
- package/packages/daemon/dist/tui/mirror/spans.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/spans.js +31 -0
- package/packages/daemon/dist/tui/mirror/status-grammar.d.ts +18 -0
- package/packages/daemon/dist/tui/mirror/status-grammar.js +29 -0
- package/packages/daemon/dist/tui/mirror/terminal-surface.d.ts +55 -0
- package/packages/daemon/dist/tui/mirror/terminal-surface.js +92 -0
- package/packages/daemon/dist/tui/mirror/terminal-text.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/terminal-text.js +38 -0
- package/packages/daemon/dist/tui/mirror/theme.d.ts +207 -0
- package/packages/daemon/dist/tui/mirror/theme.js +744 -0
- package/packages/daemon/dist/tui/mirror/ui/agent-badge.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/ui/agent-badge.jsx +14 -0
- package/packages/daemon/dist/tui/mirror/ui/badge.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/ui/badge.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/ui/button.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/ui/button.jsx +66 -0
- package/packages/daemon/dist/tui/mirror/ui/dialog.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/ui/dialog.jsx +8 -0
- package/packages/daemon/dist/tui/mirror/ui/index.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/ui/index.js +16 -0
- package/packages/daemon/dist/tui/mirror/ui/key-hint.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/ui/key-hint.jsx +39 -0
- package/packages/daemon/dist/tui/mirror/ui/keyboard-router.d.ts +25 -0
- package/packages/daemon/dist/tui/mirror/ui/keyboard-router.jsx +46 -0
- package/packages/daemon/dist/tui/mirror/ui/menu.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/ui/menu.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/ui/navigation-row.d.ts +21 -0
- package/packages/daemon/dist/tui/mirror/ui/navigation-row.jsx +62 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-frame.d.ts +25 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-frame.jsx +52 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-host.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-host.jsx +33 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-list-row.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-list-row.jsx +23 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-model.d.ts +29 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-model.js +45 -0
- package/packages/daemon/dist/tui/mirror/ui/state.d.ts +27 -0
- package/packages/daemon/dist/tui/mirror/ui/state.js +171 -0
- package/packages/daemon/dist/tui/mirror/ui/status-bar.d.ts +43 -0
- package/packages/daemon/dist/tui/mirror/ui/status-bar.jsx +102 -0
- package/packages/daemon/dist/tui/mirror/ui/surface.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/ui/surface.jsx +45 -0
- package/packages/daemon/dist/tui/mirror/ui/tabs.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/ui/tabs.jsx +88 -0
- package/packages/daemon/dist/tui/mirror/widget-fallback.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/widget-fallback.js +52 -0
- package/packages/daemon/dist/tui/mirror/widget-surface-model.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/widget-surface-model.js +145 -0
- package/packages/daemon/dist/tui/mirror/widget-surface.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/widget-surface.jsx +31 -0
- package/packages/daemon/dist/tui/mirror/workspace/agent-terminal-canvas.d.ts +53 -0
- package/packages/daemon/dist/tui/mirror/workspace/agent-terminal-canvas.js +77 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-root-controller.d.ts +266 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-root-controller.js +99 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-controller.d.ts +83 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-controller.js +292 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-surface-commands.d.ts +5 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-surface-commands.js +28 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell.d.ts +49 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell.js +97 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface-view.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface-view.jsx +158 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface.d.ts +128 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface.js +342 -0
- package/packages/daemon/dist/tui/mirror/workspace/icons.d.ts +154 -0
- package/packages/daemon/dist/tui/mirror/workspace/icons.js +43 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-action-menu.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-action-menu.jsx +20 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-frame.d.ts +143 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-frame.js +452 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-chrome.d.ts +152 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-chrome.js +555 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-header.d.ts +58 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-header.jsx +93 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-window-strip.d.ts +75 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-window-strip.jsx +253 -0
- package/packages/daemon/dist/tui/mirror/workspace/text.d.ts +2 -0
- package/packages/daemon/dist/tui/mirror/workspace/text.js +27 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-controller.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-controller.js +34 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-shell.d.ts +123 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-shell.js +286 -0
- package/packages/daemon/dist/tui/mirror/workspace-ui-state.d.ts +174 -0
- package/packages/daemon/dist/tui/mirror/workspace-ui-state.js +885 -0
- package/packages/daemon/dist/tui/readiness.d.ts +22 -0
- package/packages/daemon/dist/tui/readiness.js +34 -0
- package/packages/daemon/dist/tui/team/entry.d.ts +37 -0
- package/packages/daemon/dist/tui/team/entry.js +20 -0
- package/packages/daemon/dist/tui/team/fuzzy.d.ts +38 -0
- package/packages/daemon/dist/tui/team/fuzzy.js +141 -0
- package/packages/daemon/dist/tui/team/home.d.ts +94 -0
- package/packages/daemon/dist/tui/team/home.js +115 -0
- package/packages/daemon/dist/tui/team/input.d.ts +22 -0
- package/packages/daemon/dist/tui/team/input.js +21 -0
- package/packages/daemon/dist/tui/team/keymap.d.ts +33 -0
- package/packages/daemon/dist/tui/team/keymap.js +99 -0
- package/packages/daemon/dist/tui/team/mouse.d.ts +18 -0
- package/packages/daemon/dist/tui/team/mouse.js +17 -0
- package/packages/daemon/dist/tui/team/nav.d.ts +21 -0
- package/packages/daemon/dist/tui/team/nav.js +33 -0
- package/packages/daemon/dist/tui/team/preview.d.ts +19 -0
- package/packages/daemon/dist/tui/team/preview.js +35 -0
- package/packages/daemon/dist/tui/team/projects.d.ts +52 -0
- package/packages/daemon/dist/tui/team/projects.js +159 -0
- package/packages/daemon/dist/tui/team/report.d.ts +51 -0
- package/packages/daemon/dist/tui/team/report.js +37 -0
- package/packages/daemon/dist/tui/team/sessions.d.ts +235 -0
- package/packages/daemon/dist/tui/team/sessions.js +292 -0
- package/packages/daemon/dist/tui/team/tree.d.ts +41 -0
- package/packages/daemon/dist/tui/team/tree.js +42 -0
- package/packages/daemon/dist/tui/team/wait-receipts.d.ts +60 -0
- package/packages/daemon/dist/tui/team/wait-receipts.js +153 -0
- package/packages/daemon/dist/tui/team/wait.d.ts +62 -0
- package/packages/daemon/dist/tui/team/wait.js +90 -0
- package/packages/daemon/dist/validate.js +16 -10
- package/packages/daemon/dist/widgets/lib/watcher.d.ts +5 -9
- package/packages/daemon/dist/widgets/lib/watcher.js +5 -92
- package/packages/daemon/dist/widgets/resolve.js +10 -7
- package/packages/daemon/dist/widgets/setup/setup-model.js +7 -9
- package/packages/daemon/src/attach.ts +2 -2
- package/packages/daemon/src/canonical.ts +19 -2
- package/packages/daemon/src/cli.ts +38 -36
- package/packages/daemon/src/command-center/actions/command-definitions.ts +91 -0
- package/packages/daemon/src/command-center/actions/dispatcher.ts +291 -10
- package/packages/daemon/src/command-center/actions/errors.ts +40 -0
- package/packages/daemon/src/command-center/actions/handlers/_project-context.ts +4 -5
- package/packages/daemon/src/command-center/actions/handlers/app-window-mutate.ts +54 -0
- package/packages/daemon/src/command-center/actions/handlers/config-actions.ts +59 -29
- package/packages/daemon/src/command-center/actions/handlers/daemon-shutdown.ts +12 -0
- package/packages/daemon/src/command-center/actions/handlers/fleet-lifecycle.ts +104 -0
- package/packages/daemon/src/command-center/actions/handlers/project-launch.ts +20 -4
- package/packages/daemon/src/command-center/actions/handlers/workspace-multiplexer.ts +96 -0
- package/packages/daemon/src/command-center/actions/handlers/workspace-open.ts +141 -0
- package/packages/daemon/src/command-center/actions/handlers/workspace-pane-create.ts +48 -0
- package/packages/daemon/src/command-center/actions/handlers/workspace-promote.ts +48 -0
- package/packages/daemon/src/command-center/actions/registry.ts +200 -1
- package/packages/daemon/src/command-center/actions/semantic-multiplexer-actions.ts +26 -0
- package/packages/daemon/src/command-center/agent-status-watch.ts +222 -0
- package/packages/daemon/src/command-center/daemon-fleet-facts-observer.ts +465 -0
- package/packages/daemon/src/command-center/discovery.ts +310 -5
- package/packages/daemon/src/command-center/owner-authority.ts +118 -0
- package/packages/daemon/src/command-center/pane-stream-issue.ts +247 -0
- package/packages/daemon/src/command-center/resources/agent-graph-overlay.ts +270 -0
- package/packages/daemon/src/command-center/resources/application-shell.ts +909 -0
- package/packages/daemon/src/command-center/resources/desktop-missions.ts +171 -0
- package/packages/daemon/src/command-center/resources/fleet-catalog.ts +200 -0
- package/packages/daemon/src/command-center/resources/fleet-resource-route.ts +61 -0
- package/packages/daemon/src/command-center/resources/startup-readiness-route.ts +172 -0
- package/packages/daemon/src/command-center/resources/startup-readiness.ts +250 -0
- package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +45 -0
- package/packages/daemon/src/command-center/resources/workspace-changes-authority.ts +594 -0
- package/packages/daemon/src/command-center/resources/workspace-changes-git.ts +278 -0
- package/packages/daemon/src/command-center/resources/workspace-files-authority.ts +583 -0
- package/packages/daemon/src/command-center/resources/workspace-missions-route.ts +125 -0
- package/packages/daemon/src/command-center/resources/workspace-resource-ids.ts +81 -0
- package/packages/daemon/src/command-center/resources/workspace-resource-routes.ts +147 -0
- package/packages/daemon/src/command-center/server.ts +732 -59
- package/packages/daemon/src/command-center/terminal-attachment-issue.ts +257 -0
- package/packages/daemon/src/command-center/workspace-resource-observer.ts +560 -0
- package/packages/daemon/src/command-center/ws-events.ts +853 -66
- package/packages/daemon/src/config.ts +35 -25
- package/packages/daemon/src/control/client.ts +128 -0
- package/packages/daemon/src/control/dispatch.ts +107 -0
- package/packages/daemon/src/control/fanout.ts +44 -0
- package/packages/daemon/src/control/frames.ts +40 -0
- package/packages/daemon/src/control/lifecycle.ts +163 -0
- package/packages/daemon/src/control/server.ts +237 -0
- package/packages/daemon/src/control/verbs.ts +118 -0
- package/packages/daemon/src/detect.ts +25 -20
- package/packages/daemon/src/doctor.ts +133 -33
- package/packages/daemon/src/index.ts +244 -2
- package/packages/daemon/src/init.ts +23 -22
- package/packages/daemon/src/inspect.ts +41 -8
- package/packages/daemon/src/launch.ts +56 -28
- package/packages/daemon/src/lib/agent-discovery.ts +53 -13
- package/packages/daemon/src/lib/agent-kind.ts +23 -0
- package/packages/daemon/src/lib/app-config.ts +143 -9
- package/packages/daemon/src/lib/app-window-kernel.ts +777 -0
- package/packages/daemon/src/lib/app-window-mutation.ts +178 -0
- package/packages/daemon/src/lib/app-window-repository.ts +650 -0
- package/packages/daemon/src/lib/app-window-state.ts +599 -0
- package/packages/daemon/src/lib/application-shell-app-windows.ts +357 -0
- package/packages/daemon/src/lib/auth/middleware.ts +9 -3
- package/packages/daemon/src/lib/canonical-daemon-bootstrap.ts +266 -0
- package/packages/daemon/src/lib/canonical-daemon.ts +695 -73
- package/packages/daemon/src/lib/chrome-front-door.ts +17 -0
- package/packages/daemon/src/lib/cli-action-bridge.ts +127 -91
- package/packages/daemon/src/lib/command-registry.ts +152 -0
- package/packages/daemon/src/lib/config-context.ts +61 -0
- package/packages/daemon/src/lib/daemon-embed.ts +1347 -387
- package/packages/daemon/src/lib/daemon-session-monitor.ts +274 -0
- package/packages/daemon/src/lib/daemon.ts +3 -46
- package/packages/daemon/src/lib/directory-watcher.ts +166 -0
- package/packages/daemon/src/lib/environment-identity.ts +82 -0
- package/packages/daemon/src/lib/errors.ts +7 -1
- package/packages/daemon/src/lib/fleet-agent-lifecycle.ts +74 -0
- package/packages/daemon/src/lib/fleet-lifecycle-authority.ts +535 -0
- package/packages/daemon/src/lib/headless-daemon.ts +406 -0
- package/packages/daemon/src/lib/launch-plan.ts +123 -4
- package/packages/daemon/src/lib/legacy-config-adapter.ts +28 -0
- package/packages/daemon/src/lib/legacy-config-migration.ts +145 -0
- package/packages/daemon/src/lib/legacy-theme-compat.ts +40 -0
- package/packages/daemon/src/lib/manifest-pack.ts +255 -0
- package/packages/daemon/src/lib/mission-projections.ts +775 -0
- package/packages/daemon/src/lib/mission-repository.ts +1311 -0
- package/packages/daemon/src/lib/onboarding-marker.ts +51 -0
- package/packages/daemon/src/lib/pane-chrome.ts +14 -0
- package/packages/daemon/src/lib/pane-source-credentials.ts +200 -0
- package/packages/daemon/src/lib/pane-widget.ts +182 -0
- package/packages/daemon/src/lib/project-inspect.ts +4 -0
- package/packages/daemon/src/lib/project-onboard.ts +19 -24
- package/packages/daemon/src/lib/project-probe.ts +38 -30
- package/packages/daemon/src/lib/project-readiness-probe.ts +578 -0
- package/packages/daemon/src/lib/project-readiness.ts +1034 -0
- package/packages/daemon/src/lib/project-registry.ts +45 -9
- package/packages/daemon/src/lib/project-resolver.ts +350 -0
- package/packages/daemon/src/lib/project-runtime-errors.ts +41 -0
- package/packages/daemon/src/lib/project-runtime-repository.ts +1194 -0
- package/packages/daemon/src/lib/resolved-config.ts +425 -0
- package/packages/daemon/src/lib/runtime-namespace.ts +186 -0
- package/packages/daemon/src/lib/semantic-resource-id.ts +17 -0
- package/packages/daemon/src/lib/session-monitor.ts +28 -20
- package/packages/daemon/src/lib/session-options.ts +3 -10
- package/packages/daemon/src/lib/state-home.ts +12 -0
- package/packages/daemon/src/lib/theme-mode.ts +11 -0
- package/packages/daemon/src/lib/tmux-external-interaction-observer.ts +632 -0
- package/packages/daemon/src/lib/tmux-interaction-options.ts +171 -0
- package/packages/daemon/src/lib/tmux-terminal-color.ts +44 -0
- package/packages/daemon/src/lib/tui-binary.ts +354 -34
- package/packages/daemon/src/lib/unix-socket-authority.ts +65 -0
- package/packages/daemon/src/lib/update-check.ts +5 -0
- package/packages/daemon/src/lib/widget-asset-policy.ts +3 -0
- package/packages/daemon/src/lib/widget-asset-store.ts +218 -0
- package/packages/daemon/src/lib/workspace-config-loader.ts +378 -0
- package/packages/daemon/src/lib/workspace-multiplexer-verbs.ts +1362 -0
- package/packages/daemon/src/lib/workspace-open-handoff.ts +340 -0
- package/packages/daemon/src/lib/workspace-open.ts +983 -0
- package/packages/daemon/src/lib/workspace-pane-creation.ts +1406 -0
- package/packages/daemon/src/lib/workspace-promotion.ts +1031 -0
- package/packages/daemon/src/lib/workspace-registry.ts +193 -25
- package/packages/daemon/src/lib/workspace-state-repository.ts +1204 -0
- package/packages/daemon/src/lib/workspace-state.ts +960 -0
- package/packages/daemon/src/lib/yaml-io.ts +8 -17
- package/packages/daemon/src/migrate.ts +134 -0
- package/packages/daemon/src/restart.ts +2 -2
- package/packages/daemon/src/restore.ts +67 -24
- package/packages/daemon/src/schemas/inspect.ts +9 -1
- package/packages/daemon/src/schemas/registry.ts +12 -22
- package/packages/daemon/src/schemas/ws-events.ts +14 -131
- package/packages/daemon/src/send.ts +191 -22
- package/packages/daemon/src/server/pane-stream-upgrade.ts +141 -0
- package/packages/daemon/src/server/terminal-attachment-upgrade.ts +153 -0
- package/packages/daemon/src/status.ts +13 -8
- package/packages/daemon/src/stop.ts +2 -2
- package/packages/daemon/src/terminal/MonotonicPtyInput.ts +153 -0
- package/packages/daemon/src/terminal/NodePtyAdapter.ts +53 -11
- package/packages/daemon/src/terminal/PtyAdapter.ts +111 -3
- package/packages/daemon/src/terminal/README.md +34 -16
- package/packages/daemon/src/terminal/attachments/admission-util.ts +97 -0
- package/packages/daemon/src/terminal/attachments/agent-status-probe.ts +474 -0
- package/packages/daemon/src/terminal/attachments/direct-websocket.ts +1482 -0
- package/packages/daemon/src/terminal/attachments/grouped-tmux.ts +293 -0
- package/packages/daemon/src/terminal/attachments/lease-manager.ts +1042 -0
- package/packages/daemon/src/terminal/attachments/native-runtime.ts +2206 -0
- package/packages/daemon/src/terminal/attachments/pty-tmux-attachment-launcher.ts +750 -0
- package/packages/daemon/src/terminal/attachments/semantic-pane-catalog.ts +365 -0
- package/packages/daemon/src/terminal/attachments/tmux-view-executor.ts +1095 -0
- package/packages/daemon/src/terminal/mirror/control-channel.ts +827 -0
- package/packages/daemon/src/terminal/mirror/control-mode-ownership.ts +34 -0
- package/packages/daemon/src/terminal/mirror/events.ts +128 -0
- package/packages/daemon/src/terminal/mirror/flow-ledger.ts +65 -0
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +480 -0
- package/packages/daemon/src/terminal/mirror/pane-feed.ts +193 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +2820 -0
- package/packages/daemon/src/terminal/mirror/trusted-inventory.ts +29 -0
- package/packages/daemon/src/terminal/pane-stream/lease-manager.ts +375 -0
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +2612 -0
- package/packages/daemon/src/terminal/pane-stream/runtime.ts +78 -0
- package/packages/daemon/src/terminal/pane-stream/wire-ledger.ts +155 -0
- package/packages/daemon/src/terminal/protocol/README.md +14 -0
- package/packages/daemon/src/terminal/protocol/chunk-bytes.ts +20 -0
- package/packages/daemon/src/{tui/mirror → terminal/protocol}/control.ts +39 -6
- package/packages/daemon/src/{tui/mirror → terminal/protocol}/input-coalescer.ts +18 -7
- package/packages/daemon/src/terminal/protocol/layout-parse.ts +154 -0
- package/packages/daemon/src/terminal/protocol/pane-display-name.ts +185 -0
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +382 -0
- package/packages/daemon/src/terminal/protocol/workspace-tmux-adapter.ts +470 -0
- package/packages/daemon/src/terminal/session-runtime/authority-arbiter.ts +312 -0
- package/packages/daemon/src/terminal/session-runtime/causal-cell-ledger.ts +359 -0
- package/packages/daemon/src/terminal/session-runtime/interaction-receipt-facts.ts +173 -0
- package/packages/daemon/src/terminal/session-runtime/multiplexer-backend.ts +194 -0
- package/packages/daemon/src/terminal/session-runtime/registry.ts +2047 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-observability.ts +267 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-scheduler.ts +22 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-trace-correlator.ts +58 -0
- package/packages/daemon/src/terminal/session-runtime/semantic-mutation-executor.ts +555 -0
- package/packages/daemon/src/terminal/session-runtime/semantic-mutation-resource-changes.ts +48 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts +1806 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-observation-identity.ts +18 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-interpreter-backend.ts +64 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +690 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-owner.ts +498 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-shadow-projections.ts +36 -0
- package/packages/daemon/src/terminal/session-runtime/transport-binding.ts +682 -0
- package/packages/daemon/src/terminal/session-runtime/xterm-headless-provenance.json +25 -0
- package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +379 -0
- package/packages/daemon/src/tui/async-disposable-slot.ts +60 -0
- package/packages/daemon/src/tui/chrome/events.ts +4 -4
- package/packages/daemon/src/tui/chrome/front-door.ts +27 -0
- package/packages/daemon/src/tui/chrome/notify-prefs.ts +58 -0
- package/packages/daemon/src/tui/chrome/notify-state.ts +76 -0
- package/packages/daemon/src/tui/chrome/notify.ts +582 -84
- package/packages/daemon/src/tui/chrome/sidebar.ts +9 -4
- package/packages/daemon/src/tui/chrome/statusline.ts +15 -6
- package/packages/daemon/src/tui/chrome/updater.ts +367 -64
- package/packages/daemon/src/tui/compiled.ts +102 -6
- package/packages/daemon/src/tui/detect/agent-resolution.ts +85 -0
- package/packages/daemon/src/tui/detect/classify.ts +34 -0
- package/packages/daemon/src/tui/detect/manifest-loader.ts +54 -5
- package/packages/daemon/src/tui/detect/manifest.ts +24 -3
- package/packages/daemon/src/tui/detect/manifests.ts +240 -6
- package/packages/daemon/src/tui/detect/process-tree.ts +30 -4
- package/packages/daemon/src/tui/detect/session-id.ts +503 -0
- package/packages/daemon/src/tui/detect/snapshot.ts +38 -3
- package/packages/daemon/src/tui/integrations/claude.ts +1 -0
- package/packages/daemon/src/tui/integrations/opencode.ts +121 -0
- package/packages/daemon/src/tui/main.ts +53 -0
- package/packages/daemon/src/tui/mirror/RECIPES.md +59 -0
- package/packages/daemon/src/tui/mirror/SHELL_CHROME.md +39 -0
- package/packages/daemon/src/tui/mirror/THEME.md +48 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/activity-surface-renderer.test.tsx.snap +42 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/changes-terminal-surface-renderer.test.tsx.snap +267 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/home-files-surface-renderer.test.tsx.snap +267 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/missions-surface-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/recipes-gallery-renderer.test.tsx.snap +141 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/shell-chrome-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/activity-surface-view.tsx +169 -0
- package/packages/daemon/src/tui/mirror/activity-surface.ts +430 -0
- package/packages/daemon/src/tui/mirror/agent-chip.ts +40 -11
- package/packages/daemon/src/tui/mirror/agent-lifecycle.ts +468 -0
- package/packages/daemon/src/tui/mirror/agent-provisioning-executor.ts +151 -0
- package/packages/daemon/src/tui/mirror/agent-rows.ts +61 -5
- package/packages/daemon/src/tui/mirror/ansi-palette.ts +3 -0
- package/packages/daemon/src/tui/mirror/app-state.ts +185 -9
- package/packages/daemon/src/tui/mirror/app.tsx +2 -5264
- package/packages/daemon/src/tui/mirror/application-keybindings.ts +54 -0
- package/packages/daemon/src/tui/mirror/application-shell-daemon-connection.ts +344 -0
- package/packages/daemon/src/tui/mirror/application-shell-daemon-session.ts +74 -0
- package/packages/daemon/src/tui/mirror/attention.ts +110 -0
- package/packages/daemon/src/tui/mirror/canonical-workspace-routing.ts +63 -0
- package/packages/daemon/src/tui/mirror/changes-surface-view.tsx +263 -0
- package/packages/daemon/src/tui/mirror/changes-surface.ts +338 -0
- package/packages/daemon/src/tui/mirror/composite-layout.ts +710 -0
- package/packages/daemon/src/tui/mirror/configless-session-bootstrap.ts +192 -0
- package/packages/daemon/src/tui/mirror/dialog-model.ts +2 -2
- package/packages/daemon/src/tui/mirror/dialog-stack-core.ts +264 -0
- package/packages/daemon/src/tui/mirror/dialog-stack.ts +2 -354
- package/packages/daemon/src/tui/mirror/diff-model.ts +279 -4
- package/packages/daemon/src/tui/mirror/editor-buffer.ts +9 -70
- package/packages/daemon/src/tui/mirror/editor-open-policy.ts +16 -0
- package/packages/daemon/src/tui/mirror/features/changes/contract.ts +84 -0
- package/packages/daemon/src/tui/mirror/features/changes/controller.ts +470 -0
- package/packages/daemon/src/tui/mirror/features/changes/feature.tsx +19 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/contract.ts +64 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/feature.tsx +227 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/session.ts +186 -0
- package/packages/daemon/src/tui/mirror/features/files/feature.tsx +54 -0
- package/packages/daemon/src/tui/mirror/features/files/session.ts +694 -0
- package/packages/daemon/src/tui/mirror/features/home/feature.tsx +172 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/contract.ts +106 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/feature.tsx +19 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/session.ts +470 -0
- package/packages/daemon/src/tui/mirror/features/palette/contract.ts +121 -0
- package/packages/daemon/src/tui/mirror/features/palette/feature.ts +14 -0
- package/packages/daemon/src/tui/mirror/features/palette/session.ts +427 -0
- package/packages/daemon/src/tui/mirror/features/palette/surface.tsx +92 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/contract.ts +20 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/feature.tsx +8 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/session.ts +152 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/surface.tsx +137 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/asset-loader.ts +153 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/contract.ts +94 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/feature.tsx +141 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/session.ts +387 -0
- package/packages/daemon/src/tui/mirror/features/settings/catalog.ts +26 -0
- package/packages/daemon/src/tui/mirror/features/settings/contract.ts +41 -0
- package/packages/daemon/src/tui/mirror/features/settings/feature.ts +3 -0
- package/packages/daemon/src/tui/mirror/features/settings/session.ts +375 -0
- package/packages/daemon/src/tui/mirror/file-tree.ts +231 -6
- package/packages/daemon/src/tui/mirror/files-surface-view.tsx +242 -0
- package/packages/daemon/src/tui/mirror/files-surface.ts +371 -0
- package/packages/daemon/src/tui/mirror/focus-projection.ts +113 -0
- package/packages/daemon/src/tui/mirror/frame-coalescer.ts +87 -0
- package/packages/daemon/src/tui/mirror/home-model.ts +1 -1
- package/packages/daemon/src/tui/mirror/home-surface-model.ts +440 -0
- package/packages/daemon/src/tui/mirror/home-surface.tsx +254 -0
- package/packages/daemon/src/tui/mirror/host-terminal.ts +49 -0
- package/packages/daemon/src/tui/mirror/hosted.ts +286 -0
- package/packages/daemon/src/tui/mirror/input-lifecycle.ts +248 -0
- package/packages/daemon/src/tui/mirror/interaction-flow.ts +83 -0
- package/packages/daemon/src/tui/mirror/legacy/missions-workspace-loader.ts +117 -0
- package/packages/daemon/src/tui/mirror/menu-model.ts +28 -18
- package/packages/daemon/src/tui/mirror/missions-dashboard.ts +451 -0
- package/packages/daemon/src/tui/mirror/missions-render-fixtures.ts +371 -0
- package/packages/daemon/src/tui/mirror/missions-surface-controller.ts +530 -0
- package/packages/daemon/src/tui/mirror/missions-surface.tsx +434 -0
- package/packages/daemon/src/tui/mirror/missions-workspace.ts +1996 -0
- package/packages/daemon/src/tui/mirror/multiplexer-action-executor.ts +379 -0
- package/packages/daemon/src/tui/mirror/open-tui-pane-stream-socket.ts +47 -0
- package/packages/daemon/src/tui/mirror/open-tui-verified-routing.ts +83 -0
- package/packages/daemon/src/tui/mirror/open-tui-workspace-runtime-port.ts +1314 -0
- package/packages/daemon/src/tui/mirror/palette-surface-adapter.ts +465 -0
- package/packages/daemon/src/tui/mirror/palette.ts +485 -34
- package/packages/daemon/src/tui/mirror/pane-frame-state.ts +209 -0
- package/packages/daemon/src/tui/mirror/pane-mirror.ts +215 -50
- package/packages/daemon/src/tui/mirror/pane-surface.tsx +720 -51
- package/packages/daemon/src/tui/mirror/panel-host-reactive.ts +17 -0
- package/packages/daemon/src/tui/mirror/panel-host.ts +384 -0
- package/packages/daemon/src/tui/mirror/perf-tap.ts +1 -122
- package/packages/daemon/src/tui/mirror/performance-events.ts +488 -0
- package/packages/daemon/src/tui/mirror/recipe-components.tsx +310 -0
- package/packages/daemon/src/tui/mirror/recipes-gallery.tsx +256 -0
- package/packages/daemon/src/tui/mirror/recipes.ts +543 -0
- package/packages/daemon/src/tui/mirror/reference-performance-trace.ts +726 -0
- package/packages/daemon/src/tui/mirror/renderer-commands.ts +344 -0
- package/packages/daemon/src/tui/mirror/resize-model.ts +74 -9
- package/packages/daemon/src/tui/mirror/resize-transaction.ts +342 -0
- package/packages/daemon/src/tui/mirror/rich-placement-projection.ts +173 -0
- package/packages/daemon/src/tui/mirror/runtime/__snapshots__/application-shell-view-renderer.test.tsx.snap +87 -0
- package/packages/daemon/src/tui/mirror/runtime/application-appearance-owner.ts +121 -0
- package/packages/daemon/src/tui/mirror/runtime/application-bootstrap.ts +118 -0
- package/packages/daemon/src/tui/mirror/runtime/application-entry.ts +194 -0
- package/packages/daemon/src/tui/mirror/runtime/application-generation-starter.ts +116 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-catalog-owner.ts +112 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-catalog.ts +440 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-control-binding.ts +143 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-control-capability.ts +46 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-presentation.ts +176 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-test-control.ts +313 -0
- package/packages/daemon/src/tui/mirror/runtime/application-input-readiness.ts +28 -0
- package/packages/daemon/src/tui/mirror/runtime/application-lifecycle.ts +374 -0
- package/packages/daemon/src/tui/mirror/runtime/application-optional-features.ts +25 -0
- package/packages/daemon/src/tui/mirror/runtime/application-palette-command-owner.ts +87 -0
- package/packages/daemon/src/tui/mirror/runtime/application-palette-input.ts +105 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-rename-input.ts +43 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-rename-owner.ts +43 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pending-terminal-input.ts +117 -0
- package/packages/daemon/src/tui/mirror/runtime/application-performance-log.ts +110 -0
- package/packages/daemon/src/tui/mirror/runtime/application-post-render-runtime.ts +163 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-configuration.ts +47 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-renderer.ts +32 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +506 -0
- package/packages/daemon/src/tui/mirror/runtime/application-session-focus-owner.ts +80 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-binding.ts +365 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-catalog.tsx +372 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-home.tsx +161 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-overlay-stack.tsx +42 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-overlays.tsx +154 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-sidebar.tsx +140 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-view.tsx +425 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-viewport.ts +18 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-frame-readiness-owner.ts +33 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-host-focus-owner.ts +36 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-input-ingress.ts +133 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +1630 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-palette-owner.ts +302 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-paste.ts +33 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-renderer-sources.ts +33 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-selection-owner.ts +218 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-workspace-policy.ts +285 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-workspace.tsx +1150 -0
- package/packages/daemon/src/tui/mirror/runtime/application-theme-repaint.ts +45 -0
- package/packages/daemon/src/tui/mirror/runtime/application-transient-note-owner.ts +42 -0
- package/packages/daemon/src/tui/mirror/runtime/bounded-performance-record-writer.ts +75 -0
- package/packages/daemon/src/tui/mirror/runtime/causal-cell-client-ledger.ts +394 -0
- package/packages/daemon/src/tui/mirror/runtime/causal-cell-input-fixture.ts +55 -0
- package/packages/daemon/src/tui/mirror/runtime/changes-deferred-identity.ts +34 -0
- package/packages/daemon/src/tui/mirror/runtime/daemon-authority-rebind.ts +163 -0
- package/packages/daemon/src/tui/mirror/runtime/deferred-intent-queue.ts +45 -0
- package/packages/daemon/src/tui/mirror/runtime/editor-primitives.ts +56 -0
- package/packages/daemon/src/tui/mirror/runtime/file-content-primitives.ts +8 -0
- package/packages/daemon/src/tui/mirror/runtime/fleet-lifecycle-client.ts +61 -0
- package/packages/daemon/src/tui/mirror/runtime/focus-framebuffer-projection.ts +71 -0
- package/packages/daemon/src/tui/mirror/runtime/generation-bound-slot.ts +23 -0
- package/packages/daemon/src/tui/mirror/runtime/host-local-tmux-adapter.ts +105 -0
- package/packages/daemon/src/tui/mirror/runtime/hosted-tty-size-bridge.ts +213 -0
- package/packages/daemon/src/tui/mirror/runtime/latest-intent-fence.ts +22 -0
- package/packages/daemon/src/tui/mirror/runtime/local-view-controller.ts +95 -0
- package/packages/daemon/src/tui/mirror/runtime/modal-admission-coordinator.ts +158 -0
- package/packages/daemon/src/tui/mirror/runtime/modal-pointer-capture.ts +23 -0
- package/packages/daemon/src/tui/mirror/runtime/open-tui-generation-host.ts +996 -0
- package/packages/daemon/src/tui/mirror/runtime/open-tui-session-owner.ts +195 -0
- package/packages/daemon/src/tui/mirror/runtime/optional-feature-registry.ts +234 -0
- package/packages/daemon/src/tui/mirror/runtime/optional-feature-registry.typecheck.ts +14 -0
- package/packages/daemon/src/tui/mirror/runtime/palette-production-controller.ts +170 -0
- package/packages/daemon/src/tui/mirror/runtime/palette-production-overlay.tsx +65 -0
- package/packages/daemon/src/tui/mirror/runtime/pane-resize-geometry.ts +22 -0
- package/packages/daemon/src/tui/mirror/runtime/pane-scoped-terminal-surface.tsx +146 -0
- package/packages/daemon/src/tui/mirror/runtime/product-surface-policy.ts +16 -0
- package/packages/daemon/src/tui/mirror/runtime/renderer-cadence.ts +4 -0
- package/packages/daemon/src/tui/mirror/runtime/resize-terminal-pane.ts +134 -0
- package/packages/daemon/src/tui/mirror/runtime/rich-preview-demand.ts +26 -0
- package/packages/daemon/src/tui/mirror/runtime/rich-preview-overlay.tsx +54 -0
- package/packages/daemon/src/tui/mirror/runtime/runtime-layout-presentation.ts +119 -0
- package/packages/daemon/src/tui/mirror/runtime/select-terminal-pane.ts +127 -0
- package/packages/daemon/src/tui/mirror/runtime/semantic-pane-publication.ts +26 -0
- package/packages/daemon/src/tui/mirror/runtime/semantic-shell-viewport-resize.ts +78 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-dimensions-owner.ts +20 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.ts +719 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-frame-readiness.ts +100 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-host-focus.ts +519 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-host-frame-diagnostics.ts +47 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-input-adapter.ts +69 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-layout-projection.ts +45 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-pane-input-router.ts +94 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-selection.ts +218 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-session-handoff.ts +143 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-tool-readiness.ts +72 -0
- package/packages/daemon/src/tui/mirror/runtime/tool-resource-controller.ts +799 -0
- package/packages/daemon/src/tui/mirror/runtime/tool-resource-projection.ts +223 -0
- package/packages/daemon/src/tui/mirror/runtime/viewport-fit-coordinator.ts +12 -0
- package/packages/daemon/src/tui/mirror/runtime/workspace-terminal-fast-lane.ts +597 -0
- package/packages/daemon/src/tui/mirror/selection.ts +122 -29
- package/packages/daemon/src/tui/mirror/semantic-pane-render-source.ts +767 -0
- package/packages/daemon/src/tui/mirror/semantic-session-view.ts +366 -0
- package/packages/daemon/src/tui/mirror/settings-model.ts +95 -57
- package/packages/daemon/src/tui/mirror/shell-chrome-view.tsx +346 -0
- package/packages/daemon/src/tui/mirror/shell-chrome.ts +508 -0
- package/packages/daemon/src/tui/mirror/sidebar.tsx +321 -0
- package/packages/daemon/src/tui/mirror/size-truth.ts +53 -0
- package/packages/daemon/src/tui/mirror/terminal-surface.ts +157 -0
- package/packages/daemon/src/tui/mirror/terminal-surface.tsx +84 -0
- package/packages/daemon/src/tui/mirror/terminal-text.ts +42 -0
- package/packages/daemon/src/tui/mirror/theme.ts +1059 -0
- package/packages/daemon/src/tui/mirror/ui/agent-badge.tsx +41 -0
- package/packages/daemon/src/tui/mirror/ui/badge.tsx +42 -0
- package/packages/daemon/src/tui/mirror/ui/button.tsx +127 -0
- package/packages/daemon/src/tui/mirror/ui/dialog.tsx +45 -0
- package/packages/daemon/src/tui/mirror/ui/index.ts +59 -0
- package/packages/daemon/src/tui/mirror/ui/key-hint.tsx +63 -0
- package/packages/daemon/src/tui/mirror/ui/keyboard-router.tsx +72 -0
- package/packages/daemon/src/tui/mirror/ui/menu.tsx +68 -0
- package/packages/daemon/src/tui/mirror/ui/navigation-row.tsx +114 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-frame.tsx +115 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-host.tsx +71 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-list-row.tsx +59 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-model.ts +75 -0
- package/packages/daemon/src/tui/mirror/ui/state.ts +218 -0
- package/packages/daemon/src/tui/mirror/ui/status-bar.tsx +208 -0
- package/packages/daemon/src/tui/mirror/ui/surface.tsx +71 -0
- package/packages/daemon/src/tui/mirror/ui/tabs.tsx +168 -0
- package/packages/daemon/src/tui/mirror/widget-fallback.ts +66 -0
- package/packages/daemon/src/tui/mirror/widget-surface-model.ts +170 -0
- package/packages/daemon/src/tui/mirror/widget-surface.tsx +79 -0
- package/packages/daemon/src/tui/mirror/workspace/README.md +79 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/agent-terminal-canvas-renderer.test.tsx.snap +348 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/application-shell-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/command-palette-surface-renderer.test.tsx.snap +255 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/pane-frame-renderer.test.tsx.snap +525 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/workbench-shell-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/workspace/agent-terminal-canvas-view.tsx +61 -0
- package/packages/daemon/src/tui/mirror/workspace/agent-terminal-canvas.ts +131 -0
- package/packages/daemon/src/tui/mirror/workspace/application-root-controller.ts +169 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell-controller.ts +430 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell-surface-commands.ts +64 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell-view.tsx +169 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell.ts +179 -0
- package/packages/daemon/src/tui/mirror/workspace/command-palette-surface-view.tsx +356 -0
- package/packages/daemon/src/tui/mirror/workspace/command-palette-surface.ts +544 -0
- package/packages/daemon/src/tui/mirror/workspace/icons.ts +56 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-action-menu.tsx +68 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-frame.ts +675 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-frame.tsx +490 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-pane-chrome-view.tsx +125 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-pane-chrome.ts +833 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-pane-header.tsx +225 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-window-strip.tsx +466 -0
- package/packages/daemon/src/tui/mirror/workspace/text.ts +28 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-controller.ts +75 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-dock-opentui.tsx +224 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-shell.ts +486 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-shell.tsx +95 -0
- package/packages/daemon/src/tui/mirror/workspace-ui-state.ts +1278 -0
- package/packages/daemon/src/tui/readiness.ts +52 -0
- package/packages/daemon/src/tui/team/entry.ts +23 -13
- package/packages/daemon/src/tui/team/fuzzy.ts +20 -0
- package/packages/daemon/src/tui/team/home.ts +1 -1
- package/packages/daemon/src/tui/team/index.tsx +27 -8
- package/packages/daemon/src/tui/team/projects.ts +12 -0
- package/packages/daemon/src/tui/team/sessions.ts +119 -46
- package/packages/daemon/src/tui/team/wait-receipts.ts +192 -0
- package/packages/daemon/src/tui/team/wait.ts +144 -0
- package/packages/daemon/src/ui/pane-frame/fixture.ts +43 -0
- package/packages/daemon/src/ui/workbench-dock/fixture.ts +61 -0
- package/packages/daemon/src/validate.ts +21 -9
- package/packages/daemon/src/widgets/config/README.md +1 -1
- package/packages/daemon/src/widgets/config/index.tsx +15 -115
- package/packages/daemon/src/widgets/lib/watcher.ts +3 -130
- package/packages/daemon/src/widgets/resolve.ts +15 -7
- package/packages/daemon/src/widgets/setup/footer.tsx +0 -7
- package/packages/daemon/src/widgets/setup/index.tsx +18 -20
- package/packages/daemon/src/widgets/setup/review-panel.tsx +15 -10
- package/packages/daemon/src/widgets/setup/setup-model.ts +7 -10
- package/packages/daemon-client/package.json +42 -0
- package/packages/daemon-client/src/application-shell-session.test.ts +196 -0
- package/packages/daemon-client/src/application-shell-session.ts +450 -0
- package/packages/daemon-client/src/bootstrap-coordinator.test.ts +122 -0
- package/packages/daemon-client/src/bootstrap-coordinator.ts +293 -0
- package/packages/daemon-client/src/connection-supervisor.test.ts +109 -0
- package/packages/daemon-client/src/connection-supervisor.ts +216 -0
- package/packages/daemon-client/src/direct-application-shell-transport.test.ts +939 -0
- package/packages/daemon-client/src/direct-application-shell-transport.ts +1144 -0
- package/packages/daemon-client/src/first-latest-coordinator.test.ts +175 -0
- package/packages/daemon-client/src/first-latest-coordinator.ts +82 -0
- package/packages/daemon-client/src/generation-bound-store-timers.test.ts +74 -0
- package/packages/daemon-client/src/generation-bound-store.ts +908 -0
- package/packages/daemon-client/src/index.ts +25 -0
- package/packages/daemon-client/src/owner-action-client.test.ts +180 -0
- package/packages/daemon-client/src/owner-action-client.ts +113 -0
- package/packages/daemon-client/src/pane-stream-client.test.ts +2754 -0
- package/packages/daemon-client/src/pane-stream-client.ts +1665 -0
- package/packages/daemon-client/src/pane-stream-clock-calibration.test.ts +207 -0
- package/packages/daemon-client/src/pane-stream-clock-calibration.ts +161 -0
- package/packages/daemon-client/src/pane-stream-loopback-benchmark.test.ts +51 -0
- package/packages/daemon-client/src/push-resource-session.test.ts +509 -0
- package/packages/daemon-client/src/push-resource-session.ts +797 -0
- package/packages/daemon-client/src/resource-replica.test.ts +186 -0
- package/packages/daemon-client/src/resource-replica.ts +280 -0
- package/packages/daemon-client/src/runtime-resource-ledger.test.ts +18 -0
- package/packages/daemon-client/src/runtime-resource-ledger.ts +69 -0
- package/packages/daemon-client/src/terminal-fast-lane.test.ts +817 -0
- package/packages/daemon-client/src/terminal-fast-lane.ts +817 -0
- package/packages/daemon-client/src/terminal-fast-lane.typecheck.ts +16 -0
- package/packages/daemon-client/src/workspace-catalog-v2.test.ts +109 -0
- package/packages/daemon-client/src/workspace-catalog-v2.ts +66 -0
- package/packages/daemon-client/src/workspace-client-boundaries.test.ts +59 -0
- package/packages/daemon-client/src/workspace-client-conformance.ts +67 -0
- package/packages/daemon-client/src/workspace-client-operations.ts +203 -0
- package/packages/daemon-client/src/workspace-client-types.ts +302 -0
- package/packages/daemon-client/src/workspace-client.test.ts +2626 -0
- package/packages/daemon-client/src/workspace-client.ts +1421 -0
- package/packages/daemon-client/src/workspace-event-supervisor.test.ts +1086 -0
- package/packages/daemon-client/src/workspace-event-supervisor.ts +719 -0
- package/packages/daemon-client/src/workspace-pane-client.test.ts +80 -0
- package/packages/daemon-client/src/workspace-pane-client.ts +63 -0
- package/packages/presentation/package.json +28 -0
- package/packages/presentation/src/index.ts +2 -0
- package/packages/presentation/src/pane-frame/action-state.ts +72 -0
- package/packages/presentation/src/pane-frame/index.ts +3 -0
- package/packages/presentation/src/pane-frame/model.ts +517 -0
- package/packages/presentation/src/pane-frame/presenter.tsx +335 -0
- package/packages/presentation/src/pane-frame/web-entry.tsx +22 -0
- package/packages/presentation/src/pane-frame/web-host-unstyled.tsx +280 -0
- package/packages/presentation/src/pane-frame/web-host.css +388 -0
- package/packages/presentation/src/pane-frame/web-host.tsx +3 -0
- package/packages/presentation/src/presentation-contract.test.ts +63 -0
- package/packages/presentation/src/workbench-dock/index.ts +2 -0
- package/packages/presentation/src/workbench-dock/navigation.ts +54 -0
- package/packages/presentation/src/workbench-dock/presenter.tsx +252 -0
- package/packages/presentation/src/workbench-dock/web-entry.tsx +19 -0
- package/packages/presentation/src/workbench-dock/web-host-unstyled.tsx +198 -0
- package/packages/presentation/src/workbench-dock/web-host.css +204 -0
- package/packages/presentation/src/workbench-dock/web-host.tsx +3 -0
- package/packages/tmux-bridge/src/index.ts +9 -1
- package/packages/tmux-bridge/src/panes.ts +4 -0
- package/packages/tmux-bridge/src/runner.test.ts +72 -0
- package/packages/tmux-bridge/src/runner.ts +43 -2
- package/packages/tmux-bridge/src/sessions.ts +8 -1
- package/scripts/architecture-debt-budget.json +10 -0
- package/scripts/architecture-debt-inventory.mjs +98 -0
- package/scripts/build-cli.mjs +22 -1
- package/scripts/build-macos-notifier.mjs +160 -0
- package/scripts/build-tui.mjs +59 -3
- package/scripts/check-control-bytes.mjs +70 -0
- package/scripts/dev-web.mjs +66 -0
- package/scripts/lib/bounded-child-command.mjs +59 -0
- package/scripts/lib/bounded-child-command.test.mjs +148 -0
- package/scripts/lib/bounded-diagnostic-tail.mjs +82 -0
- package/scripts/lib/bounded-diagnostic-tail.test.mjs +97 -0
- package/scripts/lib/npm-release-tag.mjs +27 -0
- package/scripts/lib/npm-release-tag.test.mjs +116 -0
- package/scripts/lib/packed-opentui-frame.mjs +18 -0
- package/scripts/lib/packed-opentui-frame.test.mjs +40 -0
- package/scripts/lib/performance-reference-budgets.mjs +36 -0
- package/scripts/lib/performance-reference-report.mjs +157 -0
- package/scripts/lib/performance-reference-report.test.mjs +62 -0
- package/scripts/lib/portable-performance-evidence.mjs +210 -0
- package/scripts/lib/portable-performance-evidence.test.mjs +208 -0
- package/scripts/lib/product-ansi-cursor-alt-screen-fixture.mjs +132 -0
- package/scripts/lib/product-ansi-cursor-alt-screen.mjs +4618 -0
- package/scripts/lib/product-ansi-cursor-alt-screen.test.mjs +4120 -0
- package/scripts/lib/product-ansi-tmux-precondition.mjs +159 -0
- package/scripts/lib/product-ansi-tmux-precondition.test.mjs +147 -0
- package/scripts/lib/product-card5-host-topology.mjs +873 -0
- package/scripts/lib/product-card5-host-topology.test.mjs +1070 -0
- package/scripts/lib/product-card5-production-host-owner.mjs +4864 -0
- package/scripts/lib/product-card5-production-host-owner.test.mjs +5051 -0
- package/scripts/lib/product-configless-owner.mjs +1578 -0
- package/scripts/lib/product-configless-owner.test.mjs +2169 -0
- package/scripts/lib/product-cross-client-handoff.mjs +1165 -0
- package/scripts/lib/product-cross-client-handoff.test.mjs +1062 -0
- package/scripts/lib/product-cross-client-host-evidence.mjs +4780 -0
- package/scripts/lib/product-cross-client-host-evidence.test.mjs +3897 -0
- package/scripts/lib/product-first-input.mjs +1546 -0
- package/scripts/lib/product-first-input.test.mjs +1731 -0
- package/scripts/lib/product-focus-tmux.mjs +46 -0
- package/scripts/lib/product-focus.mjs +1198 -0
- package/scripts/lib/product-focus.test.mjs +1504 -0
- package/scripts/lib/product-idle-process-proof.mjs +270 -0
- package/scripts/lib/product-idle-process-proof.test.mjs +210 -0
- package/scripts/lib/product-keyboard-pointer-resize.mjs +471 -0
- package/scripts/lib/product-keyboard-pointer-resize.test.mjs +363 -0
- package/scripts/lib/product-rig-causal-cell-fixture.mjs +91 -0
- package/scripts/lib/product-rig-causal-fixture-geometry.mjs +27 -0
- package/scripts/lib/product-rig-causal-fixture-geometry.test.mjs +45 -0
- package/scripts/lib/product-rig-sleep-assertion.mjs +179 -0
- package/scripts/lib/product-selection-copy-app-mouse.mjs +1585 -0
- package/scripts/lib/product-selection-copy-app-mouse.test.mjs +1602 -0
- package/scripts/lib/product-tui-host-readiness.mjs +133 -0
- package/scripts/lib/product-tui-host-readiness.test.mjs +258 -0
- package/scripts/lib/product-window-lifecycle.mjs +1351 -0
- package/scripts/lib/product-window-lifecycle.test.mjs +1305 -0
- package/scripts/lib/release-source-state.mjs +28 -0
- package/scripts/lib/release-source-state.test.mjs +26 -0
- package/scripts/lib/tui-diagnostics.mjs +159 -0
- package/scripts/lib/tui-host-publication.mjs +38 -0
- package/scripts/lib/tui-testdrive-clipboard-hook.mjs +543 -0
- package/scripts/lib/tui-testdrive-clipboard-hook.test.mjs +626 -0
- package/scripts/lib/tui-testdrive-input.mjs +1940 -0
- package/scripts/lib/tui-testdrive-input.test.mjs +3434 -0
- package/scripts/lib/tui-testdrive-launch.mjs +180 -0
- package/scripts/lib/tui-testdrive-launch.test.mjs +294 -0
- package/scripts/opentui-release-check.mjs +209 -0
- package/scripts/pack-check-run.mjs +1779 -30
- package/scripts/pack-tui-check.mjs +73 -0
- package/scripts/pack-web-check.mjs +19 -0
- package/scripts/performance-portable-evidence.mjs +419 -0
- package/scripts/performance-qualification.mjs +456 -0
- package/scripts/performance-reference-memory.ts +177 -0
- package/scripts/performance-reference-pane-stream.ts +74 -0
- package/scripts/performance-reference.mjs +681 -0
- package/scripts/postinstall.js +14 -6
- package/scripts/prepublish-check.mjs +37 -1
- package/scripts/prepublish-opentui-check.mjs +24 -0
- package/scripts/product-test-rig-journeys.mjs +2700 -0
- package/scripts/product-test-rig-journeys.test.mjs +3959 -0
- package/scripts/product-test-rig-lib.mjs +2359 -0
- package/scripts/product-test-rig-multiclient.ts +434 -0
- package/scripts/product-test-rig-native-client.mjs +45 -0
- package/scripts/product-test-rig.mjs +20260 -0
- package/scripts/product-test-rig.test.mjs +3634 -0
- package/scripts/publish-tap.sh +55 -0
- package/scripts/smoke-tui-missions.mjs +329 -0
- package/scripts/tui-diagnose.mjs +258 -0
- package/scripts/tui-diagnose.test.mjs +200 -0
- package/scripts/tui-testdrive-capture.test.mjs +161 -0
- package/scripts/tui-testdrive.mjs +1955 -0
- package/skill/SKILL.md +115 -30
- package/templates/agent-team-monorepo.yml +28 -30
- package/templates/agent-team-nextjs.yml +24 -26
- package/templates/agent-team.yml +24 -24
- package/templates/convex.yml +24 -16
- package/templates/default.yml +26 -21
- package/templates/go.yml +21 -14
- package/templates/missions.yml +25 -40
- package/templates/nextjs.yml +24 -16
- package/templates/python.yml +21 -14
- package/templates/vite.yml +21 -14
- package/packages/daemon/dist/widgets/changes/index.jsx +0 -575
- package/packages/daemon/dist/widgets/config/index.d.ts +0 -1
- package/packages/daemon/dist/widgets/config/index.jsx +0 -395
- package/packages/daemon/dist/widgets/explorer/breadcrumbs.d.ts +0 -10
- package/packages/daemon/dist/widgets/explorer/breadcrumbs.jsx +0 -51
- package/packages/daemon/dist/widgets/explorer/footer.d.ts +0 -6
- package/packages/daemon/dist/widgets/explorer/footer.jsx +0 -11
- package/packages/daemon/dist/widgets/explorer/index.jsx +0 -393
- package/packages/daemon/dist/widgets/explorer/tree.d.ts +0 -13
- package/packages/daemon/dist/widgets/explorer/tree.jsx +0 -108
- package/packages/daemon/dist/widgets/lib/help-overlay.d.ts +0 -19
- package/packages/daemon/dist/widgets/lib/help-overlay.jsx +0 -69
- package/packages/daemon/dist/widgets/preview/index.jsx +0 -371
- package/packages/daemon/dist/widgets/setup/agent-naming.d.ts +0 -9
- package/packages/daemon/dist/widgets/setup/agent-naming.jsx +0 -81
- package/packages/daemon/dist/widgets/setup/config-tree.d.ts +0 -13
- package/packages/daemon/dist/widgets/setup/config-tree.jsx +0 -203
- package/packages/daemon/dist/widgets/setup/detect-panel.d.ts +0 -14
- package/packages/daemon/dist/widgets/setup/detect-panel.jsx +0 -48
- package/packages/daemon/dist/widgets/setup/field-editor.d.ts +0 -12
- package/packages/daemon/dist/widgets/setup/field-editor.jsx +0 -163
- package/packages/daemon/dist/widgets/setup/footer.d.ts +0 -17
- package/packages/daemon/dist/widgets/setup/footer.jsx +0 -64
- package/packages/daemon/dist/widgets/setup/index.d.ts +0 -1
- package/packages/daemon/dist/widgets/setup/index.jsx +0 -261
- package/packages/daemon/dist/widgets/setup/layout-picker.d.ts +0 -9
- package/packages/daemon/dist/widgets/setup/layout-picker.jsx +0 -69
- package/packages/daemon/dist/widgets/sidebar/index.jsx +0 -462
- package/packages/daemon/src/tui/mirror/control-client.ts +0 -214
- package/packages/daemon/src/tui/mirror/focus-border.ts +0 -57
- package/packages/daemon/src/tui/mirror/session-mirror.ts +0 -443
- package/packages/daemon/src/widgets/setup/orchestrator-panel.tsx +0 -200
- package/scripts/perf-mirror.mjs +0 -313
- package/scripts/verify-endpoints.sh +0 -90
- /package/packages/daemon/dist/{widgets/changes/index.d.ts → lib/__tests__/fixtures/workspace-state-writer.d.ts} +0 -0
- /package/packages/daemon/dist/{widgets/explorer/index.d.ts → terminal/mirror/trusted-inventory.js} +0 -0
- /package/packages/daemon/dist/{widgets/preview/index.d.ts → terminal/session-runtime/terminal-interpreter-backend.js} +0 -0
- /package/packages/daemon/dist/{widgets/sidebar/index.d.ts → tui/mirror/features/changes/contract.js} +0 -0
|
@@ -0,0 +1,3959 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { createHmac } from "node:crypto";
|
|
4
|
+
import {
|
|
5
|
+
chmodSync,
|
|
6
|
+
existsSync,
|
|
7
|
+
mkdirSync,
|
|
8
|
+
mkdtempSync,
|
|
9
|
+
lstatSync,
|
|
10
|
+
readFileSync,
|
|
11
|
+
readdirSync,
|
|
12
|
+
renameSync,
|
|
13
|
+
rmSync,
|
|
14
|
+
statSync,
|
|
15
|
+
symlinkSync,
|
|
16
|
+
unlinkSync,
|
|
17
|
+
writeFileSync,
|
|
18
|
+
} from "node:fs";
|
|
19
|
+
import { tmpdir } from "node:os";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import test from "node:test";
|
|
22
|
+
|
|
23
|
+
import { createScratchFleet } from "../apps/desktop-renderer/e2e/fixtures/scratch-fleet.ts";
|
|
24
|
+
import {
|
|
25
|
+
productCoherentFrameTimeoutObservation,
|
|
26
|
+
summarizeProductInputDistribution,
|
|
27
|
+
} from "./lib/product-first-input.mjs";
|
|
28
|
+
|
|
29
|
+
import {
|
|
30
|
+
PRODUCT_DIAGNOSTIC_BUNDLE_FILES,
|
|
31
|
+
PRODUCT_JOURNEY_REGISTRY,
|
|
32
|
+
ProductJourneyAttemptError,
|
|
33
|
+
auditProductJourneyScope,
|
|
34
|
+
acquireLegacyProductRigCleanupLedger,
|
|
35
|
+
assessLegacyProductRigCleanupAdmission,
|
|
36
|
+
assessLegacyProductRigOwnerRetryCompatibility,
|
|
37
|
+
assessLegacyProductRigOwnerRetryCompletion,
|
|
38
|
+
assessProductSessionRecreateEvidence,
|
|
39
|
+
createLegacyProductRigOwnerRetryIntent,
|
|
40
|
+
acquireLegacyProductRigOwnerRetryIntent,
|
|
41
|
+
legacyProductRigOwnerRetryIntentMatchesState,
|
|
42
|
+
legacyProductRigOwnerRetryIntentMatchesOwnerRows,
|
|
43
|
+
createLegacyProductRigOwnerRetryShutdownRequest,
|
|
44
|
+
createLegacyProductRigOwnerRetryReceipt,
|
|
45
|
+
acquireLegacyProductRigOwnerRetryReceipt,
|
|
46
|
+
finalizeLegacyProductRigOwnerRetry,
|
|
47
|
+
assessProductRigRetainedProcessAbsence,
|
|
48
|
+
captureLegacyProductRigCleanupLedger,
|
|
49
|
+
bufferOwnedTuiRuntimeEvidence,
|
|
50
|
+
collectProductRigCleanupFailures,
|
|
51
|
+
createProductRigCleanupReceipt,
|
|
52
|
+
createProductDiagnosticBundle,
|
|
53
|
+
createIsolatedTargetedTuiCwd,
|
|
54
|
+
dispatchProductJourneyExecutor,
|
|
55
|
+
expandProductJourneyEntries,
|
|
56
|
+
isCleanLegacyStoppedProductRigState,
|
|
57
|
+
isProductRigPendingReapAck,
|
|
58
|
+
parseProductDiagnoseOptions,
|
|
59
|
+
prepareIsolatedTargetedTuiCwd,
|
|
60
|
+
prepareOwnedTuiRuntime,
|
|
61
|
+
prepareProductDiagnosticBundlePublication,
|
|
62
|
+
productDiagnosticRunId,
|
|
63
|
+
productRigCleanupAcknowledgesRequest,
|
|
64
|
+
productRigCleanupBarrierFailures,
|
|
65
|
+
productRigTerminalFailureError,
|
|
66
|
+
productRigTerminalFailureState,
|
|
67
|
+
resolveProductJourneyPlan,
|
|
68
|
+
retireLegacyProductRigCleanupIdentities,
|
|
69
|
+
retireProductRigCleanupProofFiles,
|
|
70
|
+
runIsolatedProductJourneyAttempt,
|
|
71
|
+
runConfiglessProductJourneyOwnerBoot,
|
|
72
|
+
runCoherentFirstPaneOwnerBoot,
|
|
73
|
+
runFirstKeyPasteOwnerBoot,
|
|
74
|
+
runFocusOwnerBoot,
|
|
75
|
+
runKeyboardPointerResizeOwnerBoot,
|
|
76
|
+
runSelectionCopyAppMouseOwnerBoot,
|
|
77
|
+
runAnsiCursorAltScreenOwnerBoot,
|
|
78
|
+
runCrossClientHandoffOwnerBoot,
|
|
79
|
+
runDaemonRestartOwnerBoot,
|
|
80
|
+
runSessionRecreateOwnerBoot,
|
|
81
|
+
runWindowLifecycleOwnerBoot,
|
|
82
|
+
runProductJourneyPlan,
|
|
83
|
+
settleInternalProductRigCleanup,
|
|
84
|
+
startOwnedProductRigDaemon,
|
|
85
|
+
} from "./product-test-rig-journeys.mjs";
|
|
86
|
+
|
|
87
|
+
const unavailableWebPng = Buffer.from(
|
|
88
|
+
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
|
|
89
|
+
"base64",
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
function removeTestTree(path) {
|
|
93
|
+
if (!existsSync(path)) return;
|
|
94
|
+
chmodSync(path, 0o700);
|
|
95
|
+
for (const entry of readdirSync(path, { withFileTypes: true })) {
|
|
96
|
+
const child = join(path, entry.name);
|
|
97
|
+
if (entry.isDirectory()) removeTestTree(child);
|
|
98
|
+
else chmodSync(child, 0o600);
|
|
99
|
+
}
|
|
100
|
+
rmSync(path, { recursive: true, force: true });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function failureEvidence(boundary, message) {
|
|
104
|
+
const report = { status: "failed", firstBrokenBoundary: boundary, failure: message };
|
|
105
|
+
return {
|
|
106
|
+
report,
|
|
107
|
+
alignment: { firstBrokenBoundary: boundary, correlation: { complete: false } },
|
|
108
|
+
timeline: "",
|
|
109
|
+
tmuxTruth: { status: "unavailable" },
|
|
110
|
+
daemonState: { revision: null },
|
|
111
|
+
clientState: { committed: null, pending: null, derived: null },
|
|
112
|
+
tuiAnsi: "[unavailable]\n",
|
|
113
|
+
webPng: unavailableWebPng,
|
|
114
|
+
stderr: "",
|
|
115
|
+
reproduction: "#!/bin/sh\nexit 1\n",
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function attemptEntry(runId, repetition = 1) {
|
|
120
|
+
return {
|
|
121
|
+
journey: { id: "runtime-qualification" },
|
|
122
|
+
repetition,
|
|
123
|
+
repeat: 2,
|
|
124
|
+
runId,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function cleanupReceipt(runId, overrides = {}) {
|
|
129
|
+
return {
|
|
130
|
+
version: 1,
|
|
131
|
+
runId,
|
|
132
|
+
requestId: "cleanup-request-1",
|
|
133
|
+
attempt: 1,
|
|
134
|
+
passed: true,
|
|
135
|
+
completedAt: "2026-08-18T10:30:11.842Z",
|
|
136
|
+
ownerPid: 1001,
|
|
137
|
+
daemon: { status: "started", instanceId: "daemon-generation-1", pid: 1002 },
|
|
138
|
+
namespaceDigest: "a".repeat(64),
|
|
139
|
+
ownerDead: true,
|
|
140
|
+
daemonDead: true,
|
|
141
|
+
pathsAbsent: true,
|
|
142
|
+
pathAbsence: {
|
|
143
|
+
runtimeRoot: true,
|
|
144
|
+
tmuxSocket: true,
|
|
145
|
+
hostTmuxSocket: true,
|
|
146
|
+
daemonInfo: true,
|
|
147
|
+
tuiRuntime: true,
|
|
148
|
+
},
|
|
149
|
+
failureCount: 0,
|
|
150
|
+
...overrides,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
test("golden registry enables only accepted direct journey executors", () => {
|
|
155
|
+
const expected = [
|
|
156
|
+
"configless-cold-start",
|
|
157
|
+
"coherent-first-pane",
|
|
158
|
+
"first-key-paste",
|
|
159
|
+
"focus",
|
|
160
|
+
"window-lifecycle",
|
|
161
|
+
"keyboard-pointer-resize",
|
|
162
|
+
"selection-copy-app-mouse",
|
|
163
|
+
"ansi-cursor-alt-screen",
|
|
164
|
+
"cross-client-handoff",
|
|
165
|
+
"daemon-restart",
|
|
166
|
+
"session-recreate",
|
|
167
|
+
];
|
|
168
|
+
const golden = PRODUCT_JOURNEY_REGISTRY.filter(({ id }) => id !== "runtime-qualification");
|
|
169
|
+
assert.deepEqual(
|
|
170
|
+
golden.map(({ id }) => id),
|
|
171
|
+
expected,
|
|
172
|
+
);
|
|
173
|
+
assert.ok(golden.every(({ implementation }) => implementation === "implemented"));
|
|
174
|
+
assert.deepEqual(auditProductJourneyScope(), {
|
|
175
|
+
complete: true,
|
|
176
|
+
declarationComplete: true,
|
|
177
|
+
executableComplete: true,
|
|
178
|
+
missing: [],
|
|
179
|
+
pendingJourneyIds: [],
|
|
180
|
+
});
|
|
181
|
+
assert.deepEqual(auditProductJourneyScope(golden.slice(1)), {
|
|
182
|
+
complete: false,
|
|
183
|
+
declarationComplete: false,
|
|
184
|
+
executableComplete: true,
|
|
185
|
+
missing: ["configless", "cold-start"],
|
|
186
|
+
pendingJourneyIds: [],
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test("session recreate owner fences G1 before same-name G2 and accepts new input last", async () => {
|
|
191
|
+
const calls = [];
|
|
192
|
+
const value = (name) => Object.freeze({ name });
|
|
193
|
+
const operation = (name) => async () => (calls.push(name), value(name));
|
|
194
|
+
const operations = {
|
|
195
|
+
onBoundary: (boundary) => calls.push(`boundary:${boundary}`),
|
|
196
|
+
createNamespace: operation("namespace"),
|
|
197
|
+
startDaemon: operation("daemon"),
|
|
198
|
+
openWorkspace: operation("workspace"),
|
|
199
|
+
build: operation("build"),
|
|
200
|
+
launch: operation("launch"),
|
|
201
|
+
proveBefore: operation("before"),
|
|
202
|
+
killSession: operation("kill"),
|
|
203
|
+
proveRetired: operation("retired"),
|
|
204
|
+
proveOldInputRejected: operation("stale-input"),
|
|
205
|
+
recreateSession: operation("recreate"),
|
|
206
|
+
proveRecovered: operation("recovered"),
|
|
207
|
+
proveNewInputOnce: operation("new-input"),
|
|
208
|
+
proveNoStaleResidue: operation("residue"),
|
|
209
|
+
};
|
|
210
|
+
const result = await runSessionRecreateOwnerBoot(operations);
|
|
211
|
+
assert.equal("daemon" in result, false);
|
|
212
|
+
assert.deepEqual(calls, [
|
|
213
|
+
"boundary:session-recreate-namespace-ready",
|
|
214
|
+
"namespace",
|
|
215
|
+
"boundary:session-recreate-daemon-ready",
|
|
216
|
+
"daemon",
|
|
217
|
+
"boundary:session-recreate-workspace-ready",
|
|
218
|
+
"workspace",
|
|
219
|
+
"boundary:session-recreate-tui-build",
|
|
220
|
+
"build",
|
|
221
|
+
"boundary:session-recreate-tui-started",
|
|
222
|
+
"launch",
|
|
223
|
+
"boundary:session-recreate-before-coherent",
|
|
224
|
+
"before",
|
|
225
|
+
"boundary:session-recreate-session-killed",
|
|
226
|
+
"kill",
|
|
227
|
+
"boundary:session-recreate-old-retired",
|
|
228
|
+
"retired",
|
|
229
|
+
"boundary:session-recreate-old-input-rejected",
|
|
230
|
+
"stale-input",
|
|
231
|
+
"boundary:session-recreate-same-name-created",
|
|
232
|
+
"recreate",
|
|
233
|
+
"boundary:session-recreate-new-generation-live",
|
|
234
|
+
"recovered",
|
|
235
|
+
"boundary:session-recreate-new-input-once",
|
|
236
|
+
"new-input",
|
|
237
|
+
"boundary:session-recreate-no-stale-residue",
|
|
238
|
+
"residue",
|
|
239
|
+
]);
|
|
240
|
+
for (const method of Object.keys(operations).filter((key) => key !== "onBoundary")) {
|
|
241
|
+
await assert.rejects(
|
|
242
|
+
runSessionRecreateOwnerBoot({
|
|
243
|
+
...operations,
|
|
244
|
+
[method]: async () => {
|
|
245
|
+
throw new Error(`failed ${method}`);
|
|
246
|
+
},
|
|
247
|
+
}),
|
|
248
|
+
/failed/u,
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test("session recreate assessment rejects identity reuse, stale input, and restart residue", () => {
|
|
254
|
+
const passing = {
|
|
255
|
+
before: {
|
|
256
|
+
sessionName: "ordinary",
|
|
257
|
+
sessionId: "$1",
|
|
258
|
+
paneId: "%1",
|
|
259
|
+
semanticPaneId: "pane.old",
|
|
260
|
+
cwd: "/tmp/old",
|
|
261
|
+
},
|
|
262
|
+
retired: { catalogAbsent: true, workspaceUnavailable: true, oldPaneAbsent: true },
|
|
263
|
+
staleInput: { submittedWhileRetired: true },
|
|
264
|
+
recreated: {
|
|
265
|
+
sessionName: "ordinary",
|
|
266
|
+
sessionId: "$2",
|
|
267
|
+
paneId: "%2",
|
|
268
|
+
semanticPaneId: "pane.new",
|
|
269
|
+
cwd: "/tmp/new",
|
|
270
|
+
},
|
|
271
|
+
recovered: {
|
|
272
|
+
status: "live",
|
|
273
|
+
semanticPaneId: "pane.new",
|
|
274
|
+
oldSemanticPanePresent: false,
|
|
275
|
+
styledContentRestored: true,
|
|
276
|
+
staleInputRejected: true,
|
|
277
|
+
},
|
|
278
|
+
acceptedInput: { occurrences: 1, semanticPaneId: "pane.new" },
|
|
279
|
+
residue: { oldRegistryEntries: 0, oldSidebarEntries: 0, oldProcessAlive: false },
|
|
280
|
+
hostile: {
|
|
281
|
+
daemonSigkill: {
|
|
282
|
+
predecessorDead: true,
|
|
283
|
+
staleRecordRetained: true,
|
|
284
|
+
generationChanged: true,
|
|
285
|
+
status: "live",
|
|
286
|
+
inputOccurrences: 1,
|
|
287
|
+
},
|
|
288
|
+
tmuxServerRecreate: {
|
|
289
|
+
predecessorFenced: true,
|
|
290
|
+
oldPaneDead: true,
|
|
291
|
+
sessionIdChanged: true,
|
|
292
|
+
daemonGenerationChanged: true,
|
|
293
|
+
status: "live",
|
|
294
|
+
inputOccurrences: 1,
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
assert.deepEqual(assessProductSessionRecreateEvidence(passing), {
|
|
299
|
+
passed: true,
|
|
300
|
+
firstFailed: null,
|
|
301
|
+
checks: {
|
|
302
|
+
oldIdentityExact: true,
|
|
303
|
+
exactRetirement: true,
|
|
304
|
+
staleInputRejected: true,
|
|
305
|
+
reincarnated: true,
|
|
306
|
+
recoveredExact: true,
|
|
307
|
+
newInputOnce: true,
|
|
308
|
+
noResidue: true,
|
|
309
|
+
daemonSigkillRecovered: true,
|
|
310
|
+
tmuxServerRecreateRecovered: true,
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
for (const mutation of [
|
|
314
|
+
{ recreated: { ...passing.recreated, sessionId: "$1" } },
|
|
315
|
+
{ recovered: { ...passing.recovered, staleInputRejected: false } },
|
|
316
|
+
{ acceptedInput: { occurrences: 2, semanticPaneId: "pane.new" } },
|
|
317
|
+
{ residue: { ...passing.residue, oldSidebarEntries: 1 } },
|
|
318
|
+
{
|
|
319
|
+
hostile: {
|
|
320
|
+
...passing.hostile,
|
|
321
|
+
daemonSigkill: { ...passing.hostile.daemonSigkill, staleRecordRetained: false },
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
hostile: {
|
|
326
|
+
...passing.hostile,
|
|
327
|
+
tmuxServerRecreate: {
|
|
328
|
+
...passing.hostile.tmuxServerRecreate,
|
|
329
|
+
predecessorFenced: false,
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
]) {
|
|
334
|
+
assert.equal(assessProductSessionRecreateEvidence({ ...passing, ...mutation }).passed, false);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
test("Card5 owner drives production clients through exact restart/correlation boundaries", async () => {
|
|
339
|
+
const calls = [];
|
|
340
|
+
const operation = (name) => async () => (calls.push(name), { name });
|
|
341
|
+
await runCrossClientHandoffOwnerBoot({
|
|
342
|
+
onBoundary: (boundary) => calls.push(`boundary:${boundary}`),
|
|
343
|
+
createProductionHosts: operation("hosts"),
|
|
344
|
+
waitInitialConvergence: operation("initial"),
|
|
345
|
+
driveAuthorityHandoff: operation("handoff"),
|
|
346
|
+
provePassiveGeometry: operation("geometry"),
|
|
347
|
+
proveSlowWebIsolation: operation("slow"),
|
|
348
|
+
restartDaemon: operation("restart"),
|
|
349
|
+
waitRestartConvergence: operation("after"),
|
|
350
|
+
proveNativeObserver: operation("native"),
|
|
351
|
+
sealCorrelation: operation("correlation"),
|
|
352
|
+
});
|
|
353
|
+
assert.deepEqual(calls, [
|
|
354
|
+
"boundary:cross-client-production-hosts",
|
|
355
|
+
"hosts",
|
|
356
|
+
"boundary:cross-client-initial-convergence",
|
|
357
|
+
"initial",
|
|
358
|
+
"boundary:cross-client-authority-handoff",
|
|
359
|
+
"handoff",
|
|
360
|
+
"boundary:cross-client-passive-geometry",
|
|
361
|
+
"geometry",
|
|
362
|
+
"boundary:cross-client-slow-web-isolation",
|
|
363
|
+
"slow",
|
|
364
|
+
"boundary:cross-client-daemon-restart",
|
|
365
|
+
"restart",
|
|
366
|
+
"boundary:cross-client-restart-convergence",
|
|
367
|
+
"after",
|
|
368
|
+
"boundary:cross-client-native-observer",
|
|
369
|
+
"native",
|
|
370
|
+
"boundary:cross-client-correlation-privacy",
|
|
371
|
+
"correlation",
|
|
372
|
+
]);
|
|
373
|
+
for (const method of [
|
|
374
|
+
"createProductionHosts",
|
|
375
|
+
"waitInitialConvergence",
|
|
376
|
+
"driveAuthorityHandoff",
|
|
377
|
+
"provePassiveGeometry",
|
|
378
|
+
"proveSlowWebIsolation",
|
|
379
|
+
"restartDaemon",
|
|
380
|
+
"waitRestartConvergence",
|
|
381
|
+
"proveNativeObserver",
|
|
382
|
+
"sealCorrelation",
|
|
383
|
+
]) {
|
|
384
|
+
await assert.rejects(
|
|
385
|
+
runCrossClientHandoffOwnerBoot({
|
|
386
|
+
createProductionHosts: operation("hosts"),
|
|
387
|
+
waitInitialConvergence: operation("initial"),
|
|
388
|
+
driveAuthorityHandoff: operation("handoff"),
|
|
389
|
+
provePassiveGeometry: operation("geometry"),
|
|
390
|
+
proveSlowWebIsolation: operation("slow"),
|
|
391
|
+
restartDaemon: operation("restart"),
|
|
392
|
+
waitRestartConvergence: operation("after"),
|
|
393
|
+
proveNativeObserver: operation("native"),
|
|
394
|
+
sealCorrelation: operation("correlation"),
|
|
395
|
+
[method]: async () => {
|
|
396
|
+
throw new Error(`failed ${method}`);
|
|
397
|
+
},
|
|
398
|
+
}),
|
|
399
|
+
/failed/u,
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
test("Card5 daemon restart owner has a distinct fail-closed phase vector", async () => {
|
|
405
|
+
const calls = [];
|
|
406
|
+
const operation = (name) => async () => (calls.push(name), { name });
|
|
407
|
+
await runDaemonRestartOwnerBoot({
|
|
408
|
+
onBoundary: (boundary) => calls.push(`boundary:${boundary}`),
|
|
409
|
+
createProductionHosts: operation("hosts"),
|
|
410
|
+
waitBeforeConvergence: operation("before"),
|
|
411
|
+
replaceDaemon: operation("replace"),
|
|
412
|
+
proveStaleFence: operation("stale"),
|
|
413
|
+
waitHostsReconnected: operation("reconnect"),
|
|
414
|
+
waitCanonicalConvergence: operation("after"),
|
|
415
|
+
sealRestartCorrelation: operation("correlation"),
|
|
416
|
+
});
|
|
417
|
+
assert.deepEqual(calls, [
|
|
418
|
+
"boundary:daemon-restart-production-hosts",
|
|
419
|
+
"hosts",
|
|
420
|
+
"boundary:daemon-restart-before-convergence",
|
|
421
|
+
"before",
|
|
422
|
+
"boundary:daemon-restart-generation-replaced",
|
|
423
|
+
"replace",
|
|
424
|
+
"boundary:daemon-restart-stale-authority-rejected",
|
|
425
|
+
"stale",
|
|
426
|
+
"boundary:daemon-restart-hosts-reconnected",
|
|
427
|
+
"reconnect",
|
|
428
|
+
"boundary:daemon-restart-canonical-convergence",
|
|
429
|
+
"after",
|
|
430
|
+
"boundary:daemon-restart-correlation-privacy",
|
|
431
|
+
"correlation",
|
|
432
|
+
]);
|
|
433
|
+
for (const method of [
|
|
434
|
+
"createProductionHosts",
|
|
435
|
+
"waitBeforeConvergence",
|
|
436
|
+
"replaceDaemon",
|
|
437
|
+
"proveStaleFence",
|
|
438
|
+
"waitHostsReconnected",
|
|
439
|
+
"waitCanonicalConvergence",
|
|
440
|
+
"sealRestartCorrelation",
|
|
441
|
+
]) {
|
|
442
|
+
await assert.rejects(
|
|
443
|
+
runDaemonRestartOwnerBoot({
|
|
444
|
+
createProductionHosts: operation("hosts"),
|
|
445
|
+
waitBeforeConvergence: operation("before"),
|
|
446
|
+
replaceDaemon: operation("replace"),
|
|
447
|
+
proveStaleFence: operation("stale"),
|
|
448
|
+
waitHostsReconnected: operation("reconnect"),
|
|
449
|
+
waitCanonicalConvergence: operation("after"),
|
|
450
|
+
sealRestartCorrelation: operation("correlation"),
|
|
451
|
+
[method]: async () => {
|
|
452
|
+
throw new Error(`failed ${method}`);
|
|
453
|
+
},
|
|
454
|
+
}),
|
|
455
|
+
/failed/u,
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
test("window lifecycle owner preserves exact create switch rename Web ordering and boundaries", async () => {
|
|
461
|
+
const calls = [];
|
|
462
|
+
const renamedValue = Object.freeze({ windows: ["post-rename"] });
|
|
463
|
+
const operation =
|
|
464
|
+
(name, value = {}) =>
|
|
465
|
+
async () => (calls.push(name), value);
|
|
466
|
+
const operations = {
|
|
467
|
+
onBoundary: (boundary) => calls.push(`boundary:${boundary}`),
|
|
468
|
+
createWindowNamespace: operation("namespace"),
|
|
469
|
+
startCanonicalDaemon: operation("daemon"),
|
|
470
|
+
openCanonicalWorkspace: operation("workspace"),
|
|
471
|
+
buildBeforeMeasurement: operation("build"),
|
|
472
|
+
launchWindowTui: operation("tui-started"),
|
|
473
|
+
waitForWindowHostReady: operation("host"),
|
|
474
|
+
waitForWindowTuiCoherent: operation("tui"),
|
|
475
|
+
proveWindowBaseline: operation("baseline"),
|
|
476
|
+
createWindow: operation("create"),
|
|
477
|
+
primeCreatedWindow: operation("prime"),
|
|
478
|
+
renameWindow: operation("rename", renamedValue),
|
|
479
|
+
driveWarmSwitches: async (...args) => {
|
|
480
|
+
calls.push("switch");
|
|
481
|
+
assert.equal(args[6], renamedValue);
|
|
482
|
+
return {};
|
|
483
|
+
},
|
|
484
|
+
startWebAfterWindowLifecycle: operation("web"),
|
|
485
|
+
};
|
|
486
|
+
await runWindowLifecycleOwnerBoot(operations);
|
|
487
|
+
assert.deepEqual(calls, [
|
|
488
|
+
"boundary:window-namespace-ready",
|
|
489
|
+
"namespace",
|
|
490
|
+
"boundary:window-daemon-ready",
|
|
491
|
+
"daemon",
|
|
492
|
+
"boundary:window-daemon-ready",
|
|
493
|
+
"workspace",
|
|
494
|
+
"boundary:window-tui-build",
|
|
495
|
+
"build",
|
|
496
|
+
"boundary:window-tui-started",
|
|
497
|
+
"tui-started",
|
|
498
|
+
"boundary:window-host-ready",
|
|
499
|
+
"host",
|
|
500
|
+
"boundary:window-tui-coherent",
|
|
501
|
+
"tui",
|
|
502
|
+
"boundary:window-baseline",
|
|
503
|
+
"baseline",
|
|
504
|
+
"boundary:window-create-proved",
|
|
505
|
+
"create",
|
|
506
|
+
"boundary:window-switch-visible",
|
|
507
|
+
"prime",
|
|
508
|
+
"boundary:window-rename-visible",
|
|
509
|
+
"rename",
|
|
510
|
+
"boundary:window-switch-distribution",
|
|
511
|
+
"switch",
|
|
512
|
+
"boundary:window-web-correlation",
|
|
513
|
+
"web",
|
|
514
|
+
]);
|
|
515
|
+
for (const [method, boundary] of [
|
|
516
|
+
["createWindowNamespace", "window-namespace-ready"],
|
|
517
|
+
["startCanonicalDaemon", "window-daemon-ready"],
|
|
518
|
+
["openCanonicalWorkspace", "window-daemon-ready"],
|
|
519
|
+
["buildBeforeMeasurement", "window-tui-build"],
|
|
520
|
+
["launchWindowTui", "window-tui-started"],
|
|
521
|
+
["waitForWindowHostReady", "window-host-ready"],
|
|
522
|
+
["waitForWindowTuiCoherent", "window-tui-coherent"],
|
|
523
|
+
["proveWindowBaseline", "window-baseline"],
|
|
524
|
+
["createWindow", "window-create-proved"],
|
|
525
|
+
["primeCreatedWindow", "window-switch-visible"],
|
|
526
|
+
["renameWindow", "window-rename-visible"],
|
|
527
|
+
["driveWarmSwitches", "window-switch-distribution"],
|
|
528
|
+
["startWebAfterWindowLifecycle", "window-web-correlation"],
|
|
529
|
+
]) {
|
|
530
|
+
await assert.rejects(
|
|
531
|
+
runWindowLifecycleOwnerBoot({
|
|
532
|
+
...operations,
|
|
533
|
+
[method]: async () => {
|
|
534
|
+
throw new Error(`failed ${method}`);
|
|
535
|
+
},
|
|
536
|
+
}),
|
|
537
|
+
(error) => error?.boundary === boundary,
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
test("resize owner preserves exact keyboard preview release Web ordering and boundaries", async () => {
|
|
543
|
+
const calls = [];
|
|
544
|
+
const operation = (name) => async () => (calls.push(name), Object.freeze({ name }));
|
|
545
|
+
const operations = {
|
|
546
|
+
onBoundary: (boundary) => calls.push(`boundary:${boundary}`),
|
|
547
|
+
createResizeNamespace: operation("namespace"),
|
|
548
|
+
startCanonicalDaemon: operation("daemon"),
|
|
549
|
+
openCanonicalWorkspace: operation("workspace"),
|
|
550
|
+
buildBeforeMeasurement: operation("build"),
|
|
551
|
+
launchResizeTui: operation("start"),
|
|
552
|
+
waitForResizeHostReady: operation("host"),
|
|
553
|
+
waitForResizeTuiCoherent: operation("coherent"),
|
|
554
|
+
proveResizeBaseline: operation("baseline"),
|
|
555
|
+
driveKeyboardResize: operation("keyboard"),
|
|
556
|
+
drivePointerPreviews: operation("previews"),
|
|
557
|
+
drivePointerRelease: operation("release"),
|
|
558
|
+
startWebAfterResize: operation("web"),
|
|
559
|
+
};
|
|
560
|
+
await runKeyboardPointerResizeOwnerBoot(operations);
|
|
561
|
+
assert.deepEqual(calls, [
|
|
562
|
+
"boundary:resize-namespace-ready",
|
|
563
|
+
"namespace",
|
|
564
|
+
"boundary:resize-daemon-ready",
|
|
565
|
+
"daemon",
|
|
566
|
+
"boundary:resize-daemon-ready",
|
|
567
|
+
"workspace",
|
|
568
|
+
"boundary:resize-tui-build",
|
|
569
|
+
"build",
|
|
570
|
+
"boundary:resize-tui-started",
|
|
571
|
+
"start",
|
|
572
|
+
"boundary:resize-host-ready",
|
|
573
|
+
"host",
|
|
574
|
+
"boundary:resize-tui-coherent",
|
|
575
|
+
"coherent",
|
|
576
|
+
"boundary:resize-baseline",
|
|
577
|
+
"baseline",
|
|
578
|
+
"boundary:resize-keyboard-proved",
|
|
579
|
+
"keyboard",
|
|
580
|
+
"boundary:resize-pointer-preview-distribution",
|
|
581
|
+
"previews",
|
|
582
|
+
"boundary:resize-pointer-release-proved",
|
|
583
|
+
"release",
|
|
584
|
+
"boundary:resize-web-correlation",
|
|
585
|
+
"web",
|
|
586
|
+
]);
|
|
587
|
+
for (const [method, boundary] of [
|
|
588
|
+
["createResizeNamespace", "resize-namespace-ready"],
|
|
589
|
+
["startCanonicalDaemon", "resize-daemon-ready"],
|
|
590
|
+
["openCanonicalWorkspace", "resize-daemon-ready"],
|
|
591
|
+
["buildBeforeMeasurement", "resize-tui-build"],
|
|
592
|
+
["launchResizeTui", "resize-tui-started"],
|
|
593
|
+
["waitForResizeHostReady", "resize-host-ready"],
|
|
594
|
+
["waitForResizeTuiCoherent", "resize-tui-coherent"],
|
|
595
|
+
["proveResizeBaseline", "resize-baseline"],
|
|
596
|
+
["driveKeyboardResize", "resize-keyboard-proved"],
|
|
597
|
+
["drivePointerPreviews", "resize-pointer-preview-distribution"],
|
|
598
|
+
["drivePointerRelease", "resize-pointer-release-proved"],
|
|
599
|
+
["startWebAfterResize", "resize-web-correlation"],
|
|
600
|
+
]) {
|
|
601
|
+
await assert.rejects(
|
|
602
|
+
runKeyboardPointerResizeOwnerBoot({
|
|
603
|
+
...operations,
|
|
604
|
+
[method]: async () => {
|
|
605
|
+
throw new Error(String(method));
|
|
606
|
+
},
|
|
607
|
+
}),
|
|
608
|
+
(error) => error?.boundary === boundary,
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
test("selection owner preserves exact local copy app-mouse local-mode Web ordering", async () => {
|
|
614
|
+
const calls = [];
|
|
615
|
+
const operation = (name) => async () => (calls.push(name), Object.freeze({ name }));
|
|
616
|
+
await runSelectionCopyAppMouseOwnerBoot({
|
|
617
|
+
onBoundary: (boundary) => calls.push(`boundary:${boundary}`),
|
|
618
|
+
createNamespace: operation("namespace"),
|
|
619
|
+
startDaemon: operation("daemon"),
|
|
620
|
+
openWorkspace: operation("workspace"),
|
|
621
|
+
build: operation("build"),
|
|
622
|
+
launch: operation("start"),
|
|
623
|
+
waitHost: operation("host"),
|
|
624
|
+
waitCoherent: operation("coherent"),
|
|
625
|
+
proveBaseline: operation("baseline"),
|
|
626
|
+
driveSelection: operation("selection"),
|
|
627
|
+
driveCopy: operation("copy"),
|
|
628
|
+
driveAppMouse: operation("app-mouse"),
|
|
629
|
+
driveLocalMode: operation("local-mode"),
|
|
630
|
+
startWeb: operation("web"),
|
|
631
|
+
});
|
|
632
|
+
assert.deepEqual(calls, [
|
|
633
|
+
"boundary:selection-namespace-ready",
|
|
634
|
+
"namespace",
|
|
635
|
+
"boundary:selection-daemon-ready",
|
|
636
|
+
"daemon",
|
|
637
|
+
"boundary:selection-daemon-ready",
|
|
638
|
+
"workspace",
|
|
639
|
+
"boundary:selection-tui-build",
|
|
640
|
+
"build",
|
|
641
|
+
"boundary:selection-tui-started",
|
|
642
|
+
"start",
|
|
643
|
+
"boundary:selection-host-ready",
|
|
644
|
+
"host",
|
|
645
|
+
"boundary:selection-tui-coherent",
|
|
646
|
+
"coherent",
|
|
647
|
+
"boundary:selection-baseline",
|
|
648
|
+
"baseline",
|
|
649
|
+
"boundary:selection-visible",
|
|
650
|
+
"selection",
|
|
651
|
+
"boundary:selection-copy-proved",
|
|
652
|
+
"copy",
|
|
653
|
+
"boundary:application-mouse-forwarded",
|
|
654
|
+
"app-mouse",
|
|
655
|
+
"boundary:selection-local-mode-proved",
|
|
656
|
+
"local-mode",
|
|
657
|
+
"boundary:selection-web-correlation",
|
|
658
|
+
"web",
|
|
659
|
+
]);
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
test("ANSI owner preserves normal cursor alternate restore workload idle Web ordering", async () => {
|
|
663
|
+
const calls = [];
|
|
664
|
+
const operation = (name) => async () => (calls.push(name), Object.freeze({ name }));
|
|
665
|
+
await runAnsiCursorAltScreenOwnerBoot({
|
|
666
|
+
onBoundary: (boundary) => calls.push(`boundary:${boundary}`),
|
|
667
|
+
createNamespace: operation("namespace"),
|
|
668
|
+
startDaemon: operation("daemon"),
|
|
669
|
+
openWorkspace: operation("workspace"),
|
|
670
|
+
build: operation("build"),
|
|
671
|
+
launch: operation("start"),
|
|
672
|
+
waitHost: operation("host"),
|
|
673
|
+
waitCoherent: operation("coherent"),
|
|
674
|
+
proveNormalBaseline: operation("baseline"),
|
|
675
|
+
driveRichAnsi: operation("rich"),
|
|
676
|
+
driveCursorDistribution: operation("cursor"),
|
|
677
|
+
enterAlternateScreen: operation("alternate"),
|
|
678
|
+
restoreNormalScreen: operation("restore"),
|
|
679
|
+
runSustainedWorkload: operation("sustained"),
|
|
680
|
+
proveIdle: operation("idle"),
|
|
681
|
+
startWeb: operation("web"),
|
|
682
|
+
});
|
|
683
|
+
assert.deepEqual(
|
|
684
|
+
calls.filter((value) => !value.startsWith("boundary:")),
|
|
685
|
+
[
|
|
686
|
+
"namespace",
|
|
687
|
+
"daemon",
|
|
688
|
+
"workspace",
|
|
689
|
+
"build",
|
|
690
|
+
"start",
|
|
691
|
+
"host",
|
|
692
|
+
"coherent",
|
|
693
|
+
"baseline",
|
|
694
|
+
"rich",
|
|
695
|
+
"cursor",
|
|
696
|
+
"alternate",
|
|
697
|
+
"restore",
|
|
698
|
+
"sustained",
|
|
699
|
+
"idle",
|
|
700
|
+
"web",
|
|
701
|
+
],
|
|
702
|
+
);
|
|
703
|
+
assert.equal(calls.at(-2), "boundary:ansi-web-correlation");
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
test("window lifecycle owner preserves the bounded owned-action predicate at rename boundary", async () => {
|
|
707
|
+
const observation = Object.freeze({
|
|
708
|
+
version: 1,
|
|
709
|
+
operation: "window-owned-action",
|
|
710
|
+
predicate: "action-result",
|
|
711
|
+
action: "workspace.rename",
|
|
712
|
+
operationId: "12345678-1234-4234-8234-123456789abc",
|
|
713
|
+
status: 200,
|
|
714
|
+
ok: false,
|
|
715
|
+
resultPresent: false,
|
|
716
|
+
code: "operation_conflict",
|
|
717
|
+
reason: "controller_conflict",
|
|
718
|
+
issueCount: 0,
|
|
719
|
+
});
|
|
720
|
+
const operation =
|
|
721
|
+
(value = {}) =>
|
|
722
|
+
async () =>
|
|
723
|
+
value;
|
|
724
|
+
await assert.rejects(
|
|
725
|
+
runWindowLifecycleOwnerBoot({
|
|
726
|
+
createWindowNamespace: operation(),
|
|
727
|
+
startCanonicalDaemon: operation(),
|
|
728
|
+
openCanonicalWorkspace: operation(),
|
|
729
|
+
buildBeforeMeasurement: operation(),
|
|
730
|
+
launchWindowTui: operation(),
|
|
731
|
+
waitForWindowHostReady: operation(),
|
|
732
|
+
waitForWindowTuiCoherent: operation(),
|
|
733
|
+
proveWindowBaseline: operation(),
|
|
734
|
+
createWindow: operation(),
|
|
735
|
+
primeCreatedWindow: operation(),
|
|
736
|
+
renameWindow: async () => {
|
|
737
|
+
const error = new Error("owned action failed");
|
|
738
|
+
error.observation = observation;
|
|
739
|
+
throw error;
|
|
740
|
+
},
|
|
741
|
+
driveWarmSwitches: operation(),
|
|
742
|
+
startWebAfterWindowLifecycle: operation(),
|
|
743
|
+
}),
|
|
744
|
+
(error) => error?.boundary === "window-rename-visible" && error?.observation === observation,
|
|
745
|
+
);
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
test("scratch fleet rejects unsafe preseed markers before creating any namespace", async () => {
|
|
749
|
+
const slug = `unsafe-marker-${process.pid}`;
|
|
750
|
+
const before = new Set(readdirSync("/tmp").filter((entry) => entry.includes(slug)));
|
|
751
|
+
await assert.rejects(
|
|
752
|
+
createScratchFleet({ sessions: 1, slug, initialPaneMarker: "RIG_SAFE'; touch /tmp/pwned; '" }),
|
|
753
|
+
/bounded safe ProductRig token/u,
|
|
754
|
+
);
|
|
755
|
+
assert.deepEqual(new Set(readdirSync("/tmp").filter((entry) => entry.includes(slug))), before);
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
test("scratch fleet starts an exact argv command in the initial pane before orchestration", async () => {
|
|
759
|
+
const fleet = await createScratchFleet({
|
|
760
|
+
sessions: 1,
|
|
761
|
+
slug: `initial-command-${process.pid}`,
|
|
762
|
+
initialPaneCommand: {
|
|
763
|
+
executable: "sh",
|
|
764
|
+
args: ["-c", "printf 'DIRECT_FIXTURE_READY\\n'; exec sh -i"],
|
|
765
|
+
},
|
|
766
|
+
});
|
|
767
|
+
try {
|
|
768
|
+
assert.match(fleet.capturePane(fleet.sessionNames[0]), /DIRECT_FIXTURE_READY/u);
|
|
769
|
+
assert.equal(fleet.initialPanes.length, 1);
|
|
770
|
+
assert.equal(fleet.initialPanes[0].sessionName, fleet.sessionNames[0]);
|
|
771
|
+
assert.match(fleet.initialPanes[0].paneId, /^%[0-9]+$/u);
|
|
772
|
+
assert.ok(fleet.initialPanes[0].width > 0 && fleet.initialPanes[0].height > 0);
|
|
773
|
+
const semanticStamp = spawnSync(
|
|
774
|
+
"tmux",
|
|
775
|
+
[
|
|
776
|
+
"-S",
|
|
777
|
+
fleet.socketPath,
|
|
778
|
+
"display-message",
|
|
779
|
+
"-p",
|
|
780
|
+
"-t",
|
|
781
|
+
fleet.initialPanes[0].paneId,
|
|
782
|
+
"#{@tmux_ide_pane_id}",
|
|
783
|
+
],
|
|
784
|
+
{ encoding: "utf8" },
|
|
785
|
+
);
|
|
786
|
+
assert.equal(semanticStamp.status, 0);
|
|
787
|
+
assert.equal(semanticStamp.stdout.trim(), "");
|
|
788
|
+
} finally {
|
|
789
|
+
await fleet.dispose();
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
test("scratch fleet preserves two-window default and supports exact one-window lifecycle namespace", async () => {
|
|
794
|
+
for (const [suffix, windowsPerSession, expectedWindows] of [
|
|
795
|
+
["default", undefined, ["one", "two"]],
|
|
796
|
+
["one-window", 1, ["one"]],
|
|
797
|
+
]) {
|
|
798
|
+
const fleet = await createScratchFleet({
|
|
799
|
+
sessions: 1,
|
|
800
|
+
slug: `window-count-${suffix}-${process.pid}`,
|
|
801
|
+
...(windowsPerSession === undefined ? {} : { windowsPerSession }),
|
|
802
|
+
});
|
|
803
|
+
try {
|
|
804
|
+
const session = fleet.sessionNames[0];
|
|
805
|
+
assert.ok(session);
|
|
806
|
+
assert.deepEqual(fleet.listWindows(session), expectedWindows);
|
|
807
|
+
assert.equal(fleet.countPanes(session), expectedWindows.length);
|
|
808
|
+
assert.equal(fleet.currentWindow(session), "one");
|
|
809
|
+
assert.equal(fleet.initialPanes.filter((pane) => pane.sessionName === session).length, 1);
|
|
810
|
+
} finally {
|
|
811
|
+
await fleet.dispose();
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
test("diagnose options select and repeat the executable journey deterministically", () => {
|
|
817
|
+
const options = parseProductDiagnoseOptions([
|
|
818
|
+
"--journey",
|
|
819
|
+
"runtime-qualification",
|
|
820
|
+
"--repeat",
|
|
821
|
+
"3",
|
|
822
|
+
"--json",
|
|
823
|
+
]);
|
|
824
|
+
assert.equal(options.json, true);
|
|
825
|
+
assert.deepEqual(
|
|
826
|
+
resolveProductJourneyPlan(options).map(({ journey, repetition }) => [journey.id, repetition]),
|
|
827
|
+
[
|
|
828
|
+
["runtime-qualification", 1],
|
|
829
|
+
["runtime-qualification", 2],
|
|
830
|
+
["runtime-qualification", 3],
|
|
831
|
+
],
|
|
832
|
+
);
|
|
833
|
+
assert.deepEqual(
|
|
834
|
+
resolveProductJourneyPlan(
|
|
835
|
+
parseProductDiagnoseOptions([
|
|
836
|
+
"--journey",
|
|
837
|
+
"configless-cold-start",
|
|
838
|
+
"--repeat",
|
|
839
|
+
"1",
|
|
840
|
+
"--json",
|
|
841
|
+
]),
|
|
842
|
+
).map(({ journey, repetition, variant }) => [journey.id, repetition, variant]),
|
|
843
|
+
[["configless-cold-start", 1, null]],
|
|
844
|
+
);
|
|
845
|
+
assert.deepEqual(
|
|
846
|
+
resolveProductJourneyPlan(
|
|
847
|
+
parseProductDiagnoseOptions(["--journey", "coherent-first-pane", "--repeat", "1", "--json"]),
|
|
848
|
+
).map(({ journey, repetition, variant }) => [journey.id, repetition, variant]),
|
|
849
|
+
[["coherent-first-pane", 1, null]],
|
|
850
|
+
);
|
|
851
|
+
assert.deepEqual(
|
|
852
|
+
resolveProductJourneyPlan(
|
|
853
|
+
parseProductDiagnoseOptions([
|
|
854
|
+
"--journey",
|
|
855
|
+
"ansi-cursor-alt-screen",
|
|
856
|
+
"--repeat",
|
|
857
|
+
"1",
|
|
858
|
+
"--json",
|
|
859
|
+
]),
|
|
860
|
+
).map(({ journey, repetition, variant }) => [journey.id, repetition, variant]),
|
|
861
|
+
[["ansi-cursor-alt-screen", 1, null]],
|
|
862
|
+
);
|
|
863
|
+
assert.deepEqual(
|
|
864
|
+
resolveProductJourneyPlan(
|
|
865
|
+
parseProductDiagnoseOptions([
|
|
866
|
+
"--journey",
|
|
867
|
+
"selection-copy-app-mouse",
|
|
868
|
+
"--repeat",
|
|
869
|
+
"1",
|
|
870
|
+
"--json",
|
|
871
|
+
]),
|
|
872
|
+
).map(({ journey, repetition, variant }) => [journey.id, repetition, variant]),
|
|
873
|
+
[["selection-copy-app-mouse", 1, null]],
|
|
874
|
+
);
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
test("coherent-first-pane owner preserves targeted preseed-to-Web ordering", async () => {
|
|
878
|
+
const calls = [];
|
|
879
|
+
const operation = (name, result) => async () => {
|
|
880
|
+
calls.push(name);
|
|
881
|
+
return result;
|
|
882
|
+
};
|
|
883
|
+
const result = await runCoherentFirstPaneOwnerBoot({
|
|
884
|
+
createTargetedNamespace: operation("preseed", { seed: "before-start" }),
|
|
885
|
+
startCanonicalDaemon: operation("daemon", { generation: "generation" }),
|
|
886
|
+
openCanonicalWorkspace: operation("workspace", { workspaceName: "workspace" }),
|
|
887
|
+
buildBeforeMeasurement: operation("build"),
|
|
888
|
+
prepareTargetedTuiCwd: operation("cwd", "/isolated/tui/home"),
|
|
889
|
+
launchTargetedTui: operation("targeted-tui", { processId: "opentui:1" }),
|
|
890
|
+
proveCoherentPublication: operation("coherent", { semanticPaneId: "pane.one" }),
|
|
891
|
+
startWebAfterCoherentBoundary: operation("web", { connected: true }),
|
|
892
|
+
});
|
|
893
|
+
assert.deepEqual(calls, [
|
|
894
|
+
"preseed",
|
|
895
|
+
"daemon",
|
|
896
|
+
"workspace",
|
|
897
|
+
"build",
|
|
898
|
+
"cwd",
|
|
899
|
+
"targeted-tui",
|
|
900
|
+
"coherent",
|
|
901
|
+
"web",
|
|
902
|
+
]);
|
|
903
|
+
assert.equal(result.namespace.seed, "before-start");
|
|
904
|
+
assert.equal(result.coherent.semanticPaneId, "pane.one");
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
test("coherent production owner prepares the exact isolated TUI cwd before launch", async () => {
|
|
908
|
+
const temporary = mkdtempSync(join(tmpdir(), "coherent-targeted-cwd-"));
|
|
909
|
+
const runtimeDir = join(temporary, "tui");
|
|
910
|
+
const calls = [];
|
|
911
|
+
try {
|
|
912
|
+
await runCoherentFirstPaneOwnerBoot({
|
|
913
|
+
createTargetedNamespace: async () => {
|
|
914
|
+
const cwd = createIsolatedTargetedTuiCwd(runtimeDir);
|
|
915
|
+
assert.equal(cwd, join(runtimeDir, "home"));
|
|
916
|
+
return { tui: { runtimeDir } };
|
|
917
|
+
},
|
|
918
|
+
startCanonicalDaemon: async () => ({}),
|
|
919
|
+
openCanonicalWorkspace: async () => ({}),
|
|
920
|
+
buildBeforeMeasurement: async () => calls.push("build"),
|
|
921
|
+
prepareTargetedTuiCwd: async (namespace) => {
|
|
922
|
+
calls.push("prepare");
|
|
923
|
+
return prepareIsolatedTargetedTuiCwd(namespace.tui.runtimeDir);
|
|
924
|
+
},
|
|
925
|
+
launchTargetedTui: async () => {
|
|
926
|
+
calls.push("launch");
|
|
927
|
+
const cwd = join(runtimeDir, "home");
|
|
928
|
+
assert.equal(statSync(cwd).isDirectory(), true);
|
|
929
|
+
assert.equal(lstatSync(cwd).isSymbolicLink(), false);
|
|
930
|
+
assert.equal(statSync(cwd).mode & 0o777, 0o700);
|
|
931
|
+
return {};
|
|
932
|
+
},
|
|
933
|
+
proveCoherentPublication: async () => ({}),
|
|
934
|
+
startWebAfterCoherentBoundary: async () => ({}),
|
|
935
|
+
});
|
|
936
|
+
assert.deepEqual(calls, ["build", "prepare", "launch"]);
|
|
937
|
+
|
|
938
|
+
const blockedRuntime = join(temporary, "blocked");
|
|
939
|
+
writeFileSync(blockedRuntime, "not a directory");
|
|
940
|
+
await assert.rejects(
|
|
941
|
+
runCoherentFirstPaneOwnerBoot({
|
|
942
|
+
createTargetedNamespace: async () => ({ tui: { runtimeDir: blockedRuntime } }),
|
|
943
|
+
startCanonicalDaemon: async () => ({}),
|
|
944
|
+
openCanonicalWorkspace: async () => ({}),
|
|
945
|
+
buildBeforeMeasurement: async () => undefined,
|
|
946
|
+
prepareTargetedTuiCwd: async (namespace) =>
|
|
947
|
+
prepareIsolatedTargetedTuiCwd(namespace.tui.runtimeDir),
|
|
948
|
+
launchTargetedTui: () => assert.fail("launch must not follow cwd failure"),
|
|
949
|
+
proveCoherentPublication: async () => ({}),
|
|
950
|
+
startWebAfterCoherentBoundary: async () => ({}),
|
|
951
|
+
}),
|
|
952
|
+
(error) => {
|
|
953
|
+
assert.equal(error.boundary, "targeted-tui-connect");
|
|
954
|
+
assert.deepEqual(error.observation, {
|
|
955
|
+
operation: "prepare-isolated-tui-cwd",
|
|
956
|
+
reason: "runtime-not-exact-directory",
|
|
957
|
+
runtimeKind: "product-rig-testdrive",
|
|
958
|
+
});
|
|
959
|
+
const state = productRigTerminalFailureState(error, "product-rig-startup");
|
|
960
|
+
assert.equal(state.firstBrokenBoundary, "targeted-tui-connect");
|
|
961
|
+
assert.equal(state.failureObservation, error.observation);
|
|
962
|
+
return true;
|
|
963
|
+
},
|
|
964
|
+
);
|
|
965
|
+
} finally {
|
|
966
|
+
removeTestTree(temporary);
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
test("targeted launch validation rejects a missing home without external mutation", async () => {
|
|
971
|
+
const temporary = mkdtempSync(join(tmpdir(), "coherent-targeted-missing-home-"));
|
|
972
|
+
const runtimeDir = join(temporary, "runtime");
|
|
973
|
+
const external = join(temporary, "external");
|
|
974
|
+
try {
|
|
975
|
+
mkdirSync(runtimeDir, { mode: 0o700 });
|
|
976
|
+
mkdirSync(external, { mode: 0o755 });
|
|
977
|
+
chmodSync(external, 0o755);
|
|
978
|
+
writeFileSync(join(external, "sentinel"), "unchanged");
|
|
979
|
+
await assert.rejects(
|
|
980
|
+
runCoherentFirstPaneOwnerBoot({
|
|
981
|
+
createTargetedNamespace: async () => ({ tui: { runtimeDir } }),
|
|
982
|
+
startCanonicalDaemon: async () => ({}),
|
|
983
|
+
openCanonicalWorkspace: async () => ({}),
|
|
984
|
+
buildBeforeMeasurement: async () => undefined,
|
|
985
|
+
prepareTargetedTuiCwd: async (namespace) =>
|
|
986
|
+
prepareIsolatedTargetedTuiCwd(namespace.tui.runtimeDir),
|
|
987
|
+
launchTargetedTui: () => assert.fail("launch must not follow missing cwd"),
|
|
988
|
+
proveCoherentPublication: async () => ({}),
|
|
989
|
+
startWebAfterCoherentBoundary: async () => ({}),
|
|
990
|
+
}),
|
|
991
|
+
(error) =>
|
|
992
|
+
error.boundary === "targeted-tui-connect" && error.observation?.reason === "home-missing",
|
|
993
|
+
);
|
|
994
|
+
assert.equal(statSync(external).mode & 0o777, 0o755);
|
|
995
|
+
assert.equal(readFileSync(join(external, "sentinel"), "utf8"), "unchanged");
|
|
996
|
+
assert.equal(existsSync(join(runtimeDir, "home")), false);
|
|
997
|
+
} finally {
|
|
998
|
+
removeTestTree(temporary);
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
test("targeted launch validation rejects permission mismatches without repair", () => {
|
|
1003
|
+
for (const mismatched of ["runtime", "home"]) {
|
|
1004
|
+
const temporary = mkdtempSync(join(tmpdir(), `coherent-targeted-mode-${mismatched}-`));
|
|
1005
|
+
const runtimeDir = join(temporary, "runtime");
|
|
1006
|
+
const home = join(runtimeDir, "home");
|
|
1007
|
+
try {
|
|
1008
|
+
createIsolatedTargetedTuiCwd(runtimeDir);
|
|
1009
|
+
writeFileSync(join(home, "sentinel"), "unchanged");
|
|
1010
|
+
chmodSync(mismatched === "runtime" ? runtimeDir : home, 0o755);
|
|
1011
|
+
assert.throws(
|
|
1012
|
+
() => prepareIsolatedTargetedTuiCwd(runtimeDir),
|
|
1013
|
+
(error) =>
|
|
1014
|
+
error.boundary === "targeted-tui-connect" &&
|
|
1015
|
+
error.observation?.reason === `${mismatched}-permission-mismatch`,
|
|
1016
|
+
);
|
|
1017
|
+
assert.equal(statSync(mismatched === "runtime" ? runtimeDir : home).mode & 0o777, 0o755);
|
|
1018
|
+
assert.equal(readFileSync(join(home, "sentinel"), "utf8"), "unchanged");
|
|
1019
|
+
} finally {
|
|
1020
|
+
removeTestTree(temporary);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
|
|
1025
|
+
test("targeted TUI cwd preparation never follows runtime or home symlinks", () => {
|
|
1026
|
+
const temporary = mkdtempSync(join(tmpdir(), "coherent-targeted-symlink-"));
|
|
1027
|
+
try {
|
|
1028
|
+
const external = join(temporary, "external");
|
|
1029
|
+
mkdirSync(external, { mode: 0o755 });
|
|
1030
|
+
chmodSync(external, 0o755);
|
|
1031
|
+
const runtimeDir = join(temporary, "runtime");
|
|
1032
|
+
mkdirSync(runtimeDir, { mode: 0o700 });
|
|
1033
|
+
symlinkSync(external, join(runtimeDir, "home"), "dir");
|
|
1034
|
+
assert.throws(
|
|
1035
|
+
() => prepareIsolatedTargetedTuiCwd(runtimeDir),
|
|
1036
|
+
(error) =>
|
|
1037
|
+
error.boundary === "targeted-tui-connect" &&
|
|
1038
|
+
error.observation?.reason === "home-not-exact-directory",
|
|
1039
|
+
);
|
|
1040
|
+
assert.equal(statSync(external).mode & 0o777, 0o755);
|
|
1041
|
+
|
|
1042
|
+
const runtimeLink = join(temporary, "runtime-link");
|
|
1043
|
+
symlinkSync(external, runtimeLink, "dir");
|
|
1044
|
+
assert.throws(
|
|
1045
|
+
() => prepareIsolatedTargetedTuiCwd(runtimeLink),
|
|
1046
|
+
(error) =>
|
|
1047
|
+
error.boundary === "targeted-tui-connect" &&
|
|
1048
|
+
error.observation?.reason === "runtime-not-exact-directory",
|
|
1049
|
+
);
|
|
1050
|
+
assert.equal(statSync(external).mode & 0o777, 0o755);
|
|
1051
|
+
} finally {
|
|
1052
|
+
for (const link of [join(temporary, "runtime", "home"), join(temporary, "runtime-link")]) {
|
|
1053
|
+
try {
|
|
1054
|
+
unlinkSync(link);
|
|
1055
|
+
} catch {
|
|
1056
|
+
// The assertion may have failed before a given symlink was created.
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
removeTestTree(temporary);
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
test("targeted TUI cwd preparation retains its runtime inode across child preparation", () => {
|
|
1064
|
+
const temporary = mkdtempSync(join(tmpdir(), "coherent-targeted-parent-swap-"));
|
|
1065
|
+
const runtimeDir = join(temporary, "runtime");
|
|
1066
|
+
const retainedRuntime = join(temporary, "runtime-retained");
|
|
1067
|
+
const external = join(temporary, "external");
|
|
1068
|
+
const externalHome = join(external, "home");
|
|
1069
|
+
try {
|
|
1070
|
+
mkdirSync(runtimeDir, { mode: 0o700 });
|
|
1071
|
+
mkdirSync(external, { mode: 0o755 });
|
|
1072
|
+
mkdirSync(externalHome, { mode: 0o755 });
|
|
1073
|
+
chmodSync(external, 0o755);
|
|
1074
|
+
chmodSync(externalHome, 0o755);
|
|
1075
|
+
writeFileSync(join(externalHome, "sentinel"), "unchanged");
|
|
1076
|
+
assert.throws(
|
|
1077
|
+
() =>
|
|
1078
|
+
prepareIsolatedTargetedTuiCwd(runtimeDir, {
|
|
1079
|
+
afterRuntimeValidated: () => {
|
|
1080
|
+
renameSync(runtimeDir, retainedRuntime);
|
|
1081
|
+
symlinkSync(external, runtimeDir, "dir");
|
|
1082
|
+
},
|
|
1083
|
+
}),
|
|
1084
|
+
(error) =>
|
|
1085
|
+
error.boundary === "targeted-tui-connect" &&
|
|
1086
|
+
error.observation?.reason === "runtime-identity-changed",
|
|
1087
|
+
);
|
|
1088
|
+
assert.equal(statSync(external).mode & 0o777, 0o755);
|
|
1089
|
+
assert.equal(statSync(externalHome).mode & 0o777, 0o755);
|
|
1090
|
+
assert.equal(readFileSync(join(externalHome, "sentinel"), "utf8"), "unchanged");
|
|
1091
|
+
} finally {
|
|
1092
|
+
try {
|
|
1093
|
+
unlinkSync(runtimeDir);
|
|
1094
|
+
} catch {
|
|
1095
|
+
// The swap may not have completed.
|
|
1096
|
+
}
|
|
1097
|
+
if (existsSync(retainedRuntime)) renameSync(retainedRuntime, runtimeDir);
|
|
1098
|
+
removeTestTree(temporary);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
test("coherent-first-pane owner decorates every raw phase failure with its first boundary", async () => {
|
|
1103
|
+
const cases = [
|
|
1104
|
+
["createTargetedNamespace", "targeted-namespace-preseeded"],
|
|
1105
|
+
["startCanonicalDaemon", "targeted-daemon-ready"],
|
|
1106
|
+
["openCanonicalWorkspace", "targeted-daemon-ready"],
|
|
1107
|
+
["buildBeforeMeasurement", "targeted-tui-connect"],
|
|
1108
|
+
["prepareTargetedTuiCwd", "targeted-tui-connect"],
|
|
1109
|
+
["launchTargetedTui", "targeted-tui-connect"],
|
|
1110
|
+
["proveCoherentPublication", "coherent-terminal-publication"],
|
|
1111
|
+
["startWebAfterCoherentBoundary", "web-started-after-coherent-boundary"],
|
|
1112
|
+
];
|
|
1113
|
+
for (const [failedOperation, expectedBoundary] of cases) {
|
|
1114
|
+
const operations = Object.fromEntries(
|
|
1115
|
+
cases.map(([name]) => [
|
|
1116
|
+
name,
|
|
1117
|
+
async () => {
|
|
1118
|
+
if (name === failedOperation) throw new Error(`failed ${name}`);
|
|
1119
|
+
return Object.freeze({ name });
|
|
1120
|
+
},
|
|
1121
|
+
]),
|
|
1122
|
+
);
|
|
1123
|
+
await assert.rejects(runCoherentFirstPaneOwnerBoot(operations), (error) => {
|
|
1124
|
+
assert.equal(error.boundary, expectedBoundary);
|
|
1125
|
+
assert.match(error.message, new RegExp(`failed ${failedOperation}`, "u"));
|
|
1126
|
+
return true;
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
|
|
1131
|
+
test("coherent proof boundary survives strict cleanup into its sealed failure bundle", async () => {
|
|
1132
|
+
const temporary = mkdtempSync(join(tmpdir(), "coherent-boundary-bundle-"));
|
|
1133
|
+
const entry = {
|
|
1134
|
+
...attemptEntry("20260818131500000-coherent-first-pane-r1-proof"),
|
|
1135
|
+
journey: { id: "coherent-first-pane" },
|
|
1136
|
+
};
|
|
1137
|
+
let cleaned = false;
|
|
1138
|
+
try {
|
|
1139
|
+
await assert.rejects(
|
|
1140
|
+
runIsolatedProductJourneyAttempt(entry, {
|
|
1141
|
+
preCleanup: async () => undefined,
|
|
1142
|
+
drive: () =>
|
|
1143
|
+
runCoherentFirstPaneOwnerBoot({
|
|
1144
|
+
createTargetedNamespace: async () => ({}),
|
|
1145
|
+
startCanonicalDaemon: async () => ({}),
|
|
1146
|
+
openCanonicalWorkspace: async () => ({}),
|
|
1147
|
+
buildBeforeMeasurement: async () => undefined,
|
|
1148
|
+
prepareTargetedTuiCwd: async () => undefined,
|
|
1149
|
+
launchTargetedTui: async () => ({}),
|
|
1150
|
+
proveCoherentPublication: async () => {
|
|
1151
|
+
throw new Error("target frame never published");
|
|
1152
|
+
},
|
|
1153
|
+
startWebAfterCoherentBoundary: async () => ({}),
|
|
1154
|
+
}),
|
|
1155
|
+
currentBoundary: () => "product-rig-startup",
|
|
1156
|
+
postCleanup: async () => {
|
|
1157
|
+
cleaned = true;
|
|
1158
|
+
},
|
|
1159
|
+
retryCleanup: () => assert.fail("cleanup succeeded"),
|
|
1160
|
+
prepareFailure: async (error, boundary) => ({
|
|
1161
|
+
evidence: failureEvidence(boundary, error.message),
|
|
1162
|
+
}),
|
|
1163
|
+
appendCleanupFailure: () => assert.fail("no cleanup failure"),
|
|
1164
|
+
publishFailure: async ({ evidence }) => {
|
|
1165
|
+
assert.equal(cleaned, true);
|
|
1166
|
+
return createProductDiagnosticBundle({ root: temporary, runId: entry.runId, evidence });
|
|
1167
|
+
},
|
|
1168
|
+
publishSuccess: () => assert.fail("proof failure cannot publish success"),
|
|
1169
|
+
}),
|
|
1170
|
+
(error) => {
|
|
1171
|
+
assert.ok(error instanceof ProductJourneyAttemptError);
|
|
1172
|
+
assert.equal(error.boundary, "coherent-terminal-publication");
|
|
1173
|
+
const report = JSON.parse(readFileSync(join(error.bundle.runDir, "report.json"), "utf8"));
|
|
1174
|
+
assert.equal(report.firstBrokenBoundary, "coherent-terminal-publication");
|
|
1175
|
+
return true;
|
|
1176
|
+
},
|
|
1177
|
+
);
|
|
1178
|
+
} finally {
|
|
1179
|
+
removeTestTree(temporary);
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
|
|
1183
|
+
test("clock calibration failure observation stays bounded and path-free in the sealed bundle", () => {
|
|
1184
|
+
const temporary = mkdtempSync(join(tmpdir(), "clock-calibration-bundle-"));
|
|
1185
|
+
const runId = "20260818174500000-first-key-paste-key-r1-clock";
|
|
1186
|
+
const failureObservation = {
|
|
1187
|
+
firstFailedPredicate: "clock-calibration",
|
|
1188
|
+
predicates: [
|
|
1189
|
+
{
|
|
1190
|
+
id: "clock-calibration",
|
|
1191
|
+
status: "failed",
|
|
1192
|
+
reason: "timeout-no-sample",
|
|
1193
|
+
attemptedProbes: 1,
|
|
1194
|
+
receivedProbes: 0,
|
|
1195
|
+
validProbes: 0,
|
|
1196
|
+
selectedProbes: 0,
|
|
1197
|
+
selectedProbe: null,
|
|
1198
|
+
},
|
|
1199
|
+
],
|
|
1200
|
+
};
|
|
1201
|
+
const evidence = failureEvidence("input-clock-calibration", "clock calibration unavailable");
|
|
1202
|
+
evidence.report.failureObservation = failureObservation;
|
|
1203
|
+
evidence.alignment.failureObservation = failureObservation;
|
|
1204
|
+
evidence.clientState.failureObservation = failureObservation;
|
|
1205
|
+
try {
|
|
1206
|
+
const bundle = createProductDiagnosticBundle({ root: temporary, runId, evidence });
|
|
1207
|
+
const report = JSON.parse(readFileSync(join(bundle.runDir, "report.json"), "utf8"));
|
|
1208
|
+
const alignment = JSON.parse(readFileSync(join(bundle.runDir, "alignment.json"), "utf8"));
|
|
1209
|
+
const client = JSON.parse(readFileSync(join(bundle.runDir, "client-state.json"), "utf8"));
|
|
1210
|
+
assert.deepEqual(report.failureObservation, failureObservation);
|
|
1211
|
+
assert.deepEqual(alignment.failureObservation, failureObservation);
|
|
1212
|
+
assert.deepEqual(client.failureObservation, failureObservation);
|
|
1213
|
+
const serialized = JSON.stringify(failureObservation);
|
|
1214
|
+
assert.ok(serialized.length < 2_048);
|
|
1215
|
+
assert.doesNotMatch(serialized, /[\\/]/u);
|
|
1216
|
+
} finally {
|
|
1217
|
+
removeTestTree(temporary);
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
|
|
1221
|
+
test("coherent timeout observation is preserved in report and alignment after cleanup", () => {
|
|
1222
|
+
const temporary = mkdtempSync(join(tmpdir(), "coherent-timeout-bundle-"));
|
|
1223
|
+
const runId = "20260818174500000-first-key-paste-key-r1-frame";
|
|
1224
|
+
const generation = "226826d4-5f72-4b59-be54-9f75e85640d4";
|
|
1225
|
+
const failureObservation = productCoherentFrameTimeoutObservation({
|
|
1226
|
+
processId: "opentui:4934",
|
|
1227
|
+
daemonGeneration: generation,
|
|
1228
|
+
detailMode: "0",
|
|
1229
|
+
lifecycleRecords: [
|
|
1230
|
+
{
|
|
1231
|
+
phase: "generation-host-internal-snapshot-publication",
|
|
1232
|
+
publicationPhase: "internal-snapshot-published",
|
|
1233
|
+
processId: "opentui:4934",
|
|
1234
|
+
clockId: "opentui-performance-now",
|
|
1235
|
+
daemonGeneration: generation,
|
|
1236
|
+
rendererEpoch: 1,
|
|
1237
|
+
monotonicMicros: 100,
|
|
1238
|
+
},
|
|
1239
|
+
],
|
|
1240
|
+
traceRecords: [
|
|
1241
|
+
{
|
|
1242
|
+
type: "performance.terminal-canonical-paint",
|
|
1243
|
+
processId: "opentui:4934",
|
|
1244
|
+
clockId: "opentui-performance-now",
|
|
1245
|
+
generation,
|
|
1246
|
+
atMicros: 200,
|
|
1247
|
+
},
|
|
1248
|
+
],
|
|
1249
|
+
});
|
|
1250
|
+
const evidence = failureEvidence("distribution-lane-fresh", "coherent frame unavailable");
|
|
1251
|
+
evidence.report.failureObservation = failureObservation;
|
|
1252
|
+
evidence.alignment.failureObservation = failureObservation;
|
|
1253
|
+
evidence.clientState.failureObservation = failureObservation;
|
|
1254
|
+
try {
|
|
1255
|
+
const bundle = createProductDiagnosticBundle({ root: temporary, runId, evidence });
|
|
1256
|
+
for (const file of ["report.json", "alignment.json", "client-state.json"]) {
|
|
1257
|
+
const sealed = JSON.parse(readFileSync(join(bundle.runDir, file), "utf8"));
|
|
1258
|
+
assert.deepEqual(sealed.failureObservation, failureObservation);
|
|
1259
|
+
}
|
|
1260
|
+
const serialized = JSON.stringify(failureObservation);
|
|
1261
|
+
assert.ok(serialized.length < 2_048);
|
|
1262
|
+
assert.doesNotMatch(serialized, /[\\/]/u);
|
|
1263
|
+
} finally {
|
|
1264
|
+
removeTestTree(temporary);
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
test("first-key-paste expands each repetition into separately isolated key and paste attempts", () => {
|
|
1269
|
+
const journey = {
|
|
1270
|
+
id: "first-key-paste",
|
|
1271
|
+
variants: Object.freeze(["key", "paste"]),
|
|
1272
|
+
implementation: "implemented",
|
|
1273
|
+
};
|
|
1274
|
+
assert.deepEqual(
|
|
1275
|
+
expandProductJourneyEntries([journey], 2).map(({ repetition, variant }) => [
|
|
1276
|
+
repetition,
|
|
1277
|
+
variant,
|
|
1278
|
+
]),
|
|
1279
|
+
[
|
|
1280
|
+
[1, "key"],
|
|
1281
|
+
[1, "paste"],
|
|
1282
|
+
[2, "key"],
|
|
1283
|
+
[2, "paste"],
|
|
1284
|
+
],
|
|
1285
|
+
);
|
|
1286
|
+
assert.equal(
|
|
1287
|
+
parseProductDiagnoseOptions(["--journey", "first-key-paste", "--variant", "paste"]).variant,
|
|
1288
|
+
"paste",
|
|
1289
|
+
);
|
|
1290
|
+
const selected = resolveProductJourneyPlan(
|
|
1291
|
+
parseProductDiagnoseOptions([
|
|
1292
|
+
"--journey",
|
|
1293
|
+
"first-key-paste",
|
|
1294
|
+
"--variant",
|
|
1295
|
+
"paste",
|
|
1296
|
+
"--repeat",
|
|
1297
|
+
"2",
|
|
1298
|
+
]),
|
|
1299
|
+
);
|
|
1300
|
+
assert.deepEqual(
|
|
1301
|
+
selected.map(({ repetition, variant }) => [repetition, variant]),
|
|
1302
|
+
[
|
|
1303
|
+
[1, "paste"],
|
|
1304
|
+
[2, "paste"],
|
|
1305
|
+
],
|
|
1306
|
+
);
|
|
1307
|
+
assert.throws(
|
|
1308
|
+
() =>
|
|
1309
|
+
resolveProductJourneyPlan(
|
|
1310
|
+
parseProductDiagnoseOptions(["--journey", "runtime-qualification", "--variant", "paste"]),
|
|
1311
|
+
),
|
|
1312
|
+
/only valid with --journey first-key-paste/u,
|
|
1313
|
+
);
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1316
|
+
test("first-key-paste owner preserves direct phase order and named failures", async () => {
|
|
1317
|
+
const calls = [];
|
|
1318
|
+
const operations = {
|
|
1319
|
+
createInputNamespace: async () => (calls.push("namespace"), {}),
|
|
1320
|
+
startCanonicalDaemon: async () => (calls.push("daemon"), {}),
|
|
1321
|
+
openCanonicalWorkspace: async () => (calls.push("workspace"), {}),
|
|
1322
|
+
buildBeforeMeasurement: async () => calls.push("build"),
|
|
1323
|
+
prepareFirstTui: async () => calls.push("prepare"),
|
|
1324
|
+
launchFirstTui: async () => (calls.push("first-tui"), {}),
|
|
1325
|
+
proveNoPriorHostedInput: async () => (calls.push("baseline"), {}),
|
|
1326
|
+
driveFirstInput: async () => (calls.push("first-input"), {}),
|
|
1327
|
+
rehostDistributionTui: async () => (calls.push("rehost"), {}),
|
|
1328
|
+
driveDistribution: async () => (calls.push("distribution"), {}),
|
|
1329
|
+
startWebAfterInput: async () => (calls.push("web"), {}),
|
|
1330
|
+
};
|
|
1331
|
+
await runFirstKeyPasteOwnerBoot(operations);
|
|
1332
|
+
assert.deepEqual(calls, [
|
|
1333
|
+
"namespace",
|
|
1334
|
+
"daemon",
|
|
1335
|
+
"workspace",
|
|
1336
|
+
"build",
|
|
1337
|
+
"prepare",
|
|
1338
|
+
"first-tui",
|
|
1339
|
+
"baseline",
|
|
1340
|
+
"first-input",
|
|
1341
|
+
"rehost",
|
|
1342
|
+
"distribution",
|
|
1343
|
+
"web",
|
|
1344
|
+
]);
|
|
1345
|
+
for (const [method, boundary] of [
|
|
1346
|
+
["createInputNamespace", "first-input-namespace-ready"],
|
|
1347
|
+
["startCanonicalDaemon", "first-input-daemon-ready"],
|
|
1348
|
+
["launchFirstTui", "first-input-tui-coherent"],
|
|
1349
|
+
["proveNoPriorHostedInput", "first-input-no-prior-hosted-input"],
|
|
1350
|
+
["driveFirstInput", "first-input-causal-paint"],
|
|
1351
|
+
["rehostDistributionTui", "distribution-lane-fresh"],
|
|
1352
|
+
["driveDistribution", "distribution-samples"],
|
|
1353
|
+
["startWebAfterInput", "first-input-web-correlation"],
|
|
1354
|
+
]) {
|
|
1355
|
+
await assert.rejects(
|
|
1356
|
+
runFirstKeyPasteOwnerBoot({
|
|
1357
|
+
...operations,
|
|
1358
|
+
[method]: async () => {
|
|
1359
|
+
throw new Error(`failed ${method}`);
|
|
1360
|
+
},
|
|
1361
|
+
}),
|
|
1362
|
+
(error) => error.boundary === boundary,
|
|
1363
|
+
);
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
|
|
1367
|
+
test("focus owner preserves blur before reclaim and names every failure boundary", async () => {
|
|
1368
|
+
const calls = [];
|
|
1369
|
+
const operations = {
|
|
1370
|
+
createFocusNamespace: async () => (calls.push("namespace"), {}),
|
|
1371
|
+
startCanonicalDaemon: async () => (calls.push("daemon"), {}),
|
|
1372
|
+
openCanonicalWorkspace: async () => (calls.push("workspace"), {}),
|
|
1373
|
+
buildBeforeMeasurement: async () => calls.push("build"),
|
|
1374
|
+
launchFocusTui: async () => (calls.push("tui-start"), {}),
|
|
1375
|
+
waitForFocusHostReady: async () => (calls.push("host-ready"), {}),
|
|
1376
|
+
waitForFocusTuiCoherent: async () => (calls.push("tui-coherent"), {}),
|
|
1377
|
+
proveFocusBaseline: async () => (calls.push("baseline"), {}),
|
|
1378
|
+
driveBlur: async () => (calls.push("blur"), {}),
|
|
1379
|
+
driveFocus: async () => (calls.push("focus"), {}),
|
|
1380
|
+
startWebAfterFocus: async () => (calls.push("web"), {}),
|
|
1381
|
+
};
|
|
1382
|
+
const framebufferObservation = Object.freeze({
|
|
1383
|
+
operation: "wait-for-focus-framebuffer-capture",
|
|
1384
|
+
reason: "semantic-chrome-missing",
|
|
1385
|
+
attempts: 8,
|
|
1386
|
+
matchCount: 0,
|
|
1387
|
+
});
|
|
1388
|
+
await assert.rejects(
|
|
1389
|
+
runFocusOwnerBoot({
|
|
1390
|
+
...operations,
|
|
1391
|
+
driveBlur: async () => {
|
|
1392
|
+
const error = new Error("focus framebuffer capture did not stabilize");
|
|
1393
|
+
error.boundary = "focus-framebuffer-capture";
|
|
1394
|
+
error.observation = framebufferObservation;
|
|
1395
|
+
throw error;
|
|
1396
|
+
},
|
|
1397
|
+
}),
|
|
1398
|
+
(error) =>
|
|
1399
|
+
error.boundary === "focus-framebuffer-capture" &&
|
|
1400
|
+
error.observation === framebufferObservation,
|
|
1401
|
+
);
|
|
1402
|
+
calls.length = 0;
|
|
1403
|
+
await runFocusOwnerBoot(operations);
|
|
1404
|
+
assert.deepEqual(calls, [
|
|
1405
|
+
"namespace",
|
|
1406
|
+
"daemon",
|
|
1407
|
+
"workspace",
|
|
1408
|
+
"build",
|
|
1409
|
+
"tui-start",
|
|
1410
|
+
"host-ready",
|
|
1411
|
+
"tui-coherent",
|
|
1412
|
+
"baseline",
|
|
1413
|
+
"blur",
|
|
1414
|
+
"focus",
|
|
1415
|
+
"web",
|
|
1416
|
+
]);
|
|
1417
|
+
for (const [method, boundary] of [
|
|
1418
|
+
["createFocusNamespace", "focus-namespace-ready"],
|
|
1419
|
+
["startCanonicalDaemon", "focus-daemon-ready"],
|
|
1420
|
+
["buildBeforeMeasurement", "focus-tui-build"],
|
|
1421
|
+
["launchFocusTui", "focus-tui-started"],
|
|
1422
|
+
["waitForFocusHostReady", "focus-host-ready"],
|
|
1423
|
+
["waitForFocusTuiCoherent", "focus-tui-coherent"],
|
|
1424
|
+
["proveFocusBaseline", "focus-baseline"],
|
|
1425
|
+
["driveBlur", "focus-blur-proved"],
|
|
1426
|
+
["driveFocus", "focus-reclaim-proved"],
|
|
1427
|
+
["startWebAfterFocus", "focus-web-correlation"],
|
|
1428
|
+
]) {
|
|
1429
|
+
await assert.rejects(
|
|
1430
|
+
runFocusOwnerBoot({
|
|
1431
|
+
...operations,
|
|
1432
|
+
[method]: async () => {
|
|
1433
|
+
throw new Error(`failed ${method}`);
|
|
1434
|
+
},
|
|
1435
|
+
}),
|
|
1436
|
+
(error) => error.boundary === boundary,
|
|
1437
|
+
);
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
test("focus framebuffer failure observation is bounded and sealed before artifact gating", () => {
|
|
1442
|
+
const temporary = mkdtempSync(join(tmpdir(), "focus-framebuffer-bundle-"));
|
|
1443
|
+
const runId = "20260818211500000-focus-r1-framebuffer";
|
|
1444
|
+
const failureObservation = {
|
|
1445
|
+
operation: "wait-for-focus-framebuffer-capture",
|
|
1446
|
+
reason: "semantic-chrome-missing",
|
|
1447
|
+
attempts: 8,
|
|
1448
|
+
matchCount: 0,
|
|
1449
|
+
positions: [],
|
|
1450
|
+
frameRows: 44,
|
|
1451
|
+
frameMaxWidth: 160,
|
|
1452
|
+
frameHash: "a".repeat(64),
|
|
1453
|
+
projectedDigest: "b".repeat(64),
|
|
1454
|
+
nativeDigest: "c".repeat(64),
|
|
1455
|
+
expectedMarker: "○",
|
|
1456
|
+
latestTrace: [],
|
|
1457
|
+
};
|
|
1458
|
+
const evidence = failureEvidence(
|
|
1459
|
+
"focus-framebuffer-capture",
|
|
1460
|
+
"focus framebuffer capture did not stabilize",
|
|
1461
|
+
);
|
|
1462
|
+
evidence.report.failureObservation = failureObservation;
|
|
1463
|
+
evidence.alignment.failureObservation = failureObservation;
|
|
1464
|
+
evidence.clientState.failureObservation = failureObservation;
|
|
1465
|
+
try {
|
|
1466
|
+
const bundle = createProductDiagnosticBundle({ root: temporary, runId, evidence });
|
|
1467
|
+
for (const artifact of ["report.json", "alignment.json", "client-state.json"]) {
|
|
1468
|
+
const value = JSON.parse(readFileSync(join(bundle.runDir, artifact), "utf8"));
|
|
1469
|
+
assert.deepEqual(value.failureObservation, failureObservation);
|
|
1470
|
+
}
|
|
1471
|
+
const serialized = JSON.stringify(failureObservation);
|
|
1472
|
+
assert.ok(serialized.length < 2_048);
|
|
1473
|
+
assert.doesNotMatch(serialized, /[\\/]/u);
|
|
1474
|
+
} finally {
|
|
1475
|
+
removeTestTree(temporary);
|
|
1476
|
+
}
|
|
1477
|
+
});
|
|
1478
|
+
|
|
1479
|
+
test("focus Web readiness failure preserves bounded structural predicates in every sealed view", () => {
|
|
1480
|
+
const temporary = mkdtempSync(join(tmpdir(), "focus-web-bundle-"));
|
|
1481
|
+
const runId = "20260820090000000-focus-r1-web";
|
|
1482
|
+
const failureObservation = {
|
|
1483
|
+
operation: "wait-for-focus-web-semantic",
|
|
1484
|
+
reason: "deadline",
|
|
1485
|
+
attempts: 41,
|
|
1486
|
+
elapsedMs: 60_001,
|
|
1487
|
+
deadlineMs: 60_000,
|
|
1488
|
+
firstFailedPredicate: "web-window-group-count",
|
|
1489
|
+
stableExactSamples: 0,
|
|
1490
|
+
expectedGroupCount: 2,
|
|
1491
|
+
latest: {
|
|
1492
|
+
runtimeShellExact: true,
|
|
1493
|
+
daemonGenerationExact: true,
|
|
1494
|
+
visible: true,
|
|
1495
|
+
focused: true,
|
|
1496
|
+
workspaceCount: 1,
|
|
1497
|
+
observedWindowCount: 1,
|
|
1498
|
+
activeWindowCount: 1,
|
|
1499
|
+
availableResourceCount: 2,
|
|
1500
|
+
observedTerminalCount: 1,
|
|
1501
|
+
connectedTerminalCount: 1,
|
|
1502
|
+
windowMembershipExact: false,
|
|
1503
|
+
terminalExact: false,
|
|
1504
|
+
strictQualified: false,
|
|
1505
|
+
digest: "a".repeat(64),
|
|
1506
|
+
},
|
|
1507
|
+
predicates: [{ id: "web-window-group-count", passed: false }],
|
|
1508
|
+
};
|
|
1509
|
+
const evidence = failureEvidence("focus-web-correlation", "focus Web readiness deadline");
|
|
1510
|
+
evidence.report.failureObservation = failureObservation;
|
|
1511
|
+
evidence.alignment.failureObservation = failureObservation;
|
|
1512
|
+
evidence.clientState.failureObservation = failureObservation;
|
|
1513
|
+
try {
|
|
1514
|
+
const bundle = createProductDiagnosticBundle({ root: temporary, runId, evidence });
|
|
1515
|
+
for (const artifact of ["report.json", "alignment.json", "client-state.json"]) {
|
|
1516
|
+
const value = JSON.parse(readFileSync(join(bundle.runDir, artifact), "utf8"));
|
|
1517
|
+
assert.deepEqual(value.failureObservation, failureObservation);
|
|
1518
|
+
}
|
|
1519
|
+
const serialized = JSON.stringify(failureObservation);
|
|
1520
|
+
assert.ok(serialized.length < 2_048);
|
|
1521
|
+
assert.doesNotMatch(serialized, /[\\/]|pane\.|window\.|workspace-/u);
|
|
1522
|
+
} finally {
|
|
1523
|
+
removeTestTree(temporary);
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1527
|
+
test("focus host readiness failure observation remains bounded and sealed after cleanup", () => {
|
|
1528
|
+
const temporary = mkdtempSync(join(tmpdir(), "focus-host-ready-bundle-"));
|
|
1529
|
+
const runId = "20260818213000000-focus-r1-host-ready";
|
|
1530
|
+
const failureObservation = {
|
|
1531
|
+
operation: "focus-host-ready",
|
|
1532
|
+
reason: "host-status-timeout",
|
|
1533
|
+
stage: "atomic-host-display",
|
|
1534
|
+
attempts: 6,
|
|
1535
|
+
elapsedMs: 10_000,
|
|
1536
|
+
deadlineMs: 10_000,
|
|
1537
|
+
metadataPresent: true,
|
|
1538
|
+
metadataProcessId: 27415,
|
|
1539
|
+
metadataProcessAlive: true,
|
|
1540
|
+
currentHostIdentity: null,
|
|
1541
|
+
lifecycleCount: 41,
|
|
1542
|
+
latestLifecyclePhase: "generation-workspace-client-state",
|
|
1543
|
+
stderrBytes: 0,
|
|
1544
|
+
stderrSha256: "a".repeat(64),
|
|
1545
|
+
};
|
|
1546
|
+
const evidence = failureEvidence("focus-host-ready", "focus host readiness failed");
|
|
1547
|
+
evidence.report.failureObservation = failureObservation;
|
|
1548
|
+
evidence.alignment.failureObservation = failureObservation;
|
|
1549
|
+
evidence.clientState.failureObservation = failureObservation;
|
|
1550
|
+
try {
|
|
1551
|
+
const bundle = createProductDiagnosticBundle({ root: temporary, runId, evidence });
|
|
1552
|
+
for (const artifact of ["report.json", "alignment.json", "client-state.json"]) {
|
|
1553
|
+
const value = JSON.parse(readFileSync(join(bundle.runDir, artifact), "utf8"));
|
|
1554
|
+
assert.deepEqual(value.failureObservation, failureObservation);
|
|
1555
|
+
}
|
|
1556
|
+
assert.doesNotMatch(JSON.stringify(failureObservation), /[\\/]/u);
|
|
1557
|
+
} finally {
|
|
1558
|
+
removeTestTree(temporary);
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
|
|
1562
|
+
test("journey dispatcher invokes the exact registry executor instead of the runtime monolith", async () => {
|
|
1563
|
+
const calls = [];
|
|
1564
|
+
const entry = { journey: { id: "configless-cold-start", executor: "configless-cold-start" } };
|
|
1565
|
+
const result = await dispatchProductJourneyExecutor(entry, {
|
|
1566
|
+
"configless-cold-start": async () => {
|
|
1567
|
+
calls.push("configless");
|
|
1568
|
+
return "direct";
|
|
1569
|
+
},
|
|
1570
|
+
"runtime-qualification": async () => {
|
|
1571
|
+
calls.push("runtime");
|
|
1572
|
+
return "monolith";
|
|
1573
|
+
},
|
|
1574
|
+
});
|
|
1575
|
+
assert.equal(result, "direct");
|
|
1576
|
+
assert.deepEqual(calls, ["configless"]);
|
|
1577
|
+
});
|
|
1578
|
+
|
|
1579
|
+
test("configless owner launches public entry before election/adoption/coherence and Web", async () => {
|
|
1580
|
+
const calls = [];
|
|
1581
|
+
const operation = (name, result) => async () => {
|
|
1582
|
+
calls.push(name);
|
|
1583
|
+
return result;
|
|
1584
|
+
};
|
|
1585
|
+
const result = await runConfiglessProductJourneyOwnerBoot({
|
|
1586
|
+
createOrdinaryNamespace: operation("ordinary-namespace", { id: "namespace" }),
|
|
1587
|
+
assertNamespaceClean: operation("namespace-clean"),
|
|
1588
|
+
buildBeforeMeasurement: operation("build"),
|
|
1589
|
+
launchPublicNoArgumentEntry: operation("public-no-arg", { pid: 41 }),
|
|
1590
|
+
observeElectedDaemon: operation("daemon-election", { instanceId: "daemon" }),
|
|
1591
|
+
observeOrdinarySessionDiscovery: operation("ordinary-discovery", { sessionId: "session" }),
|
|
1592
|
+
adoptThroughPublicApp: operation("public-adoption", { workspace: "workspace" }),
|
|
1593
|
+
proveCoherentPublication: operation("coherent-publication", { frame: "frame" }),
|
|
1594
|
+
startWebAfterColdBoundary: operation("web-after-cold", { page: "web" }),
|
|
1595
|
+
});
|
|
1596
|
+
assert.deepEqual(calls, [
|
|
1597
|
+
"ordinary-namespace",
|
|
1598
|
+
"namespace-clean",
|
|
1599
|
+
"build",
|
|
1600
|
+
"public-no-arg",
|
|
1601
|
+
"daemon-election",
|
|
1602
|
+
"ordinary-discovery",
|
|
1603
|
+
"public-adoption",
|
|
1604
|
+
"coherent-publication",
|
|
1605
|
+
"web-after-cold",
|
|
1606
|
+
]);
|
|
1607
|
+
assert.equal(result.publicProcess.pid, 41);
|
|
1608
|
+
|
|
1609
|
+
calls.length = 0;
|
|
1610
|
+
await assert.rejects(
|
|
1611
|
+
runConfiglessProductJourneyOwnerBoot({
|
|
1612
|
+
createOrdinaryNamespace: operation("ordinary-namespace", {}),
|
|
1613
|
+
assertNamespaceClean: operation("namespace-clean"),
|
|
1614
|
+
buildBeforeMeasurement: operation("build"),
|
|
1615
|
+
launchPublicNoArgumentEntry: operation("public-no-arg", {}),
|
|
1616
|
+
observeElectedDaemon: async () => {
|
|
1617
|
+
calls.push("daemon-election");
|
|
1618
|
+
throw new Error("election failed");
|
|
1619
|
+
},
|
|
1620
|
+
observeOrdinarySessionDiscovery: operation("ordinary-discovery"),
|
|
1621
|
+
adoptThroughPublicApp: operation("public-adoption"),
|
|
1622
|
+
proveCoherentPublication: operation("coherent-publication"),
|
|
1623
|
+
startWebAfterColdBoundary: operation("web-after-cold"),
|
|
1624
|
+
}),
|
|
1625
|
+
/election failed/u,
|
|
1626
|
+
);
|
|
1627
|
+
assert.deepEqual(calls, [
|
|
1628
|
+
"ordinary-namespace",
|
|
1629
|
+
"namespace-clean",
|
|
1630
|
+
"build",
|
|
1631
|
+
"public-no-arg",
|
|
1632
|
+
"daemon-election",
|
|
1633
|
+
]);
|
|
1634
|
+
});
|
|
1635
|
+
|
|
1636
|
+
test("repeat runner drives every planned journey sequentially and stops at the first failure", async () => {
|
|
1637
|
+
const plan = resolveProductJourneyPlan(
|
|
1638
|
+
parseProductDiagnoseOptions(["--journey", "runtime-qualification", "--repeat", "3"]),
|
|
1639
|
+
);
|
|
1640
|
+
const calls = [];
|
|
1641
|
+
const results = await runProductJourneyPlan(plan, async ({ repetition }) => {
|
|
1642
|
+
calls.push(repetition);
|
|
1643
|
+
return `run-${repetition}`;
|
|
1644
|
+
});
|
|
1645
|
+
assert.deepEqual(calls, [1, 2, 3]);
|
|
1646
|
+
assert.deepEqual(results, ["run-1", "run-2", "run-3"]);
|
|
1647
|
+
|
|
1648
|
+
const failedCalls = [];
|
|
1649
|
+
await assert.rejects(
|
|
1650
|
+
runProductJourneyPlan(plan, async ({ repetition }) => {
|
|
1651
|
+
failedCalls.push(repetition);
|
|
1652
|
+
if (repetition === 2) throw new Error("failed run");
|
|
1653
|
+
}),
|
|
1654
|
+
/failed run/u,
|
|
1655
|
+
);
|
|
1656
|
+
assert.deepEqual(failedCalls, [1, 2]);
|
|
1657
|
+
});
|
|
1658
|
+
|
|
1659
|
+
test("implemented Card5, all, unknown, and invalid selections are fail closed", () => {
|
|
1660
|
+
assert.equal(
|
|
1661
|
+
resolveProductJourneyPlan(parseProductDiagnoseOptions(["--journey", "cross-client-handoff"]))[0]
|
|
1662
|
+
.journey.id,
|
|
1663
|
+
"cross-client-handoff",
|
|
1664
|
+
);
|
|
1665
|
+
assert.equal(
|
|
1666
|
+
resolveProductJourneyPlan(parseProductDiagnoseOptions(["--journey", "all"])).length,
|
|
1667
|
+
12,
|
|
1668
|
+
);
|
|
1669
|
+
assert.throws(
|
|
1670
|
+
() => resolveProductJourneyPlan(parseProductDiagnoseOptions(["--journey", "imaginary"])),
|
|
1671
|
+
/unknown ProductRig journey imaginary/u,
|
|
1672
|
+
);
|
|
1673
|
+
for (const value of ["0", "11", "1.5", "many"])
|
|
1674
|
+
assert.throws(
|
|
1675
|
+
() => parseProductDiagnoseOptions(["--repeat", value]),
|
|
1676
|
+
/--repeat requires an integer from 1 to 10/u,
|
|
1677
|
+
);
|
|
1678
|
+
for (const value of [",", "runtime-qualification,", ",runtime-qualification", "Focus", "a b"])
|
|
1679
|
+
assert.throws(
|
|
1680
|
+
() => parseProductDiagnoseOptions(["--journey", value]),
|
|
1681
|
+
/--journey requires non-empty lowercase journey ids/u,
|
|
1682
|
+
);
|
|
1683
|
+
assert.throws(
|
|
1684
|
+
() =>
|
|
1685
|
+
resolveProductJourneyPlan(
|
|
1686
|
+
parseProductDiagnoseOptions(["--journey", "all", "--journey", "runtime-qualification"]),
|
|
1687
|
+
),
|
|
1688
|
+
/all cannot be combined/u,
|
|
1689
|
+
);
|
|
1690
|
+
});
|
|
1691
|
+
|
|
1692
|
+
test("run ids are deterministic, bounded, and path safe", () => {
|
|
1693
|
+
assert.equal(
|
|
1694
|
+
productDiagnosticRunId({
|
|
1695
|
+
journeyId: "runtime-qualification",
|
|
1696
|
+
repetition: 2,
|
|
1697
|
+
now: "2026-08-17T14:30:12.345Z",
|
|
1698
|
+
nonce: "A1-B2_C3",
|
|
1699
|
+
}),
|
|
1700
|
+
"20260817143012345-runtime-qualification-r2-a1b2c3",
|
|
1701
|
+
);
|
|
1702
|
+
assert.equal(
|
|
1703
|
+
productDiagnosticRunId({
|
|
1704
|
+
journeyId: "first-key-paste",
|
|
1705
|
+
variant: "paste",
|
|
1706
|
+
repetition: 10,
|
|
1707
|
+
now: "2026-08-17T14:30:12.345Z",
|
|
1708
|
+
nonce: "C0FFEE",
|
|
1709
|
+
}),
|
|
1710
|
+
"20260817143012345-first-key-paste-paste-r10-c0ffee",
|
|
1711
|
+
);
|
|
1712
|
+
});
|
|
1713
|
+
|
|
1714
|
+
test("bundle writer creates the exact immutable M59.4 evidence set", () => {
|
|
1715
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-bundle-"));
|
|
1716
|
+
try {
|
|
1717
|
+
const webPngPath = join(temporary, "source.png");
|
|
1718
|
+
writeFileSync(webPngPath, Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]));
|
|
1719
|
+
const root = join(temporary, "bundles");
|
|
1720
|
+
const runId = "20260817143012345-runtime-qualification-r1-a1b2";
|
|
1721
|
+
const distribution = {
|
|
1722
|
+
sampleCount: 30,
|
|
1723
|
+
samples: Array.from({ length: 30 }, (_, index) => ({
|
|
1724
|
+
traceId: `trace-${index}`,
|
|
1725
|
+
durationMs: index + 1,
|
|
1726
|
+
parserOrigin: "keyboard",
|
|
1727
|
+
queueBefore: { inputPending: 0, inputInFlight: 0, inputPendingBytes: 0 },
|
|
1728
|
+
queueAfter: { inputPending: 0, inputInFlight: 0, inputPendingBytes: 0 },
|
|
1729
|
+
dirtyRowProved: true,
|
|
1730
|
+
fenceHealth: { droppedRecords: 0, oversizedRecords: 0, failed: false },
|
|
1731
|
+
})),
|
|
1732
|
+
};
|
|
1733
|
+
const evidence = {
|
|
1734
|
+
report: {
|
|
1735
|
+
status: "failed",
|
|
1736
|
+
distribution,
|
|
1737
|
+
},
|
|
1738
|
+
alignment: { firstBrokenBoundary: "release-to-receipt" },
|
|
1739
|
+
timeline:
|
|
1740
|
+
[
|
|
1741
|
+
"first-input-namespace-ready",
|
|
1742
|
+
"first-input-daemon-ready",
|
|
1743
|
+
"first-input-no-prior-hosted-input",
|
|
1744
|
+
"first-input-causal-paint",
|
|
1745
|
+
"distribution-lane-fresh",
|
|
1746
|
+
"distribution-samples",
|
|
1747
|
+
"first-input-web-correlation",
|
|
1748
|
+
]
|
|
1749
|
+
.map((phase) =>
|
|
1750
|
+
JSON.stringify(
|
|
1751
|
+
phase === "distribution-samples"
|
|
1752
|
+
? { phase, ...summarizeProductInputDistribution(distribution) }
|
|
1753
|
+
: { phase },
|
|
1754
|
+
),
|
|
1755
|
+
)
|
|
1756
|
+
.join("\n") + "\n",
|
|
1757
|
+
tmuxTruth: { panes: [] },
|
|
1758
|
+
daemonState: { generation: "daemon-1" },
|
|
1759
|
+
clientState: { committed: {}, pending: {} },
|
|
1760
|
+
tuiAnsi: "\u001b[Hframe",
|
|
1761
|
+
webPngPath,
|
|
1762
|
+
stderr: "diagnostic\n",
|
|
1763
|
+
reproduction:
|
|
1764
|
+
"#!/bin/sh\nset -eu\npnpm product:testdrive diagnose --journey runtime-qualification --repeat 1 --json\n",
|
|
1765
|
+
};
|
|
1766
|
+
const bundle = createProductDiagnosticBundle({ root, runId, evidence });
|
|
1767
|
+
assert.deepEqual(
|
|
1768
|
+
readdirSync(bundle.runDir).sort(),
|
|
1769
|
+
[...PRODUCT_DIAGNOSTIC_BUNDLE_FILES].sort(),
|
|
1770
|
+
);
|
|
1771
|
+
assert.equal(
|
|
1772
|
+
JSON.parse(readFileSync(join(bundle.runDir, "report.json"), "utf8")).status,
|
|
1773
|
+
"failed",
|
|
1774
|
+
);
|
|
1775
|
+
const sealedReport = JSON.parse(readFileSync(join(bundle.runDir, "report.json"), "utf8"));
|
|
1776
|
+
assert.equal(sealedReport.distribution.samples.length, 30);
|
|
1777
|
+
assert.equal(sealedReport.distribution.samples[29].fenceHealth.failed, false);
|
|
1778
|
+
const sealedTimeline = readFileSync(join(bundle.runDir, "timeline.jsonl"), "utf8")
|
|
1779
|
+
.trim()
|
|
1780
|
+
.split("\n")
|
|
1781
|
+
.map((line) => JSON.parse(line));
|
|
1782
|
+
assert.deepEqual(
|
|
1783
|
+
sealedTimeline.map(({ phase }) => phase),
|
|
1784
|
+
[
|
|
1785
|
+
"first-input-namespace-ready",
|
|
1786
|
+
"first-input-daemon-ready",
|
|
1787
|
+
"first-input-no-prior-hosted-input",
|
|
1788
|
+
"first-input-causal-paint",
|
|
1789
|
+
"distribution-lane-fresh",
|
|
1790
|
+
"distribution-samples",
|
|
1791
|
+
"first-input-web-correlation",
|
|
1792
|
+
],
|
|
1793
|
+
);
|
|
1794
|
+
assert.equal(sealedTimeline[5].sampleCount, 30);
|
|
1795
|
+
assert.equal("samples" in sealedTimeline[5], false);
|
|
1796
|
+
assert.equal(statSync(bundle.runDir).mode & 0o777, 0o500);
|
|
1797
|
+
assert.equal(statSync(join(bundle.runDir, "report.json")).mode & 0o777, 0o400);
|
|
1798
|
+
assert.equal(statSync(join(bundle.runDir, "reproduction.sh")).mode & 0o777, 0o500);
|
|
1799
|
+
const manifest = readdirSync(bundle.runDir).sort();
|
|
1800
|
+
assert.throws(
|
|
1801
|
+
() => writeFileSync(join(bundle.runDir, "report.json"), "overwritten\n"),
|
|
1802
|
+
(error) => error?.code === "EACCES",
|
|
1803
|
+
);
|
|
1804
|
+
assert.throws(
|
|
1805
|
+
() => writeFileSync(join(bundle.runDir, "eleventh-file"), "forbidden\n"),
|
|
1806
|
+
(error) => error?.code === "EACCES",
|
|
1807
|
+
);
|
|
1808
|
+
assert.throws(
|
|
1809
|
+
() => unlinkSync(join(bundle.runDir, "report.json")),
|
|
1810
|
+
(error) => error?.code === "EACCES",
|
|
1811
|
+
);
|
|
1812
|
+
assert.deepEqual(readdirSync(bundle.runDir).sort(), manifest);
|
|
1813
|
+
assert.throws(
|
|
1814
|
+
() => createProductDiagnosticBundle({ root, runId, evidence }),
|
|
1815
|
+
/already exists/u,
|
|
1816
|
+
);
|
|
1817
|
+
assert.throws(
|
|
1818
|
+
() => createProductDiagnosticBundle({ root, runId: "../escape", evidence }),
|
|
1819
|
+
/bounded lowercase slug/u,
|
|
1820
|
+
);
|
|
1821
|
+
} finally {
|
|
1822
|
+
removeTestTree(temporary);
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
test("bundle writer publishes a bounded explicit unavailable Web artifact", () => {
|
|
1827
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-placeholder-"));
|
|
1828
|
+
try {
|
|
1829
|
+
const webPng = Buffer.from(
|
|
1830
|
+
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
|
|
1831
|
+
"base64",
|
|
1832
|
+
);
|
|
1833
|
+
const runId = "20260817143012345-runtime-qualification-r1-failure";
|
|
1834
|
+
const bundle = createProductDiagnosticBundle({
|
|
1835
|
+
root: join(temporary, "bundles"),
|
|
1836
|
+
runId,
|
|
1837
|
+
evidence: {
|
|
1838
|
+
report: {
|
|
1839
|
+
status: "failed",
|
|
1840
|
+
firstBrokenBoundary: "product-rig-startup",
|
|
1841
|
+
failure: "owner never became ready",
|
|
1842
|
+
},
|
|
1843
|
+
alignment: {
|
|
1844
|
+
correlation: { complete: false, missing: ["web.semantic"] },
|
|
1845
|
+
availability: { tui: false, web: false },
|
|
1846
|
+
},
|
|
1847
|
+
timeline: "",
|
|
1848
|
+
tmuxTruth: { status: "unavailable" },
|
|
1849
|
+
daemonState: { revision: null, correlationComplete: false },
|
|
1850
|
+
clientState: {
|
|
1851
|
+
committed: null,
|
|
1852
|
+
pending: null,
|
|
1853
|
+
derived: null,
|
|
1854
|
+
correlationComplete: false,
|
|
1855
|
+
},
|
|
1856
|
+
tuiAnsi: "[unavailable]\n",
|
|
1857
|
+
webPng,
|
|
1858
|
+
stderr: "",
|
|
1859
|
+
reproduction: "#!/bin/sh\nexit 1\n",
|
|
1860
|
+
},
|
|
1861
|
+
});
|
|
1862
|
+
assert.deepEqual(
|
|
1863
|
+
readdirSync(bundle.runDir).sort(),
|
|
1864
|
+
[...PRODUCT_DIAGNOSTIC_BUNDLE_FILES].sort(),
|
|
1865
|
+
);
|
|
1866
|
+
assert.equal(readFileSync(join(bundle.runDir, "web.png")).equals(webPng), true);
|
|
1867
|
+
assert.equal(
|
|
1868
|
+
JSON.parse(readFileSync(join(bundle.runDir, "alignment.json"), "utf8")).correlation.complete,
|
|
1869
|
+
false,
|
|
1870
|
+
);
|
|
1871
|
+
} finally {
|
|
1872
|
+
removeTestTree(temporary);
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1876
|
+
test("attempt startup failure cleans up before publishing immutable placeholder evidence", async () => {
|
|
1877
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-attempt-failure-"));
|
|
1878
|
+
const events = [];
|
|
1879
|
+
const cause = new Error("owner never became ready");
|
|
1880
|
+
const entry = attemptEntry("20260817143012345-runtime-qualification-r1-startup");
|
|
1881
|
+
const receipt = cleanupReceipt(entry.runId, { daemon: { status: "not-started" } });
|
|
1882
|
+
try {
|
|
1883
|
+
let caught = null;
|
|
1884
|
+
try {
|
|
1885
|
+
await runIsolatedProductJourneyAttempt(entry, {
|
|
1886
|
+
onPhase: (phase) => events.push(`phase:${phase}`),
|
|
1887
|
+
preCleanup: async () => events.push("cleanup:before"),
|
|
1888
|
+
drive: async () => {
|
|
1889
|
+
events.push("drive");
|
|
1890
|
+
throw cause;
|
|
1891
|
+
},
|
|
1892
|
+
currentBoundary: () => "first-input-namespace-ready",
|
|
1893
|
+
postCleanup: async () => {
|
|
1894
|
+
events.push("cleanup:after");
|
|
1895
|
+
return receipt;
|
|
1896
|
+
},
|
|
1897
|
+
retryCleanup: () => assert.fail("successful cleanup cannot retry"),
|
|
1898
|
+
prepareFailure: async (error, boundary) => {
|
|
1899
|
+
events.push(`prepare:${boundary}`);
|
|
1900
|
+
return { evidence: failureEvidence(boundary, error.message) };
|
|
1901
|
+
},
|
|
1902
|
+
appendCleanupFailure: () => assert.fail("unexpected secondary cleanup failure"),
|
|
1903
|
+
publishFailure: async ({ evidence }, cleanupReceiptValue) => {
|
|
1904
|
+
events.push("publish:failure");
|
|
1905
|
+
const prepared = prepareProductDiagnosticBundlePublication({
|
|
1906
|
+
root: temporary,
|
|
1907
|
+
runId: entry.runId,
|
|
1908
|
+
report: evidence.report,
|
|
1909
|
+
evidence,
|
|
1910
|
+
cleanupReceipt: cleanupReceiptValue,
|
|
1911
|
+
});
|
|
1912
|
+
return createProductDiagnosticBundle({
|
|
1913
|
+
root: temporary,
|
|
1914
|
+
runId: entry.runId,
|
|
1915
|
+
evidence: prepared.evidence,
|
|
1916
|
+
});
|
|
1917
|
+
},
|
|
1918
|
+
publishSuccess: () => assert.fail("startup failure cannot publish success"),
|
|
1919
|
+
});
|
|
1920
|
+
} catch (error) {
|
|
1921
|
+
caught = error;
|
|
1922
|
+
}
|
|
1923
|
+
assert.ok(caught instanceof ProductJourneyAttemptError);
|
|
1924
|
+
assert.equal(caught.originalCause, cause);
|
|
1925
|
+
assert.equal(caught.boundary, "first-input-namespace-ready");
|
|
1926
|
+
assert.deepEqual(events, [
|
|
1927
|
+
"phase:pre-attempt-cleanup",
|
|
1928
|
+
"cleanup:before",
|
|
1929
|
+
"phase:product-rig-startup",
|
|
1930
|
+
"drive",
|
|
1931
|
+
"phase:attempt-cleanup",
|
|
1932
|
+
"cleanup:after",
|
|
1933
|
+
"phase:post-cleanup-validation",
|
|
1934
|
+
"prepare:first-input-namespace-ready",
|
|
1935
|
+
"phase:failure-bundle-publication",
|
|
1936
|
+
"publish:failure",
|
|
1937
|
+
]);
|
|
1938
|
+
assert.deepEqual(
|
|
1939
|
+
readdirSync(caught.bundle.runDir).sort(),
|
|
1940
|
+
[...PRODUCT_DIAGNOSTIC_BUNDLE_FILES].sort(),
|
|
1941
|
+
);
|
|
1942
|
+
const report = JSON.parse(readFileSync(join(caught.bundle.runDir, "report.json"), "utf8"));
|
|
1943
|
+
assert.equal(report.firstBrokenBoundary, "first-input-namespace-ready");
|
|
1944
|
+
assert.deepEqual(report.cleanupReceipt.daemon, { status: "not-started" });
|
|
1945
|
+
assert.equal(report.failure, cause.message);
|
|
1946
|
+
assert.equal(
|
|
1947
|
+
readFileSync(join(caught.bundle.runDir, "web.png")).equals(unavailableWebPng),
|
|
1948
|
+
true,
|
|
1949
|
+
);
|
|
1950
|
+
} finally {
|
|
1951
|
+
removeTestTree(temporary);
|
|
1952
|
+
}
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
test("failure evidence is awaited before cleanup and capture failures stay bounded", async () => {
|
|
1956
|
+
for (const mode of ["captured", "failed", "timeout", "abort-aware"]) {
|
|
1957
|
+
const entry = attemptEntry(`20260817143100000-cross-client-handoff-r1-${mode}`);
|
|
1958
|
+
const events = [];
|
|
1959
|
+
let lateResolve;
|
|
1960
|
+
const late = new Promise((resolve) => {
|
|
1961
|
+
lateResolve = resolve;
|
|
1962
|
+
});
|
|
1963
|
+
await assert.rejects(
|
|
1964
|
+
runIsolatedProductJourneyAttempt(entry, {
|
|
1965
|
+
onPhase: (phase) => events.push(`phase:${phase}`),
|
|
1966
|
+
preCleanup: async () => undefined,
|
|
1967
|
+
drive: async () => {
|
|
1968
|
+
throw new Error("readiness failed");
|
|
1969
|
+
},
|
|
1970
|
+
currentBoundary: () => "product-rig-startup",
|
|
1971
|
+
failureEvidenceTimeoutMs: 5,
|
|
1972
|
+
captureFailureEvidence: async (_error, _boundary, signal) => {
|
|
1973
|
+
events.push("capture:start");
|
|
1974
|
+
if (mode === "failed") throw new Error("capture failed");
|
|
1975
|
+
if (mode === "timeout") return late;
|
|
1976
|
+
if (mode === "abort-aware")
|
|
1977
|
+
return new Promise((resolve) => {
|
|
1978
|
+
signal.addEventListener(
|
|
1979
|
+
"abort",
|
|
1980
|
+
() => {
|
|
1981
|
+
events.push("capture:aborted");
|
|
1982
|
+
resolve(Object.freeze({ available: false, reason: "read-aborted" }));
|
|
1983
|
+
},
|
|
1984
|
+
{ once: true },
|
|
1985
|
+
);
|
|
1986
|
+
});
|
|
1987
|
+
events.push("capture:complete");
|
|
1988
|
+
return Object.freeze({ available: true, count: 1 });
|
|
1989
|
+
},
|
|
1990
|
+
postCleanup: async () => {
|
|
1991
|
+
events.push("cleanup");
|
|
1992
|
+
return cleanupReceipt(entry.runId);
|
|
1993
|
+
},
|
|
1994
|
+
retryCleanup: () => assert.fail("cleanup passed"),
|
|
1995
|
+
prepareFailure: async (_error, _boundary, _receipt, captured) => {
|
|
1996
|
+
events.push("prepare");
|
|
1997
|
+
return { captured };
|
|
1998
|
+
},
|
|
1999
|
+
appendCleanupFailure: () => assert.fail("no cleanup failure"),
|
|
2000
|
+
publishFailure: async ({ captured }) => {
|
|
2001
|
+
if (mode === "captured") assert.deepEqual(captured, { available: true, count: 1 });
|
|
2002
|
+
else
|
|
2003
|
+
assert.deepEqual(captured, {
|
|
2004
|
+
available: false,
|
|
2005
|
+
reason: mode === "abort-aware" ? "pre-cleanup-timeout" : `pre-cleanup-${mode}`,
|
|
2006
|
+
});
|
|
2007
|
+
return { runDir: `/immutable/precleanup-${mode}` };
|
|
2008
|
+
},
|
|
2009
|
+
publishSuccess: () => assert.fail("failure cannot publish success"),
|
|
2010
|
+
}),
|
|
2011
|
+
ProductJourneyAttemptError,
|
|
2012
|
+
);
|
|
2013
|
+
assert.ok(events.indexOf("capture:start") < events.indexOf("cleanup"));
|
|
2014
|
+
if (mode === "abort-aware")
|
|
2015
|
+
assert.ok(events.indexOf("capture:aborted") < events.indexOf("cleanup"));
|
|
2016
|
+
assert.ok(events.indexOf("cleanup") < events.indexOf("prepare"));
|
|
2017
|
+
lateResolve(Object.freeze({ available: true, count: 99 }));
|
|
2018
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
2019
|
+
}
|
|
2020
|
+
});
|
|
2021
|
+
|
|
2022
|
+
test("structured product boundary survives startup wrapping and cleanup", async () => {
|
|
2023
|
+
const boundaryError = new Error("promotion timed out");
|
|
2024
|
+
boundaryError.boundary = "canonical-promotion-adoption";
|
|
2025
|
+
boundaryError.observation = { predicates: [{ id: "fleet-row-session", status: "failed" }] };
|
|
2026
|
+
const terminalState = productRigTerminalFailureState(boundaryError, "product-rig-startup");
|
|
2027
|
+
assert.equal(terminalState.firstBrokenBoundary, "canonical-promotion-adoption");
|
|
2028
|
+
assert.equal(terminalState.failureObservation, boundaryError.observation);
|
|
2029
|
+
const restored = productRigTerminalFailureError(terminalState);
|
|
2030
|
+
assert.equal(restored.boundary, "canonical-promotion-adoption");
|
|
2031
|
+
assert.equal(restored.observation, boundaryError.observation);
|
|
2032
|
+
let preparedBoundary = null;
|
|
2033
|
+
await assert.rejects(
|
|
2034
|
+
runIsolatedProductJourneyAttempt(attemptEntry("structured-boundary"), {
|
|
2035
|
+
preCleanup: async () => undefined,
|
|
2036
|
+
drive: async () => {
|
|
2037
|
+
throw boundaryError;
|
|
2038
|
+
},
|
|
2039
|
+
currentBoundary: () => "product-rig-startup",
|
|
2040
|
+
postCleanup: async () => undefined,
|
|
2041
|
+
retryCleanup: () => assert.fail("cleanup succeeded"),
|
|
2042
|
+
prepareFailure: async (_error, boundary) => {
|
|
2043
|
+
preparedBoundary = boundary;
|
|
2044
|
+
return { evidence: failureEvidence(boundary, "promotion timed out") };
|
|
2045
|
+
},
|
|
2046
|
+
appendCleanupFailure: () => assert.fail("no cleanup failure"),
|
|
2047
|
+
publishFailure: async () => ({ runDir: "/immutable/structured-boundary" }),
|
|
2048
|
+
publishSuccess: () => assert.fail("failure cannot publish success"),
|
|
2049
|
+
}),
|
|
2050
|
+
(error) =>
|
|
2051
|
+
error instanceof ProductJourneyAttemptError &&
|
|
2052
|
+
error.boundary === "canonical-promotion-adoption" &&
|
|
2053
|
+
error.originalCause === boundaryError,
|
|
2054
|
+
);
|
|
2055
|
+
assert.equal(preparedBoundary, "canonical-promotion-adoption");
|
|
2056
|
+
});
|
|
2057
|
+
|
|
2058
|
+
test("bundle publication embeds and verifies its final immutable report path", () => {
|
|
2059
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-report-path-"));
|
|
2060
|
+
const root = join(temporary, "bundles");
|
|
2061
|
+
const runId = "20260818060000000-configless-cold-start-r1-path";
|
|
2062
|
+
try {
|
|
2063
|
+
const prepared = prepareProductDiagnosticBundlePublication({
|
|
2064
|
+
root,
|
|
2065
|
+
runId,
|
|
2066
|
+
report: { status: "failed", reportPath: null },
|
|
2067
|
+
evidence: {
|
|
2068
|
+
...failureEvidence("canonical-promotion-adoption", "timed out"),
|
|
2069
|
+
report: { status: "failed", reportPath: null },
|
|
2070
|
+
},
|
|
2071
|
+
cleanupReceipt: cleanupReceipt(runId),
|
|
2072
|
+
});
|
|
2073
|
+
const bundle = createProductDiagnosticBundle({ root, runId, evidence: prepared.evidence });
|
|
2074
|
+
const expected = join(bundle.runDir, "report.json");
|
|
2075
|
+
assert.equal(prepared.reportPath, expected);
|
|
2076
|
+
assert.equal(JSON.parse(readFileSync(expected, "utf8")).reportPath, expected);
|
|
2077
|
+
assert.equal(JSON.parse(readFileSync(expected, "utf8")).cleanupReceipt.passed, true);
|
|
2078
|
+
assert.equal(
|
|
2079
|
+
JSON.parse(readFileSync(join(bundle.runDir, "alignment.json"), "utf8")).reportPath,
|
|
2080
|
+
expected,
|
|
2081
|
+
);
|
|
2082
|
+
assert.equal(
|
|
2083
|
+
JSON.parse(readFileSync(join(bundle.runDir, "alignment.json"), "utf8")).cleanupReceipt.runId,
|
|
2084
|
+
runId,
|
|
2085
|
+
);
|
|
2086
|
+
assert.throws(
|
|
2087
|
+
() =>
|
|
2088
|
+
createProductDiagnosticBundle({
|
|
2089
|
+
root,
|
|
2090
|
+
runId: `${runId}-tampered`,
|
|
2091
|
+
evidence: {
|
|
2092
|
+
...prepared.evidence,
|
|
2093
|
+
report: { ...prepared.evidence.report, runId: `${runId}-tampered` },
|
|
2094
|
+
alignment: { ...prepared.evidence.alignment, cleanupReceipt: null },
|
|
2095
|
+
},
|
|
2096
|
+
}),
|
|
2097
|
+
/cleanup receipt/u,
|
|
2098
|
+
);
|
|
2099
|
+
assert.throws(
|
|
2100
|
+
() =>
|
|
2101
|
+
prepareProductDiagnosticBundlePublication({
|
|
2102
|
+
root,
|
|
2103
|
+
runId: `${runId}-other`,
|
|
2104
|
+
report: { status: "failed", reportPath: "/wrong/report.json" },
|
|
2105
|
+
evidence: failureEvidence("product-rig-startup", "failed"),
|
|
2106
|
+
cleanupReceipt: cleanupReceipt(`${runId}-other`),
|
|
2107
|
+
}),
|
|
2108
|
+
/does not match/u,
|
|
2109
|
+
);
|
|
2110
|
+
} finally {
|
|
2111
|
+
removeTestTree(temporary);
|
|
2112
|
+
}
|
|
2113
|
+
});
|
|
2114
|
+
|
|
2115
|
+
test("bundle preparation requires an exact passed immutable cleanup receipt", () => {
|
|
2116
|
+
const root = "/tmp/product-diagnostic-cleanup-contract";
|
|
2117
|
+
const runId = "20260818060000000-configless-cold-start-r1-cleanup";
|
|
2118
|
+
const input = {
|
|
2119
|
+
root,
|
|
2120
|
+
runId,
|
|
2121
|
+
report: { status: "passed", reportPath: null },
|
|
2122
|
+
evidence: failureEvidence(null, ""),
|
|
2123
|
+
};
|
|
2124
|
+
assert.throws(() => prepareProductDiagnosticBundlePublication(input), /cleanup receipt/u);
|
|
2125
|
+
for (const receipt of [
|
|
2126
|
+
cleanupReceipt("wrong-run"),
|
|
2127
|
+
cleanupReceipt(runId, { passed: false }),
|
|
2128
|
+
cleanupReceipt(runId, { ownerDead: false }),
|
|
2129
|
+
cleanupReceipt(runId, { pathsAbsent: false }),
|
|
2130
|
+
cleanupReceipt(runId, { failureCount: 1 }),
|
|
2131
|
+
cleanupReceipt(runId, { daemon: { status: "started", instanceId: "generation" } }),
|
|
2132
|
+
cleanupReceipt(runId, { daemon: { status: "not-started", pid: 1002 } }),
|
|
2133
|
+
cleanupReceipt(runId, {
|
|
2134
|
+
pathAbsence: {
|
|
2135
|
+
runtimeRoot: true,
|
|
2136
|
+
tmuxSocket: true,
|
|
2137
|
+
hostTmuxSocket: true,
|
|
2138
|
+
daemonInfo: true,
|
|
2139
|
+
tuiRuntime: false,
|
|
2140
|
+
},
|
|
2141
|
+
}),
|
|
2142
|
+
])
|
|
2143
|
+
assert.throws(
|
|
2144
|
+
() => prepareProductDiagnosticBundlePublication({ ...input, cleanupReceipt: receipt }),
|
|
2145
|
+
/cleanup receipt/u,
|
|
2146
|
+
);
|
|
2147
|
+
const canonical = prepareProductDiagnosticBundlePublication({
|
|
2148
|
+
...input,
|
|
2149
|
+
cleanupReceipt: cleanupReceipt(runId, {
|
|
2150
|
+
ownerToken: "must-not-seal",
|
|
2151
|
+
runtimeRoot: "/must/not/seal",
|
|
2152
|
+
daemon: {
|
|
2153
|
+
status: "started",
|
|
2154
|
+
instanceId: "daemon-generation-1",
|
|
2155
|
+
pid: 1002,
|
|
2156
|
+
authToken: "must-not-seal",
|
|
2157
|
+
},
|
|
2158
|
+
}),
|
|
2159
|
+
});
|
|
2160
|
+
assert.doesNotMatch(
|
|
2161
|
+
JSON.stringify(canonical.evidence),
|
|
2162
|
+
/ownerToken|authToken|must-not-seal|\/must\/not\/seal/u,
|
|
2163
|
+
);
|
|
2164
|
+
assert.deepEqual(Object.keys(canonical.report.cleanupReceipt).sort(), [
|
|
2165
|
+
"attempt",
|
|
2166
|
+
"completedAt",
|
|
2167
|
+
"daemon",
|
|
2168
|
+
"daemonDead",
|
|
2169
|
+
"failureCount",
|
|
2170
|
+
"namespaceDigest",
|
|
2171
|
+
"ownerDead",
|
|
2172
|
+
"ownerPid",
|
|
2173
|
+
"passed",
|
|
2174
|
+
"pathAbsence",
|
|
2175
|
+
"pathsAbsent",
|
|
2176
|
+
"requestId",
|
|
2177
|
+
"runId",
|
|
2178
|
+
"version",
|
|
2179
|
+
]);
|
|
2180
|
+
});
|
|
2181
|
+
|
|
2182
|
+
test("isolated attempts thread first-pass and retry cleanup receipts into every publication", async () => {
|
|
2183
|
+
const successEntry = attemptEntry("20260818060000000-configless-cold-start-r1-receipt-success");
|
|
2184
|
+
const firstReceipt = cleanupReceipt(successEntry.runId);
|
|
2185
|
+
const success = await runIsolatedProductJourneyAttempt(successEntry, {
|
|
2186
|
+
preCleanup: async () => undefined,
|
|
2187
|
+
drive: async () => ({ report: { status: "passed" } }),
|
|
2188
|
+
currentBoundary: () => "journey-drive",
|
|
2189
|
+
postCleanup: async () => firstReceipt,
|
|
2190
|
+
retryCleanup: () => assert.fail("first cleanup passed"),
|
|
2191
|
+
prepareFailure: () => assert.fail("success cannot prepare failure"),
|
|
2192
|
+
appendCleanupFailure: () => assert.fail("success has no cleanup failure"),
|
|
2193
|
+
publishFailure: () => assert.fail("success cannot publish failure"),
|
|
2194
|
+
publishSuccess: async (_completed, receipt) => receipt,
|
|
2195
|
+
});
|
|
2196
|
+
assert.equal(success, firstReceipt);
|
|
2197
|
+
|
|
2198
|
+
const failureEntry = attemptEntry("20260818060000000-configless-cold-start-r1-receipt-retry");
|
|
2199
|
+
const secondReceipt = cleanupReceipt(failureEntry.runId, { attempt: 2 });
|
|
2200
|
+
const journeyFailure = new Error("journey failed before cleanup");
|
|
2201
|
+
const cleanupFailure = new Error("first cleanup failed");
|
|
2202
|
+
await assert.rejects(
|
|
2203
|
+
runIsolatedProductJourneyAttempt(failureEntry, {
|
|
2204
|
+
preCleanup: async () => undefined,
|
|
2205
|
+
drive: async () => {
|
|
2206
|
+
throw journeyFailure;
|
|
2207
|
+
},
|
|
2208
|
+
currentBoundary: () => "diagnostic-correlation",
|
|
2209
|
+
postCleanup: async () => {
|
|
2210
|
+
throw cleanupFailure;
|
|
2211
|
+
},
|
|
2212
|
+
retryCleanup: async (error) => {
|
|
2213
|
+
assert.equal(error, cleanupFailure);
|
|
2214
|
+
return secondReceipt;
|
|
2215
|
+
},
|
|
2216
|
+
prepareFailure: async (_error, _boundary, receipt) => ({ receipt }),
|
|
2217
|
+
appendCleanupFailure: (_prepared, error) => assert.equal(error, cleanupFailure),
|
|
2218
|
+
publishFailure: async (prepared, receipt) => {
|
|
2219
|
+
assert.equal(prepared.receipt, secondReceipt);
|
|
2220
|
+
assert.equal(receipt, secondReceipt);
|
|
2221
|
+
return { runDir: "/immutable/retry-receipt" };
|
|
2222
|
+
},
|
|
2223
|
+
publishSuccess: () => assert.fail("journey failure cannot publish success"),
|
|
2224
|
+
}),
|
|
2225
|
+
(error) =>
|
|
2226
|
+
error instanceof ProductJourneyAttemptError && error.originalCause === journeyFailure,
|
|
2227
|
+
);
|
|
2228
|
+
});
|
|
2229
|
+
|
|
2230
|
+
test("post-cleanup provenance drift replaces success before immutable publication", async () => {
|
|
2231
|
+
const entry = attemptEntry("20260818060000000-window-lifecycle-r1-source-drift");
|
|
2232
|
+
const receipt = cleanupReceipt(entry.runId);
|
|
2233
|
+
const drift = new Error("source changed after cleanup");
|
|
2234
|
+
drift.boundary = "source-provenance";
|
|
2235
|
+
drift.observation = { reason: "source-drift", changedCount: 1 };
|
|
2236
|
+
await assert.rejects(
|
|
2237
|
+
runIsolatedProductJourneyAttempt(entry, {
|
|
2238
|
+
preCleanup: async () => undefined,
|
|
2239
|
+
drive: async () => ({ report: { status: "passed" } }),
|
|
2240
|
+
currentBoundary: () => "window-web-correlation",
|
|
2241
|
+
postCleanup: async () => receipt,
|
|
2242
|
+
retryCleanup: () => assert.fail("cleanup passed"),
|
|
2243
|
+
validateAfterCleanup: () => {
|
|
2244
|
+
throw drift;
|
|
2245
|
+
},
|
|
2246
|
+
prepareFailure: async (error, boundary, cleanup) => ({ error, boundary, cleanup }),
|
|
2247
|
+
appendCleanupFailure: () => assert.fail("no prior failure"),
|
|
2248
|
+
publishFailure: async (prepared, cleanup) => {
|
|
2249
|
+
assert.equal(prepared.error, drift);
|
|
2250
|
+
assert.equal(prepared.boundary, "source-provenance");
|
|
2251
|
+
assert.equal(prepared.cleanup, receipt);
|
|
2252
|
+
assert.equal(cleanup, receipt);
|
|
2253
|
+
return { runDir: "/immutable/source-drift" };
|
|
2254
|
+
},
|
|
2255
|
+
publishSuccess: () => assert.fail("drift cannot publish success"),
|
|
2256
|
+
}),
|
|
2257
|
+
(error) =>
|
|
2258
|
+
error instanceof ProductJourneyAttemptError &&
|
|
2259
|
+
error.boundary === "source-provenance" &&
|
|
2260
|
+
error.originalCause === drift,
|
|
2261
|
+
);
|
|
2262
|
+
});
|
|
2263
|
+
|
|
2264
|
+
test("post-cleanup provenance drift remains structured beside an earlier journey failure", async () => {
|
|
2265
|
+
const entry = attemptEntry("20260818060000000-window-lifecycle-r1-source-drift-secondary");
|
|
2266
|
+
const receipt = cleanupReceipt(entry.runId);
|
|
2267
|
+
const journey = new Error("window action failed");
|
|
2268
|
+
const drift = new Error("source changed after cleanup");
|
|
2269
|
+
drift.boundary = "source-provenance";
|
|
2270
|
+
drift.observation = { reason: "source-drift", changedCount: 2 };
|
|
2271
|
+
await assert.rejects(
|
|
2272
|
+
runIsolatedProductJourneyAttempt(entry, {
|
|
2273
|
+
preCleanup: async () => undefined,
|
|
2274
|
+
drive: async () => {
|
|
2275
|
+
throw journey;
|
|
2276
|
+
},
|
|
2277
|
+
currentBoundary: () => "window-rename-visible",
|
|
2278
|
+
postCleanup: async () => receipt,
|
|
2279
|
+
retryCleanup: () => assert.fail("cleanup passed"),
|
|
2280
|
+
validateAfterCleanup: () => {
|
|
2281
|
+
throw drift;
|
|
2282
|
+
},
|
|
2283
|
+
prepareFailure: async (error, boundary) => ({ error, boundary }),
|
|
2284
|
+
appendCleanupFailure: () => assert.fail("drift is not cleanup failure text"),
|
|
2285
|
+
appendValidationFailure: (prepared, error) => {
|
|
2286
|
+
prepared.sourceProvenanceFailure = error.observation;
|
|
2287
|
+
},
|
|
2288
|
+
publishFailure: async (prepared) => {
|
|
2289
|
+
assert.equal(prepared.error, journey);
|
|
2290
|
+
assert.equal(prepared.boundary, "window-rename-visible");
|
|
2291
|
+
assert.deepEqual(prepared.sourceProvenanceFailure, drift.observation);
|
|
2292
|
+
return { runDir: "/immutable/source-drift-secondary" };
|
|
2293
|
+
},
|
|
2294
|
+
publishSuccess: () => assert.fail("journey failed"),
|
|
2295
|
+
}),
|
|
2296
|
+
(error) =>
|
|
2297
|
+
error instanceof ProductJourneyAttemptError &&
|
|
2298
|
+
error.boundary === "window-rename-visible" &&
|
|
2299
|
+
error.originalCause === journey,
|
|
2300
|
+
);
|
|
2301
|
+
});
|
|
2302
|
+
|
|
2303
|
+
test("cleanup receipt builder rejects live identity or namespace residue", () => {
|
|
2304
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-cleanup-receipt-"));
|
|
2305
|
+
const entry = attemptEntry("20260818060000000-configless-cold-start-r1-builder");
|
|
2306
|
+
const state = {
|
|
2307
|
+
ownerPid: 2_000_000_001,
|
|
2308
|
+
daemonLifecycle: "started",
|
|
2309
|
+
daemon: { pid: 2_000_000_002, instanceId: "daemon-generation" },
|
|
2310
|
+
runtimeNamespace: {
|
|
2311
|
+
root: join(temporary, "absent"),
|
|
2312
|
+
tmuxSocketPath: join(temporary, "absent", "tmux.sock"),
|
|
2313
|
+
hostTmuxSocketPath: join(temporary, "absent", "host.sock"),
|
|
2314
|
+
daemonInfoDir: join(temporary, "absent", "daemon"),
|
|
2315
|
+
},
|
|
2316
|
+
cleanup: {
|
|
2317
|
+
requestId: "request",
|
|
2318
|
+
status: "passed",
|
|
2319
|
+
completedAt: "2026-08-18T10:30:11.842Z",
|
|
2320
|
+
failures: [],
|
|
2321
|
+
},
|
|
2322
|
+
};
|
|
2323
|
+
try {
|
|
2324
|
+
const receipt = createProductRigCleanupReceipt(entry, state, 1);
|
|
2325
|
+
assert.equal(receipt.ownerDead, true);
|
|
2326
|
+
assert.equal(receipt.daemonDead, true);
|
|
2327
|
+
assert.equal(receipt.pathsAbsent, true);
|
|
2328
|
+
assert.equal(receipt.daemon.status, "started");
|
|
2329
|
+
assert.doesNotMatch(JSON.stringify(receipt), /cleanupToken|ownerToken|\/tmp\//u);
|
|
2330
|
+
mkdirSync(state.runtimeNamespace.root);
|
|
2331
|
+
assert.throws(() => createProductRigCleanupReceipt(entry, state, 1), /cleanup receipt/u);
|
|
2332
|
+
assert.throws(
|
|
2333
|
+
() => createProductRigCleanupReceipt(entry, { ...state, ownerPid: process.pid }, 1),
|
|
2334
|
+
/cleanup receipt/u,
|
|
2335
|
+
);
|
|
2336
|
+
rmSync(state.runtimeNamespace.root, { recursive: true, force: true });
|
|
2337
|
+
const stateWithoutDaemon = { ...state };
|
|
2338
|
+
delete stateWithoutDaemon.daemon;
|
|
2339
|
+
const notStarted = createProductRigCleanupReceipt(
|
|
2340
|
+
entry,
|
|
2341
|
+
{
|
|
2342
|
+
...stateWithoutDaemon,
|
|
2343
|
+
daemonLifecycle: "not-started",
|
|
2344
|
+
ownedTuiRuntimeDirs: [join(temporary, "absent-tui")],
|
|
2345
|
+
},
|
|
2346
|
+
1,
|
|
2347
|
+
);
|
|
2348
|
+
assert.deepEqual(notStarted.daemon, { status: "not-started" });
|
|
2349
|
+
assert.equal(notStarted.pathAbsence.tuiRuntime, true);
|
|
2350
|
+
assert.throws(
|
|
2351
|
+
() =>
|
|
2352
|
+
createProductRigCleanupReceipt(
|
|
2353
|
+
entry,
|
|
2354
|
+
{
|
|
2355
|
+
...state,
|
|
2356
|
+
daemon: { pid: 2_000_000_002 },
|
|
2357
|
+
},
|
|
2358
|
+
1,
|
|
2359
|
+
),
|
|
2360
|
+
/source is incomplete/u,
|
|
2361
|
+
);
|
|
2362
|
+
for (const invalidDaemonState of [
|
|
2363
|
+
{ ...state, daemonLifecycle: "not-started" },
|
|
2364
|
+
{ ...state, daemonLifecycle: "starting" },
|
|
2365
|
+
{ ...state, daemon: null, daemonLifecycle: "not-started" },
|
|
2366
|
+
{ ...state, daemon: undefined, daemonLifecycle: "not-started" },
|
|
2367
|
+
{ ...state, daemonLifecycle: "started", daemon: undefined },
|
|
2368
|
+
])
|
|
2369
|
+
assert.throws(
|
|
2370
|
+
() => createProductRigCleanupReceipt(entry, invalidDaemonState, 1),
|
|
2371
|
+
/source is incomplete/u,
|
|
2372
|
+
);
|
|
2373
|
+
const tuiResidue = join(temporary, "tui-residue");
|
|
2374
|
+
mkdirSync(tuiResidue);
|
|
2375
|
+
assert.throws(
|
|
2376
|
+
() =>
|
|
2377
|
+
createProductRigCleanupReceipt(
|
|
2378
|
+
entry,
|
|
2379
|
+
{
|
|
2380
|
+
...stateWithoutDaemon,
|
|
2381
|
+
daemonLifecycle: "not-started",
|
|
2382
|
+
ownedTuiRuntimeDirs: [tuiResidue],
|
|
2383
|
+
},
|
|
2384
|
+
1,
|
|
2385
|
+
),
|
|
2386
|
+
/cleanup receipt/u,
|
|
2387
|
+
);
|
|
2388
|
+
} finally {
|
|
2389
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
2392
|
+
|
|
2393
|
+
test("command preflight seals one explicit no-resource receipt without fabricated path absence", () => {
|
|
2394
|
+
const entry = attemptEntry("20260822030000000-ansi-cursor-alt-screen-r1-preflight");
|
|
2395
|
+
const preflight = {
|
|
2396
|
+
operation: "product-rig-namespace-preflight",
|
|
2397
|
+
stage: "ansi-initial-pane-command",
|
|
2398
|
+
outcome: "command-rejected",
|
|
2399
|
+
resourcesCreated: false,
|
|
2400
|
+
pathsClaimed: 0,
|
|
2401
|
+
daemonStarted: false,
|
|
2402
|
+
};
|
|
2403
|
+
const state = {
|
|
2404
|
+
status: "failed",
|
|
2405
|
+
ownerPid: 2_000_000_111,
|
|
2406
|
+
daemonLifecycle: "not-started",
|
|
2407
|
+
firstBrokenBoundary: "ansi-namespace-ready",
|
|
2408
|
+
failureObservation: preflight,
|
|
2409
|
+
diagnosticAttempt: {
|
|
2410
|
+
runId: entry.runId,
|
|
2411
|
+
resourcesCreated: false,
|
|
2412
|
+
sourceProvenance: {
|
|
2413
|
+
commit: "a".repeat(40),
|
|
2414
|
+
tree: "b".repeat(40),
|
|
2415
|
+
manifestDigest: "c".repeat(64),
|
|
2416
|
+
},
|
|
2417
|
+
preflight,
|
|
2418
|
+
},
|
|
2419
|
+
cleanup: {
|
|
2420
|
+
requestId: "ansi-preflight-cleanup",
|
|
2421
|
+
status: "passed",
|
|
2422
|
+
cleanupToken: null,
|
|
2423
|
+
failures: [],
|
|
2424
|
+
completedAt: "2026-08-22T03:00:01.000Z",
|
|
2425
|
+
},
|
|
2426
|
+
};
|
|
2427
|
+
const receipt = createProductRigCleanupReceipt(entry, state, 1);
|
|
2428
|
+
assert.deepEqual(receipt.daemon, { status: "not-started" });
|
|
2429
|
+
assert.equal(receipt.scope, "preflight-no-resources");
|
|
2430
|
+
assert.equal(receipt.resourcesCreated, false);
|
|
2431
|
+
assert.equal(receipt.pathsClaimed, 0);
|
|
2432
|
+
assert.equal(Object.hasOwn(receipt, "pathsAbsent"), false);
|
|
2433
|
+
assert.equal(Object.hasOwn(receipt, "pathAbsence"), false);
|
|
2434
|
+
const prepared = prepareProductDiagnosticBundlePublication({
|
|
2435
|
+
root: "/immutable",
|
|
2436
|
+
runId: entry.runId,
|
|
2437
|
+
report: { version: 1, status: "failed", reportPath: null },
|
|
2438
|
+
evidence: { alignment: {} },
|
|
2439
|
+
cleanupReceipt: receipt,
|
|
2440
|
+
});
|
|
2441
|
+
assert.equal(prepared.report.cleanupReceipt.scope, "preflight-no-resources");
|
|
2442
|
+
for (const mutate of [
|
|
2443
|
+
(value) => (value.diagnosticAttempt.runId = `${entry.runId}-wrong`),
|
|
2444
|
+
(value) => (value.diagnosticAttempt.resourcesCreated = true),
|
|
2445
|
+
(value) => (value.diagnosticAttempt.preflight.pathsClaimed = 1),
|
|
2446
|
+
(value) => (value.diagnosticAttempt.preflight.outcome = "other"),
|
|
2447
|
+
(value) => (value.diagnosticAttempt.preflight.rawPath = "/tmp/forbidden"),
|
|
2448
|
+
(value) => (value.failureObservation.pathsClaimed = 1),
|
|
2449
|
+
(value) => (value.firstBrokenBoundary = "other"),
|
|
2450
|
+
(value) => (value.runtimeNamespace = {}),
|
|
2451
|
+
(value) => (value.cleanup.cleanupToken = "fabricated"),
|
|
2452
|
+
]) {
|
|
2453
|
+
const invalid = structuredClone(state);
|
|
2454
|
+
mutate(invalid);
|
|
2455
|
+
assert.throws(() => createProductRigCleanupReceipt(entry, invalid, 1), /cleanup receipt/u);
|
|
2456
|
+
}
|
|
2457
|
+
});
|
|
2458
|
+
|
|
2459
|
+
test("TUI cleanup buffers active evidence and removes every owned runtime path", () => {
|
|
2460
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-tui-buffer-"));
|
|
2461
|
+
const first = join(temporary, "first");
|
|
2462
|
+
const active = join(temporary, "active");
|
|
2463
|
+
const artifacts = join(temporary, "artifacts");
|
|
2464
|
+
mkdirSync(first);
|
|
2465
|
+
mkdirSync(active);
|
|
2466
|
+
writeFileSync(join(first, "stderr.log"), "first stderr\n");
|
|
2467
|
+
writeFileSync(join(active, "stderr.log"), "active stderr\n");
|
|
2468
|
+
writeFileSync(join(active, "trace.jsonl"), '{"type":"trace"}\n');
|
|
2469
|
+
try {
|
|
2470
|
+
const buffered = bufferOwnedTuiRuntimeEvidence({
|
|
2471
|
+
ownedRuntimeDirs: [first, active],
|
|
2472
|
+
activeTui: { runtimeDir: active, performanceTracePath: join(active, "trace.jsonl") },
|
|
2473
|
+
artifactDir: artifacts,
|
|
2474
|
+
pathExists: existsSync,
|
|
2475
|
+
ensureArtifactDir: (path) => mkdirSync(path, { recursive: true }),
|
|
2476
|
+
moveRuntimeDir: renameSync,
|
|
2477
|
+
});
|
|
2478
|
+
assert.equal(existsSync(first), false);
|
|
2479
|
+
assert.equal(existsSync(active), false);
|
|
2480
|
+
assert.equal(
|
|
2481
|
+
readFileSync(join(artifacts, "tui-runtime-1", "stderr.log"), "utf8"),
|
|
2482
|
+
"first stderr\n",
|
|
2483
|
+
);
|
|
2484
|
+
assert.equal(readFileSync(join(buffered.runtimeDir, "stderr.log"), "utf8"), "active stderr\n");
|
|
2485
|
+
assert.equal(readFileSync(buffered.performanceTracePath, "utf8"), '{"type":"trace"}\n');
|
|
2486
|
+
} finally {
|
|
2487
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
2488
|
+
}
|
|
2489
|
+
});
|
|
2490
|
+
|
|
2491
|
+
test("TUI evidence relocation recovers after a later move fails", () => {
|
|
2492
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-tui-buffer-retry-"));
|
|
2493
|
+
const first = join(temporary, "first");
|
|
2494
|
+
const second = join(temporary, "second");
|
|
2495
|
+
const artifacts = join(temporary, "artifacts");
|
|
2496
|
+
mkdirSync(first);
|
|
2497
|
+
mkdirSync(second);
|
|
2498
|
+
writeFileSync(join(first, "stderr.log"), "retained stderr\n");
|
|
2499
|
+
writeFileSync(join(first, "trace.jsonl"), '{"retained":true}\n');
|
|
2500
|
+
let activeTui = { runtimeDir: first, performanceTracePath: join(first, "trace.jsonl") };
|
|
2501
|
+
let failSecond = true;
|
|
2502
|
+
const operations = {
|
|
2503
|
+
ownedRuntimeDirs: [first, second],
|
|
2504
|
+
artifactDir: artifacts,
|
|
2505
|
+
pathExists: existsSync,
|
|
2506
|
+
ensureArtifactDir: (path) => mkdirSync(path, { recursive: true }),
|
|
2507
|
+
moveRuntimeDir: (source, destination) => {
|
|
2508
|
+
if (source === second && failSecond) {
|
|
2509
|
+
failSecond = false;
|
|
2510
|
+
throw new Error("injected second move failure");
|
|
2511
|
+
}
|
|
2512
|
+
renameSync(source, destination);
|
|
2513
|
+
},
|
|
2514
|
+
onActiveTuiRelocated: (tui) => {
|
|
2515
|
+
activeTui = tui;
|
|
2516
|
+
},
|
|
2517
|
+
};
|
|
2518
|
+
try {
|
|
2519
|
+
assert.throws(
|
|
2520
|
+
() => bufferOwnedTuiRuntimeEvidence({ ...operations, activeTui }),
|
|
2521
|
+
/second move failure/u,
|
|
2522
|
+
);
|
|
2523
|
+
assert.equal(activeTui.runtimeDir, join(artifacts, "tui-runtime-1"));
|
|
2524
|
+
assert.equal(readFileSync(activeTui.performanceTracePath, "utf8"), '{"retained":true}\n');
|
|
2525
|
+
activeTui = bufferOwnedTuiRuntimeEvidence({ ...operations, activeTui });
|
|
2526
|
+
assert.equal(existsSync(first), false);
|
|
2527
|
+
assert.equal(existsSync(second), false);
|
|
2528
|
+
assert.equal(
|
|
2529
|
+
readFileSync(join(activeTui.runtimeDir, "stderr.log"), "utf8"),
|
|
2530
|
+
"retained stderr\n",
|
|
2531
|
+
);
|
|
2532
|
+
} finally {
|
|
2533
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
2534
|
+
}
|
|
2535
|
+
});
|
|
2536
|
+
|
|
2537
|
+
test("namespace ownership is published before provenance and runtime setup failures", () => {
|
|
2538
|
+
for (const failure of ["provenance", "runtime"]) {
|
|
2539
|
+
const publications = [];
|
|
2540
|
+
assert.throws(
|
|
2541
|
+
() =>
|
|
2542
|
+
prepareOwnedTuiRuntime({
|
|
2543
|
+
ownership: { session: "session-a", runtimeNamespace: { root: "/tmp/owned" } },
|
|
2544
|
+
intendedTui: {
|
|
2545
|
+
runtimeDir: "/tmp/owned-tui",
|
|
2546
|
+
performanceTracePath: "/tmp/owned-tui/trace.jsonl",
|
|
2547
|
+
},
|
|
2548
|
+
publish: (value) => publications.push(value),
|
|
2549
|
+
resolveProvenance: () => {
|
|
2550
|
+
if (failure === "provenance") throw new Error("provenance failed");
|
|
2551
|
+
return { commit: "a".repeat(40), tree: "b".repeat(40) };
|
|
2552
|
+
},
|
|
2553
|
+
createRuntimeDir: () => {
|
|
2554
|
+
if (failure === "runtime") throw new Error("runtime failed");
|
|
2555
|
+
},
|
|
2556
|
+
}),
|
|
2557
|
+
new RegExp(`${failure} failed`, "u"),
|
|
2558
|
+
);
|
|
2559
|
+
assert.deepEqual(publications[0], {
|
|
2560
|
+
session: "session-a",
|
|
2561
|
+
runtimeNamespace: { root: "/tmp/owned" },
|
|
2562
|
+
tui: {
|
|
2563
|
+
runtimeDir: "/tmp/owned-tui",
|
|
2564
|
+
performanceTracePath: "/tmp/owned-tui/trace.jsonl",
|
|
2565
|
+
},
|
|
2566
|
+
ownedTuiRuntimeDirs: ["/tmp/owned-tui"],
|
|
2567
|
+
});
|
|
2568
|
+
if (failure === "runtime") {
|
|
2569
|
+
assert.equal(publications.length, 2);
|
|
2570
|
+
assert.equal(publications[1].tui.performanceTraceCommit, "a".repeat(40));
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
});
|
|
2574
|
+
|
|
2575
|
+
test("Card5 creates an absent owned TUI cwd and cleanup retires it before or after acquisition", () => {
|
|
2576
|
+
for (const acquired of [false, true]) {
|
|
2577
|
+
const temporary = mkdtempSync(join(tmpdir(), `product-rig-card5-cwd-${acquired}-`));
|
|
2578
|
+
const runtimeDir = join(temporary, "tui");
|
|
2579
|
+
const state = {};
|
|
2580
|
+
const publish = (value) => Object.assign(state, value);
|
|
2581
|
+
try {
|
|
2582
|
+
assert.equal(existsSync(runtimeDir), false);
|
|
2583
|
+
const tui = prepareOwnedTuiRuntime({
|
|
2584
|
+
ownership: {
|
|
2585
|
+
session: "card5-session",
|
|
2586
|
+
runtimeNamespace: { root: join(temporary, "namespace") },
|
|
2587
|
+
},
|
|
2588
|
+
intendedTui: {
|
|
2589
|
+
runtimeDir,
|
|
2590
|
+
performanceTracePath: join(runtimeDir, "performance-trace.jsonl"),
|
|
2591
|
+
},
|
|
2592
|
+
publish,
|
|
2593
|
+
resolveProvenance: () => ({
|
|
2594
|
+
commit: "a".repeat(40),
|
|
2595
|
+
tree: "b".repeat(40),
|
|
2596
|
+
manifestDigest: "c".repeat(64),
|
|
2597
|
+
}),
|
|
2598
|
+
createRuntimeDir: createIsolatedTargetedTuiCwd,
|
|
2599
|
+
});
|
|
2600
|
+
assert.deepEqual(state.ownedTuiRuntimeDirs, [runtimeDir]);
|
|
2601
|
+
assert.equal(prepareIsolatedTargetedTuiCwd(tui.runtimeDir), join(runtimeDir, "home"));
|
|
2602
|
+
assert.equal(statSync(runtimeDir).mode & 0o777, 0o700);
|
|
2603
|
+
assert.equal(statSync(join(runtimeDir, "home")).mode & 0o777, 0o700);
|
|
2604
|
+
if (acquired) writeFileSync(join(runtimeDir, "state.json"), '{"processId":123}\n');
|
|
2605
|
+
const artifacts = join(temporary, "artifacts");
|
|
2606
|
+
const bufferedTui = bufferOwnedTuiRuntimeEvidence({
|
|
2607
|
+
ownedRuntimeDirs: state.ownedTuiRuntimeDirs,
|
|
2608
|
+
activeTui: state.tui,
|
|
2609
|
+
artifactDir: artifacts,
|
|
2610
|
+
pathExists: existsSync,
|
|
2611
|
+
ensureArtifactDir: (path) => mkdirSync(path, { recursive: true, mode: 0o700 }),
|
|
2612
|
+
moveRuntimeDir: renameSync,
|
|
2613
|
+
});
|
|
2614
|
+
assert.equal(existsSync(runtimeDir), false);
|
|
2615
|
+
assert.equal(bufferedTui.runtimeDir, join(artifacts, "tui-runtime-1"));
|
|
2616
|
+
assert.equal(existsSync(join(bufferedTui.runtimeDir, "home")), true);
|
|
2617
|
+
assert.equal(existsSync(join(bufferedTui.runtimeDir, "state.json")), acquired);
|
|
2618
|
+
} finally {
|
|
2619
|
+
removeTestTree(temporary);
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2623
|
+
|
|
2624
|
+
test("pre-daemon fixture failure retains non-vacuous ownership through cleanup and sealed publication", async () => {
|
|
2625
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-ansi-early-failure-"));
|
|
2626
|
+
const runtimeNamespace = {
|
|
2627
|
+
root: temporary,
|
|
2628
|
+
tmuxSocketPath: join(temporary, "tmux.sock"),
|
|
2629
|
+
hostTmuxSocketPath: join(temporary, "host.sock"),
|
|
2630
|
+
daemonInfoDir: join(temporary, "daemon"),
|
|
2631
|
+
cleanupToken: "product-test-rig:ansi-early-failure",
|
|
2632
|
+
};
|
|
2633
|
+
const state = { ownerPid: 2_000_000_101, daemonLifecycle: "not-started" };
|
|
2634
|
+
const publish = (value) => Object.assign(state, value);
|
|
2635
|
+
const entry = attemptEntry("20260822013000000-ansi-cursor-alt-screen-r1-early");
|
|
2636
|
+
let sealedReceipt = null;
|
|
2637
|
+
try {
|
|
2638
|
+
await assert.rejects(
|
|
2639
|
+
runIsolatedProductJourneyAttempt(entry, {
|
|
2640
|
+
preCleanup: async () => undefined,
|
|
2641
|
+
drive: async () => {
|
|
2642
|
+
prepareOwnedTuiRuntime({
|
|
2643
|
+
ownership: { session: "ansi-session", runtimeNamespace },
|
|
2644
|
+
intendedTui: {
|
|
2645
|
+
runtimeDir: join(temporary, "tui-ansi"),
|
|
2646
|
+
performanceTracePath: join(temporary, "tui-ansi", "performance.jsonl"),
|
|
2647
|
+
},
|
|
2648
|
+
publish,
|
|
2649
|
+
resolveProvenance: () => ({
|
|
2650
|
+
commit: "a".repeat(40),
|
|
2651
|
+
tree: "b".repeat(40),
|
|
2652
|
+
manifestDigest: "c".repeat(64),
|
|
2653
|
+
}),
|
|
2654
|
+
createRuntimeDir: (path) => mkdirSync(path, { recursive: true }),
|
|
2655
|
+
});
|
|
2656
|
+
const error = new Error("ANSI tmux fixture did not reach exact stable geometry");
|
|
2657
|
+
error.boundary = "ansi-namespace-ready";
|
|
2658
|
+
error.observation = { stage: "ansi-tmux-precondition", outcome: "list-timeout" };
|
|
2659
|
+
throw error;
|
|
2660
|
+
},
|
|
2661
|
+
currentBoundary: () => "ansi-namespace-ready",
|
|
2662
|
+
postCleanup: async () => {
|
|
2663
|
+
removeTestTree(temporary);
|
|
2664
|
+
Object.assign(state, {
|
|
2665
|
+
status: "failed",
|
|
2666
|
+
cleanup: {
|
|
2667
|
+
requestId: "ansi-cleanup-1",
|
|
2668
|
+
status: "passed",
|
|
2669
|
+
cleanupToken: runtimeNamespace.cleanupToken,
|
|
2670
|
+
failures: [],
|
|
2671
|
+
completedAt: "2026-08-22T01:30:01.000Z",
|
|
2672
|
+
},
|
|
2673
|
+
});
|
|
2674
|
+
return createProductRigCleanupReceipt(entry, state, 1);
|
|
2675
|
+
},
|
|
2676
|
+
retryCleanup: () => assert.fail("exact early cleanup must not retry"),
|
|
2677
|
+
prepareFailure: async (error, boundary, receipt) => ({ error, boundary, receipt }),
|
|
2678
|
+
appendCleanupFailure: () => assert.fail("cleanup passed"),
|
|
2679
|
+
publishFailure: async (prepared, receipt) => {
|
|
2680
|
+
assert.equal(prepared.boundary, "ansi-namespace-ready");
|
|
2681
|
+
assert.equal(prepared.error.observation.stage, "ansi-tmux-precondition");
|
|
2682
|
+
assert.equal(receipt, prepared.receipt);
|
|
2683
|
+
assert.equal(receipt.daemon.status, "not-started");
|
|
2684
|
+
assert.equal(receipt.pathsAbsent, true);
|
|
2685
|
+
assert.match(receipt.namespaceDigest, /^[0-9a-f]{64}$/u);
|
|
2686
|
+
sealedReceipt = receipt;
|
|
2687
|
+
return { runDir: "/immutable/ansi-early-failure" };
|
|
2688
|
+
},
|
|
2689
|
+
publishSuccess: () => assert.fail("fixture failure cannot publish success"),
|
|
2690
|
+
}),
|
|
2691
|
+
(error) =>
|
|
2692
|
+
error instanceof ProductJourneyAttemptError &&
|
|
2693
|
+
error.boundary === "ansi-namespace-ready" &&
|
|
2694
|
+
error.bundle.runDir === "/immutable/ansi-early-failure",
|
|
2695
|
+
);
|
|
2696
|
+
assert.equal(sealedReceipt?.passed, true);
|
|
2697
|
+
assert.doesNotMatch(JSON.stringify(sealedReceipt), /cleanupToken|ansi-session|tmux\.sock/u);
|
|
2698
|
+
} finally {
|
|
2699
|
+
removeTestTree(temporary);
|
|
2700
|
+
}
|
|
2701
|
+
});
|
|
2702
|
+
|
|
2703
|
+
test("a partially-created distribution runtime is owned before failure and remains cleanable", () => {
|
|
2704
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-distribution-ownership-"));
|
|
2705
|
+
const firstRuntime = join(temporary, "tui-first-input");
|
|
2706
|
+
const distributionRuntime = join(temporary, "tui-input-distribution");
|
|
2707
|
+
const artifacts = join(temporary, "artifacts");
|
|
2708
|
+
mkdirSync(firstRuntime, { recursive: true });
|
|
2709
|
+
writeFileSync(join(firstRuntime, "first.log"), "first\n");
|
|
2710
|
+
const state = { ownedTuiRuntimeDirs: [firstRuntime] };
|
|
2711
|
+
const publish = (value) => Object.assign(state, value);
|
|
2712
|
+
try {
|
|
2713
|
+
assert.throws(
|
|
2714
|
+
() =>
|
|
2715
|
+
prepareOwnedTuiRuntime({
|
|
2716
|
+
ownership: {},
|
|
2717
|
+
intendedTui: {
|
|
2718
|
+
runtimeDir: distributionRuntime,
|
|
2719
|
+
performanceTracePath: join(distributionRuntime, "performance-trace.jsonl"),
|
|
2720
|
+
},
|
|
2721
|
+
ownedTuiRuntimeDirs: state.ownedTuiRuntimeDirs,
|
|
2722
|
+
publish,
|
|
2723
|
+
resolveProvenance: () => ({ commit: "a".repeat(40), tree: "b".repeat(40) }),
|
|
2724
|
+
createRuntimeDir: (runtimeDir) => {
|
|
2725
|
+
mkdirSync(runtimeDir, { recursive: true });
|
|
2726
|
+
writeFileSync(join(runtimeDir, "partial.log"), "retained partial evidence\n");
|
|
2727
|
+
throw new Error("partial distribution creation failed");
|
|
2728
|
+
},
|
|
2729
|
+
}),
|
|
2730
|
+
/partial distribution creation failed/u,
|
|
2731
|
+
);
|
|
2732
|
+
assert.deepEqual(state.ownedTuiRuntimeDirs, [firstRuntime, distributionRuntime]);
|
|
2733
|
+
bufferOwnedTuiRuntimeEvidence({
|
|
2734
|
+
ownedRuntimeDirs: state.ownedTuiRuntimeDirs,
|
|
2735
|
+
activeTui: state.tui,
|
|
2736
|
+
artifactDir: artifacts,
|
|
2737
|
+
pathExists: existsSync,
|
|
2738
|
+
ensureArtifactDir: (path) => mkdirSync(path, { recursive: true }),
|
|
2739
|
+
moveRuntimeDir: renameSync,
|
|
2740
|
+
});
|
|
2741
|
+
assert.equal(existsSync(firstRuntime), false);
|
|
2742
|
+
assert.equal(existsSync(distributionRuntime), false);
|
|
2743
|
+
assert.equal(
|
|
2744
|
+
readFileSync(join(artifacts, "tui-runtime-2", "partial.log"), "utf8"),
|
|
2745
|
+
"retained partial evidence\n",
|
|
2746
|
+
);
|
|
2747
|
+
} finally {
|
|
2748
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
2749
|
+
}
|
|
2750
|
+
});
|
|
2751
|
+
|
|
2752
|
+
test("daemon identity is published before readiness can fail", async () => {
|
|
2753
|
+
const record = { instanceId: "generation-a", pid: 2_000_000_002 };
|
|
2754
|
+
const publications = [];
|
|
2755
|
+
await assert.rejects(
|
|
2756
|
+
startOwnedProductRigDaemon({
|
|
2757
|
+
start: async () => ({ record }),
|
|
2758
|
+
publish: (value) => publications.push(value),
|
|
2759
|
+
waitUntilReady: async () => {
|
|
2760
|
+
throw new Error("readiness failed");
|
|
2761
|
+
},
|
|
2762
|
+
}),
|
|
2763
|
+
/readiness failed/u,
|
|
2764
|
+
);
|
|
2765
|
+
assert.deepEqual(publications, [
|
|
2766
|
+
{ daemonLifecycle: "starting" },
|
|
2767
|
+
{ daemonLifecycle: "started", daemon: record },
|
|
2768
|
+
]);
|
|
2769
|
+
});
|
|
2770
|
+
|
|
2771
|
+
test("attempt cleanup failure is bundled at its exact boundary", async () => {
|
|
2772
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-attempt-cleanup-"));
|
|
2773
|
+
const entry = attemptEntry("20260817143012345-runtime-qualification-r1-cleanup");
|
|
2774
|
+
const cleanupFailure = new Error("owner survived cleanup");
|
|
2775
|
+
const events = [];
|
|
2776
|
+
try {
|
|
2777
|
+
await assert.rejects(
|
|
2778
|
+
runIsolatedProductJourneyAttempt(entry, {
|
|
2779
|
+
preCleanup: async () => undefined,
|
|
2780
|
+
drive: async () => ({ status: "passed" }),
|
|
2781
|
+
currentBoundary: () => "journey-drive",
|
|
2782
|
+
postCleanup: async () => {
|
|
2783
|
+
events.push("cleanup:first-failed");
|
|
2784
|
+
throw cleanupFailure;
|
|
2785
|
+
},
|
|
2786
|
+
retryCleanup: async (error) => {
|
|
2787
|
+
assert.equal(error, cleanupFailure);
|
|
2788
|
+
events.push("cleanup:retry-passed");
|
|
2789
|
+
},
|
|
2790
|
+
prepareFailure: async (error, boundary) => {
|
|
2791
|
+
events.push("prepare:failure");
|
|
2792
|
+
return { evidence: failureEvidence(boundary, error.message) };
|
|
2793
|
+
},
|
|
2794
|
+
appendCleanupFailure: () => assert.fail("cleanup is the primary failure"),
|
|
2795
|
+
publishFailure: async ({ evidence }) => {
|
|
2796
|
+
events.push("publish:failure");
|
|
2797
|
+
return createProductDiagnosticBundle({ root: temporary, runId: entry.runId, evidence });
|
|
2798
|
+
},
|
|
2799
|
+
publishSuccess: () => assert.fail("cleanup failure cannot publish success"),
|
|
2800
|
+
}),
|
|
2801
|
+
(error) => {
|
|
2802
|
+
assert.ok(error instanceof ProductJourneyAttemptError);
|
|
2803
|
+
assert.equal(error.originalCause, cleanupFailure);
|
|
2804
|
+
assert.equal(error.boundary, "attempt-cleanup");
|
|
2805
|
+
assert.equal(
|
|
2806
|
+
JSON.parse(readFileSync(join(error.bundle.runDir, "report.json"), "utf8"))
|
|
2807
|
+
.firstBrokenBoundary,
|
|
2808
|
+
"attempt-cleanup",
|
|
2809
|
+
);
|
|
2810
|
+
assert.deepEqual(events, [
|
|
2811
|
+
"cleanup:first-failed",
|
|
2812
|
+
"cleanup:retry-passed",
|
|
2813
|
+
"prepare:failure",
|
|
2814
|
+
"publish:failure",
|
|
2815
|
+
]);
|
|
2816
|
+
return true;
|
|
2817
|
+
},
|
|
2818
|
+
);
|
|
2819
|
+
} finally {
|
|
2820
|
+
removeTestTree(temporary);
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
|
|
2824
|
+
test("persistent cleanup failure blocks evidence publication and later attempts", async () => {
|
|
2825
|
+
const entry = attemptEntry("20260817143012345-runtime-qualification-r1-cleanupblocked");
|
|
2826
|
+
let prepared = false;
|
|
2827
|
+
let published = false;
|
|
2828
|
+
await assert.rejects(
|
|
2829
|
+
runIsolatedProductJourneyAttempt(entry, {
|
|
2830
|
+
preCleanup: async () => undefined,
|
|
2831
|
+
drive: async () => ({ status: "passed" }),
|
|
2832
|
+
currentBoundary: () => "journey-drive",
|
|
2833
|
+
postCleanup: async () => {
|
|
2834
|
+
throw new Error("first exact cleanup failed");
|
|
2835
|
+
},
|
|
2836
|
+
retryCleanup: async () => {
|
|
2837
|
+
throw new Error("bounded exact cleanup retry failed");
|
|
2838
|
+
},
|
|
2839
|
+
prepareFailure: async () => {
|
|
2840
|
+
prepared = true;
|
|
2841
|
+
},
|
|
2842
|
+
appendCleanupFailure: () => undefined,
|
|
2843
|
+
publishFailure: async () => {
|
|
2844
|
+
published = true;
|
|
2845
|
+
},
|
|
2846
|
+
publishSuccess: async () => {
|
|
2847
|
+
published = true;
|
|
2848
|
+
},
|
|
2849
|
+
}),
|
|
2850
|
+
/cleanup barrier failed after bounded retry/u,
|
|
2851
|
+
);
|
|
2852
|
+
assert.equal(prepared, false);
|
|
2853
|
+
assert.equal(published, false);
|
|
2854
|
+
});
|
|
2855
|
+
|
|
2856
|
+
test("owner cleanup collector persists labeled subsystem failures and permits exact retry", async () => {
|
|
2857
|
+
let tuiAttempts = 0;
|
|
2858
|
+
const steps = () => [
|
|
2859
|
+
{
|
|
2860
|
+
subsystem: "tui",
|
|
2861
|
+
run: async () => {
|
|
2862
|
+
tuiAttempts += 1;
|
|
2863
|
+
if (tuiAttempts === 1) throw new Error(`tui stop failed ${"x".repeat(100)}`);
|
|
2864
|
+
},
|
|
2865
|
+
},
|
|
2866
|
+
{ subsystem: "daemon", run: async () => undefined },
|
|
2867
|
+
];
|
|
2868
|
+
const first = await collectProductRigCleanupFailures(steps(), { detailLimit: 32 });
|
|
2869
|
+
assert.equal(first.length, 1);
|
|
2870
|
+
assert.equal(first[0].subsystem, "tui");
|
|
2871
|
+
assert.equal(first[0].detail.length, 32);
|
|
2872
|
+
const retried = await collectProductRigCleanupFailures(steps(), { detailLimit: 32 });
|
|
2873
|
+
assert.deepEqual(retried, []);
|
|
2874
|
+
assert.equal(tuiAttempts, 2);
|
|
2875
|
+
});
|
|
2876
|
+
|
|
2877
|
+
test("internal owner cleanup preserves its retry actor until an exact attempt passes", async () => {
|
|
2878
|
+
const events = [];
|
|
2879
|
+
const blocked = await settleInternalProductRigCleanup({
|
|
2880
|
+
maxImmediateAttempts: 2,
|
|
2881
|
+
cleanup: async (attempt) => {
|
|
2882
|
+
events.push(`cleanup:${attempt}`);
|
|
2883
|
+
return { passed: false, failures: [{ subsystem: "tui" }] };
|
|
2884
|
+
},
|
|
2885
|
+
onTerminal: async () => events.push("owner:exit"),
|
|
2886
|
+
onRetryable: async () => events.push("owner:retain-token-poller"),
|
|
2887
|
+
});
|
|
2888
|
+
assert.equal(blocked.passed, false);
|
|
2889
|
+
assert.deepEqual(events, ["cleanup:1", "cleanup:2", "owner:retain-token-poller"]);
|
|
2890
|
+
|
|
2891
|
+
events.length = 0;
|
|
2892
|
+
const settled = await settleInternalProductRigCleanup({
|
|
2893
|
+
maxImmediateAttempts: 2,
|
|
2894
|
+
cleanup: async (attempt) => {
|
|
2895
|
+
events.push(`cleanup:${attempt}`);
|
|
2896
|
+
return { passed: attempt === 2, failures: [] };
|
|
2897
|
+
},
|
|
2898
|
+
onTerminal: async () => events.push("owner:exit"),
|
|
2899
|
+
onRetryable: async () => events.push("owner:retain-token-poller"),
|
|
2900
|
+
});
|
|
2901
|
+
assert.equal(settled.passed, true);
|
|
2902
|
+
assert.deepEqual(events, ["cleanup:1", "cleanup:2", "owner:exit"]);
|
|
2903
|
+
});
|
|
2904
|
+
|
|
2905
|
+
test("cleanup barrier rejects stopped publication before exact owner death and owned path removal", () => {
|
|
2906
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-cleanup-barrier-"));
|
|
2907
|
+
const socket = join(temporary, "main.sock");
|
|
2908
|
+
const tuiRuntime = join(temporary, "tui-runtime");
|
|
2909
|
+
writeFileSync(socket, "owned");
|
|
2910
|
+
mkdirSync(tuiRuntime);
|
|
2911
|
+
const state = {
|
|
2912
|
+
status: "stopped",
|
|
2913
|
+
ownerPid: process.pid,
|
|
2914
|
+
daemon: { pid: 987_654_321 },
|
|
2915
|
+
ownedTuiRuntimeDirs: [tuiRuntime],
|
|
2916
|
+
runtimeNamespace: {
|
|
2917
|
+
root: temporary,
|
|
2918
|
+
tmuxSocketPath: socket,
|
|
2919
|
+
hostTmuxSocketPath: join(temporary, "host.sock"),
|
|
2920
|
+
daemonInfoDir: join(temporary, "daemon"),
|
|
2921
|
+
cleanupToken: "exact-token",
|
|
2922
|
+
},
|
|
2923
|
+
cleanup: {
|
|
2924
|
+
requestId: "request-1",
|
|
2925
|
+
status: "passed",
|
|
2926
|
+
cleanupToken: "exact-token",
|
|
2927
|
+
failures: [],
|
|
2928
|
+
},
|
|
2929
|
+
};
|
|
2930
|
+
try {
|
|
2931
|
+
const premature = productRigCleanupBarrierFailures(state, "request-1", {
|
|
2932
|
+
processAlive: (pid) => pid === process.pid,
|
|
2933
|
+
pathExists: existsSync,
|
|
2934
|
+
});
|
|
2935
|
+
assert.ok(premature.includes("owner-process-live"));
|
|
2936
|
+
assert.ok(premature.includes("runtime-root-present"));
|
|
2937
|
+
assert.ok(premature.includes("tmux-socket-present"));
|
|
2938
|
+
assert.ok(premature.includes("tui-runtime-present"));
|
|
2939
|
+
} finally {
|
|
2940
|
+
removeTestTree(temporary);
|
|
2941
|
+
}
|
|
2942
|
+
assert.deepEqual(
|
|
2943
|
+
productRigCleanupBarrierFailures(state, "request-1", {
|
|
2944
|
+
processAlive: () => false,
|
|
2945
|
+
pathExists: existsSync,
|
|
2946
|
+
}),
|
|
2947
|
+
[],
|
|
2948
|
+
);
|
|
2949
|
+
assert.deepEqual(
|
|
2950
|
+
productRigCleanupBarrierFailures(
|
|
2951
|
+
{ ...state, status: "failed", failure: "startup broke" },
|
|
2952
|
+
"request-1",
|
|
2953
|
+
{
|
|
2954
|
+
processAlive: () => false,
|
|
2955
|
+
pathExists: existsSync,
|
|
2956
|
+
},
|
|
2957
|
+
),
|
|
2958
|
+
[],
|
|
2959
|
+
);
|
|
2960
|
+
});
|
|
2961
|
+
|
|
2962
|
+
test("cleanup barrier externally reobserves terminal host children after tokened owner exit", () => {
|
|
2963
|
+
const root = "/tmp/tmi-e2e-terminal-reap-proof";
|
|
2964
|
+
const state = {
|
|
2965
|
+
status: "failed",
|
|
2966
|
+
ownerPid: 778,
|
|
2967
|
+
daemon: { pid: 779 },
|
|
2968
|
+
runtimeNamespace: {
|
|
2969
|
+
root,
|
|
2970
|
+
tmuxSocketPath: `${root}/t.sock`,
|
|
2971
|
+
hostTmuxSocketPath: `${root}/host.sock`,
|
|
2972
|
+
daemonInfoDir: `${root}/daemon`,
|
|
2973
|
+
cleanupToken: "product-test-rig:terminal-reap",
|
|
2974
|
+
},
|
|
2975
|
+
cleanup: {
|
|
2976
|
+
requestId: "terminal-reap-request",
|
|
2977
|
+
status: "passed",
|
|
2978
|
+
cleanupToken: "product-test-rig:terminal-reap",
|
|
2979
|
+
failures: [],
|
|
2980
|
+
card5: { chromiumTerminalProcessCount: 0, electronTerminalProcessCount: 1 },
|
|
2981
|
+
},
|
|
2982
|
+
};
|
|
2983
|
+
const base = { processAlive: () => false, pathExists: () => false };
|
|
2984
|
+
assert.deepEqual(
|
|
2985
|
+
productRigCleanupBarrierFailures(state, "terminal-reap-request", {
|
|
2986
|
+
...base,
|
|
2987
|
+
retainedProcessIdentityStatus: () => "live",
|
|
2988
|
+
}),
|
|
2989
|
+
["owner-child-process-live"],
|
|
2990
|
+
);
|
|
2991
|
+
assert.deepEqual(productRigCleanupBarrierFailures(state, "terminal-reap-request", base), [
|
|
2992
|
+
"owner-child-reap-unverified",
|
|
2993
|
+
]);
|
|
2994
|
+
assert.deepEqual(
|
|
2995
|
+
productRigCleanupBarrierFailures(state, "terminal-reap-request", {
|
|
2996
|
+
...base,
|
|
2997
|
+
retainedProcessIdentityStatus: () => "absent",
|
|
2998
|
+
}),
|
|
2999
|
+
[],
|
|
3000
|
+
);
|
|
3001
|
+
});
|
|
3002
|
+
|
|
3003
|
+
test("retained process absence is exact for rootless zombies, disappearance, and PID reuse", () => {
|
|
3004
|
+
const identities = [
|
|
3005
|
+
{ kind: "owner", pid: 700, pgid: 700, startToken: "owner-start" },
|
|
3006
|
+
{ kind: "electron", pid: 701, pgid: 700, startToken: "electron-start" },
|
|
3007
|
+
];
|
|
3008
|
+
assert.equal(
|
|
3009
|
+
assessProductRigRetainedProcessAbsence(identities, [
|
|
3010
|
+
{ pid: 701, pgid: 700, startToken: "electron-start", command: "(Electron)" },
|
|
3011
|
+
]),
|
|
3012
|
+
"live",
|
|
3013
|
+
);
|
|
3014
|
+
assert.equal(assessProductRigRetainedProcessAbsence(identities, []), "absent");
|
|
3015
|
+
assert.equal(
|
|
3016
|
+
assessProductRigRetainedProcessAbsence(identities, [
|
|
3017
|
+
{ pid: 701, pgid: 700, startToken: "reused-start", command: "unrelated" },
|
|
3018
|
+
]),
|
|
3019
|
+
"absent",
|
|
3020
|
+
);
|
|
3021
|
+
assert.equal(assessProductRigRetainedProcessAbsence(identities, null), "invalid");
|
|
3022
|
+
});
|
|
3023
|
+
|
|
3024
|
+
test("a passed owner keeps accepting its exact reap acknowledgement request after timeout", () => {
|
|
3025
|
+
const request = {
|
|
3026
|
+
requestId: "request-a",
|
|
3027
|
+
ownerPid: 700,
|
|
3028
|
+
ownerToken: "a".repeat(48),
|
|
3029
|
+
cleanupToken: "cleanup-token",
|
|
3030
|
+
};
|
|
3031
|
+
const state = {
|
|
3032
|
+
ownerPid: request.ownerPid,
|
|
3033
|
+
ownerToken: request.ownerToken,
|
|
3034
|
+
runtimeNamespace: { cleanupToken: request.cleanupToken },
|
|
3035
|
+
cleanup: {
|
|
3036
|
+
requestId: request.requestId,
|
|
3037
|
+
status: "passed",
|
|
3038
|
+
processReap: { version: 1 },
|
|
3039
|
+
},
|
|
3040
|
+
};
|
|
3041
|
+
assert.equal(isProductRigPendingReapAck(state, request, "cross-client-handoff"), true);
|
|
3042
|
+
assert.equal(isProductRigPendingReapAck(state, request, "cross-client-handoff"), true);
|
|
3043
|
+
assert.equal(
|
|
3044
|
+
isProductRigPendingReapAck(state, { ...request, requestId: "foreign" }, "cross-client-handoff"),
|
|
3045
|
+
false,
|
|
3046
|
+
);
|
|
3047
|
+
assert.equal(
|
|
3048
|
+
isProductRigPendingReapAck(
|
|
3049
|
+
state,
|
|
3050
|
+
{ ...request, ownerToken: "b".repeat(48) },
|
|
3051
|
+
"cross-client-handoff",
|
|
3052
|
+
),
|
|
3053
|
+
false,
|
|
3054
|
+
);
|
|
3055
|
+
});
|
|
3056
|
+
|
|
3057
|
+
test("cleanup proof retirement removes the token ack before the recovery ledger", () => {
|
|
3058
|
+
const files = new Set(["ack", "ledger"]);
|
|
3059
|
+
assert.throws(() =>
|
|
3060
|
+
retireProductRigCleanupProofFiles({
|
|
3061
|
+
removeAck: () => files.delete("ack"),
|
|
3062
|
+
removeLedger: () => {
|
|
3063
|
+
throw new Error("controller-crash");
|
|
3064
|
+
},
|
|
3065
|
+
}),
|
|
3066
|
+
);
|
|
3067
|
+
assert.deepEqual([...files], ["ledger"]);
|
|
3068
|
+
retireProductRigCleanupProofFiles({
|
|
3069
|
+
removeAck: () => files.delete("ack"),
|
|
3070
|
+
removeLedger: () => files.delete("ledger"),
|
|
3071
|
+
});
|
|
3072
|
+
assert.deepEqual([...files], []);
|
|
3073
|
+
});
|
|
3074
|
+
|
|
3075
|
+
test("legacy cleanup captures a stable authorized owner and rootless descendant ledger", async () => {
|
|
3076
|
+
const root = "/tmp/tmi-e2e-legacy-recovery";
|
|
3077
|
+
const state = {
|
|
3078
|
+
status: "cleanup-failed",
|
|
3079
|
+
ownerPid: 700,
|
|
3080
|
+
ownerToken: "a".repeat(48),
|
|
3081
|
+
diagnosticAttempt: {
|
|
3082
|
+
runId: "legacy-run",
|
|
3083
|
+
sourceProvenance: {
|
|
3084
|
+
commit: "b".repeat(40),
|
|
3085
|
+
tree: "c".repeat(40),
|
|
3086
|
+
manifestDigest: "d".repeat(64),
|
|
3087
|
+
},
|
|
3088
|
+
},
|
|
3089
|
+
runtimeNamespace: { root, cleanupToken: "cleanup-token" },
|
|
3090
|
+
cleanup: { status: "failed", card5: { electronProcessCount: 1 } },
|
|
3091
|
+
};
|
|
3092
|
+
const authorization = {
|
|
3093
|
+
requestId: `legacy-${"e".repeat(24)}`,
|
|
3094
|
+
runId: "legacy-run",
|
|
3095
|
+
ownerToken: state.ownerToken,
|
|
3096
|
+
commit: "b".repeat(40),
|
|
3097
|
+
tree: "c".repeat(40),
|
|
3098
|
+
manifestDigest: "d".repeat(64),
|
|
3099
|
+
runtimeRoot: root,
|
|
3100
|
+
};
|
|
3101
|
+
const rows = [
|
|
3102
|
+
{ pid: 700, ppid: 1, pgid: 700, state: "S", startToken: "owner", command: "node owner" },
|
|
3103
|
+
{ pid: 701, ppid: 700, pgid: 700, state: "?Es", startToken: "child", command: "(Electron)" },
|
|
3104
|
+
];
|
|
3105
|
+
const ledger = await captureLegacyProductRigCleanupLedger(state, authorization, {
|
|
3106
|
+
readProcessRows: () => structuredClone(rows),
|
|
3107
|
+
yieldTurn: async () => {},
|
|
3108
|
+
});
|
|
3109
|
+
assert.equal(ledger.identities.length, 2);
|
|
3110
|
+
assert.equal(ledger.identities[1].command, "(Electron)");
|
|
3111
|
+
assert.match(ledger.identityHmac, /^[0-9a-f]{64}$/u);
|
|
3112
|
+
assert.deepEqual(
|
|
3113
|
+
acquireLegacyProductRigCleanupLedger(state, authorization, structuredClone(ledger)),
|
|
3114
|
+
ledger,
|
|
3115
|
+
);
|
|
3116
|
+
const completedState = {
|
|
3117
|
+
...state,
|
|
3118
|
+
status: "failed",
|
|
3119
|
+
cleanup: {
|
|
3120
|
+
status: "passed",
|
|
3121
|
+
failures: [],
|
|
3122
|
+
card5: { passed: true },
|
|
3123
|
+
processReap: {
|
|
3124
|
+
version: 1,
|
|
3125
|
+
identityCount: ledger.identities.length,
|
|
3126
|
+
terminalIdentityCount: ledger.identities.length - 1,
|
|
3127
|
+
identityHmac: ledger.identityHmac,
|
|
3128
|
+
},
|
|
3129
|
+
},
|
|
3130
|
+
};
|
|
3131
|
+
assert.deepEqual(
|
|
3132
|
+
acquireLegacyProductRigCleanupLedger(completedState, authorization, structuredClone(ledger)),
|
|
3133
|
+
ledger,
|
|
3134
|
+
);
|
|
3135
|
+
assert.equal(
|
|
3136
|
+
acquireLegacyProductRigCleanupLedger(
|
|
3137
|
+
{
|
|
3138
|
+
...completedState,
|
|
3139
|
+
cleanup: {
|
|
3140
|
+
...completedState.cleanup,
|
|
3141
|
+
processReap: { ...completedState.cleanup.processReap, identityHmac: "0".repeat(64) },
|
|
3142
|
+
},
|
|
3143
|
+
},
|
|
3144
|
+
authorization,
|
|
3145
|
+
structuredClone(ledger),
|
|
3146
|
+
),
|
|
3147
|
+
null,
|
|
3148
|
+
);
|
|
3149
|
+
assert.equal(
|
|
3150
|
+
acquireLegacyProductRigCleanupLedger(
|
|
3151
|
+
state,
|
|
3152
|
+
{ ...authorization, ownerToken: "f".repeat(48) },
|
|
3153
|
+
structuredClone(ledger),
|
|
3154
|
+
),
|
|
3155
|
+
null,
|
|
3156
|
+
);
|
|
3157
|
+
assert.equal(
|
|
3158
|
+
acquireLegacyProductRigCleanupLedger(
|
|
3159
|
+
state,
|
|
3160
|
+
{ ...authorization, manifestDigest: "0".repeat(64) },
|
|
3161
|
+
structuredClone(ledger),
|
|
3162
|
+
),
|
|
3163
|
+
null,
|
|
3164
|
+
);
|
|
3165
|
+
assert.equal(
|
|
3166
|
+
acquireLegacyProductRigCleanupLedger(
|
|
3167
|
+
{ ...state, runtimeNamespace: { ...state.runtimeNamespace, root: "/tmp/tmi-e2e-other" } },
|
|
3168
|
+
authorization,
|
|
3169
|
+
structuredClone(ledger),
|
|
3170
|
+
),
|
|
3171
|
+
null,
|
|
3172
|
+
);
|
|
3173
|
+
assert.equal(
|
|
3174
|
+
await captureLegacyProductRigCleanupLedger(
|
|
3175
|
+
state,
|
|
3176
|
+
{ ...authorization, runId: "wrong-run" },
|
|
3177
|
+
{ readProcessRows: () => rows },
|
|
3178
|
+
),
|
|
3179
|
+
null,
|
|
3180
|
+
);
|
|
3181
|
+
let turn = 0;
|
|
3182
|
+
assert.equal(
|
|
3183
|
+
await captureLegacyProductRigCleanupLedger(state, authorization, {
|
|
3184
|
+
readProcessRows: () =>
|
|
3185
|
+
turn++ === 0 ? rows : [{ ...rows[0] }, { ...rows[1], startToken: "replacement" }],
|
|
3186
|
+
yieldTurn: async () => {},
|
|
3187
|
+
}),
|
|
3188
|
+
null,
|
|
3189
|
+
);
|
|
3190
|
+
const capturePair = async (first, second) => {
|
|
3191
|
+
let read = 0;
|
|
3192
|
+
return captureLegacyProductRigCleanupLedger(state, authorization, {
|
|
3193
|
+
readProcessRows: () => structuredClone(read++ === 0 ? first : second),
|
|
3194
|
+
yieldTurn: async () => {},
|
|
3195
|
+
});
|
|
3196
|
+
};
|
|
3197
|
+
const unrelated = {
|
|
3198
|
+
pid: 900,
|
|
3199
|
+
ppid: 1,
|
|
3200
|
+
pgid: 900,
|
|
3201
|
+
state: "S",
|
|
3202
|
+
startToken: "unrelated",
|
|
3203
|
+
command: "x".repeat(8_000),
|
|
3204
|
+
};
|
|
3205
|
+
const emptyUnrelated = { ...unrelated, pid: 901, pgid: 901, command: "" };
|
|
3206
|
+
assert.equal(
|
|
3207
|
+
(await capturePair([...rows, unrelated, emptyUnrelated], [...rows, unrelated, emptyUnrelated]))
|
|
3208
|
+
.identities.length,
|
|
3209
|
+
2,
|
|
3210
|
+
);
|
|
3211
|
+
const disappeared = await capturePair(rows, [rows[0]]);
|
|
3212
|
+
assert.equal(disappeared.identities.length, 2);
|
|
3213
|
+
assert.equal(disappeared.identities[1].pid, 701);
|
|
3214
|
+
assert.equal(
|
|
3215
|
+
(await capturePair(rows, [{ ...rows[0], state: "R" }, rows[1]])).identities.length,
|
|
3216
|
+
2,
|
|
3217
|
+
);
|
|
3218
|
+
assert.equal(
|
|
3219
|
+
await capturePair(rows, [...rows, { ...rows[1], pid: 702, startToken: "new-child" }]),
|
|
3220
|
+
null,
|
|
3221
|
+
);
|
|
3222
|
+
assert.equal(
|
|
3223
|
+
await capturePair(rows, [{ ...rows[0] }, { ...rows[1], command: "x".repeat(5_000) }]),
|
|
3224
|
+
null,
|
|
3225
|
+
);
|
|
3226
|
+
assert.equal(await capturePair([rows[0]], [rows[0]]), null);
|
|
3227
|
+
});
|
|
3228
|
+
|
|
3229
|
+
test("legacy cleanup revalidates every signal and retains failure until exact absence", async () => {
|
|
3230
|
+
const base = {
|
|
3231
|
+
version: 1,
|
|
3232
|
+
mode: "legacy-cleanup-v1",
|
|
3233
|
+
identities: [
|
|
3234
|
+
{
|
|
3235
|
+
pid: 700,
|
|
3236
|
+
ppid: 1,
|
|
3237
|
+
pgid: 700,
|
|
3238
|
+
state: "S",
|
|
3239
|
+
startToken: "owner",
|
|
3240
|
+
command: "node owner",
|
|
3241
|
+
ownership: "owner",
|
|
3242
|
+
},
|
|
3243
|
+
{
|
|
3244
|
+
pid: 701,
|
|
3245
|
+
ppid: 700,
|
|
3246
|
+
pgid: 700,
|
|
3247
|
+
state: "S",
|
|
3248
|
+
startToken: "child",
|
|
3249
|
+
command: "(Electron)",
|
|
3250
|
+
ownership: "descendant",
|
|
3251
|
+
},
|
|
3252
|
+
],
|
|
3253
|
+
};
|
|
3254
|
+
let rows = structuredClone(base.identities);
|
|
3255
|
+
const signals = [];
|
|
3256
|
+
const passed = await retireLegacyProductRigCleanupIdentities(base, {
|
|
3257
|
+
readProcessRows: () => structuredClone(rows),
|
|
3258
|
+
signalProcess: (pid, signal) => {
|
|
3259
|
+
signals.push([pid, signal]);
|
|
3260
|
+
if (signal === "SIGKILL") rows = rows.filter((row) => row.pid !== pid);
|
|
3261
|
+
},
|
|
3262
|
+
sleep: async () => {},
|
|
3263
|
+
});
|
|
3264
|
+
assert.equal(passed.passed, true);
|
|
3265
|
+
assert.deepEqual(signals, [
|
|
3266
|
+
[701, "SIGTERM"],
|
|
3267
|
+
[700, "SIGTERM"],
|
|
3268
|
+
[701, "SIGKILL"],
|
|
3269
|
+
[700, "SIGKILL"],
|
|
3270
|
+
]);
|
|
3271
|
+
|
|
3272
|
+
rows = structuredClone(base.identities);
|
|
3273
|
+
const reusedSignals = [];
|
|
3274
|
+
const reused = await retireLegacyProductRigCleanupIdentities(base, {
|
|
3275
|
+
readProcessRows: () => structuredClone(rows),
|
|
3276
|
+
signalProcess: (pid, signal) => {
|
|
3277
|
+
reusedSignals.push([pid, signal]);
|
|
3278
|
+
if (pid === 701) {
|
|
3279
|
+
rows = rows.filter((row) => row.pid !== 701);
|
|
3280
|
+
rows[0].startToken = "owner-reused";
|
|
3281
|
+
}
|
|
3282
|
+
},
|
|
3283
|
+
sleep: async () => {},
|
|
3284
|
+
});
|
|
3285
|
+
assert.equal(reused.passed, true);
|
|
3286
|
+
assert.deepEqual(reusedSignals, [[701, "SIGTERM"]]);
|
|
3287
|
+
assert.equal(rows[0].startToken, "owner-reused");
|
|
3288
|
+
|
|
3289
|
+
rows = [{ ...base.identities[1], ppid: 1 }];
|
|
3290
|
+
const childPersists = await retireLegacyProductRigCleanupIdentities(base, {
|
|
3291
|
+
readProcessRows: () => structuredClone(rows),
|
|
3292
|
+
signalProcess: () => {},
|
|
3293
|
+
sleep: async () => {},
|
|
3294
|
+
});
|
|
3295
|
+
assert.equal(childPersists.passed, false);
|
|
3296
|
+
assert.equal(childPersists.reason, "legacy-identity-live");
|
|
3297
|
+
|
|
3298
|
+
rows = [{ ...base.identities[1], ppid: 1 }];
|
|
3299
|
+
const firstRetry = await retireLegacyProductRigCleanupIdentities(base, {
|
|
3300
|
+
readProcessRows: () => structuredClone(rows),
|
|
3301
|
+
signalProcess: () => {},
|
|
3302
|
+
sleep: async () => {},
|
|
3303
|
+
});
|
|
3304
|
+
assert.equal(firstRetry.passed, false);
|
|
3305
|
+
rows = [];
|
|
3306
|
+
const secondRetry = await retireLegacyProductRigCleanupIdentities(base, {
|
|
3307
|
+
readProcessRows: () => structuredClone(rows),
|
|
3308
|
+
signalProcess: () => assert.fail("an absent original identity must never be signalled"),
|
|
3309
|
+
sleep: async () => {},
|
|
3310
|
+
});
|
|
3311
|
+
assert.equal(secondRetry.passed, true);
|
|
3312
|
+
});
|
|
3313
|
+
|
|
3314
|
+
test("legacy cleanup admits only isolated Card5 host residue with every other axis clean", () => {
|
|
3315
|
+
const root = "/tmp/tmi-e2e-legacy-admission";
|
|
3316
|
+
const state = {
|
|
3317
|
+
status: "cleanup-failed",
|
|
3318
|
+
ownerPid: 700,
|
|
3319
|
+
ownerToken: "a".repeat(48),
|
|
3320
|
+
daemon: { pid: 702 },
|
|
3321
|
+
diagnosticAttempt: {
|
|
3322
|
+
runId: "legacy-run",
|
|
3323
|
+
sourceProvenance: {
|
|
3324
|
+
commit: "b".repeat(40),
|
|
3325
|
+
tree: "c".repeat(40),
|
|
3326
|
+
manifestDigest: "d".repeat(64),
|
|
3327
|
+
},
|
|
3328
|
+
},
|
|
3329
|
+
runtimeNamespace: { root, cleanupToken: "cleanup-token" },
|
|
3330
|
+
cleanup: {
|
|
3331
|
+
status: "failed",
|
|
3332
|
+
failures: [{ subsystem: "card5-cleanup-ledger", detail: "owned host residue remained" }],
|
|
3333
|
+
card5: {
|
|
3334
|
+
passed: false,
|
|
3335
|
+
owners: Object.fromEntries(
|
|
3336
|
+
["chromium", "electron", "opentui", "daemon", "namespace"].map((name) => [
|
|
3337
|
+
name,
|
|
3338
|
+
{ owned: true, retired: name !== "electron" },
|
|
3339
|
+
]),
|
|
3340
|
+
),
|
|
3341
|
+
chromiumProcessCount: 0,
|
|
3342
|
+
chromiumDescendantCount: 0,
|
|
3343
|
+
chromiumTerminalProcessCount: 0,
|
|
3344
|
+
chromiumPageCount: 0,
|
|
3345
|
+
chromiumContextCount: 0,
|
|
3346
|
+
chromiumListenerCount: 0,
|
|
3347
|
+
electronProcessCount: 0,
|
|
3348
|
+
electronDescendantCount: 0,
|
|
3349
|
+
electronTerminalProcessCount: 1,
|
|
3350
|
+
electronWindowCount: 0,
|
|
3351
|
+
electronListenerCount: 0,
|
|
3352
|
+
electronOpenHandleCount: 0,
|
|
3353
|
+
socketResidueCount: 0,
|
|
3354
|
+
nativeObserverProcessCount: 0,
|
|
3355
|
+
pathResidueCount: 0,
|
|
3356
|
+
},
|
|
3357
|
+
},
|
|
3358
|
+
};
|
|
3359
|
+
const identities = [
|
|
3360
|
+
{
|
|
3361
|
+
pid: 700,
|
|
3362
|
+
ppid: 1,
|
|
3363
|
+
pgid: 700,
|
|
3364
|
+
state: "S",
|
|
3365
|
+
startToken: "owner",
|
|
3366
|
+
command: "node owner",
|
|
3367
|
+
ownership: "owner",
|
|
3368
|
+
},
|
|
3369
|
+
{
|
|
3370
|
+
pid: 701,
|
|
3371
|
+
ppid: 700,
|
|
3372
|
+
pgid: 700,
|
|
3373
|
+
state: "?Es",
|
|
3374
|
+
startToken: "child",
|
|
3375
|
+
command: "(Electron)",
|
|
3376
|
+
ownership: "descendant",
|
|
3377
|
+
},
|
|
3378
|
+
];
|
|
3379
|
+
const ledger = {
|
|
3380
|
+
version: 1,
|
|
3381
|
+
mode: "legacy-cleanup-v1",
|
|
3382
|
+
requestId: `legacy-${"e".repeat(24)}`,
|
|
3383
|
+
runId: "legacy-run",
|
|
3384
|
+
ownerPid: 700,
|
|
3385
|
+
cleanupToken: "cleanup-token",
|
|
3386
|
+
provenance: state.diagnosticAttempt.sourceProvenance,
|
|
3387
|
+
runtimeRoot: root,
|
|
3388
|
+
identities,
|
|
3389
|
+
identityHmac: createHmac("sha256", Buffer.from(state.ownerToken, "hex"))
|
|
3390
|
+
.update(JSON.stringify(identities))
|
|
3391
|
+
.digest("hex"),
|
|
3392
|
+
};
|
|
3393
|
+
const clean = { processAlive: () => false, pathExists: () => false };
|
|
3394
|
+
assert.equal(assessLegacyProductRigCleanupAdmission(state, ledger, clean).passed, true);
|
|
3395
|
+
const oldShape = structuredClone(state);
|
|
3396
|
+
oldShape.cleanup.card5.electronProcessCount = 1;
|
|
3397
|
+
delete oldShape.cleanup.card5.electronTerminalProcessCount;
|
|
3398
|
+
assert.equal(assessLegacyProductRigCleanupAdmission(oldShape, ledger, clean).passed, true);
|
|
3399
|
+
for (const changed of [
|
|
3400
|
+
{ cleanup: { ...state.cleanup, failures: [{ subsystem: "daemon", detail: "live" }] } },
|
|
3401
|
+
{ cleanup: { ...state.cleanup, card5: { ...state.cleanup.card5, pathResidueCount: 1 } } },
|
|
3402
|
+
{
|
|
3403
|
+
cleanup: {
|
|
3404
|
+
...state.cleanup,
|
|
3405
|
+
card5: { ...state.cleanup.card5, nativeObserverProcessCount: 1 },
|
|
3406
|
+
},
|
|
3407
|
+
},
|
|
3408
|
+
])
|
|
3409
|
+
assert.equal(
|
|
3410
|
+
assessLegacyProductRigCleanupAdmission({ ...state, ...changed }, ledger, clean).passed,
|
|
3411
|
+
false,
|
|
3412
|
+
);
|
|
3413
|
+
assert.equal(
|
|
3414
|
+
assessLegacyProductRigCleanupAdmission(state, ledger, {
|
|
3415
|
+
processAlive: (pid) => pid === state.daemon.pid,
|
|
3416
|
+
pathExists: () => false,
|
|
3417
|
+
}).passed,
|
|
3418
|
+
false,
|
|
3419
|
+
);
|
|
3420
|
+
assert.equal(
|
|
3421
|
+
assessLegacyProductRigCleanupAdmission(state, ledger, {
|
|
3422
|
+
processAlive: () => false,
|
|
3423
|
+
pathExists: (path) => path === root,
|
|
3424
|
+
}).passed,
|
|
3425
|
+
false,
|
|
3426
|
+
);
|
|
3427
|
+
});
|
|
3428
|
+
|
|
3429
|
+
test("legacy owner retry admits only the exact vanished sole Electron residue", () => {
|
|
3430
|
+
const root = "/tmp/tmi-e2e-legacy-owner-retry";
|
|
3431
|
+
const authorization = {
|
|
3432
|
+
requestId: `legacy-${"e".repeat(24)}`,
|
|
3433
|
+
runId: "legacy-run",
|
|
3434
|
+
ownerToken: "a".repeat(48),
|
|
3435
|
+
commit: "b".repeat(40),
|
|
3436
|
+
tree: "c".repeat(40),
|
|
3437
|
+
manifestDigest: "d".repeat(64),
|
|
3438
|
+
runtimeRoot: root,
|
|
3439
|
+
};
|
|
3440
|
+
const state = {
|
|
3441
|
+
status: "cleanup-failed",
|
|
3442
|
+
ownerPid: 700,
|
|
3443
|
+
ownerToken: authorization.ownerToken,
|
|
3444
|
+
daemon: { pid: 702 },
|
|
3445
|
+
diagnosticAttempt: {
|
|
3446
|
+
runId: authorization.runId,
|
|
3447
|
+
sourceProvenance: {
|
|
3448
|
+
commit: authorization.commit,
|
|
3449
|
+
tree: authorization.tree,
|
|
3450
|
+
manifestDigest: authorization.manifestDigest,
|
|
3451
|
+
},
|
|
3452
|
+
},
|
|
3453
|
+
runtimeNamespace: { root, cleanupToken: "cleanup-token" },
|
|
3454
|
+
cleanup: {
|
|
3455
|
+
status: "failed",
|
|
3456
|
+
failures: [{ subsystem: "card5-cleanup-ledger", detail: "owned host residue remained" }],
|
|
3457
|
+
card5: {
|
|
3458
|
+
passed: false,
|
|
3459
|
+
owners: {
|
|
3460
|
+
chromium: { owned: true, retired: true },
|
|
3461
|
+
electron: { owned: true, retired: false },
|
|
3462
|
+
opentui: { owned: false, retired: true },
|
|
3463
|
+
daemon: { owned: true, retired: true },
|
|
3464
|
+
namespace: { owned: true, retired: true },
|
|
3465
|
+
},
|
|
3466
|
+
chromiumProcessCount: 0,
|
|
3467
|
+
chromiumDescendantCount: 0,
|
|
3468
|
+
electronProcessCount: 1,
|
|
3469
|
+
electronDescendantCount: 0,
|
|
3470
|
+
chromiumPageCount: 0,
|
|
3471
|
+
chromiumContextCount: 0,
|
|
3472
|
+
chromiumListenerCount: 0,
|
|
3473
|
+
electronWindowCount: 0,
|
|
3474
|
+
electronListenerCount: 0,
|
|
3475
|
+
electronOpenHandleCount: 0,
|
|
3476
|
+
socketResidueCount: 0,
|
|
3477
|
+
nativeObserverProcessCount: 0,
|
|
3478
|
+
pathResidueCount: 0,
|
|
3479
|
+
},
|
|
3480
|
+
},
|
|
3481
|
+
};
|
|
3482
|
+
const owner = {
|
|
3483
|
+
pid: 700,
|
|
3484
|
+
ppid: 1,
|
|
3485
|
+
pgid: 700,
|
|
3486
|
+
state: "S",
|
|
3487
|
+
startToken: "owner-start",
|
|
3488
|
+
command: "node owner",
|
|
3489
|
+
};
|
|
3490
|
+
const clean = { processAlive: () => false, pathExists: () => false };
|
|
3491
|
+
assert.equal(
|
|
3492
|
+
assessLegacyProductRigOwnerRetryCompatibility(
|
|
3493
|
+
state,
|
|
3494
|
+
authorization,
|
|
3495
|
+
[owner],
|
|
3496
|
+
[{ ...owner, state: "R" }],
|
|
3497
|
+
clean,
|
|
3498
|
+
).passed,
|
|
3499
|
+
true,
|
|
3500
|
+
);
|
|
3501
|
+
const child = {
|
|
3502
|
+
pid: 701,
|
|
3503
|
+
ppid: 700,
|
|
3504
|
+
pgid: 701,
|
|
3505
|
+
state: "?Es",
|
|
3506
|
+
startToken: "child",
|
|
3507
|
+
command: "(Electron)",
|
|
3508
|
+
};
|
|
3509
|
+
assert.equal(
|
|
3510
|
+
assessLegacyProductRigOwnerRetryCompatibility(
|
|
3511
|
+
state,
|
|
3512
|
+
authorization,
|
|
3513
|
+
[owner, child],
|
|
3514
|
+
[owner, child],
|
|
3515
|
+
clean,
|
|
3516
|
+
).passed,
|
|
3517
|
+
false,
|
|
3518
|
+
);
|
|
3519
|
+
assert.equal(
|
|
3520
|
+
assessLegacyProductRigOwnerRetryCompatibility(
|
|
3521
|
+
{ ...state, cleanup: { ...state.cleanup, failures: [{ subsystem: "daemon" }] } },
|
|
3522
|
+
authorization,
|
|
3523
|
+
[owner],
|
|
3524
|
+
[owner],
|
|
3525
|
+
clean,
|
|
3526
|
+
).passed,
|
|
3527
|
+
false,
|
|
3528
|
+
);
|
|
3529
|
+
assert.equal(
|
|
3530
|
+
assessLegacyProductRigOwnerRetryCompatibility(
|
|
3531
|
+
state,
|
|
3532
|
+
authorization,
|
|
3533
|
+
[owner],
|
|
3534
|
+
[{ ...owner, startToken: "reused" }],
|
|
3535
|
+
clean,
|
|
3536
|
+
).passed,
|
|
3537
|
+
false,
|
|
3538
|
+
);
|
|
3539
|
+
const passedCard5 = {
|
|
3540
|
+
...state.cleanup.card5,
|
|
3541
|
+
passed: true,
|
|
3542
|
+
owners: Object.fromEntries(
|
|
3543
|
+
["chromium", "electron", "opentui", "daemon", "namespace"].map((name) => [
|
|
3544
|
+
name,
|
|
3545
|
+
{ ...state.cleanup.card5.owners[name], retired: true },
|
|
3546
|
+
]),
|
|
3547
|
+
),
|
|
3548
|
+
electronProcessCount: 0,
|
|
3549
|
+
};
|
|
3550
|
+
const finalState = {
|
|
3551
|
+
...state,
|
|
3552
|
+
status: "failed",
|
|
3553
|
+
cleanup: {
|
|
3554
|
+
requestId: "exact-owner-response",
|
|
3555
|
+
cleanupToken: state.runtimeNamespace.cleanupToken,
|
|
3556
|
+
status: "passed",
|
|
3557
|
+
failures: [],
|
|
3558
|
+
card5: passedCard5,
|
|
3559
|
+
},
|
|
3560
|
+
};
|
|
3561
|
+
assert.equal(
|
|
3562
|
+
assessLegacyProductRigOwnerRetryCompletion(state, finalState, "exact-owner-response", {
|
|
3563
|
+
...clean,
|
|
3564
|
+
processRows: [],
|
|
3565
|
+
}).passed,
|
|
3566
|
+
true,
|
|
3567
|
+
);
|
|
3568
|
+
for (const changed of [
|
|
3569
|
+
{ cleanup: { ...finalState.cleanup, requestId: "foreign-response" } },
|
|
3570
|
+
{
|
|
3571
|
+
cleanup: {
|
|
3572
|
+
...finalState.cleanup,
|
|
3573
|
+
card5: { ...passedCard5, electronProcessCount: 1 },
|
|
3574
|
+
},
|
|
3575
|
+
},
|
|
3576
|
+
])
|
|
3577
|
+
assert.equal(
|
|
3578
|
+
assessLegacyProductRigOwnerRetryCompletion(
|
|
3579
|
+
state,
|
|
3580
|
+
{ ...finalState, ...changed },
|
|
3581
|
+
"exact-owner-response",
|
|
3582
|
+
{ ...clean, processRows: [] },
|
|
3583
|
+
).passed,
|
|
3584
|
+
false,
|
|
3585
|
+
);
|
|
3586
|
+
assert.equal(
|
|
3587
|
+
assessLegacyProductRigOwnerRetryCompletion(state, finalState, "exact-owner-response", {
|
|
3588
|
+
processAlive: (pid) => pid === state.ownerPid,
|
|
3589
|
+
pathExists: () => false,
|
|
3590
|
+
processRows: [],
|
|
3591
|
+
}).passed,
|
|
3592
|
+
false,
|
|
3593
|
+
);
|
|
3594
|
+
assert.equal(
|
|
3595
|
+
assessLegacyProductRigOwnerRetryCompletion(state, finalState, "exact-owner-response", {
|
|
3596
|
+
...clean,
|
|
3597
|
+
processRows: [
|
|
3598
|
+
{
|
|
3599
|
+
pid: 701,
|
|
3600
|
+
ppid: 1,
|
|
3601
|
+
pgid: 701,
|
|
3602
|
+
state: "?Es",
|
|
3603
|
+
startToken: "child",
|
|
3604
|
+
command: "(Electron)",
|
|
3605
|
+
},
|
|
3606
|
+
],
|
|
3607
|
+
}).passed,
|
|
3608
|
+
false,
|
|
3609
|
+
);
|
|
3610
|
+
|
|
3611
|
+
const intent = createLegacyProductRigOwnerRetryIntent(state, authorization, owner);
|
|
3612
|
+
assert.ok(intent);
|
|
3613
|
+
assert.deepEqual(acquireLegacyProductRigOwnerRetryIntent(authorization, intent), intent);
|
|
3614
|
+
assert.equal(legacyProductRigOwnerRetryIntentMatchesState(state, authorization, intent), true);
|
|
3615
|
+
assert.equal(
|
|
3616
|
+
legacyProductRigOwnerRetryIntentMatchesOwnerRows(intent, [{ ...owner, state: "R" }]),
|
|
3617
|
+
true,
|
|
3618
|
+
);
|
|
3619
|
+
assert.equal(
|
|
3620
|
+
legacyProductRigOwnerRetryIntentMatchesOwnerRows(intent, [{ ...owner, startToken: "reused" }]),
|
|
3621
|
+
false,
|
|
3622
|
+
);
|
|
3623
|
+
assert.equal(
|
|
3624
|
+
legacyProductRigOwnerRetryIntentMatchesState(
|
|
3625
|
+
{ ...state, cleanup: { ...state.cleanup, attempt: 2 } },
|
|
3626
|
+
authorization,
|
|
3627
|
+
intent,
|
|
3628
|
+
),
|
|
3629
|
+
false,
|
|
3630
|
+
);
|
|
3631
|
+
assert.equal(
|
|
3632
|
+
acquireLegacyProductRigOwnerRetryIntent({ ...authorization, tree: "f".repeat(40) }, intent),
|
|
3633
|
+
null,
|
|
3634
|
+
);
|
|
3635
|
+
const shutdownRequest = createLegacyProductRigOwnerRetryShutdownRequest(
|
|
3636
|
+
state,
|
|
3637
|
+
authorization,
|
|
3638
|
+
intent,
|
|
3639
|
+
);
|
|
3640
|
+
assert.deepEqual(shutdownRequest, {
|
|
3641
|
+
version: 1,
|
|
3642
|
+
requestId: authorization.requestId,
|
|
3643
|
+
attempt: 1,
|
|
3644
|
+
ownerPid: state.ownerPid,
|
|
3645
|
+
ownerToken: state.ownerToken,
|
|
3646
|
+
cleanupToken: state.runtimeNamespace.cleanupToken,
|
|
3647
|
+
});
|
|
3648
|
+
assert.deepEqual(
|
|
3649
|
+
createLegacyProductRigOwnerRetryShutdownRequest(state, authorization, intent),
|
|
3650
|
+
shutdownRequest,
|
|
3651
|
+
);
|
|
3652
|
+
const retryFinalState = {
|
|
3653
|
+
...finalState,
|
|
3654
|
+
cleanup: { ...finalState.cleanup, requestId: authorization.requestId },
|
|
3655
|
+
};
|
|
3656
|
+
const receipt = createLegacyProductRigOwnerRetryReceipt(intent, authorization);
|
|
3657
|
+
assert.ok(receipt);
|
|
3658
|
+
assert.deepEqual(
|
|
3659
|
+
acquireLegacyProductRigOwnerRetryReceipt(authorization, receipt, intent),
|
|
3660
|
+
receipt,
|
|
3661
|
+
);
|
|
3662
|
+
assert.equal(
|
|
3663
|
+
acquireLegacyProductRigOwnerRetryReceipt(
|
|
3664
|
+
authorization,
|
|
3665
|
+
{ ...receipt, ownerPid: receipt.ownerPid + 1 },
|
|
3666
|
+
intent,
|
|
3667
|
+
),
|
|
3668
|
+
null,
|
|
3669
|
+
);
|
|
3670
|
+
|
|
3671
|
+
const exactCompletionDependencies = (events, overrides = {}) => ({
|
|
3672
|
+
...clean,
|
|
3673
|
+
processRows: [],
|
|
3674
|
+
writeReceipt: () => events.push("receipt"),
|
|
3675
|
+
writeState: () => events.push("state"),
|
|
3676
|
+
removeAck: () => events.push("ack"),
|
|
3677
|
+
removeIntent: () => events.push("intent"),
|
|
3678
|
+
...overrides,
|
|
3679
|
+
});
|
|
3680
|
+
const events = [];
|
|
3681
|
+
const finalized = finalizeLegacyProductRigOwnerRetry(
|
|
3682
|
+
retryFinalState,
|
|
3683
|
+
authorization,
|
|
3684
|
+
intent,
|
|
3685
|
+
null,
|
|
3686
|
+
exactCompletionDependencies(events),
|
|
3687
|
+
);
|
|
3688
|
+
assert.equal(finalized.passed, true);
|
|
3689
|
+
assert.deepEqual(events, ["receipt", "state", "ack", "intent"]);
|
|
3690
|
+
assert.equal(finalized.state.cleanup.legacyOwnerRetry.receiptHmac, receipt.receiptHmac);
|
|
3691
|
+
|
|
3692
|
+
let durableReceipt = null;
|
|
3693
|
+
assert.throws(
|
|
3694
|
+
() =>
|
|
3695
|
+
finalizeLegacyProductRigOwnerRetry(
|
|
3696
|
+
retryFinalState,
|
|
3697
|
+
authorization,
|
|
3698
|
+
intent,
|
|
3699
|
+
null,
|
|
3700
|
+
exactCompletionDependencies([], {
|
|
3701
|
+
writeReceipt: (value) => {
|
|
3702
|
+
durableReceipt = value;
|
|
3703
|
+
},
|
|
3704
|
+
writeState: () => {
|
|
3705
|
+
throw new Error("controller-crash-after-receipt");
|
|
3706
|
+
},
|
|
3707
|
+
}),
|
|
3708
|
+
),
|
|
3709
|
+
/controller-crash-after-receipt/u,
|
|
3710
|
+
);
|
|
3711
|
+
const recoveredEvents = [];
|
|
3712
|
+
assert.equal(
|
|
3713
|
+
finalizeLegacyProductRigOwnerRetry(
|
|
3714
|
+
retryFinalState,
|
|
3715
|
+
authorization,
|
|
3716
|
+
intent,
|
|
3717
|
+
durableReceipt,
|
|
3718
|
+
exactCompletionDependencies(recoveredEvents),
|
|
3719
|
+
).passed,
|
|
3720
|
+
true,
|
|
3721
|
+
);
|
|
3722
|
+
assert.deepEqual(recoveredEvents, ["state", "ack", "intent"]);
|
|
3723
|
+
|
|
3724
|
+
const interruptedDeletes = [];
|
|
3725
|
+
assert.throws(
|
|
3726
|
+
() =>
|
|
3727
|
+
finalizeLegacyProductRigOwnerRetry(
|
|
3728
|
+
retryFinalState,
|
|
3729
|
+
authorization,
|
|
3730
|
+
intent,
|
|
3731
|
+
receipt,
|
|
3732
|
+
exactCompletionDependencies(interruptedDeletes, {
|
|
3733
|
+
removeIntent: () => {
|
|
3734
|
+
interruptedDeletes.push("intent");
|
|
3735
|
+
throw new Error("controller-crash-before-intent-commit");
|
|
3736
|
+
},
|
|
3737
|
+
}),
|
|
3738
|
+
),
|
|
3739
|
+
/controller-crash-before-intent-commit/u,
|
|
3740
|
+
);
|
|
3741
|
+
assert.deepEqual(interruptedDeletes, ["state", "ack", "intent"]);
|
|
3742
|
+
const noIntentEvents = [];
|
|
3743
|
+
assert.equal(
|
|
3744
|
+
finalizeLegacyProductRigOwnerRetry(
|
|
3745
|
+
retryFinalState,
|
|
3746
|
+
authorization,
|
|
3747
|
+
null,
|
|
3748
|
+
receipt,
|
|
3749
|
+
exactCompletionDependencies(noIntentEvents),
|
|
3750
|
+
).passed,
|
|
3751
|
+
true,
|
|
3752
|
+
);
|
|
3753
|
+
assert.deepEqual(noIntentEvents, ["state", "ack", "intent"]);
|
|
3754
|
+
});
|
|
3755
|
+
|
|
3756
|
+
test("legacy stopped preclean admits only the exact dead and residue-free v1 shape", () => {
|
|
3757
|
+
const root = join(tmpdir(), "tmi-e2e-legacy-clean-shape");
|
|
3758
|
+
const state = {
|
|
3759
|
+
version: 1,
|
|
3760
|
+
status: "stopped",
|
|
3761
|
+
ownerPid: 98_875,
|
|
3762
|
+
daemon: { pid: 1_387, instanceId: "legacy-generation" },
|
|
3763
|
+
runtimeNamespace: {
|
|
3764
|
+
root,
|
|
3765
|
+
tmuxSocketPath: join(root, "t.sock"),
|
|
3766
|
+
hostTmuxSocketPath: join(root, "product-rig-host-tmux.sock"),
|
|
3767
|
+
daemonInfoDir: join(root, "daemon"),
|
|
3768
|
+
cleanupToken: "product-test-rig:legacy",
|
|
3769
|
+
},
|
|
3770
|
+
};
|
|
3771
|
+
const deadAndAbsent = { processAlive: () => false, pathExists: () => false };
|
|
3772
|
+
assert.equal(isCleanLegacyStoppedProductRigState(state, deadAndAbsent), true);
|
|
3773
|
+
|
|
3774
|
+
for (const contaminated of [
|
|
3775
|
+
(({ version: _version, ...withoutVersion }) => withoutVersion)(state),
|
|
3776
|
+
{ ...state, version: 2 },
|
|
3777
|
+
{ ...state, cleanup: null },
|
|
3778
|
+
{ ...state, cleanup: undefined },
|
|
3779
|
+
{ ...state, cleanup: { status: "passed" } },
|
|
3780
|
+
{ ...state, status: "failed" },
|
|
3781
|
+
{ ...state, status: "cleanup-failed" },
|
|
3782
|
+
{ ...state, ownerToken: null },
|
|
3783
|
+
{ ...state, ownerToken: undefined },
|
|
3784
|
+
{ ...state, ownerToken: "current-owner-token" },
|
|
3785
|
+
{ ...state, ownerPid: 0 },
|
|
3786
|
+
{ ...state, daemon: { ...state.daemon, pid: null } },
|
|
3787
|
+
{ ...state, daemon: { ...state.daemon, instanceId: "" } },
|
|
3788
|
+
{
|
|
3789
|
+
...state,
|
|
3790
|
+
runtimeNamespace: { ...state.runtimeNamespace, tmuxSocketPath: "/tmp/outside.sock" },
|
|
3791
|
+
},
|
|
3792
|
+
{
|
|
3793
|
+
...state,
|
|
3794
|
+
runtimeNamespace: { ...state.runtimeNamespace, tmuxSocketPath: root },
|
|
3795
|
+
},
|
|
3796
|
+
{
|
|
3797
|
+
...state,
|
|
3798
|
+
runtimeNamespace: { ...state.runtimeNamespace, hostTmuxSocketPath: root },
|
|
3799
|
+
},
|
|
3800
|
+
{
|
|
3801
|
+
...state,
|
|
3802
|
+
runtimeNamespace: { ...state.runtimeNamespace, daemonInfoDir: root },
|
|
3803
|
+
},
|
|
3804
|
+
{
|
|
3805
|
+
...state,
|
|
3806
|
+
runtimeNamespace: { ...state.runtimeNamespace, cleanupToken: null },
|
|
3807
|
+
},
|
|
3808
|
+
])
|
|
3809
|
+
assert.equal(isCleanLegacyStoppedProductRigState(contaminated, deadAndAbsent), false);
|
|
3810
|
+
|
|
3811
|
+
assert.equal(
|
|
3812
|
+
isCleanLegacyStoppedProductRigState(state, {
|
|
3813
|
+
processAlive: (pid) => pid === state.ownerPid,
|
|
3814
|
+
pathExists: () => false,
|
|
3815
|
+
}),
|
|
3816
|
+
false,
|
|
3817
|
+
);
|
|
3818
|
+
assert.equal(
|
|
3819
|
+
isCleanLegacyStoppedProductRigState(state, {
|
|
3820
|
+
processAlive: (pid) => pid === state.daemon.pid,
|
|
3821
|
+
pathExists: () => false,
|
|
3822
|
+
}),
|
|
3823
|
+
false,
|
|
3824
|
+
);
|
|
3825
|
+
for (const ownedPath of [
|
|
3826
|
+
state.runtimeNamespace.root,
|
|
3827
|
+
state.runtimeNamespace.tmuxSocketPath,
|
|
3828
|
+
state.runtimeNamespace.hostTmuxSocketPath,
|
|
3829
|
+
state.runtimeNamespace.daemonInfoDir,
|
|
3830
|
+
])
|
|
3831
|
+
assert.equal(
|
|
3832
|
+
isCleanLegacyStoppedProductRigState(state, {
|
|
3833
|
+
processAlive: () => false,
|
|
3834
|
+
pathExists: (candidate) => candidate === ownedPath,
|
|
3835
|
+
}),
|
|
3836
|
+
false,
|
|
3837
|
+
);
|
|
3838
|
+
});
|
|
3839
|
+
|
|
3840
|
+
test("public-elected daemon cleanup is an exact barrier before the next repeat", () => {
|
|
3841
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-public-repeat-"));
|
|
3842
|
+
const daemonInfoDir = join(temporary, "daemon-info");
|
|
3843
|
+
mkdirSync(daemonInfoDir);
|
|
3844
|
+
const state = {
|
|
3845
|
+
status: "stopped",
|
|
3846
|
+
ownerPid: 111,
|
|
3847
|
+
daemon: { pid: 222, instanceId: "public-generation-1" },
|
|
3848
|
+
runtimeNamespace: {
|
|
3849
|
+
root: temporary,
|
|
3850
|
+
tmuxSocketPath: join(temporary, "tmux.sock"),
|
|
3851
|
+
hostTmuxSocketPath: join(temporary, "host.sock"),
|
|
3852
|
+
daemonInfoDir,
|
|
3853
|
+
cleanupToken: "public-repeat-token",
|
|
3854
|
+
},
|
|
3855
|
+
cleanup: {
|
|
3856
|
+
requestId: "public-repeat-cleanup",
|
|
3857
|
+
status: "passed",
|
|
3858
|
+
cleanupToken: "public-repeat-token",
|
|
3859
|
+
failures: [],
|
|
3860
|
+
},
|
|
3861
|
+
};
|
|
3862
|
+
try {
|
|
3863
|
+
const blocked = productRigCleanupBarrierFailures(state, "public-repeat-cleanup", {
|
|
3864
|
+
processAlive: (pid) => pid === 222,
|
|
3865
|
+
pathExists: existsSync,
|
|
3866
|
+
});
|
|
3867
|
+
assert.ok(blocked.includes("daemon-process-live"));
|
|
3868
|
+
assert.ok(blocked.includes("runtime-root-present"));
|
|
3869
|
+
removeTestTree(temporary);
|
|
3870
|
+
assert.deepEqual(
|
|
3871
|
+
productRigCleanupBarrierFailures(state, "public-repeat-cleanup", {
|
|
3872
|
+
processAlive: () => false,
|
|
3873
|
+
pathExists: existsSync,
|
|
3874
|
+
}),
|
|
3875
|
+
[],
|
|
3876
|
+
);
|
|
3877
|
+
} finally {
|
|
3878
|
+
removeTestTree(temporary);
|
|
3879
|
+
}
|
|
3880
|
+
});
|
|
3881
|
+
|
|
3882
|
+
test("controller adopts an overlapping internal cleanup only after its exact terminal pass", () => {
|
|
3883
|
+
const internal = {
|
|
3884
|
+
status: "failed",
|
|
3885
|
+
cleanup: { requestId: "internal-owner-failure", status: "passed" },
|
|
3886
|
+
};
|
|
3887
|
+
assert.equal(productRigCleanupAcknowledgesRequest(internal, "controller-request"), true);
|
|
3888
|
+
assert.equal(
|
|
3889
|
+
productRigCleanupAcknowledgesRequest(
|
|
3890
|
+
{ ...internal, status: "cleanup-failed", cleanup: { ...internal.cleanup, status: "failed" } },
|
|
3891
|
+
"controller-request",
|
|
3892
|
+
),
|
|
3893
|
+
false,
|
|
3894
|
+
);
|
|
3895
|
+
assert.equal(
|
|
3896
|
+
productRigCleanupAcknowledgesRequest(
|
|
3897
|
+
{ status: "cleanup-failed", cleanup: { requestId: "controller-request", status: "failed" } },
|
|
3898
|
+
"controller-request",
|
|
3899
|
+
),
|
|
3900
|
+
true,
|
|
3901
|
+
);
|
|
3902
|
+
});
|
|
3903
|
+
|
|
3904
|
+
test("two successful attempts use distinct clean owners and immutable namespaces", async () => {
|
|
3905
|
+
const temporary = mkdtempSync(join(tmpdir(), "product-rig-attempt-repeat-"));
|
|
3906
|
+
const published = [];
|
|
3907
|
+
try {
|
|
3908
|
+
for (const repetition of [1, 2]) {
|
|
3909
|
+
const entry = attemptEntry(
|
|
3910
|
+
`20260817143012345-runtime-qualification-r${repetition}-success`,
|
|
3911
|
+
repetition,
|
|
3912
|
+
);
|
|
3913
|
+
const ownerPath = join(temporary, `owner-${repetition}.json`);
|
|
3914
|
+
const namespacePath = join(temporary, `namespace-${repetition}`);
|
|
3915
|
+
const result = await runIsolatedProductJourneyAttempt(entry, {
|
|
3916
|
+
preCleanup: async () => {
|
|
3917
|
+
assert.equal(existsSync(ownerPath), false);
|
|
3918
|
+
assert.equal(existsSync(namespacePath), false);
|
|
3919
|
+
},
|
|
3920
|
+
drive: async () => {
|
|
3921
|
+
writeFileSync(ownerPath, JSON.stringify({ owner: `owner-${repetition}` }));
|
|
3922
|
+
mkdirSync(namespacePath, { mode: 0o700 });
|
|
3923
|
+
writeFileSync(join(namespacePath, "tmux.sock"), "owned socket");
|
|
3924
|
+
return { owner: `owner-${repetition}`, namespace: `namespace-${repetition}` };
|
|
3925
|
+
},
|
|
3926
|
+
currentBoundary: () => "journey-drive",
|
|
3927
|
+
postCleanup: async () => {
|
|
3928
|
+
unlinkSync(ownerPath);
|
|
3929
|
+
removeTestTree(namespacePath);
|
|
3930
|
+
},
|
|
3931
|
+
retryCleanup: () => assert.fail("successful cleanup cannot retry"),
|
|
3932
|
+
prepareFailure: () => assert.fail("successful attempt cannot prepare failure"),
|
|
3933
|
+
appendCleanupFailure: () => assert.fail("successful attempt cannot append cleanup"),
|
|
3934
|
+
publishFailure: () => assert.fail("successful attempt cannot publish failure"),
|
|
3935
|
+
publishSuccess: async (completed) => {
|
|
3936
|
+
assert.equal(existsSync(ownerPath), false);
|
|
3937
|
+
assert.equal(existsSync(namespacePath), false);
|
|
3938
|
+
const bundle = createProductDiagnosticBundle({
|
|
3939
|
+
root: temporary,
|
|
3940
|
+
runId: entry.runId,
|
|
3941
|
+
evidence: {
|
|
3942
|
+
...failureEvidence("none", ""),
|
|
3943
|
+
report: { status: "passed", ...completed },
|
|
3944
|
+
},
|
|
3945
|
+
});
|
|
3946
|
+
published.push(bundle.runDir);
|
|
3947
|
+
return { completed, bundle, reportPath: join(bundle.runDir, "report.json") };
|
|
3948
|
+
},
|
|
3949
|
+
});
|
|
3950
|
+
assert.equal(result.completed.owner, `owner-${repetition}`);
|
|
3951
|
+
assert.equal(result.completed.namespace, `namespace-${repetition}`);
|
|
3952
|
+
assert.equal(result.reportPath, join(result.bundle.runDir, "report.json"));
|
|
3953
|
+
}
|
|
3954
|
+
assert.equal(new Set(published).size, 2);
|
|
3955
|
+
assert.ok(published.every((runDir) => existsSync(join(runDir, "report.json"))));
|
|
3956
|
+
} finally {
|
|
3957
|
+
removeTestTree(temporary);
|
|
3958
|
+
}
|
|
3959
|
+
});
|