tmux-ide 2.9.25 → 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 +344 -50
- package/package.json +2 -1
- package/packages/contracts/src/pane-stream.ts +19 -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/resources/terminal-runtime-inventory.js +42 -2
- package/packages/daemon/dist/command-center/tmux-servers.js +17 -7
- package/packages/daemon/dist/lib/tmux-server-owner.js +4 -2
- 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/mirror/session-channel.js +6 -1
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +1 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +98 -22
- 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 +1 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +121 -6
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +2 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +51 -4
- package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +48 -1
- package/packages/daemon/src/command-center/tmux-servers.ts +19 -6
- package/packages/daemon/src/lib/tmux-server-owner.ts +6 -3
- package/packages/daemon/src/terminal/mirror/events.ts +2 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +8 -1
- package/packages/daemon/src/terminal/pane-stream/lease-manager.ts +3 -0
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +111 -20
- 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 +1 -0
- 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 +2 -0
- package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +67 -3
package/bin/cli.js
CHANGED
|
@@ -7395,7 +7395,7 @@ var init_causal_cell = __esm({
|
|
|
7395
7395
|
|
|
7396
7396
|
// packages/contracts/src/terminal-delivery.ts
|
|
7397
7397
|
import { z as z48 } from "zod";
|
|
7398
|
-
var STOCK_CAPTURE_TAB_UNAVAILABLE, TERMINAL_DELIVERY_BINARY_CAPABILITY_VERSION, TERMINAL_DELIVERY_BINARY_LOCAL_CAPABILITY_VERSION, TERMINAL_DELIVERY_PROTOCOL_VERSION, TERMINAL_DELIVERY_CHUNK_BYTES, TERMINAL_DELIVERY_PATCH_TO_SEED_BYTES, TERMINAL_DELIVERY_MAX_REPRESENTATION_BYTES, TerminalDeliveryEncodingSchemaZ, TerminalDeliveryOfferSchemaZ, TerminalDeliveryNegotiatedSchemaZ, TerminalDeliveryNegotiationResultSchemaZ, DeliveryAddressSchemaZ, TerminalDeliveryEnvelopeSchemaZ, TerminalDeliveryFaultSchemaZ, TerminalDeliveryAckSchemaZ, TerminalDeliveryNackSchemaZ, TerminalDeliveryVisibilitySchemaZ, TerminalSemanticDeliveryPayloadSchemaZ;
|
|
7398
|
+
var STOCK_CAPTURE_TAB_UNAVAILABLE, TERMINAL_DELIVERY_BINARY_CAPABILITY_VERSION, TERMINAL_DELIVERY_BINARY_LOCAL_CAPABILITY_VERSION, TERMINAL_DELIVERY_PROTOCOL_VERSION, TERMINAL_DELIVERY_MAX_OFFERED_VERSIONS, TERMINAL_DELIVERY_CHUNK_BYTES, TERMINAL_DELIVERY_PATCH_TO_SEED_BYTES, TERMINAL_DELIVERY_MAX_REPRESENTATION_BYTES, TerminalDeliveryEncodingSchemaZ, TerminalDeliveryOfferSchemaZ, TerminalDeliveryNegotiatedSchemaZ, TerminalDeliveryNegotiationResultSchemaZ, DeliveryAddressSchemaZ, TerminalDeliveryEnvelopeSchemaZ, TerminalDeliveryFaultSchemaZ, TerminalDeliveryAckSchemaZ, TerminalDeliveryNackSchemaZ, TerminalDeliveryVisibilitySchemaZ, TerminalSemanticDeliveryPayloadSchemaZ;
|
|
7399
7399
|
var init_terminal_delivery = __esm({
|
|
7400
7400
|
"packages/contracts/src/terminal-delivery.ts"() {
|
|
7401
7401
|
"use strict";
|
|
@@ -7408,6 +7408,7 @@ var init_terminal_delivery = __esm({
|
|
|
7408
7408
|
TERMINAL_DELIVERY_BINARY_CAPABILITY_VERSION = /* @__PURE__ */ (() => 109)();
|
|
7409
7409
|
TERMINAL_DELIVERY_BINARY_LOCAL_CAPABILITY_VERSION = /* @__PURE__ */ (() => 110)();
|
|
7410
7410
|
TERMINAL_DELIVERY_PROTOCOL_VERSION = /* @__PURE__ */ (() => 1)();
|
|
7411
|
+
TERMINAL_DELIVERY_MAX_OFFERED_VERSIONS = /* @__PURE__ */ (() => 16)();
|
|
7411
7412
|
TERMINAL_DELIVERY_CHUNK_BYTES = /* @__PURE__ */ (() => 256 * 1024)();
|
|
7412
7413
|
TERMINAL_DELIVERY_PATCH_TO_SEED_BYTES = /* @__PURE__ */ (() => 512 * 1024)();
|
|
7413
7414
|
TERMINAL_DELIVERY_MAX_REPRESENTATION_BYTES = /* @__PURE__ */ (() => 16 * 1024 * 1024)();
|
|
@@ -7419,8 +7420,9 @@ var init_terminal_delivery = __esm({
|
|
|
7419
7420
|
"ansi-raw-v1"
|
|
7420
7421
|
]))();
|
|
7421
7422
|
TerminalDeliveryOfferSchemaZ = /* @__PURE__ */ (() => z48.object({
|
|
7422
|
-
//
|
|
7423
|
-
|
|
7423
|
+
// Released daemons before 2.9.26 refuse more than nine numbers, so a client
|
|
7424
|
+
// offers a tenth only to a daemon whose productVersion is 2.9.26 or later.
|
|
7425
|
+
protocolVersions: z48.array(z48.number().int().positive()).min(1).max(TERMINAL_DELIVERY_MAX_OFFERED_VERSIONS),
|
|
7424
7426
|
encodings: z48.array(TerminalDeliveryEncodingSchemaZ).min(1).max(4),
|
|
7425
7427
|
richPlacements: z48.boolean()
|
|
7426
7428
|
}).strict().superRefine((value, context) => {
|
|
@@ -7700,6 +7702,7 @@ __export(tmux_server_scope_exports, {
|
|
|
7700
7702
|
TmuxServerSessionTargetSchemaZ: () => TmuxServerSessionTargetSchemaZ,
|
|
7701
7703
|
TmuxServerSessionsResourceSchemaZ: () => TmuxServerSessionsResourceSchemaZ,
|
|
7702
7704
|
TmuxServerSessionsResourceV2SchemaZ: () => TmuxServerSessionsResourceV2SchemaZ,
|
|
7705
|
+
TmuxServerSessionsResourceV3SchemaZ: () => TmuxServerSessionsResourceV3SchemaZ,
|
|
7703
7706
|
TmuxServerWindowTargetSchemaZ: () => TmuxServerWindowTargetSchemaZ,
|
|
7704
7707
|
TmuxServersResourceSchemaZ: () => TmuxServersResourceSchemaZ,
|
|
7705
7708
|
isTmuxServerPaneStreamPath: () => isTmuxServerPaneStreamPath,
|
|
@@ -7738,7 +7741,7 @@ function base64DecodedLength(data) {
|
|
|
7738
7741
|
const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
|
|
7739
7742
|
return data.length / 4 * 3 - padding;
|
|
7740
7743
|
}
|
|
7741
|
-
var descriptorShape, TmuxServerDescriptorSchemaZ, TMUX_SERVERS_API_PATH, TmuxServersResourceSchemaZ, TmuxServerSessionTargetSchemaZ, TmuxServerWindowTargetSchemaZ, TmuxServerPaneTargetSchemaZ, TmuxServerSessionsResourceSchemaZ, TMUX_SERVER_SESSION_FAVICON_MAX_BYTES, TmuxServerSessionFaviconMimeSchemaZ, TmuxServerSessionFaviconSchemaZ, TmuxServerSessionsResourceV2SchemaZ, TmuxServerRegistrationRequestSchemaZ;
|
|
7744
|
+
var descriptorShape, TmuxServerDescriptorSchemaZ, TMUX_SERVERS_API_PATH, TmuxServersResourceSchemaZ, TmuxServerSessionTargetSchemaZ, TmuxServerWindowTargetSchemaZ, TmuxServerPaneTargetSchemaZ, TmuxServerSessionsResourceSchemaZ, TMUX_SERVER_SESSION_FAVICON_MAX_BYTES, TmuxServerSessionFaviconMimeSchemaZ, TmuxServerSessionFaviconSchemaZ, TmuxServerSessionsResourceV2SchemaZ, TmuxServerSessionsResourceV3SchemaZ, TmuxServerRegistrationRequestSchemaZ;
|
|
7742
7745
|
var init_tmux_server_scope = __esm({
|
|
7743
7746
|
"packages/contracts/src/tmux-server-scope.ts"() {
|
|
7744
7747
|
"use strict";
|
|
@@ -7832,6 +7835,13 @@ var init_tmux_server_scope = __esm({
|
|
|
7832
7835
|
}).strict()
|
|
7833
7836
|
)
|
|
7834
7837
|
}).strict())();
|
|
7838
|
+
TmuxServerSessionsResourceV3SchemaZ = /* @__PURE__ */ (() => z50.object({
|
|
7839
|
+
version: z50.literal(3),
|
|
7840
|
+
server: TmuxServerScopeSchemaZ,
|
|
7841
|
+
sessions: z50.array(
|
|
7842
|
+
TmuxServerSessionsResourceV2SchemaZ.shape.sessions.element.extend({ largestWindowPaneCount: z50.number().int().min(1) }).strict()
|
|
7843
|
+
)
|
|
7844
|
+
}).strict())();
|
|
7835
7845
|
TmuxServerRegistrationRequestSchemaZ = /* @__PURE__ */ (() => z50.object({
|
|
7836
7846
|
label: descriptorShape.label.max(128),
|
|
7837
7847
|
selector: z50.discriminatedUnion("kind", [
|
|
@@ -7940,7 +7950,7 @@ var init_terminal_graphics = __esm({
|
|
|
7940
7950
|
|
|
7941
7951
|
// packages/contracts/src/pane-stream.ts
|
|
7942
7952
|
import { z as z52 } from "zod";
|
|
7943
|
-
var PANE_STREAM_CLOCK_BOUNDS_CAPABILITY_V1, PaneStreamDiagnosticCapabilitySchemaZ, PANE_STREAM_PROTOCOL_VERSION, PANE_STREAM_ISSUE_PATH, PANE_STREAM_REDEEM_PATH, PANE_STREAM_WEBSOCKET_SUBPROTOCOL, PANE_STREAM_MAX_PANES, PANE_STREAM_MAX_OUTPUT_BYTES, PANE_STREAM_MAX_OUTPUT_BASE64_CHARS, PANE_STREAM_MAX_SEED_BYTES, PANE_STREAM_MAX_SEED_BASE64_CHARS, PANE_STREAM_MAX_HELD_DELTAS, PANE_STREAM_MAX_LAYOUT_PANES, PANE_STREAM_MAX_GRID_CELLS, PANE_STREAM_MAX_INPUT_SEQUENCE, PaneStreamSemanticPaneIdSchemaZ, PaneStreamViewerModeSchemaZ, PaneSetSchemaZ, PaneStreamLeaseRequestSchemaZ, PaneStreamRedemptionTicketSchemaZ, PaneStreamLoopbackWebSocketUrlSchemaZ, PaneStreamIssueDescriptorSchemaZ, PaneStreamIssueErrorSchemaZ, PaneStreamIssueResultSchemaZ, PaneStreamIssueMutationRequestSchemaZ, BoundedIdentitySchemaZ, PaneStreamRedeemFrameSchemaZ, PANE_STREAM_INPUT_LIFETIME_CAPABILITY_VERSION, PANE_STREAM_INPUT_BYTES_CAPABILITY_VERSION, PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION, PANE_STREAM_READER_CAPABILITY_VERSION, PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION, PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION, PaneStreamInputLifetimeSchemaZ, PaneStreamInputFrameMetadataShape, PaneStreamInputFrameSchemaZ, PaneStreamConsumedFrameSchemaZ, PaneStreamTerminalDeliveryAckFrameSchemaZ, PaneStreamTerminalProjectionReceiptFrameSchemaZ, PaneStreamTerminalProjectionMaterializeFrameSchemaZ, PaneStreamTerminalDeliveryNackFrameSchemaZ, PaneStreamTerminalDeliveryVisibilityFrameSchemaZ, PaneStreamSemanticIntentFrameSchemaZ, PaneStreamViewportFrameSchemaZ, PaneStreamAuthorityRequestIdSchemaZ, PaneStreamAuthorityGenerationSchemaZ, PaneStreamPresenceFrameSchemaZ, PaneStreamActivityFrameSchemaZ, PaneStreamAuthorityRequestFrameSchemaZ, PaneStreamAuthorityReleaseFrameSchemaZ, SharedMonotonicMicrosSchemaZ, PaneStreamClockProbeFrameSchemaZ, PaneStreamTerminalGraphicsRequestFrameSchemaZ, PaneStreamTerminalGraphicsLocalReleaseFrameSchemaZ, PaneStreamTerminalCellPixelsFrameSchemaZ, PaneStreamClientFrameSchemaZ, Base64SchemaZ, ServerSeqSchemaZ, GridCellSchemaZ, CellCoordinateSchemaZ, PaneStreamReadyFrameSchemaZ, PaneStreamSeedBatchFrameSchemaZ, PaneStreamOutputFrameSchemaZ, PaneStreamCursorFrameSchemaZ, BoundedDisplayNameSchemaZ, PaneDisplayNameSourceSchemaZ, PaneStreamLayoutFrameSchemaZ, PaneStreamLayoutSnapshotV1FrameSchemaZ, PaneStreamLayoutSnapshotV2FrameSchemaZ, PaneStreamLayoutSnapshotFrameSchemaZ, PaneStreamFlowFrameSchemaZ, PaneStreamTopologyFrameSchemaZ, PaneStreamClosedFrameSchemaZ, PaneStreamInputAckFrameSchemaZ, PaneStreamClockProbeAckFrameSchemaZ, PaneStreamCausalCellProofFrameSchemaZ, PaneStreamCausalCellFailureFrameSchemaZ, PaneStreamTerminalDeliveryReadyFrameSchemaZ, PaneStreamTerminalDeliveryEnvelopeFrameSchemaZ, PaneStreamTerminalProjectionEnvelopeFrameSchemaZ, PaneStreamTerminalDeliveryChunkFrameSchemaZ, PaneStreamTerminalDeliveryFaultFrameSchemaZ, PaneStreamTerminalGraphicsFrameSchemaZ, PaneStreamTerminalGraphicsBlobFrameSchemaZ, PaneStreamTerminalGraphicsLocalFrameSchemaZ, PaneStreamSemanticIntentAckFrameSchemaZ, PaneStreamViewportAckFrameSchemaZ, PaneStreamAuthoritySnapshotFrameSchemaZ, PaneStreamAuthorityReceiptFrameSchemaZ, PaneStreamErrorFrameCodeSchemaZ, PaneStreamErrorFrameSchemaZ, PaneStreamServerFrameSchemaZ;
|
|
7953
|
+
var PANE_STREAM_CLOCK_BOUNDS_CAPABILITY_V1, PaneStreamDiagnosticCapabilitySchemaZ, PANE_STREAM_PROTOCOL_VERSION, PANE_STREAM_ISSUE_PATH, PANE_STREAM_REDEEM_PATH, PANE_STREAM_WEBSOCKET_SUBPROTOCOL, PANE_STREAM_MAX_PANES, PANE_STREAM_MAX_OUTPUT_BYTES, PANE_STREAM_MAX_OUTPUT_BASE64_CHARS, PANE_STREAM_MAX_SEED_BYTES, PANE_STREAM_MAX_SEED_BASE64_CHARS, PANE_STREAM_MAX_HELD_DELTAS, PANE_STREAM_MAX_LAYOUT_PANES, PANE_STREAM_MAX_GRID_CELLS, PANE_STREAM_MAX_INPUT_SEQUENCE, PaneStreamSemanticPaneIdSchemaZ, PaneStreamViewerModeSchemaZ, PaneSetSchemaZ, PaneStreamLeaseRequestSchemaZ, PaneStreamRedemptionTicketSchemaZ, PaneStreamLoopbackWebSocketUrlSchemaZ, PaneStreamIssueDescriptorSchemaZ, PaneStreamIssueErrorSchemaZ, PaneStreamIssueResultSchemaZ, PaneStreamIssueMutationRequestSchemaZ, BoundedIdentitySchemaZ, PaneStreamRedeemFrameSchemaZ, PANE_STREAM_INPUT_LIFETIME_CAPABILITY_VERSION, PANE_STREAM_INPUT_BYTES_CAPABILITY_VERSION, PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION, PANE_STREAM_READER_CAPABILITY_VERSION, PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION, PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION, PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION, PaneStreamInputLifetimeSchemaZ, PaneStreamInputFrameMetadataShape, PaneStreamInputFrameSchemaZ, PaneStreamConsumedFrameSchemaZ, PaneStreamTerminalDeliveryAckFrameSchemaZ, PaneStreamTerminalProjectionReceiptFrameSchemaZ, PaneStreamTerminalProjectionMaterializeFrameSchemaZ, PaneStreamTerminalDeliveryNackFrameSchemaZ, PaneStreamTerminalDeliveryVisibilityFrameSchemaZ, PaneStreamSemanticIntentFrameSchemaZ, PaneStreamViewportFrameSchemaZ, PaneStreamAuthorityRequestIdSchemaZ, PaneStreamAuthorityGenerationSchemaZ, PaneStreamPresenceFrameSchemaZ, PaneStreamActivityFrameSchemaZ, PaneStreamAuthorityRequestFrameSchemaZ, PaneStreamAuthorityReleaseFrameSchemaZ, SharedMonotonicMicrosSchemaZ, PaneStreamClockProbeFrameSchemaZ, PaneStreamTerminalGraphicsRequestFrameSchemaZ, PaneStreamTerminalGraphicsLocalReleaseFrameSchemaZ, PaneStreamTerminalCellPixelsFrameSchemaZ, PaneStreamClientFrameSchemaZ, Base64SchemaZ, ServerSeqSchemaZ, GridCellSchemaZ, CellCoordinateSchemaZ, PaneStreamReadyFrameSchemaZ, PaneStreamSeedBatchFrameSchemaZ, PaneStreamOutputFrameSchemaZ, PaneStreamCursorFrameSchemaZ, BoundedDisplayNameSchemaZ, PaneDisplayNameSourceSchemaZ, PaneStreamLayoutFrameSchemaZ, PaneStreamLayoutSnapshotV1FrameSchemaZ, PaneStreamLayoutSnapshotV2FrameSchemaZ, PaneStreamLayoutSnapshotFrameSchemaZ, PaneStreamFlowFrameSchemaZ, PaneStreamTopologyFrameSchemaZ, PaneStreamClosedFrameSchemaZ, PaneStreamInputAckFrameSchemaZ, PaneStreamClockProbeAckFrameSchemaZ, PaneStreamCausalCellProofFrameSchemaZ, PaneStreamCausalCellFailureFrameSchemaZ, PaneStreamTerminalDeliveryReadyFrameSchemaZ, PaneStreamTerminalDeliveryEnvelopeFrameSchemaZ, PaneStreamTerminalProjectionEnvelopeFrameSchemaZ, PaneStreamTerminalDeliveryChunkFrameSchemaZ, PaneStreamTerminalDeliveryFaultFrameSchemaZ, PaneStreamTerminalGraphicsFrameSchemaZ, PaneStreamTerminalGraphicsBlobFrameSchemaZ, PaneStreamTerminalGraphicsLocalFrameSchemaZ, PaneStreamSemanticIntentAckFrameSchemaZ, PaneStreamViewportAckFrameSchemaZ, PaneStreamAuthoritySnapshotFrameSchemaZ, PaneStreamAuthorityReceiptFrameSchemaZ, PaneStreamErrorFrameCodeSchemaZ, PaneStreamErrorFrameSchemaZ, PaneStreamServerFrameSchemaZ;
|
|
7944
7954
|
var init_pane_stream = __esm({
|
|
7945
7955
|
"packages/contracts/src/pane-stream.ts"() {
|
|
7946
7956
|
"use strict";
|
|
@@ -7986,7 +7996,15 @@ var init_pane_stream = __esm({
|
|
|
7986
7996
|
panes: PaneSetSchemaZ,
|
|
7987
7997
|
viewerMode: PaneStreamViewerModeSchemaZ,
|
|
7988
7998
|
/** Explicit semantic-v2 content/authority mode. Omission retains raw v1. */
|
|
7989
|
-
terminalDelivery: TerminalDeliveryOfferSchemaZ.optional()
|
|
7999
|
+
terminalDelivery: TerminalDeliveryOfferSchemaZ.optional(),
|
|
8000
|
+
/**
|
|
8001
|
+
* #806: a stream for one window. `panes` must be exactly that window's
|
|
8002
|
+
* panes (at most PANE_STREAM_MAX_PANES), so a session with more panes in
|
|
8003
|
+
* all can be viewed window by window. Under capability 119/120 the stream
|
|
8004
|
+
* follows that window's pane set in place; other windows never enter.
|
|
8005
|
+
* Released daemons refuse the field: send it only to a daemon that has it.
|
|
8006
|
+
*/
|
|
8007
|
+
semanticWindowId: TerminalAttachmentSemanticWindowIdSchemaZ.optional()
|
|
7990
8008
|
}).strict())();
|
|
7991
8009
|
PaneStreamRedemptionTicketSchemaZ = /* @__PURE__ */ (() => z52.string().regex(/^ps2_[A-Za-z0-9_-]{43}$/u))();
|
|
7992
8010
|
PaneStreamLoopbackWebSocketUrlSchemaZ = /* @__PURE__ */ (() => z52.url().max(2048).refine((value) => {
|
|
@@ -8033,6 +8051,7 @@ var init_pane_stream = __esm({
|
|
|
8033
8051
|
PANE_STREAM_INPUT_BYTES_CAPABILITY_VERSION = /* @__PURE__ */ (() => 106)();
|
|
8034
8052
|
PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION = /* @__PURE__ */ (() => 117)();
|
|
8035
8053
|
PANE_STREAM_READER_CAPABILITY_VERSION = /* @__PURE__ */ (() => 118)();
|
|
8054
|
+
PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION = /* @__PURE__ */ (() => 123)();
|
|
8036
8055
|
PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION = /* @__PURE__ */ (() => 119)();
|
|
8037
8056
|
PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION = /* @__PURE__ */ (() => 120)();
|
|
8038
8057
|
PaneStreamInputLifetimeSchemaZ = /* @__PURE__ */ (() => z52.object({
|
|
@@ -8247,6 +8266,11 @@ var init_pane_stream = __esm({
|
|
|
8247
8266
|
displayName: BoundedDisplayNameSchemaZ.nullable().optional(),
|
|
8248
8267
|
displayNameSource: PaneDisplayNameSourceSchemaZ.nullable().optional(),
|
|
8249
8268
|
browserIcon: z52.string().regex(/^(?:[0-9a-f]{2048})?$/u).nullable().optional(),
|
|
8269
|
+
/**
|
|
8270
|
+
* Only with capability 123: a terminal browser with tmux-ide's
|
|
8271
|
+
* native controls, a plain one without them, or null.
|
|
8272
|
+
*/
|
|
8273
|
+
browserKind: z52.enum(["native", "plain"]).nullable().optional(),
|
|
8250
8274
|
/** Only with capability 118: the Markdown reader's file name, never its path. */
|
|
8251
8275
|
reader: z52.object({
|
|
8252
8276
|
name: z52.string().min(1).max(255).refine((value) => !hasControlCharacter(value) && !value.includes("/"))
|
|
@@ -10704,7 +10728,7 @@ var init_terminal_graphics_compressed = __esm({
|
|
|
10704
10728
|
|
|
10705
10729
|
// packages/contracts/src/terminal-runtime-inventory.ts
|
|
10706
10730
|
import { z as z72 } from "zod";
|
|
10707
|
-
var TERMINAL_RUNTIME_INVENTORY_RESOURCE_VERSION, TerminalRuntimeInventoryProjectionV1SchemaZ;
|
|
10731
|
+
var TERMINAL_RUNTIME_INVENTORY_RESOURCE_VERSION, TerminalRuntimeInventoryProjectionV1SchemaZ, TerminalRuntimeInventoryWindowSchemaZ, TerminalRuntimeInventoryProjectionV2SchemaZ;
|
|
10708
10732
|
var init_terminal_runtime_inventory = __esm({
|
|
10709
10733
|
"packages/contracts/src/terminal-runtime-inventory.ts"() {
|
|
10710
10734
|
"use strict";
|
|
@@ -10724,6 +10748,42 @@ var init_terminal_runtime_inventory = __esm({
|
|
|
10724
10748
|
"pane ids must be sorted"
|
|
10725
10749
|
)
|
|
10726
10750
|
}).strict())();
|
|
10751
|
+
TerminalRuntimeInventoryWindowSchemaZ = /* @__PURE__ */ (() => z72.object({
|
|
10752
|
+
semanticWindowId: TerminalAttachmentSemanticWindowIdSchemaZ,
|
|
10753
|
+
/** tmux's current window of the session. */
|
|
10754
|
+
active: z72.boolean(),
|
|
10755
|
+
semanticPaneIds: z72.array(TerminalAttachmentSemanticPaneIdSchemaZ).min(1).max(256).refine((values2) => new Set(values2).size === values2.length, "pane ids must be unique")
|
|
10756
|
+
}).strict())();
|
|
10757
|
+
TerminalRuntimeInventoryProjectionV2SchemaZ = /* @__PURE__ */ (() => TerminalRuntimeInventoryProjectionV1SchemaZ.extend({
|
|
10758
|
+
/** In tmux window order. */
|
|
10759
|
+
windows: z72.array(TerminalRuntimeInventoryWindowSchemaZ).max(256)
|
|
10760
|
+
}).strict().superRefine((value, ctx) => {
|
|
10761
|
+
const listed = new Set(value.semanticPaneIds);
|
|
10762
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10763
|
+
const windows = /* @__PURE__ */ new Set();
|
|
10764
|
+
let active3 = 0;
|
|
10765
|
+
for (const window2 of value.windows) {
|
|
10766
|
+
if (windows.has(window2.semanticWindowId))
|
|
10767
|
+
ctx.addIssue({ code: "custom", message: "a window is listed twice", path: ["windows"] });
|
|
10768
|
+
windows.add(window2.semanticWindowId);
|
|
10769
|
+
if (window2.active) active3 += 1;
|
|
10770
|
+
for (const pane of window2.semanticPaneIds) {
|
|
10771
|
+
if (!listed.has(pane) || seen.has(pane))
|
|
10772
|
+
ctx.addIssue({
|
|
10773
|
+
code: "custom",
|
|
10774
|
+
message: "a window pane must be listed once and in the inventory",
|
|
10775
|
+
path: ["windows"]
|
|
10776
|
+
});
|
|
10777
|
+
seen.add(pane);
|
|
10778
|
+
}
|
|
10779
|
+
}
|
|
10780
|
+
if (active3 > 1)
|
|
10781
|
+
ctx.addIssue({
|
|
10782
|
+
code: "custom",
|
|
10783
|
+
message: "at most one window is active",
|
|
10784
|
+
path: ["windows"]
|
|
10785
|
+
});
|
|
10786
|
+
}))();
|
|
10727
10787
|
}
|
|
10728
10788
|
});
|
|
10729
10789
|
|
|
@@ -15376,7 +15436,7 @@ var require_package = __commonJS({
|
|
|
15376
15436
|
"package.json"(exports, module) {
|
|
15377
15437
|
module.exports = {
|
|
15378
15438
|
name: "tmux-ide",
|
|
15379
|
-
version: "2.9.
|
|
15439
|
+
version: "2.9.26",
|
|
15380
15440
|
description: "The open-source workspace for coding agents: run Claude Code, Codex and other agents in tmux with live status",
|
|
15381
15441
|
type: "module",
|
|
15382
15442
|
bin: {
|
|
@@ -15415,6 +15475,7 @@ var require_package = __commonJS({
|
|
|
15415
15475
|
"test:tmux-boundary": "node scripts/test-tmux-boundary.mjs",
|
|
15416
15476
|
build: "pnpm build:cli",
|
|
15417
15477
|
"build:cli": "node scripts/build-cli.mjs",
|
|
15478
|
+
"check:cli-bundle": "node scripts/check-cli-bundle.mjs",
|
|
15418
15479
|
"build:macos-notifier": "node scripts/build-macos-notifier.mjs",
|
|
15419
15480
|
"build:tui": "bun scripts/build-tui.mjs",
|
|
15420
15481
|
prepack: "pnpm build:cli",
|
|
@@ -28355,7 +28416,7 @@ function parseSessionPaneDescriptorReply(lines) {
|
|
|
28355
28416
|
continue;
|
|
28356
28417
|
}
|
|
28357
28418
|
const encoded = utf8Line.split(" ");
|
|
28358
|
-
if (encoded.length < 21 || encoded.length >
|
|
28419
|
+
if (encoded.length < 21 || encoded.length > 26) continue;
|
|
28359
28420
|
const [
|
|
28360
28421
|
runtimePaneId = "",
|
|
28361
28422
|
semanticPaneId3 = "",
|
|
@@ -28381,7 +28442,8 @@ function parseSessionPaneDescriptorReply(lines) {
|
|
|
28381
28442
|
nameSource2 = "",
|
|
28382
28443
|
browserIconRaw = "",
|
|
28383
28444
|
readerRaw = "",
|
|
28384
|
-
panePidRaw = ""
|
|
28445
|
+
panePidRaw = "",
|
|
28446
|
+
browserControl = ""
|
|
28385
28447
|
] = encoded.map(decodeTmuxArgument);
|
|
28386
28448
|
if (!/^%(?:0|[1-9][0-9]*)$/u.test(runtimePaneId) || runtimePaneId.length > 32) continue;
|
|
28387
28449
|
if (!/^\$(?:0|[1-9][0-9]*)$/u.test(runtimeSessionId) || runtimeSessionId.length > 32) continue;
|
|
@@ -28400,6 +28462,7 @@ function parseSessionPaneDescriptorReply(lines) {
|
|
|
28400
28462
|
}
|
|
28401
28463
|
descriptors.push({
|
|
28402
28464
|
browserIcon: browserIcon(browserIconRaw),
|
|
28465
|
+
browserKind: terminalBrowserKind(browserControl, currentCommand),
|
|
28403
28466
|
reader: readerOption(readerRaw, panePidRaw),
|
|
28404
28467
|
sessionName,
|
|
28405
28468
|
runtimePaneId,
|
|
@@ -28442,6 +28505,17 @@ function decodeControlReplyUtf8(value) {
|
|
|
28442
28505
|
function positiveInteger(value, fallback) {
|
|
28443
28506
|
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
|
|
28444
28507
|
}
|
|
28508
|
+
function terminalBrowserKind(control, currentCommand, alive = processAlive) {
|
|
28509
|
+
if (control.length > 0 && control.length <= 4096) {
|
|
28510
|
+
try {
|
|
28511
|
+
const pid = JSON.parse(control)?.pid;
|
|
28512
|
+
if (typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0 && alive(pid))
|
|
28513
|
+
return "native";
|
|
28514
|
+
} catch {
|
|
28515
|
+
}
|
|
28516
|
+
}
|
|
28517
|
+
return /^terminal-browser?$/u.test(currentCommand) ? "plain" : null;
|
|
28518
|
+
}
|
|
28445
28519
|
var SESSION_PANE_DESCRIPTOR_FORMAT, VOLATILE_DESCRIPTOR_FIELDS, SessionDescriptorDiscovery, STRICT_UTF8_DECODER;
|
|
28446
28520
|
var init_session_descriptor_discovery = __esm({
|
|
28447
28521
|
"packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts"() {
|
|
@@ -28474,7 +28548,9 @@ var init_session_descriptor_discovery = __esm({
|
|
|
28474
28548
|
"#{qa:@tmux_ide_browser_icon}",
|
|
28475
28549
|
"#{qa:@tmux_ide_reader}",
|
|
28476
28550
|
// The reader option belongs to the pane only when its own process set it.
|
|
28477
|
-
"#{pane_pid}"
|
|
28551
|
+
"#{pane_pid}",
|
|
28552
|
+
// Set only by a terminal browser that has tmux-ide's native controls (#718).
|
|
28553
|
+
"#{qa:@tmux_ide_browser_control}"
|
|
28478
28554
|
].join(" ");
|
|
28479
28555
|
VOLATILE_DESCRIPTOR_FIELDS = /* @__PURE__ */ new Set([
|
|
28480
28556
|
4,
|
|
@@ -34649,6 +34725,9 @@ var init_session_channel = __esm({
|
|
|
34649
34725
|
await this.captureAttachedSessionIdentity();
|
|
34650
34726
|
this.io.send("refresh-client -B 'tmux-ide-browser-icon:%*:#{@tmux_ide_browser_icon}'");
|
|
34651
34727
|
this.io.send("refresh-client -B 'tmux-ide-reader:%*:#{@tmux_ide_reader}'");
|
|
34728
|
+
this.io.send(
|
|
34729
|
+
"refresh-client -B 'tmux-ide-browser-kind:%*:#{@tmux_ide_browser_control}#{m:terminal-browse*,#{pane_current_command}}'"
|
|
34730
|
+
);
|
|
34652
34731
|
this.io.send("refresh-client -B 'tmux-ide-pane-borders:@*:#{pane-border-status}'");
|
|
34653
34732
|
this.io.send("refresh-client -B 'tmux-ide-copy-keys:@*:#{mode-keys}'");
|
|
34654
34733
|
this.io.send("refresh-client -B 'tmux-ide-pane-history:%*:#{history_size}'");
|
|
@@ -36350,7 +36429,7 @@ var init_session_channel = __esm({
|
|
|
36350
36429
|
onNotify(name, rest) {
|
|
36351
36430
|
if (name === "window-add" || name === "window-close" || name === "unlinked-window-add" || name === "unlinked-window-close" || name === "session-renamed" || name === "sessions-changed")
|
|
36352
36431
|
this.opts.onWindowTopologyChanged?.();
|
|
36353
|
-
if (name === "subscription-changed" && (rest.startsWith("tmux-ide-browser-icon ") || rest.startsWith("tmux-ide-reader "))) {
|
|
36432
|
+
if (name === "subscription-changed" && (rest.startsWith("tmux-ide-browser-icon ") || rest.startsWith("tmux-ide-reader ") || rest.startsWith("tmux-ide-browser-kind "))) {
|
|
36354
36433
|
this.scheduleSync();
|
|
36355
36434
|
return;
|
|
36356
36435
|
}
|
|
@@ -36671,6 +36750,7 @@ var init_session_channel = __esm({
|
|
|
36671
36750
|
displayName: display?.name ?? null,
|
|
36672
36751
|
displayNameSource: display?.source ?? null,
|
|
36673
36752
|
browserIcon: pane?.descriptor?.browserIcon ?? null,
|
|
36753
|
+
browserKind: pane?.descriptor?.browserKind ?? null,
|
|
36674
36754
|
reader: pane?.descriptor?.reader ?? null,
|
|
36675
36755
|
left: leaf.left,
|
|
36676
36756
|
top: leaf.top,
|
|
@@ -62991,6 +63071,9 @@ var init_xterm_terminal_interpreter_backend = __esm({
|
|
|
62991
63071
|
#terminal;
|
|
62992
63072
|
#rowCache = /* @__PURE__ */ new WeakMap();
|
|
62993
63073
|
#scrollEpoch = 0;
|
|
63074
|
+
#historyLimit;
|
|
63075
|
+
#collecting = false;
|
|
63076
|
+
#lastYbase = null;
|
|
62994
63077
|
#lastScrollEpoch = 0;
|
|
62995
63078
|
#lastViewportY = 0;
|
|
62996
63079
|
#lastBufferType = "normal";
|
|
@@ -63003,11 +63086,16 @@ var init_xterm_terminal_interpreter_backend = __esm({
|
|
|
63003
63086
|
#historyProjectionInvalidated = false;
|
|
63004
63087
|
#scrollOnClear;
|
|
63005
63088
|
constructor(options) {
|
|
63089
|
+
const historyLimit = options.historyLimit ?? options.scrollback;
|
|
63090
|
+
this.#historyLimit = historyLimit;
|
|
63006
63091
|
this.#terminal = new Terminal2({
|
|
63007
63092
|
cols: options.cols,
|
|
63008
63093
|
rows: options.rows,
|
|
63009
|
-
|
|
63010
|
-
|
|
63094
|
+
// One row of headroom over what the replica may hold (the limit, or a
|
|
63095
|
+
// larger captured history): xterm must not recycle the row a scroll
|
|
63096
|
+
// adds before #collectHistory sees it.
|
|
63097
|
+
scrollback: historyLimit > 0 ? Math.max(options.scrollback, historyLimit) + 1 : options.scrollback,
|
|
63098
|
+
tmuxHistoryLimit: historyLimit,
|
|
63011
63099
|
allowProposedApi: true
|
|
63012
63100
|
});
|
|
63013
63101
|
this.#terminal.loadAddon(new import_addon_unicode11.Unicode11Addon());
|
|
@@ -63037,7 +63125,9 @@ var init_xterm_terminal_interpreter_backend = __esm({
|
|
|
63037
63125
|
return false;
|
|
63038
63126
|
});
|
|
63039
63127
|
this.#terminal.onScroll(() => {
|
|
63040
|
-
if (this.#terminal.buffer.active.type
|
|
63128
|
+
if (this.#terminal.buffer.active.type !== "normal") return;
|
|
63129
|
+
this.#scrollEpoch += 1;
|
|
63130
|
+
this.#collectHistory();
|
|
63041
63131
|
});
|
|
63042
63132
|
const core = this.#terminal._core;
|
|
63043
63133
|
if (!core?.coreService) {
|
|
@@ -63045,6 +63135,34 @@ var init_xterm_terminal_interpreter_backend = __esm({
|
|
|
63045
63135
|
throw new Error("Unsupported @tmux-ide/xterm-headless private API shape");
|
|
63046
63136
|
}
|
|
63047
63137
|
}
|
|
63138
|
+
/**
|
|
63139
|
+
* tmux at its history-limit collects the oldest tenth of history before a
|
|
63140
|
+
* scroll would pass it (grid_collect_history), so its history_size moves
|
|
63141
|
+
* between 0.9 and 1.0 of the limit. Recycling one row at a time instead kept
|
|
63142
|
+
* the replica at the limit, and the owner's history-size check then reseeded
|
|
63143
|
+
* the whole pane each time its output paused. The projection reports the
|
|
63144
|
+
* collection as an ordinary history trim.
|
|
63145
|
+
*/
|
|
63146
|
+
startHistoryCollection() {
|
|
63147
|
+
this.#collecting = true;
|
|
63148
|
+
this.#lastYbase = this.#normalBuffer()?.ybase ?? null;
|
|
63149
|
+
}
|
|
63150
|
+
#normalBuffer() {
|
|
63151
|
+
return this.#terminal._core?.buffers?.normal;
|
|
63152
|
+
}
|
|
63153
|
+
#collectHistory() {
|
|
63154
|
+
const buffer = this.#normalBuffer();
|
|
63155
|
+
if (!buffer) return;
|
|
63156
|
+
const before = this.#lastYbase;
|
|
63157
|
+
const limit = this.#historyLimit;
|
|
63158
|
+
if (this.#collecting && limit > 0 && before !== null && before >= limit && buffer.ybase === before + 1) {
|
|
63159
|
+
const trim = Math.min(buffer.ybase, Math.max(1, Math.floor(limit / 10)));
|
|
63160
|
+
buffer.lines.trimStart(trim);
|
|
63161
|
+
buffer.ybase -= trim;
|
|
63162
|
+
buffer.ydisp = Math.max(0, buffer.ydisp - trim);
|
|
63163
|
+
}
|
|
63164
|
+
this.#lastYbase = buffer.ybase;
|
|
63165
|
+
}
|
|
63048
63166
|
get cols() {
|
|
63049
63167
|
return this.#terminal.cols;
|
|
63050
63168
|
}
|
|
@@ -64289,6 +64407,7 @@ var init_terminal_replica_interpreter = __esm({
|
|
|
64289
64407
|
rows: options.rows,
|
|
64290
64408
|
scrollback: this.#scrollback
|
|
64291
64409
|
});
|
|
64410
|
+
this.#backend.startHistoryCollection?.();
|
|
64292
64411
|
this.#kitty = new KittyImageStore(
|
|
64293
64412
|
options.kittyImageBudget ? { budget: options.kittyImageBudget } : {}
|
|
64294
64413
|
);
|
|
@@ -64466,6 +64585,7 @@ var init_terminal_replica_interpreter = __esm({
|
|
|
64466
64585
|
this.#admitRaw(chunk);
|
|
64467
64586
|
this.#observeMarkerBytes(chunk);
|
|
64468
64587
|
}
|
|
64588
|
+
replacement.startHistoryCollection?.();
|
|
64469
64589
|
const previous = this.#backend;
|
|
64470
64590
|
this.#backend = replacement;
|
|
64471
64591
|
this.#attachKitty(replacement);
|
|
@@ -65843,15 +65963,16 @@ function semanticPayload(baselineRevision, baseline, target, baselineIncarnation
|
|
|
65843
65963
|
patch: update.patch
|
|
65844
65964
|
};
|
|
65845
65965
|
const snapshot3 = target.state.snapshot;
|
|
65846
|
-
|
|
65966
|
+
const trim = baseline ? historyTrim(baseline.history, snapshot3.history) : 0;
|
|
65967
|
+
if (baseline && baselineIncarnation === update.incarnation && baseline.cols === snapshot3.cols && baseline.rows === snapshot3.rows && baseline.history.length - trim <= snapshot3.history.length) {
|
|
65847
65968
|
let comparisonCells = 0;
|
|
65848
65969
|
const equal = (left, right) => {
|
|
65849
65970
|
if (left === right) return true;
|
|
65850
65971
|
comparisonCells += right.cells.length;
|
|
65851
65972
|
return comparisonCells <= TERMINAL_COMPACT_COOPERATIVE_SEED_CELLS ? terminalReplicaRowsEqual(left, right) : null;
|
|
65852
65973
|
};
|
|
65853
|
-
for (let index =
|
|
65854
|
-
if (equal(baseline.history[index], snapshot3.history[index]) !== true)
|
|
65974
|
+
for (let index = trim; index < baseline.history.length; index++)
|
|
65975
|
+
if (equal(baseline.history[index], snapshot3.history[index - trim]) !== true)
|
|
65855
65976
|
return semanticSeed(target);
|
|
65856
65977
|
const rows = [];
|
|
65857
65978
|
for (let index = 0; index < snapshot3.grid.length; index++) {
|
|
@@ -65859,17 +65980,18 @@ function semanticPayload(baselineRevision, baseline, target, baselineIncarnation
|
|
|
65859
65980
|
if (same7 === null) return semanticSeed(target);
|
|
65860
65981
|
if (!same7) rows.push({ index, row: snapshot3.grid[index] });
|
|
65861
65982
|
}
|
|
65862
|
-
const
|
|
65983
|
+
const retained = baseline.history.length - trim;
|
|
65984
|
+
const appendedRows = snapshot3.history.length - retained;
|
|
65863
65985
|
if ((rows.length + appendedRows) * snapshot3.cols >= TERMINAL_COMPACT_COOPERATIVE_SEED_CELLS)
|
|
65864
65986
|
return semanticSeed(target);
|
|
65865
|
-
const append = snapshot3.history.slice(
|
|
65987
|
+
const append = snapshot3.history.slice(retained);
|
|
65866
65988
|
return {
|
|
65867
65989
|
frame: "patch",
|
|
65868
65990
|
baseRevision: baselineRevision,
|
|
65869
65991
|
revision: update.revision,
|
|
65870
65992
|
patch: {
|
|
65871
65993
|
rows,
|
|
65872
|
-
...append.length ? { historyDelta: { trim
|
|
65994
|
+
...append.length || trim ? { historyDelta: { trim, append } } : {},
|
|
65873
65995
|
cursor: snapshot3.cursor,
|
|
65874
65996
|
modes: snapshot3.modes,
|
|
65875
65997
|
placements: snapshot3.placements,
|
|
@@ -65879,6 +66001,25 @@ function semanticPayload(baselineRevision, baseline, target, baselineIncarnation
|
|
|
65879
66001
|
}
|
|
65880
66002
|
return semanticSeed(target);
|
|
65881
66003
|
}
|
|
66004
|
+
function historyTrim(baseline, target) {
|
|
66005
|
+
const first = target[0];
|
|
66006
|
+
if (first === void 0 || baseline[0] === first) return 0;
|
|
66007
|
+
let candidates = 0;
|
|
66008
|
+
for (let trim = 1; trim < baseline.length; trim++) {
|
|
66009
|
+
if (baseline[trim] !== first) continue;
|
|
66010
|
+
if (++candidates > 4) return 0;
|
|
66011
|
+
const retained = baseline.length - trim;
|
|
66012
|
+
if (retained > target.length) continue;
|
|
66013
|
+
let same7 = true;
|
|
66014
|
+
for (let index = 0; index < retained; index++)
|
|
66015
|
+
if (baseline[trim + index] !== target[index]) {
|
|
66016
|
+
same7 = false;
|
|
66017
|
+
break;
|
|
66018
|
+
}
|
|
66019
|
+
if (same7) return trim;
|
|
66020
|
+
}
|
|
66021
|
+
return 0;
|
|
66022
|
+
}
|
|
65882
66023
|
function canonicalUpdateCellCost(update) {
|
|
65883
66024
|
if (update.type === "terminal.tombstone") return 0;
|
|
65884
66025
|
if (update.type === "terminal.seed")
|
|
@@ -65941,7 +66082,7 @@ function logDeliveryFault(client, reason, cause) {
|
|
|
65941
66082
|
workspace: client.deliveryWorkspaceName
|
|
65942
66083
|
});
|
|
65943
66084
|
}
|
|
65944
|
-
var MAX_CANONICAL_REVISIONS, MAX_RAW_JOURNAL_BYTES, MAX_REPRESENTATION_CACHE_ENTRIES, MAX_REPRESENTATION_CACHE_BYTES, MAX_CLIENTS, MAX_PANES, MAX_PENDING_CANONICAL_CELLS, MAX_CONNECTIONS, BACKGROUND_CADENCE_MS, DeferredProjectionEncoding, DeferredSeedEncoding, ExactSemanticRepresentationSelectionError, TerminalDeliveryRepresentationSelectionError, TerminalDeliveryPreaccountLimitError, SessionRuntimeTerminalDeliveryHub;
|
|
66085
|
+
var MAX_CANONICAL_REVISIONS, MAX_RAW_JOURNAL_BYTES, MAX_REPRESENTATION_CACHE_ENTRIES, MAX_REPRESENTATION_CACHE_BYTES, MAX_CLIENTS, MAX_PANES, MAX_PENDING_CANONICAL_CELLS, MAX_CONNECTIONS, BACKGROUND_CADENCE_MS, TERMINAL_DELIVERY_CONNECTION_UNACKED_BYTES, TERMINAL_DELIVERY_CONNECTION_HOLD_MS, TERMINAL_DELIVERY_CONNECTION_CONGESTED_MS, DeferredProjectionEncoding, DeferredSeedEncoding, ExactSemanticRepresentationSelectionError, TerminalDeliveryRepresentationSelectionError, TerminalDeliveryPreaccountLimitError, SessionRuntimeTerminalDeliveryHub;
|
|
65945
66086
|
var init_terminal_delivery_hub = __esm({
|
|
65946
66087
|
"packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts"() {
|
|
65947
66088
|
"use strict";
|
|
@@ -65965,6 +66106,9 @@ var init_terminal_delivery_hub = __esm({
|
|
|
65965
66106
|
MAX_PENDING_CANONICAL_CELLS = 1e6;
|
|
65966
66107
|
MAX_CONNECTIONS = MAX_CLIENTS * MAX_PANES;
|
|
65967
66108
|
BACKGROUND_CADENCE_MS = 100;
|
|
66109
|
+
TERMINAL_DELIVERY_CONNECTION_UNACKED_BYTES = 256 * 1024;
|
|
66110
|
+
TERMINAL_DELIVERY_CONNECTION_HOLD_MS = 250;
|
|
66111
|
+
TERMINAL_DELIVERY_CONNECTION_CONGESTED_MS = 30;
|
|
65968
66112
|
DeferredProjectionEncoding = class extends Error {
|
|
65969
66113
|
constructor(payload) {
|
|
65970
66114
|
super("Deferred projection encoding");
|
|
@@ -66016,6 +66160,8 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66016
66160
|
this.generation = generation;
|
|
66017
66161
|
this.workspaceName = workspaceName;
|
|
66018
66162
|
this.#ownerForPane = ownerForPane;
|
|
66163
|
+
this.#holdMs = options.connectionHoldMs ?? TERMINAL_DELIVERY_CONNECTION_HOLD_MS;
|
|
66164
|
+
this.#congestedMs = options.connectionCongestedMs ?? TERMINAL_DELIVERY_CONNECTION_CONGESTED_MS;
|
|
66019
66165
|
this.#scheduler = options.scheduler ?? SYSTEM_SESSION_RUNTIME_SCHEDULER;
|
|
66020
66166
|
this.#observability = options.observability ?? DISABLED_SESSION_RUNTIME_OBSERVABILITY;
|
|
66021
66167
|
}
|
|
@@ -66026,6 +66172,8 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66026
66172
|
#observability;
|
|
66027
66173
|
#panes = /* @__PURE__ */ new Map();
|
|
66028
66174
|
#clients = /* @__PURE__ */ new Map();
|
|
66175
|
+
/** Per connection: the pane it last typed into. */
|
|
66176
|
+
#priority = /* @__PURE__ */ new Map();
|
|
66029
66177
|
#sourceCloseFailures = 0;
|
|
66030
66178
|
#pendingSourceCloses = 0;
|
|
66031
66179
|
/** Synchronous reservations held while an async pane source is starting. */
|
|
@@ -66043,6 +66191,8 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66043
66191
|
#deliveryLifecycleOrdinal = 0;
|
|
66044
66192
|
#deliveryStatusOrdinal = 0;
|
|
66045
66193
|
#closed = false;
|
|
66194
|
+
#holdMs;
|
|
66195
|
+
#congestedMs;
|
|
66046
66196
|
async open(clientId, semanticPaneId3, offerInput, accept, diagnosticIdentity = Object.freeze({ clientId, surface: "direct", laneId: clientId }), deliveryWorkspaceName = this.workspaceName) {
|
|
66047
66197
|
if (this.#closed) throw new Error("Terminal delivery hub is closed");
|
|
66048
66198
|
const address = WorkspaceIdSchemaZ.parse(deliveryWorkspaceName);
|
|
@@ -66104,7 +66254,10 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66104
66254
|
captureUnavailable: false,
|
|
66105
66255
|
lastAck: null,
|
|
66106
66256
|
sourceClosedFlight: null,
|
|
66107
|
-
backgroundTimer: null
|
|
66257
|
+
backgroundTimer: null,
|
|
66258
|
+
budgetHeld: false,
|
|
66259
|
+
budgetHeldSince: null,
|
|
66260
|
+
budgetTimer: null
|
|
66108
66261
|
};
|
|
66109
66262
|
this.#clients.set(key2, client);
|
|
66110
66263
|
client.lifecycleOpenRecorded = this.#recordDeliveryLifecycle(client, pane, "open");
|
|
@@ -66117,6 +66270,11 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66117
66270
|
projectionReceipt: (receipt) => this.#projectionReceipt(client, receipt),
|
|
66118
66271
|
materialize: (request3) => this.#materialize(client, request3),
|
|
66119
66272
|
nack: (nack) => this.#nack(client, nack),
|
|
66273
|
+
prioritize: () => {
|
|
66274
|
+
if (client.closed) return;
|
|
66275
|
+
this.#priority.set(client.clientId, client.paneId);
|
|
66276
|
+
this.#releaseBudget(client.clientId);
|
|
66277
|
+
},
|
|
66120
66278
|
setVisibility: (visibilityInput) => {
|
|
66121
66279
|
if (client.closed) return;
|
|
66122
66280
|
client.visibility = TerminalDeliveryVisibilitySchemaZ.parse(visibilityInput);
|
|
@@ -66294,6 +66452,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66294
66452
|
this.#cancelEncoding(client);
|
|
66295
66453
|
client.outgoing.length = 0;
|
|
66296
66454
|
client.inFlight = null;
|
|
66455
|
+
client.budgetHeld = false;
|
|
66297
66456
|
logDeliveryFault(client, "source-closed", "source-restarted");
|
|
66298
66457
|
this.#enqueue(client, {
|
|
66299
66458
|
type: "terminal.delivery.fault",
|
|
@@ -66578,6 +66737,32 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66578
66737
|
pane.rawFloorRevision = Math.max(pane.rawFloorRevision, first[0] + 1);
|
|
66579
66738
|
}
|
|
66580
66739
|
}
|
|
66740
|
+
#overBudget(client) {
|
|
66741
|
+
if (this.#priority.get(client.clientId) === client.paneId) return false;
|
|
66742
|
+
if (client.budgetHeldSince !== null && this.#scheduler.nowMs() - client.budgetHeldSince >= this.#holdMs)
|
|
66743
|
+
return false;
|
|
66744
|
+
const now = this.#scheduler.nowMs();
|
|
66745
|
+
let bytes = 0;
|
|
66746
|
+
let oldest = now;
|
|
66747
|
+
for (const other of this.#clients.values())
|
|
66748
|
+
if (other !== client && other.clientId === client.clientId && other.inFlight) {
|
|
66749
|
+
bytes += other.inFlight.envelope.representationBytes;
|
|
66750
|
+
oldest = Math.min(oldest, other.inFlight.sentAt);
|
|
66751
|
+
}
|
|
66752
|
+
return bytes >= TERMINAL_DELIVERY_CONNECTION_UNACKED_BYTES && now - oldest >= this.#congestedMs;
|
|
66753
|
+
}
|
|
66754
|
+
/** A pane's delivery settled or left: held panes of its connection try again, typed-into pane first. */
|
|
66755
|
+
#releaseBudget(clientId) {
|
|
66756
|
+
const held = [...this.#clients.values()].filter(
|
|
66757
|
+
(other) => other.clientId === clientId && other.budgetHeld
|
|
66758
|
+
);
|
|
66759
|
+
const priority = this.#priority.get(clientId);
|
|
66760
|
+
held.sort((a, b) => Number(b.paneId === priority) - Number(a.paneId === priority));
|
|
66761
|
+
for (const other of held) {
|
|
66762
|
+
other.budgetHeld = false;
|
|
66763
|
+
this.#schedule(other);
|
|
66764
|
+
}
|
|
66765
|
+
}
|
|
66581
66766
|
#schedule(client) {
|
|
66582
66767
|
if (client.closed || client.captureUnavailable || client.inFlight || client.encoding || client.latestRevision === null || client.latestRevision === client.baselineRevision || client.visibility === "hidden" || client.visibility === "frozen")
|
|
66583
66768
|
return;
|
|
@@ -66603,6 +66788,20 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66603
66788
|
const target = completed?.target ?? pane?.latest;
|
|
66604
66789
|
if (!pane || !target || client.closed || client.captureUnavailable || client.inFlight || client.encoding || client.visibility === "hidden" || client.visibility === "frozen" || !completed && target.update.revision !== client.latestRevision)
|
|
66605
66790
|
return;
|
|
66791
|
+
if (!completed && this.#overBudget(client)) {
|
|
66792
|
+
client.budgetHeld = true;
|
|
66793
|
+
client.budgetHeldSince ??= this.#scheduler.nowMs();
|
|
66794
|
+
client.budgetTimer ??= this.#scheduler.timer(() => {
|
|
66795
|
+
client.budgetTimer = null;
|
|
66796
|
+
if (client.closed || !client.budgetHeld) return;
|
|
66797
|
+
client.budgetHeld = false;
|
|
66798
|
+
this.#schedule(client);
|
|
66799
|
+
}, this.#holdMs);
|
|
66800
|
+
return;
|
|
66801
|
+
}
|
|
66802
|
+
client.budgetHeldSince = null;
|
|
66803
|
+
client.budgetTimer?.cancel();
|
|
66804
|
+
client.budgetTimer = null;
|
|
66606
66805
|
const traceStarted = completed?.traceStarted ?? (this.#observability.enabled ? this.#observability.nowMicros() : 0);
|
|
66607
66806
|
let deferred = false;
|
|
66608
66807
|
let encodedRepresentation = null;
|
|
@@ -67171,6 +67370,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67171
67370
|
client.baselineHash = ack.canonicalStateHash;
|
|
67172
67371
|
client.reseedRequired = false;
|
|
67173
67372
|
client.inFlight = null;
|
|
67373
|
+
this.#releaseBudget(client.clientId);
|
|
67174
67374
|
client.lastAck = ack;
|
|
67175
67375
|
if (client.latestRevision === ack.canonicalRevision) client.latestRevision = null;
|
|
67176
67376
|
this.#pruneAckSupersededCache(client.paneId);
|
|
@@ -67238,6 +67438,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67238
67438
|
client.lastProjectionReceipt = receipt;
|
|
67239
67439
|
client.reseedRequired = false;
|
|
67240
67440
|
client.inFlight = null;
|
|
67441
|
+
this.#releaseBudget(client.clientId);
|
|
67241
67442
|
if (client.latestRevision === receipt.canonicalRevision) client.latestRevision = null;
|
|
67242
67443
|
if (client.materializeRequested)
|
|
67243
67444
|
client.latestRevision = this.#panes.get(client.paneId)?.latest?.update.revision ?? null;
|
|
@@ -67277,6 +67478,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67277
67478
|
this.#nacks += 1;
|
|
67278
67479
|
client.reseedRequired = true;
|
|
67279
67480
|
client.inFlight = null;
|
|
67481
|
+
this.#releaseBudget(client.clientId);
|
|
67280
67482
|
this.#pruneCanonicalRevisions(client.paneId);
|
|
67281
67483
|
this.#schedule(client);
|
|
67282
67484
|
this.#recordDeliveryStatus(client, this.#panes.get(client.paneId));
|
|
@@ -67322,6 +67524,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67322
67524
|
client.outgoing.length = 0;
|
|
67323
67525
|
if (reason === "source-closed") client.sourceClosedFlight = client.inFlight?.envelope ?? null;
|
|
67324
67526
|
client.inFlight = null;
|
|
67527
|
+
this.#releaseBudget(client.clientId);
|
|
67325
67528
|
const fault = {
|
|
67326
67529
|
type: "terminal.delivery.fault",
|
|
67327
67530
|
reason,
|
|
@@ -67390,8 +67593,13 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67390
67593
|
if (client.lifecycleOpenRecorded)
|
|
67391
67594
|
this.#recordDeliveryLifecycle(client, this.#panes.get(client.paneId), "close");
|
|
67392
67595
|
client.backgroundTimer?.cancel();
|
|
67596
|
+
client.budgetTimer?.cancel();
|
|
67597
|
+
client.budgetTimer = null;
|
|
67393
67598
|
client.outgoing.length = 0;
|
|
67394
67599
|
this.#clients.delete(client.key);
|
|
67600
|
+
if (![...this.#clients.values()].some((other) => other.clientId === client.clientId))
|
|
67601
|
+
this.#priority.delete(client.clientId);
|
|
67602
|
+
else this.#releaseBudget(client.clientId);
|
|
67395
67603
|
this.#pruneCanonicalRevisions(client.paneId);
|
|
67396
67604
|
if ([...this.#clients.values()].some((candidate) => candidate.paneId === client.paneId)) return;
|
|
67397
67605
|
const pane = this.#panes.get(client.paneId);
|
|
@@ -69579,6 +69787,7 @@ var init_registry2 = __esm({
|
|
|
69579
69787
|
ack: (ack) => upstream.ack(ack),
|
|
69580
69788
|
...upstream.projectionReceipt ? { projectionReceipt: upstream.projectionReceipt } : {},
|
|
69581
69789
|
...upstream.materialize ? { materialize: upstream.materialize } : {},
|
|
69790
|
+
...upstream.prioritize ? { prioritize: upstream.prioritize } : {},
|
|
69582
69791
|
nack: (nack) => upstream.nack(nack),
|
|
69583
69792
|
setVisibility: (visibility) => upstream.setVisibility(visibility),
|
|
69584
69793
|
close: async () => {
|
|
@@ -76092,6 +76301,7 @@ var init_lease_manager2 = __esm({
|
|
|
76092
76301
|
sessionName: state.sessionName,
|
|
76093
76302
|
runtimeSessionId: state.runtimeSessionId,
|
|
76094
76303
|
panes: [...state.request.panes],
|
|
76304
|
+
semanticWindowId: state.request.semanticWindowId ?? null,
|
|
76095
76305
|
viewerMode: state.request.viewerMode,
|
|
76096
76306
|
terminalDelivery: state.request.terminalDelivery ?? null,
|
|
76097
76307
|
status: state.status,
|
|
@@ -76701,6 +76911,16 @@ var init_pane_stream_websocket = __esm({
|
|
|
76701
76911
|
);
|
|
76702
76912
|
}
|
|
76703
76913
|
}
|
|
76914
|
+
if (request3.semanticWindowId !== void 0) {
|
|
76915
|
+
const windowPanes = new Set(
|
|
76916
|
+
described.panes.filter((pane) => pane.semanticWindowId === request3.semanticWindowId).map((pane) => pane.semanticPaneId)
|
|
76917
|
+
);
|
|
76918
|
+
if (windowPanes.size !== request3.panes.length || request3.panes.some((pane) => !windowPanes.has(pane)))
|
|
76919
|
+
throw new PaneStreamAdmissionError(
|
|
76920
|
+
"pane-not-found",
|
|
76921
|
+
"The panes are not exactly the panes of that window of the workspace session."
|
|
76922
|
+
);
|
|
76923
|
+
}
|
|
76704
76924
|
const issued = await this.#leaseManager.issue(request3, {
|
|
76705
76925
|
requestId,
|
|
76706
76926
|
projectIdentity,
|
|
@@ -77470,13 +77690,13 @@ var init_pane_stream_websocket = __esm({
|
|
|
77470
77690
|
* stream with 1011, and nothing was tried twice. A refusal of authority is a
|
|
77471
77691
|
* decision, not a failure, and is never repeated. Each repeat is logged.
|
|
77472
77692
|
*/
|
|
77473
|
-
async #retryOpenStep(step, run) {
|
|
77693
|
+
async #retryOpenStep(step, run, final = () => false) {
|
|
77474
77694
|
for (let attempt = 0; ; attempt += 1) {
|
|
77475
77695
|
try {
|
|
77476
77696
|
return await run();
|
|
77477
77697
|
} catch (error) {
|
|
77478
77698
|
const delayMs = this.#openRetryDelaysMs[attempt];
|
|
77479
|
-
if (delayMs === void 0 || this.#closed || error instanceof SessionRuntimeControllerLeaseError)
|
|
77699
|
+
if (delayMs === void 0 || this.#closed || error instanceof SessionRuntimeControllerLeaseError || final(error))
|
|
77480
77700
|
throw error;
|
|
77481
77701
|
logger.info("pane-stream", "stream open step failed; trying again", {
|
|
77482
77702
|
session: this.#descriptor.sessionName,
|
|
@@ -77507,21 +77727,29 @@ var init_pane_stream_websocket = __esm({
|
|
|
77507
77727
|
let stagedAuthority = null;
|
|
77508
77728
|
let authorityMalformed = false;
|
|
77509
77729
|
let layoutActivated = false;
|
|
77730
|
+
let layoutAttempt = 0;
|
|
77510
77731
|
try {
|
|
77511
|
-
|
|
77512
|
-
|
|
77513
|
-
|
|
77514
|
-
|
|
77515
|
-
{
|
|
77516
|
-
|
|
77517
|
-
|
|
77518
|
-
|
|
77519
|
-
|
|
77520
|
-
|
|
77521
|
-
|
|
77522
|
-
|
|
77523
|
-
|
|
77524
|
-
|
|
77732
|
+
const subscribeLayout = this.#mirror.subscribeLayout?.bind(this.#mirror);
|
|
77733
|
+
if (!subscribeLayout) throw new Error("authoritative layout is unavailable");
|
|
77734
|
+
const subscription = await this.#retryOpenStep(
|
|
77735
|
+
"semantic-layout-subscribe",
|
|
77736
|
+
() => {
|
|
77737
|
+
const attempt = ++layoutAttempt;
|
|
77738
|
+
stagedAuthority = null;
|
|
77739
|
+
authorityMalformed = false;
|
|
77740
|
+
return subscribeLayout(this.#descriptor.sessionName, () => void 0, {
|
|
77741
|
+
expectedSemanticPaneIds: expectedPaneIds,
|
|
77742
|
+
expectedRuntimeSessionId: this.#descriptor.runtimeSessionId,
|
|
77743
|
+
onAuthority: (snapshot3) => {
|
|
77744
|
+
if (attempt !== layoutAttempt) return;
|
|
77745
|
+
this.#recordDiagnosticLifecycle("pane-stream-layout-staged");
|
|
77746
|
+
if (snapshot3.layouts.length > PANE_STREAM_MAX_PANES) authorityMalformed = true;
|
|
77747
|
+
else if (!layoutActivated) stagedAuthority = snapshot3;
|
|
77748
|
+
else this.#onLayoutAuthority(snapshot3);
|
|
77749
|
+
}
|
|
77750
|
+
});
|
|
77751
|
+
},
|
|
77752
|
+
(error) => error instanceof Error && error.name === "MirrorTopologyChangedError"
|
|
77525
77753
|
);
|
|
77526
77754
|
if (this.#closed) {
|
|
77527
77755
|
await subscription.close().catch(() => void 0);
|
|
@@ -78221,11 +78449,12 @@ var init_pane_stream_websocket = __esm({
|
|
|
78221
78449
|
return;
|
|
78222
78450
|
}
|
|
78223
78451
|
const frames = this.#validateInitialLayout(snapshot3.layouts, this.#semanticExpectedPaneIds);
|
|
78224
|
-
|
|
78452
|
+
const windowChanged = frames !== null && this.#windowPaneSetChanged(snapshot3);
|
|
78453
|
+
if ((!frames || windowChanged) && this.#topologyInPlace) {
|
|
78225
78454
|
void this.#reconcileTopology(snapshot3);
|
|
78226
78455
|
return;
|
|
78227
78456
|
}
|
|
78228
|
-
if (!frames || !PaneStreamLayoutSnapshotFrameSchemaZ.safeParse({
|
|
78457
|
+
if (!frames || windowChanged || !PaneStreamLayoutSnapshotFrameSchemaZ.safeParse({
|
|
78229
78458
|
type: "layout-snapshot",
|
|
78230
78459
|
topologyEpoch: snapshot3.topologyEpoch,
|
|
78231
78460
|
layouts: frames,
|
|
@@ -78250,6 +78479,17 @@ var init_pane_stream_websocket = __esm({
|
|
|
78250
78479
|
windowLinks: snapshot3.windowLinks
|
|
78251
78480
|
});
|
|
78252
78481
|
}
|
|
78482
|
+
/** #806: the layout no longer shows this stream's window with exactly its panes. */
|
|
78483
|
+
#windowPaneSetChanged(snapshot3) {
|
|
78484
|
+
const window2 = this.#descriptor.semanticWindowId;
|
|
78485
|
+
if (window2 === null) return false;
|
|
78486
|
+
const live = [...this.#panes.values()].filter((channel) => !channel.closed).map((channel) => channel.semanticPaneId);
|
|
78487
|
+
const shown = snapshot3.layouts.find((event) => event.semanticWindowId === window2);
|
|
78488
|
+
if (!shown) return true;
|
|
78489
|
+
const panes = shown.panes.map((pane) => pane.semanticPaneId ?? "");
|
|
78490
|
+
if (shown.zoomed) return panes.length !== 1 || !live.includes(panes[0]);
|
|
78491
|
+
return panes.length !== live.length || panes.some((pane) => !live.includes(pane));
|
|
78492
|
+
}
|
|
78253
78493
|
/** The same session and runtime, a newer epoch, a layout a stream can carry. */
|
|
78254
78494
|
#layoutAuthorityAdmissible(snapshot3) {
|
|
78255
78495
|
return snapshot3.session === this.#descriptor.sessionName && snapshot3.runtimeSessionId === this.#semanticRuntimeSessionId && snapshot3.topologyEpoch > this.#semanticTopologyEpoch && snapshot3.layouts.length <= PANE_STREAM_MAX_PANES;
|
|
@@ -78344,10 +78584,25 @@ var init_pane_stream_websocket = __esm({
|
|
|
78344
78584
|
windowLinks: snapshot3.windowLinks
|
|
78345
78585
|
}).success)
|
|
78346
78586
|
return this.#topologyFailed("layout snapshot invalid");
|
|
78587
|
+
const window2 = this.#descriptor.semanticWindowId;
|
|
78588
|
+
let windowPanes = null;
|
|
78589
|
+
if (window2 !== null) {
|
|
78590
|
+
windowPanes = [
|
|
78591
|
+
...new Set(
|
|
78592
|
+
described.panes.filter((pane) => pane.semanticWindowId === window2).map((pane) => pane.semanticPaneId)
|
|
78593
|
+
)
|
|
78594
|
+
].sort();
|
|
78595
|
+
if (windowPanes.length === 0) return this.#topologyFailed("the stream's window is gone");
|
|
78596
|
+
const shown = snapshot3.layouts.find((event) => event.semanticWindowId === window2);
|
|
78597
|
+
const shownPanes = (shown?.panes ?? []).map((pane) => pane.semanticPaneId ?? "");
|
|
78598
|
+
if (!shown || (shown.zoomed ? shownPanes.length !== 1 || !windowPanes.includes(shownPanes[0]) : shownPanes.length !== windowPanes.length || shownPanes.some((pane) => !windowPanes.includes(pane))))
|
|
78599
|
+
return "stale";
|
|
78600
|
+
}
|
|
78601
|
+
const followed = windowPanes ?? next;
|
|
78347
78602
|
const live = [...this.#panes.values()].filter((channel) => !channel.closed);
|
|
78348
|
-
const removed = live.filter((channel) => !
|
|
78603
|
+
const removed = live.filter((channel) => !followed.includes(channel.semanticPaneId));
|
|
78349
78604
|
const liveIds = new Set(live.map((channel) => channel.semanticPaneId));
|
|
78350
|
-
const added = this.#leasesWholeSession ?
|
|
78605
|
+
const added = windowPanes !== null || this.#leasesWholeSession ? followed.filter((pane) => !liveIds.has(pane)) : [];
|
|
78351
78606
|
if (added.length > 0 && !inventoryIsThisSession)
|
|
78352
78607
|
return this.#topologyFailed("inventory cannot prove the runtime session");
|
|
78353
78608
|
const remaining = live.length - removed.length + added.length;
|
|
@@ -78471,6 +78726,7 @@ var init_pane_stream_websocket = __esm({
|
|
|
78471
78726
|
displayNameSource: pane.displayNameSource,
|
|
78472
78727
|
...this.#offers(PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION) || this.#offers(PANE_STREAM_READER_CAPABILITY_VERSION) ? { browserIcon: pane.browserIcon ?? null } : {},
|
|
78473
78728
|
...this.#offers(PANE_STREAM_READER_CAPABILITY_VERSION) ? { reader: pane.reader ? { name: pane.reader.name } : null } : {},
|
|
78729
|
+
...this.#offers(PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION) ? { browserKind: pane.browserKind ?? null } : {},
|
|
78474
78730
|
left: pane.left,
|
|
78475
78731
|
top: pane.top,
|
|
78476
78732
|
width: pane.width,
|
|
@@ -79193,6 +79449,7 @@ var init_pane_stream_websocket = __esm({
|
|
|
79193
79449
|
else if (kind === "text") channel.sub.sendText(data);
|
|
79194
79450
|
else if (kind === "key") channel.sub.sendKey(data);
|
|
79195
79451
|
else throw new Error("Byte input requires semantic runtime");
|
|
79452
|
+
channel.delivery?.prioritize?.();
|
|
79196
79453
|
let ackStartedAtMicros = null;
|
|
79197
79454
|
let ackStartedAtSharedMicros = null;
|
|
79198
79455
|
if (trace) {
|
|
@@ -80262,12 +80519,12 @@ function createNativeTmuxServerCatalog(workspaceRegistry, run, assertOpen = () =
|
|
|
80262
80519
|
const row = rows.get(liveSessionId) ?? {
|
|
80263
80520
|
summary: { liveSessionId, sessionName: name, paneCount: 0 },
|
|
80264
80521
|
panes: /* @__PURE__ */ new Set(),
|
|
80265
|
-
windows: /* @__PURE__ */ new
|
|
80522
|
+
windows: /* @__PURE__ */ new Map(),
|
|
80266
80523
|
dir,
|
|
80267
80524
|
activity: activity && /^\d+$/.test(activity) ? Number(activity) : null
|
|
80268
80525
|
};
|
|
80526
|
+
if (!row.panes.has(pane)) row.windows.set(window2, (row.windows.get(window2) ?? 0) + 1);
|
|
80269
80527
|
row.panes.add(pane);
|
|
80270
|
-
row.windows.add(window2);
|
|
80271
80528
|
rows.set(liveSessionId, row);
|
|
80272
80529
|
}
|
|
80273
80530
|
const names = new Set([...rows.values()].map(({ summary }) => summary.sessionName));
|
|
@@ -80286,6 +80543,7 @@ function createNativeTmuxServerCatalog(workspaceRegistry, run, assertOpen = () =
|
|
|
80286
80543
|
...summary,
|
|
80287
80544
|
paneCount: panes.size,
|
|
80288
80545
|
windowCount: windows.size,
|
|
80546
|
+
largestWindowPaneCount: Math.max(...windows.values()),
|
|
80289
80547
|
lastActivity: activity,
|
|
80290
80548
|
sessionPath: dir
|
|
80291
80549
|
}));
|
|
@@ -92371,6 +92629,37 @@ function projectTerminalRuntimeInventory(session, resourceRevision) {
|
|
|
92371
92629
|
].sort()
|
|
92372
92630
|
});
|
|
92373
92631
|
}
|
|
92632
|
+
function projectTerminalRuntimeInventoryV2(session, resourceRevision) {
|
|
92633
|
+
const identities = paneIdentities(session);
|
|
92634
|
+
const windows = /* @__PURE__ */ new Map();
|
|
92635
|
+
session.panes.forEach((pane, index) => {
|
|
92636
|
+
if (pane.windowId === void 0) return;
|
|
92637
|
+
const stamp = pane.windowStamp ?? null;
|
|
92638
|
+
const entry = windows.get(pane.windowId) ?? {
|
|
92639
|
+
semanticWindowId: stamp,
|
|
92640
|
+
active: false,
|
|
92641
|
+
panes: [],
|
|
92642
|
+
complete: true
|
|
92643
|
+
};
|
|
92644
|
+
windows.set(pane.windowId, entry);
|
|
92645
|
+
const attachability = identities[index].attachability;
|
|
92646
|
+
if (attachability.status === "available") entry.panes.push(attachability.semanticPaneId);
|
|
92647
|
+
else entry.complete = false;
|
|
92648
|
+
if (pane.active) entry.active = true;
|
|
92649
|
+
});
|
|
92650
|
+
return TerminalRuntimeInventoryProjectionV2SchemaZ.parse({
|
|
92651
|
+
...projectTerminalRuntimeInventory(session, resourceRevision),
|
|
92652
|
+
windows: [...windows.values()].flatMap(
|
|
92653
|
+
(window2) => window2.complete && window2.semanticWindowId !== null && window2.panes.length > 0 ? [
|
|
92654
|
+
{
|
|
92655
|
+
semanticWindowId: window2.semanticWindowId,
|
|
92656
|
+
active: window2.active,
|
|
92657
|
+
semanticPaneIds: [...window2.panes].sort()
|
|
92658
|
+
}
|
|
92659
|
+
] : []
|
|
92660
|
+
)
|
|
92661
|
+
});
|
|
92662
|
+
}
|
|
92374
92663
|
function terminalRuntimeInventoryEnvelope(daemon, session, resourceRevision) {
|
|
92375
92664
|
return {
|
|
92376
92665
|
version: TERMINAL_RUNTIME_INVENTORY_RESOURCE_VERSION,
|
|
@@ -92621,7 +92910,8 @@ function mountTmuxServerRoutes(app, options) {
|
|
|
92621
92910
|
`${scoped}/sessions`,
|
|
92622
92911
|
route(async (c) => {
|
|
92623
92912
|
const server = scope2(c);
|
|
92624
|
-
const
|
|
92913
|
+
const v3 = c.req.query("version") === "3";
|
|
92914
|
+
const v2 = v3 || c.req.query("version") === "2";
|
|
92625
92915
|
const { rows, favicons } = await options.owners.withOwner(server, async (owner) => {
|
|
92626
92916
|
const sessions = await owner.catalog();
|
|
92627
92917
|
const workspaces = owner.workspaceRegistry.list();
|
|
@@ -92652,9 +92942,10 @@ function mountTmuxServerRoutes(app, options) {
|
|
|
92652
92942
|
})
|
|
92653
92943
|
);
|
|
92654
92944
|
let budget2 = SESSIONS_RESOURCE_FAVICON_BUDGET_BYTES;
|
|
92945
|
+
const schema = v3 ? TmuxServerSessionsResourceV3SchemaZ : TmuxServerSessionsResourceV2SchemaZ;
|
|
92655
92946
|
return c.json(
|
|
92656
|
-
|
|
92657
|
-
version: 2,
|
|
92947
|
+
schema.parse({
|
|
92948
|
+
version: v3 ? 3 : 2,
|
|
92658
92949
|
server,
|
|
92659
92950
|
sessions: rows.map(({ session, workspaceName }, index) => {
|
|
92660
92951
|
const found = favicons[index] ?? null;
|
|
@@ -92666,6 +92957,7 @@ function mountTmuxServerRoutes(app, options) {
|
|
|
92666
92957
|
workspaceName,
|
|
92667
92958
|
paneCount: session.paneCount,
|
|
92668
92959
|
windowCount: session.windowCount,
|
|
92960
|
+
...v3 ? { largestWindowPaneCount: session.largestWindowPaneCount } : {},
|
|
92669
92961
|
lastActivity: session.lastActivity,
|
|
92670
92962
|
favicon: favicon ? { mime: favicon.mime, data: favicon.data } : null
|
|
92671
92963
|
};
|
|
@@ -92693,6 +92985,7 @@ function mountTmuxServerRoutes(app, options) {
|
|
|
92693
92985
|
route(async (c) => {
|
|
92694
92986
|
const server = scope2(c);
|
|
92695
92987
|
const workspaceName = workspaceSchema.parse(c.req.param("workspaceName"));
|
|
92988
|
+
const v2 = c.req.query("version") === "2";
|
|
92696
92989
|
const resource3 = await options.owners.withOwner(server, async (owner) => {
|
|
92697
92990
|
const sessions = await owner.catalog();
|
|
92698
92991
|
const workspace = owner.workspaceRegistry.get(workspaceName);
|
|
@@ -92706,9 +92999,10 @@ function mountTmuxServerRoutes(app, options) {
|
|
|
92706
92999
|
workspace.sessionName,
|
|
92707
93000
|
c.req.raw.signal
|
|
92708
93001
|
);
|
|
92709
|
-
|
|
93002
|
+
if (!snapshot3) return null;
|
|
93003
|
+
return v2 ? projectTerminalRuntimeInventoryV2(snapshot3, 0) : projectTerminalRuntimeInventory(snapshot3, 0);
|
|
92710
93004
|
});
|
|
92711
|
-
return resource3 ? c.json({ version: 1, server, resource: resource3 }) : c.json({ error: { code: "workspace-not-found" } }, 404);
|
|
93005
|
+
return resource3 ? c.json({ version: v2 ? 2 : 1, server, resource: resource3 }) : c.json({ error: { code: "workspace-not-found" } }, 404);
|
|
92712
93006
|
})
|
|
92713
93007
|
);
|
|
92714
93008
|
app.get(
|