@raybase/core 0.0.2 → 0.3.4

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 (435) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.admin-build/AdminApp.css +2 -0
  3. package/dist/.admin-build/AdminApp.js +77 -0
  4. package/dist/.admin-docs-build/AdminDocsApp.css +2 -0
  5. package/dist/.admin-docs-build/AdminDocsApp.js +45 -0
  6. package/dist/actions.d.ts +347 -0
  7. package/dist/actions.d.ts.map +1 -0
  8. package/dist/actions.js +661 -0
  9. package/dist/actions.js.map +1 -0
  10. package/dist/admin-assets/admin.7738f50720a8ed7b.css +2 -0
  11. package/dist/admin-assets/admin.8678cb61db34dc81.js +77 -0
  12. package/dist/admin-boot.d.ts +94 -0
  13. package/dist/admin-boot.d.ts.map +1 -0
  14. package/dist/admin-boot.js +139 -0
  15. package/dist/admin-boot.js.map +1 -0
  16. package/dist/admin-docs-content.d.ts +95 -0
  17. package/dist/admin-docs-content.d.ts.map +1 -0
  18. package/dist/admin-docs-content.js +463 -0
  19. package/dist/admin-docs-content.js.map +1 -0
  20. package/dist/admin-docs-ui.d.ts +11 -0
  21. package/dist/admin-docs-ui.d.ts.map +1 -0
  22. package/dist/admin-docs-ui.js +23 -0
  23. package/dist/admin-docs-ui.js.map +1 -0
  24. package/dist/admin-kit.d.ts +29 -0
  25. package/dist/admin-kit.js +1557 -0
  26. package/dist/admin-role.d.ts +8 -0
  27. package/dist/admin-role.d.ts.map +1 -0
  28. package/dist/admin-role.js +22 -0
  29. package/dist/admin-role.js.map +1 -0
  30. package/dist/admin-ui.d.ts +3 -0
  31. package/dist/admin-ui.d.ts.map +1 -0
  32. package/dist/admin-ui.js +16 -0
  33. package/dist/admin-ui.js.map +1 -0
  34. package/dist/agent-ai-chat.d.ts +127 -0
  35. package/dist/agent-ai-chat.d.ts.map +1 -0
  36. package/dist/agent-ai-chat.js +5975 -0
  37. package/dist/agent-ai-chat.js.map +1 -0
  38. package/dist/agent-chapter-archive.d.ts +214 -0
  39. package/dist/agent-chapter-archive.d.ts.map +1 -0
  40. package/dist/agent-chapter-archive.js +696 -0
  41. package/dist/agent-chapter-archive.js.map +1 -0
  42. package/dist/agent-chapter-search.d.ts +116 -0
  43. package/dist/agent-chapter-search.d.ts.map +1 -0
  44. package/dist/agent-chapter-search.js +605 -0
  45. package/dist/agent-chapter-search.js.map +1 -0
  46. package/dist/agent-chapter-tools.d.ts +45 -0
  47. package/dist/agent-chapter-tools.d.ts.map +1 -0
  48. package/dist/agent-chapter-tools.js +344 -0
  49. package/dist/agent-chapter-tools.js.map +1 -0
  50. package/dist/agent-chapters.d.ts +228 -0
  51. package/dist/agent-chapters.d.ts.map +1 -0
  52. package/dist/agent-chapters.js +737 -0
  53. package/dist/agent-chapters.js.map +1 -0
  54. package/dist/agent-data-parts.d.ts +167 -0
  55. package/dist/agent-data-parts.d.ts.map +1 -0
  56. package/dist/agent-data-parts.js +68 -0
  57. package/dist/agent-data-parts.js.map +1 -0
  58. package/dist/agent-errors.d.ts +41 -0
  59. package/dist/agent-errors.d.ts.map +1 -0
  60. package/dist/agent-errors.js +191 -0
  61. package/dist/agent-errors.js.map +1 -0
  62. package/dist/agent-follow-up-store.d.ts +273 -0
  63. package/dist/agent-follow-up-store.d.ts.map +1 -0
  64. package/dist/agent-follow-up-store.js +703 -0
  65. package/dist/agent-follow-up-store.js.map +1 -0
  66. package/dist/agent-follow-ups.d.ts +314 -0
  67. package/dist/agent-follow-ups.d.ts.map +1 -0
  68. package/dist/agent-follow-ups.js +840 -0
  69. package/dist/agent-follow-ups.js.map +1 -0
  70. package/dist/agent-memory.d.ts +323 -0
  71. package/dist/agent-memory.d.ts.map +1 -0
  72. package/dist/agent-memory.js +1270 -0
  73. package/dist/agent-memory.js.map +1 -0
  74. package/dist/agent-message-parts.d.ts +58 -0
  75. package/dist/agent-message-parts.d.ts.map +1 -0
  76. package/dist/agent-message-parts.js +163 -0
  77. package/dist/agent-message-parts.js.map +1 -0
  78. package/dist/agent-remote-mcp-credentials.d.ts +154 -0
  79. package/dist/agent-remote-mcp-credentials.d.ts.map +1 -0
  80. package/dist/agent-remote-mcp-credentials.js +287 -0
  81. package/dist/agent-remote-mcp-credentials.js.map +1 -0
  82. package/dist/agent-remote-mcp-crypto.d.ts +32 -0
  83. package/dist/agent-remote-mcp-crypto.d.ts.map +1 -0
  84. package/dist/agent-remote-mcp-crypto.js +101 -0
  85. package/dist/agent-remote-mcp-crypto.js.map +1 -0
  86. package/dist/agent-remote-mcp-install.d.ts +299 -0
  87. package/dist/agent-remote-mcp-install.d.ts.map +1 -0
  88. package/dist/agent-remote-mcp-install.js +785 -0
  89. package/dist/agent-remote-mcp-install.js.map +1 -0
  90. package/dist/agent-remote-mcp-oauth.d.ts +73 -0
  91. package/dist/agent-remote-mcp-oauth.d.ts.map +1 -0
  92. package/dist/agent-remote-mcp-oauth.js +344 -0
  93. package/dist/agent-remote-mcp-oauth.js.map +1 -0
  94. package/dist/agent-remote-mcp-transport.d.ts +46 -0
  95. package/dist/agent-remote-mcp-transport.d.ts.map +1 -0
  96. package/dist/agent-remote-mcp-transport.js +225 -0
  97. package/dist/agent-remote-mcp-transport.js.map +1 -0
  98. package/dist/agent-remote-mcp.d.ts +147 -0
  99. package/dist/agent-remote-mcp.d.ts.map +1 -0
  100. package/dist/agent-remote-mcp.js +681 -0
  101. package/dist/agent-remote-mcp.js.map +1 -0
  102. package/dist/agent-room-redaction.d.ts +66 -0
  103. package/dist/agent-room-redaction.d.ts.map +1 -0
  104. package/dist/agent-room-redaction.js +264 -0
  105. package/dist/agent-room-redaction.js.map +1 -0
  106. package/dist/agent-rooms.d.ts +209 -0
  107. package/dist/agent-rooms.d.ts.map +1 -0
  108. package/dist/agent-rooms.js +244 -0
  109. package/dist/agent-rooms.js.map +1 -0
  110. package/dist/agent-runtime.d.ts +541 -0
  111. package/dist/agent-runtime.d.ts.map +1 -0
  112. package/dist/agent-runtime.js +4260 -0
  113. package/dist/agent-runtime.js.map +1 -0
  114. package/dist/agent-skill-archive.d.ts +20 -0
  115. package/dist/agent-skill-archive.d.ts.map +1 -0
  116. package/dist/agent-skill-archive.js +316 -0
  117. package/dist/agent-skill-archive.js.map +1 -0
  118. package/dist/agent-skill-discovery.d.ts +96 -0
  119. package/dist/agent-skill-discovery.d.ts.map +1 -0
  120. package/dist/agent-skill-discovery.js +464 -0
  121. package/dist/agent-skill-discovery.js.map +1 -0
  122. package/dist/agent-skill-format.d.ts +57 -0
  123. package/dist/agent-skill-format.d.ts.map +1 -0
  124. package/dist/agent-skill-format.js +238 -0
  125. package/dist/agent-skill-format.js.map +1 -0
  126. package/dist/agent-skill-import.d.ts +64 -0
  127. package/dist/agent-skill-import.d.ts.map +1 -0
  128. package/dist/agent-skill-import.js +295 -0
  129. package/dist/agent-skill-import.js.map +1 -0
  130. package/dist/agent-skill-publish.d.ts +51 -0
  131. package/dist/agent-skill-publish.d.ts.map +1 -0
  132. package/dist/agent-skill-publish.js +136 -0
  133. package/dist/agent-skill-publish.js.map +1 -0
  134. package/dist/agent-skill-store.d.ts +252 -0
  135. package/dist/agent-skill-store.d.ts.map +1 -0
  136. package/dist/agent-skill-store.js +514 -0
  137. package/dist/agent-skill-store.js.map +1 -0
  138. package/dist/agent-skills.d.ts +85 -0
  139. package/dist/agent-skills.d.ts.map +1 -0
  140. package/dist/agent-skills.js +291 -0
  141. package/dist/agent-skills.js.map +1 -0
  142. package/dist/agent-transcript-pager.d.ts +77 -0
  143. package/dist/agent-transcript-pager.d.ts.map +1 -0
  144. package/dist/agent-transcript-pager.js +210 -0
  145. package/dist/agent-transcript-pager.js.map +1 -0
  146. package/dist/agent-user-data-parts.d.ts +20 -0
  147. package/dist/agent-user-data-parts.d.ts.map +1 -0
  148. package/dist/agent-user-data-parts.js +161 -0
  149. package/dist/agent-user-data-parts.js.map +1 -0
  150. package/dist/agent-user-transcript.d.ts +46 -0
  151. package/dist/agent-user-transcript.d.ts.map +1 -0
  152. package/dist/agent-user-transcript.js +106 -0
  153. package/dist/agent-user-transcript.js.map +1 -0
  154. package/dist/agent-voice-notes.d.ts +15 -0
  155. package/dist/agent-voice-notes.d.ts.map +1 -0
  156. package/dist/agent-voice-notes.js +17 -0
  157. package/dist/agent-voice-notes.js.map +1 -0
  158. package/dist/agent-wakes.d.ts +213 -0
  159. package/dist/agent-wakes.d.ts.map +1 -0
  160. package/dist/agent-wakes.js +534 -0
  161. package/dist/agent-wakes.js.map +1 -0
  162. package/dist/agent.d.ts +1780 -0
  163. package/dist/agent.d.ts.map +1 -0
  164. package/dist/agent.js +3123 -0
  165. package/dist/agent.js.map +1 -0
  166. package/dist/ai.d.ts +583 -0
  167. package/dist/ai.d.ts.map +1 -0
  168. package/dist/ai.js +1858 -0
  169. package/dist/ai.js.map +1 -0
  170. package/dist/app-manifest.d.ts +255 -0
  171. package/dist/app-manifest.d.ts.map +1 -0
  172. package/dist/app-manifest.js +372 -0
  173. package/dist/app-manifest.js.map +1 -0
  174. package/dist/app-users.d.ts +30 -0
  175. package/dist/app-users.d.ts.map +1 -0
  176. package/dist/app-users.js +91 -0
  177. package/dist/app-users.js.map +1 -0
  178. package/dist/audit-archive.d.ts +85 -0
  179. package/dist/audit-archive.d.ts.map +1 -0
  180. package/dist/audit-archive.js +178 -0
  181. package/dist/audit-archive.js.map +1 -0
  182. package/dist/audit.d.ts +54 -0
  183. package/dist/audit.d.ts.map +1 -0
  184. package/dist/audit.js +95 -0
  185. package/dist/audit.js.map +1 -0
  186. package/dist/auth-logger.d.ts +28 -0
  187. package/dist/auth-logger.d.ts.map +1 -0
  188. package/dist/auth-logger.js +53 -0
  189. package/dist/auth-logger.js.map +1 -0
  190. package/dist/auth-password-secret.d.ts +59 -0
  191. package/dist/auth-password-secret.d.ts.map +1 -0
  192. package/dist/auth-password-secret.js +409 -0
  193. package/dist/auth-password-secret.js.map +1 -0
  194. package/dist/auth-schema.d.ts +120 -0
  195. package/dist/auth-schema.d.ts.map +1 -0
  196. package/dist/auth-schema.js +285 -0
  197. package/dist/auth-schema.js.map +1 -0
  198. package/dist/auth.d.ts +321 -0
  199. package/dist/auth.d.ts.map +1 -0
  200. package/dist/auth.js +1562 -0
  201. package/dist/auth.js.map +1 -0
  202. package/dist/backup-archive.d.ts +257 -0
  203. package/dist/backup-archive.d.ts.map +1 -0
  204. package/dist/backup-archive.js +2068 -0
  205. package/dist/backup-archive.js.map +1 -0
  206. package/dist/backup-crypto.d.ts +313 -0
  207. package/dist/backup-crypto.d.ts.map +1 -0
  208. package/dist/backup-crypto.js +693 -0
  209. package/dist/backup-crypto.js.map +1 -0
  210. package/dist/backup-format.d.ts +200 -0
  211. package/dist/backup-format.d.ts.map +1 -0
  212. package/dist/backup-format.js +1247 -0
  213. package/dist/backup-format.js.map +1 -0
  214. package/dist/cli.d.ts +9 -0
  215. package/dist/cli.d.ts.map +1 -0
  216. package/dist/cli.js +15 -0
  217. package/dist/cli.js.map +1 -0
  218. package/dist/clock.d.ts +35 -0
  219. package/dist/clock.d.ts.map +1 -0
  220. package/dist/clock.js +83 -0
  221. package/dist/clock.js.map +1 -0
  222. package/dist/data-client.d.ts +187 -0
  223. package/dist/data-client.d.ts.map +1 -0
  224. package/dist/data-client.js +590 -0
  225. package/dist/data-client.js.map +1 -0
  226. package/dist/data-secrets.d.ts +164 -0
  227. package/dist/data-secrets.d.ts.map +1 -0
  228. package/dist/data-secrets.js +383 -0
  229. package/dist/data-secrets.js.map +1 -0
  230. package/dist/db.d.ts +453 -0
  231. package/dist/db.d.ts.map +1 -0
  232. package/dist/db.js +324 -0
  233. package/dist/db.js.map +1 -0
  234. package/dist/dev-activity.d.ts +48 -0
  235. package/dist/dev-activity.d.ts.map +1 -0
  236. package/dist/dev-activity.js +50 -0
  237. package/dist/dev-activity.js.map +1 -0
  238. package/dist/do.d.ts +429 -0
  239. package/dist/do.d.ts.map +1 -0
  240. package/dist/do.js +4526 -0
  241. package/dist/do.js.map +1 -0
  242. package/dist/email.d.ts +137 -0
  243. package/dist/email.d.ts.map +1 -0
  244. package/dist/email.js +527 -0
  245. package/dist/email.js.map +1 -0
  246. package/dist/generated/admin-assets.d.ts +16 -0
  247. package/dist/generated/admin-assets.d.ts.map +1 -0
  248. package/dist/generated/admin-assets.js +16 -0
  249. package/dist/generated/admin-assets.js.map +1 -0
  250. package/dist/generated/admin-docs-assets.d.ts +3 -0
  251. package/dist/generated/admin-docs-assets.d.ts.map +1 -0
  252. package/dist/generated/admin-docs-assets.js +3 -0
  253. package/dist/generated/admin-docs-assets.js.map +1 -0
  254. package/dist/handoff-consumer.d.ts +79 -0
  255. package/dist/handoff-consumer.d.ts.map +1 -0
  256. package/dist/handoff-consumer.js +300 -0
  257. package/dist/handoff-consumer.js.map +1 -0
  258. package/dist/handoff.d.ts +70 -0
  259. package/dist/handoff.d.ts.map +1 -0
  260. package/dist/handoff.js +228 -0
  261. package/dist/handoff.js.map +1 -0
  262. package/dist/host-auth.d.ts +47 -0
  263. package/dist/host-auth.d.ts.map +1 -0
  264. package/dist/host-auth.js +59 -0
  265. package/dist/host-auth.js.map +1 -0
  266. package/dist/host-user.d.ts +15 -0
  267. package/dist/host-user.d.ts.map +1 -0
  268. package/dist/host-user.js +23 -0
  269. package/dist/host-user.js.map +1 -0
  270. package/dist/html.d.ts +35 -0
  271. package/dist/html.d.ts.map +1 -0
  272. package/dist/html.js +634 -0
  273. package/dist/html.js.map +1 -0
  274. package/dist/http-error.d.ts +13 -0
  275. package/dist/http-error.d.ts.map +1 -0
  276. package/dist/http-error.js +15 -0
  277. package/dist/http-error.js.map +1 -0
  278. package/dist/imports.d.ts +219 -0
  279. package/dist/imports.d.ts.map +1 -0
  280. package/dist/imports.js +571 -0
  281. package/dist/imports.js.map +1 -0
  282. package/dist/index.d.ts +78 -0
  283. package/dist/index.d.ts.map +1 -0
  284. package/dist/index.js +76 -0
  285. package/dist/index.js.map +1 -0
  286. package/dist/inference-tape.d.ts +64 -0
  287. package/dist/inference-tape.d.ts.map +1 -0
  288. package/dist/inference-tape.js +278 -0
  289. package/dist/inference-tape.js.map +1 -0
  290. package/dist/internal.d.ts +15 -0
  291. package/dist/internal.d.ts.map +1 -0
  292. package/dist/internal.js +48 -0
  293. package/dist/internal.js.map +1 -0
  294. package/dist/jobs.d.ts +796 -0
  295. package/dist/jobs.d.ts.map +1 -0
  296. package/dist/jobs.js +538 -0
  297. package/dist/jobs.js.map +1 -0
  298. package/dist/json-schema.d.ts +91 -0
  299. package/dist/json-schema.d.ts.map +1 -0
  300. package/dist/json-schema.js +884 -0
  301. package/dist/json-schema.js.map +1 -0
  302. package/dist/knowledge.d.ts +33 -0
  303. package/dist/knowledge.d.ts.map +1 -0
  304. package/dist/knowledge.js +348 -0
  305. package/dist/knowledge.js.map +1 -0
  306. package/dist/local-dev-chrome.d.ts +29 -0
  307. package/dist/local-dev-chrome.d.ts.map +1 -0
  308. package/dist/local-dev-chrome.js +514 -0
  309. package/dist/local-dev-chrome.js.map +1 -0
  310. package/dist/local-dev-personas.d.ts +15 -0
  311. package/dist/local-dev-personas.d.ts.map +1 -0
  312. package/dist/local-dev-personas.js +46 -0
  313. package/dist/local-dev-personas.js.map +1 -0
  314. package/dist/mcp.d.ts +567 -0
  315. package/dist/mcp.d.ts.map +1 -0
  316. package/dist/mcp.js +2480 -0
  317. package/dist/mcp.js.map +1 -0
  318. package/dist/modules.d.ts +145 -0
  319. package/dist/modules.d.ts.map +1 -0
  320. package/dist/modules.js +164 -0
  321. package/dist/modules.js.map +1 -0
  322. package/dist/notification-client.d.ts +94 -0
  323. package/dist/notification-client.d.ts.map +1 -0
  324. package/dist/notification-client.js +127 -0
  325. package/dist/notification-client.js.map +1 -0
  326. package/dist/notifications.d.ts +447 -0
  327. package/dist/notifications.d.ts.map +1 -0
  328. package/dist/notifications.js +1625 -0
  329. package/dist/notifications.js.map +1 -0
  330. package/dist/operator-data-query.d.ts +117 -0
  331. package/dist/operator-data-query.d.ts.map +1 -0
  332. package/dist/operator-data-query.js +431 -0
  333. package/dist/operator-data-query.js.map +1 -0
  334. package/dist/operator-mcp.d.ts +63 -0
  335. package/dist/operator-mcp.d.ts.map +1 -0
  336. package/dist/operator-mcp.js +2828 -0
  337. package/dist/operator-mcp.js.map +1 -0
  338. package/dist/outbound-https.d.ts +24 -0
  339. package/dist/outbound-https.d.ts.map +1 -0
  340. package/dist/outbound-https.js +172 -0
  341. package/dist/outbound-https.js.map +1 -0
  342. package/dist/pitr.d.ts +60 -0
  343. package/dist/pitr.d.ts.map +1 -0
  344. package/dist/pitr.js +94 -0
  345. package/dist/pitr.js.map +1 -0
  346. package/dist/platform.d.ts +199 -0
  347. package/dist/platform.d.ts.map +1 -0
  348. package/dist/platform.js +196 -0
  349. package/dist/platform.js.map +1 -0
  350. package/dist/policies.d.ts +115 -0
  351. package/dist/policies.d.ts.map +1 -0
  352. package/dist/policies.js +158 -0
  353. package/dist/policies.js.map +1 -0
  354. package/dist/principal.d.ts +143 -0
  355. package/dist/principal.d.ts.map +1 -0
  356. package/dist/principal.js +174 -0
  357. package/dist/principal.js.map +1 -0
  358. package/dist/realtime.d.ts +280 -0
  359. package/dist/realtime.d.ts.map +1 -0
  360. package/dist/realtime.js +578 -0
  361. package/dist/realtime.js.map +1 -0
  362. package/dist/retrieval.d.ts +263 -0
  363. package/dist/retrieval.d.ts.map +1 -0
  364. package/dist/retrieval.js +602 -0
  365. package/dist/retrieval.js.map +1 -0
  366. package/dist/runtime-error-client.d.ts +10 -0
  367. package/dist/runtime-error-client.d.ts.map +1 -0
  368. package/dist/runtime-error-client.js +70 -0
  369. package/dist/runtime-error-client.js.map +1 -0
  370. package/dist/runtime-errors.d.ts +180 -0
  371. package/dist/runtime-errors.d.ts.map +1 -0
  372. package/dist/runtime-errors.js +572 -0
  373. package/dist/runtime-errors.js.map +1 -0
  374. package/dist/schema.d.ts +434 -0
  375. package/dist/schema.d.ts.map +1 -0
  376. package/dist/schema.js +232 -0
  377. package/dist/schema.js.map +1 -0
  378. package/dist/search.d.ts +216 -0
  379. package/dist/search.d.ts.map +1 -0
  380. package/dist/search.js +785 -0
  381. package/dist/search.js.map +1 -0
  382. package/dist/settings.d.ts +191 -0
  383. package/dist/settings.d.ts.map +1 -0
  384. package/dist/settings.js +478 -0
  385. package/dist/settings.js.map +1 -0
  386. package/dist/sql.d.ts +7 -0
  387. package/dist/sql.d.ts.map +1 -0
  388. package/dist/sql.js +30 -0
  389. package/dist/sql.js.map +1 -0
  390. package/dist/storage-client.d.ts +69 -0
  391. package/dist/storage-client.d.ts.map +1 -0
  392. package/dist/storage-client.js +469 -0
  393. package/dist/storage-client.js.map +1 -0
  394. package/dist/storage.d.ts +21 -0
  395. package/dist/storage.d.ts.map +1 -0
  396. package/dist/storage.js +82 -0
  397. package/dist/storage.js.map +1 -0
  398. package/dist/subject-domains.d.ts +15 -0
  399. package/dist/subject-domains.d.ts.map +1 -0
  400. package/dist/subject-domains.js +38 -0
  401. package/dist/subject-domains.js.map +1 -0
  402. package/dist/support.d.ts +132 -0
  403. package/dist/support.d.ts.map +1 -0
  404. package/dist/support.js +483 -0
  405. package/dist/support.js.map +1 -0
  406. package/dist/system-tables.d.ts +12 -0
  407. package/dist/system-tables.d.ts.map +1 -0
  408. package/dist/system-tables.js +225 -0
  409. package/dist/system-tables.js.map +1 -0
  410. package/dist/test.d.ts +57 -0
  411. package/dist/test.d.ts.map +1 -0
  412. package/dist/test.js +454 -0
  413. package/dist/test.js.map +1 -0
  414. package/dist/vite.d.ts +82 -0
  415. package/dist/vite.d.ts.map +1 -0
  416. package/dist/vite.js +82 -0
  417. package/dist/vite.js.map +1 -0
  418. package/dist/webpush-crypto.d.ts +39 -0
  419. package/dist/webpush-crypto.d.ts.map +1 -0
  420. package/dist/webpush-crypto.js +213 -0
  421. package/dist/webpush-crypto.js.map +1 -0
  422. package/dist/webpush-private.d.ts +11 -0
  423. package/dist/webpush-private.d.ts.map +1 -0
  424. package/dist/webpush-private.js +11 -0
  425. package/dist/webpush-private.js.map +1 -0
  426. package/dist/webpush.d.ts +86 -0
  427. package/dist/webpush.d.ts.map +1 -0
  428. package/dist/webpush.js +375 -0
  429. package/dist/webpush.js.map +1 -0
  430. package/dist/worker.d.ts +185 -0
  431. package/dist/worker.d.ts.map +1 -0
  432. package/dist/worker.js +13021 -0
  433. package/dist/worker.js.map +1 -0
  434. package/package.json +161 -8
  435. package/README.md +0 -3
package/dist/jobs.d.ts ADDED
@@ -0,0 +1,796 @@
1
+ import { z } from "zod";
2
+ import { type ActionPolicyExpression, type RaybaseAction, type RaybaseActionRowAuthorization } from "./actions.js";
3
+ import type { RaybaseAgentInvocationRuntime } from "./agent.js";
4
+ import type { RaybaseAuditContextEvent } from "./audit.js";
5
+ import type { RaybaseActionDataClient } from "./data-client.js";
6
+ import type { RaybaseAI } from "./ai.js";
7
+ import type { RaybaseAuthContextRuntime } from "./auth.js";
8
+ import { type JsonSchemaObject } from "./json-schema.js";
9
+ import type { RaybaseNotificationsRuntime } from "./notifications.js";
10
+ import type { PolicyExpression, RaybaseUser } from "./policies.js";
11
+ import { type RaybaseJobPrincipal } from "./principal.js";
12
+ import type { RaybaseSchema } from "./schema.js";
13
+ import type { RaybaseRuntimeSettings, RaybaseSettingsDefinitions } from "./settings.js";
14
+ export { principalToStored } from "./principal.js";
15
+ export type { RaybaseJobPrincipal, RaybaseStoredPrincipal } from "./principal.js";
16
+ export type JobJsonSchemaObject = JsonSchemaObject;
17
+ export type JobPolicyExpression = PolicyExpression;
18
+ export type JobRetryConfig = {
19
+ maxAttempts?: number;
20
+ backoff?: "fixed" | "exponential" | {
21
+ kind: "fixed" | "exponential";
22
+ delay?: string | number;
23
+ };
24
+ delay?: string | number;
25
+ };
26
+ /**
27
+ * In-flight bounds enforced when the data Durable Object claims a run. A run
28
+ * counts while it holds a live lease; a claim over a full limit is deferred,
29
+ * never failed, and never spends an attempt. The Durable Object parks the
30
+ * waiting run and wakes it when a run releases a slot it shares.
31
+ */
32
+ export type JobConcurrencyConfig<Input = unknown> = {
33
+ /** Most runs of this job name in flight at once in one data Durable Object. */
34
+ max?: number;
35
+ /**
36
+ * Most runs in flight at once per key. The key is computed from the parsed
37
+ * input at enqueue time and is shared by every job in the data Durable
38
+ * Object that returns the same string, so namespace it (`site:${id}`).
39
+ */
40
+ perKey?: {
41
+ key: (input: Input) => string;
42
+ max: number;
43
+ };
44
+ };
45
+ /** Token bucket over run starts, checked in the same claim as concurrency. */
46
+ export type JobRateLimitConfig<Input = unknown> = {
47
+ /** Sustained starts per second; fractions allowed (0.5 is one start every two seconds). */
48
+ perSecond: number;
49
+ /** Starts allowed back to back after an idle period. Defaults to max(1, ceil(perSecond)). */
50
+ burst?: number;
51
+ /** Bucket key computed from the parsed input; shared like `concurrency.perKey.key`. Defaults to one bucket per job name. */
52
+ key?: (input: Input) => string;
53
+ };
54
+ /** The declared limits a claim enforces, resolved from the job definition by the queue consumer. */
55
+ export type JobRunClaimLimits = {
56
+ max?: number;
57
+ perKeyMax?: number;
58
+ rateLimit?: {
59
+ perSecond: number;
60
+ burst: number;
61
+ keyed: boolean;
62
+ };
63
+ };
64
+ export type RaybaseJobDeferralReason = "concurrency" | "concurrency-key" | "rate-limit";
65
+ export type RaybaseJobDeferral = {
66
+ reason: RaybaseJobDeferralReason;
67
+ /** The full limit: `max`, `perKey.max`, or the rate-limit burst. */
68
+ limit: number;
69
+ /** Runs holding a live lease when the claim was deferred (concurrency reasons). */
70
+ inFlight?: number;
71
+ /** The concurrency or rate-limit key, when the limit is keyed. */
72
+ key?: string | null;
73
+ /** Rate limit only: time until the bucket holds a whole token. */
74
+ retryAfterMs?: number;
75
+ /** Total deferrals of this run, including this one. */
76
+ deferrals: number;
77
+ /**
78
+ * The data Durable Object holds the waiting run and sends its message when
79
+ * a slot frees, so the consumer acknowledges without redelivering it.
80
+ */
81
+ parked?: boolean;
82
+ };
83
+ export type JobRetentionConfig = {
84
+ success?: string | number;
85
+ failure?: string | number;
86
+ cancelled?: string | number;
87
+ events?: string | number;
88
+ };
89
+ export type JobScheduleConfig = {
90
+ cron: string;
91
+ timezone?: string;
92
+ input?: unknown;
93
+ enabled?: boolean;
94
+ };
95
+ export type RaybaseJobLogger = {
96
+ debug(message: string, data?: unknown): void;
97
+ info(message: string, data?: unknown): void;
98
+ warn(message: string, data?: unknown): void;
99
+ error(message: string, data?: unknown): void;
100
+ };
101
+ export type RaybaseJobScheduleContext = {
102
+ key: string;
103
+ bookedAt: string;
104
+ generation: number;
105
+ late: boolean;
106
+ };
107
+ export type RaybaseJobHandlerContext<Input = unknown> = {
108
+ input: Input;
109
+ run: RaybaseJobRun;
110
+ enqueuedBy: RaybaseJobPrincipal;
111
+ runAs: RaybaseJobPrincipal;
112
+ principal: RaybaseJobPrincipal;
113
+ user?: RaybaseUser;
114
+ /** Opaque first-party runtime scope metadata; Core leaves this unset. */
115
+ organizationId?: string;
116
+ /** Policy-checked app data as the job's runAs principal; `revealSecret()` returns `secret()` plaintext through an audited call. */
117
+ db: RaybaseActionDataClient;
118
+ auth: RaybaseAuthContextRuntime;
119
+ agents: RaybaseAgentInvocationRuntime;
120
+ ai: RaybaseAI;
121
+ settings: RaybaseRuntimeSettings<unknown, RaybaseSettingsDefinitions<unknown>>;
122
+ notifications: RaybaseNotificationsRuntime;
123
+ jobs: RaybaseJobsRuntime;
124
+ schedule?: RaybaseJobScheduleContext;
125
+ /** Present only on a batch continuation run (`onComplete` or `onFailure`). */
126
+ batch?: RaybaseJobBatchContext;
127
+ env: unknown;
128
+ log: RaybaseJobLogger;
129
+ progress: (patch: Record<string, unknown>) => Promise<void>;
130
+ signal: AbortSignal;
131
+ audit?: (event: RaybaseAuditContextEvent) => Promise<void>;
132
+ };
133
+ export type RaybaseJobDefinition<Input = unknown> = {
134
+ name: string;
135
+ description?: string;
136
+ input: z.ZodType<Input> | JobJsonSchemaObject;
137
+ enqueue: JobPolicyExpression;
138
+ view?: JobPolicyExpression;
139
+ cancel?: JobPolicyExpression;
140
+ retry?: JobPolicyExpression;
141
+ /** "actor" means run as the principal that enqueued the job. */
142
+ runAs: "actor" | "system" | {
143
+ userRef: string;
144
+ };
145
+ mode?: "queue" | "workflow";
146
+ retries?: JobRetryConfig;
147
+ concurrency?: JobConcurrencyConfig<Input>;
148
+ rateLimit?: JobRateLimitConfig<Input>;
149
+ /**
150
+ * How long a claimed run holds its lease, and so its concurrency slot,
151
+ * before the stale-lease sweep may fail it. Falls back to
152
+ * `appConfig.jobs.leaseDuration`, then 5 minutes.
153
+ */
154
+ leaseDuration?: string | number;
155
+ retention?: JobRetentionConfig;
156
+ schedule?: JobScheduleConfig;
157
+ handler: (ctx: RaybaseJobHandlerContext<Input>) => Promise<unknown>;
158
+ };
159
+ export type RaybaseActionJobRunAs = RaybaseJobDefinition["runAs"];
160
+ export type RaybaseActionJobOptions<Input = unknown, Output = unknown, Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
161
+ name?: string;
162
+ description?: string;
163
+ enqueue: ActionPolicyExpression;
164
+ runAs: RaybaseActionJobRunAs;
165
+ view?: JobPolicyExpression;
166
+ cancel?: JobPolicyExpression;
167
+ retry?: JobPolicyExpression;
168
+ mode?: "queue" | "workflow";
169
+ retries?: JobRetryConfig;
170
+ concurrency?: JobConcurrencyConfig<Input>;
171
+ rateLimit?: JobRateLimitConfig<Input>;
172
+ leaseDuration?: string | number;
173
+ retention?: JobRetentionConfig;
174
+ schedule?: JobScheduleConfig;
175
+ policy?: ActionPolicyExpression;
176
+ rowAuthorization?: RaybaseActionRowAuthorization<Input, Env, Schema>;
177
+ };
178
+ export type RaybaseJobDefinitionInput<Input = unknown> = RaybaseJobDefinition<Input>;
179
+ export type RaybaseJobCollectionDefinition<Input = unknown> = Omit<RaybaseJobDefinition<Input>, "name"> & {
180
+ name?: string;
181
+ };
182
+ export type RaybaseJobs = Record<string, RaybaseJobDefinition<any>>;
183
+ export type RaybaseJobDefinitions = Record<string, RaybaseJobDefinition<any> | RaybaseJobCollectionDefinition<any>>;
184
+ export type RaybaseJobRunStatus = "queued" | "leased" | "running" | "succeeded" | "failed" | "denied" | "cancelled" | "expired";
185
+ export type RaybaseJobRun = {
186
+ id: string;
187
+ jobName: string;
188
+ status: RaybaseJobRunStatus;
189
+ inputJson: string;
190
+ inputHash: string | null;
191
+ idempotencyKey: string | null;
192
+ actorKind: "user" | "operator" | "service" | "agent";
193
+ actorId: string | null;
194
+ runAsKind: "user" | "operator" | "service" | "agent";
195
+ runAsId: string | null;
196
+ attempt: number;
197
+ maxAttempts: number;
198
+ queueMessageId: string | null;
199
+ workflowInstanceId: string | null;
200
+ leaseOwner: string | null;
201
+ leaseExpiresAt: string | null;
202
+ createdAt: string;
203
+ availableAt: string;
204
+ startedAt: string | null;
205
+ endedAt: string | null;
206
+ expiresAt: string | null;
207
+ progressJson: string | null;
208
+ resultJson: string | null;
209
+ errorJson: string | null;
210
+ artifactJson: string | null;
211
+ createdBy: string | null;
212
+ retryOfRunId: string | null;
213
+ scheduleKey: string | null;
214
+ scheduleGeneration: number | null;
215
+ scheduleBookedAt: string | null;
216
+ /** The batch this run is a child of. */
217
+ batchId: string | null;
218
+ /** Enqueue order inside the batch, starting at 1; the children cursor. */
219
+ batchSeq: number | null;
220
+ /** The batch whose completion this run continues. */
221
+ continuationOfBatchId: string | null;
222
+ /** `concurrency.perKey.key(input)`, computed at enqueue. */
223
+ concurrencyKey: string | null;
224
+ /** `rateLimit.key(input)`, computed at enqueue. */
225
+ rateLimitKey: string | null;
226
+ /** Claims deferred because a concurrency or rate limit was full. */
227
+ deferrals: number;
228
+ deferredAt: string | null;
229
+ /** Set while a queued run waits on a full limit; cleared when the run is claimed. */
230
+ deferredReason: RaybaseJobDeferralReason | null;
231
+ /**
232
+ * When the data Durable Object last sent a waiting run its wake message.
233
+ * For the next 30 seconds the run holds the slot that woke it.
234
+ */
235
+ wokenAt: string | null;
236
+ };
237
+ export type RaybaseJobEvent = {
238
+ id: string;
239
+ runId: string;
240
+ type: string;
241
+ level: "debug" | "info" | "warn" | "error";
242
+ message: string | null;
243
+ dataJson: string | null;
244
+ createdAt: string;
245
+ };
246
+ export type RaybaseJobQueueMessage = {
247
+ kind: "raybase.job.run";
248
+ version: 1;
249
+ runId: string;
250
+ jobName: string;
251
+ organizationId?: string;
252
+ };
253
+ export type RaybaseJobScheduleDispatchMessage = {
254
+ kind: "raybase.job.schedule";
255
+ version: 1;
256
+ scheduleId: string;
257
+ key: string;
258
+ jobName: string;
259
+ generation: number;
260
+ bookedAt: string;
261
+ inputJson: string;
262
+ service: string;
263
+ actorKind: "user" | "operator" | "service" | "agent";
264
+ actorId: string | null;
265
+ organizationId?: string;
266
+ };
267
+ type CreateJobRunOptionalField = "attempt" | "queueMessageId" | "workflowInstanceId" | "leaseOwner" | "leaseExpiresAt" | "startedAt" | "endedAt" | "resultJson" | "errorJson" | "batchId" | "batchSeq" | "continuationOfBatchId" | "concurrencyKey" | "rateLimitKey" | "deferrals" | "deferredAt" | "deferredReason" | "wokenAt";
268
+ export type CreateJobRunInput = {
269
+ run: Omit<RaybaseJobRun, CreateJobRunOptionalField> & Partial<Pick<RaybaseJobRun, CreateJobRunOptionalField>>;
270
+ };
271
+ export type CreateJobRunResult = {
272
+ created: boolean;
273
+ run: RaybaseJobRun;
274
+ };
275
+ export type ClaimJobRunInput = {
276
+ runId: string;
277
+ jobName: string;
278
+ leaseOwner: string;
279
+ now: string;
280
+ wallNow?: string;
281
+ leaseExpiresAt: string;
282
+ limits?: JobRunClaimLimits;
283
+ /** Runtime scope claims the Durable Object attaches to the wake message of a run it parks. */
284
+ claims?: Record<string, unknown>;
285
+ };
286
+ export type ClaimJobRunResult = {
287
+ status: "claimed";
288
+ run: RaybaseJobRun;
289
+ } | {
290
+ status: "missing";
291
+ } | {
292
+ status: "terminal";
293
+ run: RaybaseJobRun;
294
+ } | {
295
+ status: "not-due";
296
+ run: RaybaseJobRun;
297
+ } | {
298
+ status: "leased";
299
+ run: RaybaseJobRun;
300
+ } | {
301
+ status: "cancelled";
302
+ run: RaybaseJobRun;
303
+ } | {
304
+ status: "deferred";
305
+ run: RaybaseJobRun;
306
+ deferral: RaybaseJobDeferral;
307
+ };
308
+ export type CompleteJobRunInput = {
309
+ runId: string;
310
+ leaseOwner: string;
311
+ now: string;
312
+ expiresAt: string | null;
313
+ resultJson: string | null;
314
+ artifactJson?: string | null;
315
+ };
316
+ export type FailJobRunInput = {
317
+ runId: string;
318
+ leaseOwner: string;
319
+ now: string;
320
+ retry: boolean;
321
+ availableAt?: string | null;
322
+ expiresAt?: string | null;
323
+ errorJson: string;
324
+ };
325
+ export type DenyJobRunInput = {
326
+ runId: string;
327
+ leaseOwner?: string | null;
328
+ now: string;
329
+ expiresAt: string | null;
330
+ errorJson: string;
331
+ };
332
+ export type CancelJobRunInput = {
333
+ runId: string;
334
+ now: string;
335
+ actorKind?: string | null;
336
+ actorId?: string | null;
337
+ expiresAt?: string | null;
338
+ reason?: string | null;
339
+ };
340
+ export type CancelJobRunResult = {
341
+ status: "cancelled";
342
+ run: RaybaseJobRun;
343
+ } | {
344
+ status: "already-terminal";
345
+ run: RaybaseJobRun;
346
+ } | {
347
+ status: "missing";
348
+ };
349
+ export type AppendJobEventInput = {
350
+ id?: string;
351
+ runId: string;
352
+ type: string;
353
+ level: "debug" | "info" | "warn" | "error";
354
+ message?: string | null;
355
+ dataJson?: string | null;
356
+ createdAt?: string;
357
+ };
358
+ export type ListDueSchedulesInput = {
359
+ now: string;
360
+ limit?: number;
361
+ };
362
+ export type RaybaseJobSchedule = {
363
+ id: string;
364
+ jobName: string;
365
+ key: string;
366
+ kind: "once" | "cron";
367
+ status: "pending" | "suspended" | "fired" | "cancelled";
368
+ inputJson: string;
369
+ cron: string | null;
370
+ timezone: string | null;
371
+ bookedAt: string | null;
372
+ generation: number;
373
+ dispatchAttempts: number;
374
+ dispatchLeaseExpiresAt: string | null;
375
+ lastDispatchAt: string | null;
376
+ lastDispatchError: string | null;
377
+ suspendedAt: string | null;
378
+ cancelledAt: string | null;
379
+ cancellationReason: string | null;
380
+ lastRunAt: string | null;
381
+ createdAt: string;
382
+ updatedAt: string;
383
+ createdBy: string | null;
384
+ service: string | null;
385
+ actorKind: "user" | "operator" | "service" | "agent";
386
+ actorId: string | null;
387
+ };
388
+ export type RaybaseJobScheduleCreateOptions = {
389
+ name: string;
390
+ key: string;
391
+ input: unknown;
392
+ at?: string | number | Date;
393
+ cron?: string;
394
+ timezone?: string;
395
+ };
396
+ export type RaybaseJobScheduleReplaceOptions = Omit<RaybaseJobScheduleCreateOptions, "key">;
397
+ export type RaybaseJobScheduleListOptions = {
398
+ name?: string;
399
+ prefix?: string;
400
+ status?: RaybaseJobSchedule["status"];
401
+ limit?: number;
402
+ };
403
+ export type RaybaseJobScheduleSelection = {
404
+ prefix: string;
405
+ keys?: never;
406
+ } | {
407
+ keys: string[];
408
+ prefix?: never;
409
+ };
410
+ export type RaybaseJobSchedulesRuntime = {
411
+ create(options: RaybaseJobScheduleCreateOptions): Promise<RaybaseJobSchedule>;
412
+ get(key: string): Promise<RaybaseJobSchedule | null>;
413
+ list(options?: RaybaseJobScheduleListOptions): Promise<RaybaseJobSchedule[]>;
414
+ replace(key: string, options: RaybaseJobScheduleReplaceOptions): Promise<RaybaseJobSchedule>;
415
+ cancel(key: string, reason?: string): Promise<RaybaseJobSchedule | null>;
416
+ suspend(selection: RaybaseJobScheduleSelection): Promise<{
417
+ count: number;
418
+ schedules: RaybaseJobSchedule[];
419
+ }>;
420
+ resume(selection: RaybaseJobScheduleSelection): Promise<{
421
+ count: number;
422
+ schedules: RaybaseJobSchedule[];
423
+ }>;
424
+ };
425
+ /**
426
+ * A batch moves `open` → `sealed` → `completed`. It completes, and fires its
427
+ * one continuation, once it is sealed and every child run is terminal.
428
+ */
429
+ export type RaybaseJobBatchStatus = "open" | "sealed" | "completed";
430
+ /** Child runs by state; `pending` counts children that are not yet terminal. */
431
+ export type RaybaseJobBatchCounts = {
432
+ total: number;
433
+ pending: number;
434
+ succeeded: number;
435
+ failed: number;
436
+ cancelled: number;
437
+ denied: number;
438
+ expired: number;
439
+ };
440
+ export type RaybaseJobBatchContinuation = {
441
+ job: string;
442
+ input: unknown;
443
+ };
444
+ export type RaybaseJobBatch = {
445
+ id: string;
446
+ name: string;
447
+ key: string;
448
+ status: RaybaseJobBatchStatus;
449
+ counts: RaybaseJobBatchCounts;
450
+ onComplete: RaybaseJobBatchContinuation;
451
+ onFailure: RaybaseJobBatchContinuation | null;
452
+ /** The one continuation run, set when the batch completes. */
453
+ continuationRunId: string | null;
454
+ continuationJob: string | null;
455
+ continuationDispatchedAt: string | null;
456
+ lastDispatchError: string | null;
457
+ cancelledAt: string | null;
458
+ cancellationReason: string | null;
459
+ createdAt: string;
460
+ updatedAt: string;
461
+ sealedAt: string | null;
462
+ completedAt: string | null;
463
+ /** When the continuation run reached a terminal state. */
464
+ finishedAt: string | null;
465
+ expiresAt: string | null;
466
+ createdBy: string | null;
467
+ actorKind: "user" | "operator" | "service" | "agent";
468
+ actorId: string | null;
469
+ };
470
+ export type RaybaseJobBatchCreateOptions = {
471
+ /** Stable label shown in admin, for example `crawl.pages`. */
472
+ name: string;
473
+ /** Unique inside the data Durable Object; creating an existing key returns that batch. */
474
+ key: string;
475
+ onComplete: RaybaseJobBatchContinuation;
476
+ /** Fires instead of `onComplete` when any child did not succeed or the batch was cancelled. */
477
+ onFailure?: RaybaseJobBatchContinuation;
478
+ };
479
+ export type RaybaseJobBatchEnqueueOptions = Pick<EnqueueJobOptions, "idempotencyKey" | "delay">;
480
+ /** One child for `batches.enqueueMany`: its input plus the options `batches.enqueue` takes. */
481
+ export type RaybaseJobBatchEnqueueItem = RaybaseJobBatchEnqueueOptions & {
482
+ input: unknown;
483
+ };
484
+ export type RaybaseJobBatchChild = {
485
+ runId: string;
486
+ seq: number;
487
+ jobName: string;
488
+ status: RaybaseJobRunStatus;
489
+ /** The key passed to `batches.enqueue`, without the batch scope. */
490
+ idempotencyKey: string | null;
491
+ attempt: number;
492
+ input: unknown;
493
+ result: unknown;
494
+ error: unknown;
495
+ createdAt: string;
496
+ endedAt: string | null;
497
+ };
498
+ export type RaybaseJobBatchChildrenOptions = {
499
+ status?: RaybaseJobRunStatus;
500
+ cursor?: string | null;
501
+ /** Defaults to 50, at most 100. */
502
+ limit?: number;
503
+ };
504
+ export type RaybaseJobBatchChildrenPage = {
505
+ children: RaybaseJobBatchChild[];
506
+ /** Pass back as `cursor` for the next page; null on the last page. */
507
+ cursor: string | null;
508
+ };
509
+ export type RaybaseJobBatchesRuntime = {
510
+ create(options: RaybaseJobBatchCreateOptions): Promise<RaybaseJobBatch>;
511
+ get(batchId: string): Promise<RaybaseJobBatch | null>;
512
+ enqueue(batchId: string, jobName: string, input: unknown, options?: RaybaseJobBatchEnqueueOptions): Promise<RaybaseJobRun>;
513
+ /**
514
+ * Adds many children of one job, as `enqueue` would one at a time, in one
515
+ * Durable Object transaction and one queue batch send per 100 items.
516
+ * Returns the runs in item order.
517
+ */
518
+ enqueueMany(batchId: string, jobName: string, items: readonly RaybaseJobBatchEnqueueItem[]): Promise<RaybaseJobRun[]>;
519
+ seal(batchId: string): Promise<RaybaseJobBatch>;
520
+ cancel(batchId: string, reason?: string): Promise<RaybaseJobBatch>;
521
+ children(batchId: string, options?: RaybaseJobBatchChildrenOptions): Promise<RaybaseJobBatchChildrenPage>;
522
+ };
523
+ /** What a continuation handler receives as `ctx.batch`. */
524
+ export type RaybaseJobBatchContext = {
525
+ id: string;
526
+ name: string;
527
+ key: string;
528
+ counts: RaybaseJobBatchCounts;
529
+ cancelled: boolean;
530
+ cancellationReason: string | null;
531
+ children(options?: RaybaseJobBatchChildrenOptions): Promise<RaybaseJobBatchChildrenPage>;
532
+ };
533
+ export type RaybaseJobsRuntime = {
534
+ enqueue(jobName: string, input: unknown, options?: EnqueueJobOptions): Promise<RaybaseJobRun>;
535
+ schedules: RaybaseJobSchedulesRuntime;
536
+ batches: RaybaseJobBatchesRuntime;
537
+ };
538
+ export declare const unsupportedRaybaseJobsRuntime: RaybaseJobsRuntime;
539
+ /** A continuation prepared and policy-checked when the batch is created. */
540
+ export type RaybaseJobBatchContinuationTemplate = {
541
+ jobName: string;
542
+ inputJson: string;
543
+ inputHash: string | null;
544
+ runAsKind: "user" | "operator" | "service" | "agent";
545
+ runAsId: string | null;
546
+ maxAttempts: number;
547
+ /** Limit keys computed from the input when the batch was created; absent on templates stored before limits existed. */
548
+ concurrencyKey?: string | null;
549
+ rateLimitKey?: string | null;
550
+ };
551
+ export type CreateJobBatchInput = {
552
+ id: string;
553
+ name: string;
554
+ key: string;
555
+ onComplete: RaybaseJobBatchContinuationTemplate;
556
+ onFailure: RaybaseJobBatchContinuationTemplate | null;
557
+ createdBy: string | null;
558
+ actorKind: "user" | "operator" | "service" | "agent";
559
+ actorId: string | null;
560
+ claims?: Record<string, unknown>;
561
+ now: string;
562
+ };
563
+ export type CreateJobBatchResult = {
564
+ created: boolean;
565
+ batch: RaybaseJobBatch;
566
+ };
567
+ /** The `_audit` row values of an audit event, as `recordAudit` would insert them. */
568
+ export type RaybaseJobAuditRow = {
569
+ actorKind: string | null;
570
+ actorId: string | null;
571
+ runAsKind: string | null;
572
+ runAsId: string | null;
573
+ action: string;
574
+ metadata: string | null;
575
+ };
576
+ export type CreateJobBatchChildrenInput = {
577
+ batchId: string;
578
+ /** At most 100; each child's enqueue event and audit row are written only when its run is created. */
579
+ children: Array<{
580
+ run: CreateJobRunInput["run"];
581
+ eventDataJson: string | null;
582
+ audit: RaybaseJobAuditRow;
583
+ }>;
584
+ /** The calling run; a live child may add siblings after the batch is sealed. */
585
+ fromRunId?: string | null;
586
+ now: string;
587
+ };
588
+ export type CreateJobBatchChildrenResult = {
589
+ /** In input order; a repeated idempotency key returns the existing run with `created: false`. */
590
+ children: Array<{
591
+ created: boolean;
592
+ run: RaybaseJobRun;
593
+ }>;
594
+ batch: RaybaseJobBatch;
595
+ };
596
+ export type SealJobBatchInput = {
597
+ batchId: string;
598
+ now: string;
599
+ };
600
+ export type CancelJobBatchInput = {
601
+ batchId: string;
602
+ now: string;
603
+ reason?: string | null;
604
+ actorKind?: string | null;
605
+ actorId?: string | null;
606
+ /** Retention for cancelled children, by job name, falling back to `expiresAt`. */
607
+ expiresAtByJob?: Record<string, string | null>;
608
+ expiresAt?: string | null;
609
+ };
610
+ export type ListJobBatchesInput = {
611
+ status?: RaybaseJobBatchStatus;
612
+ name?: string;
613
+ key?: string;
614
+ limit?: number;
615
+ };
616
+ export type ListJobBatchChildrenInput = RaybaseJobBatchChildrenOptions & {
617
+ batchId: string;
618
+ };
619
+ export declare function batchChildIdempotencyKey(batchId: string, key: string): string;
620
+ export declare function batchContinuationIdempotencyKey(batchId: string): string;
621
+ export type CreateJobScheduleInput = {
622
+ id: string;
623
+ jobName: string;
624
+ key: string;
625
+ kind: "once" | "cron";
626
+ inputJson: string;
627
+ cron?: string | null;
628
+ timezone?: string | null;
629
+ bookedAt: string;
630
+ createdBy?: string | null;
631
+ service?: string | null;
632
+ actorKind?: "user" | "operator" | "service" | "agent";
633
+ actorId?: string | null;
634
+ claims?: Record<string, unknown>;
635
+ now: string;
636
+ };
637
+ export type ListJobSchedulesInput = RaybaseJobScheduleListOptions;
638
+ export type ReplaceJobScheduleInput = Omit<CreateJobScheduleInput, "id" | "key" | "createdBy"> & {
639
+ key: string;
640
+ expected?: Omit<RaybaseJobScheduleExpectedCoordinate, "key">;
641
+ };
642
+ export type RaybaseJobScheduleExpectedCoordinate = {
643
+ key: string;
644
+ scheduleId: string;
645
+ generation: number;
646
+ bookedAt: string | null;
647
+ };
648
+ export type CancelJobScheduleInput = {
649
+ key: string;
650
+ reason?: string | null;
651
+ now: string;
652
+ expected?: {
653
+ scheduleId: string;
654
+ generation: number;
655
+ bookedAt: string | null;
656
+ };
657
+ };
658
+ export type MutateJobScheduleSelectionInput = RaybaseJobScheduleSelection & {
659
+ now: string;
660
+ expected?: RaybaseJobScheduleExpectedCoordinate[];
661
+ };
662
+ export type FindMaterializedScheduledJobRunInput = {
663
+ scheduleId: string;
664
+ key: string;
665
+ generation: number;
666
+ bookedAt: string;
667
+ };
668
+ export type ClaimDueJobSchedulesInput = {
669
+ now: string;
670
+ wallNow: string;
671
+ leaseExpiresAt: string;
672
+ limit?: number;
673
+ };
674
+ export type MaterializeScheduledJobRunInput = {
675
+ scheduleId: string;
676
+ key: string;
677
+ generation: number;
678
+ bookedAt: string;
679
+ materializedAt: string;
680
+ nextBookedAt: string | null;
681
+ run: CreateJobRunInput["run"];
682
+ };
683
+ export type MaterializeScheduledJobRunResult = {
684
+ status: "materialized";
685
+ run: RaybaseJobRun;
686
+ schedule: RaybaseJobSchedule;
687
+ } | {
688
+ status: "existing";
689
+ run: RaybaseJobRun;
690
+ schedule: RaybaseJobSchedule;
691
+ } | {
692
+ status: "stale";
693
+ } | {
694
+ status: "missing";
695
+ };
696
+ export type RaybaseSchedulerState = {
697
+ nextJobScheduleAt: string | null;
698
+ pendingJobSchedules: number;
699
+ leasedJobSchedules: number;
700
+ };
701
+ export type ListDueSchedulesResult = {
702
+ schedules: RaybaseJobSchedule[];
703
+ };
704
+ export type UpsertJobScheduleInput = {
705
+ id: string;
706
+ jobName: string;
707
+ inputJson: string;
708
+ cron: string;
709
+ timezone?: string | null;
710
+ enabled?: boolean;
711
+ nextRunAt?: string | null;
712
+ createdBy?: string | null;
713
+ service?: string | null;
714
+ now: string;
715
+ };
716
+ export type AdvanceScheduleInput = {
717
+ id: string;
718
+ lastRunAt: string;
719
+ nextRunAt: string | null;
720
+ now: string;
721
+ };
722
+ export type CompactJobsInput = {
723
+ now: string;
724
+ wallNow?: string;
725
+ batchSize?: number;
726
+ staleLeaseBefore?: string;
727
+ wallClockBudgetMs?: number;
728
+ };
729
+ export type CompactJobsResult = {
730
+ expiredLeases: number;
731
+ rolledUpRuns: number;
732
+ deletedEvents: number;
733
+ deletedRuns: number;
734
+ more: boolean;
735
+ };
736
+ export type EnqueueJobOptions = {
737
+ idempotencyKey?: string;
738
+ delay?: string | number;
739
+ runId?: string;
740
+ createdAt?: string;
741
+ retryOfRunId?: string;
742
+ };
743
+ export type PreparedJobRun = {
744
+ run: CreateJobRunInput["run"];
745
+ message: RaybaseJobQueueMessage;
746
+ input: unknown;
747
+ };
748
+ export declare function defineJob<Input>(definition: RaybaseJobDefinitionInput<Input>): RaybaseJobDefinition<Input>;
749
+ export declare function jobFromAction<Input, Output, Env, Schema extends RaybaseSchema = RaybaseSchema>(action: RaybaseAction<Input, Output, Env, Schema>, options: RaybaseActionJobOptions<Input, Output, Env, Schema>): RaybaseJobDefinition<Input>;
750
+ export declare function defineJobs<T extends RaybaseJobDefinitions>(jobs: T): RaybaseJobs;
751
+ export declare function normalizeRaybaseJobs(jobs: RaybaseJobDefinitions | undefined): RaybaseJobs;
752
+ export declare function mergeRaybaseJobs(base: RaybaseJobDefinitions | undefined, contribution: RaybaseJobDefinitions | undefined, duplicateMessage?: string): RaybaseJobs;
753
+ export declare function validateJobName(name: string): void;
754
+ export declare function validateJobDefinition(job: RaybaseJobDefinition): void;
755
+ /** The lease a claimed run of `job` holds: the job's own `leaseDuration`, else the app's, else 5 minutes. */
756
+ export declare function jobLeaseDurationMs(job: Pick<RaybaseJobDefinition, "leaseDuration">, appJobs?: {
757
+ leaseDuration?: string | number;
758
+ }): number;
759
+ /** The limits the queue consumer asks the data Durable Object to enforce when it claims a run of `job`. */
760
+ export declare function jobClaimLimits(job: RaybaseJobDefinition): JobRunClaimLimits | undefined;
761
+ /**
762
+ * Redelivery delay for a deferred claim: equal-jitter exponential backoff on
763
+ * the run's deferral count (1s, 2s, 4s ... capped at 30s), never sooner than
764
+ * the rate limit's next token.
765
+ */
766
+ export declare function jobDeferralDelaySeconds(deferral: Pick<RaybaseJobDeferral, "deferrals" | "retryAfterMs">, random?: () => number): number;
767
+ export declare function isTerminalJobStatus(status: string): status is RaybaseJobRunStatus;
768
+ export declare function storedPrincipal(kind: string, id: string | null, user?: RaybaseUser | null): RaybaseJobPrincipal;
769
+ export declare function jobPrincipalId(principal: RaybaseJobPrincipal): string | null;
770
+ export declare function evaluateJobPolicy(policy: JobPolicyExpression | undefined, ctx: {
771
+ principal: RaybaseJobPrincipal;
772
+ action: "enqueue" | "view" | "cancel" | "retry";
773
+ run?: RaybaseJobRun | Record<string, unknown> | null;
774
+ }): boolean;
775
+ export declare function validateJobInput<Input>(job: RaybaseJobDefinition<Input>, input: unknown): Input;
776
+ export declare function prepareJobRun(job: RaybaseJobDefinition, input: unknown, principal: RaybaseJobPrincipal, options?: EnqueueJobOptions, extra?: {
777
+ organizationId?: string;
778
+ wallNow?: string;
779
+ }): Promise<PreparedJobRun>;
780
+ export declare function jobPrincipalUser(principal: RaybaseJobPrincipal): RaybaseUser;
781
+ export declare function retentionExpiresAt(job: RaybaseJobDefinition | undefined, status: RaybaseJobRunStatus, now: string, defaults?: JobRetentionConfig): string | null;
782
+ export declare function retryAvailableAt(job: RaybaseJobDefinition, attempt: number, now: string): string;
783
+ export declare function addDuration(startIso: string, duration: string | number): string;
784
+ export declare function addMilliseconds(startIso: string, ms: number): string;
785
+ export declare function durationMs(duration: string | number | undefined): number;
786
+ export declare function truncateJson(value: unknown, maxBytes?: number): {
787
+ json: string | null;
788
+ truncated: boolean;
789
+ };
790
+ export declare function truncateEventData(value: unknown): string | null;
791
+ export declare function validateQueueMessage(body: unknown): RaybaseJobQueueMessage | null;
792
+ export declare function cronMatches(cron: string, date?: Date, timezone?: string | null): boolean;
793
+ export declare function nextCronRun(cron: string, fromIso: string, timezone?: string | null): string | null;
794
+ export declare function validateCron(cron: string): string[];
795
+ export declare function serviceJobUser(service: string): RaybaseUser;
796
+ //# sourceMappingURL=jobs.d.ts.map