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,2301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionChannel — one control-mode channel serving every pane subscription
|
|
3
|
+
* of one tmux session (m43 card 1).
|
|
4
|
+
*
|
|
5
|
+
* Responsibilities, in the order the bytes see them:
|
|
6
|
+
*
|
|
7
|
+
* - ROUTING: `%output`/`%extended-output` bytes are keyed by runtime `%N`
|
|
8
|
+
* and fanned out to that pane's subscribers through their {@link PaneFeed}
|
|
9
|
+
* gates. Runtime ids never leave this module — the public surface
|
|
10
|
+
* (subscribe, describe, layout events) speaks semantic ids only.
|
|
11
|
+
* - IDENTITY: the descriptor discovery ({@link SessionDescriptorDiscovery})
|
|
12
|
+
* feeds the workspace-tmux-adapter reconciliation; stamps are untrusted
|
|
13
|
+
* until verified, generated ids become real only after their pane-local
|
|
14
|
+
* stamp-back succeeds, and duplicate stamps are ALL restamped.
|
|
15
|
+
* - SEED/RESEED: the atomic recipe (capture + cursor probe back-to-back on
|
|
16
|
+
* the control channel, discard-until-reply) via `commandInline`, whose
|
|
17
|
+
* callbacks fire synchronously in channel read order.
|
|
18
|
+
* - FLOW: `%pause` bookkeeping in the {@link FlowLedger}; sticky-pause
|
|
19
|
+
* recovery continues+reseeds EVERY backpressure-paused pane that still has
|
|
20
|
+
* an unfrozen subscriber; explicit freeze/thaw parks one pane without
|
|
21
|
+
* touching siblings.
|
|
22
|
+
* - LAYOUT: `%layout-change`/`%window-pane-changed`/`%session-window-changed`
|
|
23
|
+
* are applied synchronously in notification order (ahead of any output the
|
|
24
|
+
* server emitted after the layout), joined to semantic window/pane ids.
|
|
25
|
+
* - INPUT: literals coalesce per pane (measured 256-byte chunks) and named
|
|
26
|
+
* keys flush pending literals first — the shared {@link InputCoalescer}
|
|
27
|
+
* discipline — leaving fire-and-forget via the channel.
|
|
28
|
+
*/
|
|
29
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
30
|
+
import { WORKSPACE_SEMANTIC_PANE_OPTION, WORKSPACE_SEMANTIC_WINDOW_OPTION, WorkspaceIdSchemaZ, } from "@tmux-ide/contracts";
|
|
31
|
+
import { textToHexKeys } from "../protocol/control.js";
|
|
32
|
+
import { InputCoalescer } from "../protocol/input-coalescer.js";
|
|
33
|
+
import { parseLayout, parseLayoutChange, parseSessionWindowChanged, parseWindowPaneChanged, } from "../protocol/layout-parse.js";
|
|
34
|
+
import { SESSION_PANE_DESCRIPTOR_FORMAT, SessionDescriptorDiscovery, decodeControlReplyUtf8, decodeTmuxArgument, parseSessionPaneDescriptorReply, } from "../protocol/session-descriptor-discovery.js";
|
|
35
|
+
import { resolvePaneDisplayName } from "../protocol/pane-display-name.js";
|
|
36
|
+
import { finalizeWorkspaceTmuxReconciliation, planWorkspaceTmuxReconciliation, } from "../protocol/workspace-tmux-adapter.js";
|
|
37
|
+
import { FlowLedger } from "./flow-ledger.js";
|
|
38
|
+
import { PaneFeed } from "./pane-feed.js";
|
|
39
|
+
import { INTERNAL_READ_OPERATION_OPTION, registerInternalReadOperation, retireInternalReadOperation, } from "../../lib/tmux-interaction-options.js";
|
|
40
|
+
/** Notifications whose payload cannot be applied directly — fall back to the
|
|
41
|
+
* debounced truth sync (shared by all semantic terminal clients). */
|
|
42
|
+
const STRUCTURAL_NOTIFICATIONS = new Set([
|
|
43
|
+
"window-add",
|
|
44
|
+
"window-close",
|
|
45
|
+
"window-renamed",
|
|
46
|
+
"unlinked-window-close",
|
|
47
|
+
]);
|
|
48
|
+
const NATIVE_CLIENT_NOTIFICATIONS = new Set([
|
|
49
|
+
"client-attached",
|
|
50
|
+
"client-detached",
|
|
51
|
+
"client-resized",
|
|
52
|
+
"client-session-changed",
|
|
53
|
+
"subscription-changed",
|
|
54
|
+
]);
|
|
55
|
+
const NATIVE_CLIENT_SUBSCRIPTION = "tmux-ide-native-clients";
|
|
56
|
+
const DEFAULT_HISTORY_LINES = 2000;
|
|
57
|
+
const SYNC_DEBOUNCE_MS = 40;
|
|
58
|
+
/** Foreground-command labels follow output, but never turn a busy pane into a probe loop. */
|
|
59
|
+
const DISPLAY_NAME_SYNC_INTERVAL_MS = 750;
|
|
60
|
+
const RECOVERY_QUIET_MS = 40;
|
|
61
|
+
const RECOVERY_COMMAND_DEADLINE_MS = 500;
|
|
62
|
+
const RECOVERY_NO_PROGRESS_DEADLINE_MS = 3_000;
|
|
63
|
+
const RECOVERY_ABSOLUTE_DEADLINE_MS = 5_000;
|
|
64
|
+
const RECOVERY_MAX_ATTEMPTS = 4;
|
|
65
|
+
const RECOVERY_CAPTURE_MAX_BYTES = 16 * 1024 * 1024;
|
|
66
|
+
const RECOVERY_CAPTURE_MAX_LINES = 8_192;
|
|
67
|
+
const RECOVERY_CURSOR_MAX_BYTES = 1_024;
|
|
68
|
+
const MAX_CONTINUE_NOTIFICATION_QUEUE = 32;
|
|
69
|
+
const MAX_CONTINUE_NOTIFICATION_DEBT = 65_536;
|
|
70
|
+
const RECOVERY_CURSOR_PROBE_FORMAT = [
|
|
71
|
+
"#{cursor_x}",
|
|
72
|
+
"#{cursor_y}",
|
|
73
|
+
"#{pane_width}",
|
|
74
|
+
"#{pane_height}",
|
|
75
|
+
"#{alternate_on}",
|
|
76
|
+
"#{cursor_flag}",
|
|
77
|
+
"#{insert_flag}",
|
|
78
|
+
"#{keypad_cursor_flag}",
|
|
79
|
+
"#{keypad_flag}",
|
|
80
|
+
"#{mouse_any_flag}",
|
|
81
|
+
"#{mouse_button_flag}",
|
|
82
|
+
"#{mouse_standard_flag}",
|
|
83
|
+
"#{origin_flag}",
|
|
84
|
+
"#{wrap_flag}",
|
|
85
|
+
].join(" ");
|
|
86
|
+
const FAILED_RESEED_RESULT = Object.freeze({
|
|
87
|
+
ok: false,
|
|
88
|
+
fingerprint: null,
|
|
89
|
+
publish: () => false,
|
|
90
|
+
hold: () => { },
|
|
91
|
+
});
|
|
92
|
+
function snapshotFingerprint(captureLines, cursorLine, fallbackSize) {
|
|
93
|
+
const hash = createHash("sha256");
|
|
94
|
+
const append = (bytes) => {
|
|
95
|
+
const length = Buffer.allocUnsafe(4);
|
|
96
|
+
length.writeUInt32BE(bytes.byteLength);
|
|
97
|
+
hash.update(length);
|
|
98
|
+
hash.update(bytes);
|
|
99
|
+
};
|
|
100
|
+
hash.update("tmux-ide/recovery-snapshot/v1\0");
|
|
101
|
+
const count = Buffer.allocUnsafe(4);
|
|
102
|
+
count.writeUInt32BE(captureLines.length);
|
|
103
|
+
hash.update(count);
|
|
104
|
+
for (const line of captureLines)
|
|
105
|
+
append(Buffer.from(line, "latin1"));
|
|
106
|
+
append(Buffer.from(cursorLine, "utf8"));
|
|
107
|
+
append(Buffer.from(fallbackSize ? `${fallbackSize.cols}x${fallbackSize.rows}` : "no-layout-fallback", "ascii"));
|
|
108
|
+
return hash.digest("hex");
|
|
109
|
+
}
|
|
110
|
+
function tmuxSingleQuote(value) {
|
|
111
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
112
|
+
}
|
|
113
|
+
export function defaultMirrorPaneId() {
|
|
114
|
+
return `pane.mirror.${randomBytes(8).toString("hex")}`;
|
|
115
|
+
}
|
|
116
|
+
export function defaultMirrorWindowId() {
|
|
117
|
+
return `window.mirror.${randomBytes(8).toString("hex")}`;
|
|
118
|
+
}
|
|
119
|
+
export class SessionChannel {
|
|
120
|
+
opts;
|
|
121
|
+
io;
|
|
122
|
+
ledger = new FlowLedger();
|
|
123
|
+
discovery;
|
|
124
|
+
panesByRuntime = new Map();
|
|
125
|
+
panesBySemantic = new Map();
|
|
126
|
+
windowsByRuntime = new Map();
|
|
127
|
+
layoutByWindow = new Map();
|
|
128
|
+
activePaneByWindow = new Map();
|
|
129
|
+
layoutSubscribers = new Set();
|
|
130
|
+
layoutAuthoritySubscribers = new Set();
|
|
131
|
+
layoutTopologyEpoch = 0;
|
|
132
|
+
truthActive = new Map();
|
|
133
|
+
truthWindow = new Map();
|
|
134
|
+
currentWindow = "";
|
|
135
|
+
diagnostics = [];
|
|
136
|
+
degraded = false;
|
|
137
|
+
ageByRuntime = new Map();
|
|
138
|
+
maxAgeMs = 0;
|
|
139
|
+
geometryParticipating = false;
|
|
140
|
+
cancelSync = null;
|
|
141
|
+
lastDisplayNameSyncAtMs = 0;
|
|
142
|
+
disposed = false;
|
|
143
|
+
nativeClientProbePending = false;
|
|
144
|
+
windowAuthorityOrdinal = 0;
|
|
145
|
+
paneIncarnation = 0;
|
|
146
|
+
recoveryOrdinal = 0;
|
|
147
|
+
outputOrdinals = new Map();
|
|
148
|
+
recoveries = new Map();
|
|
149
|
+
continueNotificationQueues = new Map();
|
|
150
|
+
trustedInventoryFlight = null;
|
|
151
|
+
trustedInventoryFlightSessionId = null;
|
|
152
|
+
attachedIdentity = null;
|
|
153
|
+
/** Settles once the FIRST identity join lands (or is proven impossible), so
|
|
154
|
+
* `start()` returns a channel whose semantic ids are subscribable. */
|
|
155
|
+
resolveFirstJoin = null;
|
|
156
|
+
firstJoin = new Promise((resolve) => {
|
|
157
|
+
this.resolveFirstJoin = resolve;
|
|
158
|
+
});
|
|
159
|
+
input = new InputCoalescer((action) => {
|
|
160
|
+
const startedAtMicros = action.traceIds?.length ? Math.floor(performance.now() * 1_000) : 0;
|
|
161
|
+
const pendingBeforeSend = action.traceIds?.length ? (this.io.pendingCount ?? 0) : 0;
|
|
162
|
+
const onReply = action.traceIds?.length
|
|
163
|
+
? (reply) => this.opts.onInputAccepted?.(action, Math.floor(performance.now() * 1_000), reply.ok)
|
|
164
|
+
: undefined;
|
|
165
|
+
if (action.kind === "literal") {
|
|
166
|
+
this.io.send(`send-keys -t ${action.pane} -H ${textToHexKeys(action.text).join(" ")}`, onReply);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.io.send(`send-keys -t ${action.pane} ${action.key}`, onReply);
|
|
170
|
+
}
|
|
171
|
+
if (action.traceIds?.length)
|
|
172
|
+
this.opts.onInputWrite?.(action, startedAtMicros, Math.floor(performance.now() * 1_000), pendingBeforeSend);
|
|
173
|
+
}, (flush) => queueMicrotask(flush));
|
|
174
|
+
constructor(opts) {
|
|
175
|
+
this.opts = opts;
|
|
176
|
+
this.io = opts.createIo({
|
|
177
|
+
onOutput: (pane, data, ageMs, timing) => this.onOutput(pane, data, ageMs, timing),
|
|
178
|
+
onNotify: (name, rest) => this.onNotify(name, rest),
|
|
179
|
+
onExit: () => this.onChannelExit(),
|
|
180
|
+
});
|
|
181
|
+
this.discovery = new SessionDescriptorDiscovery({
|
|
182
|
+
query: () => this.io.request(`list-panes -s -t "${this.opts.session}" -F "${SESSION_PANE_DESCRIPTOR_FORMAT}"`),
|
|
183
|
+
onDescriptors: (descriptors, listed) => {
|
|
184
|
+
void this.reconcileIdentity(descriptors, listed).catch(() => { });
|
|
185
|
+
},
|
|
186
|
+
onStatus: (status) => {
|
|
187
|
+
if (status) {
|
|
188
|
+
this.pushDiagnostic({
|
|
189
|
+
code: `DESCRIPTOR_${status.status.toUpperCase()}`,
|
|
190
|
+
message: status.message,
|
|
191
|
+
degraded: status.degraded,
|
|
192
|
+
});
|
|
193
|
+
// Discovery gave up: identity will not improve on its own — let
|
|
194
|
+
// start() return the (degraded) channel rather than hang.
|
|
195
|
+
if (status.status === "failed")
|
|
196
|
+
this.settleFirstJoin();
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
async start() {
|
|
202
|
+
await this.io.start();
|
|
203
|
+
await this.captureAttachedSessionIdentity();
|
|
204
|
+
if (this.opts.onNativeClientActivity) {
|
|
205
|
+
// tmux does not guarantee `%client-attached` is broadcast to an
|
|
206
|
+
// existing control client. A format subscription is the documented,
|
|
207
|
+
// event-driven observation seam; its notification only schedules the
|
|
208
|
+
// coalesced list-clients proof below.
|
|
209
|
+
this.io.send(`refresh-client -B '${NATIVE_CLIENT_SUBSCRIPTION}::#{session_attached}'`);
|
|
210
|
+
}
|
|
211
|
+
await this.syncNow();
|
|
212
|
+
await this.firstJoin;
|
|
213
|
+
}
|
|
214
|
+
// ── Public surface (semantic ids only) ──────────────────────────────────
|
|
215
|
+
describe() {
|
|
216
|
+
const panes = [...this.panesBySemantic.values()].map((pane) => {
|
|
217
|
+
const display = resolvePaneDisplayName({
|
|
218
|
+
semanticPaneId: pane.semanticId,
|
|
219
|
+
configuredName: pane.descriptor?.name,
|
|
220
|
+
configuredNameSource: pane.descriptor?.nameSource,
|
|
221
|
+
currentCommand: pane.descriptor?.currentCommand,
|
|
222
|
+
title: pane.descriptor?.title,
|
|
223
|
+
paneType: pane.descriptor?.type,
|
|
224
|
+
});
|
|
225
|
+
return {
|
|
226
|
+
semanticPaneId: pane.semanticId,
|
|
227
|
+
semanticWindowId: pane.windowRuntimeId
|
|
228
|
+
? (this.windowsByRuntime.get(pane.windowRuntimeId)?.semanticId ?? null)
|
|
229
|
+
: null,
|
|
230
|
+
role: pane.descriptor?.role ?? null,
|
|
231
|
+
paneType: pane.descriptor?.type ?? null,
|
|
232
|
+
currentCommand: pane.descriptor?.currentCommand ?? null,
|
|
233
|
+
cwd: pane.descriptor?.cwd ?? null,
|
|
234
|
+
title: pane.descriptor?.title ?? null,
|
|
235
|
+
displayName: display.name,
|
|
236
|
+
displayNameSource: display.source,
|
|
237
|
+
windowName: pane.descriptor?.windowName ?? null,
|
|
238
|
+
active: pane.active,
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
return {
|
|
242
|
+
session: this.opts.session,
|
|
243
|
+
panes,
|
|
244
|
+
diagnostics: [...this.diagnostics],
|
|
245
|
+
degraded: this.degraded,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Strict daemon-internal inventory from this channel's current tmux truth.
|
|
250
|
+
* Unlike the background discovery path, this query awaits descriptor
|
|
251
|
+
* reconciliation before projecting and rejects incomplete identity rather
|
|
252
|
+
* than returning the previous descriptor snapshot.
|
|
253
|
+
*/
|
|
254
|
+
describeTrustedInventory(expectedRuntimeSessionId) {
|
|
255
|
+
if (this.disposed) {
|
|
256
|
+
return Promise.reject(new Error(`mirror session ${this.opts.session} is disposed`));
|
|
257
|
+
}
|
|
258
|
+
if (this.trustedInventoryFlight) {
|
|
259
|
+
return this.trustedInventoryFlightSessionId === expectedRuntimeSessionId
|
|
260
|
+
? this.trustedInventoryFlight
|
|
261
|
+
: Promise.reject(new Error(`trusted inventory identity changed for ${this.opts.session}`));
|
|
262
|
+
}
|
|
263
|
+
const flight = this.refreshTrustedInventory(expectedRuntimeSessionId).finally(() => {
|
|
264
|
+
if (this.trustedInventoryFlight === flight) {
|
|
265
|
+
this.trustedInventoryFlight = null;
|
|
266
|
+
this.trustedInventoryFlightSessionId = null;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
this.trustedInventoryFlight = flight;
|
|
270
|
+
this.trustedInventoryFlightSessionId = expectedRuntimeSessionId;
|
|
271
|
+
return flight;
|
|
272
|
+
}
|
|
273
|
+
/** Read-only proof of the session this control client is actually attached to. */
|
|
274
|
+
async attachedSessionIdentity() {
|
|
275
|
+
if (this.disposed)
|
|
276
|
+
throw new Error(`mirror session ${this.opts.session} is disposed`);
|
|
277
|
+
if (!this.attachedIdentity)
|
|
278
|
+
throw new Error(`mirror session ${this.opts.session} identity is absent`);
|
|
279
|
+
return this.attachedIdentity;
|
|
280
|
+
}
|
|
281
|
+
async captureAttachedSessionIdentity() {
|
|
282
|
+
const lines = await this.io.request(`display-message -p "#{qa:session_name}\t#{session_id}"`);
|
|
283
|
+
if (lines.length !== 1)
|
|
284
|
+
throw new Error(`mirror session ${this.opts.session} identity is absent`);
|
|
285
|
+
const decodedLine = decodeControlReplyUtf8(lines[0]);
|
|
286
|
+
if (decodedLine === null)
|
|
287
|
+
throw new Error(`mirror session ${this.opts.session} identity is malformed`);
|
|
288
|
+
const [encodedName = "", runtimeSessionId = ""] = decodedLine.split("\t");
|
|
289
|
+
const sessionName = decodeTmuxArgument(encodedName);
|
|
290
|
+
if (sessionName.length === 0 ||
|
|
291
|
+
sessionName.length > 160 ||
|
|
292
|
+
!/^\$(?:0|[1-9][0-9]*)$/u.test(runtimeSessionId) ||
|
|
293
|
+
runtimeSessionId.length > 32) {
|
|
294
|
+
throw new Error(`mirror session ${this.opts.session} identity is malformed`);
|
|
295
|
+
}
|
|
296
|
+
this.attachedIdentity = Object.freeze({ sessionName, runtimeSessionId });
|
|
297
|
+
}
|
|
298
|
+
subscribePane(semanticPaneId, onEvent, onLayout) {
|
|
299
|
+
const pane = this.panesBySemantic.get(semanticPaneId);
|
|
300
|
+
if (!pane) {
|
|
301
|
+
throw new Error(`unknown semantic pane ${semanticPaneId} in session ${this.opts.session}`);
|
|
302
|
+
}
|
|
303
|
+
const sub = {
|
|
304
|
+
feed: new PaneFeed(),
|
|
305
|
+
onEvent,
|
|
306
|
+
onLayout: onLayout ?? null,
|
|
307
|
+
pane,
|
|
308
|
+
frozen: false,
|
|
309
|
+
closed: false,
|
|
310
|
+
};
|
|
311
|
+
pane.subs.add(sub);
|
|
312
|
+
// A paused pane gains an unfrozen watcher: release the park before the
|
|
313
|
+
// seed so the capture reflects a flowing pane.
|
|
314
|
+
const recoveryReason = this.ledger.isRequested(pane.runtimeId)
|
|
315
|
+
? "requested"
|
|
316
|
+
: this.ledger.isBackpressured(pane.runtimeId)
|
|
317
|
+
? "backpressure"
|
|
318
|
+
: null;
|
|
319
|
+
if (recoveryReason)
|
|
320
|
+
this.beginRecovery(pane, recoveryReason);
|
|
321
|
+
else
|
|
322
|
+
this.reseedPlain(sub);
|
|
323
|
+
this.emitLayoutSnapshot(sub);
|
|
324
|
+
return {
|
|
325
|
+
semanticPaneId,
|
|
326
|
+
freeze: () => this.freeze(sub),
|
|
327
|
+
thaw: () => this.thaw(sub),
|
|
328
|
+
reseed: () => this.reseedPlain(sub),
|
|
329
|
+
sendText: (text) => {
|
|
330
|
+
if (!sub.closed)
|
|
331
|
+
this.input.literal(sub.pane.runtimeId, text);
|
|
332
|
+
},
|
|
333
|
+
sendKey: (key) => {
|
|
334
|
+
if (!sub.closed)
|
|
335
|
+
this.input.key(sub.pane.runtimeId, key);
|
|
336
|
+
},
|
|
337
|
+
close: () => this.closeSub(sub),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/** Session geometry without a dummy pane feed or terminal-content seed. */
|
|
341
|
+
subscribeLayout(onLayout) {
|
|
342
|
+
if (this.disposed)
|
|
343
|
+
throw new Error(`mirror session ${this.opts.session} is disposed`);
|
|
344
|
+
this.layoutSubscribers.add(onLayout);
|
|
345
|
+
for (const windowRuntimeId of this.layoutByWindow.keys()) {
|
|
346
|
+
const event = this.layoutEventFor(windowRuntimeId);
|
|
347
|
+
if (event)
|
|
348
|
+
onLayout(event);
|
|
349
|
+
}
|
|
350
|
+
let closed = false;
|
|
351
|
+
return {
|
|
352
|
+
close: () => {
|
|
353
|
+
if (closed)
|
|
354
|
+
return;
|
|
355
|
+
closed = true;
|
|
356
|
+
this.layoutSubscribers.delete(onLayout);
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Refresh all session/window authority before exposing a global layout
|
|
362
|
+
* subscription. A cached control-mode channel may have been retained while
|
|
363
|
+
* only the current window had emitted geometry; replaying that cache would
|
|
364
|
+
* strand a multi-window renderer behind its exact inventory-coverage gate.
|
|
365
|
+
*/
|
|
366
|
+
async subscribeAuthoritativeLayout(onLayout, expectedSemanticPaneIds, onAuthority) {
|
|
367
|
+
if (this.disposed)
|
|
368
|
+
throw new Error(`mirror session ${this.opts.session} is disposed`);
|
|
369
|
+
const identity = await this.attachedSessionIdentity();
|
|
370
|
+
const inventory = await this.describeTrustedInventory(identity.runtimeSessionId);
|
|
371
|
+
if (this.disposed)
|
|
372
|
+
throw new Error(`mirror session ${this.opts.session} is disposed`);
|
|
373
|
+
const expectedByWindow = new Map();
|
|
374
|
+
for (const pane of inventory.panes) {
|
|
375
|
+
const expected = expectedByWindow.get(pane.runtimeWindowId) ?? new Set();
|
|
376
|
+
expected.add(pane.semanticPaneId);
|
|
377
|
+
expectedByWindow.set(pane.runtimeWindowId, expected);
|
|
378
|
+
}
|
|
379
|
+
if (expectedSemanticPaneIds) {
|
|
380
|
+
const requested = [...expectedSemanticPaneIds].sort();
|
|
381
|
+
const authoritative = inventory.panes.map(({ semanticPaneId }) => semanticPaneId).sort();
|
|
382
|
+
if (requested.length === 0 ||
|
|
383
|
+
new Set(requested).size !== requested.length ||
|
|
384
|
+
requested.length !== authoritative.length ||
|
|
385
|
+
requested.some((pane, index) => pane !== authoritative[index])) {
|
|
386
|
+
const error = new Error(`authoritative layout for ${this.opts.session} changed topology`);
|
|
387
|
+
error.name = "MirrorTopologyChangedError";
|
|
388
|
+
throw error;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (expectedByWindow.size !== inventory.panes[0].sessionWindowCount ||
|
|
392
|
+
expectedByWindow.size !== this.windowsByRuntime.size) {
|
|
393
|
+
throw new Error(`authoritative layout for ${this.opts.session} has incomplete windows`);
|
|
394
|
+
}
|
|
395
|
+
for (const [runtimeWindowId, expectedPanes] of expectedByWindow) {
|
|
396
|
+
const event = this.layoutEventFor(runtimeWindowId);
|
|
397
|
+
if (!event)
|
|
398
|
+
throw new Error(`authoritative layout for ${this.opts.session} has incomplete panes`);
|
|
399
|
+
const observed = event.panes.flatMap(({ semanticPaneId }) => typeof semanticPaneId === "string" ? [semanticPaneId] : []);
|
|
400
|
+
if (observed.length !== event.panes.length ||
|
|
401
|
+
observed.length !== expectedPanes.size ||
|
|
402
|
+
new Set(observed).size !== observed.length ||
|
|
403
|
+
observed.some((pane) => !expectedPanes.has(pane))) {
|
|
404
|
+
throw new Error(`authoritative layout for ${this.opts.session} has incomplete panes`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const handle = this.subscribeLayout(onLayout);
|
|
408
|
+
if (onAuthority) {
|
|
409
|
+
this.layoutAuthoritySubscribers.add(onAuthority);
|
|
410
|
+
this.emitLayoutAuthorityTo(onAuthority, identity.runtimeSessionId);
|
|
411
|
+
}
|
|
412
|
+
return {
|
|
413
|
+
close: () => {
|
|
414
|
+
handle.close();
|
|
415
|
+
if (onAuthority)
|
|
416
|
+
this.layoutAuthoritySubscribers.delete(onAuthority);
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
/** Controller-authorized input fast path. It deliberately reuses the one
|
|
421
|
+
* session InputCoalescer, so literal/key ordering and tmux application-mode
|
|
422
|
+
* named-key semantics are identical for GUI, TUI and direct subscribers. */
|
|
423
|
+
sendText(semanticPaneId, text, performanceTraceId, isolated = false) {
|
|
424
|
+
const pane = this.panesBySemantic.get(semanticPaneId);
|
|
425
|
+
if (!pane)
|
|
426
|
+
throw new Error(`unknown semantic pane ${semanticPaneId} in session ${this.opts.session}`);
|
|
427
|
+
if (isolated)
|
|
428
|
+
this.input.flush();
|
|
429
|
+
this.input.literal(pane.runtimeId, text, performanceTraceId);
|
|
430
|
+
if (isolated)
|
|
431
|
+
this.input.flush();
|
|
432
|
+
}
|
|
433
|
+
sendKey(semanticPaneId, key, performanceTraceId) {
|
|
434
|
+
const pane = this.panesBySemantic.get(semanticPaneId);
|
|
435
|
+
if (!pane)
|
|
436
|
+
throw new Error(`unknown semantic pane ${semanticPaneId} in session ${this.opts.session}`);
|
|
437
|
+
this.input.key(pane.runtimeId, key, performanceTraceId);
|
|
438
|
+
}
|
|
439
|
+
fitViewport(cols, rows) {
|
|
440
|
+
if (!Number.isSafeInteger(cols) || !Number.isSafeInteger(rows) || cols < 2 || rows < 2) {
|
|
441
|
+
throw new RangeError("viewport must contain positive bounded terminal cells");
|
|
442
|
+
}
|
|
443
|
+
this.input.flush();
|
|
444
|
+
this.io.send(`refresh-client -C ${cols}x${rows}`);
|
|
445
|
+
}
|
|
446
|
+
/** Toggle whether the retained control client participates in tmux sizing. */
|
|
447
|
+
setGeometryParticipation(active) {
|
|
448
|
+
if (this.geometryParticipating === active)
|
|
449
|
+
return;
|
|
450
|
+
this.geometryParticipating = active;
|
|
451
|
+
this.input.flush();
|
|
452
|
+
this.io.send(`refresh-client -f ${active ? "!ignore-size" : "ignore-size"}`);
|
|
453
|
+
}
|
|
454
|
+
subscriberCount() {
|
|
455
|
+
let count = 0;
|
|
456
|
+
for (const pane of this.panesByRuntime.values())
|
|
457
|
+
count += pane.subs.size;
|
|
458
|
+
return count;
|
|
459
|
+
}
|
|
460
|
+
/** Fall-behind telemetry from the `%extended-output` age field. */
|
|
461
|
+
ageTelemetry() {
|
|
462
|
+
const byPane = {};
|
|
463
|
+
for (const [runtime, age] of this.ageByRuntime) {
|
|
464
|
+
const semantic = this.panesByRuntime.get(runtime)?.semanticId;
|
|
465
|
+
if (semantic)
|
|
466
|
+
byPane[semantic] = age;
|
|
467
|
+
}
|
|
468
|
+
return { maxAgeMs: this.maxAgeMs, byPane };
|
|
469
|
+
}
|
|
470
|
+
flowSnapshot() {
|
|
471
|
+
const toSemantic = (runtime) => this.panesByRuntime.get(runtime)?.semanticId ?? "(unidentified)";
|
|
472
|
+
const snapshot = this.ledger.snapshot();
|
|
473
|
+
return {
|
|
474
|
+
backpressured: snapshot.backpressured.map(toSemantic),
|
|
475
|
+
requested: snapshot.requested.map(toSemantic),
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
async dispose() {
|
|
479
|
+
if (this.disposed)
|
|
480
|
+
return;
|
|
481
|
+
this.disposed = true;
|
|
482
|
+
this.settleFirstJoin();
|
|
483
|
+
this.cancelSync?.();
|
|
484
|
+
this.cancelSync = null;
|
|
485
|
+
for (const runtime of [...this.recoveries.keys()])
|
|
486
|
+
this.cancelRecovery(runtime);
|
|
487
|
+
this.continueNotificationQueues.clear();
|
|
488
|
+
this.discovery.dispose();
|
|
489
|
+
this.input.flush();
|
|
490
|
+
for (const pane of this.panesByRuntime.values()) {
|
|
491
|
+
for (const sub of pane.subs) {
|
|
492
|
+
if (!sub.closed) {
|
|
493
|
+
sub.closed = true;
|
|
494
|
+
sub.onEvent({ type: "closed" });
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
pane.subs.clear();
|
|
498
|
+
}
|
|
499
|
+
this.layoutSubscribers.clear();
|
|
500
|
+
this.layoutAuthoritySubscribers.clear();
|
|
501
|
+
await this.io.dispose();
|
|
502
|
+
}
|
|
503
|
+
// ── Byte routing ─────────────────────────────────────────────────────────
|
|
504
|
+
onOutput(runtimePane, data, ageMs, timing) {
|
|
505
|
+
const now = Date.now();
|
|
506
|
+
if (now - this.lastDisplayNameSyncAtMs >= DISPLAY_NAME_SYNC_INTERVAL_MS) {
|
|
507
|
+
this.lastDisplayNameSyncAtMs = now;
|
|
508
|
+
this.scheduleSync();
|
|
509
|
+
}
|
|
510
|
+
if (ageMs !== null) {
|
|
511
|
+
this.ageByRuntime.set(runtimePane, ageMs);
|
|
512
|
+
if (ageMs > this.maxAgeMs)
|
|
513
|
+
this.maxAgeMs = ageMs;
|
|
514
|
+
}
|
|
515
|
+
const pane = this.panesByRuntime.get(runtimePane);
|
|
516
|
+
if (!pane)
|
|
517
|
+
return;
|
|
518
|
+
const outputOrdinal = (this.outputOrdinals.get(runtimePane) ?? 0) + 1;
|
|
519
|
+
this.outputOrdinals.set(runtimePane, outputOrdinal);
|
|
520
|
+
this.opts.onOutputObserved?.(pane.semanticId, ageMs, timing);
|
|
521
|
+
let overflowed = false;
|
|
522
|
+
for (const sub of pane.subs) {
|
|
523
|
+
if (sub.frozen || sub.closed)
|
|
524
|
+
continue;
|
|
525
|
+
for (const event of sub.feed.delta(data))
|
|
526
|
+
sub.onEvent(event);
|
|
527
|
+
if (sub.feed.takeOverflowed())
|
|
528
|
+
overflowed = true;
|
|
529
|
+
}
|
|
530
|
+
if (overflowed)
|
|
531
|
+
this.restartRecoveryAfterOutputOverflow(pane);
|
|
532
|
+
this.noteRecoveryOutput(pane, outputOrdinal);
|
|
533
|
+
}
|
|
534
|
+
// ── Seed / reseed (the atomic recipe) ────────────────────────────────────
|
|
535
|
+
reseed(sub, onSettled, deferPublish = false) {
|
|
536
|
+
if (sub.closed || sub.frozen || this.disposed) {
|
|
537
|
+
onSettled?.(FAILED_RESEED_RESULT);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
const runtime = sub.pane.runtimeId;
|
|
541
|
+
const epoch = sub.feed.beginReseed();
|
|
542
|
+
let settled = false;
|
|
543
|
+
let captureSucceeded = false;
|
|
544
|
+
let markerRetired = false;
|
|
545
|
+
let captureLines = null;
|
|
546
|
+
const settle = (result) => {
|
|
547
|
+
if (settled)
|
|
548
|
+
return;
|
|
549
|
+
settled = true;
|
|
550
|
+
onSettled?.(result);
|
|
551
|
+
};
|
|
552
|
+
// Keystroke ordering: pending coalesced input leaves before the probes.
|
|
553
|
+
this.input.flush();
|
|
554
|
+
const history = this.opts.historyLines ?? DEFAULT_HISTORY_LINES;
|
|
555
|
+
const internalReadMarker = registerInternalReadOperation(runtime);
|
|
556
|
+
const retireMarker = () => {
|
|
557
|
+
if (markerRetired)
|
|
558
|
+
return;
|
|
559
|
+
markerRetired = true;
|
|
560
|
+
this.retireInternalReadMarker(runtime, internalReadMarker);
|
|
561
|
+
};
|
|
562
|
+
// Both probes ride one write burst; the FIFO reply order is the seam.
|
|
563
|
+
this.io.commandListInline(`set-option -p -t ${runtime} ${INTERNAL_READ_OPERATION_OPTION} ${internalReadMarker} ; capture-pane -p -e -J -S -${history} -t ${runtime}`, 2, 1, (reply) => {
|
|
564
|
+
if (!reply.ok) {
|
|
565
|
+
// Successful captures consume the marker atomically inside the tmux
|
|
566
|
+
// after-capture-pane hook. The command-list also prevents a concurrent
|
|
567
|
+
// mirror from stealing the marker. Only failures need cleanup.
|
|
568
|
+
retireMarker();
|
|
569
|
+
sub.feed.abort(epoch);
|
|
570
|
+
settle(FAILED_RESEED_RESULT);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
captureSucceeded = true;
|
|
574
|
+
if (sub.closed || sub.frozen || this.disposed) {
|
|
575
|
+
sub.feed.abort(epoch);
|
|
576
|
+
settle(FAILED_RESEED_RESULT);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
captureLines = [...reply.lines];
|
|
580
|
+
sub.feed.captureReply(epoch, reply.lines);
|
|
581
|
+
});
|
|
582
|
+
this.io.commandInline(`display-message -p -t ${runtime} "${RECOVERY_CURSOR_PROBE_FORMAT}"`, (reply) => {
|
|
583
|
+
if (sub.closed || sub.frozen || this.disposed) {
|
|
584
|
+
sub.feed.abort(epoch);
|
|
585
|
+
settle(FAILED_RESEED_RESULT);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
if (!reply.ok) {
|
|
589
|
+
if (!captureSucceeded)
|
|
590
|
+
retireMarker();
|
|
591
|
+
sub.feed.abort(epoch);
|
|
592
|
+
settle(FAILED_RESEED_RESULT);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const cursorLine = reply.lines[0] ?? "";
|
|
596
|
+
const fallbackSize = this.layoutSizeFor(runtime);
|
|
597
|
+
const events = sub.feed.cursorReply(epoch, cursorLine, fallbackSize);
|
|
598
|
+
let published = false;
|
|
599
|
+
const publish = () => {
|
|
600
|
+
if (published)
|
|
601
|
+
return true;
|
|
602
|
+
if (sub.closed || sub.frozen || this.disposed)
|
|
603
|
+
return false;
|
|
604
|
+
published = true;
|
|
605
|
+
for (const event of events)
|
|
606
|
+
sub.onEvent(event);
|
|
607
|
+
return true;
|
|
608
|
+
};
|
|
609
|
+
const ok = events.length > 0 && !sub.closed && captureLines !== null;
|
|
610
|
+
const result = {
|
|
611
|
+
ok,
|
|
612
|
+
fingerprint: ok ? snapshotFingerprint(captureLines, cursorLine, fallbackSize) : null,
|
|
613
|
+
publish,
|
|
614
|
+
hold: () => sub.feed.quarantine(epoch),
|
|
615
|
+
};
|
|
616
|
+
if (!deferPublish)
|
|
617
|
+
publish();
|
|
618
|
+
settle(result);
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
reseedPlain(sub, resumeReason = null) {
|
|
622
|
+
this.reseed(sub, ({ ok }) => {
|
|
623
|
+
if (ok) {
|
|
624
|
+
if (resumeReason && !sub.closed && !sub.frozen)
|
|
625
|
+
sub.onEvent({ type: "flow", state: "resumed", reason: resumeReason });
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
if (sub.closed ||
|
|
629
|
+
sub.frozen ||
|
|
630
|
+
this.disposed ||
|
|
631
|
+
this.recoveries.has(sub.pane.runtimeId) ||
|
|
632
|
+
this.panesByRuntime.get(sub.pane.runtimeId) !== sub.pane)
|
|
633
|
+
return;
|
|
634
|
+
this.beginLocalOverflowRecovery(sub.pane);
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
retireInternalReadMarker(runtime, marker) {
|
|
638
|
+
if (!/^%(?:0|[1-9][0-9]*)$/u.test(runtime))
|
|
639
|
+
throw new TypeError("internal read cleanup requires a runtime pane id");
|
|
640
|
+
retireInternalReadOperation(marker, runtime);
|
|
641
|
+
// Pane capture phases overlap under cancellation. Clear only the exact
|
|
642
|
+
// failed marker so a late A callback cannot erase the newer B authority.
|
|
643
|
+
this.io.send(`if-shell -t ${runtime} -F "#{==:#{${INTERNAL_READ_OPERATION_OPTION}},${marker}}" ` +
|
|
644
|
+
`"set-option -pu -t ${runtime} ${INTERNAL_READ_OPERATION_OPTION}" ""`);
|
|
645
|
+
}
|
|
646
|
+
layoutSizeFor(runtime) {
|
|
647
|
+
for (const layout of this.layoutByWindow.values()) {
|
|
648
|
+
const leaf = layout.leaves.find((candidate) => candidate.id === runtime);
|
|
649
|
+
if (leaf)
|
|
650
|
+
return { cols: leaf.width, rows: leaf.height };
|
|
651
|
+
}
|
|
652
|
+
return null;
|
|
653
|
+
}
|
|
654
|
+
// ── Flow control ─────────────────────────────────────────────────────────
|
|
655
|
+
freeze(sub) {
|
|
656
|
+
if (sub.frozen || sub.closed)
|
|
657
|
+
return;
|
|
658
|
+
sub.frozen = true;
|
|
659
|
+
sub.onEvent({ type: "flow", state: "paused", reason: "requested" });
|
|
660
|
+
const pane = sub.pane;
|
|
661
|
+
const allFrozen = [...pane.subs].every((candidate) => candidate.frozen || candidate.closed);
|
|
662
|
+
if (allFrozen) {
|
|
663
|
+
this.cancelRecovery(pane.runtimeId);
|
|
664
|
+
this.ledger.requestPause(pane.runtimeId);
|
|
665
|
+
this.io.send(`refresh-client -A '${pane.runtimeId}:pause'`);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
thaw(sub) {
|
|
669
|
+
if (!sub.frozen || sub.closed)
|
|
670
|
+
return;
|
|
671
|
+
sub.frozen = false;
|
|
672
|
+
const runtime = sub.pane.runtimeId;
|
|
673
|
+
if (this.ledger.isRequested(runtime) || this.ledger.isBackpressured(runtime))
|
|
674
|
+
this.beginRecovery(sub.pane, "requested");
|
|
675
|
+
else
|
|
676
|
+
this.reseedPlain(sub, "requested");
|
|
677
|
+
this.recoverSticky();
|
|
678
|
+
}
|
|
679
|
+
continuePane(runtime) {
|
|
680
|
+
this.io.send(`refresh-client -A '${runtime}:continue'`);
|
|
681
|
+
this.ledger.noteContinued(runtime);
|
|
682
|
+
}
|
|
683
|
+
scheduleRecovery(callback, delayMs) {
|
|
684
|
+
if (this.opts.scheduleRecovery)
|
|
685
|
+
return this.opts.scheduleRecovery(callback, delayMs);
|
|
686
|
+
const timer = setTimeout(callback, delayMs);
|
|
687
|
+
return () => clearTimeout(timer);
|
|
688
|
+
}
|
|
689
|
+
observeRecovery(pane, recovery, phase, failureReason = null, fingerprintExact = null) {
|
|
690
|
+
const elapsedMicros = Math.min(RECOVERY_ABSOLUTE_DEADLINE_MS * 1_000, Math.max(0, Math.floor((this.recoveryNowMs() - recovery.startedAtMs) * 1_000)));
|
|
691
|
+
this.opts.onFlowRecoveryObserved?.(Object.freeze({
|
|
692
|
+
semanticPaneId: pane.semanticId,
|
|
693
|
+
phase,
|
|
694
|
+
recoveryOrdinal: recovery.ordinal,
|
|
695
|
+
paneIncarnation: recovery.paneIncarnation,
|
|
696
|
+
outputOrdinal: this.outputOrdinals.get(recovery.runtimeId) ?? 0,
|
|
697
|
+
failureReason,
|
|
698
|
+
elapsedMicros,
|
|
699
|
+
fingerprintExact,
|
|
700
|
+
confirmationOrdinal: recovery.confirmationOrdinal,
|
|
701
|
+
collectorStarted: recovery.collectorStarted,
|
|
702
|
+
collectorLastCompletedOrdinal: recovery.collectorLastCompletedOrdinal,
|
|
703
|
+
collectorCaptureLineCount: recovery.collectorCaptureLineCount,
|
|
704
|
+
collectorCaptureByteCount: recovery.collectorCaptureByteCount,
|
|
705
|
+
collectorContinueObserved: recovery.collectorContinueObserved,
|
|
706
|
+
collectorStatusObserved: recovery.collectorStatusObserved,
|
|
707
|
+
collectorObserverEmissionObserved: recovery.collectorObserverEmissionObserved,
|
|
708
|
+
collectorFailureReason: recovery.collectorFailureReason,
|
|
709
|
+
}));
|
|
710
|
+
}
|
|
711
|
+
recoveryNowMs() {
|
|
712
|
+
return this.opts.recoveryNowMs?.() ?? performance.now();
|
|
713
|
+
}
|
|
714
|
+
recoveryPane(recovery) {
|
|
715
|
+
const pane = this.panesByRuntime.get(recovery.runtimeId);
|
|
716
|
+
return !this.disposed &&
|
|
717
|
+
this.recoveries.get(recovery.runtimeId) === recovery &&
|
|
718
|
+
pane?.incarnation === recovery.paneIncarnation
|
|
719
|
+
? !recovery.retired
|
|
720
|
+
? pane
|
|
721
|
+
: null
|
|
722
|
+
: null;
|
|
723
|
+
}
|
|
724
|
+
cancelRecovery(runtime) {
|
|
725
|
+
const recovery = this.recoveries.get(runtime);
|
|
726
|
+
if (!recovery)
|
|
727
|
+
return;
|
|
728
|
+
recovery.retired = true;
|
|
729
|
+
recovery.cancelQuiet?.();
|
|
730
|
+
recovery.cancelCommandDeadline?.();
|
|
731
|
+
recovery.cancelNoProgressDeadline?.();
|
|
732
|
+
recovery.cancelAbsoluteDeadline?.();
|
|
733
|
+
if (recovery.atomicCollectorNonce)
|
|
734
|
+
this.io.retireAtomicPaneSnapshotCollector?.(recovery.atomicCollectorNonce, "retired");
|
|
735
|
+
recovery.atomicCollectorNonce = null;
|
|
736
|
+
this.recoveries.delete(runtime);
|
|
737
|
+
this.retireContinueNotificationOwner(recovery);
|
|
738
|
+
const pane = this.panesByRuntime.get(runtime);
|
|
739
|
+
if (pane?.incarnation === recovery.paneIncarnation)
|
|
740
|
+
for (const sub of pane.subs)
|
|
741
|
+
sub.feed.abortCurrent();
|
|
742
|
+
}
|
|
743
|
+
beginRecovery(pane, reason) {
|
|
744
|
+
const runtime = pane.runtimeId;
|
|
745
|
+
this.cancelRecovery(runtime);
|
|
746
|
+
const recovery = {
|
|
747
|
+
ordinal: ++this.recoveryOrdinal,
|
|
748
|
+
runtimeId: runtime,
|
|
749
|
+
paneIncarnation: pane.incarnation,
|
|
750
|
+
reason,
|
|
751
|
+
startedAtMs: this.recoveryNowMs(),
|
|
752
|
+
retired: false,
|
|
753
|
+
continueReply: false,
|
|
754
|
+
continueNotify: false,
|
|
755
|
+
stage: "continue",
|
|
756
|
+
attempts: 0,
|
|
757
|
+
reseedOrdinal: 0,
|
|
758
|
+
outputOrdinal: this.outputOrdinals.get(runtime) ?? 0,
|
|
759
|
+
candidateFingerprint: null,
|
|
760
|
+
confirmationFingerprint: null,
|
|
761
|
+
confirmationOrdinal: 0,
|
|
762
|
+
atomicCollectorNonce: null,
|
|
763
|
+
collectorStarted: false,
|
|
764
|
+
collectorLastCompletedOrdinal: -1,
|
|
765
|
+
collectorCaptureLineCount: 0,
|
|
766
|
+
collectorCaptureByteCount: 0,
|
|
767
|
+
collectorContinueObserved: false,
|
|
768
|
+
collectorStatusObserved: false,
|
|
769
|
+
collectorObserverEmissionObserved: false,
|
|
770
|
+
collectorFailureReason: null,
|
|
771
|
+
cancelQuiet: null,
|
|
772
|
+
cancelCommandDeadline: null,
|
|
773
|
+
cancelNoProgressDeadline: null,
|
|
774
|
+
cancelAbsoluteDeadline: null,
|
|
775
|
+
};
|
|
776
|
+
this.recoveries.set(runtime, recovery);
|
|
777
|
+
for (const sub of pane.subs) {
|
|
778
|
+
if (!sub.frozen && !sub.closed)
|
|
779
|
+
sub.feed.abortCurrent();
|
|
780
|
+
}
|
|
781
|
+
this.observeRecovery(pane, recovery, "pause");
|
|
782
|
+
this.observeRecovery(pane, recovery, "continue-request");
|
|
783
|
+
recovery.cancelCommandDeadline = this.scheduleRecovery(() => {
|
|
784
|
+
if (this.recoveryPane(recovery) && !recovery.continueReply)
|
|
785
|
+
this.failRecovery(recovery, "command-timeout");
|
|
786
|
+
}, RECOVERY_COMMAND_DEADLINE_MS);
|
|
787
|
+
const queue = this.continueNotificationQueues.get(runtime) ?? [];
|
|
788
|
+
if (queue.length >= MAX_CONTINUE_NOTIFICATION_QUEUE) {
|
|
789
|
+
this.failRecovery(recovery, "notification-queue-overflow");
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
queue.push({ kind: "owner", recovery });
|
|
793
|
+
this.continueNotificationQueues.set(runtime, queue);
|
|
794
|
+
this.io.send(`refresh-client -A '${runtime}:continue'`, (reply) => {
|
|
795
|
+
const current = this.recoveryPane(recovery);
|
|
796
|
+
if (!reply.ok) {
|
|
797
|
+
this.removeContinueNotificationOwner(recovery);
|
|
798
|
+
if (current)
|
|
799
|
+
this.failRecovery(recovery, "command-error");
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
recovery.continueReply = true;
|
|
803
|
+
if (!current) {
|
|
804
|
+
this.retireContinueNotificationOwner(recovery);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
recovery.cancelCommandDeadline?.();
|
|
808
|
+
recovery.cancelCommandDeadline = null;
|
|
809
|
+
this.beginRecoveryConvergence(recovery);
|
|
810
|
+
this.observeRecovery(current, recovery, "continue-reply");
|
|
811
|
+
this.noteRecoveryProgress(recovery);
|
|
812
|
+
this.beginFinalRecovery(recovery);
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
beginLocalOverflowRecovery(pane) {
|
|
816
|
+
const runtime = pane.runtimeId;
|
|
817
|
+
this.cancelRecovery(runtime);
|
|
818
|
+
const recovery = {
|
|
819
|
+
ordinal: ++this.recoveryOrdinal,
|
|
820
|
+
runtimeId: runtime,
|
|
821
|
+
paneIncarnation: pane.incarnation,
|
|
822
|
+
reason: "backpressure",
|
|
823
|
+
startedAtMs: this.recoveryNowMs(),
|
|
824
|
+
retired: false,
|
|
825
|
+
continueReply: true,
|
|
826
|
+
continueNotify: true,
|
|
827
|
+
stage: "continue",
|
|
828
|
+
attempts: 0,
|
|
829
|
+
reseedOrdinal: 0,
|
|
830
|
+
outputOrdinal: this.outputOrdinals.get(runtime) ?? 0,
|
|
831
|
+
candidateFingerprint: null,
|
|
832
|
+
confirmationFingerprint: null,
|
|
833
|
+
confirmationOrdinal: 0,
|
|
834
|
+
atomicCollectorNonce: null,
|
|
835
|
+
collectorStarted: false,
|
|
836
|
+
collectorLastCompletedOrdinal: -1,
|
|
837
|
+
collectorCaptureLineCount: 0,
|
|
838
|
+
collectorCaptureByteCount: 0,
|
|
839
|
+
collectorContinueObserved: false,
|
|
840
|
+
collectorStatusObserved: false,
|
|
841
|
+
collectorObserverEmissionObserved: false,
|
|
842
|
+
collectorFailureReason: null,
|
|
843
|
+
cancelQuiet: null,
|
|
844
|
+
cancelCommandDeadline: null,
|
|
845
|
+
cancelNoProgressDeadline: null,
|
|
846
|
+
cancelAbsoluteDeadline: null,
|
|
847
|
+
};
|
|
848
|
+
this.recoveries.set(runtime, recovery);
|
|
849
|
+
for (const sub of pane.subs) {
|
|
850
|
+
if (!sub.frozen && !sub.closed)
|
|
851
|
+
sub.onEvent({ type: "flow", state: "paused", reason: "backpressure" });
|
|
852
|
+
}
|
|
853
|
+
this.observeRecovery(pane, recovery, "pause");
|
|
854
|
+
this.beginRecoveryConvergence(recovery);
|
|
855
|
+
this.beginFinalRecovery(recovery);
|
|
856
|
+
}
|
|
857
|
+
beginRecoveryConvergence(recovery) {
|
|
858
|
+
if (recovery.cancelAbsoluteDeadline)
|
|
859
|
+
return;
|
|
860
|
+
recovery.cancelAbsoluteDeadline = this.scheduleRecovery(() => {
|
|
861
|
+
if (this.recoveryPane(recovery))
|
|
862
|
+
this.failRecovery(recovery, "absolute-deadline");
|
|
863
|
+
}, RECOVERY_ABSOLUTE_DEADLINE_MS);
|
|
864
|
+
this.noteRecoveryProgress(recovery);
|
|
865
|
+
}
|
|
866
|
+
noteRecoveryProgress(recovery) {
|
|
867
|
+
if (!this.recoveryPane(recovery) || !recovery.cancelAbsoluteDeadline)
|
|
868
|
+
return;
|
|
869
|
+
recovery.cancelNoProgressDeadline?.();
|
|
870
|
+
recovery.cancelNoProgressDeadline = this.scheduleRecovery(() => {
|
|
871
|
+
if (this.recoveryPane(recovery))
|
|
872
|
+
this.failRecovery(recovery, "no-progress");
|
|
873
|
+
}, RECOVERY_NO_PROGRESS_DEADLINE_MS);
|
|
874
|
+
}
|
|
875
|
+
noteAtomicCollectorProgress(recovery, nonce, progress) {
|
|
876
|
+
if (this.recoveryPane(recovery) === null ||
|
|
877
|
+
recovery.atomicCollectorNonce !== nonce ||
|
|
878
|
+
!progress.started)
|
|
879
|
+
return;
|
|
880
|
+
recovery.collectorStarted = true;
|
|
881
|
+
recovery.collectorLastCompletedOrdinal = Math.max(recovery.collectorLastCompletedOrdinal, progress.lastCompletedOrdinal);
|
|
882
|
+
recovery.collectorCaptureLineCount = Math.max(recovery.collectorCaptureLineCount, progress.captureLineCount);
|
|
883
|
+
recovery.collectorCaptureByteCount = Math.max(recovery.collectorCaptureByteCount, progress.captureByteCount);
|
|
884
|
+
recovery.collectorContinueObserved ||= progress.continueObserved;
|
|
885
|
+
recovery.collectorStatusObserved ||= progress.statusObserved;
|
|
886
|
+
recovery.collectorObserverEmissionObserved ||= progress.observerEmissionObserved;
|
|
887
|
+
this.noteRecoveryProgress(recovery);
|
|
888
|
+
}
|
|
889
|
+
reseedRecoverySubscribers(pane, recovery, done, deferPublish = false) {
|
|
890
|
+
if (this.io.armAtomicPaneSnapshotCollector && this.io.retireAtomicPaneSnapshotCollector) {
|
|
891
|
+
this.reseedRecoverySubscribersAtomic(pane, recovery, done, deferPublish);
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
const live = [...pane.subs].filter((sub) => !sub.frozen && !sub.closed);
|
|
895
|
+
if (live.length === 0) {
|
|
896
|
+
done(FAILED_RESEED_RESULT);
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
const participants = live.map((sub) => Object.freeze({ sub, epoch: sub.feed.beginReseed() }));
|
|
900
|
+
const reseedOrdinal = ++recovery.reseedOrdinal;
|
|
901
|
+
let settled = false;
|
|
902
|
+
let captureSucceeded = false;
|
|
903
|
+
let markerRetired = false;
|
|
904
|
+
let captureLines = null;
|
|
905
|
+
// One pane authority capture is enough for every subscriber. Per-feed
|
|
906
|
+
// epochs still independently fence delivery, while membership is frozen
|
|
907
|
+
// across both FIFO replies so no subscriber can join half a snapshot.
|
|
908
|
+
this.input.flush();
|
|
909
|
+
const history = this.opts.historyLines ?? DEFAULT_HISTORY_LINES;
|
|
910
|
+
const internalReadMarker = registerInternalReadOperation(pane.runtimeId);
|
|
911
|
+
const participantsExact = () => {
|
|
912
|
+
if (this.recoveryPane(recovery) !== pane ||
|
|
913
|
+
recovery.reseedOrdinal !== reseedOrdinal ||
|
|
914
|
+
participants.some(({ sub }) => sub.closed || sub.frozen || sub.pane !== pane || !pane.subs.has(sub)))
|
|
915
|
+
return false;
|
|
916
|
+
const current = [...pane.subs].filter((sub) => !sub.frozen && !sub.closed);
|
|
917
|
+
return (current.length === participants.length &&
|
|
918
|
+
current.every((sub) => participants.some((participant) => participant.sub === sub)));
|
|
919
|
+
};
|
|
920
|
+
const retireMarker = () => {
|
|
921
|
+
if (markerRetired)
|
|
922
|
+
return;
|
|
923
|
+
markerRetired = true;
|
|
924
|
+
this.retireInternalReadMarker(pane.runtimeId, internalReadMarker);
|
|
925
|
+
};
|
|
926
|
+
const fail = () => {
|
|
927
|
+
if (settled)
|
|
928
|
+
return;
|
|
929
|
+
settled = true;
|
|
930
|
+
if (!captureSucceeded)
|
|
931
|
+
retireMarker();
|
|
932
|
+
for (const { sub } of participants)
|
|
933
|
+
sub.feed.abortCurrent();
|
|
934
|
+
done(FAILED_RESEED_RESULT);
|
|
935
|
+
};
|
|
936
|
+
this.io.commandListInline(`set-option -p -t ${pane.runtimeId} ${INTERNAL_READ_OPERATION_OPTION} ${internalReadMarker} ; capture-pane -p -e -J -S -${history} -t ${pane.runtimeId}`, 2, 1, (reply) => {
|
|
937
|
+
if (!reply.ok) {
|
|
938
|
+
fail();
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
captureSucceeded = true;
|
|
942
|
+
if (!participantsExact()) {
|
|
943
|
+
fail();
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
captureLines = Object.freeze([...reply.lines]);
|
|
947
|
+
for (const { sub, epoch } of participants)
|
|
948
|
+
sub.feed.captureReply(epoch, captureLines);
|
|
949
|
+
});
|
|
950
|
+
this.io.commandInline(`display-message -p -t ${pane.runtimeId} "${RECOVERY_CURSOR_PROBE_FORMAT}"`, (reply) => {
|
|
951
|
+
if (settled)
|
|
952
|
+
return;
|
|
953
|
+
if (!participantsExact() || captureLines === null || !reply.ok) {
|
|
954
|
+
fail();
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
const cursorLine = reply.lines[0] ?? "";
|
|
958
|
+
const fallbackSize = this.layoutSizeFor(pane.runtimeId);
|
|
959
|
+
const deliveries = participants.map(({ sub, epoch }) => ({
|
|
960
|
+
sub,
|
|
961
|
+
epoch,
|
|
962
|
+
events: sub.feed.cursorReply(epoch, cursorLine, fallbackSize),
|
|
963
|
+
}));
|
|
964
|
+
if (!participantsExact() || deliveries.some(({ events }) => events.length === 0)) {
|
|
965
|
+
fail();
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
let published = false;
|
|
969
|
+
const publish = () => {
|
|
970
|
+
if (published)
|
|
971
|
+
return true;
|
|
972
|
+
if (!participantsExact())
|
|
973
|
+
return false;
|
|
974
|
+
published = true;
|
|
975
|
+
for (const { sub, events } of deliveries)
|
|
976
|
+
for (const event of events)
|
|
977
|
+
sub.onEvent(event);
|
|
978
|
+
return participantsExact();
|
|
979
|
+
};
|
|
980
|
+
if (!deferPublish && !publish()) {
|
|
981
|
+
fail();
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
for (const { sub, epoch } of deliveries)
|
|
985
|
+
sub.feed.quarantine(epoch);
|
|
986
|
+
settled = true;
|
|
987
|
+
done({
|
|
988
|
+
ok: true,
|
|
989
|
+
fingerprint: snapshotFingerprint(captureLines, cursorLine, fallbackSize),
|
|
990
|
+
publish,
|
|
991
|
+
hold: () => { },
|
|
992
|
+
});
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
reseedRecoverySubscribersAtomic(pane, recovery, done, deferPublish) {
|
|
996
|
+
const live = [...pane.subs].filter((sub) => !sub.frozen && !sub.closed);
|
|
997
|
+
if (live.length === 0) {
|
|
998
|
+
done(FAILED_RESEED_RESULT);
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
const participants = live.map((sub) => Object.freeze({ sub, epoch: sub.feed.beginReseed() }));
|
|
1002
|
+
const reseedOrdinal = ++recovery.reseedOrdinal;
|
|
1003
|
+
const nonce = this.opts.generateAtomicHookNonce?.() ?? randomBytes(24).toString("hex");
|
|
1004
|
+
if (!/^[0-9a-f]{32,128}$/u.test(nonce)) {
|
|
1005
|
+
for (const { sub } of participants)
|
|
1006
|
+
sub.feed.abortCurrent();
|
|
1007
|
+
done(FAILED_RESEED_RESULT);
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
const hookName = `@tmux_ide_atomic_${nonce}`;
|
|
1011
|
+
const expectedName = `@tmux_ide_atomic_expected_${nonce}`;
|
|
1012
|
+
const ownerName = `@tmux_ide_atomic_owner_${nonce}`;
|
|
1013
|
+
const internalReadMarker = registerInternalReadOperation(pane.runtimeId);
|
|
1014
|
+
recovery.atomicCollectorNonce = nonce;
|
|
1015
|
+
recovery.collectorStarted = false;
|
|
1016
|
+
recovery.collectorLastCompletedOrdinal = -1;
|
|
1017
|
+
recovery.collectorCaptureLineCount = 0;
|
|
1018
|
+
recovery.collectorCaptureByteCount = 0;
|
|
1019
|
+
recovery.collectorContinueObserved = false;
|
|
1020
|
+
recovery.collectorStatusObserved = false;
|
|
1021
|
+
recovery.collectorObserverEmissionObserved = false;
|
|
1022
|
+
recovery.collectorFailureReason = null;
|
|
1023
|
+
const participantsExact = () => {
|
|
1024
|
+
if (this.recoveryPane(recovery) !== pane ||
|
|
1025
|
+
recovery.reseedOrdinal !== reseedOrdinal ||
|
|
1026
|
+
participants.some(({ sub }) => sub.closed || sub.frozen || sub.pane !== pane || !pane.subs.has(sub)))
|
|
1027
|
+
return false;
|
|
1028
|
+
const current = [...pane.subs].filter((sub) => !sub.frozen && !sub.closed);
|
|
1029
|
+
return (current.length === participants.length &&
|
|
1030
|
+
current.every((sub) => participants.some((participant) => participant.sub === sub)));
|
|
1031
|
+
};
|
|
1032
|
+
let settled = false;
|
|
1033
|
+
let observerEmitted = false;
|
|
1034
|
+
const hookOwned = `#{==:#{${ownerName}},${nonce}}`;
|
|
1035
|
+
const hookUnchanged = `#{==:#{${hookName}},#{${expectedName}}}`;
|
|
1036
|
+
const cleanupHook = () => {
|
|
1037
|
+
this.io.commandListInline(`if-shell -t ${pane.runtimeId} -F "#{&&:${hookOwned},${hookUnchanged}}" ` +
|
|
1038
|
+
`${tmuxSingleQuote(`set-option -pu -t ${pane.runtimeId} ${hookName}`)} ` +
|
|
1039
|
+
tmuxSingleQuote(`display-message -p -t ${pane.runtimeId} tmux-ide-atomic-cleanup-hook-skip-v1:${nonce}`), 2, 1, () => { });
|
|
1040
|
+
this.io.commandListInline(`if-shell -t ${pane.runtimeId} -F "${hookOwned}" ` +
|
|
1041
|
+
tmuxSingleQuote(`set-option -pu -t ${pane.runtimeId} ${expectedName}`) +
|
|
1042
|
+
` ${tmuxSingleQuote(`display-message -p -t ${pane.runtimeId} tmux-ide-atomic-cleanup-expected-skip-v1:${nonce}`)}`, 2, 1, () => { });
|
|
1043
|
+
this.io.commandListInline(`if-shell -t ${pane.runtimeId} -F "${hookOwned}" ` +
|
|
1044
|
+
tmuxSingleQuote(`set-option -pu -t ${pane.runtimeId} ${ownerName}`) +
|
|
1045
|
+
` ${tmuxSingleQuote(`display-message -p -t ${pane.runtimeId} tmux-ide-atomic-cleanup-owner-skip-v1:${nonce}`)}`, 2, 1, () => { });
|
|
1046
|
+
};
|
|
1047
|
+
const fail = (statusObserved = false) => {
|
|
1048
|
+
if (settled)
|
|
1049
|
+
return;
|
|
1050
|
+
settled = true;
|
|
1051
|
+
if (recovery.atomicCollectorNonce === nonce)
|
|
1052
|
+
recovery.atomicCollectorNonce = null;
|
|
1053
|
+
cleanupHook();
|
|
1054
|
+
if (!statusObserved && !observerEmitted)
|
|
1055
|
+
this.retireInternalReadMarker(pane.runtimeId, internalReadMarker);
|
|
1056
|
+
for (const { sub } of participants)
|
|
1057
|
+
sub.feed.abortCurrent();
|
|
1058
|
+
done(FAILED_RESEED_RESULT);
|
|
1059
|
+
};
|
|
1060
|
+
let observer;
|
|
1061
|
+
try {
|
|
1062
|
+
observer = this.opts.internalReadHookEmission?.(pane.runtimeId, internalReadMarker) ?? null;
|
|
1063
|
+
}
|
|
1064
|
+
catch {
|
|
1065
|
+
fail();
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
const safeObserver = observer !== null &&
|
|
1069
|
+
/^[A-Za-z0-9._-]{1,256}$/u.test(observer.bufferName) &&
|
|
1070
|
+
/^[A-Za-z0-9._-]{1,256}$/u.test(observer.signalChannel) &&
|
|
1071
|
+
/^[A-Za-z0-9%:._|-]{1,1024}$/u.test(observer.record);
|
|
1072
|
+
if (!safeObserver) {
|
|
1073
|
+
fail();
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
const sentinel = (kind) => `display-message -p -t ${pane.runtimeId} ` + `"%tmux-ide-atomic-v1 ${nonce} ${kind}"`;
|
|
1077
|
+
const observerCommands = ` ; set-buffer -a -b ${observer.bufferName} ${observer.record}` +
|
|
1078
|
+
` ; wait-for -S ${observer.signalChannel}`;
|
|
1079
|
+
const body = `set-option -po -t ${pane.runtimeId} ${INTERNAL_READ_OPERATION_OPTION} ${internalReadMarker}` +
|
|
1080
|
+
` ; ${sentinel("start")}` +
|
|
1081
|
+
` ; capture-pane -p -e -J -S -${this.opts.historyLines ?? DEFAULT_HISTORY_LINES} -t ${pane.runtimeId}` +
|
|
1082
|
+
` ; ${sentinel("capture-end")}` +
|
|
1083
|
+
` ; display-message -p -t ${pane.runtimeId} "${RECOVERY_CURSOR_PROBE_FORMAT}"` +
|
|
1084
|
+
` ; ${sentinel("cursor-end")}` +
|
|
1085
|
+
` ; refresh-client -A ${pane.runtimeId}:continue` +
|
|
1086
|
+
observerCommands +
|
|
1087
|
+
` ; if-shell -t ${pane.runtimeId} -F ` +
|
|
1088
|
+
`"#{==:#{${INTERNAL_READ_OPERATION_OPTION}},${internalReadMarker}}" ` +
|
|
1089
|
+
tmuxSingleQuote(`set-option -pu -t ${pane.runtimeId} ${INTERNAL_READ_OPERATION_OPTION}`) +
|
|
1090
|
+
` ${tmuxSingleQuote(`${sentinel("marker-rejected")}`)}` +
|
|
1091
|
+
` ; ${sentinel("status-ok")}` +
|
|
1092
|
+
` ; set-option -pu -t ${pane.runtimeId} ${hookName}` +
|
|
1093
|
+
` ; ${sentinel("complete")}`;
|
|
1094
|
+
this.input.flush();
|
|
1095
|
+
const invoke = (reply) => {
|
|
1096
|
+
if (!reply.ok || !participantsExact()) {
|
|
1097
|
+
fail();
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
const remaining = Math.floor(RECOVERY_ABSOLUTE_DEADLINE_MS - (this.recoveryNowMs() - recovery.startedAtMs));
|
|
1101
|
+
if (remaining <= 0) {
|
|
1102
|
+
fail();
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
const armed = this.io.armAtomicPaneSnapshotCollector({
|
|
1106
|
+
nonce,
|
|
1107
|
+
runtimePaneId: pane.runtimeId,
|
|
1108
|
+
maxCaptureBytes: RECOVERY_CAPTURE_MAX_BYTES,
|
|
1109
|
+
maxCaptureLines: RECOVERY_CAPTURE_MAX_LINES,
|
|
1110
|
+
maxCursorBytes: RECOVERY_CURSOR_MAX_BYTES,
|
|
1111
|
+
observerCommandCount: 2,
|
|
1112
|
+
onProgress: (progress) => this.noteAtomicCollectorProgress(recovery, nonce, progress),
|
|
1113
|
+
onSettled: (result) => {
|
|
1114
|
+
if (recovery.atomicCollectorNonce === nonce)
|
|
1115
|
+
recovery.atomicCollectorNonce = null;
|
|
1116
|
+
recovery.collectorStarted ||= result.started;
|
|
1117
|
+
recovery.collectorLastCompletedOrdinal = Math.max(recovery.collectorLastCompletedOrdinal, result.lastCompletedOrdinal);
|
|
1118
|
+
recovery.collectorCaptureLineCount = Math.max(recovery.collectorCaptureLineCount, result.captureLineCount);
|
|
1119
|
+
recovery.collectorCaptureByteCount = Math.max(recovery.collectorCaptureByteCount, result.captureByteCount);
|
|
1120
|
+
recovery.collectorContinueObserved ||= result.continueObserved;
|
|
1121
|
+
recovery.collectorStatusObserved ||= result.statusObserved;
|
|
1122
|
+
recovery.collectorObserverEmissionObserved ||= result.observerEmissionObserved;
|
|
1123
|
+
recovery.collectorFailureReason = result.failureReason;
|
|
1124
|
+
observerEmitted = result.observerEmissionObserved && safeObserver;
|
|
1125
|
+
cleanupHook();
|
|
1126
|
+
if (settled)
|
|
1127
|
+
return;
|
|
1128
|
+
if (!result.ok || !participantsExact() || result.cursorLine === null) {
|
|
1129
|
+
fail(result.statusObserved);
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
const captureLines = Object.freeze([...result.captureLines]);
|
|
1133
|
+
for (const { sub, epoch } of participants)
|
|
1134
|
+
sub.feed.captureReply(epoch, captureLines);
|
|
1135
|
+
const fallbackSize = this.layoutSizeFor(pane.runtimeId);
|
|
1136
|
+
const deliveries = participants.map(({ sub, epoch }) => ({
|
|
1137
|
+
sub,
|
|
1138
|
+
epoch,
|
|
1139
|
+
events: sub.feed.cursorReply(epoch, result.cursorLine, fallbackSize),
|
|
1140
|
+
}));
|
|
1141
|
+
if (!participantsExact() || deliveries.some(({ events }) => events.length === 0)) {
|
|
1142
|
+
fail(true);
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
let published = false;
|
|
1146
|
+
const publish = () => {
|
|
1147
|
+
if (published)
|
|
1148
|
+
return true;
|
|
1149
|
+
if (!participantsExact())
|
|
1150
|
+
return false;
|
|
1151
|
+
published = true;
|
|
1152
|
+
for (const { sub, events } of deliveries)
|
|
1153
|
+
for (const event of events)
|
|
1154
|
+
sub.onEvent(event);
|
|
1155
|
+
return participantsExact();
|
|
1156
|
+
};
|
|
1157
|
+
if (!deferPublish && !publish()) {
|
|
1158
|
+
fail(true);
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
for (const { sub, epoch } of deliveries)
|
|
1162
|
+
sub.feed.quarantine(epoch);
|
|
1163
|
+
settled = true;
|
|
1164
|
+
done({
|
|
1165
|
+
ok: true,
|
|
1166
|
+
fingerprint: snapshotFingerprint(captureLines, result.cursorLine, fallbackSize),
|
|
1167
|
+
publish,
|
|
1168
|
+
hold: () => { },
|
|
1169
|
+
});
|
|
1170
|
+
},
|
|
1171
|
+
}, remaining);
|
|
1172
|
+
if (!armed) {
|
|
1173
|
+
fail();
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
const rejected = `tmux-ide-atomic-invoke-rejected-v1:${nonce}`;
|
|
1177
|
+
this.io.commandListInline(`if-shell -t ${pane.runtimeId} -F "#{&&:${hookOwned},${hookUnchanged}}" ` +
|
|
1178
|
+
`${tmuxSingleQuote(`set-hook -Rp -t ${pane.runtimeId} ${hookName}`)} ` +
|
|
1179
|
+
tmuxSingleQuote(`display-message -p -t ${pane.runtimeId} ${rejected}`), 2, 1, (hookReply) => {
|
|
1180
|
+
if (!hookReply.ok || hookReply.lines.length > 0) {
|
|
1181
|
+
this.io.retireAtomicPaneSnapshotCollector?.(nonce, "retired");
|
|
1182
|
+
fail();
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
};
|
|
1186
|
+
// Three owner-local create-only writes avoid a command-group partial-error
|
|
1187
|
+
// ambiguity: every accepted step has its own ordered reply and any later
|
|
1188
|
+
// failure can conditionally retire exactly the already-created prefix.
|
|
1189
|
+
this.io.commandInline(`set-option -po -t ${pane.runtimeId} ${ownerName} ${nonce}`, (ownerReply) => {
|
|
1190
|
+
if (!ownerReply.ok || !participantsExact()) {
|
|
1191
|
+
fail();
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
this.io.commandInline(`set-option -po -t ${pane.runtimeId} ${expectedName} ${tmuxSingleQuote(body)}`, (expectedReply) => {
|
|
1195
|
+
if (!expectedReply.ok || !participantsExact()) {
|
|
1196
|
+
fail();
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
this.io.commandInline(`set-option -po -t ${pane.runtimeId} ${hookName} ${tmuxSingleQuote(body)}`, invoke);
|
|
1200
|
+
});
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
armRecoveryQuiet(recovery, callback) {
|
|
1204
|
+
recovery.cancelQuiet?.();
|
|
1205
|
+
recovery.cancelQuiet = this.scheduleRecovery(() => {
|
|
1206
|
+
recovery.cancelQuiet = null;
|
|
1207
|
+
if (this.recoveryPane(recovery))
|
|
1208
|
+
callback();
|
|
1209
|
+
}, RECOVERY_QUIET_MS);
|
|
1210
|
+
}
|
|
1211
|
+
beginFinalRecovery(recovery) {
|
|
1212
|
+
const pane = this.recoveryPane(recovery);
|
|
1213
|
+
if (!pane)
|
|
1214
|
+
return;
|
|
1215
|
+
if (recovery.attempts >= RECOVERY_MAX_ATTEMPTS) {
|
|
1216
|
+
this.failRecovery(recovery, "attempts-exhausted");
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
recovery.attempts += 1;
|
|
1220
|
+
recovery.stage = "final";
|
|
1221
|
+
this.noteRecoveryProgress(recovery);
|
|
1222
|
+
// The final read is only a private candidate. Publishing it here can put
|
|
1223
|
+
// expensive replica projection ahead of the confirmation timers and, more
|
|
1224
|
+
// importantly, exposes a snapshot that has not yet survived the two-read
|
|
1225
|
+
// authority proof.
|
|
1226
|
+
this.reseedRecoverySubscribers(pane, recovery, ({ ok, fingerprint }) => {
|
|
1227
|
+
const current = this.recoveryPane(recovery);
|
|
1228
|
+
if (!current)
|
|
1229
|
+
return;
|
|
1230
|
+
if (!ok || fingerprint === null) {
|
|
1231
|
+
this.armRecoveryQuiet(recovery, () => this.beginFinalRecovery(recovery));
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
recovery.outputOrdinal = this.outputOrdinals.get(recovery.runtimeId) ?? 0;
|
|
1235
|
+
recovery.candidateFingerprint = fingerprint;
|
|
1236
|
+
recovery.confirmationFingerprint = null;
|
|
1237
|
+
recovery.confirmationOrdinal = 0;
|
|
1238
|
+
recovery.stage = "confirm";
|
|
1239
|
+
this.observeRecovery(current, recovery, "final-reseed");
|
|
1240
|
+
this.noteRecoveryProgress(recovery);
|
|
1241
|
+
this.armRecoveryQuiet(recovery, () => this.confirmRecovery(recovery));
|
|
1242
|
+
}, true);
|
|
1243
|
+
}
|
|
1244
|
+
confirmRecovery(recovery) {
|
|
1245
|
+
const pane = this.recoveryPane(recovery);
|
|
1246
|
+
if (!pane)
|
|
1247
|
+
return;
|
|
1248
|
+
if ((this.outputOrdinals.get(recovery.runtimeId) ?? 0) !== recovery.outputOrdinal) {
|
|
1249
|
+
this.beginFinalRecovery(recovery);
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
recovery.stage = "final";
|
|
1253
|
+
this.noteRecoveryProgress(recovery);
|
|
1254
|
+
this.reseedRecoverySubscribers(pane, recovery, ({ ok, fingerprint, publish }) => {
|
|
1255
|
+
const current = this.recoveryPane(recovery);
|
|
1256
|
+
if (!current)
|
|
1257
|
+
return;
|
|
1258
|
+
if (!ok || fingerprint === null) {
|
|
1259
|
+
this.armRecoveryQuiet(recovery, () => this.beginFinalRecovery(recovery));
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
const outputOrdinal = this.outputOrdinals.get(recovery.runtimeId) ?? 0;
|
|
1263
|
+
const ordinalExact = outputOrdinal === recovery.outputOrdinal;
|
|
1264
|
+
const candidateExact = ordinalExact && fingerprint === recovery.candidateFingerprint;
|
|
1265
|
+
const consecutiveExact = candidateExact &&
|
|
1266
|
+
recovery.confirmationFingerprint !== null &&
|
|
1267
|
+
fingerprint === recovery.confirmationFingerprint;
|
|
1268
|
+
recovery.confirmationOrdinal += 1;
|
|
1269
|
+
this.observeRecovery(current, recovery, "confirmation-reseed", null, consecutiveExact);
|
|
1270
|
+
this.noteRecoveryProgress(recovery);
|
|
1271
|
+
if (!ordinalExact) {
|
|
1272
|
+
recovery.stage = "confirm";
|
|
1273
|
+
this.armRecoveryQuiet(recovery, () => this.beginFinalRecovery(recovery));
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
if (!candidateExact) {
|
|
1277
|
+
if (recovery.attempts >= RECOVERY_MAX_ATTEMPTS) {
|
|
1278
|
+
this.failRecovery(recovery, "attempts-exhausted");
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
// A changed confirmation replaces the private candidate without
|
|
1282
|
+
// becoming observable. Two subsequent reads must confirm this truth.
|
|
1283
|
+
recovery.attempts += 1;
|
|
1284
|
+
recovery.candidateFingerprint = fingerprint;
|
|
1285
|
+
recovery.confirmationFingerprint = null;
|
|
1286
|
+
recovery.outputOrdinal = outputOrdinal;
|
|
1287
|
+
recovery.stage = "confirm";
|
|
1288
|
+
this.armRecoveryQuiet(recovery, () => this.confirmRecovery(recovery));
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
if (!consecutiveExact) {
|
|
1292
|
+
recovery.confirmationFingerprint = fingerprint;
|
|
1293
|
+
recovery.outputOrdinal = outputOrdinal;
|
|
1294
|
+
recovery.stage = "confirm";
|
|
1295
|
+
this.armRecoveryQuiet(recovery, () => this.confirmRecovery(recovery));
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
// This publisher belongs to the current second matching read, not the
|
|
1299
|
+
// older candidate. Publish exactly once while every participant is
|
|
1300
|
+
// still fenced, then synchronously retire recovery before downstream
|
|
1301
|
+
// projection work can run.
|
|
1302
|
+
if (!publish()) {
|
|
1303
|
+
recovery.stage = "confirm";
|
|
1304
|
+
this.armRecoveryQuiet(recovery, () => this.beginFinalRecovery(recovery));
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
this.convergeRecovery(current, recovery);
|
|
1308
|
+
}, true);
|
|
1309
|
+
}
|
|
1310
|
+
convergeRecovery(pane, recovery) {
|
|
1311
|
+
recovery.cancelCommandDeadline?.();
|
|
1312
|
+
recovery.cancelCommandDeadline = null;
|
|
1313
|
+
recovery.cancelNoProgressDeadline?.();
|
|
1314
|
+
recovery.cancelNoProgressDeadline = null;
|
|
1315
|
+
recovery.cancelAbsoluteDeadline?.();
|
|
1316
|
+
recovery.cancelAbsoluteDeadline = null;
|
|
1317
|
+
this.recoveries.delete(recovery.runtimeId);
|
|
1318
|
+
recovery.retired = true;
|
|
1319
|
+
this.retireContinueNotificationOwner(recovery);
|
|
1320
|
+
this.ledger.noteContinued(recovery.runtimeId);
|
|
1321
|
+
if (recovery.reason === "requested")
|
|
1322
|
+
this.ledger.clearRequest(recovery.runtimeId);
|
|
1323
|
+
for (const sub of pane.subs) {
|
|
1324
|
+
if (!sub.frozen && !sub.closed) {
|
|
1325
|
+
sub.feed.releaseQuarantine();
|
|
1326
|
+
sub.onEvent({ type: "flow", state: "resumed", reason: recovery.reason });
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
this.observeRecovery(pane, recovery, "converged", null, true);
|
|
1330
|
+
}
|
|
1331
|
+
noteRecoveryOutput(pane, outputOrdinal) {
|
|
1332
|
+
const recovery = this.recoveries.get(pane.runtimeId);
|
|
1333
|
+
if (!recovery || recovery.paneIncarnation !== pane.incarnation)
|
|
1334
|
+
return;
|
|
1335
|
+
recovery.outputOrdinal = outputOrdinal;
|
|
1336
|
+
if (recovery.continueReply)
|
|
1337
|
+
this.noteRecoveryProgress(recovery);
|
|
1338
|
+
if (recovery.stage === "quiet")
|
|
1339
|
+
this.armRecoveryQuiet(recovery, () => this.beginFinalRecovery(recovery));
|
|
1340
|
+
else if (recovery.stage === "confirm")
|
|
1341
|
+
this.armRecoveryQuiet(recovery, () => this.beginFinalRecovery(recovery));
|
|
1342
|
+
}
|
|
1343
|
+
restartRecoveryAfterOutputOverflow(pane) {
|
|
1344
|
+
const recovery = this.recoveries.get(pane.runtimeId);
|
|
1345
|
+
if (recovery?.paneIncarnation === pane.incarnation) {
|
|
1346
|
+
if (recovery.stage === "quiet" || recovery.stage === "confirm")
|
|
1347
|
+
this.armRecoveryQuiet(recovery, () => this.beginFinalRecovery(recovery));
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
this.beginLocalOverflowRecovery(pane);
|
|
1351
|
+
}
|
|
1352
|
+
failRecovery(recovery, failureReason) {
|
|
1353
|
+
const pane = this.recoveryPane(recovery);
|
|
1354
|
+
if (!pane)
|
|
1355
|
+
return;
|
|
1356
|
+
recovery.cancelQuiet?.();
|
|
1357
|
+
recovery.cancelQuiet = null;
|
|
1358
|
+
recovery.cancelCommandDeadline?.();
|
|
1359
|
+
recovery.cancelCommandDeadline = null;
|
|
1360
|
+
recovery.cancelNoProgressDeadline?.();
|
|
1361
|
+
recovery.cancelNoProgressDeadline = null;
|
|
1362
|
+
recovery.cancelAbsoluteDeadline?.();
|
|
1363
|
+
recovery.cancelAbsoluteDeadline = null;
|
|
1364
|
+
recovery.retired = true;
|
|
1365
|
+
const collectorNonce = recovery.atomicCollectorNonce;
|
|
1366
|
+
recovery.atomicCollectorNonce = null;
|
|
1367
|
+
if (collectorNonce)
|
|
1368
|
+
this.io.retireAtomicPaneSnapshotCollector?.(collectorNonce, "retired");
|
|
1369
|
+
this.recoveries.delete(recovery.runtimeId);
|
|
1370
|
+
this.retireContinueNotificationOwner(recovery);
|
|
1371
|
+
for (const sub of pane.subs)
|
|
1372
|
+
sub.feed.abortCurrent();
|
|
1373
|
+
this.observeRecovery(pane, recovery, "nonconverged", failureReason);
|
|
1374
|
+
}
|
|
1375
|
+
removeContinueNotificationOwner(recovery) {
|
|
1376
|
+
const queue = this.continueNotificationQueues.get(recovery.runtimeId);
|
|
1377
|
+
if (!queue)
|
|
1378
|
+
return;
|
|
1379
|
+
const index = queue.findIndex((entry) => entry.kind === "owner" && entry.recovery === recovery);
|
|
1380
|
+
if (index < 0)
|
|
1381
|
+
return;
|
|
1382
|
+
queue.splice(index, 1);
|
|
1383
|
+
this.compactContinueNotificationQueue(recovery.runtimeId, queue);
|
|
1384
|
+
}
|
|
1385
|
+
retireContinueNotificationOwner(recovery) {
|
|
1386
|
+
if (!recovery.continueReply)
|
|
1387
|
+
return;
|
|
1388
|
+
const queue = this.continueNotificationQueues.get(recovery.runtimeId);
|
|
1389
|
+
if (!queue)
|
|
1390
|
+
return;
|
|
1391
|
+
const index = queue.findIndex((entry) => entry.kind === "owner" && entry.recovery === recovery);
|
|
1392
|
+
if (index < 0)
|
|
1393
|
+
return;
|
|
1394
|
+
queue.splice(index, 1, { kind: "debt", count: 1, saturated: false });
|
|
1395
|
+
this.compactContinueNotificationQueue(recovery.runtimeId, queue);
|
|
1396
|
+
}
|
|
1397
|
+
compactContinueNotificationQueue(runtime, queue) {
|
|
1398
|
+
for (let index = 1; index < queue.length;) {
|
|
1399
|
+
const previous = queue[index - 1];
|
|
1400
|
+
const current = queue[index];
|
|
1401
|
+
if (previous?.kind !== "debt" || current?.kind !== "debt") {
|
|
1402
|
+
index += 1;
|
|
1403
|
+
continue;
|
|
1404
|
+
}
|
|
1405
|
+
const total = previous.count + current.count;
|
|
1406
|
+
previous.count = Math.min(total, MAX_CONTINUE_NOTIFICATION_DEBT);
|
|
1407
|
+
previous.saturated =
|
|
1408
|
+
previous.saturated || current.saturated || total > MAX_CONTINUE_NOTIFICATION_DEBT;
|
|
1409
|
+
queue.splice(index, 1);
|
|
1410
|
+
}
|
|
1411
|
+
if (queue.length === 0)
|
|
1412
|
+
this.continueNotificationQueues.delete(runtime);
|
|
1413
|
+
else
|
|
1414
|
+
this.continueNotificationQueues.set(runtime, queue);
|
|
1415
|
+
}
|
|
1416
|
+
/** Continue + reseed EVERY backpressure-paused pane that still has an
|
|
1417
|
+
* unfrozen subscriber. %pause is sticky and hits quiet panes after any
|
|
1418
|
+
* stall — recovering only the noisy pane leaves siblings dark. */
|
|
1419
|
+
recoverSticky() {
|
|
1420
|
+
for (const runtime of this.ledger.stickyRecoverySet()) {
|
|
1421
|
+
if (this.recoveries.has(runtime))
|
|
1422
|
+
continue;
|
|
1423
|
+
const pane = this.panesByRuntime.get(runtime);
|
|
1424
|
+
const live = pane ? [...pane.subs].filter((sub) => !sub.frozen && !sub.closed) : [];
|
|
1425
|
+
if (live.length === 0)
|
|
1426
|
+
continue; // nobody watching: staying paused is free
|
|
1427
|
+
this.beginRecovery(pane, "backpressure");
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
closeSub(sub) {
|
|
1431
|
+
if (sub.closed)
|
|
1432
|
+
return;
|
|
1433
|
+
sub.closed = true;
|
|
1434
|
+
const pane = sub.pane;
|
|
1435
|
+
pane.subs.delete(sub);
|
|
1436
|
+
if ([...pane.subs].every((candidate) => candidate.closed || candidate.frozen))
|
|
1437
|
+
this.cancelRecovery(pane.runtimeId);
|
|
1438
|
+
// Ticket return on departure: a pane parked by a now-gone subscriber must
|
|
1439
|
+
// not stay paused forever.
|
|
1440
|
+
if (pane.subs.size === 0 && this.ledger.isRequested(pane.runtimeId)) {
|
|
1441
|
+
this.ledger.clearRequest(pane.runtimeId);
|
|
1442
|
+
this.continuePane(pane.runtimeId);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
// ── Notifications (channel order is the invariant) ──────────────────────
|
|
1446
|
+
onNotify(name, rest) {
|
|
1447
|
+
if (name === "layout-change" ||
|
|
1448
|
+
name === "window-pane-changed" ||
|
|
1449
|
+
name === "session-window-changed" ||
|
|
1450
|
+
STRUCTURAL_NOTIFICATIONS.has(name)) {
|
|
1451
|
+
this.windowAuthorityOrdinal += 1;
|
|
1452
|
+
}
|
|
1453
|
+
// Layout changes remain a second honest wake-up: a native resize can arrive
|
|
1454
|
+
// before the once-per-second subscription notification. The inventory
|
|
1455
|
+
// (not either notification) remains the proof.
|
|
1456
|
+
if (this.opts.onNativeClientActivity &&
|
|
1457
|
+
(NATIVE_CLIENT_NOTIFICATIONS.has(name) || name === "layout-change")) {
|
|
1458
|
+
this.probeNativeClientActivity();
|
|
1459
|
+
}
|
|
1460
|
+
if (name === "pause") {
|
|
1461
|
+
const runtime = rest.trim().split(/\s+/)[0] ?? "";
|
|
1462
|
+
if (!runtime.startsWith("%"))
|
|
1463
|
+
return;
|
|
1464
|
+
this.cancelRecovery(runtime);
|
|
1465
|
+
this.ledger.notePause(runtime);
|
|
1466
|
+
const pane = this.panesByRuntime.get(runtime);
|
|
1467
|
+
if (pane) {
|
|
1468
|
+
for (const sub of pane.subs) {
|
|
1469
|
+
if (!sub.frozen && !sub.closed) {
|
|
1470
|
+
sub.onEvent({ type: "flow", state: "paused", reason: "backpressure" });
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
this.recoverSticky();
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
if (name === "continue") {
|
|
1478
|
+
const runtime = rest.trim().split(/\s+/)[0] ?? "";
|
|
1479
|
+
if (runtime.startsWith("%")) {
|
|
1480
|
+
const queue = this.continueNotificationQueues.get(runtime);
|
|
1481
|
+
const entry = queue?.[0] ?? null;
|
|
1482
|
+
if (entry?.kind === "debt") {
|
|
1483
|
+
if (!entry.saturated) {
|
|
1484
|
+
entry.count -= 1;
|
|
1485
|
+
if (entry.count === 0)
|
|
1486
|
+
queue.shift();
|
|
1487
|
+
}
|
|
1488
|
+
this.compactContinueNotificationQueue(runtime, queue);
|
|
1489
|
+
}
|
|
1490
|
+
else if (entry?.kind === "owner") {
|
|
1491
|
+
queue.shift();
|
|
1492
|
+
this.compactContinueNotificationQueue(runtime, queue);
|
|
1493
|
+
const owner = entry.recovery;
|
|
1494
|
+
const pane = this.recoveryPane(owner);
|
|
1495
|
+
owner.continueNotify = true;
|
|
1496
|
+
if (pane) {
|
|
1497
|
+
this.observeRecovery(pane, owner, "continue-notify");
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
if (name === "layout-change") {
|
|
1504
|
+
const change = parseLayoutChange(rest);
|
|
1505
|
+
if (!change)
|
|
1506
|
+
return;
|
|
1507
|
+
const parsed = parseLayout(change.visible);
|
|
1508
|
+
if (!parsed) {
|
|
1509
|
+
this.scheduleSync(); // never guess from a failed parse
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
this.layoutByWindow.set(change.windowId, { ...parsed, zoomed: change.zoomed });
|
|
1513
|
+
// Resync on BOTH structural deltas: an unknown leaf (new pane) and a
|
|
1514
|
+
// known pane of this window missing from the leaves (a killed pane in a
|
|
1515
|
+
// surviving window emits only %layout-change — without this, its
|
|
1516
|
+
// subscribers never receive `closed`). Closure itself still comes only
|
|
1517
|
+
// from the truth reply; a probe failure never reads as absence.
|
|
1518
|
+
const leafIds = new Set(parsed.leaves.map((leaf) => leaf.id));
|
|
1519
|
+
const knownPaneVanished = [...this.panesByRuntime.values()].some((pane) => pane.windowRuntimeId === change.windowId && !leafIds.has(pane.runtimeId));
|
|
1520
|
+
if (parsed.leaves.some((leaf) => !this.panesByRuntime.has(leaf.id)) || knownPaneVanished) {
|
|
1521
|
+
this.scheduleSync();
|
|
1522
|
+
}
|
|
1523
|
+
this.emitLayout(change.windowId);
|
|
1524
|
+
this.emitLayoutAuthority();
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
if (name === "window-pane-changed") {
|
|
1528
|
+
const change = parseWindowPaneChanged(rest);
|
|
1529
|
+
if (!change)
|
|
1530
|
+
return;
|
|
1531
|
+
this.activePaneByWindow.set(change.windowId, change.paneId);
|
|
1532
|
+
for (const pane of this.panesByRuntime.values()) {
|
|
1533
|
+
if (pane.windowRuntimeId === change.windowId)
|
|
1534
|
+
pane.active = pane.runtimeId === change.paneId;
|
|
1535
|
+
}
|
|
1536
|
+
this.emitLayout(change.windowId);
|
|
1537
|
+
this.emitLayoutAuthority();
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
if (name === "session-window-changed") {
|
|
1541
|
+
const change = parseSessionWindowChanged(rest);
|
|
1542
|
+
if (!change)
|
|
1543
|
+
return;
|
|
1544
|
+
const previous = this.currentWindow;
|
|
1545
|
+
this.currentWindow = change.windowId;
|
|
1546
|
+
if (previous === change.windowId)
|
|
1547
|
+
return;
|
|
1548
|
+
/*
|
|
1549
|
+
* Re-emit BOTH windows.
|
|
1550
|
+
*
|
|
1551
|
+
* `currentWindow` is carried on the layout frame, and this notification is
|
|
1552
|
+
* the only thing that changes it. Without a re-emit the flag stays as it
|
|
1553
|
+
* was until something else about a layout happens to move — so a view
|
|
1554
|
+
* whose window tabs come from these frames (m50) would keep marking the
|
|
1555
|
+
* window the user just left as the one they are in, indefinitely.
|
|
1556
|
+
*/
|
|
1557
|
+
if (previous)
|
|
1558
|
+
this.emitLayout(previous);
|
|
1559
|
+
this.emitLayout(change.windowId);
|
|
1560
|
+
this.emitLayoutAuthority();
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
if (STRUCTURAL_NOTIFICATIONS.has(name))
|
|
1564
|
+
this.scheduleSync();
|
|
1565
|
+
}
|
|
1566
|
+
probeNativeClientActivity() {
|
|
1567
|
+
if (this.nativeClientProbePending || this.disposed)
|
|
1568
|
+
return;
|
|
1569
|
+
this.nativeClientProbePending = true;
|
|
1570
|
+
void this.io
|
|
1571
|
+
.request(`list-clients -t "${this.opts.session}" -F "#{client_control_mode}\t#{client_activity}"`)
|
|
1572
|
+
.then((lines) => {
|
|
1573
|
+
// The daemon's own mirror is a control-mode client. Only a tmux-owned
|
|
1574
|
+
// attached client (control mode = 0) is honest evidence for yielding
|
|
1575
|
+
// geometry; notification names alone can include our own lifecycle.
|
|
1576
|
+
if (lines.some((line) => /^0\t\d+$/u.test(line.trim()))) {
|
|
1577
|
+
this.opts.onNativeClientActivity?.();
|
|
1578
|
+
}
|
|
1579
|
+
})
|
|
1580
|
+
.catch(() => undefined)
|
|
1581
|
+
.finally(() => {
|
|
1582
|
+
this.nativeClientProbePending = false;
|
|
1583
|
+
});
|
|
1584
|
+
}
|
|
1585
|
+
emitLayout(windowRuntimeId) {
|
|
1586
|
+
const event = this.layoutEventFor(windowRuntimeId);
|
|
1587
|
+
if (!event)
|
|
1588
|
+
return;
|
|
1589
|
+
for (const subscriber of this.layoutSubscribers)
|
|
1590
|
+
subscriber(event);
|
|
1591
|
+
for (const pane of this.panesByRuntime.values()) {
|
|
1592
|
+
if (pane.windowRuntimeId !== windowRuntimeId)
|
|
1593
|
+
continue;
|
|
1594
|
+
for (const sub of pane.subs) {
|
|
1595
|
+
if (!sub.closed && sub.onLayout)
|
|
1596
|
+
sub.onLayout(event);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
emitLayoutAuthority() {
|
|
1601
|
+
const runtimeSessionId = this.attachedIdentity?.runtimeSessionId;
|
|
1602
|
+
if (!runtimeSessionId || this.layoutAuthoritySubscribers.size === 0)
|
|
1603
|
+
return;
|
|
1604
|
+
this.layoutTopologyEpoch += 1;
|
|
1605
|
+
for (const subscriber of this.layoutAuthoritySubscribers)
|
|
1606
|
+
this.emitLayoutAuthorityTo(subscriber, runtimeSessionId);
|
|
1607
|
+
}
|
|
1608
|
+
emitLayoutAuthorityTo(subscriber, runtimeSessionId) {
|
|
1609
|
+
const layouts = [...this.layoutByWindow.keys()]
|
|
1610
|
+
.map((runtimeId) => this.layoutEventFor(runtimeId))
|
|
1611
|
+
.filter((event) => event !== null);
|
|
1612
|
+
subscriber({
|
|
1613
|
+
session: this.opts.session,
|
|
1614
|
+
runtimeSessionId,
|
|
1615
|
+
topologyEpoch: this.layoutTopologyEpoch,
|
|
1616
|
+
layouts,
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Hand ONE new subscriber the geometry of its owning window.
|
|
1621
|
+
*
|
|
1622
|
+
* Without it a subscriber's first layout frame arrives only when a layout
|
|
1623
|
+
* happens to change, so a view built from these frames opens empty and stays
|
|
1624
|
+
* empty until the user moves something — which reads as the app failing to
|
|
1625
|
+
* find the session's windows at all.
|
|
1626
|
+
*/
|
|
1627
|
+
emitLayoutSnapshot(sub) {
|
|
1628
|
+
if (!sub.onLayout)
|
|
1629
|
+
return;
|
|
1630
|
+
const windowRuntimeId = sub.pane.windowRuntimeId;
|
|
1631
|
+
if (windowRuntimeId === null)
|
|
1632
|
+
return;
|
|
1633
|
+
const event = this.layoutEventFor(windowRuntimeId);
|
|
1634
|
+
if (!sub.closed && event)
|
|
1635
|
+
sub.onLayout(event);
|
|
1636
|
+
}
|
|
1637
|
+
layoutEventFor(windowRuntimeId) {
|
|
1638
|
+
const layout = this.layoutByWindow.get(windowRuntimeId);
|
|
1639
|
+
if (!layout)
|
|
1640
|
+
return null;
|
|
1641
|
+
const windowRecord = this.windowsByRuntime.get(windowRuntimeId) ?? null;
|
|
1642
|
+
const activePane = this.activePaneByWindow.get(windowRuntimeId) ?? "";
|
|
1643
|
+
const event = {
|
|
1644
|
+
type: "layout",
|
|
1645
|
+
session: this.opts.session,
|
|
1646
|
+
semanticWindowId: windowRecord?.semanticId ?? null,
|
|
1647
|
+
windowName: windowRecord?.name ?? null,
|
|
1648
|
+
currentWindow: windowRuntimeId === this.currentWindow,
|
|
1649
|
+
cols: layout.width,
|
|
1650
|
+
rows: layout.height,
|
|
1651
|
+
zoomed: layout.zoomed,
|
|
1652
|
+
paneBorderStatus: windowRecord?.paneBorderStatus ?? "off",
|
|
1653
|
+
panes: layout.leaves.map((leaf) => {
|
|
1654
|
+
const pane = this.panesByRuntime.get(leaf.id) ?? null;
|
|
1655
|
+
const display = pane
|
|
1656
|
+
? resolvePaneDisplayName({
|
|
1657
|
+
semanticPaneId: pane.semanticId,
|
|
1658
|
+
configuredName: pane.descriptor?.name,
|
|
1659
|
+
configuredNameSource: pane.descriptor?.nameSource,
|
|
1660
|
+
currentCommand: pane.descriptor?.currentCommand,
|
|
1661
|
+
title: pane.descriptor?.title,
|
|
1662
|
+
paneType: pane.descriptor?.type,
|
|
1663
|
+
})
|
|
1664
|
+
: null;
|
|
1665
|
+
return {
|
|
1666
|
+
semanticPaneId: pane?.semanticId ?? null,
|
|
1667
|
+
displayName: display?.name ?? null,
|
|
1668
|
+
displayNameSource: display?.source ?? null,
|
|
1669
|
+
left: leaf.left,
|
|
1670
|
+
top: leaf.top,
|
|
1671
|
+
width: leaf.width,
|
|
1672
|
+
height: leaf.height,
|
|
1673
|
+
active: leaf.id === activePane,
|
|
1674
|
+
};
|
|
1675
|
+
}),
|
|
1676
|
+
};
|
|
1677
|
+
return event;
|
|
1678
|
+
}
|
|
1679
|
+
// ── Truth sync + identity join ───────────────────────────────────────────
|
|
1680
|
+
scheduleSync() {
|
|
1681
|
+
if (this.cancelSync || this.disposed)
|
|
1682
|
+
return;
|
|
1683
|
+
const schedule = this.opts.scheduleSync ??
|
|
1684
|
+
((callback, delayMs) => {
|
|
1685
|
+
const timer = setTimeout(callback, delayMs);
|
|
1686
|
+
return () => clearTimeout(timer);
|
|
1687
|
+
});
|
|
1688
|
+
this.cancelSync = schedule(() => {
|
|
1689
|
+
this.cancelSync = null;
|
|
1690
|
+
void this.syncNow().catch(() => { });
|
|
1691
|
+
}, SYNC_DEBOUNCE_MS);
|
|
1692
|
+
}
|
|
1693
|
+
async syncNow() {
|
|
1694
|
+
if (this.disposed)
|
|
1695
|
+
return;
|
|
1696
|
+
const lines = await this.io.request(`list-panes -s -t "${this.opts.session}" -F "#{pane_id}\t#{pane_active}\t#{window_id}\t#{?window_active,1,0}"`);
|
|
1697
|
+
const truth = [];
|
|
1698
|
+
for (const line of lines) {
|
|
1699
|
+
const [runtime = "", active = "", windowId = "", windowActive = ""] = line.split("\t");
|
|
1700
|
+
if (!/^%[0-9]+$/u.test(runtime))
|
|
1701
|
+
continue;
|
|
1702
|
+
truth.push({
|
|
1703
|
+
runtimePaneId: runtime,
|
|
1704
|
+
active: active === "1",
|
|
1705
|
+
runtimeWindowId: windowId,
|
|
1706
|
+
windowActive: windowActive === "1",
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
const { listed, movedWindowRuntimeIds } = this.applyPaneTruth(truth);
|
|
1710
|
+
await this.syncWindows(this.opts.session, movedWindowRuntimeIds);
|
|
1711
|
+
this.discovery.discover(listed);
|
|
1712
|
+
}
|
|
1713
|
+
applyPaneTruth(truth) {
|
|
1714
|
+
const listed = new Set();
|
|
1715
|
+
const movedWindowRuntimeIds = new Set();
|
|
1716
|
+
this.truthActive.clear();
|
|
1717
|
+
this.truthWindow.clear();
|
|
1718
|
+
this.activePaneByWindow.clear();
|
|
1719
|
+
for (const row of truth) {
|
|
1720
|
+
listed.add(row.runtimePaneId);
|
|
1721
|
+
this.truthActive.set(row.runtimePaneId, row.active);
|
|
1722
|
+
this.truthWindow.set(row.runtimePaneId, row.runtimeWindowId);
|
|
1723
|
+
if (row.active)
|
|
1724
|
+
this.activePaneByWindow.set(row.runtimeWindowId, row.runtimePaneId);
|
|
1725
|
+
if (row.windowActive)
|
|
1726
|
+
this.currentWindow = row.runtimeWindowId;
|
|
1727
|
+
}
|
|
1728
|
+
// Closure is decided ONLY by a successful truth reply that omits the pane
|
|
1729
|
+
// (probe failure never reads as absence — a thrown request skips all this).
|
|
1730
|
+
for (const [runtime, pane] of [...this.panesByRuntime]) {
|
|
1731
|
+
if (listed.has(runtime)) {
|
|
1732
|
+
pane.active = this.truthActive.get(runtime) ?? pane.active;
|
|
1733
|
+
const nextWindowRuntimeId = this.truthWindow.get(runtime) ?? pane.windowRuntimeId;
|
|
1734
|
+
if (nextWindowRuntimeId !== pane.windowRuntimeId && nextWindowRuntimeId !== null)
|
|
1735
|
+
movedWindowRuntimeIds.add(nextWindowRuntimeId);
|
|
1736
|
+
pane.windowRuntimeId = nextWindowRuntimeId;
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1739
|
+
this.cancelRecovery(runtime);
|
|
1740
|
+
this.continueNotificationQueues.delete(runtime);
|
|
1741
|
+
this.panesByRuntime.delete(runtime);
|
|
1742
|
+
this.outputOrdinals.delete(runtime);
|
|
1743
|
+
this.panesBySemantic.delete(pane.semanticId);
|
|
1744
|
+
this.ledger.forget(runtime);
|
|
1745
|
+
this.ageByRuntime.delete(runtime);
|
|
1746
|
+
for (const sub of pane.subs) {
|
|
1747
|
+
if (!sub.closed) {
|
|
1748
|
+
sub.closed = true;
|
|
1749
|
+
sub.onEvent({ type: "closed" });
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
pane.subs.clear();
|
|
1753
|
+
}
|
|
1754
|
+
return { listed, movedWindowRuntimeIds };
|
|
1755
|
+
}
|
|
1756
|
+
async refreshTrustedInventory(expectedRuntimeSessionId, attempt = 0) {
|
|
1757
|
+
const authorityOrdinal = this.windowAuthorityOrdinal;
|
|
1758
|
+
const beforeLines = await this.io.request(`list-panes -s -t "${expectedRuntimeSessionId}" -F "${SESSION_PANE_DESCRIPTOR_FORMAT}"`);
|
|
1759
|
+
if (this.disposed)
|
|
1760
|
+
throw new Error(`mirror session ${this.opts.session} is disposed`);
|
|
1761
|
+
const parsed = parseSessionPaneDescriptorReply(beforeLines);
|
|
1762
|
+
if (parsed.malformedUtf8Records !== 0 ||
|
|
1763
|
+
parsed.descriptors.length === 0 ||
|
|
1764
|
+
parsed.descriptors.length !== beforeLines.length) {
|
|
1765
|
+
throw new Error(`trusted inventory for ${this.opts.session} is malformed`);
|
|
1766
|
+
}
|
|
1767
|
+
const descriptors = parsed.descriptors;
|
|
1768
|
+
const runtimePaneIds = new Set(descriptors.map((pane) => pane.runtimePaneId));
|
|
1769
|
+
const runtimeSessionIds = new Set(descriptors.map((pane) => pane.runtimeSessionId));
|
|
1770
|
+
const activeWindowIds = new Set(descriptors.filter((pane) => pane.windowActive).map((pane) => pane.windowId));
|
|
1771
|
+
const globallyActivePanes = descriptors.filter((pane) => pane.paneActive && pane.windowActive);
|
|
1772
|
+
if (runtimePaneIds.size !== descriptors.length ||
|
|
1773
|
+
runtimeSessionIds.size !== 1 ||
|
|
1774
|
+
runtimeSessionIds.values().next().value !== expectedRuntimeSessionId ||
|
|
1775
|
+
descriptors.some((pane) => pane.sessionName !== this.opts.session) ||
|
|
1776
|
+
descriptors.some((pane) => pane.windowId === null) ||
|
|
1777
|
+
activeWindowIds.size !== 1 ||
|
|
1778
|
+
globallyActivePanes.length !== 1) {
|
|
1779
|
+
throw new Error(`trusted inventory for ${this.opts.session} is inconsistent`);
|
|
1780
|
+
}
|
|
1781
|
+
const computedWindowCounts = new Map();
|
|
1782
|
+
for (const descriptor of descriptors) {
|
|
1783
|
+
const runtimeWindowId = descriptor.windowId;
|
|
1784
|
+
computedWindowCounts.set(runtimeWindowId, (computedWindowCounts.get(runtimeWindowId) ?? 0) + 1);
|
|
1785
|
+
}
|
|
1786
|
+
if (descriptors.some((pane) => pane.windowPaneCount !== computedWindowCounts.get(pane.windowId) ||
|
|
1787
|
+
pane.sessionWindowCount !== computedWindowCounts.size)) {
|
|
1788
|
+
throw new Error(`trusted inventory for ${this.opts.session} has incomplete counts`);
|
|
1789
|
+
}
|
|
1790
|
+
const windowStage = await this.stageWindows(expectedRuntimeSessionId);
|
|
1791
|
+
const repairedPanes = await this.repairTrustedPaneIdentity(descriptors, windowStage.layouts);
|
|
1792
|
+
const afterLines = await this.io.request(`list-panes -s -t "${expectedRuntimeSessionId}" -F "${SESSION_PANE_DESCRIPTOR_FORMAT}"`);
|
|
1793
|
+
const confirmedWindowStage = await this.stageWindows(expectedRuntimeSessionId);
|
|
1794
|
+
const coherent = beforeLines.length === afterLines.length &&
|
|
1795
|
+
beforeLines.every((line, index) => line === afterLines[index]);
|
|
1796
|
+
if (windowStage.repairedIdentity ||
|
|
1797
|
+
confirmedWindowStage.repairedIdentity ||
|
|
1798
|
+
repairedPanes ||
|
|
1799
|
+
!coherent ||
|
|
1800
|
+
!this.windowStagesEqual(windowStage, confirmedWindowStage) ||
|
|
1801
|
+
authorityOrdinal !== this.windowAuthorityOrdinal) {
|
|
1802
|
+
if (attempt >= 1)
|
|
1803
|
+
throw new Error(`trusted inventory for ${this.opts.session} did not settle`);
|
|
1804
|
+
return await this.refreshTrustedInventory(expectedRuntimeSessionId, attempt + 1);
|
|
1805
|
+
}
|
|
1806
|
+
if (this.disposed)
|
|
1807
|
+
throw new Error(`mirror session ${this.opts.session} is disposed`);
|
|
1808
|
+
const activeWindowId = activeWindowIds.values().next().value;
|
|
1809
|
+
const descriptorWindowByPane = new Map(descriptors.map((descriptor) => [descriptor.runtimePaneId, descriptor.windowId]));
|
|
1810
|
+
const stagedPaneIds = new Set();
|
|
1811
|
+
let stagedPaneCount = 0;
|
|
1812
|
+
let stagedPaneMembershipExact = true;
|
|
1813
|
+
for (const [runtimeWindowId, layout] of confirmedWindowStage.layouts) {
|
|
1814
|
+
if (layout.leaves.length !== computedWindowCounts.get(runtimeWindowId)) {
|
|
1815
|
+
stagedPaneMembershipExact = false;
|
|
1816
|
+
break;
|
|
1817
|
+
}
|
|
1818
|
+
for (const leaf of layout.leaves) {
|
|
1819
|
+
stagedPaneCount += 1;
|
|
1820
|
+
if (stagedPaneIds.has(leaf.id) || descriptorWindowByPane.get(leaf.id) !== runtimeWindowId) {
|
|
1821
|
+
stagedPaneMembershipExact = false;
|
|
1822
|
+
break;
|
|
1823
|
+
}
|
|
1824
|
+
stagedPaneIds.add(leaf.id);
|
|
1825
|
+
}
|
|
1826
|
+
if (!stagedPaneMembershipExact)
|
|
1827
|
+
break;
|
|
1828
|
+
}
|
|
1829
|
+
if (confirmedWindowStage.currentWindow !== activeWindowId ||
|
|
1830
|
+
confirmedWindowStage.windows.size !== computedWindowCounts.size ||
|
|
1831
|
+
!stagedPaneMembershipExact ||
|
|
1832
|
+
stagedPaneCount !== descriptors.length ||
|
|
1833
|
+
stagedPaneIds.size !== descriptors.length ||
|
|
1834
|
+
[...computedWindowCounts.keys()].some((runtimeWindowId) => !confirmedWindowStage.windows.has(runtimeWindowId)) ||
|
|
1835
|
+
descriptors.some((descriptor) => {
|
|
1836
|
+
const pane = this.panesByRuntime.get(descriptor.runtimePaneId);
|
|
1837
|
+
const window = confirmedWindowStage.windows.get(descriptor.windowId);
|
|
1838
|
+
return (!pane ||
|
|
1839
|
+
!window?.semanticId ||
|
|
1840
|
+
descriptor.semanticPaneId !== pane.semanticId ||
|
|
1841
|
+
descriptor.semanticWindowId !== window.semanticId ||
|
|
1842
|
+
!WorkspaceIdSchemaZ.safeParse(pane.semanticId).success ||
|
|
1843
|
+
!WorkspaceIdSchemaZ.safeParse(window.semanticId).success);
|
|
1844
|
+
})) {
|
|
1845
|
+
throw new Error(`trusted inventory for ${this.opts.session} lacks verified identity`);
|
|
1846
|
+
}
|
|
1847
|
+
const previousCurrentWindow = this.currentWindow;
|
|
1848
|
+
const { movedWindowRuntimeIds } = this.applyPaneTruth(descriptors.map((pane) => ({
|
|
1849
|
+
runtimePaneId: pane.runtimePaneId,
|
|
1850
|
+
active: pane.paneActive,
|
|
1851
|
+
runtimeWindowId: pane.windowId,
|
|
1852
|
+
windowActive: pane.windowActive,
|
|
1853
|
+
})));
|
|
1854
|
+
for (const descriptor of descriptors) {
|
|
1855
|
+
const pane = this.panesByRuntime.get(descriptor.runtimePaneId);
|
|
1856
|
+
pane.descriptor = descriptor;
|
|
1857
|
+
pane.active = descriptor.paneActive;
|
|
1858
|
+
}
|
|
1859
|
+
this.commitWindowStage(confirmedWindowStage, movedWindowRuntimeIds, previousCurrentWindow);
|
|
1860
|
+
if (this.degraded ||
|
|
1861
|
+
this.panesByRuntime.size !== descriptors.length ||
|
|
1862
|
+
this.windowsByRuntime.size !== computedWindowCounts.size ||
|
|
1863
|
+
[...computedWindowCounts.keys()].some((runtimeWindowId) => !this.windowsByRuntime.has(runtimeWindowId))) {
|
|
1864
|
+
throw new Error(`trusted inventory for ${this.opts.session} is degraded`);
|
|
1865
|
+
}
|
|
1866
|
+
const windowCounts = computedWindowCounts;
|
|
1867
|
+
const sessionWindowCount = computedWindowCounts.size;
|
|
1868
|
+
const panes = descriptors.map((descriptor) => {
|
|
1869
|
+
const record = this.panesByRuntime.get(descriptor.runtimePaneId);
|
|
1870
|
+
const runtimeWindowId = descriptor.windowId;
|
|
1871
|
+
const window = this.windowsByRuntime.get(runtimeWindowId);
|
|
1872
|
+
if (!record ||
|
|
1873
|
+
record.windowRuntimeId !== descriptor.windowId ||
|
|
1874
|
+
!window?.semanticId ||
|
|
1875
|
+
descriptor.semanticPaneId !== record.semanticId ||
|
|
1876
|
+
descriptor.semanticWindowId !== window.semanticId ||
|
|
1877
|
+
!WorkspaceIdSchemaZ.safeParse(record.semanticId).success ||
|
|
1878
|
+
!WorkspaceIdSchemaZ.safeParse(window.semanticId).success) {
|
|
1879
|
+
throw new Error(`trusted inventory for ${this.opts.session} lacks verified identity`);
|
|
1880
|
+
}
|
|
1881
|
+
return Object.freeze({
|
|
1882
|
+
runtimeSessionId: descriptor.runtimeSessionId,
|
|
1883
|
+
runtimeWindowId,
|
|
1884
|
+
runtimePaneId: descriptor.runtimePaneId,
|
|
1885
|
+
semanticWindowId: window.semanticId,
|
|
1886
|
+
semanticPaneId: record.semanticId,
|
|
1887
|
+
windowPaneCount: windowCounts.get(runtimeWindowId),
|
|
1888
|
+
sessionWindowCount,
|
|
1889
|
+
paneIndex: descriptor.paneIndex,
|
|
1890
|
+
title: descriptor.title ?? "",
|
|
1891
|
+
currentCommand: descriptor.currentCommand ?? "",
|
|
1892
|
+
active: descriptor.paneActive && descriptor.windowActive,
|
|
1893
|
+
role: descriptor.role,
|
|
1894
|
+
name: descriptor.name,
|
|
1895
|
+
type: descriptor.type,
|
|
1896
|
+
missionStamp: descriptor.missionStamp,
|
|
1897
|
+
dir: descriptor.cwd ?? "",
|
|
1898
|
+
});
|
|
1899
|
+
});
|
|
1900
|
+
return Object.freeze({
|
|
1901
|
+
sessionName: this.opts.session,
|
|
1902
|
+
runtimeSessionId: descriptors[0].runtimeSessionId,
|
|
1903
|
+
panes: Object.freeze(panes),
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
async syncWindows(target = this.opts.session, requiredLayoutEmits = new Set()) {
|
|
1907
|
+
const stage = await this.stageWindows(target);
|
|
1908
|
+
this.commitWindowStage(stage, requiredLayoutEmits);
|
|
1909
|
+
return stage.repairedIdentity;
|
|
1910
|
+
}
|
|
1911
|
+
commitWindowStage(stage, requiredLayoutEmits = new Set(), previousCurrentWindow = this.currentWindow) {
|
|
1912
|
+
const changedWindows = new Set();
|
|
1913
|
+
for (const [runtimeId, record] of stage.windows) {
|
|
1914
|
+
const previous = this.windowsByRuntime.get(runtimeId);
|
|
1915
|
+
const previousLayout = this.layoutByWindow.get(runtimeId);
|
|
1916
|
+
const nextLayout = stage.layouts.get(runtimeId);
|
|
1917
|
+
if (!previous ||
|
|
1918
|
+
previous.name !== record.name ||
|
|
1919
|
+
previous.semanticId !== record.semanticId ||
|
|
1920
|
+
previous.paneBorderStatus !== record.paneBorderStatus ||
|
|
1921
|
+
!previousLayout ||
|
|
1922
|
+
previousLayout.zoomed !== nextLayout.zoomed ||
|
|
1923
|
+
previousLayout.width !== nextLayout.width ||
|
|
1924
|
+
previousLayout.height !== nextLayout.height ||
|
|
1925
|
+
previousLayout.leaves.length !== nextLayout.leaves.length ||
|
|
1926
|
+
previousLayout.leaves.some((leaf, index) => {
|
|
1927
|
+
const candidate = nextLayout.leaves[index];
|
|
1928
|
+
return (!candidate ||
|
|
1929
|
+
leaf.id !== candidate.id ||
|
|
1930
|
+
leaf.left !== candidate.left ||
|
|
1931
|
+
leaf.top !== candidate.top ||
|
|
1932
|
+
leaf.width !== candidate.width ||
|
|
1933
|
+
leaf.height !== candidate.height);
|
|
1934
|
+
})) {
|
|
1935
|
+
changedWindows.add(runtimeId);
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
const windowSetChanged = stage.windows.size !== this.windowsByRuntime.size;
|
|
1939
|
+
if (previousCurrentWindow !== stage.currentWindow) {
|
|
1940
|
+
if (stage.windows.has(previousCurrentWindow))
|
|
1941
|
+
changedWindows.add(previousCurrentWindow);
|
|
1942
|
+
if (stage.windows.has(stage.currentWindow))
|
|
1943
|
+
changedWindows.add(stage.currentWindow);
|
|
1944
|
+
}
|
|
1945
|
+
this.currentWindow = stage.currentWindow;
|
|
1946
|
+
this.windowsByRuntime.clear();
|
|
1947
|
+
for (const [key, value] of stage.windows)
|
|
1948
|
+
this.windowsByRuntime.set(key, value);
|
|
1949
|
+
this.layoutByWindow.clear();
|
|
1950
|
+
for (const [key, value] of stage.layouts)
|
|
1951
|
+
this.layoutByWindow.set(key, value);
|
|
1952
|
+
const layoutEmits = windowSetChanged
|
|
1953
|
+
? new Set(stage.windows.keys())
|
|
1954
|
+
: new Set([...changedWindows, ...requiredLayoutEmits].filter((runtimeId) => stage.windows.has(runtimeId)));
|
|
1955
|
+
for (const runtimeId of layoutEmits)
|
|
1956
|
+
this.emitLayout(runtimeId);
|
|
1957
|
+
this.emitLayoutAuthority();
|
|
1958
|
+
}
|
|
1959
|
+
windowStagesEqual(left, right) {
|
|
1960
|
+
if (left.currentWindow !== right.currentWindow ||
|
|
1961
|
+
left.windows.size !== right.windows.size ||
|
|
1962
|
+
left.layouts.size !== right.layouts.size) {
|
|
1963
|
+
return false;
|
|
1964
|
+
}
|
|
1965
|
+
for (const [runtimeId, leftWindow] of left.windows) {
|
|
1966
|
+
const rightWindow = right.windows.get(runtimeId);
|
|
1967
|
+
const leftLayout = left.layouts.get(runtimeId);
|
|
1968
|
+
const rightLayout = right.layouts.get(runtimeId);
|
|
1969
|
+
if (!rightWindow ||
|
|
1970
|
+
!leftLayout ||
|
|
1971
|
+
!rightLayout ||
|
|
1972
|
+
leftWindow.semanticId !== rightWindow.semanticId ||
|
|
1973
|
+
leftWindow.name !== rightWindow.name ||
|
|
1974
|
+
leftWindow.paneBorderStatus !== rightWindow.paneBorderStatus ||
|
|
1975
|
+
leftLayout.zoomed !== rightLayout.zoomed ||
|
|
1976
|
+
leftLayout.width !== rightLayout.width ||
|
|
1977
|
+
leftLayout.height !== rightLayout.height ||
|
|
1978
|
+
leftLayout.leaves.length !== rightLayout.leaves.length ||
|
|
1979
|
+
leftLayout.leaves.some((leaf, index) => {
|
|
1980
|
+
const candidate = rightLayout.leaves[index];
|
|
1981
|
+
return (!candidate ||
|
|
1982
|
+
leaf.id !== candidate.id ||
|
|
1983
|
+
leaf.left !== candidate.left ||
|
|
1984
|
+
leaf.top !== candidate.top ||
|
|
1985
|
+
leaf.width !== candidate.width ||
|
|
1986
|
+
leaf.height !== candidate.height);
|
|
1987
|
+
})) {
|
|
1988
|
+
return false;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
return true;
|
|
1992
|
+
}
|
|
1993
|
+
async stageWindows(target = this.opts.session) {
|
|
1994
|
+
const lines = await this.io.request(`list-windows -t "${target}" -F "#{window_id}\t#{qa:@tmux_ide_window_id}\t#{qa:window_name}\t#{window_active}\t#{window_visible_layout}\t#{?window_zoomed_flag,1,0}\t#{pane-border-status}"`);
|
|
1995
|
+
const rows = [];
|
|
1996
|
+
const seenRuntimeIds = new Set();
|
|
1997
|
+
for (const raw of lines) {
|
|
1998
|
+
// Replies are latin1 byte strings; recover UTF-8 window names first.
|
|
1999
|
+
const line = Buffer.from(raw, "latin1").toString("utf8");
|
|
2000
|
+
const parts = line.split("\t");
|
|
2001
|
+
if (parts.length !== 7) {
|
|
2002
|
+
throw new Error(`window layout truth for ${this.opts.session} is malformed`);
|
|
2003
|
+
}
|
|
2004
|
+
const [runtimeId = "", stampRaw = "", nameRaw = "", active = "", visible = "", zoomed = "", borderStatus = "off",] = parts;
|
|
2005
|
+
if (!/^@[0-9]+$/u.test(runtimeId) ||
|
|
2006
|
+
seenRuntimeIds.has(runtimeId) ||
|
|
2007
|
+
(active !== "0" && active !== "1") ||
|
|
2008
|
+
(zoomed !== "0" && zoomed !== "1") ||
|
|
2009
|
+
(borderStatus !== "top" && borderStatus !== "bottom" && borderStatus !== "off")) {
|
|
2010
|
+
throw new Error(`window layout truth for ${this.opts.session} is malformed`);
|
|
2011
|
+
}
|
|
2012
|
+
seenRuntimeIds.add(runtimeId);
|
|
2013
|
+
const stamp = decodeTmuxArgument(stampRaw);
|
|
2014
|
+
const name = decodeTmuxArgument(nameRaw);
|
|
2015
|
+
rows.push({
|
|
2016
|
+
runtimeId,
|
|
2017
|
+
stamp: stamp.length > 0 ? stamp : null,
|
|
2018
|
+
name: name.length > 0 ? name : null,
|
|
2019
|
+
active: active === "1",
|
|
2020
|
+
visible,
|
|
2021
|
+
zoomed: zoomed === "1",
|
|
2022
|
+
paneBorderStatus: borderStatus,
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
if (rows.length === 0) {
|
|
2026
|
+
throw new Error(`window layout truth for ${this.opts.session} is missing`);
|
|
2027
|
+
}
|
|
2028
|
+
const activeRows = rows.filter(({ active }) => active);
|
|
2029
|
+
if (activeRows.length !== 1) {
|
|
2030
|
+
throw new Error(`window layout truth for ${this.opts.session} has inconsistent active window`);
|
|
2031
|
+
}
|
|
2032
|
+
const nextLayoutByWindow = new Map();
|
|
2033
|
+
for (const row of rows) {
|
|
2034
|
+
const parsed = parseLayout(row.visible);
|
|
2035
|
+
if (!parsed) {
|
|
2036
|
+
throw new Error(`window layout truth for ${this.opts.session} is malformed`);
|
|
2037
|
+
}
|
|
2038
|
+
nextLayoutByWindow.set(row.runtimeId, { ...parsed, zoomed: row.zoomed });
|
|
2039
|
+
}
|
|
2040
|
+
// Valid unique stamps are identity; missing/invalid/duplicated stamps are
|
|
2041
|
+
// ALL regenerated and stamped back (the pane policy, applied to windows).
|
|
2042
|
+
const stampCounts = new Map();
|
|
2043
|
+
for (const row of rows) {
|
|
2044
|
+
if (row.stamp && WorkspaceIdSchemaZ.safeParse(row.stamp).success) {
|
|
2045
|
+
stampCounts.set(row.stamp, (stampCounts.get(row.stamp) ?? 0) + 1);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
const claimed = new Set(stampCounts.keys());
|
|
2049
|
+
const generateWindowId = this.opts.generateWindowId ?? defaultMirrorWindowId;
|
|
2050
|
+
let repairedIdentity = false;
|
|
2051
|
+
const next = new Map();
|
|
2052
|
+
let nextCurrentWindow = "";
|
|
2053
|
+
for (const row of rows) {
|
|
2054
|
+
if (row.active)
|
|
2055
|
+
nextCurrentWindow = row.runtimeId;
|
|
2056
|
+
let semanticId = null;
|
|
2057
|
+
if (row.stamp && stampCounts.get(row.stamp) === 1) {
|
|
2058
|
+
semanticId = row.stamp;
|
|
2059
|
+
}
|
|
2060
|
+
else {
|
|
2061
|
+
repairedIdentity = true;
|
|
2062
|
+
let candidate = null;
|
|
2063
|
+
for (let attempt = 0; attempt < 32 && !candidate; attempt += 1) {
|
|
2064
|
+
const generated = generateWindowId();
|
|
2065
|
+
if (WorkspaceIdSchemaZ.safeParse(generated).success && !claimed.has(generated)) {
|
|
2066
|
+
candidate = generated;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
if (candidate) {
|
|
2070
|
+
claimed.add(candidate);
|
|
2071
|
+
const ok = await this.io
|
|
2072
|
+
.request(`set-option -w -t ${row.runtimeId} ${WORKSPACE_SEMANTIC_WINDOW_OPTION} "${candidate}"`)
|
|
2073
|
+
.then(() => true, () => false);
|
|
2074
|
+
if (ok)
|
|
2075
|
+
semanticId = candidate;
|
|
2076
|
+
else {
|
|
2077
|
+
this.pushDiagnostic({
|
|
2078
|
+
code: "WINDOW_STAMP_BACK_FAILED",
|
|
2079
|
+
message: `Could not stamp semantic window identity ${candidate}.`,
|
|
2080
|
+
degraded: true,
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
next.set(row.runtimeId, {
|
|
2086
|
+
runtimeId: row.runtimeId,
|
|
2087
|
+
semanticId,
|
|
2088
|
+
name: row.name,
|
|
2089
|
+
paneBorderStatus: row.paneBorderStatus,
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
return {
|
|
2093
|
+
windows: next,
|
|
2094
|
+
layouts: nextLayoutByWindow,
|
|
2095
|
+
currentWindow: nextCurrentWindow,
|
|
2096
|
+
repairedIdentity,
|
|
2097
|
+
};
|
|
2098
|
+
}
|
|
2099
|
+
async reconcileIdentity(descriptors, listed) {
|
|
2100
|
+
if (this.disposed)
|
|
2101
|
+
return false;
|
|
2102
|
+
const snapshots = descriptors
|
|
2103
|
+
.filter((descriptor) => listed.has(descriptor.runtimePaneId))
|
|
2104
|
+
.map((descriptor) => ({
|
|
2105
|
+
runtimePaneId: descriptor.runtimePaneId,
|
|
2106
|
+
semanticPaneId: descriptor.semanticPaneId,
|
|
2107
|
+
role: descriptor.role,
|
|
2108
|
+
type: descriptor.type,
|
|
2109
|
+
currentCommand: descriptor.currentCommand,
|
|
2110
|
+
cwd: descriptor.cwd,
|
|
2111
|
+
title: descriptor.title,
|
|
2112
|
+
rect: this.rectFor(descriptor.runtimePaneId),
|
|
2113
|
+
active: this.truthActive.get(descriptor.runtimePaneId) ?? false,
|
|
2114
|
+
}));
|
|
2115
|
+
const plan = planWorkspaceTmuxReconciliation({
|
|
2116
|
+
panes: snapshots,
|
|
2117
|
+
generateSemanticPaneId: this.opts.generatePaneId ?? defaultMirrorPaneId,
|
|
2118
|
+
});
|
|
2119
|
+
const outcomes = await Promise.all(plan.stampEffects.map((effect) => this.io
|
|
2120
|
+
.request(`set-option -p -t ${effect.runtimePaneId} ${WORKSPACE_SEMANTIC_PANE_OPTION} "${effect.value}"`)
|
|
2121
|
+
.then(() => ({ runtimePaneId: effect.runtimePaneId, ok: true }), (cause) => ({
|
|
2122
|
+
runtimePaneId: effect.runtimePaneId,
|
|
2123
|
+
ok: false,
|
|
2124
|
+
error: cause instanceof Error ? cause.message : String(cause),
|
|
2125
|
+
}))));
|
|
2126
|
+
if (this.disposed)
|
|
2127
|
+
return plan.stampEffects.length > 0;
|
|
2128
|
+
const reconciliation = finalizeWorkspaceTmuxReconciliation(plan, outcomes);
|
|
2129
|
+
const descriptorByRuntime = new Map(descriptors.map((d) => [d.runtimePaneId, d]));
|
|
2130
|
+
for (const verified of reconciliation.panes) {
|
|
2131
|
+
if (!listed.has(verified.runtimePaneId))
|
|
2132
|
+
continue;
|
|
2133
|
+
const descriptor = descriptorByRuntime.get(verified.runtimePaneId) ?? null;
|
|
2134
|
+
const windowRuntimeId = this.truthWindow.get(verified.runtimePaneId) ?? descriptor?.windowId ?? null;
|
|
2135
|
+
const existingBySemantic = this.panesBySemantic.get(verified.semanticPaneId);
|
|
2136
|
+
const existingByRuntime = this.panesByRuntime.get(verified.runtimePaneId);
|
|
2137
|
+
if (existingBySemantic && existingBySemantic.runtimeId !== verified.runtimePaneId) {
|
|
2138
|
+
// The semantic identity moved to a different runtime address (respawn/
|
|
2139
|
+
// restore). Follow it and reseed every live subscriber — the old
|
|
2140
|
+
// address's bytes are a different pane's now.
|
|
2141
|
+
const retiredRuntime = existingBySemantic.runtimeId;
|
|
2142
|
+
this.cancelRecovery(retiredRuntime);
|
|
2143
|
+
this.continueNotificationQueues.delete(retiredRuntime);
|
|
2144
|
+
this.panesByRuntime.delete(retiredRuntime);
|
|
2145
|
+
this.outputOrdinals.delete(retiredRuntime);
|
|
2146
|
+
this.ledger.forget(retiredRuntime);
|
|
2147
|
+
existingBySemantic.runtimeId = verified.runtimePaneId;
|
|
2148
|
+
existingBySemantic.incarnation = ++this.paneIncarnation;
|
|
2149
|
+
existingBySemantic.descriptor = descriptor;
|
|
2150
|
+
existingBySemantic.active = verified.active;
|
|
2151
|
+
existingBySemantic.windowRuntimeId = windowRuntimeId;
|
|
2152
|
+
this.panesByRuntime.set(verified.runtimePaneId, existingBySemantic);
|
|
2153
|
+
for (const sub of existingBySemantic.subs) {
|
|
2154
|
+
if (!sub.closed && !sub.frozen)
|
|
2155
|
+
this.reseedPlain(sub);
|
|
2156
|
+
}
|
|
2157
|
+
continue;
|
|
2158
|
+
}
|
|
2159
|
+
if (existingByRuntime && existingByRuntime.semanticId === verified.semanticPaneId) {
|
|
2160
|
+
existingByRuntime.descriptor = descriptor;
|
|
2161
|
+
existingByRuntime.active = verified.active;
|
|
2162
|
+
existingByRuntime.windowRuntimeId = windowRuntimeId;
|
|
2163
|
+
continue;
|
|
2164
|
+
}
|
|
2165
|
+
if (existingByRuntime) {
|
|
2166
|
+
// The runtime address was restamped to a new identity (duplicate
|
|
2167
|
+
// resolution). The old semantic id is gone.
|
|
2168
|
+
this.panesBySemantic.delete(existingByRuntime.semanticId);
|
|
2169
|
+
this.cancelRecovery(existingByRuntime.runtimeId);
|
|
2170
|
+
this.continueNotificationQueues.delete(existingByRuntime.runtimeId);
|
|
2171
|
+
this.ledger.forget(existingByRuntime.runtimeId);
|
|
2172
|
+
this.outputOrdinals.delete(existingByRuntime.runtimeId);
|
|
2173
|
+
for (const sub of existingByRuntime.subs) {
|
|
2174
|
+
if (sub.closed)
|
|
2175
|
+
continue;
|
|
2176
|
+
sub.closed = true;
|
|
2177
|
+
sub.feed.abortCurrent();
|
|
2178
|
+
sub.onEvent({ type: "closed" });
|
|
2179
|
+
}
|
|
2180
|
+
existingByRuntime.subs.clear();
|
|
2181
|
+
existingByRuntime.incarnation = ++this.paneIncarnation;
|
|
2182
|
+
existingByRuntime.semanticId = verified.semanticPaneId;
|
|
2183
|
+
existingByRuntime.descriptor = descriptor;
|
|
2184
|
+
existingByRuntime.active = verified.active;
|
|
2185
|
+
existingByRuntime.windowRuntimeId = windowRuntimeId;
|
|
2186
|
+
this.panesBySemantic.set(verified.semanticPaneId, existingByRuntime);
|
|
2187
|
+
continue;
|
|
2188
|
+
}
|
|
2189
|
+
const record = {
|
|
2190
|
+
runtimeId: verified.runtimePaneId,
|
|
2191
|
+
semanticId: verified.semanticPaneId,
|
|
2192
|
+
descriptor,
|
|
2193
|
+
active: verified.active,
|
|
2194
|
+
windowRuntimeId,
|
|
2195
|
+
subs: new Set(),
|
|
2196
|
+
incarnation: ++this.paneIncarnation,
|
|
2197
|
+
};
|
|
2198
|
+
this.panesByRuntime.set(record.runtimeId, record);
|
|
2199
|
+
this.panesBySemantic.set(record.semanticId, record);
|
|
2200
|
+
}
|
|
2201
|
+
// Diagnostics cross the semantic boundary too: rewrite runtime addresses
|
|
2202
|
+
// to the joined semantic id (or an honest placeholder for panes that never
|
|
2203
|
+
// verified) so `%N` never leaves the service.
|
|
2204
|
+
const semanticByRuntime = new Map(reconciliation.panes.map((pane) => [pane.runtimePaneId, pane.semanticPaneId]));
|
|
2205
|
+
this.diagnostics = reconciliation.diagnostics.map((diagnostic) => ({
|
|
2206
|
+
code: diagnostic.code,
|
|
2207
|
+
message: diagnostic.message.replace(/%[0-9]+/gu, (runtime) => semanticByRuntime.get(runtime) ?? "(unidentified pane)"),
|
|
2208
|
+
degraded: diagnostic.degraded,
|
|
2209
|
+
}));
|
|
2210
|
+
this.degraded = reconciliation.degraded;
|
|
2211
|
+
/*
|
|
2212
|
+
* Re-emit every window's layout now that panes carry semantic identity.
|
|
2213
|
+
*
|
|
2214
|
+
* A pane created by a split appears in the %layout-change frame BEFORE its
|
|
2215
|
+
* `@tmux_ide_pane_id` stamp exists, so the frame names it null — and a
|
|
2216
|
+
* consumer that renders semantic identities has nothing to draw for it. The
|
|
2217
|
+
* stamp-back lands here, in a sync, which emits no layout of its own; so
|
|
2218
|
+
* without this the new pane stays invisible until something else happens to
|
|
2219
|
+
* move a layout, and a split looks like it did not reach the view.
|
|
2220
|
+
*/
|
|
2221
|
+
for (const runtimeId of this.layoutByWindow.keys())
|
|
2222
|
+
this.emitLayout(runtimeId);
|
|
2223
|
+
this.emitLayoutAuthority();
|
|
2224
|
+
this.settleFirstJoin();
|
|
2225
|
+
return plan.stampEffects.length > 0;
|
|
2226
|
+
}
|
|
2227
|
+
async repairTrustedPaneIdentity(descriptors, layouts) {
|
|
2228
|
+
const rectForRuntime = (runtimePaneId) => {
|
|
2229
|
+
for (const layout of layouts.values()) {
|
|
2230
|
+
const leaf = layout.leaves.find(({ id }) => id === runtimePaneId);
|
|
2231
|
+
if (leaf) {
|
|
2232
|
+
return {
|
|
2233
|
+
left: leaf.left,
|
|
2234
|
+
top: leaf.top,
|
|
2235
|
+
width: leaf.width,
|
|
2236
|
+
height: leaf.height,
|
|
2237
|
+
};
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
return { left: 0, top: 0, width: 1, height: 1 };
|
|
2241
|
+
};
|
|
2242
|
+
const plan = planWorkspaceTmuxReconciliation({
|
|
2243
|
+
panes: descriptors.map((descriptor) => ({
|
|
2244
|
+
runtimePaneId: descriptor.runtimePaneId,
|
|
2245
|
+
semanticPaneId: descriptor.semanticPaneId,
|
|
2246
|
+
role: descriptor.role,
|
|
2247
|
+
type: descriptor.type,
|
|
2248
|
+
currentCommand: descriptor.currentCommand,
|
|
2249
|
+
cwd: descriptor.cwd,
|
|
2250
|
+
title: descriptor.title,
|
|
2251
|
+
rect: rectForRuntime(descriptor.runtimePaneId),
|
|
2252
|
+
active: descriptor.paneActive && descriptor.windowActive,
|
|
2253
|
+
})),
|
|
2254
|
+
generateSemanticPaneId: this.opts.generatePaneId ?? defaultMirrorPaneId,
|
|
2255
|
+
});
|
|
2256
|
+
if (plan.stampEffects.length === 0)
|
|
2257
|
+
return false;
|
|
2258
|
+
const outcomes = await Promise.all(plan.stampEffects.map((effect) => this.io
|
|
2259
|
+
.request(`set-option -p -t ${effect.runtimePaneId} ${WORKSPACE_SEMANTIC_PANE_OPTION} "${effect.value}"`)
|
|
2260
|
+
.then(() => true, () => false)));
|
|
2261
|
+
if (outcomes.some((ok) => !ok)) {
|
|
2262
|
+
throw new Error(`trusted inventory for ${this.opts.session} could not repair identity`);
|
|
2263
|
+
}
|
|
2264
|
+
return true;
|
|
2265
|
+
}
|
|
2266
|
+
settleFirstJoin() {
|
|
2267
|
+
this.resolveFirstJoin?.();
|
|
2268
|
+
this.resolveFirstJoin = null;
|
|
2269
|
+
}
|
|
2270
|
+
rectFor(runtime) {
|
|
2271
|
+
for (const layout of this.layoutByWindow.values()) {
|
|
2272
|
+
const leaf = layout.leaves.find((candidate) => candidate.id === runtime);
|
|
2273
|
+
if (leaf)
|
|
2274
|
+
return { left: leaf.left, top: leaf.top, width: leaf.width, height: leaf.height };
|
|
2275
|
+
}
|
|
2276
|
+
return { left: 0, top: 0, width: 1, height: 1 };
|
|
2277
|
+
}
|
|
2278
|
+
pushDiagnostic(diagnostic) {
|
|
2279
|
+
this.diagnostics = [...this.diagnostics.slice(-31), diagnostic];
|
|
2280
|
+
if (diagnostic.degraded)
|
|
2281
|
+
this.degraded = true;
|
|
2282
|
+
}
|
|
2283
|
+
onChannelExit() {
|
|
2284
|
+
if (this.disposed)
|
|
2285
|
+
return;
|
|
2286
|
+
this.settleFirstJoin();
|
|
2287
|
+
for (const runtime of [...this.recoveries.keys()])
|
|
2288
|
+
this.cancelRecovery(runtime);
|
|
2289
|
+
this.continueNotificationQueues.clear();
|
|
2290
|
+
for (const pane of this.panesByRuntime.values()) {
|
|
2291
|
+
for (const sub of pane.subs) {
|
|
2292
|
+
if (!sub.closed) {
|
|
2293
|
+
sub.closed = true;
|
|
2294
|
+
sub.onEvent({ type: "closed" });
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
pane.subs.clear();
|
|
2298
|
+
}
|
|
2299
|
+
this.opts.onExit?.();
|
|
2300
|
+
}
|
|
2301
|
+
}
|