sandbox-agent 0.2.1 → 0.2.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { NewSessionRequest, AnyMessage, AcpEnvelopeDirection, NewSessionResponse, PromptRequest, PromptResponse } from 'acp-http-client';
1
+ import { NewSessionRequest, SessionConfigOption, SessionModeState, AnyMessage, AcpEnvelopeDirection, NewSessionResponse, PromptRequest, PromptResponse, SetSessionModeResponse, SetSessionConfigOptionResponse } from 'acp-http-client';
2
2
  export { AcpRpcError } from 'acp-http-client';
3
3
 
4
4
  type SandboxAgentSpawnLogMode = "inherit" | "pipe" | "silent";
@@ -85,7 +85,7 @@ interface components {
85
85
  agents: components["schemas"]["AgentInfo"][];
86
86
  };
87
87
  /** @enum {string} */
88
- ErrorType: "invalid_request" | "conflict" | "unsupported_agent" | "agent_not_installed" | "install_failed" | "agent_process_exited" | "token_invalid" | "permission_denied" | "not_acceptable" | "unsupported_media_type" | "session_not_found" | "session_already_exists" | "mode_not_supported" | "stream_error" | "timeout";
88
+ ErrorType: "invalid_request" | "conflict" | "unsupported_agent" | "agent_not_installed" | "install_failed" | "agent_process_exited" | "token_invalid" | "permission_denied" | "not_acceptable" | "unsupported_media_type" | "not_found" | "session_not_found" | "session_already_exists" | "mode_not_supported" | "stream_error" | "timeout";
89
89
  FsActionResponse: {
90
90
  path: string;
91
91
  };
@@ -182,6 +182,116 @@ interface components {
182
182
  type: string;
183
183
  [key: string]: unknown;
184
184
  };
185
+ ProcessConfig: {
186
+ /** Format: int64 */
187
+ defaultRunTimeoutMs: number;
188
+ maxConcurrentProcesses: number;
189
+ maxInputBytesPerRequest: number;
190
+ maxLogBytesPerProcess: number;
191
+ maxOutputBytes: number;
192
+ /** Format: int64 */
193
+ maxRunTimeoutMs: number;
194
+ };
195
+ ProcessCreateRequest: {
196
+ args?: string[];
197
+ command: string;
198
+ cwd?: string | null;
199
+ env?: {
200
+ [key: string]: string;
201
+ };
202
+ interactive?: boolean;
203
+ tty?: boolean;
204
+ };
205
+ ProcessInfo: {
206
+ args: string[];
207
+ command: string;
208
+ /** Format: int64 */
209
+ createdAtMs: number;
210
+ cwd?: string | null;
211
+ /** Format: int32 */
212
+ exitCode?: number | null;
213
+ /** Format: int64 */
214
+ exitedAtMs?: number | null;
215
+ id: string;
216
+ interactive: boolean;
217
+ /** Format: int32 */
218
+ pid?: number | null;
219
+ status: components["schemas"]["ProcessState"];
220
+ tty: boolean;
221
+ };
222
+ ProcessInputRequest: {
223
+ data: string;
224
+ encoding?: string | null;
225
+ };
226
+ ProcessInputResponse: {
227
+ bytesWritten: number;
228
+ };
229
+ ProcessListResponse: {
230
+ processes: components["schemas"]["ProcessInfo"][];
231
+ };
232
+ ProcessLogEntry: {
233
+ data: string;
234
+ encoding: string;
235
+ /** Format: int64 */
236
+ sequence: number;
237
+ stream: components["schemas"]["ProcessLogsStream"];
238
+ /** Format: int64 */
239
+ timestampMs: number;
240
+ };
241
+ ProcessLogsQuery: {
242
+ follow?: boolean | null;
243
+ /** Format: int64 */
244
+ since?: number | null;
245
+ stream?: components["schemas"]["ProcessLogsStream"] | null;
246
+ tail?: number | null;
247
+ };
248
+ ProcessLogsResponse: {
249
+ entries: components["schemas"]["ProcessLogEntry"][];
250
+ processId: string;
251
+ stream: components["schemas"]["ProcessLogsStream"];
252
+ };
253
+ /** @enum {string} */
254
+ ProcessLogsStream: "stdout" | "stderr" | "combined" | "pty";
255
+ ProcessRunRequest: {
256
+ args?: string[];
257
+ command: string;
258
+ cwd?: string | null;
259
+ env?: {
260
+ [key: string]: string;
261
+ };
262
+ maxOutputBytes?: number | null;
263
+ /** Format: int64 */
264
+ timeoutMs?: number | null;
265
+ };
266
+ ProcessRunResponse: {
267
+ /** Format: int64 */
268
+ durationMs: number;
269
+ /** Format: int32 */
270
+ exitCode?: number | null;
271
+ stderr: string;
272
+ stderrTruncated: boolean;
273
+ stdout: string;
274
+ stdoutTruncated: boolean;
275
+ timedOut: boolean;
276
+ };
277
+ ProcessSignalQuery: {
278
+ /** Format: int64 */
279
+ waitMs?: number | null;
280
+ };
281
+ /** @enum {string} */
282
+ ProcessState: "running" | "exited";
283
+ ProcessTerminalResizeRequest: {
284
+ /** Format: int32 */
285
+ cols: number;
286
+ /** Format: int32 */
287
+ rows: number;
288
+ };
289
+ ProcessTerminalResizeResponse: {
290
+ /** Format: int32 */
291
+ cols: number;
292
+ /** Format: int32 */
293
+ rows: number;
294
+ };
185
295
  /** @enum {string} */
186
296
  ServerStatus: "running" | "stopped";
187
297
  ServerStatusInfo: {
@@ -694,12 +804,495 @@ interface operations {
694
804
  };
695
805
  };
696
806
  };
807
+ /**
808
+ * List all managed processes.
809
+ * @description Returns a list of all processes (running and exited) currently tracked
810
+ * by the runtime, sorted by process ID.
811
+ */
812
+ get_v1_processes: {
813
+ responses: {
814
+ /** @description List processes */
815
+ 200: {
816
+ content: {
817
+ "application/json": components["schemas"]["ProcessListResponse"];
818
+ };
819
+ };
820
+ /** @description Process API unsupported on this platform */
821
+ 501: {
822
+ content: {
823
+ "application/json": components["schemas"]["ProblemDetails"];
824
+ };
825
+ };
826
+ };
827
+ };
828
+ /**
829
+ * Create a long-lived managed process.
830
+ * @description Spawns a new process with the given command and arguments. Supports both
831
+ * pipe-based and PTY (tty) modes. Returns the process descriptor on success.
832
+ */
833
+ post_v1_processes: {
834
+ requestBody: {
835
+ content: {
836
+ "application/json": components["schemas"]["ProcessCreateRequest"];
837
+ };
838
+ };
839
+ responses: {
840
+ /** @description Started process */
841
+ 200: {
842
+ content: {
843
+ "application/json": components["schemas"]["ProcessInfo"];
844
+ };
845
+ };
846
+ /** @description Invalid request */
847
+ 400: {
848
+ content: {
849
+ "application/json": components["schemas"]["ProblemDetails"];
850
+ };
851
+ };
852
+ /** @description Process limit or state conflict */
853
+ 409: {
854
+ content: {
855
+ "application/json": components["schemas"]["ProblemDetails"];
856
+ };
857
+ };
858
+ /** @description Process API unsupported on this platform */
859
+ 501: {
860
+ content: {
861
+ "application/json": components["schemas"]["ProblemDetails"];
862
+ };
863
+ };
864
+ };
865
+ };
866
+ /**
867
+ * Get process runtime configuration.
868
+ * @description Returns the current runtime configuration for the process management API,
869
+ * including limits for concurrency, timeouts, and buffer sizes.
870
+ */
871
+ get_v1_processes_config: {
872
+ responses: {
873
+ /** @description Current runtime process config */
874
+ 200: {
875
+ content: {
876
+ "application/json": components["schemas"]["ProcessConfig"];
877
+ };
878
+ };
879
+ /** @description Process API unsupported on this platform */
880
+ 501: {
881
+ content: {
882
+ "application/json": components["schemas"]["ProblemDetails"];
883
+ };
884
+ };
885
+ };
886
+ };
887
+ /**
888
+ * Update process runtime configuration.
889
+ * @description Replaces the runtime configuration for the process management API.
890
+ * Validates that all values are non-zero and clamps default timeout to max.
891
+ */
892
+ post_v1_processes_config: {
893
+ requestBody: {
894
+ content: {
895
+ "application/json": components["schemas"]["ProcessConfig"];
896
+ };
897
+ };
898
+ responses: {
899
+ /** @description Updated runtime process config */
900
+ 200: {
901
+ content: {
902
+ "application/json": components["schemas"]["ProcessConfig"];
903
+ };
904
+ };
905
+ /** @description Invalid config */
906
+ 400: {
907
+ content: {
908
+ "application/json": components["schemas"]["ProblemDetails"];
909
+ };
910
+ };
911
+ /** @description Process API unsupported on this platform */
912
+ 501: {
913
+ content: {
914
+ "application/json": components["schemas"]["ProblemDetails"];
915
+ };
916
+ };
917
+ };
918
+ };
919
+ /**
920
+ * Run a one-shot command.
921
+ * @description Executes a command to completion and returns its stdout, stderr, exit code,
922
+ * and duration. Supports configurable timeout and output size limits.
923
+ */
924
+ post_v1_processes_run: {
925
+ requestBody: {
926
+ content: {
927
+ "application/json": components["schemas"]["ProcessRunRequest"];
928
+ };
929
+ };
930
+ responses: {
931
+ /** @description One-off command result */
932
+ 200: {
933
+ content: {
934
+ "application/json": components["schemas"]["ProcessRunResponse"];
935
+ };
936
+ };
937
+ /** @description Invalid request */
938
+ 400: {
939
+ content: {
940
+ "application/json": components["schemas"]["ProblemDetails"];
941
+ };
942
+ };
943
+ /** @description Process API unsupported on this platform */
944
+ 501: {
945
+ content: {
946
+ "application/json": components["schemas"]["ProblemDetails"];
947
+ };
948
+ };
949
+ };
950
+ };
951
+ /**
952
+ * Get a single process by ID.
953
+ * @description Returns the current state of a managed process including its status,
954
+ * PID, exit code, and creation/exit timestamps.
955
+ */
956
+ get_v1_process: {
957
+ parameters: {
958
+ path: {
959
+ /** @description Process ID */
960
+ id: string;
961
+ };
962
+ };
963
+ responses: {
964
+ /** @description Process details */
965
+ 200: {
966
+ content: {
967
+ "application/json": components["schemas"]["ProcessInfo"];
968
+ };
969
+ };
970
+ /** @description Unknown process */
971
+ 404: {
972
+ content: {
973
+ "application/json": components["schemas"]["ProblemDetails"];
974
+ };
975
+ };
976
+ /** @description Process API unsupported on this platform */
977
+ 501: {
978
+ content: {
979
+ "application/json": components["schemas"]["ProblemDetails"];
980
+ };
981
+ };
982
+ };
983
+ };
984
+ /**
985
+ * Delete a process record.
986
+ * @description Removes a stopped process from the runtime. Returns 409 if the process
987
+ * is still running; stop or kill it first.
988
+ */
989
+ delete_v1_process: {
990
+ parameters: {
991
+ path: {
992
+ /** @description Process ID */
993
+ id: string;
994
+ };
995
+ };
996
+ responses: {
997
+ /** @description Process deleted */
998
+ 204: {
999
+ content: never;
1000
+ };
1001
+ /** @description Unknown process */
1002
+ 404: {
1003
+ content: {
1004
+ "application/json": components["schemas"]["ProblemDetails"];
1005
+ };
1006
+ };
1007
+ /** @description Process is still running */
1008
+ 409: {
1009
+ content: {
1010
+ "application/json": components["schemas"]["ProblemDetails"];
1011
+ };
1012
+ };
1013
+ /** @description Process API unsupported on this platform */
1014
+ 501: {
1015
+ content: {
1016
+ "application/json": components["schemas"]["ProblemDetails"];
1017
+ };
1018
+ };
1019
+ };
1020
+ };
1021
+ /**
1022
+ * Write input to a process.
1023
+ * @description Sends data to a process's stdin (pipe mode) or PTY writer (tty mode).
1024
+ * Data can be encoded as base64, utf8, or text. Returns 413 if the decoded
1025
+ * payload exceeds the configured `maxInputBytesPerRequest` limit.
1026
+ */
1027
+ post_v1_process_input: {
1028
+ parameters: {
1029
+ path: {
1030
+ /** @description Process ID */
1031
+ id: string;
1032
+ };
1033
+ };
1034
+ requestBody: {
1035
+ content: {
1036
+ "application/json": components["schemas"]["ProcessInputRequest"];
1037
+ };
1038
+ };
1039
+ responses: {
1040
+ /** @description Input accepted */
1041
+ 200: {
1042
+ content: {
1043
+ "application/json": components["schemas"]["ProcessInputResponse"];
1044
+ };
1045
+ };
1046
+ /** @description Invalid request */
1047
+ 400: {
1048
+ content: {
1049
+ "application/json": components["schemas"]["ProblemDetails"];
1050
+ };
1051
+ };
1052
+ /** @description Process not writable */
1053
+ 409: {
1054
+ content: {
1055
+ "application/json": components["schemas"]["ProblemDetails"];
1056
+ };
1057
+ };
1058
+ /** @description Input exceeds configured limit */
1059
+ 413: {
1060
+ content: {
1061
+ "application/json": components["schemas"]["ProblemDetails"];
1062
+ };
1063
+ };
1064
+ /** @description Process API unsupported on this platform */
1065
+ 501: {
1066
+ content: {
1067
+ "application/json": components["schemas"]["ProblemDetails"];
1068
+ };
1069
+ };
1070
+ };
1071
+ };
1072
+ /**
1073
+ * Send SIGKILL to a process.
1074
+ * @description Sends SIGKILL to the process and optionally waits up to `waitMs`
1075
+ * milliseconds for the process to exit before returning.
1076
+ */
1077
+ post_v1_process_kill: {
1078
+ parameters: {
1079
+ query?: {
1080
+ /** @description Wait up to N ms for process to exit */
1081
+ waitMs?: number | null;
1082
+ };
1083
+ path: {
1084
+ /** @description Process ID */
1085
+ id: string;
1086
+ };
1087
+ };
1088
+ responses: {
1089
+ /** @description Kill signal sent */
1090
+ 200: {
1091
+ content: {
1092
+ "application/json": components["schemas"]["ProcessInfo"];
1093
+ };
1094
+ };
1095
+ /** @description Unknown process */
1096
+ 404: {
1097
+ content: {
1098
+ "application/json": components["schemas"]["ProblemDetails"];
1099
+ };
1100
+ };
1101
+ /** @description Process API unsupported on this platform */
1102
+ 501: {
1103
+ content: {
1104
+ "application/json": components["schemas"]["ProblemDetails"];
1105
+ };
1106
+ };
1107
+ };
1108
+ };
1109
+ /**
1110
+ * Fetch process logs.
1111
+ * @description Returns buffered log entries for a process. Supports filtering by stream
1112
+ * type, tail count, and sequence-based resumption. When `follow=true`,
1113
+ * returns an SSE stream that replays buffered entries then streams live output.
1114
+ */
1115
+ get_v1_process_logs: {
1116
+ parameters: {
1117
+ query?: {
1118
+ /** @description stdout|stderr|combined|pty */
1119
+ stream?: components["schemas"]["ProcessLogsStream"] | null;
1120
+ /** @description Tail N entries */
1121
+ tail?: number | null;
1122
+ /** @description Follow via SSE */
1123
+ follow?: boolean | null;
1124
+ /** @description Only entries with sequence greater than this */
1125
+ since?: number | null;
1126
+ };
1127
+ path: {
1128
+ /** @description Process ID */
1129
+ id: string;
1130
+ };
1131
+ };
1132
+ responses: {
1133
+ /** @description Process logs */
1134
+ 200: {
1135
+ content: {
1136
+ "application/json": components["schemas"]["ProcessLogsResponse"];
1137
+ };
1138
+ };
1139
+ /** @description Unknown process */
1140
+ 404: {
1141
+ content: {
1142
+ "application/json": components["schemas"]["ProblemDetails"];
1143
+ };
1144
+ };
1145
+ /** @description Process API unsupported on this platform */
1146
+ 501: {
1147
+ content: {
1148
+ "application/json": components["schemas"]["ProblemDetails"];
1149
+ };
1150
+ };
1151
+ };
1152
+ };
1153
+ /**
1154
+ * Send SIGTERM to a process.
1155
+ * @description Sends SIGTERM to the process and optionally waits up to `waitMs`
1156
+ * milliseconds for the process to exit before returning.
1157
+ */
1158
+ post_v1_process_stop: {
1159
+ parameters: {
1160
+ query?: {
1161
+ /** @description Wait up to N ms for process to exit */
1162
+ waitMs?: number | null;
1163
+ };
1164
+ path: {
1165
+ /** @description Process ID */
1166
+ id: string;
1167
+ };
1168
+ };
1169
+ responses: {
1170
+ /** @description Stop signal sent */
1171
+ 200: {
1172
+ content: {
1173
+ "application/json": components["schemas"]["ProcessInfo"];
1174
+ };
1175
+ };
1176
+ /** @description Unknown process */
1177
+ 404: {
1178
+ content: {
1179
+ "application/json": components["schemas"]["ProblemDetails"];
1180
+ };
1181
+ };
1182
+ /** @description Process API unsupported on this platform */
1183
+ 501: {
1184
+ content: {
1185
+ "application/json": components["schemas"]["ProblemDetails"];
1186
+ };
1187
+ };
1188
+ };
1189
+ };
1190
+ /**
1191
+ * Resize a process terminal.
1192
+ * @description Sets the PTY window size (columns and rows) for a tty-mode process and
1193
+ * sends SIGWINCH so the child process can adapt.
1194
+ */
1195
+ post_v1_process_terminal_resize: {
1196
+ parameters: {
1197
+ path: {
1198
+ /** @description Process ID */
1199
+ id: string;
1200
+ };
1201
+ };
1202
+ requestBody: {
1203
+ content: {
1204
+ "application/json": components["schemas"]["ProcessTerminalResizeRequest"];
1205
+ };
1206
+ };
1207
+ responses: {
1208
+ /** @description Resize accepted */
1209
+ 200: {
1210
+ content: {
1211
+ "application/json": components["schemas"]["ProcessTerminalResizeResponse"];
1212
+ };
1213
+ };
1214
+ /** @description Invalid request */
1215
+ 400: {
1216
+ content: {
1217
+ "application/json": components["schemas"]["ProblemDetails"];
1218
+ };
1219
+ };
1220
+ /** @description Unknown process */
1221
+ 404: {
1222
+ content: {
1223
+ "application/json": components["schemas"]["ProblemDetails"];
1224
+ };
1225
+ };
1226
+ /** @description Not a terminal process */
1227
+ 409: {
1228
+ content: {
1229
+ "application/json": components["schemas"]["ProblemDetails"];
1230
+ };
1231
+ };
1232
+ /** @description Process API unsupported on this platform */
1233
+ 501: {
1234
+ content: {
1235
+ "application/json": components["schemas"]["ProblemDetails"];
1236
+ };
1237
+ };
1238
+ };
1239
+ };
1240
+ /**
1241
+ * Open an interactive WebSocket terminal session.
1242
+ * @description Upgrades the connection to a WebSocket for bidirectional PTY I/O. Accepts
1243
+ * `access_token` query param for browser-based auth (WebSocket API cannot
1244
+ * send custom headers). Streams raw PTY output as binary frames and accepts
1245
+ * JSON control frames for input, resize, and close.
1246
+ */
1247
+ get_v1_process_terminal_ws: {
1248
+ parameters: {
1249
+ query?: {
1250
+ /** @description Bearer token alternative for WS auth */
1251
+ access_token?: string | null;
1252
+ };
1253
+ path: {
1254
+ /** @description Process ID */
1255
+ id: string;
1256
+ };
1257
+ };
1258
+ responses: {
1259
+ /** @description WebSocket upgraded */
1260
+ 101: {
1261
+ content: never;
1262
+ };
1263
+ /** @description Invalid websocket frame or upgrade request */
1264
+ 400: {
1265
+ content: {
1266
+ "application/json": components["schemas"]["ProblemDetails"];
1267
+ };
1268
+ };
1269
+ /** @description Unknown process */
1270
+ 404: {
1271
+ content: {
1272
+ "application/json": components["schemas"]["ProblemDetails"];
1273
+ };
1274
+ };
1275
+ /** @description Not a terminal process */
1276
+ 409: {
1277
+ content: {
1278
+ "application/json": components["schemas"]["ProblemDetails"];
1279
+ };
1280
+ };
1281
+ /** @description Process API unsupported on this platform */
1282
+ 501: {
1283
+ content: {
1284
+ "application/json": components["schemas"]["ProblemDetails"];
1285
+ };
1286
+ };
1287
+ };
1288
+ };
697
1289
  }
698
1290
 
699
1291
  type ProblemDetails = components["schemas"]["ProblemDetails"];
700
1292
  type HealthResponse = JsonResponse<operations["get_v1_health"], 200>;
701
1293
  type AgentListResponse = JsonResponse<operations["get_v1_agents"], 200>;
702
1294
  type AgentInfo = components["schemas"]["AgentInfo"];
1295
+ type AgentQuery = QueryParams<operations["get_v1_agents"]>;
703
1296
  type AgentInstallRequest = JsonRequestBody<operations["post_v1_agent_install"]>;
704
1297
  type AgentInstallResponse = JsonResponse<operations["post_v1_agent_install"], 200>;
705
1298
  type AcpEnvelope = components["schemas"]["AcpEnvelope"];
@@ -720,6 +1313,46 @@ type McpConfigQuery = QueryParams<operations["get_v1_config_mcp"]>;
720
1313
  type McpServerConfig = components["schemas"]["McpServerConfig"];
721
1314
  type SkillsConfigQuery = QueryParams<operations["get_v1_config_skills"]>;
722
1315
  type SkillsConfig = components["schemas"]["SkillsConfig"];
1316
+ type ProcessConfig = JsonResponse<operations["get_v1_processes_config"], 200>;
1317
+ type ProcessCreateRequest = JsonRequestBody<operations["post_v1_processes"]>;
1318
+ type ProcessInfo = components["schemas"]["ProcessInfo"];
1319
+ type ProcessInputRequest = JsonRequestBody<operations["post_v1_process_input"]>;
1320
+ type ProcessInputResponse = JsonResponse<operations["post_v1_process_input"], 200>;
1321
+ type ProcessListResponse = JsonResponse<operations["get_v1_processes"], 200>;
1322
+ type ProcessLogEntry = components["schemas"]["ProcessLogEntry"];
1323
+ type ProcessLogsQuery = QueryParams<operations["get_v1_process_logs"]>;
1324
+ type ProcessLogsResponse = JsonResponse<operations["get_v1_process_logs"], 200>;
1325
+ type ProcessLogsStream = components["schemas"]["ProcessLogsStream"];
1326
+ type ProcessRunRequest = JsonRequestBody<operations["post_v1_processes_run"]>;
1327
+ type ProcessRunResponse = JsonResponse<operations["post_v1_processes_run"], 200>;
1328
+ type ProcessSignalQuery = QueryParams<operations["post_v1_process_stop"]>;
1329
+ type ProcessState = components["schemas"]["ProcessState"];
1330
+ type ProcessTerminalResizeRequest = JsonRequestBody<operations["post_v1_process_terminal_resize"]>;
1331
+ type ProcessTerminalResizeResponse = JsonResponse<operations["post_v1_process_terminal_resize"], 200>;
1332
+ type ProcessTerminalClientFrame = {
1333
+ type: "input";
1334
+ data: string;
1335
+ encoding?: string;
1336
+ } | {
1337
+ type: "resize";
1338
+ cols: number;
1339
+ rows: number;
1340
+ } | {
1341
+ type: "close";
1342
+ };
1343
+ interface ProcessTerminalReadyFrame {
1344
+ type: "ready";
1345
+ processId: string;
1346
+ }
1347
+ interface ProcessTerminalExitFrame {
1348
+ type: "exit";
1349
+ exitCode?: number | null;
1350
+ }
1351
+ interface ProcessTerminalErrorFrame {
1352
+ type: "error";
1353
+ message: string;
1354
+ }
1355
+ type ProcessTerminalServerFrame = ProcessTerminalReadyFrame | ProcessTerminalExitFrame | ProcessTerminalErrorFrame;
723
1356
  interface SessionRecord {
724
1357
  id: string;
725
1358
  agent: string;
@@ -728,6 +1361,8 @@ interface SessionRecord {
728
1361
  createdAt: number;
729
1362
  destroyedAt?: number;
730
1363
  sessionInit?: Omit<NewSessionRequest, "_meta">;
1364
+ configOptions?: SessionConfigOption[];
1365
+ modes?: SessionModeState | null;
731
1366
  }
732
1367
  type SessionEventSender = "client" | "agent";
733
1368
  interface SessionEvent {
@@ -798,12 +1433,17 @@ type QueryParams<T> = T extends {
798
1433
  };
799
1434
  } ? Q : never;
800
1435
 
1436
+ interface SandboxAgentHealthWaitOptions {
1437
+ timeoutMs?: number;
1438
+ }
801
1439
  interface SandboxAgentConnectCommonOptions {
802
1440
  headers?: HeadersInit;
803
1441
  persist?: SessionPersistDriver;
804
1442
  replayMaxEvents?: number;
805
1443
  replayMaxChars?: number;
1444
+ signal?: AbortSignal;
806
1445
  token?: string;
1446
+ waitForHealth?: boolean | SandboxAgentHealthWaitOptions;
807
1447
  }
808
1448
  type SandboxAgentConnectOptions = (SandboxAgentConnectCommonOptions & {
809
1449
  baseUrl: string;
@@ -824,22 +1464,65 @@ interface SessionCreateRequest {
824
1464
  id?: string;
825
1465
  agent: string;
826
1466
  sessionInit?: Omit<NewSessionRequest, "_meta">;
1467
+ model?: string;
1468
+ mode?: string;
1469
+ thoughtLevel?: string;
827
1470
  }
828
1471
  interface SessionResumeOrCreateRequest {
829
1472
  id: string;
830
1473
  agent: string;
831
1474
  sessionInit?: Omit<NewSessionRequest, "_meta">;
1475
+ model?: string;
1476
+ mode?: string;
1477
+ thoughtLevel?: string;
832
1478
  }
833
1479
  interface SessionSendOptions {
834
1480
  notification?: boolean;
835
1481
  }
836
1482
  type SessionEventListener = (event: SessionEvent) => void;
1483
+ type ProcessLogListener = (entry: ProcessLogEntry) => void;
1484
+ type ProcessLogFollowQuery = Omit<ProcessLogsQuery, "follow">;
1485
+ interface AgentQueryOptions {
1486
+ config?: boolean;
1487
+ noCache?: boolean;
1488
+ }
1489
+ interface ProcessLogSubscription {
1490
+ close(): void;
1491
+ closed: Promise<void>;
1492
+ }
1493
+ interface ProcessTerminalWebSocketUrlOptions {
1494
+ accessToken?: string;
1495
+ }
1496
+ interface ProcessTerminalConnectOptions extends ProcessTerminalWebSocketUrlOptions {
1497
+ protocols?: string | string[];
1498
+ WebSocket?: typeof WebSocket;
1499
+ }
837
1500
  declare class SandboxAgentError extends Error {
838
1501
  readonly status: number;
839
1502
  readonly problem?: ProblemDetails;
840
1503
  readonly response: Response;
841
1504
  constructor(status: number, problem: ProblemDetails | undefined, response: Response);
842
1505
  }
1506
+ declare class UnsupportedSessionCategoryError extends Error {
1507
+ readonly sessionId: string;
1508
+ readonly category: string;
1509
+ readonly availableCategories: string[];
1510
+ constructor(sessionId: string, category: string, availableCategories: string[]);
1511
+ }
1512
+ declare class UnsupportedSessionValueError extends Error {
1513
+ readonly sessionId: string;
1514
+ readonly category: string;
1515
+ readonly configId: string;
1516
+ readonly requestedValue: string;
1517
+ readonly allowedValues: string[];
1518
+ constructor(sessionId: string, category: string, configId: string, requestedValue: string, allowedValues: string[]);
1519
+ }
1520
+ declare class UnsupportedSessionConfigOptionError extends Error {
1521
+ readonly sessionId: string;
1522
+ readonly configId: string;
1523
+ readonly availableConfigIds: string[];
1524
+ constructor(sessionId: string, configId: string, availableConfigIds: string[]);
1525
+ }
843
1526
  declare class Session {
844
1527
  private record;
845
1528
  private readonly sandbox;
@@ -853,6 +1536,12 @@ declare class Session {
853
1536
  refresh(): Promise<Session>;
854
1537
  send(method: string, params?: Record<string, unknown>, options?: SessionSendOptions): Promise<unknown>;
855
1538
  prompt(prompt: PromptRequest["prompt"]): Promise<PromptResponse>;
1539
+ setMode(modeId: string): Promise<SetSessionModeResponse | void>;
1540
+ setConfigOption(configId: string, value: string): Promise<SetSessionConfigOptionResponse>;
1541
+ setModel(model: string): Promise<SetSessionConfigOptionResponse>;
1542
+ setThoughtLevel(thoughtLevel: string): Promise<SetSessionConfigOptionResponse>;
1543
+ getConfigOptions(): Promise<SessionConfigOption[]>;
1544
+ getModes(): Promise<SessionModeState | null>;
856
1545
  onEvent(listener: SessionEventListener): () => void;
857
1546
  toRecord(): SessionRecord;
858
1547
  apply(record: SessionRecord): void;
@@ -895,10 +1584,15 @@ declare class SandboxAgent {
895
1584
  private readonly token?;
896
1585
  private readonly fetcher;
897
1586
  private readonly defaultHeaders?;
1587
+ private readonly healthWait;
1588
+ private readonly healthWaitAbortController;
898
1589
  private readonly persist;
899
1590
  private readonly replayMaxEvents;
900
1591
  private readonly replayMaxChars;
901
1592
  private spawnHandle?;
1593
+ private healthPromise?;
1594
+ private healthError?;
1595
+ private disposed;
902
1596
  private readonly liveConnections;
903
1597
  private readonly pendingLiveConnections;
904
1598
  private readonly sessionHandles;
@@ -916,18 +1610,36 @@ declare class SandboxAgent {
916
1610
  resumeSession(id: string): Promise<Session>;
917
1611
  resumeOrCreateSession(request: SessionResumeOrCreateRequest): Promise<Session>;
918
1612
  destroySession(id: string): Promise<Session>;
1613
+ setSessionMode(sessionId: string, modeId: string): Promise<{
1614
+ session: Session;
1615
+ response: SetSessionModeResponse | void;
1616
+ }>;
1617
+ setSessionConfigOption(sessionId: string, configId: string, value: string): Promise<{
1618
+ session: Session;
1619
+ response: SetSessionConfigOptionResponse;
1620
+ }>;
1621
+ setSessionModel(sessionId: string, model: string): Promise<{
1622
+ session: Session;
1623
+ response: SetSessionConfigOptionResponse;
1624
+ }>;
1625
+ setSessionThoughtLevel(sessionId: string, thoughtLevel: string): Promise<{
1626
+ session: Session;
1627
+ response: SetSessionConfigOptionResponse;
1628
+ }>;
1629
+ getSessionConfigOptions(sessionId: string): Promise<SessionConfigOption[]>;
1630
+ getSessionModes(sessionId: string): Promise<SessionModeState | null>;
1631
+ private setSessionCategoryValue;
1632
+ private hydrateSessionConfigOptions;
919
1633
  sendSessionMethod(sessionId: string, method: string, params: Record<string, unknown>, options?: SessionSendOptions): Promise<{
920
1634
  session: Session;
921
1635
  response: unknown;
922
1636
  }>;
1637
+ private sendSessionMethodInternal;
1638
+ private persistSessionStateFromMethod;
923
1639
  onSessionEvent(sessionId: string, listener: SessionEventListener): () => void;
924
1640
  getHealth(): Promise<HealthResponse>;
925
- listAgents(options?: {
926
- config?: boolean;
927
- }): Promise<AgentListResponse>;
928
- getAgent(agent: string, options?: {
929
- config?: boolean;
930
- }): Promise<AgentInfo>;
1641
+ listAgents(options?: AgentQueryOptions): Promise<AgentListResponse>;
1642
+ getAgent(agent: string, options?: AgentQueryOptions): Promise<AgentInfo>;
931
1643
  installAgent(agent: string, request?: AgentInstallRequest): Promise<AgentInstallResponse>;
932
1644
  listAcpServers(): Promise<AcpServerListResponse>;
933
1645
  listFsEntries(query?: FsEntriesQuery): Promise<FsEntry[]>;
@@ -944,8 +1656,24 @@ declare class SandboxAgent {
944
1656
  getSkillsConfig(query: SkillsConfigQuery): Promise<SkillsConfig>;
945
1657
  setSkillsConfig(query: SkillsConfigQuery, config: SkillsConfig): Promise<void>;
946
1658
  deleteSkillsConfig(query: SkillsConfigQuery): Promise<void>;
1659
+ getProcessConfig(): Promise<ProcessConfig>;
1660
+ setProcessConfig(config: ProcessConfig): Promise<ProcessConfig>;
1661
+ createProcess(request: ProcessCreateRequest): Promise<ProcessInfo>;
1662
+ runProcess(request: ProcessRunRequest): Promise<ProcessRunResponse>;
1663
+ listProcesses(): Promise<ProcessListResponse>;
1664
+ getProcess(id: string): Promise<ProcessInfo>;
1665
+ stopProcess(id: string, query?: ProcessSignalQuery): Promise<ProcessInfo>;
1666
+ killProcess(id: string, query?: ProcessSignalQuery): Promise<ProcessInfo>;
1667
+ deleteProcess(id: string): Promise<void>;
1668
+ getProcessLogs(id: string, query?: ProcessLogFollowQuery): Promise<ProcessLogsResponse>;
1669
+ followProcessLogs(id: string, listener: ProcessLogListener, query?: ProcessLogFollowQuery): Promise<ProcessLogSubscription>;
1670
+ sendProcessInput(id: string, request: ProcessInputRequest): Promise<ProcessInputResponse>;
1671
+ resizeProcessTerminal(id: string, request: ProcessTerminalResizeRequest): Promise<ProcessTerminalResizeResponse>;
1672
+ buildProcessTerminalWebSocketUrl(id: string, options?: ProcessTerminalWebSocketUrlOptions): string;
1673
+ connectProcessTerminalWebSocket(id: string, options?: ProcessTerminalConnectOptions): WebSocket;
947
1674
  private getLiveConnection;
948
1675
  private persistObservedEnvelope;
1676
+ private persistSessionStateFromEvent;
949
1677
  private allocateSessionEventIndex;
950
1678
  private ensureSessionEventIndexSeeded;
951
1679
  private findMaxPersistedSessionEventIndex;
@@ -954,8 +1682,12 @@ declare class SandboxAgent {
954
1682
  private requireSessionRecord;
955
1683
  private requestJson;
956
1684
  private requestRaw;
1685
+ private startHealthWait;
1686
+ private awaitHealthy;
1687
+ private runHealthWait;
957
1688
  private buildHeaders;
958
1689
  private buildUrl;
1690
+ private requestHealth;
959
1691
  }
960
1692
 
961
1693
  interface InspectorUrlOptions {
@@ -979,4 +1711,4 @@ interface InspectorUrlOptions {
979
1711
  */
980
1712
  declare function buildInspectorUrl(options: InspectorUrlOptions): string;
981
1713
 
982
- export { type AcpEnvelope, type AcpServerInfo, type AcpServerListResponse, type AgentInfo, type AgentInstallRequest, type AgentInstallResponse, type AgentListResponse, type FsActionResponse, type FsDeleteQuery, type FsEntriesQuery, type FsEntry, type FsMoveRequest, type FsMoveResponse, type FsPathQuery, type FsStat, type FsUploadBatchQuery, type FsUploadBatchResponse, type FsWriteResponse, type HealthResponse, InMemorySessionPersistDriver, type InMemorySessionPersistDriverOptions, type InspectorUrlOptions, type ListEventsRequest, type ListPage, type ListPageRequest, LiveAcpConnection, type McpConfigQuery, type McpServerConfig, type ProblemDetails, SandboxAgent, type SandboxAgentConnectOptions, SandboxAgentError, type SandboxAgentSpawnLogMode, type SandboxAgentSpawnOptions, type SandboxAgentStartOptions, Session, type SessionCreateRequest, type SessionEvent, type SessionEventListener, type SessionPersistDriver, type SessionRecord, type SessionResumeOrCreateRequest, type SessionSendOptions, type SkillsConfig, type SkillsConfigQuery, buildInspectorUrl };
1714
+ export { type AcpEnvelope, type AcpServerInfo, type AcpServerListResponse, type AgentInfo, type AgentInstallRequest, type AgentInstallResponse, type AgentListResponse, type AgentQuery, type AgentQueryOptions, type FsActionResponse, type FsDeleteQuery, type FsEntriesQuery, type FsEntry, type FsMoveRequest, type FsMoveResponse, type FsPathQuery, type FsStat, type FsUploadBatchQuery, type FsUploadBatchResponse, type FsWriteResponse, type HealthResponse, InMemorySessionPersistDriver, type InMemorySessionPersistDriverOptions, type InspectorUrlOptions, type ListEventsRequest, type ListPage, type ListPageRequest, LiveAcpConnection, type McpConfigQuery, type McpServerConfig, type ProblemDetails, type ProcessConfig, type ProcessCreateRequest, type ProcessInfo, type ProcessInputRequest, type ProcessInputResponse, type ProcessListResponse, type ProcessLogEntry, type ProcessLogFollowQuery, type ProcessLogListener, type ProcessLogSubscription, type ProcessLogsQuery, type ProcessLogsResponse, type ProcessLogsStream, type ProcessRunRequest, type ProcessRunResponse, type ProcessSignalQuery, type ProcessState, type ProcessTerminalClientFrame, type ProcessTerminalConnectOptions, type ProcessTerminalErrorFrame, type ProcessTerminalExitFrame, type ProcessTerminalReadyFrame, type ProcessTerminalResizeRequest, type ProcessTerminalResizeResponse, type ProcessTerminalServerFrame, type ProcessTerminalWebSocketUrlOptions, SandboxAgent, type SandboxAgentConnectOptions, SandboxAgentError, type SandboxAgentHealthWaitOptions, type SandboxAgentSpawnLogMode, type SandboxAgentSpawnOptions, type SandboxAgentStartOptions, Session, type SessionCreateRequest, type SessionEvent, type SessionEventListener, type SessionPersistDriver, type SessionRecord, type SessionResumeOrCreateRequest, type SessionSendOptions, type SkillsConfig, type SkillsConfigQuery, UnsupportedSessionCategoryError, UnsupportedSessionConfigOptionError, UnsupportedSessionValueError, buildInspectorUrl };