@agentuity/core 1.0.33 → 1.0.35

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 (1127) hide show
  1. package/dist/index.d.ts +2 -17
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -15
  4. package/dist/index.js.map +1 -1
  5. package/dist/services/adapter.d.ts +57 -22
  6. package/dist/services/adapter.d.ts.map +1 -1
  7. package/dist/services/adapter.js +52 -1
  8. package/dist/services/adapter.js.map +1 -1
  9. package/dist/services/api.d.ts +222 -0
  10. package/dist/services/api.d.ts.map +1 -0
  11. package/dist/services/api.js +662 -0
  12. package/dist/services/api.js.map +1 -0
  13. package/dist/services/apikey/create.d.ts +34 -0
  14. package/dist/services/apikey/create.d.ts.map +1 -0
  15. package/dist/services/apikey/create.js +29 -0
  16. package/dist/services/apikey/create.js.map +1 -0
  17. package/dist/services/apikey/delete.d.ts.map +1 -0
  18. package/dist/services/apikey/delete.js.map +1 -0
  19. package/dist/services/apikey/get.d.ts.map +1 -0
  20. package/dist/services/apikey/get.js.map +1 -0
  21. package/dist/services/apikey/index.d.ts.map +1 -0
  22. package/dist/services/apikey/index.js.map +1 -0
  23. package/dist/services/apikey/list.d.ts +65 -0
  24. package/dist/services/apikey/list.d.ts.map +1 -0
  25. package/dist/services/apikey/list.js +50 -0
  26. package/dist/services/apikey/list.js.map +1 -0
  27. package/dist/services/apikey/util.d.ts.map +1 -0
  28. package/dist/services/apikey/util.js.map +1 -0
  29. package/dist/services/config.d.ts +22 -0
  30. package/dist/services/config.d.ts.map +1 -0
  31. package/dist/services/config.js +55 -0
  32. package/dist/services/config.js.map +1 -0
  33. package/dist/services/db/index.d.ts +6 -0
  34. package/dist/services/db/index.d.ts.map +1 -0
  35. package/dist/services/db/index.js +6 -0
  36. package/dist/services/db/index.js.map +1 -0
  37. package/dist/services/db/logs.d.ts.map +1 -0
  38. package/dist/services/db/logs.js.map +1 -0
  39. package/dist/services/db/query.d.ts +40 -0
  40. package/dist/services/db/query.d.ts.map +1 -0
  41. package/dist/services/db/query.js +55 -0
  42. package/dist/services/db/query.js.map +1 -0
  43. package/dist/services/db/stats.d.ts +146 -0
  44. package/dist/services/db/stats.d.ts.map +1 -0
  45. package/dist/services/db/stats.js +94 -0
  46. package/dist/services/db/stats.js.map +1 -0
  47. package/dist/services/db/tables.d.ts +50 -0
  48. package/dist/services/db/tables.d.ts.map +1 -0
  49. package/dist/services/db/tables.js +64 -0
  50. package/dist/services/db/tables.js.map +1 -0
  51. package/dist/services/db/util.d.ts.map +1 -0
  52. package/dist/services/db/util.js.map +1 -0
  53. package/dist/services/email/index.d.ts +2 -0
  54. package/dist/services/email/index.d.ts.map +1 -0
  55. package/dist/services/email/index.js +2 -0
  56. package/dist/services/email/index.js.map +1 -0
  57. package/dist/services/email/service.d.ts +742 -0
  58. package/dist/services/email/service.d.ts.map +1 -0
  59. package/dist/services/email/service.js +1107 -0
  60. package/dist/services/email/service.js.map +1 -0
  61. package/dist/services/env.d.ts.map +1 -0
  62. package/dist/services/env.js.map +1 -0
  63. package/dist/services/eval/events.d.ts +93 -0
  64. package/dist/services/eval/events.d.ts.map +1 -0
  65. package/dist/services/eval/events.js +24 -0
  66. package/dist/services/eval/events.js.map +1 -0
  67. package/dist/services/eval/get.d.ts.map +1 -0
  68. package/dist/services/eval/get.js.map +1 -0
  69. package/dist/services/eval/index.d.ts +6 -0
  70. package/dist/services/eval/index.d.ts.map +1 -0
  71. package/dist/services/eval/index.js +6 -0
  72. package/dist/services/eval/index.js.map +1 -0
  73. package/dist/services/eval/list.d.ts.map +1 -0
  74. package/dist/services/eval/list.js.map +1 -0
  75. package/dist/services/eval/run-get.d.ts.map +1 -0
  76. package/dist/services/eval/run-get.js.map +1 -0
  77. package/dist/services/eval/run-list.d.ts.map +1 -0
  78. package/dist/services/eval/run-list.js.map +1 -0
  79. package/dist/services/exception.d.ts +28 -9
  80. package/dist/services/exception.d.ts.map +1 -1
  81. package/dist/services/exception.js +14 -0
  82. package/dist/services/exception.js.map +1 -1
  83. package/dist/services/index.d.ts +26 -12
  84. package/dist/services/index.d.ts.map +1 -1
  85. package/dist/services/index.js +26 -11
  86. package/dist/services/index.js.map +1 -1
  87. package/dist/services/keyvalue/index.d.ts +2 -0
  88. package/dist/services/keyvalue/index.d.ts.map +1 -0
  89. package/dist/services/keyvalue/index.js +2 -0
  90. package/dist/services/keyvalue/index.js.map +1 -0
  91. package/dist/services/keyvalue/service.d.ts +261 -0
  92. package/dist/services/keyvalue/service.d.ts.map +1 -0
  93. package/dist/services/keyvalue/service.js +475 -0
  94. package/dist/services/keyvalue/service.js.map +1 -0
  95. package/dist/services/logger.d.ts.map +1 -0
  96. package/dist/services/logger.js.map +1 -0
  97. package/dist/services/machine/index.d.ts.map +1 -0
  98. package/dist/services/machine/index.js.map +1 -0
  99. package/dist/services/machine/machine.d.ts.map +1 -0
  100. package/dist/services/machine/machine.js +177 -0
  101. package/dist/services/machine/machine.js.map +1 -0
  102. package/dist/services/machine/util.d.ts.map +1 -0
  103. package/dist/services/machine/util.js.map +1 -0
  104. package/dist/services/org/env-delete.d.ts.map +1 -0
  105. package/dist/services/org/env-delete.js.map +1 -0
  106. package/dist/services/org/env-get.d.ts +33 -0
  107. package/dist/services/org/env-get.d.ts.map +1 -0
  108. package/dist/services/org/env-get.js +33 -0
  109. package/dist/services/org/env-get.js.map +1 -0
  110. package/dist/services/org/env-update.d.ts.map +1 -0
  111. package/dist/services/org/env-update.js.map +1 -0
  112. package/dist/services/org/index.d.ts.map +1 -0
  113. package/dist/services/org/index.js.map +1 -0
  114. package/dist/services/org/list.d.ts.map +1 -0
  115. package/dist/services/org/list.js.map +1 -0
  116. package/dist/services/org/resources.d.ts +150 -0
  117. package/dist/services/org/resources.d.ts.map +1 -0
  118. package/dist/services/org/resources.js +111 -0
  119. package/dist/services/org/resources.js.map +1 -0
  120. package/dist/services/org/util.d.ts.map +1 -0
  121. package/dist/services/org/util.js.map +1 -0
  122. package/dist/services/pagination.d.ts +38 -11
  123. package/dist/services/pagination.d.ts.map +1 -1
  124. package/dist/services/pagination.js +30 -1
  125. package/dist/services/pagination.js.map +1 -1
  126. package/dist/services/project/agent.d.ts.map +1 -0
  127. package/dist/services/project/agent.js.map +1 -0
  128. package/dist/services/project/create.d.ts.map +1 -0
  129. package/dist/services/project/create.js.map +1 -0
  130. package/dist/services/project/delete.d.ts.map +1 -0
  131. package/dist/services/project/delete.js +15 -0
  132. package/dist/services/project/delete.js.map +1 -0
  133. package/dist/services/project/deploy.d.ts +468 -0
  134. package/dist/services/project/deploy.d.ts.map +1 -0
  135. package/dist/services/project/deploy.js.map +1 -0
  136. package/dist/services/project/deployment.d.ts.map +1 -0
  137. package/dist/services/project/deployment.js +180 -0
  138. package/dist/services/project/deployment.js.map +1 -0
  139. package/dist/services/project/env-delete.d.ts.map +1 -0
  140. package/dist/services/project/env-delete.js.map +1 -0
  141. package/dist/services/project/env-update.d.ts.map +1 -0
  142. package/dist/services/project/env-update.js.map +1 -0
  143. package/dist/services/project/exists.d.ts.map +1 -0
  144. package/dist/services/project/exists.js.map +1 -0
  145. package/dist/services/project/get.d.ts.map +1 -0
  146. package/dist/services/project/get.js.map +1 -0
  147. package/dist/services/project/hostname.d.ts.map +1 -0
  148. package/dist/services/project/hostname.js +43 -0
  149. package/dist/services/project/hostname.js.map +1 -0
  150. package/dist/services/project/index.d.ts.map +1 -0
  151. package/dist/services/project/index.js.map +1 -0
  152. package/dist/services/project/list.d.ts.map +1 -0
  153. package/dist/services/project/list.js.map +1 -0
  154. package/dist/services/project/malware.d.ts.map +1 -0
  155. package/dist/services/project/malware.js +57 -0
  156. package/dist/services/project/malware.js.map +1 -0
  157. package/dist/services/project/update-region.d.ts.map +1 -0
  158. package/dist/services/project/update-region.js.map +1 -0
  159. package/dist/services/project/util.d.ts.map +1 -0
  160. package/dist/services/project/util.js.map +1 -0
  161. package/dist/services/queue/analytics.d.ts +261 -0
  162. package/dist/services/queue/analytics.d.ts.map +1 -0
  163. package/dist/services/queue/analytics.js +254 -0
  164. package/dist/services/queue/analytics.js.map +1 -0
  165. package/dist/services/queue/consumers.d.ts +48 -0
  166. package/dist/services/queue/consumers.d.ts.map +1 -0
  167. package/dist/services/queue/consumers.js +43 -0
  168. package/dist/services/queue/consumers.js.map +1 -0
  169. package/dist/services/queue/destinations.d.ts +269 -0
  170. package/dist/services/queue/destinations.d.ts.map +1 -0
  171. package/dist/services/queue/destinations.js +215 -0
  172. package/dist/services/queue/destinations.js.map +1 -0
  173. package/dist/services/queue/dlq.d.ts +170 -0
  174. package/dist/services/queue/dlq.d.ts.map +1 -0
  175. package/dist/services/queue/dlq.js.map +1 -0
  176. package/dist/services/queue/index.d.ts +58 -0
  177. package/dist/services/queue/index.d.ts.map +1 -0
  178. package/dist/services/queue/index.js +98 -0
  179. package/dist/services/queue/index.js.map +1 -0
  180. package/dist/services/queue/messages.d.ts +511 -0
  181. package/dist/services/queue/messages.d.ts.map +1 -0
  182. package/dist/services/queue/messages.js.map +1 -0
  183. package/dist/services/queue/queues.d.ts +228 -0
  184. package/dist/services/queue/queues.d.ts.map +1 -0
  185. package/dist/services/queue/queues.js.map +1 -0
  186. package/dist/services/queue/service.d.ts +309 -0
  187. package/dist/services/queue/service.d.ts.map +1 -0
  188. package/dist/services/queue/service.js +456 -0
  189. package/dist/services/queue/service.js.map +1 -0
  190. package/dist/services/queue/sources.d.ts +252 -0
  191. package/dist/services/queue/sources.d.ts.map +1 -0
  192. package/dist/services/queue/sources.js +249 -0
  193. package/dist/services/queue/sources.js.map +1 -0
  194. package/dist/services/queue/types.d.ts +1335 -0
  195. package/dist/services/queue/types.d.ts.map +1 -0
  196. package/dist/services/queue/types.js +1382 -0
  197. package/dist/services/queue/types.js.map +1 -0
  198. package/dist/services/queue/util.d.ts +278 -0
  199. package/dist/services/queue/util.d.ts.map +1 -0
  200. package/dist/services/queue/util.js +233 -0
  201. package/dist/services/queue/util.js.map +1 -0
  202. package/dist/services/queue/validation.d.ts +218 -0
  203. package/dist/services/queue/validation.d.ts.map +1 -0
  204. package/dist/services/queue/validation.js +498 -0
  205. package/dist/services/queue/validation.js.map +1 -0
  206. package/dist/services/queue/websocket.d.ts +154 -0
  207. package/dist/services/queue/websocket.d.ts.map +1 -0
  208. package/dist/services/queue/websocket.js +491 -0
  209. package/dist/services/queue/websocket.js.map +1 -0
  210. package/dist/services/region/create.d.ts.map +1 -0
  211. package/dist/services/region/create.js.map +1 -0
  212. package/dist/services/region/delete.d.ts.map +1 -0
  213. package/dist/services/region/delete.js.map +1 -0
  214. package/dist/services/region/index.d.ts.map +1 -0
  215. package/dist/services/region/index.js.map +1 -0
  216. package/dist/services/region/list.d.ts.map +1 -0
  217. package/dist/services/region/list.js.map +1 -0
  218. package/dist/services/region/resources.d.ts.map +1 -0
  219. package/dist/services/region/resources.js.map +1 -0
  220. package/dist/services/region/util.d.ts.map +1 -0
  221. package/dist/services/region/util.js.map +1 -0
  222. package/dist/services/sandbox/cli-list.d.ts +103 -0
  223. package/dist/services/sandbox/cli-list.d.ts.map +1 -0
  224. package/dist/services/sandbox/cli-list.js +106 -0
  225. package/dist/services/sandbox/cli-list.js.map +1 -0
  226. package/dist/services/sandbox/client.d.ts +173 -0
  227. package/dist/services/sandbox/client.d.ts.map +1 -0
  228. package/dist/services/sandbox/client.js +302 -0
  229. package/dist/services/sandbox/client.js.map +1 -0
  230. package/dist/services/sandbox/create.d.ts +193 -0
  231. package/dist/services/sandbox/create.d.ts.map +1 -0
  232. package/dist/services/sandbox/create.js +215 -0
  233. package/dist/services/sandbox/create.js.map +1 -0
  234. package/dist/services/sandbox/destroy.d.ts +23 -0
  235. package/dist/services/sandbox/destroy.d.ts.map +1 -0
  236. package/dist/services/sandbox/destroy.js +30 -0
  237. package/dist/services/sandbox/destroy.js.map +1 -0
  238. package/dist/services/sandbox/disk-checkpoint.d.ts +108 -0
  239. package/dist/services/sandbox/disk-checkpoint.d.ts.map +1 -0
  240. package/dist/services/sandbox/disk-checkpoint.js +124 -0
  241. package/dist/services/sandbox/disk-checkpoint.js.map +1 -0
  242. package/dist/services/sandbox/execute.d.ts +96 -0
  243. package/dist/services/sandbox/execute.d.ts.map +1 -0
  244. package/dist/services/sandbox/execute.js +109 -0
  245. package/dist/services/sandbox/execute.js.map +1 -0
  246. package/dist/services/sandbox/execution.d.ts +145 -0
  247. package/dist/services/sandbox/execution.d.ts.map +1 -0
  248. package/dist/services/sandbox/execution.js +113 -0
  249. package/dist/services/sandbox/execution.js.map +1 -0
  250. package/dist/services/sandbox/files.d.ts +269 -0
  251. package/dist/services/sandbox/files.d.ts.map +1 -0
  252. package/dist/services/sandbox/files.js +454 -0
  253. package/dist/services/sandbox/files.js.map +1 -0
  254. package/dist/services/sandbox/get.d.ts +284 -0
  255. package/dist/services/sandbox/get.d.ts.map +1 -0
  256. package/dist/services/sandbox/get.js +231 -0
  257. package/dist/services/sandbox/get.js.map +1 -0
  258. package/dist/services/sandbox/getStatus.d.ts +20 -0
  259. package/dist/services/sandbox/getStatus.d.ts.map +1 -0
  260. package/dist/services/sandbox/getStatus.js +36 -0
  261. package/dist/services/sandbox/getStatus.js.map +1 -0
  262. package/dist/services/sandbox/index.d.ts +40 -0
  263. package/dist/services/sandbox/index.d.ts.map +1 -0
  264. package/dist/services/sandbox/index.js +21 -0
  265. package/dist/services/sandbox/index.js.map +1 -0
  266. package/dist/services/sandbox/list.d.ts +327 -0
  267. package/dist/services/sandbox/list.d.ts.map +1 -0
  268. package/dist/services/sandbox/list.js +204 -0
  269. package/dist/services/sandbox/list.js.map +1 -0
  270. package/dist/services/sandbox/pause.d.ts +23 -0
  271. package/dist/services/sandbox/pause.d.ts.map +1 -0
  272. package/dist/services/sandbox/pause.js +30 -0
  273. package/dist/services/sandbox/pause.js.map +1 -0
  274. package/dist/services/sandbox/resolve.d.ts +75 -0
  275. package/dist/services/sandbox/resolve.d.ts.map +1 -0
  276. package/dist/services/sandbox/resolve.js +76 -0
  277. package/dist/services/sandbox/resolve.js.map +1 -0
  278. package/dist/services/sandbox/resume.d.ts +23 -0
  279. package/dist/services/sandbox/resume.d.ts.map +1 -0
  280. package/dist/services/sandbox/resume.js +30 -0
  281. package/dist/services/sandbox/resume.js.map +1 -0
  282. package/dist/services/sandbox/run.d.ts +71 -0
  283. package/dist/services/sandbox/run.d.ts.map +1 -0
  284. package/dist/services/sandbox/run.js +355 -0
  285. package/dist/services/sandbox/run.js.map +1 -0
  286. package/dist/services/sandbox/runtime.d.ts +94 -0
  287. package/dist/services/sandbox/runtime.d.ts.map +1 -0
  288. package/dist/services/sandbox/runtime.js +82 -0
  289. package/dist/services/sandbox/runtime.js.map +1 -0
  290. package/dist/services/sandbox/snapshot-build.d.ts.map +1 -0
  291. package/dist/services/sandbox/snapshot-build.js.map +1 -0
  292. package/dist/services/sandbox/snapshot.d.ts +596 -0
  293. package/dist/services/sandbox/snapshot.d.ts.map +1 -0
  294. package/dist/services/sandbox/snapshot.js +612 -0
  295. package/dist/services/sandbox/snapshot.js.map +1 -0
  296. package/dist/services/sandbox/types.d.ts +851 -0
  297. package/dist/services/sandbox/types.d.ts.map +1 -0
  298. package/dist/services/sandbox/types.js +674 -0
  299. package/dist/services/sandbox/types.js.map +1 -0
  300. package/dist/services/sandbox/util.d.ts +295 -0
  301. package/dist/services/sandbox/util.d.ts.map +1 -0
  302. package/dist/services/sandbox/util.js +233 -0
  303. package/dist/services/sandbox/util.js.map +1 -0
  304. package/dist/services/schedule/index.d.ts +2 -0
  305. package/dist/services/schedule/index.d.ts.map +1 -0
  306. package/dist/services/schedule/index.js +2 -0
  307. package/dist/services/schedule/index.js.map +1 -0
  308. package/dist/services/schedule/service.d.ts +439 -0
  309. package/dist/services/schedule/service.d.ts.map +1 -0
  310. package/dist/services/schedule/service.js +701 -0
  311. package/dist/services/schedule/service.js.map +1 -0
  312. package/dist/services/session/events.d.ts +127 -0
  313. package/dist/services/session/events.d.ts.map +1 -0
  314. package/dist/services/session/events.js +42 -0
  315. package/dist/services/session/events.js.map +1 -0
  316. package/dist/services/session/get.d.ts +170 -0
  317. package/dist/services/session/get.d.ts.map +1 -0
  318. package/dist/services/session/get.js.map +1 -0
  319. package/dist/services/session/index.d.ts +5 -0
  320. package/dist/services/session/index.d.ts.map +1 -0
  321. package/dist/services/session/index.js +5 -0
  322. package/dist/services/session/index.js.map +1 -0
  323. package/dist/services/session/list.d.ts +150 -0
  324. package/dist/services/session/list.d.ts.map +1 -0
  325. package/dist/services/session/list.js +117 -0
  326. package/dist/services/session/list.js.map +1 -0
  327. package/dist/services/session/logs.d.ts.map +1 -0
  328. package/dist/services/session/logs.js.map +1 -0
  329. package/dist/services/session/util.d.ts.map +1 -0
  330. package/dist/services/session/util.js.map +1 -0
  331. package/dist/services/stats.d.ts +261 -0
  332. package/dist/services/stats.d.ts.map +1 -0
  333. package/dist/services/stats.js +181 -0
  334. package/dist/services/stats.js.map +1 -0
  335. package/dist/services/storage/config.d.ts.map +1 -0
  336. package/dist/services/storage/config.js.map +1 -0
  337. package/dist/services/storage/index.d.ts.map +1 -0
  338. package/dist/services/storage/index.js.map +1 -0
  339. package/dist/services/storage/objects.d.ts +158 -0
  340. package/dist/services/storage/objects.d.ts.map +1 -0
  341. package/dist/services/storage/objects.js +161 -0
  342. package/dist/services/storage/objects.js.map +1 -0
  343. package/dist/services/storage/types.d.ts.map +1 -0
  344. package/dist/services/storage/types.js.map +1 -0
  345. package/dist/services/storage/util.d.ts.map +1 -0
  346. package/dist/services/storage/util.js.map +1 -0
  347. package/dist/services/stream/get.d.ts.map +1 -0
  348. package/dist/services/stream/get.js.map +1 -0
  349. package/dist/services/stream/index.d.ts +5 -0
  350. package/dist/services/stream/index.d.ts.map +1 -0
  351. package/dist/services/stream/index.js +5 -0
  352. package/dist/services/stream/index.js.map +1 -0
  353. package/dist/services/stream/list.d.ts +96 -0
  354. package/dist/services/stream/list.d.ts.map +1 -0
  355. package/dist/services/stream/list.js +92 -0
  356. package/dist/services/stream/list.js.map +1 -0
  357. package/dist/services/stream/service.d.ts +264 -0
  358. package/dist/services/stream/service.d.ts.map +1 -0
  359. package/dist/services/stream/service.js +631 -0
  360. package/dist/services/stream/service.js.map +1 -0
  361. package/dist/services/stream/util.d.ts.map +1 -0
  362. package/dist/services/stream/util.js.map +1 -0
  363. package/dist/services/task/index.d.ts +2 -0
  364. package/dist/services/task/index.d.ts.map +1 -0
  365. package/dist/services/task/index.js +2 -0
  366. package/dist/services/task/index.js.map +1 -0
  367. package/dist/services/task/service.d.ts +1491 -0
  368. package/dist/services/task/service.d.ts.map +1 -0
  369. package/dist/services/task/service.js +1887 -0
  370. package/dist/services/task/service.js.map +1 -0
  371. package/dist/services/thread/delete.d.ts.map +1 -0
  372. package/dist/services/thread/delete.js.map +1 -0
  373. package/dist/services/thread/get.d.ts.map +1 -0
  374. package/dist/services/thread/get.js.map +1 -0
  375. package/dist/services/thread/index.d.ts.map +1 -0
  376. package/dist/services/thread/index.js.map +1 -0
  377. package/dist/services/thread/list.d.ts +75 -0
  378. package/dist/services/thread/list.d.ts.map +1 -0
  379. package/dist/services/thread/list.js +65 -0
  380. package/dist/services/thread/list.js.map +1 -0
  381. package/dist/services/thread/util.d.ts.map +1 -0
  382. package/dist/services/thread/util.js.map +1 -0
  383. package/dist/services/user/index.d.ts.map +1 -0
  384. package/dist/services/user/index.js.map +1 -0
  385. package/dist/services/user/util.d.ts.map +1 -0
  386. package/dist/services/user/util.js.map +1 -0
  387. package/dist/services/user/whoami.d.ts.map +1 -0
  388. package/dist/services/user/whoami.js.map +1 -0
  389. package/dist/services/vector/index.d.ts +2 -0
  390. package/dist/services/vector/index.d.ts.map +1 -0
  391. package/dist/services/vector/index.js +2 -0
  392. package/dist/services/vector/index.js.map +1 -0
  393. package/dist/services/vector/service.d.ts +459 -0
  394. package/dist/services/vector/service.d.ts.map +1 -0
  395. package/dist/services/vector/service.js +707 -0
  396. package/dist/services/vector/service.js.map +1 -0
  397. package/dist/services/webhook/analytics.d.ts +77 -0
  398. package/dist/services/webhook/analytics.d.ts.map +1 -0
  399. package/dist/services/webhook/analytics.js +56 -0
  400. package/dist/services/webhook/analytics.js.map +1 -0
  401. package/dist/services/webhook/deliveries.d.ts +94 -0
  402. package/dist/services/webhook/deliveries.d.ts.map +1 -0
  403. package/dist/services/webhook/deliveries.js.map +1 -0
  404. package/dist/services/webhook/destinations.d.ts +140 -0
  405. package/dist/services/webhook/destinations.d.ts.map +1 -0
  406. package/dist/services/webhook/destinations.js.map +1 -0
  407. package/dist/services/webhook/index.d.ts +43 -0
  408. package/dist/services/webhook/index.d.ts.map +1 -0
  409. package/dist/services/webhook/index.js +64 -0
  410. package/dist/services/webhook/index.js.map +1 -0
  411. package/dist/services/webhook/receipts.d.ts.map +1 -0
  412. package/dist/services/webhook/receipts.js.map +1 -0
  413. package/dist/services/webhook/service.d.ts +374 -0
  414. package/dist/services/webhook/service.d.ts.map +1 -0
  415. package/dist/services/webhook/service.js +663 -0
  416. package/dist/services/webhook/service.js.map +1 -0
  417. package/dist/services/webhook/types.d.ts +182 -0
  418. package/dist/services/webhook/types.d.ts.map +1 -0
  419. package/dist/services/webhook/types.js +188 -0
  420. package/dist/services/webhook/types.js.map +1 -0
  421. package/dist/services/webhook/util.d.ts.map +1 -0
  422. package/dist/services/webhook/util.js.map +1 -0
  423. package/dist/services/webhook/webhooks.d.ts +150 -0
  424. package/dist/services/webhook/webhooks.d.ts.map +1 -0
  425. package/dist/services/webhook/webhooks.js.map +1 -0
  426. package/package.json +59 -7
  427. package/src/index.ts +6 -247
  428. package/src/services/adapter.ts +69 -24
  429. package/src/services/api.ts +951 -0
  430. package/src/services/apikey/create.ts +48 -0
  431. package/src/services/apikey/list.ts +66 -0
  432. package/src/services/config.ts +65 -0
  433. package/src/services/db/index.ts +42 -0
  434. package/src/services/db/query.ts +69 -0
  435. package/src/services/db/stats.ts +121 -0
  436. package/src/services/db/tables.ts +94 -0
  437. package/src/services/email/index.ts +1 -0
  438. package/src/services/email/service.ts +1476 -0
  439. package/src/services/eval/index.ts +29 -0
  440. package/src/services/exception.ts +16 -7
  441. package/src/services/index.ts +29 -28
  442. package/src/services/keyvalue/index.ts +1 -0
  443. package/src/services/keyvalue/service.ts +677 -0
  444. package/src/services/machine/machine.ts +228 -0
  445. package/src/services/org/env-get.ts +48 -0
  446. package/src/services/org/resources.ts +140 -0
  447. package/src/services/pagination.ts +40 -11
  448. package/src/services/project/delete.ts +27 -0
  449. package/src/services/project/deploy.ts +433 -0
  450. package/src/services/project/deployment.ts +250 -0
  451. package/src/services/project/hostname.ts +79 -0
  452. package/src/services/project/malware.ts +85 -0
  453. package/src/services/queue/analytics.ts +343 -0
  454. package/src/services/queue/consumers.ts +56 -0
  455. package/src/services/queue/destinations.ts +329 -0
  456. package/src/services/queue/index.ts +339 -0
  457. package/src/services/queue/service.ts +634 -0
  458. package/src/services/queue/sources.ts +364 -0
  459. package/src/services/queue/types.ts +1666 -0
  460. package/src/services/queue/util.ts +275 -0
  461. package/src/services/queue/validation.ts +541 -0
  462. package/src/services/queue/websocket.ts +578 -0
  463. package/src/services/sandbox/cli-list.ts +117 -0
  464. package/src/services/sandbox/client.ts +435 -0
  465. package/src/services/sandbox/create.ts +249 -0
  466. package/src/services/sandbox/destroy.ts +43 -0
  467. package/src/services/sandbox/disk-checkpoint.ts +184 -0
  468. package/src/services/sandbox/execute.ts +134 -0
  469. package/src/services/sandbox/execution.ts +144 -0
  470. package/src/services/sandbox/files.ts +608 -0
  471. package/src/services/sandbox/get.ts +262 -0
  472. package/src/services/sandbox/getStatus.ts +51 -0
  473. package/src/services/sandbox/index.ts +230 -0
  474. package/src/services/sandbox/list.ts +234 -0
  475. package/src/services/sandbox/pause.ts +41 -0
  476. package/src/services/sandbox/resolve.ts +96 -0
  477. package/src/services/sandbox/resume.ts +41 -0
  478. package/src/services/sandbox/run.ts +441 -0
  479. package/src/services/sandbox/runtime.ts +106 -0
  480. package/src/services/sandbox/snapshot.ts +791 -0
  481. package/src/services/sandbox/types.ts +798 -0
  482. package/src/services/sandbox/util.ts +279 -0
  483. package/src/services/schedule/index.ts +1 -0
  484. package/src/services/schedule/service.ts +814 -0
  485. package/src/services/session/get.ts +108 -0
  486. package/src/services/session/index.ts +4 -0
  487. package/src/services/session/list.ts +143 -0
  488. package/src/services/stats.ts +232 -0
  489. package/src/services/storage/objects.ts +256 -0
  490. package/src/services/stream/index.ts +14 -0
  491. package/src/services/stream/list.ts +105 -0
  492. package/src/services/stream/service.ts +929 -0
  493. package/src/services/task/index.ts +1 -0
  494. package/src/services/task/service.ts +2573 -0
  495. package/src/services/thread/list.ts +81 -0
  496. package/src/services/vector/index.ts +1 -0
  497. package/src/services/vector/service.ts +1242 -0
  498. package/src/services/webhook/analytics.ts +80 -0
  499. package/src/services/webhook/index.ts +160 -0
  500. package/src/services/webhook/service.ts +900 -0
  501. package/src/services/webhook/types.ts +277 -0
  502. package/dist/api/api.d.ts +0 -226
  503. package/dist/api/api.d.ts.map +0 -1
  504. package/dist/api/api.js +0 -635
  505. package/dist/api/api.js.map +0 -1
  506. package/dist/api/apikey/create.d.ts +0 -33
  507. package/dist/api/apikey/create.d.ts.map +0 -1
  508. package/dist/api/apikey/create.js +0 -23
  509. package/dist/api/apikey/create.js.map +0 -1
  510. package/dist/api/apikey/delete.d.ts.map +0 -1
  511. package/dist/api/apikey/delete.js.map +0 -1
  512. package/dist/api/apikey/get.d.ts.map +0 -1
  513. package/dist/api/apikey/get.js.map +0 -1
  514. package/dist/api/apikey/index.d.ts.map +0 -1
  515. package/dist/api/apikey/index.js.map +0 -1
  516. package/dist/api/apikey/list.d.ts +0 -64
  517. package/dist/api/apikey/list.d.ts.map +0 -1
  518. package/dist/api/apikey/list.js +0 -46
  519. package/dist/api/apikey/list.js.map +0 -1
  520. package/dist/api/apikey/util.d.ts.map +0 -1
  521. package/dist/api/apikey/util.js.map +0 -1
  522. package/dist/api/config.d.ts +0 -20
  523. package/dist/api/config.d.ts.map +0 -1
  524. package/dist/api/config.js +0 -43
  525. package/dist/api/config.js.map +0 -1
  526. package/dist/api/db/index.d.ts +0 -5
  527. package/dist/api/db/index.d.ts.map +0 -1
  528. package/dist/api/db/index.js +0 -5
  529. package/dist/api/db/index.js.map +0 -1
  530. package/dist/api/db/logs.d.ts.map +0 -1
  531. package/dist/api/db/logs.js.map +0 -1
  532. package/dist/api/db/query.d.ts +0 -39
  533. package/dist/api/db/query.d.ts.map +0 -1
  534. package/dist/api/db/query.js +0 -49
  535. package/dist/api/db/query.js.map +0 -1
  536. package/dist/api/db/tables.d.ts +0 -49
  537. package/dist/api/db/tables.d.ts.map +0 -1
  538. package/dist/api/db/tables.js +0 -59
  539. package/dist/api/db/tables.js.map +0 -1
  540. package/dist/api/db/util.d.ts.map +0 -1
  541. package/dist/api/db/util.js.map +0 -1
  542. package/dist/api/env.d.ts.map +0 -1
  543. package/dist/api/env.js.map +0 -1
  544. package/dist/api/eval/get.d.ts.map +0 -1
  545. package/dist/api/eval/get.js.map +0 -1
  546. package/dist/api/eval/index.d.ts +0 -5
  547. package/dist/api/eval/index.d.ts.map +0 -1
  548. package/dist/api/eval/index.js +0 -5
  549. package/dist/api/eval/index.js.map +0 -1
  550. package/dist/api/eval/list.d.ts.map +0 -1
  551. package/dist/api/eval/list.js.map +0 -1
  552. package/dist/api/eval/run-get.d.ts.map +0 -1
  553. package/dist/api/eval/run-get.js.map +0 -1
  554. package/dist/api/eval/run-list.d.ts.map +0 -1
  555. package/dist/api/eval/run-list.js.map +0 -1
  556. package/dist/api/index.d.ts +0 -21
  557. package/dist/api/index.d.ts.map +0 -1
  558. package/dist/api/index.js +0 -21
  559. package/dist/api/index.js.map +0 -1
  560. package/dist/api/logger.d.ts.map +0 -1
  561. package/dist/api/logger.js.map +0 -1
  562. package/dist/api/machine/index.d.ts.map +0 -1
  563. package/dist/api/machine/index.js.map +0 -1
  564. package/dist/api/machine/machine.d.ts.map +0 -1
  565. package/dist/api/machine/machine.js +0 -109
  566. package/dist/api/machine/machine.js.map +0 -1
  567. package/dist/api/machine/util.d.ts.map +0 -1
  568. package/dist/api/machine/util.js.map +0 -1
  569. package/dist/api/org/env-delete.d.ts.map +0 -1
  570. package/dist/api/org/env-delete.js.map +0 -1
  571. package/dist/api/org/env-get.d.ts +0 -33
  572. package/dist/api/org/env-get.d.ts.map +0 -1
  573. package/dist/api/org/env-get.js +0 -26
  574. package/dist/api/org/env-get.js.map +0 -1
  575. package/dist/api/org/env-update.d.ts.map +0 -1
  576. package/dist/api/org/env-update.js.map +0 -1
  577. package/dist/api/org/index.d.ts.map +0 -1
  578. package/dist/api/org/index.js.map +0 -1
  579. package/dist/api/org/list.d.ts.map +0 -1
  580. package/dist/api/org/list.js.map +0 -1
  581. package/dist/api/org/resources.d.ts +0 -141
  582. package/dist/api/org/resources.d.ts.map +0 -1
  583. package/dist/api/org/resources.js +0 -97
  584. package/dist/api/org/resources.js.map +0 -1
  585. package/dist/api/org/util.d.ts.map +0 -1
  586. package/dist/api/org/util.js.map +0 -1
  587. package/dist/api/project/agent.d.ts.map +0 -1
  588. package/dist/api/project/agent.js.map +0 -1
  589. package/dist/api/project/create.d.ts.map +0 -1
  590. package/dist/api/project/create.js.map +0 -1
  591. package/dist/api/project/delete.d.ts.map +0 -1
  592. package/dist/api/project/delete.js +0 -13
  593. package/dist/api/project/delete.js.map +0 -1
  594. package/dist/api/project/deploy.d.ts +0 -490
  595. package/dist/api/project/deploy.d.ts.map +0 -1
  596. package/dist/api/project/deploy.js.map +0 -1
  597. package/dist/api/project/deployment.d.ts.map +0 -1
  598. package/dist/api/project/deployment.js +0 -127
  599. package/dist/api/project/deployment.js.map +0 -1
  600. package/dist/api/project/env-delete.d.ts.map +0 -1
  601. package/dist/api/project/env-delete.js.map +0 -1
  602. package/dist/api/project/env-update.d.ts.map +0 -1
  603. package/dist/api/project/env-update.js.map +0 -1
  604. package/dist/api/project/exists.d.ts.map +0 -1
  605. package/dist/api/project/exists.js.map +0 -1
  606. package/dist/api/project/get.d.ts.map +0 -1
  607. package/dist/api/project/get.js.map +0 -1
  608. package/dist/api/project/hostname.d.ts.map +0 -1
  609. package/dist/api/project/hostname.js +0 -37
  610. package/dist/api/project/hostname.js.map +0 -1
  611. package/dist/api/project/index.d.ts.map +0 -1
  612. package/dist/api/project/index.js.map +0 -1
  613. package/dist/api/project/list.d.ts.map +0 -1
  614. package/dist/api/project/list.js.map +0 -1
  615. package/dist/api/project/malware.d.ts.map +0 -1
  616. package/dist/api/project/malware.js +0 -42
  617. package/dist/api/project/malware.js.map +0 -1
  618. package/dist/api/project/update-region.d.ts.map +0 -1
  619. package/dist/api/project/update-region.js.map +0 -1
  620. package/dist/api/project/util.d.ts.map +0 -1
  621. package/dist/api/project/util.js.map +0 -1
  622. package/dist/api/queue/analytics.d.ts +0 -250
  623. package/dist/api/queue/analytics.d.ts.map +0 -1
  624. package/dist/api/queue/analytics.js +0 -233
  625. package/dist/api/queue/analytics.js.map +0 -1
  626. package/dist/api/queue/destinations.d.ts +0 -202
  627. package/dist/api/queue/destinations.d.ts.map +0 -1
  628. package/dist/api/queue/destinations.js +0 -168
  629. package/dist/api/queue/destinations.js.map +0 -1
  630. package/dist/api/queue/dlq.d.ts +0 -168
  631. package/dist/api/queue/dlq.d.ts.map +0 -1
  632. package/dist/api/queue/dlq.js.map +0 -1
  633. package/dist/api/queue/index.d.ts +0 -56
  634. package/dist/api/queue/index.d.ts.map +0 -1
  635. package/dist/api/queue/index.js +0 -90
  636. package/dist/api/queue/index.js.map +0 -1
  637. package/dist/api/queue/messages.d.ts +0 -503
  638. package/dist/api/queue/messages.d.ts.map +0 -1
  639. package/dist/api/queue/messages.js.map +0 -1
  640. package/dist/api/queue/queues.d.ts +0 -226
  641. package/dist/api/queue/queues.d.ts.map +0 -1
  642. package/dist/api/queue/queues.js.map +0 -1
  643. package/dist/api/queue/sources.d.ts +0 -202
  644. package/dist/api/queue/sources.d.ts.map +0 -1
  645. package/dist/api/queue/sources.js +0 -202
  646. package/dist/api/queue/sources.js.map +0 -1
  647. package/dist/api/queue/types.d.ts +0 -1218
  648. package/dist/api/queue/types.d.ts.map +0 -1
  649. package/dist/api/queue/types.js +0 -1002
  650. package/dist/api/queue/types.js.map +0 -1
  651. package/dist/api/queue/util.d.ts +0 -278
  652. package/dist/api/queue/util.d.ts.map +0 -1
  653. package/dist/api/queue/util.js +0 -233
  654. package/dist/api/queue/util.js.map +0 -1
  655. package/dist/api/queue/validation.d.ts +0 -247
  656. package/dist/api/queue/validation.d.ts.map +0 -1
  657. package/dist/api/queue/validation.js +0 -513
  658. package/dist/api/queue/validation.js.map +0 -1
  659. package/dist/api/queue/websocket.d.ts +0 -172
  660. package/dist/api/queue/websocket.d.ts.map +0 -1
  661. package/dist/api/queue/websocket.js +0 -396
  662. package/dist/api/queue/websocket.js.map +0 -1
  663. package/dist/api/region/create.d.ts.map +0 -1
  664. package/dist/api/region/create.js.map +0 -1
  665. package/dist/api/region/delete.d.ts.map +0 -1
  666. package/dist/api/region/delete.js.map +0 -1
  667. package/dist/api/region/index.d.ts.map +0 -1
  668. package/dist/api/region/index.js.map +0 -1
  669. package/dist/api/region/list.d.ts.map +0 -1
  670. package/dist/api/region/list.js.map +0 -1
  671. package/dist/api/region/resources.d.ts.map +0 -1
  672. package/dist/api/region/resources.js.map +0 -1
  673. package/dist/api/region/util.d.ts.map +0 -1
  674. package/dist/api/region/util.js.map +0 -1
  675. package/dist/api/sandbox/cli-list.d.ts +0 -114
  676. package/dist/api/sandbox/cli-list.d.ts.map +0 -1
  677. package/dist/api/sandbox/cli-list.js +0 -71
  678. package/dist/api/sandbox/cli-list.js.map +0 -1
  679. package/dist/api/sandbox/client.d.ts +0 -192
  680. package/dist/api/sandbox/client.d.ts.map +0 -1
  681. package/dist/api/sandbox/client.js +0 -262
  682. package/dist/api/sandbox/client.js.map +0 -1
  683. package/dist/api/sandbox/create.d.ts +0 -118
  684. package/dist/api/sandbox/create.d.ts.map +0 -1
  685. package/dist/api/sandbox/create.js +0 -211
  686. package/dist/api/sandbox/create.js.map +0 -1
  687. package/dist/api/sandbox/destroy.d.ts +0 -22
  688. package/dist/api/sandbox/destroy.d.ts.map +0 -1
  689. package/dist/api/sandbox/destroy.js +0 -25
  690. package/dist/api/sandbox/destroy.js.map +0 -1
  691. package/dist/api/sandbox/disk-checkpoint.d.ts +0 -104
  692. package/dist/api/sandbox/disk-checkpoint.d.ts.map +0 -1
  693. package/dist/api/sandbox/disk-checkpoint.js +0 -104
  694. package/dist/api/sandbox/disk-checkpoint.js.map +0 -1
  695. package/dist/api/sandbox/execute.d.ts +0 -69
  696. package/dist/api/sandbox/execute.d.ts.map +0 -1
  697. package/dist/api/sandbox/execute.js +0 -103
  698. package/dist/api/sandbox/execute.js.map +0 -1
  699. package/dist/api/sandbox/execution.d.ts +0 -169
  700. package/dist/api/sandbox/execution.d.ts.map +0 -1
  701. package/dist/api/sandbox/execution.js +0 -118
  702. package/dist/api/sandbox/execution.js.map +0 -1
  703. package/dist/api/sandbox/files.d.ts +0 -261
  704. package/dist/api/sandbox/files.d.ts.map +0 -1
  705. package/dist/api/sandbox/files.js +0 -386
  706. package/dist/api/sandbox/files.js.map +0 -1
  707. package/dist/api/sandbox/get.d.ts +0 -283
  708. package/dist/api/sandbox/get.d.ts.map +0 -1
  709. package/dist/api/sandbox/get.js +0 -215
  710. package/dist/api/sandbox/get.js.map +0 -1
  711. package/dist/api/sandbox/getStatus.d.ts +0 -16
  712. package/dist/api/sandbox/getStatus.d.ts.map +0 -1
  713. package/dist/api/sandbox/getStatus.js +0 -32
  714. package/dist/api/sandbox/getStatus.js.map +0 -1
  715. package/dist/api/sandbox/index.d.ts +0 -39
  716. package/dist/api/sandbox/index.d.ts.map +0 -1
  717. package/dist/api/sandbox/index.js +0 -20
  718. package/dist/api/sandbox/index.js.map +0 -1
  719. package/dist/api/sandbox/list.d.ts +0 -293
  720. package/dist/api/sandbox/list.d.ts.map +0 -1
  721. package/dist/api/sandbox/list.js +0 -191
  722. package/dist/api/sandbox/list.js.map +0 -1
  723. package/dist/api/sandbox/pause.d.ts +0 -22
  724. package/dist/api/sandbox/pause.d.ts.map +0 -1
  725. package/dist/api/sandbox/pause.js +0 -25
  726. package/dist/api/sandbox/pause.js.map +0 -1
  727. package/dist/api/sandbox/resolve.d.ts +0 -82
  728. package/dist/api/sandbox/resolve.d.ts.map +0 -1
  729. package/dist/api/sandbox/resolve.js +0 -71
  730. package/dist/api/sandbox/resolve.js.map +0 -1
  731. package/dist/api/sandbox/resume.d.ts +0 -22
  732. package/dist/api/sandbox/resume.d.ts.map +0 -1
  733. package/dist/api/sandbox/resume.js +0 -25
  734. package/dist/api/sandbox/resume.js.map +0 -1
  735. package/dist/api/sandbox/run.d.ts +0 -28
  736. package/dist/api/sandbox/run.d.ts.map +0 -1
  737. package/dist/api/sandbox/run.js +0 -342
  738. package/dist/api/sandbox/run.js.map +0 -1
  739. package/dist/api/sandbox/runtime.d.ts +0 -83
  740. package/dist/api/sandbox/runtime.d.ts.map +0 -1
  741. package/dist/api/sandbox/runtime.js +0 -78
  742. package/dist/api/sandbox/runtime.js.map +0 -1
  743. package/dist/api/sandbox/snapshot-build.d.ts.map +0 -1
  744. package/dist/api/sandbox/snapshot-build.js.map +0 -1
  745. package/dist/api/sandbox/snapshot.d.ts +0 -595
  746. package/dist/api/sandbox/snapshot.d.ts.map +0 -1
  747. package/dist/api/sandbox/snapshot.js +0 -598
  748. package/dist/api/sandbox/snapshot.js.map +0 -1
  749. package/dist/api/sandbox/util.d.ts +0 -284
  750. package/dist/api/sandbox/util.d.ts.map +0 -1
  751. package/dist/api/sandbox/util.js +0 -210
  752. package/dist/api/sandbox/util.js.map +0 -1
  753. package/dist/api/services/index.d.ts +0 -2
  754. package/dist/api/services/index.d.ts.map +0 -1
  755. package/dist/api/services/index.js +0 -2
  756. package/dist/api/services/index.js.map +0 -1
  757. package/dist/api/services/stats.d.ts +0 -263
  758. package/dist/api/services/stats.d.ts.map +0 -1
  759. package/dist/api/services/stats.js +0 -144
  760. package/dist/api/services/stats.js.map +0 -1
  761. package/dist/api/session/get.d.ts +0 -169
  762. package/dist/api/session/get.d.ts.map +0 -1
  763. package/dist/api/session/get.js.map +0 -1
  764. package/dist/api/session/index.d.ts +0 -4
  765. package/dist/api/session/index.d.ts.map +0 -1
  766. package/dist/api/session/index.js +0 -4
  767. package/dist/api/session/index.js.map +0 -1
  768. package/dist/api/session/list.d.ts +0 -143
  769. package/dist/api/session/list.d.ts.map +0 -1
  770. package/dist/api/session/list.js +0 -91
  771. package/dist/api/session/list.js.map +0 -1
  772. package/dist/api/session/logs.d.ts.map +0 -1
  773. package/dist/api/session/logs.js.map +0 -1
  774. package/dist/api/session/util.d.ts.map +0 -1
  775. package/dist/api/session/util.js.map +0 -1
  776. package/dist/api/storage/config.d.ts.map +0 -1
  777. package/dist/api/storage/config.js.map +0 -1
  778. package/dist/api/storage/index.d.ts.map +0 -1
  779. package/dist/api/storage/index.js.map +0 -1
  780. package/dist/api/storage/objects.d.ts +0 -155
  781. package/dist/api/storage/objects.d.ts.map +0 -1
  782. package/dist/api/storage/objects.js +0 -148
  783. package/dist/api/storage/objects.js.map +0 -1
  784. package/dist/api/storage/types.d.ts.map +0 -1
  785. package/dist/api/storage/types.js.map +0 -1
  786. package/dist/api/storage/util.d.ts.map +0 -1
  787. package/dist/api/storage/util.js.map +0 -1
  788. package/dist/api/stream/get.d.ts.map +0 -1
  789. package/dist/api/stream/get.js.map +0 -1
  790. package/dist/api/stream/index.d.ts +0 -4
  791. package/dist/api/stream/index.d.ts.map +0 -1
  792. package/dist/api/stream/index.js +0 -4
  793. package/dist/api/stream/index.js.map +0 -1
  794. package/dist/api/stream/list.d.ts +0 -120
  795. package/dist/api/stream/list.d.ts.map +0 -1
  796. package/dist/api/stream/list.js +0 -77
  797. package/dist/api/stream/list.js.map +0 -1
  798. package/dist/api/stream/util.d.ts.map +0 -1
  799. package/dist/api/stream/util.js.map +0 -1
  800. package/dist/api/thread/delete.d.ts.map +0 -1
  801. package/dist/api/thread/delete.js.map +0 -1
  802. package/dist/api/thread/get.d.ts.map +0 -1
  803. package/dist/api/thread/get.js.map +0 -1
  804. package/dist/api/thread/index.d.ts.map +0 -1
  805. package/dist/api/thread/index.js.map +0 -1
  806. package/dist/api/thread/list.d.ts +0 -69
  807. package/dist/api/thread/list.d.ts.map +0 -1
  808. package/dist/api/thread/list.js +0 -51
  809. package/dist/api/thread/list.js.map +0 -1
  810. package/dist/api/thread/util.d.ts.map +0 -1
  811. package/dist/api/thread/util.js.map +0 -1
  812. package/dist/api/user/index.d.ts.map +0 -1
  813. package/dist/api/user/index.js.map +0 -1
  814. package/dist/api/user/util.d.ts.map +0 -1
  815. package/dist/api/user/util.js.map +0 -1
  816. package/dist/api/user/whoami.d.ts.map +0 -1
  817. package/dist/api/user/whoami.js.map +0 -1
  818. package/dist/api/webhook/deliveries.d.ts +0 -94
  819. package/dist/api/webhook/deliveries.d.ts.map +0 -1
  820. package/dist/api/webhook/deliveries.js.map +0 -1
  821. package/dist/api/webhook/destinations.d.ts +0 -136
  822. package/dist/api/webhook/destinations.d.ts.map +0 -1
  823. package/dist/api/webhook/destinations.js.map +0 -1
  824. package/dist/api/webhook/index.d.ts +0 -41
  825. package/dist/api/webhook/index.d.ts.map +0 -1
  826. package/dist/api/webhook/index.js +0 -59
  827. package/dist/api/webhook/index.js.map +0 -1
  828. package/dist/api/webhook/receipts.d.ts.map +0 -1
  829. package/dist/api/webhook/receipts.js.map +0 -1
  830. package/dist/api/webhook/types.d.ts +0 -249
  831. package/dist/api/webhook/types.d.ts.map +0 -1
  832. package/dist/api/webhook/types.js +0 -221
  833. package/dist/api/webhook/types.js.map +0 -1
  834. package/dist/api/webhook/util.d.ts.map +0 -1
  835. package/dist/api/webhook/util.js.map +0 -1
  836. package/dist/api/webhook/webhooks.d.ts +0 -146
  837. package/dist/api/webhook/webhooks.d.ts.map +0 -1
  838. package/dist/api/webhook/webhooks.js.map +0 -1
  839. package/dist/services/email.d.ts +0 -901
  840. package/dist/services/email.d.ts.map +0 -1
  841. package/dist/services/email.js +0 -722
  842. package/dist/services/email.js.map +0 -1
  843. package/dist/services/evalrun.d.ts +0 -93
  844. package/dist/services/evalrun.d.ts.map +0 -1
  845. package/dist/services/evalrun.js +0 -24
  846. package/dist/services/evalrun.js.map +0 -1
  847. package/dist/services/keyvalue.d.ts +0 -283
  848. package/dist/services/keyvalue.d.ts.map +0 -1
  849. package/dist/services/keyvalue.js +0 -305
  850. package/dist/services/keyvalue.js.map +0 -1
  851. package/dist/services/queue.d.ts +0 -361
  852. package/dist/services/queue.d.ts.map +0 -1
  853. package/dist/services/queue.js +0 -308
  854. package/dist/services/queue.js.map +0 -1
  855. package/dist/services/sandbox.d.ts +0 -1241
  856. package/dist/services/sandbox.d.ts.map +0 -1
  857. package/dist/services/sandbox.js +0 -6
  858. package/dist/services/sandbox.js.map +0 -1
  859. package/dist/services/schedule.d.ts +0 -501
  860. package/dist/services/schedule.d.ts.map +0 -1
  861. package/dist/services/schedule.js +0 -425
  862. package/dist/services/schedule.js.map +0 -1
  863. package/dist/services/session.d.ts +0 -127
  864. package/dist/services/session.d.ts.map +0 -1
  865. package/dist/services/session.js +0 -42
  866. package/dist/services/session.js.map +0 -1
  867. package/dist/services/stream.d.ts +0 -293
  868. package/dist/services/stream.d.ts.map +0 -1
  869. package/dist/services/stream.js +0 -500
  870. package/dist/services/stream.js.map +0 -1
  871. package/dist/services/task.d.ts +0 -1337
  872. package/dist/services/task.d.ts.map +0 -1
  873. package/dist/services/task.js +0 -1397
  874. package/dist/services/task.js.map +0 -1
  875. package/dist/services/vector.d.ts +0 -498
  876. package/dist/services/vector.d.ts.map +0 -1
  877. package/dist/services/vector.js +0 -381
  878. package/dist/services/vector.js.map +0 -1
  879. package/dist/services/webhook.d.ts +0 -454
  880. package/dist/services/webhook.d.ts.map +0 -1
  881. package/dist/services/webhook.js +0 -589
  882. package/dist/services/webhook.js.map +0 -1
  883. package/src/api/api.ts +0 -931
  884. package/src/api/apikey/create.ts +0 -41
  885. package/src/api/apikey/list.ts +0 -64
  886. package/src/api/config.ts +0 -60
  887. package/src/api/db/index.ts +0 -27
  888. package/src/api/db/query.ts +0 -67
  889. package/src/api/db/tables.ts +0 -92
  890. package/src/api/eval/index.ts +0 -28
  891. package/src/api/index.ts +0 -20
  892. package/src/api/machine/machine.ts +0 -160
  893. package/src/api/org/env-get.ts +0 -43
  894. package/src/api/org/resources.ts +0 -140
  895. package/src/api/project/delete.ts +0 -25
  896. package/src/api/project/deploy.ts +0 -458
  897. package/src/api/project/deployment.ts +0 -195
  898. package/src/api/project/hostname.ts +0 -73
  899. package/src/api/project/malware.ts +0 -68
  900. package/src/api/queue/analytics.ts +0 -311
  901. package/src/api/queue/destinations.ts +0 -259
  902. package/src/api/queue/index.ts +0 -308
  903. package/src/api/queue/sources.ts +0 -294
  904. package/src/api/queue/types.ts +0 -1325
  905. package/src/api/queue/util.ts +0 -275
  906. package/src/api/queue/validation.ts +0 -560
  907. package/src/api/queue/websocket.ts +0 -521
  908. package/src/api/sandbox/cli-list.ts +0 -127
  909. package/src/api/sandbox/client.ts +0 -460
  910. package/src/api/sandbox/create.ts +0 -256
  911. package/src/api/sandbox/destroy.ts +0 -41
  912. package/src/api/sandbox/disk-checkpoint.ts +0 -179
  913. package/src/api/sandbox/execute.ts +0 -132
  914. package/src/api/sandbox/execution.ts +0 -183
  915. package/src/api/sandbox/files.ts +0 -596
  916. package/src/api/sandbox/get.ts +0 -249
  917. package/src/api/sandbox/getStatus.ts +0 -54
  918. package/src/api/sandbox/index.ts +0 -211
  919. package/src/api/sandbox/list.ts +0 -224
  920. package/src/api/sandbox/pause.ts +0 -39
  921. package/src/api/sandbox/resolve.ts +0 -98
  922. package/src/api/sandbox/resume.ts +0 -39
  923. package/src/api/sandbox/run.ts +0 -439
  924. package/src/api/sandbox/runtime.ts +0 -104
  925. package/src/api/sandbox/snapshot.ts +0 -781
  926. package/src/api/sandbox/util.ts +0 -275
  927. package/src/api/services/index.ts +0 -1
  928. package/src/api/services/stats.ts +0 -213
  929. package/src/api/session/get.ts +0 -106
  930. package/src/api/session/index.ts +0 -3
  931. package/src/api/session/list.ts +0 -136
  932. package/src/api/storage/objects.ts +0 -250
  933. package/src/api/stream/index.ts +0 -3
  934. package/src/api/stream/list.ts +0 -127
  935. package/src/api/thread/list.ts +0 -76
  936. package/src/api/webhook/index.ts +0 -133
  937. package/src/api/webhook/types.ts +0 -309
  938. package/src/services/email.ts +0 -1410
  939. package/src/services/keyvalue.ts +0 -620
  940. package/src/services/queue.ts +0 -603
  941. package/src/services/sandbox.ts +0 -1466
  942. package/src/services/schedule.ts +0 -763
  943. package/src/services/stream.ts +0 -886
  944. package/src/services/task.ts +0 -2611
  945. package/src/services/vector.ts +0 -1119
  946. package/src/services/webhook.ts +0 -921
  947. /package/dist/{api → services}/apikey/delete.d.ts +0 -0
  948. /package/dist/{api → services}/apikey/delete.js +0 -0
  949. /package/dist/{api → services}/apikey/get.d.ts +0 -0
  950. /package/dist/{api → services}/apikey/get.js +0 -0
  951. /package/dist/{api → services}/apikey/index.d.ts +0 -0
  952. /package/dist/{api → services}/apikey/index.js +0 -0
  953. /package/dist/{api → services}/apikey/util.d.ts +0 -0
  954. /package/dist/{api → services}/apikey/util.js +0 -0
  955. /package/dist/{api → services}/db/logs.d.ts +0 -0
  956. /package/dist/{api → services}/db/logs.js +0 -0
  957. /package/dist/{api → services}/db/util.d.ts +0 -0
  958. /package/dist/{api → services}/db/util.js +0 -0
  959. /package/dist/{api → services}/env.d.ts +0 -0
  960. /package/dist/{api → services}/env.js +0 -0
  961. /package/dist/{api → services}/eval/get.d.ts +0 -0
  962. /package/dist/{api → services}/eval/get.js +0 -0
  963. /package/dist/{api → services}/eval/list.d.ts +0 -0
  964. /package/dist/{api → services}/eval/list.js +0 -0
  965. /package/dist/{api → services}/eval/run-get.d.ts +0 -0
  966. /package/dist/{api → services}/eval/run-get.js +0 -0
  967. /package/dist/{api → services}/eval/run-list.d.ts +0 -0
  968. /package/dist/{api → services}/eval/run-list.js +0 -0
  969. /package/dist/{api → services}/logger.d.ts +0 -0
  970. /package/dist/{api → services}/logger.js +0 -0
  971. /package/dist/{api → services}/machine/index.d.ts +0 -0
  972. /package/dist/{api → services}/machine/index.js +0 -0
  973. /package/dist/{api → services}/machine/machine.d.ts +0 -0
  974. /package/dist/{api → services}/machine/util.d.ts +0 -0
  975. /package/dist/{api → services}/machine/util.js +0 -0
  976. /package/dist/{api → services}/org/env-delete.d.ts +0 -0
  977. /package/dist/{api → services}/org/env-delete.js +0 -0
  978. /package/dist/{api → services}/org/env-update.d.ts +0 -0
  979. /package/dist/{api → services}/org/env-update.js +0 -0
  980. /package/dist/{api → services}/org/index.d.ts +0 -0
  981. /package/dist/{api → services}/org/index.js +0 -0
  982. /package/dist/{api → services}/org/list.d.ts +0 -0
  983. /package/dist/{api → services}/org/list.js +0 -0
  984. /package/dist/{api → services}/org/util.d.ts +0 -0
  985. /package/dist/{api → services}/org/util.js +0 -0
  986. /package/dist/{api → services}/project/agent.d.ts +0 -0
  987. /package/dist/{api → services}/project/agent.js +0 -0
  988. /package/dist/{api → services}/project/create.d.ts +0 -0
  989. /package/dist/{api → services}/project/create.js +0 -0
  990. /package/dist/{api → services}/project/delete.d.ts +0 -0
  991. /package/dist/{api → services}/project/deploy.js +0 -0
  992. /package/dist/{api → services}/project/deployment.d.ts +0 -0
  993. /package/dist/{api → services}/project/env-delete.d.ts +0 -0
  994. /package/dist/{api → services}/project/env-delete.js +0 -0
  995. /package/dist/{api → services}/project/env-update.d.ts +0 -0
  996. /package/dist/{api → services}/project/env-update.js +0 -0
  997. /package/dist/{api → services}/project/exists.d.ts +0 -0
  998. /package/dist/{api → services}/project/exists.js +0 -0
  999. /package/dist/{api → services}/project/get.d.ts +0 -0
  1000. /package/dist/{api → services}/project/get.js +0 -0
  1001. /package/dist/{api → services}/project/hostname.d.ts +0 -0
  1002. /package/dist/{api → services}/project/index.d.ts +0 -0
  1003. /package/dist/{api → services}/project/index.js +0 -0
  1004. /package/dist/{api → services}/project/list.d.ts +0 -0
  1005. /package/dist/{api → services}/project/list.js +0 -0
  1006. /package/dist/{api → services}/project/malware.d.ts +0 -0
  1007. /package/dist/{api → services}/project/update-region.d.ts +0 -0
  1008. /package/dist/{api → services}/project/update-region.js +0 -0
  1009. /package/dist/{api → services}/project/util.d.ts +0 -0
  1010. /package/dist/{api → services}/project/util.js +0 -0
  1011. /package/dist/{api → services}/queue/dlq.js +0 -0
  1012. /package/dist/{api → services}/queue/messages.js +0 -0
  1013. /package/dist/{api → services}/queue/queues.js +0 -0
  1014. /package/dist/{api → services}/region/create.d.ts +0 -0
  1015. /package/dist/{api → services}/region/create.js +0 -0
  1016. /package/dist/{api → services}/region/delete.d.ts +0 -0
  1017. /package/dist/{api → services}/region/delete.js +0 -0
  1018. /package/dist/{api → services}/region/index.d.ts +0 -0
  1019. /package/dist/{api → services}/region/index.js +0 -0
  1020. /package/dist/{api → services}/region/list.d.ts +0 -0
  1021. /package/dist/{api → services}/region/list.js +0 -0
  1022. /package/dist/{api → services}/region/resources.d.ts +0 -0
  1023. /package/dist/{api → services}/region/resources.js +0 -0
  1024. /package/dist/{api → services}/region/util.d.ts +0 -0
  1025. /package/dist/{api → services}/region/util.js +0 -0
  1026. /package/dist/{api → services}/sandbox/snapshot-build.d.ts +0 -0
  1027. /package/dist/{api → services}/sandbox/snapshot-build.js +0 -0
  1028. /package/dist/{api → services}/session/get.js +0 -0
  1029. /package/dist/{api → services}/session/logs.d.ts +0 -0
  1030. /package/dist/{api → services}/session/logs.js +0 -0
  1031. /package/dist/{api → services}/session/util.d.ts +0 -0
  1032. /package/dist/{api → services}/session/util.js +0 -0
  1033. /package/dist/{api → services}/storage/config.d.ts +0 -0
  1034. /package/dist/{api → services}/storage/config.js +0 -0
  1035. /package/dist/{api → services}/storage/index.d.ts +0 -0
  1036. /package/dist/{api → services}/storage/index.js +0 -0
  1037. /package/dist/{api → services}/storage/types.d.ts +0 -0
  1038. /package/dist/{api → services}/storage/types.js +0 -0
  1039. /package/dist/{api → services}/storage/util.d.ts +0 -0
  1040. /package/dist/{api → services}/storage/util.js +0 -0
  1041. /package/dist/{api → services}/stream/get.d.ts +0 -0
  1042. /package/dist/{api → services}/stream/get.js +0 -0
  1043. /package/dist/{api → services}/stream/util.d.ts +0 -0
  1044. /package/dist/{api → services}/stream/util.js +0 -0
  1045. /package/dist/{api → services}/thread/delete.d.ts +0 -0
  1046. /package/dist/{api → services}/thread/delete.js +0 -0
  1047. /package/dist/{api → services}/thread/get.d.ts +0 -0
  1048. /package/dist/{api → services}/thread/get.js +0 -0
  1049. /package/dist/{api → services}/thread/index.d.ts +0 -0
  1050. /package/dist/{api → services}/thread/index.js +0 -0
  1051. /package/dist/{api → services}/thread/util.d.ts +0 -0
  1052. /package/dist/{api → services}/thread/util.js +0 -0
  1053. /package/dist/{api → services}/user/index.d.ts +0 -0
  1054. /package/dist/{api → services}/user/index.js +0 -0
  1055. /package/dist/{api → services}/user/util.d.ts +0 -0
  1056. /package/dist/{api → services}/user/util.js +0 -0
  1057. /package/dist/{api → services}/user/whoami.d.ts +0 -0
  1058. /package/dist/{api → services}/user/whoami.js +0 -0
  1059. /package/dist/{api → services}/webhook/deliveries.js +0 -0
  1060. /package/dist/{api → services}/webhook/destinations.js +0 -0
  1061. /package/dist/{api → services}/webhook/receipts.d.ts +0 -0
  1062. /package/dist/{api → services}/webhook/receipts.js +0 -0
  1063. /package/dist/{api → services}/webhook/util.d.ts +0 -0
  1064. /package/dist/{api → services}/webhook/util.js +0 -0
  1065. /package/dist/{api → services}/webhook/webhooks.js +0 -0
  1066. /package/src/{api → services}/api-example.md +0 -0
  1067. /package/src/{api → services}/apikey/delete.ts +0 -0
  1068. /package/src/{api → services}/apikey/get.ts +0 -0
  1069. /package/src/{api → services}/apikey/index.ts +0 -0
  1070. /package/src/{api → services}/apikey/util.ts +0 -0
  1071. /package/src/{api → services}/db/logs.ts +0 -0
  1072. /package/src/{api → services}/db/util.ts +0 -0
  1073. /package/src/{api → services}/env.ts +0 -0
  1074. /package/src/services/{evalrun.ts → eval/events.ts} +0 -0
  1075. /package/src/{api → services}/eval/get.ts +0 -0
  1076. /package/src/{api → services}/eval/list.ts +0 -0
  1077. /package/src/{api → services}/eval/run-get.ts +0 -0
  1078. /package/src/{api → services}/eval/run-list.ts +0 -0
  1079. /package/src/{api → services}/logger.ts +0 -0
  1080. /package/src/{api → services}/machine/index.ts +0 -0
  1081. /package/src/{api → services}/machine/util.ts +0 -0
  1082. /package/src/{api → services}/org/env-delete.ts +0 -0
  1083. /package/src/{api → services}/org/env-update.ts +0 -0
  1084. /package/src/{api → services}/org/index.ts +0 -0
  1085. /package/src/{api → services}/org/list.ts +0 -0
  1086. /package/src/{api → services}/org/util.ts +0 -0
  1087. /package/src/{api → services}/project/agent.ts +0 -0
  1088. /package/src/{api → services}/project/create.ts +0 -0
  1089. /package/src/{api → services}/project/env-delete.ts +0 -0
  1090. /package/src/{api → services}/project/env-update.ts +0 -0
  1091. /package/src/{api → services}/project/exists.ts +0 -0
  1092. /package/src/{api → services}/project/get.ts +0 -0
  1093. /package/src/{api → services}/project/index.ts +0 -0
  1094. /package/src/{api → services}/project/list.ts +0 -0
  1095. /package/src/{api → services}/project/update-region.ts +0 -0
  1096. /package/src/{api → services}/project/util.ts +0 -0
  1097. /package/src/{api → services}/queue/dlq.ts +0 -0
  1098. /package/src/{api → services}/queue/messages.ts +0 -0
  1099. /package/src/{api → services}/queue/queues.ts +0 -0
  1100. /package/src/{api → services}/region/create.ts +0 -0
  1101. /package/src/{api → services}/region/delete.ts +0 -0
  1102. /package/src/{api → services}/region/index.ts +0 -0
  1103. /package/src/{api → services}/region/list.ts +0 -0
  1104. /package/src/{api → services}/region/resources.ts +0 -0
  1105. /package/src/{api → services}/region/util.ts +0 -0
  1106. /package/src/{api → services}/sandbox/snapshot-build.ts +0 -0
  1107. /package/src/services/{session.ts → session/events.ts} +0 -0
  1108. /package/src/{api → services}/session/logs.ts +0 -0
  1109. /package/src/{api → services}/session/util.ts +0 -0
  1110. /package/src/{api → services}/storage/config.ts +0 -0
  1111. /package/src/{api → services}/storage/index.ts +0 -0
  1112. /package/src/{api → services}/storage/types.ts +0 -0
  1113. /package/src/{api → services}/storage/util.ts +0 -0
  1114. /package/src/{api → services}/stream/get.ts +0 -0
  1115. /package/src/{api → services}/stream/util.ts +0 -0
  1116. /package/src/{api → services}/thread/delete.ts +0 -0
  1117. /package/src/{api → services}/thread/get.ts +0 -0
  1118. /package/src/{api → services}/thread/index.ts +0 -0
  1119. /package/src/{api → services}/thread/util.ts +0 -0
  1120. /package/src/{api → services}/user/index.ts +0 -0
  1121. /package/src/{api → services}/user/util.ts +0 -0
  1122. /package/src/{api → services}/user/whoami.ts +0 -0
  1123. /package/src/{api → services}/webhook/deliveries.ts +0 -0
  1124. /package/src/{api → services}/webhook/destinations.ts +0 -0
  1125. /package/src/{api → services}/webhook/receipts.ts +0 -0
  1126. /package/src/{api → services}/webhook/util.ts +0 -0
  1127. /package/src/{api → services}/webhook/webhooks.ts +0 -0
@@ -0,0 +1,1887 @@
1
+ import { buildUrl, toServiceException } from "../_util.js";
2
+ import { StructuredError } from "../../error.js";
3
+ import { safeStringify } from "../../json.js";
4
+ import { z } from 'zod';
5
+ /**
6
+ * Priority level for a task, from highest (`'high'`) to no priority (`'none'`).
7
+ */
8
+ export const TaskPrioritySchema = z.enum(['high', 'medium', 'low', 'none']);
9
+ /**
10
+ * The classification of a task.
11
+ *
12
+ * - `'epic'` — Large initiatives that span multiple features or tasks.
13
+ * - `'feature'` — New capabilities to be built.
14
+ * - `'enhancement'` — Improvements to existing features.
15
+ * - `'bug'` — Defects to be fixed.
16
+ * - `'task'` — General work items.
17
+ */
18
+ export const TaskTypeSchema = z.enum(['epic', 'feature', 'enhancement', 'bug', 'task']);
19
+ /**
20
+ * The lifecycle status of a task.
21
+ *
22
+ * - `'open'` — Created, not yet started.
23
+ * - `'in_progress'` — Actively being worked on.
24
+ * - `'done'` — Work completed.
25
+ * - `'closed'` — Resolved and closed.
26
+ * - `'cancelled'` — Abandoned.
27
+ */
28
+ export const TaskStatusSchema = z.enum(['open', 'in_progress', 'closed', 'done', 'cancelled']);
29
+ /**
30
+ * A lightweight reference to a user or project entity, containing just the ID
31
+ * and display name. Used for creator, assignee, closer, and project associations.
32
+ */
33
+ export const EntityRefSchema = z.object({
34
+ id: z.string().describe('Unique identifier of the referenced entity.'),
35
+ name: z.string().describe('Human-readable display name of the entity.'),
36
+ });
37
+ /**
38
+ * The type of user entity.
39
+ *
40
+ * - `'human'` — A human user.
41
+ * - `'agent'` — An AI agent.
42
+ */
43
+ export const UserTypeSchema = z.enum(['human', 'agent']);
44
+ /**
45
+ * A reference to a user entity with type discrimination.
46
+ * Extends {@link EntityRef} with a {@link UserEntityRef.type | type} field
47
+ * to distinguish between human users and AI agents.
48
+ */
49
+ export const UserEntityRefSchema = EntityRefSchema.extend({
50
+ type: UserTypeSchema.optional().describe("The type of user. Defaults to `'human'` if not specified."),
51
+ });
52
+ /**
53
+ * A work item in the task management system.
54
+ *
55
+ * Tasks can represent epics, features, bugs, enhancements, or generic tasks.
56
+ * They support hierarchical organization via {@link Task.parent_id | parent_id},
57
+ * assignment tracking, and lifecycle management through status transitions.
58
+ *
59
+ * @remarks
60
+ * Status transitions are tracked automatically — when a task moves to a new status,
61
+ * the corresponding date field (e.g., {@link Task.open_date | open_date},
62
+ * {@link Task.in_progress_date | in_progress_date}) is set by the server.
63
+ */
64
+ export const TaskSchema = z.object({
65
+ id: z.string().describe('Unique identifier for the task.'),
66
+ created_at: z.string().describe('ISO 8601 timestamp when the task was created.'),
67
+ updated_at: z.string().describe('ISO 8601 timestamp when the task was last modified.'),
68
+ title: z.string().describe('The task title.'),
69
+ description: z.string().optional().describe('Detailed description of the task.'),
70
+ metadata: z
71
+ .record(z.string(), z.unknown())
72
+ .optional()
73
+ .describe('Arbitrary key-value metadata attached to the task.'),
74
+ priority: TaskPrioritySchema.describe('The priority level of the task.'),
75
+ parent_id: z
76
+ .string()
77
+ .optional()
78
+ .describe('ID of the parent task, enabling hierarchical task organization'),
79
+ type: TaskTypeSchema.describe('The classification of this task.'),
80
+ status: TaskStatusSchema.describe('The current lifecycle status of the task.'),
81
+ open_date: z
82
+ .string()
83
+ .optional()
84
+ .describe("ISO 8601 timestamp when the task was moved to `'open'` status."),
85
+ in_progress_date: z
86
+ .string()
87
+ .optional()
88
+ .describe("ISO 8601 timestamp when the task was moved to `'in_progress'` status."),
89
+ closed_date: z.string().optional().describe('ISO 8601 timestamp when the task was closed.'),
90
+ created_id: z.string().describe('ID of the user who created the task.'),
91
+ assigned_id: z.string().optional().describe('ID of the user the task is assigned to.'),
92
+ closed_id: z.string().optional().describe('ID of the user who closed the task.'),
93
+ creator: z
94
+ .lazy(() => UserEntityRefSchema)
95
+ .optional()
96
+ .describe('Reference to the user who created the task.'),
97
+ assignee: z
98
+ .lazy(() => UserEntityRefSchema)
99
+ .optional()
100
+ .describe('Reference to the user the task is assigned to.'),
101
+ closer: z
102
+ .lazy(() => UserEntityRefSchema)
103
+ .optional()
104
+ .describe('Reference to the user who closed the task.'),
105
+ project: EntityRefSchema.optional().describe('Reference to the project this task belongs to.'),
106
+ cancelled_date: z
107
+ .string()
108
+ .optional()
109
+ .describe('ISO 8601 timestamp when the task was cancelled.'),
110
+ tags: z
111
+ .lazy(() => z.array(TagSchema))
112
+ .optional()
113
+ .describe('Array of tags associated with this task.'),
114
+ comments: z
115
+ .lazy(() => z.array(CommentSchema))
116
+ .optional()
117
+ .describe('Array of comments on this task.'),
118
+ });
119
+ /**
120
+ * A comment on a task, supporting threaded discussion.
121
+ */
122
+ export const CommentSchema = z.object({
123
+ id: z.string().describe('Unique identifier for the comment.'),
124
+ created_at: z.string().describe('ISO 8601 timestamp when the comment was created.'),
125
+ updated_at: z.string().describe('ISO 8601 timestamp when the comment was last edited.'),
126
+ task_id: z.string().describe('ID of the task this comment belongs to.'),
127
+ user_id: z.string().describe('ID of the user who authored the comment.'),
128
+ author: UserEntityRefSchema.optional().describe('Reference to the comment author with display name.'),
129
+ body: z.string().describe('The comment text content.'),
130
+ });
131
+ /**
132
+ * A label that can be applied to tasks for categorization and filtering.
133
+ */
134
+ export const TagSchema = z.object({
135
+ id: z.string().describe('Unique identifier for the tag.'),
136
+ created_at: z.string().describe('ISO 8601 timestamp when the tag was created.'),
137
+ name: z.string().describe('Display name of the tag.'),
138
+ color: z.string().optional().describe('Optional hex color code for the tag.'),
139
+ });
140
+ /**
141
+ * A record of a single field change on a task, providing an audit trail.
142
+ */
143
+ export const TaskChangelogEntrySchema = z.object({
144
+ id: z.string().describe('Unique identifier for the changelog entry.'),
145
+ created_at: z.string().describe('ISO 8601 timestamp when the change occurred.'),
146
+ task_id: z.string().describe('ID of the task that was changed.'),
147
+ field: z.string().describe('Name of the field that was changed.'),
148
+ old_value: z
149
+ .string()
150
+ .optional()
151
+ .describe('The previous value of the field (as a string), or `undefined` if the field was newly set.'),
152
+ new_value: z
153
+ .string()
154
+ .optional()
155
+ .describe('The new value of the field (as a string), or `undefined` if the field was cleared.'),
156
+ });
157
+ /**
158
+ * Parameters for creating a new task.
159
+ */
160
+ export const CreateTaskParamsSchema = z.object({
161
+ /**
162
+ * The task title (required).
163
+ *
164
+ * @remarks Must be non-empty and at most 1024 characters.
165
+ */
166
+ title: z.string().describe('The task title (required).'),
167
+ /**
168
+ * Detailed description of the task.
169
+ *
170
+ * @remarks Maximum 65,536 characters.
171
+ */
172
+ description: z.string().optional().describe('Detailed description of the task.'),
173
+ /** Arbitrary key-value metadata. */
174
+ metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary key-value metadata.'),
175
+ /**
176
+ * Priority level. Defaults to `'none'` if not provided.
177
+ *
178
+ * @default 'none'
179
+ */
180
+ priority: TaskPrioritySchema.optional().describe("Priority level. Defaults to `'none'` if not provided."),
181
+ /** ID of the parent task for hierarchical organization. */
182
+ parent_id: z
183
+ .string()
184
+ .optional()
185
+ .describe('ID of the parent task for hierarchical organization.'),
186
+ /** The task classification (required). */
187
+ type: TaskTypeSchema.describe('The task classification (required).'),
188
+ /**
189
+ * Initial status. Defaults to `'open'` if not provided.
190
+ *
191
+ * @default 'open'
192
+ */
193
+ status: TaskStatusSchema.optional().describe("Initial status. Defaults to `'open'` if not provided."),
194
+ /**
195
+ * ID of the creator.
196
+ *
197
+ * @remarks Legacy field; prefer {@link CreateTaskParams.creator | creator}.
198
+ */
199
+ created_id: z.string().describe('ID of the creator.'),
200
+ /**
201
+ * ID of the assigned user.
202
+ *
203
+ * @remarks Legacy field; prefer {@link CreateTaskParams.assignee | assignee}.
204
+ */
205
+ assigned_id: z.string().optional().describe('ID of the assigned user.'),
206
+ /** Reference to the user creating the task (id, name, and optional type). */
207
+ creator: UserEntityRefSchema.optional().describe('Reference to the user creating the task (id, name, and optional type).'),
208
+ /** Reference to the user being assigned the task. */
209
+ assignee: UserEntityRefSchema.optional().describe('Reference to the user being assigned the task.'),
210
+ /** Reference to the project this task belongs to. */
211
+ project: EntityRefSchema.optional().describe('Reference to the project this task belongs to.'),
212
+ /** Array of tag IDs to associate with the task at creation. */
213
+ tag_ids: z
214
+ .array(z.string())
215
+ .optional()
216
+ .describe('Array of tag IDs to associate with the task at creation.'),
217
+ });
218
+ /**
219
+ * Parameters for partially updating an existing task.
220
+ *
221
+ * @remarks Only provided fields are modified; omitted fields remain unchanged.
222
+ */
223
+ export const UpdateTaskParamsSchema = z.object({
224
+ /**
225
+ * Updated task title.
226
+ *
227
+ * @remarks Must be non-empty and at most 1024 characters if provided.
228
+ */
229
+ title: z.string().optional().describe('Updated task title.'),
230
+ /**
231
+ * Updated description.
232
+ *
233
+ * @remarks Maximum 65,536 characters.
234
+ */
235
+ description: z.string().optional().describe('Updated description.'),
236
+ /** Updated key-value metadata. */
237
+ metadata: z.record(z.string(), z.unknown()).optional().describe('Updated key-value metadata.'),
238
+ /** Updated priority level. */
239
+ priority: TaskPrioritySchema.optional().describe('Updated priority level.'),
240
+ /** Updated parent task ID. */
241
+ parent_id: z.string().optional().describe('Updated parent task ID.'),
242
+ /** Updated task classification. */
243
+ type: TaskTypeSchema.optional().describe('Updated task classification.'),
244
+ /** Updated lifecycle status. */
245
+ status: TaskStatusSchema.optional().describe('Updated lifecycle status.'),
246
+ /**
247
+ * Updated assigned user ID.
248
+ *
249
+ * @remarks Legacy field; prefer {@link UpdateTaskParams.assignee | assignee}.
250
+ */
251
+ assigned_id: z.string().optional().describe('Updated assigned user ID.'),
252
+ /**
253
+ * ID of the user closing the task.
254
+ *
255
+ * @remarks Legacy field; prefer {@link UpdateTaskParams.closer | closer}.
256
+ */
257
+ closed_id: z.string().optional().describe('ID of the user closing the task.'),
258
+ /** Reference to the user being assigned the task. */
259
+ assignee: UserEntityRefSchema.optional().describe('Reference to the user being assigned the task.'),
260
+ /** Reference to the user closing the task. */
261
+ closer: UserEntityRefSchema.optional().describe('Reference to the user closing the task.'),
262
+ /** Reference to the project this task belongs to. */
263
+ project: EntityRefSchema.optional().describe('Reference to the project this task belongs to.'),
264
+ });
265
+ /**
266
+ * Parameters for filtering and paginating the task list.
267
+ */
268
+ export const ListTasksParamsSchema = z.object({
269
+ /** Filter by task status. */
270
+ status: TaskStatusSchema.optional().describe('Filter by task status.'),
271
+ /** Filter by task type. */
272
+ type: TaskTypeSchema.optional().describe('Filter by task type.'),
273
+ /** Filter by priority level. */
274
+ priority: TaskPrioritySchema.optional().describe('Filter by priority level.'),
275
+ /** Filter by assigned user ID. */
276
+ assigned_id: z.string().optional().describe('Filter by assigned user ID.'),
277
+ /** Filter by parent task ID (get subtasks). */
278
+ parent_id: z.string().optional().describe('Filter by parent task ID (get subtasks).'),
279
+ /** Filter by project ID. */
280
+ project_id: z.string().optional().describe('Filter by project ID.'),
281
+ /** Filter by tag ID. */
282
+ tag_id: z.string().optional().describe('Filter by tag ID.'),
283
+ /**
284
+ * Filter for soft-deleted tasks.
285
+ *
286
+ * @default false
287
+ */
288
+ deleted: z.boolean().optional().describe('Filter for soft-deleted tasks.'),
289
+ /**
290
+ * Sort field. Prefix with `-` for descending order.
291
+ *
292
+ * @remarks Supported values: `'created_at'`, `'updated_at'`, `'priority'`.
293
+ * Prefix with `-` for descending (e.g., `'-created_at'`).
294
+ */
295
+ sort: z.string().optional().describe('Sort field. Prefix with `-` for descending order.'),
296
+ /** Sort direction: `'asc'` or `'desc'`. */
297
+ order: z.enum(['asc', 'desc']).optional().describe("Sort direction: `'asc'` or `'desc'`."),
298
+ /** Maximum number of results to return. */
299
+ limit: z.number().optional().describe('Maximum number of results to return.'),
300
+ /** Number of results to skip for pagination. */
301
+ offset: z.number().optional().describe('Number of results to skip for pagination.'),
302
+ });
303
+ /**
304
+ * Paginated list of tasks with total count.
305
+ */
306
+ export const ListTasksResultSchema = z.object({
307
+ /** Array of tasks matching the query. */
308
+ tasks: z.array(TaskSchema).describe('Array of tasks matching the query.'),
309
+ /** Total number of tasks matching the filters (before pagination). */
310
+ total: z.number().describe('Total number of tasks matching the filters (before pagination).'),
311
+ /** The limit that was applied. */
312
+ limit: z.number().describe('The limit that was applied.'),
313
+ /** The offset that was applied. */
314
+ offset: z.number().describe('The offset that was applied.'),
315
+ });
316
+ /**
317
+ * Parameters for batch-deleting tasks by filter.
318
+ * At least one filter must be provided.
319
+ */
320
+ export const BatchDeleteTasksParamsSchema = z.object({
321
+ /** Filter by task status. */
322
+ status: TaskStatusSchema.optional().describe('Filter by task status.'),
323
+ /** Filter by task type. */
324
+ type: TaskTypeSchema.optional().describe('Filter by task type.'),
325
+ /** Filter by priority level. */
326
+ priority: TaskPrioritySchema.optional().describe('Filter by priority level.'),
327
+ /** Filter by parent task ID (delete subtasks). */
328
+ parent_id: z.string().optional().describe('Filter by parent task ID (delete subtasks).'),
329
+ /** Filter by creator ID. */
330
+ created_id: z.string().optional().describe('Filter by creator ID.'),
331
+ /**
332
+ * Delete tasks older than this duration.
333
+ * Accepts Go-style duration strings: `'30m'`, `'24h'`, `'7d'`, `'2w'`.
334
+ */
335
+ older_than: z.string().optional().describe('Delete tasks older than this duration.'),
336
+ /**
337
+ * Maximum number of tasks to delete.
338
+ * @default 50
339
+ * @maximum 200
340
+ */
341
+ limit: z.number().optional().describe('Maximum number of tasks to delete.'),
342
+ });
343
+ /**
344
+ * A single task that was deleted in a batch operation.
345
+ */
346
+ export const BatchDeletedTaskSchema = z.object({
347
+ id: z.string().describe('The ID of the deleted task.'),
348
+ title: z.string().describe('The title of the deleted task.'),
349
+ });
350
+ /**
351
+ * Result of a batch delete operation.
352
+ */
353
+ export const BatchDeleteTasksResultSchema = z.object({
354
+ /** Array of tasks that were deleted. */
355
+ deleted: z.array(BatchDeletedTaskSchema).describe('Array of tasks that were deleted.'),
356
+ /** Total number of tasks deleted. */
357
+ count: z.number().describe('Total number of tasks deleted.'),
358
+ });
359
+ /**
360
+ * Paginated list of changelog entries for a task.
361
+ */
362
+ export const TaskChangelogResultSchema = z.object({
363
+ /** Array of change records. */
364
+ changelog: z.array(TaskChangelogEntrySchema).describe('Array of change records.'),
365
+ /** Total number of changelog entries. */
366
+ total: z.number().describe('Total number of changelog entries.'),
367
+ /** Applied limit. */
368
+ limit: z.number().describe('Applied limit.'),
369
+ /** Applied offset. */
370
+ offset: z.number().describe('Applied offset.'),
371
+ });
372
+ /**
373
+ * Paginated list of comments on a task.
374
+ */
375
+ export const ListCommentsResultSchema = z.object({
376
+ /** Array of comments. */
377
+ comments: z.array(CommentSchema).describe('Array of comments.'),
378
+ /** Total number of comments. */
379
+ total: z.number().describe('Total number of comments.'),
380
+ /** Applied limit. */
381
+ limit: z.number().describe('Applied limit.'),
382
+ /** Applied offset. */
383
+ offset: z.number().describe('Applied offset.'),
384
+ });
385
+ /**
386
+ * List of all tags in the organization.
387
+ */
388
+ export const ListTagsResultSchema = z.object({
389
+ tags: z.array(TagSchema).describe('Array of tags.'),
390
+ });
391
+ /**
392
+ * A file attachment on a task. Attachments are stored in S3 and accessed via presigned URLs.
393
+ */
394
+ export const AttachmentSchema = z.object({
395
+ id: z.string().describe('Unique identifier for the attachment.'),
396
+ created_at: z.string().describe('ISO 8601 timestamp when the attachment was uploaded.'),
397
+ task_id: z.string().describe('ID of the task this attachment belongs to.'),
398
+ user_id: z.string().describe('ID of the user who uploaded the attachment.'),
399
+ author: UserEntityRefSchema.optional().describe('Reference to the uploader with display name.'),
400
+ filename: z.string().describe('Original filename of the uploaded file.'),
401
+ content_type: z.string().optional().describe('MIME type of the file.'),
402
+ size: z.number().optional().describe('File size in bytes.'),
403
+ });
404
+ /**
405
+ * Parameters for initiating a file upload to a task.
406
+ */
407
+ export const CreateAttachmentParamsSchema = z.object({
408
+ filename: z.string().describe('The filename for the attachment (required).'),
409
+ content_type: z.string().optional().describe('MIME type of the file.'),
410
+ size: z.number().optional().describe('File size in bytes.'),
411
+ });
412
+ /**
413
+ * Response from initiating an attachment upload. Contains a presigned S3 URL for direct upload.
414
+ */
415
+ export const PresignUploadResponseSchema = z.object({
416
+ attachment: AttachmentSchema.describe('The created attachment record.'),
417
+ presigned_url: z
418
+ .string()
419
+ .describe('A presigned S3 URL to upload the file content via HTTP PUT.'),
420
+ expiry_seconds: z.number().describe('Number of seconds until the presigned URL expires.'),
421
+ });
422
+ /**
423
+ * Response containing a presigned S3 URL for downloading an attachment.
424
+ */
425
+ export const PresignDownloadResponseSchema = z.object({
426
+ presigned_url: z.string().describe('A presigned S3 URL to download the file via HTTP GET.'),
427
+ expiry_seconds: z.number().describe('Number of seconds until the presigned URL expires.'),
428
+ });
429
+ /**
430
+ * List of attachments on a task.
431
+ */
432
+ export const ListAttachmentsResultSchema = z.object({
433
+ /** Array of attachment records. */
434
+ attachments: z.array(AttachmentSchema).describe('Array of attachment records.'),
435
+ /** Total number of attachments. */
436
+ total: z.number().describe('Total number of attachments.'),
437
+ });
438
+ /**
439
+ * List of all users who have been referenced in tasks (as creators, assignees, or closers).
440
+ */
441
+ export const ListUsersResultSchema = z.object({
442
+ users: z
443
+ .array(UserEntityRefSchema)
444
+ .describe('Array of user entity references with type information.'),
445
+ });
446
+ /**
447
+ * List of all projects that have been referenced in tasks.
448
+ */
449
+ export const ListProjectsResultSchema = z.object({
450
+ projects: z.array(EntityRefSchema).describe('Array of project entity references.'),
451
+ });
452
+ /**
453
+ * Parameters for querying task activity time-series data.
454
+ */
455
+ export const TaskActivityParamsSchema = z.object({
456
+ /**
457
+ * Number of days of activity to retrieve.
458
+ *
459
+ * @remarks Minimum 7, maximum 365.
460
+ * @default 90
461
+ */
462
+ days: z.number().min(7).max(365).optional().describe('Number of days of activity to retrieve.'),
463
+ });
464
+ /**
465
+ * A single day's snapshot of task counts by status.
466
+ */
467
+ export const TaskActivityDataPointSchema = z.object({
468
+ /**
469
+ * The date in `YYYY-MM-DD` format.
470
+ *
471
+ * @example '2026-02-28'
472
+ */
473
+ date: z.string().describe('The date in `YYYY-MM-DD` format.'),
474
+ /** Number of tasks in `'open'` status on this date. */
475
+ open: z.number().describe("Number of tasks in `'open'` status on this date."),
476
+ /** Number of tasks in `'in_progress'` status on this date. */
477
+ inProgress: z.number().describe("Number of tasks in `'in_progress'` status on this date."),
478
+ /** Number of tasks in `'done'` status on this date. */
479
+ done: z.number().describe("Number of tasks in `'done'` status on this date."),
480
+ /** Number of tasks in `'closed'` status on this date. */
481
+ closed: z.number().describe("Number of tasks in `'closed'` status on this date."),
482
+ /** Number of tasks in `'cancelled'` status on this date. */
483
+ cancelled: z.number().describe("Number of tasks in `'cancelled'` status on this date."),
484
+ });
485
+ /**
486
+ * Task activity time-series data.
487
+ */
488
+ export const TaskActivityResultSchema = z.object({
489
+ activity: z
490
+ .array(TaskActivityDataPointSchema)
491
+ .describe('Array of daily activity snapshots, ordered chronologically.'),
492
+ days: z.number().describe('The number of days of data returned.'),
493
+ });
494
+ /** API version string used for task CRUD, comment, tag, and attachment endpoints. */
495
+ const TASK_API_VERSION = '2026-02-24';
496
+ /** Maximum number of tasks that can be deleted in a single batch request. */
497
+ const MAX_BATCH_DELETE_LIMIT = 200;
498
+ /** API version string used for the task activity analytics endpoint. */
499
+ const TASK_ACTIVITY_API_VERSION = '2026-02-28';
500
+ /** Thrown when a task ID parameter is empty or not a string. */
501
+ const TaskIdRequiredError = StructuredError('TaskIdRequiredError', 'Task ID is required and must be a non-empty string');
502
+ /** Thrown when a task title is empty or not a string. */
503
+ const TaskTitleRequiredError = StructuredError('TaskTitleRequiredError', 'Task title is required and must be a non-empty string');
504
+ /** Thrown when a comment ID parameter is empty or not a string. */
505
+ const CommentIdRequiredError = StructuredError('CommentIdRequiredError', 'Comment ID is required and must be a non-empty string');
506
+ /** Thrown when a comment body is empty or not a string. */
507
+ const CommentBodyRequiredError = StructuredError('CommentBodyRequiredError', 'Comment body is required and must be a non-empty string');
508
+ /** Thrown when a tag ID parameter is empty or not a string. */
509
+ const TagIdRequiredError = StructuredError('TagIdRequiredError', 'Tag ID is required and must be a non-empty string');
510
+ /** Thrown when a tag name is empty or not a string. */
511
+ const TagNameRequiredError = StructuredError('TagNameRequiredError', 'Tag name is required and must be a non-empty string');
512
+ /** Thrown when an attachment ID parameter is empty or not a string. */
513
+ const AttachmentIdRequiredError = StructuredError('AttachmentIdRequiredError', 'Attachment ID is required and must be a non-empty string');
514
+ /** Thrown when a user ID parameter is empty or not a string. */
515
+ const UserIdRequiredError = StructuredError('UserIdRequiredError', 'User ID is required and must be a non-empty string');
516
+ /**
517
+ * Thrown when the API returns a success HTTP status but the response body indicates failure.
518
+ */
519
+ const TaskStorageResponseError = StructuredError('TaskStorageResponseError')();
520
+ /**
521
+ * Client for the Agentuity Task management service.
522
+ *
523
+ * Provides a full-featured project management API including task CRUD, hierarchical
524
+ * organization (epics → features → tasks), comments, tags, file attachments via
525
+ * presigned S3 URLs, changelog tracking, and activity analytics.
526
+ *
527
+ * Tasks support lifecycle management through status transitions (`open` → `in_progress`
528
+ * → `done`/`closed`/`cancelled`) with automatic date tracking for each transition.
529
+ *
530
+ * All methods validate inputs client-side and throw structured errors for invalid
531
+ * parameters. API errors throw {@link ServiceException}.
532
+ *
533
+ * @example
534
+ * ```typescript
535
+ * const tasks = new TaskStorageService(baseUrl, adapter);
536
+ *
537
+ * // Create a task
538
+ * const task = await tasks.create({
539
+ * title: 'Implement login flow',
540
+ * type: 'feature',
541
+ * created_id: 'user_123',
542
+ * creator: { id: 'user_123', name: 'Alice' },
543
+ * priority: 'high',
544
+ * });
545
+ *
546
+ * // Add a comment
547
+ * await tasks.createComment(task.id, 'Started working on this', 'user_123');
548
+ *
549
+ * // List open tasks
550
+ * const { tasks: openTasks } = await tasks.list({ status: 'open' });
551
+ * ```
552
+ */
553
+ export class TaskStorageService {
554
+ #adapter;
555
+ #baseUrl;
556
+ /**
557
+ * Creates a new TaskStorageService instance.
558
+ *
559
+ * @param baseUrl - The base URL of the task management API
560
+ * @param adapter - The HTTP fetch adapter used for making API requests
561
+ */
562
+ constructor(baseUrl, adapter) {
563
+ this.#adapter = adapter;
564
+ this.#baseUrl = baseUrl;
565
+ }
566
+ /**
567
+ * Create a new task.
568
+ *
569
+ * @param params - The task creation parameters including title, type, and optional fields
570
+ * @returns The newly created task
571
+ * @throws {@link TaskTitleRequiredError} if the title is empty or not a string
572
+ * @throws {@link ServiceException} if the API request fails
573
+ *
574
+ * @example
575
+ * ```typescript
576
+ * const task = await tasks.create({
577
+ * title: 'Fix login bug',
578
+ * type: 'bug',
579
+ * created_id: 'user_123',
580
+ * priority: 'high',
581
+ * creator: { id: 'user_123', name: 'Alice' },
582
+ * project: { id: 'proj_456', name: 'Auth Service' },
583
+ * });
584
+ * console.log('Created:', task.id);
585
+ * ```
586
+ */
587
+ async create(params) {
588
+ if (!params?.title || typeof params.title !== 'string' || params.title.trim().length === 0) {
589
+ throw new TaskTitleRequiredError();
590
+ }
591
+ const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}`);
592
+ const signal = AbortSignal.timeout(30_000);
593
+ const res = await this.#adapter.invoke(url, {
594
+ method: 'POST',
595
+ body: safeStringify(params),
596
+ contentType: 'application/json',
597
+ signal,
598
+ telemetry: {
599
+ name: 'agentuity.task.create',
600
+ attributes: {
601
+ type: params.type,
602
+ priority: params.priority ?? 'none',
603
+ status: params.status ?? 'open',
604
+ },
605
+ },
606
+ });
607
+ if (res.ok) {
608
+ if (res.data.success) {
609
+ return res.data.data;
610
+ }
611
+ throw new TaskStorageResponseError({
612
+ status: res.response.status,
613
+ message: res.data.message,
614
+ });
615
+ }
616
+ throw await toServiceException('POST', url, res.response);
617
+ }
618
+ /**
619
+ * Get a task by its ID.
620
+ *
621
+ * @param id - The unique task identifier
622
+ * @returns The task if found, or `null` if the task does not exist
623
+ * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
624
+ * @throws {@link ServiceException} if the API request fails
625
+ *
626
+ * @example
627
+ * ```typescript
628
+ * const task = await tasks.get('task_abc123');
629
+ * if (task) {
630
+ * console.log(task.title, task.status);
631
+ * } else {
632
+ * console.log('Task not found');
633
+ * }
634
+ * ```
635
+ */
636
+ async get(id) {
637
+ if (!id || typeof id !== 'string' || id.trim().length === 0) {
638
+ throw new TaskIdRequiredError();
639
+ }
640
+ const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
641
+ const signal = AbortSignal.timeout(30_000);
642
+ const res = await this.#adapter.invoke(url, {
643
+ method: 'GET',
644
+ signal,
645
+ telemetry: {
646
+ name: 'agentuity.task.get',
647
+ attributes: { id },
648
+ },
649
+ });
650
+ if (res.response.status === 404) {
651
+ return null;
652
+ }
653
+ if (res.ok) {
654
+ if (res.data.success) {
655
+ return res.data.data;
656
+ }
657
+ throw new TaskStorageResponseError({
658
+ status: res.response.status,
659
+ message: res.data.message,
660
+ });
661
+ }
662
+ throw await toServiceException('GET', url, res.response);
663
+ }
664
+ /**
665
+ * List tasks with optional filtering and pagination.
666
+ *
667
+ * @param params - Optional filter and pagination parameters
668
+ * @returns Paginated list of tasks matching the filters
669
+ * @throws {@link ServiceException} if the API request fails
670
+ *
671
+ * @example
672
+ * ```typescript
673
+ * // List all open high-priority bugs
674
+ * const result = await tasks.list({
675
+ * status: 'open',
676
+ * type: 'bug',
677
+ * priority: 'high',
678
+ * sort: '-created_at',
679
+ * limit: 20,
680
+ * });
681
+ * console.log(`Found ${result.total} bugs, showing ${result.tasks.length}`);
682
+ * ```
683
+ */
684
+ async list(params) {
685
+ const queryParams = new URLSearchParams();
686
+ if (params?.status)
687
+ queryParams.set('status', params.status);
688
+ if (params?.type)
689
+ queryParams.set('type', params.type);
690
+ if (params?.priority)
691
+ queryParams.set('priority', params.priority);
692
+ if (params?.assigned_id)
693
+ queryParams.set('assigned_id', params.assigned_id);
694
+ if (params?.parent_id)
695
+ queryParams.set('parent_id', params.parent_id);
696
+ if (params?.project_id)
697
+ queryParams.set('project_id', params.project_id);
698
+ if (params?.tag_id)
699
+ queryParams.set('tag_id', params.tag_id);
700
+ if (params?.deleted !== undefined)
701
+ queryParams.set('deleted', String(params.deleted));
702
+ if (params?.sort)
703
+ queryParams.set('sort', params.sort);
704
+ if (params?.order)
705
+ queryParams.set('order', params.order);
706
+ if (params?.limit !== undefined)
707
+ queryParams.set('limit', String(params.limit));
708
+ if (params?.offset !== undefined)
709
+ queryParams.set('offset', String(params.offset));
710
+ const queryString = queryParams.toString();
711
+ const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}${queryString ? `?${queryString}` : ''}`);
712
+ const signal = AbortSignal.timeout(30_000);
713
+ const res = await this.#adapter.invoke(url, {
714
+ method: 'GET',
715
+ signal,
716
+ telemetry: {
717
+ name: 'agentuity.task.list',
718
+ attributes: {
719
+ ...(params?.status ? { status: params.status } : {}),
720
+ ...(params?.type ? { type: params.type } : {}),
721
+ ...(params?.priority ? { priority: params.priority } : {}),
722
+ },
723
+ },
724
+ });
725
+ if (res.ok) {
726
+ if (res.data.success) {
727
+ return res.data.data;
728
+ }
729
+ throw new TaskStorageResponseError({
730
+ status: res.response.status,
731
+ message: res.data.message,
732
+ });
733
+ }
734
+ throw await toServiceException('GET', url, res.response);
735
+ }
736
+ /**
737
+ * Partially update an existing task.
738
+ *
739
+ * @param id - The unique task identifier
740
+ * @param params - Fields to update; only provided fields are changed
741
+ * @returns The updated task
742
+ * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
743
+ * @throws {@link TaskTitleRequiredError} if a title is provided but is empty
744
+ * @throws {@link ServiceException} if the API request fails
745
+ *
746
+ * @example
747
+ * ```typescript
748
+ * const updated = await tasks.update('task_abc123', {
749
+ * status: 'in_progress',
750
+ * priority: 'high',
751
+ * assignee: { id: 'user_456', name: 'Bob' },
752
+ * });
753
+ * console.log('Updated status:', updated.status);
754
+ * ```
755
+ */
756
+ async update(id, params) {
757
+ if (!id || typeof id !== 'string' || id.trim().length === 0) {
758
+ throw new TaskIdRequiredError();
759
+ }
760
+ if (params.title !== undefined &&
761
+ (typeof params.title !== 'string' || params.title.trim().length === 0)) {
762
+ throw new TaskTitleRequiredError();
763
+ }
764
+ const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
765
+ const signal = AbortSignal.timeout(30_000);
766
+ const res = await this.#adapter.invoke(url, {
767
+ method: 'PATCH',
768
+ body: safeStringify(params),
769
+ contentType: 'application/json',
770
+ signal,
771
+ telemetry: {
772
+ name: 'agentuity.task.update',
773
+ attributes: { id },
774
+ },
775
+ });
776
+ if (res.ok) {
777
+ if (res.data.success) {
778
+ return res.data.data;
779
+ }
780
+ throw new TaskStorageResponseError({
781
+ status: res.response.status,
782
+ message: res.data.message,
783
+ });
784
+ }
785
+ throw await toServiceException('PATCH', url, res.response);
786
+ }
787
+ /**
788
+ * Close a task by setting its status to closed.
789
+ *
790
+ * @param id - The unique task identifier
791
+ * @returns The closed task with updated `closed_date`
792
+ * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
793
+ * @throws {@link ServiceException} if the API request fails
794
+ *
795
+ * @example
796
+ * ```typescript
797
+ * const closed = await tasks.close('task_abc123');
798
+ * console.log('Closed at:', closed.closed_date);
799
+ * ```
800
+ */
801
+ async close(id) {
802
+ if (!id || typeof id !== 'string' || id.trim().length === 0) {
803
+ throw new TaskIdRequiredError();
804
+ }
805
+ const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
806
+ const signal = AbortSignal.timeout(30_000);
807
+ const res = await this.#adapter.invoke(url, {
808
+ method: 'DELETE',
809
+ signal,
810
+ telemetry: {
811
+ name: 'agentuity.task.close',
812
+ attributes: { id },
813
+ },
814
+ });
815
+ if (res.ok) {
816
+ if (res.data.success) {
817
+ return res.data.data;
818
+ }
819
+ throw new TaskStorageResponseError({
820
+ status: res.response.status,
821
+ message: res.data.message,
822
+ });
823
+ }
824
+ throw await toServiceException('DELETE', url, res.response);
825
+ }
826
+ /**
827
+ * Get the changelog (audit trail) for a task, showing all field changes over time.
828
+ *
829
+ * @param id - The unique task identifier
830
+ * @param params - Optional pagination parameters
831
+ * @returns Paginated list of changelog entries ordered by most recent first
832
+ * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
833
+ * @throws {@link ServiceException} if the API request fails
834
+ *
835
+ * @example
836
+ * ```typescript
837
+ * const { changelog, total } = await tasks.changelog('task_abc123', {
838
+ * limit: 10,
839
+ * offset: 0,
840
+ * });
841
+ * for (const entry of changelog) {
842
+ * console.log(`${entry.field}: ${entry.old_value} → ${entry.new_value}`);
843
+ * }
844
+ * ```
845
+ */
846
+ async changelog(id, params) {
847
+ if (!id || typeof id !== 'string' || id.trim().length === 0) {
848
+ throw new TaskIdRequiredError();
849
+ }
850
+ const queryParams = new URLSearchParams();
851
+ if (params?.limit !== undefined)
852
+ queryParams.set('limit', String(params.limit));
853
+ if (params?.offset !== undefined)
854
+ queryParams.set('offset', String(params.offset));
855
+ const queryString = queryParams.toString();
856
+ const url = buildUrl(this.#baseUrl, `/task/changelog/${TASK_API_VERSION}/${encodeURIComponent(id)}${queryString ? `?${queryString}` : ''}`);
857
+ const signal = AbortSignal.timeout(30_000);
858
+ const res = await this.#adapter.invoke(url, {
859
+ method: 'GET',
860
+ signal,
861
+ telemetry: {
862
+ name: 'agentuity.task.changelog',
863
+ attributes: { id },
864
+ },
865
+ });
866
+ if (res.ok) {
867
+ if (res.data.success) {
868
+ return res.data.data;
869
+ }
870
+ throw new TaskStorageResponseError({
871
+ status: res.response.status,
872
+ message: res.data.message,
873
+ });
874
+ }
875
+ throw await toServiceException('GET', url, res.response);
876
+ }
877
+ /**
878
+ * Soft-delete a task, marking it as deleted without permanent removal.
879
+ *
880
+ * @param id - The unique task identifier
881
+ * @returns The soft-deleted task
882
+ * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
883
+ * @throws {@link ServiceException} if the API request fails
884
+ *
885
+ * @example
886
+ * ```typescript
887
+ * const deleted = await tasks.softDelete('task_abc123');
888
+ * console.log('Soft-deleted task:', deleted.id);
889
+ * ```
890
+ */
891
+ async softDelete(id) {
892
+ if (!id || typeof id !== 'string' || id.trim().length === 0) {
893
+ throw new TaskIdRequiredError();
894
+ }
895
+ const url = buildUrl(this.#baseUrl, `/task/delete/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
896
+ const signal = AbortSignal.timeout(30_000);
897
+ const res = await this.#adapter.invoke(url, {
898
+ method: 'POST',
899
+ signal,
900
+ telemetry: {
901
+ name: 'agentuity.task.softDelete',
902
+ attributes: { id },
903
+ },
904
+ });
905
+ if (res.ok) {
906
+ if (res.data.success) {
907
+ return res.data.data;
908
+ }
909
+ throw new TaskStorageResponseError({
910
+ status: res.response.status,
911
+ message: res.data.message,
912
+ });
913
+ }
914
+ throw await toServiceException('POST', url, res.response);
915
+ }
916
+ /**
917
+ * Batch soft-delete tasks matching the given filters.
918
+ * At least one filter must be provided. The server caps the limit at 200.
919
+ *
920
+ * @param params - Filters to select which tasks to delete
921
+ * @returns The list of deleted tasks and count
922
+ * @throws {@link ServiceException} if the API request fails
923
+ *
924
+ * @example
925
+ * ```typescript
926
+ * const result = await tasks.batchDelete({ status: 'closed', older_than: '7d', limit: 50 });
927
+ * console.log(`Deleted ${result.count} tasks`);
928
+ * ```
929
+ */
930
+ async batchDelete(params) {
931
+ const hasFilter = params.status ||
932
+ params.type ||
933
+ params.priority ||
934
+ params.parent_id ||
935
+ params.created_id ||
936
+ params.older_than;
937
+ if (!hasFilter) {
938
+ throw new Error('At least one filter is required for batch delete');
939
+ }
940
+ if (params.limit !== undefined && params.limit > MAX_BATCH_DELETE_LIMIT) {
941
+ throw new Error(`Batch delete limit must not exceed ${MAX_BATCH_DELETE_LIMIT} (got ${params.limit})`);
942
+ }
943
+ const url = buildUrl(this.#baseUrl, `/task/delete/batch/${TASK_API_VERSION}`);
944
+ const signal = AbortSignal.timeout(60_000);
945
+ const body = {};
946
+ if (params.status)
947
+ body.status = params.status;
948
+ if (params.type)
949
+ body.type = params.type;
950
+ if (params.priority)
951
+ body.priority = params.priority;
952
+ if (params.parent_id)
953
+ body.parent_id = params.parent_id;
954
+ if (params.created_id)
955
+ body.created_id = params.created_id;
956
+ if (params.older_than)
957
+ body.older_than = params.older_than;
958
+ if (params.limit !== undefined)
959
+ body.limit = params.limit;
960
+ const res = await this.#adapter.invoke(url, {
961
+ method: 'POST',
962
+ body: safeStringify(body),
963
+ headers: { 'Content-Type': 'application/json' },
964
+ signal,
965
+ telemetry: {
966
+ name: 'agentuity.task.batchDelete',
967
+ attributes: {
968
+ ...(params.status ? { status: params.status } : {}),
969
+ ...(params.type ? { type: params.type } : {}),
970
+ ...(params.older_than ? { older_than: params.older_than } : {}),
971
+ },
972
+ },
973
+ });
974
+ if (res.ok) {
975
+ if (res.data.success) {
976
+ return res.data.data;
977
+ }
978
+ throw new TaskStorageResponseError({
979
+ status: res.response.status,
980
+ message: res.data.message,
981
+ });
982
+ }
983
+ throw await toServiceException('POST', url, res.response);
984
+ }
985
+ /**
986
+ * Create a comment on a task.
987
+ *
988
+ * @param taskId - The ID of the task to comment on
989
+ * @param body - The comment text content (must be non-empty)
990
+ * @param userId - The ID of the user authoring the comment
991
+ * @param author - Optional entity reference with the author's display name
992
+ * @returns The newly created comment
993
+ * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
994
+ * @throws {@link CommentBodyRequiredError} if the body is empty or not a string
995
+ * @throws {@link UserIdRequiredError} if the user ID is empty or not a string
996
+ * @throws {@link ServiceException} if the API request fails
997
+ *
998
+ * @example
999
+ * ```typescript
1000
+ * const comment = await tasks.createComment(
1001
+ * 'task_abc123',
1002
+ * 'This is ready for review.',
1003
+ * 'user_456',
1004
+ * { id: 'user_456', name: 'Bob' },
1005
+ * );
1006
+ * console.log('Comment created:', comment.id);
1007
+ * ```
1008
+ */
1009
+ async createComment(taskId, body, userId, author) {
1010
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1011
+ throw new TaskIdRequiredError();
1012
+ }
1013
+ if (!body || typeof body !== 'string' || body.trim().length === 0) {
1014
+ throw new CommentBodyRequiredError();
1015
+ }
1016
+ if (!userId || typeof userId !== 'string' || userId.trim().length === 0) {
1017
+ throw new UserIdRequiredError();
1018
+ }
1019
+ const url = buildUrl(this.#baseUrl, `/task/comments/create/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
1020
+ const signal = AbortSignal.timeout(30_000);
1021
+ const commentBody = { body, user_id: userId };
1022
+ if (author)
1023
+ commentBody.author = author;
1024
+ const res = await this.#adapter.invoke(url, {
1025
+ method: 'POST',
1026
+ body: safeStringify(commentBody),
1027
+ contentType: 'application/json',
1028
+ signal,
1029
+ telemetry: {
1030
+ name: 'agentuity.task.createComment',
1031
+ attributes: { taskId },
1032
+ },
1033
+ });
1034
+ if (res.ok) {
1035
+ if (res.data.success) {
1036
+ return res.data.data;
1037
+ }
1038
+ throw new TaskStorageResponseError({
1039
+ status: res.response.status,
1040
+ message: res.data.message,
1041
+ });
1042
+ }
1043
+ throw await toServiceException('POST', url, res.response);
1044
+ }
1045
+ /**
1046
+ * Get a comment by its ID.
1047
+ *
1048
+ * @param commentId - The unique comment identifier
1049
+ * @returns The comment
1050
+ * @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
1051
+ * @throws {@link ServiceException} if the API request fails
1052
+ *
1053
+ * @example
1054
+ * ```typescript
1055
+ * const comment = await tasks.getComment('comment_xyz789');
1056
+ * console.log(`${comment.author?.name}: ${comment.body}`);
1057
+ * ```
1058
+ */
1059
+ async getComment(commentId) {
1060
+ if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
1061
+ throw new CommentIdRequiredError();
1062
+ }
1063
+ const url = buildUrl(this.#baseUrl, `/task/comments/get/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`);
1064
+ const signal = AbortSignal.timeout(30_000);
1065
+ const res = await this.#adapter.invoke(url, {
1066
+ method: 'GET',
1067
+ signal,
1068
+ telemetry: {
1069
+ name: 'agentuity.task.getComment',
1070
+ attributes: { commentId },
1071
+ },
1072
+ });
1073
+ if (res.ok) {
1074
+ if (res.data.success) {
1075
+ return res.data.data;
1076
+ }
1077
+ throw new TaskStorageResponseError({
1078
+ status: res.response.status,
1079
+ message: res.data.message,
1080
+ });
1081
+ }
1082
+ throw await toServiceException('GET', url, res.response);
1083
+ }
1084
+ /**
1085
+ * Update a comment's body text.
1086
+ *
1087
+ * @param commentId - The unique comment identifier
1088
+ * @param body - The new comment text (must be non-empty)
1089
+ * @returns The updated comment
1090
+ * @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
1091
+ * @throws {@link CommentBodyRequiredError} if the body is empty or not a string
1092
+ * @throws {@link ServiceException} if the API request fails
1093
+ *
1094
+ * @example
1095
+ * ```typescript
1096
+ * const updated = await tasks.updateComment(
1097
+ * 'comment_xyz789',
1098
+ * 'Updated: This is now ready for final review.',
1099
+ * );
1100
+ * console.log('Updated at:', updated.updated_at);
1101
+ * ```
1102
+ */
1103
+ async updateComment(commentId, body) {
1104
+ if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
1105
+ throw new CommentIdRequiredError();
1106
+ }
1107
+ if (!body || typeof body !== 'string' || body.trim().length === 0) {
1108
+ throw new CommentBodyRequiredError();
1109
+ }
1110
+ const url = buildUrl(this.#baseUrl, `/task/comments/update/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`);
1111
+ const signal = AbortSignal.timeout(30_000);
1112
+ const res = await this.#adapter.invoke(url, {
1113
+ method: 'PATCH',
1114
+ body: safeStringify({ body }),
1115
+ contentType: 'application/json',
1116
+ signal,
1117
+ telemetry: {
1118
+ name: 'agentuity.task.updateComment',
1119
+ attributes: { commentId },
1120
+ },
1121
+ });
1122
+ if (res.ok) {
1123
+ if (res.data.success) {
1124
+ return res.data.data;
1125
+ }
1126
+ throw new TaskStorageResponseError({
1127
+ status: res.response.status,
1128
+ message: res.data.message,
1129
+ });
1130
+ }
1131
+ throw await toServiceException('PATCH', url, res.response);
1132
+ }
1133
+ /**
1134
+ * Delete a comment permanently.
1135
+ *
1136
+ * @param commentId - The unique comment identifier
1137
+ * @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
1138
+ * @throws {@link ServiceException} if the API request fails
1139
+ *
1140
+ * @example
1141
+ * ```typescript
1142
+ * await tasks.deleteComment('comment_xyz789');
1143
+ * console.log('Comment deleted');
1144
+ * ```
1145
+ */
1146
+ async deleteComment(commentId) {
1147
+ if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
1148
+ throw new CommentIdRequiredError();
1149
+ }
1150
+ const url = buildUrl(this.#baseUrl, `/task/comments/delete/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`);
1151
+ const signal = AbortSignal.timeout(30_000);
1152
+ const res = await this.#adapter.invoke(url, {
1153
+ method: 'DELETE',
1154
+ signal,
1155
+ telemetry: {
1156
+ name: 'agentuity.task.deleteComment',
1157
+ attributes: { commentId },
1158
+ },
1159
+ });
1160
+ if (res.ok) {
1161
+ if (res.data?.success === false) {
1162
+ throw new TaskStorageResponseError({
1163
+ status: res.response.status,
1164
+ message: res.data.message ?? 'Operation failed',
1165
+ });
1166
+ }
1167
+ return;
1168
+ }
1169
+ throw await toServiceException('DELETE', url, res.response);
1170
+ }
1171
+ /**
1172
+ * List comments on a task with optional pagination.
1173
+ *
1174
+ * @param taskId - The ID of the task whose comments to list
1175
+ * @param params - Optional pagination parameters
1176
+ * @returns Paginated list of comments
1177
+ * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1178
+ * @throws {@link ServiceException} if the API request fails
1179
+ *
1180
+ * @example
1181
+ * ```typescript
1182
+ * const { comments, total } = await tasks.listComments('task_abc123', {
1183
+ * limit: 25,
1184
+ * offset: 0,
1185
+ * });
1186
+ * for (const c of comments) {
1187
+ * console.log(`${c.author?.name}: ${c.body}`);
1188
+ * }
1189
+ * ```
1190
+ */
1191
+ async listComments(taskId, params) {
1192
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1193
+ throw new TaskIdRequiredError();
1194
+ }
1195
+ const queryParams = new URLSearchParams();
1196
+ if (params?.limit !== undefined)
1197
+ queryParams.set('limit', String(params.limit));
1198
+ if (params?.offset !== undefined)
1199
+ queryParams.set('offset', String(params.offset));
1200
+ const queryString = queryParams.toString();
1201
+ const url = buildUrl(this.#baseUrl, `/task/comments/list/${TASK_API_VERSION}/${encodeURIComponent(taskId)}${queryString ? `?${queryString}` : ''}`);
1202
+ const signal = AbortSignal.timeout(30_000);
1203
+ const res = await this.#adapter.invoke(url, {
1204
+ method: 'GET',
1205
+ signal,
1206
+ telemetry: {
1207
+ name: 'agentuity.task.listComments',
1208
+ attributes: { taskId },
1209
+ },
1210
+ });
1211
+ if (res.ok) {
1212
+ if (res.data.success) {
1213
+ return res.data.data;
1214
+ }
1215
+ throw new TaskStorageResponseError({
1216
+ status: res.response.status,
1217
+ message: res.data.message,
1218
+ });
1219
+ }
1220
+ throw await toServiceException('GET', url, res.response);
1221
+ }
1222
+ /**
1223
+ * Create a new tag for categorizing tasks.
1224
+ *
1225
+ * @param name - The tag display name (must be non-empty)
1226
+ * @param color - Optional hex color code (e.g., `'#ff0000'`)
1227
+ * @returns The newly created tag
1228
+ * @throws {@link TagNameRequiredError} if the name is empty or not a string
1229
+ * @throws {@link ServiceException} if the API request fails
1230
+ *
1231
+ * @example
1232
+ * ```typescript
1233
+ * const tag = await tasks.createTag('urgent', '#ff0000');
1234
+ * console.log('Created tag:', tag.id, tag.name);
1235
+ * ```
1236
+ */
1237
+ async createTag(name, color) {
1238
+ if (!name || typeof name !== 'string' || name.trim().length === 0) {
1239
+ throw new TagNameRequiredError();
1240
+ }
1241
+ const url = buildUrl(this.#baseUrl, `/task/tags/create/${TASK_API_VERSION}`);
1242
+ const signal = AbortSignal.timeout(30_000);
1243
+ const body = { name };
1244
+ if (color !== undefined)
1245
+ body.color = color;
1246
+ const res = await this.#adapter.invoke(url, {
1247
+ method: 'POST',
1248
+ body: safeStringify(body),
1249
+ contentType: 'application/json',
1250
+ signal,
1251
+ telemetry: {
1252
+ name: 'agentuity.task.createTag',
1253
+ attributes: { tagName: name },
1254
+ },
1255
+ });
1256
+ if (res.ok) {
1257
+ if (res.data.success) {
1258
+ return res.data.data;
1259
+ }
1260
+ throw new TaskStorageResponseError({
1261
+ status: res.response.status,
1262
+ message: res.data.message,
1263
+ });
1264
+ }
1265
+ throw await toServiceException('POST', url, res.response);
1266
+ }
1267
+ /**
1268
+ * Get a tag by its ID.
1269
+ *
1270
+ * @param tagId - The unique tag identifier
1271
+ * @returns The tag
1272
+ * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1273
+ * @throws {@link ServiceException} if the API request fails
1274
+ *
1275
+ * @example
1276
+ * ```typescript
1277
+ * const tag = await tasks.getTag('tag_def456');
1278
+ * console.log(`${tag.name} (${tag.color})`);
1279
+ * ```
1280
+ */
1281
+ async getTag(tagId) {
1282
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
1283
+ throw new TagIdRequiredError();
1284
+ }
1285
+ const url = buildUrl(this.#baseUrl, `/task/tags/get/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`);
1286
+ const signal = AbortSignal.timeout(30_000);
1287
+ const res = await this.#adapter.invoke(url, {
1288
+ method: 'GET',
1289
+ signal,
1290
+ telemetry: {
1291
+ name: 'agentuity.task.getTag',
1292
+ attributes: { tagId },
1293
+ },
1294
+ });
1295
+ if (res.ok) {
1296
+ if (res.data.success) {
1297
+ return res.data.data;
1298
+ }
1299
+ throw new TaskStorageResponseError({
1300
+ status: res.response.status,
1301
+ message: res.data.message,
1302
+ });
1303
+ }
1304
+ throw await toServiceException('GET', url, res.response);
1305
+ }
1306
+ /**
1307
+ * Update a tag's name and optionally its color.
1308
+ *
1309
+ * @param tagId - The unique tag identifier
1310
+ * @param name - The new tag name (must be non-empty)
1311
+ * @param color - Optional new hex color code
1312
+ * @returns The updated tag
1313
+ * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1314
+ * @throws {@link TagNameRequiredError} if the name is empty or not a string
1315
+ * @throws {@link ServiceException} if the API request fails
1316
+ *
1317
+ * @example
1318
+ * ```typescript
1319
+ * const updated = await tasks.updateTag('tag_def456', 'critical', '#cc0000');
1320
+ * console.log('Updated:', updated.name);
1321
+ * ```
1322
+ */
1323
+ async updateTag(tagId, name, color) {
1324
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
1325
+ throw new TagIdRequiredError();
1326
+ }
1327
+ if (!name || typeof name !== 'string' || name.trim().length === 0) {
1328
+ throw new TagNameRequiredError();
1329
+ }
1330
+ const url = buildUrl(this.#baseUrl, `/task/tags/update/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`);
1331
+ const signal = AbortSignal.timeout(30_000);
1332
+ const body = { name };
1333
+ if (color !== undefined)
1334
+ body.color = color;
1335
+ const res = await this.#adapter.invoke(url, {
1336
+ method: 'PATCH',
1337
+ body: safeStringify(body),
1338
+ contentType: 'application/json',
1339
+ signal,
1340
+ telemetry: {
1341
+ name: 'agentuity.task.updateTag',
1342
+ attributes: { tagId },
1343
+ },
1344
+ });
1345
+ if (res.ok) {
1346
+ if (res.data.success) {
1347
+ return res.data.data;
1348
+ }
1349
+ throw new TaskStorageResponseError({
1350
+ status: res.response.status,
1351
+ message: res.data.message,
1352
+ });
1353
+ }
1354
+ throw await toServiceException('PATCH', url, res.response);
1355
+ }
1356
+ /**
1357
+ * Delete a tag permanently.
1358
+ *
1359
+ * @param tagId - The unique tag identifier
1360
+ * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1361
+ * @throws {@link ServiceException} if the API request fails
1362
+ *
1363
+ * @example
1364
+ * ```typescript
1365
+ * await tasks.deleteTag('tag_def456');
1366
+ * console.log('Tag deleted');
1367
+ * ```
1368
+ */
1369
+ async deleteTag(tagId) {
1370
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
1371
+ throw new TagIdRequiredError();
1372
+ }
1373
+ const url = buildUrl(this.#baseUrl, `/task/tags/delete/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`);
1374
+ const signal = AbortSignal.timeout(30_000);
1375
+ const res = await this.#adapter.invoke(url, {
1376
+ method: 'DELETE',
1377
+ signal,
1378
+ telemetry: {
1379
+ name: 'agentuity.task.deleteTag',
1380
+ attributes: { tagId },
1381
+ },
1382
+ });
1383
+ if (res.ok) {
1384
+ if (res.data?.success === false) {
1385
+ throw new TaskStorageResponseError({
1386
+ status: res.response.status,
1387
+ message: res.data.message ?? 'Operation failed',
1388
+ });
1389
+ }
1390
+ return;
1391
+ }
1392
+ throw await toServiceException('DELETE', url, res.response);
1393
+ }
1394
+ /**
1395
+ * List all tags in the organization.
1396
+ *
1397
+ * @returns List of all tags
1398
+ * @throws {@link ServiceException} if the API request fails
1399
+ *
1400
+ * @example
1401
+ * ```typescript
1402
+ * const { tags } = await tasks.listTags();
1403
+ * for (const tag of tags) {
1404
+ * console.log(`${tag.name} (${tag.color ?? 'no color'})`);
1405
+ * }
1406
+ * ```
1407
+ */
1408
+ async listTags() {
1409
+ const url = buildUrl(this.#baseUrl, `/task/tags/list/${TASK_API_VERSION}`);
1410
+ const signal = AbortSignal.timeout(30_000);
1411
+ const res = await this.#adapter.invoke(url, {
1412
+ method: 'GET',
1413
+ signal,
1414
+ telemetry: {
1415
+ name: 'agentuity.task.listTags',
1416
+ attributes: {},
1417
+ },
1418
+ });
1419
+ if (res.ok) {
1420
+ if (res.data.success) {
1421
+ return res.data.data;
1422
+ }
1423
+ throw new TaskStorageResponseError({
1424
+ status: res.response.status,
1425
+ message: res.data.message,
1426
+ });
1427
+ }
1428
+ throw await toServiceException('GET', url, res.response);
1429
+ }
1430
+ /**
1431
+ * Associate a tag with a task.
1432
+ *
1433
+ * @param taskId - The ID of the task
1434
+ * @param tagId - The ID of the tag to add
1435
+ * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1436
+ * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1437
+ * @throws {@link ServiceException} if the API request fails
1438
+ *
1439
+ * @example
1440
+ * ```typescript
1441
+ * await tasks.addTagToTask('task_abc123', 'tag_def456');
1442
+ * console.log('Tag added to task');
1443
+ * ```
1444
+ */
1445
+ async addTagToTask(taskId, tagId) {
1446
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1447
+ throw new TaskIdRequiredError();
1448
+ }
1449
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
1450
+ throw new TagIdRequiredError();
1451
+ }
1452
+ const url = buildUrl(this.#baseUrl, `/task/tags/add/${TASK_API_VERSION}/${encodeURIComponent(taskId)}/${encodeURIComponent(tagId)}`);
1453
+ const signal = AbortSignal.timeout(30_000);
1454
+ const res = await this.#adapter.invoke(url, {
1455
+ method: 'POST',
1456
+ signal,
1457
+ telemetry: {
1458
+ name: 'agentuity.task.addTagToTask',
1459
+ attributes: { taskId, tagId },
1460
+ },
1461
+ });
1462
+ if (res.ok) {
1463
+ if (res.data?.success === false) {
1464
+ throw new TaskStorageResponseError({
1465
+ status: res.response.status,
1466
+ message: res.data.message ?? 'Operation failed',
1467
+ });
1468
+ }
1469
+ return;
1470
+ }
1471
+ throw await toServiceException('POST', url, res.response);
1472
+ }
1473
+ /**
1474
+ * Remove a tag association from a task.
1475
+ *
1476
+ * @param taskId - The ID of the task
1477
+ * @param tagId - The ID of the tag to remove
1478
+ * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1479
+ * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1480
+ * @throws {@link ServiceException} if the API request fails
1481
+ *
1482
+ * @example
1483
+ * ```typescript
1484
+ * await tasks.removeTagFromTask('task_abc123', 'tag_def456');
1485
+ * console.log('Tag removed from task');
1486
+ * ```
1487
+ */
1488
+ async removeTagFromTask(taskId, tagId) {
1489
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1490
+ throw new TaskIdRequiredError();
1491
+ }
1492
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
1493
+ throw new TagIdRequiredError();
1494
+ }
1495
+ const url = buildUrl(this.#baseUrl, `/task/tags/remove/${TASK_API_VERSION}/${encodeURIComponent(taskId)}/${encodeURIComponent(tagId)}`);
1496
+ const signal = AbortSignal.timeout(30_000);
1497
+ const res = await this.#adapter.invoke(url, {
1498
+ method: 'DELETE',
1499
+ signal,
1500
+ telemetry: {
1501
+ name: 'agentuity.task.removeTagFromTask',
1502
+ attributes: { taskId, tagId },
1503
+ },
1504
+ });
1505
+ if (res.ok) {
1506
+ if (res.data?.success === false) {
1507
+ throw new TaskStorageResponseError({
1508
+ status: res.response.status,
1509
+ message: res.data.message ?? 'Operation failed',
1510
+ });
1511
+ }
1512
+ return;
1513
+ }
1514
+ throw await toServiceException('DELETE', url, res.response);
1515
+ }
1516
+ /**
1517
+ * List all tags associated with a specific task.
1518
+ *
1519
+ * @param taskId - The ID of the task
1520
+ * @returns Array of tags on the task
1521
+ * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1522
+ * @throws {@link ServiceException} if the API request fails
1523
+ *
1524
+ * @example
1525
+ * ```typescript
1526
+ * const tags = await tasks.listTagsForTask('task_abc123');
1527
+ * console.log('Tags:', tags.map((t) => t.name).join(', '));
1528
+ * ```
1529
+ */
1530
+ async listTagsForTask(taskId) {
1531
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1532
+ throw new TaskIdRequiredError();
1533
+ }
1534
+ const url = buildUrl(this.#baseUrl, `/task/tags/task/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
1535
+ const signal = AbortSignal.timeout(30_000);
1536
+ const res = await this.#adapter.invoke(url, {
1537
+ method: 'GET',
1538
+ signal,
1539
+ telemetry: {
1540
+ name: 'agentuity.task.listTagsForTask',
1541
+ attributes: { taskId },
1542
+ },
1543
+ });
1544
+ if (res.ok) {
1545
+ if (res.data.success) {
1546
+ return res.data.data;
1547
+ }
1548
+ throw new TaskStorageResponseError({
1549
+ status: res.response.status,
1550
+ message: res.data.message,
1551
+ });
1552
+ }
1553
+ throw await toServiceException('GET', url, res.response);
1554
+ }
1555
+ /**
1556
+ * Initiate a file upload to a task. Returns a presigned S3 URL for direct upload.
1557
+ *
1558
+ * @remarks
1559
+ * After receiving the presigned URL, upload the file content via HTTP PUT to that URL.
1560
+ * Then call {@link TaskStorageService.confirmAttachment | confirmAttachment} to finalize.
1561
+ *
1562
+ * @param taskId - The ID of the task to attach the file to
1563
+ * @param params - Attachment metadata including filename, content type, and size
1564
+ * @returns The created attachment record and a presigned upload URL
1565
+ * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1566
+ * @throws {@link ServiceException} if the API request fails
1567
+ *
1568
+ * @example
1569
+ * ```typescript
1570
+ * const { attachment, presigned_url } = await tasks.uploadAttachment(
1571
+ * 'task_abc123',
1572
+ * { filename: 'report.pdf', content_type: 'application/pdf', size: 102400 },
1573
+ * );
1574
+ *
1575
+ * // Upload the file to S3
1576
+ * await fetch(presigned_url, { method: 'PUT', body: fileContent });
1577
+ *
1578
+ * // Confirm the upload
1579
+ * await tasks.confirmAttachment(attachment.id);
1580
+ * ```
1581
+ */
1582
+ async uploadAttachment(taskId, params) {
1583
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1584
+ throw new TaskIdRequiredError();
1585
+ }
1586
+ const url = buildUrl(this.#baseUrl, `/task/attachments/presign-upload/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
1587
+ const signal = AbortSignal.timeout(30_000);
1588
+ const res = await this.#adapter.invoke(url, {
1589
+ method: 'POST',
1590
+ body: safeStringify(params),
1591
+ contentType: 'application/json',
1592
+ signal,
1593
+ telemetry: {
1594
+ name: 'agentuity.task.uploadAttachment',
1595
+ attributes: { taskId },
1596
+ },
1597
+ });
1598
+ if (res.ok) {
1599
+ if (res.data.success) {
1600
+ return res.data.data;
1601
+ }
1602
+ throw new TaskStorageResponseError({
1603
+ status: res.response.status,
1604
+ message: res.data.message,
1605
+ });
1606
+ }
1607
+ throw await toServiceException('POST', url, res.response);
1608
+ }
1609
+ /**
1610
+ * Confirm that a file upload has completed successfully.
1611
+ *
1612
+ * @remarks
1613
+ * Call this after successfully uploading the file to the presigned URL
1614
+ * returned by {@link TaskStorageService.uploadAttachment | uploadAttachment}.
1615
+ *
1616
+ * @param attachmentId - The unique attachment identifier
1617
+ * @returns The confirmed attachment record
1618
+ * @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
1619
+ * @throws {@link ServiceException} if the API request fails
1620
+ *
1621
+ * @example
1622
+ * ```typescript
1623
+ * const confirmed = await tasks.confirmAttachment('att_ghi789');
1624
+ * console.log('Confirmed:', confirmed.filename);
1625
+ * ```
1626
+ */
1627
+ async confirmAttachment(attachmentId) {
1628
+ if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
1629
+ throw new AttachmentIdRequiredError();
1630
+ }
1631
+ const url = buildUrl(this.#baseUrl, `/task/attachments/confirm/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`);
1632
+ const signal = AbortSignal.timeout(30_000);
1633
+ const res = await this.#adapter.invoke(url, {
1634
+ method: 'POST',
1635
+ signal,
1636
+ telemetry: {
1637
+ name: 'agentuity.task.confirmAttachment',
1638
+ attributes: { attachmentId },
1639
+ },
1640
+ });
1641
+ if (res.ok) {
1642
+ if (res.data.success) {
1643
+ return res.data.data;
1644
+ }
1645
+ throw new TaskStorageResponseError({
1646
+ status: res.response.status,
1647
+ message: res.data.message,
1648
+ });
1649
+ }
1650
+ throw await toServiceException('POST', url, res.response);
1651
+ }
1652
+ /**
1653
+ * Get a presigned S3 URL for downloading an attachment.
1654
+ *
1655
+ * @param attachmentId - The unique attachment identifier
1656
+ * @returns A presigned download URL with expiry information
1657
+ * @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
1658
+ * @throws {@link ServiceException} if the API request fails
1659
+ *
1660
+ * @example
1661
+ * ```typescript
1662
+ * const { presigned_url, expiry_seconds } = await tasks.downloadAttachment('att_ghi789');
1663
+ * console.log(`Download URL (expires in ${expiry_seconds}s):`, presigned_url);
1664
+ * ```
1665
+ */
1666
+ async downloadAttachment(attachmentId) {
1667
+ if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
1668
+ throw new AttachmentIdRequiredError();
1669
+ }
1670
+ const url = buildUrl(this.#baseUrl, `/task/attachments/presign-download/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`);
1671
+ const signal = AbortSignal.timeout(30_000);
1672
+ const res = await this.#adapter.invoke(url, {
1673
+ method: 'POST',
1674
+ signal,
1675
+ telemetry: {
1676
+ name: 'agentuity.task.downloadAttachment',
1677
+ attributes: { attachmentId },
1678
+ },
1679
+ });
1680
+ if (res.ok) {
1681
+ if (res.data.success) {
1682
+ return res.data.data;
1683
+ }
1684
+ throw new TaskStorageResponseError({
1685
+ status: res.response.status,
1686
+ message: res.data.message,
1687
+ });
1688
+ }
1689
+ throw await toServiceException('POST', url, res.response);
1690
+ }
1691
+ /**
1692
+ * List all attachments on a task.
1693
+ *
1694
+ * @param taskId - The ID of the task
1695
+ * @returns List of attachments with total count
1696
+ * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1697
+ * @throws {@link ServiceException} if the API request fails
1698
+ *
1699
+ * @example
1700
+ * ```typescript
1701
+ * const { attachments, total } = await tasks.listAttachments('task_abc123');
1702
+ * for (const att of attachments) {
1703
+ * console.log(`${att.filename} (${att.content_type}, ${att.size} bytes)`);
1704
+ * }
1705
+ * ```
1706
+ */
1707
+ async listAttachments(taskId) {
1708
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1709
+ throw new TaskIdRequiredError();
1710
+ }
1711
+ const url = buildUrl(this.#baseUrl, `/task/attachments/list/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
1712
+ const signal = AbortSignal.timeout(30_000);
1713
+ const res = await this.#adapter.invoke(url, {
1714
+ method: 'GET',
1715
+ signal,
1716
+ telemetry: {
1717
+ name: 'agentuity.task.listAttachments',
1718
+ attributes: { taskId },
1719
+ },
1720
+ });
1721
+ if (res.ok) {
1722
+ if (res.data.success) {
1723
+ return res.data.data;
1724
+ }
1725
+ throw new TaskStorageResponseError({
1726
+ status: res.response.status,
1727
+ message: res.data.message,
1728
+ });
1729
+ }
1730
+ throw await toServiceException('GET', url, res.response);
1731
+ }
1732
+ /**
1733
+ * Delete an attachment permanently.
1734
+ *
1735
+ * @param attachmentId - The unique attachment identifier
1736
+ * @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
1737
+ * @throws {@link ServiceException} if the API request fails
1738
+ *
1739
+ * @example
1740
+ * ```typescript
1741
+ * await tasks.deleteAttachment('att_ghi789');
1742
+ * console.log('Attachment deleted');
1743
+ * ```
1744
+ */
1745
+ async deleteAttachment(attachmentId) {
1746
+ if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
1747
+ throw new AttachmentIdRequiredError();
1748
+ }
1749
+ const url = buildUrl(this.#baseUrl, `/task/attachments/delete/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`);
1750
+ const signal = AbortSignal.timeout(30_000);
1751
+ const res = await this.#adapter.invoke(url, {
1752
+ method: 'DELETE',
1753
+ signal,
1754
+ telemetry: {
1755
+ name: 'agentuity.task.deleteAttachment',
1756
+ attributes: { attachmentId },
1757
+ },
1758
+ });
1759
+ if (res.ok) {
1760
+ if (res.data?.success === false) {
1761
+ throw new TaskStorageResponseError({
1762
+ status: res.response.status,
1763
+ message: res.data.message ?? 'Operation failed',
1764
+ });
1765
+ }
1766
+ return;
1767
+ }
1768
+ throw await toServiceException('DELETE', url, res.response);
1769
+ }
1770
+ /**
1771
+ * List all users who have been referenced in tasks (as creators, assignees, or closers).
1772
+ *
1773
+ * @returns List of user entity references
1774
+ * @throws {@link ServiceException} if the API request fails
1775
+ *
1776
+ * @example
1777
+ * ```typescript
1778
+ * const { users } = await tasks.listUsers();
1779
+ * for (const user of users) {
1780
+ * console.log(`${user.name} (${user.id})`);
1781
+ * }
1782
+ * ```
1783
+ */
1784
+ async listUsers() {
1785
+ const url = buildUrl(this.#baseUrl, `/task/users/${TASK_API_VERSION}`);
1786
+ const signal = AbortSignal.timeout(30_000);
1787
+ const res = await this.#adapter.invoke(url, {
1788
+ method: 'GET',
1789
+ signal,
1790
+ telemetry: {
1791
+ name: 'agentuity.task.listUsers',
1792
+ attributes: {},
1793
+ },
1794
+ });
1795
+ if (res.ok) {
1796
+ if (res.data.success) {
1797
+ return res.data.data;
1798
+ }
1799
+ throw new TaskStorageResponseError({
1800
+ status: res.response.status,
1801
+ message: res.data.message,
1802
+ });
1803
+ }
1804
+ throw await toServiceException('GET', url, res.response);
1805
+ }
1806
+ /**
1807
+ * List all projects that have been referenced in tasks.
1808
+ *
1809
+ * @returns List of project entity references
1810
+ * @throws {@link ServiceException} if the API request fails
1811
+ *
1812
+ * @example
1813
+ * ```typescript
1814
+ * const { projects } = await tasks.listProjects();
1815
+ * for (const project of projects) {
1816
+ * console.log(`${project.name} (${project.id})`);
1817
+ * }
1818
+ * ```
1819
+ */
1820
+ async listProjects() {
1821
+ const url = buildUrl(this.#baseUrl, `/task/projects/${TASK_API_VERSION}`);
1822
+ const signal = AbortSignal.timeout(30_000);
1823
+ const res = await this.#adapter.invoke(url, {
1824
+ method: 'GET',
1825
+ signal,
1826
+ telemetry: {
1827
+ name: 'agentuity.task.listProjects',
1828
+ attributes: {},
1829
+ },
1830
+ });
1831
+ if (res.ok) {
1832
+ if (res.data.success) {
1833
+ return res.data.data;
1834
+ }
1835
+ throw new TaskStorageResponseError({
1836
+ status: res.response.status,
1837
+ message: res.data.message,
1838
+ });
1839
+ }
1840
+ throw await toServiceException('GET', url, res.response);
1841
+ }
1842
+ /**
1843
+ * Get task activity time-series data showing daily task counts by status.
1844
+ *
1845
+ * @param params - Optional parameters controlling the number of days to retrieve
1846
+ * @returns Time-series activity data with daily snapshots
1847
+ * @throws {@link ServiceException} if the API request fails
1848
+ *
1849
+ * @example
1850
+ * ```typescript
1851
+ * const { activity, days } = await tasks.getActivity({ days: 30 });
1852
+ * console.log(`Activity over ${days} days:`);
1853
+ * for (const point of activity) {
1854
+ * console.log(`${point.date}: ${point.open} open, ${point.inProgress} in progress`);
1855
+ * }
1856
+ * ```
1857
+ */
1858
+ async getActivity(params) {
1859
+ const queryParams = new URLSearchParams();
1860
+ if (params?.days !== undefined)
1861
+ queryParams.set('days', String(params.days));
1862
+ const queryString = queryParams.toString();
1863
+ const url = buildUrl(this.#baseUrl, `/task/activity/${TASK_ACTIVITY_API_VERSION}${queryString ? `?${queryString}` : ''}`);
1864
+ const signal = AbortSignal.timeout(30_000);
1865
+ const res = await this.#adapter.invoke(url, {
1866
+ method: 'GET',
1867
+ signal,
1868
+ telemetry: {
1869
+ name: 'agentuity.task.activity',
1870
+ attributes: {
1871
+ ...(params?.days !== undefined ? { days: String(params.days) } : {}),
1872
+ },
1873
+ },
1874
+ });
1875
+ if (res.ok) {
1876
+ if (res.data.success) {
1877
+ return res.data.data;
1878
+ }
1879
+ throw new TaskStorageResponseError({
1880
+ status: res.response.status,
1881
+ message: res.data.message,
1882
+ });
1883
+ }
1884
+ throw await toServiceException('GET', url, res.response);
1885
+ }
1886
+ }
1887
+ //# sourceMappingURL=service.js.map