tmux-ide 2.8.0 → 2.9.0-beta.6
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 +88 -125
- package/bin/cli.js +68983 -13250
- package/bin/cli.ts +412 -51
- package/package.json +63 -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__/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/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 +59 -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/lifecycle.js +12 -2
- package/packages/daemon/dist/control/server.js +3 -3
- package/packages/daemon/dist/detect.js +23 -20
- package/packages/daemon/dist/doctor.js +22 -6
- 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-kind.d.ts +7 -0
- package/packages/daemon/dist/lib/agent-kind.js +24 -0
- package/packages/daemon/dist/lib/app-config.d.ts +9 -4
- package/packages/daemon/dist/lib/app-config.js +27 -1
- 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/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.js +2 -3
- 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/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 +5 -5
- package/packages/daemon/dist/restore.js +10 -6
- 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 +8 -0
- package/packages/daemon/dist/send.js +106 -3
- 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 +402 -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 +1084 -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/lifecycle.ts +14 -2
- package/packages/daemon/src/control/server.ts +3 -3
- package/packages/daemon/src/detect.ts +25 -20
- package/packages/daemon/src/doctor.ts +20 -5
- 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-kind.ts +23 -0
- package/packages/daemon/src/lib/app-config.ts +41 -5
- 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/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 +2 -3
- 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/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 +14 -9
- 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 +138 -3
- 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/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 +514 -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/front-door.ts +11 -23
- 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 +100 -3
- 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/process-tree.ts +17 -1
- 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/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-lifecycle.ts +36 -5
- package/packages/daemon/src/tui/mirror/agent-provisioning-executor.ts +151 -0
- package/packages/daemon/src/tui/mirror/agent-rows.ts +34 -0
- package/packages/daemon/src/tui/mirror/ansi-palette.ts +3 -0
- package/packages/daemon/src/tui/mirror/app-state.ts +14 -1
- package/packages/daemon/src/tui/mirror/app.tsx +2 -7047
- 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/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 -367
- 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/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/hosted.ts +87 -6
- 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 +1 -14
- 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 +1335 -0
- package/packages/daemon/src/tui/mirror/palette-surface-adapter.ts +465 -0
- package/packages/daemon/src/tui/mirror/palette.ts +189 -28
- package/packages/daemon/src/tui/mirror/pane-frame-state.ts +209 -0
- package/packages/daemon/src/tui/mirror/pane-mirror.ts +133 -46
- package/packages/daemon/src/tui/mirror/pane-surface.tsx +702 -40
- 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 -148
- 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 +0 -21
- 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 +24 -66
- 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 +138 -35
- package/packages/daemon/src/tui/mirror/size-truth.ts +1 -1
- 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 +1047 -33
- 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/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 +43 -48
- package/packages/daemon/src/tui/team/wait-receipts.ts +192 -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 +2682 -0
- package/packages/daemon-client/src/workspace-client.ts +1432 -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-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 +6 -5
- 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/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 +27 -28
- 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/native/TmuxIdeNotifier.app/Contents/Info.plist +0 -34
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/PkgInfo +0 -1
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/AppIcon.icns +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +0 -139
- 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 -724
- 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
- /package/packages/daemon/src/{tui/mirror → terminal/protocol}/layout-parse.ts +0 -0
|
@@ -0,0 +1,2700 @@
|
|
|
1
|
+
import {
|
|
2
|
+
constants as fsConstants,
|
|
3
|
+
closeSync,
|
|
4
|
+
chmodSync,
|
|
5
|
+
existsSync,
|
|
6
|
+
fchmodSync,
|
|
7
|
+
fstatSync,
|
|
8
|
+
fsyncSync,
|
|
9
|
+
lstatSync,
|
|
10
|
+
mkdirSync,
|
|
11
|
+
openSync,
|
|
12
|
+
readFileSync,
|
|
13
|
+
realpathSync,
|
|
14
|
+
renameSync,
|
|
15
|
+
rmSync,
|
|
16
|
+
writeSync,
|
|
17
|
+
} from "node:fs";
|
|
18
|
+
import { createHash, createHmac, randomBytes } from "node:crypto";
|
|
19
|
+
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
20
|
+
|
|
21
|
+
export const PRODUCT_DIAGNOSTIC_BUNDLE_VERSION = 1;
|
|
22
|
+
export const PRODUCT_DIAGNOSTIC_BUNDLE_FILES = Object.freeze([
|
|
23
|
+
"report.json",
|
|
24
|
+
"alignment.json",
|
|
25
|
+
"timeline.jsonl",
|
|
26
|
+
"tmux-truth.json",
|
|
27
|
+
"daemon-state.json",
|
|
28
|
+
"client-state.json",
|
|
29
|
+
"tui.ansi",
|
|
30
|
+
"web.png",
|
|
31
|
+
"stderr.log",
|
|
32
|
+
"reproduction.sh",
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const GOLDEN_JOURNEYS = Object.freeze(
|
|
36
|
+
[
|
|
37
|
+
["configless-cold-start", ["configless", "cold-start"]],
|
|
38
|
+
["coherent-first-pane", ["connect-coherent-frame", "coherent-frame", "terminal-pane"]],
|
|
39
|
+
[
|
|
40
|
+
"first-key-paste",
|
|
41
|
+
[
|
|
42
|
+
"key-input",
|
|
43
|
+
"paste-input",
|
|
44
|
+
"input-consumed-changed-cell",
|
|
45
|
+
"queue-depth",
|
|
46
|
+
"event-loop-delay",
|
|
47
|
+
"dirty-rows",
|
|
48
|
+
],
|
|
49
|
+
],
|
|
50
|
+
["focus", ["focus", "blur"]],
|
|
51
|
+
[
|
|
52
|
+
"window-lifecycle",
|
|
53
|
+
["window-create", "window-switch", "window-rename", "switch-visible-frame"],
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
"keyboard-pointer-resize",
|
|
57
|
+
["keyboard-resize", "pointer-resize", "pointer-guide", "release-receipt"],
|
|
58
|
+
],
|
|
59
|
+
["selection-copy-app-mouse", ["selection", "copy", "application-mouse"]],
|
|
60
|
+
[
|
|
61
|
+
"ansi-cursor-alt-screen",
|
|
62
|
+
["ansi", "cursor", "alternate-screen", "unchanged-grid-walk", "memory-slope"],
|
|
63
|
+
],
|
|
64
|
+
["cross-client-handoff", ["opentui", "web", "native", "authority-handoff"]],
|
|
65
|
+
["daemon-restart", ["daemon-restart", "generation-recovery"]],
|
|
66
|
+
["session-recreate", ["session-kill", "session-recreate"]],
|
|
67
|
+
].map(([id, coverage]) =>
|
|
68
|
+
Object.freeze({
|
|
69
|
+
id,
|
|
70
|
+
coverage: Object.freeze(coverage),
|
|
71
|
+
executor: id,
|
|
72
|
+
variants: Object.freeze(id === "first-key-paste" ? ["key", "paste"] : [null]),
|
|
73
|
+
implementation: [
|
|
74
|
+
"configless-cold-start",
|
|
75
|
+
"coherent-first-pane",
|
|
76
|
+
"first-key-paste",
|
|
77
|
+
"focus",
|
|
78
|
+
"window-lifecycle",
|
|
79
|
+
"keyboard-pointer-resize",
|
|
80
|
+
"selection-copy-app-mouse",
|
|
81
|
+
"ansi-cursor-alt-screen",
|
|
82
|
+
"cross-client-handoff",
|
|
83
|
+
"daemon-restart",
|
|
84
|
+
"session-recreate",
|
|
85
|
+
].includes(id)
|
|
86
|
+
? "implemented"
|
|
87
|
+
: "pending",
|
|
88
|
+
}),
|
|
89
|
+
),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The existing monolithic diagnosis remains selectable while it is split into
|
|
94
|
+
* the golden journeys above. It does not claim the missing journey coverage.
|
|
95
|
+
*/
|
|
96
|
+
export const PRODUCT_JOURNEY_REGISTRY = Object.freeze([
|
|
97
|
+
...GOLDEN_JOURNEYS,
|
|
98
|
+
Object.freeze({
|
|
99
|
+
id: "runtime-qualification",
|
|
100
|
+
executor: "runtime-qualification",
|
|
101
|
+
variants: Object.freeze([null]),
|
|
102
|
+
coverage: Object.freeze([
|
|
103
|
+
"coherent-frame",
|
|
104
|
+
"key-input",
|
|
105
|
+
"pointer-resize",
|
|
106
|
+
"window-switch",
|
|
107
|
+
"opentui",
|
|
108
|
+
"web",
|
|
109
|
+
"daemon-restart",
|
|
110
|
+
"memory",
|
|
111
|
+
"idle-work",
|
|
112
|
+
]),
|
|
113
|
+
implementation: "implemented",
|
|
114
|
+
}),
|
|
115
|
+
]);
|
|
116
|
+
|
|
117
|
+
const JOURNEYS_BY_ID = new Map(PRODUCT_JOURNEY_REGISTRY.map((journey) => [journey.id, journey]));
|
|
118
|
+
|
|
119
|
+
export const PRODUCT_REQUIRED_JOURNEY_COVERAGE = Object.freeze([
|
|
120
|
+
"configless",
|
|
121
|
+
"cold-start",
|
|
122
|
+
"connect-coherent-frame",
|
|
123
|
+
"key-input",
|
|
124
|
+
"paste-input",
|
|
125
|
+
"input-consumed-changed-cell",
|
|
126
|
+
"focus",
|
|
127
|
+
"blur",
|
|
128
|
+
"window-create",
|
|
129
|
+
"window-switch",
|
|
130
|
+
"window-rename",
|
|
131
|
+
"switch-visible-frame",
|
|
132
|
+
"keyboard-resize",
|
|
133
|
+
"pointer-resize",
|
|
134
|
+
"pointer-guide",
|
|
135
|
+
"release-receipt",
|
|
136
|
+
"selection",
|
|
137
|
+
"copy",
|
|
138
|
+
"application-mouse",
|
|
139
|
+
"ansi",
|
|
140
|
+
"cursor",
|
|
141
|
+
"alternate-screen",
|
|
142
|
+
"opentui",
|
|
143
|
+
"web",
|
|
144
|
+
"native",
|
|
145
|
+
"authority-handoff",
|
|
146
|
+
"daemon-restart",
|
|
147
|
+
"generation-recovery",
|
|
148
|
+
"session-kill",
|
|
149
|
+
"session-recreate",
|
|
150
|
+
"queue-depth",
|
|
151
|
+
"dirty-rows",
|
|
152
|
+
"unchanged-grid-walk",
|
|
153
|
+
"event-loop-delay",
|
|
154
|
+
"memory-slope",
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
export function auditProductJourneyScope(registry = PRODUCT_JOURNEY_REGISTRY) {
|
|
158
|
+
const covered = new Set(registry.flatMap(({ coverage }) => coverage));
|
|
159
|
+
const missing = PRODUCT_REQUIRED_JOURNEY_COVERAGE.filter(
|
|
160
|
+
(requirement) => !covered.has(requirement),
|
|
161
|
+
);
|
|
162
|
+
const pendingJourneyIds = registry
|
|
163
|
+
.filter(({ implementation }) => implementation !== "implemented")
|
|
164
|
+
.map(({ id }) => id);
|
|
165
|
+
return Object.freeze({
|
|
166
|
+
complete: missing.length === 0 && pendingJourneyIds.length === 0,
|
|
167
|
+
declarationComplete: missing.length === 0,
|
|
168
|
+
executableComplete: pendingJourneyIds.length === 0,
|
|
169
|
+
missing: Object.freeze(missing),
|
|
170
|
+
pendingJourneyIds: Object.freeze(pendingJourneyIds),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function parseProductDiagnoseOptions(args) {
|
|
175
|
+
const journeyIds = [];
|
|
176
|
+
let sawJourney = false;
|
|
177
|
+
let repeat = 1;
|
|
178
|
+
let variant = null;
|
|
179
|
+
let json = false;
|
|
180
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
181
|
+
const argument = args[index];
|
|
182
|
+
if (argument === "--json") {
|
|
183
|
+
json = true;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (argument === "--journey") {
|
|
187
|
+
sawJourney = true;
|
|
188
|
+
const value = args[index + 1];
|
|
189
|
+
if (!value || value.startsWith("--")) throw new Error("--journey requires a journey id");
|
|
190
|
+
const tokens = value.split(",");
|
|
191
|
+
if (tokens.some((token) => !/^[a-z0-9][a-z0-9-]*$/u.test(token)))
|
|
192
|
+
throw new Error("--journey requires non-empty lowercase journey ids");
|
|
193
|
+
journeyIds.push(...tokens);
|
|
194
|
+
index += 1;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (argument === "--repeat") {
|
|
198
|
+
const value = args[index + 1];
|
|
199
|
+
if (!/^\d+$/u.test(value ?? "")) throw new Error("--repeat requires an integer from 1 to 10");
|
|
200
|
+
repeat = Number(value);
|
|
201
|
+
if (repeat < 1 || repeat > 10) throw new Error("--repeat requires an integer from 1 to 10");
|
|
202
|
+
index += 1;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (argument === "--variant") {
|
|
206
|
+
const value = args[index + 1];
|
|
207
|
+
if (!/^(?:key|paste)$/u.test(value ?? "")) throw new Error("--variant requires key or paste");
|
|
208
|
+
variant = value;
|
|
209
|
+
index += 1;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
throw new Error(`unknown diagnose option ${argument}`);
|
|
213
|
+
}
|
|
214
|
+
return Object.freeze({
|
|
215
|
+
json,
|
|
216
|
+
repeat,
|
|
217
|
+
variant,
|
|
218
|
+
journeyIds: Object.freeze(
|
|
219
|
+
sawJourney ? journeyIds : journeyIds.length > 0 ? journeyIds : ["runtime-qualification"],
|
|
220
|
+
),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function resolveProductJourneyPlan({ journeyIds, repeat, variant = null }) {
|
|
225
|
+
if (journeyIds.includes("all") && journeyIds.length !== 1)
|
|
226
|
+
throw new Error("ProductRig journey all cannot be combined with another journey id");
|
|
227
|
+
const selected = journeyIds.includes("all")
|
|
228
|
+
? GOLDEN_JOURNEYS
|
|
229
|
+
: journeyIds.map((id) => JOURNEYS_BY_ID.get(id));
|
|
230
|
+
const unknown = journeyIds.filter((id) => id !== "all" && !JOURNEYS_BY_ID.has(id));
|
|
231
|
+
if (unknown.length > 0)
|
|
232
|
+
throw new Error(
|
|
233
|
+
`unknown ProductRig journey ${unknown.join(", ")}; available: ${PRODUCT_JOURNEY_REGISTRY.map(({ id }) => id).join(", ")}`,
|
|
234
|
+
);
|
|
235
|
+
if (variant && (selected.length !== 1 || selected[0]?.id !== "first-key-paste"))
|
|
236
|
+
throw new Error("--variant is only valid with --journey first-key-paste");
|
|
237
|
+
const pending = selected.filter((journey) => journey.implementation !== "implemented");
|
|
238
|
+
if (pending.length > 0)
|
|
239
|
+
throw new Error(
|
|
240
|
+
`ProductRig journey not implemented: ${pending.map(({ id }) => id).join(", ")}; missing evidence is a failure`,
|
|
241
|
+
);
|
|
242
|
+
const expanded = expandProductJourneyEntries(selected, repeat);
|
|
243
|
+
return variant ? Object.freeze(expanded.filter((entry) => entry.variant === variant)) : expanded;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function expandProductJourneyEntries(journeys, repeat) {
|
|
247
|
+
return Object.freeze(
|
|
248
|
+
journeys.flatMap((journey) =>
|
|
249
|
+
Array.from({ length: repeat }, (_, repetition) =>
|
|
250
|
+
journey.variants.map((variant) =>
|
|
251
|
+
Object.freeze({ journey, variant, repetition: repetition + 1, repeat }),
|
|
252
|
+
),
|
|
253
|
+
).flat(),
|
|
254
|
+
),
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export async function runProductJourneyPlan(plan, run) {
|
|
259
|
+
if (!Array.isArray(plan) || plan.length === 0)
|
|
260
|
+
throw new Error("ProductRig journey plan must contain at least one run");
|
|
261
|
+
if (typeof run !== "function")
|
|
262
|
+
throw new TypeError("ProductRig journey runner must be a function");
|
|
263
|
+
const results = [];
|
|
264
|
+
for (const entry of plan) results.push(await run(entry));
|
|
265
|
+
return Object.freeze(results);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export async function dispatchProductJourneyExecutor(entry, executors) {
|
|
269
|
+
const executor = executors[entry.journey.executor];
|
|
270
|
+
if (typeof executor !== "function")
|
|
271
|
+
throw new Error(`ProductRig journey executor is unavailable: ${entry.journey.executor}`);
|
|
272
|
+
return executor(entry);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** Exact cold-owner ordering seam used by the production ProductRig owner. */
|
|
276
|
+
export async function runConfiglessProductJourneyOwnerBoot(operations) {
|
|
277
|
+
const namespace = await operations.createOrdinaryNamespace();
|
|
278
|
+
await operations.assertNamespaceClean(namespace);
|
|
279
|
+
await operations.buildBeforeMeasurement(namespace);
|
|
280
|
+
const publicProcess = await operations.launchPublicNoArgumentEntry(namespace);
|
|
281
|
+
const daemon = await operations.observeElectedDaemon(namespace, publicProcess);
|
|
282
|
+
const discovered = await operations.observeOrdinarySessionDiscovery(namespace, daemon);
|
|
283
|
+
const adopted = await operations.adoptThroughPublicApp(namespace, daemon, discovered);
|
|
284
|
+
const coherent = await operations.proveCoherentPublication(namespace, daemon, adopted);
|
|
285
|
+
const web = await operations.startWebAfterColdBoundary(namespace, daemon, coherent);
|
|
286
|
+
return Object.freeze({ namespace, publicProcess, daemon, discovered, adopted, coherent, web });
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Targeted coherent boot: preseed namespace → daemon/workspace → TUI → proof → Web. */
|
|
290
|
+
export async function runCoherentFirstPaneOwnerBoot(operations) {
|
|
291
|
+
const atBoundary = async (boundary, operation) => {
|
|
292
|
+
try {
|
|
293
|
+
return await operation();
|
|
294
|
+
} catch (error) {
|
|
295
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
296
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
297
|
+
cause: error,
|
|
298
|
+
});
|
|
299
|
+
bounded.boundary = boundary;
|
|
300
|
+
if (error?.observation) bounded.observation = error.observation;
|
|
301
|
+
throw bounded;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const namespace = await atBoundary("targeted-namespace-preseeded", () =>
|
|
305
|
+
operations.createTargetedNamespace(),
|
|
306
|
+
);
|
|
307
|
+
const daemon = await atBoundary("targeted-daemon-ready", () =>
|
|
308
|
+
operations.startCanonicalDaemon(namespace),
|
|
309
|
+
);
|
|
310
|
+
const identity = await atBoundary("targeted-daemon-ready", () =>
|
|
311
|
+
operations.openCanonicalWorkspace(namespace, daemon),
|
|
312
|
+
);
|
|
313
|
+
await atBoundary("targeted-tui-connect", () => operations.buildBeforeMeasurement(namespace));
|
|
314
|
+
await atBoundary("targeted-tui-connect", () => operations.prepareTargetedTuiCwd(namespace));
|
|
315
|
+
const targetedProcess = await atBoundary("targeted-tui-connect", () =>
|
|
316
|
+
operations.launchTargetedTui(namespace, daemon, identity),
|
|
317
|
+
);
|
|
318
|
+
const coherent = await atBoundary("coherent-terminal-publication", () =>
|
|
319
|
+
operations.proveCoherentPublication(namespace, daemon, identity, targetedProcess),
|
|
320
|
+
);
|
|
321
|
+
const web = await atBoundary("web-started-after-coherent-boundary", () =>
|
|
322
|
+
operations.startWebAfterCoherentBoundary(namespace, daemon, identity, coherent),
|
|
323
|
+
);
|
|
324
|
+
return Object.freeze({ namespace, identity, targetedProcess, coherent, web });
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** Dedicated first-input journey: one detailed first input, then a fresh timing host. */
|
|
328
|
+
export async function runFirstKeyPasteOwnerBoot(operations) {
|
|
329
|
+
const atBoundary = async (boundary, operation) => {
|
|
330
|
+
try {
|
|
331
|
+
return await operation();
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
334
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
335
|
+
cause: error,
|
|
336
|
+
});
|
|
337
|
+
bounded.boundary = boundary;
|
|
338
|
+
if (error?.observation) bounded.observation = error.observation;
|
|
339
|
+
throw bounded;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
const namespace = await atBoundary("first-input-namespace-ready", () =>
|
|
343
|
+
operations.createInputNamespace(),
|
|
344
|
+
);
|
|
345
|
+
const daemon = await atBoundary("first-input-daemon-ready", () =>
|
|
346
|
+
operations.startCanonicalDaemon(namespace),
|
|
347
|
+
);
|
|
348
|
+
const identity = await atBoundary("first-input-daemon-ready", () =>
|
|
349
|
+
operations.openCanonicalWorkspace(namespace, daemon),
|
|
350
|
+
);
|
|
351
|
+
await atBoundary("first-input-tui-coherent", () => operations.buildBeforeMeasurement(namespace));
|
|
352
|
+
await atBoundary("first-input-tui-coherent", () => operations.prepareFirstTui(namespace));
|
|
353
|
+
const firstProcess = await atBoundary("first-input-tui-coherent", () =>
|
|
354
|
+
operations.launchFirstTui(namespace, daemon, identity),
|
|
355
|
+
);
|
|
356
|
+
const baseline = await atBoundary("first-input-no-prior-hosted-input", () =>
|
|
357
|
+
operations.proveNoPriorHostedInput(namespace, daemon, identity, firstProcess),
|
|
358
|
+
);
|
|
359
|
+
const firstInput = await atBoundary("first-input-causal-paint", () =>
|
|
360
|
+
operations.driveFirstInput(namespace, daemon, identity, firstProcess, baseline),
|
|
361
|
+
);
|
|
362
|
+
const distributionProcess = await atBoundary("distribution-lane-fresh", () =>
|
|
363
|
+
operations.rehostDistributionTui(namespace, daemon, identity, firstProcess, firstInput),
|
|
364
|
+
);
|
|
365
|
+
const distribution = await atBoundary("distribution-samples", () =>
|
|
366
|
+
operations.driveDistribution(namespace, daemon, identity, distributionProcess, firstInput),
|
|
367
|
+
);
|
|
368
|
+
const web = await atBoundary("first-input-web-correlation", () =>
|
|
369
|
+
operations.startWebAfterInput(namespace, daemon, identity, distribution),
|
|
370
|
+
);
|
|
371
|
+
return Object.freeze({
|
|
372
|
+
namespace,
|
|
373
|
+
identity,
|
|
374
|
+
firstProcess,
|
|
375
|
+
firstInput,
|
|
376
|
+
distributionProcess,
|
|
377
|
+
distribution,
|
|
378
|
+
web,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** Dedicated focus journey: coherent target → exact blur/yield → focus/reclaim → Web. */
|
|
383
|
+
export async function runFocusOwnerBoot(operations) {
|
|
384
|
+
const atBoundary = async (boundary, operation) => {
|
|
385
|
+
try {
|
|
386
|
+
return await operation();
|
|
387
|
+
} catch (error) {
|
|
388
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
389
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
390
|
+
cause: error,
|
|
391
|
+
});
|
|
392
|
+
bounded.boundary = boundary;
|
|
393
|
+
if (error?.observation) bounded.observation = error.observation;
|
|
394
|
+
throw bounded;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
const namespace = await atBoundary("focus-namespace-ready", () =>
|
|
398
|
+
operations.createFocusNamespace(),
|
|
399
|
+
);
|
|
400
|
+
const daemon = await atBoundary("focus-daemon-ready", () =>
|
|
401
|
+
operations.startCanonicalDaemon(namespace),
|
|
402
|
+
);
|
|
403
|
+
const identity = await atBoundary("focus-daemon-ready", () =>
|
|
404
|
+
operations.openCanonicalWorkspace(namespace, daemon),
|
|
405
|
+
);
|
|
406
|
+
await atBoundary("focus-tui-build", () => operations.buildBeforeMeasurement(namespace));
|
|
407
|
+
const started = await atBoundary("focus-tui-started", () =>
|
|
408
|
+
operations.launchFocusTui(namespace, daemon, identity),
|
|
409
|
+
);
|
|
410
|
+
const host = await atBoundary("focus-host-ready", () =>
|
|
411
|
+
operations.waitForFocusHostReady(namespace, daemon, identity, started),
|
|
412
|
+
);
|
|
413
|
+
const process = await atBoundary("focus-tui-coherent", () =>
|
|
414
|
+
operations.waitForFocusTuiCoherent(namespace, daemon, identity, started, host),
|
|
415
|
+
);
|
|
416
|
+
const baseline = await atBoundary("focus-baseline", () =>
|
|
417
|
+
operations.proveFocusBaseline(namespace, daemon, identity, process),
|
|
418
|
+
);
|
|
419
|
+
const blur = await atBoundary("focus-blur-proved", () =>
|
|
420
|
+
operations.driveBlur(namespace, daemon, identity, process, baseline),
|
|
421
|
+
);
|
|
422
|
+
const reclaim = await atBoundary("focus-reclaim-proved", () =>
|
|
423
|
+
operations.driveFocus(namespace, daemon, identity, process, baseline, blur),
|
|
424
|
+
);
|
|
425
|
+
const web = await atBoundary("focus-web-correlation", () =>
|
|
426
|
+
operations.startWebAfterFocus(namespace, daemon, identity, process, reclaim),
|
|
427
|
+
);
|
|
428
|
+
return Object.freeze({ namespace, identity, process, baseline, blur, reclaim, web });
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/** Dedicated window lifecycle: coherent baseline → create → warm switches → rename → Web. */
|
|
432
|
+
export async function runWindowLifecycleOwnerBoot(operations) {
|
|
433
|
+
const atBoundary = async (boundary, operation) => {
|
|
434
|
+
operations.onBoundary?.(boundary);
|
|
435
|
+
try {
|
|
436
|
+
return await operation();
|
|
437
|
+
} catch (error) {
|
|
438
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
439
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
440
|
+
cause: error,
|
|
441
|
+
});
|
|
442
|
+
bounded.boundary = boundary;
|
|
443
|
+
if (error?.observation) bounded.observation = error.observation;
|
|
444
|
+
throw bounded;
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
const namespace = await atBoundary("window-namespace-ready", () =>
|
|
448
|
+
operations.createWindowNamespace(),
|
|
449
|
+
);
|
|
450
|
+
const daemon = await atBoundary("window-daemon-ready", () =>
|
|
451
|
+
operations.startCanonicalDaemon(namespace),
|
|
452
|
+
);
|
|
453
|
+
const identity = await atBoundary("window-daemon-ready", () =>
|
|
454
|
+
operations.openCanonicalWorkspace(namespace, daemon),
|
|
455
|
+
);
|
|
456
|
+
await atBoundary("window-tui-build", () => operations.buildBeforeMeasurement(namespace));
|
|
457
|
+
const started = await atBoundary("window-tui-started", () =>
|
|
458
|
+
operations.launchWindowTui(namespace, daemon, identity),
|
|
459
|
+
);
|
|
460
|
+
const host = await atBoundary("window-host-ready", () =>
|
|
461
|
+
operations.waitForWindowHostReady(namespace, daemon, identity, started),
|
|
462
|
+
);
|
|
463
|
+
const process = await atBoundary("window-tui-coherent", () =>
|
|
464
|
+
operations.waitForWindowTuiCoherent(namespace, daemon, identity, started, host),
|
|
465
|
+
);
|
|
466
|
+
const baseline = await atBoundary("window-baseline", () =>
|
|
467
|
+
operations.proveWindowBaseline(namespace, daemon, identity, process),
|
|
468
|
+
);
|
|
469
|
+
const created = await atBoundary("window-create-proved", () =>
|
|
470
|
+
operations.createWindow(namespace, daemon, identity, process, baseline),
|
|
471
|
+
);
|
|
472
|
+
const primed = await atBoundary("window-switch-visible", () =>
|
|
473
|
+
operations.primeCreatedWindow(namespace, daemon, identity, process, baseline, created),
|
|
474
|
+
);
|
|
475
|
+
const renamed = await atBoundary("window-rename-visible", () =>
|
|
476
|
+
operations.renameWindow(namespace, daemon, identity, process, baseline, created, primed),
|
|
477
|
+
);
|
|
478
|
+
const switches = await atBoundary("window-switch-distribution", () =>
|
|
479
|
+
operations.driveWarmSwitches(namespace, daemon, identity, process, baseline, created, renamed),
|
|
480
|
+
);
|
|
481
|
+
const web = await atBoundary("window-web-correlation", () =>
|
|
482
|
+
operations.startWebAfterWindowLifecycle(
|
|
483
|
+
namespace,
|
|
484
|
+
daemon,
|
|
485
|
+
identity,
|
|
486
|
+
process,
|
|
487
|
+
baseline,
|
|
488
|
+
created,
|
|
489
|
+
switches,
|
|
490
|
+
renamed,
|
|
491
|
+
),
|
|
492
|
+
);
|
|
493
|
+
return Object.freeze({
|
|
494
|
+
namespace,
|
|
495
|
+
identity,
|
|
496
|
+
process,
|
|
497
|
+
baseline,
|
|
498
|
+
created,
|
|
499
|
+
primed,
|
|
500
|
+
switches,
|
|
501
|
+
renamed,
|
|
502
|
+
web,
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/** Dedicated resize journey: coherent two-pane baseline → keyboard → pointer previews/release → Web. */
|
|
507
|
+
export async function runKeyboardPointerResizeOwnerBoot(operations) {
|
|
508
|
+
const atBoundary = async (boundary, operation) => {
|
|
509
|
+
operations.onBoundary?.(boundary);
|
|
510
|
+
try {
|
|
511
|
+
return await operation();
|
|
512
|
+
} catch (error) {
|
|
513
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
514
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
515
|
+
cause: error,
|
|
516
|
+
});
|
|
517
|
+
bounded.boundary = boundary;
|
|
518
|
+
bounded.observation =
|
|
519
|
+
error?.observation ??
|
|
520
|
+
Object.freeze({
|
|
521
|
+
operation: "keyboard-pointer-resize-owner",
|
|
522
|
+
reason: "operation-failed",
|
|
523
|
+
stage: boundary,
|
|
524
|
+
});
|
|
525
|
+
throw bounded;
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
const namespace = await atBoundary("resize-namespace-ready", operations.createResizeNamespace);
|
|
529
|
+
const daemon = await atBoundary("resize-daemon-ready", () =>
|
|
530
|
+
operations.startCanonicalDaemon(namespace),
|
|
531
|
+
);
|
|
532
|
+
const identity = await atBoundary("resize-daemon-ready", () =>
|
|
533
|
+
operations.openCanonicalWorkspace(namespace, daemon),
|
|
534
|
+
);
|
|
535
|
+
await atBoundary("resize-tui-build", () => operations.buildBeforeMeasurement(namespace));
|
|
536
|
+
const started = await atBoundary("resize-tui-started", () =>
|
|
537
|
+
operations.launchResizeTui(namespace, daemon, identity),
|
|
538
|
+
);
|
|
539
|
+
const host = await atBoundary("resize-host-ready", () =>
|
|
540
|
+
operations.waitForResizeHostReady(namespace, daemon, identity, started),
|
|
541
|
+
);
|
|
542
|
+
const process = await atBoundary("resize-tui-coherent", () =>
|
|
543
|
+
operations.waitForResizeTuiCoherent(namespace, daemon, identity, started, host),
|
|
544
|
+
);
|
|
545
|
+
const baseline = await atBoundary("resize-baseline", () =>
|
|
546
|
+
operations.proveResizeBaseline(namespace, daemon, identity, process),
|
|
547
|
+
);
|
|
548
|
+
const keyboard = await atBoundary("resize-keyboard-proved", () =>
|
|
549
|
+
operations.driveKeyboardResize(namespace, daemon, identity, process, baseline),
|
|
550
|
+
);
|
|
551
|
+
const pointerPreviews = await atBoundary("resize-pointer-preview-distribution", () =>
|
|
552
|
+
operations.drivePointerPreviews(namespace, daemon, identity, process, baseline, keyboard),
|
|
553
|
+
);
|
|
554
|
+
const pointerRelease = await atBoundary("resize-pointer-release-proved", () =>
|
|
555
|
+
operations.drivePointerRelease(
|
|
556
|
+
namespace,
|
|
557
|
+
daemon,
|
|
558
|
+
identity,
|
|
559
|
+
process,
|
|
560
|
+
baseline,
|
|
561
|
+
keyboard,
|
|
562
|
+
pointerPreviews,
|
|
563
|
+
),
|
|
564
|
+
);
|
|
565
|
+
const web = await atBoundary("resize-web-correlation", () =>
|
|
566
|
+
operations.startWebAfterResize(
|
|
567
|
+
namespace,
|
|
568
|
+
daemon,
|
|
569
|
+
identity,
|
|
570
|
+
process,
|
|
571
|
+
baseline,
|
|
572
|
+
keyboard,
|
|
573
|
+
pointerRelease,
|
|
574
|
+
),
|
|
575
|
+
);
|
|
576
|
+
return Object.freeze({
|
|
577
|
+
namespace,
|
|
578
|
+
identity,
|
|
579
|
+
process,
|
|
580
|
+
baseline,
|
|
581
|
+
keyboard,
|
|
582
|
+
pointerPreviews,
|
|
583
|
+
pointerRelease,
|
|
584
|
+
web,
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/** Dedicated selection journey: coherent pane → local selection/copy → app mouse → Web. */
|
|
589
|
+
export async function runSelectionCopyAppMouseOwnerBoot(operations) {
|
|
590
|
+
const atBoundary = async (boundary, operation) => {
|
|
591
|
+
operations.onBoundary?.(boundary);
|
|
592
|
+
try {
|
|
593
|
+
return await operation();
|
|
594
|
+
} catch (error) {
|
|
595
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
596
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
597
|
+
cause: error,
|
|
598
|
+
});
|
|
599
|
+
bounded.boundary = boundary;
|
|
600
|
+
bounded.observation =
|
|
601
|
+
error?.observation ??
|
|
602
|
+
Object.freeze({ operation: "selection-copy-app-mouse-owner", stage: boundary });
|
|
603
|
+
throw bounded;
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
const namespace = await atBoundary("selection-namespace-ready", operations.createNamespace);
|
|
607
|
+
const daemon = await atBoundary("selection-daemon-ready", () =>
|
|
608
|
+
operations.startDaemon(namespace),
|
|
609
|
+
);
|
|
610
|
+
const identity = await atBoundary("selection-daemon-ready", () =>
|
|
611
|
+
operations.openWorkspace(namespace, daemon),
|
|
612
|
+
);
|
|
613
|
+
await atBoundary("selection-tui-build", () => operations.build(namespace));
|
|
614
|
+
const started = await atBoundary("selection-tui-started", () =>
|
|
615
|
+
operations.launch(namespace, daemon, identity),
|
|
616
|
+
);
|
|
617
|
+
const host = await atBoundary("selection-host-ready", () =>
|
|
618
|
+
operations.waitHost(namespace, daemon, identity, started),
|
|
619
|
+
);
|
|
620
|
+
const process = await atBoundary("selection-tui-coherent", () =>
|
|
621
|
+
operations.waitCoherent(namespace, daemon, identity, started, host),
|
|
622
|
+
);
|
|
623
|
+
const baseline = await atBoundary("selection-baseline", () =>
|
|
624
|
+
operations.proveBaseline(namespace, daemon, identity, process, host),
|
|
625
|
+
);
|
|
626
|
+
const selection = await atBoundary("selection-visible", () =>
|
|
627
|
+
operations.driveSelection(namespace, daemon, identity, process, baseline),
|
|
628
|
+
);
|
|
629
|
+
const copy = await atBoundary("selection-copy-proved", () =>
|
|
630
|
+
operations.driveCopy(namespace, daemon, identity, process, baseline, selection),
|
|
631
|
+
);
|
|
632
|
+
const appMouse = await atBoundary("application-mouse-forwarded", () =>
|
|
633
|
+
operations.driveAppMouse(namespace, daemon, identity, process, baseline, copy),
|
|
634
|
+
);
|
|
635
|
+
const localMode = await atBoundary("selection-local-mode-proved", () =>
|
|
636
|
+
operations.driveLocalMode(namespace, daemon, identity, process, baseline, appMouse),
|
|
637
|
+
);
|
|
638
|
+
const web = await atBoundary("selection-web-correlation", () =>
|
|
639
|
+
operations.startWeb(namespace, daemon, identity, process, baseline, localMode),
|
|
640
|
+
);
|
|
641
|
+
return Object.freeze({
|
|
642
|
+
namespace,
|
|
643
|
+
identity,
|
|
644
|
+
process,
|
|
645
|
+
host,
|
|
646
|
+
baseline,
|
|
647
|
+
selection,
|
|
648
|
+
copy,
|
|
649
|
+
appMouse,
|
|
650
|
+
localMode,
|
|
651
|
+
web,
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/** Dedicated ANSI journey: normal baseline → cursor/ANSI → alternate buffer → exact restore. */
|
|
656
|
+
export async function runAnsiCursorAltScreenOwnerBoot(operations) {
|
|
657
|
+
const atBoundary = async (boundary, operation) => {
|
|
658
|
+
operations.onBoundary?.(boundary);
|
|
659
|
+
try {
|
|
660
|
+
return await operation();
|
|
661
|
+
} catch (error) {
|
|
662
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
663
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
664
|
+
cause: error,
|
|
665
|
+
});
|
|
666
|
+
bounded.boundary = boundary;
|
|
667
|
+
bounded.observation =
|
|
668
|
+
error?.observation ??
|
|
669
|
+
Object.freeze({ operation: "ansi-cursor-alt-screen-owner", stage: boundary });
|
|
670
|
+
throw bounded;
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
const namespace = await atBoundary("ansi-namespace-ready", operations.createNamespace);
|
|
674
|
+
const daemon = await atBoundary("ansi-daemon-ready", () => operations.startDaemon(namespace));
|
|
675
|
+
const identity = await atBoundary("ansi-daemon-ready", () =>
|
|
676
|
+
operations.openWorkspace(namespace, daemon),
|
|
677
|
+
);
|
|
678
|
+
await atBoundary("ansi-tui-build", () => operations.build(namespace));
|
|
679
|
+
const started = await atBoundary("ansi-tui-started", () =>
|
|
680
|
+
operations.launch(namespace, daemon, identity),
|
|
681
|
+
);
|
|
682
|
+
const host = await atBoundary("ansi-host-ready", () =>
|
|
683
|
+
operations.waitHost(namespace, daemon, identity, started),
|
|
684
|
+
);
|
|
685
|
+
const process = await atBoundary("ansi-tui-coherent", () =>
|
|
686
|
+
operations.waitCoherent(namespace, daemon, identity, started, host),
|
|
687
|
+
);
|
|
688
|
+
const baseline = await atBoundary("ansi-normal-baseline", () =>
|
|
689
|
+
operations.proveNormalBaseline(namespace, daemon, identity, process, host),
|
|
690
|
+
);
|
|
691
|
+
const rich = await atBoundary("ansi-rich-presentation", () =>
|
|
692
|
+
operations.driveRichAnsi(namespace, daemon, identity, process, baseline),
|
|
693
|
+
);
|
|
694
|
+
const cursor = await atBoundary("ansi-cursor-only-distribution", () =>
|
|
695
|
+
operations.driveCursorDistribution(namespace, daemon, identity, process, baseline, rich),
|
|
696
|
+
);
|
|
697
|
+
const alternate = await atBoundary("ansi-alternate-screen", () =>
|
|
698
|
+
operations.enterAlternateScreen(namespace, daemon, identity, process, baseline, cursor),
|
|
699
|
+
);
|
|
700
|
+
const restored = await atBoundary("ansi-normal-restored", () =>
|
|
701
|
+
operations.restoreNormalScreen(namespace, daemon, identity, process, baseline, alternate),
|
|
702
|
+
);
|
|
703
|
+
const sustained = await atBoundary("ansi-sustained-workload", () =>
|
|
704
|
+
operations.runSustainedWorkload(namespace, daemon, identity, process, baseline, restored),
|
|
705
|
+
);
|
|
706
|
+
const idle = await atBoundary("ansi-idle-quiescent", () =>
|
|
707
|
+
operations.proveIdle(namespace, daemon, identity, process, baseline, sustained),
|
|
708
|
+
);
|
|
709
|
+
const web = await atBoundary("ansi-web-correlation", () =>
|
|
710
|
+
operations.startWeb(namespace, daemon, identity, process, baseline, restored, idle),
|
|
711
|
+
);
|
|
712
|
+
return Object.freeze({
|
|
713
|
+
namespace,
|
|
714
|
+
identity,
|
|
715
|
+
process,
|
|
716
|
+
host,
|
|
717
|
+
baseline,
|
|
718
|
+
rich,
|
|
719
|
+
cursor,
|
|
720
|
+
alternate,
|
|
721
|
+
restored,
|
|
722
|
+
sustained,
|
|
723
|
+
idle,
|
|
724
|
+
web,
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/** Card5 proof: real adapters first, then authority/isolation, then one daemon replacement. */
|
|
729
|
+
export async function runCrossClientHandoffOwnerBoot(operations) {
|
|
730
|
+
const atBoundary = async (boundary, operation) => {
|
|
731
|
+
operations.onBoundary?.(boundary);
|
|
732
|
+
try {
|
|
733
|
+
return await operation();
|
|
734
|
+
} catch (error) {
|
|
735
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
736
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
737
|
+
cause: error,
|
|
738
|
+
});
|
|
739
|
+
bounded.boundary = boundary;
|
|
740
|
+
bounded.observation =
|
|
741
|
+
error?.observation ??
|
|
742
|
+
Object.freeze({
|
|
743
|
+
operation: "card5-cross-client-live-proof",
|
|
744
|
+
reason: "operation-failed",
|
|
745
|
+
boundary,
|
|
746
|
+
});
|
|
747
|
+
throw bounded;
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
const namespace = await atBoundary(
|
|
751
|
+
"cross-client-production-hosts",
|
|
752
|
+
operations.createProductionHosts,
|
|
753
|
+
);
|
|
754
|
+
const initial = await atBoundary("cross-client-initial-convergence", () =>
|
|
755
|
+
operations.waitInitialConvergence(namespace),
|
|
756
|
+
);
|
|
757
|
+
const handoff = await atBoundary("cross-client-authority-handoff", () =>
|
|
758
|
+
operations.driveAuthorityHandoff(namespace, initial),
|
|
759
|
+
);
|
|
760
|
+
const geometry = await atBoundary("cross-client-passive-geometry", () =>
|
|
761
|
+
operations.provePassiveGeometry(namespace, initial, handoff),
|
|
762
|
+
);
|
|
763
|
+
const slowWeb = await atBoundary("cross-client-slow-web-isolation", () =>
|
|
764
|
+
operations.proveSlowWebIsolation(namespace, initial, handoff, geometry),
|
|
765
|
+
);
|
|
766
|
+
const restart = await atBoundary("cross-client-daemon-restart", () =>
|
|
767
|
+
operations.restartDaemon(namespace, initial, slowWeb),
|
|
768
|
+
);
|
|
769
|
+
const after = await atBoundary("cross-client-restart-convergence", () =>
|
|
770
|
+
operations.waitRestartConvergence(namespace, initial, restart),
|
|
771
|
+
);
|
|
772
|
+
const nativeObserver = await atBoundary("cross-client-native-observer", () =>
|
|
773
|
+
operations.proveNativeObserver(namespace, after),
|
|
774
|
+
);
|
|
775
|
+
const correlation = await atBoundary("cross-client-correlation-privacy", () =>
|
|
776
|
+
operations.sealCorrelation(
|
|
777
|
+
namespace,
|
|
778
|
+
initial,
|
|
779
|
+
handoff,
|
|
780
|
+
geometry,
|
|
781
|
+
slowWeb,
|
|
782
|
+
restart,
|
|
783
|
+
after,
|
|
784
|
+
nativeObserver,
|
|
785
|
+
),
|
|
786
|
+
);
|
|
787
|
+
return Object.freeze({
|
|
788
|
+
namespace,
|
|
789
|
+
initial,
|
|
790
|
+
handoff,
|
|
791
|
+
geometry,
|
|
792
|
+
slowWeb,
|
|
793
|
+
restart,
|
|
794
|
+
after,
|
|
795
|
+
nativeObserver,
|
|
796
|
+
correlation,
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/** Card5 restart proof is independent from authority handoff despite shared host setup. */
|
|
801
|
+
export async function runDaemonRestartOwnerBoot(operations) {
|
|
802
|
+
const atBoundary = async (boundary, operation) => {
|
|
803
|
+
operations.onBoundary?.(boundary);
|
|
804
|
+
try {
|
|
805
|
+
return await operation();
|
|
806
|
+
} catch (error) {
|
|
807
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
808
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
809
|
+
cause: error,
|
|
810
|
+
});
|
|
811
|
+
bounded.boundary = boundary;
|
|
812
|
+
bounded.observation =
|
|
813
|
+
error?.observation ??
|
|
814
|
+
Object.freeze({
|
|
815
|
+
operation: "card5-daemon-restart-live-proof",
|
|
816
|
+
reason: "operation-failed",
|
|
817
|
+
boundary,
|
|
818
|
+
});
|
|
819
|
+
throw bounded;
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
const hosts = await atBoundary(
|
|
823
|
+
"daemon-restart-production-hosts",
|
|
824
|
+
operations.createProductionHosts,
|
|
825
|
+
);
|
|
826
|
+
const before = await atBoundary("daemon-restart-before-convergence", () =>
|
|
827
|
+
operations.waitBeforeConvergence(hosts),
|
|
828
|
+
);
|
|
829
|
+
const replacement = await atBoundary("daemon-restart-generation-replaced", () =>
|
|
830
|
+
operations.replaceDaemon(hosts, before),
|
|
831
|
+
);
|
|
832
|
+
const staleFence = await atBoundary("daemon-restart-stale-authority-rejected", () =>
|
|
833
|
+
operations.proveStaleFence(hosts, before, replacement),
|
|
834
|
+
);
|
|
835
|
+
const reconnect = await atBoundary("daemon-restart-hosts-reconnected", () =>
|
|
836
|
+
operations.waitHostsReconnected(hosts, replacement, staleFence),
|
|
837
|
+
);
|
|
838
|
+
const after = await atBoundary("daemon-restart-canonical-convergence", () =>
|
|
839
|
+
operations.waitCanonicalConvergence(hosts, replacement, reconnect),
|
|
840
|
+
);
|
|
841
|
+
const correlation = await atBoundary("daemon-restart-correlation-privacy", () =>
|
|
842
|
+
operations.sealRestartCorrelation(hosts, before, replacement, after),
|
|
843
|
+
);
|
|
844
|
+
return Object.freeze({ hosts, before, replacement, staleFence, reconnect, after, correlation });
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** Ordinary-session reincarnation: retire G1 completely before admitting same-name G2. */
|
|
848
|
+
export async function runSessionRecreateOwnerBoot(operations) {
|
|
849
|
+
const atBoundary = async (boundary, operation) => {
|
|
850
|
+
operations.onBoundary?.(boundary);
|
|
851
|
+
try {
|
|
852
|
+
return await operation();
|
|
853
|
+
} catch (error) {
|
|
854
|
+
if (error && typeof error === "object" && error.boundary) throw error;
|
|
855
|
+
const bounded = new Error(error instanceof Error ? error.message : String(error), {
|
|
856
|
+
cause: error,
|
|
857
|
+
});
|
|
858
|
+
bounded.boundary = boundary;
|
|
859
|
+
bounded.observation =
|
|
860
|
+
error?.observation ??
|
|
861
|
+
Object.freeze({
|
|
862
|
+
operation: "product-session-recreate",
|
|
863
|
+
reason: "operation-failed",
|
|
864
|
+
boundary,
|
|
865
|
+
});
|
|
866
|
+
throw bounded;
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
const namespace = await atBoundary(
|
|
870
|
+
"session-recreate-namespace-ready",
|
|
871
|
+
operations.createNamespace,
|
|
872
|
+
);
|
|
873
|
+
const daemon = await atBoundary("session-recreate-daemon-ready", () =>
|
|
874
|
+
operations.startDaemon(namespace),
|
|
875
|
+
);
|
|
876
|
+
const identity = await atBoundary("session-recreate-workspace-ready", () =>
|
|
877
|
+
operations.openWorkspace(namespace, daemon),
|
|
878
|
+
);
|
|
879
|
+
await atBoundary("session-recreate-tui-build", () => operations.build(namespace));
|
|
880
|
+
const process = await atBoundary("session-recreate-tui-started", () =>
|
|
881
|
+
operations.launch(namespace, daemon, identity),
|
|
882
|
+
);
|
|
883
|
+
const before = await atBoundary("session-recreate-before-coherent", () =>
|
|
884
|
+
operations.proveBefore(namespace, daemon, identity, process),
|
|
885
|
+
);
|
|
886
|
+
const killed = await atBoundary("session-recreate-session-killed", () =>
|
|
887
|
+
operations.killSession(namespace, daemon, identity, process, before),
|
|
888
|
+
);
|
|
889
|
+
const retired = await atBoundary("session-recreate-old-retired", () =>
|
|
890
|
+
operations.proveRetired(namespace, daemon, identity, process, before, killed),
|
|
891
|
+
);
|
|
892
|
+
const staleInput = await atBoundary("session-recreate-old-input-rejected", () =>
|
|
893
|
+
operations.proveOldInputRejected(namespace, daemon, identity, process, before, killed, retired),
|
|
894
|
+
);
|
|
895
|
+
const recreated = await atBoundary("session-recreate-same-name-created", () =>
|
|
896
|
+
operations.recreateSession(namespace, daemon, identity, process, before, retired, staleInput),
|
|
897
|
+
);
|
|
898
|
+
const recovered = await atBoundary("session-recreate-new-generation-live", () =>
|
|
899
|
+
operations.proveRecovered(namespace, daemon, identity, process, before, retired, recreated),
|
|
900
|
+
);
|
|
901
|
+
const acceptedInput = await atBoundary("session-recreate-new-input-once", () =>
|
|
902
|
+
operations.proveNewInputOnce(namespace, daemon, process, before, recreated, recovered),
|
|
903
|
+
);
|
|
904
|
+
const residue = await atBoundary("session-recreate-no-stale-residue", () =>
|
|
905
|
+
operations.proveNoStaleResidue(
|
|
906
|
+
namespace,
|
|
907
|
+
daemon,
|
|
908
|
+
process,
|
|
909
|
+
before,
|
|
910
|
+
retired,
|
|
911
|
+
recreated,
|
|
912
|
+
recovered,
|
|
913
|
+
acceptedInput,
|
|
914
|
+
),
|
|
915
|
+
);
|
|
916
|
+
return Object.freeze({
|
|
917
|
+
namespace,
|
|
918
|
+
identity,
|
|
919
|
+
process,
|
|
920
|
+
before,
|
|
921
|
+
killed,
|
|
922
|
+
retired,
|
|
923
|
+
staleInput,
|
|
924
|
+
recreated,
|
|
925
|
+
recovered,
|
|
926
|
+
acceptedInput,
|
|
927
|
+
residue,
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
export function assessProductSessionRecreateEvidence(evidence) {
|
|
932
|
+
const before = evidence?.before;
|
|
933
|
+
const retired = evidence?.retired;
|
|
934
|
+
const recreated = evidence?.recreated;
|
|
935
|
+
const recovered = evidence?.recovered;
|
|
936
|
+
const acceptedInput = evidence?.acceptedInput;
|
|
937
|
+
const residue = evidence?.residue;
|
|
938
|
+
const checks = Object.freeze({
|
|
939
|
+
oldIdentityExact:
|
|
940
|
+
typeof before?.sessionId === "string" &&
|
|
941
|
+
typeof before?.paneId === "string" &&
|
|
942
|
+
typeof before?.semanticPaneId === "string",
|
|
943
|
+
exactRetirement:
|
|
944
|
+
retired?.catalogAbsent === true &&
|
|
945
|
+
retired?.workspaceUnavailable === true &&
|
|
946
|
+
retired?.oldPaneAbsent === true,
|
|
947
|
+
staleInputRejected:
|
|
948
|
+
evidence?.staleInput?.submittedWhileRetired === true &&
|
|
949
|
+
recovered?.staleInputRejected === true,
|
|
950
|
+
reincarnated:
|
|
951
|
+
recreated?.sessionName === before?.sessionName &&
|
|
952
|
+
recreated?.sessionId !== before?.sessionId &&
|
|
953
|
+
recreated?.paneId !== before?.paneId &&
|
|
954
|
+
recreated?.cwd !== before?.cwd,
|
|
955
|
+
recoveredExact:
|
|
956
|
+
recovered?.status === "live" &&
|
|
957
|
+
recovered?.semanticPaneId === recreated?.semanticPaneId &&
|
|
958
|
+
recovered?.oldSemanticPanePresent === false &&
|
|
959
|
+
recovered?.styledContentRestored === true,
|
|
960
|
+
newInputOnce:
|
|
961
|
+
acceptedInput?.occurrences === 1 &&
|
|
962
|
+
acceptedInput?.semanticPaneId === recreated?.semanticPaneId,
|
|
963
|
+
noResidue:
|
|
964
|
+
residue?.oldRegistryEntries === 0 &&
|
|
965
|
+
residue?.oldSidebarEntries === 0 &&
|
|
966
|
+
residue?.oldProcessAlive === false,
|
|
967
|
+
daemonSigkillRecovered:
|
|
968
|
+
evidence?.hostile?.daemonSigkill?.predecessorDead === true &&
|
|
969
|
+
evidence?.hostile?.daemonSigkill?.staleRecordRetained === true &&
|
|
970
|
+
evidence?.hostile?.daemonSigkill?.generationChanged === true &&
|
|
971
|
+
evidence?.hostile?.daemonSigkill?.status === "live" &&
|
|
972
|
+
evidence?.hostile?.daemonSigkill?.inputOccurrences === 1,
|
|
973
|
+
tmuxServerRecreateRecovered:
|
|
974
|
+
evidence?.hostile?.tmuxServerRecreate?.predecessorFenced === true &&
|
|
975
|
+
evidence?.hostile?.tmuxServerRecreate?.oldPaneDead === true &&
|
|
976
|
+
evidence?.hostile?.tmuxServerRecreate?.sessionIdChanged === true &&
|
|
977
|
+
evidence?.hostile?.tmuxServerRecreate?.daemonGenerationChanged === true &&
|
|
978
|
+
evidence?.hostile?.tmuxServerRecreate?.status === "live" &&
|
|
979
|
+
evidence?.hostile?.tmuxServerRecreate?.inputOccurrences === 1,
|
|
980
|
+
});
|
|
981
|
+
const firstFailed = Object.entries(checks).find(([, passed]) => !passed)?.[0] ?? null;
|
|
982
|
+
return Object.freeze({ passed: firstFailed === null, firstFailed, checks });
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function exactTargetedTuiCwd(runtimeDir, { createMissing, hooks = {} }) {
|
|
986
|
+
const fail = (reason, cause = undefined) => {
|
|
987
|
+
const error = new Error(`targeted TUI isolated cwd preparation failed: ${reason}`, { cause });
|
|
988
|
+
error.boundary = createMissing ? "targeted-namespace-preseeded" : "targeted-tui-connect";
|
|
989
|
+
error.observation = Object.freeze({
|
|
990
|
+
operation: createMissing ? "create-isolated-tui-cwd" : "prepare-isolated-tui-cwd",
|
|
991
|
+
reason,
|
|
992
|
+
runtimeKind: "product-rig-testdrive",
|
|
993
|
+
});
|
|
994
|
+
throw error;
|
|
995
|
+
};
|
|
996
|
+
if (
|
|
997
|
+
typeof runtimeDir !== "string" ||
|
|
998
|
+
!isAbsolute(runtimeDir) ||
|
|
999
|
+
runtimeDir.length === 0 ||
|
|
1000
|
+
runtimeDir.length > 4_096 ||
|
|
1001
|
+
/[\0\r\n]/u.test(runtimeDir)
|
|
1002
|
+
)
|
|
1003
|
+
fail("malformed-runtime-directory");
|
|
1004
|
+
const exactRuntimeDir = resolve(runtimeDir);
|
|
1005
|
+
const cwd = join(exactRuntimeDir, "home");
|
|
1006
|
+
const assertDirectoryIdentity = (path, label, opened) => {
|
|
1007
|
+
let current;
|
|
1008
|
+
try {
|
|
1009
|
+
current = lstatSync(path);
|
|
1010
|
+
} catch (error) {
|
|
1011
|
+
fail(`${label}-identity-read-failed`, error);
|
|
1012
|
+
}
|
|
1013
|
+
if (
|
|
1014
|
+
current.isSymbolicLink() ||
|
|
1015
|
+
!current.isDirectory() ||
|
|
1016
|
+
current.dev !== opened.dev ||
|
|
1017
|
+
current.ino !== opened.ino
|
|
1018
|
+
)
|
|
1019
|
+
fail(`${label}-identity-changed`);
|
|
1020
|
+
try {
|
|
1021
|
+
const expectedRealPath = join(realpathSync(dirname(path)), basename(path));
|
|
1022
|
+
if (realpathSync(path) !== expectedRealPath) fail(`${label}-resolved-path-mismatch`);
|
|
1023
|
+
} catch (error) {
|
|
1024
|
+
if (error?.boundary) throw error;
|
|
1025
|
+
fail(`${label}-resolved-path-read-failed`, error);
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
const prepareDirectory = (path, label, parent = null) => {
|
|
1029
|
+
if (parent) assertDirectoryIdentity(parent.path, parent.label, parent.opened);
|
|
1030
|
+
let metadata;
|
|
1031
|
+
try {
|
|
1032
|
+
metadata = lstatSync(path);
|
|
1033
|
+
} catch (error) {
|
|
1034
|
+
if (error?.code !== "ENOENT") fail(`${label}-metadata-read-failed`, error);
|
|
1035
|
+
if (!createMissing) fail(`${label}-missing`);
|
|
1036
|
+
try {
|
|
1037
|
+
mkdirSync(path, { recursive: false, mode: 0o700 });
|
|
1038
|
+
metadata = lstatSync(path);
|
|
1039
|
+
} catch (createError) {
|
|
1040
|
+
fail(`${label}-create-failed`, createError);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
if (!metadata.isDirectory() || metadata.isSymbolicLink()) fail(`${label}-not-exact-directory`);
|
|
1044
|
+
let descriptor;
|
|
1045
|
+
try {
|
|
1046
|
+
descriptor = openSync(
|
|
1047
|
+
path,
|
|
1048
|
+
fsConstants.O_RDONLY | fsConstants.O_DIRECTORY | fsConstants.O_NOFOLLOW,
|
|
1049
|
+
);
|
|
1050
|
+
const opened = fstatSync(descriptor);
|
|
1051
|
+
if (!opened.isDirectory()) fail(`${label}-opened-resource-not-directory`);
|
|
1052
|
+
if (parent) assertDirectoryIdentity(parent.path, parent.label, parent.opened);
|
|
1053
|
+
if (createMissing) fchmodSync(descriptor, 0o700);
|
|
1054
|
+
else if ((opened.mode & 0o777) !== 0o700) fail(`${label}-permission-mismatch`);
|
|
1055
|
+
assertDirectoryIdentity(path, label, opened);
|
|
1056
|
+
if (parent) assertDirectoryIdentity(parent.path, parent.label, parent.opened);
|
|
1057
|
+
return { descriptor, opened, path, label };
|
|
1058
|
+
} catch (error) {
|
|
1059
|
+
if (descriptor !== undefined) closeSync(descriptor);
|
|
1060
|
+
if (error?.boundary) throw error;
|
|
1061
|
+
fail(`${label}-open-or-permission-failed`, error);
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
let runtime;
|
|
1065
|
+
let home;
|
|
1066
|
+
try {
|
|
1067
|
+
runtime = prepareDirectory(exactRuntimeDir, "runtime");
|
|
1068
|
+
try {
|
|
1069
|
+
hooks.afterRuntimeValidated?.();
|
|
1070
|
+
} catch (error) {
|
|
1071
|
+
fail("runtime-validation-hook-failed", error);
|
|
1072
|
+
}
|
|
1073
|
+
assertDirectoryIdentity(runtime.path, runtime.label, runtime.opened);
|
|
1074
|
+
home = prepareDirectory(cwd, "home", runtime);
|
|
1075
|
+
assertDirectoryIdentity(runtime.path, runtime.label, runtime.opened);
|
|
1076
|
+
return cwd;
|
|
1077
|
+
} finally {
|
|
1078
|
+
if (home?.descriptor !== undefined) closeSync(home.descriptor);
|
|
1079
|
+
if (runtime?.descriptor !== undefined) closeSync(runtime.descriptor);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
export function createIsolatedTargetedTuiCwd(runtimeDir) {
|
|
1084
|
+
return exactTargetedTuiCwd(runtimeDir, { createMissing: true });
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
export function prepareIsolatedTargetedTuiCwd(runtimeDir, hooks = {}) {
|
|
1088
|
+
return exactTargetedTuiCwd(runtimeDir, { createMissing: false, hooks });
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
export class ProductJourneyAttemptError extends Error {
|
|
1092
|
+
constructor(entry, boundary, bundle, cause) {
|
|
1093
|
+
super(
|
|
1094
|
+
`ProductRig journey ${entry.journey.id} repetition ${entry.repetition} failed at ${boundary}; evidence: ${bundle.runDir}`,
|
|
1095
|
+
{ cause },
|
|
1096
|
+
);
|
|
1097
|
+
this.name = "ProductJourneyAttemptError";
|
|
1098
|
+
this.boundary = boundary;
|
|
1099
|
+
this.bundle = bundle;
|
|
1100
|
+
this.originalCause = cause;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
export function productJourneyFailureBoundary(error, fallback) {
|
|
1105
|
+
return typeof error?.boundary === "string" && error.boundary.length > 0
|
|
1106
|
+
? error.boundary
|
|
1107
|
+
: fallback;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
export function productRigTerminalFailureState(error, fallbackBoundary) {
|
|
1111
|
+
return Object.freeze({
|
|
1112
|
+
status: "failed",
|
|
1113
|
+
failure: error instanceof Error ? error.stack || error.message : String(error),
|
|
1114
|
+
firstBrokenBoundary: productJourneyFailureBoundary(error, fallbackBoundary),
|
|
1115
|
+
...(error?.observation ? { failureObservation: error.observation } : {}),
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export function productRigTerminalFailureError(state) {
|
|
1120
|
+
const failure = new Error(state?.failure || "product rig failed");
|
|
1121
|
+
if (typeof state?.firstBrokenBoundary === "string") failure.boundary = state.firstBrokenBoundary;
|
|
1122
|
+
if (state?.failureObservation) failure.observation = state.failureObservation;
|
|
1123
|
+
return failure;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/** Deterministic lifecycle seam: clean → drive → clean → immutable publish. */
|
|
1127
|
+
export async function runIsolatedProductJourneyAttempt(entry, operations) {
|
|
1128
|
+
let completed = null;
|
|
1129
|
+
let failure = null;
|
|
1130
|
+
let failureBoundary = null;
|
|
1131
|
+
let cleanupFailure = null;
|
|
1132
|
+
let validationFailure = null;
|
|
1133
|
+
let preCleanupFailureEvidence = null;
|
|
1134
|
+
let cleanupReceipt;
|
|
1135
|
+
const phase = (value) => operations.onPhase?.(value);
|
|
1136
|
+
|
|
1137
|
+
phase("pre-attempt-cleanup");
|
|
1138
|
+
try {
|
|
1139
|
+
await operations.preCleanup();
|
|
1140
|
+
phase("product-rig-startup");
|
|
1141
|
+
completed = await operations.drive();
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
failure = error;
|
|
1144
|
+
failureBoundary = productJourneyFailureBoundary(error, operations.currentBoundary());
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
if (failure && operations.captureFailureEvidence) {
|
|
1148
|
+
phase("pre-cleanup-failure-evidence");
|
|
1149
|
+
const captureAbort = new AbortController();
|
|
1150
|
+
const capture = Promise.resolve().then(() =>
|
|
1151
|
+
operations.captureFailureEvidence(failure, failureBoundary, captureAbort.signal),
|
|
1152
|
+
);
|
|
1153
|
+
const settledCapture = capture.then(
|
|
1154
|
+
(value) => ({ status: "captured", value }),
|
|
1155
|
+
() => ({ status: "failed" }),
|
|
1156
|
+
);
|
|
1157
|
+
let timeout;
|
|
1158
|
+
const captureTimeoutMs =
|
|
1159
|
+
Number.isSafeInteger(operations.failureEvidenceTimeoutMs) &&
|
|
1160
|
+
operations.failureEvidenceTimeoutMs >= 1 &&
|
|
1161
|
+
operations.failureEvidenceTimeoutMs <= 1_000
|
|
1162
|
+
? operations.failureEvidenceTimeoutMs
|
|
1163
|
+
: 1_000;
|
|
1164
|
+
const timeoutCapture = new Promise((resolve) => {
|
|
1165
|
+
timeout = setTimeout(() => resolve({ status: "timeout" }), captureTimeoutMs);
|
|
1166
|
+
});
|
|
1167
|
+
const outcome = await Promise.race([settledCapture, timeoutCapture]);
|
|
1168
|
+
clearTimeout(timeout);
|
|
1169
|
+
if (outcome.status === "timeout") {
|
|
1170
|
+
captureAbort.abort();
|
|
1171
|
+
let cancellationTimeout;
|
|
1172
|
+
await Promise.race([
|
|
1173
|
+
settledCapture,
|
|
1174
|
+
new Promise((resolve) => {
|
|
1175
|
+
cancellationTimeout = setTimeout(resolve, Math.min(captureTimeoutMs, 100));
|
|
1176
|
+
}),
|
|
1177
|
+
]);
|
|
1178
|
+
clearTimeout(cancellationTimeout);
|
|
1179
|
+
}
|
|
1180
|
+
preCleanupFailureEvidence =
|
|
1181
|
+
outcome.status === "captured"
|
|
1182
|
+
? outcome.value
|
|
1183
|
+
: Object.freeze({ available: false, reason: `pre-cleanup-${outcome.status}` });
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
phase("attempt-cleanup");
|
|
1187
|
+
try {
|
|
1188
|
+
cleanupReceipt = await operations.postCleanup();
|
|
1189
|
+
} catch (cleanupError) {
|
|
1190
|
+
phase("attempt-cleanup-retry");
|
|
1191
|
+
try {
|
|
1192
|
+
cleanupReceipt = await operations.retryCleanup(cleanupError);
|
|
1193
|
+
} catch (retryError) {
|
|
1194
|
+
throw new AggregateError(
|
|
1195
|
+
[cleanupError, retryError],
|
|
1196
|
+
"ProductRig exact cleanup barrier failed after bounded retry; evidence publication and later attempts are blocked",
|
|
1197
|
+
{ cause: retryError },
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
if (!failure) {
|
|
1201
|
+
failure = cleanupError;
|
|
1202
|
+
failureBoundary = "attempt-cleanup";
|
|
1203
|
+
} else {
|
|
1204
|
+
cleanupFailure = cleanupError;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
phase("post-cleanup-validation");
|
|
1209
|
+
try {
|
|
1210
|
+
await operations.validateAfterCleanup?.();
|
|
1211
|
+
} catch (validationError) {
|
|
1212
|
+
if (!failure) {
|
|
1213
|
+
failure = validationError;
|
|
1214
|
+
failureBoundary = productJourneyFailureBoundary(validationError, "post-cleanup-validation");
|
|
1215
|
+
} else {
|
|
1216
|
+
validationFailure = validationError;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
if (failure) {
|
|
1221
|
+
const failedResult = await operations.prepareFailure(
|
|
1222
|
+
failure,
|
|
1223
|
+
failureBoundary,
|
|
1224
|
+
cleanupReceipt,
|
|
1225
|
+
preCleanupFailureEvidence,
|
|
1226
|
+
);
|
|
1227
|
+
if (cleanupFailure) operations.appendCleanupFailure(failedResult, cleanupFailure);
|
|
1228
|
+
if (validationFailure) operations.appendValidationFailure?.(failedResult, validationFailure);
|
|
1229
|
+
phase("failure-bundle-publication");
|
|
1230
|
+
const bundle = await operations.publishFailure(failedResult, cleanupReceipt);
|
|
1231
|
+
throw new ProductJourneyAttemptError(entry, failureBoundary, bundle, failure);
|
|
1232
|
+
}
|
|
1233
|
+
phase("success-bundle-publication");
|
|
1234
|
+
try {
|
|
1235
|
+
return await operations.publishSuccess(completed, cleanupReceipt);
|
|
1236
|
+
} catch (publicationError) {
|
|
1237
|
+
const boundary = "success-bundle-publication";
|
|
1238
|
+
const publicationFailure = await operations.prepareFailure(
|
|
1239
|
+
publicationError,
|
|
1240
|
+
boundary,
|
|
1241
|
+
cleanupReceipt,
|
|
1242
|
+
);
|
|
1243
|
+
const bundle = await operations.publishFailure(publicationFailure, cleanupReceipt);
|
|
1244
|
+
throw new ProductJourneyAttemptError(entry, boundary, bundle, publicationError);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
function exactObjectKeys(value, keys) {
|
|
1249
|
+
return (
|
|
1250
|
+
value !== null &&
|
|
1251
|
+
typeof value === "object" &&
|
|
1252
|
+
!Array.isArray(value) &&
|
|
1253
|
+
Object.keys(value).sort().join("\0") === [...keys].sort().join("\0")
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
export function createProductRigCleanupReceipt(entry, state, attempt) {
|
|
1258
|
+
const namespace = state?.runtimeNamespace;
|
|
1259
|
+
const cleanup = state?.cleanup;
|
|
1260
|
+
const preflight = state?.diagnosticAttempt?.preflight;
|
|
1261
|
+
const exactNoResourcePreflight =
|
|
1262
|
+
exactObjectKeys(state?.diagnosticAttempt, [
|
|
1263
|
+
"runId",
|
|
1264
|
+
"resourcesCreated",
|
|
1265
|
+
"sourceProvenance",
|
|
1266
|
+
"preflight",
|
|
1267
|
+
]) &&
|
|
1268
|
+
exactObjectKeys(state?.diagnosticAttempt?.sourceProvenance, [
|
|
1269
|
+
"commit",
|
|
1270
|
+
"tree",
|
|
1271
|
+
"manifestDigest",
|
|
1272
|
+
]) &&
|
|
1273
|
+
/^[0-9a-f]{40,64}$/u.test(state?.diagnosticAttempt?.sourceProvenance?.commit ?? "") &&
|
|
1274
|
+
/^[0-9a-f]{40,64}$/u.test(state?.diagnosticAttempt?.sourceProvenance?.tree ?? "") &&
|
|
1275
|
+
/^[0-9a-f]{64}$/u.test(state?.diagnosticAttempt?.sourceProvenance?.manifestDigest ?? "") &&
|
|
1276
|
+
exactObjectKeys(preflight, [
|
|
1277
|
+
"operation",
|
|
1278
|
+
"stage",
|
|
1279
|
+
"outcome",
|
|
1280
|
+
"resourcesCreated",
|
|
1281
|
+
"pathsClaimed",
|
|
1282
|
+
"daemonStarted",
|
|
1283
|
+
]) &&
|
|
1284
|
+
state?.diagnosticAttempt?.runId === entry?.runId &&
|
|
1285
|
+
state?.diagnosticAttempt?.resourcesCreated === false &&
|
|
1286
|
+
preflight?.operation === "product-rig-namespace-preflight" &&
|
|
1287
|
+
preflight?.stage === "ansi-initial-pane-command" &&
|
|
1288
|
+
preflight?.outcome === "command-rejected" &&
|
|
1289
|
+
preflight?.resourcesCreated === false &&
|
|
1290
|
+
preflight?.pathsClaimed === 0 &&
|
|
1291
|
+
preflight?.daemonStarted === false &&
|
|
1292
|
+
state?.firstBrokenBoundary === "ansi-namespace-ready" &&
|
|
1293
|
+
exactObjectKeys(state?.failureObservation, [
|
|
1294
|
+
"operation",
|
|
1295
|
+
"stage",
|
|
1296
|
+
"outcome",
|
|
1297
|
+
"resourcesCreated",
|
|
1298
|
+
"pathsClaimed",
|
|
1299
|
+
"daemonStarted",
|
|
1300
|
+
]) &&
|
|
1301
|
+
state.failureObservation.operation === preflight.operation &&
|
|
1302
|
+
state.failureObservation.stage === preflight.stage &&
|
|
1303
|
+
state.failureObservation.outcome === preflight.outcome &&
|
|
1304
|
+
state.failureObservation.resourcesCreated === preflight.resourcesCreated &&
|
|
1305
|
+
state.failureObservation.pathsClaimed === preflight.pathsClaimed &&
|
|
1306
|
+
state.failureObservation.daemonStarted === preflight.daemonStarted &&
|
|
1307
|
+
!Object.prototype.hasOwnProperty.call(state ?? {}, "runtimeNamespace") &&
|
|
1308
|
+
!Object.prototype.hasOwnProperty.call(state ?? {}, "session") &&
|
|
1309
|
+
!Object.prototype.hasOwnProperty.call(state ?? {}, "tui") &&
|
|
1310
|
+
!Object.prototype.hasOwnProperty.call(state ?? {}, "daemon") &&
|
|
1311
|
+
state?.daemonLifecycle === "not-started";
|
|
1312
|
+
if (exactNoResourcePreflight) {
|
|
1313
|
+
if (
|
|
1314
|
+
!cleanup ||
|
|
1315
|
+
cleanup.status !== "passed" ||
|
|
1316
|
+
cleanup.cleanupToken !== null ||
|
|
1317
|
+
!Array.isArray(cleanup.failures) ||
|
|
1318
|
+
cleanup.failures.length !== 0 ||
|
|
1319
|
+
!Number.isSafeInteger(attempt) ||
|
|
1320
|
+
attempt < 1 ||
|
|
1321
|
+
attempt > 2 ||
|
|
1322
|
+
!Number.isSafeInteger(state.ownerPid)
|
|
1323
|
+
)
|
|
1324
|
+
throw new Error("ProductRig preflight cleanup receipt source is incomplete");
|
|
1325
|
+
const ownerDead = (() => {
|
|
1326
|
+
try {
|
|
1327
|
+
process.kill(state.ownerPid, 0);
|
|
1328
|
+
return false;
|
|
1329
|
+
} catch (error) {
|
|
1330
|
+
return error?.code === "ESRCH";
|
|
1331
|
+
}
|
|
1332
|
+
})();
|
|
1333
|
+
return validateProductRigCleanupReceipt(
|
|
1334
|
+
{
|
|
1335
|
+
version: 1,
|
|
1336
|
+
scope: "preflight-no-resources",
|
|
1337
|
+
runId: entry.runId,
|
|
1338
|
+
requestId: cleanup.requestId,
|
|
1339
|
+
attempt,
|
|
1340
|
+
passed: true,
|
|
1341
|
+
completedAt: cleanup.completedAt,
|
|
1342
|
+
ownerPid: state.ownerPid,
|
|
1343
|
+
daemon: { status: "not-started" },
|
|
1344
|
+
namespaceDigest: createHash("sha256")
|
|
1345
|
+
.update(`preflight-no-resources\0${entry.runId}`)
|
|
1346
|
+
.digest("hex"),
|
|
1347
|
+
ownerDead,
|
|
1348
|
+
daemonDead: true,
|
|
1349
|
+
resourcesCreated: false,
|
|
1350
|
+
pathsClaimed: 0,
|
|
1351
|
+
failureCount: 0,
|
|
1352
|
+
},
|
|
1353
|
+
entry.runId,
|
|
1354
|
+
);
|
|
1355
|
+
}
|
|
1356
|
+
const ownedPaths = [
|
|
1357
|
+
namespace?.root,
|
|
1358
|
+
namespace?.tmuxSocketPath,
|
|
1359
|
+
namespace?.hostTmuxSocketPath,
|
|
1360
|
+
namespace?.daemonInfoDir,
|
|
1361
|
+
...(state?.ownedTuiRuntimeDirs ?? []),
|
|
1362
|
+
];
|
|
1363
|
+
const hasDaemon = Object.prototype.hasOwnProperty.call(state ?? {}, "daemon");
|
|
1364
|
+
const daemonStarted = hasDaemon && state.daemon !== undefined && state.daemon !== null;
|
|
1365
|
+
if (
|
|
1366
|
+
!entry ||
|
|
1367
|
+
typeof entry.runId !== "string" ||
|
|
1368
|
+
!cleanup ||
|
|
1369
|
+
cleanup.status !== "passed" ||
|
|
1370
|
+
!Array.isArray(cleanup.failures) ||
|
|
1371
|
+
cleanup.failures.length !== 0 ||
|
|
1372
|
+
!Number.isSafeInteger(attempt) ||
|
|
1373
|
+
attempt < 1 ||
|
|
1374
|
+
attempt > 2 ||
|
|
1375
|
+
!Number.isSafeInteger(state?.ownerPid) ||
|
|
1376
|
+
(!daemonStarted && (hasDaemon || state?.daemonLifecycle !== "not-started")) ||
|
|
1377
|
+
(daemonStarted &&
|
|
1378
|
+
(state.daemonLifecycle !== "started" ||
|
|
1379
|
+
!Number.isSafeInteger(state.daemon.pid) ||
|
|
1380
|
+
typeof state.daemon.instanceId !== "string")) ||
|
|
1381
|
+
ownedPaths.some((path) => typeof path !== "string")
|
|
1382
|
+
)
|
|
1383
|
+
throw new Error("ProductRig cleanup receipt source is incomplete");
|
|
1384
|
+
const dead = (pid) => {
|
|
1385
|
+
try {
|
|
1386
|
+
process.kill(pid, 0);
|
|
1387
|
+
return false;
|
|
1388
|
+
} catch (error) {
|
|
1389
|
+
return error?.code === "ESRCH";
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
const ownerDead = dead(state.ownerPid);
|
|
1393
|
+
const daemonDead = daemonStarted ? dead(state.daemon.pid) : true;
|
|
1394
|
+
const pathsAbsent = ownedPaths.every((path) => !existsSync(path));
|
|
1395
|
+
const pathAbsence = {
|
|
1396
|
+
runtimeRoot: !existsSync(ownedPaths[0]),
|
|
1397
|
+
tmuxSocket: !existsSync(ownedPaths[1]),
|
|
1398
|
+
hostTmuxSocket: !existsSync(ownedPaths[2]),
|
|
1399
|
+
daemonInfo: !existsSync(ownedPaths[3]),
|
|
1400
|
+
tuiRuntime: ownedPaths.slice(4).every((path) => !existsSync(path)),
|
|
1401
|
+
};
|
|
1402
|
+
const receipt = {
|
|
1403
|
+
version: 1,
|
|
1404
|
+
runId: entry.runId,
|
|
1405
|
+
requestId: cleanup.requestId,
|
|
1406
|
+
attempt,
|
|
1407
|
+
passed: true,
|
|
1408
|
+
completedAt: cleanup.completedAt,
|
|
1409
|
+
ownerPid: state.ownerPid,
|
|
1410
|
+
daemon: daemonStarted
|
|
1411
|
+
? { status: "started", instanceId: state.daemon.instanceId, pid: state.daemon.pid }
|
|
1412
|
+
: { status: "not-started" },
|
|
1413
|
+
namespaceDigest: createHash("sha256").update(JSON.stringify(ownedPaths)).digest("hex"),
|
|
1414
|
+
ownerDead,
|
|
1415
|
+
daemonDead,
|
|
1416
|
+
pathsAbsent,
|
|
1417
|
+
pathAbsence,
|
|
1418
|
+
failureCount: 0,
|
|
1419
|
+
};
|
|
1420
|
+
return validateProductRigCleanupReceipt(receipt, entry.runId);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
export function validateProductRigCleanupReceipt(receipt, runId) {
|
|
1424
|
+
const daemonValid =
|
|
1425
|
+
(receipt?.daemon?.status === "started" &&
|
|
1426
|
+
typeof receipt.daemon.instanceId === "string" &&
|
|
1427
|
+
receipt.daemon.instanceId.length > 0 &&
|
|
1428
|
+
receipt.daemon.instanceId.length <= 128 &&
|
|
1429
|
+
Number.isSafeInteger(receipt.daemon.pid) &&
|
|
1430
|
+
receipt.daemon.pid > 0) ||
|
|
1431
|
+
(receipt?.daemon?.status === "not-started" &&
|
|
1432
|
+
!Object.prototype.hasOwnProperty.call(receipt.daemon, "instanceId") &&
|
|
1433
|
+
!Object.prototype.hasOwnProperty.call(receipt.daemon, "pid"));
|
|
1434
|
+
const commonValid =
|
|
1435
|
+
receipt?.version === 1 &&
|
|
1436
|
+
receipt.runId === runId &&
|
|
1437
|
+
typeof receipt.requestId === "string" &&
|
|
1438
|
+
/^[a-zA-Z0-9-]{1,128}$/u.test(receipt.requestId) &&
|
|
1439
|
+
(receipt.attempt === 1 || receipt.attempt === 2) &&
|
|
1440
|
+
receipt.passed === true &&
|
|
1441
|
+
typeof receipt.completedAt === "string" &&
|
|
1442
|
+
receipt.completedAt.length <= 64 &&
|
|
1443
|
+
Number.isFinite(Date.parse(receipt.completedAt)) &&
|
|
1444
|
+
Number.isSafeInteger(receipt.ownerPid) &&
|
|
1445
|
+
receipt.ownerPid > 0 &&
|
|
1446
|
+
daemonValid &&
|
|
1447
|
+
/^[0-9a-f]{64}$/u.test(receipt.namespaceDigest ?? "") &&
|
|
1448
|
+
receipt.ownerDead === true &&
|
|
1449
|
+
receipt.daemonDead === true &&
|
|
1450
|
+
receipt.failureCount === 0;
|
|
1451
|
+
const preflightValid =
|
|
1452
|
+
exactObjectKeys(receipt, [
|
|
1453
|
+
"version",
|
|
1454
|
+
"scope",
|
|
1455
|
+
"runId",
|
|
1456
|
+
"requestId",
|
|
1457
|
+
"attempt",
|
|
1458
|
+
"passed",
|
|
1459
|
+
"completedAt",
|
|
1460
|
+
"ownerPid",
|
|
1461
|
+
"daemon",
|
|
1462
|
+
"namespaceDigest",
|
|
1463
|
+
"ownerDead",
|
|
1464
|
+
"daemonDead",
|
|
1465
|
+
"resourcesCreated",
|
|
1466
|
+
"pathsClaimed",
|
|
1467
|
+
"failureCount",
|
|
1468
|
+
]) &&
|
|
1469
|
+
receipt?.scope === "preflight-no-resources" &&
|
|
1470
|
+
exactObjectKeys(receipt.daemon, ["status"]) &&
|
|
1471
|
+
receipt.daemon?.status === "not-started" &&
|
|
1472
|
+
receipt.resourcesCreated === false &&
|
|
1473
|
+
receipt.pathsClaimed === 0 &&
|
|
1474
|
+
!Object.prototype.hasOwnProperty.call(receipt, "pathsAbsent") &&
|
|
1475
|
+
!Object.prototype.hasOwnProperty.call(receipt, "pathAbsence");
|
|
1476
|
+
const ownedNamespaceValid =
|
|
1477
|
+
!Object.prototype.hasOwnProperty.call(receipt ?? {}, "scope") &&
|
|
1478
|
+
receipt?.pathsAbsent === true &&
|
|
1479
|
+
receipt?.pathAbsence?.runtimeRoot === true &&
|
|
1480
|
+
receipt?.pathAbsence?.tmuxSocket === true &&
|
|
1481
|
+
receipt?.pathAbsence?.hostTmuxSocket === true &&
|
|
1482
|
+
receipt?.pathAbsence?.daemonInfo === true &&
|
|
1483
|
+
receipt?.pathAbsence?.tuiRuntime === true &&
|
|
1484
|
+
!Object.prototype.hasOwnProperty.call(receipt ?? {}, "resourcesCreated") &&
|
|
1485
|
+
!Object.prototype.hasOwnProperty.call(receipt ?? {}, "pathsClaimed");
|
|
1486
|
+
const valid = commonValid && (preflightValid || ownedNamespaceValid);
|
|
1487
|
+
if (!valid) throw new Error("ProductRig cleanup receipt is missing, mismatched, or not passed");
|
|
1488
|
+
if (preflightValid)
|
|
1489
|
+
return Object.freeze({
|
|
1490
|
+
version: 1,
|
|
1491
|
+
scope: "preflight-no-resources",
|
|
1492
|
+
runId: receipt.runId,
|
|
1493
|
+
requestId: receipt.requestId,
|
|
1494
|
+
attempt: receipt.attempt,
|
|
1495
|
+
passed: true,
|
|
1496
|
+
completedAt: receipt.completedAt,
|
|
1497
|
+
ownerPid: receipt.ownerPid,
|
|
1498
|
+
daemon: Object.freeze({ status: "not-started" }),
|
|
1499
|
+
namespaceDigest: receipt.namespaceDigest,
|
|
1500
|
+
ownerDead: true,
|
|
1501
|
+
daemonDead: true,
|
|
1502
|
+
resourcesCreated: false,
|
|
1503
|
+
pathsClaimed: 0,
|
|
1504
|
+
failureCount: 0,
|
|
1505
|
+
});
|
|
1506
|
+
return Object.freeze({
|
|
1507
|
+
version: 1,
|
|
1508
|
+
runId: receipt.runId,
|
|
1509
|
+
requestId: receipt.requestId,
|
|
1510
|
+
attempt: receipt.attempt,
|
|
1511
|
+
passed: true,
|
|
1512
|
+
completedAt: receipt.completedAt,
|
|
1513
|
+
ownerPid: receipt.ownerPid,
|
|
1514
|
+
daemon:
|
|
1515
|
+
receipt.daemon.status === "started"
|
|
1516
|
+
? Object.freeze({
|
|
1517
|
+
status: "started",
|
|
1518
|
+
instanceId: receipt.daemon.instanceId,
|
|
1519
|
+
pid: receipt.daemon.pid,
|
|
1520
|
+
})
|
|
1521
|
+
: Object.freeze({ status: "not-started" }),
|
|
1522
|
+
namespaceDigest: receipt.namespaceDigest,
|
|
1523
|
+
ownerDead: true,
|
|
1524
|
+
daemonDead: true,
|
|
1525
|
+
pathsAbsent: true,
|
|
1526
|
+
pathAbsence: Object.freeze({
|
|
1527
|
+
runtimeRoot: true,
|
|
1528
|
+
tmuxSocket: true,
|
|
1529
|
+
hostTmuxSocket: true,
|
|
1530
|
+
daemonInfo: true,
|
|
1531
|
+
tuiRuntime: true,
|
|
1532
|
+
}),
|
|
1533
|
+
failureCount: 0,
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
export function productRigCleanupBarrierFailures(
|
|
1538
|
+
state,
|
|
1539
|
+
requestId,
|
|
1540
|
+
{ processAlive: isAlive, pathExists = existsSync, retainedProcessIdentityStatus = null },
|
|
1541
|
+
) {
|
|
1542
|
+
const failures = [];
|
|
1543
|
+
if (!state || typeof state !== "object") return Object.freeze(["state-missing"]);
|
|
1544
|
+
if (state.cleanup?.requestId !== requestId) failures.push("cleanup-request-not-acknowledged");
|
|
1545
|
+
if (state.cleanup?.status !== "passed") failures.push("cleanup-not-passed");
|
|
1546
|
+
if (!["stopped", "failed"].includes(state.status))
|
|
1547
|
+
failures.push(`state-${state.status ?? "missing"}`);
|
|
1548
|
+
if ((state.cleanup?.cleanupToken ?? null) !== (state.runtimeNamespace?.cleanupToken ?? null))
|
|
1549
|
+
failures.push("cleanup-token-mismatch");
|
|
1550
|
+
for (const failure of state.cleanup?.failures ?? [])
|
|
1551
|
+
failures.push(`subsystem-${failure.subsystem ?? "unknown"}`);
|
|
1552
|
+
if (Number.isInteger(state.ownerPid) && isAlive(state.ownerPid))
|
|
1553
|
+
failures.push("owner-process-live");
|
|
1554
|
+
if (Number.isInteger(state.daemon?.pid) && isAlive(state.daemon.pid))
|
|
1555
|
+
failures.push("daemon-process-live");
|
|
1556
|
+
const terminalHostProcessCount = Math.max(
|
|
1557
|
+
(state.cleanup?.card5?.chromiumTerminalProcessCount ?? 0) +
|
|
1558
|
+
(state.cleanup?.card5?.electronTerminalProcessCount ?? 0),
|
|
1559
|
+
state.cleanup?.processReap?.terminalIdentityCount ?? 0,
|
|
1560
|
+
);
|
|
1561
|
+
if (terminalHostProcessCount > 0) {
|
|
1562
|
+
const status =
|
|
1563
|
+
typeof retainedProcessIdentityStatus === "function"
|
|
1564
|
+
? retainedProcessIdentityStatus()
|
|
1565
|
+
: "invalid";
|
|
1566
|
+
if (status === "invalid") failures.push("owner-child-reap-unverified");
|
|
1567
|
+
else if (status !== "absent") failures.push("owner-child-process-live");
|
|
1568
|
+
}
|
|
1569
|
+
for (const [name, path] of [
|
|
1570
|
+
["runtime-root", state.runtimeNamespace?.root],
|
|
1571
|
+
["tmux-socket", state.runtimeNamespace?.tmuxSocketPath],
|
|
1572
|
+
["host-tmux-socket", state.runtimeNamespace?.hostTmuxSocketPath],
|
|
1573
|
+
["daemon-info", state.runtimeNamespace?.daemonInfoDir],
|
|
1574
|
+
...(state.ownedTuiRuntimeDirs ?? []).map((path) => ["tui-runtime", path]),
|
|
1575
|
+
])
|
|
1576
|
+
if (typeof path === "string" && pathExists(path)) failures.push(`${name}-present`);
|
|
1577
|
+
return Object.freeze(failures);
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
export function assessProductRigRetainedProcessAbsence(identities, rows) {
|
|
1581
|
+
const exactIdentity = (value) =>
|
|
1582
|
+
value !== null &&
|
|
1583
|
+
typeof value === "object" &&
|
|
1584
|
+
!Array.isArray(value) &&
|
|
1585
|
+
Number.isSafeInteger(value.pid) &&
|
|
1586
|
+
value.pid > 0 &&
|
|
1587
|
+
Number.isSafeInteger(value.pgid) &&
|
|
1588
|
+
value.pgid > 0 &&
|
|
1589
|
+
typeof value.startToken === "string" &&
|
|
1590
|
+
value.startToken.length > 0 &&
|
|
1591
|
+
value.startToken.length <= 64;
|
|
1592
|
+
if (
|
|
1593
|
+
!Array.isArray(identities) ||
|
|
1594
|
+
identities.length < 1 ||
|
|
1595
|
+
identities.length > 65 ||
|
|
1596
|
+
!identities.every(exactIdentity) ||
|
|
1597
|
+
new Set(identities.map(({ pid }) => pid)).size !== identities.length ||
|
|
1598
|
+
!Array.isArray(rows) ||
|
|
1599
|
+
!rows.every(exactIdentity)
|
|
1600
|
+
)
|
|
1601
|
+
return "invalid";
|
|
1602
|
+
return identities.some((identity) =>
|
|
1603
|
+
rows.some(
|
|
1604
|
+
(row) =>
|
|
1605
|
+
row.pid === identity.pid &&
|
|
1606
|
+
row.pgid === identity.pgid &&
|
|
1607
|
+
row.startToken === identity.startToken,
|
|
1608
|
+
),
|
|
1609
|
+
)
|
|
1610
|
+
? "live"
|
|
1611
|
+
: "absent";
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
export function isProductRigPendingReapAck(state, request, journeyId) {
|
|
1615
|
+
return (
|
|
1616
|
+
request?.requestId === state?.cleanup?.requestId &&
|
|
1617
|
+
request?.ownerPid === state?.ownerPid &&
|
|
1618
|
+
request?.ownerToken === state?.ownerToken &&
|
|
1619
|
+
request?.cleanupToken === state?.runtimeNamespace?.cleanupToken &&
|
|
1620
|
+
state?.cleanup?.status === "passed" &&
|
|
1621
|
+
state?.cleanup?.processReap?.version === 1 &&
|
|
1622
|
+
["cross-client-handoff", "daemon-restart"].includes(journeyId)
|
|
1623
|
+
);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
export function retireProductRigCleanupProofFiles({ removeAck, removeLedger }) {
|
|
1627
|
+
if (typeof removeAck !== "function" || typeof removeLedger !== "function")
|
|
1628
|
+
throw new TypeError("ProductRig cleanup proof retirement contract was invalid");
|
|
1629
|
+
removeAck();
|
|
1630
|
+
removeLedger();
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
const exactLegacyProcessRow = (row) =>
|
|
1634
|
+
row !== null &&
|
|
1635
|
+
typeof row === "object" &&
|
|
1636
|
+
!Array.isArray(row) &&
|
|
1637
|
+
Number.isSafeInteger(row.pid) &&
|
|
1638
|
+
row.pid > 0 &&
|
|
1639
|
+
Number.isSafeInteger(row.ppid) &&
|
|
1640
|
+
row.ppid >= 0 &&
|
|
1641
|
+
Number.isSafeInteger(row.pgid) &&
|
|
1642
|
+
row.pgid > 0 &&
|
|
1643
|
+
typeof row.state === "string" &&
|
|
1644
|
+
row.state.length > 0 &&
|
|
1645
|
+
row.state.length <= 16 &&
|
|
1646
|
+
typeof row.startToken === "string" &&
|
|
1647
|
+
row.startToken.length > 0 &&
|
|
1648
|
+
row.startToken.length <= 64 &&
|
|
1649
|
+
typeof row.command === "string" &&
|
|
1650
|
+
row.command.length > 0 &&
|
|
1651
|
+
row.command.length <= 4096;
|
|
1652
|
+
|
|
1653
|
+
const exactLegacyProcessRoutingRow = (row) =>
|
|
1654
|
+
row !== null &&
|
|
1655
|
+
typeof row === "object" &&
|
|
1656
|
+
!Array.isArray(row) &&
|
|
1657
|
+
Number.isSafeInteger(row.pid) &&
|
|
1658
|
+
row.pid > 0 &&
|
|
1659
|
+
Number.isSafeInteger(row.ppid) &&
|
|
1660
|
+
row.ppid >= 0 &&
|
|
1661
|
+
Number.isSafeInteger(row.pgid) &&
|
|
1662
|
+
row.pgid > 0 &&
|
|
1663
|
+
typeof row.state === "string" &&
|
|
1664
|
+
typeof row.startToken === "string" &&
|
|
1665
|
+
typeof row.command === "string";
|
|
1666
|
+
|
|
1667
|
+
const sameLegacyProcessIdentity = (left, right) =>
|
|
1668
|
+
left.pid === right.pid &&
|
|
1669
|
+
left.ppid === right.ppid &&
|
|
1670
|
+
left.pgid === right.pgid &&
|
|
1671
|
+
left.startToken === right.startToken &&
|
|
1672
|
+
left.command === right.command &&
|
|
1673
|
+
left.ownership === right.ownership;
|
|
1674
|
+
|
|
1675
|
+
export function assessLegacyProductRigOwnerRetryCompatibility(
|
|
1676
|
+
state,
|
|
1677
|
+
authorization,
|
|
1678
|
+
firstRows,
|
|
1679
|
+
secondRows,
|
|
1680
|
+
{ processAlive, pathExists },
|
|
1681
|
+
) {
|
|
1682
|
+
const card5 = state?.cleanup?.card5;
|
|
1683
|
+
const exactRows = (rows) =>
|
|
1684
|
+
Array.isArray(rows) &&
|
|
1685
|
+
rows.length <= 4096 &&
|
|
1686
|
+
rows.every(exactLegacyProcessRoutingRow) &&
|
|
1687
|
+
new Set(rows.map(({ pid }) => pid)).size === rows.length;
|
|
1688
|
+
const selectOwner = (rows) => {
|
|
1689
|
+
const owner = rows.filter(({ pid }) => pid === state?.ownerPid);
|
|
1690
|
+
if (owner.length !== 1 || !exactLegacyProcessRow(owner[0])) return null;
|
|
1691
|
+
if (
|
|
1692
|
+
rows.some(
|
|
1693
|
+
(row) =>
|
|
1694
|
+
row.pid !== owner[0].pid &&
|
|
1695
|
+
(row.ppid === owner[0].pid ||
|
|
1696
|
+
(row.pgid === owner[0].pgid && row.command.includes(authorization.runtimeRoot))),
|
|
1697
|
+
)
|
|
1698
|
+
)
|
|
1699
|
+
return null;
|
|
1700
|
+
return { ...owner[0], ownership: "owner" };
|
|
1701
|
+
};
|
|
1702
|
+
const firstOwner = exactRows(firstRows) ? selectOwner(firstRows) : null;
|
|
1703
|
+
const secondOwner = exactRows(secondRows) ? selectOwner(secondRows) : null;
|
|
1704
|
+
const paths = [
|
|
1705
|
+
state?.runtimeNamespace?.root,
|
|
1706
|
+
state?.runtimeNamespace?.tmuxSocketPath,
|
|
1707
|
+
state?.runtimeNamespace?.hostTmuxSocketPath,
|
|
1708
|
+
state?.runtimeNamespace?.daemonInfoDir,
|
|
1709
|
+
...(Array.isArray(state?.ownedTuiRuntimeDirs) ? state.ownedTuiRuntimeDirs : []),
|
|
1710
|
+
];
|
|
1711
|
+
const exact =
|
|
1712
|
+
state?.status === "cleanup-failed" &&
|
|
1713
|
+
/^legacy-[0-9a-f]{24}$/u.test(authorization?.requestId ?? "") &&
|
|
1714
|
+
/^[0-9a-f]{48}$/u.test(authorization?.ownerToken ?? "") &&
|
|
1715
|
+
/^\/tmp\/tmi-e2e-[A-Za-z0-9._-]{1,160}$/u.test(authorization?.runtimeRoot ?? "") &&
|
|
1716
|
+
state?.diagnosticAttempt?.runId === authorization?.runId &&
|
|
1717
|
+
state?.ownerToken === authorization?.ownerToken &&
|
|
1718
|
+
state?.runtimeNamespace?.root === authorization?.runtimeRoot &&
|
|
1719
|
+
state?.diagnosticAttempt?.sourceProvenance?.commit === authorization?.commit &&
|
|
1720
|
+
state?.diagnosticAttempt?.sourceProvenance?.tree === authorization?.tree &&
|
|
1721
|
+
state?.diagnosticAttempt?.sourceProvenance?.manifestDigest === authorization?.manifestDigest &&
|
|
1722
|
+
state?.cleanup?.status === "failed" &&
|
|
1723
|
+
state.cleanup.failures?.length === 1 &&
|
|
1724
|
+
state.cleanup.failures[0]?.subsystem === "card5-cleanup-ledger" &&
|
|
1725
|
+
card5?.passed === false &&
|
|
1726
|
+
card5?.chromiumProcessCount === 0 &&
|
|
1727
|
+
card5?.chromiumDescendantCount === 0 &&
|
|
1728
|
+
(card5?.chromiumTerminalProcessCount ?? 0) === 0 &&
|
|
1729
|
+
card5?.electronProcessCount === 1 &&
|
|
1730
|
+
card5?.electronDescendantCount === 0 &&
|
|
1731
|
+
(card5?.electronTerminalProcessCount ?? 0) === 0 &&
|
|
1732
|
+
card5?.owners?.electron?.owned === true &&
|
|
1733
|
+
card5?.owners?.electron?.retired === false &&
|
|
1734
|
+
card5?.owners?.chromium?.retired === true &&
|
|
1735
|
+
card5?.owners?.opentui?.retired === true &&
|
|
1736
|
+
card5?.owners?.daemon?.retired === true &&
|
|
1737
|
+
card5?.owners?.namespace?.retired === true &&
|
|
1738
|
+
[
|
|
1739
|
+
"chromiumPageCount",
|
|
1740
|
+
"chromiumContextCount",
|
|
1741
|
+
"chromiumListenerCount",
|
|
1742
|
+
"electronWindowCount",
|
|
1743
|
+
"electronListenerCount",
|
|
1744
|
+
"electronOpenHandleCount",
|
|
1745
|
+
"socketResidueCount",
|
|
1746
|
+
"nativeObserverProcessCount",
|
|
1747
|
+
"pathResidueCount",
|
|
1748
|
+
].every((key) => card5?.[key] === 0) &&
|
|
1749
|
+
firstOwner !== null &&
|
|
1750
|
+
secondOwner !== null &&
|
|
1751
|
+
sameLegacyProcessIdentity(firstOwner, secondOwner) &&
|
|
1752
|
+
typeof processAlive === "function" &&
|
|
1753
|
+
!processAlive(state?.daemon?.pid) &&
|
|
1754
|
+
typeof pathExists === "function" &&
|
|
1755
|
+
paths.every((path) => typeof path !== "string" || !pathExists(path));
|
|
1756
|
+
return Object.freeze({
|
|
1757
|
+
passed: exact === true,
|
|
1758
|
+
reason: exact ? null : "legacy-owner-retry-invalid",
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
export function createLegacyProductRigOwnerRetryIntent(state, authorization, ownerIdentity) {
|
|
1763
|
+
if (
|
|
1764
|
+
!/^legacy-[0-9a-f]{24}$/u.test(authorization?.requestId ?? "") ||
|
|
1765
|
+
!/^[0-9a-f]{48}$/u.test(authorization?.ownerToken ?? "") ||
|
|
1766
|
+
state?.ownerToken !== authorization.ownerToken ||
|
|
1767
|
+
!exactLegacyProcessRow(ownerIdentity) ||
|
|
1768
|
+
ownerIdentity.pid !== state.ownerPid
|
|
1769
|
+
)
|
|
1770
|
+
return null;
|
|
1771
|
+
const payload = {
|
|
1772
|
+
version: 1,
|
|
1773
|
+
mode: "legacy-owner-retry-v1",
|
|
1774
|
+
requestId: authorization.requestId,
|
|
1775
|
+
runId: authorization.runId,
|
|
1776
|
+
ownerPid: state.ownerPid,
|
|
1777
|
+
ownerIdentity: {
|
|
1778
|
+
pid: ownerIdentity.pid,
|
|
1779
|
+
ppid: ownerIdentity.ppid,
|
|
1780
|
+
pgid: ownerIdentity.pgid,
|
|
1781
|
+
startToken: ownerIdentity.startToken,
|
|
1782
|
+
command: ownerIdentity.command,
|
|
1783
|
+
},
|
|
1784
|
+
cleanupToken: state.runtimeNamespace?.cleanupToken,
|
|
1785
|
+
provenance: {
|
|
1786
|
+
commit: authorization.commit,
|
|
1787
|
+
tree: authorization.tree,
|
|
1788
|
+
manifestDigest: authorization.manifestDigest,
|
|
1789
|
+
},
|
|
1790
|
+
runtimeRoot: authorization.runtimeRoot,
|
|
1791
|
+
initialCleanupHmac: createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
1792
|
+
.update(JSON.stringify(state.cleanup))
|
|
1793
|
+
.digest("hex"),
|
|
1794
|
+
};
|
|
1795
|
+
return Object.freeze({
|
|
1796
|
+
...payload,
|
|
1797
|
+
intentHmac: createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
1798
|
+
.update(JSON.stringify(payload))
|
|
1799
|
+
.digest("hex"),
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
export function acquireLegacyProductRigOwnerRetryIntent(authorization, intent) {
|
|
1804
|
+
if (
|
|
1805
|
+
intent?.version !== 1 ||
|
|
1806
|
+
intent?.mode !== "legacy-owner-retry-v1" ||
|
|
1807
|
+
intent.requestId !== authorization?.requestId ||
|
|
1808
|
+
intent.runId !== authorization?.runId ||
|
|
1809
|
+
intent.runtimeRoot !== authorization?.runtimeRoot ||
|
|
1810
|
+
intent.provenance?.commit !== authorization?.commit ||
|
|
1811
|
+
intent.provenance?.tree !== authorization?.tree ||
|
|
1812
|
+
intent.provenance?.manifestDigest !== authorization?.manifestDigest ||
|
|
1813
|
+
!Number.isSafeInteger(intent.ownerPid) ||
|
|
1814
|
+
intent.ownerPid < 1 ||
|
|
1815
|
+
!exactLegacyProcessRow({ ...intent.ownerIdentity, state: "S" }) ||
|
|
1816
|
+
intent.ownerIdentity.pid !== intent.ownerPid ||
|
|
1817
|
+
typeof intent.cleanupToken !== "string" ||
|
|
1818
|
+
!/^[0-9a-f]{64}$/u.test(intent.initialCleanupHmac ?? "") ||
|
|
1819
|
+
!/^[0-9a-f]{64}$/u.test(intent.intentHmac ?? "") ||
|
|
1820
|
+
!/^[0-9a-f]{48}$/u.test(authorization?.ownerToken ?? "")
|
|
1821
|
+
)
|
|
1822
|
+
return null;
|
|
1823
|
+
const { intentHmac, ...payload } = intent;
|
|
1824
|
+
const expected = createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
1825
|
+
.update(JSON.stringify(payload))
|
|
1826
|
+
.digest("hex");
|
|
1827
|
+
return expected === intentHmac ? Object.freeze({ ...intent }) : null;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
export function legacyProductRigOwnerRetryIntentMatchesOwnerRows(intent, rows) {
|
|
1831
|
+
if (!Array.isArray(rows) || !intent?.ownerIdentity) return false;
|
|
1832
|
+
const matches = rows.filter(({ pid }) => pid === intent.ownerPid);
|
|
1833
|
+
if (matches.length !== 1 || !exactLegacyProcessRow(matches[0])) return false;
|
|
1834
|
+
const identity = {
|
|
1835
|
+
pid: matches[0].pid,
|
|
1836
|
+
ppid: matches[0].ppid,
|
|
1837
|
+
pgid: matches[0].pgid,
|
|
1838
|
+
startToken: matches[0].startToken,
|
|
1839
|
+
command: matches[0].command,
|
|
1840
|
+
};
|
|
1841
|
+
return JSON.stringify(identity) === JSON.stringify(intent.ownerIdentity);
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
export function legacyProductRigOwnerRetryIntentMatchesState(state, authorization, intent) {
|
|
1845
|
+
const acquired = acquireLegacyProductRigOwnerRetryIntent(authorization, intent);
|
|
1846
|
+
if (
|
|
1847
|
+
acquired === null ||
|
|
1848
|
+
state?.status !== "cleanup-failed" ||
|
|
1849
|
+
state?.ownerPid !== acquired.ownerPid ||
|
|
1850
|
+
state?.ownerToken !== authorization?.ownerToken ||
|
|
1851
|
+
state?.diagnosticAttempt?.runId !== acquired.runId ||
|
|
1852
|
+
state?.runtimeNamespace?.root !== acquired.runtimeRoot ||
|
|
1853
|
+
state?.runtimeNamespace?.cleanupToken !== acquired.cleanupToken ||
|
|
1854
|
+
state?.diagnosticAttempt?.sourceProvenance?.commit !== acquired.provenance.commit ||
|
|
1855
|
+
state?.diagnosticAttempt?.sourceProvenance?.tree !== acquired.provenance.tree ||
|
|
1856
|
+
state?.diagnosticAttempt?.sourceProvenance?.manifestDigest !==
|
|
1857
|
+
acquired.provenance.manifestDigest
|
|
1858
|
+
)
|
|
1859
|
+
return false;
|
|
1860
|
+
const cleanupHmac = createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
1861
|
+
.update(JSON.stringify(state.cleanup))
|
|
1862
|
+
.digest("hex");
|
|
1863
|
+
return cleanupHmac === acquired.initialCleanupHmac;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
export function createLegacyProductRigOwnerRetryShutdownRequest(state, authorization, intent) {
|
|
1867
|
+
if (!legacyProductRigOwnerRetryIntentMatchesState(state, authorization, intent)) return null;
|
|
1868
|
+
return Object.freeze({
|
|
1869
|
+
version: 1,
|
|
1870
|
+
requestId: authorization.requestId,
|
|
1871
|
+
attempt: 1,
|
|
1872
|
+
ownerPid: state.ownerPid,
|
|
1873
|
+
ownerToken: state.ownerToken,
|
|
1874
|
+
cleanupToken: state.runtimeNamespace.cleanupToken,
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
export function createLegacyProductRigOwnerRetryReceipt(intent, authorization) {
|
|
1879
|
+
const acquired = acquireLegacyProductRigOwnerRetryIntent(authorization, intent);
|
|
1880
|
+
if (acquired === null) return null;
|
|
1881
|
+
const payload = {
|
|
1882
|
+
version: 1,
|
|
1883
|
+
mode: "legacy-owner-retry-v1",
|
|
1884
|
+
requestId: acquired.requestId,
|
|
1885
|
+
runId: acquired.runId,
|
|
1886
|
+
ownerPid: acquired.ownerPid,
|
|
1887
|
+
provenance: acquired.provenance,
|
|
1888
|
+
runtimeRoot: acquired.runtimeRoot,
|
|
1889
|
+
intentHmac: acquired.intentHmac,
|
|
1890
|
+
status: "absent",
|
|
1891
|
+
};
|
|
1892
|
+
return Object.freeze({
|
|
1893
|
+
...payload,
|
|
1894
|
+
receiptHmac: createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
1895
|
+
.update(JSON.stringify(payload))
|
|
1896
|
+
.digest("hex"),
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
export function acquireLegacyProductRigOwnerRetryReceipt(authorization, receipt, intent = null) {
|
|
1901
|
+
if (
|
|
1902
|
+
receipt?.version !== 1 ||
|
|
1903
|
+
receipt?.mode !== "legacy-owner-retry-v1" ||
|
|
1904
|
+
receipt.requestId !== authorization?.requestId ||
|
|
1905
|
+
receipt.runId !== authorization?.runId ||
|
|
1906
|
+
receipt.runtimeRoot !== authorization?.runtimeRoot ||
|
|
1907
|
+
receipt.provenance?.commit !== authorization?.commit ||
|
|
1908
|
+
receipt.provenance?.tree !== authorization?.tree ||
|
|
1909
|
+
receipt.provenance?.manifestDigest !== authorization?.manifestDigest ||
|
|
1910
|
+
!Number.isSafeInteger(receipt.ownerPid) ||
|
|
1911
|
+
receipt.ownerPid < 1 ||
|
|
1912
|
+
!/^[0-9a-f]{64}$/u.test(receipt.intentHmac ?? "") ||
|
|
1913
|
+
receipt.status !== "absent" ||
|
|
1914
|
+
!/^[0-9a-f]{64}$/u.test(receipt.receiptHmac ?? "") ||
|
|
1915
|
+
!/^[0-9a-f]{48}$/u.test(authorization?.ownerToken ?? "")
|
|
1916
|
+
)
|
|
1917
|
+
return null;
|
|
1918
|
+
if (intent !== null) {
|
|
1919
|
+
const acquiredIntent = acquireLegacyProductRigOwnerRetryIntent(authorization, intent);
|
|
1920
|
+
if (acquiredIntent === null || acquiredIntent.intentHmac !== receipt.intentHmac) return null;
|
|
1921
|
+
}
|
|
1922
|
+
const { receiptHmac, ...payload } = receipt;
|
|
1923
|
+
const expected = createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
1924
|
+
.update(JSON.stringify(payload))
|
|
1925
|
+
.digest("hex");
|
|
1926
|
+
return expected === receiptHmac ? Object.freeze({ ...receipt }) : null;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
export function assessLegacyProductRigOwnerRetryCompletion(
|
|
1930
|
+
initialState,
|
|
1931
|
+
finalState,
|
|
1932
|
+
requestId,
|
|
1933
|
+
{ processAlive, pathExists, processRows },
|
|
1934
|
+
) {
|
|
1935
|
+
const card5 = finalState?.cleanup?.card5;
|
|
1936
|
+
const owners = card5?.owners;
|
|
1937
|
+
const paths = [
|
|
1938
|
+
finalState?.runtimeNamespace?.root,
|
|
1939
|
+
finalState?.runtimeNamespace?.tmuxSocketPath,
|
|
1940
|
+
finalState?.runtimeNamespace?.hostTmuxSocketPath,
|
|
1941
|
+
finalState?.runtimeNamespace?.daemonInfoDir,
|
|
1942
|
+
...(Array.isArray(finalState?.ownedTuiRuntimeDirs) ? finalState.ownedTuiRuntimeDirs : []),
|
|
1943
|
+
];
|
|
1944
|
+
const requiredZeroAxes = [
|
|
1945
|
+
"chromiumProcessCount",
|
|
1946
|
+
"chromiumDescendantCount",
|
|
1947
|
+
"chromiumPageCount",
|
|
1948
|
+
"chromiumContextCount",
|
|
1949
|
+
"chromiumListenerCount",
|
|
1950
|
+
"electronProcessCount",
|
|
1951
|
+
"electronDescendantCount",
|
|
1952
|
+
"electronWindowCount",
|
|
1953
|
+
"electronListenerCount",
|
|
1954
|
+
"electronOpenHandleCount",
|
|
1955
|
+
"socketResidueCount",
|
|
1956
|
+
"nativeObserverProcessCount",
|
|
1957
|
+
"pathResidueCount",
|
|
1958
|
+
];
|
|
1959
|
+
const exact =
|
|
1960
|
+
typeof requestId === "string" &&
|
|
1961
|
+
requestId.length > 0 &&
|
|
1962
|
+
finalState?.ownerPid === initialState?.ownerPid &&
|
|
1963
|
+
finalState?.ownerToken === initialState?.ownerToken &&
|
|
1964
|
+
finalState?.runtimeNamespace?.root === initialState?.runtimeNamespace?.root &&
|
|
1965
|
+
finalState?.runtimeNamespace?.cleanupToken === initialState?.runtimeNamespace?.cleanupToken &&
|
|
1966
|
+
finalState?.cleanup?.requestId === requestId &&
|
|
1967
|
+
finalState.cleanup.cleanupToken === initialState.runtimeNamespace.cleanupToken &&
|
|
1968
|
+
finalState.cleanup.status === "passed" &&
|
|
1969
|
+
Array.isArray(finalState.cleanup.failures) &&
|
|
1970
|
+
finalState.cleanup.failures.length === 0 &&
|
|
1971
|
+
["failed", "stopped"].includes(finalState.status) &&
|
|
1972
|
+
card5?.passed === true &&
|
|
1973
|
+
requiredZeroAxes.every((key) => card5?.[key] === 0) &&
|
|
1974
|
+
["chromiumTerminalProcessCount", "electronTerminalProcessCount"].every(
|
|
1975
|
+
(key) => card5?.[key] === undefined || card5[key] === 0,
|
|
1976
|
+
) &&
|
|
1977
|
+
owners &&
|
|
1978
|
+
["chromium", "electron", "opentui", "daemon", "namespace"].every(
|
|
1979
|
+
(name) => owners[name]?.retired === true,
|
|
1980
|
+
) &&
|
|
1981
|
+
typeof processAlive === "function" &&
|
|
1982
|
+
!processAlive(finalState.ownerPid) &&
|
|
1983
|
+
!processAlive(finalState.daemon?.pid) &&
|
|
1984
|
+
Array.isArray(processRows) &&
|
|
1985
|
+
processRows.length <= 4096 &&
|
|
1986
|
+
processRows.every(exactLegacyProcessRoutingRow) &&
|
|
1987
|
+
new Set(processRows.map(({ pid }) => pid)).size === processRows.length &&
|
|
1988
|
+
!processRows.some(
|
|
1989
|
+
(row) =>
|
|
1990
|
+
row.pid === finalState.ownerPid ||
|
|
1991
|
+
row.ppid === finalState.ownerPid ||
|
|
1992
|
+
row.pgid === finalState.ownerPid ||
|
|
1993
|
+
row.command === "(Electron)" ||
|
|
1994
|
+
row.command.includes(finalState.runtimeNamespace.root),
|
|
1995
|
+
) &&
|
|
1996
|
+
typeof pathExists === "function" &&
|
|
1997
|
+
paths.every((path) => typeof path !== "string" || !pathExists(path));
|
|
1998
|
+
return Object.freeze({
|
|
1999
|
+
passed: exact === true,
|
|
2000
|
+
reason: exact ? null : "legacy-owner-retry-incomplete",
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
export function finalizeLegacyProductRigOwnerRetry(
|
|
2005
|
+
state,
|
|
2006
|
+
authorization,
|
|
2007
|
+
intent,
|
|
2008
|
+
existingReceipt,
|
|
2009
|
+
{ processAlive, pathExists, processRows, writeReceipt, writeState, removeAck, removeIntent },
|
|
2010
|
+
) {
|
|
2011
|
+
const receipt = existingReceipt
|
|
2012
|
+
? acquireLegacyProductRigOwnerRetryReceipt(authorization, existingReceipt, intent)
|
|
2013
|
+
: intent
|
|
2014
|
+
? createLegacyProductRigOwnerRetryReceipt(intent, authorization)
|
|
2015
|
+
: null;
|
|
2016
|
+
if (receipt === null)
|
|
2017
|
+
return Object.freeze({ passed: false, reason: "legacy-owner-retry-receipt-invalid" });
|
|
2018
|
+
const completion = assessLegacyProductRigOwnerRetryCompletion(
|
|
2019
|
+
{
|
|
2020
|
+
ownerPid: receipt.ownerPid,
|
|
2021
|
+
ownerToken: authorization?.ownerToken,
|
|
2022
|
+
runtimeNamespace: {
|
|
2023
|
+
root: receipt.runtimeRoot,
|
|
2024
|
+
cleanupToken: state?.runtimeNamespace?.cleanupToken,
|
|
2025
|
+
},
|
|
2026
|
+
},
|
|
2027
|
+
state,
|
|
2028
|
+
receipt.requestId,
|
|
2029
|
+
{ processAlive, pathExists, processRows },
|
|
2030
|
+
);
|
|
2031
|
+
if (!completion.passed) return completion;
|
|
2032
|
+
if (typeof writeReceipt !== "function" || typeof writeState !== "function")
|
|
2033
|
+
return Object.freeze({ passed: false, reason: "legacy-owner-retry-writer-invalid" });
|
|
2034
|
+
if (!existingReceipt) writeReceipt(receipt);
|
|
2035
|
+
const completed = Object.freeze({
|
|
2036
|
+
...state,
|
|
2037
|
+
cleanup: {
|
|
2038
|
+
...state.cleanup,
|
|
2039
|
+
legacyOwnerRetry: {
|
|
2040
|
+
version: 1,
|
|
2041
|
+
requestId: receipt.requestId,
|
|
2042
|
+
intentHmac: receipt.intentHmac,
|
|
2043
|
+
receiptHmac: receipt.receiptHmac,
|
|
2044
|
+
status: "absent",
|
|
2045
|
+
},
|
|
2046
|
+
},
|
|
2047
|
+
});
|
|
2048
|
+
writeState(completed);
|
|
2049
|
+
retireProductRigCleanupProofFiles({ removeAck, removeLedger: removeIntent });
|
|
2050
|
+
return Object.freeze({ passed: true, reason: null, state: completed, receipt });
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
export async function captureLegacyProductRigCleanupLedger(
|
|
2054
|
+
state,
|
|
2055
|
+
authorization,
|
|
2056
|
+
{ readProcessRows, yieldTurn = () => Promise.resolve() },
|
|
2057
|
+
) {
|
|
2058
|
+
const provenance = state?.diagnosticAttempt?.sourceProvenance;
|
|
2059
|
+
if (
|
|
2060
|
+
state?.status !== "cleanup-failed" ||
|
|
2061
|
+
state?.diagnosticAttempt?.runId !== authorization?.runId ||
|
|
2062
|
+
state?.ownerToken !== authorization?.ownerToken ||
|
|
2063
|
+
state?.runtimeNamespace?.root !== authorization?.runtimeRoot ||
|
|
2064
|
+
provenance?.commit !== authorization?.commit ||
|
|
2065
|
+
provenance?.tree !== authorization?.tree ||
|
|
2066
|
+
provenance?.manifestDigest !== authorization?.manifestDigest ||
|
|
2067
|
+
!/^\/tmp\/tmi-e2e-[A-Za-z0-9._-]{1,160}$/u.test(authorization?.runtimeRoot ?? "") ||
|
|
2068
|
+
!/^legacy-[0-9a-f]{24}$/u.test(authorization?.requestId ?? "") ||
|
|
2069
|
+
!/^[0-9a-f]{48}$/u.test(authorization?.ownerToken ?? "") ||
|
|
2070
|
+
typeof readProcessRows !== "function"
|
|
2071
|
+
)
|
|
2072
|
+
return null;
|
|
2073
|
+
const select = (rows) => {
|
|
2074
|
+
if (
|
|
2075
|
+
!Array.isArray(rows) ||
|
|
2076
|
+
rows.length > 4096 ||
|
|
2077
|
+
!rows.every(exactLegacyProcessRoutingRow) ||
|
|
2078
|
+
new Set(rows.map(({ pid }) => pid)).size !== rows.length
|
|
2079
|
+
)
|
|
2080
|
+
return null;
|
|
2081
|
+
const owner = rows.filter(({ pid }) => pid === state.ownerPid);
|
|
2082
|
+
if (owner.length !== 1 || !exactLegacyProcessRow(owner[0])) return null;
|
|
2083
|
+
const selected = new Map([[owner[0].pid, { ...owner[0], ownership: "owner" }]]);
|
|
2084
|
+
let changed = true;
|
|
2085
|
+
while (changed) {
|
|
2086
|
+
changed = false;
|
|
2087
|
+
for (const row of rows) {
|
|
2088
|
+
if (!selected.has(row.pid) && selected.has(row.ppid)) {
|
|
2089
|
+
if (!exactLegacyProcessRow(row)) return null;
|
|
2090
|
+
selected.set(row.pid, { ...row, ownership: "descendant" });
|
|
2091
|
+
changed = true;
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
for (const row of rows)
|
|
2096
|
+
if (
|
|
2097
|
+
!selected.has(row.pid) &&
|
|
2098
|
+
row.pgid === owner[0].pgid &&
|
|
2099
|
+
row.command.includes(authorization.runtimeRoot)
|
|
2100
|
+
) {
|
|
2101
|
+
if (!exactLegacyProcessRow(row)) return null;
|
|
2102
|
+
selected.set(row.pid, { ...row, ownership: "scoped-pgid" });
|
|
2103
|
+
}
|
|
2104
|
+
const identities = [...selected.values()].sort((a, b) => a.pid - b.pid);
|
|
2105
|
+
if (
|
|
2106
|
+
identities.length > 65 ||
|
|
2107
|
+
new Set(identities.map(({ pid }) => pid)).size !== identities.length
|
|
2108
|
+
)
|
|
2109
|
+
return null;
|
|
2110
|
+
return identities;
|
|
2111
|
+
};
|
|
2112
|
+
const first = select(readProcessRows());
|
|
2113
|
+
if (!first) return null;
|
|
2114
|
+
const expectedHostCount = [
|
|
2115
|
+
"chromiumProcessCount",
|
|
2116
|
+
"chromiumDescendantCount",
|
|
2117
|
+
"chromiumTerminalProcessCount",
|
|
2118
|
+
"electronProcessCount",
|
|
2119
|
+
"electronDescendantCount",
|
|
2120
|
+
"electronTerminalProcessCount",
|
|
2121
|
+
].reduce((sum, key) => sum + (state.cleanup?.card5?.[key] ?? 0), 0);
|
|
2122
|
+
if (first.length < 1 + expectedHostCount) return null;
|
|
2123
|
+
await yieldTurn();
|
|
2124
|
+
const second = select(readProcessRows());
|
|
2125
|
+
if (
|
|
2126
|
+
!second ||
|
|
2127
|
+
second.length > first.length ||
|
|
2128
|
+
!second.every((identity) => {
|
|
2129
|
+
const prior = first.find(({ pid }) => pid === identity.pid);
|
|
2130
|
+
return prior && sameLegacyProcessIdentity(prior, identity);
|
|
2131
|
+
}) ||
|
|
2132
|
+
!second.some(({ ownership }) => ownership === "owner")
|
|
2133
|
+
)
|
|
2134
|
+
return null;
|
|
2135
|
+
const identityHmac = createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
2136
|
+
.update(JSON.stringify(first))
|
|
2137
|
+
.digest("hex");
|
|
2138
|
+
return Object.freeze({
|
|
2139
|
+
version: 1,
|
|
2140
|
+
mode: "legacy-cleanup-v1",
|
|
2141
|
+
requestId: authorization.requestId,
|
|
2142
|
+
runId: authorization.runId,
|
|
2143
|
+
ownerPid: state.ownerPid,
|
|
2144
|
+
cleanupToken: state.runtimeNamespace.cleanupToken,
|
|
2145
|
+
provenance: Object.freeze({ ...provenance }),
|
|
2146
|
+
runtimeRoot: authorization.runtimeRoot,
|
|
2147
|
+
identities: Object.freeze(first.map((identity) => Object.freeze(identity))),
|
|
2148
|
+
identityHmac,
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
export function acquireLegacyProductRigCleanupLedger(state, authorization, ledger) {
|
|
2153
|
+
const provenance = state?.diagnosticAttempt?.sourceProvenance;
|
|
2154
|
+
const cleanupFailed =
|
|
2155
|
+
["cleanup-failed", "failed"].includes(state?.status) && state?.cleanup?.status === "failed";
|
|
2156
|
+
const cleanupCompleted =
|
|
2157
|
+
state?.status === "failed" &&
|
|
2158
|
+
state?.cleanup?.status === "passed" &&
|
|
2159
|
+
state?.cleanup?.card5?.passed === true &&
|
|
2160
|
+
Array.isArray(state?.cleanup?.failures) &&
|
|
2161
|
+
state.cleanup.failures.length === 0 &&
|
|
2162
|
+
state?.cleanup?.processReap?.version === 1 &&
|
|
2163
|
+
state.cleanup.processReap.identityCount === ledger?.identities?.length &&
|
|
2164
|
+
state.cleanup.processReap.terminalIdentityCount === ledger?.identities?.length - 1 &&
|
|
2165
|
+
state.cleanup.processReap.identityHmac === ledger?.identityHmac;
|
|
2166
|
+
if (
|
|
2167
|
+
(!cleanupFailed && !cleanupCompleted) ||
|
|
2168
|
+
state?.diagnosticAttempt?.runId !== authorization?.runId ||
|
|
2169
|
+
state?.ownerToken !== authorization?.ownerToken ||
|
|
2170
|
+
state?.runtimeNamespace?.root !== authorization?.runtimeRoot ||
|
|
2171
|
+
ledger?.version !== 1 ||
|
|
2172
|
+
ledger?.mode !== "legacy-cleanup-v1" ||
|
|
2173
|
+
ledger.requestId !== authorization?.requestId ||
|
|
2174
|
+
ledger.runId !== authorization?.runId ||
|
|
2175
|
+
ledger.ownerPid !== state?.ownerPid ||
|
|
2176
|
+
ledger.cleanupToken !== state?.runtimeNamespace?.cleanupToken ||
|
|
2177
|
+
ledger.runtimeRoot !== authorization?.runtimeRoot ||
|
|
2178
|
+
ledger.provenance?.commit !== authorization?.commit ||
|
|
2179
|
+
ledger.provenance?.tree !== authorization?.tree ||
|
|
2180
|
+
ledger.provenance?.manifestDigest !== authorization?.manifestDigest ||
|
|
2181
|
+
provenance?.commit !== authorization?.commit ||
|
|
2182
|
+
provenance?.tree !== authorization?.tree ||
|
|
2183
|
+
provenance?.manifestDigest !== authorization?.manifestDigest ||
|
|
2184
|
+
!/^legacy-[0-9a-f]{24}$/u.test(authorization?.requestId ?? "") ||
|
|
2185
|
+
!Array.isArray(ledger.identities) ||
|
|
2186
|
+
ledger.identities.length < 1 ||
|
|
2187
|
+
ledger.identities.length > 65 ||
|
|
2188
|
+
!ledger.identities.every(
|
|
2189
|
+
(identity) =>
|
|
2190
|
+
exactLegacyProcessRow(identity) &&
|
|
2191
|
+
["owner", "descendant", "scoped-pgid"].includes(identity.ownership),
|
|
2192
|
+
) ||
|
|
2193
|
+
ledger.identities.filter(({ ownership }) => ownership === "owner").length !== 1 ||
|
|
2194
|
+
ledger.identities.find(({ ownership }) => ownership === "owner")?.pid !== state?.ownerPid ||
|
|
2195
|
+
new Set(ledger.identities.map(({ pid }) => pid)).size !== ledger.identities.length ||
|
|
2196
|
+
!/^[0-9a-f]{48}$/u.test(authorization?.ownerToken ?? "")
|
|
2197
|
+
)
|
|
2198
|
+
return null;
|
|
2199
|
+
const identityHmac = createHmac("sha256", Buffer.from(authorization.ownerToken, "hex"))
|
|
2200
|
+
.update(JSON.stringify(ledger.identities))
|
|
2201
|
+
.digest("hex");
|
|
2202
|
+
return identityHmac === ledger.identityHmac
|
|
2203
|
+
? Object.freeze({
|
|
2204
|
+
...ledger,
|
|
2205
|
+
provenance: Object.freeze({ ...ledger.provenance }),
|
|
2206
|
+
identities: Object.freeze(
|
|
2207
|
+
ledger.identities.map((identity) => Object.freeze({ ...identity })),
|
|
2208
|
+
),
|
|
2209
|
+
})
|
|
2210
|
+
: null;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
export function assessLegacyProductRigCleanupAdmission(
|
|
2214
|
+
state,
|
|
2215
|
+
ledger,
|
|
2216
|
+
{ processAlive, pathExists },
|
|
2217
|
+
) {
|
|
2218
|
+
const cleanup = state?.cleanup;
|
|
2219
|
+
const card5 = cleanup?.card5;
|
|
2220
|
+
const owners = card5?.owners;
|
|
2221
|
+
const failure = cleanup?.failures?.[0];
|
|
2222
|
+
const hostCount = (host) => {
|
|
2223
|
+
const values = [
|
|
2224
|
+
card5?.[`${host}ProcessCount`],
|
|
2225
|
+
card5?.[`${host}DescendantCount`],
|
|
2226
|
+
card5?.[`${host}TerminalProcessCount`] ?? 0,
|
|
2227
|
+
];
|
|
2228
|
+
return values.every((value) => Number.isSafeInteger(value) && value >= 0)
|
|
2229
|
+
? values.reduce((sum, value) => sum + value, 0)
|
|
2230
|
+
: -1;
|
|
2231
|
+
};
|
|
2232
|
+
const paths = [
|
|
2233
|
+
state?.runtimeNamespace?.root,
|
|
2234
|
+
state?.runtimeNamespace?.tmuxSocketPath,
|
|
2235
|
+
state?.runtimeNamespace?.hostTmuxSocketPath,
|
|
2236
|
+
state?.runtimeNamespace?.daemonInfoDir,
|
|
2237
|
+
...(Array.isArray(state?.ownedTuiRuntimeDirs) ? state.ownedTuiRuntimeDirs : []),
|
|
2238
|
+
];
|
|
2239
|
+
const exactOwners = ["chromium", "electron", "opentui", "daemon", "namespace"];
|
|
2240
|
+
const valid =
|
|
2241
|
+
acquireLegacyProductRigCleanupLedger(
|
|
2242
|
+
state,
|
|
2243
|
+
{
|
|
2244
|
+
requestId: ledger?.requestId,
|
|
2245
|
+
runId: ledger?.runId,
|
|
2246
|
+
ownerToken: state?.ownerToken,
|
|
2247
|
+
commit: ledger?.provenance?.commit,
|
|
2248
|
+
tree: ledger?.provenance?.tree,
|
|
2249
|
+
manifestDigest: ledger?.provenance?.manifestDigest,
|
|
2250
|
+
runtimeRoot: ledger?.runtimeRoot,
|
|
2251
|
+
},
|
|
2252
|
+
ledger,
|
|
2253
|
+
) !== null &&
|
|
2254
|
+
cleanup?.status === "failed" &&
|
|
2255
|
+
Array.isArray(cleanup.failures) &&
|
|
2256
|
+
cleanup.failures.length === 1 &&
|
|
2257
|
+
failure?.subsystem === "card5-cleanup-ledger" &&
|
|
2258
|
+
typeof failure?.detail === "string" &&
|
|
2259
|
+
failure.detail.length > 0 &&
|
|
2260
|
+
failure.detail.length <= 256 &&
|
|
2261
|
+
card5?.passed === false &&
|
|
2262
|
+
owners &&
|
|
2263
|
+
Object.keys(owners).sort().join("\0") === [...exactOwners].sort().join("\0") &&
|
|
2264
|
+
exactOwners.every(
|
|
2265
|
+
(name) =>
|
|
2266
|
+
typeof owners[name]?.owned === "boolean" && typeof owners[name]?.retired === "boolean",
|
|
2267
|
+
) &&
|
|
2268
|
+
owners.opentui.retired === true &&
|
|
2269
|
+
owners.daemon.retired === true &&
|
|
2270
|
+
owners.namespace.retired === true &&
|
|
2271
|
+
["chromium", "electron"].every((host) => {
|
|
2272
|
+
const count = hostCount(host);
|
|
2273
|
+
return (
|
|
2274
|
+
count >= 0 && (count > 0 ? owners[host].owned === true : owners[host].retired === true)
|
|
2275
|
+
);
|
|
2276
|
+
}) &&
|
|
2277
|
+
[
|
|
2278
|
+
"chromiumPageCount",
|
|
2279
|
+
"chromiumContextCount",
|
|
2280
|
+
"chromiumListenerCount",
|
|
2281
|
+
"electronWindowCount",
|
|
2282
|
+
"electronListenerCount",
|
|
2283
|
+
"electronOpenHandleCount",
|
|
2284
|
+
"socketResidueCount",
|
|
2285
|
+
"nativeObserverProcessCount",
|
|
2286
|
+
"pathResidueCount",
|
|
2287
|
+
].every((key) => card5?.[key] === 0) &&
|
|
2288
|
+
typeof processAlive === "function" &&
|
|
2289
|
+
!processAlive(state?.daemon?.pid) &&
|
|
2290
|
+
typeof pathExists === "function" &&
|
|
2291
|
+
paths.every((path) => typeof path !== "string" || !pathExists(path));
|
|
2292
|
+
return Object.freeze({
|
|
2293
|
+
passed: valid === true,
|
|
2294
|
+
reason: valid ? null : "legacy-admission-invalid",
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
export async function retireLegacyProductRigCleanupIdentities(
|
|
2299
|
+
ledger,
|
|
2300
|
+
{ readProcessRows, signalProcess, sleep, termWaitMs = 2_000, killWaitMs = 500 },
|
|
2301
|
+
) {
|
|
2302
|
+
if (
|
|
2303
|
+
ledger?.version !== 1 ||
|
|
2304
|
+
ledger?.mode !== "legacy-cleanup-v1" ||
|
|
2305
|
+
!Array.isArray(ledger.identities) ||
|
|
2306
|
+
ledger.identities.length < 1 ||
|
|
2307
|
+
ledger.identities.length > 65 ||
|
|
2308
|
+
typeof readProcessRows !== "function" ||
|
|
2309
|
+
typeof signalProcess !== "function" ||
|
|
2310
|
+
typeof sleep !== "function"
|
|
2311
|
+
)
|
|
2312
|
+
return Object.freeze({ passed: false, reason: "legacy-ledger-invalid" });
|
|
2313
|
+
const same = (identity, row) =>
|
|
2314
|
+
row &&
|
|
2315
|
+
identity.pid === row.pid &&
|
|
2316
|
+
identity.ppid === row.ppid &&
|
|
2317
|
+
identity.pgid === row.pgid &&
|
|
2318
|
+
identity.startToken === row.startToken &&
|
|
2319
|
+
identity.command === row.command;
|
|
2320
|
+
const current = (identity) => {
|
|
2321
|
+
const rows = readProcessRows();
|
|
2322
|
+
if (!Array.isArray(rows) || !rows.every(exactLegacyProcessRow)) return "unavailable";
|
|
2323
|
+
const row = rows.find(({ pid }) => pid === identity.pid);
|
|
2324
|
+
return row ? (same(identity, row) ? row : "reused") : null;
|
|
2325
|
+
};
|
|
2326
|
+
const depth = (identity) => {
|
|
2327
|
+
let value = 0;
|
|
2328
|
+
let parent = identity.ppid;
|
|
2329
|
+
while (
|
|
2330
|
+
ledger.identities.some(({ pid }) => pid === parent) &&
|
|
2331
|
+
value <= ledger.identities.length
|
|
2332
|
+
) {
|
|
2333
|
+
value += 1;
|
|
2334
|
+
parent = ledger.identities.find(({ pid }) => pid === parent)?.ppid;
|
|
2335
|
+
}
|
|
2336
|
+
return value;
|
|
2337
|
+
};
|
|
2338
|
+
const childrenFirst = [...ledger.identities].sort((a, b) => depth(b) - depth(a));
|
|
2339
|
+
const signalExact = (signal) => {
|
|
2340
|
+
for (const identity of childrenFirst) {
|
|
2341
|
+
const row = current(identity);
|
|
2342
|
+
if (row === "unavailable") return false;
|
|
2343
|
+
if (row === null || row === "reused" || /[EZ]/u.test(row.state)) continue;
|
|
2344
|
+
try {
|
|
2345
|
+
signalProcess(identity.pid, signal);
|
|
2346
|
+
} catch {
|
|
2347
|
+
// A retained process may retire after its immediate identity check.
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
return true;
|
|
2351
|
+
};
|
|
2352
|
+
if (!signalExact("SIGTERM"))
|
|
2353
|
+
return Object.freeze({ passed: false, reason: "legacy-identity-unavailable" });
|
|
2354
|
+
await sleep(termWaitMs);
|
|
2355
|
+
if (!signalExact("SIGKILL"))
|
|
2356
|
+
return Object.freeze({ passed: false, reason: "legacy-identity-unavailable" });
|
|
2357
|
+
await sleep(killWaitMs);
|
|
2358
|
+
const rows = readProcessRows();
|
|
2359
|
+
const absence = assessProductRigRetainedProcessAbsence(ledger.identities, rows);
|
|
2360
|
+
return Object.freeze({
|
|
2361
|
+
passed: absence === "absent",
|
|
2362
|
+
reason: absence === "absent" ? null : `legacy-identity-${absence}`,
|
|
2363
|
+
});
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* One-way compatibility for stopped ProductRig v1 state written before exact
|
|
2368
|
+
* cleanup receipts existed. This is admission only: start() retains ownership
|
|
2369
|
+
* of deleting the stale rig directory after the barrier passes.
|
|
2370
|
+
*/
|
|
2371
|
+
export function isCleanLegacyStoppedProductRigState(
|
|
2372
|
+
state,
|
|
2373
|
+
{ processAlive: isAlive, pathExists = existsSync },
|
|
2374
|
+
) {
|
|
2375
|
+
if (!state || typeof state !== "object" || Array.isArray(state)) return false;
|
|
2376
|
+
if (Object.prototype.hasOwnProperty.call(state, "cleanup") || state.cleanup !== undefined)
|
|
2377
|
+
return false;
|
|
2378
|
+
if (
|
|
2379
|
+
state.version !== 1 ||
|
|
2380
|
+
state.status !== "stopped" ||
|
|
2381
|
+
Object.prototype.hasOwnProperty.call(state, "ownerToken") ||
|
|
2382
|
+
state.ownerToken !== undefined
|
|
2383
|
+
)
|
|
2384
|
+
return false;
|
|
2385
|
+
if (!Number.isSafeInteger(state.ownerPid) || state.ownerPid <= 0 || isAlive(state.ownerPid))
|
|
2386
|
+
return false;
|
|
2387
|
+
if (
|
|
2388
|
+
!state.daemon ||
|
|
2389
|
+
typeof state.daemon !== "object" ||
|
|
2390
|
+
!Number.isSafeInteger(state.daemon.pid) ||
|
|
2391
|
+
state.daemon.pid <= 0 ||
|
|
2392
|
+
isAlive(state.daemon.pid) ||
|
|
2393
|
+
typeof state.daemon.instanceId !== "string" ||
|
|
2394
|
+
state.daemon.instanceId.length === 0 ||
|
|
2395
|
+
state.daemon.instanceId.length > 128
|
|
2396
|
+
)
|
|
2397
|
+
return false;
|
|
2398
|
+
const namespace = state.runtimeNamespace;
|
|
2399
|
+
if (
|
|
2400
|
+
!namespace ||
|
|
2401
|
+
typeof namespace !== "object" ||
|
|
2402
|
+
typeof namespace.cleanupToken !== "string" ||
|
|
2403
|
+
namespace.cleanupToken.length === 0 ||
|
|
2404
|
+
namespace.cleanupToken.length > 256
|
|
2405
|
+
)
|
|
2406
|
+
return false;
|
|
2407
|
+
const root = namespace.root;
|
|
2408
|
+
const childPaths = [
|
|
2409
|
+
namespace.tmuxSocketPath,
|
|
2410
|
+
namespace.hostTmuxSocketPath,
|
|
2411
|
+
namespace.daemonInfoDir,
|
|
2412
|
+
];
|
|
2413
|
+
if (
|
|
2414
|
+
typeof root !== "string" ||
|
|
2415
|
+
!isAbsolute(root) ||
|
|
2416
|
+
root === sep ||
|
|
2417
|
+
resolve(root) !== root ||
|
|
2418
|
+
pathExists(root) ||
|
|
2419
|
+
childPaths.some(
|
|
2420
|
+
(ownedPath) =>
|
|
2421
|
+
typeof ownedPath !== "string" ||
|
|
2422
|
+
!isAbsolute(ownedPath) ||
|
|
2423
|
+
resolve(ownedPath) !== ownedPath ||
|
|
2424
|
+
!ownedPath.startsWith(`${root}${sep}`) ||
|
|
2425
|
+
pathExists(ownedPath),
|
|
2426
|
+
)
|
|
2427
|
+
)
|
|
2428
|
+
return false;
|
|
2429
|
+
return true;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
export function productRigCleanupAcknowledgesRequest(state, requestId) {
|
|
2433
|
+
if (!state || typeof state !== "object") return false;
|
|
2434
|
+
if (state.cleanup?.requestId === requestId) return true;
|
|
2435
|
+
return (
|
|
2436
|
+
state.cleanup?.status === "passed" &&
|
|
2437
|
+
typeof state.cleanup?.requestId === "string" &&
|
|
2438
|
+
["stopped", "failed"].includes(state.status)
|
|
2439
|
+
);
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
export async function collectProductRigCleanupFailures(steps, { detailLimit = 4_000 } = {}) {
|
|
2443
|
+
const failures = [];
|
|
2444
|
+
for (const step of steps) {
|
|
2445
|
+
try {
|
|
2446
|
+
await step.run();
|
|
2447
|
+
} catch (error) {
|
|
2448
|
+
const detail = String(error instanceof Error ? error.message : error);
|
|
2449
|
+
failures.push(
|
|
2450
|
+
Object.freeze({
|
|
2451
|
+
subsystem: step.subsystem,
|
|
2452
|
+
detail: detail.length <= detailLimit ? detail : detail.slice(-detailLimit),
|
|
2453
|
+
}),
|
|
2454
|
+
);
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
return Object.freeze(failures);
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
export function bufferOwnedTuiRuntimeEvidence({
|
|
2461
|
+
ownedRuntimeDirs,
|
|
2462
|
+
activeTui,
|
|
2463
|
+
artifactDir,
|
|
2464
|
+
pathExists,
|
|
2465
|
+
ensureArtifactDir,
|
|
2466
|
+
moveRuntimeDir,
|
|
2467
|
+
onActiveTuiRelocated = () => undefined,
|
|
2468
|
+
}) {
|
|
2469
|
+
let bufferedTui = activeTui;
|
|
2470
|
+
ensureArtifactDir(artifactDir);
|
|
2471
|
+
const relocateActiveTui = (runtimeDir, bufferedRuntimeDir) => {
|
|
2472
|
+
if (bufferedTui?.runtimeDir !== runtimeDir) return;
|
|
2473
|
+
const relocate = (path) =>
|
|
2474
|
+
typeof path === "string" && path.startsWith(`${runtimeDir}${sep}`)
|
|
2475
|
+
? join(bufferedRuntimeDir, path.slice(runtimeDir.length + 1))
|
|
2476
|
+
: path;
|
|
2477
|
+
bufferedTui = Object.freeze({
|
|
2478
|
+
...bufferedTui,
|
|
2479
|
+
runtimeDir: bufferedRuntimeDir,
|
|
2480
|
+
performanceTracePath: relocate(bufferedTui.performanceTracePath),
|
|
2481
|
+
});
|
|
2482
|
+
onActiveTuiRelocated(bufferedTui);
|
|
2483
|
+
};
|
|
2484
|
+
for (const [index, runtimeDir] of ownedRuntimeDirs.entries()) {
|
|
2485
|
+
const bufferedRuntimeDir = join(artifactDir, `tui-runtime-${index + 1}`);
|
|
2486
|
+
const sourceExists = pathExists(runtimeDir);
|
|
2487
|
+
const destinationExists = pathExists(bufferedRuntimeDir);
|
|
2488
|
+
if (!sourceExists && destinationExists) {
|
|
2489
|
+
relocateActiveTui(runtimeDir, bufferedRuntimeDir);
|
|
2490
|
+
continue;
|
|
2491
|
+
}
|
|
2492
|
+
if (!sourceExists) continue;
|
|
2493
|
+
if (destinationExists) throw new Error("buffered TUI evidence destination already exists");
|
|
2494
|
+
moveRuntimeDir(runtimeDir, bufferedRuntimeDir);
|
|
2495
|
+
relocateActiveTui(runtimeDir, bufferedRuntimeDir);
|
|
2496
|
+
}
|
|
2497
|
+
return bufferedTui;
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
export function prepareOwnedTuiRuntime({
|
|
2501
|
+
ownership,
|
|
2502
|
+
intendedTui,
|
|
2503
|
+
ownedTuiRuntimeDirs = [],
|
|
2504
|
+
publish,
|
|
2505
|
+
resolveProvenance,
|
|
2506
|
+
createRuntimeDir,
|
|
2507
|
+
}) {
|
|
2508
|
+
const ownedRuntimeDirs = [...new Set([...ownedTuiRuntimeDirs, intendedTui.runtimeDir])];
|
|
2509
|
+
publish({ ...ownership, tui: intendedTui, ownedTuiRuntimeDirs: ownedRuntimeDirs });
|
|
2510
|
+
const provenance = resolveProvenance();
|
|
2511
|
+
const tui = Object.freeze({
|
|
2512
|
+
...intendedTui,
|
|
2513
|
+
performanceTraceCommit: provenance.commit,
|
|
2514
|
+
performanceTraceTree: provenance.tree,
|
|
2515
|
+
performanceTraceManifestDigest: provenance.manifestDigest ?? null,
|
|
2516
|
+
});
|
|
2517
|
+
publish({ tui });
|
|
2518
|
+
createRuntimeDir(tui.runtimeDir);
|
|
2519
|
+
return tui;
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
export async function startOwnedProductRigDaemon({ start, publish, waitUntilReady }) {
|
|
2523
|
+
publish({ daemonLifecycle: "starting" });
|
|
2524
|
+
const daemon = await start();
|
|
2525
|
+
publish({ daemonLifecycle: "started", daemon: daemon.record });
|
|
2526
|
+
await waitUntilReady(daemon);
|
|
2527
|
+
return daemon;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
/**
|
|
2531
|
+
* Internal owner failures may try cleanup immediately, but a failed attempt
|
|
2532
|
+
* must keep the token-valid owner alive for the controller's exact retry.
|
|
2533
|
+
*/
|
|
2534
|
+
export async function settleInternalProductRigCleanup({
|
|
2535
|
+
cleanup,
|
|
2536
|
+
maxImmediateAttempts,
|
|
2537
|
+
onTerminal,
|
|
2538
|
+
onRetryable,
|
|
2539
|
+
}) {
|
|
2540
|
+
let result = null;
|
|
2541
|
+
for (let attempt = 1; attempt <= maxImmediateAttempts; attempt += 1) {
|
|
2542
|
+
result = await cleanup(attempt);
|
|
2543
|
+
if (result?.passed === true) {
|
|
2544
|
+
await onTerminal(result);
|
|
2545
|
+
return Object.freeze({ passed: true, attempts: attempt, result });
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
await onRetryable(result);
|
|
2549
|
+
return Object.freeze({ passed: false, attempts: maxImmediateAttempts, result });
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
export function productDiagnosticRunId({ journeyId, variant = null, repetition, now, nonce }) {
|
|
2553
|
+
const timestamp = new Date(now).toISOString().replaceAll(/[-:.TZ]/gu, "");
|
|
2554
|
+
const safeJourney = String(journeyId)
|
|
2555
|
+
.toLowerCase()
|
|
2556
|
+
.replaceAll(/[^a-z0-9-]/gu, "-");
|
|
2557
|
+
const safeNonce = String(nonce)
|
|
2558
|
+
.toLowerCase()
|
|
2559
|
+
.replaceAll(/[^a-z0-9]/gu, "")
|
|
2560
|
+
.slice(0, 16);
|
|
2561
|
+
if (!safeNonce) throw new Error("diagnostic run id requires a non-empty nonce");
|
|
2562
|
+
const safeVariant = variant
|
|
2563
|
+
? `-${String(variant)
|
|
2564
|
+
.toLowerCase()
|
|
2565
|
+
.replaceAll(/[^a-z0-9-]/gu, "-")}`
|
|
2566
|
+
: "";
|
|
2567
|
+
return `${timestamp}-${safeJourney}${safeVariant}-r${repetition}-${safeNonce}`;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
export function prepareProductDiagnosticBundlePublication({
|
|
2571
|
+
root,
|
|
2572
|
+
runId,
|
|
2573
|
+
report,
|
|
2574
|
+
evidence,
|
|
2575
|
+
cleanupReceipt,
|
|
2576
|
+
}) {
|
|
2577
|
+
const exactCleanupReceipt = validateProductRigCleanupReceipt(cleanupReceipt, runId);
|
|
2578
|
+
const reportPath = join(root, runId, "report.json");
|
|
2579
|
+
if (
|
|
2580
|
+
report?.reportPath !== null &&
|
|
2581
|
+
report?.reportPath !== undefined &&
|
|
2582
|
+
report.reportPath !== reportPath
|
|
2583
|
+
)
|
|
2584
|
+
throw new Error("diagnostic reportPath does not match its immutable bundle destination");
|
|
2585
|
+
const sealedReport = Object.freeze({
|
|
2586
|
+
...report,
|
|
2587
|
+
reportPath,
|
|
2588
|
+
cleanupReceipt: exactCleanupReceipt,
|
|
2589
|
+
});
|
|
2590
|
+
return Object.freeze({
|
|
2591
|
+
report: sealedReport,
|
|
2592
|
+
reportPath,
|
|
2593
|
+
evidence: Object.freeze({
|
|
2594
|
+
...evidence,
|
|
2595
|
+
report: sealedReport,
|
|
2596
|
+
alignment: Object.freeze({
|
|
2597
|
+
...evidence.alignment,
|
|
2598
|
+
reportPath,
|
|
2599
|
+
cleanupReceipt: exactCleanupReceipt,
|
|
2600
|
+
}),
|
|
2601
|
+
}),
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
function writeExclusive(path, value, mode = 0o600) {
|
|
2606
|
+
const handle = openSync(path, "wx", mode);
|
|
2607
|
+
try {
|
|
2608
|
+
writeSync(handle, value);
|
|
2609
|
+
fsyncSync(handle);
|
|
2610
|
+
} finally {
|
|
2611
|
+
closeSync(handle);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
function json(value) {
|
|
2616
|
+
return `${JSON.stringify(value, null, 2)}\n`;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
/** Write the complete evidence set once; an existing run id fails closed. */
|
|
2620
|
+
export function createProductDiagnosticBundle({ root, runId, evidence }) {
|
|
2621
|
+
if (!/^[a-z0-9][a-z0-9-]{0,159}$/u.test(runId))
|
|
2622
|
+
throw new Error("diagnostic bundle run id must be a bounded lowercase slug");
|
|
2623
|
+
for (const field of ["timeline", "tuiAnsi", "stderr", "reproduction"])
|
|
2624
|
+
if (typeof evidence?.[field] !== "string")
|
|
2625
|
+
throw new TypeError(`diagnostic bundle ${field} must be a string`);
|
|
2626
|
+
for (const field of ["report", "alignment", "tmuxTruth", "daemonState", "clientState"])
|
|
2627
|
+
if (!evidence?.[field] || typeof evidence[field] !== "object" || Array.isArray(evidence[field]))
|
|
2628
|
+
throw new TypeError(`diagnostic bundle ${field} must be an object`);
|
|
2629
|
+
if (typeof evidence.report.runId === "string") {
|
|
2630
|
+
const receipt = validateProductRigCleanupReceipt(evidence.report.cleanupReceipt, runId);
|
|
2631
|
+
if (JSON.stringify(evidence.alignment.cleanupReceipt) !== JSON.stringify(receipt))
|
|
2632
|
+
throw new Error("diagnostic bundle cleanup receipt diverges between report and alignment");
|
|
2633
|
+
}
|
|
2634
|
+
const webPng = Buffer.isBuffer(evidence.webPng)
|
|
2635
|
+
? evidence.webPng
|
|
2636
|
+
: typeof evidence.webPngPath === "string" && existsSync(evidence.webPngPath)
|
|
2637
|
+
? readFileSync(evidence.webPngPath)
|
|
2638
|
+
: null;
|
|
2639
|
+
if (!webPng) throw new Error("diagnostic bundle web PNG evidence is missing");
|
|
2640
|
+
const signature = webPng.subarray(0, 8).toString("hex");
|
|
2641
|
+
if (signature !== "89504e470d0a1a0a")
|
|
2642
|
+
throw new Error("diagnostic bundle web PNG source is not a PNG");
|
|
2643
|
+
mkdirSync(root, { recursive: true, mode: 0o700 });
|
|
2644
|
+
const runDir = join(root, runId);
|
|
2645
|
+
if (existsSync(runDir)) throw new Error(`diagnostic bundle already exists: ${runId}`);
|
|
2646
|
+
const temporary = join(root, `.${runId}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`);
|
|
2647
|
+
mkdirSync(temporary, { recursive: false, mode: 0o700 });
|
|
2648
|
+
try {
|
|
2649
|
+
writeExclusive(join(temporary, "report.json"), json(evidence.report));
|
|
2650
|
+
writeExclusive(join(temporary, "alignment.json"), json(evidence.alignment));
|
|
2651
|
+
writeExclusive(join(temporary, "timeline.jsonl"), evidence.timeline);
|
|
2652
|
+
writeExclusive(join(temporary, "tmux-truth.json"), json(evidence.tmuxTruth));
|
|
2653
|
+
writeExclusive(join(temporary, "daemon-state.json"), json(evidence.daemonState));
|
|
2654
|
+
writeExclusive(join(temporary, "client-state.json"), json(evidence.clientState));
|
|
2655
|
+
writeExclusive(join(temporary, "tui.ansi"), evidence.tuiAnsi);
|
|
2656
|
+
const copiedPng = join(temporary, "web.png");
|
|
2657
|
+
writeExclusive(copiedPng, webPng);
|
|
2658
|
+
const pngHandle = openSync(copiedPng, "r");
|
|
2659
|
+
try {
|
|
2660
|
+
fsyncSync(pngHandle);
|
|
2661
|
+
} finally {
|
|
2662
|
+
closeSync(pngHandle);
|
|
2663
|
+
}
|
|
2664
|
+
writeExclusive(join(temporary, "stderr.log"), evidence.stderr);
|
|
2665
|
+
writeExclusive(join(temporary, "reproduction.sh"), evidence.reproduction, 0o700);
|
|
2666
|
+
for (const file of PRODUCT_DIAGNOSTIC_BUNDLE_FILES) {
|
|
2667
|
+
const path = join(temporary, file);
|
|
2668
|
+
chmodSync(path, file === "reproduction.sh" ? 0o500 : 0o400);
|
|
2669
|
+
const fileHandle = openSync(path, "r");
|
|
2670
|
+
try {
|
|
2671
|
+
fsyncSync(fileHandle);
|
|
2672
|
+
} finally {
|
|
2673
|
+
closeSync(fileHandle);
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
chmodSync(temporary, 0o500);
|
|
2677
|
+
const temporaryHandle = openSync(temporary, "r");
|
|
2678
|
+
try {
|
|
2679
|
+
fsyncSync(temporaryHandle);
|
|
2680
|
+
} finally {
|
|
2681
|
+
closeSync(temporaryHandle);
|
|
2682
|
+
}
|
|
2683
|
+
renameSync(temporary, runDir);
|
|
2684
|
+
const rootHandle = openSync(root, "r");
|
|
2685
|
+
try {
|
|
2686
|
+
fsyncSync(rootHandle);
|
|
2687
|
+
} finally {
|
|
2688
|
+
closeSync(rootHandle);
|
|
2689
|
+
}
|
|
2690
|
+
} catch (error) {
|
|
2691
|
+
try {
|
|
2692
|
+
chmodSync(temporary, 0o700);
|
|
2693
|
+
} catch {
|
|
2694
|
+
// The temporary may already have been atomically renamed.
|
|
2695
|
+
}
|
|
2696
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
2697
|
+
throw error;
|
|
2698
|
+
}
|
|
2699
|
+
return Object.freeze({ version: PRODUCT_DIAGNOSTIC_BUNDLE_VERSION, runId, runDir });
|
|
2700
|
+
}
|