pi-outpost 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/contract/README.md +190 -0
  2. package/dist/contract/conformance/README.md +54 -0
  3. package/dist/contract/conformance/index.json +134 -0
  4. package/dist/contract/conformance/invalid/change-without-reference.json +17 -0
  5. package/dist/contract/conformance/invalid/change-without-target.json +10 -0
  6. package/dist/contract/conformance/invalid/duplicate-identifier.json +17 -0
  7. package/dist/contract/conformance/invalid/duplicate-reference-twice.json +24 -0
  8. package/dist/contract/conformance/invalid/duplicate-reference.json +23 -0
  9. package/dist/contract/conformance/invalid/empty-change.json +15 -0
  10. package/dist/contract/conformance/invalid/kind-data-mismatch.json +13 -0
  11. package/dist/contract/conformance/invalid/label-past-ceiling.json +13 -0
  12. package/dist/contract/conformance/invalid/new-element-without-label.json +12 -0
  13. package/dist/contract/conformance/invalid/new-relationship-without-kind.json +22 -0
  14. package/dist/contract/conformance/invalid/relationship-change-without-target.json +13 -0
  15. package/dist/contract/conformance/invalid/relationship-without-endpoints.json +19 -0
  16. package/dist/contract/conformance/invalid/removal-without-target.json +19 -0
  17. package/dist/contract/conformance/invalid/removal-without-type.json +19 -0
  18. package/dist/contract/conformance/invalid/row-column-mismatch.json +15 -0
  19. package/dist/contract/conformance/invalid/table-with-empty-removals.json +6 -0
  20. package/dist/contract/conformance/invalid/table-with-removal.json +20 -0
  21. package/dist/contract/conformance/invalid/table-with-target.json +15 -0
  22. package/dist/contract/conformance/invalid/too-many-element-kinds.json +340 -0
  23. package/dist/contract/conformance/invalid/too-many-relationship-kinds.json +665 -0
  24. package/dist/contract/conformance/invalid/undeclared-property.json +14 -0
  25. package/dist/contract/conformance/invalid/unknown-version.json +13 -0
  26. package/dist/contract/conformance/invalid/unresolved-endpoint.json +19 -0
  27. package/dist/contract/conformance/valid/graph-at-the-kind-ceiling.json +650 -0
  28. package/dist/contract/conformance/valid/graph-minimal.json +13 -0
  29. package/dist/contract/conformance/valid/graph-proposal-addition-only.json +14 -0
  30. package/dist/contract/conformance/valid/graph-proposal-context-element.json +24 -0
  31. package/dist/contract/conformance/valid/graph-proposal-declared-change.json +18 -0
  32. package/dist/contract/conformance/valid/graph-proposal-field-patch.json +17 -0
  33. package/dist/contract/conformance/valid/graph-proposal-named-context.json +25 -0
  34. package/dist/contract/conformance/valid/graph-proposal-reattachment.json +30 -0
  35. package/dist/contract/conformance/valid/graph-with-typed-relationship.json +24 -0
  36. package/dist/contract/conformance/valid/sequence-minimal.json +13 -0
  37. package/dist/contract/conformance/valid/sequence-ordered.json +28 -0
  38. package/dist/contract/conformance/valid/table-minimal.json +20 -0
  39. package/dist/contract/schemas/structured-exchange-1.json +328 -0
  40. package/dist/contract/validate-structured-exchange.mjs +8602 -0
  41. package/dist/pi-outpost.mjs +12971 -3627
  42. package/dist/pi-outpost.sea.mjs +17254 -7912
  43. package/dist/sea-prep.blob +0 -0
  44. package/dist/skills/README.md +22 -0
  45. package/dist/skills/structured-exchange/SKILL.md +216 -0
  46. package/dist/skills/structured-exchange/structured-exchange-1.json +328 -0
  47. package/dist/web/assets/{PdfViewer-DqktVuQi.js → PdfViewer-x2xiBxe4.js} +2 -2
  48. package/dist/web/assets/{abnfDiagram-N423BO3Z-DTFllthO.js → abnfDiagram-N423BO3Z-kee00MEd.js} +1 -1
  49. package/dist/web/assets/architecture-TIHT7OUA-s5QlE0U9.js +1 -0
  50. package/dist/web/assets/{architectureDiagram-T3A2C74G-z58o8Htx.js → architectureDiagram-T3A2C74G-FQrRA7W5.js} +1 -1
  51. package/dist/web/assets/{blockDiagram-VBNYF7ZC-DunlRCsF.js → blockDiagram-VBNYF7ZC-DvskKqA0.js} +1 -1
  52. package/dist/web/assets/{c4Diagram-5PPSVZJV-BnXZSwmd.js → c4Diagram-5PPSVZJV-BZRDgGhx.js} +1 -1
  53. package/dist/web/assets/channel-Ca0hg8PC.js +1 -0
  54. package/dist/web/assets/{chunk-2GRJ4B5K-DMD6wv-7.js → chunk-2GRJ4B5K-BKAhH8lI.js} +1 -1
  55. package/dist/web/assets/{chunk-3NCLNEKW-DcwPPr-p.js → chunk-3NCLNEKW-CDW_UFrj.js} +1 -1
  56. package/dist/web/assets/{chunk-4I5QYGJK-CpI4oXUq.js → chunk-4I5QYGJK-DexlHym3.js} +1 -1
  57. package/dist/web/assets/{chunk-5RXB4S5H-vLnKsYcD.js → chunk-5RXB4S5H-Dy5vrF_c.js} +1 -1
  58. package/dist/web/assets/{chunk-6Q2QTUOP-C2P_VKtw.js → chunk-6Q2QTUOP-CgZiYapq.js} +1 -1
  59. package/dist/web/assets/{chunk-7Z6QIM7H-9Vj99wwd.js → chunk-7Z6QIM7H-CJnQz0bE.js} +1 -1
  60. package/dist/web/assets/{chunk-GF5L2VYU-Cna6JsDy.js → chunk-GF5L2VYU-CNU1cTmN.js} +1 -1
  61. package/dist/web/assets/{chunk-I66GZJ75-Crrt_0-l.js → chunk-I66GZJ75-CAg8Cp7h.js} +3 -3
  62. package/dist/web/assets/{chunk-J7OUQ5F2-NnE94fab.js → chunk-J7OUQ5F2-DPUu4PC3.js} +2 -2
  63. package/dist/web/assets/{chunk-JQJVKLGR-DV6jrsII.js → chunk-JQJVKLGR-BvvzMzOD.js} +1 -1
  64. package/dist/web/assets/{chunk-KBJHAD2P-96NXxGM6.js → chunk-KBJHAD2P-CU234oZY.js} +1 -1
  65. package/dist/web/assets/{chunk-NSK5VX7P-D8DkQ2AO.js → chunk-NSK5VX7P-DC9AvBMO.js} +1 -1
  66. package/dist/web/assets/{chunk-QR6OTTB3-BCLPnKlE.js → chunk-QR6OTTB3-NGKRGHT-.js} +1 -1
  67. package/dist/web/assets/{chunk-UBXNYLIW-DswC9lJa.js → chunk-UBXNYLIW-BdEuaF2V.js} +1 -1
  68. package/dist/web/assets/{chunk-W5SLKNZC-CPDEB8Hp.js → chunk-W5SLKNZC-DI52N2zG.js} +1 -1
  69. package/dist/web/assets/{chunk-WRU74C26-DCZH8Rwq.js → chunk-WRU74C26-Z4jYNWlA.js} +1 -1
  70. package/dist/web/assets/classDiagram-JCYQIIEL-D6TSE_k7.js +1 -0
  71. package/dist/web/assets/classDiagram-v2-OCEON4UE-D6TSE_k7.js +1 -0
  72. package/dist/web/assets/{cynefin-VYW2F7L2-cIE_7dpt.js → cynefin-VYW2F7L2-pqhisvct.js} +1 -1
  73. package/dist/web/assets/{cynefinDiagram-MW4NZA55-D2MrYar5.js → cynefinDiagram-MW4NZA55-dph1hMaU.js} +1 -1
  74. package/dist/web/assets/{dagre-VZM6K2ZE-BagJQZYc.js → dagre-VZM6K2ZE-dkUSGnsd.js} +1 -1
  75. package/dist/web/assets/{diagram-7IWD3JNH-BwKHjjQ-.js → diagram-7IWD3JNH-Dr227O8k.js} +1 -1
  76. package/dist/web/assets/{diagram-B4RE2ZJO-BJmMpny4.js → diagram-B4RE2ZJO-ntl1e6sh.js} +1 -1
  77. package/dist/web/assets/{diagram-LBJQPF4R-D3PE9vwZ.js → diagram-LBJQPF4R-DOjM-sZd.js} +1 -1
  78. package/dist/web/assets/{diagram-Q27KOJAE-oiQW2yMD.js → diagram-Q27KOJAE-B-MjzCeJ.js} +1 -1
  79. package/dist/web/assets/{diagram-UB23O5K3-lKRQ-OEd.js → diagram-UB23O5K3-DC7MbtQl.js} +1 -1
  80. package/dist/web/assets/{ebnfDiagram-BXEA7PRR-B7T7YLs8.js → ebnfDiagram-BXEA7PRR-y-LOEsHH.js} +1 -1
  81. package/dist/web/assets/{erDiagram-JOGREHBK-BB-xsqVL.js → erDiagram-JOGREHBK-k8AoIy3Q.js} +1 -1
  82. package/dist/web/assets/eventmodeling-45OFAUF4-CtFKjGJF.js +1 -0
  83. package/dist/web/assets/flowDiagram-UKHOOZJN-j1XVLSIh.js +1 -0
  84. package/dist/web/assets/{ganttDiagram-PKOTCBZU-BnmC1zyp.js → ganttDiagram-PKOTCBZU-BzS1g8HQ.js} +1 -1
  85. package/dist/web/assets/{gitGraph-TEB2WS4Q-DFCnvCQm.js → gitGraph-TEB2WS4Q-Dc63nekB.js} +1 -1
  86. package/dist/web/assets/{gitGraphDiagram-DS77QQ5N-CVU7rVHy.js → gitGraphDiagram-DS77QQ5N-BTWw_ecn.js} +1 -1
  87. package/dist/web/assets/index-BWflhMWc.js +323 -0
  88. package/dist/web/assets/index-DpjN669x.css +2 -0
  89. package/dist/web/assets/{info-DKCQHKI2-C8DZu4NS.js → info-DKCQHKI2-D_28_vN7.js} +1 -1
  90. package/dist/web/assets/{infoDiagram-6WML65LV-BSYvkU5b.js → infoDiagram-6WML65LV-77gNLZvi.js} +1 -1
  91. package/dist/web/assets/{ishikawaDiagram-WSZJBQD7-B6uWyt8M.js → ishikawaDiagram-WSZJBQD7-7XDMgYt5.js} +1 -1
  92. package/dist/web/assets/{journeyDiagram-NVQOT4AX-CTrfVU7d.js → journeyDiagram-NVQOT4AX-vsyfZeiY.js} +1 -1
  93. package/dist/web/assets/{kanban-definition-27J2QSJJ-DsBfco54.js → kanban-definition-27J2QSJJ-DQ5g-1NC.js} +1 -1
  94. package/dist/web/assets/{line-C6m1STwY.js → line-DtXn_0p6.js} +1 -1
  95. package/dist/web/assets/{mermaid-parser.core-DbS7gJe7.js → mermaid-parser.core-Dyx1WWw_.js} +3 -3
  96. package/dist/web/assets/{mermaid.core-Blq4BYkb.js → mermaid.core-uKmrA7tr.js} +3 -3
  97. package/dist/web/assets/{mindmap-definition-FAOFIHXS-BWL0h6Uq.js → mindmap-definition-FAOFIHXS-BYgTwh7C.js} +1 -1
  98. package/dist/web/assets/{packet-7NZHBO7P-CryH8SNn.js → packet-7NZHBO7P-BZKnuEXR.js} +1 -1
  99. package/dist/web/assets/{pdf-BxEVw97_.js → pdf-pU3WmOmo.js} +1 -1
  100. package/dist/web/assets/{pegDiagram-VL7TDLO6-CWrJoBL8.js → pegDiagram-VL7TDLO6-CBsL2dth.js} +1 -1
  101. package/dist/web/assets/{pie-RZYD4A2V-DsuD2v_v.js → pie-RZYD4A2V-DGE1bbOE.js} +1 -1
  102. package/dist/web/assets/{pieDiagram-7S7Q4E2Y-D6-xXQ5p.js → pieDiagram-7S7Q4E2Y-BwURarOq.js} +1 -1
  103. package/dist/web/assets/{quadrantDiagram-CIZ2JOQS-CMlYXuHz.js → quadrantDiagram-CIZ2JOQS-BqFQ2trs.js} +1 -1
  104. package/dist/web/assets/{radar-I7S5WNFK-CjUoPns1.js → radar-I7S5WNFK-Bg6p9yp7.js} +1 -1
  105. package/dist/web/assets/{railroad-3IZDKUUU-Dv7YQd2U.js → railroad-3IZDKUUU-DNI6o4Em.js} +1 -1
  106. package/dist/web/assets/railroad-abnf-AHOZXSZD-BNrH9Ci1.js +1 -0
  107. package/dist/web/assets/railroad-ebnf-EBAXGLYW-Dz3SvEbQ.js +1 -0
  108. package/dist/web/assets/railroad-peg-LSFZ7HO6-DTIkD36f.js +1 -0
  109. package/dist/web/assets/{railroadDiagram-AXF67PYL-bzfj9r2a.js → railroadDiagram-AXF67PYL-oEpcqk-W.js} +1 -1
  110. package/dist/web/assets/{requirementDiagram-LRYGKXZP-B7PaiV8r.js → requirementDiagram-LRYGKXZP-BKxgubC8.js} +1 -1
  111. package/dist/web/assets/{sankeyDiagram-W5VNT64P-DEKRi7gf.js → sankeyDiagram-W5VNT64P-DR5jQRd_.js} +1 -1
  112. package/dist/web/assets/{sequenceDiagram-SI44F4Z6-BB2FYR31.js → sequenceDiagram-SI44F4Z6-C7L40Nsa.js} +1 -1
  113. package/dist/web/assets/{stateDiagram-OKZ733FA-BnQwJgUG.js → stateDiagram-OKZ733FA-D3mb8r39.js} +1 -1
  114. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-Dmyli1R9.js +1 -0
  115. package/dist/web/assets/{swimlanes-SLNWSIFB-omoGGO13.js → swimlanes-SLNWSIFB-BEeA1QZ_.js} +1 -1
  116. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-CGGlb8e_.js +8 -0
  117. package/dist/web/assets/{timeline-definition-Z64GVDOM-D0C35XAV.js → timeline-definition-Z64GVDOM-DJzDXvxa.js} +1 -1
  118. package/dist/web/assets/{treeView-QDETBFTQ-D21D9o06.js → treeView-QDETBFTQ-C7Ygr33N.js} +1 -1
  119. package/dist/web/assets/{treemap-6X3UGDF4-DsNn3HqU.js → treemap-6X3UGDF4-Cvo79BWQ.js} +1 -1
  120. package/dist/web/assets/{vennDiagram-T6HMQDX7-Cg1oGxJi.js → vennDiagram-T6HMQDX7-K4-0i3bx.js} +1 -1
  121. package/dist/web/assets/{wardley-OPB4EBWU-Df-Ugyh4.js → wardley-OPB4EBWU-vPJ7z6yC.js} +1 -1
  122. package/dist/web/assets/{wardleyDiagram-T6FBY63Y-DKiQg0PU.js → wardleyDiagram-T6FBY63Y-ZMc27dHf.js} +1 -1
  123. package/dist/web/assets/{xychartDiagram-ELKLHX3M-DecoU60Y.js → xychartDiagram-ELKLHX3M-CC9smjjw.js} +1 -1
  124. package/dist/web/index.html +2 -2
  125. package/package.json +2 -2
  126. package/dist/web/assets/architecture-TIHT7OUA-CfWIx3bb.js +0 -1
  127. package/dist/web/assets/channel-By9fNdgM.js +0 -1
  128. package/dist/web/assets/classDiagram-JCYQIIEL-CbRWDDDS.js +0 -1
  129. package/dist/web/assets/classDiagram-v2-OCEON4UE-CbRWDDDS.js +0 -1
  130. package/dist/web/assets/eventmodeling-45OFAUF4-CIh5g1Zv.js +0 -1
  131. package/dist/web/assets/flowDiagram-UKHOOZJN-DWTzsyQN.js +0 -1
  132. package/dist/web/assets/index-Ct33KYcg.js +0 -321
  133. package/dist/web/assets/index-DFy_CqqQ.css +0 -2
  134. package/dist/web/assets/railroad-abnf-AHOZXSZD-Cr90hvNI.js +0 -1
  135. package/dist/web/assets/railroad-ebnf-EBAXGLYW-BhLKG67T.js +0 -1
  136. package/dist/web/assets/railroad-peg-LSFZ7HO6-Ct2bnVSV.js +0 -1
  137. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-CsdKarH7.js +0 -1
  138. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-KAs6WWZH.js +0 -8
Binary file
@@ -0,0 +1,22 @@
1
+ # Skills shipped with pi-outpost
2
+
3
+ A skill teaches the agent how to use a capability this application provides. These are
4
+ part of the product, not local configuration, so they live here — `.pi/skills/` and
5
+ `.agents/skills/` are runtime locations and are deliberately not tracked.
6
+
7
+ ## Loading one
8
+
9
+ Point `skillPaths` at it in your configuration:
10
+
11
+ ```json
12
+ { "skillPaths": ["<path to this repo>/skills/structured-exchange"] }
13
+ ```
14
+
15
+ Or copy the directory into `.agents/skills/`, which the agent discovers on its own.
16
+
17
+ ## What is here
18
+
19
+ - **`structured-exchange/`** — authoring a structured-exchange document: the envelope,
20
+ the two identities, patch semantics, and the loop to run when a document is refused.
21
+ Pairs with [`docs/structured-exchange.md`](../docs/structured-exchange.md), which is
22
+ for whoever writes a producer rather than for the agent.
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: structured-exchange
3
+ description: Author a structured-exchange document — a graph, sequence, or table the interface renders natively, or a proposal to change one an external authority holds. Use when asked to draw or diagram a structure, to propose an evolution of an existing model, or when a result would otherwise be a hand-written diagram.
4
+ allowed-tools: Bash(node:*)
5
+ license: MIT
6
+ metadata:
7
+ version: "1.0"
8
+ ---
9
+
10
+ # Authoring a structured-exchange document
11
+
12
+ Emit **data**, not a diagram. The interface renders the diagram from your data; a
13
+ diagram you draw by hand is syntax it has to guess at, and cannot be approved,
14
+ validated, or applied.
15
+
16
+ > **The one rule that trips everyone up.** When you propose a change to something
17
+ > that already exists, the fields you write beside its `ref` say *what it is called
18
+ > now*. They are not applied. The new value goes in `set`.
19
+ >
20
+ > ```json
21
+ > { "id": "ledger", "ref": "EL-7", "label": "Ledger",
22
+ > "set": { "label": "General Ledger" } }
23
+ > ```
24
+ >
25
+ > Writing `"label": "General Ledger"` on its own does **not** rename anything — it
26
+ > claims that is already its name, and the proposal silently does nothing. If the
27
+ > tool answers `0 changed`, this is what happened.
28
+
29
+ Everything you need is on this page. The normative contract sits beside it, as
30
+ `structured-exchange-1.json` in this same directory — read it when a detail here is
31
+ not enough, and do not go hunting elsewhere in the workspace for it.
32
+
33
+ ## The tool validates for you
34
+
35
+ `present_structure` checks the document before showing anything. A refusal comes back
36
+ as an error naming the rule and pointing at the offending value with a JSON Pointer.
37
+ **Read it, fix the document, call again.** That is the loop; it is not a dead end.
38
+
39
+ Nothing is repaired for you. An endpoint one character off a declared identifier is
40
+ refused, never corrected — correcting it would produce a document you did not write.
41
+
42
+ ## The envelope
43
+
44
+ ```json
45
+ {
46
+ "schema": "urn:structured-exchange:1",
47
+ "kind": "graph",
48
+ "data": { "nodes": [...], "edges": [...] }
49
+ }
50
+ ```
51
+
52
+ `kind` is `graph`, `sequence`, or `table`. A table is a projection: it can be shown
53
+ and reasoned about, never proposed.
54
+
55
+ Each carries its own `data`:
56
+
57
+ ```jsonc
58
+ // graph — things and directed relationships between them
59
+ "data": { "nodes": [{ "id": "a", "label": "A" }],
60
+ "edges": [{ "from": "a", "to": "b", "kind": "calls" }] }
61
+
62
+ // sequence — participants and ordered messages between them
63
+ "data": { "participants": [{ "id": "a", "label": "Client" }],
64
+ "messages": [{ "from": "a", "to": "b", "label": "POST /orders" }] }
65
+
66
+ // table — columns and rows aligned to them
67
+ "data": { "columns": ["requirement", "satisfied by"],
68
+ "rows": [["REQ-1", "Billing"]] }
69
+ ```
70
+
71
+ A message declares a `label` and no `kind` — the label *is* what is being sent.
72
+ Message order is the order you write them in; nothing sorts them for you.
73
+
74
+ ## Two identities, never confused
75
+
76
+ Every element carries an `id`, and may carry a `ref`.
77
+
78
+ - **`id`** is local to your document. Relationships point at it. It means nothing
79
+ outside the document you are writing, so make it readable — `payment-service`,
80
+ not `n1`.
81
+ - **`ref`** is the identifier the external authority already holds for that element.
82
+ Use it only when you know it, from something that was given to you. **Never invent
83
+ one.** An element with no `ref` is understood as new.
84
+
85
+ Give a referenced element its **current** label whenever you know it. Without one the
86
+ reader sees the bare reference — `EL-12` instead of `Billing` — which is exactly the
87
+ context they needed and did not get.
88
+
89
+ ## Describing something new
90
+
91
+ Leave `target` out. Every element declares its `label`; every relationship declares
92
+ its `kind`.
93
+
94
+ > **Type your elements.** `kind` is optional on an element and you should almost
95
+ > always set it. The reader's view colours by it and builds a key from it, so a
96
+ > diagram whose elements carry no type arrives in a single flat grey — legible, and
97
+ > much harder to read than it needed to be.
98
+
99
+ ```json
100
+ {
101
+ "schema": "urn:structured-exchange:1",
102
+ "kind": "graph",
103
+ "data": {
104
+ "nodes": [
105
+ { "id": "gateway", "label": "API Gateway", "kind": "service" },
106
+ { "id": "billing", "label": "Billing", "kind": "service" },
107
+ { "id": "ledger", "label": "Ledger", "kind": "datastore" }
108
+ ],
109
+ "edges": [
110
+ { "from": "gateway", "to": "billing", "kind": "calls" },
111
+ { "from": "billing", "to": "ledger", "kind": "writes" }
112
+ ]
113
+ }
114
+ }
115
+ ```
116
+
117
+ `kind` is an opaque string from your domain, on elements and relationships alike.
118
+ Nothing validates it against a list and nothing interprets it: it is shown, it tells
119
+ two otherwise identical things apart, and whatever applies the document is free to
120
+ map it onto its own type system.
121
+
122
+ Pick the vocabulary the domain already uses, and use it consistently — the same
123
+ concept must get the same string throughout a document, because that string is what
124
+ groups things in the key. Two or three types for a small diagram, rarely more than
125
+ about eight; past that the key stops helping.
126
+
127
+ A physical architecture might use `battery`, `converter`, `motor`, `controller`,
128
+ `sensor`; a software one `service`, `datastore`, `queue`, `external`; a stereotyped
129
+ model whatever its profile defines. Relationships likewise: `power`, `thermal`,
130
+ `communication` on a physical model, `calls`, `writes`, `publishes` on a software one.
131
+
132
+ ## Proposing a change to something that exists
133
+
134
+ Name the artifact in `target`. Then:
135
+
136
+ - An element you do not mention is left alone. Omission never removes anything.
137
+ - **On anything carrying a `ref`, the fields you declare describe what is already
138
+ there.** They are how the reader recognises it. They change nothing.
139
+ - **To change something, say so in `set`.** That is the only thing that is applied.
140
+ - To remove something, say so in `removals`, giving both the `ref` and whether it is
141
+ an `"element"` or a `"relationship"` — a reference alone does not say which.
142
+
143
+ > **Say what you are removing.** A removal may also carry `label`, `kind`, and for a
144
+ > relationship `from` and `to`. Add them. The reader's application holds your document
145
+ > and nothing else — it cannot look up what `REL-88` stood for, so without them the
146
+ > approval gate reads "relationship: REL-88" and asks someone to approve deleting
147
+ > something they cannot see. These fields describe and never identify: `ref` is still
148
+ > what names the thing.
149
+
150
+ ```json
151
+ {
152
+ "schema": "urn:structured-exchange:1",
153
+ "kind": "graph",
154
+ "target": "architecture-v4",
155
+ "removals": [
156
+ { "type": "relationship", "ref": "REL-88",
157
+ "kind": "calls", "from": "ledger", "to": "billing" }
158
+ ],
159
+ "data": {
160
+ "nodes": [
161
+ { "id": "billing", "ref": "EL-12", "label": "Billing" },
162
+ { "id": "ledger", "ref": "EL-7", "label": "Ledger",
163
+ "set": { "label": "General Ledger" } },
164
+ { "id": "audit", "label": "Audit" }
165
+ ],
166
+ "edges": [{ "from": "audit", "to": "billing", "kind": "calls" }]
167
+ }
168
+ }
169
+ ```
170
+
171
+ Read that proposal:
172
+
173
+ - **The removal** names `REL-88` and says what it is: the `calls` from Ledger to
174
+ Billing. The reader sees what goes, rather than an identifier.
175
+
176
+ - **`billing`** has a `ref` and a name, no `set` → **context**. It exists, it is shown
177
+ so you can see where the new thing attaches, and nothing happens to it.
178
+ - **`ledger`** has a `ref`, its current name, and a `set` → **a change**. The reader
179
+ sees `Ledger → General Ledger`, which is what makes it approvable.
180
+ - **`audit`** has no `ref` → **new**. With nothing to describe, its `label` is simply
181
+ its value.
182
+
183
+ **Include as much context as the reader needs.** That is what the default is for: an
184
+ element you include to make the picture legible costs nothing and changes nothing.
185
+ Leaving it out to be safe is the wrong instinct — a proposal nobody can situate is a
186
+ proposal nobody should approve.
187
+
188
+ ### Two rules that catch people out
189
+
190
+ **Never put a `set` on something with no `ref`.** There is nothing to change; its
191
+ fields are already its values. Refused.
192
+
193
+ **Never both `set` and remove the same `ref`.** That states two intentions at once and
194
+ is refused rather than resolved — decide which you meant.
195
+
196
+ **A relationship always declares `from` and `to`**, even when it carries a `ref`. Its
197
+ endpoints are its identity, not something you patch. To re-attach a relationship,
198
+ remove it and declare a new one.
199
+
200
+ ## What the reader sees, and what the model sees
201
+
202
+ The structured document is rendered for the human and **does not reach the model** —
203
+ not even yours, on a later turn. So the result's ordinary text must stand on its own:
204
+ summarise what the structure says, well enough that the next question can be answered
205
+ without it. A document with a rich diagram and a one-line text is a document you
206
+ cannot reason about afterwards.
207
+
208
+ ## Size
209
+
210
+ Collections and strings are bounded — 500 elements, 2000 relationships, 500-character
211
+ labels, among others; the schema states them all. Exceeding a bound is refused with a
212
+ diagnostic naming what was exceeded.
213
+
214
+ If you are near a limit, the question was too broad. Narrow the scope rather than
215
+ trimming the answer: a diagram of everything is one nobody can read, and a proposal
216
+ nobody can read is one nobody should approve.
@@ -0,0 +1,328 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:structured-exchange:1",
4
+ "title": "Structured exchange envelope v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema",
9
+ "kind",
10
+ "data"
11
+ ],
12
+ "$defs": {
13
+ "ref": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "maxLength": 200
17
+ },
18
+ "localId": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "maxLength": 200
22
+ },
23
+ "label": {
24
+ "type": "string",
25
+ "maxLength": 500
26
+ },
27
+ "kind": {
28
+ "description": "The producing tool's type or stereotype for this thing \u2014 'block', 'sensor', 'power', 'thermal'. Free text, because the vocabulary belongs to the domain and not to this contract. Carries meaning, not presentation: a reader may colour by it, and a consumer may map it back to its own type system.",
29
+ "type": "string",
30
+ "minLength": 1,
31
+ "maxLength": 100
32
+ },
33
+ "element": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": [
37
+ "id"
38
+ ],
39
+ "properties": {
40
+ "id": {
41
+ "$ref": "#/$defs/localId"
42
+ },
43
+ "ref": {
44
+ "$ref": "#/$defs/ref"
45
+ },
46
+ "label": {
47
+ "$ref": "#/$defs/label"
48
+ },
49
+ "kind": {
50
+ "$ref": "#/$defs/kind"
51
+ },
52
+ "set": {
53
+ "$ref": "#/$defs/elementChange"
54
+ }
55
+ },
56
+ "if": {
57
+ "not": {
58
+ "required": [
59
+ "ref"
60
+ ]
61
+ }
62
+ },
63
+ "then": {
64
+ "required": [
65
+ "label"
66
+ ]
67
+ }
68
+ },
69
+ "edge": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": [
73
+ "from",
74
+ "to"
75
+ ],
76
+ "properties": {
77
+ "from": {
78
+ "$ref": "#/$defs/localId"
79
+ },
80
+ "to": {
81
+ "$ref": "#/$defs/localId"
82
+ },
83
+ "kind": {
84
+ "$ref": "#/$defs/kind"
85
+ },
86
+ "ref": {
87
+ "$ref": "#/$defs/ref"
88
+ },
89
+ "label": {
90
+ "$ref": "#/$defs/label"
91
+ },
92
+ "set": {
93
+ "$ref": "#/$defs/edgeChange"
94
+ }
95
+ },
96
+ "if": {
97
+ "not": {
98
+ "required": [
99
+ "ref"
100
+ ]
101
+ }
102
+ },
103
+ "then": {
104
+ "required": [
105
+ "kind"
106
+ ]
107
+ }
108
+ },
109
+ "message": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": [
113
+ "from",
114
+ "to"
115
+ ],
116
+ "properties": {
117
+ "from": {
118
+ "$ref": "#/$defs/localId"
119
+ },
120
+ "to": {
121
+ "$ref": "#/$defs/localId"
122
+ },
123
+ "ref": {
124
+ "$ref": "#/$defs/ref"
125
+ },
126
+ "label": {
127
+ "$ref": "#/$defs/label"
128
+ },
129
+ "set": {
130
+ "$ref": "#/$defs/messageChange"
131
+ }
132
+ },
133
+ "if": {
134
+ "not": {
135
+ "required": [
136
+ "ref"
137
+ ]
138
+ }
139
+ },
140
+ "then": {
141
+ "required": [
142
+ "label"
143
+ ]
144
+ }
145
+ },
146
+ "removal": {
147
+ "type": "object",
148
+ "additionalProperties": false,
149
+ "required": [
150
+ "type",
151
+ "ref"
152
+ ],
153
+ "properties": {
154
+ "type": {
155
+ "enum": [
156
+ "element",
157
+ "relationship"
158
+ ]
159
+ },
160
+ "ref": {
161
+ "$ref": "#/$defs/ref"
162
+ },
163
+ "label": {
164
+ "$ref": "#/$defs/label"
165
+ },
166
+ "kind": {
167
+ "$ref": "#/$defs/kind"
168
+ },
169
+ "from": {
170
+ "$ref": "#/$defs/localId"
171
+ },
172
+ "to": {
173
+ "$ref": "#/$defs/localId"
174
+ }
175
+ },
176
+ "description": "Something to take out of the target, named by the reference the authority knows it by. The other fields describe it and never identify it: they exist so a reader can see what they are approving the removal of. This application holds one document, not the authority's model, so without them a removal is an opaque identifier and the reader is asked to approve the deletion of something they cannot see."
177
+ },
178
+ "elementChange": {
179
+ "type": "object",
180
+ "additionalProperties": false,
181
+ "minProperties": 1,
182
+ "properties": {
183
+ "label": {
184
+ "$ref": "#/$defs/label"
185
+ },
186
+ "kind": {
187
+ "$ref": "#/$defs/kind"
188
+ }
189
+ }
190
+ },
191
+ "edgeChange": {
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "minProperties": 1,
195
+ "properties": {
196
+ "kind": {
197
+ "$ref": "#/$defs/kind"
198
+ },
199
+ "label": {
200
+ "$ref": "#/$defs/label"
201
+ }
202
+ }
203
+ },
204
+ "messageChange": {
205
+ "type": "object",
206
+ "additionalProperties": false,
207
+ "minProperties": 1,
208
+ "properties": {
209
+ "label": {
210
+ "$ref": "#/$defs/label"
211
+ }
212
+ }
213
+ }
214
+ },
215
+ "properties": {
216
+ "schema": {
217
+ "const": "urn:structured-exchange:1"
218
+ },
219
+ "kind": {
220
+ "enum": [
221
+ "graph",
222
+ "sequence",
223
+ "table"
224
+ ]
225
+ },
226
+ "target": {
227
+ "$ref": "#/$defs/ref"
228
+ },
229
+ "removals": {
230
+ "type": "array",
231
+ "maxItems": 500,
232
+ "items": {
233
+ "$ref": "#/$defs/removal"
234
+ }
235
+ },
236
+ "data": {
237
+ "oneOf": [
238
+ {
239
+ "type": "object",
240
+ "additionalProperties": false,
241
+ "required": [
242
+ "nodes",
243
+ "edges"
244
+ ],
245
+ "properties": {
246
+ "nodes": {
247
+ "type": "array",
248
+ "minItems": 1,
249
+ "maxItems": 500,
250
+ "items": {
251
+ "$ref": "#/$defs/element"
252
+ }
253
+ },
254
+ "edges": {
255
+ "type": "array",
256
+ "maxItems": 2000,
257
+ "items": {
258
+ "$ref": "#/$defs/edge"
259
+ }
260
+ }
261
+ }
262
+ },
263
+ {
264
+ "type": "object",
265
+ "additionalProperties": false,
266
+ "required": [
267
+ "participants",
268
+ "messages"
269
+ ],
270
+ "properties": {
271
+ "participants": {
272
+ "type": "array",
273
+ "minItems": 1,
274
+ "maxItems": 100,
275
+ "items": {
276
+ "$ref": "#/$defs/element"
277
+ }
278
+ },
279
+ "messages": {
280
+ "type": "array",
281
+ "maxItems": 1000,
282
+ "items": {
283
+ "$ref": "#/$defs/message"
284
+ }
285
+ }
286
+ }
287
+ },
288
+ {
289
+ "type": "object",
290
+ "additionalProperties": false,
291
+ "required": [
292
+ "columns",
293
+ "rows"
294
+ ],
295
+ "properties": {
296
+ "columns": {
297
+ "type": "array",
298
+ "minItems": 1,
299
+ "maxItems": 50,
300
+ "items": {
301
+ "type": "string",
302
+ "minLength": 1,
303
+ "maxLength": 200
304
+ }
305
+ },
306
+ "rows": {
307
+ "type": "array",
308
+ "maxItems": 5000,
309
+ "items": {
310
+ "type": "array",
311
+ "items": {
312
+ "type": [
313
+ "string",
314
+ "number",
315
+ "boolean",
316
+ "null"
317
+ ],
318
+ "maxLength": 1000
319
+ },
320
+ "maxItems": 50
321
+ }
322
+ }
323
+ }
324
+ }
325
+ ]
326
+ }
327
+ }
328
+ }
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-BxEVw97_.js","assets/index-Ct33KYcg.js","assets/rolldown-runtime-QTnfLwEv.js","assets/index-DFy_CqqQ.css"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,r}from"./index-Ct33KYcg.js";var i=e(),a=r(),o=[.5,.75,1,1.25,1.5,2,3];function s(e){return e>=1024*1024?`${Math.round(e/(1024*1024))} MB`:`${Math.round(e/1024)} KB`}function c(e){switch(e.kind){case`too-large`:return e.limitBytes===void 0?`This PDF is larger than the server's PDF limit.`:`This PDF is larger than the ${s(e.limitBytes)} limit the server allows.`;case`encrypted`:return`This PDF is password-protected, so it cannot be displayed.`;case`not-found`:return`This file no longer exists.`;case`unauthorized`:return`This session is not authorized to read this file.`;case`unreadable`:return`This file could not be read as a PDF.`}}async function l(e,n,r){let i=await fetch(t(e,n,null),{headers:r?{Authorization:`Bearer ${r}`}:{}});if(!i.ok){if(i.status===413){let e=await i.json().catch(()=>({}));throw{kind:`too-large`,...typeof e.limit==`number`?{limitBytes:e.limit}:{}}}throw i.status===401||i.status===403?{kind:`unauthorized`}:i.status===404?{kind:`not-found`}:{kind:`unreadable`}}return new Uint8Array(await i.arrayBuffer())}async function u(e){let t=await n(()=>import(`./pdf-BxEVw97_.js`),__vite__mapDeps([0,1,2,3]));t.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString();let r=t.getDocument({data:e,useWorkerFetch:!1,isOffscreenCanvasSupported:!1});try{return{doc:await r.promise,task:r}}catch(e){throw await r.destroy().catch(()=>{}),{kind:(e instanceof Error?e.name:``)===`PasswordException`?`encrypted`:`unreadable`}}}async function d(e,t,r,i){if(!(r===null||e.streamTextContent===void 0)){r.replaceChildren();try{let a=await n(()=>import(`./pdf-BxEVw97_.js`),__vite__mapDeps([0,1,2,3]));r.style.setProperty(`--total-scale-factor`,String(i)),await new a.TextLayer({textContentSource:await e.streamTextContent(),container:r,viewport:t}).render()}catch{r.replaceChildren()}}}function f(e){try{e?.cancel()}catch{}}function p(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`}var m=1;function h({doc:e,pageNumber:t,scale:n,baseSize:r,active:o,registerSlot:s}){let c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useRef)(null),[p,m]=(0,i.useState)(!1),[h,g]=(0,i.useState)({width:r.width*n,height:r.height*n});return(0,i.useEffect)(()=>{g({width:r.width*n,height:r.height*n})},[r.width,r.height,n]),(0,i.useEffect)(()=>{if(!o)return;let r=!1,i=u.current;return f(i),(async()=>{try{let a=await e.getPage(t),o=a.getViewport({scale:n}),s=c.current;if(r||s===null||(await i?.promise.catch(()=>{}),r))return;g({width:o.width,height:o.height}),s.width=Math.floor(o.width),s.height=Math.floor(o.height);let f=a.render({canvas:s,viewport:o,annotationMode:0});if(u.current=f,await f.promise,r)return;await d(a,o,l.current,n),r||m(!1)}catch(e){let t=e instanceof Error?e.name:``;!r&&t!==`RenderingCancelledException`&&m(!0)}})(),()=>{r=!0,f(u.current)}},[e,t,n,o]),(0,a.jsx)(`div`,{ref:e=>s(t,e),"data-page":t,className:`relative mx-auto mb-4 bg-white shadow last:mb-0`,style:{width:h.width,height:h.height},children:p?(0,a.jsxs)(`p`,{className:`absolute inset-0 flex items-center justify-center p-4 text-center text-xs text-red-600 dark:text-red-400`,children:[`Page `,t,` could not be rendered.`]}):o?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`canvas`,{ref:c,className:`block h-full w-full`}),(0,a.jsx)(`div`,{ref:l,className:`pdf-text-layer`,"aria-hidden":!0})]}):null})}function g({path:e,serverUrl:t=``,token:n=null,onLoaded:r}){let[s,d]=(0,i.useState)(null),[f,g]=(0,i.useState)(null),[_,v]=(0,i.useState)(1),[y,b]=(0,i.useState)(2),[x,S]=(0,i.useState)(null),C=(0,i.useRef)(null),w=(0,i.useRef)(new Map);(0,i.useEffect)(()=>{let i=!1,a=null;return d(null),g(null),v(1),S(null),(async()=>{try{let{doc:o,task:s}=await u(await l(t,e,n));if(a=s,i){await s.destroy().catch(()=>{});return}try{let e=(await o.getPage(1)).getViewport({scale:1});i||S({width:e.width,height:e.height})}catch{i||S({width:612,height:792})}if(i)return;d(o),r?.(e)}catch(e){i||g(p(e)?e:{kind:`unreadable`})}})(),()=>{i=!0,a?.destroy().catch(()=>{})}},[e,t,n]);let T=s?.numPages??0,E=(0,i.useCallback)((e,t)=>{t===null?w.current.delete(e):w.current.set(e,t)},[]);(0,i.useEffect)(()=>{if(s===null||typeof IntersectionObserver>`u`)return;let e=C.current;if(e===null)return;let t=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=Number(t.target.dataset.page);Number.isFinite(e)&&v(e)}},{root:e,rootMargin:`-45% 0px -45% 0px`,threshold:0});for(let e of w.current.values())t.observe(e);return()=>t.disconnect()},[s,T]);let D=(0,i.useCallback)(e=>{e<1||e>T||(v(e),w.current.get(e)?.scrollIntoView({block:`start`}))},[T]);return f===null?s===null?(0,a.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,a.jsx)(`p`,{className:`text-sm text-zinc-500`,children:`Loading PDF…`})}):(0,a.jsxs)(`div`,{className:`flex h-full flex-col`,onKeyDown:e=>{if(e.key===`PageDown`||e.key===`ArrowRight`)D(_+1);else if(e.key===`PageUp`||e.key===`ArrowLeft`)D(_-1);else return;e.preventDefault()},children:[(0,a.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-zinc-200 px-3 py-2 text-xs dark:border-zinc-800`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:()=>D(_-1),disabled:_<=1,"aria-label":`Previous page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`‹`}),(0,a.jsxs)(`span`,{className:`tabular-nums text-zinc-600 dark:text-zinc-400`,children:[`Page `,_,` / `,T]}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>D(_+1),disabled:_>=T,"aria-label":`Next page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`›`}),(0,a.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:()=>b(e=>Math.max(0,e-1)),disabled:y===0,"aria-label":`Zoom out`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`−`}),(0,a.jsxs)(`span`,{className:`tabular-nums text-zinc-500`,children:[Math.round(o[y]*100),`%`]}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>b(e=>Math.min(o.length-1,e+1)),disabled:y===o.length-1,"aria-label":`Zoom in`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`+`})]})]}),(0,a.jsx)(`div`,{ref:C,className:`flex-1 overflow-auto bg-zinc-100 p-4 dark:bg-zinc-950`,children:x!==null&&Array.from({length:T},(e,t)=>t+1).map(e=>(0,a.jsx)(h,{doc:s,pageNumber:e,scale:o[y],baseSize:x,active:Math.abs(e-_)<=m,registerSlot:E},e))})]}):(0,a.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,a.jsx)(`p`,{className:`max-w-md text-center text-sm text-zinc-600 dark:text-zinc-400`,children:c(f)})})}export{g as PdfViewer,g as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-pU3WmOmo.js","assets/index-BWflhMWc.js","assets/rolldown-runtime-QTnfLwEv.js","assets/index-DpjN669x.css"])))=>i.map(i=>d[i]);
2
+ import{a as e,i as t,n,r}from"./index-BWflhMWc.js";var i=e(),a=r(),o=[.5,.75,1,1.25,1.5,2,3];function s(e){return e>=1024*1024?`${Math.round(e/(1024*1024))} MB`:`${Math.round(e/1024)} KB`}function c(e){switch(e.kind){case`too-large`:return e.limitBytes===void 0?`This PDF is larger than the server's PDF limit.`:`This PDF is larger than the ${s(e.limitBytes)} limit the server allows.`;case`encrypted`:return`This PDF is password-protected, so it cannot be displayed.`;case`not-found`:return`This file no longer exists.`;case`unauthorized`:return`This session is not authorized to read this file.`;case`unreadable`:return`This file could not be read as a PDF.`}}async function l(e,n,r){let i=await fetch(t(e,n,null),{headers:r?{Authorization:`Bearer ${r}`}:{}});if(!i.ok){if(i.status===413){let e=await i.json().catch(()=>({}));throw{kind:`too-large`,...typeof e.limit==`number`?{limitBytes:e.limit}:{}}}throw i.status===401||i.status===403?{kind:`unauthorized`}:i.status===404?{kind:`not-found`}:{kind:`unreadable`}}return new Uint8Array(await i.arrayBuffer())}async function u(e){let t=await n(()=>import(`./pdf-pU3WmOmo.js`),__vite__mapDeps([0,1,2,3]));t.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString();let r=t.getDocument({data:e,useWorkerFetch:!1,isOffscreenCanvasSupported:!1});try{return{doc:await r.promise,task:r}}catch(e){throw await r.destroy().catch(()=>{}),{kind:(e instanceof Error?e.name:``)===`PasswordException`?`encrypted`:`unreadable`}}}async function d(e,t,r,i){if(!(r===null||e.streamTextContent===void 0)){r.replaceChildren();try{let a=await n(()=>import(`./pdf-pU3WmOmo.js`),__vite__mapDeps([0,1,2,3]));r.style.setProperty(`--total-scale-factor`,String(i)),await new a.TextLayer({textContentSource:await e.streamTextContent(),container:r,viewport:t}).render()}catch{r.replaceChildren()}}}function f(e){try{e?.cancel()}catch{}}function p(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`}var m=1;function h({doc:e,pageNumber:t,scale:n,baseSize:r,active:o,registerSlot:s}){let c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useRef)(null),[p,m]=(0,i.useState)(!1),[h,g]=(0,i.useState)({width:r.width*n,height:r.height*n});return(0,i.useEffect)(()=>{g({width:r.width*n,height:r.height*n})},[r.width,r.height,n]),(0,i.useEffect)(()=>{if(!o)return;let r=!1,i=u.current;return f(i),(async()=>{try{let a=await e.getPage(t),o=a.getViewport({scale:n}),s=c.current;if(r||s===null||(await i?.promise.catch(()=>{}),r))return;g({width:o.width,height:o.height}),s.width=Math.floor(o.width),s.height=Math.floor(o.height);let f=a.render({canvas:s,viewport:o,annotationMode:0});if(u.current=f,await f.promise,r)return;await d(a,o,l.current,n),r||m(!1)}catch(e){let t=e instanceof Error?e.name:``;!r&&t!==`RenderingCancelledException`&&m(!0)}})(),()=>{r=!0,f(u.current)}},[e,t,n,o]),(0,a.jsx)(`div`,{ref:e=>s(t,e),"data-page":t,className:`relative mx-auto mb-4 bg-white shadow last:mb-0`,style:{width:h.width,height:h.height},children:p?(0,a.jsxs)(`p`,{className:`absolute inset-0 flex items-center justify-center p-4 text-center text-xs text-red-600 dark:text-red-400`,children:[`Page `,t,` could not be rendered.`]}):o?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`canvas`,{ref:c,className:`block h-full w-full`}),(0,a.jsx)(`div`,{ref:l,className:`pdf-text-layer`,"aria-hidden":!0})]}):null})}function g({path:e,serverUrl:t=``,token:n=null,onLoaded:r}){let[s,d]=(0,i.useState)(null),[f,g]=(0,i.useState)(null),[_,v]=(0,i.useState)(1),[y,b]=(0,i.useState)(2),[x,S]=(0,i.useState)(null),C=(0,i.useRef)(null),w=(0,i.useRef)(new Map);(0,i.useEffect)(()=>{let i=!1,a=null;return d(null),g(null),v(1),S(null),(async()=>{try{let{doc:o,task:s}=await u(await l(t,e,n));if(a=s,i){await s.destroy().catch(()=>{});return}try{let e=(await o.getPage(1)).getViewport({scale:1});i||S({width:e.width,height:e.height})}catch{i||S({width:612,height:792})}if(i)return;d(o),r?.(e)}catch(e){i||g(p(e)?e:{kind:`unreadable`})}})(),()=>{i=!0,a?.destroy().catch(()=>{})}},[e,t,n]);let T=s?.numPages??0,E=(0,i.useCallback)((e,t)=>{t===null?w.current.delete(e):w.current.set(e,t)},[]);(0,i.useEffect)(()=>{if(s===null||typeof IntersectionObserver>`u`)return;let e=C.current;if(e===null)return;let t=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=Number(t.target.dataset.page);Number.isFinite(e)&&v(e)}},{root:e,rootMargin:`-45% 0px -45% 0px`,threshold:0});for(let e of w.current.values())t.observe(e);return()=>t.disconnect()},[s,T]);let D=(0,i.useCallback)(e=>{e<1||e>T||(v(e),w.current.get(e)?.scrollIntoView({block:`start`}))},[T]);return f===null?s===null?(0,a.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,a.jsx)(`p`,{className:`text-sm text-zinc-500`,children:`Loading PDF…`})}):(0,a.jsxs)(`div`,{className:`flex h-full flex-col`,onKeyDown:e=>{if(e.key===`PageDown`||e.key===`ArrowRight`)D(_+1);else if(e.key===`PageUp`||e.key===`ArrowLeft`)D(_-1);else return;e.preventDefault()},children:[(0,a.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-zinc-200 px-3 py-2 text-xs dark:border-zinc-800`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:()=>D(_-1),disabled:_<=1,"aria-label":`Previous page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`‹`}),(0,a.jsxs)(`span`,{className:`tabular-nums text-zinc-600 dark:text-zinc-400`,children:[`Page `,_,` / `,T]}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>D(_+1),disabled:_>=T,"aria-label":`Next page`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`›`}),(0,a.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:()=>b(e=>Math.max(0,e-1)),disabled:y===0,"aria-label":`Zoom out`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`−`}),(0,a.jsxs)(`span`,{className:`tabular-nums text-zinc-500`,children:[Math.round(o[y]*100),`%`]}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>b(e=>Math.min(o.length-1,e+1)),disabled:y===o.length-1,"aria-label":`Zoom in`,className:`rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800`,children:`+`})]})]}),(0,a.jsx)(`div`,{ref:C,className:`flex-1 overflow-auto bg-zinc-100 p-4 dark:bg-zinc-950`,children:x!==null&&Array.from({length:T},(e,t)=>t+1).map(e=>(0,a.jsx)(h,{doc:s,pageNumber:e,scale:o[y],baseSize:x,active:Math.abs(e-_)<=m,registerSlot:E},e))})]}):(0,a.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,a.jsx)(`p`,{className:`max-w-md text-center text-sm text-zinc-600 dark:text-zinc-400`,children:c(f)})})}export{g as PdfViewer,g as default};
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-DbS7gJe7.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-_wZywoZs.js";import"./chunk-I66GZJ75-Crrt_0-l.js";import"./chunk-3NCLNEKW-DcwPPr-p.js";import{n as i,r as a,t as o}from"./chunk-6Q2QTUOP-C2P_VKtw.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
1
+ import{m as e,t}from"./mermaid-parser.core-Dyx1WWw_.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-_wZywoZs.js";import"./chunk-I66GZJ75-CAg8Cp7h.js";import"./chunk-3NCLNEKW-CDW_UFrj.js";import{n as i,r as a,t as o}from"./chunk-6Q2QTUOP-CgZiYapq.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
@@ -0,0 +1 @@
1
+ import"./chunk-KEIR6QF5-BfrZ3jm6.js";import{M as e}from"./mermaid-parser.core-Dyx1WWw_.js";export{e as createArchitectureServices};