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,1940 @@
|
|
|
1
|
+
const MAX_JSON_BYTES = 96 * 1024;
|
|
2
|
+
export const MAX_PASTE_BYTES = 64 * 1024;
|
|
3
|
+
export const MAX_CLIPBOARD_BYTES = 1024 * 1024;
|
|
4
|
+
export const MAX_CLIPBOARD_CALLBACK_ARTIFACTS = 4;
|
|
5
|
+
export const MAX_CLIPBOARD_AUTO_BUFFERS = 2_048;
|
|
6
|
+
export const DEFAULT_INPUT_TIMEOUT_MS = 2_000;
|
|
7
|
+
export const MAX_INPUT_TIMEOUT_MS = 5_000;
|
|
8
|
+
export const TESTDRIVE_INPUT_REPORTING_GRACE_MS = 500;
|
|
9
|
+
export const CLIPBOARD_RETIREMENT_RESERVE_MS = 650;
|
|
10
|
+
export const POST_INPUT_IDENTITY_RESERVE_MS = 200;
|
|
11
|
+
export const CLIPBOARD_OBSERVATION_RESERVE_MS = 400;
|
|
12
|
+
// Common-path clipboard arming performs two inventory reads plus seven
|
|
13
|
+
// lock/owner/hook operations. Each operation is already bounded at the tmux
|
|
14
|
+
// boundary; this aggregate slice prevents arming from consuming the release.
|
|
15
|
+
export const CLIPBOARD_ARM_BUDGET_MS = 900;
|
|
16
|
+
export const CLIPBOARD_RELEASE_BUDGET_MS = 200;
|
|
17
|
+
const CLIPBOARD_OBSERVATION_TIMEOUT = Symbol("clipboard-observation-timeout");
|
|
18
|
+
const CLIPBOARD_OBSERVATION_TIMEOUT_CODE = "TMUX_IDE_CLIPBOARD_OBSERVATION_TIMEOUT";
|
|
19
|
+
|
|
20
|
+
function clipboardObservationTimeoutError() {
|
|
21
|
+
const error = new Error("Clipboard observation deadline elapsed");
|
|
22
|
+
error.code = CLIPBOARD_OBSERVATION_TIMEOUT_CODE;
|
|
23
|
+
Object.defineProperty(error, CLIPBOARD_OBSERVATION_TIMEOUT, { value: true });
|
|
24
|
+
return error;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isClipboardObservationTimeout(error) {
|
|
28
|
+
return (
|
|
29
|
+
error?.code === CLIPBOARD_OBSERVATION_TIMEOUT_CODE &&
|
|
30
|
+
error?.[CLIPBOARD_OBSERVATION_TIMEOUT] === true
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function testdriveInputSupervisorTimeout(timeoutMs) {
|
|
35
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 50 || timeoutMs > MAX_INPUT_TIMEOUT_MS) {
|
|
36
|
+
throw new Error("Test-drive input supervisor timeout is malformed");
|
|
37
|
+
}
|
|
38
|
+
return timeoutMs + TESTDRIVE_INPUT_REPORTING_GRACE_MS;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const ESC = "\u001b";
|
|
42
|
+
const DOCUMENT_KEYS = new Set(["version", "kind", "timeoutMs"]);
|
|
43
|
+
const KEYS_BY_KIND = {
|
|
44
|
+
key: new Set([...DOCUMENT_KEYS, "key"]),
|
|
45
|
+
"modified-key": new Set([...DOCUMENT_KEYS, "key", "modifiers"]),
|
|
46
|
+
"control-key": new Set([...DOCUMENT_KEYS, "key"]),
|
|
47
|
+
paste: new Set([...DOCUMENT_KEYS, "text"]),
|
|
48
|
+
focus: new Set([...DOCUMENT_KEYS, "state"]),
|
|
49
|
+
"application-mouse": new Set([...DOCUMENT_KEYS, "action", "x", "y", "button", "modifiers"]),
|
|
50
|
+
"selection-drag": new Set([...DOCUMENT_KEYS, "from", "to", "contentRect"]),
|
|
51
|
+
"copy-capture": DOCUMENT_KEYS,
|
|
52
|
+
};
|
|
53
|
+
const POINTER_KEYS = new Set(["x", "y"]);
|
|
54
|
+
const RECT_KEYS = new Set(["x", "y", "width", "height"]);
|
|
55
|
+
const MODIFIERS = new Set(["shift", "alt", "meta", "ctrl"]);
|
|
56
|
+
export const TESTDRIVE_INPUT_OBSERVATION_PREFIX = "TMUX_IDE_TESTDRIVE_OBSERVATION ";
|
|
57
|
+
const INPUT_FAILURE_SUBSTAGES = new Set([
|
|
58
|
+
"resolve-identity",
|
|
59
|
+
"preflight-identity",
|
|
60
|
+
"capabilities",
|
|
61
|
+
"select-mode-identity",
|
|
62
|
+
"enter-select-mode",
|
|
63
|
+
"wait-select-mode",
|
|
64
|
+
"capture-before-selection",
|
|
65
|
+
"drag-pre-release-identity",
|
|
66
|
+
"drag-pre-release",
|
|
67
|
+
"selection-style-wait",
|
|
68
|
+
"pre-release-budget",
|
|
69
|
+
"clipboard-arm",
|
|
70
|
+
"release-identity",
|
|
71
|
+
"selection-release",
|
|
72
|
+
"input-delivery",
|
|
73
|
+
"clipboard-wait",
|
|
74
|
+
"clipboard-retirement",
|
|
75
|
+
"post-input-identity",
|
|
76
|
+
"postflight-identity",
|
|
77
|
+
]);
|
|
78
|
+
const INPUT_FAILURE_CAUSES = new Set([
|
|
79
|
+
"deadline",
|
|
80
|
+
"identity-mismatch",
|
|
81
|
+
"operation-error",
|
|
82
|
+
"timeout",
|
|
83
|
+
]);
|
|
84
|
+
const INPUT_FAILURE_BASE_KEYS = new Set([
|
|
85
|
+
"operation",
|
|
86
|
+
"kind",
|
|
87
|
+
"substage",
|
|
88
|
+
"completedPhases",
|
|
89
|
+
"totalPhases",
|
|
90
|
+
"completedTransportCalls",
|
|
91
|
+
"totalTransportCalls",
|
|
92
|
+
"completedPhysicalTransportCalls",
|
|
93
|
+
"totalPhysicalTransportCalls",
|
|
94
|
+
"cause",
|
|
95
|
+
"elapsedMs",
|
|
96
|
+
"remainingMs",
|
|
97
|
+
]);
|
|
98
|
+
const INPUT_FAILURE_CLIPBOARD_KEYS = new Set([
|
|
99
|
+
...INPUT_FAILURE_BASE_KEYS,
|
|
100
|
+
"candidateAttempts",
|
|
101
|
+
"occupiedCount",
|
|
102
|
+
"retirementExact",
|
|
103
|
+
"retirementStage",
|
|
104
|
+
"retirementElapsedMs",
|
|
105
|
+
"finalOwnerAbsent",
|
|
106
|
+
"finalHookAbsent",
|
|
107
|
+
"priorCopyCount",
|
|
108
|
+
"newCopyCount",
|
|
109
|
+
"clipboardIdentityExact",
|
|
110
|
+
"callbackInvocations",
|
|
111
|
+
"callbackStage",
|
|
112
|
+
"callbackOutcome",
|
|
113
|
+
"callbackInventoryPolls",
|
|
114
|
+
"callbackHookElapsedMs",
|
|
115
|
+
"callbackHookEntryLagMs",
|
|
116
|
+
"callbackInventorySeenElapsedMs",
|
|
117
|
+
"callbackArtifactPublishedElapsedMs",
|
|
118
|
+
"callbackPreSaveElapsedMs",
|
|
119
|
+
"callbackSaveElapsedMs",
|
|
120
|
+
"callbackSaveOutcome",
|
|
121
|
+
"callbackRetirementStage",
|
|
122
|
+
"callbackRetirementElapsedMs",
|
|
123
|
+
"callbackWorkSettled",
|
|
124
|
+
"callbackLeaseInactive",
|
|
125
|
+
"artifactObservedElapsedMs",
|
|
126
|
+
"duplicateSettleElapsedMs",
|
|
127
|
+
"callbackLastScanElapsedMs",
|
|
128
|
+
"clipboardArmElapsedMs",
|
|
129
|
+
"clipboardArmStartedElapsedMs",
|
|
130
|
+
"clipboardArmBudgetAtStartMs",
|
|
131
|
+
"clipboardArmRawRemainingAtStartMs",
|
|
132
|
+
"clipboardReleaseElapsedMs",
|
|
133
|
+
"clipboardWaitStartedElapsedMs",
|
|
134
|
+
"clipboardReleaseBudgetAtStartMs",
|
|
135
|
+
"clipboardReleaseIdentityElapsedMs",
|
|
136
|
+
"clipboardReleaseTransportAttempted",
|
|
137
|
+
"clipboardReleaseEffectOccurred",
|
|
138
|
+
"clipboardReleaseLoadMarkerAcquired",
|
|
139
|
+
"clipboardReleaseCleanupAttempted",
|
|
140
|
+
]);
|
|
141
|
+
const CLIPBOARD_CALLBACK_STAGES = new Set([
|
|
142
|
+
"not-invoked",
|
|
143
|
+
"hook-invoked",
|
|
144
|
+
"inventory-pending",
|
|
145
|
+
"inventory-seen",
|
|
146
|
+
"save-pending",
|
|
147
|
+
"artifact-published",
|
|
148
|
+
]);
|
|
149
|
+
const CLIPBOARD_CALLBACK_OUTCOMES = new Set(["pending", "seen", "published", "error"]);
|
|
150
|
+
|
|
151
|
+
export function clipboardCallbackStageOutcomeExact(stage, outcome) {
|
|
152
|
+
if (!CLIPBOARD_CALLBACK_STAGES.has(stage) || !CLIPBOARD_CALLBACK_OUTCOMES.has(outcome))
|
|
153
|
+
return false;
|
|
154
|
+
if (outcome === "published" || stage === "artifact-published")
|
|
155
|
+
return outcome === "published" && stage === "artifact-published";
|
|
156
|
+
if (outcome === "seen") return stage === "inventory-seen";
|
|
157
|
+
if (outcome === "pending")
|
|
158
|
+
return ["not-invoked", "hook-invoked", "inventory-pending", "save-pending"].includes(stage);
|
|
159
|
+
return [
|
|
160
|
+
"not-invoked",
|
|
161
|
+
"hook-invoked",
|
|
162
|
+
"inventory-pending",
|
|
163
|
+
"inventory-seen",
|
|
164
|
+
"save-pending",
|
|
165
|
+
].includes(stage);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function inputError(message) {
|
|
169
|
+
throw new Error(`Invalid test-drive input: ${message}`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function parseTestdriveInputFailureObservation(stderr, expectedKind) {
|
|
173
|
+
if (typeof stderr !== "string" || Buffer.byteLength(stderr) > 64 * 1_024) return null;
|
|
174
|
+
const matches = stderr
|
|
175
|
+
.split("\n")
|
|
176
|
+
.filter((line) => line.startsWith(TESTDRIVE_INPUT_OBSERVATION_PREFIX));
|
|
177
|
+
if (matches.length !== 1) return null;
|
|
178
|
+
try {
|
|
179
|
+
const value = JSON.parse(matches[0].slice(TESTDRIVE_INPUT_OBSERVATION_PREFIX.length));
|
|
180
|
+
if (
|
|
181
|
+
value === null ||
|
|
182
|
+
typeof value !== "object" ||
|
|
183
|
+
Array.isArray(value) ||
|
|
184
|
+
![INPUT_FAILURE_BASE_KEYS, INPUT_FAILURE_CLIPBOARD_KEYS].some(
|
|
185
|
+
(keys) =>
|
|
186
|
+
Object.keys(value).length === keys.size &&
|
|
187
|
+
Object.keys(value).every((key) => keys.has(key)),
|
|
188
|
+
) ||
|
|
189
|
+
value.operation !== "tui-testdrive-input" ||
|
|
190
|
+
value.kind !== expectedKind ||
|
|
191
|
+
!INPUT_FAILURE_SUBSTAGES.has(value.substage) ||
|
|
192
|
+
![value.completedPhases, value.completedTransportCalls].every(
|
|
193
|
+
(count) => Number.isSafeInteger(count) && count >= 0 && count <= 32,
|
|
194
|
+
) ||
|
|
195
|
+
![value.totalPhases, value.totalTransportCalls].every(
|
|
196
|
+
(count) => count === null || (Number.isSafeInteger(count) && count >= 0 && count <= 32),
|
|
197
|
+
) ||
|
|
198
|
+
!Number.isSafeInteger(value.completedPhysicalTransportCalls) ||
|
|
199
|
+
value.completedPhysicalTransportCalls < 0 ||
|
|
200
|
+
value.completedPhysicalTransportCalls > 32 ||
|
|
201
|
+
(value.totalPhysicalTransportCalls !== null &&
|
|
202
|
+
(!Number.isSafeInteger(value.totalPhysicalTransportCalls) ||
|
|
203
|
+
value.totalPhysicalTransportCalls < 0 ||
|
|
204
|
+
value.totalPhysicalTransportCalls > 32)) ||
|
|
205
|
+
!INPUT_FAILURE_CAUSES.has(value.cause) ||
|
|
206
|
+
![value.elapsedMs, value.remainingMs].every(
|
|
207
|
+
(duration) =>
|
|
208
|
+
Number.isSafeInteger(duration) && duration >= 0 && duration <= MAX_INPUT_TIMEOUT_MS,
|
|
209
|
+
)
|
|
210
|
+
)
|
|
211
|
+
return null;
|
|
212
|
+
const clipboardEvidence = "candidateAttempts" in value;
|
|
213
|
+
if (
|
|
214
|
+
clipboardEvidence &&
|
|
215
|
+
(!Number.isSafeInteger(value.candidateAttempts) ||
|
|
216
|
+
value.candidateAttempts < 0 ||
|
|
217
|
+
value.candidateAttempts > 8 ||
|
|
218
|
+
!Number.isSafeInteger(value.occupiedCount) ||
|
|
219
|
+
value.occupiedCount < 0 ||
|
|
220
|
+
value.occupiedCount > 8 ||
|
|
221
|
+
typeof value.retirementExact !== "boolean" ||
|
|
222
|
+
![
|
|
223
|
+
"not-started",
|
|
224
|
+
"lock",
|
|
225
|
+
"preflight",
|
|
226
|
+
"mutation",
|
|
227
|
+
"verification",
|
|
228
|
+
"unlock",
|
|
229
|
+
"complete",
|
|
230
|
+
].includes(value.retirementStage) ||
|
|
231
|
+
!Number.isSafeInteger(value.retirementElapsedMs) ||
|
|
232
|
+
value.retirementElapsedMs < 0 ||
|
|
233
|
+
value.retirementElapsedMs > MAX_INPUT_TIMEOUT_MS ||
|
|
234
|
+
typeof value.finalOwnerAbsent !== "boolean" ||
|
|
235
|
+
typeof value.finalHookAbsent !== "boolean" ||
|
|
236
|
+
![value.priorCopyCount, value.newCopyCount].every(
|
|
237
|
+
(count) =>
|
|
238
|
+
count === null || (Number.isSafeInteger(count) && count >= 0 && count <= 2_048),
|
|
239
|
+
) ||
|
|
240
|
+
typeof value.clipboardIdentityExact !== "boolean" ||
|
|
241
|
+
!Number.isSafeInteger(value.callbackInvocations) ||
|
|
242
|
+
value.callbackInvocations < 0 ||
|
|
243
|
+
value.callbackInvocations > 2 ||
|
|
244
|
+
!clipboardCallbackStageOutcomeExact(value.callbackStage, value.callbackOutcome) ||
|
|
245
|
+
!["not-started", "pending", "complete", "error"].includes(value.callbackSaveOutcome) ||
|
|
246
|
+
!["not-started", "already-exited", "abort-ack", "failed"].includes(
|
|
247
|
+
value.callbackRetirementStage,
|
|
248
|
+
) ||
|
|
249
|
+
!Number.isSafeInteger(value.callbackRetirementElapsedMs) ||
|
|
250
|
+
value.callbackRetirementElapsedMs < 0 ||
|
|
251
|
+
value.callbackRetirementElapsedMs > MAX_INPUT_TIMEOUT_MS ||
|
|
252
|
+
typeof value.callbackWorkSettled !== "boolean" ||
|
|
253
|
+
typeof value.callbackLeaseInactive !== "boolean" ||
|
|
254
|
+
!Number.isSafeInteger(value.callbackInventoryPolls) ||
|
|
255
|
+
value.callbackInventoryPolls < 0 ||
|
|
256
|
+
value.callbackInventoryPolls > 2_048 ||
|
|
257
|
+
![
|
|
258
|
+
value.callbackHookElapsedMs,
|
|
259
|
+
value.callbackHookEntryLagMs,
|
|
260
|
+
value.callbackInventorySeenElapsedMs,
|
|
261
|
+
value.callbackArtifactPublishedElapsedMs,
|
|
262
|
+
value.callbackPreSaveElapsedMs,
|
|
263
|
+
value.callbackSaveElapsedMs,
|
|
264
|
+
value.artifactObservedElapsedMs,
|
|
265
|
+
value.duplicateSettleElapsedMs,
|
|
266
|
+
value.callbackLastScanElapsedMs,
|
|
267
|
+
value.clipboardArmElapsedMs,
|
|
268
|
+
value.clipboardArmStartedElapsedMs,
|
|
269
|
+
value.clipboardArmBudgetAtStartMs,
|
|
270
|
+
value.clipboardArmRawRemainingAtStartMs,
|
|
271
|
+
value.clipboardReleaseElapsedMs,
|
|
272
|
+
value.clipboardWaitStartedElapsedMs,
|
|
273
|
+
value.clipboardReleaseBudgetAtStartMs,
|
|
274
|
+
value.clipboardReleaseIdentityElapsedMs,
|
|
275
|
+
].every(
|
|
276
|
+
(duration) =>
|
|
277
|
+
duration === null ||
|
|
278
|
+
(Number.isSafeInteger(duration) && duration >= 0 && duration <= MAX_INPUT_TIMEOUT_MS),
|
|
279
|
+
) ||
|
|
280
|
+
(value.clipboardArmStartedElapsedMs === null) !==
|
|
281
|
+
(value.clipboardArmBudgetAtStartMs === null) ||
|
|
282
|
+
(value.clipboardArmStartedElapsedMs === null) !==
|
|
283
|
+
(value.clipboardArmRawRemainingAtStartMs === null) ||
|
|
284
|
+
(value.clipboardArmBudgetAtStartMs !== null &&
|
|
285
|
+
(value.clipboardArmBudgetAtStartMs < 90 ||
|
|
286
|
+
value.clipboardArmBudgetAtStartMs > CLIPBOARD_ARM_BUDGET_MS)) ||
|
|
287
|
+
![
|
|
288
|
+
value.clipboardReleaseTransportAttempted,
|
|
289
|
+
value.clipboardReleaseLoadMarkerAcquired,
|
|
290
|
+
value.clipboardReleaseCleanupAttempted,
|
|
291
|
+
].every((flag) => typeof flag === "boolean") ||
|
|
292
|
+
![true, false, null].includes(value.clipboardReleaseEffectOccurred))
|
|
293
|
+
)
|
|
294
|
+
return null;
|
|
295
|
+
return Object.freeze({
|
|
296
|
+
operation: value.operation,
|
|
297
|
+
kind: value.kind,
|
|
298
|
+
substage: value.substage,
|
|
299
|
+
completedPhases: value.completedPhases,
|
|
300
|
+
totalPhases: value.totalPhases,
|
|
301
|
+
completedTransportCalls: value.completedTransportCalls,
|
|
302
|
+
totalTransportCalls: value.totalTransportCalls,
|
|
303
|
+
completedPhysicalTransportCalls: value.completedPhysicalTransportCalls,
|
|
304
|
+
totalPhysicalTransportCalls: value.totalPhysicalTransportCalls,
|
|
305
|
+
cause: value.cause,
|
|
306
|
+
elapsedMs: value.elapsedMs,
|
|
307
|
+
remainingMs: value.remainingMs,
|
|
308
|
+
...(clipboardEvidence
|
|
309
|
+
? {
|
|
310
|
+
candidateAttempts: value.candidateAttempts,
|
|
311
|
+
occupiedCount: value.occupiedCount,
|
|
312
|
+
retirementExact: value.retirementExact,
|
|
313
|
+
retirementStage: value.retirementStage,
|
|
314
|
+
retirementElapsedMs: value.retirementElapsedMs,
|
|
315
|
+
finalOwnerAbsent: value.finalOwnerAbsent,
|
|
316
|
+
finalHookAbsent: value.finalHookAbsent,
|
|
317
|
+
priorCopyCount: value.priorCopyCount,
|
|
318
|
+
newCopyCount: value.newCopyCount,
|
|
319
|
+
clipboardIdentityExact: value.clipboardIdentityExact,
|
|
320
|
+
callbackInvocations: value.callbackInvocations,
|
|
321
|
+
callbackStage: value.callbackStage,
|
|
322
|
+
callbackOutcome: value.callbackOutcome,
|
|
323
|
+
callbackInventoryPolls: value.callbackInventoryPolls,
|
|
324
|
+
callbackHookElapsedMs: value.callbackHookElapsedMs,
|
|
325
|
+
callbackHookEntryLagMs: value.callbackHookEntryLagMs,
|
|
326
|
+
callbackInventorySeenElapsedMs: value.callbackInventorySeenElapsedMs,
|
|
327
|
+
callbackArtifactPublishedElapsedMs: value.callbackArtifactPublishedElapsedMs,
|
|
328
|
+
callbackPreSaveElapsedMs: value.callbackPreSaveElapsedMs,
|
|
329
|
+
callbackSaveElapsedMs: value.callbackSaveElapsedMs,
|
|
330
|
+
callbackSaveOutcome: value.callbackSaveOutcome,
|
|
331
|
+
callbackRetirementStage: value.callbackRetirementStage,
|
|
332
|
+
callbackRetirementElapsedMs: value.callbackRetirementElapsedMs,
|
|
333
|
+
callbackWorkSettled: value.callbackWorkSettled,
|
|
334
|
+
callbackLeaseInactive: value.callbackLeaseInactive,
|
|
335
|
+
artifactObservedElapsedMs: value.artifactObservedElapsedMs,
|
|
336
|
+
duplicateSettleElapsedMs: value.duplicateSettleElapsedMs,
|
|
337
|
+
callbackLastScanElapsedMs: value.callbackLastScanElapsedMs,
|
|
338
|
+
clipboardArmElapsedMs: value.clipboardArmElapsedMs,
|
|
339
|
+
clipboardArmStartedElapsedMs: value.clipboardArmStartedElapsedMs,
|
|
340
|
+
clipboardArmBudgetAtStartMs: value.clipboardArmBudgetAtStartMs,
|
|
341
|
+
clipboardArmRawRemainingAtStartMs: value.clipboardArmRawRemainingAtStartMs,
|
|
342
|
+
clipboardReleaseElapsedMs: value.clipboardReleaseElapsedMs,
|
|
343
|
+
clipboardWaitStartedElapsedMs: value.clipboardWaitStartedElapsedMs,
|
|
344
|
+
clipboardReleaseBudgetAtStartMs: value.clipboardReleaseBudgetAtStartMs,
|
|
345
|
+
clipboardReleaseIdentityElapsedMs: value.clipboardReleaseIdentityElapsedMs,
|
|
346
|
+
clipboardReleaseTransportAttempted: value.clipboardReleaseTransportAttempted,
|
|
347
|
+
clipboardReleaseEffectOccurred: value.clipboardReleaseEffectOccurred,
|
|
348
|
+
clipboardReleaseLoadMarkerAcquired: value.clipboardReleaseLoadMarkerAcquired,
|
|
349
|
+
clipboardReleaseCleanupAttempted: value.clipboardReleaseCleanupAttempted,
|
|
350
|
+
}
|
|
351
|
+
: {}),
|
|
352
|
+
});
|
|
353
|
+
} catch {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function exactObject(value, keys, label) {
|
|
359
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
360
|
+
inputError(`${label} must be an object`);
|
|
361
|
+
}
|
|
362
|
+
for (const key of Object.keys(value)) {
|
|
363
|
+
if (!keys.has(key)) inputError(`${label} contains unknown field ${JSON.stringify(key)}`);
|
|
364
|
+
}
|
|
365
|
+
return value;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function integer(value, label, minimum, maximum) {
|
|
369
|
+
if (!Number.isInteger(value) || value < minimum || value > maximum) {
|
|
370
|
+
inputError(`${label} must be an integer from ${minimum} through ${maximum}`);
|
|
371
|
+
}
|
|
372
|
+
return value;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function timeout(value) {
|
|
376
|
+
if (value === undefined) return DEFAULT_INPUT_TIMEOUT_MS;
|
|
377
|
+
return integer(value, "timeoutMs", 50, MAX_INPUT_TIMEOUT_MS);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function point(value, label) {
|
|
381
|
+
const object = exactObject(value, POINTER_KEYS, label);
|
|
382
|
+
return {
|
|
383
|
+
x: integer(object.x, `${label}.x`, 0, 16_383),
|
|
384
|
+
y: integer(object.y, `${label}.y`, 0, 16_383),
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function contentRect(value) {
|
|
389
|
+
const object = exactObject(value, RECT_KEYS, "contentRect");
|
|
390
|
+
return {
|
|
391
|
+
x: integer(object.x, "contentRect.x", 0, 16_383),
|
|
392
|
+
y: integer(object.y, "contentRect.y", 0, 16_383),
|
|
393
|
+
width: integer(object.width, "contentRect.width", 1, 16_384),
|
|
394
|
+
height: integer(object.height, "contentRect.height", 1, 16_384),
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function modifiers(value) {
|
|
399
|
+
if (value === undefined) return [];
|
|
400
|
+
if (!Array.isArray(value) || value.length > MODIFIERS.size) {
|
|
401
|
+
inputError("modifiers must be an array with at most three entries");
|
|
402
|
+
}
|
|
403
|
+
const result = [];
|
|
404
|
+
for (const modifier of value) {
|
|
405
|
+
if (typeof modifier !== "string" || !MODIFIERS.has(modifier)) {
|
|
406
|
+
inputError(`unsupported modifier ${JSON.stringify(modifier)}`);
|
|
407
|
+
}
|
|
408
|
+
if (result.includes(modifier)) inputError(`duplicate modifier ${JSON.stringify(modifier)}`);
|
|
409
|
+
result.push(modifier);
|
|
410
|
+
}
|
|
411
|
+
return result;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export function parseTestdriveInputDocument(source) {
|
|
415
|
+
if (typeof source !== "string") inputError("JSON document must be a string");
|
|
416
|
+
const bytes = Buffer.byteLength(source, "utf8");
|
|
417
|
+
if (bytes === 0 || bytes > MAX_JSON_BYTES) {
|
|
418
|
+
inputError(`JSON document must contain 1 through ${MAX_JSON_BYTES} UTF-8 bytes`);
|
|
419
|
+
}
|
|
420
|
+
let raw;
|
|
421
|
+
try {
|
|
422
|
+
raw = JSON.parse(source);
|
|
423
|
+
} catch {
|
|
424
|
+
inputError("document is not valid JSON");
|
|
425
|
+
}
|
|
426
|
+
const object = exactObject(
|
|
427
|
+
raw,
|
|
428
|
+
new Set([...DOCUMENT_KEYS, ...Object.values(KEYS_BY_KIND).flatMap((keys) => [...keys])]),
|
|
429
|
+
"document",
|
|
430
|
+
);
|
|
431
|
+
if (object.version !== 1) inputError("version must be 1");
|
|
432
|
+
if (typeof object.kind !== "string") inputError("kind must be a string");
|
|
433
|
+
const allowedKeys = KEYS_BY_KIND[object.kind];
|
|
434
|
+
if (!allowedKeys) inputError(`unsupported kind ${JSON.stringify(object.kind)}`);
|
|
435
|
+
exactObject(object, allowedKeys, `${object.kind} document`);
|
|
436
|
+
const common = { version: 1, kind: object.kind, timeoutMs: timeout(object.timeoutMs) };
|
|
437
|
+
|
|
438
|
+
switch (object.kind) {
|
|
439
|
+
case "key": {
|
|
440
|
+
if (typeof object.key !== "string" || !/^[\x20-\x7e]$/u.test(object.key))
|
|
441
|
+
inputError("key must be one printable ASCII character");
|
|
442
|
+
return { ...common, kind: "key", key: object.key };
|
|
443
|
+
}
|
|
444
|
+
case "control-key": {
|
|
445
|
+
if (typeof object.key !== "string" || !/^[a-z]$/u.test(object.key))
|
|
446
|
+
inputError("control-key key must be one lowercase ASCII letter");
|
|
447
|
+
return { ...common, kind: "control-key", key: object.key };
|
|
448
|
+
}
|
|
449
|
+
case "modified-key": {
|
|
450
|
+
if (!["left", "right", "up", "down"].includes(object.key))
|
|
451
|
+
inputError("modified-key key must be left, right, up, or down");
|
|
452
|
+
const requestedModifiers = modifiers(object.modifiers);
|
|
453
|
+
if (requestedModifiers.length !== 1 || requestedModifiers[0] !== "meta")
|
|
454
|
+
inputError("modified-key currently requires exactly the meta modifier");
|
|
455
|
+
return {
|
|
456
|
+
...common,
|
|
457
|
+
kind: "modified-key",
|
|
458
|
+
key: object.key,
|
|
459
|
+
modifiers: requestedModifiers,
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
case "paste": {
|
|
463
|
+
if (typeof object.text !== "string") inputError("paste text must be a string");
|
|
464
|
+
if (object.text.includes(`${ESC}[201~`)) {
|
|
465
|
+
inputError("paste text must not contain a bracketed-paste terminator");
|
|
466
|
+
}
|
|
467
|
+
for (let index = 0; index < object.text.length; index += 1) {
|
|
468
|
+
const code = object.text.charCodeAt(index);
|
|
469
|
+
if (code < 0xd800 || code > 0xdfff) continue;
|
|
470
|
+
if (code <= 0xdbff && index + 1 < object.text.length) {
|
|
471
|
+
const next = object.text.charCodeAt(index + 1);
|
|
472
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
473
|
+
index += 1;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
inputError("paste text must not contain lone UTF-16 surrogates");
|
|
478
|
+
}
|
|
479
|
+
const textBytes = Buffer.byteLength(object.text, "utf8");
|
|
480
|
+
if (textBytes === 0 || textBytes > MAX_PASTE_BYTES) {
|
|
481
|
+
inputError(`paste text must contain 1 through ${MAX_PASTE_BYTES} UTF-8 bytes`);
|
|
482
|
+
}
|
|
483
|
+
return { ...common, kind: "paste", text: object.text };
|
|
484
|
+
}
|
|
485
|
+
case "focus":
|
|
486
|
+
if (object.state !== "focus" && object.state !== "blur") {
|
|
487
|
+
inputError("focus state must be focus or blur");
|
|
488
|
+
}
|
|
489
|
+
return { ...common, kind: "focus", state: object.state };
|
|
490
|
+
case "application-mouse": {
|
|
491
|
+
if (!["move", "down", "drag", "up", "click"].includes(object.action)) {
|
|
492
|
+
inputError("application-mouse action must be move, down, drag, up, or click");
|
|
493
|
+
}
|
|
494
|
+
const button = object.button ?? "left";
|
|
495
|
+
if (object.action === "move" && object.button !== undefined) {
|
|
496
|
+
inputError("application-mouse move must not specify a button");
|
|
497
|
+
}
|
|
498
|
+
if (!["left", "middle", "right"].includes(button)) {
|
|
499
|
+
inputError("application-mouse button must be left, middle, or right");
|
|
500
|
+
}
|
|
501
|
+
return {
|
|
502
|
+
...common,
|
|
503
|
+
kind: "application-mouse",
|
|
504
|
+
action: object.action,
|
|
505
|
+
x: integer(object.x, "x", 0, 16_383),
|
|
506
|
+
y: integer(object.y, "y", 0, 16_383),
|
|
507
|
+
button,
|
|
508
|
+
modifiers: modifiers(object.modifiers),
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
case "selection-drag": {
|
|
512
|
+
const from = point(object.from, "from");
|
|
513
|
+
const to = point(object.to, "to");
|
|
514
|
+
const rect = contentRect(object.contentRect);
|
|
515
|
+
if (from.x === to.x && from.y === to.y) {
|
|
516
|
+
inputError("selection-drag must span at least two terminal cells");
|
|
517
|
+
}
|
|
518
|
+
for (const [label, candidate] of [
|
|
519
|
+
["from", from],
|
|
520
|
+
["to", to],
|
|
521
|
+
]) {
|
|
522
|
+
if (
|
|
523
|
+
candidate.x < rect.x ||
|
|
524
|
+
candidate.x >= rect.x + rect.width ||
|
|
525
|
+
candidate.y < rect.y ||
|
|
526
|
+
candidate.y >= rect.y + rect.height
|
|
527
|
+
) {
|
|
528
|
+
inputError(`${label} must be inside contentRect`);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
...common,
|
|
533
|
+
kind: "selection-drag",
|
|
534
|
+
from,
|
|
535
|
+
to,
|
|
536
|
+
contentRect: rect,
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
case "copy-capture":
|
|
540
|
+
return { ...common, kind: "copy-capture" };
|
|
541
|
+
default:
|
|
542
|
+
inputError(`unsupported kind ${JSON.stringify(object.kind)}`);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function requireCapability(capabilities, name, operation) {
|
|
547
|
+
if (capabilities?.[name] !== true) {
|
|
548
|
+
throw new Error(`Terminal does not support ${operation}`);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function assertGeometry(pointValue, geometry, label) {
|
|
553
|
+
if (
|
|
554
|
+
!geometry ||
|
|
555
|
+
!Number.isInteger(geometry.cols) ||
|
|
556
|
+
!Number.isInteger(geometry.rows) ||
|
|
557
|
+
geometry.cols < 1 ||
|
|
558
|
+
geometry.rows < 1
|
|
559
|
+
) {
|
|
560
|
+
throw new Error("Live host geometry is unavailable");
|
|
561
|
+
}
|
|
562
|
+
if (pointValue.x >= geometry.cols || pointValue.y >= geometry.rows) {
|
|
563
|
+
throw new Error(
|
|
564
|
+
`${label} ${pointValue.x},${pointValue.y} is outside host geometry ${geometry.cols}x${geometry.rows}`,
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function modifierCode(values) {
|
|
570
|
+
return (
|
|
571
|
+
(values.includes("shift") ? 4 : 0) +
|
|
572
|
+
(values.includes("alt") || values.includes("meta") ? 8 : 0) +
|
|
573
|
+
(values.includes("ctrl") ? 16 : 0)
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function mouseSequence(action, x, y, button = "left", values = []) {
|
|
578
|
+
const buttonCode = { left: 0, middle: 1, right: 2 }[button];
|
|
579
|
+
const code =
|
|
580
|
+
action === "move"
|
|
581
|
+
? 35 + modifierCode(values)
|
|
582
|
+
: action === "drag"
|
|
583
|
+
? 32 + buttonCode + modifierCode(values)
|
|
584
|
+
: buttonCode + modifierCode(values);
|
|
585
|
+
return `${ESC}[<${code};${x + 1};${y + 1}${action === "up" ? "m" : "M"}`;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function selectionPhases(from, to) {
|
|
589
|
+
const phases = [{ bytes: mouseSequence("down", from.x, from.y), delayMs: 12 }];
|
|
590
|
+
const distance = Math.max(Math.abs(to.x - from.x), Math.abs(to.y - from.y));
|
|
591
|
+
const steps = Math.max(1, Math.min(24, distance));
|
|
592
|
+
for (let step = 1; step <= steps; step += 1) {
|
|
593
|
+
const x = Math.round(from.x + ((to.x - from.x) * step) / steps);
|
|
594
|
+
const y = Math.round(from.y + ((to.y - from.y) * step) / steps);
|
|
595
|
+
phases.push({ bytes: mouseSequence("drag", x, y), delayMs: 4 });
|
|
596
|
+
}
|
|
597
|
+
phases.push({ bytes: mouseSequence("up", to.x, to.y), delayMs: 0 });
|
|
598
|
+
return phases;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export function selectionInputPhases(from, to) {
|
|
602
|
+
return selectionPhases(from, to);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export function translateTestdriveInput(command, { capabilities, geometry } = {}) {
|
|
606
|
+
switch (command.kind) {
|
|
607
|
+
case "key":
|
|
608
|
+
return { phases: [{ bytes: command.key, delayMs: 0 }] };
|
|
609
|
+
case "control-key":
|
|
610
|
+
return {
|
|
611
|
+
phases: [{ bytes: String.fromCharCode(command.key.charCodeAt(0) - 96), delayMs: 0 }],
|
|
612
|
+
};
|
|
613
|
+
case "modified-key": {
|
|
614
|
+
const final = { up: "A", down: "B", right: "C", left: "D" }[command.key];
|
|
615
|
+
return { phases: [{ bytes: `${ESC}[1;3${final}`, delayMs: 0 }] };
|
|
616
|
+
}
|
|
617
|
+
case "paste":
|
|
618
|
+
requireCapability(capabilities, "bracketedPaste", "bracketed paste");
|
|
619
|
+
return { phases: [{ bytes: `${ESC}[200~${command.text}${ESC}[201~`, delayMs: 0 }] };
|
|
620
|
+
case "focus":
|
|
621
|
+
requireCapability(capabilities, "focusEvents", "host focus events");
|
|
622
|
+
return {
|
|
623
|
+
phases: [{ bytes: command.state === "focus" ? `${ESC}[I` : `${ESC}[O`, delayMs: 0 }],
|
|
624
|
+
};
|
|
625
|
+
case "application-mouse": {
|
|
626
|
+
requireCapability(capabilities, "sgrMouse", "SGR application mouse events");
|
|
627
|
+
assertGeometry(command, geometry, "mouse coordinate");
|
|
628
|
+
const downOrAction = mouseSequence(
|
|
629
|
+
command.action === "click" ? "down" : command.action,
|
|
630
|
+
command.x,
|
|
631
|
+
command.y,
|
|
632
|
+
command.button,
|
|
633
|
+
command.modifiers,
|
|
634
|
+
);
|
|
635
|
+
return {
|
|
636
|
+
phases:
|
|
637
|
+
command.action === "click"
|
|
638
|
+
? [
|
|
639
|
+
{ bytes: downOrAction, delayMs: 12 },
|
|
640
|
+
{
|
|
641
|
+
bytes: mouseSequence(
|
|
642
|
+
"up",
|
|
643
|
+
command.x,
|
|
644
|
+
command.y,
|
|
645
|
+
command.button,
|
|
646
|
+
command.modifiers,
|
|
647
|
+
),
|
|
648
|
+
delayMs: 0,
|
|
649
|
+
},
|
|
650
|
+
]
|
|
651
|
+
: [{ bytes: downOrAction, delayMs: 0 }],
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
case "selection-drag":
|
|
655
|
+
requireCapability(capabilities, "sgrMouse", "SGR selection drag");
|
|
656
|
+
assertGeometry(command.from, geometry, "selection start");
|
|
657
|
+
assertGeometry(command.to, geometry, "selection end");
|
|
658
|
+
if (
|
|
659
|
+
command.contentRect.x + command.contentRect.width > geometry.cols ||
|
|
660
|
+
command.contentRect.y + command.contentRect.height > geometry.rows
|
|
661
|
+
) {
|
|
662
|
+
throw new Error("selection contentRect is outside live host geometry");
|
|
663
|
+
}
|
|
664
|
+
return { phases: selectionPhases(command.from, command.to) };
|
|
665
|
+
case "copy-capture":
|
|
666
|
+
requireCapability(capabilities, "clipboardCapture", "clipboard capture");
|
|
667
|
+
return { phases: [{ bytes: "\u0003", delayMs: 0 }], captureClipboard: true };
|
|
668
|
+
default:
|
|
669
|
+
throw new Error(`Unsupported parsed test-drive input kind ${JSON.stringify(command.kind)}`);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export function fullTerminalCapabilities() {
|
|
674
|
+
return {
|
|
675
|
+
bracketedPaste: true,
|
|
676
|
+
focusEvents: true,
|
|
677
|
+
sgrMouse: true,
|
|
678
|
+
clipboardCapture: true,
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export function exactPtyPasteBufferArgs(bufferName, target) {
|
|
683
|
+
if (!/^testdrive-input-[A-Za-z0-9-]+$/u.test(bufferName)) {
|
|
684
|
+
throw new Error("Invalid ephemeral test-drive buffer name");
|
|
685
|
+
}
|
|
686
|
+
if (!/^%[0-9]+$/u.test(target)) {
|
|
687
|
+
throw new Error("Invalid exact test-drive host pane target");
|
|
688
|
+
}
|
|
689
|
+
// -S disables vis(3) control-byte sanitizing and -r preserves LF bytes.
|
|
690
|
+
// Deliberately omit -p: the caller already supplied any bracket markers.
|
|
691
|
+
return ["paste-buffer", "-d", "-r", "-S", "-b", bufferName, "-t", target];
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
function applySgr(style, parameters) {
|
|
695
|
+
const next = { ...style };
|
|
696
|
+
const values = parameters.length === 0 ? [0] : parameters;
|
|
697
|
+
for (let index = 0; index < values.length; index += 1) {
|
|
698
|
+
const code = values[index];
|
|
699
|
+
if (code === 0) {
|
|
700
|
+
next.fg = "default";
|
|
701
|
+
next.bg = "default";
|
|
702
|
+
} else if (code === 39) next.fg = "default";
|
|
703
|
+
else if (code === 49) next.bg = "default";
|
|
704
|
+
else if (code >= 30 && code <= 37) next.fg = `palette:${code - 30}`;
|
|
705
|
+
else if (code >= 90 && code <= 97) next.fg = `palette:${code - 90 + 8}`;
|
|
706
|
+
else if (code >= 40 && code <= 47) next.bg = `palette:${code - 40}`;
|
|
707
|
+
else if (code >= 100 && code <= 107) next.bg = `palette:${code - 100 + 8}`;
|
|
708
|
+
else if (code === 38 || code === 48) {
|
|
709
|
+
const channel = code === 38 ? "fg" : "bg";
|
|
710
|
+
if (values[index + 1] === 5 && Number.isInteger(values[index + 2])) {
|
|
711
|
+
next[channel] = `palette:${values[index + 2]}`;
|
|
712
|
+
index += 2;
|
|
713
|
+
} else if (
|
|
714
|
+
values[index + 1] === 2 &&
|
|
715
|
+
values.slice(index + 2, index + 5).every(Number.isInteger)
|
|
716
|
+
) {
|
|
717
|
+
next[channel] = `rgb:${values.slice(index + 2, index + 5).join(",")}`;
|
|
718
|
+
index += 4;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return next;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
export function decodeTmuxCaptureCellStyles(frame, geometry) {
|
|
726
|
+
const rows = Array.from({ length: geometry.rows }, () =>
|
|
727
|
+
Array.from({ length: geometry.cols }, () => ({ fg: "default", bg: "default" })),
|
|
728
|
+
);
|
|
729
|
+
let row = 0;
|
|
730
|
+
let col = 0;
|
|
731
|
+
let style = { fg: "default", bg: "default" };
|
|
732
|
+
for (let index = 0; index < frame.length && row < geometry.rows; index += 1) {
|
|
733
|
+
if (frame[index] === ESC && frame[index + 1] === "[") {
|
|
734
|
+
let end = index + 2;
|
|
735
|
+
while (end < frame.length && !/[A-Za-z]/u.test(frame[end])) end += 1;
|
|
736
|
+
if (frame[end] === "m") {
|
|
737
|
+
const raw = frame.slice(index + 2, end);
|
|
738
|
+
if (!/^[0-9;]*$/u.test(raw)) throw new Error("Unsupported tmux SGR capture encoding");
|
|
739
|
+
style = applySgr(style, raw === "" ? [] : raw.split(";").map(Number));
|
|
740
|
+
}
|
|
741
|
+
index = end;
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
if (frame[index] === "\n") {
|
|
745
|
+
row += 1;
|
|
746
|
+
col = 0;
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
if (frame[index] === "\r") continue;
|
|
750
|
+
const codePoint = String.fromCodePoint(frame.codePointAt(index));
|
|
751
|
+
if (codePoint.length === 2) index += 1;
|
|
752
|
+
const width = stringWidth(codePoint);
|
|
753
|
+
if (width < 1) continue;
|
|
754
|
+
for (let offset = 0; offset < width && col + offset < geometry.cols; offset += 1) {
|
|
755
|
+
rows[row][col + offset] = { ...style };
|
|
756
|
+
}
|
|
757
|
+
col += width;
|
|
758
|
+
}
|
|
759
|
+
return rows;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function dragSpanCells(from, to, content) {
|
|
763
|
+
const localFrom = { x: from.x - content.x, y: from.y - content.y };
|
|
764
|
+
const localTo = { x: to.x - content.x, y: to.y - content.y };
|
|
765
|
+
const ordered =
|
|
766
|
+
localFrom.y < localTo.y || (localFrom.y === localTo.y && localFrom.x <= localTo.x)
|
|
767
|
+
? { start: localFrom, end: localTo }
|
|
768
|
+
: { start: localTo, end: localFrom };
|
|
769
|
+
const cells = [];
|
|
770
|
+
for (let row = ordered.start.y; row <= ordered.end.y; row += 1) {
|
|
771
|
+
const first = row === ordered.start.y ? ordered.start.x : 0;
|
|
772
|
+
const last = row === ordered.end.y ? ordered.end.x : content.width - 1;
|
|
773
|
+
for (let col = first; col <= last; col += 1) {
|
|
774
|
+
cells.push({ row: content.y + row, col: content.x + col });
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return cells;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
export function proveRendererSelectionStyleDelta(
|
|
781
|
+
beforeFrame,
|
|
782
|
+
afterFrame,
|
|
783
|
+
from,
|
|
784
|
+
to,
|
|
785
|
+
geometry,
|
|
786
|
+
content,
|
|
787
|
+
) {
|
|
788
|
+
const before = decodeTmuxCaptureCellStyles(beforeFrame, geometry);
|
|
789
|
+
const after = decodeTmuxCaptureCellStyles(afterFrame, geometry);
|
|
790
|
+
const span = dragSpanCells(from, to, content);
|
|
791
|
+
const swapped = span.filter(({ row, col }) => {
|
|
792
|
+
const prior = before[row]?.[col];
|
|
793
|
+
const next = after[row]?.[col];
|
|
794
|
+
return prior && next && prior.fg === next.bg && prior.bg === next.fg && prior.fg !== prior.bg;
|
|
795
|
+
});
|
|
796
|
+
const requested = new Set(span.map(({ row, col }) => `${row}:${col}`));
|
|
797
|
+
const changed = [];
|
|
798
|
+
for (let row = 0; row < geometry.rows; row += 1) {
|
|
799
|
+
for (let col = 0; col < geometry.cols; col += 1) {
|
|
800
|
+
const prior = before[row]?.[col];
|
|
801
|
+
const next = after[row]?.[col];
|
|
802
|
+
if (prior && next && (prior.fg !== next.fg || prior.bg !== next.bg))
|
|
803
|
+
changed.push({ row, col });
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
const extra = changed.filter(({ row, col }) => !requested.has(`${row}:${col}`));
|
|
807
|
+
if (swapped.length < 2 || swapped.length !== span.length || extra.length !== 0) {
|
|
808
|
+
throw new Error(
|
|
809
|
+
`OpenTUI selection style proof covered ${swapped.length}/${span.length} requested cells with ${extra.length} extra changed cells`,
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
return { cells: swapped.length, extraChangedCells: 0 };
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
export function deliverExactHostBytes({ identity, bytes, timeoutMs, bufferName, runTmux, clock }) {
|
|
816
|
+
if (typeof bytes !== "string" || Buffer.byteLength(bytes, "utf8") === 0) {
|
|
817
|
+
throw new Error("test-drive input sequence must contain bytes");
|
|
818
|
+
}
|
|
819
|
+
const deadline = clock.now() + timeoutMs;
|
|
820
|
+
const cleanupReserve = Math.min(25, Math.max(5, Math.floor(timeoutMs / 4)));
|
|
821
|
+
const workRemaining = () => {
|
|
822
|
+
const value = Math.floor(deadline - clock.now() - cleanupReserve);
|
|
823
|
+
if (value < 1) throw new Error("Exact PTY delivery exceeded its absolute deadline");
|
|
824
|
+
return value;
|
|
825
|
+
};
|
|
826
|
+
const cleanupRemaining = () => Math.max(1, Math.floor(deadline - clock.now()));
|
|
827
|
+
const loadMarker = "TMUX_IDE_TESTDRIVE_BUFFER_LOADED";
|
|
828
|
+
const transaction = [
|
|
829
|
+
"load-buffer",
|
|
830
|
+
"-b",
|
|
831
|
+
bufferName,
|
|
832
|
+
"-",
|
|
833
|
+
";",
|
|
834
|
+
"display-message",
|
|
835
|
+
"-p",
|
|
836
|
+
loadMarker,
|
|
837
|
+
";",
|
|
838
|
+
...exactPtyPasteBufferArgs(bufferName, identity.paneId),
|
|
839
|
+
];
|
|
840
|
+
try {
|
|
841
|
+
const output = runTmux(transaction, {
|
|
842
|
+
input: bytes,
|
|
843
|
+
timeout: workRemaining(),
|
|
844
|
+
});
|
|
845
|
+
if (String(output ?? "").trim() !== loadMarker) {
|
|
846
|
+
throw new Error("Exact PTY delivery transaction proof is malformed");
|
|
847
|
+
}
|
|
848
|
+
return Object.freeze({
|
|
849
|
+
physicalCalls: 1,
|
|
850
|
+
transportAttempted: true,
|
|
851
|
+
effectOccurred: true,
|
|
852
|
+
loadMarkerAcquired: true,
|
|
853
|
+
cleanupAttempted: false,
|
|
854
|
+
});
|
|
855
|
+
} catch (error) {
|
|
856
|
+
// The marker is emitted only after load-buffer has acquired this
|
|
857
|
+
// operation's unguessable buffer name. A later paste failure therefore
|
|
858
|
+
// owns exactly one bounded delete; a load failure must not delete a name
|
|
859
|
+
// it never acquired.
|
|
860
|
+
const loadMarkerAcquired = String(error?.stdout ?? "").trim() === loadMarker;
|
|
861
|
+
let cleanupAttempted = false;
|
|
862
|
+
if (loadMarkerAcquired) {
|
|
863
|
+
cleanupAttempted = true;
|
|
864
|
+
try {
|
|
865
|
+
runTmux(["delete-buffer", "-b", bufferName], { timeout: cleanupRemaining() });
|
|
866
|
+
} catch {
|
|
867
|
+
// The operation still fails by its original error; cleanup is bounded
|
|
868
|
+
// and best-effort, but is never skipped.
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
if (error && typeof error === "object") {
|
|
872
|
+
error.deliveryEvidence = Object.freeze({
|
|
873
|
+
transportAttempted: true,
|
|
874
|
+
effectOccurred: loadMarkerAcquired ? null : false,
|
|
875
|
+
loadMarkerAcquired,
|
|
876
|
+
cleanupAttempted,
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
throw error;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
export async function reapOwnedClipboardCallback({
|
|
884
|
+
isActive,
|
|
885
|
+
requestAbort,
|
|
886
|
+
isAcknowledged,
|
|
887
|
+
sleep,
|
|
888
|
+
clock,
|
|
889
|
+
timeoutMs,
|
|
890
|
+
}) {
|
|
891
|
+
if (
|
|
892
|
+
typeof isActive !== "function" ||
|
|
893
|
+
typeof requestAbort !== "function" ||
|
|
894
|
+
typeof isAcknowledged !== "function" ||
|
|
895
|
+
typeof sleep !== "function" ||
|
|
896
|
+
typeof clock?.now !== "function" ||
|
|
897
|
+
!Number.isSafeInteger(timeoutMs) ||
|
|
898
|
+
timeoutMs < 1 ||
|
|
899
|
+
timeoutMs > MAX_INPUT_TIMEOUT_MS
|
|
900
|
+
) {
|
|
901
|
+
throw new Error("Clipboard callback retirement input is malformed");
|
|
902
|
+
}
|
|
903
|
+
const startedAt = clock.now();
|
|
904
|
+
const deadline = startedAt + timeoutMs;
|
|
905
|
+
const elapsed = () =>
|
|
906
|
+
Math.min(MAX_INPUT_TIMEOUT_MS, Math.max(0, Math.round(clock.now() - startedAt)));
|
|
907
|
+
const failed = (cause) => {
|
|
908
|
+
const error = new Error(`Clipboard callback cooperative retirement failed: ${cause}`);
|
|
909
|
+
error.clipboardCallbackRetirement = Object.freeze({
|
|
910
|
+
callbackRetirementStage: "failed",
|
|
911
|
+
callbackRetirementElapsedMs: elapsed(),
|
|
912
|
+
callbackWorkSettled: false,
|
|
913
|
+
callbackLeaseInactive: false,
|
|
914
|
+
});
|
|
915
|
+
return error;
|
|
916
|
+
};
|
|
917
|
+
try {
|
|
918
|
+
if (!isActive())
|
|
919
|
+
return Object.freeze({
|
|
920
|
+
callbackRetirementStage: "already-exited",
|
|
921
|
+
callbackRetirementElapsedMs: 0,
|
|
922
|
+
callbackWorkSettled: true,
|
|
923
|
+
callbackLeaseInactive: true,
|
|
924
|
+
});
|
|
925
|
+
await requestAbort();
|
|
926
|
+
while (clock.now() < deadline) {
|
|
927
|
+
const active = isActive();
|
|
928
|
+
const acknowledged = isAcknowledged();
|
|
929
|
+
if (!active) {
|
|
930
|
+
return Object.freeze({
|
|
931
|
+
callbackRetirementStage: acknowledged ? "abort-ack" : "already-exited",
|
|
932
|
+
callbackRetirementElapsedMs: elapsed(),
|
|
933
|
+
callbackWorkSettled: true,
|
|
934
|
+
callbackLeaseInactive: true,
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
await sleep(Math.min(10, Math.max(1, deadline - clock.now())));
|
|
938
|
+
}
|
|
939
|
+
throw failed("deadline");
|
|
940
|
+
} catch (error) {
|
|
941
|
+
if (error?.clipboardCallbackRetirement) throw error;
|
|
942
|
+
throw failed("control-channel");
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
export async function watchClipboardCallbackAbort({
|
|
947
|
+
controlToken,
|
|
948
|
+
readRequest,
|
|
949
|
+
abort,
|
|
950
|
+
isSettled,
|
|
951
|
+
sleep,
|
|
952
|
+
}) {
|
|
953
|
+
if (
|
|
954
|
+
!/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/u.test(controlToken ?? "") ||
|
|
955
|
+
typeof readRequest !== "function" ||
|
|
956
|
+
typeof abort !== "function" ||
|
|
957
|
+
typeof isSettled !== "function" ||
|
|
958
|
+
typeof sleep !== "function"
|
|
959
|
+
) {
|
|
960
|
+
throw new Error("Clipboard callback abort watcher input is malformed");
|
|
961
|
+
}
|
|
962
|
+
while (!isSettled()) {
|
|
963
|
+
const request = readRequest();
|
|
964
|
+
if (request !== null) {
|
|
965
|
+
if (
|
|
966
|
+
request?.version !== 1 ||
|
|
967
|
+
Object.keys(request).length !== 3 ||
|
|
968
|
+
request.kind !== "abort" ||
|
|
969
|
+
request.controlToken !== controlToken
|
|
970
|
+
) {
|
|
971
|
+
throw new Error("Clipboard callback abort request identity is malformed");
|
|
972
|
+
}
|
|
973
|
+
abort();
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
await sleep(5);
|
|
977
|
+
}
|
|
978
|
+
return false;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
export function validateClipboardObservationEvents(events, expected) {
|
|
982
|
+
if (!Array.isArray(events) || events.length !== 1) {
|
|
983
|
+
throw new Error(
|
|
984
|
+
events?.length > 1
|
|
985
|
+
? "Multiple clipboard events matched one test-drive operation"
|
|
986
|
+
: "Missing pane-scoped clipboard event",
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
const event = exactObject(
|
|
990
|
+
events[0],
|
|
991
|
+
new Set(["version", "nonce", "paneId", "bufferName", "bytes", "sha256"]),
|
|
992
|
+
"clipboard event",
|
|
993
|
+
);
|
|
994
|
+
if (
|
|
995
|
+
event.version !== 1 ||
|
|
996
|
+
event.nonce !== expected.nonce ||
|
|
997
|
+
event.paneId !== expected.paneId ||
|
|
998
|
+
typeof event.bufferName !== "string" ||
|
|
999
|
+
!/^buffer[0-9]+$/u.test(event.bufferName) ||
|
|
1000
|
+
!Number.isInteger(event.bytes) ||
|
|
1001
|
+
event.bytes < 1 ||
|
|
1002
|
+
event.bytes > MAX_CLIPBOARD_BYTES ||
|
|
1003
|
+
typeof event.sha256 !== "string" ||
|
|
1004
|
+
!/^[a-f0-9]{64}$/u.test(event.sha256)
|
|
1005
|
+
) {
|
|
1006
|
+
throw new Error("Clipboard hook published malformed or unrelated evidence");
|
|
1007
|
+
}
|
|
1008
|
+
return { bytes: event.bytes, sha256: event.sha256 };
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
export function enforceClipboardCallbackCap(artifactIds) {
|
|
1012
|
+
const unique = new Set(artifactIds);
|
|
1013
|
+
if (unique.size > MAX_CLIPBOARD_CALLBACK_ARTIFACTS) {
|
|
1014
|
+
throw new Error(
|
|
1015
|
+
`Clipboard callback cap exceeded (${unique.size}/${MAX_CLIPBOARD_CALLBACK_ARTIFACTS})`,
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
return unique.size;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
export function parseClipboardCallbackState(value, expected) {
|
|
1022
|
+
const saveTimingExact =
|
|
1023
|
+
value?.stage === "save-pending" || value?.stage === "artifact-published"
|
|
1024
|
+
? Number.isSafeInteger(value.preSaveElapsedMs) &&
|
|
1025
|
+
value.preSaveElapsedMs >= value.inventorySeenElapsedMs &&
|
|
1026
|
+
(value.stage === "artifact-published"
|
|
1027
|
+
? value.saveOutcome === "complete" &&
|
|
1028
|
+
Number.isSafeInteger(value.saveElapsedMs) &&
|
|
1029
|
+
value.saveElapsedMs >= 0 &&
|
|
1030
|
+
value.preSaveElapsedMs + value.saveElapsedMs <= value.artifactPublishedElapsedMs
|
|
1031
|
+
: ["pending", "error"].includes(value.saveOutcome) &&
|
|
1032
|
+
(value.saveElapsedMs === null ||
|
|
1033
|
+
(Number.isSafeInteger(value.saveElapsedMs) && value.saveElapsedMs >= 0)))
|
|
1034
|
+
: value?.preSaveElapsedMs === null &&
|
|
1035
|
+
value?.saveElapsedMs === null &&
|
|
1036
|
+
value?.saveOutcome === "not-started";
|
|
1037
|
+
const timingExact =
|
|
1038
|
+
Number.isSafeInteger(value?.hookElapsedMs) &&
|
|
1039
|
+
value.hookElapsedMs >= 0 &&
|
|
1040
|
+
value.hookElapsedMs <= MAX_INPUT_TIMEOUT_MS &&
|
|
1041
|
+
(["inventory-seen", "save-pending", "artifact-published"].includes(value?.stage)
|
|
1042
|
+
? Number.isSafeInteger(value.inventorySeenElapsedMs) &&
|
|
1043
|
+
value.inventorySeenElapsedMs >= value.hookElapsedMs
|
|
1044
|
+
: value?.inventorySeenElapsedMs === null) &&
|
|
1045
|
+
(value?.stage === "artifact-published"
|
|
1046
|
+
? Number.isSafeInteger(value.artifactPublishedElapsedMs) &&
|
|
1047
|
+
value.artifactPublishedElapsedMs >= value.inventorySeenElapsedMs
|
|
1048
|
+
: value?.artifactPublishedElapsedMs === null);
|
|
1049
|
+
if (
|
|
1050
|
+
value === null ||
|
|
1051
|
+
typeof value !== "object" ||
|
|
1052
|
+
Array.isArray(value) ||
|
|
1053
|
+
Object.keys(value).length !== 13 ||
|
|
1054
|
+
value.version !== 1 ||
|
|
1055
|
+
value.nonce !== expected?.nonce ||
|
|
1056
|
+
value.paneId !== expected?.paneId ||
|
|
1057
|
+
value.stage === "not-invoked" ||
|
|
1058
|
+
!clipboardCallbackStageOutcomeExact(value.stage, value.outcome) ||
|
|
1059
|
+
!Number.isSafeInteger(value.inventoryPolls) ||
|
|
1060
|
+
value.inventoryPolls < 0 ||
|
|
1061
|
+
value.inventoryPolls > 2_048 ||
|
|
1062
|
+
!Number.isSafeInteger(value.hookEntryLagMs) ||
|
|
1063
|
+
value.hookEntryLagMs < 0 ||
|
|
1064
|
+
value.hookEntryLagMs > MAX_INPUT_TIMEOUT_MS ||
|
|
1065
|
+
!timingExact ||
|
|
1066
|
+
!saveTimingExact ||
|
|
1067
|
+
![
|
|
1068
|
+
value.hookElapsedMs,
|
|
1069
|
+
value.inventorySeenElapsedMs,
|
|
1070
|
+
value.artifactPublishedElapsedMs,
|
|
1071
|
+
value.preSaveElapsedMs,
|
|
1072
|
+
value.saveElapsedMs,
|
|
1073
|
+
].every(
|
|
1074
|
+
(duration) =>
|
|
1075
|
+
duration === null ||
|
|
1076
|
+
(Number.isSafeInteger(duration) && duration >= 0 && duration <= MAX_INPUT_TIMEOUT_MS),
|
|
1077
|
+
)
|
|
1078
|
+
) {
|
|
1079
|
+
throw new Error("Clipboard callback state is malformed or unrelated");
|
|
1080
|
+
}
|
|
1081
|
+
return Object.freeze({
|
|
1082
|
+
callbackStage: value.stage,
|
|
1083
|
+
callbackOutcome: value.outcome,
|
|
1084
|
+
callbackInventoryPolls: value.inventoryPolls,
|
|
1085
|
+
callbackHookElapsedMs: value.hookElapsedMs,
|
|
1086
|
+
callbackHookEntryLagMs: value.hookEntryLagMs,
|
|
1087
|
+
callbackInventorySeenElapsedMs: value.inventorySeenElapsedMs,
|
|
1088
|
+
callbackArtifactPublishedElapsedMs: value.artifactPublishedElapsedMs,
|
|
1089
|
+
callbackPreSaveElapsedMs: value.preSaveElapsedMs,
|
|
1090
|
+
callbackSaveElapsedMs: value.saveElapsedMs,
|
|
1091
|
+
callbackSaveOutcome: value.saveOutcome,
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
export function parseClipboardAutoBufferInventory(source, bufferLimit) {
|
|
1096
|
+
if (
|
|
1097
|
+
typeof source !== "string" ||
|
|
1098
|
+
Buffer.byteLength(source, "utf8") > 256 * 1_024 ||
|
|
1099
|
+
!Number.isSafeInteger(bufferLimit) ||
|
|
1100
|
+
bufferLimit < 2 ||
|
|
1101
|
+
bufferLimit > MAX_CLIPBOARD_AUTO_BUFFERS
|
|
1102
|
+
) {
|
|
1103
|
+
throw new Error("Clipboard automatic buffer inventory is malformed or over cap");
|
|
1104
|
+
}
|
|
1105
|
+
const buffers = [];
|
|
1106
|
+
const names = new Set();
|
|
1107
|
+
for (const line of source.split("\n").filter(Boolean)) {
|
|
1108
|
+
const fields = line.split("\t");
|
|
1109
|
+
if (fields.length !== 3) throw new Error("Clipboard buffer inventory row is malformed");
|
|
1110
|
+
const [name, sizeText, created] = fields;
|
|
1111
|
+
if (!/^buffer[0-9]+$/u.test(name)) continue;
|
|
1112
|
+
const size = Number(sizeText);
|
|
1113
|
+
if (
|
|
1114
|
+
names.has(name) ||
|
|
1115
|
+
!Number.isSafeInteger(size) ||
|
|
1116
|
+
size < 0 ||
|
|
1117
|
+
size > MAX_CLIPBOARD_BYTES ||
|
|
1118
|
+
typeof created !== "string" ||
|
|
1119
|
+
created.length < 1 ||
|
|
1120
|
+
created.length > 64 ||
|
|
1121
|
+
[...created].some((character) => {
|
|
1122
|
+
const code = character.codePointAt(0);
|
|
1123
|
+
return code < 0x20 || code === 0x7f;
|
|
1124
|
+
})
|
|
1125
|
+
) {
|
|
1126
|
+
throw new Error("Clipboard automatic buffer inventory entry is malformed");
|
|
1127
|
+
}
|
|
1128
|
+
names.add(name);
|
|
1129
|
+
buffers.push(Object.freeze({ name, size, created }));
|
|
1130
|
+
}
|
|
1131
|
+
if (buffers.length > bufferLimit || buffers.length > MAX_CLIPBOARD_AUTO_BUFFERS) {
|
|
1132
|
+
throw new Error("Clipboard automatic buffer inventory exceeds buffer-limit");
|
|
1133
|
+
}
|
|
1134
|
+
// tmux paste_walk() lists newest first, so the last automatic entry is the
|
|
1135
|
+
// exact eviction candidate when paste_add() reaches buffer-limit.
|
|
1136
|
+
const oldestAutoName = buffers.at(-1)?.name ?? null;
|
|
1137
|
+
return Object.freeze({
|
|
1138
|
+
bufferLimit,
|
|
1139
|
+
oldestAutoName,
|
|
1140
|
+
buffers: Object.freeze(
|
|
1141
|
+
[...buffers].sort((left, right) =>
|
|
1142
|
+
left.name < right.name ? -1 : left.name > right.name ? 1 : 0,
|
|
1143
|
+
),
|
|
1144
|
+
),
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
const CLIPBOARD_LIMIT_MARKER = "__TMUX_IDE_CLIPBOARD_LIMIT__";
|
|
1149
|
+
const CLIPBOARD_BUFFERS_MARKER = "__TMUX_IDE_CLIPBOARD_BUFFERS__";
|
|
1150
|
+
const CLIPBOARD_INVENTORY_END_MARKER = "__TMUX_IDE_CLIPBOARD_INVENTORY_END__";
|
|
1151
|
+
|
|
1152
|
+
function clipboardInventoryTransactionCommands({ runTmux, timeoutMs, save }) {
|
|
1153
|
+
if (
|
|
1154
|
+
typeof runTmux !== "function" ||
|
|
1155
|
+
!Number.isSafeInteger(timeoutMs) ||
|
|
1156
|
+
timeoutMs < 1 ||
|
|
1157
|
+
timeoutMs > MAX_INPUT_TIMEOUT_MS ||
|
|
1158
|
+
(save !== null &&
|
|
1159
|
+
(typeof save !== "object" ||
|
|
1160
|
+
Array.isArray(save) ||
|
|
1161
|
+
Object.keys(save).length !== 2 ||
|
|
1162
|
+
!/^buffer[0-9]+$/u.test(save.bufferName) ||
|
|
1163
|
+
typeof save.path !== "string" ||
|
|
1164
|
+
save.path.length < 1 ||
|
|
1165
|
+
save.path.length > 4_096 ||
|
|
1166
|
+
[...save.path].some((character) => {
|
|
1167
|
+
const code = character.codePointAt(0);
|
|
1168
|
+
return code < 0x20 || code === 0x7f;
|
|
1169
|
+
})))
|
|
1170
|
+
) {
|
|
1171
|
+
throw new Error("Clipboard inventory transaction input is malformed");
|
|
1172
|
+
}
|
|
1173
|
+
return [
|
|
1174
|
+
...(save ? ["save-buffer", "-b", save.bufferName, save.path, ";"] : []),
|
|
1175
|
+
"display-message",
|
|
1176
|
+
"-p",
|
|
1177
|
+
CLIPBOARD_LIMIT_MARKER,
|
|
1178
|
+
";",
|
|
1179
|
+
"show-options",
|
|
1180
|
+
"-gv",
|
|
1181
|
+
"buffer-limit",
|
|
1182
|
+
";",
|
|
1183
|
+
"display-message",
|
|
1184
|
+
"-p",
|
|
1185
|
+
CLIPBOARD_BUFFERS_MARKER,
|
|
1186
|
+
";",
|
|
1187
|
+
"list-buffers",
|
|
1188
|
+
"-F",
|
|
1189
|
+
"#{buffer_name}\t#{buffer_size}\t#{buffer_created}",
|
|
1190
|
+
";",
|
|
1191
|
+
"display-message",
|
|
1192
|
+
"-p",
|
|
1193
|
+
CLIPBOARD_INVENTORY_END_MARKER,
|
|
1194
|
+
];
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
function parseClipboardInventoryTransactionOutput({ output, noBuffers }) {
|
|
1198
|
+
if (typeof output !== "string" || Buffer.byteLength(output, "utf8") > 256 * 1_024) {
|
|
1199
|
+
throw new Error("Clipboard inventory transaction exceeded its output cap");
|
|
1200
|
+
}
|
|
1201
|
+
const lines = output.replace(/\n$/u, "").split("\n");
|
|
1202
|
+
const limitAt = lines.indexOf(CLIPBOARD_LIMIT_MARKER);
|
|
1203
|
+
const buffersAt = lines.indexOf(CLIPBOARD_BUFFERS_MARKER);
|
|
1204
|
+
const endAt = lines.indexOf(CLIPBOARD_INVENTORY_END_MARKER);
|
|
1205
|
+
if (
|
|
1206
|
+
limitAt !== 0 ||
|
|
1207
|
+
buffersAt !== 2 ||
|
|
1208
|
+
(!noBuffers &&
|
|
1209
|
+
(endAt < 3 ||
|
|
1210
|
+
endAt !== lines.length - 1 ||
|
|
1211
|
+
lines.lastIndexOf(CLIPBOARD_INVENTORY_END_MARKER) !== endAt)) ||
|
|
1212
|
+
(noBuffers && (endAt >= 0 || lines.length !== 3))
|
|
1213
|
+
) {
|
|
1214
|
+
throw new Error("Clipboard inventory transaction output is malformed");
|
|
1215
|
+
}
|
|
1216
|
+
const bufferLimit = Number(lines[1]);
|
|
1217
|
+
const source = noBuffers ? "" : lines.slice(3, endAt).join("\n");
|
|
1218
|
+
return Object.freeze({
|
|
1219
|
+
source,
|
|
1220
|
+
inventory: parseClipboardAutoBufferInventory(source, bufferLimit),
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
export function readClipboardAutoBufferInventoryTransaction({ runTmux, timeoutMs, save = null }) {
|
|
1225
|
+
const commands = clipboardInventoryTransactionCommands({ runTmux, timeoutMs, save });
|
|
1226
|
+
let output;
|
|
1227
|
+
let noBuffers = false;
|
|
1228
|
+
try {
|
|
1229
|
+
output = runTmux(commands, { timeout: timeoutMs });
|
|
1230
|
+
} catch (error) {
|
|
1231
|
+
if (!save && /no buffers/iu.test(String(error?.stderr ?? error?.message ?? ""))) {
|
|
1232
|
+
output = String(error?.stdout ?? "");
|
|
1233
|
+
noBuffers = true;
|
|
1234
|
+
} else {
|
|
1235
|
+
throw error;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return parseClipboardInventoryTransactionOutput({ output, noBuffers });
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
export async function readClipboardAutoBufferInventoryTransactionAsync({
|
|
1242
|
+
runTmux,
|
|
1243
|
+
timeoutMs,
|
|
1244
|
+
save = null,
|
|
1245
|
+
signal,
|
|
1246
|
+
}) {
|
|
1247
|
+
const commands = clipboardInventoryTransactionCommands({ runTmux, timeoutMs, save });
|
|
1248
|
+
let output;
|
|
1249
|
+
let noBuffers = false;
|
|
1250
|
+
try {
|
|
1251
|
+
output = await runTmux(commands, { timeout: timeoutMs, signal });
|
|
1252
|
+
} catch (error) {
|
|
1253
|
+
if (!save && /no buffers/iu.test(String(error?.stderr ?? error?.message ?? ""))) {
|
|
1254
|
+
output = String(error?.stdout ?? "");
|
|
1255
|
+
noBuffers = true;
|
|
1256
|
+
} else {
|
|
1257
|
+
throw error;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
return parseClipboardInventoryTransactionOutput({ output, noBuffers });
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
export function assessClipboardAutoBufferDelta(baseline, current) {
|
|
1264
|
+
if (
|
|
1265
|
+
baseline?.bufferLimit !== current?.bufferLimit ||
|
|
1266
|
+
!Array.isArray(baseline?.buffers) ||
|
|
1267
|
+
!Array.isArray(current?.buffers)
|
|
1268
|
+
) {
|
|
1269
|
+
throw new Error("Clipboard inventory lease does not match current buffer-limit");
|
|
1270
|
+
}
|
|
1271
|
+
const before = new Map(baseline.buffers.map((entry) => [entry.name, entry]));
|
|
1272
|
+
const after = new Map(current.buffers.map((entry) => [entry.name, entry]));
|
|
1273
|
+
const added = current.buffers.filter((entry) => !before.has(entry.name));
|
|
1274
|
+
const removed = baseline.buffers.filter((entry) => !after.has(entry.name));
|
|
1275
|
+
const retainedChanged = baseline.buffers.some((entry) => {
|
|
1276
|
+
const next = after.get(entry.name);
|
|
1277
|
+
return next && (next.size !== entry.size || next.created !== entry.created);
|
|
1278
|
+
});
|
|
1279
|
+
if (!retainedChanged && added.length === 0 && removed.length === 0) {
|
|
1280
|
+
return Object.freeze({ status: "pending" });
|
|
1281
|
+
}
|
|
1282
|
+
const atLimit = baseline.buffers.length === baseline.bufferLimit;
|
|
1283
|
+
const exactRotation =
|
|
1284
|
+
atLimit &&
|
|
1285
|
+
removed.length === 1 &&
|
|
1286
|
+
removed[0].name === baseline.oldestAutoName &&
|
|
1287
|
+
current.buffers.length === baseline.buffers.length;
|
|
1288
|
+
const exactAppend =
|
|
1289
|
+
!atLimit && removed.length === 0 && current.buffers.length === baseline.buffers.length + 1;
|
|
1290
|
+
if (
|
|
1291
|
+
retainedChanged ||
|
|
1292
|
+
added.length !== 1 ||
|
|
1293
|
+
(!exactAppend && !exactRotation) ||
|
|
1294
|
+
added[0].size < 1
|
|
1295
|
+
) {
|
|
1296
|
+
throw new Error("Clipboard automatic buffer inventory changed ambiguously");
|
|
1297
|
+
}
|
|
1298
|
+
return Object.freeze({ status: "captured", buffer: added[0] });
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function shellQuote(value) {
|
|
1302
|
+
return `'${String(value).replaceAll("'", `'\\''`)}'`;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
export function buildClipboardPaneHookCommand({
|
|
1306
|
+
nodePath,
|
|
1307
|
+
scriptPath,
|
|
1308
|
+
runtimeDir,
|
|
1309
|
+
socketPath,
|
|
1310
|
+
nonce,
|
|
1311
|
+
paneId,
|
|
1312
|
+
}) {
|
|
1313
|
+
const observer = [
|
|
1314
|
+
"env",
|
|
1315
|
+
...(socketPath ? [`TMUX_IDE_TESTDRIVE_HOST_SOCKET_PATH=${shellQuote(socketPath)}`] : []),
|
|
1316
|
+
`TMUX_IDE_TESTDRIVE_RUNTIME_DIR=${shellQuote(runtimeDir)}`,
|
|
1317
|
+
shellQuote(nodePath),
|
|
1318
|
+
shellQuote(scriptPath),
|
|
1319
|
+
"clipboard-observe",
|
|
1320
|
+
shellQuote(nonce),
|
|
1321
|
+
shellQuote(paneId),
|
|
1322
|
+
// set-hook is called through direct argv, so this format is stored and is
|
|
1323
|
+
// expanded only when the pane hook runs. Doubling is required only when a
|
|
1324
|
+
// surrounding tmux command/config parse would otherwise consume it.
|
|
1325
|
+
"#{q:hook_pane}",
|
|
1326
|
+
].join(" ");
|
|
1327
|
+
// JSON string escaping is also valid tmux double-quoted command syntax for
|
|
1328
|
+
// this bounded ASCII command. tmux's `show-hooks` retains this canonical
|
|
1329
|
+
// representation, which lets the owner verify exact command identity.
|
|
1330
|
+
return `run-shell ${JSON.stringify(observer)}`;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
export async function waitForClipboardObservation({
|
|
1334
|
+
listArtifacts,
|
|
1335
|
+
readEvent,
|
|
1336
|
+
expected,
|
|
1337
|
+
clock,
|
|
1338
|
+
sleep,
|
|
1339
|
+
timeoutMs,
|
|
1340
|
+
quietMs = 40,
|
|
1341
|
+
}) {
|
|
1342
|
+
const deadline = clock.now() + timeoutMs;
|
|
1343
|
+
let firstCompleteAt = null;
|
|
1344
|
+
let retained = null;
|
|
1345
|
+
const scan = () => {
|
|
1346
|
+
const artifactIds = [...new Set(listArtifacts())];
|
|
1347
|
+
if (artifactIds.length > 1) {
|
|
1348
|
+
throw new Error("Multiple clipboard events matched one test-drive operation");
|
|
1349
|
+
}
|
|
1350
|
+
if (artifactIds.length !== 1) return null;
|
|
1351
|
+
const event = readEvent(artifactIds[0]);
|
|
1352
|
+
if (!event) return null;
|
|
1353
|
+
if (event.bufferName !== artifactIds[0]) {
|
|
1354
|
+
throw new Error("Clipboard event buffer identity does not match its atomic artifact");
|
|
1355
|
+
}
|
|
1356
|
+
return Object.freeze({
|
|
1357
|
+
artifactId: artifactIds[0],
|
|
1358
|
+
clipboard: Object.freeze(validateClipboardObservationEvents([event], expected)),
|
|
1359
|
+
});
|
|
1360
|
+
};
|
|
1361
|
+
while (clock.now() < deadline) {
|
|
1362
|
+
const validated = scan();
|
|
1363
|
+
if (validated) {
|
|
1364
|
+
retained ??= validated;
|
|
1365
|
+
firstCompleteAt ??= clock.now();
|
|
1366
|
+
if (clock.now() - firstCompleteAt >= quietMs) return retained;
|
|
1367
|
+
}
|
|
1368
|
+
const remaining = deadline - clock.now();
|
|
1369
|
+
if (remaining <= 0) break;
|
|
1370
|
+
await sleep(Math.min(10, remaining));
|
|
1371
|
+
}
|
|
1372
|
+
// A callback may atomically publish while the final bounded sleep reaches
|
|
1373
|
+
// the deadline. Sample once more so the owned retirement phase can fence it.
|
|
1374
|
+
const edge = scan();
|
|
1375
|
+
if (edge && quietMs === 0) return retained ?? edge;
|
|
1376
|
+
throw clipboardObservationTimeoutError();
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
export async function settleClipboardObservationAfterRetirement({
|
|
1380
|
+
listArtifacts,
|
|
1381
|
+
readCallbackEvidence,
|
|
1382
|
+
retainedBufferName,
|
|
1383
|
+
clock,
|
|
1384
|
+
sleep,
|
|
1385
|
+
timeoutMs,
|
|
1386
|
+
quietMs = 40,
|
|
1387
|
+
}) {
|
|
1388
|
+
const startedAt = clock.now();
|
|
1389
|
+
const deadline = startedAt + timeoutMs;
|
|
1390
|
+
const exact = (final = false) => {
|
|
1391
|
+
const artifacts = [...new Set(listArtifacts())];
|
|
1392
|
+
const callback = readCallbackEvidence();
|
|
1393
|
+
const callbackPublished =
|
|
1394
|
+
callback?.callbackInvocations === 1 &&
|
|
1395
|
+
callback.callbackStage === "artifact-published" &&
|
|
1396
|
+
callback.callbackOutcome === "published" &&
|
|
1397
|
+
Number.isSafeInteger(callback.callbackInventoryPolls) &&
|
|
1398
|
+
callback.callbackInventoryPolls >= 1 &&
|
|
1399
|
+
callback.callbackInventoryPolls <= 2_048;
|
|
1400
|
+
const callbackImpossible =
|
|
1401
|
+
callback?.callbackInvocations > 1 || callback?.callbackOutcome === "error";
|
|
1402
|
+
if (
|
|
1403
|
+
artifacts.length !== 1 ||
|
|
1404
|
+
artifacts[0] !== retainedBufferName ||
|
|
1405
|
+
callbackImpossible ||
|
|
1406
|
+
(final && !callbackPublished)
|
|
1407
|
+
) {
|
|
1408
|
+
throw new Error("Clipboard observation changed during post-retirement settlement");
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
exact();
|
|
1412
|
+
while (clock.now() - startedAt < quietMs) {
|
|
1413
|
+
const remaining = deadline - clock.now();
|
|
1414
|
+
if (remaining < 1) throw new Error("Clipboard duplicate settlement exceeded its deadline");
|
|
1415
|
+
await sleep(Math.min(10, quietMs - (clock.now() - startedAt), remaining));
|
|
1416
|
+
exact();
|
|
1417
|
+
}
|
|
1418
|
+
exact(true);
|
|
1419
|
+
return Math.min(MAX_INPUT_TIMEOUT_MS, Math.max(0, Math.round(clock.now() - startedAt)));
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
export async function executeTestdriveInputOperation(command, port) {
|
|
1423
|
+
const startedAt = port.clock.now();
|
|
1424
|
+
const deadline = startedAt + command.timeoutMs;
|
|
1425
|
+
const clipboardOperation = command.kind === "selection-drag" || command.kind === "copy-capture";
|
|
1426
|
+
const cleanupReserveMs = clipboardOperation
|
|
1427
|
+
? Math.min(CLIPBOARD_RETIREMENT_RESERVE_MS, Math.max(10, Math.floor(command.timeoutMs / 4)))
|
|
1428
|
+
: Math.min(100, Math.max(10, Math.floor(command.timeoutMs / 4)));
|
|
1429
|
+
const workRemaining = () => {
|
|
1430
|
+
const value = Math.floor(deadline - port.clock.now() - cleanupReserveMs);
|
|
1431
|
+
if (value < 1) throw new Error(`Test-drive ${command.kind} exceeded its absolute deadline`);
|
|
1432
|
+
return value;
|
|
1433
|
+
};
|
|
1434
|
+
const postInputIdentityReserveMs = clipboardOperation
|
|
1435
|
+
? Math.min(POST_INPUT_IDENTITY_RESERVE_MS, Math.max(10, Math.floor(command.timeoutMs / 10)))
|
|
1436
|
+
: 0;
|
|
1437
|
+
let postInputIdentityPending = clipboardOperation;
|
|
1438
|
+
const clipboardObservationReserveMs = clipboardOperation
|
|
1439
|
+
? Math.min(CLIPBOARD_OBSERVATION_RESERVE_MS, Math.max(40, Math.floor(command.timeoutMs / 6)))
|
|
1440
|
+
: 0;
|
|
1441
|
+
let clipboardObservationPending = clipboardOperation;
|
|
1442
|
+
const deliveryRemaining = () => {
|
|
1443
|
+
const pendingFinalizationReserve = Math.max(
|
|
1444
|
+
postInputIdentityPending ? postInputIdentityReserveMs : 0,
|
|
1445
|
+
clipboardObservationPending ? clipboardObservationReserveMs : 0,
|
|
1446
|
+
);
|
|
1447
|
+
const value = workRemaining() - pendingFinalizationReserve;
|
|
1448
|
+
if (value < 1) throw new Error(`Test-drive ${command.kind} exceeded its pre-identity deadline`);
|
|
1449
|
+
return value;
|
|
1450
|
+
};
|
|
1451
|
+
const cleanupRemaining = () => Math.max(1, Math.floor(deadline - port.clock.now()));
|
|
1452
|
+
let observation = null;
|
|
1453
|
+
let identity = null;
|
|
1454
|
+
let bytesInjected = 0;
|
|
1455
|
+
let phases = 0;
|
|
1456
|
+
let transportCalls = 0;
|
|
1457
|
+
let physicalTransportCalls = 0;
|
|
1458
|
+
let totalPhases = null;
|
|
1459
|
+
let totalTransportCalls = null;
|
|
1460
|
+
let failureSubstage = "resolve-identity";
|
|
1461
|
+
let selectionStyle = null;
|
|
1462
|
+
let clipboard = null;
|
|
1463
|
+
let operationFailure = null;
|
|
1464
|
+
let clipboardArmElapsedMs = null;
|
|
1465
|
+
let clipboardArmStartedElapsedMs = null;
|
|
1466
|
+
let clipboardArmBudgetAtStartMs = null;
|
|
1467
|
+
let clipboardArmRawRemainingAtStartMs = null;
|
|
1468
|
+
let clipboardReleaseElapsedMs = null;
|
|
1469
|
+
let clipboardWaitStartedElapsedMs = null;
|
|
1470
|
+
let clipboardReleaseBudgetAtStartMs = null;
|
|
1471
|
+
let clipboardReleaseIdentityElapsedMs = null;
|
|
1472
|
+
let clipboardReleaseTransportAttempted = false;
|
|
1473
|
+
let clipboardReleaseEffectOccurred = false;
|
|
1474
|
+
let clipboardReleaseLoadMarkerAcquired = false;
|
|
1475
|
+
let clipboardReleaseCleanupAttempted = false;
|
|
1476
|
+
const exactClipboardResult = (value) =>
|
|
1477
|
+
value !== null &&
|
|
1478
|
+
typeof value === "object" &&
|
|
1479
|
+
Number.isSafeInteger(value.bytes) &&
|
|
1480
|
+
value.bytes > 0 &&
|
|
1481
|
+
value.bytes <= MAX_CLIPBOARD_BYTES &&
|
|
1482
|
+
typeof value.sha256 === "string" &&
|
|
1483
|
+
/^[a-f0-9]{64}$/u.test(value.sha256);
|
|
1484
|
+
const inject = async (bytes, logicalPhases = 1) => {
|
|
1485
|
+
const outcome = await port.inject(identity, bytes, deliveryRemaining());
|
|
1486
|
+
bytesInjected += Buffer.byteLength(bytes, "utf8");
|
|
1487
|
+
phases += logicalPhases;
|
|
1488
|
+
transportCalls += 1;
|
|
1489
|
+
physicalTransportCalls +=
|
|
1490
|
+
Number.isSafeInteger(outcome?.physicalCalls) && outcome.physicalCalls === 1
|
|
1491
|
+
? outcome.physicalCalls
|
|
1492
|
+
: 1;
|
|
1493
|
+
};
|
|
1494
|
+
const pause = async (milliseconds) => {
|
|
1495
|
+
if (milliseconds <= 0) return;
|
|
1496
|
+
if (milliseconds > deliveryRemaining()) {
|
|
1497
|
+
throw new Error(`Test-drive ${command.kind} delay exceeds its absolute deadline`);
|
|
1498
|
+
}
|
|
1499
|
+
await port.sleep(milliseconds);
|
|
1500
|
+
};
|
|
1501
|
+
const finalizationReserveMs = clipboardOperation
|
|
1502
|
+
? Math.max(postInputIdentityReserveMs, clipboardObservationReserveMs)
|
|
1503
|
+
: 0;
|
|
1504
|
+
const clipboardReleaseBudgetMs = Math.min(
|
|
1505
|
+
CLIPBOARD_RELEASE_BUDGET_MS,
|
|
1506
|
+
Math.max(20, Math.floor(command.timeoutMs / 15)),
|
|
1507
|
+
);
|
|
1508
|
+
const rawRemaining = () => Math.max(0, Math.floor(deadline - port.clock.now()));
|
|
1509
|
+
const armClipboardWithinBudget = async () => {
|
|
1510
|
+
failureSubstage = "pre-release-budget";
|
|
1511
|
+
const fixedReserveMs = cleanupReserveMs + finalizationReserveMs + clipboardReleaseBudgetMs;
|
|
1512
|
+
const rawRemainingAtStartMs = rawRemaining();
|
|
1513
|
+
const availableArmMs = rawRemainingAtStartMs - fixedReserveMs;
|
|
1514
|
+
if (availableArmMs < 90) {
|
|
1515
|
+
throw new Error(`Test-drive ${command.kind} exceeded its pre-release budget`);
|
|
1516
|
+
}
|
|
1517
|
+
const clipboardArmBudgetMs = Math.min(CLIPBOARD_ARM_BUDGET_MS, availableArmMs);
|
|
1518
|
+
clipboardArmBudgetAtStartMs = clipboardArmBudgetMs;
|
|
1519
|
+
clipboardArmRawRemainingAtStartMs = rawRemainingAtStartMs;
|
|
1520
|
+
failureSubstage = "clipboard-arm";
|
|
1521
|
+
clipboardArmStartedElapsedMs = Math.min(
|
|
1522
|
+
MAX_INPUT_TIMEOUT_MS,
|
|
1523
|
+
Math.max(0, Math.round(port.clock.now() - startedAt)),
|
|
1524
|
+
);
|
|
1525
|
+
const armStartedAt = port.clock.now();
|
|
1526
|
+
observation = await port.armClipboard(
|
|
1527
|
+
identity,
|
|
1528
|
+
port.nonce(),
|
|
1529
|
+
clipboardArmBudgetMs,
|
|
1530
|
+
cleanupReserveMs,
|
|
1531
|
+
);
|
|
1532
|
+
clipboardArmElapsedMs = Math.min(
|
|
1533
|
+
MAX_INPUT_TIMEOUT_MS,
|
|
1534
|
+
Math.max(0, Math.round(port.clock.now() - startedAt)),
|
|
1535
|
+
);
|
|
1536
|
+
if (
|
|
1537
|
+
port.clock.now() - armStartedAt > clipboardArmBudgetMs ||
|
|
1538
|
+
rawRemaining() < cleanupReserveMs + finalizationReserveMs + clipboardReleaseBudgetMs
|
|
1539
|
+
) {
|
|
1540
|
+
throw new Error(`Test-drive ${command.kind} clipboard arm exceeded its bounded slice`);
|
|
1541
|
+
}
|
|
1542
|
+
};
|
|
1543
|
+
const releaseClipboardInput = async (bytes, logicalPhases = 1) => {
|
|
1544
|
+
const available = rawRemaining() - cleanupReserveMs - finalizationReserveMs;
|
|
1545
|
+
if (available < clipboardReleaseBudgetMs) {
|
|
1546
|
+
throw new Error(`Test-drive ${command.kind} exceeded its release budget`);
|
|
1547
|
+
}
|
|
1548
|
+
clipboardReleaseBudgetAtStartMs = clipboardReleaseBudgetMs;
|
|
1549
|
+
const releaseStartedAt = port.clock.now();
|
|
1550
|
+
const releaseDeadline = releaseStartedAt + clipboardReleaseBudgetMs;
|
|
1551
|
+
const releaseRemaining = () => {
|
|
1552
|
+
const value = Math.floor(releaseDeadline - port.clock.now());
|
|
1553
|
+
if (value < 1) throw new Error(`Test-drive ${command.kind} exceeded its release budget`);
|
|
1554
|
+
return value;
|
|
1555
|
+
};
|
|
1556
|
+
failureSubstage = "release-identity";
|
|
1557
|
+
const identityStartedAt = port.clock.now();
|
|
1558
|
+
await port.verifyIdentity(identity, releaseRemaining());
|
|
1559
|
+
clipboardReleaseIdentityElapsedMs = Math.min(
|
|
1560
|
+
clipboardReleaseBudgetMs,
|
|
1561
|
+
Math.max(0, Math.round(port.clock.now() - identityStartedAt)),
|
|
1562
|
+
);
|
|
1563
|
+
failureSubstage = command.kind === "selection-drag" ? "selection-release" : "input-delivery";
|
|
1564
|
+
clipboardReleaseTransportAttempted = true;
|
|
1565
|
+
let outcome;
|
|
1566
|
+
try {
|
|
1567
|
+
outcome = await port.inject(identity, bytes, releaseRemaining());
|
|
1568
|
+
} catch (error) {
|
|
1569
|
+
clipboardReleaseEffectOccurred =
|
|
1570
|
+
error?.deliveryEvidence?.effectOccurred === false &&
|
|
1571
|
+
error?.deliveryEvidence?.loadMarkerAcquired === false
|
|
1572
|
+
? false
|
|
1573
|
+
: null;
|
|
1574
|
+
clipboardReleaseLoadMarkerAcquired = error?.deliveryEvidence?.loadMarkerAcquired === true;
|
|
1575
|
+
clipboardReleaseCleanupAttempted = error?.deliveryEvidence?.cleanupAttempted === true;
|
|
1576
|
+
throw error;
|
|
1577
|
+
}
|
|
1578
|
+
clipboardReleaseEffectOccurred =
|
|
1579
|
+
outcome?.physicalCalls === 1 &&
|
|
1580
|
+
outcome?.transportAttempted === true &&
|
|
1581
|
+
outcome?.effectOccurred === true &&
|
|
1582
|
+
outcome?.loadMarkerAcquired === true &&
|
|
1583
|
+
outcome?.cleanupAttempted === false
|
|
1584
|
+
? true
|
|
1585
|
+
: null;
|
|
1586
|
+
clipboardReleaseLoadMarkerAcquired = outcome?.loadMarkerAcquired === true;
|
|
1587
|
+
clipboardReleaseCleanupAttempted = outcome?.cleanupAttempted === true;
|
|
1588
|
+
if (
|
|
1589
|
+
port.clock.now() - releaseStartedAt > clipboardReleaseBudgetMs ||
|
|
1590
|
+
rawRemaining() < cleanupReserveMs + finalizationReserveMs ||
|
|
1591
|
+
outcome?.physicalCalls !== 1 ||
|
|
1592
|
+
!clipboardReleaseEffectOccurred ||
|
|
1593
|
+
!clipboardReleaseLoadMarkerAcquired ||
|
|
1594
|
+
clipboardReleaseCleanupAttempted
|
|
1595
|
+
) {
|
|
1596
|
+
throw new Error(`Test-drive ${command.kind} release proof exceeded its bounded slice`);
|
|
1597
|
+
}
|
|
1598
|
+
bytesInjected += Buffer.byteLength(bytes, "utf8");
|
|
1599
|
+
phases += logicalPhases;
|
|
1600
|
+
transportCalls += 1;
|
|
1601
|
+
physicalTransportCalls += 1;
|
|
1602
|
+
};
|
|
1603
|
+
try {
|
|
1604
|
+
identity = await port.resolveIdentity(deliveryRemaining());
|
|
1605
|
+
failureSubstage = "preflight-identity";
|
|
1606
|
+
await port.verifyIdentity(identity, deliveryRemaining());
|
|
1607
|
+
failureSubstage = "capabilities";
|
|
1608
|
+
const capabilities = await port.capabilities(identity, deliveryRemaining());
|
|
1609
|
+
const translated = translateTestdriveInput(command, {
|
|
1610
|
+
capabilities,
|
|
1611
|
+
geometry: { cols: identity.cols, rows: identity.rows },
|
|
1612
|
+
});
|
|
1613
|
+
totalPhases = translated.phases.length;
|
|
1614
|
+
totalTransportCalls = translated.phases.length;
|
|
1615
|
+
|
|
1616
|
+
if (command.kind === "selection-drag") {
|
|
1617
|
+
totalPhases += 3;
|
|
1618
|
+
totalTransportCalls = 5;
|
|
1619
|
+
// Explicitly enter the product's pane-local select mode through its real
|
|
1620
|
+
// context menu, then require its rendered badge/note before dragging.
|
|
1621
|
+
for (const phase of [
|
|
1622
|
+
{ bytes: mouseSequence("down", command.from.x, command.from.y, "right"), delayMs: 12 },
|
|
1623
|
+
{ bytes: mouseSequence("up", command.from.x, command.from.y, "right"), delayMs: 12 },
|
|
1624
|
+
{ bytes: "\r", delayMs: 0 },
|
|
1625
|
+
]) {
|
|
1626
|
+
failureSubstage = "select-mode-identity";
|
|
1627
|
+
await port.verifyIdentity(identity, deliveryRemaining());
|
|
1628
|
+
failureSubstage = "enter-select-mode";
|
|
1629
|
+
await inject(phase.bytes);
|
|
1630
|
+
await pause(phase.delayMs);
|
|
1631
|
+
}
|
|
1632
|
+
failureSubstage = "wait-select-mode";
|
|
1633
|
+
await port.waitForFrame(
|
|
1634
|
+
identity,
|
|
1635
|
+
(frame) => frame.includes("select text: drag to copy") || frame.includes("⧉ select"),
|
|
1636
|
+
deliveryRemaining(),
|
|
1637
|
+
);
|
|
1638
|
+
failureSubstage = "capture-before-selection";
|
|
1639
|
+
await port.verifyIdentity(identity, deliveryRemaining());
|
|
1640
|
+
const before = await port.captureAnsi(identity, deliveryRemaining());
|
|
1641
|
+
const selectionPhases = translated.phases;
|
|
1642
|
+
const preRelease = selectionPhases.slice(0, -1);
|
|
1643
|
+
// One immutable PTY transaction preserves every logical SGR event and
|
|
1644
|
+
// their order while keeping host transport cost independent of distance.
|
|
1645
|
+
failureSubstage = "drag-pre-release-identity";
|
|
1646
|
+
await port.verifyIdentity(identity, deliveryRemaining());
|
|
1647
|
+
failureSubstage = "drag-pre-release";
|
|
1648
|
+
await inject(preRelease.map(({ bytes }) => bytes).join(""), preRelease.length);
|
|
1649
|
+
failureSubstage = "selection-style-wait";
|
|
1650
|
+
for (;;) {
|
|
1651
|
+
await port.verifyIdentity(identity, deliveryRemaining());
|
|
1652
|
+
const selected = await port.captureAnsi(identity, deliveryRemaining());
|
|
1653
|
+
await port.verifyIdentity(identity, deliveryRemaining());
|
|
1654
|
+
try {
|
|
1655
|
+
selectionStyle = {
|
|
1656
|
+
...proveRendererSelectionStyleDelta(
|
|
1657
|
+
before,
|
|
1658
|
+
selected,
|
|
1659
|
+
command.from,
|
|
1660
|
+
command.to,
|
|
1661
|
+
{
|
|
1662
|
+
cols: identity.cols,
|
|
1663
|
+
rows: identity.rows,
|
|
1664
|
+
},
|
|
1665
|
+
command.contentRect,
|
|
1666
|
+
),
|
|
1667
|
+
frameDigest: createHash("sha256").update(selected).digest("hex"),
|
|
1668
|
+
};
|
|
1669
|
+
break;
|
|
1670
|
+
} catch {
|
|
1671
|
+
await pause(Math.min(10, deliveryRemaining()));
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
// Do not arm or release unless both bounded mutations and the concurrent
|
|
1675
|
+
// post-release proof fit alongside cleanup.
|
|
1676
|
+
await armClipboardWithinBudget();
|
|
1677
|
+
await releaseClipboardInput(selectionPhases.at(-1).bytes);
|
|
1678
|
+
} else {
|
|
1679
|
+
failureSubstage = translated.captureClipboard ? "clipboard-arm" : "input-delivery";
|
|
1680
|
+
if (translated.captureClipboard) await armClipboardWithinBudget();
|
|
1681
|
+
for (const phase of translated.phases) {
|
|
1682
|
+
if (translated.captureClipboard) await releaseClipboardInput(phase.bytes);
|
|
1683
|
+
else await inject(phase.bytes);
|
|
1684
|
+
await pause(phase.delayMs);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
let clipboardWaitFailure = null;
|
|
1689
|
+
let clipboardIdentityFailure = null;
|
|
1690
|
+
if (clipboardOperation) {
|
|
1691
|
+
// Start observing immediately after the input effect. Identity proof and
|
|
1692
|
+
// callback publication are independent prerequisites and run together;
|
|
1693
|
+
// neither can consume the other's pre-release reserve.
|
|
1694
|
+
clipboardObservationPending = false;
|
|
1695
|
+
failureSubstage = "clipboard-wait";
|
|
1696
|
+
clipboardReleaseElapsedMs = Math.min(
|
|
1697
|
+
MAX_INPUT_TIMEOUT_MS,
|
|
1698
|
+
Math.max(0, Math.round(port.clock.now() - startedAt)),
|
|
1699
|
+
);
|
|
1700
|
+
clipboardWaitStartedElapsedMs = clipboardReleaseElapsedMs;
|
|
1701
|
+
const waitTimeout = workRemaining();
|
|
1702
|
+
const identityTimeout = Math.min(postInputIdentityReserveMs, workRemaining());
|
|
1703
|
+
const waitPromise = observation?.wait(waitTimeout) ?? Promise.resolve(null);
|
|
1704
|
+
const identityPromise = port.verifyIdentity(identity, identityTimeout);
|
|
1705
|
+
const [waitResult, identityResult] = await Promise.allSettled([waitPromise, identityPromise]);
|
|
1706
|
+
postInputIdentityPending = false;
|
|
1707
|
+
if (waitResult.status === "fulfilled") clipboard = waitResult.value;
|
|
1708
|
+
else clipboardWaitFailure = waitResult.reason;
|
|
1709
|
+
if (identityResult.status === "rejected") {
|
|
1710
|
+
clipboardIdentityFailure = identityResult.reason;
|
|
1711
|
+
}
|
|
1712
|
+
} else {
|
|
1713
|
+
failureSubstage = "postflight-identity";
|
|
1714
|
+
await port.verifyIdentity(identity, workRemaining());
|
|
1715
|
+
}
|
|
1716
|
+
let clipboardObservation = null;
|
|
1717
|
+
if (observation) {
|
|
1718
|
+
failureSubstage = "clipboard-retirement";
|
|
1719
|
+
const terminalClipboard = await observation.dispose(cleanupRemaining());
|
|
1720
|
+
if (!clipboard && exactClipboardResult(terminalClipboard)) clipboard = terminalClipboard;
|
|
1721
|
+
const settledObservation = observation.evidence?.() ?? {};
|
|
1722
|
+
clipboardObservation = Object.freeze({
|
|
1723
|
+
...settledObservation,
|
|
1724
|
+
callbackHookElapsedMs: settledObservation.callbackHookElapsedMs ?? null,
|
|
1725
|
+
callbackHookEntryLagMs: settledObservation.callbackHookEntryLagMs ?? null,
|
|
1726
|
+
callbackInventorySeenElapsedMs: settledObservation.callbackInventorySeenElapsedMs ?? null,
|
|
1727
|
+
callbackArtifactPublishedElapsedMs:
|
|
1728
|
+
settledObservation.callbackArtifactPublishedElapsedMs ?? null,
|
|
1729
|
+
callbackPreSaveElapsedMs: settledObservation.callbackPreSaveElapsedMs ?? null,
|
|
1730
|
+
callbackSaveElapsedMs: settledObservation.callbackSaveElapsedMs ?? null,
|
|
1731
|
+
callbackSaveOutcome: settledObservation.callbackSaveOutcome ?? "not-started",
|
|
1732
|
+
callbackRetirementStage: settledObservation.callbackRetirementStage ?? "not-started",
|
|
1733
|
+
callbackRetirementElapsedMs: settledObservation.callbackRetirementElapsedMs ?? 0,
|
|
1734
|
+
callbackWorkSettled: settledObservation.callbackWorkSettled === true,
|
|
1735
|
+
callbackLeaseInactive: settledObservation.callbackLeaseInactive === true,
|
|
1736
|
+
artifactObservedElapsedMs: settledObservation.artifactObservedElapsedMs ?? null,
|
|
1737
|
+
duplicateSettleElapsedMs: settledObservation.duplicateSettleElapsedMs ?? null,
|
|
1738
|
+
callbackLastScanElapsedMs: settledObservation.callbackLastScanElapsedMs ?? null,
|
|
1739
|
+
clipboardArmElapsedMs,
|
|
1740
|
+
clipboardArmStartedElapsedMs,
|
|
1741
|
+
clipboardArmBudgetAtStartMs,
|
|
1742
|
+
clipboardArmRawRemainingAtStartMs,
|
|
1743
|
+
clipboardReleaseElapsedMs,
|
|
1744
|
+
clipboardWaitStartedElapsedMs,
|
|
1745
|
+
clipboardReleaseBudgetAtStartMs,
|
|
1746
|
+
clipboardReleaseIdentityElapsedMs,
|
|
1747
|
+
clipboardReleaseTransportAttempted,
|
|
1748
|
+
clipboardReleaseEffectOccurred,
|
|
1749
|
+
clipboardReleaseLoadMarkerAcquired,
|
|
1750
|
+
clipboardReleaseCleanupAttempted,
|
|
1751
|
+
priorCopyCount: clipboard?.priorCopyCount ?? null,
|
|
1752
|
+
newCopyCount: clipboard?.newCopyCount ?? null,
|
|
1753
|
+
identityExact: clipboard?.identityExact === true,
|
|
1754
|
+
});
|
|
1755
|
+
observation = null;
|
|
1756
|
+
}
|
|
1757
|
+
if (clipboardIdentityFailure) {
|
|
1758
|
+
failureSubstage = "post-input-identity";
|
|
1759
|
+
throw clipboardIdentityFailure;
|
|
1760
|
+
}
|
|
1761
|
+
if (
|
|
1762
|
+
clipboardWaitFailure &&
|
|
1763
|
+
(!clipboard || !isClipboardObservationTimeout(clipboardWaitFailure))
|
|
1764
|
+
) {
|
|
1765
|
+
failureSubstage = "clipboard-wait";
|
|
1766
|
+
throw clipboardWaitFailure;
|
|
1767
|
+
}
|
|
1768
|
+
return {
|
|
1769
|
+
version: 1,
|
|
1770
|
+
kind: command.kind,
|
|
1771
|
+
target: identity.paneId,
|
|
1772
|
+
paneId: identity.paneId,
|
|
1773
|
+
sessionId: identity.sessionId,
|
|
1774
|
+
geometry: { cols: identity.cols, rows: identity.rows },
|
|
1775
|
+
delivery: "exact-bytes-to-immutable-host-pane-pty",
|
|
1776
|
+
bytesInjected,
|
|
1777
|
+
phases,
|
|
1778
|
+
transportCalls,
|
|
1779
|
+
physicalTransportCalls,
|
|
1780
|
+
...(command.kind === "focus" ? { requestedState: command.state } : null),
|
|
1781
|
+
...(command.kind === "control-key" ? { requestedKey: command.key } : null),
|
|
1782
|
+
...(command.kind === "modified-key"
|
|
1783
|
+
? { requestedKey: command.key, requestedModifiers: command.modifiers }
|
|
1784
|
+
: null),
|
|
1785
|
+
...(command.kind === "application-mouse"
|
|
1786
|
+
? {
|
|
1787
|
+
requestedAction: command.action,
|
|
1788
|
+
requestedPoint: { x: command.x, y: command.y },
|
|
1789
|
+
requestedButton: command.button,
|
|
1790
|
+
requestedModifiers: command.modifiers,
|
|
1791
|
+
}
|
|
1792
|
+
: null),
|
|
1793
|
+
...(command.kind === "selection-drag"
|
|
1794
|
+
? {
|
|
1795
|
+
requestedSelection: {
|
|
1796
|
+
from: command.from,
|
|
1797
|
+
to: command.to,
|
|
1798
|
+
contentRect: command.contentRect,
|
|
1799
|
+
},
|
|
1800
|
+
}
|
|
1801
|
+
: null),
|
|
1802
|
+
elapsedMs: Number((port.clock.now() - startedAt).toFixed(2)),
|
|
1803
|
+
...(clipboard ? { clipboard: { bytes: clipboard.bytes, sha256: clipboard.sha256 } } : null),
|
|
1804
|
+
...(clipboardObservation ? { clipboardObservation } : null),
|
|
1805
|
+
...(selectionStyle ? { selectionStyle } : null),
|
|
1806
|
+
};
|
|
1807
|
+
} catch (error) {
|
|
1808
|
+
operationFailure = error;
|
|
1809
|
+
if (error && typeof error === "object" && !error.observation) {
|
|
1810
|
+
const emptyClipboardEvidence = clipboardOperation
|
|
1811
|
+
? {
|
|
1812
|
+
candidateAttempts: 0,
|
|
1813
|
+
occupiedCount: 0,
|
|
1814
|
+
retirementExact: false,
|
|
1815
|
+
retirementStage: "not-started",
|
|
1816
|
+
retirementElapsedMs: 0,
|
|
1817
|
+
finalOwnerAbsent: false,
|
|
1818
|
+
finalHookAbsent: false,
|
|
1819
|
+
callbackInvocations: 0,
|
|
1820
|
+
callbackStage: "not-invoked",
|
|
1821
|
+
callbackOutcome: "pending",
|
|
1822
|
+
callbackInventoryPolls: 0,
|
|
1823
|
+
callbackHookElapsedMs: null,
|
|
1824
|
+
callbackHookEntryLagMs: null,
|
|
1825
|
+
callbackInventorySeenElapsedMs: null,
|
|
1826
|
+
callbackArtifactPublishedElapsedMs: null,
|
|
1827
|
+
callbackPreSaveElapsedMs: null,
|
|
1828
|
+
callbackSaveElapsedMs: null,
|
|
1829
|
+
callbackSaveOutcome: "not-started",
|
|
1830
|
+
callbackRetirementStage: "not-started",
|
|
1831
|
+
callbackRetirementElapsedMs: 0,
|
|
1832
|
+
callbackWorkSettled: false,
|
|
1833
|
+
callbackLeaseInactive: false,
|
|
1834
|
+
artifactObservedElapsedMs: null,
|
|
1835
|
+
duplicateSettleElapsedMs: null,
|
|
1836
|
+
callbackLastScanElapsedMs: null,
|
|
1837
|
+
}
|
|
1838
|
+
: null;
|
|
1839
|
+
const clipboardLeaseEvidence =
|
|
1840
|
+
(observation?.evidence?.() ?? error.clipboardLeaseEvidence ?? emptyClipboardEvidence) ||
|
|
1841
|
+
null;
|
|
1842
|
+
error.observation = Object.freeze({
|
|
1843
|
+
operation: "tui-testdrive-input",
|
|
1844
|
+
kind: command.kind,
|
|
1845
|
+
substage: failureSubstage,
|
|
1846
|
+
completedPhases: Math.min(phases, 32),
|
|
1847
|
+
totalPhases:
|
|
1848
|
+
Number.isSafeInteger(totalPhases) && totalPhases >= 0 ? Math.min(totalPhases, 32) : null,
|
|
1849
|
+
completedTransportCalls: Math.min(transportCalls, 32),
|
|
1850
|
+
totalTransportCalls:
|
|
1851
|
+
Number.isSafeInteger(totalTransportCalls) && totalTransportCalls >= 0
|
|
1852
|
+
? Math.min(totalTransportCalls, 32)
|
|
1853
|
+
: null,
|
|
1854
|
+
completedPhysicalTransportCalls: Math.min(physicalTransportCalls, 32),
|
|
1855
|
+
totalPhysicalTransportCalls:
|
|
1856
|
+
Number.isSafeInteger(totalTransportCalls) && totalTransportCalls >= 0
|
|
1857
|
+
? Math.min(totalTransportCalls, 32)
|
|
1858
|
+
: null,
|
|
1859
|
+
cause:
|
|
1860
|
+
isClipboardObservationTimeout(error) ||
|
|
1861
|
+
error?.code === "ETIMEDOUT" ||
|
|
1862
|
+
/timed?\s*out|ETIMEDOUT/iu.test(error?.message ?? "")
|
|
1863
|
+
? "timeout"
|
|
1864
|
+
: /identity|geometry changed/iu.test(error?.message ?? "")
|
|
1865
|
+
? "identity-mismatch"
|
|
1866
|
+
: /deadline|budget/iu.test(error?.message ?? "")
|
|
1867
|
+
? "deadline"
|
|
1868
|
+
: "operation-error",
|
|
1869
|
+
elapsedMs: Math.min(
|
|
1870
|
+
MAX_INPUT_TIMEOUT_MS,
|
|
1871
|
+
Math.max(0, Math.floor(port.clock.now() - startedAt)),
|
|
1872
|
+
),
|
|
1873
|
+
remainingMs: Math.min(
|
|
1874
|
+
MAX_INPUT_TIMEOUT_MS,
|
|
1875
|
+
Math.max(0, Math.floor(deadline - port.clock.now())),
|
|
1876
|
+
),
|
|
1877
|
+
...(clipboardLeaseEvidence
|
|
1878
|
+
? {
|
|
1879
|
+
...clipboardLeaseEvidence,
|
|
1880
|
+
callbackInvocations: clipboardLeaseEvidence.callbackInvocations ?? 0,
|
|
1881
|
+
callbackStage: clipboardLeaseEvidence.callbackStage ?? "not-invoked",
|
|
1882
|
+
callbackOutcome: clipboardLeaseEvidence.callbackOutcome ?? "pending",
|
|
1883
|
+
callbackInventoryPolls: clipboardLeaseEvidence.callbackInventoryPolls ?? 0,
|
|
1884
|
+
callbackHookElapsedMs: clipboardLeaseEvidence.callbackHookElapsedMs ?? null,
|
|
1885
|
+
callbackHookEntryLagMs: clipboardLeaseEvidence.callbackHookEntryLagMs ?? null,
|
|
1886
|
+
callbackInventorySeenElapsedMs:
|
|
1887
|
+
clipboardLeaseEvidence.callbackInventorySeenElapsedMs ?? null,
|
|
1888
|
+
callbackArtifactPublishedElapsedMs:
|
|
1889
|
+
clipboardLeaseEvidence.callbackArtifactPublishedElapsedMs ?? null,
|
|
1890
|
+
callbackPreSaveElapsedMs: clipboardLeaseEvidence.callbackPreSaveElapsedMs ?? null,
|
|
1891
|
+
callbackSaveElapsedMs: clipboardLeaseEvidence.callbackSaveElapsedMs ?? null,
|
|
1892
|
+
callbackSaveOutcome: clipboardLeaseEvidence.callbackSaveOutcome ?? "not-started",
|
|
1893
|
+
callbackRetirementStage:
|
|
1894
|
+
clipboardLeaseEvidence.callbackRetirementStage ?? "not-started",
|
|
1895
|
+
callbackRetirementElapsedMs: clipboardLeaseEvidence.callbackRetirementElapsedMs ?? 0,
|
|
1896
|
+
callbackWorkSettled: clipboardLeaseEvidence.callbackWorkSettled === true,
|
|
1897
|
+
callbackLeaseInactive: clipboardLeaseEvidence.callbackLeaseInactive === true,
|
|
1898
|
+
artifactObservedElapsedMs: clipboardLeaseEvidence.artifactObservedElapsedMs ?? null,
|
|
1899
|
+
duplicateSettleElapsedMs: clipboardLeaseEvidence.duplicateSettleElapsedMs ?? null,
|
|
1900
|
+
callbackLastScanElapsedMs: clipboardLeaseEvidence.callbackLastScanElapsedMs ?? null,
|
|
1901
|
+
clipboardArmElapsedMs,
|
|
1902
|
+
clipboardArmStartedElapsedMs,
|
|
1903
|
+
clipboardArmBudgetAtStartMs,
|
|
1904
|
+
clipboardArmRawRemainingAtStartMs,
|
|
1905
|
+
clipboardReleaseElapsedMs,
|
|
1906
|
+
clipboardWaitStartedElapsedMs,
|
|
1907
|
+
clipboardReleaseBudgetAtStartMs,
|
|
1908
|
+
clipboardReleaseIdentityElapsedMs,
|
|
1909
|
+
clipboardReleaseTransportAttempted,
|
|
1910
|
+
clipboardReleaseEffectOccurred,
|
|
1911
|
+
clipboardReleaseLoadMarkerAcquired,
|
|
1912
|
+
clipboardReleaseCleanupAttempted,
|
|
1913
|
+
priorCopyCount: clipboard?.priorCopyCount ?? null,
|
|
1914
|
+
newCopyCount: clipboard?.newCopyCount ?? null,
|
|
1915
|
+
clipboardIdentityExact: clipboard?.identityExact === true,
|
|
1916
|
+
}
|
|
1917
|
+
: {}),
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
throw error;
|
|
1921
|
+
} finally {
|
|
1922
|
+
if (observation) {
|
|
1923
|
+
try {
|
|
1924
|
+
await observation.dispose(cleanupRemaining());
|
|
1925
|
+
} catch {
|
|
1926
|
+
// The primary operation failure remains authoritative; the exact
|
|
1927
|
+
// retirement outcome is merged into its bounded observation below.
|
|
1928
|
+
} finally {
|
|
1929
|
+
if (operationFailure?.observation) {
|
|
1930
|
+
operationFailure.observation = Object.freeze({
|
|
1931
|
+
...operationFailure.observation,
|
|
1932
|
+
...observation.evidence?.(),
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
import stringWidth from "string-width";
|
|
1940
|
+
import { createHash } from "node:crypto";
|