@i14ks/ccv 0.50.0 → 0.52.0

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 (84) hide show
  1. package/bundle/ccv.mjs +617 -264
  2. package/package.json +1 -1
  3. package/web/assets/{MarkdownTextEditor-DoP0b52_.js → MarkdownTextEditor-BIFEJNef.js} +1 -1
  4. package/web/assets/{abnfDiagram-S7VZAUFO-CApqnaGR.js → abnfDiagram-S7VZAUFO-PxAPu8yc.js} +1 -1
  5. package/web/assets/{architectureDiagram-YGSQEFNW-jwCcwggk.js → architectureDiagram-YGSQEFNW-DTbKZSgE.js} +1 -1
  6. package/web/assets/{blockDiagram-APKKGZFW-Bji4PkTF.js → blockDiagram-APKKGZFW-BLpAnO86.js} +1 -1
  7. package/web/assets/{c4Diagram-KJ2TOQU5-BFRf3dTO.js → c4Diagram-KJ2TOQU5-0c71mRhk.js} +1 -1
  8. package/web/assets/{chunk-2Q5K7J3B-DUFwqu3B.js → chunk-2Q5K7J3B-BjVCDOxa.js} +1 -1
  9. package/web/assets/{chunk-5VM5RSS4-BNCdpRtw.js → chunk-5VM5RSS4-DI_P3CD-.js} +1 -1
  10. package/web/assets/{chunk-HFQBQIA3-D8sImu8E.js → chunk-HFQBQIA3-D7JelBkC.js} +1 -1
  11. package/web/assets/{chunk-JWPE2WC7-BhL2yBgo.js → chunk-JWPE2WC7-DViBoUd7.js} +1 -1
  12. package/web/assets/{chunk-KQLB2F66-pFBglgtP.js → chunk-KQLB2F66-B5lYURho.js} +2 -2
  13. package/web/assets/{chunk-KS47KZWR-BrLOmWWS.js → chunk-KS47KZWR-6KKVV3bb.js} +1 -1
  14. package/web/assets/{chunk-OY52VR5R-Cgk3JXPf.js → chunk-OY52VR5R-DhJv-npE.js} +1 -1
  15. package/web/assets/{chunk-TU62E6Q5-e2yCDokg.js → chunk-TU62E6Q5-C2EMV_EL.js} +1 -1
  16. package/web/assets/{chunk-XXDRQBXY-DU6jFvHG.js → chunk-XXDRQBXY-W6EPffTM.js} +1 -1
  17. package/web/assets/{classDiagram-v2-L25IHNXF-Bt1zi6CS.js → classDiagram-v2-L25IHNXF-BLw99iUE.js} +1 -1
  18. package/web/assets/{codemirror-CNxAt-Eg.js → codemirror-BZIHS6Y4.js} +1 -1
  19. package/web/assets/{codemirrorImages-C30a2wIG.js → codemirrorImages-BLPDadol.js} +1 -1
  20. package/web/assets/{cose-bilkent-JH36ORCC-CYITjt4m.js → cose-bilkent-JH36ORCC-D7OUJYUx.js} +1 -1
  21. package/web/assets/{cynefin-EF2NZ3EQ-BiYmPyip.js → cynefin-EF2NZ3EQ-BkJ9Ys0f.js} +1 -1
  22. package/web/assets/{cynefinDiagram-L36ESFBY-DiITK0W-.js → cynefinDiagram-L36ESFBY-a9Mz3IWv.js} +1 -1
  23. package/web/assets/{dagre-SPEB5RXH-BnOvnJrY.js → dagre-SPEB5RXH-BGvBQ1JJ.js} +1 -1
  24. package/web/assets/{diagram-3B7GL73J-DnFw5yRA.js → diagram-3B7GL73J-BB-OGRG4.js} +1 -1
  25. package/web/assets/{diagram-DNEMPZML-CLe-W-8E.js → diagram-DNEMPZML-pVP1U_3t.js} +1 -1
  26. package/web/assets/{diagram-L3MUGCDN-xhFV1YT8.js → diagram-L3MUGCDN-RJis0nI0.js} +1 -1
  27. package/web/assets/{diagram-LA4NIPWU-S58Cgi0K.js → diagram-LA4NIPWU-abNtUOgC.js} +1 -1
  28. package/web/assets/{diagram-MHCOC4E2-fbSbD-Tu.js → diagram-MHCOC4E2-BluxAEc9.js} +1 -1
  29. package/web/assets/{diagram-XPFHEONP-C3K_xR1q.js → diagram-XPFHEONP-B-iDKzmS.js} +1 -1
  30. package/web/assets/{ebnfDiagram-UZSYDL2S-BG_udZa4.js → ebnfDiagram-UZSYDL2S-DvrL6XM7.js} +1 -1
  31. package/web/assets/{elk-XV6XMXQE-DE6K1qve.js → elk-XV6XMXQE-rBP63iHG.js} +1 -1
  32. package/web/assets/{erDiagram-EYBAPDEH-xkeusKpC.js → erDiagram-EYBAPDEH-Bz-CI5Ad.js} +1 -1
  33. package/web/assets/{flowDiagram-MALGAFMO-OisK-T0f.js → flowDiagram-MALGAFMO-CuZ-qxXu.js} +1 -1
  34. package/web/assets/{ganttDiagram-23REXITY-DmQVS3ZV.js → ganttDiagram-23REXITY-D0NL8MsN.js} +1 -1
  35. package/web/assets/{gitGraphDiagram-STJD7YCW-Cll-SkVb.js → gitGraphDiagram-STJD7YCW-DVK15w1H.js} +1 -1
  36. package/web/assets/{index-fF3dLvWP.js → index-8thykVyW.js} +1 -1
  37. package/web/assets/{index-DM3T56Jf.js → index-Bx5KoulY.js} +1 -1
  38. package/web/assets/{index-CkpIGiUh.js → index-C-y2hGlr.js} +1 -1
  39. package/web/assets/{index-D5xJiVmD.js → index-C3sgKrKm.js} +1 -1
  40. package/web/assets/{index-CcKihMD9.js → index-CBL6a7v6.js} +1 -1
  41. package/web/assets/index-CE6j3gk_.css +1 -0
  42. package/web/assets/{index-BzBiXh1K.js → index-CQ616cZ-.js} +1 -1
  43. package/web/assets/{index-CUm9rUfI.js → index-CZImp-mV.js} +1 -1
  44. package/web/assets/{index-B_jwjnO_.js → index-CiCsKZJJ.js} +1 -1
  45. package/web/assets/{index-B2l2owfY.js → index-CpdrbcyL.js} +1 -1
  46. package/web/assets/{index-CYTyvY7n.js → index-D4XCa8rw.js} +1 -1
  47. package/web/assets/{index-CkV2xkfY.js → index-D6PgK7Rj.js} +1 -1
  48. package/web/assets/{index-Zq9V5ZB9.js → index-D6RqSPP1.js} +1 -1
  49. package/web/assets/{index-qOoKNKZw.js → index-DPIf-x-z.js} +1 -1
  50. package/web/assets/{index-cu8Fcww3.js → index-EkowKQcB.js} +1 -1
  51. package/web/assets/{index-CJzQgsOc.js → index-N3HP-ren.js} +1 -1
  52. package/web/assets/{index-Bta4Smbo.js → index-NdAR8ey0.js} +1 -1
  53. package/web/assets/{index-CXbAKkq5.js → index-Sbwl34DE.js} +1 -1
  54. package/web/assets/{index-DXCiYt0O.js → index-g5NZFHh-.js} +1 -1
  55. package/web/assets/index-nHoWKKiY.js +172 -0
  56. package/web/assets/{index-BTQSusTZ.js → index-wmfsTRb2.js} +1 -1
  57. package/web/assets/{infoDiagram-KBXO4MBG-CFnvxUDW.js → infoDiagram-KBXO4MBG-DyqlFY5x.js} +1 -1
  58. package/web/assets/{ishikawaDiagram-M35NCXHK-CjJXkiZb.js → ishikawaDiagram-M35NCXHK-_Vm9QN3f.js} +1 -1
  59. package/web/assets/{journeyDiagram-OPLOXDXO-CYBHLPC5.js → journeyDiagram-OPLOXDXO-Bd7hG7eI.js} +1 -1
  60. package/web/assets/{kanban-definition-BZKZHSQY-BzNwzCFX.js → kanban-definition-BZKZHSQY-D1c3SCqg.js} +1 -1
  61. package/web/assets/{mermaid.core-CFBl9TP8.js → mermaid.core-DjyhFRJs.js} +4 -4
  62. package/web/assets/{mindmap-definition-I2QAS2VK-X8WzviFV.js → mindmap-definition-I2QAS2VK--m4_NDPW.js} +1 -1
  63. package/web/assets/{pegDiagram-FD4XPPHP-kvO-a_98.js → pegDiagram-FD4XPPHP-D5d8ScZG.js} +1 -1
  64. package/web/assets/{pieDiagram-J4AKIIQI-BEiN8l-e.js → pieDiagram-J4AKIIQI-BOwYtqfK.js} +1 -1
  65. package/web/assets/{quadrantDiagram-XTYBLID2-Cf-t2xpS.js → quadrantDiagram-XTYBLID2-u5znlo3M.js} +1 -1
  66. package/web/assets/{railroadDiagram-MRQ6NCDL-Bou3xfYm.js → railroadDiagram-MRQ6NCDL-D7jiW3__.js} +1 -1
  67. package/web/assets/{requirementDiagram-Y7LWUY3S-Ch1ghejU.js → requirementDiagram-Y7LWUY3S-Cpt1GlyO.js} +1 -1
  68. package/web/assets/{sankeyDiagram-WGJFYUXA-DCjH5hxL.js → sankeyDiagram-WGJFYUXA-_JyZCeTQ.js} +1 -1
  69. package/web/assets/{sequenceDiagram-5NDRBG5M-DrspJAAy.js → sequenceDiagram-5NDRBG5M-CbYA777-.js} +1 -1
  70. package/web/assets/{sizeCapture-INFHLROL-BpOJNwe1.js → sizeCapture-INFHLROL-DmnizpVE.js} +1 -1
  71. package/web/assets/{stateDiagram-v2-FJ4FJNEA-RkYUtnsy.js → stateDiagram-v2-FJ4FJNEA-FvAiEdvY.js} +1 -1
  72. package/web/assets/{swimlanes-UMQ2AFYF-BR4cicEg.js → swimlanes-UMQ2AFYF-BfeMkSWP.js} +1 -1
  73. package/web/assets/swimlanesDiagram-OMPLPG4O-Dixvh2s6.js +8 -0
  74. package/web/assets/{timeline-definition-SEUHKTQE-Bq2VoDLH.js → timeline-definition-SEUHKTQE-ryDw6wbV.js} +1 -1
  75. package/web/assets/{usecaseDiagram-AFA6YXN4-BsB6aBKf.js → usecaseDiagram-AFA6YXN4-DiwJEYD6.js} +1 -1
  76. package/web/assets/{vennDiagram-NNMJR3RB-8pOZirDr.js → vennDiagram-NNMJR3RB-BW4IZXpZ.js} +1 -1
  77. package/web/assets/{wardleyDiagram-S7YFUSEH-Dx-je9ls.js → wardleyDiagram-S7YFUSEH-B1ngysj0.js} +1 -1
  78. package/web/assets/{xychartDiagram-GGNKY7IX-mpETY7ui.js → xychartDiagram-GGNKY7IX-BhBXCKWG.js} +1 -1
  79. package/web/index.html +10 -2
  80. package/web/manifest.webmanifest +13 -0
  81. package/web/notify-sw.js +33 -0
  82. package/web/assets/index-C0GRVSmD.css +0 -1
  83. package/web/assets/index-CM1F7OtV.js +0 -172
  84. package/web/assets/swimlanesDiagram-OMPLPG4O-DGwvhioW.js +0 -8
package/bundle/ccv.mjs CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  // dist/ccv.js
4
4
  import { spawn as spawn5 } from "node:child_process";
5
- import { readFile as readFile22 } from "node:fs/promises";
6
- import path34 from "node:path";
5
+ import { readFile as readFile23 } from "node:fs/promises";
6
+ import path35 from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { parseArgs } from "node:util";
9
9
 
@@ -147,7 +147,7 @@ function envDefaults() {
147
147
  // ../host/dist/server.js
148
148
  import { createServer as createServer3 } from "node:http";
149
149
  import { createReadStream as createReadStream2, existsSync as existsSync5, statSync as statSync3 } from "node:fs";
150
- import path33 from "node:path";
150
+ import path34 from "node:path";
151
151
  import { homedir as homedir8 } from "node:os";
152
152
  import { randomUUID as randomUUID10 } from "node:crypto";
153
153
  import { WebSocketServer } from "ws";
@@ -461,7 +461,7 @@ async function exists(file) {
461
461
  return lstat(file).then(() => true, () => false);
462
462
  }
463
463
  async function isRealEntry(file) {
464
- return lstat(file).then((stat6) => !stat6.isSymbolicLink(), () => false);
464
+ return lstat(file).then((stat7) => !stat7.isSymbolicLink(), () => false);
465
465
  }
466
466
  async function candidateConfigDirs() {
467
467
  const home = homedir2();
@@ -786,12 +786,12 @@ function snippet(text, at, length) {
786
786
  // ../host/dist/workspace-ids.js
787
787
  function workspaceIdRemap(paths, sessionsOf) {
788
788
  const byLegacy = /* @__PURE__ */ new Map();
789
- for (const path35 of paths) {
790
- const id = workspaceIdFromPath(path35);
791
- for (const legacy of formerWorkspaceIdsFromPath(path35)) {
789
+ for (const path36 of paths) {
790
+ const id = workspaceIdFromPath(path36);
791
+ for (const legacy of formerWorkspaceIdsFromPath(path36)) {
792
792
  const group = byLegacy.get(legacy) ?? [];
793
793
  if (!group.some((target) => target.id === id))
794
- group.push({ id, path: path35 });
794
+ group.push({ id, path: path36 });
795
795
  byLegacy.set(legacy, group);
796
796
  }
797
797
  }
@@ -824,7 +824,7 @@ function workspaceIdRemap(paths, sessionsOf) {
824
824
  // ../host/dist/session.js
825
825
  import { EventEmitter as EventEmitter2 } from "node:events";
826
826
  import { randomUUID as randomUUID3 } from "node:crypto";
827
- import path9 from "node:path";
827
+ import path10 from "node:path";
828
828
  import { query as query2, renameSession } from "@anthropic-ai/claude-agent-sdk";
829
829
 
830
830
  // ../host/dist/files.js
@@ -1692,7 +1692,7 @@ function managedSettingsPath() {
1692
1692
  }
1693
1693
  var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
1694
1694
  async function readConfiguredDefaults(cwd) {
1695
- const files = [
1695
+ const files2 = [
1696
1696
  USER_SETTINGS,
1697
1697
  path8.join(cwd, PROJECT_SETTINGS),
1698
1698
  path8.join(cwd, LOCAL_SETTINGS),
@@ -1705,7 +1705,7 @@ async function readConfiguredDefaults(cwd) {
1705
1705
  thinking: true,
1706
1706
  switchModelsOnFlag: true
1707
1707
  };
1708
- for (const file of files) {
1708
+ for (const file of files2) {
1709
1709
  const settings = await readSettings(file);
1710
1710
  if (!settings)
1711
1711
  continue;
@@ -1750,16 +1750,164 @@ async function readSettings(file) {
1750
1750
 
1751
1751
  // ../host/dist/transcript.js
1752
1752
  import { getSessionMessages } from "@anthropic-ai/claude-agent-sdk";
1753
+
1754
+ // ../host/dist/branches.js
1755
+ import { readFile as readFile5, readdir as readdir4, stat as stat4 } from "node:fs/promises";
1756
+ import path9 from "node:path";
1757
+ var ROOT = "";
1758
+ var files = /* @__PURE__ */ new Map();
1759
+ async function findTranscriptFile(sessionId, configDir) {
1760
+ const name = `${sessionId}.jsonl`;
1761
+ const cached = files.get(sessionId);
1762
+ if (cached && await exists3(cached))
1763
+ return cached;
1764
+ const root = path9.join(configDir ?? inheritedDir(), "projects");
1765
+ let dirs;
1766
+ try {
1767
+ dirs = await readdir4(root);
1768
+ } catch {
1769
+ return null;
1770
+ }
1771
+ for (const dir of dirs) {
1772
+ const file = path9.join(root, dir, name);
1773
+ if (await exists3(file)) {
1774
+ files.set(sessionId, file);
1775
+ return file;
1776
+ }
1777
+ }
1778
+ return null;
1779
+ }
1780
+ async function exists3(file) {
1781
+ try {
1782
+ return (await stat4(file)).isFile();
1783
+ } catch {
1784
+ return false;
1785
+ }
1786
+ }
1787
+ async function readEntries(file) {
1788
+ const text = await readFile5(file, "utf8");
1789
+ const entries = [];
1790
+ for (const line of text.split("\n")) {
1791
+ if (!line.trim())
1792
+ continue;
1793
+ try {
1794
+ const value = JSON.parse(line);
1795
+ if (value && typeof value === "object" && typeof value.type === "string") {
1796
+ entries.push(value);
1797
+ }
1798
+ } catch {
1799
+ }
1800
+ }
1801
+ return entries;
1802
+ }
1803
+ function branchTree(entries, isHuman) {
1804
+ const byUuid = /* @__PURE__ */ new Map();
1805
+ for (const entry of entries)
1806
+ if (entry.uuid)
1807
+ byUuid.set(entry.uuid, entry);
1808
+ const groups = /* @__PURE__ */ new Map();
1809
+ const forkOf = /* @__PURE__ */ new Map();
1810
+ for (const entry of entries) {
1811
+ if (!entry.uuid || entry.type !== "user" || entry.isSidechain || !isHuman(entry))
1812
+ continue;
1813
+ const key = messageAncestor(entry, byUuid);
1814
+ forkOf.set(entry.uuid, key);
1815
+ const group = groups.get(key);
1816
+ if (group)
1817
+ group.push(entry.uuid);
1818
+ else
1819
+ groups.set(key, [entry.uuid]);
1820
+ }
1821
+ return { groups, forkOf, entries };
1822
+ }
1823
+ function messageAncestor(entry, byUuid) {
1824
+ const seen = /* @__PURE__ */ new Set();
1825
+ let parent = entry.parentUuid ? byUuid.get(entry.parentUuid) : void 0;
1826
+ while (parent && parent.uuid && !seen.has(parent.uuid)) {
1827
+ if (parent.type === "user" || parent.type === "assistant")
1828
+ return parent.uuid;
1829
+ seen.add(parent.uuid);
1830
+ parent = parent.parentUuid ? byUuid.get(parent.parentUuid) : void 0;
1831
+ }
1832
+ return ROOT;
1833
+ }
1834
+ function droppedBy(tree, choices) {
1835
+ const dropped = /* @__PURE__ */ new Set();
1836
+ for (const [key, chosen] of choices) {
1837
+ const group = tree.groups.get(key);
1838
+ if (!group || !group.includes(chosen))
1839
+ continue;
1840
+ for (const uuid of group)
1841
+ if (uuid !== chosen)
1842
+ dropped.add(uuid);
1843
+ }
1844
+ if (dropped.size === 0)
1845
+ return dropped;
1846
+ const children = /* @__PURE__ */ new Map();
1847
+ for (const entry of tree.entries) {
1848
+ if (!entry.uuid || !entry.parentUuid)
1849
+ continue;
1850
+ const list = children.get(entry.parentUuid);
1851
+ if (list)
1852
+ list.push(entry.uuid);
1853
+ else
1854
+ children.set(entry.parentUuid, [entry.uuid]);
1855
+ }
1856
+ const queue = [...dropped];
1857
+ while (queue.length > 0) {
1858
+ const uuid = queue.pop();
1859
+ for (const child of children.get(uuid) ?? []) {
1860
+ if (dropped.has(child))
1861
+ continue;
1862
+ dropped.add(child);
1863
+ queue.push(child);
1864
+ }
1865
+ }
1866
+ return dropped;
1867
+ }
1868
+ function branchStore(tree, dropped) {
1869
+ const entries = dropped.size === 0 ? tree.entries : tree.entries.filter((e) => !e.uuid || !dropped.has(e.uuid));
1870
+ return {
1871
+ append: async () => void 0,
1872
+ load: async () => entries
1873
+ };
1874
+ }
1875
+
1876
+ // ../host/dist/transcript.js
1753
1877
  var RESULT_LIMIT = 4e3;
1754
1878
  var INPUT_LIMIT = 2e4;
1755
1879
  var CUT = "\n\u2026 (\u043E\u0431\u0440\u0435\u0437\u0430\u043D\u043E)";
1880
+ async function loadBranch(sessionId, dir, configDir, choices = /* @__PURE__ */ new Map()) {
1881
+ const file = await findTranscriptFile(sessionId, configDir);
1882
+ let tree = null;
1883
+ if (file) {
1884
+ try {
1885
+ tree = branchTree(await readEntries(file), (entry) => isHumanTurn(entry));
1886
+ } catch {
1887
+ tree = null;
1888
+ }
1889
+ }
1890
+ const sessionStore = tree ? branchStore(tree, droppedBy(tree, choices)) : void 0;
1891
+ const messages = await withConfigDir(configDir, () => getSessionMessages(sessionId, {
1892
+ dir,
1893
+ includeSystemMessages: true,
1894
+ ...sessionStore ? { sessionStore } : {}
1895
+ }));
1896
+ const versions = /* @__PURE__ */ new Map();
1897
+ if (tree) {
1898
+ for (const group of tree.groups.values()) {
1899
+ if (group.length < 2)
1900
+ continue;
1901
+ group.forEach((uuid, i) => versions.set(uuid, { index: i + 1, count: group.length }));
1902
+ }
1903
+ }
1904
+ return { messages, versions, tree };
1905
+ }
1756
1906
  async function readTranscript(sessionId, options2) {
1757
1907
  let messages;
1908
+ let versions;
1758
1909
  try {
1759
- messages = await withConfigDir(options2.configDir ?? null, () => getSessionMessages(sessionId, {
1760
- dir: options2.dir,
1761
- includeSystemMessages: true
1762
- }));
1910
+ ({ messages, versions } = await loadBranch(sessionId, options2.dir, options2.configDir ?? null, options2.choices));
1763
1911
  } catch {
1764
1912
  return [];
1765
1913
  }
@@ -1783,19 +1931,21 @@ async function readTranscript(sessionId, options2) {
1783
1931
  }
1784
1932
  const content = contentOf(message);
1785
1933
  if (message.type === "user") {
1934
+ const version2 = versions.get(message.uuid);
1935
+ const versioned = version2 ? { version: version2 } : {};
1786
1936
  if (typeof content === "string") {
1787
1937
  const text = humanText(content);
1788
1938
  if (text)
1789
- record({ kind: "user.message", text }, ts);
1939
+ record({ kind: "user.message", text, ...versioned }, ts);
1790
1940
  continue;
1791
1941
  }
1792
- const files = [];
1942
+ const files2 = [];
1793
1943
  for (const block of content) {
1794
1944
  if (block.type !== "document")
1795
1945
  continue;
1796
1946
  const source = block.source;
1797
1947
  const isText = source?.type === "text";
1798
- files.push({
1948
+ files2.push({
1799
1949
  kind: isText ? "text" : "pdf",
1800
1950
  name: typeof block.title === "string" && block.title ? block.title : "\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",
1801
1951
  mediaType: isText ? "text/plain" : "application/pdf",
@@ -1807,10 +1957,15 @@ async function readTranscript(sessionId, options2) {
1807
1957
  const stripped = stripAttachmentNote(block.text);
1808
1958
  const text = humanText(stripped.text);
1809
1959
  for (const name of stripped.names) {
1810
- files.push({ kind: "file", name, mediaType: "application/octet-stream", size: 0 });
1960
+ files2.push({ kind: "file", name, mediaType: "application/octet-stream", size: 0 });
1811
1961
  }
1812
- if (text || files.length > 0) {
1813
- record({ kind: "user.message", text, ...files.length > 0 ? { files: files.splice(0) } : {} }, ts);
1962
+ if (text || files2.length > 0) {
1963
+ record({
1964
+ kind: "user.message",
1965
+ text,
1966
+ ...files2.length > 0 ? { files: files2.splice(0) } : {},
1967
+ ...versioned
1968
+ }, ts);
1814
1969
  }
1815
1970
  } else if (block.type === "tool_result") {
1816
1971
  record({
@@ -1855,26 +2010,76 @@ async function readTranscript(sessionId, options2) {
1855
2010
  }
1856
2011
  return entries;
1857
2012
  }
1858
- async function locateResumePoint(sessionId, dir, userIndex, configDir = null) {
1859
- let messages;
2013
+ async function locateResumePoint(sessionId, dir, userIndex, configDir = null, choices) {
2014
+ let view;
1860
2015
  try {
1861
- messages = await withConfigDir(configDir, () => getSessionMessages(sessionId, { dir, includeSystemMessages: true }));
2016
+ view = await loadBranch(sessionId, dir, configDir, choices);
1862
2017
  } catch {
1863
2018
  return null;
1864
2019
  }
2020
+ const leaf = view.messages.at(-1)?.uuid ?? null;
1865
2021
  let lastUuid = null;
1866
2022
  let seen = 0;
1867
- for (const message of messages) {
2023
+ let found = null;
2024
+ for (const message of view.messages) {
1868
2025
  if (message.parent_tool_use_id !== null || message.parent_agent_id !== null)
1869
2026
  continue;
1870
2027
  if (message.type === "user" && isHumanTurn(message)) {
1871
- if (seen === userIndex)
1872
- return { resumeAt: lastUuid, userUuid: message.uuid };
2028
+ if (userIndex === "last" || seen === userIndex) {
2029
+ const forkKey = view.tree?.forkOf.get(message.uuid) ?? null;
2030
+ found = {
2031
+ resumeAt: lastUuid,
2032
+ userUuid: message.uuid,
2033
+ userIndex: seen,
2034
+ forkKey,
2035
+ versions: (forkKey !== null ? view.tree?.groups.get(forkKey) : void 0) ?? [message.uuid],
2036
+ message,
2037
+ leaf
2038
+ };
2039
+ if (userIndex !== "last")
2040
+ return found;
2041
+ }
1873
2042
  seen += 1;
1874
2043
  }
1875
2044
  lastUuid = message.uuid;
1876
2045
  }
1877
- return null;
2046
+ return found;
2047
+ }
2048
+ function promptOf(message) {
2049
+ const content = contentOf(message);
2050
+ if (typeof content === "string")
2051
+ return { text: humanText(content), images: [], files: [] };
2052
+ const images = [];
2053
+ const files2 = [];
2054
+ const texts = [];
2055
+ for (const block of content) {
2056
+ const source = block.source;
2057
+ if (block.type === "image") {
2058
+ if (source?.type === "base64" && typeof source.data === "string") {
2059
+ images.push({ mediaType: source.media_type, data: source.data });
2060
+ }
2061
+ } else if (block.type === "document") {
2062
+ const isText = source?.type === "text";
2063
+ files2.push({
2064
+ kind: isText ? "text" : "pdf",
2065
+ name: typeof block.title === "string" && block.title ? block.title : "\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",
2066
+ mediaType: isText ? "text/plain" : "application/pdf",
2067
+ size: typeof source?.data === "string" ? Buffer.byteLength(source.data, isText ? "utf8" : "base64") : 0
2068
+ });
2069
+ } else if (block.type === "text" && typeof block.text === "string") {
2070
+ const stripped = stripAttachmentNote(block.text);
2071
+ for (const name of stripped.names) {
2072
+ files2.push({ kind: "file", name, mediaType: "application/octet-stream", size: 0 });
2073
+ }
2074
+ const text = humanText(stripped.text);
2075
+ if (text)
2076
+ texts.push(text);
2077
+ }
2078
+ }
2079
+ return { text: texts.join("\n\n"), images, files: files2 };
2080
+ }
2081
+ function promptContent(message) {
2082
+ return contentOf(message);
1878
2083
  }
1879
2084
  function isHumanTurn(message) {
1880
2085
  const content = contentOf(message);
@@ -2102,6 +2307,17 @@ var ClaudeSession = class extends EventEmitter2 {
2102
2307
  * начата с нуля, и продолжать нечего.
2103
2308
  */
2104
2309
  #history = null;
2310
+ /**
2311
+ * Выбранные версии реплик (`switchBranch`): ключ развилки → uuid версии.
2312
+ * Пусто — показывается последняя ветка файла, как её выбирает сам CLI.
2313
+ */
2314
+ #branchChoices = /* @__PURE__ */ new Map();
2315
+ /**
2316
+ * Последнее сообщение выбранной ветки, пока в неё ничего не дописали.
2317
+ * Процесс, поднятый заново (переподключение), продолжает отсюда, а не с
2318
+ * последней ветки файла. Первая же новая реплика делает её последней.
2319
+ */
2320
+ #branchResumeAt = null;
2105
2321
  /** Чем подняли эту сессию — нужно, чтобы объяснить провал старта. */
2106
2322
  #executable = { source: "bundled" };
2107
2323
  #inbox = new AsyncQueue();
@@ -2472,8 +2688,9 @@ var ClaudeSession = class extends EventEmitter2 {
2472
2688
  const resume = this.#claudeSessionId ?? this.#options.resume;
2473
2689
  if (resume)
2474
2690
  options2.resume = resume;
2475
- if (typeof resumeAt === "string")
2476
- options2.resumeSessionAt = resumeAt;
2691
+ const at = resumeAt ?? this.#branchResumeAt;
2692
+ if (resume && typeof at === "string")
2693
+ options2.resumeSessionAt = at;
2477
2694
  }
2478
2695
  if (this.#options.fork && !this.#claudeSessionId)
2479
2696
  options2.forkSession = true;
@@ -2741,14 +2958,20 @@ var ClaudeSession = class extends EventEmitter2 {
2741
2958
  // -------------------------------------------------------------------------
2742
2959
  // Ввод от пользователя
2743
2960
  // -------------------------------------------------------------------------
2744
- sendPrompt(text, images, service = false, attachments) {
2961
+ sendPrompt(text, images, service = false, attachments, version2) {
2745
2962
  if (this.#closing)
2746
2963
  throw new Error("session is closed");
2747
2964
  const blocked = networkGuard.blockedReason();
2748
2965
  if (blocked)
2749
2966
  throw new Error(`${blocked}. \u041F\u0440\u043E\u043C\u043F\u0442 \u043D\u0435 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D.`);
2750
2967
  checkAttachments(images, attachments);
2751
- this.#record({ kind: "user.message", text, images, files: attachmentMeta(attachments) });
2968
+ this.#record({
2969
+ kind: "user.message",
2970
+ text,
2971
+ images,
2972
+ files: attachmentMeta(attachments),
2973
+ ...version2 ? { version: version2 } : {}
2974
+ });
2752
2975
  if (!service && (!this.#title || this.#titleIsDefault)) {
2753
2976
  this.#title = text.slice(0, 80);
2754
2977
  this.#titleIsDefault = false;
@@ -2762,10 +2985,12 @@ var ClaudeSession = class extends EventEmitter2 {
2762
2985
  if (!this.#query) {
2763
2986
  this.#pendingRetry.push({ text, images, attachments });
2764
2987
  this.reconnect("\u0441\u0435\u0441\u0441\u0438\u0438 \u043D\u0443\u0436\u0435\u043D \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0434\u043B\u044F \u043D\u043E\u0432\u043E\u0433\u043E \u043F\u0440\u043E\u043C\u043F\u0442\u0430");
2988
+ this.#branchResumeAt = null;
2765
2989
  return;
2766
2990
  }
2767
2991
  this.#setState("running");
2768
2992
  this.#push(text, images, attachments);
2993
+ this.#branchResumeAt = null;
2769
2994
  }
2770
2995
  /**
2771
2996
  * Отредактировать реплику `userIndex` — как в любом AI-чате: всё, что было
@@ -2792,7 +3017,7 @@ var ClaudeSession = class extends EventEmitter2 {
2792
3017
  if (this.#state === "running")
2793
3018
  await this.interrupt();
2794
3019
  const source = this.#claudeSessionId ?? this.#options.resume;
2795
- const anchor = source ? await locateResumePoint(source, this.cwd, userIndex, this.#options.configDir ?? null) : null;
3020
+ const anchor = source ? await locateResumePoint(source, this.cwd, userIndex, this.#options.configDir ?? null, this.#branchChoices) : null;
2796
3021
  if (!anchor) {
2797
3022
  this.#record({
2798
3023
  kind: "error",
@@ -2817,12 +3042,122 @@ var ClaudeSession = class extends EventEmitter2 {
2817
3042
  if (rewindError) {
2818
3043
  this.#record({ kind: "error", message: `\u0424\u0430\u0439\u043B\u044B \u043D\u0435 \u043E\u0442\u043A\u0430\u0447\u0435\u043D\u044B: ${rewindError}` });
2819
3044
  }
2820
- this.#teardown("\u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0440\u0435\u043F\u043B\u0438\u043A\u0438");
3045
+ const version2 = this.#newVersion(anchor);
3046
+ this.#replaceProcess("\u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0440\u0435\u043F\u043B\u0438\u043A\u0438", anchor.resumeAt);
3047
+ this.sendPrompt(text, images, false, attachments, version2);
3048
+ }
3049
+ /**
3050
+ * Тот же круг смены процесса, что и при реконнекте (`#restart`), но без
3051
+ * его сообщения в ленту — правка или повтор не авария, объяснять тут нечего.
3052
+ */
3053
+ #replaceProcess(reason, resumeAt) {
3054
+ this.#teardown(reason);
2821
3055
  this.#inbox = new AsyncQueue();
2822
3056
  this.#streamMessageId = null;
2823
3057
  this.#blockCounts.clear();
2824
- this.#spawn(true, anchor.resumeAt);
2825
- this.sendPrompt(text, images, false, attachments);
3058
+ this.#branchResumeAt = null;
3059
+ this.#spawn(true, resumeAt);
3060
+ }
3061
+ /**
3062
+ * Версия, которой станет новая реплика на месте `anchor`. Правка первой
3063
+ * реплики поднимает новый файл (`resumeAt === null`), и версий там нет.
3064
+ * Выбор на этой развилке снимается: новая версия — последняя в файле.
3065
+ */
3066
+ #newVersion(anchor) {
3067
+ if (anchor.resumeAt === null || anchor.forkKey === null)
3068
+ return void 0;
3069
+ this.#branchChoices.delete(anchor.forkKey);
3070
+ const count2 = anchor.versions.length + 1;
3071
+ return { index: count2, count: count2 };
3072
+ }
3073
+ /**
3074
+ * Повторить ответ на последнюю реплику: тот же вопрос, заданный заново с
3075
+ * того же места. Старый ответ остаётся прошлой версией реплики.
3076
+ *
3077
+ * Реплика уходит в CLI теми же блоками, какими лежит в транскрипте:
3078
+ * картинки и документы у клиента есть только описанием, а здесь — целиком.
3079
+ */
3080
+ async retryLastPrompt() {
3081
+ if (this.#closing)
3082
+ throw new Error("session is closed");
3083
+ const blocked = networkGuard.blockedReason();
3084
+ if (blocked)
3085
+ throw new Error(`${blocked}. \u041F\u043E\u0432\u0442\u043E\u0440 \u043D\u0435 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D.`);
3086
+ if (this.#state === "running")
3087
+ await this.interrupt();
3088
+ const source = this.#claudeSessionId ?? this.#options.resume;
3089
+ const anchor = source ? await locateResumePoint(source, this.cwd, "last", this.#options.configDir ?? null, this.#branchChoices) : null;
3090
+ if (!anchor) {
3091
+ this.#record({ kind: "error", message: "\u041D\u0435 \u043D\u0430\u0448\u043B\u043E\u0441\u044C \u0440\u0435\u043F\u043B\u0438\u043A\u0438, \u043D\u0430 \u043A\u043E\u0442\u043E\u0440\u0443\u044E \u043C\u043E\u0436\u043D\u043E \u043E\u0442\u0432\u0435\u0442\u0438\u0442\u044C \u0437\u0430\u043D\u043E\u0432\u043E." });
3092
+ return;
3093
+ }
3094
+ this.journal.clear();
3095
+ this.#record({ kind: "rewound", toUserIndex: anchor.userIndex });
3096
+ const version2 = this.#newVersion(anchor);
3097
+ this.#replaceProcess("\u043F\u043E\u0432\u0442\u043E\u0440 \u043E\u0442\u0432\u0435\u0442\u0430", anchor.resumeAt);
3098
+ const prompt = promptOf(anchor.message);
3099
+ this.#record({
3100
+ kind: "user.message",
3101
+ text: prompt.text,
3102
+ ...prompt.images.length > 0 ? { images: prompt.images } : {},
3103
+ ...prompt.files.length > 0 ? { files: prompt.files } : {},
3104
+ ...version2 ? { version: version2 } : {}
3105
+ });
3106
+ this.#lastTurn = null;
3107
+ this.#interruptRequested = false;
3108
+ this.#lastPrompt = prompt.text;
3109
+ this.#lastImages = prompt.images.length > 0 ? prompt.images : void 0;
3110
+ this.#lastAttachments = void 0;
3111
+ this.#turnDidWork = false;
3112
+ this.#setState("running");
3113
+ this.#inbox.push({
3114
+ type: "user",
3115
+ message: { role: "user", content: promptContent(anchor.message) },
3116
+ parent_tool_use_id: null
3117
+ });
3118
+ }
3119
+ /**
3120
+ * Показать другую версию реплики `userIndex` (`version` с 1) — и всё, что
3121
+ * выросло из неё. Разговор продолжится с конца выбранной ветки.
3122
+ *
3123
+ * История перечитывается по новой ветке, живой журнал очищается, клиент по
3124
+ * `branch.switched` спрашивает историю заново. Во время хода — отказ:
3125
+ * ответ дописывается в ту ветку, из которой его спросили.
3126
+ */
3127
+ async switchBranch(userIndex, version2) {
3128
+ if (this.#closing)
3129
+ throw new Error("session is closed");
3130
+ if (this.#state !== "idle" && this.#state !== "error") {
3131
+ throw new Error("\u0410\u0433\u0435\u043D\u0442 \u0435\u0449\u0451 \u043E\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u2014 \u0434\u043E\u0436\u0434\u0438\u0442\u0435\u0441\u044C \u043A\u043E\u043D\u0446\u0430 \u0445\u043E\u0434\u0430 \u0438\u043B\u0438 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0435\u0433\u043E.");
3132
+ }
3133
+ const source = this.#claudeSessionId ?? this.#options.resume;
3134
+ if (!source)
3135
+ throw new Error("\u0423 \u0441\u0435\u0441\u0441\u0438\u0438 \u0435\u0449\u0451 \u043D\u0435\u0442 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430 \u043D\u0430 \u0434\u0438\u0441\u043A\u0435.");
3136
+ const configDir = this.#options.configDir ?? null;
3137
+ const anchor = await locateResumePoint(source, this.cwd, userIndex, configDir, this.#branchChoices);
3138
+ const chosen = anchor?.versions[version2 - 1];
3139
+ if (!anchor || anchor.forkKey === null || !chosen) {
3140
+ throw new Error("\u0422\u0430\u043A\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0435\u043F\u043B\u0438\u043A\u0438 \u043D\u0435\u0442 \u2014 \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u043B\u0435\u043D\u0442\u0430 \u0443\u0436\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u043B\u0430\u0441\u044C.");
3141
+ }
3142
+ if (chosen === anchor.userUuid)
3143
+ return;
3144
+ const choices = new Map(this.#branchChoices);
3145
+ choices.set(anchor.forkKey, chosen);
3146
+ const next = await locateResumePoint(source, this.cwd, userIndex, configDir, choices);
3147
+ if (!next?.leaf)
3148
+ throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u0443\u044E \u0432\u0435\u0442\u043A\u0443.");
3149
+ this.#branchChoices = choices;
3150
+ this.#history = readTranscript(source, {
3151
+ dir: this.cwd,
3152
+ until: Number.POSITIVE_INFINITY,
3153
+ configDir,
3154
+ choices
3155
+ });
3156
+ await this.#history;
3157
+ this.journal.clear();
3158
+ this.#record({ kind: "branch.switched" });
3159
+ this.#replaceProcess("\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0432\u0435\u0442\u043A\u0438", next.leaf);
3160
+ this.#branchResumeAt = next.leaf;
2826
3161
  }
2827
3162
  /**
2828
3163
  * Откатить файлы к чекпоинту реплики `userIndex` (см. `prompt.edit` о
@@ -3348,7 +3683,7 @@ var ClaudeSession = class extends EventEmitter2 {
3348
3683
  const target = writeTarget(input.tool_input);
3349
3684
  if (!target)
3350
3685
  return pass;
3351
- const absolute = path9.resolve(this.cwd, target);
3686
+ const absolute = path10.resolve(this.cwd, target);
3352
3687
  if (roots.some((root) => contains(root, absolute)))
3353
3688
  return pass;
3354
3689
  return {
@@ -3983,29 +4318,29 @@ import { spawn as spawn2, execFile as execFile3 } from "node:child_process";
3983
4318
  import { randomUUID as randomUUID4 } from "node:crypto";
3984
4319
  import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
3985
4320
  import { tmpdir as tmpdir2 } from "node:os";
3986
- import path11 from "node:path";
4321
+ import path12 from "node:path";
3987
4322
  import { createInterface as createInterface2 } from "node:readline";
3988
4323
 
3989
4324
  // ../host/dist/antigravity-cli.js
3990
4325
  import { execFile as execFile2 } from "node:child_process";
3991
4326
  import { existsSync } from "node:fs";
3992
4327
  import { homedir as homedir4 } from "node:os";
3993
- import path10 from "node:path";
4328
+ import path11 from "node:path";
3994
4329
  function agyExecutable() {
3995
4330
  const forced = process.env.CCV_AGY_PATH;
3996
4331
  if (forced && existsSync(forced))
3997
4332
  return forced;
3998
4333
  const names2 = process.platform === "win32" ? ["agy.exe", "agy"] : ["agy"];
3999
- const dirs = (process.env.PATH ?? "").split(path10.delimiter).filter(Boolean);
4334
+ const dirs = (process.env.PATH ?? "").split(path11.delimiter).filter(Boolean);
4000
4335
  if (process.platform === "win32") {
4001
- const local = process.env.LOCALAPPDATA ?? path10.join(homedir4(), "AppData", "Local");
4002
- dirs.push(path10.join(local, "agy", "bin"));
4336
+ const local = process.env.LOCALAPPDATA ?? path11.join(homedir4(), "AppData", "Local");
4337
+ dirs.push(path11.join(local, "agy", "bin"));
4003
4338
  } else {
4004
- dirs.push(path10.join(homedir4(), ".local", "bin"), "/usr/local/bin", "/opt/homebrew/bin");
4339
+ dirs.push(path11.join(homedir4(), ".local", "bin"), "/usr/local/bin", "/opt/homebrew/bin");
4005
4340
  }
4006
4341
  for (const dir of dirs) {
4007
4342
  for (const name of names2) {
4008
- const candidate = path10.join(dir, name);
4343
+ const candidate = path11.join(dir, name);
4009
4344
  if (existsSync(candidate))
4010
4345
  return candidate;
4011
4346
  }
@@ -4674,12 +5009,12 @@ var AntigravitySession = class extends EventEmitter3 {
4674
5009
  const note = attachmentNote((attachments ?? []).map((a) => saveAttachment(a, this.id)));
4675
5010
  if (!images || images.length === 0)
4676
5011
  return text + note;
4677
- const dir = path11.join(tmpdir2(), "ccv-antigravity", this.id);
5012
+ const dir = path12.join(tmpdir2(), "ccv-antigravity", this.id);
4678
5013
  await mkdir3(dir, { recursive: true });
4679
5014
  const paths = [];
4680
5015
  for (const image of images) {
4681
5016
  const ext = image.mediaType.split("/")[1] === "jpeg" ? "jpg" : image.mediaType.split("/")[1];
4682
- const file = path11.join(dir, `${randomUUID4()}.${ext}`);
5017
+ const file = path12.join(dir, `${randomUUID4()}.${ext}`);
4683
5018
  await writeFile3(file, Buffer.from(image.data, "base64"));
4684
5019
  paths.push(file);
4685
5020
  }
@@ -5067,8 +5402,8 @@ function describe2(error) {
5067
5402
  }
5068
5403
 
5069
5404
  // ../host/dist/antigravity-store.js
5070
- import { appendFile, mkdir as mkdir4, readFile as readFile5, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
5071
- import path12 from "node:path";
5405
+ import { appendFile, mkdir as mkdir4, readFile as readFile6, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
5406
+ import path13 from "node:path";
5072
5407
  var AntigravityStore = class {
5073
5408
  #dir;
5074
5409
  #file;
@@ -5080,13 +5415,13 @@ var AntigravityStore = class {
5080
5415
  * у которых в `conversationId` лежит id треда `codex app-server`.
5081
5416
  */
5082
5417
  constructor(dataDir, subdir = "antigravity") {
5083
- this.#dir = path12.join(dataDir, subdir);
5084
- this.#file = path12.join(this.#dir, "sessions.json");
5418
+ this.#dir = path13.join(dataDir, subdir);
5419
+ this.#file = path13.join(this.#dir, "sessions.json");
5085
5420
  }
5086
5421
  #load() {
5087
5422
  this.#loaded ??= (async () => {
5088
5423
  try {
5089
- const raw = JSON.parse(await readFile5(this.#file, "utf8"));
5424
+ const raw = JSON.parse(await readFile6(this.#file, "utf8"));
5090
5425
  for (const record of Array.isArray(raw) ? raw : []) {
5091
5426
  if (record && typeof record.id === "string")
5092
5427
  this.#records.set(record.id, record);
@@ -5161,7 +5496,7 @@ var AntigravityStore = class {
5161
5496
  await this.#writing;
5162
5497
  let raw;
5163
5498
  try {
5164
- raw = await readFile5(this.#eventsFile(id), "utf8");
5499
+ raw = await readFile6(this.#eventsFile(id), "utf8");
5165
5500
  } catch {
5166
5501
  return [];
5167
5502
  }
@@ -5178,7 +5513,7 @@ var AntigravityStore = class {
5178
5513
  return entries;
5179
5514
  }
5180
5515
  #eventsFile(id) {
5181
- return path12.join(this.#dir, `${id.replace(/[^\w-]/g, "_")}.jsonl`);
5516
+ return path13.join(this.#dir, `${id.replace(/[^\w-]/g, "_")}.jsonl`);
5182
5517
  }
5183
5518
  #persist() {
5184
5519
  const snapshot = JSON.stringify([...this.#records.values()], null, 2);
@@ -5202,43 +5537,43 @@ import { EventEmitter as EventEmitter5 } from "node:events";
5202
5537
  import { randomUUID as randomUUID5 } from "node:crypto";
5203
5538
  import { mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
5204
5539
  import { tmpdir as tmpdir3 } from "node:os";
5205
- import path14 from "node:path";
5540
+ import path15 from "node:path";
5206
5541
 
5207
5542
  // ../host/dist/codex-cli.js
5208
5543
  import { EventEmitter as EventEmitter4 } from "node:events";
5209
5544
  import { spawn as spawn3, execFile as execFile4 } from "node:child_process";
5210
5545
  import { existsSync as existsSync2, readdirSync } from "node:fs";
5211
5546
  import { homedir as homedir5 } from "node:os";
5212
- import path13 from "node:path";
5547
+ import path14 from "node:path";
5213
5548
  import { createInterface as createInterface3 } from "node:readline";
5214
5549
  function codexExecutable() {
5215
5550
  const forced = process.env.CCV_CODEX_PATH;
5216
5551
  if (forced && existsSync2(forced))
5217
5552
  return forced;
5218
5553
  const win = process.platform === "win32";
5219
- const dirs = (process.env.PATH ?? "").split(path13.delimiter).filter(Boolean);
5554
+ const dirs = (process.env.PATH ?? "").split(path14.delimiter).filter(Boolean);
5220
5555
  if (win) {
5221
- const local = process.env.LOCALAPPDATA ?? path13.join(homedir5(), "AppData", "Local");
5222
- dirs.push(path13.join(local, "Programs", "OpenAI", "Codex", "bin"));
5556
+ const local = process.env.LOCALAPPDATA ?? path14.join(homedir5(), "AppData", "Local");
5557
+ dirs.push(path14.join(local, "Programs", "OpenAI", "Codex", "bin"));
5223
5558
  } else {
5224
- dirs.push(path13.join(homedir5(), ".local", "bin"), "/usr/local/bin", "/opt/homebrew/bin");
5559
+ dirs.push(path14.join(homedir5(), ".local", "bin"), "/usr/local/bin", "/opt/homebrew/bin");
5225
5560
  }
5226
5561
  const name = win ? "codex.exe" : "codex";
5227
5562
  for (const dir of dirs) {
5228
- const candidate = path13.join(dir, name);
5563
+ const candidate = path14.join(dir, name);
5229
5564
  if (existsSync2(candidate))
5230
5565
  return candidate;
5231
5566
  }
5232
5567
  if (win) {
5233
- const roaming = process.env.APPDATA ?? path13.join(homedir5(), "AppData", "Roaming");
5234
- const vendor = npmVendorExe(path13.join(roaming, "npm", "node_modules", "@openai", "codex"));
5568
+ const roaming = process.env.APPDATA ?? path14.join(homedir5(), "AppData", "Roaming");
5569
+ const vendor = npmVendorExe(path14.join(roaming, "npm", "node_modules", "@openai", "codex"));
5235
5570
  if (vendor)
5236
5571
  return vendor;
5237
5572
  }
5238
5573
  return null;
5239
5574
  }
5240
5575
  function npmVendorExe(pkg) {
5241
- const scope = path13.join(pkg, "node_modules", "@openai");
5576
+ const scope = path14.join(pkg, "node_modules", "@openai");
5242
5577
  let subpackages;
5243
5578
  try {
5244
5579
  subpackages = readdirSync(scope).filter((d) => d.startsWith("codex-win32"));
@@ -5246,7 +5581,7 @@ function npmVendorExe(pkg) {
5246
5581
  return null;
5247
5582
  }
5248
5583
  for (const sub of subpackages) {
5249
- const vendor = path13.join(scope, sub, "vendor");
5584
+ const vendor = path14.join(scope, sub, "vendor");
5250
5585
  let triples;
5251
5586
  try {
5252
5587
  triples = readdirSync(vendor);
@@ -5254,7 +5589,7 @@ function npmVendorExe(pkg) {
5254
5589
  continue;
5255
5590
  }
5256
5591
  for (const triple of triples) {
5257
- const exe = path13.join(vendor, triple, "bin", "codex.exe");
5592
+ const exe = path14.join(vendor, triple, "bin", "codex.exe");
5258
5593
  if (existsSync2(exe))
5259
5594
  return exe;
5260
5595
  }
@@ -5860,11 +6195,11 @@ var CodexSession = class extends EventEmitter5 {
5860
6195
  input.push({ type: "skill", name: skill.name, path: skill.path });
5861
6196
  input.push({ type: "text", text: text + note, text_elements: [] });
5862
6197
  if (images && images.length > 0) {
5863
- const dir = path14.join(tmpdir3(), "ccv-codex", this.id);
6198
+ const dir = path15.join(tmpdir3(), "ccv-codex", this.id);
5864
6199
  await mkdir5(dir, { recursive: true });
5865
6200
  for (const image of images) {
5866
6201
  const sub = image.mediaType.split("/")[1] ?? "png";
5867
- const file = path14.join(dir, `${randomUUID5()}.${sub === "jpeg" ? "jpg" : sub}`);
6202
+ const file = path15.join(dir, `${randomUUID5()}.${sub === "jpeg" ? "jpg" : sub}`);
5868
6203
  await writeFile5(file, Buffer.from(image.data, "base64"));
5869
6204
  input.push({ type: "localImage", path: file });
5870
6205
  }
@@ -6464,9 +6799,9 @@ function toolResult(item) {
6464
6799
  }
6465
6800
  case "fileChange": {
6466
6801
  const ok = item.status === "completed";
6467
- const files = (item.changes ?? []).map((c) => `${c.kind?.type ?? "update"} ${c.path}`).join("\n");
6468
- return { content: ok ? files : `${item.status === "declined" ? "\u041E\u0442\u043A\u043B\u043E\u043D\u0435\u043D\u043E" : "\u041D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0435\u043D\u043E"}
6469
- ${files}`, isError: !ok };
6802
+ const files2 = (item.changes ?? []).map((c) => `${c.kind?.type ?? "update"} ${c.path}`).join("\n");
6803
+ return { content: ok ? files2 : `${item.status === "declined" ? "\u041E\u0442\u043A\u043B\u043E\u043D\u0435\u043D\u043E" : "\u041D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0435\u043D\u043E"}
6804
+ ${files2}`, isError: !ok };
6470
6805
  }
6471
6806
  case "mcpToolCall": {
6472
6807
  if (item.error?.message)
@@ -6523,9 +6858,9 @@ var CodexStore = class extends AntigravityStore {
6523
6858
 
6524
6859
  // ../host/dist/git.js
6525
6860
  import { execFile as execFile5 } from "node:child_process";
6526
- import { mkdtemp, readFile as readFile6, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
6861
+ import { mkdtemp, readFile as readFile7, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
6527
6862
  import { tmpdir as tmpdir4 } from "node:os";
6528
- import path15 from "node:path";
6863
+ import path16 from "node:path";
6529
6864
  var TIMEOUT_MS = 2e4;
6530
6865
  var NET_TIMEOUT_MS = 5 * 6e4;
6531
6866
  var MAX_BUFFER = 32 * 1024 * 1024;
@@ -6656,7 +6991,7 @@ var GitRepo = class {
6656
6991
  "--format=",
6657
6992
  hash
6658
6993
  ]);
6659
- const { files, truncated } = parsePatch(patch);
6994
+ const { files: files2, truncated } = parsePatch(patch);
6660
6995
  return {
6661
6996
  hash: parts[0] ?? hash,
6662
6997
  shortHash: parts[1] ?? hash.slice(0, 8),
@@ -6666,7 +7001,7 @@ var GitRepo = class {
6666
7001
  date: parts[5] ?? "",
6667
7002
  subject: parts[6] ?? "",
6668
7003
  body: parts.slice(7).join(UNIT).trim(),
6669
- files,
7004
+ files: files2,
6670
7005
  truncated
6671
7006
  };
6672
7007
  }
@@ -6680,7 +7015,7 @@ var GitRepo = class {
6680
7015
  */
6681
7016
  async #worktree() {
6682
7017
  const patch = await this.#soft(["diff", "HEAD", "--no-color", "--find-renames"]);
6683
- const { files, truncated } = parsePatch(patch);
7018
+ const { files: files2, truncated } = parsePatch(patch);
6684
7019
  const untracked = parseStatus(await this.#soft(["status", "--porcelain=v1"])).filter((change) => change.status === "??").map((change) => ({
6685
7020
  path: change.path,
6686
7021
  oldPath: "",
@@ -6699,7 +7034,7 @@ var GitRepo = class {
6699
7034
  date: (/* @__PURE__ */ new Date()).toISOString(),
6700
7035
  subject: "\u041D\u0435\u0437\u0430\u043A\u043E\u043C\u043C\u0438\u0447\u0435\u043D\u043D\u044B\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",
6701
7036
  body: "",
6702
- files: [...files, ...untracked],
7037
+ files: [...files2, ...untracked],
6703
7038
  truncated
6704
7039
  };
6705
7040
  }
@@ -6841,7 +7176,7 @@ var GitRepo = class {
6841
7176
  * важнее всего (см. `checkIgnored`).
6842
7177
  */
6843
7178
  async #withoutRepo(args) {
6844
- const dir = await mkdtemp(path15.join(tmpdir4(), "ccv-git-"));
7179
+ const dir = await mkdtemp(path16.join(tmpdir4(), "ccv-git-"));
6845
7180
  try {
6846
7181
  await this.#run(["init", "--bare", "--quiet", dir]);
6847
7182
  return await this.#soft([`--git-dir=${dir}`, `--work-tree=${this.cwd}`, ...args]);
@@ -6887,8 +7222,8 @@ var GitRepo = class {
6887
7222
  * исключил. Повторы отсеиваются, чтобы файл не рос от каждой публикации.
6888
7223
  */
6889
7224
  async #appendGitignore(paths) {
6890
- const file = path15.join(this.cwd, ".gitignore");
6891
- const existing = await readFile6(file, "utf8").catch(() => "");
7225
+ const file = path16.join(this.cwd, ".gitignore");
7226
+ const existing = await readFile7(file, "utf8").catch(() => "");
6892
7227
  const known = new Set(existing.split(/\r?\n/).map((line) => line.trim()));
6893
7228
  const lines = paths.map(ignorePattern).filter((line) => !known.has(line));
6894
7229
  if (lines.length === 0)
@@ -7044,7 +7379,7 @@ function parseBranches(raw, current) {
7044
7379
  return out;
7045
7380
  }
7046
7381
  function parsePatch(raw) {
7047
- const files = [];
7382
+ const files2 = [];
7048
7383
  let truncated = false;
7049
7384
  let total = 0;
7050
7385
  for (const chunk of raw.split(/^diff --git /m).slice(1)) {
@@ -7093,9 +7428,9 @@ function parsePatch(raw) {
7093
7428
  body = "";
7094
7429
  }
7095
7430
  total += body.length;
7096
- const path35 = status === "deleted" ? oldPath : newPath || oldPath;
7097
- files.push({
7098
- path: path35,
7431
+ const path36 = status === "deleted" ? oldPath : newPath || oldPath;
7432
+ files2.push({
7433
+ path: path36,
7099
7434
  oldPath: status === "renamed" ? oldPath : "",
7100
7435
  status,
7101
7436
  added: count(body, "+"),
@@ -7104,13 +7439,13 @@ function parsePatch(raw) {
7104
7439
  patch: binary ? "" : body
7105
7440
  });
7106
7441
  }
7107
- return { files, truncated };
7442
+ return { files: files2, truncated };
7108
7443
  }
7109
7444
  function stripPrefix(value) {
7110
- const path35 = unquote(value.trim());
7111
- if (path35 === "/dev/null")
7445
+ const path36 = unquote(value.trim());
7446
+ if (path36 === "/dev/null")
7112
7447
  return "";
7113
- return path35.replace(/^[ab]\//, "");
7448
+ return path36.replace(/^[ab]\//, "");
7114
7449
  }
7115
7450
  function count(body, mark) {
7116
7451
  let n = 0;
@@ -7123,8 +7458,8 @@ function count(body, mark) {
7123
7458
 
7124
7459
  // ../host/dist/github.js
7125
7460
  import { execFile as execFile6 } from "node:child_process";
7126
- import { mkdir as mkdir6, readFile as readFile7, writeFile as writeFile7 } from "node:fs/promises";
7127
- import path16 from "node:path";
7461
+ import { mkdir as mkdir6, readFile as readFile8, writeFile as writeFile7 } from "node:fs/promises";
7462
+ import path17 from "node:path";
7128
7463
  var API = "https://api.github.com";
7129
7464
  var API_VERSION = "2022-11-28";
7130
7465
  var API_TIMEOUT_MS = 2e4;
@@ -7145,11 +7480,11 @@ var GitHubAccount = class {
7145
7480
  */
7146
7481
  #ghInstalled = null;
7147
7482
  constructor(dataDir) {
7148
- this.#storePath = path16.join(dataDir, "github.json");
7483
+ this.#storePath = path17.join(dataDir, "github.json");
7149
7484
  }
7150
7485
  async load() {
7151
7486
  try {
7152
- const raw = JSON.parse(await readFile7(this.#storePath, "utf8"));
7487
+ const raw = JSON.parse(await readFile8(this.#storePath, "utf8"));
7153
7488
  const token = raw.token;
7154
7489
  this.#token = typeof token === "string" ? token.trim() : "";
7155
7490
  } catch {
@@ -7159,7 +7494,7 @@ var GitHubAccount = class {
7159
7494
  /** Сохранить токен или стереть его пустой строкой. */
7160
7495
  async setToken(token) {
7161
7496
  this.#token = token.trim();
7162
- await mkdir6(path16.dirname(this.#storePath), { recursive: true });
7497
+ await mkdir6(path17.dirname(this.#storePath), { recursive: true });
7163
7498
  await writeFile7(this.#storePath, JSON.stringify({ token: this.#token }, null, 2), {
7164
7499
  encoding: "utf8",
7165
7500
  mode: 384
@@ -7352,8 +7687,8 @@ function describe5(error) {
7352
7687
  }
7353
7688
 
7354
7689
  // ../host/dist/memory.js
7355
- import { mkdir as mkdir7, readFile as readFile8, readdir as readdir4, rm as rm4, stat as stat4, writeFile as writeFile8 } from "node:fs/promises";
7356
- import path17 from "node:path";
7690
+ import { mkdir as mkdir7, readFile as readFile9, readdir as readdir5, rm as rm4, stat as stat5, writeFile as writeFile8 } from "node:fs/promises";
7691
+ import path18 from "node:path";
7357
7692
  function projectSlug(cwd) {
7358
7693
  return cwd.replace(/[^a-zA-Z0-9]/g, "-");
7359
7694
  }
@@ -7367,7 +7702,7 @@ var MemoryFiles = class {
7367
7702
  this.configDir = configDir;
7368
7703
  }
7369
7704
  get memoryDir() {
7370
- return path17.join(this.configDir, "projects", projectSlug(this.cwd), "memory");
7705
+ return path18.join(this.configDir, "projects", projectSlug(this.cwd), "memory");
7371
7706
  }
7372
7707
  async #entries() {
7373
7708
  const entries = [
@@ -7375,7 +7710,7 @@ var MemoryFiles = class {
7375
7710
  id: "user",
7376
7711
  scope: "user",
7377
7712
  label: "\u0418\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F",
7378
- path: path17.join(this.configDir, "CLAUDE.md"),
7713
+ path: path18.join(this.configDir, "CLAUDE.md"),
7379
7714
  deletable: false,
7380
7715
  creatable: true
7381
7716
  },
@@ -7383,7 +7718,7 @@ var MemoryFiles = class {
7383
7718
  id: "project",
7384
7719
  scope: "project",
7385
7720
  label: "\u0418\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430",
7386
- path: path17.join(this.cwd, "CLAUDE.md"),
7721
+ path: path18.join(this.cwd, "CLAUDE.md"),
7387
7722
  deletable: false,
7388
7723
  creatable: true
7389
7724
  },
@@ -7391,7 +7726,7 @@ var MemoryFiles = class {
7391
7726
  id: "project-dotclaude",
7392
7727
  scope: "project",
7393
7728
  label: "\u0418\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 (.claude)",
7394
- path: path17.join(this.cwd, ".claude", "CLAUDE.md"),
7729
+ path: path18.join(this.cwd, ".claude", "CLAUDE.md"),
7395
7730
  deletable: false,
7396
7731
  creatable: false
7397
7732
  },
@@ -7399,14 +7734,14 @@ var MemoryFiles = class {
7399
7734
  id: "local",
7400
7735
  scope: "local",
7401
7736
  label: "\u041B\u0438\u0447\u043D\u044B\u0435 \u0438\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430",
7402
- path: path17.join(this.cwd, "CLAUDE.local.md"),
7737
+ path: path18.join(this.cwd, "CLAUDE.local.md"),
7403
7738
  deletable: false,
7404
7739
  creatable: true
7405
7740
  }
7406
7741
  ];
7407
7742
  let names2 = [];
7408
7743
  try {
7409
- names2 = (await readdir4(this.memoryDir)).filter((n) => n.toLowerCase().endsWith(".md"));
7744
+ names2 = (await readdir5(this.memoryDir)).filter((n) => n.toLowerCase().endsWith(".md"));
7410
7745
  } catch {
7411
7746
  }
7412
7747
  if (!names2.includes(MEMORY_INDEX))
@@ -7417,7 +7752,7 @@ var MemoryFiles = class {
7417
7752
  id: `memory:${name}`,
7418
7753
  scope: "memory",
7419
7754
  label: name,
7420
- path: path17.join(this.memoryDir, name),
7755
+ path: path18.join(this.memoryDir, name),
7421
7756
  deletable: true,
7422
7757
  creatable: name === MEMORY_INDEX
7423
7758
  });
@@ -7425,24 +7760,24 @@ var MemoryFiles = class {
7425
7760
  return entries;
7426
7761
  }
7427
7762
  async list() {
7428
- const files = [];
7763
+ const files2 = [];
7429
7764
  for (const entry of await this.#entries()) {
7430
- const info = await stat4(entry.path).catch(() => null);
7431
- const exists5 = Boolean(info?.isFile());
7432
- if (!exists5 && !entry.creatable)
7765
+ const info = await stat5(entry.path).catch(() => null);
7766
+ const exists6 = Boolean(info?.isFile());
7767
+ if (!exists6 && !entry.creatable)
7433
7768
  continue;
7434
- files.push({
7769
+ files2.push({
7435
7770
  id: entry.id,
7436
7771
  scope: entry.scope,
7437
7772
  label: entry.label,
7438
7773
  path: entry.path,
7439
- exists: exists5,
7440
- size: exists5 ? info.size : 0,
7441
- mtime: exists5 ? Math.round(info.mtimeMs) : 0,
7442
- deletable: entry.deletable && exists5
7774
+ exists: exists6,
7775
+ size: exists6 ? info.size : 0,
7776
+ mtime: exists6 ? Math.round(info.mtimeMs) : 0,
7777
+ deletable: entry.deletable && exists6
7443
7778
  });
7444
7779
  }
7445
- return files;
7780
+ return files2;
7446
7781
  }
7447
7782
  async #find(id) {
7448
7783
  const entry = (await this.#entries()).find((e) => e.id === id);
@@ -7452,25 +7787,25 @@ var MemoryFiles = class {
7452
7787
  }
7453
7788
  async read(id) {
7454
7789
  const entry = await this.#find(id);
7455
- const info = await stat4(entry.path).catch(() => null);
7790
+ const info = await stat5(entry.path).catch(() => null);
7456
7791
  if (!info?.isFile())
7457
7792
  return { content: "", mtime: 0 };
7458
7793
  if (info.size > MAX_SIZE)
7459
7794
  throw new Error("\u0424\u0430\u0439\u043B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0432\u0435\u043B\u0438\u043A");
7460
- return { content: await readFile8(entry.path, "utf8"), mtime: Math.round(info.mtimeMs) };
7795
+ return { content: await readFile9(entry.path, "utf8"), mtime: Math.round(info.mtimeMs) };
7461
7796
  }
7462
7797
  async write(id, content, baseMtime) {
7463
7798
  const entry = await this.#find(id);
7464
- const info = await stat4(entry.path).catch(() => null);
7799
+ const info = await stat5(entry.path).catch(() => null);
7465
7800
  const current = info?.isFile() ? Math.round(info.mtimeMs) : 0;
7466
7801
  if (current !== baseMtime) {
7467
7802
  throw new ConflictError("\u0424\u0430\u0439\u043B \u0438\u0437\u043C\u0435\u043D\u0438\u043B\u0441\u044F, \u043F\u043E\u043A\u0430 \u0435\u0433\u043E \u043F\u0440\u0430\u0432\u0438\u043B\u0438");
7468
7803
  }
7469
7804
  if (Buffer.byteLength(content, "utf8") > MAX_SIZE)
7470
7805
  throw new Error("\u0424\u0430\u0439\u043B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0432\u0435\u043B\u0438\u043A");
7471
- await mkdir7(path17.dirname(entry.path), { recursive: true });
7806
+ await mkdir7(path18.dirname(entry.path), { recursive: true });
7472
7807
  await writeFile8(entry.path, content, "utf8");
7473
- return Math.round((await stat4(entry.path)).mtimeMs);
7808
+ return Math.round((await stat5(entry.path)).mtimeMs);
7474
7809
  }
7475
7810
  async delete(id) {
7476
7811
  const entry = await this.#find(id);
@@ -7481,8 +7816,8 @@ var MemoryFiles = class {
7481
7816
  };
7482
7817
 
7483
7818
  // ../host/dist/scheduler.js
7484
- import { mkdir as mkdir8, readFile as readFile9, writeFile as writeFile9 } from "node:fs/promises";
7485
- import path18 from "node:path";
7819
+ import { mkdir as mkdir8, readFile as readFile10, writeFile as writeFile9 } from "node:fs/promises";
7820
+ import path19 from "node:path";
7486
7821
  import { randomUUID as randomUUID6 } from "node:crypto";
7487
7822
  var MIN_INTERVAL_MINUTES = 15;
7488
7823
  var TICK_MS = 3e4;
@@ -7494,11 +7829,11 @@ var Scheduler = class {
7494
7829
  #storePath;
7495
7830
  constructor(dataDir, hooks) {
7496
7831
  this.hooks = hooks;
7497
- this.#storePath = path18.join(dataDir, "scheduled-tasks.json");
7832
+ this.#storePath = path19.join(dataDir, "scheduled-tasks.json");
7498
7833
  }
7499
7834
  async load() {
7500
7835
  try {
7501
- const parsed = JSON.parse(await readFile9(this.#storePath, "utf8"));
7836
+ const parsed = JSON.parse(await readFile10(this.#storePath, "utf8"));
7502
7837
  const now = Date.now();
7503
7838
  for (const task of parsed.tasks ?? []) {
7504
7839
  if (!task || typeof task.id !== "string")
@@ -7603,7 +7938,7 @@ var Scheduler = class {
7603
7938
  await this.#persist();
7604
7939
  }
7605
7940
  async #persist() {
7606
- await mkdir8(path18.dirname(this.#storePath), { recursive: true });
7941
+ await mkdir8(path19.dirname(this.#storePath), { recursive: true });
7607
7942
  await writeFile9(this.#storePath, JSON.stringify({ tasks: this.list() }, null, 2), "utf8");
7608
7943
  this.hooks.changed(this.list());
7609
7944
  }
@@ -7685,9 +8020,9 @@ function nextRun(task, now) {
7685
8020
 
7686
8021
  // ../host/dist/finder.js
7687
8022
  import { existsSync as existsSync3, statSync } from "node:fs";
7688
- import { readdir as readdir5 } from "node:fs/promises";
8023
+ import { readdir as readdir6 } from "node:fs/promises";
7689
8024
  import os2 from "node:os";
7690
- import path19 from "node:path";
8025
+ import path20 from "node:path";
7691
8026
  import { listSessions } from "@anthropic-ai/claude-agent-sdk";
7692
8027
  var CACHE_TTL = 6e4;
7693
8028
  var FIND_LIMIT = 50;
@@ -7728,7 +8063,7 @@ var ProjectFinder = class {
7728
8063
  if (needles.length === 0)
7729
8064
  return { candidates: [], truncated: false };
7730
8065
  const open = new Map(this.registry.list().map((workspace) => [workspace.path.toLowerCase(), workspace]));
7731
- const byName = this.#dirs.filter((dir) => matches(path19.basename(dir.path), needles));
8066
+ const byName = this.#dirs.filter((dir) => matches(path20.basename(dir.path), needles));
7732
8067
  const matched = byName.length > 0 ? byName : this.#dirs.filter((dir) => matches(dir.path, needles));
7733
8068
  const sorted = [...matched].sort((a, b) => {
7734
8069
  const aOpen = open.has(a.path.toLowerCase());
@@ -7739,7 +8074,7 @@ var ProjectFinder = class {
7739
8074
  return a.sessions > 0 ? -1 : 1;
7740
8075
  if (a.lastUsedAt !== b.lastUsedAt)
7741
8076
  return b.lastUsedAt - a.lastUsedAt;
7742
- return path19.basename(a.path).localeCompare(path19.basename(b.path), void 0, {
8077
+ return path20.basename(a.path).localeCompare(path20.basename(b.path), void 0, {
7743
8078
  numeric: true,
7744
8079
  sensitivity: "base"
7745
8080
  });
@@ -7747,7 +8082,7 @@ var ProjectFinder = class {
7747
8082
  return {
7748
8083
  candidates: sorted.slice(0, FIND_LIMIT).map((dir) => ({
7749
8084
  path: dir.path,
7750
- name: path19.basename(dir.path) || dir.path,
8085
+ name: path20.basename(dir.path) || dir.path,
7751
8086
  sessions: dir.sessions,
7752
8087
  lastUsedAt: dir.lastUsedAt || null,
7753
8088
  open: open.has(dir.path.toLowerCase()),
@@ -7771,7 +8106,7 @@ var ProjectFinder = class {
7771
8106
  const candidates = [];
7772
8107
  for (const entry of named) {
7773
8108
  const absolute = entry.path.trim();
7774
- if (!absolute || !path19.isAbsolute(absolute))
8109
+ if (!absolute || !path20.isAbsolute(absolute))
7775
8110
  continue;
7776
8111
  const key = absolute.toLowerCase();
7777
8112
  if (seen.has(key))
@@ -7782,7 +8117,7 @@ var ProjectFinder = class {
7782
8117
  const record = known.get(key);
7783
8118
  candidates.push({
7784
8119
  path: record?.path ?? absolute,
7785
- name: path19.basename(absolute) || absolute,
8120
+ name: path20.basename(absolute) || absolute,
7786
8121
  sessions: record?.sessions ?? 0,
7787
8122
  lastUsedAt: record?.lastUsedAt || null,
7788
8123
  open: open.has(key),
@@ -7834,12 +8169,12 @@ var ProjectFinder = class {
7834
8169
  dirs.set(key, { path: cwd, sessions: 1, lastUsedAt: info.lastModified });
7835
8170
  }
7836
8171
  for (const parent of this.#parents(dirs.values())) {
7837
- const names2 = await readdir5(parent, { withFileTypes: true }).catch(() => []);
8172
+ const names2 = await readdir6(parent, { withFileTypes: true }).catch(() => []);
7838
8173
  for (const dirent of names2) {
7839
8174
  if (!dirent.isDirectory() || SKIP_NAMES.has(dirent.name) || dirent.name.startsWith(".")) {
7840
8175
  continue;
7841
8176
  }
7842
- const full = path19.join(parent, dirent.name);
8177
+ const full = path20.join(parent, dirent.name);
7843
8178
  const key = full.toLowerCase();
7844
8179
  if (dirs.has(key))
7845
8180
  continue;
@@ -7860,7 +8195,7 @@ var ProjectFinder = class {
7860
8195
  #parents(dirs) {
7861
8196
  const counted = /* @__PURE__ */ new Map();
7862
8197
  for (const dir of dirs) {
7863
- const parent = path19.dirname(dir.path);
8198
+ const parent = path20.dirname(dir.path);
7864
8199
  if (parent === dir.path || !usable(parent))
7865
8200
  continue;
7866
8201
  const key = parent.toLowerCase();
@@ -7975,18 +8310,18 @@ function fromText(text) {
7975
8310
 
7976
8311
  // ../host/dist/workspaces.js
7977
8312
  import { existsSync as existsSync4, statSync as statSync2 } from "node:fs";
7978
- import { mkdir as mkdir9, readFile as readFile10, writeFile as writeFile10 } from "node:fs/promises";
7979
- import path20 from "node:path";
8313
+ import { mkdir as mkdir9, readFile as readFile11, writeFile as writeFile10 } from "node:fs/promises";
8314
+ import path21 from "node:path";
7980
8315
  import { listSessions as listSessions2 } from "@anthropic-ai/claude-agent-sdk";
7981
8316
  var WorkspaceRegistry = class {
7982
8317
  #entries = [];
7983
8318
  #storePath;
7984
8319
  constructor(dataDir) {
7985
- this.#storePath = path20.join(dataDir, "workspaces.json");
8320
+ this.#storePath = path21.join(dataDir, "workspaces.json");
7986
8321
  }
7987
8322
  async load() {
7988
8323
  try {
7989
- const raw = await readFile10(this.#storePath, "utf8");
8324
+ const raw = await readFile11(this.#storePath, "utf8");
7990
8325
  const parsed = JSON.parse(raw);
7991
8326
  if (!Array.isArray(parsed)) {
7992
8327
  this.#entries = [];
@@ -8005,7 +8340,7 @@ var WorkspaceRegistry = class {
8005
8340
  }
8006
8341
  }
8007
8342
  async #persist() {
8008
- await mkdir9(path20.dirname(this.#storePath), { recursive: true });
8343
+ await mkdir9(path21.dirname(this.#storePath), { recursive: true });
8009
8344
  await writeFile10(this.#storePath, JSON.stringify(this.#entries, null, 2), "utf8");
8010
8345
  }
8011
8346
  /**
@@ -8017,7 +8352,7 @@ var WorkspaceRegistry = class {
8017
8352
  for (const entry of this.#entries) {
8018
8353
  if (!isUnder(from, entry.path))
8019
8354
  continue;
8020
- const next = path20.join(to, path20.relative(from, entry.path));
8355
+ const next = path21.join(to, path21.relative(from, entry.path));
8021
8356
  moved.push({ from: entry.path, to: next });
8022
8357
  entry.path = next;
8023
8358
  }
@@ -8046,7 +8381,7 @@ var WorkspaceRegistry = class {
8046
8381
  return entry ? toInfo(entry) : void 0;
8047
8382
  }
8048
8383
  async open(rawPath) {
8049
- const absolute = path20.resolve(rawPath);
8384
+ const absolute = path21.resolve(rawPath);
8050
8385
  if (!existsSync4(absolute)) {
8051
8386
  throw new Error(`\u041A\u0430\u0442\u0430\u043B\u043E\u0433 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${absolute}`);
8052
8387
  }
@@ -8126,24 +8461,24 @@ var WorkspaceRegistry = class {
8126
8461
  async create(parentRaw, nameRaw, init) {
8127
8462
  const name = nameRaw.trim();
8128
8463
  requireName(name);
8129
- const parent = path20.resolve(parentRaw.trim());
8464
+ const parent = path21.resolve(parentRaw.trim());
8130
8465
  if (!existsSync4(parent)) {
8131
8466
  throw new Error(`\u041A\u0430\u0442\u0430\u043B\u043E\u0433 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${parent}`);
8132
8467
  }
8133
8468
  if (!statSync2(parent).isDirectory()) {
8134
8469
  throw new Error(`\u042D\u0442\u043E \u043D\u0435 \u043A\u0430\u0442\u0430\u043B\u043E\u0433: ${parent}`);
8135
8470
  }
8136
- const target = path20.join(parent, name);
8471
+ const target = path21.join(parent, name);
8137
8472
  if (existsSync4(target)) {
8138
8473
  throw new Error(`\u0423\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442: ${target} \u2014 \u043E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0435\u0433\u043E \u043A\u0430\u043A \u043F\u0440\u043E\u0435\u043A\u0442`);
8139
8474
  }
8140
8475
  await mkdir9(target);
8141
8476
  const warnings = [];
8142
8477
  if (init.claudeMd) {
8143
- await step(warnings, "CLAUDE.md", () => writeFile10(path20.join(target, "CLAUDE.md"), claudeMdStub(name), "utf8"));
8478
+ await step(warnings, "CLAUDE.md", () => writeFile10(path21.join(target, "CLAUDE.md"), claudeMdStub(name), "utf8"));
8144
8479
  }
8145
8480
  if (init.readme) {
8146
- await step(warnings, "README.md", () => writeFile10(path20.join(target, "README.md"), readmeStub(name), "utf8"));
8481
+ await step(warnings, "README.md", () => writeFile10(path21.join(target, "README.md"), readmeStub(name), "utf8"));
8147
8482
  }
8148
8483
  if (init.git) {
8149
8484
  await step(warnings, "git init", () => new GitRepo(target).init());
@@ -8228,8 +8563,8 @@ function toInfo(entry) {
8228
8563
  return {
8229
8564
  id: workspaceIdFromPath(absolute),
8230
8565
  path: absolute,
8231
- name: path20.basename(absolute) || absolute,
8232
- hasClaudeMd: existsSync4(path20.join(absolute, "CLAUDE.md")),
8566
+ name: path21.basename(absolute) || absolute,
8567
+ hasClaudeMd: existsSync4(path21.join(absolute, "CLAUDE.md")),
8233
8568
  ...archivedAt ? { archivedAt } : {}
8234
8569
  };
8235
8570
  }
@@ -8249,10 +8584,10 @@ function collapseDuplicates(entries) {
8249
8584
  return [...byId.values()];
8250
8585
  }
8251
8586
  function isUnder(parent, child) {
8252
- const norm = (value) => path20.resolve(value).replace(/[\\/]+$/, "").toLowerCase();
8587
+ const norm = (value) => path21.resolve(value).replace(/[\\/]+$/, "").toLowerCase();
8253
8588
  const p = norm(parent);
8254
8589
  const c = norm(child);
8255
- return c === p || c.startsWith(`${p}${path20.sep}`.toLowerCase()) || c.startsWith(`${p}/`);
8590
+ return c === p || c.startsWith(`${p}${path21.sep}`.toLowerCase()) || c.startsWith(`${p}/`);
8256
8591
  }
8257
8592
 
8258
8593
  // ../host/dist/site-proxy.js
@@ -8761,9 +9096,9 @@ var SiteProxies = class {
8761
9096
 
8762
9097
  // ../host/dist/video-studio.js
8763
9098
  import { execFile as execFile7, spawn as spawn4 } from "node:child_process";
8764
- import { readdir as readdir6, readFile as readFile11, stat as stat5 } from "node:fs/promises";
9099
+ import { readdir as readdir7, readFile as readFile12, stat as stat6 } from "node:fs/promises";
8765
9100
  import { createServer as createServer2 } from "node:net";
8766
- import path21 from "node:path";
9101
+ import path22 from "node:path";
8767
9102
  var VIDEO_EXT = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov", ".m4v", ".mkv", ".ogv", ".gif"]);
8768
9103
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", "_deps", "vendor", "third_party", ".git", ".next", ".nuxt", ".cache", ".turbo", ".venv", "__pycache__"]);
8769
9104
  var MAX_DEPTH = 8;
@@ -8781,19 +9116,19 @@ var ENTRY_CANDIDATES = [
8781
9116
  "remotion/index.tsx"
8782
9117
  ];
8783
9118
  function toRelative(root, file) {
8784
- return path21.relative(root, file).split(path21.sep).join("/");
9119
+ return path22.relative(root, file).split(path22.sep).join("/");
8785
9120
  }
8786
- async function exists3(file) {
8787
- return stat5(file).then(() => true, () => false);
9121
+ async function exists4(file) {
9122
+ return stat6(file).then(() => true, () => false);
8788
9123
  }
8789
9124
  async function remotionEntry(dir, pkg) {
8790
9125
  for (const script of Object.values(pkg.scripts ?? {})) {
8791
9126
  const match = /remotion\s+(?:studio|preview|render)\s+([^\s]+\.(?:tsx?|jsx?))/.exec(script);
8792
- if (match?.[1] && await exists3(path21.join(dir, match[1])))
9127
+ if (match?.[1] && await exists4(path22.join(dir, match[1])))
8793
9128
  return match[1].replace(/\\/g, "/");
8794
9129
  }
8795
9130
  for (const candidate of ENTRY_CANDIDATES) {
8796
- if (await exists3(path21.join(dir, candidate)))
9131
+ if (await exists4(path22.join(dir, candidate)))
8797
9132
  return candidate;
8798
9133
  }
8799
9134
  return null;
@@ -8809,7 +9144,7 @@ async function scanVideoCatalog(root) {
8809
9144
  return;
8810
9145
  let entries;
8811
9146
  try {
8812
- entries = await readdir6(dir, { withFileTypes: true });
9147
+ entries = await readdir7(dir, { withFileTypes: true });
8813
9148
  } catch {
8814
9149
  return;
8815
9150
  }
@@ -8818,7 +9153,7 @@ async function scanVideoCatalog(root) {
8818
9153
  truncated = true;
8819
9154
  return;
8820
9155
  }
8821
- const full = path21.join(dir, entry.name);
9156
+ const full = path22.join(dir, entry.name);
8822
9157
  if (entry.isDirectory()) {
8823
9158
  if (SKIP_DIRS.has(entry.name) || entry.name.startsWith("."))
8824
9159
  continue;
@@ -8827,31 +9162,31 @@ async function scanVideoCatalog(root) {
8827
9162
  }
8828
9163
  if (!entry.isFile())
8829
9164
  continue;
8830
- const ext = path21.extname(entry.name).toLowerCase();
9165
+ const ext = path22.extname(entry.name).toLowerCase();
8831
9166
  if (VIDEO_EXT.has(ext)) {
8832
- const info = await stat5(full).catch(() => null);
9167
+ const info = await stat6(full).catch(() => null);
8833
9168
  if (info)
8834
9169
  videos.push({ path: toRelative(root, full), size: info.size, mtime: Math.round(info.mtimeMs) });
8835
9170
  } else if (ext === ".html" || ext === ".htm") {
8836
- const info = await stat5(full).catch(() => null);
9171
+ const info = await stat6(full).catch(() => null);
8837
9172
  if (!info || info.size > MAX_ANIMATION_BYTES)
8838
9173
  continue;
8839
- const text = await readFile11(full, "utf8").catch(() => "");
9174
+ const text = await readFile12(full, "utf8").catch(() => "");
8840
9175
  if (ANIMATION_HINT.test(text)) {
8841
9176
  animations.push({ path: toRelative(root, full), size: info.size, mtime: Math.round(info.mtimeMs) });
8842
9177
  }
8843
9178
  } else if (entry.name === "package.json") {
8844
9179
  try {
8845
- const pkg = JSON.parse(await readFile11(full, "utf8"));
9180
+ const pkg = JSON.parse(await readFile12(full, "utf8"));
8846
9181
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
8847
9182
  if (!REMOTION_DEPS.some((name) => name in deps))
8848
9183
  continue;
8849
9184
  const entryFile = await remotionEntry(dir, pkg);
8850
9185
  remotion.push({
8851
9186
  root: toRelative(root, dir) || ".",
8852
- name: pkg.name ?? path21.basename(dir),
9187
+ name: pkg.name ?? path22.basename(dir),
8853
9188
  entry: entryFile,
8854
- installed: await exists3(path21.join(dir, "node_modules", "remotion"))
9189
+ installed: await exists4(path22.join(dir, "node_modules", "remotion"))
8855
9190
  });
8856
9191
  } catch {
8857
9192
  }
@@ -8891,9 +9226,9 @@ var RemotionStudios = class {
8891
9226
  this.#emit(running2.state);
8892
9227
  return;
8893
9228
  }
8894
- const dir = path21.resolve(workspacePath, root);
8895
- const relative = path21.relative(workspacePath, dir);
8896
- if (relative.startsWith("..") || path21.isAbsolute(relative))
9229
+ const dir = path22.resolve(workspacePath, root);
9230
+ const relative = path22.relative(workspacePath, dir);
9231
+ if (relative.startsWith("..") || path22.isAbsolute(relative))
8897
9232
  throw new Error("\u041F\u0440\u043E\u0435\u043A\u0442 Remotion \u0432\u043D\u0435 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430");
8898
9233
  const port2 = await freePort();
8899
9234
  const args = ["remotion", "studio", ...entry ? [entry] : [], "--port", String(port2)];
@@ -9016,7 +9351,7 @@ function runVersion(binary) {
9016
9351
  function ffmpegFallbackDirs() {
9017
9352
  if (process.platform === "win32") {
9018
9353
  const local = process.env.LOCALAPPDATA;
9019
- return local ? [path21.join(local, "Microsoft", "WinGet", "Links")] : [];
9354
+ return local ? [path22.join(local, "Microsoft", "WinGet", "Links")] : [];
9020
9355
  }
9021
9356
  return ["/opt/homebrew/bin", "/usr/local/bin", "/usr/bin"];
9022
9357
  }
@@ -9031,13 +9366,13 @@ async function probeFfmpeg() {
9031
9366
  }
9032
9367
  const exe = process.platform === "win32" ? "ffmpeg.exe" : "ffmpeg";
9033
9368
  for (const dir of ffmpegFallbackDirs()) {
9034
- const candidate = path21.join(dir, exe);
9035
- if (!await exists3(candidate))
9369
+ const candidate = path22.join(dir, exe);
9370
+ if (!await exists4(candidate))
9036
9371
  continue;
9037
9372
  const version2 = await runVersion(candidate);
9038
9373
  if (version2 === null)
9039
9374
  continue;
9040
- process.env.PATH = `${dir}${path21.delimiter}${process.env.PATH ?? ""}`;
9375
+ process.env.PATH = `${dir}${path22.delimiter}${process.env.PATH ?? ""}`;
9041
9376
  ffmpegKnown = { available: true, version: version2 };
9042
9377
  return ffmpegKnown;
9043
9378
  }
@@ -9045,18 +9380,18 @@ async function probeFfmpeg() {
9045
9380
  }
9046
9381
 
9047
9382
  // ../host/dist/archive.js
9048
- import { mkdir as mkdir10, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
9049
- import path22 from "node:path";
9383
+ import { mkdir as mkdir10, readFile as readFile13, writeFile as writeFile11 } from "node:fs/promises";
9384
+ import path23 from "node:path";
9050
9385
  var SessionArchive = class {
9051
9386
  #archived = /* @__PURE__ */ new Map();
9052
9387
  #restored = /* @__PURE__ */ new Map();
9053
9388
  #storePath;
9054
9389
  constructor(dataDir) {
9055
- this.#storePath = path22.join(dataDir, "session-archive.json");
9390
+ this.#storePath = path23.join(dataDir, "session-archive.json");
9056
9391
  }
9057
9392
  async load() {
9058
9393
  try {
9059
- const raw = await readFile12(this.#storePath, "utf8");
9394
+ const raw = await readFile13(this.#storePath, "utf8");
9060
9395
  const parsed = JSON.parse(raw);
9061
9396
  this.#archived = new Map(Object.entries(parsed.archived ?? {}).filter(([, r]) => isRecord2(r)));
9062
9397
  this.#restored = new Map(Object.entries(parsed.restored ?? {}).filter((entry) => typeof entry[1] === "number"));
@@ -9164,7 +9499,7 @@ var SessionArchive = class {
9164
9499
  archived: Object.fromEntries(this.#archived),
9165
9500
  restored: Object.fromEntries(this.#restored)
9166
9501
  };
9167
- await mkdir10(path22.dirname(this.#storePath), { recursive: true });
9502
+ await mkdir10(path23.dirname(this.#storePath), { recursive: true });
9168
9503
  await writeFile11(this.#storePath, JSON.stringify(file, null, 2), "utf8");
9169
9504
  }
9170
9505
  };
@@ -9173,8 +9508,8 @@ function isRecord2(value) {
9173
9508
  }
9174
9509
 
9175
9510
  // ../host/dist/pins.js
9176
- import { mkdir as mkdir11, readFile as readFile13, writeFile as writeFile12 } from "node:fs/promises";
9177
- import path23 from "node:path";
9511
+ import { mkdir as mkdir11, readFile as readFile14, writeFile as writeFile12 } from "node:fs/promises";
9512
+ import path24 from "node:path";
9178
9513
  var SessionPins = class {
9179
9514
  #pinned = /* @__PURE__ */ new Map();
9180
9515
  /**
@@ -9189,11 +9524,11 @@ var SessionPins = class {
9189
9524
  #moved = /* @__PURE__ */ new Map();
9190
9525
  #storePath;
9191
9526
  constructor(dataDir) {
9192
- this.#storePath = path23.join(dataDir, "session-pins.json");
9527
+ this.#storePath = path24.join(dataDir, "session-pins.json");
9193
9528
  }
9194
9529
  async load() {
9195
9530
  try {
9196
- const raw = await readFile13(this.#storePath, "utf8");
9531
+ const raw = await readFile14(this.#storePath, "utf8");
9197
9532
  const parsed = JSON.parse(raw);
9198
9533
  this.#pinned = new Map(Object.entries(parsed.pinned ?? {}).filter(([, r]) => isRecord3(r)));
9199
9534
  this.#moved = new Map(Object.entries(parsed.moved ?? {}).filter(([, to]) => typeof to === "string"));
@@ -9346,7 +9681,7 @@ var SessionPins = class {
9346
9681
  pinned: Object.fromEntries(this.#pinned),
9347
9682
  ...this.#moved.size > 0 ? { moved: Object.fromEntries(this.#moved) } : {}
9348
9683
  };
9349
- await mkdir11(path23.dirname(this.#storePath), { recursive: true });
9684
+ await mkdir11(path24.dirname(this.#storePath), { recursive: true });
9350
9685
  await writeFile12(this.#storePath, JSON.stringify(file, null, 2), "utf8");
9351
9686
  }
9352
9687
  };
@@ -9355,17 +9690,17 @@ function isRecord3(value) {
9355
9690
  }
9356
9691
 
9357
9692
  // ../host/dist/order.js
9358
- import { mkdir as mkdir12, readFile as readFile14, writeFile as writeFile13 } from "node:fs/promises";
9359
- import path24 from "node:path";
9693
+ import { mkdir as mkdir12, readFile as readFile15, writeFile as writeFile13 } from "node:fs/promises";
9694
+ import path25 from "node:path";
9360
9695
  var ListOrderStore = class {
9361
9696
  #order = emptyOrder();
9362
9697
  #storePath;
9363
9698
  constructor(dataDir) {
9364
- this.#storePath = path24.join(dataDir, "list-order.json");
9699
+ this.#storePath = path25.join(dataDir, "list-order.json");
9365
9700
  }
9366
9701
  async load() {
9367
9702
  try {
9368
- const raw = await readFile14(this.#storePath, "utf8");
9703
+ const raw = await readFile15(this.#storePath, "utf8");
9369
9704
  this.#order = sanitize(JSON.parse(raw));
9370
9705
  } catch {
9371
9706
  this.#order = emptyOrder();
@@ -9437,7 +9772,7 @@ var ListOrderStore = class {
9437
9772
  return changed;
9438
9773
  }
9439
9774
  async #persist() {
9440
- await mkdir12(path24.dirname(this.#storePath), { recursive: true });
9775
+ await mkdir12(path25.dirname(this.#storePath), { recursive: true });
9441
9776
  await writeFile13(this.#storePath, JSON.stringify(this.#order, null, 2), "utf8");
9442
9777
  }
9443
9778
  };
@@ -9467,8 +9802,8 @@ function sanitize(value) {
9467
9802
  }
9468
9803
 
9469
9804
  // ../host/dist/folders.js
9470
- import { mkdir as mkdir13, readFile as readFile15, writeFile as writeFile14 } from "node:fs/promises";
9471
- import path25 from "node:path";
9805
+ import { mkdir as mkdir13, readFile as readFile16, writeFile as writeFile14 } from "node:fs/promises";
9806
+ import path26 from "node:path";
9472
9807
  import { randomUUID as randomUUID7 } from "node:crypto";
9473
9808
  var COLOR_PATTERN = /^#[0-9a-f]{6}$/i;
9474
9809
  var Folders = class {
@@ -9480,11 +9815,11 @@ var Folders = class {
9480
9815
  #pinnedAssignments = /* @__PURE__ */ new Map();
9481
9816
  #storePath;
9482
9817
  constructor(dataDir) {
9483
- this.#storePath = path25.join(dataDir, "folders.json");
9818
+ this.#storePath = path26.join(dataDir, "folders.json");
9484
9819
  }
9485
9820
  async load() {
9486
9821
  try {
9487
- const raw = await readFile15(this.#storePath, "utf8");
9822
+ const raw = await readFile16(this.#storePath, "utf8");
9488
9823
  const parsed = JSON.parse(raw);
9489
9824
  this.#workspaceFolders = new Map(Object.entries(parsed.workspaceFolders ?? {}).filter(([, r]) => isWorkspaceFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
9490
9825
  this.#sessionFolders = new Map(Object.entries(parsed.sessionFolders ?? {}).filter(([, r]) => isSessionFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
@@ -9748,7 +10083,7 @@ var Folders = class {
9748
10083
  sessionAssignments: Object.fromEntries(this.#sessionAssignments),
9749
10084
  pinnedAssignments: Object.fromEntries(this.#pinnedAssignments)
9750
10085
  };
9751
- await mkdir13(path25.dirname(this.#storePath), { recursive: true });
10086
+ await mkdir13(path26.dirname(this.#storePath), { recursive: true });
9752
10087
  await writeFile14(this.#storePath, JSON.stringify(file, null, 2), "utf8");
9753
10088
  }
9754
10089
  };
@@ -9770,9 +10105,9 @@ function isPinnedFolder(value) {
9770
10105
  }
9771
10106
 
9772
10107
  // ../host/dist/app-settings.js
9773
- import { mkdir as mkdir14, readFile as readFile16, writeFile as writeFile15 } from "node:fs/promises";
10108
+ import { mkdir as mkdir14, readFile as readFile17, writeFile as writeFile15 } from "node:fs/promises";
9774
10109
  import { homedir as homedir6 } from "node:os";
9775
- import path26 from "node:path";
10110
+ import path27 from "node:path";
9776
10111
  var DEFAULT_AUTO_ARCHIVE_AFTER_MS = 2 * 24 * 60 * 60 * 1e3;
9777
10112
  var MIN_AUTO_ARCHIVE_AFTER_MS = 60 * 60 * 1e3;
9778
10113
  var DEFAULT_AUTO_STOP_AFTER_MS = 10 * 60 * 1e3;
@@ -9832,11 +10167,11 @@ var AppSettingsStore = class {
9832
10167
  #settings = { ...DEFAULT_APP_SETTINGS };
9833
10168
  #storePath;
9834
10169
  constructor(dataDir) {
9835
- this.#storePath = path26.join(dataDir, "app-settings.json");
10170
+ this.#storePath = path27.join(dataDir, "app-settings.json");
9836
10171
  }
9837
10172
  async load() {
9838
10173
  try {
9839
- const raw = await readFile16(this.#storePath, "utf8");
10174
+ const raw = await readFile17(this.#storePath, "utf8");
9840
10175
  this.#settings = sanitize2(JSON.parse(raw), DEFAULT_APP_SETTINGS);
9841
10176
  } catch {
9842
10177
  this.#settings = { ...DEFAULT_APP_SETTINGS };
@@ -9856,7 +10191,7 @@ var AppSettingsStore = class {
9856
10191
  async update(patch) {
9857
10192
  const next = sanitize2(patch, this.#settings);
9858
10193
  this.#settings = next;
9859
- await mkdir14(path26.dirname(this.#storePath), { recursive: true });
10194
+ await mkdir14(path27.dirname(this.#storePath), { recursive: true });
9860
10195
  await writeFile15(this.#storePath, JSON.stringify(next, null, 2), "utf8");
9861
10196
  return this.current;
9862
10197
  }
@@ -9931,7 +10266,7 @@ function sanitize2(value, fallback) {
9931
10266
  return result;
9932
10267
  }
9933
10268
  function claudeHome() {
9934
- return path26.join(homedir6(), ".claude");
10269
+ return path27.join(homedir6(), ".claude");
9935
10270
  }
9936
10271
  function writableRoots(mode, cwd, workspacePaths) {
9937
10272
  if (mode === "all")
@@ -9941,7 +10276,7 @@ function writableRoots(mode, cwd, workspacePaths) {
9941
10276
  return [...roots];
9942
10277
  for (const workspace of [cwd, ...workspacePaths]) {
9943
10278
  roots.add(workspace);
9944
- const parent = path26.dirname(workspace);
10279
+ const parent = path27.dirname(workspace);
9945
10280
  if (parent !== workspace)
9946
10281
  roots.add(parent);
9947
10282
  }
@@ -10055,19 +10390,19 @@ var PromptQueues = class extends EventEmitter6 {
10055
10390
  };
10056
10391
 
10057
10392
  // ../host/dist/handoff-store.js
10058
- import { mkdir as mkdir15, readFile as readFile17, readdir as readdir7, rm as rm5, writeFile as writeFile16 } from "node:fs/promises";
10059
- import path27 from "node:path";
10393
+ import { mkdir as mkdir15, readFile as readFile18, readdir as readdir8, rm as rm5, writeFile as writeFile16 } from "node:fs/promises";
10394
+ import path28 from "node:path";
10060
10395
  var HandoffStore = class {
10061
10396
  #dir;
10062
10397
  constructor(dataDir) {
10063
- this.#dir = path27.join(dataDir, "handoffs");
10398
+ this.#dir = path28.join(dataDir, "handoffs");
10064
10399
  }
10065
10400
  async get(sessionId) {
10066
10401
  const file = this.#file(sessionId);
10067
10402
  if (!file)
10068
10403
  return null;
10069
10404
  try {
10070
- const parsed = JSON.parse(await readFile17(file, "utf8"));
10405
+ const parsed = JSON.parse(await readFile18(file, "utf8"));
10071
10406
  return typeof parsed.text === "string" ? parsed : null;
10072
10407
  } catch {
10073
10408
  return null;
@@ -10088,7 +10423,7 @@ var HandoffStore = class {
10088
10423
  /** id всех сохранённых хэндоффов. */
10089
10424
  async list() {
10090
10425
  try {
10091
- return (await readdir7(this.#dir)).filter((name) => name.endsWith(".json")).map((name) => name.slice(0, -".json".length));
10426
+ return (await readdir8(this.#dir)).filter((name) => name.endsWith(".json")).map((name) => name.slice(0, -".json".length));
10092
10427
  } catch {
10093
10428
  return [];
10094
10429
  }
@@ -10097,7 +10432,7 @@ var HandoffStore = class {
10097
10432
  #file(sessionId) {
10098
10433
  if (!/^[\w-]{1,128}$/.test(sessionId))
10099
10434
  return null;
10100
- return path27.join(this.#dir, `${sessionId}.json`);
10435
+ return path28.join(this.#dir, `${sessionId}.json`);
10101
10436
  }
10102
10437
  };
10103
10438
  var SAME_WINDOW_MS = 5 * 6e4;
@@ -10106,11 +10441,11 @@ var LimitStopState = class {
10106
10441
  #fired = {};
10107
10442
  #storePath;
10108
10443
  constructor(dataDir) {
10109
- this.#storePath = path27.join(dataDir, "limit-stop.json");
10444
+ this.#storePath = path28.join(dataDir, "limit-stop.json");
10110
10445
  }
10111
10446
  async load() {
10112
10447
  try {
10113
- const parsed = JSON.parse(await readFile17(this.#storePath, "utf8"));
10448
+ const parsed = JSON.parse(await readFile18(this.#storePath, "utf8"));
10114
10449
  this.#fired = {};
10115
10450
  const read = (source) => {
10116
10451
  const out = {};
@@ -10154,7 +10489,7 @@ var LimitStopState = class {
10154
10489
  }
10155
10490
  async #mark(account, limit, until) {
10156
10491
  this.#fired[account] = { ...this.#fired[account], [limit]: until };
10157
- await mkdir15(path27.dirname(this.#storePath), { recursive: true });
10492
+ await mkdir15(path28.dirname(this.#storePath), { recursive: true });
10158
10493
  const { [MAIN_ACCOUNT_ID]: main = {}, ...others } = this.#fired;
10159
10494
  await writeFile16(this.#storePath, JSON.stringify({ ...main, ...others }, null, 2), "utf8");
10160
10495
  }
@@ -10208,7 +10543,7 @@ function journalHandoff(entries) {
10208
10543
  const prompts = [];
10209
10544
  let lastText = "";
10210
10545
  let todos = null;
10211
- const files = /* @__PURE__ */ new Set();
10546
+ const files2 = /* @__PURE__ */ new Set();
10212
10547
  for (const { event } of entries) {
10213
10548
  if (event.kind === "user.message") {
10214
10549
  if (!event.text.startsWith("[ccv]"))
@@ -10221,7 +10556,7 @@ function journalHandoff(entries) {
10221
10556
  if (EDIT_TOOLS.has(event.name)) {
10222
10557
  const target = input.file_path ?? input.notebook_path;
10223
10558
  if (typeof target === "string")
10224
- files.add(target);
10559
+ files2.add(target);
10225
10560
  } else if (event.name === "TodoWrite" && Array.isArray(input.todos)) {
10226
10561
  todos = input.todos.flatMap((todo) => {
10227
10562
  const t = todo;
@@ -10240,8 +10575,8 @@ function journalHandoff(entries) {
10240
10575
  const mark = (status) => status === "completed" ? "[x]" : status === "in_progress" ? "[~]" : "[ ]";
10241
10576
  sections.push("## \u0417\u0430\u0434\u0430\u0447\u0438\n\n" + todos.map((t) => `- ${mark(t.status)} ${t.content}`).join("\n"));
10242
10577
  }
10243
- if (files.size > 0) {
10244
- sections.push("## \u0422\u0440\u043E\u043D\u0443\u0442\u044B\u0435 \u0444\u0430\u0439\u043B\u044B\n\n" + [...files].map((f) => `- \`${f}\``).join("\n"));
10578
+ if (files2.size > 0) {
10579
+ sections.push("## \u0422\u0440\u043E\u043D\u0443\u0442\u044B\u0435 \u0444\u0430\u0439\u043B\u044B\n\n" + [...files2].map((f) => `- \`${f}\``).join("\n"));
10245
10580
  }
10246
10581
  if (lastText)
10247
10582
  sections.push("## \u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0439 \u043E\u0442\u0432\u0435\u0442 \u0430\u0433\u0435\u043D\u0442\u0430\n\n" + clip2(lastText, 4e3));
@@ -10260,9 +10595,9 @@ function capitalize(text) {
10260
10595
  }
10261
10596
 
10262
10597
  // ../host/dist/plugins.js
10263
- import { readFile as readFile18 } from "node:fs/promises";
10598
+ import { readFile as readFile19 } from "node:fs/promises";
10264
10599
  import { homedir as homedir7 } from "node:os";
10265
- import path28 from "node:path";
10600
+ import path29 from "node:path";
10266
10601
  var TIMEOUT_MS2 = 12e4;
10267
10602
  var SAFE_ARG = /^[A-Za-z0-9][A-Za-z0-9._@/-]*$/;
10268
10603
  var PluginCli = class {
@@ -10361,10 +10696,10 @@ async function readCatalog(markets, installed) {
10361
10696
  return lists.flat().sort((a, b) => a.name.localeCompare(b.name));
10362
10697
  }
10363
10698
  async function readMarketplace(market, installed) {
10364
- const root = market.installLocation || path28.join(homedir7(), ".claude", "plugins", "marketplaces", market.name);
10699
+ const root = market.installLocation || path29.join(homedir7(), ".claude", "plugins", "marketplaces", market.name);
10365
10700
  let manifest;
10366
10701
  try {
10367
- const text = await readFile18(path28.join(root, ".claude-plugin", "marketplace.json"), "utf8");
10702
+ const text = await readFile19(path29.join(root, ".claude-plugin", "marketplace.json"), "utf8");
10368
10703
  manifest = JSON.parse(text);
10369
10704
  } catch {
10370
10705
  return [];
@@ -10616,8 +10951,8 @@ function describe6(error) {
10616
10951
 
10617
10952
  // ../host/dist/relay-link.js
10618
10953
  import { EventEmitter as EventEmitter8 } from "node:events";
10619
- import { readFile as readFile19, writeFile as writeFile17, rm as rm6, mkdir as mkdir16 } from "node:fs/promises";
10620
- import path29 from "node:path";
10954
+ import { readFile as readFile20, writeFile as writeFile17, rm as rm6, mkdir as mkdir16 } from "node:fs/promises";
10955
+ import path30 from "node:path";
10621
10956
  import { hostname } from "node:os";
10622
10957
  import WebSocket from "ws";
10623
10958
 
@@ -10672,7 +11007,7 @@ var RelayLink = class extends EventEmitter8 {
10672
11007
  #log;
10673
11008
  constructor(options2) {
10674
11009
  super();
10675
- this.#file = path29.join(options2.dataDir, "relay.json");
11010
+ this.#file = path30.join(options2.dataDir, "relay.json");
10676
11011
  this.#defaultUrl = options2.defaultUrl.replace(/\/+$/, "");
10677
11012
  this.#log = options2.log ?? ((msg) => console.log(`[relay] ${msg}`));
10678
11013
  }
@@ -10753,7 +11088,7 @@ var RelayLink = class extends EventEmitter8 {
10753
11088
  }
10754
11089
  async #read() {
10755
11090
  try {
10756
- const raw = await readFile19(this.#file, "utf8");
11091
+ const raw = await readFile20(this.#file, "utf8");
10757
11092
  const parsed = JSON.parse(raw);
10758
11093
  if (typeof parsed !== "object" || parsed === null)
10759
11094
  return null;
@@ -10766,7 +11101,7 @@ var RelayLink = class extends EventEmitter8 {
10766
11101
  }
10767
11102
  }
10768
11103
  async #write(credentials) {
10769
- await mkdir16(path29.dirname(this.#file), { recursive: true });
11104
+ await mkdir16(path30.dirname(this.#file), { recursive: true });
10770
11105
  await writeFile17(this.#file, `${JSON.stringify(credentials, null, 2)}
10771
11106
  `, {
10772
11107
  encoding: "utf8",
@@ -11024,7 +11359,7 @@ function humanize(error) {
11024
11359
  // ../host/dist/terminal.js
11025
11360
  import { EventEmitter as EventEmitter9 } from "node:events";
11026
11361
  import { access as access2, constants as constants2 } from "node:fs/promises";
11027
- import path30 from "node:path";
11362
+ import path31 from "node:path";
11028
11363
  import { randomUUID as randomUUID9 } from "node:crypto";
11029
11364
  var SCROLLBACK_BYTES = 256 * 1024;
11030
11365
  var FLUSH_MS = 12;
@@ -11194,35 +11529,35 @@ async function defaultShell() {
11194
11529
  if (pwsh)
11195
11530
  return { file: pwsh, args: [], title: "pwsh" };
11196
11531
  const system = process.env.SystemRoot ?? "C:\\Windows";
11197
- const powershell = path30.join(system, "System32/WindowsPowerShell/v1.0/powershell.exe");
11198
- if (await exists4(powershell))
11532
+ const powershell = path31.join(system, "System32/WindowsPowerShell/v1.0/powershell.exe");
11533
+ if (await exists5(powershell))
11199
11534
  return { file: powershell, args: [], title: "powershell" };
11200
11535
  return { file: process.env.COMSPEC ?? "cmd.exe", args: [], title: "cmd" };
11201
11536
  }
11202
11537
  const shell = process.env.SHELL;
11203
- if (shell && await exists4(shell))
11204
- return { file: shell, args: [], title: path30.basename(shell) };
11205
- if (await exists4("/bin/bash"))
11538
+ if (shell && await exists5(shell))
11539
+ return { file: shell, args: [], title: path31.basename(shell) };
11540
+ if (await exists5("/bin/bash"))
11206
11541
  return { file: "/bin/bash", args: [], title: "bash" };
11207
11542
  return { file: "/bin/sh", args: [], title: "sh" };
11208
11543
  }
11209
11544
  async function findOnPath(name) {
11210
- const dirs = (process.env.PATH ?? "").split(path30.delimiter).filter(Boolean);
11545
+ const dirs = (process.env.PATH ?? "").split(path31.delimiter).filter(Boolean);
11211
11546
  for (const dir of dirs) {
11212
- const candidate = path30.join(dir, name);
11213
- if (await exists4(candidate))
11547
+ const candidate = path31.join(dir, name);
11548
+ if (await exists5(candidate))
11214
11549
  return candidate;
11215
11550
  }
11216
11551
  return null;
11217
11552
  }
11218
- function exists4(file) {
11553
+ function exists5(file) {
11219
11554
  return access2(file, constants2.X_OK).then(() => true, () => false);
11220
11555
  }
11221
11556
 
11222
11557
  // ../host/dist/mcp-credentials.js
11223
11558
  import { createHash } from "node:crypto";
11224
- import { readFile as readFile20, rename as rename2, writeFile as writeFile18 } from "node:fs/promises";
11225
- import path31 from "node:path";
11559
+ import { readFile as readFile21, rename as rename2, writeFile as writeFile18 } from "node:fs/promises";
11560
+ import path32 from "node:path";
11226
11561
  function mcpOAuthKey(name, config) {
11227
11562
  if (!config || typeof config !== "object")
11228
11563
  return null;
@@ -11236,7 +11571,7 @@ function mcpOAuthKey(name, config) {
11236
11571
  async function readMcpCredentialRecords(configDir, name) {
11237
11572
  let parsed;
11238
11573
  try {
11239
- parsed = JSON.parse(await readFile20(path31.join(configDir, ".credentials.json"), "utf8"));
11574
+ parsed = JSON.parse(await readFile21(path32.join(configDir, ".credentials.json"), "utf8"));
11240
11575
  } catch {
11241
11576
  return null;
11242
11577
  }
@@ -11303,11 +11638,11 @@ function diagnoseSignIn(records, expectedKey) {
11303
11638
  };
11304
11639
  }
11305
11640
  function registryPath(configDir) {
11306
- return path31.join(configDir, "plugins", "installed_plugins.json");
11641
+ return path32.join(configDir, "plugins", "installed_plugins.json");
11307
11642
  }
11308
11643
  async function readRegistry(configDir) {
11309
11644
  try {
11310
- const raw = JSON.parse(await readFile20(registryPath(configDir), "utf8"));
11645
+ const raw = JSON.parse(await readFile21(registryPath(configDir), "utf8"));
11311
11646
  const plugins = raw.plugins;
11312
11647
  if (!plugins || typeof plugins !== "object")
11313
11648
  return null;
@@ -11351,10 +11686,10 @@ async function keepSinglePluginRecord(configDir, id) {
11351
11686
  }
11352
11687
 
11353
11688
  // ../host/dist/mcp-config.js
11354
- import { readFile as readFile21, writeFile as writeFile19, mkdir as mkdir17 } from "node:fs/promises";
11355
- import path32 from "node:path";
11689
+ import { readFile as readFile22, writeFile as writeFile19, mkdir as mkdir17 } from "node:fs/promises";
11690
+ import path33 from "node:path";
11356
11691
  var MCP_FILE = ".mcp.json";
11357
- var LOCAL_SETTINGS2 = path32.join(".claude", "settings.local.json");
11692
+ var LOCAL_SETTINGS2 = path33.join(".claude", "settings.local.json");
11358
11693
  var queues = /* @__PURE__ */ new Map();
11359
11694
  function serialize(cwd, work) {
11360
11695
  const previous = queues.get(cwd) ?? Promise.resolve();
@@ -11363,7 +11698,7 @@ function serialize(cwd, work) {
11363
11698
  return next;
11364
11699
  }
11365
11700
  async function readProjectServers(cwd) {
11366
- const file = await readJson(path32.join(cwd, MCP_FILE));
11701
+ const file = await readJson(path33.join(cwd, MCP_FILE));
11367
11702
  const servers = file?.mcpServers;
11368
11703
  if (!servers || typeof servers !== "object")
11369
11704
  return {};
@@ -11371,23 +11706,23 @@ async function readProjectServers(cwd) {
11371
11706
  }
11372
11707
  function addProjectServer(cwd, name, config) {
11373
11708
  return serialize(cwd, async () => {
11374
- const file = await readJson(path32.join(cwd, MCP_FILE)) ?? {};
11709
+ const file = await readJson(path33.join(cwd, MCP_FILE)) ?? {};
11375
11710
  const servers = file.mcpServers ?? {};
11376
11711
  servers[name] = config;
11377
11712
  file.mcpServers = servers;
11378
- await writeJson(path32.join(cwd, MCP_FILE), file);
11713
+ await writeJson(path33.join(cwd, MCP_FILE), file);
11379
11714
  await approve(cwd, name);
11380
11715
  });
11381
11716
  }
11382
11717
  function removeProjectServer(cwd, name) {
11383
11718
  return serialize(cwd, async () => {
11384
- const file = await readJson(path32.join(cwd, MCP_FILE));
11719
+ const file = await readJson(path33.join(cwd, MCP_FILE));
11385
11720
  const servers = file?.mcpServers;
11386
11721
  if (!servers || !(name in servers))
11387
11722
  return false;
11388
11723
  delete servers[name];
11389
- await writeJson(path32.join(cwd, MCP_FILE), file);
11390
- const settingsPath = path32.join(cwd, LOCAL_SETTINGS2);
11724
+ await writeJson(path33.join(cwd, MCP_FILE), file);
11725
+ const settingsPath = path33.join(cwd, LOCAL_SETTINGS2);
11391
11726
  const settings = await readJson(settingsPath);
11392
11727
  const enabled = settings?.enabledMcpjsonServers;
11393
11728
  if (settings && Array.isArray(enabled) && enabled.includes(name)) {
@@ -11398,7 +11733,7 @@ function removeProjectServer(cwd, name) {
11398
11733
  });
11399
11734
  }
11400
11735
  async function approve(cwd, name) {
11401
- const file = path32.join(cwd, LOCAL_SETTINGS2);
11736
+ const file = path33.join(cwd, LOCAL_SETTINGS2);
11402
11737
  const settings = await readJson(file) ?? {};
11403
11738
  const enabled = Array.isArray(settings.enabledMcpjsonServers) ? settings.enabledMcpjsonServers : [];
11404
11739
  if (!enabled.includes(name))
@@ -11437,20 +11772,20 @@ function describeConfig(config) {
11437
11772
  }
11438
11773
  async function readJson(file) {
11439
11774
  try {
11440
- const raw = await readFile21(file, "utf8");
11775
+ const raw = await readFile22(file, "utf8");
11441
11776
  const parsed = JSON.parse(raw);
11442
11777
  return parsed && typeof parsed === "object" ? parsed : null;
11443
11778
  } catch (error) {
11444
11779
  if (error.code === "ENOENT")
11445
11780
  return null;
11446
11781
  if (error instanceof SyntaxError) {
11447
- throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C ${path32.basename(file)}: ${error.message}`);
11782
+ throw new Error(`\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C ${path33.basename(file)}: ${error.message}`);
11448
11783
  }
11449
11784
  throw error;
11450
11785
  }
11451
11786
  }
11452
11787
  async function writeJson(file, data) {
11453
- await mkdir17(path32.dirname(file), { recursive: true });
11788
+ await mkdir17(path33.dirname(file), { recursive: true });
11454
11789
  await writeFile19(file, `${JSON.stringify(data, null, 2)}
11455
11790
  `, "utf8");
11456
11791
  }
@@ -11683,7 +12018,7 @@ var HostServer = class {
11683
12018
  const status = await new AuthCli(configDir).status().catch(() => null);
11684
12019
  if (!status?.loggedIn)
11685
12020
  return null;
11686
- const used = this.#accounts.all.find((a) => path33.resolve(this.#accounts.effectiveDir(a.id)).toLowerCase() === configDir.toLowerCase());
12021
+ const used = this.#accounts.all.find((a) => path34.resolve(this.#accounts.effectiveDir(a.id)).toLowerCase() === configDir.toLowerCase());
11687
12022
  return {
11688
12023
  configDir,
11689
12024
  email: status.email,
@@ -12327,6 +12662,24 @@ var HostServer = class {
12327
12662
  this.#approveAfterLimit(frame.sessionId);
12328
12663
  await this.#requireSession(frame.sessionId).editPrompt(frame.userIndex, frame.text, frame.images, frame.attachments, frame.rewindFiles === true);
12329
12664
  return;
12665
+ case "prompt.retry": {
12666
+ if (!frame.force)
12667
+ this.#refuseDuringMcpAuth(frame.sessionId);
12668
+ const session = this.#requireSession(frame.sessionId);
12669
+ if (!(session instanceof ClaudeSession))
12670
+ throw new Error("\u041F\u043E\u0432\u0442\u043E\u0440 \u043E\u0442\u0432\u0435\u0442\u0430 \u0435\u0441\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0443 \u0441\u0435\u0441\u0441\u0438\u0439 Claude.");
12671
+ await networkGuard.ensureFresh();
12672
+ this.#approveAfterLimit(frame.sessionId);
12673
+ await session.retryLastPrompt();
12674
+ return;
12675
+ }
12676
+ case "session.switchBranch": {
12677
+ const session = this.#requireSession(frame.sessionId);
12678
+ if (!(session instanceof ClaudeSession))
12679
+ throw new Error("\u0412\u0435\u0440\u0441\u0438\u0438 \u0440\u0435\u043F\u043B\u0438\u043A \u0435\u0441\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0443 \u0441\u0435\u0441\u0441\u0438\u0439 Claude.");
12680
+ await session.switchBranch(frame.userIndex, frame.version);
12681
+ return;
12682
+ }
12330
12683
  case "session.rewindFiles": {
12331
12684
  const session = this.#requireSession(frame.sessionId);
12332
12685
  const reply = {
@@ -12560,11 +12913,11 @@ var HostServer = class {
12560
12913
  await this.#gitNetwork(frame.workspaceId, "\u041F\u0443\u0431\u043B\u0438\u043A\u0443\u0435\u043C \u043D\u0430 GitHub\u2026", (repo) => this.#publish(repo, frame));
12561
12914
  return;
12562
12915
  case "git.files": {
12563
- const { files, truncated } = await this.#git(frame.workspaceId).candidates();
12916
+ const { files: files2, truncated } = await this.#git(frame.workspaceId).candidates();
12564
12917
  this.#send(socket, {
12565
12918
  type: "git.files",
12566
12919
  workspaceId: frame.workspaceId,
12567
- files,
12920
+ files: files2,
12568
12921
  truncated
12569
12922
  });
12570
12923
  return;
@@ -12710,10 +13063,10 @@ var HostServer = class {
12710
13063
  return;
12711
13064
  }
12712
13065
  case "fs.write": {
12713
- const files = this.#files(frame.workspaceId);
13066
+ const files2 = this.#files(frame.workspaceId);
12714
13067
  let saved;
12715
13068
  try {
12716
- saved = await files.write(frame.path, frame.content, frame.eol, frame.encoding ?? "utf8", frame.baseMtime, frame.force === true);
13069
+ saved = await files2.write(frame.path, frame.content, frame.eol, frame.encoding ?? "utf8", frame.baseMtime, frame.force === true);
12717
13070
  } catch (error) {
12718
13071
  this.#fsFailed(frame.workspaceId, frame.path, error);
12719
13072
  return;
@@ -12786,15 +13139,15 @@ var HostServer = class {
12786
13139
  case "fs.create":
12787
13140
  case "fs.delete":
12788
13141
  case "fs.rename": {
12789
- const files = this.#files(frame.workspaceId);
13142
+ const files2 = this.#files(frame.workspaceId);
12790
13143
  const done = frame.type === "fs.create" ? `\u0421\u043E\u0437\u0434\u0430\u043D${frame.kind === "dir" ? " \u043A\u0430\u0442\u0430\u043B\u043E\u0433" : " \u0444\u0430\u0439\u043B"} ${normalize(frame.path)}` : frame.type === "fs.delete" ? `\u0423\u0434\u0430\u043B\u0435\u043D\u043E: ${normalize(frame.path)}` : `\u041F\u0435\u0440\u0435\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u043E \u0432 ${normalize(frame.to)}`;
12791
13144
  try {
12792
13145
  if (frame.type === "fs.create")
12793
- await files.create(frame.path, frame.kind);
13146
+ await files2.create(frame.path, frame.kind);
12794
13147
  else if (frame.type === "fs.delete")
12795
- await files.remove(frame.path);
13148
+ await files2.remove(frame.path);
12796
13149
  else
12797
- await files.rename(frame.path, frame.to);
13150
+ await files2.rename(frame.path, frame.to);
12798
13151
  } catch (error) {
12799
13152
  this.#fsFailed(frame.workspaceId, frame.path, error);
12800
13153
  return;
@@ -14265,12 +14618,12 @@ var HostServer = class {
14265
14618
  }
14266
14619
  async #sendMemoryState(socket, workspaceId, accountId) {
14267
14620
  const account = this.#accounts.find(accountId) ?? this.#accounts.find(void 0);
14268
- const files = await this.#memory(workspaceId, account?.id).list();
14621
+ const files2 = await this.#memory(workspaceId, account?.id).list();
14269
14622
  this.#send(socket, {
14270
14623
  type: "memory.state",
14271
14624
  workspaceId,
14272
14625
  accountId: account?.id ?? MAIN_ACCOUNT_ID,
14273
- files
14626
+ files: files2
14274
14627
  });
14275
14628
  }
14276
14629
  #files(workspaceId) {
@@ -14457,8 +14810,8 @@ var HostServer = class {
14457
14810
  return;
14458
14811
  }
14459
14812
  const url2 = new URL(req.url ?? "/", "http://localhost");
14460
- const requested = path33.join(webRoot, path33.normalize(url2.pathname));
14461
- const target = requested.startsWith(webRoot) && existsSync5(requested) && statSync3(requested).isFile() ? requested : path33.join(webRoot, "index.html");
14813
+ const requested = path34.join(webRoot, path34.normalize(url2.pathname));
14814
+ const target = requested.startsWith(webRoot) && existsSync5(requested) && statSync3(requested).isFile() ? requested : path34.join(webRoot, "index.html");
14462
14815
  if (!existsSync5(target)) {
14463
14816
  res.writeHead(404).end("not found");
14464
14817
  return;
@@ -14484,7 +14837,7 @@ function contentType(file) {
14484
14837
  ".svg": "image/svg+xml",
14485
14838
  ".woff2": "font/woff2"
14486
14839
  };
14487
- return types[path33.extname(file)] ?? "application/octet-stream";
14840
+ return types[path34.extname(file)] ?? "application/octet-stream";
14488
14841
  }
14489
14842
  var PROVIDER_LABEL = {
14490
14843
  claude: "Claude",
@@ -14519,8 +14872,8 @@ function antigravitySummary(record, provider = "antigravity") {
14519
14872
  }
14520
14873
 
14521
14874
  // dist/ccv.js
14522
- var HERE = path34.dirname(fileURLToPath(import.meta.url));
14523
- var PACKAGE_ROOT = path34.resolve(HERE, "..");
14875
+ var HERE = path35.dirname(fileURLToPath(import.meta.url));
14876
+ var PACKAGE_ROOT = path35.resolve(HERE, "..");
14524
14877
  var USAGE = `ccv \u2014 Claude Code Visual: \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0445\u043E\u0441\u0442 Claude Code \u0441 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043E\u043C \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.
14525
14878
 
14526
14879
  \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:
@@ -14587,7 +14940,7 @@ var server = new HostServer({
14587
14940
  dataDir: defaults.dataDir,
14588
14941
  // UI лежит в пакете рядом с бандлом — это и есть разница между установленной
14589
14942
  // утилитой и запуском из репозитория, где сборка живёт в `apps/web/dist`.
14590
- webRoot: process.env.CCV_WEB_ROOT ?? path34.join(PACKAGE_ROOT, "web"),
14943
+ webRoot: process.env.CCV_WEB_ROOT ?? path35.join(PACKAGE_ROOT, "web"),
14591
14944
  version,
14592
14945
  relayUrl: defaults.relayUrl
14593
14946
  });
@@ -14616,7 +14969,7 @@ for (const signal of ["SIGINT", "SIGTERM"]) {
14616
14969
  }
14617
14970
  async function packageVersion() {
14618
14971
  try {
14619
- const text = await readFile22(path34.join(PACKAGE_ROOT, "package.json"), "utf8");
14972
+ const text = await readFile23(path35.join(PACKAGE_ROOT, "package.json"), "utf8");
14620
14973
  return JSON.parse(text).version ?? "0.0.0";
14621
14974
  } catch {
14622
14975
  return "0.0.0";