@agentuity/sandbox 3.0.12 → 3.1.1

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 (122) hide show
  1. package/AGENTS.md +3 -3
  2. package/dist/api-reference.d.ts +1221 -0
  3. package/dist/api-reference.d.ts.map +1 -0
  4. package/dist/api-reference.js +1046 -0
  5. package/dist/api-reference.js.map +1 -0
  6. package/dist/base64.d.ts +2 -0
  7. package/dist/base64.d.ts.map +1 -0
  8. package/dist/base64.js +14 -0
  9. package/dist/base64.js.map +1 -0
  10. package/dist/client.d.ts +431 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +632 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/create.d.ts +203 -0
  15. package/dist/create.d.ts.map +1 -0
  16. package/dist/create.js +235 -0
  17. package/dist/create.js.map +1 -0
  18. package/dist/destroy.d.ts +23 -0
  19. package/dist/destroy.d.ts.map +1 -0
  20. package/dist/destroy.js +30 -0
  21. package/dist/destroy.js.map +1 -0
  22. package/dist/disk-checkpoint.d.ts +108 -0
  23. package/dist/disk-checkpoint.d.ts.map +1 -0
  24. package/dist/disk-checkpoint.js +124 -0
  25. package/dist/disk-checkpoint.js.map +1 -0
  26. package/dist/events.d.ts +56 -0
  27. package/dist/events.d.ts.map +1 -0
  28. package/dist/events.js +54 -0
  29. package/dist/events.js.map +1 -0
  30. package/dist/execute.d.ts +99 -0
  31. package/dist/execute.d.ts.map +1 -0
  32. package/dist/execute.js +138 -0
  33. package/dist/execute.js.map +1 -0
  34. package/dist/execution.d.ts +150 -0
  35. package/dist/execution.d.ts.map +1 -0
  36. package/dist/execution.js +120 -0
  37. package/dist/execution.js.map +1 -0
  38. package/dist/files.d.ts +283 -0
  39. package/dist/files.d.ts.map +1 -0
  40. package/dist/files.js +471 -0
  41. package/dist/files.js.map +1 -0
  42. package/dist/get.d.ts +288 -0
  43. package/dist/get.d.ts.map +1 -0
  44. package/dist/get.js +256 -0
  45. package/dist/get.js.map +1 -0
  46. package/dist/getStatus.d.ts +23 -0
  47. package/dist/getStatus.d.ts.map +1 -0
  48. package/dist/getStatus.js +53 -0
  49. package/dist/getStatus.js.map +1 -0
  50. package/dist/index.d.ts +42 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +22 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/job.d.ts +227 -0
  55. package/dist/job.d.ts.map +1 -0
  56. package/dist/job.js +109 -0
  57. package/dist/job.js.map +1 -0
  58. package/dist/list.d.ts +330 -0
  59. package/dist/list.d.ts.map +1 -0
  60. package/dist/list.js +209 -0
  61. package/dist/list.js.map +1 -0
  62. package/dist/pause.d.ts +39 -0
  63. package/dist/pause.d.ts.map +1 -0
  64. package/dist/pause.js +48 -0
  65. package/dist/pause.js.map +1 -0
  66. package/dist/resolve.d.ts +75 -0
  67. package/dist/resolve.d.ts.map +1 -0
  68. package/dist/resolve.js +76 -0
  69. package/dist/resolve.js.map +1 -0
  70. package/dist/resume.d.ts +23 -0
  71. package/dist/resume.d.ts.map +1 -0
  72. package/dist/resume.js +30 -0
  73. package/dist/resume.js.map +1 -0
  74. package/dist/run.d.ts +73 -0
  75. package/dist/run.d.ts.map +1 -0
  76. package/dist/run.js +568 -0
  77. package/dist/run.js.map +1 -0
  78. package/dist/runtime.d.ts +94 -0
  79. package/dist/runtime.d.ts.map +1 -0
  80. package/dist/runtime.js +82 -0
  81. package/dist/runtime.js.map +1 -0
  82. package/dist/snapshot-build.d.ts +48 -0
  83. package/dist/snapshot-build.d.ts.map +1 -0
  84. package/dist/snapshot-build.js +72 -0
  85. package/dist/snapshot-build.js.map +1 -0
  86. package/dist/snapshot.d.ts +596 -0
  87. package/dist/snapshot.d.ts.map +1 -0
  88. package/dist/snapshot.js +612 -0
  89. package/dist/snapshot.js.map +1 -0
  90. package/dist/types.d.ts +1010 -0
  91. package/dist/types.d.ts.map +1 -0
  92. package/dist/types.js +853 -0
  93. package/dist/types.js.map +1 -0
  94. package/dist/util.d.ts +296 -0
  95. package/dist/util.d.ts.map +1 -0
  96. package/dist/util.js +234 -0
  97. package/dist/util.js.map +1 -0
  98. package/package.json +7 -2
  99. package/src/api-reference.ts +1094 -0
  100. package/src/base64.ts +14 -0
  101. package/src/client.ts +998 -0
  102. package/src/create.ts +273 -0
  103. package/src/destroy.ts +43 -0
  104. package/src/disk-checkpoint.ts +184 -0
  105. package/src/events.ts +72 -0
  106. package/src/execute.ts +167 -0
  107. package/src/execution.ts +152 -0
  108. package/src/files.ts +637 -0
  109. package/src/get.ts +291 -0
  110. package/src/getStatus.ts +72 -0
  111. package/src/index.ts +252 -18
  112. package/src/job.ts +161 -0
  113. package/src/list.ts +239 -0
  114. package/src/pause.ts +75 -0
  115. package/src/resolve.ts +96 -0
  116. package/src/resume.ts +41 -0
  117. package/src/run.ts +783 -0
  118. package/src/runtime.ts +106 -0
  119. package/src/snapshot-build.ts +94 -0
  120. package/src/snapshot.ts +791 -0
  121. package/src/types.ts +1033 -0
  122. package/src/util.ts +280 -0
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod';
2
+ import { APIResponseSchema, APIResponseSchemaNoData } from '@agentuity/api';
3
+ import { throwSandboxError } from './util.js';
4
+ // --- Schemas ---
5
+ export const DiskCheckpointInfoSchema = z.object({
6
+ id: z.string().describe('Globally unique checkpoint ID (ckpt_xxx)'),
7
+ name: z.string().describe('User-provided checkpoint name'),
8
+ createdAt: z.string().describe('ISO timestamp of creation'),
9
+ parent: z.string().describe('Parent checkpoint name (empty for base)'),
10
+ });
11
+ const CreateDiskCheckpointDataSchema = DiskCheckpointInfoSchema;
12
+ export const CreateDiskCheckpointResponseSchema = APIResponseSchema(CreateDiskCheckpointDataSchema);
13
+ const ListDiskCheckpointsDataSchema = z.object({
14
+ checkpoints: z.array(DiskCheckpointInfoSchema),
15
+ });
16
+ export const ListDiskCheckpointsResponseSchema = APIResponseSchema(ListDiskCheckpointsDataSchema);
17
+ export const RestoreDiskCheckpointResponseSchema = APIResponseSchemaNoData();
18
+ export const DeleteDiskCheckpointResponseSchema = APIResponseSchemaNoData();
19
+ // --- Params ---
20
+ export const DiskCheckpointCreateParamsSchema = z.object({
21
+ sandboxId: z.string().describe('Sandbox ID for checkpoint creation'),
22
+ name: z.string().describe('Name to assign to the new checkpoint'),
23
+ orgId: z.string().optional().describe('Optional org id for CLI auth context'),
24
+ });
25
+ export const DiskCheckpointListParamsSchema = z.object({
26
+ sandboxId: z.string().describe('Sandbox ID to list checkpoints for'),
27
+ orgId: z.string().optional().describe('Optional org id for CLI auth context'),
28
+ });
29
+ export const DiskCheckpointRestoreParamsSchema = z.object({
30
+ sandboxId: z.string().describe('Sandbox ID to restore'),
31
+ checkpointId: z.string().describe('Checkpoint ID to restore from'),
32
+ orgId: z.string().optional().describe('Optional org id for CLI auth context'),
33
+ });
34
+ export const DiskCheckpointDeleteParamsSchema = z.object({
35
+ sandboxId: z.string().describe('Sandbox ID containing the checkpoint'),
36
+ checkpointId: z.string().describe('Checkpoint ID to delete'),
37
+ orgId: z.string().optional().describe('Optional org id for CLI auth context'),
38
+ });
39
+ // --- API Functions ---
40
+ /**
41
+ * Creates a new disk checkpoint for a sandbox.
42
+ *
43
+ * @param client - The API client to use for the request
44
+ * @param params - Parameters including the sandbox ID and checkpoint name
45
+ * @throws {SandboxResponseError} If the sandbox is not found or checkpoint creation fails
46
+ */
47
+ export async function diskCheckpointCreate(client, params) {
48
+ const { sandboxId, name, orgId } = params;
49
+ const queryParams = new URLSearchParams();
50
+ if (orgId) {
51
+ queryParams.set('orgId', orgId);
52
+ }
53
+ const queryString = queryParams.toString();
54
+ const url = `/sandbox/${encodeURIComponent(sandboxId)}/checkpoint${queryString ? `?${queryString}` : ''}`;
55
+ const resp = await client.post(url, { name }, CreateDiskCheckpointResponseSchema);
56
+ if (resp.success) {
57
+ return resp.data;
58
+ }
59
+ throwSandboxError(resp, { sandboxId });
60
+ }
61
+ /**
62
+ * Lists all disk checkpoints for a sandbox.
63
+ *
64
+ * @param client - The API client to use for the request
65
+ * @param params - Parameters including the sandbox ID
66
+ * @throws {SandboxResponseError} If the sandbox is not found or listing fails
67
+ */
68
+ export async function diskCheckpointList(client, params) {
69
+ const { sandboxId, orgId } = params;
70
+ const queryParams = new URLSearchParams();
71
+ if (orgId) {
72
+ queryParams.set('orgId', orgId);
73
+ }
74
+ const queryString = queryParams.toString();
75
+ const url = `/sandbox/checkpoints/${encodeURIComponent(sandboxId)}${queryString ? `?${queryString}` : ''}`;
76
+ const resp = await client.get(url, ListDiskCheckpointsResponseSchema);
77
+ if (resp.success) {
78
+ return resp.data.checkpoints;
79
+ }
80
+ throwSandboxError(resp, { sandboxId });
81
+ }
82
+ /**
83
+ * Restores a sandbox to a specific disk checkpoint.
84
+ *
85
+ * @param client - The API client to use for the request
86
+ * @param params - Parameters including the sandbox ID and checkpoint ID
87
+ * @throws {SandboxResponseError} If the sandbox or checkpoint is not found, or restore fails
88
+ */
89
+ export async function diskCheckpointRestore(client, params) {
90
+ const { sandboxId, checkpointId, orgId } = params;
91
+ const queryParams = new URLSearchParams();
92
+ if (orgId) {
93
+ queryParams.set('orgId', orgId);
94
+ }
95
+ const queryString = queryParams.toString();
96
+ const url = `/sandbox/${encodeURIComponent(sandboxId)}/checkpoint/${encodeURIComponent(checkpointId)}/restore${queryString ? `?${queryString}` : ''}`;
97
+ const resp = await client.post(url, undefined, RestoreDiskCheckpointResponseSchema);
98
+ if (resp.success) {
99
+ return;
100
+ }
101
+ throwSandboxError(resp, { sandboxId });
102
+ }
103
+ /**
104
+ * Deletes a disk checkpoint from a sandbox.
105
+ *
106
+ * @param client - The API client to use for the request
107
+ * @param params - Parameters including the sandbox ID and checkpoint ID
108
+ * @throws {SandboxResponseError} If the sandbox or checkpoint is not found, or deletion fails
109
+ */
110
+ export async function diskCheckpointDelete(client, params) {
111
+ const { sandboxId, checkpointId, orgId } = params;
112
+ const queryParams = new URLSearchParams();
113
+ if (orgId) {
114
+ queryParams.set('orgId', orgId);
115
+ }
116
+ const queryString = queryParams.toString();
117
+ const url = `/sandbox/${encodeURIComponent(sandboxId)}/checkpoint/${encodeURIComponent(checkpointId)}${queryString ? `?${queryString}` : ''}`;
118
+ const resp = await client.delete(url, DeleteDiskCheckpointResponseSchema);
119
+ if (resp.success) {
120
+ return;
121
+ }
122
+ throwSandboxError(resp, { sandboxId });
123
+ }
124
+ //# sourceMappingURL=disk-checkpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disk-checkpoint.js","sourceRoot":"","sources":["../src/disk-checkpoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,kBAAkB;AAElB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IACnE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC1D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC3D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CACtE,CAAC,CAAC;AAIH,MAAM,8BAA8B,GAAG,wBAAwB,CAAC;AAChE,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAAiB,CAAC,8BAA8B,CAAC,CAAC;AAEpG,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;CAC9C,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,iBAAiB,CAAC,6BAA6B,CAAC,CA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;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,MAAiB,EACjB,MAAkC;IAElC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAClD,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;IAC1C,IAAI,KAAK,EAAE,CAAC;QACX,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC3C,MAAM,GAAG,GAAG,YAAY,kBAAkB,CAAC,SAAS,CAAC,eAAe,kBAAkB,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAE9I,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAC/B,GAAG,EACH,kCAAkC,CAClC,CAAC;IAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO;IACR,CAAC;IAED,iBAAiB,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { type APIClient } from '@agentuity/api';
3
+ export declare const SandboxEventInfoSchema: z.ZodObject<{
4
+ eventId: z.ZodString;
5
+ sandboxId: z.ZodString;
6
+ type: z.ZodString;
7
+ event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8
+ createdAt: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export declare const SandboxEventListDataSchema: z.ZodObject<{
11
+ events: z.ZodArray<z.ZodObject<{
12
+ eventId: z.ZodString;
13
+ sandboxId: z.ZodString;
14
+ type: z.ZodString;
15
+ event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
16
+ createdAt: z.ZodString;
17
+ }, z.core.$strip>>;
18
+ }, z.core.$strip>;
19
+ export declare const SandboxEventListResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
20
+ success: z.ZodLiteral<false>;
21
+ message: z.ZodString;
22
+ code: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>, z.ZodObject<{
24
+ success: z.ZodLiteral<true>;
25
+ data: z.ZodObject<{
26
+ events: z.ZodArray<z.ZodObject<{
27
+ eventId: z.ZodString;
28
+ sandboxId: z.ZodString;
29
+ type: z.ZodString;
30
+ event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
31
+ createdAt: z.ZodString;
32
+ }, z.core.$strip>>;
33
+ }, z.core.$strip>;
34
+ }, z.core.$strip>], "success">;
35
+ export type SandboxEventInfo = z.infer<typeof SandboxEventInfoSchema>;
36
+ export declare const SandboxEventListParamsSchema: z.ZodObject<{
37
+ sandboxId: z.ZodString;
38
+ orgId: z.ZodOptional<z.ZodString>;
39
+ limit: z.ZodOptional<z.ZodNumber>;
40
+ direction: z.ZodOptional<z.ZodEnum<{
41
+ asc: "asc";
42
+ desc: "desc";
43
+ }>>;
44
+ }, z.core.$strip>;
45
+ export type SandboxEventListParams = z.infer<typeof SandboxEventListParamsSchema>;
46
+ export type SandboxEventListResponse = z.infer<typeof SandboxEventListDataSchema>;
47
+ /**
48
+ * Lists all events for a specific sandbox, ordered by creation time (oldest first by default).
49
+ *
50
+ * @param client - The API client to use for the request
51
+ * @param params - Parameters including the sandbox ID, optional limit, and sort direction
52
+ * @returns List of event information for the sandbox
53
+ * @throws {SandboxResponseError} If the sandbox is not found or request fails
54
+ */
55
+ export declare function sandboxEventList(client: APIClient, params: SandboxEventListParams): Promise<SandboxEventListResponse>;
56
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAInE,eAAO,MAAM,sBAAsB;;;;;;iBAQY,CAAC;AAEhD,eAAO,MAAM,0BAA0B;;;;;;;;iBAIG,CAAC;AAE3C,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;8BAAgD,CAAC;AAE5F,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,4BAA4B;;;;;;;;iBAKvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAElF;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,sBAAsB,GAC5B,OAAO,CAAC,wBAAwB,CAAC,CAyBnC"}
package/dist/events.js ADDED
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ import { APIResponseSchema } from '@agentuity/api';
3
+ import { SortDirectionSchema } from '@agentuity/client';
4
+ import { throwSandboxError } from './util.js';
5
+ export const SandboxEventInfoSchema = z
6
+ .object({
7
+ eventId: z.string().describe('Unique identifier for the event'),
8
+ sandboxId: z.string().describe('ID of the sandbox this event belongs to'),
9
+ type: z.string().describe('Type of event (e.g., create, destroy, lifecycle:started)'),
10
+ event: z.record(z.string(), z.unknown()).describe('Event data payload'),
11
+ createdAt: z.string().describe('ISO timestamp when the event was recorded'),
12
+ })
13
+ .describe('Information about a sandbox event');
14
+ export const SandboxEventListDataSchema = z
15
+ .object({
16
+ events: z.array(SandboxEventInfoSchema).describe('List of sandbox events'),
17
+ })
18
+ .describe('List of events for a sandbox');
19
+ export const SandboxEventListResponseSchema = APIResponseSchema(SandboxEventListDataSchema);
20
+ export const SandboxEventListParamsSchema = z.object({
21
+ sandboxId: z.string().describe('sandbox id'),
22
+ orgId: z.string().optional().describe('organization id'),
23
+ limit: z.number().optional().describe('limit'),
24
+ direction: SortDirectionSchema.optional().describe('sort direction (default: asc)'),
25
+ });
26
+ /**
27
+ * Lists all events for a specific sandbox, ordered by creation time (oldest first by default).
28
+ *
29
+ * @param client - The API client to use for the request
30
+ * @param params - Parameters including the sandbox ID, optional limit, and sort direction
31
+ * @returns List of event information for the sandbox
32
+ * @throws {SandboxResponseError} If the sandbox is not found or request fails
33
+ */
34
+ export async function sandboxEventList(client, params) {
35
+ const { sandboxId, orgId, limit, direction } = params;
36
+ const queryParams = new URLSearchParams();
37
+ if (orgId) {
38
+ queryParams.set('orgId', orgId);
39
+ }
40
+ if (limit !== undefined) {
41
+ queryParams.set('limit', String(limit));
42
+ }
43
+ if (direction) {
44
+ queryParams.set('direction', direction);
45
+ }
46
+ const queryString = queryParams.toString();
47
+ const url = `/sandbox/sandboxes/${sandboxId}/events${queryString ? `?${queryString}` : ''}`;
48
+ const resp = await client.get(url, SandboxEventListResponseSchema);
49
+ if (resp.success) {
50
+ return resp.data;
51
+ }
52
+ throwSandboxError(resp, { sandboxId });
53
+ }
54
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACrC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC/D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IACzE,IAAI,EAAE,C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E,CAAC;IAC1C,IAAI,KAAK,EAAE,CAAC;QACX,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACf,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC3C,MAAM,GAAG,GAAG,sBAAsB,SAAS,UAAU,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAE5F,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAC5B,GAAG,EACH,8BAA8B,CAC9B,CAAC;IAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED,iBAAiB,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,99 @@
1
+ import type { Execution } from './types.ts';
2
+ import { z } from 'zod';
3
+ import type { APIClient } from '@agentuity/api';
4
+ export declare const ExecuteRequestSchema: z.ZodObject<{
5
+ command: z.ZodArray<z.ZodString>;
6
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
+ path: z.ZodString;
8
+ content: z.ZodString;
9
+ }, z.core.$strip>>>;
10
+ timeout: z.ZodOptional<z.ZodString>;
11
+ stream: z.ZodOptional<z.ZodObject<{
12
+ stdout: z.ZodOptional<z.ZodString>;
13
+ stderr: z.ZodOptional<z.ZodString>;
14
+ timestamps: z.ZodOptional<z.ZodBoolean>;
15
+ }, z.core.$strip>>;
16
+ }, z.core.$strip>;
17
+ export declare const ExecuteDataSchema: z.ZodObject<{
18
+ executionId: z.ZodString;
19
+ status: z.ZodEnum<{
20
+ cancelled: "cancelled";
21
+ completed: "completed";
22
+ failed: "failed";
23
+ queued: "queued";
24
+ running: "running";
25
+ timeout: "timeout";
26
+ }>;
27
+ exitCode: z.ZodOptional<z.ZodNumber>;
28
+ durationMs: z.ZodOptional<z.ZodNumber>;
29
+ stdoutStreamUrl: z.ZodOptional<z.ZodString>;
30
+ stderrStreamUrl: z.ZodOptional<z.ZodString>;
31
+ outputTruncated: z.ZodOptional<z.ZodBoolean>;
32
+ }, z.core.$strip>;
33
+ export declare const ExecuteResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ success: z.ZodLiteral<false>;
35
+ message: z.ZodString;
36
+ code: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$strip>, z.ZodObject<{
38
+ success: z.ZodLiteral<true>;
39
+ data: z.ZodObject<{
40
+ executionId: z.ZodString;
41
+ status: z.ZodEnum<{
42
+ cancelled: "cancelled";
43
+ completed: "completed";
44
+ failed: "failed";
45
+ queued: "queued";
46
+ running: "running";
47
+ timeout: "timeout";
48
+ }>;
49
+ exitCode: z.ZodOptional<z.ZodNumber>;
50
+ durationMs: z.ZodOptional<z.ZodNumber>;
51
+ stdoutStreamUrl: z.ZodOptional<z.ZodString>;
52
+ stderrStreamUrl: z.ZodOptional<z.ZodString>;
53
+ outputTruncated: z.ZodOptional<z.ZodBoolean>;
54
+ }, z.core.$strip>;
55
+ autoResumed: z.ZodOptional<z.ZodBoolean>;
56
+ }, z.core.$strip>], "success">;
57
+ export declare const SandboxExecuteParamsSchema: z.ZodObject<{
58
+ sandboxId: z.ZodString;
59
+ options: z.ZodCustom<{
60
+ command: string[];
61
+ files?: {
62
+ path: string;
63
+ content: Uint8Array<ArrayBuffer>;
64
+ }[] | undefined;
65
+ timeout?: string | undefined;
66
+ stream?: {
67
+ stdout?: string | undefined;
68
+ stderr?: string | undefined;
69
+ timestamps?: boolean | undefined;
70
+ } | undefined;
71
+ signal?: AbortSignal | undefined;
72
+ }, {
73
+ command: string[];
74
+ files?: {
75
+ path: string;
76
+ content: Uint8Array<ArrayBuffer>;
77
+ }[] | undefined;
78
+ timeout?: string | undefined;
79
+ stream?: {
80
+ stdout?: string | undefined;
81
+ stderr?: string | undefined;
82
+ timestamps?: boolean | undefined;
83
+ } | undefined;
84
+ signal?: AbortSignal | undefined;
85
+ }>;
86
+ orgId: z.ZodOptional<z.ZodString>;
87
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
88
+ }, z.core.$strip>;
89
+ export type SandboxExecuteParams = z.infer<typeof SandboxExecuteParamsSchema>;
90
+ /**
91
+ * Executes a command in an existing sandbox.
92
+ *
93
+ * @param client - The API client to use for the request
94
+ * @param params - Parameters including sandbox ID and execution options
95
+ * @returns The execution result including status and stream URLs
96
+ * @throws {SandboxResponseError} If the execution request fails
97
+ */
98
+ export declare function sandboxExecute(client: APIClient, params: SandboxExecuteParams): Promise<Execution>;
99
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,SAAS,EAAmB,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAsB8B,CAAC;AAEhE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;iBAeoB,CAAC;AAEnD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;8BAYhC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;;;;GAOG;AACH,wBAAsB,cAAc,CACnC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,oBAAoB,GAC1B,OAAO,CAAC,SAAS,CAAC,CAqFpB"}
@@ -0,0 +1,138 @@
1
+ import { z } from 'zod';
2
+ import { SandboxBusyError, SandboxNotFoundError, throwSandboxError } from './util.js';
3
+ import { base64Encode } from './base64.js';
4
+ export const ExecuteRequestSchema = z
5
+ .object({
6
+ command: z.array(z.string()).describe('Command and arguments to execute'),
7
+ files: z
8
+ .array(z.object({
9
+ path: z.string().describe('File path relative to workspace'),
10
+ content: z.string().describe('Base64-encoded file content'),
11
+ }))
12
+ .optional()
13
+ .describe('Files to write before execution'),
14
+ timeout: z.string().optional().describe('Execution timeout (e.g., "30s", "5m")'),
15
+ stream: z
16
+ .object({
17
+ stdout: z.string().optional().describe('Stream ID for stdout output'),
18
+ stderr: z.string().optional().describe('Stream ID for stderr output'),
19
+ timestamps: z.boolean().optional().describe('Whether to include timestamps in output'),
20
+ })
21
+ .optional()
22
+ .describe('Stream configuration for output redirection'),
23
+ })
24
+ .describe('Request body for executing a command in a sandbox');
25
+ export const ExecuteDataSchema = z
26
+ .object({
27
+ executionId: z.string().describe('Unique identifier for the execution'),
28
+ status: z
29
+ .enum(['queued', 'running', 'completed', 'failed', 'timeout', 'cancelled'])
30
+ .describe('Current status of the execution'),
31
+ exitCode: z.number().optional().describe('Exit code of the executed command'),
32
+ durationMs: z.number().optional().describe('Execution duration in milliseconds'),
33
+ stdoutStreamUrl: z.string().optional().describe('URL for streaming stdout output'),
34
+ stderrStreamUrl: z.string().optional().describe('URL for streaming stderr output'),
35
+ outputTruncated: z
36
+ .boolean()
37
+ .optional()
38
+ .describe('Whether the captured output was truncated due to size limits'),
39
+ })
40
+ .describe('Response data from command execution');
41
+ export const ExecuteResponseSchema = z.discriminatedUnion('success', [
42
+ z.object({
43
+ success: z.literal(false),
44
+ message: z.string(),
45
+ code: z.string().optional(),
46
+ }),
47
+ z.object({
48
+ success: z.literal(true),
49
+ data: ExecuteDataSchema,
50
+ /** True if the sandbox was automatically resumed from a suspended state */
51
+ autoResumed: z.boolean().optional(),
52
+ }),
53
+ ]);
54
+ export const SandboxExecuteParamsSchema = z.object({
55
+ sandboxId: z.string().describe('Sandbox ID where command should execute'),
56
+ options: z.custom().describe('Command execution options'),
57
+ orgId: z.string().optional().describe('Optional org id for CLI auth context'),
58
+ signal: z.custom().optional().describe('Optional abort signal for cancellation'),
59
+ });
60
+ /**
61
+ * Executes a command in an existing sandbox.
62
+ *
63
+ * @param client - The API client to use for the request
64
+ * @param params - Parameters including sandbox ID and execution options
65
+ * @returns The execution result including status and stream URLs
66
+ * @throws {SandboxResponseError} If the execution request fails
67
+ */
68
+ export async function sandboxExecute(client, params) {
69
+ const { sandboxId, options, orgId, signal } = params;
70
+ const body = {
71
+ command: options.command,
72
+ };
73
+ if (options.files && options.files.length > 0) {
74
+ body.files = options.files.map((f) => ({
75
+ path: f.path,
76
+ content: base64Encode(f.content),
77
+ }));
78
+ }
79
+ if (options.timeout) {
80
+ body.timeout = options.timeout;
81
+ }
82
+ if (options.stream) {
83
+ body.stream = options.stream;
84
+ }
85
+ const queryParams = new URLSearchParams();
86
+ if (orgId) {
87
+ queryParams.set('orgId', orgId);
88
+ }
89
+ const queryString = queryParams.toString();
90
+ const url = `/sandbox/${sandboxId}/execute${queryString ? `?${queryString}` : ''}`;
91
+ let resp;
92
+ try {
93
+ resp = await client.post(url, body, ExecuteResponseSchema, ExecuteRequestSchema, signal ?? options.signal);
94
+ }
95
+ catch (error) {
96
+ if (error &&
97
+ typeof error === 'object' &&
98
+ '_tag' in error &&
99
+ error._tag === 'APIErrorResponse' &&
100
+ 'status' in error) {
101
+ const status = error.status;
102
+ // Detect 404 Not Found — sandbox may not exist or may still be initializing.
103
+ // The server normally handles the creating→idle wait transparently, but this
104
+ // provides a clear typed error if a 404 reaches the SDK for any reason.
105
+ if (status === 404) {
106
+ throw new SandboxNotFoundError({
107
+ message: 'Sandbox not found. If you just created this sandbox, it may still be initializing. The server should handle this automatically — if this persists, the sandbox may have been destroyed.',
108
+ sandboxId,
109
+ });
110
+ }
111
+ // Detect 409 Conflict (sandbox busy) and throw a specific error.
112
+ // The sandbox API client is configured with maxRetries: 0 to fail fast
113
+ // when sandbox is busy (retrying wouldn't help - sandbox is still busy).
114
+ // Convert APIErrorResponse with status 409 to SandboxBusyError for clarity.
115
+ if (status === 409) {
116
+ throw new SandboxBusyError({
117
+ message: 'Sandbox is currently busy executing another command. Please wait for the current execution to complete before submitting a new one.',
118
+ sandboxId,
119
+ });
120
+ }
121
+ }
122
+ throw error;
123
+ }
124
+ if (resp.success) {
125
+ return {
126
+ executionId: resp.data.executionId,
127
+ status: resp.data.status,
128
+ exitCode: resp.data.exitCode,
129
+ durationMs: resp.data.durationMs,
130
+ stdoutStreamUrl: resp.data.stdoutStreamUrl,
131
+ stderrStreamUrl: resp.data.stderrStreamUrl,
132
+ outputTruncated: resp.data.outputTruncated,
133
+ autoResumed: resp.autoResumed,
134
+ };
135
+ }
136
+ throwSandboxError(resp, { sandboxId });
137
+ }
138
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KACnC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IACzE,KAAK,EAAE,CAAC;SACN,KAAK,CACL,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EA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C,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,150 @@
1
+ import { z } from 'zod';
2
+ import { type APIClient } from '@agentuity/api';
3
+ export declare const ExecutionInfoSchema: z.ZodObject<{
4
+ executionId: z.ZodString;
5
+ sandboxId: z.ZodString;
6
+ type: z.ZodOptional<z.ZodString>;
7
+ status: z.ZodEnum<{
8
+ cancelled: "cancelled";
9
+ completed: "completed";
10
+ failed: "failed";
11
+ queued: "queued";
12
+ running: "running";
13
+ timeout: "timeout";
14
+ }>;
15
+ command: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
+ exitCode: z.ZodOptional<z.ZodNumber>;
17
+ durationMs: z.ZodOptional<z.ZodNumber>;
18
+ startedAt: z.ZodOptional<z.ZodString>;
19
+ completedAt: z.ZodOptional<z.ZodString>;
20
+ error: z.ZodOptional<z.ZodString>;
21
+ stdoutStreamUrl: z.ZodOptional<z.ZodString>;
22
+ stderrStreamUrl: z.ZodOptional<z.ZodString>;
23
+ outputTruncated: z.ZodOptional<z.ZodBoolean>;
24
+ }, z.core.$strip>;
25
+ export declare const ExecutionGetResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
26
+ success: z.ZodLiteral<false>;
27
+ message: z.ZodString;
28
+ code: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>, z.ZodObject<{
30
+ success: z.ZodLiteral<true>;
31
+ data: z.ZodObject<{
32
+ executionId: z.ZodString;
33
+ sandboxId: z.ZodString;
34
+ type: z.ZodOptional<z.ZodString>;
35
+ status: z.ZodEnum<{
36
+ cancelled: "cancelled";
37
+ completed: "completed";
38
+ failed: "failed";
39
+ queued: "queued";
40
+ running: "running";
41
+ timeout: "timeout";
42
+ }>;
43
+ command: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
+ exitCode: z.ZodOptional<z.ZodNumber>;
45
+ durationMs: z.ZodOptional<z.ZodNumber>;
46
+ startedAt: z.ZodOptional<z.ZodString>;
47
+ completedAt: z.ZodOptional<z.ZodString>;
48
+ error: z.ZodOptional<z.ZodString>;
49
+ stdoutStreamUrl: z.ZodOptional<z.ZodString>;
50
+ stderrStreamUrl: z.ZodOptional<z.ZodString>;
51
+ outputTruncated: z.ZodOptional<z.ZodBoolean>;
52
+ }, z.core.$strip>;
53
+ }, z.core.$strip>], "success">;
54
+ export declare const ExecutionListDataSchema: z.ZodObject<{
55
+ executions: z.ZodArray<z.ZodObject<{
56
+ executionId: z.ZodString;
57
+ sandboxId: z.ZodString;
58
+ type: z.ZodOptional<z.ZodString>;
59
+ status: z.ZodEnum<{
60
+ cancelled: "cancelled";
61
+ completed: "completed";
62
+ failed: "failed";
63
+ queued: "queued";
64
+ running: "running";
65
+ timeout: "timeout";
66
+ }>;
67
+ command: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
+ exitCode: z.ZodOptional<z.ZodNumber>;
69
+ durationMs: z.ZodOptional<z.ZodNumber>;
70
+ startedAt: z.ZodOptional<z.ZodString>;
71
+ completedAt: z.ZodOptional<z.ZodString>;
72
+ error: z.ZodOptional<z.ZodString>;
73
+ stdoutStreamUrl: z.ZodOptional<z.ZodString>;
74
+ stderrStreamUrl: z.ZodOptional<z.ZodString>;
75
+ outputTruncated: z.ZodOptional<z.ZodBoolean>;
76
+ }, z.core.$strip>>;
77
+ }, z.core.$strip>;
78
+ export declare const ExecutionListResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
79
+ success: z.ZodLiteral<false>;
80
+ message: z.ZodString;
81
+ code: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ success: z.ZodLiteral<true>;
84
+ data: z.ZodObject<{
85
+ executions: z.ZodArray<z.ZodObject<{
86
+ executionId: z.ZodString;
87
+ sandboxId: z.ZodString;
88
+ type: z.ZodOptional<z.ZodString>;
89
+ status: z.ZodEnum<{
90
+ cancelled: "cancelled";
91
+ completed: "completed";
92
+ failed: "failed";
93
+ queued: "queued";
94
+ running: "running";
95
+ timeout: "timeout";
96
+ }>;
97
+ command: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ exitCode: z.ZodOptional<z.ZodNumber>;
99
+ durationMs: z.ZodOptional<z.ZodNumber>;
100
+ startedAt: z.ZodOptional<z.ZodString>;
101
+ completedAt: z.ZodOptional<z.ZodString>;
102
+ error: z.ZodOptional<z.ZodString>;
103
+ stdoutStreamUrl: z.ZodOptional<z.ZodString>;
104
+ stderrStreamUrl: z.ZodOptional<z.ZodString>;
105
+ outputTruncated: z.ZodOptional<z.ZodBoolean>;
106
+ }, z.core.$strip>>;
107
+ }, z.core.$strip>;
108
+ }, z.core.$strip>], "success">;
109
+ export type ExecutionInfo = z.infer<typeof ExecutionInfoSchema>;
110
+ export declare const ExecutionGetParamsSchema: z.ZodObject<{
111
+ executionId: z.ZodString;
112
+ orgId: z.ZodOptional<z.ZodString>;
113
+ wait: z.ZodOptional<z.ZodString>;
114
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
115
+ }, z.core.$strip>;
116
+ export type ExecutionGetParams = z.infer<typeof ExecutionGetParamsSchema>;
117
+ /**
118
+ * Retrieves detailed information about a specific execution.
119
+ *
120
+ * @param client - The API client to use for the request
121
+ * @param params - Parameters including the execution ID and optional wait duration
122
+ * @returns Detailed execution information including status, timing, and errors
123
+ * @throws {SandboxResponseError} If the execution is not found or request fails
124
+ *
125
+ * @example
126
+ * // Immediate return (current behavior)
127
+ * const info = await executionGet(client, { executionId: 'exec_123' });
128
+ *
129
+ * @example
130
+ * // Long-poll: wait up to 60 seconds for completion
131
+ * const info = await executionGet(client, { executionId: 'exec_123', wait: '60s' });
132
+ */
133
+ export declare function executionGet(client: APIClient, params: ExecutionGetParams): Promise<ExecutionInfo>;
134
+ export declare const ExecutionListParamsSchema: z.ZodObject<{
135
+ sandboxId: z.ZodString;
136
+ orgId: z.ZodOptional<z.ZodString>;
137
+ limit: z.ZodOptional<z.ZodNumber>;
138
+ }, z.core.$strip>;
139
+ export type ExecutionListParams = z.infer<typeof ExecutionListParamsSchema>;
140
+ export type ExecutionListResponse = z.infer<typeof ExecutionListDataSchema>;
141
+ /**
142
+ * Lists all executions for a specific sandbox.
143
+ *
144
+ * @param client - The API client to use for the request
145
+ * @param params - Parameters including the sandbox ID and optional limit
146
+ * @returns List of execution information for the sandbox
147
+ * @throws {SandboxResponseError} If the sandbox is not found or request fails
148
+ */
149
+ export declare function executionList(client: APIClient, params: ExecutionListParams): Promise<ExecutionListResponse>;
150
+ //# sourceMappingURL=execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAGnE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;iBAsB4B,CAAC;AAE7D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAAyC,CAAC;AAEjF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;iBAIU,CAAC;AAE/C,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAA6C,CAAC;AAEtF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,wBAAwB;;;;;iBAOnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,kBAAkB,GACxB,OAAO,CAAC,aAAa,CAAC,CAqCxB;AAED,eAAO,MAAM,yBAAyB;;;;iBAIpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE5E;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAClC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,mBAAmB,GACzB,OAAO,CAAC,qBAAqB,CAAC,CAsBhC"}