tmux-ide 2.7.0 → 2.9.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -115
- package/bin/cli.js +69987 -11819
- package/bin/cli.ts +772 -114
- package/package.json +64 -30
- package/packages/contracts/package.json +3 -2
- package/packages/contracts/src/__tests__/actions-contract.test.ts +119 -0
- package/packages/contracts/src/__tests__/agent-graph-overlay.test.ts +428 -0
- package/packages/contracts/src/__tests__/app-window-mutation.test.ts +51 -0
- package/packages/contracts/src/__tests__/app-window-state.test.ts +34 -0
- package/packages/contracts/src/__tests__/application-shell.test.ts +635 -0
- package/packages/contracts/src/__tests__/causal-cell.test.ts +47 -0
- package/packages/contracts/src/__tests__/client-view-state.test.ts +115 -0
- package/packages/contracts/src/__tests__/cohesion-fixture.test.ts +106 -0
- package/packages/contracts/src/__tests__/commands.test.ts +86 -0
- package/packages/contracts/src/__tests__/control.test.ts +154 -0
- package/packages/contracts/src/__tests__/daemon-events.test.ts +400 -0
- package/packages/contracts/src/__tests__/daemon-resources.test.ts +143 -0
- package/packages/contracts/src/__tests__/daemon-wire.test.ts +117 -0
- package/packages/contracts/src/__tests__/desktop-host.test.ts +269 -0
- package/packages/contracts/src/__tests__/desktop-missions.test.ts +211 -0
- package/packages/contracts/src/__tests__/experience-conformance.test.ts +153 -0
- package/packages/contracts/src/__tests__/experience-kernel-boundary.test.ts +109 -0
- package/packages/contracts/src/__tests__/experience-shell.test.ts +65 -0
- package/packages/contracts/src/__tests__/fixtures/daemon-wire-v2.json +35 -0
- package/packages/contracts/src/__tests__/fleet-agent-graph.test.ts +231 -0
- package/packages/contracts/src/__tests__/fleet-catalog.test.ts +268 -0
- package/packages/contracts/src/__tests__/fleet-lifecycle.test.ts +62 -0
- package/packages/contracts/src/__tests__/focus-overlay.test.ts +110 -0
- package/packages/contracts/src/__tests__/ide-config.test.ts +18 -0
- package/packages/contracts/src/__tests__/issue-error.test.ts +78 -0
- package/packages/contracts/src/__tests__/mission-projections.test.ts +186 -0
- package/packages/contracts/src/__tests__/missions.test.ts +272 -0
- package/packages/contracts/src/__tests__/multiplexer-verbs.test.ts +240 -0
- package/packages/contracts/src/__tests__/pane-appearance.test.ts +146 -0
- package/packages/contracts/src/__tests__/pane-stream.test.ts +466 -0
- package/packages/contracts/src/__tests__/pane-widget-marker.test.ts +327 -0
- package/packages/contracts/src/__tests__/performance-metrics.test.ts +73 -0
- package/packages/contracts/src/__tests__/performance-qualification.test.ts +137 -0
- package/packages/contracts/src/__tests__/rich-card-widget.test.ts +29 -0
- package/packages/contracts/src/__tests__/session-runtime.test.ts +490 -0
- package/packages/contracts/src/__tests__/startup-readiness.test.ts +409 -0
- package/packages/contracts/src/__tests__/terminal-attachment-stream.test.ts +72 -0
- package/packages/contracts/src/__tests__/terminal-attachments.test.ts +329 -0
- package/packages/contracts/src/__tests__/terminal-delivery.test.ts +88 -0
- package/packages/contracts/src/__tests__/terminal-runtime-inventory.test.ts +68 -0
- package/packages/contracts/src/__tests__/visual-tokens.test.ts +224 -0
- package/packages/contracts/src/__tests__/workspace-changes-resource.test.ts +317 -0
- package/packages/contracts/src/__tests__/workspace-changes-view.test.ts +122 -0
- package/packages/contracts/src/__tests__/workspace-config.test.ts +294 -0
- package/packages/contracts/src/__tests__/workspace-files-resource.test.ts +261 -0
- package/packages/contracts/src/__tests__/workspace-files-tree.test.ts +147 -0
- package/packages/contracts/src/__tests__/workspace-pane-creation.test.ts +249 -0
- package/packages/contracts/src/__tests__/workspace-promotion.test.ts +94 -0
- package/packages/contracts/src/__tests__/workspace-resource-identity.test.ts +90 -0
- package/packages/contracts/src/actions-contract.ts +205 -0
- package/packages/contracts/src/actions-errors.ts +20 -0
- package/packages/contracts/src/agent-graph-overlay.ts +425 -0
- package/packages/contracts/src/app-window-mutation.ts +103 -0
- package/packages/contracts/src/app-window-state.ts +446 -0
- package/packages/contracts/src/application-shell-resource.ts +54 -0
- package/packages/contracts/src/application-shell.ts +1094 -0
- package/packages/contracts/src/causal-cell.ts +168 -0
- package/packages/contracts/src/client-view-state.ts +156 -0
- package/packages/contracts/src/cohesion-fixture.ts +647 -0
- package/packages/contracts/src/commands.ts +153 -0
- package/packages/contracts/src/control.ts +217 -0
- package/packages/contracts/src/daemon-events.ts +374 -0
- package/packages/contracts/src/daemon-resource-request.test.ts +192 -0
- package/packages/contracts/src/daemon-resource-request.ts +397 -0
- package/packages/contracts/src/daemon-resources.ts +108 -0
- package/packages/contracts/src/daemon-wire.ts +100 -0
- package/packages/contracts/src/desktop-daemon-issue.ts +83 -0
- package/packages/contracts/src/desktop-host.ts +746 -0
- package/packages/contracts/src/desktop-missions.ts +159 -0
- package/packages/contracts/src/desktop-update.ts +48 -0
- package/packages/contracts/src/desktop-workspace-name.ts +18 -0
- package/packages/contracts/src/domain.ts +493 -0
- package/packages/contracts/src/experience-identifiers.ts +53 -0
- package/packages/contracts/src/experience-shell.ts +249 -0
- package/packages/contracts/src/fleet-agent-graph.ts +171 -0
- package/packages/contracts/src/fleet-catalog.ts +190 -0
- package/packages/contracts/src/fleet-lifecycle.ts +136 -0
- package/packages/contracts/src/focus-overlay.ts +175 -0
- package/packages/contracts/src/ide-config.ts +40 -20
- package/packages/contracts/src/index.ts +60 -0
- package/packages/contracts/src/interaction-receipts.ts +438 -0
- package/packages/contracts/src/issue-error.ts +107 -0
- package/packages/contracts/src/mission-projections.ts +269 -0
- package/packages/contracts/src/multiplexer-verbs.ts +447 -0
- package/packages/contracts/src/pane-appearance.ts +248 -0
- package/packages/contracts/src/pane-stream.ts +709 -0
- package/packages/contracts/src/pane-widget-descriptor.ts +62 -0
- package/packages/contracts/src/pane-widget-marker.ts +301 -0
- package/packages/contracts/src/performance-metrics.ts +128 -0
- package/packages/contracts/src/performance-qualification.ts +276 -0
- package/packages/contracts/src/rich-card-widget.ts +72 -0
- package/packages/contracts/src/semantic-identity.ts +39 -0
- package/packages/contracts/src/session-runtime.ts +351 -0
- package/packages/contracts/src/shared-monotonic-clock.ts +18 -0
- package/packages/contracts/src/startup-readiness.ts +432 -0
- package/packages/contracts/src/terminal-attachment-stream.ts +119 -0
- package/packages/contracts/src/terminal-attachments.ts +347 -0
- package/packages/contracts/src/terminal-delivery.ts +245 -0
- package/packages/contracts/src/terminal-replica.ts +133 -0
- package/packages/contracts/src/terminal-runtime-inventory.ts +42 -0
- package/packages/contracts/src/visual-recipes.ts +126 -0
- package/packages/contracts/src/visual-tokens.ts +883 -0
- package/packages/contracts/src/widget-asset.ts +43 -0
- package/packages/contracts/src/workspace-catalog-resource.test.ts +146 -0
- package/packages/contracts/src/workspace-catalog-resource.ts +180 -0
- package/packages/contracts/src/workspace-changes-resource.ts +405 -0
- package/packages/contracts/src/workspace-changes-view.ts +195 -0
- package/packages/contracts/src/workspace-config.ts +303 -0
- package/packages/contracts/src/workspace-files-resource.ts +310 -0
- package/packages/contracts/src/workspace-files-tree.ts +167 -0
- package/packages/contracts/src/workspace-missions-resource.ts +32 -0
- package/packages/contracts/src/workspace-multiplexer.ts +373 -0
- package/packages/contracts/src/workspace-open-handoff.ts +99 -0
- package/packages/contracts/src/workspace-open.ts +64 -0
- package/packages/contracts/src/workspace-pane-creation.ts +223 -0
- package/packages/contracts/src/workspace-promotion.ts +109 -0
- package/packages/contracts/src/workspace-resource-identity.ts +81 -0
- package/packages/contracts/src/workspace-state.ts +530 -0
- package/packages/contracts/src/workspace.ts +14 -2
- package/packages/core/package.json +35 -0
- package/packages/core/src/agent-provisioning.test.ts +42 -0
- package/packages/core/src/agent-provisioning.ts +112 -0
- package/packages/core/src/app-window-identity.ts +33 -0
- package/packages/core/src/application-shell-session.test.ts +105 -0
- package/packages/core/src/application-shell-session.ts +195 -0
- package/packages/core/src/index.ts +15 -0
- package/packages/core/src/interaction-flow.test.ts +66 -0
- package/packages/core/src/interaction-flow.ts +159 -0
- package/packages/core/src/interaction-receipts.test.ts +361 -0
- package/packages/core/src/interaction-receipts.ts +335 -0
- package/packages/core/src/navigator.test.ts +34 -0
- package/packages/core/src/navigator.ts +74 -0
- package/packages/core/src/optimistic-projection-conformance.test.ts +75 -0
- package/packages/core/src/optimistic-projection-conformance.ts +61 -0
- package/packages/core/src/optimistic-projection-store.ts +71 -0
- package/packages/core/src/optimistic-projection.test.ts +118 -0
- package/packages/core/src/optimistic-projection.ts +194 -0
- package/packages/core/src/performance-metrics.test.ts +121 -0
- package/packages/core/src/performance-metrics.ts +241 -0
- package/packages/core/src/performance-qualification.test.ts +283 -0
- package/packages/core/src/performance-qualification.ts +360 -0
- package/packages/core/src/terminal-compact-capability.ts +31 -0
- package/packages/core/src/terminal-compact-cold.test.ts +87 -0
- package/packages/core/src/terminal-conformance.test.ts +48 -0
- package/packages/core/src/terminal-conformance.ts +405 -0
- package/packages/core/src/terminal-delivery.test.ts +1196 -0
- package/packages/core/src/terminal-delivery.ts +2918 -0
- package/packages/core/src/terminal-replica-cold.test.ts +31 -0
- package/packages/core/src/terminal-replica-hash-cache.test.ts +201 -0
- package/packages/core/src/terminal-replica-hash-cache.ts +367 -0
- package/packages/core/src/terminal-replica.test.ts +282 -0
- package/packages/core/src/terminal-replica.ts +943 -0
- package/packages/core/src/workspace-selection.test.ts +63 -0
- package/packages/core/src/workspace-selection.ts +97 -0
- package/packages/daemon/dist/attach.js +2 -2
- package/packages/daemon/dist/canonical.d.ts +2 -2
- package/packages/daemon/dist/canonical.js +1 -1
- package/packages/daemon/dist/cli.js +37 -36
- package/packages/daemon/dist/command-center/actions/command-definitions.d.ts +4 -0
- package/packages/daemon/dist/command-center/actions/command-definitions.js +70 -0
- package/packages/daemon/dist/command-center/actions/dispatcher.d.ts +29 -0
- package/packages/daemon/dist/command-center/actions/dispatcher.js +228 -10
- package/packages/daemon/dist/command-center/actions/errors.d.ts +1 -1
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.d.ts +1 -1
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.js +3 -4
- package/packages/daemon/dist/command-center/actions/handlers/app-window-mutate.d.ts +8 -0
- package/packages/daemon/dist/command-center/actions/handlers/app-window-mutate.js +39 -0
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.d.ts +6 -6
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.js +44 -20
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.d.ts +2 -1
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.js +11 -1
- package/packages/daemon/dist/command-center/actions/handlers/fleet-lifecycle.d.ts +10 -0
- package/packages/daemon/dist/command-center/actions/handlers/fleet-lifecycle.js +56 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-launch.js +16 -4
- package/packages/daemon/dist/command-center/actions/handlers/workspace-multiplexer.d.ts +186 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-multiplexer.js +55 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-open.d.ts +16 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-open.js +89 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-pane-create.d.ts +8 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-pane-create.js +34 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-promote.d.ts +8 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-promote.js +34 -0
- package/packages/daemon/dist/command-center/actions/registry.d.ts +33 -2
- package/packages/daemon/dist/command-center/actions/registry.js +126 -0
- package/packages/daemon/dist/command-center/actions/semantic-multiplexer-actions.d.ts +3 -0
- package/packages/daemon/dist/command-center/actions/semantic-multiplexer-actions.js +16 -0
- package/packages/daemon/dist/command-center/agent-status-watch.d.ts +100 -0
- package/packages/daemon/dist/command-center/agent-status-watch.js +170 -0
- package/packages/daemon/dist/command-center/daemon-fleet-facts-observer.d.ts +57 -0
- package/packages/daemon/dist/command-center/daemon-fleet-facts-observer.js +395 -0
- package/packages/daemon/dist/command-center/discovery.d.ts +98 -1
- package/packages/daemon/dist/command-center/discovery.js +262 -3
- package/packages/daemon/dist/command-center/owner-authority.d.ts +71 -0
- package/packages/daemon/dist/command-center/owner-authority.js +46 -0
- package/packages/daemon/dist/command-center/pane-stream-issue.d.ts +26 -0
- package/packages/daemon/dist/command-center/pane-stream-issue.js +185 -0
- package/packages/daemon/dist/command-center/resources/agent-graph-overlay.d.ts +45 -0
- package/packages/daemon/dist/command-center/resources/agent-graph-overlay.js +234 -0
- package/packages/daemon/dist/command-center/resources/application-shell.d.ts +201 -0
- package/packages/daemon/dist/command-center/resources/application-shell.js +641 -0
- package/packages/daemon/dist/command-center/resources/desktop-missions.d.ts +10 -0
- package/packages/daemon/dist/command-center/resources/desktop-missions.js +132 -0
- package/packages/daemon/dist/command-center/resources/fleet-catalog.d.ts +25 -0
- package/packages/daemon/dist/command-center/resources/fleet-catalog.js +163 -0
- package/packages/daemon/dist/command-center/resources/fleet-resource-route.d.ts +25 -0
- package/packages/daemon/dist/command-center/resources/fleet-resource-route.js +46 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness-route.d.ts +38 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness-route.js +121 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness.d.ts +57 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness.js +183 -0
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.d.ts +5 -0
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.js +24 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-authority.d.ts +39 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-authority.js +451 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-git.d.ts +63 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-git.js +222 -0
- package/packages/daemon/dist/command-center/resources/workspace-files-authority.d.ts +44 -0
- package/packages/daemon/dist/command-center/resources/workspace-files-authority.js +493 -0
- package/packages/daemon/dist/command-center/resources/workspace-missions-route.d.ts +22 -0
- package/packages/daemon/dist/command-center/resources/workspace-missions-route.js +75 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-ids.d.ts +24 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-ids.js +69 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-routes.d.ts +17 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-routes.js +116 -0
- package/packages/daemon/dist/command-center/schemas.d.ts +1 -1
- package/packages/daemon/dist/command-center/server.d.ts +57 -1
- package/packages/daemon/dist/command-center/server.js +540 -51
- package/packages/daemon/dist/command-center/terminal-attachment-issue.d.ts +22 -0
- package/packages/daemon/dist/command-center/terminal-attachment-issue.js +191 -0
- package/packages/daemon/dist/command-center/workspace-resource-observer.d.ts +50 -0
- package/packages/daemon/dist/command-center/workspace-resource-observer.js +453 -0
- package/packages/daemon/dist/command-center/ws-events.d.ts +82 -7
- package/packages/daemon/dist/command-center/ws-events.js +681 -63
- package/packages/daemon/dist/config.js +31 -25
- package/packages/daemon/dist/control/client.d.ts +23 -0
- package/packages/daemon/dist/control/client.js +105 -0
- package/packages/daemon/dist/control/dispatch.d.ts +34 -0
- package/packages/daemon/dist/control/dispatch.js +83 -0
- package/packages/daemon/dist/control/fanout.d.ts +19 -0
- package/packages/daemon/dist/control/fanout.js +37 -0
- package/packages/daemon/dist/control/frames.d.ts +23 -0
- package/packages/daemon/dist/control/frames.js +37 -0
- package/packages/daemon/dist/control/lifecycle.d.ts +45 -0
- package/packages/daemon/dist/control/lifecycle.js +124 -0
- package/packages/daemon/dist/control/server.d.ts +16 -0
- package/packages/daemon/dist/control/server.js +214 -0
- package/packages/daemon/dist/control/verbs.d.ts +11 -0
- package/packages/daemon/dist/control/verbs.js +91 -0
- package/packages/daemon/dist/detect.js +23 -20
- package/packages/daemon/dist/doctor.d.ts +18 -0
- package/packages/daemon/dist/doctor.js +127 -21
- package/packages/daemon/dist/index.d.ts +21 -2
- package/packages/daemon/dist/index.js +20 -1
- package/packages/daemon/dist/init.js +24 -22
- package/packages/daemon/dist/inspect.d.ts +7 -1
- package/packages/daemon/dist/inspect.js +33 -8
- package/packages/daemon/dist/launch.d.ts +2 -0
- package/packages/daemon/dist/launch.js +38 -26
- package/packages/daemon/dist/lib/__tests__/fixtures/workspace-state-writer.js +58 -0
- package/packages/daemon/dist/lib/agent-discovery.d.ts +27 -2
- package/packages/daemon/dist/lib/agent-discovery.js +29 -14
- package/packages/daemon/dist/lib/agent-kind.d.ts +7 -0
- package/packages/daemon/dist/lib/agent-kind.js +24 -0
- package/packages/daemon/dist/lib/app-config.d.ts +111 -0
- package/packages/daemon/dist/lib/app-config.js +130 -5
- package/packages/daemon/dist/lib/app-window-kernel.d.ts +64 -0
- package/packages/daemon/dist/lib/app-window-kernel.js +556 -0
- package/packages/daemon/dist/lib/app-window-mutation.d.ts +28 -0
- package/packages/daemon/dist/lib/app-window-mutation.js +139 -0
- package/packages/daemon/dist/lib/app-window-repository.d.ts +81 -0
- package/packages/daemon/dist/lib/app-window-repository.js +368 -0
- package/packages/daemon/dist/lib/app-window-state.d.ts +57 -0
- package/packages/daemon/dist/lib/app-window-state.js +415 -0
- package/packages/daemon/dist/lib/application-shell-app-windows.d.ts +16 -0
- package/packages/daemon/dist/lib/application-shell-app-windows.js +285 -0
- package/packages/daemon/dist/lib/auth/middleware.d.ts +1 -1
- package/packages/daemon/dist/lib/auth/middleware.js +7 -3
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.d.ts +25 -0
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.js +174 -0
- package/packages/daemon/dist/lib/canonical-daemon.d.ts +80 -14
- package/packages/daemon/dist/lib/canonical-daemon.js +507 -70
- package/packages/daemon/dist/lib/chrome-front-door.d.ts +7 -0
- package/packages/daemon/dist/lib/chrome-front-door.js +13 -0
- package/packages/daemon/dist/lib/cli-action-bridge.d.ts +8 -3
- package/packages/daemon/dist/lib/cli-action-bridge.js +112 -82
- package/packages/daemon/dist/lib/command-registry.d.ts +37 -0
- package/packages/daemon/dist/lib/command-registry.js +107 -0
- package/packages/daemon/dist/lib/config-context.d.ts +18 -0
- package/packages/daemon/dist/lib/config-context.js +34 -0
- package/packages/daemon/dist/lib/daemon-embed.d.ts +30 -0
- package/packages/daemon/dist/lib/daemon-embed.js +1060 -356
- package/packages/daemon/dist/lib/daemon-session-monitor.d.ts +50 -0
- package/packages/daemon/dist/lib/daemon-session-monitor.js +194 -0
- package/packages/daemon/dist/lib/daemon.js +3 -47
- package/packages/daemon/dist/lib/directory-watcher.d.ts +12 -0
- package/packages/daemon/dist/lib/directory-watcher.js +118 -0
- package/packages/daemon/dist/lib/environment-identity.d.ts +9 -0
- package/packages/daemon/dist/lib/environment-identity.js +79 -0
- package/packages/daemon/dist/lib/errors.d.ts +1 -1
- package/packages/daemon/dist/lib/fleet-agent-lifecycle.d.ts +8 -0
- package/packages/daemon/dist/lib/fleet-agent-lifecycle.js +65 -0
- package/packages/daemon/dist/lib/fleet-lifecycle-authority.d.ts +21 -0
- package/packages/daemon/dist/lib/fleet-lifecycle-authority.js +437 -0
- package/packages/daemon/dist/lib/headless-daemon.d.ts +33 -0
- package/packages/daemon/dist/lib/headless-daemon.js +306 -0
- package/packages/daemon/dist/lib/launch-plan.d.ts +20 -1
- package/packages/daemon/dist/lib/launch-plan.js +96 -1
- package/packages/daemon/dist/lib/legacy-config-adapter.d.ts +12 -0
- package/packages/daemon/dist/lib/legacy-config-adapter.js +19 -0
- package/packages/daemon/dist/lib/legacy-config-migration.d.ts +15 -0
- package/packages/daemon/dist/lib/legacy-config-migration.js +110 -0
- package/packages/daemon/dist/lib/legacy-theme-compat.d.ts +14 -0
- package/packages/daemon/dist/lib/legacy-theme-compat.js +25 -0
- package/packages/daemon/dist/lib/manifest-pack.d.ts +79 -0
- package/packages/daemon/dist/lib/manifest-pack.js +232 -0
- package/packages/daemon/dist/lib/mission-projections.d.ts +24 -0
- package/packages/daemon/dist/lib/mission-projections.js +615 -0
- package/packages/daemon/dist/lib/mission-repository.d.ts +941 -0
- package/packages/daemon/dist/lib/mission-repository.js +775 -0
- package/packages/daemon/dist/lib/onboarding-marker.d.ts +13 -0
- package/packages/daemon/dist/lib/onboarding-marker.js +51 -0
- package/packages/daemon/dist/lib/pane-chrome.d.ts +12 -0
- package/packages/daemon/dist/lib/pane-chrome.js +12 -0
- package/packages/daemon/dist/lib/pane-source-credentials.d.ts +32 -0
- package/packages/daemon/dist/lib/pane-source-credentials.js +178 -0
- package/packages/daemon/dist/lib/pane-widget.d.ts +61 -0
- package/packages/daemon/dist/lib/pane-widget.js +126 -0
- package/packages/daemon/dist/lib/project-inspect.js +4 -0
- package/packages/daemon/dist/lib/project-onboard.d.ts +5 -5
- package/packages/daemon/dist/lib/project-onboard.js +17 -21
- package/packages/daemon/dist/lib/project-probe.d.ts +9 -3
- package/packages/daemon/dist/lib/project-probe.js +28 -22
- package/packages/daemon/dist/lib/project-readiness-probe.d.ts +60 -0
- package/packages/daemon/dist/lib/project-readiness-probe.js +425 -0
- package/packages/daemon/dist/lib/project-readiness.d.ts +157 -0
- package/packages/daemon/dist/lib/project-readiness.js +680 -0
- package/packages/daemon/dist/lib/project-registry.d.ts +8 -0
- package/packages/daemon/dist/lib/project-registry.js +42 -9
- package/packages/daemon/dist/lib/project-resolver.d.ts +77 -0
- package/packages/daemon/dist/lib/project-resolver.js +245 -0
- package/packages/daemon/dist/lib/project-runtime-errors.d.ts +13 -0
- package/packages/daemon/dist/lib/project-runtime-errors.js +21 -0
- package/packages/daemon/dist/lib/project-runtime-repository.d.ts +193 -0
- package/packages/daemon/dist/lib/project-runtime-repository.js +876 -0
- package/packages/daemon/dist/lib/resolved-config.d.ts +48 -0
- package/packages/daemon/dist/lib/resolved-config.js +318 -0
- package/packages/daemon/dist/lib/runtime-namespace.d.ts +34 -0
- package/packages/daemon/dist/lib/runtime-namespace.js +136 -0
- package/packages/daemon/dist/lib/semantic-resource-id.d.ts +7 -0
- package/packages/daemon/dist/lib/semantic-resource-id.js +14 -0
- package/packages/daemon/dist/lib/session-monitor.d.ts +2 -0
- package/packages/daemon/dist/lib/session-monitor.js +29 -23
- package/packages/daemon/dist/lib/session-options.js +3 -10
- package/packages/daemon/dist/lib/state-home.d.ts +2 -0
- package/packages/daemon/dist/lib/state-home.js +11 -0
- package/packages/daemon/dist/lib/theme-mode.d.ts +10 -0
- package/packages/daemon/dist/lib/theme-mode.js +9 -0
- package/packages/daemon/dist/lib/tmux-external-interaction-observer.d.ts +88 -0
- package/packages/daemon/dist/lib/tmux-external-interaction-observer.js +534 -0
- package/packages/daemon/dist/lib/tmux-interaction-options.d.ts +34 -0
- package/packages/daemon/dist/lib/tmux-interaction-options.js +126 -0
- package/packages/daemon/dist/lib/tmux-terminal-color.d.ts +18 -0
- package/packages/daemon/dist/lib/tmux-terminal-color.js +37 -0
- package/packages/daemon/dist/lib/tui-binary.d.ts +30 -5
- package/packages/daemon/dist/lib/tui-binary.js +291 -28
- package/packages/daemon/dist/lib/unix-socket-authority.d.ts +9 -0
- package/packages/daemon/dist/lib/unix-socket-authority.js +48 -0
- package/packages/daemon/dist/lib/update-check.js +5 -0
- package/packages/daemon/dist/lib/widget-asset-policy.d.ts +3 -0
- package/packages/daemon/dist/lib/widget-asset-policy.js +3 -0
- package/packages/daemon/dist/lib/widget-asset-store.d.ts +22 -0
- package/packages/daemon/dist/lib/widget-asset-store.js +166 -0
- package/packages/daemon/dist/lib/workspace-config-loader.d.ts +68 -0
- package/packages/daemon/dist/lib/workspace-config-loader.js +280 -0
- package/packages/daemon/dist/lib/workspace-multiplexer-verbs.d.ts +109 -0
- package/packages/daemon/dist/lib/workspace-multiplexer-verbs.js +1138 -0
- package/packages/daemon/dist/lib/workspace-open-handoff.d.ts +41 -0
- package/packages/daemon/dist/lib/workspace-open-handoff.js +219 -0
- package/packages/daemon/dist/lib/workspace-open.d.ts +44 -0
- package/packages/daemon/dist/lib/workspace-open.js +740 -0
- package/packages/daemon/dist/lib/workspace-pane-creation.d.ts +64 -0
- package/packages/daemon/dist/lib/workspace-pane-creation.js +1107 -0
- package/packages/daemon/dist/lib/workspace-promotion.d.ts +41 -0
- package/packages/daemon/dist/lib/workspace-promotion.js +804 -0
- package/packages/daemon/dist/lib/workspace-registry.d.ts +49 -2
- package/packages/daemon/dist/lib/workspace-registry.js +150 -23
- package/packages/daemon/dist/lib/workspace-state-repository.d.ts +139 -0
- package/packages/daemon/dist/lib/workspace-state-repository.js +790 -0
- package/packages/daemon/dist/lib/workspace-state.d.ts +37 -0
- package/packages/daemon/dist/lib/workspace-state.js +765 -0
- package/packages/daemon/dist/lib/yaml-io.js +4 -18
- package/packages/daemon/dist/migrate.d.ts +11 -0
- package/packages/daemon/dist/migrate.js +105 -0
- package/packages/daemon/dist/restart.js +2 -2
- package/packages/daemon/dist/restore.d.ts +40 -13
- package/packages/daemon/dist/restore.js +62 -21
- package/packages/daemon/dist/schemas/inspect.d.ts +8 -0
- package/packages/daemon/dist/schemas/inspect.js +9 -1
- package/packages/daemon/dist/schemas/registry.d.ts +18 -4
- package/packages/daemon/dist/schemas/registry.js +5 -19
- package/packages/daemon/dist/schemas/ws-events.d.ts +5 -69
- package/packages/daemon/dist/schemas/ws-events.js +4 -107
- package/packages/daemon/dist/send.d.ts +41 -1
- package/packages/daemon/dist/send.js +136 -20
- package/packages/daemon/dist/server/pane-stream-upgrade.d.ts +12 -0
- package/packages/daemon/dist/server/pane-stream-upgrade.js +117 -0
- package/packages/daemon/dist/server/terminal-attachment-upgrade.d.ts +11 -0
- package/packages/daemon/dist/server/terminal-attachment-upgrade.js +121 -0
- package/packages/daemon/dist/status.js +11 -8
- package/packages/daemon/dist/stop.js +2 -2
- package/packages/daemon/dist/terminal/MonotonicPtyInput.d.ts +30 -0
- package/packages/daemon/dist/terminal/MonotonicPtyInput.js +130 -0
- package/packages/daemon/dist/terminal/NodePtyAdapter.d.ts +9 -3
- package/packages/daemon/dist/terminal/NodePtyAdapter.js +37 -10
- package/packages/daemon/dist/terminal/PtyAdapter.d.ts +93 -3
- package/packages/daemon/dist/terminal/PtyAdapter.js +18 -0
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.d.ts +14 -4
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.js +33 -6
- package/packages/daemon/dist/terminal/attachments/admission-util.d.ts +14 -0
- package/packages/daemon/dist/terminal/attachments/admission-util.js +87 -0
- package/packages/daemon/dist/terminal/attachments/agent-status-probe.d.ts +102 -0
- package/packages/daemon/dist/terminal/attachments/agent-status-probe.js +325 -0
- package/packages/daemon/dist/terminal/attachments/direct-websocket.d.ts +141 -0
- package/packages/daemon/dist/terminal/attachments/direct-websocket.js +1069 -0
- package/packages/daemon/dist/terminal/attachments/grouped-tmux.d.ts +106 -0
- package/packages/daemon/dist/terminal/attachments/grouped-tmux.js +213 -0
- package/packages/daemon/dist/terminal/attachments/lease-manager.d.ts +188 -0
- package/packages/daemon/dist/terminal/attachments/lease-manager.js +655 -0
- package/packages/daemon/dist/terminal/attachments/native-runtime.d.ts +196 -0
- package/packages/daemon/dist/terminal/attachments/native-runtime.js +1564 -0
- package/packages/daemon/dist/terminal/attachments/pty-tmux-attachment-launcher.d.ts +66 -0
- package/packages/daemon/dist/terminal/attachments/pty-tmux-attachment-launcher.js +607 -0
- package/packages/daemon/dist/terminal/attachments/semantic-pane-catalog.d.ts +81 -0
- package/packages/daemon/dist/terminal/attachments/semantic-pane-catalog.js +208 -0
- package/packages/daemon/dist/terminal/attachments/tmux-view-executor.d.ts +111 -0
- package/packages/daemon/dist/terminal/attachments/tmux-view-executor.js +825 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/scripted-channel.d.ts +25 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/scripted-channel.js +80 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/simulated-channel.d.ts +66 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/simulated-channel.js +133 -0
- package/packages/daemon/dist/terminal/mirror/control-channel.d.ts +188 -0
- package/packages/daemon/dist/terminal/mirror/control-channel.js +624 -0
- package/packages/daemon/dist/terminal/mirror/control-mode-ownership.d.ts +14 -0
- package/packages/daemon/dist/terminal/mirror/control-mode-ownership.js +30 -0
- package/packages/daemon/dist/terminal/mirror/events.d.ts +115 -0
- package/packages/daemon/dist/terminal/mirror/events.js +18 -0
- package/packages/daemon/dist/terminal/mirror/flow-ledger.d.ts +40 -0
- package/packages/daemon/dist/terminal/mirror/flow-ledger.js +56 -0
- package/packages/daemon/dist/terminal/mirror/mirror-service.d.ts +137 -0
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +329 -0
- package/packages/daemon/dist/terminal/mirror/pane-feed.d.ts +90 -0
- package/packages/daemon/dist/terminal/mirror/pane-feed.js +140 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.d.ts +216 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.js +2301 -0
- package/packages/daemon/dist/terminal/mirror/trusted-inventory.d.ts +28 -0
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.d.ts +72 -0
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +245 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.d.ts +208 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +2058 -0
- package/packages/daemon/dist/terminal/pane-stream/runtime.d.ts +26 -0
- package/packages/daemon/dist/terminal/pane-stream/runtime.js +53 -0
- package/packages/daemon/dist/terminal/pane-stream/wire-ledger.d.ts +59 -0
- package/packages/daemon/dist/terminal/pane-stream/wire-ledger.js +110 -0
- package/packages/daemon/dist/terminal/protocol/chunk-bytes.d.ts +3 -0
- package/packages/daemon/dist/terminal/protocol/chunk-bytes.js +21 -0
- package/packages/daemon/dist/terminal/protocol/control.d.ts +66 -0
- package/packages/daemon/dist/terminal/protocol/control.js +111 -0
- package/packages/daemon/dist/terminal/protocol/input-coalescer.d.ts +55 -0
- package/packages/daemon/dist/terminal/protocol/input-coalescer.js +111 -0
- package/packages/daemon/dist/terminal/protocol/layout-parse.d.ts +68 -0
- package/packages/daemon/dist/terminal/protocol/layout-parse.js +127 -0
- package/packages/daemon/dist/terminal/protocol/pane-display-name.d.ts +16 -0
- package/packages/daemon/dist/terminal/protocol/pane-display-name.js +153 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.d.ts +78 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +294 -0
- package/packages/daemon/dist/terminal/protocol/workspace-tmux-adapter.d.ts +90 -0
- package/packages/daemon/dist/terminal/protocol/workspace-tmux-adapter.js +213 -0
- package/packages/daemon/dist/terminal/session-runtime/authority-arbiter.d.ts +36 -0
- package/packages/daemon/dist/terminal/session-runtime/authority-arbiter.js +260 -0
- package/packages/daemon/dist/terminal/session-runtime/causal-cell-ledger.d.ts +29 -0
- package/packages/daemon/dist/terminal/session-runtime/causal-cell-ledger.js +278 -0
- package/packages/daemon/dist/terminal/session-runtime/interaction-receipt-facts.d.ts +12 -0
- package/packages/daemon/dist/terminal/session-runtime/interaction-receipt-facts.js +147 -0
- package/packages/daemon/dist/terminal/session-runtime/multiplexer-backend.d.ts +16 -0
- package/packages/daemon/dist/terminal/session-runtime/multiplexer-backend.js +116 -0
- package/packages/daemon/dist/terminal/session-runtime/registry.d.ts +148 -0
- package/packages/daemon/dist/terminal/session-runtime/registry.js +1368 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-observability.d.ts +118 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-observability.js +72 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-scheduler.d.ts +11 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-scheduler.js +10 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-trace-correlator.d.ts +18 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-trace-correlator.js +48 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-executor.d.ts +69 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-executor.js +353 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-resource-changes.d.ts +8 -0
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-resource-changes.js +32 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.d.ts +91 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +1362 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-observation-identity.d.ts +3 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-observation-identity.js +9 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-interpreter-backend.d.ts +55 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.d.ts +91 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +528 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.d.ts +50 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.js +387 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-shadow-projections.d.ts +37 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-shadow-projections.js +21 -0
- package/packages/daemon/dist/terminal/session-runtime/transport-binding.d.ts +75 -0
- package/packages/daemon/dist/terminal/session-runtime/transport-binding.js +474 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.d.ts +26 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +276 -0
- package/packages/daemon/dist/tui/async-disposable-slot.d.ts +18 -0
- package/packages/daemon/dist/tui/async-disposable-slot.js +57 -0
- package/packages/daemon/dist/tui/chrome/cheatsheet.d.ts +59 -0
- package/packages/daemon/dist/tui/chrome/cheatsheet.js +211 -0
- package/packages/daemon/dist/tui/chrome/chip.d.ts +21 -0
- package/packages/daemon/dist/tui/chrome/chip.js +25 -0
- package/packages/daemon/dist/tui/chrome/events.d.ts +51 -0
- package/packages/daemon/dist/tui/chrome/events.js +94 -0
- package/packages/daemon/dist/tui/chrome/front-door.d.ts +16 -0
- package/packages/daemon/dist/tui/chrome/front-door.js +16 -0
- package/packages/daemon/dist/tui/chrome/kitty-keys.d.ts +41 -0
- package/packages/daemon/dist/tui/chrome/kitty-keys.js +54 -0
- package/packages/daemon/dist/tui/chrome/menu.d.ts +92 -0
- package/packages/daemon/dist/tui/chrome/menu.js +251 -0
- package/packages/daemon/dist/tui/chrome/notify-prefs.d.ts +47 -0
- package/packages/daemon/dist/tui/chrome/notify-prefs.js +13 -0
- package/packages/daemon/dist/tui/chrome/notify-state.d.ts +13 -0
- package/packages/daemon/dist/tui/chrome/notify-state.js +77 -0
- package/packages/daemon/dist/tui/chrome/notify.d.ts +361 -0
- package/packages/daemon/dist/tui/chrome/notify.js +711 -0
- package/packages/daemon/dist/tui/chrome/panels.d.ts +72 -0
- package/packages/daemon/dist/tui/chrome/panels.js +60 -0
- package/packages/daemon/dist/tui/chrome/sidebar.d.ts +77 -0
- package/packages/daemon/dist/tui/chrome/sidebar.js +183 -0
- package/packages/daemon/dist/tui/chrome/snapshot.d.ts +110 -0
- package/packages/daemon/dist/tui/chrome/snapshot.js +290 -0
- package/packages/daemon/dist/tui/chrome/statusline.d.ts +237 -0
- package/packages/daemon/dist/tui/chrome/statusline.js +552 -0
- package/packages/daemon/dist/tui/chrome/updater.d.ts +230 -0
- package/packages/daemon/dist/tui/chrome/updater.js +651 -0
- package/packages/daemon/dist/tui/chrome/welcome.d.ts +41 -0
- package/packages/daemon/dist/tui/chrome/welcome.js +117 -0
- package/packages/daemon/dist/tui/compiled.d.ts +86 -0
- package/packages/daemon/dist/tui/compiled.js +165 -0
- package/packages/daemon/dist/tui/detect/agent-resolution.d.ts +56 -0
- package/packages/daemon/dist/tui/detect/agent-resolution.js +60 -0
- package/packages/daemon/dist/tui/detect/classify.d.ts +107 -0
- package/packages/daemon/dist/tui/detect/classify.js +184 -0
- package/packages/daemon/dist/tui/detect/manifest-loader.d.ts +54 -0
- package/packages/daemon/dist/tui/detect/manifest-loader.js +242 -0
- package/packages/daemon/dist/tui/detect/manifest.d.ts +111 -0
- package/packages/daemon/dist/tui/detect/manifest.js +126 -0
- package/packages/daemon/dist/tui/detect/manifests.d.ts +40 -0
- package/packages/daemon/dist/tui/detect/manifests.js +535 -0
- package/packages/daemon/dist/tui/detect/process-tree.d.ts +96 -0
- package/packages/daemon/dist/tui/detect/process-tree.js +194 -0
- package/packages/daemon/dist/tui/detect/session-id.d.ts +110 -0
- package/packages/daemon/dist/tui/detect/session-id.js +414 -0
- package/packages/daemon/dist/tui/detect/snapshot.d.ts +27 -0
- package/packages/daemon/dist/tui/detect/snapshot.js +81 -0
- package/packages/daemon/dist/tui/integrations/claude.d.ts +65 -0
- package/packages/daemon/dist/tui/integrations/claude.js +151 -0
- package/packages/daemon/dist/tui/integrations/offer.d.ts +47 -0
- package/packages/daemon/dist/tui/integrations/offer.js +134 -0
- package/packages/daemon/dist/tui/integrations/opencode.d.ts +37 -0
- package/packages/daemon/dist/tui/integrations/opencode.js +117 -0
- package/packages/daemon/dist/tui/mirror/ack-writer.d.ts +36 -0
- package/packages/daemon/dist/tui/mirror/ack-writer.js +78 -0
- package/packages/daemon/dist/tui/mirror/activity-surface-view.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/activity-surface-view.jsx +69 -0
- package/packages/daemon/dist/tui/mirror/activity-surface.d.ts +103 -0
- package/packages/daemon/dist/tui/mirror/activity-surface.js +271 -0
- package/packages/daemon/dist/tui/mirror/agent-chip.d.ts +76 -0
- package/packages/daemon/dist/tui/mirror/agent-chip.js +84 -0
- package/packages/daemon/dist/tui/mirror/agent-lifecycle.d.ts +217 -0
- package/packages/daemon/dist/tui/mirror/agent-lifecycle.js +372 -0
- package/packages/daemon/dist/tui/mirror/agent-provisioning-executor.d.ts +42 -0
- package/packages/daemon/dist/tui/mirror/agent-provisioning-executor.js +86 -0
- package/packages/daemon/dist/tui/mirror/agent-rows.d.ts +119 -0
- package/packages/daemon/dist/tui/mirror/agent-rows.js +126 -0
- package/packages/daemon/dist/tui/mirror/ansi-palette.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/ansi-palette.js +3 -0
- package/packages/daemon/dist/tui/mirror/app-state.d.ts +114 -0
- package/packages/daemon/dist/tui/mirror/app-state.js +294 -0
- package/packages/daemon/dist/tui/mirror/application-keybindings.d.ts +18 -0
- package/packages/daemon/dist/tui/mirror/application-keybindings.js +33 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-connection.d.ts +53 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-connection.js +253 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-session.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-session.js +45 -0
- package/packages/daemon/dist/tui/mirror/attention.d.ts +63 -0
- package/packages/daemon/dist/tui/mirror/attention.js +59 -0
- package/packages/daemon/dist/tui/mirror/blit.d.ts +82 -0
- package/packages/daemon/dist/tui/mirror/blit.js +120 -0
- package/packages/daemon/dist/tui/mirror/canonical-workspace-routing.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/canonical-workspace-routing.js +45 -0
- package/packages/daemon/dist/tui/mirror/changes-surface-view.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/changes-surface-view.jsx +92 -0
- package/packages/daemon/dist/tui/mirror/changes-surface.d.ts +115 -0
- package/packages/daemon/dist/tui/mirror/changes-surface.js +210 -0
- package/packages/daemon/dist/tui/mirror/composite-layout.d.ts +91 -0
- package/packages/daemon/dist/tui/mirror/composite-layout.js +539 -0
- package/packages/daemon/dist/tui/mirror/configless-session-bootstrap.d.ts +39 -0
- package/packages/daemon/dist/tui/mirror/configless-session-bootstrap.js +133 -0
- package/packages/daemon/dist/tui/mirror/dialog-model.d.ts +154 -0
- package/packages/daemon/dist/tui/mirror/dialog-model.js +183 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack-core.d.ts +45 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack-core.js +232 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack.d.ts +2 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack.js +2 -0
- package/packages/daemon/dist/tui/mirror/diff-model.d.ts +169 -0
- package/packages/daemon/dist/tui/mirror/diff-model.js +332 -0
- package/packages/daemon/dist/tui/mirror/editor-buffer.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/editor-buffer.js +47 -0
- package/packages/daemon/dist/tui/mirror/editor-open-policy.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/editor-open-policy.js +9 -0
- package/packages/daemon/dist/tui/mirror/features/changes/contract.d.ts +75 -0
- package/packages/daemon/dist/tui/mirror/features/changes/controller.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/features/changes/controller.js +454 -0
- package/packages/daemon/dist/tui/mirror/features/changes/feature.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/features/changes/feature.jsx +9 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/contract.d.ts +47 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/feature.d.ts +12 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/feature.jsx +123 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/session.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/session.js +160 -0
- package/packages/daemon/dist/tui/mirror/features/files/feature.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/features/files/feature.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/features/files/session.d.ts +133 -0
- package/packages/daemon/dist/tui/mirror/features/files/session.js +617 -0
- package/packages/daemon/dist/tui/mirror/features/home/feature.d.ts +28 -0
- package/packages/daemon/dist/tui/mirror/features/home/feature.jsx +122 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/contract.d.ts +84 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/contract.js +3 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/feature.d.ts +6 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/feature.jsx +5 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/session.d.ts +5 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/session.js +377 -0
- package/packages/daemon/dist/tui/mirror/features/palette/contract.d.ts +116 -0
- package/packages/daemon/dist/tui/mirror/features/palette/contract.js +9 -0
- package/packages/daemon/dist/tui/mirror/features/palette/feature.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/features/palette/feature.js +3 -0
- package/packages/daemon/dist/tui/mirror/features/palette/session.d.ts +2 -0
- package/packages/daemon/dist/tui/mirror/features/palette/session.js +393 -0
- package/packages/daemon/dist/tui/mirror/features/palette/surface.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/features/palette/surface.jsx +48 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/contract.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/feature.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/feature.jsx +2 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/session.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/session.js +148 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/surface.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/surface.jsx +64 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/asset-loader.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/asset-loader.js +125 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/contract.d.ts +71 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/feature.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/feature.jsx +103 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/session.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/session.js +310 -0
- package/packages/daemon/dist/tui/mirror/features/settings/catalog.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/features/settings/catalog.js +10 -0
- package/packages/daemon/dist/tui/mirror/features/settings/contract.d.ts +35 -0
- package/packages/daemon/dist/tui/mirror/features/settings/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/settings/feature.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/features/settings/feature.js +2 -0
- package/packages/daemon/dist/tui/mirror/features/settings/session.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/features/settings/session.js +309 -0
- package/packages/daemon/dist/tui/mirror/file-tree.d.ts +142 -0
- package/packages/daemon/dist/tui/mirror/file-tree.js +283 -0
- package/packages/daemon/dist/tui/mirror/files-surface-view.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/files-surface-view.jsx +92 -0
- package/packages/daemon/dist/tui/mirror/files-surface.d.ts +123 -0
- package/packages/daemon/dist/tui/mirror/files-surface.js +237 -0
- package/packages/daemon/dist/tui/mirror/focus-projection.d.ts +20 -0
- package/packages/daemon/dist/tui/mirror/focus-projection.js +80 -0
- package/packages/daemon/dist/tui/mirror/folder-picker.d.ts +38 -0
- package/packages/daemon/dist/tui/mirror/folder-picker.js +114 -0
- package/packages/daemon/dist/tui/mirror/frame-coalescer.d.ts +29 -0
- package/packages/daemon/dist/tui/mirror/frame-coalescer.js +74 -0
- package/packages/daemon/dist/tui/mirror/home-model.d.ts +81 -0
- package/packages/daemon/dist/tui/mirror/home-model.js +125 -0
- package/packages/daemon/dist/tui/mirror/home-surface-model.d.ts +113 -0
- package/packages/daemon/dist/tui/mirror/home-surface-model.js +297 -0
- package/packages/daemon/dist/tui/mirror/home-surface.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/home-surface.jsx +110 -0
- package/packages/daemon/dist/tui/mirror/host-terminal.d.ts +28 -0
- package/packages/daemon/dist/tui/mirror/host-terminal.js +33 -0
- package/packages/daemon/dist/tui/mirror/hosted.d.ts +179 -0
- package/packages/daemon/dist/tui/mirror/hosted.js +239 -0
- package/packages/daemon/dist/tui/mirror/input-lifecycle.d.ts +140 -0
- package/packages/daemon/dist/tui/mirror/input-lifecycle.js +147 -0
- package/packages/daemon/dist/tui/mirror/interaction-flow.d.ts +30 -0
- package/packages/daemon/dist/tui/mirror/interaction-flow.js +41 -0
- package/packages/daemon/dist/tui/mirror/legacy/missions-workspace-loader.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/legacy/missions-workspace-loader.js +84 -0
- package/packages/daemon/dist/tui/mirror/menu-model.d.ts +89 -0
- package/packages/daemon/dist/tui/mirror/menu-model.js +143 -0
- package/packages/daemon/dist/tui/mirror/missions-dashboard.d.ts +68 -0
- package/packages/daemon/dist/tui/mirror/missions-dashboard.js +261 -0
- package/packages/daemon/dist/tui/mirror/missions-render-fixtures.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/missions-render-fixtures.js +330 -0
- package/packages/daemon/dist/tui/mirror/missions-surface-controller.d.ts +84 -0
- package/packages/daemon/dist/tui/mirror/missions-surface-controller.js +314 -0
- package/packages/daemon/dist/tui/mirror/missions-surface.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/missions-surface.jsx +239 -0
- package/packages/daemon/dist/tui/mirror/missions-workspace.d.ts +341 -0
- package/packages/daemon/dist/tui/mirror/missions-workspace.js +1399 -0
- package/packages/daemon/dist/tui/mirror/multiplexer-action-executor.d.ts +71 -0
- package/packages/daemon/dist/tui/mirror/multiplexer-action-executor.js +233 -0
- package/packages/daemon/dist/tui/mirror/open-tui-pane-stream-socket.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/open-tui-pane-stream-socket.js +32 -0
- package/packages/daemon/dist/tui/mirror/open-tui-verified-routing.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/open-tui-verified-routing.js +45 -0
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.d.ts +36 -0
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.js +1069 -0
- package/packages/daemon/dist/tui/mirror/palette-surface-adapter.d.ts +58 -0
- package/packages/daemon/dist/tui/mirror/palette-surface-adapter.js +384 -0
- package/packages/daemon/dist/tui/mirror/palette.d.ts +315 -0
- package/packages/daemon/dist/tui/mirror/palette.js +522 -0
- package/packages/daemon/dist/tui/mirror/pane-frame-state.d.ts +68 -0
- package/packages/daemon/dist/tui/mirror/pane-frame-state.js +124 -0
- package/packages/daemon/dist/tui/mirror/pane-mirror.d.ts +205 -0
- package/packages/daemon/dist/tui/mirror/pane-mirror.js +584 -0
- package/packages/daemon/dist/tui/mirror/pane-surface.d.ts +257 -0
- package/packages/daemon/dist/tui/mirror/pane-surface.jsx +855 -0
- package/packages/daemon/dist/tui/mirror/panel-host-reactive.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/panel-host-reactive.js +13 -0
- package/packages/daemon/dist/tui/mirror/panel-host.d.ts +69 -0
- package/packages/daemon/dist/tui/mirror/panel-host.js +242 -0
- package/packages/daemon/dist/tui/mirror/perf-tap.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/perf-tap.js +32 -0
- package/packages/daemon/dist/tui/mirror/performance-events.d.ts +404 -0
- package/packages/daemon/dist/tui/mirror/performance-events.js +46 -0
- package/packages/daemon/dist/tui/mirror/recipe-components.d.ts +93 -0
- package/packages/daemon/dist/tui/mirror/recipe-components.jsx +135 -0
- package/packages/daemon/dist/tui/mirror/recipes.d.ts +90 -0
- package/packages/daemon/dist/tui/mirror/recipes.js +395 -0
- package/packages/daemon/dist/tui/mirror/reference-performance-trace.d.ts +80 -0
- package/packages/daemon/dist/tui/mirror/reference-performance-trace.js +597 -0
- package/packages/daemon/dist/tui/mirror/renderer-commands.d.ts +60 -0
- package/packages/daemon/dist/tui/mirror/renderer-commands.js +250 -0
- package/packages/daemon/dist/tui/mirror/resize-model.d.ts +76 -0
- package/packages/daemon/dist/tui/mirror/resize-model.js +105 -0
- package/packages/daemon/dist/tui/mirror/resize-transaction.d.ts +102 -0
- package/packages/daemon/dist/tui/mirror/resize-transaction.js +221 -0
- package/packages/daemon/dist/tui/mirror/rich-placement-projection.d.ts +64 -0
- package/packages/daemon/dist/tui/mirror/rich-placement-projection.js +80 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-appearance-owner.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-appearance-owner.js +79 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-bootstrap.d.ts +61 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-bootstrap.js +51 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-generation-starter.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-generation-starter.js +80 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog-owner.d.ts +21 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog-owner.js +88 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog.d.ts +60 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog.js +320 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-binding.d.ts +28 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-binding.js +111 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-capability.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-control-capability.js +25 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-presentation.d.ts +38 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-presentation.js +129 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-test-control.d.ts +43 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-host-focus-test-control.js +242 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-input-readiness.d.ts +5 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-input-readiness.js +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-lifecycle.d.ts +72 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-lifecycle.js +297 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-optional-features.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-optional-features.js +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-command-owner.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-command-owner.js +61 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-input.d.ts +31 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-input.js +60 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-input.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-input.js +30 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-owner.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-owner.js +38 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pending-terminal-input.d.ts +53 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pending-terminal-input.js +74 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-performance-log.d.ts +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-performance-log.js +81 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-post-render-runtime.d.ts +37 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-post-render-runtime.js +117 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-configuration.d.ts +21 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-configuration.js +21 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-renderer.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-renderer.js +27 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-session-focus-owner.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-session-focus-owner.js +65 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-binding.d.ts +34 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-binding.js +307 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-viewport.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-viewport.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-frame-readiness-owner.d.ts +6 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-frame-readiness-owner.js +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-host-focus-owner.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-host-focus-owner.js +25 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-input-ingress.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-input-ingress.js +96 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.d.ts +65 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +1326 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-palette-owner.d.ts +65 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-palette-owner.js +217 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-paste.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-paste.js +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-renderer-sources.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-renderer-sources.js +31 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-selection-owner.d.ts +47 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-selection-owner.js +161 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace-policy.d.ts +44 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace-policy.js +177 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace.d.ts +103 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace.jsx +720 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-theme-repaint.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-theme-repaint.js +34 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-transient-note-owner.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-transient-note-owner.js +29 -0
- package/packages/daemon/dist/tui/mirror/runtime/bounded-performance-record-writer.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/bounded-performance-record-writer.js +67 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-client-ledger.d.ts +64 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-client-ledger.js +271 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-input-fixture.d.ts +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/causal-cell-input-fixture.js +43 -0
- package/packages/daemon/dist/tui/mirror/runtime/changes-deferred-identity.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/changes-deferred-identity.js +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/daemon-authority-rebind.d.ts +29 -0
- package/packages/daemon/dist/tui/mirror/runtime/daemon-authority-rebind.js +128 -0
- package/packages/daemon/dist/tui/mirror/runtime/deferred-intent-queue.d.ts +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/deferred-intent-queue.js +40 -0
- package/packages/daemon/dist/tui/mirror/runtime/editor-primitives.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/editor-primitives.js +39 -0
- package/packages/daemon/dist/tui/mirror/runtime/file-content-primitives.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/file-content-primitives.js +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/fleet-lifecycle-client.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/fleet-lifecycle-client.js +27 -0
- package/packages/daemon/dist/tui/mirror/runtime/focus-framebuffer-projection.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/runtime/focus-framebuffer-projection.js +53 -0
- package/packages/daemon/dist/tui/mirror/runtime/generation-bound-slot.d.ts +7 -0
- package/packages/daemon/dist/tui/mirror/runtime/generation-bound-slot.js +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/host-local-tmux-adapter.d.ts +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/host-local-tmux-adapter.js +90 -0
- package/packages/daemon/dist/tui/mirror/runtime/hosted-tty-size-bridge.d.ts +55 -0
- package/packages/daemon/dist/tui/mirror/runtime/hosted-tty-size-bridge.js +166 -0
- package/packages/daemon/dist/tui/mirror/runtime/latest-intent-fence.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/latest-intent-fence.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/local-view-controller.d.ts +30 -0
- package/packages/daemon/dist/tui/mirror/runtime/local-view-controller.js +58 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-admission-coordinator.d.ts +44 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-admission-coordinator.js +118 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-pointer-capture.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-pointer-capture.js +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-generation-host.d.ts +68 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-generation-host.js +834 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-session-owner.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-session-owner.js +146 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.d.ts +45 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.js +178 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.typecheck.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/optional-feature-registry.typecheck.js +1 -0
- package/packages/daemon/dist/tui/mirror/runtime/palette-production-controller.d.ts +55 -0
- package/packages/daemon/dist/tui/mirror/runtime/palette-production-controller.js +126 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-resize-geometry.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-resize-geometry.js +13 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-scoped-terminal-surface.d.ts +42 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-scoped-terminal-surface.jsx +67 -0
- package/packages/daemon/dist/tui/mirror/runtime/product-surface-policy.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/runtime/product-surface-policy.js +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/renderer-cadence.d.ts +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/renderer-cadence.js +4 -0
- package/packages/daemon/dist/tui/mirror/runtime/resize-terminal-pane.d.ts +35 -0
- package/packages/daemon/dist/tui/mirror/runtime/resize-terminal-pane.js +91 -0
- package/packages/daemon/dist/tui/mirror/runtime/rich-preview-demand.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/rich-preview-demand.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/runtime-layout-presentation.d.ts +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/runtime-layout-presentation.js +111 -0
- package/packages/daemon/dist/tui/mirror/runtime/select-terminal-pane.d.ts +25 -0
- package/packages/daemon/dist/tui/mirror/runtime/select-terminal-pane.js +90 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-pane-publication.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-pane-publication.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-shell-viewport-resize.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/runtime/semantic-shell-viewport-resize.js +56 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-dimensions-owner.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-dimensions-owner.js +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.d.ts +52 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.js +610 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-frame-readiness.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-frame-readiness.js +84 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-focus.d.ts +41 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-focus.js +347 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-frame-diagnostics.d.ts +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-host-frame-diagnostics.js +37 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-input-adapter.d.ts +10 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-input-adapter.js +50 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-layout-projection.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-layout-projection.js +28 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-pane-input-router.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-pane-input-router.js +82 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-selection.d.ts +66 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-selection.js +141 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-session-handoff.d.ts +50 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-session-handoff.js +89 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-tool-readiness.d.ts +31 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-tool-readiness.js +64 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-controller.d.ts +92 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-controller.js +636 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-projection.d.ts +59 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-projection.js +169 -0
- package/packages/daemon/dist/tui/mirror/runtime/viewport-fit-coordinator.d.ts +8 -0
- package/packages/daemon/dist/tui/mirror/runtime/viewport-fit-coordinator.js +7 -0
- package/packages/daemon/dist/tui/mirror/runtime/workspace-terminal-fast-lane.d.ts +22 -0
- package/packages/daemon/dist/tui/mirror/runtime/workspace-terminal-fast-lane.js +498 -0
- package/packages/daemon/dist/tui/mirror/scrollbar-model.d.ts +35 -0
- package/packages/daemon/dist/tui/mirror/scrollbar-model.js +64 -0
- package/packages/daemon/dist/tui/mirror/search-model.d.ts +41 -0
- package/packages/daemon/dist/tui/mirror/search-model.js +62 -0
- package/packages/daemon/dist/tui/mirror/selection.d.ts +175 -0
- package/packages/daemon/dist/tui/mirror/selection.js +264 -0
- package/packages/daemon/dist/tui/mirror/semantic-pane-render-source.d.ts +147 -0
- package/packages/daemon/dist/tui/mirror/semantic-pane-render-source.js +562 -0
- package/packages/daemon/dist/tui/mirror/semantic-session-view.d.ts +86 -0
- package/packages/daemon/dist/tui/mirror/semantic-session-view.js +269 -0
- package/packages/daemon/dist/tui/mirror/settings-model.d.ts +108 -0
- package/packages/daemon/dist/tui/mirror/settings-model.js +304 -0
- package/packages/daemon/dist/tui/mirror/shell-chrome.d.ts +151 -0
- package/packages/daemon/dist/tui/mirror/shell-chrome.js +313 -0
- package/packages/daemon/dist/tui/mirror/size-truth.d.ts +92 -0
- package/packages/daemon/dist/tui/mirror/size-truth.js +104 -0
- package/packages/daemon/dist/tui/mirror/spans.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/spans.js +31 -0
- package/packages/daemon/dist/tui/mirror/status-grammar.d.ts +18 -0
- package/packages/daemon/dist/tui/mirror/status-grammar.js +29 -0
- package/packages/daemon/dist/tui/mirror/terminal-surface.d.ts +55 -0
- package/packages/daemon/dist/tui/mirror/terminal-surface.js +92 -0
- package/packages/daemon/dist/tui/mirror/terminal-text.d.ts +9 -0
- package/packages/daemon/dist/tui/mirror/terminal-text.js +38 -0
- package/packages/daemon/dist/tui/mirror/theme.d.ts +207 -0
- package/packages/daemon/dist/tui/mirror/theme.js +744 -0
- package/packages/daemon/dist/tui/mirror/ui/agent-badge.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/ui/agent-badge.jsx +14 -0
- package/packages/daemon/dist/tui/mirror/ui/badge.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/ui/badge.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/ui/button.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/ui/button.jsx +66 -0
- package/packages/daemon/dist/tui/mirror/ui/dialog.d.ts +19 -0
- package/packages/daemon/dist/tui/mirror/ui/dialog.jsx +8 -0
- package/packages/daemon/dist/tui/mirror/ui/index.d.ts +16 -0
- package/packages/daemon/dist/tui/mirror/ui/index.js +16 -0
- package/packages/daemon/dist/tui/mirror/ui/key-hint.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/ui/key-hint.jsx +39 -0
- package/packages/daemon/dist/tui/mirror/ui/keyboard-router.d.ts +25 -0
- package/packages/daemon/dist/tui/mirror/ui/keyboard-router.jsx +46 -0
- package/packages/daemon/dist/tui/mirror/ui/menu.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/ui/menu.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/ui/navigation-row.d.ts +21 -0
- package/packages/daemon/dist/tui/mirror/ui/navigation-row.jsx +62 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-frame.d.ts +25 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-frame.jsx +52 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-host.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-host.jsx +33 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-list-row.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-list-row.jsx +23 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-model.d.ts +29 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-model.js +45 -0
- package/packages/daemon/dist/tui/mirror/ui/state.d.ts +27 -0
- package/packages/daemon/dist/tui/mirror/ui/state.js +171 -0
- package/packages/daemon/dist/tui/mirror/ui/status-bar.d.ts +43 -0
- package/packages/daemon/dist/tui/mirror/ui/status-bar.jsx +102 -0
- package/packages/daemon/dist/tui/mirror/ui/surface.d.ts +14 -0
- package/packages/daemon/dist/tui/mirror/ui/surface.jsx +45 -0
- package/packages/daemon/dist/tui/mirror/ui/tabs.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/ui/tabs.jsx +88 -0
- package/packages/daemon/dist/tui/mirror/widget-fallback.d.ts +15 -0
- package/packages/daemon/dist/tui/mirror/widget-fallback.js +52 -0
- package/packages/daemon/dist/tui/mirror/widget-surface-model.d.ts +26 -0
- package/packages/daemon/dist/tui/mirror/widget-surface-model.js +145 -0
- package/packages/daemon/dist/tui/mirror/widget-surface.d.ts +13 -0
- package/packages/daemon/dist/tui/mirror/widget-surface.jsx +31 -0
- package/packages/daemon/dist/tui/mirror/workspace/agent-terminal-canvas.d.ts +53 -0
- package/packages/daemon/dist/tui/mirror/workspace/agent-terminal-canvas.js +77 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-root-controller.d.ts +266 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-root-controller.js +99 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-controller.d.ts +83 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-controller.js +292 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-surface-commands.d.ts +5 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell-surface-commands.js +28 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell.d.ts +49 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell.js +97 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface-view.d.ts +11 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface-view.jsx +158 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface.d.ts +128 -0
- package/packages/daemon/dist/tui/mirror/workspace/command-palette-surface.js +342 -0
- package/packages/daemon/dist/tui/mirror/workspace/icons.d.ts +154 -0
- package/packages/daemon/dist/tui/mirror/workspace/icons.js +43 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-action-menu.d.ts +24 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-action-menu.jsx +20 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-frame.d.ts +143 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-frame.js +452 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-chrome.d.ts +152 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-chrome.js +555 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-header.d.ts +58 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-header.jsx +93 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-window-strip.d.ts +75 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-window-strip.jsx +253 -0
- package/packages/daemon/dist/tui/mirror/workspace/text.d.ts +2 -0
- package/packages/daemon/dist/tui/mirror/workspace/text.js +27 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-controller.d.ts +23 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-controller.js +34 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-shell.d.ts +123 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-shell.js +286 -0
- package/packages/daemon/dist/tui/mirror/workspace-ui-state.d.ts +174 -0
- package/packages/daemon/dist/tui/mirror/workspace-ui-state.js +885 -0
- package/packages/daemon/dist/tui/readiness.d.ts +22 -0
- package/packages/daemon/dist/tui/readiness.js +34 -0
- package/packages/daemon/dist/tui/team/entry.d.ts +37 -0
- package/packages/daemon/dist/tui/team/entry.js +20 -0
- package/packages/daemon/dist/tui/team/fuzzy.d.ts +38 -0
- package/packages/daemon/dist/tui/team/fuzzy.js +141 -0
- package/packages/daemon/dist/tui/team/home.d.ts +94 -0
- package/packages/daemon/dist/tui/team/home.js +115 -0
- package/packages/daemon/dist/tui/team/input.d.ts +22 -0
- package/packages/daemon/dist/tui/team/input.js +21 -0
- package/packages/daemon/dist/tui/team/keymap.d.ts +33 -0
- package/packages/daemon/dist/tui/team/keymap.js +99 -0
- package/packages/daemon/dist/tui/team/mouse.d.ts +18 -0
- package/packages/daemon/dist/tui/team/mouse.js +17 -0
- package/packages/daemon/dist/tui/team/nav.d.ts +21 -0
- package/packages/daemon/dist/tui/team/nav.js +33 -0
- package/packages/daemon/dist/tui/team/preview.d.ts +19 -0
- package/packages/daemon/dist/tui/team/preview.js +35 -0
- package/packages/daemon/dist/tui/team/projects.d.ts +52 -0
- package/packages/daemon/dist/tui/team/projects.js +159 -0
- package/packages/daemon/dist/tui/team/report.d.ts +51 -0
- package/packages/daemon/dist/tui/team/report.js +37 -0
- package/packages/daemon/dist/tui/team/sessions.d.ts +235 -0
- package/packages/daemon/dist/tui/team/sessions.js +292 -0
- package/packages/daemon/dist/tui/team/tree.d.ts +41 -0
- package/packages/daemon/dist/tui/team/tree.js +42 -0
- package/packages/daemon/dist/tui/team/wait-receipts.d.ts +60 -0
- package/packages/daemon/dist/tui/team/wait-receipts.js +153 -0
- package/packages/daemon/dist/tui/team/wait.d.ts +62 -0
- package/packages/daemon/dist/tui/team/wait.js +90 -0
- package/packages/daemon/dist/validate.js +16 -10
- package/packages/daemon/dist/widgets/lib/watcher.d.ts +5 -9
- package/packages/daemon/dist/widgets/lib/watcher.js +5 -92
- package/packages/daemon/dist/widgets/resolve.js +10 -7
- package/packages/daemon/dist/widgets/setup/setup-model.js +7 -9
- package/packages/daemon/src/attach.ts +2 -2
- package/packages/daemon/src/canonical.ts +19 -2
- package/packages/daemon/src/cli.ts +38 -36
- package/packages/daemon/src/command-center/actions/command-definitions.ts +91 -0
- package/packages/daemon/src/command-center/actions/dispatcher.ts +291 -10
- package/packages/daemon/src/command-center/actions/errors.ts +40 -0
- package/packages/daemon/src/command-center/actions/handlers/_project-context.ts +4 -5
- package/packages/daemon/src/command-center/actions/handlers/app-window-mutate.ts +54 -0
- package/packages/daemon/src/command-center/actions/handlers/config-actions.ts +59 -29
- package/packages/daemon/src/command-center/actions/handlers/daemon-shutdown.ts +12 -0
- package/packages/daemon/src/command-center/actions/handlers/fleet-lifecycle.ts +104 -0
- package/packages/daemon/src/command-center/actions/handlers/project-launch.ts +20 -4
- package/packages/daemon/src/command-center/actions/handlers/workspace-multiplexer.ts +96 -0
- package/packages/daemon/src/command-center/actions/handlers/workspace-open.ts +141 -0
- package/packages/daemon/src/command-center/actions/handlers/workspace-pane-create.ts +48 -0
- package/packages/daemon/src/command-center/actions/handlers/workspace-promote.ts +48 -0
- package/packages/daemon/src/command-center/actions/registry.ts +200 -1
- package/packages/daemon/src/command-center/actions/semantic-multiplexer-actions.ts +26 -0
- package/packages/daemon/src/command-center/agent-status-watch.ts +222 -0
- package/packages/daemon/src/command-center/daemon-fleet-facts-observer.ts +465 -0
- package/packages/daemon/src/command-center/discovery.ts +310 -5
- package/packages/daemon/src/command-center/owner-authority.ts +118 -0
- package/packages/daemon/src/command-center/pane-stream-issue.ts +247 -0
- package/packages/daemon/src/command-center/resources/agent-graph-overlay.ts +270 -0
- package/packages/daemon/src/command-center/resources/application-shell.ts +909 -0
- package/packages/daemon/src/command-center/resources/desktop-missions.ts +171 -0
- package/packages/daemon/src/command-center/resources/fleet-catalog.ts +200 -0
- package/packages/daemon/src/command-center/resources/fleet-resource-route.ts +61 -0
- package/packages/daemon/src/command-center/resources/startup-readiness-route.ts +172 -0
- package/packages/daemon/src/command-center/resources/startup-readiness.ts +250 -0
- package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +45 -0
- package/packages/daemon/src/command-center/resources/workspace-changes-authority.ts +594 -0
- package/packages/daemon/src/command-center/resources/workspace-changes-git.ts +278 -0
- package/packages/daemon/src/command-center/resources/workspace-files-authority.ts +583 -0
- package/packages/daemon/src/command-center/resources/workspace-missions-route.ts +125 -0
- package/packages/daemon/src/command-center/resources/workspace-resource-ids.ts +81 -0
- package/packages/daemon/src/command-center/resources/workspace-resource-routes.ts +147 -0
- package/packages/daemon/src/command-center/server.ts +732 -59
- package/packages/daemon/src/command-center/terminal-attachment-issue.ts +257 -0
- package/packages/daemon/src/command-center/workspace-resource-observer.ts +560 -0
- package/packages/daemon/src/command-center/ws-events.ts +853 -66
- package/packages/daemon/src/config.ts +35 -25
- package/packages/daemon/src/control/client.ts +128 -0
- package/packages/daemon/src/control/dispatch.ts +107 -0
- package/packages/daemon/src/control/fanout.ts +44 -0
- package/packages/daemon/src/control/frames.ts +40 -0
- package/packages/daemon/src/control/lifecycle.ts +163 -0
- package/packages/daemon/src/control/server.ts +237 -0
- package/packages/daemon/src/control/verbs.ts +118 -0
- package/packages/daemon/src/detect.ts +25 -20
- package/packages/daemon/src/doctor.ts +133 -33
- package/packages/daemon/src/index.ts +244 -2
- package/packages/daemon/src/init.ts +23 -22
- package/packages/daemon/src/inspect.ts +41 -8
- package/packages/daemon/src/launch.ts +56 -28
- package/packages/daemon/src/lib/agent-discovery.ts +53 -13
- package/packages/daemon/src/lib/agent-kind.ts +23 -0
- package/packages/daemon/src/lib/app-config.ts +143 -9
- package/packages/daemon/src/lib/app-window-kernel.ts +777 -0
- package/packages/daemon/src/lib/app-window-mutation.ts +178 -0
- package/packages/daemon/src/lib/app-window-repository.ts +650 -0
- package/packages/daemon/src/lib/app-window-state.ts +599 -0
- package/packages/daemon/src/lib/application-shell-app-windows.ts +357 -0
- package/packages/daemon/src/lib/auth/middleware.ts +9 -3
- package/packages/daemon/src/lib/canonical-daemon-bootstrap.ts +266 -0
- package/packages/daemon/src/lib/canonical-daemon.ts +695 -73
- package/packages/daemon/src/lib/chrome-front-door.ts +17 -0
- package/packages/daemon/src/lib/cli-action-bridge.ts +127 -91
- package/packages/daemon/src/lib/command-registry.ts +152 -0
- package/packages/daemon/src/lib/config-context.ts +61 -0
- package/packages/daemon/src/lib/daemon-embed.ts +1347 -387
- package/packages/daemon/src/lib/daemon-session-monitor.ts +274 -0
- package/packages/daemon/src/lib/daemon.ts +3 -46
- package/packages/daemon/src/lib/directory-watcher.ts +166 -0
- package/packages/daemon/src/lib/environment-identity.ts +82 -0
- package/packages/daemon/src/lib/errors.ts +7 -1
- package/packages/daemon/src/lib/fleet-agent-lifecycle.ts +74 -0
- package/packages/daemon/src/lib/fleet-lifecycle-authority.ts +535 -0
- package/packages/daemon/src/lib/headless-daemon.ts +406 -0
- package/packages/daemon/src/lib/launch-plan.ts +123 -4
- package/packages/daemon/src/lib/legacy-config-adapter.ts +28 -0
- package/packages/daemon/src/lib/legacy-config-migration.ts +145 -0
- package/packages/daemon/src/lib/legacy-theme-compat.ts +40 -0
- package/packages/daemon/src/lib/manifest-pack.ts +255 -0
- package/packages/daemon/src/lib/mission-projections.ts +775 -0
- package/packages/daemon/src/lib/mission-repository.ts +1311 -0
- package/packages/daemon/src/lib/onboarding-marker.ts +51 -0
- package/packages/daemon/src/lib/pane-chrome.ts +14 -0
- package/packages/daemon/src/lib/pane-source-credentials.ts +200 -0
- package/packages/daemon/src/lib/pane-widget.ts +182 -0
- package/packages/daemon/src/lib/project-inspect.ts +4 -0
- package/packages/daemon/src/lib/project-onboard.ts +19 -24
- package/packages/daemon/src/lib/project-probe.ts +38 -30
- package/packages/daemon/src/lib/project-readiness-probe.ts +578 -0
- package/packages/daemon/src/lib/project-readiness.ts +1034 -0
- package/packages/daemon/src/lib/project-registry.ts +45 -9
- package/packages/daemon/src/lib/project-resolver.ts +350 -0
- package/packages/daemon/src/lib/project-runtime-errors.ts +41 -0
- package/packages/daemon/src/lib/project-runtime-repository.ts +1194 -0
- package/packages/daemon/src/lib/resolved-config.ts +425 -0
- package/packages/daemon/src/lib/runtime-namespace.ts +186 -0
- package/packages/daemon/src/lib/semantic-resource-id.ts +17 -0
- package/packages/daemon/src/lib/session-monitor.ts +28 -20
- package/packages/daemon/src/lib/session-options.ts +3 -10
- package/packages/daemon/src/lib/state-home.ts +12 -0
- package/packages/daemon/src/lib/theme-mode.ts +11 -0
- package/packages/daemon/src/lib/tmux-external-interaction-observer.ts +632 -0
- package/packages/daemon/src/lib/tmux-interaction-options.ts +171 -0
- package/packages/daemon/src/lib/tmux-terminal-color.ts +44 -0
- package/packages/daemon/src/lib/tui-binary.ts +354 -34
- package/packages/daemon/src/lib/unix-socket-authority.ts +65 -0
- package/packages/daemon/src/lib/update-check.ts +5 -0
- package/packages/daemon/src/lib/widget-asset-policy.ts +3 -0
- package/packages/daemon/src/lib/widget-asset-store.ts +218 -0
- package/packages/daemon/src/lib/workspace-config-loader.ts +378 -0
- package/packages/daemon/src/lib/workspace-multiplexer-verbs.ts +1362 -0
- package/packages/daemon/src/lib/workspace-open-handoff.ts +340 -0
- package/packages/daemon/src/lib/workspace-open.ts +983 -0
- package/packages/daemon/src/lib/workspace-pane-creation.ts +1406 -0
- package/packages/daemon/src/lib/workspace-promotion.ts +1031 -0
- package/packages/daemon/src/lib/workspace-registry.ts +193 -25
- package/packages/daemon/src/lib/workspace-state-repository.ts +1204 -0
- package/packages/daemon/src/lib/workspace-state.ts +960 -0
- package/packages/daemon/src/lib/yaml-io.ts +8 -17
- package/packages/daemon/src/migrate.ts +134 -0
- package/packages/daemon/src/restart.ts +2 -2
- package/packages/daemon/src/restore.ts +67 -24
- package/packages/daemon/src/schemas/inspect.ts +9 -1
- package/packages/daemon/src/schemas/registry.ts +12 -22
- package/packages/daemon/src/schemas/ws-events.ts +14 -131
- package/packages/daemon/src/send.ts +191 -22
- package/packages/daemon/src/server/pane-stream-upgrade.ts +141 -0
- package/packages/daemon/src/server/terminal-attachment-upgrade.ts +153 -0
- package/packages/daemon/src/status.ts +13 -8
- package/packages/daemon/src/stop.ts +2 -2
- package/packages/daemon/src/terminal/MonotonicPtyInput.ts +153 -0
- package/packages/daemon/src/terminal/NodePtyAdapter.ts +53 -11
- package/packages/daemon/src/terminal/PtyAdapter.ts +111 -3
- package/packages/daemon/src/terminal/README.md +34 -16
- package/packages/daemon/src/terminal/attachments/admission-util.ts +97 -0
- package/packages/daemon/src/terminal/attachments/agent-status-probe.ts +474 -0
- package/packages/daemon/src/terminal/attachments/direct-websocket.ts +1482 -0
- package/packages/daemon/src/terminal/attachments/grouped-tmux.ts +293 -0
- package/packages/daemon/src/terminal/attachments/lease-manager.ts +1042 -0
- package/packages/daemon/src/terminal/attachments/native-runtime.ts +2206 -0
- package/packages/daemon/src/terminal/attachments/pty-tmux-attachment-launcher.ts +750 -0
- package/packages/daemon/src/terminal/attachments/semantic-pane-catalog.ts +365 -0
- package/packages/daemon/src/terminal/attachments/tmux-view-executor.ts +1095 -0
- package/packages/daemon/src/terminal/mirror/control-channel.ts +827 -0
- package/packages/daemon/src/terminal/mirror/control-mode-ownership.ts +34 -0
- package/packages/daemon/src/terminal/mirror/events.ts +128 -0
- package/packages/daemon/src/terminal/mirror/flow-ledger.ts +65 -0
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +480 -0
- package/packages/daemon/src/terminal/mirror/pane-feed.ts +193 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +2820 -0
- package/packages/daemon/src/terminal/mirror/trusted-inventory.ts +29 -0
- package/packages/daemon/src/terminal/pane-stream/lease-manager.ts +375 -0
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +2612 -0
- package/packages/daemon/src/terminal/pane-stream/runtime.ts +78 -0
- package/packages/daemon/src/terminal/pane-stream/wire-ledger.ts +155 -0
- package/packages/daemon/src/terminal/protocol/README.md +14 -0
- package/packages/daemon/src/terminal/protocol/chunk-bytes.ts +20 -0
- package/packages/daemon/src/{tui/mirror → terminal/protocol}/control.ts +39 -6
- package/packages/daemon/src/{tui/mirror → terminal/protocol}/input-coalescer.ts +18 -7
- package/packages/daemon/src/terminal/protocol/layout-parse.ts +154 -0
- package/packages/daemon/src/terminal/protocol/pane-display-name.ts +185 -0
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +382 -0
- package/packages/daemon/src/terminal/protocol/workspace-tmux-adapter.ts +470 -0
- package/packages/daemon/src/terminal/session-runtime/authority-arbiter.ts +312 -0
- package/packages/daemon/src/terminal/session-runtime/causal-cell-ledger.ts +359 -0
- package/packages/daemon/src/terminal/session-runtime/interaction-receipt-facts.ts +173 -0
- package/packages/daemon/src/terminal/session-runtime/multiplexer-backend.ts +194 -0
- package/packages/daemon/src/terminal/session-runtime/registry.ts +2047 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-observability.ts +267 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-scheduler.ts +22 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-trace-correlator.ts +58 -0
- package/packages/daemon/src/terminal/session-runtime/semantic-mutation-executor.ts +555 -0
- package/packages/daemon/src/terminal/session-runtime/semantic-mutation-resource-changes.ts +48 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts +1806 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-observation-identity.ts +18 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-interpreter-backend.ts +64 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +690 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-owner.ts +498 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-shadow-projections.ts +36 -0
- package/packages/daemon/src/terminal/session-runtime/transport-binding.ts +682 -0
- package/packages/daemon/src/terminal/session-runtime/xterm-headless-provenance.json +25 -0
- package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +379 -0
- package/packages/daemon/src/tui/async-disposable-slot.ts +60 -0
- package/packages/daemon/src/tui/chrome/events.ts +4 -4
- package/packages/daemon/src/tui/chrome/front-door.ts +27 -0
- package/packages/daemon/src/tui/chrome/notify-prefs.ts +58 -0
- package/packages/daemon/src/tui/chrome/notify-state.ts +76 -0
- package/packages/daemon/src/tui/chrome/notify.ts +582 -84
- package/packages/daemon/src/tui/chrome/sidebar.ts +9 -4
- package/packages/daemon/src/tui/chrome/statusline.ts +15 -6
- package/packages/daemon/src/tui/chrome/updater.ts +367 -64
- package/packages/daemon/src/tui/compiled.ts +102 -6
- package/packages/daemon/src/tui/detect/agent-resolution.ts +85 -0
- package/packages/daemon/src/tui/detect/classify.ts +34 -0
- package/packages/daemon/src/tui/detect/manifest-loader.ts +54 -5
- package/packages/daemon/src/tui/detect/manifest.ts +24 -3
- package/packages/daemon/src/tui/detect/manifests.ts +240 -6
- package/packages/daemon/src/tui/detect/process-tree.ts +30 -4
- package/packages/daemon/src/tui/detect/session-id.ts +503 -0
- package/packages/daemon/src/tui/detect/snapshot.ts +38 -3
- package/packages/daemon/src/tui/integrations/claude.ts +1 -0
- package/packages/daemon/src/tui/integrations/opencode.ts +121 -0
- package/packages/daemon/src/tui/main.ts +53 -0
- package/packages/daemon/src/tui/mirror/RECIPES.md +59 -0
- package/packages/daemon/src/tui/mirror/SHELL_CHROME.md +39 -0
- package/packages/daemon/src/tui/mirror/THEME.md +48 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/activity-surface-renderer.test.tsx.snap +42 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/changes-terminal-surface-renderer.test.tsx.snap +267 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/home-files-surface-renderer.test.tsx.snap +267 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/missions-surface-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/recipes-gallery-renderer.test.tsx.snap +141 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/shell-chrome-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/activity-surface-view.tsx +169 -0
- package/packages/daemon/src/tui/mirror/activity-surface.ts +430 -0
- package/packages/daemon/src/tui/mirror/agent-chip.ts +40 -11
- package/packages/daemon/src/tui/mirror/agent-lifecycle.ts +468 -0
- package/packages/daemon/src/tui/mirror/agent-provisioning-executor.ts +151 -0
- package/packages/daemon/src/tui/mirror/agent-rows.ts +61 -5
- package/packages/daemon/src/tui/mirror/ansi-palette.ts +3 -0
- package/packages/daemon/src/tui/mirror/app-state.ts +185 -9
- package/packages/daemon/src/tui/mirror/app.tsx +2 -5264
- package/packages/daemon/src/tui/mirror/application-keybindings.ts +54 -0
- package/packages/daemon/src/tui/mirror/application-shell-daemon-connection.ts +344 -0
- package/packages/daemon/src/tui/mirror/application-shell-daemon-session.ts +74 -0
- package/packages/daemon/src/tui/mirror/attention.ts +110 -0
- package/packages/daemon/src/tui/mirror/canonical-workspace-routing.ts +63 -0
- package/packages/daemon/src/tui/mirror/changes-surface-view.tsx +263 -0
- package/packages/daemon/src/tui/mirror/changes-surface.ts +338 -0
- package/packages/daemon/src/tui/mirror/composite-layout.ts +710 -0
- package/packages/daemon/src/tui/mirror/configless-session-bootstrap.ts +192 -0
- package/packages/daemon/src/tui/mirror/dialog-model.ts +2 -2
- package/packages/daemon/src/tui/mirror/dialog-stack-core.ts +264 -0
- package/packages/daemon/src/tui/mirror/dialog-stack.ts +2 -354
- package/packages/daemon/src/tui/mirror/diff-model.ts +279 -4
- package/packages/daemon/src/tui/mirror/editor-buffer.ts +9 -70
- package/packages/daemon/src/tui/mirror/editor-open-policy.ts +16 -0
- package/packages/daemon/src/tui/mirror/features/changes/contract.ts +84 -0
- package/packages/daemon/src/tui/mirror/features/changes/controller.ts +470 -0
- package/packages/daemon/src/tui/mirror/features/changes/feature.tsx +19 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/contract.ts +64 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/feature.tsx +227 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/session.ts +186 -0
- package/packages/daemon/src/tui/mirror/features/files/feature.tsx +54 -0
- package/packages/daemon/src/tui/mirror/features/files/session.ts +694 -0
- package/packages/daemon/src/tui/mirror/features/home/feature.tsx +172 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/contract.ts +106 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/feature.tsx +19 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/session.ts +470 -0
- package/packages/daemon/src/tui/mirror/features/palette/contract.ts +121 -0
- package/packages/daemon/src/tui/mirror/features/palette/feature.ts +14 -0
- package/packages/daemon/src/tui/mirror/features/palette/session.ts +427 -0
- package/packages/daemon/src/tui/mirror/features/palette/surface.tsx +92 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/contract.ts +20 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/feature.tsx +8 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/session.ts +152 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/surface.tsx +137 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/asset-loader.ts +153 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/contract.ts +94 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/feature.tsx +141 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/session.ts +387 -0
- package/packages/daemon/src/tui/mirror/features/settings/catalog.ts +26 -0
- package/packages/daemon/src/tui/mirror/features/settings/contract.ts +41 -0
- package/packages/daemon/src/tui/mirror/features/settings/feature.ts +3 -0
- package/packages/daemon/src/tui/mirror/features/settings/session.ts +375 -0
- package/packages/daemon/src/tui/mirror/file-tree.ts +231 -6
- package/packages/daemon/src/tui/mirror/files-surface-view.tsx +242 -0
- package/packages/daemon/src/tui/mirror/files-surface.ts +371 -0
- package/packages/daemon/src/tui/mirror/focus-projection.ts +113 -0
- package/packages/daemon/src/tui/mirror/frame-coalescer.ts +87 -0
- package/packages/daemon/src/tui/mirror/home-model.ts +1 -1
- package/packages/daemon/src/tui/mirror/home-surface-model.ts +440 -0
- package/packages/daemon/src/tui/mirror/home-surface.tsx +254 -0
- package/packages/daemon/src/tui/mirror/host-terminal.ts +49 -0
- package/packages/daemon/src/tui/mirror/hosted.ts +286 -0
- package/packages/daemon/src/tui/mirror/input-lifecycle.ts +248 -0
- package/packages/daemon/src/tui/mirror/interaction-flow.ts +83 -0
- package/packages/daemon/src/tui/mirror/legacy/missions-workspace-loader.ts +117 -0
- package/packages/daemon/src/tui/mirror/menu-model.ts +28 -18
- package/packages/daemon/src/tui/mirror/missions-dashboard.ts +451 -0
- package/packages/daemon/src/tui/mirror/missions-render-fixtures.ts +371 -0
- package/packages/daemon/src/tui/mirror/missions-surface-controller.ts +530 -0
- package/packages/daemon/src/tui/mirror/missions-surface.tsx +434 -0
- package/packages/daemon/src/tui/mirror/missions-workspace.ts +1996 -0
- package/packages/daemon/src/tui/mirror/multiplexer-action-executor.ts +379 -0
- package/packages/daemon/src/tui/mirror/open-tui-pane-stream-socket.ts +47 -0
- package/packages/daemon/src/tui/mirror/open-tui-verified-routing.ts +83 -0
- package/packages/daemon/src/tui/mirror/open-tui-workspace-runtime-port.ts +1314 -0
- package/packages/daemon/src/tui/mirror/palette-surface-adapter.ts +465 -0
- package/packages/daemon/src/tui/mirror/palette.ts +485 -34
- package/packages/daemon/src/tui/mirror/pane-frame-state.ts +209 -0
- package/packages/daemon/src/tui/mirror/pane-mirror.ts +215 -50
- package/packages/daemon/src/tui/mirror/pane-surface.tsx +720 -51
- package/packages/daemon/src/tui/mirror/panel-host-reactive.ts +17 -0
- package/packages/daemon/src/tui/mirror/panel-host.ts +384 -0
- package/packages/daemon/src/tui/mirror/perf-tap.ts +1 -122
- package/packages/daemon/src/tui/mirror/performance-events.ts +488 -0
- package/packages/daemon/src/tui/mirror/recipe-components.tsx +310 -0
- package/packages/daemon/src/tui/mirror/recipes-gallery.tsx +256 -0
- package/packages/daemon/src/tui/mirror/recipes.ts +543 -0
- package/packages/daemon/src/tui/mirror/reference-performance-trace.ts +726 -0
- package/packages/daemon/src/tui/mirror/renderer-commands.ts +344 -0
- package/packages/daemon/src/tui/mirror/resize-model.ts +74 -9
- package/packages/daemon/src/tui/mirror/resize-transaction.ts +342 -0
- package/packages/daemon/src/tui/mirror/rich-placement-projection.ts +173 -0
- package/packages/daemon/src/tui/mirror/runtime/__snapshots__/application-shell-view-renderer.test.tsx.snap +87 -0
- package/packages/daemon/src/tui/mirror/runtime/application-appearance-owner.ts +121 -0
- package/packages/daemon/src/tui/mirror/runtime/application-bootstrap.ts +118 -0
- package/packages/daemon/src/tui/mirror/runtime/application-entry.ts +194 -0
- package/packages/daemon/src/tui/mirror/runtime/application-generation-starter.ts +116 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-catalog-owner.ts +112 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-catalog.ts +440 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-control-binding.ts +143 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-control-capability.ts +46 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-presentation.ts +176 -0
- package/packages/daemon/src/tui/mirror/runtime/application-host-focus-test-control.ts +313 -0
- package/packages/daemon/src/tui/mirror/runtime/application-input-readiness.ts +28 -0
- package/packages/daemon/src/tui/mirror/runtime/application-lifecycle.ts +374 -0
- package/packages/daemon/src/tui/mirror/runtime/application-optional-features.ts +25 -0
- package/packages/daemon/src/tui/mirror/runtime/application-palette-command-owner.ts +87 -0
- package/packages/daemon/src/tui/mirror/runtime/application-palette-input.ts +105 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-rename-input.ts +43 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-rename-owner.ts +43 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pending-terminal-input.ts +117 -0
- package/packages/daemon/src/tui/mirror/runtime/application-performance-log.ts +110 -0
- package/packages/daemon/src/tui/mirror/runtime/application-post-render-runtime.ts +163 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-configuration.ts +47 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-renderer.ts +32 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +506 -0
- package/packages/daemon/src/tui/mirror/runtime/application-session-focus-owner.ts +80 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-binding.ts +365 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-catalog.tsx +372 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-home.tsx +161 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-overlay-stack.tsx +42 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-overlays.tsx +154 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-sidebar.tsx +140 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-view.tsx +425 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-viewport.ts +18 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-frame-readiness-owner.ts +33 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-host-focus-owner.ts +36 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-input-ingress.ts +133 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +1630 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-palette-owner.ts +302 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-paste.ts +33 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-renderer-sources.ts +33 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-selection-owner.ts +218 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-workspace-policy.ts +285 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-workspace.tsx +1150 -0
- package/packages/daemon/src/tui/mirror/runtime/application-theme-repaint.ts +45 -0
- package/packages/daemon/src/tui/mirror/runtime/application-transient-note-owner.ts +42 -0
- package/packages/daemon/src/tui/mirror/runtime/bounded-performance-record-writer.ts +75 -0
- package/packages/daemon/src/tui/mirror/runtime/causal-cell-client-ledger.ts +394 -0
- package/packages/daemon/src/tui/mirror/runtime/causal-cell-input-fixture.ts +55 -0
- package/packages/daemon/src/tui/mirror/runtime/changes-deferred-identity.ts +34 -0
- package/packages/daemon/src/tui/mirror/runtime/daemon-authority-rebind.ts +163 -0
- package/packages/daemon/src/tui/mirror/runtime/deferred-intent-queue.ts +45 -0
- package/packages/daemon/src/tui/mirror/runtime/editor-primitives.ts +56 -0
- package/packages/daemon/src/tui/mirror/runtime/file-content-primitives.ts +8 -0
- package/packages/daemon/src/tui/mirror/runtime/fleet-lifecycle-client.ts +61 -0
- package/packages/daemon/src/tui/mirror/runtime/focus-framebuffer-projection.ts +71 -0
- package/packages/daemon/src/tui/mirror/runtime/generation-bound-slot.ts +23 -0
- package/packages/daemon/src/tui/mirror/runtime/host-local-tmux-adapter.ts +105 -0
- package/packages/daemon/src/tui/mirror/runtime/hosted-tty-size-bridge.ts +213 -0
- package/packages/daemon/src/tui/mirror/runtime/latest-intent-fence.ts +22 -0
- package/packages/daemon/src/tui/mirror/runtime/local-view-controller.ts +95 -0
- package/packages/daemon/src/tui/mirror/runtime/modal-admission-coordinator.ts +158 -0
- package/packages/daemon/src/tui/mirror/runtime/modal-pointer-capture.ts +23 -0
- package/packages/daemon/src/tui/mirror/runtime/open-tui-generation-host.ts +996 -0
- package/packages/daemon/src/tui/mirror/runtime/open-tui-session-owner.ts +195 -0
- package/packages/daemon/src/tui/mirror/runtime/optional-feature-registry.ts +234 -0
- package/packages/daemon/src/tui/mirror/runtime/optional-feature-registry.typecheck.ts +14 -0
- package/packages/daemon/src/tui/mirror/runtime/palette-production-controller.ts +170 -0
- package/packages/daemon/src/tui/mirror/runtime/palette-production-overlay.tsx +65 -0
- package/packages/daemon/src/tui/mirror/runtime/pane-resize-geometry.ts +22 -0
- package/packages/daemon/src/tui/mirror/runtime/pane-scoped-terminal-surface.tsx +146 -0
- package/packages/daemon/src/tui/mirror/runtime/product-surface-policy.ts +16 -0
- package/packages/daemon/src/tui/mirror/runtime/renderer-cadence.ts +4 -0
- package/packages/daemon/src/tui/mirror/runtime/resize-terminal-pane.ts +134 -0
- package/packages/daemon/src/tui/mirror/runtime/rich-preview-demand.ts +26 -0
- package/packages/daemon/src/tui/mirror/runtime/rich-preview-overlay.tsx +54 -0
- package/packages/daemon/src/tui/mirror/runtime/runtime-layout-presentation.ts +119 -0
- package/packages/daemon/src/tui/mirror/runtime/select-terminal-pane.ts +127 -0
- package/packages/daemon/src/tui/mirror/runtime/semantic-pane-publication.ts +26 -0
- package/packages/daemon/src/tui/mirror/runtime/semantic-shell-viewport-resize.ts +78 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-dimensions-owner.ts +20 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.ts +719 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-frame-readiness.ts +100 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-host-focus.ts +519 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-host-frame-diagnostics.ts +47 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-input-adapter.ts +69 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-layout-projection.ts +45 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-pane-input-router.ts +94 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-selection.ts +218 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-session-handoff.ts +143 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-tool-readiness.ts +72 -0
- package/packages/daemon/src/tui/mirror/runtime/tool-resource-controller.ts +799 -0
- package/packages/daemon/src/tui/mirror/runtime/tool-resource-projection.ts +223 -0
- package/packages/daemon/src/tui/mirror/runtime/viewport-fit-coordinator.ts +12 -0
- package/packages/daemon/src/tui/mirror/runtime/workspace-terminal-fast-lane.ts +597 -0
- package/packages/daemon/src/tui/mirror/selection.ts +122 -29
- package/packages/daemon/src/tui/mirror/semantic-pane-render-source.ts +767 -0
- package/packages/daemon/src/tui/mirror/semantic-session-view.ts +366 -0
- package/packages/daemon/src/tui/mirror/settings-model.ts +95 -57
- package/packages/daemon/src/tui/mirror/shell-chrome-view.tsx +346 -0
- package/packages/daemon/src/tui/mirror/shell-chrome.ts +508 -0
- package/packages/daemon/src/tui/mirror/sidebar.tsx +321 -0
- package/packages/daemon/src/tui/mirror/size-truth.ts +53 -0
- package/packages/daemon/src/tui/mirror/terminal-surface.ts +157 -0
- package/packages/daemon/src/tui/mirror/terminal-surface.tsx +84 -0
- package/packages/daemon/src/tui/mirror/terminal-text.ts +42 -0
- package/packages/daemon/src/tui/mirror/theme.ts +1059 -0
- package/packages/daemon/src/tui/mirror/ui/agent-badge.tsx +41 -0
- package/packages/daemon/src/tui/mirror/ui/badge.tsx +42 -0
- package/packages/daemon/src/tui/mirror/ui/button.tsx +127 -0
- package/packages/daemon/src/tui/mirror/ui/dialog.tsx +45 -0
- package/packages/daemon/src/tui/mirror/ui/index.ts +59 -0
- package/packages/daemon/src/tui/mirror/ui/key-hint.tsx +63 -0
- package/packages/daemon/src/tui/mirror/ui/keyboard-router.tsx +72 -0
- package/packages/daemon/src/tui/mirror/ui/menu.tsx +68 -0
- package/packages/daemon/src/tui/mirror/ui/navigation-row.tsx +114 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-frame.tsx +115 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-host.tsx +71 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-list-row.tsx +59 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-model.ts +75 -0
- package/packages/daemon/src/tui/mirror/ui/state.ts +218 -0
- package/packages/daemon/src/tui/mirror/ui/status-bar.tsx +208 -0
- package/packages/daemon/src/tui/mirror/ui/surface.tsx +71 -0
- package/packages/daemon/src/tui/mirror/ui/tabs.tsx +168 -0
- package/packages/daemon/src/tui/mirror/widget-fallback.ts +66 -0
- package/packages/daemon/src/tui/mirror/widget-surface-model.ts +170 -0
- package/packages/daemon/src/tui/mirror/widget-surface.tsx +79 -0
- package/packages/daemon/src/tui/mirror/workspace/README.md +79 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/agent-terminal-canvas-renderer.test.tsx.snap +348 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/application-shell-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/command-palette-surface-renderer.test.tsx.snap +255 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/pane-frame-renderer.test.tsx.snap +525 -0
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/workbench-shell-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/workspace/agent-terminal-canvas-view.tsx +61 -0
- package/packages/daemon/src/tui/mirror/workspace/agent-terminal-canvas.ts +131 -0
- package/packages/daemon/src/tui/mirror/workspace/application-root-controller.ts +169 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell-controller.ts +430 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell-surface-commands.ts +64 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell-view.tsx +169 -0
- package/packages/daemon/src/tui/mirror/workspace/application-shell.ts +179 -0
- package/packages/daemon/src/tui/mirror/workspace/command-palette-surface-view.tsx +356 -0
- package/packages/daemon/src/tui/mirror/workspace/command-palette-surface.ts +544 -0
- package/packages/daemon/src/tui/mirror/workspace/icons.ts +56 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-action-menu.tsx +68 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-frame.ts +675 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-frame.tsx +490 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-pane-chrome-view.tsx +125 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-pane-chrome.ts +833 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-pane-header.tsx +225 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-window-strip.tsx +466 -0
- package/packages/daemon/src/tui/mirror/workspace/text.ts +28 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-controller.ts +75 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-dock-opentui.tsx +224 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-shell.ts +486 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-shell.tsx +95 -0
- package/packages/daemon/src/tui/mirror/workspace-ui-state.ts +1278 -0
- package/packages/daemon/src/tui/readiness.ts +52 -0
- package/packages/daemon/src/tui/team/entry.ts +23 -13
- package/packages/daemon/src/tui/team/fuzzy.ts +20 -0
- package/packages/daemon/src/tui/team/home.ts +1 -1
- package/packages/daemon/src/tui/team/index.tsx +27 -8
- package/packages/daemon/src/tui/team/projects.ts +12 -0
- package/packages/daemon/src/tui/team/sessions.ts +119 -46
- package/packages/daemon/src/tui/team/wait-receipts.ts +192 -0
- package/packages/daemon/src/tui/team/wait.ts +144 -0
- package/packages/daemon/src/ui/pane-frame/fixture.ts +43 -0
- package/packages/daemon/src/ui/workbench-dock/fixture.ts +61 -0
- package/packages/daemon/src/validate.ts +21 -9
- package/packages/daemon/src/widgets/config/README.md +1 -1
- package/packages/daemon/src/widgets/config/index.tsx +15 -115
- package/packages/daemon/src/widgets/lib/watcher.ts +3 -130
- package/packages/daemon/src/widgets/resolve.ts +15 -7
- package/packages/daemon/src/widgets/setup/footer.tsx +0 -7
- package/packages/daemon/src/widgets/setup/index.tsx +18 -20
- package/packages/daemon/src/widgets/setup/review-panel.tsx +15 -10
- package/packages/daemon/src/widgets/setup/setup-model.ts +7 -10
- package/packages/daemon-client/package.json +42 -0
- package/packages/daemon-client/src/application-shell-session.test.ts +196 -0
- package/packages/daemon-client/src/application-shell-session.ts +450 -0
- package/packages/daemon-client/src/bootstrap-coordinator.test.ts +122 -0
- package/packages/daemon-client/src/bootstrap-coordinator.ts +293 -0
- package/packages/daemon-client/src/connection-supervisor.test.ts +109 -0
- package/packages/daemon-client/src/connection-supervisor.ts +216 -0
- package/packages/daemon-client/src/direct-application-shell-transport.test.ts +939 -0
- package/packages/daemon-client/src/direct-application-shell-transport.ts +1144 -0
- package/packages/daemon-client/src/first-latest-coordinator.test.ts +175 -0
- package/packages/daemon-client/src/first-latest-coordinator.ts +82 -0
- package/packages/daemon-client/src/generation-bound-store-timers.test.ts +74 -0
- package/packages/daemon-client/src/generation-bound-store.ts +908 -0
- package/packages/daemon-client/src/index.ts +25 -0
- package/packages/daemon-client/src/owner-action-client.test.ts +180 -0
- package/packages/daemon-client/src/owner-action-client.ts +113 -0
- package/packages/daemon-client/src/pane-stream-client.test.ts +2754 -0
- package/packages/daemon-client/src/pane-stream-client.ts +1665 -0
- package/packages/daemon-client/src/pane-stream-clock-calibration.test.ts +207 -0
- package/packages/daemon-client/src/pane-stream-clock-calibration.ts +161 -0
- package/packages/daemon-client/src/pane-stream-loopback-benchmark.test.ts +51 -0
- package/packages/daemon-client/src/push-resource-session.test.ts +509 -0
- package/packages/daemon-client/src/push-resource-session.ts +797 -0
- package/packages/daemon-client/src/resource-replica.test.ts +186 -0
- package/packages/daemon-client/src/resource-replica.ts +280 -0
- package/packages/daemon-client/src/runtime-resource-ledger.test.ts +18 -0
- package/packages/daemon-client/src/runtime-resource-ledger.ts +69 -0
- package/packages/daemon-client/src/terminal-fast-lane.test.ts +817 -0
- package/packages/daemon-client/src/terminal-fast-lane.ts +817 -0
- package/packages/daemon-client/src/terminal-fast-lane.typecheck.ts +16 -0
- package/packages/daemon-client/src/workspace-catalog-v2.test.ts +109 -0
- package/packages/daemon-client/src/workspace-catalog-v2.ts +66 -0
- package/packages/daemon-client/src/workspace-client-boundaries.test.ts +59 -0
- package/packages/daemon-client/src/workspace-client-conformance.ts +67 -0
- package/packages/daemon-client/src/workspace-client-operations.ts +203 -0
- package/packages/daemon-client/src/workspace-client-types.ts +302 -0
- package/packages/daemon-client/src/workspace-client.test.ts +2626 -0
- package/packages/daemon-client/src/workspace-client.ts +1421 -0
- package/packages/daemon-client/src/workspace-event-supervisor.test.ts +1086 -0
- package/packages/daemon-client/src/workspace-event-supervisor.ts +719 -0
- package/packages/daemon-client/src/workspace-pane-client.test.ts +80 -0
- package/packages/daemon-client/src/workspace-pane-client.ts +63 -0
- package/packages/presentation/package.json +28 -0
- package/packages/presentation/src/index.ts +2 -0
- package/packages/presentation/src/pane-frame/action-state.ts +72 -0
- package/packages/presentation/src/pane-frame/index.ts +3 -0
- package/packages/presentation/src/pane-frame/model.ts +517 -0
- package/packages/presentation/src/pane-frame/presenter.tsx +335 -0
- package/packages/presentation/src/pane-frame/web-entry.tsx +22 -0
- package/packages/presentation/src/pane-frame/web-host-unstyled.tsx +280 -0
- package/packages/presentation/src/pane-frame/web-host.css +388 -0
- package/packages/presentation/src/pane-frame/web-host.tsx +3 -0
- package/packages/presentation/src/presentation-contract.test.ts +63 -0
- package/packages/presentation/src/workbench-dock/index.ts +2 -0
- package/packages/presentation/src/workbench-dock/navigation.ts +54 -0
- package/packages/presentation/src/workbench-dock/presenter.tsx +252 -0
- package/packages/presentation/src/workbench-dock/web-entry.tsx +19 -0
- package/packages/presentation/src/workbench-dock/web-host-unstyled.tsx +198 -0
- package/packages/presentation/src/workbench-dock/web-host.css +204 -0
- package/packages/presentation/src/workbench-dock/web-host.tsx +3 -0
- package/packages/tmux-bridge/src/index.ts +9 -1
- package/packages/tmux-bridge/src/panes.ts +4 -0
- package/packages/tmux-bridge/src/runner.test.ts +72 -0
- package/packages/tmux-bridge/src/runner.ts +43 -2
- package/packages/tmux-bridge/src/sessions.ts +8 -1
- package/scripts/architecture-debt-budget.json +10 -0
- package/scripts/architecture-debt-inventory.mjs +98 -0
- package/scripts/build-cli.mjs +22 -1
- package/scripts/build-macos-notifier.mjs +160 -0
- package/scripts/build-tui.mjs +59 -3
- package/scripts/check-control-bytes.mjs +70 -0
- package/scripts/dev-web.mjs +66 -0
- package/scripts/lib/bounded-child-command.mjs +59 -0
- package/scripts/lib/bounded-child-command.test.mjs +148 -0
- package/scripts/lib/bounded-diagnostic-tail.mjs +82 -0
- package/scripts/lib/bounded-diagnostic-tail.test.mjs +97 -0
- package/scripts/lib/npm-release-tag.mjs +27 -0
- package/scripts/lib/npm-release-tag.test.mjs +116 -0
- package/scripts/lib/packed-opentui-frame.mjs +18 -0
- package/scripts/lib/packed-opentui-frame.test.mjs +40 -0
- package/scripts/lib/performance-reference-budgets.mjs +36 -0
- package/scripts/lib/performance-reference-report.mjs +157 -0
- package/scripts/lib/performance-reference-report.test.mjs +62 -0
- package/scripts/lib/portable-performance-evidence.mjs +210 -0
- package/scripts/lib/portable-performance-evidence.test.mjs +208 -0
- package/scripts/lib/product-ansi-cursor-alt-screen-fixture.mjs +132 -0
- package/scripts/lib/product-ansi-cursor-alt-screen.mjs +4618 -0
- package/scripts/lib/product-ansi-cursor-alt-screen.test.mjs +4120 -0
- package/scripts/lib/product-ansi-tmux-precondition.mjs +159 -0
- package/scripts/lib/product-ansi-tmux-precondition.test.mjs +147 -0
- package/scripts/lib/product-card5-host-topology.mjs +873 -0
- package/scripts/lib/product-card5-host-topology.test.mjs +1070 -0
- package/scripts/lib/product-card5-production-host-owner.mjs +4864 -0
- package/scripts/lib/product-card5-production-host-owner.test.mjs +5051 -0
- package/scripts/lib/product-configless-owner.mjs +1578 -0
- package/scripts/lib/product-configless-owner.test.mjs +2169 -0
- package/scripts/lib/product-cross-client-handoff.mjs +1165 -0
- package/scripts/lib/product-cross-client-handoff.test.mjs +1062 -0
- package/scripts/lib/product-cross-client-host-evidence.mjs +4780 -0
- package/scripts/lib/product-cross-client-host-evidence.test.mjs +3897 -0
- package/scripts/lib/product-first-input.mjs +1546 -0
- package/scripts/lib/product-first-input.test.mjs +1731 -0
- package/scripts/lib/product-focus-tmux.mjs +46 -0
- package/scripts/lib/product-focus.mjs +1198 -0
- package/scripts/lib/product-focus.test.mjs +1504 -0
- package/scripts/lib/product-idle-process-proof.mjs +270 -0
- package/scripts/lib/product-idle-process-proof.test.mjs +210 -0
- package/scripts/lib/product-keyboard-pointer-resize.mjs +471 -0
- package/scripts/lib/product-keyboard-pointer-resize.test.mjs +363 -0
- package/scripts/lib/product-rig-causal-cell-fixture.mjs +91 -0
- package/scripts/lib/product-rig-causal-fixture-geometry.mjs +27 -0
- package/scripts/lib/product-rig-causal-fixture-geometry.test.mjs +45 -0
- package/scripts/lib/product-rig-sleep-assertion.mjs +179 -0
- package/scripts/lib/product-selection-copy-app-mouse.mjs +1585 -0
- package/scripts/lib/product-selection-copy-app-mouse.test.mjs +1602 -0
- package/scripts/lib/product-tui-host-readiness.mjs +133 -0
- package/scripts/lib/product-tui-host-readiness.test.mjs +258 -0
- package/scripts/lib/product-window-lifecycle.mjs +1351 -0
- package/scripts/lib/product-window-lifecycle.test.mjs +1305 -0
- package/scripts/lib/release-source-state.mjs +28 -0
- package/scripts/lib/release-source-state.test.mjs +26 -0
- package/scripts/lib/tui-diagnostics.mjs +159 -0
- package/scripts/lib/tui-host-publication.mjs +38 -0
- package/scripts/lib/tui-testdrive-clipboard-hook.mjs +543 -0
- package/scripts/lib/tui-testdrive-clipboard-hook.test.mjs +626 -0
- package/scripts/lib/tui-testdrive-input.mjs +1940 -0
- package/scripts/lib/tui-testdrive-input.test.mjs +3434 -0
- package/scripts/lib/tui-testdrive-launch.mjs +180 -0
- package/scripts/lib/tui-testdrive-launch.test.mjs +294 -0
- package/scripts/opentui-release-check.mjs +209 -0
- package/scripts/pack-check-run.mjs +1779 -30
- package/scripts/pack-tui-check.mjs +73 -0
- package/scripts/pack-web-check.mjs +19 -0
- package/scripts/performance-portable-evidence.mjs +419 -0
- package/scripts/performance-qualification.mjs +456 -0
- package/scripts/performance-reference-memory.ts +177 -0
- package/scripts/performance-reference-pane-stream.ts +74 -0
- package/scripts/performance-reference.mjs +681 -0
- package/scripts/postinstall.js +14 -6
- package/scripts/prepublish-check.mjs +37 -1
- package/scripts/prepublish-opentui-check.mjs +24 -0
- package/scripts/product-test-rig-journeys.mjs +2700 -0
- package/scripts/product-test-rig-journeys.test.mjs +3959 -0
- package/scripts/product-test-rig-lib.mjs +2359 -0
- package/scripts/product-test-rig-multiclient.ts +434 -0
- package/scripts/product-test-rig-native-client.mjs +45 -0
- package/scripts/product-test-rig.mjs +20260 -0
- package/scripts/product-test-rig.test.mjs +3634 -0
- package/scripts/publish-tap.sh +55 -0
- package/scripts/smoke-tui-missions.mjs +329 -0
- package/scripts/tui-diagnose.mjs +258 -0
- package/scripts/tui-diagnose.test.mjs +200 -0
- package/scripts/tui-testdrive-capture.test.mjs +161 -0
- package/scripts/tui-testdrive.mjs +1955 -0
- package/skill/SKILL.md +115 -30
- package/templates/agent-team-monorepo.yml +28 -30
- package/templates/agent-team-nextjs.yml +24 -26
- package/templates/agent-team.yml +24 -24
- package/templates/convex.yml +24 -16
- package/templates/default.yml +26 -21
- package/templates/go.yml +21 -14
- package/templates/missions.yml +25 -40
- package/templates/nextjs.yml +24 -16
- package/templates/python.yml +21 -14
- package/templates/vite.yml +21 -14
- package/packages/daemon/dist/widgets/changes/index.jsx +0 -575
- package/packages/daemon/dist/widgets/config/index.d.ts +0 -1
- package/packages/daemon/dist/widgets/config/index.jsx +0 -395
- package/packages/daemon/dist/widgets/explorer/breadcrumbs.d.ts +0 -10
- package/packages/daemon/dist/widgets/explorer/breadcrumbs.jsx +0 -51
- package/packages/daemon/dist/widgets/explorer/footer.d.ts +0 -6
- package/packages/daemon/dist/widgets/explorer/footer.jsx +0 -11
- package/packages/daemon/dist/widgets/explorer/index.jsx +0 -393
- package/packages/daemon/dist/widgets/explorer/tree.d.ts +0 -13
- package/packages/daemon/dist/widgets/explorer/tree.jsx +0 -108
- package/packages/daemon/dist/widgets/lib/help-overlay.d.ts +0 -19
- package/packages/daemon/dist/widgets/lib/help-overlay.jsx +0 -69
- package/packages/daemon/dist/widgets/preview/index.jsx +0 -371
- package/packages/daemon/dist/widgets/setup/agent-naming.d.ts +0 -9
- package/packages/daemon/dist/widgets/setup/agent-naming.jsx +0 -81
- package/packages/daemon/dist/widgets/setup/config-tree.d.ts +0 -13
- package/packages/daemon/dist/widgets/setup/config-tree.jsx +0 -203
- package/packages/daemon/dist/widgets/setup/detect-panel.d.ts +0 -14
- package/packages/daemon/dist/widgets/setup/detect-panel.jsx +0 -48
- package/packages/daemon/dist/widgets/setup/field-editor.d.ts +0 -12
- package/packages/daemon/dist/widgets/setup/field-editor.jsx +0 -163
- package/packages/daemon/dist/widgets/setup/footer.d.ts +0 -17
- package/packages/daemon/dist/widgets/setup/footer.jsx +0 -64
- package/packages/daemon/dist/widgets/setup/index.d.ts +0 -1
- package/packages/daemon/dist/widgets/setup/index.jsx +0 -261
- package/packages/daemon/dist/widgets/setup/layout-picker.d.ts +0 -9
- package/packages/daemon/dist/widgets/setup/layout-picker.jsx +0 -69
- package/packages/daemon/dist/widgets/sidebar/index.jsx +0 -462
- package/packages/daemon/src/tui/mirror/control-client.ts +0 -214
- package/packages/daemon/src/tui/mirror/focus-border.ts +0 -57
- package/packages/daemon/src/tui/mirror/session-mirror.ts +0 -443
- package/packages/daemon/src/widgets/setup/orchestrator-panel.tsx +0 -200
- package/scripts/perf-mirror.mjs +0 -313
- package/scripts/verify-endpoints.sh +0 -90
- /package/packages/daemon/dist/{widgets/changes/index.d.ts → lib/__tests__/fixtures/workspace-state-writer.d.ts} +0 -0
- /package/packages/daemon/dist/{widgets/explorer/index.d.ts → terminal/mirror/trusted-inventory.js} +0 -0
- /package/packages/daemon/dist/{widgets/preview/index.d.ts → terminal/session-runtime/terminal-interpreter-backend.js} +0 -0
- /package/packages/daemon/dist/{widgets/sidebar/index.d.ts → tui/mirror/features/changes/contract.js} +0 -0
|
@@ -0,0 +1,3634 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { EventEmitter } from "node:events";
|
|
5
|
+
import {
|
|
6
|
+
appendFileSync,
|
|
7
|
+
mkdirSync,
|
|
8
|
+
mkdtempSync,
|
|
9
|
+
readFileSync,
|
|
10
|
+
renameSync,
|
|
11
|
+
rmSync,
|
|
12
|
+
truncateSync,
|
|
13
|
+
writeFileSync,
|
|
14
|
+
} from "node:fs";
|
|
15
|
+
import { tmpdir } from "node:os";
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
import test from "node:test";
|
|
18
|
+
|
|
19
|
+
import { devServerProcessIsRunning } from "../apps/desktop-renderer/e2e/fixtures/dev-server.ts";
|
|
20
|
+
import {
|
|
21
|
+
PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES,
|
|
22
|
+
PRODUCT_RIG_SOURCE_INVENTORY_MAX_PATHS,
|
|
23
|
+
PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES,
|
|
24
|
+
PRODUCT_RIG_SOURCE_MANIFEST_HASH_CHUNK_BYTES,
|
|
25
|
+
PRODUCT_RIG_SOURCE_PATH_MAX_BYTES,
|
|
26
|
+
PRODUCT_RIG_STATE_VERSION,
|
|
27
|
+
PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS,
|
|
28
|
+
PRODUCT_RESOURCE_CONDITIONING_CYCLE_COUNT,
|
|
29
|
+
PRODUCT_RESOURCE_MEASURED_CYCLE_COUNT,
|
|
30
|
+
activeTmuxPaneFromRows,
|
|
31
|
+
bindPromotedInitialPane,
|
|
32
|
+
appendBoundedWebDiagnostic,
|
|
33
|
+
awaitWebDiagnosticWithDeadline,
|
|
34
|
+
boundedSourceTraceDiff,
|
|
35
|
+
buildSourceTracePayload,
|
|
36
|
+
buildProductSourceManifest,
|
|
37
|
+
buildProductDiagnosticReport,
|
|
38
|
+
buildWebStartupEvidence,
|
|
39
|
+
causalFixtureBaselineReadiness,
|
|
40
|
+
causalFixtureTeardownDiagnostic,
|
|
41
|
+
causalInputSamples,
|
|
42
|
+
causalInputSampleHasIncarnation,
|
|
43
|
+
causalFixtureShellReady,
|
|
44
|
+
runCausalFixtureTeardownGate,
|
|
45
|
+
causalProbeEpochState,
|
|
46
|
+
latestCausalFixtureCanonicalWraparound,
|
|
47
|
+
coherentReadiness,
|
|
48
|
+
coherentGenerationDuration,
|
|
49
|
+
createProductJsonlTailReader,
|
|
50
|
+
projectProductPaneStreamLifecycle,
|
|
51
|
+
createProductRigAttemptTimelineClock,
|
|
52
|
+
compareProductSourceProvenance,
|
|
53
|
+
deriveProductSourceManifestReadBudget,
|
|
54
|
+
inputPaintSamples,
|
|
55
|
+
paneBodyRegion,
|
|
56
|
+
paneGeometryIdentity,
|
|
57
|
+
productInputQueuesSettled,
|
|
58
|
+
productAttachablePaneInventory,
|
|
59
|
+
productRigSourceTraceIncludesPath,
|
|
60
|
+
productRigGitBlobObjectId,
|
|
61
|
+
productRigHostHeartbeatObservation,
|
|
62
|
+
productRigSourceTraceDiffArgs,
|
|
63
|
+
productRigSourceTraceUntrackedArgs,
|
|
64
|
+
productSourceHeadBaselineBytes,
|
|
65
|
+
readBoundedSourceTraceFiles,
|
|
66
|
+
productResourceCycleCommands,
|
|
67
|
+
productResourceCyclePlan,
|
|
68
|
+
productResourceEndpointEpochState,
|
|
69
|
+
productResourceGeometryIdentity,
|
|
70
|
+
productResourceMeasuredEndpointTraceIds,
|
|
71
|
+
productResourceProbeCells,
|
|
72
|
+
productCapturePageUrlStatus,
|
|
73
|
+
publicRigStatus,
|
|
74
|
+
readJson,
|
|
75
|
+
redactWebDiagnosticText,
|
|
76
|
+
resolvePaneBodyRect,
|
|
77
|
+
selectProductResourceEndpoint,
|
|
78
|
+
summarizeProductResources,
|
|
79
|
+
shouldCaptureWebConsoleMessage,
|
|
80
|
+
waitForLifecycleEntry,
|
|
81
|
+
writeJsonAtomic,
|
|
82
|
+
} from "./product-test-rig-lib.mjs";
|
|
83
|
+
|
|
84
|
+
import { sourceArchitectureInventory } from "./architecture-debt-inventory.mjs";
|
|
85
|
+
import { buildTuiHostPublicationEvidence } from "./lib/tui-host-publication.mjs";
|
|
86
|
+
import { acquireProductRigSleepAssertion } from "./lib/product-rig-sleep-assertion.mjs";
|
|
87
|
+
import { selectCard5TuiHostFocusBinding } from "./lib/product-cross-client-host-evidence.mjs";
|
|
88
|
+
|
|
89
|
+
test("Card5 tails join delayed phase-only lifecycle and source-shaped reference records", () => {
|
|
90
|
+
const root = mkdtempSync(join(tmpdir(), "product-card5-dual-tail-"));
|
|
91
|
+
const lifecyclePath = join(root, "performance.jsonl");
|
|
92
|
+
const referencePath = join(root, "performance-trace.jsonl");
|
|
93
|
+
const key = "ab".repeat(32);
|
|
94
|
+
const owners = { input: "opentui:42", focus: "opentui:42", geometry: "opentui:42" };
|
|
95
|
+
const presence = {
|
|
96
|
+
clientId: "opentui:42",
|
|
97
|
+
state: "foreground",
|
|
98
|
+
connectedRevision: 1,
|
|
99
|
+
activityRevision: 9,
|
|
100
|
+
};
|
|
101
|
+
const authority = {
|
|
102
|
+
generation: "generation-a",
|
|
103
|
+
session: "runtime-a",
|
|
104
|
+
revision: 9,
|
|
105
|
+
owners,
|
|
106
|
+
clients: [
|
|
107
|
+
{
|
|
108
|
+
clientId: "web:a",
|
|
109
|
+
surface: "web",
|
|
110
|
+
state: "background",
|
|
111
|
+
connectedRevision: 1,
|
|
112
|
+
activityRevision: 1,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
clientId: "web:b",
|
|
116
|
+
surface: "web",
|
|
117
|
+
state: "background",
|
|
118
|
+
connectedRevision: 2,
|
|
119
|
+
activityRevision: 2,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
clientId: "opentui:42",
|
|
123
|
+
surface: "opentui",
|
|
124
|
+
state: "foreground",
|
|
125
|
+
connectedRevision: 1,
|
|
126
|
+
activityRevision: 9,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
const expectedCanonical = {
|
|
131
|
+
semanticPaneId: "pane-a",
|
|
132
|
+
processId: "opentui:42",
|
|
133
|
+
clockId: "opentui-performance-now",
|
|
134
|
+
generation: "generation-a",
|
|
135
|
+
incarnation: "generation-a:0",
|
|
136
|
+
revision: 5,
|
|
137
|
+
canonicalStateHash: "a".repeat(16),
|
|
138
|
+
};
|
|
139
|
+
const select = (lifecycleReader, referenceReader) =>
|
|
140
|
+
selectCard5TuiHostFocusBinding({
|
|
141
|
+
lifecycleRecords: lifecycleReader.read(),
|
|
142
|
+
referenceRecords: referenceReader.read(),
|
|
143
|
+
expectedCanonical,
|
|
144
|
+
expectedAuthority: authority,
|
|
145
|
+
expectedWorkspaceName: "workspace-a",
|
|
146
|
+
expectedTuiClientId: "opentui:42",
|
|
147
|
+
evidenceKey: key,
|
|
148
|
+
});
|
|
149
|
+
try {
|
|
150
|
+
writeFileSync(lifecyclePath, "");
|
|
151
|
+
writeFileSync(referencePath, "");
|
|
152
|
+
const lifecycleReader = createProductJsonlTailReader(lifecyclePath, {
|
|
153
|
+
recordKind: "lifecycle",
|
|
154
|
+
});
|
|
155
|
+
const referenceReader = createProductJsonlTailReader(referencePath);
|
|
156
|
+
assert.equal(select(lifecycleReader, referenceReader).passed, false);
|
|
157
|
+
appendFileSync(
|
|
158
|
+
lifecyclePath,
|
|
159
|
+
`${JSON.stringify({ phase: "terminal-host-focus-claim-attempt", claimOrdinal: 1 })}\n`,
|
|
160
|
+
);
|
|
161
|
+
assert.equal(select(lifecycleReader, referenceReader).passed, false);
|
|
162
|
+
appendFileSync(
|
|
163
|
+
referencePath,
|
|
164
|
+
`${JSON.stringify({
|
|
165
|
+
version: 1,
|
|
166
|
+
type: "performance.terminal-frame-fence",
|
|
167
|
+
semanticPaneId: "pane-a",
|
|
168
|
+
processId: "opentui:42",
|
|
169
|
+
clockId: "opentui-performance-now",
|
|
170
|
+
generation: "generation-a",
|
|
171
|
+
incarnation: "generation-a:0",
|
|
172
|
+
revision: 5,
|
|
173
|
+
stateHash: "a".repeat(16),
|
|
174
|
+
rendererEpoch: 3,
|
|
175
|
+
})}\n`,
|
|
176
|
+
);
|
|
177
|
+
assert.equal(select(lifecycleReader, referenceReader).passed, false);
|
|
178
|
+
appendFileSync(
|
|
179
|
+
lifecyclePath,
|
|
180
|
+
`${JSON.stringify({
|
|
181
|
+
phase: "terminal-host-focus-control-gate-ready",
|
|
182
|
+
elapsedMs: 9,
|
|
183
|
+
at: "2026-08-24T20:00:00.000Z",
|
|
184
|
+
capability: true,
|
|
185
|
+
detail: true,
|
|
186
|
+
path: true,
|
|
187
|
+
root: true,
|
|
188
|
+
key: true,
|
|
189
|
+
trace: true,
|
|
190
|
+
enabled: true,
|
|
191
|
+
monotonicMicros: 90,
|
|
192
|
+
processId: "opentui:42",
|
|
193
|
+
clockId: "opentui-performance-now",
|
|
194
|
+
})}\n`,
|
|
195
|
+
);
|
|
196
|
+
assert.equal(select(lifecycleReader, referenceReader).passed, false);
|
|
197
|
+
appendFileSync(
|
|
198
|
+
lifecyclePath,
|
|
199
|
+
`${JSON.stringify({
|
|
200
|
+
phase: "terminal-host-focus-control-binding-ready",
|
|
201
|
+
elapsedMs: 10,
|
|
202
|
+
at: "2026-08-24T20:00:00.000Z",
|
|
203
|
+
bindingEpoch: 1,
|
|
204
|
+
processId: "opentui:42",
|
|
205
|
+
clockId: "opentui-performance-now",
|
|
206
|
+
daemonInstanceId: "generation-a",
|
|
207
|
+
authorityGeneration: "generation-a",
|
|
208
|
+
runtimeSession: "runtime-a",
|
|
209
|
+
workspaceName: "workspace-a",
|
|
210
|
+
clientId: "opentui:42",
|
|
211
|
+
clientPhase: "live",
|
|
212
|
+
rendererEpoch: 3,
|
|
213
|
+
clientGeneration: 7,
|
|
214
|
+
monotonicMicros: 100,
|
|
215
|
+
})}\n`,
|
|
216
|
+
);
|
|
217
|
+
assert.equal(select(lifecycleReader, referenceReader).passed, true);
|
|
218
|
+
appendFileSync(
|
|
219
|
+
lifecyclePath,
|
|
220
|
+
`${JSON.stringify({
|
|
221
|
+
phase: "terminal-host-focus-authority-reconcile",
|
|
222
|
+
diagnosticEpoch: null,
|
|
223
|
+
status: "applied",
|
|
224
|
+
processId: "opentui:42",
|
|
225
|
+
clockId: "opentui-performance-now",
|
|
226
|
+
daemonInstanceId: "generation-a",
|
|
227
|
+
authorityGeneration: "generation-a",
|
|
228
|
+
runtimeSession: "runtime-a",
|
|
229
|
+
workspaceName: "workspace-a",
|
|
230
|
+
clientPhase: "live",
|
|
231
|
+
rendererEpoch: 3,
|
|
232
|
+
clientGeneration: 7,
|
|
233
|
+
authorityRevision: 9,
|
|
234
|
+
authorityOwners: owners,
|
|
235
|
+
opentuiPresence: presence,
|
|
236
|
+
receipts: ["input", "focus", "geometry"].map((authorityKind) => ({
|
|
237
|
+
authority: authorityKind,
|
|
238
|
+
status: "fulfilled",
|
|
239
|
+
granted: true,
|
|
240
|
+
exact: true,
|
|
241
|
+
})),
|
|
242
|
+
})}\n`,
|
|
243
|
+
);
|
|
244
|
+
const exact = select(lifecycleReader, referenceReader);
|
|
245
|
+
assert.equal(exact.passed, true);
|
|
246
|
+
assert.equal(exact.observation.epochMismatch, false);
|
|
247
|
+
assert.equal(exact.observation.clientGenerationMismatch, false);
|
|
248
|
+
assert.equal(
|
|
249
|
+
lifecycleReader.read().filter(({ phase }) => phase === "terminal-host-focus-claim-attempt")
|
|
250
|
+
.length,
|
|
251
|
+
1,
|
|
252
|
+
);
|
|
253
|
+
lifecycleReader.close();
|
|
254
|
+
referenceReader.close();
|
|
255
|
+
} finally {
|
|
256
|
+
rmSync(root, { recursive: true, force: true });
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test("incremental JSONL tail parses each bounded append exactly once", () => {
|
|
261
|
+
const root = mkdtempSync(join(tmpdir(), "product-jsonl-tail-"));
|
|
262
|
+
const path = join(root, "trace.jsonl");
|
|
263
|
+
try {
|
|
264
|
+
const values = Array.from({ length: 2_560 }, (_, ordinal) => ({
|
|
265
|
+
version: 1,
|
|
266
|
+
type: "performance.test",
|
|
267
|
+
ordinal,
|
|
268
|
+
text: `${ordinal}:界:${"x".repeat(560)}`,
|
|
269
|
+
...(ordinal === 0 ? { nested: { exact: true } } : {}),
|
|
270
|
+
}));
|
|
271
|
+
const bytes = Buffer.from(values.map((value) => JSON.stringify(value)).join("\n") + "\n");
|
|
272
|
+
writeFileSync(path, bytes.subarray(0, bytes.length - 1));
|
|
273
|
+
const reader = createProductJsonlTailReader(path, {
|
|
274
|
+
maxBytesPerPoll: 64 * 1024,
|
|
275
|
+
maxRecordsPerPoll: 128,
|
|
276
|
+
});
|
|
277
|
+
let prior = reader.snapshot();
|
|
278
|
+
let maxPollMs = 0;
|
|
279
|
+
while (reader.snapshot().offset < bytes.length - 1) {
|
|
280
|
+
const startedAt = performance.now();
|
|
281
|
+
reader.read();
|
|
282
|
+
maxPollMs = Math.max(maxPollMs, performance.now() - startedAt);
|
|
283
|
+
const next = reader.snapshot();
|
|
284
|
+
assert.ok(next.offset - prior.offset <= 64 * 1024);
|
|
285
|
+
assert.ok(next.recordCount - prior.recordCount <= 128);
|
|
286
|
+
prior = next;
|
|
287
|
+
}
|
|
288
|
+
assert.equal(reader.read().length, values.length - 1);
|
|
289
|
+
appendFileSync(path, "\n");
|
|
290
|
+
assert.deepEqual(reader.read(), values);
|
|
291
|
+
assert.equal(reader.read().length, values.length);
|
|
292
|
+
assert.ok(maxPollMs < 33, `incremental observer poll blocked ${maxPollMs.toFixed(3)}ms`);
|
|
293
|
+
assert.equal(reader.snapshot().offset, bytes.length);
|
|
294
|
+
const exactPrefixMark = reader.mark();
|
|
295
|
+
assert.equal(reader.recordsThrough(exactPrefixMark).length, values.length);
|
|
296
|
+
assert.deepEqual(reader.recordsSince(exactPrefixMark), []);
|
|
297
|
+
assert.equal(new Set(reader.read().map(({ ordinal }) => ordinal)).size, values.length);
|
|
298
|
+
assert.throws(() => {
|
|
299
|
+
reader.read()[0].nested.exact = false;
|
|
300
|
+
}, TypeError);
|
|
301
|
+
let maxQualificationPollMs = 0;
|
|
302
|
+
for (let poll = 0; poll < 1_000; poll += 1) {
|
|
303
|
+
const startedAt = performance.now();
|
|
304
|
+
const cumulative = reader.read();
|
|
305
|
+
const tail = cumulative.slice(2_400);
|
|
306
|
+
assert.equal(tail.filter(({ type }) => type === "performance.test").length, 160);
|
|
307
|
+
assert.equal(cumulative.findLast(({ ordinal }) => ordinal <= 2_559)?.ordinal, 2_559);
|
|
308
|
+
maxQualificationPollMs = Math.max(maxQualificationPollMs, performance.now() - startedAt);
|
|
309
|
+
}
|
|
310
|
+
assert.ok(
|
|
311
|
+
maxQualificationPollMs < 33,
|
|
312
|
+
`integrated observer qualification blocked ${maxQualificationPollMs.toFixed(3)}ms`,
|
|
313
|
+
);
|
|
314
|
+
appendFileSync(
|
|
315
|
+
path,
|
|
316
|
+
`${JSON.stringify({ version: 1, type: "performance.test", ordinal: 2_560 })}\n`,
|
|
317
|
+
);
|
|
318
|
+
reader.read();
|
|
319
|
+
assert.equal(reader.recordsThrough(exactPrefixMark).length, values.length);
|
|
320
|
+
assert.deepEqual(
|
|
321
|
+
reader.recordsSince(exactPrefixMark).map(({ ordinal }) => ordinal),
|
|
322
|
+
[2_560],
|
|
323
|
+
);
|
|
324
|
+
reader.close();
|
|
325
|
+
} finally {
|
|
326
|
+
rmSync(root, { recursive: true, force: true });
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
test("incremental JSONL tail preserves partial UTF-8 and fails closed on source mutation", () => {
|
|
331
|
+
const root = mkdtempSync(join(tmpdir(), "product-jsonl-integrity-"));
|
|
332
|
+
const path = join(root, "trace.jsonl");
|
|
333
|
+
try {
|
|
334
|
+
const line = Buffer.from(JSON.stringify({ version: 1, type: "test", text: "界" }) + "\n");
|
|
335
|
+
const split = line.indexOf(Buffer.from("界")) + 1;
|
|
336
|
+
writeFileSync(path, line.subarray(0, split));
|
|
337
|
+
const partial = createProductJsonlTailReader(path, {
|
|
338
|
+
maxBytesPerPoll: 64,
|
|
339
|
+
maxRecordsPerPoll: 2,
|
|
340
|
+
});
|
|
341
|
+
assert.deepEqual(partial.read(), []);
|
|
342
|
+
appendFileSync(path, line.subarray(split));
|
|
343
|
+
assert.equal(partial.read()[0].text, "界");
|
|
344
|
+
truncateSync(path, 0);
|
|
345
|
+
assert.throws(() => partial.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
346
|
+
partial.close();
|
|
347
|
+
|
|
348
|
+
writeFileSync(path, `${JSON.stringify({ version: 1, type: "first" })}\n`);
|
|
349
|
+
const replaced = createProductJsonlTailReader(path);
|
|
350
|
+
replaced.read();
|
|
351
|
+
renameSync(path, `${path}.old`);
|
|
352
|
+
writeFileSync(path, `${JSON.stringify({ version: 1, type: "second" })}\n`);
|
|
353
|
+
assert.throws(() => replaced.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
354
|
+
replaced.close();
|
|
355
|
+
|
|
356
|
+
writeFileSync(path, "{bad}\n");
|
|
357
|
+
const malformed = createProductJsonlTailReader(path);
|
|
358
|
+
assert.throws(() => malformed.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
359
|
+
malformed.close();
|
|
360
|
+
|
|
361
|
+
writeFileSync(path, Buffer.from([0x7b, 0x22, 0x78, 0x22, 0x3a, 0x22, 0xff, 0x22, 0x7d, 0x0a]));
|
|
362
|
+
const invalidUtf8 = createProductJsonlTailReader(path);
|
|
363
|
+
assert.throws(() => invalidUtf8.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
364
|
+
invalidUtf8.close();
|
|
365
|
+
|
|
366
|
+
writeFileSync(path, `${JSON.stringify({ version: 1, type: "deleted" })}\n`);
|
|
367
|
+
const deleted = createProductJsonlTailReader(path);
|
|
368
|
+
deleted.read();
|
|
369
|
+
rmSync(path);
|
|
370
|
+
assert.throws(() => deleted.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
371
|
+
deleted.close();
|
|
372
|
+
} finally {
|
|
373
|
+
rmSync(root, { recursive: true, force: true });
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
test("Card5 daemon lifecycle projection is bounded, keyed, and fails closed on causal gaps", async () => {
|
|
378
|
+
const root = mkdtempSync(join(tmpdir(), "product-pane-stream-lifecycle-"));
|
|
379
|
+
const path = join(root, "daemon.jsonl");
|
|
380
|
+
const evidenceKey = "ab".repeat(32);
|
|
381
|
+
const record = (ordinal, operation = "pane-stream-terminal") => ({
|
|
382
|
+
version: 1,
|
|
383
|
+
type: "performance.stage",
|
|
384
|
+
traceId: `private-request-${ordinal}`,
|
|
385
|
+
authority: { generation: "private-generation", incarnation: null },
|
|
386
|
+
operation,
|
|
387
|
+
terminalDelivery: {
|
|
388
|
+
paneStreamCloseCode: 1012,
|
|
389
|
+
paneStreamCloseReason: "topology-changed",
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
try {
|
|
393
|
+
writeFileSync(
|
|
394
|
+
path,
|
|
395
|
+
`${Array.from({ length: 80 }, (_, ordinal) => JSON.stringify(record(ordinal))).join("\n")}\n`,
|
|
396
|
+
);
|
|
397
|
+
const projected = await projectProductPaneStreamLifecycle(path, evidenceKey);
|
|
398
|
+
assert.equal(projected.available, true);
|
|
399
|
+
assert.equal(projected.count, 80);
|
|
400
|
+
assert.equal(projected.overflow, 16);
|
|
401
|
+
assert.equal(projected.events.length, 64);
|
|
402
|
+
assert.equal(projected.events[0].ordinal, 16);
|
|
403
|
+
assert.equal(projected.events.at(-1).closeReason, "topology-changed");
|
|
404
|
+
assert.match(projected.events[0].requestHmac, /^[0-9a-f]{64}$/u);
|
|
405
|
+
assert.doesNotMatch(JSON.stringify(projected), /private-request|private-generation/u);
|
|
406
|
+
|
|
407
|
+
writeFileSync(path, `${JSON.stringify(record(0, "pane-stream-server-ready"))}\n`);
|
|
408
|
+
let appendedDuringDrain = false;
|
|
409
|
+
let appendRaceConfirmations = 0;
|
|
410
|
+
const appended = await projectProductPaneStreamLifecycle(path, evidenceKey, {
|
|
411
|
+
readerFactory: (readerPath, options) => {
|
|
412
|
+
const reader = createProductJsonlTailReader(readerPath, options);
|
|
413
|
+
return {
|
|
414
|
+
read: () => reader.read(),
|
|
415
|
+
snapshot: () => reader.snapshot(),
|
|
416
|
+
confirmCaughtUp: () => {
|
|
417
|
+
appendRaceConfirmations += 1;
|
|
418
|
+
if (!appendedDuringDrain) {
|
|
419
|
+
appendedDuringDrain = true;
|
|
420
|
+
setImmediate(() => appendFileSync(readerPath, `${JSON.stringify(record(1))}\n`));
|
|
421
|
+
}
|
|
422
|
+
return reader.confirmCaughtUp();
|
|
423
|
+
},
|
|
424
|
+
close: () => reader.close(),
|
|
425
|
+
};
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
assert.equal(appendedDuringDrain, true);
|
|
429
|
+
assert.equal(appendRaceConfirmations, 3);
|
|
430
|
+
assert.equal(appended.available, true);
|
|
431
|
+
assert.deepEqual(
|
|
432
|
+
appended.events.map(({ stage, ordinal }) => ({ stage, ordinal })),
|
|
433
|
+
[
|
|
434
|
+
{ stage: "server-ready", ordinal: 0 },
|
|
435
|
+
{ stage: "terminal", ordinal: 1 },
|
|
436
|
+
],
|
|
437
|
+
);
|
|
438
|
+
|
|
439
|
+
writeFileSync(path, `${JSON.stringify(record(0, "pane-stream-server-ready"))}\n`);
|
|
440
|
+
let growthOrdinal = 1;
|
|
441
|
+
const perpetualGrowth = await projectProductPaneStreamLifecycle(path, evidenceKey, {
|
|
442
|
+
readerFactory: (readerPath, options) => {
|
|
443
|
+
const reader = createProductJsonlTailReader(readerPath, options);
|
|
444
|
+
return {
|
|
445
|
+
read: () => reader.read(),
|
|
446
|
+
snapshot: () => reader.snapshot(),
|
|
447
|
+
confirmCaughtUp: () => {
|
|
448
|
+
appendFileSync(readerPath, `${JSON.stringify(record(growthOrdinal))}\n`);
|
|
449
|
+
growthOrdinal += 1;
|
|
450
|
+
return reader.confirmCaughtUp();
|
|
451
|
+
},
|
|
452
|
+
close: () => reader.close(),
|
|
453
|
+
};
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
assert.deepEqual(perpetualGrowth, {
|
|
457
|
+
available: false,
|
|
458
|
+
reason: "reader-budget-exhausted",
|
|
459
|
+
count: 0,
|
|
460
|
+
overflow: 0,
|
|
461
|
+
events: [],
|
|
462
|
+
});
|
|
463
|
+
assert.equal(growthOrdinal, 257);
|
|
464
|
+
|
|
465
|
+
writeFileSync(path, `${JSON.stringify(record(0))}\n`);
|
|
466
|
+
const abort = new AbortController();
|
|
467
|
+
let abortedReads = 0;
|
|
468
|
+
let abortedCloses = 0;
|
|
469
|
+
const aborted = await projectProductPaneStreamLifecycle(path, evidenceKey, {
|
|
470
|
+
signal: abort.signal,
|
|
471
|
+
readerFactory: (readerPath, options) => {
|
|
472
|
+
const reader = createProductJsonlTailReader(readerPath, options);
|
|
473
|
+
return {
|
|
474
|
+
read: () => {
|
|
475
|
+
abortedReads += 1;
|
|
476
|
+
return reader.read();
|
|
477
|
+
},
|
|
478
|
+
snapshot: () => reader.snapshot(),
|
|
479
|
+
confirmCaughtUp: () => reader.confirmCaughtUp(),
|
|
480
|
+
close: () => {
|
|
481
|
+
abortedCloses += 1;
|
|
482
|
+
reader.close();
|
|
483
|
+
},
|
|
484
|
+
};
|
|
485
|
+
},
|
|
486
|
+
yieldTurn: async () => abort.abort(),
|
|
487
|
+
});
|
|
488
|
+
assert.deepEqual(aborted, {
|
|
489
|
+
available: false,
|
|
490
|
+
reason: "read-aborted",
|
|
491
|
+
count: 0,
|
|
492
|
+
overflow: 0,
|
|
493
|
+
events: [],
|
|
494
|
+
});
|
|
495
|
+
assert.equal(abortedReads, 1);
|
|
496
|
+
assert.equal(abortedCloses, 1);
|
|
497
|
+
|
|
498
|
+
writeFileSync(path, `${JSON.stringify(record(0, "unrelated"))}\n`);
|
|
499
|
+
assert.deepEqual(await projectProductPaneStreamLifecycle(path, evidenceKey), {
|
|
500
|
+
available: false,
|
|
501
|
+
reason: "no-matching-events",
|
|
502
|
+
count: 0,
|
|
503
|
+
overflow: 0,
|
|
504
|
+
events: [],
|
|
505
|
+
});
|
|
506
|
+
writeFileSync(path, "{malformed}\n");
|
|
507
|
+
assert.equal((await projectProductPaneStreamLifecycle(path, evidenceKey)).available, false);
|
|
508
|
+
assert.equal(
|
|
509
|
+
(await projectProductPaneStreamLifecycle(path, evidenceKey)).reason,
|
|
510
|
+
"malformed-record",
|
|
511
|
+
);
|
|
512
|
+
writeFileSync(path, JSON.stringify(record(0)));
|
|
513
|
+
assert.deepEqual(await projectProductPaneStreamLifecycle(path, evidenceKey), {
|
|
514
|
+
available: false,
|
|
515
|
+
reason: "partial-record",
|
|
516
|
+
count: 0,
|
|
517
|
+
overflow: 0,
|
|
518
|
+
events: [],
|
|
519
|
+
});
|
|
520
|
+
} finally {
|
|
521
|
+
rmSync(root, { recursive: true, force: true });
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
test("incremental JSONL watermark drains buffered records and commits each poll atomically", () => {
|
|
526
|
+
const root = mkdtempSync(join(tmpdir(), "product-jsonl-watermark-"));
|
|
527
|
+
const path = join(root, "trace.jsonl");
|
|
528
|
+
try {
|
|
529
|
+
const values = Array.from({ length: 600 }, (_, ordinal) => ({
|
|
530
|
+
version: 1,
|
|
531
|
+
type: "t",
|
|
532
|
+
ordinal,
|
|
533
|
+
}));
|
|
534
|
+
writeFileSync(path, `${values.map((value) => JSON.stringify(value)).join("\n")}\n`);
|
|
535
|
+
const reader = createProductJsonlTailReader(path, {
|
|
536
|
+
maxBytesPerPoll: 64 * 1024,
|
|
537
|
+
maxRecordsPerPoll: 512,
|
|
538
|
+
});
|
|
539
|
+
assert.equal(reader.read().length, 512);
|
|
540
|
+
assert.equal(reader.snapshot().caughtUp, false);
|
|
541
|
+
assert.equal(reader.read().length, 600);
|
|
542
|
+
assert.equal(reader.snapshot().caughtUp, true);
|
|
543
|
+
const mark = reader.mark();
|
|
544
|
+
appendFileSync(path, `${JSON.stringify({ version: 1, type: "t", ordinal: 600 })}\n`);
|
|
545
|
+
reader.read();
|
|
546
|
+
assert.deepEqual(
|
|
547
|
+
reader.recordsSince(mark).map(({ ordinal }) => ordinal),
|
|
548
|
+
[600],
|
|
549
|
+
);
|
|
550
|
+
assert.equal(Object.isFrozen(reader.recordsSince(mark)), true);
|
|
551
|
+
const foreign = createProductJsonlTailReader(path);
|
|
552
|
+
foreign.read();
|
|
553
|
+
assert.throws(() => foreign.recordsSince(mark), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
554
|
+
foreign.close();
|
|
555
|
+
assert.throws(() => reader.read().push(values[0]), {
|
|
556
|
+
code: "PRODUCT_JSONL_TAIL_INVALID",
|
|
557
|
+
});
|
|
558
|
+
assert.throws(() => reader.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
559
|
+
reader.close();
|
|
560
|
+
|
|
561
|
+
writeFileSync(path, `${JSON.stringify(values[0])}\n`);
|
|
562
|
+
const atomic = createProductJsonlTailReader(path);
|
|
563
|
+
const visible = atomic.read();
|
|
564
|
+
assert.equal(visible.length, 1);
|
|
565
|
+
appendFileSync(path, `{malformed}\n${JSON.stringify(values[1])}\n`);
|
|
566
|
+
assert.throws(() => atomic.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
567
|
+
assert.equal(visible.length, 1);
|
|
568
|
+
assert.throws(() => atomic.read(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
569
|
+
assert.throws(() => atomic.snapshot(), { code: "PRODUCT_JSONL_TAIL_INVALID" });
|
|
570
|
+
atomic.close();
|
|
571
|
+
|
|
572
|
+
writeFileSync(
|
|
573
|
+
path,
|
|
574
|
+
`${JSON.stringify({ phase: "generation-workspace-client-state", elapsedMs: 1 })}\n`,
|
|
575
|
+
);
|
|
576
|
+
const lifecycle = createProductJsonlTailReader(path, { recordKind: "lifecycle" });
|
|
577
|
+
assert.equal(lifecycle.read()[0].phase, "generation-workspace-client-state");
|
|
578
|
+
assert.equal(lifecycle.snapshot().caughtUp, true);
|
|
579
|
+
lifecycle.close();
|
|
580
|
+
} finally {
|
|
581
|
+
rmSync(root, { recursive: true, force: true });
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
test("focus Web readiness detects dev-server exit and signal death", () => {
|
|
586
|
+
assert.equal(devServerProcessIsRunning({ exitCode: null, signalCode: null }), true);
|
|
587
|
+
assert.equal(devServerProcessIsRunning({ exitCode: 1, signalCode: null }), false);
|
|
588
|
+
assert.equal(devServerProcessIsRunning({ exitCode: null, signalCode: "SIGTERM" }), false);
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
test("artifact capture accepts only bounded local ProductRig page URLs", () => {
|
|
592
|
+
for (const pageUrl of [
|
|
593
|
+
"http://127.0.0.1:5173/?devHost=1",
|
|
594
|
+
"http://localhost:4000/",
|
|
595
|
+
"http://[::1]:8080/path",
|
|
596
|
+
])
|
|
597
|
+
assert.deepEqual(productCapturePageUrlStatus(pageUrl), {
|
|
598
|
+
exact: true,
|
|
599
|
+
pageUrl,
|
|
600
|
+
reason: null,
|
|
601
|
+
});
|
|
602
|
+
for (const [value, reason] of [
|
|
603
|
+
[undefined, "missing-or-shape"],
|
|
604
|
+
["not a URL", "malformed"],
|
|
605
|
+
["https://127.0.0.1:5173/", "scheme"],
|
|
606
|
+
["http://example.com:5173/", "host"],
|
|
607
|
+
["http://127.0.0.1/", "port"],
|
|
608
|
+
["http://user:secret@127.0.0.1:5173/", "credentials"],
|
|
609
|
+
])
|
|
610
|
+
assert.equal(productCapturePageUrlStatus(value).reason, reason);
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
function fakeSleepAssertionChild({ pid = 1234, exitBeforeReady = false } = {}) {
|
|
614
|
+
const child = new EventEmitter();
|
|
615
|
+
child.pid = pid;
|
|
616
|
+
child.exitCode = null;
|
|
617
|
+
child.signalCode = null;
|
|
618
|
+
child.kills = [];
|
|
619
|
+
child.kill = (signal) => {
|
|
620
|
+
child.kills.push(signal);
|
|
621
|
+
child.signalCode = signal;
|
|
622
|
+
queueMicrotask(() => child.emit("close", null, signal));
|
|
623
|
+
return true;
|
|
624
|
+
};
|
|
625
|
+
queueMicrotask(() => {
|
|
626
|
+
child.emit("spawn");
|
|
627
|
+
if (exitBeforeReady) {
|
|
628
|
+
child.exitCode = 1;
|
|
629
|
+
child.emit("close", 1, null);
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
return child;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
test("ProductRig owns one macOS idle-sleep assertion until exact cleanup", async () => {
|
|
636
|
+
const child = fakeSleepAssertionChild();
|
|
637
|
+
const calls = [];
|
|
638
|
+
const assertion = await acquireProductRigSleepAssertion({
|
|
639
|
+
platform: "darwin",
|
|
640
|
+
verifyAssertions: async () => true,
|
|
641
|
+
ownerPid: 99,
|
|
642
|
+
spawnProcess: (command, args, options) => {
|
|
643
|
+
calls.push({ command, args, options });
|
|
644
|
+
return child;
|
|
645
|
+
},
|
|
646
|
+
});
|
|
647
|
+
assert.deepEqual(calls, [
|
|
648
|
+
{
|
|
649
|
+
command: "/usr/bin/caffeinate",
|
|
650
|
+
args: ["-s", "-i", "-w", "99"],
|
|
651
|
+
options: { stdio: "ignore" },
|
|
652
|
+
},
|
|
653
|
+
]);
|
|
654
|
+
assert.equal(assertion.active(), true);
|
|
655
|
+
assert.equal(assertion.pid, child.pid);
|
|
656
|
+
assert.equal(assertion.failure instanceof Promise, true);
|
|
657
|
+
await assertion.release();
|
|
658
|
+
await assertion.release();
|
|
659
|
+
assert.deepEqual(child.kills, ["SIGTERM"]);
|
|
660
|
+
assert.equal(assertion.active(), false);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
test("lifecycle wait recovers when the filesystem watcher drops the publication", async () => {
|
|
664
|
+
let entry = null;
|
|
665
|
+
let closed = 0;
|
|
666
|
+
const pending = waitForLifecycleEntry({
|
|
667
|
+
findEntry: () => entry,
|
|
668
|
+
subscribe: () => ({
|
|
669
|
+
close: () => {
|
|
670
|
+
closed += 1;
|
|
671
|
+
},
|
|
672
|
+
}),
|
|
673
|
+
timeoutMs: 250,
|
|
674
|
+
timeoutMessage: "missed lifecycle entry",
|
|
675
|
+
pollIntervalMs: 1,
|
|
676
|
+
});
|
|
677
|
+
setTimeout(() => {
|
|
678
|
+
entry = { phase: "first-terminal-frame", processId: "opentui:42" };
|
|
679
|
+
}, 5);
|
|
680
|
+
|
|
681
|
+
assert.deepEqual(await pending, entry);
|
|
682
|
+
assert.equal(closed, 1);
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
test("ProductRig sleep assertion is a non-macOS no-op", async () => {
|
|
686
|
+
let spawned = false;
|
|
687
|
+
const assertion = await acquireProductRigSleepAssertion({
|
|
688
|
+
platform: "linux",
|
|
689
|
+
spawnProcess: () => {
|
|
690
|
+
spawned = true;
|
|
691
|
+
},
|
|
692
|
+
});
|
|
693
|
+
assert.equal(spawned, false);
|
|
694
|
+
assert.equal(assertion.kind, "not-required");
|
|
695
|
+
assert.equal(assertion.active(), true);
|
|
696
|
+
await assertion.release();
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
test("ProductRig fails closed when the macOS sleep assertion exits during acquisition", async () => {
|
|
700
|
+
await assert.rejects(
|
|
701
|
+
acquireProductRigSleepAssertion({
|
|
702
|
+
platform: "darwin",
|
|
703
|
+
verifyAssertions: async () => true,
|
|
704
|
+
ownerPid: 99,
|
|
705
|
+
spawnProcess: () => fakeSleepAssertionChild({ exitBeforeReady: true }),
|
|
706
|
+
}),
|
|
707
|
+
/exited before acquisition completed/u,
|
|
708
|
+
);
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
test("ProductRig fails closed when caffeinate cannot spawn", async () => {
|
|
712
|
+
const child = new EventEmitter();
|
|
713
|
+
child.pid = undefined;
|
|
714
|
+
child.exitCode = null;
|
|
715
|
+
child.signalCode = null;
|
|
716
|
+
queueMicrotask(() => child.emit("error", new Error("missing caffeinate")));
|
|
717
|
+
await assert.rejects(
|
|
718
|
+
acquireProductRigSleepAssertion({
|
|
719
|
+
platform: "darwin",
|
|
720
|
+
verifyAssertions: async () => true,
|
|
721
|
+
ownerPid: 99,
|
|
722
|
+
spawnProcess: () => child,
|
|
723
|
+
}),
|
|
724
|
+
/missing caffeinate/u,
|
|
725
|
+
);
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
test("ProductRig aborts and reaps a sleep assertion acquisition in flight", async () => {
|
|
729
|
+
const child = fakeSleepAssertionChild();
|
|
730
|
+
const controller = new AbortController();
|
|
731
|
+
const acquisition = acquireProductRigSleepAssertion({
|
|
732
|
+
platform: "darwin",
|
|
733
|
+
verifyAssertions: async () => true,
|
|
734
|
+
ownerPid: 99,
|
|
735
|
+
spawnProcess: () => child,
|
|
736
|
+
settle: () => new Promise(() => undefined),
|
|
737
|
+
signal: controller.signal,
|
|
738
|
+
});
|
|
739
|
+
await new Promise((resolve) => child.once("spawn", resolve));
|
|
740
|
+
controller.abort();
|
|
741
|
+
await assert.rejects(acquisition, /acquisition aborted/u);
|
|
742
|
+
assert.deepEqual(child.kills, ["SIGTERM"]);
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
test("ProductRig reports an acquired sleep assertion that dies unexpectedly", async () => {
|
|
746
|
+
const child = fakeSleepAssertionChild();
|
|
747
|
+
const assertion = await acquireProductRigSleepAssertion({
|
|
748
|
+
platform: "darwin",
|
|
749
|
+
verifyAssertions: async () => true,
|
|
750
|
+
ownerPid: 99,
|
|
751
|
+
spawnProcess: () => child,
|
|
752
|
+
});
|
|
753
|
+
child.exitCode = 9;
|
|
754
|
+
child.emit("close", 9, null);
|
|
755
|
+
await assert.rejects(assertion.failure, /exited unexpectedly \(9\)/u);
|
|
756
|
+
assert.equal(assertion.active(), false);
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
test("ProductRig fails closed when macOS does not publish both sleep assertions", async () => {
|
|
760
|
+
const child = fakeSleepAssertionChild();
|
|
761
|
+
await assert.rejects(
|
|
762
|
+
acquireProductRigSleepAssertion({
|
|
763
|
+
platform: "darwin",
|
|
764
|
+
ownerPid: 99,
|
|
765
|
+
spawnProcess: () => child,
|
|
766
|
+
verifyAssertions: async () => false,
|
|
767
|
+
}),
|
|
768
|
+
/system-sleep assertion could not be verified/u,
|
|
769
|
+
);
|
|
770
|
+
assert.deepEqual(child.kills, ["SIGTERM"]);
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
test("ProductRig reaps caffeinate when assertion verification errors", async () => {
|
|
774
|
+
const child = fakeSleepAssertionChild();
|
|
775
|
+
await assert.rejects(
|
|
776
|
+
acquireProductRigSleepAssertion({
|
|
777
|
+
platform: "darwin",
|
|
778
|
+
ownerPid: 99,
|
|
779
|
+
spawnProcess: () => child,
|
|
780
|
+
verifyAssertions: async () => {
|
|
781
|
+
throw new Error("pmset timeout");
|
|
782
|
+
},
|
|
783
|
+
}),
|
|
784
|
+
/pmset timeout/u,
|
|
785
|
+
);
|
|
786
|
+
assert.deepEqual(child.kills, ["SIGTERM"]);
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
test("ProductRig classifies a verified heartbeat gap without relying on monotonic sleep", () => {
|
|
790
|
+
assert.deepEqual(
|
|
791
|
+
productRigHostHeartbeatObservation({
|
|
792
|
+
previousHeartbeatWallMs: 1_000,
|
|
793
|
+
wallNowMs: 931_000,
|
|
794
|
+
}),
|
|
795
|
+
{
|
|
796
|
+
reason: "host-suspended",
|
|
797
|
+
suspended: true,
|
|
798
|
+
elapsedMs: 930_000,
|
|
799
|
+
expectedIntervalMs: 100,
|
|
800
|
+
gapMs: 929_900,
|
|
801
|
+
},
|
|
802
|
+
);
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
test("source provenance accepts patches above Node's default buffer and enforces a hard ceiling", () => {
|
|
806
|
+
const aboveNodeDefault = "x".repeat(1024 * 1024 + 1);
|
|
807
|
+
assert.equal(boundedSourceTraceDiff(aboveNodeDefault), aboveNodeDefault);
|
|
808
|
+
assert.throws(
|
|
809
|
+
() => boundedSourceTraceDiff("x".repeat(PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES + 1)),
|
|
810
|
+
/hard ceiling/u,
|
|
811
|
+
);
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
test("source provenance deterministically binds sorted untracked paths and bytes", () => {
|
|
815
|
+
const tracked = Buffer.from("tracked-diff\0bytes");
|
|
816
|
+
const files = [
|
|
817
|
+
{ path: "scripts/z-new.mjs", content: Buffer.from("z\0content") },
|
|
818
|
+
{ path: "packages/core/src/a-new.ts", content: Buffer.from("alpha") },
|
|
819
|
+
];
|
|
820
|
+
const payload = buildSourceTracePayload(tracked, files);
|
|
821
|
+
const reversed = buildSourceTracePayload(tracked, files.toReversed());
|
|
822
|
+
const digest = (value) => createHash("sha256").update(value).digest("hex");
|
|
823
|
+
assert.deepEqual(payload, reversed);
|
|
824
|
+
assert.notEqual(
|
|
825
|
+
digest(payload),
|
|
826
|
+
digest(
|
|
827
|
+
buildSourceTracePayload(tracked, [
|
|
828
|
+
files[0],
|
|
829
|
+
{ ...files[1], content: Buffer.from("changed") },
|
|
830
|
+
]),
|
|
831
|
+
),
|
|
832
|
+
);
|
|
833
|
+
assert.notEqual(
|
|
834
|
+
digest(payload),
|
|
835
|
+
digest(
|
|
836
|
+
buildSourceTracePayload(tracked, [
|
|
837
|
+
files[0],
|
|
838
|
+
{ ...files[1], path: "packages/core/src/renamed.ts" },
|
|
839
|
+
]),
|
|
840
|
+
),
|
|
841
|
+
);
|
|
842
|
+
assert.throws(() => buildSourceTracePayload(tracked, [...files, files[0]]), /malformed/u);
|
|
843
|
+
assert.throws(
|
|
844
|
+
() => buildSourceTracePayload(tracked, [{ path: "../outside", content: "x" }]),
|
|
845
|
+
/malformed/u,
|
|
846
|
+
);
|
|
847
|
+
assert.throws(
|
|
848
|
+
() =>
|
|
849
|
+
buildSourceTracePayload("", [
|
|
850
|
+
{ path: "scripts/new.mjs", content: "x".repeat(PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES) },
|
|
851
|
+
]),
|
|
852
|
+
/hard ceiling/u,
|
|
853
|
+
);
|
|
854
|
+
assert.equal(productRigSourceTraceIncludesPath("scripts/lib/product-first-input.mjs"), true);
|
|
855
|
+
assert.equal(
|
|
856
|
+
productRigSourceTraceIncludesPath("packages/daemon/native/target/debug/artifact"),
|
|
857
|
+
false,
|
|
858
|
+
);
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
test("source provenance computes the exact bounded Git blob id without a stdin subprocess", (t) => {
|
|
862
|
+
const directory = mkdtempSync(join(tmpdir(), "tmux-ide-git-blob-"));
|
|
863
|
+
t.after(() => rmSync(directory, { recursive: true, force: true }));
|
|
864
|
+
const buffers = [
|
|
865
|
+
Buffer.alloc(0),
|
|
866
|
+
Buffer.from([0, 1, 0, 255]),
|
|
867
|
+
Buffer.alloc(64 * 1024, 0x61),
|
|
868
|
+
Buffer.alloc(1024 * 1024 + 17, 0x62),
|
|
869
|
+
Buffer.alloc(PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES, 0x63),
|
|
870
|
+
];
|
|
871
|
+
for (const [ordinal, buffer] of buffers.entries()) {
|
|
872
|
+
const path = join(directory, `payload-${ordinal}.bin`);
|
|
873
|
+
writeFileSync(path, buffer);
|
|
874
|
+
const expected = execFileSync("git", ["hash-object", path], {
|
|
875
|
+
encoding: "utf8",
|
|
876
|
+
}).trim();
|
|
877
|
+
assert.equal(productRigGitBlobObjectId(buffer), expected);
|
|
878
|
+
assert.equal(productRigGitBlobObjectId(Buffer.from(buffer)), expected);
|
|
879
|
+
}
|
|
880
|
+
assert.throws(
|
|
881
|
+
() => productRigGitBlobObjectId(Buffer.alloc(PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES + 1)),
|
|
882
|
+
/bounded byte ceiling/u,
|
|
883
|
+
);
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
test("source provenance manifest reports stable and bounded between-run drift", () => {
|
|
887
|
+
const expected = {
|
|
888
|
+
commit: "a".repeat(40),
|
|
889
|
+
tree: "b".repeat(40),
|
|
890
|
+
manifestDigest: "c".repeat(64),
|
|
891
|
+
manifest: [
|
|
892
|
+
{ pathDigest: "1".repeat(64), contentDigest: "2".repeat(64), bytes: 10 },
|
|
893
|
+
{ pathDigest: "3".repeat(64), contentDigest: "4".repeat(64), bytes: 20 },
|
|
894
|
+
],
|
|
895
|
+
};
|
|
896
|
+
assert.equal(compareProductSourceProvenance(expected, structuredClone(expected)).stable, true);
|
|
897
|
+
const changed = structuredClone(expected);
|
|
898
|
+
changed.tree = "d".repeat(40);
|
|
899
|
+
changed.manifestDigest = "e".repeat(64);
|
|
900
|
+
changed.manifest[1].contentDigest = "f".repeat(64);
|
|
901
|
+
const assessment = compareProductSourceProvenance(expected, changed);
|
|
902
|
+
assert.equal(assessment.stable, false);
|
|
903
|
+
assert.equal(assessment.treeExact, false);
|
|
904
|
+
assert.equal(assessment.changedCount, 1);
|
|
905
|
+
assert.deepEqual(assessment.changedPathDigests, ["3".repeat(64)]);
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
test("source manifest uses a derived bounded budget and fixed-memory exact hashing", () => {
|
|
909
|
+
const makeFile = (content, ino, declaredSize = content.length) => ({
|
|
910
|
+
content: Buffer.from(content),
|
|
911
|
+
declaredSize,
|
|
912
|
+
dev: 7,
|
|
913
|
+
ino,
|
|
914
|
+
regular: true,
|
|
915
|
+
});
|
|
916
|
+
const build = (entries, maxBytes, onRead = () => undefined) => {
|
|
917
|
+
const files = new Map(entries);
|
|
918
|
+
let maxRequested = 0;
|
|
919
|
+
const result = buildProductSourceManifest(
|
|
920
|
+
[...files.keys()],
|
|
921
|
+
{
|
|
922
|
+
openFile(path) {
|
|
923
|
+
const file = files.get(path);
|
|
924
|
+
if (file?.symlink) throw Object.assign(new Error("symlink"), { code: "ELOOP" });
|
|
925
|
+
if (!file) throw Object.assign(new Error("missing"), { code: "ENOENT" });
|
|
926
|
+
return { path, file };
|
|
927
|
+
},
|
|
928
|
+
statFile(descriptor) {
|
|
929
|
+
return {
|
|
930
|
+
isFile: () => descriptor.file.regular,
|
|
931
|
+
size: descriptor.file.declaredSize,
|
|
932
|
+
dev: descriptor.file.dev,
|
|
933
|
+
ino: descriptor.file.ino,
|
|
934
|
+
};
|
|
935
|
+
},
|
|
936
|
+
readChunk(descriptor, buffer, requested, position) {
|
|
937
|
+
maxRequested = Math.max(maxRequested, requested);
|
|
938
|
+
onRead({ descriptor, files, position, requested });
|
|
939
|
+
const available = Math.max(
|
|
940
|
+
0,
|
|
941
|
+
Math.min(requested, descriptor.file.content.length - position),
|
|
942
|
+
);
|
|
943
|
+
descriptor.file.content.copy(buffer, 0, position, position + available);
|
|
944
|
+
return available;
|
|
945
|
+
},
|
|
946
|
+
closeFile() {},
|
|
947
|
+
},
|
|
948
|
+
maxBytes,
|
|
949
|
+
);
|
|
950
|
+
return { ...result, maxRequested };
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
const currentBytes = 8_409_153;
|
|
954
|
+
assert.equal(productSourceHeadBaselineBytes(["blob 7534884", "HEAD:new missing"], 2), 7_534_884);
|
|
955
|
+
assert.throws(() => productSourceHeadBaselineBytes(["tree 1"], 1), /invalid/u);
|
|
956
|
+
assert.throws(
|
|
957
|
+
() => productSourceHeadBaselineBytes([`blob ${Number.MAX_SAFE_INTEGER}`, "blob 1"], 2),
|
|
958
|
+
/overflowed/u,
|
|
959
|
+
);
|
|
960
|
+
const currentBudget = deriveProductSourceManifestReadBudget(7_534_884);
|
|
961
|
+
assert.equal(currentBudget, 15_923_492);
|
|
962
|
+
const current = build(
|
|
963
|
+
[["bin/current-source.js", makeFile(Buffer.alloc(currentBytes, 0x61), 1)]],
|
|
964
|
+
currentBudget,
|
|
965
|
+
);
|
|
966
|
+
assert.equal(current.bytes, currentBytes);
|
|
967
|
+
assert.ok(current.maxRequested <= PRODUCT_RIG_SOURCE_MANIFEST_HASH_CHUNK_BYTES);
|
|
968
|
+
|
|
969
|
+
const exactBudget = deriveProductSourceManifestReadBudget(10, 5, 100);
|
|
970
|
+
assert.equal(build([["scripts/exact.mjs", makeFile("x".repeat(15), 2)]], exactBudget).bytes, 15);
|
|
971
|
+
assert.throws(
|
|
972
|
+
() => build([["scripts/over.mjs", makeFile("x".repeat(16), 3)]], exactBudget),
|
|
973
|
+
/byte ceiling/u,
|
|
974
|
+
);
|
|
975
|
+
assert.equal(
|
|
976
|
+
deriveProductSourceManifestReadBudget(
|
|
977
|
+
PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES,
|
|
978
|
+
PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES,
|
|
979
|
+
),
|
|
980
|
+
PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES,
|
|
981
|
+
);
|
|
982
|
+
assert.throws(
|
|
983
|
+
() =>
|
|
984
|
+
build(
|
|
985
|
+
[
|
|
986
|
+
[
|
|
987
|
+
"scripts/hard-over.mjs",
|
|
988
|
+
makeFile("", 4, PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES + 1),
|
|
989
|
+
],
|
|
990
|
+
],
|
|
991
|
+
PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES,
|
|
992
|
+
),
|
|
993
|
+
/byte ceiling/u,
|
|
994
|
+
);
|
|
995
|
+
assert.throws(
|
|
996
|
+
() => deriveProductSourceManifestReadBudget(Number.MAX_SAFE_INTEGER, 1),
|
|
997
|
+
/overflowed/u,
|
|
998
|
+
);
|
|
999
|
+
|
|
1000
|
+
const children = build(
|
|
1001
|
+
[
|
|
1002
|
+
["scripts/a.mjs", makeFile("alpha", 5)],
|
|
1003
|
+
["scripts/b.mjs", makeFile("beta", 6)],
|
|
1004
|
+
],
|
|
1005
|
+
100,
|
|
1006
|
+
);
|
|
1007
|
+
assert.equal(
|
|
1008
|
+
children.manifest[0].contentDigest,
|
|
1009
|
+
createHash("sha256").update("alpha").digest("hex"),
|
|
1010
|
+
);
|
|
1011
|
+
assert.equal(
|
|
1012
|
+
children.manifestDigest,
|
|
1013
|
+
createHash("sha256").update(JSON.stringify(children.manifest)).digest("hex"),
|
|
1014
|
+
);
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
test("source manifest fails closed on symlink, growth, truncation, and path replacement", () => {
|
|
1018
|
+
const file = (content, ino) => ({
|
|
1019
|
+
content: Buffer.from(content),
|
|
1020
|
+
declaredSize: Buffer.byteLength(content),
|
|
1021
|
+
dev: 8,
|
|
1022
|
+
ino,
|
|
1023
|
+
regular: true,
|
|
1024
|
+
});
|
|
1025
|
+
const run = (initial, mutate) => {
|
|
1026
|
+
const files = new Map([["scripts/source.mjs", initial]]);
|
|
1027
|
+
return buildProductSourceManifest(
|
|
1028
|
+
["scripts/source.mjs"],
|
|
1029
|
+
{
|
|
1030
|
+
openFile(path) {
|
|
1031
|
+
const current = files.get(path);
|
|
1032
|
+
if (current?.symlink) throw Object.assign(new Error("symlink"), { code: "ELOOP" });
|
|
1033
|
+
if (!current) throw Object.assign(new Error("missing"), { code: "ENOENT" });
|
|
1034
|
+
return { path, file: current };
|
|
1035
|
+
},
|
|
1036
|
+
statFile: ({ file: current }) => ({
|
|
1037
|
+
isFile: () => current.regular,
|
|
1038
|
+
size: current.declaredSize,
|
|
1039
|
+
dev: current.dev,
|
|
1040
|
+
ino: current.ino,
|
|
1041
|
+
}),
|
|
1042
|
+
readChunk(descriptor, buffer, requested, position) {
|
|
1043
|
+
mutate({ descriptor, files, position });
|
|
1044
|
+
const count = Math.max(0, Math.min(requested, descriptor.file.content.length - position));
|
|
1045
|
+
descriptor.file.content.copy(buffer, 0, position, position + count);
|
|
1046
|
+
return count;
|
|
1047
|
+
},
|
|
1048
|
+
closeFile() {},
|
|
1049
|
+
},
|
|
1050
|
+
1_024,
|
|
1051
|
+
);
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
assert.throws(() => run({ ...file("x", 1), symlink: true }, () => undefined), /symlink/u);
|
|
1055
|
+
let missingOpens = 0;
|
|
1056
|
+
const deleted = buildProductSourceManifest(
|
|
1057
|
+
["scripts/deleted.mjs"],
|
|
1058
|
+
{
|
|
1059
|
+
openFile() {
|
|
1060
|
+
missingOpens += 1;
|
|
1061
|
+
throw Object.assign(new Error("missing"), { code: "ENOENT" });
|
|
1062
|
+
},
|
|
1063
|
+
statFile: () => assert.fail("deleted file must not be statted"),
|
|
1064
|
+
readChunk: () => assert.fail("deleted file must not be read"),
|
|
1065
|
+
closeFile: () => assert.fail("deleted file must not be closed"),
|
|
1066
|
+
},
|
|
1067
|
+
1_024,
|
|
1068
|
+
);
|
|
1069
|
+
assert.equal(missingOpens, 2);
|
|
1070
|
+
assert.equal(deleted.manifest[0].bytes, 0);
|
|
1071
|
+
let appearingOpens = 0;
|
|
1072
|
+
assert.throws(
|
|
1073
|
+
() =>
|
|
1074
|
+
buildProductSourceManifest(
|
|
1075
|
+
["scripts/appeared.mjs"],
|
|
1076
|
+
{
|
|
1077
|
+
openFile() {
|
|
1078
|
+
appearingOpens += 1;
|
|
1079
|
+
if (appearingOpens === 1) throw Object.assign(new Error("missing"), { code: "ENOENT" });
|
|
1080
|
+
return { file: file("x", 10) };
|
|
1081
|
+
},
|
|
1082
|
+
statFile: ({ file: current }) => ({
|
|
1083
|
+
isFile: () => current.regular,
|
|
1084
|
+
size: current.declaredSize,
|
|
1085
|
+
dev: current.dev,
|
|
1086
|
+
ino: current.ino,
|
|
1087
|
+
}),
|
|
1088
|
+
readChunk: () => 0,
|
|
1089
|
+
closeFile() {},
|
|
1090
|
+
},
|
|
1091
|
+
1_024,
|
|
1092
|
+
),
|
|
1093
|
+
/changed while building/u,
|
|
1094
|
+
);
|
|
1095
|
+
let grew = false;
|
|
1096
|
+
assert.throws(
|
|
1097
|
+
() =>
|
|
1098
|
+
run(file("abc", 2), ({ descriptor, position }) => {
|
|
1099
|
+
if (!grew && position === 3) {
|
|
1100
|
+
grew = true;
|
|
1101
|
+
descriptor.file.content = Buffer.from("abcd");
|
|
1102
|
+
descriptor.file.declaredSize = 4;
|
|
1103
|
+
}
|
|
1104
|
+
}),
|
|
1105
|
+
/changed while building/u,
|
|
1106
|
+
);
|
|
1107
|
+
let truncated = false;
|
|
1108
|
+
assert.throws(
|
|
1109
|
+
() =>
|
|
1110
|
+
run(file("abcdef", 3), ({ descriptor, position }) => {
|
|
1111
|
+
if (!truncated && position === 0) {
|
|
1112
|
+
truncated = true;
|
|
1113
|
+
descriptor.file.content = Buffer.from("abc");
|
|
1114
|
+
descriptor.file.declaredSize = 3;
|
|
1115
|
+
}
|
|
1116
|
+
}),
|
|
1117
|
+
/changed while building/u,
|
|
1118
|
+
);
|
|
1119
|
+
let replaced = false;
|
|
1120
|
+
assert.throws(
|
|
1121
|
+
() =>
|
|
1122
|
+
run(file("abc", 4), ({ files, position }) => {
|
|
1123
|
+
if (!replaced && position === 3) {
|
|
1124
|
+
replaced = true;
|
|
1125
|
+
files.set("scripts/source.mjs", file("abc", 5));
|
|
1126
|
+
}
|
|
1127
|
+
}),
|
|
1128
|
+
/changed while building/u,
|
|
1129
|
+
);
|
|
1130
|
+
});
|
|
1131
|
+
|
|
1132
|
+
test("source provenance rejects oversized untracked input before reading content", () => {
|
|
1133
|
+
let reads = 0;
|
|
1134
|
+
let closes = 0;
|
|
1135
|
+
assert.throws(
|
|
1136
|
+
() =>
|
|
1137
|
+
readBoundedSourceTraceFiles(
|
|
1138
|
+
"tracked",
|
|
1139
|
+
["scripts/huge-new.mjs"],
|
|
1140
|
+
{
|
|
1141
|
+
openFile: () => 17,
|
|
1142
|
+
statFile: () => ({ isFile: () => true, size: PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES }),
|
|
1143
|
+
readFile: () => {
|
|
1144
|
+
reads += 1;
|
|
1145
|
+
return Buffer.alloc(0);
|
|
1146
|
+
},
|
|
1147
|
+
closeFile: () => {
|
|
1148
|
+
closes += 1;
|
|
1149
|
+
},
|
|
1150
|
+
},
|
|
1151
|
+
1_024,
|
|
1152
|
+
),
|
|
1153
|
+
/hard ceiling/u,
|
|
1154
|
+
);
|
|
1155
|
+
assert.equal(reads, 0);
|
|
1156
|
+
assert.equal(closes, 1);
|
|
1157
|
+
let statCalls = 0;
|
|
1158
|
+
assert.throws(
|
|
1159
|
+
() =>
|
|
1160
|
+
readBoundedSourceTraceFiles("", ["scripts/raced.mjs"], {
|
|
1161
|
+
openFile: () => 18,
|
|
1162
|
+
statFile: () => {
|
|
1163
|
+
statCalls += 1;
|
|
1164
|
+
return {
|
|
1165
|
+
isFile: () => true,
|
|
1166
|
+
size: statCalls === 1 ? 1 : 2,
|
|
1167
|
+
dev: 4,
|
|
1168
|
+
ino: 9,
|
|
1169
|
+
};
|
|
1170
|
+
},
|
|
1171
|
+
readFile: () => Buffer.from("x"),
|
|
1172
|
+
closeFile: () => undefined,
|
|
1173
|
+
}),
|
|
1174
|
+
/changed while hashing/u,
|
|
1175
|
+
);
|
|
1176
|
+
assert.throws(
|
|
1177
|
+
() =>
|
|
1178
|
+
readBoundedSourceTraceFiles(
|
|
1179
|
+
"",
|
|
1180
|
+
Array.from(
|
|
1181
|
+
{ length: PRODUCT_RIG_SOURCE_INVENTORY_MAX_PATHS + 1 },
|
|
1182
|
+
(_, index) => `scripts/${index}.mjs`,
|
|
1183
|
+
),
|
|
1184
|
+
{
|
|
1185
|
+
openFile: () => assert.fail("oversized inventory must not open files"),
|
|
1186
|
+
statFile: () => assert.fail("oversized inventory must not stat files"),
|
|
1187
|
+
readFile: () => assert.fail("oversized inventory must not read files"),
|
|
1188
|
+
closeFile: () => assert.fail("oversized inventory must not close unopened files"),
|
|
1189
|
+
},
|
|
1190
|
+
),
|
|
1191
|
+
/path-count ceiling/u,
|
|
1192
|
+
);
|
|
1193
|
+
assert.throws(
|
|
1194
|
+
() =>
|
|
1195
|
+
buildSourceTracePayload("", [
|
|
1196
|
+
{ path: "x".repeat(PRODUCT_RIG_SOURCE_PATH_MAX_BYTES + 1), content: "" },
|
|
1197
|
+
]),
|
|
1198
|
+
/malformed/u,
|
|
1199
|
+
);
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
test("source provenance excludes tracked native changes but binds tracked source changes", () => {
|
|
1203
|
+
const root = mkdtempSync(join(tmpdir(), "tmux-ide-source-trace-"));
|
|
1204
|
+
try {
|
|
1205
|
+
execFileSync("git", ["init", "-q"], { cwd: root });
|
|
1206
|
+
mkdirSync(join(root, "scripts"), { recursive: true });
|
|
1207
|
+
mkdirSync(join(root, "packages", "daemon", "native"), { recursive: true });
|
|
1208
|
+
writeFileSync(join(root, "scripts", "tracked.mjs"), "export const value = 1;\n");
|
|
1209
|
+
writeFileSync(join(root, "packages", "daemon", "native", "tracked.bin"), "native-1\n");
|
|
1210
|
+
execFileSync("git", ["add", "."], { cwd: root });
|
|
1211
|
+
execFileSync(
|
|
1212
|
+
"git",
|
|
1213
|
+
["-c", "user.name=ProductRig", "-c", "user.email=rig@example.test", "commit", "-qm", "base"],
|
|
1214
|
+
{ cwd: root },
|
|
1215
|
+
);
|
|
1216
|
+
writeFileSync(join(root, "packages", "daemon", "native", "tracked.bin"), "native-2\n");
|
|
1217
|
+
assert.equal(
|
|
1218
|
+
execFileSync("git", productRigSourceTraceDiffArgs(), { cwd: root, encoding: "utf8" }),
|
|
1219
|
+
"",
|
|
1220
|
+
);
|
|
1221
|
+
writeFileSync(join(root, "scripts", "tracked.mjs"), "export const value = 2;\n");
|
|
1222
|
+
const diff = execFileSync("git", productRigSourceTraceDiffArgs(), {
|
|
1223
|
+
cwd: root,
|
|
1224
|
+
encoding: "utf8",
|
|
1225
|
+
});
|
|
1226
|
+
assert.match(diff, /scripts\/tracked\.mjs/u);
|
|
1227
|
+
assert.doesNotMatch(diff, /packages\/daemon\/native/u);
|
|
1228
|
+
writeFileSync(join(root, "packages", "daemon", "native", "untracked.bin"), "native-new\n");
|
|
1229
|
+
writeFileSync(join(root, "scripts", "untracked.mjs"), "export const fresh = true;\n");
|
|
1230
|
+
const untracked = execFileSync("git", productRigSourceTraceUntrackedArgs(), {
|
|
1231
|
+
cwd: root,
|
|
1232
|
+
encoding: "utf8",
|
|
1233
|
+
})
|
|
1234
|
+
.split("\0")
|
|
1235
|
+
.filter(Boolean);
|
|
1236
|
+
assert.deepEqual(untracked, ["scripts/untracked.mjs"]);
|
|
1237
|
+
} finally {
|
|
1238
|
+
rmSync(root, { recursive: true, force: true });
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
test("key and paste timelines use distinct attempt-local origins shared with their owners", () => {
|
|
1243
|
+
let parentNow = 10_000;
|
|
1244
|
+
const keyParent = createProductRigAttemptTimelineClock(() => parentNow, 10_000);
|
|
1245
|
+
assert.equal(keyParent.elapsedMs(), 0);
|
|
1246
|
+
parentNow = 10_250;
|
|
1247
|
+
assert.equal(keyParent.elapsedMs(), 250);
|
|
1248
|
+
|
|
1249
|
+
let ownerNow = 10_400;
|
|
1250
|
+
const keyOwner = createProductRigAttemptTimelineClock(() => ownerNow, 10_000);
|
|
1251
|
+
assert.equal(keyOwner.elapsedMs(), 400);
|
|
1252
|
+
ownerNow = 34_000;
|
|
1253
|
+
assert.equal(keyOwner.elapsedMs(), 24_000);
|
|
1254
|
+
|
|
1255
|
+
let pasteNow = 63_000;
|
|
1256
|
+
const pasteParent = createProductRigAttemptTimelineClock(() => pasteNow, 63_000);
|
|
1257
|
+
assert.equal(pasteParent.elapsedMs(), 0);
|
|
1258
|
+
pasteNow = 88_400;
|
|
1259
|
+
assert.equal(pasteParent.elapsedMs(), 25_400);
|
|
1260
|
+
assert.notEqual(pasteParent.elapsedMs(), 53_026);
|
|
1261
|
+
|
|
1262
|
+
let pasteOwnerNow = 63_180;
|
|
1263
|
+
const pasteOwner = createProductRigAttemptTimelineClock(() => pasteOwnerNow, 63_000);
|
|
1264
|
+
assert.equal(pasteOwner.elapsedMs(), 180);
|
|
1265
|
+
pasteOwnerNow = 63_179;
|
|
1266
|
+
assert.throws(() => pasteOwner.elapsedMs(), /invalid/u);
|
|
1267
|
+
|
|
1268
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
1269
|
+
assert.match(
|
|
1270
|
+
source,
|
|
1271
|
+
/async function executeDiagnosticAttempt\(entry\) \{\s*resetAttemptTimelineClock\(\);/u,
|
|
1272
|
+
);
|
|
1273
|
+
assert.match(source, /TMUX_IDE_PRODUCT_TIMELINE_ORIGIN_MS: String\(attemptTimelineOriginMs\)/u);
|
|
1274
|
+
assert.match(
|
|
1275
|
+
source,
|
|
1276
|
+
/resetAttemptTimelineClock\(\s*Number\.isFinite\(inheritedTimelineOrigin\)/u,
|
|
1277
|
+
);
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1280
|
+
test("Web startup evidence redacts browser authority recursively", () => {
|
|
1281
|
+
const secret = "owner-secret-value";
|
|
1282
|
+
const evidence = buildWebStartupEvidence(
|
|
1283
|
+
{
|
|
1284
|
+
capturedAt: "2026-08-16T00:00:00.000Z",
|
|
1285
|
+
navigation: {
|
|
1286
|
+
requestedUrl: `http://localhost/?token=${secret}`,
|
|
1287
|
+
url: `ws://localhost/events?__tmux_ide_dev_host_session=${secret}`,
|
|
1288
|
+
status: 503,
|
|
1289
|
+
},
|
|
1290
|
+
page: { authorization: `Bearer ${secret}`, bodyExcerpt: `token=${secret}` },
|
|
1291
|
+
dom: { tag: "meta", attributes: { capability: secret }, children: [] },
|
|
1292
|
+
console: [{ type: "error", text: `Bearer ${secret}` }],
|
|
1293
|
+
webSockets: [{ event: "open", url: `ws://localhost/?__tmux_ide_dev_host_session=${secret}` }],
|
|
1294
|
+
screenshotPath: "/tmp/evidence.png",
|
|
1295
|
+
screenshotError: null,
|
|
1296
|
+
viteOutput: `ownerToken=${secret}`,
|
|
1297
|
+
daemonOutput: secret,
|
|
1298
|
+
},
|
|
1299
|
+
{ secrets: [secret] },
|
|
1300
|
+
);
|
|
1301
|
+
const serialized = JSON.stringify(evidence);
|
|
1302
|
+
assert.doesNotMatch(serialized, new RegExp(secret, "u"));
|
|
1303
|
+
assert.match(serialized, /\[REDACTED\]/u);
|
|
1304
|
+
assert.equal(evidence.page.authorization, "[REDACTED]");
|
|
1305
|
+
assert.equal(evidence.dom, null);
|
|
1306
|
+
assert.match(redactWebDiagnosticText("Authorization: Bearer abc"), /\[REDACTED\]/u);
|
|
1307
|
+
assert.doesNotMatch(
|
|
1308
|
+
redactWebDiagnosticText(`/?__tmux_ide_dev_host_session=${secret}`),
|
|
1309
|
+
new RegExp(secret, "u"),
|
|
1310
|
+
);
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
test("Web startup evidence has a deterministic bounded shape", () => {
|
|
1314
|
+
const events = Array.from(
|
|
1315
|
+
{ length: PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount + 9 },
|
|
1316
|
+
(_, id) => ({
|
|
1317
|
+
id,
|
|
1318
|
+
text: "x".repeat(PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.textChars + 20),
|
|
1319
|
+
}),
|
|
1320
|
+
);
|
|
1321
|
+
const evidence = buildWebStartupEvidence({
|
|
1322
|
+
capturedAt: "now",
|
|
1323
|
+
console: events,
|
|
1324
|
+
webSockets: events.map(({ id }) => ({ event: "open", id, url: `ws://localhost/${id}` })),
|
|
1325
|
+
viteOutput: "v".repeat(PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.processOutputChars + 20),
|
|
1326
|
+
daemonOutput: "d".repeat(PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.processOutputChars + 20),
|
|
1327
|
+
});
|
|
1328
|
+
assert.deepEqual(Object.keys(evidence), [
|
|
1329
|
+
"version",
|
|
1330
|
+
"kind",
|
|
1331
|
+
"capturedAt",
|
|
1332
|
+
"navigation",
|
|
1333
|
+
"page",
|
|
1334
|
+
"dom",
|
|
1335
|
+
"pageErrors",
|
|
1336
|
+
"console",
|
|
1337
|
+
"requestFailures",
|
|
1338
|
+
"httpErrors",
|
|
1339
|
+
"webSockets",
|
|
1340
|
+
"screenshotPath",
|
|
1341
|
+
"screenshotError",
|
|
1342
|
+
"viteOutput",
|
|
1343
|
+
"daemonOutput",
|
|
1344
|
+
]);
|
|
1345
|
+
assert.equal(evidence.console.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount);
|
|
1346
|
+
assert.equal(evidence.console[0].id, 9);
|
|
1347
|
+
assert.equal(evidence.console[0].text.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.textChars);
|
|
1348
|
+
assert.equal(evidence.webSockets.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount);
|
|
1349
|
+
assert.equal(evidence.webSockets[0].id, 9);
|
|
1350
|
+
assert.equal(evidence.viteOutput.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.processOutputChars);
|
|
1351
|
+
assert.equal(evidence.daemonOutput.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.processOutputChars);
|
|
1352
|
+
assert.equal(evidence.screenshotPath, null);
|
|
1353
|
+
assert.equal(evidence.screenshotError, null);
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1356
|
+
test("Web startup collectors bound at capture time and retain the host-active info line", () => {
|
|
1357
|
+
const captured = [];
|
|
1358
|
+
for (let id = 0; id < PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount + 3; id += 1) {
|
|
1359
|
+
appendBoundedWebDiagnostic(captured, { id });
|
|
1360
|
+
}
|
|
1361
|
+
assert.equal(captured.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount);
|
|
1362
|
+
assert.equal(captured[0].id, 3);
|
|
1363
|
+
assert.equal(shouldCaptureWebConsoleMessage("warning", "ordinary warning"), true);
|
|
1364
|
+
assert.equal(
|
|
1365
|
+
shouldCaptureWebConsoleMessage("info", "[tmux-ide] development web host active via gateway"),
|
|
1366
|
+
true,
|
|
1367
|
+
);
|
|
1368
|
+
assert.equal(shouldCaptureWebConsoleMessage("info", "ordinary info"), false);
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
test("Web startup collectors sanitize oversized raw events before retaining them", () => {
|
|
1372
|
+
const secret = "raw-host-session-secret";
|
|
1373
|
+
const captured = [];
|
|
1374
|
+
appendBoundedWebDiagnostic(
|
|
1375
|
+
captured,
|
|
1376
|
+
{
|
|
1377
|
+
url: `ws://localhost/?__tmux_ide_dev_host_session=${secret}`,
|
|
1378
|
+
text: "t".repeat(PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.textChars + 100),
|
|
1379
|
+
error: `Bearer ${secret}`,
|
|
1380
|
+
nested: Array.from({ length: PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount + 5 }, (_, id) => ({
|
|
1381
|
+
id,
|
|
1382
|
+
detail: "d".repeat(PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.textChars + 100),
|
|
1383
|
+
})),
|
|
1384
|
+
[`${"x".repeat(PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.fieldNameChars)}token`]: secret,
|
|
1385
|
+
...Object.fromEntries(
|
|
1386
|
+
Array.from({ length: PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount + 5 }, (_, id) => [
|
|
1387
|
+
`field-${id}`,
|
|
1388
|
+
id,
|
|
1389
|
+
]),
|
|
1390
|
+
),
|
|
1391
|
+
},
|
|
1392
|
+
{ secrets: [secret] },
|
|
1393
|
+
);
|
|
1394
|
+
const [event] = captured;
|
|
1395
|
+
assert.notEqual(event.text.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.textChars + 100);
|
|
1396
|
+
assert.equal(event.text.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.textChars);
|
|
1397
|
+
assert.equal(event.nested.length, PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount);
|
|
1398
|
+
assert.ok(Object.keys(event).length <= PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount);
|
|
1399
|
+
assert.ok(Object.values(event).includes("[REDACTED]"));
|
|
1400
|
+
assert.doesNotMatch(JSON.stringify(event), new RegExp(secret, "u"));
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
test("Web diagnostic evaluation has a fixed deadline and consumes a late rejection", async () => {
|
|
1404
|
+
const never = new Promise(() => undefined);
|
|
1405
|
+
const timedOut = await awaitWebDiagnosticWithDeadline(never, {
|
|
1406
|
+
timeoutMs: 1,
|
|
1407
|
+
onFailure: (error) => error.message,
|
|
1408
|
+
});
|
|
1409
|
+
assert.match(timedOut, /evaluation exceeded 1ms/u);
|
|
1410
|
+
|
|
1411
|
+
let rejectLate;
|
|
1412
|
+
const late = new Promise((resolve, reject) => {
|
|
1413
|
+
rejectLate = reject;
|
|
1414
|
+
});
|
|
1415
|
+
const lateResult = await awaitWebDiagnosticWithDeadline(late, {
|
|
1416
|
+
timeoutMs: 0,
|
|
1417
|
+
onFailure: (error) => error.message,
|
|
1418
|
+
});
|
|
1419
|
+
rejectLate(new Error("late renderer rejection"));
|
|
1420
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
1421
|
+
assert.match(lateResult, /evaluation exceeded 0ms/u);
|
|
1422
|
+
});
|
|
1423
|
+
|
|
1424
|
+
test("host publication proof requires chrome and generation-local terminal bytes", () => {
|
|
1425
|
+
const first = buildTuiHostPublicationEvidence({
|
|
1426
|
+
frame: " tmux-ide F2 Terminals\nprompt FIRST_GENERATION_MARKER",
|
|
1427
|
+
kind: "terminal",
|
|
1428
|
+
token: "FIRST_GENERATION_MARKER",
|
|
1429
|
+
generation: "generation-a",
|
|
1430
|
+
processId: 11,
|
|
1431
|
+
elapsedMs: 42.4,
|
|
1432
|
+
});
|
|
1433
|
+
const second = buildTuiHostPublicationEvidence({
|
|
1434
|
+
frame: " tmux-ide F2 Terminals\nprompt SECOND_GENERATION_MARKER",
|
|
1435
|
+
kind: "terminal",
|
|
1436
|
+
token: "SECOND_GENERATION_MARKER",
|
|
1437
|
+
generation: "generation-b",
|
|
1438
|
+
processId: 12,
|
|
1439
|
+
elapsedMs: 39.7,
|
|
1440
|
+
});
|
|
1441
|
+
assert.equal(first.passed, true);
|
|
1442
|
+
assert.equal(second.passed, true);
|
|
1443
|
+
assert.notEqual(first.frameHash, second.frameHash);
|
|
1444
|
+
assert.equal(
|
|
1445
|
+
buildTuiHostPublicationEvidence({
|
|
1446
|
+
frame: "",
|
|
1447
|
+
kind: "terminal",
|
|
1448
|
+
token: "SECOND_GENERATION_MARKER",
|
|
1449
|
+
}).passed,
|
|
1450
|
+
false,
|
|
1451
|
+
);
|
|
1452
|
+
assert.equal(
|
|
1453
|
+
buildTuiHostPublicationEvidence({
|
|
1454
|
+
frame: "tmux-ide without the requested terminal bytes",
|
|
1455
|
+
kind: "terminal",
|
|
1456
|
+
token: "SECOND_GENERATION_MARKER",
|
|
1457
|
+
}).passed,
|
|
1458
|
+
false,
|
|
1459
|
+
);
|
|
1460
|
+
assert.equal(
|
|
1461
|
+
buildTuiHostPublicationEvidence({ frame: "tmux-ide", kind: "terminal" }).passed,
|
|
1462
|
+
false,
|
|
1463
|
+
);
|
|
1464
|
+
assert.throws(
|
|
1465
|
+
() => buildTuiHostPublicationEvidence({ frame: "tmux-ide", kind: "paint" }),
|
|
1466
|
+
/chrome or terminal/u,
|
|
1467
|
+
);
|
|
1468
|
+
});
|
|
1469
|
+
|
|
1470
|
+
test("normalizes external host generation marks for warm coherent timing", () => {
|
|
1471
|
+
const lifecycle = [
|
|
1472
|
+
{
|
|
1473
|
+
phase: "generation-connection-resolved",
|
|
1474
|
+
daemonGeneration: "generation-a",
|
|
1475
|
+
elapsedMs: 100,
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
phase: "first-terminal-frame",
|
|
1479
|
+
daemonGeneration: "generation-a",
|
|
1480
|
+
elapsedMs: 300,
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
phase: "host-terminal-publication",
|
|
1484
|
+
generation: "generation-a",
|
|
1485
|
+
elapsedMs: 325,
|
|
1486
|
+
},
|
|
1487
|
+
];
|
|
1488
|
+
assert.equal(coherentGenerationDuration(lifecycle), 225);
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
test("resolves active tmux runtime and semantic pane identities together", () => {
|
|
1492
|
+
const pane = activeTmuxPaneFromRows(
|
|
1493
|
+
[
|
|
1494
|
+
"%1|1|0|pane.promoted.left|0|0|50|30",
|
|
1495
|
+
"%2|1|1|pane.promoted.right|51|0|50|30",
|
|
1496
|
+
"%3|0|1|pane.promoted.hidden|0|0|101|30",
|
|
1497
|
+
].join("\n"),
|
|
1498
|
+
);
|
|
1499
|
+
assert.deepEqual(pane, {
|
|
1500
|
+
paneId: "%2",
|
|
1501
|
+
windowActive: true,
|
|
1502
|
+
paneActive: true,
|
|
1503
|
+
semanticPaneId: "pane.promoted.right",
|
|
1504
|
+
left: 51,
|
|
1505
|
+
top: 0,
|
|
1506
|
+
width: 50,
|
|
1507
|
+
height: 30,
|
|
1508
|
+
});
|
|
1509
|
+
assert.equal(activeTmuxPaneFromRows("%1|1|1||0|0|50|30"), null);
|
|
1510
|
+
assert.equal(
|
|
1511
|
+
activeTmuxPaneFromRows("%1|1|1|pane.one|0|0|50|30\n%2|1|1|pane.two|50|0|50|30"),
|
|
1512
|
+
null,
|
|
1513
|
+
);
|
|
1514
|
+
assert.equal(
|
|
1515
|
+
bindPromotedInitialPane({ paneId: "%2", width: 80, height: 24 }, pane).semanticPaneId,
|
|
1516
|
+
"pane.promoted.right",
|
|
1517
|
+
);
|
|
1518
|
+
assert.throws(
|
|
1519
|
+
() => bindPromotedInitialPane({ paneId: "%1", width: 80, height: 24 }, pane),
|
|
1520
|
+
/did not match/u,
|
|
1521
|
+
);
|
|
1522
|
+
});
|
|
1523
|
+
|
|
1524
|
+
test("anchors a two-pane framebuffer body to semantic chrome when tmux origin drifted", () => {
|
|
1525
|
+
const frame = [
|
|
1526
|
+
" tmux-ide",
|
|
1527
|
+
" one",
|
|
1528
|
+
"● pane.promoted.left".padEnd(50) + " " + "○ pane.promoted.right".padEnd(50),
|
|
1529
|
+
"left seed".padEnd(50) + " " + "__right_unique_marker__".padEnd(50),
|
|
1530
|
+
"".padEnd(50) + " " + "right row two".padEnd(50),
|
|
1531
|
+
"".padEnd(50) + " " + "right row three".padEnd(50),
|
|
1532
|
+
].join("\n");
|
|
1533
|
+
const pane = activeTmuxPaneFromRows(
|
|
1534
|
+
// Deliberately stale/impossible tmux origin: this is the failure mode the
|
|
1535
|
+
// live evidence previously hashed as an almost-empty rectangle. Keeping
|
|
1536
|
+
// the full active-pane sample supplies the semantic chrome anchor.
|
|
1537
|
+
"%2|1|1|pane.promoted.right|7|28|50|3",
|
|
1538
|
+
);
|
|
1539
|
+
assert.ok(pane);
|
|
1540
|
+
assert.deepEqual(resolvePaneBodyRect(frame, pane), {
|
|
1541
|
+
left: 51,
|
|
1542
|
+
firstBodyRow: 3,
|
|
1543
|
+
width: 50,
|
|
1544
|
+
bodyRows: 3,
|
|
1545
|
+
origin: "semantic-pane-chrome",
|
|
1546
|
+
valid: true,
|
|
1547
|
+
semanticChromeMatches: 1,
|
|
1548
|
+
});
|
|
1549
|
+
assert.match(paneBodyRegion(frame, pane), /__right_unique_marker__/u);
|
|
1550
|
+
assert.doesNotMatch(paneBodyRegion(frame, pane), /left seed/u);
|
|
1551
|
+
});
|
|
1552
|
+
|
|
1553
|
+
test("root-v2 projects all 40 tmux content rows below separate semantic chrome", () => {
|
|
1554
|
+
const frame = [
|
|
1555
|
+
" tmux-ide",
|
|
1556
|
+
" ordinary",
|
|
1557
|
+
"● pane.run".padEnd(132),
|
|
1558
|
+
...Array.from({ length: 40 }, (_unused, row) => `body-${row}`.padEnd(132)),
|
|
1559
|
+
].join("\n");
|
|
1560
|
+
const pane = {
|
|
1561
|
+
semanticPaneId: "pane.run",
|
|
1562
|
+
left: 0,
|
|
1563
|
+
top: 0,
|
|
1564
|
+
width: 132,
|
|
1565
|
+
height: 40,
|
|
1566
|
+
};
|
|
1567
|
+
assert.deepEqual(resolvePaneBodyRect(frame, pane), {
|
|
1568
|
+
left: 0,
|
|
1569
|
+
firstBodyRow: 3,
|
|
1570
|
+
width: 132,
|
|
1571
|
+
bodyRows: 40,
|
|
1572
|
+
origin: "semantic-pane-chrome",
|
|
1573
|
+
valid: true,
|
|
1574
|
+
semanticChromeMatches: 1,
|
|
1575
|
+
});
|
|
1576
|
+
assert.equal(paneBodyRegion(frame, pane).split("\n").length, 40);
|
|
1577
|
+
assert.match(paneBodyRegion(frame, pane), /body-39/u);
|
|
1578
|
+
});
|
|
1579
|
+
|
|
1580
|
+
test("anchors memorable pane-name chrome to its canonical semantic layout identity", () => {
|
|
1581
|
+
const frame = [
|
|
1582
|
+
" tmux-ide",
|
|
1583
|
+
" ordinary",
|
|
1584
|
+
"● amber-forest".padEnd(50) + " " + "○ quiet-river".padEnd(50),
|
|
1585
|
+
"left body".padEnd(50) + " " + "__right_memorable_marker__".padEnd(50),
|
|
1586
|
+
"left row two".padEnd(50) + " " + "right row two".padEnd(50),
|
|
1587
|
+
].join("\n");
|
|
1588
|
+
const pane = {
|
|
1589
|
+
semanticPaneId: "pane.promoted.right",
|
|
1590
|
+
displayName: "node",
|
|
1591
|
+
canonicalDisplayNames: ["node", "quiet-river"],
|
|
1592
|
+
left: 51,
|
|
1593
|
+
top: 0,
|
|
1594
|
+
width: 50,
|
|
1595
|
+
height: 2,
|
|
1596
|
+
};
|
|
1597
|
+
|
|
1598
|
+
assert.deepEqual(resolvePaneBodyRect(frame, pane), {
|
|
1599
|
+
left: 51,
|
|
1600
|
+
firstBodyRow: 3,
|
|
1601
|
+
width: 50,
|
|
1602
|
+
bodyRows: 2,
|
|
1603
|
+
origin: "semantic-pane-chrome",
|
|
1604
|
+
valid: true,
|
|
1605
|
+
semanticChromeMatches: 1,
|
|
1606
|
+
});
|
|
1607
|
+
assert.match(paneBodyRegion(frame, pane), /__right_memorable_marker__/u);
|
|
1608
|
+
assert.doesNotMatch(paneBodyRegion(frame, pane), /left body/u);
|
|
1609
|
+
|
|
1610
|
+
const duplicate = frame.replace("amber-forest", "quiet-river");
|
|
1611
|
+
assert.deepEqual(resolvePaneBodyRect(duplicate, pane), {
|
|
1612
|
+
left: 51,
|
|
1613
|
+
firstBodyRow: 3,
|
|
1614
|
+
width: 50,
|
|
1615
|
+
bodyRows: 0,
|
|
1616
|
+
origin: "semantic-pane-chrome-ambiguous",
|
|
1617
|
+
valid: false,
|
|
1618
|
+
semanticChromeMatches: 2,
|
|
1619
|
+
});
|
|
1620
|
+
});
|
|
1621
|
+
|
|
1622
|
+
test("pane body evidence fails closed without a canonical semantic identity", () => {
|
|
1623
|
+
assert.deepEqual(
|
|
1624
|
+
resolvePaneBodyRect("● memorable-pane\nbody", {
|
|
1625
|
+
displayName: "memorable-pane",
|
|
1626
|
+
left: 0,
|
|
1627
|
+
top: 0,
|
|
1628
|
+
width: 40,
|
|
1629
|
+
height: 1,
|
|
1630
|
+
}),
|
|
1631
|
+
{
|
|
1632
|
+
left: 0,
|
|
1633
|
+
firstBodyRow: 3,
|
|
1634
|
+
width: 40,
|
|
1635
|
+
bodyRows: 0,
|
|
1636
|
+
origin: "semantic-pane-identity-missing",
|
|
1637
|
+
valid: false,
|
|
1638
|
+
semanticChromeMatches: 0,
|
|
1639
|
+
},
|
|
1640
|
+
);
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
test("focus framebuffer proof has no synchronous target tmux reads and fences native capture", () => {
|
|
1644
|
+
const source = readFileSync(join(process.cwd(), "scripts", "product-test-rig.mjs"), "utf8");
|
|
1645
|
+
const focusSlice = source.slice(
|
|
1646
|
+
source.indexOf("async function focusPaneSnapshot("),
|
|
1647
|
+
source.indexOf("async function activePaneBodyEvidence("),
|
|
1648
|
+
);
|
|
1649
|
+
assert.doesNotMatch(focusSlice, /execFileSync|tuiCommand\(/u);
|
|
1650
|
+
assert.match(focusSlice, /focusActiveWindowPaneGeometry\(state, lifecycle\)/u);
|
|
1651
|
+
assert.match(focusSlice, /stage: "native-body-post-capture"/u);
|
|
1652
|
+
assert.match(source, /#\{window_visible_layout\}/u);
|
|
1653
|
+
});
|
|
1654
|
+
|
|
1655
|
+
test("focus Web success publishes exact stable semantic readiness before later correlation", () => {
|
|
1656
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
1657
|
+
const start = source.indexOf("startWebAfterFocus:");
|
|
1658
|
+
const slice = source.slice(start, source.indexOf('if (journeyId === "session-recreate")', start));
|
|
1659
|
+
const readinessPublish = slice.indexOf("focusWebSemantic: semantic");
|
|
1660
|
+
const laterWorkspaceState = slice.indexOf("waitForFocusWorkspaceEvidence", readinessPublish);
|
|
1661
|
+
const watermark = slice.indexOf("focusWorkspaceEvidenceWatermark");
|
|
1662
|
+
const devServerStart = slice.indexOf("startDevServer");
|
|
1663
|
+
assert.ok(readinessPublish > 0);
|
|
1664
|
+
assert.ok(laterWorkspaceState > readinessPublish);
|
|
1665
|
+
assert.ok(watermark > 0);
|
|
1666
|
+
assert.ok(devServerStart > watermark);
|
|
1667
|
+
assert.match(
|
|
1668
|
+
slice,
|
|
1669
|
+
/derivedResources: reclaim\.workspaceClient\.derived\.terminalInventory\.resources/u,
|
|
1670
|
+
);
|
|
1671
|
+
assert.doesNotMatch(slice, /derivedResources:[^\n]*\?\?/u);
|
|
1672
|
+
assert.match(slice, /clientGeneration: reclaim\.workspaceClient\.committed\.generation/u);
|
|
1673
|
+
assert.match(slice, /semanticPaneId: reclaim\.assessment\.qualified\.semanticPaneId/u);
|
|
1674
|
+
assert.match(slice, /afterMicros: workspaceClientWatermark \+ 1/u);
|
|
1675
|
+
assert.match(slice, /boundary: "focus-web-correlation"/u);
|
|
1676
|
+
const reclaimStart = source.indexOf("driveFocus:");
|
|
1677
|
+
const reclaimSlice = source.slice(reclaimStart, start);
|
|
1678
|
+
assert.match(reclaimSlice, /\.\.\.baseline\.expected,[\s\S]*boundary: "focus-reclaim-proved"/u);
|
|
1679
|
+
assert.match(
|
|
1680
|
+
slice,
|
|
1681
|
+
/semantic: focusBoot\.web\.semantic,[\s\S]*readiness: focusBoot\.web\.readiness/u,
|
|
1682
|
+
);
|
|
1683
|
+
assert.doesNotMatch(slice, /locator\("\.terminal-surface\[data-phase='connected'\]"\)/u);
|
|
1684
|
+
});
|
|
1685
|
+
|
|
1686
|
+
test("causal qualification passes the full active pane into its after-capture body", () => {
|
|
1687
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
1688
|
+
assert.match(source, /const renderedBody = paneBodyRegion\(tuiFrame, activePane\);/u);
|
|
1689
|
+
});
|
|
1690
|
+
|
|
1691
|
+
test("fails closed when duplicate semantic chrome could map a marker to the wrong pane", () => {
|
|
1692
|
+
const frame = [
|
|
1693
|
+
" tmux-ide",
|
|
1694
|
+
" one",
|
|
1695
|
+
"● pane.duplicate".padEnd(30) + "○ pane.duplicate".padEnd(30),
|
|
1696
|
+
// The marker expected for the RIGHT-hand pane appears only in the first,
|
|
1697
|
+
// wrong rectangle. A first-match resolver would therefore false-pass.
|
|
1698
|
+
"__right_marker__".padEnd(30) + "right has no marker".padEnd(30),
|
|
1699
|
+
].join("\n");
|
|
1700
|
+
const pane = {
|
|
1701
|
+
semanticPaneId: "pane.duplicate",
|
|
1702
|
+
left: 30,
|
|
1703
|
+
top: 0,
|
|
1704
|
+
width: 30,
|
|
1705
|
+
height: 2,
|
|
1706
|
+
};
|
|
1707
|
+
assert.match(frame.split("\n")[3].slice(0, 30), /__right_marker__/u);
|
|
1708
|
+
assert.doesNotMatch(frame.split("\n")[3].slice(30, 60), /__right_marker__/u);
|
|
1709
|
+
assert.deepEqual(resolvePaneBodyRect(frame, pane), {
|
|
1710
|
+
left: 30,
|
|
1711
|
+
firstBodyRow: 3,
|
|
1712
|
+
width: 30,
|
|
1713
|
+
bodyRows: 0,
|
|
1714
|
+
origin: "semantic-pane-chrome-ambiguous",
|
|
1715
|
+
valid: false,
|
|
1716
|
+
semanticChromeMatches: 2,
|
|
1717
|
+
});
|
|
1718
|
+
assert.equal(paneBodyRegion(frame, pane), "");
|
|
1719
|
+
});
|
|
1720
|
+
|
|
1721
|
+
test("pane geometry identity is order-independent and changes on any rectangle mutation", () => {
|
|
1722
|
+
const left = {
|
|
1723
|
+
paneId: "%1",
|
|
1724
|
+
semanticPaneId: "pane.left",
|
|
1725
|
+
left: 0,
|
|
1726
|
+
top: 0,
|
|
1727
|
+
width: 50,
|
|
1728
|
+
height: 30,
|
|
1729
|
+
};
|
|
1730
|
+
const right = {
|
|
1731
|
+
paneId: "%2",
|
|
1732
|
+
semanticPaneId: "pane.right",
|
|
1733
|
+
left: 51,
|
|
1734
|
+
top: 0,
|
|
1735
|
+
width: 50,
|
|
1736
|
+
height: 30,
|
|
1737
|
+
};
|
|
1738
|
+
assert.equal(paneGeometryIdentity([left, right]), paneGeometryIdentity([right, left]));
|
|
1739
|
+
assert.notEqual(
|
|
1740
|
+
paneGeometryIdentity([left, right]),
|
|
1741
|
+
paneGeometryIdentity([left, { ...right, left: 52 }]),
|
|
1742
|
+
);
|
|
1743
|
+
});
|
|
1744
|
+
|
|
1745
|
+
test("coherent readiness never aliases app chrome to terminal readiness", () => {
|
|
1746
|
+
assert.deepEqual(coherentReadiness({ chromeMs: 12.4, terminalMs: null }), {
|
|
1747
|
+
appChromeFrameMs: 12,
|
|
1748
|
+
coherentTerminalFrameMs: null,
|
|
1749
|
+
ready: false,
|
|
1750
|
+
});
|
|
1751
|
+
assert.equal(coherentReadiness({ chromeMs: 12, terminalMs: 31 }).ready, true);
|
|
1752
|
+
});
|
|
1753
|
+
|
|
1754
|
+
test("correlates same-client stages and daemon-local spans without subtracting clocks", () => {
|
|
1755
|
+
const traceId = "00000000-0000-4000-8000-000000000123";
|
|
1756
|
+
const samples = causalInputSamples(
|
|
1757
|
+
[
|
|
1758
|
+
{
|
|
1759
|
+
type: "performance.stage",
|
|
1760
|
+
traceId,
|
|
1761
|
+
stage: "input",
|
|
1762
|
+
processId: "opentui:1",
|
|
1763
|
+
clockId: "client-clock",
|
|
1764
|
+
startedAtMicros: 1_000,
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
type: "performance.stage",
|
|
1768
|
+
traceId,
|
|
1769
|
+
stage: "client",
|
|
1770
|
+
operation: "lane-enqueue",
|
|
1771
|
+
processId: "opentui:1",
|
|
1772
|
+
clockId: "client-clock",
|
|
1773
|
+
atMicros: 2_000,
|
|
1774
|
+
},
|
|
1775
|
+
{
|
|
1776
|
+
type: "performance.stage",
|
|
1777
|
+
traceId,
|
|
1778
|
+
stage: "paint",
|
|
1779
|
+
processId: "opentui:1",
|
|
1780
|
+
clockId: "client-clock",
|
|
1781
|
+
endedAtMicros: 9_000,
|
|
1782
|
+
generation: "generation",
|
|
1783
|
+
},
|
|
1784
|
+
],
|
|
1785
|
+
[
|
|
1786
|
+
{
|
|
1787
|
+
type: "performance.stage",
|
|
1788
|
+
traceId,
|
|
1789
|
+
stage: "tmux",
|
|
1790
|
+
operation: "raw-input-command",
|
|
1791
|
+
processId: "daemon:2",
|
|
1792
|
+
clockId: "daemon-clock",
|
|
1793
|
+
startedAtMicros: 50_000,
|
|
1794
|
+
endedAtMicros: 53_000,
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
type: "performance.stage",
|
|
1798
|
+
traceId,
|
|
1799
|
+
stage: "tmux",
|
|
1800
|
+
operation: "control-write",
|
|
1801
|
+
processId: "daemon:2",
|
|
1802
|
+
clockId: "daemon-clock",
|
|
1803
|
+
startedAtMicros: 53_100,
|
|
1804
|
+
endedAtMicros: 53_200,
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
type: "performance.stage",
|
|
1808
|
+
traceId,
|
|
1809
|
+
stage: "tmux",
|
|
1810
|
+
operation: "first-output-observed",
|
|
1811
|
+
processId: "daemon:2",
|
|
1812
|
+
clockId: "daemon-clock",
|
|
1813
|
+
startedAtMicros: 70_000,
|
|
1814
|
+
endedAtMicros: 70_100,
|
|
1815
|
+
},
|
|
1816
|
+
],
|
|
1817
|
+
);
|
|
1818
|
+
assert.deepEqual(
|
|
1819
|
+
samples[0]?.clientStages.map(({ operation, offsetMs }) => ({ operation, offsetMs })),
|
|
1820
|
+
[{ operation: "lane-enqueue", offsetMs: 1 }],
|
|
1821
|
+
);
|
|
1822
|
+
assert.deepEqual(samples[0]?.daemonSpans, [
|
|
1823
|
+
{
|
|
1824
|
+
stage: "tmux",
|
|
1825
|
+
operation: "raw-input-command",
|
|
1826
|
+
startedAtMicros: 50_000,
|
|
1827
|
+
endedAtMicros: 53_000,
|
|
1828
|
+
offsetMs: 0,
|
|
1829
|
+
durationMs: 3,
|
|
1830
|
+
processId: "daemon:2",
|
|
1831
|
+
clockId: "daemon-clock",
|
|
1832
|
+
},
|
|
1833
|
+
{
|
|
1834
|
+
stage: "tmux",
|
|
1835
|
+
operation: "control-write",
|
|
1836
|
+
startedAtMicros: 53_100,
|
|
1837
|
+
endedAtMicros: 53_200,
|
|
1838
|
+
offsetMs: 3.1,
|
|
1839
|
+
durationMs: 0.1,
|
|
1840
|
+
processId: "daemon:2",
|
|
1841
|
+
clockId: "daemon-clock",
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
stage: "tmux",
|
|
1845
|
+
operation: "first-output-observed",
|
|
1846
|
+
startedAtMicros: 70_000,
|
|
1847
|
+
endedAtMicros: 70_100,
|
|
1848
|
+
offsetMs: 20,
|
|
1849
|
+
durationMs: 0.1,
|
|
1850
|
+
processId: "daemon:2",
|
|
1851
|
+
clockId: "daemon-clock",
|
|
1852
|
+
},
|
|
1853
|
+
]);
|
|
1854
|
+
});
|
|
1855
|
+
|
|
1856
|
+
test("fails closed when causal-cell-v1 has no finalized proofs", () => {
|
|
1857
|
+
const report = buildProductDiagnosticReport({
|
|
1858
|
+
state: { status: "ready", daemon: { instanceId: "generation" }, convergence: null },
|
|
1859
|
+
truth: { session: "alpha", windows: [], panes: [] },
|
|
1860
|
+
lifecycle: [],
|
|
1861
|
+
traceRecords: [],
|
|
1862
|
+
daemonTraceRecords: [],
|
|
1863
|
+
stderr: "",
|
|
1864
|
+
});
|
|
1865
|
+
assert.equal(report.inputCausalSummary.causalAttribution, false);
|
|
1866
|
+
assert.equal(report.inputCausalSummary.correlation, "causal-cell-v1");
|
|
1867
|
+
assert.equal(report.inputCausalSummary.finalizedProofs, 0);
|
|
1868
|
+
assert.equal(report.firstBrokenInputBoundary, "input-or-paint-pair");
|
|
1869
|
+
assert.ok(
|
|
1870
|
+
report.boundaries.some(
|
|
1871
|
+
(boundary) => boundary.id === "input-enqueue-to-correlated-changed-cell-paint",
|
|
1872
|
+
),
|
|
1873
|
+
);
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1876
|
+
test("causal probe epochs admit one input and close on one terminal result", () => {
|
|
1877
|
+
const processId = "opentui:1";
|
|
1878
|
+
const traceId = "00000000-0000-4000-8000-000000000001";
|
|
1879
|
+
const input = { type: "performance.stage", stage: "input", processId, traceId };
|
|
1880
|
+
assert.deepEqual(causalProbeEpochState([input], 0, processId), {
|
|
1881
|
+
status: "pending",
|
|
1882
|
+
traceId,
|
|
1883
|
+
reason: null,
|
|
1884
|
+
});
|
|
1885
|
+
assert.deepEqual(
|
|
1886
|
+
causalProbeEpochState(
|
|
1887
|
+
[
|
|
1888
|
+
input,
|
|
1889
|
+
{
|
|
1890
|
+
type: "performance.stage",
|
|
1891
|
+
stage: "client",
|
|
1892
|
+
processId,
|
|
1893
|
+
traceId,
|
|
1894
|
+
operation: "causal-cell-painted",
|
|
1895
|
+
},
|
|
1896
|
+
],
|
|
1897
|
+
0,
|
|
1898
|
+
processId,
|
|
1899
|
+
),
|
|
1900
|
+
{ status: "proved", traceId, reason: null },
|
|
1901
|
+
);
|
|
1902
|
+
assert.deepEqual(
|
|
1903
|
+
causalProbeEpochState(
|
|
1904
|
+
[
|
|
1905
|
+
input,
|
|
1906
|
+
{
|
|
1907
|
+
type: "performance.stage",
|
|
1908
|
+
stage: "client",
|
|
1909
|
+
processId,
|
|
1910
|
+
traceId,
|
|
1911
|
+
operation: "causal-cell-failed:baseline-drift",
|
|
1912
|
+
},
|
|
1913
|
+
],
|
|
1914
|
+
0,
|
|
1915
|
+
processId,
|
|
1916
|
+
),
|
|
1917
|
+
{ status: "failed", traceId, reason: "baseline-drift" },
|
|
1918
|
+
);
|
|
1919
|
+
});
|
|
1920
|
+
|
|
1921
|
+
test("causal probe epochs fail closed instead of pseudoreplicating concurrent inputs", () => {
|
|
1922
|
+
const processId = "opentui:1";
|
|
1923
|
+
assert.deepEqual(
|
|
1924
|
+
causalProbeEpochState(
|
|
1925
|
+
[
|
|
1926
|
+
{ type: "performance.stage", stage: "input", processId, traceId: "trace-a" },
|
|
1927
|
+
{ type: "performance.stage", stage: "input", processId, traceId: "trace-b" },
|
|
1928
|
+
],
|
|
1929
|
+
0,
|
|
1930
|
+
processId,
|
|
1931
|
+
),
|
|
1932
|
+
{ status: "ambiguous", traceId: null, reason: "multiple-inputs" },
|
|
1933
|
+
);
|
|
1934
|
+
});
|
|
1935
|
+
|
|
1936
|
+
test("causal fixture teardown requires the restored shell, marker, queues and geometry", () => {
|
|
1937
|
+
const ready = {
|
|
1938
|
+
fixtureOption: "",
|
|
1939
|
+
currentCommand: "zsh",
|
|
1940
|
+
expectedCommand: "zsh",
|
|
1941
|
+
marker: "tmux-ide-shell-ready-token",
|
|
1942
|
+
nativeFrame: "tmux-ide-shell-ready-token",
|
|
1943
|
+
tuiBody: "tmux-ide-shell-ready-token",
|
|
1944
|
+
inputPending: 0,
|
|
1945
|
+
inputInFlight: 0,
|
|
1946
|
+
inputPendingBytes: 0,
|
|
1947
|
+
geometryStable: true,
|
|
1948
|
+
canonicalWraparound: true,
|
|
1949
|
+
};
|
|
1950
|
+
assert.equal(causalFixtureShellReady(ready), true);
|
|
1951
|
+
for (const [field, value] of [
|
|
1952
|
+
["fixtureOption", "ready-v1"],
|
|
1953
|
+
["currentCommand", "node"],
|
|
1954
|
+
["nativeFrame", ""],
|
|
1955
|
+
["tuiBody", ""],
|
|
1956
|
+
["inputPending", 1],
|
|
1957
|
+
["inputInFlight", 1],
|
|
1958
|
+
["inputPendingBytes", 1],
|
|
1959
|
+
["geometryStable", false],
|
|
1960
|
+
["canonicalWraparound", false],
|
|
1961
|
+
]) {
|
|
1962
|
+
assert.equal(causalFixtureShellReady({ ...ready, [field]: value }), false, field);
|
|
1963
|
+
}
|
|
1964
|
+
});
|
|
1965
|
+
|
|
1966
|
+
test("causal fixture gate orders teardown and releases resource only after direct canonical proof", async () => {
|
|
1967
|
+
let clock = 0;
|
|
1968
|
+
const calls = [];
|
|
1969
|
+
const observations = [
|
|
1970
|
+
{ fixtureOption: "ready-v1", currentCommand: "node" },
|
|
1971
|
+
{ fixtureOption: "", currentCommand: "zsh" },
|
|
1972
|
+
{
|
|
1973
|
+
fixtureOption: "",
|
|
1974
|
+
currentCommand: "zsh",
|
|
1975
|
+
expectedCommand: "zsh",
|
|
1976
|
+
marker: "shell-ready",
|
|
1977
|
+
nativeFrame: "shell-ready",
|
|
1978
|
+
tuiBody: "shell-ready",
|
|
1979
|
+
canonicalWraparound: true,
|
|
1980
|
+
inputPending: 0,
|
|
1981
|
+
inputInFlight: 0,
|
|
1982
|
+
inputPendingBytes: 0,
|
|
1983
|
+
geometryStable: true,
|
|
1984
|
+
stabilityIdentity: "stable",
|
|
1985
|
+
},
|
|
1986
|
+
];
|
|
1987
|
+
let index = 0;
|
|
1988
|
+
const result = await runCausalFixtureTeardownGate({
|
|
1989
|
+
interrupt: () => calls.push("interrupt"),
|
|
1990
|
+
observe: () => {
|
|
1991
|
+
calls.push(`observe:${index}`);
|
|
1992
|
+
return { expectedCommand: "zsh", marker: "shell-ready", ...observations[index++] };
|
|
1993
|
+
},
|
|
1994
|
+
sendShellMarker: () => calls.push("marker"),
|
|
1995
|
+
releaseResource: () => calls.push("resource"),
|
|
1996
|
+
now: () => clock,
|
|
1997
|
+
wait: (ms) => {
|
|
1998
|
+
clock += ms;
|
|
1999
|
+
if (index >= observations.length) index = observations.length - 1;
|
|
2000
|
+
},
|
|
2001
|
+
stableMs: 25,
|
|
2002
|
+
timeoutMs: 200,
|
|
2003
|
+
pollMs: 25,
|
|
2004
|
+
});
|
|
2005
|
+
assert.deepEqual(result, { canDispatchResource: true });
|
|
2006
|
+
assert.deepEqual(calls, [
|
|
2007
|
+
"interrupt",
|
|
2008
|
+
"observe:0",
|
|
2009
|
+
"observe:1",
|
|
2010
|
+
"marker",
|
|
2011
|
+
"observe:2",
|
|
2012
|
+
"observe:2",
|
|
2013
|
+
"resource",
|
|
2014
|
+
]);
|
|
2015
|
+
});
|
|
2016
|
+
|
|
2017
|
+
test("causal fixture canonical proof uses the latest exact-incarnation transition", () => {
|
|
2018
|
+
const expected = {
|
|
2019
|
+
processId: "opentui:1",
|
|
2020
|
+
semanticPaneId: "pane.alpha",
|
|
2021
|
+
generation: "generation",
|
|
2022
|
+
incarnation: "incarnation:1",
|
|
2023
|
+
};
|
|
2024
|
+
const record = (wraparound, incarnation = expected.incarnation) => ({
|
|
2025
|
+
type: "performance.terminal-canonical-mode",
|
|
2026
|
+
...expected,
|
|
2027
|
+
incarnation,
|
|
2028
|
+
wraparound,
|
|
2029
|
+
});
|
|
2030
|
+
assert.equal(latestCausalFixtureCanonicalWraparound([record(true)], 0, expected), true);
|
|
2031
|
+
assert.equal(
|
|
2032
|
+
latestCausalFixtureCanonicalWraparound([record(true), record(false)], 0, expected),
|
|
2033
|
+
false,
|
|
2034
|
+
);
|
|
2035
|
+
assert.equal(
|
|
2036
|
+
latestCausalFixtureCanonicalWraparound([record(true, "incarnation:other")], 0, expected),
|
|
2037
|
+
false,
|
|
2038
|
+
);
|
|
2039
|
+
});
|
|
2040
|
+
|
|
2041
|
+
test("causal teardown never releases on rolled-back or wrong-incarnation mode proof", async () => {
|
|
2042
|
+
const expected = {
|
|
2043
|
+
processId: "opentui:1",
|
|
2044
|
+
semanticPaneId: "pane.alpha",
|
|
2045
|
+
generation: "generation",
|
|
2046
|
+
incarnation: "incarnation:1",
|
|
2047
|
+
};
|
|
2048
|
+
const mode = (wraparound, incarnation = expected.incarnation) => ({
|
|
2049
|
+
type: "performance.terminal-canonical-mode",
|
|
2050
|
+
...expected,
|
|
2051
|
+
incarnation,
|
|
2052
|
+
wraparound,
|
|
2053
|
+
});
|
|
2054
|
+
for (const records of [[mode(true), mode(false)], [mode(true, "incarnation:other")]]) {
|
|
2055
|
+
let clock = 0;
|
|
2056
|
+
let released = 0;
|
|
2057
|
+
await assert.rejects(
|
|
2058
|
+
runCausalFixtureTeardownGate({
|
|
2059
|
+
interrupt: () => undefined,
|
|
2060
|
+
sendShellMarker: () => undefined,
|
|
2061
|
+
observe: () => ({
|
|
2062
|
+
fixtureOption: "",
|
|
2063
|
+
currentCommand: "zsh",
|
|
2064
|
+
expectedCommand: "zsh",
|
|
2065
|
+
marker: "shell-ready",
|
|
2066
|
+
nativeFrame: "shell-ready",
|
|
2067
|
+
tuiBody: "shell-ready",
|
|
2068
|
+
canonicalWraparound: latestCausalFixtureCanonicalWraparound(records, 0, expected),
|
|
2069
|
+
inputPending: 0,
|
|
2070
|
+
inputInFlight: 0,
|
|
2071
|
+
inputPendingBytes: 0,
|
|
2072
|
+
geometryStable: true,
|
|
2073
|
+
stabilityIdentity: "stable",
|
|
2074
|
+
}),
|
|
2075
|
+
releaseResource: () => {
|
|
2076
|
+
released += 1;
|
|
2077
|
+
},
|
|
2078
|
+
now: () => clock,
|
|
2079
|
+
wait: (ms) => {
|
|
2080
|
+
clock += ms;
|
|
2081
|
+
},
|
|
2082
|
+
timeoutMs: 50,
|
|
2083
|
+
pollMs: 25,
|
|
2084
|
+
}),
|
|
2085
|
+
);
|
|
2086
|
+
assert.equal(released, 0);
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
|
|
2090
|
+
test("causal fixture gate fails closed with zero resource dispatch on timeout and observation error", async () => {
|
|
2091
|
+
for (const failure of ["timeout", "error"]) {
|
|
2092
|
+
let clock = 0;
|
|
2093
|
+
let resources = 0;
|
|
2094
|
+
await assert.rejects(
|
|
2095
|
+
runCausalFixtureTeardownGate({
|
|
2096
|
+
interrupt: () => undefined,
|
|
2097
|
+
observe: () => {
|
|
2098
|
+
if (failure === "error") throw new Error("capture failed");
|
|
2099
|
+
return { fixtureOption: "ready-v1", currentCommand: "node" };
|
|
2100
|
+
},
|
|
2101
|
+
sendShellMarker: () => undefined,
|
|
2102
|
+
releaseResource: () => {
|
|
2103
|
+
resources += 1;
|
|
2104
|
+
},
|
|
2105
|
+
now: () => clock,
|
|
2106
|
+
wait: (ms) => {
|
|
2107
|
+
clock += ms;
|
|
2108
|
+
},
|
|
2109
|
+
timeoutMs: 50,
|
|
2110
|
+
pollMs: 25,
|
|
2111
|
+
}),
|
|
2112
|
+
);
|
|
2113
|
+
assert.equal(resources, 0, failure);
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
test("causal teardown timeout identifies each failed predicate without retaining terminal content", async () => {
|
|
2118
|
+
const ready = {
|
|
2119
|
+
fixtureOption: "",
|
|
2120
|
+
currentCommand: "zsh",
|
|
2121
|
+
expectedCommand: "zsh",
|
|
2122
|
+
marker: "private-marker",
|
|
2123
|
+
nativeFrame: "private-marker secret-native",
|
|
2124
|
+
tuiBody: "private-marker secret-tui",
|
|
2125
|
+
markerNativeIndex: 0,
|
|
2126
|
+
markerTuiIndex: 0,
|
|
2127
|
+
canonicalWraparound: true,
|
|
2128
|
+
canonical: {
|
|
2129
|
+
revision: 5,
|
|
2130
|
+
stateHash: "hash",
|
|
2131
|
+
incarnation: "incarnation",
|
|
2132
|
+
wraparound: true,
|
|
2133
|
+
},
|
|
2134
|
+
inputPending: 0,
|
|
2135
|
+
inputInFlight: 0,
|
|
2136
|
+
inputPendingBytes: 0,
|
|
2137
|
+
geometryStable: true,
|
|
2138
|
+
geometryBefore: "%1:80x24",
|
|
2139
|
+
geometryAfter: "%1:80x24",
|
|
2140
|
+
nativeHash: "native-hash",
|
|
2141
|
+
bodyHash: "body-hash",
|
|
2142
|
+
stabilityIdentity: "stable",
|
|
2143
|
+
stabilityParts: { nativeHash: "native-hash", bodyHash: "body-hash" },
|
|
2144
|
+
};
|
|
2145
|
+
assert.doesNotMatch(JSON.stringify(causalFixtureTeardownDiagnostic(ready)), /secret-|private-/u);
|
|
2146
|
+
for (const [field, value, failure] of [
|
|
2147
|
+
["fixtureOption", "ready-v1", "option-empty"],
|
|
2148
|
+
["currentCommand", "node", "command-matches"],
|
|
2149
|
+
["markerNativeIndex", null, "marker-native"],
|
|
2150
|
+
["markerTuiIndex", null, "marker-tui"],
|
|
2151
|
+
["canonicalWraparound", false, "canonical-wraparound"],
|
|
2152
|
+
["inputPending", 1, "queue-zero"],
|
|
2153
|
+
["geometryStable", false, "geometry-stable"],
|
|
2154
|
+
]) {
|
|
2155
|
+
let clock = 0;
|
|
2156
|
+
await assert.rejects(
|
|
2157
|
+
runCausalFixtureTeardownGate({
|
|
2158
|
+
interrupt: () => undefined,
|
|
2159
|
+
sendShellMarker: () => undefined,
|
|
2160
|
+
observe: () => ({ ...ready, [field]: value }),
|
|
2161
|
+
releaseResource: () => assert.fail("must not release"),
|
|
2162
|
+
now: () => clock,
|
|
2163
|
+
wait: (ms) => {
|
|
2164
|
+
clock += ms;
|
|
2165
|
+
},
|
|
2166
|
+
timeoutMs: 25,
|
|
2167
|
+
stableMs: 100,
|
|
2168
|
+
pollMs: 25,
|
|
2169
|
+
}),
|
|
2170
|
+
(error) => {
|
|
2171
|
+
assert.match(error.message, /"failureKind":"predicate-failed"/u);
|
|
2172
|
+
assert.match(error.message, new RegExp(`"${failure}"`, "u"));
|
|
2173
|
+
return true;
|
|
2174
|
+
},
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
2177
|
+
});
|
|
2178
|
+
|
|
2179
|
+
test("causal teardown distinguishes identity churn from an incomplete stability window", async () => {
|
|
2180
|
+
const observation = (identity) => ({
|
|
2181
|
+
fixtureOption: "",
|
|
2182
|
+
currentCommand: "zsh",
|
|
2183
|
+
expectedCommand: "zsh",
|
|
2184
|
+
marker: "marker",
|
|
2185
|
+
nativeFrame: "marker",
|
|
2186
|
+
tuiBody: "marker",
|
|
2187
|
+
markerNativeIndex: 0,
|
|
2188
|
+
markerTuiIndex: 0,
|
|
2189
|
+
canonicalWraparound: true,
|
|
2190
|
+
inputPending: 0,
|
|
2191
|
+
inputInFlight: 0,
|
|
2192
|
+
inputPendingBytes: 0,
|
|
2193
|
+
geometryStable: true,
|
|
2194
|
+
stabilityIdentity: identity,
|
|
2195
|
+
stabilityParts: { nativeHash: identity },
|
|
2196
|
+
});
|
|
2197
|
+
for (const [identities, failureKind] of [
|
|
2198
|
+
[["a", "b", "a"], "stability-identity-churn"],
|
|
2199
|
+
[["a"], "stability-window-incomplete"],
|
|
2200
|
+
]) {
|
|
2201
|
+
let clock = 0;
|
|
2202
|
+
let index = 0;
|
|
2203
|
+
await assert.rejects(
|
|
2204
|
+
runCausalFixtureTeardownGate({
|
|
2205
|
+
interrupt: () => undefined,
|
|
2206
|
+
sendShellMarker: () => undefined,
|
|
2207
|
+
observe: () => observation(identities[Math.min(index++, identities.length - 1)]),
|
|
2208
|
+
releaseResource: () => assert.fail("must not release"),
|
|
2209
|
+
now: () => clock,
|
|
2210
|
+
wait: (ms) => {
|
|
2211
|
+
clock += ms;
|
|
2212
|
+
},
|
|
2213
|
+
timeoutMs: identities.length * 25,
|
|
2214
|
+
stableMs: 100,
|
|
2215
|
+
pollMs: 25,
|
|
2216
|
+
}),
|
|
2217
|
+
(error) => {
|
|
2218
|
+
assert.match(error.message, new RegExp(`"failureKind":"${failureKind}"`, "u"));
|
|
2219
|
+
return true;
|
|
2220
|
+
},
|
|
2221
|
+
);
|
|
2222
|
+
}
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
test("causal helper restores DECAWM and resets probes onto the visible first row", () => {
|
|
2226
|
+
const source = readFileSync(
|
|
2227
|
+
new URL("./lib/product-rig-causal-cell-fixture.mjs", import.meta.url),
|
|
2228
|
+
"utf8",
|
|
2229
|
+
);
|
|
2230
|
+
assert.match(source, /writeSync\(1, "\\x1b\[\?7h/u);
|
|
2231
|
+
assert.match(source, /if \(restored\) return;/u);
|
|
2232
|
+
assert.match(source, /reset-v1;/u);
|
|
2233
|
+
assert.match(source, /createCausalFixtureGeometry/u);
|
|
2234
|
+
});
|
|
2235
|
+
|
|
2236
|
+
test("requires a closed zero-drop reference trace summary", () => {
|
|
2237
|
+
const base = {
|
|
2238
|
+
state: { status: "ready", daemon: { instanceId: "generation" }, convergence: null },
|
|
2239
|
+
truth: { session: "alpha", windows: [], panes: [] },
|
|
2240
|
+
lifecycle: [],
|
|
2241
|
+
stderr: "",
|
|
2242
|
+
};
|
|
2243
|
+
const missing = buildProductDiagnosticReport({ ...base, traceRecords: [] });
|
|
2244
|
+
assert.equal(
|
|
2245
|
+
missing.boundaries.find((boundary) => boundary.id === "reference-trace-integrity")?.status,
|
|
2246
|
+
"unmeasured",
|
|
2247
|
+
);
|
|
2248
|
+
const dropped = buildProductDiagnosticReport({
|
|
2249
|
+
...base,
|
|
2250
|
+
traceRecords: [
|
|
2251
|
+
{
|
|
2252
|
+
type: "performance.trace.summary",
|
|
2253
|
+
acceptedRecords: 10,
|
|
2254
|
+
droppedRecords: 1,
|
|
2255
|
+
oversizedRecords: 0,
|
|
2256
|
+
failed: false,
|
|
2257
|
+
saturated: false,
|
|
2258
|
+
pendingInputs: 0,
|
|
2259
|
+
droppedInputs: 0,
|
|
2260
|
+
},
|
|
2261
|
+
],
|
|
2262
|
+
});
|
|
2263
|
+
assert.equal(
|
|
2264
|
+
dropped.boundaries.find((boundary) => boundary.id === "reference-trace-integrity")?.status,
|
|
2265
|
+
"failed",
|
|
2266
|
+
);
|
|
2267
|
+
});
|
|
2268
|
+
|
|
2269
|
+
test("pairs only same-clock input and changed-cell paint traces", () => {
|
|
2270
|
+
const samples = inputPaintSamples([
|
|
2271
|
+
{
|
|
2272
|
+
type: "performance.stage",
|
|
2273
|
+
traceId: "one",
|
|
2274
|
+
stage: "input",
|
|
2275
|
+
processId: "tui:1",
|
|
2276
|
+
clockId: "clock",
|
|
2277
|
+
startedAtMicros: 1_000,
|
|
2278
|
+
},
|
|
2279
|
+
{
|
|
2280
|
+
type: "performance.stage",
|
|
2281
|
+
traceId: "one",
|
|
2282
|
+
stage: "paint",
|
|
2283
|
+
processId: "tui:1",
|
|
2284
|
+
clockId: "clock",
|
|
2285
|
+
endedAtMicros: 9_000,
|
|
2286
|
+
generation: "generation",
|
|
2287
|
+
incarnation: "generation:0",
|
|
2288
|
+
semanticPaneId: "%1",
|
|
2289
|
+
revision: 4,
|
|
2290
|
+
stateHash: "abcd1234",
|
|
2291
|
+
paintStateIdentity: "latest-canonical-state-blitted",
|
|
2292
|
+
},
|
|
2293
|
+
{
|
|
2294
|
+
type: "performance.stage",
|
|
2295
|
+
traceId: "cross-clock",
|
|
2296
|
+
stage: "input",
|
|
2297
|
+
processId: "tui:1",
|
|
2298
|
+
clockId: "a",
|
|
2299
|
+
startedAtMicros: 1_000,
|
|
2300
|
+
},
|
|
2301
|
+
{
|
|
2302
|
+
type: "performance.stage",
|
|
2303
|
+
traceId: "cross-clock",
|
|
2304
|
+
stage: "paint",
|
|
2305
|
+
processId: "tui:1",
|
|
2306
|
+
clockId: "b",
|
|
2307
|
+
endedAtMicros: 2_000,
|
|
2308
|
+
},
|
|
2309
|
+
]);
|
|
2310
|
+
assert.deepEqual(samples, [
|
|
2311
|
+
{
|
|
2312
|
+
traceId: "one",
|
|
2313
|
+
durationMs: 8,
|
|
2314
|
+
generation: "generation",
|
|
2315
|
+
incarnation: "generation:0",
|
|
2316
|
+
processId: "tui:1",
|
|
2317
|
+
clockId: "clock",
|
|
2318
|
+
semanticPaneId: "%1",
|
|
2319
|
+
revision: 4,
|
|
2320
|
+
stateHash: "abcd1234",
|
|
2321
|
+
paintStateIdentity: "latest-canonical-state-blitted",
|
|
2322
|
+
},
|
|
2323
|
+
]);
|
|
2324
|
+
assert.equal(causalInputSampleHasIncarnation(samples[0]), true);
|
|
2325
|
+
assert.equal(causalInputSampleHasIncarnation({ ...samples[0], incarnation: null }), false);
|
|
2326
|
+
assert.equal(causalInputSampleHasIncarnation({ ...samples[0], incarnation: "" }), false);
|
|
2327
|
+
});
|
|
2328
|
+
|
|
2329
|
+
test("qualifies paint evidence only when it names the latest canonical state blitted", () => {
|
|
2330
|
+
const traceRecords = [
|
|
2331
|
+
{ type: "performance.trace.header", processId: "tui:1" },
|
|
2332
|
+
{
|
|
2333
|
+
type: "performance.stage",
|
|
2334
|
+
traceId: "trace",
|
|
2335
|
+
stage: "input",
|
|
2336
|
+
processId: "tui:1",
|
|
2337
|
+
clockId: "clock",
|
|
2338
|
+
startedAtMicros: 1_000,
|
|
2339
|
+
},
|
|
2340
|
+
{
|
|
2341
|
+
type: "performance.stage",
|
|
2342
|
+
traceId: "trace",
|
|
2343
|
+
stage: "paint",
|
|
2344
|
+
processId: "tui:1",
|
|
2345
|
+
clockId: "clock",
|
|
2346
|
+
endedAtMicros: 2_000,
|
|
2347
|
+
generation: "generation",
|
|
2348
|
+
semanticPaneId: "%1",
|
|
2349
|
+
revision: 2,
|
|
2350
|
+
stateHash: "latest-hash",
|
|
2351
|
+
paintStateIdentity: "latest-canonical-state-blitted",
|
|
2352
|
+
},
|
|
2353
|
+
];
|
|
2354
|
+
const base = {
|
|
2355
|
+
state: { status: "ready", daemon: { instanceId: "generation" }, convergence: null },
|
|
2356
|
+
truth: { session: "alpha", windows: [], panes: [] },
|
|
2357
|
+
lifecycle: [],
|
|
2358
|
+
traceRecords,
|
|
2359
|
+
stderr: "",
|
|
2360
|
+
};
|
|
2361
|
+
const evidence = {
|
|
2362
|
+
traceId: "trace",
|
|
2363
|
+
semanticPaneId: "%1",
|
|
2364
|
+
revision: 2,
|
|
2365
|
+
stateHash: "latest-hash",
|
|
2366
|
+
markerVisibleInNative: true,
|
|
2367
|
+
markerVisibleInPaneRect: true,
|
|
2368
|
+
paintStateIdentity: "latest-canonical-state-blitted",
|
|
2369
|
+
causalAttribution: true,
|
|
2370
|
+
row: 0,
|
|
2371
|
+
column: 1,
|
|
2372
|
+
beforeGrapheme: " ",
|
|
2373
|
+
afterGrapheme: "x",
|
|
2374
|
+
};
|
|
2375
|
+
assert.equal(
|
|
2376
|
+
buildProductDiagnosticReport({ ...base, qualifyingInputEvidence: [evidence] }).inputSamples
|
|
2377
|
+
.length,
|
|
2378
|
+
1,
|
|
2379
|
+
);
|
|
2380
|
+
const { paintStateIdentity: _omitted, ...unproven } = evidence;
|
|
2381
|
+
void _omitted;
|
|
2382
|
+
assert.equal(
|
|
2383
|
+
buildProductDiagnosticReport({ ...base, qualifyingInputEvidence: [unproven] }).inputSamples
|
|
2384
|
+
.length,
|
|
2385
|
+
0,
|
|
2386
|
+
);
|
|
2387
|
+
});
|
|
2388
|
+
|
|
2389
|
+
test("rejects duplicate trace endpoints instead of silently choosing the last sample", () => {
|
|
2390
|
+
const base = {
|
|
2391
|
+
type: "performance.stage",
|
|
2392
|
+
traceId: "duplicate",
|
|
2393
|
+
processId: "tui:1",
|
|
2394
|
+
clockId: "clock",
|
|
2395
|
+
};
|
|
2396
|
+
assert.deepEqual(
|
|
2397
|
+
inputPaintSamples([
|
|
2398
|
+
{ ...base, stage: "input", startedAtMicros: 1 },
|
|
2399
|
+
{ ...base, stage: "input", startedAtMicros: 2 },
|
|
2400
|
+
{ ...base, stage: "paint", endedAtMicros: 3 },
|
|
2401
|
+
]),
|
|
2402
|
+
[],
|
|
2403
|
+
);
|
|
2404
|
+
});
|
|
2405
|
+
|
|
2406
|
+
test("extracts proof only from the pane body rectangle", () => {
|
|
2407
|
+
const frame = [
|
|
2408
|
+
"header",
|
|
2409
|
+
"tabs",
|
|
2410
|
+
"● pane.left".padEnd(13) + "○ pane.right",
|
|
2411
|
+
"left-marker sibling",
|
|
2412
|
+
"left-second sibling-clean",
|
|
2413
|
+
].join("\n");
|
|
2414
|
+
assert.equal(
|
|
2415
|
+
paneBodyRegion(frame, {
|
|
2416
|
+
semanticPaneId: "pane.left",
|
|
2417
|
+
left: 0,
|
|
2418
|
+
top: 0,
|
|
2419
|
+
width: 12,
|
|
2420
|
+
height: 2,
|
|
2421
|
+
}),
|
|
2422
|
+
"left-marker \nleft-second ",
|
|
2423
|
+
);
|
|
2424
|
+
assert.doesNotMatch(
|
|
2425
|
+
paneBodyRegion(frame, {
|
|
2426
|
+
semanticPaneId: "pane.right",
|
|
2427
|
+
left: 13,
|
|
2428
|
+
top: 0,
|
|
2429
|
+
width: 7,
|
|
2430
|
+
height: 2,
|
|
2431
|
+
}),
|
|
2432
|
+
/marker/u,
|
|
2433
|
+
);
|
|
2434
|
+
});
|
|
2435
|
+
|
|
2436
|
+
test("resource evidence requires a distribution and proves queues settle", () => {
|
|
2437
|
+
const clientStages = Array.from({ length: 16 }, (_, index) => ({
|
|
2438
|
+
rssBytes: 100_000 + index,
|
|
2439
|
+
heapUsedBytes: 50_000 + index,
|
|
2440
|
+
inputPending: index === 15 ? 0 : 1,
|
|
2441
|
+
inputInFlight: index === 15 ? 0 : 1,
|
|
2442
|
+
inputPendingBytes: index === 15 ? 0 : 1,
|
|
2443
|
+
}));
|
|
2444
|
+
const observation = summarizeProductResources(clientStages, [
|
|
2445
|
+
{
|
|
2446
|
+
queuePeak: 1,
|
|
2447
|
+
queueCapacity: 1,
|
|
2448
|
+
settledQueueDepth: 0,
|
|
2449
|
+
revisionLagPeak: 0,
|
|
2450
|
+
},
|
|
2451
|
+
]);
|
|
2452
|
+
assert.equal(observation.memorySampleCount, 16);
|
|
2453
|
+
assert.equal(observation.settledInputPending, 0);
|
|
2454
|
+
assert.equal(observation.settledInputInFlight, 0);
|
|
2455
|
+
assert.equal(observation.settledDeliveryQueueDepth, 0);
|
|
2456
|
+
assert.equal(observation.rssGrowthBytes, 15);
|
|
2457
|
+
assert.equal(observation.heapGrowthBytes, 15);
|
|
2458
|
+
assert.equal(observation.rssRobustSlopeBytesPerSample, 1);
|
|
2459
|
+
assert.equal(observation.heapRobustSlopeBytesPerSample, 1);
|
|
2460
|
+
});
|
|
2461
|
+
|
|
2462
|
+
test("resource retention samples independent load-clear-settle cycles", () => {
|
|
2463
|
+
const plan = productResourceCyclePlan();
|
|
2464
|
+
assert.equal(PRODUCT_RESOURCE_CONDITIONING_CYCLE_COUNT, 8);
|
|
2465
|
+
assert.equal(PRODUCT_RESOURCE_MEASURED_CYCLE_COUNT, 16);
|
|
2466
|
+
assert.equal(plan.length, 24);
|
|
2467
|
+
assert.deepEqual(
|
|
2468
|
+
plan.map(({ phase }) => phase),
|
|
2469
|
+
[
|
|
2470
|
+
...Array.from({ length: 8 }, () => "conditioning"),
|
|
2471
|
+
...Array.from({ length: 16 }, () => "measured"),
|
|
2472
|
+
],
|
|
2473
|
+
);
|
|
2474
|
+
assert.deepEqual(
|
|
2475
|
+
plan.map(({ measuredIndex }) => measuredIndex),
|
|
2476
|
+
[...Array.from({ length: 8 }, () => null), ...Array.from({ length: 16 }, (_, index) => index)],
|
|
2477
|
+
);
|
|
2478
|
+
assert.equal(new Set(plan.map(({ cycle }) => cycle)).size, plan.length);
|
|
2479
|
+
assert.equal(new Set(plan.map(({ cycleMarker }) => cycleMarker)).size, plan.length);
|
|
2480
|
+
assert.equal(new Set(plan.map(({ probe }) => probe)).size, plan.length);
|
|
2481
|
+
assert.ok(plan.every(({ probe }) => typeof probe === "string" && probe.length === 1));
|
|
2482
|
+
assert.ok(plan.every(({ loadLines }) => loadLines === 300));
|
|
2483
|
+
for (const cycle of plan) {
|
|
2484
|
+
const commands = productResourceCycleCommands(cycle);
|
|
2485
|
+
assert.equal(commands.floodCommand.includes(`tmux-ide-flood-${cycle.cycle}`), false);
|
|
2486
|
+
assert.equal(commands.settleCommand.includes(cycle.cycleMarker), false);
|
|
2487
|
+
}
|
|
2488
|
+
assert.throws(() => productResourceCyclePlan(16), /fixed and cannot be configured/u);
|
|
2489
|
+
});
|
|
2490
|
+
|
|
2491
|
+
test("resource conditioning endpoints are fenced but excluded from measured endpoint ids", () => {
|
|
2492
|
+
const plan = productResourceCyclePlan();
|
|
2493
|
+
const endpoints = plan.map(({ cycle, phase }) => ({
|
|
2494
|
+
cycle,
|
|
2495
|
+
phase,
|
|
2496
|
+
traceId: `${phase}-${cycle}`,
|
|
2497
|
+
}));
|
|
2498
|
+
assert.deepEqual(
|
|
2499
|
+
productResourceMeasuredEndpointTraceIds(endpoints),
|
|
2500
|
+
Array.from({ length: 16 }, (_, index) => `measured-${index + 8}`),
|
|
2501
|
+
);
|
|
2502
|
+
assert.throws(
|
|
2503
|
+
() => productResourceMeasuredEndpointTraceIds(endpoints.slice(1)),
|
|
2504
|
+
/exactly 24 cycle endpoints/u,
|
|
2505
|
+
);
|
|
2506
|
+
assert.throws(
|
|
2507
|
+
() =>
|
|
2508
|
+
productResourceMeasuredEndpointTraceIds([
|
|
2509
|
+
endpoints[0],
|
|
2510
|
+
{ ...endpoints[1], phase: "measured" },
|
|
2511
|
+
...endpoints.slice(2),
|
|
2512
|
+
]),
|
|
2513
|
+
/identity mismatch at cycle 1/u,
|
|
2514
|
+
);
|
|
2515
|
+
assert.throws(
|
|
2516
|
+
() =>
|
|
2517
|
+
productResourceMeasuredEndpointTraceIds([
|
|
2518
|
+
endpoints[0],
|
|
2519
|
+
{ ...endpoints[1], traceId: endpoints[0].traceId },
|
|
2520
|
+
...endpoints.slice(2),
|
|
2521
|
+
]),
|
|
2522
|
+
/trace id is duplicated at cycle 1/u,
|
|
2523
|
+
);
|
|
2524
|
+
});
|
|
2525
|
+
|
|
2526
|
+
test("resource endpoint closes only one new exact same-process paired trace", () => {
|
|
2527
|
+
const expected = {
|
|
2528
|
+
cycle: 2,
|
|
2529
|
+
processId: "tui:1",
|
|
2530
|
+
generation: "generation",
|
|
2531
|
+
semanticPaneId: "%1",
|
|
2532
|
+
};
|
|
2533
|
+
const endpoint = (traceId) => ({
|
|
2534
|
+
traceId,
|
|
2535
|
+
processId: "tui:1",
|
|
2536
|
+
generation: "generation",
|
|
2537
|
+
semanticPaneId: "%1",
|
|
2538
|
+
revision: 4,
|
|
2539
|
+
stateHash: "hash",
|
|
2540
|
+
paintStateIdentity: "latest-canonical-state-blitted",
|
|
2541
|
+
});
|
|
2542
|
+
assert.equal(
|
|
2543
|
+
selectProductResourceEndpoint([endpoint("old")], [endpoint("old"), endpoint("new")], expected)
|
|
2544
|
+
.traceId,
|
|
2545
|
+
"new",
|
|
2546
|
+
);
|
|
2547
|
+
assert.throws(
|
|
2548
|
+
() => selectProductResourceEndpoint([endpoint("old")], [endpoint("old")], expected),
|
|
2549
|
+
/Missing paired resource endpoint/u,
|
|
2550
|
+
);
|
|
2551
|
+
assert.throws(
|
|
2552
|
+
() =>
|
|
2553
|
+
selectProductResourceEndpoint(
|
|
2554
|
+
[endpoint("old")],
|
|
2555
|
+
[endpoint("old"), endpoint("new-a"), endpoint("new-b")],
|
|
2556
|
+
expected,
|
|
2557
|
+
),
|
|
2558
|
+
/Ambiguous paired resource endpoint/u,
|
|
2559
|
+
);
|
|
2560
|
+
|
|
2561
|
+
const pending = productResourceEndpointEpochState({
|
|
2562
|
+
beforeSamples: [endpoint("old")],
|
|
2563
|
+
afterSamples: [endpoint("old"), endpoint("new")],
|
|
2564
|
+
expected,
|
|
2565
|
+
inputSettled: true,
|
|
2566
|
+
traceQuiet: false,
|
|
2567
|
+
probeCellCount: 1,
|
|
2568
|
+
geometryStable: true,
|
|
2569
|
+
});
|
|
2570
|
+
assert.equal(pending.status, "pending");
|
|
2571
|
+
assert.equal(
|
|
2572
|
+
productResourceEndpointEpochState({
|
|
2573
|
+
beforeSamples: [endpoint("old")],
|
|
2574
|
+
afterSamples: [endpoint("old"), endpoint("new")],
|
|
2575
|
+
expected,
|
|
2576
|
+
inputSettled: true,
|
|
2577
|
+
traceQuiet: true,
|
|
2578
|
+
probeCellCount: 1,
|
|
2579
|
+
geometryStable: true,
|
|
2580
|
+
}).status,
|
|
2581
|
+
"ready",
|
|
2582
|
+
);
|
|
2583
|
+
assert.throws(
|
|
2584
|
+
() =>
|
|
2585
|
+
productResourceEndpointEpochState({
|
|
2586
|
+
beforeSamples: [endpoint("old")],
|
|
2587
|
+
afterSamples: [endpoint("old"), endpoint("new"), endpoint("late")],
|
|
2588
|
+
expected,
|
|
2589
|
+
inputSettled: true,
|
|
2590
|
+
traceQuiet: true,
|
|
2591
|
+
probeCellCount: 1,
|
|
2592
|
+
geometryStable: true,
|
|
2593
|
+
}),
|
|
2594
|
+
/Ambiguous paired resource endpoint/u,
|
|
2595
|
+
);
|
|
2596
|
+
assert.throws(
|
|
2597
|
+
() =>
|
|
2598
|
+
productResourceEndpointEpochState({
|
|
2599
|
+
beforeSamples: [endpoint("old")],
|
|
2600
|
+
afterSamples: [endpoint("old"), endpoint("new")],
|
|
2601
|
+
expected,
|
|
2602
|
+
inputSettled: true,
|
|
2603
|
+
traceQuiet: true,
|
|
2604
|
+
probeCellCount: 1,
|
|
2605
|
+
geometryStable: false,
|
|
2606
|
+
}),
|
|
2607
|
+
/geometry changed/u,
|
|
2608
|
+
);
|
|
2609
|
+
assert.throws(
|
|
2610
|
+
() =>
|
|
2611
|
+
productResourceEndpointEpochState({
|
|
2612
|
+
beforeSamples: [endpoint("old")],
|
|
2613
|
+
afterSamples: [endpoint("old"), endpoint("new")],
|
|
2614
|
+
expected,
|
|
2615
|
+
inputSettled: true,
|
|
2616
|
+
traceQuiet: true,
|
|
2617
|
+
probeCellCount: 2,
|
|
2618
|
+
geometryStable: true,
|
|
2619
|
+
}),
|
|
2620
|
+
/Ambiguous visible resource probe/u,
|
|
2621
|
+
);
|
|
2622
|
+
});
|
|
2623
|
+
|
|
2624
|
+
test("resource probe requires one shared newly-visible native and TUI cell", () => {
|
|
2625
|
+
assert.deepEqual(
|
|
2626
|
+
productResourceProbeCells({
|
|
2627
|
+
beforeNative: "prompt ",
|
|
2628
|
+
afterNative: "prompt a",
|
|
2629
|
+
beforeTui: "prompt ",
|
|
2630
|
+
afterTui: "prompt a",
|
|
2631
|
+
probe: "a",
|
|
2632
|
+
}),
|
|
2633
|
+
[{ row: 0, col: 7 }],
|
|
2634
|
+
);
|
|
2635
|
+
assert.deepEqual(
|
|
2636
|
+
productResourceProbeCells({
|
|
2637
|
+
beforeNative: "prompt ",
|
|
2638
|
+
afterNative: "prompt a",
|
|
2639
|
+
beforeTui: "prompt ",
|
|
2640
|
+
afterTui: "prompt ",
|
|
2641
|
+
probe: "a",
|
|
2642
|
+
}),
|
|
2643
|
+
[],
|
|
2644
|
+
);
|
|
2645
|
+
|
|
2646
|
+
const pane = {
|
|
2647
|
+
paneId: "%1",
|
|
2648
|
+
semanticPaneId: "pane.one",
|
|
2649
|
+
left: 0,
|
|
2650
|
+
top: 0,
|
|
2651
|
+
width: 20,
|
|
2652
|
+
height: 4,
|
|
2653
|
+
};
|
|
2654
|
+
const frame = "● pane.one \nprompt \n ";
|
|
2655
|
+
assert.equal(
|
|
2656
|
+
productResourceGeometryIdentity(frame, pane),
|
|
2657
|
+
productResourceGeometryIdentity(frame.replace("prompt", "prompt a"), pane),
|
|
2658
|
+
);
|
|
2659
|
+
assert.notEqual(
|
|
2660
|
+
productResourceGeometryIdentity(frame, pane),
|
|
2661
|
+
productResourceGeometryIdentity(frame, { ...pane, width: 21 }),
|
|
2662
|
+
);
|
|
2663
|
+
});
|
|
2664
|
+
|
|
2665
|
+
test("resource queue settlement reads the latest bounded input counters", () => {
|
|
2666
|
+
const stage = (inputPending, inputInFlight, inputPendingBytes) => ({
|
|
2667
|
+
type: "performance.stage",
|
|
2668
|
+
stage: "client",
|
|
2669
|
+
processId: "tui:1",
|
|
2670
|
+
inputPending,
|
|
2671
|
+
inputInFlight,
|
|
2672
|
+
inputPendingBytes,
|
|
2673
|
+
});
|
|
2674
|
+
assert.equal(productInputQueuesSettled([stage(1, 0, 1), stage(0, 0, 0)], "tui:1"), true);
|
|
2675
|
+
assert.equal(productInputQueuesSettled([stage(0, 0, 0), stage(0, 1, 0)], "tui:1"), false);
|
|
2676
|
+
assert.equal(
|
|
2677
|
+
productInputQueuesSettled(
|
|
2678
|
+
[
|
|
2679
|
+
{
|
|
2680
|
+
type: "performance.input-queue-state",
|
|
2681
|
+
processId: "tui:2",
|
|
2682
|
+
operation: "initialized",
|
|
2683
|
+
inputPending: 0,
|
|
2684
|
+
inputInFlight: 0,
|
|
2685
|
+
inputPendingBytes: 0,
|
|
2686
|
+
},
|
|
2687
|
+
],
|
|
2688
|
+
"tui:2",
|
|
2689
|
+
),
|
|
2690
|
+
true,
|
|
2691
|
+
);
|
|
2692
|
+
assert.equal(productInputQueuesSettled([], "tui:3"), false);
|
|
2693
|
+
});
|
|
2694
|
+
|
|
2695
|
+
test("multi-client convergence leases the exact full session topology", () => {
|
|
2696
|
+
const resources = [
|
|
2697
|
+
{ attachability: { status: "available", semanticPaneId: "pane.c" } },
|
|
2698
|
+
{ attachability: { status: "unavailable", semanticPaneId: "pane.ignored" } },
|
|
2699
|
+
{ attachability: { status: "available", semanticPaneId: "pane.a" } },
|
|
2700
|
+
{ attachability: { status: "available", semanticPaneId: "pane.b" } },
|
|
2701
|
+
];
|
|
2702
|
+
assert.deepEqual(productAttachablePaneInventory(resources), ["pane.a", "pane.b", "pane.c"]);
|
|
2703
|
+
assert.throws(
|
|
2704
|
+
() =>
|
|
2705
|
+
productAttachablePaneInventory([
|
|
2706
|
+
resources[0],
|
|
2707
|
+
{ attachability: { status: "available", semanticPaneId: "pane.c" } },
|
|
2708
|
+
]),
|
|
2709
|
+
/ambiguous/u,
|
|
2710
|
+
);
|
|
2711
|
+
const owner = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2712
|
+
const client = readFileSync(
|
|
2713
|
+
new URL("./product-test-rig-multiclient.ts", import.meta.url),
|
|
2714
|
+
"utf8",
|
|
2715
|
+
);
|
|
2716
|
+
assert.match(owner, /TMUX_IDE_RIG_PANES: JSON\.stringify\(panes\)/u);
|
|
2717
|
+
assert.match(client, /const panes = requiredPaneInventory/u);
|
|
2718
|
+
assert.match(client, /stream: \{[\s\S]*?panes,/u);
|
|
2719
|
+
assert.doesNotMatch(
|
|
2720
|
+
client.slice(client.indexOf("const nativeStartedAt"), client.indexOf("timings.nativeYieldMs")),
|
|
2721
|
+
/resize-window/u,
|
|
2722
|
+
);
|
|
2723
|
+
assert.match(
|
|
2724
|
+
client,
|
|
2725
|
+
/await Bun\.sleep\(250\);[\s\S]*?geometryAfterNative = await webB\.requestAuthority\("geometry"\)/u,
|
|
2726
|
+
);
|
|
2727
|
+
assert.doesNotMatch(
|
|
2728
|
+
client.slice(
|
|
2729
|
+
client.indexOf("await Bun.sleep(250)"),
|
|
2730
|
+
client.indexOf("timings.nativeQuietReacquireMs"),
|
|
2731
|
+
),
|
|
2732
|
+
/catch/u,
|
|
2733
|
+
);
|
|
2734
|
+
});
|
|
2735
|
+
|
|
2736
|
+
test("causal baseline names every fail-closed readiness predicate", () => {
|
|
2737
|
+
const ready = {
|
|
2738
|
+
fixtureOption: "ready-v1:probe-0",
|
|
2739
|
+
expectedOption: "ready-v1:probe-0",
|
|
2740
|
+
currentCommand: "node",
|
|
2741
|
+
queueObservation: { inputPending: 0, inputInFlight: 0, inputPendingBytes: 0 },
|
|
2742
|
+
activePaneId: "%1",
|
|
2743
|
+
fixturePaneId: "%1",
|
|
2744
|
+
geometryBefore: "%1:80x24",
|
|
2745
|
+
geometryAfter: "%1:80x24",
|
|
2746
|
+
nativeCell: " ",
|
|
2747
|
+
tuiCell: " ",
|
|
2748
|
+
};
|
|
2749
|
+
assert.equal(causalFixtureBaselineReadiness(ready).ready, true);
|
|
2750
|
+
for (const [field, value, predicate] of [
|
|
2751
|
+
["fixtureOption", "ready-v1:other", "optionReady"],
|
|
2752
|
+
["currentCommand", "zsh", "helperCommandReady"],
|
|
2753
|
+
["queueObservation", null, "queueObserved"],
|
|
2754
|
+
["queueObservation", { inputPending: 1, inputInFlight: 0, inputPendingBytes: 1 }, "queueZero"],
|
|
2755
|
+
["activePaneId", "%2", "paneIdentityReady"],
|
|
2756
|
+
["geometryAfter", "%1:81x24", "geometryStable"],
|
|
2757
|
+
["nativeCell", "x", "nativeCellBlank"],
|
|
2758
|
+
["tuiCell", "x", "tuiCellBlank"],
|
|
2759
|
+
]) {
|
|
2760
|
+
const result = causalFixtureBaselineReadiness({ ...ready, [field]: value });
|
|
2761
|
+
assert.equal(result.ready, false, predicate);
|
|
2762
|
+
assert.equal(result.predicates[predicate], false, predicate);
|
|
2763
|
+
}
|
|
2764
|
+
});
|
|
2765
|
+
|
|
2766
|
+
test("causal baseline stability ignores unrelated trace growth", () => {
|
|
2767
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2768
|
+
const start = source.indexOf("const resetFixtureBaseline");
|
|
2769
|
+
const baseline = source.slice(start, source.indexOf("let causalFailure", start));
|
|
2770
|
+
const identity = baseline.match(/const nextIdentity = \[[\s\S]*?\]\.join/)?.[0] ?? "";
|
|
2771
|
+
assert.doesNotMatch(identity, /records\.length/u);
|
|
2772
|
+
assert.match(identity, /queueObservation\?\.atMicros/u);
|
|
2773
|
+
});
|
|
2774
|
+
|
|
2775
|
+
test("window failure preparation seals relocated structural runtime evidence in every JSON view", () => {
|
|
2776
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2777
|
+
const start = source.indexOf("async function prepareDiagnosticFailure");
|
|
2778
|
+
const end = source.indexOf("async function executeDiagnosticAttempt", start);
|
|
2779
|
+
const failure = source.slice(start, end);
|
|
2780
|
+
assert.ok(start > 0 && end > start);
|
|
2781
|
+
assert.match(failure, /const state = readJson\(statePath\);\s*const partialRuntime =/u);
|
|
2782
|
+
assert.match(failure, /report = \{[\s\S]*?failureObservation,\s*partialRuntime,/u);
|
|
2783
|
+
assert.match(failure, /alignment: \{[\s\S]*?failureObservation,\s*partialRuntime,/u);
|
|
2784
|
+
assert.match(
|
|
2785
|
+
failure,
|
|
2786
|
+
/clientState: \{ \.\.\.correlation\.clientState, failureObservation, partialRuntime \}/u,
|
|
2787
|
+
);
|
|
2788
|
+
});
|
|
2789
|
+
|
|
2790
|
+
test("Card5 owner seals keyed daemon lifecycle before cleanup and controller only reuses it", () => {
|
|
2791
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2792
|
+
const ownerCatch = source.slice(
|
|
2793
|
+
source.indexOf(" } catch (error) {", source.indexOf("async function owner")),
|
|
2794
|
+
source.indexOf("\n }\n}\n\nconst [command", source.indexOf("async function owner")),
|
|
2795
|
+
);
|
|
2796
|
+
assert.match(
|
|
2797
|
+
ownerCatch,
|
|
2798
|
+
/daemonPaneStreamLifecycle: await card5DaemonPaneStreamLifecycle\(state\)[\s\S]*?publish\(terminalFailure\)[\s\S]*?settleInternalProductRigCleanup/u,
|
|
2799
|
+
);
|
|
2800
|
+
const execute = source.slice(
|
|
2801
|
+
source.indexOf("async function executeDiagnosticAttempt"),
|
|
2802
|
+
source.indexOf(
|
|
2803
|
+
"async function diagnose",
|
|
2804
|
+
source.indexOf("async function executeDiagnosticAttempt"),
|
|
2805
|
+
),
|
|
2806
|
+
);
|
|
2807
|
+
assert.match(
|
|
2808
|
+
execute,
|
|
2809
|
+
/state\?\.failureObservation\?\.daemonPaneStreamLifecycle[\s\S]*?state\.failureObservation\.daemonPaneStreamLifecycle/u,
|
|
2810
|
+
);
|
|
2811
|
+
assert.doesNotMatch(ownerCatch, /publish\([^)]*card5InputFingerprintKey/u);
|
|
2812
|
+
});
|
|
2813
|
+
|
|
2814
|
+
test("window switch selection rejection fails immediately with its bounded predicate", () => {
|
|
2815
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2816
|
+
const start = source.indexOf("async function driveExactHostedWindowSwitch");
|
|
2817
|
+
const end = source.indexOf("async function", start + 20);
|
|
2818
|
+
const drive = source.slice(start, end);
|
|
2819
|
+
assert.ok(start > 0 && end > start);
|
|
2820
|
+
assert.match(drive, /record\?\.phase === "window-switch-failed"/u);
|
|
2821
|
+
assert.match(drive, /windowSwitchSelectionFailureObservation/u);
|
|
2822
|
+
assert.doesNotMatch(drive, /tuiCommand\(state/u);
|
|
2823
|
+
assert.match(drive, /await tuiCommandAsync\([\s\S]*?signal/u);
|
|
2824
|
+
assert.match(drive, /windowSwitchInputFailureObservation/u);
|
|
2825
|
+
assert.match(drive, /error\.boundary = boundary/u);
|
|
2826
|
+
assert.match(drive, /backendReason: rejectedReceipt\?\.failureBackendReason/u);
|
|
2827
|
+
assert.ok(
|
|
2828
|
+
drive.indexOf("windowSwitchSelectionFailureObservation") <
|
|
2829
|
+
drive.indexOf("window switch actual-frame fence did not settle"),
|
|
2830
|
+
);
|
|
2831
|
+
});
|
|
2832
|
+
|
|
2833
|
+
test("window switch callers identify prime versus measured input failures", () => {
|
|
2834
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2835
|
+
assert.match(
|
|
2836
|
+
source,
|
|
2837
|
+
/driveExactHostedWindowSwitch\([\s\S]*?boundary: "window-switch-visible"[\s\S]*?signal: ownerAbort\.signal/u,
|
|
2838
|
+
);
|
|
2839
|
+
assert.match(
|
|
2840
|
+
source,
|
|
2841
|
+
/driveExactHostedWindowSwitch\(state, tracePath, seen, \{[\s\S]*?boundary: "window-switch-distribution",\s*ordinal,\s*signal: ownerAbort\.signal/u,
|
|
2842
|
+
);
|
|
2843
|
+
});
|
|
2844
|
+
|
|
2845
|
+
test("ProductRig checks a heartbeat gap before its monotonic timeout", () => {
|
|
2846
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2847
|
+
const start = source.indexOf("async function waitForState");
|
|
2848
|
+
const end = source.indexOf("function installWebStartupDiagnostics", start);
|
|
2849
|
+
const wait = source.slice(start, end);
|
|
2850
|
+
assert.match(wait, /for \(;;\)/u);
|
|
2851
|
+
assert.ok(wait.indexOf("heartbeat.suspended") < wait.indexOf("performance.now() >= deadline"));
|
|
2852
|
+
assert.match(wait, /switchOrdinalWatermark/u);
|
|
2853
|
+
});
|
|
2854
|
+
|
|
2855
|
+
test("ANSI owner readiness uses one bounded journey-specific wait and publishes progress", () => {
|
|
2856
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2857
|
+
const startAt = source.indexOf("async function start(json");
|
|
2858
|
+
const stopAt = source.indexOf("async function stop(", startAt);
|
|
2859
|
+
const start = source.slice(startAt, stopAt);
|
|
2860
|
+
assert.match(start, /ansi-cursor-alt-screen" \? 900_000 : 90_000/u);
|
|
2861
|
+
const diagnoseAt = source.indexOf("async function diagnoseAnsiCursorAltScreen");
|
|
2862
|
+
const diagnoseEnd = source.indexOf("function executeProductJourney", diagnoseAt);
|
|
2863
|
+
const diagnose = source.slice(diagnoseAt, diagnoseEnd);
|
|
2864
|
+
assert.match(diagnose, /const state = await start\(false, true, planEntry\)/u);
|
|
2865
|
+
assert.doesNotMatch(diagnose, /waitForState/u);
|
|
2866
|
+
assert.match(
|
|
2867
|
+
source,
|
|
2868
|
+
/workloadProgress: Object\.freeze\(\{[\s\S]*?activeCycle:[\s\S]*?completedCycles:/u,
|
|
2869
|
+
);
|
|
2870
|
+
assert.match(source, /resource-sample-unavailable/u);
|
|
2871
|
+
assert.match(source, /resource-sample-cardinality/u);
|
|
2872
|
+
assert.match(source, /rss-absolute-cap/u);
|
|
2873
|
+
assert.match(source, /heap-absolute-cap/u);
|
|
2874
|
+
assert.equal((source.match(/ansiEventLoopResourceCapStatus\(/gu) ?? []).length, 2);
|
|
2875
|
+
assert.doesNotMatch(source, /eventLoopDelayPeakMicros\s*>\s*33_000/u);
|
|
2876
|
+
const ansiOwnerAt = source.indexOf('if (journeyId === "ansi-cursor-alt-screen")');
|
|
2877
|
+
const ansiOwnerEnd = source.indexOf('if (journeyId === "keyboard-pointer-resize")', ansiOwnerAt);
|
|
2878
|
+
const ansiOwner = source.slice(ansiOwnerAt, ansiOwnerEnd);
|
|
2879
|
+
assert.ok(ansiOwnerAt > 0);
|
|
2880
|
+
assert.ok(ansiOwnerEnd > ansiOwnerAt);
|
|
2881
|
+
assert.match(ansiOwner, /const ansiJsonlReaders = new Map\(\)/u);
|
|
2882
|
+
assert.match(ansiOwner, /createProductJsonlTailReader\(path, \{ recordKind \}\)/u);
|
|
2883
|
+
assert.match(ansiOwner, /await ansiJsonlWatermark\(namespace\.tui\.performanceTracePath\)/u);
|
|
2884
|
+
assert.equal((ansiOwner.match(/\breadJsonLines\(/gu) ?? []).length, 0);
|
|
2885
|
+
assert.ok((ansiOwner.match(/ansiReadJsonLines\(/gu) ?? []).length >= 15);
|
|
2886
|
+
assert.match(source, /heartbeatPeakRevisionHmac/u);
|
|
2887
|
+
assert.match(source, /heartbeatPeakContextSwitchesAvailable/u);
|
|
2888
|
+
const ansiStartWebAt = source.indexOf(
|
|
2889
|
+
"startWeb: async (namespace, runningDaemon, identity, _process, baseline)",
|
|
2890
|
+
);
|
|
2891
|
+
const ansiStartWebEnd = ansiStartWebAt + 60_000;
|
|
2892
|
+
const ansiStartWeb = source.slice(ansiStartWebAt, ansiStartWebEnd);
|
|
2893
|
+
assert.ok(ansiStartWebAt > 0 && ansiStartWeb.length === 60_000);
|
|
2894
|
+
assert.match(ansiStartWeb, /productCapturePageUrlStatus\(devServer\.pageUrl\)/u);
|
|
2895
|
+
assert.match(ansiStartWeb, /publish\(\{ web: \{ pageUrl: ansiPageUrl\.pageUrl/u);
|
|
2896
|
+
assert.ok(ansiStartWeb.indexOf("publish({ web:") < ansiStartWeb.indexOf("await page.goto("));
|
|
2897
|
+
|
|
2898
|
+
const captureAt = source.indexOf("async function captureArtifacts");
|
|
2899
|
+
const captureEnd = source.indexOf("async function waitForState", captureAt);
|
|
2900
|
+
const capture = source.slice(captureAt, captureEnd);
|
|
2901
|
+
assert.match(capture, /productCapturePageUrlStatus\(state\?\.web\?\.pageUrl\)/u);
|
|
2902
|
+
assert.match(capture, /PRODUCT_RIG_CAPTURE_PAGE_URL_INVALID/u);
|
|
2903
|
+
assert.match(capture, /error\.boundary = "evidence-capture"/u);
|
|
2904
|
+
assert.ok(capture.indexOf("if (!capturePageUrl.exact)") < capture.indexOf("mkdirSync("));
|
|
2905
|
+
assert.doesNotMatch(capture, /state\.web\.pageUrl/u);
|
|
2906
|
+
});
|
|
2907
|
+
|
|
2908
|
+
test("window switch rejects writer loss before quiet-tail or rename attribution", () => {
|
|
2909
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2910
|
+
const start = source.indexOf("async function driveExactHostedWindowSwitch");
|
|
2911
|
+
const end = source.indexOf("async function waitForWindowRenameFence", start);
|
|
2912
|
+
const drive = source.slice(start, end);
|
|
2913
|
+
assert.ok(start > 0 && end > start);
|
|
2914
|
+
assert.match(drive, /window switch lifecycle writer fence was unhealthy/u);
|
|
2915
|
+
assert.match(drive, /windowLifecycleWriterFailureObservation/u);
|
|
2916
|
+
assert.ok(
|
|
2917
|
+
drive.indexOf("windowLifecycleWriterFailureObservation") <
|
|
2918
|
+
drive.indexOf("settleWindowReferenceTrace"),
|
|
2919
|
+
);
|
|
2920
|
+
});
|
|
2921
|
+
|
|
2922
|
+
test("window reports seal the bounded causal frame assessment in report and alignment", () => {
|
|
2923
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2924
|
+
const start = source.indexOf("async function diagnoseWindowLifecycle");
|
|
2925
|
+
const end = source.indexOf("async function diagnoseKeyboardPointerResize", start);
|
|
2926
|
+
const diagnose = source.slice(start, end);
|
|
2927
|
+
assert.ok(start > 0 && end > start);
|
|
2928
|
+
assert.match(diagnose, /const causal = assessProductWindowLifecycle/u);
|
|
2929
|
+
assert.equal((diagnose.match(/causalAssessment: causal/gu) ?? []).length, 2);
|
|
2930
|
+
assert.match(diagnose, /firstBrokenBoundary: assessment\.firstBrokenBoundary/u);
|
|
2931
|
+
});
|
|
2932
|
+
|
|
2933
|
+
test("resize journey owns one bounded two-pane Meta+Arrow and SGR causal executor", () => {
|
|
2934
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2935
|
+
const start = source.indexOf('if (journeyId === "keyboard-pointer-resize")');
|
|
2936
|
+
const end = source.indexOf('if (journeyId === "window-lifecycle")', start);
|
|
2937
|
+
const resize = source.slice(start, end);
|
|
2938
|
+
const resizeConditioning = source.slice(
|
|
2939
|
+
source.indexOf("async function conditionExactResizeTmuxFixture"),
|
|
2940
|
+
source.indexOf("async function validateExactResizeTmuxBaseline"),
|
|
2941
|
+
);
|
|
2942
|
+
const resizeBaseline = source.slice(
|
|
2943
|
+
source.indexOf("async function validateExactResizeTmuxBaseline"),
|
|
2944
|
+
source.indexOf("async function preserveWarmRehostFailure"),
|
|
2945
|
+
);
|
|
2946
|
+
assert.ok(start > 0 && end > start);
|
|
2947
|
+
assert.match(resize, /runKeyboardPointerResizeOwnerBoot/u);
|
|
2948
|
+
assert.match(resize, /windowsPerSession: 1/u);
|
|
2949
|
+
assert.match(resize, /"split-window",\s+"-h"/u);
|
|
2950
|
+
assert.match(resize, /validateExactResizeTmuxBaseline/u);
|
|
2951
|
+
assert.match(resize, /initialPaneCommand/u);
|
|
2952
|
+
assert.match(resize, /exactResizeBlockerCommand/u);
|
|
2953
|
+
assert.doesNotMatch(resize, /exec sh -i/u);
|
|
2954
|
+
assert.match(resizeConditioning, /pane-border-status",\s+"top"/u);
|
|
2955
|
+
assert.match(
|
|
2956
|
+
resizeConditioning,
|
|
2957
|
+
/"resize-window",\s+"-t",\s+target,\s+"-x",\s+"132",\s+"-y",\s+"41"/u,
|
|
2958
|
+
);
|
|
2959
|
+
assert.match(resizeConditioning, /"select-layout",\s+"-t",\s+target,\s+"even-horizontal"/u);
|
|
2960
|
+
assert.doesNotMatch(resizeBaseline, /set-option|resize-window|select-layout/u);
|
|
2961
|
+
assert.match(resize, /kind: "modified-key"/u);
|
|
2962
|
+
assert.match(resize, /modifiers: \["meta"\]/u);
|
|
2963
|
+
assert.match(resize, /ordinal < 30/u);
|
|
2964
|
+
assert.match(resize, /action: "down"/u);
|
|
2965
|
+
assert.match(resize, /action: "drag"/u);
|
|
2966
|
+
assert.match(resize, /action: "up"/u);
|
|
2967
|
+
assert.match(resize, /presentationDigest/u);
|
|
2968
|
+
assert.match(resize, /captureResizeContentContinuity/u);
|
|
2969
|
+
assert.match(resize, /inspectResizeContentContinuity/u);
|
|
2970
|
+
assert.match(resize, /contentContinuity/u);
|
|
2971
|
+
assert.match(resize, /waitForWindowWorkspaceEvidence/u);
|
|
2972
|
+
assert.match(resize, /waitForFocusWebSemantic/u);
|
|
2973
|
+
assert.match(
|
|
2974
|
+
resize,
|
|
2975
|
+
/fleetSessionId: resizeBoot\.identity\.fleetSessionId,[\s\S]*?catalogRevision: resizeBoot\.identity\.catalogRevision/u,
|
|
2976
|
+
);
|
|
2977
|
+
assert.match(
|
|
2978
|
+
resize,
|
|
2979
|
+
/publish\(\{\s*convergence: \{ workspaceClient: resizeBoot\.web\.workspaceClient \},\s*journeyEvidence: \{ keyboardPointerResize: journeyEvidence \}/u,
|
|
2980
|
+
);
|
|
2981
|
+
assert.doesNotMatch(resize, /\btuiCommand\(state/u);
|
|
2982
|
+
assert.doesNotMatch(resize, /\bexecFileSync\(/u);
|
|
2983
|
+
});
|
|
2984
|
+
|
|
2985
|
+
test("selection journey owns one exact hosted selection copy app-mouse executor", () => {
|
|
2986
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
2987
|
+
const start = source.indexOf('if (journeyId === "selection-copy-app-mouse")');
|
|
2988
|
+
const end = source.indexOf('if (journeyId === "ansi-cursor-alt-screen")', start);
|
|
2989
|
+
const selection = source.slice(start, end);
|
|
2990
|
+
assert.ok(start > 0 && end > start);
|
|
2991
|
+
assert.match(selection, /runSelectionCopyAppMouseOwnerBoot/u);
|
|
2992
|
+
assert.match(selection, /initialPaneCommand/u);
|
|
2993
|
+
assert.match(selection, /kind: "selection-drag"/u);
|
|
2994
|
+
assert.match(selection, /kind: "copy-capture"/u);
|
|
2995
|
+
assert.match(selection, /kind: "copy-capture", timeoutMs: 3_000/u);
|
|
2996
|
+
assert.match(selection, /beforeCount: before/u);
|
|
2997
|
+
assert.match(selection, /expectedOrdinal: priorCopy\.copyOrdinal \+ 1/u);
|
|
2998
|
+
assert.equal((selection.match(/kind: "application-mouse"/gu) ?? []).length, 1);
|
|
2999
|
+
assert.match(selection, /\["down", point\.x\]/u);
|
|
3000
|
+
assert.match(selection, /\["drag", point\.x \+ 1\]/u);
|
|
3001
|
+
assert.match(selection, /\["up", point\.x \+ 1\]/u);
|
|
3002
|
+
assert.match(selection, /gesture < 10/u);
|
|
3003
|
+
assert.match(selection, /applicationMouseCausalSamples/u);
|
|
3004
|
+
assert.match(selection, /assessApplicationMouseDistribution/u);
|
|
3005
|
+
assert.match(selection, /distribution\.qualified/u);
|
|
3006
|
+
assert.match(selection, /createHmac/u);
|
|
3007
|
+
assert.match(selection, /evidenceKey/u);
|
|
3008
|
+
assert.match(selection, /selectionStyle\.extraChangedCells/u);
|
|
3009
|
+
assert.match(selection, /selectionMouseFixtureProgram\(\)/u);
|
|
3010
|
+
assert.match(selection, /kind: "control-key", key: "y"/u);
|
|
3011
|
+
assert.match(selection, /waitForSelectionMouseModeConditioning/u);
|
|
3012
|
+
assert.match(selection, /applicationMouseReceipts: 0/u);
|
|
3013
|
+
assert.match(selection, /preCleanTmux/u);
|
|
3014
|
+
assert.match(selection, /selectionLocalModeFailureObservation/u);
|
|
3015
|
+
assert.match(selection, /performanceWatermark: performanceBefore\.length/u);
|
|
3016
|
+
assert.match(selection, /traceWatermark: traceBefore\.length/u);
|
|
3017
|
+
assert.match(selection, /selectionCopyFailureEvidence/u);
|
|
3018
|
+
assert.match(selection, /copyFailure/u);
|
|
3019
|
+
assert.match(
|
|
3020
|
+
selection,
|
|
3021
|
+
/selectionWorkspaceClientEvidence\(selectionBoot\.web\.workspaceClient\)/u,
|
|
3022
|
+
);
|
|
3023
|
+
assert.match(selection, /workspaceClient\.committed\.terminalResourceRevision/u);
|
|
3024
|
+
assert.match(selection, /exactTerminalResourceRevision: baseline\.terminalResourceRevision/u);
|
|
3025
|
+
assert.doesNotMatch(selection, /derived\.terminalInventory\.terminalResourceRevision/u);
|
|
3026
|
+
assert.match(selection, /selectionCausalFailureObservation\(assessment, journeyEvidence\)/u);
|
|
3027
|
+
assert.match(selection, /failureObservation,/u);
|
|
3028
|
+
assert.match(selection, /evidenceKey: namespace\.evidenceKey/u);
|
|
3029
|
+
assert.match(
|
|
3030
|
+
selection,
|
|
3031
|
+
/distribution = assessApplicationMouseDistribution\(samples, expectedPoint\)/u,
|
|
3032
|
+
);
|
|
3033
|
+
assert.match(selection, /applicationMouseDistributionFailureObservation\(\{/u);
|
|
3034
|
+
const assessmentFailure = selection.slice(
|
|
3035
|
+
selection.indexOf("const assessment = assessProductSelectionCopyAppMouse"),
|
|
3036
|
+
selection.indexOf("publish({\n convergence:", selection.indexOf("const assessment =")),
|
|
3037
|
+
);
|
|
3038
|
+
assert.ok(assessmentFailure.indexOf("publish({") < assessmentFailure.indexOf("throw error"));
|
|
3039
|
+
assert.doesNotMatch(assessmentFailure, /status:\s*"ready"/u);
|
|
3040
|
+
assert.match(source, /timeout: testdriveInputSupervisorTimeout\(document\.timeoutMs\)/u);
|
|
3041
|
+
assert.match(selection, /latestMode/u);
|
|
3042
|
+
assert.match(selection, /waitForWindowWorkspaceEvidence/u);
|
|
3043
|
+
assert.match(selection, /waitForFocusWebSemantic/u);
|
|
3044
|
+
assert.match(selection, /settleWindowReferenceTrace/u);
|
|
3045
|
+
assert.doesNotMatch(selection, /\btuiCommand\(state/u);
|
|
3046
|
+
assert.doesNotMatch(selection, /\bexecFileSync\(/u);
|
|
3047
|
+
});
|
|
3048
|
+
|
|
3049
|
+
test("ANSI journey owns one isolated cursor alternate-screen executor", () => {
|
|
3050
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3051
|
+
const ansiHelper = readFileSync(
|
|
3052
|
+
new URL("./lib/product-ansi-cursor-alt-screen.mjs", import.meta.url),
|
|
3053
|
+
"utf8",
|
|
3054
|
+
);
|
|
3055
|
+
const start = source.indexOf('if (journeyId === "ansi-cursor-alt-screen")');
|
|
3056
|
+
const end = source.indexOf('if (journeyId === "keyboard-pointer-resize")', start);
|
|
3057
|
+
const ansi = source.slice(start, end);
|
|
3058
|
+
assert.ok(start > 0 && end > start);
|
|
3059
|
+
assert.match(source, /TMUX_IDE_PRODUCT_RUN_ID: planEntry\.runId/u);
|
|
3060
|
+
assert.match(source, /diagnosticAttempt: inheritedDiagnosticAttempt/u);
|
|
3061
|
+
assert.match(source, /Persist the parent-frozen run\/provenance identity/u);
|
|
3062
|
+
assert.match(ansi, /runAnsiCursorAltScreenOwnerBoot/u);
|
|
3063
|
+
assert.match(ansi, /product-ansi-cursor-alt-screen-fixture\.mjs/u);
|
|
3064
|
+
assert.match(ansi, /validateScratchInitialPaneCommand\(initialPaneCommand\)/u);
|
|
3065
|
+
assert.doesNotMatch(ansi, /args: \["-e", ansiCursorAltScreenFixtureProgram/u);
|
|
3066
|
+
assert.match(ansi, /const marker = ansiWorkloadMarker\(namespace\.marker, cycle\)/u);
|
|
3067
|
+
assert.match(ansi, /const workloadPayload = ansiWorkloadPayload\(namespace\.marker, cycle\)/u);
|
|
3068
|
+
assert.match(ansi, /ansiWorkloadProducerStatus\(producerTail,/u);
|
|
3069
|
+
assert.match(ansi, /producerStatus: producer\.state/u);
|
|
3070
|
+
assert.match(ansi, /producerFirstCause:/u);
|
|
3071
|
+
assert.match(ansi, /flowRecovery: flowRecoveryEvidence/u);
|
|
3072
|
+
assert.match(ansi, /lastFailureReason: ANSI_MIRROR_FLOW_FAILURE_REASONS\.has/u);
|
|
3073
|
+
assert.match(ansi, /nativeTimeout:/u);
|
|
3074
|
+
assert.doesNotMatch(ansi, /4096 \* 28 \+ Buffer\.byteLength\(marker\)/u);
|
|
3075
|
+
assert.match(ansi, /windowsPerSession: 1/u);
|
|
3076
|
+
assert.match(ansi, /performanceTraceDetail: "1"/u);
|
|
3077
|
+
assert.match(ansi, /for \(let ordinal = 1; ordinal <= 30; ordinal \+= 1\)/u);
|
|
3078
|
+
assert.match(ansi, /gridWalked: false/u);
|
|
3079
|
+
assert.match(
|
|
3080
|
+
ansi,
|
|
3081
|
+
/gridWalked: options\.gridWalked,\s*gridRowsRead: options\.gridRowsRead,\s*fullWalk: options\.fullWalk,/u,
|
|
3082
|
+
);
|
|
3083
|
+
assert.match(ansi, /conditioningCycleCount: 8/u);
|
|
3084
|
+
assert.match(ansi, /measuredCycleCount: 16/u);
|
|
3085
|
+
assert.match(ansi, /advanceAnsiWorkloadProgress/u);
|
|
3086
|
+
assert.match(ansi, /ansiWorkloadProgressExpiry/u);
|
|
3087
|
+
assert.match(ansi, /ANSI_WORKLOAD_ABSOLUTE_MS/u);
|
|
3088
|
+
assert.match(ansi, /ANSI_WORKLOAD_NO_PROGRESS_MS/u);
|
|
3089
|
+
assert.match(ansi, /decodeFocusFramebufferCapture\(captureEnvelope\)/u);
|
|
3090
|
+
assert.match(ansi, /markerCount === 1 && captureIdentityExact/u);
|
|
3091
|
+
assert.match(ansi, /finalCursorPresentation\.cursorY === 39/u);
|
|
3092
|
+
assert.match(ansi, /finalCursorPresentation\.viewportRows === 40/u);
|
|
3093
|
+
assert.match(ansi, /finalCursorPresentation\.visible === true/u);
|
|
3094
|
+
assert.match(
|
|
3095
|
+
ansi,
|
|
3096
|
+
/ansiWorkloadDeliveryJoin\(\{\s*canonical: finalTransition,\s*daemonRecords: daemonTail,\s*expected:/u,
|
|
3097
|
+
);
|
|
3098
|
+
assert.match(ansi, /ansiWorkloadOrderedTailStatus/u);
|
|
3099
|
+
assert.match(ansi, /type === "performance\.terminal-canonical-update"/u);
|
|
3100
|
+
assert.match(ansi, /type === "performance\.terminal-canonical-publication"/u);
|
|
3101
|
+
assert.match(ansi, /record\.updateType === "terminal\.seed"/u);
|
|
3102
|
+
assert.match(ansi, /ansiWorkloadOrderedTailStatus\(\{\s*transitions: canonicalTransitions,/u);
|
|
3103
|
+
assert.match(ansi, /const finalTransition = canonicalTransitions\.at\(-1\) \?\? null/u);
|
|
3104
|
+
assert.match(ansi, /const mode = matchingModes\.length === 1 \? matchingModes\[0\] : null/u);
|
|
3105
|
+
assert.match(ansi, /canonical: finalTransition/u);
|
|
3106
|
+
assert.match(ansi, /transition: finalTransition/u);
|
|
3107
|
+
assert.doesNotMatch(ansi, /mode\.cursor\?\.y === 39/u);
|
|
3108
|
+
assert.match(ansi, /finalCursorPresentation\.cursorY === 39/u);
|
|
3109
|
+
assert.match(ansi, /laterTransitionCount/u);
|
|
3110
|
+
assert.match(ansi, /canonicalTransitionType: finalTransition\.updateType/u);
|
|
3111
|
+
assert.match(ansi, /workloadFailure: error\.observation/u);
|
|
3112
|
+
assert.match(ansi, /const tracedDelivery = tracedEnqueues\.length === 1/u);
|
|
3113
|
+
assert.match(ansi, /tracedDelivery\.traceId/u);
|
|
3114
|
+
assert.doesNotMatch(ansi, /daemonTraceHmac:[\s\S]{0,160}daemonDelivery\.traceId/u);
|
|
3115
|
+
assert.match(ansi, /workloadFirstFailedPredicate/u);
|
|
3116
|
+
assert.match(ansi, /workloadMetrics: Object\.freeze/u);
|
|
3117
|
+
assert.match(ansi, /webPredicates: Object\.freeze/u);
|
|
3118
|
+
assert.ok(
|
|
3119
|
+
ansi.indexOf("ansiWorkloadOrderedTailStatus") <
|
|
3120
|
+
ansi.indexOf("const finalTransition = canonicalTransitions.at"),
|
|
3121
|
+
);
|
|
3122
|
+
assert.match(ansi, /deliveryWorkspaceName: identity\.sessionName/u);
|
|
3123
|
+
assert.match(ansi, /workspaceName: baseline\.deliveryWorkspaceName/u);
|
|
3124
|
+
assert.match(ansi, /deliverySurfaces: ansiExpectedDeliverySurfaces/u);
|
|
3125
|
+
assert.match(ansi, /deliveryClients: ansiExpectedDeliveryClients/u);
|
|
3126
|
+
assert.match(ansiHelper, /ansiDeliverySubscriberTopologyStatus/u);
|
|
3127
|
+
assert.match(ansi, /const readinessGate = await runAnsiDeliveryReadyAction\(\{/u);
|
|
3128
|
+
assert.match(ansiHelper, /waitForAnsiDeliverySubscriberReadiness/u);
|
|
3129
|
+
assert.match(ansiHelper, /ansiDeliverySubscriberReadinessStatus/u);
|
|
3130
|
+
assert.match(ansi, /ANSI_DELIVERY_LANE_NOT_CAUGHT_UP/u);
|
|
3131
|
+
assert.match(
|
|
3132
|
+
ansi,
|
|
3133
|
+
/publishAnsiPartial\(\{ stage: "web-readiness", webFailure: error\.observation \}\)/u,
|
|
3134
|
+
);
|
|
3135
|
+
assert.match(ansi, /const expectedGrid = ansiWebExpectedGridProjection\(stage, driven\)/u);
|
|
3136
|
+
assert.doesNotMatch(ansi, /driven\.raw\.mode\.dirtyRows/u);
|
|
3137
|
+
assert.match(ansi, /operation: "ansi-web-expected-projection"/u);
|
|
3138
|
+
assert.match(ansi, /error\.code = "ANSI_WEB_EXPECTED_GRID_INVALID"/u);
|
|
3139
|
+
assert.match(ansi, /renditionHmacExact: candidate\?\.renditionHmac === renditionHmac/u);
|
|
3140
|
+
assert.match(
|
|
3141
|
+
ansi,
|
|
3142
|
+
/rendererColsExact:\s*candidate\?\.rendererCols === expectedPresentation\.rendererCols/u,
|
|
3143
|
+
);
|
|
3144
|
+
assert.match(
|
|
3145
|
+
ansi,
|
|
3146
|
+
/rendererRowsExact:\s*candidate\?\.rendererRows === expectedPresentation\.rendererRows/u,
|
|
3147
|
+
);
|
|
3148
|
+
assert.match(ansi, /renditionCellCountExact:/u);
|
|
3149
|
+
assert.match(
|
|
3150
|
+
ansi,
|
|
3151
|
+
/cursorCountExact:\s*candidate\?\.cursorCount === \(expectedPresentation\.cursorHidden \? 0 : 1\)/u,
|
|
3152
|
+
);
|
|
3153
|
+
assert.match(ansi, /ansiRenditionFailureLocalization\(candidate,/u);
|
|
3154
|
+
assert.match(ansi, /positionWrappedHmac:/u);
|
|
3155
|
+
assert.match(ansi, /"cellHmacs"/u);
|
|
3156
|
+
assert.match(ansi, /renditionFailure: identityExact \? null : localization/u);
|
|
3157
|
+
assert.match(ansi, /firstFailedPredicate,/u);
|
|
3158
|
+
assert.match(ansi, /code: error\.code,\s*firstFailedPredicate,\s*stableSamples:/u);
|
|
3159
|
+
assert.match(ansi, /candidate: boundedCandidate,\s*predicates: predicateVector/u);
|
|
3160
|
+
assert.ok(
|
|
3161
|
+
ansi.indexOf("const readinessGate = await runAnsiDeliveryReadyAction") <
|
|
3162
|
+
ansi.indexOf("takeWatermark:", ansi.indexOf("driveAnsiStage")),
|
|
3163
|
+
);
|
|
3164
|
+
assert.ok(
|
|
3165
|
+
ansi.indexOf("takeWatermark:", ansi.indexOf("driveAnsiStage")) <
|
|
3166
|
+
ansi.indexOf("driveInput:", ansi.indexOf("driveAnsiStage")),
|
|
3167
|
+
);
|
|
3168
|
+
assert.doesNotMatch(ansi, /waitAnsiDeliveryTopology/u);
|
|
3169
|
+
assert.match(ansiHelper, /timeoutMs = 60_000/u);
|
|
3170
|
+
assert.match(ansi, /const deadline = performance\.now\(\) \+ 3_000/u);
|
|
3171
|
+
assert.match(ansiHelper, /sampledAt - stableSince >= stableMs/u);
|
|
3172
|
+
assert.match(ansi, /ansiExpectedDeliverySurfaces = Object\.freeze\(\["opentui", "web"\]\)/u);
|
|
3173
|
+
assert.match(ansi, /exactWebClients\.length !== 1/u);
|
|
3174
|
+
assert.match(ansi, /opentui: baseline\.clientId,\s*web: exactWebClients\[0\]\.clientId/u);
|
|
3175
|
+
assert.match(ansi, /semanticPaneId: baseline\.semanticPaneId/u);
|
|
3176
|
+
assert.match(ansi, /daemonProcessId: baseline\.rawIdentity\.daemonProcessId/u);
|
|
3177
|
+
assert.match(ansi, /daemonClockKind: "performance-now"/u);
|
|
3178
|
+
assert.match(ansi, /deliveryJoin\.exact/u);
|
|
3179
|
+
assert.match(ansi, /deliveryJoin\.enqueueCount - candidate\.enqueueCount/u);
|
|
3180
|
+
assert.match(ansi, /performance\.now\(\) - candidate\.startedAt >= 40/u);
|
|
3181
|
+
assert.match(ansi, /workloadFinalities: ansiBoot\.sustained\.workloadFinalities/u);
|
|
3182
|
+
assert.match(
|
|
3183
|
+
ansi,
|
|
3184
|
+
/const qualifiedPresentation = result\.raw\.presentation;[\s\S]*?ansiPresentationCounters = Object\.freeze\(\{\s*gridRowsReadTotal: qualifiedPresentation\.gridRowsReadTotal,\s*fullWalkTotal: qualifiedPresentation\.fullWalkTotal,\s*presentationCount: qualifiedPresentation\.presentationCount,/u,
|
|
3185
|
+
);
|
|
3186
|
+
assert.match(ansi, /operation: "ansi-idle-counter-continuity"/u);
|
|
3187
|
+
assert.match(ansi, /workloadFailure: timeoutObservation/u);
|
|
3188
|
+
assert.match(ansi, /captureAnsiCursorWebPresentation/u);
|
|
3189
|
+
assert.match(ansi, /__TMUX_IDE_ANSI_RENDITION_PROBE_ENABLED__/u);
|
|
3190
|
+
assert.match(ansi, /webStageVector/u);
|
|
3191
|
+
assert.match(ansi, /webFirstFailure/u);
|
|
3192
|
+
assert.match(ansi, /boundedWebCandidate/u);
|
|
3193
|
+
assert.match(ansi, /ansiBaselineCursorEvidenceStatus/u);
|
|
3194
|
+
assert.match(ansi, /ansiBaselinePreviousCounters/u);
|
|
3195
|
+
assert.match(ansi, /baselinePredecessor,/u);
|
|
3196
|
+
assert.doesNotMatch(ansi, /priorPresentation\?\.gridRowsReadTotal \?\? 0/u);
|
|
3197
|
+
assert.match(ansi, /ansiNativePaneLeaseStatus/u);
|
|
3198
|
+
assert.equal((ansi.match(/inspectAnsiNativeStage\(/gu) ?? []).length, 6);
|
|
3199
|
+
assert.match(ansi, /const preAlternate = await driveAnsiStage\(namespace, "b"/u);
|
|
3200
|
+
assert.match(ansi, /afterRevision: cursor\.latest\.stage\.revision/u);
|
|
3201
|
+
assert.match(ansi, /afterRevision: preAlternate\.stage\.revision/u);
|
|
3202
|
+
assert.match(
|
|
3203
|
+
ansi,
|
|
3204
|
+
/preAlternate\.stage\.presentationHmac === baseline\.stage\.presentationHmac/u,
|
|
3205
|
+
);
|
|
3206
|
+
assert.match(
|
|
3207
|
+
ansi,
|
|
3208
|
+
/result\.stage\.presentationHmac !== alternate\.preAlternate\.stage\.presentationHmac/u,
|
|
3209
|
+
);
|
|
3210
|
+
assert.match(ansi, /preAlternate: ansiBoot\.alternate\.preAlternate\.evidence/u);
|
|
3211
|
+
assert.match(ansi, /const lastCursorExpected = ansiBoot\.cursor\.expectedSamples\.at\(-1\)/u);
|
|
3212
|
+
assert.match(ansi, /predecessorRevision: lastCursorExpected\.presentation\.revision/u);
|
|
3213
|
+
assert.match(ansi, /predecessorStateHmac: lastCursorExpected\.presentation\.stateHmac/u);
|
|
3214
|
+
assert.match(ansi, /"-t", leaseStatus\.lease\.paneId/u);
|
|
3215
|
+
assert.doesNotMatch(ansi, /"-t",\s*(?:baseline|ansiBoot\.baseline)\.semanticPaneId/u);
|
|
3216
|
+
assert.match(ansi, /const semanticBody = ansiSemanticBodyProjection\(publication\.bodyRect\)/u);
|
|
3217
|
+
assert.equal((ansi.match(/\.\.\.semanticBody/gu) ?? []).length, 2);
|
|
3218
|
+
assert.doesNotMatch(ansi, /publication\.bodyRect\.(?:x|y|height)\b/u);
|
|
3219
|
+
assert.match(ansi, /operation: "ansi-normal-baseline"/u);
|
|
3220
|
+
assert.match(ansi, /stage: "cursor-evidence"/u);
|
|
3221
|
+
assert.match(ansi, /modes: modes\.slice\(0, 2\)/u);
|
|
3222
|
+
assert.match(ansi, /presentations: presentations\.slice\(0, 2\)/u);
|
|
3223
|
+
assert.match(ansi, /rendererEpoch: hostFrame\.rendererEpoch/u);
|
|
3224
|
+
assert.match(ansi, /daemonProcessId: `daemon:\$\{runningDaemon\.record\.pid\}`/u);
|
|
3225
|
+
assert.match(ansi, /daemonClockId: "node-performance-now"/u);
|
|
3226
|
+
assert.match(ansi, /seedIdentityExact:/u);
|
|
3227
|
+
assert.match(ansi, /\.\.\.status/u);
|
|
3228
|
+
assert.match(ansi, /firstFailedPredicate/u);
|
|
3229
|
+
assert.match(ansi, /webRestorationPredicates: Object\.freeze/u);
|
|
3230
|
+
assert.match(ansi, /webFirstFailedRestorationPredicate: new Set/u);
|
|
3231
|
+
assert.match(ansi, /positionWrappedHmacExact/u);
|
|
3232
|
+
assert.match(ansi, /domRowsHmacPresent/u);
|
|
3233
|
+
assert.match(ansi, /domCursorHmacPresent/u);
|
|
3234
|
+
assert.match(ansi, /domSemanticExact: candidate\?\.domSemanticExact === true/u);
|
|
3235
|
+
assert.match(ansi, /domRowCountExact: candidate\?\.domRowCountExact === true/u);
|
|
3236
|
+
assert.match(ansi, /domTextExact: candidate\?\.domTextExact === true/u);
|
|
3237
|
+
assert.match(ansi, /domStyleExact: candidate\?\.domStyleExact === true/u);
|
|
3238
|
+
assert.match(ansi, /domFirstMismatchComponent: new Set/u);
|
|
3239
|
+
assert.match(ansi, /domCursorExact: candidate\?\.domCursorExact === true/u);
|
|
3240
|
+
assert.match(ansi, /expectedRendition,/u);
|
|
3241
|
+
assert.match(ansi, /expectedCursor: Object\.freeze\(\{[\s\S]*?style: canonicalCursorStyle/u);
|
|
3242
|
+
assert.match(ansi, /"rowsHmac",\s*"cursorHmac"/u);
|
|
3243
|
+
assert.match(ansi, /JSON\.stringify\(qualifiedWebPresentation\(candidate, undefined\)\)/u);
|
|
3244
|
+
assert.match(ansi, /ansiResourceEpochIdentity === null/u);
|
|
3245
|
+
assert.match(ansi, /sample\.resourceEpochArmed !== true/u);
|
|
3246
|
+
assert.match(ansi, /ansiResourceEpochIdentityExact\(sample\.resourceEpochIdentity/u);
|
|
3247
|
+
assert.match(ansi, /"ansi-normal-baseline-resource-cap"/u);
|
|
3248
|
+
assert.match(ansi, /baselineResource \? "ansi-normal-baseline" : "ansi-sustained-workload"/u);
|
|
3249
|
+
assert.match(ansi, /rssBytes: sample\.rssBytes/u);
|
|
3250
|
+
assert.match(ansi, /rssPeakBytes: sample\.rssPeakBytes/u);
|
|
3251
|
+
assert.match(ansi, /daemonEvidence: latest\?\.daemonEvidence \?\? null/u);
|
|
3252
|
+
assert.match(ansi, /stageEvidence: latest\?\.stageEvidence \?\? null/u);
|
|
3253
|
+
assert.match(ansi, /ansiCursorStageFromRecords/u);
|
|
3254
|
+
assert.match(ansi, /ansiCursorAltScreenExpected: expected/u);
|
|
3255
|
+
assert.match(ansi, /assessAnsiCursorAltScreenEvidence\(journeyEvidence, expected\)/u);
|
|
3256
|
+
assert.doesNotMatch(ansi, /\btuiCommand\(state/u);
|
|
3257
|
+
assert.doesNotMatch(ansi, /\bexecFileSync\(/u);
|
|
3258
|
+
});
|
|
3259
|
+
|
|
3260
|
+
test("selection report seals strict causal distribution evidence in report and alignment", () => {
|
|
3261
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3262
|
+
const start = source.indexOf("async function diagnoseSelectionCopyAppMouse");
|
|
3263
|
+
const end = source.indexOf("async function diagnoseAnsiCursorAltScreen", start);
|
|
3264
|
+
const diagnose = source.slice(start, end);
|
|
3265
|
+
assert.ok(start > 0 && end > start);
|
|
3266
|
+
assert.match(diagnose, /const causal = assessProductSelectionCopyAppMouse/u);
|
|
3267
|
+
assert.equal((diagnose.match(/causalAssessment: causal/gu) ?? []).length, 2);
|
|
3268
|
+
assert.match(diagnose, /selectionCopyAppMouse: journeyEvidence/u);
|
|
3269
|
+
assert.match(diagnose, /firstBrokenBoundary: assessment\.firstBrokenBoundary/u);
|
|
3270
|
+
});
|
|
3271
|
+
|
|
3272
|
+
test("ANSI report seals its causal vector and independent HMAC contract in both JSON views", () => {
|
|
3273
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3274
|
+
const start = source.indexOf("async function diagnoseAnsiCursorAltScreen");
|
|
3275
|
+
const end = source.indexOf("function executeProductJourney", start);
|
|
3276
|
+
const diagnose = source.slice(start, end);
|
|
3277
|
+
assert.ok(start > 0 && end > start);
|
|
3278
|
+
assert.equal((diagnose.match(/causalAssessment: causal/gu) ?? []).length, 2);
|
|
3279
|
+
assert.equal((diagnose.match(/ansiCursorAltScreen: journeyEvidence/gu) ?? []).length, 2);
|
|
3280
|
+
assert.equal((diagnose.match(/ansiCursorAltScreenExpected: expected/gu) ?? []).length, 2);
|
|
3281
|
+
});
|
|
3282
|
+
|
|
3283
|
+
test("ANSI fixture reaches exact stable 132x41 geometry before daemon startup", () => {
|
|
3284
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3285
|
+
const start = source.indexOf('if (journeyId === "ansi-cursor-alt-screen")');
|
|
3286
|
+
const end = source.indexOf('if (journeyId === "', start + 10);
|
|
3287
|
+
const ansi = source.slice(start, end > start ? end : undefined);
|
|
3288
|
+
const cleanupToken = ansi.indexOf("const cleanupToken =");
|
|
3289
|
+
const runtimeNamespace = ansi.indexOf("const runtimeNamespace =");
|
|
3290
|
+
const ownership = ansi.indexOf("const tui = prepareOwnedTuiRuntime({");
|
|
3291
|
+
const condition = ansi.indexOf("await conditionAnsiTmuxFixture({");
|
|
3292
|
+
const ready = ansi.indexOf('event("ansi-namespace-ready"');
|
|
3293
|
+
const daemon = ansi.indexOf("startDaemon: async");
|
|
3294
|
+
assert.ok(
|
|
3295
|
+
cleanupToken > 0 &&
|
|
3296
|
+
runtimeNamespace > cleanupToken &&
|
|
3297
|
+
ownership > runtimeNamespace &&
|
|
3298
|
+
condition > ownership &&
|
|
3299
|
+
ready > condition &&
|
|
3300
|
+
daemon > ready,
|
|
3301
|
+
);
|
|
3302
|
+
assert.match(ansi, /paneId: initialPane\.paneId/u);
|
|
3303
|
+
assert.match(ansi, /socketPath: scratchFleet\.socketPath/u);
|
|
3304
|
+
assert.match(ansi, /ownership: \{ session, runtimeNamespace \}/u);
|
|
3305
|
+
assert.match(ansi, /resolveProvenance: sourceTraceProvenance/u);
|
|
3306
|
+
assert.match(ansi, /left: conditioned\.paneLeft/u);
|
|
3307
|
+
assert.match(ansi, /top: conditioned\.paneTop/u);
|
|
3308
|
+
assert.doesNotMatch(ansi, /geometry: Object\.freeze\(\{[\s\S]*?top: 0,[\s\S]*?\}\),/u);
|
|
3309
|
+
});
|
|
3310
|
+
|
|
3311
|
+
test("resize diagnostic correlation uses strict post-Web identity and never a sibling fallback", () => {
|
|
3312
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3313
|
+
const start = source.indexOf("function productDiagnosticCorrelation");
|
|
3314
|
+
const end = source.indexOf("const WARM_COHERENT_SAMPLE_COUNT", start);
|
|
3315
|
+
const correlation = source.slice(start, end);
|
|
3316
|
+
assert.ok(start > 0 && end > start);
|
|
3317
|
+
assert.match(
|
|
3318
|
+
correlation,
|
|
3319
|
+
/const keyboardPointerResize = state\?\.journeyEvidence\?\.keyboardPointerResize \?\? null/u,
|
|
3320
|
+
);
|
|
3321
|
+
assert.match(
|
|
3322
|
+
correlation,
|
|
3323
|
+
/keyboardPointerResize\.expected\?\.fleetSessionId[\s\S]*?keyboardPointerResize\.expected\?\.catalogRevision[\s\S]*?keyboardPointerResize\.expected\?\.semanticPaneId/u,
|
|
3324
|
+
);
|
|
3325
|
+
assert.doesNotMatch(correlation, /keyboardPointerResize\.keyboard\.workspaceClient/u);
|
|
3326
|
+
assert.doesNotMatch(correlation, /keyboardPointerResize\.pointerRelease\.workspaceClient/u);
|
|
3327
|
+
assert.match(correlation, /buildProductDiagnosticCorrelation\(\{[\s\S]*?state,/u);
|
|
3328
|
+
});
|
|
3329
|
+
|
|
3330
|
+
test("runtime qualification translates tmux resize geometry into application-content coordinates", () => {
|
|
3331
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3332
|
+
const start = source.indexOf("function activeVerticalResizeSeparator");
|
|
3333
|
+
const end = source.indexOf("\nfunction ", start + 10);
|
|
3334
|
+
const resizeSeparator = source.slice(start, end);
|
|
3335
|
+
|
|
3336
|
+
assert.match(resizeSeparator, /shellChromeLayout\(160, 44, 28\)/u);
|
|
3337
|
+
assert.match(resizeSeparator, /x: chrome\.main\.x \+ before\.left \+ before\.width/u);
|
|
3338
|
+
assert.match(resizeSeparator, /chrome\.main\.y \+\s*1 \+/u);
|
|
3339
|
+
});
|
|
3340
|
+
|
|
3341
|
+
test("runtime qualification binds active tmux geometry to canonical pane display identity", () => {
|
|
3342
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3343
|
+
const start = source.indexOf("function activeTmuxPane(state)");
|
|
3344
|
+
const end = source.indexOf("\nfunction ", start + 10);
|
|
3345
|
+
const activePane = source.slice(start, end);
|
|
3346
|
+
|
|
3347
|
+
assert.match(activePane, /sessionPaneGeometry\(state\)\.find/u);
|
|
3348
|
+
assert.match(activePane, /displayName: semantic\.displayName/u);
|
|
3349
|
+
assert.match(activePane, /canonicalDisplayNames: semantic\.canonicalDisplayNames/u);
|
|
3350
|
+
});
|
|
3351
|
+
|
|
3352
|
+
test("runtime qualification captures its own evidence instead of requiring a Card5 owner", () => {
|
|
3353
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3354
|
+
const start = source.indexOf("async function diagnoseRuntimeQualification");
|
|
3355
|
+
const captureStart = source.indexOf(
|
|
3356
|
+
'diagnosticAttemptPhases.set(planEntry.runId, "evidence-capture")',
|
|
3357
|
+
start,
|
|
3358
|
+
);
|
|
3359
|
+
const captureEnd = source.indexOf("diagnosticCaptures.set", captureStart);
|
|
3360
|
+
const qualification = source.slice(captureStart, captureEnd);
|
|
3361
|
+
|
|
3362
|
+
assert.ok(start > 0 && captureStart > start && captureEnd > captureStart);
|
|
3363
|
+
assert.match(qualification, /await captureArtifacts\(/u);
|
|
3364
|
+
assert.doesNotMatch(qualification, /state\.card5CaptureEvidence/u);
|
|
3365
|
+
});
|
|
3366
|
+
|
|
3367
|
+
test("selection diagnostic correlation uses its own post-Web identity and no sibling evidence", () => {
|
|
3368
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3369
|
+
const start = source.indexOf("function productDiagnosticCorrelation");
|
|
3370
|
+
const end = source.indexOf("const WARM_COHERENT_SAMPLE_COUNT", start);
|
|
3371
|
+
const correlation = source.slice(start, end);
|
|
3372
|
+
assert.match(
|
|
3373
|
+
correlation,
|
|
3374
|
+
/const selectionCopyAppMouse = state\?\.journeyEvidence\?\.selectionCopyAppMouse \?\? null/u,
|
|
3375
|
+
);
|
|
3376
|
+
assert.match(
|
|
3377
|
+
correlation,
|
|
3378
|
+
/selectionCopyAppMouse\.expected\?\.fleetSessionId[\s\S]*?selectionCopyAppMouse\.expected\?\.catalogRevision[\s\S]*?selectionCopyAppMouse\.expected\?\.semanticPaneId/u,
|
|
3379
|
+
);
|
|
3380
|
+
assert.doesNotMatch(correlation, /selectionCopyAppMouse\.selection\.workspaceClient/u);
|
|
3381
|
+
assert.doesNotMatch(correlation, /selectionCopyAppMouse\.copy\.workspaceClient/u);
|
|
3382
|
+
});
|
|
3383
|
+
|
|
3384
|
+
test("strict seed failure preserves bounded native and same-pane patch/frame/fence evidence", () => {
|
|
3385
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3386
|
+
const start = source.indexOf("async function provePreseededPanePublication");
|
|
3387
|
+
const end = source.indexOf("async function preserveWarmRehostFailure", start);
|
|
3388
|
+
const proof = source.slice(start, end);
|
|
3389
|
+
assert.ok(start > 0 && end > start);
|
|
3390
|
+
assert.match(proof, /runBoundedFocusTmux/u);
|
|
3391
|
+
assert.match(proof, /deadline: performance\.now\(\) \+ 500/u);
|
|
3392
|
+
assert.match(proof, /maxBuffer: 64 \* 1_024/u);
|
|
3393
|
+
assert.match(proof, /latestCanonicalPatch/u);
|
|
3394
|
+
assert.match(proof, /latestCanonicalFrame/u);
|
|
3395
|
+
assert.match(proof, /latestCanonicalFence/u);
|
|
3396
|
+
assert.match(proof, /targetGeometryExact/u);
|
|
3397
|
+
assert.match(proof, /canonicalGeometryExact/u);
|
|
3398
|
+
assert.match(proof, /viewportGeometryExact/u);
|
|
3399
|
+
assert.match(proof, /sourceEpochExact/u);
|
|
3400
|
+
assert.doesNotMatch(proof, /\.\.\.\(error\.observation/u);
|
|
3401
|
+
});
|
|
3402
|
+
|
|
3403
|
+
test("window owned actions use the exact live OpenTUI principal and preserve typed failures", () => {
|
|
3404
|
+
const source = readFileSync(new URL("./product-test-rig.mjs", import.meta.url), "utf8");
|
|
3405
|
+
const start = source.indexOf("async function dispatchOwnedProductAction");
|
|
3406
|
+
const end = source.indexOf("async function productApplicationShell", start);
|
|
3407
|
+
const dispatch = source.slice(start, end);
|
|
3408
|
+
assert.ok(start > 0 && end > start);
|
|
3409
|
+
assert.match(dispatch, /"X-Tmux-Ide-Host-Client-Id": hostClientId/u);
|
|
3410
|
+
assert.match(dispatch, /ownedWindowActionFailureObservation/u);
|
|
3411
|
+
assert.match(dispatch, /predicate: "action-result"|error\.observation/u);
|
|
3412
|
+
const windowOwner = source.slice(
|
|
3413
|
+
source.indexOf("createWindow: async"),
|
|
3414
|
+
source.indexOf("startWebAfterWindowLifecycle:", source.indexOf("createWindow: async")),
|
|
3415
|
+
);
|
|
3416
|
+
assert.equal(
|
|
3417
|
+
(windowOwner.match(/dispatchOwnedProductAction\([\s\S]*?baseline\.clientId,/gu) ?? []).length,
|
|
3418
|
+
2,
|
|
3419
|
+
);
|
|
3420
|
+
assert.match(windowOwner, /postFailure: Object\.freeze/u);
|
|
3421
|
+
assert.match(windowOwner, /applicationShellExact/u);
|
|
3422
|
+
assert.match(windowOwner, /tmuxPreActionStateExact/u);
|
|
3423
|
+
const renameOwner = windowOwner.slice(windowOwner.indexOf("renameWindow: async"));
|
|
3424
|
+
assert.match(renameOwner, /windowResourceAcknowledgementWatermark/u);
|
|
3425
|
+
assert.match(renameOwner, /exactTerminalResourceRevision: created\.terminalResourceRevision/u);
|
|
3426
|
+
assert.match(renameOwner, /acknowledgement: \{[\s\S]*?operationId,[\s\S]*?afterSequence:/u);
|
|
3427
|
+
assert.doesNotMatch(renameOwner, /receipt: \{[\s\S]*?operationKind: "workspace\.rename"/u);
|
|
3428
|
+
});
|
|
3429
|
+
|
|
3430
|
+
test("resource conditioning remains in peak and queue evidence but not memory slopes", () => {
|
|
3431
|
+
const stages = [
|
|
3432
|
+
...Array.from({ length: 8 }, (_, index) => ({
|
|
3433
|
+
traceId: `conditioning-${index}`,
|
|
3434
|
+
rssBytes: 900_000 + index * 10_000,
|
|
3435
|
+
heapUsedBytes: 800_000 + index * 10_000,
|
|
3436
|
+
inputPending: index === 3 ? 7 : 0,
|
|
3437
|
+
inputInFlight: index === 3 ? 3 : 0,
|
|
3438
|
+
inputPendingBytes: index === 3 ? 777 : 0,
|
|
3439
|
+
})),
|
|
3440
|
+
...Array.from({ length: 16 }, (_, index) => ({
|
|
3441
|
+
traceId: `endpoint-${index}`,
|
|
3442
|
+
rssBytes: 100_000 + index,
|
|
3443
|
+
heapUsedBytes: 50_000 + index,
|
|
3444
|
+
inputPending: 0,
|
|
3445
|
+
inputInFlight: 0,
|
|
3446
|
+
inputPendingBytes: 0,
|
|
3447
|
+
})),
|
|
3448
|
+
];
|
|
3449
|
+
const observation = summarizeProductResources(
|
|
3450
|
+
stages,
|
|
3451
|
+
[
|
|
3452
|
+
{
|
|
3453
|
+
queuePeak: 9,
|
|
3454
|
+
queueCapacity: 10,
|
|
3455
|
+
settledQueueDepth: 0,
|
|
3456
|
+
revisionLagPeak: 4,
|
|
3457
|
+
},
|
|
3458
|
+
],
|
|
3459
|
+
Array.from({ length: 16 }, (_, index) => `endpoint-${index}`),
|
|
3460
|
+
);
|
|
3461
|
+
assert.equal(observation.memorySampleCount, 16);
|
|
3462
|
+
assert.equal(observation.workloadMemorySampleCount, 24);
|
|
3463
|
+
assert.equal(observation.rssWorkloadPeakBytes, 970_000);
|
|
3464
|
+
assert.equal(observation.heapWorkloadPeakBytes, 870_000);
|
|
3465
|
+
assert.equal(observation.rssPeakBytes, 100_015);
|
|
3466
|
+
assert.equal(observation.heapPeakBytes, 50_015);
|
|
3467
|
+
assert.equal(observation.rssGrowthBytes, 15);
|
|
3468
|
+
assert.equal(observation.heapGrowthBytes, 15);
|
|
3469
|
+
assert.equal(observation.rssRobustSlopeBytesPerSample, 1);
|
|
3470
|
+
assert.equal(observation.heapRobustSlopeBytesPerSample, 1);
|
|
3471
|
+
assert.equal(observation.inputPendingPeak, 7);
|
|
3472
|
+
assert.equal(observation.inputInFlightPeak, 3);
|
|
3473
|
+
assert.equal(observation.inputPendingBytesPeak, 777);
|
|
3474
|
+
assert.equal(observation.settledInputPending, 0);
|
|
3475
|
+
assert.equal(observation.settledInputInFlight, 0);
|
|
3476
|
+
assert.equal(observation.deliveryQueuePeak, 9);
|
|
3477
|
+
assert.equal(observation.deliveryQueueCapacity, 10);
|
|
3478
|
+
assert.equal(observation.settledDeliveryQueueDepth, 0);
|
|
3479
|
+
assert.equal(observation.revisionLagPeak, 4);
|
|
3480
|
+
});
|
|
3481
|
+
|
|
3482
|
+
test("resource growth uses ordered quiescent endpoints, not a GC max-min range", () => {
|
|
3483
|
+
const clientStages = Array.from({ length: 16 }, (_, index) => ({
|
|
3484
|
+
traceId: `trace-${index}`,
|
|
3485
|
+
rssBytes: index === 8 ? 200_000 : 100_000 + index,
|
|
3486
|
+
heapUsedBytes: index < 8 ? 150_000 : 50_000 + index,
|
|
3487
|
+
inputPending: 0,
|
|
3488
|
+
inputInFlight: 0,
|
|
3489
|
+
inputPendingBytes: 0,
|
|
3490
|
+
}));
|
|
3491
|
+
const observation = summarizeProductResources(clientStages, []);
|
|
3492
|
+
assert.equal(observation.rssPeakBytes, 200_000);
|
|
3493
|
+
assert.equal(observation.rssGrowthBytes, 15);
|
|
3494
|
+
assert.equal(observation.heapPeakBytes, 150_000);
|
|
3495
|
+
assert.equal(observation.heapGrowthBytes, 0);
|
|
3496
|
+
});
|
|
3497
|
+
|
|
3498
|
+
test("diagnostic report names the first causal break and never passes unmeasured gates", () => {
|
|
3499
|
+
const report = buildProductDiagnosticReport({
|
|
3500
|
+
state: {
|
|
3501
|
+
status: "ready",
|
|
3502
|
+
daemon: { instanceId: "generation" },
|
|
3503
|
+
convergence: {
|
|
3504
|
+
restart: {
|
|
3505
|
+
elapsedMs: 100,
|
|
3506
|
+
webRecovered: true,
|
|
3507
|
+
tuiRecovered: true,
|
|
3508
|
+
hostedTuiInputPainted: true,
|
|
3509
|
+
},
|
|
3510
|
+
},
|
|
3511
|
+
},
|
|
3512
|
+
truth: { session: "alpha", windows: ["window"], panes: ["pane"] },
|
|
3513
|
+
lifecycle: [
|
|
3514
|
+
{ phase: "generation-connection-resolved", daemonGeneration: "generation", elapsedMs: 10 },
|
|
3515
|
+
{
|
|
3516
|
+
phase: "generation-shell-lifecycle",
|
|
3517
|
+
clientPhase: "live",
|
|
3518
|
+
shellStatus: "live",
|
|
3519
|
+
inventoryResources: 1,
|
|
3520
|
+
elapsedMs: 20,
|
|
3521
|
+
},
|
|
3522
|
+
{
|
|
3523
|
+
phase: "generation-runtime-progress",
|
|
3524
|
+
runtimePhase: "coherent",
|
|
3525
|
+
panes: 1,
|
|
3526
|
+
seededPanes: 1,
|
|
3527
|
+
elapsedMs: 30,
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
phase: "generation-status",
|
|
3531
|
+
status: "live",
|
|
3532
|
+
daemonGeneration: "generation",
|
|
3533
|
+
elapsedMs: 31,
|
|
3534
|
+
},
|
|
3535
|
+
],
|
|
3536
|
+
traceRecords: [],
|
|
3537
|
+
stderr: "",
|
|
3538
|
+
framebufferEvidence: { passed: true, detail: "1/1 visible pane bodies matched" },
|
|
3539
|
+
});
|
|
3540
|
+
assert.equal(report.status, "failed");
|
|
3541
|
+
assert.equal(report.firstBrokenBoundary, "tui-painted-frame");
|
|
3542
|
+
assert.equal(report.firstUnmeasuredBoundary, "reference-trace-integrity");
|
|
3543
|
+
assert.deepEqual(report.framebufferEvidence, {
|
|
3544
|
+
passed: true,
|
|
3545
|
+
detail: "1/1 visible pane bodies matched",
|
|
3546
|
+
});
|
|
3547
|
+
});
|
|
3548
|
+
|
|
3549
|
+
test("state artifacts are atomic and public status redacts browser authority", () => {
|
|
3550
|
+
const root = mkdtempSync(join(tmpdir(), "tmi-product-rig-test-"));
|
|
3551
|
+
try {
|
|
3552
|
+
const path = join(root, "state.json");
|
|
3553
|
+
writeJsonAtomic(path, {
|
|
3554
|
+
version: PRODUCT_RIG_STATE_VERSION,
|
|
3555
|
+
status: "ready",
|
|
3556
|
+
ownerPid: process.pid,
|
|
3557
|
+
runtimeNamespace: { tmuxSocketPath: "/tmp/test.sock" },
|
|
3558
|
+
web: { pageUrl: "http://127.0.0.1:5173/?devHost=1", browserWsEndpoint: "secret" },
|
|
3559
|
+
daemon: { pid: process.pid, port: 1234, instanceId: "generation", authToken: "secret" },
|
|
3560
|
+
});
|
|
3561
|
+
assert.equal(readJson(path).status, "ready");
|
|
3562
|
+
const publicStatus = publicRigStatus(readJson(path));
|
|
3563
|
+
assert.equal(publicStatus.running, true);
|
|
3564
|
+
assert.equal("browserWsEndpoint" in publicStatus.web, false);
|
|
3565
|
+
assert.equal("authToken" in publicStatus.daemon, false);
|
|
3566
|
+
assert.doesNotMatch(readFileSync(path, "utf8"), /\.tmp/u);
|
|
3567
|
+
} finally {
|
|
3568
|
+
rmSync(root, { recursive: true, force: true });
|
|
3569
|
+
}
|
|
3570
|
+
});
|
|
3571
|
+
|
|
3572
|
+
test("architecture inventory emits grouped, machine-readable deletion reports", () => {
|
|
3573
|
+
const repo = new URL("../", import.meta.url).pathname;
|
|
3574
|
+
const report = sourceArchitectureInventory(repo);
|
|
3575
|
+
assert.equal(report.version, 1);
|
|
3576
|
+
assert.equal("generatedAt" in report, false);
|
|
3577
|
+
assert.deepEqual(Object.keys(report.groups).sort(), [
|
|
3578
|
+
"direct-tmux",
|
|
3579
|
+
"grouped-pty",
|
|
3580
|
+
"v1-catalog",
|
|
3581
|
+
"v1-default-authority",
|
|
3582
|
+
"v1-standalone-authority",
|
|
3583
|
+
]);
|
|
3584
|
+
for (const group of Object.values(report.groups)) {
|
|
3585
|
+
assert.equal(group.remainingUseCount, group.entries.length);
|
|
3586
|
+
assert.equal(group.remainingFileCount, group.uses.length);
|
|
3587
|
+
assert.equal(group.zeroUse, group.remainingUseCount === 0);
|
|
3588
|
+
assert.deepEqual(
|
|
3589
|
+
[...group.uses].sort((left, right) => left.localeCompare(right)),
|
|
3590
|
+
group.uses,
|
|
3591
|
+
);
|
|
3592
|
+
for (const entry of group.entries) {
|
|
3593
|
+
assert.ok(entry.line > 0);
|
|
3594
|
+
assert.ok(group.uses.includes(entry.file));
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
});
|
|
3598
|
+
|
|
3599
|
+
test("architecture debt cannot grow beyond the checked-in deletion budget", () => {
|
|
3600
|
+
const repo = new URL("../", import.meta.url).pathname;
|
|
3601
|
+
const report = sourceArchitectureInventory(repo);
|
|
3602
|
+
const budget = JSON.parse(
|
|
3603
|
+
readFileSync(new URL("./architecture-debt-budget.json", import.meta.url), "utf8"),
|
|
3604
|
+
);
|
|
3605
|
+
assert.equal(budget.version, 1);
|
|
3606
|
+
for (const [name, groupBudget] of Object.entries(budget.groups)) {
|
|
3607
|
+
const group = report.groups[name];
|
|
3608
|
+
assert.ok(group, `missing inventory group ${name}`);
|
|
3609
|
+
assert.ok(
|
|
3610
|
+
group.remainingUseCount <= groupBudget.maximumUses,
|
|
3611
|
+
`${name} grew from budget ${groupBudget.maximumUses} to ${group.remainingUseCount}`,
|
|
3612
|
+
);
|
|
3613
|
+
assert.equal(groupBudget.targetUses, 0, `${name} must retain an explicit zero-use target`);
|
|
3614
|
+
}
|
|
3615
|
+
});
|
|
3616
|
+
|
|
3617
|
+
test("checked-in product baseline is honest and safe to inventory", () => {
|
|
3618
|
+
const baseline = JSON.parse(
|
|
3619
|
+
readFileSync(new URL("../docs/product/product-baseline.json", import.meta.url), "utf8"),
|
|
3620
|
+
);
|
|
3621
|
+
assert.equal(baseline.qualification, "not-product-qualified");
|
|
3622
|
+
assert.deepEqual(baseline.defaultProduct.primarySurfaces, ["home", "terminals"]);
|
|
3623
|
+
assert.deepEqual(baseline.defaultProduct.quarantinedSurfaces, [
|
|
3624
|
+
"files",
|
|
3625
|
+
"changes",
|
|
3626
|
+
"missions",
|
|
3627
|
+
"activity",
|
|
3628
|
+
]);
|
|
3629
|
+
assert.equal(baseline.portablePerformance.status, "passed-with-limitations");
|
|
3630
|
+
assert.equal(baseline.portablePerformance.coherentTerminalFrame, "not-measured");
|
|
3631
|
+
assert.equal(baseline.portablePerformance.inputToPaint, "not-measured");
|
|
3632
|
+
assert.ok(baseline.knownDefects.every((defect) => defect.reproduce.length > 0));
|
|
3633
|
+
assert.match(baseline.completionPolicy, /not Done/u);
|
|
3634
|
+
});
|