@agentuity/server 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/AGENTS.md +38 -34
  2. package/dist/api/api.d.ts +32 -2
  3. package/dist/api/api.d.ts.map +1 -1
  4. package/dist/api/api.js +16 -4
  5. package/dist/api/api.js.map +1 -1
  6. package/dist/api/apikey/create.d.ts +12 -2
  7. package/dist/api/apikey/create.d.ts.map +1 -1
  8. package/dist/api/apikey/create.js +2 -2
  9. package/dist/api/apikey/create.js.map +1 -1
  10. package/dist/api/apikey/delete.d.ts +9 -0
  11. package/dist/api/apikey/delete.d.ts.map +1 -1
  12. package/dist/api/apikey/delete.js +1 -1
  13. package/dist/api/apikey/delete.js.map +1 -1
  14. package/dist/api/apikey/get.d.ts +21 -2
  15. package/dist/api/apikey/get.d.ts.map +1 -1
  16. package/dist/api/apikey/get.js +2 -2
  17. package/dist/api/apikey/get.js.map +1 -1
  18. package/dist/api/apikey/index.d.ts +1 -0
  19. package/dist/api/apikey/index.d.ts.map +1 -1
  20. package/dist/api/apikey/index.js +1 -0
  21. package/dist/api/apikey/index.js.map +1 -1
  22. package/dist/api/apikey/list.d.ts +1 -2
  23. package/dist/api/apikey/list.d.ts.map +1 -1
  24. package/dist/api/apikey/list.js +1 -1
  25. package/dist/api/apikey/list.js.map +1 -1
  26. package/dist/api/db/index.d.ts +3 -3
  27. package/dist/api/db/index.d.ts.map +1 -1
  28. package/dist/api/db/index.js +3 -3
  29. package/dist/api/db/index.js.map +1 -1
  30. package/dist/api/db/logs.d.ts +14 -2
  31. package/dist/api/db/logs.d.ts.map +1 -1
  32. package/dist/api/db/logs.js +4 -4
  33. package/dist/api/db/logs.js.map +1 -1
  34. package/dist/api/db/query.d.ts +14 -1
  35. package/dist/api/db/query.d.ts.map +1 -1
  36. package/dist/api/db/query.js +2 -2
  37. package/dist/api/db/query.js.map +1 -1
  38. package/dist/api/db/tables.d.ts +1 -1
  39. package/dist/api/db/tables.d.ts.map +1 -1
  40. package/dist/api/db/tables.js +1 -1
  41. package/dist/api/db/tables.js.map +1 -1
  42. package/dist/api/eval/get.d.ts +1 -2
  43. package/dist/api/eval/get.d.ts.map +1 -1
  44. package/dist/api/eval/get.js +1 -1
  45. package/dist/api/eval/get.js.map +1 -1
  46. package/dist/api/eval/index.d.ts +4 -4
  47. package/dist/api/eval/index.d.ts.map +1 -1
  48. package/dist/api/eval/index.js +4 -4
  49. package/dist/api/eval/index.js.map +1 -1
  50. package/dist/api/eval/list.d.ts +12 -2
  51. package/dist/api/eval/list.d.ts.map +1 -1
  52. package/dist/api/eval/list.js +2 -2
  53. package/dist/api/eval/list.js.map +1 -1
  54. package/dist/api/eval/run-get.d.ts +1 -2
  55. package/dist/api/eval/run-get.d.ts.map +1 -1
  56. package/dist/api/eval/run-get.js +1 -1
  57. package/dist/api/eval/run-get.js.map +1 -1
  58. package/dist/api/eval/run-list.d.ts +18 -2
  59. package/dist/api/eval/run-list.d.ts.map +1 -1
  60. package/dist/api/eval/run-list.js +2 -2
  61. package/dist/api/eval/run-list.js.map +1 -1
  62. package/dist/api/index.d.ts +1 -0
  63. package/dist/api/index.d.ts.map +1 -1
  64. package/dist/api/index.js +1 -0
  65. package/dist/api/index.js.map +1 -1
  66. package/dist/api/machine/machine.d.ts +134 -3
  67. package/dist/api/machine/machine.d.ts.map +1 -1
  68. package/dist/api/machine/machine.js +11 -11
  69. package/dist/api/machine/machine.js.map +1 -1
  70. package/dist/api/org/env-delete.d.ts +10 -3
  71. package/dist/api/org/env-delete.d.ts.map +1 -1
  72. package/dist/api/org/env-delete.js +2 -2
  73. package/dist/api/org/env-delete.js.map +1 -1
  74. package/dist/api/org/env-get.d.ts +14 -1
  75. package/dist/api/org/env-get.d.ts.map +1 -1
  76. package/dist/api/org/env-get.js +2 -2
  77. package/dist/api/org/env-get.js.map +1 -1
  78. package/dist/api/org/env-update.d.ts +10 -3
  79. package/dist/api/org/env-update.d.ts.map +1 -1
  80. package/dist/api/org/env-update.js +2 -2
  81. package/dist/api/org/env-update.js.map +1 -1
  82. package/dist/api/org/list.d.ts +2 -3
  83. package/dist/api/org/list.d.ts.map +1 -1
  84. package/dist/api/org/list.js +2 -2
  85. package/dist/api/org/list.js.map +1 -1
  86. package/dist/api/org/resources.d.ts +4 -5
  87. package/dist/api/org/resources.d.ts.map +1 -1
  88. package/dist/api/org/resources.js +4 -4
  89. package/dist/api/org/resources.js.map +1 -1
  90. package/dist/api/project/agent.d.ts +1 -2
  91. package/dist/api/project/agent.d.ts.map +1 -1
  92. package/dist/api/project/agent.js +1 -1
  93. package/dist/api/project/agent.js.map +1 -1
  94. package/dist/api/project/create.d.ts +3 -3
  95. package/dist/api/project/create.d.ts.map +1 -1
  96. package/dist/api/project/create.js +3 -3
  97. package/dist/api/project/create.js.map +1 -1
  98. package/dist/api/project/delete.d.ts +4 -0
  99. package/dist/api/project/delete.d.ts.map +1 -1
  100. package/dist/api/project/delete.js +1 -1
  101. package/dist/api/project/delete.js.map +1 -1
  102. package/dist/api/project/deploy.d.ts +168 -9
  103. package/dist/api/project/deploy.d.ts.map +1 -1
  104. package/dist/api/project/deploy.js +23 -23
  105. package/dist/api/project/deploy.js.map +1 -1
  106. package/dist/api/project/deployment.d.ts +27 -3
  107. package/dist/api/project/deployment.d.ts.map +1 -1
  108. package/dist/api/project/deployment.js +3 -3
  109. package/dist/api/project/deployment.js.map +1 -1
  110. package/dist/api/project/env-delete.d.ts +2 -2
  111. package/dist/api/project/env-delete.d.ts.map +1 -1
  112. package/dist/api/project/env-delete.js +5 -1
  113. package/dist/api/project/env-delete.js.map +1 -1
  114. package/dist/api/project/env-update.d.ts +2 -2
  115. package/dist/api/project/env-update.d.ts.map +1 -1
  116. package/dist/api/project/env-update.js +1 -1
  117. package/dist/api/project/env-update.js.map +1 -1
  118. package/dist/api/project/exists.d.ts +2 -2
  119. package/dist/api/project/exists.d.ts.map +1 -1
  120. package/dist/api/project/exists.js +1 -1
  121. package/dist/api/project/exists.js.map +1 -1
  122. package/dist/api/project/get.d.ts +3 -3
  123. package/dist/api/project/get.d.ts.map +1 -1
  124. package/dist/api/project/get.js +2 -2
  125. package/dist/api/project/get.js.map +1 -1
  126. package/dist/api/project/list.d.ts +11 -2
  127. package/dist/api/project/list.d.ts.map +1 -1
  128. package/dist/api/project/list.js +4 -3
  129. package/dist/api/project/list.js.map +1 -1
  130. package/dist/api/project/malware.d.ts +14 -7
  131. package/dist/api/project/malware.d.ts.map +1 -1
  132. package/dist/api/project/malware.js +9 -9
  133. package/dist/api/project/malware.js.map +1 -1
  134. package/dist/api/project/update-region.d.ts +4 -0
  135. package/dist/api/project/update-region.d.ts.map +1 -1
  136. package/dist/api/project/update-region.js +1 -1
  137. package/dist/api/project/update-region.js.map +1 -1
  138. package/dist/api/region/create.d.ts +18 -4
  139. package/dist/api/region/create.d.ts.map +1 -1
  140. package/dist/api/region/create.js +5 -5
  141. package/dist/api/region/create.js.map +1 -1
  142. package/dist/api/region/delete.d.ts +17 -4
  143. package/dist/api/region/delete.d.ts.map +1 -1
  144. package/dist/api/region/delete.js +5 -5
  145. package/dist/api/region/delete.js.map +1 -1
  146. package/dist/api/region/list.d.ts +2 -3
  147. package/dist/api/region/list.d.ts.map +1 -1
  148. package/dist/api/region/list.js +2 -2
  149. package/dist/api/region/list.js.map +1 -1
  150. package/dist/api/region/resources.d.ts +2 -3
  151. package/dist/api/region/resources.d.ts.map +1 -1
  152. package/dist/api/region/resources.js +2 -2
  153. package/dist/api/region/resources.js.map +1 -1
  154. package/dist/api/sandbox/cli-list.d.ts +99 -0
  155. package/dist/api/sandbox/cli-list.d.ts.map +1 -0
  156. package/dist/api/sandbox/cli-list.js +63 -0
  157. package/dist/api/sandbox/cli-list.js.map +1 -0
  158. package/dist/api/sandbox/files.d.ts +100 -0
  159. package/dist/api/sandbox/files.d.ts.map +1 -1
  160. package/dist/api/sandbox/files.js +16 -16
  161. package/dist/api/sandbox/files.js.map +1 -1
  162. package/dist/api/sandbox/index.d.ts +5 -1
  163. package/dist/api/sandbox/index.d.ts.map +1 -1
  164. package/dist/api/sandbox/index.js +3 -1
  165. package/dist/api/sandbox/index.js.map +1 -1
  166. package/dist/api/sandbox/resolve.d.ts +52 -0
  167. package/dist/api/sandbox/resolve.d.ts.map +1 -0
  168. package/dist/api/sandbox/resolve.js +71 -0
  169. package/dist/api/sandbox/resolve.js.map +1 -0
  170. package/dist/api/sandbox/run.d.ts.map +1 -1
  171. package/dist/api/sandbox/run.js +6 -0
  172. package/dist/api/sandbox/run.js.map +1 -1
  173. package/dist/api/session/get.d.ts +123 -8
  174. package/dist/api/session/get.d.ts.map +1 -1
  175. package/dist/api/session/get.js +8 -8
  176. package/dist/api/session/get.js.map +1 -1
  177. package/dist/api/session/index.d.ts +3 -6
  178. package/dist/api/session/index.d.ts.map +1 -1
  179. package/dist/api/session/index.js +3 -3
  180. package/dist/api/session/index.js.map +1 -1
  181. package/dist/api/session/list.d.ts +2 -2
  182. package/dist/api/session/list.d.ts.map +1 -1
  183. package/dist/api/session/list.js +2 -2
  184. package/dist/api/session/list.js.map +1 -1
  185. package/dist/api/session/logs.d.ts +19 -2
  186. package/dist/api/session/logs.d.ts.map +1 -1
  187. package/dist/api/session/logs.js +4 -4
  188. package/dist/api/session/logs.js.map +1 -1
  189. package/dist/api/stream/get.d.ts +59 -0
  190. package/dist/api/stream/get.d.ts.map +1 -0
  191. package/dist/api/stream/get.js +40 -0
  192. package/dist/api/stream/get.js.map +1 -0
  193. package/dist/api/stream/index.d.ts +4 -0
  194. package/dist/api/stream/index.d.ts.map +1 -0
  195. package/dist/api/stream/index.js +4 -0
  196. package/dist/api/stream/index.js.map +1 -0
  197. package/dist/api/stream/list.d.ts +108 -0
  198. package/dist/api/stream/list.d.ts.map +1 -0
  199. package/dist/api/stream/list.js +71 -0
  200. package/dist/api/stream/list.js.map +1 -0
  201. package/dist/api/stream/util.d.ts +23 -0
  202. package/dist/api/stream/util.d.ts.map +1 -0
  203. package/dist/api/stream/util.js +3 -0
  204. package/dist/api/stream/util.js.map +1 -0
  205. package/dist/api/thread/delete.d.ts +10 -3
  206. package/dist/api/thread/delete.d.ts.map +1 -1
  207. package/dist/api/thread/delete.js +2 -2
  208. package/dist/api/thread/delete.js.map +1 -1
  209. package/dist/api/thread/get.d.ts +23 -5
  210. package/dist/api/thread/get.d.ts.map +1 -1
  211. package/dist/api/thread/get.js +2 -2
  212. package/dist/api/thread/get.js.map +1 -1
  213. package/dist/api/thread/index.d.ts +4 -4
  214. package/dist/api/thread/index.d.ts.map +1 -1
  215. package/dist/api/thread/index.js +4 -4
  216. package/dist/api/thread/index.js.map +1 -1
  217. package/dist/api/thread/list.d.ts +4 -5
  218. package/dist/api/thread/list.d.ts.map +1 -1
  219. package/dist/api/thread/list.js +3 -4
  220. package/dist/api/thread/list.js.map +1 -1
  221. package/dist/api/user/whoami.d.ts +6 -3
  222. package/dist/api/user/whoami.d.ts.map +1 -1
  223. package/dist/api/user/whoami.js +3 -3
  224. package/dist/api/user/whoami.js.map +1 -1
  225. package/package.json +4 -4
  226. package/src/api/api.ts +25 -4
  227. package/src/api/apikey/create.ts +2 -2
  228. package/src/api/apikey/delete.ts +1 -1
  229. package/src/api/apikey/get.ts +2 -2
  230. package/src/api/apikey/index.ts +1 -0
  231. package/src/api/apikey/list.ts +1 -1
  232. package/src/api/db/index.ts +17 -2
  233. package/src/api/db/logs.ts +6 -6
  234. package/src/api/db/query.ts +2 -2
  235. package/src/api/db/tables.ts +1 -1
  236. package/src/api/eval/get.ts +1 -1
  237. package/src/api/eval/index.ts +16 -4
  238. package/src/api/eval/list.ts +2 -2
  239. package/src/api/eval/run-get.ts +1 -1
  240. package/src/api/eval/run-list.ts +2 -2
  241. package/src/api/index.ts +1 -0
  242. package/src/api/machine/machine.ts +15 -11
  243. package/src/api/org/env-delete.ts +4 -4
  244. package/src/api/org/env-get.ts +3 -3
  245. package/src/api/org/env-update.ts +4 -4
  246. package/src/api/org/list.ts +2 -2
  247. package/src/api/org/resources.ts +4 -4
  248. package/src/api/project/agent.ts +1 -1
  249. package/src/api/project/create.ts +4 -4
  250. package/src/api/project/delete.ts +1 -1
  251. package/src/api/project/deploy.ts +32 -32
  252. package/src/api/project/deployment.ts +3 -3
  253. package/src/api/project/env-delete.ts +10 -6
  254. package/src/api/project/env-update.ts +2 -2
  255. package/src/api/project/exists.ts +2 -2
  256. package/src/api/project/get.ts +3 -3
  257. package/src/api/project/list.ts +13 -13
  258. package/src/api/project/malware.ts +12 -12
  259. package/src/api/project/update-region.ts +1 -1
  260. package/src/api/region/create.ts +5 -5
  261. package/src/api/region/delete.ts +5 -5
  262. package/src/api/region/list.ts +2 -2
  263. package/src/api/region/resources.ts +2 -2
  264. package/src/api/sandbox/cli-list.ts +99 -0
  265. package/src/api/sandbox/files.ts +16 -16
  266. package/src/api/sandbox/index.ts +21 -0
  267. package/src/api/sandbox/resolve.ts +98 -0
  268. package/src/api/sandbox/run.ts +6 -1
  269. package/src/api/session/get.ts +13 -13
  270. package/src/api/session/index.ts +3 -6
  271. package/src/api/session/list.ts +2 -2
  272. package/src/api/session/logs.ts +4 -4
  273. package/src/api/stream/get.ts +51 -0
  274. package/src/api/stream/index.ts +3 -0
  275. package/src/api/stream/list.ts +111 -0
  276. package/src/api/stream/util.ts +3 -0
  277. package/src/api/thread/delete.ts +4 -4
  278. package/src/api/thread/get.ts +5 -7
  279. package/src/api/thread/index.ts +4 -4
  280. package/src/api/thread/list.ts +4 -6
  281. package/src/api/user/whoami.ts +3 -3
@@ -1,42 +1,42 @@
1
1
  import { z } from 'zod';
2
2
  import { type APIClient, APIResponseSchema } from '../api';
3
3
 
4
- const PackageRef = z.object({
4
+ export const PackageRefSchema = z.object({
5
5
  name: z.string(),
6
6
  version: z.string(),
7
7
  });
8
8
 
9
- export type PackageRef = z.infer<typeof PackageRef>;
9
+ export type PackageRef = z.infer<typeof PackageRefSchema>;
10
10
 
11
- const MalwareFinding = z.object({
11
+ export const MalwareFindingSchema = z.object({
12
12
  name: z.string(),
13
13
  version: z.string(),
14
14
  reason: z.string(),
15
15
  });
16
16
 
17
- export type MalwareFinding = z.infer<typeof MalwareFinding>;
17
+ export type MalwareFinding = z.infer<typeof MalwareFindingSchema>;
18
18
 
19
- const MalwareCheckSummary = z.object({
19
+ export const MalwareCheckSummarySchema = z.object({
20
20
  scanned: z.number(),
21
21
  flagged: z.number(),
22
22
  });
23
23
 
24
- const MalwareCheckListMetadata = z.object({
24
+ export const MalwareCheckListMetadataSchema = z.object({
25
25
  fetchedAt: z.string(),
26
26
  count: z.number(),
27
27
  });
28
28
 
29
- const MalwareCheckResult = z.object({
29
+ export const MalwareCheckResultSchema = z.object({
30
30
  action: z.enum(['allow', 'block']),
31
- summary: MalwareCheckSummary,
32
- findings: z.array(MalwareFinding),
33
- list: MalwareCheckListMetadata.optional(),
31
+ summary: MalwareCheckSummarySchema,
32
+ findings: z.array(MalwareFindingSchema),
33
+ list: MalwareCheckListMetadataSchema.optional(),
34
34
  error: z.string().optional(),
35
35
  });
36
36
 
37
- const MalwareCheckResponseSchema = APIResponseSchema(MalwareCheckResult);
37
+ const MalwareCheckResponseSchema = APIResponseSchema(MalwareCheckResultSchema);
38
38
 
39
- export type MalwareCheckResult = z.infer<typeof MalwareCheckResult>;
39
+ export type MalwareCheckResult = z.infer<typeof MalwareCheckResultSchema>;
40
40
 
41
41
  export async function projectDeploymentMalwareCheck(
42
42
  client: APIClient,
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { APIClient, APIResponseSchema } from '../api';
3
3
  import { ProjectResponseError } from './util';
4
4
 
5
- const UpdateRegionRequestSchema = z.object({
5
+ export const UpdateRegionRequestSchema = z.object({
6
6
  cloudRegion: z.string().describe('the cloud region to update the project to'),
7
7
  });
8
8
 
@@ -120,27 +120,27 @@ function isIPv4Address(s: string): boolean {
120
120
  return true;
121
121
  }
122
122
 
123
- const ResourceSpec = z.object({
123
+ export const ResourceSpec = z.object({
124
124
  type: z.enum(['db', 's3']).describe('the resource type'),
125
125
  name: z.string().optional().describe('optional custom name for db'),
126
126
  description: z.string().optional().describe('optional description for db'),
127
127
  });
128
128
 
129
- const CreateResourcesRequest = z.object({
129
+ export const CreateResourcesRequest = z.object({
130
130
  resources: z.array(ResourceSpec).describe('list of resources to create'),
131
131
  });
132
132
 
133
- const CreatedResource = z.object({
133
+ export const CreatedResource = z.object({
134
134
  type: z.string().describe('the resource type'),
135
135
  name: z.string().describe('the resource name'),
136
136
  env: z.record(z.string(), z.string()).describe('environment variables for the resource'),
137
137
  });
138
138
 
139
- const CreateResourcesResponse = z.object({
139
+ export const CreateResourcesResponse = z.object({
140
140
  created: z.array(CreatedResource),
141
141
  });
142
142
 
143
- const CreateResourcesResponseSchema = APIResponseSchema(CreateResourcesResponse);
143
+ export const CreateResourcesResponseSchema = APIResponseSchema(CreateResourcesResponse);
144
144
 
145
145
  export type CreateResourcesRequest = z.infer<typeof CreateResourcesRequest>;
146
146
  export type CreateResourcesResponse = z.infer<typeof CreateResourcesResponseSchema>;
@@ -2,26 +2,26 @@ import { z } from 'zod';
2
2
  import { APIResponseSchema, APIClient } from '../api';
3
3
  import { RegionResponseError } from './util';
4
4
 
5
- const DeleteResourceSpec = z.object({
5
+ export const DeleteResourceSpec = z.object({
6
6
  type: z.enum(['db', 's3']).describe('the resource type'),
7
7
  name: z.string().describe('the resource name (bucket_name for S3, db_name for DB)'),
8
8
  });
9
9
 
10
- const DeleteResourcesRequest = z.object({
10
+ export const DeleteResourcesRequest = z.object({
11
11
  resources: z.array(DeleteResourceSpec).describe('list of resources to delete'),
12
12
  });
13
13
 
14
- const DeletedResource = z.object({
14
+ export const DeletedResource = z.object({
15
15
  type: z.string().describe('the resource type'),
16
16
  name: z.string().describe('the resource name'),
17
17
  env_keys: z.array(z.string()).describe('environment variable keys to remove'),
18
18
  });
19
19
 
20
- const DeleteResourcesResponse = z.object({
20
+ export const DeleteResourcesResponse = z.object({
21
21
  deleted: z.array(DeletedResource).describe('list of deleted resources'),
22
22
  });
23
23
 
24
- const DeleteResourcesResponseSchema = APIResponseSchema(DeleteResourcesResponse);
24
+ export const DeleteResourcesResponseSchema = APIResponseSchema(DeleteResourcesResponse);
25
25
 
26
26
  export type DeleteResourcesRequest = z.infer<typeof DeleteResourcesRequest>;
27
27
  export type DeleteResourcesResponse = z.infer<typeof DeleteResourcesResponseSchema>;
@@ -2,13 +2,13 @@ import { z } from 'zod';
2
2
  import { APIResponseSchema, APIClient } from '../api';
3
3
  import { RegionResponseError } from './util';
4
4
 
5
- const ListRegionsResponse = z.array(
5
+ export const ListRegionsResponse = z.array(
6
6
  z.object({
7
7
  region: z.string().describe('the region identifier'),
8
8
  description: z.string().describe('the human-readable description of the region'),
9
9
  })
10
10
  );
11
- const ListRegionsResponseSchema = APIResponseSchema(ListRegionsResponse);
11
+ export const ListRegionsResponseSchema = APIResponseSchema(ListRegionsResponse);
12
12
 
13
13
  export type ListRegionsResponse = z.infer<typeof ListRegionsResponseSchema>;
14
14
  export type RegionList = z.infer<typeof ListRegionsResponse>;
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { APIResponseSchema, APIClient } from '../api';
3
3
  import { RegionResponseError } from './util';
4
4
 
5
- const ResourceListResponse = z.object({
5
+ export const ResourceListResponse = z.object({
6
6
  s3: z.array(
7
7
  z.object({
8
8
  bucket_name: z.string().describe('the S3 bucket name'),
@@ -39,7 +39,7 @@ const ResourceListResponse = z.object({
39
39
  })
40
40
  .optional(),
41
41
  });
42
- const ResourceListResponseSchema = APIResponseSchema(ResourceListResponse);
42
+ export const ResourceListResponseSchema = APIResponseSchema(ResourceListResponse);
43
43
 
44
44
  export type ResourceListResponse = z.infer<typeof ResourceListResponseSchema>;
45
45
  export type ResourceList = z.infer<typeof ResourceListResponse>;
@@ -0,0 +1,99 @@
1
+ import { z } from 'zod';
2
+ import { APIClient, APIResponseSchema } from '../api';
3
+ import { SandboxResponseError } from './util';
4
+
5
+ const SandboxInfoSchema = z.object({
6
+ id: z.string().describe('the sandbox id'),
7
+ name: z.string().nullable().describe('the sandbox name'),
8
+ description: z.string().nullable().describe('the sandbox description'),
9
+ status: z.string().describe('sandbox status'),
10
+ region: z.string().nullable().describe('cloud region'),
11
+ createdAt: z.string().nullable().describe('ISO 8601 creation timestamp'),
12
+ orgId: z.string().describe('the organization id'),
13
+ orgName: z.string().nullable().describe('the organization name'),
14
+ projectId: z.string().nullable().describe('the project id'),
15
+ });
16
+
17
+ const SandboxListDataSchema = z.object({
18
+ sandboxes: z.array(SandboxInfoSchema).describe('list of sandboxes'),
19
+ total: z.number().describe('total count of matching sandboxes'),
20
+ });
21
+
22
+ const SandboxListResponseSchema = APIResponseSchema(SandboxListDataSchema);
23
+
24
+ export type CLISandboxListResponse = z.infer<typeof SandboxListResponseSchema>;
25
+ export type CLISandboxListData = z.infer<typeof SandboxListDataSchema>;
26
+ export type CLISandboxInfo = z.infer<typeof SandboxInfoSchema>;
27
+
28
+ export interface CLISandboxListOptions {
29
+ /**
30
+ * Filter by specific project ID
31
+ */
32
+ projectId?: string;
33
+ /**
34
+ * Filter by specific organization ID
35
+ */
36
+ orgId?: string;
37
+ /**
38
+ * Filter by sandbox status
39
+ */
40
+ status?: 'creating' | 'idle' | 'running' | 'terminated' | 'failed';
41
+ /**
42
+ * Maximum number of sandboxes to return (default: 50, max: 100)
43
+ */
44
+ limit?: number;
45
+ /**
46
+ * Number of sandboxes to skip for pagination
47
+ */
48
+ offset?: number;
49
+ }
50
+
51
+ /**
52
+ * List sandboxes with optional filtering using the CLI API endpoint.
53
+ *
54
+ * This endpoint searches across all organizations the user is a member of,
55
+ * unlike the Catalyst API which requires an orgId.
56
+ *
57
+ * @param client - The API client
58
+ * @param options - Filtering and pagination options
59
+ * @returns A promise that resolves to the list of sandboxes
60
+ *
61
+ * @example
62
+ * // List all sandboxes across all orgs
63
+ * const result = await cliSandboxList(client);
64
+ * console.log(`Found ${result.total} sandboxes`);
65
+ *
66
+ * @example
67
+ * // List running sandboxes
68
+ * const result = await cliSandboxList(client, { status: 'running' });
69
+ *
70
+ * @example
71
+ * // List sandboxes for a specific project
72
+ * const result = await cliSandboxList(client, { projectId: 'proj_123' });
73
+ */
74
+ export async function cliSandboxList(
75
+ client: APIClient,
76
+ options: CLISandboxListOptions = {}
77
+ ): Promise<CLISandboxListData> {
78
+ const { projectId, orgId, status, limit, offset } = options;
79
+ const params = new URLSearchParams();
80
+
81
+ if (projectId) params.set('projectId', projectId);
82
+ if (orgId) params.set('orgId', orgId);
83
+ if (status) params.set('status', status);
84
+ if (limit !== undefined) params.set('limit', limit.toString());
85
+ if (offset !== undefined) params.set('offset', offset.toString());
86
+
87
+ const queryString = params.toString();
88
+ const resp = await client.request<CLISandboxListResponse>(
89
+ 'GET',
90
+ `/cli/sandbox${queryString ? `?${queryString}` : ''}`,
91
+ SandboxListResponseSchema
92
+ );
93
+
94
+ if (resp.success) {
95
+ return resp.data;
96
+ }
97
+
98
+ throw new SandboxResponseError({ message: resp.message });
99
+ }
@@ -8,19 +8,19 @@ export const FileToWriteSchema = z.object({
8
8
  content: z.string().describe('Base64-encoded file content'),
9
9
  });
10
10
 
11
- const WriteFilesRequestSchema = z
11
+ export const WriteFilesRequestSchema = z
12
12
  .object({
13
13
  files: z.array(FileToWriteSchema).describe('Array of files to write'),
14
14
  })
15
15
  .describe('Request body for writing files to a sandbox');
16
16
 
17
- const WriteFilesDataSchema = z
17
+ export const WriteFilesDataSchema = z
18
18
  .object({
19
19
  filesWritten: z.number().describe('Number of files successfully written'),
20
20
  })
21
21
  .describe('Response data from writing files');
22
22
 
23
- const WriteFilesResponseSchema = z.discriminatedUnion('success', [
23
+ export const WriteFilesResponseSchema = z.discriminatedUnion('success', [
24
24
  z.object({
25
25
  success: z.literal<false>(false),
26
26
  message: z.string().describe('the error message'),
@@ -140,14 +140,14 @@ export async function sandboxReadFile(
140
140
  return response.body;
141
141
  }
142
142
 
143
- const MkDirRequestSchema = z
143
+ export const MkDirRequestSchema = z
144
144
  .object({
145
145
  path: z.string().describe('Path to the directory to create'),
146
146
  recursive: z.boolean().optional().describe('Create parent directories if needed'),
147
147
  })
148
148
  .describe('Request body for creating a directory');
149
149
 
150
- const MkDirResponseSchema = z.discriminatedUnion('success', [
150
+ export const MkDirResponseSchema = z.discriminatedUnion('success', [
151
151
  z.object({
152
152
  success: z.literal<false>(false),
153
153
  message: z.string().describe('the error message'),
@@ -200,14 +200,14 @@ export async function sandboxMkDir(client: APIClient, params: MkDirParams): Prom
200
200
  }
201
201
  }
202
202
 
203
- const RmDirRequestSchema = z
203
+ export const RmDirRequestSchema = z
204
204
  .object({
205
205
  path: z.string().describe('Path to the directory to remove'),
206
206
  recursive: z.boolean().optional().describe('Remove directory and all contents'),
207
207
  })
208
208
  .describe('Request body for removing a directory');
209
209
 
210
- const RmDirResponseSchema = z.discriminatedUnion('success', [
210
+ export const RmDirResponseSchema = z.discriminatedUnion('success', [
211
211
  z.object({
212
212
  success: z.literal<false>(false),
213
213
  message: z.string().describe('the error message'),
@@ -260,13 +260,13 @@ export async function sandboxRmDir(client: APIClient, params: RmDirParams): Prom
260
260
  }
261
261
  }
262
262
 
263
- const RmFileRequestSchema = z
263
+ export const RmFileRequestSchema = z
264
264
  .object({
265
265
  path: z.string().describe('Path to the file to remove'),
266
266
  })
267
267
  .describe('Request body for removing a file');
268
268
 
269
- const RmFileResponseSchema = z.discriminatedUnion('success', [
269
+ export const RmFileResponseSchema = z.discriminatedUnion('success', [
270
270
  z.object({
271
271
  success: z.literal<false>(false),
272
272
  message: z.string().describe('the error message'),
@@ -317,7 +317,7 @@ export async function sandboxRmFile(client: APIClient, params: RmFileParams): Pr
317
317
  }
318
318
  }
319
319
 
320
- const FileInfoSchema = z.object({
320
+ export const FileInfoSchema = z.object({
321
321
  path: z.string().describe('File path relative to the listed directory'),
322
322
  size: z.number().describe('File size in bytes'),
323
323
  isDir: z.boolean().describe('Whether the entry is a directory'),
@@ -325,11 +325,11 @@ const FileInfoSchema = z.object({
325
325
  modTime: z.string().describe('Modification time in RFC3339 format'),
326
326
  });
327
327
 
328
- const ListFilesDataSchema = z.object({
328
+ export const ListFilesDataSchema = z.object({
329
329
  files: z.array(FileInfoSchema).describe('Array of file information'),
330
330
  });
331
331
 
332
- const ListFilesResponseSchema = z.discriminatedUnion('success', [
332
+ export const ListFilesResponseSchema = z.discriminatedUnion('success', [
333
333
  z.object({
334
334
  success: z.literal<false>(false),
335
335
  message: z.string().describe('the error message'),
@@ -467,7 +467,7 @@ export interface UploadArchiveParams {
467
467
  signal?: AbortSignal;
468
468
  }
469
469
 
470
- const UploadArchiveResponseSchema = z.discriminatedUnion('success', [
470
+ export const UploadArchiveResponseSchema = z.discriminatedUnion('success', [
471
471
  z.object({
472
472
  success: z.literal<false>(false),
473
473
  message: z.string().describe('the error message'),
@@ -523,17 +523,17 @@ export async function sandboxUploadArchive(
523
523
  }
524
524
  }
525
525
 
526
- const SetEnvRequestSchema = z.object({
526
+ export const SetEnvRequestSchema = z.object({
527
527
  env: z
528
528
  .record(z.string(), z.string().nullable())
529
529
  .describe('Environment variables to set (null to delete)'),
530
530
  });
531
531
 
532
- const SetEnvDataSchema = z.object({
532
+ export const SetEnvDataSchema = z.object({
533
533
  env: z.record(z.string(), z.string()).describe('Current environment variables after update'),
534
534
  });
535
535
 
536
- const SetEnvResponseSchema = z.discriminatedUnion('success', [
536
+ export const SetEnvResponseSchema = z.discriminatedUnion('success', [
537
537
  z.object({
538
538
  success: z.literal<false>(false),
539
539
  message: z.string().describe('the error message'),
@@ -4,8 +4,12 @@ export { sandboxExecute } from './execute';
4
4
  export type { SandboxExecuteParams } from './execute';
5
5
  export { sandboxGet } from './get';
6
6
  export type { SandboxGetParams } from './get';
7
+ export { sandboxResolve, SandboxResolveError } from './resolve';
8
+ export type { ResolvedSandboxInfo } from './resolve';
7
9
  export { sandboxList } from './list';
8
10
  export type { SandboxListParams } from './list';
11
+ export { cliSandboxList } from './cli-list';
12
+ export type { CLISandboxListOptions, CLISandboxListData, CLISandboxInfo } from './cli-list';
9
13
  export { runtimeList } from './runtime';
10
14
  export type { RuntimeListParams } from './runtime';
11
15
  export { sandboxDestroy } from './destroy';
@@ -48,6 +52,23 @@ export {
48
52
  sandboxDownloadArchive,
49
53
  sandboxUploadArchive,
50
54
  sandboxSetEnv,
55
+ FileToWriteSchema,
56
+ WriteFilesRequestSchema,
57
+ WriteFilesDataSchema,
58
+ WriteFilesResponseSchema,
59
+ MkDirRequestSchema,
60
+ MkDirResponseSchema,
61
+ RmDirRequestSchema,
62
+ RmDirResponseSchema,
63
+ RmFileRequestSchema,
64
+ RmFileResponseSchema,
65
+ FileInfoSchema,
66
+ ListFilesDataSchema,
67
+ ListFilesResponseSchema,
68
+ UploadArchiveResponseSchema,
69
+ SetEnvRequestSchema,
70
+ SetEnvDataSchema,
71
+ SetEnvResponseSchema,
51
72
  } from './files';
52
73
  export type {
53
74
  WriteFilesParams,
@@ -0,0 +1,98 @@
1
+ import { z } from 'zod';
2
+ import { StructuredError } from '@agentuity/core';
3
+ import { APIResponseSchemaOptionalData, type APIClient } from '../api';
4
+
5
+ /**
6
+ * Data schema for sandbox resolve endpoint
7
+ */
8
+ const SandboxResolveDataSchema = z.object({
9
+ id: z.string(),
10
+ name: z.string().nullable(),
11
+ region: z.string(),
12
+ status: z.string(),
13
+ orgId: z.string(),
14
+ projectId: z.string().nullable(),
15
+ });
16
+
17
+ /**
18
+ * Response schema for sandbox resolve endpoint using standardized discriminated union
19
+ */
20
+ const SandboxResolveResponseSchema = APIResponseSchemaOptionalData(SandboxResolveDataSchema);
21
+
22
+ /**
23
+ * Resolved sandbox info returned from the CLI API
24
+ */
25
+ export interface ResolvedSandboxInfo {
26
+ id: string;
27
+ name: string | null;
28
+ region: string;
29
+ status: string;
30
+ orgId: string;
31
+ projectId: string | null;
32
+ }
33
+
34
+ /**
35
+ * Error thrown when sandbox resolution fails.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * try {
40
+ * await sandboxResolve(client, 'sbx_123');
41
+ * } catch (error) {
42
+ * if (error._tag === 'SandboxResolveError') {
43
+ * console.error(`Sandbox not found: ${error.sandboxId}`);
44
+ * }
45
+ * }
46
+ * ```
47
+ */
48
+ export const SandboxResolveError = StructuredError('SandboxResolveError')<{
49
+ sandboxId?: string;
50
+ statusCode?: number;
51
+ }>();
52
+
53
+ /**
54
+ * Resolve a sandbox by ID across all organizations the user has access to.
55
+ * Uses the CLI API endpoint which searches across all user's orgs.
56
+ *
57
+ * @param client - API client configured for CLI endpoints
58
+ * @param sandboxId - The sandbox ID to resolve
59
+ * @returns Resolved sandbox info including region and orgId
60
+ * @throws {SandboxResolveError} If sandbox not found or request fails
61
+ */
62
+ export async function sandboxResolve(
63
+ client: APIClient,
64
+ sandboxId: string
65
+ ): Promise<ResolvedSandboxInfo> {
66
+ const response = await client.get<z.infer<typeof SandboxResolveResponseSchema>>(
67
+ `/cli/sandbox/${sandboxId}`,
68
+ SandboxResolveResponseSchema
69
+ );
70
+
71
+ if (!response.success) {
72
+ // Extract status code from error code if present (e.g., "NOT_FOUND" -> 404)
73
+ // Fall back to 404 if no code is provided
74
+ const statusCode = response.code === 'NOT_FOUND' ? 404 : response.code ? 400 : 404;
75
+ throw new SandboxResolveError({
76
+ message: response.message || 'Sandbox not found',
77
+ sandboxId,
78
+ statusCode,
79
+ });
80
+ }
81
+
82
+ if (!response.data) {
83
+ throw new SandboxResolveError({
84
+ message: 'Sandbox not found',
85
+ sandboxId,
86
+ statusCode: 404,
87
+ });
88
+ }
89
+
90
+ return {
91
+ id: response.data.id,
92
+ name: response.data.name,
93
+ region: response.data.region,
94
+ status: response.data.status,
95
+ orgId: response.data.orgId,
96
+ projectId: response.data.projectId,
97
+ };
98
+ }
@@ -1,7 +1,7 @@
1
1
  import type { Logger } from '@agentuity/core';
2
2
  import type { Readable, Writable } from 'node:stream';
3
3
  import { PassThrough } from 'node:stream';
4
- import { APIClient } from '../api';
4
+ import { APIClient, PaymentRequiredError } from '../api';
5
5
  import { sandboxCreate } from './create';
6
6
  import { sandboxDestroy } from './destroy';
7
7
  import { sandboxGet } from './get';
@@ -286,6 +286,11 @@ async function createStdinStream(
286
286
  });
287
287
 
288
288
  if (!response.ok) {
289
+ if (response.status === 402) {
290
+ throw new PaymentRequiredError({
291
+ url: url,
292
+ });
293
+ }
289
294
  throw new Error(`Failed to create stdin stream: ${response.status} ${response.statusText}`);
290
295
  }
291
296
 
@@ -1,13 +1,13 @@
1
1
  import { z } from 'zod';
2
2
  import { APIClient, APIResponseSchema } from '../api';
3
- import { SessionSchema } from './list';
3
+ import { SessionSchema, type Session } from './list';
4
4
  import { SessionResponseError } from './util';
5
5
 
6
- const _SessionGetRequestSchema = z.object({
6
+ export const _SessionGetRequestSchema = z.object({
7
7
  id: z.string().describe('the session id'),
8
8
  });
9
9
 
10
- const EvalRunSchema = z.object({
10
+ export const SessionEvalRunSchema = z.object({
11
11
  id: z.string().describe('eval run id'),
12
12
  created_at: z.string().describe('creation timestamp'),
13
13
  eval_id: z.string().describe('evaluation id'),
@@ -26,7 +26,7 @@ export interface SpanNode {
26
26
  error?: string;
27
27
  }
28
28
 
29
- const SpanNodeSchema: z.ZodType<SpanNode> = z.lazy(() =>
29
+ export const SpanNodeSchema: z.ZodType<SpanNode> = z.lazy(() =>
30
30
  z.object({
31
31
  id: z.string().describe('span ID'),
32
32
  duration: z.number().describe('duration in milliseconds'),
@@ -37,7 +37,7 @@ const SpanNodeSchema: z.ZodType<SpanNode> = z.lazy(() =>
37
37
  })
38
38
  );
39
39
 
40
- const RouteInfoSchema = z
40
+ export const RouteInfoSchema = z
41
41
  .object({
42
42
  id: z.string().describe('route id'),
43
43
  method: z.string().describe('HTTP method'),
@@ -45,25 +45,23 @@ const RouteInfoSchema = z
45
45
  })
46
46
  .nullable();
47
47
 
48
- const AgentInfoSchema = z.object({
48
+ export const AgentInfoSchema = z.object({
49
49
  name: z.string().describe('agent name'),
50
50
  identifier: z.string().describe('agent identifier'),
51
51
  });
52
52
 
53
- const EnrichedSessionDataSchema = z.object({
53
+ export const EnrichedSessionDataSchema = z.object({
54
54
  session: SessionSchema,
55
55
  agents: z.array(AgentInfoSchema).describe('resolved agents'),
56
- eval_runs: z.array(EvalRunSchema).describe('eval runs for this session'),
56
+ eval_runs: z.array(SessionEvalRunSchema).describe('eval runs for this session'),
57
57
  route: RouteInfoSchema.describe('route information'),
58
58
  });
59
59
 
60
- const SessionGetResponseSchema = APIResponseSchema(EnrichedSessionDataSchema);
60
+ export const SessionGetResponseSchema = APIResponseSchema(EnrichedSessionDataSchema);
61
61
 
62
62
  type SessionGetRequest = z.infer<typeof _SessionGetRequestSchema>;
63
63
  type SessionGetResponse = z.infer<typeof SessionGetResponseSchema>;
64
64
 
65
- export type Session = z.infer<typeof SessionSchema>;
66
-
67
65
  /**
68
66
  * Get a single session by id
69
67
  *
@@ -71,13 +69,15 @@ export type Session = z.infer<typeof SessionSchema>;
71
69
  * @param request
72
70
  * @returns
73
71
  */
74
- export type EvalRun = z.infer<typeof EvalRunSchema>;
72
+ export type SessionEvalRun = z.infer<typeof SessionEvalRunSchema>;
73
+ /** @deprecated Use SessionEvalRun instead */
74
+ export type EvalRun = SessionEvalRun;
75
75
  export type RouteInfo = z.infer<typeof RouteInfoSchema>;
76
76
  export type AgentInfo = z.infer<typeof AgentInfoSchema>;
77
77
  export type EnrichedSession = {
78
78
  session: Session;
79
79
  agents: AgentInfo[];
80
- evalRuns: EvalRun[];
80
+ evalRuns: SessionEvalRun[];
81
81
  timeline: SpanNode | null;
82
82
  route: RouteInfo;
83
83
  };
@@ -1,6 +1,3 @@
1
- export { sessionGet } from './get';
2
- export type { Session, EnrichedSession, EvalRun, SpanNode, RouteInfo, AgentInfo } from './get';
3
- export { sessionList, SessionSchema } from './list';
4
- export type { SessionList, SessionListResponse, SessionListOptions } from './list';
5
- export { sessionLogs } from './logs';
6
- export type { SessionLog } from './logs';
1
+ export * from './get';
2
+ export * from './list';
3
+ export * from './logs';
@@ -42,9 +42,9 @@ const SessionSchema = z.object({
42
42
 
43
43
  export { SessionSchema };
44
44
 
45
- const SessionListResponse = z.array(SessionSchema);
45
+ export const SessionListResponse = z.array(SessionSchema);
46
46
 
47
- const SessionListResponseSchema = APIResponseSchema(SessionListResponse);
47
+ export const SessionListResponseSchema = APIResponseSchema(SessionListResponse);
48
48
 
49
49
  export type SessionListResponse = z.infer<typeof SessionListResponseSchema>;
50
50
  export type SessionList = z.infer<typeof SessionListResponse>;
@@ -2,19 +2,19 @@ import { z } from 'zod';
2
2
  import { APIClient, APIResponseSchema } from '../api';
3
3
  import { SessionResponseError } from './util';
4
4
 
5
- const _SessionLogsRequestSchema = z.object({
5
+ export const _SessionLogsRequestSchema = z.object({
6
6
  id: z.string().describe('the session id'),
7
7
  });
8
8
 
9
- const LogSchema = z.object({
9
+ export const LogSchema = z.object({
10
10
  body: z.string().describe('the log body'),
11
11
  severity: z.string().describe('the log severity'),
12
12
  timestamp: z.string().describe('the log timestamp'),
13
13
  });
14
14
 
15
- const SessionLogsResponse = z.array(LogSchema);
15
+ export const SessionLogsResponse = z.array(LogSchema);
16
16
 
17
- const SessionLogsResponseSchema = APIResponseSchema(SessionLogsResponse);
17
+ export const SessionLogsResponseSchema = APIResponseSchema(SessionLogsResponse);
18
18
 
19
19
  type SessionLogsRequest = z.infer<typeof _SessionLogsRequestSchema>;
20
20
  type SessionLogsResponse = z.infer<typeof SessionLogsResponseSchema>;