wizards 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +170 -0
  3. package/apps/runtime/dist/agents/architect.js +453 -0
  4. package/apps/runtime/dist/agents/project-assistant.js +354 -0
  5. package/apps/runtime/dist/agents/subscription.js +206 -0
  6. package/apps/runtime/dist/agents/thought.js +21 -0
  7. package/apps/runtime/dist/agents/website.js +197 -0
  8. package/apps/runtime/dist/app.js +153 -0
  9. package/apps/runtime/dist/auth/account.js +121 -0
  10. package/apps/runtime/dist/auth/index.js +329 -0
  11. package/apps/runtime/dist/auth/keys.js +55 -0
  12. package/apps/runtime/dist/auth/local-ticket.js +23 -0
  13. package/apps/runtime/dist/authoring/example.js +73 -0
  14. package/apps/runtime/dist/authoring/guide.js +259 -0
  15. package/apps/runtime/dist/authoring/ops.js +117 -0
  16. package/apps/runtime/dist/cli/autostart.js +134 -0
  17. package/apps/runtime/dist/cli/clients.js +44 -0
  18. package/apps/runtime/dist/cli/environment.js +81 -0
  19. package/apps/runtime/dist/cli/exec.js +45 -0
  20. package/apps/runtime/dist/cli/home.js +74 -0
  21. package/apps/runtime/dist/cli/machine.js +145 -0
  22. package/apps/runtime/dist/cli/main.js +125 -0
  23. package/apps/runtime/dist/cli/setup.js +273 -0
  24. package/apps/runtime/dist/cli/start.js +190 -0
  25. package/apps/runtime/dist/cli/status.js +120 -0
  26. package/apps/runtime/dist/cli/ui.js +12 -0
  27. package/apps/runtime/dist/cli/update.js +58 -0
  28. package/apps/runtime/dist/connectors/builtin.js +70 -0
  29. package/apps/runtime/dist/connectors/external.js +400 -0
  30. package/apps/runtime/dist/connectors/gmail.js +107 -0
  31. package/apps/runtime/dist/connectors/imap.js +217 -0
  32. package/apps/runtime/dist/connectors/index.js +266 -0
  33. package/apps/runtime/dist/connectors/mail.js +72 -0
  34. package/apps/runtime/dist/connectors/outlook.js +90 -0
  35. package/apps/runtime/dist/credits/credits.js +103 -0
  36. package/apps/runtime/dist/credits/estimate.js +132 -0
  37. package/apps/runtime/dist/db/adopt.js +149 -0
  38. package/apps/runtime/dist/db/client.js +146 -0
  39. package/apps/runtime/dist/db/control-schema.js +70 -0
  40. package/apps/runtime/dist/db/migrations/control/0000_last_absorbing_man.sql +47 -0
  41. package/apps/runtime/dist/db/migrations/control/0001_gorgeous_nicolaos.sql +41 -0
  42. package/apps/runtime/dist/db/migrations/control/0002_secret_penance.sql +1 -0
  43. package/apps/runtime/dist/db/migrations/control/0003_nasty_mordo.sql +3 -0
  44. package/apps/runtime/dist/db/migrations/control/0004_breezy_eddie_brock.sql +6 -0
  45. package/apps/runtime/dist/db/migrations/control/meta/0000_snapshot.json +311 -0
  46. package/apps/runtime/dist/db/migrations/control/meta/0001_snapshot.json +599 -0
  47. package/apps/runtime/dist/db/migrations/control/meta/0002_snapshot.json +607 -0
  48. package/apps/runtime/dist/db/migrations/control/meta/0003_snapshot.json +311 -0
  49. package/apps/runtime/dist/db/migrations/control/meta/0004_snapshot.json +350 -0
  50. package/apps/runtime/dist/db/migrations/control/meta/_journal.json +41 -0
  51. package/apps/runtime/dist/db/migrations/tenant/0000_eminent_freak.sql +188 -0
  52. package/apps/runtime/dist/db/migrations/tenant/0001_salty_master_chief.sql +1 -0
  53. package/apps/runtime/dist/db/migrations/tenant/0002_cloudy_firebird.sql +1 -0
  54. package/apps/runtime/dist/db/migrations/tenant/0003_brown_warbound.sql +52 -0
  55. package/apps/runtime/dist/db/migrations/tenant/0004_romantic_nocturne.sql +6 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/0000_snapshot.json +1323 -0
  57. package/apps/runtime/dist/db/migrations/tenant/meta/0001_snapshot.json +1330 -0
  58. package/apps/runtime/dist/db/migrations/tenant/meta/0002_snapshot.json +1337 -0
  59. package/apps/runtime/dist/db/migrations/tenant/meta/0003_snapshot.json +1605 -0
  60. package/apps/runtime/dist/db/migrations/tenant/meta/0004_snapshot.json +1645 -0
  61. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +41 -0
  62. package/apps/runtime/dist/db/schema.js +278 -0
  63. package/apps/runtime/dist/documents/parse.js +230 -0
  64. package/apps/runtime/dist/engenty/connections-external/build-connector.js +193 -0
  65. package/apps/runtime/dist/engenty/connections-external/errors.js +11 -0
  66. package/apps/runtime/dist/engenty/connections-external/import-service.js +270 -0
  67. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +34 -0
  68. package/apps/runtime/dist/engenty/connections-external/importer/map-auth.js +185 -0
  69. package/apps/runtime/dist/engenty/connections-external/importer/normalize-mcp.js +63 -0
  70. package/apps/runtime/dist/engenty/connections-external/importer/normalize-openapi.js +130 -0
  71. package/apps/runtime/dist/engenty/connections-external/invoke/http-invoker.js +143 -0
  72. package/apps/runtime/dist/engenty/connections-external/invoke/mcp-client.js +143 -0
  73. package/apps/runtime/dist/engenty/connections-external/net/guarded-fetch.js +119 -0
  74. package/apps/runtime/dist/engenty/connections-external/oauth-dcr.js +88 -0
  75. package/apps/runtime/dist/engenty/connections-external/registry-client.js +336 -0
  76. package/apps/runtime/dist/engenty/connections-external/registry-source.js +82 -0
  77. package/apps/runtime/dist/engenty/connections-external/types.js +7 -0
  78. package/apps/runtime/dist/engenty/connections-github/connector.js +209 -0
  79. package/apps/runtime/dist/engenty/connections-google/connectors/calendar.js +359 -0
  80. package/apps/runtime/dist/engenty/connections-google/connectors/contacts.js +94 -0
  81. package/apps/runtime/dist/engenty/connections-google/connectors/drive.js +290 -0
  82. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +567 -0
  83. package/apps/runtime/dist/engenty/connections-google/definitions.js +11 -0
  84. package/apps/runtime/dist/engenty/connections-google/shared.js +73 -0
  85. package/apps/runtime/dist/engenty/connections-hubspot/connector.js +140 -0
  86. package/apps/runtime/dist/engenty/connections-microsoft/action.js +17 -0
  87. package/apps/runtime/dist/engenty/connections-microsoft/graph.js +114 -0
  88. package/apps/runtime/dist/engenty/connections-microsoft/onedrive.js +286 -0
  89. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +464 -0
  90. package/apps/runtime/dist/engenty/connections-s3/s3.js +328 -0
  91. package/apps/runtime/dist/engenty/connections-sdk/files-capability.js +86 -0
  92. package/apps/runtime/dist/engenty/connections-sdk/oauth2.js +150 -0
  93. package/apps/runtime/dist/engenty/connections-sdk/registry.js +89 -0
  94. package/apps/runtime/dist/engenty/connections-sdk/storage-capability.js +84 -0
  95. package/apps/runtime/dist/engenty/connections-sdk/types.js +30 -0
  96. package/apps/runtime/dist/engenty/connections-slack/connector.js +360 -0
  97. package/apps/runtime/dist/engenty/csv-import/csv-matrix.js +178 -0
  98. package/apps/runtime/dist/engenty/csv-import/import-sources.js +87 -0
  99. package/apps/runtime/dist/engenty/csv-import/parse-csv.js +129 -0
  100. package/apps/runtime/dist/engenty/csv-import/serialize-csv.js +20 -0
  101. package/apps/runtime/dist/engenty/csv-import/types.js +1 -0
  102. package/apps/runtime/dist/engenty/csv-import/xlsx-workbook.js +159 -0
  103. package/apps/runtime/dist/engenty/doc-converter/interface.js +9 -0
  104. package/apps/runtime/dist/engenty/doc-converter/page-break.js +92 -0
  105. package/apps/runtime/dist/engenty/doc-converter/providers/local/index.js +72 -0
  106. package/apps/runtime/dist/engenty/document-scanner/schemas/classifier.js +30 -0
  107. package/apps/runtime/dist/engenty/document-scanner/schemas/index.js +4 -0
  108. package/apps/runtime/dist/engenty/document-scanner/schemas/invoice.js +73 -0
  109. package/apps/runtime/dist/engenty/document-scanner/schemas/receipt.js +63 -0
  110. package/apps/runtime/dist/engenty/document-scanner/schemas/shared.js +40 -0
  111. package/apps/runtime/dist/engenty/search-index/chunks.js +164 -0
  112. package/apps/runtime/dist/engenty/search-index/contracts.js +9 -0
  113. package/apps/runtime/dist/engenty/shims/connections-sdk.js +39 -0
  114. package/apps/runtime/dist/engenty/shims/plugin-sdk.js +1 -0
  115. package/apps/runtime/dist/engenty/shims/web-ingest.js +3 -0
  116. package/apps/runtime/dist/engenty/web-ingest/ssrf.js +277 -0
  117. package/apps/runtime/dist/engine/asks.js +60 -0
  118. package/apps/runtime/dist/engine/events.js +46 -0
  119. package/apps/runtime/dist/engine/input.js +170 -0
  120. package/apps/runtime/dist/engine/prepare.js +51 -0
  121. package/apps/runtime/dist/engine/requirements.js +124 -0
  122. package/apps/runtime/dist/engine/resources.js +89 -0
  123. package/apps/runtime/dist/engine/runner.js +560 -0
  124. package/apps/runtime/dist/engine/steps.js +598 -0
  125. package/apps/runtime/dist/engine/template.js +183 -0
  126. package/apps/runtime/dist/engine/types.js +3 -0
  127. package/apps/runtime/dist/env.js +224 -0
  128. package/apps/runtime/dist/files/blobs.js +22 -0
  129. package/apps/runtime/dist/files/objects.js +86 -0
  130. package/apps/runtime/dist/files/storage.js +95 -0
  131. package/apps/runtime/dist/geocode.js +58 -0
  132. package/apps/runtime/dist/harness/claude.js +138 -0
  133. package/apps/runtime/dist/harness/codex.js +228 -0
  134. package/apps/runtime/dist/harness/cursor.js +93 -0
  135. package/apps/runtime/dist/harness/env.js +124 -0
  136. package/apps/runtime/dist/harness/gemini.js +126 -0
  137. package/apps/runtime/dist/harness/index.js +99 -0
  138. package/apps/runtime/dist/harness/model.js +267 -0
  139. package/apps/runtime/dist/harness/prompt.js +121 -0
  140. package/apps/runtime/dist/harness/terminal.js +193 -0
  141. package/apps/runtime/dist/harness/types.js +7 -0
  142. package/apps/runtime/dist/index.js +76 -0
  143. package/apps/runtime/dist/limits.js +57 -0
  144. package/apps/runtime/dist/link-preview.js +59 -0
  145. package/apps/runtime/dist/manage.js +151 -0
  146. package/apps/runtime/dist/mcp/auth.js +102 -0
  147. package/apps/runtime/dist/mcp/bridge.js +59 -0
  148. package/apps/runtime/dist/mcp/handler.js +42 -0
  149. package/apps/runtime/dist/mcp/scopes.js +5 -0
  150. package/apps/runtime/dist/mcp/tools.js +401 -0
  151. package/apps/runtime/dist/media/ffmpeg.js +121 -0
  152. package/apps/runtime/dist/media/generate.js +120 -0
  153. package/apps/runtime/dist/media/marking.js +121 -0
  154. package/apps/runtime/dist/media/transcribe.js +30 -0
  155. package/apps/runtime/dist/model-errors.js +3 -0
  156. package/apps/runtime/dist/models.js +489 -0
  157. package/apps/runtime/dist/plugin.js +61 -0
  158. package/apps/runtime/dist/render/chromium.js +85 -0
  159. package/apps/runtime/dist/render/convert.js +161 -0
  160. package/apps/runtime/dist/render/downloads.js +277 -0
  161. package/apps/runtime/dist/render/guard.js +25 -0
  162. package/apps/runtime/dist/routes/api.js +74 -0
  163. package/apps/runtime/dist/routes/delivery.js +52 -0
  164. package/apps/runtime/dist/routes/internal.js +49 -0
  165. package/apps/runtime/dist/routes/marketplace.js +36 -0
  166. package/apps/runtime/dist/routes/runs.js +805 -0
  167. package/apps/runtime/dist/routes/studio.js +702 -0
  168. package/apps/runtime/dist/routes/wizard-stream.js +30 -0
  169. package/apps/runtime/dist/running.js +39 -0
  170. package/apps/runtime/dist/sandbox/agentos.js +191 -0
  171. package/apps/runtime/dist/sandbox/docker.js +77 -0
  172. package/apps/runtime/dist/sandbox/index.js +30 -0
  173. package/apps/runtime/dist/sandbox/types.js +1 -0
  174. package/apps/runtime/dist/secrets/crypto.js +28 -0
  175. package/apps/runtime/dist/secrets/signing.js +34 -0
  176. package/apps/runtime/dist/secrets/vault.js +59 -0
  177. package/apps/runtime/dist/services/architect.js +92 -0
  178. package/apps/runtime/dist/services/brand.js +20 -0
  179. package/apps/runtime/dist/services/cloud.js +52 -0
  180. package/apps/runtime/dist/services/draft-events.js +27 -0
  181. package/apps/runtime/dist/services/errors.js +24 -0
  182. package/apps/runtime/dist/services/files.js +129 -0
  183. package/apps/runtime/dist/services/links.js +16 -0
  184. package/apps/runtime/dist/services/marketplace.js +292 -0
  185. package/apps/runtime/dist/services/package.js +202 -0
  186. package/apps/runtime/dist/services/profile.js +23 -0
  187. package/apps/runtime/dist/services/project-files.js +266 -0
  188. package/apps/runtime/dist/services/project-index.js +109 -0
  189. package/apps/runtime/dist/services/projects.js +181 -0
  190. package/apps/runtime/dist/services/runs.js +224 -0
  191. package/apps/runtime/dist/services/shares.js +129 -0
  192. package/apps/runtime/dist/services/widgets.js +34 -0
  193. package/apps/runtime/dist/services/wizards.js +342 -0
  194. package/apps/runtime/dist/settings.js +16 -0
  195. package/apps/runtime/dist/store/index.js +279 -0
  196. package/apps/runtime/dist/tenants/control.js +106 -0
  197. package/apps/runtime/dist/tenants/tenant.js +26 -0
  198. package/apps/runtime/dist/tools/browser.js +380 -0
  199. package/apps/runtime/dist/tools/connector.js +204 -0
  200. package/apps/runtime/dist/tools/index.js +234 -0
  201. package/apps/runtime/dist/tools/mail.js +104 -0
  202. package/apps/runtime/dist/tools/net-guard.js +59 -0
  203. package/apps/runtime/dist/tools/project.js +53 -0
  204. package/apps/runtime/dist/tools/shared.js +42 -0
  205. package/apps/runtime/dist/tools/store.js +238 -0
  206. package/apps/runtime/dist/update.js +118 -0
  207. package/apps/runtime/dist/widgets/bundle.js +99 -0
  208. package/apps/runtime/dist/widgets/render.js +312 -0
  209. package/apps/runtime/dist/widgets/runtime.js +84 -0
  210. package/apps/runtime/dist/widgets/script.js +30 -0
  211. package/apps/runtime/dist/widgets/step.js +192 -0
  212. package/apps/web/dist/ai-labels/ai-black.svg +20 -0
  213. package/apps/web/dist/ai-labels/ai-generated-black.svg +31 -0
  214. package/apps/web/dist/ai-labels/ai-generated-white.svg +32 -0
  215. package/apps/web/dist/ai-labels/ai-modified-black.svg +30 -0
  216. package/apps/web/dist/ai-labels/ai-modified-white.svg +31 -0
  217. package/apps/web/dist/ai-labels/ai-white.svg +21 -0
  218. package/apps/web/dist/assets/ChangelogDialog-O00vEnbm.js +1 -0
  219. package/apps/web/dist/assets/ChatPanel-CH9ry0Hp.js +1 -0
  220. package/apps/web/dist/assets/CreditsDialog-DRzecwUw.js +1 -0
  221. package/apps/web/dist/assets/EditorPage-BRnBf02Q.js +2 -0
  222. package/apps/web/dist/assets/FlowPreview-DDOj8IAH.js +1 -0
  223. package/apps/web/dist/assets/HomePage-CAGTTG3N.js +1 -0
  224. package/apps/web/dist/assets/ImportWizard-0RRrAnX3.js +1 -0
  225. package/apps/web/dist/assets/LocalRuntime-BrP-ENHg.css +1 -0
  226. package/apps/web/dist/assets/LocalRuntime-C-TBYrzs.js +16 -0
  227. package/apps/web/dist/assets/NewWizardPage-kI90h3_9.js +2 -0
  228. package/apps/web/dist/assets/PublicRunner-CKRDeIVd.js +1 -0
  229. package/apps/web/dist/assets/RunnerView-Rc4H8wYH.js +2 -0
  230. package/apps/web/dist/assets/SettingsPage-CESMuZxq.js +2 -0
  231. package/apps/web/dist/assets/SetupPage-D1rrYU14.js +1 -0
  232. package/apps/web/dist/assets/SharePage-COTAmOgh.js +1 -0
  233. package/apps/web/dist/assets/api-BY28cjGY.js +10 -0
  234. package/apps/web/dist/assets/arrow-left-UpjOBfQp.js +1 -0
  235. package/apps/web/dist/assets/arrow-right-CucQycEy.js +1 -0
  236. package/apps/web/dist/assets/changelog-p3wsaDDS.js +1 -0
  237. package/apps/web/dist/assets/check-Bjx41xbB.js +1 -0
  238. package/apps/web/dist/assets/createLucideIcon-DBu2Ovxj.js +1 -0
  239. package/apps/web/dist/assets/definition-cy7uvY5L.js +55 -0
  240. package/apps/web/dist/assets/engenty-CWIFpgKq.js +1 -0
  241. package/apps/web/dist/assets/esm-D1OEhjTK.js +7 -0
  242. package/apps/web/dist/assets/external-link-CRg6DVdO.js +1 -0
  243. package/apps/web/dist/assets/fluffy-engenty-CJ3wCQgT.js +456 -0
  244. package/apps/web/dist/assets/index-CQ_q9iMO.css +1 -0
  245. package/apps/web/dist/assets/index-D0gxh90t.js +10 -0
  246. package/apps/web/dist/assets/jsx-runtime-Dk72oS4N.js +1 -0
  247. package/apps/web/dist/assets/meta-BbSdtTUa.js +1 -0
  248. package/apps/web/dist/assets/mic-CeqQ89Dj.js +1 -0
  249. package/apps/web/dist/assets/oss-credits-cPuZUFHD.js +1 -0
  250. package/apps/web/dist/assets/outputs-D6pxH6ve.js +69 -0
  251. package/apps/web/dist/assets/plus-HA210wXA.js +1 -0
  252. package/apps/web/dist/assets/preload-helper-CNEI7N0N.js +1 -0
  253. package/apps/web/dist/assets/qr-scanner-worker.min-CJaXo3yu.js +98 -0
  254. package/apps/web/dist/assets/qr-scanner.min-C_UI0gH-.js +1 -0
  255. package/apps/web/dist/assets/type-BzYgVWKL.js +1 -0
  256. package/apps/web/dist/assets/ui-Ddwl35A6.js +1 -0
  257. package/apps/web/dist/assets/upload-DsgLfQ3U.js +1 -0
  258. package/apps/web/dist/assets/video-Dk1fuTDl.js +1 -0
  259. package/apps/web/dist/assets/wand-sparkles-Bf97fs8T.js +1 -0
  260. package/apps/web/dist/embed.js +102 -0
  261. package/apps/web/dist/favicon.svg +1 -0
  262. package/apps/web/dist/icons/apple-touch-icon.png +0 -0
  263. package/apps/web/dist/icons/icon-192.png +0 -0
  264. package/apps/web/dist/icons/icon-512.png +0 -0
  265. package/apps/web/dist/icons/icon-maskable-512.png +0 -0
  266. package/apps/web/dist/index.html +46 -0
  267. package/apps/web/dist/install.sh +532 -0
  268. package/apps/web/dist/manifest.webmanifest +20 -0
  269. package/apps/web/dist/sw.js +15 -0
  270. package/bin/wizards.mjs +13 -0
  271. package/node_modules/@engenty-wizards/shared/dist/connectors.d.ts +77 -0
  272. package/node_modules/@engenty-wizards/shared/dist/connectors.js +2 -0
  273. package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +1415 -0
  274. package/node_modules/@engenty-wizards/shared/dist/definition.js +762 -0
  275. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.d.ts +5 -0
  276. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.js +132 -0
  277. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.d.ts +11 -0
  278. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.js +209 -0
  279. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.d.ts +532 -0
  280. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.js +216 -0
  281. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.d.ts +3 -0
  282. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.js +3 -0
  283. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.d.ts +14 -0
  284. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.js +166 -0
  285. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.d.ts +33 -0
  286. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.js +99 -0
  287. package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.d.ts +35 -0
  288. package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.js +86 -0
  289. package/node_modules/@engenty-wizards/shared/dist/marketplace-search.d.ts +20 -0
  290. package/node_modules/@engenty-wizards/shared/dist/marketplace-search.js +133 -0
  291. package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +298 -0
  292. package/node_modules/@engenty-wizards/shared/dist/marketplace.js +211 -0
  293. package/node_modules/@engenty-wizards/shared/dist/merge.d.ts +7 -0
  294. package/node_modules/@engenty-wizards/shared/dist/merge.js +40 -0
  295. package/node_modules/@engenty-wizards/shared/dist/projects.d.ts +74 -0
  296. package/node_modules/@engenty-wizards/shared/dist/projects.js +96 -0
  297. package/node_modules/@engenty-wizards/shared/dist/run.d.ts +219 -0
  298. package/node_modules/@engenty-wizards/shared/dist/run.js +1 -0
  299. package/node_modules/@engenty-wizards/shared/dist/store.d.ts +100 -0
  300. package/node_modules/@engenty-wizards/shared/dist/store.js +44 -0
  301. package/node_modules/@engenty-wizards/shared/dist/workspace.d.ts +16 -0
  302. package/node_modules/@engenty-wizards/shared/dist/workspace.js +51 -0
  303. package/node_modules/@engenty-wizards/shared/package.json +10 -0
  304. package/package.json +62 -0
  305. package/plugin/.claude-plugin/plugin.json +9 -0
  306. package/plugin/.mcp.json +8 -0
  307. package/plugin/commands/wizard.md +8 -0
  308. package/plugin/skills/build-wizard/SKILL.md +27 -0
@@ -0,0 +1,46 @@
1
+ import { AsyncResource } from "node:async_hooks";
2
+ import { EventEmitter } from "node:events";
3
+ import { and, desc, eq, gt } from "drizzle-orm";
4
+ import { db, schema } from "../db/client.js";
5
+ const bus = new EventEmitter();
6
+ bus.setMaxListeners(0);
7
+ export async function emitEvent(runId, stepId, type, message, asset) {
8
+ const [row] = await db
9
+ .insert(schema.runEvent)
10
+ .values({ runId, stepId, type, message: message.slice(0, 2000), assetId: asset ?? null })
11
+ .returning();
12
+ const event = {
13
+ id: row.id,
14
+ at: row.createdAt.toISOString(),
15
+ stepId: row.stepId,
16
+ type: row.type,
17
+ message: row.message,
18
+ asset: row.assetId,
19
+ };
20
+ bus.emit(runId, { runId, event });
21
+ }
22
+ export function signalChanged(runId) {
23
+ bus.emit(runId, { runId, event: null });
24
+ }
25
+ /** The listener runs in the subscriber's own context (its tenant), whoever signals. */
26
+ export function subscribe(runId, listener) {
27
+ const bound = AsyncResource.bind(listener);
28
+ bus.on(runId, bound);
29
+ return () => bus.off(runId, bound);
30
+ }
31
+ export async function recentEvents(runId, afterId = 0, limit = 40) {
32
+ const rows = await db
33
+ .select()
34
+ .from(schema.runEvent)
35
+ .where(and(eq(schema.runEvent.runId, runId), gt(schema.runEvent.id, afterId)))
36
+ .orderBy(desc(schema.runEvent.id))
37
+ .limit(limit);
38
+ return rows.reverse().map((r) => ({
39
+ id: r.id,
40
+ at: r.createdAt.toISOString(),
41
+ stepId: r.stepId,
42
+ type: r.type,
43
+ message: r.message,
44
+ asset: r.assetId,
45
+ }));
46
+ }
@@ -0,0 +1,170 @@
1
+ import { isLocationValue, MAX_FILES, } from "@engenty-wizards/shared/definition";
2
+ function empty(v) {
3
+ return v === undefined || v === null || v === "" || (Array.isArray(v) && v.length === 0);
4
+ }
5
+ function coerce(field, raw) {
6
+ if (raw === undefined || raw === null) {
7
+ return undefined;
8
+ }
9
+ switch (field.kind) {
10
+ case "number": {
11
+ if (raw === "") {
12
+ return undefined;
13
+ }
14
+ const n = Number(String(raw).replace(",", "."));
15
+ return Number.isFinite(n) ? n : Number.NaN;
16
+ }
17
+ case "toggle":
18
+ return raw === true || raw === "true" || raw === "on";
19
+ case "multiselect":
20
+ return (Array.isArray(raw) ? raw : [raw])
21
+ .map(String)
22
+ .filter((v) => field.options?.includes(v));
23
+ case "image":
24
+ case "file": {
25
+ const ids = (Array.isArray(raw) ? raw : [raw])
26
+ .filter((v) => typeof v === "string" && v.length > 0)
27
+ .slice(0, MAX_FILES);
28
+ if (!ids.length) {
29
+ return undefined;
30
+ }
31
+ return field.multiple ? ids : ids[0];
32
+ }
33
+ case "signature":
34
+ return typeof raw === "string" && raw ? raw.slice(0, 64) : undefined;
35
+ case "audio":
36
+ return readAudio(raw);
37
+ case "location":
38
+ return readLocation(raw);
39
+ // The account and the list live in the wizard's store, not in the page's answers.
40
+ case "connection":
41
+ case "list":
42
+ return undefined;
43
+ case "items": {
44
+ if (!Array.isArray(raw)) {
45
+ return [];
46
+ }
47
+ const cols = field.columns ?? [];
48
+ return raw
49
+ .filter((r) => r && typeof r === "object")
50
+ .map((r) => Object.fromEntries(cols.map((c) => {
51
+ const v = r[c.id];
52
+ if (c.kind === "text") {
53
+ return [c.id, String(v ?? "").slice(0, 2000)];
54
+ }
55
+ const n = Number(String(v ?? "").replace(",", "."));
56
+ return [c.id, Number.isFinite(n) ? n : 0];
57
+ })))
58
+ .filter((r) => Object.values(r).some((v) => v !== "" && v !== 0))
59
+ .slice(0, 200);
60
+ }
61
+ default:
62
+ return String(raw).slice(0, 20_000);
63
+ }
64
+ }
65
+ function finite(v) {
66
+ const n = typeof v === "number" ? v : typeof v === "string" && v.trim() ? Number(v) : Number.NaN;
67
+ return Number.isFinite(n) ? n : undefined;
68
+ }
69
+ /**
70
+ * A position from the device, a typed place, or both. Coordinates outside the globe are dropped,
71
+ * so a step never reads a point that cannot exist.
72
+ */
73
+ function readLocation(raw) {
74
+ if (typeof raw === "string") {
75
+ const label = raw.trim().slice(0, 300);
76
+ return label ? { label } : undefined;
77
+ }
78
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
79
+ return undefined;
80
+ }
81
+ const input = raw;
82
+ const out = {};
83
+ const lat = finite(input.lat);
84
+ const lng = finite(input.lng);
85
+ if (lat !== undefined && lng !== undefined && Math.abs(lat) <= 90 && Math.abs(lng) <= 180) {
86
+ out.lat = Math.round(lat * 1e6) / 1e6;
87
+ out.lng = Math.round(lng * 1e6) / 1e6;
88
+ const accuracy = finite(input.accuracy);
89
+ if (accuracy !== undefined && accuracy >= 0) {
90
+ out.accuracy = Math.round(accuracy);
91
+ }
92
+ }
93
+ const label = typeof input.label === "string" ? input.label.trim().slice(0, 300) : "";
94
+ if (label) {
95
+ out.label = label;
96
+ }
97
+ return isLocationValue(out) ? out : undefined;
98
+ }
99
+ /** A recording by its upload id; a transcript the page already shows travels with it. */
100
+ function readAudio(raw) {
101
+ const input = typeof raw === "string" ? { asset: raw } : raw;
102
+ if (!input || typeof input !== "object" || typeof input.asset !== "string" || !input.asset) {
103
+ return undefined;
104
+ }
105
+ const out = { asset: input.asset.slice(0, 64) };
106
+ const seconds = finite(input.seconds);
107
+ if (seconds !== undefined && seconds >= 0) {
108
+ out.seconds = Math.round(seconds);
109
+ }
110
+ if (typeof input.transcript === "string") {
111
+ out.transcript = input.transcript.slice(0, 20_000);
112
+ }
113
+ return out;
114
+ }
115
+ /** Keep only this page's fields, typed; report what is missing or wrong. */
116
+ export function readPageInput(step, input) {
117
+ const values = {};
118
+ const errors = [];
119
+ for (const field of step.fields) {
120
+ const v = coerce(field, input[field.id]);
121
+ if (field.kind === "connection" || field.kind === "list") {
122
+ continue;
123
+ }
124
+ if (field.required && empty(v) && field.kind !== "toggle") {
125
+ errors.push({ field: field.id, message: "Pflichtfeld" });
126
+ continue;
127
+ }
128
+ if (Array.isArray(v) && (field.kind === "image" || field.kind === "file")) {
129
+ if (field.min && v.length < field.min) {
130
+ errors.push({ field: field.id, message: `Bitte mindestens ${field.min} auswählen` });
131
+ continue;
132
+ }
133
+ if (field.max && v.length > field.max) {
134
+ errors.push({
135
+ field: field.id,
136
+ message: `Höchstens ${field.max} – bitte einige entfernen`,
137
+ });
138
+ continue;
139
+ }
140
+ }
141
+ if (field.kind === "number" && Number.isNaN(v)) {
142
+ errors.push({ field: field.id, message: "Bitte eine Zahl eingeben" });
143
+ continue;
144
+ }
145
+ if (field.kind === "select" && !empty(v) && !field.options?.includes(String(v))) {
146
+ errors.push({ field: field.id, message: "Ungültige Auswahl" });
147
+ continue;
148
+ }
149
+ if (field.kind === "email" && !empty(v) && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(v))) {
150
+ errors.push({ field: field.id, message: "Keine gültige E-Mail-Adresse" });
151
+ continue;
152
+ }
153
+ if (field.kind === "url" && !empty(v)) {
154
+ try {
155
+ new URL(String(v));
156
+ }
157
+ catch {
158
+ errors.push({ field: field.id, message: "Keine gültige URL" });
159
+ continue;
160
+ }
161
+ }
162
+ if (v !== undefined) {
163
+ values[field.id] = v;
164
+ }
165
+ }
166
+ return { values, errors };
167
+ }
168
+ export function defaultsFor(step) {
169
+ return Object.fromEntries(step.fields.filter((f) => f.default !== undefined).map((f) => [f.id, f.default]));
170
+ }
@@ -0,0 +1,51 @@
1
+ import { allFields, isAudioValue } from "@engenty-wizards/shared/definition";
2
+ import { loadAsset } from "../files/storage.js";
3
+ import { transcribeAudio } from "../media/transcribe.js";
4
+ /**
5
+ * Gets the person's answers ready for a step that works on its own: a voice note is listened to
6
+ * once and kept as text with the answer, and a recording or signature that is not this run's own
7
+ * upload is dropped. Runs before every automatic step; what is already done costs nothing.
8
+ */
9
+ export async function prepareInputs(ctx) {
10
+ const values = ctx.state.values;
11
+ for (const field of allFields(ctx.def)) {
12
+ const value = values[field.id];
13
+ if (field.kind === "signature" && typeof value === "string") {
14
+ const drawn = await loadAsset(value);
15
+ if (drawn?.row.runId !== ctx.runId || !drawn.row.mime.startsWith("image/")) {
16
+ delete values[field.id];
17
+ }
18
+ continue;
19
+ }
20
+ if (field.kind !== "audio" || !isAudioValue(value)) {
21
+ continue;
22
+ }
23
+ if (value.transcript !== undefined) {
24
+ continue;
25
+ }
26
+ const found = await loadAsset(value.asset);
27
+ if (!found || found.row.runId !== ctx.runId || !/^(audio|video)\//.test(found.row.mime)) {
28
+ delete values[field.id];
29
+ continue;
30
+ }
31
+ await ctx.emit("info", `Hört „${field.label}“ an …`);
32
+ try {
33
+ const transcript = await transcribeAudio({
34
+ bytes: new Uint8Array(found.data),
35
+ mediaType: found.row.mime,
36
+ abortSignal: ctx.signal,
37
+ call: ctx.call,
38
+ });
39
+ await ctx.chargeUsd(transcript.costUsd);
40
+ values[field.id] = { ...value, transcript: transcript.text };
41
+ }
42
+ catch (err) {
43
+ if (ctx.signal.aborted) {
44
+ throw err;
45
+ }
46
+ // The step goes on without the words; the next one tries again.
47
+ console.error(`[run ${ctx.runId}] transcribe ${field.id}`, err);
48
+ await ctx.emit("info", `„${field.label}“ konnte nicht verschriftlicht werden.`);
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,124 @@
1
+ import { isDecisionStep, } from "@engenty-wizards/shared/definition";
2
+ import { classProblem } from "../models.js";
3
+ /**
4
+ * What a wizard needs of the models before a run starts: each class its steps call, and whether
5
+ * this runtime can serve it. A step every run passes through blocks the start when its class is
6
+ * missing; a step behind a branch only warns, since the person may choose around it.
7
+ */
8
+ /** The classes a step calls, as ../engine/steps.ts and ../media/generate.ts call them. */
9
+ export function stepClasses(step) {
10
+ switch (step.type) {
11
+ case "agent": {
12
+ if (isDecisionStep(step)) {
13
+ return ["classifier"];
14
+ }
15
+ const classes = [step.model ?? "high"];
16
+ if (step.tools.includes("image")) {
17
+ classes.push("image");
18
+ }
19
+ if (step.output.format === "json") {
20
+ classes.push("classifier");
21
+ }
22
+ return classes;
23
+ }
24
+ case "generate":
25
+ switch (step.asset) {
26
+ case "image":
27
+ return ["standard", "image"];
28
+ case "video":
29
+ return ["standard", "video"];
30
+ case "voice":
31
+ return ["speech"];
32
+ default:
33
+ return [step.model ?? "high"];
34
+ }
35
+ default:
36
+ // Pages, reviews (they redo a generate step counted already), widgets, results.
37
+ return [];
38
+ }
39
+ }
40
+ /** The steps every run passes through: without one of them the end is not reachable. */
41
+ export function unavoidableSteps(def) {
42
+ const index = new Map(def.steps.map((s, i) => [s.id, i]));
43
+ const successors = (i) => {
44
+ const out = (def.steps[i].next ?? [])
45
+ .map((rule) => (rule.goto === "end" ? def.steps.length : (index.get(rule.goto) ?? -1)))
46
+ .filter((j) => j >= 0);
47
+ // No rule matching goes on to the next step (or ends after the last).
48
+ out.push(i + 1);
49
+ return out;
50
+ };
51
+ const reachesEnd = (without) => {
52
+ if (without === 0) {
53
+ return false;
54
+ }
55
+ const seen = new Set([0]);
56
+ const queue = [0];
57
+ while (queue.length) {
58
+ const i = queue.shift();
59
+ if (i >= def.steps.length) {
60
+ return true;
61
+ }
62
+ for (const j of successors(i)) {
63
+ if (j !== without && !seen.has(j)) {
64
+ seen.add(j);
65
+ queue.push(j);
66
+ }
67
+ }
68
+ }
69
+ return false;
70
+ };
71
+ return new Set(def.steps.filter((_, i) => !reachesEnd(i)).map((s) => s.id));
72
+ }
73
+ /** The classes this wizard needs that this runtime cannot serve; empty = every step can run. */
74
+ export async function missingModels(def) {
75
+ const unavoidable = unavoidableSteps(def);
76
+ const needs = new Map();
77
+ for (const step of def.steps) {
78
+ for (const cls of new Set(stepClasses(step))) {
79
+ needs.set(cls, [...(needs.get(cls) ?? []), step]);
80
+ }
81
+ }
82
+ const missing = [];
83
+ for (const [cls, steps] of needs) {
84
+ const problem = await classProblem(cls);
85
+ if (problem) {
86
+ missing.push({
87
+ cls,
88
+ problem,
89
+ steps: steps.map((s) => ({ id: s.id, title: s.title })),
90
+ blocking: steps.some((s) => unavoidable.has(s.id)),
91
+ });
92
+ }
93
+ }
94
+ return missing;
95
+ }
96
+ /** The message a run that cannot start gives, naming the steps and why. */
97
+ export function blockingMessage(missing) {
98
+ const blocking = missing.filter((m) => m.blocking);
99
+ if (!blocking.length) {
100
+ return null;
101
+ }
102
+ return blocking
103
+ .map((m) => `${m.steps.map((s) => `„${s.title}“`).join(", ")}: ${m.problem}`)
104
+ .join(" ");
105
+ }
106
+ /** The class a marketplace capability stands for; the rest need no model of their own. */
107
+ const CAPABILITY_CLASS = {
108
+ text: "standard",
109
+ documents: "standard",
110
+ image: "image",
111
+ video: "video",
112
+ speech: "speech",
113
+ listening: "audio",
114
+ };
115
+ /** The capabilities this runtime has no model for. */
116
+ export async function missingCapabilities() {
117
+ const missing = new Set();
118
+ for (const [capability, cls] of Object.entries(CAPABILITY_CLASS)) {
119
+ if (await classProblem(cls)) {
120
+ missing.add(capability);
121
+ }
122
+ }
123
+ return missing;
124
+ }
@@ -0,0 +1,89 @@
1
+ import { webContext } from "../render/chromium.js";
2
+ import { createSandbox } from "../sandbox/index.js";
3
+ import { getSecret, putSecret } from "../store/index.js";
4
+ /** Sign-ins the person asked the wizard to keep, as Playwright storage state. */
5
+ const SESSION_SLOT = "browser";
6
+ /**
7
+ * What a run holds while an agent works: a browser context and a sandbox, both made on first
8
+ * use and released when the run stops running.
9
+ */
10
+ export class RunResources {
11
+ runId;
12
+ context = null;
13
+ page = null;
14
+ sandbox = null;
15
+ scope = null;
16
+ /** Changes the person allowed for the rest of this run, as "<connection>:<action>". */
17
+ allowed = new Set();
18
+ constructor(runId) {
19
+ this.runId = runId;
20
+ }
21
+ /** Whose store kept sign-ins are read from and written to. */
22
+ bind(scope) {
23
+ this.scope = scope;
24
+ }
25
+ async browserContext() {
26
+ if (!this.context) {
27
+ const kept = this.scope
28
+ ? await getSecret(this.scope, SESSION_SLOT).catch(() => null)
29
+ : null;
30
+ this.context = await webContext({
31
+ locale: "de-DE",
32
+ ...(kept ? { storageState: kept.data } : {}),
33
+ });
34
+ }
35
+ return this.context;
36
+ }
37
+ async browserPage() {
38
+ const context = await this.browserContext();
39
+ if (!this.page || this.page.isClosed()) {
40
+ this.page = await context.newPage();
41
+ }
42
+ return this.page;
43
+ }
44
+ /** The page the agent has open, if any — without opening a browser for the question. */
45
+ openPage() {
46
+ return this.page && !this.page.isClosed() ? this.page : null;
47
+ }
48
+ /** A link opened a new tab: the agent goes on there. */
49
+ adopt(page) {
50
+ this.page = page;
51
+ }
52
+ /** Keeps the browser's sign-ins for the person's next run (they ticked "remember"). */
53
+ async keepSession() {
54
+ if (this.context && this.scope) {
55
+ await putSecret(this.scope, SESSION_SLOT, "browser", "Browser-Anmeldungen", await this.context.storageState());
56
+ }
57
+ }
58
+ sandboxHandle() {
59
+ this.sandbox ??= createSandbox(this.runId);
60
+ return this.sandbox;
61
+ }
62
+ async release() {
63
+ const context = this.context;
64
+ const sandbox = this.sandbox;
65
+ this.context = null;
66
+ this.page = null;
67
+ this.sandbox = null;
68
+ await context?.close().catch(() => undefined);
69
+ await sandbox?.destroy().catch(() => undefined);
70
+ }
71
+ }
72
+ const live = new Map();
73
+ export function resourcesFor(runId) {
74
+ let r = live.get(runId);
75
+ if (!r) {
76
+ r = new RunResources(runId);
77
+ live.set(runId, r);
78
+ }
79
+ return r;
80
+ }
81
+ /** The resources of a run that is working right now, if it has any. */
82
+ export function liveResources(runId) {
83
+ return live.get(runId) ?? null;
84
+ }
85
+ export async function releaseResources(runId) {
86
+ const r = live.get(runId);
87
+ live.delete(runId);
88
+ await r?.release();
89
+ }