@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,84 @@
1
+ /** What runs open models on a computer. */
2
+ export declare const SERVER_IDS: readonly ["ollama", "lmstudio", "mlx"];
3
+ export type ServerId = (typeof SERVER_IDS)[number];
4
+ /** A model a server holds, as the server describes it. */
5
+ export interface InstalledModel {
6
+ name: string;
7
+ /** On disk, in bytes: about the memory it takes while it answers, too. */
8
+ size: number;
9
+ digest: string;
10
+ /** `completion`, `tools`, `vision`, `thinking`, `audio`, `embedding`, `decision`, … */
11
+ capabilities: string[];
12
+ /** It writes text. */
13
+ completion: boolean;
14
+ /** It takes tools. */
15
+ tools: boolean;
16
+ /** It takes pictures. */
17
+ vision: boolean;
18
+ /** It can think before it answers. */
19
+ thinking: boolean;
20
+ /** `mlx` or `llamacpp`; null where the server does not say. */
21
+ runner: string | null;
22
+ quantization: string | null;
23
+ /** In memory right now. */
24
+ running: boolean;
25
+ }
26
+ /**
27
+ * Why a server that is there gives nothing away: it wants a token (`locked`), or it is older than
28
+ * the API this package speaks (`old`).
29
+ */
30
+ export type ServerTrouble = "locked" | "old";
31
+ export interface ServerState {
32
+ /** It answers at the address. */
33
+ running: boolean;
34
+ /** Null where the server does not say. */
35
+ version: string | null;
36
+ /** The names of the models it holds. */
37
+ models: string[];
38
+ trouble: ServerTrouble | null;
39
+ }
40
+ export interface ServerOptions {
41
+ /** Another fetch, such as a test's. */
42
+ fetch?: typeof fetch;
43
+ }
44
+ /**
45
+ * A server on a computer that runs open models, through its own API. Nothing but `ask` loads a
46
+ * model.
47
+ */
48
+ export interface LocalServer {
49
+ id: ServerId;
50
+ /** The product name, as the person knows it. */
51
+ name: string;
52
+ /** Where it answers for this process, when nothing names another address; MLX: its models' folder. */
53
+ address(env?: NodeJS.ProcessEnv): string;
54
+ state(url: string, options?: ServerOptions): Promise<ServerState>;
55
+ /** The models it holds; empty where it does not answer. */
56
+ models(url: string, options?: ServerOptions): Promise<InstalledModel[]>;
57
+ /** Downloads a model; `onProgress` hears the bytes so far and in all. Rejects with the server's reason. */
58
+ download(url: string, model: string, onProgress: (done: number, total: number) => void, options?: ServerOptions & {
59
+ signal?: AbortSignal;
60
+ }): Promise<void>;
61
+ /** Removes a model; absent where the server's API does not. Rejects with the server's reason. */
62
+ remove?(url: string, model: string, options?: ServerOptions): Promise<void>;
63
+ /** One short answer of a model, which loads it. Rejects with the server's reason. */
64
+ ask(url: string, model: InstalledModel, prompt: string, options?: ServerOptions & {
65
+ signal?: AbortSignal;
66
+ }): Promise<string>;
67
+ }
68
+ /** The JSON of a request; null where nothing answers, or not with 200. */
69
+ export declare function getJson<T>(doFetch: typeof fetch, url: string, init?: RequestInit, timeoutMs?: number): Promise<T | null>;
70
+ /** A JSON request's parts. */
71
+ export declare function jsonBody(body: unknown): {
72
+ headers: Record<string, string>;
73
+ body: string;
74
+ };
75
+ /** What a server said as it refused: its `error`, in any of the spellings, else the text. */
76
+ export declare function refusal(res: Response, name: string): Promise<Error>;
77
+ /**
78
+ * Whether a model fits a computer: it takes at most `share` of the memory, and leaves the rest to
79
+ * everything else that runs there. Size and memory in the same unit; the model's size on disk
80
+ * is about what it takes while it answers.
81
+ */
82
+ export declare function fits(model: number | {
83
+ size: number;
84
+ }, memory: number, share: number): boolean;
@@ -0,0 +1,38 @@
1
+ /** What runs open models on a computer. */
2
+ export const SERVER_IDS = ["ollama", "lmstudio", "mlx"];
3
+ /** The JSON of a request; null where nothing answers, or not with 200. */
4
+ export async function getJson(doFetch, url, init, timeoutMs = 2000) {
5
+ try {
6
+ const res = await doFetch(url, { ...init, signal: AbortSignal.timeout(timeoutMs) });
7
+ return res.ok ? (await res.json()) : null;
8
+ }
9
+ catch {
10
+ return null;
11
+ }
12
+ }
13
+ /** A JSON request's parts. */
14
+ export function jsonBody(body) {
15
+ return { headers: { "content-type": "application/json" }, body: JSON.stringify(body) };
16
+ }
17
+ /** What a server said as it refused: its `error`, in any of the spellings, else the text. */
18
+ export async function refusal(res, name) {
19
+ const text = (await res.text().catch(() => "")).trim();
20
+ let said = text;
21
+ try {
22
+ const { error } = JSON.parse(text);
23
+ said = (typeof error === "string" ? error : error?.message) ?? text;
24
+ }
25
+ catch {
26
+ // the text as it came
27
+ }
28
+ return new Error(said.slice(0, 400) || `${name} answered ${res.status}.`);
29
+ }
30
+ /**
31
+ * Whether a model fits a computer: it takes at most `share` of the memory, and leaves the rest to
32
+ * everything else that runs there. Size and memory in the same unit; the model's size on disk
33
+ * is about what it takes while it answers.
34
+ */
35
+ export function fits(model, memory, share) {
36
+ const size = typeof model === "number" ? model : model.size;
37
+ return size <= memory * share;
38
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@engenty/local-models",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./dist/index.js",
8
+ "./ollama": "./dist/ollama/index.js",
9
+ "./lmstudio": "./dist/lmstudio/index.js",
10
+ "./mlx": "./dist/mlx/index.js",
11
+ "./servers": "./dist/servers/index.js",
12
+ "./clients": "./dist/clients/index.js",
13
+ "./probe": "./dist/probe.js",
14
+ "./bridge": "./dist/bridge/index.js"
15
+ }
16
+ }
@@ -0,0 +1,36 @@
1
+ /** How the setup installs an AI client: with npm into the host's own prefix, or by the vendor's script. */
2
+ export type ClientInstall = {
3
+ kind: "npm";
4
+ pkg: string;
5
+ }
6
+ /** `url` for `curl | bash`; `windows` for PowerShell's `irm | iex`. */
7
+ | {
8
+ kind: "script";
9
+ url: string;
10
+ windows: string;
11
+ };
12
+ export declare const CLIENT_IDS: readonly ["codex", "claude", "antigravity", "cursor"];
13
+ export type ClientId = (typeof CLIENT_IDS)[number];
14
+ /** An AI client the setup offers. */
15
+ export interface ClientEntry {
16
+ id: ClientId;
17
+ name: string;
18
+ /** The name with its provider, where a list shows it: "Anthropic Claude Code". */
19
+ label: string;
20
+ bin: string;
21
+ /** The subscription it answers on. */
22
+ account: string;
23
+ install: ClientInstall;
24
+ /** The vendor's desktop app: on this computer, the person most likely has the subscription. */
25
+ app?: string;
26
+ }
27
+ /** The AI clients an app can think with, in the order the setup offers them. */
28
+ export declare const CLIENTS: readonly ClientEntry[];
29
+ export declare function clientEntry(id: string): ClientEntry | null;
30
+ /**
31
+ * The command the setup runs for a client, as the person would type it (PowerShell on Windows).
32
+ * `folder`: npm's prefix, where the host keeps the clients it installs.
33
+ */
34
+ export declare function installCommand(client: ClientEntry, folder: string, platform: string): string;
35
+ /** PowerShell, for a command written for it: without the person's profile, scripts allowed. */
36
+ export declare const POWERSHELL: string[];
@@ -0,0 +1,81 @@
1
+ export const CLIENT_IDS = ["codex", "claude", "antigravity", "cursor"];
2
+ /** The AI clients an app can think with, in the order the setup offers them. */
3
+ export const CLIENTS = [
4
+ {
5
+ id: "codex",
6
+ name: "Codex",
7
+ label: "OpenAI Codex",
8
+ bin: "codex",
9
+ account: "ChatGPT",
10
+ install: { kind: "npm", pkg: "@openai/codex" },
11
+ app: "ChatGPT",
12
+ },
13
+ {
14
+ id: "claude",
15
+ name: "Claude Code",
16
+ label: "Anthropic Claude Code",
17
+ bin: "claude",
18
+ account: "Claude",
19
+ install: {
20
+ kind: "script",
21
+ url: "https://claude.ai/install.sh",
22
+ windows: "https://claude.ai/install.ps1",
23
+ },
24
+ app: "Claude",
25
+ },
26
+ {
27
+ id: "antigravity",
28
+ name: "Antigravity",
29
+ label: "Google Antigravity",
30
+ bin: "agy",
31
+ account: "Google AI",
32
+ install: {
33
+ kind: "script",
34
+ url: "https://antigravity.google/cli/install.sh",
35
+ windows: "https://antigravity.google/cli/install.ps1",
36
+ },
37
+ app: "Antigravity",
38
+ },
39
+ {
40
+ id: "cursor",
41
+ name: "Cursor Agent",
42
+ label: "Cursor Agent",
43
+ bin: "cursor-agent",
44
+ account: "Cursor",
45
+ install: {
46
+ kind: "script",
47
+ url: "https://cursor.com/install",
48
+ windows: "https://cursor.com/install?win32=true",
49
+ },
50
+ app: "Cursor",
51
+ },
52
+ ];
53
+ export function clientEntry(id) {
54
+ return CLIENTS.find((client) => client.id === id) ?? null;
55
+ }
56
+ /** A word for the shell: quoted when it holds anything but plain characters. */
57
+ const shellWord = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
58
+ /** A word for PowerShell: in single quotes, which take everything but a single quote as it is. */
59
+ const powershellWord = (word) => /^[\w@%+=:,./\\-]+$/.test(word) ? word : `'${word.replaceAll("'", "''")}'`;
60
+ /**
61
+ * The command the setup runs for a client, as the person would type it (PowerShell on Windows).
62
+ * `folder`: npm's prefix, where the host keeps the clients it installs.
63
+ */
64
+ export function installCommand(client, folder, platform) {
65
+ const windows = platform === "win32";
66
+ if (client.install.kind === "npm") {
67
+ const prefix = windows ? powershellWord(folder) : shellWord(folder);
68
+ return `npm install --global --prefix ${prefix} ${client.install.pkg}`;
69
+ }
70
+ return windows
71
+ ? `irm ${powershellWord(client.install.windows)} | iex`
72
+ : `curl -fsSL ${client.install.url} | bash`;
73
+ }
74
+ /** PowerShell, for a command written for it: without the person's profile, scripts allowed. */
75
+ export const POWERSHELL = [
76
+ "powershell.exe",
77
+ "-NoProfile",
78
+ "-ExecutionPolicy",
79
+ "Bypass",
80
+ "-Command",
81
+ ];
@@ -0,0 +1,3 @@
1
+ export { CLIENT_IDS, CLIENTS, type ClientEntry, type ClientId, type ClientInstall, clientEntry, installCommand, POWERSHELL, } from "./catalog.js";
2
+ export { OFFERED_MODELS } from "./offered.js";
3
+ export { type ClientSetupStatus, type HeldModel, type LocalModelsState, MODEL_JOBS, type ModelDownload, type ModelJob, type OfferedModel, type ServerStatus, type TerminalEvent, } from "./types.js";
@@ -0,0 +1,3 @@
1
+ export { CLIENT_IDS, CLIENTS, clientEntry, installCommand, POWERSHELL, } from "./catalog.js";
2
+ export { OFFERED_MODELS } from "./offered.js";
3
+ export { MODEL_JOBS, } from "./types.js";
@@ -0,0 +1,7 @@
1
+ import type { ServerId } from "@engenty/local-models/servers";
2
+ import type { OfferedModel } from "./types.js";
3
+ /**
4
+ * Models that write, by the server that runs them, for a host that asks no one for a list. The
5
+ * first that fits the computer is the one the setup suggests.
6
+ */
7
+ export declare const OFFERED_MODELS: Record<ServerId, readonly OfferedModel[]>;
@@ -0,0 +1,64 @@
1
+ const NOTES = {
2
+ qwen: {
3
+ en: "Writes, researches and uses tools well; for a Mac with 32 GB or more.",
4
+ de: "Schreibt, recherchiert und nutzt Werkzeuge gut; für einen Mac mit 32 GB oder mehr.",
5
+ },
6
+ gemmaLarge: {
7
+ en: "Google’s larger Gemma 4; reads images too.",
8
+ de: "Googles größeres Gemma 4; liest auch Bilder.",
9
+ },
10
+ gemma: {
11
+ en: "Enough for short texts and sorting; for a Mac with 16 GB.",
12
+ de: "Reicht für kurze Texte und Einordnen; für einen Mac mit 16 GB.",
13
+ },
14
+ small: {
15
+ en: "Small, with tools; for short answers on any Mac.",
16
+ de: "Klein, mit Werkzeugen; für kurze Antworten auf jedem Mac.",
17
+ },
18
+ gemmaSmall: {
19
+ en: "Small and quick; for short answers.",
20
+ de: "Klein und schnell; für kurze Antworten.",
21
+ },
22
+ };
23
+ /**
24
+ * Models that write, by the server that runs them, for a host that asks no one for a list. The
25
+ * first that fits the computer is the one the setup suggests.
26
+ */
27
+ export const OFFERED_MODELS = {
28
+ ollama: [
29
+ { name: "qwen3.8:27b", job: "text", size: 17.7, memory: 22, note: NOTES.qwen },
30
+ { name: "gemma4:26b", job: "text", size: 18.7, memory: 22, note: NOTES.gemmaLarge },
31
+ { name: "gemma4:12b", job: "text", size: 8, memory: 11, note: NOTES.gemma },
32
+ { name: "gemma4:e4b", job: "text", size: 6.6, memory: 8, note: NOTES.gemmaSmall },
33
+ ],
34
+ lmstudio: [
35
+ { name: "qwen/qwen3.8-27b", job: "text", size: 16, memory: 20, note: NOTES.qwen },
36
+ { name: "google/gemma-4-26b-a4b", job: "text", size: 16, memory: 20, note: NOTES.gemmaLarge },
37
+ { name: "google/gemma-4-12b", job: "text", size: 7, memory: 10, note: NOTES.gemma },
38
+ { name: "google/gemma-4-e4b", job: "text", size: 6, memory: 8, note: NOTES.gemmaSmall },
39
+ ],
40
+ mlx: [
41
+ {
42
+ name: "mlx-community/Qwen3.8-27B-4bit",
43
+ job: "text",
44
+ size: 16.1,
45
+ memory: 20,
46
+ note: NOTES.qwen,
47
+ },
48
+ {
49
+ name: "mlx-community/gemma-4-26b-a4b-it-4bit",
50
+ job: "text",
51
+ size: 15.4,
52
+ memory: 19,
53
+ note: NOTES.gemmaLarge,
54
+ },
55
+ {
56
+ name: "mlx-community/gemma-4-12b-it-4bit",
57
+ job: "text",
58
+ size: 6.8,
59
+ memory: 10,
60
+ note: NOTES.gemma,
61
+ },
62
+ { name: "mlx-community/Qwen3-4B-4bit", job: "text", size: 2.3, memory: 5, note: NOTES.small },
63
+ ],
64
+ };
@@ -0,0 +1,46 @@
1
+ import { type ClientId } from "../catalog.js";
2
+ import type { ClientSetupStatus } from "../types.js";
3
+ import type { SetupChoice } from "./columns.js";
4
+ /** What a test call came to. */
5
+ export interface TestResult {
6
+ ok: boolean;
7
+ ref?: string;
8
+ reply?: string;
9
+ error?: string;
10
+ ms: number;
11
+ }
12
+ /**
13
+ * One short call, as the app would make it; the answer shows the way is open. `auto`: the call
14
+ * is made right away, as the setup tests by itself once a source is ready.
15
+ */
16
+ export declare function ModelTest({ auto }: {
17
+ auto?: boolean;
18
+ }): import("react").JSX.Element;
19
+ /**
20
+ * Installed clients first, and among each, the one whose app is on this computer; else in the
21
+ * catalog's order.
22
+ */
23
+ export declare function rankClients<T extends Pick<ClientSetupStatus<ClientId>, "id" | "version" | "app">>(clients: readonly T[]): T[];
24
+ /**
25
+ * The clients the list opens with: those signed in. Where none is, those installed; where none is
26
+ * either, the first. The others are among the rest.
27
+ */
28
+ export declare function foundClients<T extends Pick<ClientSetupStatus<ClientId>, "id" | "version" | "app" | "auth">>(clients: readonly T[]): T[];
29
+ /** The clients as rows of the list, the first one recommended. */
30
+ export declare function useClientChoices(clients: readonly ClientSetupStatus<ClientId>[]): SetupChoice[];
31
+ /** Where a client stands: its step, and what to do now. */
32
+ export declare function useClientStage(client: ClientSetupStatus | undefined, works: boolean): {
33
+ stage: number;
34
+ heading: string;
35
+ };
36
+ /**
37
+ * One AI client on this computer: found with its version, how it is signed in, the sign-in
38
+ * itself in a terminal, and the test call. The setup and the settings both show it.
39
+ */
40
+ export declare function ClientPanel({ client, autoTest, hint, }: {
41
+ client: ClientSetupStatus<ClientId>;
42
+ /** Make the test call without a click as soon as the client is signed in. */
43
+ autoTest?: boolean;
44
+ /** What the app does with it; the package's own line when none is given. */
45
+ hint?: string;
46
+ }): import("react").JSX.Element;
@@ -0,0 +1,147 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, cn } from "@engenty/chatviews/react/ui";
3
+ import { Check, RefreshCw } from "lucide-react";
4
+ import { lazy, Suspense, useEffect, useRef, useState } from "react";
5
+ import { CLIENT_IDS } from "../catalog.js";
6
+ import { useCall, useSetupHost, useText } from "./host.js";
7
+ // The terminal is big and rarely needed: it loads when one opens.
8
+ const Terminal = lazy(() => import("./terminal.js"));
9
+ /**
10
+ * One short call, as the app would make it; the answer shows the way is open. `auto`: the call
11
+ * is made right away, as the setup tests by itself once a source is ready.
12
+ */
13
+ export function ModelTest({ auto = false }) {
14
+ const host = useSetupHost();
15
+ const t = useText();
16
+ const test = useCall(async () => {
17
+ const result = await host.post("/models/test", {});
18
+ // A working call ends the setup: the page learns it.
19
+ if (result.ok) {
20
+ await host.changed();
21
+ }
22
+ return result;
23
+ });
24
+ const { run } = test;
25
+ const started = useRef(false);
26
+ useEffect(() => {
27
+ if (auto && !started.current) {
28
+ started.current = true;
29
+ void run();
30
+ }
31
+ }, [auto, run]);
32
+ const r = test.data;
33
+ const failed = test.error ?? (r && !r.ok ? (r.error ?? "") : undefined);
34
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("p", { className: "text-[0.8125rem] text-ink-3", children: t("local.testHint") }), _jsx("div", { children: _jsx(Button, { variant: "secondary", busy: test.busy, onClick: () => void run(), children: t("local.test") }) }), r?.ok ? (_jsxs("p", { className: "flex items-start gap-2 text-[0.875rem] text-ink-2", children: [_jsx(Check, { className: "mt-0.5 size-4 shrink-0 text-moss" }), _jsx("span", { children: t("local.testOk", {
35
+ s: (r.ms / 1000).toFixed(1),
36
+ ref: r.ref ?? "",
37
+ reply: r.reply ?? "",
38
+ }) })] })) : null, failed !== undefined ? (_jsx("p", { className: "text-[0.875rem] text-rose", children: t("local.testFailed", { error: failed }) })) : null] }));
39
+ }
40
+ /**
41
+ * Installed clients first, and among each, the one whose app is on this computer; else in the
42
+ * catalog's order.
43
+ */
44
+ export function rankClients(clients) {
45
+ const rank = (c) => (c.version === null ? 2 : 0) + (c.app ? 0 : 1);
46
+ return [...clients].sort((a, b) => rank(a) - rank(b) || CLIENT_IDS.indexOf(a.id) - CLIENT_IDS.indexOf(b.id));
47
+ }
48
+ /**
49
+ * The clients the list opens with: those signed in. Where none is, those installed; where none is
50
+ * either, the first. The others are among the rest.
51
+ */
52
+ export function foundClients(clients) {
53
+ const ranked = rankClients(clients);
54
+ const signedIn = ranked.filter((c) => c.version !== null && c.auth !== "none");
55
+ if (signedIn.length) {
56
+ return signedIn;
57
+ }
58
+ const installed = ranked.filter((c) => c.version !== null);
59
+ return installed.length ? installed : ranked.slice(0, 1);
60
+ }
61
+ /** The clients as rows of the list, the first one recommended. */
62
+ export function useClientChoices(clients) {
63
+ const t = useText();
64
+ const found = foundClients(clients);
65
+ return rankClients(clients).map((client) => ({
66
+ id: client.id,
67
+ title: client.label,
68
+ description: t(`harness.desc.${client.id}`),
69
+ ...(client === found[0] ? { badge: t("setup.recommended") } : {}),
70
+ ...(found.includes(client) ? {} : { more: true }),
71
+ ...(client.version === null
72
+ ? { note: t("harness.notInstalled") }
73
+ : client.auth === "none"
74
+ ? { note: t("harness.signedOut") }
75
+ : client.auth === "subscription"
76
+ ? { note: t("harness.ready") }
77
+ : {}),
78
+ }));
79
+ }
80
+ /** Where a client stands: its step, and what to do now. */
81
+ export function useClientStage(client, works) {
82
+ const t = useText();
83
+ if (works) {
84
+ return { stage: 2, heading: t("setup.h.done") };
85
+ }
86
+ if (!client) {
87
+ return { stage: 1, heading: t("setup.h.test") };
88
+ }
89
+ if (client.version === null) {
90
+ return { stage: 0, heading: t("setup.h.install", { name: client.name }) };
91
+ }
92
+ return client.auth === "none"
93
+ ? { stage: 0, heading: t("setup.h.signIn", { name: client.name }) }
94
+ : { stage: 1, heading: t("setup.h.test") };
95
+ }
96
+ /**
97
+ * One AI client on this computer: found with its version, how it is signed in, the sign-in
98
+ * itself in a terminal, and the test call. The setup and the settings both show it.
99
+ */
100
+ export function ClientPanel({ client, autoTest = false, hint, }) {
101
+ const host = useSetupHost();
102
+ const t = useText();
103
+ const { id } = client;
104
+ // The terminal runs the install or the sign-in; one of them at a time.
105
+ const [terminal, setTerminal] = useState(null);
106
+ const [ended, setEnded] = useState(null);
107
+ const recheck = useCall(async () => {
108
+ await host.post(`/harness/${id}/detect`);
109
+ await host.changed();
110
+ });
111
+ const open = async (job) => {
112
+ const started = await host.post(`/harness/${id}/${job}`, {
113
+ cols: 100,
114
+ rows: 24,
115
+ });
116
+ setTerminal({ id: started.terminal, job });
117
+ setEnded(null);
118
+ };
119
+ const install = useCall(() => open("install"));
120
+ const login = useCall(() => open("login"));
121
+ const signedIn = client.auth === "subscription";
122
+ const installed = client.version !== null;
123
+ // What the terminal was for is there and its command is over: it has done its job.
124
+ useEffect(() => {
125
+ if (ended !== null && (terminal?.job === "install" ? installed : signedIn)) {
126
+ setTerminal(null);
127
+ }
128
+ }, [signedIn, installed, ended, terminal?.job]);
129
+ const sub = t(`harness.sub.${id}`);
130
+ const again = (_jsxs(Button, { variant: "ghost", size: "sm", busy: recheck.busy, onClick: () => void recheck.run(), children: [_jsx(RefreshCw, { className: "size-3.5" }), " ", t("local.recheck")] }));
131
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx("p", { className: "text-[0.8125rem] text-ink-3", children: hint ??
132
+ t(client.images ? "harness.hintImages" : "harness.hint", { name: client.name, sub }) }), installed ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("p", { className: "flex items-center gap-2 text-[0.875rem] text-ink-2", children: [_jsx(Check, { className: "size-4 text-moss" }), t("harness.found", { name: client.name, version: client.version ?? "" })] }), _jsx("p", { className: cn("text-[0.8125rem]", signedIn ? "text-ink-3" : "text-rose"), children: signedIn
133
+ ? t("harness.authSubscription", { sub })
134
+ : client.auth === "api_key"
135
+ ? t("harness.authKey", { sub })
136
+ : t("harness.authNone") }), signedIn || terminal ? null : (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Button, { busy: login.busy, onClick: () => void login.run(), children: t("harness.signIn") }), again] })), login.error ? _jsx("p", { className: "text-[0.8125rem] text-rose", children: login.error }) : null] })) : (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("p", { className: "text-[0.875rem] text-rose", children: t("harness.missing", { name: client.name }) }), client.app ? (_jsx("p", { className: "text-[0.8125rem] text-ink-3", children: t("harness.appHere", { app: client.app, name: client.name, sub }) })) : null, terminal ? null : (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Button, { busy: install.busy, onClick: () => void install.run(), children: t("harness.installButton", { name: client.name }) }), again] })), install.error ? _jsx("p", { className: "text-[0.8125rem] text-rose", children: install.error }) : null, _jsxs("p", { className: "text-[0.8125rem] text-ink-3", children: [t("harness.install"), " ", _jsx("code", { className: "rounded bg-paper px-1.5 py-0.5 font-mono text-[0.75rem] text-ink-2", children: client.install })] })] })), terminal ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("p", { className: "text-[0.8125rem] text-ink-3", children: terminal.job === "install"
137
+ ? t("harness.installing", { name: client.name })
138
+ : client.interactiveLogin
139
+ ? t("harness.signInInteractive", { name: client.name, sub })
140
+ : t("harness.signingIn") }), _jsx(Suspense, { fallback: _jsx("div", { className: "h-[28rem] max-h-[60dvh] rounded-lg bg-[#0f1424]" }), children: _jsx(Terminal, { id: terminal.id, onDone: () => void recheck.run(), onExit: (code) => {
141
+ setEnded(code);
142
+ void recheck.run();
143
+ } }, terminal.id) }), _jsx("div", { className: "flex flex-wrap items-center gap-2", children: ended === null ? (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
144
+ void host.del(`/terminal/${terminal.id}`).catch(() => undefined);
145
+ setTerminal(null);
146
+ }, children: t("setup.cancel") })) : (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setTerminal(null), children: t("setup.close") }), terminal.job === "install" ? (installed ? null : (_jsx("span", { className: "text-[0.8125rem] text-rose", children: t("harness.installEnded", { name: client.name }) }))) : signedIn ? null : (_jsx("span", { className: "text-[0.8125rem] text-rose", children: t("harness.loginEnded", { name: client.name }) }))] })) })] })) : null, installed ? (_jsx(ModelTest, { auto: autoTest && client.auth !== "none" }, `${id}:${client.auth}`)) : null] }));
147
+ }
@@ -0,0 +1,78 @@
1
+ import { type ReactNode } from "react";
2
+ /** One thing an app can think with, as a row of the list. */
3
+ export interface SetupChoice {
4
+ id: string;
5
+ title: string;
6
+ description: string;
7
+ /** Set on the row's edge: the choice the setup recommends. */
8
+ badge?: string;
9
+ /** How the choice stands right now, at the row's end. */
10
+ note?: string;
11
+ /** It cannot answer as it is: shown once the person asks for more. */
12
+ more?: boolean;
13
+ }
14
+ export declare function Choice({ choice, selected, onPick, }: {
15
+ choice: SetupChoice;
16
+ selected: boolean;
17
+ onPick: () => void;
18
+ }): import("react").JSX.Element;
19
+ /**
20
+ * Where the setup stands: what is chosen, its steps by name, then one dash per step. A step
21
+ * reached is green and checked, the one to do now amber, the ones ahead dim. The dashes fill
22
+ * like a strength meter: as many as the step the setup is on, amber on the way, all green once
23
+ * it works.
24
+ */
25
+ export declare function Stages({ name, at, done }: {
26
+ name: string;
27
+ at: number;
28
+ done: boolean;
29
+ }): import("react").JSX.Element;
30
+ /** The opened choice: what it is, where it stands, and what it needs. */
31
+ export interface SetupPanel {
32
+ name: string;
33
+ heading: string;
34
+ /** The step it is on: connect, test, done. */
35
+ stage: number;
36
+ works: boolean;
37
+ /** A figure on the box's corner; the heading keeps clear of it. */
38
+ figure?: ReactNode;
39
+ content: ReactNode;
40
+ /** Below the box: what goes on from here. */
41
+ footer?: ReactNode;
42
+ }
43
+ /**
44
+ * The setup: first only the question what the app thinks with, in the middle of the page. A
45
+ * choice steps the list aside and opens what that choice needs (the sign-in, the keys, the test
46
+ * call), its rows level with the list's.
47
+ */
48
+ export declare function SetupColumns({ eyebrow, title, sub, figure, top, divider, choices, selected, marked, onPick, recheck, panel, hidden, }: {
49
+ eyebrow?: string;
50
+ title: string;
51
+ sub: string;
52
+ /** A figure that stands beside the choices while none is opened, small above them on a narrow page. */
53
+ figure?: ReactNode;
54
+ /** Above the choices: an account. A choice in it is picked with `pick`. */
55
+ top?: (pick: (id: string) => void) => ReactNode;
56
+ /** A line between what is above and the choices. */
57
+ divider?: {
58
+ label: string;
59
+ note: string;
60
+ };
61
+ choices: readonly SetupChoice[];
62
+ /** The choice in effect; null: none yet. */
63
+ selected: string | null;
64
+ /** The row that is lit: the one just clicked, at once; else the one in effect. */
65
+ marked: string | null;
66
+ onPick: (id: string) => Promise<unknown> | unknown;
67
+ /** Looks at the clients again; `note`: said beside it. */
68
+ recheck?: {
69
+ busy: boolean;
70
+ run: () => void;
71
+ note?: string | null;
72
+ };
73
+ panel: SetupPanel | null;
74
+ /** Something else stands in its place. */
75
+ hidden?: boolean;
76
+ }): import("react").JSX.Element;
77
+ /** Said once the test worked, above the way on. */
78
+ export declare function SetupReady(): import("react").JSX.Element;