@boxrouter/sdk 0.0.1-alpha.0 → 0.12.190

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 (338) hide show
  1. package/NOTICE +29 -5
  2. package/README.md +497 -24
  3. package/dist/addresses.d.ts +5 -0
  4. package/dist/addresses.js +10 -0
  5. package/dist/api-error.d.ts +62 -0
  6. package/dist/api-error.js +264 -0
  7. package/dist/boxrouter.d.ts +68 -0
  8. package/dist/boxrouter.js +291 -0
  9. package/dist/browser-session/index.d.ts +17 -0
  10. package/dist/browser-session/index.js +48 -0
  11. package/dist/browser-session/operations.gen.d.ts +272 -0
  12. package/dist/browser-session/operations.gen.js +58 -0
  13. package/dist/browser-session/responseContracts/api_keys.d.ts +2 -0
  14. package/dist/browser-session/responseContracts/api_keys.js +10 -0
  15. package/dist/browser-session/responseContracts/credits.d.ts +2 -0
  16. package/dist/browser-session/responseContracts/credits.js +8 -0
  17. package/dist/browser-session/responseContracts/github.d.ts +2 -0
  18. package/dist/browser-session/responseContracts/github.js +11 -0
  19. package/dist/browser-session/responseContracts/identity.d.ts +2 -0
  20. package/dist/browser-session/responseContracts/identity.js +30 -0
  21. package/dist/browser-session/responseContracts/organizations.d.ts +2 -0
  22. package/dist/browser-session/responseContracts/organizations.js +17 -0
  23. package/dist/browser-session/responseContracts/privacy.d.ts +2 -0
  24. package/dist/browser-session/responseContracts/privacy.js +7 -0
  25. package/dist/browser-session/responseContracts.gen.d.ts +3 -0
  26. package/dist/browser-session/responseContracts.gen.js +10 -0
  27. package/dist/browser-session/responseValidators/api_keys-diagnostics.cjs +1 -0
  28. package/dist/browser-session/responseValidators/api_keys-diagnostics.d.cts +4 -0
  29. package/dist/browser-session/responseValidators/api_keys.cjs +2 -0
  30. package/dist/browser-session/responseValidators/api_keys.d.cts +4 -0
  31. package/dist/browser-session/responseValidators/credits-diagnostics.cjs +1 -0
  32. package/dist/browser-session/responseValidators/credits-diagnostics.d.cts +3 -0
  33. package/dist/browser-session/responseValidators/credits.cjs +2 -0
  34. package/dist/browser-session/responseValidators/credits.d.cts +3 -0
  35. package/dist/browser-session/responseValidators/github-diagnostics.cjs +1 -0
  36. package/dist/browser-session/responseValidators/github-diagnostics.d.cts +3 -0
  37. package/dist/browser-session/responseValidators/github.cjs +2 -0
  38. package/dist/browser-session/responseValidators/github.d.cts +3 -0
  39. package/dist/browser-session/responseValidators/identity-diagnostics.cjs +1 -0
  40. package/dist/browser-session/responseValidators/identity-diagnostics.d.cts +23 -0
  41. package/dist/browser-session/responseValidators/identity.cjs +2 -0
  42. package/dist/browser-session/responseValidators/identity.d.cts +23 -0
  43. package/dist/browser-session/responseValidators/organizations-diagnostics.cjs +1 -0
  44. package/dist/browser-session/responseValidators/organizations-diagnostics.d.cts +15 -0
  45. package/dist/browser-session/responseValidators/organizations.cjs +2 -0
  46. package/dist/browser-session/responseValidators/organizations.d.cts +15 -0
  47. package/dist/browser-session/responseValidators/privacy-diagnostics.cjs +1 -0
  48. package/dist/browser-session/responseValidators/privacy-diagnostics.d.cts +2 -0
  49. package/dist/browser-session/responseValidators/privacy.cjs +2 -0
  50. package/dist/browser-session/responseValidators/privacy.d.cts +2 -0
  51. package/dist/client/client.gen.d.ts +1 -1
  52. package/dist/client/client.gen.js +46 -94
  53. package/dist/client/index.d.ts +10 -10
  54. package/dist/client/index.js +16 -5
  55. package/dist/client/types.gen.d.ts +6 -6
  56. package/dist/client/types.gen.js +2 -1
  57. package/dist/client/utils.gen.d.ts +2 -2
  58. package/dist/client/utils.gen.js +31 -20
  59. package/dist/client.gen.d.ts +2 -2
  60. package/dist/client.gen.js +5 -2
  61. package/dist/command-check.gen.d.ts +14 -0
  62. package/dist/command-check.gen.js +23 -0
  63. package/dist/command-input.gen.d.ts +6 -0
  64. package/dist/command-input.gen.js +45 -0
  65. package/dist/core/auth.gen.js +5 -1
  66. package/dist/core/binaryStream.d.ts +8 -0
  67. package/dist/core/binaryStream.js +76 -0
  68. package/dist/core/bodySerializer.gen.d.ts +1 -1
  69. package/dist/core/bodySerializer.gen.js +8 -5
  70. package/dist/core/commandValidators.cjs +1 -0
  71. package/dist/core/commandValidators.d.cts +14 -0
  72. package/dist/core/eventValidation.d.ts +17 -0
  73. package/dist/core/eventValidation.js +56 -0
  74. package/dist/core/eventValidators.cjs +1 -0
  75. package/dist/core/eventValidators.d.cts +2 -0
  76. package/dist/core/json.d.ts +3 -0
  77. package/dist/core/json.js +33 -0
  78. package/dist/core/params.gen.js +4 -1
  79. package/dist/core/pathSerializer.gen.js +20 -11
  80. package/dist/core/queryKeySerializer.gen.js +12 -6
  81. package/dist/core/responseContracts/actions.d.ts +2 -0
  82. package/dist/core/responseContracts/actions.js +30 -0
  83. package/dist/core/responseContracts/agents.d.ts +2 -0
  84. package/dist/core/responseContracts/agents.js +7 -0
  85. package/dist/core/responseContracts/artifacts.d.ts +2 -0
  86. package/dist/core/responseContracts/artifacts.js +8 -0
  87. package/dist/core/responseContracts/commands.d.ts +2 -0
  88. package/dist/core/responseContracts/commands.js +6 -0
  89. package/dist/core/responseContracts/credits.d.ts +2 -0
  90. package/dist/core/responseContracts/credits.js +27 -0
  91. package/dist/core/responseContracts/files.d.ts +2 -0
  92. package/dist/core/responseContracts/files.js +15 -0
  93. package/dist/core/responseContracts/github.d.ts +2 -0
  94. package/dist/core/responseContracts/github.js +8 -0
  95. package/dist/core/responseContracts/images.d.ts +2 -0
  96. package/dist/core/responseContracts/images.js +8 -0
  97. package/dist/core/responseContracts/launchRuns.d.ts +2 -0
  98. package/dist/core/responseContracts/launchRuns.js +10 -0
  99. package/dist/core/responseContracts/launches.d.ts +2 -0
  100. package/dist/core/responseContracts/launches.js +10 -0
  101. package/dist/core/responseContracts/operations.d.ts +2 -0
  102. package/dist/core/responseContracts/operations.js +7 -0
  103. package/dist/core/responseContracts/previews.d.ts +2 -0
  104. package/dist/core/responseContracts/previews.js +8 -0
  105. package/dist/core/responseContracts/pricing.d.ts +2 -0
  106. package/dist/core/responseContracts/pricing.js +6 -0
  107. package/dist/core/responseContracts/processes.d.ts +2 -0
  108. package/dist/core/responseContracts/processes.js +11 -0
  109. package/dist/core/responseContracts/provider_accounts.d.ts +2 -0
  110. package/dist/core/responseContracts/provider_accounts.js +13 -0
  111. package/dist/core/responseContracts/providers.d.ts +2 -0
  112. package/dist/core/responseContracts/providers.js +6 -0
  113. package/dist/core/responseContracts/routing.d.ts +2 -0
  114. package/dist/core/responseContracts/routing.js +8 -0
  115. package/dist/core/responseContracts/sandboxes.d.ts +2 -0
  116. package/dist/core/responseContracts/sandboxes.js +15 -0
  117. package/dist/core/responseContracts/secrets.d.ts +2 -0
  118. package/dist/core/responseContracts/secrets.js +8 -0
  119. package/dist/core/responseContracts/spend_limits.d.ts +2 -0
  120. package/dist/core/responseContracts/spend_limits.js +8 -0
  121. package/dist/core/responseContracts/terminals.d.ts +2 -0
  122. package/dist/core/responseContracts/terminals.js +11 -0
  123. package/dist/core/responseContracts/usage.d.ts +2 -0
  124. package/dist/core/responseContracts/usage.js +7 -0
  125. package/dist/core/responseContracts/volumes.d.ts +2 -0
  126. package/dist/core/responseContracts/volumes.js +19 -0
  127. package/dist/core/responseContracts.gen.d.ts +3 -0
  128. package/dist/core/responseContracts.gen.js +27 -0
  129. package/dist/core/responseModes.d.ts +19 -0
  130. package/dist/core/responseModes.js +13 -0
  131. package/dist/core/responseValidation.d.ts +44 -0
  132. package/dist/core/responseValidation.js +174 -0
  133. package/dist/core/responseValidators/actions-diagnostics.cjs +4 -0
  134. package/dist/core/responseValidators/actions-diagnostics.d.cts +24 -0
  135. package/dist/core/responseValidators/actions.cjs +2 -0
  136. package/dist/core/responseValidators/actions.d.cts +24 -0
  137. package/dist/core/responseValidators/agents-diagnostics.cjs +1 -0
  138. package/dist/core/responseValidators/agents-diagnostics.d.cts +2 -0
  139. package/dist/core/responseValidators/agents.cjs +2 -0
  140. package/dist/core/responseValidators/agents.d.cts +2 -0
  141. package/dist/core/responseValidators/artifacts-diagnostics.cjs +1 -0
  142. package/dist/core/responseValidators/artifacts-diagnostics.d.cts +2 -0
  143. package/dist/core/responseValidators/artifacts.cjs +2 -0
  144. package/dist/core/responseValidators/artifacts.d.cts +2 -0
  145. package/dist/core/responseValidators/commands-diagnostics.cjs +1 -0
  146. package/dist/core/responseValidators/commands-diagnostics.d.cts +1 -0
  147. package/dist/core/responseValidators/commands.cjs +2 -0
  148. package/dist/core/responseValidators/commands.d.cts +1 -0
  149. package/dist/core/responseValidators/compact.cjs +122 -0
  150. package/dist/core/responseValidators/credits-diagnostics.cjs +1 -0
  151. package/dist/core/responseValidators/credits-diagnostics.d.cts +21 -0
  152. package/dist/core/responseValidators/credits.cjs +2 -0
  153. package/dist/core/responseValidators/credits.d.cts +21 -0
  154. package/dist/core/responseValidators/files-diagnostics.cjs +1 -0
  155. package/dist/core/responseValidators/files-diagnostics.d.cts +5 -0
  156. package/dist/core/responseValidators/files.cjs +2 -0
  157. package/dist/core/responseValidators/files.d.cts +5 -0
  158. package/dist/core/responseValidators/github-diagnostics.cjs +1 -0
  159. package/dist/core/responseValidators/github-diagnostics.d.cts +2 -0
  160. package/dist/core/responseValidators/github.cjs +2 -0
  161. package/dist/core/responseValidators/github.d.cts +2 -0
  162. package/dist/core/responseValidators/images-diagnostics.cjs +1 -0
  163. package/dist/core/responseValidators/images-diagnostics.d.cts +3 -0
  164. package/dist/core/responseValidators/images.cjs +2 -0
  165. package/dist/core/responseValidators/images.d.cts +3 -0
  166. package/dist/core/responseValidators/launchRuns-diagnostics.cjs +1 -0
  167. package/dist/core/responseValidators/launchRuns-diagnostics.d.cts +5 -0
  168. package/dist/core/responseValidators/launchRuns.cjs +2 -0
  169. package/dist/core/responseValidators/launchRuns.d.cts +5 -0
  170. package/dist/core/responseValidators/launches-diagnostics.cjs +10 -0
  171. package/dist/core/responseValidators/launches-diagnostics.d.cts +5 -0
  172. package/dist/core/responseValidators/launches.cjs +2 -0
  173. package/dist/core/responseValidators/launches.d.cts +5 -0
  174. package/dist/core/responseValidators/operations-diagnostics.cjs +1 -0
  175. package/dist/core/responseValidators/operations-diagnostics.d.cts +2 -0
  176. package/dist/core/responseValidators/operations.cjs +2 -0
  177. package/dist/core/responseValidators/operations.d.cts +2 -0
  178. package/dist/core/responseValidators/previews-diagnostics.cjs +1 -0
  179. package/dist/core/responseValidators/previews-diagnostics.d.cts +3 -0
  180. package/dist/core/responseValidators/previews.cjs +2 -0
  181. package/dist/core/responseValidators/previews.d.cts +3 -0
  182. package/dist/core/responseValidators/pricing-diagnostics.cjs +7 -0
  183. package/dist/core/responseValidators/pricing-diagnostics.d.cts +1 -0
  184. package/dist/core/responseValidators/pricing.cjs +2 -0
  185. package/dist/core/responseValidators/pricing.d.cts +1 -0
  186. package/dist/core/responseValidators/processes-diagnostics.cjs +1 -0
  187. package/dist/core/responseValidators/processes-diagnostics.d.cts +2 -0
  188. package/dist/core/responseValidators/processes.cjs +2 -0
  189. package/dist/core/responseValidators/processes.d.cts +2 -0
  190. package/dist/core/responseValidators/provider_accounts-diagnostics.cjs +1 -0
  191. package/dist/core/responseValidators/provider_accounts-diagnostics.d.cts +8 -0
  192. package/dist/core/responseValidators/provider_accounts.cjs +2 -0
  193. package/dist/core/responseValidators/provider_accounts.d.cts +8 -0
  194. package/dist/core/responseValidators/providers-diagnostics.cjs +1 -0
  195. package/dist/core/responseValidators/providers-diagnostics.d.cts +1 -0
  196. package/dist/core/responseValidators/providers.cjs +2 -0
  197. package/dist/core/responseValidators/providers.d.cts +1 -0
  198. package/dist/core/responseValidators/routing-diagnostics.cjs +1 -0
  199. package/dist/core/responseValidators/routing-diagnostics.d.cts +3 -0
  200. package/dist/core/responseValidators/routing.cjs +2 -0
  201. package/dist/core/responseValidators/routing.d.cts +3 -0
  202. package/dist/core/responseValidators/sandboxes-diagnostics.cjs +1 -0
  203. package/dist/core/responseValidators/sandboxes-diagnostics.d.cts +10 -0
  204. package/dist/core/responseValidators/sandboxes.cjs +2 -0
  205. package/dist/core/responseValidators/sandboxes.d.cts +10 -0
  206. package/dist/core/responseValidators/secrets-diagnostics.cjs +1 -0
  207. package/dist/core/responseValidators/secrets-diagnostics.d.cts +1 -0
  208. package/dist/core/responseValidators/secrets.cjs +2 -0
  209. package/dist/core/responseValidators/secrets.d.cts +1 -0
  210. package/dist/core/responseValidators/spend_limits-diagnostics.cjs +1 -0
  211. package/dist/core/responseValidators/spend_limits-diagnostics.d.cts +3 -0
  212. package/dist/core/responseValidators/spend_limits.cjs +2 -0
  213. package/dist/core/responseValidators/spend_limits.d.cts +3 -0
  214. package/dist/core/responseValidators/terminals-diagnostics.cjs +1 -0
  215. package/dist/core/responseValidators/terminals-diagnostics.d.cts +2 -0
  216. package/dist/core/responseValidators/terminals.cjs +2 -0
  217. package/dist/core/responseValidators/terminals.d.cts +2 -0
  218. package/dist/core/responseValidators/usage-diagnostics.cjs +1 -0
  219. package/dist/core/responseValidators/usage-diagnostics.d.cts +1 -0
  220. package/dist/core/responseValidators/usage.cjs +2 -0
  221. package/dist/core/responseValidators/usage.d.cts +1 -0
  222. package/dist/core/responseValidators/volumes-diagnostics.cjs +1 -0
  223. package/dist/core/responseValidators/volumes-diagnostics.d.cts +10 -0
  224. package/dist/core/responseValidators/volumes.cjs +2 -0
  225. package/dist/core/responseValidators/volumes.d.cts +10 -0
  226. package/dist/core/serverSentEvents.gen.d.ts +21 -62
  227. package/dist/core/serverSentEvents.gen.js +297 -116
  228. package/dist/core/streamErrors.d.ts +32 -0
  229. package/dist/core/streamErrors.js +51 -0
  230. package/dist/core/types.gen.d.ts +2 -2
  231. package/dist/core/types.gen.js +2 -1
  232. package/dist/core/utils.gen.d.ts +1 -1
  233. package/dist/core/utils.gen.js +16 -10
  234. package/dist/creation.gen.d.ts +21 -0
  235. package/dist/creation.gen.js +35 -0
  236. package/dist/data-origin.d.ts +25 -0
  237. package/dist/data-origin.js +57 -0
  238. package/dist/error-codes.gen.d.ts +2 -0
  239. package/dist/error-codes.gen.js +2 -0
  240. package/dist/idempotency.gen.d.ts +1 -0
  241. package/dist/idempotency.gen.js +60 -0
  242. package/dist/images.d.ts +74 -0
  243. package/dist/images.js +88 -0
  244. package/dist/index.d.ts +22 -2
  245. package/dist/index.js +79 -1
  246. package/dist/launch-input.gen.d.ts +9 -0
  247. package/dist/launch-input.gen.js +83 -0
  248. package/dist/launch.d.ts +28 -0
  249. package/dist/launch.js +222 -0
  250. package/dist/namespace-actions.d.mts +307 -0
  251. package/dist/namespace-actions.mjs +595 -0
  252. package/dist/namespace-agents.d.mts +33 -0
  253. package/dist/namespace-agents.mjs +40 -0
  254. package/dist/namespace-artifacts.d.mts +46 -0
  255. package/dist/namespace-artifacts.mjs +69 -0
  256. package/dist/namespace-base.d.mts +7 -0
  257. package/dist/namespace-base.mjs +7 -0
  258. package/dist/namespace-commands.d.mts +57 -0
  259. package/dist/namespace-commands.mjs +57 -0
  260. package/dist/namespace-credits.d.mts +213 -0
  261. package/dist/namespace-credits.mjs +476 -0
  262. package/dist/namespace-files.d.mts +203 -0
  263. package/dist/namespace-files.mjs +334 -0
  264. package/dist/namespace-github.d.mts +50 -0
  265. package/dist/namespace-github.mjs +68 -0
  266. package/dist/namespace-images.d.mts +52 -0
  267. package/dist/namespace-images.mjs +78 -0
  268. package/dist/namespace-launch_runs.d.mts +89 -0
  269. package/dist/namespace-launch_runs.mjs +133 -0
  270. package/dist/namespace-launches.d.mts +89 -0
  271. package/dist/namespace-launches.mjs +133 -0
  272. package/dist/namespace-operations.d.mts +45 -0
  273. package/dist/namespace-operations.mjs +52 -0
  274. package/dist/namespace-previews.d.mts +79 -0
  275. package/dist/namespace-previews.mjs +101 -0
  276. package/dist/namespace-pricing.d.mts +31 -0
  277. package/dist/namespace-pricing.mjs +22 -0
  278. package/dist/namespace-processes.d.mts +125 -0
  279. package/dist/namespace-processes.mjs +184 -0
  280. package/dist/namespace-provider_accounts.d.mts +156 -0
  281. package/dist/namespace-provider_accounts.mjs +241 -0
  282. package/dist/namespace-providers.d.mts +28 -0
  283. package/dist/namespace-providers.mjs +24 -0
  284. package/dist/namespace-routing.d.mts +64 -0
  285. package/dist/namespace-routing.mjs +86 -0
  286. package/dist/namespace-sandboxes.d.mts +287 -0
  287. package/dist/namespace-sandboxes.mjs +402 -0
  288. package/dist/namespace-secrets.d.mts +46 -0
  289. package/dist/namespace-secrets.mjs +68 -0
  290. package/dist/namespace-spend_limits.d.mts +48 -0
  291. package/dist/namespace-spend_limits.mjs +70 -0
  292. package/dist/namespace-terminals.d.mts +112 -0
  293. package/dist/namespace-terminals.mjs +177 -0
  294. package/dist/namespace-usage.d.mts +46 -0
  295. package/dist/namespace-usage.mjs +53 -0
  296. package/dist/namespace-volumes.d.mts +110 -0
  297. package/dist/namespace-volumes.mjs +269 -0
  298. package/dist/operations.d.ts +14 -0
  299. package/dist/operations.js +31 -0
  300. package/dist/retry.d.ts +8 -0
  301. package/dist/retry.js +63 -0
  302. package/dist/routing-choices.gen.d.ts +132 -0
  303. package/dist/routing-choices.gen.js +136 -0
  304. package/dist/routing.d.ts +23 -0
  305. package/dist/routing.js +38 -0
  306. package/dist/sandbox-handle.gen.d.ts +8 -0
  307. package/dist/sandbox-handle.gen.js +14 -0
  308. package/dist/sandboxes.d.ts +213 -0
  309. package/dist/sandboxes.js +507 -0
  310. package/dist/sdk.gen.d.ts +2016 -12
  311. package/dist/sdk.gen.js +3862 -16
  312. package/dist/server-timing.d.ts +19 -0
  313. package/dist/server-timing.gen.d.ts +265 -0
  314. package/dist/server-timing.gen.js +254 -0
  315. package/dist/server-timing.js +421 -0
  316. package/dist/spend-limits.d.ts +17 -0
  317. package/dist/spend-limits.js +26 -0
  318. package/dist/telemetry.d.ts +51 -0
  319. package/dist/telemetry.gen.d.ts +1 -0
  320. package/dist/telemetry.gen.js +5 -0
  321. package/dist/telemetry.js +438 -0
  322. package/dist/terminal.d.ts +61 -0
  323. package/dist/terminal.js +266 -0
  324. package/dist/transfer.d.ts +75 -0
  325. package/dist/transfer.js +389 -0
  326. package/dist/types.gen.d.ts +14936 -110
  327. package/dist/types.gen.js +2 -1
  328. package/dist/user-agent.d.ts +2 -0
  329. package/dist/user-agent.js +18 -0
  330. package/dist/version.gen.d.ts +1 -0
  331. package/dist/version.gen.js +5 -0
  332. package/dist/volumes.d.ts +33 -0
  333. package/dist/volumes.js +221 -0
  334. package/dist/waits.d.ts +31 -0
  335. package/dist/waits.js +42 -0
  336. package/dist/workflow-policy.gen.d.ts +41 -0
  337. package/dist/workflow-policy.gen.js +45 -0
  338. package/package.json +124 -14
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RoutingResources = void 0;
4
+ /** Workspace Routing settings and read-only availability preview. */
5
+ class RoutingResources {
6
+ api;
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ async settings(options = {}) {
11
+ return this.api.routing.settings({ signal: options.signal });
12
+ }
13
+ /** Change only the routing fields you give; omitted fields keep their stored values. */
14
+ async update(fields, options = {}) {
15
+ if (Object.keys(fields).length === 0)
16
+ throw new TypeError('Pass at least one routing field to change');
17
+ return this.api.routing.updateSettings({
18
+ body: { section: 'routing', routing: fields },
19
+ headers: options.ifMatch === undefined ? undefined : { 'If-Match': options.ifMatch },
20
+ signal: options.signal,
21
+ });
22
+ }
23
+ /** Change only the funding fields you give for one provider. */
24
+ async updateFunding(provider, funding, options = {}) {
25
+ if (Object.keys(funding).length === 0)
26
+ throw new TypeError('Pass funding_order or credits to change');
27
+ return this.api.routing.updateSettings({
28
+ body: { section: 'provider_funding', provider, funding },
29
+ headers: options.ifMatch === undefined ? undefined : { 'If-Match': options.ifMatch },
30
+ signal: options.signal,
31
+ });
32
+ }
33
+ /** Read current routing availability; this is not a route prediction. */
34
+ async preview(options = {}) {
35
+ return this.api.routing.preview({ signal: options.signal });
36
+ }
37
+ }
38
+ exports.RoutingResources = RoutingResources;
@@ -0,0 +1,8 @@
1
+ import type { Sandbox } from './types.gen';
2
+ /** The sandbox's fields as of the last response, shown as read-only handle properties. */
3
+ export interface SandboxFields extends Readonly<Pick<Sandbox, "id" | "state" | "state_reason" | "failure" | "native_state" | "observed_at" | "state_recorded_at" | "created_at" | "expires_at" | "ready_at" | "ended_at" | "created_at_source" | "created_at_how" | "created_at_step" | "ready_at_source" | "ready_at_how" | "ready_at_step" | "ended_at_source" | "ended_at_how" | "ended_at_step" | "cost_source" | "cost_how" | "cost_step" | "origin" | "labels" | "name" | "resources" | "image" | "image_setup" | "usage" | "cost" | "charge" | "funded_until" | "connectable" | "lifetime" | "route" | "contract" | "request" | "hidden_secrets" | "tcp_ports" | "recorder" | "limits" | "volume" | "operation_id" | "account">> {
4
+ }
5
+ /** Define each field as a getter on the handle's prototype, read from the handle's current sandbox. */
6
+ export declare function defineSandboxFields<Handle extends object>(handle: {
7
+ prototype: Handle;
8
+ }, read: (handle: Handle) => Sandbox): void;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineSandboxFields = defineSandboxFields;
4
+ const SANDBOX_FIELDS = ["id", "state", "state_reason", "failure", "native_state", "observed_at", "state_recorded_at", "created_at", "expires_at", "ready_at", "ended_at", "created_at_source", "created_at_how", "created_at_step", "ready_at_source", "ready_at_how", "ready_at_step", "ended_at_source", "ended_at_how", "ended_at_step", "cost_source", "cost_how", "cost_step", "origin", "labels", "name", "resources", "image", "image_setup", "usage", "cost", "charge", "funded_until", "connectable", "lifetime", "route", "contract", "request", "hidden_secrets", "tcp_ports", "recorder", "limits", "volume", "operation_id", "account"];
5
+ /** Define each field as a getter on the handle's prototype, read from the handle's current sandbox. */
6
+ function defineSandboxFields(handle, read) {
7
+ for (const name of SANDBOX_FIELDS) {
8
+ Object.defineProperty(handle.prototype, name, {
9
+ get() { return read(this)[name]; },
10
+ enumerable: true,
11
+ configurable: true,
12
+ });
13
+ }
14
+ }
@@ -0,0 +1,213 @@
1
+ import type { BoxRouterApi } from './sdk.gen';
2
+ import type { AgentPage, ByteCommandResult, DirectoryEntry, Launch, Lifetime, MatchResult, OpenPreview, Paused, Preview, Resumed, RunCommand, CommandResult, ProcessOutput, Sandbox, SandboxPage, SandboxesListData, StartProcess, VolumeCheckpoint } from './types.gen';
3
+ import { type Terminal, type TerminalOptions } from './terminal';
4
+ import { type LaunchOptions } from './launch';
5
+ import { type TransferProgress } from './transfer';
6
+ import { type SandboxConfig, type SandboxVolumeSaveArguments } from './creation.gen';
7
+ import { type SandboxFields } from './sandbox-handle.gen';
8
+ export type { SandboxConfig } from './creation.gen';
9
+ export interface RequestOptions {
10
+ signal?: AbortSignal;
11
+ }
12
+ export interface MutationOptions extends RequestOptions {
13
+ idempotencyKey?: string;
14
+ }
15
+ export declare function mutationOptions({ signal, idempotencyKey }: MutationOptions): {
16
+ signal: AbortSignal | undefined;
17
+ headers: {
18
+ 'Idempotency-Key': string;
19
+ } | undefined;
20
+ };
21
+ /** What a text command may carry: today's fields, and `output` left out or `'text'`. */
22
+ export type TextCommandConfig = Omit<RunCommand, 'command' | 'output'> & CommandCheck & {
23
+ output?: 'text';
24
+ };
25
+ /** What a command asking for bytes carries. */
26
+ export type ByteCommandConfig = Omit<RunCommand, 'command' | 'output'> & CommandCheck & {
27
+ output: 'bytes';
28
+ };
29
+ /** Client-side: raise the contract's result-check error when the command fails or times out. */
30
+ export interface CommandCheck {
31
+ check?: boolean;
32
+ }
33
+ /** A byte-mode command result after decoding the JSON transport's base64 streams. */
34
+ export interface CommandBytesResult extends Omit<ByteCommandResult, 'stdout_base64' | 'stderr_base64'> {
35
+ stdout: Uint8Array;
36
+ stderr: Uint8Array;
37
+ }
38
+ export declare function decodeBase64(value: string): Uint8Array;
39
+ /** Provider-neutral sandbox operations. */
40
+ export declare class SandboxResources {
41
+ private readonly api;
42
+ constructor(api: BoxRouterApi);
43
+ agents(options?: RequestOptions): Promise<AgentPage>;
44
+ create(config?: SandboxConfig, options?: MutationOptions): Promise<SandboxHandle>;
45
+ /** Explain which routes creation would use for the same config, without creating anything. */
46
+ match(config?: SandboxConfig, options?: RequestOptions): Promise<MatchResult>;
47
+ /** Read a sandbox's live state from Cloud and return its handle. */
48
+ get(id: string, options?: RequestOptions): Promise<SandboxHandle>;
49
+ /** One page of the caller's sandboxes; the query filters and pages as the list operation defines. */
50
+ list(query?: NonNullable<SandboxesListData['query']>, options?: RequestOptions): Promise<SandboxPage>;
51
+ /** Open a PTY shell by sandbox ID, or attach with terminalId; the shell keeps running afterwards. */
52
+ openTerminal(id: string, options?: TerminalOptions): Promise<Terminal>;
53
+ /**
54
+ * Launch a catalog agent, image, source manifest, plain checkout or manifest. Waits until the launch is
55
+ * ready and returns the sandbox, the same handle `create` returns; `destroy()` ends it. `openTerminal`
56
+ * on the handle opens a shell that starts the launch's command. Rejects with a TimeoutError when the
57
+ * launch is still pending after its bound.
58
+ */
59
+ launch(options?: LaunchOptions): Promise<SandboxHandle>;
60
+ launch(agent: string, options?: LaunchOptions): Promise<SandboxHandle>;
61
+ }
62
+ export interface SandboxHandle extends SandboxFields {
63
+ }
64
+ /**
65
+ * A bound sandbox. Its properties are the Sandbox fields (`state`, `lifetime`, `route`, ...) as
66
+ * of the last response: `get` returns a handle, `refresh` reads again, and `destroy`, `pause`,
67
+ * `resume` and `extend` update it. Every handle has every method: a sandbox created without the
68
+ * requirement a method needs answers with an `APIError` whose code is `not_named`.
69
+ */
70
+ export declare class SandboxHandle {
71
+ #private;
72
+ /** The launch result when `sandboxes.launch` returned this handle (with `interactive` resolved), otherwise undefined. */
73
+ readonly launch: Launch | undefined;
74
+ readonly files: SandboxFiles;
75
+ readonly processes: SandboxProcesses;
76
+ readonly previews: SandboxPreviews;
77
+ private readonly api;
78
+ constructor(api: BoxRouterApi, sandbox: Sandbox, launched?: {
79
+ launch: Launch;
80
+ terminalCommand: string | undefined;
81
+ });
82
+ [Symbol.asyncDispose](): Promise<void>;
83
+ /** Read the sandbox again from Cloud and update this handle's properties. */
84
+ refresh(options?: RequestOptions): Promise<this>;
85
+ /**
86
+ * Open a PTY shell in this sandbox, or attach with terminalId. After `sandboxes.launch`, a new shell starts
87
+ * the launch's command (written first, with a 3600 s timeout unless you give one).
88
+ */
89
+ openTerminal(options?: TerminalOptions): Promise<Terminal>;
90
+ /** Run a command; byte mode returns exact stdout and stderr Uint8Arrays. */
91
+ exec(command: string, config?: TextCommandConfig, options?: MutationOptions): Promise<CommandResult>;
92
+ exec(command: string, config: ByteCommandConfig, options?: MutationOptions): Promise<CommandBytesResult>;
93
+ /** `output` chosen at run time: the result is whichever form it named. */
94
+ exec(command: string, config: Omit<RunCommand, 'command'> & CommandCheck, options?: MutationOptions): Promise<CommandResult | CommandBytesResult>;
95
+ saveVolume(...[options]: SandboxVolumeSaveArguments): Promise<VolumeCheckpoint>;
96
+ /**
97
+ * Request destruction and update this handle from the sandbox Cloud returns: `destroyed`, or
98
+ * `destroying` with an `operation_id` while Cloud finishes the destroy without the caller.
99
+ */
100
+ destroy(options?: MutationOptions & {
101
+ discardUnsaved?: boolean;
102
+ }): Promise<Sandbox>;
103
+ /** Pause the sandbox; the handle's `state` and `lifetime` follow the response. */
104
+ pause(options?: MutationOptions): Promise<Paused>;
105
+ /** Resume the sandbox; undefined means it was already running (204), and nothing changes. */
106
+ resume(options?: MutationOptions): Promise<Resumed | undefined>;
107
+ /** Set the sandbox's new total running-time budget in seconds (not an increment). */
108
+ extend(body: {
109
+ lifetime_seconds: number;
110
+ }, options?: MutationOptions): Promise<Lifetime>;
111
+ }
112
+ /** Previews of one sandbox. */
113
+ export declare class SandboxPreviews {
114
+ private readonly api;
115
+ private readonly id;
116
+ constructor(api: BoxRouterApi, id: string);
117
+ /** Open a preview of `port`, which the sandbox's previews requirement must name. */
118
+ open(port: number, config?: Omit<OpenPreview, 'port'>, options?: MutationOptions): Promise<Preview>;
119
+ }
120
+ /** Options of `ProcessHandle.wait()`. */
121
+ export interface ProcessWaitOptions extends RequestOptions {
122
+ /** Byte offsets to start from. */
123
+ stdout?: number | bigint;
124
+ stderr?: number | bigint;
125
+ /** Reject with a TimeoutError after this many seconds; the command keeps running. */
126
+ timeoutSeconds?: number;
127
+ }
128
+ /** Background commands bound to one sandbox. */
129
+ export declare class SandboxProcesses {
130
+ private readonly api;
131
+ private readonly id;
132
+ constructor(api: BoxRouterApi, id: string);
133
+ start(command: string, config?: Omit<StartProcess, 'command'>, options?: MutationOptions): Promise<ProcessHandle>;
134
+ /** A handle for a started process. */
135
+ fromId(processId: string): ProcessHandle;
136
+ }
137
+ /** A started command, addressed by its durable ID. Nothing here cancels it implicitly. */
138
+ export declare class ProcessHandle {
139
+ #private;
140
+ private readonly api;
141
+ constructor(api: BoxRouterApi, sandboxId: string, processId: string);
142
+ get id(): string;
143
+ /**
144
+ * Output from the given byte offsets; continue from next_stdout and next_stderr.
145
+ * exit_code is set once the process ended and both streams were read to their ends.
146
+ */
147
+ read(options?: RequestOptions & {
148
+ stdout?: number | bigint;
149
+ stderr?: number | bigint;
150
+ }): Promise<ProcessOutput>;
151
+ /**
152
+ * Polls read() until the process exits and returns the result `exec` returns for the same
153
+ * `output`: text (invalid bytes replaced) by default, or the exact bytes with `output: 'bytes'`.
154
+ * Rejects with a TimeoutError once timeoutSeconds have passed, never later: every read and
155
+ * pause is bounded by the time left. The command keeps running.
156
+ */
157
+ wait(options?: ProcessWaitOptions & {
158
+ output?: 'text';
159
+ }): Promise<CommandResult>;
160
+ wait(options: ProcessWaitOptions & {
161
+ output: 'bytes';
162
+ }): Promise<CommandBytesResult>;
163
+ wait(options: ProcessWaitOptions & {
164
+ output?: 'text' | 'bytes';
165
+ }): Promise<CommandResult | CommandBytesResult>;
166
+ /** Appends text to stdin; the process must have started with stdin: true. */
167
+ writeStdin(data: string, options?: MutationOptions): Promise<void>;
168
+ closeStdin(options?: RequestOptions): Promise<void>;
169
+ /** Requests termination; wait() or read() confirms the exit. */
170
+ cancel(options?: MutationOptions): Promise<void>;
171
+ /** Deletes the retained output of a finished process. */
172
+ remove(options?: MutationOptions): Promise<void>;
173
+ }
174
+ export interface SandboxUploadOptions extends MutationOptions {
175
+ /** Required for a stream; checked against any other source. */
176
+ size?: number;
177
+ concurrency?: number;
178
+ progress?: TransferProgress;
179
+ }
180
+ export interface SandboxDownloadOptions extends RequestOptions {
181
+ progress?: TransferProgress;
182
+ }
183
+ export declare class SandboxFiles {
184
+ private readonly api;
185
+ private readonly id;
186
+ private readonly inlineTransferMaxBytes?;
187
+ constructor(api: BoxRouterApi, id: string, inlineTransferMaxBytes?: number | undefined);
188
+ /** The route's advertised inline size, capped at the inline read's own bound. */
189
+ private inlineBelow;
190
+ list(path: string, options?: RequestOptions): Promise<DirectoryEntry[]>;
191
+ exists(path: string, options?: RequestOptions): Promise<boolean>;
192
+ mkdir(path: string, options?: MutationOptions & {
193
+ parents?: boolean;
194
+ }): Promise<void>;
195
+ remove(path: string, options?: MutationOptions & {
196
+ recursive?: boolean;
197
+ }): Promise<void>;
198
+ read(path: string, options?: RequestOptions): Promise<Uint8Array>;
199
+ write(path: string, content: string | Uint8Array | Blob, options?: MutationOptions): Promise<void>;
200
+ /**
201
+ * Upload a local file path, Blob, bytes or stream to `remotePath`. A stream needs `size`. The request
202
+ * carries the exact length, so a stream is first spooled to a temporary file (never into memory).
203
+ * `progress` is called as each part finishes. An upload that fails before completion is sent is aborted;
204
+ * one that fails after is left as it is, its outcome unknown. Bytes already written may remain.
205
+ */
206
+ upload(source: string | Blob | Uint8Array | ReadableStream<Uint8Array>, remotePath: string, options?: SandboxUploadOptions): Promise<void>;
207
+ /**
208
+ * Download `remotePath` to `localPath` (written through a temporary file and renamed once the full
209
+ * length has arrived), or with no `localPath` return the bytes as a stream that errors if it ends short.
210
+ */
211
+ download(remotePath: string, localPath?: undefined, options?: SandboxDownloadOptions): Promise<ReadableStream<Uint8Array>>;
212
+ download(remotePath: string, localPath: string, options?: SandboxDownloadOptions): Promise<void>;
213
+ }