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,216 @@
1
+ /**
2
+ * Space-table column definitions.
3
+ *
4
+ * A table is a small database, not a CSV dump: every column has a type and a
5
+ * display format. Agents create the definition; row writes are validated
6
+ * against it.
7
+ */
8
+ import { z } from "zod";
9
+ const COLUMN_ID = /^[a-z][a-z0-9_]*$/;
10
+ const columnBaseSchema = z.object({
11
+ description: z.string().max(1024).optional(),
12
+ /**
13
+ * Where the cell is edited. Omit to use the type default:
14
+ * single-line text and booleans are in-field; everything else is a popout.
15
+ */
16
+ edit: z.enum(["inline", "popout"]).optional(),
17
+ id: z
18
+ .string()
19
+ .min(1)
20
+ .max(64)
21
+ .regex(COLUMN_ID, "column id must be a lowercase slug (a-z, 0-9, _)"),
22
+ name: z.string().min(1).max(128),
23
+ required: z.boolean().optional(),
24
+ });
25
+ export const numberStyleSchema = z.enum([
26
+ "integer",
27
+ "decimal",
28
+ "percent",
29
+ "currency",
30
+ ]);
31
+ export const numberFormatSchema = z
32
+ .object({
33
+ currency: z
34
+ .string()
35
+ .regex(/^[A-Z]{3}$/, "currency must be an ISO 4217 code")
36
+ .optional(),
37
+ fractionDigits: z.number().int().min(0).max(8).optional(),
38
+ grouping: z.boolean().optional(),
39
+ style: numberStyleSchema,
40
+ })
41
+ .superRefine((val, ctx) => {
42
+ if (val.style === "currency" && !val.currency) {
43
+ ctx.addIssue({
44
+ code: "custom",
45
+ message: "currency style needs an ISO 4217 code",
46
+ path: ["currency"],
47
+ });
48
+ }
49
+ if (val.style !== "currency" && val.currency) {
50
+ ctx.addIssue({
51
+ code: "custom",
52
+ message: "currency is only valid on currency columns",
53
+ path: ["currency"],
54
+ });
55
+ }
56
+ });
57
+ export const dateKindSchema = z.enum(["date", "datetime", "time"]);
58
+ export const dateStyleSchema = z.enum(["short", "medium", "long", "iso"]);
59
+ /** `hours` is clock time with no minutes — `14` or `14:30` both store as `14:00`. */
60
+ export const timePrecisionSchema = z.enum(["hours", "minutes", "seconds"]);
61
+ export const dateFormatSchema = z.object({
62
+ dateStyle: dateStyleSchema.optional(),
63
+ kind: dateKindSchema,
64
+ timePrecision: timePrecisionSchema.optional(),
65
+ });
66
+ export const durationUnitSchema = z.enum([
67
+ "milliseconds",
68
+ "seconds",
69
+ "minutes",
70
+ "hours",
71
+ "days",
72
+ ]);
73
+ export const durationDisplaySchema = z.enum([
74
+ "hms",
75
+ "hours",
76
+ "minutes",
77
+ "decimal-hours",
78
+ "iso",
79
+ ]);
80
+ export const durationFormatSchema = z.object({
81
+ display: durationDisplaySchema,
82
+ /** Unit a writer typically types; stored value is always milliseconds. */
83
+ inputUnit: durationUnitSchema,
84
+ });
85
+ export const selectOptionSchema = z.object({
86
+ id: z.string().min(1).max(64),
87
+ label: z.string().min(1).max(128),
88
+ });
89
+ export const selectFormatSchema = z.object({
90
+ /** Values outside `options` are kept as-is instead of rejected. */
91
+ allowCustom: z.boolean(),
92
+ multiple: z.boolean().optional(),
93
+ options: z.array(selectOptionSchema).max(200),
94
+ });
95
+ export const textStyleSchema = z.enum(["single", "multiline", "markdown"]);
96
+ export const textFormatSchema = z.object({
97
+ /** `single` is one line; `multiline` is plain wrapping text; `markdown` is inline marks. */
98
+ style: textStyleSchema.default("single"),
99
+ });
100
+ export const tableColumnSchema = z.discriminatedUnion("type", [
101
+ columnBaseSchema.extend({
102
+ format: textFormatSchema.optional(),
103
+ type: z.literal("text"),
104
+ }),
105
+ columnBaseSchema.extend({
106
+ format: numberFormatSchema,
107
+ type: z.literal("number"),
108
+ }),
109
+ columnBaseSchema.extend({
110
+ format: dateFormatSchema,
111
+ type: z.literal("date"),
112
+ }),
113
+ columnBaseSchema.extend({
114
+ format: durationFormatSchema,
115
+ type: z.literal("duration"),
116
+ }),
117
+ columnBaseSchema.extend({
118
+ format: selectFormatSchema,
119
+ type: z.literal("select"),
120
+ }),
121
+ columnBaseSchema.extend({ type: z.literal("boolean") }),
122
+ ]);
123
+ export function textColumnStyle(column) {
124
+ return column.type === "text" ? (column.format?.style ?? "single") : "single";
125
+ }
126
+ /** Where this cell is edited. Explicit `edit` wins; otherwise type defaults. */
127
+ export function columnEdit(column) {
128
+ if (column.edit) {
129
+ return column.edit;
130
+ }
131
+ if (column.type === "boolean") {
132
+ return "inline";
133
+ }
134
+ if (column.type === "text" && textColumnStyle(column) === "single") {
135
+ return "inline";
136
+ }
137
+ return "popout";
138
+ }
139
+ export const tableColumnsSchema = z
140
+ .array(tableColumnSchema)
141
+ .min(1)
142
+ .max(64)
143
+ .superRefine((columns, ctx) => {
144
+ const seen = new Set();
145
+ for (let i = 0; i < columns.length; i++) {
146
+ const id = columns[i]?.id;
147
+ if (!id) {
148
+ continue;
149
+ }
150
+ if (seen.has(id)) {
151
+ ctx.addIssue({
152
+ code: "custom",
153
+ message: `duplicate column id "${id}"`,
154
+ path: [i, "id"],
155
+ });
156
+ }
157
+ seen.add(id);
158
+ }
159
+ });
160
+ /**
161
+ * The shape a MODEL is shown for `columns`, as opposed to the one we validate.
162
+ *
163
+ * `tableColumnsSchema` is a six-branch discriminated union that repeats the
164
+ * whole column base per branch. As a tool's JSON Schema that came to 14.7 KB —
165
+ * on its own 5% of a copilot prompt, resent on every model call of every run,
166
+ * whether or not a table is in play. The union earns that as a *contract*; it
167
+ * does not earn it as a *hint*.
168
+ *
169
+ * So the wire shape is one flat object with every format key optional, and the
170
+ * tool re-parses the result with `tableColumnsSchema` before doing anything.
171
+ * Validation is unchanged and the error the model gets back is the strict
172
+ * schema's own; only the advertisement shrinks. Per-type rules live in the
173
+ * tool description, which the model reads anyway.
174
+ */
175
+ export const tableColumnWireSchema = z.object({
176
+ description: z.string().optional(),
177
+ edit: z.enum(["inline", "popout"]).optional(),
178
+ format: z
179
+ .object({
180
+ allowCustom: z.boolean().optional(),
181
+ currency: z.string().optional(),
182
+ dateStyle: z.enum(["short", "medium", "long", "iso"]).optional(),
183
+ display: durationDisplaySchema.optional(),
184
+ fractionDigits: z.number().int().optional(),
185
+ grouping: z.boolean().optional(),
186
+ inputUnit: durationUnitSchema.optional(),
187
+ kind: dateKindSchema.optional(),
188
+ multiple: z.boolean().optional(),
189
+ options: z.array(selectOptionSchema).optional(),
190
+ // `style` spans text and number columns; which values are legal follows
191
+ // from `type`, and the strict schema is what decides.
192
+ style: z
193
+ .enum([
194
+ "single",
195
+ "multiline",
196
+ "markdown",
197
+ "integer",
198
+ "decimal",
199
+ "percent",
200
+ "currency",
201
+ ])
202
+ .optional(),
203
+ timePrecision: timePrecisionSchema.optional(),
204
+ })
205
+ .optional(),
206
+ id: z.string(),
207
+ name: z.string(),
208
+ required: z.boolean().optional(),
209
+ type: z.enum(["text", "number", "date", "duration", "select", "boolean"]),
210
+ });
211
+ export const tableColumnsWireSchema = z.array(tableColumnWireSchema);
212
+ export const DATA_TABLE_ARTIFACT_TYPE = "database";
213
+ export const DATA_TABLE_MIME_TYPE = "application/vnd.engenty.database+json";
214
+ export const dataTableHandleSchema = z.object({
215
+ table_id: z.string().uuid(),
216
+ });
@@ -0,0 +1,3 @@
1
+ export { type ColumnEdit, columnEdit, DATA_TABLE_ARTIFACT_TYPE, DATA_TABLE_MIME_TYPE, type DataTableHandle, type DateFormat, type DateKind, type DateStyle, type DurationDisplay, type DurationFormat, type DurationUnit, dataTableHandleSchema, dateFormatSchema, durationFormatSchema, type NumberFormat, type NumberStyle, numberFormatSchema, type SelectFormat, type SelectOption, selectFormatSchema, type TableColumn, type TableColumnWire, type TextFormat, type TextStyle, type TimePrecision, tableColumnSchema, tableColumnsSchema, tableColumnsWireSchema, tableColumnWireSchema, textColumnStyle, textFormatSchema, textStyleSchema, } from "./columns.js";
2
+ export { formatDateCell, formatDurationCell, formatNumberCell, formatTableCell, } from "./columns-format.js";
3
+ export { coerceColumnValue, coerceRowValues, mergeRowValues, parseTableColumns, TableColumnValueError, } from "./columns-value.js";
@@ -0,0 +1,3 @@
1
+ export { columnEdit, DATA_TABLE_ARTIFACT_TYPE, DATA_TABLE_MIME_TYPE, dataTableHandleSchema, dateFormatSchema, durationFormatSchema, numberFormatSchema, selectFormatSchema, tableColumnSchema, tableColumnsSchema, tableColumnsWireSchema, tableColumnWireSchema, textColumnStyle, textFormatSchema, textStyleSchema, } from "./columns.js";
2
+ export { formatDateCell, formatDurationCell, formatNumberCell, formatTableCell, } from "./columns-format.js";
3
+ export { coerceColumnValue, coerceRowValues, mergeRowValues, parseTableColumns, TableColumnValueError, } from "./columns-value.js";
@@ -0,0 +1,14 @@
1
+ export type CatalogSearchEntry = Record<string, unknown>;
2
+ export type CatalogFieldWeights = ReadonlyArray<readonly [string, number]>;
3
+ export declare const CATALOG_FIELD_WEIGHTS: CatalogFieldWeights;
4
+ export declare function tokenizeCatalogText(value: string): string[];
5
+ export declare function stringifyCatalogSearchValue(value: unknown): string;
6
+ /**
7
+ * Weighted "key: value" text for an entry — the canonical input for
8
+ * embedding an entry when a consumer layers semantic search on top.
9
+ */
10
+ export declare function buildCatalogSearchText(entry: CatalogSearchEntry, weights?: CatalogFieldWeights): string;
11
+ /** BM25-like weighted-field lexical score; 0 when the query has no overlap. */
12
+ export declare function scoreCatalogEntry(entry: CatalogSearchEntry, query?: string, weights?: CatalogFieldWeights): number;
13
+ /** Sort entries by precomputed lexical score, dropping zero-score entries. */
14
+ export declare function rankLexically<T extends CatalogSearchEntry>(entries: T[], lexicalScores: number[]): T[];
@@ -0,0 +1,166 @@
1
+ // Shared lexical scoring for API-catalog-shaped entries.
2
+ //
3
+ // Extracted from apps/core's api-catalog search so both apps/core (the
4
+ // `core_api_catalog_search` gateway method, lexical-only) and apps/ai
5
+ // (the agent-facing catalog provider, which layers semantic reranking on
6
+ // top) score entries the same way. Entries are plain records; callers
7
+ // pick which fields matter via a weight list.
8
+ // Default weights match the historical apps/core catalog ranking (entries
9
+ // produced by buildApiCatalog: HTTP routes + tool operations).
10
+ export const CATALOG_FIELD_WEIGHTS = [
11
+ ["id", 8],
12
+ ["toolId", 10],
13
+ ["moduleId", 7],
14
+ ["pluginId", 6],
15
+ ["title", 6],
16
+ ["description", 4],
17
+ ["tags", 3],
18
+ ["path", 3],
19
+ ["inputSchema", 2],
20
+ ["outputSchema", 2],
21
+ ["request", 1],
22
+ ["response", 1],
23
+ ];
24
+ function normalizeText(value) {
25
+ return value
26
+ .normalize("NFKD")
27
+ .replace(/[̀-ͯ]/g, "")
28
+ .replace(/([a-z])([A-Z])/g, "$1 $2")
29
+ .toLowerCase();
30
+ }
31
+ export function tokenizeCatalogText(value) {
32
+ return normalizeText(value)
33
+ .split(/[^a-z0-9]+/)
34
+ .map((token) => token.trim())
35
+ .filter((token) => token.length > 1);
36
+ }
37
+ export function stringifyCatalogSearchValue(value) {
38
+ if (value == null) {
39
+ return "";
40
+ }
41
+ if (Array.isArray(value)) {
42
+ return value.map(stringifyCatalogSearchValue).filter(Boolean).join(" ");
43
+ }
44
+ if (typeof value === "object") {
45
+ return Object.values(value)
46
+ .map(stringifyCatalogSearchValue)
47
+ .filter(Boolean)
48
+ .join(" ");
49
+ }
50
+ return String(value);
51
+ }
52
+ function buildSearchDocument(entry, weights) {
53
+ const fields = weights
54
+ .map(([key, weight]) => ({
55
+ text: stringifyCatalogSearchValue(entry[key]),
56
+ weight,
57
+ }))
58
+ .filter((field) => field.text.length > 0);
59
+ const tokens = fields.flatMap((field) => tokenizeCatalogText(field.text));
60
+ return { fields, tokens };
61
+ }
62
+ /**
63
+ * Weighted "key: value" text for an entry — the canonical input for
64
+ * embedding an entry when a consumer layers semantic search on top.
65
+ */
66
+ export function buildCatalogSearchText(entry, weights = CATALOG_FIELD_WEIGHTS) {
67
+ return weights
68
+ .map(([key]) => {
69
+ const value = stringifyCatalogSearchValue(entry[key]);
70
+ return value ? `${key}: ${value}` : "";
71
+ })
72
+ .filter(Boolean)
73
+ .join("\n");
74
+ }
75
+ function inflectionStems(token) {
76
+ const stems = [token];
77
+ if (token.length < 5) {
78
+ return stems;
79
+ }
80
+ if (token.endsWith("ing")) {
81
+ const base = token.slice(0, -3);
82
+ if (base.length >= 3) {
83
+ stems.push(base, `${base}e`);
84
+ }
85
+ }
86
+ else if (token.endsWith("ies") && token.length >= 6) {
87
+ stems.push(`${token.slice(0, -3)}y`);
88
+ }
89
+ else if (token.endsWith("es")) {
90
+ stems.push(token.slice(0, -2), token.slice(0, -1));
91
+ }
92
+ else if (token.endsWith("ed")) {
93
+ const base = token.slice(0, -2);
94
+ stems.push(base, `${base}e`);
95
+ }
96
+ else if (token.endsWith("s") && !token.endsWith("ss")) {
97
+ stems.push(token.slice(0, -1));
98
+ }
99
+ return [...new Set(stems)];
100
+ }
101
+ function tokenMatchStrength(queryToken, candidate) {
102
+ if (queryToken === candidate) {
103
+ return 1;
104
+ }
105
+ let best = 0;
106
+ for (const queryStem of inflectionStems(queryToken)) {
107
+ for (const candidateStem of inflectionStems(candidate)) {
108
+ if (queryStem === candidateStem) {
109
+ best = Math.max(best, queryStem === queryToken && candidateStem === candidate ? 1 : 0.75);
110
+ continue;
111
+ }
112
+ if (queryStem.length >= 2 && candidateStem.startsWith(queryStem)) {
113
+ best = Math.max(best, 0.55 * (queryStem.length / candidateStem.length));
114
+ }
115
+ if (candidateStem.length >= 4 && queryStem.startsWith(candidateStem)) {
116
+ best = Math.max(best, 0.4 * (candidateStem.length / queryStem.length));
117
+ }
118
+ }
119
+ }
120
+ return best;
121
+ }
122
+ function weightedTokenFrequency(tokens, queryToken) {
123
+ return tokens.reduce((sum, token) => sum + tokenMatchStrength(queryToken, token), 0);
124
+ }
125
+ /** BM25-like weighted-field lexical score; 0 when the query has no overlap. */
126
+ export function scoreCatalogEntry(entry, query, weights = CATALOG_FIELD_WEIGHTS) {
127
+ if (!query?.trim()) {
128
+ return 0;
129
+ }
130
+ const queryTokens = tokenizeCatalogText(query);
131
+ if (queryTokens.length === 0) {
132
+ return 0;
133
+ }
134
+ const document = buildSearchDocument(entry, weights);
135
+ if (document.tokens.length === 0) {
136
+ return 0;
137
+ }
138
+ return queryTokens.reduce((score, token) => {
139
+ const termFrequency = weightedTokenFrequency(document.tokens, token);
140
+ if (termFrequency === 0) {
141
+ return score;
142
+ }
143
+ const fieldScore = document.fields.reduce((sum, field) => {
144
+ const fieldTokens = tokenizeCatalogText(field.text);
145
+ const fieldFrequency = weightedTokenFrequency(fieldTokens, token);
146
+ if (fieldFrequency === 0) {
147
+ return sum;
148
+ }
149
+ const bm25Like = (fieldFrequency * 2.2) /
150
+ (fieldFrequency + 1.2 + fieldTokens.length / 16);
151
+ return sum + field.weight * bm25Like;
152
+ }, 0);
153
+ return score + fieldScore;
154
+ }, 0);
155
+ }
156
+ /** Sort entries by precomputed lexical score, dropping zero-score entries. */
157
+ export function rankLexically(entries, lexicalScores) {
158
+ return entries
159
+ .map((entry, index) => ({
160
+ entry,
161
+ score: lexicalScores[index] ?? 0,
162
+ }))
163
+ .filter((item) => item.score > 0)
164
+ .sort((a, b) => b.score - a.score)
165
+ .map((item) => item.entry);
166
+ }
@@ -0,0 +1,33 @@
1
+ import { type CatalogFieldWeights, type CatalogSearchEntry } from "./catalog-lexical.js";
2
+ export type CatalogRankStrategy = "hybrid" | "lexical" | "semantic";
3
+ /** Name/description records (space modules, skills, connections, agents). */
4
+ export declare const RECORD_CATALOG_FIELD_WEIGHTS: CatalogFieldWeights;
5
+ /**
6
+ * Rank name/description records by lexical BM25 (prefix + inflection).
7
+ * Empty query keeps input order; zero-score rows drop out.
8
+ */
9
+ export declare function rankRecordsLexically<T>(items: readonly T[], query: string, toRecord: (item: T) => CatalogSearchEntry, weights?: CatalogFieldWeights): T[];
10
+ export declare function cosineSimilarity(a: number[], b: number[]): number;
11
+ export declare function blendCatalogScores(params: {
12
+ lexical: number;
13
+ maxLexical: number;
14
+ semantic: number;
15
+ strategy: CatalogRankStrategy;
16
+ }): number;
17
+ export interface ScoredCatalogItem<T> {
18
+ entry: T;
19
+ lexical: number;
20
+ score: number;
21
+ semantic: number;
22
+ }
23
+ /**
24
+ * Sort catalog rows by blended score. Lexical hits always survive; semantic
25
+ * hits need to clear `minSemantic` (default 0 means any cosine > 0).
26
+ */
27
+ export declare function rankScoredCatalog<T>(items: ReadonlyArray<{
28
+ entry: T;
29
+ lexical: number;
30
+ semantic: number;
31
+ }>, strategy: CatalogRankStrategy, options?: {
32
+ minSemantic?: number;
33
+ }): ScoredCatalogItem<T>[];
@@ -0,0 +1,99 @@
1
+ // Shared hybrid ranking for catalog-shaped records.
2
+ //
3
+ // Lexical BM25 lives in catalog-lexical.ts. This module blends those scores
4
+ // with cosine similarity when a consumer (apps/ai today) supplies embeddings.
5
+ // UI pickers can call rankScoredCatalog with semantic=0 for lexical-only.
6
+ import { scoreCatalogEntry, } from "./catalog-lexical.js";
7
+ /** Name/description records (space modules, skills, connections, agents). */
8
+ export const RECORD_CATALOG_FIELD_WEIGHTS = [
9
+ ["name", 10],
10
+ ["id", 8],
11
+ ["title", 6],
12
+ ["summary", 6],
13
+ ["description", 6],
14
+ ["category", 5],
15
+ ["modules", 4],
16
+ ["connectorId", 4],
17
+ ["role", 3],
18
+ ["tags", 3],
19
+ ["source", 2],
20
+ ];
21
+ /**
22
+ * Rank name/description records by lexical BM25 (prefix + inflection).
23
+ * Empty query keeps input order; zero-score rows drop out.
24
+ */
25
+ export function rankRecordsLexically(items, query, toRecord, weights = RECORD_CATALOG_FIELD_WEIGHTS) {
26
+ const trimmed = query.trim();
27
+ if (!trimmed) {
28
+ return [...items];
29
+ }
30
+ return items
31
+ .map((item) => ({
32
+ item,
33
+ score: scoreCatalogEntry(toRecord(item), trimmed, weights),
34
+ }))
35
+ .filter((row) => row.score > 0)
36
+ .sort((left, right) => right.score - left.score)
37
+ .map((row) => row.item);
38
+ }
39
+ export function cosineSimilarity(a, b) {
40
+ const length = Math.min(a.length, b.length);
41
+ if (length === 0) {
42
+ return 0;
43
+ }
44
+ let dot = 0;
45
+ let left = 0;
46
+ let right = 0;
47
+ for (let index = 0; index < length; index += 1) {
48
+ const aValue = a[index] ?? 0;
49
+ const bValue = b[index] ?? 0;
50
+ dot += aValue * bValue;
51
+ left += aValue * aValue;
52
+ right += bValue * bValue;
53
+ }
54
+ const denominator = Math.sqrt(left) * Math.sqrt(right);
55
+ if (denominator === 0) {
56
+ return 0;
57
+ }
58
+ return dot / denominator;
59
+ }
60
+ export function blendCatalogScores(params) {
61
+ if (params.strategy === "lexical") {
62
+ return params.lexical;
63
+ }
64
+ if (params.strategy === "semantic") {
65
+ return params.semantic;
66
+ }
67
+ const normalizedLexical = params.maxLexical > 0 ? params.lexical / params.maxLexical : 0;
68
+ return params.semantic * 0.65 + normalizedLexical * 0.35;
69
+ }
70
+ /**
71
+ * Sort catalog rows by blended score. Lexical hits always survive; semantic
72
+ * hits need to clear `minSemantic` (default 0 means any cosine > 0).
73
+ */
74
+ export function rankScoredCatalog(items, strategy, options = {}) {
75
+ const minSemantic = options.minSemantic ?? 0;
76
+ const maxLexical = Math.max(...items.map((item) => item.lexical), 0);
77
+ return items
78
+ .map((item) => ({
79
+ entry: item.entry,
80
+ lexical: item.lexical,
81
+ score: blendCatalogScores({
82
+ lexical: item.lexical,
83
+ maxLexical,
84
+ semantic: item.semantic,
85
+ strategy,
86
+ }),
87
+ semantic: item.semantic,
88
+ }))
89
+ .filter((item) => {
90
+ if (strategy === "lexical") {
91
+ return item.lexical > 0;
92
+ }
93
+ if (strategy === "semantic") {
94
+ return item.semantic > minSemantic;
95
+ }
96
+ return item.lexical > 0 || item.semantic > minSemantic;
97
+ })
98
+ .sort((a, b) => b.score - a.score);
99
+ }
@@ -0,0 +1,35 @@
1
+ import { type WizardDefinition } from "./definition.js";
2
+ import type { ItemFormat, MarketplaceLang } from "./marketplace.js";
3
+ /** A step as the flow shows it: what happens there, not how — and where the flow branches. */
4
+ export interface OutlineStep {
5
+ id: string;
6
+ type: string;
7
+ title: string;
8
+ /** What a generate step makes. */
9
+ asset?: string;
10
+ /** A widget step that cuts a film. */
11
+ video?: boolean;
12
+ /** Where the flow goes on instead of the next step, and when. `to` is a step's id or `end`. */
13
+ branches?: {
14
+ to: string;
15
+ when: string;
16
+ }[];
17
+ }
18
+ /** What a person takes along at the end: each thing by its name, with the files it comes as. */
19
+ export interface EntryResult {
20
+ title: string;
21
+ kind: ItemFormat;
22
+ formats: string[];
23
+ }
24
+ /** What an entry's wizard is made of, as a reader sees it. */
25
+ export interface WizardOutline {
26
+ description: string;
27
+ outline: OutlineStep[];
28
+ results: EntryResult[];
29
+ /** The workspace files it starts with. */
30
+ files: string[];
31
+ }
32
+ export declare const outlineOf: (definition: WizardDefinition, lang: MarketplaceLang) => OutlineStep[];
33
+ export declare function resultsOf(definition: WizardDefinition): EntryResult[];
34
+ /** An entry's wizard as a reader sees it, in a language. */
35
+ export declare function wizardOutline(definition: WizardDefinition, files: string[], lang: MarketplaceLang): WizardOutline;
@@ -0,0 +1,86 @@
1
+ import { allFields, listRef } from "./definition.js";
2
+ /** When a branch is taken, in words: the field's label stands for its id. */
3
+ function condition(definition, rule, lang) {
4
+ const { field, op, value } = rule.when;
5
+ const name = allFields(definition).find((f) => f.id === field)?.label ?? field.split(".").pop() ?? field;
6
+ const de = lang === "de";
7
+ // A toggle is often labelled "Mit …" already.
8
+ const bare = name.replace(/^(mit|with)\s+/i, "");
9
+ const without = de ? `ohne ${bare}` : `without ${bare}`;
10
+ const withIt = de ? `mit ${bare}` : `with ${bare}`;
11
+ // A toggle reads better as with / without than as "= true".
12
+ if (typeof value === "boolean" && (op === "equals" || op === "notEquals")) {
13
+ return (op === "equals") === value ? withIt : without;
14
+ }
15
+ const shown = Array.isArray(value) ? value.join(" / ") : String(value ?? "");
16
+ switch (op) {
17
+ case "equals":
18
+ return `${name}: ${shown}`;
19
+ case "notEquals":
20
+ return `${name} ≠ ${shown}`;
21
+ case "in":
22
+ return `${name}: ${shown}`;
23
+ case "notEmpty":
24
+ return withIt;
25
+ case "empty":
26
+ return without;
27
+ }
28
+ }
29
+ export const outlineOf = (definition, lang) => definition.steps.map((s) => ({
30
+ id: s.id,
31
+ type: s.type,
32
+ title: s.title,
33
+ ...(s.type === "generate" ? { asset: s.asset } : {}),
34
+ ...(s.type === "widget" && s.video ? { video: true } : {}),
35
+ ...(s.next?.length
36
+ ? {
37
+ branches: s.next.map((rule) => ({
38
+ to: rule.goto,
39
+ when: condition(definition, rule, lang),
40
+ })),
41
+ }
42
+ : {}),
43
+ }));
44
+ /** What a step hands over, as the marketplace sorts results. */
45
+ function resultKind(definition, from) {
46
+ if (listRef(from)) {
47
+ return "table";
48
+ }
49
+ const step = definition.steps.find((s) => s.id === from);
50
+ if (step?.type === "generate") {
51
+ return step.asset === "voice" ? "audio" : step.asset;
52
+ }
53
+ if (step?.type === "widget") {
54
+ return step.video ? "video" : "dashboard";
55
+ }
56
+ return step?.type === "agent" && step.output.format === "json" ? "table" : "text";
57
+ }
58
+ export function resultsOf(definition) {
59
+ const out = [];
60
+ for (const step of definition.steps) {
61
+ if (step.type !== "result") {
62
+ continue;
63
+ }
64
+ for (const d of step.deliverables) {
65
+ const list = listRef(d.from);
66
+ const title = d.label ??
67
+ (list
68
+ ? definition.lists?.find((l) => l.id === list)?.title
69
+ : definition.steps.find((s) => s.id === d.from)?.title) ??
70
+ d.from;
71
+ if (!out.some((r) => r.title === title)) {
72
+ out.push({ title, kind: resultKind(definition, d.from), formats: d.formats });
73
+ }
74
+ }
75
+ }
76
+ return out;
77
+ }
78
+ /** An entry's wizard as a reader sees it, in a language. */
79
+ export function wizardOutline(definition, files, lang) {
80
+ return {
81
+ description: definition.description,
82
+ outline: outlineOf(definition, lang),
83
+ results: resultsOf(definition),
84
+ files,
85
+ };
86
+ }
@@ -0,0 +1,20 @@
1
+ import { type MarketplaceFilters, type MarketplacePage, type MarketplaceSummary } from "./marketplace.js";
2
+ /** What a query is looked up by: its words, without the ones that say nothing. */
3
+ export declare function searchTerms(query: string): string[];
4
+ /** From this many words on a query is a sentence: it shares some word with nearly every entry. */
5
+ export declare const SENTENCE_WORDS = 3;
6
+ export declare const isSentence: (query: string) => boolean;
7
+ /** How well an entry answers the query by its words; 0 when it does not at all. */
8
+ export declare function scoreEntry(entry: MarketplaceSummary, query: string): number;
9
+ /** The entries a query finds by its words, best first. An empty query keeps the list as it is. */
10
+ export declare function rankEntries<T extends MarketplaceSummary>(entries: readonly T[], query: string): T[];
11
+ /** Whether an entry passes the filters. An entry made for any industry passes every industry. */
12
+ export declare function matchesFilters(e: MarketplaceSummary, f: MarketplaceFilters): boolean;
13
+ /**
14
+ * A search as the marketplace answers it: the entries the words find, best first (an empty
15
+ * query keeps the order given), narrowed by the filters, one page of them, and the counts.
16
+ */
17
+ export declare function searchEntries<T extends MarketplaceSummary>(entries: readonly T[], query: string, filters?: MarketplaceFilters, page?: {
18
+ limit?: number;
19
+ offset?: number;
20
+ }): MarketplacePage<T>;