@i14ks/ccv 0.49.0 → 0.51.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 (85) hide show
  1. package/bundle/ccv.mjs +666 -263
  2. package/package.json +1 -1
  3. package/web/assets/MarkdownTextEditor-JS5gfhvn.js +60 -0
  4. package/web/assets/{abnfDiagram-S7VZAUFO-C6rudl3G.js → abnfDiagram-S7VZAUFO-NiQLnUk4.js} +1 -1
  5. package/web/assets/{architectureDiagram-YGSQEFNW-Chxd_j3W.js → architectureDiagram-YGSQEFNW-CacJXhkP.js} +1 -1
  6. package/web/assets/{blockDiagram-APKKGZFW-CX9y-KCE.js → blockDiagram-APKKGZFW-CQmfctFs.js} +1 -1
  7. package/web/assets/{c4Diagram-KJ2TOQU5-SjVMVZLW.js → c4Diagram-KJ2TOQU5-BvlnxWev.js} +1 -1
  8. package/web/assets/{chunk-2Q5K7J3B-D4joGaMo.js → chunk-2Q5K7J3B-Cgc58TSE.js} +1 -1
  9. package/web/assets/{chunk-5VM5RSS4-Bx6fCaId.js → chunk-5VM5RSS4-C1bWQfyK.js} +1 -1
  10. package/web/assets/{chunk-HFQBQIA3-GmYpzkM2.js → chunk-HFQBQIA3-C7a1_mVn.js} +1 -1
  11. package/web/assets/{chunk-JWPE2WC7-YRiv3Zg6.js → chunk-JWPE2WC7-C18blVa-.js} +1 -1
  12. package/web/assets/{chunk-KQLB2F66-DTEa-Nv0.js → chunk-KQLB2F66-CI40AH6D.js} +2 -2
  13. package/web/assets/{chunk-KS47KZWR-DLIoy_uq.js → chunk-KS47KZWR-DqUN9A3o.js} +1 -1
  14. package/web/assets/{chunk-OY52VR5R-d0ASvNW1.js → chunk-OY52VR5R-NLJNl2SH.js} +1 -1
  15. package/web/assets/{chunk-TU62E6Q5-Di5_cwgX.js → chunk-TU62E6Q5-Dfc2QrQc.js} +1 -1
  16. package/web/assets/{chunk-XXDRQBXY-B_JAqY4C.js → chunk-XXDRQBXY-BbvDRTY2.js} +1 -1
  17. package/web/assets/{classDiagram-v2-L25IHNXF-DB3TN6Gr.js → classDiagram-v2-L25IHNXF-C70BAnHO.js} +1 -1
  18. package/web/assets/{codemirror-C1bYpAmx.js → codemirror-C9-rbUS5.js} +1 -1
  19. package/web/assets/{codemirrorImages-MC8VsJDU.js → codemirrorImages-Ddzgh4gP.js} +1 -1
  20. package/web/assets/{cose-bilkent-JH36ORCC-CSfL8Y8l.js → cose-bilkent-JH36ORCC-BpSbzUvj.js} +1 -1
  21. package/web/assets/{cynefin-EF2NZ3EQ-Dav5gSV6.js → cynefin-EF2NZ3EQ-BOIqStKg.js} +1 -1
  22. package/web/assets/{cynefinDiagram-L36ESFBY-D7UuGAHO.js → cynefinDiagram-L36ESFBY-DfDb4Bbh.js} +1 -1
  23. package/web/assets/{dagre-SPEB5RXH-C45VrWYv.js → dagre-SPEB5RXH-B21shBDF.js} +1 -1
  24. package/web/assets/{diagram-3B7GL73J-DCOSOr3V.js → diagram-3B7GL73J-D5GyZahr.js} +1 -1
  25. package/web/assets/{diagram-DNEMPZML-DYbsw7Q0.js → diagram-DNEMPZML-l_jbAuYI.js} +1 -1
  26. package/web/assets/{diagram-L3MUGCDN-Cf1adeNh.js → diagram-L3MUGCDN-Dxg4m10Z.js} +1 -1
  27. package/web/assets/{diagram-LA4NIPWU-dsheOSjV.js → diagram-LA4NIPWU-Cel9qbbE.js} +1 -1
  28. package/web/assets/{diagram-MHCOC4E2-D8QLy-br.js → diagram-MHCOC4E2-BiOEXYq3.js} +1 -1
  29. package/web/assets/{diagram-XPFHEONP-BIwbvAS3.js → diagram-XPFHEONP-BvK5PJyb.js} +1 -1
  30. package/web/assets/{ebnfDiagram-UZSYDL2S-Dfno1buw.js → ebnfDiagram-UZSYDL2S-6zLeUUGj.js} +1 -1
  31. package/web/assets/{elk-XV6XMXQE-CPTpYM05.js → elk-XV6XMXQE-vHNWsDBP.js} +1 -1
  32. package/web/assets/{erDiagram-EYBAPDEH-DIIeNZoS.js → erDiagram-EYBAPDEH-B_0_-AXN.js} +1 -1
  33. package/web/assets/{flowDiagram-MALGAFMO-Dv_SGxd_.js → flowDiagram-MALGAFMO-DHbDByLY.js} +1 -1
  34. package/web/assets/{ganttDiagram-23REXITY-BVj7_X-p.js → ganttDiagram-23REXITY-B80CTXbo.js} +1 -1
  35. package/web/assets/{gitGraphDiagram-STJD7YCW-Dida84g9.js → gitGraphDiagram-STJD7YCW-CkacpGe7.js} +1 -1
  36. package/web/assets/{index-3swuCbjs.js → index-92k3_wJu.js} +1 -1
  37. package/web/assets/{index-D19W3mPS.js → index-B36m2pd4.js} +1 -1
  38. package/web/assets/{index-CCcMvPPM.js → index-BPYt9SZ5.js} +1 -1
  39. package/web/assets/{index-DPlaluO4.js → index-BWlmCdoh.js} +1 -1
  40. package/web/assets/{index-DObAlG3d.js → index-BiVTsO6O.js} +1 -1
  41. package/web/assets/{index-BXS87hWE.js → index-C-Hx4d-f.js} +1 -1
  42. package/web/assets/{index-D3KJ44QL.js → index-C8qdu2Ys.js} +1 -1
  43. package/web/assets/{index-CrIvEt3W.js → index-CIuxUzk9.js} +1 -1
  44. package/web/assets/{index-DqN3Yjn2.js → index-CVL9Nmm_.js} +1 -1
  45. package/web/assets/{index-DEQgVEIp.js → index-C_2wUJRx.js} +1 -1
  46. package/web/assets/{index-6VtLhZfr.js → index-Cm5B9oUk.js} +1 -1
  47. package/web/assets/index-CnDNc_gM.js +172 -0
  48. package/web/assets/{index-rnuYD-5b.js → index-CuT0yXRF.js} +1 -1
  49. package/web/assets/{index-BrzBT7tX.js → index-DC0nz24L.js} +1 -1
  50. package/web/assets/{index-Cec-XFvp.js → index-DSvz1p_2.js} +1 -1
  51. package/web/assets/index-DmzLc_Io.css +1 -0
  52. package/web/assets/{index-QlFQPxZP.js → index-Ea4Oi4uX.js} +1 -1
  53. package/web/assets/{index-D2m7bnfK.js → index-FQtowISJ.js} +1 -1
  54. package/web/assets/{index-6ji44meo.js → index-g768jR3q.js} +1 -1
  55. package/web/assets/{index-CSlP1EYA.js → index-kN0c62Qc.js} +1 -1
  56. package/web/assets/{index-BBJdr5JT.js → index-pc3Dhu5R.js} +1 -1
  57. package/web/assets/{infoDiagram-KBXO4MBG-TDow-d_4.js → infoDiagram-KBXO4MBG-CU1EkG0-.js} +1 -1
  58. package/web/assets/{ishikawaDiagram-M35NCXHK-CLbrSa1y.js → ishikawaDiagram-M35NCXHK-BZmugbzW.js} +1 -1
  59. package/web/assets/{journeyDiagram-OPLOXDXO-p3kvT_Eo.js → journeyDiagram-OPLOXDXO-DDidfWhw.js} +1 -1
  60. package/web/assets/{kanban-definition-BZKZHSQY-pNNn3NfD.js → kanban-definition-BZKZHSQY-DT8uvOWy.js} +1 -1
  61. package/web/assets/{mermaid.core-DjpUkD1z.js → mermaid.core-L3hD6CUN.js} +4 -4
  62. package/web/assets/{mindmap-definition-I2QAS2VK-BqPuqnfQ.js → mindmap-definition-I2QAS2VK-CglnosNO.js} +1 -1
  63. package/web/assets/{pegDiagram-FD4XPPHP-BeVWcZMC.js → pegDiagram-FD4XPPHP-Riow5Koi.js} +1 -1
  64. package/web/assets/{pieDiagram-J4AKIIQI-DqXZUVHj.js → pieDiagram-J4AKIIQI-CK0itELu.js} +1 -1
  65. package/web/assets/{quadrantDiagram-XTYBLID2-CUwRsDjZ.js → quadrantDiagram-XTYBLID2-a0cZCRAm.js} +1 -1
  66. package/web/assets/{railroadDiagram-MRQ6NCDL-BzrKPnp_.js → railroadDiagram-MRQ6NCDL-C-JOz99A.js} +1 -1
  67. package/web/assets/{requirementDiagram-Y7LWUY3S-DxRAPAAb.js → requirementDiagram-Y7LWUY3S-C6ek4quK.js} +1 -1
  68. package/web/assets/{sankeyDiagram-WGJFYUXA-Bf96cqWy.js → sankeyDiagram-WGJFYUXA-CV0CpeMd.js} +1 -1
  69. package/web/assets/{sequenceDiagram-5NDRBG5M-COUQWvkl.js → sequenceDiagram-5NDRBG5M-UAB57p0q.js} +1 -1
  70. package/web/assets/{sizeCapture-INFHLROL-CnDTd2qA.js → sizeCapture-INFHLROL-CEP45PjG.js} +1 -1
  71. package/web/assets/{stateDiagram-v2-FJ4FJNEA-Be14yvtF.js → stateDiagram-v2-FJ4FJNEA-DtxyTD99.js} +1 -1
  72. package/web/assets/{swimlanes-UMQ2AFYF-BgwhOIJf.js → swimlanes-UMQ2AFYF-D0-FWl64.js} +1 -1
  73. package/web/assets/swimlanesDiagram-OMPLPG4O-B5BeOS4_.js +8 -0
  74. package/web/assets/{timeline-definition-SEUHKTQE-DrzXj456.js → timeline-definition-SEUHKTQE-OQG2waQW.js} +1 -1
  75. package/web/assets/{usecaseDiagram-AFA6YXN4-Ptp1a8ek.js → usecaseDiagram-AFA6YXN4-DxTFx1Wc.js} +1 -1
  76. package/web/assets/{vennDiagram-NNMJR3RB-84pzw-p8.js → vennDiagram-NNMJR3RB-1Uym6RqY.js} +1 -1
  77. package/web/assets/{wardleyDiagram-S7YFUSEH-GlcuH79W.js → wardleyDiagram-S7YFUSEH-CqeyKfQR.js} +1 -1
  78. package/web/assets/{xychartDiagram-GGNKY7IX-CyOLgTKD.js → xychartDiagram-GGNKY7IX-CGvFnidy.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/MarkdownTextEditor-Dt2Iu87I.js +0 -60
  83. package/web/assets/index-BlgH7sOz.css +0 -1
  84. package/web/assets/index-DPTOk3jB.js +0 -166
  85. package/web/assets/swimlanesDiagram-OMPLPG4O-BvICHG_z.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
@@ -8760,10 +9095,10 @@ var SiteProxies = class {
8760
9095
  };
8761
9096
 
8762
9097
  // ../host/dist/video-studio.js
8763
- import { spawn as spawn4 } from "node:child_process";
8764
- import { readdir as readdir6, readFile as readFile11, stat as stat5 } from "node:fs/promises";
9098
+ import { execFile as execFile7, spawn as spawn4 } from "node:child_process";
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)];
@@ -8996,20 +9331,67 @@ var RemotionStudios = class {
8996
9331
  this.#fail(studio, "Remotion Studio \u043D\u0435 \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B\u0430\u0441\u044C \u0437\u0430 3 \u043C\u0438\u043D\u0443\u0442\u044B");
8997
9332
  }
8998
9333
  };
9334
+ function ffmpegInstallCommand() {
9335
+ if (process.platform === "win32")
9336
+ return "winget install --id Gyan.FFmpeg -e";
9337
+ if (process.platform === "darwin")
9338
+ return "brew install ffmpeg";
9339
+ return "sudo apt install -y ffmpeg";
9340
+ }
9341
+ function runVersion(binary) {
9342
+ return new Promise((resolve) => {
9343
+ execFile7(binary, ["-version"], { timeout: 5e3, windowsHide: true }, (error, stdout) => {
9344
+ if (error)
9345
+ return resolve(null);
9346
+ const first = String(stdout).split(/\r?\n/)[0] ?? "";
9347
+ resolve(/^ffmpeg version\s+(\S+)/.exec(first)?.[1] ?? first.trim());
9348
+ });
9349
+ });
9350
+ }
9351
+ function ffmpegFallbackDirs() {
9352
+ if (process.platform === "win32") {
9353
+ const local = process.env.LOCALAPPDATA;
9354
+ return local ? [path22.join(local, "Microsoft", "WinGet", "Links")] : [];
9355
+ }
9356
+ return ["/opt/homebrew/bin", "/usr/local/bin", "/usr/bin"];
9357
+ }
9358
+ var ffmpegKnown = null;
9359
+ async function probeFfmpeg() {
9360
+ if (ffmpegKnown)
9361
+ return ffmpegKnown;
9362
+ const onPath = await runVersion("ffmpeg");
9363
+ if (onPath !== null) {
9364
+ ffmpegKnown = { available: true, version: onPath };
9365
+ return ffmpegKnown;
9366
+ }
9367
+ const exe = process.platform === "win32" ? "ffmpeg.exe" : "ffmpeg";
9368
+ for (const dir of ffmpegFallbackDirs()) {
9369
+ const candidate = path22.join(dir, exe);
9370
+ if (!await exists4(candidate))
9371
+ continue;
9372
+ const version2 = await runVersion(candidate);
9373
+ if (version2 === null)
9374
+ continue;
9375
+ process.env.PATH = `${dir}${path22.delimiter}${process.env.PATH ?? ""}`;
9376
+ ffmpegKnown = { available: true, version: version2 };
9377
+ return ffmpegKnown;
9378
+ }
9379
+ return { available: false, install: ffmpegInstallCommand() };
9380
+ }
8999
9381
 
9000
9382
  // ../host/dist/archive.js
9001
- import { mkdir as mkdir10, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
9002
- 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";
9003
9385
  var SessionArchive = class {
9004
9386
  #archived = /* @__PURE__ */ new Map();
9005
9387
  #restored = /* @__PURE__ */ new Map();
9006
9388
  #storePath;
9007
9389
  constructor(dataDir) {
9008
- this.#storePath = path22.join(dataDir, "session-archive.json");
9390
+ this.#storePath = path23.join(dataDir, "session-archive.json");
9009
9391
  }
9010
9392
  async load() {
9011
9393
  try {
9012
- const raw = await readFile12(this.#storePath, "utf8");
9394
+ const raw = await readFile13(this.#storePath, "utf8");
9013
9395
  const parsed = JSON.parse(raw);
9014
9396
  this.#archived = new Map(Object.entries(parsed.archived ?? {}).filter(([, r]) => isRecord2(r)));
9015
9397
  this.#restored = new Map(Object.entries(parsed.restored ?? {}).filter((entry) => typeof entry[1] === "number"));
@@ -9117,7 +9499,7 @@ var SessionArchive = class {
9117
9499
  archived: Object.fromEntries(this.#archived),
9118
9500
  restored: Object.fromEntries(this.#restored)
9119
9501
  };
9120
- await mkdir10(path22.dirname(this.#storePath), { recursive: true });
9502
+ await mkdir10(path23.dirname(this.#storePath), { recursive: true });
9121
9503
  await writeFile11(this.#storePath, JSON.stringify(file, null, 2), "utf8");
9122
9504
  }
9123
9505
  };
@@ -9126,8 +9508,8 @@ function isRecord2(value) {
9126
9508
  }
9127
9509
 
9128
9510
  // ../host/dist/pins.js
9129
- import { mkdir as mkdir11, readFile as readFile13, writeFile as writeFile12 } from "node:fs/promises";
9130
- 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";
9131
9513
  var SessionPins = class {
9132
9514
  #pinned = /* @__PURE__ */ new Map();
9133
9515
  /**
@@ -9142,11 +9524,11 @@ var SessionPins = class {
9142
9524
  #moved = /* @__PURE__ */ new Map();
9143
9525
  #storePath;
9144
9526
  constructor(dataDir) {
9145
- this.#storePath = path23.join(dataDir, "session-pins.json");
9527
+ this.#storePath = path24.join(dataDir, "session-pins.json");
9146
9528
  }
9147
9529
  async load() {
9148
9530
  try {
9149
- const raw = await readFile13(this.#storePath, "utf8");
9531
+ const raw = await readFile14(this.#storePath, "utf8");
9150
9532
  const parsed = JSON.parse(raw);
9151
9533
  this.#pinned = new Map(Object.entries(parsed.pinned ?? {}).filter(([, r]) => isRecord3(r)));
9152
9534
  this.#moved = new Map(Object.entries(parsed.moved ?? {}).filter(([, to]) => typeof to === "string"));
@@ -9299,7 +9681,7 @@ var SessionPins = class {
9299
9681
  pinned: Object.fromEntries(this.#pinned),
9300
9682
  ...this.#moved.size > 0 ? { moved: Object.fromEntries(this.#moved) } : {}
9301
9683
  };
9302
- await mkdir11(path23.dirname(this.#storePath), { recursive: true });
9684
+ await mkdir11(path24.dirname(this.#storePath), { recursive: true });
9303
9685
  await writeFile12(this.#storePath, JSON.stringify(file, null, 2), "utf8");
9304
9686
  }
9305
9687
  };
@@ -9308,17 +9690,17 @@ function isRecord3(value) {
9308
9690
  }
9309
9691
 
9310
9692
  // ../host/dist/order.js
9311
- import { mkdir as mkdir12, readFile as readFile14, writeFile as writeFile13 } from "node:fs/promises";
9312
- 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";
9313
9695
  var ListOrderStore = class {
9314
9696
  #order = emptyOrder();
9315
9697
  #storePath;
9316
9698
  constructor(dataDir) {
9317
- this.#storePath = path24.join(dataDir, "list-order.json");
9699
+ this.#storePath = path25.join(dataDir, "list-order.json");
9318
9700
  }
9319
9701
  async load() {
9320
9702
  try {
9321
- const raw = await readFile14(this.#storePath, "utf8");
9703
+ const raw = await readFile15(this.#storePath, "utf8");
9322
9704
  this.#order = sanitize(JSON.parse(raw));
9323
9705
  } catch {
9324
9706
  this.#order = emptyOrder();
@@ -9390,7 +9772,7 @@ var ListOrderStore = class {
9390
9772
  return changed;
9391
9773
  }
9392
9774
  async #persist() {
9393
- await mkdir12(path24.dirname(this.#storePath), { recursive: true });
9775
+ await mkdir12(path25.dirname(this.#storePath), { recursive: true });
9394
9776
  await writeFile13(this.#storePath, JSON.stringify(this.#order, null, 2), "utf8");
9395
9777
  }
9396
9778
  };
@@ -9420,8 +9802,8 @@ function sanitize(value) {
9420
9802
  }
9421
9803
 
9422
9804
  // ../host/dist/folders.js
9423
- import { mkdir as mkdir13, readFile as readFile15, writeFile as writeFile14 } from "node:fs/promises";
9424
- 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";
9425
9807
  import { randomUUID as randomUUID7 } from "node:crypto";
9426
9808
  var COLOR_PATTERN = /^#[0-9a-f]{6}$/i;
9427
9809
  var Folders = class {
@@ -9433,11 +9815,11 @@ var Folders = class {
9433
9815
  #pinnedAssignments = /* @__PURE__ */ new Map();
9434
9816
  #storePath;
9435
9817
  constructor(dataDir) {
9436
- this.#storePath = path25.join(dataDir, "folders.json");
9818
+ this.#storePath = path26.join(dataDir, "folders.json");
9437
9819
  }
9438
9820
  async load() {
9439
9821
  try {
9440
- const raw = await readFile15(this.#storePath, "utf8");
9822
+ const raw = await readFile16(this.#storePath, "utf8");
9441
9823
  const parsed = JSON.parse(raw);
9442
9824
  this.#workspaceFolders = new Map(Object.entries(parsed.workspaceFolders ?? {}).filter(([, r]) => isWorkspaceFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
9443
9825
  this.#sessionFolders = new Map(Object.entries(parsed.sessionFolders ?? {}).filter(([, r]) => isSessionFolder(r)).map(([id, r]) => [id, withValidColor(r)]));
@@ -9701,7 +10083,7 @@ var Folders = class {
9701
10083
  sessionAssignments: Object.fromEntries(this.#sessionAssignments),
9702
10084
  pinnedAssignments: Object.fromEntries(this.#pinnedAssignments)
9703
10085
  };
9704
- await mkdir13(path25.dirname(this.#storePath), { recursive: true });
10086
+ await mkdir13(path26.dirname(this.#storePath), { recursive: true });
9705
10087
  await writeFile14(this.#storePath, JSON.stringify(file, null, 2), "utf8");
9706
10088
  }
9707
10089
  };
@@ -9723,9 +10105,9 @@ function isPinnedFolder(value) {
9723
10105
  }
9724
10106
 
9725
10107
  // ../host/dist/app-settings.js
9726
- 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";
9727
10109
  import { homedir as homedir6 } from "node:os";
9728
- import path26 from "node:path";
10110
+ import path27 from "node:path";
9729
10111
  var DEFAULT_AUTO_ARCHIVE_AFTER_MS = 2 * 24 * 60 * 60 * 1e3;
9730
10112
  var MIN_AUTO_ARCHIVE_AFTER_MS = 60 * 60 * 1e3;
9731
10113
  var DEFAULT_AUTO_STOP_AFTER_MS = 10 * 60 * 1e3;
@@ -9785,11 +10167,11 @@ var AppSettingsStore = class {
9785
10167
  #settings = { ...DEFAULT_APP_SETTINGS };
9786
10168
  #storePath;
9787
10169
  constructor(dataDir) {
9788
- this.#storePath = path26.join(dataDir, "app-settings.json");
10170
+ this.#storePath = path27.join(dataDir, "app-settings.json");
9789
10171
  }
9790
10172
  async load() {
9791
10173
  try {
9792
- const raw = await readFile16(this.#storePath, "utf8");
10174
+ const raw = await readFile17(this.#storePath, "utf8");
9793
10175
  this.#settings = sanitize2(JSON.parse(raw), DEFAULT_APP_SETTINGS);
9794
10176
  } catch {
9795
10177
  this.#settings = { ...DEFAULT_APP_SETTINGS };
@@ -9809,7 +10191,7 @@ var AppSettingsStore = class {
9809
10191
  async update(patch) {
9810
10192
  const next = sanitize2(patch, this.#settings);
9811
10193
  this.#settings = next;
9812
- await mkdir14(path26.dirname(this.#storePath), { recursive: true });
10194
+ await mkdir14(path27.dirname(this.#storePath), { recursive: true });
9813
10195
  await writeFile15(this.#storePath, JSON.stringify(next, null, 2), "utf8");
9814
10196
  return this.current;
9815
10197
  }
@@ -9884,7 +10266,7 @@ function sanitize2(value, fallback) {
9884
10266
  return result;
9885
10267
  }
9886
10268
  function claudeHome() {
9887
- return path26.join(homedir6(), ".claude");
10269
+ return path27.join(homedir6(), ".claude");
9888
10270
  }
9889
10271
  function writableRoots(mode, cwd, workspacePaths) {
9890
10272
  if (mode === "all")
@@ -9894,7 +10276,7 @@ function writableRoots(mode, cwd, workspacePaths) {
9894
10276
  return [...roots];
9895
10277
  for (const workspace of [cwd, ...workspacePaths]) {
9896
10278
  roots.add(workspace);
9897
- const parent = path26.dirname(workspace);
10279
+ const parent = path27.dirname(workspace);
9898
10280
  if (parent !== workspace)
9899
10281
  roots.add(parent);
9900
10282
  }
@@ -10008,19 +10390,19 @@ var PromptQueues = class extends EventEmitter6 {
10008
10390
  };
10009
10391
 
10010
10392
  // ../host/dist/handoff-store.js
10011
- import { mkdir as mkdir15, readFile as readFile17, readdir as readdir7, rm as rm5, writeFile as writeFile16 } from "node:fs/promises";
10012
- 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";
10013
10395
  var HandoffStore = class {
10014
10396
  #dir;
10015
10397
  constructor(dataDir) {
10016
- this.#dir = path27.join(dataDir, "handoffs");
10398
+ this.#dir = path28.join(dataDir, "handoffs");
10017
10399
  }
10018
10400
  async get(sessionId) {
10019
10401
  const file = this.#file(sessionId);
10020
10402
  if (!file)
10021
10403
  return null;
10022
10404
  try {
10023
- const parsed = JSON.parse(await readFile17(file, "utf8"));
10405
+ const parsed = JSON.parse(await readFile18(file, "utf8"));
10024
10406
  return typeof parsed.text === "string" ? parsed : null;
10025
10407
  } catch {
10026
10408
  return null;
@@ -10041,7 +10423,7 @@ var HandoffStore = class {
10041
10423
  /** id всех сохранённых хэндоффов. */
10042
10424
  async list() {
10043
10425
  try {
10044
- 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));
10045
10427
  } catch {
10046
10428
  return [];
10047
10429
  }
@@ -10050,7 +10432,7 @@ var HandoffStore = class {
10050
10432
  #file(sessionId) {
10051
10433
  if (!/^[\w-]{1,128}$/.test(sessionId))
10052
10434
  return null;
10053
- return path27.join(this.#dir, `${sessionId}.json`);
10435
+ return path28.join(this.#dir, `${sessionId}.json`);
10054
10436
  }
10055
10437
  };
10056
10438
  var SAME_WINDOW_MS = 5 * 6e4;
@@ -10059,11 +10441,11 @@ var LimitStopState = class {
10059
10441
  #fired = {};
10060
10442
  #storePath;
10061
10443
  constructor(dataDir) {
10062
- this.#storePath = path27.join(dataDir, "limit-stop.json");
10444
+ this.#storePath = path28.join(dataDir, "limit-stop.json");
10063
10445
  }
10064
10446
  async load() {
10065
10447
  try {
10066
- const parsed = JSON.parse(await readFile17(this.#storePath, "utf8"));
10448
+ const parsed = JSON.parse(await readFile18(this.#storePath, "utf8"));
10067
10449
  this.#fired = {};
10068
10450
  const read = (source) => {
10069
10451
  const out = {};
@@ -10107,7 +10489,7 @@ var LimitStopState = class {
10107
10489
  }
10108
10490
  async #mark(account, limit, until) {
10109
10491
  this.#fired[account] = { ...this.#fired[account], [limit]: until };
10110
- await mkdir15(path27.dirname(this.#storePath), { recursive: true });
10492
+ await mkdir15(path28.dirname(this.#storePath), { recursive: true });
10111
10493
  const { [MAIN_ACCOUNT_ID]: main = {}, ...others } = this.#fired;
10112
10494
  await writeFile16(this.#storePath, JSON.stringify({ ...main, ...others }, null, 2), "utf8");
10113
10495
  }
@@ -10161,7 +10543,7 @@ function journalHandoff(entries) {
10161
10543
  const prompts = [];
10162
10544
  let lastText = "";
10163
10545
  let todos = null;
10164
- const files = /* @__PURE__ */ new Set();
10546
+ const files2 = /* @__PURE__ */ new Set();
10165
10547
  for (const { event } of entries) {
10166
10548
  if (event.kind === "user.message") {
10167
10549
  if (!event.text.startsWith("[ccv]"))
@@ -10174,7 +10556,7 @@ function journalHandoff(entries) {
10174
10556
  if (EDIT_TOOLS.has(event.name)) {
10175
10557
  const target = input.file_path ?? input.notebook_path;
10176
10558
  if (typeof target === "string")
10177
- files.add(target);
10559
+ files2.add(target);
10178
10560
  } else if (event.name === "TodoWrite" && Array.isArray(input.todos)) {
10179
10561
  todos = input.todos.flatMap((todo) => {
10180
10562
  const t = todo;
@@ -10193,8 +10575,8 @@ function journalHandoff(entries) {
10193
10575
  const mark = (status) => status === "completed" ? "[x]" : status === "in_progress" ? "[~]" : "[ ]";
10194
10576
  sections.push("## \u0417\u0430\u0434\u0430\u0447\u0438\n\n" + todos.map((t) => `- ${mark(t.status)} ${t.content}`).join("\n"));
10195
10577
  }
10196
- if (files.size > 0) {
10197
- 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"));
10198
10580
  }
10199
10581
  if (lastText)
10200
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));
@@ -10213,9 +10595,9 @@ function capitalize(text) {
10213
10595
  }
10214
10596
 
10215
10597
  // ../host/dist/plugins.js
10216
- import { readFile as readFile18 } from "node:fs/promises";
10598
+ import { readFile as readFile19 } from "node:fs/promises";
10217
10599
  import { homedir as homedir7 } from "node:os";
10218
- import path28 from "node:path";
10600
+ import path29 from "node:path";
10219
10601
  var TIMEOUT_MS2 = 12e4;
10220
10602
  var SAFE_ARG = /^[A-Za-z0-9][A-Za-z0-9._@/-]*$/;
10221
10603
  var PluginCli = class {
@@ -10314,10 +10696,10 @@ async function readCatalog(markets, installed) {
10314
10696
  return lists.flat().sort((a, b) => a.name.localeCompare(b.name));
10315
10697
  }
10316
10698
  async function readMarketplace(market, installed) {
10317
- 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);
10318
10700
  let manifest;
10319
10701
  try {
10320
- 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");
10321
10703
  manifest = JSON.parse(text);
10322
10704
  } catch {
10323
10705
  return [];
@@ -10569,8 +10951,8 @@ function describe6(error) {
10569
10951
 
10570
10952
  // ../host/dist/relay-link.js
10571
10953
  import { EventEmitter as EventEmitter8 } from "node:events";
10572
- import { readFile as readFile19, writeFile as writeFile17, rm as rm6, mkdir as mkdir16 } from "node:fs/promises";
10573
- 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";
10574
10956
  import { hostname } from "node:os";
10575
10957
  import WebSocket from "ws";
10576
10958
 
@@ -10625,7 +11007,7 @@ var RelayLink = class extends EventEmitter8 {
10625
11007
  #log;
10626
11008
  constructor(options2) {
10627
11009
  super();
10628
- this.#file = path29.join(options2.dataDir, "relay.json");
11010
+ this.#file = path30.join(options2.dataDir, "relay.json");
10629
11011
  this.#defaultUrl = options2.defaultUrl.replace(/\/+$/, "");
10630
11012
  this.#log = options2.log ?? ((msg) => console.log(`[relay] ${msg}`));
10631
11013
  }
@@ -10706,7 +11088,7 @@ var RelayLink = class extends EventEmitter8 {
10706
11088
  }
10707
11089
  async #read() {
10708
11090
  try {
10709
- const raw = await readFile19(this.#file, "utf8");
11091
+ const raw = await readFile20(this.#file, "utf8");
10710
11092
  const parsed = JSON.parse(raw);
10711
11093
  if (typeof parsed !== "object" || parsed === null)
10712
11094
  return null;
@@ -10719,7 +11101,7 @@ var RelayLink = class extends EventEmitter8 {
10719
11101
  }
10720
11102
  }
10721
11103
  async #write(credentials) {
10722
- await mkdir16(path29.dirname(this.#file), { recursive: true });
11104
+ await mkdir16(path30.dirname(this.#file), { recursive: true });
10723
11105
  await writeFile17(this.#file, `${JSON.stringify(credentials, null, 2)}
10724
11106
  `, {
10725
11107
  encoding: "utf8",
@@ -10977,7 +11359,7 @@ function humanize(error) {
10977
11359
  // ../host/dist/terminal.js
10978
11360
  import { EventEmitter as EventEmitter9 } from "node:events";
10979
11361
  import { access as access2, constants as constants2 } from "node:fs/promises";
10980
- import path30 from "node:path";
11362
+ import path31 from "node:path";
10981
11363
  import { randomUUID as randomUUID9 } from "node:crypto";
10982
11364
  var SCROLLBACK_BYTES = 256 * 1024;
10983
11365
  var FLUSH_MS = 12;
@@ -11147,35 +11529,35 @@ async function defaultShell() {
11147
11529
  if (pwsh)
11148
11530
  return { file: pwsh, args: [], title: "pwsh" };
11149
11531
  const system = process.env.SystemRoot ?? "C:\\Windows";
11150
- const powershell = path30.join(system, "System32/WindowsPowerShell/v1.0/powershell.exe");
11151
- if (await exists4(powershell))
11532
+ const powershell = path31.join(system, "System32/WindowsPowerShell/v1.0/powershell.exe");
11533
+ if (await exists5(powershell))
11152
11534
  return { file: powershell, args: [], title: "powershell" };
11153
11535
  return { file: process.env.COMSPEC ?? "cmd.exe", args: [], title: "cmd" };
11154
11536
  }
11155
11537
  const shell = process.env.SHELL;
11156
- if (shell && await exists4(shell))
11157
- return { file: shell, args: [], title: path30.basename(shell) };
11158
- 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"))
11159
11541
  return { file: "/bin/bash", args: [], title: "bash" };
11160
11542
  return { file: "/bin/sh", args: [], title: "sh" };
11161
11543
  }
11162
11544
  async function findOnPath(name) {
11163
- const dirs = (process.env.PATH ?? "").split(path30.delimiter).filter(Boolean);
11545
+ const dirs = (process.env.PATH ?? "").split(path31.delimiter).filter(Boolean);
11164
11546
  for (const dir of dirs) {
11165
- const candidate = path30.join(dir, name);
11166
- if (await exists4(candidate))
11547
+ const candidate = path31.join(dir, name);
11548
+ if (await exists5(candidate))
11167
11549
  return candidate;
11168
11550
  }
11169
11551
  return null;
11170
11552
  }
11171
- function exists4(file) {
11553
+ function exists5(file) {
11172
11554
  return access2(file, constants2.X_OK).then(() => true, () => false);
11173
11555
  }
11174
11556
 
11175
11557
  // ../host/dist/mcp-credentials.js
11176
11558
  import { createHash } from "node:crypto";
11177
- import { readFile as readFile20, rename as rename2, writeFile as writeFile18 } from "node:fs/promises";
11178
- 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";
11179
11561
  function mcpOAuthKey(name, config) {
11180
11562
  if (!config || typeof config !== "object")
11181
11563
  return null;
@@ -11189,7 +11571,7 @@ function mcpOAuthKey(name, config) {
11189
11571
  async function readMcpCredentialRecords(configDir, name) {
11190
11572
  let parsed;
11191
11573
  try {
11192
- parsed = JSON.parse(await readFile20(path31.join(configDir, ".credentials.json"), "utf8"));
11574
+ parsed = JSON.parse(await readFile21(path32.join(configDir, ".credentials.json"), "utf8"));
11193
11575
  } catch {
11194
11576
  return null;
11195
11577
  }
@@ -11256,11 +11638,11 @@ function diagnoseSignIn(records, expectedKey) {
11256
11638
  };
11257
11639
  }
11258
11640
  function registryPath(configDir) {
11259
- return path31.join(configDir, "plugins", "installed_plugins.json");
11641
+ return path32.join(configDir, "plugins", "installed_plugins.json");
11260
11642
  }
11261
11643
  async function readRegistry(configDir) {
11262
11644
  try {
11263
- const raw = JSON.parse(await readFile20(registryPath(configDir), "utf8"));
11645
+ const raw = JSON.parse(await readFile21(registryPath(configDir), "utf8"));
11264
11646
  const plugins = raw.plugins;
11265
11647
  if (!plugins || typeof plugins !== "object")
11266
11648
  return null;
@@ -11304,10 +11686,10 @@ async function keepSinglePluginRecord(configDir, id) {
11304
11686
  }
11305
11687
 
11306
11688
  // ../host/dist/mcp-config.js
11307
- import { readFile as readFile21, writeFile as writeFile19, mkdir as mkdir17 } from "node:fs/promises";
11308
- 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";
11309
11691
  var MCP_FILE = ".mcp.json";
11310
- var LOCAL_SETTINGS2 = path32.join(".claude", "settings.local.json");
11692
+ var LOCAL_SETTINGS2 = path33.join(".claude", "settings.local.json");
11311
11693
  var queues = /* @__PURE__ */ new Map();
11312
11694
  function serialize(cwd, work) {
11313
11695
  const previous = queues.get(cwd) ?? Promise.resolve();
@@ -11316,7 +11698,7 @@ function serialize(cwd, work) {
11316
11698
  return next;
11317
11699
  }
11318
11700
  async function readProjectServers(cwd) {
11319
- const file = await readJson(path32.join(cwd, MCP_FILE));
11701
+ const file = await readJson(path33.join(cwd, MCP_FILE));
11320
11702
  const servers = file?.mcpServers;
11321
11703
  if (!servers || typeof servers !== "object")
11322
11704
  return {};
@@ -11324,23 +11706,23 @@ async function readProjectServers(cwd) {
11324
11706
  }
11325
11707
  function addProjectServer(cwd, name, config) {
11326
11708
  return serialize(cwd, async () => {
11327
- const file = await readJson(path32.join(cwd, MCP_FILE)) ?? {};
11709
+ const file = await readJson(path33.join(cwd, MCP_FILE)) ?? {};
11328
11710
  const servers = file.mcpServers ?? {};
11329
11711
  servers[name] = config;
11330
11712
  file.mcpServers = servers;
11331
- await writeJson(path32.join(cwd, MCP_FILE), file);
11713
+ await writeJson(path33.join(cwd, MCP_FILE), file);
11332
11714
  await approve(cwd, name);
11333
11715
  });
11334
11716
  }
11335
11717
  function removeProjectServer(cwd, name) {
11336
11718
  return serialize(cwd, async () => {
11337
- const file = await readJson(path32.join(cwd, MCP_FILE));
11719
+ const file = await readJson(path33.join(cwd, MCP_FILE));
11338
11720
  const servers = file?.mcpServers;
11339
11721
  if (!servers || !(name in servers))
11340
11722
  return false;
11341
11723
  delete servers[name];
11342
- await writeJson(path32.join(cwd, MCP_FILE), file);
11343
- const settingsPath = path32.join(cwd, LOCAL_SETTINGS2);
11724
+ await writeJson(path33.join(cwd, MCP_FILE), file);
11725
+ const settingsPath = path33.join(cwd, LOCAL_SETTINGS2);
11344
11726
  const settings = await readJson(settingsPath);
11345
11727
  const enabled = settings?.enabledMcpjsonServers;
11346
11728
  if (settings && Array.isArray(enabled) && enabled.includes(name)) {
@@ -11351,7 +11733,7 @@ function removeProjectServer(cwd, name) {
11351
11733
  });
11352
11734
  }
11353
11735
  async function approve(cwd, name) {
11354
- const file = path32.join(cwd, LOCAL_SETTINGS2);
11736
+ const file = path33.join(cwd, LOCAL_SETTINGS2);
11355
11737
  const settings = await readJson(file) ?? {};
11356
11738
  const enabled = Array.isArray(settings.enabledMcpjsonServers) ? settings.enabledMcpjsonServers : [];
11357
11739
  if (!enabled.includes(name))
@@ -11390,20 +11772,20 @@ function describeConfig(config) {
11390
11772
  }
11391
11773
  async function readJson(file) {
11392
11774
  try {
11393
- const raw = await readFile21(file, "utf8");
11775
+ const raw = await readFile22(file, "utf8");
11394
11776
  const parsed = JSON.parse(raw);
11395
11777
  return parsed && typeof parsed === "object" ? parsed : null;
11396
11778
  } catch (error) {
11397
11779
  if (error.code === "ENOENT")
11398
11780
  return null;
11399
11781
  if (error instanceof SyntaxError) {
11400
- 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}`);
11401
11783
  }
11402
11784
  throw error;
11403
11785
  }
11404
11786
  }
11405
11787
  async function writeJson(file, data) {
11406
- await mkdir17(path32.dirname(file), { recursive: true });
11788
+ await mkdir17(path33.dirname(file), { recursive: true });
11407
11789
  await writeFile19(file, `${JSON.stringify(data, null, 2)}
11408
11790
  `, "utf8");
11409
11791
  }
@@ -11636,7 +12018,7 @@ var HostServer = class {
11636
12018
  const status = await new AuthCli(configDir).status().catch(() => null);
11637
12019
  if (!status?.loggedIn)
11638
12020
  return null;
11639
- 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());
11640
12022
  return {
11641
12023
  configDir,
11642
12024
  email: status.email,
@@ -12280,6 +12662,24 @@ var HostServer = class {
12280
12662
  this.#approveAfterLimit(frame.sessionId);
12281
12663
  await this.#requireSession(frame.sessionId).editPrompt(frame.userIndex, frame.text, frame.images, frame.attachments, frame.rewindFiles === true);
12282
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
+ }
12283
12683
  case "session.rewindFiles": {
12284
12684
  const session = this.#requireSession(frame.sessionId);
12285
12685
  const reply = {
@@ -12513,11 +12913,11 @@ var HostServer = class {
12513
12913
  await this.#gitNetwork(frame.workspaceId, "\u041F\u0443\u0431\u043B\u0438\u043A\u0443\u0435\u043C \u043D\u0430 GitHub\u2026", (repo) => this.#publish(repo, frame));
12514
12914
  return;
12515
12915
  case "git.files": {
12516
- const { files, truncated } = await this.#git(frame.workspaceId).candidates();
12916
+ const { files: files2, truncated } = await this.#git(frame.workspaceId).candidates();
12517
12917
  this.#send(socket, {
12518
12918
  type: "git.files",
12519
12919
  workspaceId: frame.workspaceId,
12520
- files,
12920
+ files: files2,
12521
12921
  truncated
12522
12922
  });
12523
12923
  return;
@@ -12663,10 +13063,10 @@ var HostServer = class {
12663
13063
  return;
12664
13064
  }
12665
13065
  case "fs.write": {
12666
- const files = this.#files(frame.workspaceId);
13066
+ const files2 = this.#files(frame.workspaceId);
12667
13067
  let saved;
12668
13068
  try {
12669
- 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);
12670
13070
  } catch (error) {
12671
13071
  this.#fsFailed(frame.workspaceId, frame.path, error);
12672
13072
  return;
@@ -12698,8 +13098,8 @@ var HostServer = class {
12698
13098
  const workspace = this.#workspaces.find(frame.workspaceId);
12699
13099
  if (!workspace)
12700
13100
  throw new Error(`\u0412\u043E\u0440\u043A\u0441\u043F\u0435\u0439\u0441 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${frame.workspaceId}`);
12701
- const catalog = await scanVideoCatalog(workspace.path);
12702
- this.#send(socket, { type: "video.catalog", workspaceId: workspace.id, ...catalog });
13101
+ const [catalog, ffmpeg] = await Promise.all([scanVideoCatalog(workspace.path), probeFfmpeg()]);
13102
+ this.#send(socket, { type: "video.catalog", workspaceId: workspace.id, ...catalog, ffmpeg });
12703
13103
  for (const state of this.#studios.states(workspace.id)) {
12704
13104
  this.#send(socket, { type: "video.studio", state });
12705
13105
  }
@@ -12739,15 +13139,15 @@ var HostServer = class {
12739
13139
  case "fs.create":
12740
13140
  case "fs.delete":
12741
13141
  case "fs.rename": {
12742
- const files = this.#files(frame.workspaceId);
13142
+ const files2 = this.#files(frame.workspaceId);
12743
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)}`;
12744
13144
  try {
12745
13145
  if (frame.type === "fs.create")
12746
- await files.create(frame.path, frame.kind);
13146
+ await files2.create(frame.path, frame.kind);
12747
13147
  else if (frame.type === "fs.delete")
12748
- await files.remove(frame.path);
13148
+ await files2.remove(frame.path);
12749
13149
  else
12750
- await files.rename(frame.path, frame.to);
13150
+ await files2.rename(frame.path, frame.to);
12751
13151
  } catch (error) {
12752
13152
  this.#fsFailed(frame.workspaceId, frame.path, error);
12753
13153
  return;
@@ -12808,6 +13208,9 @@ var HostServer = class {
12808
13208
  rows: frame.rows
12809
13209
  });
12810
13210
  this.#broadcastTerminal({ type: "term.opened", terminal });
13211
+ if (frame.input)
13212
+ this.#terminals.write(terminal.id, `${frame.input}
13213
+ `);
12811
13214
  return;
12812
13215
  }
12813
13216
  case "term.attach":
@@ -14215,12 +14618,12 @@ var HostServer = class {
14215
14618
  }
14216
14619
  async #sendMemoryState(socket, workspaceId, accountId) {
14217
14620
  const account = this.#accounts.find(accountId) ?? this.#accounts.find(void 0);
14218
- const files = await this.#memory(workspaceId, account?.id).list();
14621
+ const files2 = await this.#memory(workspaceId, account?.id).list();
14219
14622
  this.#send(socket, {
14220
14623
  type: "memory.state",
14221
14624
  workspaceId,
14222
14625
  accountId: account?.id ?? MAIN_ACCOUNT_ID,
14223
- files
14626
+ files: files2
14224
14627
  });
14225
14628
  }
14226
14629
  #files(workspaceId) {
@@ -14407,8 +14810,8 @@ var HostServer = class {
14407
14810
  return;
14408
14811
  }
14409
14812
  const url2 = new URL(req.url ?? "/", "http://localhost");
14410
- const requested = path33.join(webRoot, path33.normalize(url2.pathname));
14411
- 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");
14412
14815
  if (!existsSync5(target)) {
14413
14816
  res.writeHead(404).end("not found");
14414
14817
  return;
@@ -14434,7 +14837,7 @@ function contentType(file) {
14434
14837
  ".svg": "image/svg+xml",
14435
14838
  ".woff2": "font/woff2"
14436
14839
  };
14437
- return types[path33.extname(file)] ?? "application/octet-stream";
14840
+ return types[path34.extname(file)] ?? "application/octet-stream";
14438
14841
  }
14439
14842
  var PROVIDER_LABEL = {
14440
14843
  claude: "Claude",
@@ -14469,8 +14872,8 @@ function antigravitySummary(record, provider = "antigravity") {
14469
14872
  }
14470
14873
 
14471
14874
  // dist/ccv.js
14472
- var HERE = path34.dirname(fileURLToPath(import.meta.url));
14473
- var PACKAGE_ROOT = path34.resolve(HERE, "..");
14875
+ var HERE = path35.dirname(fileURLToPath(import.meta.url));
14876
+ var PACKAGE_ROOT = path35.resolve(HERE, "..");
14474
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.
14475
14878
 
14476
14879
  \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:
@@ -14537,7 +14940,7 @@ var server = new HostServer({
14537
14940
  dataDir: defaults.dataDir,
14538
14941
  // UI лежит в пакете рядом с бандлом — это и есть разница между установленной
14539
14942
  // утилитой и запуском из репозитория, где сборка живёт в `apps/web/dist`.
14540
- webRoot: process.env.CCV_WEB_ROOT ?? path34.join(PACKAGE_ROOT, "web"),
14943
+ webRoot: process.env.CCV_WEB_ROOT ?? path35.join(PACKAGE_ROOT, "web"),
14541
14944
  version,
14542
14945
  relayUrl: defaults.relayUrl
14543
14946
  });
@@ -14566,7 +14969,7 @@ for (const signal of ["SIGINT", "SIGTERM"]) {
14566
14969
  }
14567
14970
  async function packageVersion() {
14568
14971
  try {
14569
- const text = await readFile22(path34.join(PACKAGE_ROOT, "package.json"), "utf8");
14972
+ const text = await readFile23(path35.join(PACKAGE_ROOT, "package.json"), "utf8");
14570
14973
  return JSON.parse(text).version ?? "0.0.0";
14571
14974
  } catch {
14572
14975
  return "0.0.0";