@engenty/wizards-runtime 0.12.2 → 0.14.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 (328) hide show
  1. package/apps/runtime/dist/agents/architect.js +8 -7
  2. package/apps/runtime/dist/agents/goose-connections.js +82 -0
  3. package/apps/runtime/dist/agents/space-agent.js +9 -2
  4. package/apps/runtime/dist/agents/studio-assistant.js +126 -71
  5. package/apps/runtime/dist/agents/website.js +1 -1
  6. package/apps/runtime/dist/app.js +28 -3
  7. package/apps/runtime/dist/assistant/knows.js +6 -5
  8. package/apps/runtime/dist/authoring/guide.js +25 -5
  9. package/apps/runtime/dist/broker/account.js +166 -0
  10. package/apps/runtime/dist/broker/call.js +417 -0
  11. package/apps/runtime/dist/broker/caller.js +10 -0
  12. package/apps/runtime/dist/broker/grant.js +152 -0
  13. package/apps/runtime/dist/broker/host.js +51 -0
  14. package/apps/runtime/dist/broker/index.js +8 -0
  15. package/apps/runtime/dist/broker/kept.js +31 -0
  16. package/apps/runtime/dist/broker/log.js +240 -0
  17. package/apps/runtime/dist/broker/registry.js +9 -0
  18. package/apps/runtime/dist/broker/rwx.js +367 -0
  19. package/apps/runtime/dist/broker/send.js +189 -0
  20. package/apps/runtime/dist/connectors/builtin.js +1 -1
  21. package/apps/runtime/dist/connectors/external.js +38 -37
  22. package/apps/runtime/dist/connectors/index.js +30 -91
  23. package/apps/runtime/dist/connectors/mail.js +0 -8
  24. package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
  25. package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
  26. package/apps/runtime/dist/connectors/smtp.js +1 -1
  27. package/apps/runtime/dist/connectors/space-connections.js +436 -0
  28. package/apps/runtime/dist/credits/estimate.js +3 -3
  29. package/apps/runtime/dist/db/adopt.js +3 -3
  30. package/apps/runtime/dist/db/client.js +9 -0
  31. package/apps/runtime/dist/db/live-triggers.js +65 -23
  32. package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
  33. package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
  34. package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
  35. package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
  36. package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
  37. package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
  38. package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
  39. package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
  40. package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
  41. package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
  42. package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
  43. package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
  47. package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
  48. package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
  49. package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
  50. package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
  51. package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
  52. package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
  53. package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
  54. package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
  55. package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
  57. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
  58. package/apps/runtime/dist/db/schema.js +295 -72
  59. package/apps/runtime/dist/docs/dev/architecture.md +215 -0
  60. package/apps/runtime/dist/docs/dev/broker.md +298 -0
  61. package/apps/runtime/dist/docs/dev/index.md +5 -1
  62. package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
  63. package/apps/runtime/dist/docs/dev/meta.json +3 -0
  64. package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
  65. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
  66. package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
  67. package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
  68. package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
  69. package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
  70. package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
  71. package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
  72. package/apps/runtime/dist/docs/dev/skills.md +16 -9
  73. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +59 -6
  74. package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
  75. package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
  76. package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
  77. package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
  78. package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
  79. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
  80. package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
  81. package/apps/runtime/dist/docs/user-guide/index.md +10 -1
  82. package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
  83. package/apps/runtime/dist/docs/user-guide/models.md +105 -30
  84. package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
  85. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  86. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  87. package/apps/runtime/dist/docs/user-guide/together.md +29 -2
  88. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  89. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  90. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  91. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  92. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  93. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  94. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  95. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  96. package/apps/runtime/dist/engine/decide.js +1 -1
  97. package/apps/runtime/dist/engine/requirements.js +139 -11
  98. package/apps/runtime/dist/engine/resources.js +43 -12
  99. package/apps/runtime/dist/engine/runner.js +121 -27
  100. package/apps/runtime/dist/engine/steps.js +42 -16
  101. package/apps/runtime/dist/engine/template.js +35 -1
  102. package/apps/runtime/dist/env.js +9 -4
  103. package/apps/runtime/dist/index.js +18 -2
  104. package/apps/runtime/dist/link-preview.js +9 -0
  105. package/apps/runtime/dist/live/feed.js +2 -2
  106. package/apps/runtime/dist/live/origin.js +2 -2
  107. package/apps/runtime/dist/live/views.js +51 -26
  108. package/apps/runtime/dist/manage.js +32 -0
  109. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  110. package/apps/runtime/dist/mcp/handler.js +55 -1
  111. package/apps/runtime/dist/mcp/seen.js +47 -0
  112. package/apps/runtime/dist/mcp/tools.js +75 -34
  113. package/apps/runtime/dist/models.js +203 -12
  114. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  115. package/apps/runtime/dist/motion-graphics/step.js +2 -2
  116. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  117. package/apps/runtime/dist/plugins/events.js +2 -2
  118. package/apps/runtime/dist/plugins/jobs.js +4 -1
  119. package/apps/runtime/dist/plugins/loader.js +2 -2
  120. package/apps/runtime/dist/prompts/architect.md +3 -3
  121. package/apps/runtime/dist/prompts/authoring.md +46 -12
  122. package/apps/runtime/dist/prompts/goose.md +14 -13
  123. package/apps/runtime/dist/prompts/mcp.md +6 -6
  124. package/apps/runtime/dist/prompts/safety.md +18 -0
  125. package/apps/runtime/dist/prompts/services.md +4 -4
  126. package/apps/runtime/dist/prompts/step.md +3 -3
  127. package/apps/runtime/dist/prompts/tools.md +39 -10
  128. package/apps/runtime/dist/routes/api.js +31 -20
  129. package/apps/runtime/dist/routes/broker.js +316 -0
  130. package/apps/runtime/dist/routes/connections.js +71 -0
  131. package/apps/runtime/dist/routes/delivery.js +25 -0
  132. package/apps/runtime/dist/routes/discover.js +17 -0
  133. package/apps/runtime/dist/routes/live.js +11 -1
  134. package/apps/runtime/dist/routes/marketplace.js +3 -3
  135. package/apps/runtime/dist/routes/person.js +4 -1
  136. package/apps/runtime/dist/routes/plugins.js +3 -1
  137. package/apps/runtime/dist/routes/rules.js +26 -0
  138. package/apps/runtime/dist/routes/runs.js +59 -33
  139. package/apps/runtime/dist/routes/skills.js +6 -6
  140. package/apps/runtime/dist/routes/studio.js +256 -148
  141. package/apps/runtime/dist/routes/work.js +199 -0
  142. package/apps/runtime/dist/safety.js +60 -18
  143. package/apps/runtime/dist/sandbox/index.js +27 -0
  144. package/apps/runtime/dist/services/access.js +38 -17
  145. package/apps/runtime/dist/services/api.js +38 -13
  146. package/apps/runtime/dist/services/architect.js +3 -3
  147. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  148. package/apps/runtime/dist/services/brand.js +12 -12
  149. package/apps/runtime/dist/services/broker-bell.js +69 -0
  150. package/apps/runtime/dist/services/broker-notify.js +127 -0
  151. package/apps/runtime/dist/services/client-steps.js +79 -0
  152. package/apps/runtime/dist/services/cloud.js +42 -42
  153. package/apps/runtime/dist/services/command-risk.js +51 -0
  154. package/apps/runtime/dist/services/discover.js +85 -0
  155. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  156. package/apps/runtime/dist/services/knowledge.js +117 -80
  157. package/apps/runtime/dist/services/manage-reports.js +77 -7
  158. package/apps/runtime/dist/services/marketplace.js +7 -31
  159. package/apps/runtime/dist/services/members-studio.js +165 -0
  160. package/apps/runtime/dist/services/onboarding.js +22 -22
  161. package/apps/runtime/dist/services/package-file.js +1 -1
  162. package/apps/runtime/dist/services/package.js +22 -22
  163. package/apps/runtime/dist/services/pages.js +13 -9
  164. package/apps/runtime/dist/services/runs.js +4 -3
  165. package/apps/runtime/dist/services/seen.js +55 -0
  166. package/apps/runtime/dist/services/shares.js +28 -13
  167. package/apps/runtime/dist/services/site.js +23 -23
  168. package/apps/runtime/dist/services/skills-registry.js +15 -15
  169. package/apps/runtime/dist/services/skills.js +44 -44
  170. package/apps/runtime/dist/services/space-categories.js +35 -35
  171. package/apps/runtime/dist/services/space-data.js +130 -111
  172. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  173. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  174. package/apps/runtime/dist/services/space-origin.js +19 -11
  175. package/apps/runtime/dist/services/spaces.js +478 -598
  176. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  177. package/apps/runtime/dist/services/themes.js +15 -15
  178. package/apps/runtime/dist/services/widgets.js +6 -6
  179. package/apps/runtime/dist/services/wizards.js +112 -38
  180. package/apps/runtime/dist/services/work-ai.js +257 -0
  181. package/apps/runtime/dist/services/work-approvals.js +104 -0
  182. package/apps/runtime/dist/services/work-chats.js +908 -0
  183. package/apps/runtime/dist/services/work-connections.js +90 -0
  184. package/apps/runtime/dist/services/work-files.js +85 -0
  185. package/apps/runtime/dist/services/work-mastra.js +73 -0
  186. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  187. package/apps/runtime/dist/sharing/files.js +14 -4
  188. package/apps/runtime/dist/sharing/index.js +40 -39
  189. package/apps/runtime/dist/sharing/jobs.js +67 -17
  190. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  191. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  192. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  193. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  194. package/apps/runtime/dist/store/index.js +14 -3
  195. package/apps/runtime/dist/store/shared-lists.js +4 -2
  196. package/apps/runtime/dist/sync/apply.js +2 -2
  197. package/apps/runtime/dist/sync/client.js +113 -113
  198. package/apps/runtime/dist/sync/hub.js +41 -41
  199. package/apps/runtime/dist/sync/log.js +12 -12
  200. package/apps/runtime/dist/sync/records.js +118 -120
  201. package/apps/runtime/dist/texts.js +44 -2
  202. package/apps/runtime/dist/tools/connections.js +112 -0
  203. package/apps/runtime/dist/tools/connector.js +157 -67
  204. package/apps/runtime/dist/tools/index.js +31 -15
  205. package/apps/runtime/dist/tools/mail.js +40 -11
  206. package/apps/runtime/dist/tools/pages.js +11 -5
  207. package/apps/runtime/dist/tools/plugin.js +43 -7
  208. package/apps/runtime/dist/tools/skills.js +1 -1
  209. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  210. package/apps/runtime/dist/tools/store.js +3 -2
  211. package/apps/runtime/dist/widgets/step.js +10 -10
  212. package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
  213. package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
  214. package/apps/web/dist/assets/{ChangelogDialog-CKLgFL6r.js → ChangelogDialog-Duab4zTO.js} +1 -1
  215. package/apps/web/dist/assets/{CodeEditor-B3nto_26.js → CodeEditor-nxoOt8ge.js} +1 -1
  216. package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
  217. package/apps/web/dist/assets/{FlowPreview-zJCtixSi.js → FlowPreview-aMfwcPul.js} +1 -1
  218. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  219. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  220. package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
  221. package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
  222. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  223. package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
  224. package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
  225. package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
  226. package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
  227. package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
  228. package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
  229. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  230. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  231. package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
  232. package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
  233. package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
  234. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  235. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  236. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  237. package/apps/web/dist/assets/{code-xml-Hx7YxCg0.js → code-xml-B4kLFZSj.js} +1 -1
  238. package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
  239. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  240. package/apps/web/dist/assets/{eye-BkMFLnYu.js → eye-BpoKpIdt.js} +1 -1
  241. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  242. package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
  243. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  244. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  245. package/apps/web/dist/assets/index-D2akynS-.js +10 -0
  246. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  247. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  248. package/apps/web/dist/assets/{phone-DMfwuh9V.js → phone-Ctvf-Am-.js} +1 -1
  249. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  250. package/apps/web/dist/assets/{runners-D5qz6b_s.js → runners-CyIvJIHr.js} +1 -1
  251. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  252. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  253. package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
  254. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  255. package/apps/web/dist/assets/{upload-DQJwLSGj.js → upload-BchUnQGV.js} +1 -1
  256. package/apps/web/dist/assets/{useMutation-C20c2EH3.js → useMutation-DEkZhp5c.js} +1 -1
  257. package/apps/web/dist/assets/{volume-2-CC5qamYT.js → volume-2-CU_oy81Z.js} +1 -1
  258. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  259. package/apps/web/dist/index.html +17 -10
  260. package/apps/web/dist/mcp/flow.html +119 -64
  261. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  262. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +7 -1
  263. package/node_modules/@engenty/wizards-shared/dist/assistant.js +11 -1
  264. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  265. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  266. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +257 -8
  267. package/node_modules/@engenty/wizards-shared/dist/definition.js +113 -15
  268. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  269. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  270. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +38 -2
  271. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +38 -2
  272. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  273. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  274. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  275. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  276. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  277. package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +0 -5
  278. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  279. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +115 -6
  280. package/node_modules/@engenty/wizards-shared/dist/run.js +135 -0
  281. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  282. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  283. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  284. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  285. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  286. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  287. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  288. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  289. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  290. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  291. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  292. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  293. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  294. package/node_modules/@engenty/wizards-shared/dist/tiers.d.ts +195 -0
  295. package/node_modules/@engenty/wizards-shared/dist/tiers.js +98 -0
  296. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  297. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  298. package/package.json +4 -1
  299. package/plugin/.claude-plugin/plugin.json +1 -1
  300. package/plugin/plugin.json +1 -1
  301. package/plugin/skills/build-wizard/SKILL.md +1 -1
  302. package/apps/runtime/dist/services/projects.js +0 -473
  303. package/apps/web/dist/assets/AboutDialog-CLgnoYTI.js +0 -1
  304. package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +0 -3
  305. package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +0 -2
  306. package/apps/web/dist/assets/NewWizardChannels-B4N7GIYh.js +0 -1
  307. package/apps/web/dist/assets/NewWizardPage-Dpt0Mzk8.js +0 -7
  308. package/apps/web/dist/assets/OnboardingPage-CDoYVjRC.js +0 -1
  309. package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +0 -10
  310. package/apps/web/dist/assets/ProjectPage-408YOoNa.js +0 -10
  311. package/apps/web/dist/assets/PublicRunner-BZ66xdRX.js +0 -1
  312. package/apps/web/dist/assets/ReadOnly-C9oGMkUB.js +0 -1
  313. package/apps/web/dist/assets/SettingsPage-Dq3AZwJS.js +0 -2
  314. package/apps/web/dist/assets/SetupPage-CP3lbyZc.js +0 -1
  315. package/apps/web/dist/assets/SharePage-DdMm1Y8K.js +0 -1
  316. package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +0 -1
  317. package/apps/web/dist/assets/changelog-82-DHogQ.js +0 -1
  318. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  319. package/apps/web/dist/assets/i18n-CKKh3Pn0.js +0 -55
  320. package/apps/web/dist/assets/index-Cy2NHzAx.js +0 -49
  321. package/apps/web/dist/assets/index-wR_-1hfN.css +0 -1
  322. package/apps/web/dist/assets/lock-CGXM95Mi.js +0 -1
  323. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  324. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  325. package/apps/web/dist/assets/session-DRy0k0nh.js +0 -2
  326. package/apps/web/dist/assets/theme-DNPm6r4e.js +0 -11
  327. package/apps/web/dist/assets/ui-CwFQAfE-.js +0 -83
  328. /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
@@ -9,14 +9,16 @@ import { createReplicate } from "@ai-sdk/replicate";
9
9
  import { DEFINITION_VERSION, MODEL_CLASSES, TEXT_CLASSES, } from "@engenty/wizards-shared/definition";
10
10
  import { blockingNeeds, CAPABILITY_CLASSES, creditsModelOf, isCreditsRef, missingNeeds, PROVIDER_IDS, providerInfo, providerOfRef, traitsOf, } from "@engenty/wizards-shared/providers";
11
11
  import { note, saidText } from "@engenty/wizards-shared/run";
12
+ import { policyEntry, } from "@engenty/wizards-shared/tiers";
12
13
  import { generateSpeech, generateText, } from "ai";
13
14
  import { accountToken, linkedAccount } from "./auth/account.js";
14
15
  import { LOCAL_DECISION_MODEL, ollamaDecisionModel, ollamaRoot } from "./decision-model.js";
15
16
  import { DeviceModel, deviceThinks } from "./engine/device.js";
16
17
  import { env } from "./env.js";
18
+ import { feature, remoteFeatures } from "./features.js";
17
19
  import { appleModel, appleStatus, appleTranscriptionModel, appleUnavailableNote, } from "./harness/apple.js";
18
20
  import { detectHarness, HarnessModel, harness, isHarnessVendor, notInstalled, signedOut, } from "./harness/index.js";
19
- import { managed } from "./manage.js";
21
+ import { managed, tenantInfo } from "./manage.js";
20
22
  import { hasFfmpeg } from "./media/ffmpeg.js";
21
23
  import { ModelUnavailableError, saidOf } from "./model-errors.js";
22
24
  import { seal, unseal } from "./secrets/crypto.js";
@@ -61,6 +63,39 @@ export const DECISION_WAYS = ["gateway", "typesafe", "local", "credits"];
61
63
  */
62
64
  export const DECISION_CHOICES = ["auto", ...DECISION_WAYS, "llm"];
63
65
  const local = { settings: { source: "own", bindings: {} }, keys: {} };
66
+ /** The environment variable a runtime that runs alone reads a provider's key from. */
67
+ const ENV_KEYS = {
68
+ gateway: "AI_GATEWAY_API_KEY",
69
+ openai: "OPENAI_API_KEY",
70
+ anthropic: "ANTHROPIC_API_KEY",
71
+ google: "GOOGLE_GENERATIVE_AI_API_KEY",
72
+ fal: "FAL_KEY",
73
+ elevenlabs: "ELEVENLABS_API_KEY",
74
+ replicate: "REPLICATE_API_TOKEN",
75
+ };
76
+ /** A key as the settings page may show it: its prefix and its last four characters. */
77
+ export function maskKey(key) {
78
+ if (key.length < 12) {
79
+ return `…${key.slice(-2)}`;
80
+ }
81
+ const prefix = key.match(/^[A-Za-z]{1,8}[-_](?:[A-Za-z]{1,8}[-_])?/)?.[0] ?? "";
82
+ return `${prefix}…${key.slice(-4)}`;
83
+ }
84
+ /**
85
+ * Where each key the settings page shows comes from: kept in the studio (sealed for an
86
+ * organization), or read from an environment variable of this machine; masked, never whole.
87
+ */
88
+ async function keyHints(cfg) {
89
+ const hints = {};
90
+ for (const name of LOCAL_KEYS) {
91
+ const key = cfg.keys[name];
92
+ if (key) {
93
+ const fromEnv = !managed && !(await vaultGet(`key.${name}`));
94
+ hints[name] = { masked: maskKey(key), env: fromEnv ? ENV_KEYS[name] : null };
95
+ }
96
+ }
97
+ return hints;
98
+ }
64
99
  function envKey(name) {
65
100
  const value = {
66
101
  gateway: env.aiGatewayKey,
@@ -107,13 +142,39 @@ async function tenantConfig(tenant) {
107
142
  tenantConfigs.set(tenant, value);
108
143
  return value;
109
144
  }
110
- async function config() {
145
+ /** What an organization saved: its keys and bindings as they are, used or not. */
146
+ async function storedConfig() {
111
147
  if (!managed) {
112
148
  return local;
113
149
  }
114
150
  const tenant = currentTenantOrNull();
115
151
  return tenant ? tenantConfig(tenant) : { settings: organizationSettings({}), keys: {} };
116
152
  }
153
+ /**
154
+ * Whether the organization thinks on its own keys now: its plan has them and, while `modelTiers`
155
+ * is on, its admins' policy allows them. When the Manage-App can't say, it doesn't.
156
+ */
157
+ async function ownKeysAllowed(tenant) {
158
+ const info = await tenantInfo(tenant).catch(() => null);
159
+ return Boolean(info &&
160
+ feature("ownKeys", info.features) &&
161
+ !(feature("modelTiers", info.features) && info.modelPolicy?.ownKeys === false));
162
+ }
163
+ /**
164
+ * What a call runs on. An organization whose plan or policy leaves out own keys keeps them saved,
165
+ * but every class goes to the credits: its keys and the bindings to a provider's model don't count.
166
+ */
167
+ async function config() {
168
+ const cfg = await storedConfig();
169
+ const tenant = managed ? currentTenantOrNull() : null;
170
+ if (!tenant || (await ownKeysAllowed(tenant))) {
171
+ return cfg;
172
+ }
173
+ return {
174
+ settings: organizationSettings(Object.fromEntries(Object.entries(cfg.settings.bindings).filter(([, ref]) => isCreditsRef(ref)))),
175
+ keys: {},
176
+ };
177
+ }
117
178
  function mergeBindings(current, changes = {}) {
118
179
  const bindings = { ...current };
119
180
  for (const [cls, ref] of Object.entries(changes)) {
@@ -186,7 +247,7 @@ export async function saveModels(input) {
186
247
  }
187
248
  /** A stored key, for a check of the key itself; never sent to the studio. */
188
249
  export async function storedKey(name) {
189
- return (await config()).keys[name];
250
+ return (await storedConfig()).keys[name];
190
251
  }
191
252
  // --- where a class runs -------------------------------------------------------------
192
253
  const isText = (cls) => TEXT_CLASSES.includes(cls);
@@ -336,19 +397,99 @@ function need(cfg, name) {
336
397
  * answers `/v1/models` in them. A caller without it is a runtime from before version 2.
337
398
  */
338
399
  const DEFINITION_HEADER = { "x-wizards-definition": String(DEFINITION_VERSION) };
339
- function gatewayClient(access, meta) {
400
+ /** Whether the organization's model tier counts: maker classes and the purpose header. */
401
+ async function tiersOn() {
402
+ return feature("modelTiers", await remoteFeatures().catch(() => null));
403
+ }
404
+ /** What a call is for, as the gateway checks it against the organization's policy. */
405
+ const purposeOf = (meta) => meta.purpose ?? (meta.runId ? "wizard" : "assistant");
406
+ function purposeHeader(meta, tiers) {
407
+ return tiers ? { "x-wizards-purpose": purposeOf(meta) } : {};
408
+ }
409
+ /**
410
+ * What the gateway masked in a run's calls, per run and step, until the step's Log line says it:
411
+ * `x-wizards-masked: {"person":2,"email":1}` counts per kind.
412
+ */
413
+ const maskedCounts = new Map();
414
+ function countMasked(meta, header) {
415
+ if (!header || !meta.runId) {
416
+ return;
417
+ }
418
+ const key = `${meta.runId}|${meta.stepId ?? ""}`;
419
+ const counts = maskedCounts.get(key) ?? {};
420
+ let said = null;
421
+ try {
422
+ said = JSON.parse(header);
423
+ }
424
+ catch {
425
+ return;
426
+ }
427
+ for (const [kind, count] of Object.entries(said && typeof said === "object" ? said : {})) {
428
+ if (Number.isInteger(count) && count > 0) {
429
+ counts[kind] = (counts[kind] ?? 0) + count;
430
+ }
431
+ }
432
+ maskedCounts.set(key, counts);
433
+ }
434
+ /** What the gateway masked in a step's calls, per kind, once: the counts are gone after. */
435
+ export function takeMasked(runId, stepId) {
436
+ const key = `${runId}|${stepId}`;
437
+ const counts = maskedCounts.get(key);
438
+ maskedCounts.delete(key);
439
+ return counts && Object.keys(counts).length ? counts : null;
440
+ }
441
+ function gatewayClient(access, meta, tiers) {
340
442
  return createGateway({
341
443
  baseURL: `${access.baseUrl}/v4/ai`,
342
444
  apiKey: access.token,
445
+ // A run's call that had personal data masked says how much, for the step's Log line.
446
+ ...(tiers && meta.runId
447
+ ? {
448
+ fetch: async (input, init) => {
449
+ const res = await fetch(input, init);
450
+ countMasked(meta, res.headers.get("x-wizards-masked"));
451
+ return res;
452
+ },
453
+ }
454
+ : {}),
343
455
  headers: {
344
456
  ...DEFINITION_HEADER,
345
457
  ...(access.tenant ? { "x-wizards-tenant": access.tenant } : {}),
346
458
  ...(meta.runId ? { "x-wizards-run": meta.runId } : {}),
347
459
  ...(meta.stepId ? { "x-wizards-step": meta.stepId } : {}),
348
460
  ...(meta.effort ? { "x-wizards-effort": meta.effort } : {}),
461
+ ...purposeHeader(meta, tiers),
349
462
  },
350
463
  });
351
464
  }
465
+ const NO_TIER = { tier: null, modelPolicy: null };
466
+ export async function currentTiers() {
467
+ const tenant = managed ? currentTenantOrNull() : null;
468
+ const info = tenant ? await tenantInfo(tenant).catch(() => null) : null;
469
+ if (!info || !feature("modelTiers", info.features)) {
470
+ return NO_TIER;
471
+ }
472
+ return { tier: info.tier ?? null, modelPolicy: info.modelPolicy ?? null };
473
+ }
474
+ /** The organization's model tier, while `modelTiers` is on; null where it has none. */
475
+ export async function currentTier() {
476
+ return (await currentTiers()).tier;
477
+ }
478
+ /**
479
+ * Whether the organization's tier allows web search; true without a tier. When the Manage-App
480
+ * can't say, an organization's search waits: a tier that rules it out may be the reason.
481
+ */
482
+ export async function searchAllowed() {
483
+ const tenant = managed ? currentTenantOrNull() : null;
484
+ if (!tenant) {
485
+ return true;
486
+ }
487
+ const info = await tenantInfo(tenant).catch(() => null);
488
+ if (!info) {
489
+ return false;
490
+ }
491
+ return !feature("modelTiers", info.features) || (info.tier?.rules.search ?? true);
492
+ }
352
493
  let gatewayCatalog = null;
353
494
  /** What the gateway binds each class to, with prices in credits. Cached for five minutes. */
354
495
  export async function classCatalog() {
@@ -384,9 +525,16 @@ export async function classCatalog() {
384
525
  }
385
526
  /** A call on the credits: the model a binding names, or the gateway's model of the class. */
386
527
  async function viaCredits(route, cls, meta, pick) {
387
- const bound = route.model ?? (await classCatalog())?.classes[cls]?.model ?? "";
528
+ const tiers = await tiersOn();
529
+ const asked = tiers && meta.makerClass ? meta.makerClass : null;
530
+ // Where way C's list approves the model a class runs on and not the class, the call asks for it.
531
+ const { tier, modelPolicy } = tiers && !route.model ? await currentTiers() : NO_TIER;
532
+ const entry = tier ? policyEntry(tier, modelPolicy, purposeOf(meta), asked ?? cls) : null;
533
+ const byModel = entry && entry !== (asked ?? cls) ? entry : null;
534
+ const makerModel = asked ? (tier?.classes[asked]?.model ?? null) : null;
535
+ const bound = route.model ?? byModel ?? makerModel ?? (await classCatalog())?.classes[cls]?.model ?? "";
388
536
  return {
389
- model: pick(gatewayClient(route.access, meta), route.model ?? `wizards/${cls}`),
537
+ model: pick(gatewayClient(route.access, meta, tiers), route.model ?? byModel ?? `wizards/${asked ?? cls}`),
390
538
  ref: bound,
391
539
  vendor: vendorOf(bound.replace(/^[a-z]+:/, "")),
392
540
  gateway: true,
@@ -788,7 +936,7 @@ async function embeddingBy(cfg, way, chosen) {
788
936
  const bound = access ? (await classCatalog())?.classes.embedding : null;
789
937
  return access && bound
790
938
  ? {
791
- model: gatewayClient(access, {}).embeddingModel("wizards/embedding"),
939
+ model: gatewayClient(access, {}, await tiersOn()).embeddingModel("wizards/embedding"),
792
940
  ref: bound.model,
793
941
  }
794
942
  : null;
@@ -819,7 +967,7 @@ async function embeddingAccess(cfg) {
819
967
  return null;
820
968
  }
821
969
  /**
822
- * The model that turns passages and questions into vectors for a project's document index: the
970
+ * The model that turns passages and questions into vectors for a space's document index: the
823
971
  * credits on a Manage-App's runtime; alone, what the settings choose — by default an AI Gateway
824
972
  * key, an OpenAI key, EmbeddingGemma in Ollama on this computer, then the linked account's
825
973
  * credits. Null where none is set up — an installed AI client has no such model — and the
@@ -940,8 +1088,26 @@ async function decisionBy(cfg, way, chosen) {
940
1088
  * machine (free, and nothing leaves it), then Jev on the linked account's credits. Null when
941
1089
  * there is none: the classifier class's language model answers then.
942
1090
  */
943
- export async function systemOneAccess() {
944
- return (await decisionAccess(await config()))?.access ?? null;
1091
+ export async function systemOneAccess(meta = {}) {
1092
+ // A tier without evaluation models: the classifier class's language model answers, inside it.
1093
+ const tier = await currentTier();
1094
+ if (tier && !tier.rules.decisions) {
1095
+ return null;
1096
+ }
1097
+ const found = await decisionAccess(await config());
1098
+ if (found?.way !== "credits") {
1099
+ return found?.access ?? null;
1100
+ }
1101
+ const { access } = found;
1102
+ return {
1103
+ ...access,
1104
+ headers: {
1105
+ ...access.headers,
1106
+ ...(meta.runId ? { "x-wizards-run": meta.runId } : {}),
1107
+ ...(meta.stepId ? { "x-wizards-step": meta.stepId } : {}),
1108
+ ...purposeHeader(meta, await tiersOn()),
1109
+ },
1110
+ };
945
1111
  }
946
1112
  async function decisionAccess(cfg) {
947
1113
  if (managed) {
@@ -1001,6 +1167,24 @@ export function freeTierRefusal(err) {
1001
1167
  }
1002
1168
  return /"originalModelId":"([^"]+)"/.exec(text)?.[1] ?? "";
1003
1169
  }
1170
+ /**
1171
+ * A call the gateway refused for the organization's tier (`outside_tier`) or its admins' policy
1172
+ * (`not_in_policy`), with the class it asked for; null for any other failure.
1173
+ */
1174
+ export function tierRefusal(err) {
1175
+ let text = "";
1176
+ for (let e = err; e && text.length < 100_000; e = e.cause) {
1177
+ text += ` ${e.message ?? ""} ${typeof e.responseBody === "string" ? e.responseBody : ""}`;
1178
+ }
1179
+ const type = /"type"\s*:\s*"(outside_tier|not_in_policy)"/.exec(text)?.[1];
1180
+ return type
1181
+ ? {
1182
+ type,
1183
+ cls: /"class"\s*:\s*"([^"]+)"/.exec(text)?.[1] ?? null,
1184
+ tier: /"tier"\s*:\s*\{[^}]*"name"\s*:\s*"([^"]+)"/.exec(text)?.[1] ?? null,
1185
+ }
1186
+ : null;
1187
+ }
1004
1188
  /** What the person reads when Vercel's free tier leaves a model out, and how to fix it. */
1005
1189
  export function freeTierText(model) {
1006
1190
  return note("freeTier", {
@@ -1231,13 +1415,18 @@ export function waysIn(ways, lang) {
1231
1415
  /** What the settings page shows: the choices, which keys are there (never the keys), and the ways. */
1232
1416
  export async function modelSettings(lang = "en") {
1233
1417
  const cfg = await config();
1418
+ const stored = await storedConfig();
1234
1419
  const ways = await classWays();
1235
1420
  return {
1236
1421
  source: cfg.settings.source,
1237
- bindings: cfg.settings.bindings,
1422
+ bindings: stored.settings.bindings,
1238
1423
  ollamaUrl: cfg.settings.ollamaUrl ?? env.ollamaUrl,
1239
1424
  creditFallback: cfg.settings.creditFallback !== false,
1240
- keys: Object.fromEntries(LOCAL_KEYS.map((k) => [k, Boolean(cfg.keys[k])])),
1425
+ keys: Object.fromEntries(LOCAL_KEYS.map((k) => [k, Boolean(stored.keys[k])])),
1426
+ /** Each key there is, masked, and the environment variable it came from. */
1427
+ keyHints: await keyHints(stored),
1428
+ /** Saved keys and provider bindings the plan or the admins' policy leaves unused for now. */
1429
+ ownKeysUnused: cfg !== stored,
1241
1430
  ways: waysIn(ways, lang),
1242
1431
  /** Who answers decisions; where no decision model does, the classifier class's way. */
1243
1432
  decision: await decisionSettings(cfg),
@@ -1251,6 +1440,8 @@ export async function modelSettings(lang = "en") {
1251
1440
  prices: (await classCatalog())?.classes ?? null,
1252
1441
  /** The media models the credits pay for, which a binding may name. */
1253
1442
  creditModels: (await classCatalog())?.models ?? [],
1443
+ /** The organization's model tier, what each class runs on in it, and its admins' policy. */
1444
+ ...(await currentTiers()),
1254
1445
  };
1255
1446
  }
1256
1447
  // --- Checking a key ------------------------------------------------------------------
@@ -3,7 +3,7 @@ import { existsSync } from "node:fs";
3
3
  import { cp, mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { dirname, join, normalize } from "node:path";
5
5
  import { dataRef, MOTION_SIZES } from "@engenty/wizards-shared/definition";
6
- import { gradientCss, ruleLines, textStyleLine } from "@engenty/wizards-shared/projects";
6
+ import { gradientCss, ruleLines, textStyleLine } from "@engenty/wizards-shared/spaces";
7
7
  import { unzipSync } from "fflate";
8
8
  import { logoSectionLine, renderTemplate, resolveRef } from "../engine/template.js";
9
9
  import { env } from "../env.js";
@@ -11,7 +11,7 @@ import { getBlob } from "../files/blobs.js";
11
11
  import { extFor, loadAsset } from "../files/storage.js";
12
12
  import { prompt } from "../prompts.js";
13
13
  import { contentPolicy } from "../safety.js";
14
- import { projectFileContent } from "../services/project-files.js";
14
+ import { spaceFileContent } from "../services/space-files.js";
15
15
  import { placeSkills } from "./skills.js";
16
16
  import { soundCatalog } from "./sounds.js";
17
17
  import { runHyperframes } from "./tools.js";
@@ -79,10 +79,10 @@ async function writeBrand(root, ctx) {
79
79
  const fileName = (dir, f) => `${dir}/${safeName(f.name.replace(/\.[^.]+$/, ""))}.${extFor(f.mime) === "bin" ? (f.name.split(".").pop() ?? "bin") : extFor(f.mime)}`;
80
80
  const patterns = [];
81
81
  for (const p of b.patterns ?? []) {
82
- const f = ctx.projectFiles.find((x) => x.id === p.file);
82
+ const f = ctx.spaceFiles.find((x) => x.id === p.file);
83
83
  try {
84
84
  if (f) {
85
- const { data } = await projectFileContent(f.projectId, f.id);
85
+ const { data } = await spaceFileContent(f.spaceId, f.id);
86
86
  const name = fileName("patterns", f);
87
87
  files.push({ name, data });
88
88
  hash.update(name).update(data);
@@ -99,9 +99,9 @@ async function writeBrand(root, ctx) {
99
99
  }
100
100
  }
101
101
  const logos = [];
102
- for (const f of ctx.projectFiles.filter((p) => p.kind === "logo")) {
102
+ for (const f of ctx.spaceFiles.filter((p) => p.kind === "logo")) {
103
103
  try {
104
- const { data } = await projectFileContent(f.projectId, f.id);
104
+ const { data } = await spaceFileContent(f.spaceId, f.id);
105
105
  const name = fileName("logos", f);
106
106
  files.push({ name, data });
107
107
  hash.update(name).update(data);
@@ -187,12 +187,12 @@ const BASE = join(".engenty", "base");
187
187
  */
188
188
  function brandBaseDir(ctx, kitHash, brandStamp) {
189
189
  const key = createHash("sha256").update(`${kitHash}:${brandStamp}`).digest("hex").slice(0, 24);
190
- return join(env.dataDir, "brand-bases", ctx.project.id, key);
190
+ return join(env.dataDir, "brand-bases", ctx.space.id, key);
191
191
  }
192
192
  /** What in video/brand/ is the brand base: everything but the brand itself. */
193
193
  const isBrandItself = (name) => name === "brand.json" || name === "logos" || name === "patterns";
194
194
  /**
195
- * Brings the brand into a project that started from a base: brand.json and the logos as they are
195
+ * Brings the brand into a space that started from a base: brand.json and the logos as they are
196
196
  * now, and the brand base kept for them when there is one. A base that no longer fits the brand
197
197
  * is removed — the video makes it again, as BRAND.md says.
198
198
  */
@@ -2,7 +2,7 @@ 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 { MOTION_SIZES } from "@engenty/wizards-shared/definition";
5
+ import { MOTION_SIZES, textClassOf, } from "@engenty/wizards-shared/definition";
6
6
  import { note as runNote } from "@engenty/wizards-shared/run";
7
7
  import { StepError } from "../engine/types.js";
8
8
  import { CLAUDE_BIN, claudeEnv } from "../harness/claude.js";
@@ -98,7 +98,7 @@ function renderProblem(out) {
98
98
  /** How many times a failed final render goes back to the client to be fixed. */
99
99
  const RENDER_FIXES = 2;
100
100
  export async function runMotionGraphicsStep(step, ctx) {
101
- const found = await motionClient(step.model ?? "low");
101
+ const found = await motionClient(textClassOf(step.model ?? "low"));
102
102
  if ("problem" in found) {
103
103
  throw new StepError(found.problem);
104
104
  }
@@ -61,7 +61,7 @@ function cliEnv() {
61
61
  out.HYPERFRAMES_SKIP_SKILLS = "1";
62
62
  return out;
63
63
  }
64
- /** Runs `hyperframes <args>` in a project folder and returns what it printed (the tail). */
64
+ /** Runs `hyperframes <args>` in a space folder and returns what it printed (the tail). */
65
65
  export async function runHyperframes(args, opts) {
66
66
  const cli = await hyperframesEntry();
67
67
  return spawnText(process.execPath, [cli, ...args], {
@@ -42,7 +42,7 @@ export function runEnded(runId, status) {
42
42
  }
43
43
  return {
44
44
  run: { id: run.id, wizardId: run.wizardId, mode: run.mode, status },
45
- wizard: { id: wizard.id, title: run.definition.title, projectId: wizard.projectId },
45
+ wizard: { id: wizard.id, title: run.definition.title, spaceId: wizard.spaceId },
46
46
  values: run.state.values,
47
47
  };
48
48
  });
@@ -57,7 +57,7 @@ export function spaceChanged(event, spaceId) {
57
57
  /** A file of a space was read and is ready, or was removed. Not waited for either. */
58
58
  export function spaceFileChanged(event, file) {
59
59
  void emitPluginEvent(event, {
60
- space: { id: file.projectId },
60
+ space: { id: file.spaceId },
61
61
  file: { id: file.id, name: file.name, kind: file.kind, mime: file.mime },
62
62
  });
63
63
  }
@@ -1,4 +1,5 @@
1
1
  import { and, eq } from "drizzle-orm";
2
+ import { readingAs, SYSTEM } from "../broker/rwx.js";
2
3
  import { control, controlDb, withTenant } from "../db/client.js";
3
4
  import { env } from "../env.js";
4
5
  import { twoWayActive } from "../sync/state.js";
@@ -49,7 +50,9 @@ export async function runDueJobs(now = new Date()) {
49
50
  target: [control.pluginJob.tenantId, control.pluginJob.plugin, control.pluginJob.name],
50
51
  set: { lastRunAt: now },
51
52
  });
52
- started.push(withTenant(tenant.id, () => job.handler({ tenantId: tenant.id, lastRun: last, signal: plugin.stopped.signal }))
53
+ started.push(withTenant(tenant.id, () =>
54
+ // A job runs on the clock, for no person, guest or run: the runtime itself reads.
55
+ readingAs([SYSTEM], async () => job.handler({ tenantId: tenant.id, lastRun: last, signal: plugin.stopped.signal })))
53
56
  .catch((err) => console.error(`[plugin ${id}] job ${name}:`, err))
54
57
  .finally(() => running.delete(key)));
55
58
  }
@@ -17,7 +17,7 @@ import { currentFeatures } from "../features.js";
17
17
  import { managed } from "../manage.js";
18
18
  import { conversationAccess, ModelUnavailableError, textModel } from "../models.js";
19
19
  import { seal, unseal } from "../secrets/crypto.js";
20
- import { putIndexEntry, removeIndexEntries } from "../services/project-index.js";
20
+ import { putIndexEntry, removeIndexEntries } from "../services/space-index.js";
21
21
  import { originData } from "../services/space-origin.js";
22
22
  import { readSetting, writeSetting } from "../settings.js";
23
23
  import { safeFetch } from "../tools/net-guard.js";
@@ -228,7 +228,7 @@ function apiFor(record) {
228
228
  spaceData: originData(source.id),
229
229
  spaces: {
230
230
  async brand(space) {
231
- const p = await db.query.project.findFirst({ where: eq(schema.project.id, space) });
231
+ const p = await db.query.space.findFirst({ where: eq(schema.space.id, space) });
232
232
  return p
233
233
  ? {
234
234
  name: p.brand.name ?? "",
@@ -32,7 +32,7 @@ HOW YOU WORK
32
32
  - Call independent tools in the same step (they run together).
33
33
  - Never retype data you downloaded. Reshape it with run_script (output to a file), or let the widget read the raw files with wizard.json() and transform them when it starts.
34
34
  - Work in few, purposeful steps: every tool call costs the admin time and credits.
35
- - Services the wizard should work in for the person: find_connectors, import_connector (it returns the actions), then a connection for it in the wizard. list_connectors shows what the project has.
35
+ - Services the wizard should work in for the person: find_connectors, import_connector (it returns the actions), then a connection for it in the wizard. list_connectors shows what the space has.
36
36
  - Research what you need to prepare (web_search, web_fetch) — e.g. which lakes, their outlines, a chart library.
37
37
 
38
38
  <!-- section: subscription.system -->
@@ -41,7 +41,7 @@ You work on exactly one wizard: id "${wizard_id}". Read it with get_wizard befor
41
41
  Call get_authoring_guide once before your first change. Fix every issue a write reports before you answer.
42
42
 
43
43
  <!-- section: system -->
44
- <!-- The system prompt. schema, principles, widgets and surfaces are authoring.md's sections, project_tools its line.* sections (projectLines() in authoring/guide.ts); example is the example wizard as JSON. -->
44
+ <!-- The system prompt. schema, principles, widgets and surfaces are authoring.md's sections, space_tools its line.* sections (spaceLines() in authoring/guide.ts); example is the example wizard as JSON. -->
45
45
  ${persona}
46
46
 
47
47
  ${schema}
@@ -53,7 +53,7 @@ ${widgets}
53
53
  Surface catalog (for surface steps and output.surface):
54
54
  ${surfaces}
55
55
 
56
- ${project_tools}
56
+ ${space_tools}
57
57
 
58
58
  Example of a complete wizard:
59
59
  ```json
@@ -2,7 +2,7 @@
2
2
  The authoring guide: how a wizard is written down and what makes a good one. Read by
3
3
  authoring/guide.ts. authoringGuide() (section guide) is what MCP clients get from
4
4
  get_authoring_guide and what Goose knows; the architect (agents/architect.ts) builds its own
5
- system prompt from schema, principles, widgets, surfaces and the line.* sections (projectLines()).
5
+ system prompt from schema, principles, widgets, surfaces and the line.* sections (spaceLines()).
6
6
  engine/steps.ts reads surfaces too.
7
7
  -->
8
8
 
@@ -37,6 +37,7 @@ ${sandbox}
37
37
  - Collecting from everyone who runs the wizard (requests, leads, sign-ups, feedback): a list with "shared": true, saved with list_write. It is the admin's, under Space → Data; never show one person's rows to another. Longer text for every run (a running summary, a log): the "pages" tool.
38
38
  - The person's mail: one connection of kind "mail", a page field of kind "connection" early in the wizard, and the agent step lists it in "connections". Do not ask for the provider or the address in other fields — the connect field does that.
39
39
  - Working in a service for the person (read their Notion, create an issue, look up a customer): import the service as a connector, declare a connection with "connector", put a page field of kind "connection" before the step, and list the connection in the step's "connections". Prefer a connector over the browser whenever the service has one.
40
+ - Working in the space's own account (its CRM, its calendar, its mailbox — set up by the admins, listed below as connections of the space): declare a connection with "spaceConnection", no connect field. AI steps READ there; every WRITE (create, update, send, delete) is a fixed step: "call" with the connection, the action and fixed input fields from the run's values — the AI never writes as the space, and the person running is never asked for it. Example: an agent step reads the request and extracts the fields; then { "type": "agent", "call": { "connection": "crm", "action": "create_contact", "input": { "email": "{{email}}", "note": "{{steps.read.summary}}" } }, "output": { "format": "json" } }.
40
41
  - Logins on websites: never ask for passwords in page fields. An agent step with the browser tool asks the person at the moment it meets the login (browser_request_credentials); write that into its instructions, and that it must go on without the site when the person skips.
41
42
  - Most people open a wizard on their phone. Keep pages short, and let the phone do the typing: photos with an "image" field (multiple) instead of descriptions, the place with a "location" field instead of an address form, what happened as an "audio" field instead of a long textarea (keep an optional textarea beside it), a sign-off as a "signature" field, a serial or ticket number as a "text" field with scan. Typical: damage report, handover protocol, site inspection, delivery note.
42
43
  - How it runs: the first message may name the channels ("Läuft als: …" / "Runs as: …"); they are set already, never ask about them. A call, an SMS or WhatsApp asks by voice or text only: where one of them is named, keep each answer to text, a choice, a number or a date, and leave photos, files, signatures and maps to pages that only the browser shows (a call hands over a link by SMS).
@@ -58,7 +59,7 @@ ${sandbox}
58
59
  <!-- Technical: engineering owns everything below. -->
59
60
 
60
61
  <!-- section: guide -->
61
- <!-- authoringGuide(): the whole guide. schema, principles, widgets and surfaces are the sections below; project_tools is projectLines(): the line.* sections below, joined by blank lines; example is the example wizard as JSON. -->
62
+ <!-- authoringGuide(): the whole guide. schema, principles, widgets and surfaces are the sections below; space_tools is spaceLines(): the line.* sections below, joined by blank lines; example is the example wizard as JSON. -->
62
63
  engenty wizards: a wizard is a page-by-page flow an end user walks through on a shared link. Pages ask questions; AI steps research, write, draw images, render video, build documents and dashboards, or write into other systems. You author the wizard as JSON; the person who asked you is the ADMIN, the people who later open the link are END USERS.
63
64
 
64
65
  ${schema}
@@ -70,7 +71,7 @@ ${widgets}
70
71
  Surface catalog (for surface steps and output.surface):
71
72
  ${surfaces}
72
73
 
73
- ${project_tools}
74
+ ${space_tools}
74
75
 
75
76
  Models: a step names the KIND of model it needs, never a model. Pick the cheapest class that does the job:
76
77
  - "classifier": routing, yes/no, picking from options, pulling a few values out of text.
@@ -131,9 +132,14 @@ type List = {
131
132
  type Connection =
132
133
  | { id, kind: "mail", title?, description? }
133
134
  // the person picks how to connect (Gmail, Outlook, or any mailbox over IMAP); steps only ever READ it
135
+ | { id, spaceConnection: spaceConnectionId, actions?: actionId[], title?, description? }
136
+ // a connection of the SPACE (listed below), set up by its admins, who chose how it signs in, who may use it and
137
+ // what each kind of action may do; the wizard holds no account and "policy" has no say. Where it signs in as
138
+ // the space, an agent step that lists it gets its READ actions only: a write is a fixed step with "call"
139
+ // (connection + action + fixed input), never the model's. Where each person signs in, it works like "connector".
134
140
  | { id, connector: connectorId, actions?: actionId[], policy?: { [actionId]: "allow"|"ask" }, title?, description? }
135
141
  // connector = a service the wizard works in for the person: a built-in one (Gmail, Google Drive, Calendar and
136
- // Contacts, Outlook, OneDrive, Slack, GitHub, HubSpot, S3) or one imported into the project from the
142
+ // Contacts, Outlook, OneDrive, Slack, GitHub, HubSpot, S3) or one imported into the space from the
137
143
  // integrations registry. The person connects their own account (OAuth or API key) on a page.
138
144
  // kind "mail" reads any mailbox the same way and keeps attachments as files; use the gmail / outlook
139
145
  // connectors only for what it cannot do (drafts, sending, labels, calendar).
@@ -237,10 +243,14 @@ type AgentStep = {
237
243
  type: "agent"
238
244
  instructions: string // the task, with {{templates}} ("" with call)
239
245
  call?: { tool: "<plugin>.<tool>", input: { … } }
240
- // NO MODEL: one plugin tool called once with this input; its answer IS the json output
241
- // (fields name the keys later steps read). Use it where a model would only fetch and copy
242
- // data (free appointment times) — it answers in a second instead of half a minute.
243
- // String inputs are templates; a filled-in whole number or true/false is passed as one.
246
+ | { connection: connectionId, action: actionId, input: { … } }
247
+ // NO MODEL: one plugin tool, or one action of a connection, called once with this input; its
248
+ // answer IS the json output (fields name the keys later steps read). Use it where a model
249
+ // would only fetch and copy data (free appointment times) — it answers in a second instead
250
+ // of half a minute — and for EVERY write through a connection that signs in as the space.
251
+ // String inputs are templates ("{{email}}", "{{steps.read.summary}}"); a filled-in whole
252
+ // number or true/false is passed as one, an empty one is left out. On the person's own
253
+ // connection a write still asks them first.
244
254
  tools: ("web_search"|"web_fetch"|"browser"|"sandbox"|"image"|"http"|"pages"|"code")[]
245
255
  connections?: string[] // ids of wizard connections this step may read (mail → mail_search, mail_read, mail_save)
246
256
  output: { format: "text"|"markdown"|"json", fields?: { id, kind: "text"|"number"|"list"|"table"|"yesno"|"choice"|"score", description, columns?: string[], options?: string[] }[], schema?: Schema, surface?: SurfaceComponent[] | true }
@@ -259,8 +269,8 @@ type AgentStep = {
259
269
  // Every agent step also has, without listing them: list_read / list_write (the wizard's lists), files_list,
260
270
  // read_document (PDF, scans and photos, Word, Excel, CSV, saved mails) and scan_documents (invoice / receipt fields, many at once)
261
271
  // — on an installed client only where there is something to read: tools or connections, uploads, lists or kept files;
262
- // and where the space has Knowledge: project_search (a question, "where" on its typed categories, hits checked for relevance),
263
- // project_list (by categories), page_read / table_read / project_document (an item whole, by its path).
272
+ // and where the space has Knowledge: space_search (a question, "where" on its typed categories, hits checked for relevance),
273
+ // space_list (by categories), page_read / table_read / space_document (an item whole, by its path).
264
274
  // "pages" brings: page_read / page_write — Markdown pages of the space the wizard keeps for every run (notes, a log
265
275
  // that grows with append), shown to the admin under Space → Data; page_read also reads Knowledge by path.
266
276
  // "code" brings: execute_typescript — the model writes one program that calls the step's other tools (not the browser) as
@@ -411,7 +421,7 @@ type ResultStep = { type: "result", message?: string, deliverables: { from: step
411
421
 
412
422
  Templates (in instructions/prompt): {{fieldId}} · {{steps.stepId}} (whole output) · {{steps.stepId.key}} (json key)
413
423
  · {{itemsField}} (line items as a table WITH computed net/VAT/total) · {{itemsField.net|vat|gross}} · {{today}}
414
- · the project (its settings): {{brand.name}} {{brand.about}} {{brand.colors}} · {{facts.key}} (one fact: address, VAT ID, …) · {{facts}} (all facts)
424
+ · the space (its settings): {{brand.name}} {{brand.brandName}} {{brand.tagline}} {{brand.voice}} {{brand.links}} {{brand.about}} {{brand.colors}} · {{facts.key}} (one fact: address, VAT ID, …) · {{facts}} (all facts)
415
425
  — every AI step already knows them, name one only where the text must carry it; agent steps also search the space's Knowledge
416
426
  and are told its categories: say in a step's instructions which category to filter by when the task names one
417
427
  · {{lists.listId}} (the stored list as a table, as it is when the step starts) · {{fileField}} (the names of the uploads, for read_document)
@@ -481,13 +491,32 @@ Components and props (a prop may be a literal or {"path": "/key/..."} into the d
481
491
  - Steps { items, textKey?, minutesKey? } — ordered work, numbered, with times
482
492
  - Link { title, subtitle?, eyebrow?, meta?, look?: "row"|"card", items: {"path": "/recipes"}, key?: "id", value: {"path": "recipe_id"}, view: id } — opens the entry of items whose key is value in a sheet, drawn by view; title, subtitle and meta read that entry, eyebrow the row the Link sits in
483
493
  - Callout { text, title?, tone?: "tip"|"note"|"warning" }
494
+ - Markdown { text } — formatted text: bold, lists, links; Text for one plain line
495
+ - Sources { items: [{ title, url? }] or {"path": ...}, titleKey?, urlKey? } — where it was found, as small chips
496
+ - File { file: an asset id or {"path": ...}, name, mime?, preview?: false } — a file with its name and Open; a PDF or picture shows itself unless preview is false
497
+ - Video { src, poster? } / Audio { src, title? } — a clip or a recording, an asset id or {"path": ...}
498
+ - Gallery { items: [asset ids] or {"path": ...}, srcKey?, captionKey? } — pictures side by side; srcKey / captionKey: the keys of entries that are objects
484
499
  A path may put its value into words: {"path": "in_fridge", "map": {"true": "da", "false": "einkaufen"}}, {"path": "minutes", "format": "{} Min"}.
485
500
  Design it like an app, not a report: lead with a headline, the key figure or the chips; one Card per thing, never a Table of things; ordered work is Steps, things to get are a Checklist, sets are grouped by their key. A Table only for figures people compare across columns.
486
501
  Keep it small: what the person needs to see first, then the details. Never invent numbers: bind them by path.
487
502
 
503
+ <!-- section: surfaces.chat -->
504
+ <!-- What a view in a Work chat adds to the surfaces section above: show_view in services/work-ai.ts reads both. -->
505
+ In a chat, show_view draws the view in the chat for everyone in it. The data is what you found: put the rows and figures into "data" and bind them by path; never type numbers into the components.
506
+ In a chat a view may also:
507
+ - ask the AI: Button { label, action: "ask", prompt? } — the person who taps it says the prompt (else the label) in the chat, and you answer it
508
+ - open a file: Button { label, action: "open", target: a file id }
509
+ - point to a thing of the space: Ref { title, open, subtitle?, meta? } — open is what search_space gave as "open" ("p:…", "t:…", "f:…"), or "chat:<id>", "wizard:<id>"
510
+ - ask for answers: one Form { title?, submit, children: [Field ids] } with Field { name, kind, label, required?, options?, value?, placeholder?, help?, multiple? }
511
+ kind: text, textarea, number, select, multiselect (both need options: [texts]), date, email, url, toggle, color, image (a picture or the camera), file, location (where the person is), audio (a recording), signature
512
+ value prefills what you already know from the chat; the person still checks it. The answers come back as that person's message; once someone sent them, the form shows them.
513
+ A file id is the space's file: what search_space gave after "f:", or a file in a message. Media and files come from the space only, never from an address on the web.
514
+ Never ask for passwords, card numbers or other secrets in a Form.
515
+ Use a view when rows, figures, a comparison or a few questions answer better than text: write one short sentence around it, not the same content again. For a short answer, write text.
516
+
488
517
  <!-- section: line.connectors -->
489
518
  <!-- connectors: one "- id — name, tools prefix_*: actions" line per connector -->
490
- Connectors a wizard of this project can use (built in, or imported from the integrations registry; find more with find_connectors + import_connector):
519
+ Connectors a wizard of this space can use (built in, or imported from the integrations registry; find more with find_connectors + import_connector):
491
520
  ${connectors}
492
521
 
493
522
  <!-- section: line.connectors.not_set_up -->
@@ -497,6 +526,11 @@ NOT SET UP on this server: tell the admin before you build on it
497
526
  <!-- section: line.connectors.no_actions -->
498
527
  actions appear once an account is connected
499
528
 
529
+ <!-- section: line.space_connections -->
530
+ <!-- Only where the space has connections; connections: one "- id — name (connector), signs in as …, actions: …" line each. -->
531
+ Connections of this space, set up by its admins (a wizard uses one with { "spaceConnection": id }; where it signs in as the space, agent steps read and a step with "call" writes):
532
+ ${connections}
533
+
500
534
  <!-- section: line.plugin_tools -->
501
535
  <!-- Only when the app's plugins add tools; tools: one "- id — description" line per tool. -->
502
536
  Tools of this app's plugins. An agent step lists one in "tools" by its full id, next to the built-in ones; a wizard that uses one runs only where that plugin is installed: