tmux-ide 2.9.26 → 2.9.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/cli.js +1252 -528
- package/package.json +2 -2
- package/packages/contracts/src/pane-stream.ts +9 -0
- package/packages/contracts/src/terminal-delivery.ts +114 -3
- package/packages/core/src/index.ts +1 -0
- package/packages/core/src/terminal-delivery-binary.ts +8 -7
- package/packages/core/src/terminal-delivery.ts +174 -3
- package/packages/core/src/terminal-partial-history.ts +152 -0
- package/packages/core/src/terminal-replica.ts +70 -1
- package/packages/daemon/dist/command-center/owner-keep-alive.js +30 -0
- package/packages/daemon/dist/command-center/server.js +3 -0
- package/packages/daemon/dist/command-center/tmux-server-attach.js +51 -0
- package/packages/daemon/dist/command-center/tmux-servers.js +78 -0
- package/packages/daemon/dist/doctor.js +4 -4
- package/packages/daemon/dist/lib/app-config.js +7 -0
- package/packages/daemon/dist/lib/node-requirement.js +20 -0
- package/packages/daemon/dist/lib/require-supported-node.js +8 -0
- package/packages/daemon/dist/lib/tmux-server-session-open.js +38 -12
- package/packages/daemon/dist/lib/workspace-promotion.js +4 -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/server/pane-stream-upgrade.js +39 -1
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +14 -0
- package/packages/daemon/dist/terminal/session-runtime/registry.js +1 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +465 -42
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.js +76 -2
- package/packages/daemon/dist/tui/mirror/theme.js +8 -1
- package/packages/daemon/src/command-center/attach-window-rule.cases.json +84 -0
- package/packages/daemon/src/command-center/owner-keep-alive.ts +38 -0
- package/packages/daemon/src/command-center/server.ts +3 -0
- package/packages/daemon/src/command-center/tmux-server-attach.ts +75 -0
- package/packages/daemon/src/command-center/tmux-servers.ts +84 -0
- package/packages/daemon/src/doctor.ts +4 -4
- package/packages/daemon/src/lib/app-config.ts +15 -0
- package/packages/daemon/src/lib/node-requirement.ts +22 -0
- package/packages/daemon/src/lib/require-supported-node.ts +9 -0
- package/packages/daemon/src/lib/tmux-server-session-open.ts +53 -15
- package/packages/daemon/src/lib/workspace-promotion.ts +4 -4
- package/packages/daemon/src/server/pane-stream-upgrade.ts +41 -1
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +25 -0
- package/packages/daemon/src/terminal/session-runtime/registry.ts +1 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts +575 -39
- package/packages/daemon/src/tui/mirror/open-tui-workspace-runtime-port.ts +82 -2
- package/packages/daemon/src/tui/mirror/theme.ts +13 -1
package/bin/cli.js
CHANGED
|
@@ -47,6 +47,27 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
47
47
|
mod
|
|
48
48
|
));
|
|
49
49
|
|
|
50
|
+
// packages/daemon/src/lib/node-requirement.ts
|
|
51
|
+
function isSupportedNodeVersion(version) {
|
|
52
|
+
const major = Number(version.split(".")[0]);
|
|
53
|
+
return Number.isInteger(major) && major >= MINIMUM_NODE_MAJOR;
|
|
54
|
+
}
|
|
55
|
+
function unsupportedNodeMessage(versions) {
|
|
56
|
+
if (versions.bun !== void 0 || versions.node === void 0) return null;
|
|
57
|
+
if (isSupportedNodeVersion(versions.node)) return null;
|
|
58
|
+
return `tmux-ide needs Node.js ${MINIMUM_NODE_MAJOR} or newer; this is Node.js ${versions.node}.
|
|
59
|
+
Upgrade Node.js, or use the installer, which brings its own runtime:
|
|
60
|
+
curl -fsSL https://tmux-ide.com/install.sh | sh
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
var MINIMUM_NODE_MAJOR;
|
|
64
|
+
var init_node_requirement = __esm({
|
|
65
|
+
"packages/daemon/src/lib/node-requirement.ts"() {
|
|
66
|
+
"use strict";
|
|
67
|
+
MINIMUM_NODE_MAJOR = 24;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
50
71
|
// packages/tmux-bridge/src/errors.ts
|
|
51
72
|
var TmuxError;
|
|
52
73
|
var init_errors = __esm({
|
|
@@ -55,8 +76,8 @@ var init_errors = __esm({
|
|
|
55
76
|
TmuxError = class extends Error {
|
|
56
77
|
code;
|
|
57
78
|
exitCode;
|
|
58
|
-
constructor(
|
|
59
|
-
super(
|
|
79
|
+
constructor(message2, code2, options = {}) {
|
|
80
|
+
super(message2, { cause: options.cause });
|
|
60
81
|
this.name = "TmuxError";
|
|
61
82
|
this.code = code2;
|
|
62
83
|
this.exitCode = options.exitCode ?? 1;
|
|
@@ -4779,7 +4800,7 @@ var init_interaction_evidence = __esm({
|
|
|
4779
4800
|
timeBasis: z27.enum(["daemon", "server", "unknown"]),
|
|
4780
4801
|
receivedAt: time
|
|
4781
4802
|
}).strict().superRefine((value, context) => {
|
|
4782
|
-
const issue = (path2,
|
|
4803
|
+
const issue = (path2, message2) => context.addIssue({ code: "custom", path: path2, message: message2 });
|
|
4783
4804
|
const { observation: observation2, actor, effect, endpoints: endpoints2 } = value;
|
|
4784
4805
|
for (const endpoint of [endpoints2.destination, endpoints2.source]) {
|
|
4785
4806
|
if (endpoint?.kind === "native-pane" && (observation2.kind !== "native-journal" || endpoint.serverEpoch !== observation2.serverEpoch))
|
|
@@ -4859,7 +4880,7 @@ var init_interaction_evidence = __esm({
|
|
|
4859
4880
|
lastGap: InteractionObservationGapSchemaZ.nullable(),
|
|
4860
4881
|
droppedCount: NativeInteractionSequenceSchemaZ.nullable()
|
|
4861
4882
|
}).strict().superRefine((value, context) => {
|
|
4862
|
-
const issue = (path2,
|
|
4883
|
+
const issue = (path2, message2) => context.addIssue({ code: "custom", path: path2, message: message2 });
|
|
4863
4884
|
if (new Set(value.commands).size !== value.commands.length || new Set(value.effects).size !== value.effects.length)
|
|
4864
4885
|
issue(["commands"], "capability lists must be unique");
|
|
4865
4886
|
if (value.method !== "native-journal" && (value.cursor !== null || value.effects.length > 0))
|
|
@@ -7395,7 +7416,7 @@ var init_causal_cell = __esm({
|
|
|
7395
7416
|
|
|
7396
7417
|
// packages/contracts/src/terminal-delivery.ts
|
|
7397
7418
|
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_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;
|
|
7419
|
+
var STOCK_CAPTURE_TAB_UNAVAILABLE, TERMINAL_DELIVERY_BINARY_CAPABILITY_VERSION, TERMINAL_DELIVERY_BINARY_LOCAL_CAPABILITY_VERSION, TERMINAL_DELIVERY_PROTOCOL_VERSION, TERMINAL_DELIVERY_PARTIAL_HISTORY_CAPABILITY_VERSION, TERMINAL_DELIVERY_HISTORY_TAIL_ROWS, TERMINAL_DELIVERY_PIPELINING_CAPABILITY_VERSION, TERMINAL_DELIVERY_MAX_PIPELINED, TERMINAL_DELIVERY_HISTORY_CHUNK_MAX_ROWS, TERMINAL_DELIVERY_MAX_OFFERED_VERSIONS, TERMINAL_DELIVERY_CHUNK_BYTES, TERMINAL_DELIVERY_PATCH_TO_SEED_BYTES, TERMINAL_DELIVERY_MAX_REPRESENTATION_BYTES, TerminalDeliveryEncodingSchemaZ, TerminalDeliveryOfferSchemaZ, TerminalDeliveryNegotiatedSchemaZ, TerminalDeliveryNegotiationResultSchemaZ, TERMINAL_HISTORY_EMPTY_DIGEST, TerminalDeliveryHistoryCommitmentSchemaZ, DeliveryAddressSchemaZ, TerminalDeliveryEnvelopeSchemaZ, TerminalDeliveryFaultSchemaZ, TerminalDeliveryAckSchemaZ, TerminalDeliveryNackSchemaZ, TerminalDeliveryHistoryRequestSchemaZ, TerminalDeliveryVisibilitySchemaZ, TerminalSemanticDeliveryPayloadSchemaZ, TerminalSemanticHistoryPayloadSchemaZ;
|
|
7399
7420
|
var init_terminal_delivery = __esm({
|
|
7400
7421
|
"packages/contracts/src/terminal-delivery.ts"() {
|
|
7401
7422
|
"use strict";
|
|
@@ -7408,6 +7429,11 @@ var init_terminal_delivery = __esm({
|
|
|
7408
7429
|
TERMINAL_DELIVERY_BINARY_CAPABILITY_VERSION = /* @__PURE__ */ (() => 109)();
|
|
7409
7430
|
TERMINAL_DELIVERY_BINARY_LOCAL_CAPABILITY_VERSION = /* @__PURE__ */ (() => 110)();
|
|
7410
7431
|
TERMINAL_DELIVERY_PROTOCOL_VERSION = /* @__PURE__ */ (() => 1)();
|
|
7432
|
+
TERMINAL_DELIVERY_PARTIAL_HISTORY_CAPABILITY_VERSION = /* @__PURE__ */ (() => 122)();
|
|
7433
|
+
TERMINAL_DELIVERY_HISTORY_TAIL_ROWS = /* @__PURE__ */ (() => 200)();
|
|
7434
|
+
TERMINAL_DELIVERY_PIPELINING_CAPABILITY_VERSION = /* @__PURE__ */ (() => 124)();
|
|
7435
|
+
TERMINAL_DELIVERY_MAX_PIPELINED = /* @__PURE__ */ (() => 3)();
|
|
7436
|
+
TERMINAL_DELIVERY_HISTORY_CHUNK_MAX_ROWS = /* @__PURE__ */ (() => 2e3)();
|
|
7411
7437
|
TERMINAL_DELIVERY_MAX_OFFERED_VERSIONS = /* @__PURE__ */ (() => 16)();
|
|
7412
7438
|
TERMINAL_DELIVERY_CHUNK_BYTES = /* @__PURE__ */ (() => 256 * 1024)();
|
|
7413
7439
|
TERMINAL_DELIVERY_PATCH_TO_SEED_BYTES = /* @__PURE__ */ (() => 512 * 1024)();
|
|
@@ -7436,12 +7462,19 @@ var init_terminal_delivery = __esm({
|
|
|
7436
7462
|
encoding: TerminalDeliveryEncodingSchemaZ,
|
|
7437
7463
|
fallbackEncoding: z48.literal("semantic-v1").nullable().optional(),
|
|
7438
7464
|
alternateScreenProjection: z48.literal("deferred-history-v1").optional(),
|
|
7465
|
+
/** Capability 122: history on demand. */
|
|
7466
|
+
partialHistory: z48.literal("tail-v1").optional(),
|
|
7439
7467
|
richPlacements: z48.boolean(),
|
|
7440
7468
|
generation: SessionRuntimeGenerationSchemaZ,
|
|
7441
7469
|
deliveryNonce: z48.uuid()
|
|
7442
7470
|
}).strict().superRefine((value, context) => {
|
|
7443
7471
|
if (value.alternateScreenProjection && value.encoding !== "semantic-binary-v1")
|
|
7444
7472
|
context.addIssue({ code: "custom", message: "projection requires binary semantic delivery" });
|
|
7473
|
+
if (value.partialHistory && (value.encoding !== "semantic-compact-v1" && value.encoding !== "semantic-binary-v1" || value.alternateScreenProjection))
|
|
7474
|
+
context.addIssue({
|
|
7475
|
+
code: "custom",
|
|
7476
|
+
message: "partial history requires compact or binary semantic delivery and no projection"
|
|
7477
|
+
});
|
|
7445
7478
|
if (value.fallbackEncoding && value.encoding !== "semantic-compact-v1")
|
|
7446
7479
|
context.addIssue({ code: "custom", message: "fallback encoding requires compact semantic" });
|
|
7447
7480
|
if (value.richPlacements && value.encoding !== "semantic-v1" && value.encoding !== "semantic-compact-v1" && value.encoding !== "semantic-binary-v1")
|
|
@@ -7458,6 +7491,14 @@ var init_terminal_delivery = __esm({
|
|
|
7458
7491
|
])
|
|
7459
7492
|
}).strict()
|
|
7460
7493
|
]))();
|
|
7494
|
+
TERMINAL_HISTORY_EMPTY_DIGEST = /* @__PURE__ */ (() => "0000000000000000")();
|
|
7495
|
+
TerminalDeliveryHistoryCommitmentSchemaZ = /* @__PURE__ */ (() => z48.object({
|
|
7496
|
+
rows: z48.number().int().nonnegative().max(1e6),
|
|
7497
|
+
digest: z48.string().regex(/^[0-9a-f]{16}$/u)
|
|
7498
|
+
}).strict().refine(
|
|
7499
|
+
(value) => value.rows > 0 || value.digest === TERMINAL_HISTORY_EMPTY_DIGEST,
|
|
7500
|
+
"an empty commitment has the empty digest"
|
|
7501
|
+
))();
|
|
7461
7502
|
DeliveryAddressSchemaZ = /* @__PURE__ */ (() => z48.object({
|
|
7462
7503
|
workspaceName: WorkspaceIdSchemaZ,
|
|
7463
7504
|
semanticPaneId: TerminalAttachmentSemanticPaneIdSchemaZ,
|
|
@@ -7478,7 +7519,7 @@ var init_terminal_delivery = __esm({
|
|
|
7478
7519
|
causalCellProof: CausalCellProofV1SchemaZ.optional(),
|
|
7479
7520
|
protocolVersion: z48.literal(TERMINAL_DELIVERY_PROTOCOL_VERSION),
|
|
7480
7521
|
encoding: TerminalDeliveryEncodingSchemaZ,
|
|
7481
|
-
frame: z48.enum(["seed", "patch", "tombstone"]),
|
|
7522
|
+
frame: z48.enum(["seed", "patch", "tombstone", "history"]),
|
|
7482
7523
|
baseRevision: z48.number().int().min(-1).nullable(),
|
|
7483
7524
|
canonicalRevision: z48.number().int().nonnegative(),
|
|
7484
7525
|
canonicalStateHash: z48.string().regex(/^[0-9a-f]{16}$/u),
|
|
@@ -7486,7 +7527,9 @@ var init_terminal_delivery = __esm({
|
|
|
7486
7527
|
representationBytes: z48.number().int().nonnegative().max(TERMINAL_DELIVERY_MAX_REPRESENTATION_BYTES),
|
|
7487
7528
|
chunkCount: z48.number().int().positive().max(256),
|
|
7488
7529
|
canonicalEquivalent: z48.boolean(),
|
|
7489
|
-
history: z48.enum(["complete", "truncated", "not-applicable"]),
|
|
7530
|
+
history: z48.enum(["complete", "partial", "truncated", "not-applicable"]),
|
|
7531
|
+
/** Capability 122: the history rows the client does not hold, oldest first. */
|
|
7532
|
+
historyUnloaded: TerminalDeliveryHistoryCommitmentSchemaZ.optional(),
|
|
7490
7533
|
richPlacements: z48.boolean()
|
|
7491
7534
|
}).strict().superRefine((value, context) => {
|
|
7492
7535
|
const semantic = value.encoding === "semantic-v1" || value.encoding === "semantic-compact-v1" || value.encoding === "semantic-binary-v1";
|
|
@@ -7501,12 +7544,27 @@ var init_terminal_delivery = __esm({
|
|
|
7501
7544
|
});
|
|
7502
7545
|
if (value.frame === "seed" && value.baseRevision !== null)
|
|
7503
7546
|
context.addIssue({ code: "custom", message: "seed baseRevision must be null" });
|
|
7504
|
-
if (value.frame
|
|
7547
|
+
if (value.frame === "history" && (value.baseRevision !== value.canonicalRevision || value.history !== "partial"))
|
|
7548
|
+
context.addIssue({
|
|
7549
|
+
code: "custom",
|
|
7550
|
+
message: "a history frame is partial and stays at the client's revision"
|
|
7551
|
+
});
|
|
7552
|
+
if (value.frame !== "seed" && value.frame !== "history" && (value.baseRevision === null || value.canonicalRevision <= value.baseRevision))
|
|
7505
7553
|
context.addIssue({
|
|
7506
7554
|
code: "custom",
|
|
7507
7555
|
message: "patch/tombstone requires an earlier baseRevision"
|
|
7508
7556
|
});
|
|
7509
|
-
if (
|
|
7557
|
+
if (value.history === "partial" !== (value.historyUnloaded !== void 0))
|
|
7558
|
+
context.addIssue({
|
|
7559
|
+
code: "custom",
|
|
7560
|
+
message: "a partial history carries its unloaded commitment, and only it does"
|
|
7561
|
+
});
|
|
7562
|
+
if (value.history === "partial" && (!semantic || value.frame === "tombstone"))
|
|
7563
|
+
context.addIssue({
|
|
7564
|
+
code: "custom",
|
|
7565
|
+
message: "partial history is semantic and not a tombstone"
|
|
7566
|
+
});
|
|
7567
|
+
if (semantic && (!value.canonicalEquivalent || value.frame !== "tombstone" && value.history !== "complete" && value.history !== "partial"))
|
|
7510
7568
|
context.addIssue({
|
|
7511
7569
|
code: "custom",
|
|
7512
7570
|
message: "semantic delivery must be complete canonical truth"
|
|
@@ -7547,6 +7605,12 @@ var init_terminal_delivery = __esm({
|
|
|
7547
7605
|
]),
|
|
7548
7606
|
appliedRevision: z48.number().int().min(-1)
|
|
7549
7607
|
}).strict())();
|
|
7608
|
+
TerminalDeliveryHistoryRequestSchemaZ = /* @__PURE__ */ (() => DeliveryAddressSchemaZ.extend({
|
|
7609
|
+
type: z48.literal("terminal.delivery.history-request"),
|
|
7610
|
+
canonicalRevision: z48.number().int().nonnegative(),
|
|
7611
|
+
unloadedRows: z48.number().int().nonnegative().max(1e6),
|
|
7612
|
+
maxRows: z48.number().int().min(1).max(TERMINAL_DELIVERY_HISTORY_CHUNK_MAX_ROWS)
|
|
7613
|
+
}).strict())();
|
|
7550
7614
|
TerminalDeliveryVisibilitySchemaZ = /* @__PURE__ */ (() => z48.enum([
|
|
7551
7615
|
"visible",
|
|
7552
7616
|
"background",
|
|
@@ -7572,6 +7636,11 @@ var init_terminal_delivery = __esm({
|
|
|
7572
7636
|
tombstone: TerminalReplicaTombstonePayloadSchemaZ
|
|
7573
7637
|
}).strict().refine((value) => value.revision > value.baseRevision, "tombstone revision must advance")
|
|
7574
7638
|
]))();
|
|
7639
|
+
TerminalSemanticHistoryPayloadSchemaZ = /* @__PURE__ */ (() => z48.object({
|
|
7640
|
+
frame: z48.literal("history"),
|
|
7641
|
+
revision: z48.number().int().nonnegative(),
|
|
7642
|
+
rows: z48.array(TerminalReplicaRowSchemaZ).min(1).max(TERMINAL_DELIVERY_HISTORY_CHUNK_MAX_ROWS)
|
|
7643
|
+
}).strict())();
|
|
7575
7644
|
}
|
|
7576
7645
|
});
|
|
7577
7646
|
|
|
@@ -7950,7 +8019,7 @@ var init_terminal_graphics = __esm({
|
|
|
7950
8019
|
|
|
7951
8020
|
// packages/contracts/src/pane-stream.ts
|
|
7952
8021
|
import { z as z52 } from "zod";
|
|
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;
|
|
8022
|
+
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, PaneStreamTerminalDeliveryHistoryRequestFrameSchemaZ, 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;
|
|
7954
8023
|
var init_pane_stream = __esm({
|
|
7955
8024
|
"packages/contracts/src/pane-stream.ts"() {
|
|
7956
8025
|
"use strict";
|
|
@@ -8094,6 +8163,10 @@ var init_pane_stream = __esm({
|
|
|
8094
8163
|
type: z52.literal("terminal-projection-materialize"),
|
|
8095
8164
|
request: TerminalProjectionMaterializeSchemaZ
|
|
8096
8165
|
}).strict())();
|
|
8166
|
+
PaneStreamTerminalDeliveryHistoryRequestFrameSchemaZ = /* @__PURE__ */ (() => z52.object({
|
|
8167
|
+
type: z52.literal("terminal-delivery-history-request"),
|
|
8168
|
+
request: TerminalDeliveryHistoryRequestSchemaZ
|
|
8169
|
+
}).strict())();
|
|
8097
8170
|
PaneStreamTerminalDeliveryNackFrameSchemaZ = /* @__PURE__ */ (() => z52.object({ type: z52.literal("terminal-delivery-nack"), nack: TerminalDeliveryNackSchemaZ }).strict())();
|
|
8098
8171
|
PaneStreamTerminalDeliveryVisibilityFrameSchemaZ = /* @__PURE__ */ (() => z52.object({
|
|
8099
8172
|
type: z52.literal("terminal-delivery-visibility"),
|
|
@@ -8179,6 +8252,7 @@ var init_pane_stream = __esm({
|
|
|
8179
8252
|
PaneStreamTerminalProjectionReceiptFrameSchemaZ,
|
|
8180
8253
|
PaneStreamTerminalProjectionMaterializeFrameSchemaZ,
|
|
8181
8254
|
PaneStreamTerminalDeliveryNackFrameSchemaZ,
|
|
8255
|
+
PaneStreamTerminalDeliveryHistoryRequestFrameSchemaZ,
|
|
8182
8256
|
PaneStreamTerminalDeliveryVisibilityFrameSchemaZ,
|
|
8183
8257
|
PaneStreamSemanticIntentFrameSchemaZ,
|
|
8184
8258
|
PaneStreamViewportFrameSchemaZ,
|
|
@@ -12307,6 +12381,10 @@ function appThemeOverrideProvenance(theme, status2, glyphs) {
|
|
|
12307
12381
|
}
|
|
12308
12382
|
return legacyThemeOverrideProvenance(explicit);
|
|
12309
12383
|
}
|
|
12384
|
+
function systemSide(value, appearance) {
|
|
12385
|
+
const preset = findVisualThemePreset(value);
|
|
12386
|
+
return preset?.appearance === appearance ? { [appearance]: preset.id } : {};
|
|
12387
|
+
}
|
|
12310
12388
|
function parseAppConfig(input) {
|
|
12311
12389
|
const D = DEFAULT_APP_CONFIG;
|
|
12312
12390
|
const root = asObject(input);
|
|
@@ -12344,6 +12422,8 @@ function parseAppConfig(input) {
|
|
|
12344
12422
|
findVisualThemePreset(theme.preset)?.appearance ?? D.theme.mode
|
|
12345
12423
|
),
|
|
12346
12424
|
...findVisualThemePreset(theme.preset) ? { preset: String(theme.preset) } : {},
|
|
12425
|
+
...systemSide(theme.light, "light"),
|
|
12426
|
+
...systemSide(theme.dark, "dark"),
|
|
12347
12427
|
accent: pickString(theme.accent, D.theme.accent),
|
|
12348
12428
|
muted: pickString(theme.muted, D.theme.muted),
|
|
12349
12429
|
fg: pickString(theme.fg, D.theme.fg),
|
|
@@ -13010,8 +13090,8 @@ async function readBoundedResponse(fetchImpl, url, maxBytes, policy) {
|
|
|
13010
13090
|
const controller = new AbortController();
|
|
13011
13091
|
let total = 0;
|
|
13012
13092
|
let timeoutMessage = null;
|
|
13013
|
-
const abortWith = (
|
|
13014
|
-
timeoutMessage =
|
|
13093
|
+
const abortWith = (message2) => () => {
|
|
13094
|
+
timeoutMessage = message2();
|
|
13015
13095
|
controller.abort();
|
|
13016
13096
|
};
|
|
13017
13097
|
const overallTimer = setTimeout(
|
|
@@ -13029,9 +13109,9 @@ async function readBoundedResponse(fetchImpl, url, maxBytes, policy) {
|
|
|
13029
13109
|
try {
|
|
13030
13110
|
const response3 = await fetchImpl(url, { signal: controller.signal });
|
|
13031
13111
|
if (!response3.ok) {
|
|
13032
|
-
const
|
|
13033
|
-
if (isTransientHttpStatus(response3.status)) throw new Error(
|
|
13034
|
-
throw new PermanentDownloadError(
|
|
13112
|
+
const message2 = `HTTP ${response3.status} ${response3.statusText}`;
|
|
13113
|
+
if (isTransientHttpStatus(response3.status)) throw new Error(message2);
|
|
13114
|
+
throw new PermanentDownloadError(message2);
|
|
13035
13115
|
}
|
|
13036
13116
|
markProgress();
|
|
13037
13117
|
const declaredLength = Number(response3.headers.get("content-length"));
|
|
@@ -13076,8 +13156,8 @@ async function readWithRetries(fetchImpl, url, maxBytes, policy, log) {
|
|
|
13076
13156
|
if (error instanceof PermanentDownloadError || attempt >= policy.maxAttempts || Date.now() + delayMs >= policy.deadline) {
|
|
13077
13157
|
throw error;
|
|
13078
13158
|
}
|
|
13079
|
-
const
|
|
13080
|
-
log(`download attempt ${attempt}/${policy.maxAttempts} failed (${
|
|
13159
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
13160
|
+
log(`download attempt ${attempt}/${policy.maxAttempts} failed (${message2}); retrying`);
|
|
13081
13161
|
await new Promise((resolve47) => setTimeout(resolve47, delayMs));
|
|
13082
13162
|
}
|
|
13083
13163
|
}
|
|
@@ -13141,10 +13221,10 @@ async function downloadTuiBinary(opts = {}) {
|
|
|
13141
13221
|
log(`downloading ${url}`);
|
|
13142
13222
|
gz = await readWithRetries(fetchImpl, url, limits.maxCompressedBytes, policy, log);
|
|
13143
13223
|
} catch (error) {
|
|
13144
|
-
const
|
|
13224
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
13145
13225
|
const hint = error instanceof PermanentDownloadError ? "Check that the release published both exact-version assets." : "Check your network connection, then retry with `tmux-ide update --tui-binary`, or run the installer again if tmux-ide is not installed yet.";
|
|
13146
13226
|
throw new Error(
|
|
13147
|
-
`could not download the TUI binary and checksum for v${version} (${
|
|
13227
|
+
`could not download the TUI binary and checksum for v${version} (${message2}). ${hint}`,
|
|
13148
13228
|
{ cause: error }
|
|
13149
13229
|
);
|
|
13150
13230
|
}
|
|
@@ -13278,9 +13358,9 @@ async function ensureTuiLaunchAvailable(input, options = {}) {
|
|
|
13278
13358
|
try {
|
|
13279
13359
|
downloaded = await (options.download ?? downloadTuiBinary)({ log: options.log });
|
|
13280
13360
|
} catch (error) {
|
|
13281
|
-
const
|
|
13361
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
13282
13362
|
throw new Error(
|
|
13283
|
-
`Automatic OpenTUI runtime acquisition failed: ${
|
|
13363
|
+
`Automatic OpenTUI runtime acquisition failed: ${message2}
|
|
13284
13364
|
Retry with \`tmux-ide update --tui-binary\`, then run \`tmux-ide app\` again.`,
|
|
13285
13365
|
{ cause: error }
|
|
13286
13366
|
);
|
|
@@ -13377,8 +13457,8 @@ var init_errors2 = __esm({
|
|
|
13377
13457
|
IdeError = class extends Error {
|
|
13378
13458
|
code;
|
|
13379
13459
|
exitCode;
|
|
13380
|
-
constructor(
|
|
13381
|
-
super(
|
|
13460
|
+
constructor(message2, { code: code2, exitCode = 1, cause } = {}) {
|
|
13461
|
+
super(message2, { cause });
|
|
13382
13462
|
this.name = "IdeError";
|
|
13383
13463
|
this.code = code2;
|
|
13384
13464
|
this.exitCode = exitCode;
|
|
@@ -13393,22 +13473,22 @@ var init_errors2 = __esm({
|
|
|
13393
13473
|
}
|
|
13394
13474
|
};
|
|
13395
13475
|
ConfigError = class extends IdeError {
|
|
13396
|
-
constructor(
|
|
13397
|
-
super(
|
|
13476
|
+
constructor(message2, code2, { cause } = {}) {
|
|
13477
|
+
super(message2, { code: code2, exitCode: 1, cause });
|
|
13398
13478
|
this.name = "ConfigError";
|
|
13399
13479
|
}
|
|
13400
13480
|
};
|
|
13401
13481
|
DaemonStartupError = class extends IdeError {
|
|
13402
13482
|
reason;
|
|
13403
|
-
constructor(
|
|
13404
|
-
super(
|
|
13483
|
+
constructor(message2, reason, { cause } = {}) {
|
|
13484
|
+
super(message2, { code: `DAEMON_${reason.toUpperCase()}`, exitCode: 1, cause });
|
|
13405
13485
|
this.name = "DaemonStartupError";
|
|
13406
13486
|
this.reason = reason;
|
|
13407
13487
|
}
|
|
13408
13488
|
};
|
|
13409
13489
|
DaemonShutdownError = class extends IdeError {
|
|
13410
|
-
constructor(
|
|
13411
|
-
super(
|
|
13490
|
+
constructor(message2, { cause } = {}) {
|
|
13491
|
+
super(message2, { code: "DAEMON_SHUTDOWN_FAILED", exitCode: 1, cause });
|
|
13412
13492
|
this.name = "DaemonShutdownError";
|
|
13413
13493
|
}
|
|
13414
13494
|
};
|
|
@@ -13462,8 +13542,8 @@ function printLayout(config2) {
|
|
|
13462
13542
|
}
|
|
13463
13543
|
}
|
|
13464
13544
|
}
|
|
13465
|
-
function outputError(
|
|
13466
|
-
throw new IdeError(
|
|
13545
|
+
function outputError(message2, code2, { exitCode = 1 } = {}) {
|
|
13546
|
+
throw new IdeError(message2, { code: code2, exitCode });
|
|
13467
13547
|
}
|
|
13468
13548
|
function printCommandError(error, { json: json3 = false } = {}) {
|
|
13469
13549
|
if (json3) {
|
|
@@ -14825,10 +14905,10 @@ function plainOrThrow(value) {
|
|
|
14825
14905
|
if (!plain.ok) throw new PluginRunError(plain.error, null);
|
|
14826
14906
|
return plain.value;
|
|
14827
14907
|
}
|
|
14828
|
-
function classify(
|
|
14829
|
-
if (
|
|
14830
|
-
if (/not enough memory/u.test(
|
|
14831
|
-
if (/Aborted\(|RuntimeError/u.test(
|
|
14908
|
+
function classify(message2) {
|
|
14909
|
+
if (message2.includes(TIMEOUT_MESSAGE) || message2.includes(WALL_CLOCK_MESSAGE)) return "timeout";
|
|
14910
|
+
if (/not enough memory/u.test(message2)) return "memory";
|
|
14911
|
+
if (/Aborted\(|RuntimeError/u.test(message2)) return "abort";
|
|
14832
14912
|
return null;
|
|
14833
14913
|
}
|
|
14834
14914
|
var MAX_SOURCE_BYTES, PluginRunError, TIMER_GAP_MS, WALL_CLOCK_MESSAGE, FOREIGN_YIELD_MESSAGE, PluginLuaState;
|
|
@@ -14841,8 +14921,8 @@ var init_lua_state = __esm({
|
|
|
14841
14921
|
MAX_SOURCE_BYTES = 1024 * 1024;
|
|
14842
14922
|
PluginRunError = class extends Error {
|
|
14843
14923
|
trip;
|
|
14844
|
-
constructor(
|
|
14845
|
-
super(
|
|
14924
|
+
constructor(message2, trip) {
|
|
14925
|
+
super(message2);
|
|
14846
14926
|
this.name = "PluginRunError";
|
|
14847
14927
|
this.trip = trip;
|
|
14848
14928
|
}
|
|
@@ -14906,7 +14986,7 @@ var init_lua_state = __esm({
|
|
|
14906
14986
|
const origin = runner.origin;
|
|
14907
14987
|
runner.pending = Promise.resolve().then(() => fn(list, origin));
|
|
14908
14988
|
});
|
|
14909
|
-
global.set("__ide_log", (level,
|
|
14989
|
+
global.set("__ide_log", (level, message2, fieldsJson) => {
|
|
14910
14990
|
const lvl = level === "debug" || level === "warn" || level === "error" ? level : "info";
|
|
14911
14991
|
let fields;
|
|
14912
14992
|
if (typeof fieldsJson === "string") {
|
|
@@ -14918,7 +14998,7 @@ var init_lua_state = __esm({
|
|
|
14918
14998
|
fields = void 0;
|
|
14919
14999
|
}
|
|
14920
15000
|
}
|
|
14921
|
-
options.hooks.log(lvl, String(
|
|
15001
|
+
options.hooks.log(lvl, String(message2), fields);
|
|
14922
15002
|
});
|
|
14923
15003
|
global.set("__ide_resolve", (kind, name) => {
|
|
14924
15004
|
if (kind !== "file" && kind !== "module" || typeof name !== "string")
|
|
@@ -15028,11 +15108,11 @@ var init_lua_state = __esm({
|
|
|
15028
15108
|
return [...thread.getStackValues()];
|
|
15029
15109
|
}
|
|
15030
15110
|
} catch (error) {
|
|
15031
|
-
const
|
|
15032
|
-
const trip = classify(
|
|
15111
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
15112
|
+
const trip = classify(message2);
|
|
15033
15113
|
if (trip) this.#hooks.trip(trip);
|
|
15034
15114
|
if (trip === "abort") this.#broken = "the Lua runtime aborted; reload the plugin";
|
|
15035
|
-
throw new PluginRunError(
|
|
15115
|
+
throw new PluginRunError(message2, trip);
|
|
15036
15116
|
} finally {
|
|
15037
15117
|
lua.luaL_unref(global.address, LUA_REGISTRYINDEX, ref);
|
|
15038
15118
|
this.#publishActions();
|
|
@@ -15215,7 +15295,7 @@ var init_main = __esm({
|
|
|
15215
15295
|
});
|
|
15216
15296
|
return next;
|
|
15217
15297
|
}
|
|
15218
|
-
#log(plugin, level,
|
|
15298
|
+
#log(plugin, level, message2, fields) {
|
|
15219
15299
|
const now = Date.now();
|
|
15220
15300
|
let budget2 = this.#logBudgets.get(plugin);
|
|
15221
15301
|
if (!budget2 || now - budget2.windowStart >= 1e3) {
|
|
@@ -15238,7 +15318,7 @@ var init_main = __esm({
|
|
|
15238
15318
|
type: "log",
|
|
15239
15319
|
plugin,
|
|
15240
15320
|
level,
|
|
15241
|
-
message:
|
|
15321
|
+
message: message2.slice(0, 8192),
|
|
15242
15322
|
...fields ? { fields } : {}
|
|
15243
15323
|
});
|
|
15244
15324
|
}
|
|
@@ -15257,7 +15337,7 @@ var init_main = __esm({
|
|
|
15257
15337
|
hooks: {
|
|
15258
15338
|
busy: () => this.#emit({ type: "busy", plugin: spec.name }),
|
|
15259
15339
|
idle: () => this.#emit({ type: "idle", plugin: spec.name }),
|
|
15260
|
-
log: (level,
|
|
15340
|
+
log: (level, message2, fields) => onLog ? onLog(level, message2) : this.#log(spec.name, level, message2, fields),
|
|
15261
15341
|
trip: (kind) => this.#emit({ type: "trip", plugin: spec.name, kind }),
|
|
15262
15342
|
actions: (json3) => this.#emit({ type: "actions", plugin: spec.name, actions: json3 })
|
|
15263
15343
|
}
|
|
@@ -15311,10 +15391,10 @@ var init_main = __esm({
|
|
|
15311
15391
|
});
|
|
15312
15392
|
this.#emit({ type: "loaded", plugin: spec.name, ok: true, memoryBytes: state.memoryUsed() });
|
|
15313
15393
|
} catch (error) {
|
|
15314
|
-
const
|
|
15315
|
-
this.#log(spec.name, "error", `load failed: ${
|
|
15394
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
15395
|
+
this.#log(spec.name, "error", `load failed: ${message2}`);
|
|
15316
15396
|
this.#unload(spec.name);
|
|
15317
|
-
this.#emit({ type: "loaded", plugin: spec.name, ok: false, error:
|
|
15397
|
+
this.#emit({ type: "loaded", plugin: spec.name, ok: false, error: message2.slice(0, 4096) });
|
|
15318
15398
|
}
|
|
15319
15399
|
}
|
|
15320
15400
|
#unload(name) {
|
|
@@ -15337,13 +15417,13 @@ var init_main = __esm({
|
|
|
15337
15417
|
});
|
|
15338
15418
|
this.#emit({ type: "invoke-result", id: command3.id, ok: true, value });
|
|
15339
15419
|
} catch (error) {
|
|
15340
|
-
const
|
|
15341
|
-
this.#log(command3.plugin, "error", `action ${command3.action} failed: ${
|
|
15420
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
15421
|
+
this.#log(command3.plugin, "error", `action ${command3.action} failed: ${message2}`);
|
|
15342
15422
|
this.#emit({
|
|
15343
15423
|
type: "invoke-result",
|
|
15344
15424
|
id: command3.id,
|
|
15345
15425
|
ok: false,
|
|
15346
|
-
error:
|
|
15426
|
+
error: message2.slice(0, 8192)
|
|
15347
15427
|
});
|
|
15348
15428
|
}
|
|
15349
15429
|
}
|
|
@@ -15357,12 +15437,12 @@ var init_main = __esm({
|
|
|
15357
15437
|
});
|
|
15358
15438
|
this.#emit({ type: "param-options-result", id: command3.id, ok: true, options });
|
|
15359
15439
|
} catch (error) {
|
|
15360
|
-
const
|
|
15440
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
15361
15441
|
this.#emit({
|
|
15362
15442
|
type: "param-options-result",
|
|
15363
15443
|
id: command3.id,
|
|
15364
15444
|
ok: false,
|
|
15365
|
-
error:
|
|
15445
|
+
error: message2.slice(0, 8192)
|
|
15366
15446
|
});
|
|
15367
15447
|
}
|
|
15368
15448
|
}
|
|
@@ -15372,8 +15452,8 @@ var init_main = __esm({
|
|
|
15372
15452
|
try {
|
|
15373
15453
|
state = await this.#createState(
|
|
15374
15454
|
{ name: RUN_STATE_NAME, includeRoots: [], moduleRoots: [], settings: {} },
|
|
15375
|
-
(level,
|
|
15376
|
-
if (logs.length < 1e3) logs.push({ level, message:
|
|
15455
|
+
(level, message2) => {
|
|
15456
|
+
if (logs.length < 1e3) logs.push({ level, message: message2.slice(0, 8192) });
|
|
15377
15457
|
}
|
|
15378
15458
|
);
|
|
15379
15459
|
const values2 = await state.runSource(command3.code, command3.chunkName, {
|
|
@@ -15382,12 +15462,12 @@ var init_main = __esm({
|
|
|
15382
15462
|
});
|
|
15383
15463
|
this.#emit({ type: "run-result", id: command3.id, ok: true, values: values2, logs });
|
|
15384
15464
|
} catch (error) {
|
|
15385
|
-
const
|
|
15465
|
+
const message2 = error instanceof PluginRunError || error instanceof Error ? error.message : String(error);
|
|
15386
15466
|
this.#emit({
|
|
15387
15467
|
type: "run-result",
|
|
15388
15468
|
id: command3.id,
|
|
15389
15469
|
ok: false,
|
|
15390
|
-
error:
|
|
15470
|
+
error: message2.slice(0, 8192),
|
|
15391
15471
|
logs
|
|
15392
15472
|
});
|
|
15393
15473
|
} finally {
|
|
@@ -15436,7 +15516,7 @@ var require_package = __commonJS({
|
|
|
15436
15516
|
"package.json"(exports, module) {
|
|
15437
15517
|
module.exports = {
|
|
15438
15518
|
name: "tmux-ide",
|
|
15439
|
-
version: "2.9.
|
|
15519
|
+
version: "2.9.27",
|
|
15440
15520
|
description: "The open-source workspace for coding agents: run Claude Code, Codex and other agents in tmux with live status",
|
|
15441
15521
|
type: "module",
|
|
15442
15522
|
bin: {
|
|
@@ -15560,7 +15640,7 @@ var require_package = __commonJS({
|
|
|
15560
15640
|
"developer-tools"
|
|
15561
15641
|
],
|
|
15562
15642
|
engines: {
|
|
15563
|
-
node: ">=
|
|
15643
|
+
node: ">=24"
|
|
15564
15644
|
},
|
|
15565
15645
|
repository: {
|
|
15566
15646
|
type: "git",
|
|
@@ -16265,8 +16345,8 @@ var init_project_registry = __esm({
|
|
|
16265
16345
|
});
|
|
16266
16346
|
ProjectRegistryError = class extends Error {
|
|
16267
16347
|
code;
|
|
16268
|
-
constructor(
|
|
16269
|
-
super(
|
|
16348
|
+
constructor(message2, code2) {
|
|
16349
|
+
super(message2);
|
|
16270
16350
|
this.name = "ProjectRegistryError";
|
|
16271
16351
|
this.code = code2;
|
|
16272
16352
|
}
|
|
@@ -17218,8 +17298,8 @@ var init_canonical_daemon = __esm({
|
|
|
17218
17298
|
MAX_DAEMON_CLAIM_BYTES = 4 * 1024;
|
|
17219
17299
|
activeClaims = /* @__PURE__ */ new Map();
|
|
17220
17300
|
CanonicalDaemonReservationError = class extends Error {
|
|
17221
|
-
constructor(
|
|
17222
|
-
super(`Supervisor reservation refused: ${
|
|
17301
|
+
constructor(message2) {
|
|
17302
|
+
super(`Supervisor reservation refused: ${message2}`);
|
|
17223
17303
|
this.name = "CanonicalDaemonReservationError";
|
|
17224
17304
|
}
|
|
17225
17305
|
};
|
|
@@ -17777,8 +17857,8 @@ var init_report = __esm({
|
|
|
17777
17857
|
});
|
|
17778
17858
|
|
|
17779
17859
|
// packages/daemon/src/control/frames.ts
|
|
17780
|
-
function encodeFrame(
|
|
17781
|
-
return `${JSON.stringify(
|
|
17860
|
+
function encodeFrame(message2) {
|
|
17861
|
+
return `${JSON.stringify(message2)}
|
|
17782
17862
|
`;
|
|
17783
17863
|
}
|
|
17784
17864
|
function createFrameSplitter() {
|
|
@@ -19492,13 +19572,13 @@ function decideNotifications(events, clients, lastNotified, nowMs, states2 = NOT
|
|
|
19492
19572
|
if (last !== void 0 && nowMs - last < NOTIFY_DEBOUNCE_MS) continue;
|
|
19493
19573
|
if (appFocus?.attached && ev.paneId && appFocus.panes.includes(ev.paneId)) continue;
|
|
19494
19574
|
nextLastNotified.set(key2, nowMs);
|
|
19495
|
-
const
|
|
19575
|
+
const message2 = notifyMessage(ev);
|
|
19496
19576
|
for (const c of clients) {
|
|
19497
19577
|
if (suppressToastFor(c, ev)) continue;
|
|
19498
|
-
toasts.push({ client: c.client, message });
|
|
19578
|
+
toasts.push({ client: c.client, message: message2 });
|
|
19499
19579
|
}
|
|
19500
19580
|
system.push({
|
|
19501
|
-
message,
|
|
19581
|
+
message: message2,
|
|
19502
19582
|
session: ev.session,
|
|
19503
19583
|
state: ev.to,
|
|
19504
19584
|
paneId: ev.paneId ?? null,
|
|
@@ -19562,9 +19642,9 @@ function readAppFocus(nowMs = Date.now()) {
|
|
|
19562
19642
|
}
|
|
19563
19643
|
function sendToasts(toasts) {
|
|
19564
19644
|
if (resolveRuntimeNamespace().development) return;
|
|
19565
|
-
for (const { client, message } of toasts) {
|
|
19645
|
+
for (const { client, message: message2 } of toasts) {
|
|
19566
19646
|
try {
|
|
19567
|
-
runTmux(["display-message", "-c", client, "-d", "3000",
|
|
19647
|
+
runTmux(["display-message", "-c", client, "-d", "3000", message2]);
|
|
19568
19648
|
} catch {
|
|
19569
19649
|
}
|
|
19570
19650
|
}
|
|
@@ -20530,8 +20610,8 @@ function dispatchUpdateToast(deps2, version) {
|
|
|
20530
20610
|
if (!mark || !listClients || !toast) return;
|
|
20531
20611
|
if (prefs && !prefs.toast) return;
|
|
20532
20612
|
if (!mark(version)) return;
|
|
20533
|
-
const
|
|
20534
|
-
toast(listClients().map((c) => ({ client: c.client, message })));
|
|
20613
|
+
const message2 = `\u2B06 tmux-ide v${version} available \u2014 run: tmux-ide update`;
|
|
20614
|
+
toast(listClients().map((c) => ({ client: c.client, message: message2 })));
|
|
20535
20615
|
}
|
|
20536
20616
|
function seedSessionStatus(session) {
|
|
20537
20617
|
try {
|
|
@@ -20746,8 +20826,8 @@ var init_dispatch = __esm({
|
|
|
20746
20826
|
init_errors2();
|
|
20747
20827
|
ControlVerbError = class extends Error {
|
|
20748
20828
|
code;
|
|
20749
|
-
constructor(code2,
|
|
20750
|
-
super(
|
|
20829
|
+
constructor(code2, message2) {
|
|
20830
|
+
super(message2);
|
|
20751
20831
|
this.code = code2;
|
|
20752
20832
|
}
|
|
20753
20833
|
};
|
|
@@ -20757,11 +20837,11 @@ var init_dispatch = __esm({
|
|
|
20757
20837
|
ok: true,
|
|
20758
20838
|
data
|
|
20759
20839
|
});
|
|
20760
|
-
fail = (id2, code2,
|
|
20840
|
+
fail = (id2, code2, message2) => ({
|
|
20761
20841
|
v: CONTROL_PROTOCOL_VERSION,
|
|
20762
20842
|
id: id2,
|
|
20763
20843
|
ok: false,
|
|
20764
|
-
error: { code: code2, message }
|
|
20844
|
+
error: { code: code2, message: message2 }
|
|
20765
20845
|
});
|
|
20766
20846
|
}
|
|
20767
20847
|
});
|
|
@@ -21263,12 +21343,12 @@ async function loadWorkspaceConfig(dir, options = {}) {
|
|
|
21263
21343
|
});
|
|
21264
21344
|
}
|
|
21265
21345
|
if (resolution.config.kind !== "workspace") {
|
|
21266
|
-
const
|
|
21346
|
+
const message2 = resolution.config.kind === "legacy" ? `Found legacy config at ${resolution.config.path}; this loader requires .tmux-ide/workspace.yml` : `No .tmux-ide/workspace.yml config was found for ${resolution.inputDir}`;
|
|
21267
21347
|
throw new WorkspaceConfigLoadError({
|
|
21268
21348
|
code: "WORKSPACE_CONFIG_REQUIRED",
|
|
21269
21349
|
stage: "resolution",
|
|
21270
21350
|
path: resolution.config.path,
|
|
21271
|
-
message
|
|
21351
|
+
message: message2
|
|
21272
21352
|
});
|
|
21273
21353
|
}
|
|
21274
21354
|
const basePath = resolution.config.path;
|
|
@@ -21374,8 +21454,8 @@ var init_legacy_config_adapter = __esm({
|
|
|
21374
21454
|
|
|
21375
21455
|
// packages/daemon/src/lib/legacy-config-migration.ts
|
|
21376
21456
|
import yaml3 from "js-yaml";
|
|
21377
|
-
function pushDiagnostic(diagnostics, code2, path2,
|
|
21378
|
-
diagnostics.push({ code: code2, path: path2, message });
|
|
21457
|
+
function pushDiagnostic(diagnostics, code2, path2, message2) {
|
|
21458
|
+
diagnostics.push({ code: code2, path: path2, message: message2 });
|
|
21379
21459
|
}
|
|
21380
21460
|
function cloneTerminalPane(pane) {
|
|
21381
21461
|
const result2 = {};
|
|
@@ -21397,16 +21477,16 @@ function convertLegacyConfigToWorkspace(legacy) {
|
|
|
21397
21477
|
const rows = legacy.rows.map((row, rowIndex) => ({
|
|
21398
21478
|
...row.size === void 0 ? {} : { size: row.size },
|
|
21399
21479
|
panes: row.panes.map((pane, paneIndex) => {
|
|
21400
|
-
for (const [key2, code2,
|
|
21480
|
+
for (const [key2, code2, message2] of PANE_UNSUPPORTED) {
|
|
21401
21481
|
if (pane[key2] !== void 0) {
|
|
21402
|
-
pushDiagnostic(diagnostics, code2, `rows.${rowIndex}.panes.${paneIndex}.${key2}`,
|
|
21482
|
+
pushDiagnostic(diagnostics, code2, `rows.${rowIndex}.panes.${paneIndex}.${key2}`, message2);
|
|
21403
21483
|
}
|
|
21404
21484
|
}
|
|
21405
21485
|
return cloneTerminalPane(pane);
|
|
21406
21486
|
})
|
|
21407
21487
|
}));
|
|
21408
|
-
for (const [key2, code2,
|
|
21409
|
-
if (legacy[key2] !== void 0) pushDiagnostic(diagnostics, code2, String(key2),
|
|
21488
|
+
for (const [key2, code2, message2] of ROOT_UNSUPPORTED) {
|
|
21489
|
+
if (legacy[key2] !== void 0) pushDiagnostic(diagnostics, code2, String(key2), message2);
|
|
21410
21490
|
}
|
|
21411
21491
|
const candidate = {
|
|
21412
21492
|
version: 1,
|
|
@@ -21526,13 +21606,13 @@ function loadedWorkspaceToResolved(loaded) {
|
|
|
21526
21606
|
migrationHint: null
|
|
21527
21607
|
};
|
|
21528
21608
|
}
|
|
21529
|
-
function configReadError(
|
|
21530
|
-
return new ConfigError(
|
|
21609
|
+
function configReadError(message2, cause) {
|
|
21610
|
+
return new ConfigError(message2, "READ_ERROR", {
|
|
21531
21611
|
cause: cause instanceof Error ? cause : new Error(String(cause))
|
|
21532
21612
|
});
|
|
21533
21613
|
}
|
|
21534
|
-
function configInvalidError(
|
|
21535
|
-
return new ConfigError(
|
|
21614
|
+
function configInvalidError(message2, cause) {
|
|
21615
|
+
return new ConfigError(message2, "INVALID_CONFIG", {
|
|
21536
21616
|
cause: cause instanceof Error ? cause : new Error(String(cause))
|
|
21537
21617
|
});
|
|
21538
21618
|
}
|
|
@@ -21796,8 +21876,8 @@ var init_resolved_config = __esm({
|
|
|
21796
21876
|
init_legacy_config_migration();
|
|
21797
21877
|
WorkspaceConfigWriteError = class extends IdeError {
|
|
21798
21878
|
path;
|
|
21799
|
-
constructor(
|
|
21800
|
-
super(
|
|
21879
|
+
constructor(message2, code2, path2, cause) {
|
|
21880
|
+
super(message2, {
|
|
21801
21881
|
code: code2,
|
|
21802
21882
|
exitCode: 1,
|
|
21803
21883
|
cause: cause instanceof Error ? cause : cause === void 0 ? void 0 : new Error(String(cause))
|
|
@@ -21807,8 +21887,8 @@ var init_resolved_config = __esm({
|
|
|
21807
21887
|
}
|
|
21808
21888
|
};
|
|
21809
21889
|
UnsupportedLegacyConfigMutationError = class extends IdeError {
|
|
21810
|
-
constructor(diagnostics,
|
|
21811
|
-
super(
|
|
21890
|
+
constructor(diagnostics, message2 = `Legacy ide.yml contains unsupported fields that would be dropped by config mutation. Run \`tmux-ide migrate --dry-run\` and move to .tmux-ide/workspace.yml first.`) {
|
|
21891
|
+
super(message2, { code: "LEGACY_CONFIG_MUTATION_UNSUPPORTED", exitCode: 1 });
|
|
21812
21892
|
this.diagnostics = diagnostics;
|
|
21813
21893
|
this.name = "UnsupportedLegacyConfigMutationError";
|
|
21814
21894
|
}
|
|
@@ -23116,8 +23196,8 @@ var init_project_runtime_errors = __esm({
|
|
|
23116
23196
|
"use strict";
|
|
23117
23197
|
ProjectRuntimeRepositoryError = class extends Error {
|
|
23118
23198
|
code;
|
|
23119
|
-
constructor(code2,
|
|
23120
|
-
super(
|
|
23199
|
+
constructor(code2, message2) {
|
|
23200
|
+
super(message2);
|
|
23121
23201
|
this.name = new.target.name;
|
|
23122
23202
|
this.code = code2;
|
|
23123
23203
|
}
|
|
@@ -24530,8 +24610,8 @@ var init_mission_repository = __esm({
|
|
|
24530
24610
|
MISSIONS_STREAM = "missions";
|
|
24531
24611
|
MissionRepositoryError = class extends IdeError {
|
|
24532
24612
|
missionCode;
|
|
24533
|
-
constructor(
|
|
24534
|
-
super(
|
|
24613
|
+
constructor(message2, code2, { cause } = {}) {
|
|
24614
|
+
super(message2, { code: code2, cause });
|
|
24535
24615
|
this.name = "MissionRepositoryError";
|
|
24536
24616
|
this.missionCode = code2;
|
|
24537
24617
|
}
|
|
@@ -26104,8 +26184,8 @@ var init_bootstrap_coordinator = __esm({
|
|
|
26104
26184
|
code;
|
|
26105
26185
|
reason;
|
|
26106
26186
|
cause;
|
|
26107
|
-
constructor(code2,
|
|
26108
|
-
super(
|
|
26187
|
+
constructor(code2, message2, options = {}) {
|
|
26188
|
+
super(message2, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
26109
26189
|
this.name = "DaemonBootstrapError";
|
|
26110
26190
|
this.code = code2;
|
|
26111
26191
|
this.reason = options.reason ?? null;
|
|
@@ -27068,14 +27148,14 @@ import { randomUUID as randomUUID10 } from "node:crypto";
|
|
|
27068
27148
|
import { execFileSync as execFileSync15 } from "node:child_process";
|
|
27069
27149
|
import { resolve as resolve20, join as join30 } from "node:path";
|
|
27070
27150
|
import { existsSync as existsSync24, mkdirSync as mkdirSync20, writeFileSync as writeFileSync18 } from "node:fs";
|
|
27071
|
-
function writeDispatchFile(dir, paneId,
|
|
27072
|
-
if (
|
|
27151
|
+
function writeDispatchFile(dir, paneId, message2) {
|
|
27152
|
+
if (message2.length <= LONG_MESSAGE_THRESHOLD) return null;
|
|
27073
27153
|
const dispatchDir = join30(dir, ".tasks", "dispatch");
|
|
27074
27154
|
if (!existsSync24(dispatchDir)) mkdirSync20(dispatchDir, { recursive: true });
|
|
27075
27155
|
const paneSlug = paneId.replace("%", "");
|
|
27076
27156
|
const filename = `send-${paneSlug}-${Date.now()}-${randomUUID10().slice(0, 8)}.md`;
|
|
27077
27157
|
const filePath = join30(dispatchDir, filename);
|
|
27078
|
-
writeFileSync18(filePath,
|
|
27158
|
+
writeFileSync18(filePath, message2);
|
|
27079
27159
|
return { filePath, triggerCmd: `Read and execute: .tasks/dispatch/${filename}` };
|
|
27080
27160
|
}
|
|
27081
27161
|
function resolvePane(panes, target) {
|
|
@@ -27095,11 +27175,11 @@ function resolvePane(panes, target) {
|
|
|
27095
27175
|
if (byPattern) return byPattern;
|
|
27096
27176
|
return null;
|
|
27097
27177
|
}
|
|
27098
|
-
function prepareMessage(
|
|
27178
|
+
function prepareMessage(message2, busyStatus) {
|
|
27099
27179
|
if (busyStatus === "agent") {
|
|
27100
|
-
return
|
|
27180
|
+
return message2.replace(/\n+/g, " ").trim();
|
|
27101
27181
|
}
|
|
27102
|
-
return
|
|
27182
|
+
return message2;
|
|
27103
27183
|
}
|
|
27104
27184
|
function deliverMessage(opts) {
|
|
27105
27185
|
const { session, target, noEnter, dir } = opts;
|
|
@@ -27124,13 +27204,13 @@ ${available}`, {
|
|
|
27124
27204
|
});
|
|
27125
27205
|
}
|
|
27126
27206
|
const busyStatus = getPaneBusyStatus(session, pane.id);
|
|
27127
|
-
const
|
|
27207
|
+
const message2 = prepareMessage(opts.message, busyStatus);
|
|
27128
27208
|
let sentViaFile = false;
|
|
27129
27209
|
if (noEnter) {
|
|
27130
|
-
sendText(session, pane.id,
|
|
27210
|
+
sendText(session, pane.id, message2);
|
|
27131
27211
|
} else {
|
|
27132
|
-
const dispatch = dir ? writeDispatchFile(dir, pane.id,
|
|
27133
|
-
if (!sendCommand(session, pane.id, dispatch?.triggerCmd ??
|
|
27212
|
+
const dispatch = dir ? writeDispatchFile(dir, pane.id, message2) : null;
|
|
27213
|
+
if (!sendCommand(session, pane.id, dispatch?.triggerCmd ?? message2)) {
|
|
27134
27214
|
throw new IdeError(`Could not send input to pane "${pane.id}"; delivery was not repeated.`, {
|
|
27135
27215
|
code: "PANE_INPUT_FAILED"
|
|
27136
27216
|
});
|
|
@@ -27146,7 +27226,7 @@ ${available}`, {
|
|
|
27146
27226
|
title: pane.title,
|
|
27147
27227
|
role: pane.role
|
|
27148
27228
|
},
|
|
27149
|
-
message,
|
|
27229
|
+
message: message2,
|
|
27150
27230
|
busyStatus,
|
|
27151
27231
|
sentViaFile,
|
|
27152
27232
|
...busyStatus === "agent" ? { warning: "agent_busy" } : {}
|
|
@@ -27268,14 +27348,14 @@ async function send(targetDir, opts) {
|
|
|
27268
27348
|
});
|
|
27269
27349
|
}
|
|
27270
27350
|
const result2 = await deliverMessageThroughDaemon({ session, target, message: rawMessage, noEnter, dir }) ?? deliverMessage({ session, target, message: rawMessage, noEnter, dir });
|
|
27271
|
-
const { message, busyStatus } = result2;
|
|
27351
|
+
const { message: message2, busyStatus } = result2;
|
|
27272
27352
|
const pane = result2.target;
|
|
27273
27353
|
if (json3) {
|
|
27274
27354
|
console.log(JSON.stringify(result2, null, 2));
|
|
27275
27355
|
return;
|
|
27276
27356
|
}
|
|
27277
27357
|
const label4 = pane.name ?? pane.title;
|
|
27278
|
-
const preview =
|
|
27358
|
+
const preview = message2.length > 60 ? message2.slice(0, 60) + "..." : message2;
|
|
27279
27359
|
console.log(`Sent to "${label4}" (${pane.paneId}): ${preview}`);
|
|
27280
27360
|
if (busyStatus === "agent") {
|
|
27281
27361
|
console.log("Warning: agent appears busy. Message sent anyway.");
|
|
@@ -27956,8 +28036,8 @@ var init_client = __esm({
|
|
|
27956
28036
|
init_server();
|
|
27957
28037
|
ControlRequestError = class extends Error {
|
|
27958
28038
|
code;
|
|
27959
|
-
constructor(code2,
|
|
27960
|
-
super(
|
|
28039
|
+
constructor(code2, message2) {
|
|
28040
|
+
super(message2);
|
|
27961
28041
|
this.code = code2;
|
|
27962
28042
|
}
|
|
27963
28043
|
};
|
|
@@ -28105,8 +28185,8 @@ var init_development_state = __esm({
|
|
|
28105
28185
|
"use strict";
|
|
28106
28186
|
execute = promisify(execFile7);
|
|
28107
28187
|
DevelopmentOperationError = class extends Error {
|
|
28108
|
-
constructor(reason,
|
|
28109
|
-
super(
|
|
28188
|
+
constructor(reason, message2, receipt, diagnostic4) {
|
|
28189
|
+
super(message2);
|
|
28110
28190
|
this.reason = reason;
|
|
28111
28191
|
this.receipt = receipt;
|
|
28112
28192
|
this.diagnostic = diagnostic4;
|
|
@@ -28122,8 +28202,8 @@ var init_development_state = __esm({
|
|
|
28122
28202
|
import { createHash as createHash10 } from "node:crypto";
|
|
28123
28203
|
import { readFileSync as readFileSync26, readlinkSync as readlinkSync4, lstatSync as lstatSync11, opendirSync as opendirSync2 } from "node:fs";
|
|
28124
28204
|
import { join as join32, dirname as dirname28 } from "node:path";
|
|
28125
|
-
function suspensionRefusal(
|
|
28126
|
-
throw new DevelopmentOperationError("suspension-unverified",
|
|
28205
|
+
function suspensionRefusal(message2) {
|
|
28206
|
+
throw new DevelopmentOperationError("suspension-unverified", message2);
|
|
28127
28207
|
}
|
|
28128
28208
|
function validateContainerBinding(binding) {
|
|
28129
28209
|
if (!binding || typeof binding.project !== "string" || typeof binding.containerId !== "string" || typeof binding.volumesHash !== "string" || !/^[a-z][a-z0-9-]{1,62}$/u.test(binding.project) || !HASH.test(binding.containerId) || !HASH.test(binding.volumesHash))
|
|
@@ -30329,8 +30409,8 @@ function sanitizeLogPayload(data, options = {}) {
|
|
|
30329
30409
|
bytes = byteLength(serialized);
|
|
30330
30410
|
return { data: summary, bytes, truncated: true, renamedKeys };
|
|
30331
30411
|
}
|
|
30332
|
-
function sanitizeLogMessage(
|
|
30333
|
-
return truncateString(redactText(String(
|
|
30412
|
+
function sanitizeLogMessage(message2, secrets2 = EMPTY, budget2 = DEFAULT_LOG_BUDGET) {
|
|
30413
|
+
return truncateString(redactText(String(message2), secrets2), budget2.maxMessageBytes);
|
|
30334
30414
|
}
|
|
30335
30415
|
function safeStringify(value) {
|
|
30336
30416
|
try {
|
|
@@ -30420,14 +30500,14 @@ function writeToStream(name, line) {
|
|
|
30420
30500
|
markStreamFailed(name, error);
|
|
30421
30501
|
}
|
|
30422
30502
|
}
|
|
30423
|
-
function writeStructuredLog(level, component,
|
|
30503
|
+
function writeStructuredLog(level, component, message2, data) {
|
|
30424
30504
|
if (LEVEL_RANK[level] < LEVEL_RANK[minLevel]) return;
|
|
30425
30505
|
const payload = sanitizeLogPayload(data, { secrets, budget });
|
|
30426
30506
|
const entry = {
|
|
30427
30507
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30428
30508
|
level,
|
|
30429
30509
|
component: sanitizeLogMessage(String(component), secrets, budget).slice(0, 128),
|
|
30430
|
-
msg: sanitizeLogMessage(
|
|
30510
|
+
msg: sanitizeLogMessage(message2, secrets, budget),
|
|
30431
30511
|
pid: process.pid,
|
|
30432
30512
|
...identity2.instanceId ? { instanceId: identity2.instanceId } : {},
|
|
30433
30513
|
...identity2.version ? { version: identity2.version } : {},
|
|
@@ -33942,8 +34022,8 @@ function previousBindingsByRuntime(bindings) {
|
|
|
33942
34022
|
}
|
|
33943
34023
|
return byRuntime;
|
|
33944
34024
|
}
|
|
33945
|
-
function diagnostic(code2, runtimePaneId, semanticPaneId3,
|
|
33946
|
-
return { code: code2, runtimePaneId, semanticPaneId: semanticPaneId3, message, degraded };
|
|
34025
|
+
function diagnostic(code2, runtimePaneId, semanticPaneId3, message2, degraded) {
|
|
34026
|
+
return { code: code2, runtimePaneId, semanticPaneId: semanticPaneId3, message: message2, degraded };
|
|
33947
34027
|
}
|
|
33948
34028
|
var RUNTIME_PANE_ID, DEFAULT_GENERATION_ATTEMPTS;
|
|
33949
34029
|
var init_workspace_tmux_adapter = __esm({
|
|
@@ -40024,9 +40104,9 @@ var init_native_journal_control_connection = __esm({
|
|
|
40024
40104
|
);
|
|
40025
40105
|
this.#phaseTimer.unref?.();
|
|
40026
40106
|
}
|
|
40027
|
-
#fail(
|
|
40107
|
+
#fail(message2) {
|
|
40028
40108
|
this.#clearPhaseDeadline();
|
|
40029
|
-
this.#failure ??= new Error(
|
|
40109
|
+
this.#failure ??= new Error(message2);
|
|
40030
40110
|
this.#pending?.reject(this.#failure);
|
|
40031
40111
|
this.#pending = null;
|
|
40032
40112
|
this.#frame = null;
|
|
@@ -41576,8 +41656,8 @@ var init_fleet_lifecycle_authority = __esm({
|
|
|
41576
41656
|
MAX_REPLAY_OPERATIONS = 128;
|
|
41577
41657
|
sleep2 = (milliseconds) => new Promise((resolve47) => setTimeout(resolve47, milliseconds));
|
|
41578
41658
|
FleetLifecycleAuthorityError = class extends Error {
|
|
41579
|
-
constructor(code2,
|
|
41580
|
-
super(
|
|
41659
|
+
constructor(code2, message2) {
|
|
41660
|
+
super(message2);
|
|
41581
41661
|
this.code = code2;
|
|
41582
41662
|
}
|
|
41583
41663
|
code;
|
|
@@ -42242,8 +42322,8 @@ var init_semantic_pane_catalog = __esm({
|
|
|
42242
42322
|
SemanticPaneCatalogError = class extends Error {
|
|
42243
42323
|
code;
|
|
42244
42324
|
target;
|
|
42245
|
-
constructor(code2, target,
|
|
42246
|
-
super(
|
|
42325
|
+
constructor(code2, target, message2) {
|
|
42326
|
+
super(message2);
|
|
42247
42327
|
this.name = "SemanticPaneCatalogError";
|
|
42248
42328
|
this.code = code2;
|
|
42249
42329
|
this.target = target;
|
|
@@ -43232,15 +43312,35 @@ function createNativeTmuxSessionOpener(options) {
|
|
|
43232
43312
|
const open5 = async (liveSessionId, observed) => {
|
|
43233
43313
|
assertOpen();
|
|
43234
43314
|
const records = await options.run([
|
|
43235
|
-
"list-
|
|
43315
|
+
"list-panes",
|
|
43316
|
+
"-a",
|
|
43236
43317
|
"-F",
|
|
43237
|
-
|
|
43318
|
+
`#{pid} #{session_id} #{session_created} #{${ADOPTED_OPTION2}} #{${SEMANTIC_WINDOW_OPTION2}} #{${SEMANTIC_PANE_OPTION3}} #{session_name}`
|
|
43238
43319
|
]);
|
|
43239
|
-
const
|
|
43240
|
-
|
|
43320
|
+
const rows = records.replace(/\n+$/u, "").split("\n").map((line) => line.split(" ")).filter((fields) => fields.length >= 7).map((fields) => ({
|
|
43321
|
+
// A tab can only come from a window or pane stamp: such a row never
|
|
43322
|
+
// takes the fast path below.
|
|
43323
|
+
exact: fields.length === 7,
|
|
43324
|
+
pid: fields[0],
|
|
43325
|
+
id: fields[1],
|
|
43326
|
+
created: fields[2],
|
|
43327
|
+
adopted: fields[3],
|
|
43328
|
+
window: fields.slice(4, -2).join(" "),
|
|
43329
|
+
pane: fields.at(-2),
|
|
43330
|
+
name: fields.at(-1)
|
|
43331
|
+
})).filter(
|
|
43332
|
+
({ pid, id: id2, created: created2, name: name2 }) => /^\d+$/.test(pid) && /^\$\d+$/.test(id2) && /^\d+$/.test(created2) && name2 && isVisibleFleetSession(name2) && liveSessionIdForNativeIdentity(pid, id2, created2) === liveSessionId
|
|
43241
43333
|
);
|
|
43242
|
-
if (
|
|
43243
|
-
|
|
43334
|
+
if (new Set(rows.map((row) => row.id)).size !== 1)
|
|
43335
|
+
throw new Error("Selected live tmux session is no longer available");
|
|
43336
|
+
const { id: nativeSessionId, created, name } = rows[0];
|
|
43337
|
+
const aliases = options.registry.list().filter((entry) => entry.sessionName === name);
|
|
43338
|
+
if (!observed && aliases.length === 1 && !options.registry.isVolatile(aliases[0].name) && rows.every(
|
|
43339
|
+
(row) => row.exact && row.adopted === "1" && row.window.length > 0 && hasValidPaneStamp(row.pane)
|
|
43340
|
+
)) {
|
|
43341
|
+
assertOpen();
|
|
43342
|
+
return { workspaceName: aliases[0].name, liveSessionId };
|
|
43343
|
+
}
|
|
43244
43344
|
const run = async (args) => {
|
|
43245
43345
|
assertOpen();
|
|
43246
43346
|
const sentinel = `tmux-session-stale.${randomUUID25()}`;
|
|
@@ -44727,11 +44827,11 @@ var init_control_channel = __esm({
|
|
|
44727
44827
|
owner.retiring = true;
|
|
44728
44828
|
if (owner.timer) clearTimeout(owner.timer);
|
|
44729
44829
|
owner.timer = null;
|
|
44730
|
-
const abort = (
|
|
44830
|
+
const abort = (message2) => {
|
|
44731
44831
|
if (this.atomicCollectorOwner !== owner) return;
|
|
44732
44832
|
try {
|
|
44733
|
-
this.core.fail(
|
|
44734
|
-
this.noteExit(
|
|
44833
|
+
this.core.fail(message2);
|
|
44834
|
+
this.noteExit(message2);
|
|
44735
44835
|
} finally {
|
|
44736
44836
|
void this.dispose();
|
|
44737
44837
|
}
|
|
@@ -45242,8 +45342,8 @@ var init_mirror_service = __esm({
|
|
|
45242
45342
|
entry.channel.sendKey(semanticPaneId3, key2, performanceTraceId);
|
|
45243
45343
|
}
|
|
45244
45344
|
assertWindowOwnership(session) {
|
|
45245
|
-
const
|
|
45246
|
-
if (
|
|
45345
|
+
const message2 = this.windowOwnershipMessage(session);
|
|
45346
|
+
if (message2) throw new Error(message2);
|
|
45247
45347
|
}
|
|
45248
45348
|
/** Registered-window ownership is being read again; input waits for it. */
|
|
45249
45349
|
windowOwnershipPending() {
|
|
@@ -45840,8 +45940,8 @@ var init_semantic_mutation_executor = __esm({
|
|
|
45840
45940
|
init_runtime_observability();
|
|
45841
45941
|
init_semantic_mutation_resource_changes();
|
|
45842
45942
|
SessionRuntimeIntentError = class extends Error {
|
|
45843
|
-
constructor(outcome,
|
|
45844
|
-
super(
|
|
45943
|
+
constructor(outcome, message2, options) {
|
|
45944
|
+
super(message2, options);
|
|
45845
45945
|
this.outcome = outcome;
|
|
45846
45946
|
this.name = "SessionRuntimeIntentError";
|
|
45847
45947
|
}
|
|
@@ -48274,14 +48374,30 @@ function terminalReplicaRowsEqualProfiled(left, right, profile) {
|
|
|
48274
48374
|
function hashTerminalReplicaSnapshot(snapshot3) {
|
|
48275
48375
|
return hashTerminalReplicaSnapshotProfiled(snapshot3);
|
|
48276
48376
|
}
|
|
48277
|
-
function
|
|
48377
|
+
function dropTerminalReplicaRowsDigestPrefix(digest3, prefix, remaining) {
|
|
48378
|
+
if (!/^[0-9a-f]{16}$/u.test(digest3)) throw new TypeError("Invalid rows digest");
|
|
48379
|
+
const hash = BigInt.asUintN(
|
|
48380
|
+
64,
|
|
48381
|
+
BigInt(`0x${digest3}`) - BigInt(`0x${hashTerminalReplicaRows(prefix)}`) * pow64(ROW_SEQUENCE_BASE, remaining)
|
|
48382
|
+
);
|
|
48383
|
+
return hash.toString(16).padStart(16, "0");
|
|
48384
|
+
}
|
|
48385
|
+
function popTerminalReplicaRowsDigestSuffix(digest3, suffix) {
|
|
48386
|
+
if (!/^[0-9a-f]{16}$/u.test(digest3)) throw new TypeError("Invalid rows digest");
|
|
48387
|
+
const hash = BigInt.asUintN(
|
|
48388
|
+
64,
|
|
48389
|
+
(BigInt(`0x${digest3}`) - BigInt(`0x${hashTerminalReplicaRows(suffix)}`)) * pow64(ROW_SEQUENCE_BASE_INVERSE, suffix.length)
|
|
48390
|
+
);
|
|
48391
|
+
return hash.toString(16).padStart(16, "0");
|
|
48392
|
+
}
|
|
48393
|
+
function hashTerminalReplicaSnapshotProfiled(snapshot3, profile, instrumentation, historyDigest) {
|
|
48278
48394
|
const started = readProfileClock(instrumentation);
|
|
48279
48395
|
const hash = hashStable([
|
|
48280
48396
|
"terminal-replica-v1",
|
|
48281
48397
|
snapshot3.cols,
|
|
48282
48398
|
snapshot3.rows,
|
|
48283
48399
|
hashTerminalReplicaRows(snapshot3.grid, profile, instrumentation),
|
|
48284
|
-
hashTerminalReplicaRows(snapshot3.history, profile, instrumentation),
|
|
48400
|
+
historyDigest ?? hashTerminalReplicaRows(snapshot3.history, profile, instrumentation),
|
|
48285
48401
|
snapshot3.cursor,
|
|
48286
48402
|
snapshot3.modes,
|
|
48287
48403
|
snapshot3.placements,
|
|
@@ -48576,7 +48692,7 @@ function terminalReplicaRowIsValid(row) {
|
|
|
48576
48692
|
}
|
|
48577
48693
|
return true;
|
|
48578
48694
|
}
|
|
48579
|
-
var VALIDATED_PATCH_ROWS, ROW_ARRAY_HASH_CACHE, ROW_SEQUENCE_BASE, verifiedTombstoneBases, TERMINAL_REPLICA_COOPERATIVE_SEED_CELLS;
|
|
48695
|
+
var VALIDATED_PATCH_ROWS, ROW_ARRAY_HASH_CACHE, ROW_SEQUENCE_BASE, ROW_SEQUENCE_BASE_INVERSE, verifiedTombstoneBases, TERMINAL_REPLICA_COOPERATIVE_SEED_CELLS;
|
|
48580
48696
|
var init_terminal_replica2 = __esm({
|
|
48581
48697
|
"packages/core/src/terminal-replica.ts"() {
|
|
48582
48698
|
"use strict";
|
|
@@ -48587,6 +48703,12 @@ var init_terminal_replica2 = __esm({
|
|
|
48587
48703
|
VALIDATED_PATCH_ROWS = /* @__PURE__ */ new WeakSet();
|
|
48588
48704
|
ROW_ARRAY_HASH_CACHE = /* @__PURE__ */ new WeakMap();
|
|
48589
48705
|
ROW_SEQUENCE_BASE = 0x100000001b3n;
|
|
48706
|
+
ROW_SEQUENCE_BASE_INVERSE = (() => {
|
|
48707
|
+
let inverse = ROW_SEQUENCE_BASE;
|
|
48708
|
+
for (let step = 0; step < 6; step++)
|
|
48709
|
+
inverse = BigInt.asUintN(64, inverse * (2n - ROW_SEQUENCE_BASE * inverse));
|
|
48710
|
+
return inverse;
|
|
48711
|
+
})();
|
|
48590
48712
|
verifiedTombstoneBases = /* @__PURE__ */ new WeakMap();
|
|
48591
48713
|
TERMINAL_REPLICA_COOPERATIVE_SEED_CELLS = 8192;
|
|
48592
48714
|
}
|
|
@@ -48670,9 +48792,9 @@ var init_terminal_delivery_binary = __esm({
|
|
|
48670
48792
|
}
|
|
48671
48793
|
header(frame, revision, base2, magic = "TCB1") {
|
|
48672
48794
|
for (const b of magic === "TCP1" ? [84, 67, 80, 49] : [84, 67, 66, 49]) this.byte(b);
|
|
48673
|
-
this.byte(frame === "seed" ? 0 : frame === "patch" ? 1 : 2);
|
|
48795
|
+
this.byte(frame === "seed" ? 0 : frame === "patch" ? 1 : frame === "tombstone" ? 2 : 3);
|
|
48674
48796
|
this.uint(revision);
|
|
48675
|
-
if (frame !== "seed") this.uint(base2);
|
|
48797
|
+
if (frame !== "seed" && frame !== "history") this.uint(base2);
|
|
48676
48798
|
}
|
|
48677
48799
|
get byteLength() {
|
|
48678
48800
|
return this.length;
|
|
@@ -48684,6 +48806,53 @@ var init_terminal_delivery_binary = __esm({
|
|
|
48684
48806
|
}
|
|
48685
48807
|
});
|
|
48686
48808
|
|
|
48809
|
+
// packages/core/src/terminal-partial-history.ts
|
|
48810
|
+
function terminalHistoryPrefixCommitment(history, unloadedRows) {
|
|
48811
|
+
if (!Number.isSafeInteger(unloadedRows) || unloadedRows < 0 || unloadedRows > history.length)
|
|
48812
|
+
throw new RangeError("Unloaded rows outside the history");
|
|
48813
|
+
const cache3 = Object.isFrozen(history) ? PREFIX_COMMITMENTS.get(history) : void 0;
|
|
48814
|
+
const cached2 = cache3?.get(unloadedRows);
|
|
48815
|
+
if (cached2) return cached2;
|
|
48816
|
+
const commitment = Object.freeze({
|
|
48817
|
+
rows: unloadedRows,
|
|
48818
|
+
digest: hashTerminalReplicaRows(
|
|
48819
|
+
unloadedRows === history.length ? history : history.slice(0, unloadedRows)
|
|
48820
|
+
)
|
|
48821
|
+
});
|
|
48822
|
+
if (Object.isFrozen(history)) {
|
|
48823
|
+
const entries = cache3 ?? /* @__PURE__ */ new Map();
|
|
48824
|
+
if (entries.size >= 8) entries.delete(entries.keys().next().value);
|
|
48825
|
+
entries.set(unloadedRows, commitment);
|
|
48826
|
+
PREFIX_COMMITMENTS.set(history, entries);
|
|
48827
|
+
}
|
|
48828
|
+
return commitment;
|
|
48829
|
+
}
|
|
48830
|
+
function dropTerminalHistoryCommitmentPrefix(commitment, dropped) {
|
|
48831
|
+
if (dropped.length > commitment.rows) throw new RangeError("Dropped rows exceed the commitment");
|
|
48832
|
+
const rows = commitment.rows - dropped.length;
|
|
48833
|
+
return Object.freeze({
|
|
48834
|
+
rows,
|
|
48835
|
+
digest: rows === 0 ? TERMINAL_HISTORY_EMPTY_DIGEST : dropTerminalReplicaRowsDigestPrefix(commitment.digest, dropped, rows)
|
|
48836
|
+
});
|
|
48837
|
+
}
|
|
48838
|
+
function popTerminalHistoryCommitmentSuffix(commitment, taken) {
|
|
48839
|
+
if (taken.length > commitment.rows) throw new RangeError("Taken rows exceed the commitment");
|
|
48840
|
+
const rows = commitment.rows - taken.length;
|
|
48841
|
+
return Object.freeze({
|
|
48842
|
+
rows,
|
|
48843
|
+
digest: rows === 0 ? TERMINAL_HISTORY_EMPTY_DIGEST : popTerminalReplicaRowsDigestSuffix(commitment.digest, taken)
|
|
48844
|
+
});
|
|
48845
|
+
}
|
|
48846
|
+
var PREFIX_COMMITMENTS;
|
|
48847
|
+
var init_terminal_partial_history = __esm({
|
|
48848
|
+
"packages/core/src/terminal-partial-history.ts"() {
|
|
48849
|
+
"use strict";
|
|
48850
|
+
init_src2();
|
|
48851
|
+
init_terminal_replica2();
|
|
48852
|
+
PREFIX_COMMITMENTS = /* @__PURE__ */ new WeakMap();
|
|
48853
|
+
}
|
|
48854
|
+
});
|
|
48855
|
+
|
|
48687
48856
|
// packages/core/src/terminal-delivery.ts
|
|
48688
48857
|
import { z as z111 } from "zod";
|
|
48689
48858
|
function negotiateTerminalDelivery(offer, generation, deliveryNonce) {
|
|
@@ -48698,12 +48867,14 @@ function negotiateTerminalDelivery(offer, generation, deliveryNonce) {
|
|
|
48698
48867
|
if (!encoding) return { accepted: false, reason: "encoding-mismatch" };
|
|
48699
48868
|
if (offer.richPlacements && encoding !== "semantic-v1" && encoding !== "semantic-compact-v1" && encoding !== "semantic-binary-v1")
|
|
48700
48869
|
return { accepted: false, reason: "unsupported-capability-combination" };
|
|
48870
|
+
const partialHistory = offer.protocolVersions.includes(TERMINAL_DELIVERY_PARTIAL_HISTORY_CAPABILITY_VERSION) && (encoding === "semantic-compact-v1" || encoding === "semantic-binary-v1");
|
|
48701
48871
|
return {
|
|
48702
48872
|
accepted: true,
|
|
48703
48873
|
negotiated: {
|
|
48704
48874
|
protocolVersion: TERMINAL_DELIVERY_PROTOCOL_VERSION,
|
|
48705
48875
|
encoding,
|
|
48706
|
-
...
|
|
48876
|
+
...partialHistory ? { partialHistory: "tail-v1" } : {},
|
|
48877
|
+
...binary && !partialHistory && offer.protocolVersions.some(
|
|
48707
48878
|
(v) => v === TERMINAL_PROJECTION_CAPABILITY_VERSION || v === TERMINAL_PROJECTION_LOCAL_CAPABILITY_VERSION || v === TERMINAL_GRAPHICS_COMPRESSED_CAPABILITY_VERSION || v === TERMINAL_GRAPHICS_COMPRESSED_LOCAL_CAPABILITY_VERSION
|
|
48708
48879
|
) ? { alternateScreenProjection: "deferred-history-v1" } : {},
|
|
48709
48880
|
...encoding === "semantic-compact-v1" && offer.encodings.includes("semantic-v1") ? { fallbackEncoding: "semantic-v1" } : {},
|
|
@@ -48848,6 +49019,43 @@ function compactSemanticWire(input) {
|
|
|
48848
49019
|
};
|
|
48849
49020
|
return wire;
|
|
48850
49021
|
}
|
|
49022
|
+
function encodeSemanticTerminalHistory(input, encoding) {
|
|
49023
|
+
const payload = HistoryEncodingPayloadSchema.parse(input);
|
|
49024
|
+
if (encoding === "semantic-v1") {
|
|
49025
|
+
const bytes = UTF8_ENCODER2.encode(canonicalJson(payload));
|
|
49026
|
+
assertRepresentationSize(bytes);
|
|
49027
|
+
return bytes;
|
|
49028
|
+
}
|
|
49029
|
+
const rows = compactRows(payload.rows, null, {
|
|
49030
|
+
rows: 0,
|
|
49031
|
+
runs: 0,
|
|
49032
|
+
cells: 0,
|
|
49033
|
+
placements: 0,
|
|
49034
|
+
maxCells: COMPACT_MAX_EXPANDED_CELLS,
|
|
49035
|
+
reusedRows: 0,
|
|
49036
|
+
allocatedCells: 0,
|
|
49037
|
+
canonicalUtf8Allocations: 0,
|
|
49038
|
+
canonicalUtf8Bytes: 0,
|
|
49039
|
+
validatedCellAllocations: 0
|
|
49040
|
+
});
|
|
49041
|
+
if (encoding === "semantic-compact-v1") {
|
|
49042
|
+
const bytes = UTF8_ENCODER2.encode(
|
|
49043
|
+
JSON.stringify({ f: "h", h: rows, k: COMPACT_SEMANTIC_KIND, r: payload.revision, v: 1 })
|
|
49044
|
+
);
|
|
49045
|
+
assertRepresentationSize(bytes);
|
|
49046
|
+
return bytes;
|
|
49047
|
+
}
|
|
49048
|
+
const writer = new BinaryTerminalWriter();
|
|
49049
|
+
try {
|
|
49050
|
+
writer.header("history", payload.revision);
|
|
49051
|
+
writer.value(rows);
|
|
49052
|
+
return writer.finish();
|
|
49053
|
+
} catch (error) {
|
|
49054
|
+
if (error instanceof BinaryTerminalLimitError)
|
|
49055
|
+
throw new TerminalDeliveryStateTooLargeError(TERMINAL_DELIVERY_MAX_REPRESENTATION_BYTES + 1);
|
|
49056
|
+
throw error;
|
|
49057
|
+
}
|
|
49058
|
+
}
|
|
48851
49059
|
function encodeBinarySemanticTerminalUpdate(input) {
|
|
48852
49060
|
const wire = compactSemanticWire(input);
|
|
48853
49061
|
const writer = new BinaryTerminalWriter();
|
|
@@ -49512,7 +49720,7 @@ function encodeTerminalProjectionMetadataTuple(value) {
|
|
|
49512
49720
|
compactBootstrap(value.bootstrap)
|
|
49513
49721
|
];
|
|
49514
49722
|
}
|
|
49515
|
-
var TerminalDeliveryStateTooLargeError, COMPACT_SEMANTIC_KIND, COMPACT_MAX_DIMENSION, COMPACT_MAX_ROWS, COMPACT_MAX_RUNS, COMPACT_MAX_EXPANDED_CELLS, COMPACT_MAX_EXPANSION_RATIO, COMPACT_MAX_PLACEMENTS, COMPACT_MAX_STRING_BYTES, UTF8_ENCODER2, COMPACT_DEFAULT_COLOR, validatedOwnedEncodingRows, CompactCellSliceSchema, trustedBlankCellsValidated, CompactOwnedCellSchema, CompactOwnedCellSliceSchema, CompactOwnedEncodingRowSchema, CompactEncodingRowSchema, CompactPatchRowFailure, StrictCompactPatchRowSchema, CompactPatchEncodingRowSchema, CompactPatchEncodingPayloadSchema, CompactEncodingPayloadSchema, TERMINAL_COMPACT_COOPERATIVE_SEED_CELLS, CompactSeedHeaderSchema, CompactSeedMetadataSchema, CompactRowHeaderSchema, COOPERATIVE_JSON_WORK_CHARS, COOPERATIVE_JSON_MAX_STRING_CHARS, TerminalDeliveryRepresentationHasher;
|
|
49723
|
+
var TerminalDeliveryStateTooLargeError, COMPACT_SEMANTIC_KIND, COMPACT_MAX_DIMENSION, COMPACT_MAX_ROWS, COMPACT_MAX_RUNS, COMPACT_MAX_EXPANDED_CELLS, COMPACT_MAX_EXPANSION_RATIO, COMPACT_MAX_PLACEMENTS, COMPACT_MAX_STRING_BYTES, UTF8_ENCODER2, COMPACT_DEFAULT_COLOR, validatedOwnedEncodingRows, CompactCellSliceSchema, trustedBlankCellsValidated, CompactOwnedCellSchema, CompactOwnedCellSliceSchema, CompactOwnedEncodingRowSchema, CompactEncodingRowSchema, CompactPatchRowFailure, StrictCompactPatchRowSchema, CompactPatchEncodingRowSchema, CompactPatchEncodingPayloadSchema, CompactEncodingPayloadSchema, HistoryEncodingPayloadSchema, TERMINAL_COMPACT_COOPERATIVE_SEED_CELLS, CompactSeedHeaderSchema, CompactSeedMetadataSchema, CompactRowHeaderSchema, COOPERATIVE_JSON_WORK_CHARS, COOPERATIVE_JSON_MAX_STRING_CHARS, TerminalDeliveryRepresentationHasher;
|
|
49516
49724
|
var init_terminal_delivery2 = __esm({
|
|
49517
49725
|
"packages/core/src/terminal-delivery.ts"() {
|
|
49518
49726
|
"use strict";
|
|
@@ -49522,6 +49730,7 @@ var init_terminal_delivery2 = __esm({
|
|
|
49522
49730
|
init_src2();
|
|
49523
49731
|
init_terminal_replica2();
|
|
49524
49732
|
init_terminal_compact_capability();
|
|
49733
|
+
init_terminal_partial_history();
|
|
49525
49734
|
init_terminal_replica_hash_cache();
|
|
49526
49735
|
TerminalDeliveryStateTooLargeError = class extends Error {
|
|
49527
49736
|
bytes;
|
|
@@ -49624,6 +49833,9 @@ var init_terminal_delivery2 = __esm({
|
|
|
49624
49833
|
TerminalSemanticDeliveryPayloadSchemaZ.options[1],
|
|
49625
49834
|
TerminalSemanticDeliveryPayloadSchemaZ.options[2]
|
|
49626
49835
|
]);
|
|
49836
|
+
HistoryEncodingPayloadSchema = TerminalSemanticHistoryPayloadSchemaZ.extend({
|
|
49837
|
+
rows: z111.array(CompactPatchEncodingRowSchema).min(1).max(TERMINAL_DELIVERY_HISTORY_CHUNK_MAX_ROWS)
|
|
49838
|
+
});
|
|
49627
49839
|
TERMINAL_COMPACT_COOPERATIVE_SEED_CELLS = 8192;
|
|
49628
49840
|
CompactSeedHeaderSchema = /* @__PURE__ */ TerminalSemanticDeliveryPayloadSchemaZ.options[0].omit({ snapshot: true });
|
|
49629
49841
|
CompactSeedMetadataSchema = /* @__PURE__ */ TerminalReplicaSnapshotSchemaZ.omit({
|
|
@@ -50158,6 +50370,7 @@ var init_src3 = __esm({
|
|
|
50158
50370
|
init_resize_transaction();
|
|
50159
50371
|
init_kitty_placeholders();
|
|
50160
50372
|
init_terminal_projection2();
|
|
50373
|
+
init_terminal_partial_history();
|
|
50161
50374
|
}
|
|
50162
50375
|
});
|
|
50163
50376
|
|
|
@@ -51816,7 +52029,7 @@ var init_xterm_headless = __esm({
|
|
|
51816
52029
|
}
|
|
51817
52030
|
}
|
|
51818
52031
|
uncoveredLeakingObjs.sort(compareBy((l) => l.idx, numberComparator));
|
|
51819
|
-
let
|
|
52032
|
+
let message2 = "";
|
|
51820
52033
|
let i = 0;
|
|
51821
52034
|
for (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {
|
|
51822
52035
|
i++;
|
|
@@ -51834,7 +52047,7 @@ var init_xterm_headless = __esm({
|
|
|
51834
52047
|
}
|
|
51835
52048
|
stackTraceFormattedLines.unshift(line);
|
|
51836
52049
|
}
|
|
51837
|
-
|
|
52050
|
+
message2 += `
|
|
51838
52051
|
|
|
51839
52052
|
|
|
51840
52053
|
==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================
|
|
@@ -51844,14 +52057,14 @@ ${stackTraceFormattedLines.join("\n")}
|
|
|
51844
52057
|
`;
|
|
51845
52058
|
}
|
|
51846
52059
|
if (uncoveredLeakingObjs.length > maxReported) {
|
|
51847
|
-
|
|
52060
|
+
message2 += `
|
|
51848
52061
|
|
|
51849
52062
|
|
|
51850
52063
|
... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables
|
|
51851
52064
|
|
|
51852
52065
|
`;
|
|
51853
52066
|
}
|
|
51854
|
-
return { leaks: uncoveredLeakingObjs, details:
|
|
52067
|
+
return { leaks: uncoveredLeakingObjs, details: message2 };
|
|
51855
52068
|
}
|
|
51856
52069
|
};
|
|
51857
52070
|
_DisposableTracker.idx = 0;
|
|
@@ -52542,10 +52755,10 @@ ${stackTraceFormattedLines.join("\n")}
|
|
|
52542
52755
|
if (this._warnCountdown <= 0) {
|
|
52543
52756
|
this._warnCountdown = threshold * 0.5;
|
|
52544
52757
|
const [topStack, topCount] = this.getMostFrequentStack();
|
|
52545
|
-
const
|
|
52546
|
-
console.warn(
|
|
52758
|
+
const message2 = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;
|
|
52759
|
+
console.warn(message2);
|
|
52547
52760
|
console.warn(topStack);
|
|
52548
|
-
const error = new ListenerLeakError(
|
|
52761
|
+
const error = new ListenerLeakError(message2, topStack);
|
|
52549
52762
|
this._errorHandler(error);
|
|
52550
52763
|
}
|
|
52551
52764
|
return () => {
|
|
@@ -52583,15 +52796,15 @@ ${stackTraceFormattedLines.join("\n")}
|
|
|
52583
52796
|
}
|
|
52584
52797
|
};
|
|
52585
52798
|
ListenerLeakError = class extends Error {
|
|
52586
|
-
constructor(
|
|
52587
|
-
super(
|
|
52799
|
+
constructor(message2, stack) {
|
|
52800
|
+
super(message2);
|
|
52588
52801
|
this.name = "ListenerLeakError";
|
|
52589
52802
|
this.stack = stack;
|
|
52590
52803
|
}
|
|
52591
52804
|
};
|
|
52592
52805
|
ListenerRefusalError = class extends Error {
|
|
52593
|
-
constructor(
|
|
52594
|
-
super(
|
|
52806
|
+
constructor(message2, stack) {
|
|
52807
|
+
super(message2);
|
|
52595
52808
|
this.name = "ListenerRefusalError";
|
|
52596
52809
|
this.stack = stack;
|
|
52597
52810
|
}
|
|
@@ -52667,10 +52880,10 @@ ${stackTraceFormattedLines.join("\n")}
|
|
|
52667
52880
|
get event() {
|
|
52668
52881
|
this._event ??= (callback, thisArgs, disposables) => {
|
|
52669
52882
|
if (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {
|
|
52670
|
-
const
|
|
52671
|
-
console.warn(
|
|
52883
|
+
const message2 = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;
|
|
52884
|
+
console.warn(message2);
|
|
52672
52885
|
const tuple = this._leakageMon.getMostFrequentStack() ?? ["UNKNOWN stack", -1];
|
|
52673
|
-
const error = new ListenerRefusalError(`${
|
|
52886
|
+
const error = new ListenerRefusalError(`${message2}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);
|
|
52674
52887
|
const errorHandler2 = this._options?.onListenerError || onUnexpectedError;
|
|
52675
52888
|
errorHandler2(error);
|
|
52676
52889
|
return Disposable.None;
|
|
@@ -53544,33 +53757,33 @@ ${stackTraceFormattedLines.join("\n")}
|
|
|
53544
53757
|
}
|
|
53545
53758
|
}
|
|
53546
53759
|
}
|
|
53547
|
-
_log(type,
|
|
53760
|
+
_log(type, message2, optionalParams) {
|
|
53548
53761
|
this._evalLazyOptionalParams(optionalParams);
|
|
53549
|
-
type.call(console, (this._optionsService.options.logger ? "" : LOG_PREFIX) +
|
|
53762
|
+
type.call(console, (this._optionsService.options.logger ? "" : LOG_PREFIX) + message2, ...optionalParams);
|
|
53550
53763
|
}
|
|
53551
|
-
trace(
|
|
53764
|
+
trace(message2, ...optionalParams) {
|
|
53552
53765
|
if (this._logLevel <= 0) {
|
|
53553
|
-
this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log,
|
|
53766
|
+
this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, message2, optionalParams);
|
|
53554
53767
|
}
|
|
53555
53768
|
}
|
|
53556
|
-
debug(
|
|
53769
|
+
debug(message2, ...optionalParams) {
|
|
53557
53770
|
if (this._logLevel <= 1) {
|
|
53558
|
-
this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log,
|
|
53771
|
+
this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, message2, optionalParams);
|
|
53559
53772
|
}
|
|
53560
53773
|
}
|
|
53561
|
-
info(
|
|
53774
|
+
info(message2, ...optionalParams) {
|
|
53562
53775
|
if (this._logLevel <= 2) {
|
|
53563
|
-
this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info,
|
|
53776
|
+
this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, message2, optionalParams);
|
|
53564
53777
|
}
|
|
53565
53778
|
}
|
|
53566
|
-
warn(
|
|
53779
|
+
warn(message2, ...optionalParams) {
|
|
53567
53780
|
if (this._logLevel <= 3) {
|
|
53568
|
-
this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn,
|
|
53781
|
+
this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, message2, optionalParams);
|
|
53569
53782
|
}
|
|
53570
53783
|
}
|
|
53571
|
-
error(
|
|
53784
|
+
error(message2, ...optionalParams) {
|
|
53572
53785
|
if (this._logLevel <= 4) {
|
|
53573
|
-
this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error,
|
|
53786
|
+
this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, message2, optionalParams);
|
|
53574
53787
|
}
|
|
53575
53788
|
}
|
|
53576
53789
|
};
|
|
@@ -65643,7 +65856,7 @@ var init_terminal_replica_owner = __esm({
|
|
|
65643
65856
|
#leaseIsCurrent(lease, subscriptionEpoch) {
|
|
65644
65857
|
return !this.#disposed && subscriptionEpoch === this.#subscriptionEpoch && this.#layoutLease !== null && this.#layoutLease.epoch === lease.epoch && layoutLeaseEqual(this.#layoutLease, lease);
|
|
65645
65858
|
}
|
|
65646
|
-
#retryReseedOrFault(
|
|
65859
|
+
#retryReseedOrFault(message2, reseed, stage, reason) {
|
|
65647
65860
|
if (this.#disposed || this.#waitingForGeometryCapture) return;
|
|
65648
65861
|
const diagnostic4 = this.#observability.enabled ? {
|
|
65649
65862
|
reason,
|
|
@@ -65667,7 +65880,7 @@ var init_terminal_replica_owner = __esm({
|
|
|
65667
65880
|
} : void 0;
|
|
65668
65881
|
if (this.#reseedRetryCount >= 1) {
|
|
65669
65882
|
this.#noteLifecycle("reseed-exhausted", diagnostic4);
|
|
65670
|
-
const error = new Error(
|
|
65883
|
+
const error = new Error(message2);
|
|
65671
65884
|
this.#interpreter.abort(error);
|
|
65672
65885
|
this.#onFault?.(error);
|
|
65673
65886
|
return;
|
|
@@ -66082,7 +66295,7 @@ function logDeliveryFault(client, reason, cause) {
|
|
|
66082
66295
|
workspace: client.deliveryWorkspaceName
|
|
66083
66296
|
});
|
|
66084
66297
|
}
|
|
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;
|
|
66298
|
+
var MAX_CANONICAL_REVISIONS, MAX_RAW_JOURNAL_BYTES, MAX_REPRESENTATION_CACHE_ENTRIES, MAX_REPRESENTATION_CACHE_BYTES, MAX_CLIENTS, HISTORY_FRAME_MAX_BYTES, 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;
|
|
66086
66299
|
var init_terminal_delivery_hub = __esm({
|
|
66087
66300
|
"packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts"() {
|
|
66088
66301
|
"use strict";
|
|
@@ -66102,6 +66315,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66102
66315
|
MAX_REPRESENTATION_CACHE_ENTRIES = 8;
|
|
66103
66316
|
MAX_REPRESENTATION_CACHE_BYTES = 16 * 1024 * 1024;
|
|
66104
66317
|
MAX_CLIENTS = 64;
|
|
66318
|
+
HISTORY_FRAME_MAX_BYTES = 128 * 1024;
|
|
66105
66319
|
MAX_PANES = 32;
|
|
66106
66320
|
MAX_PENDING_CANONICAL_CELLS = 1e6;
|
|
66107
66321
|
MAX_CONNECTIONS = MAX_CLIENTS * MAX_PANES;
|
|
@@ -66117,11 +66331,13 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66117
66331
|
payload;
|
|
66118
66332
|
};
|
|
66119
66333
|
DeferredSeedEncoding = class extends Error {
|
|
66120
|
-
constructor(payload) {
|
|
66334
|
+
constructor(payload, variant = "complete") {
|
|
66121
66335
|
super("Deferred compact seed encoding");
|
|
66122
66336
|
this.payload = payload;
|
|
66337
|
+
this.variant = variant;
|
|
66123
66338
|
}
|
|
66124
66339
|
payload;
|
|
66340
|
+
variant;
|
|
66125
66341
|
};
|
|
66126
66342
|
ExactSemanticRepresentationSelectionError = class extends TerminalDeliveryStateTooLargeError {
|
|
66127
66343
|
selectionObservation;
|
|
@@ -66241,7 +66457,18 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66241
66457
|
lastProjectionReceipt: null,
|
|
66242
66458
|
lastMaterialize: null,
|
|
66243
66459
|
reseedRequired: false,
|
|
66460
|
+
historyUnloadedRows: 0,
|
|
66461
|
+
historyUnloadedDigest: TERMINAL_HISTORY_EMPTY_DIGEST,
|
|
66462
|
+
historyLoadedRows: 0,
|
|
66463
|
+
pendingHistoryRows: null,
|
|
66464
|
+
historyBytesPerRow: null,
|
|
66465
|
+
revisionSinceHistoryRequest: false,
|
|
66244
66466
|
inFlight: null,
|
|
66467
|
+
pipelining: offer.protocolVersions.includes(
|
|
66468
|
+
TERMINAL_DELIVERY_PIPELINING_CAPABILITY_VERSION
|
|
66469
|
+
),
|
|
66470
|
+
pipelined: [],
|
|
66471
|
+
droppedTransactions: /* @__PURE__ */ new Set(),
|
|
66245
66472
|
latestRevision: pane.latest?.update.revision ?? null,
|
|
66246
66473
|
encoding: null,
|
|
66247
66474
|
scheduled: false,
|
|
@@ -66270,6 +66497,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66270
66497
|
projectionReceipt: (receipt) => this.#projectionReceipt(client, receipt),
|
|
66271
66498
|
materialize: (request3) => this.#materialize(client, request3),
|
|
66272
66499
|
nack: (nack) => this.#nack(client, nack),
|
|
66500
|
+
historyRequest: (request3) => this.#historyRequest(client, request3),
|
|
66273
66501
|
prioritize: () => {
|
|
66274
66502
|
if (client.closed) return;
|
|
66275
66503
|
this.#priority.set(client.clientId, client.paneId);
|
|
@@ -66412,7 +66640,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66412
66640
|
),
|
|
66413
66641
|
maxQueueDepth: this.#maxQueueDepth,
|
|
66414
66642
|
inFlightBytes: [...this.#clients.values()].reduce(
|
|
66415
|
-
(sum, client) => sum + (client
|
|
66643
|
+
(sum, client) => sum + this.#unackedBytes(client),
|
|
66416
66644
|
0
|
|
66417
66645
|
)
|
|
66418
66646
|
});
|
|
@@ -66452,6 +66680,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66452
66680
|
this.#cancelEncoding(client);
|
|
66453
66681
|
client.outgoing.length = 0;
|
|
66454
66682
|
client.inFlight = null;
|
|
66683
|
+
client.pipelined.length = 0;
|
|
66455
66684
|
client.budgetHeld = false;
|
|
66456
66685
|
logDeliveryFault(client, "source-closed", "source-restarted");
|
|
66457
66686
|
this.#enqueue(client, {
|
|
@@ -66746,7 +66975,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66746
66975
|
let oldest = now;
|
|
66747
66976
|
for (const other of this.#clients.values())
|
|
66748
66977
|
if (other !== client && other.clientId === client.clientId && other.inFlight) {
|
|
66749
|
-
bytes += other
|
|
66978
|
+
bytes += this.#unackedBytes(other);
|
|
66750
66979
|
oldest = Math.min(oldest, other.inFlight.sentAt);
|
|
66751
66980
|
}
|
|
66752
66981
|
return bytes >= TERMINAL_DELIVERY_CONNECTION_UNACKED_BYTES && now - oldest >= this.#congestedMs;
|
|
@@ -66763,14 +66992,84 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66763
66992
|
this.#schedule(other);
|
|
66764
66993
|
}
|
|
66765
66994
|
}
|
|
66995
|
+
/** Bytes the client has not acknowledged: every flight, pipelined ones included. */
|
|
66996
|
+
#unackedBytes(client) {
|
|
66997
|
+
let bytes = client.inFlight?.envelope.representationBytes ?? 0;
|
|
66998
|
+
for (const flight of client.pipelined) bytes += flight.envelope.representationBytes;
|
|
66999
|
+
return bytes;
|
|
67000
|
+
}
|
|
67001
|
+
/** The revision the client holds once every flight applies (its ACKed baseline if none). */
|
|
67002
|
+
#sentRevision(client) {
|
|
67003
|
+
const newest = client.pipelined.at(-1) ?? client.inFlight;
|
|
67004
|
+
return newest?.envelope.type === "terminal.delivery" && newest.envelope.frame !== "history" ? newest.envelope.canonicalRevision : client.baselineRevision;
|
|
67005
|
+
}
|
|
67006
|
+
/**
|
|
67007
|
+
* Whether another delivery may go out behind the unacknowledged ones. Only
|
|
67008
|
+
* for a client that offers 124, only a visible pane, only behind canonical patches whose chunks have all been
|
|
67009
|
+
* handed to the socket (a client takes one envelope's chunks at a time), and
|
|
67010
|
+
* within TERMINAL_DELIVERY_MAX_PIPELINED and the connection's unacknowledged
|
|
67011
|
+
* byte budget. Seeds, projections, history frames and history requests keep
|
|
67012
|
+
* one delivery in flight.
|
|
67013
|
+
*/
|
|
67014
|
+
#canPipeline(client) {
|
|
67015
|
+
if (!client.pipelining || !client.inFlight || client.pipelined.length + 1 >= TERMINAL_DELIVERY_MAX_PIPELINED || client.visibility !== "visible" || client.reseedRequired || client.materializeRequested || client.pendingHistoryRows !== null || client.encoding || client.negotiated.encoding !== "semantic-v1" && client.negotiated.encoding !== "semantic-compact-v1" && client.negotiated.encoding !== "semantic-binary-v1")
|
|
67016
|
+
return false;
|
|
67017
|
+
for (const flight of [client.inFlight, ...client.pipelined])
|
|
67018
|
+
if (flight.envelope.type !== "terminal.delivery" || flight.projection || flight.envelope.frame !== "patch" || !flight.envelope.canonicalEquivalent || flight.nextChunk < flight.envelope.chunkCount)
|
|
67019
|
+
return false;
|
|
67020
|
+
return this.#unackedBytes(client) < TERMINAL_DELIVERY_CONNECTION_UNACKED_BYTES;
|
|
67021
|
+
}
|
|
67022
|
+
/**
|
|
67023
|
+
* The client as it will be once every flight applies: what its ACKs would
|
|
67024
|
+
* set (see #ack). Representations for a pipelined patch are based on it.
|
|
67025
|
+
*/
|
|
67026
|
+
#pipelineBase(client) {
|
|
67027
|
+
const newest = client.pipelined.at(-1) ?? client.inFlight;
|
|
67028
|
+
const rows = newest.historyRows;
|
|
67029
|
+
return {
|
|
67030
|
+
...client,
|
|
67031
|
+
baselineRevision: newest.envelope.canonicalRevision,
|
|
67032
|
+
baselineHash: newest.envelope.canonicalStateHash,
|
|
67033
|
+
projectionBaseline: null,
|
|
67034
|
+
lastProjectionReceipt: null,
|
|
67035
|
+
reseedRequired: false,
|
|
67036
|
+
...rows ? {
|
|
67037
|
+
historyUnloadedRows: rows.unloaded,
|
|
67038
|
+
historyUnloadedDigest: rows.digest,
|
|
67039
|
+
historyLoadedRows: rows.loaded
|
|
67040
|
+
} : {}
|
|
67041
|
+
};
|
|
67042
|
+
}
|
|
67043
|
+
/** A patch on `base`'s projected state, or null when only a seed (or an encoding job) would do. */
|
|
67044
|
+
#pipelinedRepresentation(base2, pane, target) {
|
|
67045
|
+
if (target.update.type !== "terminal.patch" || target.update.revision <= base2.baselineRevision || pane.revisions.get(base2.baselineRevision)?.update.incarnation !== target.update.incarnation)
|
|
67046
|
+
return null;
|
|
67047
|
+
const reseeds = this.#reseeds;
|
|
67048
|
+
try {
|
|
67049
|
+
const representation = this.#representation(base2, pane, target);
|
|
67050
|
+
if (representation.frame === "patch" && representation.canonicalEquivalent && !representation.projection)
|
|
67051
|
+
return representation;
|
|
67052
|
+
} catch (error) {
|
|
67053
|
+
if (!(error instanceof DeferredSeedEncoding || error instanceof DeferredProjectionEncoding))
|
|
67054
|
+
throw error;
|
|
67055
|
+
}
|
|
67056
|
+
this.#reseeds = reseeds;
|
|
67057
|
+
return null;
|
|
67058
|
+
}
|
|
67059
|
+
/** Flights behind a NACKed or faulted one: the client gets a reseed; their feedback is inert. */
|
|
67060
|
+
#dropPipelined(client) {
|
|
67061
|
+
for (const flight of client.pipelined)
|
|
67062
|
+
client.droppedTransactions.add(flight.envelope.transactionId);
|
|
67063
|
+
client.pipelined.length = 0;
|
|
67064
|
+
}
|
|
66766
67065
|
#schedule(client) {
|
|
66767
|
-
if (client.closed || client.captureUnavailable || client.inFlight || client.encoding || client.latestRevision === null || client.latestRevision === client.
|
|
67066
|
+
if (client.closed || client.captureUnavailable || client.inFlight && !this.#canPipeline(client) || client.encoding || (client.latestRevision === null || client.latestRevision === this.#sentRevision(client)) && client.pendingHistoryRows === null || client.visibility === "hidden" || client.visibility === "frozen")
|
|
66768
67067
|
return;
|
|
66769
67068
|
if (client.visibility === "background") {
|
|
66770
67069
|
if (client.backgroundTimer) return;
|
|
66771
67070
|
client.backgroundTimer = this.#scheduler.timer(() => {
|
|
66772
67071
|
client.backgroundTimer = null;
|
|
66773
|
-
if (!client.closed && !client.inFlight && client.latestRevision !== null)
|
|
67072
|
+
if (!client.closed && !client.inFlight && (client.latestRevision !== null || client.pendingHistoryRows !== null))
|
|
66774
67073
|
this.#deliver(client);
|
|
66775
67074
|
}, BACKGROUND_CADENCE_MS);
|
|
66776
67075
|
return;
|
|
@@ -66779,29 +67078,22 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66779
67078
|
client.scheduled = true;
|
|
66780
67079
|
this.#scheduler.microtask(() => {
|
|
66781
67080
|
client.scheduled = false;
|
|
66782
|
-
if (!client.closed && client.visibility === "visible" && !client.inFlight)
|
|
67081
|
+
if (!client.closed && client.visibility === "visible" && (!client.inFlight || this.#canPipeline(client)))
|
|
66783
67082
|
this.#deliver(client);
|
|
66784
67083
|
});
|
|
66785
67084
|
}
|
|
66786
67085
|
#deliver(client, completed) {
|
|
66787
67086
|
const pane = this.#panes.get(client.paneId);
|
|
66788
|
-
|
|
66789
|
-
|
|
66790
|
-
|
|
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);
|
|
67087
|
+
if (!completed && pane && this.#historyDue(client)) {
|
|
67088
|
+
if (this.#holdForBudget(client)) return;
|
|
67089
|
+
this.#deliverHistory(client, pane);
|
|
66800
67090
|
return;
|
|
66801
67091
|
}
|
|
66802
|
-
|
|
66803
|
-
client.
|
|
66804
|
-
client.
|
|
67092
|
+
const target = completed?.target ?? pane?.latest;
|
|
67093
|
+
const pipelining = !completed && client.inFlight !== null;
|
|
67094
|
+
if (!pane || !target || client.closed || client.captureUnavailable || client.inFlight && (completed || !this.#canPipeline(client)) || client.encoding || client.visibility === "hidden" || client.visibility === "frozen" || !completed && target.update.revision !== client.latestRevision)
|
|
67095
|
+
return;
|
|
67096
|
+
if (!completed && this.#holdForBudget(client)) return;
|
|
66805
67097
|
const traceStarted = completed?.traceStarted ?? (this.#observability.enabled ? this.#observability.nowMicros() : 0);
|
|
66806
67098
|
let deferred = false;
|
|
66807
67099
|
let encodedRepresentation = null;
|
|
@@ -66809,7 +67101,12 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66809
67101
|
let deliveryEnvelope = null;
|
|
66810
67102
|
let deliveryOrdinal = null;
|
|
66811
67103
|
try {
|
|
66812
|
-
const
|
|
67104
|
+
const base2 = pipelining ? this.#pipelineBase(client) : client;
|
|
67105
|
+
const representation = pipelining ? this.#pipelinedRepresentation(base2, pane, target) : this.#representation(client, pane, target, completed?.outcome);
|
|
67106
|
+
if (!representation) {
|
|
67107
|
+
deferred = true;
|
|
67108
|
+
return;
|
|
67109
|
+
}
|
|
66813
67110
|
encodedRepresentation = representation;
|
|
66814
67111
|
const transactionId = this.#scheduler.createId();
|
|
66815
67112
|
const chunkCount = Math.max(1, Math.ceil(representation.bytes.byteLength / (256 * 1024)));
|
|
@@ -66826,7 +67123,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66826
67123
|
protocolVersion: 1,
|
|
66827
67124
|
encoding: representation.encoding ?? client.negotiated.encoding,
|
|
66828
67125
|
frame: representation.frame,
|
|
66829
|
-
baseRevision: representation.projection ? representation.projectionBaseRevision : representation.frame === "seed" ? null : Math.max(0,
|
|
67126
|
+
baseRevision: representation.projection ? representation.projectionBaseRevision : representation.frame === "seed" ? null : Math.max(0, base2.baselineRevision),
|
|
66830
67127
|
canonicalRevision: target.update.revision,
|
|
66831
67128
|
canonicalStateHash: target.update.stateHash,
|
|
66832
67129
|
representationHash: representation.representationHash ?? hashTerminalDeliveryRepresentation(representation.bytes),
|
|
@@ -66834,19 +67131,24 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66834
67131
|
chunkCount,
|
|
66835
67132
|
canonicalEquivalent: representation.canonicalEquivalent,
|
|
66836
67133
|
history: representation.history,
|
|
67134
|
+
...representation.historyUnloaded ? { historyUnloaded: representation.historyUnloaded } : {},
|
|
66837
67135
|
richPlacements: client.negotiated.richPlacements
|
|
66838
67136
|
});
|
|
66839
67137
|
deliveryEnvelope = envelope;
|
|
66840
67138
|
deliveryOrdinal = ++this.#deliveryOrdinal;
|
|
66841
67139
|
registerTerminalDeliveryObservationOrdinal(envelope, deliveryOrdinal);
|
|
66842
|
-
client.
|
|
67140
|
+
if (client.pendingHistoryRows !== null) client.revisionSinceHistoryRequest = true;
|
|
67141
|
+
const flight = {
|
|
66843
67142
|
envelope,
|
|
66844
67143
|
projection: representation.projection ?? null,
|
|
67144
|
+
historyRows: representation.historyRows ?? null,
|
|
66845
67145
|
deliveryOrdinal,
|
|
66846
67146
|
bytes: representation.bytes,
|
|
66847
67147
|
nextChunk: 0,
|
|
66848
67148
|
sentAt: this.#scheduler.nowMs()
|
|
66849
67149
|
};
|
|
67150
|
+
if (pipelining) client.pipelined.push(flight);
|
|
67151
|
+
else client.inFlight = flight;
|
|
66850
67152
|
this.#enqueue(client, envelope);
|
|
66851
67153
|
this.#recordDeliveryStatus(client, pane);
|
|
66852
67154
|
if (target.trace?.traceId === pane.pendingDeliveryTrace?.traceId)
|
|
@@ -66860,7 +67162,8 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66860
67162
|
target,
|
|
66861
67163
|
error.payload,
|
|
66862
67164
|
traceStarted,
|
|
66863
|
-
error instanceof DeferredProjectionEncoding
|
|
67165
|
+
error instanceof DeferredProjectionEncoding,
|
|
67166
|
+
error instanceof DeferredSeedEncoding ? error.variant : "complete"
|
|
66864
67167
|
);
|
|
66865
67168
|
return;
|
|
66866
67169
|
}
|
|
@@ -66919,7 +67222,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66919
67222
|
}
|
|
66920
67223
|
}
|
|
66921
67224
|
}
|
|
66922
|
-
#startEncoding(client, pane, target, payload, traceStarted, projection = false) {
|
|
67225
|
+
#startEncoding(client, pane, target, payload, traceStarted, projection = false, variant = "complete") {
|
|
66923
67226
|
const key2 = cacheKey([
|
|
66924
67227
|
target.update.workspaceName,
|
|
66925
67228
|
client.paneId,
|
|
@@ -66929,7 +67232,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66929
67232
|
target.update.stateHash,
|
|
66930
67233
|
client.negotiated.encoding,
|
|
66931
67234
|
client.negotiated.richPlacements ? "rich" : "plain",
|
|
66932
|
-
projection ? `projection:${client.projectionBaseline?.revision ?? -1}:${client.projectionBaseline?.hash ?? "none"}` :
|
|
67235
|
+
projection ? `projection:${client.projectionBaseline?.revision ?? -1}:${client.projectionBaseline?.hash ?? "none"}` : variant
|
|
66933
67236
|
]);
|
|
66934
67237
|
let job = this.#pendingEncodings.get(key2);
|
|
66935
67238
|
let created = false;
|
|
@@ -66959,6 +67262,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66959
67262
|
baselineRevision: client.baselineRevision,
|
|
66960
67263
|
baselineHash: client.baselineHash,
|
|
66961
67264
|
reseedRequired: client.reseedRequired,
|
|
67265
|
+
historyUnloadedRows: client.historyUnloadedRows,
|
|
66962
67266
|
traceStarted
|
|
66963
67267
|
};
|
|
66964
67268
|
owned.clients.add(client);
|
|
@@ -66998,7 +67302,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
66998
67302
|
const encoding = client.encoding;
|
|
66999
67303
|
if (!encoding || encoding.job !== job) continue;
|
|
67000
67304
|
client.encoding = null;
|
|
67001
|
-
if (job.abort.signal.aborted || this.#closed || client.closed || this.#clients.get(client.key) !== client || this.#panes.get(client.paneId) !== job.pane || client.baselineRevision !== encoding.baselineRevision || client.baselineHash !== encoding.baselineHash || client.reseedRequired !== encoding.reseedRequired || client.inFlight || client.visibility === "hidden" || client.visibility === "frozen" || job.pane.latest?.update.incarnation !== encoding.target.update.incarnation)
|
|
67305
|
+
if (job.abort.signal.aborted || this.#closed || client.closed || this.#clients.get(client.key) !== client || this.#panes.get(client.paneId) !== job.pane || client.baselineRevision !== encoding.baselineRevision || client.baselineHash !== encoding.baselineHash || client.reseedRequired !== encoding.reseedRequired || client.historyUnloadedRows !== encoding.historyUnloadedRows || client.inFlight || client.visibility === "hidden" || client.visibility === "frozen" || job.pane.latest?.update.incarnation !== encoding.target.update.incarnation)
|
|
67002
67306
|
continue;
|
|
67003
67307
|
this.#deliver(client, {
|
|
67004
67308
|
target: encoding.target,
|
|
@@ -67042,6 +67346,8 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67042
67346
|
projectionBaseRevision: payload.frame === "seed" ? null : payload.baseRevision
|
|
67043
67347
|
};
|
|
67044
67348
|
}
|
|
67349
|
+
if (client.negotiated.partialHistory === "tail-v1" && target.state.snapshot)
|
|
67350
|
+
return this.#partialRepresentation(client, pane, target, seedOutcome);
|
|
67045
67351
|
const key2 = cacheKey([
|
|
67046
67352
|
target.update.workspaceName,
|
|
67047
67353
|
target.update.semanticPaneId,
|
|
@@ -67343,6 +67649,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67343
67649
|
#ack(client, input) {
|
|
67344
67650
|
const ack = TerminalDeliveryAckSchemaZ.parse(input);
|
|
67345
67651
|
const flight = client.inFlight;
|
|
67652
|
+
if (client.droppedTransactions.has(ack.transactionId)) return;
|
|
67346
67653
|
if (!flight) {
|
|
67347
67654
|
if (client.lastAck && JSON.stringify(client.lastAck) === JSON.stringify(ack)) return;
|
|
67348
67655
|
const closed = client.sourceClosedFlight;
|
|
@@ -67369,7 +67676,14 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67369
67676
|
client.baselineRevision = ack.canonicalRevision;
|
|
67370
67677
|
client.baselineHash = ack.canonicalStateHash;
|
|
67371
67678
|
client.reseedRequired = false;
|
|
67372
|
-
|
|
67679
|
+
if (flight.historyRows) {
|
|
67680
|
+
client.historyUnloadedRows = flight.historyRows.unloaded;
|
|
67681
|
+
client.historyUnloadedDigest = flight.historyRows.digest;
|
|
67682
|
+
client.historyLoadedRows = flight.historyRows.loaded;
|
|
67683
|
+
this.#pushHistoryTail(client);
|
|
67684
|
+
}
|
|
67685
|
+
client.inFlight = client.pipelined.shift() ?? null;
|
|
67686
|
+
client.droppedTransactions.clear();
|
|
67373
67687
|
this.#releaseBudget(client.clientId);
|
|
67374
67688
|
client.lastAck = ack;
|
|
67375
67689
|
if (client.latestRevision === ack.canonicalRevision) client.latestRevision = null;
|
|
@@ -67420,6 +67734,234 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67420
67734
|
this.#schedule(client);
|
|
67421
67735
|
this.#recordDeliveryStatus(client, this.#panes.get(client.paneId));
|
|
67422
67736
|
}
|
|
67737
|
+
/**
|
|
67738
|
+
* Capability 122: the client's partial view of `target`. Its unloaded rows
|
|
67739
|
+
* follow the baseline's (a trim takes unloaded rows first); a seed carries
|
|
67740
|
+
* the newest TERMINAL_DELIVERY_HISTORY_TAIL_ROWS rows (none on the alternate
|
|
67741
|
+
* screen) or, after a reseed, as many rows as the client held. The full
|
|
67742
|
+
* canonical hash still verifies: the commitment covers the rest.
|
|
67743
|
+
*/
|
|
67744
|
+
#partialRepresentation(client, pane, target, seedOutcome) {
|
|
67745
|
+
const full = target.state.snapshot;
|
|
67746
|
+
const baselineRecord = client.reseedRequired || client.baselineRevision < 0 ? void 0 : pane.revisions.get(client.baselineRevision);
|
|
67747
|
+
const baselineFull = baselineRecord?.state.snapshot ?? null;
|
|
67748
|
+
const tail = full.modes.alternateScreen ? 0 : TERMINAL_DELIVERY_HISTORY_TAIL_ROWS;
|
|
67749
|
+
const loadedDepth = () => Math.max(
|
|
67750
|
+
0,
|
|
67751
|
+
full.history.length - Math.max(tail, client.baselineRevision >= 0 ? client.historyLoadedRows : 0)
|
|
67752
|
+
);
|
|
67753
|
+
let unloadedRows;
|
|
67754
|
+
let unloaded = null;
|
|
67755
|
+
let baseline = null;
|
|
67756
|
+
if (baselineFull && baselineRecord.update.incarnation === target.update.incarnation) {
|
|
67757
|
+
baseline = client.historyUnloadedRows === 0 ? baselineFull : { ...baselineFull, history: baselineFull.history.slice(client.historyUnloadedRows) };
|
|
67758
|
+
const trim = historyTrim(baselineFull.history, full.history);
|
|
67759
|
+
const kept = Math.max(0, client.historyUnloadedRows - trim);
|
|
67760
|
+
let same7 = kept <= full.history.length;
|
|
67761
|
+
for (let index = 0; same7 && index < kept; index++)
|
|
67762
|
+
if (baselineFull.history[trim + index] !== full.history[index]) same7 = false;
|
|
67763
|
+
if (same7) {
|
|
67764
|
+
unloadedRows = kept;
|
|
67765
|
+
const before = { rows: client.historyUnloadedRows, digest: client.historyUnloadedDigest };
|
|
67766
|
+
unloaded = trim === 0 ? before : dropTerminalHistoryCommitmentPrefix(
|
|
67767
|
+
before,
|
|
67768
|
+
baselineFull.history.slice(0, Math.min(trim, client.historyUnloadedRows))
|
|
67769
|
+
);
|
|
67770
|
+
} else {
|
|
67771
|
+
unloadedRows = loadedDepth();
|
|
67772
|
+
baseline = null;
|
|
67773
|
+
}
|
|
67774
|
+
} else {
|
|
67775
|
+
unloadedRows = loadedDepth();
|
|
67776
|
+
}
|
|
67777
|
+
const partial = unloadedRows === 0 ? full : { ...full, history: full.history.slice(unloadedRows) };
|
|
67778
|
+
const view = unloadedRows === 0 && client.historyUnloadedRows === 0 ? target : {
|
|
67779
|
+
...target,
|
|
67780
|
+
state: { ...target.state, snapshot: partial },
|
|
67781
|
+
update: { ...target.update, type: "terminal.seed" }
|
|
67782
|
+
};
|
|
67783
|
+
const payload = baseline ? semanticPayload(client.baselineRevision, baseline, view, baselineRecord.update.incarnation) : semanticSeed(view);
|
|
67784
|
+
const encode = (value) => {
|
|
67785
|
+
if (value.frame === "seed" && (client.negotiated.encoding === "semantic-binary-v1" || terminalSemanticUpdateNeedsCooperativeEncoding(value))) {
|
|
67786
|
+
if (!seedOutcome) throw new DeferredSeedEncoding(value, `partial:${unloadedRows}`);
|
|
67787
|
+
if ("error" in seedOutcome) throw seedOutcome.error;
|
|
67788
|
+
return seedOutcome.bytes;
|
|
67789
|
+
}
|
|
67790
|
+
return client.negotiated.encoding === "semantic-binary-v1" ? encodeBinarySemanticTerminalUpdate(value) : encodeCompactSemanticTerminalUpdate(value);
|
|
67791
|
+
};
|
|
67792
|
+
let frame = payload.frame;
|
|
67793
|
+
let bytes;
|
|
67794
|
+
try {
|
|
67795
|
+
bytes = encode(payload);
|
|
67796
|
+
} catch (error) {
|
|
67797
|
+
if (!(error instanceof TerminalDeliveryStateTooLargeError) || payload.frame !== "patch")
|
|
67798
|
+
throw error;
|
|
67799
|
+
frame = "seed";
|
|
67800
|
+
bytes = encode(semanticSeed(view));
|
|
67801
|
+
}
|
|
67802
|
+
if (frame === "seed") this.#reseeds += client.reseedRequired ? 1 : 0;
|
|
67803
|
+
const commitment = unloaded ?? terminalHistoryPrefixCommitment(full.history, unloadedRows);
|
|
67804
|
+
return {
|
|
67805
|
+
bytes,
|
|
67806
|
+
encoding: client.negotiated.encoding,
|
|
67807
|
+
frame,
|
|
67808
|
+
canonicalEquivalent: true,
|
|
67809
|
+
history: "partial",
|
|
67810
|
+
historyUnloaded: commitment,
|
|
67811
|
+
historyRows: {
|
|
67812
|
+
unloaded: unloadedRows,
|
|
67813
|
+
digest: commitment.digest,
|
|
67814
|
+
loaded: full.history.length - unloadedRows
|
|
67815
|
+
}
|
|
67816
|
+
};
|
|
67817
|
+
}
|
|
67818
|
+
/** Hold the client while its connection's other panes are congested; true if held. */
|
|
67819
|
+
#holdForBudget(client) {
|
|
67820
|
+
if (this.#overBudget(client)) {
|
|
67821
|
+
client.budgetHeld = true;
|
|
67822
|
+
client.budgetHeldSince ??= this.#scheduler.nowMs();
|
|
67823
|
+
client.budgetTimer ??= this.#scheduler.timer(() => {
|
|
67824
|
+
client.budgetTimer = null;
|
|
67825
|
+
if (client.closed || !client.budgetHeld) return;
|
|
67826
|
+
client.budgetHeld = false;
|
|
67827
|
+
this.#schedule(client);
|
|
67828
|
+
}, this.#holdMs);
|
|
67829
|
+
return true;
|
|
67830
|
+
}
|
|
67831
|
+
client.budgetHeldSince = null;
|
|
67832
|
+
client.budgetTimer?.cancel();
|
|
67833
|
+
client.budgetTimer = null;
|
|
67834
|
+
return false;
|
|
67835
|
+
}
|
|
67836
|
+
/** Capability 122: a history frame goes next if asked for and no newer output waits (or one just went). */
|
|
67837
|
+
#historyDue(client) {
|
|
67838
|
+
return client.pendingHistoryRows !== null && !client.inFlight && !client.encoding && client.baselineRevision >= 0 && !client.reseedRequired && (client.latestRevision === null || client.latestRevision === client.baselineRevision || client.revisionSinceHistoryRequest) && // Live output of another pane held by the connection's budget goes first.
|
|
67839
|
+
![...this.#clients.values()].some(
|
|
67840
|
+
(other) => other !== client && other.clientId === client.clientId && other.budgetHeld
|
|
67841
|
+
);
|
|
67842
|
+
}
|
|
67843
|
+
#deliverHistory(client, pane) {
|
|
67844
|
+
const asked = client.pendingHistoryRows;
|
|
67845
|
+
client.pendingHistoryRows = null;
|
|
67846
|
+
client.revisionSinceHistoryRequest = false;
|
|
67847
|
+
const record2 = pane.revisions.get(client.baselineRevision);
|
|
67848
|
+
const full = record2?.state.snapshot;
|
|
67849
|
+
if (!record2 || !full || client.historyUnloadedRows === 0) {
|
|
67850
|
+
this.#schedule(client);
|
|
67851
|
+
return;
|
|
67852
|
+
}
|
|
67853
|
+
const encoding = client.negotiated.encoding;
|
|
67854
|
+
const unloadedRows = client.historyUnloadedRows;
|
|
67855
|
+
try {
|
|
67856
|
+
const limit = Math.max(1, Math.min(asked, unloadedRows));
|
|
67857
|
+
const encode = (count2) => {
|
|
67858
|
+
const rows2 = full.history.slice(unloadedRows - count2, unloadedRows);
|
|
67859
|
+
const bytes2 = encodeSemanticTerminalHistory(
|
|
67860
|
+
{ frame: "history", revision: record2.update.revision, rows: rows2 },
|
|
67861
|
+
encoding
|
|
67862
|
+
);
|
|
67863
|
+
return { count: count2, rows: rows2, bytes: bytes2 };
|
|
67864
|
+
};
|
|
67865
|
+
const fit = (bytesPerRow) => Math.max(
|
|
67866
|
+
1,
|
|
67867
|
+
Math.min(limit, Math.floor(HISTORY_FRAME_MAX_BYTES * 0.95 / Math.max(1, bytesPerRow)))
|
|
67868
|
+
);
|
|
67869
|
+
let frame = client.historyBytesPerRow === null ? encode(Math.min(limit, 32)) : null;
|
|
67870
|
+
const estimate = client.historyBytesPerRow ?? frame.bytes.byteLength / frame.count;
|
|
67871
|
+
if (!frame || fit(estimate) !== frame.count) frame = encode(fit(estimate));
|
|
67872
|
+
if (frame.count < limit && frame.bytes.byteLength < HISTORY_FRAME_MAX_BYTES * 0.6) {
|
|
67873
|
+
const grown = fit(frame.bytes.byteLength / frame.count);
|
|
67874
|
+
if (grown > frame.count) frame = encode(grown);
|
|
67875
|
+
}
|
|
67876
|
+
let { count, rows, bytes } = frame;
|
|
67877
|
+
while (bytes.byteLength > HISTORY_FRAME_MAX_BYTES && count > 1) {
|
|
67878
|
+
count = Math.max(
|
|
67879
|
+
1,
|
|
67880
|
+
Math.min(
|
|
67881
|
+
count - 1,
|
|
67882
|
+
Math.floor(count * HISTORY_FRAME_MAX_BYTES * 0.9 / bytes.byteLength)
|
|
67883
|
+
)
|
|
67884
|
+
);
|
|
67885
|
+
({ rows, bytes } = encode(count));
|
|
67886
|
+
}
|
|
67887
|
+
client.historyBytesPerRow = bytes.byteLength / count;
|
|
67888
|
+
const chunk = {
|
|
67889
|
+
rows,
|
|
67890
|
+
unloaded: popTerminalHistoryCommitmentSuffix(
|
|
67891
|
+
{ rows: unloadedRows, digest: client.historyUnloadedDigest },
|
|
67892
|
+
rows
|
|
67893
|
+
)
|
|
67894
|
+
};
|
|
67895
|
+
const envelope = TerminalDeliveryEnvelopeSchemaZ.parse({
|
|
67896
|
+
type: "terminal.delivery",
|
|
67897
|
+
workspaceName: client.deliveryWorkspaceName,
|
|
67898
|
+
semanticPaneId: record2.update.semanticPaneId,
|
|
67899
|
+
generation: record2.update.generation,
|
|
67900
|
+
incarnation: record2.update.incarnation,
|
|
67901
|
+
deliveryNonce: client.negotiated.deliveryNonce,
|
|
67902
|
+
transactionId: this.#scheduler.createId(),
|
|
67903
|
+
protocolVersion: 1,
|
|
67904
|
+
encoding,
|
|
67905
|
+
frame: "history",
|
|
67906
|
+
baseRevision: record2.update.revision,
|
|
67907
|
+
canonicalRevision: record2.update.revision,
|
|
67908
|
+
canonicalStateHash: record2.update.stateHash,
|
|
67909
|
+
representationHash: hashTerminalDeliveryRepresentation(bytes),
|
|
67910
|
+
representationBytes: bytes.byteLength,
|
|
67911
|
+
chunkCount: Math.max(1, Math.ceil(bytes.byteLength / (256 * 1024))),
|
|
67912
|
+
canonicalEquivalent: true,
|
|
67913
|
+
history: "partial",
|
|
67914
|
+
historyUnloaded: chunk.unloaded,
|
|
67915
|
+
richPlacements: client.negotiated.richPlacements
|
|
67916
|
+
});
|
|
67917
|
+
const deliveryOrdinal = ++this.#deliveryOrdinal;
|
|
67918
|
+
registerTerminalDeliveryObservationOrdinal(envelope, deliveryOrdinal);
|
|
67919
|
+
client.inFlight = {
|
|
67920
|
+
envelope,
|
|
67921
|
+
projection: null,
|
|
67922
|
+
historyRows: {
|
|
67923
|
+
unloaded: chunk.unloaded.rows,
|
|
67924
|
+
digest: chunk.unloaded.digest,
|
|
67925
|
+
loaded: full.history.length - chunk.unloaded.rows
|
|
67926
|
+
},
|
|
67927
|
+
deliveryOrdinal,
|
|
67928
|
+
bytes,
|
|
67929
|
+
nextChunk: 0,
|
|
67930
|
+
sentAt: this.#scheduler.nowMs()
|
|
67931
|
+
};
|
|
67932
|
+
this.#enqueue(client, envelope);
|
|
67933
|
+
this.#recordDeliveryStatus(client, pane);
|
|
67934
|
+
} catch (error) {
|
|
67935
|
+
this.#fault(
|
|
67936
|
+
client,
|
|
67937
|
+
error instanceof TerminalDeliveryStateTooLargeError ? "state-too-large" : "protocol-violation",
|
|
67938
|
+
error instanceof Error ? error.message : String(error)
|
|
67939
|
+
);
|
|
67940
|
+
}
|
|
67941
|
+
}
|
|
67942
|
+
/** Back on the normal screen with less than the tail loaded: send the tail unasked. */
|
|
67943
|
+
#pushHistoryTail(client) {
|
|
67944
|
+
if (client.pendingHistoryRows !== null || client.historyUnloadedRows === 0) return;
|
|
67945
|
+
const full = this.#panes.get(client.paneId)?.revisions.get(client.baselineRevision)?.state.snapshot;
|
|
67946
|
+
if (!full || full.modes.alternateScreen) return;
|
|
67947
|
+
if (client.historyLoadedRows >= TERMINAL_DELIVERY_HISTORY_TAIL_ROWS) return;
|
|
67948
|
+
client.pendingHistoryRows = Math.min(
|
|
67949
|
+
client.historyUnloadedRows,
|
|
67950
|
+
TERMINAL_DELIVERY_HISTORY_TAIL_ROWS - client.historyLoadedRows
|
|
67951
|
+
);
|
|
67952
|
+
client.revisionSinceHistoryRequest = false;
|
|
67953
|
+
}
|
|
67954
|
+
#historyRequest(client, input) {
|
|
67955
|
+
if (client.closed) return;
|
|
67956
|
+
const parsed = TerminalDeliveryHistoryRequestSchemaZ.safeParse(input);
|
|
67957
|
+
if (!parsed.success || client.negotiated.partialHistory !== "tail-v1" || parsed.data.workspaceName !== client.deliveryWorkspaceName || parsed.data.semanticPaneId !== client.paneId || parsed.data.generation !== client.negotiated.generation || parsed.data.deliveryNonce !== client.negotiated.deliveryNonce) {
|
|
67958
|
+
this.#fault(client, "protocol-violation", "History request does not identify this delivery");
|
|
67959
|
+
return;
|
|
67960
|
+
}
|
|
67961
|
+
client.pendingHistoryRows = parsed.data.maxRows;
|
|
67962
|
+
client.revisionSinceHistoryRequest = false;
|
|
67963
|
+
this.#schedule(client);
|
|
67964
|
+
}
|
|
67423
67965
|
#projectionReceipt(client, input) {
|
|
67424
67966
|
const receipt = TerminalProjectionReceiptSchemaZ.parse(input);
|
|
67425
67967
|
if (client.lastProjectionReceipt && JSON.stringify(client.lastProjectionReceipt) === JSON.stringify(receipt))
|
|
@@ -67470,6 +68012,7 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67470
68012
|
const closed = client.sourceClosedFlight;
|
|
67471
68013
|
if (client.captureUnavailable && !client.inFlight && closed && nack.workspaceName === closed.workspaceName && nack.semanticPaneId === closed.semanticPaneId && nack.generation === closed.generation && nack.incarnation === closed.incarnation && nack.deliveryNonce === closed.deliveryNonce && nack.transactionId === closed.transactionId)
|
|
67472
68014
|
return;
|
|
68015
|
+
if (nack.transactionId !== null && client.droppedTransactions.has(nack.transactionId)) return;
|
|
67473
68016
|
const envelope = client.inFlight?.envelope;
|
|
67474
68017
|
if (!envelope || nack.workspaceName !== envelope.workspaceName || nack.semanticPaneId !== envelope.semanticPaneId || nack.generation !== envelope.generation || nack.incarnation !== envelope.incarnation || nack.deliveryNonce !== envelope.deliveryNonce || nack.transactionId !== envelope.transactionId) {
|
|
67475
68018
|
this.#fault(client, "protocol-violation", "NACK does not identify the in-flight delivery");
|
|
@@ -67478,12 +68021,13 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67478
68021
|
this.#nacks += 1;
|
|
67479
68022
|
client.reseedRequired = true;
|
|
67480
68023
|
client.inFlight = null;
|
|
68024
|
+
this.#dropPipelined(client);
|
|
67481
68025
|
this.#releaseBudget(client.clientId);
|
|
67482
68026
|
this.#pruneCanonicalRevisions(client.paneId);
|
|
67483
68027
|
this.#schedule(client);
|
|
67484
68028
|
this.#recordDeliveryStatus(client, this.#panes.get(client.paneId));
|
|
67485
68029
|
}
|
|
67486
|
-
#fault(client, reason,
|
|
68030
|
+
#fault(client, reason, message2, selectionObservation = null) {
|
|
67487
68031
|
logDeliveryFault(client, reason);
|
|
67488
68032
|
if (this.#observability.enabled)
|
|
67489
68033
|
try {
|
|
@@ -67524,11 +68068,12 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67524
68068
|
client.outgoing.length = 0;
|
|
67525
68069
|
if (reason === "source-closed") client.sourceClosedFlight = client.inFlight?.envelope ?? null;
|
|
67526
68070
|
client.inFlight = null;
|
|
68071
|
+
this.#dropPipelined(client);
|
|
67527
68072
|
this.#releaseBudget(client.clientId);
|
|
67528
68073
|
const fault = {
|
|
67529
68074
|
type: "terminal.delivery.fault",
|
|
67530
68075
|
reason,
|
|
67531
|
-
message:
|
|
68076
|
+
message: message2.slice(0, 1024),
|
|
67532
68077
|
deliveryNonce: client.negotiated.deliveryNonce
|
|
67533
68078
|
};
|
|
67534
68079
|
if (reason === "source-closed" && client.sending) {
|
|
@@ -67541,8 +68086,8 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67541
68086
|
this.#enqueue(client, fault);
|
|
67542
68087
|
client.retireAfterDrain = true;
|
|
67543
68088
|
}
|
|
67544
|
-
#enqueue(client,
|
|
67545
|
-
this.#enqueueFactory(client, () =>
|
|
68089
|
+
#enqueue(client, message2) {
|
|
68090
|
+
this.#enqueueFactory(client, () => message2);
|
|
67546
68091
|
}
|
|
67547
68092
|
#enqueueFactory(client, create) {
|
|
67548
68093
|
if (client.closed) return;
|
|
@@ -67555,10 +68100,12 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67555
68100
|
while (!client.closed) {
|
|
67556
68101
|
const queued = client.outgoing.shift();
|
|
67557
68102
|
let next = queued?.();
|
|
67558
|
-
const flight = client.inFlight;
|
|
68103
|
+
const flight = client.pipelined.at(-1) ?? client.inFlight;
|
|
67559
68104
|
if (!next && flight && flight.nextChunk < flight.envelope.chunkCount) {
|
|
67560
68105
|
const index = flight.nextChunk;
|
|
67561
68106
|
flight.nextChunk += 1;
|
|
68107
|
+
if (flight.nextChunk === flight.envelope.chunkCount && client.latestRevision !== null)
|
|
68108
|
+
this.#schedule(client);
|
|
67562
68109
|
next = {
|
|
67563
68110
|
type: "terminal.delivery.chunk",
|
|
67564
68111
|
transactionId: flight.envelope.transactionId,
|
|
@@ -67734,8 +68281,9 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67734
68281
|
reachable.add(client.baselineRevision);
|
|
67735
68282
|
const encoding = client.encoding?.target.update;
|
|
67736
68283
|
if (encoding?.incarnation === latest.incarnation) reachable.add(encoding.revision);
|
|
67737
|
-
const flight
|
|
67738
|
-
|
|
68284
|
+
for (const flight of [client.inFlight, ...client.pipelined])
|
|
68285
|
+
if (flight?.envelope.incarnation === latest.incarnation)
|
|
68286
|
+
reachable.add(flight.envelope.canonicalRevision);
|
|
67739
68287
|
}
|
|
67740
68288
|
for (const revision of pane.revisions.keys())
|
|
67741
68289
|
if (!reachable.has(revision)) {
|
|
@@ -67750,7 +68298,9 @@ var init_terminal_delivery_hub = __esm({
|
|
|
67750
68298
|
for (const [key2, cached2] of this.#cache) {
|
|
67751
68299
|
if (cached2.cachePaneId !== paneId) continue;
|
|
67752
68300
|
const reachable = clients.some(
|
|
67753
|
-
(candidate) => cached2.cacheBaseRevision === candidate.baselineRevision || Number.isSafeInteger(cached2.cacheTargetRevision) && cached2.cacheTargetRevision > candidate.baselineRevision || cached2.cacheTargetRevision === candidate.inFlight?.envelope.canonicalRevision
|
|
68301
|
+
(candidate) => cached2.cacheBaseRevision === candidate.baselineRevision || Number.isSafeInteger(cached2.cacheTargetRevision) && cached2.cacheTargetRevision > candidate.baselineRevision || cached2.cacheTargetRevision === candidate.inFlight?.envelope.canonicalRevision || candidate.pipelined.some(
|
|
68302
|
+
(flight) => cached2.cacheTargetRevision === flight.envelope.canonicalRevision
|
|
68303
|
+
)
|
|
67754
68304
|
);
|
|
67755
68305
|
if (reachable) continue;
|
|
67756
68306
|
this.#cache.delete(key2);
|
|
@@ -68087,16 +68637,16 @@ var init_registry2 = __esm({
|
|
|
68087
68637
|
pendingDeliveryClients: 0
|
|
68088
68638
|
});
|
|
68089
68639
|
SessionRuntimeControllerLeaseError = class extends Error {
|
|
68090
|
-
constructor(code2,
|
|
68091
|
-
super(
|
|
68640
|
+
constructor(code2, message2) {
|
|
68641
|
+
super(message2);
|
|
68092
68642
|
this.code = code2;
|
|
68093
68643
|
this.name = "SessionRuntimeControllerLeaseError";
|
|
68094
68644
|
}
|
|
68095
68645
|
code;
|
|
68096
68646
|
};
|
|
68097
68647
|
SessionRuntimeInputLifetimeEndedError = class extends Error {
|
|
68098
|
-
constructor(
|
|
68099
|
-
super(
|
|
68648
|
+
constructor(message2) {
|
|
68649
|
+
super(message2);
|
|
68100
68650
|
this.name = "SessionRuntimeInputLifetimeEndedError";
|
|
68101
68651
|
}
|
|
68102
68652
|
};
|
|
@@ -69479,9 +70029,9 @@ var init_registry2 = __esm({
|
|
|
69479
70029
|
this.#publishAuthority();
|
|
69480
70030
|
}
|
|
69481
70031
|
assertNoSharedWindow() {
|
|
69482
|
-
const
|
|
69483
|
-
if (
|
|
69484
|
-
throw new SessionRuntimeControllerLeaseError("controller-conflict",
|
|
70032
|
+
const message2 = this.#mirror.windowOwnershipMessage(this.session);
|
|
70033
|
+
if (message2) {
|
|
70034
|
+
throw new SessionRuntimeControllerLeaseError("controller-conflict", message2);
|
|
69485
70035
|
}
|
|
69486
70036
|
}
|
|
69487
70037
|
invalidateSharedWindowAuthority() {
|
|
@@ -69787,6 +70337,7 @@ var init_registry2 = __esm({
|
|
|
69787
70337
|
ack: (ack) => upstream.ack(ack),
|
|
69788
70338
|
...upstream.projectionReceipt ? { projectionReceipt: upstream.projectionReceipt } : {},
|
|
69789
70339
|
...upstream.materialize ? { materialize: upstream.materialize } : {},
|
|
70340
|
+
...upstream.historyRequest ? { historyRequest: upstream.historyRequest } : {},
|
|
69790
70341
|
...upstream.prioritize ? { prioritize: upstream.prioritize } : {},
|
|
69791
70342
|
nack: (nack) => upstream.nack(nack),
|
|
69792
70343
|
setVisibility: (visibility) => upstream.setVisibility(visibility),
|
|
@@ -70737,8 +71288,8 @@ var init_lease_manager = __esm({
|
|
|
70737
71288
|
MarkerPattern = /^v1:([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}):(0|[1-9][0-9]*)$/iu;
|
|
70738
71289
|
AttachmentLeaseError = class extends Error {
|
|
70739
71290
|
code;
|
|
70740
|
-
constructor(code2,
|
|
70741
|
-
super(
|
|
71291
|
+
constructor(code2, message2) {
|
|
71292
|
+
super(message2);
|
|
70742
71293
|
this.name = "AttachmentLeaseError";
|
|
70743
71294
|
this.code = code2;
|
|
70744
71295
|
}
|
|
@@ -71477,8 +72028,8 @@ var init_direct_websocket = __esm({
|
|
|
71477
72028
|
GridSchemaZ = TerminalAttachmentViewportSchemaZ;
|
|
71478
72029
|
TerminalAttachmentAdmissionError = class extends Error {
|
|
71479
72030
|
code;
|
|
71480
|
-
constructor(code2,
|
|
71481
|
-
super(
|
|
72031
|
+
constructor(code2, message2) {
|
|
72032
|
+
super(message2);
|
|
71482
72033
|
this.name = "TerminalAttachmentAdmissionError";
|
|
71483
72034
|
this.code = code2;
|
|
71484
72035
|
}
|
|
@@ -76125,8 +76676,8 @@ var init_lease_manager2 = __esm({
|
|
|
76125
76676
|
TicketPattern2 = /^ps2_[A-Za-z0-9_-]{43}$/u;
|
|
76126
76677
|
PaneStreamLeaseError = class extends Error {
|
|
76127
76678
|
code;
|
|
76128
|
-
constructor(code2,
|
|
76129
|
-
super(
|
|
76679
|
+
constructor(code2, message2) {
|
|
76680
|
+
super(message2);
|
|
76130
76681
|
this.name = "PaneStreamLeaseError";
|
|
76131
76682
|
this.code = code2;
|
|
76132
76683
|
}
|
|
@@ -76762,8 +77313,8 @@ var init_pane_stream_websocket = __esm({
|
|
|
76762
77313
|
BindingIdSchemaZ4 = z123.string().min(1).max(4096).refine((value) => !value.includes("\0"));
|
|
76763
77314
|
PaneStreamAdmissionError = class extends Error {
|
|
76764
77315
|
code;
|
|
76765
|
-
constructor(code2,
|
|
76766
|
-
super(
|
|
77316
|
+
constructor(code2, message2) {
|
|
77317
|
+
super(message2);
|
|
76767
77318
|
this.name = "PaneStreamAdmissionError";
|
|
76768
77319
|
this.code = code2;
|
|
76769
77320
|
}
|
|
@@ -77263,6 +77814,9 @@ var init_pane_stream_websocket = __esm({
|
|
|
77263
77814
|
cancelBeforeBind() {
|
|
77264
77815
|
this.close(1008, "upgrade-rejected");
|
|
77265
77816
|
}
|
|
77817
|
+
redeemFromUpgrade(frame) {
|
|
77818
|
+
this.#onMessage(frame, false);
|
|
77819
|
+
}
|
|
77266
77820
|
promote() {
|
|
77267
77821
|
if (!this.#open) return;
|
|
77268
77822
|
this.#promoted = true;
|
|
@@ -77857,10 +78411,10 @@ var init_pane_stream_websocket = __esm({
|
|
|
77857
78411
|
return binding.openTerminalDelivery(
|
|
77858
78412
|
channel.semanticPaneId,
|
|
77859
78413
|
offer,
|
|
77860
|
-
(
|
|
77861
|
-
if (!ready && !(negotiated &&
|
|
77862
|
-
pending.push(
|
|
77863
|
-
else return this.#sendTerminalDelivery(channel.semanticPaneId,
|
|
78414
|
+
(message2) => {
|
|
78415
|
+
if (!ready && !(negotiated && message2.type === "terminal.delivery.fault"))
|
|
78416
|
+
pending.push(message2);
|
|
78417
|
+
else return this.#sendTerminalDelivery(channel.semanticPaneId, message2);
|
|
77864
78418
|
},
|
|
77865
78419
|
this.#descriptor.workspaceName
|
|
77866
78420
|
);
|
|
@@ -77882,11 +78436,11 @@ var init_pane_stream_websocket = __esm({
|
|
|
77882
78436
|
const negotiated = delivery.negotiation.negotiated;
|
|
77883
78437
|
if (negotiated.generation !== this.#binding.daemonInstanceId) return true;
|
|
77884
78438
|
let incarnation = null;
|
|
77885
|
-
for (const
|
|
77886
|
-
if (
|
|
77887
|
-
if (
|
|
78439
|
+
for (const message2 of pending) {
|
|
78440
|
+
if (message2.type !== "terminal.delivery" && message2.type !== "terminal.projection") continue;
|
|
78441
|
+
if (message2.workspaceName !== this.#descriptor.workspaceName || message2.semanticPaneId !== channel.semanticPaneId || message2.generation !== negotiated.generation || message2.deliveryNonce !== negotiated.deliveryNonce || incarnation !== null && message2.incarnation !== incarnation)
|
|
77888
78442
|
return true;
|
|
77889
|
-
incarnation =
|
|
78443
|
+
incarnation = message2.incarnation;
|
|
77890
78444
|
}
|
|
77891
78445
|
return false;
|
|
77892
78446
|
}
|
|
@@ -77918,8 +78472,8 @@ var init_pane_stream_websocket = __esm({
|
|
|
77918
78472
|
}
|
|
77919
78473
|
for (const { channel, pending, markReady } of opened) {
|
|
77920
78474
|
if (this.#closed || channel.closed) continue;
|
|
77921
|
-
for (const
|
|
77922
|
-
await this.#sendTerminalDelivery(channel.semanticPaneId,
|
|
78475
|
+
for (const message2 of pending)
|
|
78476
|
+
await this.#sendTerminalDelivery(channel.semanticPaneId, message2);
|
|
77923
78477
|
pending.length = 0;
|
|
77924
78478
|
markReady();
|
|
77925
78479
|
this.#startGraphics(channel);
|
|
@@ -77952,27 +78506,27 @@ var init_pane_stream_websocket = __esm({
|
|
|
77952
78506
|
* change has a fresh channel, which this tombstone is not about.
|
|
77953
78507
|
*/
|
|
77954
78508
|
#tombstonesAfterChange = /* @__PURE__ */ new Set();
|
|
77955
|
-
async #sendTerminalDelivery(pane,
|
|
77956
|
-
if ((
|
|
78509
|
+
async #sendTerminalDelivery(pane, message2) {
|
|
78510
|
+
if ((message2.type === "terminal.delivery" || message2.type === "terminal.projection") && message2.frame === "tombstone")
|
|
77957
78511
|
this.#watchTombstone(pane);
|
|
77958
|
-
if (
|
|
78512
|
+
if (message2.type === "terminal.projection") {
|
|
77959
78513
|
const channel = this.#panes.get(pane);
|
|
77960
|
-
if (channel?.deliveryAddress) channel.deliveryAddress.incarnation =
|
|
78514
|
+
if (channel?.deliveryAddress) channel.deliveryAddress.incarnation = message2.incarnation;
|
|
77961
78515
|
if (channel) channel.binaryCells = true;
|
|
77962
|
-
this.#sendFrame(pane, { type: "terminal-projection-envelope", pane, envelope:
|
|
77963
|
-
} else if (
|
|
78516
|
+
this.#sendFrame(pane, { type: "terminal-projection-envelope", pane, envelope: message2 });
|
|
78517
|
+
} else if (message2.type === "terminal.delivery") {
|
|
77964
78518
|
if (!this.#diagnosticFirstSeedObserved) {
|
|
77965
78519
|
this.#diagnosticFirstSeedObserved = true;
|
|
77966
78520
|
this.#recordDiagnosticLifecycle("pane-stream-first-seed");
|
|
77967
78521
|
}
|
|
77968
78522
|
const channel = this.#panes.get(pane);
|
|
77969
|
-
if (channel?.deliveryAddress) channel.deliveryAddress.incarnation =
|
|
77970
|
-
if (channel) channel.binaryCells =
|
|
78523
|
+
if (channel?.deliveryAddress) channel.deliveryAddress.incarnation = message2.incarnation;
|
|
78524
|
+
if (channel) channel.binaryCells = message2.encoding === "semantic-binary-v1";
|
|
77971
78525
|
const detailedDeliveryObservation = this.#observability?.enabled === true;
|
|
77972
|
-
const trace =
|
|
78526
|
+
const trace = message2.performanceTraceId && detailedDeliveryObservation ? this.#observability.beginTrace(
|
|
77973
78527
|
"terminal-input-to-paint",
|
|
77974
|
-
{ generation:
|
|
77975
|
-
|
|
78528
|
+
{ generation: message2.generation, incarnation: message2.incarnation },
|
|
78529
|
+
message2.performanceTraceId
|
|
77976
78530
|
) : null;
|
|
77977
78531
|
let startedAtMicros = null;
|
|
77978
78532
|
if (detailedDeliveryObservation)
|
|
@@ -77990,7 +78544,7 @@ var init_pane_stream_websocket = __esm({
|
|
|
77990
78544
|
this.#sendFrame(pane, {
|
|
77991
78545
|
type: "terminal-delivery-envelope",
|
|
77992
78546
|
pane,
|
|
77993
|
-
envelope:
|
|
78547
|
+
envelope: message2
|
|
77994
78548
|
});
|
|
77995
78549
|
if (startedAtMicros !== null) {
|
|
77996
78550
|
let endedAtMicros;
|
|
@@ -78018,32 +78572,32 @@ var init_pane_stream_websocket = __esm({
|
|
|
78018
78572
|
endedAtMicros: endedAtSharedMicros
|
|
78019
78573
|
},
|
|
78020
78574
|
Object.freeze({
|
|
78021
|
-
workspaceName:
|
|
78022
|
-
semanticPaneId:
|
|
78023
|
-
canonicalGeneration:
|
|
78024
|
-
canonicalIncarnation:
|
|
78025
|
-
canonicalRevision:
|
|
78026
|
-
canonicalStateHash:
|
|
78027
|
-
transactionId:
|
|
78028
|
-
...terminalDeliveryObservationOrdinal(
|
|
78575
|
+
workspaceName: message2.workspaceName,
|
|
78576
|
+
semanticPaneId: message2.semanticPaneId,
|
|
78577
|
+
canonicalGeneration: message2.generation,
|
|
78578
|
+
canonicalIncarnation: message2.incarnation,
|
|
78579
|
+
canonicalRevision: message2.canonicalRevision,
|
|
78580
|
+
canonicalStateHash: message2.canonicalStateHash,
|
|
78581
|
+
transactionId: message2.transactionId,
|
|
78582
|
+
...terminalDeliveryObservationOrdinal(message2) === null ? {} : { deliveryOrdinal: terminalDeliveryObservationOrdinal(message2) },
|
|
78029
78583
|
deliveryClientId: this.#sessionRuntimeBinding?.clientId ?? this.#clientId,
|
|
78030
78584
|
deliverySurface: this.#sessionRuntimeBinding?.surface ?? "unknown",
|
|
78031
78585
|
deliveryLaneId: this.#sessionRuntimeBinding?.deliveryLaneId ?? this.#clientId,
|
|
78032
78586
|
deliveryRequestId: this.#sessionRuntimeBinding?.deliveryRequestId ?? this.#clientId,
|
|
78033
|
-
deliveryNonce:
|
|
78587
|
+
deliveryNonce: message2.deliveryNonce
|
|
78034
78588
|
})
|
|
78035
78589
|
);
|
|
78036
78590
|
} catch {
|
|
78037
78591
|
}
|
|
78038
78592
|
}
|
|
78039
|
-
} else if (
|
|
78593
|
+
} else if (message2.type === "terminal.delivery.chunk") {
|
|
78040
78594
|
if (this.#panes.get(pane)?.binaryCells) {
|
|
78041
78595
|
this.#sendEncoded(
|
|
78042
78596
|
pane,
|
|
78043
78597
|
Buffer.from(
|
|
78044
78598
|
encodeTerminalDeliveryBinaryChunk(
|
|
78045
|
-
{ pane, transactionId:
|
|
78046
|
-
|
|
78599
|
+
{ pane, transactionId: message2.transactionId, index: message2.index },
|
|
78600
|
+
message2.bytes
|
|
78047
78601
|
)
|
|
78048
78602
|
),
|
|
78049
78603
|
true
|
|
@@ -78052,13 +78606,13 @@ var init_pane_stream_websocket = __esm({
|
|
|
78052
78606
|
this.#sendFrame(pane, {
|
|
78053
78607
|
type: "terminal-delivery-chunk",
|
|
78054
78608
|
pane,
|
|
78055
|
-
transactionId:
|
|
78056
|
-
index:
|
|
78057
|
-
data: Buffer.from(
|
|
78609
|
+
transactionId: message2.transactionId,
|
|
78610
|
+
index: message2.index,
|
|
78611
|
+
data: Buffer.from(message2.bytes).toString("base64")
|
|
78058
78612
|
});
|
|
78059
78613
|
}
|
|
78060
78614
|
} else {
|
|
78061
|
-
this.#sendFrame(pane, { type: "terminal-delivery-fault", pane, fault:
|
|
78615
|
+
this.#sendFrame(pane, { type: "terminal-delivery-fault", pane, fault: message2 });
|
|
78062
78616
|
return;
|
|
78063
78617
|
}
|
|
78064
78618
|
await this.#awaitSemanticCredit(pane);
|
|
@@ -79008,6 +79562,14 @@ var init_pane_stream_websocket = __esm({
|
|
|
79008
79562
|
channel.delivery.projectionReceipt(frame.receipt);
|
|
79009
79563
|
return;
|
|
79010
79564
|
}
|
|
79565
|
+
if (frame.type === "terminal-delivery-history-request") {
|
|
79566
|
+
const channel = this.#deliveryChannel(frame.request);
|
|
79567
|
+
if (!channel) return;
|
|
79568
|
+
if (!channel.delivery?.historyRequest || !channel.delivery.negotiation.accepted || channel.delivery.negotiation.negotiated.partialHistory !== "tail-v1")
|
|
79569
|
+
return this.#failProtocol("protocol-error");
|
|
79570
|
+
channel.delivery.historyRequest(frame.request);
|
|
79571
|
+
return;
|
|
79572
|
+
}
|
|
79011
79573
|
if (frame.type === "terminal-projection-materialize") {
|
|
79012
79574
|
const channel = this.#deliveryChannel(frame.request);
|
|
79013
79575
|
if (!channel) return;
|
|
@@ -81838,6 +82400,15 @@ function rawHeaderValues(request3, expectedName) {
|
|
|
81838
82400
|
}
|
|
81839
82401
|
return values2;
|
|
81840
82402
|
}
|
|
82403
|
+
function upgradeRedeemFrame(request3) {
|
|
82404
|
+
const values2 = rawHeaderValues(request3, PANE_STREAM_REDEEM_HEADER);
|
|
82405
|
+
if (values2.length === 0) return null;
|
|
82406
|
+
const value = values2[0];
|
|
82407
|
+
if (values2.length > 1 || value.length === 0 || value.length > Math.ceil(PANE_STREAM_MAX_REDEMPTION_BYTES * 4 / 3) || !/^[A-Za-z0-9_-]+$/u.test(value))
|
|
82408
|
+
return "invalid";
|
|
82409
|
+
const frame = Buffer.from(value, "base64url");
|
|
82410
|
+
return frame.byteLength === 0 || frame.byteLength > PANE_STREAM_MAX_REDEMPTION_BYTES ? "invalid" : frame;
|
|
82411
|
+
}
|
|
81841
82412
|
function rejectUpgrade(socket, status2) {
|
|
81842
82413
|
const phrase = status2 === 403 ? "Forbidden" : status2 === 404 ? "Not Found" : status2 === 410 ? "Gone" : status2 === 426 ? "Upgrade Required" : "Service Unavailable";
|
|
81843
82414
|
try {
|
|
@@ -81861,7 +82432,11 @@ function attachPaneStreamWebSocket(server, coordinator, redemptionPath = PANE_ST
|
|
|
81861
82432
|
return offered.size === 1 && offered.has(PANE_STREAM_WEBSOCKET_SUBPROTOCOL) ? PANE_STREAM_WEBSOCKET_SUBPROTOCOL : false;
|
|
81862
82433
|
}
|
|
81863
82434
|
});
|
|
81864
|
-
|
|
82435
|
+
const redeemed = /* @__PURE__ */ new WeakSet();
|
|
82436
|
+
wss.on("headers", (headers2, request3) => {
|
|
82437
|
+
heartbeat.advertise(headers2);
|
|
82438
|
+
if (redeemed.has(request3)) headers2.push("X-Tmux-Ide-Redeem: accepted");
|
|
82439
|
+
});
|
|
81865
82440
|
const upgrade = (request3, socket, head3) => {
|
|
81866
82441
|
const rawPath = request3.url ?? "";
|
|
81867
82442
|
const pathname = rawPath.split("?", 1)[0] ?? "";
|
|
@@ -81896,6 +82471,11 @@ function attachPaneStreamWebSocket(server, coordinator, redemptionPath = PANE_ST
|
|
|
81896
82471
|
rejectUpgrade(socket, 403);
|
|
81897
82472
|
return;
|
|
81898
82473
|
}
|
|
82474
|
+
const redeemFrame = upgradeRedeemFrame(request3);
|
|
82475
|
+
if (redeemFrame === "invalid") {
|
|
82476
|
+
rejectUpgrade(socket, 403);
|
|
82477
|
+
return;
|
|
82478
|
+
}
|
|
81899
82479
|
if (!isCurrent()) {
|
|
81900
82480
|
rejectUpgrade(socket, 410);
|
|
81901
82481
|
return;
|
|
@@ -81914,12 +82494,14 @@ function attachPaneStreamWebSocket(server, coordinator, redemptionPath = PANE_ST
|
|
|
81914
82494
|
const cancelUnbound = () => decision.admission.cancelBeforeBind();
|
|
81915
82495
|
socket.once("close", cancelUnbound);
|
|
81916
82496
|
socket.once("error", cancelUnbound);
|
|
82497
|
+
if (redeemFrame) redeemed.add(request3);
|
|
81917
82498
|
try {
|
|
81918
82499
|
wss.handleUpgrade(request3, socket, head3, (ws) => {
|
|
81919
82500
|
socket.off("close", cancelUnbound);
|
|
81920
82501
|
socket.off("error", cancelUnbound);
|
|
81921
82502
|
heartbeat.watch(ws, `pane-stream ${redemptionPath}`);
|
|
81922
82503
|
decision.admission.bind(ws);
|
|
82504
|
+
if (redeemFrame) decision.admission.redeemFromUpgrade(redeemFrame);
|
|
81923
82505
|
});
|
|
81924
82506
|
} catch {
|
|
81925
82507
|
socket.off("close", cancelUnbound);
|
|
@@ -81937,12 +82519,14 @@ function attachPaneStreamWebSocket(server, coordinator, redemptionPath = PANE_ST
|
|
|
81937
82519
|
}
|
|
81938
82520
|
};
|
|
81939
82521
|
}
|
|
82522
|
+
var PANE_STREAM_REDEEM_HEADER;
|
|
81940
82523
|
var init_pane_stream_upgrade = __esm({
|
|
81941
82524
|
"packages/daemon/src/server/pane-stream-upgrade.ts"() {
|
|
81942
82525
|
"use strict";
|
|
81943
82526
|
init_src2();
|
|
81944
82527
|
init_websocket_heartbeat2();
|
|
81945
82528
|
init_pane_stream_websocket();
|
|
82529
|
+
PANE_STREAM_REDEEM_HEADER = "x-tmux-ide-redeem";
|
|
81946
82530
|
}
|
|
81947
82531
|
});
|
|
81948
82532
|
|
|
@@ -82964,15 +83548,15 @@ async function readPortProcessFactsAsync(signal) {
|
|
|
82964
83548
|
}
|
|
82965
83549
|
function classifySessionInspectionError(error) {
|
|
82966
83550
|
const candidate = error;
|
|
82967
|
-
const
|
|
82968
|
-
if (candidate.code === "EBADF" || candidate.code === "EAGAIN" || candidate.code === "EMFILE" || candidate.code === "ENFILE" ||
|
|
83551
|
+
const message2 = candidate.message ?? "";
|
|
83552
|
+
if (candidate.code === "EBADF" || candidate.code === "EAGAIN" || candidate.code === "EMFILE" || candidate.code === "ENFILE" || message2.includes("EBADF") || message2.includes("EAGAIN")) {
|
|
82969
83553
|
return "unknown";
|
|
82970
83554
|
}
|
|
82971
83555
|
return "no";
|
|
82972
83556
|
}
|
|
82973
83557
|
function isConfirmedMissingTmuxTarget(error) {
|
|
82974
|
-
const
|
|
82975
|
-
return /(?:can't find|no such|unknown) (?:pane|session|window|target)/iu.test(
|
|
83558
|
+
const message2 = error instanceof Error ? error.message : String(error);
|
|
83559
|
+
return /(?:can't find|no such|unknown) (?:pane|session|window|target)/iu.test(message2);
|
|
82976
83560
|
}
|
|
82977
83561
|
async function mapBounded(values2, concurrency, operation) {
|
|
82978
83562
|
let cursor2 = 0;
|
|
@@ -83162,8 +83746,8 @@ var init_pty_bridge = __esm({
|
|
|
83162
83746
|
cwd;
|
|
83163
83747
|
reason;
|
|
83164
83748
|
constructor(args) {
|
|
83165
|
-
const
|
|
83166
|
-
super(
|
|
83749
|
+
const message2 = _TerminalCwdError.formatMessage(args.cwd, args.reason);
|
|
83750
|
+
super(message2, args.cause !== void 0 ? { cause: args.cause } : void 0);
|
|
83167
83751
|
this.name = "TerminalCwdError";
|
|
83168
83752
|
this.cwd = args.cwd;
|
|
83169
83753
|
this.reason = args.reason;
|
|
@@ -83531,9 +84115,9 @@ function parseResizeFrame(data) {
|
|
|
83531
84115
|
}
|
|
83532
84116
|
return { type: "resize", cols: frame.cols, rows: frame.rows };
|
|
83533
84117
|
}
|
|
83534
|
-
function sendError(ws,
|
|
84118
|
+
function sendError(ws, message2, extras) {
|
|
83535
84119
|
if (ws.readyState !== WS_OPEN4) return;
|
|
83536
|
-
const frame = { type: "error", message };
|
|
84120
|
+
const frame = { type: "error", message: message2 };
|
|
83537
84121
|
if (extras?.reason !== void 0) frame.reason = extras.reason;
|
|
83538
84122
|
if (extras?.cwd !== void 0) frame.cwd = extras.cwd;
|
|
83539
84123
|
ws.send(JSON.stringify(frame));
|
|
@@ -83601,8 +84185,8 @@ function handlePtyWebSocket(ws, id2, options = {}) {
|
|
|
83601
84185
|
bridge.pause();
|
|
83602
84186
|
scheduleDrainCheck();
|
|
83603
84187
|
};
|
|
83604
|
-
const closeWithError = (
|
|
83605
|
-
sendError(socket,
|
|
84188
|
+
const closeWithError = (message2) => {
|
|
84189
|
+
sendError(socket, message2);
|
|
83606
84190
|
closeWs(socket);
|
|
83607
84191
|
};
|
|
83608
84192
|
const closeWithCwdError = (err) => {
|
|
@@ -85256,8 +85840,8 @@ function acquireLegacyObservation() {
|
|
|
85256
85840
|
function broadcastInitOutput(jobId, chunk, done) {
|
|
85257
85841
|
for (const client of allClients) client.broadcastInitOutput(jobId, chunk, done);
|
|
85258
85842
|
}
|
|
85259
|
-
function broadcastInitError(jobId,
|
|
85260
|
-
for (const client of allClients) client.broadcastInitError(jobId,
|
|
85843
|
+
function broadcastInitError(jobId, message2) {
|
|
85844
|
+
for (const client of allClients) client.broadcastInitError(jobId, message2);
|
|
85261
85845
|
}
|
|
85262
85846
|
function broadcastActionComplete(name, result2) {
|
|
85263
85847
|
for (const client of allClients) client.broadcastActionComplete(name, result2);
|
|
@@ -85343,9 +85927,9 @@ function handleWsEventsConnection(socket, daemonIdentity, options = {}) {
|
|
|
85343
85927
|
const frame = done === void 0 ? { type: "init.output", jobId, chunk } : { type: "init.output", jobId, chunk, done };
|
|
85344
85928
|
send2(frame);
|
|
85345
85929
|
};
|
|
85346
|
-
const broadcastInitErrorForClient = (jobId,
|
|
85930
|
+
const broadcastInitErrorForClient = (jobId, message2) => {
|
|
85347
85931
|
if (!legacyDeliveryEnabled) return;
|
|
85348
|
-
send2({ type: "init.error", jobId, message });
|
|
85932
|
+
send2({ type: "init.error", jobId, message: message2 });
|
|
85349
85933
|
};
|
|
85350
85934
|
const broadcastActionCompleteForClient = (name, result2) => {
|
|
85351
85935
|
if (!legacyDeliveryEnabled) return;
|
|
@@ -85835,8 +86419,8 @@ function actionErrorFromCwdError(err) {
|
|
|
85835
86419
|
function wrapInternalError(err) {
|
|
85836
86420
|
if (err instanceof ActionError) return err;
|
|
85837
86421
|
if (err instanceof TerminalCwdError) return actionErrorFromCwdError(err);
|
|
85838
|
-
const
|
|
85839
|
-
return new ActionError({ code: "internal", message, cause: err });
|
|
86422
|
+
const message2 = err instanceof Error ? err.message : String(err);
|
|
86423
|
+
return new ActionError({ code: "internal", message: message2, cause: err });
|
|
85840
86424
|
}
|
|
85841
86425
|
var ActionError, CWD_REASON_TO_CODE;
|
|
85842
86426
|
var init_errors3 = __esm({
|
|
@@ -86705,8 +87289,8 @@ var init_workspace_open_handoff2 = __esm({
|
|
|
86705
87289
|
"use strict";
|
|
86706
87290
|
WorkspaceOpenHandoffError = class extends Error {
|
|
86707
87291
|
code;
|
|
86708
|
-
constructor(code2,
|
|
86709
|
-
super(
|
|
87292
|
+
constructor(code2, message2) {
|
|
87293
|
+
super(message2);
|
|
86710
87294
|
this.name = "WorkspaceOpenHandoffError";
|
|
86711
87295
|
this.code = code2;
|
|
86712
87296
|
}
|
|
@@ -87318,8 +87902,8 @@ function canonicalScene(scene) {
|
|
|
87318
87902
|
focusedWindowId: scene.focusedWindowId
|
|
87319
87903
|
};
|
|
87320
87904
|
}
|
|
87321
|
-
function diagnostic2(code2, path2,
|
|
87322
|
-
return { code: code2, path: path2, message };
|
|
87905
|
+
function diagnostic2(code2, path2, message2) {
|
|
87906
|
+
return { code: code2, path: path2, message: message2 };
|
|
87323
87907
|
}
|
|
87324
87908
|
function isRecord2(value) {
|
|
87325
87909
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
@@ -87840,9 +88424,9 @@ function sameScene(left, right) {
|
|
|
87840
88424
|
focusedWindowId: right.focusedWindowId
|
|
87841
88425
|
});
|
|
87842
88426
|
}
|
|
87843
|
-
function requireNonnegativeIndex(value, path2,
|
|
88427
|
+
function requireNonnegativeIndex(value, path2, message2) {
|
|
87844
88428
|
if (!Number.isInteger(value) || value < 0) {
|
|
87845
|
-
throw new AppWindowKernelError("INVALID_INPUT", path2,
|
|
88429
|
+
throw new AppWindowKernelError("INVALID_INPUT", path2, message2);
|
|
87846
88430
|
}
|
|
87847
88431
|
}
|
|
87848
88432
|
function boundedCoordinate(value, path2) {
|
|
@@ -87902,8 +88486,8 @@ function finalize(current, timestamp, patch) {
|
|
|
87902
88486
|
}
|
|
87903
88487
|
function translateStateError(error, path2) {
|
|
87904
88488
|
if (error instanceof AppWindowKernelError) return error;
|
|
87905
|
-
const
|
|
87906
|
-
return new AppWindowKernelError("INVALID_INPUT", path2,
|
|
88489
|
+
const message2 = error.message;
|
|
88490
|
+
return new AppWindowKernelError("INVALID_INPUT", path2, message2);
|
|
87907
88491
|
}
|
|
87908
88492
|
var APP_WINDOW_FLOAT_MIN_WIDTH, APP_WINDOW_FLOAT_MIN_HEIGHT, APP_WINDOW_COORDINATE_LIMIT, AppWindowKernelError;
|
|
87909
88493
|
var init_app_window_kernel = __esm({
|
|
@@ -87917,8 +88501,8 @@ var init_app_window_kernel = __esm({
|
|
|
87917
88501
|
AppWindowKernelError = class extends Error {
|
|
87918
88502
|
code;
|
|
87919
88503
|
path;
|
|
87920
|
-
constructor(code2, path2,
|
|
87921
|
-
super(
|
|
88504
|
+
constructor(code2, path2, message2) {
|
|
88505
|
+
super(message2);
|
|
87922
88506
|
this.name = "AppWindowKernelError";
|
|
87923
88507
|
this.code = code2;
|
|
87924
88508
|
this.path = path2;
|
|
@@ -88290,8 +88874,8 @@ function validateExpectedRevision(value) {
|
|
|
88290
88874
|
}
|
|
88291
88875
|
return value;
|
|
88292
88876
|
}
|
|
88293
|
-
function diagnostic3(code2, path2,
|
|
88294
|
-
return { code: code2, path: path2, message };
|
|
88877
|
+
function diagnostic3(code2, path2, message2) {
|
|
88878
|
+
return { code: code2, path: path2, message: message2 };
|
|
88295
88879
|
}
|
|
88296
88880
|
var APP_WINDOW_DOCUMENT_PATH, LEGACY_WORKSPACE_UI_PATH, AppWindowRepositoryError, AppWindowService;
|
|
88297
88881
|
var init_app_window_repository = __esm({
|
|
@@ -88307,8 +88891,8 @@ var init_app_window_repository = __esm({
|
|
|
88307
88891
|
code;
|
|
88308
88892
|
diagnostics;
|
|
88309
88893
|
cause;
|
|
88310
|
-
constructor(code2,
|
|
88311
|
-
super(
|
|
88894
|
+
constructor(code2, message2, diagnostics = [], cause) {
|
|
88895
|
+
super(message2);
|
|
88312
88896
|
this.name = "AppWindowRepositoryError";
|
|
88313
88897
|
this.code = code2;
|
|
88314
88898
|
this.diagnostics = diagnostics;
|
|
@@ -88814,10 +89398,10 @@ Content-Length: 0\r
|
|
|
88814
89398
|
active3 = ws;
|
|
88815
89399
|
const owner = new NativeSurfaceProviderChannel(
|
|
88816
89400
|
registry,
|
|
88817
|
-
(
|
|
88818
|
-
if (!isCurrent() || ws.readyState !== WebSocket.OPEN || ws.bufferedAmount + Buffer.byteLength(
|
|
89401
|
+
(message2) => {
|
|
89402
|
+
if (!isCurrent() || ws.readyState !== WebSocket.OPEN || ws.bufferedAmount + Buffer.byteLength(message2) > 64 * 1024)
|
|
88819
89403
|
return false;
|
|
88820
|
-
ws.send(
|
|
89404
|
+
ws.send(message2, (error) => {
|
|
88821
89405
|
if (error) owner.close();
|
|
88822
89406
|
});
|
|
88823
89407
|
return true;
|
|
@@ -89840,8 +90424,8 @@ import { spawn as nodeSpawn } from "node:child_process";
|
|
|
89840
90424
|
import { existsSync as existsSync30, statSync as statSync25 } from "node:fs";
|
|
89841
90425
|
import { isAbsolute as isAbsolute28 } from "node:path";
|
|
89842
90426
|
import { z as z129 } from "zod";
|
|
89843
|
-
function fail2(
|
|
89844
|
-
throw new ExecError(
|
|
90427
|
+
function fail2(message2) {
|
|
90428
|
+
throw new ExecError(message2);
|
|
89845
90429
|
}
|
|
89846
90430
|
async function prepareExec(raw, deps2) {
|
|
89847
90431
|
const parsed = ExecRequestSchemaZ.safeParse(raw);
|
|
@@ -90134,8 +90718,8 @@ var init_plugin_store = __esm({
|
|
|
90134
90718
|
import { spawn as spawn9 } from "node:child_process";
|
|
90135
90719
|
import { homedir as homedir6 } from "node:os";
|
|
90136
90720
|
import { z as z130 } from "zod";
|
|
90137
|
-
function fail3(
|
|
90138
|
-
throw new WorktreeCallError(
|
|
90721
|
+
function fail3(message2) {
|
|
90722
|
+
throw new WorktreeCallError(message2);
|
|
90139
90723
|
}
|
|
90140
90724
|
async function worktreeCall(operation, raw, deps2) {
|
|
90141
90725
|
if (!WORKTREE_OPERATIONS.includes(operation))
|
|
@@ -90180,8 +90764,8 @@ async function worktreeCall(operation, raw, deps2) {
|
|
|
90180
90764
|
delete env.TMUX_PANE;
|
|
90181
90765
|
const result2 = await deps2.runCli(args, env);
|
|
90182
90766
|
if (result2.code !== 0) {
|
|
90183
|
-
const
|
|
90184
|
-
fail3(`E_FAILED: ${
|
|
90767
|
+
const message2 = (result2.stderr.trim() || result2.stdout.trim()).split("\n").slice(-3).join(" ");
|
|
90768
|
+
fail3(`E_FAILED: ${message2 || `tmux-ide worktree ${op} failed`}`.slice(0, 2e3));
|
|
90185
90769
|
}
|
|
90186
90770
|
try {
|
|
90187
90771
|
return JSON.parse(result2.stdout);
|
|
@@ -90250,8 +90834,8 @@ function daemonPort(endpoint) {
|
|
|
90250
90834
|
return [];
|
|
90251
90835
|
}
|
|
90252
90836
|
}
|
|
90253
|
-
function fail4(
|
|
90254
|
-
throw new HostCallError(
|
|
90837
|
+
function fail4(message2) {
|
|
90838
|
+
throw new HostCallError(message2);
|
|
90255
90839
|
}
|
|
90256
90840
|
function paneContextFromTmux(pane, line) {
|
|
90257
90841
|
const [socket, pid, session, cwd] = line.replace(/\n$/u, "").split(" ");
|
|
@@ -90276,8 +90860,8 @@ function createHostCallHandler(deps2) {
|
|
|
90276
90860
|
const body = await response3.json().catch(() => null);
|
|
90277
90861
|
if (!response3.ok) {
|
|
90278
90862
|
const error = body && typeof body === "object" && "error" in body ? body.error : null;
|
|
90279
|
-
const
|
|
90280
|
-
fail4(`E_FAILED: ${
|
|
90863
|
+
const message2 = typeof error === "string" ? error : error && typeof error === "object" && "message" in error ? String(error.message) : error && typeof error === "object" && "code" in error ? String(error.code) : `HTTP ${response3.status}`;
|
|
90864
|
+
fail4(`E_FAILED: ${message2}`);
|
|
90281
90865
|
}
|
|
90282
90866
|
return body;
|
|
90283
90867
|
};
|
|
@@ -91154,13 +91738,13 @@ var init_supervisor = __esm({
|
|
|
91154
91738
|
});
|
|
91155
91739
|
}
|
|
91156
91740
|
// ---------------------------------------------------------------- internals
|
|
91157
|
-
#log(plugin, level,
|
|
91741
|
+
#log(plugin, level, message2, fields) {
|
|
91158
91742
|
const secrets2 = this.#secretSet();
|
|
91159
91743
|
this.#options.onLog({
|
|
91160
91744
|
ts: new Date(this.#options.now()).toISOString(),
|
|
91161
91745
|
plugin,
|
|
91162
91746
|
level,
|
|
91163
|
-
message: redactText(
|
|
91747
|
+
message: redactText(message2, secrets2),
|
|
91164
91748
|
...fields ? { fields: redactLogValue(fields, secrets2) } : {}
|
|
91165
91749
|
});
|
|
91166
91750
|
}
|
|
@@ -91509,11 +92093,11 @@ import { basename as basename19, dirname as dirname40, extname as extname3, join
|
|
|
91509
92093
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
91510
92094
|
async function notifyTmuxClients(tmux8, plugin, text2, level) {
|
|
91511
92095
|
const prefix = level === "info" ? "" : `${level}: `;
|
|
91512
|
-
const
|
|
92096
|
+
const message2 = `${plugin}: ${prefix}${text2}`.replace(/#/gu, "##");
|
|
91513
92097
|
const clients = (await tmux8(["list-clients", "-F", "#{client_name}"])).split("\n").map((line) => line.trim()).filter(Boolean);
|
|
91514
92098
|
await Promise.all(
|
|
91515
92099
|
clients.map(
|
|
91516
|
-
(client) => tmux8(["display-message", "-c", client, "-d", "4000",
|
|
92100
|
+
(client) => tmux8(["display-message", "-c", client, "-d", "4000", message2]).catch(() => "")
|
|
91517
92101
|
)
|
|
91518
92102
|
);
|
|
91519
92103
|
}
|
|
@@ -92612,6 +93196,41 @@ var init_pane_stream_issue = __esm({
|
|
|
92612
93196
|
}
|
|
92613
93197
|
});
|
|
92614
93198
|
|
|
93199
|
+
// packages/daemon/src/command-center/tmux-server-attach.ts
|
|
93200
|
+
import { z as z136 } from "zod";
|
|
93201
|
+
function chooseAttachSelection(inventory, preferredPane, maxPanes) {
|
|
93202
|
+
const panes = inventory.semanticPaneIds;
|
|
93203
|
+
if (panes.length === 0) return null;
|
|
93204
|
+
let semanticWindowId = null;
|
|
93205
|
+
let chosen = panes;
|
|
93206
|
+
if (panes.length > maxPanes) {
|
|
93207
|
+
const fits = (window3) => window3 !== void 0 && window3.semanticPaneIds.length <= maxPanes;
|
|
93208
|
+
const active3 = inventory.windows.find((window3) => window3.active);
|
|
93209
|
+
const wanted = (preferredPane !== null ? inventory.windows.find((window3) => window3.semanticPaneIds.includes(preferredPane)) : void 0) ?? active3;
|
|
93210
|
+
const window2 = [wanted, active3].find(fits) ?? inventory.windows.find(fits);
|
|
93211
|
+
if (!window2) return null;
|
|
93212
|
+
semanticWindowId = window2.semanticWindowId;
|
|
93213
|
+
chosen = window2.semanticPaneIds;
|
|
93214
|
+
}
|
|
93215
|
+
const selectedPane = preferredPane !== null && chosen.includes(preferredPane) ? preferredPane : chosen[0];
|
|
93216
|
+
return { semanticWindowId, panes: chosen, selectedPane };
|
|
93217
|
+
}
|
|
93218
|
+
var TmuxServerAttachRequestSchemaZ;
|
|
93219
|
+
var init_tmux_server_attach = __esm({
|
|
93220
|
+
"packages/daemon/src/command-center/tmux-server-attach.ts"() {
|
|
93221
|
+
"use strict";
|
|
93222
|
+
TmuxServerAttachRequestSchemaZ = z136.object({
|
|
93223
|
+
version: z136.literal(1),
|
|
93224
|
+
preferredPane: z136.string().min(1).max(128).nullable(),
|
|
93225
|
+
maxPanes: z136.number().int().min(1).max(256),
|
|
93226
|
+
issue: z136.object({
|
|
93227
|
+
expectedDaemonInstanceId: z136.uuid(),
|
|
93228
|
+
stream: z136.record(z136.string(), z136.unknown())
|
|
93229
|
+
}).catchall(z136.unknown())
|
|
93230
|
+
}).strict();
|
|
93231
|
+
}
|
|
93232
|
+
});
|
|
93233
|
+
|
|
92615
93234
|
// packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts
|
|
92616
93235
|
function projectTerminalRuntimeInventory(session, resourceRevision) {
|
|
92617
93236
|
const shell = projectApplicationShellResource(session);
|
|
@@ -92678,7 +93297,7 @@ var init_terminal_runtime_inventory2 = __esm({
|
|
|
92678
93297
|
// packages/daemon/src/command-center/tmux-servers.ts
|
|
92679
93298
|
import { Hono as Hono2 } from "hono";
|
|
92680
93299
|
import { streamSSE as streamSSE2 } from "hono/streaming";
|
|
92681
|
-
import { z as
|
|
93300
|
+
import { z as z137 } from "zod";
|
|
92682
93301
|
async function boundedJson2(request3, limit = 64 * 1024) {
|
|
92683
93302
|
if (!request3.body) throw new TypeError("Missing body");
|
|
92684
93303
|
const reader = request3.body.getReader();
|
|
@@ -92718,7 +93337,7 @@ function failure(c, error) {
|
|
|
92718
93337
|
return c.json({ error: { code: "harness_unavailable" } }, 409);
|
|
92719
93338
|
if (error instanceof WorkspaceMultiplexerError)
|
|
92720
93339
|
return c.json({ error: { code: error.code } }, 409);
|
|
92721
|
-
if (error instanceof
|
|
93340
|
+
if (error instanceof z137.ZodError || error instanceof SyntaxError || error instanceof TypeError)
|
|
92722
93341
|
return c.json({ error: { code: "invalid-request" } }, 400);
|
|
92723
93342
|
const code2 = error?.code;
|
|
92724
93343
|
logger.warn("tmux-server-routes", "request failed as server-unavailable", {
|
|
@@ -92858,9 +93477,9 @@ function mountTmuxServerRoutes(app, options) {
|
|
|
92858
93477
|
`${scoped}/sessions/create`,
|
|
92859
93478
|
route(async (c) => {
|
|
92860
93479
|
const server = scope2(c);
|
|
92861
|
-
const request3 =
|
|
92862
|
-
operationId:
|
|
92863
|
-
expectedDaemonInstanceId:
|
|
93480
|
+
const request3 = z137.object({
|
|
93481
|
+
operationId: z137.uuid(),
|
|
93482
|
+
expectedDaemonInstanceId: z137.uuid(),
|
|
92864
93483
|
intent: WorkspaceSessionCreateArgumentsSchemaZ
|
|
92865
93484
|
}).strict().parse(await boundedJson2(c.req.raw));
|
|
92866
93485
|
if (request3.expectedDaemonInstanceId !== server.generation || request3.intent.expectedDaemonInstanceId && request3.intent.expectedDaemonInstanceId !== server.generation)
|
|
@@ -92906,6 +93525,77 @@ function mountTmuxServerRoutes(app, options) {
|
|
|
92906
93525
|
return c.json({ version: 1, server, ...result2 });
|
|
92907
93526
|
})
|
|
92908
93527
|
);
|
|
93528
|
+
app.post(
|
|
93529
|
+
`${scoped}/sessions/:liveSessionId/attach`,
|
|
93530
|
+
route(async (c) => {
|
|
93531
|
+
const server = scope2(c);
|
|
93532
|
+
const liveSessionId = workspaceSchema.parse(c.req.param("liveSessionId"));
|
|
93533
|
+
const request3 = TmuxServerAttachRequestSchemaZ.parse(await boundedJson2(c.req.raw));
|
|
93534
|
+
if (request3.issue.expectedDaemonInstanceId !== server.generation || c.req.header("X-Tmux-Ide-Expected-Daemon-Instance-Id") !== server.generation)
|
|
93535
|
+
throw new TmuxServerScopeError("stale-generation");
|
|
93536
|
+
const result2 = await options.owners.withOwner(server, async (owner) => {
|
|
93537
|
+
const opened = await owner.openSession(liveSessionId);
|
|
93538
|
+
const workspace = owner.workspaceRegistry.get(opened.workspaceName);
|
|
93539
|
+
if (!workspace || opened.liveSessionId !== liveSessionId)
|
|
93540
|
+
throw new TmuxServerScopeError("stale-generation");
|
|
93541
|
+
const snapshot3 = await owner.terminalInventoryRuntime.discoverTerminalRuntimeSession(
|
|
93542
|
+
workspace.sessionName,
|
|
93543
|
+
c.req.raw.signal
|
|
93544
|
+
);
|
|
93545
|
+
if (!snapshot3) return null;
|
|
93546
|
+
const inventory = projectTerminalRuntimeInventoryV2(snapshot3, 0);
|
|
93547
|
+
const selection = chooseAttachSelection(inventory, request3.preferredPane, request3.maxPanes);
|
|
93548
|
+
if (!selection)
|
|
93549
|
+
return { kind: "attached", opened, inventory, selection, issue: null };
|
|
93550
|
+
const stream = { ...request3.issue.stream };
|
|
93551
|
+
delete stream.semanticWindowId;
|
|
93552
|
+
const body = {
|
|
93553
|
+
...request3.issue,
|
|
93554
|
+
stream: {
|
|
93555
|
+
...stream,
|
|
93556
|
+
workspaceName: opened.workspaceName,
|
|
93557
|
+
panes: selection.panes,
|
|
93558
|
+
...selection.semanticWindowId ? { semanticWindowId: selection.semanticWindowId } : {}
|
|
93559
|
+
}
|
|
93560
|
+
};
|
|
93561
|
+
const issueApp = new Hono2();
|
|
93562
|
+
mountPaneStreamIssueRoute(issueApp, {
|
|
93563
|
+
daemonInstanceId: server.generation,
|
|
93564
|
+
ownerToken: options.ownerToken,
|
|
93565
|
+
workspaceRegistry: owner.workspaceRegistry,
|
|
93566
|
+
backend: owner.paneStreamRuntime.coordinator
|
|
93567
|
+
});
|
|
93568
|
+
const url = new URL(c.req.url);
|
|
93569
|
+
url.pathname = PANE_STREAM_ISSUE_PATH;
|
|
93570
|
+
url.search = "";
|
|
93571
|
+
const headers2 = new Headers(c.req.raw.headers);
|
|
93572
|
+
headers2.delete("Content-Length");
|
|
93573
|
+
headers2.set("Content-Type", "application/json");
|
|
93574
|
+
const issued = await issueApp.request(
|
|
93575
|
+
new Request(url, { method: "POST", headers: headers2, body: JSON.stringify(body) })
|
|
93576
|
+
);
|
|
93577
|
+
if (issued.status !== 200) return { kind: "refused", refused: issued };
|
|
93578
|
+
return {
|
|
93579
|
+
kind: "attached",
|
|
93580
|
+
opened,
|
|
93581
|
+
inventory,
|
|
93582
|
+
selection,
|
|
93583
|
+
issue: await issued.json()
|
|
93584
|
+
};
|
|
93585
|
+
});
|
|
93586
|
+
if (!result2) return c.json({ error: { code: "workspace-not-found" } }, 404);
|
|
93587
|
+
if (result2.kind === "refused") return result2.refused;
|
|
93588
|
+
return c.json({
|
|
93589
|
+
version: 1,
|
|
93590
|
+
server,
|
|
93591
|
+
workspaceName: result2.opened.workspaceName,
|
|
93592
|
+
liveSessionId,
|
|
93593
|
+
inventory: result2.inventory,
|
|
93594
|
+
selection: result2.selection,
|
|
93595
|
+
issue: result2.issue
|
|
93596
|
+
});
|
|
93597
|
+
})
|
|
93598
|
+
);
|
|
92909
93599
|
app.get(
|
|
92910
93600
|
`${scoped}/sessions`,
|
|
92911
93601
|
route(async (c) => {
|
|
@@ -93250,10 +93940,11 @@ var init_tmux_servers = __esm({
|
|
|
93250
93940
|
init_owner_authority();
|
|
93251
93941
|
init_log();
|
|
93252
93942
|
init_pane_stream_issue();
|
|
93943
|
+
init_tmux_server_attach();
|
|
93253
93944
|
init_terminal_runtime_inventory2();
|
|
93254
93945
|
SESSIONS_RESOURCE_FAVICON_BUDGET_BYTES = 512 * 1024;
|
|
93255
93946
|
registrationSchema = TmuxServerRegistrationSchemaZ.omit({ serverId: true }).strict();
|
|
93256
|
-
workspaceSchema =
|
|
93947
|
+
workspaceSchema = z137.string().min(1).max(160).refine((value) => !/[\0\r\n]/u.test(value));
|
|
93257
93948
|
}
|
|
93258
93949
|
});
|
|
93259
93950
|
|
|
@@ -93528,7 +94219,7 @@ var init_saved_machines3 = __esm({
|
|
|
93528
94219
|
|
|
93529
94220
|
// packages/daemon/src/command-center/resources/saved-machine-watch.ts
|
|
93530
94221
|
import { createHash as createHash29 } from "node:crypto";
|
|
93531
|
-
import { z as
|
|
94222
|
+
import { z as z138 } from "zod";
|
|
93532
94223
|
function snapshot2(value) {
|
|
93533
94224
|
const registry = SavedMachineRegistrySchema.parse(value);
|
|
93534
94225
|
return {
|
|
@@ -93634,16 +94325,16 @@ var init_saved_machine_watch = __esm({
|
|
|
93634
94325
|
init_owner_authority();
|
|
93635
94326
|
SAVED_MACHINE_WATCH_WAIT_MS = 2e4;
|
|
93636
94327
|
MAX_WATCHERS = 32;
|
|
93637
|
-
Query =
|
|
93638
|
-
expectedInstanceId:
|
|
93639
|
-
after:
|
|
94328
|
+
Query = z138.strictObject({
|
|
94329
|
+
expectedInstanceId: z138.uuid(),
|
|
94330
|
+
after: z138.string().regex(/^[a-f0-9]{64}$/u).optional()
|
|
93640
94331
|
});
|
|
93641
94332
|
}
|
|
93642
94333
|
});
|
|
93643
94334
|
|
|
93644
94335
|
// packages/daemon/src/command-center/resources/saved-machine-route.ts
|
|
93645
94336
|
import { bodyLimit as bodyLimit2 } from "hono/body-limit";
|
|
93646
|
-
import { z as
|
|
94337
|
+
import { z as z139 } from "zod";
|
|
93647
94338
|
function mountSavedMachineRoute(app, options) {
|
|
93648
94339
|
mountSavedMachineWatch(app, options);
|
|
93649
94340
|
const authorize = ownerAuthorityGate(options.ownerToken, {
|
|
@@ -93726,12 +94417,12 @@ var init_saved_machine_route = __esm({
|
|
|
93726
94417
|
init_saved_machines();
|
|
93727
94418
|
init_saved_machines3();
|
|
93728
94419
|
init_owner_authority();
|
|
93729
|
-
Request2 =
|
|
93730
|
-
expectedInstanceId:
|
|
94420
|
+
Request2 = z139.strictObject({
|
|
94421
|
+
expectedInstanceId: z139.uuid(),
|
|
93731
94422
|
registry: SavedMachineRegistrySchema
|
|
93732
94423
|
});
|
|
93733
|
-
MutationRequest =
|
|
93734
|
-
expectedInstanceId:
|
|
94424
|
+
MutationRequest = z139.strictObject({
|
|
94425
|
+
expectedInstanceId: z139.uuid(),
|
|
93735
94426
|
change: SavedMachineMutationSchema
|
|
93736
94427
|
});
|
|
93737
94428
|
}
|
|
@@ -93908,74 +94599,74 @@ var init_semantic_multiplexer_actions = __esm({
|
|
|
93908
94599
|
});
|
|
93909
94600
|
|
|
93910
94601
|
// packages/daemon/src/command-center/schemas.ts
|
|
93911
|
-
import { z as
|
|
94602
|
+
import { z as z140 } from "zod";
|
|
93912
94603
|
var updateTaskSchema, createTaskSchema, savePlanSchema, savePlanContentSchema, sendCommandSchema, createMilestoneSchema, updateMilestoneSchema, updateAssertionSchema, triggerResearchSchema, launchSchema, stopSchema, skillNameRegex, createSkillSchema, updateSkillSchema;
|
|
93913
94604
|
var init_schemas = __esm({
|
|
93914
94605
|
"packages/daemon/src/command-center/schemas.ts"() {
|
|
93915
94606
|
"use strict";
|
|
93916
|
-
updateTaskSchema =
|
|
93917
|
-
status:
|
|
93918
|
-
assignee:
|
|
93919
|
-
title:
|
|
93920
|
-
description:
|
|
93921
|
-
priority:
|
|
94607
|
+
updateTaskSchema = z140.object({
|
|
94608
|
+
status: z140.enum(["todo", "in-progress", "review", "done"]).optional(),
|
|
94609
|
+
assignee: z140.string().optional(),
|
|
94610
|
+
title: z140.string().optional(),
|
|
94611
|
+
description: z140.string().optional(),
|
|
94612
|
+
priority: z140.number().optional()
|
|
93922
94613
|
});
|
|
93923
|
-
createTaskSchema =
|
|
93924
|
-
title:
|
|
93925
|
-
description:
|
|
93926
|
-
priority:
|
|
93927
|
-
goal:
|
|
93928
|
-
tags:
|
|
94614
|
+
createTaskSchema = z140.object({
|
|
94615
|
+
title: z140.string().trim().min(1, "Title is required"),
|
|
94616
|
+
description: z140.string().optional(),
|
|
94617
|
+
priority: z140.number().optional(),
|
|
94618
|
+
goal: z140.string().optional(),
|
|
94619
|
+
tags: z140.array(z140.string()).optional()
|
|
93929
94620
|
});
|
|
93930
|
-
savePlanSchema =
|
|
93931
|
-
content:
|
|
94621
|
+
savePlanSchema = z140.object({
|
|
94622
|
+
content: z140.string().max(1e6, "Plan content is too large")
|
|
93932
94623
|
});
|
|
93933
|
-
savePlanContentSchema =
|
|
93934
|
-
content:
|
|
94624
|
+
savePlanContentSchema = z140.object({
|
|
94625
|
+
content: z140.string().max(1e6, "Plan content is too large")
|
|
93935
94626
|
});
|
|
93936
|
-
sendCommandSchema =
|
|
93937
|
-
target:
|
|
93938
|
-
message:
|
|
93939
|
-
noEnter:
|
|
94627
|
+
sendCommandSchema = z140.object({
|
|
94628
|
+
target: z140.string().min(1, "Target pane is required"),
|
|
94629
|
+
message: z140.string().min(1, "Message is required"),
|
|
94630
|
+
noEnter: z140.boolean().optional()
|
|
93940
94631
|
});
|
|
93941
|
-
createMilestoneSchema =
|
|
93942
|
-
title:
|
|
93943
|
-
sequence:
|
|
93944
|
-
description:
|
|
94632
|
+
createMilestoneSchema = z140.object({
|
|
94633
|
+
title: z140.string().trim().min(1, "Title is required"),
|
|
94634
|
+
sequence: z140.number().int().positive(),
|
|
94635
|
+
description: z140.string().optional()
|
|
93945
94636
|
});
|
|
93946
|
-
updateMilestoneSchema =
|
|
93947
|
-
status:
|
|
93948
|
-
title:
|
|
93949
|
-
description:
|
|
94637
|
+
updateMilestoneSchema = z140.object({
|
|
94638
|
+
status: z140.enum(["locked", "active", "done", "validating"]).optional(),
|
|
94639
|
+
title: z140.string().optional(),
|
|
94640
|
+
description: z140.string().optional()
|
|
93950
94641
|
});
|
|
93951
|
-
updateAssertionSchema =
|
|
93952
|
-
status:
|
|
93953
|
-
evidence:
|
|
93954
|
-
verifiedBy:
|
|
94642
|
+
updateAssertionSchema = z140.object({
|
|
94643
|
+
status: z140.enum(["pending", "passing", "failing", "blocked"]),
|
|
94644
|
+
evidence: z140.string().optional(),
|
|
94645
|
+
verifiedBy: z140.string().optional()
|
|
93955
94646
|
});
|
|
93956
|
-
triggerResearchSchema =
|
|
93957
|
-
type:
|
|
94647
|
+
triggerResearchSchema = z140.object({
|
|
94648
|
+
type: z140.string().trim().min(1, "Research type is required")
|
|
93958
94649
|
});
|
|
93959
|
-
launchSchema =
|
|
93960
|
-
attach:
|
|
94650
|
+
launchSchema = z140.object({
|
|
94651
|
+
attach: z140.boolean().optional()
|
|
93961
94652
|
}).optional();
|
|
93962
|
-
stopSchema =
|
|
94653
|
+
stopSchema = z140.object({}).optional();
|
|
93963
94654
|
skillNameRegex = /^[A-Za-z0-9._ -]+$/;
|
|
93964
|
-
createSkillSchema =
|
|
93965
|
-
name:
|
|
94655
|
+
createSkillSchema = z140.object({
|
|
94656
|
+
name: z140.string().trim().min(1, "Skill name is required").regex(
|
|
93966
94657
|
skillNameRegex,
|
|
93967
94658
|
"Skill name may only contain letters, digits, dot, dash, underscore, or space"
|
|
93968
94659
|
),
|
|
93969
|
-
role:
|
|
93970
|
-
description:
|
|
93971
|
-
specialties:
|
|
93972
|
-
body:
|
|
94660
|
+
role: z140.string().trim().optional(),
|
|
94661
|
+
description: z140.string().optional(),
|
|
94662
|
+
specialties: z140.array(z140.string()).optional(),
|
|
94663
|
+
body: z140.string().optional()
|
|
93973
94664
|
});
|
|
93974
|
-
updateSkillSchema =
|
|
93975
|
-
role:
|
|
93976
|
-
description:
|
|
93977
|
-
specialties:
|
|
93978
|
-
body:
|
|
94665
|
+
updateSkillSchema = z140.object({
|
|
94666
|
+
role: z140.string().trim().optional(),
|
|
94667
|
+
description: z140.string().optional(),
|
|
94668
|
+
specialties: z140.array(z140.string()).optional(),
|
|
94669
|
+
body: z140.string().optional()
|
|
93979
94670
|
});
|
|
93980
94671
|
}
|
|
93981
94672
|
});
|
|
@@ -95991,10 +96682,10 @@ async function mutateConfigAction(input, deps2, fn) {
|
|
|
95991
96682
|
cause: err
|
|
95992
96683
|
});
|
|
95993
96684
|
}
|
|
95994
|
-
const
|
|
96685
|
+
const message2 = err.message ?? String(err);
|
|
95995
96686
|
throw new ActionError({
|
|
95996
|
-
code:
|
|
95997
|
-
message,
|
|
96687
|
+
code: message2.toLowerCase().includes("path") ? "config_path_invalid" : "config_validation_failed",
|
|
96688
|
+
message: message2,
|
|
95998
96689
|
cause: err
|
|
95999
96690
|
});
|
|
96000
96691
|
}
|
|
@@ -97189,64 +97880,64 @@ var init_project_init_runner = __esm({
|
|
|
97189
97880
|
});
|
|
97190
97881
|
|
|
97191
97882
|
// packages/daemon/src/schemas/inspect.ts
|
|
97192
|
-
import { z as
|
|
97883
|
+
import { z as z141 } from "zod";
|
|
97193
97884
|
var ProjectInspectDetectedSchemaZ, ProjectInspectSchemaZ, InspectFilesystemRequestSchemaZ, OnboardProjectRequestSchemaZ;
|
|
97194
97885
|
var init_inspect = __esm({
|
|
97195
97886
|
"packages/daemon/src/schemas/inspect.ts"() {
|
|
97196
97887
|
"use strict";
|
|
97197
|
-
ProjectInspectDetectedSchemaZ =
|
|
97888
|
+
ProjectInspectDetectedSchemaZ = z141.object({
|
|
97198
97889
|
/** Detected package manager from lockfile, or `null`. */
|
|
97199
|
-
packageManager:
|
|
97890
|
+
packageManager: z141.enum(["pnpm", "npm", "yarn", "bun"]).nullable(),
|
|
97200
97891
|
/** Detected frameworks (e.g. `["next", "convex"]`). Empty array when none. */
|
|
97201
|
-
frameworks:
|
|
97892
|
+
frameworks: z141.array(z141.string()),
|
|
97202
97893
|
/** Suggested dev command (e.g. `pnpm dev`). `null` if no dev script found. */
|
|
97203
|
-
devCommand:
|
|
97894
|
+
devCommand: z141.string().nullable(),
|
|
97204
97895
|
/** Suggested test command (e.g. `pnpm test`). `null` if no test script found. */
|
|
97205
|
-
testCommand:
|
|
97896
|
+
testCommand: z141.string().nullable()
|
|
97206
97897
|
});
|
|
97207
|
-
ProjectInspectSchemaZ =
|
|
97898
|
+
ProjectInspectSchemaZ = z141.object({
|
|
97208
97899
|
/** Sanitized basename of the directory — safe to use as a tmux session name. */
|
|
97209
|
-
name:
|
|
97900
|
+
name: z141.string(),
|
|
97210
97901
|
/** Absolute, canonical path to the directory. */
|
|
97211
|
-
dir:
|
|
97902
|
+
dir: z141.string(),
|
|
97212
97903
|
/** Whether `<dir>/ide.yml` exists. Legacy compatibility fact. */
|
|
97213
|
-
hasIdeYml:
|
|
97904
|
+
hasIdeYml: z141.boolean(),
|
|
97214
97905
|
/** Whether `.tmux-ide/workspace.yml` exists or wins discovery. */
|
|
97215
|
-
hasWorkspaceConfig:
|
|
97906
|
+
hasWorkspaceConfig: z141.boolean().optional(),
|
|
97216
97907
|
/** Generalized winning config kind. Added without replacing `hasIdeYml`. */
|
|
97217
|
-
configKind:
|
|
97908
|
+
configKind: z141.enum(["workspace", "legacy", "none"]).optional(),
|
|
97218
97909
|
/** Generalized winning config path. Added without replacing legacy path facts. */
|
|
97219
|
-
configPath:
|
|
97910
|
+
configPath: z141.string().nullable().optional(),
|
|
97220
97911
|
/** Legacy config path when an `ide.yml` is present. */
|
|
97221
|
-
ideConfigPath:
|
|
97912
|
+
ideConfigPath: z141.string().nullable().optional(),
|
|
97222
97913
|
/** Git remote origin URL, or `null` if not a git repo / no origin / probe failed. */
|
|
97223
|
-
gitOrigin:
|
|
97914
|
+
gitOrigin: z141.string().nullable(),
|
|
97224
97915
|
/** Current git branch, or `null` if not a git repo / detached HEAD / probe failed. */
|
|
97225
|
-
gitBranch:
|
|
97916
|
+
gitBranch: z141.string().nullable(),
|
|
97226
97917
|
/** Detected stack signals (reuses `tmux-ide detect` logic). */
|
|
97227
97918
|
detected: ProjectInspectDetectedSchemaZ
|
|
97228
97919
|
});
|
|
97229
|
-
InspectFilesystemRequestSchemaZ =
|
|
97230
|
-
dir:
|
|
97920
|
+
InspectFilesystemRequestSchemaZ = z141.object({
|
|
97921
|
+
dir: z141.string().min(1)
|
|
97231
97922
|
});
|
|
97232
|
-
OnboardProjectRequestSchemaZ =
|
|
97233
|
-
dir:
|
|
97923
|
+
OnboardProjectRequestSchemaZ = z141.object({
|
|
97924
|
+
dir: z141.string().min(1),
|
|
97234
97925
|
/** Optional override for the project name — defaults to inspect.name. */
|
|
97235
|
-
name:
|
|
97926
|
+
name: z141.string().min(1).optional(),
|
|
97236
97927
|
/** 1, 2, or 3 — how many Claude panes to scaffold in the top row. */
|
|
97237
|
-
agents:
|
|
97928
|
+
agents: z141.number().int().min(1).max(3),
|
|
97238
97929
|
/**
|
|
97239
97930
|
* Optional per-agent pane titles. When provided, length must equal
|
|
97240
97931
|
* `agents`; the server uses these as `title:` for the Claude panes
|
|
97241
97932
|
* instead of the canonical `Lead`/`Teammate N`/`Claude N` defaults.
|
|
97242
97933
|
*/
|
|
97243
|
-
agentNames:
|
|
97934
|
+
agentNames: z141.array(z141.string().min(1)).optional(),
|
|
97244
97935
|
/** Dev server command (e.g. `pnpm dev`). Omit / null to skip the dev pane. */
|
|
97245
|
-
devCommand:
|
|
97936
|
+
devCommand: z141.string().min(1).nullable().optional(),
|
|
97246
97937
|
/** Test command (e.g. `pnpm test`). Currently informational; stored for later. */
|
|
97247
|
-
testCommand:
|
|
97938
|
+
testCommand: z141.string().min(1).nullable().optional(),
|
|
97248
97939
|
/** Lint command (e.g. `pnpm lint`). Currently informational; stored for later. */
|
|
97249
|
-
lintCommand:
|
|
97940
|
+
lintCommand: z141.string().min(1).nullable().optional()
|
|
97250
97941
|
});
|
|
97251
97942
|
}
|
|
97252
97943
|
});
|
|
@@ -97628,8 +98319,8 @@ var init_project_onboard = __esm({
|
|
|
97628
98319
|
};
|
|
97629
98320
|
OnboardInvalidInputError = class extends Error {
|
|
97630
98321
|
code = "INVALID_INPUT";
|
|
97631
|
-
constructor(
|
|
97632
|
-
super(
|
|
98322
|
+
constructor(message2) {
|
|
98323
|
+
super(message2);
|
|
97633
98324
|
this.name = "OnboardInvalidInputError";
|
|
97634
98325
|
}
|
|
97635
98326
|
};
|
|
@@ -98133,23 +98824,23 @@ var init_workspace_files_authority = __esm({
|
|
|
98133
98824
|
const parentRel = segments.join("/");
|
|
98134
98825
|
return parentRel === "" ? rootId : this.ids.intern(parentRel);
|
|
98135
98826
|
}
|
|
98136
|
-
catalogUnavailable(reason,
|
|
98827
|
+
catalogUnavailable(reason, message2, retryable = false) {
|
|
98137
98828
|
return WorkspaceFilesCatalogResourceV1SchemaZ.parse({
|
|
98138
98829
|
status: "unavailable",
|
|
98139
98830
|
workspaceName: this.workspaceName,
|
|
98140
98831
|
reason,
|
|
98141
|
-
message,
|
|
98832
|
+
message: message2,
|
|
98142
98833
|
retryable
|
|
98143
98834
|
});
|
|
98144
98835
|
}
|
|
98145
|
-
previewUnavailable(fileId, reason,
|
|
98836
|
+
previewUnavailable(fileId, reason, message2, retryable = false) {
|
|
98146
98837
|
return WorkspaceFilePreviewResourceV1SchemaZ.parse({
|
|
98147
98838
|
status: "unavailable",
|
|
98148
98839
|
workspaceName: this.workspaceName,
|
|
98149
98840
|
catalogRevision: filesRevision(`unavailable:${fileId}`),
|
|
98150
98841
|
fileId,
|
|
98151
98842
|
reason,
|
|
98152
|
-
message,
|
|
98843
|
+
message: message2,
|
|
98153
98844
|
retryable
|
|
98154
98845
|
});
|
|
98155
98846
|
}
|
|
@@ -98776,23 +99467,23 @@ var init_workspace_changes_authority = __esm({
|
|
|
98776
99467
|
const source = raw.group === "staged" ? staged : unstaged;
|
|
98777
99468
|
return source.get(raw.path) ?? { additions: 0, deletions: 0, binary: false };
|
|
98778
99469
|
}
|
|
98779
|
-
catalogUnavailable(reason,
|
|
99470
|
+
catalogUnavailable(reason, message2, retryable = false) {
|
|
98780
99471
|
return WorkspaceChangesCatalogResourceV1SchemaZ.parse({
|
|
98781
99472
|
status: "unavailable",
|
|
98782
99473
|
workspaceName: this.workspaceName,
|
|
98783
99474
|
reason,
|
|
98784
|
-
message,
|
|
99475
|
+
message: message2,
|
|
98785
99476
|
retryable
|
|
98786
99477
|
});
|
|
98787
99478
|
}
|
|
98788
|
-
diffUnavailable(changeId, reason,
|
|
99479
|
+
diffUnavailable(changeId, reason, message2, retryable = false) {
|
|
98789
99480
|
return WorkspaceChangeDiffResourceV1SchemaZ.parse({
|
|
98790
99481
|
status: "unavailable",
|
|
98791
99482
|
workspaceName: this.workspaceName,
|
|
98792
99483
|
changesRevision: changesRevision(`unavailable:${changeId}`),
|
|
98793
99484
|
changeId,
|
|
98794
99485
|
reason,
|
|
98795
|
-
message,
|
|
99486
|
+
message: message2,
|
|
98796
99487
|
retryable
|
|
98797
99488
|
});
|
|
98798
99489
|
}
|
|
@@ -99064,7 +99755,7 @@ var init_application_shell_app_windows = __esm({
|
|
|
99064
99755
|
|
|
99065
99756
|
// packages/daemon/src/command-center/plugin-routes.ts
|
|
99066
99757
|
import { bodyLimit as bodyLimit3 } from "hono/body-limit";
|
|
99067
|
-
import { z as
|
|
99758
|
+
import { z as z142 } from "zod";
|
|
99068
99759
|
function ownerOnlyNonBrowserGuard(ownerToken) {
|
|
99069
99760
|
const authorize = ownerAuthorityGate(ownerToken, {
|
|
99070
99761
|
whenOwnerless: "unavailable",
|
|
@@ -99128,11 +99819,11 @@ var init_plugin_routes = __esm({
|
|
|
99128
99819
|
"packages/daemon/src/command-center/plugin-routes.ts"() {
|
|
99129
99820
|
"use strict";
|
|
99130
99821
|
init_owner_authority();
|
|
99131
|
-
ReloadRequestZ =
|
|
99132
|
-
RunRequestZ =
|
|
99133
|
-
code:
|
|
99134
|
-
chunkName:
|
|
99135
|
-
budgetMs:
|
|
99822
|
+
ReloadRequestZ = z142.strictObject({ name: z142.string().min(1).max(64).optional() });
|
|
99823
|
+
RunRequestZ = z142.strictObject({
|
|
99824
|
+
code: z142.string().max(1024 * 1024),
|
|
99825
|
+
chunkName: z142.string().min(1).max(200).regex(/^[=@][^\0\n]*$/u).optional(),
|
|
99826
|
+
budgetMs: z142.number().int().min(10).max(6e5).optional()
|
|
99136
99827
|
});
|
|
99137
99828
|
}
|
|
99138
99829
|
});
|
|
@@ -99707,8 +100398,8 @@ var init_mission_projections2 = __esm({
|
|
|
99707
100398
|
init_mission_repository();
|
|
99708
100399
|
MissionProjectionError = class extends IdeError {
|
|
99709
100400
|
projectionCode;
|
|
99710
|
-
constructor(
|
|
99711
|
-
super(
|
|
100401
|
+
constructor(message2, code2, { cause } = {}) {
|
|
100402
|
+
super(message2, { code: code2, cause });
|
|
99712
100403
|
this.name = "MissionProjectionError";
|
|
99713
100404
|
this.projectionCode = code2;
|
|
99714
100405
|
}
|
|
@@ -100422,6 +101113,29 @@ var init_workspace_missions_route = __esm({
|
|
|
100422
101113
|
}
|
|
100423
101114
|
});
|
|
100424
101115
|
|
|
101116
|
+
// packages/daemon/src/command-center/owner-keep-alive.ts
|
|
101117
|
+
function ownerKeepAlive(ownerToken, timeoutMs = OWNER_KEEP_ALIVE_MS) {
|
|
101118
|
+
return async (c, next) => {
|
|
101119
|
+
const bindings = c.env;
|
|
101120
|
+
const outgoing = bindings?.outgoing;
|
|
101121
|
+
const socket = bindings?.incoming?.socket;
|
|
101122
|
+
if (outgoing && socket && ownerBearerMatches(c.req.header("Authorization"), ownerToken)) {
|
|
101123
|
+
outgoing.once("finish", () => {
|
|
101124
|
+
if (!socket.destroyed && outgoing.shouldKeepAlive) socket.setTimeout(timeoutMs);
|
|
101125
|
+
});
|
|
101126
|
+
}
|
|
101127
|
+
await next();
|
|
101128
|
+
};
|
|
101129
|
+
}
|
|
101130
|
+
var OWNER_KEEP_ALIVE_MS;
|
|
101131
|
+
var init_owner_keep_alive = __esm({
|
|
101132
|
+
"packages/daemon/src/command-center/owner-keep-alive.ts"() {
|
|
101133
|
+
"use strict";
|
|
101134
|
+
init_owner_authority();
|
|
101135
|
+
OWNER_KEEP_ALIVE_MS = 65e3;
|
|
101136
|
+
}
|
|
101137
|
+
});
|
|
101138
|
+
|
|
100425
101139
|
// packages/daemon/src/command-center/diagnostics.ts
|
|
100426
101140
|
import { performance as performance2 } from "node:perf_hooks";
|
|
100427
101141
|
function sampleDaemonDiagnostics(daemon) {
|
|
@@ -100922,8 +101636,8 @@ var init_widget_asset_store = __esm({
|
|
|
100922
101636
|
MAX_ASSET_FILES = 256;
|
|
100923
101637
|
ASSET_DIRECTORY = "widget-assets";
|
|
100924
101638
|
WidgetAssetStoreError = class extends Error {
|
|
100925
|
-
constructor(code2,
|
|
100926
|
-
super(
|
|
101639
|
+
constructor(code2, message2) {
|
|
101640
|
+
super(message2);
|
|
100927
101641
|
this.code = code2;
|
|
100928
101642
|
this.name = "WidgetAssetStoreError";
|
|
100929
101643
|
}
|
|
@@ -100949,7 +101663,7 @@ import { Hono as Hono3 } from "hono";
|
|
|
100949
101663
|
import { streamSSE as streamSSE3 } from "hono/streaming";
|
|
100950
101664
|
import { cors } from "hono/cors";
|
|
100951
101665
|
import { zValidator } from "@hono/zod-validator";
|
|
100952
|
-
import { z as
|
|
101666
|
+
import { z as z143 } from "zod";
|
|
100953
101667
|
import { realpathSync as realpathSync29 } from "node:fs";
|
|
100954
101668
|
import { homedir as homedir9 } from "node:os";
|
|
100955
101669
|
import { isAbsolute as isAbsolute34, resolve as pathResolve } from "node:path";
|
|
@@ -100999,7 +101713,7 @@ function requireHostCapability(ownerToken) {
|
|
|
100999
101713
|
if (denied) return denied;
|
|
101000
101714
|
markActionOwnerAuthorized(c);
|
|
101001
101715
|
}
|
|
101002
|
-
if (requirement === "owner-and-operation-id" && !
|
|
101716
|
+
if (requirement === "owner-and-operation-id" && !z143.uuid().safeParse(c.req.header("X-Tmux-Ide-Operation-Id")).success) {
|
|
101003
101717
|
return c.json({ error: "A stable host operation id is required" }, 400);
|
|
101004
101718
|
}
|
|
101005
101719
|
return next();
|
|
@@ -101109,6 +101823,7 @@ function createApp(options = {}) {
|
|
|
101109
101823
|
const healthBootedAt = Date.now();
|
|
101110
101824
|
const app = new Hono3();
|
|
101111
101825
|
app.use("/*", cors());
|
|
101826
|
+
app.use("/*", ownerKeepAlive(options.remoteAccess?.ownerToken ?? null));
|
|
101112
101827
|
if (options.tmuxServerOwners) {
|
|
101113
101828
|
mountAutomationRoutes(app, {
|
|
101114
101829
|
ownerToken: options.remoteAccess?.ownerToken ?? null,
|
|
@@ -101201,7 +101916,7 @@ function createApp(options = {}) {
|
|
|
101201
101916
|
} catch {
|
|
101202
101917
|
return c.json({ error: "Invalid capability request" }, 400);
|
|
101203
101918
|
}
|
|
101204
|
-
if (!
|
|
101919
|
+
if (!z143.object({}).strict().safeParse(body).success) {
|
|
101205
101920
|
return c.json({ error: "Invalid capability request" }, 400);
|
|
101206
101921
|
}
|
|
101207
101922
|
const appWindowCommandRegistered = daemonActionCommandRegistry.descriptors().some(({ id: id2 }) => id2 === "workspace.app-window.mutate");
|
|
@@ -101823,7 +102538,7 @@ function createApp(options = {}) {
|
|
|
101823
102538
|
const name = c.req.param("name");
|
|
101824
102539
|
const session = lookupSession(name);
|
|
101825
102540
|
if (typeof session === "string") return sessionMissing(c, session);
|
|
101826
|
-
const { target, message, noEnter } = c.req.valid("json");
|
|
102541
|
+
const { target, message: message2, noEnter } = c.req.valid("json");
|
|
101827
102542
|
const panes = listSessionPanes(name);
|
|
101828
102543
|
const pane = resolvePane(panes, target);
|
|
101829
102544
|
if (!pane) {
|
|
@@ -101836,7 +102551,7 @@ function createApp(options = {}) {
|
|
|
101836
102551
|
return c.json({ error: "Pane not found", target, available }, 404);
|
|
101837
102552
|
}
|
|
101838
102553
|
const busyStatus = getPaneBusyStatus(name, pane.id);
|
|
101839
|
-
const prepared = busyStatus === "agent" ?
|
|
102554
|
+
const prepared = busyStatus === "agent" ? message2.replace(/\n+/g, " ").trim() : message2;
|
|
101840
102555
|
if (noEnter) {
|
|
101841
102556
|
sendText(name, pane.id, prepared);
|
|
101842
102557
|
} else {
|
|
@@ -101873,8 +102588,8 @@ function createApp(options = {}) {
|
|
|
101873
102588
|
ideConfigPath: resolved2.resolution.legacyConfigPath
|
|
101874
102589
|
});
|
|
101875
102590
|
} catch (err) {
|
|
101876
|
-
const
|
|
101877
|
-
return c.json({ error: "Failed to read workspace config", detail:
|
|
102591
|
+
const message2 = err instanceof Error ? err.message : String(err);
|
|
102592
|
+
return c.json({ error: "Failed to read workspace config", detail: message2 }, 500);
|
|
101878
102593
|
}
|
|
101879
102594
|
});
|
|
101880
102595
|
app.post("/api/project/:name/config", async (c) => {
|
|
@@ -101905,8 +102620,8 @@ function createApp(options = {}) {
|
|
|
101905
102620
|
ideConfigPath: resolved2.resolution.legacyConfigPath
|
|
101906
102621
|
});
|
|
101907
102622
|
} catch (err) {
|
|
101908
|
-
const
|
|
101909
|
-
return c.json({ error: "Failed to write workspace config", detail:
|
|
102623
|
+
const message2 = err instanceof Error ? err.message : String(err);
|
|
102624
|
+
return c.json({ error: "Failed to write workspace config", detail: message2 }, 500);
|
|
101910
102625
|
}
|
|
101911
102626
|
});
|
|
101912
102627
|
const execFileAsync2 = promisify4(execFile15);
|
|
@@ -101922,8 +102637,8 @@ function createApp(options = {}) {
|
|
|
101922
102637
|
});
|
|
101923
102638
|
return c.json({ ok: true, session: name, status: "restarted" });
|
|
101924
102639
|
} catch (err) {
|
|
101925
|
-
const
|
|
101926
|
-
return c.json({ error: "Restart failed", detail:
|
|
102640
|
+
const message2 = err instanceof Error ? err.message : String(err);
|
|
102641
|
+
return c.json({ error: "Restart failed", detail: message2 }, 500);
|
|
101927
102642
|
}
|
|
101928
102643
|
});
|
|
101929
102644
|
app.post("/api/project/:name/launch", async (c) => {
|
|
@@ -101943,8 +102658,8 @@ function createApp(options = {}) {
|
|
|
101943
102658
|
});
|
|
101944
102659
|
return c.json({ ok: true, session: name, status: "launched" });
|
|
101945
102660
|
} catch (err) {
|
|
101946
|
-
const
|
|
101947
|
-
return c.json({ error: "Launch failed", detail:
|
|
102661
|
+
const message2 = err instanceof Error ? err.message : String(err);
|
|
102662
|
+
return c.json({ error: "Launch failed", detail: message2 }, 500);
|
|
101948
102663
|
}
|
|
101949
102664
|
});
|
|
101950
102665
|
app.post("/api/project/:name/stop", async (c) => {
|
|
@@ -102319,6 +103034,7 @@ var init_server2 = __esm({
|
|
|
102319
103034
|
init_fleet_resource_route();
|
|
102320
103035
|
init_workspace_missions_route();
|
|
102321
103036
|
init_owner_authority();
|
|
103037
|
+
init_owner_keep_alive();
|
|
102322
103038
|
init_diagnostics();
|
|
102323
103039
|
init_startup_readiness_route();
|
|
102324
103040
|
init_widget_asset_store();
|
|
@@ -102620,11 +103336,11 @@ function takeoverTimeoutMs() {
|
|
|
102620
103336
|
const override = globalThis[TAKEOVER_DEADLINE_TEST_OVERRIDE];
|
|
102621
103337
|
return typeof override === "number" ? override : TAKEOVER_TIMEOUT_MS;
|
|
102622
103338
|
}
|
|
102623
|
-
function throwTakeoverTimeout(
|
|
102624
|
-
throw new DaemonStartupError(
|
|
103339
|
+
function throwTakeoverTimeout(message2) {
|
|
103340
|
+
throw new DaemonStartupError(message2, "canonical_takeover_timeout");
|
|
102625
103341
|
}
|
|
102626
|
-
function assertTakeoverDeadline(deadline,
|
|
102627
|
-
if (deadline.signal.aborted || deadline.remainingMs() <= 0) throwTakeoverTimeout(
|
|
103342
|
+
function assertTakeoverDeadline(deadline, message2) {
|
|
103343
|
+
if (deadline.signal.aborted || deadline.remainingMs() <= 0) throwTakeoverTimeout(message2);
|
|
102628
103344
|
}
|
|
102629
103345
|
async function waitForTakeoverPoll(deadline) {
|
|
102630
103346
|
assertTakeoverDeadline(deadline, "Canonical daemon did not quiesce before the takeover deadline");
|
|
@@ -105597,10 +106313,10 @@ async function openBrowser(url, options = {}, dependencies = {}) {
|
|
|
105597
106313
|
url,
|
|
105598
106314
|
options
|
|
105599
106315
|
);
|
|
105600
|
-
const
|
|
105601
|
-
if (
|
|
106316
|
+
const message2 = await nativeControlsNotice(run, result2.pane, executable, dependencies.wait);
|
|
106317
|
+
if (message2)
|
|
105602
106318
|
(dependencies.notice ?? ((line) => process.stderr.write(`${line}
|
|
105603
|
-
`)))(
|
|
106319
|
+
`)))(message2);
|
|
105604
106320
|
return result2;
|
|
105605
106321
|
}
|
|
105606
106322
|
function createPinnedBrowserPane(executable, url, options) {
|
|
@@ -106041,7 +106757,7 @@ import {
|
|
|
106041
106757
|
import { randomUUID as randomUUID53 } from "node:crypto";
|
|
106042
106758
|
import { dirname as dirname49, join as join65 } from "node:path";
|
|
106043
106759
|
import { homedir as homedir11 } from "node:os";
|
|
106044
|
-
import { z as
|
|
106760
|
+
import { z as z144 } from "zod";
|
|
106045
106761
|
function defaults() {
|
|
106046
106762
|
const namespace = resolveRuntimeNamespace();
|
|
106047
106763
|
return {
|
|
@@ -106063,8 +106779,8 @@ function defaults() {
|
|
|
106063
106779
|
waitMs: 3e4
|
|
106064
106780
|
};
|
|
106065
106781
|
}
|
|
106066
|
-
function refused(
|
|
106067
|
-
throw new IdeError(
|
|
106782
|
+
function refused(message2) {
|
|
106783
|
+
throw new IdeError(message2, { code: "DAEMON_SERVICE_REFUSED" });
|
|
106068
106784
|
}
|
|
106069
106785
|
function ownedFile(path2) {
|
|
106070
106786
|
let descriptor;
|
|
@@ -106251,11 +106967,11 @@ var init_daemon_service = __esm({
|
|
|
106251
106967
|
init_runtime_namespace();
|
|
106252
106968
|
init_errors2();
|
|
106253
106969
|
init_private_operation_lock();
|
|
106254
|
-
RecordSchema =
|
|
106255
|
-
version:
|
|
106256
|
-
removing:
|
|
106257
|
-
executable:
|
|
106258
|
-
contents:
|
|
106970
|
+
RecordSchema = z144.strictObject({
|
|
106971
|
+
version: z144.literal(1),
|
|
106972
|
+
removing: z144.boolean().optional(),
|
|
106973
|
+
executable: z144.string().min(1),
|
|
106974
|
+
contents: z144.string().min(1).max(64 * 1024)
|
|
106259
106975
|
});
|
|
106260
106976
|
}
|
|
106261
106977
|
});
|
|
@@ -106399,7 +107115,7 @@ var init_restart_canonical_daemon = __esm({
|
|
|
106399
107115
|
else signal.addEventListener("abort", abort, { once: true });
|
|
106400
107116
|
})
|
|
106401
107117
|
};
|
|
106402
|
-
failure2 = (code2,
|
|
107118
|
+
failure2 = (code2, message2) => new IdeError(message2, { code: code2 });
|
|
106403
107119
|
}
|
|
106404
107120
|
});
|
|
106405
107121
|
|
|
@@ -107199,12 +107915,11 @@ function tmuxServerSocketRow(environment, uid) {
|
|
|
107199
107915
|
};
|
|
107200
107916
|
}
|
|
107201
107917
|
function nodeVersionRow(version) {
|
|
107202
|
-
const
|
|
107203
|
-
const pass = Number.isInteger(major) && major >= 20;
|
|
107918
|
+
const pass = isSupportedNodeVersion(version);
|
|
107204
107919
|
return {
|
|
107205
|
-
label:
|
|
107920
|
+
label: `Node.js \u2265 ${MINIMUM_NODE_MAJOR}`,
|
|
107206
107921
|
pass,
|
|
107207
|
-
detail: pass ? `v${version}` : `Node ${version} (need \u2265
|
|
107922
|
+
detail: pass ? `v${version}` : `Node ${version} (need \u2265 ${MINIMUM_NODE_MAJOR})`,
|
|
107208
107923
|
optional: false
|
|
107209
107924
|
};
|
|
107210
107925
|
}
|
|
@@ -107405,6 +108120,7 @@ var init_doctor = __esm({
|
|
|
107405
108120
|
init_claude();
|
|
107406
108121
|
init_notify();
|
|
107407
108122
|
init_resolved_config();
|
|
108123
|
+
init_node_requirement();
|
|
107408
108124
|
init_daemon_provenance();
|
|
107409
108125
|
DAY_MS = 24 * 60 * 60 * 1e3;
|
|
107410
108126
|
}
|
|
@@ -107821,9 +108537,9 @@ __export(ssh_daemon_transport_exports, {
|
|
|
107821
108537
|
});
|
|
107822
108538
|
import { spawn as spawn12 } from "node:child_process";
|
|
107823
108539
|
import { createServer as createServer4 } from "node:net";
|
|
107824
|
-
import { z as
|
|
107825
|
-
function failure3(
|
|
107826
|
-
return new SshConnectionError(
|
|
108540
|
+
import { z as z145 } from "zod";
|
|
108541
|
+
function failure3(message2, code2 = "unavailable") {
|
|
108542
|
+
return new SshConnectionError(message2, code2);
|
|
107827
108543
|
}
|
|
107828
108544
|
function observeSshFailure(child) {
|
|
107829
108545
|
let tail = "";
|
|
@@ -108102,20 +108818,20 @@ var init_ssh_daemon_transport = __esm({
|
|
|
108102
108818
|
init_remote_tmux_command();
|
|
108103
108819
|
init_ssh_daemon_relay();
|
|
108104
108820
|
init_src2();
|
|
108105
|
-
RemoteDaemonHandshakeSchema =
|
|
108106
|
-
version:
|
|
108821
|
+
RemoteDaemonHandshakeSchema = z145.object({
|
|
108822
|
+
version: z145.literal(1),
|
|
108107
108823
|
daemon: CanonicalDaemonInfoSchema.strict().extend({
|
|
108108
|
-
bindHostname:
|
|
108109
|
-
authToken:
|
|
108824
|
+
bindHostname: z145.enum(["127.0.0.1", "localhost", "::1", "0.0.0.0", "::"]),
|
|
108825
|
+
authToken: z145.string().min(1).max(4096)
|
|
108110
108826
|
})
|
|
108111
108827
|
}).strict();
|
|
108112
|
-
RemoteDaemonHandshakeFailureSchema =
|
|
108113
|
-
version:
|
|
108114
|
-
error:
|
|
108828
|
+
RemoteDaemonHandshakeFailureSchema = z145.strictObject({
|
|
108829
|
+
version: z145.literal(1),
|
|
108830
|
+
error: z145.strictObject({ code: z145.enum(["daemon-missing", "incompatible", "unavailable"]) })
|
|
108115
108831
|
});
|
|
108116
108832
|
SshConnectionError = class extends Error {
|
|
108117
|
-
constructor(
|
|
108118
|
-
super(`SSH daemon connection: ${
|
|
108833
|
+
constructor(message2, code2 = "unavailable") {
|
|
108834
|
+
super(`SSH daemon connection: ${message2}`);
|
|
108119
108835
|
this.code = code2;
|
|
108120
108836
|
}
|
|
108121
108837
|
code;
|
|
@@ -108185,8 +108901,8 @@ var init_remote_daemon_info = __esm({
|
|
|
108185
108901
|
init_canonical_daemon();
|
|
108186
108902
|
init_ssh_daemon_transport();
|
|
108187
108903
|
RemoteDaemonInfoError = class extends Error {
|
|
108188
|
-
constructor(
|
|
108189
|
-
super(
|
|
108904
|
+
constructor(message2, code2) {
|
|
108905
|
+
super(message2);
|
|
108190
108906
|
this.code = code2;
|
|
108191
108907
|
}
|
|
108192
108908
|
code;
|
|
@@ -108427,7 +109143,7 @@ import {
|
|
|
108427
109143
|
import { hostname as hostname4, tmpdir as tmpdir2 } from "node:os";
|
|
108428
109144
|
import { dirname as dirname52, join as join68 } from "node:path";
|
|
108429
109145
|
import { createInterface as createInterface3 } from "node:readline/promises";
|
|
108430
|
-
import { z as
|
|
109146
|
+
import { z as z146 } from "zod";
|
|
108431
109147
|
function targetSocket(target, environment = process.env) {
|
|
108432
109148
|
if (target.socketPath && target.socketName)
|
|
108433
109149
|
throw new IdeError("Pass --socket-path or --socket-name, not both.", {
|
|
@@ -108583,9 +109299,9 @@ function readWorkerResult(path2) {
|
|
|
108583
109299
|
}
|
|
108584
109300
|
}
|
|
108585
109301
|
function writeWorkerResult(path2, result2) {
|
|
108586
|
-
const { status: status2, message, restored, failed } = result2;
|
|
109302
|
+
const { status: status2, message: message2, restored, failed } = result2;
|
|
108587
109303
|
const temporary = `${path2}.${process.pid}.tmp`;
|
|
108588
|
-
writeFileSync31(temporary, JSON.stringify({ status: status2, message, restored, failed }) + "\n", {
|
|
109304
|
+
writeFileSync31(temporary, JSON.stringify({ status: status2, message: message2, restored, failed }) + "\n", {
|
|
108589
109305
|
mode: 384
|
|
108590
109306
|
});
|
|
108591
109307
|
renameSync23(temporary, path2);
|
|
@@ -108859,23 +109575,23 @@ var init_io = __esm({
|
|
|
108859
109575
|
init_plan();
|
|
108860
109576
|
UPGRADE_HOLD_SESSION = "_tmux-ide-upgrade";
|
|
108861
109577
|
NO_SERVER = /no server running|error connecting|failed to connect|connection refused/u;
|
|
108862
|
-
ServerIdentitySchemaZ =
|
|
108863
|
-
host:
|
|
108864
|
-
socketPath:
|
|
108865
|
-
pid:
|
|
108866
|
-
startTime:
|
|
108867
|
-
version:
|
|
108868
|
-
executable:
|
|
108869
|
-
features:
|
|
109578
|
+
ServerIdentitySchemaZ = z146.object({
|
|
109579
|
+
host: z146.string(),
|
|
109580
|
+
socketPath: z146.string().min(1),
|
|
109581
|
+
pid: z146.number().int().positive(),
|
|
109582
|
+
startTime: z146.number().int().nonnegative(),
|
|
109583
|
+
version: z146.string(),
|
|
109584
|
+
executable: z146.string(),
|
|
109585
|
+
features: z146.enum(["full", "stock", "older", "partial", "unknown"])
|
|
108870
109586
|
}).strict();
|
|
108871
|
-
WorkerStateSchemaZ =
|
|
109587
|
+
WorkerStateSchemaZ = z146.object({
|
|
108872
109588
|
server: ServerIdentitySchemaZ,
|
|
108873
|
-
client:
|
|
108874
|
-
snapshotPath:
|
|
108875
|
-
resumeAgents:
|
|
109589
|
+
client: z146.string().min(1),
|
|
109590
|
+
snapshotPath: z146.string().min(1),
|
|
109591
|
+
resumeAgents: z146.boolean()
|
|
108876
109592
|
}).strict();
|
|
108877
|
-
WorkerResultSchemaZ =
|
|
108878
|
-
status:
|
|
109593
|
+
WorkerResultSchemaZ = z146.object({
|
|
109594
|
+
status: z146.enum([
|
|
108879
109595
|
"already-full",
|
|
108880
109596
|
"preview",
|
|
108881
109597
|
"declined",
|
|
@@ -108884,9 +109600,9 @@ var init_io = __esm({
|
|
|
108884
109600
|
"upgraded",
|
|
108885
109601
|
"failed"
|
|
108886
109602
|
]),
|
|
108887
|
-
message:
|
|
108888
|
-
restored:
|
|
108889
|
-
failed:
|
|
109603
|
+
message: z146.string(),
|
|
109604
|
+
restored: z146.array(z146.string()).optional(),
|
|
109605
|
+
failed: z146.array(z146.string()).optional()
|
|
108890
109606
|
});
|
|
108891
109607
|
}
|
|
108892
109608
|
});
|
|
@@ -109093,7 +109809,7 @@ var init_run = __esm({
|
|
|
109093
109809
|
init_errors2();
|
|
109094
109810
|
init_plan();
|
|
109095
109811
|
retryCommand = (snapshotPath2, resumeAgents) => `tmux-ide restore --from ${snapshotPath2}${resumeAgents ? " --resume-agents" : ""}`;
|
|
109096
|
-
nothingChanged = (
|
|
109812
|
+
nothingChanged = (message2, code2) => new IdeError(`${message2} Nothing was stopped.`, { code: code2, exitCode: 1 });
|
|
109097
109813
|
}
|
|
109098
109814
|
});
|
|
109099
109815
|
|
|
@@ -110576,7 +111292,7 @@ __export(automation_exports, {
|
|
|
110576
111292
|
resolveAutomationIntent: () => resolveAutomationIntent,
|
|
110577
111293
|
runAutomationCli: () => runAutomationCli
|
|
110578
111294
|
});
|
|
110579
|
-
import { z as
|
|
111295
|
+
import { z as z147 } from "zod";
|
|
110580
111296
|
import { execFileSync as execFileSync26 } from "node:child_process";
|
|
110581
111297
|
import { parseArgs } from "node:util";
|
|
110582
111298
|
function invokingPaneCredential(env = process.env) {
|
|
@@ -110743,7 +111459,7 @@ var init_automation2 = __esm({
|
|
|
110743
111459
|
return { ...super.toJSON(), handle: this.handle };
|
|
110744
111460
|
}
|
|
110745
111461
|
};
|
|
110746
|
-
AutomationInvocationIntentSchemaZ =
|
|
111462
|
+
AutomationInvocationIntentSchemaZ = z147.discriminatedUnion("kind", [
|
|
110747
111463
|
AutomationOperationIntentSchemaZ.options[0].extend({
|
|
110748
111464
|
source: AutomationOperationIntentSchemaZ.options[0].shape.source.optional()
|
|
110749
111465
|
}),
|
|
@@ -111202,8 +111918,8 @@ async function callDaemon(io, method, path2, body) {
|
|
|
111202
111918
|
throw new PluginCliError(`The daemon answered ${response3.status} without JSON`);
|
|
111203
111919
|
}
|
|
111204
111920
|
if (!response3.ok) {
|
|
111205
|
-
const
|
|
111206
|
-
throw new PluginCliError(
|
|
111921
|
+
const message2 = payload && typeof payload === "object" && "error" in payload ? String(payload.error) : `HTTP ${response3.status}`;
|
|
111922
|
+
throw new PluginCliError(message2);
|
|
111207
111923
|
}
|
|
111208
111924
|
return payload;
|
|
111209
111925
|
}
|
|
@@ -111641,8 +112357,8 @@ var init_cli2 = __esm({
|
|
|
111641
112357
|
init_protocol();
|
|
111642
112358
|
PluginCliError = class extends Error {
|
|
111643
112359
|
exitCode;
|
|
111644
|
-
constructor(
|
|
111645
|
-
super(
|
|
112360
|
+
constructor(message2, exitCode = 1) {
|
|
112361
|
+
super(message2);
|
|
111646
112362
|
this.name = "PluginCliError";
|
|
111647
112363
|
this.exitCode = exitCode;
|
|
111648
112364
|
}
|
|
@@ -111902,7 +112618,7 @@ __export(mcp_exports, {
|
|
|
111902
112618
|
});
|
|
111903
112619
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
111904
112620
|
import { serveStdio, StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
111905
|
-
import { z as
|
|
112621
|
+
import { z as z148 } from "zod";
|
|
111906
112622
|
async function call(work) {
|
|
111907
112623
|
try {
|
|
111908
112624
|
return result(await work());
|
|
@@ -111925,7 +112641,7 @@ function createTmuxIdeMcpServer(client) {
|
|
|
111925
112641
|
"tmux_panes",
|
|
111926
112642
|
{
|
|
111927
112643
|
description: "Discover current panes across this daemon's tmux servers. Use returned endpoint objects unchanged; names and native pane numbers are not unique identities.",
|
|
111928
|
-
inputSchema:
|
|
112644
|
+
inputSchema: z148.object({}).strict(),
|
|
111929
112645
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
111930
112646
|
},
|
|
111931
112647
|
async (_args, context) => call(() => client.discover({ signal: context.mcpReq.signal }))
|
|
@@ -111934,7 +112650,7 @@ function createTmuxIdeMcpServer(client) {
|
|
|
111934
112650
|
"tmux_prepare",
|
|
111935
112651
|
{
|
|
111936
112652
|
description: "Prepare a read or send and receive a generation-fenced operation handle. This does not send input. Save the handle before executing. Omit source to resolve this MCP process\u2019s verified pane automatically, or use source:null for an unbound caller. Save the returned intent unchanged with the handle.",
|
|
111937
|
-
inputSchema:
|
|
112653
|
+
inputSchema: z148.object({ intent: AutomationInvocationIntentSchemaZ }).strict(),
|
|
111938
112654
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
111939
112655
|
},
|
|
111940
112656
|
async ({ intent }, context) => call(async () => {
|
|
@@ -111951,7 +112667,7 @@ function createTmuxIdeMcpServer(client) {
|
|
|
111951
112667
|
"tmux_execute",
|
|
111952
112668
|
{
|
|
111953
112669
|
description: "Execute a prepared read or send using its exact handle and unchanged intent. Sends may run terminal commands. On uncertainty, check status or retry this same handle; never prepare another operation. Read text is returned once; replay returns metadata only. A completed send is command completion, not proof the recipient consumed it.",
|
|
111954
|
-
inputSchema:
|
|
112670
|
+
inputSchema: z148.object({
|
|
111955
112671
|
handle: AutomationOperationHandleSchemaZ,
|
|
111956
112672
|
intent: AutomationOperationIntentSchemaZ
|
|
111957
112673
|
}).strict(),
|
|
@@ -111963,7 +112679,7 @@ function createTmuxIdeMcpServer(client) {
|
|
|
111963
112679
|
"tmux_operation_status",
|
|
111964
112680
|
{
|
|
111965
112681
|
description: "Look up a prepared operation without repeating its effect. Status contains no sent or captured text. Outcome-unknown includes expired retention and must not be interpreted as not executed.",
|
|
111966
|
-
inputSchema:
|
|
112682
|
+
inputSchema: z148.object({ handle: AutomationOperationHandleSchemaZ }).strict(),
|
|
111967
112683
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
111968
112684
|
},
|
|
111969
112685
|
async ({ handle }, context) => call(() => client.status(handle, { signal: context.mcpReq.signal }))
|
|
@@ -111972,9 +112688,9 @@ function createTmuxIdeMcpServer(client) {
|
|
|
111972
112688
|
"tmux_interactions",
|
|
111973
112689
|
{
|
|
111974
112690
|
description: "Read at most one batch of scoped interaction metadata, optionally waiting for new events. Carry the returned cursor into the next call. Gaps explicitly mean missing history; these events contain no terminal contents.",
|
|
111975
|
-
inputSchema:
|
|
112691
|
+
inputSchema: z148.object({
|
|
111976
112692
|
resume: TmuxInteractionCursorSchemaZ,
|
|
111977
|
-
waitMs:
|
|
112693
|
+
waitMs: z148.number().int().min(1).max(3e4).default(1e3)
|
|
111978
112694
|
}).strict(),
|
|
111979
112695
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
111980
112696
|
},
|
|
@@ -112662,8 +113378,8 @@ var init_worktree = __esm({
|
|
|
112662
113378
|
"use strict";
|
|
112663
113379
|
init_errors2();
|
|
112664
113380
|
WorktreeError = class extends IdeError {
|
|
112665
|
-
constructor(
|
|
112666
|
-
super(
|
|
113381
|
+
constructor(message2, code2) {
|
|
113382
|
+
super(message2, { code: code2, exitCode: 1 });
|
|
112667
113383
|
this.name = "WorktreeError";
|
|
112668
113384
|
}
|
|
112669
113385
|
};
|
|
@@ -112904,8 +113620,8 @@ function renderPlan2(plan, {
|
|
|
112904
113620
|
].join("\n");
|
|
112905
113621
|
}
|
|
112906
113622
|
function updateFailure(what, error) {
|
|
112907
|
-
const { status: status2, signal, message } = error;
|
|
112908
|
-
const how = typeof status2 === "number" ? `exited with status ${status2}` : typeof signal === "string" ? `was stopped by ${signal}` : `could not run (${String(
|
|
113623
|
+
const { status: status2, signal, message: message2 } = error;
|
|
113624
|
+
const how = typeof status2 === "number" ? `exited with status ${status2}` : typeof signal === "string" ? `was stopped by ${signal}` : `could not run (${String(message2).split("\n")[0]})`;
|
|
112909
113625
|
return new IdeError(
|
|
112910
113626
|
`The update did not finish: ${what} ${how}. Its own message is above. Retry with: tmux-ide update`,
|
|
112911
113627
|
{ code: "UPDATE_FAILED", cause: error instanceof Error ? error : void 0 }
|
|
@@ -113092,8 +113808,8 @@ var init_pane_widget = __esm({
|
|
|
113092
113808
|
"use strict";
|
|
113093
113809
|
init_src2();
|
|
113094
113810
|
PaneWidgetRefusal = class extends Error {
|
|
113095
|
-
constructor(reason,
|
|
113096
|
-
super(
|
|
113811
|
+
constructor(reason, message2) {
|
|
113812
|
+
super(message2);
|
|
113097
113813
|
this.reason = reason;
|
|
113098
113814
|
this.name = "PaneWidgetRefusal";
|
|
113099
113815
|
}
|
|
@@ -113219,6 +113935,14 @@ var init_server3 = __esm({
|
|
|
113219
113935
|
}
|
|
113220
113936
|
});
|
|
113221
113937
|
|
|
113938
|
+
// packages/daemon/src/lib/require-supported-node.ts
|
|
113939
|
+
init_node_requirement();
|
|
113940
|
+
var message = unsupportedNodeMessage(process.versions);
|
|
113941
|
+
if (message !== null) {
|
|
113942
|
+
process.stderr.write(message);
|
|
113943
|
+
process.exit(1);
|
|
113944
|
+
}
|
|
113945
|
+
|
|
113222
113946
|
// bin/cli.ts
|
|
113223
113947
|
init_src();
|
|
113224
113948
|
init_tmux_client_execution();
|
|
@@ -113581,7 +114305,7 @@ async function execBunWidget(surface, scriptPath, args, commandLabel, extraEnv =
|
|
|
113581
114305
|
compiledBinary: findCompiledTui(),
|
|
113582
114306
|
preferSource: process.env.TMUX_IDE_TUI_SOURCE === "1"
|
|
113583
114307
|
},
|
|
113584
|
-
{ log: (
|
|
114308
|
+
{ log: (message2) => process.stderr.write(`[tmux-ide] ${message2}
|
|
113585
114309
|
`) }
|
|
113586
114310
|
);
|
|
113587
114311
|
if (launch2.mode === "unavailable") {
|
|
@@ -113808,7 +114532,7 @@ async function runApp(appArgs) {
|
|
|
113808
114532
|
compiledBinary: findCompiledTui(),
|
|
113809
114533
|
preferSource: process.env.TMUX_IDE_TUI_SOURCE === "1"
|
|
113810
114534
|
},
|
|
113811
|
-
{ log: (
|
|
114535
|
+
{ log: (message2) => process.stderr.write(`[tmux-ide] ${message2}
|
|
113812
114536
|
`) }
|
|
113813
114537
|
);
|
|
113814
114538
|
try {
|
|
@@ -114242,12 +114966,12 @@ try {
|
|
|
114242
114966
|
case "send": {
|
|
114243
114967
|
const target = values.to ?? positionals[1];
|
|
114244
114968
|
const messageStart = values.to ? 1 : 2;
|
|
114245
|
-
let
|
|
114246
|
-
if (!
|
|
114969
|
+
let message2 = positionals.slice(messageStart).join(" ");
|
|
114970
|
+
if (!message2 && !process.stdin.isTTY) {
|
|
114247
114971
|
const { readFileSync: readFileSync50 } = await import("node:fs");
|
|
114248
|
-
|
|
114972
|
+
message2 = readFileSync50(0, "utf-8").trim();
|
|
114249
114973
|
}
|
|
114250
|
-
await (await Promise.resolve().then(() => (init_send(), send_exports))).send(null, { json: json2, to: target, message, noEnter: values["no-enter"] });
|
|
114974
|
+
await (await Promise.resolve().then(() => (init_send(), send_exports))).send(null, { json: json2, to: target, message: message2, noEnter: values["no-enter"] });
|
|
114251
114975
|
break;
|
|
114252
114976
|
}
|
|
114253
114977
|
case "settings": {
|
|
@@ -115185,9 +115909,9 @@ Known panels: ${POPUP_WIDGETS2.join(", ")}.`,
|
|
|
115185
115909
|
);
|
|
115186
115910
|
}
|
|
115187
115911
|
} catch (err) {
|
|
115188
|
-
const
|
|
115189
|
-
if (json2) console.log(JSON.stringify({ ok: false, error:
|
|
115190
|
-
else console.error(`manifest pack NOT installed: ${
|
|
115912
|
+
const message2 = err instanceof Error ? err.message : String(err);
|
|
115913
|
+
if (json2) console.log(JSON.stringify({ ok: false, error: message2 }, null, 2));
|
|
115914
|
+
else console.error(`manifest pack NOT installed: ${message2}`);
|
|
115191
115915
|
process.exitCode = 1;
|
|
115192
115916
|
}
|
|
115193
115917
|
break;
|
|
@@ -115288,11 +116012,11 @@ Known panels: ${POPUP_WIDGETS2.join(", ")}.`,
|
|
|
115288
116012
|
announcement = buildCardAnnouncement2(JSON.parse(source));
|
|
115289
116013
|
}
|
|
115290
116014
|
} catch (error) {
|
|
115291
|
-
const
|
|
116015
|
+
const message2 = error instanceof PaneWidgetRefusal2 || error instanceof WidgetAssetStoreError2 ? error.message : `The widget input could not be read: ${error.message}`;
|
|
115292
116016
|
if (json2) {
|
|
115293
|
-
console.log(JSON.stringify({ ok: false, error:
|
|
116017
|
+
console.log(JSON.stringify({ ok: false, error: message2 }, null, 2));
|
|
115294
116018
|
} else {
|
|
115295
|
-
console.error(
|
|
116019
|
+
console.error(message2);
|
|
115296
116020
|
}
|
|
115297
116021
|
process.exit(1);
|
|
115298
116022
|
}
|