@agentuity/server 1.0.32 → 1.0.34

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 (562) hide show
  1. package/dist/api/api.d.ts +1 -227
  2. package/dist/api/api.d.ts.map +1 -1
  3. package/dist/api/api.js +1 -637
  4. package/dist/api/api.js.map +1 -1
  5. package/dist/api/index.d.ts +1 -17
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/api/index.js +1 -17
  8. package/dist/api/index.js.map +1 -1
  9. package/dist/api/org/env-delete.d.ts +1 -22
  10. package/dist/api/org/env-delete.d.ts.map +1 -1
  11. package/dist/api/org/env-delete.js +1 -24
  12. package/dist/api/org/env-delete.js.map +1 -1
  13. package/dist/api/org/env-get.d.ts +1 -32
  14. package/dist/api/org/env-get.d.ts.map +1 -1
  15. package/dist/api/org/env-get.js +1 -25
  16. package/dist/api/org/env-get.js.map +1 -1
  17. package/dist/api/org/env-update.d.ts +1 -23
  18. package/dist/api/org/env-update.d.ts.map +1 -1
  19. package/dist/api/org/env-update.js +1 -25
  20. package/dist/api/org/env-update.js.map +1 -1
  21. package/dist/api/project/get.d.ts +1 -42
  22. package/dist/api/project/get.d.ts.map +1 -1
  23. package/dist/api/project/get.js +1 -35
  24. package/dist/api/project/get.js.map +1 -1
  25. package/dist/api/project/list.d.ts +1 -47
  26. package/dist/api/project/list.d.ts.map +1 -1
  27. package/dist/api/project/list.js +1 -37
  28. package/dist/api/project/list.js.map +1 -1
  29. package/dist/api/project/malware.d.ts +1 -70
  30. package/dist/api/project/malware.d.ts.map +1 -1
  31. package/dist/api/project/malware.js +1 -41
  32. package/dist/api/project/malware.js.map +1 -1
  33. package/dist/api/region/create.d.ts +1 -80
  34. package/dist/api/region/create.d.ts.map +1 -1
  35. package/dist/api/region/create.js +1 -176
  36. package/dist/api/region/create.js.map +1 -1
  37. package/dist/api/sandbox/client.d.ts +1 -190
  38. package/dist/api/sandbox/client.d.ts.map +1 -1
  39. package/dist/api/sandbox/client.js +1 -260
  40. package/dist/api/sandbox/client.js.map +1 -1
  41. package/dist/api/sandbox/pause.d.ts +1 -21
  42. package/dist/api/sandbox/pause.d.ts.map +1 -1
  43. package/dist/api/sandbox/pause.js +1 -24
  44. package/dist/api/sandbox/pause.js.map +1 -1
  45. package/dist/api/sandbox/resume.d.ts +1 -21
  46. package/dist/api/sandbox/resume.d.ts.map +1 -1
  47. package/dist/api/sandbox/resume.js +1 -24
  48. package/dist/api/sandbox/resume.js.map +1 -1
  49. package/dist/api/sandbox/util.d.ts +1 -284
  50. package/dist/api/sandbox/util.d.ts.map +1 -1
  51. package/dist/api/sandbox/util.js +1 -210
  52. package/dist/api/sandbox/util.js.map +1 -1
  53. package/dist/api/user/whoami.d.ts +1 -38
  54. package/dist/api/user/whoami.d.ts.map +1 -1
  55. package/dist/api/user/whoami.js +1 -26
  56. package/dist/api/user/whoami.js.map +1 -1
  57. package/dist/index.d.ts +1 -4
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +3 -12
  60. package/dist/index.js.map +1 -1
  61. package/package.json +4 -4
  62. package/src/api/api.ts +1 -936
  63. package/src/api/index.ts +1 -17
  64. package/src/api/org/env-delete.ts +1 -37
  65. package/src/api/org/env-get.ts +1 -43
  66. package/src/api/org/env-update.ts +1 -38
  67. package/src/api/project/get.ts +1 -49
  68. package/src/api/project/list.ts +1 -54
  69. package/src/api/project/malware.ts +1 -68
  70. package/src/api/region/create.ts +1 -207
  71. package/src/api/sandbox/client.ts +1 -460
  72. package/src/api/sandbox/pause.ts +1 -39
  73. package/src/api/sandbox/resume.ts +1 -39
  74. package/src/api/sandbox/util.ts +1 -276
  75. package/src/api/user/whoami.ts +1 -32
  76. package/src/index.ts +3 -30
  77. package/dist/api/apikey/create.d.ts +0 -33
  78. package/dist/api/apikey/create.d.ts.map +0 -1
  79. package/dist/api/apikey/create.js +0 -23
  80. package/dist/api/apikey/create.js.map +0 -1
  81. package/dist/api/apikey/delete.d.ts +0 -19
  82. package/dist/api/apikey/delete.d.ts.map +0 -1
  83. package/dist/api/apikey/delete.js +0 -19
  84. package/dist/api/apikey/delete.js.map +0 -1
  85. package/dist/api/apikey/get.d.ts +0 -45
  86. package/dist/api/apikey/get.d.ts.map +0 -1
  87. package/dist/api/apikey/get.js +0 -36
  88. package/dist/api/apikey/get.js.map +0 -1
  89. package/dist/api/apikey/index.d.ts +0 -6
  90. package/dist/api/apikey/index.d.ts.map +0 -1
  91. package/dist/api/apikey/index.js +0 -6
  92. package/dist/api/apikey/index.js.map +0 -1
  93. package/dist/api/apikey/list.d.ts +0 -64
  94. package/dist/api/apikey/list.d.ts.map +0 -1
  95. package/dist/api/apikey/list.js +0 -46
  96. package/dist/api/apikey/list.js.map +0 -1
  97. package/dist/api/apikey/util.d.ts +0 -23
  98. package/dist/api/apikey/util.d.ts.map +0 -1
  99. package/dist/api/apikey/util.js +0 -3
  100. package/dist/api/apikey/util.js.map +0 -1
  101. package/dist/api/db/index.d.ts +0 -5
  102. package/dist/api/db/index.d.ts.map +0 -1
  103. package/dist/api/db/index.js +0 -5
  104. package/dist/api/db/index.js.map +0 -1
  105. package/dist/api/db/logs.d.ts +0 -70
  106. package/dist/api/db/logs.d.ts.map +0 -1
  107. package/dist/api/db/logs.js +0 -59
  108. package/dist/api/db/logs.js.map +0 -1
  109. package/dist/api/db/query.d.ts +0 -39
  110. package/dist/api/db/query.d.ts.map +0 -1
  111. package/dist/api/db/query.js +0 -49
  112. package/dist/api/db/query.js.map +0 -1
  113. package/dist/api/db/tables.d.ts +0 -49
  114. package/dist/api/db/tables.d.ts.map +0 -1
  115. package/dist/api/db/tables.js +0 -59
  116. package/dist/api/db/tables.js.map +0 -1
  117. package/dist/api/db/util.d.ts +0 -31
  118. package/dist/api/db/util.d.ts.map +0 -1
  119. package/dist/api/db/util.js +0 -4
  120. package/dist/api/db/util.js.map +0 -1
  121. package/dist/api/eval/get.d.ts +0 -36
  122. package/dist/api/eval/get.d.ts.map +0 -1
  123. package/dist/api/eval/get.js +0 -23
  124. package/dist/api/eval/get.js.map +0 -1
  125. package/dist/api/eval/index.d.ts +0 -5
  126. package/dist/api/eval/index.d.ts.map +0 -1
  127. package/dist/api/eval/index.js +0 -5
  128. package/dist/api/eval/index.js.map +0 -1
  129. package/dist/api/eval/list.d.ts +0 -50
  130. package/dist/api/eval/list.d.ts.map +0 -1
  131. package/dist/api/eval/list.js +0 -32
  132. package/dist/api/eval/list.js.map +0 -1
  133. package/dist/api/eval/run-get.d.ts +0 -48
  134. package/dist/api/eval/run-get.d.ts.map +0 -1
  135. package/dist/api/eval/run-get.js +0 -29
  136. package/dist/api/eval/run-get.js.map +0 -1
  137. package/dist/api/eval/run-list.d.ts +0 -70
  138. package/dist/api/eval/run-list.d.ts.map +0 -1
  139. package/dist/api/eval/run-list.js +0 -42
  140. package/dist/api/eval/run-list.js.map +0 -1
  141. package/dist/api/machine/index.d.ts +0 -3
  142. package/dist/api/machine/index.d.ts.map +0 -1
  143. package/dist/api/machine/index.js +0 -3
  144. package/dist/api/machine/index.js.map +0 -1
  145. package/dist/api/machine/machine.d.ts +0 -192
  146. package/dist/api/machine/machine.d.ts.map +0 -1
  147. package/dist/api/machine/machine.js +0 -109
  148. package/dist/api/machine/machine.js.map +0 -1
  149. package/dist/api/machine/util.d.ts +0 -14
  150. package/dist/api/machine/util.d.ts.map +0 -1
  151. package/dist/api/machine/util.js +0 -3
  152. package/dist/api/machine/util.js.map +0 -1
  153. package/dist/api/org/index.d.ts +0 -7
  154. package/dist/api/org/index.d.ts.map +0 -1
  155. package/dist/api/org/index.js +0 -7
  156. package/dist/api/org/index.js.map +0 -1
  157. package/dist/api/org/list.d.ts +0 -27
  158. package/dist/api/org/list.d.ts.map +0 -1
  159. package/dist/api/org/list.js +0 -22
  160. package/dist/api/org/list.js.map +0 -1
  161. package/dist/api/org/resources.d.ts +0 -141
  162. package/dist/api/org/resources.d.ts.map +0 -1
  163. package/dist/api/org/resources.js +0 -97
  164. package/dist/api/org/resources.js.map +0 -1
  165. package/dist/api/org/util.d.ts +0 -45
  166. package/dist/api/org/util.d.ts.map +0 -1
  167. package/dist/api/org/util.js +0 -4
  168. package/dist/api/org/util.js.map +0 -1
  169. package/dist/api/project/agent.d.ts +0 -89
  170. package/dist/api/project/agent.d.ts.map +0 -1
  171. package/dist/api/project/agent.js +0 -60
  172. package/dist/api/project/agent.js.map +0 -1
  173. package/dist/api/project/create.d.ts +0 -37
  174. package/dist/api/project/create.d.ts.map +0 -1
  175. package/dist/api/project/create.js +0 -31
  176. package/dist/api/project/create.js.map +0 -1
  177. package/dist/api/project/delete.d.ts +0 -15
  178. package/dist/api/project/delete.d.ts.map +0 -1
  179. package/dist/api/project/delete.js +0 -13
  180. package/dist/api/project/delete.js.map +0 -1
  181. package/dist/api/project/deploy.d.ts +0 -490
  182. package/dist/api/project/deploy.d.ts.map +0 -1
  183. package/dist/api/project/deploy.js +0 -313
  184. package/dist/api/project/deploy.js.map +0 -1
  185. package/dist/api/project/deployment.d.ts +0 -237
  186. package/dist/api/project/deployment.d.ts.map +0 -1
  187. package/dist/api/project/deployment.js +0 -127
  188. package/dist/api/project/deployment.js.map +0 -1
  189. package/dist/api/project/env-delete.d.ts +0 -22
  190. package/dist/api/project/env-delete.d.ts.map +0 -1
  191. package/dist/api/project/env-delete.js +0 -29
  192. package/dist/api/project/env-delete.js.map +0 -1
  193. package/dist/api/project/env-update.d.ts +0 -31
  194. package/dist/api/project/env-update.d.ts.map +0 -1
  195. package/dist/api/project/env-update.js +0 -36
  196. package/dist/api/project/env-update.js.map +0 -1
  197. package/dist/api/project/exists.d.ts +0 -25
  198. package/dist/api/project/exists.d.ts.map +0 -1
  199. package/dist/api/project/exists.js +0 -45
  200. package/dist/api/project/exists.js.map +0 -1
  201. package/dist/api/project/hostname.d.ts +0 -25
  202. package/dist/api/project/hostname.d.ts.map +0 -1
  203. package/dist/api/project/hostname.js +0 -37
  204. package/dist/api/project/hostname.js.map +0 -1
  205. package/dist/api/project/index.d.ts +0 -14
  206. package/dist/api/project/index.d.ts.map +0 -1
  207. package/dist/api/project/index.js +0 -14
  208. package/dist/api/project/index.js.map +0 -1
  209. package/dist/api/project/update-region.d.ts +0 -27
  210. package/dist/api/project/update-region.d.ts.map +0 -1
  211. package/dist/api/project/update-region.js +0 -25
  212. package/dist/api/project/update-region.js.map +0 -1
  213. package/dist/api/project/util.d.ts +0 -62
  214. package/dist/api/project/util.d.ts.map +0 -1
  215. package/dist/api/project/util.js +0 -6
  216. package/dist/api/project/util.js.map +0 -1
  217. package/dist/api/queue/analytics.d.ts +0 -250
  218. package/dist/api/queue/analytics.d.ts.map +0 -1
  219. package/dist/api/queue/analytics.js +0 -233
  220. package/dist/api/queue/analytics.js.map +0 -1
  221. package/dist/api/queue/destinations.d.ts +0 -202
  222. package/dist/api/queue/destinations.d.ts.map +0 -1
  223. package/dist/api/queue/destinations.js +0 -168
  224. package/dist/api/queue/destinations.js.map +0 -1
  225. package/dist/api/queue/dlq.d.ts +0 -168
  226. package/dist/api/queue/dlq.d.ts.map +0 -1
  227. package/dist/api/queue/dlq.js +0 -166
  228. package/dist/api/queue/dlq.js.map +0 -1
  229. package/dist/api/queue/index.d.ts +0 -56
  230. package/dist/api/queue/index.d.ts.map +0 -1
  231. package/dist/api/queue/index.js +0 -90
  232. package/dist/api/queue/index.js.map +0 -1
  233. package/dist/api/queue/messages.d.ts +0 -503
  234. package/dist/api/queue/messages.d.ts.map +0 -1
  235. package/dist/api/queue/messages.js +0 -549
  236. package/dist/api/queue/messages.js.map +0 -1
  237. package/dist/api/queue/queues.d.ts +0 -226
  238. package/dist/api/queue/queues.d.ts.map +0 -1
  239. package/dist/api/queue/queues.js +0 -321
  240. package/dist/api/queue/queues.js.map +0 -1
  241. package/dist/api/queue/sources.d.ts +0 -202
  242. package/dist/api/queue/sources.d.ts.map +0 -1
  243. package/dist/api/queue/sources.js +0 -202
  244. package/dist/api/queue/sources.js.map +0 -1
  245. package/dist/api/queue/types.d.ts +0 -1218
  246. package/dist/api/queue/types.d.ts.map +0 -1
  247. package/dist/api/queue/types.js +0 -1002
  248. package/dist/api/queue/types.js.map +0 -1
  249. package/dist/api/queue/util.d.ts +0 -278
  250. package/dist/api/queue/util.d.ts.map +0 -1
  251. package/dist/api/queue/util.js +0 -235
  252. package/dist/api/queue/util.js.map +0 -1
  253. package/dist/api/queue/validation.d.ts +0 -247
  254. package/dist/api/queue/validation.d.ts.map +0 -1
  255. package/dist/api/queue/validation.js +0 -513
  256. package/dist/api/queue/validation.js.map +0 -1
  257. package/dist/api/queue/websocket.d.ts +0 -168
  258. package/dist/api/queue/websocket.d.ts.map +0 -1
  259. package/dist/api/queue/websocket.js +0 -394
  260. package/dist/api/queue/websocket.js.map +0 -1
  261. package/dist/api/region/delete.d.ts +0 -62
  262. package/dist/api/region/delete.d.ts.map +0 -1
  263. package/dist/api/region/delete.js +0 -37
  264. package/dist/api/region/delete.js.map +0 -1
  265. package/dist/api/region/index.d.ts +0 -5
  266. package/dist/api/region/index.d.ts.map +0 -1
  267. package/dist/api/region/index.js +0 -5
  268. package/dist/api/region/index.js.map +0 -1
  269. package/dist/api/region/list.d.ts +0 -27
  270. package/dist/api/region/list.d.ts.map +0 -1
  271. package/dist/api/region/list.js +0 -22
  272. package/dist/api/region/list.js.map +0 -1
  273. package/dist/api/region/resources.d.ts +0 -71
  274. package/dist/api/region/resources.d.ts.map +0 -1
  275. package/dist/api/region/resources.js +0 -53
  276. package/dist/api/region/resources.js.map +0 -1
  277. package/dist/api/region/util.d.ts +0 -23
  278. package/dist/api/region/util.d.ts.map +0 -1
  279. package/dist/api/region/util.js +0 -3
  280. package/dist/api/region/util.js.map +0 -1
  281. package/dist/api/sandbox/cli-list.d.ts +0 -114
  282. package/dist/api/sandbox/cli-list.d.ts.map +0 -1
  283. package/dist/api/sandbox/cli-list.js +0 -71
  284. package/dist/api/sandbox/cli-list.js.map +0 -1
  285. package/dist/api/sandbox/create.d.ts +0 -118
  286. package/dist/api/sandbox/create.d.ts.map +0 -1
  287. package/dist/api/sandbox/create.js +0 -211
  288. package/dist/api/sandbox/create.js.map +0 -1
  289. package/dist/api/sandbox/destroy.d.ts +0 -22
  290. package/dist/api/sandbox/destroy.d.ts.map +0 -1
  291. package/dist/api/sandbox/destroy.js +0 -25
  292. package/dist/api/sandbox/destroy.js.map +0 -1
  293. package/dist/api/sandbox/disk-checkpoint.d.ts +0 -104
  294. package/dist/api/sandbox/disk-checkpoint.d.ts.map +0 -1
  295. package/dist/api/sandbox/disk-checkpoint.js +0 -104
  296. package/dist/api/sandbox/disk-checkpoint.js.map +0 -1
  297. package/dist/api/sandbox/execute.d.ts +0 -69
  298. package/dist/api/sandbox/execute.d.ts.map +0 -1
  299. package/dist/api/sandbox/execute.js +0 -103
  300. package/dist/api/sandbox/execute.js.map +0 -1
  301. package/dist/api/sandbox/execution.d.ts +0 -169
  302. package/dist/api/sandbox/execution.d.ts.map +0 -1
  303. package/dist/api/sandbox/execution.js +0 -118
  304. package/dist/api/sandbox/execution.js.map +0 -1
  305. package/dist/api/sandbox/files.d.ts +0 -261
  306. package/dist/api/sandbox/files.d.ts.map +0 -1
  307. package/dist/api/sandbox/files.js +0 -386
  308. package/dist/api/sandbox/files.js.map +0 -1
  309. package/dist/api/sandbox/get.d.ts +0 -283
  310. package/dist/api/sandbox/get.d.ts.map +0 -1
  311. package/dist/api/sandbox/get.js +0 -215
  312. package/dist/api/sandbox/get.js.map +0 -1
  313. package/dist/api/sandbox/getStatus.d.ts +0 -16
  314. package/dist/api/sandbox/getStatus.d.ts.map +0 -1
  315. package/dist/api/sandbox/getStatus.js +0 -32
  316. package/dist/api/sandbox/getStatus.js.map +0 -1
  317. package/dist/api/sandbox/index.d.ts +0 -39
  318. package/dist/api/sandbox/index.d.ts.map +0 -1
  319. package/dist/api/sandbox/index.js +0 -20
  320. package/dist/api/sandbox/index.js.map +0 -1
  321. package/dist/api/sandbox/list.d.ts +0 -293
  322. package/dist/api/sandbox/list.d.ts.map +0 -1
  323. package/dist/api/sandbox/list.js +0 -191
  324. package/dist/api/sandbox/list.js.map +0 -1
  325. package/dist/api/sandbox/resolve.d.ts +0 -82
  326. package/dist/api/sandbox/resolve.d.ts.map +0 -1
  327. package/dist/api/sandbox/resolve.js +0 -71
  328. package/dist/api/sandbox/resolve.js.map +0 -1
  329. package/dist/api/sandbox/run.d.ts +0 -28
  330. package/dist/api/sandbox/run.d.ts.map +0 -1
  331. package/dist/api/sandbox/run.js +0 -342
  332. package/dist/api/sandbox/run.js.map +0 -1
  333. package/dist/api/sandbox/runtime.d.ts +0 -83
  334. package/dist/api/sandbox/runtime.d.ts.map +0 -1
  335. package/dist/api/sandbox/runtime.js +0 -78
  336. package/dist/api/sandbox/runtime.js.map +0 -1
  337. package/dist/api/sandbox/snapshot-build.d.ts +0 -48
  338. package/dist/api/sandbox/snapshot-build.d.ts.map +0 -1
  339. package/dist/api/sandbox/snapshot-build.js +0 -74
  340. package/dist/api/sandbox/snapshot-build.js.map +0 -1
  341. package/dist/api/sandbox/snapshot.d.ts +0 -595
  342. package/dist/api/sandbox/snapshot.d.ts.map +0 -1
  343. package/dist/api/sandbox/snapshot.js +0 -598
  344. package/dist/api/sandbox/snapshot.js.map +0 -1
  345. package/dist/api/services/index.d.ts +0 -2
  346. package/dist/api/services/index.d.ts.map +0 -1
  347. package/dist/api/services/index.js +0 -2
  348. package/dist/api/services/index.js.map +0 -1
  349. package/dist/api/services/stats.d.ts +0 -263
  350. package/dist/api/services/stats.d.ts.map +0 -1
  351. package/dist/api/services/stats.js +0 -144
  352. package/dist/api/services/stats.js.map +0 -1
  353. package/dist/api/session/get.d.ts +0 -169
  354. package/dist/api/session/get.d.ts.map +0 -1
  355. package/dist/api/session/get.js +0 -56
  356. package/dist/api/session/get.js.map +0 -1
  357. package/dist/api/session/index.d.ts +0 -4
  358. package/dist/api/session/index.d.ts.map +0 -1
  359. package/dist/api/session/index.js +0 -4
  360. package/dist/api/session/index.js.map +0 -1
  361. package/dist/api/session/list.d.ts +0 -143
  362. package/dist/api/session/list.d.ts.map +0 -1
  363. package/dist/api/session/list.js +0 -91
  364. package/dist/api/session/list.js.map +0 -1
  365. package/dist/api/session/logs.d.ts +0 -40
  366. package/dist/api/session/logs.d.ts.map +0 -1
  367. package/dist/api/session/logs.js +0 -28
  368. package/dist/api/session/logs.js.map +0 -1
  369. package/dist/api/session/util.d.ts +0 -23
  370. package/dist/api/session/util.d.ts.map +0 -1
  371. package/dist/api/session/util.js +0 -3
  372. package/dist/api/session/util.js.map +0 -1
  373. package/dist/api/storage/config.d.ts +0 -99
  374. package/dist/api/storage/config.d.ts.map +0 -1
  375. package/dist/api/storage/config.js +0 -61
  376. package/dist/api/storage/config.js.map +0 -1
  377. package/dist/api/storage/index.d.ts +0 -5
  378. package/dist/api/storage/index.d.ts.map +0 -1
  379. package/dist/api/storage/index.js +0 -5
  380. package/dist/api/storage/index.js.map +0 -1
  381. package/dist/api/storage/objects.d.ts +0 -155
  382. package/dist/api/storage/objects.d.ts.map +0 -1
  383. package/dist/api/storage/objects.js +0 -148
  384. package/dist/api/storage/objects.js.map +0 -1
  385. package/dist/api/storage/types.d.ts +0 -161
  386. package/dist/api/storage/types.d.ts.map +0 -1
  387. package/dist/api/storage/types.js +0 -141
  388. package/dist/api/storage/types.js.map +0 -1
  389. package/dist/api/storage/util.d.ts +0 -48
  390. package/dist/api/storage/util.d.ts.map +0 -1
  391. package/dist/api/storage/util.js +0 -8
  392. package/dist/api/storage/util.js.map +0 -1
  393. package/dist/api/stream/get.d.ts +0 -58
  394. package/dist/api/stream/get.d.ts.map +0 -1
  395. package/dist/api/stream/get.js +0 -40
  396. package/dist/api/stream/get.js.map +0 -1
  397. package/dist/api/stream/index.d.ts +0 -4
  398. package/dist/api/stream/index.d.ts.map +0 -1
  399. package/dist/api/stream/index.js +0 -4
  400. package/dist/api/stream/index.js.map +0 -1
  401. package/dist/api/stream/list.d.ts +0 -120
  402. package/dist/api/stream/list.d.ts.map +0 -1
  403. package/dist/api/stream/list.js +0 -77
  404. package/dist/api/stream/list.js.map +0 -1
  405. package/dist/api/stream/util.d.ts +0 -23
  406. package/dist/api/stream/util.d.ts.map +0 -1
  407. package/dist/api/stream/util.js +0 -3
  408. package/dist/api/stream/util.js.map +0 -1
  409. package/dist/api/thread/delete.d.ts +0 -23
  410. package/dist/api/thread/delete.d.ts.map +0 -1
  411. package/dist/api/thread/delete.js +0 -21
  412. package/dist/api/thread/delete.js.map +0 -1
  413. package/dist/api/thread/get.d.ts +0 -36
  414. package/dist/api/thread/get.d.ts.map +0 -1
  415. package/dist/api/thread/get.js +0 -23
  416. package/dist/api/thread/get.js.map +0 -1
  417. package/dist/api/thread/index.d.ts +0 -5
  418. package/dist/api/thread/index.d.ts.map +0 -1
  419. package/dist/api/thread/index.js +0 -5
  420. package/dist/api/thread/index.js.map +0 -1
  421. package/dist/api/thread/list.d.ts +0 -69
  422. package/dist/api/thread/list.d.ts.map +0 -1
  423. package/dist/api/thread/list.js +0 -51
  424. package/dist/api/thread/list.js.map +0 -1
  425. package/dist/api/thread/util.d.ts +0 -23
  426. package/dist/api/thread/util.d.ts.map +0 -1
  427. package/dist/api/thread/util.js +0 -3
  428. package/dist/api/thread/util.js.map +0 -1
  429. package/dist/api/user/index.d.ts +0 -2
  430. package/dist/api/user/index.d.ts.map +0 -1
  431. package/dist/api/user/index.js +0 -2
  432. package/dist/api/user/index.js.map +0 -1
  433. package/dist/api/user/util.d.ts +0 -23
  434. package/dist/api/user/util.d.ts.map +0 -1
  435. package/dist/api/user/util.js +0 -3
  436. package/dist/api/user/util.js.map +0 -1
  437. package/dist/api/webhook/deliveries.d.ts +0 -94
  438. package/dist/api/webhook/deliveries.d.ts.map +0 -1
  439. package/dist/api/webhook/deliveries.js +0 -79
  440. package/dist/api/webhook/deliveries.js.map +0 -1
  441. package/dist/api/webhook/destinations.d.ts +0 -136
  442. package/dist/api/webhook/destinations.d.ts.map +0 -1
  443. package/dist/api/webhook/destinations.js +0 -137
  444. package/dist/api/webhook/destinations.js.map +0 -1
  445. package/dist/api/webhook/index.d.ts +0 -41
  446. package/dist/api/webhook/index.d.ts.map +0 -1
  447. package/dist/api/webhook/index.js +0 -59
  448. package/dist/api/webhook/index.js.map +0 -1
  449. package/dist/api/webhook/receipts.d.ts +0 -77
  450. package/dist/api/webhook/receipts.d.ts.map +0 -1
  451. package/dist/api/webhook/receipts.js +0 -78
  452. package/dist/api/webhook/receipts.js.map +0 -1
  453. package/dist/api/webhook/types.d.ts +0 -249
  454. package/dist/api/webhook/types.d.ts.map +0 -1
  455. package/dist/api/webhook/types.js +0 -221
  456. package/dist/api/webhook/types.js.map +0 -1
  457. package/dist/api/webhook/util.d.ts +0 -202
  458. package/dist/api/webhook/util.d.ts.map +0 -1
  459. package/dist/api/webhook/util.js +0 -201
  460. package/dist/api/webhook/util.js.map +0 -1
  461. package/dist/api/webhook/webhooks.d.ts +0 -146
  462. package/dist/api/webhook/webhooks.d.ts.map +0 -1
  463. package/dist/api/webhook/webhooks.js +0 -165
  464. package/dist/api/webhook/webhooks.js.map +0 -1
  465. package/src/api/api-example.md +0 -164
  466. package/src/api/apikey/create.ts +0 -41
  467. package/src/api/apikey/delete.ts +0 -30
  468. package/src/api/apikey/get.ts +0 -48
  469. package/src/api/apikey/index.ts +0 -5
  470. package/src/api/apikey/list.ts +0 -64
  471. package/src/api/apikey/util.ts +0 -3
  472. package/src/api/db/index.ts +0 -27
  473. package/src/api/db/logs.ts +0 -75
  474. package/src/api/db/query.ts +0 -67
  475. package/src/api/db/tables.ts +0 -92
  476. package/src/api/db/util.ts +0 -9
  477. package/src/api/eval/get.ts +0 -33
  478. package/src/api/eval/index.ts +0 -28
  479. package/src/api/eval/list.ts +0 -49
  480. package/src/api/eval/run-get.ts +0 -39
  481. package/src/api/eval/run-list.ts +0 -59
  482. package/src/api/machine/index.ts +0 -2
  483. package/src/api/machine/machine.ts +0 -160
  484. package/src/api/machine/util.ts +0 -5
  485. package/src/api/org/index.ts +0 -6
  486. package/src/api/org/list.ts +0 -28
  487. package/src/api/org/resources.ts +0 -140
  488. package/src/api/org/util.ts +0 -4
  489. package/src/api/project/agent.ts +0 -86
  490. package/src/api/project/create.ts +0 -47
  491. package/src/api/project/delete.ts +0 -25
  492. package/src/api/project/deploy.ts +0 -458
  493. package/src/api/project/deployment.ts +0 -195
  494. package/src/api/project/env-delete.ts +0 -45
  495. package/src/api/project/env-update.ts +0 -55
  496. package/src/api/project/exists.ts +0 -58
  497. package/src/api/project/hostname.ts +0 -73
  498. package/src/api/project/index.ts +0 -13
  499. package/src/api/project/update-region.ts +0 -44
  500. package/src/api/project/util.ts +0 -8
  501. package/src/api/queue/analytics.ts +0 -311
  502. package/src/api/queue/destinations.ts +0 -259
  503. package/src/api/queue/dlq.ts +0 -243
  504. package/src/api/queue/index.ts +0 -308
  505. package/src/api/queue/messages.ts +0 -784
  506. package/src/api/queue/queues.ts +0 -460
  507. package/src/api/queue/sources.ts +0 -294
  508. package/src/api/queue/types.ts +0 -1325
  509. package/src/api/queue/util.ts +0 -278
  510. package/src/api/queue/validation.ts +0 -560
  511. package/src/api/queue/websocket.ts +0 -514
  512. package/src/api/region/delete.ts +0 -57
  513. package/src/api/region/index.ts +0 -4
  514. package/src/api/region/list.ts +0 -32
  515. package/src/api/region/resources.ts +0 -69
  516. package/src/api/region/util.ts +0 -3
  517. package/src/api/sandbox/cli-list.ts +0 -127
  518. package/src/api/sandbox/create.ts +0 -256
  519. package/src/api/sandbox/destroy.ts +0 -41
  520. package/src/api/sandbox/disk-checkpoint.ts +0 -179
  521. package/src/api/sandbox/execute.ts +0 -132
  522. package/src/api/sandbox/execution.ts +0 -183
  523. package/src/api/sandbox/files.ts +0 -596
  524. package/src/api/sandbox/get.ts +0 -249
  525. package/src/api/sandbox/getStatus.ts +0 -54
  526. package/src/api/sandbox/index.ts +0 -211
  527. package/src/api/sandbox/list.ts +0 -224
  528. package/src/api/sandbox/resolve.ts +0 -98
  529. package/src/api/sandbox/run.ts +0 -439
  530. package/src/api/sandbox/runtime.ts +0 -100
  531. package/src/api/sandbox/snapshot-build.ts +0 -98
  532. package/src/api/sandbox/snapshot.ts +0 -781
  533. package/src/api/services/index.ts +0 -1
  534. package/src/api/services/stats.ts +0 -213
  535. package/src/api/session/get.ts +0 -106
  536. package/src/api/session/index.ts +0 -3
  537. package/src/api/session/list.ts +0 -136
  538. package/src/api/session/logs.ts +0 -47
  539. package/src/api/session/util.ts +0 -3
  540. package/src/api/storage/config.ts +0 -111
  541. package/src/api/storage/index.ts +0 -4
  542. package/src/api/storage/objects.ts +0 -250
  543. package/src/api/storage/types.ts +0 -174
  544. package/src/api/storage/util.ts +0 -10
  545. package/src/api/stream/get.ts +0 -51
  546. package/src/api/stream/index.ts +0 -3
  547. package/src/api/stream/list.ts +0 -127
  548. package/src/api/stream/util.ts +0 -3
  549. package/src/api/thread/delete.ts +0 -31
  550. package/src/api/thread/get.ts +0 -34
  551. package/src/api/thread/index.ts +0 -4
  552. package/src/api/thread/list.ts +0 -76
  553. package/src/api/thread/util.ts +0 -3
  554. package/src/api/user/index.ts +0 -1
  555. package/src/api/user/util.ts +0 -3
  556. package/src/api/webhook/deliveries.ts +0 -129
  557. package/src/api/webhook/destinations.ts +0 -224
  558. package/src/api/webhook/index.ts +0 -133
  559. package/src/api/webhook/receipts.ts +0 -124
  560. package/src/api/webhook/types.ts +0 -309
  561. package/src/api/webhook/util.ts +0 -237
  562. package/src/api/webhook/webhooks.ts +0 -260
@@ -1,513 +0,0 @@
1
- /**
2
- * @module validation
3
- * Queue validation utilities with constants matching the Catalyst backend.
4
- *
5
- * These validation functions perform client-side validation before API calls,
6
- * providing immediate feedback and reducing unnecessary network requests.
7
- */
8
- import { StructuredError } from '@agentuity/core';
9
- // ============================================================================
10
- // Validation Constants
11
- // ============================================================================
12
- /** Maximum allowed length for queue names. */
13
- export const MAX_QUEUE_NAME_LENGTH = 256;
14
- /** Minimum allowed length for queue names. */
15
- export const MIN_QUEUE_NAME_LENGTH = 1;
16
- /** Maximum payload size in bytes (1MB). */
17
- export const MAX_PAYLOAD_SIZE = 1048576;
18
- /** Maximum description length in characters. */
19
- export const MAX_DESCRIPTION_LENGTH = 1024;
20
- /** Maximum number of messages in a single batch operation. */
21
- export const MAX_BATCH_SIZE = 1000;
22
- /** Maximum metadata size in bytes (64KB). */
23
- export const MAX_METADATA_SIZE = 65536;
24
- /** Maximum partition key length in characters. */
25
- export const MAX_PARTITION_KEY_LENGTH = 256;
26
- /** Maximum idempotency key length in characters. */
27
- export const MAX_IDEMPOTENCY_KEY_LENGTH = 256;
28
- /** Maximum visibility timeout in seconds (12 hours). */
29
- export const MAX_VISIBILITY_TIMEOUT = 43200;
30
- /** Maximum number of retry attempts allowed. */
31
- export const MAX_RETRIES = 100;
32
- /** Maximum number of in-flight messages per client. */
33
- export const MAX_IN_FLIGHT = 1000;
34
- /** Queue name pattern: starts with letter/underscore, contains lowercase alphanumerics, underscores, hyphens. */
35
- const VALID_QUEUE_NAME_REGEX = /^[a-z_][a-z0-9_-]*$/;
36
- /** Message ID pattern: must start with qmsg_ prefix. */
37
- const VALID_MESSAGE_ID_REGEX = /^qmsg_[a-zA-Z0-9]+$/;
38
- /** Destination ID pattern: must start with qdest_ prefix. */
39
- const VALID_DESTINATION_ID_REGEX = /^qdest_[a-zA-Z0-9]+$/;
40
- /** Source ID pattern: must start with qsrc_ prefix. */
41
- const VALID_SOURCE_ID_REGEX = /^qsrc_[a-zA-Z0-9]+$/;
42
- /** Maximum source name length. */
43
- export const MAX_SOURCE_NAME_LENGTH = 256;
44
- // ============================================================================
45
- // Validation Error
46
- // ============================================================================
47
- /**
48
- * Error thrown when validation fails for queue operations.
49
- *
50
- * Includes the field name and optionally the invalid value for debugging.
51
- *
52
- * @example
53
- * ```typescript
54
- * try {
55
- * validateQueueName('Invalid Name!');
56
- * } catch (error) {
57
- * if (error instanceof QueueValidationError) {
58
- * console.error(`Invalid ${error.field}: ${error.message}`);
59
- * }
60
- * }
61
- * ```
62
- */
63
- export const QueueValidationError = StructuredError('QueueValidationError')();
64
- // ============================================================================
65
- // Validation Functions
66
- // ============================================================================
67
- /**
68
- * Validates a queue name against naming rules.
69
- *
70
- * Queue names must:
71
- * - Be 1-256 characters long
72
- * - Start with a lowercase letter or underscore
73
- * - Contain only lowercase letters, digits, underscores, and hyphens
74
- *
75
- * @param name - The queue name to validate
76
- * @throws {QueueValidationError} If the name is invalid
77
- *
78
- * @example
79
- * ```typescript
80
- * validateQueueName('my_queue'); // OK
81
- * validateQueueName('order-queue'); // OK
82
- * validateQueueName('Invalid Name!'); // Throws
83
- * ```
84
- */
85
- export function validateQueueName(name) {
86
- if (!name || name.length < MIN_QUEUE_NAME_LENGTH) {
87
- throw new QueueValidationError({
88
- message: 'Queue name cannot be empty',
89
- field: 'name',
90
- value: name,
91
- });
92
- }
93
- if (name.length > MAX_QUEUE_NAME_LENGTH) {
94
- throw new QueueValidationError({
95
- message: `Queue name must not exceed ${MAX_QUEUE_NAME_LENGTH} characters`,
96
- field: 'name',
97
- value: name,
98
- });
99
- }
100
- if (!VALID_QUEUE_NAME_REGEX.test(name)) {
101
- throw new QueueValidationError({
102
- message: 'Queue name must start with a letter or underscore and contain only lowercase letters, digits, underscores, and hyphens',
103
- field: 'name',
104
- value: name,
105
- });
106
- }
107
- }
108
- /**
109
- * Validates a queue type.
110
- *
111
- * @param type - The queue type to validate
112
- * @throws {QueueValidationError} If the type is not 'worker' or 'pubsub'
113
- */
114
- export function validateQueueType(type) {
115
- if (type !== 'worker' && type !== 'pubsub') {
116
- throw new QueueValidationError({
117
- message: "Queue type must be 'worker' or 'pubsub'",
118
- field: 'queue_type',
119
- value: type,
120
- });
121
- }
122
- }
123
- /**
124
- * Validates a message payload.
125
- *
126
- * Payloads must be non-empty JSON and not exceed 1MB when serialized.
127
- *
128
- * @param payload - The payload to validate (must be JSON-serializable)
129
- * @throws {QueueValidationError} If the payload is empty or too large
130
- */
131
- export function validatePayload(payload) {
132
- if (payload === undefined || payload === null) {
133
- throw new QueueValidationError({
134
- message: 'Payload cannot be empty',
135
- field: 'payload',
136
- });
137
- }
138
- const serialized = JSON.stringify(payload);
139
- const payloadBytes = new TextEncoder().encode(serialized).length;
140
- if (payloadBytes > MAX_PAYLOAD_SIZE) {
141
- throw new QueueValidationError({
142
- message: `Payload size exceeds ${MAX_PAYLOAD_SIZE} byte limit (${payloadBytes} bytes)`,
143
- field: 'payload',
144
- value: payloadBytes,
145
- });
146
- }
147
- }
148
- /**
149
- * Validates a message ID format.
150
- *
151
- * Message IDs must start with the `qmsg_` prefix.
152
- *
153
- * @param id - The message ID to validate
154
- * @throws {QueueValidationError} If the ID format is invalid
155
- */
156
- export function validateMessageId(id) {
157
- if (!id || !VALID_MESSAGE_ID_REGEX.test(id)) {
158
- throw new QueueValidationError({
159
- message: 'Invalid message ID format (must start with qmsg_ prefix)',
160
- field: 'message_id',
161
- value: id,
162
- });
163
- }
164
- }
165
- /**
166
- * Validates a destination ID format.
167
- *
168
- * Destination IDs must start with the `qdest_` prefix.
169
- *
170
- * @param id - The destination ID to validate
171
- * @throws {QueueValidationError} If the ID format is invalid
172
- */
173
- export function validateDestinationId(id) {
174
- if (!id || !VALID_DESTINATION_ID_REGEX.test(id)) {
175
- throw new QueueValidationError({
176
- message: 'Invalid destination ID format (must start with qdest_ prefix)',
177
- field: 'destination_id',
178
- value: id,
179
- });
180
- }
181
- }
182
- /**
183
- * Validates a queue or message description.
184
- *
185
- * @param description - The description to validate (optional)
186
- * @throws {QueueValidationError} If the description exceeds the maximum length
187
- */
188
- export function validateDescription(description) {
189
- if (description && description.length > MAX_DESCRIPTION_LENGTH) {
190
- throw new QueueValidationError({
191
- message: `Description must not exceed ${MAX_DESCRIPTION_LENGTH} characters`,
192
- field: 'description',
193
- value: description.length,
194
- });
195
- }
196
- }
197
- /**
198
- * Validates a partition key length.
199
- *
200
- * Partition keys are used for message ordering within a queue.
201
- *
202
- * @param key - The partition key to validate (optional)
203
- * @throws {QueueValidationError} If the key exceeds the maximum length
204
- */
205
- export function validatePartitionKey(key) {
206
- if (key && key.length > MAX_PARTITION_KEY_LENGTH) {
207
- throw new QueueValidationError({
208
- message: `Partition key must not exceed ${MAX_PARTITION_KEY_LENGTH} characters`,
209
- field: 'partition_key',
210
- value: key.length,
211
- });
212
- }
213
- }
214
- /**
215
- * Validates an idempotency key length.
216
- *
217
- * Idempotency keys are used to prevent duplicate message processing.
218
- *
219
- * @param key - The idempotency key to validate (optional)
220
- * @throws {QueueValidationError} If the key exceeds the maximum length
221
- */
222
- export function validateIdempotencyKey(key) {
223
- if (key && key.length > MAX_IDEMPOTENCY_KEY_LENGTH) {
224
- throw new QueueValidationError({
225
- message: `Idempotency key must not exceed ${MAX_IDEMPOTENCY_KEY_LENGTH} characters`,
226
- field: 'idempotency_key',
227
- value: key.length,
228
- });
229
- }
230
- }
231
- /**
232
- * Validates a time-to-live value.
233
- *
234
- * TTL specifies how long a message should be kept before expiring.
235
- *
236
- * @param ttl - The TTL in seconds to validate (optional)
237
- * @throws {QueueValidationError} If the TTL is negative
238
- */
239
- export function validateTTL(ttl) {
240
- if (ttl !== undefined && ttl < 0) {
241
- throw new QueueValidationError({
242
- message: 'TTL cannot be negative',
243
- field: 'ttl',
244
- value: ttl,
245
- });
246
- }
247
- }
248
- /**
249
- * Validates a visibility timeout.
250
- *
251
- * Visibility timeout is how long a message is hidden after being received,
252
- * giving the consumer time to process it before it becomes visible again.
253
- *
254
- * @param timeout - The timeout in seconds to validate (optional)
255
- * @throws {QueueValidationError} If the timeout is out of valid range (1-43200 seconds)
256
- */
257
- export function validateVisibilityTimeout(timeout) {
258
- if (timeout !== undefined) {
259
- if (timeout < 1) {
260
- throw new QueueValidationError({
261
- message: 'Visibility timeout must be at least 1 second',
262
- field: 'visibility_timeout',
263
- value: timeout,
264
- });
265
- }
266
- if (timeout > MAX_VISIBILITY_TIMEOUT) {
267
- throw new QueueValidationError({
268
- message: `Visibility timeout must not exceed ${MAX_VISIBILITY_TIMEOUT} seconds (12 hours)`,
269
- field: 'visibility_timeout',
270
- value: timeout,
271
- });
272
- }
273
- }
274
- }
275
- /**
276
- * Validates the maximum retry count.
277
- *
278
- * @param retries - The max retries value to validate (optional)
279
- * @throws {QueueValidationError} If retries is negative or exceeds maximum
280
- */
281
- export function validateMaxRetries(retries) {
282
- if (retries !== undefined) {
283
- if (retries < 0) {
284
- throw new QueueValidationError({
285
- message: 'Max retries cannot be negative',
286
- field: 'max_retries',
287
- value: retries,
288
- });
289
- }
290
- if (retries > MAX_RETRIES) {
291
- throw new QueueValidationError({
292
- message: `Max retries must not exceed ${MAX_RETRIES}`,
293
- field: 'max_retries',
294
- value: retries,
295
- });
296
- }
297
- }
298
- }
299
- /**
300
- * Validates the maximum in-flight messages per client.
301
- *
302
- * This controls how many messages a single consumer can process concurrently.
303
- *
304
- * @param maxInFlight - The max in-flight value to validate (optional)
305
- * @throws {QueueValidationError} If the value is out of valid range (1-1000)
306
- */
307
- export function validateMaxInFlight(maxInFlight) {
308
- if (maxInFlight !== undefined) {
309
- if (maxInFlight < 1) {
310
- throw new QueueValidationError({
311
- message: 'Max in-flight per client must be at least 1',
312
- field: 'max_in_flight',
313
- value: maxInFlight,
314
- });
315
- }
316
- if (maxInFlight > MAX_IN_FLIGHT) {
317
- throw new QueueValidationError({
318
- message: `Max in-flight per client must not exceed ${MAX_IN_FLIGHT}`,
319
- field: 'max_in_flight',
320
- value: maxInFlight,
321
- });
322
- }
323
- }
324
- }
325
- /**
326
- * Validates a message offset.
327
- *
328
- * Offsets are sequential positions in the queue, starting from 0.
329
- *
330
- * @param offset - The offset value to validate
331
- * @throws {QueueValidationError} If the offset is negative
332
- */
333
- export function validateOffset(offset) {
334
- if (offset < 0) {
335
- throw new QueueValidationError({
336
- message: 'Offset cannot be negative',
337
- field: 'offset',
338
- value: offset,
339
- });
340
- }
341
- }
342
- /**
343
- * Validates a limit for list/consume operations.
344
- *
345
- * @param limit - The limit value to validate
346
- * @throws {QueueValidationError} If the limit is less than 1 or exceeds maximum
347
- */
348
- export function validateLimit(limit) {
349
- if (limit < 1) {
350
- throw new QueueValidationError({
351
- message: 'Limit must be at least 1',
352
- field: 'limit',
353
- value: limit,
354
- });
355
- }
356
- if (limit > MAX_BATCH_SIZE) {
357
- throw new QueueValidationError({
358
- message: `Limit must not exceed ${MAX_BATCH_SIZE}`,
359
- field: 'limit',
360
- value: limit,
361
- });
362
- }
363
- }
364
- /**
365
- * Validates a batch size for batch operations.
366
- *
367
- * @param size - The batch size to validate
368
- * @throws {QueueValidationError} If the size is less than 1 or exceeds maximum
369
- */
370
- export function validateBatchSize(size) {
371
- if (size <= 0) {
372
- throw new QueueValidationError({
373
- message: 'Batch size must be greater than 0',
374
- field: 'batch_size',
375
- value: size,
376
- });
377
- }
378
- if (size > MAX_BATCH_SIZE) {
379
- throw new QueueValidationError({
380
- message: `Batch size must not exceed ${MAX_BATCH_SIZE}`,
381
- field: 'batch_size',
382
- value: size,
383
- });
384
- }
385
- }
386
- /**
387
- * Validates a webhook URL for destinations.
388
- *
389
- * URLs must use HTTP or HTTPS protocol.
390
- *
391
- * @param url - The URL to validate
392
- * @throws {QueueValidationError} If the URL is missing or not HTTP/HTTPS
393
- */
394
- export function validateWebhookUrl(url) {
395
- if (!url) {
396
- throw new QueueValidationError({
397
- message: 'Webhook URL is required',
398
- field: 'url',
399
- });
400
- }
401
- if (!url.startsWith('http://') && !url.startsWith('https://')) {
402
- throw new QueueValidationError({
403
- message: 'Webhook URL must be a valid HTTP or HTTPS URL',
404
- field: 'url',
405
- value: url,
406
- });
407
- }
408
- }
409
- /**
410
- * Validates a destination configuration object.
411
- *
412
- * Checks that the config contains a valid URL and optional method/timeout settings.
413
- *
414
- * @param config - The destination config object to validate
415
- * @throws {QueueValidationError} If the config is invalid
416
- */
417
- export function validateDestinationConfig(config) {
418
- if (!config) {
419
- throw new QueueValidationError({
420
- message: 'Destination config is required',
421
- field: 'config',
422
- });
423
- }
424
- const url = config.url;
425
- if (typeof url !== 'string' || !url) {
426
- throw new QueueValidationError({
427
- message: 'config.url is required',
428
- field: 'config.url',
429
- });
430
- }
431
- validateWebhookUrl(url);
432
- const method = config.method;
433
- if (method !== undefined) {
434
- if (method !== 'POST' && method !== 'PUT' && method !== 'PATCH') {
435
- throw new QueueValidationError({
436
- message: 'config.method must be POST, PUT, or PATCH',
437
- field: 'config.method',
438
- value: method,
439
- });
440
- }
441
- }
442
- const timeoutMs = config.timeout_ms;
443
- if (timeoutMs !== undefined) {
444
- if (typeof timeoutMs !== 'number' || timeoutMs < 1000 || timeoutMs > 300000) {
445
- throw new QueueValidationError({
446
- message: 'config.timeout_ms must be between 1000 and 300000',
447
- field: 'config.timeout_ms',
448
- value: timeoutMs,
449
- });
450
- }
451
- }
452
- }
453
- /**
454
- * Validates a source ID format.
455
- *
456
- * Source IDs must start with the `qsrc_` prefix.
457
- *
458
- * @param id - The source ID to validate
459
- * @throws {QueueValidationError} If the ID format is invalid
460
- *
461
- * @example
462
- * ```typescript
463
- * validateSourceId('qsrc_abc123'); // OK
464
- * validateSourceId('invalid'); // Throws
465
- * ```
466
- */
467
- export function validateSourceId(id) {
468
- if (!id || typeof id !== 'string') {
469
- throw new QueueValidationError({
470
- field: 'source_id',
471
- value: id,
472
- message: 'Source ID is required',
473
- });
474
- }
475
- if (!VALID_SOURCE_ID_REGEX.test(id)) {
476
- throw new QueueValidationError({
477
- field: 'source_id',
478
- value: id,
479
- message: 'Source ID must start with "qsrc_" prefix and contain only alphanumeric characters',
480
- });
481
- }
482
- }
483
- /**
484
- * Validates a source name.
485
- *
486
- * Source names must be non-empty and not exceed the maximum length.
487
- *
488
- * @param name - The source name to validate
489
- * @throws {QueueValidationError} If the name is invalid
490
- *
491
- * @example
492
- * ```typescript
493
- * validateSourceName('my-source'); // OK
494
- * validateSourceName(''); // Throws
495
- * ```
496
- */
497
- export function validateSourceName(name) {
498
- if (!name || typeof name !== 'string') {
499
- throw new QueueValidationError({
500
- field: 'source_name',
501
- value: name,
502
- message: 'Source name is required',
503
- });
504
- }
505
- if (name.length > MAX_SOURCE_NAME_LENGTH) {
506
- throw new QueueValidationError({
507
- field: 'source_name',
508
- value: name,
509
- message: `Source name must be at most ${MAX_SOURCE_NAME_LENGTH} characters`,
510
- });
511
- }
512
- }
513
- //# sourceMappingURL=validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/api/queue/validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,8CAA8C;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC,gDAAgD;AAChD,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEvC,kDAAkD;AAClD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C,oDAAoD;AACpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,wDAAwD;AACxD,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE5C,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC,iHAAiH;AACjH,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAErD,wDAAwD;AACxD,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAErD,6DAA6D;AAC7D,MAAM,0BAA0B,GAAG,sBAAsB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ACX,OAAO,EAAE,yBAAyB;SAClC,CAAC,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,sBAAsB,EAAE,CAAC;QAC1C,MAAM,IAAI,oBAAoB,CAAC;YAC9B,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,+BAA+B,sBAAsB,aAAa;SAC3E,CAAC,CAAC;IACJ,CAAC;AACF,CAAC"}
@@ -1,168 +0,0 @@
1
- /**
2
- * @module websocket
3
- *
4
- * WebSocket client for real-time queue message subscriptions.
5
- *
6
- * Provides both a callback-based API ({@link createQueueWebSocket}) and an
7
- * async iterator API ({@link subscribeToQueue}) for receiving messages from
8
- * a queue in real time via WebSocket.
9
- *
10
- * @example Callback-based API
11
- * ```typescript
12
- * import { createQueueWebSocket } from '@agentuity/server';
13
- *
14
- * const connection = createQueueWebSocket({
15
- * queueName: 'order-processing',
16
- * baseUrl: 'https://catalyst.agentuity.cloud',
17
- * onMessage: (message) => {
18
- * console.log('Received:', message.id, message.payload);
19
- * },
20
- * onOpen: () => console.log('Connected'),
21
- * onClose: (code, reason) => console.log('Closed:', code, reason),
22
- * onError: (error) => console.error('Error:', error),
23
- * });
24
- *
25
- * // Later: close the connection
26
- * connection.close();
27
- * ```
28
- *
29
- * @example Resuming from a previous session
30
- * ```typescript
31
- * import { createQueueWebSocket } from '@agentuity/server';
32
- *
33
- * // Use a previously obtained clientId and lastOffset to resume
34
- * const connection = createQueueWebSocket({
35
- * queueName: 'order-processing',
36
- * baseUrl: 'https://catalyst.agentuity.cloud',
37
- * clientId: previousClientId,
38
- * lastOffset: previousOffset,
39
- * onMessage: (message) => {
40
- * console.log('Received:', message.id, message.payload);
41
- * },
42
- * });
43
- * ```
44
- *
45
- * @example Async iterator API
46
- * ```typescript
47
- * import { subscribeToQueue } from '@agentuity/server';
48
- *
49
- * const controller = new AbortController();
50
- * for await (const message of subscribeToQueue({
51
- * queueName: 'order-processing',
52
- * baseUrl: 'https://catalyst.agentuity.cloud',
53
- * signal: controller.signal,
54
- * })) {
55
- * console.log('Received:', message.id, message.payload);
56
- * }
57
- * ```
58
- */
59
- import type { Message } from './types.ts';
60
- /** Connection state for a queue WebSocket connection. */
61
- export type QueueWebSocketState = 'connecting' | 'authenticating' | 'connected' | 'reconnecting' | 'closed';
62
- /** Options for creating a queue WebSocket subscription. */
63
- export interface QueueWebSocketOptions {
64
- /** Queue name to subscribe to. */
65
- queueName: string;
66
- /** API key for authentication (if not provided, uses AGENTUITY_SDK_KEY env var). */
67
- apiKey?: string;
68
- /** Base URL of the catalyst service (e.g., https://catalyst.agentuity.cloud). */
69
- baseUrl: string;
70
- /** Called when a message is received. */
71
- onMessage: (message: Message) => void;
72
- /** Called when the connection is established and authenticated. */
73
- onOpen?: () => void;
74
- /** Called when the connection is closed. */
75
- onClose?: (code: number, reason: string) => void;
76
- /** Called when an error occurs. */
77
- onError?: (error: Error) => void;
78
- /** Whether to automatically reconnect on disconnection (default: true). */
79
- autoReconnect?: boolean;
80
- /** Maximum number of reconnection attempts (default: Infinity). */
81
- maxReconnectAttempts?: number;
82
- /** Initial reconnection delay in ms (default: 1000). Uses exponential backoff. */
83
- reconnectDelayMs?: number;
84
- /** Maximum reconnection delay in ms (default: 30000). */
85
- maxReconnectDelayMs?: number;
86
- /** Optional client ID from a previous session to resume a subscription. */
87
- clientId?: string;
88
- /** Optional last processed offset from a previous session to resume from. */
89
- lastOffset?: number;
90
- }
91
- /** Return type from {@link createQueueWebSocket}. */
92
- export interface QueueWebSocketConnection {
93
- /** Close the WebSocket connection. Disables auto-reconnect. */
94
- close(): void;
95
- /** The current connection state. */
96
- readonly state: QueueWebSocketState;
97
- /** The client/subscription ID assigned by the server. Stable across reconnections. */
98
- readonly clientId: string | undefined;
99
- /** The offset of the last message processed. */
100
- readonly lastOffset: number | undefined;
101
- }
102
- /** Options for the async iterator queue subscription. */
103
- export interface SubscribeToQueueOptions {
104
- /** Queue name to subscribe to. */
105
- queueName: string;
106
- /** API key for authentication (if not provided, uses AGENTUITY_SDK_KEY env var). */
107
- apiKey?: string;
108
- /** Base URL of the catalyst service. */
109
- baseUrl: string;
110
- /** AbortSignal to stop the subscription. */
111
- signal?: AbortSignal;
112
- /** Optional client ID from a previous session to resume a subscription. */
113
- clientId?: string;
114
- /** Optional last processed offset from a previous session to resume from. */
115
- lastOffset?: number;
116
- }
117
- /**
118
- * Create a WebSocket connection to receive real-time messages from a queue.
119
- *
120
- * The connection handles authentication, automatic reconnection with exponential
121
- * backoff, and ping/pong keep-alive (handled automatically by the WebSocket
122
- * implementation).
123
- *
124
- * @param options - Configuration for the WebSocket connection
125
- * @returns A {@link QueueWebSocketConnection} handle for managing the connection
126
- * @throws {QueueError} If no API key is available
127
- * @throws {QueueValidationError} If the queue name is invalid
128
- *
129
- * @example
130
- * ```typescript
131
- * const connection = createQueueWebSocket({
132
- * queueName: 'order-processing',
133
- * baseUrl: 'https://catalyst.agentuity.cloud',
134
- * onMessage: (message) => {
135
- * console.log('Received:', message.id, message.payload);
136
- * },
137
- * });
138
- *
139
- * // Later: close the connection
140
- * connection.close();
141
- * ```
142
- */
143
- export declare function createQueueWebSocket(options: QueueWebSocketOptions): QueueWebSocketConnection;
144
- /**
145
- * Subscribe to real-time messages from a queue via WebSocket.
146
- *
147
- * Returns an async iterator that yields messages as they arrive.
148
- * The connection is automatically managed (auth, reconnection, cleanup).
149
- *
150
- * @param options - Configuration for the subscription
151
- * @returns An async generator that yields {@link Message} objects
152
- * @throws {QueueError} If no API key is available
153
- * @throws {QueueValidationError} If the queue name is invalid
154
- *
155
- * @example
156
- * ```typescript
157
- * const controller = new AbortController();
158
- * for await (const message of subscribeToQueue({
159
- * queueName: 'order-processing',
160
- * baseUrl: 'https://catalyst.agentuity.cloud',
161
- * signal: controller.signal,
162
- * })) {
163
- * console.log('Received:', message.id, message.payload);
164
- * }
165
- * ```
166
- */
167
- export declare function subscribeToQueue(options: SubscribeToQueueOptions): AsyncGenerator<Message, void, unknown>;
168
- //# sourceMappingURL=websocket.d.ts.map