@agentuity/core 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 +226 -0
- package/dist/api/api.d.ts.map +1 -0
- package/dist/api/api.js +635 -0
- package/dist/api/api.js.map +1 -0
- package/dist/api/apikey/create.d.ts +33 -0
- package/dist/api/apikey/create.d.ts.map +1 -0
- package/dist/api/apikey/create.js +23 -0
- package/dist/api/apikey/create.js.map +1 -0
- package/dist/api/apikey/delete.d.ts +19 -0
- package/dist/api/apikey/delete.d.ts.map +1 -0
- package/dist/api/apikey/delete.js +19 -0
- package/dist/api/apikey/delete.js.map +1 -0
- package/dist/api/apikey/get.d.ts +45 -0
- package/dist/api/apikey/get.d.ts.map +1 -0
- package/dist/api/apikey/get.js +36 -0
- package/dist/api/apikey/get.js.map +1 -0
- package/dist/api/apikey/index.d.ts +6 -0
- package/dist/api/apikey/index.d.ts.map +1 -0
- package/dist/api/apikey/index.js +6 -0
- package/dist/api/apikey/index.js.map +1 -0
- package/dist/api/apikey/list.d.ts +64 -0
- package/dist/api/apikey/list.d.ts.map +1 -0
- package/dist/api/apikey/list.js +46 -0
- package/dist/api/apikey/list.js.map +1 -0
- package/dist/api/apikey/util.d.ts +23 -0
- package/dist/api/apikey/util.d.ts.map +1 -0
- package/dist/api/apikey/util.js +3 -0
- package/dist/api/apikey/util.js.map +1 -0
- package/dist/api/config.d.ts +20 -0
- package/dist/api/config.d.ts.map +1 -0
- package/dist/api/config.js +43 -0
- package/dist/api/config.js.map +1 -0
- package/dist/api/db/index.d.ts +5 -0
- package/dist/api/db/index.d.ts.map +1 -0
- package/dist/api/db/index.js +5 -0
- package/dist/api/db/index.js.map +1 -0
- package/dist/api/db/logs.d.ts +70 -0
- package/dist/api/db/logs.d.ts.map +1 -0
- package/dist/api/db/logs.js +59 -0
- package/dist/api/db/logs.js.map +1 -0
- package/dist/api/db/query.d.ts +39 -0
- package/dist/api/db/query.d.ts.map +1 -0
- package/dist/api/db/query.js +49 -0
- package/dist/api/db/query.js.map +1 -0
- package/dist/api/db/tables.d.ts +49 -0
- package/dist/api/db/tables.d.ts.map +1 -0
- package/dist/api/db/tables.js +59 -0
- package/dist/api/db/tables.js.map +1 -0
- package/dist/api/db/util.d.ts +31 -0
- package/dist/api/db/util.d.ts.map +1 -0
- package/dist/api/db/util.js +4 -0
- package/dist/api/db/util.js.map +1 -0
- package/dist/api/env.d.ts +5 -0
- package/dist/api/env.d.ts.map +1 -0
- package/dist/api/env.js +10 -0
- package/dist/api/env.js.map +1 -0
- package/dist/api/eval/get.d.ts +36 -0
- package/dist/api/eval/get.d.ts.map +1 -0
- package/dist/api/eval/get.js +23 -0
- package/dist/api/eval/get.js.map +1 -0
- package/dist/api/eval/index.d.ts +5 -0
- package/dist/api/eval/index.d.ts.map +1 -0
- package/dist/api/eval/index.js +5 -0
- package/dist/api/eval/index.js.map +1 -0
- package/dist/api/eval/list.d.ts +50 -0
- package/dist/api/eval/list.d.ts.map +1 -0
- package/dist/api/eval/list.js +32 -0
- package/dist/api/eval/list.js.map +1 -0
- package/dist/api/eval/run-get.d.ts +48 -0
- package/dist/api/eval/run-get.d.ts.map +1 -0
- package/dist/api/eval/run-get.js +29 -0
- package/dist/api/eval/run-get.js.map +1 -0
- package/dist/api/eval/run-list.d.ts +70 -0
- package/dist/api/eval/run-list.d.ts.map +1 -0
- package/dist/api/eval/run-list.js +42 -0
- package/dist/api/eval/run-list.js.map +1 -0
- package/dist/api/index.d.ts +21 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +21 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/logger.d.ts +7 -0
- package/dist/api/logger.d.ts.map +1 -0
- package/dist/api/logger.js +23 -0
- package/dist/api/logger.js.map +1 -0
- package/dist/api/machine/index.d.ts +3 -0
- package/dist/api/machine/index.d.ts.map +1 -0
- package/dist/api/machine/index.js +3 -0
- package/dist/api/machine/index.js.map +1 -0
- package/dist/api/machine/machine.d.ts +192 -0
- package/dist/api/machine/machine.d.ts.map +1 -0
- package/dist/api/machine/machine.js +109 -0
- package/dist/api/machine/machine.js.map +1 -0
- package/dist/api/machine/util.d.ts +14 -0
- package/dist/api/machine/util.d.ts.map +1 -0
- package/dist/api/machine/util.js +3 -0
- package/dist/api/machine/util.js.map +1 -0
- package/dist/api/org/env-delete.d.ts +23 -0
- package/dist/api/org/env-delete.d.ts.map +1 -0
- package/dist/api/org/env-delete.js +25 -0
- package/dist/api/org/env-delete.js.map +1 -0
- package/dist/api/org/env-get.d.ts +33 -0
- package/dist/api/org/env-get.d.ts.map +1 -0
- package/dist/api/org/env-get.js +26 -0
- package/dist/api/org/env-get.js.map +1 -0
- package/dist/api/org/env-update.d.ts +24 -0
- package/dist/api/org/env-update.d.ts.map +1 -0
- package/dist/api/org/env-update.js +26 -0
- package/dist/api/org/env-update.js.map +1 -0
- package/dist/api/org/index.d.ts +7 -0
- package/dist/api/org/index.d.ts.map +1 -0
- package/dist/api/org/index.js +7 -0
- package/dist/api/org/index.js.map +1 -0
- package/dist/api/org/list.d.ts +27 -0
- package/dist/api/org/list.d.ts.map +1 -0
- package/dist/api/org/list.js +22 -0
- package/dist/api/org/list.js.map +1 -0
- package/dist/api/org/resources.d.ts +141 -0
- package/dist/api/org/resources.d.ts.map +1 -0
- package/dist/api/org/resources.js +97 -0
- package/dist/api/org/resources.js.map +1 -0
- package/dist/api/org/util.d.ts +45 -0
- package/dist/api/org/util.d.ts.map +1 -0
- package/dist/api/org/util.js +4 -0
- package/dist/api/org/util.js.map +1 -0
- package/dist/api/project/agent.d.ts +89 -0
- package/dist/api/project/agent.d.ts.map +1 -0
- package/dist/api/project/agent.js +60 -0
- package/dist/api/project/agent.js.map +1 -0
- package/dist/api/project/create.d.ts +37 -0
- package/dist/api/project/create.d.ts.map +1 -0
- package/dist/api/project/create.js +31 -0
- package/dist/api/project/create.js.map +1 -0
- package/dist/api/project/delete.d.ts +15 -0
- package/dist/api/project/delete.d.ts.map +1 -0
- package/dist/api/project/delete.js +13 -0
- package/dist/api/project/delete.js.map +1 -0
- package/dist/api/project/deploy.d.ts +490 -0
- package/dist/api/project/deploy.d.ts.map +1 -0
- package/dist/api/project/deploy.js +313 -0
- package/dist/api/project/deploy.js.map +1 -0
- package/dist/api/project/deployment.d.ts +237 -0
- package/dist/api/project/deployment.d.ts.map +1 -0
- package/dist/api/project/deployment.js +127 -0
- package/dist/api/project/deployment.js.map +1 -0
- package/dist/api/project/env-delete.d.ts +22 -0
- package/dist/api/project/env-delete.d.ts.map +1 -0
- package/dist/api/project/env-delete.js +29 -0
- package/dist/api/project/env-delete.js.map +1 -0
- package/dist/api/project/env-update.d.ts +31 -0
- package/dist/api/project/env-update.d.ts.map +1 -0
- package/dist/api/project/env-update.js +36 -0
- package/dist/api/project/env-update.js.map +1 -0
- package/dist/api/project/exists.d.ts +25 -0
- package/dist/api/project/exists.d.ts.map +1 -0
- package/dist/api/project/exists.js +45 -0
- package/dist/api/project/exists.js.map +1 -0
- package/dist/api/project/get.d.ts +43 -0
- package/dist/api/project/get.d.ts.map +1 -0
- package/dist/api/project/get.js +36 -0
- package/dist/api/project/get.js.map +1 -0
- package/dist/api/project/hostname.d.ts +25 -0
- package/dist/api/project/hostname.d.ts.map +1 -0
- package/dist/api/project/hostname.js +37 -0
- package/dist/api/project/hostname.js.map +1 -0
- package/dist/api/project/index.d.ts +14 -0
- package/dist/api/project/index.d.ts.map +1 -0
- package/dist/api/project/index.js +14 -0
- package/dist/api/project/index.js.map +1 -0
- package/dist/api/project/list.d.ts +48 -0
- package/dist/api/project/list.d.ts.map +1 -0
- package/dist/api/project/list.js +38 -0
- package/dist/api/project/list.js.map +1 -0
- package/dist/api/project/malware.d.ts +71 -0
- package/dist/api/project/malware.d.ts.map +1 -0
- package/dist/api/project/malware.js +42 -0
- package/dist/api/project/malware.js.map +1 -0
- package/dist/api/project/update-region.d.ts +27 -0
- package/dist/api/project/update-region.d.ts.map +1 -0
- package/dist/api/project/update-region.js +25 -0
- package/dist/api/project/update-region.js.map +1 -0
- package/dist/api/project/util.d.ts +62 -0
- package/dist/api/project/util.d.ts.map +1 -0
- package/dist/api/project/util.js +6 -0
- package/dist/api/project/util.js.map +1 -0
- package/dist/api/queue/analytics.d.ts +250 -0
- package/dist/api/queue/analytics.d.ts.map +1 -0
- package/dist/api/queue/analytics.js +233 -0
- package/dist/api/queue/analytics.js.map +1 -0
- package/dist/api/queue/destinations.d.ts +202 -0
- package/dist/api/queue/destinations.d.ts.map +1 -0
- package/dist/api/queue/destinations.js +168 -0
- package/dist/api/queue/destinations.js.map +1 -0
- package/dist/api/queue/dlq.d.ts +168 -0
- package/dist/api/queue/dlq.d.ts.map +1 -0
- package/dist/api/queue/dlq.js +166 -0
- package/dist/api/queue/dlq.js.map +1 -0
- package/dist/api/queue/index.d.ts +56 -0
- package/dist/api/queue/index.d.ts.map +1 -0
- package/dist/api/queue/index.js +90 -0
- package/dist/api/queue/index.js.map +1 -0
- package/dist/api/queue/messages.d.ts +503 -0
- package/dist/api/queue/messages.d.ts.map +1 -0
- package/dist/api/queue/messages.js +549 -0
- package/dist/api/queue/messages.js.map +1 -0
- package/dist/api/queue/queues.d.ts +226 -0
- package/dist/api/queue/queues.d.ts.map +1 -0
- package/dist/api/queue/queues.js +321 -0
- package/dist/api/queue/queues.js.map +1 -0
- package/dist/api/queue/sources.d.ts +202 -0
- package/dist/api/queue/sources.d.ts.map +1 -0
- package/dist/api/queue/sources.js +202 -0
- package/dist/api/queue/sources.js.map +1 -0
- package/dist/api/queue/types.d.ts +1218 -0
- package/dist/api/queue/types.d.ts.map +1 -0
- package/dist/api/queue/types.js +1002 -0
- package/dist/api/queue/types.js.map +1 -0
- package/dist/api/queue/util.d.ts +278 -0
- package/dist/api/queue/util.d.ts.map +1 -0
- package/dist/api/queue/util.js +233 -0
- package/dist/api/queue/util.js.map +1 -0
- package/dist/api/queue/validation.d.ts +247 -0
- package/dist/api/queue/validation.d.ts.map +1 -0
- package/dist/api/queue/validation.js +513 -0
- package/dist/api/queue/validation.js.map +1 -0
- package/dist/api/queue/websocket.d.ts +172 -0
- package/dist/api/queue/websocket.d.ts.map +1 -0
- package/dist/api/queue/websocket.js +396 -0
- package/dist/api/queue/websocket.js.map +1 -0
- package/dist/api/region/create.d.ts +81 -0
- package/dist/api/region/create.d.ts.map +1 -0
- package/dist/api/region/create.js +177 -0
- package/dist/api/region/create.js.map +1 -0
- package/dist/api/region/delete.d.ts +62 -0
- package/dist/api/region/delete.d.ts.map +1 -0
- package/dist/api/region/delete.js +37 -0
- package/dist/api/region/delete.js.map +1 -0
- package/dist/api/region/index.d.ts +5 -0
- package/dist/api/region/index.d.ts.map +1 -0
- package/dist/api/region/index.js +5 -0
- package/dist/api/region/index.js.map +1 -0
- package/dist/api/region/list.d.ts +27 -0
- package/dist/api/region/list.d.ts.map +1 -0
- package/dist/api/region/list.js +22 -0
- package/dist/api/region/list.js.map +1 -0
- package/dist/api/region/resources.d.ts +71 -0
- package/dist/api/region/resources.d.ts.map +1 -0
- package/dist/api/region/resources.js +53 -0
- package/dist/api/region/resources.js.map +1 -0
- package/dist/api/region/util.d.ts +23 -0
- package/dist/api/region/util.d.ts.map +1 -0
- package/dist/api/region/util.js +3 -0
- package/dist/api/region/util.js.map +1 -0
- package/dist/api/sandbox/cli-list.d.ts +114 -0
- package/dist/api/sandbox/cli-list.d.ts.map +1 -0
- package/dist/api/sandbox/cli-list.js +71 -0
- package/dist/api/sandbox/cli-list.js.map +1 -0
- package/dist/api/sandbox/client.d.ts +192 -0
- package/dist/api/sandbox/client.d.ts.map +1 -0
- package/dist/api/sandbox/client.js +262 -0
- package/dist/api/sandbox/client.js.map +1 -0
- package/dist/api/sandbox/create.d.ts +118 -0
- package/dist/api/sandbox/create.d.ts.map +1 -0
- package/dist/api/sandbox/create.js +211 -0
- package/dist/api/sandbox/create.js.map +1 -0
- package/dist/api/sandbox/destroy.d.ts +22 -0
- package/dist/api/sandbox/destroy.d.ts.map +1 -0
- package/dist/api/sandbox/destroy.js +25 -0
- package/dist/api/sandbox/destroy.js.map +1 -0
- package/dist/api/sandbox/disk-checkpoint.d.ts +104 -0
- package/dist/api/sandbox/disk-checkpoint.d.ts.map +1 -0
- package/dist/api/sandbox/disk-checkpoint.js +104 -0
- package/dist/api/sandbox/disk-checkpoint.js.map +1 -0
- package/dist/api/sandbox/execute.d.ts +69 -0
- package/dist/api/sandbox/execute.d.ts.map +1 -0
- package/dist/api/sandbox/execute.js +103 -0
- package/dist/api/sandbox/execute.js.map +1 -0
- package/dist/api/sandbox/execution.d.ts +169 -0
- package/dist/api/sandbox/execution.d.ts.map +1 -0
- package/dist/api/sandbox/execution.js +118 -0
- package/dist/api/sandbox/execution.js.map +1 -0
- package/dist/api/sandbox/files.d.ts +261 -0
- package/dist/api/sandbox/files.d.ts.map +1 -0
- package/dist/api/sandbox/files.js +386 -0
- package/dist/api/sandbox/files.js.map +1 -0
- package/dist/api/sandbox/get.d.ts +283 -0
- package/dist/api/sandbox/get.d.ts.map +1 -0
- package/dist/api/sandbox/get.js +215 -0
- package/dist/api/sandbox/get.js.map +1 -0
- package/dist/api/sandbox/getStatus.d.ts +16 -0
- package/dist/api/sandbox/getStatus.d.ts.map +1 -0
- package/dist/api/sandbox/getStatus.js +32 -0
- package/dist/api/sandbox/getStatus.js.map +1 -0
- package/dist/api/sandbox/index.d.ts +39 -0
- package/dist/api/sandbox/index.d.ts.map +1 -0
- package/dist/api/sandbox/index.js +20 -0
- package/dist/api/sandbox/index.js.map +1 -0
- package/dist/api/sandbox/list.d.ts +293 -0
- package/dist/api/sandbox/list.d.ts.map +1 -0
- package/dist/api/sandbox/list.js +191 -0
- package/dist/api/sandbox/list.js.map +1 -0
- package/dist/api/sandbox/pause.d.ts +22 -0
- package/dist/api/sandbox/pause.d.ts.map +1 -0
- package/dist/api/sandbox/pause.js +25 -0
- package/dist/api/sandbox/pause.js.map +1 -0
- package/dist/api/sandbox/resolve.d.ts +82 -0
- package/dist/api/sandbox/resolve.d.ts.map +1 -0
- package/dist/api/sandbox/resolve.js +71 -0
- package/dist/api/sandbox/resolve.js.map +1 -0
- package/dist/api/sandbox/resume.d.ts +22 -0
- package/dist/api/sandbox/resume.d.ts.map +1 -0
- package/dist/api/sandbox/resume.js +25 -0
- package/dist/api/sandbox/resume.js.map +1 -0
- package/dist/api/sandbox/run.d.ts +28 -0
- package/dist/api/sandbox/run.d.ts.map +1 -0
- package/dist/api/sandbox/run.js +342 -0
- package/dist/api/sandbox/run.js.map +1 -0
- package/dist/api/sandbox/runtime.d.ts +83 -0
- package/dist/api/sandbox/runtime.d.ts.map +1 -0
- package/dist/api/sandbox/runtime.js +78 -0
- package/dist/api/sandbox/runtime.js.map +1 -0
- package/dist/api/sandbox/snapshot-build.d.ts +48 -0
- package/dist/api/sandbox/snapshot-build.d.ts.map +1 -0
- package/dist/api/sandbox/snapshot-build.js +72 -0
- package/dist/api/sandbox/snapshot-build.js.map +1 -0
- package/dist/api/sandbox/snapshot.d.ts +595 -0
- package/dist/api/sandbox/snapshot.d.ts.map +1 -0
- package/dist/api/sandbox/snapshot.js +598 -0
- package/dist/api/sandbox/snapshot.js.map +1 -0
- package/dist/api/sandbox/util.d.ts +284 -0
- package/dist/api/sandbox/util.d.ts.map +1 -0
- package/dist/api/sandbox/util.js +210 -0
- package/dist/api/sandbox/util.js.map +1 -0
- package/dist/api/services/index.d.ts +2 -0
- package/dist/api/services/index.d.ts.map +1 -0
- package/dist/api/services/index.js +2 -0
- package/dist/api/services/index.js.map +1 -0
- package/dist/api/services/stats.d.ts +263 -0
- package/dist/api/services/stats.d.ts.map +1 -0
- package/dist/api/services/stats.js +144 -0
- package/dist/api/services/stats.js.map +1 -0
- package/dist/api/session/get.d.ts +169 -0
- package/dist/api/session/get.d.ts.map +1 -0
- package/dist/api/session/get.js +56 -0
- package/dist/api/session/get.js.map +1 -0
- package/dist/api/session/index.d.ts +4 -0
- package/dist/api/session/index.d.ts.map +1 -0
- package/dist/api/session/index.js +4 -0
- package/dist/api/session/index.js.map +1 -0
- package/dist/api/session/list.d.ts +143 -0
- package/dist/api/session/list.d.ts.map +1 -0
- package/dist/api/session/list.js +91 -0
- package/dist/api/session/list.js.map +1 -0
- package/dist/api/session/logs.d.ts +40 -0
- package/dist/api/session/logs.d.ts.map +1 -0
- package/dist/api/session/logs.js +28 -0
- package/dist/api/session/logs.js.map +1 -0
- package/dist/api/session/util.d.ts +23 -0
- package/dist/api/session/util.d.ts.map +1 -0
- package/dist/api/session/util.js +3 -0
- package/dist/api/session/util.js.map +1 -0
- package/dist/api/storage/config.d.ts +99 -0
- package/dist/api/storage/config.d.ts.map +1 -0
- package/dist/api/storage/config.js +61 -0
- package/dist/api/storage/config.js.map +1 -0
- package/dist/api/storage/index.d.ts +5 -0
- package/dist/api/storage/index.d.ts.map +1 -0
- package/dist/api/storage/index.js +5 -0
- package/dist/api/storage/index.js.map +1 -0
- package/dist/api/storage/objects.d.ts +155 -0
- package/dist/api/storage/objects.d.ts.map +1 -0
- package/dist/api/storage/objects.js +148 -0
- package/dist/api/storage/objects.js.map +1 -0
- package/dist/api/storage/types.d.ts +161 -0
- package/dist/api/storage/types.d.ts.map +1 -0
- package/dist/api/storage/types.js +141 -0
- package/dist/api/storage/types.js.map +1 -0
- package/dist/api/storage/util.d.ts +45 -0
- package/dist/api/storage/util.d.ts.map +1 -0
- package/dist/api/storage/util.js +4 -0
- package/dist/api/storage/util.js.map +1 -0
- package/dist/api/stream/get.d.ts +58 -0
- package/dist/api/stream/get.d.ts.map +1 -0
- package/dist/api/stream/get.js +40 -0
- package/dist/api/stream/get.js.map +1 -0
- package/dist/api/stream/index.d.ts +4 -0
- package/dist/api/stream/index.d.ts.map +1 -0
- package/dist/api/stream/index.js +4 -0
- package/dist/api/stream/index.js.map +1 -0
- package/dist/api/stream/list.d.ts +120 -0
- package/dist/api/stream/list.d.ts.map +1 -0
- package/dist/api/stream/list.js +77 -0
- package/dist/api/stream/list.js.map +1 -0
- package/dist/api/stream/util.d.ts +23 -0
- package/dist/api/stream/util.d.ts.map +1 -0
- package/dist/api/stream/util.js +3 -0
- package/dist/api/stream/util.js.map +1 -0
- package/dist/api/thread/delete.d.ts +23 -0
- package/dist/api/thread/delete.d.ts.map +1 -0
- package/dist/api/thread/delete.js +21 -0
- package/dist/api/thread/delete.js.map +1 -0
- package/dist/api/thread/get.d.ts +36 -0
- package/dist/api/thread/get.d.ts.map +1 -0
- package/dist/api/thread/get.js +23 -0
- package/dist/api/thread/get.js.map +1 -0
- package/dist/api/thread/index.d.ts +5 -0
- package/dist/api/thread/index.d.ts.map +1 -0
- package/dist/api/thread/index.js +5 -0
- package/dist/api/thread/index.js.map +1 -0
- package/dist/api/thread/list.d.ts +69 -0
- package/dist/api/thread/list.d.ts.map +1 -0
- package/dist/api/thread/list.js +51 -0
- package/dist/api/thread/list.js.map +1 -0
- package/dist/api/thread/util.d.ts +23 -0
- package/dist/api/thread/util.d.ts.map +1 -0
- package/dist/api/thread/util.js +3 -0
- package/dist/api/thread/util.js.map +1 -0
- package/dist/api/user/index.d.ts +2 -0
- package/dist/api/user/index.d.ts.map +1 -0
- package/dist/api/user/index.js +2 -0
- package/dist/api/user/index.js.map +1 -0
- package/dist/api/user/util.d.ts +23 -0
- package/dist/api/user/util.d.ts.map +1 -0
- package/dist/api/user/util.js +3 -0
- package/dist/api/user/util.js.map +1 -0
- package/dist/api/user/whoami.d.ts +39 -0
- package/dist/api/user/whoami.d.ts.map +1 -0
- package/dist/api/user/whoami.js +27 -0
- package/dist/api/user/whoami.js.map +1 -0
- package/dist/api/webhook/deliveries.d.ts +94 -0
- package/dist/api/webhook/deliveries.d.ts.map +1 -0
- package/dist/api/webhook/deliveries.js +79 -0
- package/dist/api/webhook/deliveries.js.map +1 -0
- package/dist/api/webhook/destinations.d.ts +136 -0
- package/dist/api/webhook/destinations.d.ts.map +1 -0
- package/dist/api/webhook/destinations.js +137 -0
- package/dist/api/webhook/destinations.js.map +1 -0
- package/dist/api/webhook/index.d.ts +41 -0
- package/dist/api/webhook/index.d.ts.map +1 -0
- package/dist/api/webhook/index.js +59 -0
- package/dist/api/webhook/index.js.map +1 -0
- package/dist/api/webhook/receipts.d.ts +77 -0
- package/dist/api/webhook/receipts.d.ts.map +1 -0
- package/dist/api/webhook/receipts.js +78 -0
- package/dist/api/webhook/receipts.js.map +1 -0
- package/dist/api/webhook/types.d.ts +249 -0
- package/dist/api/webhook/types.d.ts.map +1 -0
- package/dist/api/webhook/types.js +221 -0
- package/dist/api/webhook/types.js.map +1 -0
- package/dist/api/webhook/util.d.ts +202 -0
- package/dist/api/webhook/util.d.ts.map +1 -0
- package/dist/api/webhook/util.js +199 -0
- package/dist/api/webhook/util.js.map +1 -0
- package/dist/api/webhook/webhooks.d.ts +146 -0
- package/dist/api/webhook/webhooks.d.ts.map +1 -0
- package/dist/api/webhook/webhooks.js +165 -0
- package/dist/api/webhook/webhooks.js.map +1 -0
- package/dist/env-example.d.ts +11 -0
- package/dist/env-example.d.ts.map +1 -0
- package/dist/env-example.js +70 -0
- package/dist/env-example.js.map +1 -0
- package/dist/index.d.ts +20 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -12
- package/dist/index.js.map +1 -1
- package/dist/services/email.d.ts.map +1 -1
- package/dist/services/email.js +15 -15
- package/dist/services/email.js.map +1 -1
- package/dist/services/keyvalue.d.ts.map +1 -1
- package/dist/services/keyvalue.js +10 -10
- package/dist/services/keyvalue.js.map +1 -1
- package/dist/services/queue.d.ts.map +1 -1
- package/dist/services/queue.js +3 -3
- package/dist/services/queue.js.map +1 -1
- package/dist/services/schedule.d.ts.map +1 -1
- package/dist/services/schedule.js +8 -10
- package/dist/services/schedule.js.map +1 -1
- package/dist/services/stream.d.ts +2 -2
- package/dist/services/stream.d.ts.map +1 -1
- package/dist/services/stream.js +2 -2
- package/dist/services/stream.js.map +1 -1
- package/dist/services/vector.d.ts.map +1 -1
- package/dist/services/vector.js +9 -9
- package/dist/services/vector.js.map +1 -1
- package/dist/services/webhook.d.ts +2 -1
- package/dist/services/webhook.d.ts.map +1 -1
- package/dist/services/webhook.js +12 -14
- package/dist/services/webhook.js.map +1 -1
- package/package.json +2 -2
- package/src/api/api-example.md +164 -0
- package/src/api/api.ts +931 -0
- package/src/api/apikey/create.ts +41 -0
- package/src/api/apikey/delete.ts +30 -0
- package/src/api/apikey/get.ts +48 -0
- package/src/api/apikey/index.ts +5 -0
- package/src/api/apikey/list.ts +64 -0
- package/src/api/apikey/util.ts +3 -0
- package/src/api/config.ts +60 -0
- package/src/api/db/index.ts +27 -0
- package/src/api/db/logs.ts +75 -0
- package/src/api/db/query.ts +67 -0
- package/src/api/db/tables.ts +92 -0
- package/src/api/db/util.ts +9 -0
- package/src/api/env.ts +9 -0
- package/src/api/eval/get.ts +33 -0
- package/src/api/eval/index.ts +28 -0
- package/src/api/eval/list.ts +49 -0
- package/src/api/eval/run-get.ts +39 -0
- package/src/api/eval/run-list.ts +59 -0
- package/src/api/index.ts +20 -0
- package/src/api/logger.ts +24 -0
- package/src/api/machine/index.ts +2 -0
- package/src/api/machine/machine.ts +160 -0
- package/src/api/machine/util.ts +5 -0
- package/src/api/org/env-delete.ts +37 -0
- package/src/api/org/env-get.ts +43 -0
- package/src/api/org/env-update.ts +38 -0
- package/src/api/org/index.ts +6 -0
- package/src/api/org/list.ts +28 -0
- package/src/api/org/resources.ts +140 -0
- package/src/api/org/util.ts +4 -0
- package/src/api/project/agent.ts +86 -0
- package/src/api/project/create.ts +47 -0
- package/src/api/project/delete.ts +25 -0
- package/src/api/project/deploy.ts +458 -0
- package/src/api/project/deployment.ts +195 -0
- package/src/api/project/env-delete.ts +45 -0
- package/src/api/project/env-update.ts +55 -0
- package/src/api/project/exists.ts +58 -0
- package/src/api/project/get.ts +49 -0
- package/src/api/project/hostname.ts +73 -0
- package/src/api/project/index.ts +13 -0
- package/src/api/project/list.ts +54 -0
- package/src/api/project/malware.ts +68 -0
- package/src/api/project/update-region.ts +44 -0
- package/src/api/project/util.ts +8 -0
- package/src/api/queue/analytics.ts +311 -0
- package/src/api/queue/destinations.ts +259 -0
- package/src/api/queue/dlq.ts +243 -0
- package/src/api/queue/index.ts +308 -0
- package/src/api/queue/messages.ts +784 -0
- package/src/api/queue/queues.ts +460 -0
- package/src/api/queue/sources.ts +294 -0
- package/src/api/queue/types.ts +1325 -0
- package/src/api/queue/util.ts +275 -0
- package/src/api/queue/validation.ts +560 -0
- package/src/api/queue/websocket.ts +521 -0
- package/src/api/region/create.ts +207 -0
- package/src/api/region/delete.ts +57 -0
- package/src/api/region/index.ts +4 -0
- package/src/api/region/list.ts +32 -0
- package/src/api/region/resources.ts +69 -0
- package/src/api/region/util.ts +3 -0
- package/src/api/sandbox/cli-list.ts +127 -0
- package/src/api/sandbox/client.ts +460 -0
- package/src/api/sandbox/create.ts +256 -0
- package/src/api/sandbox/destroy.ts +41 -0
- package/src/api/sandbox/disk-checkpoint.ts +179 -0
- package/src/api/sandbox/execute.ts +132 -0
- package/src/api/sandbox/execution.ts +183 -0
- package/src/api/sandbox/files.ts +596 -0
- package/src/api/sandbox/get.ts +249 -0
- package/src/api/sandbox/getStatus.ts +54 -0
- package/src/api/sandbox/index.ts +211 -0
- package/src/api/sandbox/list.ts +224 -0
- package/src/api/sandbox/pause.ts +39 -0
- package/src/api/sandbox/resolve.ts +98 -0
- package/src/api/sandbox/resume.ts +39 -0
- package/src/api/sandbox/run.ts +439 -0
- package/src/api/sandbox/runtime.ts +104 -0
- package/src/api/sandbox/snapshot-build.ts +94 -0
- package/src/api/sandbox/snapshot.ts +781 -0
- package/src/api/sandbox/util.ts +275 -0
- package/src/api/services/index.ts +1 -0
- package/src/api/services/stats.ts +213 -0
- package/src/api/session/get.ts +106 -0
- package/src/api/session/index.ts +3 -0
- package/src/api/session/list.ts +136 -0
- package/src/api/session/logs.ts +47 -0
- package/src/api/session/util.ts +3 -0
- package/src/api/storage/config.ts +111 -0
- package/src/api/storage/index.ts +4 -0
- package/src/api/storage/objects.ts +250 -0
- package/src/api/storage/types.ts +174 -0
- package/src/api/storage/util.ts +4 -0
- package/src/api/stream/get.ts +51 -0
- package/src/api/stream/index.ts +3 -0
- package/src/api/stream/list.ts +127 -0
- package/src/api/stream/util.ts +3 -0
- package/src/api/thread/delete.ts +31 -0
- package/src/api/thread/get.ts +34 -0
- package/src/api/thread/index.ts +4 -0
- package/src/api/thread/list.ts +76 -0
- package/src/api/thread/util.ts +3 -0
- package/src/api/user/index.ts +1 -0
- package/src/api/user/util.ts +3 -0
- package/src/api/user/whoami.ts +32 -0
- package/src/api/webhook/deliveries.ts +129 -0
- package/src/api/webhook/destinations.ts +224 -0
- package/src/api/webhook/index.ts +133 -0
- package/src/api/webhook/receipts.ts +124 -0
- package/src/api/webhook/types.ts +309 -0
- package/src/api/webhook/util.ts +234 -0
- package/src/api/webhook/webhooks.ts +260 -0
- package/src/env-example.ts +90 -0
- package/src/index.ts +209 -206
- package/src/services/email.ts +15 -24
- package/src/services/keyvalue.ts +10 -13
- package/src/services/queue.ts +3 -6
- package/src/services/schedule.ts +8 -19
- package/src/services/stream.ts +4 -4
- package/src/services/vector.ts +9 -12
- package/src/services/webhook.ts +14 -24
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type APIClient } from '../api.ts';
|
|
3
|
+
export declare const SandboxInfoSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
name: z.ZodNullable<z.ZodString>;
|
|
6
|
+
description: z.ZodNullable<z.ZodString>;
|
|
7
|
+
status: z.ZodString;
|
|
8
|
+
region: z.ZodNullable<z.ZodString>;
|
|
9
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
10
|
+
orgId: z.ZodString;
|
|
11
|
+
orgName: z.ZodNullable<z.ZodString>;
|
|
12
|
+
projectId: z.ZodNullable<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const SandboxListDataSchema: z.ZodObject<{
|
|
15
|
+
sandboxes: z.ZodArray<z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
name: z.ZodNullable<z.ZodString>;
|
|
18
|
+
description: z.ZodNullable<z.ZodString>;
|
|
19
|
+
status: z.ZodString;
|
|
20
|
+
region: z.ZodNullable<z.ZodString>;
|
|
21
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
22
|
+
orgId: z.ZodString;
|
|
23
|
+
orgName: z.ZodNullable<z.ZodString>;
|
|
24
|
+
projectId: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
total: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const SandboxListResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
29
|
+
success: z.ZodLiteral<false>;
|
|
30
|
+
message: z.ZodString;
|
|
31
|
+
code: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
success: z.ZodLiteral<true>;
|
|
34
|
+
data: z.ZodObject<{
|
|
35
|
+
sandboxes: z.ZodArray<z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
name: z.ZodNullable<z.ZodString>;
|
|
38
|
+
description: z.ZodNullable<z.ZodString>;
|
|
39
|
+
status: z.ZodString;
|
|
40
|
+
region: z.ZodNullable<z.ZodString>;
|
|
41
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
42
|
+
orgId: z.ZodString;
|
|
43
|
+
orgName: z.ZodNullable<z.ZodString>;
|
|
44
|
+
projectId: z.ZodNullable<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
total: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
}, z.core.$strip>], "success">;
|
|
49
|
+
export type CLISandboxListResponse = z.infer<typeof SandboxListResponseSchema>;
|
|
50
|
+
export type CLISandboxListData = z.infer<typeof SandboxListDataSchema>;
|
|
51
|
+
export type CLISandboxInfo = z.infer<typeof SandboxInfoSchema>;
|
|
52
|
+
export interface CLISandboxListOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Filter by sandbox name
|
|
55
|
+
*/
|
|
56
|
+
name?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Filter by sandbox mode
|
|
59
|
+
*/
|
|
60
|
+
mode?: 'oneshot' | 'interactive';
|
|
61
|
+
/**
|
|
62
|
+
* Filter by specific project ID
|
|
63
|
+
*/
|
|
64
|
+
projectId?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Filter by specific organization ID
|
|
67
|
+
*/
|
|
68
|
+
orgId?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Filter by sandbox status
|
|
71
|
+
*/
|
|
72
|
+
status?: 'creating' | 'idle' | 'running' | 'paused' | 'stopping' | 'suspended' | 'terminated' | 'failed';
|
|
73
|
+
/**
|
|
74
|
+
* Maximum number of sandboxes to return (default: 50, max: 100)
|
|
75
|
+
*/
|
|
76
|
+
limit?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Number of sandboxes to skip for pagination
|
|
79
|
+
*/
|
|
80
|
+
offset?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Field to sort by
|
|
83
|
+
*/
|
|
84
|
+
sort?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Sort direction (default: 'desc')
|
|
87
|
+
*/
|
|
88
|
+
direction?: 'asc' | 'desc';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* List sandboxes with optional filtering using the CLI API endpoint.
|
|
92
|
+
*
|
|
93
|
+
* This endpoint searches across all organizations the user is a member of,
|
|
94
|
+
* unlike the Catalyst API which requires an orgId.
|
|
95
|
+
*
|
|
96
|
+
* @param client - The API client
|
|
97
|
+
* @param options - Filtering and pagination options
|
|
98
|
+
* @returns A promise that resolves to the list of sandboxes
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* // List all sandboxes across all orgs
|
|
102
|
+
* const result = await cliSandboxList(client);
|
|
103
|
+
* console.log(`Found ${result.total} sandboxes`);
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* // List running sandboxes
|
|
107
|
+
* const result = await cliSandboxList(client, { status: 'running' });
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // List sandboxes for a specific project
|
|
111
|
+
* const result = await cliSandboxList(client, { projectId: 'proj_123' });
|
|
112
|
+
*/
|
|
113
|
+
export declare function cliSandboxList(client: APIClient, options?: CLISandboxListOptions): Promise<CLISandboxListData>;
|
|
114
|
+
//# sourceMappingURL=cli-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-list.d.ts","sourceRoot":"","sources":["../../../src/api/sandbox/cli-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,WAAW,CAAC;AAG9D,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAU5B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;8BAA2C,CAAC;AAElF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACvE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EACJ,UAAU,GACV,MAAM,GACN,SAAS,GACT,QAAQ,GACR,UAAU,GACV,WAAW,GACX,YAAY,GACZ,QAAQ,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,cAAc,CACnC,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,kBAAkB,CAAC,CA0B7B"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchema } from "../api.js";
|
|
3
|
+
import { SandboxResponseError } from "./util.js";
|
|
4
|
+
export const SandboxInfoSchema = z.object({
|
|
5
|
+
id: z.string().describe('the sandbox id'),
|
|
6
|
+
name: z.string().nullable().describe('the sandbox name'),
|
|
7
|
+
description: z.string().nullable().describe('the sandbox description'),
|
|
8
|
+
status: z.string().describe('sandbox status'),
|
|
9
|
+
region: z.string().nullable().describe('cloud region'),
|
|
10
|
+
createdAt: z.string().nullable().describe('ISO 8601 creation timestamp'),
|
|
11
|
+
orgId: z.string().describe('the organization id'),
|
|
12
|
+
orgName: z.string().nullable().describe('the organization name'),
|
|
13
|
+
projectId: z.string().nullable().describe('the project id'),
|
|
14
|
+
});
|
|
15
|
+
export const SandboxListDataSchema = z.object({
|
|
16
|
+
sandboxes: z.array(SandboxInfoSchema).describe('list of sandboxes'),
|
|
17
|
+
total: z.number().describe('total count of matching sandboxes'),
|
|
18
|
+
});
|
|
19
|
+
export const SandboxListResponseSchema = APIResponseSchema(SandboxListDataSchema);
|
|
20
|
+
/**
|
|
21
|
+
* List sandboxes with optional filtering using the CLI API endpoint.
|
|
22
|
+
*
|
|
23
|
+
* This endpoint searches across all organizations the user is a member of,
|
|
24
|
+
* unlike the Catalyst API which requires an orgId.
|
|
25
|
+
*
|
|
26
|
+
* @param client - The API client
|
|
27
|
+
* @param options - Filtering and pagination options
|
|
28
|
+
* @returns A promise that resolves to the list of sandboxes
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // List all sandboxes across all orgs
|
|
32
|
+
* const result = await cliSandboxList(client);
|
|
33
|
+
* console.log(`Found ${result.total} sandboxes`);
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // List running sandboxes
|
|
37
|
+
* const result = await cliSandboxList(client, { status: 'running' });
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // List sandboxes for a specific project
|
|
41
|
+
* const result = await cliSandboxList(client, { projectId: 'proj_123' });
|
|
42
|
+
*/
|
|
43
|
+
export async function cliSandboxList(client, options = {}) {
|
|
44
|
+
const { projectId, orgId, status, limit, offset, sort, direction } = options;
|
|
45
|
+
const params = new URLSearchParams();
|
|
46
|
+
if (options.name)
|
|
47
|
+
params.set('name', options.name);
|
|
48
|
+
if (options.mode)
|
|
49
|
+
params.set('mode', options.mode);
|
|
50
|
+
if (projectId)
|
|
51
|
+
params.set('projectId', projectId);
|
|
52
|
+
if (orgId)
|
|
53
|
+
params.set('orgId', orgId);
|
|
54
|
+
if (status)
|
|
55
|
+
params.set('status', status);
|
|
56
|
+
if (limit !== undefined)
|
|
57
|
+
params.set('limit', limit.toString());
|
|
58
|
+
if (offset !== undefined)
|
|
59
|
+
params.set('offset', offset.toString());
|
|
60
|
+
if (sort)
|
|
61
|
+
params.set('sort', sort);
|
|
62
|
+
if (direction)
|
|
63
|
+
params.set('direction', direction);
|
|
64
|
+
const queryString = params.toString();
|
|
65
|
+
const resp = await client.request('GET', `/cli/sandbox${queryString ? `?${queryString}` : ''}`, SandboxListResponseSchema);
|
|
66
|
+
if (resp.success) {
|
|
67
|
+
return resp.data;
|
|
68
|
+
}
|
|
69
|
+
throw new SandboxResponseError({ message: resp.message });
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=cli-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-list.js","sourceRoot":"","sources":["../../../src/api/sandbox/cli-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IACxD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACtE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACxE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IAChE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CAC3D,CAAC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,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,IAAI,IAAI;QAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnC,IAAI,SAAS;QAAE,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAChC,KAAK,EACL,eAAe,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EACrD,yBAAyB,CACzB,CAAC;IAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { SandboxCreateOptions, SandboxInfo, ExecuteOptions as CoreExecuteOptions, Execution, FileToWrite, SandboxRunOptions, SandboxRunResult } from '../../services/sandbox.ts';
|
|
2
|
+
import type { Logger } from '../../logger.ts';
|
|
3
|
+
import type { Readable, Writable } from 'node:stream';
|
|
4
|
+
import { type SandboxCreateResponse } from './create.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Extended execute options that support piping output to writable streams
|
|
7
|
+
*/
|
|
8
|
+
export interface ExecuteOptions extends CoreExecuteOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Pipe stdout/stderr to writable streams (e.g., process.stdout)
|
|
11
|
+
*/
|
|
12
|
+
pipe?: {
|
|
13
|
+
stdout?: Writable;
|
|
14
|
+
stderr?: Writable;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface SandboxClientOptions {
|
|
18
|
+
/**
|
|
19
|
+
* API key for authentication.
|
|
20
|
+
* Defaults to process.env.AGENTUITY_SDK_KEY || process.env.AGENTUITY_CLI_KEY
|
|
21
|
+
*/
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Base URL for the sandbox API.
|
|
25
|
+
* Defaults to process.env.AGENTUITY_SANDBOX_URL ||
|
|
26
|
+
* process.env.AGENTUITY_CATALYST_URL ||
|
|
27
|
+
* process.env.AGENTUITY_TRANSPORT_URL ||
|
|
28
|
+
* regional catalyst URL
|
|
29
|
+
*/
|
|
30
|
+
url?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Organization ID for multi-tenant operations
|
|
33
|
+
*/
|
|
34
|
+
orgId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Custom logger instance
|
|
37
|
+
*/
|
|
38
|
+
logger?: Logger;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* I/O options for one-shot sandbox execution via run()
|
|
42
|
+
*/
|
|
43
|
+
export interface SandboxClientRunIO {
|
|
44
|
+
/**
|
|
45
|
+
* AbortSignal to cancel the execution
|
|
46
|
+
*/
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
/**
|
|
49
|
+
* Readable stream for stdin input
|
|
50
|
+
*/
|
|
51
|
+
stdin?: Readable;
|
|
52
|
+
/**
|
|
53
|
+
* Writable stream for stdout output
|
|
54
|
+
*/
|
|
55
|
+
stdout?: Writable;
|
|
56
|
+
/**
|
|
57
|
+
* Writable stream for stderr output
|
|
58
|
+
*/
|
|
59
|
+
stderr?: Writable;
|
|
60
|
+
/**
|
|
61
|
+
* Optional logger override for this run
|
|
62
|
+
*/
|
|
63
|
+
logger?: Logger;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A sandbox instance returned by SandboxClient.create()
|
|
67
|
+
*/
|
|
68
|
+
export interface SandboxInstance {
|
|
69
|
+
/**
|
|
70
|
+
* Unique sandbox identifier
|
|
71
|
+
*/
|
|
72
|
+
id: string;
|
|
73
|
+
/**
|
|
74
|
+
* Sandbox status at creation time
|
|
75
|
+
*/
|
|
76
|
+
status: SandboxCreateResponse['status'];
|
|
77
|
+
/**
|
|
78
|
+
* URL to stream stdout output
|
|
79
|
+
*/
|
|
80
|
+
stdoutStreamUrl?: string;
|
|
81
|
+
/**
|
|
82
|
+
* URL to stream stderr output
|
|
83
|
+
*/
|
|
84
|
+
stderrStreamUrl?: string;
|
|
85
|
+
/**
|
|
86
|
+
* URL to stream audit events (eBPF/Tetragon security events)
|
|
87
|
+
*/
|
|
88
|
+
auditStreamUrl?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Execute a command in the sandbox
|
|
91
|
+
*/
|
|
92
|
+
execute(options: ExecuteOptions): Promise<Execution>;
|
|
93
|
+
/**
|
|
94
|
+
* Write files to the sandbox workspace
|
|
95
|
+
*/
|
|
96
|
+
writeFiles(files: FileToWrite[]): Promise<number>;
|
|
97
|
+
/**
|
|
98
|
+
* Read a file from the sandbox workspace
|
|
99
|
+
*/
|
|
100
|
+
readFile(path: string): Promise<ReadableStream<Uint8Array>>;
|
|
101
|
+
/**
|
|
102
|
+
* Get current sandbox information
|
|
103
|
+
*/
|
|
104
|
+
get(): Promise<SandboxInfo>;
|
|
105
|
+
/**
|
|
106
|
+
* Destroy the sandbox and release all resources
|
|
107
|
+
*/
|
|
108
|
+
destroy(): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Convenience client for sandbox operations.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* // Interactive sandbox usage
|
|
116
|
+
* const client = new SandboxClient();
|
|
117
|
+
* const sandbox = await client.create();
|
|
118
|
+
* const result = await sandbox.execute({ command: ['echo', 'hello'] });
|
|
119
|
+
* await sandbox.destroy();
|
|
120
|
+
*
|
|
121
|
+
* // One-shot execution with streaming
|
|
122
|
+
* const result = await client.run(
|
|
123
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
124
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
125
|
+
* );
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare class SandboxClient {
|
|
129
|
+
#private;
|
|
130
|
+
constructor(options?: SandboxClientOptions);
|
|
131
|
+
/**
|
|
132
|
+
* Run a one-shot command in a new sandbox (creates, executes, destroys)
|
|
133
|
+
*
|
|
134
|
+
* This is a high-level convenience method that handles the full lifecycle:
|
|
135
|
+
* creating a sandbox, streaming I/O, polling for completion, and cleanup.
|
|
136
|
+
*
|
|
137
|
+
* @param options - Execution options including command and configuration
|
|
138
|
+
* @param io - Optional I/O streams and abort signal
|
|
139
|
+
* @returns The run result including exit code and duration
|
|
140
|
+
* @throws {Error} If stdin is provided without an API key
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const client = new SandboxClient();
|
|
145
|
+
* const result = await client.run(
|
|
146
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
147
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
148
|
+
* );
|
|
149
|
+
* console.log('Exit code:', result.exitCode);
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
run(options: SandboxRunOptions, io?: SandboxClientRunIO): Promise<SandboxRunResult>;
|
|
153
|
+
/**
|
|
154
|
+
* Create a new sandbox instance
|
|
155
|
+
*
|
|
156
|
+
* @param options - Optional sandbox configuration
|
|
157
|
+
* @returns A sandbox instance with execute and destroy methods
|
|
158
|
+
*/
|
|
159
|
+
create(options?: SandboxCreateOptions): Promise<SandboxInstance>;
|
|
160
|
+
/**
|
|
161
|
+
* Get sandbox information by ID
|
|
162
|
+
*
|
|
163
|
+
* @param sandboxId - The sandbox ID
|
|
164
|
+
* @returns Sandbox information
|
|
165
|
+
*/
|
|
166
|
+
get(sandboxId: string): Promise<SandboxInfo>;
|
|
167
|
+
/**
|
|
168
|
+
* Destroy a sandbox by ID
|
|
169
|
+
*
|
|
170
|
+
* @param sandboxId - The sandbox ID to destroy
|
|
171
|
+
*/
|
|
172
|
+
destroy(sandboxId: string): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Write files to a sandbox workspace
|
|
175
|
+
*
|
|
176
|
+
* @param sandboxId - The sandbox ID
|
|
177
|
+
* @param files - Array of files to write with path and content
|
|
178
|
+
* @param signal - Optional AbortSignal to cancel the operation
|
|
179
|
+
* @returns The number of files written
|
|
180
|
+
*/
|
|
181
|
+
writeFiles(sandboxId: string, files: FileToWrite[], signal?: AbortSignal): Promise<number>;
|
|
182
|
+
/**
|
|
183
|
+
* Read a file from a sandbox workspace
|
|
184
|
+
*
|
|
185
|
+
* @param sandboxId - The sandbox ID
|
|
186
|
+
* @param path - Path to the file relative to the sandbox workspace
|
|
187
|
+
* @param signal - Optional AbortSignal to cancel the operation
|
|
188
|
+
* @returns A ReadableStream of the file contents
|
|
189
|
+
*/
|
|
190
|
+
readFile(sandboxId: string, path: string, signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/sandbox/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,oBAAoB,EACpB,WAAW,EACX,cAAc,IAAI,kBAAkB,EACpC,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAyExE;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACzD;;OAEG;IACH,IAAI,CAAC,EAAE;QACN,MAAM,CAAC,EAAE,QAAQ,CAAC;QAClB,MAAM,CAAC,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,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAa;;gBAOb,OAAO,GAAE,oBAAyB;IAwB9C;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,GAAE,kBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkB7F;;;;;OAKG;IACG,MAAM,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IA6FtE;;;;;OAKG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlD;;;;OAIG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;;;OAOG;IACG,UAAU,CACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,EAAE,EACpB,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC;IAUlB;;;;;;;OAOG;IACG,QAAQ,CACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;CAQtC"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { APIClient } from "../api.js";
|
|
2
|
+
import { getEnv } from "../env.js";
|
|
3
|
+
import { sandboxCreate } from "./create.js";
|
|
4
|
+
import { sandboxDestroy } from "./destroy.js";
|
|
5
|
+
import { sandboxGet } from "./get.js";
|
|
6
|
+
import { sandboxExecute } from "./execute.js";
|
|
7
|
+
import { sandboxWriteFiles, sandboxReadFile } from "./files.js";
|
|
8
|
+
import { sandboxRun } from "./run.js";
|
|
9
|
+
import { executionGet } from "./execution.js";
|
|
10
|
+
import { createMinimalLogger } from "../logger.js";
|
|
11
|
+
import { getServiceUrls } from "../config.js";
|
|
12
|
+
import { writeAndDrain } from "./util.js";
|
|
13
|
+
// Server-side long-poll wait duration (max 5 minutes supported by server)
|
|
14
|
+
const EXECUTION_WAIT_DURATION = '5m';
|
|
15
|
+
/**
|
|
16
|
+
* Wait for execution completion using server-side long-polling.
|
|
17
|
+
* This is more efficient than client-side polling and provides immediate
|
|
18
|
+
* error detection if the sandbox is terminated.
|
|
19
|
+
*/
|
|
20
|
+
async function waitForExecution(client, executionId, orgId, signal) {
|
|
21
|
+
if (signal?.aborted) {
|
|
22
|
+
throw new DOMException('The operation was aborted.', 'AbortError');
|
|
23
|
+
}
|
|
24
|
+
// Use server-side long-polling - the server will hold the connection
|
|
25
|
+
// until the execution reaches a terminal state or the wait duration expires
|
|
26
|
+
return executionGet(client, {
|
|
27
|
+
executionId,
|
|
28
|
+
orgId,
|
|
29
|
+
wait: EXECUTION_WAIT_DURATION,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Pipes a remote stream URL to a local writable stream with proper backpressure handling
|
|
34
|
+
*/
|
|
35
|
+
async function pipeStreamToWritable(streamUrl, writable, signal) {
|
|
36
|
+
const response = await fetch(streamUrl, { signal });
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new Error(`Failed to fetch stream: ${response.status} ${response.statusText}`);
|
|
39
|
+
}
|
|
40
|
+
if (!response.body) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const reader = response.body.getReader();
|
|
44
|
+
try {
|
|
45
|
+
while (true) {
|
|
46
|
+
const { done, value } = await reader.read();
|
|
47
|
+
if (done)
|
|
48
|
+
break;
|
|
49
|
+
if (value) {
|
|
50
|
+
await writeAndDrain(writable, value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
try {
|
|
56
|
+
await reader.cancel();
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Ignore cancel errors - stream may already be closed
|
|
60
|
+
}
|
|
61
|
+
reader.releaseLock();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Convenience client for sandbox operations.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // Interactive sandbox usage
|
|
70
|
+
* const client = new SandboxClient();
|
|
71
|
+
* const sandbox = await client.create();
|
|
72
|
+
* const result = await sandbox.execute({ command: ['echo', 'hello'] });
|
|
73
|
+
* await sandbox.destroy();
|
|
74
|
+
*
|
|
75
|
+
* // One-shot execution with streaming
|
|
76
|
+
* const result = await client.run(
|
|
77
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
78
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
79
|
+
* );
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export class SandboxClient {
|
|
83
|
+
#client;
|
|
84
|
+
#orgId;
|
|
85
|
+
#apiKey;
|
|
86
|
+
#region;
|
|
87
|
+
#logger;
|
|
88
|
+
constructor(options = {}) {
|
|
89
|
+
const apiKey = options.apiKey || getEnv('AGENTUITY_SDK_KEY') || getEnv('AGENTUITY_CLI_KEY');
|
|
90
|
+
const region = getEnv('AGENTUITY_REGION') ?? 'usc';
|
|
91
|
+
const serviceUrls = getServiceUrls(region);
|
|
92
|
+
const url = options.url ||
|
|
93
|
+
getEnv('AGENTUITY_SANDBOX_URL') ||
|
|
94
|
+
getEnv('AGENTUITY_CATALYST_URL') ||
|
|
95
|
+
getEnv('AGENTUITY_TRANSPORT_URL') ||
|
|
96
|
+
serviceUrls.sandbox;
|
|
97
|
+
const logger = options.logger ?? createMinimalLogger();
|
|
98
|
+
// Disable retries for sandbox operations - 409 Conflict means sandbox is busy,
|
|
99
|
+
// not a retryable rate limit. Retrying would waste ~360s (4 attempts × 90s timeout).
|
|
100
|
+
this.#client = new APIClient(url, logger, apiKey ?? '', { maxRetries: 0 });
|
|
101
|
+
this.#orgId = options.orgId;
|
|
102
|
+
this.#apiKey = apiKey;
|
|
103
|
+
this.#region = region;
|
|
104
|
+
this.#logger = logger;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Run a one-shot command in a new sandbox (creates, executes, destroys)
|
|
108
|
+
*
|
|
109
|
+
* This is a high-level convenience method that handles the full lifecycle:
|
|
110
|
+
* creating a sandbox, streaming I/O, polling for completion, and cleanup.
|
|
111
|
+
*
|
|
112
|
+
* @param options - Execution options including command and configuration
|
|
113
|
+
* @param io - Optional I/O streams and abort signal
|
|
114
|
+
* @returns The run result including exit code and duration
|
|
115
|
+
* @throws {Error} If stdin is provided without an API key
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const client = new SandboxClient();
|
|
120
|
+
* const result = await client.run(
|
|
121
|
+
* { command: { exec: ['bun', 'run', 'script.ts'] } },
|
|
122
|
+
* { stdout: process.stdout, stderr: process.stderr }
|
|
123
|
+
* );
|
|
124
|
+
* console.log('Exit code:', result.exitCode);
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
async run(options, io = {}) {
|
|
128
|
+
if (io.stdin && !this.#apiKey) {
|
|
129
|
+
throw new Error('SandboxClient.run(): stdin streaming requires an API key');
|
|
130
|
+
}
|
|
131
|
+
return sandboxRun(this.#client, {
|
|
132
|
+
options,
|
|
133
|
+
orgId: this.#orgId,
|
|
134
|
+
region: this.#region,
|
|
135
|
+
apiKey: this.#apiKey,
|
|
136
|
+
signal: io.signal,
|
|
137
|
+
stdin: io.stdin,
|
|
138
|
+
stdout: io.stdout,
|
|
139
|
+
stderr: io.stderr,
|
|
140
|
+
logger: io.logger ?? this.#logger,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Create a new sandbox instance
|
|
145
|
+
*
|
|
146
|
+
* @param options - Optional sandbox configuration
|
|
147
|
+
* @returns A sandbox instance with execute and destroy methods
|
|
148
|
+
*/
|
|
149
|
+
async create(options) {
|
|
150
|
+
const response = await sandboxCreate(this.#client, {
|
|
151
|
+
options,
|
|
152
|
+
orgId: this.#orgId,
|
|
153
|
+
});
|
|
154
|
+
const sandboxId = response.sandboxId;
|
|
155
|
+
const client = this.#client;
|
|
156
|
+
const orgId = this.#orgId;
|
|
157
|
+
return {
|
|
158
|
+
id: sandboxId,
|
|
159
|
+
status: response.status,
|
|
160
|
+
stdoutStreamUrl: response.stdoutStreamUrl,
|
|
161
|
+
stderrStreamUrl: response.stderrStreamUrl,
|
|
162
|
+
auditStreamUrl: response.auditStreamUrl,
|
|
163
|
+
async execute(executeOptions) {
|
|
164
|
+
const { pipe, ...coreOptions } = executeOptions;
|
|
165
|
+
const initialResult = await sandboxExecute(client, {
|
|
166
|
+
sandboxId,
|
|
167
|
+
options: coreOptions,
|
|
168
|
+
orgId,
|
|
169
|
+
signal: coreOptions.signal,
|
|
170
|
+
});
|
|
171
|
+
// If pipe options provided, stream the output to the writable streams
|
|
172
|
+
if (pipe) {
|
|
173
|
+
const streamPromises = [];
|
|
174
|
+
if (pipe.stdout && initialResult.stdoutStreamUrl) {
|
|
175
|
+
streamPromises.push(pipeStreamToWritable(initialResult.stdoutStreamUrl, pipe.stdout, coreOptions.signal));
|
|
176
|
+
}
|
|
177
|
+
if (pipe.stderr && initialResult.stderrStreamUrl) {
|
|
178
|
+
streamPromises.push(pipeStreamToWritable(initialResult.stderrStreamUrl, pipe.stderr, coreOptions.signal));
|
|
179
|
+
}
|
|
180
|
+
// Wait for all streams to complete
|
|
181
|
+
if (streamPromises.length > 0) {
|
|
182
|
+
await Promise.all(streamPromises);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Wait for execution to complete and get final result with exit code
|
|
186
|
+
const finalResult = await waitForExecution(client, initialResult.executionId, orgId, coreOptions.signal);
|
|
187
|
+
return {
|
|
188
|
+
executionId: finalResult.executionId,
|
|
189
|
+
status: finalResult.status,
|
|
190
|
+
exitCode: finalResult.exitCode,
|
|
191
|
+
durationMs: finalResult.durationMs,
|
|
192
|
+
stdoutStreamUrl: initialResult.stdoutStreamUrl,
|
|
193
|
+
stderrStreamUrl: initialResult.stderrStreamUrl,
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
async writeFiles(files) {
|
|
197
|
+
const result = await sandboxWriteFiles(client, { sandboxId, files, orgId });
|
|
198
|
+
return result.filesWritten;
|
|
199
|
+
},
|
|
200
|
+
async readFile(path) {
|
|
201
|
+
return sandboxReadFile(client, { sandboxId, path, orgId });
|
|
202
|
+
},
|
|
203
|
+
async get() {
|
|
204
|
+
return sandboxGet(client, { sandboxId, orgId });
|
|
205
|
+
},
|
|
206
|
+
async destroy() {
|
|
207
|
+
return sandboxDestroy(client, { sandboxId, orgId });
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get sandbox information by ID
|
|
213
|
+
*
|
|
214
|
+
* @param sandboxId - The sandbox ID
|
|
215
|
+
* @returns Sandbox information
|
|
216
|
+
*/
|
|
217
|
+
async get(sandboxId) {
|
|
218
|
+
return sandboxGet(this.#client, { sandboxId, orgId: this.#orgId });
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Destroy a sandbox by ID
|
|
222
|
+
*
|
|
223
|
+
* @param sandboxId - The sandbox ID to destroy
|
|
224
|
+
*/
|
|
225
|
+
async destroy(sandboxId) {
|
|
226
|
+
return sandboxDestroy(this.#client, { sandboxId, orgId: this.#orgId });
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Write files to a sandbox workspace
|
|
230
|
+
*
|
|
231
|
+
* @param sandboxId - The sandbox ID
|
|
232
|
+
* @param files - Array of files to write with path and content
|
|
233
|
+
* @param signal - Optional AbortSignal to cancel the operation
|
|
234
|
+
* @returns The number of files written
|
|
235
|
+
*/
|
|
236
|
+
async writeFiles(sandboxId, files, signal) {
|
|
237
|
+
const result = await sandboxWriteFiles(this.#client, {
|
|
238
|
+
sandboxId,
|
|
239
|
+
files,
|
|
240
|
+
orgId: this.#orgId,
|
|
241
|
+
signal,
|
|
242
|
+
});
|
|
243
|
+
return result.filesWritten;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Read a file from a sandbox workspace
|
|
247
|
+
*
|
|
248
|
+
* @param sandboxId - The sandbox ID
|
|
249
|
+
* @param path - Path to the file relative to the sandbox workspace
|
|
250
|
+
* @param signal - Optional AbortSignal to cancel the operation
|
|
251
|
+
* @returns A ReadableStream of the file contents
|
|
252
|
+
*/
|
|
253
|
+
async readFile(sandboxId, path, signal) {
|
|
254
|
+
return sandboxReadFile(this.#client, {
|
|
255
|
+
sandboxId,
|
|
256
|
+
path,
|
|
257
|
+
orgId: this.#orgId,
|
|
258
|
+
signal,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/sandbox/client.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAA8B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,0EAA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