tmux-ide 2.9.24 → 2.9.26
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/bin/cli.js +1689 -393
- package/package.json +5 -2
- package/packages/contracts/src/pane-stream.ts +72 -0
- package/packages/contracts/src/terminal-delivery.ts +8 -2
- package/packages/contracts/src/terminal-runtime-inventory.ts +61 -1
- package/packages/contracts/src/tmux-server-scope.ts +18 -0
- package/packages/daemon/dist/command-center/discovery.js +24 -5
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.js +42 -2
- package/packages/daemon/dist/command-center/server.js +81 -75
- package/packages/daemon/dist/command-center/tmux-servers.js +17 -7
- package/packages/daemon/dist/doctor.js +46 -10
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.js +20 -2
- package/packages/daemon/dist/lib/daemon-crash-snapshot.js +118 -0
- package/packages/daemon/dist/lib/daemon-embed.js +6 -0
- package/packages/daemon/dist/lib/headless-daemon.js +63 -6
- package/packages/daemon/dist/lib/invocation-directory.js +20 -0
- package/packages/daemon/dist/lib/runtime-namespace.js +22 -6
- package/packages/daemon/dist/lib/tmux-client-execution.js +12 -3
- package/packages/daemon/dist/lib/tmux-server-owner.js +4 -2
- package/packages/daemon/dist/lib/update-check.js +18 -0
- package/packages/daemon/dist/lib/update-daemon-outcome.js +31 -0
- package/packages/daemon/dist/lib/update.js +39 -14
- 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/graphics/kitty-graphics.js +16 -4
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +26 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.js +31 -2
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +1 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +831 -222
- package/packages/daemon/dist/terminal/protocol/browser-icon.js +1 -1
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +26 -3
- package/packages/daemon/dist/terminal/session-runtime/registry.js +25 -2
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +121 -6
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +79 -2
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.js +24 -2
- package/packages/daemon/dist/terminal/session-runtime/transport-binding.js +38 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +51 -4
- package/packages/daemon/dist/tui/chrome/snapshot.js +36 -1
- package/packages/daemon/dist/tui/chrome/statusline.js +8 -5
- package/packages/daemon/dist/tui/chrome/updater.js +2 -0
- package/packages/daemon/src/command-center/discovery.ts +24 -4
- package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +48 -1
- package/packages/daemon/src/command-center/server.ts +67 -67
- package/packages/daemon/src/command-center/tmux-servers.ts +19 -6
- package/packages/daemon/src/doctor.ts +50 -9
- package/packages/daemon/src/lib/canonical-daemon-bootstrap.ts +31 -5
- package/packages/daemon/src/lib/daemon-crash-snapshot.ts +175 -0
- package/packages/daemon/src/lib/daemon-embed.ts +22 -0
- package/packages/daemon/src/lib/headless-daemon.ts +88 -7
- package/packages/daemon/src/lib/invocation-directory.ts +21 -0
- package/packages/daemon/src/lib/runtime-namespace.ts +25 -7
- package/packages/daemon/src/lib/tmux-client-execution.ts +14 -5
- package/packages/daemon/src/lib/tmux-server-owner.ts +6 -3
- package/packages/daemon/src/lib/update-check.ts +34 -0
- package/packages/daemon/src/lib/update-daemon-outcome.ts +42 -0
- package/packages/daemon/src/lib/update.ts +58 -16
- package/packages/daemon/src/terminal/graphics/kitty-graphics.ts +22 -6
- package/packages/daemon/src/terminal/mirror/events.ts +2 -0
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +27 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +38 -2
- package/packages/daemon/src/terminal/pane-stream/lease-manager.ts +3 -0
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +915 -236
- package/packages/daemon/src/terminal/protocol/browser-icon.ts +1 -1
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +32 -2
- package/packages/daemon/src/terminal/session-runtime/registry.ts +36 -2
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts +136 -6
- package/packages/daemon/src/terminal/session-runtime/terminal-interpreter-backend.ts +6 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +76 -2
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-owner.ts +21 -1
- package/packages/daemon/src/terminal/session-runtime/transport-binding.ts +42 -2
- package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +67 -3
- package/packages/daemon/src/tui/chrome/snapshot.ts +47 -1
- package/packages/daemon/src/tui/chrome/statusline.ts +7 -4
- package/packages/daemon/src/tui/chrome/updater.ts +3 -0
- package/packages/daemon-client/src/pane-stream-client.ts +47 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tmux-ide",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.26",
|
|
4
4
|
"description": "The open-source workspace for coding agents: run Claude Code, Codex and other agents in tmux with live status",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"test:tmux-boundary": "node scripts/test-tmux-boundary.mjs",
|
|
40
40
|
"build": "pnpm build:cli",
|
|
41
41
|
"build:cli": "node scripts/build-cli.mjs",
|
|
42
|
+
"check:cli-bundle": "node scripts/check-cli-bundle.mjs",
|
|
42
43
|
"build:macos-notifier": "node scripts/build-macos-notifier.mjs",
|
|
43
44
|
"build:tui": "bun scripts/build-tui.mjs",
|
|
44
45
|
"prepack": "pnpm build:cli",
|
|
@@ -62,7 +63,8 @@
|
|
|
62
63
|
"test:pane-frame-package": "pnpm --filter @tmux-ide/presentation run test",
|
|
63
64
|
"typecheck:workspace": "turbo run typecheck",
|
|
64
65
|
"docs:build": "turbo run build --filter=@tmux-ide/docs",
|
|
65
|
-
"pack:check": "pnpm test:installer &&
|
|
66
|
+
"pack:check": "pnpm test:installer && pnpm test:workflow-contracts && node scripts/pack-tui-check.mjs",
|
|
67
|
+
"test:workflow-contracts": "node --test scripts/lib/npm-release-tag.test.mjs scripts/lib/tap-bump-gate.test.mjs scripts/lib/macos-ssh-account.test.mjs scripts/lib/apt-dns-fallback.test.mjs scripts/lib/usvg-pin.test.mjs",
|
|
66
68
|
"test:pack-installed": "node scripts/pack-check-run.mjs",
|
|
67
69
|
"release:opentui:check": "node scripts/opentui-release-check.mjs",
|
|
68
70
|
"check:native-deps": "node packages/daemon/scripts/check-native-deps.mjs",
|
|
@@ -107,6 +109,7 @@
|
|
|
107
109
|
"typecheck:tui-gallery": "tsc --noEmit -p scripts/tsconfig.tui-gallery.json",
|
|
108
110
|
"test:spark-qualification": "node --import tsx --test scripts/lib/spark-*.test.ts scripts/lib/spark-*.test.mjs",
|
|
109
111
|
"test:installer": "node --test scripts/install.test.mjs scripts/lib/installer-service-qualification.test.mjs",
|
|
112
|
+
"test:installer-native": "node --test scripts/install-native-alpha.test.mjs scripts/install-native-dispatch.test.mjs",
|
|
110
113
|
"qualify:styled-ssh": "node scripts/qualify-styled-ssh.mjs"
|
|
111
114
|
},
|
|
112
115
|
"keywords": [
|
|
@@ -136,6 +136,14 @@ export const PaneStreamLeaseRequestSchemaZ = z
|
|
|
136
136
|
viewerMode: PaneStreamViewerModeSchemaZ,
|
|
137
137
|
/** Explicit semantic-v2 content/authority mode. Omission retains raw v1. */
|
|
138
138
|
terminalDelivery: TerminalDeliveryOfferSchemaZ.optional(),
|
|
139
|
+
/**
|
|
140
|
+
* #806: a stream for one window. `panes` must be exactly that window's
|
|
141
|
+
* panes (at most PANE_STREAM_MAX_PANES), so a session with more panes in
|
|
142
|
+
* all can be viewed window by window. Under capability 119/120 the stream
|
|
143
|
+
* follows that window's pane set in place; other windows never enter.
|
|
144
|
+
* Released daemons refuse the field: send it only to a daemon that has it.
|
|
145
|
+
*/
|
|
146
|
+
semanticWindowId: TerminalAttachmentSemanticWindowIdSchemaZ.optional(),
|
|
139
147
|
})
|
|
140
148
|
.strict();
|
|
141
149
|
export type PaneStreamLeaseRequest = z.infer<typeof PaneStreamLeaseRequestSchemaZ>;
|
|
@@ -257,6 +265,27 @@ export const PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION = 117;
|
|
|
257
265
|
* Offered in place of 117 because the offer array has nine slots.
|
|
258
266
|
*/
|
|
259
267
|
export const PANE_STREAM_READER_CAPABILITY_VERSION = 118;
|
|
268
|
+
/**
|
|
269
|
+
* #718: layout panes carry `browserKind` ("native" | "plain" | null), so a
|
|
270
|
+
* client can say why a plain terminal browser has no tmux-ide controls.
|
|
271
|
+
* Sent only to a client offering 123; older clients refuse the field.
|
|
272
|
+
*/
|
|
273
|
+
export const PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION = 123;
|
|
274
|
+
/**
|
|
275
|
+
* The client keeps its stream when the session gains or loses a pane (#723):
|
|
276
|
+
* the daemon sends a `topology` frame where it would otherwise close the
|
|
277
|
+
* stream with 1012 "topology-changed". Offered beside the other versions, not
|
|
278
|
+
* in place of one. The daemon confirms it with `topologyInPlace: true` in the
|
|
279
|
+
* ready frame; without both, nothing changes for either side.
|
|
280
|
+
*/
|
|
281
|
+
export const PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION = 119;
|
|
282
|
+
/**
|
|
283
|
+
* 118 and 119 in one number, for a client whose offer array is full (it holds
|
|
284
|
+
* nine, on every daemon, and the Mac app's interactive offer already has
|
|
285
|
+
* nine). Offered in place of 118. A daemon that predates it ignores it and
|
|
286
|
+
* then gives neither, so a client offers it only to a daemon that has it.
|
|
287
|
+
*/
|
|
288
|
+
export const PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION = 120;
|
|
260
289
|
export const PaneStreamInputLifetimeSchemaZ = z
|
|
261
290
|
.object({
|
|
262
291
|
generation: z.string().min(1).max(256),
|
|
@@ -477,6 +506,8 @@ export const PaneStreamReadyFrameSchemaZ = z
|
|
|
477
506
|
type: z.literal("ready"),
|
|
478
507
|
inputLifetime: z.literal(true).optional(),
|
|
479
508
|
inputBytes: z.literal(true).optional(),
|
|
509
|
+
/** Only to a client that offered capability 119: `topology` frames may follow. */
|
|
510
|
+
topologyInPlace: z.literal(true).optional(),
|
|
480
511
|
protocolVersion: z.literal(PANE_STREAM_PROTOCOL_VERSION),
|
|
481
512
|
daemonInstanceId: BoundedIdentitySchemaZ,
|
|
482
513
|
requestId: z.uuid(),
|
|
@@ -571,6 +602,11 @@ export const PaneStreamLayoutFrameSchemaZ = z
|
|
|
571
602
|
.regex(/^(?:[0-9a-f]{2048})?$/u)
|
|
572
603
|
.nullable()
|
|
573
604
|
.optional(),
|
|
605
|
+
/**
|
|
606
|
+
* Only with capability 123: a terminal browser with tmux-ide's
|
|
607
|
+
* native controls, a plain one without them, or null.
|
|
608
|
+
*/
|
|
609
|
+
browserKind: z.enum(["native", "plain"]).nullable().optional(),
|
|
574
610
|
/** Only with capability 118: the Markdown reader's file name, never its path. */
|
|
575
611
|
reader: z
|
|
576
612
|
.object({
|
|
@@ -701,6 +737,41 @@ export const PaneStreamFlowFrameSchemaZ = z
|
|
|
701
737
|
})
|
|
702
738
|
.strict();
|
|
703
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Capability 119. The session's pane set changed and the stream stays open.
|
|
742
|
+
* `panes` is the stream's whole pane set from now on, with the meaning it has
|
|
743
|
+
* in the ready frame; `removed` and `added` are its difference from the set
|
|
744
|
+
* before. Sent before the `layout-snapshot` of the same epoch, so a layout
|
|
745
|
+
* never names a pane the client has not been told about. A removed pane's
|
|
746
|
+
* delivery has ended; an added pane's `terminal-delivery-ready` and seed
|
|
747
|
+
* follow the snapshot.
|
|
748
|
+
*/
|
|
749
|
+
export const PaneStreamTopologyFrameSchemaZ = z
|
|
750
|
+
.object({
|
|
751
|
+
type: z.literal("topology"),
|
|
752
|
+
topologyEpoch: z.number().int().nonnegative(),
|
|
753
|
+
panes: PaneSetSchemaZ,
|
|
754
|
+
removed: z.array(PaneStreamSemanticPaneIdSchemaZ).max(PANE_STREAM_MAX_PANES),
|
|
755
|
+
added: z.array(PaneStreamSemanticPaneIdSchemaZ).max(PANE_STREAM_MAX_PANES),
|
|
756
|
+
})
|
|
757
|
+
.strict()
|
|
758
|
+
.superRefine((frame, context) => {
|
|
759
|
+
const panes = new Set(frame.panes);
|
|
760
|
+
const removed = new Set(frame.removed);
|
|
761
|
+
const added = new Set(frame.added);
|
|
762
|
+
if (
|
|
763
|
+
removed.size !== frame.removed.length ||
|
|
764
|
+
added.size !== frame.added.length ||
|
|
765
|
+
frame.added.some((pane) => !panes.has(pane) || removed.has(pane)) ||
|
|
766
|
+
frame.removed.some((pane) => panes.has(pane))
|
|
767
|
+
)
|
|
768
|
+
context.addIssue({
|
|
769
|
+
code: z.ZodIssueCode.custom,
|
|
770
|
+
message: "added panes must be in the set, removed panes must not, and neither may repeat",
|
|
771
|
+
});
|
|
772
|
+
});
|
|
773
|
+
export type PaneStreamTopologyFrame = z.infer<typeof PaneStreamTopologyFrameSchemaZ>;
|
|
774
|
+
|
|
704
775
|
export const PaneStreamClosedFrameSchemaZ = z
|
|
705
776
|
.object({
|
|
706
777
|
type: z.literal("closed"),
|
|
@@ -903,6 +974,7 @@ export const PaneStreamServerFrameSchemaZ = z.discriminatedUnion("type", [
|
|
|
903
974
|
PaneStreamCursorFrameSchemaZ,
|
|
904
975
|
PaneStreamLayoutFrameSchemaZ,
|
|
905
976
|
PaneStreamLayoutSnapshotFrameSchemaZ,
|
|
977
|
+
PaneStreamTopologyFrameSchemaZ,
|
|
906
978
|
PaneStreamFlowFrameSchemaZ,
|
|
907
979
|
PaneStreamClosedFrameSchemaZ,
|
|
908
980
|
PaneStreamInputAckFrameSchemaZ,
|
|
@@ -20,6 +20,8 @@ export const TERMINAL_DELIVERY_BINARY_CAPABILITY_VERSION = 109;
|
|
|
20
20
|
export const TERMINAL_DELIVERY_BINARY_LOCAL_CAPABILITY_VERSION = 110;
|
|
21
21
|
|
|
22
22
|
export const TERMINAL_DELIVERY_PROTOCOL_VERSION = 1 as const;
|
|
23
|
+
/** Capability numbers one offer may carry (nine before 2.9.26). */
|
|
24
|
+
export const TERMINAL_DELIVERY_MAX_OFFERED_VERSIONS = 16;
|
|
23
25
|
export const TERMINAL_DELIVERY_CHUNK_BYTES = 256 * 1024;
|
|
24
26
|
export const TERMINAL_DELIVERY_PATCH_TO_SEED_BYTES = 512 * 1024;
|
|
25
27
|
export const TERMINAL_DELIVERY_MAX_REPRESENTATION_BYTES = 16 * 1024 * 1024;
|
|
@@ -35,8 +37,12 @@ export type TerminalDeliveryEncoding = z.infer<typeof TerminalDeliveryEncodingSc
|
|
|
35
37
|
|
|
36
38
|
export const TerminalDeliveryOfferSchemaZ = z
|
|
37
39
|
.object({
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
+
// Released daemons before 2.9.26 refuse more than nine numbers, so a client
|
|
41
|
+
// offers a tenth only to a daemon whose productVersion is 2.9.26 or later.
|
|
42
|
+
protocolVersions: z
|
|
43
|
+
.array(z.number().int().positive())
|
|
44
|
+
.min(1)
|
|
45
|
+
.max(TERMINAL_DELIVERY_MAX_OFFERED_VERSIONS),
|
|
40
46
|
encodings: z.array(TerminalDeliveryEncodingSchemaZ).min(1).max(4),
|
|
41
47
|
richPlacements: z.boolean(),
|
|
42
48
|
})
|
|
@@ -2,7 +2,10 @@ import { z } from "zod";
|
|
|
2
2
|
|
|
3
3
|
import { DaemonInstanceIdentitySchemaZ } from "./daemon-wire.ts";
|
|
4
4
|
import { DesktopWorkspaceNameSchemaZ } from "./desktop-workspace-name.ts";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
TerminalAttachmentSemanticPaneIdSchemaZ,
|
|
7
|
+
TerminalAttachmentSemanticWindowIdSchemaZ,
|
|
8
|
+
} from "./terminal-attachments.ts";
|
|
6
9
|
import { FleetSessionIdSchemaZ } from "./fleet-catalog.ts";
|
|
7
10
|
import { SemanticProductIdSchemaZ } from "./pane-appearance.ts";
|
|
8
11
|
|
|
@@ -30,6 +33,63 @@ export type TerminalRuntimeInventoryProjectionV1 = z.infer<
|
|
|
30
33
|
typeof TerminalRuntimeInventoryProjectionV1SchemaZ
|
|
31
34
|
>;
|
|
32
35
|
|
|
36
|
+
/**
|
|
37
|
+
* #806: version 2 also names each window with its panes, so a client can issue
|
|
38
|
+
* a pane stream for one window (`semanticWindowId` plus exactly these panes).
|
|
39
|
+
* A window is listed only when every pane in it is available; a client that
|
|
40
|
+
* asks for version 2 of an older daemon gets version 1 and has no windows.
|
|
41
|
+
*/
|
|
42
|
+
export const TerminalRuntimeInventoryWindowSchemaZ = z
|
|
43
|
+
.object({
|
|
44
|
+
semanticWindowId: TerminalAttachmentSemanticWindowIdSchemaZ,
|
|
45
|
+
/** tmux's current window of the session. */
|
|
46
|
+
active: z.boolean(),
|
|
47
|
+
semanticPaneIds: z
|
|
48
|
+
.array(TerminalAttachmentSemanticPaneIdSchemaZ)
|
|
49
|
+
.min(1)
|
|
50
|
+
.max(256)
|
|
51
|
+
.refine((values) => new Set(values).size === values.length, "pane ids must be unique"),
|
|
52
|
+
})
|
|
53
|
+
.strict();
|
|
54
|
+
export type TerminalRuntimeInventoryWindow = z.infer<typeof TerminalRuntimeInventoryWindowSchemaZ>;
|
|
55
|
+
|
|
56
|
+
export const TerminalRuntimeInventoryProjectionV2SchemaZ =
|
|
57
|
+
TerminalRuntimeInventoryProjectionV1SchemaZ.extend({
|
|
58
|
+
/** In tmux window order. */
|
|
59
|
+
windows: z.array(TerminalRuntimeInventoryWindowSchemaZ).max(256),
|
|
60
|
+
})
|
|
61
|
+
.strict()
|
|
62
|
+
.superRefine((value, ctx) => {
|
|
63
|
+
const listed = new Set(value.semanticPaneIds);
|
|
64
|
+
const seen = new Set<string>();
|
|
65
|
+
const windows = new Set<string>();
|
|
66
|
+
let active = 0;
|
|
67
|
+
for (const window of value.windows) {
|
|
68
|
+
if (windows.has(window.semanticWindowId))
|
|
69
|
+
ctx.addIssue({ code: "custom", message: "a window is listed twice", path: ["windows"] });
|
|
70
|
+
windows.add(window.semanticWindowId);
|
|
71
|
+
if (window.active) active += 1;
|
|
72
|
+
for (const pane of window.semanticPaneIds) {
|
|
73
|
+
if (!listed.has(pane) || seen.has(pane))
|
|
74
|
+
ctx.addIssue({
|
|
75
|
+
code: "custom",
|
|
76
|
+
message: "a window pane must be listed once and in the inventory",
|
|
77
|
+
path: ["windows"],
|
|
78
|
+
});
|
|
79
|
+
seen.add(pane);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (active > 1)
|
|
83
|
+
ctx.addIssue({
|
|
84
|
+
code: "custom",
|
|
85
|
+
message: "at most one window is active",
|
|
86
|
+
path: ["windows"],
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
export type TerminalRuntimeInventoryProjectionV2 = z.infer<
|
|
90
|
+
typeof TerminalRuntimeInventoryProjectionV2SchemaZ
|
|
91
|
+
>;
|
|
92
|
+
|
|
33
93
|
export const TerminalRuntimeInventoryResourceV1SchemaZ = z
|
|
34
94
|
.object({
|
|
35
95
|
version: z.literal(TERMINAL_RUNTIME_INVENTORY_RESOURCE_VERSION),
|
|
@@ -205,6 +205,24 @@ export const TmuxServerSessionsResourceV2SchemaZ = z
|
|
|
205
205
|
.strict();
|
|
206
206
|
export type TmuxServerSessionsResourceV2 = z.infer<typeof TmuxServerSessionsResourceV2SchemaZ>;
|
|
207
207
|
|
|
208
|
+
/**
|
|
209
|
+
* #806: version 3 adds the pane count of the session's largest window, so Home
|
|
210
|
+
* can tell whether a session opens window by window (at most 24 panes per
|
|
211
|
+
* window) before opening it. Versions 1 and 2 stay as they were.
|
|
212
|
+
*/
|
|
213
|
+
export const TmuxServerSessionsResourceV3SchemaZ = z
|
|
214
|
+
.object({
|
|
215
|
+
version: z.literal(3),
|
|
216
|
+
server: TmuxServerScopeSchemaZ,
|
|
217
|
+
sessions: z.array(
|
|
218
|
+
TmuxServerSessionsResourceV2SchemaZ.shape.sessions.element
|
|
219
|
+
.extend({ largestWindowPaneCount: z.number().int().min(1) })
|
|
220
|
+
.strict(),
|
|
221
|
+
),
|
|
222
|
+
})
|
|
223
|
+
.strict();
|
|
224
|
+
export type TmuxServerSessionsResourceV3 = z.infer<typeof TmuxServerSessionsResourceV3SchemaZ>;
|
|
225
|
+
|
|
208
226
|
/** Selector intent is interpreted only by the daemon on its own host. */
|
|
209
227
|
export const TmuxServerRegistrationRequestSchemaZ = z
|
|
210
228
|
.object({
|
|
@@ -10,7 +10,9 @@ import { ADOPTED_OPTION } from "../lib/chrome-front-door.js";
|
|
|
10
10
|
let _tmuxRunner = (args) => execFileSync("tmux", ["-u", ...runtimeTmuxArgs(args)], {
|
|
11
11
|
encoding: "utf-8",
|
|
12
12
|
maxBuffer: 1024 * 1024,
|
|
13
|
-
|
|
13
|
+
// Keep stderr on the error: it is how a caller tells "no server running"
|
|
14
|
+
// from a server it could not reach. Nothing is printed either way.
|
|
15
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
14
16
|
}).trim();
|
|
15
17
|
export function _setTmuxRunner(fn) {
|
|
16
18
|
const prev = _tmuxRunner;
|
|
@@ -45,9 +47,20 @@ function semanticPaneIds(session) {
|
|
|
45
47
|
return result;
|
|
46
48
|
}
|
|
47
49
|
export function listTmuxSessions() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
return readTmuxSessions() ?? [];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* {@link listTmuxSessions}, but null when tmux could not be asked. Only a
|
|
54
|
+
* server that is not running has no sessions (#753).
|
|
55
|
+
*/
|
|
56
|
+
export function readTmuxSessions() {
|
|
57
|
+
let raw;
|
|
58
|
+
try {
|
|
59
|
+
raw = _tmuxRunner(["list-sessions", "-F", "#{session_name}"]);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return serverNotRunning(error) ? [] : null;
|
|
63
|
+
}
|
|
51
64
|
return raw.split("\n").filter(Boolean);
|
|
52
65
|
}
|
|
53
66
|
/**
|
|
@@ -350,7 +363,13 @@ function assembleAdoptedFleet(adopted, panesRaw, registry, nativeEpoch, resolveI
|
|
|
350
363
|
});
|
|
351
364
|
}
|
|
352
365
|
export function discoverSessions() {
|
|
353
|
-
|
|
366
|
+
return readSessions() ?? [];
|
|
367
|
+
}
|
|
368
|
+
/** {@link discoverSessions}, but null when tmux could not be asked (#753). */
|
|
369
|
+
export function readSessions() {
|
|
370
|
+
const sessionNames = readTmuxSessions();
|
|
371
|
+
if (sessionNames === null)
|
|
372
|
+
return null;
|
|
354
373
|
const results = [];
|
|
355
374
|
// Once the workspace registry is loaded (post daemon-embed startup),
|
|
356
375
|
// discovery is gated by registry membership: only registered workspaces
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TERMINAL_RUNTIME_INVENTORY_RESOURCE_VERSION, TerminalRuntimeInventoryProjectionV1SchemaZ, } from "@tmux-ide/contracts";
|
|
2
|
-
import { projectApplicationShellResource } from "./application-shell.js";
|
|
1
|
+
import { TERMINAL_RUNTIME_INVENTORY_RESOURCE_VERSION, TerminalRuntimeInventoryProjectionV1SchemaZ, TerminalRuntimeInventoryProjectionV2SchemaZ, } from "@tmux-ide/contracts";
|
|
2
|
+
import { paneIdentities, projectApplicationShellResource } from "./application-shell.js";
|
|
3
3
|
/** Pure, wire-safe agent-free topology projection. */
|
|
4
4
|
export function projectTerminalRuntimeInventory(session, resourceRevision) {
|
|
5
5
|
const shell = projectApplicationShellResource(session);
|
|
@@ -15,6 +15,46 @@ export function projectTerminalRuntimeInventory(session, resourceRevision) {
|
|
|
15
15
|
].sort(),
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* #806: version 1 plus each window and its panes, in tmux order. A window is
|
|
20
|
+
* named only when it has a verified window stamp and every pane in it is
|
|
21
|
+
* available, so its pane set is one a window-scoped issue can accept.
|
|
22
|
+
*/
|
|
23
|
+
export function projectTerminalRuntimeInventoryV2(session, resourceRevision) {
|
|
24
|
+
const identities = paneIdentities(session);
|
|
25
|
+
const windows = new Map();
|
|
26
|
+
session.panes.forEach((pane, index) => {
|
|
27
|
+
if (pane.windowId === undefined)
|
|
28
|
+
return;
|
|
29
|
+
const stamp = pane.windowStamp ?? null;
|
|
30
|
+
const entry = windows.get(pane.windowId) ?? {
|
|
31
|
+
semanticWindowId: stamp,
|
|
32
|
+
active: false,
|
|
33
|
+
panes: [],
|
|
34
|
+
complete: true,
|
|
35
|
+
};
|
|
36
|
+
windows.set(pane.windowId, entry);
|
|
37
|
+
const attachability = identities[index].attachability;
|
|
38
|
+
if (attachability.status === "available")
|
|
39
|
+
entry.panes.push(attachability.semanticPaneId);
|
|
40
|
+
else
|
|
41
|
+
entry.complete = false;
|
|
42
|
+
if (pane.active)
|
|
43
|
+
entry.active = true;
|
|
44
|
+
});
|
|
45
|
+
return TerminalRuntimeInventoryProjectionV2SchemaZ.parse({
|
|
46
|
+
...projectTerminalRuntimeInventory(session, resourceRevision),
|
|
47
|
+
windows: [...windows.values()].flatMap((window) => window.complete && window.semanticWindowId !== null && window.panes.length > 0
|
|
48
|
+
? [
|
|
49
|
+
{
|
|
50
|
+
semanticWindowId: window.semanticWindowId,
|
|
51
|
+
active: window.active,
|
|
52
|
+
semanticPaneIds: [...window.panes].sort(),
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
: []),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
18
58
|
export function terminalRuntimeInventoryEnvelope(daemon, session, resourceRevision) {
|
|
19
59
|
return {
|
|
20
60
|
version: TERMINAL_RUNTIME_INVENTORY_RESOURCE_VERSION,
|