@svenroth-ai/shipwright 0.34.1 → 0.35.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/client/dist/assets/{EmbeddedTerminal-DwGSHM6X.js → EmbeddedTerminal-BQxd2ka5.js} +1 -1
- package/client/dist/assets/{abnfDiagram-VCTEODGH-BetE1-_R.js → abnfDiagram-VCTEODGH-DVGvhPAF.js} +1 -1
- package/client/dist/assets/{arc-B076J1v2.js → arc-0CzPJDby.js} +1 -1
- package/client/dist/assets/{architectureDiagram-5GKGNRK7-D4mETsUs.js → architectureDiagram-5GKGNRK7-rRehhY2U.js} +1 -1
- package/client/dist/assets/{blockDiagram-I7D4REHJ-DFq-33KF.js → blockDiagram-I7D4REHJ-569E0sRi.js} +1 -1
- package/client/dist/assets/{c4Diagram-7LVT6UL2-BokP3tyz.js → c4Diagram-7LVT6UL2-CH709m5J.js} +1 -1
- package/client/dist/assets/channel-CK8bs2wJ.js +1 -0
- package/client/dist/assets/{chunk-2Q5K7J3B-CcOBh64m.js → chunk-2Q5K7J3B-B-wyXX83.js} +1 -1
- package/client/dist/assets/{chunk-5VM5RSS4-DkDzBZ5M.js → chunk-5VM5RSS4-8Kp9bxlq.js} +1 -1
- package/client/dist/assets/{chunk-F27PBJKO-CW0pCfcu.js → chunk-F27PBJKO-C-4vzAu0.js} +1 -1
- package/client/dist/assets/{chunk-IMKFNOWR-B4GPEpbj.js → chunk-IMKFNOWR-G8rPg9lv.js} +1 -1
- package/client/dist/assets/{chunk-JWPE2WC7-BIyZTFKd.js → chunk-JWPE2WC7-Btgjb7TA.js} +1 -1
- package/client/dist/assets/{chunk-POPQ4Y6H-D7vHHG_7.js → chunk-POPQ4Y6H-CIRHjewn.js} +1 -1
- package/client/dist/assets/{chunk-SVP7TREG-ie9InuIQ.js → chunk-SVP7TREG-XJQmZJCT.js} +1 -1
- package/client/dist/assets/{chunk-TICWLB2K-DV0e-WEc.js → chunk-TICWLB2K-BkUAP949.js} +1 -1
- package/client/dist/assets/{chunk-XXDRQBXY-DBlPWavE.js → chunk-XXDRQBXY-n6LLHK0S.js} +1 -1
- package/client/dist/assets/classDiagram-ZZMXUADV-GdThjGhm.js +1 -0
- package/client/dist/assets/classDiagram-v2-VYDZK3BY-GdThjGhm.js +1 -0
- package/client/dist/assets/{cose-bilkent-JH36ORCC-CqFx0AUx.js → cose-bilkent-JH36ORCC-B_LrVsJl.js} +1 -1
- package/client/dist/assets/{cynefin-OW5HDTMX-DLymEpAW.js → cynefin-OW5HDTMX-BBYcwy7e.js} +1 -1
- package/client/dist/assets/{cynefinDiagram-5FMLGOSQ-BhsmCFHe.js → cynefinDiagram-5FMLGOSQ-ihUD9Xxj.js} +1 -1
- package/client/dist/assets/{dagre-GXQ25YYZ-DnUER_CH.js → dagre-GXQ25YYZ-DaqDhPEt.js} +1 -1
- package/client/dist/assets/{diagram-S7CK7UJ4-PSJ4NiBz.js → diagram-S7CK7UJ4-vXMKJGg9.js} +1 -1
- package/client/dist/assets/{diagram-UQ7AKVKN-DlGy1unH.js → diagram-UQ7AKVKN-BXyED4Tc.js} +1 -1
- package/client/dist/assets/{diagram-VSXAHHWV-p0JFB6Jm.js → diagram-VSXAHHWV-Byhzh5qv.js} +1 -1
- package/client/dist/assets/{diagram-VX7I27RA-EkDtuoPG.js → diagram-VX7I27RA-CRBlNGq-.js} +1 -1
- package/client/dist/assets/{diagram-Z3DM3KII-DojdW25R.js → diagram-Z3DM3KII-BwOGWlFo.js} +1 -1
- package/client/dist/assets/{ebnfDiagram-PWID7BFC-B_vEyOqI.js → ebnfDiagram-PWID7BFC-CrpspwPC.js} +1 -1
- package/client/dist/assets/{erDiagram-RLTQ6QDP-XaJ6wVBf.js → erDiagram-RLTQ6QDP-BDDosTCI.js} +1 -1
- package/client/dist/assets/{flowDiagram-HODETNUW-CdiEIfGb.js → flowDiagram-HODETNUW-GONxzVCJ.js} +1 -1
- package/client/dist/assets/{ganttDiagram-EL5Y4UJY-JCWGjOmj.js → ganttDiagram-EL5Y4UJY-BO5m8OtJ.js} +1 -1
- package/client/dist/assets/{gitGraphDiagram-WWUBYQGX-Cxax4x3y.js → gitGraphDiagram-WWUBYQGX-C2E5sNix.js} +1 -1
- package/client/dist/assets/{index-CKR9An8G.css → index-CcpgVrnm.css} +1 -1
- package/client/dist/assets/index-DG_ARdLf.js +998 -0
- package/client/dist/assets/{infoDiagram-27XIBGKW-XhflnQfL.js → infoDiagram-27XIBGKW-IABteXGH.js} +1 -1
- package/client/dist/assets/{ishikawaDiagram-5VMMS53U-DU_irBIW.js → ishikawaDiagram-5VMMS53U-D0h4EZ79.js} +1 -1
- package/client/dist/assets/{journeyDiagram-3NMN7TZE-D_a1O3MP.js → journeyDiagram-3NMN7TZE-CI97qE7V.js} +1 -1
- package/client/dist/assets/{kanban-definition-UXKFOSKX-Dp9j8qaK.js → kanban-definition-UXKFOSKX-BrUmooWn.js} +1 -1
- package/client/dist/assets/{layout-CNrd5sQu.js → layout-BoCAyITs.js} +1 -1
- package/client/dist/assets/{linear-Du2j9ZDx.js → linear-Di_uPAQn.js} +1 -1
- package/client/dist/assets/{mermaid.core-6y29fmlV.js → mermaid.core-CySCU5kD.js} +5 -5
- package/client/dist/assets/{mindmap-definition-YA3MSWOX-BP1vzyZ-.js → mindmap-definition-YA3MSWOX-DUYWj8HD.js} +1 -1
- package/client/dist/assets/{pegDiagram-XKGWAZYB-BysYM5tY.js → pegDiagram-XKGWAZYB-QgoDxcLb.js} +1 -1
- package/client/dist/assets/{pieDiagram-E7YTZNPT-C4bXtKMQ.js → pieDiagram-E7YTZNPT-CevP5ovh.js} +1 -1
- package/client/dist/assets/{quadrantDiagram-AXDQQJYC-BThBJ4Is.js → quadrantDiagram-AXDQQJYC-CFpqC6xx.js} +1 -1
- package/client/dist/assets/{railroadDiagram-O6MQD6OU-DOok3uNz.js → railroadDiagram-O6MQD6OU-Cz752XbI.js} +1 -1
- package/client/dist/assets/{requirementDiagram-BXWQKSXE-qxOSWJb_.js → requirementDiagram-BXWQKSXE-DrnUkspF.js} +1 -1
- package/client/dist/assets/{sankeyDiagram-P5KCCOFB-DWrVBQhX.js → sankeyDiagram-P5KCCOFB-CHEZ3g0k.js} +1 -1
- package/client/dist/assets/{sequenceDiagram-WJ2MYXX4-BtpQQSu7.js → sequenceDiagram-WJ2MYXX4-BnmkUwhq.js} +1 -1
- package/client/dist/assets/{sizeCapture-INFHLROL-DHCEOCri.js → sizeCapture-INFHLROL-B8CEWxq0.js} +1 -1
- package/client/dist/assets/{stateDiagram-D77RDMKH-CGJ6QMy3.js → stateDiagram-D77RDMKH-2akPjt1U.js} +1 -1
- package/client/dist/assets/stateDiagram-v2-MP3YSRHH-D8vfNZ4A.js +1 -0
- package/client/dist/assets/{swimlanes-42K2YHIH-DqlK3zom.js → swimlanes-42K2YHIH-BvPAHlMc.js} +1 -1
- package/client/dist/assets/swimlanesDiagram-VR7AAH4N-DjIMHyce.js +8 -0
- package/client/dist/assets/{timeline-definition-24CTP7MA-DhisAXCL.js → timeline-definition-24CTP7MA-C7cih9Hk.js} +1 -1
- package/client/dist/assets/{vennDiagram-4TSXK5OY-Cuwuvudy.js → vennDiagram-4TSXK5OY-CcgPV-UR.js} +1 -1
- package/client/dist/assets/{wardleyDiagram-VM6X3IG4-H7vNGqyj.js → wardleyDiagram-VM6X3IG4-jPkq03fE.js} +1 -1
- package/client/dist/assets/{xychartDiagram-S5SC5T6Z-BlBnOH0f.js → xychartDiagram-S5SC5T6Z-BfP-hvgm.js} +1 -1
- package/client/dist/index.html +2 -2
- package/package.json +5 -4
- package/server/dist/config/mail/shipwright-logo-white.png +0 -0
- package/server/dist/core/reminder-cli-runner.d.ts +85 -0
- package/server/dist/core/reminder-cli-runner.d.ts.map +1 -0
- package/server/dist/core/reminder-cli-runner.js +179 -0
- package/server/dist/core/reminder-cli-runner.js.map +1 -0
- package/server/dist/core/reminder-contract.d.ts +44 -0
- package/server/dist/core/reminder-contract.d.ts.map +1 -0
- package/server/dist/core/reminder-contract.js +141 -0
- package/server/dist/core/reminder-contract.js.map +1 -0
- package/server/dist/core/reminder-fixtures.d.ts +40 -0
- package/server/dist/core/reminder-fixtures.d.ts.map +1 -0
- package/server/dist/core/reminder-fixtures.js +22 -0
- package/server/dist/core/reminder-fixtures.js.map +1 -0
- package/server/dist/core/reminder-mail/compose.d.ts +28 -0
- package/server/dist/core/reminder-mail/compose.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/compose.js +141 -0
- package/server/dist/core/reminder-mail/compose.js.map +1 -0
- package/server/dist/core/reminder-mail/fake-smtp.d.ts +8 -0
- package/server/dist/core/reminder-mail/fake-smtp.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/fake-smtp.js +79 -0
- package/server/dist/core/reminder-mail/fake-smtp.js.map +1 -0
- package/server/dist/core/reminder-mail/json-store.d.ts +13 -0
- package/server/dist/core/reminder-mail/json-store.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/json-store.js +83 -0
- package/server/dist/core/reminder-mail/json-store.js.map +1 -0
- package/server/dist/core/reminder-mail/ledger.d.ts +32 -0
- package/server/dist/core/reminder-mail/ledger.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/ledger.js +123 -0
- package/server/dist/core/reminder-mail/ledger.js.map +1 -0
- package/server/dist/core/reminder-mail/logo.d.ts +9 -0
- package/server/dist/core/reminder-mail/logo.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/logo.js +21 -0
- package/server/dist/core/reminder-mail/logo.js.map +1 -0
- package/server/dist/core/reminder-mail/service.d.ts +70 -0
- package/server/dist/core/reminder-mail/service.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/service.js +251 -0
- package/server/dist/core/reminder-mail/service.js.map +1 -0
- package/server/dist/core/reminder-mail/settings.d.ts +51 -0
- package/server/dist/core/reminder-mail/settings.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/settings.js +190 -0
- package/server/dist/core/reminder-mail/settings.js.map +1 -0
- package/server/dist/core/reminder-mail/timer.d.ts +26 -0
- package/server/dist/core/reminder-mail/timer.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/timer.js +82 -0
- package/server/dist/core/reminder-mail/timer.js.map +1 -0
- package/server/dist/core/reminder-mail/transport.d.ts +31 -0
- package/server/dist/core/reminder-mail/transport.d.ts.map +1 -0
- package/server/dist/core/reminder-mail/transport.js +70 -0
- package/server/dist/core/reminder-mail/transport.js.map +1 -0
- package/server/dist/core/reminder-main-root.d.ts +6 -0
- package/server/dist/core/reminder-main-root.d.ts.map +1 -0
- package/server/dist/core/reminder-main-root.js +46 -0
- package/server/dist/core/reminder-main-root.js.map +1 -0
- package/server/dist/core/reminder-validation.d.ts +23 -0
- package/server/dist/core/reminder-validation.d.ts.map +1 -0
- package/server/dist/core/reminder-validation.js +131 -0
- package/server/dist/core/reminder-validation.js.map +1 -0
- package/server/dist/external/org/audit-append.d.ts +12 -0
- package/server/dist/external/org/audit-append.d.ts.map +1 -0
- package/server/dist/external/org/audit-append.js +92 -0
- package/server/dist/external/org/audit-append.js.map +1 -0
- package/server/dist/external/org/beat-register-release-audit.d.ts +1 -1
- package/server/dist/external/org/beat-register-release-audit.d.ts.map +1 -1
- package/server/dist/external/org/beat-register-release-audit.js +3 -70
- package/server/dist/external/org/beat-register-release-audit.js.map +1 -1
- package/server/dist/external/org/countersign-core.d.ts +43 -3
- package/server/dist/external/org/countersign-core.d.ts.map +1 -1
- package/server/dist/external/org/countersign-core.js +91 -14
- package/server/dist/external/org/countersign-core.js.map +1 -1
- package/server/dist/external/org/countersign-request.d.ts.map +1 -1
- package/server/dist/external/org/countersign-request.js +38 -26
- package/server/dist/external/org/countersign-request.js.map +1 -1
- package/server/dist/external/org/decision-record-evidence.d.ts +51 -0
- package/server/dist/external/org/decision-record-evidence.d.ts.map +1 -0
- package/server/dist/external/org/decision-record-evidence.js +230 -0
- package/server/dist/external/org/decision-record-evidence.js.map +1 -0
- package/server/dist/external/org/decision-request-common.d.ts +25 -0
- package/server/dist/external/org/decision-request-common.d.ts.map +1 -0
- package/server/dist/external/org/decision-request-common.js +39 -0
- package/server/dist/external/org/decision-request-common.js.map +1 -0
- package/server/dist/external/org/decision-residue.d.ts +15 -0
- package/server/dist/external/org/decision-residue.d.ts.map +1 -0
- package/server/dist/external/org/decision-residue.js +41 -0
- package/server/dist/external/org/decision-residue.js.map +1 -0
- package/server/dist/external/org/decisions-audit.d.ts +63 -0
- package/server/dist/external/org/decisions-audit.d.ts.map +1 -0
- package/server/dist/external/org/decisions-audit.js +192 -0
- package/server/dist/external/org/decisions-audit.js.map +1 -0
- package/server/dist/external/org/decisions-lock.d.ts +1 -17
- package/server/dist/external/org/decisions-lock.d.ts.map +1 -1
- package/server/dist/external/org/decisions-lock.js +6 -29
- package/server/dist/external/org/decisions-lock.js.map +1 -1
- package/server/dist/external/org/decisions-rejected.d.ts +46 -0
- package/server/dist/external/org/decisions-rejected.d.ts.map +1 -0
- package/server/dist/external/org/decisions-rejected.js +183 -0
- package/server/dist/external/org/decisions-rejected.js.map +1 -0
- package/server/dist/external/org/proposed-confusables.d.ts +3 -0
- package/server/dist/external/org/proposed-confusables.d.ts.map +1 -0
- package/server/dist/external/org/proposed-confusables.js +38 -0
- package/server/dist/external/org/proposed-confusables.js.map +1 -0
- package/server/dist/external/org/proposed-decision-key.d.ts +2 -0
- package/server/dist/external/org/proposed-decision-key.d.ts.map +1 -0
- package/server/dist/external/org/proposed-decision-key.js +29 -0
- package/server/dist/external/org/proposed-decision-key.js.map +1 -0
- package/server/dist/external/org/proposed-entry-format.d.ts +32 -0
- package/server/dist/external/org/proposed-entry-format.d.ts.map +1 -0
- package/server/dist/external/org/proposed-entry-format.js +160 -0
- package/server/dist/external/org/proposed-entry-format.js.map +1 -0
- package/server/dist/external/org/proposed-evidence-pointer.d.ts +38 -0
- package/server/dist/external/org/proposed-evidence-pointer.d.ts.map +1 -0
- package/server/dist/external/org/proposed-evidence-pointer.js +82 -0
- package/server/dist/external/org/proposed-evidence-pointer.js.map +1 -0
- package/server/dist/external/org/proposed-grammar.d.ts +99 -0
- package/server/dist/external/org/proposed-grammar.d.ts.map +1 -0
- package/server/dist/external/org/proposed-grammar.js +249 -0
- package/server/dist/external/org/proposed-grammar.js.map +1 -0
- package/server/dist/external/org/proposed-line.d.ts +86 -0
- package/server/dist/external/org/proposed-line.d.ts.map +1 -0
- package/server/dist/external/org/proposed-line.js +154 -0
- package/server/dist/external/org/proposed-line.js.map +1 -0
- package/server/dist/external/org/reject-core.d.ts +42 -0
- package/server/dist/external/org/reject-core.d.ts.map +1 -0
- package/server/dist/external/org/reject-core.js +131 -0
- package/server/dist/external/org/reject-core.js.map +1 -0
- package/server/dist/external/org/reject-request.d.ts +11 -0
- package/server/dist/external/org/reject-request.d.ts.map +1 -0
- package/server/dist/external/org/reject-request.js +86 -0
- package/server/dist/external/org/reject-request.js.map +1 -0
- package/server/dist/index.d.ts.map +1 -1
- package/server/dist/index.js +2 -0
- package/server/dist/index.js.map +1 -1
- package/server/dist/routes/org-write-guard.d.ts +3 -0
- package/server/dist/routes/org-write-guard.d.ts.map +1 -0
- package/server/dist/routes/org-write-guard.js +30 -0
- package/server/dist/routes/org-write-guard.js.map +1 -0
- package/server/dist/routes/org-writes.d.ts.map +1 -1
- package/server/dist/routes/org-writes.js +56 -0
- package/server/dist/routes/org-writes.js.map +1 -1
- package/server/dist/routes/org.d.ts.map +1 -1
- package/server/dist/routes/org.js +3 -0
- package/server/dist/routes/org.js.map +1 -1
- package/server/dist/routes/reminder-mail-wiring.d.ts +5 -0
- package/server/dist/routes/reminder-mail-wiring.d.ts.map +1 -0
- package/server/dist/routes/reminder-mail-wiring.js +27 -0
- package/server/dist/routes/reminder-mail-wiring.js.map +1 -0
- package/server/dist/routes/reminder-mail.d.ts +8 -0
- package/server/dist/routes/reminder-mail.d.ts.map +1 -0
- package/server/dist/routes/reminder-mail.js +92 -0
- package/server/dist/routes/reminder-mail.js.map +1 -0
- package/server/dist/routes/reminders.d.ts +20 -0
- package/server/dist/routes/reminders.d.ts.map +1 -0
- package/server/dist/routes/reminders.js +183 -0
- package/server/dist/routes/reminders.js.map +1 -0
- package/server/dist/terminal/pty-raw-write.d.ts +18 -0
- package/server/dist/terminal/pty-raw-write.d.ts.map +1 -0
- package/server/dist/terminal/pty-raw-write.js +81 -0
- package/server/dist/terminal/pty-raw-write.js.map +1 -0
- package/server/dist/terminal/pty-write-chunker.d.ts +5 -11
- package/server/dist/terminal/pty-write-chunker.d.ts.map +1 -1
- package/server/dist/terminal/pty-write-chunker.js +55 -59
- package/server/dist/terminal/pty-write-chunker.js.map +1 -1
- package/server/package.json +6 -4
- package/client/dist/assets/channel-Ca6xBdrB.js +0 -1
- package/client/dist/assets/classDiagram-ZZMXUADV-CUp5IqKw.js +0 -1
- package/client/dist/assets/classDiagram-v2-VYDZK3BY-CUp5IqKw.js +0 -1
- package/client/dist/assets/index-BTHBdVBX.js +0 -1017
- package/client/dist/assets/stateDiagram-v2-MP3YSRHH-BDaWnw_s.js +0 -1
- package/client/dist/assets/swimlanesDiagram-VR7AAH4N-mtbVRccr.js +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposed-evidence-pointer.js","sourceRoot":"","sources":["../../../src/external/org/proposed-evidence-pointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkBH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAY,EAAW,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;AAE7E,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA,gDAAgD,CAAC;AAC/E,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,2BAA2B,WAAW,cAAc,CAAC,CAAC;AACpG,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,sCAAsC,WAAW,uBAAuB,CAAC,CAAC;AAEvH,4GAA4G;AAC5G,MAAM,CAAC,MAAM,iBAAiB,GAAG,IA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AI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACpD,CAAC;AAED;;4EAE4E;AAC5E,MAAM,UAAU,cAAc,CAAC,GAAkB;IAC/C,MAAM,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACpD,MAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,IAAI,CAAC,CAAC,MAAM,GAAG,iBAAiB;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IACrE,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { parseSourceRef, isKnownSource, type SourceRef } from "./proposed-evidence-pointer.js";
|
|
2
|
+
export declare const WEBUI_HEADER_RE: RegExp;
|
|
3
|
+
export declare const DAEMON_HEADER_RE: RegExp;
|
|
4
|
+
export declare const DAEMON_MARKER_RE: RegExp;
|
|
5
|
+
export declare const FENCE_LINE_RE: RegExp;
|
|
6
|
+
export declare const LEAD_ID_RE: RegExp;
|
|
7
|
+
export declare const LEAD_BULLET_RE: RegExp;
|
|
8
|
+
export declare const EVIDENCE_BULLET_RE: RegExp;
|
|
9
|
+
export declare const FENCE_LABEL_PREFIX = "[FENCED DATA";
|
|
10
|
+
export declare const ISO_TIMESTAMP_RE: RegExp;
|
|
11
|
+
export declare const stripBom: (s: string) => string;
|
|
12
|
+
export declare const isBlank: (line: string) => boolean;
|
|
13
|
+
/** First line after `open` equal to it, ignoring a trailing CR; -1 if none. */
|
|
14
|
+
export declare function findClose(lines: string[], open: number): number;
|
|
15
|
+
/** After a closing fence line the daemon writes: blank, Lead bullet, Evidence
|
|
16
|
+
* bullet. Returns the index just past the Evidence bullet, or -1. */
|
|
17
|
+
export declare function canonicalTailEnd(lines: string[], close: number): number;
|
|
18
|
+
export declare function markerAbove(lines: string[], idx: number): boolean;
|
|
19
|
+
export declare function structuralInside(lines: string[], from: number, to: number): boolean;
|
|
20
|
+
/** Which file is being read: a proposed file only knows `## Proposed` owners
|
|
21
|
+
* (with their marker above), decision_log.md only `## ADR-` owners. */
|
|
22
|
+
export type FenceFileKind = "proposed" | "logged";
|
|
23
|
+
export interface FenceScan {
|
|
24
|
+
/** Lines inside a fenced region (open line, label, text, close line). */
|
|
25
|
+
fenced: Set<number>;
|
|
26
|
+
/** Owner header lines whose region is ambiguous: never listed (proposed). */
|
|
27
|
+
ambiguousOwners: Set<number>;
|
|
28
|
+
/** Proposed file: lines at or after this index cannot be trusted (a dangling
|
|
29
|
+
* opener has no valid close). `lines.length` when nothing is poisoned. */
|
|
30
|
+
poisonFrom: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A fence opens ONLY where the daemon puts it: the first line after an owner
|
|
34
|
+
* header (marker/blank skipped) that is a fence line followed by the label; it
|
|
35
|
+
* closes at the next identical line, which must be followed by the canonical
|
|
36
|
+
* Lead/Evidence tail. proposed: a region holding any structural line is
|
|
37
|
+
* ambiguous (owner unlisted, region masked); an opener without a valid close
|
|
38
|
+
* poisons everything after it. logged: single writer (the countersign), so a
|
|
39
|
+
* valid region is ALWAYS masked - quoted `## ADR-` lines never become entries.
|
|
40
|
+
*/
|
|
41
|
+
export declare function scanFences(lines: string[], kind: FenceFileKind): FenceScan;
|
|
42
|
+
/** Lines of a daemon entry that come after its closing fence line (or the
|
|
43
|
+
* whole block when it has no fence). */
|
|
44
|
+
export declare function daemonTail(blockLines: string[]): string[];
|
|
45
|
+
/** A daemon entry is exactly what `renderEntry` writes: marker, header, blank,
|
|
46
|
+
* fence + label + plain text + fence, blank, Lead, Evidence, nothing else. Any
|
|
47
|
+
* extra line, or any structural line inside the quote, makes it non-canonical:
|
|
48
|
+
* not listed, so never countersigned into the log. */
|
|
49
|
+
export declare function isCanonicalDaemonBlock(blockLines: string[]): boolean;
|
|
50
|
+
/** First bullet of `lines` matching `re` (capture 1, trimmed), or null. */
|
|
51
|
+
export declare function firstBullet(lines: string[], re: RegExp): string | null;
|
|
52
|
+
export { parseSourceRef, isKnownSource };
|
|
53
|
+
export type { SourceRef };
|
|
54
|
+
/** The Evidence bullet as leadwright writes it: `<pointer> — "<quote>"` (the quote is one line and may itself hold
|
|
55
|
+
* ` — ` or `"`: the match is greedy). Only a KNOWN pointer in front (session excerpt, file line or journal event)
|
|
56
|
+
* licenses a quote; any other text is handled exactly as `parseSourceRef` does (unknown, no quote). */
|
|
57
|
+
export declare function parseEvidence(raw: string | null): {
|
|
58
|
+
source: SourceRef;
|
|
59
|
+
quote: string | null;
|
|
60
|
+
};
|
|
61
|
+
/** The quote of an Evidence bullet in the `<pointer> — "<quote>"` shape WHATEVER the pointer, for the copy guard only:
|
|
62
|
+
* the reader refuses some pointers the daemon accepts (display hardening), and a needle can only make the guard
|
|
63
|
+
* stricter. Display and audit use `parseEvidence`, which licenses a quote only behind a known pointer. */
|
|
64
|
+
export declare function evidenceQuoteForGuard(raw: string | null): string | null;
|
|
65
|
+
export interface FencedParts {
|
|
66
|
+
/** The fence label line (carries the beat). */
|
|
67
|
+
label: string;
|
|
68
|
+
/** Fenced lines that are not quotes: the proposed line. */
|
|
69
|
+
proposed: string[];
|
|
70
|
+
/** Fenced lines starting with `>`, verbatim. */
|
|
71
|
+
quotes: string[];
|
|
72
|
+
}
|
|
73
|
+
/** The ONE rule that splits a fenced region into proposed line and quotes: a
|
|
74
|
+
* line starting with `>` is a quote, every other line is the proposed line.
|
|
75
|
+
* `null` when the block has no fence where the daemon puts it. The block must already be canonical: a fence
|
|
76
|
+
* opened by the daemon's own label line, lines split on LF (a trailing CR is dropped). */
|
|
77
|
+
export declare function fencedParts(blockLines: string[]): FencedParts | null;
|
|
78
|
+
export declare const QUOTE_PREFIX_RE: RegExp;
|
|
79
|
+
/** ONE quote line -> its text and, when the suffix after the LAST ` — ` looks like a pointer attempt, that pointer.
|
|
80
|
+
* An em dash inside the quote text stays in it. */
|
|
81
|
+
export declare function splitQuote(line: string): {
|
|
82
|
+
text: string;
|
|
83
|
+
pointer: string | null;
|
|
84
|
+
};
|
|
85
|
+
/** Comparison form of a text: Unicode-folded (NFKC, so NBSP and wide forms), every invisible character removed
|
|
86
|
+
* (including emoji presentation selectors), look-alike letters of a small bounded Cyrillic/Greek list mapped to their
|
|
87
|
+
* Latin twin (`foldConfusables`), one line, lower case. Never written anywhere. It strips exactly what
|
|
88
|
+
* `normalizeLine` strips on the write path, and more (it also drops the emoji selector), so a line can never hide a
|
|
89
|
+
* quote by an invisible difference. */
|
|
90
|
+
export declare function foldForCompare(text: string): string;
|
|
91
|
+
/** Invisible characters removed from anything shown as, or written as, the line (see INVISIBLE). The log is read by
|
|
92
|
+
* agents as authority. `keepEmojiPresentation` (default) keeps U+FE0F after an emoji base; ZWJ stays stripped. */
|
|
93
|
+
export declare function stripInvisible(text: string, keepEmojiPresentation?: boolean): string;
|
|
94
|
+
/** One line for the log: invisible characters removed, Unicode space separators (NBSP, ideographic space, ...)
|
|
95
|
+
* become a plain space, control characters (newlines too) and runs of blanks become one space. */
|
|
96
|
+
export declare function normalizeLine(text: string): string;
|
|
97
|
+
/** The text both sides hash to tell "the entry I saw" from "the entry now": no BOM, no CR, no trailing blanks. */
|
|
98
|
+
export declare const blockForDigest: (block: string) => string;
|
|
99
|
+
//# sourceMappingURL=proposed-grammar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposed-grammar.d.ts","sourceRoot":"","sources":["../../../src/external/org/proposed-grammar.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAI/F,eAAO,MAAM,eAAe,QAA+B,CAAC;AAC5D,eAAO,MAAM,gBAAgB,QAAmC,CAAC;AACjE,eAAO,MAAM,gBAAgB,QAAqC,CAAC;AACnE,eAAO,MAAM,aAAa,QAAsC,CAAC;AACjE,eAAO,MAAM,UAAU,QAAyB,CAAC;AACjD,eAAO,MAAM,cAAc,QAAwC,CAAC;AACpE,eAAO,MAAM,kBAAkB,QAA4C,CAAC;AAC5E,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAGjD,eAAO,MAAM,gBAAgB,QAAmD,CAAC;AAEjF,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MAAuD,CAAC;AAC7F,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,OAA6B,CAAC;AAErE,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI/D;AAED;sEACsE;AACtE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAIjE;AAUD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAGnF;AAED;wEACwE;AACxE,MAAM,MAAM,aAAa,GA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AAM,EAAE,GAAG,WAAW,GAAG,IAAI,CAOpE;AAED,eAAO,MAAM,eAAe,QAAgB,CAAC;AAI7C;oDACoD;AACpD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAMjF;AAED;;;;wCAIwC;AACxC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAUD;mHACmH;AACnH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,qBAAqB,UAAO,GAAG,MAAM,CAEjF;AAED;mGACmG;AACnG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,kHAAkH;AAClH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAAsD,CAAC"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* external/org/proposed-grammar.ts — the line grammar of `decisions-proposed.md`
|
|
3
|
+
* / `decision_log.md` entries written by the leadwright daemon (W1). Contract:
|
|
4
|
+
* `docs/org-proposed-entry-contract.md`.
|
|
5
|
+
*
|
|
6
|
+
* Everything below the GRAMMAR marker is mirrored VERBATIM in
|
|
7
|
+
* `client/src/lib/orgProposedGrammar.ts` (CLAUDE.md rule 7: no cross-package
|
|
8
|
+
* import); `orgDecisionsApi.daemon-header.test.ts` fails when the two bodies
|
|
9
|
+
* differ, and the shared adversarial corpus is the behavioural parity gate.
|
|
10
|
+
*
|
|
11
|
+
* Integrity beats availability on the reading side: whenever a fence is
|
|
12
|
+
* ambiguous (a fence line, marker or header-looking line inside the quote, or
|
|
13
|
+
* an opener with no valid close) the owner entry is NOT listed and nothing
|
|
14
|
+
* inside the region is listed either - an unlisted proposal is acceptable, a
|
|
15
|
+
* forged one is not.
|
|
16
|
+
*/
|
|
17
|
+
import { foldConfusables } from "./proposed-confusables.js";
|
|
18
|
+
import { parseSourceRef, isKnownSource } from "./proposed-evidence-pointer.js";
|
|
19
|
+
// ---- GRAMMAR (verbatim mirror below this line) ----
|
|
20
|
+
export const WEBUI_HEADER_RE = /^## \[([^\]]+)\] (.+?)\r?$/;
|
|
21
|
+
export const DAEMON_HEADER_RE = /^## Proposed (\S+) — (.+?)\r?$/;
|
|
22
|
+
export const DAEMON_MARKER_RE = /^<!--[ \t]*decisionKey:.*-->\r?$/; // linear: no adjacent overlapping quantifiers
|
|
23
|
+
export const FENCE_LINE_RE = /^⟦SHIPWRIGHT-FENCE:[0-9a-f]+⟧\r?$/;
|
|
24
|
+
export const LEAD_ID_RE = /^[a-z0-9][a-z0-9-]*$/; // same rule as the countersign route
|
|
25
|
+
export const LEAD_BULLET_RE = /^-[ \t]*\*\*Lead:\*\*([^\r\n]*)\r?$/;
|
|
26
|
+
export const EVIDENCE_BULLET_RE = /^-[ \t]*\*\*Evidence:\*\*([^\r\n]*)\r?$/;
|
|
27
|
+
export const FENCE_LABEL_PREFIX = "[FENCED DATA";
|
|
28
|
+
const LOGGED_HEADER_LINE_RE = /^## ADR-\d{4,} \[/;
|
|
29
|
+
const PROPOSAL_MARKER_RE = /^<!--[ \t]*proposal:/; // only countersign writes it (the log's block fingerprint)
|
|
30
|
+
export const ISO_TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/; // same rule as the countersign route
|
|
31
|
+
export const stripBom = (s) => (s.charCodeAt(0) === 0xfeff ? s.slice(1) : s);
|
|
32
|
+
export const isBlank = (line) => line.trim() === "";
|
|
33
|
+
/** First line after `open` equal to it, ignoring a trailing CR; -1 if none. */
|
|
34
|
+
export function findClose(lines, open) {
|
|
35
|
+
const want = lines[open].trimEnd();
|
|
36
|
+
for (let k = open + 1; k < lines.length; k++)
|
|
37
|
+
if (lines[k].trimEnd() === want)
|
|
38
|
+
return k;
|
|
39
|
+
return -1;
|
|
40
|
+
}
|
|
41
|
+
/** After a closing fence line the daemon writes: blank, Lead bullet, Evidence
|
|
42
|
+
* bullet. Returns the index just past the Evidence bullet, or -1. */
|
|
43
|
+
export function canonicalTailEnd(lines, close) {
|
|
44
|
+
let j = close + 1;
|
|
45
|
+
if (j >= lines.length || !isBlank(lines[j]))
|
|
46
|
+
return -1;
|
|
47
|
+
while (j < lines.length && isBlank(lines[j]))
|
|
48
|
+
j++;
|
|
49
|
+
if (!LEAD_BULLET_RE.test(lines[j] ?? "") || !EVIDENCE_BULLET_RE.test(lines[j + 1] ?? ""))
|
|
50
|
+
return -1;
|
|
51
|
+
return j + 2;
|
|
52
|
+
}
|
|
53
|
+
export function markerAbove(lines, idx) {
|
|
54
|
+
let m = idx - 1;
|
|
55
|
+
while (m >= 0 && isBlank(lines[m]))
|
|
56
|
+
m--;
|
|
57
|
+
return m >= 0 && DAEMON_MARKER_RE.test(lines[m]);
|
|
58
|
+
}
|
|
59
|
+
/** Anything that only a real entry (or an injected fake one) contains. */
|
|
60
|
+
function isStructural(line) {
|
|
61
|
+
return (FENCE_LINE_RE.test(line) || DAEMON_MARKER_RE.test(line) || WEBUI_HEADER_RE.test(line) ||
|
|
62
|
+
DAEMON_HEADER_RE.test(line) || LOGGED_HEADER_LINE_RE.test(line) || PROPOSAL_MARKER_RE.test(line));
|
|
63
|
+
}
|
|
64
|
+
export function structuralInside(lines, from, to) {
|
|
65
|
+
for (let k = from; k < to; k++)
|
|
66
|
+
if (isStructural(lines[k]))
|
|
67
|
+
return true;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const OWNER_RE = {
|
|
71
|
+
proposed: /^## (Proposed \S+ — |\[[^\]]+\] )/, // daemon form, or a WebUI-form header that has a marker above
|
|
72
|
+
logged: /^## ADR-\d{4,} \[/,
|
|
73
|
+
};
|
|
74
|
+
/** logged: a masked region must never swallow another entry's owner header. */
|
|
75
|
+
function crossesLoggedOwner(lines, from, to) {
|
|
76
|
+
for (let k = from; k < to; k++) {
|
|
77
|
+
if (LOGGED_HEADER_LINE_RE.test(lines[k]) && DAEMON_MARKER_RE.test(lines[k + 1] ?? ""))
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A fence opens ONLY where the daemon puts it: the first line after an owner
|
|
84
|
+
* header (marker/blank skipped) that is a fence line followed by the label; it
|
|
85
|
+
* closes at the next identical line, which must be followed by the canonical
|
|
86
|
+
* Lead/Evidence tail. proposed: a region holding any structural line is
|
|
87
|
+
* ambiguous (owner unlisted, region masked); an opener without a valid close
|
|
88
|
+
* poisons everything after it. logged: single writer (the countersign), so a
|
|
89
|
+
* valid region is ALWAYS masked - quoted `## ADR-` lines never become entries.
|
|
90
|
+
*/
|
|
91
|
+
export function scanFences(lines, kind) {
|
|
92
|
+
const fenced = new Set();
|
|
93
|
+
const ambiguousOwners = new Set();
|
|
94
|
+
let poisonFrom = lines.length;
|
|
95
|
+
let i = 0;
|
|
96
|
+
while (i < lines.length) {
|
|
97
|
+
// proposed: owner = header with its decisionKey marker above; logged: owner = ADR header
|
|
98
|
+
// directly followed by a marker (the only shape countersign writes for a daemon entry)
|
|
99
|
+
// (owner shape first: the marker lookup only runs for owner-shaped lines)
|
|
100
|
+
if (OWNER_RE[kind].test(lines[i]) && (kind === "proposed" ? markerAbove(lines, i) : DAEMON_MARKER_RE.test(lines[i + 1] ?? ""))) {
|
|
101
|
+
let j = i + 1;
|
|
102
|
+
while (j < lines.length && (isBlank(lines[j]) || DAEMON_MARKER_RE.test(lines[j])))
|
|
103
|
+
j++;
|
|
104
|
+
if (j + 1 < lines.length && FENCE_LINE_RE.test(lines[j]) && lines[j + 1].startsWith(FENCE_LABEL_PREFIX)) {
|
|
105
|
+
const close = findClose(lines, j);
|
|
106
|
+
if (close !== -1 && canonicalTailEnd(lines, close) !== -1 && !(kind === "logged" && crossesLoggedOwner(lines, j, close))) {
|
|
107
|
+
for (let k = j; k <= close; k++)
|
|
108
|
+
fenced.add(k);
|
|
109
|
+
if (kind === "proposed" && structuralInside(lines, j + 2, close))
|
|
110
|
+
ambiguousOwners.add(i);
|
|
111
|
+
i = close + 1;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (kind === "proposed") {
|
|
115
|
+
ambiguousOwners.add(i);
|
|
116
|
+
poisonFrom = j;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
i++;
|
|
122
|
+
}
|
|
123
|
+
return { fenced, ambiguousOwners, poisonFrom };
|
|
124
|
+
}
|
|
125
|
+
/** Lines of a daemon entry that come after its closing fence line (or the
|
|
126
|
+
* whole block when it has no fence). */
|
|
127
|
+
export function daemonTail(blockLines) {
|
|
128
|
+
let j = 0;
|
|
129
|
+
while (j < blockLines.length && (isBlank(blockLines[j]) || DAEMON_MARKER_RE.test(blockLines[j]) || blockLines[j].startsWith("## ")))
|
|
130
|
+
j++;
|
|
131
|
+
// No fence where the daemon puts it: no quote to skip, the rest is the tail.
|
|
132
|
+
if (!(FENCE_LINE_RE.test(blockLines[j] ?? "") && (blockLines[j + 1] ?? "").startsWith(FENCE_LABEL_PREFIX)))
|
|
133
|
+
return blockLines.slice(j);
|
|
134
|
+
const close = findClose(blockLines, j);
|
|
135
|
+
return close === -1 ? [] : blockLines.slice(close + 1); // unclosed fence = corrupt: no identity
|
|
136
|
+
}
|
|
137
|
+
/** A daemon entry is exactly what `renderEntry` writes: marker, header, blank,
|
|
138
|
+
* fence + label + plain text + fence, blank, Lead, Evidence, nothing else. Any
|
|
139
|
+
* extra line, or any structural line inside the quote, makes it non-canonical:
|
|
140
|
+
* not listed, so never countersigned into the log. */
|
|
141
|
+
export function isCanonicalDaemonBlock(blockLines) {
|
|
142
|
+
let j = 0;
|
|
143
|
+
let sawMarker = false;
|
|
144
|
+
while (j < blockLines.length && (isBlank(blockLines[j]) || DAEMON_MARKER_RE.test(blockLines[j]))) {
|
|
145
|
+
if (!isBlank(blockLines[j]))
|
|
146
|
+
sawMarker = true;
|
|
147
|
+
j++;
|
|
148
|
+
}
|
|
149
|
+
if (!sawMarker)
|
|
150
|
+
return false; // listing and masking use one rule: a daemon entry has its marker
|
|
151
|
+
const header = blockLines[j] ?? "";
|
|
152
|
+
if (!DAEMON_HEADER_RE.test(header) && !WEBUI_HEADER_RE.test(header))
|
|
153
|
+
return false;
|
|
154
|
+
j++;
|
|
155
|
+
while (j < blockLines.length && isBlank(blockLines[j]))
|
|
156
|
+
j++;
|
|
157
|
+
if (!FENCE_LINE_RE.test(blockLines[j] ?? "") || !(blockLines[j + 1] ?? "").startsWith(FENCE_LABEL_PREFIX))
|
|
158
|
+
return false;
|
|
159
|
+
const close = findClose(blockLines, j);
|
|
160
|
+
if (close === -1 || structuralInside(blockLines, j + 2, close))
|
|
161
|
+
return false;
|
|
162
|
+
const end = canonicalTailEnd(blockLines, close);
|
|
163
|
+
return end !== -1 && blockLines.slice(end).every(isBlank);
|
|
164
|
+
}
|
|
165
|
+
/** First bullet of `lines` matching `re` (capture 1, trimmed), or null. */
|
|
166
|
+
export function firstBullet(lines, re) {
|
|
167
|
+
for (const l of lines) {
|
|
168
|
+
const m = re.exec(l);
|
|
169
|
+
if (m)
|
|
170
|
+
return m[1].trim();
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
// ---- W4: proposed line / quote classification and evidence pointer ----
|
|
175
|
+
// The pointer forms (session excerpt, file line, journal event) live in the mirrored evidence-pointer module.
|
|
176
|
+
export { parseSourceRef, isKnownSource };
|
|
177
|
+
const EVIDENCE_QUOTE_RE = /^(\S+) — "([^\r\n]*)"$/;
|
|
178
|
+
/** The Evidence bullet as leadwright writes it: `<pointer> — "<quote>"` (the quote is one line and may itself hold
|
|
179
|
+
* ` — ` or `"`: the match is greedy). Only a KNOWN pointer in front (session excerpt, file line or journal event)
|
|
180
|
+
* licenses a quote; any other text is handled exactly as `parseSourceRef` does (unknown, no quote). */
|
|
181
|
+
export function parseEvidence(raw) {
|
|
182
|
+
const t = raw?.trim() ?? "";
|
|
183
|
+
const m = EVIDENCE_QUOTE_RE.exec(t);
|
|
184
|
+
const source = m ? parseSourceRef(m[1]) : null;
|
|
185
|
+
if (m === null || source === null || !isKnownSource(source))
|
|
186
|
+
return { source: parseSourceRef(t), quote: null };
|
|
187
|
+
return { source, quote: stripInvisible(m[2]).trim() === "" ? null : m[2] };
|
|
188
|
+
}
|
|
189
|
+
/** The quote of an Evidence bullet in the `<pointer> — "<quote>"` shape WHATEVER the pointer, for the copy guard only:
|
|
190
|
+
* the reader refuses some pointers the daemon accepts (display hardening), and a needle can only make the guard
|
|
191
|
+
* stricter. Display and audit use `parseEvidence`, which licenses a quote only behind a known pointer. */
|
|
192
|
+
export function evidenceQuoteForGuard(raw) {
|
|
193
|
+
const m = EVIDENCE_QUOTE_RE.exec(raw?.trim() ?? "");
|
|
194
|
+
return m === null || stripInvisible(m[2]).trim() === "" ? null : m[2];
|
|
195
|
+
}
|
|
196
|
+
/** The ONE rule that splits a fenced region into proposed line and quotes: a
|
|
197
|
+
* line starting with `>` is a quote, every other line is the proposed line.
|
|
198
|
+
* `null` when the block has no fence where the daemon puts it. The block must already be canonical: a fence
|
|
199
|
+
* opened by the daemon's own label line, lines split on LF (a trailing CR is dropped). */
|
|
200
|
+
export function fencedParts(blockLines) {
|
|
201
|
+
const lines = blockLines.map((l) => l.replace(/\r$/, ""));
|
|
202
|
+
const open = lines.findIndex((l, i) => FENCE_LINE_RE.test(l) && (lines[i + 1] ?? "").startsWith(FENCE_LABEL_PREFIX));
|
|
203
|
+
const close = open === -1 ? -1 : findClose(lines, open);
|
|
204
|
+
if (open === -1 || close === -1)
|
|
205
|
+
return null;
|
|
206
|
+
const inside = lines.slice(open + 2, close);
|
|
207
|
+
return { label: lines[open + 1], proposed: inside.filter((l) => !l.trimStart().startsWith(">")), quotes: inside.filter((l) => l.trimStart().startsWith(">")) };
|
|
208
|
+
}
|
|
209
|
+
export const QUOTE_PREFIX_RE = /^\s*>[ \t]?/;
|
|
210
|
+
const QUOTE_SEP = " — ";
|
|
211
|
+
const POINTER_ATTEMPT_RE = /^(?:session\b|[A-Za-z0-9_-]{4,}:\S|[A-Za-z0-9_-]+:\d{4}-\d{2})/;
|
|
212
|
+
/** ONE quote line -> its text and, when the suffix after the LAST ` — ` looks like a pointer attempt, that pointer.
|
|
213
|
+
* An em dash inside the quote text stays in it. */
|
|
214
|
+
export function splitQuote(line) {
|
|
215
|
+
const body = line.replace(QUOTE_PREFIX_RE, "");
|
|
216
|
+
const at = body.lastIndexOf(QUOTE_SEP);
|
|
217
|
+
const suffix = at === -1 ? "" : body.slice(at + QUOTE_SEP.length).trim();
|
|
218
|
+
if (at === -1 || !POINTER_ATTEMPT_RE.test(suffix))
|
|
219
|
+
return { text: body.trim(), pointer: null };
|
|
220
|
+
return { text: body.slice(0, at).trim(), pointer: suffix };
|
|
221
|
+
}
|
|
222
|
+
/** Comparison form of a text: Unicode-folded (NFKC, so NBSP and wide forms), every invisible character removed
|
|
223
|
+
* (including emoji presentation selectors), look-alike letters of a small bounded Cyrillic/Greek list mapped to their
|
|
224
|
+
* Latin twin (`foldConfusables`), one line, lower case. Never written anywhere. It strips exactly what
|
|
225
|
+
* `normalizeLine` strips on the write path, and more (it also drops the emoji selector), so a line can never hide a
|
|
226
|
+
* quote by an invisible difference. */
|
|
227
|
+
export function foldForCompare(text) {
|
|
228
|
+
return foldConfusables(foldConfusables(normalizeLine(stripInvisible(stripInvisible(text, false).normalize("NFKC"), false))).toLowerCase());
|
|
229
|
+
}
|
|
230
|
+
// Code points that render as nothing: format characters (tag characters, bidi overrides, zero width, ...), default
|
|
231
|
+
// ignorables (variation selectors, fillers), private use, lone surrogates, C1 controls and the braille blank.
|
|
232
|
+
const INVISIBLE = String.raw `\p{Cf}\p{Default_Ignorable_Code_Point}\p{Co}\p{Cs}\u0080-\u009f\u2800\uFDD0-\uFDEF\uFFFE\uFFFF`;
|
|
233
|
+
const INVISIBLE_ALL_RE = new RegExp(`[${INVISIBLE}]`, "gu");
|
|
234
|
+
// An emoji presentation selector (U+FE0F) that directly follows an emoji base (or a keycap base before U+20E3) is
|
|
235
|
+
// kept: dropping it turns a red heart into a text glyph. Every other selector is removed.
|
|
236
|
+
const INVISIBLE_KEEP_EMOJI_RE = new RegExp(String.raw `(\p{Extended_Pictographic}\uFE0F)|([0-9#*]\uFE0F(?=\u20E3))|[${INVISIBLE}]`, "gu");
|
|
237
|
+
/** Invisible characters removed from anything shown as, or written as, the line (see INVISIBLE). The log is read by
|
|
238
|
+
* agents as authority. `keepEmojiPresentation` (default) keeps U+FE0F after an emoji base; ZWJ stays stripped. */
|
|
239
|
+
export function stripInvisible(text, keepEmojiPresentation = true) {
|
|
240
|
+
return keepEmojiPresentation ? text.replace(INVISIBLE_KEEP_EMOJI_RE, (_m, emoji, keycap) => emoji ?? keycap ?? "") : text.replace(INVISIBLE_ALL_RE, "");
|
|
241
|
+
}
|
|
242
|
+
/** One line for the log: invisible characters removed, Unicode space separators (NBSP, ideographic space, ...)
|
|
243
|
+
* become a plain space, control characters (newlines too) and runs of blanks become one space. */
|
|
244
|
+
export function normalizeLine(text) {
|
|
245
|
+
return stripInvisible(text).replace(/\p{Zs}/gu, " ").replace(/[\u0000-\u001f\u007f\u2028\u2029]+/g, " ").replace(/ {2,}/g, " ").trim();
|
|
246
|
+
}
|
|
247
|
+
/** The text both sides hash to tell "the entry I saw" from "the entry now": no BOM, no CR, no trailing blanks. */
|
|
248
|
+
export const blockForDigest = (block) => stripBom(block).replace(/\r/g, "").trimEnd();
|
|
249
|
+
//# sourceMappingURL=proposed-grammar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposed-grammar.js","sourceRoot":"","sources":["../../../src/external/org/proposed-grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,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C"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { SourceRef } from "./proposed-evidence-pointer.js";
|
|
2
|
+
import type { ProposedEntry } from "./proposed-entry-format.js";
|
|
3
|
+
export declare const LINE_MAX = 2000;
|
|
4
|
+
/** A shared run of this many (folded) characters between a line and a quote counts as a copy. A quote shorter than
|
|
5
|
+
* this is never guarded: it is too likely to occur in an honest sentence. */
|
|
6
|
+
export declare const QUOTE_GUARD_MIN = 20;
|
|
7
|
+
/** The audit's structured evidence pointer (`data.evidence`). The session form keeps its original shape (no `form`
|
|
8
|
+
* field, so records written before the other forms read the same); the file-line and journal-event forms carry a
|
|
9
|
+
* `form` discriminator and their DECODED fields. Never the quote. */
|
|
10
|
+
export type EvidencePointer = {
|
|
11
|
+
session: string;
|
|
12
|
+
time: string;
|
|
13
|
+
message: string;
|
|
14
|
+
} | {
|
|
15
|
+
form: "file";
|
|
16
|
+
project: string;
|
|
17
|
+
path: string[];
|
|
18
|
+
line: number;
|
|
19
|
+
} | {
|
|
20
|
+
form: "event";
|
|
21
|
+
id: string;
|
|
22
|
+
} | {
|
|
23
|
+
form: "rejected";
|
|
24
|
+
time: string;
|
|
25
|
+
lead: string;
|
|
26
|
+
} | {
|
|
27
|
+
form: "decision";
|
|
28
|
+
adr: string;
|
|
29
|
+
};
|
|
30
|
+
/** `null` for an unknown source: free text is never copied into the audit. */
|
|
31
|
+
export declare function auditEvidence(s: SourceRef): EvidencePointer | null;
|
|
32
|
+
export interface ProposalFacts {
|
|
33
|
+
/** The proposed line as the lead wrote it, normalised to one line. */
|
|
34
|
+
original: string;
|
|
35
|
+
/** Folded quote texts (with and without the pointer suffix), used only to refuse a copy. */
|
|
36
|
+
quotes: string[];
|
|
37
|
+
/** The entry's evidence pointer when it has a known shape (session, file line, journal event); `null` otherwise. */
|
|
38
|
+
evidence: EvidencePointer | null;
|
|
39
|
+
}
|
|
40
|
+
/** A non-text fingerprint of the proposed block: same identity + different block is told apart from crash
|
|
41
|
+
* residue by it, since the log keeps no original. It hides the block only because the fence nonce is random:
|
|
42
|
+
* a block whose nonce is shorter than 128 bits (32 hex) gets NO fingerprint (`null`) and is never trusted as residue. */
|
|
43
|
+
export declare function proposalFingerprint(block: string): string | null;
|
|
44
|
+
/** What a browser sends to say "this is the entry I saw": a digest of the block's text (the same text the client
|
|
45
|
+
* hashes, see `blockForDigest`). Countersign / reject compare it under the lock, so a lead that rewrote the entry
|
|
46
|
+
* under the same identity between render and click is caught. Not a secret: change detection only. */
|
|
47
|
+
export declare function blockDigest(block: string): string;
|
|
48
|
+
/** `null` for an entry without a fence (old marker-less WebUI form): nothing to edit, nothing to strip. */
|
|
49
|
+
export declare function proposalFacts(block: string): ProposalFacts | null;
|
|
50
|
+
export type LineVerdict = {
|
|
51
|
+
ok: true;
|
|
52
|
+
line: string;
|
|
53
|
+
} | {
|
|
54
|
+
ok: false;
|
|
55
|
+
error: "line_empty" | "line_too_long" | "line_contains_quote";
|
|
56
|
+
};
|
|
57
|
+
/** Validate the line the operator saw (edited or not) against the entry's quotes. `max` = the length limit. */
|
|
58
|
+
export declare function checkEditedLine(raw: string, facts: Pick<ProposalFacts, "quotes">, max?: number): LineVerdict;
|
|
59
|
+
/** The same checks for the line as proposed: an unedited line that repeats a quote (or is empty) needs an edit. */
|
|
60
|
+
export declare function checkOriginalLine(facts: ProposalFacts): LineVerdict;
|
|
61
|
+
/** Max length of an operator's reject reason or countersign note (after normalisation to one line). */
|
|
62
|
+
export declare const NOTE_MAX = 600;
|
|
63
|
+
export type NoteVerdict = {
|
|
64
|
+
ok: true;
|
|
65
|
+
text: string | null;
|
|
66
|
+
} | {
|
|
67
|
+
ok: false;
|
|
68
|
+
error: "too_long" | "contains_quote";
|
|
69
|
+
};
|
|
70
|
+
/** An operator's reject reason or countersign note: optional (absent or blank = `null`), and otherwise the same rules
|
|
71
|
+
* as an edited line - one line, invisible characters removed, at most NOTE_MAX characters, and never a copy of a
|
|
72
|
+
* quote of the entry. `facts === null` (an entry without a fence) has no quotes to guard. */
|
|
73
|
+
export declare function checkNoteText(raw: string | null | undefined, facts: Pick<ProposalFacts, "quotes"> | null): NoteVerdict;
|
|
74
|
+
/** The `- Note: <text>` item a countersign note adds below the logged line (text already passed `checkNoteText`). */
|
|
75
|
+
export declare const noteItem: (note: string | null | undefined) => string;
|
|
76
|
+
/** The log block of a fenced entry: header, key marker (identifier keys only), block fingerprint, the line, and the
|
|
77
|
+
* operator's note as its own item when there is one. */
|
|
78
|
+
export declare function toLoggedLineBlock(entry: ProposedEntry, number: number, line: string, note?: string | null): string;
|
|
79
|
+
/** The line, fingerprint and note of a block written by `toLoggedLineBlock`, or `null` for any other shape. */
|
|
80
|
+
export declare function parseLoggedLineBlock(loggedBlock: string): {
|
|
81
|
+
line: string;
|
|
82
|
+
fingerprint: string | null;
|
|
83
|
+
note: string | null;
|
|
84
|
+
} | null;
|
|
85
|
+
export declare function isEdited(facts: ProposalFacts, finalLine: string): boolean;
|
|
86
|
+
//# sourceMappingURL=proposed-line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposed-line.d.ts","sourceRoot":"","sources":["../../../src/external/org/proposed-line.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B;8EAC8E;AAC9E,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;sEAEsE;AACtE,MAAM,MAAM,eAAe,GACvB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GA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nE;AAED,uGAAuG;AACvG,eAAO,MAAM,QAAQ,MAAM,CAAC;AAE5B,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,CAAA;CAAE,CAAC;AAElH;;8FAE8F;AAC9F,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GAAG,IAAI,GAAG,WAAW,CAMtH;AAED,qHAAqH;AACrH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAmD,CAAC;AAE/G;yDACyD;AACzD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAOxH;AAQD,+GAA+G;AAC/G,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAIlI;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzE"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* external/org/proposed-line.ts — what countersign writes to `decision_log.md`
|
|
3
|
+
* for a fenced (daemon / marker-owned) proposal, and what it tells the audit
|
|
4
|
+
* (campaign shadow-proposals-webui, W4).
|
|
5
|
+
*
|
|
6
|
+
* The log gets ONE line: the proposed line, as the operator edited it or as
|
|
7
|
+
* the lead proposed it. Never the fence, the quotes, the Lead/Evidence bullets
|
|
8
|
+
* or the original wording of an edited line (operator decisions 4 + 5). The
|
|
9
|
+
* only lead-written text besides the line is the decisionKey, and only when it
|
|
10
|
+
* is a plain identifier (`decisionKeyOf`). The line is written as a list item
|
|
11
|
+
* on its own line, so no text of it can ever start a header, marker or fence.
|
|
12
|
+
*
|
|
13
|
+
* Documented limits: a look-alike (homoglyph, paraphrase, translation) of a quote is not detected; the evidence
|
|
14
|
+
* pointer's fields (session id, file project and path, event id; a pointer is at most 1024 characters) are
|
|
15
|
+
* lead-written, like the decisionKey, and are audited as such.
|
|
16
|
+
*
|
|
17
|
+
* The classification of fenced lines (line vs quote) and the quote split are the
|
|
18
|
+
* mirrored grammar's `fencedParts` / `splitQuote`; this module only decides what
|
|
19
|
+
* to write.
|
|
20
|
+
*/
|
|
21
|
+
import { createHash } from "node:crypto";
|
|
22
|
+
import { fencedParts, normalizeLine, foldForCompare, splitQuote, parseEvidence, evidenceQuoteForGuard, firstBullet, daemonTail, blockForDigest, EVIDENCE_BULLET_RE, QUOTE_PREFIX_RE, } from "./proposed-grammar.js";
|
|
23
|
+
import { decisionKeyOf } from "./proposed-decision-key.js";
|
|
24
|
+
export const LINE_MAX = 2000;
|
|
25
|
+
/** A shared run of this many (folded) characters between a line and a quote counts as a copy. A quote shorter than
|
|
26
|
+
* this is never guarded: it is too likely to occur in an honest sentence. */
|
|
27
|
+
export const QUOTE_GUARD_MIN = 20;
|
|
28
|
+
/** `null` for an unknown source: free text is never copied into the audit. */
|
|
29
|
+
export function auditEvidence(s) {
|
|
30
|
+
if (s.kind === "known")
|
|
31
|
+
return { session: s.session, time: s.time, message: s.message };
|
|
32
|
+
if (s.kind === "file")
|
|
33
|
+
return { form: "file", project: s.project, path: [...s.path], line: s.line };
|
|
34
|
+
if (s.kind === "event")
|
|
35
|
+
return { form: "event", id: s.id };
|
|
36
|
+
if (s.kind === "rejected")
|
|
37
|
+
return { form: "rejected", time: s.time, lead: s.lead };
|
|
38
|
+
if (s.kind === "decision")
|
|
39
|
+
return { form: "decision", adr: s.adr };
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
function quoteNeedles(raw) {
|
|
43
|
+
return [foldForCompare(raw.replace(QUOTE_PREFIX_RE, "")), foldForCompare(splitQuote(raw).text)];
|
|
44
|
+
}
|
|
45
|
+
const FENCE_NONCE_RE = /^⟦SHIPWRIGHT-FENCE:([0-9a-f]+)⟧\r?$/m;
|
|
46
|
+
/** A non-text fingerprint of the proposed block: same identity + different block is told apart from crash
|
|
47
|
+
* residue by it, since the log keeps no original. It hides the block only because the fence nonce is random:
|
|
48
|
+
* a block whose nonce is shorter than 128 bits (32 hex) gets NO fingerprint (`null`) and is never trusted as residue. */
|
|
49
|
+
export function proposalFingerprint(block) {
|
|
50
|
+
const nonce = FENCE_NONCE_RE.exec(block)?.[1];
|
|
51
|
+
if (nonce === undefined || nonce.length < 32)
|
|
52
|
+
return null;
|
|
53
|
+
return createHash("sha256").update(block.replace(/\r/g, "").trimEnd()).digest("hex").slice(0, 32);
|
|
54
|
+
}
|
|
55
|
+
/** What a browser sends to say "this is the entry I saw": a digest of the block's text (the same text the client
|
|
56
|
+
* hashes, see `blockForDigest`). Countersign / reject compare it under the lock, so a lead that rewrote the entry
|
|
57
|
+
* under the same identity between render and click is caught. Not a secret: change detection only. */
|
|
58
|
+
export function blockDigest(block) {
|
|
59
|
+
return createHash("sha256").update(blockForDigest(block), "utf8").digest("hex").slice(0, 32);
|
|
60
|
+
}
|
|
61
|
+
/** `null` for an entry without a fence (old marker-less WebUI form): nothing to edit, nothing to strip. */
|
|
62
|
+
export function proposalFacts(block) {
|
|
63
|
+
const lines = block.split("\n");
|
|
64
|
+
const parts = fencedParts(lines);
|
|
65
|
+
if (parts === null)
|
|
66
|
+
return null;
|
|
67
|
+
const evidenceLine = firstBullet(daemonTail(lines), EVIDENCE_BULLET_RE) || null;
|
|
68
|
+
const { source: pointer } = parseEvidence(evidenceLine);
|
|
69
|
+
// the quote the Evidence line carries, guarded even behind a pointer the reader refuses (never logged or audited)
|
|
70
|
+
const evidenceQuote = evidenceQuoteForGuard(evidenceLine);
|
|
71
|
+
return {
|
|
72
|
+
original: normalizeLine(parts.proposed.join("\n")),
|
|
73
|
+
// each quote line, plus the whole quote region joined (a sentence can be pasted across two quote lines)
|
|
74
|
+
quotes: [
|
|
75
|
+
...(evidenceQuote === null ? [] : [foldForCompare(evidenceQuote)]),
|
|
76
|
+
...parts.quotes.flatMap(quoteNeedles),
|
|
77
|
+
foldForCompare(parts.quotes.map((q) => q.replace(QUOTE_PREFIX_RE, "")).join(" ")),
|
|
78
|
+
foldForCompare(parts.quotes.map((q) => splitQuote(q).text).join(" ")), // joined, pointers left out
|
|
79
|
+
].filter((q) => q !== ""),
|
|
80
|
+
evidence: auditEvidence(pointer),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** True when `line` and any guarded quote share a run of QUOTE_GUARD_MIN or more folded characters. */
|
|
84
|
+
function sharesQuoteRun(line, quotes) {
|
|
85
|
+
const folded = foldForCompare(line);
|
|
86
|
+
if (folded.length < QUOTE_GUARD_MIN)
|
|
87
|
+
return false;
|
|
88
|
+
const grams = new Set();
|
|
89
|
+
for (let i = 0; i + QUOTE_GUARD_MIN <= folded.length; i++)
|
|
90
|
+
grams.add(folded.slice(i, i + QUOTE_GUARD_MIN));
|
|
91
|
+
return quotes.some((q) => {
|
|
92
|
+
for (let i = 0; i + QUOTE_GUARD_MIN <= q.length; i++)
|
|
93
|
+
if (grams.has(q.slice(i, i + QUOTE_GUARD_MIN)))
|
|
94
|
+
return true;
|
|
95
|
+
return false;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Validate the line the operator saw (edited or not) against the entry's quotes. `max` = the length limit. */
|
|
99
|
+
export function checkEditedLine(raw, facts, max = LINE_MAX) {
|
|
100
|
+
const line = normalizeLine(raw);
|
|
101
|
+
if (line === "")
|
|
102
|
+
return { ok: false, error: "line_empty" };
|
|
103
|
+
if (line.length > max)
|
|
104
|
+
return { ok: false, error: "line_too_long" };
|
|
105
|
+
if (sharesQuoteRun(line, facts.quotes))
|
|
106
|
+
return { ok: false, error: "line_contains_quote" };
|
|
107
|
+
return { ok: true, line };
|
|
108
|
+
}
|
|
109
|
+
/** The same checks for the line as proposed: an unedited line that repeats a quote (or is empty) needs an edit. */
|
|
110
|
+
export function checkOriginalLine(facts) {
|
|
111
|
+
return checkEditedLine(facts.original, facts);
|
|
112
|
+
}
|
|
113
|
+
/** Max length of an operator's reject reason or countersign note (after normalisation to one line). */
|
|
114
|
+
export const NOTE_MAX = 600;
|
|
115
|
+
/** An operator's reject reason or countersign note: optional (absent or blank = `null`), and otherwise the same rules
|
|
116
|
+
* as an edited line - one line, invisible characters removed, at most NOTE_MAX characters, and never a copy of a
|
|
117
|
+
* quote of the entry. `facts === null` (an entry without a fence) has no quotes to guard. */
|
|
118
|
+
export function checkNoteText(raw, facts) {
|
|
119
|
+
if (raw == null)
|
|
120
|
+
return { ok: true, text: null };
|
|
121
|
+
const verdict = checkEditedLine(raw, facts ?? { quotes: [] }, NOTE_MAX);
|
|
122
|
+
if (verdict.ok)
|
|
123
|
+
return { ok: true, text: verdict.line };
|
|
124
|
+
if (verdict.error === "line_empty")
|
|
125
|
+
return { ok: true, text: null };
|
|
126
|
+
return { ok: false, error: verdict.error === "line_too_long" ? "too_long" : "contains_quote" };
|
|
127
|
+
}
|
|
128
|
+
/** The `- Note: <text>` item a countersign note adds below the logged line (text already passed `checkNoteText`). */
|
|
129
|
+
export const noteItem = (note) => (note == null ? "" : `- Note: ${note}\n`);
|
|
130
|
+
/** The log block of a fenced entry: header, key marker (identifier keys only), block fingerprint, the line, and the
|
|
131
|
+
* operator's note as its own item when there is one. */
|
|
132
|
+
export function toLoggedLineBlock(entry, number, line, note = null) {
|
|
133
|
+
const adr = `ADR-${String(number).padStart(4, "0")}`;
|
|
134
|
+
const key = decisionKeyOf(entry.block);
|
|
135
|
+
const fp = proposalFingerprint(entry.block);
|
|
136
|
+
const marker = key !== null ? `<!-- decisionKey: ${key} -->\n` : "";
|
|
137
|
+
const print = fp !== null ? `<!-- proposal: ${fp} -->\n` : "";
|
|
138
|
+
return `## ${adr} [${entry.timestamp}] ${entry.leadId}\n${marker}${print}\n- ${line}\n${noteItem(note)}\n`;
|
|
139
|
+
}
|
|
140
|
+
// The EXACT shape `toLoggedLineBlock` writes and nothing else: the fingerprint is read only at its fixed place
|
|
141
|
+
// (right after the header and the optional key marker) of a block with nothing after the line but an optional note item. Any other block - a
|
|
142
|
+
// pre-W4 whole entry, a body that merely contains such a line somewhere - is not a line block.
|
|
143
|
+
const LOGGED_LINE_BLOCK_RE = /^## ADR-\d{4,} \[[^\]\n]+\] [^\n]+\n(?:<!-- decisionKey: [^\n]*-->\n)?(?:<!-- proposal: ([0-9a-f]{32}) -->\n)?\n- ([^\n]+)\n(?:- Note: ([^\n]+)\n)?\s*$/;
|
|
144
|
+
/** The line, fingerprint and note of a block written by `toLoggedLineBlock`, or `null` for any other shape. */
|
|
145
|
+
export function parseLoggedLineBlock(loggedBlock) {
|
|
146
|
+
const m = LOGGED_LINE_BLOCK_RE.exec(loggedBlock.replace(/\r/g, ""));
|
|
147
|
+
if (!m)
|
|
148
|
+
return null;
|
|
149
|
+
return { line: m[2], fingerprint: m[1] ?? null, note: m[3] ?? null };
|
|
150
|
+
}
|
|
151
|
+
export function isEdited(facts, finalLine) {
|
|
152
|
+
return finalLine !== facts.original;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=proposed-line.js.map
|