@legionworks/facet 1.9.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 (327) hide show
  1. package/LICENSE-APACHE +202 -0
  2. package/LICENSE-MIT +23 -0
  3. package/README.md +158 -0
  4. package/dist/gallery/chunk-4g8rem85.css +656 -0
  5. package/dist/gallery/chunk-c6s9k9ty.js +5970 -0
  6. package/dist/gallery/frame/artifact.css +8424 -0
  7. package/dist/gallery/frame/chunks/abnfDiagram-N423BO3Z-jj74szbm.js +155 -0
  8. package/dist/gallery/frame/chunks/architecture-TIHT7OUA-cvdjn7dt.js +10 -0
  9. package/dist/gallery/frame/chunks/architectureDiagram-T3A2C74G-n4z77eg6.js +8675 -0
  10. package/dist/gallery/frame/chunks/blockDiagram-VBNYF7ZC-7xsqzrd1.js +3529 -0
  11. package/dist/gallery/frame/chunks/c4Diagram-5PPSVZJV-z2zjs7wx.js +2413 -0
  12. package/dist/gallery/frame/chunks/classDiagram-JCYQIIEL-ve8rngqp.js +47 -0
  13. package/dist/gallery/frame/chunks/classDiagram-v2-OCEON4UE-8cfaxb8z.js +47 -0
  14. package/dist/gallery/frame/chunks/cose-bilkent-JH36ORCC-sn92qexx.js +4822 -0
  15. package/dist/gallery/frame/chunks/cynefin-VYW2F7L2-tqjv913d.js +10 -0
  16. package/dist/gallery/frame/chunks/cynefinDiagram-MW4NZA55-c1c0dj12.js +500 -0
  17. package/dist/gallery/frame/chunks/dagre-VZM6K2ZE-7tyg4yt2.js +476 -0
  18. package/dist/gallery/frame/chunks/diagram-7IWD3JNH-y4eng9sc.js +526 -0
  19. package/dist/gallery/frame/chunks/diagram-B4RE2ZJO-rn3p7j5h.js +673 -0
  20. package/dist/gallery/frame/chunks/diagram-LBJQPF4R-w4a2cm9q.js +255 -0
  21. package/dist/gallery/frame/chunks/diagram-Q27KOJAE-aqc2v7wy.js +575 -0
  22. package/dist/gallery/frame/chunks/diagram-UB23O5K3-xncy8nyd.js +355 -0
  23. package/dist/gallery/frame/chunks/ebnfDiagram-BXEA7PRR-acwgxz16.js +175 -0
  24. package/dist/gallery/frame/chunks/erDiagram-JOGREHBK-mzp5nswt.js +1332 -0
  25. package/dist/gallery/frame/chunks/eventmodeling-45OFAUF4-sg07qr0c.js +10 -0
  26. package/dist/gallery/frame/chunks/flowDiagram-UKHOOZJN-2e5ygs44.js +29 -0
  27. package/dist/gallery/frame/chunks/ganttDiagram-PKOTCBZU-p2hhh7hr.js +2620 -0
  28. package/dist/gallery/frame/chunks/gitGraph-TEB2WS4Q-j6kw0naa.js +10 -0
  29. package/dist/gallery/frame/chunks/gitGraphDiagram-DS77QQ5N-4z9z8wjm.js +1347 -0
  30. package/dist/gallery/frame/chunks/info-DKCQHKI2-mpt80jd3.js +10 -0
  31. package/dist/gallery/frame/chunks/infoDiagram-6WML65LV-5rqm3mgg.js +65 -0
  32. package/dist/gallery/frame/chunks/ishikawaDiagram-WSZJBQD7-b51z96jy.js +975 -0
  33. package/dist/gallery/frame/chunks/journeyDiagram-NVQOT4AX-9jbfp0pk.js +1272 -0
  34. package/dist/gallery/frame/chunks/kanban-definition-27J2QSJJ-4x0vx4se.js +1116 -0
  35. package/dist/gallery/frame/chunks/katex-xfgk95tv.js +14034 -0
  36. package/dist/gallery/frame/chunks/markdown-1s5vwkf2.js +9 -0
  37. package/dist/gallery/frame/chunks/markdown-2h6bwsms.js +3239 -0
  38. package/dist/gallery/frame/chunks/markdown-2x113yh8.js +107 -0
  39. package/dist/gallery/frame/chunks/markdown-30b7rwmp.js +1943 -0
  40. package/dist/gallery/frame/chunks/markdown-356bfj4g.js +2031 -0
  41. package/dist/gallery/frame/chunks/markdown-44n9ea69.js +2406 -0
  42. package/dist/gallery/frame/chunks/markdown-56enrf2r.js +39 -0
  43. package/dist/gallery/frame/chunks/markdown-5avymm8t.js +725 -0
  44. package/dist/gallery/frame/chunks/markdown-6r4svars.js +33 -0
  45. package/dist/gallery/frame/chunks/markdown-6zz8efx2.js +24 -0
  46. package/dist/gallery/frame/chunks/markdown-7jp6prnb.js +19 -0
  47. package/dist/gallery/frame/chunks/markdown-809k7q41.js +55 -0
  48. package/dist/gallery/frame/chunks/markdown-82xmzhzd.js +1076 -0
  49. package/dist/gallery/frame/chunks/markdown-92n37gd4.js +7627 -0
  50. package/dist/gallery/frame/chunks/markdown-ag2sssf8.js +36 -0
  51. package/dist/gallery/frame/chunks/markdown-b4s7ntq2.js +19 -0
  52. package/dist/gallery/frame/chunks/markdown-c9k0fvp1.js +100 -0
  53. package/dist/gallery/frame/chunks/markdown-ceefymn8.js +125 -0
  54. package/dist/gallery/frame/chunks/markdown-d1wfbs70.js +243 -0
  55. package/dist/gallery/frame/chunks/markdown-dy5sgjhc.js +11022 -0
  56. package/dist/gallery/frame/chunks/markdown-dz3z5w30.js +30868 -0
  57. package/dist/gallery/frame/chunks/markdown-eg6ngz7y.js +30340 -0
  58. package/dist/gallery/frame/chunks/markdown-ff5wvb43.js +1149 -0
  59. package/dist/gallery/frame/chunks/markdown-ffg06nfz.js +86 -0
  60. package/dist/gallery/frame/chunks/markdown-fvfncadf.js +472 -0
  61. package/dist/gallery/frame/chunks/markdown-gvyszqpv.js +19 -0
  62. package/dist/gallery/frame/chunks/markdown-gx1p0ew0.js +88 -0
  63. package/dist/gallery/frame/chunks/markdown-gxye5frz.js +65 -0
  64. package/dist/gallery/frame/chunks/markdown-h7pzv34e.js +105 -0
  65. package/dist/gallery/frame/chunks/markdown-hab789t9.js +47 -0
  66. package/dist/gallery/frame/chunks/markdown-hjp6sj8t.js +125 -0
  67. package/dist/gallery/frame/chunks/markdown-jka64qgp.js +1993 -0
  68. package/dist/gallery/frame/chunks/markdown-k8xkn8mw.js +56 -0
  69. package/dist/gallery/frame/chunks/markdown-m7frq8x8.js +112 -0
  70. package/dist/gallery/frame/chunks/markdown-p740v4qm.js +36 -0
  71. package/dist/gallery/frame/chunks/markdown-pxfeh231.js +57 -0
  72. package/dist/gallery/frame/chunks/markdown-pzgd8z3s.js +87 -0
  73. package/dist/gallery/frame/chunks/markdown-qx3cngz2.js +1673 -0
  74. package/dist/gallery/frame/chunks/markdown-rawhfvvc.js +85 -0
  75. package/dist/gallery/frame/chunks/markdown-rd8w0ng9.js +49 -0
  76. package/dist/gallery/frame/chunks/markdown-rm2yxfjj.js +2773 -0
  77. package/dist/gallery/frame/chunks/markdown-s1jatrnk.js +993 -0
  78. package/dist/gallery/frame/chunks/markdown-sgfg5vvq.js +59 -0
  79. package/dist/gallery/frame/chunks/markdown-t4ethv9d.js +409 -0
  80. package/dist/gallery/frame/chunks/markdown-tnmabqvz.js +36 -0
  81. package/dist/gallery/frame/chunks/markdown-tvdpppw8.js +5292 -0
  82. package/dist/gallery/frame/chunks/markdown-v0x27twr.js +22 -0
  83. package/dist/gallery/frame/chunks/markdown-v14td68x.js +36 -0
  84. package/dist/gallery/frame/chunks/markdown-w6sgd54z.js +36 -0
  85. package/dist/gallery/frame/chunks/markdown-xw8dsk8b.js +2125 -0
  86. package/dist/gallery/frame/chunks/markdown-y18mve73.js +85 -0
  87. package/dist/gallery/frame/chunks/markdown-yengsms5.js +427 -0
  88. package/dist/gallery/frame/chunks/markdown-z1wc0v0d.js +1826 -0
  89. package/dist/gallery/frame/chunks/markdown-zazx9h4n.js +329 -0
  90. package/dist/gallery/frame/chunks/mermaid-de7p4v0x.js +30 -0
  91. package/dist/gallery/frame/chunks/mindmap-definition-FAOFIHXS-ra44cbem.js +1216 -0
  92. package/dist/gallery/frame/chunks/packet-7NZHBO7P-xppm5913.js +10 -0
  93. package/dist/gallery/frame/chunks/pegDiagram-VL7TDLO6-a2a4wg03.js +163 -0
  94. package/dist/gallery/frame/chunks/pie-RZYD4A2V-hnbxk152.js +10 -0
  95. package/dist/gallery/frame/chunks/pieDiagram-7S7Q4E2Y-f1vxjtmx.js +311 -0
  96. package/dist/gallery/frame/chunks/quadrantDiagram-CIZ2JOQS-ywafa6kh.js +1390 -0
  97. package/dist/gallery/frame/chunks/radar-I7S5WNFK-ewqd27se.js +10 -0
  98. package/dist/gallery/frame/chunks/railroad-3IZDKUUU-5hy4bdx3.js +10 -0
  99. package/dist/gallery/frame/chunks/railroad-abnf-AHOZXSZD-bh5sxz0d.js +10 -0
  100. package/dist/gallery/frame/chunks/railroad-ebnf-EBAXGLYW-6b9c3zeh.js +10 -0
  101. package/dist/gallery/frame/chunks/railroad-peg-LSFZ7HO6-avc8v39s.js +10 -0
  102. package/dist/gallery/frame/chunks/railroadDiagram-AXF67PYL-qc61wax4.js +131 -0
  103. package/dist/gallery/frame/chunks/requirementDiagram-LRYGKXZP-9bs4786c.js +1295 -0
  104. package/dist/gallery/frame/chunks/sankeyDiagram-W5VNT64P-awt1em8b.js +1339 -0
  105. package/dist/gallery/frame/chunks/sequenceDiagram-SI44F4Z6-qaf9mz3t.js +4324 -0
  106. package/dist/gallery/frame/chunks/sizeCapture-X5ZJPWSS-9fq685xd.js +64 -0
  107. package/dist/gallery/frame/chunks/stateDiagram-OKZ733FA-vx7a7hh0.js +456 -0
  108. package/dist/gallery/frame/chunks/stateDiagram-v2-UEYNNEHI-x4m6ws5t.js +46 -0
  109. package/dist/gallery/frame/chunks/swimlanes-SLNWSIFB-e4mxm1gh.js +8287 -0
  110. package/dist/gallery/frame/chunks/swimlanesDiagram-ULZ7WXOC-0h93e2qq.js +42 -0
  111. package/dist/gallery/frame/chunks/timeline-definition-Z64GVDOM-wp0bhbzg.js +1549 -0
  112. package/dist/gallery/frame/chunks/treeView-QDETBFTQ-hcx7n0vt.js +10 -0
  113. package/dist/gallery/frame/chunks/treemap-6X3UGDF4-av02skdw.js +10 -0
  114. package/dist/gallery/frame/chunks/vennDiagram-T6HMQDX7-pmvk1p7n.js +2566 -0
  115. package/dist/gallery/frame/chunks/wardley-OPB4EBWU-njsp6e40.js +10 -0
  116. package/dist/gallery/frame/chunks/wardleyDiagram-T6FBY63Y-eggmnv4z.js +979 -0
  117. package/dist/gallery/frame/chunks/xychartDiagram-ELKLHX3M-q40tnpe5.js +1954 -0
  118. package/dist/gallery/frame/frame.css +183 -0
  119. package/dist/gallery/frame/runtime/chart.js +42744 -0
  120. package/dist/gallery/frame/runtime/html.js +14 -0
  121. package/dist/gallery/frame/runtime/markdown.js +1403 -0
  122. package/dist/gallery/frame/runtime/mermaid.js +32 -0
  123. package/dist/gallery/frame/runtime/svg.js +14 -0
  124. package/dist/gallery/frame/runtime/tsx.js +52 -0
  125. package/dist/gallery/index.html +104 -0
  126. package/docs/reference/cli.md +163 -0
  127. package/docs/reference/export.md +106 -0
  128. package/docs/reference/html.md +215 -0
  129. package/docs/reference/http.md +85 -0
  130. package/docs/reference/mcp.md +78 -0
  131. package/docs/reference/security.md +119 -0
  132. package/docs/reference/storage.md +93 -0
  133. package/docs/reference/tsx.md +101 -0
  134. package/docs/reference/validation.md +212 -0
  135. package/package.json +89 -0
  136. package/scripts/build-gallery.ts +127 -0
  137. package/scripts/launch-netns.sh +67 -0
  138. package/skills/facet/SKILL.md +100 -0
  139. package/src/cli/client.ts +311 -0
  140. package/src/cli/commands/create.ts +49 -0
  141. package/src/cli/commands/doctor.ts +249 -0
  142. package/src/cli/commands/export.ts +179 -0
  143. package/src/cli/commands/instantiate.ts +35 -0
  144. package/src/cli/commands/list.ts +49 -0
  145. package/src/cli/commands/open.ts +75 -0
  146. package/src/cli/commands/pin.ts +39 -0
  147. package/src/cli/commands/promote.ts +49 -0
  148. package/src/cli/commands/publish.ts +122 -0
  149. package/src/cli/commands/read-back.ts +56 -0
  150. package/src/cli/commands/status.ts +114 -0
  151. package/src/cli/commands/watch.ts +146 -0
  152. package/src/cli/main.ts +522 -0
  153. package/src/cli/output.ts +106 -0
  154. package/src/cli/parser.ts +376 -0
  155. package/src/cli/presenter.ts +212 -0
  156. package/src/cli/service-metadata.ts +134 -0
  157. package/src/cli/spawn-service.ts +326 -0
  158. package/src/css.d.ts +4 -0
  159. package/src/gallery-web/app.ts +1581 -0
  160. package/src/gallery-web/export-menu.ts +121 -0
  161. package/src/gallery-web/export.ts +112 -0
  162. package/src/gallery-web/favicon.ts +54 -0
  163. package/src/gallery-web/frame/entries/chart.ts +6 -0
  164. package/src/gallery-web/frame/entries/html.ts +6 -0
  165. package/src/gallery-web/frame/entries/markdown.ts +6 -0
  166. package/src/gallery-web/frame/entries/mermaid.ts +6 -0
  167. package/src/gallery-web/frame/entries/svg.ts +6 -0
  168. package/src/gallery-web/frame/entries/tsx.ts +6 -0
  169. package/src/gallery-web/frame/frame-payload.ts +91 -0
  170. package/src/gallery-web/frame/renderer-validation.ts +13 -0
  171. package/src/gallery-web/frame/renderers/chart.ts +182 -0
  172. package/src/gallery-web/frame/renderers/dompurify-shim.ts +112 -0
  173. package/src/gallery-web/frame/renderers/html.ts +48 -0
  174. package/src/gallery-web/frame/renderers/markdown.ts +81 -0
  175. package/src/gallery-web/frame/renderers/mermaid.ts +120 -0
  176. package/src/gallery-web/frame/renderers/registry.ts +260 -0
  177. package/src/gallery-web/frame/renderers/svg.ts +393 -0
  178. package/src/gallery-web/frame/renderers/tsx.ts +61 -0
  179. package/src/gallery-web/frame/runtime.ts +501 -0
  180. package/src/gallery-web/frame/styles/artifact.css +8424 -0
  181. package/src/gallery-web/frame/styles/frame.css +183 -0
  182. package/src/gallery-web/frame/styles/html-source.css +23 -0
  183. package/src/gallery-web/frame/view-box.ts +33 -0
  184. package/src/gallery-web/frame-html.ts +72 -0
  185. package/src/gallery-web/index.html +104 -0
  186. package/src/gallery-web/session.ts +107 -0
  187. package/src/gallery-web/sse-client.ts +212 -0
  188. package/src/gallery-web/styles/app.css +420 -0
  189. package/src/gallery-web/styles/tokens.css +112 -0
  190. package/src/gallery-web/styles/verdict.css +186 -0
  191. package/src/gallery-web/swap.ts +64 -0
  192. package/src/gallery-web/theme.ts +40 -0
  193. package/src/gallery-web/view-state.ts +93 -0
  194. package/src/harness-adapters/claude-code/README.md +10 -0
  195. package/src/harness-adapters/claude-code/facet.sh +4 -0
  196. package/src/harness-adapters/codex/README.md +10 -0
  197. package/src/harness-adapters/codex/facet.sh +4 -0
  198. package/src/harness-adapters/mcp/README.md +13 -0
  199. package/src/harness-adapters/mcp/cli-bridge.ts +216 -0
  200. package/src/harness-adapters/mcp/main.ts +15 -0
  201. package/src/harness-adapters/mcp/server.ts +164 -0
  202. package/src/harness-adapters/mcp/tool-schemas.ts +53 -0
  203. package/src/harness-adapters/opencode/README.md +10 -0
  204. package/src/harness-adapters/opencode/facet.sh +4 -0
  205. package/src/runtime/compiled-entrypoints.ts +69 -0
  206. package/src/service/dispatcher.ts +717 -0
  207. package/src/service/export.ts +218 -0
  208. package/src/service/http-utils.ts +55 -0
  209. package/src/service/lexical/expectations.ts +210 -0
  210. package/src/service/lifecycle/idle-controller.ts +125 -0
  211. package/src/service/lifecycle/orphan-cleanup.ts +128 -0
  212. package/src/service/lifecycle/process-lock.ts +235 -0
  213. package/src/service/main.ts +136 -0
  214. package/src/service/process.ts +240 -0
  215. package/src/service/router-guards.ts +239 -0
  216. package/src/service/router.ts +627 -0
  217. package/src/service/security/auth.ts +168 -0
  218. package/src/service/security/host-origin.ts +138 -0
  219. package/src/service/security/http-guards.ts +13 -0
  220. package/src/service/security/leases.ts +182 -0
  221. package/src/service/security/token-store.ts +138 -0
  222. package/src/service/server.ts +356 -0
  223. package/src/service/store/database.ts +61 -0
  224. package/src/service/store/evidence-retention.ts +234 -0
  225. package/src/service/store/migrations.ts +167 -0
  226. package/src/service/store/repository-lifecycle.ts +121 -0
  227. package/src/service/store/repository.ts +732 -0
  228. package/src/service/store/schema.ts +218 -0
  229. package/src/service/stored-verdict.ts +97 -0
  230. package/src/service/stream.ts +301 -0
  231. package/src/service/verdict-enrichment.ts +45 -0
  232. package/src/shared/build/frame-bundle-plugins.ts +61 -0
  233. package/src/shared/build-mode.ts +28 -0
  234. package/src/shared/config/evidence-read.ts +98 -0
  235. package/src/shared/config/limits.ts +56 -0
  236. package/src/shared/config/paths.ts +96 -0
  237. package/src/shared/contracts/artifact-types.ts +2 -0
  238. package/src/shared/contracts/artifact.ts +98 -0
  239. package/src/shared/contracts/commands/_shared.ts +59 -0
  240. package/src/shared/contracts/commands/guards.ts +86 -0
  241. package/src/shared/contracts/commands/index.ts +204 -0
  242. package/src/shared/contracts/commands/names.ts +35 -0
  243. package/src/shared/contracts/commands/requests.ts +149 -0
  244. package/src/shared/contracts/commands/results.ts +200 -0
  245. package/src/shared/contracts/envelope.ts +140 -0
  246. package/src/shared/contracts/events.ts +41 -0
  247. package/src/shared/contracts/observed-counts.ts +19 -0
  248. package/src/shared/contracts/renderers.ts +6 -0
  249. package/src/shared/contracts/validation.ts +296 -0
  250. package/src/shared/errors/facet-error.ts +127 -0
  251. package/src/shared/errors/store-error.ts +68 -0
  252. package/src/shared/evidence-image.ts +37 -0
  253. package/src/shared/export.ts +31 -0
  254. package/src/shared/html/policy.ts +108 -0
  255. package/src/shared/html/style-vocabulary.ts +352 -0
  256. package/src/shared/logging/logger.ts +108 -0
  257. package/src/shared/logging/redact.ts +49 -0
  258. package/src/shared/security/frozen-csp.ts +13 -0
  259. package/src/shared/storage-version.ts +2 -0
  260. package/src/shared/tsx/execution.ts +29 -0
  261. package/src/shared/tsx/import-policy.ts +94 -0
  262. package/src/shared/util/dir-permissions.ts +94 -0
  263. package/src/shared/util/mermaid-nodes.ts +230 -0
  264. package/src/shared/util/process.ts +67 -0
  265. package/src/shared/util/time.ts +21 -0
  266. package/src/shared/version.ts +3 -0
  267. package/src/validation/sandbox/limits.ts +41 -0
  268. package/src/validation/sandbox/netns.ts +177 -0
  269. package/src/validation/tier0/chart.ts +177 -0
  270. package/src/validation/tier0/dom-shim.ts +54 -0
  271. package/src/validation/tier0/html.ts +408 -0
  272. package/src/validation/tier0/markdown.ts +285 -0
  273. package/src/validation/tier0/mermaid.ts +98 -0
  274. package/src/validation/tier0/runner.ts +504 -0
  275. package/src/validation/tier0/svg.ts +321 -0
  276. package/src/validation/tier0/tsx/allowlist-resolver.ts +77 -0
  277. package/src/validation/tier0/tsx/ast-policy-capabilities.ts +238 -0
  278. package/src/validation/tier0/tsx/ast-policy-shared.ts +71 -0
  279. package/src/validation/tier0/tsx/ast-policy.ts +181 -0
  280. package/src/validation/tier0/tsx/compiler.ts +156 -0
  281. package/src/validation/tier0/worker-dispatch.ts +211 -0
  282. package/src/validation/tier0/worker-entry.ts +96 -0
  283. package/src/validation/tier0/worker-input.ts +75 -0
  284. package/src/validation/tier1/browser-process.ts +147 -0
  285. package/src/validation/tier1/cdp-pipe.ts +281 -0
  286. package/src/validation/tier1/entries/chart.ts +5 -0
  287. package/src/validation/tier1/entries/html.ts +6 -0
  288. package/src/validation/tier1/entries/markdown.ts +5 -0
  289. package/src/validation/tier1/entries/mermaid.ts +5 -0
  290. package/src/validation/tier1/entries/svg.ts +5 -0
  291. package/src/validation/tier1/entries/tsx.ts +5 -0
  292. package/src/validation/tier1/frame-target.ts +162 -0
  293. package/src/validation/tier1/harness-entry.ts +261 -0
  294. package/src/validation/tier1/harness.ts +215 -0
  295. package/src/validation/tier1/isolated-probe.ts +94 -0
  296. package/src/validation/tier1/launcher.ts +177 -0
  297. package/src/validation/tier1/limits.ts +80 -0
  298. package/src/validation/tier1/nonce.ts +17 -0
  299. package/src/validation/tier1/protocol-probe.ts +519 -0
  300. package/src/validation/tier1/runner.ts +1122 -0
  301. package/src/validation/tier1/verdict.ts +246 -0
  302. package/src/validation/tier1/webp.ts +69 -0
  303. package/templates/README.md +88 -0
  304. package/templates/bar-compare.vl.json +63 -0
  305. package/templates/capacity-report.tsx +102 -0
  306. package/templates/decision-record.md +24 -0
  307. package/templates/deployment-state.mmd +40 -0
  308. package/templates/exemplar.md +91 -0
  309. package/templates/facet-story.tsx +799 -0
  310. package/templates/fleet-dashboard.html +141 -0
  311. package/templates/html-release-ledger.html +91 -0
  312. package/templates/html-status-report.html +114 -0
  313. package/templates/incident-console.tsx +147 -0
  314. package/templates/legion-boundaries.mmd +23 -0
  315. package/templates/legion-flow.mmd +15 -0
  316. package/templates/legion-sequence.mmd +14 -0
  317. package/templates/legion-state.mmd +7 -0
  318. package/templates/metric-card.svg +29 -0
  319. package/templates/observability-map.svg +101 -0
  320. package/templates/pipeline-audit.md +108 -0
  321. package/templates/release-metrics.vl.json +98 -0
  322. package/templates/service-topology.mmd +47 -0
  323. package/templates/status-report.md +32 -0
  324. package/templates/system-map.svg +53 -0
  325. package/templates/timeseries.vl.json +71 -0
  326. package/templates/tsx-interactive-counter.tsx +19 -0
  327. package/templates/tsx-status-report.tsx +31 -0
@@ -0,0 +1,32 @@
1
+ import {
2
+ renderMermaidDocument
3
+ } from "../chunks/markdown-z1wc0v0d.js";
4
+ import"../chunks/markdown-6zz8efx2.js";
5
+ import"../chunks/markdown-rm2yxfjj.js";
6
+ import"../chunks/markdown-h7pzv34e.js";
7
+ import"../chunks/markdown-zazx9h4n.js";
8
+ import {
9
+ installGalleryFrameApi
10
+ } from "../chunks/markdown-fvfncadf.js";
11
+ import {
12
+ createRendererRegistry
13
+ } from "../chunks/markdown-d1wfbs70.js";
14
+ import"../chunks/markdown-s1jatrnk.js";
15
+ import"../chunks/markdown-m7frq8x8.js";
16
+ import"../chunks/markdown-tvdpppw8.js";
17
+ import"../chunks/markdown-sgfg5vvq.js";
18
+ import"../chunks/markdown-82xmzhzd.js";
19
+ import"../chunks/markdown-c9k0fvp1.js";
20
+ import"../chunks/markdown-qx3cngz2.js";
21
+ import"../chunks/markdown-yengsms5.js";
22
+ import"../chunks/markdown-ff5wvb43.js";
23
+ import"../chunks/markdown-pzgd8z3s.js";
24
+ import"../chunks/markdown-92n37gd4.js";
25
+ import"../chunks/markdown-xw8dsk8b.js";
26
+ import"../chunks/markdown-1s5vwkf2.js";
27
+ import"../chunks/markdown-dy5sgjhc.js";
28
+ import"../chunks/markdown-809k7q41.js";
29
+
30
+ // src/gallery-web/frame/entries/mermaid.ts
31
+ var registry = createRendererRegistry([["mermaid", renderMermaidDocument]]);
32
+ installGalleryFrameApi(registry);
@@ -0,0 +1,14 @@
1
+ import {
2
+ renderSvgDocument
3
+ } from "../chunks/markdown-zazx9h4n.js";
4
+ import {
5
+ installGalleryFrameApi
6
+ } from "../chunks/markdown-fvfncadf.js";
7
+ import {
8
+ createRendererRegistry
9
+ } from "../chunks/markdown-d1wfbs70.js";
10
+ import"../chunks/markdown-809k7q41.js";
11
+
12
+ // src/gallery-web/frame/entries/svg.ts
13
+ var registry = createRendererRegistry([["svg", renderSvgDocument]]);
14
+ installGalleryFrameApi(registry);
@@ -0,0 +1,52 @@
1
+ import {
2
+ renderHtml
3
+ } from "../chunks/markdown-rd8w0ng9.js";
4
+ import {
5
+ installGalleryFrameApi
6
+ } from "../chunks/markdown-fvfncadf.js";
7
+ import {
8
+ RENDER_ERROR_ATTRIBUTE,
9
+ appendRenderError,
10
+ createRendererRegistry
11
+ } from "../chunks/markdown-d1wfbs70.js";
12
+ import"../chunks/markdown-809k7q41.js";
13
+
14
+ // src/gallery-web/frame/renderers/tsx.ts
15
+ var browserTsxModuleRuntime = {
16
+ createObjectURL: (blob) => URL.createObjectURL(blob),
17
+ importModule: async (url) => import(url),
18
+ revokeObjectURL: (url) => URL.revokeObjectURL(url)
19
+ };
20
+ var tsxModuleRuntime = browserTsxModuleRuntime;
21
+ function appendRuntimeError(container, event) {
22
+ if (container.querySelector(`[${RENDER_ERROR_ATTRIBUTE}="true"]`) !== null)
23
+ return;
24
+ appendRenderError(container, event);
25
+ }
26
+ async function renderTsx(ctx, bytes, renderer, execution = "static") {
27
+ if (execution === "static") {
28
+ await renderHtml(ctx, bytes);
29
+ return;
30
+ }
31
+ const root = ctx.container.ownerDocument.createElement("main");
32
+ root.id = "facet-tsx-mount";
33
+ root.setAttribute("data-facet-renderer-root", "true");
34
+ ctx.container.replaceChildren(root);
35
+ const frameWindow = ctx.container.ownerDocument.defaultView;
36
+ const report = (event) => appendRuntimeError(ctx.container, event);
37
+ frameWindow?.addEventListener("error", report, true);
38
+ frameWindow?.addEventListener("unhandledrejection", report, true);
39
+ const moduleUrl = tsxModuleRuntime.createObjectURL(new Blob([bytes], { type: "text/javascript" }));
40
+ try {
41
+ await tsxModuleRuntime.importModule(moduleUrl);
42
+ } catch (error) {
43
+ appendRuntimeError(ctx.container, error);
44
+ throw error;
45
+ } finally {
46
+ tsxModuleRuntime.revokeObjectURL(moduleUrl);
47
+ }
48
+ }
49
+
50
+ // src/gallery-web/frame/entries/tsx.ts
51
+ var registry = createRendererRegistry([["tsx", renderTsx]]);
52
+ installGalleryFrameApi(registry);
@@ -0,0 +1,104 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>facet gallery</title>
7
+ <link id="facet-favicon" rel="icon" />
8
+
9
+
10
+
11
+ <link rel="stylesheet" crossorigin href="./chunk-4g8rem85.css"><script type="module" crossorigin src="./chunk-c6s9k9ty.js"></script></head>
12
+ <body>
13
+ <div id="facet-shell">
14
+ <header id="facet-status">
15
+ <span id="facet-mark" aria-hidden="true">◆</span>
16
+ <span class="title" id="facet-title">facet</span>
17
+ <span class="sep" aria-hidden="true"></span>
18
+ <span id="facet-artifact-title"></span>
19
+ <span class="revision" id="facet-revision">—</span>
20
+ <span class="status-line" id="facet-status-line">idle</span>
21
+ <!--
22
+ Verdict badge. JS wiring: set data-status to the FULL wire
23
+ enum, text to status.split(":")[0], and the tier span to
24
+ `· T${verdict.tier}` (empty while unverified). The badge
25
+ shows read-back results only — the shell never derives one.
26
+ -->
27
+ <span class="facet-verdict facet-verdict--sm" id="facet-verdict" data-status="unverified"
28
+ >unverified<span class="tier"></span
29
+ ></span>
30
+ </header>
31
+ <!-- Evidence strip — unhidden when a verdict is loaded. -->
32
+ <section id="facet-evidence" hidden>
33
+ <span class="label">OBSERVED</span>
34
+ <span id="facet-evidence-counts"></span>
35
+ <span class="label">CHANNELS</span>
36
+ <span class="facet-channels" id="facet-evidence-channels"></span>
37
+ <span class="divergence" id="facet-evidence-divergence"></span>
38
+ <span class="binding">bound to <span class="sha" id="facet-evidence-sha"></span></span>
39
+ </section>
40
+ <main id="facet-canvas">
41
+ <div id="facet-swapbar" hidden><div class="bar"></div></div>
42
+ <div id="facet-empty">
43
+ <span class="glyph" aria-hidden="true">◌</span>
44
+ <span class="head">No artifact.</span>
45
+ <span class="sub">Publish one to display it here.</span>
46
+ <span class="cmd"
47
+ ><span class="p">$</span> facet publish ./artifact.md
48
+ <span class="p">&amp;&amp;</span> facet open</span
49
+ >
50
+ </div>
51
+ <div id="facet-expired" hidden>
52
+ <span class="glyph" aria-hidden="true">✗</span>
53
+ <span class="head">Session expired.</span>
54
+ <span class="sub">The display lease is no longer valid.</span>
55
+ <span class="cmd"><span class="p">$</span> facet open</span>
56
+ </div>
57
+ <!-- The iframe is created + appended by app.ts. JS wiring:
58
+ hide #facet-empty whenever a frame is mounted. -->
59
+ </main>
60
+ <footer id="facet-controls">
61
+ <span id="facet-live" data-state="idle"
62
+ ><span class="dot" aria-hidden="true">●</span
63
+ ><span id="facet-live-label">idle</span></span
64
+ >
65
+ <span id="facet-error" role="status"></span>
66
+ <span class="spacer"></span>
67
+ <button
68
+ type="button"
69
+ id="facet-panzoom-toggle"
70
+ aria-label="toggle pan and zoom"
71
+ aria-pressed="false"
72
+ >
73
+ pan/zoom
74
+ </button>
75
+ <button type="button" id="facet-zoom-out" aria-label="zoom out">−</button>
76
+ <button type="button" id="facet-zoom-reset" aria-label="reset zoom">100%</button>
77
+ <button type="button" id="facet-zoom-in" aria-label="zoom in">+</button>
78
+ <button type="button" id="facet-theme-toggle" aria-label="theme: system">
79
+ theme: system
80
+ </button>
81
+ <div id="facet-export" class="facet-export">
82
+ <button type="button" id="facet-export-toggle" aria-haspopup="menu" aria-expanded="false">
83
+ export
84
+ </button>
85
+ <div id="facet-export-menu" role="menu" hidden>
86
+ <button type="button" id="facet-export-source" role="menuitem">source</button>
87
+ <button
88
+ type="button"
89
+ id="facet-export-render"
90
+ role="menuitem"
91
+ disabled
92
+ title="no stored render"
93
+ >
94
+ render
95
+ </button>
96
+ <button type="button" id="facet-export-sidecar" role="menuitem">sidecar</button>
97
+ </div>
98
+ </div>
99
+ <button type="button" id="facet-fullscreen" aria-label="fullscreen">fullscreen</button>
100
+ </footer>
101
+ </div>
102
+
103
+ </body>
104
+ </html>
@@ -0,0 +1,163 @@
1
+ # CLI reference
2
+
3
+ `facet` writes one JSON envelope per command to stdout. Diagnostics go to
4
+ stderr. `--help` and `--version` may use text output; verbs always use JSON.
5
+ Install `@legionworks/facet` with Bun, npm, or pnpm, or invoke it with
6
+ `bunx @legionworks/facet <verb>`. Bun `1.4.0` or newer is required at runtime;
7
+ npm and pnpm are distribution channels only. The pinned browser downloads on
8
+ the first visual read-back.
9
+ Named exception: `publish --watch` is a stream and writes one envelope per
10
+ publish attempt as NDJSON in machine mode; a TTY receives presenter lines.
11
+
12
+ ## Envelope
13
+
14
+ ```json
15
+ { "schemaVersion": "facet.v1", "requestId": "req-<uuid>", "ok": true, "data": {} }
16
+ ```
17
+
18
+ Errors use the same top level with `ok: false` and
19
+ `error: { code, message, retryable, details? }`.
20
+
21
+ ## Verbs and flags
22
+
23
+ | verb | flags |
24
+ | ------------- | --------------------------------------------------------------------------------------------------------------------------------- |
25
+ | `create` | `--project-id`, `--slug`, `--title` |
26
+ | `publish` | `--artifact-id`, `--type`, `--file`, `--watch`, `--note`, `--parent-revision-id`, `--renderer`, `--execution static\|interactive` |
27
+ | `list` | `--project-id`, `--slug-prefix`, `--limit` |
28
+ | `read-back` | `--artifact-id`, optional `--revision-sha` (latest when omitted), `--tier` (one of: `0` \| `1` \| `visual`) |
29
+ | `status` | `--artifact-id`, `--start` (valueless start-then-inspect switch) |
30
+ | `open` | `--artifact-id`, optional `--revision-sha` (latest when omitted), `--no-launch` |
31
+ | `promote` | `--artifact-id`, `--revision-id`, `--name`, `--description`, `--promoted-by` |
32
+ | `instantiate` | `--name`, `--new-slug`, `--project-id` |
33
+ | `pin` | `--revision-id`, `--pinned` (`true` or `false`) |
34
+ | `export` | `<artifactId>`, `--revision`, `--format source\|render`, `--out`, `--force`, `--include-bytes` |
35
+ | | `--format source` writes `.md` / `.mmd` / `.svg` / `.json` / `.html` to match the type |
36
+ | | `--format render` writes detected evidence as `.webp` (new) or `.png` (legacy); the sidecar records `renderFormat` |
37
+ | `doctor` | no flags; read-only local environment diagnostics |
38
+
39
+ `publish --file -` reads bytes from stdin. `--json` is shorthand for
40
+ `--format json` on meta commands. Verb stdout is always a JSON envelope;
41
+ `--format` applies only to meta commands and `export`, except
42
+ `publish --watch --format json`, which selects machine NDJSON.
43
+
44
+ `publish --watch --file <path>` performs an initial publish, then watches the
45
+ parent directory with debounce. It hashes bytes before sending and skips
46
+ identical content. Directory watching survives atomic-save rename/recreate
47
+ sequences. A `duplicate_revision` envelope is emitted and the loop continues;
48
+ other typed responses are emitted per attempt. If the service or transport is
49
+ unavailable, watch emits the typed failure envelope, reports a stderr
50
+ diagnostic, and keeps watching so a later edit can retry. The current client
51
+ maps a dead service to `invalid_envelope` with
52
+ `error.details.reason: "connection_failed"`; watch does not silently respawn
53
+ the already-resolved endpoint. Ctrl-C exits cleanly with code 0.
54
+ Watch requires a real file path and never reads stdin.
55
+
56
+ ```sh
57
+ printf '# Report\n' | facet publish --artifact-id art-123 --type markdown
58
+ facet read-back --artifact-id art-123 --tier 0
59
+ facet read-back --artifact-id art-123 --revision-sha <sha256> --tier 0
60
+ facet read-back --artifact-id art-123 --tier visual # launches the pinned headless browser
61
+ facet open --artifact-id art-123 --no-launch
62
+ facet export art-123 --format render --out exports/report.webp
63
+ facet export art-123 --format render --out exports/report-with-bytes.webp --include-bytes
64
+ ```
65
+
66
+ For file input, use the same publish request with `--file report.md` instead of
67
+ the piped `--file -` form above. The read-back and render-export steps are still
68
+ required before exporting Tier 1 evidence.
69
+
70
+ The publish envelope carries the stored Tier 0 verdict, including when its
71
+ `status` is `error`; callers must inspect `data.verdict` before treating the
72
+ publication as usable. A duplicate publish returns `ok: false` with
73
+ `duplicate_revision`; the existing SHA is in `error.details.revisionSha`.
74
+
75
+ Every verb accepts `--help`. It prints its positional arguments and flags from the
76
+ same command table used by the parser. Missing required inputs are reported
77
+ together in one typed usage envelope.
78
+
79
+ `doctor` runs seven read-only probes: the pinned Bun version, headless shell,
80
+ network namespace support, database and migration version, token permissions,
81
+ evidence-root permissions, and service lock state. Dormant with no lock is
82
+ healthy; missing or stale state fails with a literal repair command. A failed
83
+ probe still emits an `ok: true` envelope and exits 1.
84
+
85
+ `status --start` takes no value: it starts the local service if needed, then
86
+ returns the normal status envelope. With `--artifact-id`, status includes
87
+ `latestRevisionSha`; `read-back --artifact-id <id>` uses that latest revision
88
+ when `--revision-sha` is omitted.
89
+
90
+ `open --artifact-id <id>` resolves the latest revision when no SHA is supplied.
91
+ It returns `data.frameUrl` and `data.launched`; `--no-launch` leaves the URL
92
+ available without invoking the desktop launcher, and a launcher failure reports
93
+ `launched: false`.
94
+
95
+ `publish --renderer` selects the renderer persisted with the revision. It
96
+ defaults to `svg`; `canvas` is valid only for chart artifacts. An invalid
97
+ renderer value is a usage error and exits 64.
98
+
99
+ `publish --type html` publishes a static, script-free HTML artifact.
100
+ See [HTML reference](html.md) for the static / script-free contract,
101
+ the denied element and attribute set, the vendored class vocabulary,
102
+ and the verdict precedence specific to HTML.
103
+
104
+ `publish --type tsx` defaults to `--execution static`; `interactive` is valid
105
+ only for TSX. Non-TSX `interactive` is rejected. See [TSX reference](tsx.md).
106
+
107
+ Regular boots run Tier 0 on publish, and the publish envelope returns its stored
108
+ Tier 0 verdict even when its `status` is `error`. `read-back --tier 1` and
109
+ `read-back --tier visual` run Tier 1 on demand, then reuse the stored
110
+ revision-bound verdict. If the pinned browser or its network namespace is
111
+ unavailable, visual read-back records a Tier 1 `error` verdict with a typed
112
+ `tier1_*` code.
113
+
114
+ `screenshot_unavailable` is nested verdict evidence
115
+ (`data.verdict.screenshotError`), not a top-level CLI error code. Common typed
116
+ errors and next actions:
117
+
118
+ | code | next action |
119
+ | ---------------------- | -------------------------------------------------------------------------------------------------------------- |
120
+ | `artifact_not_found` | Check the artifact ID and list the project. |
121
+ | `revision_not_found` | Omit the SHA for latest read-back or use an existing SHA. |
122
+ | `duplicate_revision` | Reuse `error.details.revisionSha`; no new revision was stored. |
123
+ | `output_unwritable` | Fix the output directory, permissions, or rename target. |
124
+ | `evidence_unavailable` | Run Tier 1 again or inspect retention and evidence paths. |
125
+ | `tier0_*` | Inspect `error.details`; restore the Tier 0 worker, isolation, protocol, or runtime prerequisites named there. |
126
+ | `tier1_*` | Restore browser/network prerequisites and retry visual read-back. |
127
+
128
+ Gallery theme modes are `system` (the default), `dark`, and `light`. The selected mode is
129
+ session-persistent and changes Tier 2 display; Tier 1 remains dark for
130
+ structural parity. Interactive TSX declares animated-capture eligibility; the
131
+ mode does not assert that its visuals always change.
132
+
133
+ `promote` reads its operator bearer from `FACET_PROMOTE_TOKEN` or, by default,
134
+ `FACET_HOME/secrets/promote.token`. Neither source is accepted as an argv flag
135
+ or emitted in a CLI envelope.
136
+
137
+ ## Insecure mode
138
+
139
+ `FACET_INSECURE=1|2|3` sets a boot-only forced floor. `FACET_INSECURE_AUTO=1`
140
+ opts into startup probe fallback; it never selects level 3. Restart after
141
+ changing either variable. Insecure verdicts print an explicit line:
142
+
143
+ ```
144
+ INSECURE L1 — auto:tier 1 unavailable
145
+ ```
146
+
147
+ ## Exit codes
148
+
149
+ | code | meaning |
150
+ | ---: | ----------------------------------------------- |
151
+ | 0 | Well-formed envelope, including typed refusal |
152
+ | 1 | Doctor completed with one or more failed probes |
153
+ | 64 | Usage error before a command can be built |
154
+ | 70 | Unhandled internal failure |
155
+
156
+ ## Reserved surface
157
+
158
+ There is no reserved artifact type surface left for `publish --type`.
159
+ `html` ships alongside `markdown`, `mermaid`, `svg`, and `chart`. Every
160
+ artifact type goes through the same `checkArtifactTypeSupported` gate;
161
+ an unknown type returns `unsupported_reserved_type`.
162
+
163
+ → [Architecture](../../ARCHITECTURE.md) → [Export](export.md) · [HTML](html.md) · [Validation](validation.md) · [Storage](storage.md) · [Security](security.md) · [HTTP](http.md)
@@ -0,0 +1,106 @@
1
+ # Export reference
2
+
3
+ ## Syntax
4
+
5
+ ```sh
6
+ facet export <artifactId> [--revision <sha>] [--format source|render] [--out <path>] [--force] [--include-bytes]
7
+ ```
8
+
9
+ The default format is `source`. The command returns one JSON envelope on
10
+ stdout and writes the exported bytes plus a mandatory sidecar locally. In
11
+ file-output mode the CLI envelope reports `paths`, `byteCount`, and `sidecar`
12
+ instead of duplicating base64 bytes. Without `--include-bytes`, file export
13
+ writes both files and projects the envelope to `paths` and `byteCount`, omitting
14
+ `bytes`. With `--include-bytes`, file export still writes both files but keeps
15
+ the service wire payload: `bytes` is present and the CLI `paths` and `byteCount`
16
+ projection is absent. Use the flag only for compatibility or debugging; omit
17
+ it for ordinary file export.
18
+
19
+ ## Source and render
20
+
21
+ `source` exports the exact bytes stored for the selected revision. For TSX that
22
+ is the immutable `.tsx` source, not the derived compiled bundle. `render`
23
+ exports the stored Tier 1 screenshot for that revision. Render export reads
24
+ retained evidence; it serves the stored bytes, never starts a renderer or
25
+ reruns validation. The detected PNG or WebP format is preserved. Legacy `.png`
26
+ evidence remains backward compatible and can still be read and exported.
27
+
28
+ Both formats carry the selected revision and its stored verdict in the sidecar.
29
+ A missing render screenshot is an `evidence_unavailable` error. An unknown
30
+ artifact returns `artifact_not_found`; a requested but unknown revision SHA
31
+ returns `revision_not_found`.
32
+
33
+ ## Default extensions
34
+
35
+ | Format | Artifact type | Extension |
36
+ | -------- | ------------------- | --------- |
37
+ | `source` | markdown or Mermaid | `.md` |
38
+ | `source` | SVG | `.svg` |
39
+ | `source` | chart | `.json` |
40
+ | `source` | TSX | `.tsx` |
41
+ | `render` | new evidence | `.webp` |
42
+ | `render` | legacy evidence | `.png` |
43
+
44
+ The default name is `<slug>-<revisionSha prefix><extension>`.
45
+
46
+ ## `--out` and sidecar names
47
+
48
+ `--out` sets the artifact path. The sidecar appends `.facet.json` to the full
49
+ artifact filename:
50
+
51
+ ```sh
52
+ facet export art-123 --out exports/chart.json
53
+ # writes exports/chart.json and exports/chart.json.facet.json
54
+ ```
55
+
56
+ An extensionless path gets `.facet.json` appended:
57
+
58
+ ```sh
59
+ facet export art-123 --out exports/chart
60
+ # writes exports/chart and exports/chart.facet.json
61
+ ```
62
+
63
+ ## Overwrite and `--force`
64
+
65
+ The command checks both output paths before writing. If either exists, export
66
+ fails unless `--force` is present. With `--force`, both files are staged in
67
+ their target directory and replaced as a pair. A failed write leaves existing
68
+ output content untouched.
69
+
70
+ ## Sidecar
71
+
72
+ Every successful export writes a sidecar. All sidecars contain:
73
+
74
+ `artifactId`, `slug`, `revisionSha`, `artifactType`, `renderer`, `verdict`,
75
+ `format`, and `exportedAt`. Render sidecars additionally require `renderFormat`;
76
+ source sidecars omit `renderFormat`. It is the detected stored evidence format
77
+ (`webp` for new captures, `png` for legacy captures).
78
+
79
+ There is no flag to suppress the sidecar. A successful artifact file without
80
+ its sidecar is not a valid export.
81
+
82
+ ## Verdict honesty
83
+
84
+ The sidecar describes the stored verdict. Export does not approve, promote,
85
+ revalidate, or otherwise change the artifact.
86
+
87
+ ## `evidence_unavailable`
88
+
89
+ Render export returns typed `evidence_unavailable` when the selected revision
90
+ has no Tier 1 run, the run has no capture, retention evicted the evidence, or
91
+ the recorded screenshot file is missing.
92
+
93
+ It does not fall back to an older run or substitute source bytes.
94
+
95
+ See [Validation](validation.md) for the nested `screenshot_unavailable`
96
+ verdict evidence and [Storage](storage.md) for v9 `screenshot_format` metadata.
97
+
98
+ Local directory creation, permission, staging, or rename failures return the
99
+ typed `output_unwritable` error. Existing output remains untouched when a
100
+ write cannot complete.
101
+
102
+ ## Security boundary
103
+
104
+ The service serves stored bytes and metadata. The CLI owns filesystem writes,
105
+ including `--out`, `--force`, and sidecar creation. Export does not rerender
106
+ artifact content and does not import renderers or parsers into the service.