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