@appsoftwareltd/etherpk-mcp 0.19.4 → 0.21.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.
- package/README.md +5 -1
- package/dist/drawing-page/assets/{abnfDiagram-N423BO3Z-CESuDXS9.js → abnfDiagram-N423BO3Z-D8OWVggw.js} +1 -1
- package/dist/drawing-page/assets/{ar-SA-G6X2FPQ2-BxYfG_4w.js → ar-SA-G6X2FPQ2-BsVAczME.js} +1 -1
- package/dist/drawing-page/assets/{arc-DKLVGaIz.js → arc-Y4DAzUBl.js} +1 -1
- package/dist/drawing-page/assets/{architectureDiagram-T3A2C74G-CGXZt2s5.js → architectureDiagram-T3A2C74G-Cz1L9ghf.js} +1 -1
- package/dist/drawing-page/assets/{az-AZ-76LH7QW2-CmORYk3r.js → az-AZ-76LH7QW2-Bqye8SiI.js} +1 -1
- package/dist/drawing-page/assets/{bg-BG-XCXSNQG7-CueRTQtz.js → bg-BG-XCXSNQG7-asUbixpL.js} +1 -1
- package/dist/drawing-page/assets/{blockDiagram-VBNYF7ZC-CrWptAUX.js → blockDiagram-VBNYF7ZC-DyXHdjs9.js} +1 -1
- package/dist/drawing-page/assets/{bn-BD-2XOGV67Q-BfLU6g3f.js → bn-BD-2XOGV67Q-CBYUnCH7.js} +1 -1
- package/dist/drawing-page/assets/{c4Diagram-5PPSVZJV-Cc4bJvZb.js → c4Diagram-5PPSVZJV-BhjosCS6.js} +1 -1
- package/dist/drawing-page/assets/{ca-ES-6MX7JW3Y-CoTtS-84.js → ca-ES-6MX7JW3Y-C4bGnaRX.js} +1 -1
- package/dist/drawing-page/assets/channel-DS9pcdIs.js +1 -0
- package/dist/drawing-page/assets/{chunk-2GRJ4B5K-DcSwK2S2.js → chunk-2GRJ4B5K-Buq_N5c0.js} +1 -1
- package/dist/drawing-page/assets/{chunk-4I5QYGJK-DneDyAZt.js → chunk-4I5QYGJK-Bl8Z8LVy.js} +1 -1
- package/dist/drawing-page/assets/{chunk-5RXB4S5H-B8cC2Isj.js → chunk-5RXB4S5H-DE4YEvsJ.js} +1 -1
- package/dist/drawing-page/assets/{chunk-6Q2QTUOP-FSofyzu7.js → chunk-6Q2QTUOP-kbEK7SHm.js} +1 -1
- package/dist/drawing-page/assets/{chunk-7Z6QIM7H-Czjy6v_N.js → chunk-7Z6QIM7H-Be4sL324.js} +1 -1
- package/dist/drawing-page/assets/{chunk-GF5L2VYU-D7C4sksR.js → chunk-GF5L2VYU-Ydi_RicV.js} +1 -1
- package/dist/drawing-page/assets/{chunk-I66GZJ75-eQyCt4m7.js → chunk-I66GZJ75-C2Z4jtZy.js} +1 -1
- package/dist/drawing-page/assets/{chunk-JQJVKLGR-BP6tAsN9.js → chunk-JQJVKLGR-B80bvrZd.js} +1 -1
- package/dist/drawing-page/assets/{chunk-KBJHAD2P-C5PM9_Z3.js → chunk-KBJHAD2P-BAvZlShA.js} +1 -1
- package/dist/drawing-page/assets/{chunk-NSK5VX7P-CSBZRlGI.js → chunk-NSK5VX7P-BdEZvUp3.js} +1 -1
- package/dist/drawing-page/assets/{chunk-QR6OTTB3-ArIwTbsg.js → chunk-QR6OTTB3-DRMRhUJT.js} +1 -1
- package/dist/drawing-page/assets/{chunk-RYQCIY6F-r64JZc1V.js → chunk-RYQCIY6F-CQl9Ntnt.js} +1 -1
- package/dist/drawing-page/assets/{chunk-UBXNYLIW-DCDJQ_uV.js → chunk-UBXNYLIW-Bd9Q_n7K.js} +1 -1
- package/dist/drawing-page/assets/{chunk-W5SLKNZC-DVmpr6gi.js → chunk-W5SLKNZC-DWSon6sa.js} +1 -1
- package/dist/drawing-page/assets/{chunk-WRU74C26-CBC9mgCI.js → chunk-WRU74C26-IUs_bJSX.js} +1 -1
- package/dist/drawing-page/assets/{chunk-XXDRQBXY-D1NataVh.js → chunk-XXDRQBXY-CHyUWQko.js} +1 -1
- package/dist/drawing-page/assets/classDiagram-JCYQIIEL-DzQM8hoW.js +1 -0
- package/dist/drawing-page/assets/classDiagram-v2-OCEON4UE-DzQM8hoW.js +1 -0
- package/dist/drawing-page/assets/{client-CX293Fae.js → client-DZUoshau.js} +1 -1
- package/dist/drawing-page/assets/{cose-bilkent-JH36ORCC-CPalPD7U.js → cose-bilkent-JH36ORCC-B2IOQydr.js} +1 -1
- package/dist/drawing-page/assets/{cs-CZ-2BRQDIVT-JneBadmf.js → cs-CZ-2BRQDIVT-2eGnB8k8.js} +1 -1
- package/dist/drawing-page/assets/{cynefinDiagram-MW4NZA55-6UGHnaXm.js → cynefinDiagram-MW4NZA55-BBR5L_qc.js} +1 -1
- package/dist/drawing-page/assets/{da-DK-5WZEPLOC-MyYyPsgH.js → da-DK-5WZEPLOC-CyBLbPbT.js} +1 -1
- package/dist/drawing-page/assets/{dagre-VZM6K2ZE-Cq2tBCTV.js → dagre-VZM6K2ZE-CmtH_NsG.js} +1 -1
- package/dist/drawing-page/assets/{de-DE-XR44H4JA-C5sxzBO0.js → de-DE-XR44H4JA-DXW5rzjb.js} +1 -1
- package/dist/drawing-page/assets/{diagram-7IWD3JNH-CSFNaVMQ.js → diagram-7IWD3JNH-DrmVlUuB.js} +1 -1
- package/dist/drawing-page/assets/{diagram-B4RE2ZJO-DERYVA6I.js → diagram-B4RE2ZJO-DKj0DZ37.js} +1 -1
- package/dist/drawing-page/assets/{diagram-LBJQPF4R-BZLgpVLi.js → diagram-LBJQPF4R-Cl9_05Rh.js} +1 -1
- package/dist/drawing-page/assets/{diagram-Q27KOJAE-CW8RthgJ.js → diagram-Q27KOJAE-DYeXQLno.js} +1 -1
- package/dist/drawing-page/assets/{diagram-UB23O5K3-DtMRLexl.js → diagram-UB23O5K3-R3YIOKDN.js} +1 -1
- package/dist/drawing-page/assets/{dist-CBR8fdSM.js → dist-Bip7SX9b.js} +6 -6
- package/dist/drawing-page/assets/{dist-pj5P0X0N.js → dist-DBTArFLM.js} +1 -1
- package/dist/drawing-page/assets/{ebnfDiagram-BXEA7PRR-DKlWK14b.js → ebnfDiagram-BXEA7PRR-D5WCgRZP.js} +1 -1
- package/dist/drawing-page/assets/{el-GR-BZB4AONW-BDF9TGyK.js → el-GR-BZB4AONW-CADjKmTB.js} +1 -1
- package/dist/drawing-page/assets/{en-B4ZKOASM-DQptt87B.js → en-B4ZKOASM-C7v1BS8o.js} +1 -1
- package/dist/drawing-page/assets/{erDiagram-JOGREHBK-C8jQzl05.js → erDiagram-JOGREHBK-BR1DC0W8.js} +1 -1
- package/dist/drawing-page/assets/{es-ES-U4NZUMDT-CvMMDbja.js → es-ES-U4NZUMDT-C5_USRPz.js} +1 -1
- package/dist/drawing-page/assets/{eu-ES-A7QVB2H4-Azi3qer2.js → eu-ES-A7QVB2H4-Bh-Tlgte.js} +1 -1
- package/dist/drawing-page/assets/{fa-IR-HGAKTJCU-CcB_2DLJ.js → fa-IR-HGAKTJCU-DIWd51q2.js} +1 -1
- package/dist/drawing-page/assets/{fi-FI-Z5N7JZ37-Cfhwoabd.js → fi-FI-Z5N7JZ37-AF3JZRRl.js} +1 -1
- package/dist/drawing-page/assets/flowDiagram-UKHOOZJN-BxlljAAj.js +1 -0
- package/dist/drawing-page/assets/{fr-FR-RHASNOE6-CtRkYaA9.js → fr-FR-RHASNOE6-P6MTmYPf.js} +1 -1
- package/dist/drawing-page/assets/{ganttDiagram-PKOTCBZU-BlOkl0Ml.js → ganttDiagram-PKOTCBZU-BNF-Xqfv.js} +1 -1
- package/dist/drawing-page/assets/{gitGraphDiagram-DS77QQ5N-nNmXQTuR.js → gitGraphDiagram-DS77QQ5N-DbMDTDRm.js} +1 -1
- package/dist/drawing-page/assets/{gl-ES-HMX3MZ6V-BYvext-h.js → gl-ES-HMX3MZ6V-D92Lwl1g.js} +1 -1
- package/dist/drawing-page/assets/{he-IL-6SHJWFNN-Ds0Iws-m.js → he-IL-6SHJWFNN-CF5QXU1O.js} +1 -1
- package/dist/drawing-page/assets/{hi-IN-IWLTKZ5I-C5-S2BYt.js → hi-IN-IWLTKZ5I-DCG9nnM5.js} +1 -1
- package/dist/drawing-page/assets/{hu-HU-A5ZG7DT2-BKp400E6.js → hu-HU-A5ZG7DT2-DqWC1pUc.js} +1 -1
- package/dist/drawing-page/assets/{id-ID-SAP4L64H-C0DZ4SF3.js → id-ID-SAP4L64H-NL4uPTqX.js} +1 -1
- package/dist/drawing-page/assets/{image-GAAHSSAO-CRETPnVQ.js → image-GAAHSSAO-ioAhIVlf.js} +1 -1
- package/dist/drawing-page/assets/{infoDiagram-6WML65LV-PbgVrt2v.js → infoDiagram-6WML65LV-sj0RgLXh.js} +1 -1
- package/dist/drawing-page/assets/{ishikawaDiagram-WSZJBQD7-oqiUmo-r.js → ishikawaDiagram-WSZJBQD7-CADsKhde.js} +1 -1
- package/dist/drawing-page/assets/{it-IT-JPQ66NNP-DqEW-1TC.js → it-IT-JPQ66NNP-C0BwfQO9.js} +1 -1
- package/dist/drawing-page/assets/{ja-JP-DBVTYXUO-BD5fy2g0.js → ja-JP-DBVTYXUO-Cywbh0wR.js} +1 -1
- package/dist/drawing-page/assets/{journeyDiagram-NVQOT4AX-Du1rIQY5.js → journeyDiagram-NVQOT4AX-DcOlSjLB.js} +1 -1
- package/dist/drawing-page/assets/{kaa-6HZHGXH3-JwewpKGA.js → kaa-6HZHGXH3-BiB4IMVP.js} +1 -1
- package/dist/drawing-page/assets/{kab-KAB-ZGHBKWFO-Ypv2Vt_S.js → kab-KAB-ZGHBKWFO-C6EOE5eo.js} +1 -1
- package/dist/drawing-page/assets/{kanban-definition-27J2QSJJ-D41YNdW5.js → kanban-definition-27J2QSJJ-CbKcjFOA.js} +1 -1
- package/dist/drawing-page/assets/{kk-KZ-P5N5QNE5-CW8QQBb4.js → kk-KZ-P5N5QNE5-ip1AEYXT.js} +1 -1
- package/dist/drawing-page/assets/{km-KH-HSX4SM5Z-Brql62o4.js → km-KH-HSX4SM5Z-DQs24dA3.js} +1 -1
- package/dist/drawing-page/assets/{ko-KR-MTYHY66A-B2AA9q3T.js → ko-KR-MTYHY66A-CAWadZAw.js} +1 -1
- package/dist/drawing-page/assets/{ku-TR-6OUDTVRD-wRfKM-UR.js → ku-TR-6OUDTVRD-C7tGdvI8.js} +1 -1
- package/dist/drawing-page/assets/{line-DR25GccZ.js → line-BEw28pZ8.js} +1 -1
- package/dist/drawing-page/assets/{linear-CgBNAElN.js → linear-0eaIpIui.js} +1 -1
- package/dist/drawing-page/assets/{lt-LT-XHIRWOB4-JLA_pCNn.js → lt-LT-XHIRWOB4-Qd0fa1dX.js} +1 -1
- package/dist/drawing-page/assets/{lv-LV-5QDEKY6T-Bm_FaNIi.js → lv-LV-5QDEKY6T-BoAOhYL4.js} +1 -1
- package/dist/drawing-page/assets/{mindmap-definition-FAOFIHXS-CIAkR1vw.js → mindmap-definition-FAOFIHXS-CDIxta_Q.js} +1 -1
- package/dist/drawing-page/assets/{mr-IN-CRQNXWMA-B1pSsBa2.js → mr-IN-CRQNXWMA-CS9yIl05.js} +1 -1
- package/dist/drawing-page/assets/{my-MM-5M5IBNSE-DEuiqvRE.js → my-MM-5M5IBNSE-Do5mbf6R.js} +1 -1
- package/dist/drawing-page/assets/{nb-NO-T6EIAALU-NgPXPjzu.js → nb-NO-T6EIAALU-DMJUR2cn.js} +1 -1
- package/dist/drawing-page/assets/{nl-NL-IS3SIHDZ-CEIThWDg.js → nl-NL-IS3SIHDZ-C1CpMJaC.js} +1 -1
- package/dist/drawing-page/assets/{nn-NO-6E72VCQL-CWaPfJ9b.js → nn-NO-6E72VCQL-Bw4IDI_E.js} +1 -1
- package/dist/drawing-page/assets/{oc-FR-POXYY2M6-DQI9Oi0b.js → oc-FR-POXYY2M6-PpxcOiLq.js} +1 -1
- package/dist/drawing-page/assets/{pa-IN-N4M65BXN-Bp1ixU58.js → pa-IN-N4M65BXN-Ck8ZOFZQ.js} +1 -1
- package/dist/drawing-page/assets/{pegDiagram-VL7TDLO6-B-xberCP.js → pegDiagram-VL7TDLO6-CsNIPAUO.js} +1 -1
- package/dist/drawing-page/assets/percentages-BXMCSKIN-DD68R4BU.js +1 -0
- package/dist/drawing-page/assets/{pica-CjdSVAiE.js → pica-TJxRH1hS.js} +1 -1
- package/dist/drawing-page/assets/picture-D1_Gef1m.js +1 -0
- package/dist/drawing-page/assets/{pieDiagram-7S7Q4E2Y-mlV2Cfx3.js → pieDiagram-7S7Q4E2Y-ivc04D1I.js} +1 -1
- package/dist/drawing-page/assets/{pl-PL-T2D74RX3-BUKE4wqp.js → pl-PL-T2D74RX3-BO6STjgQ.js} +1 -1
- package/dist/drawing-page/assets/{prod-h6IKD9uE.js → prod-B73VusLB.js} +9 -9
- package/dist/drawing-page/assets/{pt-BR-5N22H2LF--wv9sZf1.js → pt-BR-5N22H2LF-BhL7mFPh.js} +1 -1
- package/dist/drawing-page/assets/{pt-PT-UZXXM6DQ-0XUNZ7du.js → pt-PT-UZXXM6DQ-D9xt78jb.js} +1 -1
- package/dist/drawing-page/assets/{quadrantDiagram-CIZ2JOQS-DCASpnCZ.js → quadrantDiagram-CIZ2JOQS-B5ShXxBL.js} +1 -1
- package/dist/drawing-page/assets/{railroadDiagram-AXF67PYL-DUPotRSX.js → railroadDiagram-AXF67PYL-TouNMOa2.js} +1 -1
- package/dist/drawing-page/assets/{react-dom-bLrj4m0o.js → react-dom-DOyQ--4c.js} +1 -1
- package/dist/drawing-page/assets/{react-rKJS6zPL.js → react-giARbZ_k.js} +1 -1
- package/dist/drawing-page/assets/{requirementDiagram-LRYGKXZP-BqF3hAjG.js → requirementDiagram-LRYGKXZP-8_FxBKqF.js} +1 -1
- package/dist/drawing-page/assets/{ro-RO-JPDTUUEW-C_HZ_9_y.js → ro-RO-JPDTUUEW-Ce5SkqHN.js} +1 -1
- package/dist/drawing-page/assets/{ru-RU-B4JR7IUQ-CghTzS1B.js → ru-RU-B4JR7IUQ-BMaHD5jb.js} +1 -1
- package/dist/drawing-page/assets/{sankeyDiagram-W5VNT64P-TOHKGdOj.js → sankeyDiagram-W5VNT64P-BJlO_5Zn.js} +1 -1
- package/dist/drawing-page/assets/scene-DRZ2XrJm.js +1 -0
- package/dist/drawing-page/assets/{sequenceDiagram-SI44F4Z6-BPzBwJ23.js → sequenceDiagram-SI44F4Z6-B25_T2t7.js} +1 -1
- package/dist/drawing-page/assets/{si-LK-N5RQ5JYF-C-E7WMzT.js → si-LK-N5RQ5JYF-Ck9OaWE_.js} +1 -1
- package/dist/drawing-page/assets/{sk-SK-C5VTKIMK-xSSzQ-Nc.js → sk-SK-C5VTKIMK-C1EJOPsj.js} +1 -1
- package/dist/drawing-page/assets/{sl-SI-NN7IZMDC-vd9S4rru.js → sl-SI-NN7IZMDC-DFCcSE-x.js} +1 -1
- package/dist/drawing-page/assets/{src-Bq_MLJPW.js → src-CxkpPvd7.js} +1 -1
- package/dist/drawing-page/assets/{stateDiagram-OKZ733FA-DWhPSrGe.js → stateDiagram-OKZ733FA-DhMMG4Il.js} +1 -1
- package/dist/drawing-page/assets/stateDiagram-v2-UEYNNEHI-CbCHFTZh.js +1 -0
- package/dist/drawing-page/assets/{sv-SE-XGPEYMSR-C03vrITo.js → sv-SE-XGPEYMSR-BbGGGINr.js} +1 -1
- package/dist/drawing-page/assets/{swimlanes-SLNWSIFB-bAtn9k-6.js → swimlanes-SLNWSIFB-C_067SLp.js} +1 -1
- package/dist/drawing-page/assets/swimlanesDiagram-ULZ7WXOC-D8yDNrVf.js +8 -0
- package/dist/drawing-page/assets/{ta-IN-2NMHFXQM-iApHUOhp.js → ta-IN-2NMHFXQM-MmNA5EQD.js} +1 -1
- package/dist/drawing-page/assets/{th-TH-HPSO5L25-XaEE8A2a.js → th-TH-HPSO5L25-BqwSAk--.js} +1 -1
- package/dist/drawing-page/assets/{timeline-definition-Z64GVDOM-HpHAE7p1.js → timeline-definition-Z64GVDOM-9j9r3WvN.js} +1 -1
- package/dist/drawing-page/assets/{tr-TR-DEFEU3FU-qh_6U6tZ.js → tr-TR-DEFEU3FU-DazmI1UO.js} +1 -1
- package/dist/drawing-page/assets/{uk-UA-QMV73CPH-Dnaa4Abz.js → uk-UA-QMV73CPH-BU7K3yLx.js} +1 -1
- package/dist/drawing-page/assets/{vennDiagram-T6HMQDX7-DLs65-zf.js → vennDiagram-T6HMQDX7-R7gZSWda.js} +1 -1
- package/dist/drawing-page/assets/{vi-VN-M7AON7JQ-YOkhVPYg.js → vi-VN-M7AON7JQ-DlSTVl7E.js} +1 -1
- package/dist/drawing-page/assets/{wardleyDiagram-T6FBY63Y-BD5VH3jw.js → wardleyDiagram-T6FBY63Y-DOdJ3ql5.js} +1 -1
- package/dist/drawing-page/assets/{xychartDiagram-ELKLHX3M-jJa9qhv1.js → xychartDiagram-ELKLHX3M-D-FGz-0h.js} +1 -1
- package/dist/drawing-page/assets/{zh-CN-LNUGB5OW-DggUAMgs.js → zh-CN-LNUGB5OW-D3QP-vIz.js} +1 -1
- package/dist/drawing-page/assets/{zh-HK-E62DVLB3-MCovRg56.js → zh-HK-E62DVLB3-48EQNd3p.js} +1 -1
- package/dist/drawing-page/assets/{zh-TW-RAJ6MFWO-BuC6uBYw.js → zh-TW-RAJ6MFWO-DYxGzawk.js} +1 -1
- package/dist/drawing-page/drawing-picture-page.js +4 -4
- package/dist/main.js +973 -461
- package/dist/main.js.map +1 -1
- package/dist/map-picture-page.js +162 -109
- package/package.json +6 -6
- package/dist/drawing-page/assets/channel-BzrpSA9e.js +0 -1
- package/dist/drawing-page/assets/classDiagram-JCYQIIEL-fQUEpNef.js +0 -1
- package/dist/drawing-page/assets/classDiagram-v2-OCEON4UE-fQUEpNef.js +0 -1
- package/dist/drawing-page/assets/flowDiagram-UKHOOZJN-LEBtdj-L.js +0 -1
- package/dist/drawing-page/assets/percentages-BXMCSKIN-BB8F9H2s.js +0 -1
- package/dist/drawing-page/assets/picture-B8KpPOJ2.js +0 -1
- package/dist/drawing-page/assets/scene-CNYL6uXE.js +0 -1
- package/dist/drawing-page/assets/stateDiagram-v2-UEYNNEHI-0SsDmXm-.js +0 -1
- package/dist/drawing-page/assets/swimlanesDiagram-ULZ7WXOC-3CBtkpxY.js +0 -8
package/dist/main.js
CHANGED
|
@@ -626,6 +626,15 @@ var ASSET_CHUNK_PLAINTEXT_BYTES = 4194304;
|
|
|
626
626
|
function assetChunkCount(size) {
|
|
627
627
|
return Math.max(1, Math.ceil(size / ASSET_CHUNK_PLAINTEXT_BYTES));
|
|
628
628
|
}
|
|
629
|
+
z.strictObject({
|
|
630
|
+
/** Sync+ can be bought now. */
|
|
631
|
+
billingEnabled: z.boolean(),
|
|
632
|
+
/** The price as the account site writes it, currency included. Shown as text, never parsed. */
|
|
633
|
+
priceDisplay: z.string().min(1).max(32).regex(/^[^\p{Cc}\p{Cf}<>]+$/u),
|
|
634
|
+
billingInterval: z.enum(["month", "year"]),
|
|
635
|
+
/** Days of trial a first subscription starts with; 0 for none. */
|
|
636
|
+
trialDays: z.number().int().min(0).max(366)
|
|
637
|
+
});
|
|
629
638
|
/** Whether `text` is a short link a Sync Server opens: one of Google's share links. */
|
|
630
639
|
function isShortMapLink(text) {
|
|
631
640
|
let url;
|
|
@@ -714,7 +723,7 @@ function looksLikeAgentSetupCode(value) {
|
|
|
714
723
|
}
|
|
715
724
|
var package_default = {
|
|
716
725
|
name: "@appsoftwareltd/etherpk-mcp",
|
|
717
|
-
version: "0.
|
|
726
|
+
version: "0.21.0",
|
|
718
727
|
license: "Elastic-2.0",
|
|
719
728
|
description: "EtherPK Headless Client: an MCP server over a synced knowledge graph, run beside the agent on the user's own machine.",
|
|
720
729
|
type: "module",
|
|
@@ -4280,6 +4289,7 @@ function extensionFences(lines) {
|
|
|
4280
4289
|
// ../client/src/lib/document/map-text.ts
|
|
4281
4290
|
var NUMBER = String.raw`[+-]?(?:\d+(?:\.\d*)?|\.\d+)`;
|
|
4282
4291
|
var POINT = new RegExp(String.raw`^\s*(${NUMBER})\s*,\s*(${NUMBER})\s*$`);
|
|
4292
|
+
var SIZE = /^\s*size\s+(\d{1,5})?x(\d{1,5})\s*$/;
|
|
4283
4293
|
/** How many of the last `@`s on a line may end its name (`readMapLine`). */
|
|
4284
4294
|
var MAX_NAME_ENDS = 16;
|
|
4285
4295
|
function readPoint(text) {
|
|
@@ -4338,19 +4348,40 @@ function readMapLine(text) {
|
|
|
4338
4348
|
}
|
|
4339
4349
|
return readLocation(trimmed, "");
|
|
4340
4350
|
}
|
|
4341
|
-
/**
|
|
4351
|
+
/** What a size line says, or null when `text` is not one. No size line can read as a place or a route. */
|
|
4352
|
+
function readMapSize(text) {
|
|
4353
|
+
const match = SIZE.exec(text);
|
|
4354
|
+
if (!match) return null;
|
|
4355
|
+
const width = match[1] === void 0 ? null : Number(match[1]);
|
|
4356
|
+
const height = Number(match[2]);
|
|
4357
|
+
return width === 0 || height === 0 ? null : {
|
|
4358
|
+
width,
|
|
4359
|
+
height
|
|
4360
|
+
};
|
|
4361
|
+
}
|
|
4362
|
+
/**
|
|
4363
|
+
* Every item in a Map Block's body, numbered by line, and its size. Blank lines are skipped, not
|
|
4364
|
+
* reported. A second size line is reported like any line that does not read: two members resizing at
|
|
4365
|
+
* once merge as two lines, and the map can only be one size.
|
|
4366
|
+
*/
|
|
4342
4367
|
function readMapBody(lines) {
|
|
4343
4368
|
const body = {
|
|
4344
4369
|
items: [],
|
|
4345
|
-
unread: []
|
|
4370
|
+
unread: [],
|
|
4371
|
+
size: null
|
|
4346
4372
|
};
|
|
4347
4373
|
lines.forEach((text, line) => {
|
|
4348
4374
|
if (text.trim() === "") return;
|
|
4349
4375
|
const read = readMapLine(text);
|
|
4350
|
-
if (read)
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4376
|
+
if (read) {
|
|
4377
|
+
body.items.push({
|
|
4378
|
+
...read,
|
|
4379
|
+
line
|
|
4380
|
+
});
|
|
4381
|
+
return;
|
|
4382
|
+
}
|
|
4383
|
+
const size = body.size === null ? readMapSize(text) : null;
|
|
4384
|
+
if (size) body.size = size;
|
|
4354
4385
|
else body.unread.push({
|
|
4355
4386
|
line,
|
|
4356
4387
|
text
|
|
@@ -4411,7 +4442,6 @@ var EMPTY = {
|
|
|
4411
4442
|
scheduled: null
|
|
4412
4443
|
};
|
|
4413
4444
|
/**
|
|
4414
|
-
* Tags are **case-sensitive** (ADR 0032), so `#p1` and `#d` are prose, not metadata.
|
|
4415
4445
|
* Dates are shape-matched, not calendar-validated: `#D-2026-13-45` is still a date-shaped
|
|
4416
4446
|
* tag. Shape is what makes string ordering equal date ordering, and a wrong date is the
|
|
4417
4447
|
* user's to see and fix, not ours to silently drop.
|
|
@@ -4434,8 +4464,13 @@ var STATE_TAGS = [
|
|
|
4434
4464
|
["archived", "#A"]
|
|
4435
4465
|
];
|
|
4436
4466
|
var STATE_BY_TOKEN = new Map(STATE_TAGS.map(([kind, token]) => [token, kind]));
|
|
4437
|
-
/**
|
|
4438
|
-
function
|
|
4467
|
+
/** `token` as a Task Tag is written: its ASCII letters in upper case. Not `toUpperCase`, which also turns `ſ` into `S`. */
|
|
4468
|
+
function inTagCase(token) {
|
|
4469
|
+
return token.replace(/[a-z]+/g, (letters) => letters.toUpperCase());
|
|
4470
|
+
}
|
|
4471
|
+
/** Read one token as a tag, in any case, or null if it is not one (which ends the run). */
|
|
4472
|
+
function readTag(written) {
|
|
4473
|
+
const token = inTagCase(written);
|
|
4439
4474
|
const state = STATE_BY_TOKEN.get(token);
|
|
4440
4475
|
if (state) return {
|
|
4441
4476
|
kind: state,
|
|
@@ -4507,13 +4542,17 @@ function parseTaskTags(label) {
|
|
|
4507
4542
|
/** A Free Tag's word: letters and digits in words joined by single hyphens. */
|
|
4508
4543
|
var FREE_TAG_WORD = /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/;
|
|
4509
4544
|
/**
|
|
4510
|
-
* Anything a [[Task Tag]] is or could be, in any case: `#
|
|
4545
|
+
* Anything a [[Task Tag]] is or could be, in any case: `#P4` and `#d-2026` are not Task Tags, but a
|
|
4511
4546
|
* person who wrote them meant one, so neither is a Free Tag either.
|
|
4512
4547
|
*/
|
|
4513
4548
|
var TASK_TAG_SHAPED = /^(?:P\d+|W|D|T|C|A|[DCS]-[\d-]*)$/i;
|
|
4549
|
+
/** Whether `word` (without its `#`) is a [[Task Tag]] or shaped like one, in any case. */
|
|
4550
|
+
function isTaskTagShaped(word) {
|
|
4551
|
+
return TASK_TAG_SHAPED.test(word);
|
|
4552
|
+
}
|
|
4514
4553
|
/** Whether `word` (without its `#`) can be a [[Free Tag]]: what the Task Editor checks a new tag by. */
|
|
4515
4554
|
function isFreeTagWord(word) {
|
|
4516
|
-
return FREE_TAG_WORD.test(word) && /[A-Za-z]/.test(word) && !
|
|
4555
|
+
return FREE_TAG_WORD.test(word) && /[A-Za-z]/.test(word) && !isTaskTagShaped(word);
|
|
4517
4556
|
}
|
|
4518
4557
|
/** True when a whitespace-separated token is exactly one Free Tag. */
|
|
4519
4558
|
function isFreeTagToken(token) {
|
|
@@ -4729,13 +4768,17 @@ new Set(STATE_TAGS.map(([kind]) => kind));
|
|
|
4729
4768
|
function taskTitleKey(label) {
|
|
4730
4769
|
return taskDisplay(label).text.toLowerCase();
|
|
4731
4770
|
}
|
|
4771
|
+
/** The [[Free Tag]]s on a task's line, once each, in the spelling first written. */
|
|
4772
|
+
function taskFreeTags(label) {
|
|
4773
|
+
return freeTagsIn(parseTaskTags(label).text);
|
|
4774
|
+
}
|
|
4732
4775
|
/**
|
|
4733
4776
|
* A task's tags as a [[Task Text Filter]] matches them: every [[Task Tag]] in its leading run and
|
|
4734
4777
|
* every [[Free Tag]] on its line, lower-cased, each with a space either side. No tag holds a space,
|
|
4735
4778
|
* so {@link taskTagNeedle} finds a tag whole, and `#bug` is not found in `#bugfix`.
|
|
4736
4779
|
*/
|
|
4737
4780
|
function taskTagsKey(label) {
|
|
4738
|
-
const tags = [...taskTagTokens(label).map((token) => token.slice(1)), ...
|
|
4781
|
+
const tags = [...taskTagTokens(label).map((token) => token.slice(1)), ...taskFreeTags(label)];
|
|
4739
4782
|
return tags.length === 0 ? "" : ` ${tags.join(" ").toLowerCase()} `;
|
|
4740
4783
|
}
|
|
4741
4784
|
/** What {@link taskTagsKey} is searched for, for a tag out of a {@link TaskTextFilter}. */
|
|
@@ -5611,7 +5654,7 @@ function createSchema(db) {
|
|
|
5611
5654
|
db.exec(SCHEMA$1);
|
|
5612
5655
|
db.run("INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('active_generation', 1)");
|
|
5613
5656
|
db.run("INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('revision', 0)");
|
|
5614
|
-
db.exec(`PRAGMA user_version =
|
|
5657
|
+
db.exec(`PRAGMA user_version = 23`);
|
|
5615
5658
|
}
|
|
5616
5659
|
function activeIndexGeneration(db) {
|
|
5617
5660
|
return db.all("SELECT value FROM index_metadata WHERE key = 'active_generation'")[0]?.value ?? 1;
|
|
@@ -5632,7 +5675,7 @@ function advanceIndexRevision(db) {
|
|
|
5632
5675
|
*/
|
|
5633
5676
|
function isUsableIndex(db) {
|
|
5634
5677
|
try {
|
|
5635
|
-
return db.all("PRAGMA user_version")[0]?.user_version ===
|
|
5678
|
+
return db.all("PRAGMA user_version")[0]?.user_version === 23;
|
|
5636
5679
|
} catch {
|
|
5637
5680
|
return false;
|
|
5638
5681
|
}
|
|
@@ -5685,13 +5728,13 @@ function indexDocHash(doc) {
|
|
|
5685
5728
|
const includes = doc.includes ?? [];
|
|
5686
5729
|
const properties = doc.properties ?? [];
|
|
5687
5730
|
const aliases = doc.aliases ?? [];
|
|
5688
|
-
if (includes.length === 0 && properties.length === 0 && aliases.length === 0 && !doc.template) return hashText(doc.text);
|
|
5731
|
+
if (includes.length === 0 && properties.length === 0 && aliases.length === 0 && !doc.template) return hashText$1(doc.text);
|
|
5689
5732
|
const includeText = includes.map((i) => `${i.publication}\u0001${i.slot}\u0001${i.concept}`).join("\0");
|
|
5690
5733
|
const propertyText = properties.map((p) => `${p.key}\u0001${p.value ?? ""}`).join("\0");
|
|
5691
5734
|
const templateMark = doc.template ? "template" : "";
|
|
5692
|
-
return hashText(`${doc.text}\u0000${includeText}\u0003${propertyText}\u0004${aliases.join("\0")}${templateMark}`);
|
|
5735
|
+
return hashText$1(`${doc.text}\u0000${includeText}\u0003${propertyText}\u0004${aliases.join("\0")}${templateMark}`);
|
|
5693
5736
|
}
|
|
5694
|
-
function hashText(text) {
|
|
5737
|
+
function hashText$1(text) {
|
|
5695
5738
|
let h1 = 3735928559;
|
|
5696
5739
|
let h2 = 1103547991;
|
|
5697
5740
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -5813,7 +5856,7 @@ function insertDerived(db, pageId, doc) {
|
|
|
5813
5856
|
passage.startLine,
|
|
5814
5857
|
passage.endLine,
|
|
5815
5858
|
passage.firstBlockLocalId,
|
|
5816
|
-
hashText(passage.text),
|
|
5859
|
+
hashText$1(passage.text),
|
|
5817
5860
|
passage.text
|
|
5818
5861
|
]);
|
|
5819
5862
|
return searchable;
|
|
@@ -6701,6 +6744,34 @@ function propertyKeys(db) {
|
|
|
6701
6744
|
GROUP BY pr.key
|
|
6702
6745
|
ORDER BY documents DESC, pr.key_lc, pr.key`, [activeIndexGeneration(db)]);
|
|
6703
6746
|
}
|
|
6747
|
+
/**
|
|
6748
|
+
* Every [[Free Tag]] on a task in the graph, once ignoring case, most used first and then A–Z, each
|
|
6749
|
+
* in the spelling most tasks write it in: what the `#` helper offers. Read from the tasks' text at
|
|
6750
|
+
* each ask rather than kept in a table of its own. It runs in the worker, once per `#` typed, and
|
|
6751
|
+
* `tags_key` has already ruled out every task with no tag at all.
|
|
6752
|
+
*/
|
|
6753
|
+
function usedFreeTags(db) {
|
|
6754
|
+
const rows = db.all(`SELECT t.text FROM tasks t JOIN pages p ON p.id = t.page_id
|
|
6755
|
+
WHERE p.generation = ? AND t.tags_key <> ''`, [activeIndexGeneration(db)]);
|
|
6756
|
+
const spellingsByKey = /* @__PURE__ */ new Map();
|
|
6757
|
+
for (const { text } of rows) for (const tag of taskFreeTags(text)) {
|
|
6758
|
+
const key = tag.toLowerCase();
|
|
6759
|
+
const spellings = spellingsByKey.get(key) ?? /* @__PURE__ */ new Map();
|
|
6760
|
+
spellingsByKey.set(key, spellings.set(tag, (spellings.get(tag) ?? 0) + 1));
|
|
6761
|
+
}
|
|
6762
|
+
return [...spellingsByKey].map(([key, spellings]) => ({
|
|
6763
|
+
key,
|
|
6764
|
+
...mostUsedSpelling(spellings)
|
|
6765
|
+
})).sort((a, b) => b.total - a.total || a.key.localeCompare(b.key)).map((entry) => entry.spelling);
|
|
6766
|
+
}
|
|
6767
|
+
/** The spelling most tasks write, A–Z on a tie, and how many tasks write any of them. */
|
|
6768
|
+
function mostUsedSpelling(spellings) {
|
|
6769
|
+
const [[spelling]] = [...spellings].sort(([a, m], [b, n]) => n - m || a.localeCompare(b));
|
|
6770
|
+
return {
|
|
6771
|
+
spelling,
|
|
6772
|
+
total: [...spellings.values()].reduce((sum, n) => sum + n, 0)
|
|
6773
|
+
};
|
|
6774
|
+
}
|
|
6704
6775
|
/** The values `key` has across the graph, grouped ignoring case, most used first. */
|
|
6705
6776
|
function propertyValues(db, key, limit = 50) {
|
|
6706
6777
|
return db.all(`SELECT MIN(pr.value) AS value, COUNT(DISTINCT pr.page_id) AS documents
|
|
@@ -7453,7 +7524,7 @@ function cacheRoot(env) {
|
|
|
7453
7524
|
* recovered from a joined path (see there).
|
|
7454
7525
|
*/
|
|
7455
7526
|
var CACHE_FILE_NAME = `local-cache.v${CACHE_DB_VERSION}.bin`;
|
|
7456
|
-
var INDEX_FILE_NAME = `index.
|
|
7527
|
+
var INDEX_FILE_NAME = `index.v23.sqlite`;
|
|
7457
7528
|
var VECTORS_FILE_NAME = `vectors.v1.sqlite`;
|
|
7458
7529
|
function cacheFile(dir) {
|
|
7459
7530
|
return join(dir, CACHE_FILE_NAME);
|
|
@@ -8236,6 +8307,56 @@ async function findGraphByName(records, vault, wanted, readMeta) {
|
|
|
8236
8307
|
}
|
|
8237
8308
|
return null;
|
|
8238
8309
|
}
|
|
8310
|
+
// ../client/src/lib/document/ebook/ebook-state.ts
|
|
8311
|
+
/**
|
|
8312
|
+
* A place in an EBook. An element's id is part of one, and an id can hold spaces or quotes, so the shape is
|
|
8313
|
+
* checked and not the characters. It only ever goes back to the frame or into a percent-encoded link.
|
|
8314
|
+
*/
|
|
8315
|
+
var isEbookCfi = (value) => typeof value === "string" && value.length <= 2e3 && /^epubcfi\(\P{Cc}+\)$/u.test(value);
|
|
8316
|
+
var MAX_NAME$1 = 300;
|
|
8317
|
+
var isText$1 = (value) => typeof value === "string" && value !== "";
|
|
8318
|
+
var isHash = (value) => typeof value === "string" && /^[0-9a-f]{64}$/.test(value);
|
|
8319
|
+
var isFraction = (value) => typeof value === "number" && value >= 0 && value <= 1;
|
|
8320
|
+
var CHECKS = {
|
|
8321
|
+
id: isText$1,
|
|
8322
|
+
target: isText$1,
|
|
8323
|
+
name: isText$1,
|
|
8324
|
+
hash: isHash,
|
|
8325
|
+
cfi: isEbookCfi,
|
|
8326
|
+
fraction: isFraction,
|
|
8327
|
+
createdAt: (value) => typeof value === "number"
|
|
8328
|
+
};
|
|
8329
|
+
function sanitizeOne$1(raw) {
|
|
8330
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
8331
|
+
const r = raw;
|
|
8332
|
+
if (!Object.entries(CHECKS).every(([key, valid]) => valid(r[key]))) return null;
|
|
8333
|
+
const { id, hash, target, name, cfi, fraction, createdAt } = r;
|
|
8334
|
+
return {
|
|
8335
|
+
id,
|
|
8336
|
+
hash,
|
|
8337
|
+
target,
|
|
8338
|
+
name: name.slice(0, MAX_NAME$1),
|
|
8339
|
+
cfi,
|
|
8340
|
+
fraction,
|
|
8341
|
+
createdAt,
|
|
8342
|
+
...isText$1(r.chapter) ? { chapter: r.chapter.slice(0, MAX_NAME$1) } : {}
|
|
8343
|
+
};
|
|
8344
|
+
}
|
|
8345
|
+
/** Keep the well-formed entries, the first of each id. */
|
|
8346
|
+
function sanitizeEbookBookmarks(raw) {
|
|
8347
|
+
if (!Array.isArray(raw)) return [];
|
|
8348
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8349
|
+
const out = [];
|
|
8350
|
+
for (const entry of raw) {
|
|
8351
|
+
const clean = sanitizeOne$1(entry);
|
|
8352
|
+
if (clean && !seen.has(clean.id) && out.length < 2e3) {
|
|
8353
|
+
seen.add(clean.id);
|
|
8354
|
+
out.push(clean);
|
|
8355
|
+
}
|
|
8356
|
+
}
|
|
8357
|
+
return out;
|
|
8358
|
+
}
|
|
8359
|
+
Promise.resolve();
|
|
8239
8360
|
var MAX_NAME = 300;
|
|
8240
8361
|
var isText = (value) => typeof value === "string" && value !== "";
|
|
8241
8362
|
var isWhole = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
|
|
@@ -10332,7 +10453,9 @@ var MEMBER_LIST_KINDS = [
|
|
|
10332
10453
|
"bookmarks",
|
|
10333
10454
|
"memberFlags",
|
|
10334
10455
|
"pdfStates",
|
|
10335
|
-
"pdfBookmarks"
|
|
10456
|
+
"pdfBookmarks",
|
|
10457
|
+
"ebookStates",
|
|
10458
|
+
"ebookBookmarks"
|
|
10336
10459
|
];
|
|
10337
10460
|
/** Which Yjs type each kind is, so a type received but never asked for by name is read as the right one. */
|
|
10338
10461
|
var MEMBER_LIST_IS_ARRAY = {
|
|
@@ -10341,7 +10464,9 @@ var MEMBER_LIST_IS_ARRAY = {
|
|
|
10341
10464
|
bookmarks: false,
|
|
10342
10465
|
memberFlags: false,
|
|
10343
10466
|
pdfStates: false,
|
|
10344
|
-
pdfBookmarks: false
|
|
10467
|
+
pdfBookmarks: false,
|
|
10468
|
+
ebookStates: false,
|
|
10469
|
+
ebookBookmarks: false
|
|
10345
10470
|
};
|
|
10346
10471
|
/** `kind` and member key of a per-member type's name, or null for any other root-doc type. */
|
|
10347
10472
|
function memberListName(name) {
|
|
@@ -11495,6 +11620,35 @@ function createGraphSync(deps) {
|
|
|
11495
11620
|
}
|
|
11496
11621
|
};
|
|
11497
11622
|
},
|
|
11623
|
+
ebookBookmarks(member) {
|
|
11624
|
+
requireMemberKey(member, "ebookBookmarks");
|
|
11625
|
+
const map = root.doc.getMap(`ebookBookmarks:${member}`);
|
|
11626
|
+
return {
|
|
11627
|
+
list: () => sanitizeEbookBookmarks([...map.values()]),
|
|
11628
|
+
apply(change) {
|
|
11629
|
+
root.doc.transact(() => {
|
|
11630
|
+
for (const id of change.remove) map.delete(id);
|
|
11631
|
+
for (const bookmark of change.put) map.set(bookmark.id, bookmark);
|
|
11632
|
+
});
|
|
11633
|
+
},
|
|
11634
|
+
observe(listener) {
|
|
11635
|
+
map.observe(listener);
|
|
11636
|
+
return () => map.unobserve(listener);
|
|
11637
|
+
}
|
|
11638
|
+
};
|
|
11639
|
+
},
|
|
11640
|
+
ebookStateIndex(member) {
|
|
11641
|
+
const map = root.doc.getMap(`ebookStates:${member}`);
|
|
11642
|
+
return {
|
|
11643
|
+
hashes: () => [...map.keys()],
|
|
11644
|
+
add(hash) {
|
|
11645
|
+
if (!map.has(hash)) map.set(hash, Date.now());
|
|
11646
|
+
},
|
|
11647
|
+
remove(hash) {
|
|
11648
|
+
map.delete(hash);
|
|
11649
|
+
}
|
|
11650
|
+
};
|
|
11651
|
+
},
|
|
11498
11652
|
pdfStateIndex(member) {
|
|
11499
11653
|
const map = root.doc.getMap(`pdfStates:${member}`);
|
|
11500
11654
|
return {
|
|
@@ -12844,6 +12998,70 @@ async function listHostRecords(env) {
|
|
|
12844
12998
|
}
|
|
12845
12999
|
return found;
|
|
12846
13000
|
}
|
|
13001
|
+
// src/graph-connection.ts
|
|
13002
|
+
/**
|
|
13003
|
+
* Follow `source` for as long as it lives; a session clears its listeners when disposed. Only an
|
|
13004
|
+
* open socket counts as connected, so `connecting`, `reconnecting` and `ended` are all offline: in
|
|
13005
|
+
* each of them the copy has stopped following the Sync Server.
|
|
13006
|
+
*/
|
|
13007
|
+
function followConnection(source, options = {}) {
|
|
13008
|
+
const now = options.now ?? Date.now;
|
|
13009
|
+
let connected = source.activity().connection === "open";
|
|
13010
|
+
let everConnected = connected;
|
|
13011
|
+
let since = now();
|
|
13012
|
+
const describe = (activity) => {
|
|
13013
|
+
const at = new Date(since).toISOString();
|
|
13014
|
+
return connected ? {
|
|
13015
|
+
state: "connected",
|
|
13016
|
+
since: at
|
|
13017
|
+
} : {
|
|
13018
|
+
state: "offline",
|
|
13019
|
+
since: at,
|
|
13020
|
+
unsentDocuments: activity.unsentDocuments
|
|
13021
|
+
};
|
|
13022
|
+
};
|
|
13023
|
+
function observe(activity) {
|
|
13024
|
+
const connectedNow = activity.connection === "open";
|
|
13025
|
+
if (connectedNow !== connected) {
|
|
13026
|
+
const at = now();
|
|
13027
|
+
const offlineForMs = connectedNow && everConnected ? at - since : null;
|
|
13028
|
+
connected = connectedNow;
|
|
13029
|
+
everConnected ||= connectedNow;
|
|
13030
|
+
since = at;
|
|
13031
|
+
options.onChange?.({
|
|
13032
|
+
connection: describe(activity),
|
|
13033
|
+
offlineForMs
|
|
13034
|
+
});
|
|
13035
|
+
}
|
|
13036
|
+
return describe(activity);
|
|
13037
|
+
}
|
|
13038
|
+
source.onActivity(observe);
|
|
13039
|
+
return { current: () => observe(source.activity()) };
|
|
13040
|
+
}
|
|
13041
|
+
function plural(count, unit) {
|
|
13042
|
+
return `${count} ${unit}${count === 1 ? "" : "s"}`;
|
|
13043
|
+
}
|
|
13044
|
+
function durationWords(ms) {
|
|
13045
|
+
const minutes = Math.floor(ms / 6e4);
|
|
13046
|
+
if (minutes < 1) return "under a minute";
|
|
13047
|
+
if (minutes < 60) return plural(minutes, "minute");
|
|
13048
|
+
const hours = Math.floor(minutes / 60);
|
|
13049
|
+
return hours < 48 ? plural(hours, "hour") : plural(Math.floor(hours / 24), "day");
|
|
13050
|
+
}
|
|
13051
|
+
/** How the tools word the state, with the exact time and, in brackets, how long that is. */
|
|
13052
|
+
function offlineSince(connection, now = Date.now()) {
|
|
13053
|
+
return `offline from the Sync Server since ${connection.since} (${durationWords(now - Date.parse(connection.since))})`;
|
|
13054
|
+
}
|
|
13055
|
+
/** The note an answer carries while its copy is offline; null while connected and on a folder, which has no connection. */
|
|
13056
|
+
function offlineNotice(connection, now = Date.now()) {
|
|
13057
|
+
if (connection?.state !== "offline") return null;
|
|
13058
|
+
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.`;
|
|
13059
|
+
}
|
|
13060
|
+
/** One line for the host's log. */
|
|
13061
|
+
function connectionChangeLine(change) {
|
|
13062
|
+
if (change.connection.state === "offline") return "lost the connection to the Sync Server; the tools answer from this computer's copy.";
|
|
13063
|
+
return change.offlineForMs === null ? "connected to the Sync Server." : `connected to the Sync Server again, after ${durationWords(change.offlineForMs)} offline.`;
|
|
13064
|
+
}
|
|
12847
13065
|
// ../client/src/lib/document/publish/selection.ts
|
|
12848
13066
|
/**
|
|
12849
13067
|
* Which documents a [[Publication]] contains (ADR 0082). The one place the membership rule is
|
|
@@ -13645,7 +13863,7 @@ var files = /* #__PURE__ */ Object.assign({
|
|
|
13645
13863
|
"../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
13864
|
"../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
13865
|
"../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, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\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",
|
|
13866
|
+
"../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
13867
|
"../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
13868
|
"../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
13869
|
"../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 +13939,7 @@ var files = /* #__PURE__ */ Object.assign({
|
|
|
13721
13939
|
"../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
13940
|
"../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
13941
|
"../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, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\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",
|
|
13942
|
+
"../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
13943
|
"../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
13944
|
"../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
13945
|
"../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 +14197,7 @@ function httpsAddress(value) {
|
|
|
13979
14197
|
}
|
|
13980
14198
|
}
|
|
13981
14199
|
/** A positive, finite size, or undefined. */
|
|
13982
|
-
function size(value) {
|
|
14200
|
+
function size$1(value) {
|
|
13983
14201
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
13984
14202
|
}
|
|
13985
14203
|
/**
|
|
@@ -13994,8 +14212,8 @@ function checkedFenceAnswer(out) {
|
|
|
13994
14212
|
const kind = answer.kind;
|
|
13995
14213
|
if (kind === "picture") {
|
|
13996
14214
|
const { type, bytes, alt } = answer;
|
|
13997
|
-
const width = size(answer.width);
|
|
13998
|
-
const height = size(answer.height);
|
|
14215
|
+
const width = size$1(answer.width);
|
|
14216
|
+
const height = size$1(answer.height);
|
|
13999
14217
|
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
14218
|
if (width === void 0 || height === void 0) throw new Error("its picture has no size");
|
|
14001
14219
|
return {
|
|
@@ -14016,8 +14234,8 @@ function checkedFenceAnswer(out) {
|
|
|
14016
14234
|
if (image !== null && typeof image === "object") {
|
|
14017
14235
|
const { src: rawSrc, alt, width: rawWidth, height: rawHeight } = image;
|
|
14018
14236
|
const src = httpsAddress(rawSrc);
|
|
14019
|
-
const width = size(rawWidth);
|
|
14020
|
-
const height = size(rawHeight);
|
|
14237
|
+
const width = size$1(rawWidth);
|
|
14238
|
+
const height = size$1(rawHeight);
|
|
14021
14239
|
if (src) picture = {
|
|
14022
14240
|
src,
|
|
14023
14241
|
alt: String(alt ?? ""),
|
|
@@ -16579,7 +16797,7 @@ async function openDiagramRenderer(env) {
|
|
|
16579
16797
|
window.mermaid.initialize({
|
|
16580
16798
|
startOnLoad: false,
|
|
16581
16799
|
securityLevel: "strict",
|
|
16582
|
-
theme: "
|
|
16800
|
+
theme: "neutral"
|
|
16583
16801
|
});
|
|
16584
16802
|
});
|
|
16585
16803
|
return p;
|
|
@@ -16610,103 +16828,509 @@ async function openDiagramRenderer(env) {
|
|
|
16610
16828
|
}
|
|
16611
16829
|
};
|
|
16612
16830
|
}
|
|
16613
|
-
//
|
|
16614
|
-
var DRAWING_FENCE = "excalidraw.drawing";
|
|
16615
|
-
// src/page-server.ts
|
|
16831
|
+
// ../client/src/lib/storage/fs/asset-store.ts
|
|
16616
16832
|
/**
|
|
16617
|
-
*
|
|
16618
|
-
*
|
|
16619
|
-
*
|
|
16620
|
-
*
|
|
16833
|
+
* The **Asset store** over a {@link DirectoryAdapter}: uploads land as binary files
|
|
16834
|
+
* under `assets/`, named `kebab-stem.<contenthash>.ext` (DESIGN.md → On-disk layout).
|
|
16835
|
+
* Identical bytes de-duplicate to one file **by content and extension alone** - the stem is
|
|
16836
|
+
* display, not identity - so the same file added again under a different name references the
|
|
16837
|
+
* one already stored rather than writing a second copy. Built on the same File-System seam as
|
|
16838
|
+
* {@link createFilesystemDocumentStore}, so the pure naming/dedup logic is Node-testable
|
|
16839
|
+
* over the in-memory adapter before any browser code runs.
|
|
16840
|
+
*
|
|
16841
|
+
* Assets are referenced from documents by a relative path — `../assets/<name>` — which
|
|
16842
|
+
* resolves from any journal entry or page (both sit one level under the graph root,
|
|
16843
|
+
* the Logseq convention). `resolve` reads those bytes back and hands out an object URL plus
|
|
16844
|
+
* the name and MIME type a download or a viewer needs; the URLs are cached per asset and
|
|
16845
|
+
* revoked on {@link AssetStore.dispose}.
|
|
16846
|
+
*
|
|
16847
|
+
* Remote (S3) upload and per-graph access control are deferred (DESIGN.md → Server
|
|
16848
|
+
* Backend); this is the Filesystem Backend path only.
|
|
16621
16849
|
*/
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
"
|
|
16625
|
-
"
|
|
16626
|
-
"
|
|
16850
|
+
/** Extensions rendered inline as images (everything else renders as a download link). */
|
|
16851
|
+
var IMAGE_EXTS = /* @__PURE__ */ new Set([
|
|
16852
|
+
"png",
|
|
16853
|
+
"jpg",
|
|
16854
|
+
"jpeg",
|
|
16855
|
+
"gif",
|
|
16856
|
+
"webp",
|
|
16857
|
+
"svg",
|
|
16858
|
+
"avif",
|
|
16859
|
+
"bmp"
|
|
16860
|
+
]);
|
|
16861
|
+
/** A doc-relative asset reference: optional `../` hops, then `assets/<name>`. */
|
|
16862
|
+
var ASSET_REF = /^(?:\.\.\/)*assets\/(.+)$/;
|
|
16863
|
+
/**
|
|
16864
|
+
* An asset could not be fetched just now: the connection failed, or the server answered with a
|
|
16865
|
+
* status that means "try again". It says nothing about whether the file exists, so something
|
|
16866
|
+
* showing the file asks again rather than calling it missing. `status` is the server's answer,
|
|
16867
|
+
* absent when the connection failed before there was one.
|
|
16868
|
+
*/
|
|
16869
|
+
var AssetUnavailableError = class extends Error {
|
|
16870
|
+
name = "AssetUnavailableError";
|
|
16871
|
+
status;
|
|
16872
|
+
constructor(message, options = {}) {
|
|
16873
|
+
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
16874
|
+
this.status = options.status;
|
|
16875
|
+
}
|
|
16627
16876
|
};
|
|
16628
|
-
/**
|
|
16629
|
-
|
|
16630
|
-
|
|
16631
|
-
|
|
16632
|
-
|
|
16633
|
-
|
|
16634
|
-
|
|
16635
|
-
|
|
16636
|
-
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
}
|
|
16641
|
-
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
|
|
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.");
|
|
16877
|
+
/**
|
|
16878
|
+
* An asset arrived, but not as it was stored: the server offered a different number of chunks than
|
|
16879
|
+
* its encrypted metadata records, or the joined bytes do not match the size or hash recorded there.
|
|
16880
|
+
* Each chunk is authenticated on its own, so this is what catches a file cut short, or a reuse
|
|
16881
|
+
* answer that points at a different file (ADR 0027, amended 2026-10-05). The bytes are never
|
|
16882
|
+
* handed over. Distinct from a missing file (`null`), which is gone, and from an unavailable one,
|
|
16883
|
+
* which may come good by itself.
|
|
16884
|
+
*/
|
|
16885
|
+
var AssetIntegrityError = class extends Error {
|
|
16886
|
+
name = "AssetIntegrityError";
|
|
16887
|
+
constructor(message = "This file did not arrive complete, so it was not opened. Try again in a moment.") {
|
|
16888
|
+
super(message);
|
|
16889
|
+
}
|
|
16890
|
+
};
|
|
16891
|
+
/** Split a file name into its stem and lower-cased extension (`''` ext when there is none). */
|
|
16892
|
+
function splitNameExt(fileName) {
|
|
16893
|
+
const dot = fileName.lastIndexOf(".");
|
|
16894
|
+
if (dot <= 0) return {
|
|
16895
|
+
stem: fileName,
|
|
16896
|
+
ext: ""
|
|
16897
|
+
};
|
|
16662
16898
|
return {
|
|
16663
|
-
|
|
16664
|
-
|
|
16899
|
+
stem: fileName.slice(0, dot),
|
|
16900
|
+
ext: fileName.slice(dot + 1).toLowerCase()
|
|
16665
16901
|
};
|
|
16666
16902
|
}
|
|
16667
|
-
|
|
16903
|
+
/** True when `ext` (with or without a leading dot) names an inline-rendered image format. */
|
|
16904
|
+
function isImageExt(ext) {
|
|
16905
|
+
return IMAGE_EXTS.has(ext.replace(/^\./, "").toLowerCase());
|
|
16906
|
+
}
|
|
16907
|
+
/** The on-disk asset name: `kebab-stem.<hash>.ext` (stem falls back to `asset` when slugging empties it). */
|
|
16908
|
+
function assetFileName(originalName, hash) {
|
|
16909
|
+
const { stem, ext } = splitNameExt(originalName);
|
|
16910
|
+
const slug = publishSlug(stem) || "asset";
|
|
16911
|
+
return ext ? `${slug}.${hash}.${ext}` : `${slug}.${hash}`;
|
|
16912
|
+
}
|
|
16913
|
+
/** The de-duplication key: content plus extension. The stem is display, not identity. */
|
|
16914
|
+
function contentKey(hash, ext) {
|
|
16915
|
+
return `${hash}.${ext}`;
|
|
16916
|
+
}
|
|
16668
16917
|
/**
|
|
16669
|
-
*
|
|
16670
|
-
*
|
|
16671
|
-
*
|
|
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).
|
|
16918
|
+
* An on-disk asset name with its content hash taken back out — `q3-report.a1b2c3d4.pdf` reads as
|
|
16919
|
+
* `q3-report.pdf`. What a download is called and what titles an asset tab, so neither shows a
|
|
16920
|
+
* user a hash they never typed. A name this store did not write is returned unchanged.
|
|
16677
16921
|
*/
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
return
|
|
16922
|
+
function displayAssetName(fileName) {
|
|
16923
|
+
const parsed = assetHashFromName(fileName);
|
|
16924
|
+
if (!parsed) return fileName;
|
|
16925
|
+
const stem = fileName.slice(0, fileName.length - `.${parsed.hash}`.length - (parsed.ext ? parsed.ext.length + 1 : 0));
|
|
16926
|
+
return parsed.ext ? `${stem}.${parsed.ext}` : stem;
|
|
16683
16927
|
}
|
|
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>`;
|
|
16688
16928
|
/**
|
|
16689
|
-
*
|
|
16690
|
-
*
|
|
16929
|
+
* MIME types for the formats the app itself renders, plus the handful a browser needs told about
|
|
16930
|
+
* to do anything sensible with a download. Deliberately small and deliberately **empty for
|
|
16931
|
+
* anything else**: a wrong type is worse than none, because a wrong one is acted on. The
|
|
16932
|
+
* Filesystem Backend has nowhere else to learn a type from — unlike the Server Backend, which
|
|
16933
|
+
* carries the uploader's own MIME type inside the encrypted asset metadata.
|
|
16691
16934
|
*/
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16935
|
+
var MIME_TYPES = {
|
|
16936
|
+
png: "image/png",
|
|
16937
|
+
jpg: "image/jpeg",
|
|
16938
|
+
jpeg: "image/jpeg",
|
|
16939
|
+
gif: "image/gif",
|
|
16940
|
+
webp: "image/webp",
|
|
16941
|
+
svg: "image/svg+xml",
|
|
16942
|
+
avif: "image/avif",
|
|
16943
|
+
bmp: "image/bmp",
|
|
16944
|
+
pdf: "application/pdf",
|
|
16945
|
+
epub: "application/epub+zip",
|
|
16946
|
+
txt: "text/plain",
|
|
16947
|
+
csv: "text/csv",
|
|
16948
|
+
json: "application/json",
|
|
16949
|
+
md: "text/markdown",
|
|
16950
|
+
mp3: "audio/mpeg",
|
|
16951
|
+
mp4: "video/mp4",
|
|
16952
|
+
webm: "video/webm",
|
|
16953
|
+
zip: "application/zip"
|
|
16954
|
+
};
|
|
16955
|
+
/** The MIME type for a file extension (with or without a leading dot), or `''` when unknown. */
|
|
16956
|
+
function mimeTypeForExt(ext) {
|
|
16957
|
+
return MIME_TYPES[ext.replace(/^\./, "").toLowerCase()] ?? "";
|
|
16958
|
+
}
|
|
16959
|
+
/**
|
|
16960
|
+
* The on-disk name referenced by a doc-relative asset ref, or `null` if `ref` is not an asset
|
|
16961
|
+
* reference. A reference whose name decodes to anything but one file inside `assets/`, or does not
|
|
16962
|
+
* decode at all, is not one: it can never name a file on disk (see `isSafeAssetName`).
|
|
16963
|
+
*/
|
|
16964
|
+
function assetNameFromRef(ref) {
|
|
16965
|
+
const clean = ref.split(/[?#]/)[0];
|
|
16966
|
+
const match = ASSET_REF.exec(clean);
|
|
16967
|
+
if (!match) return null;
|
|
16968
|
+
let name;
|
|
16969
|
+
try {
|
|
16970
|
+
name = decodeURIComponent(match[1]);
|
|
16971
|
+
} catch {
|
|
16972
|
+
return null;
|
|
16973
|
+
}
|
|
16974
|
+
return isSafeAssetName(name) ? name : null;
|
|
16975
|
+
}
|
|
16976
|
+
/**
|
|
16977
|
+
* The markdown to embed a saved asset: an inline image, or a plain link that downloads on click.
|
|
16978
|
+
* For an image, an optional `displaySize` (e.g. `300` or `300x200`) is added as a `|` display-size
|
|
16979
|
+
* hint; the caller is responsible for passing a valid spec (see `normalizeDisplaySize`).
|
|
16980
|
+
*/
|
|
16981
|
+
function buildAssetMarkdown(asset, displaySize) {
|
|
16982
|
+
if (!asset.isImage) return `[${asset.stem}](${asset.ref})`;
|
|
16983
|
+
return ``;
|
|
16984
|
+
}
|
|
16985
|
+
/** First 8 hex chars of the SHA-256 of the bytes — the content hash in the asset name. */
|
|
16986
|
+
async function contentHash(bytes) {
|
|
16987
|
+
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
16988
|
+
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, 8);
|
|
16989
|
+
}
|
|
16990
|
+
function createAssetStore(adapter) {
|
|
16991
|
+
const urlCache = /* @__PURE__ */ new Map();
|
|
16992
|
+
/**
|
|
16993
|
+
* Content key → the on-disk name already holding those bytes. Built from `assets/` on the
|
|
16994
|
+
* first save (so a store that only ever resolves never pays for the listing) and maintained
|
|
16995
|
+
* on every write after that.
|
|
16996
|
+
*
|
|
16997
|
+
* This is what keeps the [[Asset]] guarantee honest on this backend: identity is content,
|
|
16998
|
+
* not the name it was added under. Keying the write on the whole file name instead — which
|
|
16999
|
+
* is what this did before — stored the same bytes twice whenever the stem differed.
|
|
17000
|
+
*/
|
|
17001
|
+
let contentIndex;
|
|
17002
|
+
async function assetsByContent() {
|
|
17003
|
+
if (contentIndex) return contentIndex;
|
|
17004
|
+
const index = /* @__PURE__ */ new Map();
|
|
17005
|
+
for (const { name } of await adapter.list("assets")) {
|
|
17006
|
+
const parsed = assetHashFromName(name);
|
|
17007
|
+
if (parsed && !index.has(contentKey(parsed.hash, parsed.ext))) index.set(contentKey(parsed.hash, parsed.ext), name);
|
|
17008
|
+
}
|
|
17009
|
+
contentIndex = index;
|
|
17010
|
+
return index;
|
|
17011
|
+
}
|
|
17012
|
+
return {
|
|
17013
|
+
async save({ name, bytes }, onBytes) {
|
|
17014
|
+
const hash = await contentHash(bytes);
|
|
17015
|
+
const { stem, ext } = splitNameExt(name);
|
|
17016
|
+
const index = await assetsByContent();
|
|
17017
|
+
const key = contentKey(hash, ext);
|
|
17018
|
+
const existing = index.get(key);
|
|
17019
|
+
const fileName = existing ?? assetFileName(name, hash);
|
|
17020
|
+
if (!existing) {
|
|
17021
|
+
await adapter.writeBinary("assets", fileName, bytes);
|
|
17022
|
+
index.set(key, fileName);
|
|
17023
|
+
}
|
|
17024
|
+
onBytes?.(bytes.length);
|
|
17025
|
+
return {
|
|
17026
|
+
ref: `../assets/${fileName}`,
|
|
17027
|
+
name: fileName,
|
|
17028
|
+
stem: publishSlug(stem) || "asset",
|
|
17029
|
+
isImage: isImageExt(ext),
|
|
17030
|
+
...existing ? { reused: true } : {}
|
|
17031
|
+
};
|
|
17032
|
+
},
|
|
17033
|
+
async readBytes(ref) {
|
|
17034
|
+
const assetName = assetNameFromRef(ref);
|
|
17035
|
+
if (!assetName) return null;
|
|
17036
|
+
const { ext } = splitNameExt(assetName);
|
|
17037
|
+
try {
|
|
17038
|
+
const { bytes } = await adapter.readBinary("assets", assetName);
|
|
17039
|
+
return {
|
|
17040
|
+
bytes,
|
|
17041
|
+
name: displayAssetName(assetName),
|
|
17042
|
+
type: mimeTypeForExt(ext)
|
|
17043
|
+
};
|
|
17044
|
+
} catch {
|
|
17045
|
+
return null;
|
|
17046
|
+
}
|
|
17047
|
+
},
|
|
17048
|
+
async resolve(ref) {
|
|
17049
|
+
const assetName = assetNameFromRef(ref);
|
|
17050
|
+
if (!assetName) return null;
|
|
17051
|
+
const { ext } = splitNameExt(assetName);
|
|
17052
|
+
const meta = {
|
|
17053
|
+
name: displayAssetName(assetName),
|
|
17054
|
+
type: mimeTypeForExt(ext)
|
|
17055
|
+
};
|
|
17056
|
+
const cached = urlCache.get(assetName);
|
|
17057
|
+
if (cached) return {
|
|
17058
|
+
url: cached,
|
|
17059
|
+
...meta
|
|
17060
|
+
};
|
|
17061
|
+
let content;
|
|
17062
|
+
try {
|
|
17063
|
+
content = await adapter.readBinary("assets", assetName);
|
|
17064
|
+
} catch {
|
|
17065
|
+
return null;
|
|
17066
|
+
}
|
|
17067
|
+
const url = URL.createObjectURL(new Blob([content.bytes], meta.type ? { type: meta.type } : {}));
|
|
17068
|
+
urlCache.set(assetName, url);
|
|
17069
|
+
return {
|
|
17070
|
+
url,
|
|
17071
|
+
...meta
|
|
17072
|
+
};
|
|
17073
|
+
},
|
|
17074
|
+
dispose() {
|
|
17075
|
+
for (const url of urlCache.values()) URL.revokeObjectURL(url);
|
|
17076
|
+
urlCache.clear();
|
|
17077
|
+
},
|
|
17078
|
+
renamed(from, to) {
|
|
17079
|
+
const url = urlCache.get(from);
|
|
17080
|
+
if (url) URL.revokeObjectURL(url);
|
|
17081
|
+
urlCache.delete(from);
|
|
17082
|
+
const parsed = assetHashFromName(to);
|
|
17083
|
+
if (parsed) contentIndex?.set(contentKey(parsed.hash, parsed.ext), to);
|
|
17084
|
+
}
|
|
17085
|
+
};
|
|
17086
|
+
}
|
|
17087
|
+
// ../../extensions/excalidraw/src/format.ts
|
|
17088
|
+
var DRAWING_FENCE = "excalidraw.drawing";
|
|
17089
|
+
var HEADER_TYPE = "excalidraw.drawing";
|
|
17090
|
+
/** Every JSON object written on one line that parses, in order, with where it is. */
|
|
17091
|
+
function spansOnLine(line) {
|
|
17092
|
+
const out = [];
|
|
17093
|
+
let depth = 0;
|
|
17094
|
+
let start = -1;
|
|
17095
|
+
let inString = false;
|
|
17096
|
+
let escaped = false;
|
|
17097
|
+
for (let i = 0; i < line.length; i++) {
|
|
17098
|
+
const ch = line[i];
|
|
17099
|
+
if (inString) {
|
|
17100
|
+
if (escaped) escaped = false;
|
|
17101
|
+
else if (ch === "\\") escaped = true;
|
|
17102
|
+
else if (ch === "\"") inString = false;
|
|
17103
|
+
continue;
|
|
17104
|
+
}
|
|
17105
|
+
if (ch === "\"") inString = true;
|
|
17106
|
+
else if (ch === "{") {
|
|
17107
|
+
if (depth === 0) start = i;
|
|
17108
|
+
depth++;
|
|
17109
|
+
} else if (ch === "}" && depth > 0) {
|
|
17110
|
+
depth--;
|
|
17111
|
+
if (depth === 0 && start !== -1) {
|
|
17112
|
+
try {
|
|
17113
|
+
out.push({
|
|
17114
|
+
start,
|
|
17115
|
+
end: i + 1,
|
|
17116
|
+
value: JSON.parse(line.slice(start, i + 1))
|
|
17117
|
+
});
|
|
17118
|
+
} catch {}
|
|
17119
|
+
start = -1;
|
|
17120
|
+
}
|
|
17121
|
+
}
|
|
17122
|
+
}
|
|
17123
|
+
return out;
|
|
17124
|
+
}
|
|
17125
|
+
/** Every JSON object written on one line, in order: one, or several where a merge joined lines. */
|
|
17126
|
+
function objectsOnLine(line) {
|
|
17127
|
+
return spansOnLine(line).map((span) => span.value);
|
|
17128
|
+
}
|
|
17129
|
+
function isElement(value) {
|
|
17130
|
+
if (!value || typeof value !== "object") return false;
|
|
17131
|
+
const record = value;
|
|
17132
|
+
return typeof record.id === "string" && typeof record.type === "string" && typeof record.version === "number";
|
|
17133
|
+
}
|
|
17134
|
+
function isHeader(value) {
|
|
17135
|
+
return !!value && typeof value === "object" && value.type === HEADER_TYPE && typeof value.id === "string";
|
|
17136
|
+
}
|
|
17137
|
+
/** Whether a line's object is a shape in skeleton form: a `type`, not the drawing's own, and no `version`. */
|
|
17138
|
+
function isSkeleton(value) {
|
|
17139
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
17140
|
+
const record = value;
|
|
17141
|
+
return typeof record.type === "string" && record.type !== HEADER_TYPE && record.version === void 0 && record.isDeleted !== true;
|
|
17142
|
+
}
|
|
17143
|
+
/** Whether `a` is the later of two versions of one element, by Excalidraw's own rule. */
|
|
17144
|
+
function later(a, b) {
|
|
17145
|
+
if (a.version !== b.version) return a.version > b.version;
|
|
17146
|
+
return (a.versionNonce ?? 0) <= (b.versionNonce ?? 0);
|
|
17147
|
+
}
|
|
17148
|
+
/** Elements in their stacking order: by `index`, then by id, so every device draws them alike. */
|
|
17149
|
+
function byStackingOrder(elements) {
|
|
17150
|
+
return elements.sort((a, b) => {
|
|
17151
|
+
const ai = a.index ?? "";
|
|
17152
|
+
const bi = b.index ?? "";
|
|
17153
|
+
if (ai !== bi) return ai < bi ? -1 : 1;
|
|
17154
|
+
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
17155
|
+
});
|
|
17156
|
+
}
|
|
17157
|
+
/** The reference an image names its Asset by, or null for an image with none and anything else. */
|
|
17158
|
+
function imageAsset(element) {
|
|
17159
|
+
if (element.type !== "image") return null;
|
|
17160
|
+
const asset = element.customData?.asset;
|
|
17161
|
+
return typeof asset === "string" && asset !== "" ? asset : null;
|
|
17162
|
+
}
|
|
17163
|
+
/**
|
|
17164
|
+
* The file id of an image known only by its reference: the same on every device, in letters, digits
|
|
17165
|
+
* and hyphens, since an SVG picture names the image's element by it. Two hashes, so two images in a
|
|
17166
|
+
* drawing cannot plausibly share one.
|
|
17167
|
+
*/
|
|
17168
|
+
function imageFileId(ref) {
|
|
17169
|
+
return `asset-${hashText(ref)}-${hashText(`${ref}#`)}`;
|
|
17170
|
+
}
|
|
17171
|
+
/** An image with no file id gets the one its reference makes, so a line an older Client converted still draws. */
|
|
17172
|
+
function withFileIdFromAsset(element) {
|
|
17173
|
+
const asset = imageAsset(element);
|
|
17174
|
+
return asset && !element.fileId ? {
|
|
17175
|
+
...element,
|
|
17176
|
+
fileId: imageFileId(asset)
|
|
17177
|
+
} : element;
|
|
17178
|
+
}
|
|
17179
|
+
/** A drawing read from its fence's body. */
|
|
17180
|
+
function readDrawing(body) {
|
|
17181
|
+
const first = body[0] ? objectsOnLine(body[0])[0] : void 0;
|
|
17182
|
+
const header = isHeader(first) ? {
|
|
17183
|
+
type: HEADER_TYPE,
|
|
17184
|
+
version: 1,
|
|
17185
|
+
id: first.id,
|
|
17186
|
+
...typeof first.background === "string" ? { background: first.background } : {}
|
|
17187
|
+
} : null;
|
|
17188
|
+
const byId = /* @__PURE__ */ new Map();
|
|
17189
|
+
const skeletons = [];
|
|
17190
|
+
body.forEach((line, n) => {
|
|
17191
|
+
if (n === 0 && header) return;
|
|
17192
|
+
for (const value of objectsOnLine(line)) {
|
|
17193
|
+
if (isSkeleton(value)) skeletons.push(value);
|
|
17194
|
+
if (!isElement(value) || value.isDeleted) continue;
|
|
17195
|
+
const known = byId.get(value.id);
|
|
17196
|
+
if (!known || later(value, known)) byId.set(value.id, withFileIdFromAsset(value));
|
|
17197
|
+
}
|
|
17198
|
+
});
|
|
17199
|
+
return {
|
|
17200
|
+
header,
|
|
17201
|
+
elements: byStackingOrder([...byId.values()]),
|
|
17202
|
+
skeletons
|
|
17203
|
+
};
|
|
17204
|
+
}
|
|
17205
|
+
/**
|
|
17206
|
+
* Each image's reference a body holds, written by hand or not, for whatever has to read them all
|
|
17207
|
+
* before it can draw them.
|
|
17208
|
+
*/
|
|
17209
|
+
function imageReferences(body) {
|
|
17210
|
+
const { elements, skeletons } = readDrawing(body);
|
|
17211
|
+
return [...new Set([...elements, ...skeletons].flatMap((element) => imageAsset(element) ?? []))];
|
|
17212
|
+
}
|
|
17213
|
+
/** A short, stable hash of some text, in letters and digits (FNV-1a). */
|
|
17214
|
+
function hashText(text) {
|
|
17215
|
+
let hash = 2166136261;
|
|
17216
|
+
for (let i = 0; i < text.length; i++) {
|
|
17217
|
+
hash ^= text.charCodeAt(i);
|
|
17218
|
+
hash = Math.imul(hash, 16777619);
|
|
17219
|
+
}
|
|
17220
|
+
return (hash >>> 0).toString(36);
|
|
17221
|
+
}
|
|
17222
|
+
// src/page-server.ts
|
|
17223
|
+
/**
|
|
17224
|
+
* A server for the pages the Headless Client draws pictures in (map-pictures.ts,
|
|
17225
|
+
* drawing-pictures.ts): on the loopback address, answering one page and the files named to it and
|
|
17226
|
+
* nothing else, so a page's workers, chunks and fonts load over http as they do in the Client. Open
|
|
17227
|
+
* only for a publish that draws something.
|
|
17228
|
+
*/
|
|
17229
|
+
var TYPES = {
|
|
17230
|
+
".js": "text/javascript; charset=utf-8",
|
|
17231
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
17232
|
+
".css": "text/css; charset=utf-8",
|
|
17233
|
+
".woff2": "font/woff2"
|
|
17234
|
+
};
|
|
17235
|
+
/** A file built beside this module in the published package (dist/), or in dist/ when run from source. */
|
|
17236
|
+
function builtPath(...path) {
|
|
17237
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
17238
|
+
return here.endsWith("dist") ? join(here, ...path) : join(here, "..", "dist", ...path);
|
|
17239
|
+
}
|
|
17240
|
+
/** Every file under `folder`, by the path a page asks for it at. Empty when the folder is missing. */
|
|
17241
|
+
async function filesUnder$1(folder) {
|
|
17242
|
+
const files = (await readdir(folder, {
|
|
17243
|
+
recursive: true,
|
|
17244
|
+
withFileTypes: true
|
|
17245
|
+
}).catch(() => [])).filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name));
|
|
17246
|
+
return new Map(files.map((file) => [`/${relative(folder, file).split(sep).join("/")}`, file]));
|
|
17247
|
+
}
|
|
17248
|
+
/** The server: `html` at `/page.html`, and each of `files` at its path. */
|
|
17249
|
+
async function servePage(html, files) {
|
|
17250
|
+
const server = createServer$1((request, response) => {
|
|
17251
|
+
const path = new URL(request.url ?? "/", "http://localhost").pathname;
|
|
17252
|
+
if (path === "/page.html") {
|
|
17253
|
+
response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }).end(html);
|
|
17254
|
+
return;
|
|
17255
|
+
}
|
|
17256
|
+
const file = files.get(path);
|
|
17257
|
+
if (!file) {
|
|
17258
|
+
response.writeHead(404).end();
|
|
17259
|
+
return;
|
|
17260
|
+
}
|
|
17261
|
+
readFile(file).then((bytes) => response.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" }).end(bytes), () => response.writeHead(404).end());
|
|
17262
|
+
});
|
|
17263
|
+
await new Promise((resolve, reject) => {
|
|
17264
|
+
server.once("error", reject);
|
|
17265
|
+
server.listen(0, "127.0.0.1", () => resolve());
|
|
17266
|
+
});
|
|
17267
|
+
const address = server.address();
|
|
17268
|
+
if (!address || typeof address === "string") throw new Error("The page server has no port.");
|
|
17269
|
+
return {
|
|
17270
|
+
server,
|
|
17271
|
+
origin: `http://127.0.0.1:${address.port}`
|
|
17272
|
+
};
|
|
17273
|
+
}
|
|
17274
|
+
// src/drawing-pictures.ts
|
|
17275
|
+
/**
|
|
17276
|
+
* Drawing pictures for a publish from the Headless Client (ADR 0175): a [[Drawing]] is published as
|
|
17277
|
+
* a picture, never as its lines, and the picture is drawn in a real Chromium, the one Mermaid
|
|
17278
|
+
* diagrams use (diagrams.ts), because Excalidraw's export needs a page to measure text and load
|
|
17279
|
+
* fonts in. No page of this kind can reach the graph, so the images a drawing names are read here and
|
|
17280
|
+
* handed in, as a publish reads any other asset.
|
|
17281
|
+
*
|
|
17282
|
+
* The page runs the Excalidraw extension's own code (`drawing-page/`, built from
|
|
17283
|
+
* `src/drawing-picture-page.ts` beside the Node bundle), and is served, with Excalidraw's chunks and
|
|
17284
|
+
* fonts, from a server on the loopback address (page-server.ts).
|
|
17285
|
+
*/
|
|
17286
|
+
/** Whether a publish of these bodies draws a drawing: a fenced block whose info string is the drawing fence's. */
|
|
17287
|
+
function needsDrawings(bodies) {
|
|
17288
|
+
const fence = new RegExp(`^\\s*(?:-\\s+)?\`{3,}${DRAWING_FENCE.replace(".", "\\.")}\\s*$`, "m");
|
|
17289
|
+
for (const body of bodies) if (fence.test(body)) return true;
|
|
17290
|
+
return false;
|
|
17291
|
+
}
|
|
17292
|
+
var PAGE$1 = `<!doctype html>
|
|
17293
|
+
<html><head><meta charset="utf-8">
|
|
17294
|
+
<script type="module" src="/drawing-picture-page.js"><\/script>
|
|
17295
|
+
</head><body></body></html>`;
|
|
17296
|
+
/**
|
|
17297
|
+
* The images a drawing names, as data URLs by reference, leaving out any that cannot be read. Its type
|
|
17298
|
+
* comes from its name, since a data URL drawn in the picture must not say anything but an image.
|
|
17299
|
+
*/
|
|
17300
|
+
async function drawingImages(body, readAsset) {
|
|
17301
|
+
const images = {};
|
|
17302
|
+
for (const ref of imageReferences(body)) {
|
|
17303
|
+
const type = mimeTypeForExt(splitNameExt(assetNameFromRef(ref) ?? "").ext);
|
|
17304
|
+
if (!type.startsWith("image/")) continue;
|
|
17305
|
+
const asset = await readAsset(ref).catch(() => null);
|
|
17306
|
+
if (asset) images[ref] = `data:${type};base64,${Buffer$1.from(asset.bytes).toString("base64")}`;
|
|
17307
|
+
}
|
|
17308
|
+
return images;
|
|
17309
|
+
}
|
|
17310
|
+
/**
|
|
17311
|
+
* A renderer over one headless browser, opened for a publish and closed after it. Null when no
|
|
17312
|
+
* browser is available; the caller decides what that means (a publish with drawings refuses).
|
|
17313
|
+
*/
|
|
17314
|
+
async function openDrawingRenderer(env, readAsset) {
|
|
17315
|
+
const browser = await launchChromium(env);
|
|
17316
|
+
if (!browser) return null;
|
|
17317
|
+
let served = null;
|
|
17318
|
+
let pagePromise;
|
|
17319
|
+
const page = () => {
|
|
17320
|
+
pagePromise ??= (async () => {
|
|
17321
|
+
served = await servePage(PAGE$1, await filesUnder$1(builtPath("drawing-page")));
|
|
17322
|
+
const p = await (await browser.newContext()).newPage();
|
|
17323
|
+
await p.goto(`${served.origin}/page.html`);
|
|
17324
|
+
await p.waitForFunction(() => typeof window.etherpkDrawDrawingPicture === "function", void 0, { timeout: 15e3 });
|
|
17325
|
+
return p;
|
|
17326
|
+
})();
|
|
16705
17327
|
return pagePromise;
|
|
16706
17328
|
};
|
|
16707
17329
|
return {
|
|
16708
17330
|
async render(body) {
|
|
16709
|
-
const
|
|
17331
|
+
const p = await page();
|
|
17332
|
+
const images = await drawingImages(body, readAsset);
|
|
17333
|
+
const drawn = await p.evaluate(([lines, held]) => window.etherpkDrawDrawingPicture(lines, held), [[...body], images]);
|
|
16710
17334
|
if (drawn === null) return null;
|
|
16711
17335
|
return {
|
|
16712
17336
|
kind: "picture",
|
|
@@ -17543,308 +18167,53 @@ var DocumentUnconfirmedError = class extends Error {
|
|
|
17543
18167
|
* could be confirmed: a graph with half its links rewritten is worse than one with none, and
|
|
17544
18168
|
* the second attempt, once sync has caught up, costs nothing.
|
|
17545
18169
|
*/
|
|
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.
|
|
17697
|
-
*/
|
|
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"
|
|
18170
|
+
var RenameUnconfirmedError = class extends Error {
|
|
18171
|
+
concepts;
|
|
18172
|
+
name = "RenameUnconfirmedError";
|
|
18173
|
+
constructor(concepts) {
|
|
18174
|
+
const list = concepts.slice(0, 5).join(", ") + (concepts.length > 5 ? "…" : "");
|
|
18175
|
+
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.`);
|
|
18176
|
+
this.concepts = concepts;
|
|
18177
|
+
}
|
|
17716
18178
|
};
|
|
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
18179
|
/**
|
|
17722
|
-
*
|
|
17723
|
-
*
|
|
17724
|
-
*
|
|
18180
|
+
* Why a rename was refused, as a user-facing message, or null when it may proceed.
|
|
18181
|
+
* Shared so both backends refuse identically.
|
|
18182
|
+
*
|
|
18183
|
+
* A [[Journal Entry]] is refused because its concept *is* its date and there is exactly one
|
|
18184
|
+
* per day; renaming it would break that invariant rather than express anything. A
|
|
18185
|
+
* journal-shaped [[Pageless Concept]] (a day nobody has written yet) is refused for the same
|
|
18186
|
+
* reason: its name is its day whether or not the entry exists.
|
|
18187
|
+
*
|
|
18188
|
+
* The same holds in the other direction: a page renamed TO a day is refused, rather than left
|
|
18189
|
+
* in `pages/` answering to the day or merged into its journal entry with a `title` block the
|
|
18190
|
+
* entry never carries (ADR 0056).
|
|
18191
|
+
*
|
|
18192
|
+
* A collision is NOT a refusal (ADR 0038 §4): it is a [[Merge]], confirmed in the dialog.
|
|
17725
18193
|
*/
|
|
17726
|
-
function
|
|
17727
|
-
const
|
|
17728
|
-
|
|
17729
|
-
if (
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
|
|
17736
|
-
return isSafeAssetName(name) ? name : null;
|
|
18194
|
+
function renameRefusal(options) {
|
|
18195
|
+
const to = options.to.trim();
|
|
18196
|
+
if (to === "") return "A page needs a non-empty name.";
|
|
18197
|
+
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.";
|
|
18198
|
+
if (options.kind === "page" && isJournalConcept(to)) return dayIsNotAPageName(to);
|
|
18199
|
+
return null;
|
|
18200
|
+
}
|
|
18201
|
+
/** Every step, direct first - what an applier iterates. */
|
|
18202
|
+
function renameSteps(plan) {
|
|
18203
|
+
return [plan.direct, ...plan.cascade];
|
|
17737
18204
|
}
|
|
17738
18205
|
/**
|
|
17739
|
-
* The
|
|
17740
|
-
*
|
|
17741
|
-
*
|
|
18206
|
+
* The name a document called `concept` before the rename goes by after it: where a title step
|
|
18207
|
+
* lands it (its `into`, a merge's survivor included), or the same name when no step moves it.
|
|
18208
|
+
* How a holder of an alias the rename rewrites is found, and named in what the rename reports.
|
|
17742
18209
|
*/
|
|
17743
|
-
function
|
|
17744
|
-
|
|
17745
|
-
return
|
|
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);
|
|
18210
|
+
function landedName(plan, concept) {
|
|
18211
|
+
const key = conceptKey(concept);
|
|
18212
|
+
return renameSteps(plan).find((step) => step.hasDocument && conceptKey(step.from) === key)?.into ?? concept;
|
|
17751
18213
|
}
|
|
17752
|
-
|
|
17753
|
-
|
|
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
|
-
};
|
|
18214
|
+
/** How many steps merge - what the dialog warns about. */
|
|
18215
|
+
function mergeCount(plan) {
|
|
18216
|
+
return renameSteps(plan).filter((s) => s.merges).length;
|
|
17848
18217
|
}
|
|
17849
18218
|
// ../client/src/lib/retry.ts
|
|
17850
18219
|
/**
|
|
@@ -18679,6 +19048,64 @@ async function writeDownload(directory, name, bytes) {
|
|
|
18679
19048
|
}
|
|
18680
19049
|
throw new Error(`${directory} already holds a thousand files named like ${safe}.`);
|
|
18681
19050
|
}
|
|
19051
|
+
// src/image-size.ts
|
|
19052
|
+
function ascii(bytes, at, text) {
|
|
19053
|
+
for (let i = 0; i < text.length; i++) if (bytes[at + i] !== text.charCodeAt(i)) return false;
|
|
19054
|
+
return true;
|
|
19055
|
+
}
|
|
19056
|
+
function size(width, height) {
|
|
19057
|
+
return width > 0 && height > 0 ? {
|
|
19058
|
+
width,
|
|
19059
|
+
height
|
|
19060
|
+
} : null;
|
|
19061
|
+
}
|
|
19062
|
+
function pngSize(view) {
|
|
19063
|
+
return view.byteLength >= 24 ? size(view.getUint32(16), view.getUint32(20)) : null;
|
|
19064
|
+
}
|
|
19065
|
+
function gifSize(view) {
|
|
19066
|
+
return view.byteLength >= 10 ? size(view.getUint16(6, true), view.getUint16(8, true)) : null;
|
|
19067
|
+
}
|
|
19068
|
+
/** The first frame header's size, stepping over the segments before it, each of which states its length. */
|
|
19069
|
+
function jpegSize(view) {
|
|
19070
|
+
let at = 2;
|
|
19071
|
+
while (at + 9 <= view.byteLength) {
|
|
19072
|
+
if (view.getUint8(at) !== 255) return null;
|
|
19073
|
+
const marker = view.getUint8(at + 1);
|
|
19074
|
+
if (marker === 255) {
|
|
19075
|
+
at += 1;
|
|
19076
|
+
continue;
|
|
19077
|
+
}
|
|
19078
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) return size(view.getUint16(at + 7), view.getUint16(at + 5));
|
|
19079
|
+
at += 2 + view.getUint16(at + 2);
|
|
19080
|
+
}
|
|
19081
|
+
return null;
|
|
19082
|
+
}
|
|
19083
|
+
function webpSize(bytes, view) {
|
|
19084
|
+
if (ascii(bytes, 12, "VP8 ") && view.byteLength >= 30) return size(view.getUint16(26, true) & 16383, view.getUint16(28, true) & 16383);
|
|
19085
|
+
if (ascii(bytes, 12, "VP8L") && view.byteLength >= 25) {
|
|
19086
|
+
const bits = view.getUint32(21, true);
|
|
19087
|
+
return size((bits & 16383) + 1, (bits >>> 14 & 16383) + 1);
|
|
19088
|
+
}
|
|
19089
|
+
if (ascii(bytes, 12, "VP8X") && view.byteLength >= 30) {
|
|
19090
|
+
const width = view.getUint8(24) | view.getUint8(25) << 8 | view.getUint8(26) << 16;
|
|
19091
|
+
const height = view.getUint8(27) | view.getUint8(28) << 8 | view.getUint8(29) << 16;
|
|
19092
|
+
return size(width + 1, height + 1);
|
|
19093
|
+
}
|
|
19094
|
+
return null;
|
|
19095
|
+
}
|
|
19096
|
+
/** Its height is negative when its rows run top to bottom. */
|
|
19097
|
+
function bmpSize(view) {
|
|
19098
|
+
return view.byteLength >= 26 ? size(view.getInt32(18, true), Math.abs(view.getInt32(22, true))) : null;
|
|
19099
|
+
}
|
|
19100
|
+
function imagePixelSize(bytes) {
|
|
19101
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19102
|
+
if (ascii(bytes, 1, "PNG\r\n")) return pngSize(view);
|
|
19103
|
+
if (ascii(bytes, 0, "GIF8")) return gifSize(view);
|
|
19104
|
+
if (bytes[0] === 255 && bytes[1] === 216) return jpegSize(view);
|
|
19105
|
+
if (ascii(bytes, 0, "RIFF") && ascii(bytes, 8, "WEBP")) return webpSize(bytes, view);
|
|
19106
|
+
if (ascii(bytes, 0, "BM")) return bmpSize(view);
|
|
19107
|
+
return null;
|
|
19108
|
+
}
|
|
18682
19109
|
// ../client/src/lib/navigation/concept-path.ts
|
|
18683
19110
|
/**
|
|
18684
19111
|
* A concept in a URL path (ADR 0023): each `/`-separated segment encoded on its own, so a
|
|
@@ -20420,10 +20847,11 @@ async function uploadAsset(graph, args) {
|
|
|
20420
20847
|
const identity = assets.identify(saved.ref);
|
|
20421
20848
|
if (identity) assets.uploaded.add(identity);
|
|
20422
20849
|
return {
|
|
20423
|
-
|
|
20850
|
+
reference: saved.ref,
|
|
20424
20851
|
name: displayNameOf(saved.ref),
|
|
20425
20852
|
type,
|
|
20426
20853
|
bytes: file.bytes.byteLength,
|
|
20854
|
+
...imagePixelSize(file.bytes),
|
|
20427
20855
|
reused: saved.reused === true,
|
|
20428
20856
|
/** Paste this into a document to show the asset: an image tag for an image, a link otherwise. */
|
|
20429
20857
|
markdown: buildAssetMarkdown(saved)
|
|
@@ -20436,12 +20864,12 @@ async function uploadAsset(graph, args) {
|
|
|
20436
20864
|
*/
|
|
20437
20865
|
async function readAsset(graph, args) {
|
|
20438
20866
|
const assets = requireAssets(graph);
|
|
20439
|
-
if (!args.
|
|
20867
|
+
if (!args.reference || args.reference.trim() === "") throw new ToolError("invalid_argument", "reference must be an asset reference or name.");
|
|
20440
20868
|
await graph.store.refresh();
|
|
20441
|
-
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(args.
|
|
20442
|
-
const ref = normaliseRef(args.
|
|
20869
|
+
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.`);
|
|
20870
|
+
const ref = normaliseRef(args.reference);
|
|
20443
20871
|
const identity = assets.identify(ref);
|
|
20444
|
-
if (!identity) throw new ToolError("invalid_argument", `"${args.
|
|
20872
|
+
if (!identity) throw new ToolError("invalid_argument", `"${args.reference}" is not an asset reference of this graph.`);
|
|
20445
20873
|
const documents = await reachable(graph, identity);
|
|
20446
20874
|
if (!documents) throw new ToolError("asset_not_found", `No document you can read references "${displayNameOf(ref)}", so it is not available here.`);
|
|
20447
20875
|
const asset = await assets.store.readBytes(ref);
|
|
@@ -20458,7 +20886,8 @@ async function readAsset(graph, args) {
|
|
|
20458
20886
|
name: asset.name || displayNameOf(ref),
|
|
20459
20887
|
type: asset.type,
|
|
20460
20888
|
bytes: asset.bytes.byteLength,
|
|
20461
|
-
|
|
20889
|
+
...imagePixelSize(asset.bytes),
|
|
20890
|
+
reference: ref,
|
|
20462
20891
|
documents
|
|
20463
20892
|
};
|
|
20464
20893
|
}
|
|
@@ -20500,7 +20929,7 @@ async function listAssets(graph, args = {}) {
|
|
|
20500
20929
|
sizes = void 0;
|
|
20501
20930
|
}
|
|
20502
20931
|
const list = [...found.entries()].map(([id, entry]) => ({
|
|
20503
|
-
|
|
20932
|
+
reference: entry.ref,
|
|
20504
20933
|
name: entry.name,
|
|
20505
20934
|
type: entry.type,
|
|
20506
20935
|
...sizes?.has(id) ? { bytes: sizes.get(id) } : {},
|
|
@@ -20658,7 +21087,16 @@ async function requireReferencedTask(graph, reference, purpose = "read") {
|
|
|
20658
21087
|
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
21088
|
const named = resolveIdentity(graph, parsed.document);
|
|
20660
21089
|
if (purpose === "write" && named && await visibleText(graph, named) === null) throw protectedDocument(parsed.document);
|
|
20661
|
-
throw new ToolError("task_not_found",
|
|
21090
|
+
throw new ToolError("task_not_found", taskNotFoundMessage(graph.connection()));
|
|
21091
|
+
}
|
|
21092
|
+
/**
|
|
21093
|
+
* The tools see only this computer's copy, so a task that is missing from it may be gone or may
|
|
21094
|
+
* not have arrived. An offline copy makes the second likely, and a fresh instruction names the
|
|
21095
|
+
* same words and would fail the same way, so it asks for a retry instead.
|
|
21096
|
+
*/
|
|
21097
|
+
function taskNotFoundMessage(connection) {
|
|
21098
|
+
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.`;
|
|
21099
|
+
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
21100
|
}
|
|
20663
21101
|
/**
|
|
20664
21102
|
* The block's own lines and everything nested under it: in the index's rows, which run in
|
|
@@ -20769,6 +21207,7 @@ async function graphInfo(graph) {
|
|
|
20769
21207
|
return {
|
|
20770
21208
|
name: graph.name,
|
|
20771
21209
|
backend: graph.backend,
|
|
21210
|
+
connection: graph.connection() ?? void 0,
|
|
20772
21211
|
documents: {
|
|
20773
21212
|
pages: documents.filter((d) => d.kind === "page").length,
|
|
20774
21213
|
journals: documents.filter((d) => d.kind === "journal").length,
|
|
@@ -21040,7 +21479,7 @@ async function publish(graph, args, host) {
|
|
|
21040
21479
|
}
|
|
21041
21480
|
let drawings = null;
|
|
21042
21481
|
if (needsDrawings(bodies)) {
|
|
21043
|
-
drawings = await openDrawingRenderer(env);
|
|
21482
|
+
drawings = await openDrawingRenderer(env, source.readAsset);
|
|
21044
21483
|
if (!drawings) {
|
|
21045
21484
|
await renderer?.dispose();
|
|
21046
21485
|
await maps?.dispose();
|
|
@@ -21150,14 +21589,21 @@ function cliPublishOutput(result) {
|
|
|
21150
21589
|
note: "Documents the site leaves out are counted here, not named. Settings → Publish in EtherPK shows the full report."
|
|
21151
21590
|
};
|
|
21152
21591
|
}
|
|
21592
|
+
/**
|
|
21593
|
+
* How long `graph_info` waits for the publications. Reading them asks the relay how far each
|
|
21594
|
+
* document has moved, and that request waits for a reconnect if the socket drops under it.
|
|
21595
|
+
* `graph_info` is how an agent learns the copy is offline, so it answers without them.
|
|
21596
|
+
*/
|
|
21597
|
+
var PUBLISHING_READ_MS = 15e3;
|
|
21153
21598
|
/** The publishing half of `graph_info`: each publication with its folder here, and whether diagrams can be drawn. */
|
|
21154
|
-
async function publishingInfo(graph, host) {
|
|
21599
|
+
async function publishingInfo(graph, host, readMs = PUBLISHING_READ_MS) {
|
|
21155
21600
|
const { env, cmd } = hostOf$1(host);
|
|
21156
|
-
const
|
|
21601
|
+
const reading = graph.publishing.readSource();
|
|
21602
|
+
const read = await reachedWithin(reading, readMs);
|
|
21157
21603
|
const destinationOf = await destinationsFor(graph, env);
|
|
21158
21604
|
const chromium = await chromiumStatus(env, cmd);
|
|
21159
21605
|
return {
|
|
21160
|
-
publications: summarisePublishing(source).publications.map((p) => {
|
|
21606
|
+
publications: read ? summarisePublishing((await reading).source).publications.map((p) => {
|
|
21161
21607
|
const { folder, repository } = destinationOf(p.id);
|
|
21162
21608
|
return {
|
|
21163
21609
|
id: p.id,
|
|
@@ -21166,7 +21612,8 @@ async function publishingInfo(graph, host) {
|
|
|
21166
21612
|
publishFolder: folder,
|
|
21167
21613
|
publishRepository: repository ? repositoryLabel(repository) : null
|
|
21168
21614
|
};
|
|
21169
|
-
}),
|
|
21615
|
+
}) : null,
|
|
21616
|
+
...read ? {} : { note: "The publications could not be read in time. list_publications waits for them." },
|
|
21170
21617
|
mermaid: {
|
|
21171
21618
|
available: chromium.executable !== null,
|
|
21172
21619
|
...chromium.executable ? {} : { setup: chromium.setupCommand }
|
|
@@ -21662,7 +22109,7 @@ async function previewTheme(graph, args, host) {
|
|
|
21662
22109
|
};
|
|
21663
22110
|
const bodies = source.documents.map((d) => d.text);
|
|
21664
22111
|
const renderer = needsMermaid(bodies) ? await openDiagramRenderer(env) : null;
|
|
21665
|
-
const drawings = needsDrawings(bodies) ? await openDrawingRenderer(env) : null;
|
|
22112
|
+
const drawings = needsDrawings(bodies) ? await openDrawingRenderer(env, source.readAsset) : null;
|
|
21666
22113
|
try {
|
|
21667
22114
|
const environment = createNodePublishEnvironment({
|
|
21668
22115
|
graphTheme: (id) => graph.publishing.graphTheme(id),
|
|
@@ -21779,6 +22226,20 @@ async function runTool(work) {
|
|
|
21779
22226
|
}
|
|
21780
22227
|
}
|
|
21781
22228
|
/**
|
|
22229
|
+
* A note after the answer, whether that is a result or a refusal, while the copy it came from is
|
|
22230
|
+
* offline. A block of its own, so the answer's JSON stays as it always is.
|
|
22231
|
+
*/
|
|
22232
|
+
function withOfflineNote(result, connection) {
|
|
22233
|
+
const note = offlineNotice(connection);
|
|
22234
|
+
return note ? {
|
|
22235
|
+
...result,
|
|
22236
|
+
content: [...result.content, {
|
|
22237
|
+
type: "text",
|
|
22238
|
+
text: note
|
|
22239
|
+
}]
|
|
22240
|
+
} : result;
|
|
22241
|
+
}
|
|
22242
|
+
/**
|
|
21782
22243
|
* The refusal every tool gives once the Sync Server has ended access, instead of answering from
|
|
21783
22244
|
* a cache that can no longer be trusted or saved.
|
|
21784
22245
|
*/
|
|
@@ -21809,18 +22270,23 @@ function createMcpServer(source, info) {
|
|
|
21809
22270
|
const ready = typeof source === "function" ? null : Promise.resolve(source);
|
|
21810
22271
|
ready?.catch(() => {});
|
|
21811
22272
|
const backendKind = typeof source === "function" || source instanceof Promise ? info.backendKind : source.backend.kind;
|
|
21812
|
-
const run =
|
|
21813
|
-
|
|
22273
|
+
const run = async (work) => {
|
|
22274
|
+
let graph;
|
|
22275
|
+
try {
|
|
22276
|
+
graph = await (ready ?? source());
|
|
22277
|
+
} catch (error) {
|
|
22278
|
+
return failed(error);
|
|
22279
|
+
}
|
|
21814
22280
|
const ended = accessEndedError(graph, info.cmd ?? "etherpk-mcp");
|
|
21815
|
-
if (ended)
|
|
21816
|
-
return work(graph);
|
|
21817
|
-
}
|
|
22281
|
+
if (ended) return failed(ended);
|
|
22282
|
+
return withOfflineNote(await runTool(() => work(graph)), graph.connection());
|
|
22283
|
+
};
|
|
21818
22284
|
const server = new McpServer({
|
|
21819
22285
|
name: "etherpk",
|
|
21820
22286
|
version: info.version
|
|
21821
22287
|
}, { instructions: [
|
|
21822
22288
|
`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."] : [],
|
|
22289
|
+
...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
22290
|
`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
22291
|
"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
22292
|
"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 +22296,11 @@ function createMcpServer(source, info) {
|
|
|
21830
22296
|
"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
22297
|
"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
22298
|
"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.",
|
|
22299
|
+
"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
22300
|
"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
22301
|
"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
22302
|
"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.",
|
|
22303
|
+
"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
22304
|
"The user documentation is at https://docs.etherpk.com."
|
|
21839
22305
|
].join("\n") });
|
|
21840
22306
|
server.registerTool("list_documents", {
|
|
@@ -22038,7 +22504,7 @@ function createMcpServer(source, info) {
|
|
|
22038
22504
|
}, async (args) => run((graph) => setFrontmatter(graph, args)));
|
|
22039
22505
|
server.registerTool("upload_asset", {
|
|
22040
22506
|
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.",
|
|
22507
|
+
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
22508
|
inputSchema: {
|
|
22043
22509
|
path: z.string().min(1).describe("Absolute path of an ordinary file on this machine."),
|
|
22044
22510
|
name: z.string().min(1).optional().describe("The name to store it under - the file's own name by default.")
|
|
@@ -22046,9 +22512,9 @@ function createMcpServer(source, info) {
|
|
|
22046
22512
|
}, async (args) => run((graph) => uploadAsset(graph, args)));
|
|
22047
22513
|
server.registerTool("read_asset", {
|
|
22048
22514
|
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.",
|
|
22515
|
+
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
22516
|
inputSchema: {
|
|
22051
|
-
|
|
22517
|
+
reference: z.string().min(1).describe("The asset as a document or read_task shows it (\"../assets/<name>\"), or its name alone."),
|
|
22052
22518
|
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
22519
|
}
|
|
22054
22520
|
}, async (args) => run((graph) => readAsset(graph, args)));
|
|
@@ -22184,12 +22650,15 @@ function createMcpServer(source, info) {
|
|
|
22184
22650
|
}, async (args) => run((graph) => previewTheme(graph, args, host)));
|
|
22185
22651
|
server.registerTool("graph_info", {
|
|
22186
22652
|
title: "Graph info",
|
|
22187
|
-
description: "What you are connected to: the graph's name, whether it is a synced graph (
|
|
22653
|
+
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
22654
|
inputSchema: {}
|
|
22189
|
-
}, async () => run(async (graph) =>
|
|
22190
|
-
|
|
22191
|
-
|
|
22192
|
-
|
|
22655
|
+
}, async () => run(async (graph) => {
|
|
22656
|
+
const publishing = await publishingInfo(graph, host);
|
|
22657
|
+
return {
|
|
22658
|
+
...await graphInfo(graph),
|
|
22659
|
+
publishing
|
|
22660
|
+
};
|
|
22661
|
+
}));
|
|
22193
22662
|
return server;
|
|
22194
22663
|
}
|
|
22195
22664
|
// src/socket-transport.ts
|
|
@@ -22833,6 +23302,31 @@ function mapItems(db, concept, cap = MAP_ITEMS_CAP) {
|
|
|
22833
23302
|
* against an in-memory database, exactly as ADR 0015 established for the query layer — no
|
|
22834
23303
|
* browser, no worker, no OPFS.
|
|
22835
23304
|
*/
|
|
23305
|
+
/** The reads that list rows from the open index, and list nothing while none is open. */
|
|
23306
|
+
function answerListRead(db, request) {
|
|
23307
|
+
switch (request.type) {
|
|
23308
|
+
case "property-keys": return {
|
|
23309
|
+
type: "property-keys",
|
|
23310
|
+
id: request.id,
|
|
23311
|
+
keys: db ? propertyKeys(db) : []
|
|
23312
|
+
};
|
|
23313
|
+
case "free-tags": return {
|
|
23314
|
+
type: "free-tags",
|
|
23315
|
+
id: request.id,
|
|
23316
|
+
tags: db ? usedFreeTags(db) : []
|
|
23317
|
+
};
|
|
23318
|
+
case "templates": return {
|
|
23319
|
+
type: "templates",
|
|
23320
|
+
id: request.id,
|
|
23321
|
+
templates: db ? templatePages(db) : []
|
|
23322
|
+
};
|
|
23323
|
+
case "property-values": return {
|
|
23324
|
+
type: "property-values",
|
|
23325
|
+
id: request.id,
|
|
23326
|
+
values: db ? propertyValues(db, request.key) : []
|
|
23327
|
+
};
|
|
23328
|
+
}
|
|
23329
|
+
}
|
|
22836
23330
|
function createIndexCore(host) {
|
|
22837
23331
|
let db;
|
|
22838
23332
|
let persisted = false;
|
|
@@ -23126,21 +23620,10 @@ function createIndexCore(host) {
|
|
|
23126
23620
|
capped: count.capped
|
|
23127
23621
|
}];
|
|
23128
23622
|
}
|
|
23129
|
-
case "property-keys":
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
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
|
-
}];
|
|
23623
|
+
case "property-keys":
|
|
23624
|
+
case "free-tags":
|
|
23625
|
+
case "templates":
|
|
23626
|
+
case "property-values": return [answerListRead(db, request)];
|
|
23144
23627
|
case "property-match": return [{
|
|
23145
23628
|
type: "property-match",
|
|
23146
23629
|
id: request.id,
|
|
@@ -24044,6 +24527,12 @@ function createRemoteGraphIndex(source, transport, options) {
|
|
|
24044
24527
|
id
|
|
24045
24528
|
}))).keys;
|
|
24046
24529
|
},
|
|
24530
|
+
async freeTags() {
|
|
24531
|
+
return (await request((id) => ({
|
|
24532
|
+
type: "free-tags",
|
|
24533
|
+
id
|
|
24534
|
+
}))).tags;
|
|
24535
|
+
},
|
|
24047
24536
|
async templates() {
|
|
24048
24537
|
return (await request((id) => ({
|
|
24049
24538
|
type: "templates",
|
|
@@ -27473,6 +27962,7 @@ function assembleHeadlessGraph(parts) {
|
|
|
27473
27962
|
themes: parts.themes,
|
|
27474
27963
|
settle: () => parts.settle(schedulePersist),
|
|
27475
27964
|
accessLoss: () => parts.accessLoss?.() ?? null,
|
|
27965
|
+
connection: () => parts.connection?.() ?? null,
|
|
27476
27966
|
persist,
|
|
27477
27967
|
semantic,
|
|
27478
27968
|
semanticOpened: () => semanticOpening ? semanticOpening.catch(() => void 0) : Promise.resolve(void 0),
|
|
@@ -27513,6 +28003,7 @@ async function openHeadlessGraph(deps) {
|
|
|
27513
28003
|
onAccessLost: deps.onAccessLost,
|
|
27514
28004
|
publishName: deps.publishName
|
|
27515
28005
|
});
|
|
28006
|
+
const connection = followConnection(sync, { onChange: deps.onConnectionChange });
|
|
27516
28007
|
const store = createServerDocumentStore(sync, { readyTimeoutMs: deps.readyTimeoutMs });
|
|
27517
28008
|
try {
|
|
27518
28009
|
await store.scan();
|
|
@@ -27603,6 +28094,7 @@ async function openHeadlessGraph(deps) {
|
|
|
27603
28094
|
graphId: deps.graphId,
|
|
27604
28095
|
name: sync.getMeta().name ?? deps.graphId,
|
|
27605
28096
|
accessLoss: () => sync.accessLoss(),
|
|
28097
|
+
connection: () => connection.current(),
|
|
27606
28098
|
store: documents,
|
|
27607
28099
|
index,
|
|
27608
28100
|
assets,
|
|
@@ -28517,7 +29009,8 @@ async function unlockByDeviceApproval(api, io) {
|
|
|
28517
29009
|
const where = io.clientUrl ? `open EtherPK at ${io.clientUrl}` : "open EtherPK in a browser";
|
|
28518
29010
|
io.say("");
|
|
28519
29011
|
io.say(`To approve this device, ${where} (any page - it need not be a note) on any device where this account's`);
|
|
28520
|
-
io.say("Encryption Keys are unlocked. A prompt
|
|
29012
|
+
io.say("Encryption Keys are unlocked. A prompt appears on each of them: choose Show the code on the one you approve");
|
|
29013
|
+
io.say("from, and this terminal then shows the same code.");
|
|
28521
29014
|
io.say("");
|
|
28522
29015
|
io.say("Waiting (up to ten minutes)…");
|
|
28523
29016
|
const abandon = async () => {
|
|
@@ -28546,6 +29039,7 @@ async function unlockByDeviceApproval(api, io) {
|
|
|
28546
29039
|
if (approved && io.codesMatch()) return approved;
|
|
28547
29040
|
if (approved && !toldApproved) {
|
|
28548
29041
|
toldApproved = true;
|
|
29042
|
+
io.say("");
|
|
28549
29043
|
io.say("EtherPK approved this device. Press y if it showed the same code.");
|
|
28550
29044
|
}
|
|
28551
29045
|
await io.sleep(APPROVAL_POLL_MS);
|
|
@@ -29012,10 +29506,13 @@ async function login(args) {
|
|
|
29012
29506
|
pat: token
|
|
29013
29507
|
}).catch(abandon);
|
|
29014
29508
|
console.log(`Connected to ${syncServer} as ${account.principal.email ?? account.principal.name ?? account.principal.id}.`);
|
|
29015
|
-
const byRecoveryCode = async () =>
|
|
29016
|
-
|
|
29017
|
-
|
|
29018
|
-
|
|
29509
|
+
const byRecoveryCode = async () => {
|
|
29510
|
+
console.log("");
|
|
29511
|
+
return unlockByRecoveryCode(account.api, process.env.ETHERPK_RECOVERY_CODE ?? await ask("Recovery Code: ", {
|
|
29512
|
+
secret: true,
|
|
29513
|
+
hint: "set ETHERPK_RECOVERY_CODE"
|
|
29514
|
+
}));
|
|
29515
|
+
};
|
|
29019
29516
|
const vaultKey = await (args["recovery-code"] ? byRecoveryCode() : approveOrFallBack(account, byRecoveryCode)).catch(abandon);
|
|
29020
29517
|
if (accessTokenKind(token) === "standard") {
|
|
29021
29518
|
const given = token;
|
|
@@ -29028,6 +29525,7 @@ async function login(args) {
|
|
|
29028
29525
|
if (!await tokenStillWorks(syncServer, given)) return fail(`Could not swap the access token for an Agent Token (${reason}), and the access token you gave no longer works. Run login again with an Agent Setup Code.`);
|
|
29029
29526
|
return fail(`Could not swap the access token for an Agent Token (${reason}). Nothing was kept on this computer: run login again.`);
|
|
29030
29527
|
});
|
|
29528
|
+
console.log("");
|
|
29031
29529
|
console.log(`The access token you gave has been revoked. This computer now holds an Agent Token, limited to the routes an agent needs. If you used that access token anywhere else, create a new one at ${syncServer}/account/tokens.`);
|
|
29032
29530
|
}
|
|
29033
29531
|
if (previous) {
|
|
@@ -29035,7 +29533,10 @@ async function login(args) {
|
|
|
29035
29533
|
if (before && before.pat !== token && await revokeHeldToken({
|
|
29036
29534
|
syncServer,
|
|
29037
29535
|
token: before.pat
|
|
29038
|
-
}))
|
|
29536
|
+
})) {
|
|
29537
|
+
console.log("");
|
|
29538
|
+
console.log(`Revoked the token this computer held for ${syncServer} before this login.`);
|
|
29539
|
+
}
|
|
29039
29540
|
}
|
|
29040
29541
|
const where = await saveLogin({
|
|
29041
29542
|
config,
|
|
@@ -29047,11 +29548,19 @@ async function login(args) {
|
|
|
29047
29548
|
},
|
|
29048
29549
|
keychain: keychain()
|
|
29049
29550
|
});
|
|
29551
|
+
console.log("");
|
|
29050
29552
|
console.log(where === path ? `Encryption Keys unlocked and kept in ${path} (owner-only). Anyone who can read your files on this machine can read this account, as with a signed-in browser. Never let an agent read, print or search that file.` : `Encryption Keys unlocked and kept in ${where}; ${path} names only the server. A program you run can still ask ${where} for them, so run only agents you trust with this account.`);
|
|
29051
29553
|
const others = Object.keys(config.servers).filter((server) => server !== syncServer);
|
|
29052
|
-
if (others.length > 0)
|
|
29554
|
+
if (others.length > 0) {
|
|
29555
|
+
console.log("");
|
|
29556
|
+
console.log(`Also logged in to ${others.join(", ")} - commands now need --sync-server <url> to say which.`);
|
|
29557
|
+
}
|
|
29053
29558
|
const restarted = await stopHosts(process.env, "a new login for its server", ({ status }) => status.target.kind === "synced" && status.target.server === syncServer);
|
|
29054
|
-
if (restarted.length > 0)
|
|
29559
|
+
if (restarted.length > 0) {
|
|
29560
|
+
console.log("");
|
|
29561
|
+
console.log(`Stopped the background process of ${restarted.length === 1 ? "one graph" : `${restarted.length} graphs`} served with the previous login. Agents start a new one with this login on their next call.`);
|
|
29562
|
+
}
|
|
29563
|
+
console.log("");
|
|
29055
29564
|
await listGraphs({
|
|
29056
29565
|
syncServer,
|
|
29057
29566
|
pat: token,
|
|
@@ -29092,7 +29601,8 @@ async function approveOrFallBack(account, byRecoveryCode) {
|
|
|
29092
29601
|
const onSignal = (name) => controls.onSignal(name);
|
|
29093
29602
|
for (const name of quitSignals) process.once(name, onSignal);
|
|
29094
29603
|
if (interactive) {
|
|
29095
|
-
console.log("
|
|
29604
|
+
console.log("");
|
|
29605
|
+
console.log("**Press r to type your Recovery Code instead.**");
|
|
29096
29606
|
stdin.setRawMode(true);
|
|
29097
29607
|
} else stdin.on("end", onInputEnd);
|
|
29098
29608
|
stdin.resume();
|
|
@@ -29117,6 +29627,7 @@ async function approveOrFallBack(account, byRecoveryCode) {
|
|
|
29117
29627
|
if (!abandoned) throw new Error("unreachable");
|
|
29118
29628
|
if (controls.mismatched) fail("The codes did not match, so the request was cancelled. Something between this computer and your other device may have interfered. Run login again, or pass --recovery-code.");
|
|
29119
29629
|
if (controls.inputClosed) fail("Device approval needs someone to confirm the code it shows. Run login in a terminal and press y when the codes match, or pass --recovery-code, or set ETHERPK_RECOVERY_CODE.");
|
|
29630
|
+
console.log("");
|
|
29120
29631
|
console.log("Approval cancelled - unlocking with your Recovery Code instead.");
|
|
29121
29632
|
return byRecoveryCode();
|
|
29122
29633
|
}
|
|
@@ -29709,6 +30220,7 @@ async function openSyncedGraph(syncServer, graphId, named) {
|
|
|
29709
30220
|
embeddingModel: () => loadEmbeddingModel(process.env),
|
|
29710
30221
|
onSemanticProgress: reportSemanticProgress,
|
|
29711
30222
|
onError: (error) => console.error(`etherpk-mcp: ${error.message}`),
|
|
30223
|
+
onConnectionChange: (change) => console.error(`etherpk-mcp: ${connectionChangeLine(change)}`),
|
|
29712
30224
|
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
30225
|
publishName: createGraphNamePublisher({
|
|
29714
30226
|
api: account.api,
|