@engenty/wizards-runtime 0.20.5 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/README.md +3 -3
  2. package/apps/runtime/dist/agents/studio-assistant.js +7 -3
  3. package/apps/runtime/dist/agents/subscription.js +20 -25
  4. package/apps/runtime/dist/app.js +4 -1
  5. package/apps/runtime/dist/cli/clients.js +6 -24
  6. package/apps/runtime/dist/cli/connect.js +2 -1
  7. package/apps/runtime/dist/cli/environment.js +3 -0
  8. package/apps/runtime/dist/cli/machine.js +1 -70
  9. package/apps/runtime/dist/cli/main.js +2 -1
  10. package/apps/runtime/dist/cli/ollama.js +7 -254
  11. package/apps/runtime/dist/cli/setup.js +12 -9
  12. package/apps/runtime/dist/decision-model.js +1 -4
  13. package/apps/runtime/dist/docs/dev/licensing.md +20 -9
  14. package/apps/runtime/dist/docs/user-guide/command-line.md +5 -2
  15. package/apps/runtime/dist/elements/outside.js +2 -1
  16. package/apps/runtime/dist/engine/code-step.js +1 -1
  17. package/apps/runtime/dist/engine/decide.js +2 -2
  18. package/apps/runtime/dist/engine/device.js +3 -2
  19. package/apps/runtime/dist/engine/input.js +1 -1
  20. package/apps/runtime/dist/engine/runner.js +1 -1
  21. package/apps/runtime/dist/engine/steps.js +27 -8
  22. package/apps/runtime/dist/engine/surface.js +1 -1
  23. package/apps/runtime/dist/engine/template.js +1 -1
  24. package/apps/runtime/dist/env.js +1 -0
  25. package/apps/runtime/dist/harness/apple.js +4 -3
  26. package/apps/runtime/dist/harness/clients.js +117 -0
  27. package/apps/runtime/dist/harness/index.js +32 -87
  28. package/apps/runtime/dist/harness/model.js +32 -270
  29. package/apps/runtime/dist/harness/prompt.js +6 -120
  30. package/apps/runtime/dist/harness/types.js +5 -3
  31. package/apps/runtime/dist/local-call.js +6 -0
  32. package/apps/runtime/dist/local-models.js +53 -177
  33. package/apps/runtime/dist/mcp/bridge.js +12 -55
  34. package/apps/runtime/dist/mcp/elements.js +39 -4
  35. package/apps/runtime/dist/mcp/handler.js +12 -0
  36. package/apps/runtime/dist/mcp/run-pages.js +238 -0
  37. package/apps/runtime/dist/mcp/run-tasks.js +157 -0
  38. package/apps/runtime/dist/mcp/runs.js +129 -0
  39. package/apps/runtime/dist/mcp/tools.js +4 -95
  40. package/apps/runtime/dist/models.js +82 -32
  41. package/apps/runtime/dist/motion-graphics/step.js +2 -2
  42. package/apps/runtime/dist/prompts/mcp.md +4 -1
  43. package/apps/runtime/dist/render/downloads.js +1 -1
  44. package/apps/runtime/dist/render/shaped.js +1 -1
  45. package/apps/runtime/dist/routes/model-setup.js +77 -0
  46. package/apps/runtime/dist/routes/studio.js +8 -251
  47. package/apps/runtime/dist/services/space-categories.js +1 -1
  48. package/apps/runtime/dist/services/work-ai.js +11 -5
  49. package/apps/runtime/dist/texts.js +4 -6
  50. package/apps/runtime/dist/tools/connections.js +3 -0
  51. package/apps/runtime/dist/tools/harness.js +124 -0
  52. package/apps/web/dist/assets/AboutDialog-BSdAA4Wi.js +1 -0
  53. package/apps/web/dist/assets/{BlockEditor-CgjXTWly.js → BlockEditor-0noqMcAl.js} +1 -1
  54. package/apps/web/dist/assets/Bundle-Ctrq7lHH.js +1 -0
  55. package/apps/web/dist/assets/CapabilitiesPage-CZlVhBmU.js +2 -0
  56. package/apps/web/dist/assets/ChangelogDialog-BLCYV4jT.js +1 -0
  57. package/apps/web/dist/assets/{CodeEditor-2LyHbSre.js → CodeEditor-CpRn9BZq.js} +1 -1
  58. package/apps/web/dist/assets/ConnectorsSection-B4rRDlFo.js +1 -0
  59. package/apps/web/dist/assets/EditorPage-CXN-_zzG.js +3 -0
  60. package/apps/web/dist/assets/FlowPreview-DjQvcWxs.js +1 -0
  61. package/apps/web/dist/assets/LangSwitch-BuzsLp16.js +1 -0
  62. package/apps/web/dist/assets/LocalModels-BDfP2v5-.js +1 -0
  63. package/apps/web/dist/assets/Marketplace-4baBNzEc.js +2 -0
  64. package/apps/web/dist/assets/NewWizardChannels-B_xHm-bI.js +1 -0
  65. package/apps/web/dist/assets/NewWizardPage-BmZAY4zi.js +7 -0
  66. package/apps/web/dist/assets/OnboardingPage-fZq3WiTk.js +1 -0
  67. package/apps/web/dist/assets/ProtocolSection-v9wIxisg.js +1 -0
  68. package/apps/web/dist/assets/PublicRunner-BCh0VzAT.js +1 -0
  69. package/apps/web/dist/assets/{ReadOnly-CbvEK0rz.js → ReadOnly-13stkvNz.js} +1 -1
  70. package/apps/web/dist/assets/Results-4gmguYzH.js +1 -0
  71. package/apps/web/dist/assets/RunDrawer-CeEldWRn.js +1 -0
  72. package/apps/web/dist/assets/SettingsPage-BsKRRlfP.js +2 -0
  73. package/apps/web/dist/assets/SetupPage-FgA5Kl8z.js +1 -0
  74. package/apps/web/dist/assets/SharePage-BlBW4oxl.js +1 -0
  75. package/apps/web/dist/assets/SkillEditor-9QSskfmY.js +1 -0
  76. package/apps/web/dist/assets/Skills-DdUAyNhR.js +9 -0
  77. package/apps/web/dist/assets/SpacePage-CHkNPuqt.js +2 -0
  78. package/apps/web/dist/assets/StudioHome-BwPD-inc.js +1 -0
  79. package/apps/web/dist/assets/TableEditor-Du1DhbEC.js +7 -0
  80. package/apps/web/dist/assets/UpdateCheck-DPr9NXq_.js +2 -0
  81. package/apps/web/dist/assets/brand-DY3lzrOd.js +2 -0
  82. package/apps/web/dist/assets/changelog-BSdb22c3.js +1 -0
  83. package/apps/web/dist/assets/code-editor-Bep_LzQ5.js +2 -0
  84. package/apps/web/dist/assets/host-DiZQ_uws.js +1 -0
  85. package/apps/web/dist/assets/host-Dw-sMUSd.js +54 -0
  86. package/apps/web/dist/assets/i18n-DVrYWJaj.js +55 -0
  87. package/apps/web/dist/assets/index-C2gxK14s.css +1 -0
  88. package/apps/web/dist/assets/index-lQ4JYHYQ.js +102 -0
  89. package/apps/web/dist/assets/oss-credits-BHy69wkx.js +1 -0
  90. package/apps/web/dist/assets/{read-aloud-CRFt5q6k.js → read-aloud-CBycd8TA.js} +1 -1
  91. package/apps/web/dist/assets/{session-RDdtfee2.js → session-BYLtgklo.js} +1 -1
  92. package/apps/web/dist/assets/terminal-DmGdMags.js +16 -0
  93. package/apps/web/dist/assets/texts-ClKS2xhh.js +1 -0
  94. package/apps/web/dist/assets/theme-DFDOMsVo.js +14 -0
  95. package/apps/web/dist/assets/ui-CW2I3ecu.js +1 -0
  96. package/apps/web/dist/assets/ui-DfVpZYIW.js +16 -0
  97. package/apps/web/dist/assets/{useMutation-BSffqL6W.js → useMutation-BnkuLlQC.js} +1 -1
  98. package/apps/web/dist/assets/viewers-C6FfRwG1.js +2 -0
  99. package/apps/web/dist/index.html +18 -16
  100. package/apps/web/dist/mcp/flow.html +129 -129
  101. package/bin/bot-tunnel.mjs +375 -0
  102. package/bin/bot.mjs +494 -69
  103. package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.js +1 -1
  104. package/node_modules/@engenty/chatviews/dist/chat/a2ui.d.ts +48 -0
  105. package/node_modules/@engenty/chatviews/dist/chat/a2ui.js +514 -0
  106. package/node_modules/@engenty/chatviews/dist/chat/check.d.ts +18 -0
  107. package/node_modules/@engenty/chatviews/dist/chat/check.js +97 -0
  108. package/node_modules/@engenty/chatviews/dist/chat/index.d.ts +3 -0
  109. package/node_modules/@engenty/chatviews/dist/chat/index.js +4 -0
  110. package/node_modules/@engenty/chatviews/dist/chat/library.d.ts +39 -0
  111. package/node_modules/@engenty/chatviews/dist/chat/library.js +314 -0
  112. package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.js +1 -1
  113. package/node_modules/@engenty/chatviews/dist/react/chat.d.ts +33 -0
  114. package/node_modules/@engenty/chatviews/dist/react/chat.js +150 -0
  115. package/node_modules/@engenty/chatviews/dist/react/field-looks.d.ts +39 -0
  116. package/node_modules/@engenty/chatviews/dist/react/field-looks.js +47 -0
  117. package/node_modules/@engenty/chatviews/dist/react/markdown.d.ts +5 -0
  118. package/node_modules/@engenty/chatviews/dist/react/markdown.js +11 -0
  119. package/node_modules/@engenty/chatviews/dist/react/no-devtools.d.ts +0 -0
  120. package/node_modules/@engenty/chatviews/dist/react/no-devtools.js +8 -0
  121. package/node_modules/@engenty/chatviews/dist/react/surface.d.ts +39 -0
  122. package/node_modules/@engenty/chatviews/dist/react/surface.js +552 -0
  123. package/node_modules/@engenty/chatviews/dist/react/texts.d.ts +39 -0
  124. package/node_modules/@engenty/chatviews/dist/react/texts.js +42 -0
  125. package/node_modules/@engenty/chatviews/dist/react/ui.d.ts +112 -0
  126. package/node_modules/@engenty/chatviews/dist/react/ui.js +212 -0
  127. package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.js +1 -1
  128. package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.js +1 -1
  129. package/node_modules/@engenty/chatviews/package.json +19 -0
  130. package/node_modules/@engenty/decision-model/dist/client.d.ts +76 -0
  131. package/node_modules/@engenty/decision-model/dist/client.js +188 -0
  132. package/node_modules/@engenty/decision-model/dist/index.d.ts +6 -0
  133. package/node_modules/@engenty/decision-model/dist/index.js +5 -0
  134. package/node_modules/@engenty/decision-model/dist/local.d.ts +11 -0
  135. package/node_modules/@engenty/decision-model/dist/local.js +116 -0
  136. package/node_modules/@engenty/decision-model/dist/resolve.d.ts +26 -0
  137. package/node_modules/@engenty/decision-model/dist/resolve.js +53 -0
  138. package/node_modules/@engenty/decision-model/dist/types.d.ts +80 -0
  139. package/node_modules/@engenty/decision-model/dist/types.js +6 -0
  140. package/node_modules/@engenty/decision-model/dist/validate.d.ts +9 -0
  141. package/node_modules/@engenty/decision-model/dist/validate.js +50 -0
  142. package/node_modules/@engenty/decision-model/dist/ways.d.ts +42 -0
  143. package/node_modules/@engenty/decision-model/dist/ways.js +72 -0
  144. package/node_modules/@engenty/decision-model/package.json +9 -0
  145. package/node_modules/@engenty/local-models/dist/bridge/index.d.ts +54 -0
  146. package/node_modules/@engenty/local-models/dist/bridge/index.js +117 -0
  147. package/node_modules/@engenty/local-models/dist/clients/antigravity.d.ts +37 -0
  148. package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/antigravity.js +72 -17
  149. package/node_modules/@engenty/local-models/dist/clients/chat.d.ts +89 -0
  150. package/node_modules/@engenty/local-models/dist/clients/chat.js +22 -0
  151. package/node_modules/@engenty/local-models/dist/clients/claude.d.ts +32 -0
  152. package/node_modules/@engenty/local-models/dist/clients/claude.js +239 -0
  153. package/node_modules/@engenty/local-models/dist/clients/client.d.ts +31 -0
  154. package/node_modules/@engenty/local-models/dist/clients/client.js +2 -0
  155. package/node_modules/@engenty/local-models/dist/clients/codex.d.ts +35 -0
  156. package/node_modules/@engenty/local-models/dist/clients/codex.js +254 -0
  157. package/node_modules/@engenty/local-models/dist/clients/cursor.d.ts +35 -0
  158. package/node_modules/@engenty/local-models/dist/clients/cursor.js +192 -0
  159. package/node_modules/@engenty/local-models/dist/clients/detect.d.ts +18 -0
  160. package/node_modules/@engenty/local-models/dist/clients/detect.js +34 -0
  161. package/node_modules/@engenty/local-models/dist/clients/env.d.ts +66 -0
  162. package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/env.js +62 -31
  163. package/node_modules/@engenty/local-models/dist/clients/failure.d.ts +26 -0
  164. package/node_modules/@engenty/local-models/dist/clients/failure.js +35 -0
  165. package/node_modules/@engenty/local-models/dist/clients/index.d.ts +15 -0
  166. package/node_modules/@engenty/local-models/dist/clients/index.js +18 -0
  167. package/node_modules/@engenty/local-models/dist/clients/model.d.ts +129 -0
  168. package/node_modules/@engenty/local-models/dist/clients/model.js +225 -0
  169. package/node_modules/@engenty/local-models/dist/clients/prompt.d.ts +36 -0
  170. package/node_modules/@engenty/local-models/dist/clients/prompt.js +123 -0
  171. package/node_modules/@engenty/local-models/dist/clients/run.d.ts +15 -0
  172. package/node_modules/@engenty/local-models/dist/clients/run.js +41 -0
  173. package/node_modules/@engenty/local-models/dist/index.d.ts +4 -0
  174. package/node_modules/@engenty/local-models/dist/index.js +4 -0
  175. package/node_modules/@engenty/local-models/dist/lmstudio/api.d.ts +49 -0
  176. package/node_modules/@engenty/local-models/dist/lmstudio/api.js +101 -0
  177. package/node_modules/@engenty/local-models/dist/lmstudio/index.d.ts +3 -0
  178. package/node_modules/@engenty/local-models/dist/lmstudio/index.js +3 -0
  179. package/node_modules/@engenty/local-models/dist/lmstudio/load.d.ts +12 -0
  180. package/node_modules/@engenty/local-models/dist/lmstudio/load.js +100 -0
  181. package/node_modules/@engenty/local-models/dist/lmstudio/server.d.ts +3 -0
  182. package/node_modules/@engenty/local-models/dist/lmstudio/server.js +29 -0
  183. package/node_modules/@engenty/local-models/dist/mlx/helper.d.ts +54 -0
  184. package/node_modules/@engenty/local-models/dist/mlx/helper.js +149 -0
  185. package/node_modules/@engenty/local-models/dist/mlx/index.d.ts +3 -0
  186. package/node_modules/@engenty/local-models/dist/mlx/index.js +3 -0
  187. package/node_modules/@engenty/local-models/dist/mlx/server.d.ts +19 -0
  188. package/node_modules/@engenty/local-models/dist/mlx/server.js +82 -0
  189. package/node_modules/@engenty/local-models/dist/mlx/store.d.ts +16 -0
  190. package/node_modules/@engenty/local-models/dist/mlx/store.js +153 -0
  191. package/node_modules/@engenty/local-models/dist/ollama/api.d.ts +37 -0
  192. package/node_modules/@engenty/local-models/dist/ollama/api.js +147 -0
  193. package/node_modules/@engenty/local-models/dist/ollama/index.d.ts +3 -0
  194. package/node_modules/@engenty/local-models/dist/ollama/index.js +3 -0
  195. package/node_modules/@engenty/local-models/dist/ollama/model.d.ts +54 -0
  196. package/node_modules/@engenty/local-models/dist/ollama/model.js +302 -0
  197. package/node_modules/@engenty/local-models/dist/ollama/server.d.ts +3 -0
  198. package/node_modules/@engenty/local-models/dist/ollama/server.js +45 -0
  199. package/node_modules/@engenty/local-models/dist/probe.d.ts +57 -0
  200. package/node_modules/@engenty/local-models/dist/probe.js +174 -0
  201. package/node_modules/@engenty/local-models/dist/servers/index.d.ts +6 -0
  202. package/node_modules/@engenty/local-models/dist/servers/index.js +12 -0
  203. package/node_modules/@engenty/local-models/dist/servers/server.d.ts +84 -0
  204. package/node_modules/@engenty/local-models/dist/servers/server.js +38 -0
  205. package/node_modules/@engenty/local-models/package.json +16 -0
  206. package/node_modules/@engenty/model-setup/dist/catalog.d.ts +36 -0
  207. package/node_modules/@engenty/model-setup/dist/catalog.js +81 -0
  208. package/node_modules/@engenty/model-setup/dist/index.d.ts +3 -0
  209. package/node_modules/@engenty/model-setup/dist/index.js +3 -0
  210. package/node_modules/@engenty/model-setup/dist/offered.d.ts +7 -0
  211. package/node_modules/@engenty/model-setup/dist/offered.js +64 -0
  212. package/node_modules/@engenty/model-setup/dist/react/client.d.ts +46 -0
  213. package/node_modules/@engenty/model-setup/dist/react/client.js +147 -0
  214. package/node_modules/@engenty/model-setup/dist/react/columns.d.ts +78 -0
  215. package/node_modules/@engenty/model-setup/dist/react/columns.js +99 -0
  216. package/node_modules/@engenty/model-setup/dist/react/host.d.ts +31 -0
  217. package/node_modules/@engenty/model-setup/dist/react/host.js +48 -0
  218. package/node_modules/@engenty/model-setup/dist/react/index.d.ts +7 -0
  219. package/node_modules/@engenty/model-setup/dist/react/index.js +7 -0
  220. package/node_modules/@engenty/model-setup/dist/react/keys.d.ts +48 -0
  221. package/node_modules/@engenty/model-setup/dist/react/keys.js +74 -0
  222. package/node_modules/@engenty/model-setup/dist/react/local-models.d.ts +23 -0
  223. package/node_modules/@engenty/model-setup/dist/react/local-models.js +134 -0
  224. package/node_modules/@engenty/model-setup/dist/react/servers.d.ts +4 -0
  225. package/node_modules/@engenty/model-setup/dist/react/servers.js +13 -0
  226. package/node_modules/@engenty/model-setup/dist/react/terminal.d.ts +13 -0
  227. package/node_modules/@engenty/model-setup/dist/react/terminal.js +79 -0
  228. package/node_modules/@engenty/model-setup/dist/react/tone.d.ts +13 -0
  229. package/node_modules/@engenty/model-setup/dist/react/tone.js +66 -0
  230. package/node_modules/@engenty/model-setup/dist/server/apps.d.ts +12 -0
  231. package/node_modules/@engenty/model-setup/dist/server/apps.js +22 -0
  232. package/node_modules/@engenty/model-setup/dist/server/clients.d.ts +55 -0
  233. package/node_modules/@engenty/model-setup/dist/server/clients.js +96 -0
  234. package/node_modules/@engenty/model-setup/dist/server/index.d.ts +8 -0
  235. package/node_modules/@engenty/model-setup/dist/server/index.js +8 -0
  236. package/node_modules/@engenty/model-setup/dist/server/install.d.ts +24 -0
  237. package/node_modules/@engenty/model-setup/dist/server/install.js +68 -0
  238. package/node_modules/@engenty/model-setup/dist/server/lmstudio.d.ts +9 -0
  239. package/node_modules/@engenty/model-setup/dist/server/lmstudio.js +52 -0
  240. package/node_modules/@engenty/model-setup/dist/server/local-models.d.ts +47 -0
  241. package/node_modules/@engenty/model-setup/dist/server/local-models.js +164 -0
  242. package/node_modules/@engenty/model-setup/dist/server/models.d.ts +12 -0
  243. package/node_modules/@engenty/model-setup/dist/server/models.js +16 -0
  244. package/node_modules/@engenty/model-setup/dist/server/ollama.d.ts +22 -0
  245. package/node_modules/@engenty/model-setup/dist/server/ollama.js +146 -0
  246. package/node_modules/@engenty/model-setup/dist/server/routes.d.ts +51 -0
  247. package/node_modules/@engenty/model-setup/dist/server/routes.js +211 -0
  248. package/node_modules/@engenty/model-setup/dist/server/server-apps.d.ts +14 -0
  249. package/node_modules/@engenty/model-setup/dist/server/server-apps.js +24 -0
  250. package/node_modules/@engenty/model-setup/dist/server/terminal.d.ts +43 -0
  251. package/node_modules/@engenty/model-setup/dist/server/terminal.js +222 -0
  252. package/node_modules/@engenty/model-setup/dist/texts.d.ts +222 -0
  253. package/node_modules/@engenty/model-setup/dist/texts.js +222 -0
  254. package/node_modules/@engenty/model-setup/dist/types.d.ts +111 -0
  255. package/node_modules/@engenty/model-setup/dist/types.js +2 -0
  256. package/node_modules/@engenty/model-setup/package.json +12 -0
  257. package/node_modules/@engenty/search-index/dist/catalog-lexical.d.ts +14 -0
  258. package/node_modules/@engenty/search-index/dist/catalog-lexical.js +165 -0
  259. package/node_modules/@engenty/search-index/dist/catalog-rank.d.ts +33 -0
  260. package/node_modules/@engenty/search-index/dist/catalog-rank.js +99 -0
  261. package/node_modules/@engenty/search-index/dist/catalog-search.d.ts +40 -0
  262. package/node_modules/@engenty/search-index/dist/catalog-search.js +161 -0
  263. package/node_modules/@engenty/search-index/dist/chunks.d.ts +17 -0
  264. package/node_modules/@engenty/search-index/dist/chunks.js +164 -0
  265. package/node_modules/@engenty/search-index/dist/contracts.d.ts +135 -0
  266. package/node_modules/@engenty/search-index/dist/contracts.js +9 -0
  267. package/node_modules/@engenty/search-index/dist/embedder.d.ts +31 -0
  268. package/node_modules/@engenty/search-index/dist/embedder.js +82 -0
  269. package/node_modules/@engenty/search-index/dist/embedders/gemini.d.ts +11 -0
  270. package/node_modules/@engenty/search-index/dist/embedders/gemini.js +54 -0
  271. package/node_modules/@engenty/search-index/dist/embedders/index.d.ts +5 -0
  272. package/node_modules/@engenty/search-index/dist/embedders/index.js +5 -0
  273. package/node_modules/@engenty/search-index/dist/embedders/ollama.d.ts +12 -0
  274. package/node_modules/@engenty/search-index/dist/embedders/ollama.js +43 -0
  275. package/node_modules/@engenty/search-index/dist/embedders/openai.d.ts +11 -0
  276. package/node_modules/@engenty/search-index/dist/embedders/openai.js +36 -0
  277. package/node_modules/@engenty/search-index/dist/embedders/shared.d.ts +5 -0
  278. package/node_modules/@engenty/search-index/dist/embedders/shared.js +26 -0
  279. package/node_modules/@engenty/search-index/dist/embedders/ways.d.ts +16 -0
  280. package/node_modules/@engenty/search-index/dist/embedders/ways.js +90 -0
  281. package/node_modules/@engenty/search-index/dist/index.d.ts +10 -0
  282. package/node_modules/@engenty/search-index/dist/index.js +10 -0
  283. package/node_modules/@engenty/search-index/dist/payload.d.ts +13 -0
  284. package/node_modules/@engenty/search-index/dist/payload.js +51 -0
  285. package/node_modules/@engenty/search-index/dist/registry.d.ts +25 -0
  286. package/node_modules/@engenty/search-index/dist/registry.js +56 -0
  287. package/node_modules/@engenty/search-index/dist/scoring.d.ts +10 -0
  288. package/node_modules/@engenty/search-index/dist/scoring.js +45 -0
  289. package/node_modules/@engenty/search-index/dist/strategy.d.ts +6 -0
  290. package/node_modules/@engenty/search-index/dist/strategy.js +25 -0
  291. package/node_modules/@engenty/search-index/package.json +10 -0
  292. package/node_modules/@engenty/tool-harness/dist/harness.d.ts +70 -0
  293. package/node_modules/@engenty/tool-harness/dist/harness.js +170 -0
  294. package/node_modules/@engenty/tool-harness/dist/index.d.ts +5 -0
  295. package/node_modules/@engenty/tool-harness/dist/index.js +5 -0
  296. package/node_modules/@engenty/tool-harness/dist/judge.d.ts +8 -0
  297. package/node_modules/@engenty/tool-harness/dist/judge.js +39 -0
  298. package/node_modules/@engenty/tool-harness/dist/levels.d.ts +18 -0
  299. package/node_modules/@engenty/tool-harness/dist/levels.js +47 -0
  300. package/node_modules/@engenty/tool-harness/dist/model.d.ts +6 -0
  301. package/node_modules/@engenty/tool-harness/dist/model.js +60 -0
  302. package/node_modules/@engenty/tool-harness/dist/schema.d.ts +26 -0
  303. package/node_modules/@engenty/tool-harness/dist/schema.js +57 -0
  304. package/node_modules/@engenty/tool-harness/package.json +9 -0
  305. package/node_modules/@engenty/wizards-shared/dist/catalog-prompt.js +2 -1
  306. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +10 -10
  307. package/node_modules/@engenty/wizards-shared/dist/definition.js +4 -4
  308. package/node_modules/@engenty/wizards-shared/dist/run-schema.js +1 -1
  309. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +3 -1
  310. package/node_modules/@engenty/wizards-shared/dist/run.js +4 -0
  311. package/node_modules/@engenty/wizards-shared/dist/store.js +2 -1
  312. package/node_modules/@engenty/wizards-shared/dist/wizard-agents.d.ts +1 -1
  313. package/node_modules/@engenty/wizards-shared/dist/wizard-agents.js +1 -1
  314. package/node_modules/@engenty/wizards-shared/dist/wizard-text.js +2 -2
  315. package/package.json +13 -1
  316. package/plugin/.claude-plugin/plugin.json +1 -1
  317. package/plugin/plugin.json +1 -1
  318. package/apps/runtime/dist/agents/chat-clients.js +0 -344
  319. package/apps/runtime/dist/harness/claude.js +0 -141
  320. package/apps/runtime/dist/harness/codex.js +0 -222
  321. package/apps/runtime/dist/harness/cursor.js +0 -89
  322. package/apps/runtime/dist/harness/terminal.js +0 -201
  323. package/apps/web/dist/assets/AboutDialog-DM_2-iLP.js +0 -1
  324. package/apps/web/dist/assets/Bundle-C0u5HUZL.js +0 -1
  325. package/apps/web/dist/assets/CapabilitiesPage-DxRUERr-.js +0 -2
  326. package/apps/web/dist/assets/ChangelogDialog-Cyn3LAch.js +0 -1
  327. package/apps/web/dist/assets/ConnectorsSection-BYOrwccO.js +0 -1
  328. package/apps/web/dist/assets/EditorPage-BFUQzJpN.js +0 -3
  329. package/apps/web/dist/assets/FlowPreview-BXf4EKjU.js +0 -1
  330. package/apps/web/dist/assets/LangSwitch-BLB7dDce.js +0 -1
  331. package/apps/web/dist/assets/Marketplace-B3NoH5Va.js +0 -2
  332. package/apps/web/dist/assets/NewWizardChannels-DhmYe2C8.js +0 -1
  333. package/apps/web/dist/assets/NewWizardPage-MGKJVDp2.js +0 -7
  334. package/apps/web/dist/assets/OnboardingPage-RawpCO9J.js +0 -1
  335. package/apps/web/dist/assets/ProtocolSection-B1MshkAx.js +0 -1
  336. package/apps/web/dist/assets/PublicRunner-COatyxMi.js +0 -1
  337. package/apps/web/dist/assets/Results-DI4EHtkh.js +0 -1
  338. package/apps/web/dist/assets/RunDrawer-xXcbQ9wP.js +0 -1
  339. package/apps/web/dist/assets/SettingsPage-BcqqYDqw.js +0 -2
  340. package/apps/web/dist/assets/SetupPage-DG3fJ6fk.js +0 -1
  341. package/apps/web/dist/assets/SharePage-Drntg_oj.js +0 -1
  342. package/apps/web/dist/assets/SkillEditor-Ca_bzmjD.js +0 -1
  343. package/apps/web/dist/assets/Skills-BcgxuD15.js +0 -9
  344. package/apps/web/dist/assets/SpacePage-CzQAEQj8.js +0 -2
  345. package/apps/web/dist/assets/StudioHome-DWTDTslp.js +0 -1
  346. package/apps/web/dist/assets/TableEditor-DirMDIGk.js +0 -7
  347. package/apps/web/dist/assets/UpdateCheck-C6GlE6Am.js +0 -2
  348. package/apps/web/dist/assets/brand-BIT7AumL.js +0 -2
  349. package/apps/web/dist/assets/changelog-CMovB3yB.js +0 -1
  350. package/apps/web/dist/assets/code-editor-CufyaUFC.js +0 -2
  351. package/apps/web/dist/assets/host-DNvnJXoi.js +0 -69
  352. package/apps/web/dist/assets/i18n-WXeVnv7i.js +0 -55
  353. package/apps/web/dist/assets/index-D1iL3986.css +0 -1
  354. package/apps/web/dist/assets/index-DOq0CvXM.js +0 -102
  355. package/apps/web/dist/assets/oss-credits-C4SGbRkz.js +0 -1
  356. package/apps/web/dist/assets/theme-23bNrOQh.js +0 -14
  357. package/apps/web/dist/assets/ui-DkEhb2Rt.js +0 -16
  358. package/apps/web/dist/assets/viewers-CmGDpBjn.js +0 -2
  359. /package/apps/web/dist/assets/{host-BrP-ENHg.css → terminal-BrP-ENHg.css} +0 -0
  360. /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.d.ts +0 -0
  361. /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.d.ts +0 -0
  362. /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.d.ts +0 -0
  363. /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.d.ts +0 -0
@@ -0,0 +1,3 @@
1
+ export { A2UI_BASIC_CATALOG, type A2uiComponent, type A2uiOptions, type A2uiSurface, ENGENTY_CORE_CATALOG, engentyCoreCatalog, programToA2ui, surfaceToA2ui, } from "./a2ui.js";
2
+ export { checkView, VIEW_MAX_BYTES, type ViewCheck } from "./check.js";
3
+ export { CHAT_ACTIONS, CHAT_COMPONENTS, CHAT_FUNCTIONS, CHAT_LIBRARY, type ChatComponent, chatLibrarySpec, chatViewPrompt, } from "./library.js";
@@ -0,0 +1,4 @@
1
+ // SPDX-License-Identifier: MIT
2
+ export { A2UI_BASIC_CATALOG, ENGENTY_CORE_CATALOG, engentyCoreCatalog, programToA2ui, surfaceToA2ui, } from "./a2ui.js";
3
+ export { checkView, VIEW_MAX_BYTES } from "./check.js";
4
+ export { CHAT_ACTIONS, CHAT_COMPONENTS, CHAT_FUNCTIONS, CHAT_LIBRARY, chatLibrarySpec, chatViewPrompt, } from "./library.js";
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The views a model writes in a chat, as an OpenUI library: the components of the surface
4
+ * catalog (surface.ts) a chat may show, with their props in the order a program passes them.
5
+ * The order is the language: a stored card is text with positional arguments, so a prop is only
6
+ * ever appended (optional), never moved or renamed. A change that can't keep to that is
7
+ * `engenty:core/2`, and both are kept while cards of the old one are shown.
8
+ *
9
+ * This module has no React: the home checks programs with it and writes the model's prompt.
10
+ * `react/chat.tsx` draws the same components.
11
+ */
12
+ export declare const CHAT_LIBRARY = "engenty:core/1";
13
+ /** A component of the chat library: its name, what it is for, its props in their order. */
14
+ export interface ChatComponent {
15
+ name: string;
16
+ description: string;
17
+ props: z.ZodObject;
18
+ }
19
+ export declare const CHAT_COMPONENTS: ChatComponent[];
20
+ export declare const CHAT_FUNCTIONS: (import("@openuidev/lang-core").DefinedFunction<z.ZodObject<{
21
+ value: z.ZodAny;
22
+ table: z.ZodRecord<z.ZodString, z.ZodAny>;
23
+ }, z.core.$strip>, z.ZodAny> | import("@openuidev/lang-core").DefinedFunction<z.ZodObject<{
24
+ value: z.ZodAny;
25
+ template: z.ZodString;
26
+ as: z.ZodOptional<z.ZodEnum<{
27
+ number: "number";
28
+ percent: "percent";
29
+ }>>;
30
+ }, z.core.$strip>, z.ZodString>)[];
31
+ export declare const CHAT_ACTIONS: import("@openuidev/lang-core").DefinedAction<z.ZodObject<{
32
+ ref: z.ZodString;
33
+ }, z.core.$strip>, "Open">[];
34
+ /** The library without its drawing: for the prompt and the checks. */
35
+ export declare const chatLibrarySpec: Required<import("@openuidev/lang-core").Library<null, import("@openuidev/lang-core").DefinedAction<z.ZodObject<{
36
+ ref: z.ZodString;
37
+ }, z.core.$strip>, "Open">>>;
38
+ /** What a model reads to write a view: the language, the components, how a view is made. */
39
+ export declare function chatViewPrompt(preamble?: string): string;
@@ -0,0 +1,314 @@
1
+ // SPDX-License-Identifier: MIT
2
+ import { createLibrary, defineAction, defineComponent, defineFunction } from "@openuidev/lang-core";
3
+ import { z } from "zod";
4
+ import { viewLang } from "../react/texts.js";
5
+ /**
6
+ * The views a model writes in a chat, as an OpenUI library: the components of the surface
7
+ * catalog (surface.ts) a chat may show, with their props in the order a program passes them.
8
+ * The order is the language: a stored card is text with positional arguments, so a prop is only
9
+ * ever appended (optional), never moved or renamed. A change that can't keep to that is
10
+ * `engenty:core/2`, and both are kept while cards of the old one are shown.
11
+ *
12
+ * This module has no React: the home checks programs with it and writes the model's prompt.
13
+ * `react/chat.tsx` draws the same components.
14
+ */
15
+ export const CHAT_LIBRARY = "engenty:core/1";
16
+ /** A component a program passes into another: drawn where the other puts it. */
17
+ const child = z.any().describe("a component");
18
+ const children = z.array(child);
19
+ const text = z.string();
20
+ const value = z.union([z.string(), z.number(), z.boolean(), z.null()]);
21
+ const rows = z.array(z.record(z.string(), z.any()));
22
+ export const CHAT_COMPONENTS = [
23
+ {
24
+ name: "Column",
25
+ description: "Components one under the other; the root of a view",
26
+ props: z.object({ children }),
27
+ },
28
+ {
29
+ name: "Text",
30
+ description: 'One line of plain text; "lead" is the one opening line',
31
+ props: z.object({ text, variant: z.enum(["h3", "h4", "lead", "body", "muted"]).optional() }),
32
+ },
33
+ {
34
+ name: "Markdown",
35
+ description: "Formatted text: bold, lists, links",
36
+ props: z.object({ text }),
37
+ },
38
+ {
39
+ name: "List",
40
+ description: "Rows one under the other",
41
+ props: z.object({ children }),
42
+ },
43
+ {
44
+ name: "Row",
45
+ description: "One row of a List",
46
+ props: z.object({
47
+ title: value,
48
+ subtitle: value.optional(),
49
+ meta: value.optional(),
50
+ badge: value.optional(),
51
+ image: text.optional().describe("a file id"),
52
+ }),
53
+ },
54
+ {
55
+ name: "DetailGrid",
56
+ description: "Facts as label and value",
57
+ props: z.object({ rows: z.array(z.object({ label: text, value })) }),
58
+ },
59
+ {
60
+ name: "Badge",
61
+ description: "A short mark",
62
+ props: z.object({
63
+ label: value,
64
+ tone: z.enum(["default", "success", "warning", "accent"]).optional(),
65
+ }),
66
+ },
67
+ {
68
+ name: "Grid",
69
+ description: "Tiles side by side; min: the narrowest a tile gets in rem (14 for cards)",
70
+ props: z.object({
71
+ children,
72
+ columns: z.number().optional(),
73
+ min: z.number().optional(),
74
+ }),
75
+ },
76
+ {
77
+ name: "Metric",
78
+ description: "A key figure",
79
+ props: z.object({ label: value, value, caption: value.optional() }),
80
+ },
81
+ {
82
+ name: "Table",
83
+ description: "Figures people compare across columns; never a table of things",
84
+ props: z.object({
85
+ rows,
86
+ columns: z.array(z.object({ key: text, label: text })).optional(),
87
+ }),
88
+ },
89
+ {
90
+ name: "Image",
91
+ description: "A picture of the space's files",
92
+ props: z.object({ src: text.describe("a file id"), alt: text.optional() }),
93
+ },
94
+ {
95
+ name: "BarChart",
96
+ description: "Bars; labelKey/valueKey name the columns of points that hold label and number",
97
+ props: z.object({
98
+ points: rows,
99
+ title: text.optional(),
100
+ labelKey: text.optional(),
101
+ valueKey: text.optional(),
102
+ }),
103
+ },
104
+ {
105
+ name: "LineChart",
106
+ description: "A line over points; labelKey/valueKey as for BarChart",
107
+ props: z.object({
108
+ points: rows,
109
+ title: text.optional(),
110
+ labelKey: text.optional(),
111
+ valueKey: text.optional(),
112
+ }),
113
+ },
114
+ {
115
+ name: "DonutChart",
116
+ description: "Shares of a whole; labelKey/valueKey as for BarChart",
117
+ props: z.object({
118
+ slices: rows,
119
+ title: text.optional(),
120
+ labelKey: text.optional(),
121
+ valueKey: text.optional(),
122
+ }),
123
+ },
124
+ {
125
+ name: "Callout",
126
+ description: "A note that stands out",
127
+ props: z.object({
128
+ text,
129
+ title: text.optional(),
130
+ tone: z.enum(["tip", "note", "warning"]).optional(),
131
+ }),
132
+ },
133
+ {
134
+ name: "Chips",
135
+ description: "Short things at a glance; flagKey marks some",
136
+ props: z.object({
137
+ items: z.array(z.any()),
138
+ labelKey: text.optional(),
139
+ flagKey: text.optional(),
140
+ flag: text.optional(),
141
+ }),
142
+ },
143
+ {
144
+ name: "Steps",
145
+ description: "Ordered work, numbered, with times",
146
+ props: z.object({
147
+ items: z.array(z.any()),
148
+ textKey: text.optional(),
149
+ minutesKey: text.optional(),
150
+ }),
151
+ },
152
+ {
153
+ name: "Tabs",
154
+ description: "Two to four views of one answer",
155
+ props: z.object({
156
+ tabs: z.array(z.object({ label: text, child, count: z.number().optional() })),
157
+ }),
158
+ },
159
+ {
160
+ name: "Card",
161
+ description: "One thing: a day, an offer, a person",
162
+ props: z.object({
163
+ title: value,
164
+ children: children.optional(),
165
+ eyebrow: value.optional(),
166
+ subtitle: value.optional(),
167
+ image: text.optional().describe("a file id"),
168
+ }),
169
+ },
170
+ {
171
+ name: "Fold",
172
+ description: "Details that open on a tap",
173
+ props: z.object({ title: text, children, open: z.boolean().optional() }),
174
+ },
175
+ {
176
+ name: "Sources",
177
+ description: "Where it was found, as small chips",
178
+ props: z.object({
179
+ items: z.array(z.object({ title: text, url: text.optional(), open: text.optional() })),
180
+ }),
181
+ },
182
+ {
183
+ name: "File",
184
+ description: "A file of the space with its name; a PDF or picture shows itself",
185
+ props: z.object({
186
+ file: text.describe("a file id"),
187
+ name: text,
188
+ mime: text.optional(),
189
+ preview: z.boolean().optional(),
190
+ }),
191
+ },
192
+ {
193
+ name: "Ref",
194
+ description: 'A thing of the space: open is what space_search gave as "open" ("p:…", "t:…", "f:…"), or "chat:<id>", "wizard:<id>"',
195
+ props: z.object({
196
+ title: text,
197
+ open: text,
198
+ subtitle: text.optional(),
199
+ meta: text.optional(),
200
+ }),
201
+ },
202
+ {
203
+ name: "Actions",
204
+ description: "Buttons side by side",
205
+ props: z.object({ children }),
206
+ },
207
+ {
208
+ name: "Button",
209
+ description: 'A button; its action is @ToAssistant("what the person says") to ask you, @Open(ref) to open a thing of the space, @OpenUrl(url)',
210
+ props: z.object({ label: text, action: z.any().describe("an action") }),
211
+ },
212
+ {
213
+ name: "Form",
214
+ description: "Asks for answers: its Fields and a send button; the answers come back as the person's message",
215
+ props: z.object({ children, submit: text, title: text.optional() }),
216
+ },
217
+ {
218
+ name: "Field",
219
+ description: "One answer of a Form; select and multiselect need options; value prefills what you know",
220
+ props: z.object({
221
+ name: text.describe("letters, digits and _"),
222
+ kind: z.enum([
223
+ "text",
224
+ "textarea",
225
+ "number",
226
+ "select",
227
+ "multiselect",
228
+ "date",
229
+ "email",
230
+ "url",
231
+ "toggle",
232
+ "color",
233
+ ]),
234
+ label: text,
235
+ required: z.boolean().optional(),
236
+ options: z.array(text).optional(),
237
+ value: z.any().optional(),
238
+ placeholder: text.optional(),
239
+ }),
240
+ },
241
+ ];
242
+ /** The words a value becomes: `as` writes a number in the person's language first. */
243
+ function written(raw, as) {
244
+ if (typeof raw === "number" && (as === "number" || as === "percent")) {
245
+ return new Intl.NumberFormat(viewLang(), as === "percent" ? { style: "percent" } : {}).format(raw);
246
+ }
247
+ return raw;
248
+ }
249
+ export const CHAT_FUNCTIONS = [
250
+ defineFunction({
251
+ name: "Map",
252
+ description: 'A value looked up in a table: @Map(true, {"true": "in stock", "false": "order"})',
253
+ params: z.object({ value: z.any(), table: z.record(z.string(), z.any()) }),
254
+ returns: z.any(),
255
+ fn: ({ value: v, table }) => (Object.hasOwn(table, String(v)) ? table[String(v)] : v),
256
+ }),
257
+ defineFunction({
258
+ name: "Format",
259
+ description: 'A value set into a text, {} is the value; as: "number" or "percent" writes it in the person\'s language: @Format(0.25, "{} done", "percent")',
260
+ params: z.object({
261
+ value: z.any(),
262
+ template: z.string(),
263
+ as: z.enum(["number", "percent"]).optional(),
264
+ }),
265
+ returns: z.string(),
266
+ fn: ({ value: v, template, as }) => {
267
+ const w = written(v, as);
268
+ return w === undefined || w === null || w === ""
269
+ ? ""
270
+ : template.replace("{}", Array.isArray(w) ? w.join(", ") : String(w));
271
+ },
272
+ }),
273
+ ];
274
+ export const CHAT_ACTIONS = [
275
+ defineAction({
276
+ name: "Open",
277
+ description: "Opens a thing of the space (a Ref's open)",
278
+ params: z.object({ ref: z.string() }),
279
+ }),
280
+ ];
281
+ /** The library without its drawing: for the prompt and the checks. */
282
+ export const chatLibrarySpec = createLibrary({
283
+ components: CHAT_COMPONENTS.map((c) => defineComponent({ ...c, component: null })),
284
+ functions: CHAT_FUNCTIONS,
285
+ actions: CHAT_ACTIONS,
286
+ root: "Column",
287
+ });
288
+ /** What a model reads to write a view: the language, the components, how a view is made. */
289
+ export function chatViewPrompt(preamble) {
290
+ return chatLibrarySpec.prompt({
291
+ preamble,
292
+ additionalRules: [
293
+ "Design it like an app, not a report: lead with a headline, the key figure or the chips; one Card per thing; ordered work is Steps. A Table only for figures people compare across columns.",
294
+ "Keep it small: what the person needs to see first, then the details.",
295
+ "Never invent numbers: write the figures you found.",
296
+ "Pictures and files are the space's own, by file id; never an address on the web.",
297
+ "Never ask for passwords, card numbers or other secrets in a Form.",
298
+ "No Query, Mutation or $variables: a view shows what you write into it.",
299
+ ],
300
+ examples: [
301
+ [
302
+ "root = Column([title, figures, days, ask])",
303
+ 'title = Text("Next week", "h3")',
304
+ "figures = Grid([open, done], 2)",
305
+ 'open = Metric("Open", 12)',
306
+ 'done = Metric("Done", @Format(0.4, "{}", "percent"))',
307
+ "days = List([mon, tue])",
308
+ 'mon = Row("Monday", "Site visit", "9:00")',
309
+ 'tue = Row("Tuesday", "Offer due", "17:00", "today")',
310
+ 'ask = Button("Plan Wednesday", @ToAssistant("Plan Wednesday for me"))',
311
+ ].join("\n"),
312
+ ],
313
+ });
314
+ }
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: FSL-1.1-MIT OR MIT
1
+ // SPDX-License-Identifier: MIT
2
2
  /**
3
3
  * Numbers as people write and read them: what a phone's number pad, a table cell or a document
4
4
  * gives, and an amount or a file's size as a page shows it. The server, the studio and the runner read and
@@ -0,0 +1,33 @@
1
+ import "./no-devtools.js";
2
+ import { type ActionEvent } from "@openuidev/react-lang";
3
+ import { type SurfaceChat } from "./surface.js";
4
+ /** What a host gives the views a model wrote: where files and Refs lead, who answered. */
5
+ export interface ViewHost {
6
+ /** Where a file of the space is read, by its id. */
7
+ assetUrl(id: string): string;
8
+ /** Where a Ref's `open` leads, and how the host follows it. */
9
+ chat?: Pick<SurfaceChat, "href" | "follow">;
10
+ /** The Form's answers someone already sent: shown, not to be sent again. */
11
+ answered?: {
12
+ by: string;
13
+ } | null;
14
+ }
15
+ /** The chat library with its drawing: what `ViewRenderer` draws a program with. */
16
+ export declare const chatLibrary: Required<import("@openuidev/react-lang").Library<import("@openuidev/lang-core").DefinedAction<import("zod").ZodObject<{
17
+ ref: import("zod").ZodString;
18
+ }, import("zod/v4/core").$strip>, "Open">>>;
19
+ /**
20
+ * A view a model wrote (an OpenUI Lang program, checked with `checkView` before it was stored),
21
+ * drawn with the catalog's components. `onAction` gets OpenUI's action events: a button that
22
+ * asks the assistant and a Form's send are `continue_conversation` with the form's state,
23
+ * `Open` carries a Ref's `open`, `open_url` an address.
24
+ */
25
+ export declare function ViewRenderer({ program, host, onAction, initialState, onStateUpdate, streaming, }: {
26
+ program: string;
27
+ host: ViewHost;
28
+ onAction?: (event: ActionEvent) => void;
29
+ /** A Form's answers kept from last time (the card's draft, or what was sent). */
30
+ initialState?: Record<string, unknown>;
31
+ onStateUpdate?: (state: Record<string, unknown>) => void;
32
+ streaming?: boolean;
33
+ }): import("react").JSX.Element;
@@ -0,0 +1,150 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // SPDX-License-Identifier: MIT
3
+ // First: keeps react-lang from mounting its devtools, which a development build loads from a CDN.
4
+ import "./no-devtools.js";
5
+ import { createLibrary, defineComponent, FormNameContext, Renderer, useFormName, useIsStreaming, useStateField, useTriggerAction, } from "@openuidev/react-lang";
6
+ import { createContext, useContext, useId, useRef, useState } from "react";
7
+ import { CHAT_ACTIONS, CHAT_COMPONENTS, CHAT_FUNCTIONS, } from "../chat/library.js";
8
+ import { SurfaceView } from "./surface.js";
9
+ import { t } from "./texts.js";
10
+ import { Button, cn, Input, Label, Select, Swatch, Switch, Textarea } from "./ui.js";
11
+ const HostContext = createContext({ assetUrl: (id) => id });
12
+ const isElement = (v) => Boolean(v && typeof v === "object" && v.type === "element");
13
+ /**
14
+ * A component of the catalog, drawn by SurfaceView: its props as the program gave them, the
15
+ * components it holds as slots that OpenUI draws.
16
+ */
17
+ function drawn(name) {
18
+ return function Drawn({ props, renderNode, }) {
19
+ const host = useContext(HostContext);
20
+ const slots = new Map();
21
+ const holds = (v) => {
22
+ if (isElement(v)) {
23
+ const id = `s${slots.size}`;
24
+ slots.set(id, renderNode(v));
25
+ return id;
26
+ }
27
+ if (Array.isArray(v)) {
28
+ return v.map(holds);
29
+ }
30
+ if (v && typeof v === "object") {
31
+ return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, holds(x)]));
32
+ }
33
+ return v;
34
+ };
35
+ const own = holds(props);
36
+ const component = { ...own, id: "root", component: name };
37
+ return (_jsx(SurfaceView, { surface: { components: [component], data: {} }, assetUrl: host.assetUrl, chat: host.chat, slots: slots }));
38
+ };
39
+ }
40
+ /** A Button: its action as the program wrote it (ask the assistant, open a thing, a page). */
41
+ function ActionButton({ props }) {
42
+ const trigger = useTriggerAction();
43
+ const formName = useFormName();
44
+ const streaming = useIsStreaming();
45
+ const label = String(props.label ?? "");
46
+ return (_jsx(Button, { variant: "secondary", size: "sm", className: "self-start", disabled: streaming, onClick: () => void trigger(label, formName, props.action), children: label }));
47
+ }
48
+ const FieldsContext = createContext(null);
49
+ /** A Form: its Fields, and a button that sends the answers as the person's message. */
50
+ function FormBox({ props, renderNode, statementId, }) {
51
+ const host = useContext(HostContext);
52
+ const trigger = useTriggerAction();
53
+ const streaming = useIsStreaming();
54
+ const name = statementId ?? "form";
55
+ const checks = useRef(new Map());
56
+ const [missing, setMissing] = useState(new Set());
57
+ const answered = host.answered ?? null;
58
+ const fields = {
59
+ register(field, check) {
60
+ checks.current.set(field, check);
61
+ return () => checks.current.delete(field);
62
+ },
63
+ missing,
64
+ sent: Boolean(answered),
65
+ };
66
+ const submit = String(props.submit ?? "");
67
+ const send = () => {
68
+ const empty = new Set([...checks.current].filter(([, filled]) => !filled()).map(([f]) => f));
69
+ setMissing(empty);
70
+ if (empty.size === 0) {
71
+ void trigger(submit, name, { type: "continue_conversation" });
72
+ }
73
+ };
74
+ return (_jsx(FormNameContext.Provider, { value: name, children: _jsx(FieldsContext.Provider, { value: fields, children: _jsxs("div", { className: "flex flex-col gap-4 rounded-xl bg-card p-4 ring-1 ring-border-soft", children: [props.title ? (_jsx("div", { className: "font-semibold text-[1rem]", children: String(props.title) })) : null, renderNode(props.children), answered ? (_jsx("div", { className: "text-[0.8125rem] text-ink-3", children: t("surface.sentBy", { name: answered.by }) })) : (_jsx(Button, { className: "self-start", disabled: streaming, onClick: send, children: submit }))] }) }) }));
75
+ }
76
+ const empty = (v) => v === undefined || v === null || v === "" || (Array.isArray(v) && v.length === 0);
77
+ /** One answer of a Form, kept in OpenUI's form state under its name. */
78
+ function FieldBox({ props }) {
79
+ const name = String(props.name ?? "");
80
+ const kind = String(props.kind ?? "text");
81
+ const field = useStateField(name);
82
+ const fields = useContext(FieldsContext);
83
+ const id = useId();
84
+ const start = props.value;
85
+ const value = field.value === undefined ? start : field.value;
86
+ const required = props.required === true;
87
+ const registered = useRef(null);
88
+ if (fields && registered.current !== name) {
89
+ registered.current = name;
90
+ fields.register(name, () => !required || !empty(field.value ?? start));
91
+ }
92
+ const options = Array.isArray(props.options) ? props.options.map(String) : [];
93
+ const disabled = fields?.sent ?? false;
94
+ const set = (v) => field.setValue(v);
95
+ const label = String(props.label ?? name);
96
+ const placeholder = typeof props.placeholder === "string" ? props.placeholder : undefined;
97
+ let input;
98
+ switch (kind) {
99
+ case "textarea":
100
+ input = (_jsx(Textarea, { id: id, value: String(value ?? ""), placeholder: placeholder, disabled: disabled, onChange: (e) => set(e.target.value) }));
101
+ break;
102
+ case "select":
103
+ input = (_jsx(Select, { value: String(value ?? ""), placeholder: placeholder ?? "", options: options.map((o) => ({ value: o, label: o })), onChange: set }));
104
+ break;
105
+ case "multiselect": {
106
+ const chosen = new Set(Array.isArray(value) ? value.map(String) : []);
107
+ input = (_jsx("div", { className: "flex flex-wrap gap-2", children: options.map((o) => (_jsx("button", { type: "button", disabled: disabled, onClick: () => {
108
+ const next = new Set(chosen);
109
+ if (next.has(o)) {
110
+ next.delete(o);
111
+ }
112
+ else {
113
+ next.add(o);
114
+ }
115
+ set(options.filter((x) => next.has(x)));
116
+ }, className: cn("h-9 rounded-full px-3.5 text-[0.875rem] ring-1", chosen.has(o) ? "bg-ink text-paper ring-ink" : "bg-card ring-border-soft"), children: o }, o))) }));
117
+ break;
118
+ }
119
+ case "toggle":
120
+ input = _jsx(Switch, { checked: value === true, label: label, disabled: disabled, onChange: set });
121
+ break;
122
+ case "color":
123
+ input = _jsx(Swatch, { value: String(value ?? "#000000"), onChange: (e) => set(e.target.value) });
124
+ break;
125
+ default:
126
+ input = (_jsx(Input, { id: id, type: kind === "number" ? "number" : ["date", "email", "url"].includes(kind) ? kind : "text", value: value === undefined || value === null ? "" : String(value), placeholder: placeholder, disabled: disabled, onChange: (e) => set(kind === "number" && e.target.value !== "" ? Number(e.target.value) : e.target.value) }));
127
+ }
128
+ return (_jsxs("label", { htmlFor: id, className: "block", children: [_jsx(Label, { required: required, children: label }), input, fields?.missing.has(name) ? (_jsx("div", { className: "mt-1 text-[0.8125rem] text-rose", children: t("surface.required") })) : null] }));
129
+ }
130
+ const OWN = {
131
+ Button: (c) => defineComponent({ ...c, component: ActionButton }),
132
+ Form: (c) => defineComponent({ ...c, component: FormBox }),
133
+ Field: (c) => defineComponent({ ...c, component: FieldBox }),
134
+ };
135
+ /** The chat library with its drawing: what `ViewRenderer` draws a program with. */
136
+ export const chatLibrary = createLibrary({
137
+ components: CHAT_COMPONENTS.map((c) => OWN[c.name] ? OWN[c.name](c) : defineComponent({ ...c, component: drawn(c.name) })),
138
+ functions: CHAT_FUNCTIONS,
139
+ actions: CHAT_ACTIONS,
140
+ root: "Column",
141
+ });
142
+ /**
143
+ * A view a model wrote (an OpenUI Lang program, checked with `checkView` before it was stored),
144
+ * drawn with the catalog's components. `onAction` gets OpenUI's action events: a button that
145
+ * asks the assistant and a Form's send are `continue_conversation` with the form's state,
146
+ * `Open` carries a Ref's `open`, `open_url` an address.
147
+ */
148
+ export function ViewRenderer({ program, host, onAction, initialState, onStateUpdate, streaming = false, }) {
149
+ return (_jsx(HostContext.Provider, { value: host, children: _jsx("div", { className: "flex flex-col gap-3", children: _jsx(Renderer, { response: program, library: chatLibrary, isStreaming: streaming, onAction: onAction, initialState: initialState, onStateUpdate: onStateUpdate }) }) }));
150
+ }
@@ -0,0 +1,39 @@
1
+ /** A number typed in, its unit after it. */
2
+ export declare function NumberInput({ value, unit, placeholder, onChange, }: {
3
+ value: string;
4
+ unit?: string;
5
+ placeholder?: string;
6
+ onChange: (v: unknown) => void;
7
+ }): import("react").JSX.Element;
8
+ /**
9
+ * The value large above a slider. No answer yet: "–", the thumb at the start, so what the page
10
+ * shows is never an answer nobody gave.
11
+ */
12
+ export declare function NumberSlider({ label, value, min, max, increment, unit, onChange, }: {
13
+ label: string;
14
+ value: unknown;
15
+ min: number;
16
+ max: number;
17
+ increment?: number;
18
+ unit?: string;
19
+ onChange: (v: unknown) => void;
20
+ }): import("react").JSX.Element;
21
+ /** Minus and plus around the value, which can also be typed; the server checks what it holds. */
22
+ export declare function NumberStepper({ value, min, max, increment, unit, placeholder, onChange, }: {
23
+ value: unknown;
24
+ min?: number;
25
+ max?: number;
26
+ increment?: number;
27
+ unit?: string;
28
+ placeholder?: string;
29
+ onChange: (v: unknown) => void;
30
+ }): import("react").JSX.Element;
31
+ /** One row with a round button per choice, for choices that need a line of text. */
32
+ export declare function ListChoice({ name, value, options, disabled, label, onChange, }: {
33
+ name: string;
34
+ value: string;
35
+ options: string[];
36
+ disabled: Set<string>;
37
+ label: (option: string) => string;
38
+ onChange: (v: unknown) => void;
39
+ }): import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // SPDX-License-Identifier: MIT
3
+ import { readNumber } from "../numbers.js";
4
+ import { t, viewLang } from "./texts.js";
5
+ import { cn, Input } from "./ui.js";
6
+ /** The answer as a number, or undefined while there is none: a field holds what was typed. */
7
+ const numberOf = (value) => {
8
+ if (value === undefined || value === null || value === "") {
9
+ return undefined;
10
+ }
11
+ return readNumber(value) ?? undefined;
12
+ };
13
+ const written = (n, unit) => n === undefined ? "–" : `${new Intl.NumberFormat(viewLang()).format(n)}${unit ? ` ${unit}` : ""}`;
14
+ /** A number stays clean through repeated steps: 0.1 + 0.2 is 0.3 here. */
15
+ const tidy = (n) => Number(n.toFixed(6));
16
+ /** A number typed in, its unit after it. */
17
+ export function NumberInput({ value, unit, placeholder, onChange, }) {
18
+ const input = (_jsx(Input, { inputMode: "decimal", autoComplete: "off", value: value, placeholder: placeholder, onChange: (e) => onChange(e.target.value) }));
19
+ return unit ? (_jsxs("div", { className: "flex items-center gap-2", children: [input, _jsx("span", { className: "shrink-0 text-ink-2 text-sm", children: unit })] })) : (input);
20
+ }
21
+ /**
22
+ * The value large above a slider. No answer yet: "–", the thumb at the start, so what the page
23
+ * shows is never an answer nobody gave.
24
+ */
25
+ export function NumberSlider({ label, value, min, max, increment, unit, onChange, }) {
26
+ const n = numberOf(value);
27
+ return (_jsxs("div", { className: "grid gap-2", children: [_jsx("div", { className: "font-display font-semibold text-3xl tabular-nums", children: written(n, unit) }), _jsx("input", { type: "range", "aria-label": label, min: min, max: max, step: increment ?? "any", value: n ?? min, onChange: (e) => onChange(Number(e.target.value)), className: "h-11 w-full cursor-pointer accent-ember" }), _jsxs("div", { className: "flex justify-between text-[0.8125rem] text-ink-3 tabular-nums", children: [_jsx("span", { children: written(min, unit) }), _jsx("span", { children: written(max, unit) })] })] }));
28
+ }
29
+ /** Minus and plus around the value, which can also be typed; the server checks what it holds. */
30
+ export function NumberStepper({ value, min, max, increment, unit, placeholder, onChange, }) {
31
+ const n = numberOf(value);
32
+ const by = increment ?? 1;
33
+ const move = (direction) => {
34
+ const next = tidy(n === undefined ? (min ?? 0) : n + direction * by);
35
+ onChange(Math.min(max ?? next, Math.max(min ?? next, next)));
36
+ };
37
+ const button = "flex size-11 shrink-0 items-center justify-center rounded-full border border-input bg-card text-ink-2 text-xl transition hover:border-ink-4 hover:text-ink disabled:pointer-events-none disabled:opacity-40";
38
+ return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { type: "button", "aria-label": t("run.less"), className: button, disabled: n !== undefined && min !== undefined && n <= min, onClick: () => move(-1), children: "\u2212" }), _jsx(Input, { inputMode: "decimal", autoComplete: "off", className: "text-center tabular-nums", value: value === undefined || value === null ? "" : String(value), placeholder: placeholder, onChange: (e) => onChange(e.target.value) }), unit ? _jsx("span", { className: "shrink-0 text-ink-2 text-sm", children: unit }) : null, _jsx("button", { type: "button", "aria-label": t("run.more"), className: button, disabled: n !== undefined && max !== undefined && n >= max, onClick: () => move(1), children: "+" })] }));
39
+ }
40
+ /** One row with a round button per choice, for choices that need a line of text. */
41
+ export function ListChoice({ name, value, options, disabled, label, onChange, }) {
42
+ return (_jsx("div", { className: "grid gap-2", children: options.map((option) => {
43
+ const on = value === option;
44
+ const shut = disabled.has(option);
45
+ return (_jsxs("label", { className: cn("flex min-h-11 cursor-pointer items-center gap-3 rounded-xl border px-4 py-2.5 text-[0.9375rem] transition", on ? "border-ember bg-ember-tint text-ink" : "border-input bg-card text-ink-2", shut ? "pointer-events-none opacity-60 line-through" : "hover:border-ink-4"), children: [_jsx("input", { type: "radio", name: name, checked: on, disabled: shut, onChange: () => onChange(option), className: "size-[1.125rem] shrink-0 appearance-none rounded-full border border-input bg-card transition-[border] checked:border-[0.3rem] checked:border-ember" }), _jsx("span", { children: label(option) })] }, option));
46
+ }) }));
47
+ }
@@ -0,0 +1,5 @@
1
+ /** Markdown a model or an author wrote, as HTML that DOMPurify cleaned. */
2
+ export declare function Markdown({ text, className }: {
3
+ text: string;
4
+ className?: string;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // SPDX-License-Identifier: MIT
3
+ import DOMPurify from "dompurify";
4
+ import { marked } from "marked";
5
+ import { useMemo } from "react";
6
+ import { cn } from "./ui.js";
7
+ /** Markdown a model or an author wrote, as HTML that DOMPurify cleaned. */
8
+ export function Markdown({ text, className }) {
9
+ const html = useMemo(() => DOMPurify.sanitize(marked.parse(text, { async: false })), [text]);
10
+ return (_jsx("div", { className: cn("prose-zen", className), dangerouslySetInnerHTML: { __html: html } }));
11
+ }