@agentuity/core 1.0.24 → 1.0.25

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.
@@ -2,8 +2,15 @@ import { buildUrl, toServiceException } from "./_util.js";
2
2
  import { StructuredError } from "../error.js";
3
3
  import { safeStringify } from "../json.js";
4
4
  const TASK_API_VERSION = '2026-02-24';
5
+ const TASK_ACTIVITY_API_VERSION = '2026-02-28';
5
6
  const TaskIdRequiredError = StructuredError('TaskIdRequiredError', 'Task ID is required and must be a non-empty string');
6
7
  const TaskTitleRequiredError = StructuredError('TaskTitleRequiredError', 'Task title is required and must be a non-empty string');
8
+ const CommentIdRequiredError = StructuredError('CommentIdRequiredError', 'Comment ID is required and must be a non-empty string');
9
+ const CommentBodyRequiredError = StructuredError('CommentBodyRequiredError', 'Comment body is required and must be a non-empty string');
10
+ const TagIdRequiredError = StructuredError('TagIdRequiredError', 'Tag ID is required and must be a non-empty string');
11
+ const TagNameRequiredError = StructuredError('TagNameRequiredError', 'Tag name is required and must be a non-empty string');
12
+ const AttachmentIdRequiredError = StructuredError('AttachmentIdRequiredError', 'Attachment ID is required and must be a non-empty string');
13
+ const UserIdRequiredError = StructuredError('UserIdRequiredError', 'User ID is required and must be a non-empty string');
7
14
  const TaskStorageResponseError = StructuredError('TaskStorageResponseError')();
8
15
  export class TaskStorageService {
9
16
  #adapter;
@@ -83,6 +90,12 @@ export class TaskStorageService {
83
90
  queryParams.set('assigned_id', params.assigned_id);
84
91
  if (params?.parent_id)
85
92
  queryParams.set('parent_id', params.parent_id);
93
+ if (params?.project_id)
94
+ queryParams.set('project_id', params.project_id);
95
+ if (params?.tag_id)
96
+ queryParams.set('tag_id', params.tag_id);
97
+ if (params?.deleted !== undefined)
98
+ queryParams.set('deleted', String(params.deleted));
86
99
  if (params?.sort)
87
100
  queryParams.set('sort', params.sort);
88
101
  if (params?.order)
@@ -183,7 +196,7 @@ export class TaskStorageService {
183
196
  if (params?.offset !== undefined)
184
197
  queryParams.set('offset', String(params.offset));
185
198
  const queryString = queryParams.toString();
186
- const url = buildUrl(this.#baseUrl, `/task-changelog/${TASK_API_VERSION}/${encodeURIComponent(id)}${queryString ? `?${queryString}` : ''}`);
199
+ const url = buildUrl(this.#baseUrl, `/task/changelog/${TASK_API_VERSION}/${encodeURIComponent(id)}${queryString ? `?${queryString}` : ''}`);
187
200
  const signal = AbortSignal.timeout(30_000);
188
201
  const res = await this.#adapter.invoke(url, {
189
202
  method: 'GET',
@@ -204,5 +217,593 @@ export class TaskStorageService {
204
217
  }
205
218
  throw await toServiceException('GET', url, res.response);
206
219
  }
220
+ async softDelete(id) {
221
+ if (!id || typeof id !== 'string' || id.trim().length === 0) {
222
+ throw new TaskIdRequiredError();
223
+ }
224
+ const url = buildUrl(this.#baseUrl, `/task/delete/${TASK_API_VERSION}/${encodeURIComponent(id)}`);
225
+ const signal = AbortSignal.timeout(30_000);
226
+ const res = await this.#adapter.invoke(url, {
227
+ method: 'POST',
228
+ signal,
229
+ telemetry: {
230
+ name: 'agentuity.task.softDelete',
231
+ attributes: { id },
232
+ },
233
+ });
234
+ if (res.ok) {
235
+ if (res.data.success) {
236
+ return res.data.data;
237
+ }
238
+ throw new TaskStorageResponseError({
239
+ status: res.response.status,
240
+ message: res.data.message,
241
+ });
242
+ }
243
+ throw await toServiceException('POST', url, res.response);
244
+ }
245
+ async createComment(taskId, body, userId, author) {
246
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
247
+ throw new TaskIdRequiredError();
248
+ }
249
+ if (!body || typeof body !== 'string' || body.trim().length === 0) {
250
+ throw new CommentBodyRequiredError();
251
+ }
252
+ if (!userId || typeof userId !== 'string' || userId.trim().length === 0) {
253
+ throw new UserIdRequiredError();
254
+ }
255
+ const url = buildUrl(this.#baseUrl, `/task/comments/create/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
256
+ const signal = AbortSignal.timeout(30_000);
257
+ const commentBody = { body, user_id: userId };
258
+ if (author)
259
+ commentBody.author = author;
260
+ const res = await this.#adapter.invoke(url, {
261
+ method: 'POST',
262
+ body: safeStringify(commentBody),
263
+ contentType: 'application/json',
264
+ signal,
265
+ telemetry: {
266
+ name: 'agentuity.task.createComment',
267
+ attributes: { taskId },
268
+ },
269
+ });
270
+ if (res.ok) {
271
+ if (res.data.success) {
272
+ return res.data.data;
273
+ }
274
+ throw new TaskStorageResponseError({
275
+ status: res.response.status,
276
+ message: res.data.message,
277
+ });
278
+ }
279
+ throw await toServiceException('POST', url, res.response);
280
+ }
281
+ async getComment(commentId) {
282
+ if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
283
+ throw new CommentIdRequiredError();
284
+ }
285
+ const url = buildUrl(this.#baseUrl, `/task/comments/get/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`);
286
+ const signal = AbortSignal.timeout(30_000);
287
+ const res = await this.#adapter.invoke(url, {
288
+ method: 'GET',
289
+ signal,
290
+ telemetry: {
291
+ name: 'agentuity.task.getComment',
292
+ attributes: { commentId },
293
+ },
294
+ });
295
+ if (res.ok) {
296
+ if (res.data.success) {
297
+ return res.data.data;
298
+ }
299
+ throw new TaskStorageResponseError({
300
+ status: res.response.status,
301
+ message: res.data.message,
302
+ });
303
+ }
304
+ throw await toServiceException('GET', url, res.response);
305
+ }
306
+ async updateComment(commentId, body) {
307
+ if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
308
+ throw new CommentIdRequiredError();
309
+ }
310
+ if (!body || typeof body !== 'string' || body.trim().length === 0) {
311
+ throw new CommentBodyRequiredError();
312
+ }
313
+ const url = buildUrl(this.#baseUrl, `/task/comments/update/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`);
314
+ const signal = AbortSignal.timeout(30_000);
315
+ const res = await this.#adapter.invoke(url, {
316
+ method: 'PATCH',
317
+ body: safeStringify({ body }),
318
+ contentType: 'application/json',
319
+ signal,
320
+ telemetry: {
321
+ name: 'agentuity.task.updateComment',
322
+ attributes: { commentId },
323
+ },
324
+ });
325
+ if (res.ok) {
326
+ if (res.data.success) {
327
+ return res.data.data;
328
+ }
329
+ throw new TaskStorageResponseError({
330
+ status: res.response.status,
331
+ message: res.data.message,
332
+ });
333
+ }
334
+ throw await toServiceException('PATCH', url, res.response);
335
+ }
336
+ async deleteComment(commentId) {
337
+ if (!commentId || typeof commentId !== 'string' || commentId.trim().length === 0) {
338
+ throw new CommentIdRequiredError();
339
+ }
340
+ const url = buildUrl(this.#baseUrl, `/task/comments/delete/${TASK_API_VERSION}/${encodeURIComponent(commentId)}`);
341
+ const signal = AbortSignal.timeout(30_000);
342
+ const res = await this.#adapter.invoke(url, {
343
+ method: 'DELETE',
344
+ signal,
345
+ telemetry: {
346
+ name: 'agentuity.task.deleteComment',
347
+ attributes: { commentId },
348
+ },
349
+ });
350
+ if (res.ok) {
351
+ if (res.data?.success === false) {
352
+ throw new TaskStorageResponseError({
353
+ status: res.response.status,
354
+ message: res.data.message ?? 'Operation failed',
355
+ });
356
+ }
357
+ return;
358
+ }
359
+ throw await toServiceException('DELETE', url, res.response);
360
+ }
361
+ async listComments(taskId, params) {
362
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
363
+ throw new TaskIdRequiredError();
364
+ }
365
+ const queryParams = new URLSearchParams();
366
+ if (params?.limit !== undefined)
367
+ queryParams.set('limit', String(params.limit));
368
+ if (params?.offset !== undefined)
369
+ queryParams.set('offset', String(params.offset));
370
+ const queryString = queryParams.toString();
371
+ const url = buildUrl(this.#baseUrl, `/task/comments/list/${TASK_API_VERSION}/${encodeURIComponent(taskId)}${queryString ? `?${queryString}` : ''}`);
372
+ const signal = AbortSignal.timeout(30_000);
373
+ const res = await this.#adapter.invoke(url, {
374
+ method: 'GET',
375
+ signal,
376
+ telemetry: {
377
+ name: 'agentuity.task.listComments',
378
+ attributes: { taskId },
379
+ },
380
+ });
381
+ if (res.ok) {
382
+ if (res.data.success) {
383
+ return res.data.data;
384
+ }
385
+ throw new TaskStorageResponseError({
386
+ status: res.response.status,
387
+ message: res.data.message,
388
+ });
389
+ }
390
+ throw await toServiceException('GET', url, res.response);
391
+ }
392
+ async createTag(name, color) {
393
+ if (!name || typeof name !== 'string' || name.trim().length === 0) {
394
+ throw new TagNameRequiredError();
395
+ }
396
+ const url = buildUrl(this.#baseUrl, `/task/tags/create/${TASK_API_VERSION}`);
397
+ const signal = AbortSignal.timeout(30_000);
398
+ const body = { name };
399
+ if (color !== undefined)
400
+ body.color = color;
401
+ const res = await this.#adapter.invoke(url, {
402
+ method: 'POST',
403
+ body: safeStringify(body),
404
+ contentType: 'application/json',
405
+ signal,
406
+ telemetry: {
407
+ name: 'agentuity.task.createTag',
408
+ attributes: { tagName: name },
409
+ },
410
+ });
411
+ if (res.ok) {
412
+ if (res.data.success) {
413
+ return res.data.data;
414
+ }
415
+ throw new TaskStorageResponseError({
416
+ status: res.response.status,
417
+ message: res.data.message,
418
+ });
419
+ }
420
+ throw await toServiceException('POST', url, res.response);
421
+ }
422
+ async getTag(tagId) {
423
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
424
+ throw new TagIdRequiredError();
425
+ }
426
+ const url = buildUrl(this.#baseUrl, `/task/tags/get/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`);
427
+ const signal = AbortSignal.timeout(30_000);
428
+ const res = await this.#adapter.invoke(url, {
429
+ method: 'GET',
430
+ signal,
431
+ telemetry: {
432
+ name: 'agentuity.task.getTag',
433
+ attributes: { tagId },
434
+ },
435
+ });
436
+ if (res.ok) {
437
+ if (res.data.success) {
438
+ return res.data.data;
439
+ }
440
+ throw new TaskStorageResponseError({
441
+ status: res.response.status,
442
+ message: res.data.message,
443
+ });
444
+ }
445
+ throw await toServiceException('GET', url, res.response);
446
+ }
447
+ async updateTag(tagId, name, color) {
448
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
449
+ throw new TagIdRequiredError();
450
+ }
451
+ if (!name || typeof name !== 'string' || name.trim().length === 0) {
452
+ throw new TagNameRequiredError();
453
+ }
454
+ const url = buildUrl(this.#baseUrl, `/task/tags/update/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`);
455
+ const signal = AbortSignal.timeout(30_000);
456
+ const body = { name };
457
+ if (color !== undefined)
458
+ body.color = color;
459
+ const res = await this.#adapter.invoke(url, {
460
+ method: 'PATCH',
461
+ body: safeStringify(body),
462
+ contentType: 'application/json',
463
+ signal,
464
+ telemetry: {
465
+ name: 'agentuity.task.updateTag',
466
+ attributes: { tagId },
467
+ },
468
+ });
469
+ if (res.ok) {
470
+ if (res.data.success) {
471
+ return res.data.data;
472
+ }
473
+ throw new TaskStorageResponseError({
474
+ status: res.response.status,
475
+ message: res.data.message,
476
+ });
477
+ }
478
+ throw await toServiceException('PATCH', url, res.response);
479
+ }
480
+ async deleteTag(tagId) {
481
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
482
+ throw new TagIdRequiredError();
483
+ }
484
+ const url = buildUrl(this.#baseUrl, `/task/tags/delete/${TASK_API_VERSION}/${encodeURIComponent(tagId)}`);
485
+ const signal = AbortSignal.timeout(30_000);
486
+ const res = await this.#adapter.invoke(url, {
487
+ method: 'DELETE',
488
+ signal,
489
+ telemetry: {
490
+ name: 'agentuity.task.deleteTag',
491
+ attributes: { tagId },
492
+ },
493
+ });
494
+ if (res.ok) {
495
+ if (res.data?.success === false) {
496
+ throw new TaskStorageResponseError({
497
+ status: res.response.status,
498
+ message: res.data.message ?? 'Operation failed',
499
+ });
500
+ }
501
+ return;
502
+ }
503
+ throw await toServiceException('DELETE', url, res.response);
504
+ }
505
+ async listTags() {
506
+ const url = buildUrl(this.#baseUrl, `/task/tags/list/${TASK_API_VERSION}`);
507
+ const signal = AbortSignal.timeout(30_000);
508
+ const res = await this.#adapter.invoke(url, {
509
+ method: 'GET',
510
+ signal,
511
+ telemetry: {
512
+ name: 'agentuity.task.listTags',
513
+ attributes: {},
514
+ },
515
+ });
516
+ if (res.ok) {
517
+ if (res.data.success) {
518
+ return res.data.data;
519
+ }
520
+ throw new TaskStorageResponseError({
521
+ status: res.response.status,
522
+ message: res.data.message,
523
+ });
524
+ }
525
+ throw await toServiceException('GET', url, res.response);
526
+ }
527
+ async addTagToTask(taskId, tagId) {
528
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
529
+ throw new TaskIdRequiredError();
530
+ }
531
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
532
+ throw new TagIdRequiredError();
533
+ }
534
+ const url = buildUrl(this.#baseUrl, `/task/tags/add/${TASK_API_VERSION}/${encodeURIComponent(taskId)}/${encodeURIComponent(tagId)}`);
535
+ const signal = AbortSignal.timeout(30_000);
536
+ const res = await this.#adapter.invoke(url, {
537
+ method: 'POST',
538
+ signal,
539
+ telemetry: {
540
+ name: 'agentuity.task.addTagToTask',
541
+ attributes: { taskId, tagId },
542
+ },
543
+ });
544
+ if (res.ok) {
545
+ if (res.data?.success === false) {
546
+ throw new TaskStorageResponseError({
547
+ status: res.response.status,
548
+ message: res.data.message ?? 'Operation failed',
549
+ });
550
+ }
551
+ return;
552
+ }
553
+ throw await toServiceException('POST', url, res.response);
554
+ }
555
+ async removeTagFromTask(taskId, tagId) {
556
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
557
+ throw new TaskIdRequiredError();
558
+ }
559
+ if (!tagId || typeof tagId !== 'string' || tagId.trim().length === 0) {
560
+ throw new TagIdRequiredError();
561
+ }
562
+ const url = buildUrl(this.#baseUrl, `/task/tags/remove/${TASK_API_VERSION}/${encodeURIComponent(taskId)}/${encodeURIComponent(tagId)}`);
563
+ const signal = AbortSignal.timeout(30_000);
564
+ const res = await this.#adapter.invoke(url, {
565
+ method: 'DELETE',
566
+ signal,
567
+ telemetry: {
568
+ name: 'agentuity.task.removeTagFromTask',
569
+ attributes: { taskId, tagId },
570
+ },
571
+ });
572
+ if (res.ok) {
573
+ if (res.data?.success === false) {
574
+ throw new TaskStorageResponseError({
575
+ status: res.response.status,
576
+ message: res.data.message ?? 'Operation failed',
577
+ });
578
+ }
579
+ return;
580
+ }
581
+ throw await toServiceException('DELETE', url, res.response);
582
+ }
583
+ async listTagsForTask(taskId) {
584
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
585
+ throw new TaskIdRequiredError();
586
+ }
587
+ const url = buildUrl(this.#baseUrl, `/task/tags/task/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
588
+ const signal = AbortSignal.timeout(30_000);
589
+ const res = await this.#adapter.invoke(url, {
590
+ method: 'GET',
591
+ signal,
592
+ telemetry: {
593
+ name: 'agentuity.task.listTagsForTask',
594
+ attributes: { taskId },
595
+ },
596
+ });
597
+ if (res.ok) {
598
+ if (res.data.success) {
599
+ return res.data.data;
600
+ }
601
+ throw new TaskStorageResponseError({
602
+ status: res.response.status,
603
+ message: res.data.message,
604
+ });
605
+ }
606
+ throw await toServiceException('GET', url, res.response);
607
+ }
608
+ // Attachment methods
609
+ async uploadAttachment(taskId, params) {
610
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
611
+ throw new TaskIdRequiredError();
612
+ }
613
+ const url = buildUrl(this.#baseUrl, `/task/attachments/presign-upload/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
614
+ const signal = AbortSignal.timeout(30_000);
615
+ const res = await this.#adapter.invoke(url, {
616
+ method: 'POST',
617
+ body: safeStringify(params),
618
+ contentType: 'application/json',
619
+ signal,
620
+ telemetry: {
621
+ name: 'agentuity.task.uploadAttachment',
622
+ attributes: { taskId },
623
+ },
624
+ });
625
+ if (res.ok) {
626
+ if (res.data.success) {
627
+ return res.data.data;
628
+ }
629
+ throw new TaskStorageResponseError({
630
+ status: res.response.status,
631
+ message: res.data.message,
632
+ });
633
+ }
634
+ throw await toServiceException('POST', url, res.response);
635
+ }
636
+ async confirmAttachment(attachmentId) {
637
+ if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
638
+ throw new AttachmentIdRequiredError();
639
+ }
640
+ const url = buildUrl(this.#baseUrl, `/task/attachments/confirm/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`);
641
+ const signal = AbortSignal.timeout(30_000);
642
+ const res = await this.#adapter.invoke(url, {
643
+ method: 'POST',
644
+ signal,
645
+ telemetry: {
646
+ name: 'agentuity.task.confirmAttachment',
647
+ attributes: { attachmentId },
648
+ },
649
+ });
650
+ if (res.ok) {
651
+ if (res.data.success) {
652
+ return res.data.data;
653
+ }
654
+ throw new TaskStorageResponseError({
655
+ status: res.response.status,
656
+ message: res.data.message,
657
+ });
658
+ }
659
+ throw await toServiceException('POST', url, res.response);
660
+ }
661
+ async downloadAttachment(attachmentId) {
662
+ if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
663
+ throw new AttachmentIdRequiredError();
664
+ }
665
+ const url = buildUrl(this.#baseUrl, `/task/attachments/presign-download/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`);
666
+ const signal = AbortSignal.timeout(30_000);
667
+ const res = await this.#adapter.invoke(url, {
668
+ method: 'POST',
669
+ signal,
670
+ telemetry: {
671
+ name: 'agentuity.task.downloadAttachment',
672
+ attributes: { attachmentId },
673
+ },
674
+ });
675
+ if (res.ok) {
676
+ if (res.data.success) {
677
+ return res.data.data;
678
+ }
679
+ throw new TaskStorageResponseError({
680
+ status: res.response.status,
681
+ message: res.data.message,
682
+ });
683
+ }
684
+ throw await toServiceException('POST', url, res.response);
685
+ }
686
+ async listAttachments(taskId) {
687
+ if (!taskId || typeof taskId !== 'string' || taskId.trim().length === 0) {
688
+ throw new TaskIdRequiredError();
689
+ }
690
+ const url = buildUrl(this.#baseUrl, `/task/attachments/list/${TASK_API_VERSION}/${encodeURIComponent(taskId)}`);
691
+ const signal = AbortSignal.timeout(30_000);
692
+ const res = await this.#adapter.invoke(url, {
693
+ method: 'GET',
694
+ signal,
695
+ telemetry: {
696
+ name: 'agentuity.task.listAttachments',
697
+ attributes: { taskId },
698
+ },
699
+ });
700
+ if (res.ok) {
701
+ if (res.data.success) {
702
+ return res.data.data;
703
+ }
704
+ throw new TaskStorageResponseError({
705
+ status: res.response.status,
706
+ message: res.data.message,
707
+ });
708
+ }
709
+ throw await toServiceException('GET', url, res.response);
710
+ }
711
+ async deleteAttachment(attachmentId) {
712
+ if (!attachmentId || typeof attachmentId !== 'string' || attachmentId.trim().length === 0) {
713
+ throw new AttachmentIdRequiredError();
714
+ }
715
+ const url = buildUrl(this.#baseUrl, `/task/attachments/delete/${TASK_API_VERSION}/${encodeURIComponent(attachmentId)}`);
716
+ const signal = AbortSignal.timeout(30_000);
717
+ const res = await this.#adapter.invoke(url, {
718
+ method: 'DELETE',
719
+ signal,
720
+ telemetry: {
721
+ name: 'agentuity.task.deleteAttachment',
722
+ attributes: { attachmentId },
723
+ },
724
+ });
725
+ if (res.ok) {
726
+ if (res.data?.success === false) {
727
+ throw new TaskStorageResponseError({
728
+ status: res.response.status,
729
+ message: res.data.message ?? 'Operation failed',
730
+ });
731
+ }
732
+ return;
733
+ }
734
+ throw await toServiceException('DELETE', url, res.response);
735
+ }
736
+ async listUsers() {
737
+ const url = buildUrl(this.#baseUrl, `/task/users/${TASK_API_VERSION}`);
738
+ const signal = AbortSignal.timeout(30_000);
739
+ const res = await this.#adapter.invoke(url, {
740
+ method: 'GET',
741
+ signal,
742
+ telemetry: {
743
+ name: 'agentuity.task.listUsers',
744
+ attributes: {},
745
+ },
746
+ });
747
+ if (res.ok) {
748
+ if (res.data.success) {
749
+ return res.data.data;
750
+ }
751
+ throw new TaskStorageResponseError({
752
+ status: res.response.status,
753
+ message: res.data.message,
754
+ });
755
+ }
756
+ throw await toServiceException('GET', url, res.response);
757
+ }
758
+ async listProjects() {
759
+ const url = buildUrl(this.#baseUrl, `/task/projects/${TASK_API_VERSION}`);
760
+ const signal = AbortSignal.timeout(30_000);
761
+ const res = await this.#adapter.invoke(url, {
762
+ method: 'GET',
763
+ signal,
764
+ telemetry: {
765
+ name: 'agentuity.task.listProjects',
766
+ attributes: {},
767
+ },
768
+ });
769
+ if (res.ok) {
770
+ if (res.data.success) {
771
+ return res.data.data;
772
+ }
773
+ throw new TaskStorageResponseError({
774
+ status: res.response.status,
775
+ message: res.data.message,
776
+ });
777
+ }
778
+ throw await toServiceException('GET', url, res.response);
779
+ }
780
+ async getActivity(params) {
781
+ const queryParams = new URLSearchParams();
782
+ if (params?.days !== undefined)
783
+ queryParams.set('days', String(params.days));
784
+ const queryString = queryParams.toString();
785
+ const url = buildUrl(this.#baseUrl, `/task/activity/${TASK_ACTIVITY_API_VERSION}${queryString ? `?${queryString}` : ''}`);
786
+ const signal = AbortSignal.timeout(30_000);
787
+ const res = await this.#adapter.invoke(url, {
788
+ method: 'GET',
789
+ signal,
790
+ telemetry: {
791
+ name: 'agentuity.task.activity',
792
+ attributes: {
793
+ ...(params?.days !== undefined ? { days: String(params.days) } : {}),
794
+ },
795
+ },
796
+ });
797
+ if (res.ok) {
798
+ if (res.data.success) {
799
+ return res.data.data;
800
+ }
801
+ throw new TaskStorageResponseError({
802
+ status: res.response.status,
803
+ message: res.data.message,
804
+ });
805
+ }
806
+ throw await toServiceException('GET', url, res.response);
807
+ }
207
808
  }
208
809
  //# sourceMappingURL=task.js.map