@yorz/cli 0.13.0 → 0.14.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 (134) hide show
  1. package/dist/cli/index.js +324 -10
  2. package/dist/gui/assets/{abnfDiagram-VRR7QNED-CHas-sjI.js → abnfDiagram-VRR7QNED-Br8A6RUk.js} +1 -1
  3. package/dist/{gui-mobile/assets/arc-W0d0aNNL.js → gui/assets/arc-BNZF-XYv.js} +1 -1
  4. package/dist/{gui-mobile/assets/architectureDiagram-ZJ3FMSHR-C7n8Akxp.js → gui/assets/architectureDiagram-ZJ3FMSHR-Dl9THa2L.js} +1 -1
  5. package/dist/{gui-mobile/assets/blockDiagram-677ZJIJ3-DyqrKJT7.js → gui/assets/blockDiagram-677ZJIJ3-D-2owPWZ.js} +1 -1
  6. package/dist/gui/assets/{c4Diagram-LMCZKHZV-rfToA0_z.js → c4Diagram-LMCZKHZV-CpOx6hTg.js} +1 -1
  7. package/dist/gui/assets/channel-Bf3xgAnb.js +1 -0
  8. package/dist/gui/assets/{chunk-2Q5K7J3B-EBzGDbj7.js → chunk-2Q5K7J3B-B40RmE3d.js} +1 -1
  9. package/dist/gui/assets/{chunk-32BRIVSS-BWjVeFy7.js → chunk-32BRIVSS-BrNJz81X.js} +1 -1
  10. package/dist/gui/assets/{chunk-5VM5RSS4-DTQx1JHi.js → chunk-5VM5RSS4-CVqumv99.js} +1 -1
  11. package/dist/gui/assets/{chunk-EX3LRPZG-BG5uo2fg.js → chunk-EX3LRPZG-D2K9iqmJ.js} +1 -1
  12. package/dist/gui/assets/{chunk-JWPE2WC7--G0oyo9O.js → chunk-JWPE2WC7-HEpHfS7t.js} +1 -1
  13. package/dist/gui/assets/{chunk-MOJQB5TN-BQ-Mu9Ua.js → chunk-MOJQB5TN-u0_j3hH3.js} +1 -1
  14. package/dist/gui/assets/{chunk-RYQCIY6F-BEYJmvvY.js → chunk-RYQCIY6F-DSwSAQnJ.js} +1 -1
  15. package/dist/gui/assets/{chunk-V7JOEXUC-CXTB9Dv-.js → chunk-V7JOEXUC-BNzztD3a.js} +1 -1
  16. package/dist/gui/assets/{chunk-VR4S4FIN-DdWFxvZe.js → chunk-VR4S4FIN-DizwLX2s.js} +1 -1
  17. package/dist/gui/assets/{chunk-XXDRQBXY-Bu2xNLMy.js → chunk-XXDRQBXY-ngTYtCxj.js} +1 -1
  18. package/dist/gui/assets/classDiagram-OUVF2IWQ-CEEynI1x.js +1 -0
  19. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-CEEynI1x.js +1 -0
  20. package/dist/{gui-mobile/assets/cose-bilkent-JH36ORCC-B-ugahei.js → gui/assets/cose-bilkent-JH36ORCC-OTzs1-hb.js} +1 -1
  21. package/dist/gui/assets/{cynefin-VYW2F7L2-CgdsCBRp.js → cynefin-VYW2F7L2-DKOvpOnu.js} +1 -1
  22. package/dist/{gui-mobile/assets/cynefinDiagram-TSTJHNR4-EpR-VLwY.js → gui/assets/cynefinDiagram-TSTJHNR4-G2TceZSR.js} +1 -1
  23. package/dist/gui/assets/{dagre-VKFMJZFB-9mi0GAtJ.js → dagre-VKFMJZFB-C7bX4NMr.js} +1 -1
  24. package/dist/gui/assets/{diagram-FQU43EPY-C1VrrSj8.js → diagram-FQU43EPY-DzZ_uozs.js} +1 -1
  25. package/dist/{gui-mobile/assets/diagram-G47NLZAW-BkGDb5FF.js → gui/assets/diagram-G47NLZAW-CtUanX8u.js} +1 -1
  26. package/dist/gui/assets/{diagram-NH7WQ7WH-Dt_RBtZf.js → diagram-NH7WQ7WH-Cj0b2ASJ.js} +1 -1
  27. package/dist/{gui-mobile/assets/diagram-OA4YK3LP-bUxPsiBQ.js → gui/assets/diagram-OA4YK3LP-wbAJUivR.js} +1 -1
  28. package/dist/gui/assets/{diagram-WEI45ONY-DM2Z5Vfp.js → diagram-WEI45ONY-8zb4nL1k.js} +1 -1
  29. package/dist/gui/assets/{ebnfDiagram-CCIWWBDH-DJWV5L6j.js → ebnfDiagram-CCIWWBDH-D22yXTH4.js} +1 -1
  30. package/dist/{gui-mobile/assets/erDiagram-Q63AITRT-CbJRWC8U.js → gui/assets/erDiagram-Q63AITRT-Ch6MTse3.js} +1 -1
  31. package/dist/gui/assets/{flowDiagram-23GEKE2U-GznvAjo1.js → flowDiagram-23GEKE2U-DoWr52n6.js} +1 -1
  32. package/dist/{gui-mobile/assets/ganttDiagram-NO4QXBWP-DEdAq2e9.js → gui/assets/ganttDiagram-NO4QXBWP-Bn27EBp5.js} +1 -1
  33. package/dist/gui/assets/{gitGraphDiagram-IHSO6WYX-Cqb8K3WB.js → gitGraphDiagram-IHSO6WYX-eNrZKJto.js} +1 -1
  34. package/dist/gui/assets/index-CGJqeBWy.css +1 -0
  35. package/dist/gui/assets/index-CnBmykN1.js +42 -0
  36. package/dist/gui/assets/{infoDiagram-FWYZ7A6U-3mAm46xF.js → infoDiagram-FWYZ7A6U-thYTzFt4.js} +1 -1
  37. package/dist/gui/assets/{ishikawaDiagram-FXEZZL3T-s8LvetuP.js → ishikawaDiagram-FXEZZL3T-B9wHLiN6.js} +1 -1
  38. package/dist/{gui-mobile/assets/journeyDiagram-5HDEW3XC-CB79ifZC.js → gui/assets/journeyDiagram-5HDEW3XC-DtAVTkgO.js} +1 -1
  39. package/dist/gui/assets/{kanban-definition-HUTT4EX6-CrDI5xq2.js → kanban-definition-HUTT4EX6-Dz9RiLQ9.js} +1 -1
  40. package/dist/gui/assets/{linear-AzP4MQxt.js → linear-CJZ3PkYv.js} +1 -1
  41. package/dist/{gui-mobile/assets/mermaid.core-DvnVINHy.js → gui/assets/mermaid.core-ChZsXg3q.js} +4 -4
  42. package/dist/gui/assets/{mindmap-definition-LN4V7U3C-B7wpSrxj.js → mindmap-definition-LN4V7U3C-Bv4h8NN-.js} +1 -1
  43. package/dist/gui/assets/{pegDiagram-2B236MQR-BOiuiSjj.js → pegDiagram-2B236MQR-CUdmCL7t.js} +1 -1
  44. package/dist/gui/assets/{pieDiagram-ENE6RG2P-DV_bb90P.js → pieDiagram-ENE6RG2P-DBGahumA.js} +1 -1
  45. package/dist/{gui-mobile/assets/quadrantDiagram-ABIIQ3AL-Bx9pQYlQ.js → gui/assets/quadrantDiagram-ABIIQ3AL-RCEsINBH.js} +1 -1
  46. package/dist/gui/assets/{railroadDiagram-RFXS5EU6-BaO9xxpp.js → railroadDiagram-RFXS5EU6-BTVWIeOh.js} +1 -1
  47. package/dist/gui/assets/{requirementDiagram-TGXJPOKE-B-r8AGph.js → requirementDiagram-TGXJPOKE-_ezgAovI.js} +1 -1
  48. package/dist/{gui-mobile/assets/sankeyDiagram-HTMAVEWB-CMC7JPmO.js → gui/assets/sankeyDiagram-HTMAVEWB-CzBFRwRS.js} +1 -1
  49. package/dist/{gui-mobile/assets/sequenceDiagram-DBY2YBRQ-hQilIEP9.js → gui/assets/sequenceDiagram-DBY2YBRQ-vVRMDvRP.js} +1 -1
  50. package/dist/gui/assets/{sizeCapture-X5ZJPWSS-BhmePssk.js → sizeCapture-X5ZJPWSS-XjYT_qs9.js} +1 -1
  51. package/dist/{gui-mobile/assets/stateDiagram-2N3HPSRC-BVwptFNV.js → gui/assets/stateDiagram-2N3HPSRC-BvmUSBj7.js} +1 -1
  52. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-DapGdR4p.js +1 -0
  53. package/dist/{gui-mobile/assets/swimlanes-5IMT3BWC-BbylZ7V-.js → gui/assets/swimlanes-5IMT3BWC-Q9EbvB5b.js} +2 -2
  54. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-DKhxcy5X.js +8 -0
  55. package/dist/{gui-mobile/assets/timeline-definition-FHXFAJF6-BV41TYYS.js → gui/assets/timeline-definition-FHXFAJF6-DgbXmUFv.js} +1 -1
  56. package/dist/gui/assets/{vennDiagram-L72KCM5P-BIqvZp-4.js → vennDiagram-L72KCM5P-HN495Jcc.js} +1 -1
  57. package/dist/gui/assets/{wardleyDiagram-EHGQE667-JPG7bZy9.js → wardleyDiagram-EHGQE667-DO3Kcl1f.js} +1 -1
  58. package/dist/{gui-mobile/assets/xychartDiagram-FW5EYKEG-Cx6vz85D.js → gui/assets/xychartDiagram-FW5EYKEG-Dkev8MUn.js} +1 -1
  59. package/dist/gui/index.html +2 -2
  60. package/dist/gui-mobile/assets/{abnfDiagram-VRR7QNED-Ct5gVqPT.js → abnfDiagram-VRR7QNED-B8a9bP4Z.js} +1 -1
  61. package/dist/{gui/assets/arc-2DIKI2ug.js → gui-mobile/assets/arc-DMWvh_U2.js} +1 -1
  62. package/dist/{gui/assets/architectureDiagram-ZJ3FMSHR-D2QIR4yT.js → gui-mobile/assets/architectureDiagram-ZJ3FMSHR-CriuyKiK.js} +1 -1
  63. package/dist/{gui/assets/blockDiagram-677ZJIJ3-C38mclkj.js → gui-mobile/assets/blockDiagram-677ZJIJ3-C36Osy6t.js} +1 -1
  64. package/dist/gui-mobile/assets/{c4Diagram-LMCZKHZV-B3c0YPoi.js → c4Diagram-LMCZKHZV-D6F9TAnQ.js} +1 -1
  65. package/dist/gui-mobile/assets/channel-Pa9JU1-Q.js +1 -0
  66. package/dist/gui-mobile/assets/{chunk-2Q5K7J3B-DzXlffcc.js → chunk-2Q5K7J3B-DhslPOO5.js} +1 -1
  67. package/dist/gui-mobile/assets/{chunk-32BRIVSS-DNdPyBHB.js → chunk-32BRIVSS-CqWUTC4p.js} +1 -1
  68. package/dist/gui-mobile/assets/{chunk-5VM5RSS4-FHr258SK.js → chunk-5VM5RSS4-C6hfdixH.js} +1 -1
  69. package/dist/gui-mobile/assets/{chunk-EX3LRPZG-DpLoMziL.js → chunk-EX3LRPZG-BjIaj32A.js} +1 -1
  70. package/dist/gui-mobile/assets/{chunk-JWPE2WC7-BfJ8s3z4.js → chunk-JWPE2WC7-CXSE1zoi.js} +1 -1
  71. package/dist/gui-mobile/assets/{chunk-MOJQB5TN-B4KCM52Y.js → chunk-MOJQB5TN-k7ggc-5H.js} +1 -1
  72. package/dist/gui-mobile/assets/{chunk-RYQCIY6F-aU_mZozX.js → chunk-RYQCIY6F-HtP5QefR.js} +1 -1
  73. package/dist/gui-mobile/assets/{chunk-V7JOEXUC-CqjIsdVE.js → chunk-V7JOEXUC-CYYuHgUL.js} +1 -1
  74. package/dist/gui-mobile/assets/{chunk-VR4S4FIN-qx-Snhek.js → chunk-VR4S4FIN-BpCvkdOv.js} +1 -1
  75. package/dist/gui-mobile/assets/{chunk-XXDRQBXY-Dg3iQUEM.js → chunk-XXDRQBXY-BpQuZVjD.js} +1 -1
  76. package/dist/gui-mobile/assets/classDiagram-OUVF2IWQ-D8iVJmba.js +1 -0
  77. package/dist/gui-mobile/assets/classDiagram-v2-EOCWNBFH-D8iVJmba.js +1 -0
  78. package/dist/{gui/assets/cose-bilkent-JH36ORCC-D1zBTANI.js → gui-mobile/assets/cose-bilkent-JH36ORCC-jOz8GIIT.js} +1 -1
  79. package/dist/gui-mobile/assets/{cynefin-VYW2F7L2-DLOiRgeh.js → cynefin-VYW2F7L2-DtByhn4b.js} +1 -1
  80. package/dist/{gui/assets/cynefinDiagram-TSTJHNR4-DMALRnpH.js → gui-mobile/assets/cynefinDiagram-TSTJHNR4-DwDWb-Ju.js} +1 -1
  81. package/dist/gui-mobile/assets/{dagre-VKFMJZFB-DP8rPgCo.js → dagre-VKFMJZFB-pNrK4yk3.js} +1 -1
  82. package/dist/gui-mobile/assets/{diagram-FQU43EPY-zoHmM_c1.js → diagram-FQU43EPY-CdEnsu8F.js} +1 -1
  83. package/dist/{gui/assets/diagram-G47NLZAW-BjP4LLm6.js → gui-mobile/assets/diagram-G47NLZAW-BLuzoAuE.js} +1 -1
  84. package/dist/gui-mobile/assets/{diagram-NH7WQ7WH-RISBAFck.js → diagram-NH7WQ7WH-Bpi99f_Z.js} +1 -1
  85. package/dist/{gui/assets/diagram-OA4YK3LP-YOcWMSYY.js → gui-mobile/assets/diagram-OA4YK3LP-C0m0oiST.js} +1 -1
  86. package/dist/gui-mobile/assets/{diagram-WEI45ONY-DX_OX85j.js → diagram-WEI45ONY-pdcoGVYg.js} +1 -1
  87. package/dist/gui-mobile/assets/{ebnfDiagram-CCIWWBDH-DH_XqG-i.js → ebnfDiagram-CCIWWBDH-DzAqzu-j.js} +1 -1
  88. package/dist/{gui/assets/erDiagram-Q63AITRT-CLQiaiAZ.js → gui-mobile/assets/erDiagram-Q63AITRT-CKbqKY5l.js} +1 -1
  89. package/dist/gui-mobile/assets/{flowDiagram-23GEKE2U-WyU95Ioy.js → flowDiagram-23GEKE2U-CKXhLUH5.js} +1 -1
  90. package/dist/{gui/assets/ganttDiagram-NO4QXBWP-Dxn0qtBL.js → gui-mobile/assets/ganttDiagram-NO4QXBWP-exiET8aZ.js} +1 -1
  91. package/dist/gui-mobile/assets/{gitGraphDiagram-IHSO6WYX-CNKJbGdW.js → gitGraphDiagram-IHSO6WYX-DLe6IY6p.js} +1 -1
  92. package/dist/gui-mobile/assets/index-DL76Df2H.js +34 -0
  93. package/dist/gui-mobile/assets/index-DbWuq34n.css +1 -0
  94. package/dist/gui-mobile/assets/{infoDiagram-FWYZ7A6U-DxOtcAry.js → infoDiagram-FWYZ7A6U-B04qIqaC.js} +1 -1
  95. package/dist/gui-mobile/assets/{ishikawaDiagram-FXEZZL3T-CMaJhSQh.js → ishikawaDiagram-FXEZZL3T-BfUyr0CR.js} +1 -1
  96. package/dist/{gui/assets/journeyDiagram-5HDEW3XC-CxKkBGrP.js → gui-mobile/assets/journeyDiagram-5HDEW3XC-gmwBMoty.js} +1 -1
  97. package/dist/gui-mobile/assets/{kanban-definition-HUTT4EX6-D3ZZPGkn.js → kanban-definition-HUTT4EX6-D22Q3Up0.js} +1 -1
  98. package/dist/gui-mobile/assets/{linear-B0c-4Ray.js → linear-DQwTsNSF.js} +1 -1
  99. package/dist/{gui/assets/mermaid.core-DHOOjgm_.js → gui-mobile/assets/mermaid.core-D8lHksCk.js} +4 -4
  100. package/dist/gui-mobile/assets/{mindmap-definition-LN4V7U3C-_ryv_wzi.js → mindmap-definition-LN4V7U3C-DC_KwrL8.js} +1 -1
  101. package/dist/gui-mobile/assets/{pegDiagram-2B236MQR-DZ2VachG.js → pegDiagram-2B236MQR-C6j0z0D4.js} +1 -1
  102. package/dist/gui-mobile/assets/{pieDiagram-ENE6RG2P-CBph_Pgy.js → pieDiagram-ENE6RG2P-KHzkoE-g.js} +1 -1
  103. package/dist/{gui/assets/quadrantDiagram-ABIIQ3AL-BN9QEn92.js → gui-mobile/assets/quadrantDiagram-ABIIQ3AL-DNShHbw9.js} +1 -1
  104. package/dist/gui-mobile/assets/{railroadDiagram-RFXS5EU6-CmJHGX9l.js → railroadDiagram-RFXS5EU6-RvPMC4lU.js} +1 -1
  105. package/dist/gui-mobile/assets/{requirementDiagram-TGXJPOKE-jitvSOLv.js → requirementDiagram-TGXJPOKE-Z4MqXF1y.js} +1 -1
  106. package/dist/{gui/assets/sankeyDiagram-HTMAVEWB-DqRjcG-_.js → gui-mobile/assets/sankeyDiagram-HTMAVEWB-DL9TkB5D.js} +1 -1
  107. package/dist/{gui/assets/sequenceDiagram-DBY2YBRQ-KcYyDxXc.js → gui-mobile/assets/sequenceDiagram-DBY2YBRQ-ejhB58rm.js} +1 -1
  108. package/dist/gui-mobile/assets/{sizeCapture-X5ZJPWSS-DP0_srQJ.js → sizeCapture-X5ZJPWSS-fAXplUDg.js} +1 -1
  109. package/dist/{gui/assets/stateDiagram-2N3HPSRC-DaA8s8RA.js → gui-mobile/assets/stateDiagram-2N3HPSRC-DVw54Vpx.js} +1 -1
  110. package/dist/gui-mobile/assets/stateDiagram-v2-6OUMAXLB-Cq_iPvyn.js +1 -0
  111. package/dist/{gui/assets/swimlanes-5IMT3BWC-uFXg9Hk3.js → gui-mobile/assets/swimlanes-5IMT3BWC-BK2b0CK-.js} +2 -2
  112. package/dist/gui-mobile/assets/swimlanesDiagram-G3AALYLV-KQfs0uk_.js +8 -0
  113. package/dist/{gui/assets/timeline-definition-FHXFAJF6-DtLX54bg.js → gui-mobile/assets/timeline-definition-FHXFAJF6-4sNUiJhu.js} +1 -1
  114. package/dist/gui-mobile/assets/{vennDiagram-L72KCM5P-BwbuZWM5.js → vennDiagram-L72KCM5P-BzbSNpD8.js} +1 -1
  115. package/dist/gui-mobile/assets/{wardleyDiagram-EHGQE667-CIyvw8Ss.js → wardleyDiagram-EHGQE667-Ic4j9Roh.js} +1 -1
  116. package/dist/{gui/assets/xychartDiagram-FW5EYKEG-BUx7LrAa.js → gui-mobile/assets/xychartDiagram-FW5EYKEG-CE3h4iVU.js} +1 -1
  117. package/dist/gui-mobile/index.html +2 -2
  118. package/dist/gui-mobile/sw.js +1 -1
  119. package/dist/service/agent-sdk/types.d.ts +19 -0
  120. package/package.json +1 -1
  121. package/dist/gui/assets/channel-Ctk8Mzxv.js +0 -1
  122. package/dist/gui/assets/classDiagram-OUVF2IWQ-CdX03Kq_.js +0 -1
  123. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-CdX03Kq_.js +0 -1
  124. package/dist/gui/assets/index-BX4uV__j.css +0 -1
  125. package/dist/gui/assets/index-JL9p240A.js +0 -41
  126. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-CsxzEgZO.js +0 -1
  127. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-DgybLg8h.js +0 -8
  128. package/dist/gui-mobile/assets/channel-DZQuFUOP.js +0 -1
  129. package/dist/gui-mobile/assets/classDiagram-OUVF2IWQ-Ef3O_Gur.js +0 -1
  130. package/dist/gui-mobile/assets/classDiagram-v2-EOCWNBFH-Ef3O_Gur.js +0 -1
  131. package/dist/gui-mobile/assets/index-D4ldI3yk.js +0 -33
  132. package/dist/gui-mobile/assets/index-fVo_kT1f.css +0 -1
  133. package/dist/gui-mobile/assets/stateDiagram-v2-6OUMAXLB-C3kfseLl.js +0 -1
  134. package/dist/gui-mobile/assets/swimlanesDiagram-G3AALYLV-HFAz5nU-.js +0 -8
package/dist/cli/index.js CHANGED
@@ -37,7 +37,7 @@ import { EventEmitter } from "node:events";
37
37
  import { createInterface as createInterface$1 } from "node:readline/promises";
38
38
  import MarkdownIt from "markdown-it";
39
39
  const name = "@yorz/cli";
40
- const version = "0.13.0";
40
+ const version = "0.14.0";
41
41
  const type = "module";
42
42
  const description = "";
43
43
  const bin = { "yorz": "./dist/cli/index.js" };
@@ -866,12 +866,22 @@ function mimeForExt(ext) {
866
866
  }
867
867
  class AttachmentStore {
868
868
  root;
869
+ /**
870
+ * Chat attachments are copied here on send so they survive the draft root's
871
+ * 24h TTL sweep — the Chat panel re-reads history long after a draft is gone.
872
+ * Kept under `.yorz/tmp` (gitignored) so chat images never enter git, unlike
873
+ * spec-referenced attachments which do. Keyed by draftId (stable, already
874
+ * embedded in the transcript's `![](…)` path) rather than sessionId, which
875
+ * `session-manager.reconcile` can rewrite mid-run.
876
+ */
877
+ chatRoot;
869
878
  maxFileSize;
870
879
  maxCount;
871
880
  ttlMs;
872
881
  now;
873
882
  constructor(opts) {
874
883
  this.root = join(opts.cwd, ".yorz", "tmp", "drafts");
884
+ this.chatRoot = join(opts.cwd, ".yorz", "tmp", "chat-attachments");
875
885
  this.maxFileSize = opts.maxFileSize ?? DEFAULT_MAX_FILE_SIZE;
876
886
  this.maxCount = opts.maxCount ?? DEFAULT_MAX_COUNT;
877
887
  this.ttlMs = opts.ttlMs ?? DEFAULT_TTL_MS$1;
@@ -880,6 +890,37 @@ class AttachmentStore {
880
890
  get draftsDir() {
881
891
  return this.root;
882
892
  }
893
+ chatAttachmentsDir(draftId) {
894
+ return join(this.chatRoot, draftId, "attachments");
895
+ }
896
+ /**
897
+ * Copy a draft's attachments into the persistent chat root so they outlive the
898
+ * draft TTL. Idempotent: skips when the target already exists, no-ops when the
899
+ * source draft is gone. Returns true when the chat copy exists afterwards.
900
+ */
901
+ async promoteDraftToChat(draftId) {
902
+ const from = this.draftAttachmentsDir(draftId);
903
+ const to = this.chatAttachmentsDir(draftId);
904
+ if (existsSync(to)) return true;
905
+ if (!existsSync(from)) return false;
906
+ await mkdir(join(this.chatRoot, draftId), { recursive: true });
907
+ await cp(from, to, { recursive: true });
908
+ return true;
909
+ }
910
+ async readChatAttachment(draftId, storedName) {
911
+ if (!isSafeName(storedName)) {
912
+ throw new AttachmentStoreError("invalid_name", `invalid attachment name: ${storedName}`);
913
+ }
914
+ const file = join(this.chatAttachmentsDir(draftId), storedName);
915
+ if (!existsSync(file)) {
916
+ throw new AttachmentStoreError("attachment_not_found", `attachment not found: ${storedName}`);
917
+ }
918
+ const data = await readFile(file);
919
+ const ext = extname(storedName).toLowerCase();
920
+ const mime = mimeForExt(ext);
921
+ const kind = classifyMime(mime);
922
+ return { data, mime, kind };
923
+ }
883
924
  async ensureRoot() {
884
925
  await mkdir(this.root, { recursive: true });
885
926
  }
@@ -2443,7 +2484,7 @@ async function loadCustomInstructions(projectPath) {
2443
2484
  const DRAFT_ID_RE = /^[a-zA-Z0-9-]{1,64}$/;
2444
2485
  function buildChatPrompt(prompt, draftId, attachments) {
2445
2486
  if (attachments.length === 0) return prompt;
2446
- const dir = `.yorz/tmp/drafts/${draftId}/attachments`;
2487
+ const dir = `.yorz/tmp/chat-attachments/${draftId}/attachments`;
2447
2488
  const lines = attachments.map((a) => {
2448
2489
  const rel = `${dir}/${a.storedName}`;
2449
2490
  return a.kind === "image" ? `- ![${a.name}](${rel})` : `- [${a.name}](${rel})`;
@@ -2498,12 +2539,29 @@ function createSessionsRoutes(resolveProject) {
2498
2539
  const kind = typeof body.agentKind === "string" && descriptors.some((d) => d.id === body.agentKind) ? body.agentKind : void 0;
2499
2540
  const title = typeof body.title === "string" ? body.title : void 0;
2500
2541
  try {
2542
+ if (body.groupFromSessionId !== void 0) {
2543
+ if (typeof body.groupFromSessionId !== "string" || !body.groupFromSessionId.trim()) {
2544
+ return c.json({ error: "groupFromSessionId must be a non-empty string" }, 400);
2545
+ }
2546
+ const created2 = await p.sessions.createSessionInGroup(body.groupFromSessionId.trim());
2547
+ if (!created2) return c.json({ error: "source session not found" }, 404);
2548
+ return c.json(created2, 201);
2549
+ }
2501
2550
  const created = await p.sessions.createSession(kind, title);
2502
2551
  return c.json(created, 201);
2503
2552
  } catch (err) {
2504
2553
  return c.json({ error: err.message }, 500);
2505
2554
  }
2506
2555
  });
2556
+ app.get("/projects/:projectId/session-groups/:groupId/messages", async (c) => {
2557
+ const p = await need(c);
2558
+ if (p instanceof Response) return p;
2559
+ try {
2560
+ return c.json(await p.sessions.getSessionGroupMessages(c.req.param("groupId")));
2561
+ } catch (err) {
2562
+ return c.json({ error: err.message }, 500);
2563
+ }
2564
+ });
2507
2565
  app.get("/projects/:projectId/specs/:id/session", async (c) => {
2508
2566
  const p = await need(c);
2509
2567
  if (p instanceof Response) return p;
@@ -2562,6 +2620,8 @@ function createSessionsRoutes(resolveProject) {
2562
2620
  const draftId = body.draftId;
2563
2621
  if (await p.attachments.draftExists(draftId)) {
2564
2622
  const metas = await p.attachments.listAttachments(draftId);
2623
+ await p.attachments.promoteDraftToChat(draftId).catch(() => {
2624
+ });
2565
2625
  finalPrompt = buildChatPrompt(finalPrompt, draftId, metas);
2566
2626
  }
2567
2627
  }
@@ -2771,6 +2831,8 @@ async function discard(cwd, opts) {
2771
2831
  }
2772
2832
  const MAX_PATCH_BYTES = 512 * 1024;
2773
2833
  const MAX_PATCH_LINES = 3e3;
2834
+ const GIT_HISTORY_PAGE_SIZE = 20;
2835
+ const GIT_HISTORY_SCAN_BATCH = 200;
2774
2836
  function truncatePatch(patch) {
2775
2837
  let text = patch;
2776
2838
  let truncated = false;
@@ -2785,6 +2847,13 @@ function truncatePatch(patch) {
2785
2847
  }
2786
2848
  return { patch: text, truncated };
2787
2849
  }
2850
+ function patchResult(path, raw) {
2851
+ if (!raw.includes("@@") && /^Binary files .* differ$/m.test(raw)) {
2852
+ return { path, patch: "", binary: true, truncated: false };
2853
+ }
2854
+ const { patch, truncated } = truncatePatch(raw);
2855
+ return { path, patch, binary: false, truncated };
2856
+ }
2788
2857
  async function untrackedDiff(cwd, path) {
2789
2858
  let buf;
2790
2859
  try {
@@ -2814,12 +2883,117 @@ async function fileDiff(cwd, path) {
2814
2883
  if (res.code !== 0 && !res.stdout) {
2815
2884
  throw new GitError("git_failed", res.stderr.trim() || "git diff failed", res.stderr);
2816
2885
  }
2817
- const raw = res.stdout;
2818
- if (!raw.includes("@@") && /^Binary files .* differ$/m.test(raw)) {
2819
- return { path, patch: "", binary: true, truncated: false };
2886
+ return patchResult(path, res.stdout);
2887
+ }
2888
+ function parseHistoryBatch(raw) {
2889
+ const fields = raw.split("\0");
2890
+ const commits = [];
2891
+ for (let i = 0; i + 4 < fields.length; i += 5) {
2892
+ const sha = fields[i]?.trim() ?? "";
2893
+ const committedAt = fields[i + 1]?.trim() ?? "";
2894
+ const authorName = fields[i + 2]?.trim() ?? "";
2895
+ const authorEmail = fields[i + 3]?.trim() ?? "";
2896
+ const subject = fields[i + 4]?.trim() ?? "";
2897
+ if (!/^[0-9a-f]{40}$/i.test(sha)) continue;
2898
+ commits.push({ sha, subject, authorName, authorEmail, committedAt });
2899
+ }
2900
+ return commits;
2901
+ }
2902
+ async function historyBatch(cwd, cursor, count) {
2903
+ const { stdout } = await runGit(cwd, [
2904
+ "log",
2905
+ "HEAD",
2906
+ `--skip=${cursor}`,
2907
+ `--max-count=${count}`,
2908
+ "--format=%H%x00%cI%x00%an%x00%ae%x00%s%x00"
2909
+ ]);
2910
+ return parseHistoryBatch(stdout);
2911
+ }
2912
+ async function listHistory(cwd, opts = {}) {
2913
+ const cursor = opts.cursor ?? 0;
2914
+ if (!Number.isSafeInteger(cursor) || cursor < 0) {
2915
+ throw new GitError("invalid_cursor", "cursor must be a non-negative integer");
2916
+ }
2917
+ const head = await runGitRaw(cwd, ["rev-parse", "--verify", "HEAD"]);
2918
+ if (head.code !== 0) return { commits: [], nextCursor: null };
2919
+ const query2 = opts.query?.trim().toLowerCase() ?? "";
2920
+ const batchSize = query2 ? GIT_HISTORY_SCAN_BATCH : GIT_HISTORY_PAGE_SIZE + 1;
2921
+ const commits = [];
2922
+ let scanCursor = cursor;
2923
+ for (; ; ) {
2924
+ const batch = await historyBatch(cwd, scanCursor, batchSize);
2925
+ if (batch.length === 0) return { commits, nextCursor: null };
2926
+ for (const commit2 of batch) {
2927
+ const matches = !query2 || commit2.subject.toLowerCase().includes(query2) || commit2.authorName.toLowerCase().includes(query2) || commit2.authorEmail.toLowerCase().includes(query2);
2928
+ if (matches) {
2929
+ if (commits.length === GIT_HISTORY_PAGE_SIZE) {
2930
+ return { commits, nextCursor: scanCursor };
2931
+ }
2932
+ commits.push(commit2);
2933
+ }
2934
+ scanCursor += 1;
2935
+ }
2936
+ if (batch.length < batchSize) return { commits, nextCursor: null };
2937
+ }
2938
+ }
2939
+ async function assertCommit(cwd, sha) {
2940
+ const commit2 = sha.trim();
2941
+ if (!/^[0-9a-f]{40}$/i.test(commit2)) {
2942
+ throw new GitError("invalid_commit", "commit must be a full 40-character SHA");
2943
+ }
2944
+ const exists = await runGitRaw(cwd, ["cat-file", "-e", `${commit2}^{commit}`]);
2945
+ if (exists.code !== 0) throw new GitError("invalid_commit", "commit does not exist");
2946
+ return commit2;
2947
+ }
2948
+ async function firstParent(cwd, commit2) {
2949
+ const { stdout } = await runGit(cwd, ["rev-list", "--parents", "-n", "1", commit2]);
2950
+ return stdout.trim().split(/\s+/)[1] ?? null;
2951
+ }
2952
+ async function listCommitFiles(cwd, sha) {
2953
+ const commit2 = await assertCommit(cwd, sha);
2954
+ const parent = await firstParent(cwd, commit2);
2955
+ const args = [
2956
+ "diff-tree",
2957
+ "--no-commit-id",
2958
+ "--name-status",
2959
+ "-r",
2960
+ "-z",
2961
+ "-M",
2962
+ ...parent ? [parent, commit2] : ["--root", commit2]
2963
+ ];
2964
+ const { stdout } = await runGit(cwd, args);
2965
+ const fields = stdout.split("\0");
2966
+ const files2 = [];
2967
+ for (let i = 0; i < fields.length; ) {
2968
+ const rawStatus = fields[i++] ?? "";
2969
+ if (!rawStatus) continue;
2970
+ const status = rawStatus[0] ?? rawStatus;
2971
+ if (status === "R" || status === "C") {
2972
+ const renamedFrom = fields[i++] ?? "";
2973
+ const path2 = fields[i++] ?? "";
2974
+ if (path2) files2.push({ path: path2, status, ...renamedFrom ? { renamedFrom } : {} });
2975
+ continue;
2976
+ }
2977
+ const path = fields[i++] ?? "";
2978
+ if (path) files2.push({ path, status });
2820
2979
  }
2821
- const { patch, truncated } = truncatePatch(raw);
2822
- return { path, patch, binary: false, truncated };
2980
+ return files2;
2981
+ }
2982
+ async function commitFileDiff(cwd, sha, path) {
2983
+ assertSafeRelativePath(cwd, path);
2984
+ const commit2 = await assertCommit(cwd, sha);
2985
+ const file = (await listCommitFiles(cwd, commit2)).find((entry) => entry.path === path);
2986
+ if (!file) throw new GitError("invalid_path", "path is not changed by this commit");
2987
+ const pathArgs = file.renamedFrom ? [file.renamedFrom, file.path] : [file.path];
2988
+ const parent = await firstParent(cwd, commit2);
2989
+ const res = await runGitRaw(
2990
+ cwd,
2991
+ parent ? ["diff", "--find-renames", "--no-ext-diff", parent, commit2, "--", ...pathArgs] : ["show", "--format=", "--find-renames", "--no-ext-diff", commit2, "--", ...pathArgs]
2992
+ );
2993
+ if (res.code !== 0 && !res.stdout) {
2994
+ throw new GitError("git_failed", res.stderr.trim() || "git show failed", res.stderr);
2995
+ }
2996
+ return patchResult(path, res.stdout);
2823
2997
  }
2824
2998
  async function currentBranch(cwd) {
2825
2999
  const { stdout } = await runGit(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]);
@@ -3134,6 +3308,45 @@ function createGitRoutes(resolveProject) {
3134
3308
  throw err;
3135
3309
  }
3136
3310
  });
3311
+ app.get("/projects/:projectId/git/history", async (c) => {
3312
+ const p = await need(c);
3313
+ if (p instanceof Response) return p;
3314
+ const rawCursor = c.req.query("cursor");
3315
+ const cursor = rawCursor === void 0 || rawCursor === "" ? 0 : Number(rawCursor);
3316
+ try {
3317
+ return c.json(
3318
+ await listHistory(p.path, {
3319
+ query: c.req.query("q") ?? "",
3320
+ cursor
3321
+ })
3322
+ );
3323
+ } catch (err) {
3324
+ if (err instanceof GitError) return gitFail(c, err);
3325
+ throw err;
3326
+ }
3327
+ });
3328
+ app.get("/projects/:projectId/git/history/:sha/files", async (c) => {
3329
+ const p = await need(c);
3330
+ if (p instanceof Response) return p;
3331
+ try {
3332
+ return c.json({ files: await listCommitFiles(p.path, c.req.param("sha") ?? "") });
3333
+ } catch (err) {
3334
+ if (err instanceof GitError) return gitFail(c, err);
3335
+ throw err;
3336
+ }
3337
+ });
3338
+ app.get("/projects/:projectId/git/history/:sha/diff", async (c) => {
3339
+ const p = await need(c);
3340
+ if (p instanceof Response) return p;
3341
+ const path = c.req.query("path") ?? "";
3342
+ if (!path) return c.json({ error: "path required" }, 400);
3343
+ try {
3344
+ return c.json(await commitFileDiff(p.path, c.req.param("sha") ?? "", path));
3345
+ } catch (err) {
3346
+ if (err instanceof GitError) return gitFail(c, err);
3347
+ throw err;
3348
+ }
3349
+ });
3137
3350
  app.get("/projects/:projectId/git/branches", async (c) => {
3138
3351
  const p = await need(c);
3139
3352
  if (p instanceof Response) return p;
@@ -3994,6 +4207,30 @@ function isClaudeEffort(value) {
3994
4207
  function toOption(id) {
3995
4208
  return { id, displayName: id };
3996
4209
  }
4210
+ function imageFromSource(source) {
4211
+ if (!source || typeof source !== "object") return null;
4212
+ const s = source;
4213
+ if (s.type === "base64" && typeof s.data === "string") {
4214
+ const mime = typeof s.media_type === "string" ? s.media_type : "image/png";
4215
+ return { data: `data:${mime};base64,${s.data}`, mime };
4216
+ }
4217
+ if (s.type === "url" && typeof s.url === "string") {
4218
+ const mime = typeof s.media_type === "string" ? s.media_type : "image/*";
4219
+ return { data: s.url, mime };
4220
+ }
4221
+ return null;
4222
+ }
4223
+ function imagesFromToolResult(content) {
4224
+ if (!Array.isArray(content)) return [];
4225
+ const out = [];
4226
+ for (const c of content) {
4227
+ if (c && typeof c === "object" && c.type === "image") {
4228
+ const img = imageFromSource(c.source);
4229
+ if (img) out.push(img);
4230
+ }
4231
+ }
4232
+ return out;
4233
+ }
3997
4234
  function blocksFrom(message) {
3998
4235
  if (!message || typeof message !== "object") return [];
3999
4236
  const content = message.content;
@@ -4007,6 +4244,8 @@ function toolResultText$1(content) {
4007
4244
  for (const c of content) {
4008
4245
  if (c && typeof c === "object" && typeof c.text === "string") {
4009
4246
  acc += c.text;
4247
+ } else if (c && typeof c === "object" && c.type === "image") {
4248
+ continue;
4010
4249
  } else {
4011
4250
  acc += JSON.stringify(c);
4012
4251
  }
@@ -4125,12 +4364,18 @@ class ClaudeSession {
4125
4364
  } else if (b.type === "tool_use") {
4126
4365
  if (!planPhase && isSpecWrite("claude", b.name, b.input)) planPhase = phase.snapshot();
4127
4366
  yield { type: "tool-use", name: String(b.name ?? "?"), input: b.input ?? {} };
4367
+ } else if (b.type === "image") {
4368
+ const img = imageFromSource(b.source);
4369
+ if (img) yield { type: "image", data: img.data, mime: img.mime };
4128
4370
  }
4129
4371
  }
4130
4372
  } else if (m.type === "user") {
4131
4373
  for (const b of blocksFrom(m.message)) {
4132
4374
  if (b.type === "tool_result") {
4133
4375
  yield { type: "tool-result", text: toolResultText$1(b.content) };
4376
+ for (const img of imagesFromToolResult(b.content)) {
4377
+ yield { type: "image", data: img.data, mime: img.mime };
4378
+ }
4134
4379
  }
4135
4380
  }
4136
4381
  } else if (m.type === "result") {
@@ -4233,6 +4478,12 @@ class ClaudeAdapter {
4233
4478
  parts.push({ type: "tool-use", name: String(b.name ?? "?"), input: b.input ?? {} });
4234
4479
  } else if (b.type === "tool_result") {
4235
4480
  parts.push({ type: "tool-result", text: toolResultText$1(b.content) });
4481
+ for (const img of imagesFromToolResult(b.content)) {
4482
+ parts.push({ type: "image", data: img.data, mime: img.mime });
4483
+ }
4484
+ } else if (b.type === "image") {
4485
+ const img = imageFromSource(b.source);
4486
+ if (img) parts.push({ type: "image", data: img.data, mime: img.mime });
4236
4487
  }
4237
4488
  }
4238
4489
  if (parts.length) out.push({ role: entry.type, parts });
@@ -19128,6 +19379,21 @@ function createSpecDraftsRoutes(resolveProject) {
19128
19379
  return errorResponse(c, err);
19129
19380
  }
19130
19381
  });
19382
+ app.get("/projects/:projectId/chat-attachments/:draftId/:storedName", async (c) => {
19383
+ const p = await need(c);
19384
+ if (p instanceof Response) return p;
19385
+ const draftId = c.req.param("draftId");
19386
+ const storedName = c.req.param("storedName");
19387
+ try {
19388
+ const { data, mime } = await p.attachments.readChatAttachment(draftId, storedName);
19389
+ c.header("Content-Type", mime);
19390
+ c.header("Content-Disposition", "inline");
19391
+ c.header("Cache-Control", "max-age=300");
19392
+ return c.body(new Uint8Array(data));
19393
+ } catch (err) {
19394
+ return errorResponse(c, err);
19395
+ }
19396
+ });
19131
19397
  return app;
19132
19398
  }
19133
19399
  function errorResponse(c, err) {
@@ -20706,6 +20972,11 @@ class SessionStore {
20706
20972
  const items = await this.load();
20707
20973
  return items.filter((s) => s.specId === specId).sort((a, b) => a.createdAt - b.createdAt);
20708
20974
  }
20975
+ /** Every plain-chat session in one UI row, oldest first. */
20976
+ async listByGroup(groupId) {
20977
+ const items = await this.load();
20978
+ return items.filter((s) => !s.specId && (s.groupId === groupId || !s.groupId && s.id === groupId)).sort((a, b) => a.createdAt - b.createdAt);
20979
+ }
20709
20980
  /** The spec's most recently active session — where user-driven turns land. */
20710
20981
  async latestBySpec(specId) {
20711
20982
  const items = await this.load();
@@ -20723,10 +20994,11 @@ class SessionStore {
20723
20994
  else items.push(info);
20724
20995
  await this.persist();
20725
20996
  }
20726
- async create(kind, id, title, specId) {
20997
+ async create(kind, id, title, specId, groupId) {
20727
20998
  const now = this.stamp();
20728
20999
  const info = { id, title, kind, createdAt: now, updatedAt: now };
20729
21000
  if (specId) info.specId = specId;
21001
+ else if (groupId) info.groupId = groupId;
20730
21002
  await this.upsert(info);
20731
21003
  return info;
20732
21004
  }
@@ -20753,6 +21025,16 @@ class SessionStore {
20753
21025
  const entry = items.find((s) => s.id === id);
20754
21026
  if (!entry) return false;
20755
21027
  entry.specId = specId;
21028
+ delete entry.groupId;
21029
+ entry.updatedAt = this.stamp();
21030
+ await this.persist();
21031
+ return true;
21032
+ }
21033
+ async bindGroup(id, groupId) {
21034
+ const items = await this.load();
21035
+ const entry = items.find((s) => s.id === id);
21036
+ if (!entry || entry.specId) return false;
21037
+ entry.groupId = groupId;
20756
21038
  entry.updatedAt = this.stamp();
20757
21039
  await this.persist();
20758
21040
  return true;
@@ -21929,14 +22211,20 @@ class SessionManager {
21929
22211
  }
21930
22212
  return e;
21931
22213
  }
21932
- async createSession(kind, title, specId) {
22214
+ async createSession(kind, title, specId, groupId) {
21933
22215
  const k = kind ?? this.defaultKind;
21934
22216
  const adapter = await this.adapters.get(k);
21935
22217
  const runtime = k === this.defaultKind ? this.defaultRuntime : {};
21936
22218
  const session = await adapter.createSession({ ...title ? { title } : {}, ...runtime });
21937
22219
  const sessionId = session.id || randomUUID();
21938
22220
  this.live.set(sessionId, { kind: k, session });
21939
- await this.store.create(k, sessionId, title ?? "", specId);
22221
+ await this.store.create(
22222
+ k,
22223
+ sessionId,
22224
+ title ?? "",
22225
+ specId,
22226
+ specId ? void 0 : groupId ?? sessionId
22227
+ );
21940
22228
  return { sessionId, kind: k };
21941
22229
  }
21942
22230
  /**
@@ -21965,6 +22253,21 @@ class SessionManager {
21965
22253
  async createSessionForSpec(specId) {
21966
22254
  return this.createSession(void 0, specId, specId);
21967
22255
  }
22256
+ /** Mint a fresh session in the same UI row as an existing session. */
22257
+ async createSessionInGroup(sourceSessionId) {
22258
+ let source = await this.store.get(sourceSessionId);
22259
+ if (!source) {
22260
+ source = (await this.listSessions()).find((s) => s.id === sourceSessionId);
22261
+ if (!source) return null;
22262
+ const { running: _running, ...persisted } = source;
22263
+ await this.store.upsert(persisted);
22264
+ }
22265
+ if (source.specId) return this.createSessionForSpec(source.specId);
22266
+ const groupId = source.groupId ?? source.id;
22267
+ if (!source.groupId) await this.store.bindGroup(source.id, groupId);
22268
+ const title = isOpaqueTitle(source.title, source.id) ? void 0 : source.title;
22269
+ return this.createSession(void 0, title, void 0, groupId);
22270
+ }
21968
22271
  /**
21969
22272
  * The spec's most recent session, created on demand. Used by user-driven
21970
22273
  * rounds (explain, chat) whose value comes from continuing the conversation
@@ -22116,6 +22419,17 @@ class SessionManager {
22116
22419
  }))
22117
22420
  );
22118
22421
  }
22422
+ async getSessionGroupMessages(groupId) {
22423
+ const sessions = await this.store.listByGroup(groupId);
22424
+ return Promise.all(
22425
+ sessions.map(async (s) => ({
22426
+ sessionId: s.id,
22427
+ kind: s.kind,
22428
+ createdAt: s.createdAt,
22429
+ messages: await this.getMessages(s.id).catch(() => [])
22430
+ }))
22431
+ );
22432
+ }
22119
22433
  async getUsageStatus() {
22120
22434
  const adapter = await this.adapters.get(this.defaultKind);
22121
22435
  if (!adapter.capabilities().usageStatus || !adapter.getUsageStatus) {
@@ -1 +1 @@
1
- import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-BQ-Mu9Ua.js";import{p as f}from"./chunk-JWPE2WC7--G0oyo9O.js";import{_ as n,l as o}from"./mermaid.core-DHOOjgm_.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-CgdsCBRp.js";import"./index-JL9p240A.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
1
+ import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-u0_j3hH3.js";import{p as f}from"./chunk-JWPE2WC7-HEpHfS7t.js";import{_ as n,l as o}from"./mermaid.core-ChZsXg3q.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-DKOvpOnu.js";import"./index-CnBmykN1.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
@@ -1 +1 @@
1
- import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-DvnVINHy.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-ChZsXg3q.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};