tmux-ide 2.8.0 → 2.9.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -125
- package/bin/cli.js +75949 -12803
- package/package.json +74 -37
- package/packages/contracts/package.json +9 -3
- package/packages/contracts/src/__tests__/actions-contract.test.ts +119 -0
- package/packages/contracts/src/__tests__/agent-graph-overlay.test.ts +428 -0
- package/packages/contracts/src/__tests__/app-window-mutation.test.ts +51 -0
- package/packages/contracts/src/__tests__/app-window-state.test.ts +34 -0
- package/packages/contracts/src/__tests__/application-shell.test.ts +635 -0
- package/packages/contracts/src/__tests__/causal-cell.test.ts +47 -0
- package/packages/contracts/src/__tests__/client-view-state.test.ts +115 -0
- package/packages/contracts/src/__tests__/cohesion-fixture.test.ts +106 -0
- package/packages/contracts/src/__tests__/commands.test.ts +86 -0
- package/packages/contracts/src/__tests__/daemon-events.test.ts +400 -0
- package/packages/contracts/src/__tests__/daemon-resources.test.ts +143 -0
- package/packages/contracts/src/__tests__/daemon-wire.test.ts +117 -0
- package/packages/contracts/src/__tests__/desktop-host.test.ts +269 -0
- package/packages/contracts/src/__tests__/desktop-missions.test.ts +211 -0
- package/packages/contracts/src/__tests__/experience-conformance.test.ts +153 -0
- package/packages/contracts/src/__tests__/experience-kernel-boundary.test.ts +109 -0
- package/packages/contracts/src/__tests__/experience-shell.test.ts +65 -0
- package/packages/contracts/src/__tests__/fixtures/daemon-wire-v2.json +35 -0
- package/packages/contracts/src/__tests__/fleet-agent-graph.test.ts +231 -0
- package/packages/contracts/src/__tests__/fleet-catalog.test.ts +268 -0
- package/packages/contracts/src/__tests__/fleet-lifecycle.test.ts +62 -0
- package/packages/contracts/src/__tests__/focus-overlay.test.ts +110 -0
- package/packages/contracts/src/__tests__/ide-config.test.ts +18 -0
- package/packages/contracts/src/__tests__/issue-error.test.ts +78 -0
- package/packages/contracts/src/__tests__/mission-projections.test.ts +186 -0
- package/packages/contracts/src/__tests__/missions.test.ts +272 -0
- package/packages/contracts/src/__tests__/multiplexer-verbs.test.ts +240 -0
- package/packages/contracts/src/__tests__/pane-appearance.test.ts +146 -0
- package/packages/contracts/src/__tests__/pane-stream.test.ts +488 -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 +504 -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__/transport-contract-loading.test.ts +91 -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 +101 -0
- package/packages/contracts/src/app-window-state.ts +446 -0
- package/packages/contracts/src/application-shell-resource.ts +54 -0
- package/packages/contracts/src/application-shell.ts +1094 -0
- package/packages/contracts/src/causal-cell.ts +168 -0
- package/packages/contracts/src/client-view-state.ts +156 -0
- package/packages/contracts/src/cohesion-fixture.ts +647 -0
- package/packages/contracts/src/commands.ts +153 -0
- package/packages/contracts/src/daemon-events.ts +374 -0
- package/packages/contracts/src/daemon-resource-request.test.ts +192 -0
- package/packages/contracts/src/daemon-resource-request.ts +397 -0
- package/packages/contracts/src/daemon-resources.ts +108 -0
- package/packages/contracts/src/daemon-wire.ts +100 -0
- package/packages/contracts/src/desktop-daemon-capability-error.ts +31 -0
- package/packages/contracts/src/desktop-daemon-issue.ts +83 -0
- package/packages/contracts/src/desktop-host.ts +728 -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 +70 -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 +711 -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/saved-machines.ts +50 -0
- package/packages/contracts/src/semantic-identity.ts +39 -0
- package/packages/contracts/src/session-runtime.ts +364 -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-theme-presets.ts +499 -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 +62 -0
- package/packages/contracts/src/workspace-pane-creation.ts +221 -0
- package/packages/contracts/src/workspace-promotion.ts +107 -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 +17 -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 +336 -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/saved-machines.test.ts +80 -0
- package/packages/core/src/saved-machines.ts +53 -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-cache-lifetime.test.ts +167 -0
- package/packages/core/src/terminal-delivery-encode-cooperative.test.ts +140 -0
- package/packages/core/src/terminal-delivery.test.ts +1471 -0
- package/packages/core/src/terminal-delivery.ts +3154 -0
- package/packages/core/src/terminal-fnv64-wasm-bytes.ts +20 -0
- package/packages/core/src/terminal-fnv64-wasm.test.ts +61 -0
- package/packages/core/src/terminal-fnv64-wasm.ts +110 -0
- package/packages/core/src/terminal-replica-cold.test.ts +31 -0
- package/packages/core/src/terminal-replica-cooperative.test.ts +170 -0
- package/packages/core/src/terminal-replica-hash-cache.test.ts +283 -0
- package/packages/core/src/terminal-replica-hash-cache.ts +399 -0
- package/packages/core/src/terminal-replica.test.ts +347 -0
- package/packages/core/src/terminal-replica.ts +1149 -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.js +1 -1
- package/packages/daemon/dist/cli.js +38 -37
- package/packages/daemon/dist/command-center/actions/command-definitions.js +70 -0
- package/packages/daemon/dist/command-center/actions/dispatcher.js +228 -10
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.js +3 -4
- package/packages/daemon/dist/command-center/actions/handlers/app-set-remote-access.js +6 -2
- package/packages/daemon/dist/command-center/actions/handlers/app-window-mutate.js +39 -0
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.js +44 -20
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.js +11 -1
- 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.js +55 -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.js +34 -0
- package/packages/daemon/dist/command-center/actions/handlers/workspace-promote.js +34 -0
- package/packages/daemon/dist/command-center/actions/registry.js +126 -0
- package/packages/daemon/dist/command-center/actions/semantic-multiplexer-actions.js +16 -0
- package/packages/daemon/dist/command-center/agent-status-watch.js +170 -0
- package/packages/daemon/dist/command-center/daemon-fleet-facts-observer.js +395 -0
- package/packages/daemon/dist/command-center/discovery.js +262 -3
- package/packages/daemon/dist/command-center/owner-authority.js +46 -0
- package/packages/daemon/dist/command-center/pane-stream-issue.js +185 -0
- package/packages/daemon/dist/command-center/resources/agent-graph-overlay.js +234 -0
- package/packages/daemon/dist/command-center/resources/application-shell.js +641 -0
- package/packages/daemon/dist/command-center/resources/desktop-missions.js +132 -0
- package/packages/daemon/dist/command-center/resources/fleet-catalog.js +163 -0
- package/packages/daemon/dist/command-center/resources/fleet-resource-route.js +48 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness-route.js +121 -0
- package/packages/daemon/dist/command-center/resources/startup-readiness.js +183 -0
- package/packages/daemon/dist/command-center/resources/terminal-native-backing-route.js +92 -0
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.js +24 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-authority.js +451 -0
- package/packages/daemon/dist/command-center/resources/workspace-changes-git.js +222 -0
- package/packages/daemon/dist/command-center/resources/workspace-files-authority.js +493 -0
- package/packages/daemon/dist/command-center/resources/workspace-missions-route.js +75 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-ids.js +69 -0
- package/packages/daemon/dist/command-center/resources/workspace-resource-routes.js +116 -0
- package/packages/daemon/dist/command-center/server.js +540 -51
- package/packages/daemon/dist/command-center/terminal-attachment-issue.js +191 -0
- package/packages/daemon/dist/command-center/workspace-resource-observer.js +453 -0
- package/packages/daemon/dist/command-center/ws-events.js +681 -63
- package/packages/daemon/dist/config.js +31 -25
- package/packages/daemon/dist/control/lifecycle.js +12 -2
- package/packages/daemon/dist/control/server.js +3 -3
- package/packages/daemon/dist/detect.js +23 -20
- package/packages/daemon/dist/doctor.js +25 -8
- package/packages/daemon/dist/index.js +20 -1
- package/packages/daemon/dist/init.js +24 -22
- package/packages/daemon/dist/inspect.js +33 -8
- package/packages/daemon/dist/launch.js +38 -26
- package/packages/daemon/dist/lib/__tests__/fixtures/workspace-state-writer.js +58 -0
- package/packages/daemon/dist/lib/agent-kind.js +24 -0
- package/packages/daemon/dist/lib/app-config.js +29 -1
- package/packages/daemon/dist/lib/app-window-kernel.js +556 -0
- package/packages/daemon/dist/lib/app-window-mutation.js +139 -0
- package/packages/daemon/dist/lib/app-window-repository.js +368 -0
- package/packages/daemon/dist/lib/app-window-state.js +415 -0
- package/packages/daemon/dist/lib/application-shell-app-windows.js +285 -0
- package/packages/daemon/dist/lib/auth/middleware.js +7 -3
- package/packages/daemon/dist/lib/bundled-tmux.js +93 -0
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.js +276 -0
- package/packages/daemon/dist/lib/canonical-daemon.js +507 -70
- package/packages/daemon/dist/lib/chrome-front-door.js +13 -0
- package/packages/daemon/dist/lib/cli-action-bridge.js +112 -82
- package/packages/daemon/dist/lib/command-registry.js +107 -0
- package/packages/daemon/dist/lib/config-context.js +34 -0
- package/packages/daemon/dist/lib/daemon-embed.js +1072 -363
- 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.js +118 -0
- package/packages/daemon/dist/lib/embedded-daemon-lifecycle.js +102 -0
- package/packages/daemon/dist/lib/environment-identity.js +79 -0
- package/packages/daemon/dist/lib/fleet-agent-lifecycle.js +65 -0
- package/packages/daemon/dist/lib/fleet-lifecycle-authority.js +437 -0
- package/packages/daemon/dist/lib/headless-daemon.js +353 -0
- package/packages/daemon/dist/lib/launch-plan.js +96 -1
- package/packages/daemon/dist/lib/legacy-config-adapter.js +19 -0
- package/packages/daemon/dist/lib/legacy-config-migration.js +110 -0
- package/packages/daemon/dist/lib/legacy-theme-compat.js +25 -0
- package/packages/daemon/dist/lib/mission-projections.js +615 -0
- package/packages/daemon/dist/lib/mission-repository.js +775 -0
- package/packages/daemon/dist/lib/onboarding-marker.js +51 -0
- package/packages/daemon/dist/lib/pane-chrome.js +12 -0
- package/packages/daemon/dist/lib/pane-source-credentials.js +178 -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.js +17 -21
- package/packages/daemon/dist/lib/project-probe.js +28 -22
- package/packages/daemon/dist/lib/project-readiness-probe.js +425 -0
- package/packages/daemon/dist/lib/project-readiness.js +680 -0
- package/packages/daemon/dist/lib/project-registry.js +42 -9
- package/packages/daemon/dist/lib/project-resolver.js +245 -0
- package/packages/daemon/dist/lib/project-runtime-errors.js +21 -0
- package/packages/daemon/dist/lib/project-runtime-repository.js +876 -0
- package/packages/daemon/dist/lib/remote-daemon-info.js +21 -0
- package/packages/daemon/dist/lib/resolved-config.js +318 -0
- package/packages/daemon/dist/lib/runtime-namespace.js +136 -0
- package/packages/daemon/dist/lib/saved-machines.js +53 -0
- package/packages/daemon/dist/lib/semantic-resource-id.js +14 -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/ssh-daemon-transport.js +280 -0
- package/packages/daemon/dist/lib/state-home.js +2 -3
- package/packages/daemon/dist/lib/theme-mode.js +9 -0
- package/packages/daemon/dist/lib/tmux-authority-replacement.js +102 -0
- package/packages/daemon/dist/lib/tmux-external-interaction-observer.js +534 -0
- package/packages/daemon/dist/lib/tmux-interaction-options.js +126 -0
- package/packages/daemon/dist/lib/tmux-named-socket-fence.js +61 -0
- package/packages/daemon/dist/lib/tmux-terminal-color.js +37 -0
- package/packages/daemon/dist/lib/tui-binary.js +291 -28
- package/packages/daemon/dist/lib/unix-socket-authority.js +48 -0
- package/packages/daemon/dist/lib/widget-asset-policy.js +3 -0
- package/packages/daemon/dist/lib/widget-asset-store.js +166 -0
- package/packages/daemon/dist/lib/workspace-config-loader.js +280 -0
- package/packages/daemon/dist/lib/workspace-multiplexer-verbs.js +1138 -0
- package/packages/daemon/dist/lib/workspace-open-handoff.js +219 -0
- package/packages/daemon/dist/lib/workspace-open.js +740 -0
- package/packages/daemon/dist/lib/workspace-pane-creation.js +1137 -0
- package/packages/daemon/dist/lib/workspace-promotion.js +809 -0
- package/packages/daemon/dist/lib/workspace-registry.js +150 -23
- package/packages/daemon/dist/lib/workspace-state-repository.js +790 -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.js +105 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/COPYING +13 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/lib/libevent_core-2.1.7.dylib +0 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/lib/libncursesw.6.dylib +0 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/lib/libutf8proc.3.2.3.dylib +0 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/licenses/libevent_core-2.1.7.dylib.txt +99 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/licenses/libncursesw.6.dylib.txt +29 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/licenses/libutf8proc.3.2.3.dylib.txt +93 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/manifest.json +21 -0
- package/packages/daemon/dist/native/tmux/darwin-arm64/tmux +0 -0
- package/packages/daemon/dist/restart.js +2 -2
- package/packages/daemon/dist/restore.js +10 -6
- package/packages/daemon/dist/schemas/inspect.js +9 -1
- package/packages/daemon/dist/schemas/registry.js +5 -19
- package/packages/daemon/dist/schemas/ws-events.js +4 -107
- package/packages/daemon/dist/send.js +106 -3
- package/packages/daemon/dist/server/index.js +4 -2
- package/packages/daemon/dist/server/pane-stream-upgrade.js +117 -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.js +130 -0
- package/packages/daemon/dist/terminal/NodePtyAdapter.js +37 -10
- package/packages/daemon/dist/terminal/PtyAdapter.js +18 -0
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.js +33 -6
- package/packages/daemon/dist/terminal/attachments/admission-util.js +87 -0
- package/packages/daemon/dist/terminal/attachments/agent-status-probe.js +325 -0
- package/packages/daemon/dist/terminal/attachments/direct-websocket.js +1069 -0
- package/packages/daemon/dist/terminal/attachments/grouped-tmux.js +213 -0
- package/packages/daemon/dist/terminal/attachments/lease-manager.js +655 -0
- package/packages/daemon/dist/terminal/attachments/native-runtime.js +1597 -0
- package/packages/daemon/dist/terminal/attachments/pty-tmux-attachment-launcher.js +607 -0
- package/packages/daemon/dist/terminal/attachments/semantic-pane-catalog.js +208 -0
- package/packages/daemon/dist/terminal/attachments/tmux-view-executor.js +825 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/scripted-channel.js +90 -0
- package/packages/daemon/dist/terminal/mirror/__tests__/simulated-channel.js +147 -0
- package/packages/daemon/dist/terminal/mirror/control-channel.js +768 -0
- package/packages/daemon/dist/terminal/mirror/control-mode-ownership.js +30 -0
- package/packages/daemon/dist/terminal/mirror/flow-ledger.js +56 -0
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +338 -0
- package/packages/daemon/dist/terminal/mirror/native-frozen-grid.js +128 -0
- package/packages/daemon/dist/terminal/mirror/native-grid-capture.js +179 -0
- package/packages/daemon/dist/terminal/mirror/native-grid-projection.js +99 -0
- package/packages/daemon/dist/terminal/mirror/native-grid-reader.js +81 -0
- package/packages/daemon/dist/terminal/mirror/native-grid-reflow.js +207 -0
- package/packages/daemon/dist/terminal/mirror/pane-feed.js +209 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.js +2774 -0
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +245 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +2067 -0
- package/packages/daemon/dist/terminal/pane-stream/runtime.js +53 -0
- package/packages/daemon/dist/terminal/pane-stream/wire-ledger.js +110 -0
- package/packages/daemon/dist/terminal/protocol/chunk-bytes.js +21 -0
- package/packages/daemon/dist/terminal/protocol/control.js +111 -0
- package/packages/daemon/dist/terminal/protocol/input-coalescer.js +125 -0
- package/packages/daemon/dist/terminal/protocol/layout-parse.js +127 -0
- package/packages/daemon/dist/terminal/protocol/native-backing-client.js +44 -0
- package/packages/daemon/dist/terminal/protocol/pane-display-name.js +155 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +294 -0
- package/packages/daemon/dist/terminal/protocol/workspace-tmux-adapter.js +213 -0
- package/packages/daemon/dist/terminal/session-runtime/authority-arbiter.js +266 -0
- package/packages/daemon/dist/terminal/session-runtime/causal-cell-ledger.js +278 -0
- package/packages/daemon/dist/terminal/session-runtime/interaction-receipt-facts.js +147 -0
- package/packages/daemon/dist/terminal/session-runtime/multiplexer-backend.js +116 -0
- package/packages/daemon/dist/terminal/session-runtime/native-seed-backing.js +41 -0
- package/packages/daemon/dist/terminal/session-runtime/registry.js +1390 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-observability.js +72 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-scheduler.js +16 -0
- package/packages/daemon/dist/terminal/session-runtime/runtime-trace-correlator.js +48 -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.js +32 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +1770 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-observation-identity.js +9 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +582 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.js +568 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-shadow-projections.js +21 -0
- package/packages/daemon/dist/terminal/session-runtime/transport-binding.js +474 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +515 -0
- package/packages/daemon/dist/tui/async-disposable-slot.js +57 -0
- package/packages/daemon/dist/tui/chrome/cheatsheet.js +211 -0
- package/packages/daemon/dist/tui/chrome/chip.js +25 -0
- package/packages/daemon/dist/tui/chrome/events.js +94 -0
- package/packages/daemon/dist/tui/chrome/front-door.js +16 -0
- package/packages/daemon/dist/tui/chrome/kitty-keys.js +54 -0
- package/packages/daemon/dist/tui/chrome/menu.js +251 -0
- package/packages/daemon/dist/tui/chrome/notify-prefs.js +13 -0
- package/packages/daemon/dist/tui/chrome/notify-state.js +77 -0
- package/packages/daemon/dist/tui/chrome/notify.js +711 -0
- package/packages/daemon/dist/tui/chrome/panels.js +60 -0
- package/packages/daemon/dist/tui/chrome/sidebar.js +183 -0
- package/packages/daemon/dist/tui/chrome/snapshot.js +290 -0
- package/packages/daemon/dist/tui/chrome/statusline.js +552 -0
- package/packages/daemon/dist/tui/chrome/updater.js +651 -0
- package/packages/daemon/dist/tui/chrome/welcome.js +117 -0
- package/packages/daemon/dist/tui/compiled.js +194 -0
- package/packages/daemon/dist/tui/detect/agent-resolution.js +60 -0
- package/packages/daemon/dist/tui/detect/classify.js +184 -0
- package/packages/daemon/dist/tui/detect/manifest-loader.js +242 -0
- package/packages/daemon/dist/tui/detect/manifest.js +126 -0
- package/packages/daemon/dist/tui/detect/manifests.js +535 -0
- package/packages/daemon/dist/tui/detect/process-tree.js +194 -0
- package/packages/daemon/dist/tui/detect/session-id.js +414 -0
- package/packages/daemon/dist/tui/detect/snapshot.js +81 -0
- package/packages/daemon/dist/tui/integrations/claude.js +151 -0
- package/packages/daemon/dist/tui/integrations/offer.js +134 -0
- package/packages/daemon/dist/tui/integrations/opencode.js +117 -0
- package/packages/daemon/dist/tui/mirror/ack-writer.js +78 -0
- package/packages/daemon/dist/tui/mirror/activity-surface-view.jsx +69 -0
- package/packages/daemon/dist/tui/mirror/activity-surface.js +271 -0
- package/packages/daemon/dist/tui/mirror/agent-chip.js +84 -0
- package/packages/daemon/dist/tui/mirror/agent-lifecycle.js +372 -0
- package/packages/daemon/dist/tui/mirror/agent-provisioning-executor.js +111 -0
- package/packages/daemon/dist/tui/mirror/agent-rows.js +126 -0
- package/packages/daemon/dist/tui/mirror/ansi-palette.js +3 -0
- package/packages/daemon/dist/tui/mirror/app-state.js +294 -0
- package/packages/daemon/dist/tui/mirror/application-keybindings.js +33 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-connection.js +270 -0
- package/packages/daemon/dist/tui/mirror/application-shell-daemon-session.js +45 -0
- package/packages/daemon/dist/tui/mirror/attention.js +59 -0
- package/packages/daemon/dist/tui/mirror/blit.js +120 -0
- package/packages/daemon/dist/tui/mirror/canonical-workspace-routing.js +54 -0
- package/packages/daemon/dist/tui/mirror/changes-surface-view.jsx +92 -0
- package/packages/daemon/dist/tui/mirror/changes-surface.js +210 -0
- package/packages/daemon/dist/tui/mirror/composite-layout.js +539 -0
- package/packages/daemon/dist/tui/mirror/configless-session-bootstrap.js +134 -0
- package/packages/daemon/dist/tui/mirror/dialog-model.js +183 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack-core.js +232 -0
- package/packages/daemon/dist/tui/mirror/dialog-stack.js +2 -0
- package/packages/daemon/dist/tui/mirror/diff-model.js +332 -0
- package/packages/daemon/dist/tui/mirror/editor-buffer.js +47 -0
- package/packages/daemon/dist/tui/mirror/editor-open-policy.js +9 -0
- package/packages/daemon/dist/tui/mirror/features/changes/controller.js +454 -0
- package/packages/daemon/dist/tui/mirror/features/changes/feature.jsx +9 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/feature.jsx +123 -0
- package/packages/daemon/dist/tui/mirror/features/dialogs/session.js +160 -0
- package/packages/daemon/dist/tui/mirror/features/files/feature.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/features/files/session.js +617 -0
- package/packages/daemon/dist/tui/mirror/features/home/feature.jsx +122 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/contract.js +3 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/feature.jsx +5 -0
- package/packages/daemon/dist/tui/mirror/features/missions-activity/session.js +377 -0
- package/packages/daemon/dist/tui/mirror/features/palette/buffer-geometry.js +36 -0
- package/packages/daemon/dist/tui/mirror/features/palette/contract.js +9 -0
- package/packages/daemon/dist/tui/mirror/features/palette/feature.js +3 -0
- package/packages/daemon/dist/tui/mirror/features/palette/session.js +394 -0
- package/packages/daemon/dist/tui/mirror/features/palette/surface.jsx +50 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/feature.jsx +2 -0
- package/packages/daemon/dist/tui/mirror/features/performance-hud/session.js +148 -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.js +125 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/feature.jsx +103 -0
- package/packages/daemon/dist/tui/mirror/features/rich-preview/session.js +310 -0
- package/packages/daemon/dist/tui/mirror/features/settings/catalog.js +10 -0
- package/packages/daemon/dist/tui/mirror/features/settings/contract.js +1 -0
- package/packages/daemon/dist/tui/mirror/features/settings/feature.js +2 -0
- package/packages/daemon/dist/tui/mirror/features/settings/session.js +309 -0
- package/packages/daemon/dist/tui/mirror/file-tree.js +283 -0
- package/packages/daemon/dist/tui/mirror/files-surface-view.jsx +92 -0
- package/packages/daemon/dist/tui/mirror/files-surface.js +237 -0
- package/packages/daemon/dist/tui/mirror/focus-projection.js +80 -0
- package/packages/daemon/dist/tui/mirror/folder-picker.js +114 -0
- package/packages/daemon/dist/tui/mirror/frame-coalescer.js +74 -0
- package/packages/daemon/dist/tui/mirror/home-model.js +125 -0
- package/packages/daemon/dist/tui/mirror/home-surface-model.js +297 -0
- package/packages/daemon/dist/tui/mirror/home-surface.jsx +110 -0
- package/packages/daemon/dist/tui/mirror/hosted.js +239 -0
- package/packages/daemon/dist/tui/mirror/input-lifecycle.js +147 -0
- package/packages/daemon/dist/tui/mirror/interaction-flow.js +41 -0
- package/packages/daemon/dist/tui/mirror/legacy/missions-workspace-loader.js +84 -0
- package/packages/daemon/dist/tui/mirror/menu-model.js +143 -0
- package/packages/daemon/dist/tui/mirror/missions-dashboard.js +261 -0
- package/packages/daemon/dist/tui/mirror/missions-render-fixtures.js +330 -0
- package/packages/daemon/dist/tui/mirror/missions-surface-controller.js +314 -0
- package/packages/daemon/dist/tui/mirror/missions-surface.jsx +239 -0
- package/packages/daemon/dist/tui/mirror/missions-workspace.js +1399 -0
- package/packages/daemon/dist/tui/mirror/multiplexer-action-executor.js +252 -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.js +95 -0
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.js +1182 -0
- package/packages/daemon/dist/tui/mirror/palette-surface-adapter.js +384 -0
- package/packages/daemon/dist/tui/mirror/palette.js +522 -0
- package/packages/daemon/dist/tui/mirror/pane-frame-state.js +124 -0
- package/packages/daemon/dist/tui/mirror/pane-mirror.js +1 -0
- package/packages/daemon/dist/tui/mirror/pane-surface.jsx +950 -0
- package/packages/daemon/dist/tui/mirror/panel-host-reactive.js +13 -0
- package/packages/daemon/dist/tui/mirror/panel-host.js +242 -0
- package/packages/daemon/dist/tui/mirror/perf-tap.js +32 -0
- package/packages/daemon/dist/tui/mirror/performance-events.js +46 -0
- package/packages/daemon/dist/tui/mirror/recipe-components.jsx +135 -0
- package/packages/daemon/dist/tui/mirror/recipes.js +395 -0
- package/packages/daemon/dist/tui/mirror/reference-performance-trace.js +598 -0
- package/packages/daemon/dist/tui/mirror/renderer-commands.js +250 -0
- package/packages/daemon/dist/tui/mirror/resize-model.js +105 -0
- package/packages/daemon/dist/tui/mirror/resize-transaction.js +221 -0
- package/packages/daemon/dist/tui/mirror/rich-placement-projection.js +80 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-appearance-owner.js +176 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-bootstrap.js +51 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-daemon-authority-owner.js +235 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-daemon-authority.js +8 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-generation-starter.js +90 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-navigation.js +86 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-observer.js +301 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-roster.jsx +170 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-selection.js +83 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-transport.js +199 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agents-owner.js +221 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agents.js +30 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog-owner.js +104 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-catalog.js +329 -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.js +25 -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.js +242 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-input-readiness.js +20 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-lifecycle.js +297 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agent-navigation.js +61 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agents.js +158 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-authority.js +289 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-catalog.js +223 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-navigation.js +164 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-sidebar.jsx +215 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-startup.js +35 -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.js +132 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-input.js +69 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-search-owner.js +67 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-activity-owner.js +61 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-menu-owner.js +82 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-input.js +41 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-pane-rename-owner.js +46 -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.js +126 -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.js +21 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-root-renderer.js +160 -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.js +313 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-shell-home.jsx +113 -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.js +20 -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.js +102 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +1360 -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.js +22 -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.js +217 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace-policy.js +193 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-workspace.jsx +1286 -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.js +29 -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.js +281 -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.js +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/daemon-authority-rebind.js +128 -0
- package/packages/daemon/dist/tui/mirror/runtime/deferred-intent-queue.js +40 -0
- package/packages/daemon/dist/tui/mirror/runtime/editor-primitives.js +39 -0
- package/packages/daemon/dist/tui/mirror/runtime/file-content-primitives.js +9 -0
- package/packages/daemon/dist/tui/mirror/runtime/fleet-lifecycle-client.js +30 -0
- package/packages/daemon/dist/tui/mirror/runtime/focus-framebuffer-projection.js +53 -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.js +203 -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.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/local-view-controller.js +58 -0
- package/packages/daemon/dist/tui/mirror/runtime/modal-admission-coordinator.js +118 -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.js +833 -0
- package/packages/daemon/dist/tui/mirror/runtime/open-tui-session-owner.js +178 -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.js +1 -0
- package/packages/daemon/dist/tui/mirror/runtime/palette-production-controller.js +126 -0
- package/packages/daemon/dist/tui/mirror/runtime/pane-resize-geometry.js +17 -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.js +12 -0
- package/packages/daemon/dist/tui/mirror/runtime/renderer-cadence.js +7 -0
- package/packages/daemon/dist/tui/mirror/runtime/renderer-frame-optimizer.js +88 -0
- package/packages/daemon/dist/tui/mirror/runtime/renderer-output-transport.js +56 -0
- package/packages/daemon/dist/tui/mirror/runtime/resize-terminal-pane.js +91 -0
- package/packages/daemon/dist/tui/mirror/runtime/rich-preview-demand.js +14 -0
- package/packages/daemon/dist/tui/mirror/runtime/runtime-layout-presentation.js +111 -0
- package/packages/daemon/dist/tui/mirror/runtime/select-terminal-pane.js +90 -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.js +56 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-copy-cursor.js +122 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-copy-selection.js +65 -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.js +911 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-frame-readiness.js +84 -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.js +37 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-input-adapter.js +50 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-layout-projection.js +105 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-link-opener.js +23 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-links.js +81 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-pane-input-router.js +83 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-row-projection-cache.js +88 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-selection-units.js +123 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-selection.js +202 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-session-handoff.js +89 -0
- package/packages/daemon/dist/tui/mirror/runtime/terminal-tool-readiness.js +64 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-controller.js +636 -0
- package/packages/daemon/dist/tui/mirror/runtime/tool-resource-projection.js +169 -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.js +498 -0
- package/packages/daemon/dist/tui/mirror/scrollbar-model.js +64 -0
- package/packages/daemon/dist/tui/mirror/search-model.js +62 -0
- package/packages/daemon/dist/tui/mirror/selection.js +264 -0
- package/packages/daemon/dist/tui/mirror/semantic-pane-render-source.js +581 -0
- package/packages/daemon/dist/tui/mirror/semantic-session-view.js +269 -0
- package/packages/daemon/dist/tui/mirror/settings-model.js +304 -0
- package/packages/daemon/dist/tui/mirror/shell-chrome.js +313 -0
- package/packages/daemon/dist/tui/mirror/size-truth.js +104 -0
- package/packages/daemon/dist/tui/mirror/spans.js +31 -0
- package/packages/daemon/dist/tui/mirror/status-grammar.js +29 -0
- package/packages/daemon/dist/tui/mirror/terminal-native-reflow.js +1 -0
- package/packages/daemon/dist/tui/mirror/terminal-retained-row.js +10 -0
- package/packages/daemon/dist/tui/mirror/terminal-surface.js +92 -0
- package/packages/daemon/dist/tui/mirror/terminal-text.js +52 -0
- package/packages/daemon/dist/tui/mirror/terminal-viewport.js +462 -0
- package/packages/daemon/dist/tui/mirror/theme.js +765 -0
- package/packages/daemon/dist/tui/mirror/ui/agent-badge.jsx +14 -0
- package/packages/daemon/dist/tui/mirror/ui/badge.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/ui/button.jsx +66 -0
- package/packages/daemon/dist/tui/mirror/ui/dialog.jsx +8 -0
- package/packages/daemon/dist/tui/mirror/ui/index.js +16 -0
- package/packages/daemon/dist/tui/mirror/ui/key-hint.jsx +39 -0
- package/packages/daemon/dist/tui/mirror/ui/keyboard-router.jsx +46 -0
- package/packages/daemon/dist/tui/mirror/ui/menu.jsx +24 -0
- package/packages/daemon/dist/tui/mirror/ui/navigation-row.jsx +62 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-frame.jsx +54 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-host.jsx +33 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-list-row.jsx +29 -0
- package/packages/daemon/dist/tui/mirror/ui/overlay-model.js +45 -0
- package/packages/daemon/dist/tui/mirror/ui/state.js +171 -0
- package/packages/daemon/dist/tui/mirror/ui/status-bar.jsx +102 -0
- package/packages/daemon/dist/tui/mirror/ui/surface.jsx +45 -0
- package/packages/daemon/dist/tui/mirror/ui/tabs.jsx +88 -0
- package/packages/daemon/dist/tui/mirror/widget-fallback.js +52 -0
- package/packages/daemon/dist/tui/mirror/widget-surface-model.js +145 -0
- package/packages/daemon/dist/tui/mirror/widget-surface.jsx +31 -0
- package/packages/daemon/dist/tui/mirror/workspace/agent-terminal-canvas.js +77 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-command-description.js +44 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-root-controller.js +99 -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.js +28 -0
- package/packages/daemon/dist/tui/mirror/workspace/application-shell.js +97 -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.js +353 -0
- package/packages/daemon/dist/tui/mirror/workspace/connection-feedback.js +99 -0
- package/packages/daemon/dist/tui/mirror/workspace/icons.js +43 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-action-menu-model.js +8 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-action-menu.jsx +15 -0
- package/packages/daemon/dist/tui/mirror/workspace/pane-frame.js +452 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-chrome.js +555 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-pane-header.jsx +159 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-scrollback.js +183 -0
- package/packages/daemon/dist/tui/mirror/workspace/terminal-window-strip.jsx +253 -0
- package/packages/daemon/dist/tui/mirror/workspace/text.js +27 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-controller.js +34 -0
- package/packages/daemon/dist/tui/mirror/workspace/workbench-shell.js +286 -0
- package/packages/daemon/dist/tui/mirror/workspace-ui-state.js +885 -0
- package/packages/daemon/dist/tui/readiness.js +34 -0
- package/packages/daemon/dist/tui/team/entry.js +20 -0
- package/packages/daemon/dist/tui/team/fuzzy.js +141 -0
- package/packages/daemon/dist/tui/team/home.js +115 -0
- package/packages/daemon/dist/tui/team/input.js +21 -0
- package/packages/daemon/dist/tui/team/keymap.js +99 -0
- package/packages/daemon/dist/tui/team/mouse.js +17 -0
- package/packages/daemon/dist/tui/team/nav.js +33 -0
- package/packages/daemon/dist/tui/team/preview.js +35 -0
- package/packages/daemon/dist/tui/team/projects.js +159 -0
- package/packages/daemon/dist/tui/team/report.js +37 -0
- package/packages/daemon/dist/tui/team/sessions.js +292 -0
- package/packages/daemon/dist/tui/team/tree.js +42 -0
- package/packages/daemon/dist/tui/team/wait-receipts.js +153 -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.js +5 -92
- package/packages/daemon/dist/widgets/resolve.js +12 -9
- 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 +39 -37
- 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-set-remote-access.ts +9 -1
- 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 +69 -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-native-backing-route.ts +104 -0
- package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +45 -0
- package/packages/daemon/src/command-center/resources/workspace-changes-authority.ts +594 -0
- package/packages/daemon/src/command-center/resources/workspace-changes-git.ts +278 -0
- package/packages/daemon/src/command-center/resources/workspace-files-authority.ts +583 -0
- package/packages/daemon/src/command-center/resources/workspace-missions-route.ts +125 -0
- package/packages/daemon/src/command-center/resources/workspace-resource-ids.ts +81 -0
- package/packages/daemon/src/command-center/resources/workspace-resource-routes.ts +147 -0
- package/packages/daemon/src/command-center/server.ts +732 -59
- package/packages/daemon/src/command-center/terminal-attachment-issue.ts +257 -0
- package/packages/daemon/src/command-center/workspace-resource-observer.ts +560 -0
- package/packages/daemon/src/command-center/ws-events.ts +853 -66
- package/packages/daemon/src/config.ts +35 -25
- package/packages/daemon/src/control/lifecycle.ts +14 -2
- package/packages/daemon/src/control/server.ts +3 -3
- package/packages/daemon/src/detect.ts +25 -20
- package/packages/daemon/src/doctor.ts +24 -7
- package/packages/daemon/src/index.ts +244 -2
- package/packages/daemon/src/init.ts +23 -22
- package/packages/daemon/src/inspect.ts +41 -8
- package/packages/daemon/src/launch.ts +56 -28
- package/packages/daemon/src/lib/agent-kind.ts +23 -0
- package/packages/daemon/src/lib/app-config.ts +44 -5
- package/packages/daemon/src/lib/app-window-kernel.ts +777 -0
- package/packages/daemon/src/lib/app-window-mutation.ts +178 -0
- package/packages/daemon/src/lib/app-window-repository.ts +650 -0
- package/packages/daemon/src/lib/app-window-state.ts +599 -0
- package/packages/daemon/src/lib/application-shell-app-windows.ts +357 -0
- package/packages/daemon/src/lib/auth/middleware.ts +9 -3
- package/packages/daemon/src/lib/bundled-tmux.ts +103 -0
- package/packages/daemon/src/lib/canonical-daemon-bootstrap.ts +392 -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 +1374 -390
- 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/embedded-daemon-lifecycle.ts +106 -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 +459 -0
- package/packages/daemon/src/lib/launch-plan.ts +123 -4
- package/packages/daemon/src/lib/legacy-config-adapter.ts +28 -0
- package/packages/daemon/src/lib/legacy-config-migration.ts +145 -0
- package/packages/daemon/src/lib/legacy-theme-compat.ts +40 -0
- package/packages/daemon/src/lib/mission-projections.ts +775 -0
- package/packages/daemon/src/lib/mission-repository.ts +1311 -0
- package/packages/daemon/src/lib/onboarding-marker.ts +51 -0
- package/packages/daemon/src/lib/pane-chrome.ts +14 -0
- package/packages/daemon/src/lib/pane-source-credentials.ts +200 -0
- package/packages/daemon/src/lib/pane-widget.ts +182 -0
- package/packages/daemon/src/lib/project-inspect.ts +4 -0
- package/packages/daemon/src/lib/project-onboard.ts +19 -24
- package/packages/daemon/src/lib/project-probe.ts +38 -30
- package/packages/daemon/src/lib/project-readiness-probe.ts +578 -0
- package/packages/daemon/src/lib/project-readiness.ts +1034 -0
- package/packages/daemon/src/lib/project-registry.ts +45 -9
- package/packages/daemon/src/lib/project-resolver.ts +350 -0
- package/packages/daemon/src/lib/project-runtime-errors.ts +41 -0
- package/packages/daemon/src/lib/project-runtime-repository.ts +1194 -0
- package/packages/daemon/src/lib/remote-daemon-info.ts +42 -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/saved-machines.ts +63 -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/ssh-daemon-transport.ts +303 -0
- package/packages/daemon/src/lib/state-home.ts +2 -3
- package/packages/daemon/src/lib/theme-mode.ts +11 -0
- package/packages/daemon/src/lib/tmux-authority-replacement.ts +119 -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-named-socket-fence.ts +66 -0
- package/packages/daemon/src/lib/tmux-terminal-color.ts +44 -0
- package/packages/daemon/src/lib/tui-binary.ts +354 -34
- package/packages/daemon/src/lib/unix-socket-authority.ts +65 -0
- package/packages/daemon/src/lib/widget-asset-policy.ts +3 -0
- package/packages/daemon/src/lib/widget-asset-store.ts +218 -0
- package/packages/daemon/src/lib/workspace-config-loader.ts +378 -0
- package/packages/daemon/src/lib/workspace-multiplexer-verbs.ts +1362 -0
- package/packages/daemon/src/lib/workspace-open-handoff.ts +340 -0
- package/packages/daemon/src/lib/workspace-open.ts +983 -0
- package/packages/daemon/src/lib/workspace-pane-creation.ts +1434 -0
- package/packages/daemon/src/lib/workspace-promotion.ts +1035 -0
- package/packages/daemon/src/lib/workspace-registry.ts +193 -25
- package/packages/daemon/src/lib/workspace-state-repository.ts +1204 -0
- package/packages/daemon/src/lib/workspace-state.ts +960 -0
- package/packages/daemon/src/lib/yaml-io.ts +8 -17
- package/packages/daemon/src/migrate.ts +134 -0
- package/packages/daemon/src/restart.ts +2 -2
- package/packages/daemon/src/restore.ts +14 -9
- package/packages/daemon/src/schemas/inspect.ts +9 -1
- package/packages/daemon/src/schemas/registry.ts +12 -22
- package/packages/daemon/src/schemas/ws-events.ts +14 -131
- package/packages/daemon/src/send.ts +138 -3
- package/packages/daemon/src/server/README.md +1 -1
- package/packages/daemon/src/server/index.ts +6 -2
- 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 +2246 -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 +1031 -0
- package/packages/daemon/src/terminal/mirror/control-mode-ownership.ts +34 -0
- package/packages/daemon/src/terminal/mirror/events.ts +164 -0
- package/packages/daemon/src/terminal/mirror/flow-ledger.ts +65 -0
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +503 -0
- package/packages/daemon/src/terminal/mirror/native-frozen-grid.ts +154 -0
- package/packages/daemon/src/terminal/mirror/native-grid-capture.ts +235 -0
- package/packages/daemon/src/terminal/mirror/native-grid-projection.ts +125 -0
- package/packages/daemon/src/terminal/mirror/native-grid-reader.ts +109 -0
- package/packages/daemon/src/terminal/mirror/native-grid-reflow.ts +241 -0
- package/packages/daemon/src/terminal/mirror/pane-feed.ts +272 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +3378 -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 +2625 -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/terminal/protocol/control.ts +130 -0
- package/packages/daemon/src/terminal/protocol/input-coalescer.ts +131 -0
- package/packages/daemon/src/terminal/protocol/native-backing-client.ts +65 -0
- package/packages/daemon/src/terminal/protocol/pane-display-name.ts +192 -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 +318 -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/native-seed-backing.ts +80 -0
- package/packages/daemon/src/terminal/session-runtime/registry.ts +2084 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-observability.ts +267 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-scheduler.ts +30 -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 +2324 -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 +78 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +765 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-owner.ts +698 -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 +51 -0
- package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +697 -0
- package/packages/daemon/src/tui/async-disposable-slot.ts +60 -0
- package/packages/daemon/src/tui/chrome/front-door.ts +11 -23
- package/packages/daemon/src/tui/chrome/sidebar.ts +11 -5
- package/packages/daemon/src/tui/chrome/statusline.ts +15 -6
- package/packages/daemon/src/tui/chrome/updater.ts +100 -3
- package/packages/daemon/src/tui/compiled.ts +132 -6
- package/packages/daemon/src/tui/detect/agent-resolution.ts +85 -0
- package/packages/daemon/src/tui/detect/process-tree.ts +17 -1
- package/packages/daemon/src/tui/detect/snapshot.ts +38 -3
- package/packages/daemon/src/tui/integrations/claude.ts +1 -0
- package/packages/daemon/src/tui/main.ts +56 -0
- package/packages/daemon/src/tui/mirror/RECIPES.md +59 -0
- package/packages/daemon/src/tui/mirror/SHELL_CHROME.md +39 -0
- package/packages/daemon/src/tui/mirror/THEME.md +48 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/activity-surface-renderer.test.tsx.snap +42 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/changes-terminal-surface-renderer.test.tsx.snap +267 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/home-files-surface-renderer.test.tsx.snap +267 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/missions-surface-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/recipes-gallery-renderer.test.tsx.snap +141 -0
- package/packages/daemon/src/tui/mirror/__snapshots__/shell-chrome-renderer.test.tsx.snap +134 -0
- package/packages/daemon/src/tui/mirror/activity-surface-view.tsx +169 -0
- package/packages/daemon/src/tui/mirror/activity-surface.ts +430 -0
- package/packages/daemon/src/tui/mirror/agent-lifecycle.ts +36 -5
- package/packages/daemon/src/tui/mirror/agent-provisioning-executor.ts +175 -0
- package/packages/daemon/src/tui/mirror/agent-rows.ts +34 -0
- package/packages/daemon/src/tui/mirror/ansi-palette.ts +3 -0
- package/packages/daemon/src/tui/mirror/app-state.ts +14 -1
- package/packages/daemon/src/tui/mirror/app.tsx +2 -7047
- package/packages/daemon/src/tui/mirror/application-keybindings.ts +54 -0
- package/packages/daemon/src/tui/mirror/application-shell-daemon-connection.ts +370 -0
- package/packages/daemon/src/tui/mirror/application-shell-daemon-session.ts +74 -0
- package/packages/daemon/src/tui/mirror/canonical-workspace-routing.ts +90 -0
- package/packages/daemon/src/tui/mirror/changes-surface-view.tsx +263 -0
- package/packages/daemon/src/tui/mirror/changes-surface.ts +338 -0
- package/packages/daemon/src/tui/mirror/composite-layout.ts +710 -0
- package/packages/daemon/src/tui/mirror/configless-session-bootstrap.ts +192 -0
- package/packages/daemon/src/tui/mirror/dialog-model.ts +2 -2
- package/packages/daemon/src/tui/mirror/dialog-stack-core.ts +264 -0
- package/packages/daemon/src/tui/mirror/dialog-stack.ts +2 -367
- package/packages/daemon/src/tui/mirror/editor-buffer.ts +9 -70
- package/packages/daemon/src/tui/mirror/editor-open-policy.ts +16 -0
- package/packages/daemon/src/tui/mirror/features/changes/contract.ts +84 -0
- package/packages/daemon/src/tui/mirror/features/changes/controller.ts +470 -0
- package/packages/daemon/src/tui/mirror/features/changes/feature.tsx +19 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/contract.ts +64 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/feature.tsx +227 -0
- package/packages/daemon/src/tui/mirror/features/dialogs/session.ts +186 -0
- package/packages/daemon/src/tui/mirror/features/files/feature.tsx +54 -0
- package/packages/daemon/src/tui/mirror/features/files/session.ts +694 -0
- package/packages/daemon/src/tui/mirror/features/home/feature.tsx +172 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/contract.ts +106 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/feature.tsx +19 -0
- package/packages/daemon/src/tui/mirror/features/missions-activity/session.ts +470 -0
- package/packages/daemon/src/tui/mirror/features/palette/buffer-geometry.ts +46 -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 +443 -0
- package/packages/daemon/src/tui/mirror/features/palette/surface.tsx +133 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/contract.ts +20 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/feature.tsx +8 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/session.ts +152 -0
- package/packages/daemon/src/tui/mirror/features/performance-hud/surface.tsx +137 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/asset-loader.ts +153 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/contract.ts +94 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/feature.tsx +141 -0
- package/packages/daemon/src/tui/mirror/features/rich-preview/session.ts +387 -0
- package/packages/daemon/src/tui/mirror/features/settings/catalog.ts +26 -0
- package/packages/daemon/src/tui/mirror/features/settings/contract.ts +41 -0
- package/packages/daemon/src/tui/mirror/features/settings/feature.ts +3 -0
- package/packages/daemon/src/tui/mirror/features/settings/session.ts +375 -0
- package/packages/daemon/src/tui/mirror/files-surface-view.tsx +242 -0
- package/packages/daemon/src/tui/mirror/files-surface.ts +371 -0
- package/packages/daemon/src/tui/mirror/focus-projection.ts +113 -0
- package/packages/daemon/src/tui/mirror/frame-coalescer.ts +87 -0
- package/packages/daemon/src/tui/mirror/home-model.ts +1 -1
- package/packages/daemon/src/tui/mirror/home-surface-model.ts +440 -0
- package/packages/daemon/src/tui/mirror/home-surface.tsx +254 -0
- package/packages/daemon/src/tui/mirror/hosted.ts +87 -6
- package/packages/daemon/src/tui/mirror/input-lifecycle.ts +248 -0
- package/packages/daemon/src/tui/mirror/interaction-flow.ts +83 -0
- package/packages/daemon/src/tui/mirror/legacy/missions-workspace-loader.ts +117 -0
- package/packages/daemon/src/tui/mirror/menu-model.ts +1 -14
- package/packages/daemon/src/tui/mirror/missions-dashboard.ts +451 -0
- package/packages/daemon/src/tui/mirror/missions-render-fixtures.ts +371 -0
- package/packages/daemon/src/tui/mirror/missions-surface-controller.ts +530 -0
- package/packages/daemon/src/tui/mirror/missions-surface.tsx +434 -0
- package/packages/daemon/src/tui/mirror/missions-workspace.ts +1996 -0
- package/packages/daemon/src/tui/mirror/multiplexer-action-executor.ts +393 -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 +152 -0
- package/packages/daemon/src/tui/mirror/open-tui-workspace-runtime-port.ts +1451 -0
- package/packages/daemon/src/tui/mirror/palette-surface-adapter.ts +465 -0
- package/packages/daemon/src/tui/mirror/palette.ts +189 -28
- package/packages/daemon/src/tui/mirror/pane-frame-state.ts +209 -0
- package/packages/daemon/src/tui/mirror/pane-mirror.ts +11 -593
- package/packages/daemon/src/tui/mirror/pane-surface.tsx +858 -53
- package/packages/daemon/src/tui/mirror/panel-host-reactive.ts +17 -0
- package/packages/daemon/src/tui/mirror/panel-host.ts +384 -0
- package/packages/daemon/src/tui/mirror/perf-tap.ts +1 -148
- package/packages/daemon/src/tui/mirror/performance-events.ts +494 -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 +727 -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-add-machine-dialog.tsx +88 -0
- package/packages/daemon/src/tui/mirror/runtime/application-appearance-owner.ts +229 -0
- package/packages/daemon/src/tui/mirror/runtime/application-bootstrap.ts +118 -0
- package/packages/daemon/src/tui/mirror/runtime/application-daemon-authority-owner.ts +259 -0
- package/packages/daemon/src/tui/mirror/runtime/application-daemon-authority.ts +16 -0
- package/packages/daemon/src/tui/mirror/runtime/application-entry.ts +226 -0
- package/packages/daemon/src/tui/mirror/runtime/application-generation-starter.ts +130 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-navigation.ts +174 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-observer.ts +363 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-roster.tsx +276 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-selection.ts +99 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-transport.ts +232 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agents-owner.ts +295 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agents.ts +70 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-catalog-owner.ts +130 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-catalog.ts +451 -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-machine-agent-navigation.ts +91 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-agents.ts +199 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-authority.ts +337 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-catalog.ts +256 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-navigation.ts +177 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-sidebar.tsx +356 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-startup.ts +39 -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 +162 -0
- package/packages/daemon/src/tui/mirror/runtime/application-palette-input.ts +108 -0
- package/packages/daemon/src/tui/mirror/runtime/application-palette-search-owner.ts +78 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-activity-owner.ts +79 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-menu-owner.ts +95 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-rename-input.ts +61 -0
- package/packages/daemon/src/tui/mirror/runtime/application-pane-rename-owner.ts +50 -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 +166 -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 +165 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +632 -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 +375 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-catalog.tsx +448 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-home.tsx +252 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-overlay-stack.tsx +37 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-overlays.tsx +381 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-sidebar.tsx +188 -0
- package/packages/daemon/src/tui/mirror/runtime/application-shell-view.tsx +537 -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 +139 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +1673 -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 +277 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-workspace-policy.ts +311 -0
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-workspace.tsx +1921 -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 +406 -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 +67 -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 +233 -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 +1003 -0
- package/packages/daemon/src/tui/mirror/runtime/open-tui-session-owner.ts +229 -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 +29 -0
- package/packages/daemon/src/tui/mirror/runtime/pane-scoped-terminal-surface.tsx +156 -0
- package/packages/daemon/src/tui/mirror/runtime/product-surface-policy.ts +16 -0
- package/packages/daemon/src/tui/mirror/runtime/renderer-cadence.ts +7 -0
- package/packages/daemon/src/tui/mirror/runtime/renderer-frame-optimizer.ts +92 -0
- package/packages/daemon/src/tui/mirror/runtime/renderer-output-transport.ts +57 -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 +88 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-copy-cursor.ts +169 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-copy-selection.ts +79 -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 +1085 -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 +145 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-link-opener.ts +30 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-links.ts +97 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-pane-input-router.ts +95 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-row-projection-cache.ts +115 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-selection-units.ts +128 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-selection.ts +285 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-session-handoff.ts +143 -0
- package/packages/daemon/src/tui/mirror/runtime/terminal-tool-readiness.ts +72 -0
- package/packages/daemon/src/tui/mirror/runtime/tool-resource-controller.ts +799 -0
- package/packages/daemon/src/tui/mirror/runtime/tool-resource-projection.ts +223 -0
- package/packages/daemon/src/tui/mirror/runtime/viewport-fit-coordinator.ts +12 -0
- package/packages/daemon/src/tui/mirror/runtime/workspace-terminal-fast-lane.ts +597 -0
- package/packages/daemon/src/tui/mirror/selection.ts +0 -21
- package/packages/daemon/src/tui/mirror/semantic-pane-render-source.ts +786 -0
- package/packages/daemon/src/tui/mirror/semantic-session-view.ts +366 -0
- package/packages/daemon/src/tui/mirror/settings-model.ts +24 -66
- package/packages/daemon/src/tui/mirror/shell-chrome-view.tsx +346 -0
- package/packages/daemon/src/tui/mirror/shell-chrome.ts +509 -0
- package/packages/daemon/src/tui/mirror/sidebar.tsx +138 -35
- package/packages/daemon/src/tui/mirror/size-truth.ts +1 -1
- package/packages/daemon/src/tui/mirror/terminal-native-reflow.ts +1 -0
- package/packages/daemon/src/tui/mirror/terminal-retained-row.ts +24 -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 +54 -0
- package/packages/daemon/src/tui/mirror/terminal-viewport.ts +544 -0
- package/packages/daemon/src/tui/mirror/theme.ts +1069 -33
- package/packages/daemon/src/tui/mirror/ui/agent-badge.tsx +41 -0
- package/packages/daemon/src/tui/mirror/ui/badge.tsx +42 -0
- package/packages/daemon/src/tui/mirror/ui/button.tsx +127 -0
- package/packages/daemon/src/tui/mirror/ui/dialog.tsx +45 -0
- package/packages/daemon/src/tui/mirror/ui/index.ts +59 -0
- package/packages/daemon/src/tui/mirror/ui/key-hint.tsx +63 -0
- package/packages/daemon/src/tui/mirror/ui/keyboard-router.tsx +72 -0
- package/packages/daemon/src/tui/mirror/ui/menu.tsx +86 -0
- package/packages/daemon/src/tui/mirror/ui/navigation-row.tsx +114 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-frame.tsx +117 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-host.tsx +71 -0
- package/packages/daemon/src/tui/mirror/ui/overlay-list-row.tsx +68 -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__/terminal-pane-header-polish-renderer.test.tsx.snap +31 -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-command-description.ts +77 -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 +557 -0
- package/packages/daemon/src/tui/mirror/workspace/connection-feedback.ts +105 -0
- package/packages/daemon/src/tui/mirror/workspace/icons.ts +56 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-action-menu-model.ts +33 -0
- package/packages/daemon/src/tui/mirror/workspace/pane-action-menu.tsx +54 -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 +326 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-scrollback.ts +220 -0
- package/packages/daemon/src/tui/mirror/workspace/terminal-window-strip.tsx +466 -0
- package/packages/daemon/src/tui/mirror/workspace/text.ts +28 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-controller.ts +75 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-dock-opentui.tsx +224 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-shell.ts +486 -0
- package/packages/daemon/src/tui/mirror/workspace/workbench-shell.tsx +95 -0
- package/packages/daemon/src/tui/mirror/workspace-ui-state.ts +1278 -0
- package/packages/daemon/src/tui/readiness.ts +52 -0
- package/packages/daemon/src/tui/team/entry.ts +23 -13
- package/packages/daemon/src/tui/team/home.ts +1 -1
- package/packages/daemon/src/tui/team/index.tsx +27 -8
- package/packages/daemon/src/tui/team/projects.ts +12 -0
- package/packages/daemon/src/tui/team/sessions.ts +43 -48
- package/packages/daemon/src/tui/team/wait-receipts.ts +192 -0
- package/packages/daemon/src/ui/pane-frame/fixture.ts +43 -0
- package/packages/daemon/src/ui/workbench-dock/fixture.ts +61 -0
- package/packages/daemon/src/validate.ts +21 -9
- package/packages/daemon/src/widgets/config/README.md +1 -1
- package/packages/daemon/src/widgets/config/index.tsx +15 -115
- package/packages/daemon/src/widgets/lib/watcher.ts +3 -130
- package/packages/daemon/src/widgets/resolve.ts +18 -9
- 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 +2771 -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.test.ts +47 -0
- package/packages/daemon-client/src/workspace-client-operations.ts +220 -0
- package/packages/daemon-client/src/workspace-client-types.ts +302 -0
- package/packages/daemon-client/src/workspace-client.test.ts +2752 -0
- package/packages/daemon-client/src/workspace-client.ts +1452 -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/postinstall.js +57 -6
- package/skill/SKILL.md +27 -28
- package/templates/agent-team-monorepo.yml +28 -30
- package/templates/agent-team-nextjs.yml +24 -26
- package/templates/agent-team.yml +24 -24
- package/templates/convex.yml +24 -16
- package/templates/default.yml +26 -21
- package/templates/go.yml +21 -14
- package/templates/missions.yml +25 -40
- package/templates/nextjs.yml +24 -16
- package/templates/python.yml +21 -14
- package/templates/vite.yml +21 -14
- package/bin/cli.ts +0 -1773
- package/packages/daemon/dist/__tests__/support.d.ts +0 -7
- package/packages/daemon/dist/agent-explain.d.ts +0 -52
- package/packages/daemon/dist/attach.d.ts +0 -3
- package/packages/daemon/dist/bin.d.ts +0 -2
- package/packages/daemon/dist/canonical.d.ts +0 -2
- package/packages/daemon/dist/cli.d.ts +0 -1
- package/packages/daemon/dist/command-center/actions/contract.d.ts +0 -1
- package/packages/daemon/dist/command-center/actions/dispatcher.d.ts +0 -27
- package/packages/daemon/dist/command-center/actions/errors.d.ts +0 -38
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.d.ts +0 -12
- package/packages/daemon/dist/command-center/actions/handlers/_resolve-project.d.ts +0 -42
- package/packages/daemon/dist/command-center/actions/handlers/app-set-remote-access.d.ts +0 -23
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.d.ts +0 -12
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.d.ts +0 -6
- package/packages/daemon/dist/command-center/actions/handlers/project-activate.d.ts +0 -7
- package/packages/daemon/dist/command-center/actions/handlers/project-launch.d.ts +0 -18
- package/packages/daemon/dist/command-center/actions/handlers/project-open-terminal.d.ts +0 -32
- package/packages/daemon/dist/command-center/actions/handlers/project-restart.d.ts +0 -17
- package/packages/daemon/dist/command-center/actions/handlers/project-stop.d.ts +0 -24
- package/packages/daemon/dist/command-center/actions/handlers/terminal-respawn.d.ts +0 -24
- package/packages/daemon/dist/command-center/actions/handlers/terminal-stop.d.ts +0 -14
- package/packages/daemon/dist/command-center/actions/registry.d.ts +0 -35
- package/packages/daemon/dist/command-center/discovery.d.ts +0 -23
- package/packages/daemon/dist/command-center/index.d.ts +0 -10
- package/packages/daemon/dist/command-center/schemas.d.ts +0 -76
- package/packages/daemon/dist/command-center/server.d.ts +0 -26
- package/packages/daemon/dist/command-center/ws-events.d.ts +0 -59
- package/packages/daemon/dist/config.d.ts +0 -19
- package/packages/daemon/dist/control/client.d.ts +0 -23
- package/packages/daemon/dist/control/dispatch.d.ts +0 -34
- package/packages/daemon/dist/control/fanout.d.ts +0 -19
- package/packages/daemon/dist/control/frames.d.ts +0 -23
- package/packages/daemon/dist/control/lifecycle.d.ts +0 -45
- package/packages/daemon/dist/control/server.d.ts +0 -16
- package/packages/daemon/dist/control/verbs.d.ts +0 -11
- package/packages/daemon/dist/detect.d.ts +0 -15
- package/packages/daemon/dist/doctor.d.ts +0 -39
- package/packages/daemon/dist/embed.d.ts +0 -1
- package/packages/daemon/dist/index.d.ts +0 -3
- package/packages/daemon/dist/init.d.ts +0 -4
- package/packages/daemon/dist/inspect.d.ts +0 -54
- package/packages/daemon/dist/launch.d.ts +0 -23
- package/packages/daemon/dist/lib/active-projects.d.ts +0 -12
- package/packages/daemon/dist/lib/agent-discovery.d.ts +0 -68
- package/packages/daemon/dist/lib/app-config.d.ts +0 -253
- package/packages/daemon/dist/lib/app-settings.d.ts +0 -9
- package/packages/daemon/dist/lib/auth/auth-service.d.ts +0 -33
- package/packages/daemon/dist/lib/auth/middleware.d.ts +0 -16
- package/packages/daemon/dist/lib/auth/types.d.ts +0 -1
- package/packages/daemon/dist/lib/auth-token.d.ts +0 -1
- package/packages/daemon/dist/lib/authorship.d.ts +0 -62
- package/packages/daemon/dist/lib/canonical-daemon.d.ts +0 -21
- package/packages/daemon/dist/lib/cli-action-bridge.d.ts +0 -27
- package/packages/daemon/dist/lib/daemon-embed.d.ts +0 -31
- package/packages/daemon/dist/lib/daemon-watchdog.d.ts +0 -16
- package/packages/daemon/dist/lib/daemon.d.ts +0 -8
- package/packages/daemon/dist/lib/dot-path.d.ts +0 -2
- package/packages/daemon/dist/lib/errors.d.ts +0 -37
- package/packages/daemon/dist/lib/filesystem-browser.d.ts +0 -85
- package/packages/daemon/dist/lib/launch-plan.d.ts +0 -6
- package/packages/daemon/dist/lib/log.d.ts +0 -40
- package/packages/daemon/dist/lib/manifest-pack.d.ts +0 -79
- package/packages/daemon/dist/lib/output.d.ts +0 -9
- package/packages/daemon/dist/lib/project-init-runner.d.ts +0 -46
- package/packages/daemon/dist/lib/project-inspect.d.ts +0 -28
- package/packages/daemon/dist/lib/project-onboard.d.ts +0 -58
- package/packages/daemon/dist/lib/project-probe.d.ts +0 -35
- package/packages/daemon/dist/lib/project-registry.d.ts +0 -76
- package/packages/daemon/dist/lib/session-monitor.d.ts +0 -15
- package/packages/daemon/dist/lib/session-options.d.ts +0 -13
- package/packages/daemon/dist/lib/shell.d.ts +0 -5
- package/packages/daemon/dist/lib/sizes.d.ts +0 -16
- package/packages/daemon/dist/lib/skill-sync.d.ts +0 -60
- package/packages/daemon/dist/lib/slugify.d.ts +0 -4
- package/packages/daemon/dist/lib/state-home.d.ts +0 -2
- package/packages/daemon/dist/lib/terminals-store.d.ts +0 -27
- package/packages/daemon/dist/lib/tui-binary.d.ts +0 -57
- package/packages/daemon/dist/lib/update-check.d.ts +0 -118
- package/packages/daemon/dist/lib/update.d.ts +0 -65
- package/packages/daemon/dist/lib/workspace-registry.d.ts +0 -84
- package/packages/daemon/dist/lib/worktree.d.ts +0 -76
- package/packages/daemon/dist/lib/yaml-io.d.ts +0 -10
- package/packages/daemon/dist/ls.d.ts +0 -3
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +0 -34
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/PkgInfo +0 -1
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/AppIcon.icns +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +0 -139
- package/packages/daemon/dist/restart.d.ts +0 -4
- package/packages/daemon/dist/restore.d.ts +0 -113
- package/packages/daemon/dist/schemas/domain.d.ts +0 -1
- package/packages/daemon/dist/schemas/filesystem.d.ts +0 -29
- package/packages/daemon/dist/schemas/ide-config.d.ts +0 -1
- package/packages/daemon/dist/schemas/index.d.ts +0 -12
- package/packages/daemon/dist/schemas/inspect.d.ts +0 -53
- package/packages/daemon/dist/schemas/registry.d.ts +0 -35
- package/packages/daemon/dist/schemas/ws-events.d.ts +0 -72
- package/packages/daemon/dist/send.d.ts +0 -59
- package/packages/daemon/dist/server/index.d.ts +0 -10
- package/packages/daemon/dist/server/pty-bridge.d.ts +0 -174
- package/packages/daemon/dist/server/ws-route.d.ts +0 -74
- package/packages/daemon/dist/status.d.ts +0 -3
- package/packages/daemon/dist/stop.d.ts +0 -3
- package/packages/daemon/dist/terminal/NodePtyAdapter.d.ts +0 -44
- package/packages/daemon/dist/terminal/PtyAdapter.d.ts +0 -124
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.d.ts +0 -77
- package/packages/daemon/dist/types.d.ts +0 -2
- package/packages/daemon/dist/validate.d.ts +0 -4
- 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-model.d.ts +0 -13
- 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/config-model.d.ts +0 -22
- package/packages/daemon/dist/widgets/lib/files.d.ts +0 -11
- package/packages/daemon/dist/widgets/lib/git.d.ts +0 -11
- package/packages/daemon/dist/widgets/lib/grammar.d.ts +0 -79
- 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/lib/pane-comms.d.ts +0 -28
- package/packages/daemon/dist/widgets/lib/theme.d.ts +0 -44
- package/packages/daemon/dist/widgets/lib/watcher.d.ts +0 -9
- package/packages/daemon/dist/widgets/preview/index.jsx +0 -371
- package/packages/daemon/dist/widgets/resolve.d.ts +0 -20
- 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/setup/setup-model.d.ts +0 -15
- 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/control.ts +0 -97
- package/packages/daemon/src/tui/mirror/focus-border.ts +0 -57
- package/packages/daemon/src/tui/mirror/host-terminal.ts +0 -49
- package/packages/daemon/src/tui/mirror/input-coalescer.ts +0 -105
- package/packages/daemon/src/tui/mirror/session-mirror.ts +0 -724
- package/packages/daemon/src/widgets/setup/orchestrator-panel.tsx +0 -200
- package/scripts/build-cli.mjs +0 -101
- package/scripts/build-macos-notifier.mjs +0 -160
- package/scripts/build-tui.mjs +0 -65
- package/scripts/capture-codex-traffic.mjs +0 -195
- package/scripts/check-src-additions.sh +0 -74
- package/scripts/coverage-summary.mjs +0 -68
- package/scripts/install-git-hooks.js +0 -53
- package/scripts/merge-update-manifests.mjs +0 -58
- package/scripts/merge-update-manifests.test.mjs +0 -82
- package/scripts/pack-check-run.mjs +0 -83
- package/scripts/perf-mirror.mjs +0 -313
- package/scripts/prepublish-check.mjs +0 -80
- package/scripts/publish-tap.sh +0 -55
- package/scripts/stress-test.ts +0 -141
- package/scripts/verify-endpoints.sh +0 -90
- /package/packages/daemon/dist/{server/standalone.d.ts → terminal/mirror/events.js} +0 -0
- /package/packages/daemon/dist/{widgets/changes/index.d.ts → terminal/mirror/trusted-inventory.js} +0 -0
- /package/packages/daemon/dist/{widgets/explorer/index.d.ts → terminal/session-runtime/terminal-interpreter-backend.js} +0 -0
- /package/packages/daemon/dist/{widgets/preview/index.d.ts → tui/mirror/features/changes/contract.js} +0 -0
- /package/packages/daemon/dist/{widgets/sidebar/index.d.ts → tui/mirror/features/dialogs/contract.js} +0 -0
- /package/packages/daemon/src/{tui/mirror → terminal/protocol}/layout-parse.ts +0 -0
package/bin/cli.ts
DELETED
|
@@ -1,1773 +0,0 @@
|
|
|
1
|
-
// No shebang in source. The published bin is the compiled `bin/cli.js`
|
|
2
|
-
// (see scripts/build-cli.mjs) which adds `#!/usr/bin/env node` via the
|
|
3
|
-
// esbuild banner. Dev iteration uses `bun bin/cli.ts` directly, which
|
|
4
|
-
// doesn't need a shebang.
|
|
5
|
-
import { parseArgs } from "node:util";
|
|
6
|
-
import { resolve, dirname, join } from "node:path";
|
|
7
|
-
import { execFileSync } from "node:child_process";
|
|
8
|
-
import { existsSync } from "node:fs";
|
|
9
|
-
import { fileURLToPath } from "node:url";
|
|
10
|
-
|
|
11
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
// The node-runnable CLI path that spawned TUI surfaces shell back to (the app's
|
|
13
|
-
// async fleet poll + `detect --write`). When we're the published `bin/cli.js`
|
|
14
|
-
// this file IS it; under dev (`bun bin/cli.ts`) it's the built sibling
|
|
15
|
-
// `bin/cli.js`. Forwarded to surfaces as TMUX_IDE_CLI so the COMPILED TUI binary
|
|
16
|
-
// — whose own `import.meta.url` is a virtual bunfs path with no real cli.js next
|
|
17
|
-
// to it — can still find the CLI to run its subprocesses.
|
|
18
|
-
const selfPath = fileURLToPath(import.meta.url);
|
|
19
|
-
const nodeCliPath = selfPath.endsWith(".js") ? selfPath : resolve(__dirname, "cli.js");
|
|
20
|
-
import { launch } from "../packages/daemon/src/launch.ts";
|
|
21
|
-
import { resolveEntry } from "../packages/daemon/src/tui/team/entry.ts";
|
|
22
|
-
import { loadAppConfig } from "../packages/daemon/src/lib/app-config.ts";
|
|
23
|
-
import {
|
|
24
|
-
resolveTuiLaunch,
|
|
25
|
-
findCompiledTui,
|
|
26
|
-
isBunAvailable,
|
|
27
|
-
} from "../packages/daemon/src/tui/compiled.ts";
|
|
28
|
-
import { init } from "../packages/daemon/src/init.ts";
|
|
29
|
-
import { stop } from "../packages/daemon/src/stop.ts";
|
|
30
|
-
import { attach } from "../packages/daemon/src/attach.ts";
|
|
31
|
-
import { ls } from "../packages/daemon/src/ls.ts";
|
|
32
|
-
import { doctor } from "../packages/daemon/src/doctor.ts";
|
|
33
|
-
import { status } from "../packages/daemon/src/status.ts";
|
|
34
|
-
import { inspect } from "../packages/daemon/src/inspect.ts";
|
|
35
|
-
import { validate } from "../packages/daemon/src/validate.ts";
|
|
36
|
-
import { detect } from "../packages/daemon/src/detect.ts";
|
|
37
|
-
import { config } from "../packages/daemon/src/config.ts";
|
|
38
|
-
import { restart } from "../packages/daemon/src/restart.ts";
|
|
39
|
-
import { restore } from "../packages/daemon/src/restore.ts";
|
|
40
|
-
import { send } from "../packages/daemon/src/send.ts";
|
|
41
|
-
import { IdeError } from "../packages/daemon/src/lib/errors.ts";
|
|
42
|
-
import { printCommandError } from "../packages/daemon/src/lib/output.ts";
|
|
43
|
-
import {
|
|
44
|
-
wantsHostedApp,
|
|
45
|
-
hostedEnvVars,
|
|
46
|
-
hostedCommandLine,
|
|
47
|
-
hostExistsArgv,
|
|
48
|
-
hostCreateArgv,
|
|
49
|
-
hostSetupArgvs,
|
|
50
|
-
hostAttachArgv,
|
|
51
|
-
HOSTED_ENV,
|
|
52
|
-
} from "../packages/daemon/src/tui/mirror/hosted.ts";
|
|
53
|
-
|
|
54
|
-
const { positionals, values } = parseArgs({
|
|
55
|
-
allowPositionals: true,
|
|
56
|
-
strict: false,
|
|
57
|
-
options: {
|
|
58
|
-
json: { type: "boolean" },
|
|
59
|
-
row: { type: "string" },
|
|
60
|
-
pane: { type: "string" },
|
|
61
|
-
title: { type: "string" },
|
|
62
|
-
command: { type: "string" },
|
|
63
|
-
size: { type: "string" },
|
|
64
|
-
write: { type: "boolean" },
|
|
65
|
-
template: { type: "string" },
|
|
66
|
-
name: { type: "string" },
|
|
67
|
-
verbose: { type: "boolean", default: false },
|
|
68
|
-
help: { type: "boolean", short: "h" },
|
|
69
|
-
version: { type: "boolean", short: "v" },
|
|
70
|
-
port: { type: "string" },
|
|
71
|
-
// setup command flags
|
|
72
|
-
edit: { type: "boolean" },
|
|
73
|
-
wizard: { type: "boolean" },
|
|
74
|
-
// send command flags
|
|
75
|
-
to: { type: "string" },
|
|
76
|
-
"no-enter": { type: "boolean" },
|
|
77
|
-
// wait command flags
|
|
78
|
-
status: { type: "string" },
|
|
79
|
-
timeout: { type: "string" },
|
|
80
|
-
match: { type: "string" },
|
|
81
|
-
// events command flag
|
|
82
|
-
follow: { type: "boolean" },
|
|
83
|
-
// force the team cockpit instead of launching a project
|
|
84
|
-
team: { type: "boolean" },
|
|
85
|
-
// adopt every live (non-internal) session at once
|
|
86
|
-
all: { type: "boolean" },
|
|
87
|
-
// restore: print the plan without touching tmux
|
|
88
|
-
"dry-run": { type: "boolean" },
|
|
89
|
-
// restore: replay recorded pane commands (off by default for safety)
|
|
90
|
-
"run-commands": { type: "boolean" },
|
|
91
|
-
// restore: revive agent conversations via `claude --resume <id>`
|
|
92
|
-
"resume-agents": { type: "boolean" },
|
|
93
|
-
// statusline: the session whose bar is being rendered
|
|
94
|
-
active: { type: "string" },
|
|
95
|
-
// switcher: the tmux client the popup was invoked on (see `switcher` case)
|
|
96
|
-
client: { type: "string" },
|
|
97
|
-
// team --popup: run the home cockpit as a popup over a tmux client (M-h)
|
|
98
|
-
popup: { type: "boolean" },
|
|
99
|
-
// sidebar-toggle: the session whose nav column is toggled (see `sidebar-toggle`)
|
|
100
|
-
session: { type: "string" },
|
|
101
|
-
// menu: the click position (mouse binds forward #{mouse_x}/#{mouse_y}) so the
|
|
102
|
-
// actions menu opens at the pointer instead of centered (see `menu` case)
|
|
103
|
-
x: { type: "string" },
|
|
104
|
-
y: { type: "string" },
|
|
105
|
-
// app: host the cockpit in the internal `_tmux-ide-app` session and attach
|
|
106
|
-
// to it (M23.2) — `--detachable` is the primary name, `--hosted` the alias
|
|
107
|
-
detachable: { type: "boolean" },
|
|
108
|
-
hosted: { type: "boolean" },
|
|
109
|
-
// worktree: base ref for a new branch, the worktree checkout dir override,
|
|
110
|
-
// skip creating a session, and force-remove a dirty worktree (see `worktree`)
|
|
111
|
-
from: { type: "string" },
|
|
112
|
-
dir: { type: "string" },
|
|
113
|
-
"no-session": { type: "boolean" },
|
|
114
|
-
force: { type: "boolean" },
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const knownCommands = new Set([
|
|
119
|
-
"start",
|
|
120
|
-
"init",
|
|
121
|
-
"stop",
|
|
122
|
-
"attach",
|
|
123
|
-
"restart",
|
|
124
|
-
"restore",
|
|
125
|
-
"ls",
|
|
126
|
-
"doctor",
|
|
127
|
-
"status",
|
|
128
|
-
"inspect",
|
|
129
|
-
"validate",
|
|
130
|
-
"detect",
|
|
131
|
-
"config",
|
|
132
|
-
"setup",
|
|
133
|
-
"send",
|
|
134
|
-
"settings",
|
|
135
|
-
"team",
|
|
136
|
-
"app",
|
|
137
|
-
"switcher",
|
|
138
|
-
"wait",
|
|
139
|
-
"events",
|
|
140
|
-
"statusline",
|
|
141
|
-
"adopt",
|
|
142
|
-
"unadopt",
|
|
143
|
-
"agent",
|
|
144
|
-
"integration",
|
|
145
|
-
"chrome-updater",
|
|
146
|
-
"cheatsheet",
|
|
147
|
-
"welcome",
|
|
148
|
-
"menu",
|
|
149
|
-
"popup",
|
|
150
|
-
"sidebar-toggle",
|
|
151
|
-
"worktree",
|
|
152
|
-
"update",
|
|
153
|
-
"skill-sync",
|
|
154
|
-
"serve",
|
|
155
|
-
"command-center",
|
|
156
|
-
"server",
|
|
157
|
-
"help",
|
|
158
|
-
]);
|
|
159
|
-
|
|
160
|
-
// --version / -v
|
|
161
|
-
if (values.version) {
|
|
162
|
-
const pkg = await import("../package.json");
|
|
163
|
-
console.log(`tmux-ide v${pkg.version}`);
|
|
164
|
-
process.exit(0);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (values.verbose) {
|
|
168
|
-
globalThis.__tmuxIdeVerbose = true;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const firstPositional = positionals[0];
|
|
172
|
-
const resolved = firstPositional;
|
|
173
|
-
const hasKnownCommand = resolved ? knownCommands.has(resolved) : false;
|
|
174
|
-
const command = hasKnownCommand ? resolved : "start";
|
|
175
|
-
const startTargetDir = hasKnownCommand ? positionals[1] : firstPositional;
|
|
176
|
-
const json = values.json ?? false;
|
|
177
|
-
|
|
178
|
-
const noColor = "NO_COLOR" in process.env;
|
|
179
|
-
const bold = (s: string) => (noColor ? s : `\x1b[1m${s}\x1b[22m`);
|
|
180
|
-
const cyan = (s: string) => (noColor ? s : `\x1b[36m${s}\x1b[39m`);
|
|
181
|
-
const dim = (s: string) => (noColor ? s : `\x1b[2m${s}\x1b[22m`);
|
|
182
|
-
|
|
183
|
-
if (values.help) {
|
|
184
|
-
printHelp();
|
|
185
|
-
process.exit(0);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function printHelp() {
|
|
189
|
-
console.log(`${bold("tmux-ide")} — Terminal IDE powered by tmux
|
|
190
|
-
|
|
191
|
-
${bold("Usage:")}
|
|
192
|
-
${cyan("tmux-ide")} ${dim("Launch ide.yml, or open the team cockpit if none")}
|
|
193
|
-
${cyan("tmux-ide <path>")} ${dim("Launch from a specific directory (cockpit if no ide.yml)")}
|
|
194
|
-
${cyan("tmux-ide setup")} ${dim("Interactive TUI setup wizard")}
|
|
195
|
-
${cyan("tmux-ide setup --edit")} ${dim("Open config tree editor")}
|
|
196
|
-
${cyan("tmux-ide settings")} ${dim("Interactive TUI config manager")}
|
|
197
|
-
${cyan("tmux-ide init")} [--template] ${dim("Scaffold a new ide.yml (auto-detects stack)")}
|
|
198
|
-
${cyan("tmux-ide stop")} ${dim("Kill the current IDE session")}
|
|
199
|
-
${cyan("tmux-ide restart")} ${dim("Stop and relaunch the IDE session")}
|
|
200
|
-
${cyan("tmux-ide restore")} [--dry-run] [--run-commands] [--resume-agents] [--json]
|
|
201
|
-
${dim("Rebuild the fleet from the last snapshot after a tmux crash")}
|
|
202
|
-
${dim("(--resume-agents revives claude conversations via claude --resume)")}
|
|
203
|
-
${cyan("tmux-ide attach")} ${dim("Reattach to a running session")}
|
|
204
|
-
${cyan("tmux-ide team")} [--json] ${dim("TUI over all tmux sessions (--json prints fleet state)")}
|
|
205
|
-
${cyan("tmux-ide app")} [session] ${dim("Unified app: fleet home + live session mirror (bare = home)")}
|
|
206
|
-
${cyan("tmux-ide app --detachable")} ${dim("Host the app in tmux and attach — survives the terminal, ^q detaches")}
|
|
207
|
-
${cyan("tmux-ide switcher")} ${dim("Compact session picker (opens in the M-p popup on adopted sessions)")}
|
|
208
|
-
${cyan("tmux-ide wait agent-status")} <session> --status <s> [--timeout <ms>]
|
|
209
|
-
${dim("Block until a session reaches a status (exit 0 match / 1 timeout)")}
|
|
210
|
-
${cyan("tmux-ide wait output")} <pane|session> --match <regex> [--timeout <ms>]
|
|
211
|
-
${dim("Block until a pane's output matches a regex (exit 0 match / 1 timeout)")}
|
|
212
|
-
${cyan("tmux-ide events")} [--follow] [--json] [--socket] ${dim("Stream agent-status transitions (--socket: push from a running serve)")}
|
|
213
|
-
${cyan("tmux-ide serve")} [--socket <path>] ${dim("Local control socket: NDJSON verbs + pushed events (~/.tmux-ide/control.sock)")}
|
|
214
|
-
${cyan("tmux-ide adopt")} <session> ${dim("Add the live tmux-ide status bar to a session")}
|
|
215
|
-
${cyan("tmux-ide adopt --all")} ${dim("Adopt every live (non-internal) session")}
|
|
216
|
-
${cyan("tmux-ide unadopt")} <session> ${dim("Remove the status bar")}
|
|
217
|
-
${cyan("tmux-ide integration install claude")} ${dim("Authoritative agent status via Claude Code hooks")}
|
|
218
|
-
${cyan("tmux-ide agent explain")} <pane> [--json] ${dim("Debug how a pane's agent state is detected")}
|
|
219
|
-
${cyan("tmux-ide cheatsheet")} ${dim("Print the key cheat sheet (⌥k / [ ? keys ] popup)")}
|
|
220
|
-
${cyan("tmux-ide menu")} [--client N] ${dim("Open the right-click actions menu (⌥m / right-click any pane or the bar)")}
|
|
221
|
-
${cyan("tmux-ide popup")} <widget> ${dim("Open a widget as a floating panel (explorer/changes/config; ⌥e/⌥g/⌥,)")}
|
|
222
|
-
${cyan("tmux-ide sidebar-toggle")} [--session S] ${dim("Toggle the app nav column (⌥b on adopted sessions)")}
|
|
223
|
-
${cyan("tmux-ide worktree create")} <branch> [--from <ref>] [--dir <path>] [--no-session]
|
|
224
|
-
${dim("Add a git worktree (new branch) + open a session in it")}
|
|
225
|
-
${cyan("tmux-ide worktree open")} <branch> ${dim("Open (or switch to) the session for an existing worktree")}
|
|
226
|
-
${cyan("tmux-ide worktree list")} [--json] ${dim("List worktrees joined with their session status")}
|
|
227
|
-
${cyan("tmux-ide worktree remove")} <branch> [--force] ${dim("Kill the worktree's session + remove the worktree")}
|
|
228
|
-
${cyan("tmux-ide ls")} ${dim("List all tmux sessions")}
|
|
229
|
-
${cyan("tmux-ide status")} [--json] ${dim("Show session status")}
|
|
230
|
-
${cyan("tmux-ide inspect")} [--json] ${dim("Show effective config and runtime state")}
|
|
231
|
-
${cyan("tmux-ide doctor")} ${dim("Check system requirements")}
|
|
232
|
-
${cyan("tmux-ide update")} [--dry-run] ${dim("Update tmux-ide (detects dev checkout vs npm/pnpm/bun global)")}
|
|
233
|
-
${cyan("tmux-ide update --manifests")} ${dim("Fetch the latest agent-detection manifest pack (your overrides still win)")}
|
|
234
|
-
${cyan("tmux-ide skill-sync")} ${dim("Refresh the bundled Claude Code skill in ~/.claude/skills/tmux-ide")}
|
|
235
|
-
${cyan("tmux-ide validate")} [--json] ${dim("Validate ide.yml")}
|
|
236
|
-
${cyan("tmux-ide detect")} [--json] ${dim("Detect project stack")}
|
|
237
|
-
${cyan("tmux-ide detect --write")} ${dim("Detect and write ide.yml")}
|
|
238
|
-
${cyan("tmux-ide config")} [--json] ${dim("Dump config as JSON")}
|
|
239
|
-
${cyan("tmux-ide config set")} <path> <value>
|
|
240
|
-
${cyan("tmux-ide config add-pane")} --row <N> --title <T> [--command <C>]
|
|
241
|
-
${cyan("tmux-ide config remove-pane")} --row <N> --pane <M>
|
|
242
|
-
${cyan("tmux-ide config add-row")} [--size <percent>]
|
|
243
|
-
${cyan("tmux-ide config enable-team")} [--name <N>] ${dim("Enable agent teams")}
|
|
244
|
-
${cyan("tmux-ide config disable-team")} ${dim("Disable agent teams")}
|
|
245
|
-
|
|
246
|
-
${bold("Pane Messaging:")}
|
|
247
|
-
${cyan("tmux-ide send")} <target> <message> ${dim("Send message to a pane")}
|
|
248
|
-
${cyan("tmux-ide send")} --to <name> <message> ${dim("Target by name, title, role, or ID")}
|
|
249
|
-
${cyan("tmux-ide send")} <target> --no-enter msg ${dim("Send text without pressing Enter")}
|
|
250
|
-
|
|
251
|
-
${bold("Server:")}
|
|
252
|
-
${cyan("tmux-ide command-center")} [--port N] ${dim("Start the command-center HTTP API")}
|
|
253
|
-
${cyan("tmux-ide server")} [--port N] ${dim("Start HTTP + PTY WebSocket server")}
|
|
254
|
-
|
|
255
|
-
${bold("Discover (in the TUI):")}
|
|
256
|
-
${dim("Bare")} ${cyan("tmux-ide")} ${dim("with no ide.yml opens the HOME cockpit — the fleet home screen.")}
|
|
257
|
-
${dim("Once a session is adopted, the whole UI is one keystroke away:")}
|
|
258
|
-
${cyan("⌥h")} ${dim("home cockpit from anywhere ")}${cyan("⌥p")} ${dim("switch session")}
|
|
259
|
-
${cyan("⌥k")} ${dim("cheat sheet (all keys) ")}${cyan("⌥m")} ${dim("actions menu (or right-click any pane / the bar)")}
|
|
260
|
-
${cyan("⌥e ⌥g ⌥,")} ${dim("file / changes / config panels ")}${cyan("⌥b")} ${dim("sidebar")}
|
|
261
|
-
${dim("A first-run welcome card names these keys once. Run")} ${cyan("tmux-ide cheatsheet")} ${dim("to see the full sheet.")}
|
|
262
|
-
|
|
263
|
-
${bold("Flags:")}
|
|
264
|
-
${cyan("--json")} ${dim("Output as JSON (all commands)")}
|
|
265
|
-
${cyan("--template <name>")} ${dim("Use specific template for init")}
|
|
266
|
-
${cyan("--write")} ${dim("Write detected config to ide.yml")}
|
|
267
|
-
${cyan("--verbose")} ${dim("Log all tmux commands (or set TMUX_IDE_DEBUG=1)")}
|
|
268
|
-
${cyan("-h, --help")} ${dim("Show usage")}
|
|
269
|
-
${cyan("-v, --version")} ${dim("Show version number")}`);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// The TUI surfaces are OpenTUI/Solid `.tsx` that need the `bun` runtime and the
|
|
273
|
-
// checkout sources. On a clean `npm i -g tmux-ide` neither is present, so we
|
|
274
|
-
// fall back to the compiled `tmux-ide-tui` binary (see scripts/build-tui.mjs).
|
|
275
|
-
// `resolveTuiLaunch` encodes the "checkout first, binary second" order; when
|
|
276
|
-
// nothing is available it hands back an actionable reason set for an IdeError.
|
|
277
|
-
function execBunWidget(
|
|
278
|
-
surface: string,
|
|
279
|
-
scriptPath: string,
|
|
280
|
-
args: string[],
|
|
281
|
-
commandLabel: string,
|
|
282
|
-
extraEnv: Record<string, string> = {},
|
|
283
|
-
): void {
|
|
284
|
-
const launch = resolveTuiLaunch({
|
|
285
|
-
surface,
|
|
286
|
-
scriptPath,
|
|
287
|
-
args,
|
|
288
|
-
checkoutExists: existsSync(scriptPath),
|
|
289
|
-
bunAvailable: isBunAvailable(),
|
|
290
|
-
compiledBinary: findCompiledTui(),
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
if (launch.mode === "unavailable") {
|
|
294
|
-
throw new IdeError(
|
|
295
|
-
`\`tmux-ide ${commandLabel}\` is unavailable because ${launch.reasons.join(" and ")}.\n` +
|
|
296
|
-
`Install bun (https://bun.sh) — the TUI surfaces run on it. Sources ship with the npm package since v2.6.1.`,
|
|
297
|
-
{ code: "USAGE", exitCode: 1 },
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const env = {
|
|
302
|
-
...process.env,
|
|
303
|
-
TMUX_IDE_CWD: process.cwd(),
|
|
304
|
-
TMUX_IDE_CLI: nodeCliPath,
|
|
305
|
-
...extraEnv,
|
|
306
|
-
};
|
|
307
|
-
if (launch.mode === "bun") {
|
|
308
|
-
// Spawn from the repo root so bun finds `bunfig.toml` (the @opentui/solid
|
|
309
|
-
// JSX preload). Without this, running from any other cwd — e.g. bare
|
|
310
|
-
// `tmux-ide` in a project dir — falls back to the React JSX runtime and the
|
|
311
|
-
// widget fails to load. The real invocation dir rides in env so in-widget
|
|
312
|
-
// prompts (register / new session) still default to where the user is.
|
|
313
|
-
execFileSync(launch.bin, launch.argv, {
|
|
314
|
-
stdio: "inherit",
|
|
315
|
-
cwd: resolve(__dirname, ".."),
|
|
316
|
-
env,
|
|
317
|
-
});
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Compiled binary: the JSX transform and native dylib are already baked in,
|
|
322
|
-
// so there is no bunfig to find — run from the user's actual cwd (also avoids
|
|
323
|
-
// a stray repo-root bunfig.toml preload the standalone binary can't resolve).
|
|
324
|
-
execFileSync(launch.bin, launch.argv, { stdio: "inherit", env });
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// The detachable cockpit (M23.2): instead of running the app in THIS terminal,
|
|
328
|
-
// ensure the internal `_tmux-ide-app` session exists running it full-screen
|
|
329
|
-
// (status off, window-size latest — see hostSetupArgvs), then attach here.
|
|
330
|
-
// Re-invocation from any terminal reattaches the SAME cockpit; ^q inside a
|
|
331
|
-
// hosted app detaches (the HOSTED_ENV marker on the pane command flips it).
|
|
332
|
-
// Inside tmux the client switch-clients instead of nesting an attach.
|
|
333
|
-
function launchHostedApp(scriptPath: string, appArgs: string[]): void {
|
|
334
|
-
const launch = resolveTuiLaunch({
|
|
335
|
-
surface: "app",
|
|
336
|
-
scriptPath,
|
|
337
|
-
args: appArgs,
|
|
338
|
-
checkoutExists: existsSync(scriptPath),
|
|
339
|
-
bunAvailable: isBunAvailable(),
|
|
340
|
-
compiledBinary: findCompiledTui(),
|
|
341
|
-
});
|
|
342
|
-
if (launch.mode === "unavailable") {
|
|
343
|
-
throw new IdeError(
|
|
344
|
-
`\`tmux-ide app --detachable\` is unavailable because ${launch.reasons.join(" and ")}.\n` +
|
|
345
|
-
`Install bun (https://bun.sh) — the TUI surfaces run on it. Sources ship with the npm package since v2.6.1.`,
|
|
346
|
-
{ code: "USAGE", exitCode: 1 },
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
let exists = true;
|
|
351
|
-
try {
|
|
352
|
-
execFileSync("tmux", hostExistsArgv(), { stdio: "ignore" });
|
|
353
|
-
} catch {
|
|
354
|
-
exists = false; // also covers "no server yet" — new-session starts one
|
|
355
|
-
}
|
|
356
|
-
if (!exists) {
|
|
357
|
-
// Same cwd rule as execBunWidget: bun needs the repo root (bunfig preload),
|
|
358
|
-
// the compiled binary must NOT run from it. The app's real env travels on
|
|
359
|
-
// the pane command line — the tmux server's environment is not ours.
|
|
360
|
-
const cwd = launch.mode === "bun" ? resolve(__dirname, "..") : process.cwd();
|
|
361
|
-
const commandLine = hostedCommandLine(
|
|
362
|
-
launch.bin,
|
|
363
|
-
launch.argv,
|
|
364
|
-
hostedEnvVars({
|
|
365
|
-
cwd: process.cwd(),
|
|
366
|
-
cli: nodeCliPath,
|
|
367
|
-
path: process.env.PATH,
|
|
368
|
-
home: process.env.TMUX_IDE_HOME,
|
|
369
|
-
config: process.env.TMUX_IDE_CONFIG,
|
|
370
|
-
tuiBin: process.env.TMUX_IDE_TUI_BIN,
|
|
371
|
-
}),
|
|
372
|
-
);
|
|
373
|
-
execFileSync("tmux", hostCreateArgv({ cwd, commandLine }), { stdio: "ignore" });
|
|
374
|
-
}
|
|
375
|
-
// Setup runs on EVERY ensure, not just create (M25.5): the list is
|
|
376
|
-
// idempotent, so this upgrades a host created by an older tmux-ide (no
|
|
377
|
-
// resize hooks yet) and re-asserts `window-size latest` on a host a stray
|
|
378
|
-
// `resize-window` flipped to manual — the measured way a cockpit gets stuck
|
|
379
|
-
// at a departed client's size.
|
|
380
|
-
for (const args of hostSetupArgvs()) execFileSync("tmux", args, { stdio: "ignore" });
|
|
381
|
-
execFileSync("tmux", hostAttachArgv(Boolean(process.env.TMUX)), { stdio: "inherit" });
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// The scriptable control surface for the cockpit: print the fleet state as JSON
|
|
385
|
-
// and exit without spawning the (bun/OpenTUI) TUI. Shared by `tmux-ide team
|
|
386
|
-
// --json` and bare `tmux-ide --json` when there's no ide.yml to launch. Dynamic
|
|
387
|
-
// imports keep the interactive path free of the data-layer modules.
|
|
388
|
-
async function printFleetJson(): Promise<void> {
|
|
389
|
-
const { createStatusTracker } = await import("../packages/daemon/src/tui/detect/classify.ts");
|
|
390
|
-
const { listTeamProjects } = await import("../packages/daemon/src/tui/team/projects.ts");
|
|
391
|
-
const { toFleetJson } = await import("../packages/daemon/src/tui/team/report.ts");
|
|
392
|
-
console.log(JSON.stringify(toFleetJson(listTeamProjects(createStatusTracker())), null, 2));
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// The `--socket[=path]` opt-in (undeclared in parseArgs on purpose: bare
|
|
396
|
-
// `--socket` parses to `true`, `--socket=/path` to the path — strict:false
|
|
397
|
-
// gives optional-value semantics parseArgs can't declare). `true | string |
|
|
398
|
-
// undefined`; string overrides the default socket path.
|
|
399
|
-
const socketFlag = values.socket as string | boolean | undefined;
|
|
400
|
-
|
|
401
|
-
// Run a `wait` on a live `tmux-ide serve` (connect once, the server holds the
|
|
402
|
-
// wait — no local polling). Returns null when the flag is off, no server
|
|
403
|
-
// answers, or the connection drops mid-wait — callers fall back SILENTLY to
|
|
404
|
-
// the local polling implementation (same shared logic, tui/team/wait.ts).
|
|
405
|
-
async function waitOverSocket(
|
|
406
|
-
params: Record<string, unknown>,
|
|
407
|
-
): Promise<{ timedOut: boolean; data?: unknown } | null> {
|
|
408
|
-
if (!socketFlag) return null;
|
|
409
|
-
const { connectControl, ControlRequestError } =
|
|
410
|
-
await import("../packages/daemon/src/control/client.ts");
|
|
411
|
-
let client: Awaited<ReturnType<typeof connectControl>>;
|
|
412
|
-
try {
|
|
413
|
-
client = await connectControl({
|
|
414
|
-
socketPath: typeof socketFlag === "string" ? socketFlag : undefined,
|
|
415
|
-
});
|
|
416
|
-
} catch {
|
|
417
|
-
return null; // no server listening — poll locally instead
|
|
418
|
-
}
|
|
419
|
-
try {
|
|
420
|
-
const data = await client.request("wait", params);
|
|
421
|
-
return { timedOut: false, data };
|
|
422
|
-
} catch (err) {
|
|
423
|
-
if (err instanceof ControlRequestError && err.code === "timeout") return { timedOut: true };
|
|
424
|
-
return null; // dropped/errored mid-wait — fall back to polling
|
|
425
|
-
} finally {
|
|
426
|
-
client.close();
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
const teamScriptPath = resolve(__dirname, "../packages/daemon/src/tui/team/index.tsx");
|
|
431
|
-
const appScriptPath = resolve(__dirname, "../packages/daemon/src/tui/mirror/app.tsx");
|
|
432
|
-
|
|
433
|
-
// `tmux-ide team` runs the standalone full-screen cockpit (the OpenTUI app owns
|
|
434
|
-
// the whole terminal). The floating switcher popup (M-p on adopted sessions)
|
|
435
|
-
// supersedes the old nested `[ switcher | main ]` host shell.
|
|
436
|
-
function launchTeamCockpit(): void {
|
|
437
|
-
execBunWidget("team", teamScriptPath, [], "team");
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// The one entry for the unified app: `--detachable`/`--hosted` (or
|
|
441
|
-
// `app.detachable` in config) route through the hosted launcher, everything
|
|
442
|
-
// else runs the app in this terminal as before. The HOSTED_ENV guard keeps the
|
|
443
|
-
// app INSIDE the host session from re-hosting itself.
|
|
444
|
-
function runApp(appArgs: string[]): void {
|
|
445
|
-
const hosted = wantsHostedApp({
|
|
446
|
-
flagDetachable: values.detachable === true,
|
|
447
|
-
flagHosted: values.hosted === true,
|
|
448
|
-
configDetachable: loadAppConfig().app.detachable,
|
|
449
|
-
hostedEnv: process.env[HOSTED_ENV] === "1",
|
|
450
|
-
});
|
|
451
|
-
if (hosted) launchHostedApp(appScriptPath, appArgs);
|
|
452
|
-
else execBunWidget("app", appScriptPath, appArgs, "app");
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// The unified app as the front door (M22.6): bare `tmux-ide` opens `tmux-ide
|
|
456
|
-
// app`'s HOME panel when `app.frontDoor` is on and there's nothing else to
|
|
457
|
-
// launch. Same entry as the explicit `app` command with no session positional
|
|
458
|
-
// — including the hosted flip when `app.detachable` is set (M23.2).
|
|
459
|
-
function launchApp(): void {
|
|
460
|
-
runApp([]);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
try {
|
|
464
|
-
switch (command) {
|
|
465
|
-
case "start": {
|
|
466
|
-
// npm-style staleness nudge: one dim stderr line when a newer version is
|
|
467
|
-
// cached (never on --json, never blocking — best-effort, and stderr so it
|
|
468
|
-
// can't corrupt piped stdout). The dock is the primary surface; this is the
|
|
469
|
-
// hint for the moment you actually run the command.
|
|
470
|
-
if (!json) {
|
|
471
|
-
try {
|
|
472
|
-
const { getUpdateStatus } = await import("../packages/daemon/src/lib/update-check.ts");
|
|
473
|
-
const { latest, updateAvailable } = getUpdateStatus();
|
|
474
|
-
if (updateAvailable && latest) {
|
|
475
|
-
process.stderr.write(
|
|
476
|
-
dim(`⬆ tmux-ide v${latest} available — run \`tmux-ide update\`\n`),
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
} catch {
|
|
480
|
-
// never let the update hint interfere with launching
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
const targetDir = resolve(startTargetDir || ".");
|
|
484
|
-
const hasIdeYml = existsSync(join(targetDir, "ide.yml"));
|
|
485
|
-
// M22.6 — the front-door decision. `--team` always means the classic
|
|
486
|
-
// cockpit; a present ide.yml still auto-launches the project; otherwise
|
|
487
|
-
// `app.frontDoor` flips the default no-project entry to the unified app.
|
|
488
|
-
const entry = resolveEntry({
|
|
489
|
-
hasIdeYml,
|
|
490
|
-
teamFlag: values.team === true,
|
|
491
|
-
frontDoor: loadAppConfig().app.frontDoor,
|
|
492
|
-
});
|
|
493
|
-
if (entry !== "project") {
|
|
494
|
-
// No project to launch here. `--json` is a scripting surface — it always
|
|
495
|
-
// prints the fleet, whichever interactive front door is configured.
|
|
496
|
-
if (json) {
|
|
497
|
-
await printFleetJson();
|
|
498
|
-
break;
|
|
499
|
-
}
|
|
500
|
-
if (entry === "app") launchApp();
|
|
501
|
-
else launchTeamCockpit();
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
await launch(startTargetDir, { json });
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
case "init":
|
|
509
|
-
await init({ template: values.template, json });
|
|
510
|
-
break;
|
|
511
|
-
|
|
512
|
-
case "stop":
|
|
513
|
-
await stop(positionals[1], { json });
|
|
514
|
-
break;
|
|
515
|
-
|
|
516
|
-
case "attach":
|
|
517
|
-
await attach(positionals[1], { json });
|
|
518
|
-
break;
|
|
519
|
-
|
|
520
|
-
case "restart":
|
|
521
|
-
await restart(positionals[1], { json });
|
|
522
|
-
break;
|
|
523
|
-
|
|
524
|
-
case "restore":
|
|
525
|
-
await restore({
|
|
526
|
-
json,
|
|
527
|
-
dryRun: values["dry-run"] === true,
|
|
528
|
-
runCommands: values["run-commands"] === true,
|
|
529
|
-
resumeAgents: values["resume-agents"] === true,
|
|
530
|
-
});
|
|
531
|
-
break;
|
|
532
|
-
|
|
533
|
-
case "ls":
|
|
534
|
-
await ls({ json });
|
|
535
|
-
break;
|
|
536
|
-
|
|
537
|
-
case "doctor":
|
|
538
|
-
await doctor({ json });
|
|
539
|
-
break;
|
|
540
|
-
|
|
541
|
-
case "status":
|
|
542
|
-
await status(positionals[1], { json });
|
|
543
|
-
break;
|
|
544
|
-
|
|
545
|
-
case "inspect":
|
|
546
|
-
await inspect(positionals[1], { json });
|
|
547
|
-
break;
|
|
548
|
-
|
|
549
|
-
case "validate":
|
|
550
|
-
await validate(positionals[1], { json });
|
|
551
|
-
break;
|
|
552
|
-
|
|
553
|
-
case "detect":
|
|
554
|
-
await detect(positionals[1], { json, write: values.write });
|
|
555
|
-
break;
|
|
556
|
-
|
|
557
|
-
case "config": {
|
|
558
|
-
const sub = positionals[1];
|
|
559
|
-
let action = "dump";
|
|
560
|
-
let configArgs: string[] = [];
|
|
561
|
-
|
|
562
|
-
if (sub === "set") {
|
|
563
|
-
action = "set";
|
|
564
|
-
configArgs = positionals.slice(2);
|
|
565
|
-
} else if (sub === "add-pane") {
|
|
566
|
-
action = "add-pane";
|
|
567
|
-
configArgs = [];
|
|
568
|
-
if (values.row !== undefined) configArgs.push("--row", values.row);
|
|
569
|
-
if (values.title !== undefined) configArgs.push("--title", values.title);
|
|
570
|
-
if (values.command !== undefined) configArgs.push("--command", values.command);
|
|
571
|
-
if (values.size !== undefined) configArgs.push("--size", values.size);
|
|
572
|
-
} else if (sub === "remove-pane") {
|
|
573
|
-
action = "remove-pane";
|
|
574
|
-
configArgs = [];
|
|
575
|
-
if (values.row !== undefined) configArgs.push("--row", values.row);
|
|
576
|
-
if (values.pane !== undefined) configArgs.push("--pane", values.pane);
|
|
577
|
-
} else if (sub === "add-row") {
|
|
578
|
-
action = "add-row";
|
|
579
|
-
configArgs = [];
|
|
580
|
-
if (values.size !== undefined) configArgs.push("--size", values.size);
|
|
581
|
-
} else if (sub === "enable-team") {
|
|
582
|
-
action = "enable-team";
|
|
583
|
-
configArgs = [];
|
|
584
|
-
if (values.name !== undefined) configArgs.push("--name", values.name);
|
|
585
|
-
} else if (sub === "disable-team") {
|
|
586
|
-
action = "disable-team";
|
|
587
|
-
configArgs = [];
|
|
588
|
-
} else if (sub === "edit") {
|
|
589
|
-
const scriptPath = resolve(__dirname, "../packages/daemon/src/widgets/setup/index.tsx");
|
|
590
|
-
execBunWidget(
|
|
591
|
-
"setup",
|
|
592
|
-
scriptPath,
|
|
593
|
-
["--dir=" + resolve(startTargetDir || "."), "--edit"],
|
|
594
|
-
"config edit",
|
|
595
|
-
);
|
|
596
|
-
break;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
await config(null, { json, action, args: configArgs });
|
|
600
|
-
break;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
case "setup": {
|
|
604
|
-
const scriptPath = resolve(__dirname, "../packages/daemon/src/widgets/setup/index.tsx");
|
|
605
|
-
const setupArgs = ["--dir=" + resolve(startTargetDir || ".")];
|
|
606
|
-
if (positionals[1] === "--edit" || values.edit) setupArgs.push("--edit");
|
|
607
|
-
if (positionals[1] === "--wizard" || values.wizard) setupArgs.push("--wizard");
|
|
608
|
-
execBunWidget("setup", scriptPath, setupArgs, "setup");
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
case "send": {
|
|
613
|
-
const target = values.to ?? positionals[1];
|
|
614
|
-
const messageStart = values.to ? 1 : 2;
|
|
615
|
-
let message = positionals.slice(messageStart).join(" ");
|
|
616
|
-
if (!message && !process.stdin.isTTY) {
|
|
617
|
-
const { readFileSync } = await import("node:fs");
|
|
618
|
-
message = readFileSync(0, "utf-8").trim();
|
|
619
|
-
}
|
|
620
|
-
await send(null, { json, to: target, message, noEnter: values["no-enter"] });
|
|
621
|
-
break;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
case "settings": {
|
|
625
|
-
const scriptPath = resolve(__dirname, "../packages/daemon/src/widgets/config/index.tsx");
|
|
626
|
-
execBunWidget("config", scriptPath, ["--dir=" + resolve(startTargetDir || ".")], "settings");
|
|
627
|
-
break;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
case "team": {
|
|
631
|
-
// `--json` is the scriptable control surface: print the fleet state and
|
|
632
|
-
// exit without spawning the (bun/OpenTUI) TUI.
|
|
633
|
-
if (json) {
|
|
634
|
-
await printFleetJson();
|
|
635
|
-
break;
|
|
636
|
-
}
|
|
637
|
-
// `--popup` runs the FULL home cockpit inside a tmux `display-popup` (bound
|
|
638
|
-
// to `M-h` on adopt / the dock's `[ ⌂ home ⌥h ]` trigger). Like the
|
|
639
|
-
// switcher, `TMUX_IDE_POPUP_CLIENT` flips popup mode (Enter switch-clients
|
|
640
|
-
// the invoking client + closes) and carries an optional explicit client;
|
|
641
|
-
// empty means "resolve it yourself from inside the popup". Unlike the
|
|
642
|
-
// switcher it keeps the full two-column layout, not the compact picker.
|
|
643
|
-
if (values.popup === true) {
|
|
644
|
-
const clientArg = typeof values.client === "string" ? values.client : "";
|
|
645
|
-
execBunWidget("team", teamScriptPath, [], "team --popup", {
|
|
646
|
-
TMUX_IDE_POPUP_CLIENT: clientArg,
|
|
647
|
-
});
|
|
648
|
-
break;
|
|
649
|
-
}
|
|
650
|
-
launchTeamCockpit();
|
|
651
|
-
break;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
case "app": {
|
|
655
|
-
// The unified app (M18.1): sidebar fleet + a live tmux-session mirror.
|
|
656
|
-
// Bare `tmux-ide app` opens the HOME panel (fleet cards); an optional
|
|
657
|
-
// session positional boots straight into that session's mirror. With
|
|
658
|
-
// `--detachable` (alias `--hosted`, or `app.detachable` in config) the
|
|
659
|
-
// app runs in the internal `_tmux-ide-app` session instead and this
|
|
660
|
-
// terminal attaches to it (M23.2) — the positional only shapes the
|
|
661
|
-
// cockpit at CREATE time; a reattach finds the app exactly as left.
|
|
662
|
-
const session = positionals[1];
|
|
663
|
-
const appArgs = session ? [`--target=${session}`] : [];
|
|
664
|
-
runApp(appArgs);
|
|
665
|
-
break;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
case "switcher": {
|
|
669
|
-
// Runs the team app in PICKER mode inside a tmux `display-popup` (bound to
|
|
670
|
-
// `M-p` on adopt). Picking a session `switch-client`s the invoking client
|
|
671
|
-
// there and the app exits, closing the popup. `TMUX_IDE_PICKER_CLIENT`
|
|
672
|
-
// both flips the app into picker mode and carries an optional explicit
|
|
673
|
-
// client name; empty means "resolve it yourself from inside the popup".
|
|
674
|
-
const clientArg = typeof values.client === "string" ? values.client : "";
|
|
675
|
-
execBunWidget("team", teamScriptPath, [], "switcher", { TMUX_IDE_PICKER_CLIENT: clientArg });
|
|
676
|
-
break;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
case "wait": {
|
|
680
|
-
const sub = positionals[1];
|
|
681
|
-
|
|
682
|
-
// `wait output <pane|session> --match <regex>` — block until a pane's
|
|
683
|
-
// captured text matches. The target may be a pane id (%N) or a session
|
|
684
|
-
// name; tmux resolves both (a session targets its active pane).
|
|
685
|
-
if (sub === "output") {
|
|
686
|
-
const target = positionals[2];
|
|
687
|
-
const pattern = values.match;
|
|
688
|
-
if (!target || typeof pattern !== "string" || pattern.length === 0) {
|
|
689
|
-
console.error(
|
|
690
|
-
"Usage: tmux-ide wait output <pane|session> --match <regex> [--timeout <ms>] [--socket[=path]]",
|
|
691
|
-
);
|
|
692
|
-
process.exit(1);
|
|
693
|
-
}
|
|
694
|
-
try {
|
|
695
|
-
new RegExp(pattern!); // validate up front; a bad pattern is a usage error
|
|
696
|
-
} catch (err) {
|
|
697
|
-
console.error(`Invalid --match regex: ${(err as Error).message}`);
|
|
698
|
-
process.exit(1);
|
|
699
|
-
}
|
|
700
|
-
const outTimeout = Number(values.timeout ?? "60000");
|
|
701
|
-
|
|
702
|
-
// `--socket` fast path: let a running `tmux-ide serve` hold the wait
|
|
703
|
-
// (one process, no spawn-per-poll). Falls back silently when no server
|
|
704
|
-
// is listening — the polling below is exactly the same implementation.
|
|
705
|
-
const viaSocket = await waitOverSocket({
|
|
706
|
-
kind: "output",
|
|
707
|
-
target,
|
|
708
|
-
match: pattern,
|
|
709
|
-
timeoutMs: outTimeout,
|
|
710
|
-
});
|
|
711
|
-
if (viaSocket) {
|
|
712
|
-
if (viaSocket.timedOut) {
|
|
713
|
-
console.error(
|
|
714
|
-
`Timed out after ${outTimeout}ms waiting for ${target} output to match /${pattern}/`,
|
|
715
|
-
);
|
|
716
|
-
process.exit(1);
|
|
717
|
-
}
|
|
718
|
-
const hit = (viaSocket.data as { matched: string }).matched;
|
|
719
|
-
if (json) console.log(JSON.stringify({ matched: hit }));
|
|
720
|
-
else console.log(hit);
|
|
721
|
-
process.exit(0);
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
const { waitForOutputMatch } = await import("../packages/daemon/src/tui/team/wait.ts");
|
|
725
|
-
const result = await waitForOutputMatch(target!, pattern!, { timeoutMs: outTimeout });
|
|
726
|
-
if (!result.ok) {
|
|
727
|
-
console.error(
|
|
728
|
-
`Timed out after ${outTimeout}ms waiting for ${target} output to match /${pattern}/`,
|
|
729
|
-
);
|
|
730
|
-
process.exit(1);
|
|
731
|
-
}
|
|
732
|
-
if (json) console.log(JSON.stringify({ matched: result.matched }));
|
|
733
|
-
else console.log(result.matched);
|
|
734
|
-
process.exit(0);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
const VALID = new Set(["blocked", "working", "done", "idle", "unknown"]);
|
|
738
|
-
const sessionName = positionals[2];
|
|
739
|
-
const want = values.status;
|
|
740
|
-
|
|
741
|
-
if (sub !== "agent-status" || !sessionName || typeof want !== "string" || !VALID.has(want)) {
|
|
742
|
-
console.error(
|
|
743
|
-
"Usage: tmux-ide wait agent-status <session> --status <blocked|working|done|idle|unknown> [--timeout <ms>] [--socket[=path]]",
|
|
744
|
-
);
|
|
745
|
-
process.exit(1);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
const timeout = Number(values.timeout ?? "60000");
|
|
749
|
-
|
|
750
|
-
const viaSocket = await waitOverSocket({
|
|
751
|
-
kind: "agent-status",
|
|
752
|
-
session: sessionName,
|
|
753
|
-
status: want,
|
|
754
|
-
timeoutMs: timeout,
|
|
755
|
-
});
|
|
756
|
-
if (viaSocket) {
|
|
757
|
-
if (viaSocket.timedOut) {
|
|
758
|
-
console.error(
|
|
759
|
-
`Timed out after ${timeout}ms waiting for ${sessionName} to reach status "${want}"`,
|
|
760
|
-
);
|
|
761
|
-
process.exit(1);
|
|
762
|
-
}
|
|
763
|
-
if (json) console.log(JSON.stringify({ session: sessionName, status: want, ok: true }));
|
|
764
|
-
else console.log(`${sessionName} reached status: ${want}`);
|
|
765
|
-
process.exit(0);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
const { waitForAgentStatus } = await import("../packages/daemon/src/tui/team/wait.ts");
|
|
769
|
-
const result = await waitForAgentStatus(
|
|
770
|
-
sessionName!,
|
|
771
|
-
want as import("../packages/daemon/src/tui/detect/classify.ts").AgentStatus,
|
|
772
|
-
{ timeoutMs: timeout },
|
|
773
|
-
);
|
|
774
|
-
if (!result.ok) {
|
|
775
|
-
console.error(
|
|
776
|
-
`Timed out after ${timeout}ms waiting for ${sessionName} to reach status "${want}" (last: ${result.status ?? "absent"})`,
|
|
777
|
-
);
|
|
778
|
-
process.exit(1);
|
|
779
|
-
}
|
|
780
|
-
if (json) {
|
|
781
|
-
console.log(JSON.stringify({ session: sessionName, status: result.status, ok: true }));
|
|
782
|
-
} else {
|
|
783
|
-
console.log(`${sessionName} reached status: ${result.status}`);
|
|
784
|
-
}
|
|
785
|
-
process.exit(0);
|
|
786
|
-
break;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
case "events": {
|
|
790
|
-
// Stream agent-status transitions from the log the chrome updater writes.
|
|
791
|
-
const { readFileSync, existsSync, statSync, openSync, readSync, closeSync } =
|
|
792
|
-
await import("node:fs");
|
|
793
|
-
const { eventsPath, formatEventLine } =
|
|
794
|
-
await import("../packages/daemon/src/tui/chrome/events.ts");
|
|
795
|
-
type Status = "blocked" | "working" | "done" | "idle" | "unknown";
|
|
796
|
-
type EventLike = { ts: string; session: string; from: Status | null; to: Status };
|
|
797
|
-
|
|
798
|
-
const path = eventsPath();
|
|
799
|
-
|
|
800
|
-
// Status → ANSI color, matching the chrome bar's palette in spirit.
|
|
801
|
-
const paintStatus = (status: Status | null, text: string): string => {
|
|
802
|
-
if (noColor || status === null) return text;
|
|
803
|
-
const code =
|
|
804
|
-
status === "blocked"
|
|
805
|
-
? "203"
|
|
806
|
-
: status === "working"
|
|
807
|
-
? "221"
|
|
808
|
-
: status === "done"
|
|
809
|
-
? "111"
|
|
810
|
-
: status === "idle"
|
|
811
|
-
? "114"
|
|
812
|
-
: "244";
|
|
813
|
-
return `\x1b[38;5;${code}m${text}\x1b[39m`;
|
|
814
|
-
};
|
|
815
|
-
const printLine = (raw: string): void => {
|
|
816
|
-
if (json) {
|
|
817
|
-
console.log(raw);
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
|
-
try {
|
|
821
|
-
const ev = JSON.parse(raw) as EventLike;
|
|
822
|
-
console.log(formatEventLine(ev, paintStatus));
|
|
823
|
-
} catch {
|
|
824
|
-
// skip malformed line
|
|
825
|
-
}
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
// `--follow --socket` fast path: a running `tmux-ide serve` PUSHES
|
|
829
|
-
// transitions the moment its detection tick sees them — no file polling.
|
|
830
|
-
// The last-50 backlog still comes from the log (the server has no
|
|
831
|
-
// history); falls back silently to the polling path when no server is up.
|
|
832
|
-
if (values.follow && socketFlag) {
|
|
833
|
-
const { connectControl } = await import("../packages/daemon/src/control/client.ts");
|
|
834
|
-
const client = await connectControl({
|
|
835
|
-
socketPath: typeof socketFlag === "string" ? socketFlag : undefined,
|
|
836
|
-
}).catch(() => null);
|
|
837
|
-
if (client) {
|
|
838
|
-
if (existsSync(path)) {
|
|
839
|
-
const backlog = readFileSync(path, "utf8")
|
|
840
|
-
.split("\n")
|
|
841
|
-
.filter((l) => l.trim().length > 0);
|
|
842
|
-
for (const line of backlog.slice(-50)) printLine(line);
|
|
843
|
-
}
|
|
844
|
-
await client.subscribe((frame) => {
|
|
845
|
-
if (frame.event === "agent-status") printLine(JSON.stringify(frame.data));
|
|
846
|
-
});
|
|
847
|
-
process.on("SIGINT", () => {
|
|
848
|
-
client.close();
|
|
849
|
-
process.exit(0);
|
|
850
|
-
});
|
|
851
|
-
// Ends when the server shuts down (EOF) — exit cleanly then.
|
|
852
|
-
await client.done;
|
|
853
|
-
break;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
if (!existsSync(path)) {
|
|
858
|
-
console.log("no events yet — is a session adopted? (the chrome updater writes events)");
|
|
859
|
-
break;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
const allLines = readFileSync(path, "utf8")
|
|
863
|
-
.split("\n")
|
|
864
|
-
.filter((l) => l.trim().length > 0);
|
|
865
|
-
for (const line of allLines.slice(-50)) printLine(line);
|
|
866
|
-
|
|
867
|
-
if (!values.follow) break;
|
|
868
|
-
|
|
869
|
-
// Follow: poll the file for appended bytes and stream complete new lines.
|
|
870
|
-
let offset = statSync(path).size;
|
|
871
|
-
let leftover = "";
|
|
872
|
-
const timer = setInterval(() => {
|
|
873
|
-
let size: number;
|
|
874
|
-
try {
|
|
875
|
-
size = statSync(path).size;
|
|
876
|
-
} catch {
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
if (size < offset) {
|
|
880
|
-
// rotated/truncated — restart from the top of the new file
|
|
881
|
-
offset = 0;
|
|
882
|
-
leftover = "";
|
|
883
|
-
}
|
|
884
|
-
if (size <= offset) return;
|
|
885
|
-
const fd = openSync(path, "r");
|
|
886
|
-
try {
|
|
887
|
-
const buf = Buffer.alloc(size - offset);
|
|
888
|
-
readSync(fd, buf, 0, buf.length, offset);
|
|
889
|
-
offset = size;
|
|
890
|
-
const parts = (leftover + buf.toString("utf8")).split("\n");
|
|
891
|
-
leftover = parts.pop() ?? "";
|
|
892
|
-
for (const line of parts) if (line.trim().length > 0) printLine(line);
|
|
893
|
-
} finally {
|
|
894
|
-
closeSync(fd);
|
|
895
|
-
}
|
|
896
|
-
}, 500);
|
|
897
|
-
process.on("SIGINT", () => {
|
|
898
|
-
clearInterval(timer);
|
|
899
|
-
process.exit(0);
|
|
900
|
-
});
|
|
901
|
-
// Keep the process alive; the interval + SIGINT handler own the lifecycle.
|
|
902
|
-
await new Promise(() => {});
|
|
903
|
-
break;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
case "statusline": {
|
|
907
|
-
// Called by tmux via #() every status-interval — keep it lean and never
|
|
908
|
-
// let an error corrupt the bar (print a minimal brand instead).
|
|
909
|
-
try {
|
|
910
|
-
const { createStatusTracker } =
|
|
911
|
-
await import("../packages/daemon/src/tui/detect/classify.ts");
|
|
912
|
-
const { listTeamProjects } = await import("../packages/daemon/src/tui/team/projects.ts");
|
|
913
|
-
const { buildStatusline } = await import("../packages/daemon/src/tui/chrome/statusline.ts");
|
|
914
|
-
const { getAppConfig } = await import("../packages/daemon/src/lib/app-config.ts");
|
|
915
|
-
const projects = listTeamProjects(createStatusTracker());
|
|
916
|
-
console.log(buildStatusline(projects, values.active ?? null, 12, getAppConfig().theme));
|
|
917
|
-
} catch {
|
|
918
|
-
console.log("#[fg=colour75,bold] tmux-ide #[default]");
|
|
919
|
-
}
|
|
920
|
-
break;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
case "adopt": {
|
|
924
|
-
const { adoptSession, adoptableSessionNames } =
|
|
925
|
-
await import("../packages/daemon/src/tui/chrome/statusline.ts");
|
|
926
|
-
if (values.all) {
|
|
927
|
-
// Adopt every live session that isn't internal (`_`-prefixed plumbing).
|
|
928
|
-
const raw = execFileSync("tmux", ["list-sessions", "-F", "#{session_name}"], {
|
|
929
|
-
encoding: "utf8",
|
|
930
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
931
|
-
}).trim();
|
|
932
|
-
const targets = raw ? adoptableSessionNames(raw.split("\n")) : [];
|
|
933
|
-
if (targets.length === 0) {
|
|
934
|
-
console.log("no adoptable sessions");
|
|
935
|
-
break;
|
|
936
|
-
}
|
|
937
|
-
for (const name of targets) {
|
|
938
|
-
adoptSession(name);
|
|
939
|
-
console.log(`adopted ${name}`);
|
|
940
|
-
}
|
|
941
|
-
break;
|
|
942
|
-
}
|
|
943
|
-
const target = positionals[1];
|
|
944
|
-
if (!target) {
|
|
945
|
-
console.error("Usage: tmux-ide adopt <session> | tmux-ide adopt --all");
|
|
946
|
-
process.exit(1);
|
|
947
|
-
}
|
|
948
|
-
adoptSession(target);
|
|
949
|
-
console.log(`adopted ${target} — chrome row active (unadopt to remove)`);
|
|
950
|
-
break;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
case "unadopt": {
|
|
954
|
-
const { unadoptSession } = await import("../packages/daemon/src/tui/chrome/statusline.ts");
|
|
955
|
-
const target = positionals[1];
|
|
956
|
-
if (!target) {
|
|
957
|
-
console.error("Usage: tmux-ide unadopt <session>");
|
|
958
|
-
process.exit(1);
|
|
959
|
-
}
|
|
960
|
-
unadoptSession(target);
|
|
961
|
-
console.log(`unadopted ${target}`);
|
|
962
|
-
break;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
case "agent": {
|
|
966
|
-
const sub = positionals[1];
|
|
967
|
-
const target = positionals[2];
|
|
968
|
-
if (sub !== "explain" || !target) {
|
|
969
|
-
console.error(
|
|
970
|
-
"Usage: tmux-ide agent explain <pane> [--json]\n" +
|
|
971
|
-
" <pane> a pane id (%N) or a session name (uses its active pane)\n" +
|
|
972
|
-
" Prints how the fleet detector classifies the pane: authority,\n" +
|
|
973
|
-
" hint, resolved manifest, per-state rule results, and the snapshot.",
|
|
974
|
-
);
|
|
975
|
-
process.exit(1);
|
|
976
|
-
}
|
|
977
|
-
const { agentExplain } = await import("../packages/daemon/src/agent-explain.ts");
|
|
978
|
-
agentExplain(target, { json });
|
|
979
|
-
break;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
case "integration": {
|
|
983
|
-
const sub = positionals[1];
|
|
984
|
-
const agent = positionals[2];
|
|
985
|
-
// `status` and `offer` need no agent arg; install/uninstall take a kind
|
|
986
|
-
// we ship an integration for (claude hooks, opencode plugin).
|
|
987
|
-
const needsAgent = sub === "install" || sub === "uninstall";
|
|
988
|
-
const installable = agent === "claude" || agent === "opencode";
|
|
989
|
-
if (!sub || (needsAgent && !installable)) {
|
|
990
|
-
console.error(
|
|
991
|
-
"Usage: tmux-ide integration <install|uninstall|status|offer> [claude|opencode]\n" +
|
|
992
|
-
" install claude: hook lifecycle events into tmux pane state\n" +
|
|
993
|
-
" opencode: plugin that records the session id for restore --resume-agents\n" +
|
|
994
|
-
" uninstall remove exactly the tmux-ide entries for that agent\n" +
|
|
995
|
-
" status list discovered agents + integration/capture state\n" +
|
|
996
|
-
" offer one-time first-adopt install prompt (used by the popup)",
|
|
997
|
-
);
|
|
998
|
-
process.exit(1);
|
|
999
|
-
}
|
|
1000
|
-
if (needsAgent && agent === "opencode") {
|
|
1001
|
-
const oc = await import("../packages/daemon/src/tui/integrations/opencode.ts");
|
|
1002
|
-
if (sub === "install") {
|
|
1003
|
-
const { pluginPath } = oc.installOpencodeIntegration();
|
|
1004
|
-
console.log(`plugin: ${pluginPath}`);
|
|
1005
|
-
console.log(
|
|
1006
|
-
"installed — NEW opencode sessions record their session id into the pane\n" +
|
|
1007
|
-
"(@agent_session_id), so `tmux-ide restore --resume-agents` can revive them.",
|
|
1008
|
-
);
|
|
1009
|
-
} else {
|
|
1010
|
-
const { wasInstalled } = oc.uninstallOpencodeIntegration();
|
|
1011
|
-
console.log(wasInstalled ? "uninstalled — plugin removed" : "was not installed");
|
|
1012
|
-
}
|
|
1013
|
-
break;
|
|
1014
|
-
}
|
|
1015
|
-
const mod = await import("../packages/daemon/src/tui/integrations/claude.ts");
|
|
1016
|
-
if (sub === "install") {
|
|
1017
|
-
const { scriptPath, settingsPath } = mod.installClaudeIntegration();
|
|
1018
|
-
// Hooks + skill = the complete agent setup, so one command does both:
|
|
1019
|
-
// the lifecycle hooks (authoritative status) AND a fresh copy of the
|
|
1020
|
-
// skill that tells the agent how to drive tmux-ide.
|
|
1021
|
-
const { syncSkill } = await import("../packages/daemon/src/lib/skill-sync.ts");
|
|
1022
|
-
const skill = syncSkill();
|
|
1023
|
-
console.log(`hook script: ${scriptPath}`);
|
|
1024
|
-
console.log(`settings: ${settingsPath} (backup written once as .tmux-ide.bak)`);
|
|
1025
|
-
console.log(`skill: ${skill.action} → ${skill.path} (v${skill.to})`);
|
|
1026
|
-
console.log(
|
|
1027
|
-
"installed — NEW Claude Code sessions now report working/blocked/done " +
|
|
1028
|
-
"authoritatively into the tmux-ide chrome.",
|
|
1029
|
-
);
|
|
1030
|
-
// M25.1: this is the moment the user is wiring notifications, so offer
|
|
1031
|
-
// the macOS banner channel here — one plain y/N key, same shape as the
|
|
1032
|
-
// first-adopt offer. Skipped when already on, off-macOS, or when there
|
|
1033
|
-
// is no TTY to ask (TMUX_IDE_NOTIFY_KEY forces an answer for tests).
|
|
1034
|
-
const { getAppConfig, updateAppConfig } =
|
|
1035
|
-
await import("../packages/daemon/src/lib/app-config.ts");
|
|
1036
|
-
const forcedKey = process.env.TMUX_IDE_NOTIFY_KEY;
|
|
1037
|
-
const canAsk = forcedKey !== undefined || process.stdin.isTTY === true;
|
|
1038
|
-
if (process.platform === "darwin" && !getAppConfig().notifications.macos && canAsk) {
|
|
1039
|
-
const act = (key: string): void => {
|
|
1040
|
-
if (key === "y" || key === "Y") {
|
|
1041
|
-
updateAppConfig({ notifications: { macos: true } });
|
|
1042
|
-
console.log(
|
|
1043
|
-
"macOS notifications on — native branded banners will jump to the session when clicked.",
|
|
1044
|
-
);
|
|
1045
|
-
} else {
|
|
1046
|
-
console.log(
|
|
1047
|
-
"skipped — turn banners on anytime: notifications.macos in ~/.tmux-ide/config.json.",
|
|
1048
|
-
);
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
process.stdout.write("\nAlso get a macOS notification when an agent needs you? [y/N] ");
|
|
1052
|
-
if (forcedKey !== undefined) {
|
|
1053
|
-
console.log(forcedKey);
|
|
1054
|
-
act(forcedKey);
|
|
1055
|
-
} else {
|
|
1056
|
-
const key = await new Promise<string>((resolve) => {
|
|
1057
|
-
try {
|
|
1058
|
-
process.stdin.setRawMode?.(true);
|
|
1059
|
-
process.stdin.resume();
|
|
1060
|
-
process.stdin.once("data", (data) => resolve(data.toString()));
|
|
1061
|
-
} catch {
|
|
1062
|
-
resolve(""); // no readable stdin — treat as "no"
|
|
1063
|
-
}
|
|
1064
|
-
});
|
|
1065
|
-
try {
|
|
1066
|
-
process.stdin.setRawMode?.(false);
|
|
1067
|
-
process.stdin.pause();
|
|
1068
|
-
} catch {
|
|
1069
|
-
// best-effort terminal restore
|
|
1070
|
-
}
|
|
1071
|
-
console.log(/^[ -~]$/.test(key) ? key : "");
|
|
1072
|
-
act(key);
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
} else if (sub === "uninstall") {
|
|
1076
|
-
const { wasInstalled } = mod.uninstallClaudeIntegration();
|
|
1077
|
-
console.log(wasInstalled ? "uninstalled — hook entries removed" : "was not installed");
|
|
1078
|
-
} else if (sub === "offer") {
|
|
1079
|
-
// The one-time first-adopt prompt, run inside a `display-popup` by
|
|
1080
|
-
// adoptSession (see ../packages/daemon/src/tui/integrations/offer.ts). It
|
|
1081
|
-
// reads ONE key: `y` installs, anything else skips — and writes the
|
|
1082
|
-
// marker either way so it never asks twice. Must never throw or hang.
|
|
1083
|
-
const offerMod = await import("../packages/daemon/src/tui/integrations/offer.ts");
|
|
1084
|
-
try {
|
|
1085
|
-
console.log(offerMod.buildOfferText());
|
|
1086
|
-
} catch {
|
|
1087
|
-
console.log("Claude Code detected — install the tmux-ide integration? [y/N]");
|
|
1088
|
-
}
|
|
1089
|
-
const act = (key: string): void => {
|
|
1090
|
-
offerMod.markIntegrationOffered();
|
|
1091
|
-
if (key === "y" || key === "Y") {
|
|
1092
|
-
try {
|
|
1093
|
-
mod.installClaudeIntegration();
|
|
1094
|
-
console.log("\ninstalled — new Claude Code sessions now report state to tmux-ide.");
|
|
1095
|
-
} catch (e) {
|
|
1096
|
-
console.log(`\ninstall failed: ${(e as Error).message}`);
|
|
1097
|
-
}
|
|
1098
|
-
} else {
|
|
1099
|
-
console.log("\nskipped — run `tmux-ide integration install claude` anytime.");
|
|
1100
|
-
}
|
|
1101
|
-
};
|
|
1102
|
-
// Test/automation hook: a forced key exits immediately, no stdin — lets
|
|
1103
|
-
// the offer flow be exercised deterministically without a live keypress.
|
|
1104
|
-
const forced = process.env.TMUX_IDE_OFFER_KEY;
|
|
1105
|
-
if (forced !== undefined) {
|
|
1106
|
-
act(forced);
|
|
1107
|
-
process.exit(0);
|
|
1108
|
-
}
|
|
1109
|
-
const closeOffer = () => process.exit(0);
|
|
1110
|
-
const offerTimer = setTimeout(closeOffer, 60_000);
|
|
1111
|
-
offerTimer.unref?.();
|
|
1112
|
-
try {
|
|
1113
|
-
process.stdin.setRawMode?.(true);
|
|
1114
|
-
process.stdin.resume();
|
|
1115
|
-
process.stdin.once("data", (data) => {
|
|
1116
|
-
act(data.toString());
|
|
1117
|
-
console.log("\n[ press any key to close ]");
|
|
1118
|
-
process.stdin.once("data", closeOffer);
|
|
1119
|
-
process.stdin.once("end", closeOffer);
|
|
1120
|
-
});
|
|
1121
|
-
process.stdin.once("end", closeOffer);
|
|
1122
|
-
} catch {
|
|
1123
|
-
closeOffer();
|
|
1124
|
-
}
|
|
1125
|
-
} else {
|
|
1126
|
-
// status — the discovery table: every known agent, whether it's on PATH,
|
|
1127
|
-
// and (for agents we integrate) whether the integration is installed.
|
|
1128
|
-
const { discoverAgents } = await import("../packages/daemon/src/lib/agent-discovery.ts");
|
|
1129
|
-
const agents = discoverAgents();
|
|
1130
|
-
if (json) {
|
|
1131
|
-
console.log(JSON.stringify({ agents }, null, 2));
|
|
1132
|
-
break;
|
|
1133
|
-
}
|
|
1134
|
-
for (const a of agents) {
|
|
1135
|
-
let state: string;
|
|
1136
|
-
if (a.path === null) state = "not found";
|
|
1137
|
-
else if (a.integration)
|
|
1138
|
-
state = a.installed ? "integration installed ✓" : "on PATH — integration not installed";
|
|
1139
|
-
else state = "detected (no integration)";
|
|
1140
|
-
// The resume-key story: how @agent_session_id (what `restore
|
|
1141
|
-
// --resume-agents` revives from) gets captured for this kind.
|
|
1142
|
-
let capture = "";
|
|
1143
|
-
if (a.path !== null) {
|
|
1144
|
-
if (a.capture === "probe") capture = " · session-id capture: automatic";
|
|
1145
|
-
else if (a.capture !== null)
|
|
1146
|
-
capture = a.captureActive
|
|
1147
|
-
? ` · session-id capture: ${a.capture} ✓`
|
|
1148
|
-
: ` · session-id capture: ${a.capture} (install to enable)`;
|
|
1149
|
-
else capture = " · session-id capture: none";
|
|
1150
|
-
}
|
|
1151
|
-
console.log(` ${a.id.padEnd(10)} ${state}${capture}`);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
break;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
case "chrome-updater": {
|
|
1158
|
-
// The background loop that keeps every adopted session's status var fresh.
|
|
1159
|
-
// Hosted in the hidden `_tmux-ide-chrome` tmux session (started on adopt);
|
|
1160
|
-
// blocks forever. Never let a boot error crash it — a dead updater just
|
|
1161
|
-
// means stale bars, not broken sessions.
|
|
1162
|
-
try {
|
|
1163
|
-
const { runUpdaterLoop } = await import("../packages/daemon/src/tui/chrome/updater.ts");
|
|
1164
|
-
runUpdaterLoop();
|
|
1165
|
-
} catch {
|
|
1166
|
-
process.exit(0);
|
|
1167
|
-
}
|
|
1168
|
-
break;
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
case "cheatsheet": {
|
|
1172
|
-
// Renders the static key cheat sheet, then blocks until ANY key closes it
|
|
1173
|
-
// (the popup exits). Runs inside a tmux `display-popup` (bound to M-k on
|
|
1174
|
-
// adopt / the `[ ? keys ]` bar trigger), so it must never throw — a broken
|
|
1175
|
-
// render should still print something and still close on a keypress.
|
|
1176
|
-
try {
|
|
1177
|
-
const { buildCheatsheet } = await import("../packages/daemon/src/tui/chrome/cheatsheet.ts");
|
|
1178
|
-
const { getAppConfig } = await import("../packages/daemon/src/lib/app-config.ts");
|
|
1179
|
-
const cfg = getAppConfig();
|
|
1180
|
-
console.log(
|
|
1181
|
-
buildCheatsheet({
|
|
1182
|
-
width: process.stdout.columns ?? 100,
|
|
1183
|
-
keys: cfg.keys,
|
|
1184
|
-
theme: cfg.theme,
|
|
1185
|
-
}),
|
|
1186
|
-
);
|
|
1187
|
-
} catch {
|
|
1188
|
-
console.log("tmux-ide — press ⌥p for the switcher, ⌥k for this sheet. Any key closes.");
|
|
1189
|
-
}
|
|
1190
|
-
// Wait for a single keypress, then exit 0 so the popup closes. Fall back to
|
|
1191
|
-
// an auto-close after 60s if stdin never delivers (e.g. no raw mode).
|
|
1192
|
-
const close = () => process.exit(0);
|
|
1193
|
-
const timer = setTimeout(close, 60_000);
|
|
1194
|
-
timer.unref?.();
|
|
1195
|
-
try {
|
|
1196
|
-
process.stdin.setRawMode?.(true);
|
|
1197
|
-
process.stdin.resume();
|
|
1198
|
-
process.stdin.once("data", close);
|
|
1199
|
-
// A closed/redirected stdin (`</dev/null`, piped) hits EOF instead of
|
|
1200
|
-
// ever delivering a key — close on that too so the command can't hang.
|
|
1201
|
-
process.stdin.once("end", close);
|
|
1202
|
-
} catch {
|
|
1203
|
-
close();
|
|
1204
|
-
}
|
|
1205
|
-
break;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
case "welcome": {
|
|
1209
|
-
// Prints the one-time first-run welcome card, then blocks until ANY key
|
|
1210
|
-
// closes it (the popup exits). Floated by `adoptSession` via a
|
|
1211
|
-
// `display-popup -E "tmux-ide welcome"` on first adopt (see
|
|
1212
|
-
// ./chrome/welcome.ts). Mirrors the cheatsheet case — must never throw, and
|
|
1213
|
-
// must close on a key / EOF / a 60s fallback so the popup can't hang.
|
|
1214
|
-
try {
|
|
1215
|
-
const { buildWelcomeText } = await import("../packages/daemon/src/tui/chrome/welcome.ts");
|
|
1216
|
-
const { getAppConfig } = await import("../packages/daemon/src/lib/app-config.ts");
|
|
1217
|
-
console.log(buildWelcomeText(getAppConfig().keys));
|
|
1218
|
-
} catch {
|
|
1219
|
-
console.log(
|
|
1220
|
-
"Welcome to tmux-ide. Right-click for the menu · ⌥h home · ⌥p switch · ⌥k all keys.",
|
|
1221
|
-
);
|
|
1222
|
-
}
|
|
1223
|
-
const closeWelcome = () => process.exit(0);
|
|
1224
|
-
const welcomeTimer = setTimeout(closeWelcome, 60_000);
|
|
1225
|
-
welcomeTimer.unref?.();
|
|
1226
|
-
try {
|
|
1227
|
-
process.stdin.setRawMode?.(true);
|
|
1228
|
-
process.stdin.resume();
|
|
1229
|
-
process.stdin.once("data", closeWelcome);
|
|
1230
|
-
process.stdin.once("end", closeWelcome);
|
|
1231
|
-
} catch {
|
|
1232
|
-
closeWelcome();
|
|
1233
|
-
}
|
|
1234
|
-
break;
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
case "menu": {
|
|
1238
|
-
// Build the native tmux actions menu at CLICK TIME (the session list is
|
|
1239
|
-
// live) and display it on the invoking client. Bound via `run-shell -b` so
|
|
1240
|
-
// `#{client_name}` format-expands into `--client` (verified live on tmux
|
|
1241
|
-
// 3.6 — it resolves to the triggering / most-recently-active client). Runs
|
|
1242
|
-
// inside tmux's key/mouse dispatch, so it must never throw or HANG — every
|
|
1243
|
-
// tmux call below is capped at 2s and a missing client degrades to a no-op.
|
|
1244
|
-
try {
|
|
1245
|
-
// Every tmux shell-out gets a hard 2s cap: the old fallback
|
|
1246
|
-
// (`display-message -p '#{client_name}'` from outside a client) could
|
|
1247
|
-
// block indefinitely and wedge the bind. `timeout` throws on expiry,
|
|
1248
|
-
// caught below → silent no-op.
|
|
1249
|
-
const tmuxCap = {
|
|
1250
|
-
encoding: "utf8" as const,
|
|
1251
|
-
stdio: ["ignore", "pipe", "ignore"] as const,
|
|
1252
|
-
timeout: 2000,
|
|
1253
|
-
};
|
|
1254
|
-
// Resolve the target client. Prefer the `--client` the bind expanded; if
|
|
1255
|
-
// it's empty or an unexpanded `#{…}` literal, fall back to the
|
|
1256
|
-
// most-recently-active attached client (list-clients sorted by
|
|
1257
|
-
// client_activity desc). No clients at all → exit 0 silently (fired from
|
|
1258
|
-
// tmux dispatch, a no-op beats an error).
|
|
1259
|
-
const rawClient = typeof values.client === "string" ? values.client : "";
|
|
1260
|
-
let client = rawClient && !rawClient.includes("#{") ? rawClient : "";
|
|
1261
|
-
if (!client) {
|
|
1262
|
-
const raw = execFileSync(
|
|
1263
|
-
"tmux",
|
|
1264
|
-
["list-clients", "-F", "#{client_activity} #{client_name}"],
|
|
1265
|
-
tmuxCap,
|
|
1266
|
-
).trim();
|
|
1267
|
-
const newest = raw
|
|
1268
|
-
.split("\n")
|
|
1269
|
-
.filter(Boolean)
|
|
1270
|
-
.map((line) => {
|
|
1271
|
-
const sp = line.indexOf(" ");
|
|
1272
|
-
return { activity: Number(line.slice(0, sp)), name: line.slice(sp + 1) };
|
|
1273
|
-
})
|
|
1274
|
-
.sort((a, b) => b.activity - a.activity)[0];
|
|
1275
|
-
client = newest?.name ?? "";
|
|
1276
|
-
}
|
|
1277
|
-
if (!client) break; // no attached clients — nothing to show
|
|
1278
|
-
const { createStatusTracker } =
|
|
1279
|
-
await import("../packages/daemon/src/tui/detect/classify.ts");
|
|
1280
|
-
const { listTeamSessions } = await import("../packages/daemon/src/tui/team/sessions.ts");
|
|
1281
|
-
const { buildMenu, menuPositionArgs } =
|
|
1282
|
-
await import("../packages/daemon/src/tui/chrome/menu.ts");
|
|
1283
|
-
const { getAppConfig } = await import("../packages/daemon/src/lib/app-config.ts");
|
|
1284
|
-
const { getUpdateStatus } = await import("../packages/daemon/src/lib/update-check.ts");
|
|
1285
|
-
// listTeamSessions already drops internal `_`-prefixed plumbing.
|
|
1286
|
-
const sessions = listTeamSessions(createStatusTracker()).map((s) => ({
|
|
1287
|
-
name: s.name,
|
|
1288
|
-
status: s.status,
|
|
1289
|
-
}));
|
|
1290
|
-
// Position flags from a mouse bind's forwarded coords; empty (→ centered)
|
|
1291
|
-
// for the keyboard path or unexpanded #{mouse_*} literals. Must precede
|
|
1292
|
-
// the menu spec (buildMenu opens with -T), so they slot in right after -c.
|
|
1293
|
-
const position = menuPositionArgs(
|
|
1294
|
-
typeof values.x === "string" ? values.x : undefined,
|
|
1295
|
-
typeof values.y === "string" ? values.y : undefined,
|
|
1296
|
-
);
|
|
1297
|
-
const args = [
|
|
1298
|
-
"display-menu",
|
|
1299
|
-
"-c",
|
|
1300
|
-
client,
|
|
1301
|
-
...position,
|
|
1302
|
-
...buildMenu(sessions, getAppConfig().theme, getUpdateStatus()),
|
|
1303
|
-
];
|
|
1304
|
-
execFileSync("tmux", args, { stdio: "ignore", timeout: 2000 });
|
|
1305
|
-
} catch {
|
|
1306
|
-
// no client / tmux unavailable / a call timed out — nothing to show
|
|
1307
|
-
}
|
|
1308
|
-
break;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
case "popup": {
|
|
1312
|
-
// Open a widget as a floating panel. This CLI invocation IS the popup
|
|
1313
|
-
// process (a root-table key or a menu row ran `display-popup -E "tmux-ide
|
|
1314
|
-
// popup <widget>"`), so we exec the bun widget SYNCHRONOUSLY into the
|
|
1315
|
-
// popup's PTY; when the widget exits (esc/q) the popup closes.
|
|
1316
|
-
const { POPUP_WIDGETS } = await import("../packages/daemon/src/tui/chrome/panels.ts");
|
|
1317
|
-
const widget = positionals[1];
|
|
1318
|
-
if (!widget || !POPUP_WIDGETS.includes(widget)) {
|
|
1319
|
-
throw new IdeError(
|
|
1320
|
-
`Usage: tmux-ide popup <widget>\nKnown panels: ${POPUP_WIDGETS.join(", ")}.`,
|
|
1321
|
-
{ code: "USAGE", exitCode: 1 },
|
|
1322
|
-
);
|
|
1323
|
-
}
|
|
1324
|
-
// Resolve the widget entry from THIS file's dir (bin/), mirroring the
|
|
1325
|
-
// setup/config cases — the bundler rewrites `import.meta.url` to the bin/
|
|
1326
|
-
// bundle, so a `resolve.ts`-relative path would miss the sources.
|
|
1327
|
-
const scriptPath = resolve(__dirname, "../packages/daemon/src/widgets", widget, "index.tsx");
|
|
1328
|
-
// The popup opened with `-d '#{pane_current_path}'`, so our cwd IS the
|
|
1329
|
-
// pane's project dir — forward it as `--dir`. Resolve the session so the
|
|
1330
|
-
// widget's tmux side-channels (preview file, "send to claude") target it;
|
|
1331
|
-
// best-effort — an empty session just disables those (the widget still
|
|
1332
|
-
// renders and browses).
|
|
1333
|
-
let popupSession = "";
|
|
1334
|
-
try {
|
|
1335
|
-
popupSession = execFileSync("tmux", ["display-message", "-p", "#{session_name}"], {
|
|
1336
|
-
encoding: "utf8",
|
|
1337
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
1338
|
-
timeout: 2000,
|
|
1339
|
-
}).trim();
|
|
1340
|
-
} catch {
|
|
1341
|
-
// not inside a tmux client — leave session empty
|
|
1342
|
-
}
|
|
1343
|
-
const popupArgs = [`--dir=${process.cwd()}`];
|
|
1344
|
-
if (popupSession) popupArgs.push(`--session=${popupSession}`);
|
|
1345
|
-
execBunWidget(widget, scriptPath, popupArgs, `popup ${widget}`);
|
|
1346
|
-
break;
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
case "sidebar-toggle": {
|
|
1350
|
-
// Toggle the app nav column in a session (bound to `keys.sidebar`, default
|
|
1351
|
-
// M-b, via `run-shell` which expands `--session '#{session_name}'`). If a
|
|
1352
|
-
// sidebar pane already exists → close it; else split a full-height left
|
|
1353
|
-
// column running the sidebar widget. Runs inside tmux key dispatch, so it
|
|
1354
|
-
// stays best-effort — a failure is a silent no-op, never a wedged bind.
|
|
1355
|
-
try {
|
|
1356
|
-
const {
|
|
1357
|
-
findSidebarPane,
|
|
1358
|
-
openSidebarPane,
|
|
1359
|
-
closeSidebarPane,
|
|
1360
|
-
resolveSidebarConfig,
|
|
1361
|
-
DEFAULT_SIDEBAR_WIDTH,
|
|
1362
|
-
} = await import("../packages/daemon/src/tui/chrome/sidebar.ts");
|
|
1363
|
-
// Resolve the target session: the explicit --session, else the invoking
|
|
1364
|
-
// client's session via display-message.
|
|
1365
|
-
let session = typeof values.session === "string" ? values.session.trim() : "";
|
|
1366
|
-
if (!session || session.includes("#{")) {
|
|
1367
|
-
try {
|
|
1368
|
-
session = execFileSync("tmux", ["display-message", "-p", "#{session_name}"], {
|
|
1369
|
-
encoding: "utf8",
|
|
1370
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
1371
|
-
timeout: 2000,
|
|
1372
|
-
}).trim();
|
|
1373
|
-
} catch {
|
|
1374
|
-
session = "";
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
if (!session) break; // no session context — nothing to toggle
|
|
1378
|
-
const existing = findSidebarPane(session);
|
|
1379
|
-
if (existing) {
|
|
1380
|
-
closeSidebarPane(existing);
|
|
1381
|
-
break;
|
|
1382
|
-
}
|
|
1383
|
-
// Opening: resolve the session's cwd + best-effort sidebar width/theme
|
|
1384
|
-
// from an ide.yml there (any adopted session may have none → defaults).
|
|
1385
|
-
const { getSessionCwd } = await import("../packages/tmux-bridge/src/index.ts");
|
|
1386
|
-
let dir = process.cwd();
|
|
1387
|
-
try {
|
|
1388
|
-
dir = getSessionCwd(session) ?? dir;
|
|
1389
|
-
} catch {
|
|
1390
|
-
// no cwd — fall back to the CLI's cwd
|
|
1391
|
-
}
|
|
1392
|
-
let width = DEFAULT_SIDEBAR_WIDTH;
|
|
1393
|
-
let theme = null;
|
|
1394
|
-
try {
|
|
1395
|
-
const { readConfig } = await import("../packages/daemon/src/lib/yaml-io.ts");
|
|
1396
|
-
const { config } = readConfig(dir);
|
|
1397
|
-
theme = config.theme ?? null;
|
|
1398
|
-
const sb = resolveSidebarConfig(config.sidebar);
|
|
1399
|
-
if (sb.enabled) width = sb.width;
|
|
1400
|
-
} catch {
|
|
1401
|
-
// no/invalid ide.yml — defaults are fine
|
|
1402
|
-
}
|
|
1403
|
-
openSidebarPane(session, dir, width, theme);
|
|
1404
|
-
} catch {
|
|
1405
|
-
// tmux unavailable / widget missing — silent no-op (fired from a bind)
|
|
1406
|
-
}
|
|
1407
|
-
break;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
case "worktree": {
|
|
1411
|
-
const sub = positionals[1];
|
|
1412
|
-
const KNOWN_SUBS = new Set(["create", "open", "list", "remove"]);
|
|
1413
|
-
if (!sub || !KNOWN_SUBS.has(sub)) {
|
|
1414
|
-
throw new IdeError(
|
|
1415
|
-
"Usage: tmux-ide worktree <create|open|list|remove> <branch> [flags]\n" +
|
|
1416
|
-
" create <branch> [--from <ref>] [--dir <path>] [--no-session]\n" +
|
|
1417
|
-
" open <branch>\n" +
|
|
1418
|
-
" list [--json]\n" +
|
|
1419
|
-
" remove <branch> [--force]",
|
|
1420
|
-
{ code: "USAGE", exitCode: 1 },
|
|
1421
|
-
);
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
const {
|
|
1425
|
-
worktreeSessionName,
|
|
1426
|
-
worktreePath,
|
|
1427
|
-
listWorktrees,
|
|
1428
|
-
createWorktree,
|
|
1429
|
-
removeWorktree,
|
|
1430
|
-
WorktreeError,
|
|
1431
|
-
} = await import("../packages/daemon/src/lib/worktree.ts");
|
|
1432
|
-
const { getSessionName } = await import("../packages/daemon/src/lib/yaml-io.ts");
|
|
1433
|
-
const { getSessionCwd, hasSession, killSession, createDetachedSession } =
|
|
1434
|
-
await import("../packages/tmux-bridge/src/index.ts");
|
|
1435
|
-
|
|
1436
|
-
// The repo the command targets: the --session's cwd when invoked from the
|
|
1437
|
-
// menu (run-shell's own cwd is the tmux server's, not the pane's — verified
|
|
1438
|
-
// live), else the CLI's cwd.
|
|
1439
|
-
let repoDir = process.cwd();
|
|
1440
|
-
const sessionArg = typeof values.session === "string" ? values.session.trim() : "";
|
|
1441
|
-
if (sessionArg && !sessionArg.includes("#{")) {
|
|
1442
|
-
try {
|
|
1443
|
-
const cwd = getSessionCwd(sessionArg);
|
|
1444
|
-
if (cwd) repoDir = cwd;
|
|
1445
|
-
} catch {
|
|
1446
|
-
// fall back to the CLI cwd
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
// The project identity for session names: the MAIN worktree's ide.yml name
|
|
1451
|
-
// (or its dir basename). `git worktree list` returns the main checkout first.
|
|
1452
|
-
const worktrees = listWorktrees(repoDir);
|
|
1453
|
-
const mainPath = worktrees[0]?.path ?? repoDir;
|
|
1454
|
-
const projectName = getSessionName(mainPath).name;
|
|
1455
|
-
|
|
1456
|
-
// Start a session in a worktree checkout: full IDE layout when it has an
|
|
1457
|
-
// ide.yml (launch under the worktree's own session name so it never
|
|
1458
|
-
// collides with the parent repo's session), else a plain adopted session.
|
|
1459
|
-
// Never auto-attaches — the caller may be inside tmux (the menu) — it prints
|
|
1460
|
-
// how to switch instead.
|
|
1461
|
-
async function openWorktreeSession(wtPath: string, name: string): Promise<void> {
|
|
1462
|
-
if (existsSync(join(wtPath, "ide.yml"))) {
|
|
1463
|
-
await launch(wtPath, { attach: false, sessionName: name });
|
|
1464
|
-
} else {
|
|
1465
|
-
if (!hasSession(name)) createDetachedSession(name, wtPath);
|
|
1466
|
-
const { adoptSession } = await import("../packages/daemon/src/tui/chrome/statusline.ts");
|
|
1467
|
-
adoptSession(name);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
function printSwitchHint(name: string, wtPath: string): void {
|
|
1472
|
-
console.log(`Worktree ready: ${wtPath}`);
|
|
1473
|
-
console.log(`Session: ${name}`);
|
|
1474
|
-
if (process.env.TMUX) {
|
|
1475
|
-
console.log(`Switch to it: tmux switch-client -t '${name}'`);
|
|
1476
|
-
} else {
|
|
1477
|
-
console.log(`Attach to it: tmux attach -t '${name}'`);
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
if (sub === "create") {
|
|
1482
|
-
const branch = positionals[2];
|
|
1483
|
-
if (!branch) {
|
|
1484
|
-
throw new IdeError(
|
|
1485
|
-
"Usage: tmux-ide worktree create <branch> [--from <ref>] [--dir <path>] [--no-session]",
|
|
1486
|
-
{ code: "USAGE", exitCode: 1 },
|
|
1487
|
-
);
|
|
1488
|
-
}
|
|
1489
|
-
const { getAppConfig } = await import("../packages/daemon/src/lib/app-config.ts");
|
|
1490
|
-
const dirOverride =
|
|
1491
|
-
typeof values.dir === "string" && values.dir.length > 0
|
|
1492
|
-
? values.dir
|
|
1493
|
-
: getAppConfig().worktrees.dir || null;
|
|
1494
|
-
const wtPath = worktreePath(repoDir, branch, dirOverride);
|
|
1495
|
-
const from = typeof values.from === "string" ? values.from : null;
|
|
1496
|
-
|
|
1497
|
-
// Default: create a NEW branch off `from` (HEAD when absent). If the
|
|
1498
|
-
// branch already exists and no explicit base was given, fall back to
|
|
1499
|
-
// checking it out into the worktree instead of failing.
|
|
1500
|
-
try {
|
|
1501
|
-
createWorktree(repoDir, branch, wtPath, { newBranch: true, from });
|
|
1502
|
-
} catch (err) {
|
|
1503
|
-
if (err instanceof WorktreeError && err.code === "BRANCH_EXISTS" && !from) {
|
|
1504
|
-
createWorktree(repoDir, branch, wtPath, { newBranch: false });
|
|
1505
|
-
} else {
|
|
1506
|
-
throw err;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
const sessionName = worktreeSessionName(projectName, branch);
|
|
1511
|
-
if (!values["no-session"]) {
|
|
1512
|
-
await openWorktreeSession(wtPath, sessionName);
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
if (json) {
|
|
1516
|
-
console.log(
|
|
1517
|
-
JSON.stringify({
|
|
1518
|
-
branch,
|
|
1519
|
-
path: wtPath,
|
|
1520
|
-
session: values["no-session"] ? null : sessionName,
|
|
1521
|
-
}),
|
|
1522
|
-
);
|
|
1523
|
-
} else if (values["no-session"]) {
|
|
1524
|
-
console.log(`Worktree ready: ${wtPath}`);
|
|
1525
|
-
console.log(`Open a session later: tmux-ide worktree open '${branch}'`);
|
|
1526
|
-
} else {
|
|
1527
|
-
printSwitchHint(sessionName, wtPath);
|
|
1528
|
-
}
|
|
1529
|
-
break;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
if (sub === "open") {
|
|
1533
|
-
const branch = positionals[2];
|
|
1534
|
-
if (!branch) {
|
|
1535
|
-
throw new IdeError("Usage: tmux-ide worktree open <branch>", {
|
|
1536
|
-
code: "USAGE",
|
|
1537
|
-
exitCode: 1,
|
|
1538
|
-
});
|
|
1539
|
-
}
|
|
1540
|
-
const entry = worktrees.find((w) => w.branch === branch);
|
|
1541
|
-
if (!entry) {
|
|
1542
|
-
throw new IdeError(
|
|
1543
|
-
`No worktree for branch "${branch}". Create one with: tmux-ide worktree create '${branch}'`,
|
|
1544
|
-
{ code: "USAGE", exitCode: 1 },
|
|
1545
|
-
);
|
|
1546
|
-
}
|
|
1547
|
-
const sessionName = worktreeSessionName(projectName, branch);
|
|
1548
|
-
const already = hasSession(sessionName);
|
|
1549
|
-
if (!already) await openWorktreeSession(entry.path, sessionName);
|
|
1550
|
-
if (json) {
|
|
1551
|
-
console.log(
|
|
1552
|
-
JSON.stringify({ branch, path: entry.path, session: sessionName, created: !already }),
|
|
1553
|
-
);
|
|
1554
|
-
} else {
|
|
1555
|
-
if (already) console.log(`Session already running.`);
|
|
1556
|
-
printSwitchHint(sessionName, entry.path);
|
|
1557
|
-
}
|
|
1558
|
-
break;
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
if (sub === "remove") {
|
|
1562
|
-
const branch = positionals[2];
|
|
1563
|
-
if (!branch) {
|
|
1564
|
-
throw new IdeError("Usage: tmux-ide worktree remove <branch> [--force]", {
|
|
1565
|
-
code: "USAGE",
|
|
1566
|
-
exitCode: 1,
|
|
1567
|
-
});
|
|
1568
|
-
}
|
|
1569
|
-
const entry = worktrees.find((w) => w.branch === branch);
|
|
1570
|
-
if (!entry) {
|
|
1571
|
-
throw new IdeError(`No worktree for branch "${branch}".`, {
|
|
1572
|
-
code: "USAGE",
|
|
1573
|
-
exitCode: 1,
|
|
1574
|
-
});
|
|
1575
|
-
}
|
|
1576
|
-
// Remove the worktree FIRST so a failed removal (e.g. dirty without
|
|
1577
|
-
// --force, which throws here) never orphan-kills the still-usable
|
|
1578
|
-
// session. Only after a clean removal do we kill ONLY this worktree's
|
|
1579
|
-
// own session (never the parent repo's or a user session — the name is
|
|
1580
|
-
// fully derived from the worktree's branch).
|
|
1581
|
-
removeWorktree(repoDir, entry.path, { force: values.force === true });
|
|
1582
|
-
const sessionName = worktreeSessionName(projectName, branch);
|
|
1583
|
-
const killed = hasSession(sessionName) ? killSession(sessionName).stopped : false;
|
|
1584
|
-
if (json) {
|
|
1585
|
-
console.log(
|
|
1586
|
-
JSON.stringify({ branch, path: entry.path, sessionKilled: killed, removed: true }),
|
|
1587
|
-
);
|
|
1588
|
-
} else {
|
|
1589
|
-
console.log(`Removed worktree ${entry.path}${killed ? ` (killed ${sessionName})` : ""}.`);
|
|
1590
|
-
}
|
|
1591
|
-
break;
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
// sub === "list"
|
|
1595
|
-
const { createStatusTracker } = await import("../packages/daemon/src/tui/detect/classify.ts");
|
|
1596
|
-
const { listTeamSessions } = await import("../packages/daemon/src/tui/team/sessions.ts");
|
|
1597
|
-
const sessions = listTeamSessions(createStatusTracker());
|
|
1598
|
-
const rows = worktrees.map((wt) => {
|
|
1599
|
-
const isPrimary = wt.path === mainPath;
|
|
1600
|
-
const candidates: string[] = [];
|
|
1601
|
-
if (isPrimary) candidates.push(projectName);
|
|
1602
|
-
if (wt.branch) candidates.push(worktreeSessionName(projectName, wt.branch));
|
|
1603
|
-
const match = sessions.find((s) => candidates.includes(s.name)) ?? null;
|
|
1604
|
-
return {
|
|
1605
|
-
path: wt.path,
|
|
1606
|
-
branch: wt.branch,
|
|
1607
|
-
primary: isPrimary,
|
|
1608
|
-
session: match?.name ?? null,
|
|
1609
|
-
running: match !== null,
|
|
1610
|
-
status: match?.status ?? null,
|
|
1611
|
-
};
|
|
1612
|
-
});
|
|
1613
|
-
if (json) {
|
|
1614
|
-
console.log(JSON.stringify({ repo: mainPath, worktrees: rows }, null, 2));
|
|
1615
|
-
} else if (rows.length === 0) {
|
|
1616
|
-
console.log("No worktrees.");
|
|
1617
|
-
} else {
|
|
1618
|
-
for (const r of rows) {
|
|
1619
|
-
const tag = r.primary ? " (primary)" : "";
|
|
1620
|
-
const state = r.running ? `${r.status} · ${r.session}` : "no session";
|
|
1621
|
-
console.log(`${r.branch ?? "(detached)"}${tag} ${state}\n ${r.path}`);
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
break;
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
case "update": {
|
|
1628
|
-
// `--manifests`: fetch the agent-detection manifest pack (versioned JSON,
|
|
1629
|
-
// a GitHub release asset) into ~/.tmux-ide/agent-detection/pack/ — the
|
|
1630
|
-
// loader hot-merges it under bundled<pack<user precedence. Schema-invalid
|
|
1631
|
-
// packs are rejected loudly. See lib/manifest-pack.ts for the format.
|
|
1632
|
-
if (values["manifests"] === true) {
|
|
1633
|
-
const { updateManifestPack } = await import("../packages/daemon/src/lib/manifest-pack.ts");
|
|
1634
|
-
try {
|
|
1635
|
-
const r = await updateManifestPack({ log: (m) => console.error(m) });
|
|
1636
|
-
if (json) {
|
|
1637
|
-
console.log(JSON.stringify({ ok: true, ...r }, null, 2));
|
|
1638
|
-
} else {
|
|
1639
|
-
console.log(
|
|
1640
|
-
`manifest pack ${r.packVersion} installed (${r.count} manifests): ${r.path}`,
|
|
1641
|
-
);
|
|
1642
|
-
console.log(
|
|
1643
|
-
"your own agent-detection/*.json overrides still win — the pack merges beneath them",
|
|
1644
|
-
);
|
|
1645
|
-
}
|
|
1646
|
-
} catch (err) {
|
|
1647
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1648
|
-
if (json) console.log(JSON.stringify({ ok: false, error: message }, null, 2));
|
|
1649
|
-
else console.error(`manifest pack NOT installed: ${message}`);
|
|
1650
|
-
process.exitCode = 1;
|
|
1651
|
-
}
|
|
1652
|
-
break;
|
|
1653
|
-
}
|
|
1654
|
-
// `--tui-binary`: download the per-platform TUI binary (the fallback that
|
|
1655
|
-
// lets an npm install with no bun run the full cockpit). Explicit opt-in —
|
|
1656
|
-
// never auto-fetched on install (it's ~70MB). See lib/tui-binary.ts.
|
|
1657
|
-
if (values["tui-binary"] === true) {
|
|
1658
|
-
const { downloadTuiBinary } = await import("../packages/daemon/src/lib/tui-binary.ts");
|
|
1659
|
-
const { path } = await downloadTuiBinary({ log: (m) => console.error(m) });
|
|
1660
|
-
if (json) {
|
|
1661
|
-
console.log(JSON.stringify({ ok: true, path }, null, 2));
|
|
1662
|
-
} else {
|
|
1663
|
-
console.log(`TUI binary ready: ${path}`);
|
|
1664
|
-
}
|
|
1665
|
-
break;
|
|
1666
|
-
}
|
|
1667
|
-
// Detect how tmux-ide was installed and act on the pending update: a dev
|
|
1668
|
-
// checkout prints the `git pull` hint; a global install prints (with
|
|
1669
|
-
// --dry-run) or runs its package manager's update command. `__dirname` is
|
|
1670
|
-
// this CLI's own directory — the anchor for the git-checkout probe + the
|
|
1671
|
-
// package-manager path heuristic (see lib/update.ts).
|
|
1672
|
-
const { runUpdate } = await import("../packages/daemon/src/lib/update.ts");
|
|
1673
|
-
const dryRun = values["dry-run"] === true;
|
|
1674
|
-
const plan = runUpdate({ cliDir: __dirname, dryRun });
|
|
1675
|
-
if (!dryRun) {
|
|
1676
|
-
// The managed skill copy has to track the CLI. A global install refreshes
|
|
1677
|
-
// it via the package's own postinstall (which just ran); a dev checkout
|
|
1678
|
-
// has no postinstall, so `tmux-ide update` IS the checkout's refresh path
|
|
1679
|
-
// — sync the skill directly here.
|
|
1680
|
-
const { syncSkill } = await import("../packages/daemon/src/lib/skill-sync.ts");
|
|
1681
|
-
if (plan.method === "dev") {
|
|
1682
|
-
const result = syncSkill();
|
|
1683
|
-
console.log("");
|
|
1684
|
-
console.log(`skill: ${result.action} → ${result.path} (v${result.to})`);
|
|
1685
|
-
} else {
|
|
1686
|
-
console.log("");
|
|
1687
|
-
console.log("skill: refreshed by the package postinstall (~/.claude/skills/tmux-ide)");
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
break;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
case "skill-sync": {
|
|
1694
|
-
// The universal manual refresh of the managed Claude Code skill copy.
|
|
1695
|
-
// Fully-managed dir: overwrite is correct; version-equal is a no-op.
|
|
1696
|
-
const { syncSkill } = await import("../packages/daemon/src/lib/skill-sync.ts");
|
|
1697
|
-
const result = syncSkill();
|
|
1698
|
-
if (json) {
|
|
1699
|
-
console.log(JSON.stringify(result, null, 2));
|
|
1700
|
-
} else {
|
|
1701
|
-
const detail =
|
|
1702
|
-
result.action === "updated" && result.from
|
|
1703
|
-
? ` (v${result.from} → v${result.to})`
|
|
1704
|
-
: ` (v${result.to})`;
|
|
1705
|
-
console.log(`skill ${result.action}${detail}: ${result.path}`);
|
|
1706
|
-
}
|
|
1707
|
-
break;
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
case "serve": {
|
|
1711
|
-
// The local control socket (M23.3): NDJSON verbs + pushed agent-status
|
|
1712
|
-
// events over a 0600 Unix socket. Foreground on purpose — the process
|
|
1713
|
-
// the user (or their agent loop) started is the process they own; see
|
|
1714
|
-
// the host tradeoff in control/server.ts.
|
|
1715
|
-
const { startControlServer, defaultControlSocketPath } =
|
|
1716
|
-
await import("../packages/daemon/src/control/server.ts");
|
|
1717
|
-
const socketPath =
|
|
1718
|
-
typeof socketFlag === "string"
|
|
1719
|
-
? socketFlag
|
|
1720
|
-
: (positionals[1] ?? defaultControlSocketPath());
|
|
1721
|
-
const server = await startControlServer({
|
|
1722
|
-
socketPath,
|
|
1723
|
-
log: (m) => console.error(`[serve] ${m}`),
|
|
1724
|
-
});
|
|
1725
|
-
let closing = false;
|
|
1726
|
-
const shutdown = () => {
|
|
1727
|
-
if (closing) return;
|
|
1728
|
-
closing = true;
|
|
1729
|
-
// Unlinks the socket and EOFs every client before exiting.
|
|
1730
|
-
void server.close().then(() => process.exit(0));
|
|
1731
|
-
};
|
|
1732
|
-
process.on("SIGTERM", shutdown);
|
|
1733
|
-
process.on("SIGINT", shutdown);
|
|
1734
|
-
await new Promise(() => {}); // the server owns the process lifetime
|
|
1735
|
-
break;
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
case "command-center": {
|
|
1739
|
-
const { startCommandCenter } = await import("../packages/daemon/src/command-center/index.ts");
|
|
1740
|
-
await startCommandCenter({ port: parseInt(values.port ?? "4000") });
|
|
1741
|
-
break;
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
case "server": {
|
|
1745
|
-
if ("bun" in process.versions) {
|
|
1746
|
-
const scriptPath = resolve(__dirname, "../packages/daemon/src/server/standalone.ts");
|
|
1747
|
-
const serverArgs = ["--experimental-strip-types", scriptPath];
|
|
1748
|
-
if (values.port) serverArgs.push("--port", values.port);
|
|
1749
|
-
execFileSync("node", serverArgs, { stdio: "inherit" });
|
|
1750
|
-
} else {
|
|
1751
|
-
const { start } = await import("../packages/daemon/src/server/index.ts");
|
|
1752
|
-
await start(values.port ? parseInt(values.port, 10) : undefined);
|
|
1753
|
-
}
|
|
1754
|
-
break;
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
case "help":
|
|
1758
|
-
printHelp();
|
|
1759
|
-
break;
|
|
1760
|
-
|
|
1761
|
-
default:
|
|
1762
|
-
throw new IdeError(`Unknown command: ${command}\nRun "tmux-ide help" for usage.`, {
|
|
1763
|
-
code: "USAGE",
|
|
1764
|
-
exitCode: 1,
|
|
1765
|
-
});
|
|
1766
|
-
}
|
|
1767
|
-
} catch (error) {
|
|
1768
|
-
if (error instanceof IdeError) {
|
|
1769
|
-
printCommandError(error, { json });
|
|
1770
|
-
} else {
|
|
1771
|
-
throw error;
|
|
1772
|
-
}
|
|
1773
|
-
}
|