@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
@@ -1,2611 +0,0 @@
1
- import { FetchAdapter } from './adapter.ts';
2
- import { buildUrl, toServiceException } from './_util.ts';
3
- import { StructuredError } from '../error.ts';
4
- import { safeStringify } from '../json.ts';
5
-
6
- /**
7
- * Priority level for a task, from highest (`'high'`) to no priority (`'none'`).
8
- */
9
- export type TaskPriority = 'high' | 'medium' | 'low' | 'none';
10
-
11
- /**
12
- * The classification of a task.
13
- *
14
- * - `'epic'` — Large initiatives that span multiple features or tasks.
15
- * - `'feature'` — New capabilities to be built.
16
- * - `'enhancement'` — Improvements to existing features.
17
- * - `'bug'` — Defects to be fixed.
18
- * - `'task'` — General work items.
19
- */
20
- export type TaskType = 'epic' | 'feature' | 'enhancement' | 'bug' | 'task';
21
-
22
- /**
23
- * The lifecycle status of a task.
24
- *
25
- * - `'open'` — Created, not yet started.
26
- * - `'in_progress'` — Actively being worked on.
27
- * - `'done'` — Work completed.
28
- * - `'closed'` — Resolved and closed.
29
- * - `'cancelled'` — Abandoned.
30
- */
31
- export type TaskStatus = 'open' | 'in_progress' | 'closed' | 'done' | 'cancelled';
32
-
33
- /**
34
- * A lightweight reference to a user or project entity, containing just the ID
35
- * and display name. Used for creator, assignee, closer, and project associations.
36
- */
37
- export interface EntityRef {
38
- /** Unique identifier of the referenced entity. */
39
- id: string;
40
-
41
- /** Human-readable display name of the entity. */
42
- name: string;
43
- }
44
-
45
- /**
46
- * The type of user entity.
47
- *
48
- * - `'human'` — A human user.
49
- * - `'agent'` — An AI agent.
50
- */
51
- export type UserType = 'human' | 'agent';
52
-
53
- /**
54
- * A reference to a user entity with type discrimination.
55
- * Extends {@link EntityRef} with a {@link UserEntityRef.type | type} field
56
- * to distinguish between human users and AI agents.
57
- */
58
- export interface UserEntityRef extends EntityRef {
59
- /**
60
- * The type of user. Defaults to `'human'` if not specified.
61
- *
62
- * @default 'human'
63
- */
64
- type?: UserType;
65
- }
66
-
67
- /**
68
- * A work item in the task management system.
69
- *
70
- * Tasks can represent epics, features, bugs, enhancements, or generic tasks.
71
- * They support hierarchical organization via {@link Task.parent_id | parent_id},
72
- * assignment tracking, and lifecycle management through status transitions.
73
- *
74
- * @remarks
75
- * Status transitions are tracked automatically — when a task moves to a new status,
76
- * the corresponding date field (e.g., {@link Task.open_date | open_date},
77
- * {@link Task.in_progress_date | in_progress_date}) is set by the server.
78
- */
79
- export interface Task {
80
- /** Unique identifier for the task. */
81
- id: string;
82
-
83
- /** ISO 8601 timestamp when the task was created. */
84
- created_at: string;
85
-
86
- /** ISO 8601 timestamp when the task was last modified. */
87
- updated_at: string;
88
-
89
- /**
90
- * The task title.
91
- *
92
- * @remarks Must be non-empty and at most 1024 characters.
93
- */
94
- title: string;
95
-
96
- /**
97
- * Detailed description of the task.
98
- *
99
- * @remarks Maximum 65,536 characters.
100
- */
101
- description?: string;
102
-
103
- /**
104
- * Arbitrary key-value metadata attached to the task.
105
- * Can be used for custom fields, integrations, or filtering.
106
- */
107
- metadata?: Record<string, unknown>;
108
-
109
- /** The priority level of the task. */
110
- priority: TaskPriority;
111
-
112
- /**
113
- * ID of the parent task, enabling hierarchical task organization
114
- * (e.g., an epic containing features).
115
- */
116
- parent_id?: string;
117
-
118
- /** The classification of this task. */
119
- type: TaskType;
120
-
121
- /** The current lifecycle status of the task. */
122
- status: TaskStatus;
123
-
124
- /** ISO 8601 timestamp when the task was moved to `'open'` status. */
125
- open_date?: string;
126
-
127
- /** ISO 8601 timestamp when the task was moved to `'in_progress'` status. */
128
- in_progress_date?: string;
129
-
130
- /** ISO 8601 timestamp when the task was closed. */
131
- closed_date?: string;
132
-
133
- /**
134
- * ID of the user who created the task.
135
- *
136
- * @remarks Legacy field; prefer {@link Task.creator | creator}.
137
- */
138
- created_id: string;
139
-
140
- /**
141
- * ID of the user the task is assigned to.
142
- *
143
- * @remarks Legacy field; prefer {@link Task.assignee | assignee}.
144
- */
145
- assigned_id?: string;
146
-
147
- /**
148
- * ID of the user who closed the task.
149
- *
150
- * @remarks Legacy field; prefer {@link Task.closer | closer}.
151
- */
152
- closed_id?: string;
153
-
154
- /** Reference to the user who created the task. */
155
- creator?: UserEntityRef;
156
-
157
- /** Reference to the user the task is assigned to. */
158
- assignee?: UserEntityRef;
159
-
160
- /** Reference to the user who closed the task. */
161
- closer?: UserEntityRef;
162
-
163
- /** Reference to the project this task belongs to. */
164
- project?: EntityRef;
165
-
166
- /** ISO 8601 timestamp when the task was cancelled. */
167
- cancelled_date?: string;
168
-
169
- /** Array of tags associated with this task. */
170
- tags?: Tag[];
171
-
172
- /** Array of comments on this task. */
173
- comments?: Comment[];
174
- }
175
-
176
- /**
177
- * A comment on a task, supporting threaded discussion.
178
- */
179
- export interface Comment {
180
- /** Unique identifier for the comment. */
181
- id: string;
182
-
183
- /** ISO 8601 timestamp when the comment was created. */
184
- created_at: string;
185
-
186
- /** ISO 8601 timestamp when the comment was last edited. */
187
- updated_at: string;
188
-
189
- /** ID of the task this comment belongs to. */
190
- task_id: string;
191
-
192
- /** ID of the user who authored the comment. */
193
- user_id: string;
194
-
195
- /** Reference to the comment author with display name. */
196
- author?: UserEntityRef;
197
-
198
- /**
199
- * The comment text content.
200
- *
201
- * @remarks Must be non-empty.
202
- */
203
- body: string;
204
- }
205
-
206
- /**
207
- * A label that can be applied to tasks for categorization and filtering.
208
- */
209
- export interface Tag {
210
- /** Unique identifier for the tag. */
211
- id: string;
212
-
213
- /** ISO 8601 timestamp when the tag was created. */
214
- created_at: string;
215
-
216
- /** Display name of the tag. */
217
- name: string;
218
-
219
- /**
220
- * Optional hex color code for the tag.
221
- *
222
- * @example '#ff0000'
223
- */
224
- color?: string;
225
- }
226
-
227
- /**
228
- * A record of a single field change on a task, providing an audit trail.
229
- */
230
- export interface TaskChangelogEntry {
231
- /** Unique identifier for the changelog entry. */
232
- id: string;
233
-
234
- /** ISO 8601 timestamp when the change occurred. */
235
- created_at: string;
236
-
237
- /** ID of the task that was changed. */
238
- task_id: string;
239
-
240
- /**
241
- * Name of the field that was changed.
242
- *
243
- * @example 'status'
244
- * @example 'priority'
245
- * @example 'assigned_id'
246
- */
247
- field: string;
248
-
249
- /** The previous value of the field (as a string), or `undefined` if the field was newly set. */
250
- old_value?: string;
251
-
252
- /** The new value of the field (as a string), or `undefined` if the field was cleared. */
253
- new_value?: string;
254
- }
255
-
256
- /**
257
- * Parameters for creating a new task.
258
- */
259
- export interface CreateTaskParams {
260
- /**
261
- * The task title (required).
262
- *
263
- * @remarks Must be non-empty and at most 1024 characters.
264
- */
265
- title: string;
266
-
267
- /**
268
- * Detailed description of the task.
269
- *
270
- * @remarks Maximum 65,536 characters.
271
- */
272
- description?: string;
273
-
274
- /** Arbitrary key-value metadata. */
275
- metadata?: Record<string, unknown>;
276
-
277
- /**
278
- * Priority level. Defaults to `'none'` if not provided.
279
- *
280
- * @default 'none'
281
- */
282
- priority?: TaskPriority;
283
-
284
- /** ID of the parent task for hierarchical organization. */
285
- parent_id?: string;
286
-
287
- /** The task classification (required). */
288
- type: TaskType;
289
-
290
- /**
291
- * Initial status. Defaults to `'open'` if not provided.
292
- *
293
- * @default 'open'
294
- */
295
- status?: TaskStatus;
296
-
297
- /**
298
- * ID of the creator.
299
- *
300
- * @remarks Legacy field; prefer {@link CreateTaskParams.creator | creator}.
301
- */
302
- created_id: string;
303
-
304
- /**
305
- * ID of the assigned user.
306
- *
307
- * @remarks Legacy field; prefer {@link CreateTaskParams.assignee | assignee}.
308
- */
309
- assigned_id?: string;
310
-
311
- /** Reference to the user creating the task (id, name, and optional type). */
312
- creator?: UserEntityRef;
313
-
314
- /** Reference to the user being assigned the task. */
315
- assignee?: UserEntityRef;
316
-
317
- /** Reference to the project this task belongs to. */
318
- project?: EntityRef;
319
-
320
- /** Array of tag IDs to associate with the task at creation. */
321
- tag_ids?: string[];
322
- }
323
-
324
- /**
325
- * Parameters for partially updating an existing task.
326
- *
327
- * @remarks Only provided fields are modified; omitted fields remain unchanged.
328
- */
329
- export interface UpdateTaskParams {
330
- /**
331
- * Updated task title.
332
- *
333
- * @remarks Must be non-empty and at most 1024 characters if provided.
334
- */
335
- title?: string;
336
-
337
- /**
338
- * Updated description.
339
- *
340
- * @remarks Maximum 65,536 characters.
341
- */
342
- description?: string;
343
-
344
- /** Updated key-value metadata. */
345
- metadata?: Record<string, unknown>;
346
-
347
- /** Updated priority level. */
348
- priority?: TaskPriority;
349
-
350
- /** Updated parent task ID. */
351
- parent_id?: string;
352
-
353
- /** Updated task classification. */
354
- type?: TaskType;
355
-
356
- /** Updated lifecycle status. */
357
- status?: TaskStatus;
358
-
359
- /**
360
- * Updated assigned user ID.
361
- *
362
- * @remarks Legacy field; prefer {@link UpdateTaskParams.assignee | assignee}.
363
- */
364
- assigned_id?: string;
365
-
366
- /**
367
- * ID of the user closing the task.
368
- *
369
- * @remarks Legacy field; prefer {@link UpdateTaskParams.closer | closer}.
370
- */
371
- closed_id?: string;
372
-
373
- /** Reference to the user being assigned the task. */
374
- assignee?: UserEntityRef;
375
-
376
- /** Reference to the user closing the task. */
377
- closer?: UserEntityRef;
378
-
379
- /** Reference to the project this task belongs to. */
380
- project?: EntityRef;
381
- }
382
-
383
- /**
384
- * Parameters for filtering and paginating the task list.
385
- */
386
- export interface ListTasksParams {
387
- /** Filter by task status. */
388
- status?: TaskStatus;
389
-
390
- /** Filter by task type. */
391
- type?: TaskType;
392
-
393
- /** Filter by priority level. */
394
- priority?: TaskPriority;
395
-
396
- /** Filter by assigned user ID. */
397
- assigned_id?: string;
398
-
399
- /** Filter by parent task ID (get subtasks). */
400
- parent_id?: string;
401
-
402
- /** Filter by project ID. */
403
- project_id?: string;
404
-
405
- /** Filter by tag ID. */
406
- tag_id?: string;
407
-
408
- /**
409
- * Filter for soft-deleted tasks.
410
- *
411
- * @default false
412
- */
413
- deleted?: boolean;
414
-
415
- /**
416
- * Sort field. Prefix with `-` for descending order.
417
- *
418
- * @remarks Supported values: `'created_at'`, `'updated_at'`, `'priority'`.
419
- * Prefix with `-` for descending (e.g., `'-created_at'`).
420
- */
421
- sort?: string;
422
-
423
- /** Sort direction: `'asc'` or `'desc'`. */
424
- order?: 'asc' | 'desc';
425
-
426
- /** Maximum number of results to return. */
427
- limit?: number;
428
-
429
- /** Number of results to skip for pagination. */
430
- offset?: number;
431
- }
432
-
433
- /**
434
- * Paginated list of tasks with total count.
435
- */
436
- export interface ListTasksResult {
437
- /** Array of tasks matching the query. */
438
- tasks: Task[];
439
-
440
- /** Total number of tasks matching the filters (before pagination). */
441
- total: number;
442
-
443
- /** The limit that was applied. */
444
- limit: number;
445
-
446
- /** The offset that was applied. */
447
- offset: number;
448
- }
449
-
450
- /**
451
- * Parameters for batch-deleting tasks by filter.
452
- * At least one filter must be provided.
453
- */
454
- export interface BatchDeleteTasksParams {
455
- /** Filter by task status. */
456
- status?: TaskStatus;
457
-
458
- /** Filter by task type. */
459
- type?: TaskType;
460
-
461
- /** Filter by priority level. */
462
- priority?: TaskPriority;
463
-
464
- /** Filter by parent task ID (delete subtasks). */
465
- parent_id?: string;
466
-
467
- /** Filter by creator ID. */
468
- created_id?: string;
469
-
470
- /**
471
- * Delete tasks older than this duration.
472
- * Accepts Go-style duration strings: `'30m'`, `'24h'`, `'7d'`, `'2w'`.
473
- */
474
- older_than?: string;
475
-
476
- /**
477
- * Maximum number of tasks to delete.
478
- * @default 50
479
- * @maximum 200
480
- */
481
- limit?: number;
482
- }
483
-
484
- /**
485
- * A single task that was deleted in a batch operation.
486
- */
487
- export interface BatchDeletedTask {
488
- /** The ID of the deleted task. */
489
- id: string;
490
-
491
- /** The title of the deleted task. */
492
- title: string;
493
- }
494
-
495
- /**
496
- * Result of a batch delete operation.
497
- */
498
- export interface BatchDeleteTasksResult {
499
- /** Array of tasks that were deleted. */
500
- deleted: BatchDeletedTask[];
501
-
502
- /** Total number of tasks deleted. */
503
- count: number;
504
- }
505
-
506
- /**
507
- * Paginated list of changelog entries for a task.
508
- */
509
- export interface TaskChangelogResult {
510
- /** Array of change records. */
511
- changelog: TaskChangelogEntry[];
512
-
513
- /** Total number of changelog entries. */
514
- total: number;
515
-
516
- /** Applied limit. */
517
- limit: number;
518
-
519
- /** Applied offset. */
520
- offset: number;
521
- }
522
-
523
- /**
524
- * Paginated list of comments on a task.
525
- */
526
- export interface ListCommentsResult {
527
- /** Array of comments. */
528
- comments: Comment[];
529
-
530
- /** Total number of comments. */
531
- total: number;
532
-
533
- /** Applied limit. */
534
- limit: number;
535
-
536
- /** Applied offset. */
537
- offset: number;
538
- }
539
-
540
- /**
541
- * List of all tags in the organization.
542
- */
543
- export interface ListTagsResult {
544
- /** Array of tags. */
545
- tags: Tag[];
546
- }
547
-
548
- /**
549
- * A file attachment on a task. Attachments are stored in S3 and accessed via presigned URLs.
550
- */
551
- export interface Attachment {
552
- /** Unique identifier for the attachment. */
553
- id: string;
554
-
555
- /** ISO 8601 timestamp when the attachment was uploaded. */
556
- created_at: string;
557
-
558
- /** ID of the task this attachment belongs to. */
559
- task_id: string;
560
-
561
- /** ID of the user who uploaded the attachment. */
562
- user_id: string;
563
-
564
- /** Reference to the uploader with display name. */
565
- author?: UserEntityRef;
566
-
567
- /** Original filename of the uploaded file. */
568
- filename: string;
569
-
570
- /**
571
- * MIME type of the file.
572
- *
573
- * @example 'application/pdf'
574
- */
575
- content_type?: string;
576
-
577
- /** File size in bytes. */
578
- size?: number;
579
- }
580
-
581
- /**
582
- * Parameters for initiating a file upload to a task.
583
- */
584
- export interface CreateAttachmentParams {
585
- /** The filename for the attachment (required). */
586
- filename: string;
587
-
588
- /** MIME type of the file. */
589
- content_type?: string;
590
-
591
- /** File size in bytes. */
592
- size?: number;
593
- }
594
-
595
- /**
596
- * Response from initiating an attachment upload. Contains a presigned S3 URL for direct upload.
597
- */
598
- export interface PresignUploadResponse {
599
- /** The created attachment record. */
600
- attachment: Attachment;
601
-
602
- /** A presigned S3 URL to upload the file content via HTTP PUT. */
603
- presigned_url: string;
604
-
605
- /** Number of seconds until the presigned URL expires. */
606
- expiry_seconds: number;
607
- }
608
-
609
- /**
610
- * Response containing a presigned S3 URL for downloading an attachment.
611
- */
612
- export interface PresignDownloadResponse {
613
- /** A presigned S3 URL to download the file via HTTP GET. */
614
- presigned_url: string;
615
-
616
- /** Number of seconds until the presigned URL expires. */
617
- expiry_seconds: number;
618
- }
619
-
620
- /**
621
- * List of attachments on a task.
622
- */
623
- export interface ListAttachmentsResult {
624
- /** Array of attachment records. */
625
- attachments: Attachment[];
626
-
627
- /** Total number of attachments. */
628
- total: number;
629
- }
630
-
631
- /**
632
- * List of all users who have been referenced in tasks (as creators, assignees, or closers).
633
- */
634
- export interface ListUsersResult {
635
- /** Array of user entity references with type information. */
636
- users: UserEntityRef[];
637
- }
638
-
639
- /**
640
- * List of all projects that have been referenced in tasks.
641
- */
642
- export interface ListProjectsResult {
643
- /** Array of project entity references. */
644
- projects: EntityRef[];
645
- }
646
-
647
- /**
648
- * Parameters for querying task activity time-series data.
649
- */
650
- export interface TaskActivityParams {
651
- /**
652
- * Number of days of activity to retrieve.
653
- *
654
- * @remarks Minimum 7, maximum 365.
655
- * @default 90
656
- */
657
- days?: number;
658
- }
659
-
660
- /**
661
- * A single day's snapshot of task counts by status.
662
- */
663
- export interface TaskActivityDataPoint {
664
- /**
665
- * The date in `YYYY-MM-DD` format.
666
- *
667
- * @example '2026-02-28'
668
- */
669
- date: string;
670
-
671
- /** Number of tasks in `'open'` status on this date. */
672
- open: number;
673
-
674
- /** Number of tasks in `'in_progress'` status on this date. */
675
- inProgress: number;
676
-
677
- /** Number of tasks in `'done'` status on this date. */
678
- done: number;
679
-
680
- /** Number of tasks in `'closed'` status on this date. */
681
- closed: number;
682
-
683
- /** Number of tasks in `'cancelled'` status on this date. */
684
- cancelled: number;
685
- }
686
-
687
- /**
688
- * Task activity time-series data.
689
- */
690
- export interface TaskActivityResult {
691
- /** Array of daily activity snapshots, ordered chronologically. */
692
- activity: TaskActivityDataPoint[];
693
-
694
- /** The number of days of data returned. */
695
- days: number;
696
- }
697
-
698
- /**
699
- * Interface defining the contract for task storage operations.
700
- *
701
- * Implemented by {@link TaskStorageService}.
702
- */
703
- export interface TaskStorage {
704
- /**
705
- * Create a new task.
706
- *
707
- * @param params - The task creation parameters
708
- * @returns The newly created task
709
- */
710
- create(params: CreateTaskParams): Promise<Task>;
711
-
712
- /**
713
- * Get a task by its ID.
714
- *
715
- * @param id - The unique task identifier
716
- * @returns The task if found, or `null` if not found
717
- */
718
- get(id: string): Promise<Task | null>;
719
-
720
- /**
721
- * List tasks with optional filtering and pagination.
722
- *
723
- * @param params - Optional filter and pagination parameters
724
- * @returns Paginated list of matching tasks
725
- */
726
- list(params?: ListTasksParams): Promise<ListTasksResult>;
727
-
728
- /**
729
- * Partially update an existing task.
730
- *
731
- * @param id - The unique task identifier
732
- * @param params - Fields to update (only provided fields are changed)
733
- * @returns The updated task
734
- */
735
- update(id: string, params: UpdateTaskParams): Promise<Task>;
736
-
737
- /**
738
- * Close a task by setting its status to closed.
739
- *
740
- * @param id - The unique task identifier
741
- * @returns The closed task
742
- */
743
- close(id: string): Promise<Task>;
744
-
745
- /**
746
- * Soft-delete a task, marking it as deleted without permanent removal.
747
- *
748
- * @param id - The unique task identifier
749
- * @returns The soft-deleted task
750
- */
751
- softDelete(id: string): Promise<Task>;
752
-
753
- /**
754
- * Batch soft-delete tasks matching the given filters.
755
- * At least one filter must be provided.
756
- *
757
- * @param params - Filters to select which tasks to delete
758
- * @returns The list of deleted tasks and count
759
- */
760
- batchDelete(params: BatchDeleteTasksParams): Promise<BatchDeleteTasksResult>;
761
-
762
- /**
763
- * Get the changelog (audit trail) for a task.
764
- *
765
- * @param id - The unique task identifier
766
- * @param params - Optional pagination parameters
767
- * @returns Paginated list of changelog entries
768
- */
769
- changelog(
770
- id: string,
771
- params?: { limit?: number; offset?: number }
772
- ): Promise<TaskChangelogResult>;
773
-
774
- /**
775
- * Create a comment on a task.
776
- *
777
- * @param taskId - The ID of the task to comment on
778
- * @param body - The comment text content
779
- * @param userId - The ID of the user authoring the comment
780
- * @param author - Optional entity reference with display name
781
- * @returns The newly created comment
782
- */
783
- createComment(
784
- taskId: string,
785
- body: string,
786
- userId: string,
787
- author?: EntityRef
788
- ): Promise<Comment>;
789
-
790
- /**
791
- * Get a comment by its ID.
792
- *
793
- * @param commentId - The unique comment identifier
794
- * @returns The comment
795
- */
796
- getComment(commentId: string): Promise<Comment>;
797
-
798
- /**
799
- * Update a comment's body text.
800
- *
801
- * @param commentId - The unique comment identifier
802
- * @param body - The new comment text
803
- * @returns The updated comment
804
- */
805
- updateComment(commentId: string, body: string): Promise<Comment>;
806
-
807
- /**
808
- * Delete a comment.
809
- *
810
- * @param commentId - The unique comment identifier
811
- */
812
- deleteComment(commentId: string): Promise<void>;
813
-
814
- /**
815
- * List comments on a task with optional pagination.
816
- *
817
- * @param taskId - The ID of the task
818
- * @param params - Optional pagination parameters
819
- * @returns Paginated list of comments
820
- */
821
- listComments(
822
- taskId: string,
823
- params?: { limit?: number; offset?: number }
824
- ): Promise<ListCommentsResult>;
825
-
826
- /**
827
- * Create a new tag.
828
- *
829
- * @param name - The tag display name
830
- * @param color - Optional hex color code (e.g., `'#ff0000'`)
831
- * @returns The newly created tag
832
- */
833
- createTag(name: string, color?: string): Promise<Tag>;
834
-
835
- /**
836
- * Get a tag by its ID.
837
- *
838
- * @param tagId - The unique tag identifier
839
- * @returns The tag
840
- */
841
- getTag(tagId: string): Promise<Tag>;
842
-
843
- /**
844
- * Update a tag's name and optionally its color.
845
- *
846
- * @param tagId - The unique tag identifier
847
- * @param name - The new tag name
848
- * @param color - Optional new hex color code
849
- * @returns The updated tag
850
- */
851
- updateTag(tagId: string, name: string, color?: string): Promise<Tag>;
852
-
853
- /**
854
- * Delete a tag.
855
- *
856
- * @param tagId - The unique tag identifier
857
- */
858
- deleteTag(tagId: string): Promise<void>;
859
-
860
- /**
861
- * List all tags in the organization.
862
- *
863
- * @returns List of all tags
864
- */
865
- listTags(): Promise<ListTagsResult>;
866
-
867
- /**
868
- * Associate a tag with a task.
869
- *
870
- * @param taskId - The ID of the task
871
- * @param tagId - The ID of the tag to add
872
- */
873
- addTagToTask(taskId: string, tagId: string): Promise<void>;
874
-
875
- /**
876
- * Remove a tag association from a task.
877
- *
878
- * @param taskId - The ID of the task
879
- * @param tagId - The ID of the tag to remove
880
- */
881
- removeTagFromTask(taskId: string, tagId: string): Promise<void>;
882
-
883
- /**
884
- * List all tags associated with a specific task.
885
- *
886
- * @param taskId - The ID of the task
887
- * @returns Array of tags on the task
888
- */
889
- listTagsForTask(taskId: string): Promise<Tag[]>;
890
-
891
- /**
892
- * Initiate a file upload to a task. Returns a presigned S3 URL for direct upload.
893
- *
894
- * @param taskId - The ID of the task to attach the file to
895
- * @param params - Attachment metadata (filename, content type, size)
896
- * @returns The attachment record and a presigned upload URL
897
- */
898
- uploadAttachment(taskId: string, params: CreateAttachmentParams): Promise<PresignUploadResponse>;
899
-
900
- /**
901
- * Confirm that a file upload has completed successfully.
902
- *
903
- * @param attachmentId - The unique attachment identifier
904
- * @returns The confirmed attachment record
905
- */
906
- confirmAttachment(attachmentId: string): Promise<Attachment>;
907
-
908
- /**
909
- * Get a presigned S3 URL for downloading an attachment.
910
- *
911
- * @param attachmentId - The unique attachment identifier
912
- * @returns A presigned download URL
913
- */
914
- downloadAttachment(attachmentId: string): Promise<PresignDownloadResponse>;
915
-
916
- /**
917
- * List all attachments on a task.
918
- *
919
- * @param taskId - The ID of the task
920
- * @returns List of attachments with total count
921
- */
922
- listAttachments(taskId: string): Promise<ListAttachmentsResult>;
923
-
924
- /**
925
- * Delete an attachment.
926
- *
927
- * @param attachmentId - The unique attachment identifier
928
- */
929
- deleteAttachment(attachmentId: string): Promise<void>;
930
-
931
- /**
932
- * List all users who have been referenced in tasks.
933
- *
934
- * @returns List of user entity references
935
- */
936
- listUsers(): Promise<ListUsersResult>;
937
-
938
- /**
939
- * List all projects that have been referenced in tasks.
940
- *
941
- * @returns List of project entity references
942
- */
943
- listProjects(): Promise<ListProjectsResult>;
944
-
945
- /**
946
- * Get task activity time-series data showing daily status counts.
947
- *
948
- * @param params - Optional parameters controlling the number of days to retrieve
949
- * @returns Time-series activity data
950
- */
951
- getActivity(params?: TaskActivityParams): Promise<TaskActivityResult>;
952
- }
953
-
954
- /** API version string used for task CRUD, comment, tag, and attachment endpoints. */
955
- const TASK_API_VERSION = '2026-02-24';
956
-
957
- /** Maximum number of tasks that can be deleted in a single batch request. */
958
- const MAX_BATCH_DELETE_LIMIT = 200;
959
-
960
- /** API version string used for the task activity analytics endpoint. */
961
- const TASK_ACTIVITY_API_VERSION = '2026-02-28';
962
-
963
- /** Thrown when a task ID parameter is empty or not a string. */
964
- const TaskIdRequiredError = StructuredError(
965
- 'TaskIdRequiredError',
966
- 'Task ID is required and must be a non-empty string'
967
- );
968
-
969
- /** Thrown when a task title is empty or not a string. */
970
- const TaskTitleRequiredError = StructuredError(
971
- 'TaskTitleRequiredError',
972
- 'Task title is required and must be a non-empty string'
973
- );
974
-
975
- /** Thrown when a comment ID parameter is empty or not a string. */
976
- const CommentIdRequiredError = StructuredError(
977
- 'CommentIdRequiredError',
978
- 'Comment ID is required and must be a non-empty string'
979
- );
980
-
981
- /** Thrown when a comment body is empty or not a string. */
982
- const CommentBodyRequiredError = StructuredError(
983
- 'CommentBodyRequiredError',
984
- 'Comment body is required and must be a non-empty string'
985
- );
986
-
987
- /** Thrown when a tag ID parameter is empty or not a string. */
988
- const TagIdRequiredError = StructuredError(
989
- 'TagIdRequiredError',
990
- 'Tag ID is required and must be a non-empty string'
991
- );
992
-
993
- /** Thrown when a tag name is empty or not a string. */
994
- const TagNameRequiredError = StructuredError(
995
- 'TagNameRequiredError',
996
- 'Tag name is required and must be a non-empty string'
997
- );
998
-
999
- /** Thrown when an attachment ID parameter is empty or not a string. */
1000
- const AttachmentIdRequiredError = StructuredError(
1001
- 'AttachmentIdRequiredError',
1002
- 'Attachment ID is required and must be a non-empty string'
1003
- );
1004
-
1005
- /** Thrown when a user ID parameter is empty or not a string. */
1006
- const UserIdRequiredError = StructuredError(
1007
- 'UserIdRequiredError',
1008
- 'User ID is required and must be a non-empty string'
1009
- );
1010
-
1011
- /**
1012
- * Thrown when the API returns a success HTTP status but the response body indicates failure.
1013
- */
1014
- const TaskStorageResponseError = StructuredError('TaskStorageResponseError')<{
1015
- status: number;
1016
- }>();
1017
-
1018
- /**
1019
- * Internal API success response envelope for task operations.
1020
- */
1021
- interface TaskSuccessResponse<T> {
1022
- success: true;
1023
- data: T;
1024
- }
1025
-
1026
- /**
1027
- * Internal API error response envelope for task operations.
1028
- */
1029
- interface TaskErrorResponse {
1030
- success: false;
1031
- message: string;
1032
- }
1033
-
1034
- /**
1035
- * Discriminated union of API success and error responses for task operations.
1036
- */
1037
- type TaskResponse<T> = TaskSuccessResponse<T> | TaskErrorResponse;
1038
-
1039
- /**
1040
- * Client for the Agentuity Task management service.
1041
- *
1042
- * Provides a full-featured project management API including task CRUD, hierarchical
1043
- * organization (epics → features → tasks), comments, tags, file attachments via
1044
- * presigned S3 URLs, changelog tracking, and activity analytics.
1045
- *
1046
- * Tasks support lifecycle management through status transitions (`open` → `in_progress`
1047
- * → `done`/`closed`/`cancelled`) with automatic date tracking for each transition.
1048
- *
1049
- * All methods validate inputs client-side and throw structured errors for invalid
1050
- * parameters. API errors throw {@link ServiceException}.
1051
- *
1052
- * @example
1053
- * ```typescript
1054
- * const tasks = new TaskStorageService(baseUrl, adapter);
1055
- *
1056
- * // Create a task
1057
- * const task = await tasks.create({
1058
- * title: 'Implement login flow',
1059
- * type: 'feature',
1060
- * created_id: 'user_123',
1061
- * creator: { id: 'user_123', name: 'Alice' },
1062
- * priority: 'high',
1063
- * });
1064
- *
1065
- * // Add a comment
1066
- * await tasks.createComment(task.id, 'Started working on this', 'user_123');
1067
- *
1068
- * // List open tasks
1069
- * const { tasks: openTasks } = await tasks.list({ status: 'open' });
1070
- * ```
1071
- */
1072
- export class TaskStorageService implements TaskStorage {
1073
- #adapter: FetchAdapter;
1074
- #baseUrl: string;
1075
-
1076
- /**
1077
- * Creates a new TaskStorageService instance.
1078
- *
1079
- * @param baseUrl - The base URL of the task management API
1080
- * @param adapter - The HTTP fetch adapter used for making API requests
1081
- */
1082
- constructor(baseUrl: string, adapter: FetchAdapter) {
1083
- this.#adapter = adapter;
1084
- this.#baseUrl = baseUrl;
1085
- }
1086
-
1087
- /**
1088
- * Create a new task.
1089
- *
1090
- * @param params - The task creation parameters including title, type, and optional fields
1091
- * @returns The newly created task
1092
- * @throws {@link TaskTitleRequiredError} if the title is empty or not a string
1093
- * @throws {@link ServiceException} if the API request fails
1094
- *
1095
- * @example
1096
- * ```typescript
1097
- * const task = await tasks.create({
1098
- * title: 'Fix login bug',
1099
- * type: 'bug',
1100
- * created_id: 'user_123',
1101
- * priority: 'high',
1102
- * creator: { id: 'user_123', name: 'Alice' },
1103
- * project: { id: 'proj_456', name: 'Auth Service' },
1104
- * });
1105
- * console.log('Created:', task.id);
1106
- * ```
1107
- */
1108
- async create(params: CreateTaskParams): Promise<Task> {
1109
- if (!params?.title || typeof params.title !== 'string' || params.title.trim().length === 0) {
1110
- throw new TaskTitleRequiredError();
1111
- }
1112
-
1113
- const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}`);
1114
- const signal = AbortSignal.timeout(30_000);
1115
-
1116
- const res = await this.#adapter.invoke<TaskResponse<Task>>(url, {
1117
- method: 'POST',
1118
- body: safeStringify(params),
1119
- contentType: 'application/json',
1120
- signal,
1121
- telemetry: {
1122
- name: 'agentuity.task.create',
1123
- attributes: {
1124
- type: params.type,
1125
- priority: params.priority ?? 'none',
1126
- status: params.status ?? 'open',
1127
- },
1128
- },
1129
- });
1130
-
1131
- if (res.ok) {
1132
- if (res.data.success) {
1133
- return res.data.data;
1134
- }
1135
- throw new TaskStorageResponseError({
1136
- status: res.response.status,
1137
- message: res.data.message,
1138
- });
1139
- }
1140
-
1141
- throw await toServiceException('POST', url, res.response);
1142
- }
1143
-
1144
- /**
1145
- * Get a task by its ID.
1146
- *
1147
- * @param id - The unique task identifier
1148
- * @returns The task if found, or `null` if the task does not exist
1149
- * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
1150
- * @throws {@link ServiceException} if the API request fails
1151
- *
1152
- * @example
1153
- * ```typescript
1154
- * const task = await tasks.get('task_abc123');
1155
- * if (task) {
1156
- * console.log(task.title, task.status);
1157
- * } else {
1158
- * console.log('Task not found');
1159
- * }
1160
- * ```
1161
- */
1162
- async get(id: string): Promise<Task | null> {
1163
- if (!id || typeof id !== 'string' || id.trim().length === 0) {
1164
- throw new TaskIdRequiredError();
1165
- }
1166
-
1167
- const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
1168
- const signal = AbortSignal.timeout(30_000);
1169
-
1170
- const res = await this.#adapter.invoke<TaskResponse<Task>>(url, {
1171
- method: 'GET',
1172
- signal,
1173
- telemetry: {
1174
- name: 'agentuity.task.get',
1175
- attributes: { id },
1176
- },
1177
- });
1178
-
1179
- if (res.response.status === 404) {
1180
- return null;
1181
- }
1182
-
1183
- if (res.ok) {
1184
- if (res.data.success) {
1185
- return res.data.data;
1186
- }
1187
- throw new TaskStorageResponseError({
1188
- status: res.response.status,
1189
- message: res.data.message,
1190
- });
1191
- }
1192
-
1193
- throw await toServiceException('GET', url, res.response);
1194
- }
1195
-
1196
- /**
1197
- * List tasks with optional filtering and pagination.
1198
- *
1199
- * @param params - Optional filter and pagination parameters
1200
- * @returns Paginated list of tasks matching the filters
1201
- * @throws {@link ServiceException} if the API request fails
1202
- *
1203
- * @example
1204
- * ```typescript
1205
- * // List all open high-priority bugs
1206
- * const result = await tasks.list({
1207
- * status: 'open',
1208
- * type: 'bug',
1209
- * priority: 'high',
1210
- * sort: '-created_at',
1211
- * limit: 20,
1212
- * });
1213
- * console.log(`Found ${result.total} bugs, showing ${result.tasks.length}`);
1214
- * ```
1215
- */
1216
- async list(params?: ListTasksParams): Promise<ListTasksResult> {
1217
- const queryParams = new URLSearchParams();
1218
- if (params?.status) queryParams.set('status', params.status);
1219
- if (params?.type) queryParams.set('type', params.type);
1220
- if (params?.priority) queryParams.set('priority', params.priority);
1221
- if (params?.assigned_id) queryParams.set('assigned_id', params.assigned_id);
1222
- if (params?.parent_id) queryParams.set('parent_id', params.parent_id);
1223
- if (params?.project_id) queryParams.set('project_id', params.project_id);
1224
- if (params?.tag_id) queryParams.set('tag_id', params.tag_id);
1225
- if (params?.deleted !== undefined) queryParams.set('deleted', String(params.deleted));
1226
- if (params?.sort) queryParams.set('sort', params.sort);
1227
- if (params?.order) queryParams.set('order', params.order);
1228
- if (params?.limit !== undefined) queryParams.set('limit', String(params.limit));
1229
- if (params?.offset !== undefined) queryParams.set('offset', String(params.offset));
1230
-
1231
- const queryString = queryParams.toString();
1232
- const url = buildUrl(
1233
- this.#baseUrl,
1234
- `/task/${TASK_API_VERSION}${queryString ? `?${queryString}` : ''}`
1235
- );
1236
- const signal = AbortSignal.timeout(30_000);
1237
-
1238
- const res = await this.#adapter.invoke<TaskResponse<ListTasksResult>>(url, {
1239
- method: 'GET',
1240
- signal,
1241
- telemetry: {
1242
- name: 'agentuity.task.list',
1243
- attributes: {
1244
- ...(params?.status ? { status: params.status } : {}),
1245
- ...(params?.type ? { type: params.type } : {}),
1246
- ...(params?.priority ? { priority: params.priority } : {}),
1247
- },
1248
- },
1249
- });
1250
-
1251
- if (res.ok) {
1252
- if (res.data.success) {
1253
- return res.data.data;
1254
- }
1255
- throw new TaskStorageResponseError({
1256
- status: res.response.status,
1257
- message: res.data.message,
1258
- });
1259
- }
1260
-
1261
- throw await toServiceException('GET', url, res.response);
1262
- }
1263
-
1264
- /**
1265
- * Partially update an existing task.
1266
- *
1267
- * @param id - The unique task identifier
1268
- * @param params - Fields to update; only provided fields are changed
1269
- * @returns The updated task
1270
- * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
1271
- * @throws {@link TaskTitleRequiredError} if a title is provided but is empty
1272
- * @throws {@link ServiceException} if the API request fails
1273
- *
1274
- * @example
1275
- * ```typescript
1276
- * const updated = await tasks.update('task_abc123', {
1277
- * status: 'in_progress',
1278
- * priority: 'high',
1279
- * assignee: { id: 'user_456', name: 'Bob' },
1280
- * });
1281
- * console.log('Updated status:', updated.status);
1282
- * ```
1283
- */
1284
- async update(id: string, params: UpdateTaskParams): Promise<Task> {
1285
- if (!id || typeof id !== 'string' || id.trim().length === 0) {
1286
- throw new TaskIdRequiredError();
1287
- }
1288
- if (
1289
- params.title !== undefined &&
1290
- (typeof params.title !== 'string' || params.title.trim().length === 0)
1291
- ) {
1292
- throw new TaskTitleRequiredError();
1293
- }
1294
-
1295
- const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
1296
- const signal = AbortSignal.timeout(30_000);
1297
-
1298
- const res = await this.#adapter.invoke<TaskResponse<Task>>(url, {
1299
- method: 'PATCH',
1300
- body: safeStringify(params),
1301
- contentType: 'application/json',
1302
- signal,
1303
- telemetry: {
1304
- name: 'agentuity.task.update',
1305
- attributes: { id },
1306
- },
1307
- });
1308
-
1309
- if (res.ok) {
1310
- if (res.data.success) {
1311
- return res.data.data;
1312
- }
1313
- throw new TaskStorageResponseError({
1314
- status: res.response.status,
1315
- message: res.data.message,
1316
- });
1317
- }
1318
-
1319
- throw await toServiceException('PATCH', url, res.response);
1320
- }
1321
-
1322
- /**
1323
- * Close a task by setting its status to closed.
1324
- *
1325
- * @param id - The unique task identifier
1326
- * @returns The closed task with updated `closed_date`
1327
- * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
1328
- * @throws {@link ServiceException} if the API request fails
1329
- *
1330
- * @example
1331
- * ```typescript
1332
- * const closed = await tasks.close('task_abc123');
1333
- * console.log('Closed at:', closed.closed_date);
1334
- * ```
1335
- */
1336
- async close(id: string): Promise<Task> {
1337
- if (!id || typeof id !== 'string' || id.trim().length === 0) {
1338
- throw new TaskIdRequiredError();
1339
- }
1340
-
1341
- const url = buildUrl(this.#baseUrl, `/task/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
1342
- const signal = AbortSignal.timeout(30_000);
1343
-
1344
- const res = await this.#adapter.invoke<TaskResponse<Task>>(url, {
1345
- method: 'DELETE',
1346
- signal,
1347
- telemetry: {
1348
- name: 'agentuity.task.close',
1349
- attributes: { id },
1350
- },
1351
- });
1352
-
1353
- if (res.ok) {
1354
- if (res.data.success) {
1355
- return res.data.data;
1356
- }
1357
- throw new TaskStorageResponseError({
1358
- status: res.response.status,
1359
- message: res.data.message,
1360
- });
1361
- }
1362
-
1363
- throw await toServiceException('DELETE', url, res.response);
1364
- }
1365
-
1366
- /**
1367
- * Get the changelog (audit trail) for a task, showing all field changes over time.
1368
- *
1369
- * @param id - The unique task identifier
1370
- * @param params - Optional pagination parameters
1371
- * @returns Paginated list of changelog entries ordered by most recent first
1372
- * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
1373
- * @throws {@link ServiceException} if the API request fails
1374
- *
1375
- * @example
1376
- * ```typescript
1377
- * const { changelog, total } = await tasks.changelog('task_abc123', {
1378
- * limit: 10,
1379
- * offset: 0,
1380
- * });
1381
- * for (const entry of changelog) {
1382
- * console.log(`${entry.field}: ${entry.old_value} → ${entry.new_value}`);
1383
- * }
1384
- * ```
1385
- */
1386
- async changelog(
1387
- id: string,
1388
- params?: { limit?: number; offset?: number }
1389
- ): Promise<TaskChangelogResult> {
1390
- if (!id || typeof id !== 'string' || id.trim().length === 0) {
1391
- throw new TaskIdRequiredError();
1392
- }
1393
-
1394
- const queryParams = new URLSearchParams();
1395
- if (params?.limit !== undefined) queryParams.set('limit', String(params.limit));
1396
- if (params?.offset !== undefined) queryParams.set('offset', String(params.offset));
1397
- const queryString = queryParams.toString();
1398
-
1399
- const url = buildUrl(
1400
- this.#baseUrl,
1401
- `/task/changelog/${TASK_API_VERSION}/${encodeURIComponent(id)}${
1402
- queryString ? `?${queryString}` : ''
1403
- }`
1404
- );
1405
- const signal = AbortSignal.timeout(30_000);
1406
-
1407
- const res = await this.#adapter.invoke<TaskResponse<TaskChangelogResult>>(url, {
1408
- method: 'GET',
1409
- signal,
1410
- telemetry: {
1411
- name: 'agentuity.task.changelog',
1412
- attributes: { id },
1413
- },
1414
- });
1415
-
1416
- if (res.ok) {
1417
- if (res.data.success) {
1418
- return res.data.data;
1419
- }
1420
- throw new TaskStorageResponseError({
1421
- status: res.response.status,
1422
- message: res.data.message,
1423
- });
1424
- }
1425
-
1426
- throw await toServiceException('GET', url, res.response);
1427
- }
1428
-
1429
- /**
1430
- * Soft-delete a task, marking it as deleted without permanent removal.
1431
- *
1432
- * @param id - The unique task identifier
1433
- * @returns The soft-deleted task
1434
- * @throws {@link TaskIdRequiredError} if the ID is empty or not a string
1435
- * @throws {@link ServiceException} if the API request fails
1436
- *
1437
- * @example
1438
- * ```typescript
1439
- * const deleted = await tasks.softDelete('task_abc123');
1440
- * console.log('Soft-deleted task:', deleted.id);
1441
- * ```
1442
- */
1443
- async softDelete(id: string): Promise<Task> {
1444
- if (!id || typeof id !== 'string' || id.trim().length === 0) {
1445
- throw new TaskIdRequiredError();
1446
- }
1447
-
1448
- const url = buildUrl(
1449
- this.#baseUrl,
1450
- `/task/delete/${TASK_API_VERSION}/${encodeURIComponent(id)}`
1451
- );
1452
- const signal = AbortSignal.timeout(30_000);
1453
-
1454
- const res = await this.#adapter.invoke<TaskResponse<Task>>(url, {
1455
- method: 'POST',
1456
- signal,
1457
- telemetry: {
1458
- name: 'agentuity.task.softDelete',
1459
- attributes: { id },
1460
- },
1461
- });
1462
-
1463
- if (res.ok) {
1464
- if (res.data.success) {
1465
- return res.data.data;
1466
- }
1467
- throw new TaskStorageResponseError({
1468
- status: res.response.status,
1469
- message: res.data.message,
1470
- });
1471
- }
1472
-
1473
- throw await toServiceException('POST', url, res.response);
1474
- }
1475
-
1476
- /**
1477
- * Batch soft-delete tasks matching the given filters.
1478
- * At least one filter must be provided. The server caps the limit at 200.
1479
- *
1480
- * @param params - Filters to select which tasks to delete
1481
- * @returns The list of deleted tasks and count
1482
- * @throws {@link ServiceException} if the API request fails
1483
- *
1484
- * @example
1485
- * ```typescript
1486
- * const result = await tasks.batchDelete({ status: 'closed', older_than: '7d', limit: 50 });
1487
- * console.log(`Deleted ${result.count} tasks`);
1488
- * ```
1489
- */
1490
- async batchDelete(params: BatchDeleteTasksParams): Promise<BatchDeleteTasksResult> {
1491
- const hasFilter =
1492
- params.status ||
1493
- params.type ||
1494
- params.priority ||
1495
- params.parent_id ||
1496
- params.created_id ||
1497
- params.older_than;
1498
- if (!hasFilter) {
1499
- throw new Error('At least one filter is required for batch delete');
1500
- }
1501
- if (params.limit !== undefined && params.limit > MAX_BATCH_DELETE_LIMIT) {
1502
- throw new Error(
1503
- `Batch delete limit must not exceed ${MAX_BATCH_DELETE_LIMIT} (got ${params.limit})`
1504
- );
1505
- }
1506
-
1507
- const url = buildUrl(this.#baseUrl, `/task/delete/batch/${TASK_API_VERSION}`);
1508
- const signal = AbortSignal.timeout(60_000);
1509
-
1510
- const body: Record<string, unknown> = {};
1511
- if (params.status) body.status = params.status;
1512
- if (params.type) body.type = params.type;
1513
- if (params.priority) body.priority = params.priority;
1514
- if (params.parent_id) body.parent_id = params.parent_id;
1515
- if (params.created_id) body.created_id = params.created_id;
1516
- if (params.older_than) body.older_than = params.older_than;
1517
- if (params.limit !== undefined) body.limit = params.limit;
1518
-
1519
- const res = await this.#adapter.invoke<TaskResponse<BatchDeleteTasksResult>>(url, {
1520
- method: 'POST',
1521
- body: safeStringify(body),
1522
- headers: { 'Content-Type': 'application/json' },
1523
- signal,
1524
- telemetry: {
1525
- name: 'agentuity.task.batchDelete',
1526
- attributes: {
1527
- ...(params.status ? { status: params.status } : {}),
1528
- ...(params.type ? { type: params.type } : {}),
1529
- ...(params.older_than ? { older_than: params.older_than } : {}),
1530
- },
1531
- },
1532
- });
1533
-
1534
- if (res.ok) {
1535
- if (res.data.success) {
1536
- return res.data.data;
1537
- }
1538
- throw new TaskStorageResponseError({
1539
- status: res.response.status,
1540
- message: res.data.message,
1541
- });
1542
- }
1543
-
1544
- throw await toServiceException('POST', url, res.response);
1545
- }
1546
-
1547
- /**
1548
- * Create a comment on a task.
1549
- *
1550
- * @param taskId - The ID of the task to comment on
1551
- * @param body - The comment text content (must be non-empty)
1552
- * @param userId - The ID of the user authoring the comment
1553
- * @param author - Optional entity reference with the author's display name
1554
- * @returns The newly created comment
1555
- * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1556
- * @throws {@link CommentBodyRequiredError} if the body is empty or not a string
1557
- * @throws {@link UserIdRequiredError} if the user ID is empty or not a string
1558
- * @throws {@link ServiceException} if the API request fails
1559
- *
1560
- * @example
1561
- * ```typescript
1562
- * const comment = await tasks.createComment(
1563
- * 'task_abc123',
1564
- * 'This is ready for review.',
1565
- * 'user_456',
1566
- * { id: 'user_456', name: 'Bob' },
1567
- * );
1568
- * console.log('Comment created:', comment.id);
1569
- * ```
1570
- */
1571
- async createComment(
1572
- taskId: string,
1573
- body: string,
1574
- userId: string,
1575
- author?: EntityRef
1576
- ): Promise<Comment> {
1577
- if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1578
- throw new TaskIdRequiredError();
1579
- }
1580
- if (!body || typeof body !== 'string' || body.trim().length === 0) {
1581
- throw new CommentBodyRequiredError();
1582
- }
1583
- if (!userId || typeof userId !== 'string' || userId.trim().length === 0) {
1584
- throw new UserIdRequiredError();
1585
- }
1586
-
1587
- const url = buildUrl(
1588
- this.#baseUrl,
1589
- `/task/comments/create/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`
1590
- );
1591
- const signal = AbortSignal.timeout(30_000);
1592
-
1593
- const commentBody: Record<string, unknown> = { body, user_id: userId };
1594
- if (author) commentBody.author = author;
1595
-
1596
- const res = await this.#adapter.invoke<TaskResponse<Comment>>(url, {
1597
- method: 'POST',
1598
- body: safeStringify(commentBody),
1599
- contentType: 'application/json',
1600
- signal,
1601
- telemetry: {
1602
- name: 'agentuity.task.createComment',
1603
- attributes: { taskId },
1604
- },
1605
- });
1606
-
1607
- if (res.ok) {
1608
- if (res.data.success) {
1609
- return res.data.data;
1610
- }
1611
- throw new TaskStorageResponseError({
1612
- status: res.response.status,
1613
- message: res.data.message,
1614
- });
1615
- }
1616
-
1617
- throw await toServiceException('POST', url, res.response);
1618
- }
1619
-
1620
- /**
1621
- * Get a comment by its ID.
1622
- *
1623
- * @param commentId - The unique comment identifier
1624
- * @returns The comment
1625
- * @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
1626
- * @throws {@link ServiceException} if the API request fails
1627
- *
1628
- * @example
1629
- * ```typescript
1630
- * const comment = await tasks.getComment('comment_xyz789');
1631
- * console.log(`${comment.author?.name}: ${comment.body}`);
1632
- * ```
1633
- */
1634
- async getComment(commentId: string): Promise<Comment> {
1635
- if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
1636
- throw new CommentIdRequiredError();
1637
- }
1638
-
1639
- const url = buildUrl(
1640
- this.#baseUrl,
1641
- `/task/comments/get/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`
1642
- );
1643
- const signal = AbortSignal.timeout(30_000);
1644
-
1645
- const res = await this.#adapter.invoke<TaskResponse<Comment>>(url, {
1646
- method: 'GET',
1647
- signal,
1648
- telemetry: {
1649
- name: 'agentuity.task.getComment',
1650
- attributes: { commentId },
1651
- },
1652
- });
1653
-
1654
- if (res.ok) {
1655
- if (res.data.success) {
1656
- return res.data.data;
1657
- }
1658
- throw new TaskStorageResponseError({
1659
- status: res.response.status,
1660
- message: res.data.message,
1661
- });
1662
- }
1663
-
1664
- throw await toServiceException('GET', url, res.response);
1665
- }
1666
-
1667
- /**
1668
- * Update a comment's body text.
1669
- *
1670
- * @param commentId - The unique comment identifier
1671
- * @param body - The new comment text (must be non-empty)
1672
- * @returns The updated comment
1673
- * @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
1674
- * @throws {@link CommentBodyRequiredError} if the body is empty or not a string
1675
- * @throws {@link ServiceException} if the API request fails
1676
- *
1677
- * @example
1678
- * ```typescript
1679
- * const updated = await tasks.updateComment(
1680
- * 'comment_xyz789',
1681
- * 'Updated: This is now ready for final review.',
1682
- * );
1683
- * console.log('Updated at:', updated.updated_at);
1684
- * ```
1685
- */
1686
- async updateComment(commentId: string, body: string): Promise<Comment> {
1687
- if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
1688
- throw new CommentIdRequiredError();
1689
- }
1690
- if (!body || typeof body !== 'string' || body.trim().length === 0) {
1691
- throw new CommentBodyRequiredError();
1692
- }
1693
-
1694
- const url = buildUrl(
1695
- this.#baseUrl,
1696
- `/task/comments/update/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`
1697
- );
1698
- const signal = AbortSignal.timeout(30_000);
1699
-
1700
- const res = await this.#adapter.invoke<TaskResponse<Comment>>(url, {
1701
- method: 'PATCH',
1702
- body: safeStringify({ body }),
1703
- contentType: 'application/json',
1704
- signal,
1705
- telemetry: {
1706
- name: 'agentuity.task.updateComment',
1707
- attributes: { commentId },
1708
- },
1709
- });
1710
-
1711
- if (res.ok) {
1712
- if (res.data.success) {
1713
- return res.data.data;
1714
- }
1715
- throw new TaskStorageResponseError({
1716
- status: res.response.status,
1717
- message: res.data.message,
1718
- });
1719
- }
1720
-
1721
- throw await toServiceException('PATCH', url, res.response);
1722
- }
1723
-
1724
- /**
1725
- * Delete a comment permanently.
1726
- *
1727
- * @param commentId - The unique comment identifier
1728
- * @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
1729
- * @throws {@link ServiceException} if the API request fails
1730
- *
1731
- * @example
1732
- * ```typescript
1733
- * await tasks.deleteComment('comment_xyz789');
1734
- * console.log('Comment deleted');
1735
- * ```
1736
- */
1737
- async deleteComment(commentId: string): Promise<void> {
1738
- if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
1739
- throw new CommentIdRequiredError();
1740
- }
1741
-
1742
- const url = buildUrl(
1743
- this.#baseUrl,
1744
- `/task/comments/delete/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`
1745
- );
1746
- const signal = AbortSignal.timeout(30_000);
1747
-
1748
- const res = await this.#adapter.invoke<TaskResponse<void>>(url, {
1749
- method: 'DELETE',
1750
- signal,
1751
- telemetry: {
1752
- name: 'agentuity.task.deleteComment',
1753
- attributes: { commentId },
1754
- },
1755
- });
1756
-
1757
- if (res.ok) {
1758
- if (res.data?.success === false) {
1759
- throw new TaskStorageResponseError({
1760
- status: res.response.status,
1761
- message: res.data.message ?? 'Operation failed',
1762
- });
1763
- }
1764
- return;
1765
- }
1766
-
1767
- throw await toServiceException('DELETE', url, res.response);
1768
- }
1769
-
1770
- /**
1771
- * List comments on a task with optional pagination.
1772
- *
1773
- * @param taskId - The ID of the task whose comments to list
1774
- * @param params - Optional pagination parameters
1775
- * @returns Paginated list of comments
1776
- * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
1777
- * @throws {@link ServiceException} if the API request fails
1778
- *
1779
- * @example
1780
- * ```typescript
1781
- * const { comments, total } = await tasks.listComments('task_abc123', {
1782
- * limit: 25,
1783
- * offset: 0,
1784
- * });
1785
- * for (const c of comments) {
1786
- * console.log(`${c.author?.name}: ${c.body}`);
1787
- * }
1788
- * ```
1789
- */
1790
- async listComments(
1791
- taskId: string,
1792
- params?: { limit?: number; offset?: number }
1793
- ): Promise<ListCommentsResult> {
1794
- if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
1795
- throw new TaskIdRequiredError();
1796
- }
1797
-
1798
- const queryParams = new URLSearchParams();
1799
- if (params?.limit !== undefined) queryParams.set('limit', String(params.limit));
1800
- if (params?.offset !== undefined) queryParams.set('offset', String(params.offset));
1801
- const queryString = queryParams.toString();
1802
-
1803
- const url = buildUrl(
1804
- this.#baseUrl,
1805
- `/task/comments/list/${TASK_API_VERSION}/${encodeURIComponent(taskId)}${
1806
- queryString ? `?${queryString}` : ''
1807
- }`
1808
- );
1809
- const signal = AbortSignal.timeout(30_000);
1810
-
1811
- const res = await this.#adapter.invoke<TaskResponse<ListCommentsResult>>(url, {
1812
- method: 'GET',
1813
- signal,
1814
- telemetry: {
1815
- name: 'agentuity.task.listComments',
1816
- attributes: { taskId },
1817
- },
1818
- });
1819
-
1820
- if (res.ok) {
1821
- if (res.data.success) {
1822
- return res.data.data;
1823
- }
1824
- throw new TaskStorageResponseError({
1825
- status: res.response.status,
1826
- message: res.data.message,
1827
- });
1828
- }
1829
-
1830
- throw await toServiceException('GET', url, res.response);
1831
- }
1832
-
1833
- /**
1834
- * Create a new tag for categorizing tasks.
1835
- *
1836
- * @param name - The tag display name (must be non-empty)
1837
- * @param color - Optional hex color code (e.g., `'#ff0000'`)
1838
- * @returns The newly created tag
1839
- * @throws {@link TagNameRequiredError} if the name is empty or not a string
1840
- * @throws {@link ServiceException} if the API request fails
1841
- *
1842
- * @example
1843
- * ```typescript
1844
- * const tag = await tasks.createTag('urgent', '#ff0000');
1845
- * console.log('Created tag:', tag.id, tag.name);
1846
- * ```
1847
- */
1848
- async createTag(name: string, color?: string): Promise<Tag> {
1849
- if (!name || typeof name !== 'string' || name.trim().length === 0) {
1850
- throw new TagNameRequiredError();
1851
- }
1852
-
1853
- const url = buildUrl(this.#baseUrl, `/task/tags/create/${TASK_API_VERSION}`);
1854
- const signal = AbortSignal.timeout(30_000);
1855
-
1856
- const body: Record<string, string> = { name };
1857
- if (color !== undefined) body.color = color;
1858
-
1859
- const res = await this.#adapter.invoke<TaskResponse<Tag>>(url, {
1860
- method: 'POST',
1861
- body: safeStringify(body),
1862
- contentType: 'application/json',
1863
- signal,
1864
- telemetry: {
1865
- name: 'agentuity.task.createTag',
1866
- attributes: { tagName: name },
1867
- },
1868
- });
1869
-
1870
- if (res.ok) {
1871
- if (res.data.success) {
1872
- return res.data.data;
1873
- }
1874
- throw new TaskStorageResponseError({
1875
- status: res.response.status,
1876
- message: res.data.message,
1877
- });
1878
- }
1879
-
1880
- throw await toServiceException('POST', url, res.response);
1881
- }
1882
-
1883
- /**
1884
- * Get a tag by its ID.
1885
- *
1886
- * @param tagId - The unique tag identifier
1887
- * @returns The tag
1888
- * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1889
- * @throws {@link ServiceException} if the API request fails
1890
- *
1891
- * @example
1892
- * ```typescript
1893
- * const tag = await tasks.getTag('tag_def456');
1894
- * console.log(`${tag.name} (${tag.color})`);
1895
- * ```
1896
- */
1897
- async getTag(tagId: string): Promise<Tag> {
1898
- if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
1899
- throw new TagIdRequiredError();
1900
- }
1901
-
1902
- const url = buildUrl(
1903
- this.#baseUrl,
1904
- `/task/tags/get/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`
1905
- );
1906
- const signal = AbortSignal.timeout(30_000);
1907
-
1908
- const res = await this.#adapter.invoke<TaskResponse<Tag>>(url, {
1909
- method: 'GET',
1910
- signal,
1911
- telemetry: {
1912
- name: 'agentuity.task.getTag',
1913
- attributes: { tagId },
1914
- },
1915
- });
1916
-
1917
- if (res.ok) {
1918
- if (res.data.success) {
1919
- return res.data.data;
1920
- }
1921
- throw new TaskStorageResponseError({
1922
- status: res.response.status,
1923
- message: res.data.message,
1924
- });
1925
- }
1926
-
1927
- throw await toServiceException('GET', url, res.response);
1928
- }
1929
-
1930
- /**
1931
- * Update a tag's name and optionally its color.
1932
- *
1933
- * @param tagId - The unique tag identifier
1934
- * @param name - The new tag name (must be non-empty)
1935
- * @param color - Optional new hex color code
1936
- * @returns The updated tag
1937
- * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1938
- * @throws {@link TagNameRequiredError} if the name is empty or not a string
1939
- * @throws {@link ServiceException} if the API request fails
1940
- *
1941
- * @example
1942
- * ```typescript
1943
- * const updated = await tasks.updateTag('tag_def456', 'critical', '#cc0000');
1944
- * console.log('Updated:', updated.name);
1945
- * ```
1946
- */
1947
- async updateTag(tagId: string, name: string, color?: string): Promise<Tag> {
1948
- if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
1949
- throw new TagIdRequiredError();
1950
- }
1951
- if (!name || typeof name !== 'string' || name.trim().length === 0) {
1952
- throw new TagNameRequiredError();
1953
- }
1954
-
1955
- const url = buildUrl(
1956
- this.#baseUrl,
1957
- `/task/tags/update/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`
1958
- );
1959
- const signal = AbortSignal.timeout(30_000);
1960
-
1961
- const body: Record<string, string> = { name };
1962
- if (color !== undefined) body.color = color;
1963
-
1964
- const res = await this.#adapter.invoke<TaskResponse<Tag>>(url, {
1965
- method: 'PATCH',
1966
- body: safeStringify(body),
1967
- contentType: 'application/json',
1968
- signal,
1969
- telemetry: {
1970
- name: 'agentuity.task.updateTag',
1971
- attributes: { tagId },
1972
- },
1973
- });
1974
-
1975
- if (res.ok) {
1976
- if (res.data.success) {
1977
- return res.data.data;
1978
- }
1979
- throw new TaskStorageResponseError({
1980
- status: res.response.status,
1981
- message: res.data.message,
1982
- });
1983
- }
1984
-
1985
- throw await toServiceException('PATCH', url, res.response);
1986
- }
1987
-
1988
- /**
1989
- * Delete a tag permanently.
1990
- *
1991
- * @param tagId - The unique tag identifier
1992
- * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
1993
- * @throws {@link ServiceException} if the API request fails
1994
- *
1995
- * @example
1996
- * ```typescript
1997
- * await tasks.deleteTag('tag_def456');
1998
- * console.log('Tag deleted');
1999
- * ```
2000
- */
2001
- async deleteTag(tagId: string): Promise<void> {
2002
- if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
2003
- throw new TagIdRequiredError();
2004
- }
2005
-
2006
- const url = buildUrl(
2007
- this.#baseUrl,
2008
- `/task/tags/delete/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`
2009
- );
2010
- const signal = AbortSignal.timeout(30_000);
2011
-
2012
- const res = await this.#adapter.invoke<TaskResponse<void>>(url, {
2013
- method: 'DELETE',
2014
- signal,
2015
- telemetry: {
2016
- name: 'agentuity.task.deleteTag',
2017
- attributes: { tagId },
2018
- },
2019
- });
2020
-
2021
- if (res.ok) {
2022
- if (res.data?.success === false) {
2023
- throw new TaskStorageResponseError({
2024
- status: res.response.status,
2025
- message: res.data.message ?? 'Operation failed',
2026
- });
2027
- }
2028
- return;
2029
- }
2030
-
2031
- throw await toServiceException('DELETE', url, res.response);
2032
- }
2033
-
2034
- /**
2035
- * List all tags in the organization.
2036
- *
2037
- * @returns List of all tags
2038
- * @throws {@link ServiceException} if the API request fails
2039
- *
2040
- * @example
2041
- * ```typescript
2042
- * const { tags } = await tasks.listTags();
2043
- * for (const tag of tags) {
2044
- * console.log(`${tag.name} (${tag.color ?? 'no color'})`);
2045
- * }
2046
- * ```
2047
- */
2048
- async listTags(): Promise<ListTagsResult> {
2049
- const url = buildUrl(this.#baseUrl, `/task/tags/list/${TASK_API_VERSION}`);
2050
- const signal = AbortSignal.timeout(30_000);
2051
-
2052
- const res = await this.#adapter.invoke<TaskResponse<ListTagsResult>>(url, {
2053
- method: 'GET',
2054
- signal,
2055
- telemetry: {
2056
- name: 'agentuity.task.listTags',
2057
- attributes: {},
2058
- },
2059
- });
2060
-
2061
- if (res.ok) {
2062
- if (res.data.success) {
2063
- return res.data.data;
2064
- }
2065
- throw new TaskStorageResponseError({
2066
- status: res.response.status,
2067
- message: res.data.message,
2068
- });
2069
- }
2070
-
2071
- throw await toServiceException('GET', url, res.response);
2072
- }
2073
-
2074
- /**
2075
- * Associate a tag with a task.
2076
- *
2077
- * @param taskId - The ID of the task
2078
- * @param tagId - The ID of the tag to add
2079
- * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
2080
- * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
2081
- * @throws {@link ServiceException} if the API request fails
2082
- *
2083
- * @example
2084
- * ```typescript
2085
- * await tasks.addTagToTask('task_abc123', 'tag_def456');
2086
- * console.log('Tag added to task');
2087
- * ```
2088
- */
2089
- async addTagToTask(taskId: string, tagId: string): Promise<void> {
2090
- if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
2091
- throw new TaskIdRequiredError();
2092
- }
2093
- if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
2094
- throw new TagIdRequiredError();
2095
- }
2096
-
2097
- const url = buildUrl(
2098
- this.#baseUrl,
2099
- `/task/tags/add/${TASK_API_VERSION}/${encodeURIComponent(taskId)}/${encodeURIComponent(tagId)}`
2100
- );
2101
- const signal = AbortSignal.timeout(30_000);
2102
-
2103
- const res = await this.#adapter.invoke<TaskResponse<void>>(url, {
2104
- method: 'POST',
2105
- signal,
2106
- telemetry: {
2107
- name: 'agentuity.task.addTagToTask',
2108
- attributes: { taskId, tagId },
2109
- },
2110
- });
2111
-
2112
- if (res.ok) {
2113
- if (res.data?.success === false) {
2114
- throw new TaskStorageResponseError({
2115
- status: res.response.status,
2116
- message: res.data.message ?? 'Operation failed',
2117
- });
2118
- }
2119
- return;
2120
- }
2121
-
2122
- throw await toServiceException('POST', url, res.response);
2123
- }
2124
-
2125
- /**
2126
- * Remove a tag association from a task.
2127
- *
2128
- * @param taskId - The ID of the task
2129
- * @param tagId - The ID of the tag to remove
2130
- * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
2131
- * @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
2132
- * @throws {@link ServiceException} if the API request fails
2133
- *
2134
- * @example
2135
- * ```typescript
2136
- * await tasks.removeTagFromTask('task_abc123', 'tag_def456');
2137
- * console.log('Tag removed from task');
2138
- * ```
2139
- */
2140
- async removeTagFromTask(taskId: string, tagId: string): Promise<void> {
2141
- if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
2142
- throw new TaskIdRequiredError();
2143
- }
2144
- if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
2145
- throw new TagIdRequiredError();
2146
- }
2147
-
2148
- const url = buildUrl(
2149
- this.#baseUrl,
2150
- `/task/tags/remove/${TASK_API_VERSION}/${encodeURIComponent(taskId)}/${encodeURIComponent(tagId)}`
2151
- );
2152
- const signal = AbortSignal.timeout(30_000);
2153
-
2154
- const res = await this.#adapter.invoke<TaskResponse<void>>(url, {
2155
- method: 'DELETE',
2156
- signal,
2157
- telemetry: {
2158
- name: 'agentuity.task.removeTagFromTask',
2159
- attributes: { taskId, tagId },
2160
- },
2161
- });
2162
-
2163
- if (res.ok) {
2164
- if (res.data?.success === false) {
2165
- throw new TaskStorageResponseError({
2166
- status: res.response.status,
2167
- message: res.data.message ?? 'Operation failed',
2168
- });
2169
- }
2170
- return;
2171
- }
2172
-
2173
- throw await toServiceException('DELETE', url, res.response);
2174
- }
2175
-
2176
- /**
2177
- * List all tags associated with a specific task.
2178
- *
2179
- * @param taskId - The ID of the task
2180
- * @returns Array of tags on the task
2181
- * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
2182
- * @throws {@link ServiceException} if the API request fails
2183
- *
2184
- * @example
2185
- * ```typescript
2186
- * const tags = await tasks.listTagsForTask('task_abc123');
2187
- * console.log('Tags:', tags.map((t) => t.name).join(', '));
2188
- * ```
2189
- */
2190
- async listTagsForTask(taskId: string): Promise<Tag[]> {
2191
- if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
2192
- throw new TaskIdRequiredError();
2193
- }
2194
-
2195
- const url = buildUrl(
2196
- this.#baseUrl,
2197
- `/task/tags/task/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`
2198
- );
2199
- const signal = AbortSignal.timeout(30_000);
2200
-
2201
- const res = await this.#adapter.invoke<TaskResponse<Tag[]>>(url, {
2202
- method: 'GET',
2203
- signal,
2204
- telemetry: {
2205
- name: 'agentuity.task.listTagsForTask',
2206
- attributes: { taskId },
2207
- },
2208
- });
2209
-
2210
- if (res.ok) {
2211
- if (res.data.success) {
2212
- return res.data.data;
2213
- }
2214
- throw new TaskStorageResponseError({
2215
- status: res.response.status,
2216
- message: res.data.message,
2217
- });
2218
- }
2219
-
2220
- throw await toServiceException('GET', url, res.response);
2221
- }
2222
-
2223
- /**
2224
- * Initiate a file upload to a task. Returns a presigned S3 URL for direct upload.
2225
- *
2226
- * @remarks
2227
- * After receiving the presigned URL, upload the file content via HTTP PUT to that URL.
2228
- * Then call {@link TaskStorageService.confirmAttachment | confirmAttachment} to finalize.
2229
- *
2230
- * @param taskId - The ID of the task to attach the file to
2231
- * @param params - Attachment metadata including filename, content type, and size
2232
- * @returns The created attachment record and a presigned upload URL
2233
- * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
2234
- * @throws {@link ServiceException} if the API request fails
2235
- *
2236
- * @example
2237
- * ```typescript
2238
- * const { attachment, presigned_url } = await tasks.uploadAttachment(
2239
- * 'task_abc123',
2240
- * { filename: 'report.pdf', content_type: 'application/pdf', size: 102400 },
2241
- * );
2242
- *
2243
- * // Upload the file to S3
2244
- * await fetch(presigned_url, { method: 'PUT', body: fileContent });
2245
- *
2246
- * // Confirm the upload
2247
- * await tasks.confirmAttachment(attachment.id);
2248
- * ```
2249
- */
2250
- async uploadAttachment(
2251
- taskId: string,
2252
- params: CreateAttachmentParams
2253
- ): Promise<PresignUploadResponse> {
2254
- if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
2255
- throw new TaskIdRequiredError();
2256
- }
2257
-
2258
- const url = buildUrl(
2259
- this.#baseUrl,
2260
- `/task/attachments/presign-upload/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`
2261
- );
2262
- const signal = AbortSignal.timeout(30_000);
2263
-
2264
- const res = await this.#adapter.invoke<TaskResponse<PresignUploadResponse>>(url, {
2265
- method: 'POST',
2266
- body: safeStringify(params),
2267
- contentType: 'application/json',
2268
- signal,
2269
- telemetry: {
2270
- name: 'agentuity.task.uploadAttachment',
2271
- attributes: { taskId },
2272
- },
2273
- });
2274
-
2275
- if (res.ok) {
2276
- if (res.data.success) {
2277
- return res.data.data;
2278
- }
2279
- throw new TaskStorageResponseError({
2280
- status: res.response.status,
2281
- message: res.data.message,
2282
- });
2283
- }
2284
-
2285
- throw await toServiceException('POST', url, res.response);
2286
- }
2287
-
2288
- /**
2289
- * Confirm that a file upload has completed successfully.
2290
- *
2291
- * @remarks
2292
- * Call this after successfully uploading the file to the presigned URL
2293
- * returned by {@link TaskStorageService.uploadAttachment | uploadAttachment}.
2294
- *
2295
- * @param attachmentId - The unique attachment identifier
2296
- * @returns The confirmed attachment record
2297
- * @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
2298
- * @throws {@link ServiceException} if the API request fails
2299
- *
2300
- * @example
2301
- * ```typescript
2302
- * const confirmed = await tasks.confirmAttachment('att_ghi789');
2303
- * console.log('Confirmed:', confirmed.filename);
2304
- * ```
2305
- */
2306
- async confirmAttachment(attachmentId: string): Promise<Attachment> {
2307
- if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
2308
- throw new AttachmentIdRequiredError();
2309
- }
2310
-
2311
- const url = buildUrl(
2312
- this.#baseUrl,
2313
- `/task/attachments/confirm/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`
2314
- );
2315
- const signal = AbortSignal.timeout(30_000);
2316
-
2317
- const res = await this.#adapter.invoke<TaskResponse<Attachment>>(url, {
2318
- method: 'POST',
2319
- signal,
2320
- telemetry: {
2321
- name: 'agentuity.task.confirmAttachment',
2322
- attributes: { attachmentId },
2323
- },
2324
- });
2325
-
2326
- if (res.ok) {
2327
- if (res.data.success) {
2328
- return res.data.data;
2329
- }
2330
- throw new TaskStorageResponseError({
2331
- status: res.response.status,
2332
- message: res.data.message,
2333
- });
2334
- }
2335
-
2336
- throw await toServiceException('POST', url, res.response);
2337
- }
2338
-
2339
- /**
2340
- * Get a presigned S3 URL for downloading an attachment.
2341
- *
2342
- * @param attachmentId - The unique attachment identifier
2343
- * @returns A presigned download URL with expiry information
2344
- * @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
2345
- * @throws {@link ServiceException} if the API request fails
2346
- *
2347
- * @example
2348
- * ```typescript
2349
- * const { presigned_url, expiry_seconds } = await tasks.downloadAttachment('att_ghi789');
2350
- * console.log(`Download URL (expires in ${expiry_seconds}s):`, presigned_url);
2351
- * ```
2352
- */
2353
- async downloadAttachment(attachmentId: string): Promise<PresignDownloadResponse> {
2354
- if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
2355
- throw new AttachmentIdRequiredError();
2356
- }
2357
-
2358
- const url = buildUrl(
2359
- this.#baseUrl,
2360
- `/task/attachments/presign-download/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`
2361
- );
2362
- const signal = AbortSignal.timeout(30_000);
2363
-
2364
- const res = await this.#adapter.invoke<TaskResponse<PresignDownloadResponse>>(url, {
2365
- method: 'POST',
2366
- signal,
2367
- telemetry: {
2368
- name: 'agentuity.task.downloadAttachment',
2369
- attributes: { attachmentId },
2370
- },
2371
- });
2372
-
2373
- if (res.ok) {
2374
- if (res.data.success) {
2375
- return res.data.data;
2376
- }
2377
- throw new TaskStorageResponseError({
2378
- status: res.response.status,
2379
- message: res.data.message,
2380
- });
2381
- }
2382
-
2383
- throw await toServiceException('POST', url, res.response);
2384
- }
2385
-
2386
- /**
2387
- * List all attachments on a task.
2388
- *
2389
- * @param taskId - The ID of the task
2390
- * @returns List of attachments with total count
2391
- * @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
2392
- * @throws {@link ServiceException} if the API request fails
2393
- *
2394
- * @example
2395
- * ```typescript
2396
- * const { attachments, total } = await tasks.listAttachments('task_abc123');
2397
- * for (const att of attachments) {
2398
- * console.log(`${att.filename} (${att.content_type}, ${att.size} bytes)`);
2399
- * }
2400
- * ```
2401
- */
2402
- async listAttachments(taskId: string): Promise<ListAttachmentsResult> {
2403
- if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
2404
- throw new TaskIdRequiredError();
2405
- }
2406
-
2407
- const url = buildUrl(
2408
- this.#baseUrl,
2409
- `/task/attachments/list/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`
2410
- );
2411
- const signal = AbortSignal.timeout(30_000);
2412
-
2413
- const res = await this.#adapter.invoke<TaskResponse<ListAttachmentsResult>>(url, {
2414
- method: 'GET',
2415
- signal,
2416
- telemetry: {
2417
- name: 'agentuity.task.listAttachments',
2418
- attributes: { taskId },
2419
- },
2420
- });
2421
-
2422
- if (res.ok) {
2423
- if (res.data.success) {
2424
- return res.data.data;
2425
- }
2426
- throw new TaskStorageResponseError({
2427
- status: res.response.status,
2428
- message: res.data.message,
2429
- });
2430
- }
2431
-
2432
- throw await toServiceException('GET', url, res.response);
2433
- }
2434
-
2435
- /**
2436
- * Delete an attachment permanently.
2437
- *
2438
- * @param attachmentId - The unique attachment identifier
2439
- * @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
2440
- * @throws {@link ServiceException} if the API request fails
2441
- *
2442
- * @example
2443
- * ```typescript
2444
- * await tasks.deleteAttachment('att_ghi789');
2445
- * console.log('Attachment deleted');
2446
- * ```
2447
- */
2448
- async deleteAttachment(attachmentId: string): Promise<void> {
2449
- if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
2450
- throw new AttachmentIdRequiredError();
2451
- }
2452
-
2453
- const url = buildUrl(
2454
- this.#baseUrl,
2455
- `/task/attachments/delete/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`
2456
- );
2457
- const signal = AbortSignal.timeout(30_000);
2458
-
2459
- const res = await this.#adapter.invoke<TaskResponse<void>>(url, {
2460
- method: 'DELETE',
2461
- signal,
2462
- telemetry: {
2463
- name: 'agentuity.task.deleteAttachment',
2464
- attributes: { attachmentId },
2465
- },
2466
- });
2467
-
2468
- if (res.ok) {
2469
- if (res.data?.success === false) {
2470
- throw new TaskStorageResponseError({
2471
- status: res.response.status,
2472
- message: res.data.message ?? 'Operation failed',
2473
- });
2474
- }
2475
- return;
2476
- }
2477
-
2478
- throw await toServiceException('DELETE', url, res.response);
2479
- }
2480
-
2481
- /**
2482
- * List all users who have been referenced in tasks (as creators, assignees, or closers).
2483
- *
2484
- * @returns List of user entity references
2485
- * @throws {@link ServiceException} if the API request fails
2486
- *
2487
- * @example
2488
- * ```typescript
2489
- * const { users } = await tasks.listUsers();
2490
- * for (const user of users) {
2491
- * console.log(`${user.name} (${user.id})`);
2492
- * }
2493
- * ```
2494
- */
2495
- async listUsers(): Promise<ListUsersResult> {
2496
- const url = buildUrl(this.#baseUrl, `/task/users/${TASK_API_VERSION}`);
2497
- const signal = AbortSignal.timeout(30_000);
2498
-
2499
- const res = await this.#adapter.invoke<TaskResponse<ListUsersResult>>(url, {
2500
- method: 'GET',
2501
- signal,
2502
- telemetry: {
2503
- name: 'agentuity.task.listUsers',
2504
- attributes: {},
2505
- },
2506
- });
2507
-
2508
- if (res.ok) {
2509
- if (res.data.success) {
2510
- return res.data.data;
2511
- }
2512
- throw new TaskStorageResponseError({
2513
- status: res.response.status,
2514
- message: res.data.message,
2515
- });
2516
- }
2517
-
2518
- throw await toServiceException('GET', url, res.response);
2519
- }
2520
-
2521
- /**
2522
- * List all projects that have been referenced in tasks.
2523
- *
2524
- * @returns List of project entity references
2525
- * @throws {@link ServiceException} if the API request fails
2526
- *
2527
- * @example
2528
- * ```typescript
2529
- * const { projects } = await tasks.listProjects();
2530
- * for (const project of projects) {
2531
- * console.log(`${project.name} (${project.id})`);
2532
- * }
2533
- * ```
2534
- */
2535
- async listProjects(): Promise<ListProjectsResult> {
2536
- const url = buildUrl(this.#baseUrl, `/task/projects/${TASK_API_VERSION}`);
2537
- const signal = AbortSignal.timeout(30_000);
2538
-
2539
- const res = await this.#adapter.invoke<TaskResponse<ListProjectsResult>>(url, {
2540
- method: 'GET',
2541
- signal,
2542
- telemetry: {
2543
- name: 'agentuity.task.listProjects',
2544
- attributes: {},
2545
- },
2546
- });
2547
-
2548
- if (res.ok) {
2549
- if (res.data.success) {
2550
- return res.data.data;
2551
- }
2552
- throw new TaskStorageResponseError({
2553
- status: res.response.status,
2554
- message: res.data.message,
2555
- });
2556
- }
2557
-
2558
- throw await toServiceException('GET', url, res.response);
2559
- }
2560
-
2561
- /**
2562
- * Get task activity time-series data showing daily task counts by status.
2563
- *
2564
- * @param params - Optional parameters controlling the number of days to retrieve
2565
- * @returns Time-series activity data with daily snapshots
2566
- * @throws {@link ServiceException} if the API request fails
2567
- *
2568
- * @example
2569
- * ```typescript
2570
- * const { activity, days } = await tasks.getActivity({ days: 30 });
2571
- * console.log(`Activity over ${days} days:`);
2572
- * for (const point of activity) {
2573
- * console.log(`${point.date}: ${point.open} open, ${point.inProgress} in progress`);
2574
- * }
2575
- * ```
2576
- */
2577
- async getActivity(params?: TaskActivityParams): Promise<TaskActivityResult> {
2578
- const queryParams = new URLSearchParams();
2579
- if (params?.days !== undefined) queryParams.set('days', String(params.days));
2580
-
2581
- const queryString = queryParams.toString();
2582
- const url = buildUrl(
2583
- this.#baseUrl,
2584
- `/task/activity/${TASK_ACTIVITY_API_VERSION}${queryString ? `?${queryString}` : ''}`
2585
- );
2586
- const signal = AbortSignal.timeout(30_000);
2587
-
2588
- const res = await this.#adapter.invoke<TaskResponse<TaskActivityResult>>(url, {
2589
- method: 'GET',
2590
- signal,
2591
- telemetry: {
2592
- name: 'agentuity.task.activity',
2593
- attributes: {
2594
- ...(params?.days !== undefined ? { days: String(params.days) } : {}),
2595
- },
2596
- },
2597
- });
2598
-
2599
- if (res.ok) {
2600
- if (res.data.success) {
2601
- return res.data.data;
2602
- }
2603
- throw new TaskStorageResponseError({
2604
- status: res.response.status,
2605
- message: res.data.message,
2606
- });
2607
- }
2608
-
2609
- throw await toServiceException('GET', url, res.response);
2610
- }
2611
- }