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,2359 @@
|
|
|
1
|
+
import {
|
|
2
|
+
closeSync,
|
|
3
|
+
existsSync,
|
|
4
|
+
fstatSync,
|
|
5
|
+
openSync,
|
|
6
|
+
readFileSync,
|
|
7
|
+
readSync,
|
|
8
|
+
renameSync,
|
|
9
|
+
statSync,
|
|
10
|
+
writeFileSync,
|
|
11
|
+
} from "node:fs";
|
|
12
|
+
import { createHash, createHmac } from "node:crypto";
|
|
13
|
+
|
|
14
|
+
import { theilSenSlope } from "./lib/performance-reference-report.mjs";
|
|
15
|
+
|
|
16
|
+
export const PRODUCT_RIG_STATE_VERSION = 1;
|
|
17
|
+
/**
|
|
18
|
+
* Source provenance is evidence, not an unbounded in-memory archive. The rig
|
|
19
|
+
* accepts deliberately large native/binary worktrees, but refuses a patch so
|
|
20
|
+
* large that one diagnostic launch could exhaust the owner process.
|
|
21
|
+
*/
|
|
22
|
+
export const PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES = 8 * 1024 * 1024;
|
|
23
|
+
export const PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES = 16 * 1024 * 1024;
|
|
24
|
+
export const PRODUCT_RIG_SOURCE_MANIFEST_HASH_CHUNK_BYTES = 64 * 1024;
|
|
25
|
+
export const PRODUCT_RIG_SOURCE_INVENTORY_MAX_BYTES = 1024 * 1024;
|
|
26
|
+
export const PRODUCT_RIG_SOURCE_INVENTORY_MAX_PATHS = 10_000;
|
|
27
|
+
export const PRODUCT_RIG_SOURCE_PATH_MAX_BYTES = 4_096;
|
|
28
|
+
export const PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS = Object.freeze({
|
|
29
|
+
eventCount: 50,
|
|
30
|
+
fieldCount: 2_000,
|
|
31
|
+
fieldNameChars: 128,
|
|
32
|
+
textChars: 4_000,
|
|
33
|
+
processOutputChars: 16_384,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const PRODUCT_JSONL_TAIL_MAX_RECORD_BYTES = 64 * 1024;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Owner-scoped, cumulative JSONL tail. Each source byte and record is decoded
|
|
40
|
+
* once; a poll admits bounded new work while preserving the exact ordered
|
|
41
|
+
* prefix expected by existing evidence qualifiers.
|
|
42
|
+
*/
|
|
43
|
+
export function createProductJsonlTailReader(
|
|
44
|
+
path,
|
|
45
|
+
{ maxBytesPerPoll = 64 * 1024, maxRecordsPerPoll = 512, recordKind = "trace" } = {},
|
|
46
|
+
) {
|
|
47
|
+
if (
|
|
48
|
+
typeof path !== "string" ||
|
|
49
|
+
path.length === 0 ||
|
|
50
|
+
!Number.isSafeInteger(maxBytesPerPoll) ||
|
|
51
|
+
maxBytesPerPoll < 1 ||
|
|
52
|
+
maxBytesPerPoll > 1024 * 1024 ||
|
|
53
|
+
!Number.isSafeInteger(maxRecordsPerPoll) ||
|
|
54
|
+
maxRecordsPerPoll < 1 ||
|
|
55
|
+
maxRecordsPerPoll > 2_048 ||
|
|
56
|
+
!new Set(["trace", "lifecycle"]).has(recordKind)
|
|
57
|
+
)
|
|
58
|
+
throw new TypeError("invalid JSONL tail reader options");
|
|
59
|
+
let descriptor = null;
|
|
60
|
+
let device = null;
|
|
61
|
+
let inode = null;
|
|
62
|
+
let offset = 0;
|
|
63
|
+
let carry = Buffer.alloc(0);
|
|
64
|
+
let closed = false;
|
|
65
|
+
let observedSize = 0;
|
|
66
|
+
let retainedRecordBytes = 0;
|
|
67
|
+
let invalidReason = null;
|
|
68
|
+
const records = [];
|
|
69
|
+
const recordsView = new Proxy(records, {
|
|
70
|
+
set: () => fail("records-mutation"),
|
|
71
|
+
deleteProperty: () => fail("records-mutation"),
|
|
72
|
+
defineProperty: () => fail("records-mutation"),
|
|
73
|
+
});
|
|
74
|
+
const marks = new WeakSet();
|
|
75
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
76
|
+
const deepFreezeRecord = (value) => {
|
|
77
|
+
const pending = [value];
|
|
78
|
+
const seen = new WeakSet();
|
|
79
|
+
while (pending.length > 0) {
|
|
80
|
+
const current = pending.pop();
|
|
81
|
+
if (current === null || typeof current !== "object" || seen.has(current)) continue;
|
|
82
|
+
seen.add(current);
|
|
83
|
+
for (const child of Object.values(current)) pending.push(child);
|
|
84
|
+
Object.freeze(current);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
};
|
|
88
|
+
const fail = (reason) => {
|
|
89
|
+
invalidReason ??= reason;
|
|
90
|
+
const error = new Error(`JSONL tail integrity failure: ${invalidReason}`);
|
|
91
|
+
error.code = "PRODUCT_JSONL_TAIL_INVALID";
|
|
92
|
+
error.reason = invalidReason;
|
|
93
|
+
throw error;
|
|
94
|
+
};
|
|
95
|
+
const open = () => {
|
|
96
|
+
if (descriptor !== null) return true;
|
|
97
|
+
if (!existsSync(path)) return false;
|
|
98
|
+
descriptor = openSync(path, "r");
|
|
99
|
+
const metadata = fstatSync(descriptor);
|
|
100
|
+
if (!metadata.isFile()) fail("not-file");
|
|
101
|
+
device = metadata.dev;
|
|
102
|
+
inode = metadata.ino;
|
|
103
|
+
return true;
|
|
104
|
+
};
|
|
105
|
+
const parseCompleteLines = (staged, recordBudget) => {
|
|
106
|
+
let parsed = 0;
|
|
107
|
+
while (parsed < recordBudget) {
|
|
108
|
+
const newline = staged.carry.indexOf(0x0a);
|
|
109
|
+
if (newline < 0) break;
|
|
110
|
+
const raw = staged.carry.subarray(0, newline);
|
|
111
|
+
staged.carry = staged.carry.subarray(newline + 1);
|
|
112
|
+
const line = raw.length > 0 && raw.at(-1) === 0x0d ? raw.subarray(0, -1) : raw;
|
|
113
|
+
if (line.length === 0) fail("empty-line");
|
|
114
|
+
if (line.length > PRODUCT_JSONL_TAIL_MAX_RECORD_BYTES) fail("record-too-large");
|
|
115
|
+
if (
|
|
116
|
+
records.length + staged.records.length >= 8_192 ||
|
|
117
|
+
retainedRecordBytes + staged.retainedRecordBytes + line.length > 16 * 1024 * 1024
|
|
118
|
+
)
|
|
119
|
+
fail("history-cap");
|
|
120
|
+
let value;
|
|
121
|
+
try {
|
|
122
|
+
value = JSON.parse(decoder.decode(line));
|
|
123
|
+
} catch {
|
|
124
|
+
fail("malformed-record");
|
|
125
|
+
}
|
|
126
|
+
const object = value !== null && typeof value === "object" && !Array.isArray(value);
|
|
127
|
+
const shapeExact =
|
|
128
|
+
object &&
|
|
129
|
+
(recordKind === "trace"
|
|
130
|
+
? value.version === 1 &&
|
|
131
|
+
typeof value.type === "string" &&
|
|
132
|
+
value.type.length > 0 &&
|
|
133
|
+
value.type.length <= 128
|
|
134
|
+
: typeof value.phase === "string" && value.phase.length > 0 && value.phase.length <= 128);
|
|
135
|
+
if (!shapeExact) fail("record-shape");
|
|
136
|
+
staged.records.push(deepFreezeRecord(value));
|
|
137
|
+
staged.retainedRecordBytes += line.length;
|
|
138
|
+
parsed += 1;
|
|
139
|
+
}
|
|
140
|
+
return parsed;
|
|
141
|
+
};
|
|
142
|
+
return Object.freeze({
|
|
143
|
+
read() {
|
|
144
|
+
if (invalidReason !== null) fail(invalidReason);
|
|
145
|
+
if (closed) fail("closed");
|
|
146
|
+
if (!open()) return recordsView;
|
|
147
|
+
let pathMetadata;
|
|
148
|
+
try {
|
|
149
|
+
pathMetadata = statSync(path);
|
|
150
|
+
} catch {
|
|
151
|
+
fail("missing");
|
|
152
|
+
}
|
|
153
|
+
if (!pathMetadata.isFile()) fail("not-file");
|
|
154
|
+
const descriptorMetadata = fstatSync(descriptor);
|
|
155
|
+
if (
|
|
156
|
+
pathMetadata.dev !== device ||
|
|
157
|
+
pathMetadata.ino !== inode ||
|
|
158
|
+
descriptorMetadata.dev !== device ||
|
|
159
|
+
descriptorMetadata.ino !== inode
|
|
160
|
+
)
|
|
161
|
+
fail("replaced");
|
|
162
|
+
if (pathMetadata.size < offset) fail("truncated");
|
|
163
|
+
const staged = {
|
|
164
|
+
offset,
|
|
165
|
+
carry,
|
|
166
|
+
records: [],
|
|
167
|
+
retainedRecordBytes: 0,
|
|
168
|
+
};
|
|
169
|
+
let byteBudget = maxBytesPerPoll;
|
|
170
|
+
let recordBudget = maxRecordsPerPoll;
|
|
171
|
+
recordBudget -= parseCompleteLines(staged, recordBudget);
|
|
172
|
+
while (byteBudget > 0 && recordBudget > 0 && staged.offset < pathMetadata.size) {
|
|
173
|
+
const length = Math.min(64 * 1024, byteBudget, pathMetadata.size - staged.offset);
|
|
174
|
+
const chunk = Buffer.allocUnsafe(length);
|
|
175
|
+
const bytesRead = readSync(descriptor, chunk, 0, length, staged.offset);
|
|
176
|
+
if (bytesRead <= 0) fail("short-read");
|
|
177
|
+
staged.offset += bytesRead;
|
|
178
|
+
byteBudget -= bytesRead;
|
|
179
|
+
staged.carry =
|
|
180
|
+
staged.carry.length === 0
|
|
181
|
+
? chunk.subarray(0, bytesRead)
|
|
182
|
+
: Buffer.concat([staged.carry, chunk.subarray(0, bytesRead)]);
|
|
183
|
+
recordBudget -= parseCompleteLines(staged, recordBudget);
|
|
184
|
+
if (staged.carry.length > PRODUCT_JSONL_TAIL_MAX_RECORD_BYTES) fail("record-too-large");
|
|
185
|
+
}
|
|
186
|
+
offset = staged.offset;
|
|
187
|
+
carry = staged.carry;
|
|
188
|
+
records.push(...staged.records);
|
|
189
|
+
retainedRecordBytes += staged.retainedRecordBytes;
|
|
190
|
+
observedSize = pathMetadata.size;
|
|
191
|
+
return recordsView;
|
|
192
|
+
},
|
|
193
|
+
snapshot() {
|
|
194
|
+
if (invalidReason !== null) fail(invalidReason);
|
|
195
|
+
return Object.freeze({
|
|
196
|
+
offset,
|
|
197
|
+
recordCount: records.length,
|
|
198
|
+
retainedRecordBytes,
|
|
199
|
+
partialBytes: carry.length,
|
|
200
|
+
caughtUp: offset === observedSize && carry.length === 0,
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
confirmCaughtUp() {
|
|
204
|
+
if (invalidReason !== null) fail(invalidReason);
|
|
205
|
+
if (closed) fail("closed");
|
|
206
|
+
if (!open()) fail("missing");
|
|
207
|
+
let pathMetadata;
|
|
208
|
+
try {
|
|
209
|
+
pathMetadata = statSync(path);
|
|
210
|
+
} catch {
|
|
211
|
+
fail("missing");
|
|
212
|
+
}
|
|
213
|
+
const descriptorMetadata = fstatSync(descriptor);
|
|
214
|
+
if (
|
|
215
|
+
!pathMetadata.isFile() ||
|
|
216
|
+
pathMetadata.dev !== device ||
|
|
217
|
+
pathMetadata.ino !== inode ||
|
|
218
|
+
descriptorMetadata.dev !== device ||
|
|
219
|
+
descriptorMetadata.ino !== inode
|
|
220
|
+
)
|
|
221
|
+
fail("replaced");
|
|
222
|
+
if (pathMetadata.size < offset || descriptorMetadata.size < offset) fail("truncated");
|
|
223
|
+
observedSize = Math.max(pathMetadata.size, descriptorMetadata.size);
|
|
224
|
+
return (
|
|
225
|
+
carry.length === 0 && pathMetadata.size === offset && descriptorMetadata.size === offset
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
mark() {
|
|
229
|
+
if (invalidReason !== null) fail(invalidReason);
|
|
230
|
+
if (closed) fail("closed");
|
|
231
|
+
if (offset !== observedSize || carry.length !== 0) fail("mark-not-caught-up");
|
|
232
|
+
const mark = Object.freeze({ recordCount: records.length });
|
|
233
|
+
marks.add(mark);
|
|
234
|
+
return mark;
|
|
235
|
+
},
|
|
236
|
+
recordsSince(mark) {
|
|
237
|
+
if (invalidReason !== null) fail(invalidReason);
|
|
238
|
+
if (closed) fail("closed");
|
|
239
|
+
if (!marks.has(mark)) fail("foreign-mark");
|
|
240
|
+
return Object.freeze(records.slice(mark.recordCount));
|
|
241
|
+
},
|
|
242
|
+
recordsThrough(mark) {
|
|
243
|
+
if (invalidReason !== null) fail(invalidReason);
|
|
244
|
+
if (closed) fail("closed");
|
|
245
|
+
if (!marks.has(mark)) fail("foreign-mark");
|
|
246
|
+
return Object.freeze(records.slice(0, mark.recordCount));
|
|
247
|
+
},
|
|
248
|
+
close() {
|
|
249
|
+
if (closed) return;
|
|
250
|
+
closed = true;
|
|
251
|
+
if (descriptor !== null) closeSync(descriptor);
|
|
252
|
+
descriptor = null;
|
|
253
|
+
carry = Buffer.alloc(0);
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** Bounded, fail-closed Card5 projection of daemon pane-stream lifecycle spans. */
|
|
259
|
+
export async function projectProductPaneStreamLifecycle(
|
|
260
|
+
path,
|
|
261
|
+
evidenceKey,
|
|
262
|
+
{
|
|
263
|
+
maxEvents = 64,
|
|
264
|
+
readerFactory = createProductJsonlTailReader,
|
|
265
|
+
yieldTurn = () => new Promise((resolve) => setImmediate(resolve)),
|
|
266
|
+
signal = null,
|
|
267
|
+
} = {},
|
|
268
|
+
) {
|
|
269
|
+
const unavailable = (reason) =>
|
|
270
|
+
Object.freeze({
|
|
271
|
+
available: false,
|
|
272
|
+
reason,
|
|
273
|
+
count: 0,
|
|
274
|
+
overflow: 0,
|
|
275
|
+
events: Object.freeze([]),
|
|
276
|
+
});
|
|
277
|
+
if (
|
|
278
|
+
typeof path !== "string" ||
|
|
279
|
+
path.length === 0 ||
|
|
280
|
+
!/^[0-9a-f]{64}$/u.test(evidenceKey ?? "") ||
|
|
281
|
+
!Number.isSafeInteger(maxEvents) ||
|
|
282
|
+
maxEvents < 1 ||
|
|
283
|
+
maxEvents > 64 ||
|
|
284
|
+
typeof readerFactory !== "function" ||
|
|
285
|
+
typeof yieldTurn !== "function" ||
|
|
286
|
+
(signal !== null && typeof signal?.aborted !== "boolean")
|
|
287
|
+
)
|
|
288
|
+
return unavailable("identity-unavailable");
|
|
289
|
+
const reader = readerFactory(path, {
|
|
290
|
+
maxBytesPerPoll: 64 * 1024,
|
|
291
|
+
maxRecordsPerPoll: 512,
|
|
292
|
+
recordKind: "trace",
|
|
293
|
+
});
|
|
294
|
+
let records;
|
|
295
|
+
let sealedStableEof = false;
|
|
296
|
+
try {
|
|
297
|
+
let priorOffset = -1;
|
|
298
|
+
let stableEofSamples = 0;
|
|
299
|
+
let stableEofCandidate = null;
|
|
300
|
+
for (let turn = 0; turn < 256; turn += 1) {
|
|
301
|
+
if (signal?.aborted) return unavailable("read-aborted");
|
|
302
|
+
records = reader.read();
|
|
303
|
+
const snapshot = reader.snapshot();
|
|
304
|
+
if (signal?.aborted) return unavailable("read-aborted");
|
|
305
|
+
if (snapshot.caughtUp && reader.confirmCaughtUp()) {
|
|
306
|
+
const candidate = `${snapshot.offset}:${snapshot.recordCount}:${snapshot.retainedRecordBytes}`;
|
|
307
|
+
if (candidate === stableEofCandidate) stableEofSamples += 1;
|
|
308
|
+
else {
|
|
309
|
+
stableEofCandidate = candidate;
|
|
310
|
+
stableEofSamples = 1;
|
|
311
|
+
}
|
|
312
|
+
if (stableEofSamples >= 2) {
|
|
313
|
+
sealedStableEof = true;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
await yieldTurn();
|
|
317
|
+
if (signal?.aborted) return unavailable("read-aborted");
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
stableEofSamples = 0;
|
|
321
|
+
stableEofCandidate = null;
|
|
322
|
+
if (snapshot.offset === priorOffset)
|
|
323
|
+
return unavailable(snapshot.partialBytes > 0 ? "partial-record" : "reader-stalled");
|
|
324
|
+
priorOffset = snapshot.offset;
|
|
325
|
+
}
|
|
326
|
+
if (!sealedStableEof) return unavailable("reader-budget-exhausted");
|
|
327
|
+
} catch (error) {
|
|
328
|
+
const reason =
|
|
329
|
+
error?.code === "PRODUCT_JSONL_TAIL_INVALID" &&
|
|
330
|
+
typeof error.reason === "string" &&
|
|
331
|
+
/^[a-z][a-z0-9-]{0,63}$/u.test(error.reason)
|
|
332
|
+
? error.reason
|
|
333
|
+
: "read-failed";
|
|
334
|
+
return unavailable(reason);
|
|
335
|
+
} finally {
|
|
336
|
+
reader.close();
|
|
337
|
+
}
|
|
338
|
+
const stageByOperation = new Map([
|
|
339
|
+
["pane-stream-server-ready", "server-ready"],
|
|
340
|
+
["pane-stream-layout-staged", "layout-staged"],
|
|
341
|
+
["pane-stream-layout-validated", "layout-validated"],
|
|
342
|
+
["pane-stream-delivery-open", "delivery-open"],
|
|
343
|
+
["pane-stream-first-seed", "first-seed"],
|
|
344
|
+
["pane-stream-terminal", "terminal"],
|
|
345
|
+
]);
|
|
346
|
+
const all = records.filter(
|
|
347
|
+
(record) =>
|
|
348
|
+
stageByOperation.has(record?.operation) &&
|
|
349
|
+
typeof record?.traceId === "string" &&
|
|
350
|
+
typeof record?.authority?.generation === "string",
|
|
351
|
+
);
|
|
352
|
+
if (all.length === 0) return unavailable("no-matching-events");
|
|
353
|
+
const retained = all.slice(-maxEvents).map((record, index) => {
|
|
354
|
+
const terminal = record.operation === "pane-stream-terminal";
|
|
355
|
+
const closeCode = record?.terminalDelivery?.paneStreamCloseCode;
|
|
356
|
+
const closeReason = record?.terminalDelivery?.paneStreamCloseReason;
|
|
357
|
+
const hmac = (domain, value) =>
|
|
358
|
+
createHmac("sha256", Buffer.from(evidenceKey, "hex"))
|
|
359
|
+
.update(`${domain}\0${value}`)
|
|
360
|
+
.digest("hex");
|
|
361
|
+
return Object.freeze({
|
|
362
|
+
ordinal: all.length - retainedLength(all, maxEvents) + index,
|
|
363
|
+
stage: stageByOperation.get(record.operation),
|
|
364
|
+
requestHmac: hmac("request", record.traceId),
|
|
365
|
+
generationHmac: hmac("generation", record.authority.generation),
|
|
366
|
+
closeCode:
|
|
367
|
+
terminal && Number.isSafeInteger(closeCode) && closeCode >= 1000 && closeCode <= 4999
|
|
368
|
+
? closeCode
|
|
369
|
+
: null,
|
|
370
|
+
closeReason:
|
|
371
|
+
terminal && typeof closeReason === "string" && /^[a-z][a-z0-9-]{0,63}$/u.test(closeReason)
|
|
372
|
+
? closeReason
|
|
373
|
+
: terminal
|
|
374
|
+
? "unknown"
|
|
375
|
+
: "none",
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
return Object.freeze({
|
|
379
|
+
available: true,
|
|
380
|
+
reason: "available",
|
|
381
|
+
count: Math.min(all.length, 0xffff_ffff),
|
|
382
|
+
overflow: Math.max(0, all.length - retained.length),
|
|
383
|
+
events: Object.freeze(retained),
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function retainedLength(records, maxEvents) {
|
|
388
|
+
return Math.min(records.length, maxEvents);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const SECRET_KEY = /(?:authorization|bearer|capability|cookie|password|secret|token)/iu;
|
|
392
|
+
const SECRET_QUERY =
|
|
393
|
+
/([?&](?:__tmux_ide_dev_host_session|[^=&]*(?:authorization|capability|credential|password|secret|token)[^=&]*)=)[^&#]*/giu;
|
|
394
|
+
const BEARER_VALUE = /\bBearer\s+[^\s,;]+/giu;
|
|
395
|
+
|
|
396
|
+
export function appendBoundedWebDiagnostic(entries, entry, { secrets = [] } = {}) {
|
|
397
|
+
entries.push(sanitizeWebDiagnosticValue(entry, secrets));
|
|
398
|
+
if (entries.length > PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.eventCount) entries.shift();
|
|
399
|
+
return entries;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export function shouldCaptureWebConsoleMessage(type, message) {
|
|
403
|
+
return (
|
|
404
|
+
["warning", "error"].includes(type) ||
|
|
405
|
+
String(message).includes("[tmux-ide] development web host active")
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** Remove browser authority from evidence before it is serialized. */
|
|
410
|
+
export function redactWebDiagnosticText(value, secrets = []) {
|
|
411
|
+
let text = String(value ?? "");
|
|
412
|
+
for (const secret of secrets) {
|
|
413
|
+
if (typeof secret === "string" && secret.length > 0)
|
|
414
|
+
text = text.split(secret).join("[REDACTED]");
|
|
415
|
+
}
|
|
416
|
+
return text
|
|
417
|
+
.replace(BEARER_VALUE, "Bearer [REDACTED]")
|
|
418
|
+
.replace(SECRET_QUERY, "$1[REDACTED]")
|
|
419
|
+
.replace(
|
|
420
|
+
/((?:authorization|capability|password|secret|token)\s*[:=]\s*)[^\s,;"'}]+/giu,
|
|
421
|
+
"$1[REDACTED]",
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function boundedWebDiagnosticValue(
|
|
426
|
+
value,
|
|
427
|
+
secrets,
|
|
428
|
+
depth = 0,
|
|
429
|
+
budget = { remaining: PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.fieldCount },
|
|
430
|
+
) {
|
|
431
|
+
const { eventCount, fieldNameChars, textChars } = PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS;
|
|
432
|
+
if (budget.remaining <= 0) return "[FIELD-LIMIT]";
|
|
433
|
+
budget.remaining -= 1;
|
|
434
|
+
if (depth > 24) return "[DEPTH-LIMIT]";
|
|
435
|
+
if (typeof value === "string") return redactWebDiagnosticText(value, secrets).slice(0, textChars);
|
|
436
|
+
if (value === null || typeof value === "number" || typeof value === "boolean") return value;
|
|
437
|
+
if (Array.isArray(value)) {
|
|
438
|
+
return value
|
|
439
|
+
.slice(-eventCount)
|
|
440
|
+
.map((entry) => boundedWebDiagnosticValue(entry, secrets, depth + 1, budget));
|
|
441
|
+
}
|
|
442
|
+
if (typeof value !== "object") return String(value).slice(0, textChars);
|
|
443
|
+
const result = {};
|
|
444
|
+
let fields = 0;
|
|
445
|
+
for (const rawKey in value) {
|
|
446
|
+
if (!Object.hasOwn(value, rawKey)) continue;
|
|
447
|
+
if (fields >= eventCount) break;
|
|
448
|
+
fields += 1;
|
|
449
|
+
const key = rawKey.slice(0, fieldNameChars);
|
|
450
|
+
if (SECRET_KEY.test(rawKey)) {
|
|
451
|
+
result[key] = "[REDACTED]";
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
try {
|
|
455
|
+
result[key] = boundedWebDiagnosticValue(value[rawKey], secrets, depth + 1, budget);
|
|
456
|
+
} catch (error) {
|
|
457
|
+
result[key] = redactWebDiagnosticText(
|
|
458
|
+
error instanceof Error ? error.message : String(error),
|
|
459
|
+
secrets,
|
|
460
|
+
).slice(0, textChars);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return result;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export function sanitizeWebDiagnosticValue(value, secrets = []) {
|
|
467
|
+
return boundedWebDiagnosticValue(value, secrets);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export async function awaitWebDiagnosticWithDeadline(promise, { timeoutMs = 3_000, onFailure }) {
|
|
471
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 0)
|
|
472
|
+
throw new TypeError("Web diagnostic deadline must be a non-negative finite number");
|
|
473
|
+
const observed = Promise.resolve(promise).then(
|
|
474
|
+
(value) => ({ value }),
|
|
475
|
+
(error) => ({ error }),
|
|
476
|
+
);
|
|
477
|
+
let timeout;
|
|
478
|
+
const expired = new Promise((resolve) => {
|
|
479
|
+
timeout = setTimeout(
|
|
480
|
+
() => resolve({ error: new Error(`Web diagnostic evaluation exceeded ${timeoutMs}ms`) }),
|
|
481
|
+
timeoutMs,
|
|
482
|
+
);
|
|
483
|
+
});
|
|
484
|
+
const outcome = await Promise.race([observed, expired]);
|
|
485
|
+
clearTimeout(timeout);
|
|
486
|
+
return Object.hasOwn(outcome, "value") ? outcome.value : onFailure(outcome.error);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function sanitizedStructuredDom(node) {
|
|
490
|
+
if (!node || typeof node !== "object" || node.tag === "meta") return null;
|
|
491
|
+
const attributes = Object.fromEntries(
|
|
492
|
+
Object.entries(node.attributes ?? {}).filter(([name]) => !SECRET_KEY.test(name)),
|
|
493
|
+
);
|
|
494
|
+
return {
|
|
495
|
+
tag: node.tag ?? null,
|
|
496
|
+
attributes,
|
|
497
|
+
text: node.text ?? "",
|
|
498
|
+
children: (node.children ?? []).map(sanitizedStructuredDom).filter(Boolean),
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** Stable, bounded JSON shape for a Web startup failure artifact. */
|
|
503
|
+
export function buildWebStartupEvidence(input, { secrets = [] } = {}) {
|
|
504
|
+
const safe = sanitizeWebDiagnosticValue(input, secrets);
|
|
505
|
+
return Object.freeze({
|
|
506
|
+
version: 1,
|
|
507
|
+
kind: "web-startup-failure",
|
|
508
|
+
capturedAt: safe.capturedAt ?? null,
|
|
509
|
+
navigation: safe.navigation ?? { requestedUrl: null, url: null, status: null },
|
|
510
|
+
page: safe.page ?? null,
|
|
511
|
+
// The browser serializer starts at #root, and this second boundary makes
|
|
512
|
+
// it impossible for a future caller to persist a capability-bearing meta.
|
|
513
|
+
dom: sanitizedStructuredDom(safe.dom),
|
|
514
|
+
pageErrors: safe.pageErrors ?? [],
|
|
515
|
+
console: safe.console ?? [],
|
|
516
|
+
requestFailures: safe.requestFailures ?? [],
|
|
517
|
+
httpErrors: safe.httpErrors ?? [],
|
|
518
|
+
webSockets: safe.webSockets ?? [],
|
|
519
|
+
screenshotPath: safe.screenshotPath ?? null,
|
|
520
|
+
screenshotError: safe.screenshotError ?? null,
|
|
521
|
+
viteOutput: redactWebDiagnosticText(input.viteOutput ?? "", secrets).slice(
|
|
522
|
+
-PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.processOutputChars,
|
|
523
|
+
),
|
|
524
|
+
daemonOutput: redactWebDiagnosticText(input.daemonOutput ?? "", secrets).slice(
|
|
525
|
+
-PRODUCT_RIG_WEB_DIAGNOSTIC_LIMITS.processOutputChars,
|
|
526
|
+
),
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export function boundedSourceTraceDiff(diff, maxBytes = PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES) {
|
|
531
|
+
const bytes = Buffer.byteLength(diff);
|
|
532
|
+
if (bytes > maxBytes) {
|
|
533
|
+
throw new Error(`Product rig source diff is ${bytes} bytes; hard ceiling is ${maxBytes} bytes`);
|
|
534
|
+
}
|
|
535
|
+
return diff;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export function deriveProductSourceManifestReadBudget(
|
|
539
|
+
selectedHeadBytes,
|
|
540
|
+
deltaAllowance = PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES,
|
|
541
|
+
absoluteMaxBytes = PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES,
|
|
542
|
+
) {
|
|
543
|
+
if (
|
|
544
|
+
!Number.isSafeInteger(selectedHeadBytes) ||
|
|
545
|
+
selectedHeadBytes < 0 ||
|
|
546
|
+
!Number.isSafeInteger(deltaAllowance) ||
|
|
547
|
+
deltaAllowance < 0 ||
|
|
548
|
+
!Number.isSafeInteger(absoluteMaxBytes) ||
|
|
549
|
+
absoluteMaxBytes < 1
|
|
550
|
+
)
|
|
551
|
+
throw new Error("Product rig source manifest budget was invalid");
|
|
552
|
+
const derived = selectedHeadBytes + deltaAllowance;
|
|
553
|
+
if (!Number.isSafeInteger(derived))
|
|
554
|
+
throw new Error("Product rig source manifest budget overflowed");
|
|
555
|
+
return Math.min(derived, absoluteMaxBytes);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export function productSourceHeadBaselineBytes(objects, expectedCount) {
|
|
559
|
+
if (
|
|
560
|
+
!Array.isArray(objects) ||
|
|
561
|
+
!Number.isSafeInteger(expectedCount) ||
|
|
562
|
+
expectedCount < 0 ||
|
|
563
|
+
objects.length !== expectedCount
|
|
564
|
+
)
|
|
565
|
+
throw new Error("Product rig source manifest HEAD inventory was incomplete");
|
|
566
|
+
let bytes = 0;
|
|
567
|
+
for (const object of objects) {
|
|
568
|
+
if (typeof object === "string" && object.endsWith(" missing")) continue;
|
|
569
|
+
const match = typeof object === "string" ? /^blob ([0-9]+)$/u.exec(object) : null;
|
|
570
|
+
const size = match ? Number(match[1]) : Number.NaN;
|
|
571
|
+
if (!Number.isSafeInteger(size) || size < 0)
|
|
572
|
+
throw new Error("Product rig source manifest HEAD inventory was invalid");
|
|
573
|
+
bytes += size;
|
|
574
|
+
if (!Number.isSafeInteger(bytes))
|
|
575
|
+
throw new Error("Product rig source manifest HEAD inventory overflowed");
|
|
576
|
+
}
|
|
577
|
+
return bytes;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export function buildProductSourceManifest(
|
|
581
|
+
paths,
|
|
582
|
+
{ openFile, statFile, readChunk, closeFile },
|
|
583
|
+
maxBytes,
|
|
584
|
+
) {
|
|
585
|
+
if (
|
|
586
|
+
!Array.isArray(paths) ||
|
|
587
|
+
paths.length > PRODUCT_RIG_SOURCE_INVENTORY_MAX_PATHS ||
|
|
588
|
+
!Number.isSafeInteger(maxBytes) ||
|
|
589
|
+
maxBytes < 0 ||
|
|
590
|
+
maxBytes > PRODUCT_RIG_SOURCE_MANIFEST_ABSOLUTE_MAX_BYTES
|
|
591
|
+
)
|
|
592
|
+
throw new Error("Product rig source manifest budget or inventory was invalid");
|
|
593
|
+
const ordered = [...paths].sort();
|
|
594
|
+
if (new Set(ordered).size !== ordered.length)
|
|
595
|
+
throw new Error("Product rig source manifest inventory was malformed");
|
|
596
|
+
let manifestBytes = 0;
|
|
597
|
+
const manifest = ordered.map((path) => {
|
|
598
|
+
if (
|
|
599
|
+
typeof path !== "string" ||
|
|
600
|
+
path.length === 0 ||
|
|
601
|
+
path.startsWith("/") ||
|
|
602
|
+
path.split("/").includes("..") ||
|
|
603
|
+
/[\0\r\n]/u.test(path) ||
|
|
604
|
+
Buffer.byteLength(path) > PRODUCT_RIG_SOURCE_PATH_MAX_BYTES ||
|
|
605
|
+
!productRigSourceTraceIncludesPath(path)
|
|
606
|
+
)
|
|
607
|
+
throw new Error("Product rig source manifest path was malformed");
|
|
608
|
+
const pathDigest = createHash("sha256").update(path).digest("hex");
|
|
609
|
+
let descriptor;
|
|
610
|
+
try {
|
|
611
|
+
descriptor = openFile(path);
|
|
612
|
+
} catch (error) {
|
|
613
|
+
if (error?.code === "ENOENT") {
|
|
614
|
+
let appeared;
|
|
615
|
+
try {
|
|
616
|
+
appeared = openFile(path);
|
|
617
|
+
} catch (confirmationError) {
|
|
618
|
+
if (confirmationError?.code === "ENOENT") {
|
|
619
|
+
return Object.freeze({
|
|
620
|
+
pathDigest,
|
|
621
|
+
contentDigest: createHash("sha256").update("deleted").digest("hex"),
|
|
622
|
+
bytes: 0,
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
throw new Error("Product rig source changed while building its manifest", {
|
|
626
|
+
cause: confirmationError,
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
try {
|
|
630
|
+
throw new Error("Product rig source changed while building its manifest", {
|
|
631
|
+
cause: error,
|
|
632
|
+
});
|
|
633
|
+
} finally {
|
|
634
|
+
closeFile(appeared);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
throw error;
|
|
638
|
+
}
|
|
639
|
+
try {
|
|
640
|
+
const before = statFile(descriptor);
|
|
641
|
+
if (!before?.isFile?.() || !Number.isSafeInteger(before.size) || before.size < 0)
|
|
642
|
+
throw new Error("Product rig source manifest encountered a non-regular file");
|
|
643
|
+
const nextBytes = manifestBytes + before.size;
|
|
644
|
+
if (!Number.isSafeInteger(nextBytes) || nextBytes > maxBytes)
|
|
645
|
+
throw new Error("Product rig source manifest exceeded its byte ceiling");
|
|
646
|
+
const hash = createHash("sha256");
|
|
647
|
+
const chunk = Buffer.allocUnsafe(
|
|
648
|
+
Math.max(1, Math.min(PRODUCT_RIG_SOURCE_MANIFEST_HASH_CHUNK_BYTES, before.size || 1)),
|
|
649
|
+
);
|
|
650
|
+
let offset = 0;
|
|
651
|
+
while (offset < before.size) {
|
|
652
|
+
const requested = Math.min(chunk.length, before.size - offset);
|
|
653
|
+
const count = readChunk(descriptor, chunk, requested, offset);
|
|
654
|
+
if (!Number.isSafeInteger(count) || count < 1 || count > requested)
|
|
655
|
+
throw new Error("Product rig source changed while building its manifest");
|
|
656
|
+
hash.update(chunk.subarray(0, count));
|
|
657
|
+
offset += count;
|
|
658
|
+
}
|
|
659
|
+
const growthProbe = Buffer.allocUnsafe(1);
|
|
660
|
+
const grew = readChunk(descriptor, growthProbe, 1, before.size) !== 0;
|
|
661
|
+
const after = statFile(descriptor);
|
|
662
|
+
let currentDescriptor;
|
|
663
|
+
let current;
|
|
664
|
+
try {
|
|
665
|
+
currentDescriptor = openFile(path);
|
|
666
|
+
current = statFile(currentDescriptor);
|
|
667
|
+
} catch {
|
|
668
|
+
throw new Error("Product rig source changed while building its manifest");
|
|
669
|
+
} finally {
|
|
670
|
+
if (currentDescriptor !== undefined) closeFile(currentDescriptor);
|
|
671
|
+
}
|
|
672
|
+
if (
|
|
673
|
+
offset !== before.size ||
|
|
674
|
+
grew ||
|
|
675
|
+
!after?.isFile?.() ||
|
|
676
|
+
after.size !== before.size ||
|
|
677
|
+
after.dev !== before.dev ||
|
|
678
|
+
after.ino !== before.ino ||
|
|
679
|
+
!current?.isFile?.() ||
|
|
680
|
+
current.size !== before.size ||
|
|
681
|
+
current.dev !== before.dev ||
|
|
682
|
+
current.ino !== before.ino
|
|
683
|
+
)
|
|
684
|
+
throw new Error("Product rig source changed while building its manifest");
|
|
685
|
+
manifestBytes = nextBytes;
|
|
686
|
+
return Object.freeze({
|
|
687
|
+
pathDigest,
|
|
688
|
+
contentDigest: hash.digest("hex"),
|
|
689
|
+
bytes: before.size,
|
|
690
|
+
});
|
|
691
|
+
} finally {
|
|
692
|
+
closeFile(descriptor);
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
return Object.freeze({
|
|
696
|
+
bytes: manifestBytes,
|
|
697
|
+
manifest: Object.freeze(manifest),
|
|
698
|
+
manifestDigest: createHash("sha256").update(JSON.stringify(manifest)).digest("hex"),
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export function buildSourceTracePayload(
|
|
703
|
+
trackedDiff,
|
|
704
|
+
untrackedFiles,
|
|
705
|
+
maxBytes = PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES,
|
|
706
|
+
) {
|
|
707
|
+
const diffLength = Buffer.isBuffer(trackedDiff)
|
|
708
|
+
? trackedDiff.length
|
|
709
|
+
: Buffer.byteLength(trackedDiff ?? "");
|
|
710
|
+
const header = Buffer.from(`tmux-ide-source-v2\ntracked ${diffLength}\n`);
|
|
711
|
+
let totalBytes = header.length + diffLength;
|
|
712
|
+
if (!Number.isSafeInteger(totalBytes) || totalBytes > maxBytes)
|
|
713
|
+
throw new Error(`Product rig source snapshot exceeded the ${maxBytes}-byte hard ceiling`);
|
|
714
|
+
const diff = Buffer.isBuffer(trackedDiff) ? trackedDiff : Buffer.from(trackedDiff ?? "");
|
|
715
|
+
const sourceFiles = untrackedFiles ?? [];
|
|
716
|
+
if (!Array.isArray(sourceFiles) || sourceFiles.length > PRODUCT_RIG_SOURCE_INVENTORY_MAX_PATHS)
|
|
717
|
+
throw new Error("Product rig untracked source inventory exceeded its path-count ceiling");
|
|
718
|
+
const files = [...sourceFiles]
|
|
719
|
+
.map(({ path, content }) => ({ path, content }))
|
|
720
|
+
.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0));
|
|
721
|
+
const seen = new Set();
|
|
722
|
+
const chunks = [header, diff];
|
|
723
|
+
for (const file of files) {
|
|
724
|
+
if (
|
|
725
|
+
typeof file.path !== "string" ||
|
|
726
|
+
file.path.length === 0 ||
|
|
727
|
+
file.path.startsWith("/") ||
|
|
728
|
+
file.path.split("/").includes("..") ||
|
|
729
|
+
/[\0\r\n]/u.test(file.path) ||
|
|
730
|
+
Buffer.byteLength(file.path) > PRODUCT_RIG_SOURCE_PATH_MAX_BYTES ||
|
|
731
|
+
seen.has(file.path)
|
|
732
|
+
)
|
|
733
|
+
throw new Error("Product rig untracked source inventory is malformed");
|
|
734
|
+
seen.add(file.path);
|
|
735
|
+
const path = Buffer.from(file.path);
|
|
736
|
+
const contentLength = Buffer.isBuffer(file.content)
|
|
737
|
+
? file.content.length
|
|
738
|
+
: Buffer.byteLength(file.content ?? "");
|
|
739
|
+
const fileHeader = Buffer.from(`\nfile ${path.length} ${contentLength}\n`);
|
|
740
|
+
totalBytes += fileHeader.length + path.length + contentLength;
|
|
741
|
+
if (!Number.isSafeInteger(totalBytes) || totalBytes > maxBytes) {
|
|
742
|
+
throw new Error(`Product rig source snapshot exceeded the ${maxBytes}-byte hard ceiling`);
|
|
743
|
+
}
|
|
744
|
+
const content = Buffer.isBuffer(file.content) ? file.content : Buffer.from(file.content ?? "");
|
|
745
|
+
chunks.push(fileHeader, path, content);
|
|
746
|
+
}
|
|
747
|
+
if (totalBytes > maxBytes) {
|
|
748
|
+
throw new Error(`Product rig source snapshot exceeded the ${maxBytes}-byte hard ceiling`);
|
|
749
|
+
}
|
|
750
|
+
return Buffer.concat(chunks, totalBytes);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export function productRigGitBlobObjectId(payload, maxBytes = PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES) {
|
|
754
|
+
const bytes = Buffer.isBuffer(payload) ? payload : Buffer.from(payload ?? "");
|
|
755
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0 || bytes.length > maxBytes)
|
|
756
|
+
throw new Error("Product rig Git blob payload exceeded its bounded byte ceiling");
|
|
757
|
+
return createHash("sha1")
|
|
758
|
+
.update(Buffer.from(`blob ${bytes.length}\0`))
|
|
759
|
+
.update(bytes)
|
|
760
|
+
.digest("hex");
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export function readBoundedSourceTraceFiles(
|
|
764
|
+
trackedDiff,
|
|
765
|
+
paths,
|
|
766
|
+
{ openFile, statFile, readFile, closeFile },
|
|
767
|
+
maxBytes = PRODUCT_RIG_SOURCE_DIFF_MAX_BYTES,
|
|
768
|
+
) {
|
|
769
|
+
if (!Array.isArray(paths) || paths.length > PRODUCT_RIG_SOURCE_INVENTORY_MAX_PATHS)
|
|
770
|
+
throw new Error("Product rig untracked source inventory exceeded its path-count ceiling");
|
|
771
|
+
const diffLength = Buffer.byteLength(trackedDiff);
|
|
772
|
+
let totalBytes = Buffer.byteLength(`tmux-ide-source-v2\ntracked ${diffLength}\n`) + diffLength;
|
|
773
|
+
const files = [];
|
|
774
|
+
for (const path of paths) {
|
|
775
|
+
const pathBytes = Buffer.byteLength(path);
|
|
776
|
+
if (pathBytes === 0 || pathBytes > PRODUCT_RIG_SOURCE_PATH_MAX_BYTES)
|
|
777
|
+
throw new Error("Product rig untracked source path exceeded its byte ceiling");
|
|
778
|
+
const descriptor = openFile(path);
|
|
779
|
+
try {
|
|
780
|
+
const stat = statFile(descriptor);
|
|
781
|
+
if (!stat?.isFile?.() || !Number.isSafeInteger(stat.size) || stat.size < 0)
|
|
782
|
+
throw new Error(`Product rig untracked source is not a regular file: ${path}`);
|
|
783
|
+
const headerBytes = Buffer.byteLength(`\nfile ${pathBytes} ${stat.size}\n`);
|
|
784
|
+
const nextTotal = totalBytes + headerBytes + pathBytes + stat.size;
|
|
785
|
+
if (!Number.isSafeInteger(nextTotal) || nextTotal > maxBytes)
|
|
786
|
+
throw new Error(`Product rig source snapshot exceeded the ${maxBytes}-byte hard ceiling`);
|
|
787
|
+
const content = readFile(descriptor, stat.size);
|
|
788
|
+
if (!Buffer.isBuffer(content) || content.length !== stat.size)
|
|
789
|
+
throw new Error(`Product rig untracked source changed while hashing: ${path}`);
|
|
790
|
+
const after = statFile(descriptor);
|
|
791
|
+
if (
|
|
792
|
+
!after?.isFile?.() ||
|
|
793
|
+
after.size !== stat.size ||
|
|
794
|
+
after.dev !== stat.dev ||
|
|
795
|
+
after.ino !== stat.ino
|
|
796
|
+
)
|
|
797
|
+
throw new Error(`Product rig untracked source changed while hashing: ${path}`);
|
|
798
|
+
totalBytes = nextTotal;
|
|
799
|
+
files.push({ path, content });
|
|
800
|
+
} finally {
|
|
801
|
+
closeFile(descriptor);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return files;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
export function productRigSourceTraceDiffArgs() {
|
|
808
|
+
return ["diff", "--binary", "HEAD", "--", ".", ":(exclude)packages/daemon/native/**"];
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
export function productRigSourceTraceUntrackedArgs() {
|
|
812
|
+
return [
|
|
813
|
+
"ls-files",
|
|
814
|
+
"--others",
|
|
815
|
+
"--exclude-standard",
|
|
816
|
+
"-z",
|
|
817
|
+
"--",
|
|
818
|
+
".",
|
|
819
|
+
":(exclude)packages/daemon/native/**",
|
|
820
|
+
];
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
export function productRigSourceTraceIncludesPath(path) {
|
|
824
|
+
return typeof path === "string" && !path.startsWith("packages/daemon/native/");
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export function createProductRigAttemptTimelineClock(
|
|
828
|
+
now = () => performance.timeOrigin + performance.now(),
|
|
829
|
+
origin = now(),
|
|
830
|
+
) {
|
|
831
|
+
if (!Number.isFinite(origin)) throw new Error("Product rig timeline origin is unavailable");
|
|
832
|
+
let previous = 0;
|
|
833
|
+
return Object.freeze({
|
|
834
|
+
elapsedMs() {
|
|
835
|
+
const current = now();
|
|
836
|
+
if (!Number.isFinite(current) || current < origin)
|
|
837
|
+
throw new Error("Product rig timeline clock regressed");
|
|
838
|
+
const elapsed = Math.floor(current - origin);
|
|
839
|
+
if (!Number.isSafeInteger(elapsed) || elapsed < previous)
|
|
840
|
+
throw new Error("Product rig timeline elapsed time is invalid");
|
|
841
|
+
previous = elapsed;
|
|
842
|
+
return elapsed;
|
|
843
|
+
},
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export function productRigHostHeartbeatObservation({
|
|
848
|
+
previousHeartbeatWallMs,
|
|
849
|
+
wallNowMs,
|
|
850
|
+
expectedIntervalMs = 100,
|
|
851
|
+
suspensionThresholdMs = 5_000,
|
|
852
|
+
}) {
|
|
853
|
+
const values = [previousHeartbeatWallMs, wallNowMs, expectedIntervalMs, suspensionThresholdMs];
|
|
854
|
+
if (!values.every(Number.isFinite) || !Number.isFinite(suspensionThresholdMs)) {
|
|
855
|
+
return Object.freeze({ reason: "heartbeat-unavailable", suspended: false, gapMs: null });
|
|
856
|
+
}
|
|
857
|
+
const elapsedMs = Math.max(0, wallNowMs - previousHeartbeatWallMs);
|
|
858
|
+
const gapMs = Math.max(0, elapsedMs - expectedIntervalMs);
|
|
859
|
+
return Object.freeze({
|
|
860
|
+
reason: gapMs >= suspensionThresholdMs ? "host-suspended" : "running",
|
|
861
|
+
suspended: gapMs >= suspensionThresholdMs,
|
|
862
|
+
elapsedMs: Math.round(elapsedMs),
|
|
863
|
+
expectedIntervalMs: Math.round(expectedIntervalMs),
|
|
864
|
+
gapMs: Math.round(gapMs),
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export function compareProductSourceProvenance(expected, actual, changedLimit = 16) {
|
|
869
|
+
const expectedFiles = new Map(
|
|
870
|
+
Array.isArray(expected?.manifest)
|
|
871
|
+
? expected.manifest.map((entry) => [entry.pathDigest, entry])
|
|
872
|
+
: [],
|
|
873
|
+
);
|
|
874
|
+
const actualFiles = new Map(
|
|
875
|
+
Array.isArray(actual?.manifest)
|
|
876
|
+
? actual.manifest.map((entry) => [entry.pathDigest, entry])
|
|
877
|
+
: [],
|
|
878
|
+
);
|
|
879
|
+
const changed = [...new Set([...expectedFiles.keys(), ...actualFiles.keys()])]
|
|
880
|
+
.sort()
|
|
881
|
+
.filter((pathDigest) => {
|
|
882
|
+
const before = expectedFiles.get(pathDigest);
|
|
883
|
+
const after = actualFiles.get(pathDigest);
|
|
884
|
+
return (
|
|
885
|
+
!before ||
|
|
886
|
+
!after ||
|
|
887
|
+
before.contentDigest !== after.contentDigest ||
|
|
888
|
+
before.bytes !== after.bytes
|
|
889
|
+
);
|
|
890
|
+
});
|
|
891
|
+
const stable =
|
|
892
|
+
expected?.commit === actual?.commit &&
|
|
893
|
+
expected?.tree === actual?.tree &&
|
|
894
|
+
expected?.manifestDigest === actual?.manifestDigest &&
|
|
895
|
+
changed.length === 0;
|
|
896
|
+
return Object.freeze({
|
|
897
|
+
stable,
|
|
898
|
+
commitExact: expected?.commit === actual?.commit,
|
|
899
|
+
treeExact: expected?.tree === actual?.tree,
|
|
900
|
+
manifestExact: expected?.manifestDigest === actual?.manifestDigest,
|
|
901
|
+
changedCount: changed.length,
|
|
902
|
+
changedPathDigests: Object.freeze(changed.slice(0, changedLimit)),
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
const WARM_COHERENT_SAMPLE_COUNT = 20;
|
|
906
|
+
const MEMORY_BUDGET = JSON.parse(
|
|
907
|
+
readFileSync(new URL("../performance/reference-budgets.json", import.meta.url), "utf8"),
|
|
908
|
+
).memory;
|
|
909
|
+
const PRODUCT_RESOURCE_LOAD_LINES = 300;
|
|
910
|
+
export const PRODUCT_RESOURCE_CONDITIONING_CYCLE_COUNT = 8;
|
|
911
|
+
export const PRODUCT_RESOURCE_MEASURED_CYCLE_COUNT = 16;
|
|
912
|
+
const PRODUCT_RESOURCE_PROBES = "abcdefghijklmnopqrstuvwx";
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Every conditioning and measured cycle closes a distinct
|
|
916
|
+
* load→clear→settle→probe epoch. The first eight cycles condition fixed
|
|
917
|
+
* allocator/xterm high-water state; only the following sixteen are retained
|
|
918
|
+
* as independent memory endpoints.
|
|
919
|
+
*/
|
|
920
|
+
export function productResourceCyclePlan(...configuration) {
|
|
921
|
+
if (configuration.length !== 0)
|
|
922
|
+
throw new TypeError("Product resource conditioning plan is fixed and cannot be configured");
|
|
923
|
+
if (MEMORY_BUDGET.minimumSamples !== PRODUCT_RESOURCE_MEASURED_CYCLE_COUNT)
|
|
924
|
+
throw new Error("Product resource measured-cycle count must match the memory budget");
|
|
925
|
+
const cycleCount =
|
|
926
|
+
PRODUCT_RESOURCE_CONDITIONING_CYCLE_COUNT + PRODUCT_RESOURCE_MEASURED_CYCLE_COUNT;
|
|
927
|
+
if (PRODUCT_RESOURCE_PROBES.length !== cycleCount)
|
|
928
|
+
throw new Error("Product resource probe alphabet must match the fixed cycle count");
|
|
929
|
+
return Object.freeze(
|
|
930
|
+
Array.from({ length: cycleCount }, (_, cycle) => {
|
|
931
|
+
const measured = cycle >= PRODUCT_RESOURCE_CONDITIONING_CYCLE_COUNT;
|
|
932
|
+
return Object.freeze({
|
|
933
|
+
cycle,
|
|
934
|
+
phase: measured ? "measured" : "conditioning",
|
|
935
|
+
measured,
|
|
936
|
+
measuredIndex: measured ? cycle - PRODUCT_RESOURCE_CONDITIONING_CYCLE_COUNT : null,
|
|
937
|
+
loadLines: PRODUCT_RESOURCE_LOAD_LINES,
|
|
938
|
+
cycleMarker: `tmux-ide-settled-${cycle}`,
|
|
939
|
+
probe: PRODUCT_RESOURCE_PROBES[cycle],
|
|
940
|
+
});
|
|
941
|
+
}),
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
export function productResourceMeasuredEndpointTraceIds(cycleEndpoints) {
|
|
946
|
+
const plan = productResourceCyclePlan();
|
|
947
|
+
if (!Array.isArray(cycleEndpoints) || cycleEndpoints.length !== plan.length)
|
|
948
|
+
throw new Error(`Product resource run must close exactly ${plan.length} cycle endpoints`);
|
|
949
|
+
const traceIds = new Set();
|
|
950
|
+
const measuredTraceIds = [];
|
|
951
|
+
for (const [index, expected] of plan.entries()) {
|
|
952
|
+
const endpoint = cycleEndpoints[index];
|
|
953
|
+
if (
|
|
954
|
+
endpoint?.cycle !== expected.cycle ||
|
|
955
|
+
endpoint?.phase !== expected.phase ||
|
|
956
|
+
typeof endpoint?.traceId !== "string" ||
|
|
957
|
+
endpoint.traceId.length === 0
|
|
958
|
+
)
|
|
959
|
+
throw new Error(`Product resource endpoint identity mismatch at cycle ${expected.cycle}`);
|
|
960
|
+
if (traceIds.has(endpoint.traceId))
|
|
961
|
+
throw new Error(
|
|
962
|
+
`Product resource endpoint trace id is duplicated at cycle ${expected.cycle}`,
|
|
963
|
+
);
|
|
964
|
+
traceIds.add(endpoint.traceId);
|
|
965
|
+
if (expected.measured) measuredTraceIds.push(endpoint.traceId);
|
|
966
|
+
}
|
|
967
|
+
return Object.freeze(measuredTraceIds);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
export function productResourceCycleCommands({ cycle, loadLines }) {
|
|
971
|
+
if (
|
|
972
|
+
!Number.isSafeInteger(cycle) ||
|
|
973
|
+
cycle < 0 ||
|
|
974
|
+
!Number.isSafeInteger(loadLines) ||
|
|
975
|
+
loadLines < 1
|
|
976
|
+
)
|
|
977
|
+
throw new TypeError("Product resource cycle command requires bounded integer inputs");
|
|
978
|
+
return Object.freeze({
|
|
979
|
+
floodCommand: `i=0; while [ $i -lt ${loadLines} ]; do echo tmux-ide-load-$i; i=$((i+1)); done; printf 'tmux-ide-flood-%s\\n' '${cycle}'`,
|
|
980
|
+
settleCommand: `printf '\\033[2J\\033[3J\\033[Htmux-ide-settled-%s\\n' '${cycle}'`,
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
export function productInputQueueObservation(records, processId) {
|
|
985
|
+
return (
|
|
986
|
+
records.findLast(
|
|
987
|
+
(record) =>
|
|
988
|
+
((record?.type === "performance.stage" && record.stage === "client") ||
|
|
989
|
+
record?.type === "performance.input-queue-state") &&
|
|
990
|
+
record.processId === processId &&
|
|
991
|
+
Number.isFinite(record.inputPending) &&
|
|
992
|
+
Number.isFinite(record.inputInFlight) &&
|
|
993
|
+
Number.isFinite(record.inputPendingBytes),
|
|
994
|
+
) ?? null
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export function causalFixtureBaselineReadiness(observation) {
|
|
999
|
+
const queueObservation = observation?.queueObservation ?? null;
|
|
1000
|
+
const predicates = Object.freeze({
|
|
1001
|
+
optionReady: observation?.fixtureOption === observation?.expectedOption,
|
|
1002
|
+
helperCommandReady: observation?.currentCommand === "node",
|
|
1003
|
+
queueObserved: queueObservation !== null,
|
|
1004
|
+
queueZero:
|
|
1005
|
+
queueObservation?.inputPending === 0 &&
|
|
1006
|
+
queueObservation.inputInFlight === 0 &&
|
|
1007
|
+
queueObservation.inputPendingBytes === 0,
|
|
1008
|
+
paneIdentityReady: observation?.activePaneId === observation?.fixturePaneId,
|
|
1009
|
+
geometryStable: observation?.geometryBefore === observation?.geometryAfter,
|
|
1010
|
+
nativeCellBlank: observation?.nativeCell === " ",
|
|
1011
|
+
tuiCellBlank: observation?.tuiCell === " ",
|
|
1012
|
+
});
|
|
1013
|
+
return Object.freeze({
|
|
1014
|
+
ready: Object.values(predicates).every(Boolean),
|
|
1015
|
+
predicates,
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
export function productInputQueuesSettled(records, processId) {
|
|
1020
|
+
const observation = productInputQueueObservation(records, processId);
|
|
1021
|
+
return (
|
|
1022
|
+
observation?.inputPending === 0 &&
|
|
1023
|
+
observation.inputInFlight === 0 &&
|
|
1024
|
+
observation.inputPendingBytes === 0
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
export function productAttachablePaneInventory(resources) {
|
|
1029
|
+
if (!Array.isArray(resources))
|
|
1030
|
+
throw new TypeError("product rig terminal inventory must be an array");
|
|
1031
|
+
const panes = resources
|
|
1032
|
+
.filter(
|
|
1033
|
+
(resource) =>
|
|
1034
|
+
resource?.attachability?.status === "available" &&
|
|
1035
|
+
typeof resource?.attachability?.semanticPaneId === "string" &&
|
|
1036
|
+
resource.attachability.semanticPaneId.length > 0,
|
|
1037
|
+
)
|
|
1038
|
+
.map((resource) => resource.attachability.semanticPaneId)
|
|
1039
|
+
.sort();
|
|
1040
|
+
if (panes.length === 0) throw new Error("product rig found no attachable semantic pane");
|
|
1041
|
+
if (new Set(panes).size !== panes.length)
|
|
1042
|
+
throw new Error("product rig attachable semantic pane inventory was ambiguous");
|
|
1043
|
+
return Object.freeze(panes);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
export function productResourceEndpointCandidates(beforeSamples, afterSamples, expected) {
|
|
1047
|
+
const baseline = new Set(beforeSamples.map(({ traceId }) => traceId));
|
|
1048
|
+
return Object.freeze(
|
|
1049
|
+
afterSamples.filter(
|
|
1050
|
+
(sample) =>
|
|
1051
|
+
!baseline.has(sample.traceId) &&
|
|
1052
|
+
sample.processId === expected.processId &&
|
|
1053
|
+
sample.generation === expected.generation &&
|
|
1054
|
+
sample.semanticPaneId === expected.semanticPaneId &&
|
|
1055
|
+
sample.paintStateIdentity === "latest-canonical-state-blitted" &&
|
|
1056
|
+
Number.isInteger(sample.revision) &&
|
|
1057
|
+
typeof sample.stateHash === "string",
|
|
1058
|
+
),
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
export function selectProductResourceEndpoint(beforeSamples, afterSamples, expected) {
|
|
1063
|
+
const candidates = productResourceEndpointCandidates(beforeSamples, afterSamples, expected);
|
|
1064
|
+
if (candidates.length === 0)
|
|
1065
|
+
throw new Error(`Missing paired resource endpoint for cycle ${expected.cycle}`);
|
|
1066
|
+
if (candidates.length !== 1)
|
|
1067
|
+
throw new Error(
|
|
1068
|
+
`Ambiguous paired resource endpoint for cycle ${expected.cycle}: ${candidates.length} candidates`,
|
|
1069
|
+
);
|
|
1070
|
+
return candidates[0];
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
export function productResourceEndpointEpochState({
|
|
1074
|
+
beforeSamples,
|
|
1075
|
+
afterSamples,
|
|
1076
|
+
expected,
|
|
1077
|
+
inputSettled,
|
|
1078
|
+
traceQuiet,
|
|
1079
|
+
probeCellCount,
|
|
1080
|
+
geometryStable,
|
|
1081
|
+
}) {
|
|
1082
|
+
if (!geometryStable)
|
|
1083
|
+
throw new Error(`Resource probe geometry changed during cycle ${expected.cycle}`);
|
|
1084
|
+
if (probeCellCount > 1)
|
|
1085
|
+
throw new Error(
|
|
1086
|
+
`Ambiguous visible resource probe for cycle ${expected.cycle}: ${probeCellCount} cells`,
|
|
1087
|
+
);
|
|
1088
|
+
const candidates = productResourceEndpointCandidates(beforeSamples, afterSamples, expected);
|
|
1089
|
+
if (candidates.length > 1) selectProductResourceEndpoint(beforeSamples, afterSamples, expected);
|
|
1090
|
+
if (
|
|
1091
|
+
candidates.length !== 1 ||
|
|
1092
|
+
probeCellCount !== 1 ||
|
|
1093
|
+
inputSettled !== true ||
|
|
1094
|
+
traceQuiet !== true
|
|
1095
|
+
)
|
|
1096
|
+
return Object.freeze({ status: "pending", endpoint: null });
|
|
1097
|
+
return Object.freeze({ status: "ready", endpoint: candidates[0] });
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
function newlyVisibleProbeCells(before, after, probe) {
|
|
1101
|
+
const beforeLines = String(before).split("\n");
|
|
1102
|
+
return String(after)
|
|
1103
|
+
.split("\n")
|
|
1104
|
+
.flatMap((line, row) =>
|
|
1105
|
+
Array.from(line).flatMap((cell, col) =>
|
|
1106
|
+
cell === probe && Array.from(beforeLines[row] ?? "")[col] !== probe
|
|
1107
|
+
? [`${row}:${col}`]
|
|
1108
|
+
: [],
|
|
1109
|
+
),
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
export function productResourceProbeCells({
|
|
1114
|
+
beforeNative,
|
|
1115
|
+
afterNative,
|
|
1116
|
+
beforeTui,
|
|
1117
|
+
afterTui,
|
|
1118
|
+
probe,
|
|
1119
|
+
}) {
|
|
1120
|
+
if (typeof probe !== "string" || !/^[\x21-\x7e]$/u.test(probe))
|
|
1121
|
+
throw new TypeError("Product resource probe must be exactly one printable ASCII character");
|
|
1122
|
+
const native = new Set(newlyVisibleProbeCells(beforeNative, afterNative, probe));
|
|
1123
|
+
return Object.freeze(
|
|
1124
|
+
newlyVisibleProbeCells(beforeTui, afterTui, probe)
|
|
1125
|
+
.filter((coordinate) => native.has(coordinate))
|
|
1126
|
+
.map((coordinate) => {
|
|
1127
|
+
const [row, col] = coordinate.split(":").map(Number);
|
|
1128
|
+
return Object.freeze({ row, col });
|
|
1129
|
+
}),
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
export function productResourceGeometryIdentity(frame, pane) {
|
|
1134
|
+
const rect = resolvePaneBodyRect(frame, pane);
|
|
1135
|
+
if (!rect.valid) return null;
|
|
1136
|
+
return JSON.stringify({
|
|
1137
|
+
pane: paneGeometryIdentity([pane]),
|
|
1138
|
+
body: {
|
|
1139
|
+
left: rect.left,
|
|
1140
|
+
firstBodyRow: rect.firstBodyRow,
|
|
1141
|
+
width: rect.width,
|
|
1142
|
+
bodyRows: rect.bodyRows,
|
|
1143
|
+
origin: rect.origin,
|
|
1144
|
+
},
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
export function processAlive(pid) {
|
|
1149
|
+
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
1150
|
+
try {
|
|
1151
|
+
process.kill(pid, 0);
|
|
1152
|
+
return true;
|
|
1153
|
+
} catch {
|
|
1154
|
+
return false;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
export function readJson(path) {
|
|
1159
|
+
if (!existsSync(path)) return null;
|
|
1160
|
+
try {
|
|
1161
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
1162
|
+
} catch {
|
|
1163
|
+
return null;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
export async function waitForLifecycleEntry({
|
|
1168
|
+
findEntry,
|
|
1169
|
+
subscribe,
|
|
1170
|
+
timeoutMs,
|
|
1171
|
+
timeoutMessage,
|
|
1172
|
+
pollIntervalMs = 25,
|
|
1173
|
+
}) {
|
|
1174
|
+
const existing = findEntry();
|
|
1175
|
+
if (existing) return existing;
|
|
1176
|
+
|
|
1177
|
+
return await new Promise((resolveWait, rejectWait) => {
|
|
1178
|
+
let settled = false;
|
|
1179
|
+
let checking = false;
|
|
1180
|
+
let deadline = null;
|
|
1181
|
+
let poller = null;
|
|
1182
|
+
let watcher = null;
|
|
1183
|
+
const finish = (error, entry = null) => {
|
|
1184
|
+
if (settled) return;
|
|
1185
|
+
settled = true;
|
|
1186
|
+
if (deadline) clearTimeout(deadline);
|
|
1187
|
+
if (poller) clearInterval(poller);
|
|
1188
|
+
watcher?.close();
|
|
1189
|
+
if (error) rejectWait(error);
|
|
1190
|
+
else resolveWait(entry);
|
|
1191
|
+
};
|
|
1192
|
+
const check = () => {
|
|
1193
|
+
if (checking || settled) return;
|
|
1194
|
+
checking = true;
|
|
1195
|
+
try {
|
|
1196
|
+
const entry = findEntry();
|
|
1197
|
+
if (entry) finish(null, entry);
|
|
1198
|
+
} catch (error) {
|
|
1199
|
+
finish(error instanceof Error ? error : new Error(String(error)));
|
|
1200
|
+
} finally {
|
|
1201
|
+
checking = false;
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
try {
|
|
1205
|
+
watcher = subscribe(check);
|
|
1206
|
+
} catch (error) {
|
|
1207
|
+
finish(error instanceof Error ? error : new Error(String(error)));
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
deadline = setTimeout(() => finish(new Error(timeoutMessage)), timeoutMs);
|
|
1211
|
+
poller = setInterval(check, pollIntervalMs);
|
|
1212
|
+
// Close the subscribe/read race. The bounded poll also covers dropped or
|
|
1213
|
+
// inode-stale filesystem notifications without spawning another process.
|
|
1214
|
+
check();
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
export function writeJsonAtomic(path, value) {
|
|
1219
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
1220
|
+
writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
|
|
1221
|
+
renameSync(temporary, path);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
export function productCapturePageUrlStatus(value) {
|
|
1225
|
+
if (typeof value !== "string" || value.length < 1 || value.length > 2_048)
|
|
1226
|
+
return Object.freeze({ exact: false, pageUrl: null, reason: "missing-or-shape" });
|
|
1227
|
+
let parsed;
|
|
1228
|
+
try {
|
|
1229
|
+
parsed = new URL(value);
|
|
1230
|
+
} catch {
|
|
1231
|
+
return Object.freeze({ exact: false, pageUrl: null, reason: "malformed" });
|
|
1232
|
+
}
|
|
1233
|
+
if (parsed.protocol !== "http:")
|
|
1234
|
+
return Object.freeze({ exact: false, pageUrl: null, reason: "scheme" });
|
|
1235
|
+
if (!new Set(["127.0.0.1", "localhost", "[::1]"]).has(parsed.hostname))
|
|
1236
|
+
return Object.freeze({ exact: false, pageUrl: null, reason: "host" });
|
|
1237
|
+
const port = Number(parsed.port);
|
|
1238
|
+
if (!Number.isSafeInteger(port) || port < 1 || port > 65_535)
|
|
1239
|
+
return Object.freeze({ exact: false, pageUrl: null, reason: "port" });
|
|
1240
|
+
if (parsed.username !== "" || parsed.password !== "")
|
|
1241
|
+
return Object.freeze({ exact: false, pageUrl: null, reason: "credentials" });
|
|
1242
|
+
return Object.freeze({ exact: true, pageUrl: value, reason: null });
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
export function publicRigStatus(state) {
|
|
1246
|
+
if (!state) return { status: "stopped", running: false };
|
|
1247
|
+
const running = state.status !== "stopped" && processAlive(state.ownerPid);
|
|
1248
|
+
return {
|
|
1249
|
+
version: state.version,
|
|
1250
|
+
status: running ? state.status : "stopped",
|
|
1251
|
+
running,
|
|
1252
|
+
ownerPid: state.ownerPid,
|
|
1253
|
+
runtimeNamespace: state.runtimeNamespace,
|
|
1254
|
+
session: state.session,
|
|
1255
|
+
daemon: state.daemon
|
|
1256
|
+
? {
|
|
1257
|
+
pid: state.daemon.pid,
|
|
1258
|
+
port: state.daemon.port,
|
|
1259
|
+
instanceId: state.daemon.instanceId,
|
|
1260
|
+
}
|
|
1261
|
+
: null,
|
|
1262
|
+
web: state.web ? { pageUrl: state.web.pageUrl } : null,
|
|
1263
|
+
tui: state.tui ?? null,
|
|
1264
|
+
convergence: state.convergence
|
|
1265
|
+
? {
|
|
1266
|
+
status: state.convergence.status,
|
|
1267
|
+
generation: state.convergence.generation,
|
|
1268
|
+
clientCount: state.convergence.clientCount,
|
|
1269
|
+
timings: state.convergence.timings,
|
|
1270
|
+
}
|
|
1271
|
+
: null,
|
|
1272
|
+
artifactDir: state.artifactDir,
|
|
1273
|
+
timelinePath: state.timelinePath,
|
|
1274
|
+
webStartupFailureArtifact: state.webStartupFailureArtifact ?? null,
|
|
1275
|
+
failure: state.failure ?? null,
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
export function coherentReadiness({ chromeMs, terminalMs }) {
|
|
1280
|
+
return {
|
|
1281
|
+
appChromeFrameMs: Number.isFinite(chromeMs) ? Math.round(chromeMs) : null,
|
|
1282
|
+
coherentTerminalFrameMs: Number.isFinite(terminalMs) ? Math.round(terminalMs) : null,
|
|
1283
|
+
ready:
|
|
1284
|
+
Number.isFinite(chromeMs) &&
|
|
1285
|
+
Number.isFinite(terminalMs) &&
|
|
1286
|
+
Number(terminalMs) >= Number(chromeMs),
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
export function percentile(values, quantile) {
|
|
1291
|
+
if (values.length === 0) return null;
|
|
1292
|
+
const sorted = [...values].sort((left, right) => left - right);
|
|
1293
|
+
return sorted[Math.max(0, Math.ceil(sorted.length * quantile) - 1)];
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* Resolve the body rectangle actually published by root-v2.
|
|
1298
|
+
*
|
|
1299
|
+
* Tmux geometry is the source of truth for pane size, but it is not a safe
|
|
1300
|
+
* origin for an external framebuffer capture: another attached client may
|
|
1301
|
+
* change tmux's reported origin between the layout publication and this
|
|
1302
|
+
* observation. The semantic pane chrome is rendered in the same framebuffer
|
|
1303
|
+
* as the body, so it is the exact origin anchor whenever it is present.
|
|
1304
|
+
*/
|
|
1305
|
+
export function resolvePaneBodyRect(frame, pane) {
|
|
1306
|
+
const lines = String(frame).split("\n");
|
|
1307
|
+
const fallback = Object.freeze({
|
|
1308
|
+
left: pane.left,
|
|
1309
|
+
firstBodyRow: pane.top + 3,
|
|
1310
|
+
width: pane.width,
|
|
1311
|
+
bodyRows: Math.max(0, pane.height),
|
|
1312
|
+
origin: "tmux-geometry",
|
|
1313
|
+
valid: true,
|
|
1314
|
+
semanticChromeMatches: 0,
|
|
1315
|
+
});
|
|
1316
|
+
if (typeof pane.semanticPaneId !== "string" || pane.semanticPaneId.length === 0) {
|
|
1317
|
+
return Object.freeze({
|
|
1318
|
+
...fallback,
|
|
1319
|
+
bodyRows: 0,
|
|
1320
|
+
origin: "semantic-pane-identity-missing",
|
|
1321
|
+
valid: false,
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
const chromeMatches = (identity) => {
|
|
1326
|
+
if (typeof identity !== "string" || identity.length === 0) return [];
|
|
1327
|
+
const matches = [];
|
|
1328
|
+
for (let row = 0; row < lines.length; row += 1) {
|
|
1329
|
+
const line = lines[row];
|
|
1330
|
+
let index = line.indexOf(identity);
|
|
1331
|
+
while (index >= 0) {
|
|
1332
|
+
const prefix = line.slice(Math.max(0, index - 2), index);
|
|
1333
|
+
const suffix = line[index + identity.length];
|
|
1334
|
+
if ((prefix === "● " || prefix === "○ ") && (suffix === undefined || suffix === " "))
|
|
1335
|
+
matches.push({ row, left: index - 2 });
|
|
1336
|
+
index = line.indexOf(identity, index + 1);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
return matches;
|
|
1340
|
+
};
|
|
1341
|
+
// Older frames exposed the durable pane id in their title. The release UI
|
|
1342
|
+
// now presents the daemon-authored display name instead, so carry that
|
|
1343
|
+
// canonical layout fact into the evidence input and use it only when the
|
|
1344
|
+
// legacy semantic-id anchor is absent. Duplicate visible names still fail
|
|
1345
|
+
// closed rather than letting evidence attach a body to the wrong pane.
|
|
1346
|
+
const semanticMatches = chromeMatches(pane.semanticPaneId);
|
|
1347
|
+
const displayIdentities = [pane.displayName, ...(pane.canonicalDisplayNames ?? [])]
|
|
1348
|
+
.map((identity) => identity?.trim())
|
|
1349
|
+
.filter((identity, index, identities) => identity && identities.indexOf(identity) === index);
|
|
1350
|
+
const displayMatches = [
|
|
1351
|
+
...new Map(
|
|
1352
|
+
displayIdentities
|
|
1353
|
+
.flatMap(chromeMatches)
|
|
1354
|
+
.map((match) => [`${match.row}:${match.left}`, match]),
|
|
1355
|
+
).values(),
|
|
1356
|
+
];
|
|
1357
|
+
const matches = semanticMatches.length > 0 ? semanticMatches : displayMatches;
|
|
1358
|
+
if (matches.length !== 1) {
|
|
1359
|
+
return Object.freeze({
|
|
1360
|
+
...fallback,
|
|
1361
|
+
bodyRows: 0,
|
|
1362
|
+
origin:
|
|
1363
|
+
matches.length === 0 ? "semantic-pane-chrome-missing" : "semantic-pane-chrome-ambiguous",
|
|
1364
|
+
valid: false,
|
|
1365
|
+
semanticChromeMatches: matches.length,
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
const [match] = matches;
|
|
1369
|
+
return Object.freeze({
|
|
1370
|
+
left: match.left,
|
|
1371
|
+
firstBodyRow: match.row + 1,
|
|
1372
|
+
width: pane.width,
|
|
1373
|
+
bodyRows: Math.max(0, pane.height),
|
|
1374
|
+
origin: "semantic-pane-chrome",
|
|
1375
|
+
valid: true,
|
|
1376
|
+
semanticChromeMatches: 1,
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/** Exact body rectangle used by root-v2: app header + tabs + pane chrome. */
|
|
1381
|
+
export function paneBodyRegion(frame, pane) {
|
|
1382
|
+
const lines = String(frame).split("\n");
|
|
1383
|
+
const rect = resolvePaneBodyRect(frame, pane);
|
|
1384
|
+
if (!rect.valid) return "";
|
|
1385
|
+
return lines
|
|
1386
|
+
.slice(rect.firstBodyRow, rect.firstBodyRow + rect.bodyRows)
|
|
1387
|
+
.map((line) => line.slice(rect.left, rect.left + rect.width))
|
|
1388
|
+
.join("\n");
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/** Stable identity for one exact active-window geometry sample. */
|
|
1392
|
+
export function paneGeometryIdentity(panes) {
|
|
1393
|
+
return JSON.stringify(
|
|
1394
|
+
[...panes]
|
|
1395
|
+
.map(({ paneId, semanticPaneId, left, top, width, height }) => ({
|
|
1396
|
+
paneId,
|
|
1397
|
+
semanticPaneId,
|
|
1398
|
+
left,
|
|
1399
|
+
top,
|
|
1400
|
+
width,
|
|
1401
|
+
height,
|
|
1402
|
+
}))
|
|
1403
|
+
.sort((left, right) => String(left.paneId).localeCompare(String(right.paneId))),
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/** Parse the one active tmux pane without confusing runtime and semantic IDs. */
|
|
1408
|
+
export function activeTmuxPaneFromRows(rows) {
|
|
1409
|
+
const panes = String(rows)
|
|
1410
|
+
.trim()
|
|
1411
|
+
.split("\n")
|
|
1412
|
+
.filter(Boolean)
|
|
1413
|
+
.map((line) => {
|
|
1414
|
+
const [paneId, windowActive, paneActive, semanticPaneId, left, top, width, height] =
|
|
1415
|
+
line.split("|");
|
|
1416
|
+
return {
|
|
1417
|
+
paneId,
|
|
1418
|
+
windowActive: windowActive === "1",
|
|
1419
|
+
paneActive: paneActive === "1",
|
|
1420
|
+
semanticPaneId,
|
|
1421
|
+
left: Number(left),
|
|
1422
|
+
top: Number(top),
|
|
1423
|
+
width: Number(width),
|
|
1424
|
+
height: Number(height),
|
|
1425
|
+
};
|
|
1426
|
+
});
|
|
1427
|
+
const active = panes.filter((candidate) => candidate.windowActive && candidate.paneActive);
|
|
1428
|
+
if (active.length !== 1) return null;
|
|
1429
|
+
const pane = active[0];
|
|
1430
|
+
if (!pane?.paneId || !pane.semanticPaneId) return null;
|
|
1431
|
+
if (![pane.left, pane.top, pane.width, pane.height].every(Number.isFinite)) return null;
|
|
1432
|
+
return Object.freeze(pane);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
export function bindPromotedInitialPane(initialPane, promotedPane) {
|
|
1436
|
+
if (
|
|
1437
|
+
!initialPane ||
|
|
1438
|
+
!promotedPane ||
|
|
1439
|
+
!/^%[0-9]+$/u.test(initialPane.paneId ?? "") ||
|
|
1440
|
+
promotedPane.paneId !== initialPane.paneId ||
|
|
1441
|
+
typeof promotedPane.semanticPaneId !== "string" ||
|
|
1442
|
+
promotedPane.semanticPaneId.length === 0
|
|
1443
|
+
)
|
|
1444
|
+
throw new Error("promoted active pane did not match the exact initial raw pane");
|
|
1445
|
+
return Object.freeze({ ...promotedPane, initialGeometry: Object.freeze({ ...initialPane }) });
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
export function coherentGenerationPaint(lifecycle) {
|
|
1449
|
+
const painted =
|
|
1450
|
+
lifecycle.findLast((entry) => entry?.phase === "host-terminal-publication") ??
|
|
1451
|
+
lifecycle.findLast((entry) => entry?.phase === "first-terminal-frame");
|
|
1452
|
+
const generation = painted?.daemonGeneration ?? painted?.generation;
|
|
1453
|
+
return typeof generation === "string" && Number.isFinite(painted?.elapsedMs)
|
|
1454
|
+
? Object.freeze({ ...painted, daemonGeneration: generation })
|
|
1455
|
+
: null;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
export function coherentGenerationDuration(lifecycle) {
|
|
1459
|
+
const painted = coherentGenerationPaint(lifecycle);
|
|
1460
|
+
if (!painted) return null;
|
|
1461
|
+
const connected = lifecycle.find(
|
|
1462
|
+
(entry) =>
|
|
1463
|
+
entry?.phase === "generation-connection-resolved" &&
|
|
1464
|
+
entry?.daemonGeneration === painted.daemonGeneration,
|
|
1465
|
+
);
|
|
1466
|
+
if (!connected || !Number.isFinite(connected.elapsedMs)) return null;
|
|
1467
|
+
return painted.elapsedMs - connected.elapsedMs;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
export function inputPaintSamples(records) {
|
|
1471
|
+
const byTrace = new Map();
|
|
1472
|
+
for (const record of records) {
|
|
1473
|
+
if (record?.type !== "performance.stage" || typeof record.traceId !== "string") continue;
|
|
1474
|
+
const stages = byTrace.get(record.traceId) ?? { input: [], paint: [] };
|
|
1475
|
+
if (record.stage === "input" || record.stage === "paint") stages[record.stage].push(record);
|
|
1476
|
+
byTrace.set(record.traceId, stages);
|
|
1477
|
+
}
|
|
1478
|
+
return [...byTrace.entries()].flatMap(([traceId, stages]) => {
|
|
1479
|
+
// Duplicate/reordered endpoints are ambiguous and never qualify. A gate
|
|
1480
|
+
// must not silently take the last record and bias the distribution.
|
|
1481
|
+
if (stages.input.length !== 1 || stages.paint.length !== 1) return [];
|
|
1482
|
+
const [input] = stages.input;
|
|
1483
|
+
const [paint] = stages.paint;
|
|
1484
|
+
if (
|
|
1485
|
+
!input ||
|
|
1486
|
+
!paint ||
|
|
1487
|
+
input.processId !== paint.processId ||
|
|
1488
|
+
input.clockId !== paint.clockId ||
|
|
1489
|
+
!Number.isFinite(input.startedAtMicros) ||
|
|
1490
|
+
!Number.isFinite(paint.endedAtMicros)
|
|
1491
|
+
)
|
|
1492
|
+
return [];
|
|
1493
|
+
return [
|
|
1494
|
+
Object.freeze({
|
|
1495
|
+
traceId,
|
|
1496
|
+
durationMs: (paint.endedAtMicros - input.startedAtMicros) / 1_000,
|
|
1497
|
+
// Input stages record the authority tuple while changed-cell paint
|
|
1498
|
+
// stages carry the generation directly. Accept both shapes so the
|
|
1499
|
+
// report does not discard real same-process samples as unowned.
|
|
1500
|
+
generation: paint.authority?.generation ?? paint.generation ?? null,
|
|
1501
|
+
incarnation: paint.authority?.incarnation ?? paint.incarnation ?? null,
|
|
1502
|
+
processId: paint.processId,
|
|
1503
|
+
clockId: paint.clockId,
|
|
1504
|
+
semanticPaneId: paint.semanticPaneId ?? null,
|
|
1505
|
+
revision: Number.isInteger(paint.revision) ? paint.revision : null,
|
|
1506
|
+
stateHash: typeof paint.stateHash === "string" ? paint.stateHash : null,
|
|
1507
|
+
paintStateIdentity: paint.paintStateIdentity ?? null,
|
|
1508
|
+
}),
|
|
1509
|
+
];
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
export function causalInputSamples(traceRecords, daemonTraceRecords = []) {
|
|
1514
|
+
const inputs = inputPaintSamples(traceRecords);
|
|
1515
|
+
return inputs.map((sample) => {
|
|
1516
|
+
const input = traceRecords.find(
|
|
1517
|
+
(record) =>
|
|
1518
|
+
record?.type === "performance.stage" &&
|
|
1519
|
+
record.traceId === sample.traceId &&
|
|
1520
|
+
record.stage === "input",
|
|
1521
|
+
);
|
|
1522
|
+
const clientStages = traceRecords
|
|
1523
|
+
.filter(
|
|
1524
|
+
(record) =>
|
|
1525
|
+
record?.type === "performance.stage" &&
|
|
1526
|
+
record.traceId === sample.traceId &&
|
|
1527
|
+
record.stage === "client" &&
|
|
1528
|
+
record.processId === sample.processId &&
|
|
1529
|
+
record.clockId === sample.clockId &&
|
|
1530
|
+
Number.isFinite(record.atMicros),
|
|
1531
|
+
)
|
|
1532
|
+
.map((record) => ({
|
|
1533
|
+
operation: record.operation,
|
|
1534
|
+
atMicros: record.atMicros,
|
|
1535
|
+
offsetMs: Number.isFinite(input?.startedAtMicros)
|
|
1536
|
+
? (record.atMicros - input.startedAtMicros) / 1_000
|
|
1537
|
+
: null,
|
|
1538
|
+
causalAttribution: record.causalAttribution === true,
|
|
1539
|
+
semanticPaneId: record.semanticPaneId ?? null,
|
|
1540
|
+
generation: record.generation ?? null,
|
|
1541
|
+
incarnation: record.incarnation ?? null,
|
|
1542
|
+
revision: Number.isInteger(record.revision) ? record.revision : null,
|
|
1543
|
+
stateHash: typeof record.stateHash === "string" ? record.stateHash : null,
|
|
1544
|
+
row: Number.isInteger(record.row) ? record.row : null,
|
|
1545
|
+
column: Number.isInteger(record.column) ? record.column : null,
|
|
1546
|
+
beforeGrapheme: record.beforeGrapheme ?? null,
|
|
1547
|
+
afterGrapheme: record.afterGrapheme ?? null,
|
|
1548
|
+
dirtyRowProved: record.dirtyRowProved === true,
|
|
1549
|
+
inputPending: Number.isFinite(record.inputPending) ? record.inputPending : null,
|
|
1550
|
+
inputInFlight: Number.isFinite(record.inputInFlight) ? record.inputInFlight : null,
|
|
1551
|
+
inputPendingBytes: Number.isFinite(record.inputPendingBytes)
|
|
1552
|
+
? record.inputPendingBytes
|
|
1553
|
+
: null,
|
|
1554
|
+
bufferedAmount: Number.isSafeInteger(record.bufferedAmount) ? record.bufferedAmount : null,
|
|
1555
|
+
frameBytes: Number.isSafeInteger(record.frameBytes) ? record.frameBytes : null,
|
|
1556
|
+
drained: typeof record.drained === "boolean" ? record.drained : null,
|
|
1557
|
+
sharedMicros: Number.isSafeInteger(record.sharedMicros) ? record.sharedMicros : null,
|
|
1558
|
+
clockOffsetLowerMicros: Number.isSafeInteger(record.clockOffsetLowerMicros)
|
|
1559
|
+
? record.clockOffsetLowerMicros
|
|
1560
|
+
: null,
|
|
1561
|
+
clockOffsetUpperMicros: Number.isSafeInteger(record.clockOffsetUpperMicros)
|
|
1562
|
+
? record.clockOffsetUpperMicros
|
|
1563
|
+
: null,
|
|
1564
|
+
clockUncertaintyMicros: Number.isSafeInteger(record.clockUncertaintyMicros)
|
|
1565
|
+
? record.clockUncertaintyMicros
|
|
1566
|
+
: null,
|
|
1567
|
+
clockCalibratedAtMicros: Number.isSafeInteger(record.clockCalibratedAtMicros)
|
|
1568
|
+
? record.clockCalibratedAtMicros
|
|
1569
|
+
: null,
|
|
1570
|
+
clockCalibrationRequestId:
|
|
1571
|
+
typeof record.clockCalibrationRequestId === "string"
|
|
1572
|
+
? record.clockCalibrationRequestId
|
|
1573
|
+
: null,
|
|
1574
|
+
}));
|
|
1575
|
+
const matchingDaemonRecords = daemonTraceRecords.filter(
|
|
1576
|
+
(record) =>
|
|
1577
|
+
record?.type === "performance.stage" &&
|
|
1578
|
+
record.traceId === sample.traceId &&
|
|
1579
|
+
Number.isFinite(record.startedAtMicros) &&
|
|
1580
|
+
Number.isFinite(record.endedAtMicros),
|
|
1581
|
+
);
|
|
1582
|
+
const daemonOrigin = matchingDaemonRecords.find(
|
|
1583
|
+
(record) => record.operation === "raw-input-command",
|
|
1584
|
+
);
|
|
1585
|
+
const daemonSpans = matchingDaemonRecords
|
|
1586
|
+
.filter(
|
|
1587
|
+
(record) =>
|
|
1588
|
+
!daemonOrigin ||
|
|
1589
|
+
(record.processId === daemonOrigin.processId && record.clockId === daemonOrigin.clockId),
|
|
1590
|
+
)
|
|
1591
|
+
.map((record) => ({
|
|
1592
|
+
stage: record.stage,
|
|
1593
|
+
operation: record.operation,
|
|
1594
|
+
startedAtMicros: record.startedAtMicros,
|
|
1595
|
+
endedAtMicros: record.endedAtMicros,
|
|
1596
|
+
// These offsets are daemon-local. They intentionally never subtract
|
|
1597
|
+
// an OpenTUI timestamp from a daemon timestamp.
|
|
1598
|
+
offsetMs: daemonOrigin
|
|
1599
|
+
? (record.startedAtMicros - daemonOrigin.startedAtMicros) / 1_000
|
|
1600
|
+
: null,
|
|
1601
|
+
durationMs: (record.endedAtMicros - record.startedAtMicros) / 1_000,
|
|
1602
|
+
processId: record.processId,
|
|
1603
|
+
clockId: record.clockId,
|
|
1604
|
+
...(Number.isSafeInteger(record.sharedStartedAtMicros)
|
|
1605
|
+
? { sharedStartedAtMicros: record.sharedStartedAtMicros }
|
|
1606
|
+
: {}),
|
|
1607
|
+
...(Number.isSafeInteger(record.sharedEndedAtMicros)
|
|
1608
|
+
? { sharedEndedAtMicros: record.sharedEndedAtMicros }
|
|
1609
|
+
: {}),
|
|
1610
|
+
}));
|
|
1611
|
+
return Object.freeze({ ...sample, clientStages, daemonSpans });
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
export function causalInputSampleHasIncarnation(sample) {
|
|
1616
|
+
return typeof sample?.incarnation === "string" && sample.incarnation.length > 0;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
/** Close one diagnostic input epoch without admitting a second logical probe. */
|
|
1620
|
+
export function causalProbeEpochState(records, baseline, processId) {
|
|
1621
|
+
const epoch = records.slice(baseline);
|
|
1622
|
+
const inputs = epoch.filter(
|
|
1623
|
+
(record) =>
|
|
1624
|
+
record?.type === "performance.stage" &&
|
|
1625
|
+
record.stage === "input" &&
|
|
1626
|
+
record.processId === processId &&
|
|
1627
|
+
typeof record.traceId === "string",
|
|
1628
|
+
);
|
|
1629
|
+
const traceIds = [...new Set(inputs.map(({ traceId }) => traceId))];
|
|
1630
|
+
if (traceIds.length > 1 || inputs.length > 1)
|
|
1631
|
+
return Object.freeze({ status: "ambiguous", traceId: null, reason: "multiple-inputs" });
|
|
1632
|
+
const traceId = traceIds[0];
|
|
1633
|
+
if (!traceId) return Object.freeze({ status: "pending", traceId: null, reason: null });
|
|
1634
|
+
const terminal = epoch.filter(
|
|
1635
|
+
(record) =>
|
|
1636
|
+
record?.type === "performance.stage" &&
|
|
1637
|
+
record.stage === "client" &&
|
|
1638
|
+
record.processId === processId &&
|
|
1639
|
+
record.traceId === traceId &&
|
|
1640
|
+
(record.operation === "causal-cell-painted" ||
|
|
1641
|
+
String(record.operation).startsWith("causal-cell-failed:")),
|
|
1642
|
+
);
|
|
1643
|
+
if (terminal.length > 1)
|
|
1644
|
+
return Object.freeze({ status: "ambiguous", traceId, reason: "multiple-terminals" });
|
|
1645
|
+
if (terminal.length === 0) return Object.freeze({ status: "pending", traceId, reason: null });
|
|
1646
|
+
const operation = terminal[0].operation;
|
|
1647
|
+
return Object.freeze(
|
|
1648
|
+
operation === "causal-cell-painted"
|
|
1649
|
+
? { status: "proved", traceId, reason: null }
|
|
1650
|
+
: { status: "failed", traceId, reason: operation.slice("causal-cell-failed:".length) },
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
export function causalFixtureShellReady(observation) {
|
|
1655
|
+
return (
|
|
1656
|
+
observation?.fixtureOption === "" &&
|
|
1657
|
+
typeof observation?.expectedCommand === "string" &&
|
|
1658
|
+
observation.expectedCommand.length > 0 &&
|
|
1659
|
+
observation.currentCommand === observation.expectedCommand &&
|
|
1660
|
+
typeof observation?.marker === "string" &&
|
|
1661
|
+
observation.marker.length > 0 &&
|
|
1662
|
+
String(observation.nativeFrame).includes(observation.marker) &&
|
|
1663
|
+
String(observation.tuiBody).includes(observation.marker) &&
|
|
1664
|
+
observation.canonicalWraparound === true &&
|
|
1665
|
+
observation.inputPending === 0 &&
|
|
1666
|
+
observation.inputInFlight === 0 &&
|
|
1667
|
+
observation.inputPendingBytes === 0 &&
|
|
1668
|
+
observation.geometryStable === true
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
export function latestCausalFixtureCanonicalMode(records, baseline, expected) {
|
|
1673
|
+
return (
|
|
1674
|
+
records
|
|
1675
|
+
.slice(baseline)
|
|
1676
|
+
.findLast(
|
|
1677
|
+
(record) =>
|
|
1678
|
+
record?.type === "performance.terminal-canonical-mode" &&
|
|
1679
|
+
record.processId === expected.processId &&
|
|
1680
|
+
record.semanticPaneId === expected.semanticPaneId &&
|
|
1681
|
+
record.generation === expected.generation &&
|
|
1682
|
+
record.incarnation === expected.incarnation,
|
|
1683
|
+
) ?? null
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
export function latestCausalFixtureCanonicalWraparound(records, baseline, expected) {
|
|
1688
|
+
return latestCausalFixtureCanonicalMode(records, baseline, expected)?.wraparound === true;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
export function causalFixtureTeardownDiagnostic(observation) {
|
|
1692
|
+
const queueZero =
|
|
1693
|
+
observation?.inputPending === 0 &&
|
|
1694
|
+
observation.inputInFlight === 0 &&
|
|
1695
|
+
observation.inputPendingBytes === 0;
|
|
1696
|
+
return Object.freeze({
|
|
1697
|
+
optionEmpty: observation?.fixtureOption === "",
|
|
1698
|
+
commandMatches:
|
|
1699
|
+
typeof observation?.expectedCommand === "string" &&
|
|
1700
|
+
observation.expectedCommand.length > 0 &&
|
|
1701
|
+
observation.currentCommand === observation.expectedCommand,
|
|
1702
|
+
markerNative: Number.isInteger(observation?.markerNativeIndex),
|
|
1703
|
+
markerNativeIndex: Number.isInteger(observation?.markerNativeIndex)
|
|
1704
|
+
? observation.markerNativeIndex
|
|
1705
|
+
: null,
|
|
1706
|
+
markerTui: Number.isInteger(observation?.markerTuiIndex),
|
|
1707
|
+
markerTuiIndex: Number.isInteger(observation?.markerTuiIndex)
|
|
1708
|
+
? observation.markerTuiIndex
|
|
1709
|
+
: null,
|
|
1710
|
+
canonicalWraparound: observation?.canonicalWraparound === true,
|
|
1711
|
+
canonical:
|
|
1712
|
+
observation?.canonical && typeof observation.canonical === "object"
|
|
1713
|
+
? Object.freeze({
|
|
1714
|
+
revision: Number.isInteger(observation.canonical.revision)
|
|
1715
|
+
? observation.canonical.revision
|
|
1716
|
+
: null,
|
|
1717
|
+
stateHash:
|
|
1718
|
+
typeof observation.canonical.stateHash === "string"
|
|
1719
|
+
? observation.canonical.stateHash.slice(0, 128)
|
|
1720
|
+
: null,
|
|
1721
|
+
incarnation:
|
|
1722
|
+
typeof observation.canonical.incarnation === "string"
|
|
1723
|
+
? observation.canonical.incarnation.slice(0, 128)
|
|
1724
|
+
: null,
|
|
1725
|
+
wraparound: observation.canonical.wraparound === true,
|
|
1726
|
+
})
|
|
1727
|
+
: null,
|
|
1728
|
+
queueZero,
|
|
1729
|
+
queue: Object.freeze({
|
|
1730
|
+
type: typeof observation?.queueType === "string" ? observation.queueType.slice(0, 64) : null,
|
|
1731
|
+
operation:
|
|
1732
|
+
typeof observation?.queueOperation === "string"
|
|
1733
|
+
? observation.queueOperation.slice(0, 64)
|
|
1734
|
+
: null,
|
|
1735
|
+
traceId:
|
|
1736
|
+
typeof observation?.queueTraceId === "string"
|
|
1737
|
+
? observation.queueTraceId.slice(0, 128)
|
|
1738
|
+
: null,
|
|
1739
|
+
atMicros: Number.isFinite(observation?.queueAtMicros) ? observation.queueAtMicros : null,
|
|
1740
|
+
inputPending: Number.isFinite(observation?.inputPending) ? observation.inputPending : null,
|
|
1741
|
+
inputInFlight: Number.isFinite(observation?.inputInFlight) ? observation.inputInFlight : null,
|
|
1742
|
+
inputPendingBytes: Number.isFinite(observation?.inputPendingBytes)
|
|
1743
|
+
? observation.inputPendingBytes
|
|
1744
|
+
: null,
|
|
1745
|
+
}),
|
|
1746
|
+
geometryStable: observation?.geometryStable === true,
|
|
1747
|
+
geometryBefore:
|
|
1748
|
+
typeof observation?.geometryBefore === "string"
|
|
1749
|
+
? observation.geometryBefore.slice(0, 256)
|
|
1750
|
+
: null,
|
|
1751
|
+
geometryAfter:
|
|
1752
|
+
typeof observation?.geometryAfter === "string"
|
|
1753
|
+
? observation.geometryAfter.slice(0, 256)
|
|
1754
|
+
: null,
|
|
1755
|
+
nativeHash:
|
|
1756
|
+
typeof observation?.nativeHash === "string" ? observation.nativeHash.slice(0, 128) : null,
|
|
1757
|
+
bodyHash: typeof observation?.bodyHash === "string" ? observation.bodyHash.slice(0, 128) : null,
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Ordered diagnostic→resource phase boundary. The release callback is the
|
|
1763
|
+
* only authority to dispatch resource workload and is never called on an
|
|
1764
|
+
* observation error or deadline. Dependencies are injected so the complete
|
|
1765
|
+
* ordering is deterministic under test rather than inferred from source.
|
|
1766
|
+
*/
|
|
1767
|
+
export async function runCausalFixtureTeardownGate(options) {
|
|
1768
|
+
const now = options.now ?? Date.now;
|
|
1769
|
+
const wait = options.wait ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1770
|
+
const timeoutMs = options.timeoutMs ?? 5_000;
|
|
1771
|
+
const stableMs = options.stableMs ?? 100;
|
|
1772
|
+
const pollMs = options.pollMs ?? 25;
|
|
1773
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
|
|
1774
|
+
throw new TypeError("Causal fixture teardown timeout must be positive");
|
|
1775
|
+
const deadline = now() + timeoutMs;
|
|
1776
|
+
let markerSent = false;
|
|
1777
|
+
let markerSentAt = null;
|
|
1778
|
+
let stableIdentity = null;
|
|
1779
|
+
let stableSince = 0;
|
|
1780
|
+
let firstReadyAt = null;
|
|
1781
|
+
let maximumStableMs = 0;
|
|
1782
|
+
let observationCount = 0;
|
|
1783
|
+
let readyObservationCount = 0;
|
|
1784
|
+
let identityChanges = 0;
|
|
1785
|
+
const identityDeltaFields = new Set();
|
|
1786
|
+
let previousStabilityParts = null;
|
|
1787
|
+
let lastDiagnostic = null;
|
|
1788
|
+
await options.interrupt();
|
|
1789
|
+
while (now() <= deadline) {
|
|
1790
|
+
let observation;
|
|
1791
|
+
try {
|
|
1792
|
+
observation = await options.observe();
|
|
1793
|
+
} catch (cause) {
|
|
1794
|
+
throw new Error(
|
|
1795
|
+
`causal-cell fixture teardown observation failed: ${JSON.stringify({ observationCount, last: lastDiagnostic })}`,
|
|
1796
|
+
{ cause },
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1799
|
+
observationCount += 1;
|
|
1800
|
+
lastDiagnostic = causalFixtureTeardownDiagnostic(observation);
|
|
1801
|
+
if (
|
|
1802
|
+
!markerSent &&
|
|
1803
|
+
observation.fixtureOption === "" &&
|
|
1804
|
+
observation.currentCommand === observation.expectedCommand
|
|
1805
|
+
) {
|
|
1806
|
+
await options.sendShellMarker();
|
|
1807
|
+
markerSent = true;
|
|
1808
|
+
markerSentAt = now();
|
|
1809
|
+
stableIdentity = null;
|
|
1810
|
+
stableSince = now();
|
|
1811
|
+
}
|
|
1812
|
+
const ready = markerSent && causalFixtureShellReady(observation);
|
|
1813
|
+
const identity = ready ? observation.stabilityIdentity : null;
|
|
1814
|
+
const sampledAt = now();
|
|
1815
|
+
if (ready) {
|
|
1816
|
+
readyObservationCount += 1;
|
|
1817
|
+
firstReadyAt ??= sampledAt;
|
|
1818
|
+
}
|
|
1819
|
+
if (ready && typeof identity === "string" && identity === stableIdentity) {
|
|
1820
|
+
maximumStableMs = Math.max(maximumStableMs, sampledAt - stableSince);
|
|
1821
|
+
if (sampledAt - stableSince >= stableMs) {
|
|
1822
|
+
await options.releaseResource();
|
|
1823
|
+
return Object.freeze({ canDispatchResource: true });
|
|
1824
|
+
}
|
|
1825
|
+
} else {
|
|
1826
|
+
if (ready && stableIdentity !== null && identity !== stableIdentity) identityChanges += 1;
|
|
1827
|
+
if (ready && previousStabilityParts && observation.stabilityParts) {
|
|
1828
|
+
for (const key of new Set([
|
|
1829
|
+
...Object.keys(previousStabilityParts),
|
|
1830
|
+
...Object.keys(observation.stabilityParts),
|
|
1831
|
+
])) {
|
|
1832
|
+
if (previousStabilityParts[key] !== observation.stabilityParts[key])
|
|
1833
|
+
identityDeltaFields.add(key);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
stableIdentity = identity;
|
|
1837
|
+
stableSince = sampledAt;
|
|
1838
|
+
}
|
|
1839
|
+
previousStabilityParts = ready ? (observation.stabilityParts ?? null) : null;
|
|
1840
|
+
await wait(pollMs);
|
|
1841
|
+
}
|
|
1842
|
+
const failedPredicates = lastDiagnostic
|
|
1843
|
+
? [
|
|
1844
|
+
["option-empty", lastDiagnostic.optionEmpty],
|
|
1845
|
+
["command-matches", lastDiagnostic.commandMatches],
|
|
1846
|
+
["marker-native", lastDiagnostic.markerNative],
|
|
1847
|
+
["marker-tui", lastDiagnostic.markerTui],
|
|
1848
|
+
["canonical-wraparound", lastDiagnostic.canonicalWraparound],
|
|
1849
|
+
["queue-zero", lastDiagnostic.queueZero],
|
|
1850
|
+
["geometry-stable", lastDiagnostic.geometryStable],
|
|
1851
|
+
]
|
|
1852
|
+
.filter(([, passed]) => !passed)
|
|
1853
|
+
.map(([name]) => name)
|
|
1854
|
+
: ["no-observation"];
|
|
1855
|
+
const failureKind =
|
|
1856
|
+
failedPredicates.length > 0
|
|
1857
|
+
? "predicate-failed"
|
|
1858
|
+
: identityChanges > 0
|
|
1859
|
+
? "stability-identity-churn"
|
|
1860
|
+
: "stability-window-incomplete";
|
|
1861
|
+
throw new Error(
|
|
1862
|
+
`causal-cell fixture did not restore a quiet interactive shell: ${JSON.stringify({
|
|
1863
|
+
failureKind,
|
|
1864
|
+
failedPredicates,
|
|
1865
|
+
observationCount,
|
|
1866
|
+
readyObservationCount,
|
|
1867
|
+
markerSentAt,
|
|
1868
|
+
firstReadyAt,
|
|
1869
|
+
maximumStableMs,
|
|
1870
|
+
identityChanges,
|
|
1871
|
+
identityDeltaFields: [...identityDeltaFields].sort().slice(0, 32),
|
|
1872
|
+
last: lastDiagnostic,
|
|
1873
|
+
})}`,
|
|
1874
|
+
);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
export function summarizeProductResources(clientStages, deliveries, endpointTraceIds = null) {
|
|
1878
|
+
const workloadMemorySamples = clientStages.flatMap((record, ordinal) =>
|
|
1879
|
+
Number.isFinite(record.rssBytes) && Number.isFinite(record.heapUsedBytes)
|
|
1880
|
+
? [
|
|
1881
|
+
{
|
|
1882
|
+
traceKey: record.traceId ?? `untraced:${ordinal}`,
|
|
1883
|
+
rssBytes: record.rssBytes,
|
|
1884
|
+
heapUsedBytes: record.heapUsedBytes,
|
|
1885
|
+
},
|
|
1886
|
+
]
|
|
1887
|
+
: [],
|
|
1888
|
+
);
|
|
1889
|
+
// A trace emits several causal stage records with the same process-memory
|
|
1890
|
+
// observation. Retained growth is evaluated from the final observation of
|
|
1891
|
+
// each bounded post-workload probe, not from the native allocator's
|
|
1892
|
+
// transient first-render/flood high-water. The full workload peak remains in
|
|
1893
|
+
// the report so a transient regression is still visible rather than hidden.
|
|
1894
|
+
const byTrace = new Map();
|
|
1895
|
+
for (const sample of workloadMemorySamples) byTrace.set(sample.traceKey, sample);
|
|
1896
|
+
const endpointSet = endpointTraceIds ? new Set(endpointTraceIds) : null;
|
|
1897
|
+
const memorySamples = [...byTrace.values()]
|
|
1898
|
+
.filter((sample) => endpointSet === null || endpointSet.has(sample.traceKey))
|
|
1899
|
+
.slice(endpointSet === null ? -16 : 0)
|
|
1900
|
+
.map(({ rssBytes, heapUsedBytes }) => ({ rssBytes, heapUsedBytes }));
|
|
1901
|
+
const rss = memorySamples.map(({ rssBytes }) => rssBytes);
|
|
1902
|
+
const heap = memorySamples.map(({ heapUsedBytes }) => heapUsedBytes);
|
|
1903
|
+
const settledInput = clientStages.findLast(
|
|
1904
|
+
(record) => Number.isFinite(record.inputPending) && Number.isFinite(record.inputInFlight),
|
|
1905
|
+
);
|
|
1906
|
+
return Object.freeze({
|
|
1907
|
+
inputPendingPeak: Math.max(0, ...clientStages.map((record) => record.inputPending ?? 0)),
|
|
1908
|
+
inputPendingBytesPeak: Math.max(
|
|
1909
|
+
0,
|
|
1910
|
+
...clientStages.map((record) => record.inputPendingBytes ?? 0),
|
|
1911
|
+
),
|
|
1912
|
+
inputInFlightPeak: Math.max(0, ...clientStages.map((record) => record.inputInFlight ?? 0)),
|
|
1913
|
+
settledInputPending: settledInput?.inputPending ?? null,
|
|
1914
|
+
settledInputInFlight: settledInput?.inputInFlight ?? null,
|
|
1915
|
+
deliveryQueuePeak: Math.max(0, ...deliveries.map((record) => record.queuePeak ?? 0)),
|
|
1916
|
+
deliveryQueueCapacity: Math.max(0, ...deliveries.map((record) => record.queueCapacity ?? 0)),
|
|
1917
|
+
settledDeliveryQueueDepth: Math.max(
|
|
1918
|
+
0,
|
|
1919
|
+
...deliveries.map((record) => record.settledQueueDepth ?? 0),
|
|
1920
|
+
),
|
|
1921
|
+
revisionLagPeak: Math.max(0, ...deliveries.map((record) => record.revisionLagPeak ?? 0)),
|
|
1922
|
+
memorySampleCount: memorySamples.length,
|
|
1923
|
+
workloadMemorySampleCount: workloadMemorySamples.length,
|
|
1924
|
+
rssWorkloadPeakBytes: Math.max(0, ...workloadMemorySamples.map(({ rssBytes }) => rssBytes)),
|
|
1925
|
+
heapWorkloadPeakBytes: Math.max(
|
|
1926
|
+
0,
|
|
1927
|
+
...workloadMemorySamples.map(({ heapUsedBytes }) => heapUsedBytes),
|
|
1928
|
+
),
|
|
1929
|
+
rssPeakBytes: Math.max(0, ...rss),
|
|
1930
|
+
heapPeakBytes: Math.max(0, ...heap),
|
|
1931
|
+
// Growth is an ordered quiescent endpoint delta. max-min misclassifies a
|
|
1932
|
+
// normal GC cycle (large early heap, smaller later heap) as retained growth.
|
|
1933
|
+
// Transient high-water remains visible through the explicit peak fields.
|
|
1934
|
+
rssGrowthBytes: rss.length > 0 ? Math.max(0, rss.at(-1) - rss[0]) : null,
|
|
1935
|
+
heapGrowthBytes: heap.length > 0 ? Math.max(0, heap.at(-1) - heap[0]) : null,
|
|
1936
|
+
rssRobustSlopeBytesPerSample: rss.length >= 4 ? theilSenSlope(rss) : null,
|
|
1937
|
+
heapRobustSlopeBytesPerSample: heap.length >= 4 ? theilSenSlope(heap) : null,
|
|
1938
|
+
deliverySamples: deliveries.length,
|
|
1939
|
+
memorySamples: Object.freeze(memorySamples),
|
|
1940
|
+
});
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
function causalInputSummary(samples) {
|
|
1944
|
+
const expectedClientOperations = [
|
|
1945
|
+
"lane-enqueue",
|
|
1946
|
+
"transport-send-start",
|
|
1947
|
+
"transport-ack",
|
|
1948
|
+
"socket-frame-arrival",
|
|
1949
|
+
"delivery-received",
|
|
1950
|
+
"lane-published",
|
|
1951
|
+
"causal-cell-delivered",
|
|
1952
|
+
"causal-cell-painted",
|
|
1953
|
+
];
|
|
1954
|
+
const finalized = samples.filter((sample) =>
|
|
1955
|
+
sample.clientStages.some((stage) => stage.operation === "causal-cell-painted"),
|
|
1956
|
+
);
|
|
1957
|
+
const summarizeOffsets = (side, operations) =>
|
|
1958
|
+
Object.freeze(
|
|
1959
|
+
Object.fromEntries(
|
|
1960
|
+
operations.map((operation) => {
|
|
1961
|
+
const values = samples.flatMap((sample) => {
|
|
1962
|
+
const record = sample[side].find((entry) => entry.operation === operation);
|
|
1963
|
+
return Number.isFinite(record?.offsetMs) ? [record.offsetMs] : [];
|
|
1964
|
+
});
|
|
1965
|
+
return [
|
|
1966
|
+
operation,
|
|
1967
|
+
Object.freeze({ samples: values.length, p95Ms: percentile(values, 0.95) }),
|
|
1968
|
+
];
|
|
1969
|
+
}),
|
|
1970
|
+
),
|
|
1971
|
+
);
|
|
1972
|
+
const transition = (from, to) => {
|
|
1973
|
+
const values = samples.flatMap((sample) => {
|
|
1974
|
+
const start = sample.daemonSpans.find((entry) => entry.operation === from);
|
|
1975
|
+
const end = sample.daemonSpans.find((entry) => entry.operation === to);
|
|
1976
|
+
return Number.isFinite(start?.offsetMs) && Number.isFinite(end?.offsetMs)
|
|
1977
|
+
? [end.offsetMs - start.offsetMs]
|
|
1978
|
+
: [];
|
|
1979
|
+
});
|
|
1980
|
+
return Object.freeze({ samples: values.length, p95Ms: percentile(values, 0.95) });
|
|
1981
|
+
};
|
|
1982
|
+
return Object.freeze({
|
|
1983
|
+
correlation: "causal-cell-v1",
|
|
1984
|
+
causalAttribution: finalized.length >= 30 && finalized.length === samples.length,
|
|
1985
|
+
finalizedProofs: finalized.length,
|
|
1986
|
+
firstBrokenStage:
|
|
1987
|
+
samples.length < 30
|
|
1988
|
+
? "input-or-paint-pair"
|
|
1989
|
+
: (expectedClientOperations.find((operation) =>
|
|
1990
|
+
samples.some(
|
|
1991
|
+
(sample) => !sample.clientStages.some((stage) => stage.operation === operation),
|
|
1992
|
+
),
|
|
1993
|
+
) ?? null),
|
|
1994
|
+
clientOperationOffsets: summarizeOffsets("clientStages", [
|
|
1995
|
+
"lane-enqueue",
|
|
1996
|
+
"transport-send-start",
|
|
1997
|
+
"transport-ack",
|
|
1998
|
+
"socket-frame-arrival",
|
|
1999
|
+
"delivery-received",
|
|
2000
|
+
"lane-published",
|
|
2001
|
+
"render-invalidated",
|
|
2002
|
+
]),
|
|
2003
|
+
daemonOperationOffsets: summarizeOffsets("daemonSpans", [
|
|
2004
|
+
"raw-input-command",
|
|
2005
|
+
"control-write",
|
|
2006
|
+
"control-command-accepted",
|
|
2007
|
+
"daemon-event-loop-turn",
|
|
2008
|
+
"tmux-output-server-age",
|
|
2009
|
+
"control-stdout-parse",
|
|
2010
|
+
"control-output-to-replica",
|
|
2011
|
+
"first-output-observed",
|
|
2012
|
+
"terminal-replica-write",
|
|
2013
|
+
"terminal-replica-project-commit",
|
|
2014
|
+
"terminal-delivery-encode-enqueue",
|
|
2015
|
+
"pane-stream-socket-send",
|
|
2016
|
+
]),
|
|
2017
|
+
daemonTransitions: Object.freeze({
|
|
2018
|
+
controlWriteToFirstOutput: transition("control-write", "first-output-observed"),
|
|
2019
|
+
firstOutputToSocketSend: transition("first-output-observed", "pane-stream-socket-send"),
|
|
2020
|
+
}),
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
export function buildProductDiagnosticReport({
|
|
2025
|
+
state,
|
|
2026
|
+
truth,
|
|
2027
|
+
lifecycle,
|
|
2028
|
+
traceRecords,
|
|
2029
|
+
daemonTraceRecords = [],
|
|
2030
|
+
stderr,
|
|
2031
|
+
warmCoherentSamples = [],
|
|
2032
|
+
warmCoherentJourneys = [],
|
|
2033
|
+
runtimeResourceRetirements = [],
|
|
2034
|
+
windowSwitchSamples = [],
|
|
2035
|
+
resizeGuideSamples = [],
|
|
2036
|
+
framebufferEvidence = null,
|
|
2037
|
+
idleObservation = null,
|
|
2038
|
+
idleProcessObservations = [],
|
|
2039
|
+
hostedRendererRetirement = null,
|
|
2040
|
+
resourceObservation = null,
|
|
2041
|
+
qualifyingInputEvidence = [],
|
|
2042
|
+
}) {
|
|
2043
|
+
const generation = state?.daemon?.instanceId ?? null;
|
|
2044
|
+
const connectionIndex = lifecycle.findLastIndex(
|
|
2045
|
+
(entry) =>
|
|
2046
|
+
entry?.phase === "generation-connection-resolved" && entry?.daemonGeneration === generation,
|
|
2047
|
+
);
|
|
2048
|
+
const currentLifecycle = connectionIndex >= 0 ? lifecycle.slice(connectionIndex) : [];
|
|
2049
|
+
const shellLive = currentLifecycle.find(
|
|
2050
|
+
(entry) =>
|
|
2051
|
+
entry?.phase === "generation-shell-lifecycle" &&
|
|
2052
|
+
entry?.clientPhase === "live" &&
|
|
2053
|
+
entry?.shellStatus === "live",
|
|
2054
|
+
);
|
|
2055
|
+
const coherent = currentLifecycle.find(
|
|
2056
|
+
(entry) => entry?.phase === "generation-runtime-progress" && entry?.runtimePhase === "coherent",
|
|
2057
|
+
);
|
|
2058
|
+
const generationLive = currentLifecycle.find(
|
|
2059
|
+
(entry) =>
|
|
2060
|
+
entry?.phase === "generation-status" &&
|
|
2061
|
+
entry?.status === "live" &&
|
|
2062
|
+
entry?.daemonGeneration === generation,
|
|
2063
|
+
);
|
|
2064
|
+
const painted = currentLifecycle.find(
|
|
2065
|
+
(entry) => entry?.phase === "first-terminal-frame" && entry?.daemonGeneration === generation,
|
|
2066
|
+
);
|
|
2067
|
+
const activeTraceProcess = traceRecords.findLast(
|
|
2068
|
+
(record) => record?.type === "performance.trace.header",
|
|
2069
|
+
)?.processId;
|
|
2070
|
+
const qualifyingTraceEvidence = new Map(
|
|
2071
|
+
qualifyingInputEvidence.map((entry) => [entry.traceId, entry]),
|
|
2072
|
+
);
|
|
2073
|
+
const qualifies = (sample) =>
|
|
2074
|
+
sample.generation === generation &&
|
|
2075
|
+
sample.processId === activeTraceProcess &&
|
|
2076
|
+
sample.paintStateIdentity === "latest-canonical-state-blitted" &&
|
|
2077
|
+
(() => {
|
|
2078
|
+
const evidence = qualifyingTraceEvidence.get(sample.traceId);
|
|
2079
|
+
return (
|
|
2080
|
+
evidence?.paintStateIdentity === "latest-canonical-state-blitted" &&
|
|
2081
|
+
evidence.causalAttribution === true &&
|
|
2082
|
+
Number.isInteger(evidence.row) &&
|
|
2083
|
+
Number.isInteger(evidence.column) &&
|
|
2084
|
+
typeof evidence.beforeGrapheme === "string" &&
|
|
2085
|
+
typeof evidence.afterGrapheme === "string" &&
|
|
2086
|
+
evidence.markerVisibleInNative === true &&
|
|
2087
|
+
evidence?.markerVisibleInPaneRect === true &&
|
|
2088
|
+
evidence.semanticPaneId === sample.semanticPaneId &&
|
|
2089
|
+
evidence.revision === sample.revision &&
|
|
2090
|
+
evidence.stateHash === sample.stateHash
|
|
2091
|
+
);
|
|
2092
|
+
})();
|
|
2093
|
+
const inputSamples = inputPaintSamples(traceRecords).filter(qualifies);
|
|
2094
|
+
const causalSamples = causalInputSamples(traceRecords, daemonTraceRecords).filter(qualifies);
|
|
2095
|
+
const inputCausalSummary = causalInputSummary(causalSamples);
|
|
2096
|
+
const outputTransition = inputCausalSummary.daemonTransitions.controlWriteToFirstOutput;
|
|
2097
|
+
const firstBrokenInputBoundary = inputCausalSummary.firstBrokenStage;
|
|
2098
|
+
const inputDurations = inputSamples.map(({ durationMs }) => durationMs);
|
|
2099
|
+
const inputP95 = percentile(inputDurations, 0.95);
|
|
2100
|
+
const inputP99 = percentile(inputDurations, 0.99);
|
|
2101
|
+
const warmCoherentP95 = percentile(warmCoherentSamples, 0.95);
|
|
2102
|
+
const warmLaunchSamples = warmCoherentJourneys
|
|
2103
|
+
.map(({ launchToHostMs }) => launchToHostMs)
|
|
2104
|
+
.filter(Number.isFinite);
|
|
2105
|
+
const warmLaunchP95 = percentile(warmLaunchSamples, 0.95);
|
|
2106
|
+
const windowSwitchP95 = percentile(windowSwitchSamples, 0.95);
|
|
2107
|
+
const resizeGuideP95 = percentile(resizeGuideSamples, 0.95);
|
|
2108
|
+
const traceIntegrity = traceRecords.findLast(
|
|
2109
|
+
(record) => record?.type === "performance.trace.summary",
|
|
2110
|
+
);
|
|
2111
|
+
const traceIntegrityPassed = traceIntegrity
|
|
2112
|
+
? traceIntegrity.acceptedRecords > 0 &&
|
|
2113
|
+
traceIntegrity.droppedRecords === 0 &&
|
|
2114
|
+
traceIntegrity.oversizedRecords === 0 &&
|
|
2115
|
+
traceIntegrity.failed === false &&
|
|
2116
|
+
traceIntegrity.saturated === false &&
|
|
2117
|
+
traceIntegrity.pendingInputs === 0 &&
|
|
2118
|
+
traceIntegrity.droppedInputs === 0
|
|
2119
|
+
: null;
|
|
2120
|
+
const classify = (id, passed, detail) => ({
|
|
2121
|
+
id,
|
|
2122
|
+
status: passed === null ? "unmeasured" : passed ? "passed" : "failed",
|
|
2123
|
+
detail,
|
|
2124
|
+
});
|
|
2125
|
+
const boundaries = [
|
|
2126
|
+
classify(
|
|
2127
|
+
"tmux-truth",
|
|
2128
|
+
Boolean(truth?.session) && (truth?.panes?.length ?? 0) > 0,
|
|
2129
|
+
`${truth?.panes?.length ?? 0} panes / ${truth?.windows?.length ?? 0} windows`,
|
|
2130
|
+
),
|
|
2131
|
+
classify(
|
|
2132
|
+
"daemon-generation",
|
|
2133
|
+
state?.status === "ready" && typeof generation === "string",
|
|
2134
|
+
generation ?? "no live daemon generation",
|
|
2135
|
+
),
|
|
2136
|
+
classify(
|
|
2137
|
+
"workspace-client-commit",
|
|
2138
|
+
Boolean(shellLive),
|
|
2139
|
+
shellLive ? `${shellLive.inventoryResources ?? 0} committed resources` : "no live commit",
|
|
2140
|
+
),
|
|
2141
|
+
classify(
|
|
2142
|
+
"terminal-fast-lane",
|
|
2143
|
+
Boolean(coherent && generationLive),
|
|
2144
|
+
coherent
|
|
2145
|
+
? `${coherent.seededPanes ?? 0}/${coherent.panes ?? 0} pane seeds coherent`
|
|
2146
|
+
: "no coherent generation runtime",
|
|
2147
|
+
),
|
|
2148
|
+
classify(
|
|
2149
|
+
"tui-painted-frame",
|
|
2150
|
+
Boolean(painted && coherent && painted.elapsedMs >= coherent.elapsedMs),
|
|
2151
|
+
painted
|
|
2152
|
+
? `coherent ${coherent?.elapsedMs ?? "?"}ms → paint ${painted.elapsedMs}ms`
|
|
2153
|
+
: "no generation-fenced changed-cell paint",
|
|
2154
|
+
),
|
|
2155
|
+
classify(
|
|
2156
|
+
"tui-framebuffer-content",
|
|
2157
|
+
framebufferEvidence ? framebufferEvidence.passed === true : null,
|
|
2158
|
+
framebufferEvidence?.detail ?? "no per-active-window-pane rectangle proof",
|
|
2159
|
+
),
|
|
2160
|
+
classify(
|
|
2161
|
+
"web-tui-authority-restart",
|
|
2162
|
+
state?.convergence?.restart
|
|
2163
|
+
? state.convergence.restart.webRecovered === true &&
|
|
2164
|
+
state.convergence.restart.tuiRecovered === true &&
|
|
2165
|
+
state.convergence.restart.hostedTuiInputPainted === true
|
|
2166
|
+
: false,
|
|
2167
|
+
state?.convergence?.restart
|
|
2168
|
+
? `${state.convergence.restart.elapsedMs}ms full restart journey`
|
|
2169
|
+
: "restart journey absent",
|
|
2170
|
+
),
|
|
2171
|
+
classify(
|
|
2172
|
+
"reference-trace-integrity",
|
|
2173
|
+
traceIntegrityPassed,
|
|
2174
|
+
traceIntegrity
|
|
2175
|
+
? `${traceIntegrity.acceptedRecords} accepted; ${traceIntegrity.droppedRecords} dropped; ${traceIntegrity.oversizedRecords} oversized; failed ${traceIntegrity.failed}; pending inputs ${traceIntegrity.pendingInputs}; dropped inputs ${traceIntegrity.droppedInputs}`
|
|
2176
|
+
: "no closed reference trace summary",
|
|
2177
|
+
),
|
|
2178
|
+
classify(
|
|
2179
|
+
"input-enqueue-to-correlated-changed-cell-paint",
|
|
2180
|
+
inputSamples.length < 30
|
|
2181
|
+
? null
|
|
2182
|
+
: inputCausalSummary.causalAttribution && inputP95 <= 16.67 && inputP99 <= 33,
|
|
2183
|
+
`${inputSamples.length}/30 renderer-correlated samples; p95 ${inputP95 ?? "?"}ms; p99 ${inputP99 ?? "?"}ms; causal attribution ${inputCausalSummary.causalAttribution}${firstBrokenInputBoundary ? `; first broken ${firstBrokenInputBoundary}` : ""}${outputTransition.samples > 0 ? `; output transition p95 ${outputTransition.p95Ms}ms` : ""}`,
|
|
2184
|
+
),
|
|
2185
|
+
classify(
|
|
2186
|
+
"resize-guide-preview",
|
|
2187
|
+
resizeGuideSamples.length < 20 ? null : resizeGuideP95 <= 16.67,
|
|
2188
|
+
`${resizeGuideSamples.length}/20 samples; p95 ${resizeGuideP95 ?? "?"}ms`,
|
|
2189
|
+
),
|
|
2190
|
+
classify(
|
|
2191
|
+
"warm-window-switch",
|
|
2192
|
+
windowSwitchSamples.length < 30 ? null : windowSwitchP95 <= 150,
|
|
2193
|
+
`${windowSwitchSamples.length}/30 samples; p95 ${windowSwitchP95 ?? "?"}ms`,
|
|
2194
|
+
),
|
|
2195
|
+
classify(
|
|
2196
|
+
"warm-coherent-terminal-frame",
|
|
2197
|
+
warmCoherentSamples.length < WARM_COHERENT_SAMPLE_COUNT ? null : warmCoherentP95 <= 750,
|
|
2198
|
+
`${warmCoherentSamples.length}/${WARM_COHERENT_SAMPLE_COUNT} connection→host-publication samples; p95 ${warmCoherentP95 ?? "?"}ms`,
|
|
2199
|
+
),
|
|
2200
|
+
classify(
|
|
2201
|
+
"warm-process-launch-to-host-publication",
|
|
2202
|
+
warmLaunchSamples.length < WARM_COHERENT_SAMPLE_COUNT ? null : warmLaunchP95 <= 750,
|
|
2203
|
+
`${warmLaunchSamples.length}/${WARM_COHERENT_SAMPLE_COUNT} fresh-process launch→host-publication samples; p95 ${warmLaunchP95 ?? "?"}ms`,
|
|
2204
|
+
),
|
|
2205
|
+
classify(
|
|
2206
|
+
"runtime-resource-retirement",
|
|
2207
|
+
runtimeResourceRetirements.length < WARM_COHERENT_SAMPLE_COUNT
|
|
2208
|
+
? null
|
|
2209
|
+
: runtimeResourceRetirements.every(({ passed }) => passed === true),
|
|
2210
|
+
`${runtimeResourceRetirements.filter(({ passed }) => passed === true).length}/${WARM_COHERENT_SAMPLE_COUNT} rehosts returned sockets/listeners/supervisors/subscriptions/runtime timers to zero; in-close snapshots permit only the one instrumented enclosing shutdown deadline`,
|
|
2211
|
+
),
|
|
2212
|
+
classify(
|
|
2213
|
+
"idle-frame-work",
|
|
2214
|
+
idleObservation
|
|
2215
|
+
? idleObservation.durationMs >= 10_000 &&
|
|
2216
|
+
idleObservation.frameCount === 0 &&
|
|
2217
|
+
idleObservation.terminalPaints === 0 &&
|
|
2218
|
+
idleObservation.zeroDirtyPaints === 0 &&
|
|
2219
|
+
idleObservation.framebufferStable === true
|
|
2220
|
+
: null,
|
|
2221
|
+
idleObservation
|
|
2222
|
+
? `${idleObservation.durationMs}ms idle; ${idleObservation.frameCount} renderer frames; ${idleObservation.terminalPaints} terminal paints; framebuffer stable ${idleObservation.framebufferStable}`
|
|
2223
|
+
: "no renderer dirty-frame/idle-window sample",
|
|
2224
|
+
),
|
|
2225
|
+
classify(
|
|
2226
|
+
"idle-os-cpu-and-singleton-ownership",
|
|
2227
|
+
idleProcessObservations.length < 2
|
|
2228
|
+
? null
|
|
2229
|
+
: idleProcessObservations.every(({ status }) => status === "passed"),
|
|
2230
|
+
idleProcessObservations.length > 0
|
|
2231
|
+
? idleProcessObservations
|
|
2232
|
+
.map(
|
|
2233
|
+
({ label, durationMs, combinedCpuDeltaMs, combinedBudgetMs, ledger, work }) =>
|
|
2234
|
+
`${label}: ${durationMs}ms, CPU ${combinedCpuDeltaMs}/${combinedBudgetMs}ms, ${ledger.filter(({ singleton, identityStable }) => singleton && identityStable).length}/2 exact singleton identities, grid/full/reconnect/pending ${work.gridWork}/${work.fullBlits}/${work.reconnects}/${work.pendingWork}`,
|
|
2235
|
+
)
|
|
2236
|
+
.join("; ")
|
|
2237
|
+
: "no OS CPU/process-ownership idle windows",
|
|
2238
|
+
),
|
|
2239
|
+
classify(
|
|
2240
|
+
"hosted-renderer-retirement",
|
|
2241
|
+
hostedRendererRetirement?.status === "unmeasured"
|
|
2242
|
+
? null
|
|
2243
|
+
: hostedRendererRetirement?.status === "passed",
|
|
2244
|
+
hostedRendererRetirement
|
|
2245
|
+
? `${hostedRendererRetirement.retired ? "retired" : "live"} pid ${hostedRendererRetirement.pid ?? "?"} with exact start/executable fence`
|
|
2246
|
+
: "no exact hosted-renderer retirement proof",
|
|
2247
|
+
),
|
|
2248
|
+
classify(
|
|
2249
|
+
"bounded-queues-memory",
|
|
2250
|
+
resourceObservation
|
|
2251
|
+
? resourceObservation.deliverySamples > 0 &&
|
|
2252
|
+
resourceObservation.memorySampleCount >= MEMORY_BUDGET.minimumSamples &&
|
|
2253
|
+
resourceObservation.rssPeakBytes > 0 &&
|
|
2254
|
+
resourceObservation.heapPeakBytes > 0 &&
|
|
2255
|
+
resourceObservation.rssRobustSlopeBytesPerSample <=
|
|
2256
|
+
MEMORY_BUDGET.rssRobustSlopeBytesPerSample &&
|
|
2257
|
+
resourceObservation.heapRobustSlopeBytesPerSample <=
|
|
2258
|
+
MEMORY_BUDGET.heapRobustSlopeBytesPerSample &&
|
|
2259
|
+
resourceObservation.rssGrowthBytes <= MEMORY_BUDGET.rssGrowthCeilingBytes &&
|
|
2260
|
+
resourceObservation.heapGrowthBytes <= MEMORY_BUDGET.heapGrowthCeilingBytes &&
|
|
2261
|
+
resourceObservation.rssPeakBytes <= MEMORY_BUDGET.rssAbsoluteCeilingBytes &&
|
|
2262
|
+
resourceObservation.heapPeakBytes <= MEMORY_BUDGET.heapAbsoluteCeilingBytes &&
|
|
2263
|
+
resourceObservation.inputPendingPeak <= 256 &&
|
|
2264
|
+
resourceObservation.inputPendingBytesPeak <= 256 * 1_024 &&
|
|
2265
|
+
resourceObservation.inputInFlightPeak <= 8 &&
|
|
2266
|
+
resourceObservation.deliveryQueuePeak <= resourceObservation.deliveryQueueCapacity &&
|
|
2267
|
+
resourceObservation.settledInputPending === MEMORY_BUDGET.settledQueueDepth &&
|
|
2268
|
+
resourceObservation.settledInputInFlight === MEMORY_BUDGET.settledQueueDepth &&
|
|
2269
|
+
resourceObservation.settledDeliveryQueueDepth === MEMORY_BUDGET.settledQueueDepth
|
|
2270
|
+
: null,
|
|
2271
|
+
resourceObservation
|
|
2272
|
+
? `${resourceObservation.memorySampleCount}/${MEMORY_BUDGET.minimumSamples} memory samples; input peak ${resourceObservation.inputPendingPeak}/${resourceObservation.inputPendingBytesPeak}B settled ${resourceObservation.settledInputPending}/${resourceObservation.settledInputInFlight}; delivery peak ${resourceObservation.deliveryQueuePeak}/${resourceObservation.deliveryQueueCapacity} settled ${resourceObservation.settledDeliveryQueueDepth}; RSS growth/slope ${resourceObservation.rssGrowthBytes}/${resourceObservation.rssRobustSlopeBytesPerSample}B; heap growth/slope ${resourceObservation.heapGrowthBytes}/${resourceObservation.heapRobustSlopeBytesPerSample}B`
|
|
2273
|
+
: "no sustained-output queue/memory distribution",
|
|
2274
|
+
),
|
|
2275
|
+
];
|
|
2276
|
+
return Object.freeze({
|
|
2277
|
+
version: 1,
|
|
2278
|
+
status: boundaries.some(({ status }) => status === "failed")
|
|
2279
|
+
? "failed"
|
|
2280
|
+
: boundaries.some(({ status }) => status === "unmeasured")
|
|
2281
|
+
? "incomplete"
|
|
2282
|
+
: "passed",
|
|
2283
|
+
firstBrokenBoundary: boundaries.find(({ status }) => status === "failed")?.id ?? null,
|
|
2284
|
+
firstBrokenInputBoundary,
|
|
2285
|
+
firstUnmeasuredBoundary: boundaries.find(({ status }) => status === "unmeasured")?.id ?? null,
|
|
2286
|
+
generation,
|
|
2287
|
+
boundaries: Object.freeze(boundaries),
|
|
2288
|
+
clocks: Object.freeze([
|
|
2289
|
+
...new Set(
|
|
2290
|
+
lifecycle.map(({ processId, clockId }) => `${processId ?? "?"}:${clockId ?? "?"}`),
|
|
2291
|
+
),
|
|
2292
|
+
]),
|
|
2293
|
+
inputSamples: Object.freeze(inputSamples),
|
|
2294
|
+
qualifyingInputEvidence: Object.freeze(
|
|
2295
|
+
qualifyingInputEvidence.map((entry) => Object.freeze({ ...entry })),
|
|
2296
|
+
),
|
|
2297
|
+
inputCausalSamples: Object.freeze(causalSamples),
|
|
2298
|
+
inputCausalSummary,
|
|
2299
|
+
framebufferEvidence:
|
|
2300
|
+
framebufferEvidence === null ? null : Object.freeze({ ...framebufferEvidence }),
|
|
2301
|
+
warmCoherentSamples: Object.freeze([...warmCoherentSamples]),
|
|
2302
|
+
warmLaunchSamples: Object.freeze([...warmLaunchSamples]),
|
|
2303
|
+
warmCoherentJourneys: Object.freeze(
|
|
2304
|
+
warmCoherentJourneys.map((journey) =>
|
|
2305
|
+
Object.freeze({
|
|
2306
|
+
...journey,
|
|
2307
|
+
daemonSpans: (() => {
|
|
2308
|
+
const matching = daemonTraceRecords.filter(
|
|
2309
|
+
(record) => journey.streamRequestId && record?.traceId === journey.streamRequestId,
|
|
2310
|
+
);
|
|
2311
|
+
const origin = Math.min(
|
|
2312
|
+
...matching
|
|
2313
|
+
.map((record) => record.startedAtMicros)
|
|
2314
|
+
.filter((value) => Number.isFinite(value)),
|
|
2315
|
+
);
|
|
2316
|
+
return Object.freeze(
|
|
2317
|
+
matching.map((record) =>
|
|
2318
|
+
Object.freeze({
|
|
2319
|
+
operation: record.operation,
|
|
2320
|
+
offsetMs:
|
|
2321
|
+
Number.isFinite(origin) && Number.isFinite(record.startedAtMicros)
|
|
2322
|
+
? (record.startedAtMicros - origin) / 1_000
|
|
2323
|
+
: null,
|
|
2324
|
+
durationMs:
|
|
2325
|
+
Number.isFinite(record.startedAtMicros) && Number.isFinite(record.endedAtMicros)
|
|
2326
|
+
? (record.endedAtMicros - record.startedAtMicros) / 1_000
|
|
2327
|
+
: null,
|
|
2328
|
+
processId: record.processId,
|
|
2329
|
+
clockId: record.clockId,
|
|
2330
|
+
}),
|
|
2331
|
+
),
|
|
2332
|
+
);
|
|
2333
|
+
})(),
|
|
2334
|
+
}),
|
|
2335
|
+
),
|
|
2336
|
+
),
|
|
2337
|
+
runtimeResourceRetirements: Object.freeze(
|
|
2338
|
+
runtimeResourceRetirements.map((retirement) => Object.freeze({ ...retirement })),
|
|
2339
|
+
),
|
|
2340
|
+
windowSwitchSamples: Object.freeze([...windowSwitchSamples]),
|
|
2341
|
+
resizeGuideSamples: Object.freeze([...resizeGuideSamples]),
|
|
2342
|
+
idleObservation: idleObservation ? Object.freeze({ ...idleObservation }) : null,
|
|
2343
|
+
idleProcessObservations: Object.freeze(
|
|
2344
|
+
idleProcessObservations.map((observation) => Object.freeze({ ...observation })),
|
|
2345
|
+
),
|
|
2346
|
+
hostedRendererRetirement:
|
|
2347
|
+
hostedRendererRetirement === null ? null : Object.freeze({ ...hostedRendererRetirement }),
|
|
2348
|
+
resourceObservation: resourceObservation ? Object.freeze({ ...resourceObservation }) : null,
|
|
2349
|
+
stderr: Object.freeze({
|
|
2350
|
+
nonEmptyLines: String(stderr ?? "")
|
|
2351
|
+
.split("\n")
|
|
2352
|
+
.filter(Boolean).length,
|
|
2353
|
+
tail: String(stderr ?? "")
|
|
2354
|
+
.split("\n")
|
|
2355
|
+
.filter(Boolean)
|
|
2356
|
+
.slice(-20),
|
|
2357
|
+
}),
|
|
2358
|
+
});
|
|
2359
|
+
}
|