tmux-ide 2.9.2 → 2.9.4
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/LICENSE +1 -1
- package/README.md +121 -140
- package/bin/cli.js +2457 -727
- package/package.json +23 -8
- package/packages/contracts/src/desktop-host.ts +3 -0
- package/packages/contracts/src/saved-machines.ts +19 -0
- package/packages/contracts/src/terminal-replica.ts +1 -1
- package/packages/core/package.json +3 -2
- package/packages/core/src/terminal-delivery.ts +51 -3
- package/packages/core/src/terminal-fnv64-wasm.ts +4 -3
- package/packages/core/src/terminal-replica-hash-cache.ts +129 -31
- package/packages/core/src/terminal-replica-owned-row.ts +27 -0
- package/packages/core/src/terminal-replica.ts +13 -28
- package/packages/daemon/dist/command-center/daemon-fleet-facts-observer.js +96 -10
- package/packages/daemon/dist/command-center/resources/saved-machine-route.js +40 -1
- package/packages/daemon/dist/command-center/ws-events.js +5 -24
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.js +8 -0
- package/packages/daemon/dist/lib/canonical-daemon.js +28 -2
- package/packages/daemon/dist/lib/daemon-embed.js +1 -1
- package/packages/daemon/dist/lib/daemon-service-manager.js +122 -0
- package/packages/daemon/dist/lib/daemon-service-plan.js +127 -0
- package/packages/daemon/dist/lib/daemon-service.js +259 -0
- package/packages/daemon/dist/lib/install-origin.js +2 -0
- package/packages/daemon/dist/lib/local-fleet-request.js +9 -3
- package/packages/daemon/dist/lib/log.js +6 -10
- package/packages/daemon/dist/lib/managed-installer-update.js +67 -0
- package/packages/daemon/dist/lib/{tui-download-lock.js → private-operation-lock.js} +11 -11
- package/packages/daemon/dist/lib/remote-daemon-info.js +3 -2
- package/packages/daemon/dist/lib/remote-daemon-lifecycle.js +4 -4
- package/packages/daemon/dist/lib/remote-tmux-command.js +10 -0
- package/packages/daemon/dist/lib/runtime-namespace.js +28 -16
- package/packages/daemon/dist/lib/saved-machines.js +40 -2
- package/packages/daemon/dist/lib/ssh-daemon-transport.js +24 -9
- package/packages/daemon/dist/lib/tmux-server-owner.js +1 -1
- package/packages/daemon/dist/lib/tmux-server-registration.js +21 -3
- package/packages/daemon/dist/lib/tui-binary.js +2 -2
- package/packages/daemon/dist/lib/update.js +18 -0
- package/packages/daemon/dist/lib/workspace-multiplexer-verbs.js +24 -1
- package/packages/daemon/dist/machines.js +40 -4
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +2 -2
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +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 +2 -2
- package/packages/daemon/dist/terminal/attachments/direct-websocket.js +4 -1
- package/packages/daemon/dist/terminal/attachments/native-runtime.js +22 -13
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +101 -3
- package/packages/daemon/dist/terminal/mirror/registered-window-guard.js +62 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.js +75 -4
- package/packages/daemon/dist/terminal/mirror/shared-window-index.js +45 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +11 -1
- package/packages/daemon/dist/terminal/session-runtime/multiplexer-backend.js +1 -0
- package/packages/daemon/dist/terminal/session-runtime/registry.js +56 -7
- package/packages/daemon/dist/terminal/session-runtime/semantic-mutation-executor.js +3 -1
- package/packages/daemon/dist/tui/integrations/claude-agent-teams.js +264 -0
- package/packages/daemon/dist/tui/mirror/dialog-model.js +2 -35
- package/packages/daemon/dist/tui/mirror/runtime/application-daemon-authority-owner.js +8 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-fleet.js +20 -2
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agents.js +7 -1
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-authority.js +59 -9
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-navigation.js +27 -19
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-sidebar.jsx +23 -18
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-startup.js +31 -2
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-search-owner.js +7 -3
- package/packages/daemon/dist/tui/mirror/runtime/application-performance-log.js +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-input-ingress.js +146 -2
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +201 -50
- package/packages/daemon/dist/tui/mirror/runtime/bounded-performance-record-writer.js +50 -10
- package/packages/daemon/dist/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.js +6 -5
- package/packages/daemon/dist/tui/mirror/runtime/terminal-pane-input-router.js +3 -0
- package/packages/daemon/dist/tui/mirror/runtime/workspace-terminal-fast-lane.js +8 -2
- package/packages/daemon/dist/tui/mirror/terminal-text.js +35 -0
- package/packages/daemon/dist/tui/mirror/workspace/connection-feedback.js +5 -3
- package/packages/daemon/src/command-center/daemon-fleet-facts-observer.ts +100 -10
- package/packages/daemon/src/command-center/resources/saved-machine-route.ts +48 -1
- package/packages/daemon/src/command-center/ws-events.ts +5 -25
- package/packages/daemon/src/lib/canonical-daemon-bootstrap.ts +12 -0
- package/packages/daemon/src/lib/canonical-daemon.ts +44 -2
- package/packages/daemon/src/lib/daemon-embed.ts +1 -0
- package/packages/daemon/src/lib/daemon-service-manager.ts +152 -0
- package/packages/daemon/src/lib/daemon-service-plan.ts +153 -0
- package/packages/daemon/src/lib/daemon-service.ts +301 -0
- package/packages/daemon/src/lib/install-origin.ts +5 -0
- package/packages/daemon/src/lib/local-fleet-request.ts +19 -3
- package/packages/daemon/src/lib/log.ts +13 -9
- package/packages/daemon/src/lib/managed-installer-update.ts +79 -0
- package/packages/daemon/src/lib/{tui-download-lock.ts → private-operation-lock.ts} +15 -11
- package/packages/daemon/src/lib/remote-daemon-info.ts +3 -3
- package/packages/daemon/src/lib/remote-daemon-lifecycle.ts +4 -4
- package/packages/daemon/src/lib/remote-tmux-command.ts +12 -0
- package/packages/daemon/src/lib/runtime-namespace.ts +27 -18
- package/packages/daemon/src/lib/saved-machines.ts +40 -1
- package/packages/daemon/src/lib/ssh-daemon-transport.ts +25 -7
- package/packages/daemon/src/lib/tmux-server-owner.ts +1 -0
- package/packages/daemon/src/lib/tmux-server-registration.ts +21 -3
- package/packages/daemon/src/lib/tui-binary.ts +2 -2
- package/packages/daemon/src/lib/update.ts +24 -0
- package/packages/daemon/src/lib/workspace-multiplexer-verbs.ts +22 -0
- package/packages/daemon/src/machines.ts +53 -5
- package/packages/daemon/src/terminal/attachments/direct-websocket.ts +8 -2
- package/packages/daemon/src/terminal/attachments/native-runtime.ts +28 -13
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +105 -3
- package/packages/daemon/src/terminal/mirror/registered-window-guard.ts +66 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +92 -4
- package/packages/daemon/src/terminal/mirror/shared-window-index.ts +42 -0
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +12 -1
- package/packages/daemon/src/terminal/session-runtime/multiplexer-backend.ts +2 -0
- package/packages/daemon/src/terminal/session-runtime/registry.ts +70 -8
- package/packages/daemon/src/terminal/session-runtime/semantic-mutation-executor.ts +3 -1
- package/packages/daemon/src/tui/integrations/claude-agent-teams.ts +334 -0
- package/packages/daemon/src/tui/mirror/dialog-model.ts +2 -32
- package/packages/daemon/src/tui/mirror/runtime/application-daemon-authority-owner.ts +8 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-fleet.ts +19 -2
- package/packages/daemon/src/tui/mirror/runtime/application-machine-agents.ts +6 -1
- package/packages/daemon/src/tui/mirror/runtime/application-machine-authority.ts +60 -11
- package/packages/daemon/src/tui/mirror/runtime/application-machine-navigation.ts +39 -33
- package/packages/daemon/src/tui/mirror/runtime/application-machine-sidebar.tsx +31 -23
- package/packages/daemon/src/tui/mirror/runtime/application-machine-startup.ts +38 -2
- package/packages/daemon/src/tui/mirror/runtime/application-palette-search-owner.ts +7 -4
- package/packages/daemon/src/tui/mirror/runtime/application-performance-log.ts +3 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +1 -1
- package/packages/daemon/src/tui/mirror/runtime/application-shell-view.tsx +47 -46
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-input-ingress.ts +165 -2
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +207 -53
- package/packages/daemon/src/tui/mirror/runtime/bounded-performance-record-writer.ts +49 -9
- package/packages/daemon/src/tui/mirror/runtime/terminal-fast-lane-renderer-adapter.ts +6 -5
- package/packages/daemon/src/tui/mirror/runtime/terminal-pane-input-router.ts +4 -0
- package/packages/daemon/src/tui/mirror/runtime/workspace-terminal-fast-lane.ts +8 -3
- package/packages/daemon/src/tui/mirror/terminal-text.ts +32 -0
- package/packages/daemon/src/tui/mirror/workspace/connection-feedback.ts +6 -3
- package/packages/daemon-client/src/fleet-connection-status.ts +10 -1
- package/packages/daemon-client/src/workspace-client.ts +4 -1
- package/skill/SKILL.md +30 -30
- package/packages/contracts/src/__tests__/actions-contract.test.ts +0 -119
- package/packages/contracts/src/__tests__/agent-graph-overlay.test.ts +0 -428
- package/packages/contracts/src/__tests__/app-window-mutation.test.ts +0 -51
- package/packages/contracts/src/__tests__/app-window-state.test.ts +0 -34
- package/packages/contracts/src/__tests__/application-shell.test.ts +0 -645
- package/packages/contracts/src/__tests__/automation-operations.test.ts +0 -78
- package/packages/contracts/src/__tests__/causal-cell.test.ts +0 -47
- package/packages/contracts/src/__tests__/client-view-state.test.ts +0 -115
- package/packages/contracts/src/__tests__/cohesion-fixture.test.ts +0 -106
- package/packages/contracts/src/__tests__/commands.test.ts +0 -86
- package/packages/contracts/src/__tests__/control.test.ts +0 -154
- package/packages/contracts/src/__tests__/daemon-events.test.ts +0 -405
- package/packages/contracts/src/__tests__/daemon-resources.test.ts +0 -143
- package/packages/contracts/src/__tests__/daemon-wire.test.ts +0 -149
- package/packages/contracts/src/__tests__/desktop-host.test.ts +0 -269
- package/packages/contracts/src/__tests__/desktop-missions.test.ts +0 -215
- package/packages/contracts/src/__tests__/experience-conformance.test.ts +0 -153
- package/packages/contracts/src/__tests__/experience-kernel-boundary.test.ts +0 -113
- package/packages/contracts/src/__tests__/experience-shell.test.ts +0 -65
- package/packages/contracts/src/__tests__/fixtures/daemon-wire-v2.json +0 -35
- package/packages/contracts/src/__tests__/fixtures/daemon-wire-v3.json +0 -35
- package/packages/contracts/src/__tests__/fixtures/daemon-wire-v4.json +0 -35
- package/packages/contracts/src/__tests__/fixtures/scoped-receipt.ts +0 -62
- package/packages/contracts/src/__tests__/fleet-agent-graph.test.ts +0 -231
- package/packages/contracts/src/__tests__/fleet-catalog.test.ts +0 -270
- package/packages/contracts/src/__tests__/fleet-lifecycle.test.ts +0 -62
- package/packages/contracts/src/__tests__/focus-overlay.test.ts +0 -110
- package/packages/contracts/src/__tests__/ide-config.test.ts +0 -64
- package/packages/contracts/src/__tests__/interaction-evidence.test.ts +0 -288
- package/packages/contracts/src/__tests__/interaction-receipt-v2.test.ts +0 -72
- package/packages/contracts/src/__tests__/issue-error.test.ts +0 -78
- package/packages/contracts/src/__tests__/mission-projections.test.ts +0 -186
- package/packages/contracts/src/__tests__/missions.test.ts +0 -272
- package/packages/contracts/src/__tests__/multiplexer-verbs.test.ts +0 -242
- package/packages/contracts/src/__tests__/pane-appearance.test.ts +0 -146
- package/packages/contracts/src/__tests__/pane-read-result.test.ts +0 -55
- package/packages/contracts/src/__tests__/pane-stream.test.ts +0 -536
- package/packages/contracts/src/__tests__/pane-widget-marker.test.ts +0 -327
- package/packages/contracts/src/__tests__/performance-metrics.test.ts +0 -73
- package/packages/contracts/src/__tests__/performance-qualification.test.ts +0 -137
- package/packages/contracts/src/__tests__/rich-card-widget.test.ts +0 -29
- package/packages/contracts/src/__tests__/session-runtime.test.ts +0 -512
- package/packages/contracts/src/__tests__/startup-readiness.test.ts +0 -409
- package/packages/contracts/src/__tests__/terminal-attachment-stream.test.ts +0 -72
- package/packages/contracts/src/__tests__/terminal-attachments.test.ts +0 -329
- package/packages/contracts/src/__tests__/terminal-delivery.test.ts +0 -88
- package/packages/contracts/src/__tests__/terminal-runtime-inventory.test.ts +0 -68
- package/packages/contracts/src/__tests__/terminals.test.ts +0 -87
- package/packages/contracts/src/__tests__/tmux-server-scope.test.ts +0 -166
- package/packages/contracts/src/__tests__/transport-contract-loading.test.ts +0 -91
- package/packages/contracts/src/__tests__/visual-tokens.test.ts +0 -224
- package/packages/contracts/src/__tests__/window-links.test.ts +0 -243
- package/packages/contracts/src/__tests__/workspace-changes-resource.test.ts +0 -317
- package/packages/contracts/src/__tests__/workspace-changes-view.test.ts +0 -122
- package/packages/contracts/src/__tests__/workspace-config.test.ts +0 -294
- package/packages/contracts/src/__tests__/workspace-files-resource.test.ts +0 -261
- package/packages/contracts/src/__tests__/workspace-files-tree.test.ts +0 -147
- package/packages/contracts/src/__tests__/workspace-pane-creation.test.ts +0 -249
- package/packages/contracts/src/__tests__/workspace-promotion.test.ts +0 -94
- package/packages/contracts/src/__tests__/workspace-resource-identity.test.ts +0 -90
- package/packages/contracts/src/daemon-resource-request.test.ts +0 -192
- package/packages/contracts/src/native-operation-identity.test.ts +0 -23
- package/packages/contracts/src/workspace-admission.test.ts +0 -21
- package/packages/contracts/src/workspace-catalog-resource.test.ts +0 -146
- package/packages/core/src/agent-provisioning.test.ts +0 -42
- package/packages/core/src/application-shell-session.test.ts +0 -105
- package/packages/core/src/interaction-evidence.test.ts +0 -134
- package/packages/core/src/interaction-flow.test.ts +0 -66
- package/packages/core/src/interaction-receipts.test.ts +0 -671
- package/packages/core/src/navigator.test.ts +0 -34
- package/packages/core/src/optimistic-projection-conformance.test.ts +0 -75
- package/packages/core/src/optimistic-projection.test.ts +0 -118
- package/packages/core/src/performance-metrics.test.ts +0 -121
- package/packages/core/src/performance-qualification.test.ts +0 -283
- package/packages/core/src/saved-machines.test.ts +0 -80
- package/packages/core/src/terminal-compact-cold.test.ts +0 -87
- package/packages/core/src/terminal-conformance.test.ts +0 -48
- package/packages/core/src/terminal-delivery-cache-lifetime.test.ts +0 -167
- package/packages/core/src/terminal-delivery-encode-cooperative.test.ts +0 -140
- package/packages/core/src/terminal-delivery-representation-hash.test.ts +0 -77
- package/packages/core/src/terminal-delivery.test.ts +0 -1471
- package/packages/core/src/terminal-fnv64-wasm.test.ts +0 -61
- package/packages/core/src/terminal-replica-cold.test.ts +0 -31
- package/packages/core/src/terminal-replica-cooperative.test.ts +0 -170
- package/packages/core/src/terminal-replica-hash-cache.test.ts +0 -283
- package/packages/core/src/terminal-replica.test.ts +0 -347
- package/packages/core/src/workspace-selection.test.ts +0 -63
- package/packages/daemon/dist/__tests__/support.js +0 -33
- package/packages/daemon/dist/lib/__tests__/fixtures/workspace-state-writer.js +0 -58
- package/packages/daemon/dist/lib/__tests__/installed-recovery-fixture.js +0 -400
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.js +0 -182
- package/packages/daemon/dist/terminal/mirror/__tests__/scripted-channel.js +0 -98
- package/packages/daemon/dist/terminal/mirror/__tests__/simulated-channel.js +0 -156
- package/packages/daemon/src/tui/mirror/__snapshots__/activity-surface-renderer.test.tsx.snap +0 -42
- package/packages/daemon/src/tui/mirror/__snapshots__/changes-terminal-surface-renderer.test.tsx.snap +0 -267
- package/packages/daemon/src/tui/mirror/__snapshots__/home-files-surface-renderer.test.tsx.snap +0 -267
- package/packages/daemon/src/tui/mirror/__snapshots__/missions-surface-renderer.test.tsx.snap +0 -134
- package/packages/daemon/src/tui/mirror/__snapshots__/recipes-gallery-renderer.test.tsx.snap +0 -141
- package/packages/daemon/src/tui/mirror/__snapshots__/shell-chrome-renderer.test.tsx.snap +0 -134
- package/packages/daemon/src/tui/mirror/runtime/__snapshots__/application-shell-view-renderer.test.tsx.snap +0 -87
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/agent-terminal-canvas-renderer.test.tsx.snap +0 -348
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/application-shell-renderer.test.tsx.snap +0 -134
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/command-palette-surface-renderer.test.tsx.snap +0 -255
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/pane-frame-renderer.test.tsx.snap +0 -525
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/terminal-pane-header-polish-renderer.test.tsx.snap +0 -31
- package/packages/daemon/src/tui/mirror/workspace/__snapshots__/workbench-shell-renderer.test.tsx.snap +0 -134
- package/packages/daemon-client/src/application-shell-session.test.ts +0 -196
- package/packages/daemon-client/src/automation-client.test.ts +0 -214
- package/packages/daemon-client/src/bootstrap-coordinator.test.ts +0 -145
- package/packages/daemon-client/src/connection-supervisor.test.ts +0 -109
- package/packages/daemon-client/src/direct-application-shell-transport.test.ts +0 -941
- package/packages/daemon-client/src/first-latest-coordinator.test.ts +0 -175
- package/packages/daemon-client/src/fleet-dial-scheduler.test.ts +0 -114
- package/packages/daemon-client/src/fleet-environments.test.ts +0 -40
- package/packages/daemon-client/src/generation-bound-store-timers.test.ts +0 -74
- package/packages/daemon-client/src/owner-action-client.test.ts +0 -245
- package/packages/daemon-client/src/pane-stream-client.test.ts +0 -2841
- package/packages/daemon-client/src/pane-stream-clock-calibration.test.ts +0 -207
- package/packages/daemon-client/src/pane-stream-loopback-benchmark.test.ts +0 -51
- package/packages/daemon-client/src/push-resource-session.test.ts +0 -509
- package/packages/daemon-client/src/resource-replica.test.ts +0 -186
- package/packages/daemon-client/src/runtime-resource-ledger.test.ts +0 -18
- package/packages/daemon-client/src/scoped-tmux-server-transport.test.ts +0 -114
- package/packages/daemon-client/src/terminal-fast-lane.test.ts +0 -835
- package/packages/daemon-client/src/tmux-server-client.test.ts +0 -279
- package/packages/daemon-client/src/tmux-server-interaction-events.test.ts +0 -230
- package/packages/daemon-client/src/workspace-catalog-v2.test.ts +0 -109
- package/packages/daemon-client/src/workspace-client-boundaries.test.ts +0 -59
- package/packages/daemon-client/src/workspace-client-operations.test.ts +0 -96
- package/packages/daemon-client/src/workspace-client.test.ts +0 -2912
- package/packages/daemon-client/src/workspace-event-supervisor.test.ts +0 -1086
- package/packages/daemon-client/src/workspace-pane-client.test.ts +0 -80
- package/packages/presentation/src/presentation-contract.test.ts +0 -63
- package/packages/tmux-bridge/src/runner.test.ts +0 -614
- package/packages/tmux-bridge/src/targeting.test.ts +0 -107
|
@@ -1,645 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
APPLICATION_SHELL_COMMAND_ARGUMENT_SCHEMAS,
|
|
4
|
-
APPLICATION_SHELL_COMMAND_DEFINITIONS,
|
|
5
|
-
APPLICATION_SHELL_COMMAND_DESCRIPTORS,
|
|
6
|
-
ApplicationShellActionTraceV1SchemaZ,
|
|
7
|
-
ApplicationShellCommandInvocationSchemaZ,
|
|
8
|
-
ApplicationShellProjectionV1SchemaZ,
|
|
9
|
-
ApplicationShellProjectionInputV1SchemaZ,
|
|
10
|
-
ApplicationShellProjectionInputV2SchemaZ,
|
|
11
|
-
ApplicationShellProjectionInputV3SchemaZ,
|
|
12
|
-
ApplicationShellTerminalResourceSchemaZ,
|
|
13
|
-
TerminalResourceAttachabilitySchemaZ,
|
|
14
|
-
TerminalResourceUnavailableReasonSchemaZ,
|
|
15
|
-
TerminalWindowResourceIdSchemaZ,
|
|
16
|
-
applyApplicationShellInvocationV1,
|
|
17
|
-
applicationShellActionTraceV1,
|
|
18
|
-
applicationShellCommandInvocation,
|
|
19
|
-
applicationShellCommandDescriptor,
|
|
20
|
-
projectApplicationShellV1,
|
|
21
|
-
replayApplicationShellActionTraceV1,
|
|
22
|
-
} from "../application-shell.ts";
|
|
23
|
-
import {
|
|
24
|
-
ApplicationShellResourceSchemaZ,
|
|
25
|
-
ApplicationShellResourceV1SchemaZ,
|
|
26
|
-
ApplicationShellResourceV2SchemaZ,
|
|
27
|
-
ApplicationShellResourceV3SchemaZ,
|
|
28
|
-
} from "../application-shell-resource.ts";
|
|
29
|
-
import { COHESION_FIXTURE_V1 } from "../cohesion-fixture.ts";
|
|
30
|
-
import {
|
|
31
|
-
APPLICATION_SHELL_COMMAND_IDS,
|
|
32
|
-
ApplicationShellCommandIdSchemaZ,
|
|
33
|
-
CommandDescriptorSchemaZ,
|
|
34
|
-
CommandInvocationSchemaZ,
|
|
35
|
-
} from "../commands.ts";
|
|
36
|
-
import {
|
|
37
|
-
CANONICAL_SHELL_AREAS,
|
|
38
|
-
CANONICAL_SURFACE_REGISTRY,
|
|
39
|
-
commandsToOpenSurface,
|
|
40
|
-
} from "../experience-shell.ts";
|
|
41
|
-
|
|
42
|
-
const serialized = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T;
|
|
43
|
-
|
|
44
|
-
function mutableDataPaths(value: unknown, path = "value", findings: string[] = []): string[] {
|
|
45
|
-
if (!value || typeof value !== "object") return findings;
|
|
46
|
-
const prototype = Object.getPrototypeOf(value);
|
|
47
|
-
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null)
|
|
48
|
-
return findings;
|
|
49
|
-
if (!Object.isFrozen(value)) findings.push(path);
|
|
50
|
-
if (Array.isArray(value)) {
|
|
51
|
-
value.forEach((child, index) => mutableDataPaths(child, `${path}.${index}`, findings));
|
|
52
|
-
} else {
|
|
53
|
-
for (const [key, child] of Object.entries(value)) {
|
|
54
|
-
mutableDataPaths(child, `${path}.${key}`, findings);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return findings;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const closedOverlayFixture = {
|
|
61
|
-
...COHESION_FIXTURE_V1,
|
|
62
|
-
focus: { ...COHESION_FIXTURE_V1.focus, overlays: [] },
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
describe("semantic application shell", () => {
|
|
66
|
-
it("binds the REST resource to one strict daemon generation", () => {
|
|
67
|
-
const envelope = {
|
|
68
|
-
version: 1,
|
|
69
|
-
daemon: {
|
|
70
|
-
protocolVersion: 1,
|
|
71
|
-
productVersion: "2.8.0",
|
|
72
|
-
instanceId: "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
73
|
-
startedAt: "2026-07-21T00:00:00.000Z",
|
|
74
|
-
},
|
|
75
|
-
resource: {
|
|
76
|
-
project: COHESION_FIXTURE_V1.project,
|
|
77
|
-
workspace: COHESION_FIXTURE_V1.workspace,
|
|
78
|
-
dock: COHESION_FIXTURE_V1.dock,
|
|
79
|
-
focus: COHESION_FIXTURE_V1.focus,
|
|
80
|
-
connection: COHESION_FIXTURE_V1.connection,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
expect(ApplicationShellResourceV1SchemaZ.parse(envelope)).toEqual(envelope);
|
|
84
|
-
expect(
|
|
85
|
-
ApplicationShellResourceV1SchemaZ.safeParse({
|
|
86
|
-
...envelope,
|
|
87
|
-
daemon: { ...envelope.daemon, token: "secret" },
|
|
88
|
-
}).success,
|
|
89
|
-
).toBe(false);
|
|
90
|
-
expect(
|
|
91
|
-
ApplicationShellResourceV1SchemaZ.safeParse({
|
|
92
|
-
...envelope,
|
|
93
|
-
resource: {
|
|
94
|
-
...envelope.resource,
|
|
95
|
-
terminalInventory: { activeResourceId: null, resources: [] },
|
|
96
|
-
},
|
|
97
|
-
}).success,
|
|
98
|
-
).toBe(false);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("keeps terminal inventory optional while strictly preserving semantic resources", () => {
|
|
102
|
-
const legacy = projectApplicationShellV1(COHESION_FIXTURE_V1);
|
|
103
|
-
expect(legacy.terminalInventory).toBeUndefined();
|
|
104
|
-
expect(Object.prototype.hasOwnProperty.call(legacy, "terminalInventory")).toBe(false);
|
|
105
|
-
|
|
106
|
-
const input = {
|
|
107
|
-
...COHESION_FIXTURE_V1,
|
|
108
|
-
workspace: {
|
|
109
|
-
...COHESION_FIXTURE_V1.workspace,
|
|
110
|
-
sidebar: {
|
|
111
|
-
...COHESION_FIXTURE_V1.workspace.sidebar,
|
|
112
|
-
agents: COHESION_FIXTURE_V1.workspace.sidebar.agents.filter(
|
|
113
|
-
({ paneId }) => paneId === "pane.implementer",
|
|
114
|
-
),
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
terminalInventory: {
|
|
118
|
-
activeResourceId: "pane.implementer",
|
|
119
|
-
resources: [
|
|
120
|
-
{
|
|
121
|
-
id: "pane.implementer",
|
|
122
|
-
title: "Implementer",
|
|
123
|
-
kind: "agent" as const,
|
|
124
|
-
active: true,
|
|
125
|
-
interactionEndpoint: null,
|
|
126
|
-
nativeIdentity: null,
|
|
127
|
-
attachability: {
|
|
128
|
-
status: "available" as const,
|
|
129
|
-
semanticPaneId: "pane.implementer",
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: "terminal.discovered.shell",
|
|
134
|
-
title: "Shell",
|
|
135
|
-
kind: "terminal" as const,
|
|
136
|
-
active: false,
|
|
137
|
-
interactionEndpoint: null,
|
|
138
|
-
nativeIdentity: null,
|
|
139
|
-
attachability: {
|
|
140
|
-
status: "unavailable" as const,
|
|
141
|
-
reason: "missing-semantic-stamp" as const,
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
const projection = projectApplicationShellV1(input);
|
|
148
|
-
expect(projection.terminalInventory).toEqual(input.terminalInventory);
|
|
149
|
-
expect(ApplicationShellProjectionV1SchemaZ.parse(serialized(projection))).toEqual(projection);
|
|
150
|
-
expect(mutableDataPaths(projection.terminalInventory, "terminalInventory")).toEqual([]);
|
|
151
|
-
const v2Envelope = {
|
|
152
|
-
version: 2,
|
|
153
|
-
daemon: {
|
|
154
|
-
protocolVersion: 1,
|
|
155
|
-
productVersion: "2.8.0",
|
|
156
|
-
instanceId: "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
157
|
-
startedAt: "2026-07-21T00:00:00.000Z",
|
|
158
|
-
},
|
|
159
|
-
resource: {
|
|
160
|
-
project: input.project,
|
|
161
|
-
workspace: input.workspace,
|
|
162
|
-
dock: input.dock,
|
|
163
|
-
focus: input.focus,
|
|
164
|
-
connection: input.connection,
|
|
165
|
-
terminalInventory: input.terminalInventory,
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
expect(ApplicationShellResourceV2SchemaZ.parse(v2Envelope)).toEqual(v2Envelope);
|
|
169
|
-
expect(ApplicationShellResourceSchemaZ.parse(v2Envelope)).toEqual(v2Envelope);
|
|
170
|
-
const v3Envelope = {
|
|
171
|
-
...v2Envelope,
|
|
172
|
-
version: 3,
|
|
173
|
-
resource: {
|
|
174
|
-
...v2Envelope.resource,
|
|
175
|
-
appWindows: {
|
|
176
|
-
version: 1,
|
|
177
|
-
revision: 0,
|
|
178
|
-
updatedAt: "2026-07-21T00:00:00.000Z",
|
|
179
|
-
windows: {},
|
|
180
|
-
dockRoot: null,
|
|
181
|
-
dockState: { mode: "collapsed", preferredHeight: null, focusZone: "canvas" },
|
|
182
|
-
floatingOrder: [],
|
|
183
|
-
focusedWindowId: null,
|
|
184
|
-
activeLayoutId: null,
|
|
185
|
-
layouts: {},
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
expect(ApplicationShellProjectionInputV3SchemaZ.parse(v3Envelope.resource)).toEqual(
|
|
190
|
-
v3Envelope.resource,
|
|
191
|
-
);
|
|
192
|
-
expect(ApplicationShellResourceV3SchemaZ.parse(v3Envelope)).toEqual(v3Envelope);
|
|
193
|
-
expect(ApplicationShellResourceSchemaZ.parse(v3Envelope)).toEqual(v3Envelope);
|
|
194
|
-
|
|
195
|
-
expect(() =>
|
|
196
|
-
projectApplicationShellV1({
|
|
197
|
-
...input,
|
|
198
|
-
terminalInventory: {
|
|
199
|
-
activeResourceId: "pane.implementer",
|
|
200
|
-
resources: [input.terminalInventory.resources[0]!, input.terminalInventory.resources[0]!],
|
|
201
|
-
},
|
|
202
|
-
}),
|
|
203
|
-
).toThrow(/unique/u);
|
|
204
|
-
expect(() =>
|
|
205
|
-
projectApplicationShellV1({
|
|
206
|
-
...input,
|
|
207
|
-
terminalInventory: { ...input.terminalInventory, activeResourceId: null },
|
|
208
|
-
}),
|
|
209
|
-
).toThrow(/activeResourceId/u);
|
|
210
|
-
expect(() =>
|
|
211
|
-
projectApplicationShellV1({
|
|
212
|
-
...input,
|
|
213
|
-
terminalInventory: {
|
|
214
|
-
activeResourceId: "terminal.discovered.fallback",
|
|
215
|
-
resources: [
|
|
216
|
-
{
|
|
217
|
-
id: "terminal.discovered.fallback",
|
|
218
|
-
title: "Fallback",
|
|
219
|
-
kind: "terminal",
|
|
220
|
-
active: true,
|
|
221
|
-
interactionEndpoint: null,
|
|
222
|
-
nativeIdentity: null,
|
|
223
|
-
attachability: {
|
|
224
|
-
status: "available",
|
|
225
|
-
semanticPaneId: "terminal.discovered.fallback",
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
],
|
|
229
|
-
},
|
|
230
|
-
}),
|
|
231
|
-
).toThrow(/fallback/u);
|
|
232
|
-
|
|
233
|
-
// The open workspace's own fleet correlation key is additive and optional:
|
|
234
|
-
// a V3 resource without it still parses, and one carrying a valid opaque
|
|
235
|
-
// `session.<digest>` token preserves it while a raw name/path is rejected.
|
|
236
|
-
expect(ApplicationShellProjectionInputV3SchemaZ.parse(v3Envelope.resource).fleetSessionId).toBe(
|
|
237
|
-
undefined,
|
|
238
|
-
);
|
|
239
|
-
const withFleetId = {
|
|
240
|
-
...v3Envelope.resource,
|
|
241
|
-
fleetSessionId: "session.0123456789abcdef0123",
|
|
242
|
-
};
|
|
243
|
-
expect(ApplicationShellProjectionInputV3SchemaZ.parse(withFleetId)).toEqual(withFleetId);
|
|
244
|
-
for (const invalidFleetId of ["my-session", "/tmp/session", "$3", "session.short"]) {
|
|
245
|
-
expect(
|
|
246
|
-
ApplicationShellProjectionInputV3SchemaZ.safeParse({
|
|
247
|
-
...v3Envelope.resource,
|
|
248
|
-
fleetSessionId: invalidFleetId,
|
|
249
|
-
}).success,
|
|
250
|
-
).toBe(false);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
it("uses terminal attachment admission identity for available resources", () => {
|
|
255
|
-
for (const semanticPaneId of [
|
|
256
|
-
"pane:colon",
|
|
257
|
-
"constructor",
|
|
258
|
-
"__proto__",
|
|
259
|
-
".leading-dot",
|
|
260
|
-
`pane.${"x".repeat(124)}`,
|
|
261
|
-
"terminal.discovered.user-authored",
|
|
262
|
-
]) {
|
|
263
|
-
expect(
|
|
264
|
-
TerminalResourceAttachabilitySchemaZ.safeParse({
|
|
265
|
-
status: "available",
|
|
266
|
-
semanticPaneId,
|
|
267
|
-
}).success,
|
|
268
|
-
).toBe(false);
|
|
269
|
-
}
|
|
270
|
-
expect(
|
|
271
|
-
TerminalResourceAttachabilitySchemaZ.safeParse({
|
|
272
|
-
status: "available",
|
|
273
|
-
semanticPaneId: "pane.portable-worker_2",
|
|
274
|
-
}).success,
|
|
275
|
-
).toBe(true);
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
it("carries the additive window-level reasons and a wire-safe window grouping key", () => {
|
|
279
|
-
for (const reason of [
|
|
280
|
-
"missing-window-stamp",
|
|
281
|
-
"window-stamp-inconsistent",
|
|
282
|
-
"duplicate-window-stamp",
|
|
283
|
-
// Retained for wire compatibility.
|
|
284
|
-
"not-single-pane-window",
|
|
285
|
-
]) {
|
|
286
|
-
expect(TerminalResourceUnavailableReasonSchemaZ.safeParse(reason).success).toBe(true);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
expect(
|
|
290
|
-
TerminalWindowResourceIdSchemaZ.safeParse("terminal-window.0123456789abcdef0123").success,
|
|
291
|
-
).toBe(true);
|
|
292
|
-
// Only a namespaced 20-char digest — never a raw window stamp or runtime id.
|
|
293
|
-
for (const invalid of [
|
|
294
|
-
"window.abcdef0123456789",
|
|
295
|
-
"@7",
|
|
296
|
-
"terminal-window.SHORT",
|
|
297
|
-
"terminal-window.0123456789abcdef012",
|
|
298
|
-
"terminal-window.0123456789abcdef01234",
|
|
299
|
-
]) {
|
|
300
|
-
expect(TerminalWindowResourceIdSchemaZ.safeParse(invalid).success).toBe(false);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const base = {
|
|
304
|
-
id: "pane.grouped",
|
|
305
|
-
title: "Grouped",
|
|
306
|
-
kind: "terminal" as const,
|
|
307
|
-
active: true,
|
|
308
|
-
};
|
|
309
|
-
expect(
|
|
310
|
-
ApplicationShellTerminalResourceSchemaZ.safeParse({
|
|
311
|
-
...base,
|
|
312
|
-
interactionEndpoint: null,
|
|
313
|
-
nativeIdentity: null,
|
|
314
|
-
attachability: { status: "available", semanticPaneId: "pane.grouped" },
|
|
315
|
-
windowResourceId: "terminal-window.0123456789abcdef0123",
|
|
316
|
-
}).success,
|
|
317
|
-
).toBe(true);
|
|
318
|
-
// The grouping key is only valid on an attachable resource.
|
|
319
|
-
expect(
|
|
320
|
-
ApplicationShellTerminalResourceSchemaZ.safeParse({
|
|
321
|
-
...base,
|
|
322
|
-
interactionEndpoint: null,
|
|
323
|
-
nativeIdentity: null,
|
|
324
|
-
attachability: { status: "unavailable", reason: "missing-window-stamp" },
|
|
325
|
-
windowResourceId: "terminal-window.0123456789abcdef0123",
|
|
326
|
-
}).success,
|
|
327
|
-
).toBe(false);
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
it("rejects duplicate non-null agent pane ids at every strict projection boundary", () => {
|
|
331
|
-
const duplicateAgents = COHESION_FIXTURE_V1.workspace.sidebar.agents
|
|
332
|
-
.slice(0, 2)
|
|
333
|
-
.map((agent) => ({
|
|
334
|
-
...agent,
|
|
335
|
-
paneId: "pane.shared",
|
|
336
|
-
}));
|
|
337
|
-
const input = {
|
|
338
|
-
...COHESION_FIXTURE_V1,
|
|
339
|
-
workspace: {
|
|
340
|
-
...COHESION_FIXTURE_V1.workspace,
|
|
341
|
-
sidebar: { ...COHESION_FIXTURE_V1.workspace.sidebar, agents: duplicateAgents },
|
|
342
|
-
},
|
|
343
|
-
};
|
|
344
|
-
expect(ApplicationShellProjectionInputV1SchemaZ.safeParse(input).success).toBe(false);
|
|
345
|
-
expect(
|
|
346
|
-
ApplicationShellProjectionInputV2SchemaZ.safeParse({
|
|
347
|
-
...input,
|
|
348
|
-
terminalInventory: { activeResourceId: null, resources: [] },
|
|
349
|
-
}).success,
|
|
350
|
-
).toBe(false);
|
|
351
|
-
expect(() => projectApplicationShellV1(input)).toThrow(/duplicate semantic pane identity/u);
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
it("projects navigation and dock identity only from the canonical surface registry", () => {
|
|
355
|
-
const projection = projectApplicationShellV1(COHESION_FIXTURE_V1);
|
|
356
|
-
const projectedSurfaces = [
|
|
357
|
-
...projection.primaryNavigation.items,
|
|
358
|
-
...projection.bottomDock.tools,
|
|
359
|
-
];
|
|
360
|
-
|
|
361
|
-
expect(
|
|
362
|
-
projectedSurfaces.map(
|
|
363
|
-
({ id, icon, label, kind, area, order, owningMode, shortcut, activation }) => ({
|
|
364
|
-
id,
|
|
365
|
-
icon,
|
|
366
|
-
label,
|
|
367
|
-
kind,
|
|
368
|
-
area,
|
|
369
|
-
order,
|
|
370
|
-
owningMode,
|
|
371
|
-
shortcut,
|
|
372
|
-
activation,
|
|
373
|
-
}),
|
|
374
|
-
),
|
|
375
|
-
).toEqual(CANONICAL_SURFACE_REGISTRY);
|
|
376
|
-
expect(projection.primaryNavigation.items.map(({ id }) => id)).toEqual(["home", "terminals"]);
|
|
377
|
-
expect(projection.bottomDock.tools.map(({ id }) => id)).toEqual([
|
|
378
|
-
"files",
|
|
379
|
-
"changes",
|
|
380
|
-
"missions",
|
|
381
|
-
"activity",
|
|
382
|
-
]);
|
|
383
|
-
expect(
|
|
384
|
-
projection.primaryNavigation.items.every(({ area }) => area === "workspace-canvas"),
|
|
385
|
-
).toBe(true);
|
|
386
|
-
expect(projection.bottomDock.tools.every(({ area }) => area === "bottom-dock")).toBe(true);
|
|
387
|
-
expect(projection.primaryNavigation.activeMode).toBe("terminals");
|
|
388
|
-
expect(projection.bottomDock).toEqual(
|
|
389
|
-
expect.objectContaining({ mode: "open", activeTool: "missions" }),
|
|
390
|
-
);
|
|
391
|
-
expect(projection.focus.palette).toEqual({
|
|
392
|
-
open: true,
|
|
393
|
-
overlayId: "overlay.palette",
|
|
394
|
-
focusReturnTarget: {
|
|
395
|
-
kind: "pane",
|
|
396
|
-
paneId: "pane.implementer",
|
|
397
|
-
input: "terminal",
|
|
398
|
-
},
|
|
399
|
-
});
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
it("round-trips and freezes the host-neutral projection without geometry", () => {
|
|
403
|
-
const projection = projectApplicationShellV1(COHESION_FIXTURE_V1);
|
|
404
|
-
expect(serialized(projection)).toEqual(projection);
|
|
405
|
-
expect(ApplicationShellProjectionV1SchemaZ.parse(serialized(projection))).toEqual(projection);
|
|
406
|
-
|
|
407
|
-
const forbiddenKeys = new Set([
|
|
408
|
-
"x",
|
|
409
|
-
"y",
|
|
410
|
-
"width",
|
|
411
|
-
"height",
|
|
412
|
-
"rect",
|
|
413
|
-
"bounds",
|
|
414
|
-
"cell",
|
|
415
|
-
"cells",
|
|
416
|
-
"column",
|
|
417
|
-
"columns",
|
|
418
|
-
"row",
|
|
419
|
-
"rows",
|
|
420
|
-
"pixel",
|
|
421
|
-
"pixels",
|
|
422
|
-
"px",
|
|
423
|
-
"geometry",
|
|
424
|
-
"tmuxPaneId",
|
|
425
|
-
"ptyId",
|
|
426
|
-
"nativeHandle",
|
|
427
|
-
]);
|
|
428
|
-
const findings: string[] = [];
|
|
429
|
-
const mutable: string[] = [];
|
|
430
|
-
const walk = (value: unknown, path = "projection"): void => {
|
|
431
|
-
if (!value || typeof value !== "object") return;
|
|
432
|
-
if (!Object.isFrozen(value)) mutable.push(path);
|
|
433
|
-
if (Array.isArray(value)) {
|
|
434
|
-
value.forEach((child, index) => walk(child, `${path}.${index}`));
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
for (const [key, child] of Object.entries(value)) {
|
|
438
|
-
if (forbiddenKeys.has(key)) findings.push(`${path}.${key}`);
|
|
439
|
-
walk(child, `${path}.${key}`);
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
walk(projection);
|
|
443
|
-
|
|
444
|
-
expect(findings).toEqual([]);
|
|
445
|
-
expect(mutable).toEqual([]);
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
it("exports serializable descriptors for every semantic shell command", () => {
|
|
449
|
-
expect(APPLICATION_SHELL_COMMAND_DESCRIPTORS.map(({ id }) => id)).toEqual(
|
|
450
|
-
Object.values(APPLICATION_SHELL_COMMAND_IDS),
|
|
451
|
-
);
|
|
452
|
-
for (const descriptor of APPLICATION_SHELL_COMMAND_DESCRIPTORS) {
|
|
453
|
-
expect(CommandDescriptorSchemaZ.parse(serialized(descriptor))).toEqual(descriptor);
|
|
454
|
-
expect(
|
|
455
|
-
applicationShellCommandDescriptor(ApplicationShellCommandIdSchemaZ.parse(descriptor.id)),
|
|
456
|
-
).toBe(descriptor);
|
|
457
|
-
expect(Object.isFrozen(descriptor)).toBe(true);
|
|
458
|
-
expect(Object.isFrozen(descriptor.schemas)).toBe(true);
|
|
459
|
-
}
|
|
460
|
-
expect(APPLICATION_SHELL_COMMAND_DEFINITIONS.map(({ descriptor }) => descriptor)).toEqual(
|
|
461
|
-
APPLICATION_SHELL_COMMAND_DESCRIPTORS,
|
|
462
|
-
);
|
|
463
|
-
for (const definition of APPLICATION_SHELL_COMMAND_DEFINITIONS) {
|
|
464
|
-
expect(definition.inputSchema).toBe(
|
|
465
|
-
APPLICATION_SHELL_COMMAND_ARGUMENT_SCHEMAS[
|
|
466
|
-
ApplicationShellCommandIdSchemaZ.parse(definition.descriptor.id)
|
|
467
|
-
],
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
it("deep-freezes every exported and returned shell data source", () => {
|
|
473
|
-
const invocation = applicationShellCommandInvocation(
|
|
474
|
-
APPLICATION_SHELL_COMMAND_IDS.moveFocus,
|
|
475
|
-
{ target: { kind: "zone", zone: "dock-tabs" } },
|
|
476
|
-
{ kind: "keyboard", surface: "workbench" },
|
|
477
|
-
);
|
|
478
|
-
const sources = {
|
|
479
|
-
commandIds: APPLICATION_SHELL_COMMAND_IDS,
|
|
480
|
-
commandSchemas: APPLICATION_SHELL_COMMAND_ARGUMENT_SCHEMAS,
|
|
481
|
-
commandDefinitions: APPLICATION_SHELL_COMMAND_DEFINITIONS,
|
|
482
|
-
shellAreas: CANONICAL_SHELL_AREAS,
|
|
483
|
-
surfaces: CANONICAL_SURFACE_REGISTRY,
|
|
484
|
-
openSurfaceCommands: commandsToOpenSurface({
|
|
485
|
-
surface: "missions",
|
|
486
|
-
resourceId: "mission.m31",
|
|
487
|
-
}),
|
|
488
|
-
descriptors: APPLICATION_SHELL_COMMAND_DESCRIPTORS,
|
|
489
|
-
invocation,
|
|
490
|
-
};
|
|
491
|
-
for (const [name, source] of Object.entries(sources)) {
|
|
492
|
-
expect(mutableDataPaths(source, name), name).toEqual([]);
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
it("validates each command's arguments by semantic id", () => {
|
|
497
|
-
const source = { kind: "program", surface: "test" } as const;
|
|
498
|
-
const valid = [
|
|
499
|
-
applicationShellCommandInvocation(
|
|
500
|
-
APPLICATION_SHELL_COMMAND_IDS.activateMode,
|
|
501
|
-
{ mode: "home" },
|
|
502
|
-
source,
|
|
503
|
-
),
|
|
504
|
-
applicationShellCommandInvocation(
|
|
505
|
-
APPLICATION_SHELL_COMMAND_IDS.activateDockTool,
|
|
506
|
-
{ tool: "files" },
|
|
507
|
-
source,
|
|
508
|
-
),
|
|
509
|
-
applicationShellCommandInvocation(
|
|
510
|
-
APPLICATION_SHELL_COMMAND_IDS.setDockMode,
|
|
511
|
-
{ mode: "open" },
|
|
512
|
-
source,
|
|
513
|
-
),
|
|
514
|
-
applicationShellCommandInvocation(
|
|
515
|
-
APPLICATION_SHELL_COMMAND_IDS.moveFocus,
|
|
516
|
-
{ target: { kind: "zone", zone: "canvas" } },
|
|
517
|
-
source,
|
|
518
|
-
),
|
|
519
|
-
applicationShellCommandInvocation(
|
|
520
|
-
APPLICATION_SHELL_COMMAND_IDS.openPalette,
|
|
521
|
-
{
|
|
522
|
-
overlayId: "overlay.palette.test",
|
|
523
|
-
focusReturnTarget: { kind: "zone", zone: "canvas" },
|
|
524
|
-
},
|
|
525
|
-
source,
|
|
526
|
-
),
|
|
527
|
-
applicationShellCommandInvocation(
|
|
528
|
-
APPLICATION_SHELL_COMMAND_IDS.closePalette,
|
|
529
|
-
{ overlayId: "overlay.palette.test" },
|
|
530
|
-
source,
|
|
531
|
-
),
|
|
532
|
-
applicationShellCommandInvocation(
|
|
533
|
-
APPLICATION_SHELL_COMMAND_IDS.selectResource,
|
|
534
|
-
{ surface: "files", resourceId: "file.readme" },
|
|
535
|
-
source,
|
|
536
|
-
),
|
|
537
|
-
];
|
|
538
|
-
for (const invocation of valid) {
|
|
539
|
-
expect(ApplicationShellCommandInvocationSchemaZ.parse(serialized(invocation))).toEqual(
|
|
540
|
-
invocation,
|
|
541
|
-
);
|
|
542
|
-
}
|
|
543
|
-
expect(() =>
|
|
544
|
-
applicationShellCommandInvocation(
|
|
545
|
-
APPLICATION_SHELL_COMMAND_IDS.activateDockTool,
|
|
546
|
-
{ tool: "unknown" } as never,
|
|
547
|
-
source,
|
|
548
|
-
),
|
|
549
|
-
).toThrow();
|
|
550
|
-
expect(
|
|
551
|
-
ApplicationShellCommandInvocationSchemaZ.safeParse({
|
|
552
|
-
...valid[0],
|
|
553
|
-
args: { tool: "files" },
|
|
554
|
-
}).success,
|
|
555
|
-
).toBe(false);
|
|
556
|
-
});
|
|
557
|
-
|
|
558
|
-
it("turns the shared cohesion fixture into one exact cross-host command trace", () => {
|
|
559
|
-
const trace = applicationShellActionTraceV1(closedOverlayFixture);
|
|
560
|
-
expect(trace.invocations.map(({ id, args }) => ({ id, args }))).toEqual([
|
|
561
|
-
{ id: "application.shell.mode.activate", args: { mode: "home" } },
|
|
562
|
-
{ id: "application.shell.mode.activate", args: { mode: "terminals" } },
|
|
563
|
-
{ id: "application.shell.mode.activate", args: { mode: "terminals" } },
|
|
564
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "open" } },
|
|
565
|
-
{ id: "application.shell.dock.activate", args: { tool: "files" } },
|
|
566
|
-
{ id: "application.shell.mode.activate", args: { mode: "terminals" } },
|
|
567
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "open" } },
|
|
568
|
-
{ id: "application.shell.dock.activate", args: { tool: "changes" } },
|
|
569
|
-
{ id: "application.shell.mode.activate", args: { mode: "terminals" } },
|
|
570
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "open" } },
|
|
571
|
-
{ id: "application.shell.dock.activate", args: { tool: "missions" } },
|
|
572
|
-
{ id: "application.shell.mode.activate", args: { mode: "terminals" } },
|
|
573
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "open" } },
|
|
574
|
-
{ id: "application.shell.dock.activate", args: { tool: "activity" } },
|
|
575
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "collapsed" } },
|
|
576
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "open" } },
|
|
577
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "maximized" } },
|
|
578
|
-
{
|
|
579
|
-
id: "application.shell.focus.move",
|
|
580
|
-
args: { target: { kind: "zone", zone: "dock-tabs" } },
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
id: "application.shell.palette.open",
|
|
584
|
-
args: {
|
|
585
|
-
overlayId: "overlay.palette.trace",
|
|
586
|
-
focusReturnTarget: { kind: "zone", zone: "dock-tabs" },
|
|
587
|
-
},
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
id: "application.shell.palette.close",
|
|
591
|
-
args: { overlayId: "overlay.palette.trace" },
|
|
592
|
-
},
|
|
593
|
-
]);
|
|
594
|
-
expect(serialized(trace)).toEqual(trace);
|
|
595
|
-
expect(ApplicationShellActionTraceV1SchemaZ.parse(serialized(trace))).toEqual(trace);
|
|
596
|
-
expect(mutableDataPaths(trace, "trace")).toEqual([]);
|
|
597
|
-
for (const invocation of trace.invocations) {
|
|
598
|
-
expect(CommandInvocationSchemaZ.parse(serialized(invocation))).toEqual(invocation);
|
|
599
|
-
expect(
|
|
600
|
-
applicationShellCommandDescriptor(ApplicationShellCommandIdSchemaZ.parse(invocation.id)),
|
|
601
|
-
).toBeDefined();
|
|
602
|
-
expect(invocation.source).toEqual({ kind: "program", surface: "application-shell" });
|
|
603
|
-
}
|
|
604
|
-
expect(replayApplicationShellActionTraceV1(trace)).toEqual(trace.finalState);
|
|
605
|
-
expect(trace.finalState.focus).toMatchObject({
|
|
606
|
-
focusZone: "dock-tabs",
|
|
607
|
-
terminalInputPaneId: null,
|
|
608
|
-
overlays: [],
|
|
609
|
-
});
|
|
610
|
-
});
|
|
611
|
-
|
|
612
|
-
it("replays palette ownership sequentially and restores the pre-overlay focus", () => {
|
|
613
|
-
const trace = applicationShellActionTraceV1(closedOverlayFixture);
|
|
614
|
-
const openIndex = trace.invocations.findIndex(
|
|
615
|
-
({ id }) => id === APPLICATION_SHELL_COMMAND_IDS.openPalette,
|
|
616
|
-
);
|
|
617
|
-
const beforeOpen = trace.invocations
|
|
618
|
-
.slice(0, openIndex)
|
|
619
|
-
.reduce(
|
|
620
|
-
(state, invocation) => applyApplicationShellInvocationV1(state, invocation),
|
|
621
|
-
trace.initialState,
|
|
622
|
-
);
|
|
623
|
-
const opened = applyApplicationShellInvocationV1(beforeOpen, trace.invocations[openIndex]!);
|
|
624
|
-
expect(opened.focus.overlays).toHaveLength(1);
|
|
625
|
-
expect(() =>
|
|
626
|
-
applyApplicationShellInvocationV1(
|
|
627
|
-
opened,
|
|
628
|
-
applicationShellCommandInvocation(
|
|
629
|
-
APPLICATION_SHELL_COMMAND_IDS.activateMode,
|
|
630
|
-
{ mode: "home" },
|
|
631
|
-
{ kind: "program" },
|
|
632
|
-
),
|
|
633
|
-
),
|
|
634
|
-
).toThrow("semantic input is owned by overlay");
|
|
635
|
-
const closed = applyApplicationShellInvocationV1(opened, trace.invocations[openIndex + 1]!);
|
|
636
|
-
expect(closed.focus).toEqual(beforeOpen.focus);
|
|
637
|
-
expect(() => applicationShellActionTraceV1(COHESION_FIXTURE_V1)).toThrow(
|
|
638
|
-
"closed-overlay initial state",
|
|
639
|
-
);
|
|
640
|
-
|
|
641
|
-
const tampered = serialized(trace);
|
|
642
|
-
tampered.finalState.activeMode = "home";
|
|
643
|
-
expect(ApplicationShellActionTraceV1SchemaZ.safeParse(tampered).success).toBe(false);
|
|
644
|
-
});
|
|
645
|
-
});
|