tmux-ide 2.9.16 → 2.9.18

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.
Files changed (40) hide show
  1. package/bin/cli.js +913 -367
  2. package/package.json +1 -1
  3. package/packages/core/src/terminal-fnv64-wasm.ts +8 -1
  4. package/packages/core/src/terminal-replica-hash-cache.ts +108 -1
  5. package/packages/core/src/terminal-replica.ts +14 -0
  6. package/packages/daemon/dist/command-center/discovery.js +39 -6
  7. package/packages/daemon/dist/doctor.js +101 -2
  8. package/packages/daemon/dist/lib/catalog-fleet-read.js +10 -0
  9. package/packages/daemon/dist/lib/daemon-embed.js +18 -4
  10. package/packages/daemon/dist/lib/daemon-service.js +13 -5
  11. package/packages/daemon/dist/lib/native-split-capability.js +20 -0
  12. package/packages/daemon/dist/lib/tmux-server-owner.js +2 -1
  13. package/packages/daemon/dist/lib/tmux-server-owners.js +20 -1
  14. package/packages/daemon/dist/lib/tui-binary.js +83 -17
  15. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +2 -2
  16. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
  17. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/AppIcon.icns +0 -0
  18. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
  19. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +4 -4
  20. package/packages/daemon/dist/terminal/mirror/control-channel.js +3 -2
  21. package/packages/daemon/dist/terminal/mirror/mirror-service.js +47 -11
  22. package/packages/daemon/dist/terminal/mirror/session-channel.js +19 -4
  23. package/packages/daemon/dist/terminal/mirror/window-split-authority.js +9 -2
  24. package/packages/daemon/dist/terminal/protocol/native-split-resize.js +16 -16
  25. package/packages/daemon/dist/terminal/protocol/stock-split-resize.js +194 -0
  26. package/packages/daemon/src/command-center/discovery.ts +72 -7
  27. package/packages/daemon/src/doctor.ts +104 -2
  28. package/packages/daemon/src/lib/catalog-fleet-read.ts +40 -0
  29. package/packages/daemon/src/lib/daemon-embed.ts +31 -12
  30. package/packages/daemon/src/lib/daemon-service.ts +17 -4
  31. package/packages/daemon/src/lib/native-split-capability.ts +21 -0
  32. package/packages/daemon/src/lib/tmux-server-owner.ts +2 -0
  33. package/packages/daemon/src/lib/tmux-server-owners.ts +17 -1
  34. package/packages/daemon/src/lib/tui-binary.ts +114 -22
  35. package/packages/daemon/src/terminal/mirror/control-channel.ts +3 -2
  36. package/packages/daemon/src/terminal/mirror/mirror-service.ts +51 -12
  37. package/packages/daemon/src/terminal/mirror/session-channel.ts +23 -4
  38. package/packages/daemon/src/terminal/mirror/window-split-authority.ts +15 -4
  39. package/packages/daemon/src/terminal/protocol/native-split-resize.ts +16 -16
  40. package/packages/daemon/src/terminal/protocol/stock-split-resize.ts +268 -0
package/bin/cli.js CHANGED
@@ -1294,9 +1294,9 @@ function parseMacOSVersion(value) {
1294
1294
  throw new Error("Invalid bundled tmux macOS version metadata");
1295
1295
  return value.split(".").map(Number);
1296
1296
  }
1297
- function isMacOSVersionCompatible(current, minimum) {
1297
+ function isMacOSVersionCompatible(current, minimum2) {
1298
1298
  const actual = parseMacOSVersion(current);
1299
- const required = parseMacOSVersion(minimum);
1299
+ const required = parseMacOSVersion(minimum2);
1300
1300
  for (let index = 0; index < 3; index += 1) {
1301
1301
  const difference = (actual[index] ?? 0) - (required[index] ?? 0);
1302
1302
  if (difference !== 0) return difference > 0;
@@ -4775,16 +4775,16 @@ function projectAgentGraphOverlay(input) {
4775
4775
  }
4776
4776
  const edges = [];
4777
4777
  const seenEdges = /* @__PURE__ */ new Set();
4778
- for (const edge2 of input.edges) {
4779
- if (edge2.from === edge2.to) {
4778
+ for (const edge of input.edges) {
4779
+ if (edge.from === edge.to) {
4780
4780
  truncated = true;
4781
4781
  continue;
4782
4782
  }
4783
- if (!nodeIds.has(edge2.from) || !nodeIds.has(edge2.to)) {
4783
+ if (!nodeIds.has(edge.from) || !nodeIds.has(edge.to)) {
4784
4784
  truncated = true;
4785
4785
  continue;
4786
4786
  }
4787
- const key2 = `${edge2.kind}\0${edge2.from}\0${edge2.to}`;
4787
+ const key2 = `${edge.kind}\0${edge.from}\0${edge.to}`;
4788
4788
  if (seenEdges.has(key2)) {
4789
4789
  truncated = true;
4790
4790
  continue;
@@ -4794,7 +4794,7 @@ function projectAgentGraphOverlay(input) {
4794
4794
  continue;
4795
4795
  }
4796
4796
  seenEdges.add(key2);
4797
- edges.push({ from: edge2.from, to: edge2.to, kind: edge2.kind });
4797
+ edges.push({ from: edge.from, to: edge.to, kind: edge.kind });
4798
4798
  }
4799
4799
  const groups = [];
4800
4800
  const seenGroupIds = /* @__PURE__ */ new Set();
@@ -4897,22 +4897,22 @@ var init_agent_graph_overlay = __esm({
4897
4897
  }
4898
4898
  }
4899
4899
  const nodeIds = new Set(nodeEntries.map(([key2]) => key2));
4900
- for (const [index, edge2] of overlay.edges.entries()) {
4901
- if (edge2.from === edge2.to) {
4900
+ for (const [index, edge] of overlay.edges.entries()) {
4901
+ if (edge.from === edge.to) {
4902
4902
  ctx.addIssue({
4903
4903
  code: z27.ZodIssueCode.custom,
4904
4904
  message: "edge must not be a self-edge",
4905
4905
  path: ["edges", index]
4906
4906
  });
4907
4907
  }
4908
- if (!nodeIds.has(edge2.from)) {
4908
+ if (!nodeIds.has(edge.from)) {
4909
4909
  ctx.addIssue({
4910
4910
  code: z27.ZodIssueCode.custom,
4911
4911
  message: "edge references an unknown node",
4912
4912
  path: ["edges", index, "from"]
4913
4913
  });
4914
4914
  }
4915
- if (!nodeIds.has(edge2.to)) {
4915
+ if (!nodeIds.has(edge.to)) {
4916
4916
  ctx.addIssue({
4917
4917
  code: z27.ZodIssueCode.custom,
4918
4918
  message: "edge references an unknown node",
@@ -12403,7 +12403,10 @@ __export(tui_binary_exports, {
12403
12403
  MAX_TUI_COMPRESSED_BYTES: () => MAX_TUI_COMPRESSED_BYTES,
12404
12404
  MIN_TUI_BINARY_BYTES: () => MIN_TUI_BINARY_BYTES,
12405
12405
  RELEASE_REPO: () => RELEASE_REPO,
12406
- TUI_DOWNLOAD_TIMEOUT_MS: () => TUI_DOWNLOAD_TIMEOUT_MS,
12406
+ TUI_DOWNLOAD_MAX_ATTEMPTS: () => TUI_DOWNLOAD_MAX_ATTEMPTS,
12407
+ TUI_DOWNLOAD_RETRY_DELAY_MS: () => TUI_DOWNLOAD_RETRY_DELAY_MS,
12408
+ TUI_DOWNLOAD_STALL_TIMEOUT_MS: () => TUI_DOWNLOAD_STALL_TIMEOUT_MS,
12409
+ TUI_DOWNLOAD_TOTAL_TIMEOUT_MS: () => TUI_DOWNLOAD_TOTAL_TIMEOUT_MS,
12407
12410
  bunTargetForTag: () => bunTargetForTag,
12408
12411
  downloadTuiBinary: () => downloadTuiBinary,
12409
12412
  downloadedTuiPath: () => downloadedTuiPath,
@@ -12548,30 +12551,54 @@ function purgeCachedBinary(path2) {
12548
12551
  }
12549
12552
  }
12550
12553
  }
12551
- async function readBoundedResponse(fetchImpl, url, maxBytes, timeoutMs) {
12554
+ function isTransientHttpStatus(status2) {
12555
+ return status2 === 408 || status2 === 429 || status2 >= 500;
12556
+ }
12557
+ async function readBoundedResponse(fetchImpl, url, maxBytes, policy) {
12552
12558
  const controller = new AbortController();
12553
- const timer = setTimeout(() => controller.abort(), timeoutMs);
12559
+ let total = 0;
12560
+ let timeoutMessage = null;
12561
+ const abortWith = (message) => () => {
12562
+ timeoutMessage = message();
12563
+ controller.abort();
12564
+ };
12565
+ const overallTimer = setTimeout(
12566
+ abortWith(() => `download did not finish within ${policy.totalTimeoutMs}ms`),
12567
+ Math.max(0, policy.deadline - Date.now())
12568
+ );
12569
+ const onStall = abortWith(
12570
+ () => `download stalled: no data for ${policy.stallTimeoutMs}ms after ${total} bytes`
12571
+ );
12572
+ let stallTimer = setTimeout(onStall, policy.stallTimeoutMs);
12573
+ const markProgress = () => {
12574
+ clearTimeout(stallTimer);
12575
+ stallTimer = setTimeout(onStall, policy.stallTimeoutMs);
12576
+ };
12554
12577
  try {
12555
12578
  const response3 = await fetchImpl(url, { signal: controller.signal });
12556
12579
  if (!response3.ok) {
12557
- throw new Error(`HTTP ${response3.status} ${response3.statusText}`);
12580
+ const message = `HTTP ${response3.status} ${response3.statusText}`;
12581
+ if (isTransientHttpStatus(response3.status)) throw new Error(message);
12582
+ throw new PermanentDownloadError(message);
12558
12583
  }
12584
+ markProgress();
12559
12585
  const declaredLength = Number(response3.headers.get("content-length"));
12560
12586
  if (Number.isFinite(declaredLength) && declaredLength > maxBytes) {
12561
- throw new Error(`declared size ${declaredLength} exceeds ${maxBytes} bytes`);
12587
+ throw new PermanentDownloadError(`declared size ${declaredLength} exceeds ${maxBytes} bytes`);
12562
12588
  }
12563
12589
  if (!response3.body) throw new Error("response has no body");
12564
12590
  const chunks = [];
12565
- let total = 0;
12566
12591
  const reader = response3.body.getReader();
12567
12592
  try {
12568
12593
  while (true) {
12569
12594
  const { done, value } = await reader.read();
12570
12595
  if (done) break;
12596
+ if (value.byteLength === 0) continue;
12597
+ markProgress();
12571
12598
  total += value.byteLength;
12572
12599
  if (total > maxBytes) {
12573
12600
  await reader.cancel();
12574
- throw new Error(`download exceeds ${maxBytes} bytes`);
12601
+ throw new PermanentDownloadError(`download exceeds ${maxBytes} bytes`);
12575
12602
  }
12576
12603
  chunks.push(Buffer.from(value));
12577
12604
  }
@@ -12580,12 +12607,27 @@ async function readBoundedResponse(fetchImpl, url, maxBytes, timeoutMs) {
12580
12607
  }
12581
12608
  return Buffer.concat(chunks, total);
12582
12609
  } catch (error) {
12583
- if (controller.signal.aborted) {
12584
- throw new Error(`download timed out after ${timeoutMs}ms`, { cause: error });
12585
- }
12610
+ if (timeoutMessage) throw new Error(timeoutMessage, { cause: error });
12586
12611
  throw error;
12587
12612
  } finally {
12588
- clearTimeout(timer);
12613
+ clearTimeout(overallTimer);
12614
+ clearTimeout(stallTimer);
12615
+ controller.abort();
12616
+ }
12617
+ }
12618
+ async function readWithRetries(fetchImpl, url, maxBytes, policy, log) {
12619
+ for (let attempt = 1; ; attempt++) {
12620
+ try {
12621
+ return await readBoundedResponse(fetchImpl, url, maxBytes, policy);
12622
+ } catch (error) {
12623
+ const delayMs = policy.retryDelayMs * attempt;
12624
+ if (error instanceof PermanentDownloadError || attempt >= policy.maxAttempts || Date.now() + delayMs >= policy.deadline) {
12625
+ throw error;
12626
+ }
12627
+ const message = error instanceof Error ? error.message : String(error);
12628
+ log(`download attempt ${attempt}/${policy.maxAttempts} failed (${message}); retrying`);
12629
+ await new Promise((resolve45) => setTimeout(resolve45, delayMs));
12630
+ }
12589
12631
  }
12590
12632
  }
12591
12633
  async function downloadTuiBinary(opts = {}) {
@@ -12606,14 +12648,18 @@ async function downloadTuiBinary(opts = {}) {
12606
12648
  const limits = {
12607
12649
  minBinaryBytes: opts.limits?.minBinaryBytes ?? MIN_TUI_BINARY_BYTES,
12608
12650
  maxCompressedBytes: opts.limits?.maxCompressedBytes ?? MAX_TUI_COMPRESSED_BYTES,
12609
- maxBinaryBytes: opts.limits?.maxBinaryBytes ?? MAX_TUI_BINARY_BYTES,
12610
- timeoutMs: opts.timeoutMs ?? TUI_DOWNLOAD_TIMEOUT_MS
12651
+ maxBinaryBytes: opts.limits?.maxBinaryBytes ?? MAX_TUI_BINARY_BYTES
12611
12652
  };
12653
+ const totalTimeoutMs = opts.totalTimeoutMs ?? TUI_DOWNLOAD_TOTAL_TIMEOUT_MS;
12612
12654
  mkdirSync5(dirname9(dest), { recursive: true });
12655
+ const lockNotice = setTimeout(
12656
+ () => log("waiting for another tmux-ide download of this version to finish"),
12657
+ TUI_DOWNLOAD_LOCK_NOTICE_MS
12658
+ );
12613
12659
  const releaseLock = await acquirePrivateOperationLock(
12614
12660
  downloadLockPath(dest),
12615
- limits.timeoutMs * 2 + 5e3
12616
- );
12661
+ totalTimeoutMs + TUI_DOWNLOAD_LOCK_MARGIN_MS
12662
+ ).finally(() => clearTimeout(lockNotice));
12617
12663
  const suffix = `${process.pid}.${randomUUID2()}.tmp`;
12618
12664
  const binaryTmp = `${dest}.${suffix}`;
12619
12665
  const checksumTmp = `${checksumPath(dest)}.${suffix}`;
@@ -12622,21 +12668,31 @@ async function downloadTuiBinary(opts = {}) {
12622
12668
  if (cached2) return { path: dest, bytes: cached2.bytes };
12623
12669
  purgeCachedBinary(dest);
12624
12670
  const fetchImpl = opts.fetch ?? globalThis.fetch;
12671
+ const policy = {
12672
+ stallTimeoutMs: opts.stallTimeoutMs ?? TUI_DOWNLOAD_STALL_TIMEOUT_MS,
12673
+ deadline: Date.now() + totalTimeoutMs,
12674
+ totalTimeoutMs,
12675
+ maxAttempts: opts.maxAttempts ?? TUI_DOWNLOAD_MAX_ATTEMPTS,
12676
+ retryDelayMs: opts.retryDelayMs ?? TUI_DOWNLOAD_RETRY_DELAY_MS
12677
+ };
12625
12678
  log(`downloading checksum manifest ${checksumUrl}`);
12626
12679
  let manifestBytes;
12627
12680
  let gz;
12628
12681
  try {
12629
- manifestBytes = await readBoundedResponse(
12682
+ manifestBytes = await readWithRetries(
12630
12683
  fetchImpl,
12631
12684
  checksumUrl,
12632
12685
  MAX_CHECKSUM_MANIFEST_BYTES,
12633
- limits.timeoutMs
12686
+ policy,
12687
+ log
12634
12688
  );
12635
- gz = await readBoundedResponse(fetchImpl, url, limits.maxCompressedBytes, limits.timeoutMs);
12689
+ log(`downloading ${url}`);
12690
+ gz = await readWithRetries(fetchImpl, url, limits.maxCompressedBytes, policy, log);
12636
12691
  } catch (error) {
12637
12692
  const message = error instanceof Error ? error.message : String(error);
12693
+ 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.";
12638
12694
  throw new Error(
12639
- `could not download the TUI binary and checksum for v${version} (${message}). Check that the release published both exact-version assets.`,
12695
+ `could not download the TUI binary and checksum for v${version} (${message}). ${hint}`,
12640
12696
  { cause: error }
12641
12697
  );
12642
12698
  }
@@ -12681,7 +12737,7 @@ async function downloadTuiBinary(opts = {}) {
12681
12737
  releaseLock();
12682
12738
  }
12683
12739
  }
12684
- var RELEASE_REPO, MIN_TUI_BINARY_BYTES, MAX_TUI_COMPRESSED_BYTES, MAX_TUI_BINARY_BYTES, TUI_DOWNLOAD_TIMEOUT_MS, MAX_CHECKSUM_MANIFEST_BYTES, SUPPORTED;
12740
+ var RELEASE_REPO, MIN_TUI_BINARY_BYTES, MAX_TUI_COMPRESSED_BYTES, MAX_TUI_BINARY_BYTES, TUI_DOWNLOAD_STALL_TIMEOUT_MS, TUI_DOWNLOAD_TOTAL_TIMEOUT_MS, TUI_DOWNLOAD_MAX_ATTEMPTS, TUI_DOWNLOAD_RETRY_DELAY_MS, MAX_CHECKSUM_MANIFEST_BYTES, TUI_DOWNLOAD_LOCK_NOTICE_MS, TUI_DOWNLOAD_LOCK_MARGIN_MS, SUPPORTED, PermanentDownloadError;
12685
12741
  var init_tui_binary = __esm({
12686
12742
  "packages/daemon/src/lib/tui-binary.ts"() {
12687
12743
  "use strict";
@@ -12692,13 +12748,20 @@ var init_tui_binary = __esm({
12692
12748
  MIN_TUI_BINARY_BYTES = 10 * 1024 * 1024;
12693
12749
  MAX_TUI_COMPRESSED_BYTES = 128 * 1024 * 1024;
12694
12750
  MAX_TUI_BINARY_BYTES = 256 * 1024 * 1024;
12695
- TUI_DOWNLOAD_TIMEOUT_MS = 3e4;
12751
+ TUI_DOWNLOAD_STALL_TIMEOUT_MS = 3e4;
12752
+ TUI_DOWNLOAD_TOTAL_TIMEOUT_MS = 15 * 6e4;
12753
+ TUI_DOWNLOAD_MAX_ATTEMPTS = 3;
12754
+ TUI_DOWNLOAD_RETRY_DELAY_MS = 1e3;
12696
12755
  MAX_CHECKSUM_MANIFEST_BYTES = 4 * 1024;
12756
+ TUI_DOWNLOAD_LOCK_NOTICE_MS = 2e3;
12757
+ TUI_DOWNLOAD_LOCK_MARGIN_MS = 5e3;
12697
12758
  SUPPORTED = {
12698
12759
  "darwin-arm64": "darwin-arm64",
12699
12760
  "linux-x64": "linux-x64",
12700
12761
  "linux-arm64": "linux-arm64"
12701
12762
  };
12763
+ PermanentDownloadError = class extends Error {
12764
+ };
12702
12765
  }
12703
12766
  });
12704
12767
 
@@ -13082,7 +13145,7 @@ var require_package = __commonJS({
13082
13145
  "package.json"(exports, module) {
13083
13146
  module.exports = {
13084
13147
  name: "tmux-ide",
13085
- version: "2.9.16",
13148
+ version: "2.9.18",
13086
13149
  description: "The open-source workspace for coding agents: run Claude Code, Codex and other agents in tmux with live status",
13087
13150
  type: "module",
13088
13151
  bin: {
@@ -17413,19 +17476,19 @@ function pickBool2(value, fallback) {
17413
17476
  }
17414
17477
  function inQuietHours(now, quiet) {
17415
17478
  if (!quiet) return false;
17416
- const start2 = parseHHMM(quiet.start);
17479
+ const start3 = parseHHMM(quiet.start);
17417
17480
  const end = parseHHMM(quiet.end);
17418
- if (start2 === null || end === null || start2 === end) return false;
17481
+ if (start3 === null || end === null || start3 === end) return false;
17419
17482
  const nowMin = now.getHours() * 60 + now.getMinutes();
17420
- return start2 < end ? nowMin >= start2 && nowMin < end : nowMin >= start2 || nowMin < end;
17483
+ return start3 < end ? nowMin >= start3 && nowMin < end : nowMin >= start3 || nowMin < end;
17421
17484
  }
17422
17485
  function parseQuietHours(value) {
17423
17486
  const o = asObject2(value);
17424
- const start2 = typeof o.start === "string" ? o.start : null;
17487
+ const start3 = typeof o.start === "string" ? o.start : null;
17425
17488
  const end = typeof o.end === "string" ? o.end : null;
17426
- if (start2 === null || end === null) return null;
17427
- if (parseHHMM(start2) === null || parseHHMM(end) === null) return null;
17428
- return { start: start2, end };
17489
+ if (start3 === null || end === null) return null;
17490
+ if (parseHHMM(start3) === null || parseHHMM(end) === null) return null;
17491
+ return { start: start3, end };
17429
17492
  }
17430
17493
  function parseNotificationPrefs(rawConfig) {
17431
17494
  const base2 = parseAppConfig(rawConfig).notifications;
@@ -17932,7 +17995,7 @@ function writeChips(deps2, adopted, panes, theme) {
17932
17995
  writeChip(pane.paneId, chip);
17933
17996
  }
17934
17997
  }
17935
- function diffPaneTransitions(prev, panes, locate2) {
17998
+ function diffPaneTransitions(prev, panes, locate) {
17936
17999
  const events = [];
17937
18000
  const next = /* @__PURE__ */ new Map();
17938
18001
  for (const pane of panes) {
@@ -17947,7 +18010,7 @@ function diffPaneTransitions(prev, panes, locate2) {
17947
18010
  paneId: pane.paneId,
17948
18011
  windowIndex: pane.windowIndex,
17949
18012
  agent: pane.agent,
17950
- location: notifiable && locate2 ? locate2(pane.paneId) : pane.sessionName
18013
+ location: notifiable && locate ? locate(pane.paneId) : pane.sessionName
17951
18014
  });
17952
18015
  }
17953
18016
  prev.clear();
@@ -20699,12 +20762,12 @@ function decodeUtf8Strict(value, path2) {
20699
20762
  function isPromiseLike(value) {
20700
20763
  return (typeof value === "object" || typeof value === "function") && value !== null && "then" in value && typeof value.then === "function";
20701
20764
  }
20702
- function normalizeLockDuration(value, fallback, minimum, maximum, field) {
20765
+ function normalizeLockDuration(value, fallback, minimum2, maximum, field) {
20703
20766
  const resolved2 = value ?? fallback;
20704
- if (!Number.isSafeInteger(resolved2) || resolved2 < minimum || resolved2 > maximum) {
20767
+ if (!Number.isSafeInteger(resolved2) || resolved2 < minimum2 || resolved2 > maximum) {
20705
20768
  throw new InvalidJsonValueError(
20706
20769
  `$.${field}`,
20707
- `${field} must be an integer between ${minimum} and ${maximum}`
20770
+ `${field} must be an integer between ${minimum2} and ${maximum}`
20708
20771
  );
20709
20772
  }
20710
20773
  return resolved2;
@@ -22698,8 +22761,8 @@ async function resolveHarness(workspace, canonicalRoot, harnessProfileId) {
22698
22761
  harnessProfileId
22699
22762
  });
22700
22763
  }
22701
- const capability2 = matches[0];
22702
- if (capability2.kind === "shell" || capability2.installation !== "available" || capability2.commandReadiness !== "ready") {
22764
+ const capability = matches[0];
22765
+ if (capability.kind === "shell" || capability.installation !== "available" || capability.commandReadiness !== "ready") {
22703
22766
  throw new WorkspacePaneCreationError("harness_unavailable", {
22704
22767
  workspaceName: workspace.name,
22705
22768
  harnessProfileId
@@ -22707,9 +22770,9 @@ async function resolveHarness(workspace, canonicalRoot, harnessProfileId) {
22707
22770
  }
22708
22771
  const configured = configuredProfiles[harnessProfileId];
22709
22772
  const resolved2 = {
22710
- id: capability2.id,
22711
- label: capability2.label,
22712
- command: [...capability2.command],
22773
+ id: capability.id,
22774
+ label: capability.label,
22775
+ command: [...capability.command],
22713
22776
  environment: Object.freeze({ ...configured?.env ?? {} })
22714
22777
  };
22715
22778
  assertBoundedLaunch(resolved2);
@@ -25025,8 +25088,8 @@ async function clearAgentAuthority(paneId) {
25025
25088
  }
25026
25089
  function paneStartAndPath(paneId) {
25027
25090
  return tmuxRun(["display", "-p", "-t", paneId, "#{pane_start_command} #{pane_current_path}"]).then((out) => {
25028
- const [start2 = "", path2 = ""] = out.split(" ");
25029
- return { start: start2, path: path2 };
25091
+ const [start3 = "", path2 = ""] = out.split(" ");
25092
+ return { start: start3, path: path2 };
25030
25093
  }).catch(() => null);
25031
25094
  }
25032
25095
  async function stopAgent(paneId) {
@@ -26764,7 +26827,7 @@ function json(text2, limit) {
26764
26827
  throw new Error("Bounded native response required");
26765
26828
  return JSON.parse(text2);
26766
26829
  }
26767
- function capability(text2) {
26830
+ function nativeSplitCapability(text2) {
26768
26831
  const value = json(text2, 1024);
26769
26832
  return object(value, [
26770
26833
  "schemaVersion",
@@ -26777,12 +26840,12 @@ function capability(text2) {
26777
26840
  }
26778
26841
  async function supportsNativeSplitResize(runTmux2) {
26779
26842
  try {
26780
- return capability(await runTmux2(["tmux-ide-resize-split", "-V"]));
26843
+ return nativeSplitCapability(await runTmux2(["tmux-ide-resize-split", "-V"]));
26781
26844
  } catch {
26782
26845
  return false;
26783
26846
  }
26784
26847
  }
26785
- function validTree(tree) {
26848
+ function validSplitTree(tree) {
26786
26849
  let budget2 = 5;
26787
26850
  const visit = (node) => {
26788
26851
  if (node.left + node.width > 4096 || node.top + node.height > 4096) return false;
@@ -26796,7 +26859,7 @@ function validTree(tree) {
26796
26859
  };
26797
26860
  return visit(tree);
26798
26861
  }
26799
- function locate(tree, path2) {
26862
+ function locateSplit(tree, path2) {
26800
26863
  let node = tree;
26801
26864
  let parent;
26802
26865
  for (const index of path2) {
@@ -26806,13 +26869,13 @@ function locate(tree, path2) {
26806
26869
  }
26807
26870
  return parent && path2.at(-1) < parent.children.length - 1 ? { parent, node } : null;
26808
26871
  }
26809
- function edge(node, axis) {
26872
+ function splitEdge(node, axis) {
26810
26873
  return axis === "cols" ? node.left + node.width : node.top + node.height;
26811
26874
  }
26812
26875
  function sameRect(a, b) {
26813
26876
  return a.left === b.left && a.top === b.top && a.width === b.width && a.height === b.height;
26814
26877
  }
26815
- function preservesTree(before, after, affected, axis, inside = false) {
26878
+ function preservesSplitTree(before, after, affected, axis, inside = false) {
26816
26879
  const begins = before === affected;
26817
26880
  if (before.kind !== after.kind || (!inside || begins) && !sameRect(before, after)) return false;
26818
26881
  inside ||= begins;
@@ -26820,7 +26883,7 @@ function preservesTree(before, after, affected, axis, inside = false) {
26820
26883
  return false;
26821
26884
  if (before.kind === "leaf") return after.kind === "leaf" && before.id === after.id;
26822
26885
  return after.kind === "split" && before.axis === after.axis && before.children.length === after.children.length && before.children.every(
26823
- (child, index) => preservesTree(child, after.children[index], affected, axis, inside)
26886
+ (child, index) => preservesSplitTree(child, after.children[index], affected, axis, inside)
26824
26887
  );
26825
26888
  }
26826
26889
  async function resizeNativeSplit(request3, runTmux2) {
@@ -26829,8 +26892,8 @@ async function resizeNativeSplit(request3, runTmux2) {
26829
26892
  if (!object(request3, ["sessionId", "windowId", "expectedLayout", "path", "axis", "boundary"]) || typeof request3.sessionId !== "string" || !/^\$(0|[1-9][0-9]{0,9})$/.test(request3.sessionId) || Number(request3.sessionId.slice(1)) > 4294967295 || typeof request3.windowId !== "string" || !/^@(0|[1-9][0-9]{0,9})$/.test(request3.windowId) || Number(request3.windowId.slice(1)) > 4294967295 || typeof request3.expectedLayout !== "string" || !Array.isArray(request3.path) || request3.path.length < 1 || request3.path.length >= 64 || request3.path.some((index) => !Number.isInteger(index) || index < 0 || index > 511) || request3.path.join(".").length > 256 || request3.axis !== "cols" && request3.axis !== "rows" || !Number.isInteger(request3.boundary) || request3.boundary < 0 || request3.boundary > 4096)
26830
26893
  return { status: "refused", reason: "invalid-request" };
26831
26894
  const tree = parseLayoutTree(request3.expectedLayout);
26832
- if (!tree || !validTree(tree)) return { status: "refused", reason: "invalid-request" };
26833
- const selected = locate(tree, request3.path);
26895
+ if (!tree || !validSplitTree(tree)) return { status: "refused", reason: "invalid-request" };
26896
+ const selected = locateSplit(tree, request3.path);
26834
26897
  if (!selected || selected.parent.axis !== request3.axis)
26835
26898
  return { status: "refused", reason: "invalid-request" };
26836
26899
  before = tree;
@@ -26839,7 +26902,7 @@ async function resizeNativeSplit(request3, runTmux2) {
26839
26902
  return { status: "refused", reason: "invalid-request" };
26840
26903
  }
26841
26904
  try {
26842
- if (!capability(await runTmux2(["tmux-ide-resize-split", "-V"])))
26905
+ if (!nativeSplitCapability(await runTmux2(["tmux-ide-resize-split", "-V"])))
26843
26906
  return { status: "refused", reason: "unsupported" };
26844
26907
  } catch {
26845
26908
  return { status: "refused", reason: "unsupported" };
@@ -26869,10 +26932,10 @@ async function resizeNativeSplit(request3, runTmux2) {
26869
26932
  if (!object(receipt, ["schemaVersion", "boundary", "layout"]) || receipt.schemaVersion !== 1 || typeof receipt.layout !== "string" || typeof receipt.boundary !== "number" || !Number.isInteger(receipt.boundary) || receipt.boundary < 0 || receipt.boundary > 4096)
26870
26933
  return { status: "uncertain", reason: "invalid-receipt" };
26871
26934
  const after = parseLayoutTree(receipt.layout);
26872
- const original = locate(before, captured.path);
26873
- const actual = after && locate(after, captured.path);
26874
- const previous = edge(original.node, captured.axis);
26875
- if (!after || !validTree(after) || !actual || !preservesTree(before, after, original.parent, captured.axis) || receipt.boundary !== edge(actual.node, captured.axis) || receipt.boundary < Math.min(previous, captured.boundary) || receipt.boundary > Math.max(previous, captured.boundary))
26935
+ const original = locateSplit(before, captured.path);
26936
+ const actual = after && locateSplit(after, captured.path);
26937
+ const previous = splitEdge(original.node, captured.axis);
26938
+ if (!after || !validSplitTree(after) || !actual || !preservesSplitTree(before, after, original.parent, captured.axis) || receipt.boundary !== splitEdge(actual.node, captured.axis) || receipt.boundary < Math.min(previous, captured.boundary) || receipt.boundary > Math.max(previous, captured.boundary))
26876
26939
  return { status: "uncertain", reason: "invalid-receipt" };
26877
26940
  return {
26878
26941
  status: "applied",
@@ -26942,11 +27005,28 @@ function createNativeSplitReadiness(options) {
26942
27005
  pending = null;
26943
27006
  });
26944
27007
  }
27008
+ function createStockSplitProbe(options) {
27009
+ return async () => {
27010
+ for (const command3 of NATIVE_COMMANDS) {
27011
+ try {
27012
+ await options.runPinnedTmux([command3, "-V"]);
27013
+ return false;
27014
+ } catch (error) {
27015
+ const failure4 = error;
27016
+ const text2 = String(failure4?.cause?.stderr ?? failure4?.stderr ?? "");
27017
+ if (!new RegExp(`^unknown command: ${command3}$`, "mu").test(text2)) return false;
27018
+ }
27019
+ }
27020
+ return true;
27021
+ };
27022
+ }
27023
+ var NATIVE_COMMANDS;
26945
27024
  var init_native_split_capability = __esm({
26946
27025
  "packages/daemon/src/lib/native-split-capability.ts"() {
26947
27026
  "use strict";
26948
27027
  init_src2();
26949
27028
  init_native_split_resize();
27029
+ NATIVE_COMMANDS = ["tmux-ide-resize-split", "tmux-ide-events"];
26950
27030
  }
26951
27031
  });
26952
27032
 
@@ -27074,10 +27154,13 @@ function isVisibleFleetSession(name) {
27074
27154
  function readAdoptedSessionNames(runTmux2 = _tmuxRunner) {
27075
27155
  let raw;
27076
27156
  try {
27077
- raw = runTmux2(["list-sessions", "-F", `#{session_name} #{${ADOPTED_OPTION}}`]);
27157
+ raw = runTmux2(ADOPTED_SESSIONS_ARGS);
27078
27158
  } catch {
27079
27159
  return null;
27080
27160
  }
27161
+ return parseAdoptedSessionNames(raw);
27162
+ }
27163
+ function parseAdoptedSessionNames(raw) {
27081
27164
  const names = [];
27082
27165
  for (const line of raw.split("\n")) {
27083
27166
  if (!line) continue;
@@ -27096,16 +27179,51 @@ function readAdoptedFleet(registry = getDefaultWorkspaceRegistry(), runTmux2 = _
27096
27179
  const nativeEpoch = nativeServerEpoch?.() ?? null;
27097
27180
  const adopted = readAdoptedSessionNames(runTmux2);
27098
27181
  if (adopted === null) return null;
27099
- const adoptedSet = new Set(adopted);
27100
- if (adoptedSet.size === 0) return [];
27101
- const appCreatedSessions = new Set(registry.list().map((workspace) => workspace.sessionName));
27102
- const panesBySession = /* @__PURE__ */ new Map();
27182
+ if (adopted.length === 0) return [];
27183
+ let panesRaw;
27184
+ try {
27185
+ panesRaw = runTmux2(FLEET_PANES_ARGS);
27186
+ } catch {
27187
+ panesRaw = "";
27188
+ }
27189
+ return assembleAdoptedFleet(
27190
+ adopted,
27191
+ panesRaw,
27192
+ registry,
27193
+ nativeEpoch,
27194
+ resolveInteractionEndpoint,
27195
+ nativeServerEpoch
27196
+ );
27197
+ }
27198
+ async function readAdoptedFleetAsync(registry, runTmux2, resolveInteractionEndpoint, nativeServerEpoch) {
27199
+ const nativeEpoch = nativeServerEpoch?.() ?? null;
27200
+ let sessionsRaw;
27201
+ try {
27202
+ sessionsRaw = await runTmux2(ADOPTED_SESSIONS_ARGS);
27203
+ } catch {
27204
+ return null;
27205
+ }
27206
+ const adopted = parseAdoptedSessionNames(sessionsRaw);
27207
+ if (adopted.length === 0) return [];
27103
27208
  let panesRaw;
27104
27209
  try {
27105
- panesRaw = runTmux2(["list-panes", "-a", "-F", FLEET_PANE_FORMAT]);
27210
+ panesRaw = await runTmux2(FLEET_PANES_ARGS);
27106
27211
  } catch {
27107
27212
  panesRaw = "";
27108
27213
  }
27214
+ return assembleAdoptedFleet(
27215
+ adopted,
27216
+ panesRaw,
27217
+ registry,
27218
+ nativeEpoch,
27219
+ resolveInteractionEndpoint,
27220
+ nativeServerEpoch
27221
+ );
27222
+ }
27223
+ function assembleAdoptedFleet(adopted, panesRaw, registry, nativeEpoch, resolveInteractionEndpoint, nativeServerEpoch) {
27224
+ const adoptedSet = new Set(adopted);
27225
+ const appCreatedSessions = new Set(registry.list().map((workspace) => workspace.sessionName));
27226
+ const panesBySession = /* @__PURE__ */ new Map();
27109
27227
  for (const line of panesRaw.split("\n")) {
27110
27228
  if (!line) continue;
27111
27229
  const fields = line.split(FLEET_FIELD_SEPARATOR);
@@ -27193,7 +27311,7 @@ function buildProjectDetail(info) {
27193
27311
  panes: info.panes.map(({ semanticPaneId: _semanticPaneId, ...pane }) => pane)
27194
27312
  };
27195
27313
  }
27196
- var _tmuxRunner, FLEET_FIELD_SEPARATOR, FLEET_LINE_SENTINEL, FLEET_PANE_FORMAT;
27314
+ var _tmuxRunner, ADOPTED_SESSIONS_ARGS, FLEET_FIELD_SEPARATOR, FLEET_LINE_SENTINEL, FLEET_PANE_FORMAT, FLEET_PANES_ARGS;
27197
27315
  var init_discovery = __esm({
27198
27316
  "packages/daemon/src/command-center/discovery.ts"() {
27199
27317
  "use strict";
@@ -27210,6 +27328,7 @@ var init_discovery = __esm({
27210
27328
  maxBuffer: 1024 * 1024,
27211
27329
  stdio: ["ignore", "pipe", "ignore"]
27212
27330
  }).trim();
27331
+ ADOPTED_SESSIONS_ARGS = ["list-sessions", "-F", `#{session_name} #{${ADOPTED_OPTION}}`];
27213
27332
  FLEET_FIELD_SEPARATOR = "|tmux-ide-fleet-field-v1|";
27214
27333
  FLEET_LINE_SENTINEL = "tmux-ide-fleet-v1";
27215
27334
  FLEET_PANE_FORMAT = [
@@ -27231,6 +27350,7 @@ var init_discovery = __esm({
27231
27350
  "#{@tmux_ide_team}",
27232
27351
  FLEET_LINE_SENTINEL
27233
27352
  ].join(FLEET_FIELD_SEPARATOR);
27353
+ FLEET_PANES_ARGS = ["list-panes", "-a", "-F", FLEET_PANE_FORMAT];
27234
27354
  }
27235
27355
  });
27236
27356
 
@@ -28603,11 +28723,11 @@ var init_workspace_multiplexer_verbs = __esm({
28603
28723
  return null;
28604
28724
  }
28605
28725
  };
28606
- const record2 = (operation, start2) => {
28726
+ const record2 = (operation, start3) => {
28607
28727
  const end = now();
28608
- if (start2 !== null && end !== null) {
28728
+ if (start3 !== null && end !== null) {
28609
28729
  try {
28610
- timing?.record(operation, start2, end);
28730
+ timing?.record(operation, start3, end);
28611
28731
  } catch {
28612
28732
  }
28613
28733
  }
@@ -28738,9 +28858,9 @@ var init_workspace_multiplexer_verbs = __esm({
28738
28858
  reason: "pane_identity_changed_during_read"
28739
28859
  });
28740
28860
  }
28741
- let start2 = Math.max(0, bytes.byteLength - SESSION_RUNTIME_PANE_READ_MAX_BYTES);
28742
- while (start2 < bytes.byteLength && (bytes[start2] & 192) === 128) start2++;
28743
- const text2 = bytes.subarray(start2).toString("utf8");
28861
+ let start3 = Math.max(0, bytes.byteLength - SESSION_RUNTIME_PANE_READ_MAX_BYTES);
28862
+ while (start3 < bytes.byteLength && (bytes[start3] & 192) === 128) start3++;
28863
+ const text2 = bytes.subarray(start3).toString("utf8");
28744
28864
  return SessionRuntimePaneReadResultSchemaZ.parse({
28745
28865
  verb: "workspace.pane.read",
28746
28866
  operationId,
@@ -28750,9 +28870,9 @@ var init_workspace_multiplexer_verbs = __esm({
28750
28870
  format: "ansi",
28751
28871
  availability: "available",
28752
28872
  text: text2,
28753
- byteCount: bytes.byteLength - start2,
28873
+ byteCount: bytes.byteLength - start3,
28754
28874
  capturedByteCount: bytes.byteLength,
28755
- truncated: start2 > 0
28875
+ truncated: start3 > 0
28756
28876
  });
28757
28877
  }
28758
28878
  dispose() {
@@ -29403,7 +29523,7 @@ var init_workspace_multiplexer_verbs = __esm({
29403
29523
  /** Optional metadata path; null alone permits pre-dispatch stock fallback. */
29404
29524
  #runAuthored(operationId, execution, pane, expectedKinds, commands2, dispatch, options) {
29405
29525
  if (execution && pane.nativePaneBirthId && this.#io.runAuthoredNative) {
29406
- const nativeCommands = commands2.filter(
29526
+ const nativeCommands2 = commands2.filter(
29407
29527
  (command3) => !(command3[0] === "set-option" && command3[1] === "-p" && command3[2] === "-t" && command3[3] === pane.paneId && (command3[4] === INTERNAL_SEND_OPERATION_OPTION || command3[4] === INTERNAL_READ_OPERATION_OPTION))
29408
29528
  );
29409
29529
  dispatch.native = true;
@@ -29413,7 +29533,7 @@ var init_workspace_multiplexer_verbs = __esm({
29413
29533
  context: execution,
29414
29534
  targetPaneId: pane.paneId,
29415
29535
  targetBirthId: pane.nativePaneBirthId,
29416
- commands: nativeCommands,
29536
+ commands: nativeCommands2,
29417
29537
  expectedKinds
29418
29538
  },
29419
29539
  options
@@ -29866,6 +29986,158 @@ var init_guarded_native_split_resize = __esm({
29866
29986
  }
29867
29987
  });
29868
29988
 
29989
+ // packages/daemon/src/terminal/protocol/stock-split-resize.ts
29990
+ import { randomUUID as randomUUID14 } from "node:crypto";
29991
+ function minimum(node, axis, sizes, root) {
29992
+ if (node.kind === "leaf") {
29993
+ if (axis === "cols") return 1 + sizes.scrollbar;
29994
+ const onEdge = sizes.borderStatus === "top" && node.top === root.top || sizes.borderStatus === "bottom" && node.top + node.height === root.top + root.height;
29995
+ return onEdge ? 2 : 1;
29996
+ }
29997
+ const mins = node.children.map((child) => minimum(child, axis, sizes, root));
29998
+ return node.axis === axis ? mins.reduce((sum, size) => sum + size, node.children.length - 1) : Math.max(...mins);
29999
+ }
30000
+ function reachingLeaf(node, axis) {
30001
+ if (node.kind === "leaf") return node.id;
30002
+ if (node.axis === axis) return null;
30003
+ for (const child of node.children) {
30004
+ const leaf = reachingLeaf(child, axis);
30005
+ if (leaf) return leaf;
30006
+ }
30007
+ return null;
30008
+ }
30009
+ function stockSplitTarget(tree, path2, axis) {
30010
+ const located = locateSplit(tree, path2);
30011
+ if (!located || located.parent.axis !== axis) return null;
30012
+ const leading = reachingLeaf(located.node, axis);
30013
+ if (leading) return leading;
30014
+ const index = path2.at(-1);
30015
+ if (index + 1 !== located.parent.children.length - 1) return null;
30016
+ return reachingLeaf(located.parent.children[index + 1], axis);
30017
+ }
30018
+ function stockSplitRange(tree, path2, axis, sizes) {
30019
+ const located = locateSplit(tree, path2);
30020
+ if (!located) return null;
30021
+ const after = located.parent.children[path2.at(-1) + 1];
30022
+ const low = start(located.node, axis) + minimum(located.node, axis, sizes, tree);
30023
+ const high = start(after, axis) + span(after, axis) - minimum(after, axis, sizes, tree) - 1;
30024
+ return { low, high };
30025
+ }
30026
+ function stockSplitMovable(tree, path2, axis, sizes) {
30027
+ const range = stockSplitRange(tree, path2, axis, sizes);
30028
+ return stockSplitTarget(tree, path2, axis) !== null && range !== null && range.high > range.low;
30029
+ }
30030
+ function planStockSplitResize(tree, path2, axis, boundary2, sizes) {
30031
+ const paneId = stockSplitTarget(tree, path2, axis);
30032
+ const range = stockSplitRange(tree, path2, axis, sizes);
30033
+ const located = locateSplit(tree, path2);
30034
+ if (!paneId || !range || !located || range.high < range.low) return null;
30035
+ const clamped = Math.min(range.high, Math.max(range.low, boundary2));
30036
+ return { paneId, boundary: clamped, delta: clamped - splitEdge(located.node, axis) };
30037
+ }
30038
+ function formatLiteral(layout) {
30039
+ return layout.replaceAll(",", "#,").replaceAll("}", "#}");
30040
+ }
30041
+ function leafCount(node) {
30042
+ return node.kind === "leaf" ? 1 : node.children.reduce((sum, child) => sum + leafCount(child), 0);
30043
+ }
30044
+ function stockSplitCommand(request3, sessionCreated, plan, panes, options, marker) {
30045
+ const equal = (name, value) => `#{==:#{${name}},${value}}`;
30046
+ const condition = [
30047
+ equal("window_id", request3.windowId),
30048
+ equal("session_id", request3.sessionId),
30049
+ equal("session_created", sessionCreated),
30050
+ equal("window_zoomed_flag", 0),
30051
+ // Control clients' layouts leave out floating panes; this count includes them.
30052
+ equal("window_panes", panes),
30053
+ equal("pane-border-status", options.borderStatus),
30054
+ equal("pane-scrollbars", options.scrollbars),
30055
+ equal("window_layout", formatLiteral(request3.expectedLayout))
30056
+ ].reduceRight((rest, next) => `#{&&:${next},${rest}}`);
30057
+ const flag = request3.axis === "cols" ? plan.delta > 0 ? "-R" : "-L" : plan.delta > 0 ? "-D" : "-U";
30058
+ const move = plan.delta === 0 ? `display-message -p ""` : `resize-pane -t ${plan.paneId} ${flag} ${Math.abs(plan.delta)}`;
30059
+ const readback = `display-message -p -t ${request3.windowId} "${marker} #{window_layout}"`;
30060
+ return `if-shell -F -t '${request3.sessionId}:${request3.windowId}' '${condition}' '${move} ; ${readback}' 'display-message -p ${marker} ; display-message -p ${marker}'`;
30061
+ }
30062
+ function parseStockSplitOptions(line) {
30063
+ const [borderStatus, scrollbars, style] = (line ?? "").split(" ");
30064
+ if (!/^(off|top|bottom)$/u.test(borderStatus ?? "") || !/^[a-z]+$/u.test(scrollbars ?? ""))
30065
+ return null;
30066
+ const field = (name) => Number(new RegExp(`\\b${name}=(\\d+)`, "u").exec(style ?? "")?.[1] ?? 0);
30067
+ return {
30068
+ borderStatus,
30069
+ scrollbars,
30070
+ scrollbar: scrollbars === "off" ? 0 : Math.max(field("width"), 1) + field("pad")
30071
+ };
30072
+ }
30073
+ async function resizeStockSplit(request3, sessionCreated, authorizeBeforeEffect, io) {
30074
+ const before = parseLayoutTree(request3.expectedLayout);
30075
+ if (!before || !validSplitTree(before) || !/^\$\d+$/u.test(request3.sessionId) || !/^@\d+$/u.test(request3.windowId) || !/^[1-9]\d*$/u.test(sessionCreated))
30076
+ return { status: "refused", reason: "invalid-request" };
30077
+ let options;
30078
+ try {
30079
+ options = parseStockSplitOptions((await io.readOptions(request3.windowId))[0]);
30080
+ } catch {
30081
+ return { status: "refused", reason: "unsupported" };
30082
+ }
30083
+ if (!options) return { status: "refused", reason: "unsupported" };
30084
+ const plan = planStockSplitResize(before, request3.path, request3.axis, request3.boundary, options);
30085
+ if (!plan) return { status: "refused", reason: "invalid-request" };
30086
+ const marker = `tmux-ide-split-${randomUUID14()}`;
30087
+ const command3 = stockSplitCommand(
30088
+ request3,
30089
+ sessionCreated,
30090
+ plan,
30091
+ leafCount(before),
30092
+ options,
30093
+ marker
30094
+ );
30095
+ authorizeBeforeEffect();
30096
+ let reply;
30097
+ try {
30098
+ reply = await io.send(command3);
30099
+ } catch {
30100
+ return { status: "uncertain", reason: "command-failed" };
30101
+ }
30102
+ const answer = reply.join("\n");
30103
+ if (answer === marker) return { status: "refused", reason: "stale-layout" };
30104
+ if (reply.length !== 1 || !answer.startsWith(`${marker} `))
30105
+ return { status: "uncertain", reason: "invalid-receipt" };
30106
+ const layout = answer.slice(marker.length + 1);
30107
+ const after = parseLayoutTree(layout);
30108
+ const original = locateSplit(before, request3.path);
30109
+ const actual = after && locateSplit(after, request3.path);
30110
+ if (!after || !validSplitTree(after) || !actual || !preservesSplitTree(before, after, original.parent, request3.axis))
30111
+ return { status: "uncertain", reason: "invalid-receipt" };
30112
+ const edges = (parent) => parent.children.map((child) => splitEdge(child, request3.axis));
30113
+ const moved = request3.path.at(-1);
30114
+ const others = edges(actual.parent);
30115
+ if (edges(original.parent).some((edge, index) => index !== moved && edge !== others[index]))
30116
+ return { status: "uncertain", reason: "invalid-receipt" };
30117
+ const boundary2 = splitEdge(actual.node, request3.axis);
30118
+ const previous = splitEdge(original.node, request3.axis);
30119
+ if (boundary2 < Math.min(previous, plan.boundary) || boundary2 > Math.max(previous, plan.boundary))
30120
+ return { status: "uncertain", reason: "invalid-receipt" };
30121
+ return {
30122
+ status: "applied",
30123
+ boundary: boundary2,
30124
+ layout,
30125
+ tree: after,
30126
+ changed: layout !== request3.expectedLayout
30127
+ };
30128
+ }
30129
+ var span, start, STOCK_SPLIT_OPTIONS_FORMAT;
30130
+ var init_stock_split_resize = __esm({
30131
+ "packages/daemon/src/terminal/protocol/stock-split-resize.ts"() {
30132
+ "use strict";
30133
+ init_layout_parse();
30134
+ init_native_split_resize();
30135
+ span = (node, axis) => axis === "cols" ? node.width : node.height;
30136
+ start = (node, axis) => axis === "cols" ? node.left : node.top;
30137
+ STOCK_SPLIT_OPTIONS_FORMAT = "#{pane-border-status} #{pane-scrollbars} #{pane-scrollbars-style}";
30138
+ }
30139
+ });
30140
+
29869
30141
  // packages/daemon/src/terminal/mirror/layout-content-rows.ts
29870
30142
  function layoutContentRows(paneTop, paneHeight, windowRows, border) {
29871
30143
  if (border === "off") return paneHeight;
@@ -31154,6 +31426,7 @@ var TMUX_SERVER_HOSTNAME, STRUCTURAL_NOTIFICATIONS, NATIVE_CLIENT_NOTIFICATIONS,
31154
31426
  var init_session_channel = __esm({
31155
31427
  "packages/daemon/src/terminal/mirror/session-channel.ts"() {
31156
31428
  "use strict";
31429
+ init_stock_split_resize();
31157
31430
  init_layout_content_rows();
31158
31431
  init_native_atomic_snapshot();
31159
31432
  init_tmux_interaction_retention();
@@ -31598,7 +31871,7 @@ var init_session_channel = __esm({
31598
31871
  };
31599
31872
  }
31600
31873
  /** Exact native ancestry, never reconstructed from published pane rectangles. */
31601
- describeSplitLayout(target) {
31874
+ describeSplitLayout(target, stock = false) {
31602
31875
  const authority2 = this.windowLinkAuthority;
31603
31876
  const identity4 = this.attachedIdentity;
31604
31877
  const generation = this.attachedServerGeneration;
@@ -31620,14 +31893,14 @@ var init_session_channel = __esm({
31620
31893
  const panes = native2.leaves.map((leaf) => {
31621
31894
  const pane = this.panesByRuntime.get(leaf.id);
31622
31895
  const birth = pane?.descriptor?.nativePaneBirthId;
31623
- if (!pane || pane.windowRuntimeId !== resolved2.runtimeWindowId || pane.descriptor?.runtimeSessionId !== identity4.runtimeSessionId || pane.descriptor?.windowId !== resolved2.runtimeWindowId || this.panesBySemantic.get(pane.semanticId) !== pane || !birth || !/^[1-9]\d*$/u.test(birth) || !layout.leaves.some(
31896
+ if (!pane || pane.windowRuntimeId !== resolved2.runtimeWindowId || pane.descriptor?.runtimeSessionId !== identity4.runtimeSessionId || pane.descriptor?.windowId !== resolved2.runtimeWindowId || this.panesBySemantic.get(pane.semanticId) !== pane || !stock && (!birth || !/^[1-9]\d*$/u.test(birth)) || !layout.leaves.some(
31624
31897
  (visible) => visible.id === leaf.id && visible.left === leaf.left && visible.top === leaf.top && visible.width === leaf.width && visible.height === leaf.height
31625
31898
  ))
31626
31899
  throw new Error("Split layout pane identity incomplete");
31627
31900
  return Object.freeze({
31628
31901
  runtimePaneId: pane.runtimeId,
31629
31902
  semanticPaneId: pane.semanticId,
31630
- nativePaneBirthId: birth
31903
+ nativePaneBirthId: stock ? "" : birth
31631
31904
  });
31632
31905
  });
31633
31906
  return Object.freeze({
@@ -31637,9 +31910,23 @@ var init_session_channel = __esm({
31637
31910
  runtimeWindowId: resolved2.runtimeWindowId,
31638
31911
  semanticWindowId: window2.semanticId,
31639
31912
  rawLayout: layout.rawLayout,
31913
+ ...stock ? { paneBorderStatus: window2.paneBorderStatus } : {},
31640
31914
  panes: Object.freeze(panes)
31641
31915
  });
31642
31916
  }
31917
+ stockSplitOptions(windowId) {
31918
+ return this.io.request(`display-message -p -t ${windowId} "${STOCK_SPLIT_OPTIONS_FORMAT}"`);
31919
+ }
31920
+ /** One guarded resize on this control connection, for a stock tmux server. */
31921
+ stockSplitCommand(command3) {
31922
+ return new Promise((resolve45, reject) => {
31923
+ const onReply = (reply) => reply.ok ? resolve45(reply.lines) : reject(new Error("Stock split command failed"));
31924
+ const limits = { maxBytes: 16 * 1024, maxLines: 4 };
31925
+ if (this.io.commandListBoundedInline)
31926
+ this.io.commandListBoundedInline(command3, 3, 2, limits, onReply);
31927
+ else this.io.commandListInline(command3, 3, 2, onReply);
31928
+ });
31929
+ }
31643
31930
  async executeWindowLinkAction(request3) {
31644
31931
  const authority2 = this.windowLinkAuthority;
31645
31932
  if (!authority2 || this.disposed) throw new WindowLinkResolutionError("window_link_stale");
@@ -34170,7 +34457,7 @@ var init_session_channel = __esm({
34170
34457
  });
34171
34458
 
34172
34459
  // packages/daemon/src/terminal/mirror/window-split-authority.ts
34173
- import { randomUUID as randomUUID14 } from "node:crypto";
34460
+ import { randomUUID as randomUUID15 } from "node:crypto";
34174
34461
  import { z as z99 } from "zod";
34175
34462
  var MAX_RETAINED_WINDOWS, WindowSplitLayoutUnavailable, WindowSplitAuthority;
34176
34463
  var init_window_split_authority = __esm({
@@ -34179,6 +34466,7 @@ var init_window_split_authority = __esm({
34179
34466
  init_src2();
34180
34467
  init_native_operation_command();
34181
34468
  init_layout_parse();
34469
+ init_stock_split_resize();
34182
34470
  init_session_channel();
34183
34471
  MAX_RETAINED_WINDOWS = 32;
34184
34472
  WindowSplitLayoutUnavailable = class extends Error {
@@ -34208,7 +34496,7 @@ var init_window_split_authority = __esm({
34208
34496
  if (!tree || tree.width > 4096 || tree.height > 4096 || snapshot3.panes.length > 256)
34209
34497
  throw new WindowSplitLayoutUnavailable();
34210
34498
  snapshot3.panes.forEach((pane) => {
34211
- if (!/^%(0|[1-9][0-9]{0,9})$/u.test(pane.runtimePaneId) || Number(pane.runtimePaneId.slice(1)) > 4294967295 || !NativeJournalUint64SchemaZ.refine((birth) => birth !== "0").safeParse(
34499
+ if (!/^%(0|[1-9][0-9]{0,9})$/u.test(pane.runtimePaneId) || Number(pane.runtimePaneId.slice(1)) > 4294967295 || !this.options.stock && !NativeJournalUint64SchemaZ.refine((birth) => birth !== "0").safeParse(
34212
34500
  pane.nativePaneBirthId
34213
34501
  ).success)
34214
34502
  throw new WindowSplitLayoutUnavailable();
@@ -34236,8 +34524,11 @@ var init_window_split_authority = __esm({
34236
34524
  }
34237
34525
  node.children.forEach((child, index) => {
34238
34526
  const childPath = [...path2, index];
34239
- if (index < node.children.length - 1) {
34240
- const splitId = randomUUID14();
34527
+ if (index < node.children.length - 1 && (!this.options.stock || stockSplitMovable(tree, childPath, node.axis, {
34528
+ borderStatus: snapshot3.paneBorderStatus ?? "off",
34529
+ scrollbar: 0
34530
+ }))) {
34531
+ const splitId = randomUUID15();
34241
34532
  paths.set(splitId, childPath);
34242
34533
  splits.push({
34243
34534
  splitId,
@@ -34256,7 +34547,7 @@ var init_window_split_authority = __esm({
34256
34547
  const resource3 = WindowSplitLayoutResourceSchemaZ.parse({
34257
34548
  version: 1,
34258
34549
  window: window2,
34259
- layoutId: randomUUID14(),
34550
+ layoutId: randomUUID15(),
34260
34551
  cols: tree.width,
34261
34552
  rows: tree.height,
34262
34553
  panes,
@@ -34383,7 +34674,7 @@ var init_tmux_version = __esm({
34383
34674
  });
34384
34675
 
34385
34676
  // packages/daemon/src/terminal/graphics/local-image-store.ts
34386
- import { randomUUID as randomUUID15, webcrypto } from "node:crypto";
34677
+ import { randomUUID as randomUUID16, webcrypto } from "node:crypto";
34387
34678
  import { constants as constants11 } from "node:fs";
34388
34679
  import { chmod, link, lstat as lstat2, mkdtemp, open, realpath, rmdir, unlink } from "node:fs/promises";
34389
34680
  import { join as join31 } from "node:path";
@@ -34491,7 +34782,7 @@ var init_local_image_store = __esm({
34491
34782
  this.#bytes += entry.bytes;
34492
34783
  }
34493
34784
  const lease = Object.freeze({
34494
- id: randomUUID15(),
34785
+ id: randomUUID16(),
34495
34786
  generation: this.generation,
34496
34787
  client,
34497
34788
  digest: digest3,
@@ -34508,7 +34799,7 @@ var init_local_image_store = __esm({
34508
34799
  }
34509
34800
  async #write(digest3, data) {
34510
34801
  const path2 = join31(this.directory, digest3);
34511
- const temporary = join31(this.directory, `.pending-${randomUUID15()}`);
34802
+ const temporary = join31(this.directory, `.pending-${randomUUID16()}`);
34512
34803
  const file = await open(
34513
34804
  temporary,
34514
34805
  constants11.O_CREAT | constants11.O_EXCL | constants11.O_WRONLY | constants11.O_NOFOLLOW,
@@ -34608,7 +34899,7 @@ var init_local_image_store = __esm({
34608
34899
  });
34609
34900
 
34610
34901
  // packages/daemon/src/terminal/graphics/local-image-owner.ts
34611
- import { randomUUID as randomUUID16 } from "node:crypto";
34902
+ import { randomUUID as randomUUID17 } from "node:crypto";
34612
34903
  import { constants as constants12 } from "node:fs";
34613
34904
  import {
34614
34905
  link as link2,
@@ -34839,7 +35130,7 @@ var init_local_image_owner = __esm({
34839
35130
  throw new Error("Local image manifest replaced");
34840
35131
  if (JSON.stringify(current.manifest) === encoded) return;
34841
35132
  }
34842
- const temporary = join32(this.path, `.owner-${randomUUID16()}`);
35133
+ const temporary = join32(this.path, `.owner-${randomUUID17()}`);
34843
35134
  const file = await open2(
34844
35135
  temporary,
34845
35136
  constants12.O_CREAT | constants12.O_EXCL | constants12.O_WRONLY | constants12.O_NOFOLLOW,
@@ -35121,7 +35412,7 @@ var init_pane_source_discovery = __esm({
35121
35412
  });
35122
35413
 
35123
35414
  // packages/daemon/src/lib/background-native-capture.ts
35124
- import { randomUUID as randomUUID17 } from "node:crypto";
35415
+ import { randomUUID as randomUUID18 } from "node:crypto";
35125
35416
  function createBackgroundNativeCapture(options) {
35126
35417
  return async (request3, signal) => {
35127
35418
  signal?.throwIfAborted();
@@ -35132,7 +35423,7 @@ function createBackgroundNativeCapture(options) {
35132
35423
  return null;
35133
35424
  if (request3.mode !== "agent-status" && request3.mode !== "fleet-preview")
35134
35425
  throw new TypeError("Invalid background capture mode");
35135
- const operationId = randomUUID17();
35426
+ const operationId = randomUUID18();
35136
35427
  const command3 = [
35137
35428
  "capture-pane",
35138
35429
  "-p",
@@ -35255,7 +35546,7 @@ var init_background_native_capture = __esm({
35255
35546
  });
35256
35547
 
35257
35548
  // packages/daemon/src/terminal/mirror/owned-viewer-adapter.ts
35258
- import { randomUUID as randomUUID18 } from "node:crypto";
35549
+ import { randomUUID as randomUUID19 } from "node:crypto";
35259
35550
  var commands, OwnedViewerAdapter;
35260
35551
  var init_owned_viewer_adapter = __esm({
35261
35552
  "packages/daemon/src/terminal/mirror/owned-viewer-adapter.ts"() {
@@ -35280,18 +35571,18 @@ var init_owned_viewer_adapter = __esm({
35280
35571
  });
35281
35572
  }
35282
35573
  controlOptions() {
35283
- let capability2;
35574
+ let capability;
35284
35575
  try {
35285
- capability2 = this.authority.capability();
35576
+ capability = this.authority.capability();
35286
35577
  } catch {
35287
35578
  this.#uncertain();
35288
35579
  return void 0;
35289
35580
  }
35290
- if (this.#disposed || !capability2) return void 0;
35581
+ if (this.#disposed || !capability) return void 0;
35291
35582
  return {
35292
- serverEpoch: capability2.serverEpoch,
35583
+ serverEpoch: capability.serverEpoch,
35293
35584
  onIdentity: (identity4) => {
35294
- if (this.#disposed || !this.#io || this.#connection || identity4.serverEpoch !== capability2.serverEpoch || this.authority.capability()?.serverEpoch !== identity4.serverEpoch)
35585
+ if (this.#disposed || !this.#io || this.#connection || identity4.serverEpoch !== capability.serverEpoch || this.authority.capability()?.serverEpoch !== identity4.serverEpoch)
35295
35586
  return false;
35296
35587
  const connection = this.authority.register(identity4);
35297
35588
  if (!connection) return false;
@@ -35309,9 +35600,9 @@ var init_owned_viewer_adapter = __esm({
35309
35600
  /** Available only on the actual attached issuer, never the journal reader. */
35310
35601
  atomicSnapshotEpoch(io, representation = "native") {
35311
35602
  try {
35312
- const capability2 = this.authority.capability();
35603
+ const capability = this.authority.capability();
35313
35604
  const actual = io.nativeViewerIdentity;
35314
- return !this.#disposed && io === this.#io && this.#connection && this.#identity && (representation === "dual" ? capability2?.atomicPaneSnapshotDual : capability2?.atomicPaneSnapshot) === true && actual && actual.connectionId === this.#identity.connectionId && actual.serverEpoch === this.#identity.serverEpoch && capability2?.serverEpoch === actual.serverEpoch ? actual.serverEpoch : null;
35605
+ return !this.#disposed && io === this.#io && this.#connection && this.#identity && (representation === "dual" ? capability?.atomicPaneSnapshotDual : capability?.atomicPaneSnapshot) === true && actual && actual.connectionId === this.#identity.connectionId && actual.serverEpoch === this.#identity.serverEpoch && capability?.serverEpoch === actual.serverEpoch ? actual.serverEpoch : null;
35315
35606
  } catch {
35316
35607
  this.#uncertain();
35317
35608
  return null;
@@ -35320,20 +35611,20 @@ var init_owned_viewer_adapter = __esm({
35320
35611
  tryDispatch(io, request3, onReply) {
35321
35612
  const identity4 = this.#identity, connection = this.#connection;
35322
35613
  let actual;
35323
- let capability2;
35614
+ let capability;
35324
35615
  try {
35325
35616
  actual = io.nativeViewerIdentity;
35326
- capability2 = this.authority.capability();
35617
+ capability = this.authority.capability();
35327
35618
  } catch {
35328
35619
  this.#uncertain();
35329
35620
  return false;
35330
35621
  }
35331
- if (this.#disposed || io !== this.#io || !identity4 || !connection || !actual || actual.serverEpoch !== identity4.serverEpoch || request3.expectedServerEpoch !== void 0 && request3.expectedServerEpoch !== identity4.serverEpoch || actual.connectionId !== identity4.connectionId || capability2?.serverEpoch !== identity4.serverEpoch || !io.commandNativeViewerInline || !/^%(0|[1-9][0-9]*)$/.test(request3.paneId) || !/^[1-9][0-9]*$/.test(request3.paneBirthId) || request3.commands.length === 0 || request3.commands.length > 64 || request3.commands.some((argv) => !commands.has(argv[0] ?? "")))
35622
+ if (this.#disposed || io !== this.#io || !identity4 || !connection || !actual || actual.serverEpoch !== identity4.serverEpoch || request3.expectedServerEpoch !== void 0 && request3.expectedServerEpoch !== identity4.serverEpoch || actual.connectionId !== identity4.connectionId || capability?.serverEpoch !== identity4.serverEpoch || !io.commandNativeViewerInline || !/^%(0|[1-9][0-9]*)$/.test(request3.paneId) || !/^[1-9][0-9]*$/.test(request3.paneBirthId) || request3.commands.length === 0 || request3.commands.length > 64 || request3.commands.some((argv) => !commands.has(argv[0] ?? "")))
35332
35623
  return false;
35333
35624
  let permit;
35334
35625
  try {
35335
35626
  permit = this.authority.admit({
35336
- operationId: randomUUID18(),
35627
+ operationId: randomUUID19(),
35337
35628
  role: "viewer",
35338
35629
  source: null,
35339
35630
  connection,
@@ -36077,7 +36368,7 @@ var init_authored_native_receipt_staging = __esm({
36077
36368
 
36078
36369
  // packages/daemon/src/lib/owned-native-interaction-bindings.ts
36079
36370
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
36080
- import { randomUUID as randomUUID19 } from "node:crypto";
36371
+ import { randomUUID as randomUUID20 } from "node:crypto";
36081
36372
  function isOwnedNativePlanCompletion(value) {
36082
36373
  return value !== null && typeof value === "object" && ownedCompletions.has(value);
36083
36374
  }
@@ -36163,7 +36454,7 @@ var init_owned_native_interaction_bindings = __esm({
36163
36454
  return null;
36164
36455
  if ([...this.#connections.values()].some((c) => c.identity.connectionId === identity4.connectionId))
36165
36456
  return null;
36166
- const token2 = Object.freeze({ bindingId: randomUUID19() });
36457
+ const token2 = Object.freeze({ bindingId: randomUUID20() });
36167
36458
  this.#connections.set(token2, {
36168
36459
  token: token2,
36169
36460
  identity: freeze(identity4),
@@ -36505,7 +36796,7 @@ var init_owned_native_interaction_bindings = __esm({
36505
36796
  });
36506
36797
 
36507
36798
  // packages/daemon/src/lib/tmux-server-generation-runner.ts
36508
- import { randomUUID as randomUUID20 } from "node:crypto";
36799
+ import { randomUUID as randomUUID21 } from "node:crypto";
36509
36800
  function fenceNativeTmuxCommand(args, expected) {
36510
36801
  const { pid, startTime } = expected;
36511
36802
  if (!/^[1-9][0-9]*$/u.test(pid) || !/^[1-9][0-9]*$/u.test(startTime))
@@ -36524,7 +36815,7 @@ function fenceNativeTmuxCommand(args, expected) {
36524
36815
  if (firstCommand === args.length) throw new Error("Missing tmux command");
36525
36816
  const condition = `#{&&:#{==:#{pid},${pid}},#{==:#{start_time},${startTime}}}`;
36526
36817
  const command3 = args.slice(firstCommand).map((arg) => arg === ";" ? ";" : shellEscape(arg)).join(" ");
36527
- const refusal = `tmux-server-stale.${randomUUID20()}`;
36818
+ const refusal = `tmux-server-stale.${randomUUID21()}`;
36528
36819
  return {
36529
36820
  argv: [...globalFlags, "if-shell", "-F", condition, command3, `display-message -p '${refusal}'`],
36530
36821
  verify(output) {
@@ -36634,9 +36925,9 @@ var init_native_journal_control_connection = __esm({
36634
36925
  try {
36635
36926
  if (this.#failure) throw this.#failure;
36636
36927
  if (lines.length !== 2) throw new Error("Invalid native journal greeting");
36637
- const capability2 = NativeJournalCapabilitySchemaZ.parse(JSON.parse(lines[0]));
36928
+ const capability = NativeJournalCapabilitySchemaZ.parse(JSON.parse(lines[0]));
36638
36929
  const identity4 = NativeJournalIdentitySchemaZ.parse(JSON.parse(lines[1]));
36639
- if (capability2.readerTransport !== "sessionless-control-v1" || !capability2.enabled || capability2.serverEpoch !== this.#serverEpoch || identity4.serverEpoch !== this.#serverEpoch)
36930
+ if (capability.readerTransport !== "sessionless-control-v1" || !capability.enabled || capability.serverEpoch !== this.#serverEpoch || identity4.serverEpoch !== this.#serverEpoch)
36640
36931
  throw new Error("Native journal peer incarnation mismatch");
36641
36932
  this.#connectionId = identity4.connectionId;
36642
36933
  } catch (error) {
@@ -36997,45 +37288,45 @@ var init_native_tmux_interaction_observer = __esm({
36997
37288
  }
36998
37289
  }
36999
37290
  async #probe() {
37000
- let capability2;
37291
+ let capability;
37001
37292
  const output = await this.#request(["tmux-ide-events", "-V"], this.#commandMs);
37002
37293
  try {
37003
- capability2 = NativeJournalCapabilitySchemaZ.parse(JSON.parse(output));
37294
+ capability = NativeJournalCapabilitySchemaZ.parse(JSON.parse(output));
37004
37295
  } catch {
37005
37296
  this.#state("incompatible");
37006
37297
  return false;
37007
37298
  }
37008
- if (this.#options.expectedServerEpoch !== void 0 && this.#options.expectedServerEpoch !== capability2.serverEpoch || this.#capability && this.#capability.serverEpoch !== capability2.serverEpoch || this.#cursor && this.#cursor.serverEpoch !== capability2.serverEpoch) {
37299
+ if (this.#options.expectedServerEpoch !== void 0 && this.#options.expectedServerEpoch !== capability.serverEpoch || this.#capability && this.#capability.serverEpoch !== capability.serverEpoch || this.#cursor && this.#cursor.serverEpoch !== capability.serverEpoch) {
37009
37300
  this.#state("retired");
37010
37301
  return false;
37011
37302
  }
37012
- this.#capability = capability2;
37013
- if (!capability2.enabled && this.#options.enable) {
37303
+ this.#capability = capability;
37304
+ if (!capability.enabled && this.#options.enable) {
37014
37305
  const enabled = NativeJournalCapabilitySchemaZ.parse(
37015
37306
  JSON.parse(await this.#request(["tmux-ide-events", "-e"], this.#commandMs))
37016
37307
  );
37017
- if (enabled.serverEpoch !== capability2.serverEpoch) {
37308
+ if (enabled.serverEpoch !== capability.serverEpoch) {
37018
37309
  this.#state("retired");
37019
37310
  return false;
37020
37311
  }
37021
- this.#capability = capability2 = enabled;
37312
+ this.#capability = capability = enabled;
37022
37313
  }
37023
- if (!capability2.enabled) {
37314
+ if (!capability.enabled) {
37024
37315
  this.#state("disabled");
37025
37316
  return false;
37026
37317
  }
37027
- if (capability2.degraded) {
37318
+ if (capability.degraded) {
37028
37319
  this.#state("degraded");
37029
37320
  return false;
37030
37321
  }
37031
37322
  if (!this.#cursor)
37032
37323
  this.#cursor = {
37033
- serverEpoch: capability2.serverEpoch,
37034
- journalEpoch: capability2.journalEpoch,
37324
+ serverEpoch: capability.serverEpoch,
37325
+ journalEpoch: capability.journalEpoch,
37035
37326
  sequence: "0"
37036
37327
  };
37037
- else if (this.#cursor.journalEpoch !== capability2.journalEpoch)
37038
- this.#reset(capability2.journalEpoch);
37328
+ else if (this.#cursor.journalEpoch !== capability.journalEpoch)
37329
+ this.#reset(capability.journalEpoch);
37039
37330
  this.#state("ready");
37040
37331
  return true;
37041
37332
  }
@@ -37394,22 +37685,22 @@ var init_owner_interaction_observation = __esm({
37394
37685
  cursor: null
37395
37686
  });
37396
37687
  }
37397
- #ready(capability2, cursor2) {
37688
+ #ready(capability, cursor2) {
37398
37689
  this.#selection = "native";
37399
- this.#capability = capability2;
37400
- if (capability2.ownedOperationTransport === "direct-wrapper-v1")
37690
+ this.#capability = capability;
37691
+ if (capability.ownedOperationTransport === "direct-wrapper-v1")
37401
37692
  this.#bindings ??= new OwnedNativeInteractionBindings({
37402
37693
  environmentId: this.#options.environmentId,
37403
37694
  serverScope: this.#options.serverScope,
37404
- serverEpoch: capability2.serverEpoch,
37695
+ serverEpoch: capability.serverEpoch,
37405
37696
  onPlanComplete: this.#options.onOwnedPlanComplete
37406
37697
  });
37407
37698
  this.#projector ??= new NativeInteractionProjector({
37408
37699
  environmentId: this.#options.environmentId,
37409
37700
  serverScope: this.#options.serverScope,
37410
- serverEpoch: capability2.serverEpoch
37701
+ serverEpoch: capability.serverEpoch
37411
37702
  });
37412
- this.#options.status.setNativeReady(capability2.schemaVersion, cursor2);
37703
+ this.#options.status.setNativeReady(capability.schemaVersion, cursor2);
37413
37704
  }
37414
37705
  #publish(items) {
37415
37706
  if (this.#disposed) return;
@@ -38233,7 +38524,7 @@ var init_fleet_agent_lifecycle = __esm({
38233
38524
  });
38234
38525
 
38235
38526
  // packages/daemon/src/lib/fleet-lifecycle-authority.ts
38236
- import { createHash as createHash16, randomUUID as randomUUID21 } from "node:crypto";
38527
+ import { createHash as createHash16, randomUUID as randomUUID22 } from "node:crypto";
38237
38528
  import { isAbsolute as isAbsolute16, resolve as resolve21 } from "node:path";
38238
38529
  import { realpath as realpath3, stat } from "node:fs/promises";
38239
38530
  var MAX_REPLAY_OPERATIONS, sleep2, FleetLifecycleAuthorityError, FleetLifecycleAuthority;
@@ -38524,7 +38815,7 @@ var init_fleet_lifecycle_authority = __esm({
38524
38815
  "tmux did not return a pane identity."
38525
38816
  );
38526
38817
  }
38527
- const semanticPaneId3 = `pane.agent.${randomUUID21()}`;
38818
+ const semanticPaneId3 = `pane.agent.${randomUUID22()}`;
38528
38819
  try {
38529
38820
  this.#runTmux(["set-option", "-p", "-t", paneId, "@tmux_ide_pane_id", semanticPaneId3]);
38530
38821
  this.#runTmux(["set-option", "-p", "-t", paneId, "@agent_launch", input.command]);
@@ -38640,8 +38931,8 @@ var init_fleet_lifecycle_authority = __esm({
38640
38931
  } catch {
38641
38932
  throw new FleetLifecycleAuthorityError("agent_not_found", "Agent pane disappeared.");
38642
38933
  }
38643
- const [start2 = "", path2 = ""] = output.split(" ");
38644
- return { start: start2, path: path2 };
38934
+ const [start3 = "", path2 = ""] = output.split(" ");
38935
+ return { start: start3, path: path2 };
38645
38936
  }
38646
38937
  async #stopAgent(paneId) {
38647
38938
  this.#paneStartAndPath(paneId);
@@ -38726,7 +39017,7 @@ var init_tmux_server_session_create = __esm({
38726
39017
 
38727
39018
  // packages/daemon/src/lib/tmux-session-mutation-fence.ts
38728
39019
  import { AsyncLocalStorage } from "node:async_hooks";
38729
- import { randomUUID as randomUUID22 } from "node:crypto";
39020
+ import { randomUUID as randomUUID23 } from "node:crypto";
38730
39021
  function createTmuxSessionMutationFence() {
38731
39022
  const context = new AsyncLocalStorage();
38732
39023
  return {
@@ -38741,7 +39032,7 @@ function createTmuxSessionMutationFence() {
38741
39032
  return (args) => {
38742
39033
  const selected = context.getStore();
38743
39034
  if (!selected) return run(args);
38744
- const sentinel = `tmux-session-stale.${randomUUID22()}`;
39035
+ const sentinel = `tmux-session-stale.${randomUUID23()}`;
38745
39036
  const output = run([
38746
39037
  "if-shell",
38747
39038
  "-t",
@@ -39881,7 +40172,7 @@ var init_workspace_promotion2 = __esm({
39881
40172
  });
39882
40173
 
39883
40174
  // packages/daemon/src/lib/tmux-server-session-open.ts
39884
- import { randomUUID as randomUUID23 } from "node:crypto";
40175
+ import { randomUUID as randomUUID24 } from "node:crypto";
39885
40176
  function createNativeTmuxSessionOpener(options) {
39886
40177
  let disposed = false;
39887
40178
  let tail = Promise.resolve();
@@ -39904,7 +40195,7 @@ function createNativeTmuxSessionOpener(options) {
39904
40195
  const [, nativeSessionId, created, name] = matches[0];
39905
40196
  const run = async (args) => {
39906
40197
  assertOpen();
39907
- const sentinel = `tmux-session-stale.${randomUUID23()}`;
40198
+ const sentinel = `tmux-session-stale.${randomUUID24()}`;
39908
40199
  const condition = `#{&&:#{==:#{session_id},${nativeSessionId}},#{==:#{session_created},${created}}}`;
39909
40200
  const command3 = args.map((arg) => arg === ";" ? ";" : shellEscape(arg)).join(" ");
39910
40201
  const output = await options.run([
@@ -39930,7 +40221,7 @@ function createNativeTmuxSessionOpener(options) {
39930
40221
  });
39931
40222
  try {
39932
40223
  const result2 = await promotion.promote({
39933
- operationId: randomUUID23(),
40224
+ operationId: randomUUID24(),
39934
40225
  expectedDaemonInstanceId: options.generation,
39935
40226
  intent: { sessionId: fleetSessionIdForName(name) }
39936
40227
  });
@@ -39963,7 +40254,7 @@ function createNativeTmuxSessionOpener(options) {
39963
40254
  const observed = observedAgentSchema.parse(input);
39964
40255
  assertOpen();
39965
40256
  if (pending.size >= 16) throw new Error("Session admission capacity reached");
39966
- const key2 = randomUUID23();
40257
+ const key2 = randomUUID24();
39967
40258
  const operation = tail.then(async () => {
39968
40259
  const result2 = await open5(liveSessionId, observed);
39969
40260
  if (!result2.semanticPaneId) throw new Error("Agent admission returned no target");
@@ -40112,7 +40403,7 @@ var init_tmux_pane_editor_context = __esm({
40112
40403
  });
40113
40404
 
40114
40405
  // packages/daemon/src/terminal/session-runtime/runtime-observability.ts
40115
- import { randomUUID as randomUUID24 } from "node:crypto";
40406
+ import { randomUUID as randomUUID25 } from "node:crypto";
40116
40407
  import { z as z104 } from "zod";
40117
40408
  function createSessionRuntimeObservability(options = {}) {
40118
40409
  const capacity = options.capacity ?? 1024;
@@ -40122,7 +40413,7 @@ function createSessionRuntimeObservability(options = {}) {
40122
40413
  const processId = options.processId ?? `daemon:${process.pid}`;
40123
40414
  const clockId = options.clockId ?? "node-performance-now";
40124
40415
  const clockKind = options.clockKind ?? "performance-now";
40125
- const createTraceId = options.createTraceId ?? randomUUID24;
40416
+ const createTraceId = options.createTraceId ?? randomUUID25;
40126
40417
  const spans = [];
40127
40418
  let cursor2 = 0;
40128
40419
  let droppedSpans = 0;
@@ -40137,7 +40428,7 @@ function createSessionRuntimeObservability(options = {}) {
40137
40428
  });
40138
40429
  },
40139
40430
  recordSpan(stage, operation, startedAtMicros, endedAtMicros, trace = null, shared, terminalDelivery, terminalReseed) {
40140
- const span = Object.freeze({
40431
+ const span2 = Object.freeze({
40141
40432
  traceId: trace?.traceId ?? null,
40142
40433
  scenario: trace?.scenario ?? null,
40143
40434
  authority: trace?.authority ?? null,
@@ -40155,13 +40446,13 @@ function createSessionRuntimeObservability(options = {}) {
40155
40446
  ...terminalDelivery ? { terminalDelivery: Object.freeze({ ...terminalDelivery }) } : {},
40156
40447
  ...terminalReseed ? { terminalReseed: Object.freeze({ ...terminalReseed }) } : {}
40157
40448
  });
40158
- if (spans.length < capacity) spans.push(span);
40449
+ if (spans.length < capacity) spans.push(span2);
40159
40450
  else {
40160
- spans[cursor2] = span;
40451
+ spans[cursor2] = span2;
40161
40452
  cursor2 = (cursor2 + 1) % capacity;
40162
40453
  droppedSpans += 1;
40163
40454
  }
40164
- options.onSpan?.(span);
40455
+ options.onSpan?.(span2);
40165
40456
  },
40166
40457
  snapshot() {
40167
40458
  const ordered = spans.length < capacity || cursor2 === 0 ? [...spans] : [...spans.slice(cursor2), ...spans.slice(0, cursor2)];
@@ -40772,14 +41063,14 @@ var init_control_channel = __esm({
40772
41063
  }
40773
41064
  if (event.kind === "error" && sink.index !== sink.state.resultIndex)
40774
41065
  this.discardedErrors += 1;
40775
- if (event.kind === "error" && sink.index === 0) {
41066
+ if (event.kind === "error") {
40776
41067
  while (this.pending[0]?.kind === "command-list" && this.pending[0].state === sink.state)
40777
41068
  this.pending.shift();
40778
41069
  if (!sink.state.settled) {
40779
41070
  sink.state.settled = true;
40780
41071
  sink.state.onReply({
40781
41072
  ok: false,
40782
- lines: sink.state.budget || sink.state.resultIndex === 0 ? sink.state.lines : sink.state.leadingErrorLines
41073
+ lines: sink.index > 0 || sink.state.budget || sink.state.resultIndex === 0 ? sink.state.lines : sink.state.leadingErrorLines
40783
41074
  });
40784
41075
  }
40785
41076
  } else if (sink.index === sink.state.resultIndex && !sink.state.settled) {
@@ -41508,6 +41799,7 @@ var init_control_mode_ownership = __esm({
41508
41799
  });
41509
41800
 
41510
41801
  // packages/daemon/src/terminal/mirror/mirror-service.ts
41802
+ import { randomUUID as randomUUID26 } from "node:crypto";
41511
41803
  import { setTimeout as waitForPublication } from "node:timers/promises";
41512
41804
  import { accessSync as accessSync7, constants as constants13, realpathSync as realpathSync15, statSync as statSync12 } from "node:fs";
41513
41805
  import { isAbsolute as isAbsolute19 } from "node:path";
@@ -41518,6 +41810,7 @@ var init_mirror_service = __esm({
41518
41810
  "use strict";
41519
41811
  init_src2();
41520
41812
  init_window_split_authority();
41813
+ init_stock_split_resize();
41521
41814
  init_shared_window_index();
41522
41815
  init_registered_window_guard();
41523
41816
  init_tmux_client_execution();
@@ -41725,9 +42018,16 @@ var init_mirror_service = __esm({
41725
42018
  ready = await this.opts.splitLayoutPrepare();
41726
42019
  } catch {
41727
42020
  }
41728
- if (!ready || this.disposed || entry.retired || this.channels.get(session) !== entry)
42021
+ if (!ready) {
42022
+ const stock = await this.#stockSplitServer();
42023
+ if (!stock || this.disposed || entry.retired || this.channels.get(session) !== entry)
42024
+ throw new WindowSplitLayoutUnavailable();
42025
+ return this.#readStockSplitLayout(entry, target);
42026
+ }
42027
+ if (this.disposed || entry.retired || this.channels.get(session) !== entry)
41729
42028
  throw new WindowSplitLayoutUnavailable();
41730
42029
  }
42030
+ if (entry.stockSplitEpoch) throw new WindowSplitLayoutUnavailable();
41731
42031
  const epoch = this.opts.splitLayoutEpoch?.();
41732
42032
  let supported = false;
41733
42033
  try {
@@ -41742,6 +42042,23 @@ var init_mirror_service = __esm({
41742
42042
  });
41743
42043
  return entry.splitAuthority.read(target);
41744
42044
  }
42045
+ async #stockSplitServer() {
42046
+ try {
42047
+ return await this.opts.splitLayoutStock?.() === true;
42048
+ } catch {
42049
+ return false;
42050
+ }
42051
+ }
42052
+ #readStockSplitLayout(entry, target) {
42053
+ if (entry.splitAuthority && !entry.stockSplitEpoch) throw new WindowSplitLayoutUnavailable();
42054
+ const epoch = entry.stockSplitEpoch ??= randomUUID26();
42055
+ entry.splitAuthority ??= new WindowSplitAuthority({
42056
+ describe: (window2) => entry.channel.describeSplitLayout(window2, true),
42057
+ serverEpoch: () => epoch,
42058
+ stock: true
42059
+ });
42060
+ return entry.splitAuthority.read(target);
42061
+ }
41745
42062
  /** Resolve only issued handles, then revalidate immediately at native dispatch. */
41746
42063
  async resizeWindowSplit(session, target, operationId, authorizeBeforeEffect, runNative) {
41747
42064
  const captured = WindowSplitResizeTargetSchemaZ.parse(target);
@@ -41756,15 +42073,19 @@ var init_mirror_service = __esm({
41756
42073
  await entry.started;
41757
42074
  const resolved2 = current().resolve(captured);
41758
42075
  const successor = current().prepareSuccessor(captured);
41759
- const result2 = await runNative(resolved2.request, {
42076
+ const authorize = () => {
42077
+ current().resolve(captured);
42078
+ authorizeBeforeEffect();
42079
+ };
42080
+ const result2 = entry.stockSplitEpoch ? await resizeStockSplit(resolved2.request, resolved2.session.created, authorize, {
42081
+ readOptions: (windowId) => entry.channel.stockSplitOptions(windowId),
42082
+ send: (command3) => entry.channel.stockSplitCommand(command3)
42083
+ }) : await runNative(resolved2.request, {
41760
42084
  operationId,
41761
42085
  serverEpoch: resolved2.serverEpoch,
41762
42086
  session: resolved2.session,
41763
42087
  anchor: resolved2.anchor,
41764
- authorizeBeforeEffect: () => {
41765
- current().resolve(captured);
41766
- authorizeBeforeEffect();
41767
- }
42088
+ authorizeBeforeEffect: authorize
41768
42089
  });
41769
42090
  if (result2.status !== "applied") return result2;
41770
42091
  const deadline = performance.now() + 100;
@@ -42370,7 +42691,7 @@ var init_semantic_mutation_resource_changes = __esm({
42370
42691
  });
42371
42692
 
42372
42693
  // packages/daemon/src/terminal/session-runtime/semantic-mutation-executor.ts
42373
- import { randomUUID as randomUUID25 } from "node:crypto";
42694
+ import { randomUUID as randomUUID27 } from "node:crypto";
42374
42695
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
42375
42696
  import { z as z105 } from "zod";
42376
42697
  function replayedResult(result2) {
@@ -42637,7 +42958,7 @@ var init_semantic_mutation_executor = __esm({
42637
42958
  this.#publish(operationId, intent, "rejected", null, void 0, origin, interactionContext);
42638
42959
  throw error;
42639
42960
  }
42640
- const executionId = randomUUID25();
42961
+ const executionId = randomUUID27();
42641
42962
  const needsTmuxObservation = sessionRuntimeIntentNeedsTmuxObservation(intent);
42642
42963
  let observed = null;
42643
42964
  if (needsTmuxObservation) {
@@ -42856,7 +43177,7 @@ var init_semantic_mutation_executor = __esm({
42856
43177
  });
42857
43178
 
42858
43179
  // packages/daemon/src/terminal/session-runtime/history-anchor-owner.ts
42859
- import { randomUUID as randomUUID26 } from "node:crypto";
43180
+ import { randomUUID as randomUUID28 } from "node:crypto";
42860
43181
  var MAX_TOKENS, PROOF_TTL_MS, HistoryAnchorOwner;
42861
43182
  var init_history_anchor_owner = __esm({
42862
43183
  "packages/daemon/src/terminal/session-runtime/history-anchor-owner.ts"() {
@@ -42950,7 +43271,7 @@ var init_history_anchor_owner = __esm({
42950
43271
  const ordinal = known.first + historyIndex;
42951
43272
  if (ordinal < this.#first || ordinal >= this.#first + this.#length) return { status: "lost" };
42952
43273
  while (this.#tokens.size >= MAX_TOKENS) this.#tokens.delete(this.#tokens.keys().next().value);
42953
- const token2 = randomUUID26();
43274
+ const token2 = randomUUID28();
42954
43275
  this.#tokens.set(token2, { ordinal });
42955
43276
  return { status: "captured", token: token2 };
42956
43277
  }
@@ -43339,15 +43660,15 @@ var init_terminal_conformance = __esm({
43339
43660
 
43340
43661
  // packages/core/src/terminal-compact-capability.ts
43341
43662
  function consumeCompactReplicaCapability(owner, baseline, hash) {
43342
- const capability2 = compactReplicaCapabilities.get(owner);
43663
+ const capability = compactReplicaCapabilities.get(owner);
43343
43664
  compactReplicaCapabilities.delete(owner);
43344
- if (!capability2 || capability2.baseline !== baseline || capability2.hash !== hash) return void 0;
43345
- return capability2.snapshot;
43665
+ if (!capability || capability.baseline !== baseline || capability.hash !== hash) return void 0;
43666
+ return capability.snapshot;
43346
43667
  }
43347
43668
  function consumeVerifiedTombstoneInterval(owner, baseline, hash, baseRevision, revision) {
43348
- const capability2 = compactReplicaCapabilities.get(owner);
43669
+ const capability = compactReplicaCapabilities.get(owner);
43349
43670
  compactReplicaCapabilities.delete(owner);
43350
- return capability2 !== void 0 && capability2.baseline === baseline && capability2.snapshot === null && capability2.hash === hash && capability2.tombstoneInterval?.baseRevision === baseRevision && capability2.tombstoneInterval.revision === revision;
43671
+ return capability !== void 0 && capability.baseline === baseline && capability.snapshot === null && capability.hash === hash && capability.tombstoneInterval?.baseRevision === baseRevision && capability.tombstoneInterval.revision === revision;
43351
43672
  }
43352
43673
  var compactReplicaCapabilities;
43353
43674
  var init_terminal_compact_capability = __esm({
@@ -43804,11 +44125,14 @@ function initialize() {
43804
44125
  }
43805
44126
  return native;
43806
44127
  }
44128
+ function nativeFnv64() {
44129
+ return initialize();
44130
+ }
43807
44131
  function createBufferedFnv64(initialState = OFFSET_BASIS) {
43808
44132
  const hasher = initialize();
43809
44133
  return hasher ? new BufferedHasher(hasher, initialState) : null;
43810
44134
  }
43811
- var SCRATCH_BYTES, OFFSET_BASIS, initialized, native, BufferedHasher;
44135
+ var SCRATCH_BYTES, OFFSET_BASIS, initialized, native, FNV64_OFFSET_BASIS, BufferedHasher;
43812
44136
  var init_terminal_fnv64_wasm = __esm({
43813
44137
  "packages/core/src/terminal-fnv64-wasm.ts"() {
43814
44138
  "use strict";
@@ -43817,6 +44141,7 @@ var init_terminal_fnv64_wasm = __esm({
43817
44141
  OFFSET_BASIS = 0xcbf29ce484222325n;
43818
44142
  initialized = false;
43819
44143
  native = null;
44144
+ FNV64_OFFSET_BASIS = OFFSET_BASIS;
43820
44145
  BufferedHasher = class {
43821
44146
  #native;
43822
44147
  #buffer = new Uint8Array(SCRATCH_BYTES);
@@ -43836,9 +44161,9 @@ var init_terminal_fnv64_wasm = __esm({
43836
44161
  let offset = 0;
43837
44162
  while (offset < value.length) {
43838
44163
  const count = Math.min(SCRATCH_BYTES - this.#length, value.length - offset);
43839
- const start2 = this.#length;
44164
+ const start3 = this.#length;
43840
44165
  for (let index = 0; index < count; index++)
43841
- this.#buffer[start2 + index] = value.charCodeAt(offset + index);
44166
+ this.#buffer[start3 + index] = value.charCodeAt(offset + index);
43842
44167
  this.#length += count;
43843
44168
  offset += count;
43844
44169
  if (this.#length === SCRATCH_BYTES) this.#flush();
@@ -43954,6 +44279,12 @@ function hashTerminalReplicaRowCached(row, onMiss, encodingCache) {
43954
44279
  const cached2 = ROW_HASH_CACHE.get(row);
43955
44280
  if (cached2) return cached2;
43956
44281
  onMiss?.();
44282
+ const native2 = nativeFnv64();
44283
+ if (native2) {
44284
+ const digest4 = hashRowBytes(row, native2);
44285
+ if (isTerminalReplicaRowDeeplyFrozen(row)) ROW_HASH_CACHE.set(row, digest4);
44286
+ return digest4;
44287
+ }
43957
44288
  const hash = encodingCache?.createHash() ?? new CanonicalFnv64();
43958
44289
  let canonicalBytes = 10 + String(row.cells.length).length;
43959
44290
  hash.ascii("a2:");
@@ -44017,6 +44348,10 @@ async function hashTerminalReplicaRowCooperatively(row, yieldControl, bytesPerSl
44017
44348
  }
44018
44349
  function isTerminalReplicaRowDeeplyFrozen(row) {
44019
44350
  if (DEEPLY_FROZEN_ROWS.has(row)) return true;
44351
+ if (isOwnedTerminalReplicaRow(row)) {
44352
+ DEEPLY_FROZEN_ROWS.add(row);
44353
+ return true;
44354
+ }
44020
44355
  if (!Object.isFrozen(row) || !Object.isFrozen(row.cells)) return false;
44021
44356
  for (const cell of row.cells) {
44022
44357
  if (!Object.isFrozen(cell) || !Object.isFrozen(cell.foreground) || !Object.isFrozen(cell.background))
@@ -44025,7 +44360,74 @@ function isTerminalReplicaRowDeeplyFrozen(row) {
44025
44360
  DEEPLY_FROZEN_ROWS.add(row);
44026
44361
  return true;
44027
44362
  }
44028
- var ROW_HASH_CACHE, DEEPLY_FROZEN_ROWS, UTF8_ENCODER, SHORT_ASCII_HEADERS, DEFAULT_COLOR_KEYS, DEFAULT_COLOR_KEY_ORDER, CanonicalFnv64, compactColorKey, TerminalReplicaRunEncodingCache, DECODED_DEFAULT_COLOR;
44363
+ function canonicalNumber(value) {
44364
+ const text2 = String(value);
44365
+ return `d${text2.length}:${text2};`;
44366
+ }
44367
+ function canonicalColor(color3) {
44368
+ if (color3.kind === "default") return "o1:s4:kind;s7:default;;";
44369
+ if (color3.kind === "indexed")
44370
+ return `o2:s5:index;${canonicalNumber(color3.index)}s4:kind;s7:indexed;;`;
44371
+ return `o2:s4:kind;s3:rgb;s5:value;${canonicalNumber(color3.value)};`;
44372
+ }
44373
+ function encodeCell(cell) {
44374
+ const grapheme = cell.grapheme;
44375
+ let length = grapheme.length;
44376
+ for (let index = 0; index < grapheme.length; index += 1)
44377
+ if (grapheme.charCodeAt(index) > 127) {
44378
+ length = UTF8_ENCODER.encode(grapheme).byteLength;
44379
+ break;
44380
+ }
44381
+ return UTF8_ENCODER.encode(
44382
+ `a5:s${length}:${grapheme};${canonicalNumber(cell.width)}${canonicalColor(
44383
+ cell.foreground
44384
+ )}${canonicalColor(cell.background)}${canonicalNumber(cell.attributes)};`
44385
+ );
44386
+ }
44387
+ function remember(cache3, key2, bytes) {
44388
+ if (cache3.size >= CELL_BYTES_LIMIT) cache3.clear();
44389
+ cache3.set(key2, bytes);
44390
+ return bytes;
44391
+ }
44392
+ function cellBytes(cell) {
44393
+ const { grapheme, width, attributes, foreground, background } = cell;
44394
+ if (width === 1 && attributes === 0 && foreground.kind === "default" && background.kind === "default")
44395
+ return PLAIN_CELL_BYTES.get(grapheme) ?? remember(PLAIN_CELL_BYTES, grapheme, encodeCell(cell));
44396
+ const key2 = `${width}\0${attributes}\0${canonicalColor(foreground)}\0${canonicalColor(
44397
+ background
44398
+ )}\0${grapheme}`;
44399
+ return STYLED_CELL_BYTES.get(key2) ?? remember(STYLED_CELL_BYTES, key2, encodeCell(cell));
44400
+ }
44401
+ function hashRowBytes(row, native2) {
44402
+ const scratch = native2.scratch;
44403
+ const capacity = scratch.byteLength;
44404
+ let state = FNV64_OFFSET_BASIS;
44405
+ let length = 0;
44406
+ const write2 = (bytes) => {
44407
+ if (bytes.byteLength <= capacity - length) {
44408
+ scratch.set(bytes, length);
44409
+ length += bytes.byteLength;
44410
+ return;
44411
+ }
44412
+ let offset = 0;
44413
+ while (offset < bytes.byteLength) {
44414
+ const count = Math.min(capacity - length, bytes.byteLength - offset);
44415
+ scratch.set(bytes.subarray(offset, offset + count), length);
44416
+ length += count;
44417
+ offset += count;
44418
+ if (length === capacity) {
44419
+ state = BigInt.asUintN(64, native2.update(state, length));
44420
+ length = 0;
44421
+ }
44422
+ }
44423
+ };
44424
+ write2(ASCII_ENCODER.encode(`a2:${row.wrapped ? "b1;" : "b0;"}a${row.cells.length}:`));
44425
+ for (const cell of row.cells) write2(cellBytes(cell));
44426
+ write2(ROW_TRAILER);
44427
+ state = BigInt.asUintN(64, native2.update(state, length));
44428
+ return state.toString(16).padStart(16, "0");
44429
+ }
44430
+ var ROW_HASH_CACHE, DEEPLY_FROZEN_ROWS, UTF8_ENCODER, SHORT_ASCII_HEADERS, DEFAULT_COLOR_KEYS, DEFAULT_COLOR_KEY_ORDER, CanonicalFnv64, compactColorKey, TerminalReplicaRunEncodingCache, DECODED_DEFAULT_COLOR, ASCII_ENCODER, CELL_BYTES_LIMIT, PLAIN_CELL_BYTES, STYLED_CELL_BYTES, ROW_TRAILER;
44029
44431
  var init_terminal_replica_hash_cache = __esm({
44030
44432
  "packages/core/src/terminal-replica-hash-cache.ts"() {
44031
44433
  "use strict";
@@ -44272,6 +44674,11 @@ var init_terminal_replica_hash_cache = __esm({
44272
44674
  }
44273
44675
  };
44274
44676
  DECODED_DEFAULT_COLOR = Object.freeze({ kind: "default" });
44677
+ ASCII_ENCODER = new TextEncoder();
44678
+ CELL_BYTES_LIMIT = 4096;
44679
+ PLAIN_CELL_BYTES = /* @__PURE__ */ new Map();
44680
+ STYLED_CELL_BYTES = /* @__PURE__ */ new Map();
44681
+ ROW_TRAILER = ASCII_ENCODER.encode(";;");
44275
44682
  }
44276
44683
  });
44277
44684
 
@@ -44891,6 +45298,16 @@ function resolveFrameHash(update, options, profile) {
44891
45298
  return hash;
44892
45299
  }
44893
45300
  function terminalReplicaFrameIdentity(update) {
45301
+ if (update.type === "terminal.patch") {
45302
+ const { rows, history: history2, historyDelta, ...rest2 } = update.patch;
45303
+ return [
45304
+ "terminal-replica-patch-frame-v2",
45305
+ { ...update, patch: rest2 },
45306
+ rows.map(({ index, row }) => [index, hashTerminalReplicaRow(row)]),
45307
+ history2 === void 0 ? null : hashTerminalReplicaRows(history2),
45308
+ historyDelta === void 0 ? null : [historyDelta.trim, hashTerminalReplicaRows(historyDelta.append)]
45309
+ ];
45310
+ }
44894
45311
  if (update.type !== "terminal.seed") return update;
44895
45312
  const { grid, history, ...rest } = update.snapshot;
44896
45313
  return [
@@ -46660,10 +47077,10 @@ function projectNativeGridRow(source, columns, startColumn = 0, wrapped = false)
46660
47077
  const clippedOwner = x === 0 && (native2.flags & 4) !== 0 && previous?.width === 2 && !(previous.flags & 4);
46661
47078
  const styled = paint(clippedOwner ? previous : native2);
46662
47079
  if (native2.flags & (4 | 64 | 128) || native2.width < 1 || native2.width > 2 || x + native2.width > columns) {
46663
- const span = native2.flags & 128 ? Math.max(1, Math.min(native2.width, columns - x)) : 1;
47080
+ const span2 = native2.flags & 128 ? Math.max(1, Math.min(native2.width, columns - x)) : 1;
46664
47081
  const blank = freezePaint({ ...styled, grapheme: "", width: 1 });
46665
- for (let offset = 0; offset < span; offset++) cells[x + offset] = blank;
46666
- x += span - 1;
47082
+ for (let offset = 0; offset < span2; offset++) cells[x + offset] = blank;
47083
+ x += span2 - 1;
46667
47084
  continue;
46668
47085
  }
46669
47086
  cells[x] = freezePaint(styled);
@@ -46742,9 +47159,9 @@ function stringFromCodePoint(codePoint) {
46742
47159
  }
46743
47160
  return String.fromCharCode(codePoint);
46744
47161
  }
46745
- function utf32ToString(data, start2 = 0, end = data.length) {
47162
+ function utf32ToString(data, start3 = 0, end = data.length) {
46746
47163
  let result2 = "";
46747
- for (let i = start2; i < end; ++i) {
47164
+ for (let i = start3; i < end; ++i) {
46748
47165
  let codepoint = data[i];
46749
47166
  if (codepoint > 65535) {
46750
47167
  codepoint -= 65536;
@@ -49657,30 +50074,30 @@ ${stackTraceFormattedLines.join("\n")}
49657
50074
  this.setCellFromCodepoint(pos, 0, 1, fillCellData);
49658
50075
  }
49659
50076
  }
49660
- replaceCells(start2, end, fillCellData, respectProtect = false) {
50077
+ replaceCells(start3, end, fillCellData, respectProtect = false) {
49661
50078
  if (respectProtect) {
49662
- if (start2 && this.getWidth(start2 - 1) === 2 && !this.isProtected(start2 - 1)) {
49663
- this.setCellFromCodepoint(start2 - 1, 0, 1, fillCellData);
50079
+ if (start3 && this.getWidth(start3 - 1) === 2 && !this.isProtected(start3 - 1)) {
50080
+ this.setCellFromCodepoint(start3 - 1, 0, 1, fillCellData);
49664
50081
  }
49665
50082
  if (end < this.length && this.getWidth(end - 1) === 2 && !this.isProtected(end)) {
49666
50083
  this.setCellFromCodepoint(end, 0, 1, fillCellData);
49667
50084
  }
49668
- while (start2 < end && start2 < this.length) {
49669
- if (!this.isProtected(start2)) {
49670
- this.setCell(start2, fillCellData);
50085
+ while (start3 < end && start3 < this.length) {
50086
+ if (!this.isProtected(start3)) {
50087
+ this.setCell(start3, fillCellData);
49671
50088
  }
49672
- start2++;
50089
+ start3++;
49673
50090
  }
49674
50091
  return;
49675
50092
  }
49676
- if (start2 && this.getWidth(start2 - 1) === 2) {
49677
- this.setCellFromCodepoint(start2 - 1, 0, 1, fillCellData);
50093
+ if (start3 && this.getWidth(start3 - 1) === 2) {
50094
+ this.setCellFromCodepoint(start3 - 1, 0, 1, fillCellData);
49678
50095
  }
49679
50096
  if (end < this.length && this.getWidth(end - 1) === 2) {
49680
50097
  this.setCellFromCodepoint(end, 0, 1, fillCellData);
49681
50098
  }
49682
- while (start2 < end && start2 < this.length) {
49683
- this.setCell(start2++, fillCellData);
50099
+ while (start3 < end && start3 < this.length) {
50100
+ this.setCell(start3++, fillCellData);
49684
50101
  }
49685
50102
  }
49686
50103
  /**
@@ -50145,22 +50562,22 @@ ${stackTraceFormattedLines.join("\n")}
50145
50562
  * @param deleteCount The number of elements to delete.
50146
50563
  * @param items The items to insert.
50147
50564
  */
50148
- splice(start2, deleteCount, ...items) {
50565
+ splice(start3, deleteCount, ...items) {
50149
50566
  if (deleteCount) {
50150
- for (let i = start2; i < this._length - deleteCount; i++) {
50567
+ for (let i = start3; i < this._length - deleteCount; i++) {
50151
50568
  this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];
50152
50569
  }
50153
50570
  this._length -= deleteCount;
50154
- this.onDeleteEmitter.fire({ index: start2, amount: deleteCount });
50571
+ this.onDeleteEmitter.fire({ index: start3, amount: deleteCount });
50155
50572
  }
50156
- for (let i = this._length - 1; i >= start2; i--) {
50573
+ for (let i = this._length - 1; i >= start3; i--) {
50157
50574
  this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];
50158
50575
  }
50159
50576
  for (let i = 0; i < items.length; i++) {
50160
- this._array[this._getCyclicIndex(start2 + i)] = items[i];
50577
+ this._array[this._getCyclicIndex(start3 + i)] = items[i];
50161
50578
  }
50162
50579
  if (items.length) {
50163
- this.onInsertEmitter.fire({ index: start2, amount: items.length });
50580
+ this.onInsertEmitter.fire({ index: start3, amount: items.length });
50164
50581
  }
50165
50582
  if (this._length + items.length > this._maxLength) {
50166
50583
  const countToTrim = this._length + items.length - this._maxLength;
@@ -50183,21 +50600,21 @@ ${stackTraceFormattedLines.join("\n")}
50183
50600
  this._length -= count;
50184
50601
  this.onTrimEmitter.fire(count);
50185
50602
  }
50186
- shiftElements(start2, count, offset) {
50603
+ shiftElements(start3, count, offset) {
50187
50604
  if (count <= 0) {
50188
50605
  return;
50189
50606
  }
50190
- if (start2 < 0 || start2 >= this._length) {
50607
+ if (start3 < 0 || start3 >= this._length) {
50191
50608
  throw new Error("start argument out of range");
50192
50609
  }
50193
- if (start2 + offset < 0) {
50610
+ if (start3 + offset < 0) {
50194
50611
  throw new Error("Cannot shift elements in list beyond index 0");
50195
50612
  }
50196
50613
  if (offset > 0) {
50197
50614
  for (let i = count - 1; i >= 0; i--) {
50198
- this.set(start2 + i + offset, this.get(start2 + i));
50615
+ this.set(start3 + i + offset, this.get(start3 + i));
50199
50616
  }
50200
- const expandListBy = start2 + count + offset - this._length;
50617
+ const expandListBy = start3 + count + offset - this._length;
50201
50618
  if (expandListBy > 0) {
50202
50619
  this._length += expandListBy;
50203
50620
  while (this._length > this._maxLength) {
@@ -50208,7 +50625,7 @@ ${stackTraceFormattedLines.join("\n")}
50208
50625
  }
50209
50626
  } else {
50210
50627
  for (let i = 0; i < count; i++) {
50211
- this.set(start2 + i + offset, this.get(start2 + i));
50628
+ this.set(start3 + i + offset, this.get(start3 + i));
50212
50629
  }
50213
50630
  }
50214
50631
  }
@@ -52166,10 +52583,10 @@ ${stackTraceFormattedLines.join("\n")}
52166
52583
  const res = [];
52167
52584
  for (let i = 0; i < this.length; ++i) {
52168
52585
  res.push(this.params[i]);
52169
- const start2 = this._subParamsIdx[i] >> 8;
52586
+ const start3 = this._subParamsIdx[i] >> 8;
52170
52587
  const end = this._subParamsIdx[i] & 255;
52171
- if (end - start2 > 0) {
52172
- res.push(Array.prototype.slice.call(this._subParams, start2, end));
52588
+ if (end - start3 > 0) {
52589
+ res.push(Array.prototype.slice.call(this._subParams, start3, end));
52173
52590
  }
52174
52591
  }
52175
52592
  return res;
@@ -52237,10 +52654,10 @@ ${stackTraceFormattedLines.join("\n")}
52237
52654
  * the values if you need to hold them in nonlocal scope.
52238
52655
  */
52239
52656
  getSubParams(idx) {
52240
- const start2 = this._subParamsIdx[idx] >> 8;
52657
+ const start3 = this._subParamsIdx[idx] >> 8;
52241
52658
  const end = this._subParamsIdx[idx] & 255;
52242
- if (end - start2 > 0) {
52243
- return this._subParams.subarray(start2, end);
52659
+ if (end - start3 > 0) {
52660
+ return this._subParams.subarray(start3, end);
52244
52661
  }
52245
52662
  return null;
52246
52663
  }
@@ -52251,10 +52668,10 @@ ${stackTraceFormattedLines.join("\n")}
52251
52668
  getSubParamsAll() {
52252
52669
  const result2 = {};
52253
52670
  for (let i = 0; i < this.length; ++i) {
52254
- const start2 = this._subParamsIdx[i] >> 8;
52671
+ const start3 = this._subParamsIdx[i] >> 8;
52255
52672
  const end = this._subParamsIdx[i] & 255;
52256
- if (end - start2 > 0) {
52257
- result2[i] = this._subParams.slice(start2, end);
52673
+ if (end - start3 > 0) {
52674
+ result2[i] = this._subParams.slice(start3, end);
52258
52675
  }
52259
52676
  }
52260
52677
  return result2;
@@ -52336,12 +52753,12 @@ ${stackTraceFormattedLines.join("\n")}
52336
52753
  }
52337
52754
  }
52338
52755
  }
52339
- _put(data, start2, end) {
52756
+ _put(data, start3, end) {
52340
52757
  if (!this._active.length) {
52341
- this._handlerFb(this._id, "PUT", utf32ToString(data, start2, end));
52758
+ this._handlerFb(this._id, "PUT", utf32ToString(data, start3, end));
52342
52759
  } else {
52343
52760
  for (let j = this._active.length - 1; j >= 0; j--) {
52344
- this._active[j].put(data, start2, end);
52761
+ this._active[j].put(data, start3, end);
52345
52762
  }
52346
52763
  }
52347
52764
  }
@@ -52356,13 +52773,13 @@ ${stackTraceFormattedLines.join("\n")}
52356
52773
  * Payload chunks are not further processed and get
52357
52774
  * directly passed to the handlers.
52358
52775
  */
52359
- put(data, start2, end) {
52776
+ put(data, start3, end) {
52360
52777
  if (this._state === 3) {
52361
52778
  return;
52362
52779
  }
52363
52780
  if (this._state === 1) {
52364
- while (start2 < end) {
52365
- const code2 = data[start2++];
52781
+ while (start3 < end) {
52782
+ const code2 = data[start3++];
52366
52783
  if (code2 === 59) {
52367
52784
  this._state = 2;
52368
52785
  this._start();
@@ -52378,8 +52795,8 @@ ${stackTraceFormattedLines.join("\n")}
52378
52795
  this._id = this._id * 10 + code2 - 48;
52379
52796
  }
52380
52797
  }
52381
- if (this._state === 2 && end - start2 > 0) {
52382
- this._put(data, start2, end);
52798
+ if (this._state === 2 && end - start3 > 0) {
52799
+ this._put(data, start3, end);
52383
52800
  }
52384
52801
  }
52385
52802
  /**
@@ -52447,11 +52864,11 @@ ${stackTraceFormattedLines.join("\n")}
52447
52864
  this._data = "";
52448
52865
  this._hitLimit = false;
52449
52866
  }
52450
- put(data, start2, end) {
52867
+ put(data, start3, end) {
52451
52868
  if (this._hitLimit) {
52452
52869
  return;
52453
52870
  }
52454
- this._data += utf32ToString(data, start2, end);
52871
+ this._data += utf32ToString(data, start3, end);
52455
52872
  if (this._data.length > PAYLOAD_LIMIT) {
52456
52873
  this._data = "";
52457
52874
  this._hitLimit = true;
@@ -52539,12 +52956,12 @@ ${stackTraceFormattedLines.join("\n")}
52539
52956
  }
52540
52957
  }
52541
52958
  }
52542
- put(data, start2, end) {
52959
+ put(data, start3, end) {
52543
52960
  if (!this._active.length) {
52544
- this._handlerFb(this._ident, "PUT", utf32ToString(data, start2, end));
52961
+ this._handlerFb(this._ident, "PUT", utf32ToString(data, start3, end));
52545
52962
  } else {
52546
52963
  for (let j = this._active.length - 1; j >= 0; j--) {
52547
- this._active[j].put(data, start2, end);
52964
+ this._active[j].put(data, start3, end);
52548
52965
  }
52549
52966
  }
52550
52967
  }
@@ -52603,11 +53020,11 @@ ${stackTraceFormattedLines.join("\n")}
52603
53020
  this._data = "";
52604
53021
  this._hitLimit = false;
52605
53022
  }
52606
- put(data, start2, end) {
53023
+ put(data, start3, end) {
52607
53024
  if (this._hitLimit) {
52608
53025
  return;
52609
53026
  }
52610
- this._data += utf32ToString(data, start2, end);
53027
+ this._data += utf32ToString(data, start3, end);
52611
53028
  if (this._data.length > PAYLOAD_LIMIT) {
52612
53029
  this._data = "";
52613
53030
  this._hitLimit = true;
@@ -52674,7 +53091,7 @@ ${stackTraceFormattedLines.join("\n")}
52674
53091
  const table2 = new TransitionTable(4095);
52675
53092
  const BYTE_VALUES = 256;
52676
53093
  const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused, i) => i);
52677
- const r = (start2, end) => blueprint.slice(start2, end);
53094
+ const r = (start3, end) => blueprint.slice(start3, end);
52678
53095
  const PRINTABLES = r(32, 127);
52679
53096
  const EXECUTABLES = r(0, 24);
52680
53097
  EXECUTABLES.push(25);
@@ -53323,7 +53740,7 @@ ${stackTraceFormattedLines.join("\n")}
53323
53740
  this._params.addParam(0);
53324
53741
  this._collect = 0;
53325
53742
  this.precedingJoinState = 0;
53326
- this._printHandlerFb = (data, start2, end) => {
53743
+ this._printHandlerFb = (data, start3, end) => {
53327
53744
  };
53328
53745
  this._executeHandlerFb = (code2) => {
53329
53746
  };
@@ -53548,12 +53965,12 @@ ${stackTraceFormattedLines.join("\n")}
53548
53965
  parse(data, length, promiseResult) {
53549
53966
  let code2 = 0;
53550
53967
  let transition = 0;
53551
- let start2 = 0;
53968
+ let start3 = 0;
53552
53969
  let handlerResult;
53553
53970
  if (this._parseStack.state) {
53554
53971
  if (this._parseStack.state === 2) {
53555
53972
  this._parseStack.state = 0;
53556
- start2 = this._parseStack.chunkPos + 1;
53973
+ start3 = this._parseStack.chunkPos + 1;
53557
53974
  } else {
53558
53975
  if (promiseResult === void 0 || this._parseStack.state === 1) {
53559
53976
  this._parseStack.state = 1;
@@ -53614,12 +54031,12 @@ ${stackTraceFormattedLines.join("\n")}
53614
54031
  break;
53615
54032
  }
53616
54033
  this._parseStack.state = 0;
53617
- start2 = this._parseStack.chunkPos + 1;
54034
+ start3 = this._parseStack.chunkPos + 1;
53618
54035
  this.precedingJoinState = 0;
53619
54036
  this.currentState = this._parseStack.transition & 15;
53620
54037
  }
53621
54038
  }
53622
- for (let i = start2; i < length; ++i) {
54039
+ for (let i = start3; i < length; ++i) {
53623
54040
  code2 = data[i];
53624
54041
  transition = this._transitions.table[this.currentState << 8 | (code2 < 160 ? code2 : NON_ASCII_PRINTABLE)];
53625
54042
  switch (transition >> 4) {
@@ -53867,7 +54284,7 @@ ${stackTraceFormattedLines.join("\n")}
53867
54284
  }
53868
54285
  this._logService.debug("Unknown DCS code: ", { identifier: this._parser.identToString(ident), action, payload });
53869
54286
  });
53870
- this._parser.setPrintHandler((data, start2, end) => this.print(data, start2, end));
54287
+ this._parser.setPrintHandler((data, start3, end) => this.print(data, start3, end));
53871
54288
  this._parser.registerCsiHandler({ final: "@" }, (params) => this.insertChars(params));
53872
54289
  this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, (params) => this.scrollLeft(params));
53873
54290
  this._parser.registerCsiHandler({ final: "A" }, (params) => this.cursorUp(params));
@@ -54021,7 +54438,7 @@ ${stackTraceFormattedLines.join("\n")}
54021
54438
  let result2;
54022
54439
  let cursorStartX = this._activeBuffer.x;
54023
54440
  let cursorStartY = this._activeBuffer.y;
54024
- let start2 = 0;
54441
+ let start3 = 0;
54025
54442
  const wasPaused = this._parseStack.paused;
54026
54443
  if (wasPaused) {
54027
54444
  if (result2 = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, promiseResult)) {
@@ -54032,7 +54449,7 @@ ${stackTraceFormattedLines.join("\n")}
54032
54449
  cursorStartY = this._parseStack.cursorStartY;
54033
54450
  this._parseStack.paused = false;
54034
54451
  if (data.length > MAX_PARSEBUFFER_LENGTH) {
54035
- start2 = this._parseStack.position + MAX_PARSEBUFFER_LENGTH;
54452
+ start3 = this._parseStack.position + MAX_PARSEBUFFER_LENGTH;
54036
54453
  }
54037
54454
  }
54038
54455
  if (this._logService.logLevel <= 1) {
@@ -54053,7 +54470,7 @@ ${stackTraceFormattedLines.join("\n")}
54053
54470
  this._dirtyRowTracker.clearRange();
54054
54471
  }
54055
54472
  if (data.length > MAX_PARSEBUFFER_LENGTH) {
54056
- for (let i = start2; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {
54473
+ for (let i = start3; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {
54057
54474
  const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length;
54058
54475
  const len = typeof data === "string" ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer) : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer);
54059
54476
  if (result2 = this._parser.parse(this._parseBuffer, len)) {
@@ -54084,7 +54501,7 @@ ${stackTraceFormattedLines.join("\n")}
54084
54501
  });
54085
54502
  }
54086
54503
  }
54087
- print(data, start2, end) {
54504
+ print(data, start3, end) {
54088
54505
  let code2;
54089
54506
  let chWidth;
54090
54507
  const charset = this._charsetService.charset;
@@ -54095,11 +54512,11 @@ ${stackTraceFormattedLines.join("\n")}
54095
54512
  const curAttr = this._curAttrData;
54096
54513
  let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
54097
54514
  this._dirtyRowTracker.markDirty(this._activeBuffer.y);
54098
- if (this._activeBuffer.x && end - start2 > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) {
54515
+ if (this._activeBuffer.x && end - start3 > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) {
54099
54516
  bufferRow.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, curAttr);
54100
54517
  }
54101
54518
  let precedingJoinState = this._parser.precedingJoinState;
54102
- for (let pos = start2; pos < end; ++pos) {
54519
+ for (let pos = start3; pos < end; ++pos) {
54103
54520
  code2 = data[pos];
54104
54521
  if (code2 < 127 && charset) {
54105
54522
  const ch = charset[String.fromCharCode(code2)];
@@ -54183,7 +54600,7 @@ ${stackTraceFormattedLines.join("\n")}
54183
54600
  }
54184
54601
  }
54185
54602
  this._parser.precedingJoinState = precedingJoinState;
54186
- if (this._activeBuffer.x < cols && end - start2 > 0 && bufferRow.getWidth(this._activeBuffer.x) === 0 && !bufferRow.hasContent(this._activeBuffer.x)) {
54603
+ if (this._activeBuffer.x < cols && end - start3 > 0 && bufferRow.getWidth(this._activeBuffer.x) === 0 && !bufferRow.hasContent(this._activeBuffer.x)) {
54187
54604
  bufferRow.setCellFromCodepoint(this._activeBuffer.x, 0, 1, curAttr);
54188
54605
  }
54189
54606
  this._dirtyRowTracker.markDirty(this._activeBuffer.y);
@@ -54609,15 +55026,15 @@ ${stackTraceFormattedLines.join("\n")}
54609
55026
  * @param clearWrap clear the isWrapped flag
54610
55027
  * @param respectProtect Whether to respect the protection attribute (DECSCA).
54611
55028
  */
54612
- _eraseInBufferLine(y, start2, end, clearWrap = false, respectProtect = false) {
55029
+ _eraseInBufferLine(y, start3, end, clearWrap = false, respectProtect = false) {
54613
55030
  const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);
54614
55031
  line.replaceCells(
54615
- start2,
55032
+ start3,
54616
55033
  end,
54617
55034
  this._activeBuffer.getNullCell(this._eraseAttrData()),
54618
55035
  respectProtect
54619
55036
  );
54620
- if (!respectProtect && start2 === 0 && end >= this._bufferService.cols) line.tmuxCellUsed = 0;
55037
+ if (!respectProtect && start3 === 0 && end >= this._bufferService.cols) line.tmuxCellUsed = 0;
54621
55038
  if (clearWrap) {
54622
55039
  line.isWrapped = false;
54623
55040
  }
@@ -64188,7 +64605,7 @@ var init_authority_arbiter = __esm({
64188
64605
  });
64189
64606
 
64190
64607
  // packages/daemon/src/terminal/session-runtime/registry.ts
64191
- import { randomUUID as randomUUID27 } from "node:crypto";
64608
+ import { randomUUID as randomUUID29 } from "node:crypto";
64192
64609
  import { z as z109 } from "zod";
64193
64610
  async function abortable(promise, signal) {
64194
64611
  if (!signal) return promise;
@@ -64386,7 +64803,7 @@ var init_registry2 = __esm({
64386
64803
  observability: options.semanticMutations.observability ?? this.#observability
64387
64804
  }) : null;
64388
64805
  this.#resolveSession = options.semanticMutations?.resolveSession ?? null;
64389
- this.#createControllerToken = options.createControllerToken ?? randomUUID27;
64806
+ this.#createControllerToken = options.createControllerToken ?? randomUUID29;
64390
64807
  this.#nativeGeometryHysteresisMs = options.nativeGeometryHysteresisMs;
64391
64808
  this.#stopExitObserver = this.#mirror.onSessionExit((session) => {
64392
64809
  this.#sessions.get(session)?.noteControlExit();
@@ -66775,7 +67192,7 @@ var init_grouped_tmux = __esm({
66775
67192
  });
66776
67193
 
66777
67194
  // packages/daemon/src/terminal/attachments/lease-manager.ts
66778
- import { createHash as createHash21, randomBytes as randomBytes5, randomUUID as randomUUID28, timingSafeEqual as timingSafeEqual3 } from "node:crypto";
67195
+ import { createHash as createHash21, randomBytes as randomBytes5, randomUUID as randomUUID30, timingSafeEqual as timingSafeEqual3 } from "node:crypto";
66779
67196
  import { z as z113 } from "zod";
66780
67197
  function positiveDuration(value, fallback, label4) {
66781
67198
  const resolved2 = value ?? fallback;
@@ -66848,7 +67265,7 @@ var init_lease_manager = __esm({
66848
67265
  this.#viewExecutor = options.viewExecutor;
66849
67266
  this.#now = options.now ?? Date.now;
66850
67267
  this.#randomBytes = options.randomBytes ?? randomBytes5;
66851
- this.#createId = options.createId ?? randomUUID28;
67268
+ this.#createId = options.createId ?? randomUUID30;
66852
67269
  this.#ticketTtlMs = positiveDuration(options.ticketTtlMs, 15e3, "ticketTtlMs");
66853
67270
  this.#leaseTtlMs = positiveDuration(options.leaseTtlMs, 6e4, "leaseTtlMs");
66854
67271
  this.#maxLeaseTtlMs = positiveDuration(
@@ -69595,7 +70012,7 @@ var init_tmux_view_executor = __esm({
69595
70012
  // packages/daemon/src/terminal/attachments/pty-tmux-attachment-launcher.ts
69596
70013
  import { accessSync as accessSync8, constants as constants14, realpathSync as realpathSync16, statSync as statSync14 } from "node:fs";
69597
70014
  import { delimiter as delimiter3, isAbsolute as isAbsolute20, join as join35 } from "node:path";
69598
- import { randomUUID as randomUUID29 } from "node:crypto";
70015
+ import { randomUUID as randomUUID31 } from "node:crypto";
69599
70016
  import { execFileSync as execFileSync16 } from "node:child_process";
69600
70017
  function defaultSchedule2(callback, delayMs) {
69601
70018
  const timer = setTimeout(callback, delayMs);
@@ -69789,7 +70206,7 @@ var init_pty_tmux_attachment_launcher = __esm({
69789
70206
  if (existing) this.#dispose(existing);
69790
70207
  this.#reservedAttachments.add(request3.identity.attachmentId);
69791
70208
  const lifecycleEpoch = this.#lifecycleEpoch;
69792
- const attemptId = randomUUID29();
70209
+ const attemptId = randomUUID31();
69793
70210
  let resolveOutcome;
69794
70211
  const outcome = new Promise((resolve45) => {
69795
70212
  resolveOutcome = resolve45;
@@ -72129,7 +72546,7 @@ var init_agent_status_probe = __esm({
72129
72546
  });
72130
72547
 
72131
72548
  // packages/daemon/src/terminal/pane-stream/lease-manager.ts
72132
- import { createHash as createHash22, randomBytes as randomBytes6, randomUUID as randomUUID30, timingSafeEqual as timingSafeEqual4 } from "node:crypto";
72549
+ import { createHash as createHash22, randomBytes as randomBytes6, randomUUID as randomUUID32, timingSafeEqual as timingSafeEqual4 } from "node:crypto";
72133
72550
  import { z as z117 } from "zod";
72134
72551
  function positiveDuration2(value, fallback, label4) {
72135
72552
  const resolved2 = value ?? fallback;
@@ -72182,7 +72599,7 @@ var init_lease_manager2 = __esm({
72182
72599
  this.#instanceId = BindingIdSchemaZ3.parse(options.daemonInstanceId);
72183
72600
  this.#now = options.now ?? Date.now;
72184
72601
  this.#randomBytes = options.randomBytes ?? randomBytes6;
72185
- this.#createId = options.createId ?? randomUUID30;
72602
+ this.#createId = options.createId ?? randomUUID32;
72186
72603
  this.#ticketTtlMs = positiveDuration2(options.ticketTtlMs, 15e3, "ticketTtlMs");
72187
72604
  this.#redemptionProcessingTtlMs = positiveDuration2(
72188
72605
  options.redemptionProcessingTtlMs,
@@ -72350,7 +72767,7 @@ var init_lease_manager2 = __esm({
72350
72767
  });
72351
72768
 
72352
72769
  // packages/daemon/src/terminal/graphics/native-surface-viewer.ts
72353
- import { randomUUID as randomUUID31 } from "node:crypto";
72770
+ import { randomUUID as randomUUID33 } from "node:crypto";
72354
72771
  var MAX_RETAINED, NativeSurfaceViewer;
72355
72772
  var init_native_surface_viewer = __esm({
72356
72773
  "packages/daemon/src/terminal/graphics/native-surface-viewer.ts"() {
@@ -72383,7 +72800,7 @@ var init_native_surface_viewer = __esm({
72383
72800
  this.#active?.session.fallback("unsupported");
72384
72801
  this.#active = null;
72385
72802
  this.#prune();
72386
- this.#nonce = available ? randomUUID31() : null;
72803
+ this.#nonce = available ? randomUUID33() : null;
72387
72804
  this.#used = false;
72388
72805
  this.#send({
72389
72806
  type: "terminal-surface-available",
@@ -74255,9 +74672,9 @@ var init_pane_stream_websocket = __esm({
74255
74672
  if (!batch || this.#closed || channel.closed) return;
74256
74673
  let seed = batch.seed ?? new Uint8Array(0);
74257
74674
  if (seed.byteLength > PANE_STREAM_MAX_SEED_BYTES) {
74258
- let start2 = seed.byteLength - PANE_STREAM_MAX_SEED_BYTES;
74259
- while (start2 < seed.byteLength && seed[start2] !== 10) start2 += 1;
74260
- seed = seed.subarray(Math.min(start2 + 1, seed.byteLength));
74675
+ let start3 = seed.byteLength - PANE_STREAM_MAX_SEED_BYTES;
74676
+ while (start3 < seed.byteLength && seed[start3] !== 10) start3 += 1;
74677
+ seed = seed.subarray(Math.min(start3 + 1, seed.byteLength));
74261
74678
  }
74262
74679
  const held = chunkBytes(concatBytes(batch.held), PANE_STREAM_MAX_OUTPUT_BYTES).slice(
74263
74680
  0,
@@ -75558,7 +75975,7 @@ var init_interaction_observation_status = __esm({
75558
75975
  });
75559
75976
 
75560
75977
  // packages/daemon/src/lib/interaction-evidence-authority.ts
75561
- import { randomUUID as randomUUID32 } from "node:crypto";
75978
+ import { randomUUID as randomUUID34 } from "node:crypto";
75562
75979
  var HISTORY_CAPACITY, HISTORY_MS, runtimeKey, bindingKey, InteractionEvidenceAuthority;
75563
75980
  var init_interaction_evidence_authority = __esm({
75564
75981
  "packages/daemon/src/lib/interaction-evidence-authority.ts"() {
@@ -75621,7 +76038,7 @@ var init_interaction_evidence_authority = __esm({
75621
76038
  if (!/^\$(?:0|[1-9][0-9]*)$/u.test(row.sessionId) || !/^%(?:0|[1-9][0-9]*)$/u.test(row.runtimePaneId) || !row.semanticPaneId)
75622
76039
  continue;
75623
76040
  const lifetimeKey = `${row.runtimePaneId}\0${row.semanticPaneId}`;
75624
- const paneLifetimeId = lifetimes.get(lifetimeKey) ?? randomUUID32();
76041
+ const paneLifetimeId = lifetimes.get(lifetimeKey) ?? randomUUID34();
75625
76042
  const result2 = InteractionPaneEndpointSchemaZ.safeParse({
75626
76043
  kind: "pane",
75627
76044
  environmentId: this.#environmentId,
@@ -75665,7 +76082,7 @@ var init_interaction_evidence_authority = __esm({
75665
76082
  kind: "unresolved-pane",
75666
76083
  environmentId: this.#environmentId,
75667
76084
  serverScope: structuredClone(this.#serverScope),
75668
- observationRef: randomUUID32()
76085
+ observationRef: randomUUID34()
75669
76086
  };
75670
76087
  }
75671
76088
  /** Join a fresh fleet row only to the exact current native binding. */
@@ -75691,7 +76108,7 @@ var init_interaction_evidence_authority = __esm({
75691
76108
  kind: "unresolved-pane",
75692
76109
  environmentId: this.#environmentId,
75693
76110
  serverScope: structuredClone(this.#serverScope),
75694
- observationRef: randomUUID32()
76111
+ observationRef: randomUUID34()
75695
76112
  };
75696
76113
  }
75697
76114
  /** Grant must come directly from the current credential authority, never caller JSON. */
@@ -75720,10 +76137,10 @@ var init_interaction_evidence_authority = __esm({
75720
76137
  });
75721
76138
 
75722
76139
  // packages/daemon/src/lib/tmux-interaction-observation-handler.ts
75723
- import { randomUUID as randomUUID33 } from "node:crypto";
76140
+ import { randomUUID as randomUUID35 } from "node:crypto";
75724
76141
  function externalTmuxInteractionDraft(observation2, destination) {
75725
76142
  const { workspaceName, semanticPaneId: semanticPaneId3, operationKind } = observation2;
75726
- const operationId = randomUUID33();
76143
+ const operationId = randomUUID35();
75727
76144
  const at = (/* @__PURE__ */ new Date()).toISOString();
75728
76145
  return {
75729
76146
  evidence: InteractionEvidenceSchemaZ.parse({
@@ -75775,7 +76192,7 @@ var init_tmux_interaction_observation_handler = __esm({
75775
76192
 
75776
76193
  // packages/daemon/src/lib/tmux-server-owner.ts
75777
76194
  import { execFileSync as execFileSync17 } from "node:child_process";
75778
- import { createHash as createHash23, randomUUID as randomUUID34 } from "node:crypto";
76195
+ import { createHash as createHash23, randomUUID as randomUUID36 } from "node:crypto";
75779
76196
  import { mkdirSync as mkdirSync21 } from "node:fs";
75780
76197
  import { z as z119 } from "zod";
75781
76198
  function discoveredWorkspaceName(registry, sessionName) {
@@ -76031,6 +76448,7 @@ async function createNativeTmuxServerOwner(options) {
76031
76448
  observation: () => observationSelector ?? null,
76032
76449
  runPinnedTmux: generationRun
76033
76450
  }),
76451
+ splitLayoutStock: createStockSplitProbe({ runPinnedTmux: generationRun }),
76034
76452
  createOwnedViewerAdapter: createOwnedViewerAdapterFactory({
76035
76453
  environmentId: options.environmentId,
76036
76454
  serverScope: { serverId: options.serverId, generation },
@@ -76108,7 +76526,7 @@ async function createNativeTmuxServerOwner(options) {
76108
76526
  gap.reason === "overflow" ? "retention-overflow" : gap.reason === "hooks-replaced" ? "hooks-replaced" : "uncertain-consume"
76109
76527
  );
76110
76528
  },
76111
- internalReadOwnerToken: randomUUID34(),
76529
+ internalReadOwnerToken: randomUUID36(),
76112
76530
  registry: workspaceRegistry,
76113
76531
  tmuxAuthority: authority2,
76114
76532
  io: { runTmux: generationRunAsync },
@@ -76400,7 +76818,7 @@ var init_tmux_server_owner = __esm({
76400
76818
  });
76401
76819
 
76402
76820
  // packages/daemon/src/lib/tmux-server-owners.ts
76403
- import { randomUUID as randomUUID35 } from "node:crypto";
76821
+ import { randomUUID as randomUUID37 } from "node:crypto";
76404
76822
  var MAX_TMUX_SERVER_OWNERS, TmuxServerSelectorSchemaZ, TmuxServerRegistrationSchemaZ, TmuxServerScopeError, TmuxServerOwners;
76405
76823
  var init_tmux_server_owners = __esm({
76406
76824
  "packages/daemon/src/lib/tmux-server-owners.ts"() {
@@ -76428,6 +76846,8 @@ var init_tmux_server_owners = __esm({
76428
76846
  #tail = Promise.resolve();
76429
76847
  #disposed = false;
76430
76848
  #disposePromise = null;
76849
+ #queuedRefresh = null;
76850
+ #queuedRefreshTail = null;
76431
76851
  #serial(work) {
76432
76852
  const run = this.#tail.then(() => {
76433
76853
  if (this.#disposed) throw new TmuxServerScopeError("disposed");
@@ -76470,7 +76890,7 @@ var init_tmux_server_owners = __esm({
76470
76890
  (other) => other !== entry && other.observation?.fingerprint === next.fingerprint && other.observation.valid()
76471
76891
  );
76472
76892
  if (duplicate) return;
76473
- const scope2 = { serverId: entry.registration.serverId, generation: randomUUID35() };
76893
+ const scope2 = { serverId: entry.registration.serverId, generation: randomUUID37() };
76474
76894
  let owner;
76475
76895
  try {
76476
76896
  owner = await this.options.create(entry.registration, scope2, next);
@@ -76489,7 +76909,7 @@ var init_tmux_server_owners = __esm({
76489
76909
  return this.#serial(async () => {
76490
76910
  const registration = TmuxServerRegistrationSchemaZ.parse({
76491
76911
  ...input,
76492
- serverId: input.serverId ?? `tmux-server.${randomUUID35().replaceAll("-", "")}`
76912
+ serverId: input.serverId ?? `tmux-server.${randomUUID37().replaceAll("-", "")}`
76493
76913
  });
76494
76914
  const sameSelector = [...this.#entries.values()].find(
76495
76915
  (entry2) => JSON.stringify(entry2.registration.selector) === JSON.stringify(registration.selector)
@@ -76528,10 +76948,19 @@ var init_tmux_server_owners = __esm({
76528
76948
  this.#entries.set(scope2.serverId, { registration, scope: scope2, observation: observation2, owner });
76529
76949
  }
76530
76950
  refresh() {
76531
- return this.#serial(async () => {
76951
+ if (this.#queuedRefresh && this.#tail === this.#queuedRefreshTail) return this.#queuedRefresh;
76952
+ const queued = this.#serial(async () => {
76953
+ if (this.#queuedRefresh === queued) this.#queuedRefresh = null;
76532
76954
  for (const entry of this.#entries.values()) await this.#refresh(entry);
76533
76955
  return this.list();
76534
76956
  });
76957
+ this.#queuedRefresh = queued;
76958
+ this.#queuedRefreshTail = this.#tail;
76959
+ const settle = () => {
76960
+ if (this.#queuedRefresh === queued) this.#queuedRefresh = null;
76961
+ };
76962
+ queued.then(settle, settle);
76963
+ return queued;
76535
76964
  }
76536
76965
  current(scopeInput) {
76537
76966
  const scope2 = TmuxServerScopeSchemaZ.parse(scopeInput);
@@ -76581,7 +77010,7 @@ var init_tmux_server_owners = __esm({
76581
77010
  // packages/daemon/src/lib/tmux-server-registration.ts
76582
77011
  import { execFile as execFile11 } from "node:child_process";
76583
77012
  import { promisify as promisify2 } from "node:util";
76584
- import { createHash as createHash24, randomUUID as randomUUID36 } from "node:crypto";
77013
+ import { createHash as createHash24, randomUUID as randomUUID38 } from "node:crypto";
76585
77014
  import {
76586
77015
  mkdirSync as mkdirSync22,
76587
77016
  readFileSync as readFileSync24,
@@ -76603,7 +77032,7 @@ function readTmuxServerRegistrations(path2) {
76603
77032
  function writeTmuxServerRegistrations(path2, registrations) {
76604
77033
  const file = FileSchema2.parse({ version: 1, servers: registrations });
76605
77034
  mkdirSync22(dirname29(path2), { recursive: true, mode: 448 });
76606
- const temporary = `${path2}.${randomUUID36()}.tmp`;
77035
+ const temporary = `${path2}.${randomUUID38()}.tmp`;
76607
77036
  try {
76608
77037
  writeFileSync19(temporary, `${JSON.stringify(file, null, 2)}
76609
77038
  `, { mode: 384, flag: "wx" });
@@ -76800,7 +77229,7 @@ var init_pane_stream_upgrade = __esm({
76800
77229
  });
76801
77230
 
76802
77231
  // packages/daemon/src/lib/embedded-tmux-server-owners.ts
76803
- import { randomUUID as randomUUID37 } from "node:crypto";
77232
+ import { randomUUID as randomUUID39 } from "node:crypto";
76804
77233
  import { join as join36 } from "node:path";
76805
77234
  async function createEmbeddedTmuxServerOwners(options) {
76806
77235
  const path2 = join36(options.stateDirectory, "tmux-servers.json");
@@ -76820,7 +77249,7 @@ async function createEmbeddedTmuxServerOwners(options) {
76820
77249
  }
76821
77250
  }
76822
77251
  const defaultRegistration = established ?? {
76823
- serverId: `tmux-server.${randomUUID37().replaceAll("-", "")}`,
77252
+ serverId: `tmux-server.${randomUUID39().replaceAll("-", "")}`,
76824
77253
  label: "Default",
76825
77254
  selector: options.defaultAuthority.socketSelector
76826
77255
  };
@@ -77287,7 +77716,7 @@ var init_terminal_native_backing_route = __esm({
77287
77716
  });
77288
77717
 
77289
77718
  // packages/daemon/src/lib/embedded-daemon-lifecycle.ts
77290
- async function startOwnedEmbeddedDaemon(options, start2) {
77719
+ async function startOwnedEmbeddedDaemon(options, start3) {
77291
77720
  let closed = false;
77292
77721
  let available = false;
77293
77722
  let current;
@@ -77295,7 +77724,7 @@ async function startOwnedEmbeddedDaemon(options, start2) {
77295
77724
  let stopping = null;
77296
77725
  let pendingRequest = null;
77297
77726
  const launch2 = async (nextOptions) => {
77298
- const generation = await start2({
77727
+ const generation = await start3({
77299
77728
  ...nextOptions,
77300
77729
  requestRestart: (request3) => restart2(generation, request3)
77301
77730
  });
@@ -80687,6 +81116,22 @@ var init_daemon_shutdown = __esm({
80687
81116
  }
80688
81117
  });
80689
81118
 
81119
+ // packages/daemon/src/lib/catalog-fleet-read.ts
81120
+ async function readCatalogFleet(registry, runners, resolveInteractionEndpoint, nativeServerEpoch) {
81121
+ return runners.fence.active ? readAdoptedFleet(registry, runners.fencedSync, resolveInteractionEndpoint, nativeServerEpoch) : readAdoptedFleetAsync(
81122
+ registry,
81123
+ runners.generationFencedAsync,
81124
+ resolveInteractionEndpoint,
81125
+ nativeServerEpoch
81126
+ );
81127
+ }
81128
+ var init_catalog_fleet_read = __esm({
81129
+ "packages/daemon/src/lib/catalog-fleet-read.ts"() {
81130
+ "use strict";
81131
+ init_discovery();
81132
+ }
81133
+ });
81134
+
80690
81135
  // packages/daemon/src/lib/workspace-open.ts
80691
81136
  import { createHash as createHash25 } from "node:crypto";
80692
81137
  import { realpathSync as realpathSync19, statSync as statSync17 } from "node:fs";
@@ -81432,7 +81877,7 @@ var init_workspace_open2 = __esm({
81432
81877
  });
81433
81878
 
81434
81879
  // packages/daemon/src/lib/workspace-open-handoff.ts
81435
- import { randomUUID as randomUUID38 } from "node:crypto";
81880
+ import { randomUUID as randomUUID40 } from "node:crypto";
81436
81881
  var WorkspaceOpenHandoffError, WorkspaceOpenHandoffCoordinator;
81437
81882
  var init_workspace_open_handoff2 = __esm({
81438
81883
  "packages/daemon/src/lib/workspace-open-handoff.ts"() {
@@ -81496,7 +81941,7 @@ var init_workspace_open_handoff2 = __esm({
81496
81941
  const preferredPaneId = "initialPaneId" in opened.resource ? opened.resource.initialPaneId : void 0;
81497
81942
  const proof = await this.#deps.prepareRuntime(workspaceName, preferredPaneId);
81498
81943
  this.#assertCurrent(ownerClientId, revision, expectedDaemonInstanceId);
81499
- const token2 = randomUUID38();
81944
+ const token2 = randomUUID40();
81500
81945
  const result2 = {
81501
81946
  operationId,
81502
81947
  daemonInstanceId: this.#deps.daemonInstanceId,
@@ -82585,11 +83030,11 @@ function boundedCoordinate(value, path2) {
82585
83030
  }
82586
83031
  return Math.max(-APP_WINDOW_COORDINATE_LIMIT, Math.min(APP_WINDOW_COORDINATE_LIMIT, value));
82587
83032
  }
82588
- function boundedExtent(value, minimum, path2) {
83033
+ function boundedExtent(value, minimum2, path2) {
82589
83034
  if (!Number.isFinite(value)) {
82590
83035
  throw new AppWindowKernelError("INVALID_INPUT", path2, "extent must be finite");
82591
83036
  }
82592
- return Math.max(minimum, Math.min(APP_WINDOW_COORDINATE_LIMIT, value));
83037
+ return Math.max(minimum2, Math.min(APP_WINDOW_COORDINATE_LIMIT, value));
82593
83038
  }
82594
83039
  function requireTimestamp(previous, value) {
82595
83040
  let timestamp;
@@ -83371,7 +83816,7 @@ var init_terminal_attachment_upgrade = __esm({
83371
83816
  });
83372
83817
 
83373
83818
  // packages/daemon/src/terminal/graphics/native-surface-provider-channel.ts
83374
- import { randomUUID as randomUUID39 } from "node:crypto";
83819
+ import { randomUUID as randomUUID41 } from "node:crypto";
83375
83820
  import { z as z123 } from "zod";
83376
83821
  var Register, Offer, WatchDemand, NativeSurfaceProviderChannel;
83377
83822
  var init_native_surface_provider_channel = __esm({
@@ -83477,7 +83922,7 @@ var init_native_surface_provider_channel = __esm({
83477
83922
  #open(context) {
83478
83923
  if (this.#closed || this.#connections.size >= 32)
83479
83924
  throw new Error("Native provider unavailable");
83480
- const connection = randomUUID39();
83925
+ const connection = randomUUID41();
83481
83926
  this.#connections.set(connection, context);
83482
83927
  return {
83483
83928
  start: () => {
@@ -83625,7 +84070,7 @@ var init_active_projects = __esm({
83625
84070
  });
83626
84071
 
83627
84072
  // packages/daemon/src/lib/environment-identity.ts
83628
- import { randomUUID as randomUUID40 } from "node:crypto";
84073
+ import { randomUUID as randomUUID42 } from "node:crypto";
83629
84074
  import { linkSync as linkSync3, mkdirSync as mkdirSync24, readFileSync as readFileSync26, rmSync as rmSync4, writeFileSync as writeFileSync21 } from "node:fs";
83630
84075
  import { dirname as dirname32, join as join39 } from "node:path";
83631
84076
  function environmentIdentityPath() {
@@ -83642,7 +84087,7 @@ function readPersistedEnvironmentId(path2) {
83642
84087
  }
83643
84088
  }
83644
84089
  function persistEnvironmentId(path2, environmentId) {
83645
- const temporary = `${path2}.${process.pid}.${randomUUID40()}.tmp`;
84090
+ const temporary = `${path2}.${process.pid}.${randomUUID42()}.tmp`;
83646
84091
  try {
83647
84092
  mkdirSync24(dirname32(path2), { recursive: true });
83648
84093
  writeFileSync21(
@@ -83668,7 +84113,7 @@ function readOrMintEnvironmentId() {
83668
84113
  rmSync4(path2, { force: true });
83669
84114
  } catch {
83670
84115
  }
83671
- const minted = randomUUID40();
84116
+ const minted = randomUUID42();
83672
84117
  persistEnvironmentId(path2, minted);
83673
84118
  return readPersistedEnvironmentId(path2) ?? minted;
83674
84119
  }
@@ -84206,7 +84651,7 @@ var init_daemon_provenance = __esm({
84206
84651
  });
84207
84652
 
84208
84653
  // packages/daemon/src/lib/automation-operation-registry.ts
84209
- import { createHash as createHash26, randomUUID as randomUUID41 } from "node:crypto";
84654
+ import { createHash as createHash26, randomUUID as randomUUID43 } from "node:crypto";
84210
84655
  var AutomationOperationUnavailableError, AutomationOperationRegistry;
84211
84656
  var init_automation_operation_registry = __esm({
84212
84657
  "packages/daemon/src/lib/automation-operation-registry.ts"() {
@@ -84218,7 +84663,7 @@ var init_automation_operation_registry = __esm({
84218
84663
  }
84219
84664
  };
84220
84665
  AutomationOperationRegistry = class {
84221
- #generation = randomUUID41();
84666
+ #generation = randomUUID43();
84222
84667
  #entries = /* @__PURE__ */ new Map();
84223
84668
  #capacity;
84224
84669
  #retentionMs;
@@ -84238,7 +84683,7 @@ var init_automation_operation_registry = __esm({
84238
84683
  this.#prune();
84239
84684
  if (this.#entries.size >= this.#capacity)
84240
84685
  throw new Error("Automation operation capacity reached");
84241
- const operationId = randomUUID41();
84686
+ const operationId = randomUUID43();
84242
84687
  this.#entries.set(operationId, {
84243
84688
  fingerprint: this.#fingerprint(canonicalIntent),
84244
84689
  expiresAt: this.#now() + this.#retentionMs,
@@ -84873,7 +85318,7 @@ function createSessionFaviconResolver(options = {}) {
84873
85318
  const missTtlMs = options.missTtlMs ?? 3e4;
84874
85319
  const maxEntries = options.maxEntries ?? 256;
84875
85320
  const cache3 = /* @__PURE__ */ new Map();
84876
- const remember = (sessionPath, entry) => {
85321
+ const remember2 = (sessionPath, entry) => {
84877
85322
  cache3.delete(sessionPath);
84878
85323
  cache3.set(sessionPath, entry);
84879
85324
  while (cache3.size > maxEntries) cache3.delete(cache3.keys().next().value);
@@ -84918,18 +85363,18 @@ function createSessionFaviconResolver(options = {}) {
84918
85363
  if (!sessionPath || !isAbsolute24(sessionPath) || sessionPath.includes("\0")) return null;
84919
85364
  const cached2 = cache3.get(sessionPath);
84920
85365
  if (cached2?.kind === "miss" && now() - cached2.at < missTtlMs) {
84921
- remember(sessionPath, cached2);
85366
+ remember2(sessionPath, cached2);
84922
85367
  return null;
84923
85368
  }
84924
85369
  if (cached2?.kind === "hit") {
84925
85370
  const stats = await lstatOrNull(io, cached2.file);
84926
85371
  if (stats && stats.isFile() && stats.mtimeMs === cached2.mtimeMs && stats.size === cached2.size) {
84927
- remember(sessionPath, cached2);
85372
+ remember2(sessionPath, cached2);
84928
85373
  return cached2.favicon;
84929
85374
  }
84930
85375
  }
84931
85376
  const entry = await scan(sessionPath);
84932
- remember(sessionPath, entry);
85377
+ remember2(sessionPath, entry);
84933
85378
  return entry.kind === "hit" ? entry.favicon : null;
84934
85379
  };
84935
85380
  }
@@ -85925,7 +86370,7 @@ var init_workspace_admission_route = __esm({
85925
86370
  });
85926
86371
 
85927
86372
  // packages/daemon/src/lib/saved-machines.ts
85928
- import { randomUUID as randomUUID42 } from "node:crypto";
86373
+ import { randomUUID as randomUUID44 } from "node:crypto";
85929
86374
  import {
85930
86375
  closeSync as closeSync9,
85931
86376
  fstatSync as fstatSync7,
@@ -85995,7 +86440,7 @@ function persistSavedMachines(registry, path2) {
85995
86440
  if (Buffer.byteLength(contents) > MAX_REGISTRY_BYTES)
85996
86441
  throw new Error("Saved machine registry exceeds size limit");
85997
86442
  mkdirSync25(dirname33(path2), { recursive: true });
85998
- const temporary = `${path2}.${randomUUID42()}.tmp`;
86443
+ const temporary = `${path2}.${randomUUID44()}.tmp`;
85999
86444
  try {
86000
86445
  writeFileSync22(temporary, contents, { flag: "wx", mode: 384 });
86001
86446
  renameSync15(temporary, path2);
@@ -86257,7 +86702,7 @@ import {
86257
86702
  unlinkSync as unlinkSync8,
86258
86703
  writeFileSync as writeFileSync23
86259
86704
  } from "node:fs";
86260
- import { randomUUID as randomUUID43 } from "node:crypto";
86705
+ import { randomUUID as randomUUID45 } from "node:crypto";
86261
86706
  import { dirname as dirname34, join as join43 } from "node:path";
86262
86707
  function fleetClientStatePath() {
86263
86708
  return runtimeOwnedPath(join43(resolveRuntimeNamespace().registryDir, "fleet-view.json"));
@@ -86288,7 +86733,7 @@ function updateFleetClientState(change, path2 = fleetClientStatePath()) {
86288
86733
  if (Buffer.byteLength(contents) > MAX_BYTES3)
86289
86734
  throw new Error("Fleet view state exceeds its size limit");
86290
86735
  mkdirSync26(dirname34(path2), { recursive: true });
86291
- const temporary = `${path2}.${randomUUID43()}.tmp`;
86736
+ const temporary = `${path2}.${randomUUID45()}.tmp`;
86292
86737
  try {
86293
86738
  writeFileSync23(temporary, contents, { flag: "wx", mode: 384 });
86294
86739
  renameSync16(temporary, path2);
@@ -90684,14 +91129,14 @@ var init_workspace_files_authority = __esm({
90684
91129
  // packages/daemon/src/command-center/resources/workspace-changes-git.ts
90685
91130
  function splitNul(buffer) {
90686
91131
  const tokens = [];
90687
- let start2 = 0;
91132
+ let start3 = 0;
90688
91133
  for (let i = 0; i < buffer.length; i += 1) {
90689
91134
  if (buffer[i] === 0) {
90690
- tokens.push(buffer.toString("utf8", start2, i));
90691
- start2 = i + 1;
91135
+ tokens.push(buffer.toString("utf8", start3, i));
91136
+ start3 = i + 1;
90692
91137
  }
90693
91138
  }
90694
- if (start2 < buffer.length) tokens.push(buffer.toString("utf8", start2));
91139
+ if (start3 < buffer.length) tokens.push(buffer.toString("utf8", start3));
90695
91140
  return tokens;
90696
91141
  }
90697
91142
  function mapStatusLetter(letter) {
@@ -92663,7 +93108,7 @@ function projectApplicationShellAgentGraphOverlay(input) {
92663
93108
  }
92664
93109
  }
92665
93110
  const groundTruthPairs = /* @__PURE__ */ new Set();
92666
- for (const edge2 of edges) groundTruthPairs.add(pairKey(edge2.from, edge2.to));
93111
+ for (const edge of edges) groundTruthPairs.add(pairKey(edge.from, edge.to));
92667
93112
  const groundTruthGroupMembers = groups.map((group) => new Set(group.memberWindowIds));
92668
93113
  const emittedInferredPairs = /* @__PURE__ */ new Set();
92669
93114
  const emitInferred = (from, to, kind) => {
@@ -93138,7 +93583,7 @@ __export(widget_asset_store_exports, {
93138
93583
  publishWidgetAsset: () => publishWidgetAsset,
93139
93584
  readWidgetAsset: () => readWidgetAsset
93140
93585
  });
93141
- import { createHash as createHash33, randomUUID as randomUUID45 } from "node:crypto";
93586
+ import { createHash as createHash33, randomUUID as randomUUID47 } from "node:crypto";
93142
93587
  import {
93143
93588
  chmodSync as chmodSync7,
93144
93589
  existsSync as existsSync33,
@@ -93239,11 +93684,11 @@ function publishWidgetAsset(bytes, options) {
93239
93684
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
93240
93685
  };
93241
93686
  if (!existsSync33(paths.data)) {
93242
- const temporary = join47(root, `.${assetId}.${randomUUID45()}.bin`);
93687
+ const temporary = join47(root, `.${assetId}.${randomUUID47()}.bin`);
93243
93688
  writeFileSync25(temporary, bytes, { mode: 384, flag: "wx" });
93244
93689
  renameSync18(temporary, paths.data);
93245
93690
  }
93246
- const metadataTemporary = join47(root, `.${assetId}.${randomUUID45()}.json`);
93691
+ const metadataTemporary = join47(root, `.${assetId}.${randomUUID47()}.json`);
93247
93692
  writeFileSync25(metadataTemporary, `${JSON.stringify(metadata)}
93248
93693
  `, { mode: 384, flag: "wx" });
93249
93694
  renameSync18(metadataTemporary, paths.metadata);
@@ -93315,7 +93760,7 @@ import { z as z130 } from "zod";
93315
93760
  import { realpathSync as realpathSync25 } from "node:fs";
93316
93761
  import { homedir as homedir7 } from "node:os";
93317
93762
  import { isAbsolute as isAbsolute28, resolve as pathResolve } from "node:path";
93318
- import { randomUUID as randomUUID46 } from "node:crypto";
93763
+ import { randomUUID as randomUUID48 } from "node:crypto";
93319
93764
  import { WebSocketServer as WebSocketServer4 } from "ws";
93320
93765
  function bearerToken(authHeader) {
93321
93766
  if (!authHeader?.startsWith("Bearer ")) return null;
@@ -93453,7 +93898,7 @@ function createApp(options = {}) {
93453
93898
  const authService = options.authService ?? new AuthService();
93454
93899
  const daemonIdentity = options.daemonIdentity ?? {
93455
93900
  productVersion: "0.0.0",
93456
- instanceId: randomUUID46(),
93901
+ instanceId: randomUUID48(),
93457
93902
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
93458
93903
  };
93459
93904
  const daemonInstanceIdentity = DaemonInstanceIdentitySchemaZ.parse({
@@ -94027,7 +94472,7 @@ function createApp(options = {}) {
94027
94472
  });
94028
94473
  scripted = true;
94029
94474
  }
94030
- if (!id2) id2 = randomUUID46();
94475
+ if (!id2) id2 = randomUUID48();
94031
94476
  try {
94032
94477
  const upsertInput = {
94033
94478
  id: id2,
@@ -94452,7 +94897,7 @@ function createApp(options = {}) {
94452
94897
  if (!existsSync34(parsed.data.dir)) {
94453
94898
  return c.json({ error: `Directory "${parsed.data.dir}" does not exist` }, 400);
94454
94899
  }
94455
- const jobId = randomUUID46();
94900
+ const jobId = randomUUID48();
94456
94901
  const command3 = process.env.TMUX_IDE_INIT_COMMAND ?? "tmux-ide";
94457
94902
  void (async () => {
94458
94903
  try {
@@ -94756,7 +95201,7 @@ var init_types = __esm({
94756
95201
  // packages/daemon/src/lib/daemon-embed.ts
94757
95202
  import { dirname as dirname39, join as join49 } from "node:path";
94758
95203
  import { execFileSync as execFileSync21 } from "node:child_process";
94759
- import { randomBytes as randomBytes9, randomUUID as randomUUID47 } from "node:crypto";
95204
+ import { randomBytes as randomBytes9, randomUUID as randomUUID49 } from "node:crypto";
94760
95205
  import { createWriteStream } from "node:fs";
94761
95206
  import { createServer as createServer2 } from "node:http";
94762
95207
  import { createRequire as createRequire3 } from "node:module";
@@ -95455,7 +95900,7 @@ async function startEmbeddedDaemonGeneration(opts) {
95455
95900
  validatePort(port);
95456
95901
  const dir = process.cwd();
95457
95902
  const productVersion = resolveDaemonProductVersion(opts.productVersion);
95458
- const instanceId = randomUUID47();
95903
+ const instanceId = randomUUID49();
95459
95904
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
95460
95905
  const environmentId = readOrMintEnvironmentId();
95461
95906
  const workspaceRegistry = getDefaultWorkspaceRegistry();
@@ -95515,7 +95960,7 @@ async function startEmbeddedDaemonGeneration(opts) {
95515
95960
  for (const workspace of workspaceRegistry.list()) {
95516
95961
  await workspacePromotion.promote({
95517
95962
  expectedDaemonInstanceId: instanceId,
95518
- operationId: randomUUID47(),
95963
+ operationId: randomUUID49(),
95519
95964
  intent: { sessionId: fleetSessionIdForName(workspace.sessionName) }
95520
95965
  });
95521
95966
  }
@@ -95719,11 +96164,11 @@ async function startEmbeddedDaemonGeneration(opts) {
95719
96164
  // retain tens of thousands of frozen span objects or induce GC
95720
96165
  // pauses on the daemon's input/output event loop.
95721
96166
  capacity: 1024,
95722
- onSpan: (span) => {
96167
+ onSpan: (span2) => {
95723
96168
  runtimeTraceWriter?.append(() => ({
95724
96169
  version: 1,
95725
96170
  type: "performance.stage",
95726
- ...span
96171
+ ...span2
95727
96172
  }));
95728
96173
  }
95729
96174
  }) : void 0;
@@ -95738,7 +96183,7 @@ async function startEmbeddedDaemonGeneration(opts) {
95738
96183
  };
95739
96184
  const diagnostics = {
95740
96185
  nowMicros: () => Math.floor(performance3.now() * 1e3),
95741
- createTraceId: randomUUID47,
96186
+ createTraceId: randomUUID49,
95742
96187
  publish: publishObserverDiagnostic
95743
96188
  };
95744
96189
  externalInteractionObserver.setDiagnostics(diagnostics);
@@ -95784,6 +96229,9 @@ async function startEmbeddedDaemonGeneration(opts) {
95784
96229
  observation: () => observationSelector ?? null,
95785
96230
  runPinnedTmux: nativeGenerationTmuxRunner
95786
96231
  }),
96232
+ splitLayoutStock: createStockSplitProbe({
96233
+ runPinnedTmux: nativeGenerationTmuxRunner
96234
+ }),
95787
96235
  createOwnedViewerAdapter: () => ownedViewerFactory?.(),
95788
96236
  nativeServerIdentity: initialNativeServerIdentity,
95789
96237
  executable: tmuxAuthority.executablePath,
@@ -95811,7 +96259,7 @@ async function startEmbeddedDaemonGeneration(opts) {
95811
96259
  const consumer = sessionRuntimeRegistry.connect(
95812
96260
  record2.sessionName,
95813
96261
  "workspace-open-prepare",
95814
- `workspace-open-${randomUUID47()}`
96262
+ `workspace-open-${randomUUID49()}`
95815
96263
  );
95816
96264
  try {
95817
96265
  const layout = await consumer.describe();
@@ -96230,15 +96678,21 @@ async function startEmbeddedDaemonGeneration(opts) {
96230
96678
  paneStreamRuntime,
96231
96679
  catalogLiveSessions: () => discoverLiveSessionSummaries(catalogTmuxRunner),
96232
96680
  catalogFleet: async () => {
96233
- const fleet = readAdoptedFleet(
96681
+ const endpoint = (sessionName2, pane) => pane.semanticPaneId ? interactionEvidence?.captureInventoryEndpoint(
96682
+ sessionName2,
96683
+ pane.runtimePaneId,
96684
+ pane.semanticPaneId
96685
+ ) ?? null : null;
96686
+ const epoch = () => observationSelector?.nativeServerEpoch ?? null;
96687
+ const fleet = await readCatalogFleet(
96234
96688
  workspaceRegistry,
96235
- nativeGenerationTmuxRunner,
96236
- (sessionName2, pane) => pane.semanticPaneId ? interactionEvidence?.captureInventoryEndpoint(
96237
- sessionName2,
96238
- pane.runtimePaneId,
96239
- pane.semanticPaneId
96240
- ) ?? null : null,
96241
- () => observationSelector?.nativeServerEpoch ?? null
96689
+ {
96690
+ fence: sessionMutationFence,
96691
+ fencedSync: nativeGenerationTmuxRunner,
96692
+ generationFencedAsync: (args) => fleetFactsTmuxRunner(args)
96693
+ },
96694
+ endpoint,
96695
+ epoch
96242
96696
  );
96243
96697
  if (!fleet) return null;
96244
96698
  const names = await readTeamMemberships(
@@ -96690,6 +97144,7 @@ var init_daemon_embed = __esm({
96690
97144
  init_workspace_registry();
96691
97145
  init_workspace_pane_creation2();
96692
97146
  init_discovery();
97147
+ init_catalog_fleet_read();
96693
97148
  init_workspace_open2();
96694
97149
  init_workspace_promotion2();
96695
97150
  init_workspace_open_handoff2();
@@ -97931,7 +98386,7 @@ import {
97931
98386
  realpathSync as realpathSync28,
97932
98387
  linkSync as linkSync4
97933
98388
  } from "node:fs";
97934
- import { randomUUID as randomUUID48 } from "node:crypto";
98389
+ import { randomUUID as randomUUID50 } from "node:crypto";
97935
98390
  import { dirname as dirname41, join as join54 } from "node:path";
97936
98391
  import { homedir as homedir9 } from "node:os";
97937
98392
  import { z as z131 } from "zod";
@@ -98009,13 +98464,13 @@ async function manageDaemonService(action, executable, deps2 = defaults()) {
98009
98464
  refused("The service manager loaded a different definition; refusing to control it");
98010
98465
  return state;
98011
98466
  };
98012
- const ready = async (previousInstance) => {
98467
+ const ready = async (previousInstance, retiredPid) => {
98013
98468
  const deadline = Date.now() + deps2.waitMs;
98014
98469
  do {
98015
98470
  const state = deps2.inspect();
98016
98471
  if (!boundTo(state, plan.supervisionId))
98017
98472
  refused("Service reservation changed during startup");
98018
- if (state.status === "valid" && state.info.instanceId !== previousInstance) {
98473
+ if (state.status === "valid" && state.info.instanceId !== previousInstance && state.info.pid !== retiredPid) {
98019
98474
  const identity4 = await deps2.probe(state.info);
98020
98475
  const service2 = await inspectManager();
98021
98476
  if (identity4 && service2.active && service2.pid === state.info.pid && identity4.pid === state.info.pid && identity4.instanceId === state.info.instanceId && identity4.startedAt === state.info.startedAt && identity4.protocolVersion === state.info.protocolVersion)
@@ -98073,7 +98528,7 @@ async function manageDaemonService(action, executable, deps2 = defaults()) {
98073
98528
  );
98074
98529
  wroteRecord = true;
98075
98530
  mkdirSync30(dirname41(plan.unitPath), { recursive: true, mode: 448 });
98076
- const unitStage = `${plan.unitPath}.${randomUUID48()}.tmp`;
98531
+ const unitStage = `${plan.unitPath}.${randomUUID50()}.tmp`;
98077
98532
  writeFileSync28(unitStage, contents, { flag: "wx", mode: 384 });
98078
98533
  try {
98079
98534
  linkSync4(unitStage, plan.unitPath);
@@ -98097,7 +98552,7 @@ async function manageDaemonService(action, executable, deps2 = defaults()) {
98097
98552
  refused("Service manager has not confirmed the daemon stopped; reservation retained");
98098
98553
  assertFiles(allowMissingUnit);
98099
98554
  const removalRecord = JSON.stringify({ ...record2, removing: true }) + "\n";
98100
- const temporaryRecord = `${plan.recordPath}.${randomUUID48()}.tmp`;
98555
+ const temporaryRecord = `${plan.recordPath}.${randomUUID50()}.tmp`;
98101
98556
  writeFileSync28(temporaryRecord, removalRecord, { flag: "wx", mode: 384 });
98102
98557
  try {
98103
98558
  if (ownedFile(plan.recordPath) !== previousRecord)
@@ -98116,9 +98571,13 @@ async function manageDaemonService(action, executable, deps2 = defaults()) {
98116
98571
  }
98117
98572
  const before = deps2.inspect();
98118
98573
  if (action === "install" && service.active) return await ready();
98119
- if (service.loaded) await manager.restart(service.pid !== null);
98574
+ const current = service.loaded ? await inspectManager() : service;
98575
+ if (current.loaded) await manager.restart(current.pid !== null);
98120
98576
  else await manager.install();
98121
- return await ready(before.status === "valid" ? before.info.instanceId : void 0);
98577
+ return await ready(
98578
+ before.status === "valid" ? before.info.instanceId : void 0,
98579
+ current.loaded ? current.pid : null
98580
+ );
98122
98581
  } catch (error) {
98123
98582
  if (!activationAttempted && wroteRecord) {
98124
98583
  if (wroteUnit && ownedFile(plan.unitPath) === contents) unlinkSync9(plan.unitPath);
@@ -98750,11 +99209,13 @@ __export(doctor_exports, {
98750
99209
  hooksTargetRow: () => hooksTargetRow,
98751
99210
  nodeVersionRow: () => nodeVersionRow,
98752
99211
  notifierRow: () => notifierRow,
99212
+ tmuxFeaturesRow: () => tmuxFeaturesRow,
98753
99213
  workspaceConfigRow: () => workspaceConfigRow
98754
99214
  });
98755
99215
  import { execSync as execSync3, execFileSync as execFileSync22 } from "node:child_process";
98756
- import { accessSync as accessSync12, constants as constants19, existsSync as existsSync37 } from "node:fs";
98757
- import { resolve as resolve39, dirname as dirname43 } from "node:path";
99216
+ import { accessSync as accessSync12, constants as constants19, existsSync as existsSync37, mkdtempSync, rmSync as rmSync7 } from "node:fs";
99217
+ import { tmpdir } from "node:os";
99218
+ import { resolve as resolve39, dirname as dirname43, join as join56 } from "node:path";
98758
99219
  import { fileURLToPath as fileURLToPath13 } from "node:url";
98759
99220
  function agentIntegrationRows(agents) {
98760
99221
  return presentAgents(agents).map((agent) => {
@@ -98854,6 +99315,83 @@ function check(label4, fn, { optional = false } = {}) {
98854
99315
  return { label: label4, pass: false, detail: e.message, optional };
98855
99316
  }
98856
99317
  }
99318
+ function nativeCommands(probe) {
99319
+ const ask = (command3) => {
99320
+ try {
99321
+ return { output: probe([command3, "-V"]) };
99322
+ } catch (error) {
99323
+ const failure4 = error;
99324
+ return { failure: String(failure4.stderr ?? failure4.message ?? "") };
99325
+ }
99326
+ };
99327
+ const split = ask("tmux-ide-resize-split");
99328
+ const events = ask("tmux-ide-events");
99329
+ const failures = [split.failure, events.failure].filter((text2) => text2 !== void 0);
99330
+ if (failures.some((text2) => /no server running|error connecting/u.test(text2)))
99331
+ return "no-server";
99332
+ const refused3 = (answer, command3) => answer.failure !== void 0 && UNKNOWN(command3).test(answer.failure);
99333
+ if (refused3(split, "tmux-ide-resize-split") && refused3(events, "tmux-ide-events")) return "stock";
99334
+ if (split.output !== void 0 && events.output !== void 0) {
99335
+ try {
99336
+ return nativeSplitCapability(split.output) ? "full" : "partial";
99337
+ } catch {
99338
+ return "partial";
99339
+ }
99340
+ }
99341
+ return failures.length === 2 ? "unknown" : "partial";
99342
+ }
99343
+ function tmuxFeaturesRow(probeServer, probeBinary) {
99344
+ let answer = nativeCommands(probeServer);
99345
+ if (answer === "no-server") answer = nativeCommands(probeBinary);
99346
+ const details = {
99347
+ full: "bundled tmux: full features",
99348
+ stock: "stock tmux: reduced features",
99349
+ partial: "this tmux has only some tmux-ide commands: no pane dividers",
99350
+ "no-server": "could not read the tmux server's features",
99351
+ unknown: "could not read the tmux server's features"
99352
+ };
99353
+ return {
99354
+ label: "tmux features",
99355
+ pass: answer === "full" || answer === "stock",
99356
+ detail: details[answer],
99357
+ optional: true
99358
+ };
99359
+ }
99360
+ function runTmuxFeatureProbes(executable) {
99361
+ const run = (prefix) => (args) => execFileSync22(executable, [...prefix, ...args], {
99362
+ encoding: "utf8",
99363
+ stdio: ["ignore", "pipe", "pipe"],
99364
+ timeout: 3e3
99365
+ });
99366
+ const socketPath = process.env[TMUX_SOCKET_PATH_ENV];
99367
+ const socketName = process.env.TMUX_IDE_TMUX_SOCKET_NAME;
99368
+ const server = socketPath ? ["-S", socketPath] : socketName ? ["-L", socketName] : [];
99369
+ const cleanups = [];
99370
+ const probeBinary = /* @__PURE__ */ (() => {
99371
+ let scratch = null;
99372
+ return (args) => {
99373
+ scratch ??= (() => {
99374
+ const dir = mkdtempSync(join56(tmpdir(), "tmi-doctor-"));
99375
+ const prefix = ["-S", join56(dir, "s"), "-f", "/dev/null"];
99376
+ cleanups.push(() => {
99377
+ try {
99378
+ run(prefix)(["kill-server"]);
99379
+ } catch {
99380
+ }
99381
+ rmSync7(dir, { recursive: true, force: true });
99382
+ });
99383
+ run(prefix)(["new-session", "-d", "-s", "probe"]);
99384
+ return { dir, prefix };
99385
+ })();
99386
+ return run(scratch.prefix)(args);
99387
+ };
99388
+ })();
99389
+ try {
99390
+ return tmuxFeaturesRow(run(server), probeBinary);
99391
+ } finally {
99392
+ for (const cleanup of cleanups) cleanup();
99393
+ }
99394
+ }
98857
99395
  function nodeVersionRow(version) {
98858
99396
  const major = Number(version.split(".")[0]);
98859
99397
  const pass = Number.isInteger(major) && major >= 20;
@@ -98894,6 +99432,10 @@ async function doctor({
98894
99432
  return `${version} (${executable})`;
98895
99433
  })
98896
99434
  );
99435
+ try {
99436
+ checks.push(runTmuxFeatureProbes(resolveTmuxExecutable()));
99437
+ } catch {
99438
+ }
98897
99439
  checks.push(nodeVersionRow(process.versions.node));
98898
99440
  checks.push(
98899
99441
  check(
@@ -99036,11 +99578,14 @@ async function doctor({
99036
99578
  }
99037
99579
  if (!allPass) process.exitCode = 1;
99038
99580
  }
99581
+ var UNKNOWN;
99039
99582
  var init_doctor = __esm({
99040
99583
  "packages/daemon/src/doctor.ts"() {
99041
99584
  "use strict";
99042
99585
  init_tmux_version();
99043
99586
  init_tmux_client_execution();
99587
+ init_runtime_namespace();
99588
+ init_native_split_resize();
99044
99589
  init_update_check();
99045
99590
  init_skill_sync();
99046
99591
  init_agent_discovery();
@@ -99049,6 +99594,7 @@ var init_doctor = __esm({
99049
99594
  init_notify();
99050
99595
  init_resolved_config();
99051
99596
  init_daemon_provenance();
99597
+ UNKNOWN = (command3) => new RegExp(`^unknown command: ${command3}$`, "mu");
99052
99598
  }
99053
99599
  });
99054
99600
 
@@ -100194,7 +100740,7 @@ __export(tmux_servers_cli_exports, {
100194
100740
  parseTmuxServersOperation: () => parseTmuxServersOperation,
100195
100741
  runTmuxServersCli: () => runTmuxServersCli
100196
100742
  });
100197
- import { randomUUID as randomUUID49 } from "node:crypto";
100743
+ import { randomUUID as randomUUID51 } from "node:crypto";
100198
100744
  function parseTmuxServersOperation(options) {
100199
100745
  const command3 = options.command ?? "list";
100200
100746
  if (options.ssh !== void 0) SavedMachineSchema.shape.sshTarget.parse(options.ssh);
@@ -100235,7 +100781,7 @@ function parseTmuxServersOperation(options) {
100235
100781
  );
100236
100782
  }
100237
100783
  async function connectTmuxServersCli(options) {
100238
- const hostClientId = randomUUID49();
100784
+ const hostClientId = randomUUID51();
100239
100785
  if (options.ssh !== void 0) {
100240
100786
  const transport = await openSshDaemonTransport({ alias: options.ssh });
100241
100787
  try {
@@ -100304,7 +100850,7 @@ async function runTmuxServersCli(options, connect4) {
100304
100850
  generation: server.generation
100305
100851
  });
100306
100852
  try {
100307
- return operation.command === "create" ? await client.createSession(randomUUID49(), operation.input) : await client.sessions();
100853
+ return operation.command === "create" ? await client.createSession(randomUUID51(), operation.input) : await client.sessions();
100308
100854
  } finally {
100309
100855
  client.dispose();
100310
100856
  }
@@ -100449,7 +100995,7 @@ __export(machines_exports, {
100449
100995
  machines: () => machines
100450
100996
  });
100451
100997
  import { readFileSync as readFileSync38, statSync as statSync22 } from "node:fs";
100452
- import { randomUUID as randomUUID50 } from "node:crypto";
100998
+ import { randomUUID as randomUUID52 } from "node:crypto";
100453
100999
  async function machines(command3, argument, options) {
100454
101000
  const current = loadSavedMachines();
100455
101001
  if ((command3 === "enable" || command3 === "disable" || command3 === "remove" || command3 === "edit") && argument) {
@@ -100533,7 +101079,7 @@ async function machines(command3, argument, options) {
100533
101079
  version: 1,
100534
101080
  machines: [
100535
101081
  existing ?? SavedMachineSchema.parse({
100536
- id: randomUUID50(),
101082
+ id: randomUUID52(),
100537
101083
  label: options.label ?? argument,
100538
101084
  sshTarget: argument,
100539
101085
  enabled: true
@@ -101773,7 +102319,7 @@ import {
101773
102319
  accessSync as accessSync13,
101774
102320
  constants as constants20
101775
102321
  } from "node:fs";
101776
- import { basename as basename21, delimiter as delimiter5, dirname as dirname45, join as join56 } from "node:path";
102322
+ import { basename as basename21, delimiter as delimiter5, dirname as dirname45, join as join57 } from "node:path";
101777
102323
  function isOptOut(value) {
101778
102324
  if (value === false || value === 0) return true;
101779
102325
  return typeof value === "string" && /^\s*(0|false|off|no)\s*$/iu.test(value);
@@ -101821,8 +102367,8 @@ function agentTeamsPaths() {
101821
102367
  function claudeOnPath2(path2 = process.env.PATH ?? "") {
101822
102368
  return path2.split(delimiter5).filter(Boolean).some((dir) => {
101823
102369
  try {
101824
- accessSync13(join56(dir, "claude"), constants20.X_OK);
101825
- return statSync23(join56(dir, "claude")).isFile();
102370
+ accessSync13(join57(dir, "claude"), constants20.X_OK);
102371
+ return statSync23(join57(dir, "claude")).isFile();
101826
102372
  } catch {
101827
102373
  return false;
101828
102374
  }
@@ -101847,7 +102393,7 @@ function existingBackup(settingsPath) {
101847
102393
  const prefix = `${basename21(settingsPath)}${BACKUP_INFIX}`;
101848
102394
  try {
101849
102395
  const found = readdirSync11(dir).find((name) => name.startsWith(prefix));
101850
- return found ? join56(dir, found) : null;
102396
+ return found ? join57(dir, found) : null;
101851
102397
  } catch {
101852
102398
  return null;
101853
102399
  }
@@ -101863,7 +102409,7 @@ function writeSettings(path2, settings, exists) {
101863
102409
  copyFileSync3(path2, backup);
101864
102410
  }
101865
102411
  }
101866
- const temporary = join56(dirname45(path2), `.${basename21(path2)}.tmux-ide-${process.pid}.tmp`);
102412
+ const temporary = join57(dirname45(path2), `.${basename21(path2)}.tmux-ide-${process.pid}.tmp`);
101867
102413
  try {
101868
102414
  writeFileSync30(temporary, `${JSON.stringify(settings, null, 2)}
101869
102415
  `, { mode: 384 });
@@ -102004,7 +102550,7 @@ __export(worktree_exports, {
102004
102550
  worktreeSessionName: () => worktreeSessionName
102005
102551
  });
102006
102552
  import { execFileSync as execFileSync26 } from "node:child_process";
102007
- import { basename as basename22, dirname as dirname46, isAbsolute as isAbsolute32, join as join57, resolve as resolve43 } from "node:path";
102553
+ import { basename as basename22, dirname as dirname46, isAbsolute as isAbsolute32, join as join58, resolve as resolve43 } from "node:path";
102008
102554
  function sanitizeForTmux(part) {
102009
102555
  return part.replace(/[.:/\s]+/g, "-");
102010
102556
  }
@@ -102013,11 +102559,11 @@ function worktreeSessionName(project, branch) {
102013
102559
  }
102014
102560
  function defaultWorktreeBaseDir(repoDir) {
102015
102561
  const abs = resolve43(repoDir);
102016
- return join57(dirname46(abs), `${basename22(abs)}-worktrees`);
102562
+ return join58(dirname46(abs), `${basename22(abs)}-worktrees`);
102017
102563
  }
102018
102564
  function worktreePath(repoDir, branch, configuredDir) {
102019
102565
  const base2 = configuredDir && configuredDir.length > 0 ? isAbsolute32(configuredDir) ? configuredDir : resolve43(repoDir, configuredDir) : defaultWorktreeBaseDir(repoDir);
102020
- return join57(base2, branch);
102566
+ return join58(base2, branch);
102021
102567
  }
102022
102568
  function parseWorktreeList(porcelain) {
102023
102569
  const entries = [];
@@ -102151,9 +102697,9 @@ var init_worktree = __esm({
102151
102697
  });
102152
102698
 
102153
102699
  // packages/daemon/src/lib/managed-installer-update.ts
102154
- import { mkdtempSync, readFileSync as readFileSync40, realpathSync as realpathSync29, rmSync as rmSync7 } from "node:fs";
102155
- import { dirname as dirname47, join as join58 } from "node:path";
102156
- import { tmpdir } from "node:os";
102700
+ import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync40, realpathSync as realpathSync29, rmSync as rmSync8 } from "node:fs";
102701
+ import { dirname as dirname47, join as join59 } from "node:path";
102702
+ import { tmpdir as tmpdir2 } from "node:os";
102157
102703
  import { execFileSync as execFileSync27 } from "node:child_process";
102158
102704
  function managedInstallerPrefix(cliPath) {
102159
102705
  const match = /^(.*)\/share\/tmux-ide\/releases\/(install-[A-Za-z0-9]{6})\/npm\/lib\/node_modules\/tmux-ide\/bin$/.exec(
@@ -102161,16 +102707,16 @@ function managedInstallerPrefix(cliPath) {
102161
102707
  );
102162
102708
  if (!match) return null;
102163
102709
  const prefix = match[1] || "/";
102164
- const root = join58(prefix, "share/tmux-ide");
102165
- const release = join58(root, "releases", match[2]);
102710
+ const root = join59(prefix, "share/tmux-ide");
102711
+ const release = join59(root, "releases", match[2]);
102166
102712
  try {
102167
- if (realpathSync29(join58(root, "current")) !== release) return null;
102713
+ if (realpathSync29(join59(root, "current")) !== release) return null;
102168
102714
  if (realpathSync29(release) !== release) return null;
102169
- if (readFileSync40(join58(root, "installer-v1"), "utf8") !== "1\n") return null;
102170
- if (readFileSync40(join58(release, ".installer-release-v1"), "utf8") !== "1\n") return null;
102171
- if (!readFileSync40(join58(prefix, "bin/tmux-ide"), "utf8").split("\n").includes("# tmux-ide universal installer v1"))
102715
+ if (readFileSync40(join59(root, "installer-v1"), "utf8") !== "1\n") return null;
102716
+ if (readFileSync40(join59(release, ".installer-release-v1"), "utf8") !== "1\n") return null;
102717
+ if (!readFileSync40(join59(prefix, "bin/tmux-ide"), "utf8").split("\n").includes("# tmux-ide universal installer v1"))
102172
102718
  return null;
102173
- if (JSON.parse(readFileSync40(join58(dirname47(cliPath), "package.json"), "utf8")).name !== "tmux-ide")
102719
+ if (JSON.parse(readFileSync40(join59(dirname47(cliPath), "package.json"), "utf8")).name !== "tmux-ide")
102174
102720
  return null;
102175
102721
  return prefix;
102176
102722
  } catch {
@@ -102178,8 +102724,8 @@ function managedInstallerPrefix(cliPath) {
102178
102724
  }
102179
102725
  }
102180
102726
  function runManagedInstallerUpdate(prefix, channel, json3, execute2 = execFileSync27) {
102181
- const temporary = mkdtempSync(join58(tmpdir(), "tmux-ide-update-"));
102182
- const script = join58(temporary, "install.sh");
102727
+ const temporary = mkdtempSync2(join59(tmpdir2(), "tmux-ide-update-"));
102728
+ const script = join59(temporary, "install.sh");
102183
102729
  try {
102184
102730
  execute2(
102185
102731
  "curl",
@@ -102209,7 +102755,7 @@ function runManagedInstallerUpdate(prefix, channel, json3, execute2 = execFileSy
102209
102755
  stdio: json3 ? ["ignore", 2, 2] : "inherit"
102210
102756
  });
102211
102757
  } finally {
102212
- rmSync7(temporary, { recursive: true, force: true });
102758
+ rmSync8(temporary, { recursive: true, force: true });
102213
102759
  }
102214
102760
  }
102215
102761
  var MANAGED_INSTALLER_URL;
@@ -102222,7 +102768,7 @@ var init_managed_installer_update = __esm({
102222
102768
 
102223
102769
  // packages/daemon/src/lib/install-origin.ts
102224
102770
  import { existsSync as existsSync39, readFileSync as readFileSync41, realpathSync as realpathSync30 } from "node:fs";
102225
- import { dirname as dirname48, join as join59 } from "node:path";
102771
+ import { dirname as dirname48, join as join60 } from "node:path";
102226
102772
  import { fileURLToPath as fileURLToPath14 } from "node:url";
102227
102773
  function detectPackageManager(path2) {
102228
102774
  if (/\/share\/tmux-ide\/releases\/install-[^/]+\/npm\/lib\/node_modules\/tmux-ide\/bin$/.test(path2))
@@ -102239,9 +102785,9 @@ function findGitCheckoutRoot(startDir) {
102239
102785
  let dir = startDir;
102240
102786
  for (; ; ) {
102241
102787
  if (dir.endsWith("/node_modules")) return null;
102242
- if (existsSync39(join59(dir, ".git"))) {
102788
+ if (existsSync39(join60(dir, ".git"))) {
102243
102789
  try {
102244
- if (JSON.parse(readFileSync41(join59(dir, "package.json"), "utf8")).name === "tmux-ide")
102790
+ if (JSON.parse(readFileSync41(join60(dir, "package.json"), "utf8")).name === "tmux-ide")
102245
102791
  return dir;
102246
102792
  } catch {
102247
102793
  }
@@ -102262,7 +102808,7 @@ function installOrigin(cliDir = dirname48(fileURLToPath14(import.meta.url))) {
102262
102808
  let detected2 = detectPackageManager(path2);
102263
102809
  if (detected2 === "npm" || detected2 === "pnpm" || detected2 === "bun") {
102264
102810
  try {
102265
- if (JSON.parse(readFileSync41(join59(path2, "../package.json"), "utf8")).name !== "tmux-ide")
102811
+ if (JSON.parse(readFileSync41(join60(path2, "../package.json"), "utf8")).name !== "tmux-ide")
102266
102812
  detected2 = "unknown";
102267
102813
  } catch {
102268
102814
  detected2 = "unknown";
@@ -102288,7 +102834,7 @@ __export(update_exports, {
102288
102834
  runUpdate: () => runUpdate
102289
102835
  });
102290
102836
  import { realpathSync as realpathSync31 } from "node:fs";
102291
- import { dirname as dirname49, join as join60 } from "node:path";
102837
+ import { dirname as dirname49, join as join61 } from "node:path";
102292
102838
  import { execFileSync as execFileSync28 } from "node:child_process";
102293
102839
  function planUpdate(input) {
102294
102840
  const current = input.currentVersion ?? getCurrentVersion();
@@ -102378,7 +102924,7 @@ function runUpdate({ cliDir, dryRun, json: json3 = false }, dependencies = {}) {
102378
102924
  plan.executable === "bun" ? ["pm", "bin", "-g"] : ["root", "-g"]
102379
102925
  ).trim();
102380
102926
  if (!root.startsWith("/")) throw new Error("invalid manager path");
102381
- const target = plan.executable === "bun" ? dirname49(realpathSync31(join60(root, "tmux-ide"))) : realpathSync31(join60(root, "tmux-ide", "bin"));
102927
+ const target = plan.executable === "bun" ? dirname49(realpathSync31(join61(root, "tmux-ide"))) : realpathSync31(join61(root, "tmux-ide", "bin"));
102382
102928
  if (target !== source.path) throw new Error("different installation");
102383
102929
  } catch {
102384
102930
  plan = {
@@ -102583,7 +103129,7 @@ __export(server_exports3, {
102583
103129
  SERVER_BIND_HOST: () => SERVER_BIND_HOST,
102584
103130
  createApp: () => createApp2,
102585
103131
  resolvePort: () => resolvePort,
102586
- start: () => start
103132
+ start: () => start2
102587
103133
  });
102588
103134
  import { createServer as createServer6 } from "node:http";
102589
103135
  import { parse as parse2 } from "node:url";
@@ -102603,7 +103149,7 @@ function createApp2() {
102603
103149
  app.get("/health", (c) => c.json({ ok: true }));
102604
103150
  return app;
102605
103151
  }
102606
- async function start(port) {
103152
+ async function start2(port) {
102607
103153
  const resolvedPort = resolvePort(port);
102608
103154
  const app = createApp2();
102609
103155
  const server = createServer6(getRequestListener2(app.fetch));
@@ -102655,7 +103201,7 @@ var init_server3 = __esm({
102655
103201
  init_src();
102656
103202
  init_tmux_client_execution();
102657
103203
  import { parseArgs as parseArgs2 } from "node:util";
102658
- import { resolve as resolve44, dirname as dirname50, join as join61 } from "node:path";
103204
+ import { resolve as resolve44, dirname as dirname50, join as join62 } from "node:path";
102659
103205
  import { execFileSync as execFileSync29 } from "node:child_process";
102660
103206
  import { appendFileSync as appendFileSync2, existsSync as existsSync40, mkdirSync as mkdirSync33, writeFileSync as writeFileSync31 } from "node:fs";
102661
103207
  import { fileURLToPath as fileURLToPath15 } from "node:url";
@@ -102996,9 +103542,9 @@ Install bun (https://bun.sh) \u2014 the TUI surfaces run on it. Sources ship wit
102996
103542
  let automaticDiagnosticLog;
102997
103543
  if (surface === "app" && !process.env.TMUX_IDE_TUI_PERF_LOG && !process.env.TMUX_IDE_TUI_LOG) {
102998
103544
  try {
102999
- const logDirectory = join61(stateHome(), "logs");
103545
+ const logDirectory = join62(stateHome(), "logs");
103000
103546
  mkdirSync33(logDirectory, { recursive: true, mode: 448 });
103001
- automaticDiagnosticLog = join61(logDirectory, "tui-latest.jsonl");
103547
+ automaticDiagnosticLog = join62(logDirectory, "tui-latest.jsonl");
103002
103548
  writeFileSync31(
103003
103549
  automaticDiagnosticLog,
103004
103550
  `${JSON.stringify({
@@ -104690,8 +105236,8 @@ Known panels: ${POPUP_WIDGETS2.join(", ")}.`,
104690
105236
  if (values.port) serverArgs.push("--port", values.port);
104691
105237
  execFileSync29("node", serverArgs, { stdio: "inherit" });
104692
105238
  } else {
104693
- const { start: start2 } = await Promise.resolve().then(() => (init_server3(), server_exports3));
104694
- await start2(values.port ? parseInt(values.port, 10) : void 0);
105239
+ const { start: start3 } = await Promise.resolve().then(() => (init_server3(), server_exports3));
105240
+ await start3(values.port ? parseInt(values.port, 10) : void 0);
104695
105241
  }
104696
105242
  break;
104697
105243
  }