@ggui-ai/ui-gen 0.28.0 → 0.29.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 (308) hide show
  1. package/dist/{adapter-h4_V69LI.d.ts → adapter-DLQ-5COm.d.ts} +1 -1
  2. package/dist/adapters/base.js +2 -27
  3. package/dist/adapters/base.js.map +1 -1
  4. package/dist/adapters/generation-dispatch.d.ts +14 -6
  5. package/dist/adapters/generation-dispatch.js +40 -19260
  6. package/dist/adapters/generation-dispatch.js.map +1 -1
  7. package/dist/adapters/index.d.ts +1 -1
  8. package/dist/adapters/index.js +25 -3561
  9. package/dist/adapters/index.js.map +1 -1
  10. package/dist/adapters/types.js +2 -9
  11. package/dist/adapters/types.js.map +1 -1
  12. package/dist/advanced/index.d.ts +13 -12
  13. package/dist/advanced/index.js +63 -21954
  14. package/dist/advanced/index.js.map +1 -1
  15. package/dist/{bank-Ctdp3FUA.d.ts → bank-LWaiAtaA.d.ts} +1 -1
  16. package/dist/blueprint-validator.js +6 -2301
  17. package/dist/blueprint-validator.js.map +1 -1
  18. package/dist/boilerplate.d.ts +3 -2
  19. package/dist/boilerplate.js +6 -1867
  20. package/dist/boilerplate.js.map +1 -1
  21. package/dist/check/index.d.ts +3 -2
  22. package/dist/check/index.js +6 -1923
  23. package/dist/check/index.js.map +1 -1
  24. package/dist/chunk-33B3BAWS.js +24 -0
  25. package/dist/chunk-33B3BAWS.js.map +1 -0
  26. package/dist/chunk-3HSGA6NI.js +591 -0
  27. package/dist/chunk-3HSGA6NI.js.map +1 -0
  28. package/dist/chunk-3NNNGNTO.js +1707 -0
  29. package/dist/chunk-3NNNGNTO.js.map +1 -0
  30. package/dist/chunk-3T2HMTON.js +79 -0
  31. package/dist/chunk-3T2HMTON.js.map +1 -0
  32. package/dist/chunk-3ZSSDV3L.js +123 -0
  33. package/dist/chunk-3ZSSDV3L.js.map +1 -0
  34. package/dist/chunk-4MBR5GA3.js +99 -0
  35. package/dist/chunk-4MBR5GA3.js.map +1 -0
  36. package/dist/chunk-56NJFD55.js +337 -0
  37. package/dist/chunk-56NJFD55.js.map +1 -0
  38. package/dist/chunk-5AGTY555.js +26 -0
  39. package/dist/chunk-5AGTY555.js.map +1 -0
  40. package/dist/chunk-5EJM7EGY.js +115 -0
  41. package/dist/chunk-5EJM7EGY.js.map +1 -0
  42. package/dist/chunk-5KXCQLLR.js +529 -0
  43. package/dist/chunk-5KXCQLLR.js.map +1 -0
  44. package/dist/chunk-5VBXHVEH.js +171 -0
  45. package/dist/chunk-5VBXHVEH.js.map +1 -0
  46. package/dist/chunk-6KDDEING.js +515 -0
  47. package/dist/chunk-6KDDEING.js.map +1 -0
  48. package/dist/chunk-6VDRWAP6.js +123 -0
  49. package/dist/chunk-6VDRWAP6.js.map +1 -0
  50. package/dist/chunk-732IBFEJ.js +2400 -0
  51. package/dist/chunk-732IBFEJ.js.map +1 -0
  52. package/dist/chunk-73AURS3I.js +46 -0
  53. package/dist/chunk-73AURS3I.js.map +1 -0
  54. package/dist/chunk-77H5SKLX.js +8 -0
  55. package/dist/chunk-77H5SKLX.js.map +1 -0
  56. package/dist/chunk-7QE3AHLE.js +35 -0
  57. package/dist/chunk-7QE3AHLE.js.map +1 -0
  58. package/dist/chunk-A375NNWN.js +11 -0
  59. package/dist/chunk-A375NNWN.js.map +1 -0
  60. package/dist/chunk-AOU33EFS.js +140 -0
  61. package/dist/chunk-AOU33EFS.js.map +1 -0
  62. package/dist/chunk-BA4QYA6E.js +461 -0
  63. package/dist/chunk-BA4QYA6E.js.map +1 -0
  64. package/dist/chunk-DBP764GL.js +3 -0
  65. package/dist/chunk-DBP764GL.js.map +1 -0
  66. package/dist/chunk-DUU3ZJDQ.js +41 -0
  67. package/dist/chunk-DUU3ZJDQ.js.map +1 -0
  68. package/dist/chunk-DXKRBXNU.js +30 -0
  69. package/dist/chunk-DXKRBXNU.js.map +1 -0
  70. package/dist/chunk-FB7OEEAH.js +1467 -0
  71. package/dist/chunk-FB7OEEAH.js.map +1 -0
  72. package/dist/chunk-FLRNMZV2.js +18 -0
  73. package/dist/chunk-FLRNMZV2.js.map +1 -0
  74. package/dist/chunk-FWJIMKFZ.js +2032 -0
  75. package/dist/chunk-FWJIMKFZ.js.map +1 -0
  76. package/dist/chunk-FXRHWYIQ.js +163 -0
  77. package/dist/chunk-FXRHWYIQ.js.map +1 -0
  78. package/dist/chunk-G3PMV62Z.js +33 -0
  79. package/dist/chunk-G3PMV62Z.js.map +1 -0
  80. package/dist/chunk-GAJI7Y3P.js +13 -0
  81. package/dist/chunk-GAJI7Y3P.js.map +1 -0
  82. package/dist/chunk-GYINWMPR.js +2052 -0
  83. package/dist/chunk-GYINWMPR.js.map +1 -0
  84. package/dist/chunk-HD6ABIK7.js +484 -0
  85. package/dist/chunk-HD6ABIK7.js.map +1 -0
  86. package/dist/chunk-HDQVHYO6.js +100 -0
  87. package/dist/chunk-HDQVHYO6.js.map +1 -0
  88. package/dist/chunk-IHUT3SIW.js +7 -0
  89. package/dist/chunk-IHUT3SIW.js.map +1 -0
  90. package/dist/chunk-JDH5EGNZ.js +126 -0
  91. package/dist/chunk-JDH5EGNZ.js.map +1 -0
  92. package/dist/chunk-JMD4RGSV.js +37 -0
  93. package/dist/chunk-JMD4RGSV.js.map +1 -0
  94. package/dist/chunk-KJWGZL5B.js +33 -0
  95. package/dist/chunk-KJWGZL5B.js.map +1 -0
  96. package/dist/chunk-MKMDQFZ7.js +86 -0
  97. package/dist/chunk-MKMDQFZ7.js.map +1 -0
  98. package/dist/chunk-NF6JUZWF.js +85 -0
  99. package/dist/chunk-NF6JUZWF.js.map +1 -0
  100. package/dist/chunk-O2YC6XDC.js +1933 -0
  101. package/dist/chunk-O2YC6XDC.js.map +1 -0
  102. package/dist/chunk-OVLH5ICV.js +29 -0
  103. package/dist/chunk-OVLH5ICV.js.map +1 -0
  104. package/dist/chunk-PBOYHGSD.js +106 -0
  105. package/dist/chunk-PBOYHGSD.js.map +1 -0
  106. package/dist/chunk-PJFH7QWA.js +81 -0
  107. package/dist/chunk-PJFH7QWA.js.map +1 -0
  108. package/dist/chunk-PUH4CXGZ.js +284 -0
  109. package/dist/chunk-PUH4CXGZ.js.map +1 -0
  110. package/dist/chunk-QLXXPGTV.js +18 -0
  111. package/dist/chunk-QLXXPGTV.js.map +1 -0
  112. package/dist/chunk-R5GIGPW2.js +2845 -0
  113. package/dist/chunk-R5GIGPW2.js.map +1 -0
  114. package/dist/chunk-RH4IUSTO.js +83 -0
  115. package/dist/chunk-RH4IUSTO.js.map +1 -0
  116. package/dist/chunk-S2GVXKKY.js +153 -0
  117. package/dist/chunk-S2GVXKKY.js.map +1 -0
  118. package/dist/chunk-TVHGKFJS.js +58 -0
  119. package/dist/chunk-TVHGKFJS.js.map +1 -0
  120. package/dist/chunk-U7GALWLG.js +66 -0
  121. package/dist/chunk-U7GALWLG.js.map +1 -0
  122. package/dist/chunk-VTC263LT.js +256 -0
  123. package/dist/chunk-VTC263LT.js.map +1 -0
  124. package/dist/chunk-WEOXFEVE.js +739 -0
  125. package/dist/chunk-WEOXFEVE.js.map +1 -0
  126. package/dist/chunk-WYHP46LT.js +28 -0
  127. package/dist/chunk-WYHP46LT.js.map +1 -0
  128. package/dist/chunk-XGLO5LGG.js +274 -0
  129. package/dist/chunk-XGLO5LGG.js.map +1 -0
  130. package/dist/chunk-XRBCRKA2.js +29 -0
  131. package/dist/chunk-XRBCRKA2.js.map +1 -0
  132. package/dist/chunk-XW7ADFFV.js +340 -0
  133. package/dist/chunk-XW7ADFFV.js.map +1 -0
  134. package/dist/chunk-YIQ42IUX.js +34 -0
  135. package/dist/chunk-YIQ42IUX.js.map +1 -0
  136. package/dist/chunk-YJZTUY7B.js +101 -0
  137. package/dist/chunk-YJZTUY7B.js.map +1 -0
  138. package/dist/chunk-Z3CXME3K.js +107 -0
  139. package/dist/chunk-Z3CXME3K.js.map +1 -0
  140. package/dist/classifier/index.js +2 -527
  141. package/dist/classifier/index.js.map +1 -1
  142. package/dist/client-JBPCXU7W.js +4 -0
  143. package/dist/client-JBPCXU7W.js.map +1 -0
  144. package/dist/compose.js +3 -367
  145. package/dist/compose.js.map +1 -1
  146. package/dist/cost-tracker-HHGQ4FTW.js +67 -0
  147. package/dist/cost-tracker-HHGQ4FTW.js.map +1 -0
  148. package/dist/{create-ui-generator-BrZHF0cf.d.ts → create-ui-generator-BY-WeaPi.d.ts} +3 -3
  149. package/dist/{design-mode-DGWN_Gkm.d.ts → design-mode-XyOQmzE0.d.ts} +4 -3
  150. package/dist/{dispatch-B07TI30d.d.ts → dispatch-8LzTddKw.d.ts} +3 -2
  151. package/dist/dist-UALN6ZVB.js +543 -0
  152. package/dist/dist-UALN6ZVB.js.map +1 -0
  153. package/dist/dupe-break-X6K7QFIS.js +4 -0
  154. package/dist/dupe-break-X6K7QFIS.js.map +1 -0
  155. package/dist/evaluation/axis-checks/index.d.ts +5 -4
  156. package/dist/evaluation/axis-checks/index.js +6 -1914
  157. package/dist/evaluation/axis-checks/index.js.map +1 -1
  158. package/dist/evaluation/axis-checks/registry.d.ts +3 -2
  159. package/dist/evaluation/axis-checks/registry.js +3 -1844
  160. package/dist/evaluation/axis-checks/registry.js.map +1 -1
  161. package/dist/evaluation/index.d.ts +49 -132
  162. package/dist/evaluation/index.js +302 -6466
  163. package/dist/evaluation/index.js.map +1 -1
  164. package/dist/evaluation/types.d.ts +3 -2
  165. package/dist/evaluation/types.js +2 -5
  166. package/dist/evaluation/types.js.map +1 -1
  167. package/dist/fragments/index.js +2 -338
  168. package/dist/fragments/index.js.map +1 -1
  169. package/dist/{generate-tSO_shQ0.d.ts → generate-DQ4ci90s.d.ts} +1 -1
  170. package/dist/harness/check/runtime-render/index.d.ts +35 -15
  171. package/dist/harness/check/runtime-render/index.js +6 -2390
  172. package/dist/harness/check/runtime-render/index.js.map +1 -1
  173. package/dist/harness/check/runtime-render/render-check-worker.js +4 -1739
  174. package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
  175. package/dist/harness/index.d.ts +3 -2
  176. package/dist/harness/index.js +23 -5126
  177. package/dist/harness/index.js.map +1 -1
  178. package/dist/harness/llm-trace-sink.js +2 -24
  179. package/dist/harness/llm-trace-sink.js.map +1 -1
  180. package/dist/harness/prompts.d.ts +2 -2
  181. package/dist/harness/prompts.js +8 -324
  182. package/dist/harness/prompts.js.map +1 -1
  183. package/dist/harness/result-types.d.ts +6 -5
  184. package/dist/harness/result-types.js +2 -0
  185. package/dist/harness/result-types.js.map +1 -1
  186. package/dist/harness/runtime.d.ts +22 -5
  187. package/dist/harness/runtime.js +10 -2313
  188. package/dist/harness/runtime.js.map +1 -1
  189. package/dist/harness/types-public.d.ts +3 -2
  190. package/dist/harness/types-public.js +16 -2954
  191. package/dist/harness/types-public.js.map +1 -1
  192. package/dist/harness/validator-trace-sink.d.ts +3 -2
  193. package/dist/harness/validator-trace-sink.js +2 -26
  194. package/dist/harness/validator-trace-sink.js.map +1 -1
  195. package/dist/hash.js +2 -39
  196. package/dist/hash.js.map +1 -1
  197. package/dist/hashline-5OKREIRM.js +4 -0
  198. package/dist/hashline-5OKREIRM.js.map +1 -0
  199. package/dist/index.d.ts +50 -11
  200. package/dist/index.js +57 -22015
  201. package/dist/index.js.map +1 -1
  202. package/dist/llm-evaluator-PN3WFCS4.js +653 -0
  203. package/dist/llm-evaluator-PN3WFCS4.js.map +1 -0
  204. package/dist/magic-string.es-2NZTC4GZ.js +1307 -0
  205. package/dist/magic-string.es-2NZTC4GZ.js.map +1 -0
  206. package/dist/patch.d.ts +3 -2
  207. package/dist/patch.js +2 -56
  208. package/dist/patch.js.map +1 -1
  209. package/dist/policy-VCYKGSAC.js +5 -0
  210. package/dist/policy-VCYKGSAC.js.map +1 -0
  211. package/dist/policy.js +2 -35
  212. package/dist/policy.js.map +1 -1
  213. package/dist/primitive-index-2OF6F4TZ.js +131 -0
  214. package/dist/primitive-index-2OF6F4TZ.js.map +1 -0
  215. package/dist/primitive-slice-WTMBLYFJ.js +235 -0
  216. package/dist/primitive-slice-WTMBLYFJ.js.map +1 -0
  217. package/dist/{prompts-BhNUuRoZ.d.ts → prompts-CLZGywMP.d.ts} +1 -1
  218. package/dist/provider-adapter-contract.js +10407 -14204
  219. package/dist/provider-adapter-contract.js.map +1 -1
  220. package/dist/provider-adapter.js +2 -44
  221. package/dist/provider-adapter.js.map +1 -1
  222. package/dist/providers/index.d.ts +89 -1
  223. package/dist/providers/index.js +115 -44
  224. package/dist/providers/index.js.map +1 -1
  225. package/dist/raw-C6KBH5I3.js +141 -0
  226. package/dist/raw-C6KBH5I3.js.map +1 -0
  227. package/dist/raw-FXSBXQTZ.js +7 -0
  228. package/dist/raw-FXSBXQTZ.js.map +1 -0
  229. package/dist/raw-MURDUPGK.js +8 -0
  230. package/dist/raw-MURDUPGK.js.map +1 -0
  231. package/dist/raw-T3GW3UVX.js +8 -0
  232. package/dist/raw-T3GW3UVX.js.map +1 -0
  233. package/dist/render-check-host-ZNIS6BJ5.js +5 -0
  234. package/dist/render-check-host-ZNIS6BJ5.js.map +1 -0
  235. package/dist/sdk-4JNSDNSR.js +6 -0
  236. package/dist/sdk-4JNSDNSR.js.map +1 -0
  237. package/dist/sdk-DIVJMHCX.js +7 -0
  238. package/dist/sdk-DIVJMHCX.js.map +1 -0
  239. package/dist/sdk-QRJOCRTS.js +7 -0
  240. package/dist/sdk-QRJOCRTS.js.map +1 -0
  241. package/dist/tag-balance-CTHCTRJ7.js +123 -0
  242. package/dist/tag-balance-CTHCTRJ7.js.map +1 -0
  243. package/dist/tools/get-primitives-ts.d.ts +1 -1
  244. package/dist/tools/get-primitives-ts.js +3 -1
  245. package/dist/tools/get-primitives-ts.js.map +1 -1
  246. package/dist/tools/render-check-worker.js +3 -40
  247. package/dist/tools/render-check-worker.js.map +1 -1
  248. package/dist/{types-public-h8IMnYuh.d.ts → types-public-hYlrerZh.d.ts} +35 -2
  249. package/dist/validation/index.d.ts +2 -2
  250. package/dist/validation/index.js +3 -498
  251. package/dist/validation/index.js.map +1 -1
  252. package/dist/{visual-evaluator-C2strxqD.d.ts → visual-evaluator-KskajxD5.d.ts} +14 -4
  253. package/dist/visual-evaluator-TGEXYQTP.js +12 -0
  254. package/dist/visual-evaluator-TGEXYQTP.js.map +1 -0
  255. package/dist/workflows.d.ts +3 -2
  256. package/dist/workflows.js +2 -151
  257. package/dist/workflows.js.map +1 -1
  258. package/package.json +20 -16
  259. package/src/adapters/claude/sdk.ts +4 -2
  260. package/src/adapters/claude/tool-bridge.ts +2 -1
  261. package/src/adapters/generation-dispatch.ts +9 -0
  262. package/src/adapters/openai/raw.ts +4 -0
  263. package/src/adapters/openai/sdk.ts +6 -1
  264. package/src/adapters/openai/tokens.ts +21 -7
  265. package/src/adapters/tool-bridge.ts +1 -1
  266. package/src/adapters/tools.ts +1 -1
  267. package/src/advanced/feedback.ts +1 -2
  268. package/src/advanced/generator.ts +4 -3
  269. package/src/boilerplate/free-design-prompt.ts +7 -0
  270. package/src/boilerplate/generate.ts +18 -5
  271. package/src/boilerplate/hard-sections.ts +8 -3
  272. package/src/boilerplate/react-hooks.ts +56 -0
  273. package/src/boilerplate/system-prompt.ts +12 -3
  274. package/src/check/run-tier0.ts +233 -8
  275. package/src/check/type-checker.ts +128 -16
  276. package/src/coding-agent/tools.ts +26 -3
  277. package/src/design-mode.ts +4 -9
  278. package/src/evaluation/axis-checks/checks/state-merge.ts +2 -4
  279. package/src/evaluation/axis-checks/checks/state-payload.ts +1 -28
  280. package/src/evaluation/axis-checks/checks/tint.ts +197 -0
  281. package/src/evaluation/axis-checks/helpers.ts +121 -0
  282. package/src/evaluation/axis-checks/registry.ts +2 -0
  283. package/src/evaluation/criteria/__fixtures__/edge-v2-draw2.json +4629 -0
  284. package/src/evaluation/criteria/bank.ts +1 -1
  285. package/src/evaluation/criteria/edge-instruments.ts +14 -0
  286. package/src/evaluation/criteria/edge-probe-v2.ts +352 -0
  287. package/src/evaluation/criteria/edge-v2.ts +242 -0
  288. package/src/evaluation/criteria/resolve.ts +24 -5
  289. package/src/evaluation/index.ts +3 -5
  290. package/src/evaluation/mcp-server.ts +0 -50
  291. package/src/evaluation/types-public.ts +6 -1
  292. package/src/evaluation/visual-evaluator.ts +161 -30
  293. package/src/harness/check/runtime-render/index.ts +28 -4
  294. package/src/harness/check/runtime-render/render-check.ts +20 -21
  295. package/src/harness/claude-agent-sdk-loader.ts +93 -0
  296. package/src/harness/claude-code-login-query.ts +1 -1
  297. package/src/harness/coding/generate-task-runner.ts +1 -0
  298. package/src/harness/coding/run-coding-turn.ts +3 -0
  299. package/src/harness/coding/run-eval-round.ts +9 -0
  300. package/src/harness/llm-router.ts +50 -2
  301. package/src/harness/runtime.ts +17 -0
  302. package/src/index.ts +9 -0
  303. package/src/providers/anthropic-tool-call.ts +263 -0
  304. package/src/providers/index.ts +13 -0
  305. package/src/tools/get-primitives-ts.ts +1 -1
  306. package/src/tools/render-check.ts +4 -4
  307. package/src/validation/primitives.ts +2 -1
  308. package/src/evaluation/loop.ts +0 -218
@@ -1,26 +1,4 @@
1
- // src/harness/llm-trace-sink.ts
2
- var activeSink = null;
3
- function setLlmTraceSink(sink) {
4
- activeSink = sink;
5
- }
6
- function getLlmTraceSink() {
7
- return activeSink;
8
- }
9
- function emitLlmTraceEvent(event) {
10
- const sink = activeSink;
11
- if (!sink) return;
12
- try {
13
- sink.emit(event);
14
- } catch {
15
- }
16
- }
17
- function summarizeTools(tools) {
18
- return tools.map((t) => ({ name: t.name, description: t.description }));
19
- }
20
- function newLlmTraceId() {
21
- return Date.now().toString(36) + Math.random().toString(36).slice(2, 10);
22
- }
23
-
24
- export { emitLlmTraceEvent, getLlmTraceSink, newLlmTraceId, setLlmTraceSink, summarizeTools };
1
+ export { emitLlmTraceEvent, getLlmTraceSink, newLlmTraceId, setLlmTraceSink, summarizeTools } from '../chunk-5AGTY555.js';
2
+ import '../chunk-G3PMV62Z.js';
25
3
  //# sourceMappingURL=llm-trace-sink.js.map
26
4
  //# sourceMappingURL=llm-trace-sink.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/harness/llm-trace-sink.ts"],"names":[],"mappings":";AA8GA,IAAI,UAAA,GAAkC,IAAA;AAM/B,SAAS,gBAAgB,IAAA,EAAiC;AAC/D,EAAA,UAAA,GAAa,IAAA;AACf;AAGO,SAAS,eAAA,GAAuC;AACrD,EAAA,OAAO,UAAA;AACT;AAOO,SAAS,kBAAkB,KAAA,EAA4B;AAC5D,EAAA,MAAM,IAAA,GAAO,UAAA;AACb,EAAA,IAAI,CAAC,IAAA,EAAM;AACX,EAAA,IAAI;AACF,IAAA,IAAA,CAAK,KAAK,KAAK,CAAA;AAAA,EACjB,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAGO,SAAS,eACd,KAAA,EACwE;AACxE,EAAA,OAAO,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,MAAO,EAAE,IAAA,EAAM,CAAA,CAAE,IAAA,EAAM,WAAA,EAAa,CAAA,CAAE,WAAA,EAAY,CAAE,CAAA;AACxE;AAMO,SAAS,aAAA,GAAwB;AACtC,EAAA,OACE,IAAA,CAAK,GAAA,EAAI,CAAE,QAAA,CAAS,EAAE,CAAA,GACtB,IAAA,CAAK,MAAA,EAAO,CAAE,QAAA,CAAS,EAAE,CAAA,CAAE,KAAA,CAAM,GAAG,EAAE,CAAA;AAE1C","file":"llm-trace-sink.js","sourcesContent":["/**\n * Live LLM trace sink — devtools introspection of every LLM call the\n * generation harness makes.\n *\n * **Distinct from {@link TelemetrySink} and {@link AuditSink}.**\n * - **Telemetry** (mcp-server-core) = ops signals (`pair.completed`,\n * `render.duration_ms`). Sink may be lossy and drops on backpressure.\n * Attributes are flat scalars (`string | number | boolean`).\n * - **Audit** (mcp-server-core) = compliance log of privileged\n * mutations. Durable, async, may throw.\n * - **LLM trace** (this) = devtools-only, hostable in-memory ring\n * buffer of every LLM call's full payload (system prompt, user\n * prompt, tool defs, completion, token counts, cache hits, error).\n * Lossy by default. A hosted closed runtime may swap in a durable\n * sink for internal debugging; OSS ships an in-memory sink the\n * `/devtools/llm-trace` page reads.\n *\n * **Why module-level registry instead of constructor injection.** The\n * harness constructs LLM agents on every generation via\n * {@link createAgent}. Threading a sink through every call site\n * (createAgent → run-coding-turn → llm-evaluator → file-agent → …)\n * touches ~5 packages for a devtools-only surface. The OSS ggui server\n * is a single process per CLI invocation — global state has no\n * confusion-cost there. A hosted deployment isolates per request via a\n * process pool, so a global per-pool is also safe. If we ever serve\n * several apps inside one process we'll thread it then.\n *\n * **Default = no sink.** When unset, the router emits nothing and\n * spends no CPU formatting events. Passing `null` removes a previously\n * registered sink.\n */\nimport type { LLMToolDef } from '../llm.js';\n\n/** Provider tag that produced the call. Mirrors {@link AgentConfig.provider}. */\n/**\n * `claude-code-login` is the Anthropic model reached through the machine's\n * own Claude Code login (ggui#1185) rather than a key — a trace reader can\n * tell the two apart, which the routing vocabulary (`provider: 'anthropic'`)\n * deliberately does not.\n */\nexport type LlmTraceProvider = 'anthropic' | 'claude-code-login' | 'openai' | 'google' | 'openrouter';\n\n/** Which `LLMAgent` method initiated the call. */\nexport type LlmTraceKind =\n | 'callText'\n | 'callTools'\n | 'callWithTools'\n | 'callStructured'\n | 'callVision';\n\n/**\n * One LLM call. Emitted **after** the call completes (success or error)\n * — single event, not start/end split. Devtools UI is timeline-friendly\n * because each event carries `at` (start) + `endedAt` (end).\n */\nexport interface LlmTraceEvent {\n /** Random per-event ID. */\n readonly id: string;\n /** Epoch ms when the call was issued. */\n readonly at: number;\n /** Epoch ms when the call completed (success or error). */\n readonly endedAt: number;\n /** `endedAt - at` — convenience. */\n readonly durationMs: number;\n readonly provider: LlmTraceProvider;\n readonly model: string;\n readonly kind: LlmTraceKind;\n readonly systemPrompt?: string;\n readonly userPrompt?: string;\n /**\n * Tool defs sent on the call (if any). Stripped to `name + description`\n * — full JSON schema would balloon the trace and is rarely useful in\n * the operator UI.\n */\n readonly tools?: ReadonlyArray<{\n readonly name: string;\n readonly description: string;\n }>;\n /** Set on successful completion. */\n readonly result?: {\n readonly inputTokens: number;\n readonly outputTokens: number;\n /** Anthropic only. Bytes counted toward the cache write. */\n readonly cacheCreated?: number;\n /** Anthropic only. Bytes served from cache (90% discounted). */\n readonly cacheRead?: number;\n /** Set when the call returned text content. */\n readonly text?: string;\n /** Set when the call returned tool_use blocks. */\n readonly toolCalls?: ReadonlyArray<{\n readonly name: string;\n readonly input: unknown;\n }>;\n /** Set for `callWithTools` — number of agentic turns consumed. */\n readonly turnsUsed?: number;\n };\n /** Set on failure. `result` is undefined. */\n readonly error?: { readonly message: string };\n}\n\n/**\n * Sink that receives one event per LLM call. Implementations MUST be\n * sync + non-throwing — the harness fires events on the hot path and\n * cannot tolerate backpressure or rejected promises. Buffer + drop or\n * fan out to a queue inside the implementation.\n */\nexport interface LlmTraceSink {\n emit(event: LlmTraceEvent): void;\n}\n\nlet activeSink: LlmTraceSink | null = null;\n\n/**\n * Register the active sink. Pass `null` to remove. Subsequent\n * {@link emitLlmTraceEvent} calls dispatch to this sink.\n */\nexport function setLlmTraceSink(sink: LlmTraceSink | null): void {\n activeSink = sink;\n}\n\n/** Read the active sink. Mostly for tests. */\nexport function getLlmTraceSink(): LlmTraceSink | null {\n return activeSink;\n}\n\n/**\n * Internal — used by `LLMAgent` adapters. No-op when no sink is\n * registered. Swallows sink-thrown errors (a broken devtools sink must\n * not break generation).\n */\nexport function emitLlmTraceEvent(event: LlmTraceEvent): void {\n const sink = activeSink;\n if (!sink) return;\n try {\n sink.emit(event);\n } catch {\n // Devtools sink is allowed to be buggy — generation must not die.\n }\n}\n\n/** Strip `LLMToolDef[]` to the trace-friendly subset. */\nexport function summarizeTools(\n tools: ReadonlyArray<LLMToolDef>,\n): ReadonlyArray<{ readonly name: string; readonly description: string }> {\n return tools.map((t) => ({ name: t.name, description: t.description }));\n}\n\n/**\n * Crockford-style random ID. Crypto.randomUUID() would do, but we want\n * to keep this dep-free for non-Node runtimes the harness might run in.\n */\nexport function newLlmTraceId(): string {\n return (\n Date.now().toString(36) +\n Math.random().toString(36).slice(2, 10)\n );\n}\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"llm-trace-sink.js"}
@@ -1,3 +1,3 @@
1
- export { R as RenderingContext, b as buildContractsContext, a as buildRenderingContext, i as injectContracts, e as injectRenderingContext } from '../prompts-BhNUuRoZ.js';
1
+ export { R as RenderingContext, b as buildContractsContext, a as buildRenderingContext, i as injectContracts, e as injectRenderingContext } from '../prompts-CLZGywMP.js';
2
2
  import '@ggui-ai/protocol';
3
- import '../design-mode-DGWN_Gkm.js';
3
+ import '@ggui-ai/design/rendering';
@@ -1,326 +1,10 @@
1
- import { listContractGadgets, HOOK_NAME_RE } from '@ggui-ai/protocol';
2
- import ts3 from 'typescript';
3
- import '@ggui-ai/design/rendering';
4
- import 'eslint';
5
- import { consumedTokenManifest } from '@ggui-ai/design/themes';
6
-
7
- // src/boilerplate/styling-profile.ts
8
-
9
- // src/boilerplate/json-schema-ts.ts
10
- function jsonSchemaTypeToTs(schema) {
11
- const unionMembers = schema.oneOf ?? schema.anyOf;
12
- if (unionMembers?.length) {
13
- const types = [...new Set(unionMembers.map((s) => jsonSchemaTypeToTs(s)))];
14
- return types.length === 1 ? types[0] : types.join(" | ");
15
- }
16
- if (schema.const !== void 0) {
17
- return typeof schema.const === "string" ? `'${schema.const}'` : String(schema.const);
18
- }
19
- if (schema.enum?.length) {
20
- return schema.enum.map((v) => typeof v === "string" ? `'${v}'` : String(v)).join(" | ");
21
- }
22
- if (Array.isArray(schema.type)) {
23
- const { nullable: _nullable, ...rest } = schema;
24
- const members = [...new Set(schema.type)].map(
25
- (member) => jsonSchemaTypeToTs({ ...rest, type: member })
26
- );
27
- const unique = [...new Set(members)];
28
- if (schema.nullable && !unique.includes("null")) unique.push("null");
29
- return unique.join(" | ");
30
- }
31
- let result;
32
- switch (schema.type) {
33
- case "string":
34
- result = "string";
35
- break;
36
- case "number":
37
- case "integer":
38
- result = "number";
39
- break;
40
- case "boolean":
41
- result = "boolean";
42
- break;
43
- case "null":
44
- return "null";
45
- case "array": {
46
- if (schema.items) {
47
- const itemType = jsonSchemaTypeToTs(schema.items);
48
- const itemsDeclareObject = Array.isArray(schema.items.type) ? schema.items.type.includes("object") : schema.items.type === "object";
49
- result = itemsDeclareObject && schema.items.properties ? `Array<${itemType}>` : itemType.includes("|") ? `(${itemType})[]` : `${itemType}[]`;
50
- } else {
51
- result = "unknown[]";
52
- }
53
- break;
54
- }
55
- case "object": {
56
- if (schema.properties) {
57
- const required = schema.required ?? [];
58
- const fields = Object.entries(schema.properties).map(([key, prop]) => {
59
- const opt = !required.includes(key);
60
- return `${key}${opt ? "?" : ""}: ${jsonSchemaTypeToTs(prop)}`;
61
- }).join("; ");
62
- result = `{ ${fields} }`;
63
- } else if (schema.additionalProperties && typeof schema.additionalProperties === "object") {
64
- result = `Record<string, ${jsonSchemaTypeToTs(schema.additionalProperties)}>`;
65
- } else {
66
- result = "Record<string, unknown>";
67
- }
68
- break;
69
- }
70
- default:
71
- result = "unknown";
72
- }
73
- if (schema.nullable && result !== "unknown") {
74
- return `${result} | null`;
75
- }
76
- return result;
77
- }
78
-
79
- // src/check/contract-validation.ts
80
- function propsSpecToTypeScript(spec, indent = 2) {
81
- const pad = " ".repeat(indent);
82
- const lines = [];
83
- for (const [propName, entry] of Object.entries(spec.properties)) {
84
- if (entry.description) {
85
- lines.push(`${pad}/** ${entry.description} */`);
86
- }
87
- const optional = !entry.required;
88
- const tsType = jsonSchemaTypeToTs(entry.schema);
89
- const defaultStr = entry.default !== void 0 ? ` // default: ${JSON.stringify(entry.default)}` : "";
90
- lines.push(`${pad}${propName}${optional ? "?" : ""}: ${tsType};${defaultStr}`);
91
- if (entry.example !== void 0) {
92
- const exampleStr = JSON.stringify(entry.example, null, 2).split("\n").map((l, i) => i === 0 ? `${pad}// Example: ${l}` : `${pad}// ${l}`).join("\n");
93
- lines.push(exampleStr);
94
- }
95
- }
96
- return `{
97
- ${lines.join("\n")}
98
- }`;
99
- }
100
-
101
- // src/check/type-checker.ts
102
- ({
103
- target: ts3.ScriptTarget.ES2020,
104
- module: ts3.ModuleKind.ESNext,
105
- // Classic React JSX mode. The synthetic prefix (SYNTHETIC_PREFIX)
106
- // supplies `import React from 'react'` plus a `declare global` JSX
107
- // namespace shim: `@types/react` v19 removed the *global* `JSX`
108
- // namespace (it lives at `React.JSX` now), which classic mode needs
109
- // for `JSX.IntrinsicElements` and the `key`/`ref` carve-out. Without
110
- // the shim, `<div>` degrades to `any` and every typed component
111
- // falsely rejects the intrinsic `key` prop.
112
- jsx: ts3.JsxEmit.React,
113
- moduleResolution: ts3.ModuleResolutionKind.Bundler});
114
- var NOT_YET_TAUGHT_TOKENS = /* @__PURE__ */ new Set([]);
115
- consumedTokenManifest.filter(
116
- (token) => !NOT_YET_TAUGHT_TOKENS.has(token)
117
- );
118
-
119
- // src/check/run-tier0.ts
120
- new Set(consumedTokenManifest);
121
-
122
- // src/contract-context.ts
123
- var SHELL_HINTS = {
124
- chat: `**Chat Shell \u2014 Inline card in scrolling conversation**
125
- - Container: width varies (60-80% of viewport), height: auto (natural content height)
126
- - Chrome: parent provides card border + shadow + rounded corners \u2014 do NOT add your own box-shadow or outer border-radius
127
- - Sizing: target 300-600px natural height. Do NOT use min-height: 100vh. No full-viewport designs.
128
- - Padding: use var(--ggui-spacing-2) for inner elements, var(--ggui-spacing-4) for sections. Tight.
129
- - Scrolling: parent scrolls (chat feed) \u2014 component should NOT have internal scroll
130
- - Layout: single column, compact. No sidebar. Stack everything vertically.
131
- - Width: the root is width: 100% (fills the bubble) \u2014 never cap the ROOT. A prose column inside it carries the reading cap (<Container maxWidth="sm">), which is inert at bubble width; the chips or buttons that answer the prose sit in a Container of the same maxWidth, so they share its left edge.`,
132
- fullscreen: `**Fullscreen Shell \u2014 Takes over entire viewport**
133
- - Container: the whole viewport, edge to edge \u2014 the frame stretches your root to its full height (you never set a viewport height yourself)
134
- - Chrome: NONE \u2014 your component IS the entire UI. You own all visual chrome.
135
- - Sizing: size to content; to fill a parent that has a height use height: 100% or flex: 1. NEVER min-height: 100vh / 100dvh \u2014 the frame already stretches the root, and a viewport height only fights it (tier-0 fail).
136
- - Padding: component owns ALL padding. Use var(--ggui-spacing-6) or larger for breathing room.
137
- - Scrolling: component manages its own scroll if content exceeds viewport (overflow-y: auto)
138
- - Layout: can use multi-column, sidebars, headers/footers. Full creative control.
139
- - Navigation: swipe left/right between pages is handled by the shell \u2014 don't implement it.
140
- - DO NOT add outer margins or max-width containers. Fill the space.`,
141
- partial: `**Partial Shell \u2014 Embedded panel in a larger page**
142
- - Container: width constrained by parent (could be 400px sidebar or 800px main area)
143
- - Chrome: parent may or may not have border \u2014 add your own Card/shadow if needed
144
- - Sizing: width: 100% to fill parent. Use max-width if you want to center content.
145
- - Padding: use standard spacing (var(--ggui-spacing-4) to var(--ggui-spacing-6))
146
- - Scrolling: can scroll internally (overflow-y: auto) \u2014 parent does NOT scroll for you
147
- - Layout: responsive within the container. Flex-wrap for variable parent widths.
148
- - Context: other UI around you (nav, sidebar) \u2014 don't duplicate page-level chrome.`
149
- };
150
- var DEVICE_HINTS = {
151
- mobile: `**Mobile:** Single column. Touch targets 44px+. Compact padding. Stack all sections vertically.`,
152
- tablet: `**Tablet:** 1-2 columns adaptive. Medium touch targets. Side-by-side where space allows.`,
153
- desktop: `**Desktop:** Multi-column. Hover states. Dense layouts. Keyboard shortcuts. Pointer interactions.`,
154
- spatial: `**Spatial:** Fixed-size floating panel (~600x400). High contrast. Large text. No hover (gaze/hand input).`
155
- };
156
- function buildRenderingContext(ctx) {
157
- const parts = [
158
- "## Rendering Context",
159
- `- Device: ${ctx.device}`,
160
- ctx.viewport ? `- Viewport: ${ctx.viewport.width}\xD7${ctx.viewport.height}px` : "",
161
- `- Shell: ${ctx.shell}`,
162
- "",
163
- DEVICE_HINTS[ctx.device] || "",
164
- SHELL_HINTS[ctx.shell] || ""
165
- ].filter(Boolean);
166
- return parts.join("\n");
167
- }
168
- function injectRenderingContext(userPrompt, rendering) {
169
- if (!rendering) return userPrompt;
170
- return userPrompt + "\n\n" + buildRenderingContext(rendering);
171
- }
172
- function buildContractsContext(contract, appGadgets) {
173
- const parts = [];
174
- if (contract.propsSpec) {
175
- const propsSpec = contract.propsSpec;
176
- const requiredFields = Object.entries(propsSpec.properties || {}).filter(([, e]) => e.required).map(([k]) => k);
177
- const optionalFields = Object.entries(propsSpec.properties || {}).filter(([, e]) => !e.required).map(([k]) => k);
178
- const tsInterface = propsSpecToTypeScript(propsSpec);
179
- const fieldInfo = [];
180
- if (requiredFields.length > 0) fieldInfo.push(`Required: ${requiredFields.join(", ")}`);
181
- if (optionalFields.length > 0) fieldInfo.push(`Optional: ${optionalFields.join(", ")}`);
182
- parts.push(
183
- `## Props Contract (MUST use these exact prop names and types)
184
-
185
- ` + (fieldInfo.length > 0 ? fieldInfo.join("\n") + "\n\n" : "") + `\`\`\`typescript
186
- interface Props ${tsInterface}
187
- \`\`\``
188
- );
189
- }
190
- if (contract.actionSpec && Object.keys(contract.actionSpec).length > 0) {
191
- const actions = Object.entries(contract.actionSpec).map(([id, entry]) => {
192
- let line = ` - ${id}: "${entry.label ?? id}"${entry.description ? ` \u2014 ${entry.description}` : ""}`;
193
- if (entry.example !== void 0) {
194
- line += `
195
- Example payload: \`${JSON.stringify(entry.example)}\``;
196
- }
197
- if (entry.nextStep) {
198
- line += `
199
- Next-step hint: agent intends to call \`${entry.nextStep}\``;
200
- }
201
- if (entry.confirm === true) {
202
- line += `
203
- Author flag: \`confirm\` \u2014 the author marked this action as one to confirm with the user before it fires.`;
204
- }
205
- return line;
206
- }).join("\n");
207
- parts.push(`## Action Contract (wire these callbacks)
208
- ${actions}`);
209
- }
210
- if (contract.streamSpec && Object.keys(contract.streamSpec).length > 0) {
211
- const channels = Object.entries(contract.streamSpec).map(([name, entry]) => {
212
- const bits = [` - ${name}`];
213
- if (entry.description) bits.push(`\u2014 ${entry.description}`);
214
- if (entry.source?.tool) {
215
- bits.push(`(source tool: \`${entry.source.tool}\`)`);
216
- }
217
- return bits.join(" ");
218
- }).join("\n");
219
- parts.push(
220
- `## Stream Contract (real-time channels via \`useStream(name)\`)
221
- ${channels}
222
-
223
- Payload schemas:
224
- \`\`\`json
225
- ${JSON.stringify(contract.streamSpec, null, 2)}
226
- \`\`\``
227
- );
228
- }
229
- const agentTools = contract.agentCapabilities?.tools;
230
- if (agentTools && Object.keys(agentTools).length > 0) {
231
- const tools = Object.entries(agentTools).map(([name, entry]) => {
232
- const bits = [` - **\`${name}\`**`];
233
- if (entry.toolInfo?.description) bits.push(`\u2014 ${entry.toolInfo.description}`);
234
- if (entry.usage) bits.push(`(usage: ${entry.usage})`);
235
- return bits.join(" ");
236
- }).join("\n");
237
- parts.push(
238
- `## AgentTools Catalog (tools the contract references)
239
- ${tools}
240
-
241
- These are referenced via \`actionSpec[*].nextStep\` (the tool the agent SHOULD call next after the action fires) and \`streamSpec[*].source.tool\` (the tool feeding a channel). The agent OWNS the call \u2014 your component does not invoke these directly.
242
-
243
- Schemas:
244
- \`\`\`json
245
- ${JSON.stringify(agentTools, null, 2)}
246
- \`\`\``
247
- );
248
- }
249
- const clientCapabilities = contract.clientCapabilities?.gadgets;
250
- const gadgetUses = listContractGadgets(contract);
251
- if (gadgetUses.length > 0) {
252
- const caps = gadgetUses.map((use) => {
253
- const bits = [` - **\`${use.name}\`**`];
254
- bits.push(
255
- HOOK_NAME_RE.test(use.name) ? `via direct-imported hook \`${use.name}\` from \`${use.package}\` (call it)` : `via direct-imported component \`<${use.name} />\` from \`${use.package}\` (render as JSX)`
256
- );
257
- if (use.description) bits.push(`\u2014 ${use.description}`);
258
- return bits.join(" ");
259
- }).join("\n");
260
- parts.push(
261
- `## ClientCapabilities Contract (browser-capability gadgets the UI mounts)
262
- ${caps}
263
-
264
- Hook entries are imported + called; component entries are imported + rendered as JSX. Capability values reach the agent only when the UI threads them into an actionSpec payload or contextSpec slot.
265
-
266
- Declarations:
267
- \`\`\`json
268
- ${JSON.stringify(clientCapabilities, null, 2)}
269
- \`\`\``
270
- );
271
- }
272
- const uiRequirements = [];
273
- if (contract.propsSpec?.properties) {
274
- for (const [name, entry] of Object.entries(contract.propsSpec.properties)) {
275
- const required = entry.required === true;
276
- if (required) {
277
- uiRequirements.push(
278
- `- **Required prop \`${name}\`** must appear somewhere in rendered DOM (display the value, or use it to drive a label/aria/key).`
279
- );
280
- } else {
281
- uiRequirements.push(
282
- `- **Optional prop \`${name}\`** may be ABSENT at runtime \u2014 the component must render without it (guard the access or apply its default) and must display it when it IS provided.`
283
- );
284
- }
285
- }
286
- }
287
- if (contract.actionSpec) {
288
- for (const [name, entry] of Object.entries(contract.actionSpec)) {
289
- const label = entry.label ?? name;
290
- uiRequirements.push(
291
- `- **Action \`${name}\`** ("${label}") needs an interactive control that fires it (Button click, form submit, key press, etc.).`
292
- );
293
- }
294
- }
295
- if (contract.streamSpec) {
296
- for (const name of Object.keys(contract.streamSpec)) {
297
- uiRequirements.push(
298
- `- **Stream \`${name}\`** must mirror into local state via \`useEffect\` and render the resulting state \u2014 \`useStream\` alone never re-renders the DOM.`
299
- );
300
- }
301
- }
302
- for (const use of gadgetUses) {
303
- const exportName = use.name;
304
- const pkg = use.package;
305
- uiRequirements.push(
306
- HOOK_NAME_RE.test(exportName) ? `- **ClientCapability \`${exportName}\`** \u2014 the boilerplate has direct-imported \`${exportName}\` from \`${pkg}\` above a \`// DO NOT EDIT\` banner; keep that import, call \`${exportName}\` inside the component, and thread the resulting value into a context slot or action payload if the agent needs to observe it.` : `- **ClientCapability \`${exportName}\`** \u2014 the boilerplate has direct-imported \`${exportName}\` from \`${pkg}\` above a \`// DO NOT EDIT\` banner; keep that import and RENDER \`<${exportName} \u2026 />\` as a JSX element in the tree you return.`
307
- );
308
- }
309
- if (uiRequirements.length > 0) {
310
- parts.push(
311
- `## Required UI Surfaces (derived from contract \u2014 every surface below MUST have visible UI, eval will fail if any is missing)
312
- ` + uiRequirements.join("\n")
313
- );
314
- }
315
- return parts.join("\n\n");
316
- }
317
- function injectContracts(userPrompt, contract, appGadgets) {
318
- if (!contract) return userPrompt;
319
- const ctx = buildContractsContext(contract);
320
- if (!ctx) return userPrompt;
321
- return userPrompt + "\n\n" + ctx;
322
- }
323
-
324
- export { buildContractsContext, buildRenderingContext, injectContracts, injectRenderingContext };
1
+ export { buildContractsContext, buildRenderingContext, injectContracts, injectRenderingContext } from '../chunk-VTC263LT.js';
2
+ import '../chunk-FWJIMKFZ.js';
3
+ import '../chunk-33B3BAWS.js';
4
+ import '../chunk-Z3CXME3K.js';
5
+ import '../chunk-NF6JUZWF.js';
6
+ import '../chunk-PUH4CXGZ.js';
7
+ import '../chunk-3T2HMTON.js';
8
+ import '../chunk-G3PMV62Z.js';
325
9
  //# sourceMappingURL=prompts.js.map
326
10
  //# sourceMappingURL=prompts.js.map