@agentuity/server 1.0.32 → 1.0.33
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/api/api.d.ts +1 -227
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +1 -637
- package/dist/api/api.js.map +1 -1
- package/dist/api/index.d.ts +1 -17
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -17
- package/dist/api/index.js.map +1 -1
- package/dist/api/org/env-delete.d.ts +1 -22
- package/dist/api/org/env-delete.d.ts.map +1 -1
- package/dist/api/org/env-delete.js +1 -24
- package/dist/api/org/env-delete.js.map +1 -1
- package/dist/api/org/env-get.d.ts +1 -32
- package/dist/api/org/env-get.d.ts.map +1 -1
- package/dist/api/org/env-get.js +1 -25
- package/dist/api/org/env-get.js.map +1 -1
- package/dist/api/org/env-update.d.ts +1 -23
- package/dist/api/org/env-update.d.ts.map +1 -1
- package/dist/api/org/env-update.js +1 -25
- package/dist/api/org/env-update.js.map +1 -1
- package/dist/api/project/get.d.ts +1 -42
- package/dist/api/project/get.d.ts.map +1 -1
- package/dist/api/project/get.js +1 -35
- package/dist/api/project/get.js.map +1 -1
- package/dist/api/project/list.d.ts +1 -47
- package/dist/api/project/list.d.ts.map +1 -1
- package/dist/api/project/list.js +1 -37
- package/dist/api/project/list.js.map +1 -1
- package/dist/api/project/malware.d.ts +1 -70
- package/dist/api/project/malware.d.ts.map +1 -1
- package/dist/api/project/malware.js +1 -41
- package/dist/api/project/malware.js.map +1 -1
- package/dist/api/region/create.d.ts +1 -80
- package/dist/api/region/create.d.ts.map +1 -1
- package/dist/api/region/create.js +1 -176
- package/dist/api/region/create.js.map +1 -1
- package/dist/api/sandbox/client.d.ts +1 -190
- package/dist/api/sandbox/client.d.ts.map +1 -1
- package/dist/api/sandbox/client.js +1 -260
- package/dist/api/sandbox/client.js.map +1 -1
- package/dist/api/sandbox/pause.d.ts +1 -21
- package/dist/api/sandbox/pause.d.ts.map +1 -1
- package/dist/api/sandbox/pause.js +1 -24
- package/dist/api/sandbox/pause.js.map +1 -1
- package/dist/api/sandbox/resume.d.ts +1 -21
- package/dist/api/sandbox/resume.d.ts.map +1 -1
- package/dist/api/sandbox/resume.js +1 -24
- package/dist/api/sandbox/resume.js.map +1 -1
- package/dist/api/sandbox/util.d.ts +1 -284
- package/dist/api/sandbox/util.d.ts.map +1 -1
- package/dist/api/sandbox/util.js +1 -210
- package/dist/api/sandbox/util.js.map +1 -1
- package/dist/api/user/whoami.d.ts +1 -38
- package/dist/api/user/whoami.d.ts.map +1 -1
- package/dist/api/user/whoami.js +1 -26
- package/dist/api/user/whoami.js.map +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/api/api.ts +1 -936
- package/src/api/index.ts +1 -17
- package/src/api/org/env-delete.ts +1 -37
- package/src/api/org/env-get.ts +1 -43
- package/src/api/org/env-update.ts +1 -38
- package/src/api/project/get.ts +1 -49
- package/src/api/project/list.ts +1 -54
- package/src/api/project/malware.ts +1 -68
- package/src/api/region/create.ts +1 -207
- package/src/api/sandbox/client.ts +1 -460
- package/src/api/sandbox/pause.ts +1 -39
- package/src/api/sandbox/resume.ts +1 -39
- package/src/api/sandbox/util.ts +1 -276
- package/src/api/user/whoami.ts +1 -32
- package/src/index.ts +3 -30
- 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 +0 -19
- package/dist/api/apikey/delete.d.ts.map +0 -1
- package/dist/api/apikey/delete.js +0 -19
- package/dist/api/apikey/delete.js.map +0 -1
- package/dist/api/apikey/get.d.ts +0 -45
- package/dist/api/apikey/get.d.ts.map +0 -1
- package/dist/api/apikey/get.js +0 -36
- package/dist/api/apikey/get.js.map +0 -1
- package/dist/api/apikey/index.d.ts +0 -6
- package/dist/api/apikey/index.d.ts.map +0 -1
- package/dist/api/apikey/index.js +0 -6
- 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 +0 -23
- package/dist/api/apikey/util.d.ts.map +0 -1
- package/dist/api/apikey/util.js +0 -3
- package/dist/api/apikey/util.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 +0 -70
- package/dist/api/db/logs.d.ts.map +0 -1
- package/dist/api/db/logs.js +0 -59
- 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 +0 -31
- package/dist/api/db/util.d.ts.map +0 -1
- package/dist/api/db/util.js +0 -4
- package/dist/api/db/util.js.map +0 -1
- package/dist/api/eval/get.d.ts +0 -36
- package/dist/api/eval/get.d.ts.map +0 -1
- package/dist/api/eval/get.js +0 -23
- 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 +0 -50
- package/dist/api/eval/list.d.ts.map +0 -1
- package/dist/api/eval/list.js +0 -32
- package/dist/api/eval/list.js.map +0 -1
- package/dist/api/eval/run-get.d.ts +0 -48
- package/dist/api/eval/run-get.d.ts.map +0 -1
- package/dist/api/eval/run-get.js +0 -29
- package/dist/api/eval/run-get.js.map +0 -1
- package/dist/api/eval/run-list.d.ts +0 -70
- package/dist/api/eval/run-list.d.ts.map +0 -1
- package/dist/api/eval/run-list.js +0 -42
- package/dist/api/eval/run-list.js.map +0 -1
- package/dist/api/machine/index.d.ts +0 -3
- package/dist/api/machine/index.d.ts.map +0 -1
- package/dist/api/machine/index.js +0 -3
- package/dist/api/machine/index.js.map +0 -1
- package/dist/api/machine/machine.d.ts +0 -192
- 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 +0 -14
- package/dist/api/machine/util.d.ts.map +0 -1
- package/dist/api/machine/util.js +0 -3
- package/dist/api/machine/util.js.map +0 -1
- package/dist/api/org/index.d.ts +0 -7
- package/dist/api/org/index.d.ts.map +0 -1
- package/dist/api/org/index.js +0 -7
- package/dist/api/org/index.js.map +0 -1
- package/dist/api/org/list.d.ts +0 -27
- package/dist/api/org/list.d.ts.map +0 -1
- package/dist/api/org/list.js +0 -22
- 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 +0 -45
- package/dist/api/org/util.d.ts.map +0 -1
- package/dist/api/org/util.js +0 -4
- package/dist/api/org/util.js.map +0 -1
- package/dist/api/project/agent.d.ts +0 -89
- package/dist/api/project/agent.d.ts.map +0 -1
- package/dist/api/project/agent.js +0 -60
- package/dist/api/project/agent.js.map +0 -1
- package/dist/api/project/create.d.ts +0 -37
- package/dist/api/project/create.d.ts.map +0 -1
- package/dist/api/project/create.js +0 -31
- package/dist/api/project/create.js.map +0 -1
- package/dist/api/project/delete.d.ts +0 -15
- 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 +0 -313
- package/dist/api/project/deploy.js.map +0 -1
- package/dist/api/project/deployment.d.ts +0 -237
- 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 +0 -22
- package/dist/api/project/env-delete.d.ts.map +0 -1
- package/dist/api/project/env-delete.js +0 -29
- package/dist/api/project/env-delete.js.map +0 -1
- package/dist/api/project/env-update.d.ts +0 -31
- package/dist/api/project/env-update.d.ts.map +0 -1
- package/dist/api/project/env-update.js +0 -36
- package/dist/api/project/env-update.js.map +0 -1
- package/dist/api/project/exists.d.ts +0 -25
- package/dist/api/project/exists.d.ts.map +0 -1
- package/dist/api/project/exists.js +0 -45
- package/dist/api/project/exists.js.map +0 -1
- package/dist/api/project/hostname.d.ts +0 -25
- 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 +0 -14
- package/dist/api/project/index.d.ts.map +0 -1
- package/dist/api/project/index.js +0 -14
- package/dist/api/project/index.js.map +0 -1
- package/dist/api/project/update-region.d.ts +0 -27
- package/dist/api/project/update-region.d.ts.map +0 -1
- package/dist/api/project/update-region.js +0 -25
- package/dist/api/project/update-region.js.map +0 -1
- package/dist/api/project/util.d.ts +0 -62
- package/dist/api/project/util.d.ts.map +0 -1
- package/dist/api/project/util.js +0 -6
- 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 +0 -166
- 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 +0 -549
- 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 +0 -321
- 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 -235
- 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 -168
- package/dist/api/queue/websocket.d.ts.map +0 -1
- package/dist/api/queue/websocket.js +0 -394
- package/dist/api/queue/websocket.js.map +0 -1
- package/dist/api/region/delete.d.ts +0 -62
- package/dist/api/region/delete.d.ts.map +0 -1
- package/dist/api/region/delete.js +0 -37
- package/dist/api/region/delete.js.map +0 -1
- package/dist/api/region/index.d.ts +0 -5
- package/dist/api/region/index.d.ts.map +0 -1
- package/dist/api/region/index.js +0 -5
- package/dist/api/region/index.js.map +0 -1
- package/dist/api/region/list.d.ts +0 -27
- package/dist/api/region/list.d.ts.map +0 -1
- package/dist/api/region/list.js +0 -22
- package/dist/api/region/list.js.map +0 -1
- package/dist/api/region/resources.d.ts +0 -71
- package/dist/api/region/resources.d.ts.map +0 -1
- package/dist/api/region/resources.js +0 -53
- package/dist/api/region/resources.js.map +0 -1
- package/dist/api/region/util.d.ts +0 -23
- package/dist/api/region/util.d.ts.map +0 -1
- package/dist/api/region/util.js +0 -3
- 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/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/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/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 +0 -48
- package/dist/api/sandbox/snapshot-build.d.ts.map +0 -1
- package/dist/api/sandbox/snapshot-build.js +0 -74
- 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/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 +0 -56
- 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 +0 -40
- package/dist/api/session/logs.d.ts.map +0 -1
- package/dist/api/session/logs.js +0 -28
- package/dist/api/session/logs.js.map +0 -1
- package/dist/api/session/util.d.ts +0 -23
- package/dist/api/session/util.d.ts.map +0 -1
- package/dist/api/session/util.js +0 -3
- package/dist/api/session/util.js.map +0 -1
- package/dist/api/storage/config.d.ts +0 -99
- package/dist/api/storage/config.d.ts.map +0 -1
- package/dist/api/storage/config.js +0 -61
- package/dist/api/storage/config.js.map +0 -1
- package/dist/api/storage/index.d.ts +0 -5
- package/dist/api/storage/index.d.ts.map +0 -1
- package/dist/api/storage/index.js +0 -5
- 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 +0 -161
- package/dist/api/storage/types.d.ts.map +0 -1
- package/dist/api/storage/types.js +0 -141
- package/dist/api/storage/types.js.map +0 -1
- package/dist/api/storage/util.d.ts +0 -48
- package/dist/api/storage/util.d.ts.map +0 -1
- package/dist/api/storage/util.js +0 -8
- package/dist/api/storage/util.js.map +0 -1
- package/dist/api/stream/get.d.ts +0 -58
- package/dist/api/stream/get.d.ts.map +0 -1
- package/dist/api/stream/get.js +0 -40
- 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 +0 -23
- package/dist/api/stream/util.d.ts.map +0 -1
- package/dist/api/stream/util.js +0 -3
- package/dist/api/stream/util.js.map +0 -1
- package/dist/api/thread/delete.d.ts +0 -23
- package/dist/api/thread/delete.d.ts.map +0 -1
- package/dist/api/thread/delete.js +0 -21
- package/dist/api/thread/delete.js.map +0 -1
- package/dist/api/thread/get.d.ts +0 -36
- package/dist/api/thread/get.d.ts.map +0 -1
- package/dist/api/thread/get.js +0 -23
- package/dist/api/thread/get.js.map +0 -1
- package/dist/api/thread/index.d.ts +0 -5
- package/dist/api/thread/index.d.ts.map +0 -1
- package/dist/api/thread/index.js +0 -5
- 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 +0 -23
- package/dist/api/thread/util.d.ts.map +0 -1
- package/dist/api/thread/util.js +0 -3
- package/dist/api/thread/util.js.map +0 -1
- package/dist/api/user/index.d.ts +0 -2
- package/dist/api/user/index.d.ts.map +0 -1
- package/dist/api/user/index.js +0 -2
- package/dist/api/user/index.js.map +0 -1
- package/dist/api/user/util.d.ts +0 -23
- package/dist/api/user/util.d.ts.map +0 -1
- package/dist/api/user/util.js +0 -3
- package/dist/api/user/util.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 +0 -79
- 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 +0 -137
- 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 +0 -77
- package/dist/api/webhook/receipts.d.ts.map +0 -1
- package/dist/api/webhook/receipts.js +0 -78
- 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 +0 -202
- package/dist/api/webhook/util.d.ts.map +0 -1
- package/dist/api/webhook/util.js +0 -201
- 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 +0 -165
- package/dist/api/webhook/webhooks.js.map +0 -1
- package/src/api/api-example.md +0 -164
- package/src/api/apikey/create.ts +0 -41
- package/src/api/apikey/delete.ts +0 -30
- package/src/api/apikey/get.ts +0 -48
- package/src/api/apikey/index.ts +0 -5
- package/src/api/apikey/list.ts +0 -64
- package/src/api/apikey/util.ts +0 -3
- package/src/api/db/index.ts +0 -27
- package/src/api/db/logs.ts +0 -75
- package/src/api/db/query.ts +0 -67
- package/src/api/db/tables.ts +0 -92
- package/src/api/db/util.ts +0 -9
- package/src/api/eval/get.ts +0 -33
- package/src/api/eval/index.ts +0 -28
- package/src/api/eval/list.ts +0 -49
- package/src/api/eval/run-get.ts +0 -39
- package/src/api/eval/run-list.ts +0 -59
- package/src/api/machine/index.ts +0 -2
- package/src/api/machine/machine.ts +0 -160
- package/src/api/machine/util.ts +0 -5
- package/src/api/org/index.ts +0 -6
- package/src/api/org/list.ts +0 -28
- package/src/api/org/resources.ts +0 -140
- package/src/api/org/util.ts +0 -4
- package/src/api/project/agent.ts +0 -86
- package/src/api/project/create.ts +0 -47
- 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/env-delete.ts +0 -45
- package/src/api/project/env-update.ts +0 -55
- package/src/api/project/exists.ts +0 -58
- package/src/api/project/hostname.ts +0 -73
- package/src/api/project/index.ts +0 -13
- package/src/api/project/update-region.ts +0 -44
- package/src/api/project/util.ts +0 -8
- package/src/api/queue/analytics.ts +0 -311
- package/src/api/queue/destinations.ts +0 -259
- package/src/api/queue/dlq.ts +0 -243
- package/src/api/queue/index.ts +0 -308
- package/src/api/queue/messages.ts +0 -784
- package/src/api/queue/queues.ts +0 -460
- package/src/api/queue/sources.ts +0 -294
- package/src/api/queue/types.ts +0 -1325
- package/src/api/queue/util.ts +0 -278
- package/src/api/queue/validation.ts +0 -560
- package/src/api/queue/websocket.ts +0 -514
- package/src/api/region/delete.ts +0 -57
- package/src/api/region/index.ts +0 -4
- package/src/api/region/list.ts +0 -32
- package/src/api/region/resources.ts +0 -69
- package/src/api/region/util.ts +0 -3
- package/src/api/sandbox/cli-list.ts +0 -127
- 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/resolve.ts +0 -98
- package/src/api/sandbox/run.ts +0 -439
- package/src/api/sandbox/runtime.ts +0 -100
- package/src/api/sandbox/snapshot-build.ts +0 -98
- package/src/api/sandbox/snapshot.ts +0 -781
- 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/session/logs.ts +0 -47
- package/src/api/session/util.ts +0 -3
- package/src/api/storage/config.ts +0 -111
- package/src/api/storage/index.ts +0 -4
- package/src/api/storage/objects.ts +0 -250
- package/src/api/storage/types.ts +0 -174
- package/src/api/storage/util.ts +0 -10
- package/src/api/stream/get.ts +0 -51
- package/src/api/stream/index.ts +0 -3
- package/src/api/stream/list.ts +0 -127
- package/src/api/stream/util.ts +0 -3
- package/src/api/thread/delete.ts +0 -31
- package/src/api/thread/get.ts +0 -34
- package/src/api/thread/index.ts +0 -4
- package/src/api/thread/list.ts +0 -76
- package/src/api/thread/util.ts +0 -3
- package/src/api/user/index.ts +0 -1
- package/src/api/user/util.ts +0 -3
- package/src/api/webhook/deliveries.ts +0 -129
- package/src/api/webhook/destinations.ts +0 -224
- package/src/api/webhook/index.ts +0 -133
- package/src/api/webhook/receipts.ts +0 -124
- package/src/api/webhook/types.ts +0 -309
- package/src/api/webhook/util.ts +0 -237
- package/src/api/webhook/webhooks.ts +0 -260
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module websocket
|
|
3
|
-
*
|
|
4
|
-
* WebSocket client for real-time queue message subscriptions.
|
|
5
|
-
*
|
|
6
|
-
* Provides both a callback-based API ({@link createQueueWebSocket}) and an
|
|
7
|
-
* async iterator API ({@link subscribeToQueue}) for receiving messages from
|
|
8
|
-
* a queue in real time via WebSocket.
|
|
9
|
-
*
|
|
10
|
-
* @example Callback-based API
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { createQueueWebSocket } from '@agentuity/server';
|
|
13
|
-
*
|
|
14
|
-
* const connection = createQueueWebSocket({
|
|
15
|
-
* queueName: 'order-processing',
|
|
16
|
-
* baseUrl: 'https://catalyst.agentuity.cloud',
|
|
17
|
-
* onMessage: (message) => {
|
|
18
|
-
* console.log('Received:', message.id, message.payload);
|
|
19
|
-
* },
|
|
20
|
-
* onOpen: () => console.log('Connected'),
|
|
21
|
-
* onClose: (code, reason) => console.log('Closed:', code, reason),
|
|
22
|
-
* onError: (error) => console.error('Error:', error),
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* // Later: close the connection
|
|
26
|
-
* connection.close();
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example Resuming from a previous session
|
|
30
|
-
* ```typescript
|
|
31
|
-
* import { createQueueWebSocket } from '@agentuity/server';
|
|
32
|
-
*
|
|
33
|
-
* // Use a previously obtained clientId and lastOffset to resume
|
|
34
|
-
* const connection = createQueueWebSocket({
|
|
35
|
-
* queueName: 'order-processing',
|
|
36
|
-
* baseUrl: 'https://catalyst.agentuity.cloud',
|
|
37
|
-
* clientId: previousClientId,
|
|
38
|
-
* lastOffset: previousOffset,
|
|
39
|
-
* onMessage: (message) => {
|
|
40
|
-
* console.log('Received:', message.id, message.payload);
|
|
41
|
-
* },
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @example Async iterator API
|
|
46
|
-
* ```typescript
|
|
47
|
-
* import { subscribeToQueue } from '@agentuity/server';
|
|
48
|
-
*
|
|
49
|
-
* const controller = new AbortController();
|
|
50
|
-
* for await (const message of subscribeToQueue({
|
|
51
|
-
* queueName: 'order-processing',
|
|
52
|
-
* baseUrl: 'https://catalyst.agentuity.cloud',
|
|
53
|
-
* signal: controller.signal,
|
|
54
|
-
* })) {
|
|
55
|
-
* console.log('Received:', message.id, message.payload);
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
import type { Message } from './types.ts';
|
|
61
|
-
import { WebSocketAuthResponseSchema, WebSocketMessageSchema } from './types.ts';
|
|
62
|
-
import { QueueError } from './util.ts';
|
|
63
|
-
import { validateQueueName } from './validation.ts';
|
|
64
|
-
|
|
65
|
-
// ============================================================================
|
|
66
|
-
// Types
|
|
67
|
-
// ============================================================================
|
|
68
|
-
|
|
69
|
-
/** Connection state for a queue WebSocket connection. */
|
|
70
|
-
export type QueueWebSocketState =
|
|
71
|
-
| 'connecting'
|
|
72
|
-
| 'authenticating'
|
|
73
|
-
| 'connected'
|
|
74
|
-
| 'reconnecting'
|
|
75
|
-
| 'closed';
|
|
76
|
-
|
|
77
|
-
/** Options for creating a queue WebSocket subscription. */
|
|
78
|
-
export interface QueueWebSocketOptions {
|
|
79
|
-
/** Queue name to subscribe to. */
|
|
80
|
-
queueName: string;
|
|
81
|
-
/** API key for authentication (if not provided, uses AGENTUITY_SDK_KEY env var). */
|
|
82
|
-
apiKey?: string;
|
|
83
|
-
/** Base URL of the catalyst service (e.g., https://catalyst.agentuity.cloud). */
|
|
84
|
-
baseUrl: string;
|
|
85
|
-
/** Called when a message is received. */
|
|
86
|
-
onMessage: (message: Message) => void;
|
|
87
|
-
/** Called when the connection is established and authenticated. */
|
|
88
|
-
onOpen?: () => void;
|
|
89
|
-
/** Called when the connection is closed. */
|
|
90
|
-
onClose?: (code: number, reason: string) => void;
|
|
91
|
-
/** Called when an error occurs. */
|
|
92
|
-
onError?: (error: Error) => void;
|
|
93
|
-
/** Whether to automatically reconnect on disconnection (default: true). */
|
|
94
|
-
autoReconnect?: boolean;
|
|
95
|
-
/** Maximum number of reconnection attempts (default: Infinity). */
|
|
96
|
-
maxReconnectAttempts?: number;
|
|
97
|
-
/** Initial reconnection delay in ms (default: 1000). Uses exponential backoff. */
|
|
98
|
-
reconnectDelayMs?: number;
|
|
99
|
-
/** Maximum reconnection delay in ms (default: 30000). */
|
|
100
|
-
maxReconnectDelayMs?: number;
|
|
101
|
-
/** Optional client ID from a previous session to resume a subscription. */
|
|
102
|
-
clientId?: string;
|
|
103
|
-
/** Optional last processed offset from a previous session to resume from. */
|
|
104
|
-
lastOffset?: number;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** Return type from {@link createQueueWebSocket}. */
|
|
108
|
-
export interface QueueWebSocketConnection {
|
|
109
|
-
/** Close the WebSocket connection. Disables auto-reconnect. */
|
|
110
|
-
close(): void;
|
|
111
|
-
/** The current connection state. */
|
|
112
|
-
readonly state: QueueWebSocketState;
|
|
113
|
-
/** The client/subscription ID assigned by the server. Stable across reconnections. */
|
|
114
|
-
readonly clientId: string | undefined;
|
|
115
|
-
/** The offset of the last message processed. */
|
|
116
|
-
readonly lastOffset: number | undefined;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** Options for the async iterator queue subscription. */
|
|
120
|
-
export interface SubscribeToQueueOptions {
|
|
121
|
-
/** Queue name to subscribe to. */
|
|
122
|
-
queueName: string;
|
|
123
|
-
/** API key for authentication (if not provided, uses AGENTUITY_SDK_KEY env var). */
|
|
124
|
-
apiKey?: string;
|
|
125
|
-
/** Base URL of the catalyst service. */
|
|
126
|
-
baseUrl: string;
|
|
127
|
-
/** AbortSignal to stop the subscription. */
|
|
128
|
-
signal?: AbortSignal;
|
|
129
|
-
/** Optional client ID from a previous session to resume a subscription. */
|
|
130
|
-
clientId?: string;
|
|
131
|
-
/** Optional last processed offset from a previous session to resume from. */
|
|
132
|
-
lastOffset?: number;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// ============================================================================
|
|
136
|
-
// Internal Helpers
|
|
137
|
-
// ============================================================================
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Resolve the API key from the options or the AGENTUITY_SDK_KEY environment variable.
|
|
141
|
-
* Throws a {@link QueueError} if no API key is available.
|
|
142
|
-
*/
|
|
143
|
-
function resolveApiKey(apiKey?: string): string {
|
|
144
|
-
const key = apiKey ?? process.env.AGENTUITY_SDK_KEY;
|
|
145
|
-
if (!key) {
|
|
146
|
-
throw new QueueError({
|
|
147
|
-
message:
|
|
148
|
-
'No API key provided. Pass apiKey in options or set the AGENTUITY_SDK_KEY environment variable.',
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return key;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Convert an HTTP(S) base URL to a WebSocket URL and append the queue path.
|
|
156
|
-
*
|
|
157
|
-
* The WebSocket route is registered at `/queue/ws/{name}` (not versioned).
|
|
158
|
-
*/
|
|
159
|
-
function buildWebSocketUrl(baseUrl: string, queueName: string): string {
|
|
160
|
-
const wsUrl = baseUrl.replace(/^https:\/\//, 'wss://').replace(/^http:\/\//, 'ws://');
|
|
161
|
-
// Remove trailing slash if present
|
|
162
|
-
const base = wsUrl.replace(/\/$/, '');
|
|
163
|
-
return `${base}/queue/ws/${encodeURIComponent(queueName)}`;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ============================================================================
|
|
167
|
-
// Callback-based API
|
|
168
|
-
// ============================================================================
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Create a WebSocket connection to receive real-time messages from a queue.
|
|
172
|
-
*
|
|
173
|
-
* The connection handles authentication, automatic reconnection with exponential
|
|
174
|
-
* backoff, and ping/pong keep-alive (handled automatically by the WebSocket
|
|
175
|
-
* implementation).
|
|
176
|
-
*
|
|
177
|
-
* @param options - Configuration for the WebSocket connection
|
|
178
|
-
* @returns A {@link QueueWebSocketConnection} handle for managing the connection
|
|
179
|
-
* @throws {QueueError} If no API key is available
|
|
180
|
-
* @throws {QueueValidationError} If the queue name is invalid
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```typescript
|
|
184
|
-
* const connection = createQueueWebSocket({
|
|
185
|
-
* queueName: 'order-processing',
|
|
186
|
-
* baseUrl: 'https://catalyst.agentuity.cloud',
|
|
187
|
-
* onMessage: (message) => {
|
|
188
|
-
* console.log('Received:', message.id, message.payload);
|
|
189
|
-
* },
|
|
190
|
-
* });
|
|
191
|
-
*
|
|
192
|
-
* // Later: close the connection
|
|
193
|
-
* connection.close();
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
export function createQueueWebSocket(options: QueueWebSocketOptions): QueueWebSocketConnection {
|
|
197
|
-
// Validate inputs eagerly so callers get immediate feedback.
|
|
198
|
-
validateQueueName(options.queueName);
|
|
199
|
-
const apiKey = resolveApiKey(options.apiKey);
|
|
200
|
-
|
|
201
|
-
const {
|
|
202
|
-
queueName,
|
|
203
|
-
baseUrl,
|
|
204
|
-
onMessage,
|
|
205
|
-
onOpen,
|
|
206
|
-
onClose,
|
|
207
|
-
onError,
|
|
208
|
-
autoReconnect = true,
|
|
209
|
-
maxReconnectAttempts = Infinity,
|
|
210
|
-
reconnectDelayMs = 1000,
|
|
211
|
-
maxReconnectDelayMs = 30000,
|
|
212
|
-
} = options;
|
|
213
|
-
|
|
214
|
-
let state: QueueWebSocketState = 'connecting';
|
|
215
|
-
let ws: WebSocket | null = null;
|
|
216
|
-
let intentionallyClosed = false;
|
|
217
|
-
let reconnectAttempts = 0;
|
|
218
|
-
let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
|
219
|
-
let clientId: string | undefined = options.clientId;
|
|
220
|
-
let lastProcessedOffset: number | undefined = options.lastOffset;
|
|
221
|
-
|
|
222
|
-
function connect() {
|
|
223
|
-
if (intentionallyClosed) return;
|
|
224
|
-
|
|
225
|
-
const url = buildWebSocketUrl(baseUrl, queueName);
|
|
226
|
-
state = reconnectAttempts > 0 ? 'reconnecting' : 'connecting';
|
|
227
|
-
|
|
228
|
-
try {
|
|
229
|
-
ws = new WebSocket(url);
|
|
230
|
-
} catch (err) {
|
|
231
|
-
state = 'closed';
|
|
232
|
-
onError?.(
|
|
233
|
-
new QueueError({
|
|
234
|
-
message: `Failed to create WebSocket connection: ${err instanceof Error ? err.message : String(err)}`,
|
|
235
|
-
queueName,
|
|
236
|
-
cause: err instanceof Error ? err : undefined,
|
|
237
|
-
})
|
|
238
|
-
);
|
|
239
|
-
scheduleReconnect();
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
ws.onopen = () => {
|
|
244
|
-
state = 'authenticating';
|
|
245
|
-
// Send auth message — raw API key, no "Bearer " prefix.
|
|
246
|
-
// Include client_id and last_offset on reconnect for resumption.
|
|
247
|
-
const authPayload: Record<string, unknown> = { authorization: apiKey };
|
|
248
|
-
if (clientId) {
|
|
249
|
-
authPayload.client_id = clientId;
|
|
250
|
-
}
|
|
251
|
-
if (lastProcessedOffset !== undefined) {
|
|
252
|
-
authPayload.last_offset = lastProcessedOffset;
|
|
253
|
-
}
|
|
254
|
-
ws!.send(JSON.stringify(authPayload));
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
/** Whether the auth handshake has completed successfully. */
|
|
258
|
-
let authenticated = false;
|
|
259
|
-
|
|
260
|
-
ws.onmessage = (event: MessageEvent) => {
|
|
261
|
-
const raw = typeof event.data === 'string' ? event.data : String(event.data);
|
|
262
|
-
|
|
263
|
-
if (!authenticated) {
|
|
264
|
-
// First message after open must be the auth response.
|
|
265
|
-
try {
|
|
266
|
-
const parsed = JSON.parse(raw);
|
|
267
|
-
const authResult = WebSocketAuthResponseSchema.safeParse(parsed);
|
|
268
|
-
if (!authResult.success) {
|
|
269
|
-
const err = new QueueError({
|
|
270
|
-
message: `Unexpected auth response from server: ${raw}`,
|
|
271
|
-
queueName,
|
|
272
|
-
});
|
|
273
|
-
onError?.(err);
|
|
274
|
-
ws?.close(4000, 'Invalid auth response');
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (!authResult.data.success) {
|
|
279
|
-
const err = new QueueError({
|
|
280
|
-
message: `Authentication failed: ${authResult.data.error ?? 'Unknown error'}`,
|
|
281
|
-
queueName,
|
|
282
|
-
});
|
|
283
|
-
onError?.(err);
|
|
284
|
-
// Auth rejection is terminal — do not reconnect with the same bad credentials.
|
|
285
|
-
intentionallyClosed = true;
|
|
286
|
-
ws?.close(4001, 'Auth failed');
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
authenticated = true;
|
|
291
|
-
reconnectAttempts = 0; // Reset on successful auth.
|
|
292
|
-
state = 'connected';
|
|
293
|
-
if (authResult.data.client_id) {
|
|
294
|
-
clientId = authResult.data.client_id;
|
|
295
|
-
}
|
|
296
|
-
onOpen?.();
|
|
297
|
-
} catch {
|
|
298
|
-
const err = new QueueError({
|
|
299
|
-
message: `Failed to parse auth response: ${raw}`,
|
|
300
|
-
queueName,
|
|
301
|
-
});
|
|
302
|
-
onError?.(err);
|
|
303
|
-
ws?.close(4000, 'Invalid auth response');
|
|
304
|
-
}
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// Normal message after authentication.
|
|
309
|
-
try {
|
|
310
|
-
const parsed = JSON.parse(raw);
|
|
311
|
-
const msgResult = WebSocketMessageSchema.safeParse(parsed);
|
|
312
|
-
if (msgResult.success && msgResult.data.messages.length > 0) {
|
|
313
|
-
for (const msg of msgResult.data.messages) {
|
|
314
|
-
onMessage(msg);
|
|
315
|
-
if (msg.offset !== undefined) {
|
|
316
|
-
lastProcessedOffset = msg.offset;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
} catch {
|
|
321
|
-
// Non-JSON frames are silently ignored; the server may send
|
|
322
|
-
// ping text frames that are not JSON.
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
ws.onclose = (event: CloseEvent) => {
|
|
327
|
-
state = 'closed';
|
|
328
|
-
ws = null;
|
|
329
|
-
|
|
330
|
-
onClose?.(event.code, event.reason);
|
|
331
|
-
|
|
332
|
-
// Reconnect on any unintentional close — whether we were fully
|
|
333
|
-
// connected, mid-auth, or never authenticated (transient network issue).
|
|
334
|
-
if (!intentionallyClosed) {
|
|
335
|
-
scheduleReconnect();
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
ws.onerror = () => {
|
|
340
|
-
// The browser/Node WebSocket fires `error` then `close`.
|
|
341
|
-
// We report the error but let `onclose` handle reconnection.
|
|
342
|
-
onError?.(
|
|
343
|
-
new QueueError({
|
|
344
|
-
message: 'WebSocket connection error',
|
|
345
|
-
queueName,
|
|
346
|
-
})
|
|
347
|
-
);
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function scheduleReconnect() {
|
|
352
|
-
if (intentionallyClosed || !autoReconnect) return;
|
|
353
|
-
if (reconnectAttempts >= maxReconnectAttempts) {
|
|
354
|
-
onError?.(
|
|
355
|
-
new QueueError({
|
|
356
|
-
message: `Exceeded maximum reconnection attempts (${maxReconnectAttempts})`,
|
|
357
|
-
queueName,
|
|
358
|
-
})
|
|
359
|
-
);
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Exponential backoff with jitter, capped at maxReconnectDelayMs.
|
|
364
|
-
const baseDelay = reconnectDelayMs * Math.pow(2, reconnectAttempts);
|
|
365
|
-
const jitter = 0.5 + Math.random() * 0.5;
|
|
366
|
-
const delay = Math.min(Math.floor(baseDelay * jitter), maxReconnectDelayMs);
|
|
367
|
-
|
|
368
|
-
reconnectAttempts++;
|
|
369
|
-
state = 'reconnecting';
|
|
370
|
-
reconnectTimer = setTimeout(() => {
|
|
371
|
-
reconnectTimer = null;
|
|
372
|
-
connect();
|
|
373
|
-
}, delay);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// Kick off the initial connection.
|
|
377
|
-
connect();
|
|
378
|
-
|
|
379
|
-
return {
|
|
380
|
-
close() {
|
|
381
|
-
intentionallyClosed = true;
|
|
382
|
-
if (reconnectTimer !== null) {
|
|
383
|
-
clearTimeout(reconnectTimer);
|
|
384
|
-
reconnectTimer = null;
|
|
385
|
-
}
|
|
386
|
-
if (ws) {
|
|
387
|
-
ws.close(1000, 'Client closed');
|
|
388
|
-
ws = null;
|
|
389
|
-
}
|
|
390
|
-
state = 'closed';
|
|
391
|
-
},
|
|
392
|
-
get state() {
|
|
393
|
-
return state;
|
|
394
|
-
},
|
|
395
|
-
get clientId() {
|
|
396
|
-
return clientId;
|
|
397
|
-
},
|
|
398
|
-
get lastOffset() {
|
|
399
|
-
return lastProcessedOffset;
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// ============================================================================
|
|
405
|
-
// Async Iterator API
|
|
406
|
-
// ============================================================================
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Subscribe to real-time messages from a queue via WebSocket.
|
|
410
|
-
*
|
|
411
|
-
* Returns an async iterator that yields messages as they arrive.
|
|
412
|
-
* The connection is automatically managed (auth, reconnection, cleanup).
|
|
413
|
-
*
|
|
414
|
-
* @param options - Configuration for the subscription
|
|
415
|
-
* @returns An async generator that yields {@link Message} objects
|
|
416
|
-
* @throws {QueueError} If no API key is available
|
|
417
|
-
* @throws {QueueValidationError} If the queue name is invalid
|
|
418
|
-
*
|
|
419
|
-
* @example
|
|
420
|
-
* ```typescript
|
|
421
|
-
* const controller = new AbortController();
|
|
422
|
-
* for await (const message of subscribeToQueue({
|
|
423
|
-
* queueName: 'order-processing',
|
|
424
|
-
* baseUrl: 'https://catalyst.agentuity.cloud',
|
|
425
|
-
* signal: controller.signal,
|
|
426
|
-
* })) {
|
|
427
|
-
* console.log('Received:', message.id, message.payload);
|
|
428
|
-
* }
|
|
429
|
-
* ```
|
|
430
|
-
*/
|
|
431
|
-
export async function* subscribeToQueue(
|
|
432
|
-
options: SubscribeToQueueOptions
|
|
433
|
-
): AsyncGenerator<Message, void, unknown> {
|
|
434
|
-
const { signal } = options;
|
|
435
|
-
|
|
436
|
-
// Check if already aborted.
|
|
437
|
-
if (signal?.aborted) return;
|
|
438
|
-
|
|
439
|
-
// A queue for buffering messages between the WebSocket callbacks and the
|
|
440
|
-
// async iterator consumer.
|
|
441
|
-
const buffer: Message[] = [];
|
|
442
|
-
let resolve: (() => void) | null = null;
|
|
443
|
-
let done = false;
|
|
444
|
-
let lastError: Error | null = null;
|
|
445
|
-
|
|
446
|
-
function push(message: Message) {
|
|
447
|
-
buffer.push(message);
|
|
448
|
-
if (resolve) {
|
|
449
|
-
resolve();
|
|
450
|
-
resolve = null;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function finish(error?: Error) {
|
|
455
|
-
done = true;
|
|
456
|
-
if (error) lastError = error;
|
|
457
|
-
if (resolve) {
|
|
458
|
-
resolve();
|
|
459
|
-
resolve = null;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
const connection = createQueueWebSocket({
|
|
464
|
-
queueName: options.queueName,
|
|
465
|
-
apiKey: options.apiKey,
|
|
466
|
-
baseUrl: options.baseUrl,
|
|
467
|
-
clientId: options.clientId,
|
|
468
|
-
lastOffset: options.lastOffset,
|
|
469
|
-
onMessage: push,
|
|
470
|
-
onError: (err) => finish(err),
|
|
471
|
-
onClose: () => {
|
|
472
|
-
// Only finish if the connection is intentionally closed (signal aborted).
|
|
473
|
-
// Otherwise, the callback-based API handles reconnection.
|
|
474
|
-
},
|
|
475
|
-
autoReconnect: true,
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
// Wire up the abort signal to close the connection.
|
|
479
|
-
const onAbort = () => {
|
|
480
|
-
connection.close();
|
|
481
|
-
finish();
|
|
482
|
-
};
|
|
483
|
-
signal?.addEventListener('abort', onAbort, { once: true });
|
|
484
|
-
|
|
485
|
-
try {
|
|
486
|
-
while (!done) {
|
|
487
|
-
// Drain buffered messages.
|
|
488
|
-
while (buffer.length > 0) {
|
|
489
|
-
yield buffer.shift()!;
|
|
490
|
-
// Re-check after yield in case signal was aborted.
|
|
491
|
-
if (done || signal?.aborted) return;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
if (done || signal?.aborted) return;
|
|
495
|
-
|
|
496
|
-
// Wait for the next message or completion.
|
|
497
|
-
await new Promise<void>((r) => {
|
|
498
|
-
resolve = r;
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// Drain any remaining messages.
|
|
503
|
-
while (buffer.length > 0) {
|
|
504
|
-
yield buffer.shift()!;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
if (lastError) {
|
|
508
|
-
throw lastError;
|
|
509
|
-
}
|
|
510
|
-
} finally {
|
|
511
|
-
signal?.removeEventListener('abort', onAbort);
|
|
512
|
-
connection.close();
|
|
513
|
-
}
|
|
514
|
-
}
|
package/src/api/region/delete.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { APIResponseSchema, APIClient } from '../api.ts';
|
|
3
|
-
import { RegionResponseError } from './util.ts';
|
|
4
|
-
|
|
5
|
-
export const DeleteResourceSpec = z.object({
|
|
6
|
-
type: z.enum(['db', 's3']).describe('the resource type'),
|
|
7
|
-
name: z.string().describe('the resource name (bucket_name for S3, db_name for DB)'),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const DeleteResourcesRequest = z.object({
|
|
11
|
-
resources: z.array(DeleteResourceSpec).describe('list of resources to delete'),
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export const DeletedResource = z.object({
|
|
15
|
-
type: z.string().describe('the resource type'),
|
|
16
|
-
name: z.string().describe('the resource name'),
|
|
17
|
-
env_keys: z.array(z.string()).describe('environment variable keys to remove'),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const DeleteResourcesResponse = z.object({
|
|
21
|
-
deleted: z.array(DeletedResource).describe('list of deleted resources'),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const DeleteResourcesResponseSchema = APIResponseSchema(DeleteResourcesResponse);
|
|
25
|
-
|
|
26
|
-
export type DeleteResourcesRequest = z.infer<typeof DeleteResourcesRequest>;
|
|
27
|
-
export type DeleteResourcesResponse = z.infer<typeof DeleteResourcesResponseSchema>;
|
|
28
|
-
export type DeletedResource = z.infer<typeof DeletedResource>;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Delete one or more resources (DB or S3) for an organization in a specific region
|
|
32
|
-
* Requires CLI authentication
|
|
33
|
-
*
|
|
34
|
-
* @param client - Catalyst API client
|
|
35
|
-
* @param orgId - Organization ID
|
|
36
|
-
* @param region - Cloud region
|
|
37
|
-
* @param resources - Array of resources to delete
|
|
38
|
-
* @returns
|
|
39
|
-
*/
|
|
40
|
-
export async function deleteResources(
|
|
41
|
-
client: APIClient,
|
|
42
|
-
orgId: string,
|
|
43
|
-
region: string,
|
|
44
|
-
resources: Array<{ type: 'db' | 's3'; name: string }>
|
|
45
|
-
): Promise<DeletedResource[]> {
|
|
46
|
-
const resp = await client.request<DeleteResourcesResponse, DeleteResourcesRequest>(
|
|
47
|
-
'DELETE',
|
|
48
|
-
`/resource/2025-11-16/${orgId}/${region}`,
|
|
49
|
-
DeleteResourcesResponseSchema,
|
|
50
|
-
{ resources },
|
|
51
|
-
DeleteResourcesRequest
|
|
52
|
-
);
|
|
53
|
-
if (resp.success) {
|
|
54
|
-
return resp.data.deleted;
|
|
55
|
-
}
|
|
56
|
-
throw new RegionResponseError({ message: resp.message });
|
|
57
|
-
}
|
package/src/api/region/index.ts
DELETED
package/src/api/region/list.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { APIResponseSchema, APIClient } from '../api.ts';
|
|
3
|
-
import { RegionResponseError } from './util.ts';
|
|
4
|
-
|
|
5
|
-
export const ListRegionsResponse = z.array(
|
|
6
|
-
z.object({
|
|
7
|
-
region: z.string().describe('the region identifier'),
|
|
8
|
-
description: z.string().describe('the human-readable description of the region'),
|
|
9
|
-
})
|
|
10
|
-
);
|
|
11
|
-
export const ListRegionsResponseSchema = APIResponseSchema(ListRegionsResponse);
|
|
12
|
-
|
|
13
|
-
export type ListRegionsResponse = z.infer<typeof ListRegionsResponseSchema>;
|
|
14
|
-
export type RegionList = z.infer<typeof ListRegionsResponse>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* List all available cloud regions
|
|
18
|
-
*
|
|
19
|
-
* @param client
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
export async function listRegions(client: APIClient): Promise<RegionList> {
|
|
23
|
-
const resp = await client.request<ListRegionsResponse>(
|
|
24
|
-
'GET',
|
|
25
|
-
'/cli/region',
|
|
26
|
-
ListRegionsResponseSchema
|
|
27
|
-
);
|
|
28
|
-
if (resp.success) {
|
|
29
|
-
return resp.data;
|
|
30
|
-
}
|
|
31
|
-
throw new RegionResponseError({ message: resp.message });
|
|
32
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { APIResponseSchema, APIClient } from '../api.ts';
|
|
3
|
-
import { RegionResponseError } from './util.ts';
|
|
4
|
-
|
|
5
|
-
export const ResourceListResponse = z.object({
|
|
6
|
-
s3: z.array(
|
|
7
|
-
z.object({
|
|
8
|
-
bucket_name: z.string().describe('the S3 bucket name'),
|
|
9
|
-
access_key: z.string().nullable().optional().describe('the S3 access key'),
|
|
10
|
-
secret_key: z.string().nullable().optional().describe('the S3 secret key'),
|
|
11
|
-
region: z.string().nullable().optional().describe('the S3 region'),
|
|
12
|
-
endpoint: z.string().nullable().optional().describe('the S3 endpoint'),
|
|
13
|
-
cname: z.string().nullable().optional().describe('the S3 CNAME'),
|
|
14
|
-
env: z.record(z.string(), z.string()).describe('environment variables for the resource'),
|
|
15
|
-
bucket_type: z.string().describe('the bucket type (user or snapshots)'),
|
|
16
|
-
internal: z.boolean().describe('whether this is a system-managed bucket'),
|
|
17
|
-
description: z
|
|
18
|
-
.string()
|
|
19
|
-
.nullable()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe('optional description of the bucket'),
|
|
22
|
-
})
|
|
23
|
-
),
|
|
24
|
-
db: z.array(
|
|
25
|
-
z.object({
|
|
26
|
-
name: z.string().describe('the database name'),
|
|
27
|
-
username: z.string().nullable().optional().describe('the database username'),
|
|
28
|
-
password: z.string().nullable().optional().describe('the database password'),
|
|
29
|
-
url: z.string().nullable().optional().describe('the full database connection URL'),
|
|
30
|
-
env: z.record(z.string(), z.string()).describe('environment variables for the resource'),
|
|
31
|
-
internal: z
|
|
32
|
-
.boolean()
|
|
33
|
-
.describe('whether this is a system-managed database (KV/Vector/Queue)'),
|
|
34
|
-
})
|
|
35
|
-
),
|
|
36
|
-
redis: z
|
|
37
|
-
.object({
|
|
38
|
-
url: z.string().describe('the Redis connection URL'),
|
|
39
|
-
})
|
|
40
|
-
.optional(),
|
|
41
|
-
});
|
|
42
|
-
export const ResourceListResponseSchema = APIResponseSchema(ResourceListResponse);
|
|
43
|
-
|
|
44
|
-
export type ResourceListResponse = z.infer<typeof ResourceListResponseSchema>;
|
|
45
|
-
export type ResourceList = z.infer<typeof ResourceListResponse>;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* List all resources for a given organization and region
|
|
49
|
-
*
|
|
50
|
-
* @param client
|
|
51
|
-
* @param orgId
|
|
52
|
-
* @param region
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
export async function listResources(
|
|
56
|
-
client: APIClient,
|
|
57
|
-
orgId: string,
|
|
58
|
-
region: string
|
|
59
|
-
): Promise<ResourceList> {
|
|
60
|
-
const resp = await client.request<ResourceListResponse>(
|
|
61
|
-
'GET',
|
|
62
|
-
`/resource/2025-03-17/${orgId}/${region}`,
|
|
63
|
-
ResourceListResponseSchema
|
|
64
|
-
);
|
|
65
|
-
if (resp.success) {
|
|
66
|
-
return resp.data;
|
|
67
|
-
}
|
|
68
|
-
throw new RegionResponseError({ message: resp.message });
|
|
69
|
-
}
|
package/src/api/region/util.ts
DELETED