@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
@@ -2,10 +2,10 @@ import { spawn } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
3
  import { readFile, rm, stat } from "node:fs/promises";
4
4
  import { isAbsolute, join, normalize } from "node:path";
5
+ import { CLAUDE_BIN, CLIENTS, resolveEnv } from "@engenty/local-models/clients";
5
6
  import { MOTION_SIZES, textClassOf, } from "@engenty/wizards-shared/definition";
6
7
  import { note as runNote } from "@engenty/wizards-shared/run";
7
8
  import { StepError } from "../engine/types.js";
8
- import { CLAUDE_BIN, claudeEnv } from "../harness/claude.js";
9
9
  import { failureOf } from "../harness/model.js";
10
10
  import { openBridge } from "../mcp/bridge.js";
11
11
  import { saidOf } from "../model-errors.js";
@@ -160,7 +160,7 @@ export async function runMotionGraphicsStep(step, ctx) {
160
160
  void (async () => {
161
161
  const child = spawn(CLAUDE_BIN, args, {
162
162
  cwd: root,
163
- env: await claudeEnv(),
163
+ env: (await resolveEnv(CLIENTS.claude)).env,
164
164
  stdio: ["pipe", "pipe", "pipe"],
165
165
  signal: limit,
166
166
  });
@@ -87,8 +87,11 @@ Status, recent events, outputs (text clipped) with signed download links valid o
87
87
  <!-- section: tool.show_wizard -->
88
88
  Show a wizard as its flow diagram: its pages, AI steps, reviews and branches. The published version when there is one, else the draft. Also returns the steps as text.
89
89
 
90
+ <!-- section: tool.wizard_run -->
91
+ Runs one of the space's published wizards as the person, with answers for its first page (field ids from waitingFor). Then follow waitingFor until the run is done: form → ask the person the fields with inChat=true, answer_form (other fields: the run page at browserUrl); review → show the outputs, review_step; ask → answer_ask after the person said; question → answer_question in their words. While status is running, get_run with waitSeconds. Hosts with MCP Apps show the run as a widget the person answers in.
92
+
90
93
  <!-- section: tool.run_wizard -->
91
- Start a run of a published wizard for the person, here in the chat. Spends credits like any run.
94
+ For the wizard's author: try the published version. To use a space's wizard, wizard_run. Start a run of a published wizard for the person, here in the chat. Spends credits like any run.
92
95
  Start it right away — no show_wizard first: the widget shows the wizard's pages and the person can answer there. What the person already said goes to the first page with answer_form, using the field ids in waitingFor. Then follow waitingFor:
93
96
  - form: ask the person for the fields with inChat=true, in order, answer_form; fields with inChat=false (files, recordings, signatures) need the run page at browserUrl. A field with a when is asked only while its condition holds on the answers so far (shown says so for what is known now); fields the wizard decided against are not listed
94
97
  - review: show the outputs, then review_step
@@ -1,5 +1,5 @@
1
+ import { shapeOfSchema } from "@engenty/chatviews/shape";
1
2
  import { asAgent, formatsFor, isDataStep, widgetSize, } from "@engenty/wizards-shared/definition";
2
- import { shapeOfSchema } from "@engenty/wizards-shared/shape";
3
3
  import { listAsMarkdown } from "@engenty/wizards-shared/store";
4
4
  import { and, eq } from "drizzle-orm";
5
5
  import { zipSync } from "fflate";
@@ -1,4 +1,4 @@
1
- import { labelOf, titleKey, } from "@engenty/wizards-shared/shape";
1
+ import { labelOf, titleKey, } from "@engenty/chatviews/shape";
2
2
  const isEntry = (v) => Boolean(v) && typeof v === "object" && !Array.isArray(v);
3
3
  /** A value that fits in a cell or a line: no lists of entries, no objects. */
4
4
  const flat = (s) => s.kind !== "object" && s.kind !== "table" && !(s.kind === "list" && s.of.kind === "object");
@@ -0,0 +1,77 @@
1
+ import { join } from "node:path";
2
+ import { setupRoutes, Terminals, Tested } from "@engenty/model-setup/server";
3
+ import { MODEL_CLASSES, TEXT_CLASSES } from "@engenty/wizards-shared/definition";
4
+ import { note } from "@engenty/wizards-shared/run";
5
+ import { generateText } from "ai";
6
+ import { z } from "zod";
7
+ import { env } from "../env.js";
8
+ import { clientSetup, HARNESS_IDS } from "../harness/index.js";
9
+ import { localServers } from "../local-models.js";
10
+ import { DECISION_CHOICES, EMBEDDING_CHOICES, LOCAL_KEYS, localModelSettings, saveLocalModels, setUpKey, setUpServer, textModel, } from "../models.js";
11
+ import { ServiceError } from "../services/errors.js";
12
+ import { readSetting, writeSetting } from "../settings.js";
13
+ import { requestLang } from "./lang.js";
14
+ /**
15
+ * The setup of a runtime that runs alone (@engenty/model-setup): its clients, its keys and
16
+ * models, and the call that ends it.
17
+ */
18
+ /** What a page may change of the models. */
19
+ export const modelsInput = z.object({
20
+ source: z.enum([...HARNESS_IDS, "account", "own"]).optional(),
21
+ bindings: z.partialRecord(z.enum(MODEL_CLASSES), z.string().max(160)).optional(),
22
+ ollamaUrl: z.string().max(200).optional(),
23
+ lmstudioUrl: z.string().max(200).optional(),
24
+ creditFallback: z.boolean().optional(),
25
+ decision: z.enum(DECISION_CHOICES).optional(),
26
+ embedding: z.enum(EMBEDDING_CHOICES).optional(),
27
+ decisionLocal: z.string().max(120).optional(),
28
+ embeddingLocal: z.string().max(120).optional(),
29
+ keys: z.partialRecord(z.enum(LOCAL_KEYS), z.string().max(400)).optional(),
30
+ });
31
+ /** The model sources a test call has worked on: the setup is done for those, not for the others. */
32
+ export const testedSources = new Tested({
33
+ async read() {
34
+ const tested = await readSetting("setup-done");
35
+ return Array.isArray(tested) ? tested : [];
36
+ },
37
+ write: (sources) => writeSetting("setup-done", sources),
38
+ });
39
+ export const localSetup = setupRoutes({
40
+ clients: clientSetup,
41
+ terminals: new Terminals(),
42
+ workDir: () => join(env.dataDir, "harness"),
43
+ tested: testedSources,
44
+ servers: localServers,
45
+ models: {
46
+ source: () => localModelSettings().source,
47
+ settings: () => localModelSettings(),
48
+ save: async (_c, body) => {
49
+ await saveLocalModels(modelsInput.parse(body));
50
+ },
51
+ classes: TEXT_CLASSES,
52
+ async test(cls) {
53
+ const resolved = await textModel(cls);
54
+ const result = await generateText({
55
+ model: resolved.model,
56
+ prompt: "Reply with the single word: OK",
57
+ maxOutputTokens: 20,
58
+ abortSignal: AbortSignal.timeout(120_000),
59
+ });
60
+ return { ref: resolved.ref, text: result.text };
61
+ },
62
+ providers: LOCAL_KEYS,
63
+ key: (c, provider, key) => setUpKey(provider, key, requestLang(c)),
64
+ server: (c, id, url) => setUpServer(id, url, requestLang(c)),
65
+ },
66
+ });
67
+ /** A terminal that does not serve, as the person reads it. */
68
+ export function terminalRefused(err) {
69
+ switch (err.code) {
70
+ case "gone":
71
+ return new ServiceError("not_found", note("terminalNoLongerExists"));
72
+ case "not_started":
73
+ return new ServiceError("refused", note("commandNotStarted", { detail: err.detail }));
74
+ default:
75
+ return new ServiceError("refused", note("builtTerminalNotAvailable"));
76
+ }
77
+ }
@@ -1,5 +1,3 @@
1
- import { mkdirSync } from "node:fs";
2
- import { join } from "node:path";
3
1
  import { ASSISTANT_LAYOUTS, ASSISTANT_PAGE_BYTES, ASSISTANT_WIDTH, assistantSignalSchema, assistantTurnSchema, } from "@engenty/wizards-shared/assistant";
4
2
  import { LANGS, MODEL_CLASSES, TEXT_CLASSES, } from "@engenty/wizards-shared/definition";
5
3
  import { CATEGORY_TYPES, whereSchema } from "@engenty/wizards-shared/knowledge";
@@ -36,17 +34,14 @@ import { missingConnections, missingModels, stepsWithoutModel, unwatchedConnecti
36
34
  import { env } from "../env.js";
37
35
  import { feature, features, forgetAccountFeatures } from "../features.js";
38
36
  import { appleStatus } from "../harness/apple.js";
39
- import { freshAuth, loginEnv } from "../harness/env.js";
40
- import { detectHarness, detectHarnesses, HARNESS_IDS, harness, installSpec, } from "../harness/index.js";
41
- import { closeTerminal, openTerminal, resizeTerminal, subscribeTerminal, writeTerminal, } from "../harness/terminal.js";
37
+ import { detectHarness, detectHarnesses, harness } from "../harness/index.js";
42
38
  import { connectorsView, filesView, spacesView, translationsView, wizardsView, wizardView, } from "../live/views.js";
43
- import { downloadLocalModel, localModels, removeLocalModel, startLocalOllama, } from "../local-models.js";
44
39
  import { installMail, ManageError, managed, renameTenant, saveModelPolicy, saveModelTier, saveOrganizationProfile, tenantInfo, tenantMembers, tryMasking, userInfo, } from "../manage.js";
45
40
  import { checkedApps, seenApps } from "../mcp/seen.js";
46
41
  import { generateImageMedia, generateSpeechMedia, generateVideoMedia } from "../media/generate.js";
47
42
  import { transcribeAudio } from "../media/transcribe.js";
48
43
  import { errorText, saidOf } from "../model-errors.js";
49
- import { asGatewayBindings, blockedBinding, CHAT_WAYS, checkKey, classProblem, classWays, DECISION_CHOICES, EMBEDDING_CHOICES, embeddingModel, hasTextModel, LOCAL_KEYS, localModelSettings, ModelUnavailableError, modelSettings, ownKeysThroughGateway, saveLocalModels, saveModels, setUpKey, setUpOllama, storedKey, textModel, } from "../models.js";
44
+ import { asGatewayBindings, blockedBinding, CHAT_WAYS, checkKey, classProblem, classWays, embeddingModel, hasTextModel, LOCAL_KEYS, localModelSettings, ModelUnavailableError, modelSettings, ownKeysThroughGateway, saveLocalModels, saveModels, storedKey, textModel, } from "../models.js";
50
45
  import { refreshPro } from "../plugins/pro.js";
51
46
  import { HTML_RESPONSE_CSP } from "../render/guard.js";
52
47
  import { isAdminRole, mayBuild, mayCreate, requireAdmin, requireWritable, spaceWritable, } from "../services/access.js";
@@ -82,7 +77,7 @@ import { deleteTranslation, editTranslation, isLangCode, publishedDefinition, }
82
77
  import { draftWidgetPreview } from "../services/widgets.js";
83
78
  import { wizardDatabase, wizardDatabaseCsv, wizardDatabaseRows } from "../services/wizard-data.js";
84
79
  import { createWizard, deleteWizard, draftChanges, duplicateWizard, hasWizards, ownedWizard, rotateShareLink, setAnswerers, updateWizardSettings, writableWizard, writeDraft, } from "../services/wizards.js";
85
- import { deleteTenantSetting, readSetting, writeSetting, writeTenantSetting } from "../settings.js";
80
+ import { deleteTenantSetting, writeTenantSetting } from "../settings.js";
86
81
  import { sharePreview, spaceShareTargets } from "../sharing/index.js";
87
82
  import { keepCloudForAll, mergesSeen, proposeMerge, resolveConflict, sendBeforeSwitch, startSpace, stopSpace, syncAll, syncView, undoMerge, } from "../sync/client.js";
88
83
  import { codeOf } from "../tenants/control.js";
@@ -91,6 +86,7 @@ import { serverText } from "../texts.js";
91
86
  import { applyUpdate, updateStatus } from "../update.js";
92
87
  import { spaceFileResponse } from "./delivery.js";
93
88
  import { notFoundAnswer, requestLang, say } from "./lang.js";
89
+ import { localSetup, modelsInput, testedSources } from "./model-setup.js";
94
90
  import { addKey, changeKey, checkKeyOf, listKeys, removeKey, setFallback } from "./own-keys.js";
95
91
  import { mayChangeRuntime } from "./runtime-settings.js";
96
92
  const presenceSchema = z.object({
@@ -109,17 +105,6 @@ const reader = (c) => ({
109
105
  lang: requestLang(c),
110
106
  who: whoOf(c),
111
107
  });
112
- /** The model sources a test call has worked on: the setup is done for those, not for the others. */
113
- async function testedSources() {
114
- const tested = await readSetting("setup-done");
115
- return Array.isArray(tested) ? tested : [];
116
- }
117
- async function markTested(source) {
118
- const tested = await testedSources();
119
- if (!tested.includes(source)) {
120
- await writeSetting("setup-done", [...tested, source]);
121
- }
122
- }
123
108
  /**
124
109
  * The chosen source has passed a test call and can still answer: its client is there and signed
125
110
  * in. Where Apple Intelligence thinks the short classes, the test ran there; a client behind
@@ -127,7 +112,7 @@ async function markTested(source) {
127
112
  */
128
113
  async function setupDone() {
129
114
  const { source, bindings } = localModelSettings();
130
- if (!(await testedSources()).includes(source)) {
115
+ if (!(await testedSources.has(source))) {
131
116
  return false;
132
117
  }
133
118
  const client = bindings.low.startsWith("apple:") ? null : harness(source);
@@ -137,26 +122,8 @@ async function setupDone() {
137
122
  }
138
123
  return hasTextModel();
139
124
  }
140
- /** A model as Ollama names it: `name`, `name:tag`, `namespace/name:tag` or `hf.co/…`. */
141
- const localModelName = z
142
- .string()
143
- .trim()
144
- .min(1)
145
- .max(120)
146
- .regex(/^[\w.:/-]+$/);
147
125
  /** The Manage-App's masking errors, passed on as it sends them: 502 labels, 503 the detector. */
148
126
  const MASKING_CODES = new Set(["labels_unavailable", "masking_unavailable"]);
149
- const modelsInput = z.object({
150
- source: z.enum([...HARNESS_IDS, "account", "own"]).optional(),
151
- bindings: z.partialRecord(z.enum(MODEL_CLASSES), z.string().max(160)).optional(),
152
- ollamaUrl: z.string().max(200).optional(),
153
- creditFallback: z.boolean().optional(),
154
- decision: z.enum(DECISION_CHOICES).optional(),
155
- embedding: z.enum(EMBEDDING_CHOICES).optional(),
156
- decisionLocal: z.string().max(120).optional(),
157
- embeddingLocal: z.string().max(120).optional(),
158
- keys: z.partialRecord(z.enum(LOCAL_KEYS), z.string().max(400)).optional(),
159
- });
160
127
  /** Alone the person changes everything; in an organization its owner and admins. */
161
128
  function mayChangeModels(user) {
162
129
  return !managed || user.role === "owner" || user.role === "admin";
@@ -267,10 +234,6 @@ async function testClass(cls, lang) {
267
234
  export async function assistantDevFor(user) {
268
235
  return managed ? (await userInfo(user.id)).admin : env.assistantDev;
269
236
  }
270
- const terminalSize = z.object({
271
- cols: z.number().int().min(10).max(500).optional(),
272
- rows: z.number().int().min(4).max(200).optional(),
273
- });
274
237
  /** How the person settled a conflict: one side, a choice per place, or a version of their own. */
275
238
  const resolutionSchema = z.union([
276
239
  z.object({ take: z.enum(["local", "remote"]) }),
@@ -1713,14 +1676,8 @@ export const studio = new Hono()
1713
1676
  }
1714
1677
  return c.json({ apps: await checkedApps(user.tenantId) });
1715
1678
  })
1716
- .get("/local/models", (c) => (managed ? c.notFound() : c.json(localModelSettings())))
1717
- .put("/local/models", async (c) => {
1718
- if (managed) {
1719
- return c.notFound();
1720
- }
1721
- await saveLocalModels(modelsInput.parse(await c.req.json()));
1722
- return c.json(localModelSettings());
1723
- })
1679
+ // The setup and the settings of the clients, keys and models on this machine.
1680
+ .route("/local", managed ? new Hono() : localSetup)
1724
1681
  // --- models: where each class runs, own API keys, the credits behind them -----------------
1725
1682
  // Alone for this machine; on a Manage-App's runtime for the organization, whose admins change it.
1726
1683
  .get("/models", async (c) => c.json(await settingsFor(c)))
@@ -1745,6 +1702,7 @@ export const studio = new Hono()
1745
1702
  if (managed &&
1746
1703
  (input.source ||
1747
1704
  input.ollamaUrl ||
1705
+ input.lmstudioUrl ||
1748
1706
  Object.values(input.bindings ?? {}).some((ref) => ref && !cloudBinding(ref)))) {
1749
1707
  return c.json({
1750
1708
  error: say(c, "notAvailableCloud"),
@@ -1876,47 +1834,6 @@ export const studio = new Hono()
1876
1834
  }
1877
1835
  })
1878
1836
  // Ollama on this computer: its models, what each can do, the ones to download, the downloads.
1879
- .get("/models/local", async (c) => {
1880
- if (managed) {
1881
- return c.notFound();
1882
- }
1883
- return c.json(await localModels());
1884
- })
1885
- // A model pulled into Ollama. Where it is the embedding model now, the spaces are indexed with it after.
1886
- .post("/models/local/pull", async (c) => {
1887
- if (managed || !mayChangeModels(c.get("user"))) {
1888
- return c.notFound();
1889
- }
1890
- const { model } = z.object({ model: localModelName }).parse(await c.req.json());
1891
- const embeddedBy = (await embeddingModel().catch(() => null))?.ref ?? null;
1892
- await downloadLocalModel(model, async () => {
1893
- if (((await embeddingModel().catch(() => null))?.ref ?? null) !== embeddedBy) {
1894
- await reindexAll();
1895
- }
1896
- });
1897
- return c.json(await localModels());
1898
- })
1899
- .delete("/models/local", async (c) => {
1900
- if (managed || !mayChangeModels(c.get("user"))) {
1901
- return c.notFound();
1902
- }
1903
- const model = localModelName.parse(c.req.query("model"));
1904
- try {
1905
- await removeLocalModel(model);
1906
- }
1907
- catch (err) {
1908
- return c.json({ error: say(c, "localModelNotRemoved", { error: err.message }) }, 400);
1909
- }
1910
- return c.json(await localModels());
1911
- })
1912
- // Ollama installed (on a Mac) and started, as `wizards setup` does.
1913
- .post("/models/local/ollama", async (c) => {
1914
- if (managed || !mayChangeModels(c.get("user"))) {
1915
- return c.notFound();
1916
- }
1917
- await startLocalOllama();
1918
- return c.json(await localModels());
1919
- })
1920
1837
  // The organization's own accounts at the providers, kept by the Manage-App (`ownKeysGateway`).
1921
1838
  .get("/models/keys", listKeys)
1922
1839
  .post("/models/keys", addKey)
@@ -1955,166 +1872,6 @@ export const studio = new Hono()
1955
1872
  .object({ cls: z.enum(MODEL_CLASSES), lang: z.enum(LANGS).default("en") })
1956
1873
  .parse(await c.req.json());
1957
1874
  return c.json(await testClass(cls, lang));
1958
- })
1959
- // The setup's test of one key, or of Ollama: a working one is put to use and ends the setup.
1960
- .post("/local/keys/:provider", async (c) => {
1961
- if (managed) {
1962
- return c.notFound();
1963
- }
1964
- const provider = z.enum(LOCAL_KEYS).parse(c.req.param("provider"));
1965
- const { key } = z
1966
- .object({ key: z.string().max(400).optional() })
1967
- .parse(await c.req.json().catch(() => ({})));
1968
- const result = await setUpKey(provider, key, requestLang(c));
1969
- if (result.ok && result.text) {
1970
- await markTested("own");
1971
- }
1972
- return c.json(result);
1973
- })
1974
- .post("/local/ollama", async (c) => {
1975
- if (managed) {
1976
- return c.notFound();
1977
- }
1978
- const { url } = z.object({ url: z.string().url().max(200) }).parse(await c.req.json());
1979
- const result = await setUpOllama(url, requestLang(c));
1980
- if (result.ok) {
1981
- await markTested("own");
1982
- }
1983
- return c.json(result);
1984
- })
1985
- // One short call on a class, as a run would make it: shows that the way to the model is open.
1986
- .post("/local/models/test", async (c) => {
1987
- if (managed) {
1988
- return c.notFound();
1989
- }
1990
- const { cls } = z
1991
- .object({ cls: z.enum(TEXT_CLASSES).default("classifier") })
1992
- .parse(await c.req.json().catch(() => ({})));
1993
- const started = Date.now();
1994
- // The source this call runs on: the person may pick another one while it is under way.
1995
- const source = localModelSettings().source;
1996
- try {
1997
- const resolved = await textModel(cls);
1998
- const result = await generateText({
1999
- model: resolved.model,
2000
- prompt: "Reply with the single word: OK",
2001
- maxOutputTokens: 20,
2002
- abortSignal: AbortSignal.timeout(120_000),
2003
- });
2004
- // A working call is what ends the setup — for the source it ran on.
2005
- await markTested(source);
2006
- return c.json({
2007
- ok: true,
2008
- ref: resolved.ref,
2009
- reply: result.text.trim().slice(0, 200),
2010
- ms: Date.now() - started,
2011
- });
2012
- }
2013
- catch (err) {
2014
- const message = err?.message ?? String(err);
2015
- return c.json({ ok: false, error: message.slice(0, 500), ms: Date.now() - started });
2016
- }
2017
- })
2018
- // --- the AI clients on this machine: looked at afresh, signed in through the inline terminal ----
2019
- .post("/local/harness/:id/detect", async (c) => {
2020
- const id = c.req.param("id");
2021
- if (managed || !harness(id)) {
2022
- return c.notFound();
2023
- }
2024
- return c.json({ harness: await detectHarness(id, true) });
2025
- })
2026
- .post("/local/harness/:id/install", async (c) => {
2027
- const spec = managed ? null : await installSpec(c.req.param("id"));
2028
- if (!spec) {
2029
- return c.notFound();
2030
- }
2031
- const { cols, rows } = terminalSize.parse(await c.req.json().catch(() => ({})));
2032
- const cwd = join(env.dataDir, "harness");
2033
- mkdirSync(cwd, { recursive: true });
2034
- // The page asks again once the command is over: then the client is there, or its output says why not.
2035
- const terminal = await openTerminal({ ...spec, cwd, cols, rows });
2036
- return c.json({ terminal });
2037
- })
2038
- .post("/local/harness/:id/login", async (c) => {
2039
- const id = c.req.param("id");
2040
- const client = harness(id);
2041
- if (managed || !client) {
2042
- return c.notFound();
2043
- }
2044
- const { cols, rows } = terminalSize.parse(await c.req.json().catch(() => ({})));
2045
- const cwd = join(env.dataDir, "harness");
2046
- mkdirSync(cwd, { recursive: true });
2047
- const terminal = await openTerminal({
2048
- bin: client.bin,
2049
- args: client.login.args,
2050
- cwd,
2051
- env: { ...(await loginEnv(client)), ...client.login.env },
2052
- cols,
2053
- rows,
2054
- // Signed in: the client says so on its own, and the settings learn it right away.
2055
- until: async () => (await freshAuth(client)) !== "none",
2056
- onDone: () => void detectHarness(id, true),
2057
- });
2058
- return c.json({ terminal });
2059
- })
2060
- .get("/local/terminal/:id/stream", (c) => {
2061
- if (managed) {
2062
- return c.notFound();
2063
- }
2064
- const id = c.req.param("id");
2065
- return streamSSE(c, async (stream) => {
2066
- let ended = false;
2067
- // One write after the other, and all of them out before the stream ends: the last one is
2068
- // the exit, and a page that comes after the end gets everything at once.
2069
- let written = Promise.resolve();
2070
- const done = new Promise((resolve) => {
2071
- const unsubscribe = subscribeTerminal(id, (event) => {
2072
- written = written.then(() => stream.writeSSE({ event: event.type, data: JSON.stringify(event) }));
2073
- if (event.type === "exit") {
2074
- ended = true;
2075
- resolve();
2076
- }
2077
- });
2078
- stream.onAbort(() => {
2079
- unsubscribe();
2080
- resolve();
2081
- });
2082
- });
2083
- // The page keeps the stream open while the terminal lives; a heartbeat keeps proxies from closing it.
2084
- const beat = setInterval(() => {
2085
- if (!ended) {
2086
- void stream.writeSSE({ event: "ping", data: "" });
2087
- }
2088
- }, 15_000);
2089
- await done;
2090
- clearInterval(beat);
2091
- await written;
2092
- });
2093
- })
2094
- .post("/local/terminal/:id/input", async (c) => {
2095
- if (managed) {
2096
- return c.notFound();
2097
- }
2098
- const { data } = z.object({ data: z.string().max(10_000) }).parse(await c.req.json());
2099
- writeTerminal(c.req.param("id"), data);
2100
- return c.json({ ok: true });
2101
- })
2102
- .post("/local/terminal/:id/resize", async (c) => {
2103
- if (managed) {
2104
- return c.notFound();
2105
- }
2106
- const { cols, rows } = z
2107
- .object({ cols: z.number().int().min(10).max(500), rows: z.number().int().min(4).max(200) })
2108
- .parse(await c.req.json());
2109
- resizeTerminal(c.req.param("id"), cols, rows);
2110
- return c.json({ ok: true });
2111
- })
2112
- .delete("/local/terminal/:id", (c) => {
2113
- if (managed) {
2114
- return c.notFound();
2115
- }
2116
- closeTerminal(c.req.param("id"));
2117
- return c.json({ ok: true });
2118
1875
  })
2119
1876
  .put("/local/chat-models", async (c) => {
2120
1877
  if (managed) {
@@ -1,5 +1,5 @@
1
+ import { readNumber } from "@engenty/chatviews/numbers";
1
2
  import { CATEGORY_TYPES, dayOf, } from "@engenty/wizards-shared/knowledge";
2
- import { readNumber } from "@engenty/wizards-shared/numbers";
3
3
  import { note } from "@engenty/wizards-shared/run";
4
4
  import { and, asc, eq, inArray, isNotNull, or, sql } from "drizzle-orm";
5
5
  import { nanoid } from "nanoid";
@@ -1,5 +1,6 @@
1
1
  import { anthropic } from "@ai-sdk/anthropic";
2
- import { surfaceComponentsSchema, validateSurface } from "@engenty/wizards-shared/surface";
2
+ import { surfaceComponentsSchema, validateSurface } from "@engenty/chatviews/surface";
3
+ import { ClientModel } from "@engenty/local-models/clients";
3
4
  import { createTool } from "@mastra/core/tools";
4
5
  import { z } from "zod";
5
6
  import { sortedTools } from "../agents/space-agent.js";
@@ -7,13 +8,13 @@ import { chatTurnWay } from "../agents/subscription.js";
7
8
  import { personCaller } from "../elements/caller.js";
8
9
  import { elementTools } from "../elements/catalogue.js";
9
10
  import { currentFeatures } from "../features.js";
10
- import { HarnessModel } from "../harness/index.js";
11
11
  import { managed } from "../manage.js";
12
12
  import { attachTools, chatModel, gatewayTools, toolAccess, } from "../models.js";
13
13
  import { pluginsOf } from "../plugins/registry.js";
14
14
  import { prompt } from "../prompts.js";
15
15
  import { sandboxCapabilities, shellToolDescription } from "../sandbox/index.js";
16
16
  import { currentTenant } from "../tenants/tenant.js";
17
+ import { harnessed, harnessedModel, oneOfMany } from "../tools/harness.js";
17
18
  import { assistantToolPlugin, assistantToolRisk, assistantToolsOf } from "../tools/plugin.js";
18
19
  import { clip } from "../tools/shared.js";
19
20
  import { skillsBlock } from "../tools/skills.js";
@@ -266,8 +267,13 @@ export async function workTurn(turn, signal, steps, choice = {}) {
266
267
  choice.web !== false ? toolAccess() : null,
267
268
  ]);
268
269
  const client = turn.role === "client";
269
- const made = gated(await toolsFor(resolved, turn.space, turn.userId, signal, choice, turn.chatId, null, turn.role ?? null, web), turn);
270
- const tools = resolved.model instanceof HarnessModel ? steps.wrap(made) : made;
270
+ const all = await toolsFor(resolved, turn.space, turn.userId, signal, choice, turn.chatId, null, turn.role ?? null, web);
271
+ // The connections' actions and the plugins' tools: many, and few of them in one chat.
272
+ const many = new Set(Object.keys(all).filter((name) => oneOfMany(all[name])));
273
+ const made = gated(all, turn);
274
+ const tools = resolved.model instanceof ClientModel
275
+ ? steps.wrap(made)
276
+ : sortedTools(harnessed(made, resolved, (name) => many.has(name)).tools);
271
277
  attachTools(resolved, tools);
272
278
  const skills = client ? null : await spaceSkills(turn.space.id);
273
279
  const block = skills
@@ -289,7 +295,7 @@ export async function workTurn(turn, signal, steps, choice = {}) {
289
295
  .join("\n")
290
296
  : "";
291
297
  return {
292
- resolved,
298
+ resolved: harnessedModel(resolved),
293
299
  tools,
294
300
  instructions: [
295
301
  instructionsFor(turn.space.name, block, "space_search" in tools, client),
@@ -9,8 +9,8 @@ const EN = {
9
9
  schemaMismatch: "The wizard doesn’t match the schema.",
10
10
  providerError: "The provider answered with error {status}.",
11
11
  providerUnreachable: "The provider cannot be reached right now.",
12
- ollamaUnreachable: "Nothing answers at this address. Is Ollama running?",
13
- ollamaNoModel: "Ollama runs, but has no model yet: `ollama pull qwen3` fetches one.",
12
+ serverUnreachable: "Nothing answers at this address. Is {name} running?",
13
+ serverNoModel: "{name} runs, but has no model that writes yet.",
14
14
  importedFrom: "Imported from “{name}”: {steps}, {files}.",
15
15
  imported: "Imported: {steps}, {files}.",
16
16
  stepCount: { one: "{count} step", other: "{count} steps" },
@@ -120,7 +120,6 @@ const EN = {
120
120
  somethingWentWrongTry: "Something went wrong. Try again.",
121
121
  unknownApp: "Unknown app.",
122
122
  onlyOrganizationAdminsChange: "Only organization admins can change its models.",
123
- localModelNotRemoved: "Ollama didn’t remove the model: {error}",
124
123
  modelLacksForClass: "{model} lacks what the class {cls} can’t work without: {needs}. Choose another model for it.",
125
124
  "need.tools": "tool calls",
126
125
  "need.json": "JSON output",
@@ -280,8 +279,8 @@ const DE = {
280
279
  keyUnknown: "Der Anbieter kennt diesen API-Key nicht.",
281
280
  providerError: "Der Anbieter antwortet mit Fehler {status}.",
282
281
  providerUnreachable: "Der Anbieter ist gerade nicht erreichbar.",
283
- ollamaUnreachable: "Unter dieser Adresse antwortet nichts. Läuft Ollama?",
284
- ollamaNoModel: "Ollama läuft, hat aber noch kein Modell: `ollama pull qwen3` holt eines.",
282
+ serverUnreachable: "Unter dieser Adresse antwortet nichts. Läuft {name}?",
283
+ serverNoModel: "{name} läuft, hat aber noch kein Modell, das schreibt.",
285
284
  importedFrom: "Importiert aus „{name}“: {steps}, {files}.",
286
285
  imported: "Importiert: {steps}, {files}.",
287
286
  stepCount: { one: "{count} Schritt", other: "{count} Schritte" },
@@ -378,7 +377,6 @@ const DE = {
378
377
  somethingWentWrongTry: "Da ist etwas schiefgelaufen. Versuch es noch einmal.",
379
378
  unknownApp: "Diese App gibt es nicht.",
380
379
  onlyOrganizationAdminsChange: "Nur Admins der Organisation ändern ihre Modelle.",
381
- localModelNotRemoved: "Ollama hat das Modell nicht entfernt: {error}",
382
380
  modelLacksForClass: "{model} fehlt, was die Klasse {cls} unbedingt braucht: {needs}. Wähle dafür ein anderes Modell.",
383
381
  "need.tools": "Tool-Aufrufe",
384
382
  "need.json": "JSON-Ausgabe",
@@ -3,6 +3,8 @@ import { brokerCall, inAudience, kindOf, reachesOutside, } from "../broker/index
3
3
  import { resolveConnector } from "../connectors/external.js";
4
4
  import { prompt } from "../prompts.js";
5
5
  import { attempt, clip } from "./shared.js";
6
+ /** The tools that are a connection's action. */
7
+ export const connectionTools = new WeakSet();
6
8
  const TOOL_NAME = /^[a-zA-Z0-9_-]{1,64}$/;
7
9
  /** A tool's name: the connector's prefix, the connection (two of one service in a space are two), the action. */
8
10
  export const connectionToolName = (connector, row, actionId) => `${connector.toolPrefix}_${row.id}_${actionId}`;
@@ -111,6 +113,7 @@ export function makeConnectionTools(options) {
111
113
  ? attempt(async () => connectionResult(await callConnection(tool, options.who, options.where(tool), input), service))
112
114
  : options.write(tool, input),
113
115
  });
116
+ connectionTools.add(tools[name]);
114
117
  if (!read) {
115
118
  writes.add(name);
116
119
  }