@appsoftwareltd/etherpk-mcp 0.19.4 → 0.20.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 (140) hide show
  1. package/README.md +5 -1
  2. package/dist/drawing-page/assets/{abnfDiagram-N423BO3Z-CESuDXS9.js → abnfDiagram-N423BO3Z-D8OWVggw.js} +1 -1
  3. package/dist/drawing-page/assets/{ar-SA-G6X2FPQ2-BxYfG_4w.js → ar-SA-G6X2FPQ2-BsVAczME.js} +1 -1
  4. package/dist/drawing-page/assets/{arc-DKLVGaIz.js → arc-Y4DAzUBl.js} +1 -1
  5. package/dist/drawing-page/assets/{architectureDiagram-T3A2C74G-CGXZt2s5.js → architectureDiagram-T3A2C74G-Cz1L9ghf.js} +1 -1
  6. package/dist/drawing-page/assets/{az-AZ-76LH7QW2-CmORYk3r.js → az-AZ-76LH7QW2-Bqye8SiI.js} +1 -1
  7. package/dist/drawing-page/assets/{bg-BG-XCXSNQG7-CueRTQtz.js → bg-BG-XCXSNQG7-asUbixpL.js} +1 -1
  8. package/dist/drawing-page/assets/{blockDiagram-VBNYF7ZC-CrWptAUX.js → blockDiagram-VBNYF7ZC-DyXHdjs9.js} +1 -1
  9. package/dist/drawing-page/assets/{bn-BD-2XOGV67Q-BfLU6g3f.js → bn-BD-2XOGV67Q-CBYUnCH7.js} +1 -1
  10. package/dist/drawing-page/assets/{c4Diagram-5PPSVZJV-Cc4bJvZb.js → c4Diagram-5PPSVZJV-BhjosCS6.js} +1 -1
  11. package/dist/drawing-page/assets/{ca-ES-6MX7JW3Y-CoTtS-84.js → ca-ES-6MX7JW3Y-C4bGnaRX.js} +1 -1
  12. package/dist/drawing-page/assets/channel-DS9pcdIs.js +1 -0
  13. package/dist/drawing-page/assets/{chunk-2GRJ4B5K-DcSwK2S2.js → chunk-2GRJ4B5K-Buq_N5c0.js} +1 -1
  14. package/dist/drawing-page/assets/{chunk-4I5QYGJK-DneDyAZt.js → chunk-4I5QYGJK-Bl8Z8LVy.js} +1 -1
  15. package/dist/drawing-page/assets/{chunk-5RXB4S5H-B8cC2Isj.js → chunk-5RXB4S5H-DE4YEvsJ.js} +1 -1
  16. package/dist/drawing-page/assets/{chunk-6Q2QTUOP-FSofyzu7.js → chunk-6Q2QTUOP-kbEK7SHm.js} +1 -1
  17. package/dist/drawing-page/assets/{chunk-7Z6QIM7H-Czjy6v_N.js → chunk-7Z6QIM7H-Be4sL324.js} +1 -1
  18. package/dist/drawing-page/assets/{chunk-GF5L2VYU-D7C4sksR.js → chunk-GF5L2VYU-Ydi_RicV.js} +1 -1
  19. package/dist/drawing-page/assets/{chunk-I66GZJ75-eQyCt4m7.js → chunk-I66GZJ75-C2Z4jtZy.js} +1 -1
  20. package/dist/drawing-page/assets/{chunk-JQJVKLGR-BP6tAsN9.js → chunk-JQJVKLGR-B80bvrZd.js} +1 -1
  21. package/dist/drawing-page/assets/{chunk-KBJHAD2P-C5PM9_Z3.js → chunk-KBJHAD2P-BAvZlShA.js} +1 -1
  22. package/dist/drawing-page/assets/{chunk-NSK5VX7P-CSBZRlGI.js → chunk-NSK5VX7P-BdEZvUp3.js} +1 -1
  23. package/dist/drawing-page/assets/{chunk-QR6OTTB3-ArIwTbsg.js → chunk-QR6OTTB3-DRMRhUJT.js} +1 -1
  24. package/dist/drawing-page/assets/{chunk-RYQCIY6F-r64JZc1V.js → chunk-RYQCIY6F-CQl9Ntnt.js} +1 -1
  25. package/dist/drawing-page/assets/{chunk-UBXNYLIW-DCDJQ_uV.js → chunk-UBXNYLIW-Bd9Q_n7K.js} +1 -1
  26. package/dist/drawing-page/assets/{chunk-W5SLKNZC-DVmpr6gi.js → chunk-W5SLKNZC-DWSon6sa.js} +1 -1
  27. package/dist/drawing-page/assets/{chunk-WRU74C26-CBC9mgCI.js → chunk-WRU74C26-IUs_bJSX.js} +1 -1
  28. package/dist/drawing-page/assets/{chunk-XXDRQBXY-D1NataVh.js → chunk-XXDRQBXY-CHyUWQko.js} +1 -1
  29. package/dist/drawing-page/assets/classDiagram-JCYQIIEL-DzQM8hoW.js +1 -0
  30. package/dist/drawing-page/assets/classDiagram-v2-OCEON4UE-DzQM8hoW.js +1 -0
  31. package/dist/drawing-page/assets/{client-CX293Fae.js → client-DZUoshau.js} +1 -1
  32. package/dist/drawing-page/assets/{cose-bilkent-JH36ORCC-CPalPD7U.js → cose-bilkent-JH36ORCC-B2IOQydr.js} +1 -1
  33. package/dist/drawing-page/assets/{cs-CZ-2BRQDIVT-JneBadmf.js → cs-CZ-2BRQDIVT-2eGnB8k8.js} +1 -1
  34. package/dist/drawing-page/assets/{cynefinDiagram-MW4NZA55-6UGHnaXm.js → cynefinDiagram-MW4NZA55-BBR5L_qc.js} +1 -1
  35. package/dist/drawing-page/assets/{da-DK-5WZEPLOC-MyYyPsgH.js → da-DK-5WZEPLOC-CyBLbPbT.js} +1 -1
  36. package/dist/drawing-page/assets/{dagre-VZM6K2ZE-Cq2tBCTV.js → dagre-VZM6K2ZE-CmtH_NsG.js} +1 -1
  37. package/dist/drawing-page/assets/{de-DE-XR44H4JA-C5sxzBO0.js → de-DE-XR44H4JA-DXW5rzjb.js} +1 -1
  38. package/dist/drawing-page/assets/{diagram-7IWD3JNH-CSFNaVMQ.js → diagram-7IWD3JNH-DrmVlUuB.js} +1 -1
  39. package/dist/drawing-page/assets/{diagram-B4RE2ZJO-DERYVA6I.js → diagram-B4RE2ZJO-DKj0DZ37.js} +1 -1
  40. package/dist/drawing-page/assets/{diagram-LBJQPF4R-BZLgpVLi.js → diagram-LBJQPF4R-Cl9_05Rh.js} +1 -1
  41. package/dist/drawing-page/assets/{diagram-Q27KOJAE-CW8RthgJ.js → diagram-Q27KOJAE-DYeXQLno.js} +1 -1
  42. package/dist/drawing-page/assets/{diagram-UB23O5K3-DtMRLexl.js → diagram-UB23O5K3-R3YIOKDN.js} +1 -1
  43. package/dist/drawing-page/assets/{dist-CBR8fdSM.js → dist-Bip7SX9b.js} +6 -6
  44. package/dist/drawing-page/assets/{dist-pj5P0X0N.js → dist-DBTArFLM.js} +1 -1
  45. package/dist/drawing-page/assets/{ebnfDiagram-BXEA7PRR-DKlWK14b.js → ebnfDiagram-BXEA7PRR-D5WCgRZP.js} +1 -1
  46. package/dist/drawing-page/assets/{el-GR-BZB4AONW-BDF9TGyK.js → el-GR-BZB4AONW-CADjKmTB.js} +1 -1
  47. package/dist/drawing-page/assets/{en-B4ZKOASM-DQptt87B.js → en-B4ZKOASM-C7v1BS8o.js} +1 -1
  48. package/dist/drawing-page/assets/{erDiagram-JOGREHBK-C8jQzl05.js → erDiagram-JOGREHBK-BR1DC0W8.js} +1 -1
  49. package/dist/drawing-page/assets/{es-ES-U4NZUMDT-CvMMDbja.js → es-ES-U4NZUMDT-C5_USRPz.js} +1 -1
  50. package/dist/drawing-page/assets/{eu-ES-A7QVB2H4-Azi3qer2.js → eu-ES-A7QVB2H4-Bh-Tlgte.js} +1 -1
  51. package/dist/drawing-page/assets/{fa-IR-HGAKTJCU-CcB_2DLJ.js → fa-IR-HGAKTJCU-DIWd51q2.js} +1 -1
  52. package/dist/drawing-page/assets/{fi-FI-Z5N7JZ37-Cfhwoabd.js → fi-FI-Z5N7JZ37-AF3JZRRl.js} +1 -1
  53. package/dist/drawing-page/assets/flowDiagram-UKHOOZJN-BxlljAAj.js +1 -0
  54. package/dist/drawing-page/assets/{fr-FR-RHASNOE6-CtRkYaA9.js → fr-FR-RHASNOE6-P6MTmYPf.js} +1 -1
  55. package/dist/drawing-page/assets/{ganttDiagram-PKOTCBZU-BlOkl0Ml.js → ganttDiagram-PKOTCBZU-BNF-Xqfv.js} +1 -1
  56. package/dist/drawing-page/assets/{gitGraphDiagram-DS77QQ5N-nNmXQTuR.js → gitGraphDiagram-DS77QQ5N-DbMDTDRm.js} +1 -1
  57. package/dist/drawing-page/assets/{gl-ES-HMX3MZ6V-BYvext-h.js → gl-ES-HMX3MZ6V-D92Lwl1g.js} +1 -1
  58. package/dist/drawing-page/assets/{he-IL-6SHJWFNN-Ds0Iws-m.js → he-IL-6SHJWFNN-CF5QXU1O.js} +1 -1
  59. package/dist/drawing-page/assets/{hi-IN-IWLTKZ5I-C5-S2BYt.js → hi-IN-IWLTKZ5I-DCG9nnM5.js} +1 -1
  60. package/dist/drawing-page/assets/{hu-HU-A5ZG7DT2-BKp400E6.js → hu-HU-A5ZG7DT2-DqWC1pUc.js} +1 -1
  61. package/dist/drawing-page/assets/{id-ID-SAP4L64H-C0DZ4SF3.js → id-ID-SAP4L64H-NL4uPTqX.js} +1 -1
  62. package/dist/drawing-page/assets/{image-GAAHSSAO-CRETPnVQ.js → image-GAAHSSAO-ioAhIVlf.js} +1 -1
  63. package/dist/drawing-page/assets/{infoDiagram-6WML65LV-PbgVrt2v.js → infoDiagram-6WML65LV-sj0RgLXh.js} +1 -1
  64. package/dist/drawing-page/assets/{ishikawaDiagram-WSZJBQD7-oqiUmo-r.js → ishikawaDiagram-WSZJBQD7-CADsKhde.js} +1 -1
  65. package/dist/drawing-page/assets/{it-IT-JPQ66NNP-DqEW-1TC.js → it-IT-JPQ66NNP-C0BwfQO9.js} +1 -1
  66. package/dist/drawing-page/assets/{ja-JP-DBVTYXUO-BD5fy2g0.js → ja-JP-DBVTYXUO-Cywbh0wR.js} +1 -1
  67. package/dist/drawing-page/assets/{journeyDiagram-NVQOT4AX-Du1rIQY5.js → journeyDiagram-NVQOT4AX-DcOlSjLB.js} +1 -1
  68. package/dist/drawing-page/assets/{kaa-6HZHGXH3-JwewpKGA.js → kaa-6HZHGXH3-BiB4IMVP.js} +1 -1
  69. package/dist/drawing-page/assets/{kab-KAB-ZGHBKWFO-Ypv2Vt_S.js → kab-KAB-ZGHBKWFO-C6EOE5eo.js} +1 -1
  70. package/dist/drawing-page/assets/{kanban-definition-27J2QSJJ-D41YNdW5.js → kanban-definition-27J2QSJJ-CbKcjFOA.js} +1 -1
  71. package/dist/drawing-page/assets/{kk-KZ-P5N5QNE5-CW8QQBb4.js → kk-KZ-P5N5QNE5-ip1AEYXT.js} +1 -1
  72. package/dist/drawing-page/assets/{km-KH-HSX4SM5Z-Brql62o4.js → km-KH-HSX4SM5Z-DQs24dA3.js} +1 -1
  73. package/dist/drawing-page/assets/{ko-KR-MTYHY66A-B2AA9q3T.js → ko-KR-MTYHY66A-CAWadZAw.js} +1 -1
  74. package/dist/drawing-page/assets/{ku-TR-6OUDTVRD-wRfKM-UR.js → ku-TR-6OUDTVRD-C7tGdvI8.js} +1 -1
  75. package/dist/drawing-page/assets/{line-DR25GccZ.js → line-BEw28pZ8.js} +1 -1
  76. package/dist/drawing-page/assets/{linear-CgBNAElN.js → linear-0eaIpIui.js} +1 -1
  77. package/dist/drawing-page/assets/{lt-LT-XHIRWOB4-JLA_pCNn.js → lt-LT-XHIRWOB4-Qd0fa1dX.js} +1 -1
  78. package/dist/drawing-page/assets/{lv-LV-5QDEKY6T-Bm_FaNIi.js → lv-LV-5QDEKY6T-BoAOhYL4.js} +1 -1
  79. package/dist/drawing-page/assets/{mindmap-definition-FAOFIHXS-CIAkR1vw.js → mindmap-definition-FAOFIHXS-CDIxta_Q.js} +1 -1
  80. package/dist/drawing-page/assets/{mr-IN-CRQNXWMA-B1pSsBa2.js → mr-IN-CRQNXWMA-CS9yIl05.js} +1 -1
  81. package/dist/drawing-page/assets/{my-MM-5M5IBNSE-DEuiqvRE.js → my-MM-5M5IBNSE-Do5mbf6R.js} +1 -1
  82. package/dist/drawing-page/assets/{nb-NO-T6EIAALU-NgPXPjzu.js → nb-NO-T6EIAALU-DMJUR2cn.js} +1 -1
  83. package/dist/drawing-page/assets/{nl-NL-IS3SIHDZ-CEIThWDg.js → nl-NL-IS3SIHDZ-C1CpMJaC.js} +1 -1
  84. package/dist/drawing-page/assets/{nn-NO-6E72VCQL-CWaPfJ9b.js → nn-NO-6E72VCQL-Bw4IDI_E.js} +1 -1
  85. package/dist/drawing-page/assets/{oc-FR-POXYY2M6-DQI9Oi0b.js → oc-FR-POXYY2M6-PpxcOiLq.js} +1 -1
  86. package/dist/drawing-page/assets/{pa-IN-N4M65BXN-Bp1ixU58.js → pa-IN-N4M65BXN-Ck8ZOFZQ.js} +1 -1
  87. package/dist/drawing-page/assets/{pegDiagram-VL7TDLO6-B-xberCP.js → pegDiagram-VL7TDLO6-CsNIPAUO.js} +1 -1
  88. package/dist/drawing-page/assets/percentages-BXMCSKIN-DD68R4BU.js +1 -0
  89. package/dist/drawing-page/assets/{pica-CjdSVAiE.js → pica-TJxRH1hS.js} +1 -1
  90. package/dist/drawing-page/assets/picture-D1_Gef1m.js +1 -0
  91. package/dist/drawing-page/assets/{pieDiagram-7S7Q4E2Y-mlV2Cfx3.js → pieDiagram-7S7Q4E2Y-ivc04D1I.js} +1 -1
  92. package/dist/drawing-page/assets/{pl-PL-T2D74RX3-BUKE4wqp.js → pl-PL-T2D74RX3-BO6STjgQ.js} +1 -1
  93. package/dist/drawing-page/assets/{prod-h6IKD9uE.js → prod-B73VusLB.js} +9 -9
  94. package/dist/drawing-page/assets/{pt-BR-5N22H2LF--wv9sZf1.js → pt-BR-5N22H2LF-BhL7mFPh.js} +1 -1
  95. package/dist/drawing-page/assets/{pt-PT-UZXXM6DQ-0XUNZ7du.js → pt-PT-UZXXM6DQ-D9xt78jb.js} +1 -1
  96. package/dist/drawing-page/assets/{quadrantDiagram-CIZ2JOQS-DCASpnCZ.js → quadrantDiagram-CIZ2JOQS-B5ShXxBL.js} +1 -1
  97. package/dist/drawing-page/assets/{railroadDiagram-AXF67PYL-DUPotRSX.js → railroadDiagram-AXF67PYL-TouNMOa2.js} +1 -1
  98. package/dist/drawing-page/assets/{react-dom-bLrj4m0o.js → react-dom-DOyQ--4c.js} +1 -1
  99. package/dist/drawing-page/assets/{react-rKJS6zPL.js → react-giARbZ_k.js} +1 -1
  100. package/dist/drawing-page/assets/{requirementDiagram-LRYGKXZP-BqF3hAjG.js → requirementDiagram-LRYGKXZP-8_FxBKqF.js} +1 -1
  101. package/dist/drawing-page/assets/{ro-RO-JPDTUUEW-C_HZ_9_y.js → ro-RO-JPDTUUEW-Ce5SkqHN.js} +1 -1
  102. package/dist/drawing-page/assets/{ru-RU-B4JR7IUQ-CghTzS1B.js → ru-RU-B4JR7IUQ-BMaHD5jb.js} +1 -1
  103. package/dist/drawing-page/assets/{sankeyDiagram-W5VNT64P-TOHKGdOj.js → sankeyDiagram-W5VNT64P-BJlO_5Zn.js} +1 -1
  104. package/dist/drawing-page/assets/scene-DRZ2XrJm.js +1 -0
  105. package/dist/drawing-page/assets/{sequenceDiagram-SI44F4Z6-BPzBwJ23.js → sequenceDiagram-SI44F4Z6-B25_T2t7.js} +1 -1
  106. package/dist/drawing-page/assets/{si-LK-N5RQ5JYF-C-E7WMzT.js → si-LK-N5RQ5JYF-Ck9OaWE_.js} +1 -1
  107. package/dist/drawing-page/assets/{sk-SK-C5VTKIMK-xSSzQ-Nc.js → sk-SK-C5VTKIMK-C1EJOPsj.js} +1 -1
  108. package/dist/drawing-page/assets/{sl-SI-NN7IZMDC-vd9S4rru.js → sl-SI-NN7IZMDC-DFCcSE-x.js} +1 -1
  109. package/dist/drawing-page/assets/{src-Bq_MLJPW.js → src-CxkpPvd7.js} +1 -1
  110. package/dist/drawing-page/assets/{stateDiagram-OKZ733FA-DWhPSrGe.js → stateDiagram-OKZ733FA-DhMMG4Il.js} +1 -1
  111. package/dist/drawing-page/assets/stateDiagram-v2-UEYNNEHI-CbCHFTZh.js +1 -0
  112. package/dist/drawing-page/assets/{sv-SE-XGPEYMSR-C03vrITo.js → sv-SE-XGPEYMSR-BbGGGINr.js} +1 -1
  113. package/dist/drawing-page/assets/{swimlanes-SLNWSIFB-bAtn9k-6.js → swimlanes-SLNWSIFB-C_067SLp.js} +1 -1
  114. package/dist/drawing-page/assets/swimlanesDiagram-ULZ7WXOC-D8yDNrVf.js +8 -0
  115. package/dist/drawing-page/assets/{ta-IN-2NMHFXQM-iApHUOhp.js → ta-IN-2NMHFXQM-MmNA5EQD.js} +1 -1
  116. package/dist/drawing-page/assets/{th-TH-HPSO5L25-XaEE8A2a.js → th-TH-HPSO5L25-BqwSAk--.js} +1 -1
  117. package/dist/drawing-page/assets/{timeline-definition-Z64GVDOM-HpHAE7p1.js → timeline-definition-Z64GVDOM-9j9r3WvN.js} +1 -1
  118. package/dist/drawing-page/assets/{tr-TR-DEFEU3FU-qh_6U6tZ.js → tr-TR-DEFEU3FU-DazmI1UO.js} +1 -1
  119. package/dist/drawing-page/assets/{uk-UA-QMV73CPH-Dnaa4Abz.js → uk-UA-QMV73CPH-BU7K3yLx.js} +1 -1
  120. package/dist/drawing-page/assets/{vennDiagram-T6HMQDX7-DLs65-zf.js → vennDiagram-T6HMQDX7-R7gZSWda.js} +1 -1
  121. package/dist/drawing-page/assets/{vi-VN-M7AON7JQ-YOkhVPYg.js → vi-VN-M7AON7JQ-DlSTVl7E.js} +1 -1
  122. package/dist/drawing-page/assets/{wardleyDiagram-T6FBY63Y-BD5VH3jw.js → wardleyDiagram-T6FBY63Y-DOdJ3ql5.js} +1 -1
  123. package/dist/drawing-page/assets/{xychartDiagram-ELKLHX3M-jJa9qhv1.js → xychartDiagram-ELKLHX3M-D-FGz-0h.js} +1 -1
  124. package/dist/drawing-page/assets/{zh-CN-LNUGB5OW-DggUAMgs.js → zh-CN-LNUGB5OW-D3QP-vIz.js} +1 -1
  125. package/dist/drawing-page/assets/{zh-HK-E62DVLB3-MCovRg56.js → zh-HK-E62DVLB3-48EQNd3p.js} +1 -1
  126. package/dist/drawing-page/assets/{zh-TW-RAJ6MFWO-BuC6uBYw.js → zh-TW-RAJ6MFWO-DYxGzawk.js} +1 -1
  127. package/dist/drawing-page/drawing-picture-page.js +4 -4
  128. package/dist/main.js +918 -518
  129. package/dist/main.js.map +1 -1
  130. package/dist/map-picture-page.js +162 -109
  131. package/package.json +6 -6
  132. package/dist/drawing-page/assets/channel-BzrpSA9e.js +0 -1
  133. package/dist/drawing-page/assets/classDiagram-JCYQIIEL-fQUEpNef.js +0 -1
  134. package/dist/drawing-page/assets/classDiagram-v2-OCEON4UE-fQUEpNef.js +0 -1
  135. package/dist/drawing-page/assets/flowDiagram-UKHOOZJN-LEBtdj-L.js +0 -1
  136. package/dist/drawing-page/assets/percentages-BXMCSKIN-BB8F9H2s.js +0 -1
  137. package/dist/drawing-page/assets/picture-B8KpPOJ2.js +0 -1
  138. package/dist/drawing-page/assets/scene-CNYL6uXE.js +0 -1
  139. package/dist/drawing-page/assets/stateDiagram-v2-UEYNNEHI-0SsDmXm-.js +0 -1
  140. package/dist/drawing-page/assets/swimlanesDiagram-ULZ7WXOC-3CBtkpxY.js +0 -8
package/dist/main.js CHANGED
@@ -714,7 +714,7 @@ function looksLikeAgentSetupCode(value) {
714
714
  }
715
715
  var package_default = {
716
716
  name: "@appsoftwareltd/etherpk-mcp",
717
- version: "0.19.4",
717
+ version: "0.20.0",
718
718
  license: "Elastic-2.0",
719
719
  description: "EtherPK Headless Client: an MCP server over a synced knowledge graph, run beside the agent on the user's own machine.",
720
720
  type: "module",
@@ -4280,6 +4280,7 @@ function extensionFences(lines) {
4280
4280
  // ../client/src/lib/document/map-text.ts
4281
4281
  var NUMBER = String.raw`[+-]?(?:\d+(?:\.\d*)?|\.\d+)`;
4282
4282
  var POINT = new RegExp(String.raw`^\s*(${NUMBER})\s*,\s*(${NUMBER})\s*$`);
4283
+ var SIZE = /^\s*size\s+(\d{1,5})?x(\d{1,5})\s*$/;
4283
4284
  /** How many of the last `@`s on a line may end its name (`readMapLine`). */
4284
4285
  var MAX_NAME_ENDS = 16;
4285
4286
  function readPoint(text) {
@@ -4338,19 +4339,40 @@ function readMapLine(text) {
4338
4339
  }
4339
4340
  return readLocation(trimmed, "");
4340
4341
  }
4341
- /** Every item in a Map Block's body, numbered by line. Blank lines are skipped, not reported. */
4342
+ /** What a size line says, or null when `text` is not one. No size line can read as a place or a route. */
4343
+ function readMapSize(text) {
4344
+ const match = SIZE.exec(text);
4345
+ if (!match) return null;
4346
+ const width = match[1] === void 0 ? null : Number(match[1]);
4347
+ const height = Number(match[2]);
4348
+ return width === 0 || height === 0 ? null : {
4349
+ width,
4350
+ height
4351
+ };
4352
+ }
4353
+ /**
4354
+ * Every item in a Map Block's body, numbered by line, and its size. Blank lines are skipped, not
4355
+ * reported. A second size line is reported like any line that does not read: two members resizing at
4356
+ * once merge as two lines, and the map can only be one size.
4357
+ */
4342
4358
  function readMapBody(lines) {
4343
4359
  const body = {
4344
4360
  items: [],
4345
- unread: []
4361
+ unread: [],
4362
+ size: null
4346
4363
  };
4347
4364
  lines.forEach((text, line) => {
4348
4365
  if (text.trim() === "") return;
4349
4366
  const read = readMapLine(text);
4350
- if (read) body.items.push({
4351
- ...read,
4352
- line
4353
- });
4367
+ if (read) {
4368
+ body.items.push({
4369
+ ...read,
4370
+ line
4371
+ });
4372
+ return;
4373
+ }
4374
+ const size = body.size === null ? readMapSize(text) : null;
4375
+ if (size) body.size = size;
4354
4376
  else body.unread.push({
4355
4377
  line,
4356
4378
  text
@@ -4411,7 +4433,6 @@ var EMPTY = {
4411
4433
  scheduled: null
4412
4434
  };
4413
4435
  /**
4414
- * Tags are **case-sensitive** (ADR 0032), so `#p1` and `#d` are prose, not metadata.
4415
4436
  * Dates are shape-matched, not calendar-validated: `#D-2026-13-45` is still a date-shaped
4416
4437
  * tag. Shape is what makes string ordering equal date ordering, and a wrong date is the
4417
4438
  * user's to see and fix, not ours to silently drop.
@@ -4434,8 +4455,13 @@ var STATE_TAGS = [
4434
4455
  ["archived", "#A"]
4435
4456
  ];
4436
4457
  var STATE_BY_TOKEN = new Map(STATE_TAGS.map(([kind, token]) => [token, kind]));
4437
- /** Read one token as a tag, or null if it is not one (which ends the run). */
4438
- function readTag(token) {
4458
+ /** `token` as a Task Tag is written: its ASCII letters in upper case. Not `toUpperCase`, which also turns `ſ` into `S`. */
4459
+ function inTagCase(token) {
4460
+ return token.replace(/[a-z]+/g, (letters) => letters.toUpperCase());
4461
+ }
4462
+ /** Read one token as a tag, in any case, or null if it is not one (which ends the run). */
4463
+ function readTag(written) {
4464
+ const token = inTagCase(written);
4439
4465
  const state = STATE_BY_TOKEN.get(token);
4440
4466
  if (state) return {
4441
4467
  kind: state,
@@ -4507,13 +4533,17 @@ function parseTaskTags(label) {
4507
4533
  /** A Free Tag's word: letters and digits in words joined by single hyphens. */
4508
4534
  var FREE_TAG_WORD = /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/;
4509
4535
  /**
4510
- * Anything a [[Task Tag]] is or could be, in any case: `#p1` and `#P4` are not Task Tags, but a
4536
+ * Anything a [[Task Tag]] is or could be, in any case: `#P4` and `#d-2026` are not Task Tags, but a
4511
4537
  * person who wrote them meant one, so neither is a Free Tag either.
4512
4538
  */
4513
4539
  var TASK_TAG_SHAPED = /^(?:P\d+|W|D|T|C|A|[DCS]-[\d-]*)$/i;
4540
+ /** Whether `word` (without its `#`) is a [[Task Tag]] or shaped like one, in any case. */
4541
+ function isTaskTagShaped(word) {
4542
+ return TASK_TAG_SHAPED.test(word);
4543
+ }
4514
4544
  /** Whether `word` (without its `#`) can be a [[Free Tag]]: what the Task Editor checks a new tag by. */
4515
4545
  function isFreeTagWord(word) {
4516
- return FREE_TAG_WORD.test(word) && /[A-Za-z]/.test(word) && !TASK_TAG_SHAPED.test(word);
4546
+ return FREE_TAG_WORD.test(word) && /[A-Za-z]/.test(word) && !isTaskTagShaped(word);
4517
4547
  }
4518
4548
  /** True when a whitespace-separated token is exactly one Free Tag. */
4519
4549
  function isFreeTagToken(token) {
@@ -4729,13 +4759,17 @@ new Set(STATE_TAGS.map(([kind]) => kind));
4729
4759
  function taskTitleKey(label) {
4730
4760
  return taskDisplay(label).text.toLowerCase();
4731
4761
  }
4762
+ /** The [[Free Tag]]s on a task's line, once each, in the spelling first written. */
4763
+ function taskFreeTags(label) {
4764
+ return freeTagsIn(parseTaskTags(label).text);
4765
+ }
4732
4766
  /**
4733
4767
  * A task's tags as a [[Task Text Filter]] matches them: every [[Task Tag]] in its leading run and
4734
4768
  * every [[Free Tag]] on its line, lower-cased, each with a space either side. No tag holds a space,
4735
4769
  * so {@link taskTagNeedle} finds a tag whole, and `#bug` is not found in `#bugfix`.
4736
4770
  */
4737
4771
  function taskTagsKey(label) {
4738
- const tags = [...taskTagTokens(label).map((token) => token.slice(1)), ...freeTagsIn(parseTaskTags(label).text)];
4772
+ const tags = [...taskTagTokens(label).map((token) => token.slice(1)), ...taskFreeTags(label)];
4739
4773
  return tags.length === 0 ? "" : ` ${tags.join(" ").toLowerCase()} `;
4740
4774
  }
4741
4775
  /** What {@link taskTagsKey} is searched for, for a tag out of a {@link TaskTextFilter}. */
@@ -5611,7 +5645,7 @@ function createSchema(db) {
5611
5645
  db.exec(SCHEMA$1);
5612
5646
  db.run("INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('active_generation', 1)");
5613
5647
  db.run("INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('revision', 0)");
5614
- db.exec(`PRAGMA user_version = 22`);
5648
+ db.exec(`PRAGMA user_version = 23`);
5615
5649
  }
5616
5650
  function activeIndexGeneration(db) {
5617
5651
  return db.all("SELECT value FROM index_metadata WHERE key = 'active_generation'")[0]?.value ?? 1;
@@ -5632,7 +5666,7 @@ function advanceIndexRevision(db) {
5632
5666
  */
5633
5667
  function isUsableIndex(db) {
5634
5668
  try {
5635
- return db.all("PRAGMA user_version")[0]?.user_version === 22;
5669
+ return db.all("PRAGMA user_version")[0]?.user_version === 23;
5636
5670
  } catch {
5637
5671
  return false;
5638
5672
  }
@@ -5685,13 +5719,13 @@ function indexDocHash(doc) {
5685
5719
  const includes = doc.includes ?? [];
5686
5720
  const properties = doc.properties ?? [];
5687
5721
  const aliases = doc.aliases ?? [];
5688
- if (includes.length === 0 && properties.length === 0 && aliases.length === 0 && !doc.template) return hashText(doc.text);
5722
+ if (includes.length === 0 && properties.length === 0 && aliases.length === 0 && !doc.template) return hashText$1(doc.text);
5689
5723
  const includeText = includes.map((i) => `${i.publication}\u0001${i.slot}\u0001${i.concept}`).join("\0");
5690
5724
  const propertyText = properties.map((p) => `${p.key}\u0001${p.value ?? ""}`).join("\0");
5691
5725
  const templateMark = doc.template ? "template" : "";
5692
- return hashText(`${doc.text}\u0000${includeText}\u0003${propertyText}\u0004${aliases.join("\0")}${templateMark}`);
5726
+ return hashText$1(`${doc.text}\u0000${includeText}\u0003${propertyText}\u0004${aliases.join("\0")}${templateMark}`);
5693
5727
  }
5694
- function hashText(text) {
5728
+ function hashText$1(text) {
5695
5729
  let h1 = 3735928559;
5696
5730
  let h2 = 1103547991;
5697
5731
  for (let i = 0; i < text.length; i++) {
@@ -5813,7 +5847,7 @@ function insertDerived(db, pageId, doc) {
5813
5847
  passage.startLine,
5814
5848
  passage.endLine,
5815
5849
  passage.firstBlockLocalId,
5816
- hashText(passage.text),
5850
+ hashText$1(passage.text),
5817
5851
  passage.text
5818
5852
  ]);
5819
5853
  return searchable;
@@ -6701,6 +6735,34 @@ function propertyKeys(db) {
6701
6735
  GROUP BY pr.key
6702
6736
  ORDER BY documents DESC, pr.key_lc, pr.key`, [activeIndexGeneration(db)]);
6703
6737
  }
6738
+ /**
6739
+ * Every [[Free Tag]] on a task in the graph, once ignoring case, most used first and then A–Z, each
6740
+ * in the spelling most tasks write it in: what the `#` helper offers. Read from the tasks' text at
6741
+ * each ask rather than kept in a table of its own. It runs in the worker, once per `#` typed, and
6742
+ * `tags_key` has already ruled out every task with no tag at all.
6743
+ */
6744
+ function usedFreeTags(db) {
6745
+ const rows = db.all(`SELECT t.text FROM tasks t JOIN pages p ON p.id = t.page_id
6746
+ WHERE p.generation = ? AND t.tags_key <> ''`, [activeIndexGeneration(db)]);
6747
+ const spellingsByKey = /* @__PURE__ */ new Map();
6748
+ for (const { text } of rows) for (const tag of taskFreeTags(text)) {
6749
+ const key = tag.toLowerCase();
6750
+ const spellings = spellingsByKey.get(key) ?? /* @__PURE__ */ new Map();
6751
+ spellingsByKey.set(key, spellings.set(tag, (spellings.get(tag) ?? 0) + 1));
6752
+ }
6753
+ return [...spellingsByKey].map(([key, spellings]) => ({
6754
+ key,
6755
+ ...mostUsedSpelling(spellings)
6756
+ })).sort((a, b) => b.total - a.total || a.key.localeCompare(b.key)).map((entry) => entry.spelling);
6757
+ }
6758
+ /** The spelling most tasks write, A–Z on a tie, and how many tasks write any of them. */
6759
+ function mostUsedSpelling(spellings) {
6760
+ const [[spelling]] = [...spellings].sort(([a, m], [b, n]) => n - m || a.localeCompare(b));
6761
+ return {
6762
+ spelling,
6763
+ total: [...spellings.values()].reduce((sum, n) => sum + n, 0)
6764
+ };
6765
+ }
6704
6766
  /** The values `key` has across the graph, grouped ignoring case, most used first. */
6705
6767
  function propertyValues(db, key, limit = 50) {
6706
6768
  return db.all(`SELECT MIN(pr.value) AS value, COUNT(DISTINCT pr.page_id) AS documents
@@ -7453,7 +7515,7 @@ function cacheRoot(env) {
7453
7515
  * recovered from a joined path (see there).
7454
7516
  */
7455
7517
  var CACHE_FILE_NAME = `local-cache.v${CACHE_DB_VERSION}.bin`;
7456
- var INDEX_FILE_NAME = `index.v22.sqlite`;
7518
+ var INDEX_FILE_NAME = `index.v23.sqlite`;
7457
7519
  var VECTORS_FILE_NAME = `vectors.v1.sqlite`;
7458
7520
  function cacheFile(dir) {
7459
7521
  return join(dir, CACHE_FILE_NAME);
@@ -12844,6 +12906,70 @@ async function listHostRecords(env) {
12844
12906
  }
12845
12907
  return found;
12846
12908
  }
12909
+ // src/graph-connection.ts
12910
+ /**
12911
+ * Follow `source` for as long as it lives; a session clears its listeners when disposed. Only an
12912
+ * open socket counts as connected, so `connecting`, `reconnecting` and `ended` are all offline: in
12913
+ * each of them the copy has stopped following the Sync Server.
12914
+ */
12915
+ function followConnection(source, options = {}) {
12916
+ const now = options.now ?? Date.now;
12917
+ let connected = source.activity().connection === "open";
12918
+ let everConnected = connected;
12919
+ let since = now();
12920
+ const describe = (activity) => {
12921
+ const at = new Date(since).toISOString();
12922
+ return connected ? {
12923
+ state: "connected",
12924
+ since: at
12925
+ } : {
12926
+ state: "offline",
12927
+ since: at,
12928
+ unsentDocuments: activity.unsentDocuments
12929
+ };
12930
+ };
12931
+ function observe(activity) {
12932
+ const connectedNow = activity.connection === "open";
12933
+ if (connectedNow !== connected) {
12934
+ const at = now();
12935
+ const offlineForMs = connectedNow && everConnected ? at - since : null;
12936
+ connected = connectedNow;
12937
+ everConnected ||= connectedNow;
12938
+ since = at;
12939
+ options.onChange?.({
12940
+ connection: describe(activity),
12941
+ offlineForMs
12942
+ });
12943
+ }
12944
+ return describe(activity);
12945
+ }
12946
+ source.onActivity(observe);
12947
+ return { current: () => observe(source.activity()) };
12948
+ }
12949
+ function plural(count, unit) {
12950
+ return `${count} ${unit}${count === 1 ? "" : "s"}`;
12951
+ }
12952
+ function durationWords(ms) {
12953
+ const minutes = Math.floor(ms / 6e4);
12954
+ if (minutes < 1) return "under a minute";
12955
+ if (minutes < 60) return plural(minutes, "minute");
12956
+ const hours = Math.floor(minutes / 60);
12957
+ return hours < 48 ? plural(hours, "hour") : plural(Math.floor(hours / 24), "day");
12958
+ }
12959
+ /** How the tools word the state, with the exact time and, in brackets, how long that is. */
12960
+ function offlineSince(connection, now = Date.now()) {
12961
+ return `offline from the Sync Server since ${connection.since} (${durationWords(now - Date.parse(connection.since))})`;
12962
+ }
12963
+ /** The note an answer carries while its copy is offline; null while connected and on a folder, which has no connection. */
12964
+ function offlineNotice(connection, now = Date.now()) {
12965
+ if (connection?.state !== "offline") return null;
12966
+ return `This computer's copy of the graph has been ${offlineSince(connection, now)}. This answer comes from that copy: it can lack edits made elsewhere since then, and a page or task it does not find may only be newer than the copy. Tell the user before relying on it. The copy catches up when the connection returns.`;
12967
+ }
12968
+ /** One line for the host's log. */
12969
+ function connectionChangeLine(change) {
12970
+ if (change.connection.state === "offline") return "lost the connection to the Sync Server; the tools answer from this computer's copy.";
12971
+ return change.offlineForMs === null ? "connected to the Sync Server." : `connected to the Sync Server again, after ${durationWords(change.offlineForMs)} offline.`;
12972
+ }
12847
12973
  // ../client/src/lib/document/publish/selection.ts
12848
12974
  /**
12849
12975
  * Which documents a [[Publication]] contains (ADR 0082). The one place the membership rule is
@@ -13645,7 +13771,7 @@ var files = /* #__PURE__ */ Object.assign({
13645
13771
  "../etherpk-blog/theme.json": "{\n \"name\": \"etherpk-blog\",\n \"title\": \"EtherPK Blog\",\n \"version\": \"1.0.0\",\n \"contract\": 1,\n \"description\": \"A blog: dated documents as posts newest first, a top navigation from the publication's outline, the feed, and search.\",\n \"kinds\": [\"blog\"],\n \"includes\": [\n { \"name\": \"head\", \"description\": \"Extra markup inside <head>: analytics, fonts, meta tags. Raw HTML in the page body.\" },\n { \"name\": \"logo\", \"description\": \"The logo before the site title in the header: an image or inline SVG. Replaces the EtherPK icon.\" },\n { \"name\": \"favicon\", \"description\": \"The icon in the browser tab: a <link rel=\\\"icon\\\"> tag. Raw HTML in the page body. Replaces the EtherPK icon.\" },\n { \"name\": \"header\", \"description\": \"The site header. Replaces the theme's title, navigation and search box.\" },\n { \"name\": \"before-content\", \"description\": \"Rendered above every page's content.\" },\n { \"name\": \"after-content\", \"description\": \"Rendered below every page's content, above the linked references: an author bio, a comments widget.\" },\n { \"name\": \"footer\", \"description\": \"The site footer.\" },\n { \"name\": \"scripts\", \"description\": \"Scripts before </body>, added after the theme's own (search, the sidebar drawer): analytics, a widget. Raw HTML in the page body.\" },\n { \"name\": \"styles\", \"description\": \"CSS appended after the theme's stylesheet: the page's first css fence.\", \"kind\": \"css\" }\n ],\n \"files\": [\n \"layouts/page.html\", \"layouts/home.html\", \"layouts/journal.html\", \"layouts/archive.html\", \"layouts/404.html\",\n \"partials/shell-top.html\", \"partials/shell-bottom.html\", \"partials/head.html\", \"partials/logo.html\", \"partials/favicon.html\", \"partials/header.html\",\n \"partials/nav-item.html\", \"partials/backlinks.html\", \"partials/before-content.html\", \"partials/after-content.html\",\n \"partials/footer.html\", \"partials/theme-scripts.html\", \"partials/scripts.html\",\n \"assets/theme.css\", \"assets/favicon.svg\", \"assets/search.js\"\n ]\n}\n",
13646
13772
  "../etherpk-docs/assets/favicon.svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 191.82 166.13\">\n <path fill=\"#0a0a0a\" fill-rule=\"evenodd\" d=\"M67.09,132.92,47.93,166.13H9.59L0,149.52,86.33,0H105.5L19.17,149.52H38.34l19.17-33.2h76.8l9.59,16.6Zm48-83.12,9.65,16.71H143.9L115.08,16.6q-24,41.57-48,83.12H143.9q14.37,24.9,28.76,49.8h-96l-9.59,16.61H182.24l9.58-16.61-38.34-66.4H96C95.85,82.9,113.39,52.73,115.08,49.8Z\"/>\n</svg>\n",
13647
13773
  "../etherpk-docs/assets/search.js": "/*\n * Search for a Published Site: reads search.json (built over the publication's own documents\n * and nothing else) and scores documents by title and text matches. No dependencies, no\n * network beyond the one index file, and nothing runs until the search box is used. The same\n * script runs the sidebar toggle on small screens, so a page carries one script.\n */\n(function () {\n 'use strict';\n\n // -- Navigation toggle (small screens) -------------------------------------------------\n var toggle = document.querySelector('.nav-toggle');\n var backdrop = document.querySelector('.nav-backdrop');\n var nav = document.getElementById('site-nav');\n function setNavOpen(open) {\n var was = document.body.classList.contains('nav-open');\n document.body.classList.toggle('nav-open', open);\n if (toggle) toggle.setAttribute('aria-expanded', open ? 'true' : 'false');\n if (backdrop) backdrop.hidden = !open;\n // Focus follows the drawer: into its first link on open, back to the button on close,\n // so a keyboard or screen-reader user is never left on something now hidden.\n if (open && !was) {\n var first = nav.querySelector('a');\n if (first) first.focus();\n } else if (!open && was && toggle) {\n toggle.focus();\n }\n }\n if (toggle && nav) {\n toggle.addEventListener('click', function () { setNavOpen(!document.body.classList.contains('nav-open')); });\n if (backdrop) backdrop.addEventListener('click', function () { setNavOpen(false); });\n document.addEventListener('keydown', function (e) {\n if (e.key === 'Escape' && document.body.classList.contains('nav-open')) setNavOpen(false);\n });\n }\n\n // -- Search --------------------------------------------------------------------------\n var form = document.querySelector('.site-search');\n if (!form) return;\n var input = form.querySelector('input[type=\"search\"]');\n var results = form.querySelector('.site-search-results');\n var indexUrl = form.getAttribute('data-search-index') || 'search.json';\n var scriptUrl = form.getAttribute('data-search-script') || 'search-index.js';\n var index = null;\n var loading = null;\n /* True once neither route produced the index: the results then say so rather than \"nothing matches\". */\n var unavailable = false;\n\n /* The index as a script assigning window.etherpkSearchIndex: what a site opened from disk can\n load, since file:// refuses fetch but allows <script src>. */\n function loadScript() {\n return new Promise(function (resolve, reject) {\n if (window.etherpkSearchIndex) { resolve(window.etherpkSearchIndex); return; }\n var s = document.createElement('script');\n s.src = scriptUrl;\n s.onload = function () {\n if (window.etherpkSearchIndex) resolve(window.etherpkSearchIndex);\n else reject(new Error('no index'));\n };\n s.onerror = function () { reject(new Error('no script')); };\n document.head.appendChild(s);\n });\n }\n\n function load() {\n if (index) return Promise.resolve(index);\n if (!loading) {\n loading = fetch(indexUrl).then(function (r) {\n if (!r.ok) throw new Error(String(r.status));\n return r.json();\n }).catch(loadScript).then(function (data) {\n index = (data && data.documents) || [];\n return index;\n }).catch(function () { unavailable = true; index = []; return index; });\n }\n return loading;\n }\n\n function tokens(q) {\n return q.toLowerCase().split(/\\s+/).filter(function (t) { return t.length > 0; });\n }\n\n function score(doc, terms) {\n var title = (doc.title || '').toLowerCase();\n var text = (doc.text || '').toLowerCase();\n var s = 0;\n for (var i = 0; i < terms.length; i++) {\n var t = terms[i];\n if (title === t) s += 20;\n else if (title.indexOf(t) === 0) s += 10;\n else if (title.indexOf(t) !== -1) s += 6;\n var at = text.indexOf(t);\n if (at !== -1) s += 2;\n else if (title.indexOf(t) === -1) return 0; // every term must match somewhere\n }\n return s;\n }\n\n function snippet(doc, terms) {\n var text = doc.text || '';\n var lower = text.toLowerCase();\n var at = -1;\n for (var i = 0; i < terms.length && at === -1; i++) at = lower.indexOf(terms[i]);\n if (at === -1) return doc.excerpt || '';\n var start = Math.max(0, at - 60);\n var end = Math.min(text.length, at + 100);\n return (start > 0 ? '…' : '') + text.slice(start, end).replace(/\\s+/g, ' ') + (end < text.length ? '…' : '');\n }\n\n function escapeHtml(s) {\n return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\n }\n\n function render(list, q) {\n if (!q) { results.hidden = true; results.innerHTML = ''; return; }\n if (unavailable) {\n results.innerHTML = '<p class=\"site-search-empty\">The search index could not be loaded.</p>';\n results.hidden = false;\n return;\n }\n if (list.length === 0) {\n results.innerHTML = '<p class=\"site-search-empty\">Nothing matches \"' + escapeHtml(q) + '\".</p>';\n results.hidden = false;\n return;\n }\n results.innerHTML = list.map(function (hit) {\n return '<a class=\"site-search-hit\" role=\"option\" href=\"' + escapeHtml(hit.doc.url) + '\">' +\n '<span class=\"site-search-title\">' + escapeHtml(hit.doc.title) + '</span>' +\n '<span class=\"site-search-snippet\">' + escapeHtml(hit.snippet) + '</span></a>';\n }).join('');\n results.hidden = false;\n }\n\n var timer = null;\n function run() {\n var q = input.value.trim();\n var terms = tokens(q);\n if (terms.length === 0) { render([], ''); return; }\n load().then(function (docs) {\n var hits = [];\n for (var i = 0; i < docs.length; i++) {\n var s = score(docs[i], terms);\n if (s > 0) hits.push({ doc: docs[i], score: s, snippet: snippet(docs[i], terms) });\n }\n hits.sort(function (a, b) { return b.score - a.score || a.doc.title.localeCompare(b.doc.title); });\n render(hits.slice(0, 12), q);\n });\n }\n\n input.addEventListener('input', function () {\n clearTimeout(timer);\n timer = setTimeout(run, 120);\n });\n input.addEventListener('focus', function () { load(); });\n form.addEventListener('submit', function (e) {\n e.preventDefault();\n var first = results.querySelector('a');\n if (first) window.location.href = first.getAttribute('href');\n });\n document.addEventListener('keydown', function (e) {\n if (e.key === '/' && document.activeElement !== input && !/input|textarea/i.test(document.activeElement.tagName)) {\n e.preventDefault();\n input.focus();\n }\n if (e.key === 'Escape' && !results.hidden) { render([], ''); }\n });\n document.addEventListener('click', function (e) {\n if (!form.contains(e.target)) render([], '');\n });\n})();\n",
13648
- "../etherpk-docs/assets/theme.css": "/* EtherPK docs theme. Tokens follow the app's own (agent blue, the gk surface scale); the font\n is the system stack so the site loads nothing from anywhere. Dark mode follows the reader's\n preference. Classes the publisher emits and this file styles: .wikilink, .wikilink-missing,\n .task, .task-tag, .toc, .backlinks, .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --font-sans: \"Inter\", system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n --agent-500: #007acc;\n --agent-600: #005f9e;\n --agent-100: #c2e3ff;\n --surface-0: #ffffff;\n --surface-1: #f9fafb;\n --surface-2: #e5e7eb;\n --text-strong: #030712;\n --text-default: #374151;\n --text-muted: #6b7280;\n --border-soft: rgba(3, 7, 18, 0.08);\n --border-strong: rgba(3, 7, 18, 0.16);\n --mark: #fff3a3;\n --missing: #b45309;\n --nav-width: 17rem;\n /* The header is exactly this tall, so the sticky sidebar and the drawer toggle can be\n measured against it rather than guessing at the search box's height. */\n --header-height: 3.5rem;\n /* The width of the text column beside the sidebar. Pictures are capped to it as well. */\n --content-width: 52rem;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --agent-500: #5ab3ff;\n --agent-600: #94ccff;\n --agent-100: #002e4f;\n --surface-0: #18181b;\n --surface-1: #1c1c20;\n --surface-2: #2a2a30;\n --text-strong: #fafafa;\n --text-default: #d4d4d8;\n --text-muted: #a1a1aa;\n --border-soft: rgba(255, 255, 255, 0.08);\n --border-strong: rgba(255, 255, 255, 0.16);\n --mark: #6b5a00;\n --missing: #f59e0b;\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }\nbody {\n margin: 0;\n color: var(--text-default);\n background: var(--surface-0);\n line-height: 1.6;\n font-size: 16px;\n}\na { color: var(--agent-500); }\na:hover { color: var(--agent-600); }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface-1); padding: 0.5rem 1rem; z-index: 100; }\n.skip-link:focus { left: 1rem; top: 1rem; }\n\n/* -- Header ----------------------------------------------------------------------------- */\n.site-header {\n display: flex;\n align-items: center;\n gap: 1rem;\n height: var(--header-height);\n padding: 0 1.5rem;\n border-bottom: 1px solid var(--border-soft);\n background: var(--surface-1);\n position: sticky;\n top: 0;\n z-index: 20;\n}\n.site-title { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; font-weight: 600; color: var(--text-strong); text-decoration: none; font-size: 1.05rem; }\n.site-title:hover { color: var(--agent-500); }\n.site-logo { flex-shrink: 0; }\n.site-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 22rem; }\n.site-search input {\n width: 100%;\n padding: 0.4rem 0.75rem;\n line-height: 1.25;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-0);\n color: var(--text-default);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n.site-search-results {\n position: absolute;\n top: calc(100% + 0.35rem);\n left: 0;\n right: 0;\n max-height: 24rem;\n overflow: auto;\n background: var(--surface-0);\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 0.55rem 0.75rem; text-decoration: none; color: var(--text-default); border-bottom: 1px solid var(--border-soft); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--surface-1); }\n.site-search-title { display: block; font-weight: 600; color: var(--text-strong); }\n.site-search-snippet { display: block; font-size: 0.9rem; color: var(--text-muted); }\n.site-search-empty { margin: 0; padding: 0.6rem 0.75rem; color: var(--text-muted); }\n\n/* -- Shell: sidebar + content ------------------------------------------------------------ */\n.shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); min-height: calc(100vh - var(--header-height)); }\n.site-nav {\n border-right: 1px solid var(--border-soft);\n background: var(--surface-1);\n padding: 1.25rem 1rem;\n overflow-y: auto;\n position: sticky;\n top: var(--header-height);\n height: calc(100vh - var(--header-height));\n}\n.site-nav-list { list-style: none; margin: 0; padding: 0; }\n.site-nav-list .site-nav-list { padding-left: 0.85rem; border-left: 1px solid var(--border-soft); margin-left: 0.5rem; }\n.site-nav li { margin: 0.1rem 0; }\n.site-nav a, .site-nav .nav-group-label {\n display: block;\n padding: 0.3rem 0.6rem;\n border-radius: 0.4rem;\n color: var(--text-default);\n text-decoration: none;\n font-size: 0.95rem;\n line-height: 1.4;\n}\n.site-nav a:hover { background: var(--surface-2); color: var(--text-strong); }\n.site-nav .nav-current > a { background: var(--agent-100); color: var(--text-strong); font-weight: 600; }\n.site-nav .nav-group-label { font-weight: 600; color: var(--text-strong); margin-top: 0.75rem; }\n.site-nav a .wikilink { color: inherit; text-decoration: none; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n\n/* The padding sits outside the text column (border-box would take it from inside). */\n.content { padding: 2rem 3rem 4rem; max-width: calc(var(--content-width) + 6rem); width: 100%; }\n.page-header h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.5rem; color: var(--text-strong); }\n.page-header h1 .wikilink { color: inherit; text-decoration: none; }\n.page-header h1 .wikilink:hover { text-decoration: underline; }\n.page-date { color: var(--text-muted); font-size: 0.95rem; }\n.page-body h2 { margin-top: 2rem; font-size: 1.4rem; color: var(--text-strong); }\n.page-body h3 { margin-top: 1.5rem; font-size: 1.15rem; color: var(--text-strong); }\n.page-body ul { padding-left: 1.4rem; }\n.page-body li { margin: 0.2rem 0; }\n.page-body img { max-width: 100%; height: auto; border-radius: 0.35rem; }\n.page-body table { border-collapse: collapse; margin: 1rem 0; width: 100%; }\n.page-body th, .page-body td { border: 1px solid var(--border-strong); padding: 0.4rem 0.6rem; text-align: left; }\n.page-body th { background: var(--surface-1); }\n.page-body blockquote { border-left: 3px solid var(--border-strong); margin: 1rem 0; padding: 0.25rem 1rem; color: var(--text-muted); }\n.page-body code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-1); padding: 0.1em 0.35em; border-radius: 0.25rem; }\n.page-body pre { background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: 0.5rem; padding: 0.9rem 1rem; overflow-x: auto; }\n.page-body pre code { background: none; padding: 0; font-size: 0.88rem; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; border-radius: 0.2em; }\n\n/* Wikilinks, as the editor colours them. A missing target is visibly missing. */\na.wikilink { text-decoration: none; border-bottom: 1px solid var(--agent-100); }\na.wikilink:hover { border-bottom-color: var(--agent-500); }\na.wikilink-missing { color: var(--missing); text-decoration: none; border-bottom: 1px dashed var(--missing); }\n\n/* Tasks and their badges. */\nli.task { list-style: none; margin-left: -1.4rem; padding-left: 0; }\nli.task input[type=\"checkbox\"] { margin-right: 0.35rem; vertical-align: -0.1em; }\nli.task.done { color: var(--text-muted); }\n.task-tag { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 0.05em 0.5em; border-radius: 999px; background: var(--surface-2); color: var(--text-strong); margin-right: 0.25rem; vertical-align: 0.1em; }\n.task-tag.priority-1 { background: #fee2e2; color: #991b1b; }\n.task-tag.priority-2 { background: #ffedd5; color: #9a3412; }\n.task-tag.priority-3 { background: #fef9c3; color: #854d0e; }\n.task-tag.waiting, .task-tag.doing { background: var(--agent-100); color: var(--agent-600); }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Table of contents, diagrams, maths. */\n.toc { margin: 0 0 1.5rem; font-size: 0.95rem; }\n.toc summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }\n.toc ul { list-style: none; padding-left: 0; margin: 0.4rem 0 0; }\n.toc li.toc-level-3 { padding-left: 1rem; }\n.toc li.toc-level-4 { padding-left: 2rem; }\n.diagram { margin: 1rem 0; text-align: center; }\n.diagram svg { max-width: 100%; height: auto; }\n.math-block { overflow-x: auto; margin: 1rem 0; }\n\n/* Linked references, beneath the content. */\n.backlinks { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border-soft); }\n.backlinks h2 { font-size: 1.1rem; color: var(--text-strong); margin: 0 0 0.75rem; }\n.backlink-list { list-style: none; padding: 0; margin: 0; }\n.backlink-source { margin: 0 0 0.9rem; }\n.backlink-source > a { font-weight: 600; }\n.backlink-source ul { list-style: none; padding-left: 1rem; margin: 0.25rem 0 0; border-left: 2px solid var(--border-soft); }\n.backlink-context { color: var(--text-muted); font-size: 0.95rem; margin: 0.15rem 0; }\n\n/* Archive and index lists. */\n.journal-archive, .page-index-list { list-style: none; padding: 0; }\n/* The contents page: the outline as a tree, then any page it leaves out. */\n.page-index-list .page-index-list { padding-left: 1.5rem; margin-top: 0.3rem; }\n.page-index-list li { margin: 0.4rem 0; }\n.page-index-group-label { color: var(--text-muted); font-weight: 600; }\n.page-index-other { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n.journal-archive li { margin: 0 0 1rem; }\n.journal-archive time { color: var(--text-muted); margin-right: 0.5rem; font-variant-numeric: tabular-nums; }\n.archive-excerpt { margin: 0.2rem 0 0; color: var(--text-muted); }\n.archive-year { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n\n.site-footer { border-top: 1px solid var(--border-soft); padding: 1rem 1.5rem; color: var(--text-muted); font-size: 0.9rem; text-align: center; }\n\n/* Code tokens (lezer classHighlighter names). */\n.tok-keyword { color: #0a7; }\n.tok-string, .tok-string2 { color: #690; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: #999; font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: #905; }\n.tok-function, .tok-definition.tok-variableName { color: #c60; }\n.tok-typeName, .tok-className, .tok-namespace { color: #b58900; }\n.tok-operator, .tok-punctuation { color: #555; }\n.tok-propertyName, .tok-attributeName { color: #268bd2; }\n.tok-tagName { color: #22863a; }\n.tok-invalid { color: #d00; }\n@media (prefers-color-scheme: dark) {\n .tok-keyword { color: #4ec9b0; }\n .tok-string, .tok-string2 { color: #b5cea8; }\n .tok-comment, .tok-lineComment, .tok-blockComment { color: #7f848e; }\n .tok-number, .tok-bool, .tok-null, .tok-atom { color: #d19a66; }\n .tok-function, .tok-definition.tok-variableName { color: #dcdcaa; }\n .tok-typeName, .tok-className, .tok-namespace { color: #e5c07b; }\n .tok-operator, .tok-punctuation { color: #abb2bf; }\n .tok-propertyName, .tok-attributeName { color: #61afef; }\n .tok-tagName { color: #98c379; }\n}\n\n/* -- Small screens: the sidebar becomes a drawer ---------------------------------------- */\n@media (max-width: 56rem) {\n /* Content flows on its own; the drawer and its toggle are fixed, so the shell reserves no\n row for either (a grid row here stretched the toggle to the full page height). */\n .shell { display: block; min-height: 0; }\n .site-header { padding-right: 4.25rem; }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0.5rem;\n right: 1rem;\n width: 2.5rem;\n height: 2.5rem;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-1);\n color: var(--text-strong);\n cursor: pointer;\n z-index: 45;\n }\n .nav-toggle:hover { background: var(--surface-2); }\n .nav-toggle:focus-visible { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n .site-nav {\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n height: auto;\n width: min(20rem, 85vw);\n border-right: 1px solid var(--border-strong);\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n transform: translateX(-100%);\n /* Hidden while closed, so its links are not tab stops behind the page; the visibility\n change waits for the slide out. */\n visibility: hidden;\n transition: transform 160ms ease-out, visibility 0s linear 160ms;\n z-index: 40;\n }\n body.nav-open .site-nav { transform: translateX(0); visibility: visible; transition: transform 160ms ease-out; }\n body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 35; }\n .content { padding: 1rem 1.25rem 3rem; }\n .site-search { flex-basis: 12rem; }\n}\n@media (prefers-reduced-motion: reduce) {\n .site-nav { transition: none; }\n body.nav-open .site-nav { transition: none; }\n}\n",
13774
+ "../etherpk-docs/assets/theme.css": "/* EtherPK docs theme. Tokens follow the app's own (agent blue, the gk surface scale); the font\n is the system stack so the site loads nothing from anywhere. Dark mode follows the reader's\n preference. Classes the publisher emits and this file styles: .wikilink, .wikilink-missing,\n .task, .task-tag, .toc, .backlinks, .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --font-sans: \"Inter\", system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n --agent-500: #007acc;\n --agent-600: #005f9e;\n --agent-100: #c2e3ff;\n --surface-0: #ffffff;\n --surface-1: #f9fafb;\n --surface-2: #e5e7eb;\n --text-strong: #030712;\n --text-default: #374151;\n --text-muted: #6b7280;\n --border-soft: rgba(3, 7, 18, 0.08);\n --border-strong: rgba(3, 7, 18, 0.16);\n --mark: #fff3a3;\n --missing: #b45309;\n --nav-width: 17rem;\n /* The header is exactly this tall, so the sticky sidebar and the drawer toggle can be\n measured against it rather than guessing at the search box's height. */\n --header-height: 3.5rem;\n /* The width of the text column beside the sidebar. Pictures are capped to it as well. */\n --content-width: 52rem;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --agent-500: #5ab3ff;\n --agent-600: #94ccff;\n --agent-100: #002e4f;\n --surface-0: #18181b;\n --surface-1: #1c1c20;\n --surface-2: #2a2a30;\n --text-strong: #fafafa;\n --text-default: #d4d4d8;\n --text-muted: #a1a1aa;\n --border-soft: rgba(255, 255, 255, 0.08);\n --border-strong: rgba(255, 255, 255, 0.16);\n --mark: #6b5a00;\n --missing: #f59e0b;\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }\nbody {\n margin: 0;\n color: var(--text-default);\n background: var(--surface-0);\n line-height: 1.6;\n font-size: 16px;\n}\na { color: var(--agent-500); }\na:hover { color: var(--agent-600); }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface-1); padding: 0.5rem 1rem; z-index: 100; }\n.skip-link:focus { left: 1rem; top: 1rem; }\n\n/* -- Header ----------------------------------------------------------------------------- */\n.site-header {\n display: flex;\n align-items: center;\n gap: 1rem;\n height: var(--header-height);\n padding: 0 1.5rem;\n border-bottom: 1px solid var(--border-soft);\n background: var(--surface-1);\n position: sticky;\n top: 0;\n z-index: 20;\n}\n.site-title { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; font-weight: 600; color: var(--text-strong); text-decoration: none; font-size: 1.05rem; }\n.site-title:hover { color: var(--agent-500); }\n.site-logo { flex-shrink: 0; }\n.site-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 22rem; }\n.site-search input {\n width: 100%;\n padding: 0.4rem 0.75rem;\n line-height: 1.25;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-0);\n color: var(--text-default);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n.site-search-results {\n position: absolute;\n top: calc(100% + 0.35rem);\n left: 0;\n right: 0;\n max-height: 24rem;\n overflow: auto;\n background: var(--surface-0);\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 0.55rem 0.75rem; text-decoration: none; color: var(--text-default); border-bottom: 1px solid var(--border-soft); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--surface-1); }\n.site-search-title { display: block; font-weight: 600; color: var(--text-strong); }\n.site-search-snippet { display: block; font-size: 0.9rem; color: var(--text-muted); }\n.site-search-empty { margin: 0; padding: 0.6rem 0.75rem; color: var(--text-muted); }\n\n/* -- Shell: sidebar + content ------------------------------------------------------------ */\n.shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); min-height: calc(100vh - var(--header-height)); }\n.site-nav {\n border-right: 1px solid var(--border-soft);\n background: var(--surface-1);\n padding: 1.25rem 1rem;\n overflow-y: auto;\n position: sticky;\n top: var(--header-height);\n height: calc(100vh - var(--header-height));\n}\n.site-nav-list { list-style: none; margin: 0; padding: 0; }\n.site-nav-list .site-nav-list { padding-left: 0.85rem; border-left: 1px solid var(--border-soft); margin-left: 0.5rem; }\n.site-nav li { margin: 0.1rem 0; }\n.site-nav a, .site-nav .nav-group-label {\n display: block;\n padding: 0.3rem 0.6rem;\n border-radius: 0.4rem;\n color: var(--text-default);\n text-decoration: none;\n font-size: 0.95rem;\n line-height: 1.4;\n}\n.site-nav a:hover { background: var(--surface-2); color: var(--text-strong); }\n.site-nav .nav-current > a { background: var(--agent-100); color: var(--text-strong); font-weight: 600; }\n.site-nav .nav-group-label { font-weight: 600; color: var(--text-strong); margin-top: 0.75rem; }\n.site-nav a .wikilink { color: inherit; text-decoration: none; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n\n/* The padding sits outside the text column (border-box would take it from inside). */\n.content { padding: 2rem 3rem 4rem; max-width: calc(var(--content-width) + 6rem); width: 100%; }\n.page-header h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.5rem; color: var(--text-strong); }\n.page-header h1 .wikilink { color: inherit; text-decoration: none; }\n.page-header h1 .wikilink:hover { text-decoration: underline; }\n.page-date { color: var(--text-muted); font-size: 0.95rem; }\n.page-body h2 { margin-top: 2rem; font-size: 1.4rem; color: var(--text-strong); }\n.page-body h3 { margin-top: 1.5rem; font-size: 1.15rem; color: var(--text-strong); }\n.page-body ul { padding-left: 1.4rem; }\n.page-body li { margin: 0.2rem 0; }\n.page-body img { max-width: 100%; height: auto; border-radius: 0.35rem; }\n.page-body table { border-collapse: collapse; margin: 1rem 0; width: 100%; }\n.page-body th, .page-body td { border: 1px solid var(--border-strong); padding: 0.4rem 0.6rem; text-align: left; }\n.page-body th { background: var(--surface-1); }\n.page-body blockquote { border-left: 3px solid var(--border-strong); margin: 1rem 0; padding: 0.25rem 1rem; color: var(--text-muted); }\n.page-body code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-1); padding: 0.1em 0.35em; border-radius: 0.25rem; }\n.page-body pre { background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: 0.5rem; padding: 0.9rem 1rem; overflow-x: auto; }\n.page-body pre code { background: none; padding: 0; font-size: 0.88rem; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; border-radius: 0.2em; }\n\n/* Wikilinks, as the editor colours them. A missing target is visibly missing. */\na.wikilink { text-decoration: none; border-bottom: 1px solid var(--agent-100); }\na.wikilink:hover { border-bottom-color: var(--agent-500); }\na.wikilink-missing { color: var(--missing); text-decoration: none; border-bottom: 1px dashed var(--missing); }\n\n/* Tasks and their badges. */\nli.task { list-style: none; margin-left: -1.4rem; padding-left: 0; }\nli.task input[type=\"checkbox\"] { margin-right: 0.35rem; vertical-align: -0.1em; }\nli.task.done { color: var(--text-muted); }\n.task-tag { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 0.05em 0.5em; border-radius: 999px; background: var(--surface-2); color: var(--text-strong); margin-right: 0.25rem; vertical-align: 0.1em; }\n.task-tag.priority-1 { background: #fee2e2; color: #991b1b; }\n.task-tag.priority-2 { background: #ffedd5; color: #9a3412; }\n.task-tag.priority-3 { background: #fef9c3; color: #854d0e; }\n.task-tag.waiting, .task-tag.doing { background: var(--agent-100); color: var(--agent-600); }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Table of contents, diagrams, maths. */\n.toc { margin: 0 0 1.5rem; font-size: 0.95rem; }\n.toc summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }\n.toc ul { list-style: none; padding-left: 0; margin: 0.4rem 0 0; }\n.toc li.toc-level-3 { padding-left: 1rem; }\n.toc li.toc-level-4 { padding-left: 2rem; }\n.diagram { margin: 1rem 0; text-align: center; }\n.diagram svg { max-width: 100%; height: auto; }\n.math-block { overflow-x: auto; margin: 1rem 0; }\n\n/* Linked references, beneath the content. */\n.backlinks { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border-soft); }\n.backlinks h2 { font-size: 1.1rem; color: var(--text-strong); margin: 0 0 0.75rem; }\n.backlink-list { list-style: none; padding: 0; margin: 0; }\n.backlink-source { margin: 0 0 0.9rem; }\n.backlink-source > a { font-weight: 600; }\n.backlink-source ul { list-style: none; padding-left: 1rem; margin: 0.25rem 0 0; border-left: 2px solid var(--border-soft); }\n.backlink-context { color: var(--text-muted); font-size: 0.95rem; margin: 0.15rem 0; }\n\n/* Archive and index lists. */\n.journal-archive, .page-index-list { list-style: none; padding: 0; }\n/* The contents page: the outline as a tree, then any page it leaves out. */\n.page-index-list .page-index-list { padding-left: 1.5rem; margin-top: 0.3rem; }\n.page-index-list li { margin: 0.4rem 0; }\n.page-index-group-label { color: var(--text-muted); font-weight: 600; }\n.page-index-other { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n.journal-archive li { margin: 0 0 1rem; }\n.journal-archive time { color: var(--text-muted); margin-right: 0.5rem; font-variant-numeric: tabular-nums; }\n.archive-excerpt { margin: 0.2rem 0 0; color: var(--text-muted); }\n.archive-year { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n\n.site-footer { border-top: 1px solid var(--border-soft); padding: 1rem 1.5rem; color: var(--text-muted); font-size: 0.9rem; text-align: center; }\n\n/* Code tokens (lezer classHighlighter names). */\n.tok-keyword { color: #0a7; }\n.tok-string, .tok-string2 { color: #690; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: #999; font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: #905; }\n.tok-function, .tok-definition.tok-variableName { color: #c60; }\n.tok-typeName, .tok-className, .tok-namespace { color: #b58900; }\n.tok-operator, .tok-punctuation { color: #555; }\n.tok-propertyName, .tok-attributeName { color: #268bd2; }\n.tok-tagName { color: #22863a; }\n.tok-invalid { color: #d00; }\n@media (prefers-color-scheme: dark) {\n .tok-keyword { color: #4ec9b0; }\n .tok-string, .tok-string2 { color: #b5cea8; }\n .tok-comment, .tok-lineComment, .tok-blockComment { color: #7f848e; }\n .tok-number, .tok-bool, .tok-null, .tok-atom { color: #d19a66; }\n .tok-function, .tok-definition.tok-variableName { color: #dcdcaa; }\n .tok-typeName, .tok-className, .tok-namespace { color: #e5c07b; }\n .tok-operator, .tok-punctuation { color: #abb2bf; }\n .tok-propertyName, .tok-attributeName { color: #61afef; }\n .tok-tagName { color: #98c379; }\n}\n\n/* -- Small screens: the sidebar becomes a drawer ---------------------------------------- */\n@media (max-width: 56rem) {\n /* Content flows on its own; the drawer and its toggle are fixed, so the shell reserves no\n row for either (a grid row here stretched the toggle to the full page height). */\n .shell { display: block; min-height: 0; }\n .site-header { padding-right: 4.25rem; }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0.5rem;\n right: 1rem;\n width: 2.5rem;\n height: 2.5rem;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-1);\n color: var(--text-strong);\n cursor: pointer;\n z-index: 45;\n }\n .nav-toggle:hover { background: var(--surface-2); }\n .nav-toggle:focus-visible { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n .site-nav {\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n height: auto;\n width: min(20rem, 85vw);\n border-right: 1px solid var(--border-strong);\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n transform: translateX(-100%);\n /* Hidden while closed, so its links are not tab stops behind the page; the visibility\n change waits for the slide out. */\n visibility: hidden;\n transition: transform 160ms ease-out, visibility 0s linear 160ms;\n z-index: 40;\n }\n body.nav-open .site-nav { transform: translateX(0); visibility: visible; transition: transform 160ms ease-out; }\n body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 35; }\n .content { padding: 1rem 1.25rem 3rem; }\n /* The box is narrow here, beside the title and the menu button, so its results hang from the\n header instead: once the form is static, the sticky header is what they are positioned in.\n The height limit keeps the last result reachable on a phone held sideways, since the panel\n moves with the header and scrolling the page would not bring its end into view. */\n .site-search { flex-basis: 12rem; position: static; }\n .site-search-results {\n left: auto;\n right: 1rem;\n width: min(26rem, calc(100vw - 2rem));\n max-height: min(24rem, calc(100dvh - var(--header-height) - 1rem));\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .site-nav { transition: none; }\n body.nav-open .site-nav { transition: none; }\n}\n",
13649
13775
  "../etherpk-docs/layouts/404.html": "{{> shell-top}}\n <article class=\"page not-published\">\n <header class=\"page-header\">\n <h1>Not published</h1>\n </header>\n <div class=\"page-body\">\n <p>The page you followed a link to is not part of this site.</p>\n <p><a href=\"index.html\">Back to {{site.title}}</a></p>\n </div>\n </article>\n{{> shell-bottom}}\n",
13650
13776
  "../etherpk-docs/layouts/archive.html": "{{> shell-top}}\n <article class=\"page archive\">\n <header class=\"page-header\">\n <h1>{{#page.isPostsArchive}}Posts{{/page.isPostsArchive}}{{#page.isJournalArchive}}Journal{{/page.isJournalArchive}}</h1>\n </header>\n {{#page.isPostsArchive}}\n {{#site.postsByYear}}\n <h2 class=\"archive-year\" id=\"y{{year}}\">{{year}}</h2>\n <ul class=\"journal-archive\">\n {{#posts}}\n <li>\n <time datetime=\"{{date}}\">{{date}}</time>\n <a href=\"{{url}}\">{{title}}</a>\n </li>\n {{/posts}}\n </ul>\n {{/site.postsByYear}}\n {{/page.isPostsArchive}}\n {{#page.isJournalArchive}}\n <ul class=\"journal-archive\">\n {{#site.journals}}\n <li>\n <time datetime=\"{{date}}\">{{date}}</time>\n <a href=\"{{url}}\">{{title}}</a>\n {{#excerpt}}<p class=\"archive-excerpt\">{{excerpt}}</p>{{/excerpt}}\n </li>\n {{/site.journals}}\n </ul>\n {{/page.isJournalArchive}}\n </article>\n{{> shell-bottom}}\n",
13651
13777
  "../etherpk-docs/layouts/home.html": "{{> shell-top}}\n <article class=\"page home\">\n {{^page.isGeneratedIndex}}\n <header class=\"page-header\">\n <h1>{{{page.titleHtml}}}</h1>\n </header>\n{{> toc}}\n {{/page.isGeneratedIndex}}\n {{#page.isGeneratedIndex}}\n <header class=\"page-header\">\n <h1>{{site.title}}</h1>\n </header>\n {{/page.isGeneratedIndex}}\n <div class=\"page-body\">\n{{{page.content}}}\n </div>\n </article>\n{{> shell-bottom}}\n",
@@ -13721,7 +13847,7 @@ var files = /* #__PURE__ */ Object.assign({
13721
13847
  "../etherpk-stack/theme.json": "{\n \"name\": \"etherpk-stack\",\n \"title\": \"EtherPK Stack\",\n \"version\": \"1.0.0\",\n \"contract\": 1,\n \"description\": \"In the mould of Hugo's Stack: a card-based blog with a left sidebar of site identity and menu, article cards in the middle, and widgets (search, contents, archive, pages) on the right.\",\n \"kinds\": [\"blog\", \"docs\"],\n \"includes\": [\n { \"name\": \"head\", \"description\": \"Extra markup inside <head>: analytics, fonts, meta tags. Raw HTML in the page body.\" },\n { \"name\": \"logo\", \"description\": \"The avatar above the site title in the sidebar: an image or inline SVG. Replaces the EtherPK icon.\" },\n { \"name\": \"favicon\", \"description\": \"The icon in the browser tab: a <link rel=\\\"icon\\\"> tag. Raw HTML in the page body. Replaces the EtherPK icon.\" },\n { \"name\": \"header\", \"description\": \"The left sidebar's identity block (avatar, title, description). Replaces the theme's - the menu stays.\" },\n { \"name\": \"before-content\", \"description\": \"Rendered above every page's content: a banner, a notice.\" },\n { \"name\": \"after-content\", \"description\": \"Rendered below every page's content, above the linked references: an author bio, a comments widget.\" },\n { \"name\": \"footer\", \"description\": \"The footer under the article column.\" },\n { \"name\": \"scripts\", \"description\": \"Scripts before </body>, added after the theme's own (search, the theme toggle): analytics, a widget. Raw HTML in the page body.\" },\n { \"name\": \"styles\", \"description\": \"CSS appended after the theme's stylesheet: the page's first css fence.\", \"kind\": \"css\" }\n ],\n \"files\": [\n \"layouts/page.html\", \"layouts/home.html\", \"layouts/journal.html\", \"layouts/archive.html\", \"layouts/404.html\",\n \"partials/shell-top.html\", \"partials/shell-bottom.html\", \"partials/head.html\", \"partials/logo.html\", \"partials/favicon.html\", \"partials/header.html\",\n \"partials/nav-item.html\", \"partials/toc.html\", \"partials/backlinks.html\", \"partials/article-card.html\", \"partials/widgets.html\",\n \"partials/before-content.html\", \"partials/after-content.html\", \"partials/footer.html\", \"partials/theme-scripts.html\", \"partials/scripts.html\",\n \"assets/theme.css\", \"assets/favicon.svg\", \"assets/search.js\", \"assets/theme.js\"\n ]\n}\n",
13722
13848
  "../etherpk-terminal/assets/favicon.svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 191.82 166.13\">\n <path fill=\"#0a0a0a\" fill-rule=\"evenodd\" d=\"M67.09,132.92,47.93,166.13H9.59L0,149.52,86.33,0H105.5L19.17,149.52H38.34l19.17-33.2h76.8l9.59,16.6Zm48-83.12,9.65,16.71H143.9L115.08,16.6q-24,41.57-48,83.12H143.9q14.37,24.9,28.76,49.8h-96l-9.59,16.61H182.24l9.58-16.61-38.34-66.4H96C95.85,82.9,113.39,52.73,115.08,49.8Z\"/>\n</svg>\n",
13723
13849
  "../etherpk-terminal/assets/search.js": "/*\n * Search for a Published Site: reads search.json (built over the publication's own documents\n * and nothing else) and scores documents by title and text matches. No dependencies, no\n * network beyond the one index file, and nothing runs until the search box is used. The same\n * script runs the sidebar toggle on small screens, so a page carries one script.\n */\n(function () {\n 'use strict';\n\n // -- Navigation toggle (small screens) -------------------------------------------------\n var toggle = document.querySelector('.nav-toggle');\n var backdrop = document.querySelector('.nav-backdrop');\n var nav = document.getElementById('site-nav');\n function setNavOpen(open) {\n var was = document.body.classList.contains('nav-open');\n document.body.classList.toggle('nav-open', open);\n if (toggle) toggle.setAttribute('aria-expanded', open ? 'true' : 'false');\n if (backdrop) backdrop.hidden = !open;\n // Focus follows the drawer: into its first link on open, back to the button on close,\n // so a keyboard or screen-reader user is never left on something now hidden.\n if (open && !was) {\n var first = nav.querySelector('a');\n if (first) first.focus();\n } else if (!open && was && toggle) {\n toggle.focus();\n }\n }\n if (toggle && nav) {\n toggle.addEventListener('click', function () { setNavOpen(!document.body.classList.contains('nav-open')); });\n if (backdrop) backdrop.addEventListener('click', function () { setNavOpen(false); });\n document.addEventListener('keydown', function (e) {\n if (e.key === 'Escape' && document.body.classList.contains('nav-open')) setNavOpen(false);\n });\n }\n\n // -- Search --------------------------------------------------------------------------\n var form = document.querySelector('.site-search');\n if (!form) return;\n var input = form.querySelector('input[type=\"search\"]');\n var results = form.querySelector('.site-search-results');\n var indexUrl = form.getAttribute('data-search-index') || 'search.json';\n var scriptUrl = form.getAttribute('data-search-script') || 'search-index.js';\n var index = null;\n var loading = null;\n /* True once neither route produced the index: the results then say so rather than \"nothing matches\". */\n var unavailable = false;\n\n /* The index as a script assigning window.etherpkSearchIndex: what a site opened from disk can\n load, since file:// refuses fetch but allows <script src>. */\n function loadScript() {\n return new Promise(function (resolve, reject) {\n if (window.etherpkSearchIndex) { resolve(window.etherpkSearchIndex); return; }\n var s = document.createElement('script');\n s.src = scriptUrl;\n s.onload = function () {\n if (window.etherpkSearchIndex) resolve(window.etherpkSearchIndex);\n else reject(new Error('no index'));\n };\n s.onerror = function () { reject(new Error('no script')); };\n document.head.appendChild(s);\n });\n }\n\n function load() {\n if (index) return Promise.resolve(index);\n if (!loading) {\n loading = fetch(indexUrl).then(function (r) {\n if (!r.ok) throw new Error(String(r.status));\n return r.json();\n }).catch(loadScript).then(function (data) {\n index = (data && data.documents) || [];\n return index;\n }).catch(function () { unavailable = true; index = []; return index; });\n }\n return loading;\n }\n\n function tokens(q) {\n return q.toLowerCase().split(/\\s+/).filter(function (t) { return t.length > 0; });\n }\n\n function score(doc, terms) {\n var title = (doc.title || '').toLowerCase();\n var text = (doc.text || '').toLowerCase();\n var s = 0;\n for (var i = 0; i < terms.length; i++) {\n var t = terms[i];\n if (title === t) s += 20;\n else if (title.indexOf(t) === 0) s += 10;\n else if (title.indexOf(t) !== -1) s += 6;\n var at = text.indexOf(t);\n if (at !== -1) s += 2;\n else if (title.indexOf(t) === -1) return 0; // every term must match somewhere\n }\n return s;\n }\n\n function snippet(doc, terms) {\n var text = doc.text || '';\n var lower = text.toLowerCase();\n var at = -1;\n for (var i = 0; i < terms.length && at === -1; i++) at = lower.indexOf(terms[i]);\n if (at === -1) return doc.excerpt || '';\n var start = Math.max(0, at - 60);\n var end = Math.min(text.length, at + 100);\n return (start > 0 ? '…' : '') + text.slice(start, end).replace(/\\s+/g, ' ') + (end < text.length ? '…' : '');\n }\n\n function escapeHtml(s) {\n return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\n }\n\n function render(list, q) {\n if (!q) { results.hidden = true; results.innerHTML = ''; return; }\n if (unavailable) {\n results.innerHTML = '<p class=\"site-search-empty\">The search index could not be loaded.</p>';\n results.hidden = false;\n return;\n }\n if (list.length === 0) {\n results.innerHTML = '<p class=\"site-search-empty\">Nothing matches \"' + escapeHtml(q) + '\".</p>';\n results.hidden = false;\n return;\n }\n results.innerHTML = list.map(function (hit) {\n return '<a class=\"site-search-hit\" role=\"option\" href=\"' + escapeHtml(hit.doc.url) + '\">' +\n '<span class=\"site-search-title\">' + escapeHtml(hit.doc.title) + '</span>' +\n '<span class=\"site-search-snippet\">' + escapeHtml(hit.snippet) + '</span></a>';\n }).join('');\n results.hidden = false;\n }\n\n var timer = null;\n function run() {\n var q = input.value.trim();\n var terms = tokens(q);\n if (terms.length === 0) { render([], ''); return; }\n load().then(function (docs) {\n var hits = [];\n for (var i = 0; i < docs.length; i++) {\n var s = score(docs[i], terms);\n if (s > 0) hits.push({ doc: docs[i], score: s, snippet: snippet(docs[i], terms) });\n }\n hits.sort(function (a, b) { return b.score - a.score || a.doc.title.localeCompare(b.doc.title); });\n render(hits.slice(0, 12), q);\n });\n }\n\n input.addEventListener('input', function () {\n clearTimeout(timer);\n timer = setTimeout(run, 120);\n });\n input.addEventListener('focus', function () { load(); });\n form.addEventListener('submit', function (e) {\n e.preventDefault();\n var first = results.querySelector('a');\n if (first) window.location.href = first.getAttribute('href');\n });\n document.addEventListener('keydown', function (e) {\n if (e.key === '/' && document.activeElement !== input && !/input|textarea/i.test(document.activeElement.tagName)) {\n e.preventDefault();\n input.focus();\n }\n if (e.key === 'Escape' && !results.hidden) { render([], ''); }\n });\n document.addEventListener('click', function (e) {\n if (!form.contains(e.target)) render([], '');\n });\n})();\n",
13724
- "../etherpk-terminal/assets/theme.css": "/* EtherPK's Terminal: after Hugo's Terminal (panr, MIT), written afresh for EtherPK's view - one\n monospace face, a dark ground, no colour at all - the accent is a brighter shade of the text,\n so everything is drawn in tones of one ink - the block logo with its blinking cursor,\n underlined titles, framed boxes and bordered buttons. Uses Fira Code\n or the system monospace, so the site loads nothing from anywhere. Classes the publisher emits\n and this file styles: .wikilink, .wikilink-missing, .task, .task-tag, .toc, .backlinks,\n .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --accent: #f2f2f2;\n --background: #1d1e28;\n --color: #cfcfd6;\n --color-muted: #8f8f9a;\n --border-color: rgba(255, 255, 255, 0.1);\n --code-bg: rgba(255, 255, 255, 0.06);\n --font: \"Fira Code\", ui-monospace, Monaco, Consolas, \"Ubuntu Mono\", monospace;\n --container-width: 1080px;\n --mark: rgba(255, 255, 255, 0.22);\n --missing: var(--color-muted);\n}\n/* Terminal is dark by nature; a light system preference is respected, the ink inverted. */\n@media (prefers-color-scheme: light) {\n :root:not([data-theme=\"dark\"]) {\n --accent: #111111;\n --background: #f7f4ef;\n --color: #2b2b2b;\n --color-muted: #6a6a6a;\n --mark: rgba(0, 0, 0, 0.14);\n --border-color: rgba(0, 0, 0, 0.12);\n --code-bg: rgba(0, 0, 0, 0.05);\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { color-scheme: dark light; }\nbody {\n margin: 0;\n font-family: var(--font);\n font-size: 0.9375rem;\n line-height: 1.6;\n background: var(--background);\n color: var(--color);\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n font-feature-settings: \"liga\", \"tnum\", \"zero\", \"ss01\", \"locl\";\n}\na { color: var(--accent); }\na:hover { text-decoration: none; }\nimg { max-width: 100%; height: auto; display: block; }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--background); padding: 8px 16px; z-index: 100; }\n.skip-link:focus { left: 16px; top: 16px; }\n\n.container { max-width: var(--container-width); margin: 0 auto; padding: 40px; }\n\n/* -- Header: the prompt-style logo ------------------------------------------------------ */\n.header { margin-bottom: 40px; }\n.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }\n/* The block logo: the mark, the title and a blinking cursor on one line, the mark's box sized\n to the text's cap height so the two read as one glyph run. */\n.logo {\n display: inline-flex;\n align-items: center;\n gap: 12px;\n padding: 8px 16px;\n background: var(--accent);\n color: var(--background);\n font-size: 1.375rem;\n line-height: 1;\n font-weight: bold;\n text-decoration: none;\n}\n.logo:hover { text-decoration: none; }\n.logo__mark { display: inline-flex; align-items: center; line-height: 0; }\n.logo__mark .site-logo { display: block; width: 1.3em; height: 1.125em; }\n.logo__cursor {\n display: inline-block;\n width: 0.5em;\n height: 1em;\n background: var(--background);\n animation: cursor 1s infinite;\n}\n@keyframes cursor { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }\n@media (prefers-reduced-motion: reduce) { .logo__cursor { animation: none; } }\n.menu { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 30px; }\n.menu__inner { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 30px; }\n.menu__inner li a, .menu__inner .nav-group-label { color: var(--color); text-decoration: none; }\n.menu__inner li a:hover { color: var(--accent); }\n.menu__inner .nav-current > a { color: var(--accent); }\n.menu__inner .nav-current > a::after { content: \" *\"; }\n.menu__inner .nav-group-label { color: var(--color-muted); }\n.menu__inner .nav-group-label::after { content: \":\"; }\n/* A nested outline level follows its parent on the same line, the way a path reads. */\n.menu__inner li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }\n.menu__inner .site-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 12px; }\n.menu__inner .site-nav-list li::before { content: \"/\"; color: var(--color-muted); margin-right: 12px; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 16rem; }\n.site-search input {\n width: 100%;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--color);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }\n.site-search input::placeholder { color: var(--color-muted); }\n.site-search-results {\n position: absolute;\n right: 0;\n top: calc(100% + 6px);\n width: min(26rem, 90vw);\n max-height: 24rem;\n overflow: auto;\n background: var(--background);\n border: 1px solid var(--accent);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 8px 12px; color: var(--color); text-decoration: none; border-bottom: 1px solid var(--border-color); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--code-bg); }\n.site-search-title { display: block; color: var(--accent); }\n.site-search-snippet { display: block; color: var(--color-muted); font-size: 0.9rem; }\n.site-search-empty { margin: 0; padding: 8px 12px; color: var(--color-muted); }\n\n/* -- Posts ------------------------------------------------------------------------------ */\n.posts { width: 100%; }\n.post { width: 100%; }\n.post.on-list { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px dotted var(--accent); }\n.post.on-list:last-child { border-bottom: 0; }\n.post-title {\n position: relative;\n margin: 0 0 15px;\n font-size: 1.6rem;\n line-height: 1.3;\n color: var(--accent);\n text-decoration: underline;\n text-decoration-color: var(--accent);\n text-decoration-thickness: 2px;\n text-underline-offset: 6px;\n}\n.post-title a { color: inherit; text-decoration: none; }\n.post-title .wikilink { color: inherit; text-decoration: none; }\n.index-title { text-decoration: none; }\n.index-title::before { content: \"# \"; }\n.post-meta { margin: 0 0 20px; font-size: 0.9rem; color: var(--color-muted); }\n.post-content { margin-top: 20px; }\n.post-content h1, .post-content h2, .post-content h3, .post-content h4 { font-weight: bold; line-height: 1.3; margin: 40px 0 20px; }\n.post-content h2 { font-size: 1.3rem; }\n.post-content h3 { font-size: 1.2rem; }\n.post-content h2::before { content: \"## \"; color: var(--accent); }\n.post-content h3::before { content: \"### \"; color: var(--accent); }\n.post-content p { margin: 0 0 20px; }\n.post-content ul, .post-content ol { margin: 0 0 20px; padding-left: 24px; }\n.post-content li { margin: 4px 0; }\n.post-content ul li::marker { color: var(--accent); }\n.post-content img { margin: 20px 0; border: 1px solid var(--border-color); }\n.post-content .diagram { margin: 20px 0; text-align: center; }\n.post-content .diagram svg { max-width: 100%; height: auto; }\n.post-content blockquote {\n position: relative;\n margin: 40px 0;\n padding: 25px;\n border-top: 1px solid var(--accent);\n border-bottom: 1px solid var(--accent);\n font-style: italic;\n}\n.post-content blockquote::before { content: \"”\"; position: absolute; top: -40px; left: 10px; font-size: 3.875rem; font-style: normal; color: var(--accent); }\n.post-content blockquote p:last-child { margin-bottom: 0; }\n.post-content hr { border: 0; border-top: 1px dashed var(--accent); margin: 40px 0; }\n.post-content table { width: 100%; border-collapse: collapse; margin: 20px 0; }\n.post-content th, .post-content td { padding: 8px 12px; border: 1px dashed var(--accent); text-align: left; }\n.post-content th { color: var(--accent); }\n.post-content code { padding: 1px 6px; background: var(--code-bg); font-family: inherit; font-size: 0.95em; }\n.post-content pre {\n margin: 20px 0;\n padding: 20px;\n background: var(--code-bg);\n border-left: 3px solid var(--accent);\n overflow-x: auto;\n font-family: inherit;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n.post-content pre code { padding: 0; background: none; font-size: inherit; }\n.math-block { overflow-x: auto; margin: 20px 0; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; }\n\n/* Wikilinks and tasks. */\na.wikilink { color: var(--accent); }\na.wikilink-missing { color: var(--missing); text-decoration-style: dotted; }\nli.task { list-style: none; margin-left: -24px; }\nli.task input[type=\"checkbox\"] { accent-color: var(--accent); margin-right: 6px; vertical-align: -0.1em; }\nli.task.done { color: var(--color-muted); text-decoration: line-through; }\n.task-tag { display: inline-block; padding: 0 6px; margin-right: 4px; border: 1px solid var(--accent); color: var(--accent); font-size: 0.8rem; }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Buttons, frames, the table of contents and pagination. */\n.button {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n padding: 8px 18px;\n border: 1px solid var(--accent);\n color: var(--accent);\n font: inherit;\n text-decoration: none;\n background: transparent;\n cursor: pointer;\n}\n.button:hover { background: var(--accent); color: var(--background); }\n.button.inline { display: inline-flex; }\n.read-more { margin-top: 10px; }\n.all-posts { margin: 30px 0 0; }\n/* The contents page of a docs site: the outline as a tree, then any page it leaves out. */\n.page-index-list { list-style: none; margin: 0; padding: 0; }\n.page-index-list .page-index-list { padding-left: 24px; }\n.page-index-list li { margin: 6px 0; }\n.page-index-list li::before { content: \"- \"; color: var(--accent); }\n.page-index-list a { color: var(--color); }\n.page-index-list a:hover { color: var(--accent); }\n.page-index-group-label { color: var(--color-muted); }\n.page-index-group-label::after { content: \":\"; }\n.page-index-other { margin: 30px 0 10px; font-size: 1.1rem; }\n.page-index-other::before { content: \"## \"; color: var(--accent); }\n/* The archives: a year as a prompt-style heading, then one line per post. */\n.archive-year { margin: 30px 0 10px; font-size: 1.1rem; }\n.archive-year::before { content: \"## \"; color: var(--accent); }\n.archive-list { list-style: none; margin: 0; padding: 0; }\n.archive-list li { margin: 6px 0; }\n.archive-list time { color: var(--color-muted); margin-right: 12px; font-variant-numeric: tabular-nums; }\n.archive-list a { color: var(--color); }\n.archive-list a:hover { color: var(--accent); }\n.archive-excerpt { color: var(--color-muted); }\n.framed { border: 1px solid var(--accent); padding: 20px; }\n.toc { margin: 20px 0 40px; }\n.toc__title { margin: 0 0 10px; color: var(--accent); }\n.toc ul { list-style: none; margin: 0; padding: 0; }\n.toc li { margin: 4px 0; }\n.toc li::before { content: \"- \"; color: var(--accent); }\n.toc li.toc-level-3 { padding-left: 1.5rem; }\n.toc li.toc-level-4 { padding-left: 3rem; }\n.toc a { color: var(--color); text-decoration: none; }\n.toc a:hover { color: var(--accent); }\n.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 50px; }\n.pagination__next { margin-left: auto; }\n.button__text { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n/* Linked references, framed like everything else worth a box. */\n.backlinks { margin-top: 40px; border: 1px solid var(--accent); padding: 20px; }\n.backlinks h2 { margin: 0 0 12px; font-size: 1rem; color: var(--accent); }\n.backlinks h2::before { content: \":: \"; }\n.backlink-list { list-style: none; margin: 0; padding: 0; }\n.backlink-source { margin: 0 0 12px; }\n.backlink-source > a { color: var(--color); }\n.backlink-source ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 16px; border-left: 1px dashed var(--accent); }\n.backlink-context { color: var(--color-muted); font-size: 0.9rem; margin: 2px 0; }\n\n/* -- Footer ----------------------------------------------------------------------------- */\n.footer { margin-top: 60px; padding-top: 20px; border-top: 1px dotted var(--accent); font-size: 0.9rem; color: var(--color-muted); }\n.footer__inner { display: flex; flex-wrap: wrap; gap: 10px; }\n.copyright { display: flex; flex-wrap: wrap; gap: 0 8px; }\n.footer__separator { color: var(--accent); }\n\n/* Code tokens (lezer classHighlighter names). */\n/* Code tokens (lezer classHighlighter names), in tones of the one ink: weight and italics carry\n the distinction the usual colours would. */\n.tok-keyword { color: var(--accent); font-weight: bold; }\n.tok-string, .tok-string2 { color: var(--color); font-style: italic; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: var(--color-muted); font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: var(--accent); }\n.tok-function, .tok-definition.tok-variableName { color: var(--accent); }\n.tok-typeName, .tok-className, .tok-namespace { color: var(--accent); font-weight: bold; }\n.tok-operator, .tok-punctuation { color: var(--color-muted); }\n.tok-propertyName, .tok-attributeName { color: var(--color); }\n.tok-tagName { color: var(--accent); }\n.tok-invalid { color: var(--missing); text-decoration: underline wavy; }\n\n/* -- Small screens: the menu behind a Terminal-style button ----------------------------- */\n@media (max-width: 684px) {\n .container { padding: 20px; }\n .nav-toggle {\n display: inline-block;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--accent);\n font: inherit;\n cursor: pointer;\n }\n .nav-toggle::before { content: \"$ \"; }\n .menu { display: none; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 20px; padding: 20px; border: 1px solid var(--accent); }\n body.nav-open .menu { display: flex; }\n .menu__inner { flex-direction: column; gap: 8px; }\n .menu__inner li { flex-direction: column; align-items: flex-start; }\n .menu__inner .site-nav-list { flex-direction: column; padding-left: 12px; }\n .menu__inner .site-nav-list li::before { margin-right: 6px; }\n .site-search { margin-left: 0; flex-basis: auto; }\n .post-title { font-size: 1.3rem; }\n .pagination__prev, .pagination__next { flex-basis: 100%; }\n .pagination__next { justify-content: flex-end; }\n}\n",
13850
+ "../etherpk-terminal/assets/theme.css": "/* EtherPK's Terminal: after Hugo's Terminal (panr, MIT), written afresh for EtherPK's view - one\n monospace face, a dark ground, no colour at all - the accent is a brighter shade of the text,\n so everything is drawn in tones of one ink - the block logo with its blinking cursor,\n underlined titles, framed boxes and bordered buttons. Uses Fira Code\n or the system monospace, so the site loads nothing from anywhere. Classes the publisher emits\n and this file styles: .wikilink, .wikilink-missing, .task, .task-tag, .toc, .backlinks,\n .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --accent: #f2f2f2;\n --background: #1d1e28;\n --color: #cfcfd6;\n --color-muted: #8f8f9a;\n --border-color: rgba(255, 255, 255, 0.1);\n --code-bg: rgba(255, 255, 255, 0.06);\n --font: \"Fira Code\", ui-monospace, Monaco, Consolas, \"Ubuntu Mono\", monospace;\n --container-width: 1080px;\n --mark: rgba(255, 255, 255, 0.22);\n --missing: var(--color-muted);\n}\n/* Terminal is dark by nature; a light system preference is respected, the ink inverted. */\n@media (prefers-color-scheme: light) {\n :root:not([data-theme=\"dark\"]) {\n --accent: #111111;\n --background: #f7f4ef;\n --color: #2b2b2b;\n --color-muted: #6a6a6a;\n --mark: rgba(0, 0, 0, 0.14);\n --border-color: rgba(0, 0, 0, 0.12);\n --code-bg: rgba(0, 0, 0, 0.05);\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { color-scheme: dark light; }\nbody {\n margin: 0;\n font-family: var(--font);\n font-size: 0.9375rem;\n line-height: 1.6;\n background: var(--background);\n color: var(--color);\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n font-feature-settings: \"liga\", \"tnum\", \"zero\", \"ss01\", \"locl\";\n}\na { color: var(--accent); }\na:hover { text-decoration: none; }\nimg { max-width: 100%; height: auto; display: block; }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--background); padding: 8px 16px; z-index: 100; }\n.skip-link:focus { left: 16px; top: 16px; }\n\n.container { max-width: var(--container-width); margin: 0 auto; padding: 40px; }\n\n/* -- Header: the prompt-style logo ------------------------------------------------------ */\n.header { margin-bottom: 40px; }\n.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }\n/* The block logo: the mark, the title and a blinking cursor on one line, the mark's box sized\n to the text's cap height so the two read as one glyph run. */\n.logo {\n display: inline-flex;\n align-items: center;\n gap: 12px;\n padding: 8px 16px;\n background: var(--accent);\n color: var(--background);\n font-size: 1.375rem;\n line-height: 1;\n font-weight: bold;\n text-decoration: none;\n}\n.logo:hover { text-decoration: none; }\n.logo__mark { display: inline-flex; align-items: center; line-height: 0; }\n.logo__mark .site-logo { display: block; width: 1.3em; height: 1.125em; }\n.logo__cursor {\n display: inline-block;\n width: 0.5em;\n height: 1em;\n background: var(--background);\n animation: cursor 1s infinite;\n}\n@keyframes cursor { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }\n@media (prefers-reduced-motion: reduce) { .logo__cursor { animation: none; } }\n.menu { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 30px; }\n.menu__inner { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 30px; }\n.menu__inner li a, .menu__inner .nav-group-label { color: var(--color); text-decoration: none; }\n.menu__inner li a:hover { color: var(--accent); }\n.menu__inner .nav-current > a { color: var(--accent); }\n.menu__inner .nav-current > a::after { content: \" *\"; }\n.menu__inner .nav-group-label { color: var(--color-muted); }\n.menu__inner .nav-group-label::after { content: \":\"; }\n/* A nested outline level follows its parent on the same line, the way a path reads. */\n.menu__inner li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }\n.menu__inner .site-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 12px; }\n.menu__inner .site-nav-list li::before { content: \"/\"; color: var(--color-muted); margin-right: 12px; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 16rem; }\n.site-search input {\n width: 100%;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--color);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }\n.site-search input::placeholder { color: var(--color-muted); }\n.site-search-results {\n position: absolute;\n right: 0;\n top: calc(100% + 6px);\n width: min(26rem, 90vw);\n max-height: 24rem;\n overflow: auto;\n background: var(--background);\n border: 1px solid var(--accent);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 8px 12px; color: var(--color); text-decoration: none; border-bottom: 1px solid var(--border-color); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--code-bg); }\n.site-search-title { display: block; color: var(--accent); }\n.site-search-snippet { display: block; color: var(--color-muted); font-size: 0.9rem; }\n.site-search-empty { margin: 0; padding: 8px 12px; color: var(--color-muted); }\n\n/* -- Posts ------------------------------------------------------------------------------ */\n.posts { width: 100%; }\n.post { width: 100%; }\n.post.on-list { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px dotted var(--accent); }\n.post.on-list:last-child { border-bottom: 0; }\n.post-title {\n position: relative;\n margin: 0 0 15px;\n font-size: 1.6rem;\n line-height: 1.3;\n color: var(--accent);\n text-decoration: underline;\n text-decoration-color: var(--accent);\n text-decoration-thickness: 2px;\n text-underline-offset: 6px;\n}\n.post-title a { color: inherit; text-decoration: none; }\n.post-title .wikilink { color: inherit; text-decoration: none; }\n.index-title { text-decoration: none; }\n.index-title::before { content: \"# \"; }\n.post-meta { margin: 0 0 20px; font-size: 0.9rem; color: var(--color-muted); }\n.post-content { margin-top: 20px; }\n.post-content h1, .post-content h2, .post-content h3, .post-content h4 { font-weight: bold; line-height: 1.3; margin: 40px 0 20px; }\n.post-content h2 { font-size: 1.3rem; }\n.post-content h3 { font-size: 1.2rem; }\n.post-content h2::before { content: \"## \"; color: var(--accent); }\n.post-content h3::before { content: \"### \"; color: var(--accent); }\n.post-content p { margin: 0 0 20px; }\n.post-content ul, .post-content ol { margin: 0 0 20px; padding-left: 24px; }\n.post-content li { margin: 4px 0; }\n.post-content ul li::marker { color: var(--accent); }\n.post-content img { margin: 20px 0; border: 1px solid var(--border-color); }\n.post-content .diagram { margin: 20px 0; text-align: center; }\n.post-content .diagram svg { max-width: 100%; height: auto; }\n.post-content blockquote {\n position: relative;\n margin: 40px 0;\n padding: 25px;\n border-top: 1px solid var(--accent);\n border-bottom: 1px solid var(--accent);\n font-style: italic;\n}\n.post-content blockquote::before { content: \"”\"; position: absolute; top: -40px; left: 10px; font-size: 3.875rem; font-style: normal; color: var(--accent); }\n.post-content blockquote p:last-child { margin-bottom: 0; }\n.post-content hr { border: 0; border-top: 1px dashed var(--accent); margin: 40px 0; }\n.post-content table { width: 100%; border-collapse: collapse; margin: 20px 0; }\n.post-content th, .post-content td { padding: 8px 12px; border: 1px dashed var(--accent); text-align: left; }\n.post-content th { color: var(--accent); }\n.post-content code { padding: 1px 6px; background: var(--code-bg); font-family: inherit; font-size: 0.95em; }\n.post-content pre {\n margin: 20px 0;\n padding: 20px;\n background: var(--code-bg);\n border-left: 3px solid var(--accent);\n overflow-x: auto;\n font-family: inherit;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n.post-content pre code { padding: 0; background: none; font-size: inherit; }\n.math-block { overflow-x: auto; margin: 20px 0; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; }\n\n/* Wikilinks and tasks. */\na.wikilink { color: var(--accent); }\na.wikilink-missing { color: var(--missing); text-decoration-style: dotted; }\nli.task { list-style: none; margin-left: -24px; }\nli.task input[type=\"checkbox\"] { accent-color: var(--accent); margin-right: 6px; vertical-align: -0.1em; }\nli.task.done { color: var(--color-muted); text-decoration: line-through; }\n.task-tag { display: inline-block; padding: 0 6px; margin-right: 4px; border: 1px solid var(--accent); color: var(--accent); font-size: 0.8rem; }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Buttons, frames, the table of contents and pagination. */\n.button {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n padding: 8px 18px;\n border: 1px solid var(--accent);\n color: var(--accent);\n font: inherit;\n text-decoration: none;\n background: transparent;\n cursor: pointer;\n}\n.button:hover { background: var(--accent); color: var(--background); }\n.button.inline { display: inline-flex; }\n.read-more { margin-top: 10px; }\n.all-posts { margin: 30px 0 0; }\n/* The contents page of a docs site: the outline as a tree, then any page it leaves out. */\n.page-index-list { list-style: none; margin: 0; padding: 0; }\n.page-index-list .page-index-list { padding-left: 24px; }\n.page-index-list li { margin: 6px 0; }\n.page-index-list li::before { content: \"- \"; color: var(--accent); }\n.page-index-list a { color: var(--color); }\n.page-index-list a:hover { color: var(--accent); }\n.page-index-group-label { color: var(--color-muted); }\n.page-index-group-label::after { content: \":\"; }\n.page-index-other { margin: 30px 0 10px; font-size: 1.1rem; }\n.page-index-other::before { content: \"## \"; color: var(--accent); }\n/* The archives: a year as a prompt-style heading, then one line per post. */\n.archive-year { margin: 30px 0 10px; font-size: 1.1rem; }\n.archive-year::before { content: \"## \"; color: var(--accent); }\n.archive-list { list-style: none; margin: 0; padding: 0; }\n.archive-list li { margin: 6px 0; }\n.archive-list time { color: var(--color-muted); margin-right: 12px; font-variant-numeric: tabular-nums; }\n.archive-list a { color: var(--color); }\n.archive-list a:hover { color: var(--accent); }\n.archive-excerpt { color: var(--color-muted); }\n.framed { border: 1px solid var(--accent); padding: 20px; }\n.toc { margin: 20px 0 40px; }\n.toc__title { margin: 0 0 10px; color: var(--accent); }\n.toc ul { list-style: none; margin: 0; padding: 0; }\n.toc li { margin: 4px 0; }\n.toc li::before { content: \"- \"; color: var(--accent); }\n.toc li.toc-level-3 { padding-left: 1.5rem; }\n.toc li.toc-level-4 { padding-left: 3rem; }\n.toc a { color: var(--color); text-decoration: none; }\n.toc a:hover { color: var(--accent); }\n.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 50px; }\n.pagination__next { margin-left: auto; }\n.button__text { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n/* Linked references, framed like everything else worth a box. */\n.backlinks { margin-top: 40px; border: 1px solid var(--accent); padding: 20px; }\n.backlinks h2 { margin: 0 0 12px; font-size: 1rem; color: var(--accent); }\n.backlinks h2::before { content: \":: \"; }\n.backlink-list { list-style: none; margin: 0; padding: 0; }\n.backlink-source { margin: 0 0 12px; }\n.backlink-source > a { color: var(--color); }\n.backlink-source ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 16px; border-left: 1px dashed var(--accent); }\n.backlink-context { color: var(--color-muted); font-size: 0.9rem; margin: 2px 0; }\n\n/* -- Footer ----------------------------------------------------------------------------- */\n.footer { margin-top: 60px; padding-top: 20px; border-top: 1px dotted var(--accent); font-size: 0.9rem; color: var(--color-muted); }\n.footer__inner { display: flex; flex-wrap: wrap; gap: 10px; }\n.copyright { display: flex; flex-wrap: wrap; gap: 0 8px; }\n.footer__separator { color: var(--accent); }\n\n/* Code tokens (lezer classHighlighter names). */\n/* Code tokens (lezer classHighlighter names), in tones of the one ink: weight and italics carry\n the distinction the usual colours would. */\n.tok-keyword { color: var(--accent); font-weight: bold; }\n.tok-string, .tok-string2 { color: var(--color); font-style: italic; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: var(--color-muted); font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: var(--accent); }\n.tok-function, .tok-definition.tok-variableName { color: var(--accent); }\n.tok-typeName, .tok-className, .tok-namespace { color: var(--accent); font-weight: bold; }\n.tok-operator, .tok-punctuation { color: var(--color-muted); }\n.tok-propertyName, .tok-attributeName { color: var(--color); }\n.tok-tagName { color: var(--accent); }\n.tok-invalid { color: var(--missing); text-decoration: underline wavy; }\n\n/* -- Small screens: the menu behind a Terminal-style button ----------------------------- */\n@media (max-width: 684px) {\n .container { padding: 20px; }\n .nav-toggle {\n display: inline-block;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--accent);\n font: inherit;\n cursor: pointer;\n }\n .nav-toggle::before { content: \"$ \"; }\n .menu { display: none; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 20px; padding: 20px; border: 1px solid var(--accent); }\n body.nav-open .menu { display: flex; }\n .menu__inner { flex-direction: column; gap: 8px; }\n .menu__inner li { flex-direction: column; align-items: flex-start; }\n .menu__inner .site-nav-list { flex-direction: column; padding-left: 12px; }\n .menu__inner .site-nav-list li::before { margin-right: 6px; }\n .site-search { margin-left: 0; flex-basis: auto; }\n .site-search-results { left: 0; right: 0; width: auto; }\n .post-title { font-size: 1.3rem; }\n .pagination__prev, .pagination__next { flex-basis: 100%; }\n .pagination__next { justify-content: flex-end; }\n}\n",
13725
13851
  "../etherpk-terminal/layouts/404.html": "{{> shell-top}}\n <article class=\"post\">\n <h1 class=\"post-title\">404 :: not published</h1>\n <div class=\"post-content\">\n <p>$ the page you followed a link to is not part of this site.</p>\n <p><a class=\"button inline\" href=\"index.html\">← {{site.title}}</a></p>\n </div>\n </article>\n{{> shell-bottom}}\n",
13726
13852
  "../etherpk-terminal/layouts/archive.html": "{{> shell-top}}\n <article class=\"post archive\">\n <h1 class=\"post-title index-title\">{{#page.isPostsArchive}}posts{{/page.isPostsArchive}}{{#page.isJournalArchive}}journal{{/page.isJournalArchive}}</h1>\n {{#page.isPostsArchive}}\n {{#site.postsByYear}}\n <h2 class=\"archive-year\" id=\"y{{year}}\">{{year}}</h2>\n <ul class=\"archive-list\">\n {{#posts}}<li><time datetime=\"{{date}}\">{{date}}</time> <a href=\"{{url}}\">{{title}}</a></li>{{/posts}}\n </ul>\n {{/site.postsByYear}}\n {{/page.isPostsArchive}}\n {{#page.isJournalArchive}}\n <ul class=\"archive-list\">\n {{#site.journals}}<li><time datetime=\"{{date}}\">{{date}}</time> <a href=\"{{url}}\">{{title}}</a>{{#excerpt}} <span class=\"archive-excerpt\">{{excerpt}}</span>{{/excerpt}}</li>{{/site.journals}}\n </ul>\n {{/page.isJournalArchive}}\n </article>\n{{> shell-bottom}}\n",
13727
13853
  "../etherpk-terminal/layouts/home.html": "{{> shell-top}}\n {{^page.isGeneratedIndex}}\n <article class=\"post home-info\">\n <h1 class=\"post-title\">{{{page.titleHtml}}}</h1>\n <div class=\"post-content\">\n{{{page.content}}}\n </div>\n </article>\n {{/page.isGeneratedIndex}}\n {{#page.isGeneratedIndex}}\n <h1 class=\"post-title index-title\">{{site.title}}</h1>\n {{/page.isGeneratedIndex}}\n <div class=\"posts\">\n {{#site.isBlog}}{{#site.recentPosts}}{{> post-entry}}{{/site.recentPosts}}{{^site.hasPosts}}<p class=\"post-list-empty\">No dated documents are published yet. A journal entry is dated by its day, a page by a <code>date:</code> line in its frontmatter.</p>{{/site.hasPosts}}{{/site.isBlog}}\n {{^site.isBlog}}{{#page.isGeneratedIndex}}<div class=\"post-content\">{{{page.content}}}</div>{{/page.isGeneratedIndex}}{{/site.isBlog}}\n </div>\n {{#site.isBlog}}{{#site.hasPosts}}\n <p class=\"all-posts\"><a class=\"button inline\" href=\"{{site.postsUrl}}\">$ ls all {{site.postCount}} posts →</a></p>\n {{/site.hasPosts}}{{/site.isBlog}}\n{{> shell-bottom}}\n",
@@ -13979,7 +14105,7 @@ function httpsAddress(value) {
13979
14105
  }
13980
14106
  }
13981
14107
  /** A positive, finite size, or undefined. */
13982
- function size(value) {
14108
+ function size$1(value) {
13983
14109
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
13984
14110
  }
13985
14111
  /**
@@ -13994,8 +14120,8 @@ function checkedFenceAnswer(out) {
13994
14120
  const kind = answer.kind;
13995
14121
  if (kind === "picture") {
13996
14122
  const { type, bytes, alt } = answer;
13997
- const width = size(answer.width);
13998
- const height = size(answer.height);
14123
+ const width = size$1(answer.width);
14124
+ const height = size$1(answer.height);
13999
14125
  if (typeof type !== "string" || !PICTURE_TYPES.has(type) || !(bytes instanceof Uint8Array)) throw new Error("its picture is not an SVG, PNG or WebP file");
14000
14126
  if (width === void 0 || height === void 0) throw new Error("its picture has no size");
14001
14127
  return {
@@ -14016,8 +14142,8 @@ function checkedFenceAnswer(out) {
14016
14142
  if (image !== null && typeof image === "object") {
14017
14143
  const { src: rawSrc, alt, width: rawWidth, height: rawHeight } = image;
14018
14144
  const src = httpsAddress(rawSrc);
14019
- const width = size(rawWidth);
14020
- const height = size(rawHeight);
14145
+ const width = size$1(rawWidth);
14146
+ const height = size$1(rawHeight);
14021
14147
  if (src) picture = {
14022
14148
  src,
14023
14149
  alt: String(alt ?? ""),
@@ -16579,7 +16705,7 @@ async function openDiagramRenderer(env) {
16579
16705
  window.mermaid.initialize({
16580
16706
  startOnLoad: false,
16581
16707
  securityLevel: "strict",
16582
- theme: "default"
16708
+ theme: "neutral"
16583
16709
  });
16584
16710
  });
16585
16711
  return p;
@@ -16610,166 +16736,571 @@ async function openDiagramRenderer(env) {
16610
16736
  }
16611
16737
  };
16612
16738
  }
16613
- // ../../extensions/excalidraw/src/format.ts
16614
- var DRAWING_FENCE = "excalidraw.drawing";
16615
- // src/page-server.ts
16739
+ // ../client/src/lib/storage/fs/asset-store.ts
16616
16740
  /**
16617
- * A server for the pages the Headless Client draws pictures in (map-pictures.ts,
16618
- * drawing-pictures.ts): on the loopback address, answering one page and the files named to it and
16619
- * nothing else, so a page's workers, chunks and fonts load over http as they do in the Client. Open
16620
- * only for a publish that draws something.
16741
+ * The **Asset store** over a {@link DirectoryAdapter}: uploads land as binary files
16742
+ * under `assets/`, named `kebab-stem.<contenthash>.ext` (DESIGN.md → On-disk layout).
16743
+ * Identical bytes de-duplicate to one file **by content and extension alone** - the stem is
16744
+ * display, not identity - so the same file added again under a different name references the
16745
+ * one already stored rather than writing a second copy. Built on the same File-System seam as
16746
+ * {@link createFilesystemDocumentStore}, so the pure naming/dedup logic is Node-testable
16747
+ * over the in-memory adapter before any browser code runs.
16748
+ *
16749
+ * Assets are referenced from documents by a relative path — `../assets/<name>` — which
16750
+ * resolves from any journal entry or page (both sit one level under the graph root,
16751
+ * the Logseq convention). `resolve` reads those bytes back and hands out an object URL plus
16752
+ * the name and MIME type a download or a viewer needs; the URLs are cached per asset and
16753
+ * revoked on {@link AssetStore.dispose}.
16754
+ *
16755
+ * Remote (S3) upload and per-graph access control are deferred (DESIGN.md → Server
16756
+ * Backend); this is the Filesystem Backend path only.
16621
16757
  */
16622
- var TYPES = {
16623
- ".js": "text/javascript; charset=utf-8",
16624
- ".mjs": "text/javascript; charset=utf-8",
16625
- ".css": "text/css; charset=utf-8",
16626
- ".woff2": "font/woff2"
16627
- };
16628
- /** A file built beside this module in the published package (dist/), or in dist/ when run from source. */
16629
- function builtPath(...path) {
16630
- const here = dirname(fileURLToPath(import.meta.url));
16631
- return here.endsWith("dist") ? join(here, ...path) : join(here, "..", "dist", ...path);
16632
- }
16633
- /** Every file under `folder`, by the path a page asks for it at. Empty when the folder is missing. */
16634
- async function filesUnder$1(folder) {
16635
- const files = (await readdir(folder, {
16636
- recursive: true,
16637
- withFileTypes: true
16638
- }).catch(() => [])).filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name));
16639
- return new Map(files.map((file) => [`/${relative(folder, file).split(sep).join("/")}`, file]));
16640
- }
16641
- /** The server: `html` at `/page.html`, and each of `files` at its path. */
16642
- async function servePage(html, files) {
16643
- const server = createServer$1((request, response) => {
16644
- const path = new URL(request.url ?? "/", "http://localhost").pathname;
16645
- if (path === "/page.html") {
16646
- response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }).end(html);
16647
- return;
16648
- }
16649
- const file = files.get(path);
16650
- if (!file) {
16651
- response.writeHead(404).end();
16652
- return;
16653
- }
16654
- readFile(file).then((bytes) => response.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" }).end(bytes), () => response.writeHead(404).end());
16655
- });
16656
- await new Promise((resolve, reject) => {
16657
- server.once("error", reject);
16658
- server.listen(0, "127.0.0.1", () => resolve());
16659
- });
16660
- const address = server.address();
16661
- if (!address || typeof address === "string") throw new Error("The page server has no port.");
16662
- return {
16663
- server,
16664
- origin: `http://127.0.0.1:${address.port}`
16665
- };
16666
- }
16667
- // src/drawing-pictures.ts
16758
+ /** Extensions rendered inline as images (everything else renders as a download link). */
16759
+ var IMAGE_EXTS = /* @__PURE__ */ new Set([
16760
+ "png",
16761
+ "jpg",
16762
+ "jpeg",
16763
+ "gif",
16764
+ "webp",
16765
+ "svg",
16766
+ "avif",
16767
+ "bmp"
16768
+ ]);
16769
+ /** A doc-relative asset reference: optional `../` hops, then `assets/<name>`. */
16770
+ var ASSET_REF = /^(?:\.\.\/)*assets\/(.+)$/;
16668
16771
  /**
16669
- * Drawing pictures for a publish from the Headless Client (ADR 0175): a [[Drawing]] is published as
16670
- * a picture, never as its lines, and the picture is drawn in a real Chromium, the one Mermaid
16671
- * diagrams use (diagrams.ts), because Excalidraw's export needs a page to measure text and load
16672
- * fonts in.
16673
- *
16674
- * The page runs the Excalidraw extension's own code (`drawing-page/`, built from
16675
- * `src/drawing-picture-page.ts` beside the Node bundle), and is served, with Excalidraw's chunks and
16676
- * fonts, from a server on the loopback address (page-server.ts).
16772
+ * An asset could not be fetched just now: the connection failed, or the server answered with a
16773
+ * status that means "try again". It says nothing about whether the file exists, so something
16774
+ * showing the file asks again rather than calling it missing. `status` is the server's answer,
16775
+ * absent when the connection failed before there was one.
16677
16776
  */
16678
- /** Whether a publish of these bodies draws a drawing: a fenced block whose info string is the drawing fence's. */
16679
- function needsDrawings(bodies) {
16680
- const fence = new RegExp(`^\\s*(?:-\\s+)?\`{3,}${DRAWING_FENCE.replace(".", "\\.")}\\s*$`, "m");
16681
- for (const body of bodies) if (fence.test(body)) return true;
16682
- return false;
16683
- }
16684
- var PAGE$1 = `<!doctype html>
16685
- <html><head><meta charset="utf-8">
16686
- <script type="module" src="/drawing-picture-page.js"><\/script>
16687
- </head><body></body></html>`;
16777
+ var AssetUnavailableError = class extends Error {
16778
+ name = "AssetUnavailableError";
16779
+ status;
16780
+ constructor(message, options = {}) {
16781
+ super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
16782
+ this.status = options.status;
16783
+ }
16784
+ };
16688
16785
  /**
16689
- * A renderer over one headless browser, opened for a publish and closed after it. Null when no
16690
- * browser is available; the caller decides what that means (a publish with drawings refuses).
16786
+ * An asset arrived, but not as it was stored: the server offered a different number of chunks than
16787
+ * its encrypted metadata records, or the joined bytes do not match the size or hash recorded there.
16788
+ * Each chunk is authenticated on its own, so this is what catches a file cut short, or a reuse
16789
+ * answer that points at a different file (ADR 0027, amended 2026-10-05). The bytes are never
16790
+ * handed over. Distinct from a missing file (`null`), which is gone, and from an unavailable one,
16791
+ * which may come good by itself.
16691
16792
  */
16692
- async function openDrawingRenderer(env) {
16693
- const browser = await launchChromium(env);
16694
- if (!browser) return null;
16695
- let served = null;
16696
- let pagePromise;
16697
- const page = () => {
16698
- pagePromise ??= (async () => {
16699
- served = await servePage(PAGE$1, await filesUnder$1(builtPath("drawing-page")));
16700
- const p = await (await browser.newContext()).newPage();
16701
- await p.goto(`${served.origin}/page.html`);
16702
- await p.waitForFunction(() => typeof window.etherpkDrawDrawingPicture === "function", void 0, { timeout: 15e3 });
16703
- return p;
16704
- })();
16705
- return pagePromise;
16793
+ var AssetIntegrityError = class extends Error {
16794
+ name = "AssetIntegrityError";
16795
+ constructor(message = "This file did not arrive complete, so it was not opened. Try again in a moment.") {
16796
+ super(message);
16797
+ }
16798
+ };
16799
+ /** Split a file name into its stem and lower-cased extension (`''` ext when there is none). */
16800
+ function splitNameExt(fileName) {
16801
+ const dot = fileName.lastIndexOf(".");
16802
+ if (dot <= 0) return {
16803
+ stem: fileName,
16804
+ ext: ""
16706
16805
  };
16707
16806
  return {
16708
- async render(body) {
16709
- const drawn = await (await page()).evaluate((lines) => window.etherpkDrawDrawingPicture(lines), [...body]);
16710
- if (drawn === null) return null;
16711
- return {
16712
- kind: "picture",
16713
- type: drawn.type,
16714
- width: drawn.width,
16715
- height: drawn.height,
16716
- alt: drawn.alt,
16717
- bytes: new Uint8Array(Buffer$1.from(drawn.data, "base64"))
16718
- };
16719
- },
16720
- async dispose() {
16721
- await browser.close().catch(() => {});
16722
- const open = served;
16723
- await new Promise((resolve) => open ? open.server.close(() => resolve()) : resolve());
16724
- }
16807
+ stem: fileName.slice(0, dot),
16808
+ ext: fileName.slice(dot + 1).toLowerCase()
16725
16809
  };
16726
16810
  }
16727
- // ../../extensions/maps/src/map-host.ts
16728
- var HOST_STYLE = "https://maps.etherpk.com/styles/light.json";
16729
- var DEFAULT_MAP_STYLES = {
16730
- light: HOST_STYLE,
16731
- dark: HOST_STYLE
16732
- };
16733
- // src/map-pictures.ts
16734
- var require$1 = createRequire(import.meta.url);
16735
- /** The light basemap style a publish draws with, or null for a plain background. */
16736
- function publishMapStyle(env) {
16737
- const named = env.ETHERPK_MAP_STYLE_URL;
16738
- if (named === void 0) return DEFAULT_MAP_STYLES.light;
16739
- return named.trim() === "" ? null : named.trim();
16811
+ /** True when `ext` (with or without a leading dot) names an inline-rendered image format. */
16812
+ function isImageExt(ext) {
16813
+ return IMAGE_EXTS.has(ext.replace(/^\./, "").toLowerCase());
16740
16814
  }
16741
- /** Whether a publish of these bodies draws a map: a fenced block whose info string is `map`. */
16742
- function needsMaps(bodies) {
16743
- for (const body of bodies) if (/^\s*(?:-\s+)?```map\s*$/m.test(body)) return true;
16744
- return false;
16815
+ /** The on-disk asset name: `kebab-stem.<hash>.ext` (stem falls back to `asset` when slugging empties it). */
16816
+ function assetFileName(originalName, hash) {
16817
+ const { stem, ext } = splitNameExt(originalName);
16818
+ const slug = publishSlug(stem) || "asset";
16819
+ return ext ? `${slug}.${hash}.${ext}` : `${slug}.${hash}`;
16745
16820
  }
16746
- /** The page: MapLibre by the import map, then the drawing code, which puts its function on `window`. */
16747
- var PAGE = `<!doctype html>
16748
- <html><head><meta charset="utf-8">
16749
- <script type="importmap">{"imports":{"maplibre-gl":"/maplibre-gl.mjs"}}<\/script>
16750
- <script type="module" src="/map-picture-page.js"><\/script>
16751
- </head><body></body></html>`;
16752
- /** The files the page loads, by path, and where each is on disk. */
16753
- function pageFiles() {
16754
- const maplibre = dirname(require$1.resolve("maplibre-gl/dist/maplibre-gl.mjs"));
16755
- return /* @__PURE__ */ new Map([
16756
- ["/maplibre-gl.mjs", join(maplibre, "maplibre-gl.mjs")],
16757
- ["/maplibre-gl-shared.mjs", join(maplibre, "maplibre-gl-shared.mjs")],
16758
- ["/maplibre-gl-worker.mjs", join(maplibre, "maplibre-gl-worker.mjs")],
16759
- ["/map-picture-page.js", builtPath("map-picture-page.js")]
16760
- ]);
16821
+ /** The de-duplication key: content plus extension. The stem is display, not identity. */
16822
+ function contentKey(hash, ext) {
16823
+ return `${hash}.${ext}`;
16761
16824
  }
16762
16825
  /**
16763
- * A renderer over one headless browser, opened for a publish and closed after it. Null when no
16764
- * browser is available; the caller decides what that means (a publish with maps refuses).
16826
+ * An on-disk asset name with its content hash taken back out — `q3-report.a1b2c3d4.pdf` reads as
16827
+ * `q3-report.pdf`. What a download is called and what titles an asset tab, so neither shows a
16828
+ * user a hash they never typed. A name this store did not write is returned unchanged.
16765
16829
  */
16766
- async function openMapRenderer(env) {
16767
- const browser = await launchChromium(env);
16768
- if (!browser) return null;
16769
- const style = publishMapStyle(env);
16770
- let served = null;
16771
- let pagePromise;
16772
- const page = () => {
16830
+ function displayAssetName(fileName) {
16831
+ const parsed = assetHashFromName(fileName);
16832
+ if (!parsed) return fileName;
16833
+ const stem = fileName.slice(0, fileName.length - `.${parsed.hash}`.length - (parsed.ext ? parsed.ext.length + 1 : 0));
16834
+ return parsed.ext ? `${stem}.${parsed.ext}` : stem;
16835
+ }
16836
+ /**
16837
+ * MIME types for the formats the app itself renders, plus the handful a browser needs told about
16838
+ * to do anything sensible with a download. Deliberately small and deliberately **empty for
16839
+ * anything else**: a wrong type is worse than none, because a wrong one is acted on. The
16840
+ * Filesystem Backend has nowhere else to learn a type from — unlike the Server Backend, which
16841
+ * carries the uploader's own MIME type inside the encrypted asset metadata.
16842
+ */
16843
+ var MIME_TYPES = {
16844
+ png: "image/png",
16845
+ jpg: "image/jpeg",
16846
+ jpeg: "image/jpeg",
16847
+ gif: "image/gif",
16848
+ webp: "image/webp",
16849
+ svg: "image/svg+xml",
16850
+ avif: "image/avif",
16851
+ bmp: "image/bmp",
16852
+ pdf: "application/pdf",
16853
+ txt: "text/plain",
16854
+ csv: "text/csv",
16855
+ json: "application/json",
16856
+ md: "text/markdown",
16857
+ mp3: "audio/mpeg",
16858
+ mp4: "video/mp4",
16859
+ webm: "video/webm",
16860
+ zip: "application/zip"
16861
+ };
16862
+ /** The MIME type for a file extension (with or without a leading dot), or `''` when unknown. */
16863
+ function mimeTypeForExt(ext) {
16864
+ return MIME_TYPES[ext.replace(/^\./, "").toLowerCase()] ?? "";
16865
+ }
16866
+ /**
16867
+ * The on-disk name referenced by a doc-relative asset ref, or `null` if `ref` is not an asset
16868
+ * reference. A reference whose name decodes to anything but one file inside `assets/`, or does not
16869
+ * decode at all, is not one: it can never name a file on disk (see `isSafeAssetName`).
16870
+ */
16871
+ function assetNameFromRef(ref) {
16872
+ const clean = ref.split(/[?#]/)[0];
16873
+ const match = ASSET_REF.exec(clean);
16874
+ if (!match) return null;
16875
+ let name;
16876
+ try {
16877
+ name = decodeURIComponent(match[1]);
16878
+ } catch {
16879
+ return null;
16880
+ }
16881
+ return isSafeAssetName(name) ? name : null;
16882
+ }
16883
+ /**
16884
+ * The markdown to embed a saved asset: an inline image, or a plain link that downloads on click.
16885
+ * For an image, an optional `displaySize` (e.g. `300` or `300x200`) is added as a `|` display-size
16886
+ * hint; the caller is responsible for passing a valid spec (see `normalizeDisplaySize`).
16887
+ */
16888
+ function buildAssetMarkdown(asset, displaySize) {
16889
+ if (!asset.isImage) return `[${asset.stem}](${asset.ref})`;
16890
+ return `![${displaySize ? `${asset.stem}|${displaySize}` : asset.stem}](${asset.ref})`;
16891
+ }
16892
+ /** First 8 hex chars of the SHA-256 of the bytes — the content hash in the asset name. */
16893
+ async function contentHash(bytes) {
16894
+ const digest = await crypto.subtle.digest("SHA-256", bytes);
16895
+ return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, 8);
16896
+ }
16897
+ function createAssetStore(adapter) {
16898
+ const urlCache = /* @__PURE__ */ new Map();
16899
+ /**
16900
+ * Content key → the on-disk name already holding those bytes. Built from `assets/` on the
16901
+ * first save (so a store that only ever resolves never pays for the listing) and maintained
16902
+ * on every write after that.
16903
+ *
16904
+ * This is what keeps the [[Asset]] guarantee honest on this backend: identity is content,
16905
+ * not the name it was added under. Keying the write on the whole file name instead — which
16906
+ * is what this did before — stored the same bytes twice whenever the stem differed.
16907
+ */
16908
+ let contentIndex;
16909
+ async function assetsByContent() {
16910
+ if (contentIndex) return contentIndex;
16911
+ const index = /* @__PURE__ */ new Map();
16912
+ for (const { name } of await adapter.list("assets")) {
16913
+ const parsed = assetHashFromName(name);
16914
+ if (parsed && !index.has(contentKey(parsed.hash, parsed.ext))) index.set(contentKey(parsed.hash, parsed.ext), name);
16915
+ }
16916
+ contentIndex = index;
16917
+ return index;
16918
+ }
16919
+ return {
16920
+ async save({ name, bytes }, onBytes) {
16921
+ const hash = await contentHash(bytes);
16922
+ const { stem, ext } = splitNameExt(name);
16923
+ const index = await assetsByContent();
16924
+ const key = contentKey(hash, ext);
16925
+ const existing = index.get(key);
16926
+ const fileName = existing ?? assetFileName(name, hash);
16927
+ if (!existing) {
16928
+ await adapter.writeBinary("assets", fileName, bytes);
16929
+ index.set(key, fileName);
16930
+ }
16931
+ onBytes?.(bytes.length);
16932
+ return {
16933
+ ref: `../assets/${fileName}`,
16934
+ name: fileName,
16935
+ stem: publishSlug(stem) || "asset",
16936
+ isImage: isImageExt(ext),
16937
+ ...existing ? { reused: true } : {}
16938
+ };
16939
+ },
16940
+ async readBytes(ref) {
16941
+ const assetName = assetNameFromRef(ref);
16942
+ if (!assetName) return null;
16943
+ const { ext } = splitNameExt(assetName);
16944
+ try {
16945
+ const { bytes } = await adapter.readBinary("assets", assetName);
16946
+ return {
16947
+ bytes,
16948
+ name: displayAssetName(assetName),
16949
+ type: mimeTypeForExt(ext)
16950
+ };
16951
+ } catch {
16952
+ return null;
16953
+ }
16954
+ },
16955
+ async resolve(ref) {
16956
+ const assetName = assetNameFromRef(ref);
16957
+ if (!assetName) return null;
16958
+ const { ext } = splitNameExt(assetName);
16959
+ const meta = {
16960
+ name: displayAssetName(assetName),
16961
+ type: mimeTypeForExt(ext)
16962
+ };
16963
+ const cached = urlCache.get(assetName);
16964
+ if (cached) return {
16965
+ url: cached,
16966
+ ...meta
16967
+ };
16968
+ let content;
16969
+ try {
16970
+ content = await adapter.readBinary("assets", assetName);
16971
+ } catch {
16972
+ return null;
16973
+ }
16974
+ const url = URL.createObjectURL(new Blob([content.bytes], meta.type ? { type: meta.type } : {}));
16975
+ urlCache.set(assetName, url);
16976
+ return {
16977
+ url,
16978
+ ...meta
16979
+ };
16980
+ },
16981
+ dispose() {
16982
+ for (const url of urlCache.values()) URL.revokeObjectURL(url);
16983
+ urlCache.clear();
16984
+ },
16985
+ renamed(from, to) {
16986
+ const url = urlCache.get(from);
16987
+ if (url) URL.revokeObjectURL(url);
16988
+ urlCache.delete(from);
16989
+ const parsed = assetHashFromName(to);
16990
+ if (parsed) contentIndex?.set(contentKey(parsed.hash, parsed.ext), to);
16991
+ }
16992
+ };
16993
+ }
16994
+ // ../../extensions/excalidraw/src/format.ts
16995
+ var DRAWING_FENCE = "excalidraw.drawing";
16996
+ var HEADER_TYPE = "excalidraw.drawing";
16997
+ /** Every JSON object written on one line that parses, in order, with where it is. */
16998
+ function spansOnLine(line) {
16999
+ const out = [];
17000
+ let depth = 0;
17001
+ let start = -1;
17002
+ let inString = false;
17003
+ let escaped = false;
17004
+ for (let i = 0; i < line.length; i++) {
17005
+ const ch = line[i];
17006
+ if (inString) {
17007
+ if (escaped) escaped = false;
17008
+ else if (ch === "\\") escaped = true;
17009
+ else if (ch === "\"") inString = false;
17010
+ continue;
17011
+ }
17012
+ if (ch === "\"") inString = true;
17013
+ else if (ch === "{") {
17014
+ if (depth === 0) start = i;
17015
+ depth++;
17016
+ } else if (ch === "}" && depth > 0) {
17017
+ depth--;
17018
+ if (depth === 0 && start !== -1) {
17019
+ try {
17020
+ out.push({
17021
+ start,
17022
+ end: i + 1,
17023
+ value: JSON.parse(line.slice(start, i + 1))
17024
+ });
17025
+ } catch {}
17026
+ start = -1;
17027
+ }
17028
+ }
17029
+ }
17030
+ return out;
17031
+ }
17032
+ /** Every JSON object written on one line, in order: one, or several where a merge joined lines. */
17033
+ function objectsOnLine(line) {
17034
+ return spansOnLine(line).map((span) => span.value);
17035
+ }
17036
+ function isElement(value) {
17037
+ if (!value || typeof value !== "object") return false;
17038
+ const record = value;
17039
+ return typeof record.id === "string" && typeof record.type === "string" && typeof record.version === "number";
17040
+ }
17041
+ function isHeader(value) {
17042
+ return !!value && typeof value === "object" && value.type === HEADER_TYPE && typeof value.id === "string";
17043
+ }
17044
+ /** Whether a line's object is a shape in skeleton form: a `type`, not the drawing's own, and no `version`. */
17045
+ function isSkeleton(value) {
17046
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
17047
+ const record = value;
17048
+ return typeof record.type === "string" && record.type !== HEADER_TYPE && record.version === void 0 && record.isDeleted !== true;
17049
+ }
17050
+ /** Whether `a` is the later of two versions of one element, by Excalidraw's own rule. */
17051
+ function later(a, b) {
17052
+ if (a.version !== b.version) return a.version > b.version;
17053
+ return (a.versionNonce ?? 0) <= (b.versionNonce ?? 0);
17054
+ }
17055
+ /** Elements in their stacking order: by `index`, then by id, so every device draws them alike. */
17056
+ function byStackingOrder(elements) {
17057
+ return elements.sort((a, b) => {
17058
+ const ai = a.index ?? "";
17059
+ const bi = b.index ?? "";
17060
+ if (ai !== bi) return ai < bi ? -1 : 1;
17061
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
17062
+ });
17063
+ }
17064
+ /** The reference an image names its Asset by, or null for an image with none and anything else. */
17065
+ function imageAsset(element) {
17066
+ if (element.type !== "image") return null;
17067
+ const asset = element.customData?.asset;
17068
+ return typeof asset === "string" && asset !== "" ? asset : null;
17069
+ }
17070
+ /**
17071
+ * The file id of an image known only by its reference: the same on every device, in letters, digits
17072
+ * and hyphens, since an SVG picture names the image's element by it. Two hashes, so two images in a
17073
+ * drawing cannot plausibly share one.
17074
+ */
17075
+ function imageFileId(ref) {
17076
+ return `asset-${hashText(ref)}-${hashText(`${ref}#`)}`;
17077
+ }
17078
+ /** An image with no file id gets the one its reference makes, so a line an older Client converted still draws. */
17079
+ function withFileIdFromAsset(element) {
17080
+ const asset = imageAsset(element);
17081
+ return asset && !element.fileId ? {
17082
+ ...element,
17083
+ fileId: imageFileId(asset)
17084
+ } : element;
17085
+ }
17086
+ /** A drawing read from its fence's body. */
17087
+ function readDrawing(body) {
17088
+ const first = body[0] ? objectsOnLine(body[0])[0] : void 0;
17089
+ const header = isHeader(first) ? {
17090
+ type: HEADER_TYPE,
17091
+ version: 1,
17092
+ id: first.id,
17093
+ ...typeof first.background === "string" ? { background: first.background } : {}
17094
+ } : null;
17095
+ const byId = /* @__PURE__ */ new Map();
17096
+ const skeletons = [];
17097
+ body.forEach((line, n) => {
17098
+ if (n === 0 && header) return;
17099
+ for (const value of objectsOnLine(line)) {
17100
+ if (isSkeleton(value)) skeletons.push(value);
17101
+ if (!isElement(value) || value.isDeleted) continue;
17102
+ const known = byId.get(value.id);
17103
+ if (!known || later(value, known)) byId.set(value.id, withFileIdFromAsset(value));
17104
+ }
17105
+ });
17106
+ return {
17107
+ header,
17108
+ elements: byStackingOrder([...byId.values()]),
17109
+ skeletons
17110
+ };
17111
+ }
17112
+ /**
17113
+ * Each image's reference a body holds, written by hand or not, for whatever has to read them all
17114
+ * before it can draw them.
17115
+ */
17116
+ function imageReferences(body) {
17117
+ const { elements, skeletons } = readDrawing(body);
17118
+ return [...new Set([...elements, ...skeletons].flatMap((element) => imageAsset(element) ?? []))];
17119
+ }
17120
+ /** A short, stable hash of some text, in letters and digits (FNV-1a). */
17121
+ function hashText(text) {
17122
+ let hash = 2166136261;
17123
+ for (let i = 0; i < text.length; i++) {
17124
+ hash ^= text.charCodeAt(i);
17125
+ hash = Math.imul(hash, 16777619);
17126
+ }
17127
+ return (hash >>> 0).toString(36);
17128
+ }
17129
+ // src/page-server.ts
17130
+ /**
17131
+ * A server for the pages the Headless Client draws pictures in (map-pictures.ts,
17132
+ * drawing-pictures.ts): on the loopback address, answering one page and the files named to it and
17133
+ * nothing else, so a page's workers, chunks and fonts load over http as they do in the Client. Open
17134
+ * only for a publish that draws something.
17135
+ */
17136
+ var TYPES = {
17137
+ ".js": "text/javascript; charset=utf-8",
17138
+ ".mjs": "text/javascript; charset=utf-8",
17139
+ ".css": "text/css; charset=utf-8",
17140
+ ".woff2": "font/woff2"
17141
+ };
17142
+ /** A file built beside this module in the published package (dist/), or in dist/ when run from source. */
17143
+ function builtPath(...path) {
17144
+ const here = dirname(fileURLToPath(import.meta.url));
17145
+ return here.endsWith("dist") ? join(here, ...path) : join(here, "..", "dist", ...path);
17146
+ }
17147
+ /** Every file under `folder`, by the path a page asks for it at. Empty when the folder is missing. */
17148
+ async function filesUnder$1(folder) {
17149
+ const files = (await readdir(folder, {
17150
+ recursive: true,
17151
+ withFileTypes: true
17152
+ }).catch(() => [])).filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name));
17153
+ return new Map(files.map((file) => [`/${relative(folder, file).split(sep).join("/")}`, file]));
17154
+ }
17155
+ /** The server: `html` at `/page.html`, and each of `files` at its path. */
17156
+ async function servePage(html, files) {
17157
+ const server = createServer$1((request, response) => {
17158
+ const path = new URL(request.url ?? "/", "http://localhost").pathname;
17159
+ if (path === "/page.html") {
17160
+ response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }).end(html);
17161
+ return;
17162
+ }
17163
+ const file = files.get(path);
17164
+ if (!file) {
17165
+ response.writeHead(404).end();
17166
+ return;
17167
+ }
17168
+ readFile(file).then((bytes) => response.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" }).end(bytes), () => response.writeHead(404).end());
17169
+ });
17170
+ await new Promise((resolve, reject) => {
17171
+ server.once("error", reject);
17172
+ server.listen(0, "127.0.0.1", () => resolve());
17173
+ });
17174
+ const address = server.address();
17175
+ if (!address || typeof address === "string") throw new Error("The page server has no port.");
17176
+ return {
17177
+ server,
17178
+ origin: `http://127.0.0.1:${address.port}`
17179
+ };
17180
+ }
17181
+ // src/drawing-pictures.ts
17182
+ /**
17183
+ * Drawing pictures for a publish from the Headless Client (ADR 0175): a [[Drawing]] is published as
17184
+ * a picture, never as its lines, and the picture is drawn in a real Chromium, the one Mermaid
17185
+ * diagrams use (diagrams.ts), because Excalidraw's export needs a page to measure text and load
17186
+ * fonts in. No page of this kind can reach the graph, so the images a drawing names are read here and
17187
+ * handed in, as a publish reads any other asset.
17188
+ *
17189
+ * The page runs the Excalidraw extension's own code (`drawing-page/`, built from
17190
+ * `src/drawing-picture-page.ts` beside the Node bundle), and is served, with Excalidraw's chunks and
17191
+ * fonts, from a server on the loopback address (page-server.ts).
17192
+ */
17193
+ /** Whether a publish of these bodies draws a drawing: a fenced block whose info string is the drawing fence's. */
17194
+ function needsDrawings(bodies) {
17195
+ const fence = new RegExp(`^\\s*(?:-\\s+)?\`{3,}${DRAWING_FENCE.replace(".", "\\.")}\\s*$`, "m");
17196
+ for (const body of bodies) if (fence.test(body)) return true;
17197
+ return false;
17198
+ }
17199
+ var PAGE$1 = `<!doctype html>
17200
+ <html><head><meta charset="utf-8">
17201
+ <script type="module" src="/drawing-picture-page.js"><\/script>
17202
+ </head><body></body></html>`;
17203
+ /**
17204
+ * The images a drawing names, as data URLs by reference, leaving out any that cannot be read. Its type
17205
+ * comes from its name, since a data URL drawn in the picture must not say anything but an image.
17206
+ */
17207
+ async function drawingImages(body, readAsset) {
17208
+ const images = {};
17209
+ for (const ref of imageReferences(body)) {
17210
+ const type = mimeTypeForExt(splitNameExt(assetNameFromRef(ref) ?? "").ext);
17211
+ if (!type.startsWith("image/")) continue;
17212
+ const asset = await readAsset(ref).catch(() => null);
17213
+ if (asset) images[ref] = `data:${type};base64,${Buffer$1.from(asset.bytes).toString("base64")}`;
17214
+ }
17215
+ return images;
17216
+ }
17217
+ /**
17218
+ * A renderer over one headless browser, opened for a publish and closed after it. Null when no
17219
+ * browser is available; the caller decides what that means (a publish with drawings refuses).
17220
+ */
17221
+ async function openDrawingRenderer(env, readAsset) {
17222
+ const browser = await launchChromium(env);
17223
+ if (!browser) return null;
17224
+ let served = null;
17225
+ let pagePromise;
17226
+ const page = () => {
17227
+ pagePromise ??= (async () => {
17228
+ served = await servePage(PAGE$1, await filesUnder$1(builtPath("drawing-page")));
17229
+ const p = await (await browser.newContext()).newPage();
17230
+ await p.goto(`${served.origin}/page.html`);
17231
+ await p.waitForFunction(() => typeof window.etherpkDrawDrawingPicture === "function", void 0, { timeout: 15e3 });
17232
+ return p;
17233
+ })();
17234
+ return pagePromise;
17235
+ };
17236
+ return {
17237
+ async render(body) {
17238
+ const p = await page();
17239
+ const images = await drawingImages(body, readAsset);
17240
+ const drawn = await p.evaluate(([lines, held]) => window.etherpkDrawDrawingPicture(lines, held), [[...body], images]);
17241
+ if (drawn === null) return null;
17242
+ return {
17243
+ kind: "picture",
17244
+ type: drawn.type,
17245
+ width: drawn.width,
17246
+ height: drawn.height,
17247
+ alt: drawn.alt,
17248
+ bytes: new Uint8Array(Buffer$1.from(drawn.data, "base64"))
17249
+ };
17250
+ },
17251
+ async dispose() {
17252
+ await browser.close().catch(() => {});
17253
+ const open = served;
17254
+ await new Promise((resolve) => open ? open.server.close(() => resolve()) : resolve());
17255
+ }
17256
+ };
17257
+ }
17258
+ // ../../extensions/maps/src/map-host.ts
17259
+ var HOST_STYLE = "https://maps.etherpk.com/styles/light.json";
17260
+ var DEFAULT_MAP_STYLES = {
17261
+ light: HOST_STYLE,
17262
+ dark: HOST_STYLE
17263
+ };
17264
+ // src/map-pictures.ts
17265
+ var require$1 = createRequire(import.meta.url);
17266
+ /** The light basemap style a publish draws with, or null for a plain background. */
17267
+ function publishMapStyle(env) {
17268
+ const named = env.ETHERPK_MAP_STYLE_URL;
17269
+ if (named === void 0) return DEFAULT_MAP_STYLES.light;
17270
+ return named.trim() === "" ? null : named.trim();
17271
+ }
17272
+ /** Whether a publish of these bodies draws a map: a fenced block whose info string is `map`. */
17273
+ function needsMaps(bodies) {
17274
+ for (const body of bodies) if (/^\s*(?:-\s+)?```map\s*$/m.test(body)) return true;
17275
+ return false;
17276
+ }
17277
+ /** The page: MapLibre by the import map, then the drawing code, which puts its function on `window`. */
17278
+ var PAGE = `<!doctype html>
17279
+ <html><head><meta charset="utf-8">
17280
+ <script type="importmap">{"imports":{"maplibre-gl":"/maplibre-gl.mjs"}}<\/script>
17281
+ <script type="module" src="/map-picture-page.js"><\/script>
17282
+ </head><body></body></html>`;
17283
+ /** The files the page loads, by path, and where each is on disk. */
17284
+ function pageFiles() {
17285
+ const maplibre = dirname(require$1.resolve("maplibre-gl/dist/maplibre-gl.mjs"));
17286
+ return /* @__PURE__ */ new Map([
17287
+ ["/maplibre-gl.mjs", join(maplibre, "maplibre-gl.mjs")],
17288
+ ["/maplibre-gl-shared.mjs", join(maplibre, "maplibre-gl-shared.mjs")],
17289
+ ["/maplibre-gl-worker.mjs", join(maplibre, "maplibre-gl-worker.mjs")],
17290
+ ["/map-picture-page.js", builtPath("map-picture-page.js")]
17291
+ ]);
17292
+ }
17293
+ /**
17294
+ * A renderer over one headless browser, opened for a publish and closed after it. Null when no
17295
+ * browser is available; the caller decides what that means (a publish with maps refuses).
17296
+ */
17297
+ async function openMapRenderer(env) {
17298
+ const browser = await launchChromium(env);
17299
+ if (!browser) return null;
17300
+ const style = publishMapStyle(env);
17301
+ let served = null;
17302
+ let pagePromise;
17303
+ const page = () => {
16773
17304
  pagePromise ??= (async () => {
16774
17305
  served = await servePage(PAGE, pageFiles());
16775
17306
  const p = await (await browser.newContext()).newPage();
@@ -17537,314 +18068,59 @@ var DocumentUnconfirmedError = class extends Error {
17537
18068
  * one IS the rewrite (ADR 0064).
17538
18069
  */
17539
18070
  /**
17540
- * A rename refused because a document it would have to read - a referencing document under
17541
- * the rewrite arm, or a document one of its steps moves or merges - could not be brought to
17542
- * text this device can trust in time. Refused whole rather than applied to the documents that
17543
- * could be confirmed: a graph with half its links rewritten is worse than one with none, and
17544
- * the second attempt, once sync has caught up, costs nothing.
17545
- */
17546
- var RenameUnconfirmedError = class extends Error {
17547
- concepts;
17548
- name = "RenameUnconfirmedError";
17549
- constructor(concepts) {
17550
- const list = concepts.slice(0, 5).join(", ") + (concepts.length > 5 ? "…" : "");
17551
- super(`${concepts.length === 1 ? "A document" : `${concepts.length} documents`} the rename would change ${concepts.length === 1 ? "has" : "have"} not finished syncing to this device: ${list}. Nothing was renamed - try again once sync has caught up.`);
17552
- this.concepts = concepts;
17553
- }
17554
- };
17555
- /**
17556
- * Why a rename was refused, as a user-facing message, or null when it may proceed.
17557
- * Shared so both backends refuse identically.
17558
- *
17559
- * A [[Journal Entry]] is refused because its concept *is* its date and there is exactly one
17560
- * per day; renaming it would break that invariant rather than express anything. A
17561
- * journal-shaped [[Pageless Concept]] (a day nobody has written yet) is refused for the same
17562
- * reason: its name is its day whether or not the entry exists.
17563
- *
17564
- * The same holds in the other direction: a page renamed TO a day is refused, rather than left
17565
- * in `pages/` answering to the day or merged into its journal entry with a `title` block the
17566
- * entry never carries (ADR 0056).
17567
- *
17568
- * A collision is NOT a refusal (ADR 0038 §4): it is a [[Merge]], confirmed in the dialog.
17569
- */
17570
- function renameRefusal(options) {
17571
- const to = options.to.trim();
17572
- if (to === "") return "A page needs a non-empty name.";
17573
- if (options.kind === "journal" || options.kind === null && isJournalConcept(options.from)) return "A journal entry cannot be renamed - its name is its date, and there is exactly one per day.";
17574
- if (options.kind === "page" && isJournalConcept(to)) return dayIsNotAPageName(to);
17575
- return null;
17576
- }
17577
- /** Every step, direct first - what an applier iterates. */
17578
- function renameSteps(plan) {
17579
- return [plan.direct, ...plan.cascade];
17580
- }
17581
- /**
17582
- * The name a document called `concept` before the rename goes by after it: where a title step
17583
- * lands it (its `into`, a merge's survivor included), or the same name when no step moves it.
17584
- * How a holder of an alias the rename rewrites is found, and named in what the rename reports.
17585
- */
17586
- function landedName(plan, concept) {
17587
- const key = conceptKey(concept);
17588
- return renameSteps(plan).find((step) => step.hasDocument && conceptKey(step.from) === key)?.into ?? concept;
17589
- }
17590
- /** How many steps merge - what the dialog warns about. */
17591
- function mergeCount(plan) {
17592
- return renameSteps(plan).filter((s) => s.merges).length;
17593
- }
17594
- // ../client/src/lib/storage/fs/asset-store.ts
17595
- /**
17596
- * The **Asset store** over a {@link DirectoryAdapter}: uploads land as binary files
17597
- * under `assets/`, named `kebab-stem.<contenthash>.ext` (DESIGN.md → On-disk layout).
17598
- * Identical bytes de-duplicate to one file **by content and extension alone** - the stem is
17599
- * display, not identity - so the same file added again under a different name references the
17600
- * one already stored rather than writing a second copy. Built on the same File-System seam as
17601
- * {@link createFilesystemDocumentStore}, so the pure naming/dedup logic is Node-testable
17602
- * over the in-memory adapter before any browser code runs.
17603
- *
17604
- * Assets are referenced from documents by a relative path — `../assets/<name>` — which
17605
- * resolves from any journal entry or page (both sit one level under the graph root,
17606
- * the Logseq convention). `resolve` reads those bytes back and hands out an object URL plus
17607
- * the name and MIME type a download or a viewer needs; the URLs are cached per asset and
17608
- * revoked on {@link AssetStore.dispose}.
17609
- *
17610
- * Remote (S3) upload and per-graph access control are deferred (DESIGN.md → Server
17611
- * Backend); this is the Filesystem Backend path only.
17612
- */
17613
- /** Extensions rendered inline as images (everything else renders as a download link). */
17614
- var IMAGE_EXTS = /* @__PURE__ */ new Set([
17615
- "png",
17616
- "jpg",
17617
- "jpeg",
17618
- "gif",
17619
- "webp",
17620
- "svg",
17621
- "avif",
17622
- "bmp"
17623
- ]);
17624
- /** A doc-relative asset reference: optional `../` hops, then `assets/<name>`. */
17625
- var ASSET_REF = /^(?:\.\.\/)*assets\/(.+)$/;
17626
- /**
17627
- * An asset could not be fetched just now: the connection failed, or the server answered with a
17628
- * status that means "try again". It says nothing about whether the file exists, so something
17629
- * showing the file asks again rather than calling it missing. `status` is the server's answer,
17630
- * absent when the connection failed before there was one.
17631
- */
17632
- var AssetUnavailableError = class extends Error {
17633
- name = "AssetUnavailableError";
17634
- status;
17635
- constructor(message, options = {}) {
17636
- super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
17637
- this.status = options.status;
17638
- }
17639
- };
17640
- /**
17641
- * An asset arrived, but not as it was stored: the server offered a different number of chunks than
17642
- * its encrypted metadata records, or the joined bytes do not match the size or hash recorded there.
17643
- * Each chunk is authenticated on its own, so this is what catches a file cut short, or a reuse
17644
- * answer that points at a different file (ADR 0027, amended 2026-10-05). The bytes are never
17645
- * handed over. Distinct from a missing file (`null`), which is gone, and from an unavailable one,
17646
- * which may come good by itself.
17647
- */
17648
- var AssetIntegrityError = class extends Error {
17649
- name = "AssetIntegrityError";
17650
- constructor(message = "This file did not arrive complete, so it was not opened. Try again in a moment.") {
17651
- super(message);
17652
- }
17653
- };
17654
- /** Split a file name into its stem and lower-cased extension (`''` ext when there is none). */
17655
- function splitNameExt(fileName) {
17656
- const dot = fileName.lastIndexOf(".");
17657
- if (dot <= 0) return {
17658
- stem: fileName,
17659
- ext: ""
17660
- };
17661
- return {
17662
- stem: fileName.slice(0, dot),
17663
- ext: fileName.slice(dot + 1).toLowerCase()
17664
- };
17665
- }
17666
- /** True when `ext` (with or without a leading dot) names an inline-rendered image format. */
17667
- function isImageExt(ext) {
17668
- return IMAGE_EXTS.has(ext.replace(/^\./, "").toLowerCase());
17669
- }
17670
- /** The on-disk asset name: `kebab-stem.<hash>.ext` (stem falls back to `asset` when slugging empties it). */
17671
- function assetFileName(originalName, hash) {
17672
- const { stem, ext } = splitNameExt(originalName);
17673
- const slug = publishSlug(stem) || "asset";
17674
- return ext ? `${slug}.${hash}.${ext}` : `${slug}.${hash}`;
17675
- }
17676
- /** The de-duplication key: content plus extension. The stem is display, not identity. */
17677
- function contentKey(hash, ext) {
17678
- return `${hash}.${ext}`;
17679
- }
17680
- /**
17681
- * An on-disk asset name with its content hash taken back out — `q3-report.a1b2c3d4.pdf` reads as
17682
- * `q3-report.pdf`. What a download is called and what titles an asset tab, so neither shows a
17683
- * user a hash they never typed. A name this store did not write is returned unchanged.
17684
- */
17685
- function displayAssetName(fileName) {
17686
- const parsed = assetHashFromName(fileName);
17687
- if (!parsed) return fileName;
17688
- const stem = fileName.slice(0, fileName.length - `.${parsed.hash}`.length - (parsed.ext ? parsed.ext.length + 1 : 0));
17689
- return parsed.ext ? `${stem}.${parsed.ext}` : stem;
17690
- }
17691
- /**
17692
- * MIME types for the formats the app itself renders, plus the handful a browser needs told about
17693
- * to do anything sensible with a download. Deliberately small and deliberately **empty for
17694
- * anything else**: a wrong type is worse than none, because a wrong one is acted on. The
17695
- * Filesystem Backend has nowhere else to learn a type from — unlike the Server Backend, which
17696
- * carries the uploader's own MIME type inside the encrypted asset metadata.
18071
+ * A rename refused because a document it would have to read - a referencing document under
18072
+ * the rewrite arm, or a document one of its steps moves or merges - could not be brought to
18073
+ * text this device can trust in time. Refused whole rather than applied to the documents that
18074
+ * could be confirmed: a graph with half its links rewritten is worse than one with none, and
18075
+ * the second attempt, once sync has caught up, costs nothing.
17697
18076
  */
17698
- var MIME_TYPES = {
17699
- png: "image/png",
17700
- jpg: "image/jpeg",
17701
- jpeg: "image/jpeg",
17702
- gif: "image/gif",
17703
- webp: "image/webp",
17704
- svg: "image/svg+xml",
17705
- avif: "image/avif",
17706
- bmp: "image/bmp",
17707
- pdf: "application/pdf",
17708
- txt: "text/plain",
17709
- csv: "text/csv",
17710
- json: "application/json",
17711
- md: "text/markdown",
17712
- mp3: "audio/mpeg",
17713
- mp4: "video/mp4",
17714
- webm: "video/webm",
17715
- zip: "application/zip"
18077
+ var RenameUnconfirmedError = class extends Error {
18078
+ concepts;
18079
+ name = "RenameUnconfirmedError";
18080
+ constructor(concepts) {
18081
+ const list = concepts.slice(0, 5).join(", ") + (concepts.length > 5 ? "…" : "");
18082
+ super(`${concepts.length === 1 ? "A document" : `${concepts.length} documents`} the rename would change ${concepts.length === 1 ? "has" : "have"} not finished syncing to this device: ${list}. Nothing was renamed - try again once sync has caught up.`);
18083
+ this.concepts = concepts;
18084
+ }
17716
18085
  };
17717
- /** The MIME type for a file extension (with or without a leading dot), or `''` when unknown. */
17718
- function mimeTypeForExt(ext) {
17719
- return MIME_TYPES[ext.replace(/^\./, "").toLowerCase()] ?? "";
17720
- }
17721
18086
  /**
17722
- * The on-disk name referenced by a doc-relative asset ref, or `null` if `ref` is not an asset
17723
- * reference. A reference whose name decodes to anything but one file inside `assets/`, or does not
17724
- * decode at all, is not one: it can never name a file on disk (see `isSafeAssetName`).
18087
+ * Why a rename was refused, as a user-facing message, or null when it may proceed.
18088
+ * Shared so both backends refuse identically.
18089
+ *
18090
+ * A [[Journal Entry]] is refused because its concept *is* its date and there is exactly one
18091
+ * per day; renaming it would break that invariant rather than express anything. A
18092
+ * journal-shaped [[Pageless Concept]] (a day nobody has written yet) is refused for the same
18093
+ * reason: its name is its day whether or not the entry exists.
18094
+ *
18095
+ * The same holds in the other direction: a page renamed TO a day is refused, rather than left
18096
+ * in `pages/` answering to the day or merged into its journal entry with a `title` block the
18097
+ * entry never carries (ADR 0056).
18098
+ *
18099
+ * A collision is NOT a refusal (ADR 0038 §4): it is a [[Merge]], confirmed in the dialog.
17725
18100
  */
17726
- function assetNameFromRef(ref) {
17727
- const clean = ref.split(/[?#]/)[0];
17728
- const match = ASSET_REF.exec(clean);
17729
- if (!match) return null;
17730
- let name;
17731
- try {
17732
- name = decodeURIComponent(match[1]);
17733
- } catch {
17734
- return null;
17735
- }
17736
- return isSafeAssetName(name) ? name : null;
18101
+ function renameRefusal(options) {
18102
+ const to = options.to.trim();
18103
+ if (to === "") return "A page needs a non-empty name.";
18104
+ if (options.kind === "journal" || options.kind === null && isJournalConcept(options.from)) return "A journal entry cannot be renamed - its name is its date, and there is exactly one per day.";
18105
+ if (options.kind === "page" && isJournalConcept(to)) return dayIsNotAPageName(to);
18106
+ return null;
18107
+ }
18108
+ /** Every step, direct first - what an applier iterates. */
18109
+ function renameSteps(plan) {
18110
+ return [plan.direct, ...plan.cascade];
17737
18111
  }
17738
18112
  /**
17739
- * The markdown to embed a saved asset: an inline image, or a plain link that downloads on click.
17740
- * For an image, an optional `displaySize` (e.g. `300` or `300x200`) is added as a `|` display-size
17741
- * hint; the caller is responsible for passing a valid spec (see `normalizeDisplaySize`).
18113
+ * The name a document called `concept` before the rename goes by after it: where a title step
18114
+ * lands it (its `into`, a merge's survivor included), or the same name when no step moves it.
18115
+ * How a holder of an alias the rename rewrites is found, and named in what the rename reports.
17742
18116
  */
17743
- function buildAssetMarkdown(asset, displaySize) {
17744
- if (!asset.isImage) return `[${asset.stem}](${asset.ref})`;
17745
- return `![${displaySize ? `${asset.stem}|${displaySize}` : asset.stem}](${asset.ref})`;
17746
- }
17747
- /** First 8 hex chars of the SHA-256 of the bytes — the content hash in the asset name. */
17748
- async function contentHash(bytes) {
17749
- const digest = await crypto.subtle.digest("SHA-256", bytes);
17750
- return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, 8);
18117
+ function landedName(plan, concept) {
18118
+ const key = conceptKey(concept);
18119
+ return renameSteps(plan).find((step) => step.hasDocument && conceptKey(step.from) === key)?.into ?? concept;
17751
18120
  }
17752
- function createAssetStore(adapter) {
17753
- const urlCache = /* @__PURE__ */ new Map();
17754
- /**
17755
- * Content key → the on-disk name already holding those bytes. Built from `assets/` on the
17756
- * first save (so a store that only ever resolves never pays for the listing) and maintained
17757
- * on every write after that.
17758
- *
17759
- * This is what keeps the [[Asset]] guarantee honest on this backend: identity is content,
17760
- * not the name it was added under. Keying the write on the whole file name instead — which
17761
- * is what this did before — stored the same bytes twice whenever the stem differed.
17762
- */
17763
- let contentIndex;
17764
- async function assetsByContent() {
17765
- if (contentIndex) return contentIndex;
17766
- const index = /* @__PURE__ */ new Map();
17767
- for (const { name } of await adapter.list("assets")) {
17768
- const parsed = assetHashFromName(name);
17769
- if (parsed && !index.has(contentKey(parsed.hash, parsed.ext))) index.set(contentKey(parsed.hash, parsed.ext), name);
17770
- }
17771
- contentIndex = index;
17772
- return index;
17773
- }
17774
- return {
17775
- async save({ name, bytes }, onBytes) {
17776
- const hash = await contentHash(bytes);
17777
- const { stem, ext } = splitNameExt(name);
17778
- const index = await assetsByContent();
17779
- const key = contentKey(hash, ext);
17780
- const existing = index.get(key);
17781
- const fileName = existing ?? assetFileName(name, hash);
17782
- if (!existing) {
17783
- await adapter.writeBinary("assets", fileName, bytes);
17784
- index.set(key, fileName);
17785
- }
17786
- onBytes?.(bytes.length);
17787
- return {
17788
- ref: `../assets/${fileName}`,
17789
- name: fileName,
17790
- stem: publishSlug(stem) || "asset",
17791
- isImage: isImageExt(ext),
17792
- ...existing ? { reused: true } : {}
17793
- };
17794
- },
17795
- async readBytes(ref) {
17796
- const assetName = assetNameFromRef(ref);
17797
- if (!assetName) return null;
17798
- const { ext } = splitNameExt(assetName);
17799
- try {
17800
- const { bytes } = await adapter.readBinary("assets", assetName);
17801
- return {
17802
- bytes,
17803
- name: displayAssetName(assetName),
17804
- type: mimeTypeForExt(ext)
17805
- };
17806
- } catch {
17807
- return null;
17808
- }
17809
- },
17810
- async resolve(ref) {
17811
- const assetName = assetNameFromRef(ref);
17812
- if (!assetName) return null;
17813
- const { ext } = splitNameExt(assetName);
17814
- const meta = {
17815
- name: displayAssetName(assetName),
17816
- type: mimeTypeForExt(ext)
17817
- };
17818
- const cached = urlCache.get(assetName);
17819
- if (cached) return {
17820
- url: cached,
17821
- ...meta
17822
- };
17823
- let content;
17824
- try {
17825
- content = await adapter.readBinary("assets", assetName);
17826
- } catch {
17827
- return null;
17828
- }
17829
- const url = URL.createObjectURL(new Blob([content.bytes], meta.type ? { type: meta.type } : {}));
17830
- urlCache.set(assetName, url);
17831
- return {
17832
- url,
17833
- ...meta
17834
- };
17835
- },
17836
- dispose() {
17837
- for (const url of urlCache.values()) URL.revokeObjectURL(url);
17838
- urlCache.clear();
17839
- },
17840
- renamed(from, to) {
17841
- const url = urlCache.get(from);
17842
- if (url) URL.revokeObjectURL(url);
17843
- urlCache.delete(from);
17844
- const parsed = assetHashFromName(to);
17845
- if (parsed) contentIndex?.set(contentKey(parsed.hash, parsed.ext), to);
17846
- }
17847
- };
18121
+ /** How many steps merge - what the dialog warns about. */
18122
+ function mergeCount(plan) {
18123
+ return renameSteps(plan).filter((s) => s.merges).length;
17848
18124
  }
17849
18125
  // ../client/src/lib/retry.ts
17850
18126
  /**
@@ -18679,6 +18955,64 @@ async function writeDownload(directory, name, bytes) {
18679
18955
  }
18680
18956
  throw new Error(`${directory} already holds a thousand files named like ${safe}.`);
18681
18957
  }
18958
+ // src/image-size.ts
18959
+ function ascii(bytes, at, text) {
18960
+ for (let i = 0; i < text.length; i++) if (bytes[at + i] !== text.charCodeAt(i)) return false;
18961
+ return true;
18962
+ }
18963
+ function size(width, height) {
18964
+ return width > 0 && height > 0 ? {
18965
+ width,
18966
+ height
18967
+ } : null;
18968
+ }
18969
+ function pngSize(view) {
18970
+ return view.byteLength >= 24 ? size(view.getUint32(16), view.getUint32(20)) : null;
18971
+ }
18972
+ function gifSize(view) {
18973
+ return view.byteLength >= 10 ? size(view.getUint16(6, true), view.getUint16(8, true)) : null;
18974
+ }
18975
+ /** The first frame header's size, stepping over the segments before it, each of which states its length. */
18976
+ function jpegSize(view) {
18977
+ let at = 2;
18978
+ while (at + 9 <= view.byteLength) {
18979
+ if (view.getUint8(at) !== 255) return null;
18980
+ const marker = view.getUint8(at + 1);
18981
+ if (marker === 255) {
18982
+ at += 1;
18983
+ continue;
18984
+ }
18985
+ if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) return size(view.getUint16(at + 7), view.getUint16(at + 5));
18986
+ at += 2 + view.getUint16(at + 2);
18987
+ }
18988
+ return null;
18989
+ }
18990
+ function webpSize(bytes, view) {
18991
+ if (ascii(bytes, 12, "VP8 ") && view.byteLength >= 30) return size(view.getUint16(26, true) & 16383, view.getUint16(28, true) & 16383);
18992
+ if (ascii(bytes, 12, "VP8L") && view.byteLength >= 25) {
18993
+ const bits = view.getUint32(21, true);
18994
+ return size((bits & 16383) + 1, (bits >>> 14 & 16383) + 1);
18995
+ }
18996
+ if (ascii(bytes, 12, "VP8X") && view.byteLength >= 30) {
18997
+ const width = view.getUint8(24) | view.getUint8(25) << 8 | view.getUint8(26) << 16;
18998
+ const height = view.getUint8(27) | view.getUint8(28) << 8 | view.getUint8(29) << 16;
18999
+ return size(width + 1, height + 1);
19000
+ }
19001
+ return null;
19002
+ }
19003
+ /** Its height is negative when its rows run top to bottom. */
19004
+ function bmpSize(view) {
19005
+ return view.byteLength >= 26 ? size(view.getInt32(18, true), Math.abs(view.getInt32(22, true))) : null;
19006
+ }
19007
+ function imagePixelSize(bytes) {
19008
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
19009
+ if (ascii(bytes, 1, "PNG\r\n")) return pngSize(view);
19010
+ if (ascii(bytes, 0, "GIF8")) return gifSize(view);
19011
+ if (bytes[0] === 255 && bytes[1] === 216) return jpegSize(view);
19012
+ if (ascii(bytes, 0, "RIFF") && ascii(bytes, 8, "WEBP")) return webpSize(bytes, view);
19013
+ if (ascii(bytes, 0, "BM")) return bmpSize(view);
19014
+ return null;
19015
+ }
18682
19016
  // ../client/src/lib/navigation/concept-path.ts
18683
19017
  /**
18684
19018
  * A concept in a URL path (ADR 0023): each `/`-separated segment encoded on its own, so a
@@ -20420,10 +20754,11 @@ async function uploadAsset(graph, args) {
20420
20754
  const identity = assets.identify(saved.ref);
20421
20755
  if (identity) assets.uploaded.add(identity);
20422
20756
  return {
20423
- ref: saved.ref,
20757
+ reference: saved.ref,
20424
20758
  name: displayNameOf(saved.ref),
20425
20759
  type,
20426
20760
  bytes: file.bytes.byteLength,
20761
+ ...imagePixelSize(file.bytes),
20427
20762
  reused: saved.reused === true,
20428
20763
  /** Paste this into a document to show the asset: an image tag for an image, a link otherwise. */
20429
20764
  markdown: buildAssetMarkdown(saved)
@@ -20436,12 +20771,12 @@ async function uploadAsset(graph, args) {
20436
20771
  */
20437
20772
  async function readAsset(graph, args) {
20438
20773
  const assets = requireAssets(graph);
20439
- if (!args.ref || args.ref.trim() === "") throw new ToolError("invalid_argument", "ref must be an asset reference or name.");
20774
+ if (!args.reference || args.reference.trim() === "") throw new ToolError("invalid_argument", "reference must be an asset reference or name.");
20440
20775
  await graph.store.refresh();
20441
- if (/^[a-z][a-z0-9+.-]*:\/\//i.test(args.ref.trim())) throw new ToolError("invalid_argument", `"${args.ref}" is a url, not an asset of this graph.`);
20442
- const ref = normaliseRef(args.ref);
20776
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(args.reference.trim())) throw new ToolError("invalid_argument", `"${args.reference}" is a url, not an asset of this graph.`);
20777
+ const ref = normaliseRef(args.reference);
20443
20778
  const identity = assets.identify(ref);
20444
- if (!identity) throw new ToolError("invalid_argument", `"${args.ref}" is not an asset reference of this graph.`);
20779
+ if (!identity) throw new ToolError("invalid_argument", `"${args.reference}" is not an asset reference of this graph.`);
20445
20780
  const documents = await reachable(graph, identity);
20446
20781
  if (!documents) throw new ToolError("asset_not_found", `No document you can read references "${displayNameOf(ref)}", so it is not available here.`);
20447
20782
  const asset = await assets.store.readBytes(ref);
@@ -20458,7 +20793,8 @@ async function readAsset(graph, args) {
20458
20793
  name: asset.name || displayNameOf(ref),
20459
20794
  type: asset.type,
20460
20795
  bytes: asset.bytes.byteLength,
20461
- ref,
20796
+ ...imagePixelSize(asset.bytes),
20797
+ reference: ref,
20462
20798
  documents
20463
20799
  };
20464
20800
  }
@@ -20500,7 +20836,7 @@ async function listAssets(graph, args = {}) {
20500
20836
  sizes = void 0;
20501
20837
  }
20502
20838
  const list = [...found.entries()].map(([id, entry]) => ({
20503
- ref: entry.ref,
20839
+ reference: entry.ref,
20504
20840
  name: entry.name,
20505
20841
  type: entry.type,
20506
20842
  ...sizes?.has(id) ? { bytes: sizes.get(id) } : {},
@@ -20658,7 +20994,16 @@ async function requireReferencedTask(graph, reference, purpose = "read") {
20658
20994
  if (found.code === "task_ambiguous") throw new ToolError("task_ambiguous", `More than one task has those words (${found.candidates.map((candidate) => `"${candidate.document}" line ${candidate.line}`).join(", ")}), so none was chosen. Ask the user which one, or name it by concept and line.`);
20659
20995
  const named = resolveIdentity(graph, parsed.document);
20660
20996
  if (purpose === "write" && named && await visibleText(graph, named) === null) throw protectedDocument(parsed.document);
20661
- throw new ToolError("task_not_found", "No task in the graph has those words now: it was edited or deleted. Ask the user for a fresh agent instruction.");
20997
+ throw new ToolError("task_not_found", taskNotFoundMessage(graph.connection()));
20998
+ }
20999
+ /**
21000
+ * The tools see only this computer's copy, so a task that is missing from it may be gone or may
21001
+ * not have arrived. An offline copy makes the second likely, and a fresh instruction names the
21002
+ * same words and would fail the same way, so it asks for a retry instead.
21003
+ */
21004
+ function taskNotFoundMessage(connection) {
21005
+ if (connection?.state === "offline") return `No task in this computer's copy of the graph has those words, but the copy has been ${offlineSince(connection)}, so the task may be newer than the copy. Tell the user, and try again once graph_info says the copy is connected.`;
21006
+ return "No task in the graph has those words now: it was edited or deleted, or the change has not reached this computer yet. Ask the user for a fresh agent instruction.";
20662
21007
  }
20663
21008
  /**
20664
21009
  * The block's own lines and everything nested under it: in the index's rows, which run in
@@ -20769,6 +21114,7 @@ async function graphInfo(graph) {
20769
21114
  return {
20770
21115
  name: graph.name,
20771
21116
  backend: graph.backend,
21117
+ connection: graph.connection() ?? void 0,
20772
21118
  documents: {
20773
21119
  pages: documents.filter((d) => d.kind === "page").length,
20774
21120
  journals: documents.filter((d) => d.kind === "journal").length,
@@ -21040,7 +21386,7 @@ async function publish(graph, args, host) {
21040
21386
  }
21041
21387
  let drawings = null;
21042
21388
  if (needsDrawings(bodies)) {
21043
- drawings = await openDrawingRenderer(env);
21389
+ drawings = await openDrawingRenderer(env, source.readAsset);
21044
21390
  if (!drawings) {
21045
21391
  await renderer?.dispose();
21046
21392
  await maps?.dispose();
@@ -21150,14 +21496,21 @@ function cliPublishOutput(result) {
21150
21496
  note: "Documents the site leaves out are counted here, not named. Settings → Publish in EtherPK shows the full report."
21151
21497
  };
21152
21498
  }
21499
+ /**
21500
+ * How long `graph_info` waits for the publications. Reading them asks the relay how far each
21501
+ * document has moved, and that request waits for a reconnect if the socket drops under it.
21502
+ * `graph_info` is how an agent learns the copy is offline, so it answers without them.
21503
+ */
21504
+ var PUBLISHING_READ_MS = 15e3;
21153
21505
  /** The publishing half of `graph_info`: each publication with its folder here, and whether diagrams can be drawn. */
21154
- async function publishingInfo(graph, host) {
21506
+ async function publishingInfo(graph, host, readMs = PUBLISHING_READ_MS) {
21155
21507
  const { env, cmd } = hostOf$1(host);
21156
- const { source } = await graph.publishing.readSource();
21508
+ const reading = graph.publishing.readSource();
21509
+ const read = await reachedWithin(reading, readMs);
21157
21510
  const destinationOf = await destinationsFor(graph, env);
21158
21511
  const chromium = await chromiumStatus(env, cmd);
21159
21512
  return {
21160
- publications: summarisePublishing(source).publications.map((p) => {
21513
+ publications: read ? summarisePublishing((await reading).source).publications.map((p) => {
21161
21514
  const { folder, repository } = destinationOf(p.id);
21162
21515
  return {
21163
21516
  id: p.id,
@@ -21166,7 +21519,8 @@ async function publishingInfo(graph, host) {
21166
21519
  publishFolder: folder,
21167
21520
  publishRepository: repository ? repositoryLabel(repository) : null
21168
21521
  };
21169
- }),
21522
+ }) : null,
21523
+ ...read ? {} : { note: "The publications could not be read in time. list_publications waits for them." },
21170
21524
  mermaid: {
21171
21525
  available: chromium.executable !== null,
21172
21526
  ...chromium.executable ? {} : { setup: chromium.setupCommand }
@@ -21662,7 +22016,7 @@ async function previewTheme(graph, args, host) {
21662
22016
  };
21663
22017
  const bodies = source.documents.map((d) => d.text);
21664
22018
  const renderer = needsMermaid(bodies) ? await openDiagramRenderer(env) : null;
21665
- const drawings = needsDrawings(bodies) ? await openDrawingRenderer(env) : null;
22019
+ const drawings = needsDrawings(bodies) ? await openDrawingRenderer(env, source.readAsset) : null;
21666
22020
  try {
21667
22021
  const environment = createNodePublishEnvironment({
21668
22022
  graphTheme: (id) => graph.publishing.graphTheme(id),
@@ -21779,6 +22133,20 @@ async function runTool(work) {
21779
22133
  }
21780
22134
  }
21781
22135
  /**
22136
+ * A note after the answer, whether that is a result or a refusal, while the copy it came from is
22137
+ * offline. A block of its own, so the answer's JSON stays as it always is.
22138
+ */
22139
+ function withOfflineNote(result, connection) {
22140
+ const note = offlineNotice(connection);
22141
+ return note ? {
22142
+ ...result,
22143
+ content: [...result.content, {
22144
+ type: "text",
22145
+ text: note
22146
+ }]
22147
+ } : result;
22148
+ }
22149
+ /**
21782
22150
  * The refusal every tool gives once the Sync Server has ended access, instead of answering from
21783
22151
  * a cache that can no longer be trusted or saved.
21784
22152
  */
@@ -21809,18 +22177,23 @@ function createMcpServer(source, info) {
21809
22177
  const ready = typeof source === "function" ? null : Promise.resolve(source);
21810
22178
  ready?.catch(() => {});
21811
22179
  const backendKind = typeof source === "function" || source instanceof Promise ? info.backendKind : source.backend.kind;
21812
- const run = (work) => runTool(async () => {
21813
- const graph = await (ready ?? source());
22180
+ const run = async (work) => {
22181
+ let graph;
22182
+ try {
22183
+ graph = await (ready ?? source());
22184
+ } catch (error) {
22185
+ return failed(error);
22186
+ }
21814
22187
  const ended = accessEndedError(graph, info.cmd ?? "etherpk-mcp");
21815
- if (ended) throw ended;
21816
- return work(graph);
21817
- });
22188
+ if (ended) return failed(ended);
22189
+ return withOfflineNote(await runTool(() => work(graph)), graph.connection());
22190
+ };
21818
22191
  const server = new McpServer({
21819
22192
  name: "etherpk",
21820
22193
  version: info.version
21821
22194
  }, { instructions: [
21822
22195
  `You are connected to the EtherPK knowledge graph "${info.graphName}": daily journal entries and titled pages in plain markdown, linked with [[wikilinks]].`,
21823
- ...backendKind === "synced" ? ["This graph is synced and encrypted: it has no folder on this computer, so reach it only through these tools."] : [],
22196
+ ...backendKind === "synced" ? ["This graph is synced and encrypted: it has no folder on this computer, so reach it only through these tools.", "The tools answer from this computer's copy of the graph. While that copy is offline from the Sync Server, every answer ends with a note saying since when and graph_info reports connection.state \"offline\". Edits made elsewhere since then are missing, so a page or task that is not found may only be newer than the copy: tell the user that, rather than saying it is gone."] : [],
21824
22197
  `This process holds the EtherPK sign-in and Encryption Keys it needs. Never read, print, copy or search ${info.credentialsDir ?? "~/.config/etherpk"}, or any keychain entry named etherpk-mcp: they are credentials that open the whole account, not notes.`,
21825
22198
  "Concept names are case-insensitive. Protected documents are not shown here: no list, search, backlink, task or graph answer names one, and a read of one answers not_found. graph_info says how many there are. A write onto a protected document's name is refused with protected_document - tell the user to make that change in EtherPK.",
21826
22199
  "Bullets are \"- \" with two-space nesting. Tasks are \"- [ ]\" / \"- [x]\" with task tags (#P1 #P2 #P3, #W #D #C, #D-YYYY-MM-DD due, #S-YYYY-MM-DD scheduled) right after the checkbox. A free tag such as #bug or #needs-review (letters, digits and single hyphens) is the user's own label and can go anywhere in a task's text; write task tags first.",
@@ -21830,11 +22203,11 @@ function createMcpServer(source, info) {
21830
22203
  "search has two kinds of matching: mode \"text\" (default) matches words and quoted phrases, and mode \"semantic\" finds passages about what a question or description means even when no words match. Use semantic for questions and descriptions, text for names, identifiers and exact phrases. \"hybrid\" returns both groups. When you answer from a search result, cite the document and where in it (its breadcrumb or lines). Semantic mode needs a one-time \"semantic setup\" on this computer - if it is not set up, search says so and names the command.",
21831
22204
  "graph_insights says what the links show across the whole graph (the most-linked concepts, pages many documents ask for that do not exist yet, pages linked to nothing, groups of related concepts and the concepts bridging them), and graph_path finds how two concepts are connected. Use them to answer questions about the shape of the graph, or to suggest pages to write or link.",
21832
22205
  "Start with graph_info to see what you are connected to. read_documents reads several documents in one call. tasks lists tasks and set_task changes one (status, priority, due and scheduled dates) by document and line.",
21833
- "An agent instruction is how a person hands you one task: a few lines naming the graph, the task's words and a task reference, etherpk:/g/<graph>/d/<document>#task=<line>-<fingerprint> (an earlier version wrote a web address ending in the same #task=). The reference is not a web address: never fetch it. Pass the whole text to read_task for the task and its detail, to set_task (as reference) to change it, and to add_task_note to write what you did as a task comment (a bullet under the \"- Comments\" bullet nested directly under the task). Leave its status as it is unless the user asks you to change it. Tasks nested under a task are its subtasks: read_task lists them in subtasks, and you may tick off or change each one with set_task as you work through it, using its reference. A Kanban board shows a subtask only through its parent's card when the parent is on the same board. The detail can hold images and files (its assets list): read each with read_asset and look at it before you start, as it is part of the task. A reference finds the task after lines are added above it or its tags change; if its words were edited it answers task_not_found, and you should ask the user for a fresh one.",
22206
+ "An agent instruction is how a person hands you one task: a few lines naming the graph, the task's words and a task reference, etherpk:/g/<graph>/d/<document>#task=<line>-<fingerprint> (an earlier version wrote a web address ending in the same #task=). The reference is not a web address: never fetch it. Pass the whole text to read_task for the task and its detail, to set_task (as reference) to change it, and to add_task_note to write what you did as a task comment (a bullet under the \"- Comments\" bullet nested directly under the task). Leave its status as it is unless the user asks you to change it. Tasks nested under a task are its subtasks: read_task lists them in subtasks, and you may tick off or change each one with set_task as you work through it, using its reference. A Kanban board shows a subtask only through its parent's card when the parent is on the same board. The detail can hold images and files (its assets list): read each with read_asset and look at it before you start, as it is part of the task. A reference finds the task after lines are added above it or its tags change; if its words were edited, or the edit has not reached this computer yet, it answers task_not_found, and you should ask the user for a fresh one.",
21834
22207
  "An agent instruction can also hand you a whole lane of a Kanban board, to work through every task in it or to triage them: a few lines naming the graph, the board and the lane, and a lane reference, etherpk:/g/<graph>/k/<concept>#lane=<status> (etherpk:/g/<graph>/kanban#lane=<status> for the Graph Kanban, which holds every task in the graph). It is not a web address either. Pass the whole text to tasks as reference to list the lane's tasks as the board shows them now; each comes with its own task reference for read_task, set_task and add_task_note.",
21835
22208
  "Publishing: list_publications shows the publications this graph defines (a publication is a page whose frontmatter defines it - its outline is the site navigation) and the public documents none takes. A document is on a site when its frontmatter has public: true and names the publication in publications. create_publication and update_publication change the settings, and publish writes the site into the publish folder the user set for it on this machine with the etherpk-mcp publish command (the tool cannot choose a folder) and returns the report. publish with dryRun: true renders and reports without writing and needs no folder: run it after editing a publication's pages and fix what it names. Diagrams need a browser the user installs once with \"diagrams setup\".",
21836
22209
  "Themes: a publication's look is a theme - Mustache templates, a stylesheet, a script and a manifest. list_themes shows the bundled ones (read-only) and the graph's own. read_theme writes a theme's files to a folder on this machine to read and edit. customise_publication_theme copies a publication's bundled theme into the graph and points the publication at the copy (create_theme copies any theme). write_theme_file, delete_theme_file and import_theme_folder change a graph theme. preview_theme renders a theme to a folder (with screenshots when a browser is set up) to check before publish. For a snippet such as an analytics script, an include slot (update_publication includes, e.g. head) filled by a page may be lighter than a theme copy.",
21837
- "Images and files are assets: upload_asset adds a file from this machine and returns the markdown to paste into a document. read_asset writes an asset to a local file you can open, and list_assets shows the assets documents reference. An asset is available only where a document you can read references it (or you uploaded it this session). read_asset, read_theme and preview_theme write under the graph's downloads directory and return the path - name a folder relative to it, never elsewhere.",
22210
+ "Images and files are assets: upload_asset adds a file from this machine and returns the markdown to paste into a document. To put an image in a drawing, add a line to its excalidraw.drawing fence with the reference, width and height upload_asset returns: {\"type\":\"image\",\"customData\":{\"asset\":\"<reference>\"},\"x\":0,\"y\":0,\"width\":<width>,\"height\":<height>}. A shape added after it draws above it. Add lines only, and never edit or reorder the lines there. read_asset writes an asset to a local file you can open, and list_assets shows the assets documents reference. An asset is available only where a document you can read references it (or you uploaded it this session). read_asset, read_theme and preview_theme write under the graph's downloads directory and return the path - name a folder relative to it, never elsewhere.",
21838
22211
  "The user documentation is at https://docs.etherpk.com."
21839
22212
  ].join("\n") });
21840
22213
  server.registerTool("list_documents", {
@@ -22038,7 +22411,7 @@ function createMcpServer(source, info) {
22038
22411
  }, async (args) => run((graph) => setFrontmatter(graph, args)));
22039
22412
  server.registerTool("upload_asset", {
22040
22413
  title: "Upload an asset",
22041
- description: "Add a file on this machine (an image, a PDF, any file) to the graph as an asset. Returns the reference and the markdown to paste into a document (an image tag for an image, a link otherwise). Bytes the graph already holds are not stored twice: the result then says reused: true and points at the existing asset. The file is stored as it is, without image optimisation. Refused with error \"invalid_argument\" for a folder, a file over 100 MiB, a hidden file or one in a hidden folder (.ssh, .env), and the Headless Client's own config and cache. Refused with error \"asset_refused\" when the server declines it on a quota.",
22414
+ description: "Add a file on this machine (an image, a PDF, any file) to the graph as an asset. Returns the reference, an image's width and height in pixels, and the markdown to paste into a document (an image tag for an image, a link otherwise). Bytes the graph already holds are not stored twice: the result then says reused: true and points at the existing asset. The file is stored as it is, without image optimisation. Refused with error \"invalid_argument\" for a folder, a file over 100 MiB, a hidden file or one in a hidden folder (.ssh, .env), and the Headless Client's own config and cache. Refused with error \"asset_refused\" when the server declines it on a quota.",
22042
22415
  inputSchema: {
22043
22416
  path: z.string().min(1).describe("Absolute path of an ordinary file on this machine."),
22044
22417
  name: z.string().min(1).optional().describe("The name to store it under - the file's own name by default.")
@@ -22046,9 +22419,9 @@ function createMcpServer(source, info) {
22046
22419
  }, async (args) => run((graph) => uploadAsset(graph, args)));
22047
22420
  server.registerTool("read_asset", {
22048
22421
  title: "Read an asset",
22049
- description: "Write an asset's bytes to a file on this machine and return the path, so you can open or view it. Pass the reference as a document shows it (\"../assets/<name>\") or the name alone. Available only where a document you can read references the asset (or you uploaded it this session) - otherwise error \"asset_not_found\". The file is written under the graph's downloads directory, named after the asset, and never over an existing file.",
22422
+ description: "Write an asset's bytes to a file on this machine and return the path, with an image's width and height in pixels, so you can open or view it. Pass the reference as a document shows it (\"../assets/<name>\") or the name alone. Available only where a document you can read references the asset (or you uploaded it this session) - otherwise error \"asset_not_found\". The file is written under the graph's downloads directory, named after the asset, and never over an existing file.",
22050
22423
  inputSchema: {
22051
- ref: z.string().min(1),
22424
+ reference: z.string().min(1).describe("The asset as a document or read_task shows it (\"../assets/<name>\"), or its name alone."),
22052
22425
  out_dir: z.string().min(1).optional().describe("A folder under the graph's downloads directory, relative to it - the downloads directory itself by default. A folder outside it is refused.")
22053
22426
  }
22054
22427
  }, async (args) => run((graph) => readAsset(graph, args)));
@@ -22184,12 +22557,15 @@ function createMcpServer(source, info) {
22184
22557
  }, async (args) => run((graph) => previewTheme(graph, args, host)));
22185
22558
  server.registerTool("graph_info", {
22186
22559
  title: "Graph info",
22187
- description: "What you are connected to: the graph's name, whether it is a synced graph (and on which server) or a folder, how many pages and journal entries it has and how many of them are protected (protected documents are counted here and shown nowhere else), the state of semantic search, whether assets are available, the publications with the publish folder set for each on this machine, and whether Mermaid diagrams can be drawn here.",
22560
+ description: "What you are connected to: the graph's name, whether it is a synced graph (on which server, and whether this computer's copy is connected to it now: connection.state and since) or a folder, how many pages and journal entries it has and how many of them are protected (protected documents are counted here and shown nowhere else), the state of semantic search, whether assets are available, the publications with the publish folder set for each on this machine, and whether Mermaid diagrams can be drawn here.",
22188
22561
  inputSchema: {}
22189
- }, async () => run(async (graph) => ({
22190
- ...await graphInfo(graph),
22191
- publishing: await publishingInfo(graph, host)
22192
- })));
22562
+ }, async () => run(async (graph) => {
22563
+ const publishing = await publishingInfo(graph, host);
22564
+ return {
22565
+ ...await graphInfo(graph),
22566
+ publishing
22567
+ };
22568
+ }));
22193
22569
  return server;
22194
22570
  }
22195
22571
  // src/socket-transport.ts
@@ -22833,6 +23209,31 @@ function mapItems(db, concept, cap = MAP_ITEMS_CAP) {
22833
23209
  * against an in-memory database, exactly as ADR 0015 established for the query layer — no
22834
23210
  * browser, no worker, no OPFS.
22835
23211
  */
23212
+ /** The reads that list rows from the open index, and list nothing while none is open. */
23213
+ function answerListRead(db, request) {
23214
+ switch (request.type) {
23215
+ case "property-keys": return {
23216
+ type: "property-keys",
23217
+ id: request.id,
23218
+ keys: db ? propertyKeys(db) : []
23219
+ };
23220
+ case "free-tags": return {
23221
+ type: "free-tags",
23222
+ id: request.id,
23223
+ tags: db ? usedFreeTags(db) : []
23224
+ };
23225
+ case "templates": return {
23226
+ type: "templates",
23227
+ id: request.id,
23228
+ templates: db ? templatePages(db) : []
23229
+ };
23230
+ case "property-values": return {
23231
+ type: "property-values",
23232
+ id: request.id,
23233
+ values: db ? propertyValues(db, request.key) : []
23234
+ };
23235
+ }
23236
+ }
22836
23237
  function createIndexCore(host) {
22837
23238
  let db;
22838
23239
  let persisted = false;
@@ -23126,21 +23527,10 @@ function createIndexCore(host) {
23126
23527
  capped: count.capped
23127
23528
  }];
23128
23529
  }
23129
- case "property-keys": return [{
23130
- type: "property-keys",
23131
- id: request.id,
23132
- keys: db ? propertyKeys(db) : []
23133
- }];
23134
- case "templates": return [{
23135
- type: "templates",
23136
- id: request.id,
23137
- templates: db ? templatePages(db) : []
23138
- }];
23139
- case "property-values": return [{
23140
- type: "property-values",
23141
- id: request.id,
23142
- values: db ? propertyValues(db, request.key) : []
23143
- }];
23530
+ case "property-keys":
23531
+ case "free-tags":
23532
+ case "templates":
23533
+ case "property-values": return [answerListRead(db, request)];
23144
23534
  case "property-match": return [{
23145
23535
  type: "property-match",
23146
23536
  id: request.id,
@@ -24044,6 +24434,12 @@ function createRemoteGraphIndex(source, transport, options) {
24044
24434
  id
24045
24435
  }))).keys;
24046
24436
  },
24437
+ async freeTags() {
24438
+ return (await request((id) => ({
24439
+ type: "free-tags",
24440
+ id
24441
+ }))).tags;
24442
+ },
24047
24443
  async templates() {
24048
24444
  return (await request((id) => ({
24049
24445
  type: "templates",
@@ -27473,6 +27869,7 @@ function assembleHeadlessGraph(parts) {
27473
27869
  themes: parts.themes,
27474
27870
  settle: () => parts.settle(schedulePersist),
27475
27871
  accessLoss: () => parts.accessLoss?.() ?? null,
27872
+ connection: () => parts.connection?.() ?? null,
27476
27873
  persist,
27477
27874
  semantic,
27478
27875
  semanticOpened: () => semanticOpening ? semanticOpening.catch(() => void 0) : Promise.resolve(void 0),
@@ -27513,6 +27910,7 @@ async function openHeadlessGraph(deps) {
27513
27910
  onAccessLost: deps.onAccessLost,
27514
27911
  publishName: deps.publishName
27515
27912
  });
27913
+ const connection = followConnection(sync, { onChange: deps.onConnectionChange });
27516
27914
  const store = createServerDocumentStore(sync, { readyTimeoutMs: deps.readyTimeoutMs });
27517
27915
  try {
27518
27916
  await store.scan();
@@ -27603,6 +28001,7 @@ async function openHeadlessGraph(deps) {
27603
28001
  graphId: deps.graphId,
27604
28002
  name: sync.getMeta().name ?? deps.graphId,
27605
28003
  accessLoss: () => sync.accessLoss(),
28004
+ connection: () => connection.current(),
27606
28005
  store: documents,
27607
28006
  index,
27608
28007
  assets,
@@ -29709,6 +30108,7 @@ async function openSyncedGraph(syncServer, graphId, named) {
29709
30108
  embeddingModel: () => loadEmbeddingModel(process.env),
29710
30109
  onSemanticProgress: reportSemanticProgress,
29711
30110
  onError: (error) => console.error(`etherpk-mcp: ${error.message}`),
30111
+ onConnectionChange: (change) => console.error(`etherpk-mcp: ${connectionChangeLine(change)}`),
29712
30112
  onAccessLost: (loss) => console.error(loss.kind === "membership" ? `etherpk-mcp: ${account.serverBaseUrl} ended this account's access to graph ${graphId}: it left, was removed, or the graph was deleted. Stopped syncing. Run: ${CMD} graphs` : `etherpk-mcp: the token for ${account.serverBaseUrl} was revoked or is no longer valid. Stopped syncing. Run: ${CMD} login --sync-server ${login.syncServer}`),
29713
30113
  publishName: createGraphNamePublisher({
29714
30114
  api: account.api,