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,113 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { builtinModules } from "node:module";
|
|
3
|
-
import { dirname, extname, relative, resolve, sep } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
import { describe, expect, it } from "vitest";
|
|
7
|
-
|
|
8
|
-
const SOURCE_ROOT = fileURLToPath(new URL("../", import.meta.url));
|
|
9
|
-
const KERNEL_ENTRY_FILES = [
|
|
10
|
-
"application-shell.ts",
|
|
11
|
-
"experience-identifiers.ts",
|
|
12
|
-
"experience-shell.ts",
|
|
13
|
-
"visual-recipes.ts",
|
|
14
|
-
"visual-tokens.ts",
|
|
15
|
-
"pane-appearance.ts",
|
|
16
|
-
"focus-overlay.ts",
|
|
17
|
-
"cohesion-fixture.ts",
|
|
18
|
-
] as const;
|
|
19
|
-
const ALLOWED_EXTERNAL_IMPORTS = new Set(["zod"]);
|
|
20
|
-
const NODE_IMPORTS = new Set(builtinModules.flatMap((name) => [name, name.replace(/^node:/u, "")]));
|
|
21
|
-
const FORBIDDEN_LOCAL_SEGMENT =
|
|
22
|
-
/(?:^|[/._-])(?:cell|cells|dom|electron|geometry|opentui|pixel|pixels|pty|react|rect|solid|string-width|tmux|xterm)(?=$|[/._-])/iu;
|
|
23
|
-
|
|
24
|
-
function resolveLocalImport(importer: string, specifier: string): string | null {
|
|
25
|
-
const candidate = resolve(dirname(importer), specifier);
|
|
26
|
-
for (const path of [candidate, `${candidate}.ts`, resolve(candidate, "index.ts")]) {
|
|
27
|
-
if (existsSync(path)) return path;
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function displayPath(path: string): string {
|
|
33
|
-
return relative(SOURCE_ROOT, path).split(sep).join("/");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
describe("experience-kernel import boundary", () => {
|
|
37
|
-
it("keeps the complete shared graph free of host, runtime, and terminal dependencies", () => {
|
|
38
|
-
const pending = KERNEL_ENTRY_FILES.map((file) => resolve(SOURCE_ROOT, file));
|
|
39
|
-
const visited = new Set<string>();
|
|
40
|
-
const findings: string[] = [];
|
|
41
|
-
|
|
42
|
-
while (pending.length > 0) {
|
|
43
|
-
const file = pending.pop()!;
|
|
44
|
-
if (visited.has(file)) continue;
|
|
45
|
-
visited.add(file);
|
|
46
|
-
const source = readFileSync(file, "utf8");
|
|
47
|
-
const preprocessed = ts.preProcessFile(source, true, true);
|
|
48
|
-
const specifiers = [
|
|
49
|
-
...preprocessed.importedFiles.map(({ fileName }) => fileName),
|
|
50
|
-
...preprocessed.typeReferenceDirectives.map(({ fileName }) => fileName),
|
|
51
|
-
...preprocessed.libReferenceDirectives.map(({ fileName }) => fileName),
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
for (const specifier of specifiers) {
|
|
55
|
-
const evidence = `${displayPath(file)} -> ${specifier}`;
|
|
56
|
-
if (!specifier.startsWith(".")) {
|
|
57
|
-
const packageName = specifier
|
|
58
|
-
.replace(/^node:/u, "")
|
|
59
|
-
.split("/")
|
|
60
|
-
.slice(0, specifier.startsWith("@") ? 2 : 1)
|
|
61
|
-
.join("/");
|
|
62
|
-
if (
|
|
63
|
-
specifier.startsWith("node:") ||
|
|
64
|
-
NODE_IMPORTS.has(specifier) ||
|
|
65
|
-
NODE_IMPORTS.has(packageName) ||
|
|
66
|
-
!ALLOWED_EXTERNAL_IMPORTS.has(packageName)
|
|
67
|
-
) {
|
|
68
|
-
findings.push(evidence);
|
|
69
|
-
}
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (FORBIDDEN_LOCAL_SEGMENT.test(specifier)) findings.push(evidence);
|
|
74
|
-
const dependency = resolveLocalImport(file, specifier);
|
|
75
|
-
if (dependency === null) {
|
|
76
|
-
findings.push(`${evidence} (unresolved)`);
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const outsideSource = relative(SOURCE_ROOT, dependency).startsWith(`..${sep}`);
|
|
80
|
-
if (outsideSource || extname(dependency) !== ".ts") {
|
|
81
|
-
findings.push(`${evidence} (outside shared TypeScript graph)`);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
pending.push(dependency);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
expect(findings).toEqual([]);
|
|
89
|
-
expect([...visited].map(displayPath).sort()).toEqual([
|
|
90
|
-
"agent-graph-overlay.ts",
|
|
91
|
-
"app-window-state.ts",
|
|
92
|
-
"application-shell.ts",
|
|
93
|
-
"cohesion-fixture.ts",
|
|
94
|
-
"commands.ts",
|
|
95
|
-
"daemon-wire.ts",
|
|
96
|
-
"desktop-missions.ts",
|
|
97
|
-
"desktop-workspace-name.ts",
|
|
98
|
-
"domain.ts",
|
|
99
|
-
"experience-identifiers.ts",
|
|
100
|
-
"experience-shell.ts",
|
|
101
|
-
"fleet-catalog.ts",
|
|
102
|
-
"focus-overlay.ts",
|
|
103
|
-
"interaction-evidence.ts",
|
|
104
|
-
"mission-projections.ts",
|
|
105
|
-
"owner-scope-identity.ts",
|
|
106
|
-
"pane-appearance.ts",
|
|
107
|
-
"pane-team.ts",
|
|
108
|
-
"semantic-identity.ts",
|
|
109
|
-
"visual-recipes.ts",
|
|
110
|
-
"visual-tokens.ts",
|
|
111
|
-
]);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
CANONICAL_SHELL_AREAS,
|
|
4
|
-
CANONICAL_SURFACE_REGISTRY,
|
|
5
|
-
canonicalSurface,
|
|
6
|
-
commandsToOpenSurface,
|
|
7
|
-
} from "../experience-shell.ts";
|
|
8
|
-
import { VISUAL_RECIPE_REGISTRY } from "../visual-recipes.ts";
|
|
9
|
-
|
|
10
|
-
describe("experience shell", () => {
|
|
11
|
-
it("keeps one canonical shell order", () => {
|
|
12
|
-
expect(CANONICAL_SHELL_AREAS.map(({ id }) => id)).toEqual([
|
|
13
|
-
"application-bar",
|
|
14
|
-
"sidebar",
|
|
15
|
-
"primary-navigation",
|
|
16
|
-
"context-actions",
|
|
17
|
-
"workspace-canvas",
|
|
18
|
-
"bottom-dock",
|
|
19
|
-
"status-strip",
|
|
20
|
-
]);
|
|
21
|
-
expect(CANONICAL_SHELL_AREAS.map(({ order }) => order)).toEqual([0, 1, 2, 3, 4, 5, 6]);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("keeps modes and tools in separate, stable registries", () => {
|
|
25
|
-
expect(CANONICAL_SURFACE_REGISTRY.map(({ id }) => id)).toEqual([
|
|
26
|
-
"home",
|
|
27
|
-
"terminals",
|
|
28
|
-
"files",
|
|
29
|
-
"changes",
|
|
30
|
-
"missions",
|
|
31
|
-
"activity",
|
|
32
|
-
]);
|
|
33
|
-
expect(
|
|
34
|
-
CANONICAL_SURFACE_REGISTRY.filter(({ kind }) => kind === "primary-mode").map(({ id }) => id),
|
|
35
|
-
).toEqual(["home", "terminals"]);
|
|
36
|
-
expect(
|
|
37
|
-
CANONICAL_SURFACE_REGISTRY.filter(({ kind }) => kind === "dock-tool").map(({ id }) => id),
|
|
38
|
-
).toEqual(["files", "changes", "missions", "activity"]);
|
|
39
|
-
expect(new Set(CANONICAL_SURFACE_REGISTRY.map(({ shortcut }) => shortcut)).size).toBe(6);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("converges direct, keyboard, and deep-link opening on semantic commands", () => {
|
|
43
|
-
expect(commandsToOpenSurface({ surface: "terminals" })).toEqual([
|
|
44
|
-
{ id: "application.shell.mode.activate", args: { mode: "terminals" } },
|
|
45
|
-
]);
|
|
46
|
-
expect(commandsToOpenSurface({ surface: "missions", resourceId: "mission.m31" })).toEqual([
|
|
47
|
-
{ id: "application.shell.mode.activate", args: { mode: "terminals" } },
|
|
48
|
-
{ id: "application.shell.dock.mode.set", args: { mode: "open" } },
|
|
49
|
-
{ id: "application.shell.dock.activate", args: { tool: "missions" } },
|
|
50
|
-
{
|
|
51
|
-
id: "application.shell.resource.select",
|
|
52
|
-
args: { surface: "missions", resourceId: "mission.m31" },
|
|
53
|
-
},
|
|
54
|
-
]);
|
|
55
|
-
expect(canonicalSurface("files").area).toBe("bottom-dock");
|
|
56
|
-
expect(Object.isFrozen(commandsToOpenSurface({ surface: "missions" }))).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("keeps flat and elevated presentation intent explicit", () => {
|
|
60
|
-
expect(VISUAL_RECIPE_REGISTRY["pane-docked"].elevation).toBeNull();
|
|
61
|
-
expect(VISUAL_RECIPE_REGISTRY["workspace-canvas"].elevation).toBeNull();
|
|
62
|
-
expect(VISUAL_RECIPE_REGISTRY["pane-floating"].elevation).toBe("floating");
|
|
63
|
-
expect(VISUAL_RECIPE_REGISTRY["command-palette"].elevation).toBe("palette");
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"canonical": {
|
|
3
|
-
"pid": 4312,
|
|
4
|
-
"port": 4010,
|
|
5
|
-
"protocolVersion": 2,
|
|
6
|
-
"productVersion": "0.0.1",
|
|
7
|
-
"instanceId": "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
8
|
-
"startedAt": "2026-07-20T12:34:56.123Z",
|
|
9
|
-
"bindHostname": "127.0.0.1",
|
|
10
|
-
"authToken": "fixture-token"
|
|
11
|
-
},
|
|
12
|
-
"health": {
|
|
13
|
-
"ok": true,
|
|
14
|
-
"protocolVersion": 2,
|
|
15
|
-
"productVersion": "0.0.1",
|
|
16
|
-
"uptime": 42
|
|
17
|
-
},
|
|
18
|
-
"healthz": {
|
|
19
|
-
"ok": true,
|
|
20
|
-
"protocolVersion": 2,
|
|
21
|
-
"productVersion": "0.0.1",
|
|
22
|
-
"uptimeMs": 42000
|
|
23
|
-
},
|
|
24
|
-
"identity": {
|
|
25
|
-
"ok": true,
|
|
26
|
-
"pid": 4312,
|
|
27
|
-
"protocolVersion": 2,
|
|
28
|
-
"productVersion": "0.0.1",
|
|
29
|
-
"instanceId": "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
30
|
-
"startedAt": "2026-07-20T12:34:56.123Z"
|
|
31
|
-
},
|
|
32
|
-
"sessions": {
|
|
33
|
-
"sessions": [{ "name": "fixture-project", "dir": "/work/fixture-project" }]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"canonical": {
|
|
3
|
-
"pid": 4312,
|
|
4
|
-
"port": 4010,
|
|
5
|
-
"protocolVersion": 3,
|
|
6
|
-
"productVersion": "0.0.1",
|
|
7
|
-
"instanceId": "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
8
|
-
"startedAt": "2026-07-20T12:34:56.123Z",
|
|
9
|
-
"bindHostname": "127.0.0.1",
|
|
10
|
-
"authToken": "fixture-token"
|
|
11
|
-
},
|
|
12
|
-
"health": {
|
|
13
|
-
"ok": true,
|
|
14
|
-
"protocolVersion": 3,
|
|
15
|
-
"productVersion": "0.0.1",
|
|
16
|
-
"uptime": 42
|
|
17
|
-
},
|
|
18
|
-
"healthz": {
|
|
19
|
-
"ok": true,
|
|
20
|
-
"protocolVersion": 3,
|
|
21
|
-
"productVersion": "0.0.1",
|
|
22
|
-
"uptimeMs": 42000
|
|
23
|
-
},
|
|
24
|
-
"identity": {
|
|
25
|
-
"ok": true,
|
|
26
|
-
"pid": 4312,
|
|
27
|
-
"protocolVersion": 3,
|
|
28
|
-
"productVersion": "0.0.1",
|
|
29
|
-
"instanceId": "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
30
|
-
"startedAt": "2026-07-20T12:34:56.123Z"
|
|
31
|
-
},
|
|
32
|
-
"sessions": {
|
|
33
|
-
"sessions": [{ "name": "fixture-project", "dir": "/work/fixture-project" }]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"canonical": {
|
|
3
|
-
"pid": 4312,
|
|
4
|
-
"port": 4010,
|
|
5
|
-
"protocolVersion": 4,
|
|
6
|
-
"productVersion": "0.0.1",
|
|
7
|
-
"instanceId": "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
8
|
-
"startedAt": "2026-07-20T12:34:56.123Z",
|
|
9
|
-
"bindHostname": "127.0.0.1",
|
|
10
|
-
"authToken": "fixture-token"
|
|
11
|
-
},
|
|
12
|
-
"health": {
|
|
13
|
-
"ok": true,
|
|
14
|
-
"protocolVersion": 4,
|
|
15
|
-
"productVersion": "0.0.1",
|
|
16
|
-
"uptime": 42
|
|
17
|
-
},
|
|
18
|
-
"healthz": {
|
|
19
|
-
"ok": true,
|
|
20
|
-
"protocolVersion": 4,
|
|
21
|
-
"productVersion": "0.0.1",
|
|
22
|
-
"uptimeMs": 42000
|
|
23
|
-
},
|
|
24
|
-
"identity": {
|
|
25
|
-
"ok": true,
|
|
26
|
-
"pid": 4312,
|
|
27
|
-
"protocolVersion": 4,
|
|
28
|
-
"productVersion": "0.0.1",
|
|
29
|
-
"instanceId": "9bcf33b0-c837-4a94-b5e8-c0977f54464f",
|
|
30
|
-
"startedAt": "2026-07-20T12:34:56.123Z"
|
|
31
|
-
},
|
|
32
|
-
"sessions": {
|
|
33
|
-
"sessions": [{ "name": "fixture-project", "dir": "/work/fixture-project" }]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/** Explicit synthetic inventory for tests of receipt rules unrelated to provenance. */
|
|
2
|
-
export function scopedReceiptFixture<T extends Record<string, unknown>>(raw: T) {
|
|
3
|
-
const pane =
|
|
4
|
-
raw.operationKind === "workspace.pane.read" || raw.operationKind === "workspace.pane.send";
|
|
5
|
-
const id = "00000000-0000-4000-8000-000000000001";
|
|
6
|
-
const endpoint = (semanticPaneId: unknown) => ({
|
|
7
|
-
kind: "pane",
|
|
8
|
-
environmentId: id,
|
|
9
|
-
serverScope: { serverId: `tmux-server.${"a".repeat(32)}`, generation: id },
|
|
10
|
-
paneLifetimeId: id,
|
|
11
|
-
workspaceName: raw.workspaceName,
|
|
12
|
-
semanticPaneId,
|
|
13
|
-
});
|
|
14
|
-
const target = raw.target as { semanticPaneId?: unknown } | undefined;
|
|
15
|
-
const source = raw.sourceSemanticPaneId ? endpoint(raw.sourceSemanticPaneId) : null;
|
|
16
|
-
return {
|
|
17
|
-
...raw,
|
|
18
|
-
evidence: pane
|
|
19
|
-
? {
|
|
20
|
-
schemaVersion: 1,
|
|
21
|
-
interactionId: raw.operationId,
|
|
22
|
-
revision: raw.phase === "accepted" ? 0 : 1,
|
|
23
|
-
endpoints: { destination: endpoint(target?.semanticPaneId), source },
|
|
24
|
-
actor:
|
|
25
|
-
raw.origin === "external"
|
|
26
|
-
? { kind: "unknown", reason: "stock-hook" }
|
|
27
|
-
: source
|
|
28
|
-
? { kind: "cooperative", bindingId: id, agentRunId: null }
|
|
29
|
-
: { kind: "unknown", reason: "unbound-source" },
|
|
30
|
-
observation:
|
|
31
|
-
raw.origin === "external"
|
|
32
|
-
? {
|
|
33
|
-
kind: "stock-hook",
|
|
34
|
-
command:
|
|
35
|
-
raw.operationKind === "workspace.pane.read" ? "capture-pane" : "send-keys",
|
|
36
|
-
}
|
|
37
|
-
: raw.phase === "observed"
|
|
38
|
-
? {
|
|
39
|
-
kind: "cooperative-completion",
|
|
40
|
-
operationId: raw.operationId,
|
|
41
|
-
verification:
|
|
42
|
-
raw.operationKind === "workspace.pane.read"
|
|
43
|
-
? "daemon-snapshot"
|
|
44
|
-
: "daemon-input-enqueue",
|
|
45
|
-
}
|
|
46
|
-
: { kind: "admission", operationId: raw.operationId },
|
|
47
|
-
effect:
|
|
48
|
-
raw.origin !== "external" && raw.phase === "observed"
|
|
49
|
-
? {
|
|
50
|
-
kind:
|
|
51
|
-
raw.operationKind === "workspace.pane.read"
|
|
52
|
-
? "snapshot-produced"
|
|
53
|
-
: "input-enqueued",
|
|
54
|
-
}
|
|
55
|
-
: { kind: "unknown" },
|
|
56
|
-
occurredAt: null,
|
|
57
|
-
timeBasis: "unknown",
|
|
58
|
-
receivedAt: raw.at,
|
|
59
|
-
}
|
|
60
|
-
: null,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { AgentGraphOverlaySchemaZ } from "../agent-graph-overlay.ts";
|
|
3
|
-
import {
|
|
4
|
-
fleetActivityToNodeStatus,
|
|
5
|
-
fleetDisplayNodeId,
|
|
6
|
-
fleetSessionGroupId,
|
|
7
|
-
projectFleetAgentGraphOverlay,
|
|
8
|
-
type FleetAgentGraphProjectionSession,
|
|
9
|
-
} from "../fleet-agent-graph.ts";
|
|
10
|
-
import {
|
|
11
|
-
FLEET_MAX_AGENTS_PER_SESSION,
|
|
12
|
-
FLEET_MAX_SESSIONS,
|
|
13
|
-
FLEET_MAX_TOTAL_AGENTS,
|
|
14
|
-
} from "../fleet-catalog.ts";
|
|
15
|
-
import { AGENT_ACTIVITY_IDS, type AgentActivity } from "../pane-appearance.ts";
|
|
16
|
-
import { TerminalAttachmentSemanticPaneIdSchemaZ } from "../semantic-identity.ts";
|
|
17
|
-
|
|
18
|
-
function agent(
|
|
19
|
-
token: string,
|
|
20
|
-
overrides: Partial<FleetAgentGraphProjectionSession["agents"][number]> = {},
|
|
21
|
-
): FleetAgentGraphProjectionSession["agents"][number] {
|
|
22
|
-
return {
|
|
23
|
-
agentId: `agent.${token}`,
|
|
24
|
-
name: "reviewer",
|
|
25
|
-
activity: "running",
|
|
26
|
-
attention: false,
|
|
27
|
-
statusSource: "authority",
|
|
28
|
-
...overrides,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function session(
|
|
33
|
-
token: string,
|
|
34
|
-
agents: FleetAgentGraphProjectionSession["agents"],
|
|
35
|
-
): FleetAgentGraphProjectionSession {
|
|
36
|
-
return { sessionId: `session.${token}`, label: `fleet-${token.slice(0, 4)}`, agents };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const SESSION_A = "0123456789abcdef01";
|
|
40
|
-
const SESSION_B = "fedcba9876543210ff";
|
|
41
|
-
|
|
42
|
-
describe("fleetActivityToNodeStatus", () => {
|
|
43
|
-
it("is total over the activity union", () => {
|
|
44
|
-
for (const activity of AGENT_ACTIVITY_IDS) {
|
|
45
|
-
expect(() => fleetActivityToNodeStatus(activity)).not.toThrow();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("maps each activity to its canvas status", () => {
|
|
50
|
-
const expected: Record<AgentActivity, string> = {
|
|
51
|
-
idle: "idle",
|
|
52
|
-
running: "working",
|
|
53
|
-
waiting: "blocked",
|
|
54
|
-
complete: "done",
|
|
55
|
-
failed: "blocked",
|
|
56
|
-
disconnected: "idle",
|
|
57
|
-
};
|
|
58
|
-
for (const activity of AGENT_ACTIVITY_IDS) {
|
|
59
|
-
expect(fleetActivityToNodeStatus(activity)).toBe(expected[activity]);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
describe("fleet id derivation", () => {
|
|
65
|
-
it("keys nodes under the reserved non-attachable prefix", () => {
|
|
66
|
-
const nodeId = fleetDisplayNodeId(`agent.${SESSION_A}`);
|
|
67
|
-
expect(nodeId).toBe(`terminal.discovered.agent.${SESSION_A}`);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("returns null for a malformed agent id", () => {
|
|
71
|
-
expect(fleetDisplayNodeId("%7")).toBeNull();
|
|
72
|
-
expect(fleetDisplayNodeId("agent.$bad")).toBeNull();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("derives a group id from the session token", () => {
|
|
76
|
-
expect(fleetSessionGroupId(`session.${SESSION_A}`)).toBe(`group.${SESSION_A}`);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("returns null for a malformed session id", () => {
|
|
80
|
-
expect(fleetSessionGroupId("$3")).toBeNull();
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe("projectFleetAgentGraphOverlay", () => {
|
|
85
|
-
it("projects an empty fleet to an empty, untruncated overlay", () => {
|
|
86
|
-
const result = projectFleetAgentGraphOverlay({ sessions: [] });
|
|
87
|
-
expect(result.truncated).toBe(false);
|
|
88
|
-
expect(Object.keys(result.overlay.nodes)).toHaveLength(0);
|
|
89
|
-
expect(result.overlay.groups).toHaveLength(0);
|
|
90
|
-
expect(result.overlay.edges).toHaveLength(0);
|
|
91
|
-
expect(AgentGraphOverlaySchemaZ.safeParse(result.overlay).success).toBe(true);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("emits a group with no members for a session with zero agents", () => {
|
|
95
|
-
const result = projectFleetAgentGraphOverlay({ sessions: [session(SESSION_A, [])] });
|
|
96
|
-
expect(result.truncated).toBe(false);
|
|
97
|
-
expect(result.overlay.groups).toHaveLength(1);
|
|
98
|
-
expect(result.overlay.groups[0]!.id).toBe(`group.${SESSION_A}`);
|
|
99
|
-
expect(result.overlay.groups[0]!.memberWindowIds).toHaveLength(0);
|
|
100
|
-
expect(Object.keys(result.overlay.nodes)).toHaveLength(0);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("projects agents across sessions into nodes, groups, and no edges", () => {
|
|
104
|
-
const result = projectFleetAgentGraphOverlay({
|
|
105
|
-
sessions: [
|
|
106
|
-
session(SESSION_A, [agent("aaaaaaaaaaaaaaaa01"), agent("aaaaaaaaaaaaaaaa02")]),
|
|
107
|
-
session(SESSION_B, [agent("bbbbbbbbbbbbbbbb01")]),
|
|
108
|
-
],
|
|
109
|
-
});
|
|
110
|
-
expect(result.truncated).toBe(false);
|
|
111
|
-
expect(Object.keys(result.overlay.nodes)).toHaveLength(3);
|
|
112
|
-
expect(result.overlay.edges).toHaveLength(0);
|
|
113
|
-
expect(result.overlay.groups).toHaveLength(2);
|
|
114
|
-
const groupA = result.overlay.groups.find((group) => group.id === `group.${SESSION_A}`)!;
|
|
115
|
-
expect(groupA.memberWindowIds).toEqual([
|
|
116
|
-
"terminal.discovered.agent.aaaaaaaaaaaaaaaa01",
|
|
117
|
-
"terminal.discovered.agent.aaaaaaaaaaaaaaaa02",
|
|
118
|
-
]);
|
|
119
|
-
expect(AgentGraphOverlaySchemaZ.safeParse(result.overlay).success).toBe(true);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("carries status, attention, statusSource, and label onto the node", () => {
|
|
123
|
-
const result = projectFleetAgentGraphOverlay({
|
|
124
|
-
sessions: [
|
|
125
|
-
session(SESSION_A, [
|
|
126
|
-
agent("aaaaaaaaaaaaaaaa01", {
|
|
127
|
-
name: "planner",
|
|
128
|
-
activity: "waiting",
|
|
129
|
-
attention: true,
|
|
130
|
-
statusSource: "scrape",
|
|
131
|
-
}),
|
|
132
|
-
]),
|
|
133
|
-
],
|
|
134
|
-
});
|
|
135
|
-
const node = result.overlay.nodes["terminal.discovered.agent.aaaaaaaaaaaaaaaa01"]!;
|
|
136
|
-
expect(node.status).toBe("blocked");
|
|
137
|
-
expect(node.attention).toBe(true);
|
|
138
|
-
expect(node.statusSource).toBe("scrape");
|
|
139
|
-
expect(node.label).toBe("planner");
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it("produces node ids that no attachment authority will accept", () => {
|
|
143
|
-
const result = projectFleetAgentGraphOverlay({
|
|
144
|
-
sessions: [session(SESSION_A, [agent("aaaaaaaaaaaaaaaa01")])],
|
|
145
|
-
});
|
|
146
|
-
for (const nodeId of Object.keys(result.overlay.nodes)) {
|
|
147
|
-
expect(TerminalAttachmentSemanticPaneIdSchemaZ.safeParse(nodeId).success).toBe(false);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it("collapses an agent id duplicated across sessions and reports truncation", () => {
|
|
152
|
-
const result = projectFleetAgentGraphOverlay({
|
|
153
|
-
sessions: [
|
|
154
|
-
session(SESSION_A, [agent("aaaaaaaaaaaaaaaa01")]),
|
|
155
|
-
session(SESSION_B, [agent("aaaaaaaaaaaaaaaa01")]),
|
|
156
|
-
],
|
|
157
|
-
});
|
|
158
|
-
expect(result.truncated).toBe(true);
|
|
159
|
-
// The duplicate agent collapses to a single node; both session groups keep a
|
|
160
|
-
// reference to the one surviving node, and the overlay stays structurally valid.
|
|
161
|
-
expect(Object.keys(result.overlay.nodes)).toHaveLength(1);
|
|
162
|
-
const groupB = result.overlay.groups.find((group) => group.id === `group.${SESSION_B}`)!;
|
|
163
|
-
expect(groupB.memberWindowIds).toEqual(["terminal.discovered.agent.aaaaaaaaaaaaaaaa01"]);
|
|
164
|
-
expect(AgentGraphOverlaySchemaZ.safeParse(result.overlay).success).toBe(true);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it("skips a malformed session and marks truncation", () => {
|
|
168
|
-
const result = projectFleetAgentGraphOverlay({
|
|
169
|
-
sessions: [
|
|
170
|
-
{ sessionId: "$bad", label: "broken", agents: [agent("aaaaaaaaaaaaaaaa01")] },
|
|
171
|
-
session(SESSION_A, [agent("aaaaaaaaaaaaaaaa02")]),
|
|
172
|
-
],
|
|
173
|
-
});
|
|
174
|
-
expect(result.truncated).toBe(true);
|
|
175
|
-
expect(result.overlay.groups).toHaveLength(1);
|
|
176
|
-
expect(Object.keys(result.overlay.nodes)).toHaveLength(1);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it("skips a malformed agent id but keeps its session", () => {
|
|
180
|
-
const result = projectFleetAgentGraphOverlay({
|
|
181
|
-
sessions: [
|
|
182
|
-
session(SESSION_A, [
|
|
183
|
-
{
|
|
184
|
-
agentId: "%7",
|
|
185
|
-
name: "raw",
|
|
186
|
-
activity: "running",
|
|
187
|
-
attention: false,
|
|
188
|
-
statusSource: "unknown",
|
|
189
|
-
},
|
|
190
|
-
agent("aaaaaaaaaaaaaaaa02"),
|
|
191
|
-
]),
|
|
192
|
-
],
|
|
193
|
-
});
|
|
194
|
-
expect(result.truncated).toBe(true);
|
|
195
|
-
expect(result.overlay.groups).toHaveLength(1);
|
|
196
|
-
expect(Object.keys(result.overlay.nodes)).toHaveLength(1);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it("truncates sessions beyond the fleet session cap", () => {
|
|
200
|
-
const sessions = Array.from({ length: FLEET_MAX_SESSIONS + 5 }, (_unused, index) =>
|
|
201
|
-
session(`sessiontoken${String(index).padStart(6, "0")}`, []),
|
|
202
|
-
);
|
|
203
|
-
const result = projectFleetAgentGraphOverlay({ sessions });
|
|
204
|
-
expect(result.truncated).toBe(true);
|
|
205
|
-
expect(result.overlay.groups).toHaveLength(FLEET_MAX_SESSIONS);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it("truncates agents beyond the per-session cap", () => {
|
|
209
|
-
const agents = Array.from({ length: FLEET_MAX_AGENTS_PER_SESSION + 5 }, (_unused, index) =>
|
|
210
|
-
agent(`agenttoken000${String(index).padStart(6, "0")}`),
|
|
211
|
-
);
|
|
212
|
-
const result = projectFleetAgentGraphOverlay({ sessions: [session(SESSION_A, agents)] });
|
|
213
|
-
expect(result.truncated).toBe(true);
|
|
214
|
-
expect(result.overlay.groups[0]!.memberWindowIds).toHaveLength(FLEET_MAX_AGENTS_PER_SESSION);
|
|
215
|
-
expect(AgentGraphOverlaySchemaZ.safeParse(result.overlay).success).toBe(true);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it("truncates total agents beyond the fleet cap", () => {
|
|
219
|
-
let counter = 0;
|
|
220
|
-
const sessions = Array.from({ length: 6 }, (_unused, sessionIndex) => {
|
|
221
|
-
const agents = Array.from({ length: FLEET_MAX_AGENTS_PER_SESSION }, () =>
|
|
222
|
-
agent(`agenttoken${String(counter++).padStart(8, "0")}`),
|
|
223
|
-
);
|
|
224
|
-
return session(`sessiontoken${String(sessionIndex).padStart(6, "0")}`, agents);
|
|
225
|
-
});
|
|
226
|
-
const result = projectFleetAgentGraphOverlay({ sessions });
|
|
227
|
-
expect(result.truncated).toBe(true);
|
|
228
|
-
expect(Object.keys(result.overlay.nodes)).toHaveLength(FLEET_MAX_TOTAL_AGENTS);
|
|
229
|
-
expect(AgentGraphOverlaySchemaZ.safeParse(result.overlay).success).toBe(true);
|
|
230
|
-
});
|
|
231
|
-
});
|