qarpeo 0.1.34 → 0.2.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 (364) hide show
  1. package/README.md +114 -26
  2. package/dist/apps/cms.d.ts +4 -0
  3. package/dist/apps/comments.d.ts +4 -0
  4. package/dist/apps/payments.d.ts +4 -0
  5. package/dist/apps/store.d.ts +4 -0
  6. package/dist/chunks/auth-schema.mjs +169 -30
  7. package/dist/chunks/tools.mjs +1680 -0
  8. package/dist/cli/index.mjs +1256 -221
  9. package/dist/core/aliases.d.ts +5 -0
  10. package/dist/core/context.d.ts +10 -0
  11. package/dist/core/cross-drive.d.ts +2 -0
  12. package/dist/core/d1-migrate.d.ts +4 -0
  13. package/dist/core/devtools.d.ts +4 -0
  14. package/dist/core/nitro.d.ts +4 -0
  15. package/dist/core/schema.d.ts +4 -0
  16. package/dist/core/server-utils.d.ts +4 -0
  17. package/dist/core/wrangler.d.ts +4 -0
  18. package/dist/dev/wrangler.d.ts +1 -0
  19. package/dist/fate/index.d.ts +8 -8
  20. package/dist/features/agents.d.ts +4 -0
  21. package/dist/features/auth.d.ts +4 -0
  22. package/dist/features/bots.d.ts +4 -0
  23. package/dist/features/fate.d.ts +4 -0
  24. package/dist/features/mail.d.ts +4 -0
  25. package/dist/features/mcp.d.ts +4 -0
  26. package/dist/features/multitenant.d.ts +4 -0
  27. package/dist/features/notifications.d.ts +4 -0
  28. package/dist/features/realtime.d.ts +4 -0
  29. package/dist/module.d.ts +10 -2
  30. package/dist/module.mjs +6313 -5114
  31. package/dist/primitives/ai.d.ts +4 -0
  32. package/dist/primitives/analytics.d.ts +4 -0
  33. package/dist/primitives/blob.d.ts +4 -0
  34. package/dist/primitives/browser.d.ts +4 -0
  35. package/dist/primitives/cache.d.ts +4 -0
  36. package/dist/primitives/d1.d.ts +4 -0
  37. package/dist/primitives/do.d.ts +4 -0
  38. package/dist/primitives/email.d.ts +4 -0
  39. package/dist/primitives/hyperdrive.d.ts +4 -0
  40. package/dist/primitives/kv.d.ts +4 -0
  41. package/dist/primitives/queue.d.ts +4 -0
  42. package/dist/primitives/ratelimit.d.ts +4 -0
  43. package/dist/primitives/vectorize.d.ts +4 -0
  44. package/dist/primitives/workflows.d.ts +4 -0
  45. package/dist/runtime/ai.d.ts +3 -3
  46. package/dist/runtime/ai.mjs +8 -1
  47. package/dist/runtime/app/components/RealtimeCursors.vue +2 -2
  48. package/dist/runtime/app/composables/ai.d.ts +56 -29
  49. package/dist/runtime/app/composables/analytics.d.ts +26 -106
  50. package/dist/runtime/app/composables/api-tokens.d.ts +31 -34
  51. package/dist/runtime/app/composables/auth.d.ts +147 -51
  52. package/dist/runtime/app/composables/auth.mjs +0 -7
  53. package/dist/runtime/app/composables/chat.d.ts +38 -35
  54. package/dist/runtime/app/composables/cms-preview.d.ts +30 -25
  55. package/dist/runtime/app/composables/cms.d.ts +57 -282
  56. package/dist/runtime/app/composables/cms.mjs +0 -35
  57. package/dist/runtime/app/composables/comments.d.ts +32 -5
  58. package/dist/runtime/app/composables/comments.mjs +29 -1
  59. package/dist/runtime/app/composables/docs-version.d.ts +25 -28
  60. package/dist/runtime/app/composables/impersonation.d.ts +22 -5
  61. package/dist/runtime/app/composables/organization.d.ts +38 -91
  62. package/dist/runtime/app/composables/passkey.d.ts +22 -6
  63. package/dist/runtime/app/composables/passwordless.d.ts +24 -7
  64. package/dist/runtime/app/composables/payments.d.ts +50 -34
  65. package/dist/runtime/app/composables/payments.mjs +1 -0
  66. package/dist/runtime/app/composables/sse.d.ts +76 -0
  67. package/dist/runtime/app/composables/sse.mjs +152 -0
  68. package/dist/runtime/app/composables/storage.d.ts +53 -65
  69. package/dist/runtime/app/composables/storage.mjs +17 -0
  70. package/dist/runtime/app/composables/store.d.ts +198 -0
  71. package/dist/runtime/app/composables/store.mjs +414 -0
  72. package/dist/runtime/app/composables/tenant.d.ts +31 -72
  73. package/dist/runtime/app/composables/turnstile.d.ts +16 -3
  74. package/dist/runtime/app/composables/two-factor.d.ts +23 -6
  75. package/dist/runtime/app/pages/devtools/notifications.vue +30 -27
  76. package/dist/runtime/app/pages/devtools/realtime.vue +19 -31
  77. package/dist/runtime/app/pages/devtools.vue +0 -7
  78. package/dist/runtime/auth.d.ts +9 -9
  79. package/dist/runtime/blob.d.ts +10 -1
  80. package/dist/runtime/blob.mjs +83 -0
  81. package/dist/runtime/cache.d.ts +48 -0
  82. package/dist/runtime/cache.mjs +92 -0
  83. package/dist/runtime/comments.d.ts +4 -0
  84. package/dist/runtime/comments.mjs +2 -0
  85. package/dist/runtime/db.d.ts +21 -1
  86. package/dist/runtime/db.mjs +54 -0
  87. package/dist/runtime/drizzle.d.ts +4 -2
  88. package/dist/runtime/drizzle.mjs +68 -1
  89. package/dist/runtime/durable-object.d.ts +2 -0
  90. package/dist/runtime/durable-object.mjs +2 -0
  91. package/dist/runtime/email.d.ts +1 -1
  92. package/dist/runtime/email.mjs +1 -1
  93. package/dist/runtime/kv.mjs +50 -1
  94. package/dist/runtime/mcp.d.ts +2 -0
  95. package/dist/runtime/mcp.mjs +2 -0
  96. package/dist/runtime/queue.d.ts +12 -2
  97. package/dist/runtime/queue.mjs +19 -1
  98. package/dist/runtime/ratelimit.d.ts +1 -0
  99. package/dist/runtime/ratelimit.mjs +7 -0
  100. package/dist/runtime/schema.d.ts +313 -0
  101. package/dist/runtime/schema.mjs +259 -0
  102. package/dist/runtime/server/db/cms-schema.d.ts +1225 -171
  103. package/dist/runtime/server/db/cms-schema.mjs +69 -70
  104. package/dist/runtime/server/db/store-schema.d.ts +4344 -0
  105. package/dist/runtime/server/db/store-schema.mjs +266 -0
  106. package/dist/runtime/server/durable-objects/agent.mjs +35 -0
  107. package/dist/runtime/server/durable-objects/room.mjs +0 -1
  108. package/dist/runtime/server/middleware/ratelimit.mjs +10 -8
  109. package/dist/runtime/server/plugins/comments.d.ts +7 -0
  110. package/dist/runtime/server/plugins/comments.mjs +7 -0
  111. package/dist/runtime/server/plugins/email-inbound.d.ts +5 -0
  112. package/dist/runtime/server/plugins/email-inbound.mjs +17 -0
  113. package/dist/runtime/server/plugins/store.d.ts +7 -0
  114. package/dist/runtime/server/plugins/store.mjs +7 -0
  115. package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +2 -2
  116. package/dist/runtime/server/routes/atom.xml.get.mjs +3 -1
  117. package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +13 -2
  118. package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +9 -3
  119. package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +11 -3
  120. package/dist/runtime/server/routes/auth/account.delete.mjs +2 -1
  121. package/dist/runtime/server/routes/auth/audit-logs.get.mjs +1 -1
  122. package/dist/runtime/server/routes/auth/magic-link/send.post.d.ts +1 -9
  123. package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +8 -0
  124. package/dist/runtime/server/routes/auth/organization/sso/[id].delete.mjs +1 -1
  125. package/dist/runtime/server/routes/auth/organization/sso/index.get.mjs +1 -1
  126. package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +1 -1
  127. package/dist/runtime/server/routes/auth/otp/send.post.d.ts +1 -9
  128. package/dist/runtime/server/routes/auth/otp/send.post.mjs +8 -0
  129. package/dist/runtime/server/routes/auth/sso/login.get.mjs +3 -3
  130. package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +1 -1
  131. package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +2 -2
  132. package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
  133. package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +1 -1
  134. package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +2 -2
  135. package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +1 -1
  136. package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +1 -1
  137. package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.mjs +3 -1
  138. package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.mjs +3 -1
  139. package/dist/runtime/server/routes/cms/bookmarks/[id].delete.mjs +1 -1
  140. package/dist/runtime/server/routes/cms/bookmarks/check.post.mjs +1 -1
  141. package/dist/runtime/server/routes/cms/bookmarks/index.get.mjs +1 -1
  142. package/dist/runtime/server/routes/cms/bookmarks/index.post.mjs +1 -1
  143. package/dist/runtime/server/routes/cms/deploy.post.mjs +1 -1
  144. package/dist/runtime/server/routes/cms/export.post.mjs +4 -3
  145. package/dist/runtime/server/routes/cms/search.get.mjs +7 -5
  146. package/dist/runtime/server/routes/cms/sync.post.mjs +2 -1
  147. package/dist/runtime/server/routes/comments/[id]/react.post.mjs +1 -2
  148. package/dist/runtime/server/routes/comments/[id]/report.post.d.ts +1 -1
  149. package/dist/runtime/server/routes/comments/[id]/report.post.mjs +0 -2
  150. package/dist/runtime/server/routes/comments/[id].delete.mjs +8 -4
  151. package/dist/runtime/server/routes/comments/[id].get.d.ts +1 -1
  152. package/dist/runtime/server/routes/comments/[id].get.mjs +1 -2
  153. package/dist/runtime/server/routes/comments/[id].patch.d.ts +1 -1
  154. package/dist/runtime/server/routes/comments/[id].patch.mjs +6 -3
  155. package/dist/runtime/server/routes/comments/batch.post.d.ts +2 -0
  156. package/dist/runtime/server/routes/comments/batch.post.mjs +33 -0
  157. package/dist/runtime/server/routes/comments/index.get.d.ts +1 -1
  158. package/dist/runtime/server/routes/comments/index.get.mjs +6 -4
  159. package/dist/runtime/server/routes/comments/index.post.d.ts +1 -1
  160. package/dist/runtime/server/routes/comments/index.post.mjs +6 -2
  161. package/dist/runtime/server/routes/feed.xml.get.mjs +3 -1
  162. package/dist/runtime/server/routes/sitemap.xml.get.mjs +3 -1
  163. package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +17 -0
  164. package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +29 -0
  165. package/dist/runtime/server/routes/store/cart/index.delete.d.ts +6 -0
  166. package/dist/runtime/server/routes/store/cart/index.delete.mjs +11 -0
  167. package/dist/runtime/server/routes/store/cart/index.get.d.ts +5 -0
  168. package/dist/runtime/server/routes/store/cart/index.get.mjs +14 -0
  169. package/dist/runtime/server/routes/store/cart/items/[id].delete.d.ts +6 -0
  170. package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +25 -0
  171. package/dist/runtime/server/routes/store/cart/items/[id].patch.d.ts +6 -0
  172. package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +29 -0
  173. package/dist/runtime/server/routes/store/cart/items.post.d.ts +6 -0
  174. package/dist/runtime/server/routes/store/cart/items.post.mjs +36 -0
  175. package/dist/runtime/server/routes/store/categories/index.get.d.ts +2 -0
  176. package/dist/runtime/server/routes/store/categories/index.get.mjs +8 -0
  177. package/dist/runtime/server/routes/store/checkout.post.d.ts +6 -0
  178. package/dist/runtime/server/routes/store/checkout.post.mjs +21 -0
  179. package/dist/runtime/server/routes/store/coupons/apply.post.d.ts +7 -0
  180. package/dist/runtime/server/routes/store/coupons/apply.post.mjs +18 -0
  181. package/dist/runtime/server/routes/store/currencies.get.d.ts +15 -0
  182. package/dist/runtime/server/routes/store/currencies.get.mjs +13 -0
  183. package/dist/runtime/server/routes/store/orders/[id].get.d.ts +2 -0
  184. package/dist/runtime/server/routes/store/orders/[id].get.mjs +26 -0
  185. package/dist/runtime/server/routes/store/orders/download/[token].get.d.ts +7 -0
  186. package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +57 -0
  187. package/dist/runtime/server/routes/store/orders/index.get.d.ts +5 -0
  188. package/dist/runtime/server/routes/store/orders/index.get.mjs +30 -0
  189. package/dist/runtime/server/routes/store/products/[slug].get.d.ts +2 -0
  190. package/dist/runtime/server/routes/store/products/[slug].get.mjs +18 -0
  191. package/dist/runtime/server/routes/store/products/index.get.d.ts +5 -0
  192. package/dist/runtime/server/routes/store/products/index.get.mjs +33 -0
  193. package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +9 -0
  194. package/dist/runtime/server/routes/store/tax/calculate.post.mjs +18 -0
  195. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +14 -1
  196. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +14 -1
  197. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +24 -1
  198. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +6 -0
  199. package/dist/runtime/server/utils/ai.d.ts +146 -21
  200. package/dist/runtime/server/utils/ai.mjs +406 -11
  201. package/dist/runtime/server/utils/analytics-query.d.ts +13 -58
  202. package/dist/runtime/server/utils/audit.d.ts +5 -4
  203. package/dist/runtime/server/utils/audit.mjs +25 -14
  204. package/dist/runtime/server/utils/auth.d.ts +29 -12
  205. package/dist/runtime/server/utils/auth.mjs +88 -70
  206. package/dist/runtime/server/utils/bots.d.ts +20 -4
  207. package/dist/runtime/server/utils/bots.mjs +7 -3
  208. package/dist/runtime/server/utils/browser-utils.d.ts +23 -23
  209. package/dist/runtime/server/utils/cache.d.ts +31 -10
  210. package/dist/runtime/server/utils/cache.mjs +130 -53
  211. package/dist/runtime/server/utils/cms/collections.d.ts +23 -0
  212. package/dist/runtime/server/utils/cms/collections.mjs +143 -0
  213. package/dist/runtime/server/utils/cms/common.d.ts +9 -0
  214. package/dist/runtime/server/utils/cms/common.mjs +28 -0
  215. package/dist/runtime/server/utils/cms/git.mjs +2 -2
  216. package/dist/runtime/server/utils/cms/navigation.d.ts +46 -0
  217. package/dist/runtime/server/utils/cms/navigation.mjs +683 -0
  218. package/dist/runtime/server/utils/cms/preview.d.ts +11 -0
  219. package/dist/runtime/server/utils/cms/preview.mjs +50 -0
  220. package/dist/runtime/server/utils/cms/search.d.ts +1 -1
  221. package/dist/runtime/server/utils/cms/search.mjs +11 -7
  222. package/dist/runtime/server/utils/cms/sync.d.ts +34 -0
  223. package/dist/runtime/server/utils/cms/sync.mjs +1082 -0
  224. package/dist/runtime/server/utils/cms/taxonomy.d.ts +103 -0
  225. package/dist/runtime/server/utils/cms/taxonomy.mjs +348 -0
  226. package/dist/runtime/server/utils/cms.d.ts +13 -249
  227. package/dist/runtime/server/utils/cms.mjs +108 -2350
  228. package/dist/runtime/server/utils/comments-filter.d.ts +45 -0
  229. package/dist/runtime/server/utils/comments-filter.mjs +541 -0
  230. package/dist/runtime/server/utils/comments.d.ts +71 -0
  231. package/dist/runtime/server/utils/comments.mjs +137 -61
  232. package/dist/runtime/server/utils/config.d.ts +4 -3
  233. package/dist/runtime/server/utils/config.mjs +7 -6
  234. package/dist/runtime/server/utils/context.d.ts +14 -0
  235. package/dist/runtime/server/utils/context.mjs +2 -2
  236. package/dist/runtime/server/utils/crypto.d.ts +44 -5
  237. package/dist/runtime/server/utils/crypto.mjs +18 -0
  238. package/dist/runtime/server/utils/domains.mjs +9 -5
  239. package/dist/runtime/server/utils/drizzle.d.ts +35 -3
  240. package/dist/runtime/server/utils/drizzle.mjs +115 -6
  241. package/dist/runtime/server/utils/durable-object.d.ts +106 -0
  242. package/dist/runtime/server/utils/durable-object.mjs +628 -0
  243. package/dist/runtime/server/utils/email-inbound.d.ts +29 -0
  244. package/dist/runtime/server/utils/email-inbound.mjs +76 -0
  245. package/dist/runtime/server/utils/impersonation.d.ts +32 -2
  246. package/dist/runtime/server/utils/impersonation.mjs +16 -13
  247. package/dist/runtime/server/utils/lock.d.ts +71 -0
  248. package/dist/runtime/server/utils/lock.mjs +139 -0
  249. package/dist/runtime/server/utils/mail-suppression.mjs +7 -7
  250. package/dist/runtime/server/utils/mail.d.ts +30 -19
  251. package/dist/runtime/server/utils/mcp.d.ts +44 -0
  252. package/dist/runtime/server/utils/mcp.mjs +308 -0
  253. package/dist/runtime/server/utils/notifications.d.ts +72 -7
  254. package/dist/runtime/server/utils/notifications.mjs +67 -55
  255. package/dist/runtime/server/utils/oauth.d.ts +27 -4
  256. package/dist/runtime/server/utils/organization.d.ts +63 -7
  257. package/dist/runtime/server/utils/organization.mjs +26 -21
  258. package/dist/runtime/server/utils/passwordless.d.ts +62 -33
  259. package/dist/runtime/server/utils/payments.d.ts +51 -12
  260. package/dist/runtime/server/utils/payments.mjs +472 -282
  261. package/dist/runtime/server/utils/queue.d.ts +106 -13
  262. package/dist/runtime/server/utils/queue.mjs +313 -28
  263. package/dist/runtime/server/utils/rag.d.ts +42 -14
  264. package/dist/runtime/server/utils/rag.mjs +169 -4
  265. package/dist/runtime/server/utils/ratelimit.d.ts +34 -5
  266. package/dist/runtime/server/utils/ratelimit.mjs +95 -14
  267. package/dist/runtime/server/utils/realtime.d.ts +68 -52
  268. package/dist/runtime/server/utils/scheduled-task.d.ts +42 -1
  269. package/dist/runtime/server/utils/scheduled-task.mjs +29 -0
  270. package/dist/runtime/server/utils/schema-fallback.d.ts +1 -1
  271. package/dist/runtime/server/utils/schema-fallback.mjs +1 -1
  272. package/dist/runtime/server/utils/session.d.ts +84 -10
  273. package/dist/runtime/server/utils/session.mjs +12 -10
  274. package/dist/runtime/server/utils/sse.d.ts +75 -0
  275. package/dist/runtime/server/utils/sse.mjs +147 -0
  276. package/dist/runtime/server/utils/sso.d.ts +1 -1
  277. package/dist/runtime/server/utils/storage.d.ts +53 -4
  278. package/dist/runtime/server/utils/storage.mjs +15 -11
  279. package/dist/runtime/server/utils/store-localization.d.ts +51 -0
  280. package/dist/runtime/server/utils/store-localization.mjs +417 -0
  281. package/dist/runtime/server/utils/store.d.ts +207 -0
  282. package/dist/runtime/server/utils/store.mjs +2227 -0
  283. package/dist/runtime/server/utils/table-names.d.ts +51 -0
  284. package/dist/runtime/server/utils/table-names.mjs +69 -0
  285. package/dist/runtime/server/utils/tenant.d.ts +26 -2
  286. package/dist/runtime/server/utils/tenant.mjs +16 -12
  287. package/dist/runtime/server/utils/tools-registry-fallback.d.ts +1 -0
  288. package/dist/runtime/server/utils/tools-registry-fallback.mjs +1 -0
  289. package/dist/runtime/server/utils/totp.d.ts +45 -2
  290. package/dist/runtime/server/utils/tracker.d.ts +10 -11
  291. package/dist/runtime/server/utils/turnstile.d.ts +16 -1
  292. package/dist/runtime/server/utils/workflows.d.ts +92 -0
  293. package/dist/runtime/server/utils/workflows.mjs +299 -0
  294. package/dist/runtime/server.d.ts +8 -1
  295. package/dist/runtime/server.mjs +8 -5
  296. package/dist/runtime/service.d.ts +10 -10
  297. package/dist/runtime/storage.d.ts +1 -0
  298. package/dist/runtime/storage.mjs +1 -0
  299. package/dist/runtime/store.d.ts +4 -0
  300. package/dist/runtime/store.mjs +2 -0
  301. package/dist/runtime/test-utils.d.ts +11 -10
  302. package/dist/runtime/test-utils.mjs +64 -4
  303. package/dist/runtime/types/ai.d.ts +21 -2
  304. package/dist/runtime/types/d1.d.ts +17 -0
  305. package/dist/runtime/types/drizzle.d.ts +2 -2
  306. package/dist/runtime/types/durable-object.d.ts +62 -2
  307. package/dist/runtime/types/email.d.ts +46 -0
  308. package/dist/runtime/types/imports.d.ts +6 -1
  309. package/dist/runtime/types/index.d.ts +58 -0
  310. package/dist/runtime/types/index.mjs +3 -0
  311. package/dist/runtime/types/mcp.d.ts +83 -0
  312. package/dist/runtime/types/mcp.mjs +0 -0
  313. package/dist/runtime/types/queue.d.ts +36 -0
  314. package/dist/runtime/types/r2.d.ts +41 -0
  315. package/dist/runtime/types/store.d.ts +313 -0
  316. package/dist/runtime/types/store.mjs +0 -0
  317. package/dist/runtime/types/workflows.d.ts +98 -0
  318. package/dist/runtime/types/workflows.mjs +0 -0
  319. package/dist/runtime/workflows.d.ts +5 -0
  320. package/dist/runtime/workflows.mjs +2 -0
  321. package/dist/types/ai.d.ts +721 -0
  322. package/dist/types/cms.d.ts +710 -0
  323. package/dist/types.d.ts +430 -1292
  324. package/dist/utils/auth-schema.d.ts +3 -2
  325. package/dist/utils/bots.d.ts +20 -0
  326. package/dist/utils/comments-schema.d.ts +5 -4
  327. package/dist/utils/drizzle.d.ts +83 -3
  328. package/dist/utils/durable-objects.d.ts +10 -0
  329. package/dist/utils/email-inbound.d.ts +10 -0
  330. package/dist/utils/local-db.d.ts +1 -3
  331. package/dist/utils/mcp.d.ts +24 -0
  332. package/dist/utils/notifications-schema.d.ts +5 -4
  333. package/dist/utils/payments-schema.d.ts +4 -3
  334. package/dist/utils/store-schema.d.ts +14 -0
  335. package/dist/utils/table-names.d.ts +1 -0
  336. package/dist/utils/tenants-schema.d.ts +4 -3
  337. package/dist/utils/tools.d.ts +20 -0
  338. package/dist/utils/workflows.d.ts +8 -0
  339. package/package.json +34 -4
  340. package/dist/chunks/wrangler.mjs +0 -897
  341. package/dist/runtime/app/components/AuthRegister.vue +0 -306
  342. package/dist/runtime/app/components/AuthSessionsList.vue +0 -137
  343. package/dist/runtime/app/components/AuthSignIn.vue +0 -298
  344. package/dist/runtime/app/components/CMSBookmarkButton.vue +0 -59
  345. package/dist/runtime/app/components/CMSImage.vue +0 -47
  346. package/dist/runtime/app/components/CMSLocaleSwitcher.vue +0 -110
  347. package/dist/runtime/app/components/CMSNewsletter.vue +0 -81
  348. package/dist/runtime/app/components/CMSPreviewBanner.vue +0 -83
  349. package/dist/runtime/app/components/CMSTableOfContents.vue +0 -84
  350. package/dist/runtime/app/components/CMSVersionBanner.vue +0 -53
  351. package/dist/runtime/app/components/CMSVersionSwitcher.vue +0 -140
  352. package/dist/runtime/app/components/Comments.vue +0 -411
  353. package/dist/runtime/app/components/FileUpload.vue +0 -200
  354. package/dist/runtime/app/components/ImpersonationBanner.vue +0 -61
  355. package/dist/runtime/app/components/NotificationBell.vue +0 -263
  356. package/dist/runtime/app/components/NotificationList.vue +0 -205
  357. package/dist/runtime/app/components/NotificationPrompt.vue +0 -133
  358. package/dist/runtime/app/components/PricingGated.vue +0 -81
  359. package/dist/runtime/app/components/PricingTable.vue +0 -274
  360. package/dist/runtime/app/components/RealtimeChat.vue +0 -164
  361. package/dist/runtime/app/components/RealtimePresence.vue +0 -129
  362. package/dist/runtime/app/components/RealtimeStatus.vue +0 -79
  363. package/dist/runtime/app/components/SubscriptionCard.vue +0 -207
  364. package/dist/runtime/app/components/UserProfile.vue +0 -558
@@ -0,0 +1,721 @@
1
+ export type AgentRole = "user" | "assistant" | "system" | "tool";
2
+ export interface AgentMessage {
3
+ id?: string;
4
+ role: AgentRole;
5
+ content: string;
6
+ name?: string;
7
+ toolCalls?: Array<{
8
+ id: string;
9
+ name: string;
10
+ arguments: any;
11
+ }>;
12
+ toolCallId?: string;
13
+ createdAt?: number;
14
+ }
15
+ export interface AgentTool<TParams = any, TResult = any> {
16
+ name?: string;
17
+ description: string;
18
+ parameters?: Record<string, any>;
19
+ execute: (params: TParams, context?: any) => Promise<TResult> | TResult;
20
+ }
21
+ export interface AgentContext {
22
+ agentId: string;
23
+ agentName: string;
24
+ state: Record<string, any>;
25
+ setState: (state: Record<string, any>) => Promise<void>;
26
+ messages: AgentMessage[];
27
+ saveMessages: (messages: AgentMessage[]) => Promise<void>;
28
+ tools: Record<string, AgentTool>;
29
+ env: Record<string, any>;
30
+ setAlarm: (timestamp: number | Date) => Promise<void>;
31
+ }
32
+ export interface AgentDefinition {
33
+ name: string;
34
+ model?: string;
35
+ system?: string;
36
+ tools?: Record<string, AgentTool> | AgentTool[];
37
+ maxSteps?: number;
38
+ maxTokens?: number;
39
+ temperature?: number;
40
+ maxContextMessages?: number;
41
+ /** Cloudflare AI Gateway routing configuration */
42
+ gateway?: AIGatewayOptions;
43
+ onMessage?: (message: AgentMessage, context: AgentContext) => Promise<string | void> | string | void;
44
+ }
45
+ export interface AgentsOptions {
46
+ /**
47
+ * Cloudflare Durable Object binding name for agents.
48
+ *
49
+ * @default "QARPEO_AGENT_DO"
50
+ */
51
+ binding?: string;
52
+ /**
53
+ * Directory where agent files are located.
54
+ *
55
+ * @default "server/agents"
56
+ */
57
+ dir?: string;
58
+ /**
59
+ * Default Workers AI model to use.
60
+ *
61
+ * @default "@cf/meta/llama-3.3-70b-instruct"
62
+ */
63
+ defaultModel?: string;
64
+ /**
65
+ * Base API route path for agents.
66
+ *
67
+ * @default "/api/agents"
68
+ */
69
+ path?: string;
70
+ /**
71
+ * Require active user session to access agent endpoints.
72
+ *
73
+ * @default false
74
+ */
75
+ requireAuth?: boolean;
76
+ /** Alias for `requireAuth`. */
77
+ auth?: boolean;
78
+ /**
79
+ * Maximum autonomous tool execution steps before stopping.
80
+ *
81
+ * @default 5
82
+ */
83
+ maxSteps?: number;
84
+ /**
85
+ * Maximum messages preserved in context history sliding window.
86
+ *
87
+ * @default 30
88
+ */
89
+ maxContextMessages?: number;
90
+ /** Global Cloudflare AI Gateway configuration for all agent requests. */
91
+ gateway?: AIGatewayOptions;
92
+ }
93
+ export type BotProvider = "telegram" | "slack" | "discord" | "github" | "whatsapp" | "generic";
94
+ export interface BotMessageSender {
95
+ id: string;
96
+ name?: string;
97
+ username?: string;
98
+ avatarUrl?: string;
99
+ }
100
+ export interface BotMessage {
101
+ id: string;
102
+ text: string;
103
+ chatId: string;
104
+ channelId?: string;
105
+ sender?: BotMessageSender;
106
+ isCommand?: boolean;
107
+ command?: string;
108
+ args?: string[];
109
+ raw?: any;
110
+ }
111
+ export interface BotReplyOptions {
112
+ text: string;
113
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
114
+ replyToMessageId?: string;
115
+ ephemeral?: boolean;
116
+ metadata?: Record<string, any>;
117
+ /**
118
+ * Enable or customize RFC 2369 / RFC 8058 List-Unsubscribe headers for this message. Set alse to
119
+ * disable for transactional emails (e.g. OTP, password reset).
120
+ */
121
+ unsubscribe?: boolean | {
122
+ url?: string;
123
+ email?: string;
124
+ };
125
+ /**
126
+ * Whether to check the suppression list before sending. Set alse to bypass suppression checks for
127
+ * critical security or transactional emails.
128
+ *
129
+ * @default true
130
+ */
131
+ suppression?: boolean;
132
+ }
133
+ export interface BotContext<TPayload = any> {
134
+ provider: BotProvider;
135
+ event: any;
136
+ rawBody: string;
137
+ payload: TPayload;
138
+ message?: BotMessage;
139
+ query: Record<string, any>;
140
+ headers: Record<string, string | undefined>;
141
+ reply: (textOrOptions: string | BotReplyOptions) => Promise<any>;
142
+ agent: (agentName: string, id?: string) => any;
143
+ }
144
+ export interface BotHandlerConfig<TPayload = any> {
145
+ /** The bot/webhook provider platform */
146
+ provider: BotProvider;
147
+ /**
148
+ * Secret or token used to verify incoming webhook signatures:
149
+ *
150
+ * - Telegram: secret_token configured in setWebhook
151
+ * - Slack: Signing Secret
152
+ * - Discord: Public Key (hex string)
153
+ * - GitHub: Webhook secret
154
+ * - WhatsApp: Meta App Secret
155
+ * - Generic: Secret token or HMAC secret
156
+ */
157
+ secret?: string;
158
+ /**
159
+ * Bot API token or credentials for sending replies:
160
+ *
161
+ * - Telegram: Bot Token from @BotFather (`TELEGRAM_BOT_TOKEN`)
162
+ * - Slack: Bot User OAuth Token `xoxb-...` (`SLACK_BOT_TOKEN`)
163
+ * - Discord: Bot Token (`DISCORD_BOT_TOKEN`)
164
+ * - WhatsApp: Meta System User Access Token (`WHATSAPP_ACCESS_TOKEN`)
165
+ */
166
+ botToken?: string;
167
+ /** Phone Number ID for WhatsApp Cloud API (falls back to `WHATSAPP_PHONE_NUMBER_ID`) */
168
+ phoneNumberId?: string;
169
+ /**
170
+ * Verify token for WhatsApp Cloud API GET challenge verification (falls back to
171
+ * `WHATSAPP_VERIFY_TOKEN`)
172
+ */
173
+ verifyToken?: string;
174
+ /**
175
+ * Optional name of a Qarpeo agent to auto-wire. Incoming user messages are automatically sent to
176
+ * this agent and the agent's response is dispatched back to the chat platform.
177
+ */
178
+ agent?: string;
179
+ /** Custom session ID resolver for auto-wired agents. Defaults to `(msg) => msg.chatId`. */
180
+ agentSessionId?: (message: BotMessage, event: any) => string;
181
+ /** Custom hook called whenever a text message is received. */
182
+ onMessage?: (ctx: BotContext<TPayload>) => Promise<any> | any;
183
+ /**
184
+ * Custom hook called for any incoming platform event/action (e.g. Slack button clicks, GitHub
185
+ * push).
186
+ */
187
+ onEvent?: (eventName: string, ctx: BotContext<TPayload>) => Promise<any> | any;
188
+ /** Custom signature verification validator if you wish to override the default verification. */
189
+ verifySignature?: (event: any, rawBody: string) => Promise<boolean> | boolean;
190
+ }
191
+ export interface BotsOptions {
192
+ /**
193
+ * Base route path for discovered bot webhook endpoints.
194
+ *
195
+ * @default "/api/bots"
196
+ */
197
+ path?: string;
198
+ /**
199
+ * Custom directory to scan for bot handler files.
200
+ *
201
+ * @default "server/bots"
202
+ */
203
+ dir?: string;
204
+ }
205
+ export interface McpOptions {
206
+ /**
207
+ * Base route path for discovered Model Context Protocol (MCP) servers.
208
+ *
209
+ * @default "/mcp"
210
+ */
211
+ path?: string;
212
+ /**
213
+ * Custom directory to scan for MCP server definition files.
214
+ *
215
+ * @default "server/mcp"
216
+ */
217
+ dir?: string;
218
+ }
219
+ export interface ChunkOptions {
220
+ /** Maximum number of characters per chunk (default: 800) */
221
+ chunkSize?: number;
222
+ /** Number of characters of overlap between consecutive chunks (default: 100) */
223
+ chunkOverlap?: number;
224
+ /**
225
+ * Custom separator pattern or array of separators in priority order (default: ['\n\n', '\n', '.
226
+ * ', ' '])
227
+ */
228
+ separators?: string[];
229
+ }
230
+ export interface RAGDocument {
231
+ /** Unique document identifier */
232
+ id: string;
233
+ /** Full text content of the document */
234
+ text: string;
235
+ /** Optional metadata attached to every chunk of this document (e.g. title, url, author, category) */
236
+ metadata?: Record<string, any>;
237
+ /** Optional namespace within the Vectorize index */
238
+ namespace?: string;
239
+ }
240
+ export interface RAGChunk {
241
+ /** Unique chunk ID, e.g. `<docId>#chunk-<index>` */
242
+ id: string;
243
+ /** The text slice of this chunk */
244
+ text: string;
245
+ /** Parent document ID */
246
+ documentId: string;
247
+ /** 0-based index of the chunk */
248
+ chunkIndex: number;
249
+ /** Total number of chunks for this document */
250
+ totalChunks: number;
251
+ /** Merged document and chunk metadata */
252
+ metadata: Record<string, any>;
253
+ }
254
+ export interface RAGPipelineConfig {
255
+ /**
256
+ * Vectorize index binding name.
257
+ *
258
+ * @default "VECTORIZE"
259
+ */
260
+ binding?: string;
261
+ /**
262
+ * Workers AI binding name.
263
+ *
264
+ * @default "AI"
265
+ */
266
+ aiBinding?: string;
267
+ /**
268
+ * Embedding model to use.
269
+ *
270
+ * @default "@cf/baai/bge-base-en-v1.5"
271
+ */
272
+ embeddingModel?: string;
273
+ /**
274
+ * Generative LLM to use for answer generation.
275
+ *
276
+ * @default "@cf/meta/llama-3.3-70b-instruct"
277
+ */
278
+ llmModel?: string;
279
+ /** Default chunking parameters */
280
+ chunking?: ChunkOptions;
281
+ /** Default namespace for this pipeline */
282
+ namespace?: string;
283
+ /** Optional event context for binding resolution */
284
+ event?: any;
285
+ }
286
+ export interface RAGQueryOptions {
287
+ /** Maximum number of top matching chunks to retrieve (default: 5) */
288
+ topK?: number;
289
+ /** Minimum similarity score threshold (0.0 to 1.0) */
290
+ minScore?: number;
291
+ /** Metadata filter object */
292
+ filter?: Record<string, any>;
293
+ /** Namespace override */
294
+ namespace?: string;
295
+ /** Event context */
296
+ event?: any;
297
+ }
298
+ export interface RAGChunkMatch extends RAGChunk {
299
+ /** Similarity score (higher is more similar, typically 0.0 to 1.0) */
300
+ score: number;
301
+ }
302
+ export interface RAGContextResult {
303
+ /** Formatted markdown context string ready to inject into prompt */
304
+ contextText: string;
305
+ /** The matched chunks with scores and metadata */
306
+ matches: RAGChunkMatch[];
307
+ }
308
+ export interface RAGAnswerOptions extends RAGQueryOptions {
309
+ /** Custom system prompt instructions for answer generation */
310
+ system?: string;
311
+ /** Temperature for generation (default: 0.2) */
312
+ temperature?: number;
313
+ /** Maximum generation tokens */
314
+ maxTokens?: number;
315
+ }
316
+ export interface RAGAnswerResult {
317
+ /** Generated answer text */
318
+ answer: string;
319
+ /** Source chunks cited/used in answering */
320
+ sources: RAGChunkMatch[];
321
+ /** Query text */
322
+ query: string;
323
+ }
324
+ export interface RAGPipeline {
325
+ /** Splits raw text into overlapping contextual chunks */
326
+ chunkText(text: string, options?: ChunkOptions): string[];
327
+ /** Ingests and indexes a single document into Vectorize */
328
+ indexDocument(doc: RAGDocument, options?: {
329
+ chunking?: ChunkOptions;
330
+ event?: any;
331
+ }): Promise<{
332
+ chunksIndexed: number;
333
+ mutationId?: string;
334
+ }>;
335
+ /** Ingests and indexes multiple documents in batches */
336
+ indexDocuments(docs: RAGDocument[], options?: {
337
+ chunking?: ChunkOptions;
338
+ batchSize?: number;
339
+ event?: any;
340
+ }): Promise<{
341
+ totalIndexed: number;
342
+ totalChunks: number;
343
+ }>;
344
+ /** Deletes a document and all its chunks from the index */
345
+ deleteDocument(documentId: string, options?: {
346
+ maxChunks?: number;
347
+ event?: any;
348
+ }): Promise<void>;
349
+ /** Searches for most relevant chunks matching the query text */
350
+ query(queryText: string, options?: RAGQueryOptions): Promise<RAGChunkMatch[]>;
351
+ /** Retrieves matching chunks and formats them into an LLM context block */
352
+ retrieveContext(queryText: string, options?: RAGQueryOptions): Promise<RAGContextResult>;
353
+ /** Directly answers a user question using grounded RAG retrieval + LLM synthesis */
354
+ answer(queryText: string, options?: RAGAnswerOptions): Promise<RAGAnswerResult>;
355
+ /** Exports this pipeline as a typed tool for `defineAgent({ tools: { ... } })` */
356
+ asTool(options?: {
357
+ name?: string;
358
+ description?: string;
359
+ topK?: number;
360
+ minScore?: number;
361
+ }): AgentTool;
362
+ }
363
+ export interface AutoRagIndexInput {
364
+ id?: string;
365
+ text?: string;
366
+ title?: string;
367
+ metadata?: Record<string, any>;
368
+ namespace?: string;
369
+ /** If indexing an R2 file directly */
370
+ key?: string;
371
+ bucket?: string;
372
+ }
373
+ export type AutoRagIndexable = string | AutoRagIndexInput | {
374
+ text: string;
375
+ [key: string]: any;
376
+ } | {
377
+ key: string;
378
+ text?: string;
379
+ [key: string]: any;
380
+ };
381
+ export interface AutoRagIndexOptions {
382
+ /** Document ID override (auto-generated if not provided) */
383
+ id?: string;
384
+ /** Metadata to attach to all chunks */
385
+ metadata?: Record<string, any>;
386
+ /** Vectorize namespace */
387
+ namespace?: string;
388
+ /** Custom chunking config */
389
+ chunking?: ChunkOptions;
390
+ /** Optional R2 bucket binding name or instance to read from if key is provided */
391
+ bucket?: string;
392
+ /** Request event context */
393
+ event?: any;
394
+ }
395
+ export interface AutoRagIndexResult {
396
+ documentId: string;
397
+ chunksIndexed: number;
398
+ mutationId?: string;
399
+ }
400
+ export interface AutoRagSearchOptions extends RAGQueryOptions {
401
+ /** Maximum number of top matching chunks (default: 5) */
402
+ topK?: number;
403
+ /** Minimum similarity score threshold (0.0 to 1.0) */
404
+ minScore?: number;
405
+ /** Metadata filter object */
406
+ filter?: Record<string, any>;
407
+ /** Vectorize namespace */
408
+ namespace?: string;
409
+ /** Request event context */
410
+ event?: any;
411
+ }
412
+ export interface AutoRagSearchResult {
413
+ matches: RAGChunkMatch[];
414
+ contextText: string;
415
+ totalCount: number;
416
+ }
417
+ export interface AutoRagAnswerOptions extends RAGAnswerOptions {
418
+ }
419
+ export interface AutoRagAnswerResult extends RAGAnswerResult {
420
+ }
421
+ export interface AutoRagSyncR2Options {
422
+ prefix?: string;
423
+ bucket?: string;
424
+ namespace?: string;
425
+ extensions?: string[];
426
+ event?: any;
427
+ }
428
+ export interface AutoRagSyncR2Result {
429
+ indexedCount: number;
430
+ skippedCount: number;
431
+ errors?: string[];
432
+ }
433
+ export interface AutoRag {
434
+ /**
435
+ * Ingest and index raw text, a document object, or an R2 file into Vectorize with zero manual pipelines.
436
+ *
437
+ * Automatically chunks text, computes embeddings via Workers AI GPU, and upserts into Vectorize.
438
+ */
439
+ index(input: AutoRagIndexable, options?: AutoRagIndexOptions): Promise<AutoRagIndexResult>;
440
+ /**
441
+ * Semantic vector search across indexed knowledge using Workers AI embeddings and Vectorize.
442
+ */
443
+ search(query: string, options?: AutoRagSearchOptions): Promise<AutoRagSearchResult>;
444
+ /**
445
+ * Directly answer a question using grounded RAG retrieval + LLM synthesis.
446
+ */
447
+ answer(query: string, options?: AutoRagAnswerOptions): Promise<AutoRagAnswerResult>;
448
+ /**
449
+ * Delete a document and all its chunks from the index.
450
+ */
451
+ delete(documentId: string, options?: {
452
+ maxChunks?: number;
453
+ event?: any;
454
+ }): Promise<void>;
455
+ /**
456
+ * Automatically sync and index text/markdown files stored in an R2 bucket into Vectorize.
457
+ */
458
+ syncR2(options?: AutoRagSyncR2Options): Promise<AutoRagSyncR2Result>;
459
+ /**
460
+ * Expose AutoRAG as a tool for autonomous agents.
461
+ */
462
+ asTool(options?: {
463
+ name?: string;
464
+ description?: string;
465
+ topK?: number;
466
+ minScore?: number;
467
+ }): AgentTool;
468
+ }
469
+ export interface AIGatewayOptions {
470
+ /** Cloudflare AI Gateway name or ID */
471
+ id: string;
472
+ /** Skip cache lookup and fetch fresh generation */
473
+ skipCache?: boolean;
474
+ /** Cache TTL in seconds */
475
+ cacheTtl?: number;
476
+ }
477
+ export interface StreamTextOptions {
478
+ model?: string;
479
+ prompt?: string;
480
+ messages?: AgentMessage[];
481
+ system?: string;
482
+ tools?: Record<string, AgentTool> | AgentTool[];
483
+ maxSteps?: number;
484
+ maxTokens?: number;
485
+ temperature?: number;
486
+ binding?: string;
487
+ event?: any;
488
+ /** Optional Cloudflare AI Gateway routing */
489
+ gateway?: AIGatewayOptions;
490
+ }
491
+ export interface GenerateObjectOptions<T = any> {
492
+ /**
493
+ * The Workers AI model to use.
494
+ *
495
+ * @default "@cf/meta/llama-3.3-70b-instruct"
496
+ */
497
+ model?: string;
498
+ /** User prompt describing what to extract or generate. */
499
+ prompt?: string;
500
+ /** Optional conversation messages list. */
501
+ messages?: AgentMessage[];
502
+ /** Optional system prompt to instruct the model. */
503
+ system?: string;
504
+ /**
505
+ * Zod schema (e.g. `z.object({...})`) or plain JSON Schema defining the expected output structure.
506
+ */
507
+ schema: any;
508
+ /** Optional name for the JSON schema (default: "response"). */
509
+ schemaName?: string;
510
+ /** Optional description for the schema to guide the model. */
511
+ schemaDescription?: string;
512
+ /**
513
+ * Sampling temperature.
514
+ *
515
+ * @default 0.1
516
+ */
517
+ temperature?: number;
518
+ /** Maximum generation tokens. */
519
+ maxTokens?: number;
520
+ /** Cloudflare Workers AI binding override (default: "AI"). */
521
+ binding?: string;
522
+ /** Event context for binding resolution. */
523
+ event?: any;
524
+ /** Optional Cloudflare AI Gateway routing options. */
525
+ gateway?: AIGatewayOptions;
526
+ /**
527
+ * Extraction mode:
528
+ * - "auto": Uses native JSON schema constrained decoding if supported, with prompt fallback
529
+ * - "json_schema": Strict Workers AI `response_format: { type: "json_schema", ... }`
530
+ * - "json_object": Workers AI `response_format: { type: "json_object" }`
531
+ * - "tool_call": Extraction via forced function/tool call
532
+ *
533
+ * @default "auto"
534
+ */
535
+ mode?: "auto" | "json_schema" | "json_object" | "tool_call";
536
+ }
537
+ export interface GenerateObjectResult<T = any> {
538
+ /** The parsed and schema-validated JavaScript object. */
539
+ object: T;
540
+ /** The raw JSON text returned by the model. */
541
+ text: string;
542
+ /** Token usage statistics if provided by Workers AI / AI Gateway. */
543
+ usage?: {
544
+ promptTokens?: number;
545
+ completionTokens?: number;
546
+ totalTokens?: number;
547
+ };
548
+ /** Reason why generation finished (e.g. "stop"). */
549
+ finishReason?: string;
550
+ }
551
+ export interface GenerateImageOptions {
552
+ /** The text prompt describing the image to generate */
553
+ prompt: string;
554
+ /** Negative prompt describing what to avoid in the generation */
555
+ negativePrompt?: string;
556
+ /**
557
+ * The model to use.
558
+ *
559
+ * @default "@cf/black-forest-labs/flux-1-schnell"
560
+ * Other common options:
561
+ * - "@cf/stabilityai/stable-diffusion-xl-base-1.0"
562
+ * - "@cf/bytedance/stable-diffusion-xl-lightning"
563
+ * - "@cf/runwayml/stable-diffusion-v1-5"
564
+ */
565
+ model?: string;
566
+ /** Number of diffusion steps (schnell default: 4, sdxl default: 20) */
567
+ steps?: number;
568
+ /** Output image width (default: 1024 or 512 depending on model) */
569
+ width?: number;
570
+ /** Output image height (default: 1024 or 512 depending on model) */
571
+ height?: number;
572
+ /** Classifier-free guidance scale (for SDXL/SD1.5) */
573
+ guidance?: number;
574
+ /** Random seed for reproducible generation */
575
+ seed?: number;
576
+ /** Optional source image for image-to-image (img2img) tasks */
577
+ image?: Uint8Array | ArrayBuffer | Blob | Array<number> | string;
578
+ /** Strength / denoising factor for image-to-image (0.0 to 1.0) */
579
+ strength?: number;
580
+ /** Desired output format / MIME type */
581
+ format?: "png" | "jpeg" | "webp";
582
+ /** Binding name or override (defaults to "AI") */
583
+ binding?: string;
584
+ /** Event context for binding resolution */
585
+ event?: any;
586
+ /** Cloudflare AI Gateway options */
587
+ gateway?: {
588
+ id: string;
589
+ skipCache?: boolean;
590
+ cacheTtl?: number;
591
+ };
592
+ }
593
+ export interface GenerateImageResult {
594
+ /** Binary bytes of the generated image */
595
+ uint8Array: Uint8Array;
596
+ /** ArrayBuffer representation */
597
+ arrayBuffer: ArrayBuffer;
598
+ /** Base64 string without data prefix */
599
+ base64: string;
600
+ /** Ready-to-use data URL (e.g. data:image/png;base64,...) */
601
+ dataUrl: string;
602
+ /** MIME type (e.g. "image/png" or "image/jpeg") */
603
+ mimeType: string;
604
+ /** Width in pixels if specified/known */
605
+ width?: number;
606
+ /** Height in pixels if specified/known */
607
+ height?: number;
608
+ /** Returns a Web Standard Response with Content-Type and Cache-Control headers */
609
+ toResponse(headers?: HeadersInit): Response;
610
+ /**
611
+ * Persist this image directly to Qarpeo's R2 Blob storage.
612
+ *
613
+ * @param key Blob path/key to save to (e.g. "generated/avatar.png")
614
+ */
615
+ saveToBlob(key: string, options?: {
616
+ binding?: string;
617
+ event?: any;
618
+ contentType?: string;
619
+ }): Promise<any>;
620
+ }
621
+ export interface GenerateSpeechOptions {
622
+ /** The text script to convert into spoken audio */
623
+ text: string;
624
+ /**
625
+ * The TTS model to use.
626
+ *
627
+ * @default "@cf/meta/mms-tts-eng"
628
+ * Other common options:
629
+ * - "@cf/myshell-ai/melotts-english"
630
+ * - "@cf/meta/mms-tts-fra"
631
+ * - "@cf/meta/mms-tts-spa"
632
+ * - "@cf/meta/mms-tts-deu"
633
+ */
634
+ model?: string;
635
+ /** Language code (e.g. "en", "eng", "es", "fr", "de") */
636
+ lang?: string;
637
+ /** Voice name or preset (for models that support multiple voices) */
638
+ voice?: string;
639
+ /** Speech rate / speed multiplier (e.g. 1.0) */
640
+ speed?: number;
641
+ /** Binding name override */
642
+ binding?: string;
643
+ /** Event context */
644
+ event?: any;
645
+ /** Cloudflare AI Gateway options */
646
+ gateway?: {
647
+ id: string;
648
+ skipCache?: boolean;
649
+ cacheTtl?: number;
650
+ };
651
+ }
652
+ export interface GenerateSpeechResult {
653
+ /** Binary bytes of the generated audio */
654
+ uint8Array: Uint8Array;
655
+ /** ArrayBuffer representation */
656
+ arrayBuffer: ArrayBuffer;
657
+ /** Base64 string */
658
+ base64: string;
659
+ /** Ready-to-use data URL (e.g. data:audio/wav;base64,...) */
660
+ dataUrl: string;
661
+ /** Audio MIME type, e.g. "audio/wav" */
662
+ mimeType: string;
663
+ /** Returns a Web Standard Response with Content-Type header */
664
+ toResponse(headers?: HeadersInit): Response;
665
+ /** Persist directly to R2 Blob storage */
666
+ saveToBlob(key: string, options?: {
667
+ binding?: string;
668
+ event?: any;
669
+ contentType?: string;
670
+ }): Promise<any>;
671
+ }
672
+ export type TranscribeAudioInput = Uint8Array | ArrayBuffer | Blob | Array<number> | string;
673
+ export interface TranscribeAudioOptions {
674
+ /** Audio data as Uint8Array, ArrayBuffer, Blob, number array, or Base64 string */
675
+ audio: TranscribeAudioInput;
676
+ /**
677
+ * The STT model to use.
678
+ *
679
+ * @default "@cf/openai/whisper"
680
+ * Other options:
681
+ * - "@cf/openai/whisper-tiny-en"
682
+ * - "@cf/openai/whisper-large-v3-turbo"
683
+ */
684
+ model?: string;
685
+ /** Language spoken in the audio (e.g. "en", "es", "fr", "de") */
686
+ language?: string;
687
+ /** Task: 'transcribe' (default) or 'translate' (translates spoken audio into English) */
688
+ task?: "transcribe" | "translate";
689
+ /** Whether to generate word-level timestamp intervals */
690
+ timestamps?: boolean;
691
+ /** Initial prompt / vocabulary hint to guide transcription accuracy */
692
+ prompt?: string;
693
+ /** Binding name override */
694
+ binding?: string;
695
+ /** Event context */
696
+ event?: any;
697
+ /** Cloudflare AI Gateway options */
698
+ gateway?: {
699
+ id: string;
700
+ skipCache?: boolean;
701
+ cacheTtl?: number;
702
+ };
703
+ }
704
+ export interface TranscribeAudioResult {
705
+ /** The transcribed text */
706
+ text: string;
707
+ /** Approximate or exact word count */
708
+ wordCount: number;
709
+ /** Word-level timestamps and tokens if returned by the model */
710
+ words?: Array<{
711
+ word: string;
712
+ start: number;
713
+ end: number;
714
+ }>;
715
+ /** WebVTT subtitles format if returned */
716
+ vtt?: string;
717
+ /** Language detected by the model if available */
718
+ language?: string;
719
+ /** Raw output object directly from Cloudflare Workers AI */
720
+ raw: any;
721
+ }