@boxrouter/sdk 0.0.0-stage → 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 (343) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +40 -0
  3. package/README.md +508 -2
  4. package/dist/addresses.d.ts +5 -0
  5. package/dist/addresses.js +10 -0
  6. package/dist/api-error.d.ts +62 -0
  7. package/dist/api-error.js +264 -0
  8. package/dist/boxrouter.d.ts +68 -0
  9. package/dist/boxrouter.js +291 -0
  10. package/dist/browser-session/index.d.ts +17 -0
  11. package/dist/browser-session/index.js +48 -0
  12. package/dist/browser-session/operations.gen.d.ts +272 -0
  13. package/dist/browser-session/operations.gen.js +58 -0
  14. package/dist/browser-session/responseContracts/api_keys.d.ts +2 -0
  15. package/dist/browser-session/responseContracts/api_keys.js +10 -0
  16. package/dist/browser-session/responseContracts/credits.d.ts +2 -0
  17. package/dist/browser-session/responseContracts/credits.js +8 -0
  18. package/dist/browser-session/responseContracts/github.d.ts +2 -0
  19. package/dist/browser-session/responseContracts/github.js +11 -0
  20. package/dist/browser-session/responseContracts/identity.d.ts +2 -0
  21. package/dist/browser-session/responseContracts/identity.js +30 -0
  22. package/dist/browser-session/responseContracts/organizations.d.ts +2 -0
  23. package/dist/browser-session/responseContracts/organizations.js +17 -0
  24. package/dist/browser-session/responseContracts/privacy.d.ts +2 -0
  25. package/dist/browser-session/responseContracts/privacy.js +7 -0
  26. package/dist/browser-session/responseContracts.gen.d.ts +3 -0
  27. package/dist/browser-session/responseContracts.gen.js +10 -0
  28. package/dist/browser-session/responseValidators/api_keys-diagnostics.cjs +1 -0
  29. package/dist/browser-session/responseValidators/api_keys-diagnostics.d.cts +4 -0
  30. package/dist/browser-session/responseValidators/api_keys.cjs +2 -0
  31. package/dist/browser-session/responseValidators/api_keys.d.cts +4 -0
  32. package/dist/browser-session/responseValidators/credits-diagnostics.cjs +1 -0
  33. package/dist/browser-session/responseValidators/credits-diagnostics.d.cts +3 -0
  34. package/dist/browser-session/responseValidators/credits.cjs +2 -0
  35. package/dist/browser-session/responseValidators/credits.d.cts +3 -0
  36. package/dist/browser-session/responseValidators/github-diagnostics.cjs +1 -0
  37. package/dist/browser-session/responseValidators/github-diagnostics.d.cts +3 -0
  38. package/dist/browser-session/responseValidators/github.cjs +2 -0
  39. package/dist/browser-session/responseValidators/github.d.cts +3 -0
  40. package/dist/browser-session/responseValidators/identity-diagnostics.cjs +1 -0
  41. package/dist/browser-session/responseValidators/identity-diagnostics.d.cts +23 -0
  42. package/dist/browser-session/responseValidators/identity.cjs +2 -0
  43. package/dist/browser-session/responseValidators/identity.d.cts +23 -0
  44. package/dist/browser-session/responseValidators/organizations-diagnostics.cjs +1 -0
  45. package/dist/browser-session/responseValidators/organizations-diagnostics.d.cts +15 -0
  46. package/dist/browser-session/responseValidators/organizations.cjs +2 -0
  47. package/dist/browser-session/responseValidators/organizations.d.cts +15 -0
  48. package/dist/browser-session/responseValidators/privacy-diagnostics.cjs +1 -0
  49. package/dist/browser-session/responseValidators/privacy-diagnostics.d.cts +2 -0
  50. package/dist/browser-session/responseValidators/privacy.cjs +2 -0
  51. package/dist/browser-session/responseValidators/privacy.d.cts +2 -0
  52. package/dist/client/client.gen.d.ts +2 -0
  53. package/dist/client/client.gen.js +168 -0
  54. package/dist/client/index.d.ts +10 -0
  55. package/dist/client/index.js +17 -0
  56. package/dist/client/types.gen.d.ts +120 -0
  57. package/dist/client/types.gen.js +3 -0
  58. package/dist/client/utils.gen.d.ts +37 -0
  59. package/dist/client/utils.gen.js +239 -0
  60. package/dist/client.gen.d.ts +12 -0
  61. package/dist/client.gen.js +6 -0
  62. package/dist/command-check.gen.d.ts +14 -0
  63. package/dist/command-check.gen.js +23 -0
  64. package/dist/command-input.gen.d.ts +6 -0
  65. package/dist/command-input.gen.js +45 -0
  66. package/dist/core/auth.gen.d.ts +25 -0
  67. package/dist/core/auth.gen.js +18 -0
  68. package/dist/core/binaryStream.d.ts +8 -0
  69. package/dist/core/binaryStream.js +76 -0
  70. package/dist/core/bodySerializer.gen.d.ts +25 -0
  71. package/dist/core/bodySerializer.gen.js +60 -0
  72. package/dist/core/commandValidators.cjs +1 -0
  73. package/dist/core/commandValidators.d.cts +14 -0
  74. package/dist/core/eventValidation.d.ts +17 -0
  75. package/dist/core/eventValidation.js +56 -0
  76. package/dist/core/eventValidators.cjs +1 -0
  77. package/dist/core/eventValidators.d.cts +2 -0
  78. package/dist/core/json.d.ts +3 -0
  79. package/dist/core/json.js +33 -0
  80. package/dist/core/params.gen.d.ts +43 -0
  81. package/dist/core/params.gen.js +112 -0
  82. package/dist/core/pathSerializer.gen.d.ts +33 -0
  83. package/dist/core/pathSerializer.gen.js +115 -0
  84. package/dist/core/queryKeySerializer.gen.d.ts +18 -0
  85. package/dist/core/queryKeySerializer.gen.js +98 -0
  86. package/dist/core/responseContracts/actions.d.ts +2 -0
  87. package/dist/core/responseContracts/actions.js +30 -0
  88. package/dist/core/responseContracts/agents.d.ts +2 -0
  89. package/dist/core/responseContracts/agents.js +7 -0
  90. package/dist/core/responseContracts/artifacts.d.ts +2 -0
  91. package/dist/core/responseContracts/artifacts.js +8 -0
  92. package/dist/core/responseContracts/commands.d.ts +2 -0
  93. package/dist/core/responseContracts/commands.js +6 -0
  94. package/dist/core/responseContracts/credits.d.ts +2 -0
  95. package/dist/core/responseContracts/credits.js +27 -0
  96. package/dist/core/responseContracts/files.d.ts +2 -0
  97. package/dist/core/responseContracts/files.js +15 -0
  98. package/dist/core/responseContracts/github.d.ts +2 -0
  99. package/dist/core/responseContracts/github.js +8 -0
  100. package/dist/core/responseContracts/images.d.ts +2 -0
  101. package/dist/core/responseContracts/images.js +8 -0
  102. package/dist/core/responseContracts/launchRuns.d.ts +2 -0
  103. package/dist/core/responseContracts/launchRuns.js +10 -0
  104. package/dist/core/responseContracts/launches.d.ts +2 -0
  105. package/dist/core/responseContracts/launches.js +10 -0
  106. package/dist/core/responseContracts/operations.d.ts +2 -0
  107. package/dist/core/responseContracts/operations.js +7 -0
  108. package/dist/core/responseContracts/previews.d.ts +2 -0
  109. package/dist/core/responseContracts/previews.js +8 -0
  110. package/dist/core/responseContracts/pricing.d.ts +2 -0
  111. package/dist/core/responseContracts/pricing.js +6 -0
  112. package/dist/core/responseContracts/processes.d.ts +2 -0
  113. package/dist/core/responseContracts/processes.js +11 -0
  114. package/dist/core/responseContracts/provider_accounts.d.ts +2 -0
  115. package/dist/core/responseContracts/provider_accounts.js +13 -0
  116. package/dist/core/responseContracts/providers.d.ts +2 -0
  117. package/dist/core/responseContracts/providers.js +6 -0
  118. package/dist/core/responseContracts/routing.d.ts +2 -0
  119. package/dist/core/responseContracts/routing.js +8 -0
  120. package/dist/core/responseContracts/sandboxes.d.ts +2 -0
  121. package/dist/core/responseContracts/sandboxes.js +15 -0
  122. package/dist/core/responseContracts/secrets.d.ts +2 -0
  123. package/dist/core/responseContracts/secrets.js +8 -0
  124. package/dist/core/responseContracts/spend_limits.d.ts +2 -0
  125. package/dist/core/responseContracts/spend_limits.js +8 -0
  126. package/dist/core/responseContracts/terminals.d.ts +2 -0
  127. package/dist/core/responseContracts/terminals.js +11 -0
  128. package/dist/core/responseContracts/usage.d.ts +2 -0
  129. package/dist/core/responseContracts/usage.js +7 -0
  130. package/dist/core/responseContracts/volumes.d.ts +2 -0
  131. package/dist/core/responseContracts/volumes.js +19 -0
  132. package/dist/core/responseContracts.gen.d.ts +3 -0
  133. package/dist/core/responseContracts.gen.js +27 -0
  134. package/dist/core/responseModes.d.ts +19 -0
  135. package/dist/core/responseModes.js +13 -0
  136. package/dist/core/responseValidation.d.ts +44 -0
  137. package/dist/core/responseValidation.js +174 -0
  138. package/dist/core/responseValidators/actions-diagnostics.cjs +4 -0
  139. package/dist/core/responseValidators/actions-diagnostics.d.cts +24 -0
  140. package/dist/core/responseValidators/actions.cjs +2 -0
  141. package/dist/core/responseValidators/actions.d.cts +24 -0
  142. package/dist/core/responseValidators/agents-diagnostics.cjs +1 -0
  143. package/dist/core/responseValidators/agents-diagnostics.d.cts +2 -0
  144. package/dist/core/responseValidators/agents.cjs +2 -0
  145. package/dist/core/responseValidators/agents.d.cts +2 -0
  146. package/dist/core/responseValidators/artifacts-diagnostics.cjs +1 -0
  147. package/dist/core/responseValidators/artifacts-diagnostics.d.cts +2 -0
  148. package/dist/core/responseValidators/artifacts.cjs +2 -0
  149. package/dist/core/responseValidators/artifacts.d.cts +2 -0
  150. package/dist/core/responseValidators/commands-diagnostics.cjs +1 -0
  151. package/dist/core/responseValidators/commands-diagnostics.d.cts +1 -0
  152. package/dist/core/responseValidators/commands.cjs +2 -0
  153. package/dist/core/responseValidators/commands.d.cts +1 -0
  154. package/dist/core/responseValidators/compact.cjs +122 -0
  155. package/dist/core/responseValidators/credits-diagnostics.cjs +1 -0
  156. package/dist/core/responseValidators/credits-diagnostics.d.cts +21 -0
  157. package/dist/core/responseValidators/credits.cjs +2 -0
  158. package/dist/core/responseValidators/credits.d.cts +21 -0
  159. package/dist/core/responseValidators/files-diagnostics.cjs +1 -0
  160. package/dist/core/responseValidators/files-diagnostics.d.cts +5 -0
  161. package/dist/core/responseValidators/files.cjs +2 -0
  162. package/dist/core/responseValidators/files.d.cts +5 -0
  163. package/dist/core/responseValidators/github-diagnostics.cjs +1 -0
  164. package/dist/core/responseValidators/github-diagnostics.d.cts +2 -0
  165. package/dist/core/responseValidators/github.cjs +2 -0
  166. package/dist/core/responseValidators/github.d.cts +2 -0
  167. package/dist/core/responseValidators/images-diagnostics.cjs +1 -0
  168. package/dist/core/responseValidators/images-diagnostics.d.cts +3 -0
  169. package/dist/core/responseValidators/images.cjs +2 -0
  170. package/dist/core/responseValidators/images.d.cts +3 -0
  171. package/dist/core/responseValidators/launchRuns-diagnostics.cjs +1 -0
  172. package/dist/core/responseValidators/launchRuns-diagnostics.d.cts +5 -0
  173. package/dist/core/responseValidators/launchRuns.cjs +2 -0
  174. package/dist/core/responseValidators/launchRuns.d.cts +5 -0
  175. package/dist/core/responseValidators/launches-diagnostics.cjs +10 -0
  176. package/dist/core/responseValidators/launches-diagnostics.d.cts +5 -0
  177. package/dist/core/responseValidators/launches.cjs +2 -0
  178. package/dist/core/responseValidators/launches.d.cts +5 -0
  179. package/dist/core/responseValidators/operations-diagnostics.cjs +1 -0
  180. package/dist/core/responseValidators/operations-diagnostics.d.cts +2 -0
  181. package/dist/core/responseValidators/operations.cjs +2 -0
  182. package/dist/core/responseValidators/operations.d.cts +2 -0
  183. package/dist/core/responseValidators/previews-diagnostics.cjs +1 -0
  184. package/dist/core/responseValidators/previews-diagnostics.d.cts +3 -0
  185. package/dist/core/responseValidators/previews.cjs +2 -0
  186. package/dist/core/responseValidators/previews.d.cts +3 -0
  187. package/dist/core/responseValidators/pricing-diagnostics.cjs +7 -0
  188. package/dist/core/responseValidators/pricing-diagnostics.d.cts +1 -0
  189. package/dist/core/responseValidators/pricing.cjs +2 -0
  190. package/dist/core/responseValidators/pricing.d.cts +1 -0
  191. package/dist/core/responseValidators/processes-diagnostics.cjs +1 -0
  192. package/dist/core/responseValidators/processes-diagnostics.d.cts +2 -0
  193. package/dist/core/responseValidators/processes.cjs +2 -0
  194. package/dist/core/responseValidators/processes.d.cts +2 -0
  195. package/dist/core/responseValidators/provider_accounts-diagnostics.cjs +1 -0
  196. package/dist/core/responseValidators/provider_accounts-diagnostics.d.cts +8 -0
  197. package/dist/core/responseValidators/provider_accounts.cjs +2 -0
  198. package/dist/core/responseValidators/provider_accounts.d.cts +8 -0
  199. package/dist/core/responseValidators/providers-diagnostics.cjs +1 -0
  200. package/dist/core/responseValidators/providers-diagnostics.d.cts +1 -0
  201. package/dist/core/responseValidators/providers.cjs +2 -0
  202. package/dist/core/responseValidators/providers.d.cts +1 -0
  203. package/dist/core/responseValidators/routing-diagnostics.cjs +1 -0
  204. package/dist/core/responseValidators/routing-diagnostics.d.cts +3 -0
  205. package/dist/core/responseValidators/routing.cjs +2 -0
  206. package/dist/core/responseValidators/routing.d.cts +3 -0
  207. package/dist/core/responseValidators/sandboxes-diagnostics.cjs +1 -0
  208. package/dist/core/responseValidators/sandboxes-diagnostics.d.cts +10 -0
  209. package/dist/core/responseValidators/sandboxes.cjs +2 -0
  210. package/dist/core/responseValidators/sandboxes.d.cts +10 -0
  211. package/dist/core/responseValidators/secrets-diagnostics.cjs +1 -0
  212. package/dist/core/responseValidators/secrets-diagnostics.d.cts +1 -0
  213. package/dist/core/responseValidators/secrets.cjs +2 -0
  214. package/dist/core/responseValidators/secrets.d.cts +1 -0
  215. package/dist/core/responseValidators/spend_limits-diagnostics.cjs +1 -0
  216. package/dist/core/responseValidators/spend_limits-diagnostics.d.cts +3 -0
  217. package/dist/core/responseValidators/spend_limits.cjs +2 -0
  218. package/dist/core/responseValidators/spend_limits.d.cts +3 -0
  219. package/dist/core/responseValidators/terminals-diagnostics.cjs +1 -0
  220. package/dist/core/responseValidators/terminals-diagnostics.d.cts +2 -0
  221. package/dist/core/responseValidators/terminals.cjs +2 -0
  222. package/dist/core/responseValidators/terminals.d.cts +2 -0
  223. package/dist/core/responseValidators/usage-diagnostics.cjs +1 -0
  224. package/dist/core/responseValidators/usage-diagnostics.d.cts +1 -0
  225. package/dist/core/responseValidators/usage.cjs +2 -0
  226. package/dist/core/responseValidators/usage.d.cts +1 -0
  227. package/dist/core/responseValidators/volumes-diagnostics.cjs +1 -0
  228. package/dist/core/responseValidators/volumes-diagnostics.d.cts +10 -0
  229. package/dist/core/responseValidators/volumes.cjs +2 -0
  230. package/dist/core/responseValidators/volumes.d.cts +10 -0
  231. package/dist/core/serverSentEvents.gen.d.ts +30 -0
  232. package/dist/core/serverSentEvents.gen.js +313 -0
  233. package/dist/core/streamErrors.d.ts +32 -0
  234. package/dist/core/streamErrors.js +51 -0
  235. package/dist/core/types.gen.d.ts +83 -0
  236. package/dist/core/types.gen.js +3 -0
  237. package/dist/core/utils.gen.d.ts +19 -0
  238. package/dist/core/utils.gen.js +93 -0
  239. package/dist/creation.gen.d.ts +21 -0
  240. package/dist/creation.gen.js +35 -0
  241. package/dist/data-origin.d.ts +25 -0
  242. package/dist/data-origin.js +57 -0
  243. package/dist/error-codes.gen.d.ts +2 -0
  244. package/dist/error-codes.gen.js +2 -0
  245. package/dist/idempotency.gen.d.ts +1 -0
  246. package/dist/idempotency.gen.js +60 -0
  247. package/dist/images.d.ts +74 -0
  248. package/dist/images.js +88 -0
  249. package/dist/index.d.ts +22 -0
  250. package/dist/index.js +80 -0
  251. package/dist/launch-input.gen.d.ts +9 -0
  252. package/dist/launch-input.gen.js +83 -0
  253. package/dist/launch.d.ts +28 -0
  254. package/dist/launch.js +222 -0
  255. package/dist/namespace-actions.d.mts +307 -0
  256. package/dist/namespace-actions.mjs +595 -0
  257. package/dist/namespace-agents.d.mts +33 -0
  258. package/dist/namespace-agents.mjs +40 -0
  259. package/dist/namespace-artifacts.d.mts +46 -0
  260. package/dist/namespace-artifacts.mjs +69 -0
  261. package/dist/namespace-base.d.mts +7 -0
  262. package/dist/namespace-base.mjs +7 -0
  263. package/dist/namespace-commands.d.mts +57 -0
  264. package/dist/namespace-commands.mjs +57 -0
  265. package/dist/namespace-credits.d.mts +213 -0
  266. package/dist/namespace-credits.mjs +476 -0
  267. package/dist/namespace-files.d.mts +203 -0
  268. package/dist/namespace-files.mjs +334 -0
  269. package/dist/namespace-github.d.mts +50 -0
  270. package/dist/namespace-github.mjs +68 -0
  271. package/dist/namespace-images.d.mts +52 -0
  272. package/dist/namespace-images.mjs +78 -0
  273. package/dist/namespace-launch_runs.d.mts +89 -0
  274. package/dist/namespace-launch_runs.mjs +133 -0
  275. package/dist/namespace-launches.d.mts +89 -0
  276. package/dist/namespace-launches.mjs +133 -0
  277. package/dist/namespace-operations.d.mts +45 -0
  278. package/dist/namespace-operations.mjs +52 -0
  279. package/dist/namespace-previews.d.mts +79 -0
  280. package/dist/namespace-previews.mjs +101 -0
  281. package/dist/namespace-pricing.d.mts +31 -0
  282. package/dist/namespace-pricing.mjs +22 -0
  283. package/dist/namespace-processes.d.mts +125 -0
  284. package/dist/namespace-processes.mjs +184 -0
  285. package/dist/namespace-provider_accounts.d.mts +156 -0
  286. package/dist/namespace-provider_accounts.mjs +241 -0
  287. package/dist/namespace-providers.d.mts +28 -0
  288. package/dist/namespace-providers.mjs +24 -0
  289. package/dist/namespace-routing.d.mts +64 -0
  290. package/dist/namespace-routing.mjs +86 -0
  291. package/dist/namespace-sandboxes.d.mts +287 -0
  292. package/dist/namespace-sandboxes.mjs +402 -0
  293. package/dist/namespace-secrets.d.mts +46 -0
  294. package/dist/namespace-secrets.mjs +68 -0
  295. package/dist/namespace-spend_limits.d.mts +48 -0
  296. package/dist/namespace-spend_limits.mjs +70 -0
  297. package/dist/namespace-terminals.d.mts +112 -0
  298. package/dist/namespace-terminals.mjs +177 -0
  299. package/dist/namespace-usage.d.mts +46 -0
  300. package/dist/namespace-usage.mjs +53 -0
  301. package/dist/namespace-volumes.d.mts +110 -0
  302. package/dist/namespace-volumes.mjs +269 -0
  303. package/dist/operations.d.ts +14 -0
  304. package/dist/operations.js +31 -0
  305. package/dist/retry.d.ts +8 -0
  306. package/dist/retry.js +63 -0
  307. package/dist/routing-choices.gen.d.ts +132 -0
  308. package/dist/routing-choices.gen.js +136 -0
  309. package/dist/routing.d.ts +23 -0
  310. package/dist/routing.js +38 -0
  311. package/dist/sandbox-handle.gen.d.ts +8 -0
  312. package/dist/sandbox-handle.gen.js +14 -0
  313. package/dist/sandboxes.d.ts +213 -0
  314. package/dist/sandboxes.js +507 -0
  315. package/dist/sdk.gen.d.ts +2029 -0
  316. package/dist/sdk.gen.js +3862 -0
  317. package/dist/server-timing.d.ts +19 -0
  318. package/dist/server-timing.gen.d.ts +265 -0
  319. package/dist/server-timing.gen.js +254 -0
  320. package/dist/server-timing.js +421 -0
  321. package/dist/spend-limits.d.ts +17 -0
  322. package/dist/spend-limits.js +26 -0
  323. package/dist/telemetry.d.ts +51 -0
  324. package/dist/telemetry.gen.d.ts +1 -0
  325. package/dist/telemetry.gen.js +5 -0
  326. package/dist/telemetry.js +438 -0
  327. package/dist/terminal.d.ts +61 -0
  328. package/dist/terminal.js +266 -0
  329. package/dist/transfer.d.ts +75 -0
  330. package/dist/transfer.js +389 -0
  331. package/dist/types.gen.d.ts +15016 -0
  332. package/dist/types.gen.js +3 -0
  333. package/dist/user-agent.d.ts +2 -0
  334. package/dist/user-agent.js +18 -0
  335. package/dist/version.gen.d.ts +1 -0
  336. package/dist/version.gen.js +5 -0
  337. package/dist/volumes.d.ts +33 -0
  338. package/dist/volumes.js +221 -0
  339. package/dist/waits.d.ts +31 -0
  340. package/dist/waits.js +42 -0
  341. package/dist/workflow-policy.gen.d.ts +41 -0
  342. package/dist/workflow-policy.gen.js +45 -0
  343. package/package.json +135 -4
@@ -0,0 +1,3862 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BoxRouterApi = exports.Providers = exports.Pricing = exports.Files = exports.Commands = exports.Volumes = exports.ProviderAccounts = exports.Sandboxes = exports.Previews = exports.Secrets = exports.Terminals = exports.Usage = exports.SpendLimits = exports.Credits = exports.Processes = exports.Images = exports.Artifacts = exports.Operations = exports.Routing = exports.Actions = exports.Placements = exports.Jobs = exports.PoolIdleTime = exports.Runs = exports.Policies = exports.Repositories = exports.Github = exports.LaunchRuns = exports.Launches = exports.Agents = void 0;
4
+ const eventValidation_1 = require("./core/eventValidation");
5
+ const client_gen_1 = require("./client.gen");
6
+ class HeyApiClient {
7
+ client;
8
+ constructor(args) {
9
+ this.client = args?.client ?? client_gen_1.client;
10
+ }
11
+ }
12
+ class HeyApiRegistry {
13
+ defaultKey = 'default';
14
+ instances = new Map();
15
+ get(key) {
16
+ const instance = this.instances.get(key ?? this.defaultKey);
17
+ if (!instance) {
18
+ throw new Error(`No SDK client found. Create one with "new BoxRouterApi()" to fix this error.`);
19
+ }
20
+ return instance;
21
+ }
22
+ set(value, key) {
23
+ this.instances.set(key ?? this.defaultKey, value);
24
+ }
25
+ }
26
+ class Agents extends HeyApiClient {
27
+ /**
28
+ * List launch agents
29
+ *
30
+ * List the launch manifests available to this workspace. The response includes
31
+ * names, descriptions, declared secret names and preview ports. It never includes
32
+ * commands, file contents or secret values.
33
+ *
34
+ */
35
+ list(options) {
36
+ return (options?.client ?? this.client).get({
37
+ responseStyle: 'data',
38
+ security: [{ scheme: 'bearer', type: 'http' }, {
39
+ in: 'cookie',
40
+ name: '__Host-boxrouter_session',
41
+ type: 'apiKey'
42
+ }],
43
+ url: '/agents',
44
+ ...options
45
+ });
46
+ }
47
+ /**
48
+ * Get a launch agent manifest
49
+ *
50
+ * Returns a workspace-available manifest. Unknown names return agent_not_found.
51
+ */
52
+ get(options) {
53
+ return (options.client ?? this.client).get({
54
+ responseStyle: 'data',
55
+ security: [{ scheme: 'bearer', type: 'http' }, {
56
+ in: 'cookie',
57
+ name: '__Host-boxrouter_session',
58
+ type: 'apiKey'
59
+ }],
60
+ url: '/agents/{name}',
61
+ ...options
62
+ });
63
+ }
64
+ }
65
+ exports.Agents = Agents;
66
+ class Launches extends HeyApiClient {
67
+ /**
68
+ * Create an agent launch
69
+ *
70
+ * Create one workspace-owned sandbox and prepare it from a catalog agent or inline
71
+ * manifest. `overrides.lifetime_seconds` requests a lifetime in seconds in place of
72
+ * the manifest value. The required Idempotency-Key identifies one logical launch; retry an
73
+ * uncertain request with the same key and body. BoxRouter validates the manifest,
74
+ * the secrets, the routes and the funding first and answers 400, 402 or 409 with outcome
75
+ * `not_started` for a launch it cannot start; it returns 202 only after the launch
76
+ * operation is durably accepted. Poll the operation URL from Location for
77
+ * queued/running status and phase progress. A matching key returns the same operation,
78
+ * including the original result. New requests and matching retries both return HTTP 202.
79
+ * A key used with different input returns 409 and does not start another launch.
80
+ * Setup, file, background and preview preparation failures destroy the newly created
81
+ * sandbox before the operation becomes failed.
82
+ *
83
+ * Secret values supplied in secret_values are used only for this request and are
84
+ * never stored or returned. Names declared by the manifest can instead resolve from
85
+ * the workspace secret store. The successful operation contains the sandbox ID,
86
+ * phase results, preview URLs and enforced expiry in result.
87
+ *
88
+ */
89
+ create(options) {
90
+ return (options.client ?? this.client).post({
91
+ responseStyle: 'data',
92
+ security: [{ scheme: 'bearer', type: 'http' }, {
93
+ in: 'cookie',
94
+ name: '__Host-boxrouter_session',
95
+ type: 'apiKey'
96
+ }],
97
+ url: '/launches',
98
+ ...options,
99
+ headers: {
100
+ 'Content-Type': 'application/json',
101
+ ...options.headers
102
+ }
103
+ });
104
+ }
105
+ /**
106
+ * Get launch status and phase progress
107
+ *
108
+ * Returns the durable status of one launch operation owned by the caller's workspace.
109
+ * Poll while status is queued or running, respecting Retry-After when present. A
110
+ * succeeded operation includes result; a failed operation includes the original
111
+ * structured API error and its HTTP status. Secret values are never included.
112
+ *
113
+ */
114
+ getOperation(options) {
115
+ return (options.client ?? this.client).get({
116
+ responseStyle: 'data',
117
+ security: [{ scheme: 'bearer', type: 'http' }, {
118
+ in: 'cookie',
119
+ name: '__Host-boxrouter_session',
120
+ type: 'apiKey'
121
+ }],
122
+ url: '/launches/{operation_id}',
123
+ ...options
124
+ });
125
+ }
126
+ /**
127
+ * Get what a launch asked for
128
+ *
129
+ * Returns the choices one launch was created with: the catalog agent or the caller's own
130
+ * source, whether BoxRouter picked the provider or the caller chose one, and the names of
131
+ * the secrets it used. Every client that creates a launch (the dashboard, the CLI, the
132
+ * SDKs) is recorded the same way, so any of them can show or repeat it. Secret values are
133
+ * never recorded or returned. A launch created before settings were recorded is 404.
134
+ *
135
+ */
136
+ getSettings(options) {
137
+ return (options.client ?? this.client).get({
138
+ responseStyle: 'data',
139
+ security: [{ scheme: 'bearer', type: 'http' }, {
140
+ in: 'cookie',
141
+ name: '__Host-boxrouter_session',
142
+ type: 'apiKey'
143
+ }],
144
+ url: '/launches/{operation_id}/settings',
145
+ ...options
146
+ });
147
+ }
148
+ /**
149
+ * Get unattended command state
150
+ *
151
+ * Returns the observed state of the unattended command attached to a launch owned by the
152
+ * caller's workspace. Observation waits up to five seconds. While the command is running,
153
+ * call this endpoint again to observe its state. `unknown` means the outcome could not be
154
+ * confirmed; it is never inferred from a missing sandbox or an observation failure.
155
+ * A launch with no recorded unattended command returns 404. This response never contains
156
+ * command text, environment variables, process identity, stdout, stderr or other output.
157
+ * `timed_out` with exit code 124 means the armed command timer was observed to expire; an
158
+ * ordinary command exit with code 124 remains `exited`.
159
+ *
160
+ */
161
+ getCommand(options) {
162
+ return (options.client ?? this.client).get({
163
+ responseStyle: 'data',
164
+ security: [{ scheme: 'bearer', type: 'http' }, {
165
+ in: 'cookie',
166
+ name: '__Host-boxrouter_session',
167
+ type: 'apiKey'
168
+ }],
169
+ url: '/launches/{operation_id}/command',
170
+ ...options
171
+ });
172
+ }
173
+ /**
174
+ * Check whether this workspace can read a repository
175
+ *
176
+ * Answers, without launching anything, whether the caller's workspace can read the
177
+ * repository: public repositories directly, private ones through the workspace's linked
178
+ * GitHub App installation. A repository that cannot be read is a 200 with readable false
179
+ * and the refusal's code, message and fix. When readable, the answer also names the commit
180
+ * the default branch (or the requested ref) points at, the repository's top-level entries
181
+ * (directories end in a slash) and the recipe a launch would use. Results are cached per
182
+ * commit and never stored in a response cache.
183
+ *
184
+ */
185
+ checkRepositoryAccess(options) {
186
+ return (options.client ?? this.client).get({
187
+ responseStyle: 'data',
188
+ security: [{ scheme: 'bearer', type: 'http' }, {
189
+ in: 'cookie',
190
+ name: '__Host-boxrouter_session',
191
+ type: 'apiKey'
192
+ }],
193
+ url: '/repositories/{owner}/{repo}/access',
194
+ ...options
195
+ });
196
+ }
197
+ }
198
+ exports.Launches = Launches;
199
+ class LaunchRuns extends HeyApiClient {
200
+ /**
201
+ * List launch runs
202
+ *
203
+ * List the authenticated workspace's launch runs, newest first, as lightweight summaries.
204
+ * Rows contain no copy items, specs, command data or outputs; read getLaunchRun for one
205
+ * run's copies. `total_copies` and `live_copies` cover every run in the workspace, not
206
+ * only the returned page. A live copy is one whose sandbox has not been confirmed absent,
207
+ * including copies that are stopping. The read uses stored metadata only and makes no
208
+ * provider calls. Responses are private to the workspace and must not be cached.
209
+ *
210
+ * If launch-run copies are not available to you, the read still answers 200, with `available`
211
+ * false, no runs and zero totals.
212
+ *
213
+ * `next_cursor` is an opaque, workspace-scoped value for the next page and is null on the
214
+ * last page. A cursor from another workspace or a malformed cursor is invalid_request.
215
+ *
216
+ */
217
+ list(options) {
218
+ return (options?.client ?? this.client).get({
219
+ responseStyle: 'data',
220
+ security: [{ scheme: 'bearer', type: 'http' }, {
221
+ in: 'cookie',
222
+ name: '__Host-boxrouter_session',
223
+ type: 'apiKey'
224
+ }],
225
+ url: '/launch-runs',
226
+ ...options
227
+ });
228
+ }
229
+ /**
230
+ * Start an unattended launch run
231
+ *
232
+ * Reserve one workspace-owned run and all requested copies atomically. The existing
233
+ * launch request fields select exactly one catalog agent or inline manifest; `copies`
234
+ * is required. Acceptance returns 202 with a Location for metadata polling and makes
235
+ * no provider create before the executor claims each copy. Reuse the same
236
+ * Idempotency-Key and identical body to recover an uncertain acceptance; a changed
237
+ * body conflicts and never creates another run.
238
+ *
239
+ * Credential selectors are resolved at each copy claim. Secret values and provider
240
+ * tokens are never stored. Saved secrets are re-read by name, so rotation can affect
241
+ * later copies. Inline secret_values, interactive launches, and unsupported manifest
242
+ * features are refused before reservation. The feature remains opt-in until compatible
243
+ * clients are released.
244
+ *
245
+ */
246
+ create(options) {
247
+ return (options.client ?? this.client).post({
248
+ responseStyle: 'data',
249
+ security: [{ scheme: 'bearer', type: 'http' }, {
250
+ in: 'cookie',
251
+ name: '__Host-boxrouter_session',
252
+ type: 'apiKey'
253
+ }],
254
+ url: '/launch-runs',
255
+ ...options,
256
+ headers: {
257
+ 'Content-Type': 'application/json',
258
+ ...options.headers
259
+ }
260
+ });
261
+ }
262
+ /**
263
+ * Read launch run metadata
264
+ *
265
+ * Read the stored run row and copy rows only. This response excludes command data and
266
+ * output fields and makes no provider calls. `include=command` opts into bounded state
267
+ * and exit-code observations for active copies; the server uses at most eight
268
+ * observations at once and one five-second response deadline. Unknown, hung, saturated,
269
+ * or failed observations return `unknown`. Neither variant exposes command text,
270
+ * outputs, process handles, or credentials. Foreign and missing IDs have the same 404
271
+ * response.
272
+ *
273
+ */
274
+ get(options) {
275
+ return (options.client ?? this.client).get({
276
+ responseStyle: 'data',
277
+ security: [{ scheme: 'bearer', type: 'http' }, {
278
+ in: 'cookie',
279
+ name: '__Host-boxrouter_session',
280
+ type: 'apiKey'
281
+ }],
282
+ url: '/launch-runs/{run_id}',
283
+ ...options
284
+ });
285
+ }
286
+ /**
287
+ * Stop a launch run
288
+ *
289
+ * Set the workspace-owned run's desired state to stopped and request copy cancellation. The request is idempotent; repeating stop returns the original stop timestamp. This does not imply that the provider sandbox was destroyed. Foreign and missing IDs have the same 404 response.
290
+ */
291
+ stop(options) {
292
+ return (options.client ?? this.client).post({
293
+ responseStyle: 'data',
294
+ security: [{ scheme: 'bearer', type: 'http' }, {
295
+ in: 'cookie',
296
+ name: '__Host-boxrouter_session',
297
+ type: 'apiKey'
298
+ }],
299
+ url: '/launch-runs/{run_id}/stop',
300
+ ...options
301
+ });
302
+ }
303
+ /**
304
+ * Destroy one launch-run copy
305
+ *
306
+ * Durably request cleanup of one copy of a workspace-owned run; the run and its other
307
+ * copies keep running. Acceptance records the request only: no provider call is made
308
+ * during the request, and `stopping` does not mean the sandbox is gone. The copy's
309
+ * status in getLaunchRun becomes `stopped` only after its absence is confirmed; a queued
310
+ * copy that was never dispatched has no sandbox and stops at once.
311
+ *
312
+ * The request is idempotent. Retrying it, or destroying a copy that is already stopping
313
+ * or stopped, returns the same 202 and leaves the copy's state and timestamps unchanged.
314
+ * Foreign and missing run IDs and copy indexes have the same 404 response. Responses are
315
+ * private and must not be cached.
316
+ *
317
+ */
318
+ destroyCopy(options) {
319
+ return (options.client ?? this.client).post({
320
+ responseStyle: 'data',
321
+ security: [{ scheme: 'bearer', type: 'http' }, {
322
+ in: 'cookie',
323
+ name: '__Host-boxrouter_session',
324
+ type: 'apiKey'
325
+ }],
326
+ url: '/launch-runs/{run_id}/copies/{copy_index}/destroy',
327
+ ...options
328
+ });
329
+ }
330
+ }
331
+ exports.LaunchRuns = LaunchRuns;
332
+ class Github extends HeyApiClient {
333
+ /**
334
+ * List GitHub App installations linked to this workspace
335
+ *
336
+ * Requires read authority in the authenticated workspace. Results include only
337
+ * installations linked to that workspace; an installation ID supplied by a caller
338
+ * is not authority. Empty workspaces return an empty page. This is a read and never
339
+ * installs, uninstalls or relinks the App.
340
+ *
341
+ */
342
+ listInstallations(options) {
343
+ return (options?.client ?? this.client).get({
344
+ responseStyle: 'data',
345
+ security: [{ scheme: 'bearer', type: 'http' }, {
346
+ in: 'cookie',
347
+ name: '__Host-boxrouter_session',
348
+ type: 'apiKey'
349
+ }],
350
+ url: '/github/installations',
351
+ ...options
352
+ });
353
+ }
354
+ /**
355
+ * Unlink a GitHub App installation from this workspace
356
+ *
357
+ * Requires workspace administrator authority. Browser-session calls require the CSRF
358
+ * token and configured Origin. An Idempotency-Key identifies this one unlink request;
359
+ * an identical replay returns its recorded result, a changed request under that key
360
+ * conflicts, and an unknown GitHub or storage outcome is reconciled without replay.
361
+ * Unlinking prevents new Actions work and does not uninstall the shared App from
362
+ * GitHub or cancel already accepted workflow runs.
363
+ *
364
+ */
365
+ unlinkInstallation(options) {
366
+ return (options.client ?? this.client).delete({
367
+ responseStyle: 'data',
368
+ security: [{ scheme: 'bearer', type: 'http' }, {
369
+ in: 'cookie',
370
+ name: '__Host-boxrouter_session',
371
+ type: 'apiKey'
372
+ }],
373
+ url: '/github/installations/{installation_id}',
374
+ ...options
375
+ });
376
+ }
377
+ /**
378
+ * List repositories visible through a linked installation
379
+ *
380
+ * Requires read authority in the authenticated workspace. The installation must be
381
+ * linked to that workspace and its current GitHub permissions are revalidated; names
382
+ * are descriptive while stable repository IDs bind settings and work. Results contain
383
+ * no installation access credentials. Empty installations return an empty page.
384
+ *
385
+ */
386
+ listRepositories(options) {
387
+ return (options.client ?? this.client).get({
388
+ responseStyle: 'data',
389
+ security: [{ scheme: 'bearer', type: 'http' }, {
390
+ in: 'cookie',
391
+ name: '__Host-boxrouter_session',
392
+ type: 'apiKey'
393
+ }],
394
+ url: '/github/repositories',
395
+ ...options
396
+ });
397
+ }
398
+ }
399
+ exports.Github = Github;
400
+ class Repositories extends HeyApiClient {
401
+ /**
402
+ * Get Actions enablement and defaults for a repository
403
+ *
404
+ * Requires read authority in the authenticated workspace. The repository must have
405
+ * a currently linked, verified GitHub installation. The returned ETag identifies
406
+ * this settings revision. A missing settings record is represented as `exists: false`,
407
+ * disabled with no required policy; it is not silently enabled by reading it. For
408
+ * `exists: false`, omit If-Match on the first write; for `exists: true`, send the
409
+ * returned ETag to update the existing record safely.
410
+ *
411
+ */
412
+ get(options) {
413
+ return (options.client ?? this.client).get({
414
+ responseStyle: 'data',
415
+ security: [{ scheme: 'bearer', type: 'http' }, {
416
+ in: 'cookie',
417
+ name: '__Host-boxrouter_session',
418
+ type: 'apiKey'
419
+ }],
420
+ url: '/actions/repositories/{repository_id}',
421
+ ...options
422
+ });
423
+ }
424
+ /**
425
+ * Enable or update Actions defaults for a repository
426
+ *
427
+ * Requires workspace administrator authority. Browser-session calls require the CSRF
428
+ * token and configured Origin. The minimal enable request is `{"enabled":true}`;
429
+ * Actions creates its safe default settings and begins automatic image preparation
430
+ * without requiring a named policy, provider key, runner registration or YAML change.
431
+ * `policy_id` is optional and, when null, selects the workspace's current safe
432
+ * defaults. When the preceding read returned `exists: false`, omit If-Match to create
433
+ * the settings record; when it returned `exists: true`, send its ETag to update. The
434
+ * server rejects a write if that existence state changed after the read. An
435
+ * Idempotency-Key records
436
+ * the logical mutation: identical uncertain retries return the recorded outcome,
437
+ * changed input under the same key conflicts, and unknown effects are reconciled
438
+ * without automatic redispatch. Disabling stops new admission; it does not cancel
439
+ * accepted GitHub workflow runs or change their funding binding.
440
+ *
441
+ */
442
+ update(options) {
443
+ return (options.client ?? this.client).put({
444
+ responseStyle: 'data',
445
+ security: [{ scheme: 'bearer', type: 'http' }, {
446
+ in: 'cookie',
447
+ name: '__Host-boxrouter_session',
448
+ type: 'apiKey'
449
+ }],
450
+ url: '/actions/repositories/{repository_id}',
451
+ ...options,
452
+ headers: {
453
+ 'Content-Type': 'application/json',
454
+ ...options.headers
455
+ }
456
+ });
457
+ }
458
+ }
459
+ exports.Repositories = Repositories;
460
+ class Policies extends HeyApiClient {
461
+ /**
462
+ * List workspace Actions policies
463
+ *
464
+ * Requires workspace read authority. Stable ID-ordered pages may be empty; listing never changes policy or starts compute.
465
+ */
466
+ list(options) {
467
+ return (options?.client ?? this.client).get({
468
+ responseStyle: 'data',
469
+ security: [{ scheme: 'bearer', type: 'http' }, {
470
+ in: 'cookie',
471
+ name: '__Host-boxrouter_session',
472
+ type: 'apiKey'
473
+ }],
474
+ url: '/actions/policies',
475
+ ...options
476
+ });
477
+ }
478
+ /**
479
+ * Create a named workspace Actions policy
480
+ *
481
+ * Requires workspace administrator authority. Browser-session calls require the CSRF
482
+ * token and configured Origin. Policy settings can only narrow workspace and
483
+ * repository guardrails. The workspace funding choice decides the logical authority
484
+ * (workspace BYOK or platform managed); the actual provider, account and payer binding
485
+ * is confirmed separately for each attempt and is never taken from a policy. A policy
486
+ * cannot change supply or add accounts. Idempotency-Key replays the recorded
487
+ * outcome for identical input; changed input conflicts. An unknown outcome is
488
+ * reconciled without creating a second policy.
489
+ *
490
+ */
491
+ create(options) {
492
+ return (options.client ?? this.client).post({
493
+ responseStyle: 'data',
494
+ security: [{ scheme: 'bearer', type: 'http' }, {
495
+ in: 'cookie',
496
+ name: '__Host-boxrouter_session',
497
+ type: 'apiKey'
498
+ }],
499
+ url: '/actions/policies',
500
+ ...options,
501
+ headers: {
502
+ 'Content-Type': 'application/json',
503
+ ...options.headers
504
+ }
505
+ });
506
+ }
507
+ /**
508
+ * Delete an unused workspace Actions policy
509
+ *
510
+ * Requires workspace administrator authority. Browser-session calls require CSRF and
511
+ * the configured Origin. If-Match is required. A policy referenced by repository
512
+ * defaults or accepted work cannot be deleted and returns 409. Idempotency-Key
513
+ * returns the recorded delete result for identical retries; changed input conflicts. Unknown outcomes are
514
+ * reconciled without repeating the deletion.
515
+ *
516
+ */
517
+ delete(options) {
518
+ return (options.client ?? this.client).delete({
519
+ responseStyle: 'data',
520
+ security: [{ scheme: 'bearer', type: 'http' }, {
521
+ in: 'cookie',
522
+ name: '__Host-boxrouter_session',
523
+ type: 'apiKey'
524
+ }],
525
+ url: '/actions/policies/{policy_id}',
526
+ ...options
527
+ });
528
+ }
529
+ /**
530
+ * Get a workspace Actions policy
531
+ *
532
+ * Requires workspace read authority. The policy ID is workspace-scoped; foreign and unknown IDs both return 404.
533
+ */
534
+ get(options) {
535
+ return (options.client ?? this.client).get({
536
+ responseStyle: 'data',
537
+ security: [{ scheme: 'bearer', type: 'http' }, {
538
+ in: 'cookie',
539
+ name: '__Host-boxrouter_session',
540
+ type: 'apiKey'
541
+ }],
542
+ url: '/actions/policies/{policy_id}',
543
+ ...options
544
+ });
545
+ }
546
+ /**
547
+ * Replace a workspace Actions policy
548
+ *
549
+ * Requires workspace administrator authority. Browser-session calls require CSRF and
550
+ * the configured Origin. If-Match is required and must equal the latest ETag. Policy
551
+ * changes only narrow workspace/repository guardrails and do not mutate accepted jobs
552
+ * or change their supply, accounts or logical funding authority. Idempotency-Key replays an identical recorded update;
553
+ * changed input conflicts. A stale ETag returns 409 without writing. Unknown outcomes
554
+ * are reconciled, never automatically redispatched.
555
+ *
556
+ */
557
+ update(options) {
558
+ return (options.client ?? this.client).put({
559
+ responseStyle: 'data',
560
+ security: [{ scheme: 'bearer', type: 'http' }, {
561
+ in: 'cookie',
562
+ name: '__Host-boxrouter_session',
563
+ type: 'apiKey'
564
+ }],
565
+ url: '/actions/policies/{policy_id}',
566
+ ...options,
567
+ headers: {
568
+ 'Content-Type': 'application/json',
569
+ ...options.headers
570
+ }
571
+ });
572
+ }
573
+ }
574
+ exports.Policies = Policies;
575
+ class Runs extends HeyApiClient {
576
+ /**
577
+ * List workspace Actions workflow-run projections
578
+ *
579
+ * Requires workspace read authority. Pages may be empty and default to newest-first
580
+ * by creation time; `sort` also supports oldest-first by creation time and longest
581
+ * first by duration. Equal sort values retain a stable run ID order, including
582
+ * across pages. A run's status and cost are BoxRouter's latest recorded evidence;
583
+ * this read does not poll GitHub, change a run, start a job or retry an uncertain
584
+ * effect.
585
+ *
586
+ */
587
+ list(options) {
588
+ return (options?.client ?? this.client).get({
589
+ responseStyle: 'data',
590
+ security: [{ scheme: 'bearer', type: 'http' }, {
591
+ in: 'cookie',
592
+ name: '__Host-boxrouter_session',
593
+ type: 'apiKey'
594
+ }],
595
+ url: '/actions/runs',
596
+ ...options
597
+ });
598
+ }
599
+ /**
600
+ * Count the values each run filter offers
601
+ *
602
+ * For each filter of `listActionsRuns`, its values with the number of runs in the whole
603
+ * workspace that have the value, ignoring any active filters. A run counts once for each
604
+ * value it has. Requires workspace read authority; it does not poll GitHub.
605
+ *
606
+ */
607
+ listFacets(options) {
608
+ return (options?.client ?? this.client).get({
609
+ responseStyle: 'data',
610
+ security: [{ scheme: 'bearer', type: 'http' }, {
611
+ in: 'cookie',
612
+ name: '__Host-boxrouter_session',
613
+ type: 'apiKey'
614
+ }],
615
+ url: '/actions/runs/facets',
616
+ ...options
617
+ });
618
+ }
619
+ /**
620
+ * Get a workflow-run projection and aggregate billing evidence
621
+ *
622
+ * Requires workspace read authority. Foreign and unknown run IDs both return 404; state and costs are not inferred from missing observations.
623
+ */
624
+ get(options) {
625
+ return (options.client ?? this.client).get({
626
+ responseStyle: 'data',
627
+ security: [{ scheme: 'bearer', type: 'http' }, {
628
+ in: 'cookie',
629
+ name: '__Host-boxrouter_session',
630
+ type: 'apiKey'
631
+ }],
632
+ url: '/actions/runs/{run_id}',
633
+ ...options
634
+ });
635
+ }
636
+ /**
637
+ * List GitHub jobs projected for a workflow run
638
+ *
639
+ * Requires workspace read authority. Job assignment is tied to the runner GitHub actually assigns, not the job a JIT label initially requested.
640
+ */
641
+ listJobs(options) {
642
+ return (options.client ?? this.client).get({
643
+ responseStyle: 'data',
644
+ security: [{ scheme: 'bearer', type: 'http' }, {
645
+ in: 'cookie',
646
+ name: '__Host-boxrouter_session',
647
+ type: 'apiKey'
648
+ }],
649
+ url: '/actions/runs/{run_id}/jobs',
650
+ ...options
651
+ });
652
+ }
653
+ /**
654
+ * List placements attempted for a workflow run
655
+ *
656
+ * Requires workspace read authority. Placement state, outcome, cleanup and billing evidence remain separate; uncertain effects are never replayed by this read.
657
+ */
658
+ listPlacements(options) {
659
+ return (options.client ?? this.client).get({
660
+ responseStyle: 'data',
661
+ security: [{ scheme: 'bearer', type: 'http' }, {
662
+ in: 'cookie',
663
+ name: '__Host-boxrouter_session',
664
+ type: 'apiKey'
665
+ }],
666
+ url: '/actions/runs/{run_id}/placements',
667
+ ...options
668
+ });
669
+ }
670
+ /**
671
+ * Ask GitHub to cancel the entire workflow run
672
+ *
673
+ * Requires workspace execute authority. This explicitly cancels the whole GitHub
674
+ * workflow run, including its other jobs; it cannot cancel only one job. GitHub
675
+ * remains authoritative for cancellation. A 202 means GitHub acknowledged the
676
+ * request, not that every job or sandbox has ended. Idempotency-Key identifies this
677
+ * user-authorized mutation. An identical replay returns the recorded result; changed
678
+ * input conflicts. Unknown outcomes are reconciled against GitHub without repeating
679
+ * the cancellation automatically. BoxRouter never cancels as a side effect of a
680
+ * read, timeout or cleanup failure.
681
+ *
682
+ */
683
+ cancel(options) {
684
+ return (options.client ?? this.client).post({
685
+ responseStyle: 'data',
686
+ security: [{ scheme: 'bearer', type: 'http' }, {
687
+ in: 'cookie',
688
+ name: '__Host-boxrouter_session',
689
+ type: 'apiKey'
690
+ }],
691
+ url: '/actions/runs/{run_id}/cancel',
692
+ ...options
693
+ });
694
+ }
695
+ /**
696
+ * Ask GitHub to rerun the entire workflow
697
+ *
698
+ * Requires workspace execute authority. This explicitly asks GitHub to rerun the
699
+ * entire workflow run, not one job or only failed jobs. GitHub creates and owns the
700
+ * new attempt. A 202 means GitHub acknowledged the request; it does not mean the new
701
+ * jobs have started. Idempotency-Key identifies this user-authorized mutation. An
702
+ * identical replay returns the recorded result; changed input conflicts. An unknown
703
+ * outcome is reconciled against GitHub and never automatically submitted again.
704
+ * Actions admission still rechecks repository binding, policy, trust and the
705
+ * immutable workspace/account/payer before creating any new placement.
706
+ *
707
+ */
708
+ rerun(options) {
709
+ return (options.client ?? this.client).post({
710
+ responseStyle: 'data',
711
+ security: [{ scheme: 'bearer', type: 'http' }, {
712
+ in: 'cookie',
713
+ name: '__Host-boxrouter_session',
714
+ type: 'apiKey'
715
+ }],
716
+ url: '/actions/runs/{run_id}/rerun',
717
+ ...options
718
+ });
719
+ }
720
+ /**
721
+ * Ask GitHub to rerun failed jobs and their dependents
722
+ *
723
+ * Requires workspace execute authority. This explicitly asks GitHub to rerun the failed
724
+ * jobs of the entire workflow run and the jobs that depend on them in a new attempt.
725
+ * Passed jobs rerun only when they depend on a failed job. GitHub creates and owns the new attempt. A 202 means
726
+ * GitHub acknowledged the request; it does not mean the new jobs have started.
727
+ * Idempotency-Key identifies this user-authorized mutation. An identical replay returns
728
+ * the recorded result; changed input conflicts. An unknown outcome is reconciled against
729
+ * GitHub and never automatically submitted again. A run with no failed job is refused
730
+ * with 409. Actions admission still rechecks repository binding, policy, trust and the
731
+ * immutable workspace/account/payer before creating any new placement.
732
+ *
733
+ */
734
+ rerunFailedJobs(options) {
735
+ return (options.client ?? this.client).post({
736
+ responseStyle: 'data',
737
+ security: [{ scheme: 'bearer', type: 'http' }, {
738
+ in: 'cookie',
739
+ name: '__Host-boxrouter_session',
740
+ type: 'apiKey'
741
+ }],
742
+ url: '/actions/runs/{run_id}/rerun-failed-jobs',
743
+ ...options
744
+ });
745
+ }
746
+ }
747
+ exports.Runs = Runs;
748
+ class PoolIdleTime extends HeyApiClient {
749
+ /**
750
+ * Get the billed time of runners that served no job
751
+ *
752
+ * Requires workspace read authority. A pooled runner can cost money while no GitHub job
753
+ * shows it: it sat idle until the pool drained it, or its pickup was foreign or revoked,
754
+ * or it failed after its sandbox existed. That time is charged to the payer and shown
755
+ * here, apart from every run and job. The read counts the runners that started in
756
+ * `[since, until)`, in total and per pool, with the same `billing` object a run carries.
757
+ * `idle_seconds` is each runner's lifetime from creation to its end (to now for a runner
758
+ * that is still alive). `until` defaults to now, `since` to 30 days before `until`, and the
759
+ * range may not exceed 92 days; a longer or empty range returns 400. It does not poll
760
+ * GitHub or a provider and does not change a runner.
761
+ *
762
+ */
763
+ get(options) {
764
+ return (options?.client ?? this.client).get({
765
+ responseStyle: 'data',
766
+ security: [{ scheme: 'bearer', type: 'http' }, {
767
+ in: 'cookie',
768
+ name: '__Host-boxrouter_session',
769
+ type: 'apiKey'
770
+ }],
771
+ url: '/actions/pool-idle-time',
772
+ ...options
773
+ });
774
+ }
775
+ }
776
+ exports.PoolIdleTime = PoolIdleTime;
777
+ class Jobs extends HeyApiClient {
778
+ /**
779
+ * Get an Actions job projection
780
+ *
781
+ * Requires workspace read authority. The GitHub assignment is authoritative; a requested job ID is not treated as runner reservation.
782
+ */
783
+ get(options) {
784
+ return (options.client ?? this.client).get({
785
+ responseStyle: 'data',
786
+ security: [{ scheme: 'bearer', type: 'http' }, {
787
+ in: 'cookie',
788
+ name: '__Host-boxrouter_session',
789
+ type: 'apiKey'
790
+ }],
791
+ url: '/actions/jobs/{job_id}',
792
+ ...options
793
+ });
794
+ }
795
+ /**
796
+ * Get GitHub workflow steps for an Actions job
797
+ *
798
+ * Requires workspace execute authority. Resolves the selected workspace-owned
799
+ * job and its exact historical run attempt before reading the assigned GitHub
800
+ * workflow job. Steps preserve GitHub source order and original step numbers;
801
+ * position is the zero-based display order. Pending, unavailable, forbidden and
802
+ * removed are explicit source states. Step output is not included.
803
+ *
804
+ */
805
+ getSteps(options) {
806
+ return (options.client ?? this.client).get({
807
+ responseStyle: 'data',
808
+ security: [{ scheme: 'bearer', type: 'http' }, {
809
+ in: 'cookie',
810
+ name: '__Host-boxrouter_session',
811
+ type: 'apiKey'
812
+ }],
813
+ url: '/actions/jobs/{job_id}/steps',
814
+ ...options
815
+ });
816
+ }
817
+ /**
818
+ * Read a bounded prefix of the selected GitHub job log
819
+ *
820
+ * Requires workspace execute authority. Resolves the workspace-owned job,
821
+ * current repository binding, assigned GitHub job and exact historical attempt
822
+ * before fetching only that native whole-job log. At most 1 MiB is returned;
823
+ * partial indicates a bounded prefix. Output is transient and is not retained.
824
+ * Individual step log availability depends on the GitHub App/repository source.
825
+ *
826
+ */
827
+ getLogs(options) {
828
+ return (options.client ?? this.client).get({
829
+ responseStyle: 'data',
830
+ security: [{ scheme: 'bearer', type: 'http' }, {
831
+ in: 'cookie',
832
+ name: '__Host-boxrouter_session',
833
+ type: 'apiKey'
834
+ }],
835
+ url: '/actions/jobs/{job_id}/logs',
836
+ ...options
837
+ });
838
+ }
839
+ /**
840
+ * Read a bounded prefix of one GitHub step log
841
+ *
842
+ * Requires workspace execute authority. step_position is zero-based and is
843
+ * verified against the selected fresh GitHub job before this endpoint is read.
844
+ * GitHub may report individual step logs unavailable for an App/repository;
845
+ * this is returned explicitly without synthesizing output from the whole-job log.
846
+ * At most 1 MiB is returned and partial indicates a bounded prefix.
847
+ *
848
+ */
849
+ getStepLogs(options) {
850
+ return (options.client ?? this.client).get({
851
+ responseStyle: 'data',
852
+ security: [{ scheme: 'bearer', type: 'http' }, {
853
+ in: 'cookie',
854
+ name: '__Host-boxrouter_session',
855
+ type: 'apiKey'
856
+ }],
857
+ url: '/actions/jobs/{job_id}/steps/{step_position}/logs',
858
+ ...options
859
+ });
860
+ }
861
+ /**
862
+ * List Actions step events for a job
863
+ *
864
+ * Requires workspace execute authority. Returns durable step events recorded for
865
+ * this workspace-owned Actions job, ordered by event time and ID. Use the
866
+ * continuation cursor to retrieve the next page; the list is empty when no
867
+ * events are available.
868
+ *
869
+ */
870
+ listEvents(options) {
871
+ return (options.client ?? this.client).get({
872
+ responseStyle: 'data',
873
+ security: [{ scheme: 'bearer', type: 'http' }, {
874
+ in: 'cookie',
875
+ name: '__Host-boxrouter_session',
876
+ type: 'apiKey'
877
+ }],
878
+ url: '/actions/jobs/{job_id}/events',
879
+ ...options
880
+ });
881
+ }
882
+ }
883
+ exports.Jobs = Jobs;
884
+ class Placements extends HeyApiClient {
885
+ /**
886
+ * Get an Actions placement and its cost and cleanup evidence
887
+ *
888
+ * Requires workspace read authority. A completed workflow job does not prove sandbox cleanup or final charge; pending and unknown remain explicit.
889
+ */
890
+ get(options) {
891
+ return (options.client ?? this.client).get({
892
+ responseStyle: 'data',
893
+ security: [{ scheme: 'bearer', type: 'http' }, {
894
+ in: 'cookie',
895
+ name: '__Host-boxrouter_session',
896
+ type: 'apiKey'
897
+ }],
898
+ url: '/actions/placements/{placement_id}',
899
+ ...options
900
+ });
901
+ }
902
+ }
903
+ exports.Placements = Placements;
904
+ class Actions extends HeyApiClient {
905
+ /**
906
+ * Read Actions runner and workspace funding readiness
907
+ *
908
+ * Requires workspace read authority. This read-only view uses the workspace's
909
+ * existing provider accounts and credits. Unknown source facts remain unknown;
910
+ * link targets appear only when an existing page can address the reported issue.
911
+ * When `repository_id` is supplied, readiness is scoped to that repository's saved
912
+ * software profile. The profile is resolved from workspace-owned settings; callers
913
+ * cannot select a profile through this parameter.
914
+ *
915
+ */
916
+ readiness(options) {
917
+ return (options?.client ?? this.client).get({
918
+ responseStyle: 'data',
919
+ security: [{ scheme: 'bearer', type: 'http' }, {
920
+ in: 'cookie',
921
+ name: '__Host-boxrouter_session',
922
+ type: 'apiKey'
923
+ }],
924
+ url: '/actions/readiness',
925
+ ...options
926
+ });
927
+ }
928
+ /**
929
+ * Read the recommended Actions runner labels and resource floors
930
+ *
931
+ * Requires workspace read authority. The catalog is fixed for a server release and does not
932
+ * depend on the workspace, so clients and caches may reuse it until its ETag changes. It does not assert live route availability or
933
+ * verified software; use readiness for that. Readiness still carries `runner_catalog` for
934
+ * older clients, but new clients should read this operation instead.
935
+ *
936
+ */
937
+ runnerCatalog(options) {
938
+ return (options?.client ?? this.client).get({
939
+ responseStyle: 'data',
940
+ security: [{ scheme: 'bearer', type: 'http' }, {
941
+ in: 'cookie',
942
+ name: '__Host-boxrouter_session',
943
+ type: 'apiKey'
944
+ }],
945
+ url: '/actions/runner-catalog',
946
+ ...options
947
+ });
948
+ }
949
+ /**
950
+ * Preview Actions label and policy eligibility
951
+ *
952
+ * Requires read authority for the linked repository in the authenticated workspace.
953
+ * This is a read-only evaluation of the same resolved policy and route matcher used
954
+ * for dispatch. It creates no runner, sandbox, reservation or billing hold. Refused
955
+ * and unknown results remain explicit; the preview never relaxes a requirement or
956
+ * claims an unverified route is eligible. It does not verify runner images. Runner image readiness is checked separately before dispatch.
957
+ *
958
+ */
959
+ preview(options) {
960
+ return (options.client ?? this.client).post({
961
+ responseStyle: 'data',
962
+ security: [{ scheme: 'bearer', type: 'http' }, {
963
+ in: 'cookie',
964
+ name: '__Host-boxrouter_session',
965
+ type: 'apiKey'
966
+ }],
967
+ url: '/actions/preview',
968
+ ...options,
969
+ headers: {
970
+ 'Content-Type': 'application/json',
971
+ ...options.headers
972
+ }
973
+ });
974
+ }
975
+ _repositories;
976
+ get repositories() {
977
+ return this._repositories ??= new Repositories({ client: this.client });
978
+ }
979
+ _policies;
980
+ get policies() {
981
+ return this._policies ??= new Policies({ client: this.client });
982
+ }
983
+ _runs;
984
+ get runs() {
985
+ return this._runs ??= new Runs({ client: this.client });
986
+ }
987
+ _poolIdleTime;
988
+ get poolIdleTime() {
989
+ return this._poolIdleTime ??= new PoolIdleTime({ client: this.client });
990
+ }
991
+ _jobs;
992
+ get jobs() {
993
+ return this._jobs ??= new Jobs({ client: this.client });
994
+ }
995
+ _placements;
996
+ get placements() {
997
+ return this._placements ??= new Placements({ client: this.client });
998
+ }
999
+ }
1000
+ exports.Actions = Actions;
1001
+ class Routing extends HeyApiClient {
1002
+ /**
1003
+ * Read workspace routing and provider funding
1004
+ *
1005
+ * Workspace read authority required. Returns each independently versioned section
1006
+ * and its opaque ETag in section_etags. Never returns credentials. The GET itself
1007
+ * has no whole-document validator; send a chosen section's token in If-Match to
1008
+ * guard a write to that section.
1009
+ * On a workspace's first read, the server atomically creates sections from its
1010
+ * legacy funding state. Concurrent first reads return the same persisted sections
1011
+ * and ETags. Later reads do not change settings unless a supported provider,
1012
+ * managed offer or connected account changed and needs reconciliation; only a
1013
+ * section that actually changes advances its ETag. The saved Prevent Overrides
1014
+ * switch is retained across reads.
1015
+ *
1016
+ */
1017
+ settings(options) {
1018
+ return (options?.client ?? this.client).get({
1019
+ responseStyle: 'data',
1020
+ security: [{ scheme: 'bearer', type: 'http' }, {
1021
+ in: 'cookie',
1022
+ name: '__Host-boxrouter_session',
1023
+ type: 'apiKey'
1024
+ }],
1025
+ url: '/routing/settings',
1026
+ ...options
1027
+ });
1028
+ }
1029
+ /**
1030
+ * Update one workspace routing section
1031
+ *
1032
+ * Workspace admin (or provider-accounts:manage for provider funding) required;
1033
+ * browser mutations also require Origin and X-CSRF-Token. The body names exactly
1034
+ * one section: routing fields or one provider funding section. Send only the fields
1035
+ * to change; every omitted field keeps its stored value, and the merged section is
1036
+ * validated as a complete section before it is written. If-Match is optional. When
1037
+ * sent, it must be the opaque token returned for THAT section by GET or the call
1038
+ * fails 412 with no write; when omitted, the named fields are written to the
1039
+ * current section. Atomically update only the named section and advance only its
1040
+ * ETag. A stale token for that same section returns 412 with no write; a concurrent
1041
+ * Routing edit cannot conflict with provider funding, and edits to distinct
1042
+ * providers cannot conflict with one another. Reject duplicate account IDs,
1043
+ * foreign/wrong-provider accounts and newly enabled Credits on unavailable managed
1044
+ * providers before writing. Adding a key does not change provider exclusion.
1045
+ * Identical idempotency replay returns the previously recorded response, not a
1046
+ * second write.
1047
+ *
1048
+ */
1049
+ updateSettings(options) {
1050
+ return (options.client ?? this.client).put({
1051
+ responseStyle: 'data',
1052
+ security: [{ scheme: 'bearer', type: 'http' }, {
1053
+ in: 'cookie',
1054
+ name: '__Host-boxrouter_session',
1055
+ type: 'apiKey'
1056
+ }],
1057
+ url: '/routing/settings',
1058
+ ...options,
1059
+ headers: {
1060
+ 'Content-Type': 'application/json',
1061
+ ...options.headers
1062
+ }
1063
+ });
1064
+ }
1065
+ /**
1066
+ * Preview workspace route availability without dispatch
1067
+ *
1068
+ * Workspace read authority required. Side-effect-free current eligibility and
1069
+ * versioned hold quotes from admission. No next-job prediction, workspace spend
1070
+ * cap or promise that a later create can start. No secret or foreign balance.
1071
+ *
1072
+ */
1073
+ preview(options) {
1074
+ return (options?.client ?? this.client).get({
1075
+ responseStyle: 'data',
1076
+ security: [{ scheme: 'bearer', type: 'http' }, {
1077
+ in: 'cookie',
1078
+ name: '__Host-boxrouter_session',
1079
+ type: 'apiKey'
1080
+ }],
1081
+ url: '/routing/preview',
1082
+ ...options
1083
+ });
1084
+ }
1085
+ }
1086
+ exports.Routing = Routing;
1087
+ class Operations extends HeyApiClient {
1088
+ /**
1089
+ * List recorded workspace operations
1090
+ *
1091
+ * Stable ID-ordered pagination over authoritative mutation records. Observed time is the lookup time, not the original execution timestamp. Listing never reconciles or retries work.
1092
+ */
1093
+ list(options) {
1094
+ return (options?.client ?? this.client).get({
1095
+ responseStyle: 'data',
1096
+ security: [{ scheme: 'bearer', type: 'http' }, {
1097
+ in: 'cookie',
1098
+ name: '__Host-boxrouter_session',
1099
+ type: 'apiKey'
1100
+ }],
1101
+ url: '/operations',
1102
+ ...options
1103
+ });
1104
+ }
1105
+ /**
1106
+ * Get a mutation's known outcome
1107
+ *
1108
+ * Read the workspace-owned mutation record identified in an error response.
1109
+ * This lookup never repeats the mutation. Unknown remains unknown until
1110
+ * reconciliation establishes an outcome.
1111
+ *
1112
+ * If a creation response was lost, explicitly resubmitting POST /sandboxes
1113
+ * in the original workspace with the original Idempotency-Key and identical
1114
+ * effective request body recovers a retained creation record. Completed
1115
+ * creation returns the original sandbox or an error retaining its operation
1116
+ * ID if observing the sandbox's current state fails. An unresolved record
1117
+ * returns 409 with its operation ID without dispatching creation again.
1118
+ * Different input returns 409. This POST can create a sandbox if no record
1119
+ * exists; it is not a read-only lookup. Unknown records remain until resolved;
1120
+ * completed records remain for at least 24 hours. Without the original key and request,
1121
+ * or beyond guaranteed retention, inspect owned resources or use support
1122
+ * before creating more work. Never change the key to bypass uncertainty.
1123
+ *
1124
+ */
1125
+ get(options) {
1126
+ return (options.client ?? this.client).get({
1127
+ responseStyle: 'data',
1128
+ security: [{ scheme: 'bearer', type: 'http' }, {
1129
+ in: 'cookie',
1130
+ name: '__Host-boxrouter_session',
1131
+ type: 'apiKey'
1132
+ }],
1133
+ url: '/operations/{operation_id}',
1134
+ ...options
1135
+ });
1136
+ }
1137
+ }
1138
+ exports.Operations = Operations;
1139
+ class Artifacts extends HeyApiClient {
1140
+ /**
1141
+ * Upload a staged input
1142
+ *
1143
+ * Stream opaque source bytes to workspace-scoped temporary storage. Enforce
1144
+ * workspace upload quotas without buffering the entire request in memory.
1145
+ * Compute the digest server-side; return a handle only after the full upload
1146
+ * succeeds. A failed upload is not a usable artifact. Do not execute or import
1147
+ * uploaded code. Artifact references stay workspace-scoped and can be used across routes.
1148
+ *
1149
+ */
1150
+ upload(options) {
1151
+ return (options.client ?? this.client).post({
1152
+ bodySerializer: null,
1153
+ responseStyle: 'data',
1154
+ security: [{ scheme: 'bearer', type: 'http' }, {
1155
+ in: 'cookie',
1156
+ name: '__Host-boxrouter_session',
1157
+ type: 'apiKey'
1158
+ }],
1159
+ url: '/artifacts',
1160
+ ...options,
1161
+ headers: {
1162
+ 'Content-Type': 'application/octet-stream',
1163
+ ...options.headers
1164
+ }
1165
+ });
1166
+ }
1167
+ /**
1168
+ * Remove a staged artifact
1169
+ *
1170
+ * Delete source storage without deleting resulting provider images. Reject with
1171
+ * 409 while a submitted build, file transfer or credential-factory activation
1172
+ * still needs these bytes. An activated factory uses its retained encrypted
1173
+ * copy; deleting staging bytes does not revoke that credential version. Successful deletion is
1174
+ * idempotent for a known owned record; unowned IDs remain 404.
1175
+ *
1176
+ */
1177
+ delete(options) {
1178
+ return (options.client ?? this.client).delete({
1179
+ responseStyle: 'data',
1180
+ security: [{ scheme: 'bearer', type: 'http' }, {
1181
+ in: 'cookie',
1182
+ name: '__Host-boxrouter_session',
1183
+ type: 'apiKey'
1184
+ }],
1185
+ url: '/artifacts/{artifact_id}',
1186
+ ...options
1187
+ });
1188
+ }
1189
+ /**
1190
+ * Inspect a staged artifact
1191
+ *
1192
+ * Return metadata only. Unknown, unowned and expired artifacts return 404.
1193
+ */
1194
+ get(options) {
1195
+ return (options.client ?? this.client).get({
1196
+ responseStyle: 'data',
1197
+ security: [{ scheme: 'bearer', type: 'http' }, {
1198
+ in: 'cookie',
1199
+ name: '__Host-boxrouter_session',
1200
+ type: 'apiKey'
1201
+ }],
1202
+ url: '/artifacts/{artifact_id}',
1203
+ ...options
1204
+ });
1205
+ }
1206
+ }
1207
+ exports.Artifacts = Artifacts;
1208
+ class Images extends HeyApiClient {
1209
+ /**
1210
+ * Prepare an image on selected providers
1211
+ *
1212
+ * Start background preparation using this workspace's payer-account rules, on the named
1213
+ * `providers` or on the `top` providers a create with the `match` body would pick now.
1214
+ * A named provider that cannot run the image reports its fit reason immediately; a
1215
+ * `match` body that no route can run is refused as that create would be. With `match`,
1216
+ * the response lists the picked providers in rank order, and each reason says how it
1217
+ * was ranked. A ready result means a usable copy existed when preparation completed;
1218
+ * it does not keep the copy awake afterward. Read progress from GET /images/preparations.
1219
+ * OCI and Dockerfile inputs use the same declared preparation capabilities as a create.
1220
+ * A Dockerfile response returns a content selector for status and unprepare. If no selected
1221
+ * offering declares prepared Dockerfile/context support, it is refused before reading the
1222
+ * context or starting provider work. Existing provider artifacts are already prepared.
1223
+ * The request JSON is limited to 64 KiB; uploaded contexts retain the artifacts API limits.
1224
+ *
1225
+ */
1226
+ prepare(options) {
1227
+ return (options.client ?? this.client).post({
1228
+ responseStyle: 'data',
1229
+ security: [{ scheme: 'bearer', type: 'http' }, {
1230
+ in: 'cookie',
1231
+ name: '__Host-boxrouter_session',
1232
+ type: 'apiKey'
1233
+ }],
1234
+ url: '/images/prepare',
1235
+ ...options,
1236
+ headers: {
1237
+ 'Content-Type': 'application/json',
1238
+ ...options.headers
1239
+ }
1240
+ });
1241
+ }
1242
+ /**
1243
+ * Read image preparation status
1244
+ *
1245
+ * Reads preparation state recorded for the requested image in this workspace. The providers query can limit the result; omitted returns every recorded provider. A content selector reads the workspace's recorded copy without contacting a registry.
1246
+ */
1247
+ status(options) {
1248
+ return (options.client ?? this.client).get({
1249
+ responseStyle: 'data',
1250
+ security: [{ scheme: 'bearer', type: 'http' }, {
1251
+ in: 'cookie',
1252
+ name: '__Host-boxrouter_session',
1253
+ type: 'apiKey'
1254
+ }],
1255
+ url: '/images/preparations',
1256
+ ...options
1257
+ });
1258
+ }
1259
+ /**
1260
+ * Remove this workspace's prepared image copies
1261
+ *
1262
+ * Remove only copies Cloud recorded for this workspace. Copies on managed accounts
1263
+ * that other workspaces still use remain available, while this workspace's use is
1264
+ * dropped. The image itself is not deleted. A provider reports gone only after it
1265
+ * confirms removal. A later sandbox create may prepare the image again.
1266
+ *
1267
+ */
1268
+ unprepare(options) {
1269
+ return (options.client ?? this.client).post({
1270
+ responseStyle: 'data',
1271
+ security: [{ scheme: 'bearer', type: 'http' }, {
1272
+ in: 'cookie',
1273
+ name: '__Host-boxrouter_session',
1274
+ type: 'apiKey'
1275
+ }],
1276
+ url: '/images/unprepare',
1277
+ ...options,
1278
+ headers: {
1279
+ 'Content-Type': 'application/json',
1280
+ ...options.headers
1281
+ }
1282
+ });
1283
+ }
1284
+ }
1285
+ exports.Images = Images;
1286
+ class Processes extends HeyApiClient {
1287
+ /**
1288
+ * Start a durable background command
1289
+ *
1290
+ * Runs a command in the background in a Bash login shell and returns a process ID. The
1291
+ * process keeps running between your calls: read its output, write to its input, or cancel
1292
+ * it later, from any client. The sandbox's lifetime bounds how long it can run; cancel it to
1293
+ * end it sooner.
1294
+ *
1295
+ * The sandbox image needs Linux `/proc`, Bash, and a few standard tools (`setsid`, `nohup`,
1296
+ * `tail`, `base64`). If one is missing, the call fails with `unsupported_feature` before
1297
+ * anything starts.
1298
+ *
1299
+ * `stdin` defaults to `false`. Setting it to `true`, to write to the process later, needs a
1300
+ * sandbox created with the `processes.input` requirement and a route that supports writing to
1301
+ * the process after it reconnects (`reattached_stdin`). To check ahead of time which routes
1302
+ * qualify, send the same requirements to `POST /sandboxes/match`.
1303
+ *
1304
+ * With `wait_for_port`, the call returns once that port accepts TCP connections inside the
1305
+ * sandbox. If the process exits first, or the port is still closed after 30 seconds, the
1306
+ * process is ended and the call fails with `409 port_not_listening`. `details` carries
1307
+ * `port`, `stdout_tail`, `stderr_tail` and, when the process exited, `exit_code`.
1308
+ *
1309
+ */
1310
+ start(options) {
1311
+ return (options.client ?? this.client).post({
1312
+ responseStyle: 'data',
1313
+ security: [{ scheme: 'bearer', type: 'http' }, {
1314
+ in: 'cookie',
1315
+ name: '__Host-boxrouter_session',
1316
+ type: 'apiKey'
1317
+ }],
1318
+ url: '/sandboxes/{sandbox_id}/processes',
1319
+ ...options,
1320
+ headers: {
1321
+ 'Content-Type': 'application/json',
1322
+ ...options.headers
1323
+ }
1324
+ });
1325
+ }
1326
+ /**
1327
+ * Delete a finished process's retained output
1328
+ *
1329
+ * Deletes the retained output and metadata for a finished process in the addressed sandbox. It does not stop a running process; that request returns 409. The SDK generates an Idempotency-Key when omitted; reuse a supplied key with the identical request to reconcile an uncertain result.
1330
+ */
1331
+ remove(options) {
1332
+ return (options.client ?? this.client).delete({
1333
+ responseStyle: 'data',
1334
+ security: [{ scheme: 'bearer', type: 'http' }, {
1335
+ in: 'cookie',
1336
+ name: '__Host-boxrouter_session',
1337
+ type: 'apiKey'
1338
+ }],
1339
+ url: '/sandboxes/{sandbox_id}/processes/{process_id}',
1340
+ ...options
1341
+ });
1342
+ }
1343
+ /**
1344
+ * Read process output from byte offsets
1345
+ *
1346
+ * **Process observation**
1347
+ *
1348
+ * You can rely on:
1349
+ * - A completed result carries the exact exit status and the complete output; otherwise the call reports lost observation or incomplete output.
1350
+ * - Output bytes are exact on every route (commands in byte mode stay exact everywhere).
1351
+ *
1352
+ * You can set: observation deadline. Reattach where the route supports it.
1353
+ *
1354
+ * Not promised: chunk sizes; immediate status visibility; output kept beyond the retained history.
1355
+ *
1356
+ * **Process wait**
1357
+ *
1358
+ * You can rely on:
1359
+ * - Returns the exact observed exit status.
1360
+ * - An observation deadline does not claim the process stopped.
1361
+ *
1362
+ * You can set: observation deadline.
1363
+ *
1364
+ * Returns up to 256 KiB per stream from the requested byte offsets. Pass the
1365
+ * returned next offsets to continue without gaps or repeats. `exit_code` is set
1366
+ * only after the process ended and both streams were read to their ends. Reads
1367
+ * are non-blocking. If the provider replaced the guest session, the answer is
1368
+ * 410 `expired`; the command is never run again.
1369
+ *
1370
+ */
1371
+ read(options) {
1372
+ return (options.client ?? this.client).get({
1373
+ responseStyle: 'data',
1374
+ security: [{ scheme: 'bearer', type: 'http' }, {
1375
+ in: 'cookie',
1376
+ name: '__Host-boxrouter_session',
1377
+ type: 'apiKey'
1378
+ }],
1379
+ url: '/sandboxes/{sandbox_id}/processes/{process_id}',
1380
+ ...options
1381
+ });
1382
+ }
1383
+ /**
1384
+ * Write process input
1385
+ *
1386
+ * You can rely on:
1387
+ * - Input is delivered in order.
1388
+ * - EOF is explicit.
1389
+ * - Uncertain delivery is never resent.
1390
+ * - Input is UTF-8 text on every route.
1391
+ *
1392
+ * You can set: data (text), EOF.
1393
+ *
1394
+ * Not promised: chunking on the wire.
1395
+ *
1396
+ * Append text to a process started with `stdin: true`. Calls from one client
1397
+ * must be awaited sequentially to preserve input order. The selected route must
1398
+ * support both `processes.input` and input after process reconnection
1399
+ * (`reattached_stdin`); otherwise writes and EOF are refused as `unsupported_feature`
1400
+ * before dispatch. Use `POST /sandboxes/match` with `requirements.processes.input`
1401
+ * set to true to inspect eligible routes before create. If stdin is closed, return 409.
1402
+ *
1403
+ */
1404
+ writeStdin(options) {
1405
+ return (options.client ?? this.client).post({
1406
+ responseStyle: 'data',
1407
+ security: [{ scheme: 'bearer', type: 'http' }, {
1408
+ in: 'cookie',
1409
+ name: '__Host-boxrouter_session',
1410
+ type: 'apiKey'
1411
+ }],
1412
+ url: '/sandboxes/{sandbox_id}/processes/{process_id}/stdin',
1413
+ ...options,
1414
+ headers: {
1415
+ 'Content-Type': 'application/json',
1416
+ ...options.headers
1417
+ }
1418
+ });
1419
+ }
1420
+ /**
1421
+ * Send stdin EOF
1422
+ *
1423
+ * You can rely on:
1424
+ * - Input is delivered in order.
1425
+ * - EOF is explicit.
1426
+ * - Uncertain delivery is never resent.
1427
+ * - Input is UTF-8 text on every route.
1428
+ *
1429
+ * You can set: data (text), EOF.
1430
+ *
1431
+ * Not promised: chunking on the wire.
1432
+ *
1433
+ * Close only the input stream of a process started with stdin enabled; unsupported providers refuse before dispatch.
1434
+ *
1435
+ */
1436
+ closeStdin(options) {
1437
+ return (options.client ?? this.client).post({
1438
+ responseStyle: 'data',
1439
+ security: [{ scheme: 'bearer', type: 'http' }, {
1440
+ in: 'cookie',
1441
+ name: '__Host-boxrouter_session',
1442
+ type: 'apiKey'
1443
+ }],
1444
+ url: '/sandboxes/{sandbox_id}/processes/{process_id}/stdin/close',
1445
+ ...options
1446
+ });
1447
+ }
1448
+ /**
1449
+ * Cancel a durable process
1450
+ *
1451
+ * Ends the process and everything it started. This works on every sandbox; it needs no
1452
+ * `processes.cancel` requirement. Cancelling a process that has already finished succeeds and
1453
+ * changes nothing.
1454
+ *
1455
+ */
1456
+ cancel(options) {
1457
+ return (options.client ?? this.client).post({
1458
+ responseStyle: 'data',
1459
+ security: [{ scheme: 'bearer', type: 'http' }, {
1460
+ in: 'cookie',
1461
+ name: '__Host-boxrouter_session',
1462
+ type: 'apiKey'
1463
+ }],
1464
+ url: '/sandboxes/{sandbox_id}/processes/{process_id}/cancel',
1465
+ ...options
1466
+ });
1467
+ }
1468
+ }
1469
+ exports.Processes = Processes;
1470
+ class Credits extends HeyApiClient {
1471
+ /**
1472
+ * Get the workspace credit balance
1473
+ *
1474
+ * Requires account-management permission; execution keys receive 403. Returns 503
1475
+ * payments_unavailable while credit purchases are not configured. BYOK work never
1476
+ * depends on this balance.
1477
+ *
1478
+ */
1479
+ balance(options) {
1480
+ return (options?.client ?? this.client).get({
1481
+ responseStyle: 'data',
1482
+ security: [{ scheme: 'bearer', type: 'http' }, {
1483
+ in: 'cookie',
1484
+ name: '__Host-boxrouter_session',
1485
+ type: 'apiKey'
1486
+ }],
1487
+ url: '/credits',
1488
+ ...options
1489
+ });
1490
+ }
1491
+ /**
1492
+ * List recent credit purchases
1493
+ *
1494
+ * Workspace-owned purchases in every state, ordered by creation time and ID descending. Invoice and receipt links appear only after confirmed payment. New purchases do not shift subsequent pages. Invalid or another workspace's cursor is a 400.
1495
+ */
1496
+ purchases(options) {
1497
+ return (options?.client ?? this.client).get({
1498
+ responseStyle: 'data',
1499
+ security: [{ scheme: 'bearer', type: 'http' }, {
1500
+ in: 'cookie',
1501
+ name: '__Host-boxrouter_session',
1502
+ type: 'apiKey'
1503
+ }],
1504
+ url: '/credits/purchases',
1505
+ ...options
1506
+ });
1507
+ }
1508
+ /**
1509
+ * Start a credit purchase through Checkout or a saved card
1510
+ *
1511
+ * Without payment_method_id, records a pending purchase and returns the hosted
1512
+ * Checkout page; success_url and cancel_url are required for this path. The response
1513
+ * reports fee_minor and total_minor before redirect: Checkout charges total_minor
1514
+ * (amount_minor plus BoxRouter's purchase fee, before tax) in two line items, and only
1515
+ * amount_minor is added as credit. A refund returns credit only; the fee is not
1516
+ * refunded. With a
1517
+ * workspace-owned payment_method_id, creates and pays a
1518
+ * Stripe invoice using that card. A verified paid invoice returns confirmed; when
1519
+ * payer authentication is required, returns pending with the hosted invoice
1520
+ * authentication_url. Send the payer there, then poll this purchase after they
1521
+ * return to the dashboard. Credit is added only after BoxRouter fetches and validates
1522
+ * the paid invoice. A definitive card decline returns payment_declined with the
1523
+ * purchase ID and a short safe decline reason in error details, outcome not_started;
1524
+ * the failed purchase remains in history. Repeating a request with the same
1525
+ * Idempotency-Key returns its original result; a different amount or card under that
1526
+ * key is a 409. After a payment_provider_unavailable response with outcome unknown,
1527
+ * retry with the same key.
1528
+ *
1529
+ */
1530
+ purchase(options) {
1531
+ return (options.client ?? this.client).post({
1532
+ responseStyle: 'data',
1533
+ security: [{ scheme: 'bearer', type: 'http' }, {
1534
+ in: 'cookie',
1535
+ name: '__Host-boxrouter_session',
1536
+ type: 'apiKey'
1537
+ }],
1538
+ url: '/credits/purchases',
1539
+ ...options,
1540
+ headers: {
1541
+ 'Content-Type': 'application/json',
1542
+ ...options.headers
1543
+ }
1544
+ });
1545
+ }
1546
+ /**
1547
+ * Preview a credit purchase and its tax
1548
+ *
1549
+ * Returns Stripe's current tax preview for the requested top-up amount. Requires account-management permission and is available only when in-page card purchases are enabled.
1550
+ */
1551
+ quotePurchase(options) {
1552
+ return (options.client ?? this.client).post({
1553
+ responseStyle: 'data',
1554
+ security: [{ scheme: 'bearer', type: 'http' }, {
1555
+ in: 'cookie',
1556
+ name: '__Host-boxrouter_session',
1557
+ type: 'apiKey'
1558
+ }],
1559
+ url: '/credits/purchases/quote',
1560
+ ...options,
1561
+ headers: {
1562
+ 'Content-Type': 'application/json',
1563
+ ...options.headers
1564
+ }
1565
+ });
1566
+ }
1567
+ /**
1568
+ * List managed-compute credit movements
1569
+ *
1570
+ * Requires account-management permission; execution keys receive 403. Returns
1571
+ * confirmed, nonzero charges from the configured test or live billing book, the later
1572
+ * corrections to them, reservations still held, and reservations released with no
1573
+ * charge, newest first. Results are limited to the calling workspace. BYOK work,
1574
+ * supplier costs, provider account identities, API-key digests and raw usage evidence
1575
+ * are not returned; a row's `key_id` names the workspace API key it belongs to. A
1576
+ * cursor belongs to this workspace and billing mode; invalid or foreign cursors
1577
+ * return 400. New rows do not shift subsequent pages. No provider or payment-provider
1578
+ * calls are made.
1579
+ *
1580
+ */
1581
+ usage(options) {
1582
+ return (options?.client ?? this.client).get({
1583
+ responseStyle: 'data',
1584
+ security: [{ scheme: 'bearer', type: 'http' }, {
1585
+ in: 'cookie',
1586
+ name: '__Host-boxrouter_session',
1587
+ type: 'apiKey'
1588
+ }],
1589
+ url: '/credits/usage',
1590
+ ...options
1591
+ });
1592
+ }
1593
+ /**
1594
+ * Get one credit purchase
1595
+ *
1596
+ * The authoritative state to poll after the payer returns from Checkout. Another workspace's purchase is a 404.
1597
+ */
1598
+ getPurchase(options) {
1599
+ return (options.client ?? this.client).get({
1600
+ responseStyle: 'data',
1601
+ security: [{ scheme: 'bearer', type: 'http' }, {
1602
+ in: 'cookie',
1603
+ name: '__Host-boxrouter_session',
1604
+ type: 'apiKey'
1605
+ }],
1606
+ url: '/credits/purchases/{purchase_id}',
1607
+ ...options
1608
+ });
1609
+ }
1610
+ /**
1611
+ * Close an unpaid Checkout session
1612
+ *
1613
+ * Expires a known open Checkout session for this workspace-owned purchase. A
1614
+ * completed payment is reconciled and remains confirmed. If Checkout creation
1615
+ * had an unknown outcome and no session ID was recorded, the same stable Stripe
1616
+ * idempotency key recovers that request before BoxRouter expires the session.
1617
+ * Repeating this request is safe. The request needs no body: the return URLs are
1618
+ * optional and unused when closing a purchase.
1619
+ *
1620
+ */
1621
+ cancelPurchase(options) {
1622
+ return (options.client ?? this.client).post({
1623
+ responseStyle: 'data',
1624
+ security: [{ scheme: 'bearer', type: 'http' }, {
1625
+ in: 'cookie',
1626
+ name: '__Host-boxrouter_session',
1627
+ type: 'apiKey'
1628
+ }],
1629
+ url: '/credits/purchases/{purchase_id}/cancel',
1630
+ ...options,
1631
+ headers: {
1632
+ 'Content-Type': 'application/json',
1633
+ ...options.headers
1634
+ }
1635
+ });
1636
+ }
1637
+ /**
1638
+ * List redeemed promotion codes
1639
+ *
1640
+ * Promotion codes this workspace redeemed, newest first.
1641
+ */
1642
+ promotions(options) {
1643
+ return (options?.client ?? this.client).get({
1644
+ responseStyle: 'data',
1645
+ security: [{ scheme: 'bearer', type: 'http' }, {
1646
+ in: 'cookie',
1647
+ name: '__Host-boxrouter_session',
1648
+ type: 'apiKey'
1649
+ }],
1650
+ url: '/credits/promotions',
1651
+ ...options
1652
+ });
1653
+ }
1654
+ /**
1655
+ * Redeem a promotion code for free credit
1656
+ *
1657
+ * Adds the code's credit to the workspace balance, once per workspace. Codes are
1658
+ * case-insensitive and surrounding spaces are ignored. An unknown, expired, disabled
1659
+ * or fully used code is 404 promotion_code_invalid; these cases are not told apart.
1660
+ * A new redemption answers 201. A code this workspace already redeemed is refused
1661
+ * with 409 promotion_already_redeemed and details.redemption containing the original redemption;
1662
+ * its message names the redemption date. No credit is granted again. Promotional
1663
+ * credit does not expire. Requires account-management permission; 503 payments_unavailable while
1664
+ * credits are not configured.
1665
+ *
1666
+ */
1667
+ redeem(options) {
1668
+ return (options.client ?? this.client).post({
1669
+ responseStyle: 'data',
1670
+ security: [{ scheme: 'bearer', type: 'http' }, {
1671
+ in: 'cookie',
1672
+ name: '__Host-boxrouter_session',
1673
+ type: 'apiKey'
1674
+ }],
1675
+ url: '/credits/promotions',
1676
+ ...options,
1677
+ headers: {
1678
+ 'Content-Type': 'application/json',
1679
+ ...options.headers
1680
+ }
1681
+ });
1682
+ }
1683
+ /**
1684
+ * Get workspace billing details
1685
+ *
1686
+ * Requires account-management permission. Reads the workspace Stripe customer. When multiple customer tax IDs exist, tax_id is the newest by creation time (ID breaks ties). Unset details are null.
1687
+ */
1688
+ billingDetails(options) {
1689
+ return (options?.client ?? this.client).get({
1690
+ responseStyle: 'data',
1691
+ security: [{ scheme: 'bearer', type: 'http' }, {
1692
+ in: 'cookie',
1693
+ name: '__Host-boxrouter_session',
1694
+ type: 'apiKey'
1695
+ }],
1696
+ url: '/credits/billing-details',
1697
+ ...options
1698
+ });
1699
+ }
1700
+ /**
1701
+ * Replace workspace billing details
1702
+ *
1703
+ * Stores legal name, invoice email, address and one tax ID on the workspace Stripe customer, creating it when absent. Details apply to future invoices. PUT replaces all customer tax IDs with the supplied single ID, adding the replacement before deleting old IDs so a rejected replacement preserves them. Stripe tax ID verification can be pending or unsuccessful. Repeat an uncertain update with the same Idempotency-Key; a changed body under that key returns 409. Stripe rejection returns 502; the update can have partially completed, so read current details before correcting it.
1704
+ */
1705
+ updateBillingDetails(options) {
1706
+ return (options.client ?? this.client).put({
1707
+ responseStyle: 'data',
1708
+ security: [{ scheme: 'bearer', type: 'http' }, {
1709
+ in: 'cookie',
1710
+ name: '__Host-boxrouter_session',
1711
+ type: 'apiKey'
1712
+ }],
1713
+ url: '/credits/billing-details',
1714
+ ...options,
1715
+ headers: {
1716
+ 'Content-Type': 'application/json',
1717
+ ...options.headers
1718
+ }
1719
+ });
1720
+ }
1721
+ /**
1722
+ * Get workspace credit alert settings
1723
+ *
1724
+ * Requires account-management permission. Returns workspace-owned settings only.
1725
+ */
1726
+ alerts(options) {
1727
+ return (options?.client ?? this.client).get({
1728
+ responseStyle: 'data',
1729
+ security: [{ scheme: 'bearer', type: 'http' }, {
1730
+ in: 'cookie',
1731
+ name: '__Host-boxrouter_session',
1732
+ type: 'apiKey'
1733
+ }],
1734
+ url: '/credits/alerts',
1735
+ ...options
1736
+ });
1737
+ }
1738
+ /**
1739
+ * Replace workspace credit alert settings
1740
+ *
1741
+ * Atomically replaces the optional trigger level and evaluates the current available balance. Repeating identical settings is idempotent and requires no Idempotency-Key. Sends the owner one alert per crossing below the trigger level and one when available credit is zero or negative; a repeated evaluation does not resend. Re-arms at or above the trigger level and above zero respectively. BYOK work is unaffected by credit balance.
1742
+ */
1743
+ updateAlerts(options) {
1744
+ return (options.client ?? this.client).put({
1745
+ responseStyle: 'data',
1746
+ security: [{ scheme: 'bearer', type: 'http' }, {
1747
+ in: 'cookie',
1748
+ name: '__Host-boxrouter_session',
1749
+ type: 'apiKey'
1750
+ }],
1751
+ url: '/credits/alerts',
1752
+ ...options,
1753
+ headers: {
1754
+ 'Content-Type': 'application/json',
1755
+ ...options.headers
1756
+ }
1757
+ });
1758
+ }
1759
+ /**
1760
+ * List saved workspace payment methods
1761
+ *
1762
+ * Returns masked card details only. Saved methods can be charged for a workspace member's purchase or immediately when enabling auto top-up with a trigger level above the current balance.
1763
+ */
1764
+ paymentMethods(options) {
1765
+ return (options?.client ?? this.client).get({
1766
+ responseStyle: 'data',
1767
+ security: [{ scheme: 'bearer', type: 'http' }, {
1768
+ in: 'cookie',
1769
+ name: '__Host-boxrouter_session',
1770
+ type: 'apiKey'
1771
+ }],
1772
+ url: '/credits/payment-methods',
1773
+ ...options
1774
+ });
1775
+ }
1776
+ /**
1777
+ * Start hosted setup for a saved payment method
1778
+ *
1779
+ * Creates a Stripe-hosted setup page and returns its URL. Setup does not charge the
1780
+ * payer. The completed method can be charged for a later user-initiated purchase or immediately when enabling auto top-up with a trigger level above the current balance.
1781
+ * Repeating the request with the same Idempotency-Key returns the same page.
1782
+ *
1783
+ */
1784
+ setupPaymentMethod(options) {
1785
+ return (options.client ?? this.client).post({
1786
+ responseStyle: 'data',
1787
+ security: [{ scheme: 'bearer', type: 'http' }, {
1788
+ in: 'cookie',
1789
+ name: '__Host-boxrouter_session',
1790
+ type: 'apiKey'
1791
+ }],
1792
+ url: '/credits/payment-methods/setup',
1793
+ ...options,
1794
+ headers: {
1795
+ 'Content-Type': 'application/json',
1796
+ ...options.headers
1797
+ }
1798
+ });
1799
+ }
1800
+ /**
1801
+ * Start in-page saved card setup
1802
+ *
1803
+ * Creates a Stripe SetupIntent for in-page card collection. Requires account-management permission and the in-page cards feature.
1804
+ */
1805
+ setupPaymentMethodIntent(options) {
1806
+ return (options?.client ?? this.client).post({
1807
+ responseStyle: 'data',
1808
+ security: [{ scheme: 'bearer', type: 'http' }, {
1809
+ in: 'cookie',
1810
+ name: '__Host-boxrouter_session',
1811
+ type: 'apiKey'
1812
+ }],
1813
+ url: '/credits/payment-methods/setup-intent',
1814
+ ...options
1815
+ });
1816
+ }
1817
+ /**
1818
+ * Set saved card charge order
1819
+ *
1820
+ * Replaces the order of every saved card and Link method for automatic top-up. Requires account-management permission and the multi-card top-up feature.
1821
+ */
1822
+ reorderPaymentMethods(options) {
1823
+ return (options.client ?? this.client).put({
1824
+ responseStyle: 'data',
1825
+ security: [{ scheme: 'bearer', type: 'http' }, {
1826
+ in: 'cookie',
1827
+ name: '__Host-boxrouter_session',
1828
+ type: 'apiKey'
1829
+ }],
1830
+ url: '/credits/payment-methods/order',
1831
+ ...options,
1832
+ headers: {
1833
+ 'Content-Type': 'application/json',
1834
+ ...options.headers
1835
+ }
1836
+ });
1837
+ }
1838
+ /**
1839
+ * Get a saved payment method setup status
1840
+ *
1841
+ * Reads Stripe's current setup state after the payer returns. Another workspace's setup is a 404.
1842
+ */
1843
+ getPaymentMethodSetup(options) {
1844
+ return (options.client ?? this.client).get({
1845
+ responseStyle: 'data',
1846
+ security: [{ scheme: 'bearer', type: 'http' }, {
1847
+ in: 'cookie',
1848
+ name: '__Host-boxrouter_session',
1849
+ type: 'apiKey'
1850
+ }],
1851
+ url: '/credits/payment-method-setups/{setup_id}',
1852
+ ...options
1853
+ });
1854
+ }
1855
+ /**
1856
+ * Remove a saved workspace payment method
1857
+ *
1858
+ * Detaches a saved card. Another workspace's payment method is a 404. If the card
1859
+ * was the default, the next saved card becomes default; removing the last card
1860
+ * disables auto top-up with disabled_reason payment_method_required.
1861
+ *
1862
+ */
1863
+ deletePaymentMethod(options) {
1864
+ return (options.client ?? this.client).delete({
1865
+ responseStyle: 'data',
1866
+ security: [{ scheme: 'bearer', type: 'http' }, {
1867
+ in: 'cookie',
1868
+ name: '__Host-boxrouter_session',
1869
+ type: 'apiKey'
1870
+ }],
1871
+ url: '/credits/payment-methods/{payment_method_id}',
1872
+ ...options
1873
+ });
1874
+ }
1875
+ /**
1876
+ * Set the workspace's default saved card
1877
+ *
1878
+ * Makes this workspace-owned saved card the only default card. The first saved
1879
+ * card becomes default automatically. This local setting is used by one-click
1880
+ * purchases and auto top-up; repeating the request is safe. Another workspace's
1881
+ * card is a 404.
1882
+ *
1883
+ */
1884
+ setDefaultPaymentMethod(options) {
1885
+ return (options.client ?? this.client).post({
1886
+ responseStyle: 'data',
1887
+ security: [{ scheme: 'bearer', type: 'http' }, {
1888
+ in: 'cookie',
1889
+ name: '__Host-boxrouter_session',
1890
+ type: 'apiKey'
1891
+ }],
1892
+ url: '/credits/payment-methods/{payment_method_id}/default',
1893
+ ...options
1894
+ });
1895
+ }
1896
+ /**
1897
+ * Get automatic credit top-up settings
1898
+ *
1899
+ * Requires account-management permission. Auto top-up is off until explicitly enabled.
1900
+ */
1901
+ autoTopUp(options) {
1902
+ return (options?.client ?? this.client).get({
1903
+ responseStyle: 'data',
1904
+ security: [{ scheme: 'bearer', type: 'http' }, {
1905
+ in: 'cookie',
1906
+ name: '__Host-boxrouter_session',
1907
+ type: 'apiKey'
1908
+ }],
1909
+ url: '/credits/auto-top-up',
1910
+ ...options
1911
+ });
1912
+ }
1913
+ /**
1914
+ * Replace automatic credit top-up settings
1915
+ *
1916
+ * Stores the enabled state, trigger level and purchase amount. The amount must be
1917
+ * within current purchase_bounds_minor and the trigger level must be zero or greater.
1918
+ * Enabling requires a default saved card. Enabling with a trigger level above current
1919
+ * available credit evaluates and attempts one top-up immediately. An attempt is
1920
+ * made once per crossing below the trigger level and is never retried automatically. A
1921
+ * decline or required authentication disables auto top-up and records the reason.
1922
+ * Repeating the same settings is idempotent and does not start a second attempt for
1923
+ * the same balance crossing. After a 503 with outcome unknown, retry the identical
1924
+ * settings or GET the settings; inspect last_attempt.purchase_id and poll that
1925
+ * purchase to reconcile the original attempt.
1926
+ *
1927
+ */
1928
+ updateAutoTopUp(options) {
1929
+ return (options.client ?? this.client).put({
1930
+ responseStyle: 'data',
1931
+ security: [{ scheme: 'bearer', type: 'http' }, {
1932
+ in: 'cookie',
1933
+ name: '__Host-boxrouter_session',
1934
+ type: 'apiKey'
1935
+ }],
1936
+ url: '/credits/auto-top-up',
1937
+ ...options,
1938
+ headers: {
1939
+ 'Content-Type': 'application/json',
1940
+ ...options.headers
1941
+ }
1942
+ });
1943
+ }
1944
+ }
1945
+ exports.Credits = Credits;
1946
+ class SpendLimits extends HeyApiClient {
1947
+ /**
1948
+ * List managed-compute spend limits
1949
+ *
1950
+ * Requires account-management permission; execution keys receive 403. Returns the
1951
+ * workspace cap and every key's cap; a scope with no cap has `spend_limit: null`.
1952
+ * Each capped scope also carries `spent` so far in its current period, holds included:
1953
+ * `workspace_spent_nanodollars` for the workspace and `spent_nanodollars` per key.
1954
+ * Limits and usage are scoped to the configured test or live billing book. BYOK usage
1955
+ * is excluded.
1956
+ *
1957
+ */
1958
+ list(options) {
1959
+ return (options?.client ?? this.client).get({
1960
+ responseStyle: 'data',
1961
+ security: [{ scheme: 'bearer', type: 'http' }, {
1962
+ in: 'cookie',
1963
+ name: '__Host-boxrouter_session',
1964
+ type: 'apiKey'
1965
+ }],
1966
+ url: '/spend-limits',
1967
+ ...options
1968
+ });
1969
+ }
1970
+ /**
1971
+ * Clear a managed-compute spend cap
1972
+ *
1973
+ * Requires account-management permission. Removes the scope's cap. Clearing a scope
1974
+ * with no cap succeeds and returns `spend_limit: null`.
1975
+ *
1976
+ */
1977
+ clear(options) {
1978
+ return (options.client ?? this.client).delete({
1979
+ responseStyle: 'data',
1980
+ security: [{ scheme: 'bearer', type: 'http' }, {
1981
+ in: 'cookie',
1982
+ name: '__Host-boxrouter_session',
1983
+ type: 'apiKey'
1984
+ }],
1985
+ url: '/spend-limits/{scope}',
1986
+ ...options
1987
+ });
1988
+ }
1989
+ /**
1990
+ * Set a managed-compute spend cap
1991
+ *
1992
+ * Requires account-management permission. The cap applies to the scope's settled
1993
+ * managed charges and open managed holds. `limit_period` sets when it resets: `daily`
1994
+ * and `monthly` at 00:00 UTC (monthly on the first of the month), `total` never.
1995
+ * Replaces any cap the scope already has. BYOK usage is excluded.
1996
+ *
1997
+ */
1998
+ set(options) {
1999
+ return (options.client ?? this.client).put({
2000
+ responseStyle: 'data',
2001
+ security: [{ scheme: 'bearer', type: 'http' }, {
2002
+ in: 'cookie',
2003
+ name: '__Host-boxrouter_session',
2004
+ type: 'apiKey'
2005
+ }],
2006
+ url: '/spend-limits/{scope}',
2007
+ ...options,
2008
+ headers: {
2009
+ 'Content-Type': 'application/json',
2010
+ ...options.headers
2011
+ }
2012
+ });
2013
+ }
2014
+ }
2015
+ exports.SpendLimits = SpendLimits;
2016
+ class Usage extends HeyApiClient {
2017
+ /**
2018
+ * List grouped managed and BYOK sandbox usage
2019
+ *
2020
+ * Requires account-management permission; execution-only keys receive 403. Reads
2021
+ * only this workspace and the configured test or live billing book. Settled managed
2022
+ * charges come from verified ledger receipts and are recognized on their settlement
2023
+ * date. BYOK costs come from the provider's own cost or usage records priced at
2024
+ * stored list rates. byok_provider_cost_usd is that exact amount or null, never a
2025
+ * local-clock cost or partial subtotal. No BYOK fee is included because its price-book policy remains
2026
+ * proposed and unapproved. Current managed reservations are reported as held amounts;
2027
+ * with group_by=day they appear under period and group_key `current`, outside the
2028
+ * requested historical date range. Dates are inclusive UTC calendar dates and the
2029
+ * range may not exceed 92 days. Unknown observations remain null and are counted in
2030
+ * the corresponding unknown-sandbox field; a BYOK cost is null when any contributing
2031
+ * sandbox's provider cost is unknown. The optional provider filter is applied
2032
+ * before grouping to managed and BYOK history and to current managed holds. Cursors
2033
+ * are scoped to workspace, billing mode and all report filters; malformed or foreign
2034
+ * cursors return 400. No provider or
2035
+ * payment-provider calls are made.
2036
+ *
2037
+ */
2038
+ list(options) {
2039
+ return (options.client ?? this.client).get({
2040
+ responseStyle: 'data',
2041
+ security: [{ scheme: 'bearer', type: 'http' }, {
2042
+ in: 'cookie',
2043
+ name: '__Host-boxrouter_session',
2044
+ type: 'apiKey'
2045
+ }],
2046
+ url: '/usage',
2047
+ ...options
2048
+ });
2049
+ }
2050
+ /**
2051
+ * Export grouped managed and BYOK sandbox usage as CSV
2052
+ *
2053
+ * Uses the same workspace, billing mode, date range, filters and page as the JSON usage report. CSV values preserve the JSON report's exact decimal strings; `X-Usage-As-Of` identifies the observation time and `X-Next-Cursor` is present when another page exists.
2054
+ */
2055
+ exportCsv(options) {
2056
+ return (options.client ?? this.client).get({
2057
+ responseStyle: 'data',
2058
+ security: [{ scheme: 'bearer', type: 'http' }, {
2059
+ in: 'cookie',
2060
+ name: '__Host-boxrouter_session',
2061
+ type: 'apiKey'
2062
+ }],
2063
+ url: '/usage.csv',
2064
+ ...options
2065
+ });
2066
+ }
2067
+ }
2068
+ exports.Usage = Usage;
2069
+ class Terminals extends HeyApiClient {
2070
+ /**
2071
+ * Open a terminal
2072
+ *
2073
+ * Opens a real PTY running a Bash login shell on any active provider. A small
2074
+ * Python 3 helper in the guest owns the PTY, so the sandbox image must provide
2075
+ * `python3`. Opens once and returns a BoxRouter terminal handle; the shell ends at
2076
+ * `timeout_seconds`, on `kill`, when it exits, or with the sandbox. Terminal
2077
+ * connections and output expire on API worker loss; the durable open record still
2078
+ * prevents another dispatch. No automatic recovery or replay.
2079
+ *
2080
+ */
2081
+ open(options) {
2082
+ return (options.client ?? this.client).post({
2083
+ responseStyle: 'data',
2084
+ security: [{ scheme: 'bearer', type: 'http' }, {
2085
+ in: 'cookie',
2086
+ name: '__Host-boxrouter_session',
2087
+ type: 'apiKey'
2088
+ }],
2089
+ url: '/sandboxes/{sandbox_id}/terminals',
2090
+ ...options,
2091
+ headers: {
2092
+ 'Content-Type': 'application/json',
2093
+ ...options.headers
2094
+ }
2095
+ });
2096
+ }
2097
+ /**
2098
+ * Get observed terminal state
2099
+ *
2100
+ * Reads an owned terminal record without consuming output.
2101
+ */
2102
+ get(options) {
2103
+ return (options.client ?? this.client).get({
2104
+ responseStyle: 'data',
2105
+ security: [{ scheme: 'bearer', type: 'http' }, {
2106
+ in: 'cookie',
2107
+ name: '__Host-boxrouter_session',
2108
+ type: 'apiKey'
2109
+ }],
2110
+ url: '/sandboxes/{sandbox_id}/terminals/{terminal_id}',
2111
+ ...options
2112
+ });
2113
+ }
2114
+ /**
2115
+ * Stream terminal output and its end
2116
+ *
2117
+ * You can rely on:
2118
+ * - Input order is kept and output applies backpressure on PTY routes.
2119
+ * - Closing an observer does not by itself end the process.
2120
+ *
2121
+ * You can set: input, dimensions. Observation controls where supported.
2122
+ *
2123
+ * Not promised: unlimited concurrent observers.
2124
+ *
2125
+ * Server-sent events. Each data field contains one JSON TerminalEvent; the SSE id
2126
+ * is its sequence. Output events carry exact bytes as base64. An exit event follows
2127
+ * all output. An error event may arrive after HTTP 200 and ends the stream without
2128
+ * implying the shell stopped. EOF without an exit or error event is an incomplete
2129
+ * stream, not success.
2130
+ *
2131
+ * Output is retained in a 1 MiB sliding window until 60 seconds after the shell
2132
+ * ends. Last-Event-ID resumes after that event while it is retained; a dropped
2133
+ * sequence returns 410, or an error event for a reader that falls behind, and is
2134
+ * never skipped silently. Without Last-Event-ID the stream starts at the oldest
2135
+ * retained event.
2136
+ *
2137
+ */
2138
+ events(options) {
2139
+ return (0, eventValidation_1.withEventValidators)(({ signal: (options.client ?? this.client).getConfig().signal, ...options }).signal, eventValidators => (options.client ?? this.client).sse.get({
2140
+ responseStyle: 'data',
2141
+ security: [{ scheme: 'bearer', type: 'http' }, {
2142
+ in: 'cookie',
2143
+ name: '__Host-boxrouter_session',
2144
+ type: 'apiKey'
2145
+ }],
2146
+ url: '/sandboxes/{sandbox_id}/terminals/{terminal_id}/events',
2147
+ ...options,
2148
+ ...(0, eventValidation_1.validateEvent)("SandboxTerminalEventSSE", eventValidators.validate0, options.responseValidator ?? (options.client ?? this.client).getConfig().responseValidator, ["exit", "error"], void 0, ["error", "exit", "output"])
2149
+ }));
2150
+ }
2151
+ /**
2152
+ * Write terminal input
2153
+ *
2154
+ * You can rely on:
2155
+ * - Input order is kept and output applies backpressure on PTY routes.
2156
+ * - Closing an observer does not by itself end the process.
2157
+ *
2158
+ * You can set: input, dimensions. Observation controls where supported.
2159
+ *
2160
+ * Not promised: unlimited concurrent observers.
2161
+ *
2162
+ * Writes exact bytes to the PTY once. Await calls sequentially to preserve order.
2163
+ * Each call is one command round trip on the provider. An uncertain write must not
2164
+ * be replayed with a new key. Returns 409 after the shell has ended.
2165
+ *
2166
+ */
2167
+ write(options) {
2168
+ return (options.client ?? this.client).post({
2169
+ responseStyle: 'data',
2170
+ security: [{ scheme: 'bearer', type: 'http' }, {
2171
+ in: 'cookie',
2172
+ name: '__Host-boxrouter_session',
2173
+ type: 'apiKey'
2174
+ }],
2175
+ url: '/sandboxes/{sandbox_id}/terminals/{terminal_id}/input',
2176
+ ...options,
2177
+ headers: {
2178
+ 'Content-Type': 'application/json',
2179
+ ...options.headers
2180
+ }
2181
+ });
2182
+ }
2183
+ /**
2184
+ * Resize the terminal window
2185
+ *
2186
+ * You can rely on:
2187
+ * - Changes the terminal's window size, or is refused where the sandbox cannot resize an open terminal.
2188
+ *
2189
+ * You can set: columns, rows.
2190
+ *
2191
+ * Not promised: when the running program notices the new size.
2192
+ *
2193
+ * The foreground program receives SIGWINCH. Where the sandbox cannot resize an open
2194
+ * terminal, the refusal is `409 capability_unavailable`; open the terminal at the size
2195
+ * you need.
2196
+ *
2197
+ */
2198
+ resize(options) {
2199
+ return (options.client ?? this.client).post({
2200
+ responseStyle: 'data',
2201
+ security: [{ scheme: 'bearer', type: 'http' }, {
2202
+ in: 'cookie',
2203
+ name: '__Host-boxrouter_session',
2204
+ type: 'apiKey'
2205
+ }],
2206
+ url: '/sandboxes/{sandbox_id}/terminals/{terminal_id}/resize',
2207
+ ...options,
2208
+ headers: {
2209
+ 'Content-Type': 'application/json',
2210
+ ...options.headers
2211
+ }
2212
+ });
2213
+ }
2214
+ /**
2215
+ * Hang up the terminal without destroying its sandbox
2216
+ *
2217
+ * You can rely on:
2218
+ * - Ends the terminal's shell without destroying the sandbox, or is refused where the sandbox cannot end it from outside; ending a terminal that already ended succeeds until the terminal expires.
2219
+ *
2220
+ * Not promised: that the shell has already ended when the call returns (its exit event shows when it does); that the whole process group receives the hang-up.
2221
+ *
2222
+ * It sends a hang-up to the shell's process group where the provider allows that, and
2223
+ * otherwise ends the shell process. The terminal's exit event carries the shell's exit
2224
+ * code, or -1 when, after a kill, the provider ends the terminal without reporting one. Closing an
2225
+ * events connection never calls this. Where the sandbox cannot end a terminal's shell from
2226
+ * outside, the refusal is `409 capability_unavailable`; type `exit` in the terminal or
2227
+ * destroy the sandbox. A terminal expires 60 seconds after its shell ends: until then a
2228
+ * kill answers 204, afterwards `410 expired`.
2229
+ *
2230
+ */
2231
+ kill(options) {
2232
+ return (options.client ?? this.client).post({
2233
+ responseStyle: 'data',
2234
+ security: [{ scheme: 'bearer', type: 'http' }, {
2235
+ in: 'cookie',
2236
+ name: '__Host-boxrouter_session',
2237
+ type: 'apiKey'
2238
+ }],
2239
+ url: '/sandboxes/{sandbox_id}/terminals/{terminal_id}/kill',
2240
+ ...options
2241
+ });
2242
+ }
2243
+ }
2244
+ exports.Terminals = Terminals;
2245
+ class Secrets extends HeyApiClient {
2246
+ /**
2247
+ * List workspace secret names
2248
+ *
2249
+ * Requires `credentials:manage` on API keys; dashboard browser sessions are also
2250
+ * authorized. An execution key alone cannot administer workspace secrets. Lists
2251
+ * metadata only; secret values are never returned.
2252
+ *
2253
+ */
2254
+ list(options) {
2255
+ return (options?.client ?? this.client).get({
2256
+ responseStyle: 'data',
2257
+ security: [{ scheme: 'bearer', type: 'http' }, {
2258
+ in: 'cookie',
2259
+ name: '__Host-boxrouter_session',
2260
+ type: 'apiKey'
2261
+ }],
2262
+ url: '/secrets',
2263
+ ...options
2264
+ });
2265
+ }
2266
+ /**
2267
+ * Delete a workspace secret
2268
+ *
2269
+ * Requires `credentials:manage` on API keys; dashboard browser sessions are also
2270
+ * authorized. An execution key alone cannot administer workspace secrets. Remove the
2271
+ * named workspace secret and return no secret data.
2272
+ *
2273
+ */
2274
+ delete(options) {
2275
+ return (options.client ?? this.client).delete({
2276
+ responseStyle: 'data',
2277
+ security: [{ scheme: 'bearer', type: 'http' }, {
2278
+ in: 'cookie',
2279
+ name: '__Host-boxrouter_session',
2280
+ type: 'apiKey'
2281
+ }],
2282
+ url: '/secrets/{name}',
2283
+ ...options
2284
+ });
2285
+ }
2286
+ /**
2287
+ * Store a workspace secret
2288
+ *
2289
+ * Requires `credentials:manage` on API keys; dashboard browser sessions are also
2290
+ * authorized. An execution key alone cannot administer workspace secrets. Create or
2291
+ * replace a workspace-scoped secret. The value is accepted only in this request body;
2292
+ * it is never returned by this or any secret listing operation.
2293
+ *
2294
+ */
2295
+ put(options) {
2296
+ return (options.client ?? this.client).put({
2297
+ responseStyle: 'data',
2298
+ security: [{ scheme: 'bearer', type: 'http' }, {
2299
+ in: 'cookie',
2300
+ name: '__Host-boxrouter_session',
2301
+ type: 'apiKey'
2302
+ }],
2303
+ url: '/secrets/{name}',
2304
+ ...options,
2305
+ headers: {
2306
+ 'Content-Type': 'application/json',
2307
+ ...options.headers
2308
+ }
2309
+ });
2310
+ }
2311
+ }
2312
+ exports.Secrets = Secrets;
2313
+ class Previews extends HeyApiClient {
2314
+ /**
2315
+ * List a sandbox's open previews
2316
+ *
2317
+ * You can rely on:
2318
+ * - Lists the previews this sandbox has open, as recorded when they were opened; a resume forgets them, so the list is empty until one is opened again.
2319
+ *
2320
+ * You can set: cursor, limit.
2321
+ *
2322
+ * Not promised: that a listed preview still works.
2323
+ *
2324
+ * Records only: this call observes no provider.
2325
+ *
2326
+ */
2327
+ list(options) {
2328
+ return (options.client ?? this.client).get({
2329
+ responseStyle: 'data',
2330
+ security: [{ scheme: 'bearer', type: 'http' }, {
2331
+ in: 'cookie',
2332
+ name: '__Host-boxrouter_session',
2333
+ type: 'apiKey'
2334
+ }],
2335
+ url: '/sandboxes/{sandbox_id}/previews',
2336
+ ...options
2337
+ });
2338
+ }
2339
+ /**
2340
+ * Get a URL for a sandbox port
2341
+ *
2342
+ * You can rely on:
2343
+ * - A private preview never falls back to a public link, and a requested credential form never falls back to the other; a mode the sandbox cannot enforce is refused. A route whose declaration cannot enforce the mode is refused before anything is opened; a weaker preview a route does open is ended before the refusal, or the refusal says it may still be reachable and names its port and id.
2344
+ * - Opening a port that already has a preview with the same access returns that preview instead of opening a second one.
2345
+ *
2346
+ * You can set: port, access, credential.
2347
+ *
2348
+ * Not promised: that an application is listening on the port; an expiry time unless one is enforced.
2349
+ *
2350
+ * Returns an HTTPS URL for one port in the sandbox and, when the link is private, where its
2351
+ * credential is carried. The sandbox must have been created with the `previews`
2352
+ * requirement naming that port and the access you ask for.
2353
+ *
2354
+ * 404 means the sandbox does not exist in this workspace. A sandbox that exists but
2355
+ * was not created through this API is refused with `409 invalid_state`; one that has
2356
+ * ended answers `410 sandbox_ended`.
2357
+ *
2358
+ * A preview is never returned with other access than the request asked for. When the
2359
+ * provider answers with one (for example a public link for a private request), the call
2360
+ * is refused with `502 preview_access_refused` and the unwanted preview is ended where
2361
+ * the provider allows. `details.port` names the port. `details.revoked` is true when it
2362
+ * was ended and no access remains. When it could not be ended the outcome is `unknown`,
2363
+ * the message says the preview may still be reachable, and `details.preview_id` and
2364
+ * `details.url` name a public one (a private preview's address holds a credential and is
2365
+ * never repeated). The operation stays open for reconciliation: do not send the call
2366
+ * again; end the sandbox to be certain no access remains.
2367
+ *
2368
+ */
2369
+ open(options) {
2370
+ return (options.client ?? this.client).post({
2371
+ responseStyle: 'data',
2372
+ security: [{ scheme: 'bearer', type: 'http' }, {
2373
+ in: 'cookie',
2374
+ name: '__Host-boxrouter_session',
2375
+ type: 'apiKey'
2376
+ }],
2377
+ url: '/sandboxes/{sandbox_id}/previews',
2378
+ ...options,
2379
+ headers: {
2380
+ 'Content-Type': 'application/json',
2381
+ ...options.headers
2382
+ }
2383
+ });
2384
+ }
2385
+ /**
2386
+ * Revoke a preview
2387
+ *
2388
+ * You can rely on:
2389
+ * - Access through the named preview ends while the sandbox and its other previews keep running; revoking a preview that already ended succeeds.
2390
+ *
2391
+ * You can set: preview id.
2392
+ *
2393
+ * Ends a preview, named by the ID that opening it returned. The sandbox must have been created
2394
+ * with `previews.revocable` set to `true`; otherwise the call fails with `not_named`, and `fix`
2395
+ * shows the requirement to send. A sandbox that is not running fails with `not_running`, even
2396
+ * if the preview has already ended. Otherwise, ending a preview that has already ended answers
2397
+ * `204`.
2398
+ *
2399
+ */
2400
+ revoke(options) {
2401
+ return (options.client ?? this.client).delete({
2402
+ responseStyle: 'data',
2403
+ security: [{ scheme: 'bearer', type: 'http' }, {
2404
+ in: 'cookie',
2405
+ name: '__Host-boxrouter_session',
2406
+ type: 'apiKey'
2407
+ }],
2408
+ url: '/sandboxes/{sandbox_id}/previews/{preview_id}',
2409
+ ...options
2410
+ });
2411
+ }
2412
+ }
2413
+ exports.Previews = Previews;
2414
+ class Sandboxes extends HeyApiClient {
2415
+ /**
2416
+ * Prove a headless Chromium in the sandbox
2417
+ *
2418
+ * You can rely on:
2419
+ * - Returns only the automation channels that loaded a page served inside the sandbox; when none does, the call is refused.
2420
+ *
2421
+ * Not promised: installing a browser in the sandbox.
2422
+ *
2423
+ * Loads a page from a server inside the guest in the image's own headless Chromium
2424
+ * and reads the CDP endpoint: Playwright and CDP on glibc images, CDP on Alpine.
2425
+ * Create the sandbox from an image with Python 3 and Playwright with Chromium (or a
2426
+ * Chromium binary); BoxRouter's standard image has neither. An image without them, or a sandbox
2427
+ * where no channel passes, such as one with too little memory, is refused with
2428
+ * `422 unsupported_feature`. Afterwards run browser scripts through commands or processes.
2429
+ *
2430
+ */
2431
+ browser(options) {
2432
+ return (options.client ?? this.client).post({
2433
+ responseStyle: 'data',
2434
+ security: [{ scheme: 'bearer', type: 'http' }, {
2435
+ in: 'cookie',
2436
+ name: '__Host-boxrouter_session',
2437
+ type: 'apiKey'
2438
+ }],
2439
+ url: '/sandboxes/{sandbox_id}/browser',
2440
+ ...options
2441
+ });
2442
+ }
2443
+ /**
2444
+ * Pause a sandbox and keep it
2445
+ *
2446
+ * You can rely on:
2447
+ * - On return the sandbox is paused, and the result says whether running processes are kept or only files.
2448
+ * - The remaining lifetime budget is preserved.
2449
+ *
2450
+ * You can set: lifetime.
2451
+ *
2452
+ * Stops compute and keeps the sandbox where it is. The sandbox must have been created with
2453
+ * the `pause_resume` requirement. The result says what was kept (running processes, or
2454
+ * only files) and how much lifetime remains. Resume the sandbox before doing more work in it.
2455
+ *
2456
+ * 404 means the sandbox does not exist in this workspace. A sandbox that exists but
2457
+ * was not created through this API is refused with `409 invalid_state`; one that has
2458
+ * ended answers `410 sandbox_ended`.
2459
+ *
2460
+ */
2461
+ pause(options) {
2462
+ return (options.client ?? this.client).post({
2463
+ responseStyle: 'data',
2464
+ security: [{ scheme: 'bearer', type: 'http' }, {
2465
+ in: 'cookie',
2466
+ name: '__Host-boxrouter_session',
2467
+ type: 'apiKey'
2468
+ }],
2469
+ url: '/sandboxes/{sandbox_id}/pause',
2470
+ ...options
2471
+ });
2472
+ }
2473
+ /**
2474
+ * Resume the same paused sandbox
2475
+ *
2476
+ * You can rely on:
2477
+ * - Resumes the same sandbox on its original provider and account, never a replacement.
2478
+ * - On return the sandbox is running, and the result says whether processes from before the pause were lost.
2479
+ * - The sandbox runs on with the lifetime budget it had left; resume takes no new budget.
2480
+ * - Resuming a sandbox that is already running succeeds and changes nothing, so a retry is safe.
2481
+ *
2482
+ * Not promised: that previews opened before the pause still work.
2483
+ *
2484
+ * Starts a paused or stopped sandbox again and returns its remaining lifetime. Resume takes
2485
+ * no fields: send no body or `{}`, and any other field fails with `400 invalid_request`. To
2486
+ * change how long the sandbox may run, extend its lifetime, which works while it is running,
2487
+ * paused or stopped.
2488
+ *
2489
+ * Resuming a sandbox that is already running changes nothing, so you can safely send the call
2490
+ * again. 404 means the sandbox does not exist in this workspace. A sandbox that cannot be
2491
+ * resumed fails with 409: `invalid_state` while it is being created or destroyed, or when it
2492
+ * was not created through this API; `lifetime_used_up` when its lifetime is spent (extend it,
2493
+ * then resume); `volume_lease_lost` or `volume_busy` when its Volume cannot follow. A sandbox
2494
+ * that has ended answers `410 sandbox_ended`.
2495
+ *
2496
+ * Those refusals happen before anything is resumed and report `outcome: not_started`. If the
2497
+ * provider resumed the sandbox and a later step failed, the outcome is never `not_started`:
2498
+ * `502 volume_restore_failed` (the sandbox restarted without its Volume mounted) reports
2499
+ * `outcome: partial` with an `operation_id`, and the sandbox is running without its Volume.
2500
+ * Do not send the resume again; destroy the sandbox and create a new one with the Volume
2501
+ * attached. A lifetime failure after the resume reports `outcome: unknown`; read the operation
2502
+ * before acting.
2503
+ *
2504
+ */
2505
+ resume(options) {
2506
+ return (options.client ?? this.client).post({
2507
+ responseStyle: 'data',
2508
+ security: [{ scheme: 'bearer', type: 'http' }, {
2509
+ in: 'cookie',
2510
+ name: '__Host-boxrouter_session',
2511
+ type: 'apiKey'
2512
+ }],
2513
+ url: '/sandboxes/{sandbox_id}/resume',
2514
+ ...options,
2515
+ headers: {
2516
+ 'Content-Type': 'application/json',
2517
+ ...options.headers
2518
+ }
2519
+ });
2520
+ }
2521
+ /**
2522
+ * Extend a sandbox lifetime
2523
+ *
2524
+ * You can rely on:
2525
+ * - The value is the new total running-time budget, not an increment, so sending it again is safe; a budget shorter than the current one or than the running time already used is refused. On success the sandbox may run for at least the requested total; extending a paused or stopped sandbox sets the budget it resumes with.
2526
+ *
2527
+ * You can set: lifetime_seconds.
2528
+ *
2529
+ * Not promised: that the sandbox ends exactly when the budget runs out.
2530
+ *
2531
+ * Refused with not_named unless the creation request asked for resources.extendable_lifetime. It is
2532
+ * not a re-match: the only check is the route's max_lifetime_seconds for this account,
2533
+ * against the current run, and over it the answer is lifetime_limit. Allowed while
2534
+ * running, paused or stopped: a paused or stopped sandbox resumes with the new budget.
2535
+ * A total shorter than the current budget is invalid_request (400); a total below the
2536
+ * running time already used is lifetime_limit (409).
2537
+ *
2538
+ * 404 means the sandbox does not exist in this workspace. A sandbox that exists but
2539
+ * was not created through this API is refused with `409 invalid_state`; one that has
2540
+ * ended answers `410 sandbox_ended`.
2541
+ *
2542
+ */
2543
+ extend(options) {
2544
+ return (options.client ?? this.client).post({
2545
+ responseStyle: 'data',
2546
+ security: [{ scheme: 'bearer', type: 'http' }, {
2547
+ in: 'cookie',
2548
+ name: '__Host-boxrouter_session',
2549
+ type: 'apiKey'
2550
+ }],
2551
+ url: '/sandboxes/{sandbox_id}/lifetime',
2552
+ ...options,
2553
+ headers: {
2554
+ 'Content-Type': 'application/json',
2555
+ ...options.headers
2556
+ }
2557
+ });
2558
+ }
2559
+ /**
2560
+ * Change a running sandbox's outbound network policy
2561
+ *
2562
+ * You can rely on:
2563
+ * - Connections opened after the call returns follow the new policy, and the sandbox keeps its processes and files.
2564
+ * - An uncertain outcome is never resent.
2565
+ *
2566
+ * You can set: policy, allow, deny.
2567
+ *
2568
+ * Not promised: that connections already open when the call returns are closed; name lookups and DNS traffic.
2569
+ *
2570
+ * Switches the sandbox's outbound network policy, or changes its entries. Each call starts
2571
+ * from the policy the sandbox has now: the last one this call applied, or else the one named
2572
+ * when the sandbox was created (`open` if it named none).
2573
+ *
2574
+ * The sandbox must have been created with the `network_lockdown` requirement naming the
2575
+ * settings the change needs. Otherwise the call fails with `not_named`, and `fix` shows the
2576
+ * requirement to send:
2577
+ *
2578
+ * - Switching to a different policy needs `switchable`, and the target policy listed in
2579
+ * `switches_to` unless it is the policy the sandbox was created with. Switching back to the
2580
+ * created policy with different entries also needs `changeable`.
2581
+ * - Changing the entries of the current policy needs `changeable`, even when the entries are
2582
+ * the same. After one switch, a further call that names the new policy needs `changeable`.
2583
+ * - Deny entries on an allowlist need `deny_wins`, and an HTTP rule among the entries needs
2584
+ * `http_rules`.
2585
+ *
2586
+ * `422 unsupported_feature` with outcome `not_started` means the route cannot switch policies.
2587
+ *
2588
+ */
2589
+ updateNetworkPolicy(options) {
2590
+ return (options.client ?? this.client).post({
2591
+ responseStyle: 'data',
2592
+ security: [{ scheme: 'bearer', type: 'http' }, {
2593
+ in: 'cookie',
2594
+ name: '__Host-boxrouter_session',
2595
+ type: 'apiKey'
2596
+ }],
2597
+ url: '/sandboxes/{sandbox_id}/network-policy',
2598
+ ...options,
2599
+ headers: {
2600
+ 'Content-Type': 'application/json',
2601
+ ...options.headers
2602
+ }
2603
+ });
2604
+ }
2605
+ /**
2606
+ * List workspace sandboxes
2607
+ *
2608
+ * You can rely on:
2609
+ * - Lists only the workspace's own sandboxes, each with its latest recorded state.
2610
+ * - A label filter matches exactly: only sandboxes carrying every requested label are listed.
2611
+ *
2612
+ * You can set: filters, sort, cursor, limit.
2613
+ *
2614
+ * Not promised: a fresh observation of each sandbox from its provider.
2615
+ *
2616
+ * Lists your workspace's sandboxes from BoxRouter's records, without asking providers. `state`
2617
+ * is the latest state BoxRouter recorded, or `unknown` if it recorded none; get one sandbox to
2618
+ * check its provider live. `observed_at` is when the list was read, and `state_recorded_at` is
2619
+ * when that state was recorded, which can be earlier.
2620
+ *
2621
+ * `lifecycle` defaults to `all`; send `lifecycle=live` to list only live sandboxes, or `ended` for
2622
+ * the rest. You can repeat the `state` and `provider` parameters to match any
2623
+ * of several values; repeated `label` parameters must all match. Unknown query parameters fail the request. The page counts apply every
2624
+ * filter except `lifecycle`, and `by_state` also ignores `state`, so you can show counts while
2625
+ * changing those two filters. `source` filters by what created the sandbox, and a sandbox's
2626
+ * origin stays readable after it ends or is removed.
2627
+ *
2628
+ */
2629
+ list(options) {
2630
+ return (options?.client ?? this.client).get({
2631
+ responseStyle: 'data',
2632
+ security: [{ scheme: 'bearer', type: 'http' }, {
2633
+ in: 'cookie',
2634
+ name: '__Host-boxrouter_session',
2635
+ type: 'apiKey'
2636
+ }],
2637
+ url: '/sandboxes',
2638
+ ...options
2639
+ });
2640
+ }
2641
+ /**
2642
+ * Create a sandbox
2643
+ *
2644
+ * **create (standard image)**
2645
+ *
2646
+ * You can rely on:
2647
+ * - Sandboxes are created from the requested image.
2648
+ *
2649
+ * You can set: image, lifetime, requirements.
2650
+ *
2651
+ * **volume mount**
2652
+ *
2653
+ * You can rely on:
2654
+ * - The named checkpoint, or the head when none is named, is restored into the mount folder, replacing what the image has there; an empty volume restores nothing.
2655
+ *
2656
+ * You can set: volume.
2657
+ *
2658
+ * Not promised: mounting a provider's own volumes.
2659
+ *
2660
+ * Creates a sandbox and returns it once it is ready to run commands. Send `{}`, or no
2661
+ * body, for the default: the standard image on the best eligible route, running for up
2662
+ * to 300 seconds. A credit-funded sandbox on a route that can extend a lifetime runs
2663
+ * instead for as long as your credit balance covers it when you leave out
2664
+ * `lifetime_seconds`; `funded_until` on the sandbox says how far it is funded.
2665
+ *
2666
+ * Describe what you need and BoxRouter picks a route that meets all of it:
2667
+ *
2668
+ * - `requirements`: capabilities such as `pause_resume`, `previews` or
2669
+ * `network_lockdown`, each with the settings you need.
2670
+ * - `resources`: minimum CPU and memory, and a region.
2671
+ * - `lifetime_seconds` and `at_end`: how long the sandbox may run, and whether it is
2672
+ * destroyed or paused afterward.
2673
+ * - `preferences`: how to choose among eligible routes (`sort`, `only`, `ignore`,
2674
+ * `order`, `allow_fallbacks`).
2675
+ * - `volume`: a Volume to mount, optionally at a checkpoint.
2676
+ * - `secret_refs`: saved workspace secrets to add to the environment.
2677
+ *
2678
+ * BoxRouter never relaxes a requirement to find a cheaper or faster route. If no route
2679
+ * can meet the request, the call fails with `409 no_eligible_route`, `details` names each
2680
+ * route that was ruled out and the nearest changes, and nothing is created. A field that
2681
+ * BoxRouter does not recognize fails with `400 invalid_request`; it is never ignored.
2682
+ * Choosing a connected account or route whose provider is not enabled for you fails with
2683
+ * `409 provider_not_enabled` before any route is considered. The response records the
2684
+ * contract the sandbox was created under and why its route was chosen.
2685
+ *
2686
+ * A created sandbox does not mean your application is listening on a port yet. If the
2687
+ * outcome of a create is unclear, BoxRouter does not retry it or move to another
2688
+ * provider; read the operation named by `operation_id` to find out what happened.
2689
+ *
2690
+ * A `volume` has one writer at a time. If its previous writer is ending (its destroy
2691
+ * was accepted, or cleanup of its access is pending), this call waits for the
2692
+ * release, at most 120 seconds, and then creates the sandbox, so you need no polling or
2693
+ * retry. If the release does not finish in that time, or the writer is still running,
2694
+ * the call fails with `409 volume_busy`, outcome `not_started`, and
2695
+ * `details.writer_sandbox_id` names the writer. A running writer fails at once.
2696
+ *
2697
+ */
2698
+ create(options) {
2699
+ return (options?.client ?? this.client).post({
2700
+ responseStyle: 'data',
2701
+ security: [{ scheme: 'bearer', type: 'http' }, {
2702
+ in: 'cookie',
2703
+ name: '__Host-boxrouter_session',
2704
+ type: 'apiKey'
2705
+ }],
2706
+ url: '/sandboxes',
2707
+ ...options,
2708
+ headers: {
2709
+ 'Content-Type': 'application/json',
2710
+ ...options?.headers
2711
+ }
2712
+ });
2713
+ }
2714
+ /**
2715
+ * Explain routing without creating
2716
+ *
2717
+ * You can rely on:
2718
+ * - Evaluates the body exactly as create would and returns the routes create would try, in order, without provisioning, reserving or recording anything.
2719
+ *
2720
+ * You can set: creation body.
2721
+ *
2722
+ * Not promised: that a later create finds the same routes eligible.
2723
+ *
2724
+ * Each eligible route carries the contract it would grant, every excluded route the
2725
+ * checks it failed, and the nearest changes are listed; a later creation checks again.
2726
+ * A workspace with nothing to match against, that is no provider keys and no credits,
2727
+ * or a `preferences.only` pin on a provider the workspace has not connected, answers 409 no_eligible_route with the same fix
2728
+ * POST /sandboxes gives, because a dry run answers what the creation it stands for
2729
+ * would.
2730
+ *
2731
+ */
2732
+ match(options) {
2733
+ return (options?.client ?? this.client).post({
2734
+ responseStyle: 'data',
2735
+ security: [{ scheme: 'bearer', type: 'http' }, {
2736
+ in: 'cookie',
2737
+ name: '__Host-boxrouter_session',
2738
+ type: 'apiKey'
2739
+ }],
2740
+ url: '/sandboxes/match',
2741
+ ...options,
2742
+ headers: {
2743
+ 'Content-Type': 'application/json',
2744
+ ...options?.headers
2745
+ }
2746
+ });
2747
+ }
2748
+ /**
2749
+ * Destroy a sandbox
2750
+ *
2751
+ * You can rely on:
2752
+ * - Never deletes another generation of the sandbox.
2753
+ * - Returns once accepted: 204 when confirmed, else 202 with an operation that completes lifecycle work; GET /operations/{id} reports completion.
2754
+ * - While a destroy is unresolved, a repeated destroy is accepted as the same pending operation and makes no second provider call; once the destroy is confirmed, a repeat returns 204 with no body.
2755
+ *
2756
+ * You can set: nothing.
2757
+ *
2758
+ * Not promised: how long teardown takes; that the sandbox is already absent from listings on return.
2759
+ *
2760
+ * Requests destruction on the original upstream account, including persistent sandbox
2761
+ * storage where the provider's destroy operation removes it. Separately owned volumes
2762
+ * are not deleted. DELETE returns once the provider accepts the destroy, always as 202
2763
+ * with the sandbox: `state` is `destroyed` when the provider confirmed within the request
2764
+ * and `destroying` while lifecycle work remains, and `operation_id` is set while work
2765
+ * remains. BoxRouter finishes an accepted destroy without the caller. GET
2766
+ * /operations/{operation_id} reports the operation's outcome; for an accepted destroy this
2767
+ * includes any remaining stop, final usage, and deletion work.
2768
+ *
2769
+ * A repeat DELETE while destruction is unresolved returns 202 with the existing
2770
+ * operation_id and makes no second provider call. Once destruction is confirmed,
2771
+ * repeat DELETEs return 202 with the destroyed sandbox and no `operation_id`. Unknown or
2772
+ * unowned sandbox IDs return 404.
2773
+ *
2774
+ */
2775
+ destroy(options) {
2776
+ return (options.client ?? this.client).delete({
2777
+ responseStyle: 'data',
2778
+ security: [{ scheme: 'bearer', type: 'http' }, {
2779
+ in: 'cookie',
2780
+ name: '__Host-boxrouter_session',
2781
+ type: 'apiKey'
2782
+ }],
2783
+ url: '/sandboxes/{sandbox_id}',
2784
+ ...options
2785
+ });
2786
+ }
2787
+ /**
2788
+ * Get a sandbox
2789
+ *
2790
+ * You can rely on:
2791
+ * - Returns a handle for the id, or not_found.
2792
+ *
2793
+ * You can set: sandbox id.
2794
+ *
2795
+ * Returns the sandbox with its current state, checked with the provider, without resuming it.
2796
+ * `observed_at` is when the provider was checked. `state_recorded_at` is when BoxRouter last
2797
+ * recorded the state it returns; it is null if a concurrent change replaced the state during
2798
+ * the read. `origin` says what created the sandbox and stays readable after the sandbox ends or
2799
+ * is removed, even when the provider can no longer be checked.
2800
+ *
2801
+ */
2802
+ get(options) {
2803
+ return (options.client ?? this.client).get({
2804
+ responseStyle: 'data',
2805
+ security: [{ scheme: 'bearer', type: 'http' }, {
2806
+ in: 'cookie',
2807
+ name: '__Host-boxrouter_session',
2808
+ type: 'apiKey'
2809
+ }],
2810
+ url: '/sandboxes/{sandbox_id}',
2811
+ ...options
2812
+ });
2813
+ }
2814
+ }
2815
+ exports.Sandboxes = Sandboxes;
2816
+ class ProviderAccounts extends HeyApiClient {
2817
+ /**
2818
+ * List connected accounts
2819
+ *
2820
+ * Requires `provider-accounts:manage` on API keys; dashboard browser sessions are also
2821
+ * authorized. Returns your workspace's account metadata and the list of providers enabled for you;
2822
+ * it never returns stored credentials.
2823
+ *
2824
+ */
2825
+ list(options) {
2826
+ return (options?.client ?? this.client).get({
2827
+ responseStyle: 'data',
2828
+ security: [{ scheme: 'bearer', type: 'http' }, {
2829
+ in: 'cookie',
2830
+ name: '__Host-boxrouter_session',
2831
+ type: 'apiKey'
2832
+ }],
2833
+ url: '/provider-accounts',
2834
+ ...options
2835
+ });
2836
+ }
2837
+ /**
2838
+ * Connect a provider account
2839
+ *
2840
+ * Saves your own provider credentials so BoxRouter can run sandboxes on that account. Needs
2841
+ * the `provider-accounts:manage` permission on the API key; a signed-in dashboard session also
2842
+ * works. This permission is separate from the access that creates sandboxes.
2843
+ *
2844
+ * BoxRouter first makes one read-only request to the provider with the credentials. A clear
2845
+ * rejection fails with `422 credentials_rejected`; an unreachable provider or an inconclusive
2846
+ * answer does not block the save. The credentials are then stored encrypted and never
2847
+ * returned. The account is enabled at once. Connecting starts no sandbox and prepares
2848
+ * nothing in your provider account: the first sandbox that needs the standard image
2849
+ * prepares it, or run the standard image setup to prepare it now.
2850
+ *
2851
+ * If the key matches one you already connected (same provider, settings and last four
2852
+ * characters), the account is still connected and the response carries a
2853
+ * `duplicate_credential` warning naming the other account. Connecting or testing an account
2854
+ * whose provider is not enabled for you fails with `409 provider_not_enabled`.
2855
+ *
2856
+ * Provider connection settings, such as a custom URL or proxy, and credentials that run your
2857
+ * code need extra authority on the key. Submitting a URL or proxy does not by itself give
2858
+ * BoxRouter network access to that host. For credentials that run your code, send the ID of an
2859
+ * artifact you uploaded; an unknown or expired artifact fails with `404`. The response
2860
+ * returns account metadata only, never the code, configuration or tokens. Sending the same
2861
+ * request again reuses the recorded outcome, and a request still waiting on the provider
2862
+ * fails with `409` instead of running your code a second time.
2863
+ *
2864
+ * If the provider later answers with `401` or `403`, the account's status becomes
2865
+ * `credentials_rejected`; the status carries a safe cause and the action that restores access.
2866
+ *
2867
+ */
2868
+ connect(options) {
2869
+ return (options.client ?? this.client).post({
2870
+ responseStyle: 'data',
2871
+ security: [{ scheme: 'bearer', type: 'http' }, {
2872
+ in: 'cookie',
2873
+ name: '__Host-boxrouter_session',
2874
+ type: 'apiKey'
2875
+ }],
2876
+ url: '/provider-accounts',
2877
+ ...options,
2878
+ headers: {
2879
+ 'Content-Type': 'application/json',
2880
+ ...options.headers
2881
+ }
2882
+ });
2883
+ }
2884
+ /**
2885
+ * Test provider credentials without saving them
2886
+ *
2887
+ * Checks credentials without saving them. Needs the `provider-accounts:manage` permission on
2888
+ * the API key; a signed-in dashboard session also works. BoxRouter makes the same read-only
2889
+ * request to the provider as when it tests a saved account, using the credentials in the body.
2890
+ * Nothing is stored and no account is created or changed, so no idempotency key is needed.
2891
+ *
2892
+ * Credentials that run your code are not accepted here. Connection settings, such as a custom
2893
+ * URL, are accepted and choose where the request goes; they need extra authority on the key,
2894
+ * and submitting a URL or proxy does not by itself give BoxRouter network access to that host.
2895
+ * The response returns the provider's own status and body, up to 4096 characters, without
2896
+ * adding a validation message.
2897
+ *
2898
+ * Fails with `409 provider_not_enabled` when this provider is not enabled for you.
2899
+ *
2900
+ */
2901
+ testCredentials(options) {
2902
+ return (options.client ?? this.client).post({
2903
+ responseStyle: 'data',
2904
+ security: [{ scheme: 'bearer', type: 'http' }, {
2905
+ in: 'cookie',
2906
+ name: '__Host-boxrouter_session',
2907
+ type: 'apiKey'
2908
+ }],
2909
+ url: '/provider-accounts/test',
2910
+ ...options,
2911
+ headers: {
2912
+ 'Content-Type': 'application/json',
2913
+ ...options.headers
2914
+ }
2915
+ });
2916
+ }
2917
+ /**
2918
+ * Remove a connected account
2919
+ *
2920
+ * Requires `provider-accounts:manage` on API keys; dashboard browser sessions are also
2921
+ * authorized. Reject with 409 while owned
2922
+ * resources, pending mutations or unresolved cleanup still depend on this
2923
+ * credential. Never orphan sandboxes silently or transfer them to managed
2924
+ * billing. Removes the stored secret; does not revoke the upstream token.
2925
+ * For callable credentials, close all unreferenced factory workers and remove
2926
+ * their retained code/configuration and acquired secrets. Pending acquisitions
2927
+ * and retained credential-version dependencies also prevent disconnection.
2928
+ *
2929
+ * Removal waits for work already running on the account (standard-image setup,
2930
+ * Actions runner-image checks), which can take minutes. With `wait=false` the
2931
+ * request returns 202 at once with the account and `disconnect.state:
2932
+ * disconnecting`, and finishes in the background: read the account until it
2933
+ * returns 404 (removed) or `disconnect.state: failed`, whose `error` is the
2934
+ * refusal this request would otherwise have returned, with the account still
2935
+ * connected. Repeating the request while a removal runs returns the same 202 and
2936
+ * starts nothing new.
2937
+ *
2938
+ */
2939
+ disconnect(options) {
2940
+ return (options.client ?? this.client).delete({
2941
+ responseStyle: 'data',
2942
+ security: [{ scheme: 'bearer', type: 'http' }, {
2943
+ in: 'cookie',
2944
+ name: '__Host-boxrouter_session',
2945
+ type: 'apiKey'
2946
+ }],
2947
+ url: '/provider-accounts/{account_id}',
2948
+ ...options
2949
+ });
2950
+ }
2951
+ /**
2952
+ * Get connected-account metadata
2953
+ *
2954
+ * Requires `provider-accounts:manage` on API keys; dashboard browser sessions are also
2955
+ * authorized. The account must be visible within the caller's workspace. Never reveals
2956
+ * key material.
2957
+ *
2958
+ */
2959
+ get(options) {
2960
+ return (options.client ?? this.client).get({
2961
+ responseStyle: 'data',
2962
+ security: [{ scheme: 'bearer', type: 'http' }, {
2963
+ in: 'cookie',
2964
+ name: '__Host-boxrouter_session',
2965
+ type: 'apiKey'
2966
+ }],
2967
+ url: '/provider-accounts/{account_id}',
2968
+ ...options
2969
+ });
2970
+ }
2971
+ /**
2972
+ * Rotate a connected account's credentials
2973
+ *
2974
+ * Replaces a connected account's credentials, for example to rotate a key. Needs the
2975
+ * `provider-accounts:manage` permission on the API key (a signed-in dashboard session also
2976
+ * works) and the account's current `expected_version`.
2977
+ *
2978
+ * The new credentials must belong to the same provider. BoxRouter makes one read-only request
2979
+ * to the provider and refuses a clear rejection with `422 credentials_rejected`; it does not
2980
+ * check which account the key belongs to. Requests already running keep the old credentials,
2981
+ * and requests that start afterward use the new ones. A provider that is not enabled for you
2982
+ * fails with `409 provider_not_enabled`.
2983
+ *
2984
+ * Leave out the connection settings to keep the existing ones. Settings you send must match the
2985
+ * existing route; changing the endpoint, proxy or header identity needs a new connected
2986
+ * account, not a key rotation. Credentials that run your code need extra authority on the key
2987
+ * and an artifact you uploaded. If the new credentials fail to activate, the old version stays
2988
+ * in use. A token refresh that already happened with the provider is not undone.
2989
+ *
2990
+ */
2991
+ replaceCredentials(options) {
2992
+ return (options.client ?? this.client).put({
2993
+ responseStyle: 'data',
2994
+ security: [{ scheme: 'bearer', type: 'http' }, {
2995
+ in: 'cookie',
2996
+ name: '__Host-boxrouter_session',
2997
+ type: 'apiKey'
2998
+ }],
2999
+ url: '/provider-accounts/{account_id}/credentials',
3000
+ ...options,
3001
+ headers: {
3002
+ 'Content-Type': 'application/json',
3003
+ ...options.headers
3004
+ }
3005
+ });
3006
+ }
3007
+ /**
3008
+ * Test a saved provider account
3009
+ *
3010
+ * Requires `provider-accounts:manage` on API keys; dashboard browser sessions are also
3011
+ * authorized. The credential check makes one read-only provider request using the saved
3012
+ * credentials and returns the provider's native status and body, limited to 4096 characters.
3013
+ * A successful test can update account health and register provider event webhooks. It
3014
+ * starts no sandbox and prepares no image; run the standard image setup to prepare the
3015
+ * standard image before the first sandbox needs it. The response reports the credential
3016
+ * check.
3017
+ * Fails with `409 provider_not_enabled` when this provider is not enabled for you.
3018
+ *
3019
+ */
3020
+ test(options) {
3021
+ return (options.client ?? this.client).post({
3022
+ responseStyle: 'data',
3023
+ security: [{ scheme: 'bearer', type: 'http' }, {
3024
+ in: 'cookie',
3025
+ name: '__Host-boxrouter_session',
3026
+ type: 'apiKey'
3027
+ }],
3028
+ url: '/provider-accounts/{account_id}/test',
3029
+ ...options
3030
+ });
3031
+ }
3032
+ /**
3033
+ * Run the standard image setup proof
3034
+ *
3035
+ * Requires `provider-accounts:manage` on API keys; dashboard browser sessions are also
3036
+ * authorized. This explicit action first tests the saved key, then boots the provider's
3037
+ * standard image, runs a bounded command, and destroys the proof sandbox. The provider
3038
+ * may charge for that short sandbox. Readiness is recorded only after boot, command and
3039
+ * cleanup succeed; failure returns the unavailable state and its setup fix. Requests are
3040
+ * idempotent and must include an idempotency key.
3041
+ *
3042
+ */
3043
+ setupStandardImage(options) {
3044
+ return (options.client ?? this.client).post({
3045
+ responseStyle: 'data',
3046
+ security: [{ scheme: 'bearer', type: 'http' }, {
3047
+ in: 'cookie',
3048
+ name: '__Host-boxrouter_session',
3049
+ type: 'apiKey'
3050
+ }],
3051
+ url: '/provider-accounts/{account_id}/standard-image/setup',
3052
+ ...options
3053
+ });
3054
+ }
3055
+ }
3056
+ exports.ProviderAccounts = ProviderAccounts;
3057
+ class Volumes extends HeyApiClient {
3058
+ /**
3059
+ * List volumes
3060
+ *
3061
+ * Lists volumes in the caller's workspace using cursor-based pagination. The response includes the current storage usage and live-volume policy only when those values are available.
3062
+ */
3063
+ list(options) {
3064
+ return (options?.client ?? this.client).get({
3065
+ responseStyle: 'data',
3066
+ security: [{ scheme: 'bearer', type: 'http' }, {
3067
+ in: 'cookie',
3068
+ name: '__Host-boxrouter_session',
3069
+ type: 'apiKey'
3070
+ }],
3071
+ url: '/volumes',
3072
+ ...options
3073
+ });
3074
+ }
3075
+ /**
3076
+ * Create a volume
3077
+ *
3078
+ * The service selects its configured live backend when this workspace's live-volume policy allows creation. Backend identity is neither a request field nor a response label.
3079
+ */
3080
+ create(options) {
3081
+ return (options.client ?? this.client).post({
3082
+ responseStyle: 'data',
3083
+ security: [{ scheme: 'bearer', type: 'http' }, {
3084
+ in: 'cookie',
3085
+ name: '__Host-boxrouter_session',
3086
+ type: 'apiKey'
3087
+ }],
3088
+ url: '/volumes',
3089
+ ...options,
3090
+ headers: {
3091
+ 'Content-Type': 'application/json',
3092
+ ...options.headers
3093
+ }
3094
+ });
3095
+ }
3096
+ /**
3097
+ * Delete a volume and its checkpoints
3098
+ *
3099
+ * Deletes a volume and all checkpoint references and stored bytes for it. When the volume's writer is ending (its destroy was accepted), the call waits for the release, at most 120 seconds, before deleting. A running writer fails at once with volume_busy (409). Reuse a supplied Idempotency-Key with the identical request to reconcile an uncertain result; a conflicting active use can return 409.
3100
+ */
3101
+ delete(options) {
3102
+ return (options.client ?? this.client).delete({
3103
+ responseStyle: 'data',
3104
+ security: [{ scheme: 'bearer', type: 'http' }, {
3105
+ in: 'cookie',
3106
+ name: '__Host-boxrouter_session',
3107
+ type: 'apiKey'
3108
+ }],
3109
+ url: '/volumes/{volume_id}',
3110
+ ...options
3111
+ });
3112
+ }
3113
+ /**
3114
+ * Get a volume
3115
+ *
3116
+ * Returns metadata for a BoxRouter-managed volume in the caller's workspace.
3117
+ */
3118
+ get(options) {
3119
+ return (options.client ?? this.client).get({
3120
+ responseStyle: 'data',
3121
+ security: [{ scheme: 'bearer', type: 'http' }, {
3122
+ in: 'cookie',
3123
+ name: '__Host-boxrouter_session',
3124
+ type: 'apiKey'
3125
+ }],
3126
+ url: '/volumes/{volume_id}',
3127
+ ...options
3128
+ });
3129
+ }
3130
+ /**
3131
+ * List volume checkpoints
3132
+ *
3133
+ * Lists committed checkpoints for this volume, newest first. A checkpoint created by an in-progress save is not listed until the save commits.
3134
+ */
3135
+ listCheckpoints(options) {
3136
+ return (options.client ?? this.client).get({
3137
+ responseStyle: 'data',
3138
+ security: [{ scheme: 'bearer', type: 'http' }, {
3139
+ in: 'cookie',
3140
+ name: '__Host-boxrouter_session',
3141
+ type: 'apiKey'
3142
+ }],
3143
+ url: '/volumes/{volume_id}/checkpoints',
3144
+ ...options
3145
+ });
3146
+ }
3147
+ /**
3148
+ * Save a volume checkpoint
3149
+ *
3150
+ * Saves the current volume filesystem as an immutable checkpoint. The optional sandbox_id identifies the expected writer-lease holder; if omitted, the current holder is used. A mounted branch sandbox can be named to checkpoint its branch files without advancing the source volume's head. Read-only sandboxes cannot save. Reuse a supplied Idempotency-Key with the identical request to reconcile an uncertain response.
3151
+ */
3152
+ save(options) {
3153
+ return (options.client ?? this.client).post({
3154
+ responseStyle: 'data',
3155
+ security: [{ scheme: 'bearer', type: 'http' }, {
3156
+ in: 'cookie',
3157
+ name: '__Host-boxrouter_session',
3158
+ type: 'apiKey'
3159
+ }],
3160
+ url: '/volumes/{volume_id}/checkpoints',
3161
+ ...options,
3162
+ headers: {
3163
+ 'Content-Type': 'application/json',
3164
+ ...options.headers
3165
+ }
3166
+ });
3167
+ }
3168
+ /**
3169
+ * Delete a checkpoint
3170
+ *
3171
+ * Removes the checkpoint reference. Backend data is reclaimed when the volume is erased.
3172
+ */
3173
+ deleteCheckpoint(options) {
3174
+ return (options.client ?? this.client).delete({
3175
+ responseStyle: 'data',
3176
+ security: [{ scheme: 'bearer', type: 'http' }, {
3177
+ in: 'cookie',
3178
+ name: '__Host-boxrouter_session',
3179
+ type: 'apiKey'
3180
+ }],
3181
+ url: '/volumes/{volume_id}/checkpoints/{checkpoint}',
3182
+ ...options
3183
+ });
3184
+ }
3185
+ /**
3186
+ * Get a volume checkpoint
3187
+ *
3188
+ * Returns an immutable committed checkpoint by its volume ID and checkpoint number.
3189
+ */
3190
+ getCheckpoint(options) {
3191
+ return (options.client ?? this.client).get({
3192
+ responseStyle: 'data',
3193
+ security: [{ scheme: 'bearer', type: 'http' }, {
3194
+ in: 'cookie',
3195
+ name: '__Host-boxrouter_session',
3196
+ type: 'apiKey'
3197
+ }],
3198
+ url: '/volumes/{volume_id}/checkpoints/{checkpoint}',
3199
+ ...options
3200
+ });
3201
+ }
3202
+ /**
3203
+ * Release a volume's writer lease
3204
+ *
3205
+ * Releases the volume's writer lease and advances its epoch, invalidating the former writer's lease token. Reuse a supplied Idempotency-Key with the identical request to reconcile an uncertain result.
3206
+ */
3207
+ release(options) {
3208
+ return (options.client ?? this.client).delete({
3209
+ responseStyle: 'data',
3210
+ security: [{ scheme: 'bearer', type: 'http' }, {
3211
+ in: 'cookie',
3212
+ name: '__Host-boxrouter_session',
3213
+ type: 'apiKey'
3214
+ }],
3215
+ url: '/volumes/{volume_id}/lease',
3216
+ ...options
3217
+ });
3218
+ }
3219
+ /**
3220
+ * Create a volume file upload
3221
+ *
3222
+ * Creates a multipart upload for a file that will appear at
3223
+ * `/workspace/<path>` in sandboxes. Upload every returned part URL with an
3224
+ * HTTP PUT containing exactly that part's bytes; save the response `ETag`
3225
+ * header for the completion request. Part URLs expire after six hours.
3226
+ * An open upload blocks `write` sandboxes, and a live or pending `write`
3227
+ * attachment blocks uploads (`volume_busy`). `read` and `shared` attachments
3228
+ * may coexist, but their sandboxes may need to refresh their volume cache to
3229
+ * see the new file.
3230
+ *
3231
+ */
3232
+ createUpload(options) {
3233
+ return (options.client ?? this.client).post({
3234
+ responseStyle: 'data',
3235
+ security: [{ scheme: 'bearer', type: 'http' }, {
3236
+ in: 'cookie',
3237
+ name: '__Host-boxrouter_session',
3238
+ type: 'apiKey'
3239
+ }],
3240
+ url: '/volumes/{volume_id}/uploads',
3241
+ ...options,
3242
+ headers: {
3243
+ 'Content-Type': 'application/json',
3244
+ ...options.headers
3245
+ }
3246
+ });
3247
+ }
3248
+ /**
3249
+ * Complete a volume file upload
3250
+ *
3251
+ * Supply each part number exactly once with the `ETag` header returned by its PUT response.
3252
+ */
3253
+ completeUpload(options) {
3254
+ return (options.client ?? this.client).post({
3255
+ responseStyle: 'data',
3256
+ security: [{ scheme: 'bearer', type: 'http' }, {
3257
+ in: 'cookie',
3258
+ name: '__Host-boxrouter_session',
3259
+ type: 'apiKey'
3260
+ }],
3261
+ url: '/volumes/{volume_id}/uploads/{upload_id}/complete',
3262
+ ...options,
3263
+ headers: {
3264
+ 'Content-Type': 'application/json',
3265
+ ...options.headers
3266
+ }
3267
+ });
3268
+ }
3269
+ /**
3270
+ * Abort a volume file upload
3271
+ *
3272
+ * Aborts an open multipart upload for this volume. Repeating an abort is safe; the uploaded file is not made visible in the volume.
3273
+ */
3274
+ abortUpload(options) {
3275
+ return (options.client ?? this.client).delete({
3276
+ responseStyle: 'data',
3277
+ security: [{ scheme: 'bearer', type: 'http' }, {
3278
+ in: 'cookie',
3279
+ name: '__Host-boxrouter_session',
3280
+ type: 'apiKey'
3281
+ }],
3282
+ url: '/volumes/{volume_id}/uploads/{upload_id}',
3283
+ ...options
3284
+ });
3285
+ }
3286
+ /**
3287
+ * Create a volume file download
3288
+ *
3289
+ * Creates a temporary download link that expires after one hour.
3290
+ */
3291
+ createDownload(options) {
3292
+ return (options.client ?? this.client).post({
3293
+ responseStyle: 'data',
3294
+ security: [{ scheme: 'bearer', type: 'http' }, {
3295
+ in: 'cookie',
3296
+ name: '__Host-boxrouter_session',
3297
+ type: 'apiKey'
3298
+ }],
3299
+ url: '/volumes/{volume_id}/downloads',
3300
+ ...options,
3301
+ headers: {
3302
+ 'Content-Type': 'application/json',
3303
+ ...options.headers
3304
+ }
3305
+ });
3306
+ }
3307
+ /**
3308
+ * List files in a volume
3309
+ *
3310
+ * Recursively lists files in path order without a directory delimiter. Read and shared sandboxes may need to refresh their volume cache to see new files.
3311
+ */
3312
+ listFiles(options) {
3313
+ return (options.client ?? this.client).get({
3314
+ responseStyle: 'data',
3315
+ security: [{ scheme: 'bearer', type: 'http' }, {
3316
+ in: 'cookie',
3317
+ name: '__Host-boxrouter_session',
3318
+ type: 'apiKey'
3319
+ }],
3320
+ url: '/volumes/{volume_id}/files',
3321
+ ...options
3322
+ });
3323
+ }
3324
+ }
3325
+ exports.Volumes = Volumes;
3326
+ class Commands extends HeyApiClient {
3327
+ /**
3328
+ * Run a buffered command
3329
+ *
3330
+ * **Commands**
3331
+ *
3332
+ * You can rely on:
3333
+ * - Runs in a login Bash, so PATH changes that installers write to ~/.profile apply to later commands.
3334
+ * - Returns the exit status.
3335
+ * - Returns stdout and stderr separately.
3336
+ * - Returns exact bytes in byte mode.
3337
+ * - The timeout ends the command.
3338
+ * - On a timeout the command's process group receives TERM at the deadline and KILL 5 seconds later, in both output modes.
3339
+ * - Returned output is captured after the shell exits, and later writes by background children cannot change it.
3340
+ * - An uncertain outcome is never replayed.
3341
+ * - Output over the limit returns the exit status and the first output_limit_bytes of each stream, marked truncated. Default and maximum: 512 KiB per stream. Processes stream complete large output.
3342
+ *
3343
+ * You can set: command, cwd, env, timeout_seconds, output (text or bytes), output_limit_bytes.
3344
+ *
3345
+ * Not promised: guest disk used by output above the limit; ending children that leave the command's process group (for example setsid daemons).
3346
+ *
3347
+ * **Command stdin**
3348
+ *
3349
+ * You can rely on:
3350
+ * - A command takes no input: it starts with stdin at end-of-file, and login profiles, the command and its children all read empty input.
3351
+ *
3352
+ * You can set: nothing (use process input for interactive input).
3353
+ *
3354
+ * Output over output_limit_bytes is not an error: the result sets stdout_truncated or
3355
+ * stderr_truncated. A nonzero exit is a completed workload result, not an HTTP failure.
3356
+ * A command that reaches timeout_seconds is a result too: the process group is ended and
3357
+ * the answer is 200 with timed_out true, exit_code null and the output written so far.
3358
+ * 504 timeout is left for the case where BoxRouter lost sight of the command and cannot
3359
+ * say whether it ran. A disconnected HTTP client is not promised to end the command; the
3360
+ * timeout ends it. Use process streaming for output without a bound.
3361
+ * Generated clients take an opt-in check argument and raise CommandFailed (the operation's
3362
+ * x-boxrouter-result-check) when exit_code is not 0 or timed_out is true.
3363
+ *
3364
+ */
3365
+ run(options) {
3366
+ return (options.client ?? this.client).post({
3367
+ responseStyle: 'data',
3368
+ security: [{ scheme: 'bearer', type: 'http' }, {
3369
+ in: 'cookie',
3370
+ name: '__Host-boxrouter_session',
3371
+ type: 'apiKey'
3372
+ }],
3373
+ url: '/sandboxes/{sandbox_id}/commands',
3374
+ ...options,
3375
+ headers: {
3376
+ 'Content-Type': 'application/json',
3377
+ ...options.headers
3378
+ }
3379
+ });
3380
+ }
3381
+ }
3382
+ exports.Commands = Commands;
3383
+ class Files extends HeyApiClient {
3384
+ /**
3385
+ * Read exact file bytes
3386
+ *
3387
+ * You can rely on:
3388
+ * - Returns complete bytes, or resource_limit with no prefix returned.
3389
+ * - Reading a directory or another path that is not a regular file fails and returns no data.
3390
+ * - An absent path is not_found, outcome failed: a read has no effect, so its outcome is never unknown.
3391
+ *
3392
+ * You can set: path.
3393
+ *
3394
+ * Not promised: consistency while another writer changes the file.
3395
+ *
3396
+ * The limit is the advertised limits.file_transfer_bytes. Bytes are not text-decoded.
3397
+ * Closing the transfer does not destroy the sandbox. A stream that ends before
3398
+ * Content-Length is an incomplete transfer, not a successful file read.
3399
+ *
3400
+ */
3401
+ read(options) {
3402
+ return (options.client ?? this.client).get({
3403
+ responseStyle: 'data',
3404
+ security: [{ scheme: 'bearer', type: 'http' }, {
3405
+ in: 'cookie',
3406
+ name: '__Host-boxrouter_session',
3407
+ type: 'apiKey'
3408
+ }],
3409
+ url: '/sandboxes/{sandbox_id}/files/content',
3410
+ ...options
3411
+ });
3412
+ }
3413
+ /**
3414
+ * Read exact file bytes
3415
+ *
3416
+ * You can rely on:
3417
+ * - Returns complete bytes, or resource_limit with no prefix returned.
3418
+ * - Reading a directory or another path that is not a regular file fails and returns no data.
3419
+ * - An absent path is not_found, outcome failed: a read has no effect, so its outcome is never unknown.
3420
+ *
3421
+ * You can set: path.
3422
+ *
3423
+ * Not promised: consistency while another writer changes the file.
3424
+ *
3425
+ * The limit is the advertised limits.file_transfer_bytes. Bytes are not text-decoded.
3426
+ * Closing the transfer does not destroy the sandbox. A stream that ends before
3427
+ * Content-Length is an incomplete transfer, not a successful file read.
3428
+ *
3429
+ */
3430
+ readStream(options) {
3431
+ return (options.client ?? this.client).get({
3432
+ security: [{ scheme: 'bearer', type: 'http' }, {
3433
+ in: 'cookie',
3434
+ name: '__Host-boxrouter_session',
3435
+ type: 'apiKey'
3436
+ }],
3437
+ url: '/sandboxes/{sandbox_id}/files/content',
3438
+ ...options,
3439
+ parseAs: "binaryStream",
3440
+ responseStyle: "fields"
3441
+ });
3442
+ }
3443
+ /**
3444
+ * Write exact file bytes
3445
+ *
3446
+ * You can rely on:
3447
+ * - Writes exact bytes.
3448
+ * - Creates missing parents.
3449
+ * - A new file is readable and writable by the command user.
3450
+ * - The size limit is enforced.
3451
+ *
3452
+ * You can set: path, data.
3453
+ *
3454
+ * Not promised: owner, mode or executable bit; atomic replace; whether a symbolic link at the path is followed or replaced.
3455
+ *
3456
+ * The limit is the advertised limits.file_transfer_bytes. A failed transfer may leave
3457
+ * partial data; the error's outcome describes what is known. SDK text helpers must encode
3458
+ * text as UTF-8 before transfer.
3459
+ *
3460
+ */
3461
+ write(options) {
3462
+ return (options.client ?? this.client).put({
3463
+ bodySerializer: null,
3464
+ responseStyle: 'data',
3465
+ security: [{ scheme: 'bearer', type: 'http' }, {
3466
+ in: 'cookie',
3467
+ name: '__Host-boxrouter_session',
3468
+ type: 'apiKey'
3469
+ }],
3470
+ url: '/sandboxes/{sandbox_id}/files/content',
3471
+ ...options,
3472
+ headers: {
3473
+ 'Content-Type': 'application/octet-stream',
3474
+ ...options.headers
3475
+ }
3476
+ });
3477
+ }
3478
+ /**
3479
+ * Create a sandbox file upload
3480
+ *
3481
+ * You can rely on:
3482
+ * - A completed upload leaves exactly the declared bytes at the path; a body of another length is refused.
3483
+ *
3484
+ * You can set: path, size.
3485
+ *
3486
+ * Not promised: removing bytes already written when an upload is aborted.
3487
+ *
3488
+ * Starts an upload of a file of known size to an absolute path in a running sandbox. Send
3489
+ * every returned part as described by its `TransferPart`, then call `completeSandboxUpload`
3490
+ * with each part's response `ETag`, if any. BoxRouter chooses the `route`; it is
3491
+ * informational and clients must not branch on it. Upload links and the session last up to
3492
+ * six hours after creation; `expires_at` says when they end. Launch behaviour is always
3493
+ * exactly one part. Idempotency-Key is required on create, complete and abort; repeat an
3494
+ * uncertain call with the same key.
3495
+ *
3496
+ */
3497
+ createUpload(options) {
3498
+ return (options.client ?? this.client).post({
3499
+ responseStyle: 'data',
3500
+ security: [{ scheme: 'bearer', type: 'http' }, {
3501
+ in: 'cookie',
3502
+ name: '__Host-boxrouter_session',
3503
+ type: 'apiKey'
3504
+ }],
3505
+ url: '/sandboxes/{sandbox_id}/files/uploads',
3506
+ ...options,
3507
+ headers: {
3508
+ 'Content-Type': 'application/json',
3509
+ ...options.headers
3510
+ }
3511
+ });
3512
+ }
3513
+ /**
3514
+ * Complete a sandbox file upload
3515
+ *
3516
+ * You can rely on:
3517
+ * - A completed upload leaves exactly the declared bytes at the path; a body of another length is refused.
3518
+ *
3519
+ * You can set: path, size.
3520
+ *
3521
+ * Not promised: removing bytes already written when an upload is aborted.
3522
+ *
3523
+ * Supply each part number exactly once with the `ETag` header returned by its request, if
3524
+ * it returned one. Repeating the call with the same idempotency key returns the same result.
3525
+ *
3526
+ */
3527
+ completeUpload(options) {
3528
+ return (options.client ?? this.client).post({
3529
+ responseStyle: 'data',
3530
+ security: [{ scheme: 'bearer', type: 'http' }, {
3531
+ in: 'cookie',
3532
+ name: '__Host-boxrouter_session',
3533
+ type: 'apiKey'
3534
+ }],
3535
+ url: '/sandboxes/{sandbox_id}/files/uploads/{upload_id}/complete',
3536
+ ...options,
3537
+ headers: {
3538
+ 'Content-Type': 'application/json',
3539
+ ...options.headers
3540
+ }
3541
+ });
3542
+ }
3543
+ /**
3544
+ * Abort a sandbox file upload
3545
+ *
3546
+ * You can rely on:
3547
+ * - A completed upload leaves exactly the declared bytes at the path; a body of another length is refused.
3548
+ *
3549
+ * You can set: path, size.
3550
+ *
3551
+ * Not promised: removing bytes already written when an upload is aborted.
3552
+ *
3553
+ * Idempotent.
3554
+ *
3555
+ */
3556
+ abortUpload(options) {
3557
+ return (options.client ?? this.client).delete({
3558
+ responseStyle: 'data',
3559
+ security: [{ scheme: 'bearer', type: 'http' }, {
3560
+ in: 'cookie',
3561
+ name: '__Host-boxrouter_session',
3562
+ type: 'apiKey'
3563
+ }],
3564
+ url: '/sandboxes/{sandbox_id}/files/uploads/{upload_id}',
3565
+ ...options
3566
+ });
3567
+ }
3568
+ /**
3569
+ * Create a sandbox file download
3570
+ *
3571
+ * You can rely on:
3572
+ * - A complete download returns exactly the file's bytes; a transfer that ends short fails instead of returning a prefix.
3573
+ *
3574
+ * You can set: path.
3575
+ *
3576
+ * Not promised: the file's size before the download starts.
3577
+ *
3578
+ * Creates a temporary download link for a file in a running sandbox. The link lasts up to
3579
+ * one hour after creation; `expires_at` says when it ends. `route` is informational and
3580
+ * clients must not branch on it.
3581
+ *
3582
+ */
3583
+ createDownload(options) {
3584
+ return (options.client ?? this.client).post({
3585
+ responseStyle: 'data',
3586
+ security: [{ scheme: 'bearer', type: 'http' }, {
3587
+ in: 'cookie',
3588
+ name: '__Host-boxrouter_session',
3589
+ type: 'apiKey'
3590
+ }],
3591
+ url: '/sandboxes/{sandbox_id}/files/downloads',
3592
+ ...options,
3593
+ headers: {
3594
+ 'Content-Type': 'application/json',
3595
+ ...options.headers
3596
+ }
3597
+ });
3598
+ }
3599
+ /**
3600
+ * List the immediate entries of a directory
3601
+ *
3602
+ * You can rely on:
3603
+ * - Returns every immediate entry, including hidden ones and broken symbolic links, sorted by name.
3604
+ * - Each entry has its type (file, directory, symlink, other); a link is not followed.
3605
+ * - More entries than the advertised limit fail; the list is never truncated.
3606
+ *
3607
+ * You can set: path.
3608
+ *
3609
+ * Not promised: metadata beyond the type; a consistent snapshot while the directory changes.
3610
+ *
3611
+ * An unreadable or missing directory fails; it does not appear empty. No recursion.
3612
+ *
3613
+ */
3614
+ list(options) {
3615
+ return (options.client ?? this.client).get({
3616
+ responseStyle: 'data',
3617
+ security: [{ scheme: 'bearer', type: 'http' }, {
3618
+ in: 'cookie',
3619
+ name: '__Host-boxrouter_session',
3620
+ type: 'apiKey'
3621
+ }],
3622
+ url: '/sandboxes/{sandbox_id}/files/directories',
3623
+ ...options
3624
+ });
3625
+ }
3626
+ /**
3627
+ * Create a directory
3628
+ *
3629
+ * You can rely on:
3630
+ * - parents=true (the default) creates missing parents and accepts an existing directory.
3631
+ * - parents=false requires the parent and refuses an existing path.
3632
+ *
3633
+ * You can set: path, parents.
3634
+ *
3635
+ * Not promised: mode and owner beyond command-user usability.
3636
+ *
3637
+ * A failure may leave some parent directories created. An uncertain mutation is never automatically replayed.
3638
+ *
3639
+ */
3640
+ mkdir(options) {
3641
+ return (options.client ?? this.client).post({
3642
+ responseStyle: 'data',
3643
+ security: [{ scheme: 'bearer', type: 'http' }, {
3644
+ in: 'cookie',
3645
+ name: '__Host-boxrouter_session',
3646
+ type: 'apiKey'
3647
+ }],
3648
+ url: '/sandboxes/{sandbox_id}/files/directories',
3649
+ ...options,
3650
+ headers: {
3651
+ 'Content-Type': 'application/json',
3652
+ ...options.headers
3653
+ }
3654
+ });
3655
+ }
3656
+ /**
3657
+ * Check for an accessible filesystem target
3658
+ *
3659
+ * You can rely on:
3660
+ * - Follows symbolic links. True when the target exists; false when it is missing, the link is broken, or the target is not accessible.
3661
+ * - A failure to check raises an error; it never reads as false.
3662
+ *
3663
+ * You can set: path.
3664
+ *
3665
+ * Not promised: whether the answer still holds after the call.
3666
+ *
3667
+ * Transport and command-startup failures remain errors. This read does not reserve the path or guarantee it remains present.
3668
+ *
3669
+ */
3670
+ exists(options) {
3671
+ return (options.client ?? this.client).get({
3672
+ responseStyle: 'data',
3673
+ security: [{ scheme: 'bearer', type: 'http' }, {
3674
+ in: 'cookie',
3675
+ name: '__Host-boxrouter_session',
3676
+ type: 'apiKey'
3677
+ }],
3678
+ url: '/sandboxes/{sandbox_id}/files/exists',
3679
+ ...options
3680
+ });
3681
+ }
3682
+ /**
3683
+ * Remove a file, symbolic link or directory
3684
+ *
3685
+ * You can rely on:
3686
+ * - Removes only the named entry.
3687
+ * - A nonempty directory needs recursive.
3688
+ * - A symbolic link, broken or not, is unlinked and its target kept.
3689
+ * - A missing path fails.
3690
+ * - The sandbox root is refused.
3691
+ *
3692
+ * You can set: path, recursive.
3693
+ *
3694
+ * Not promised: atomicity; partial progress after a failure.
3695
+ *
3696
+ * A final slash does not change which entry is removed. Failures may leave partial changes. An uncertain mutation is never automatically replayed.
3697
+ *
3698
+ */
3699
+ remove(options) {
3700
+ return (options.client ?? this.client).post({
3701
+ responseStyle: 'data',
3702
+ security: [{ scheme: 'bearer', type: 'http' }, {
3703
+ in: 'cookie',
3704
+ name: '__Host-boxrouter_session',
3705
+ type: 'apiKey'
3706
+ }],
3707
+ url: '/sandboxes/{sandbox_id}/files/remove',
3708
+ ...options,
3709
+ headers: {
3710
+ 'Content-Type': 'application/json',
3711
+ ...options.headers
3712
+ }
3713
+ });
3714
+ }
3715
+ }
3716
+ exports.Files = Files;
3717
+ class Pricing extends HeyApiClient {
3718
+ /**
3719
+ * List the providers' live price versions
3720
+ *
3721
+ * Public: needs no key or session. Lists every live price version, which is what
3722
+ * BoxRouter used to calculate sandbox costs, so a published cost can be
3723
+ * rechecked without BoxRouter's database. Live versions never change. With `at`, returns
3724
+ * only the version in effect at that time, one per provider; a provider with no version
3725
+ * in effect then is left out. Effective periods include `effective_from` and exclude
3726
+ * `effective_to` (`[effective_from, effective_to)`); the version taking over at a boundary
3727
+ * applies at that instant.
3728
+ *
3729
+ */
3730
+ versions(options) {
3731
+ return (options?.client ?? this.client).get({
3732
+ responseStyle: 'data',
3733
+ url: '/price-versions',
3734
+ ...options
3735
+ });
3736
+ }
3737
+ }
3738
+ exports.Pricing = Pricing;
3739
+ class Providers extends HeyApiClient {
3740
+ /**
3741
+ * List available provider routes
3742
+ *
3743
+ * Returns only supply visible to the caller, including account-specific
3744
+ * entitlements and limits. This is a point-in-time eligibility view, not a
3745
+ * capacity reservation. Unknown or unverified capability guarantees are not
3746
+ * advertised as supported. Server-side eligibility is rechecked at creation.
3747
+ *
3748
+ */
3749
+ list(options) {
3750
+ return (options?.client ?? this.client).get({
3751
+ responseStyle: 'data',
3752
+ security: [{ scheme: 'bearer', type: 'http' }, {
3753
+ in: 'cookie',
3754
+ name: '__Host-boxrouter_session',
3755
+ type: 'apiKey'
3756
+ }],
3757
+ url: '/providers',
3758
+ ...options
3759
+ });
3760
+ }
3761
+ }
3762
+ exports.Providers = Providers;
3763
+ class BoxRouterApi extends HeyApiClient {
3764
+ static __registry = new HeyApiRegistry();
3765
+ constructor(args) {
3766
+ super(args);
3767
+ BoxRouterApi.__registry.set(this, args?.key);
3768
+ }
3769
+ _agents;
3770
+ get agents() {
3771
+ return this._agents ??= new Agents({ client: this.client });
3772
+ }
3773
+ _launches;
3774
+ get launches() {
3775
+ return this._launches ??= new Launches({ client: this.client });
3776
+ }
3777
+ _launchRuns;
3778
+ get launchRuns() {
3779
+ return this._launchRuns ??= new LaunchRuns({ client: this.client });
3780
+ }
3781
+ _github;
3782
+ get github() {
3783
+ return this._github ??= new Github({ client: this.client });
3784
+ }
3785
+ _actions;
3786
+ get actions() {
3787
+ return this._actions ??= new Actions({ client: this.client });
3788
+ }
3789
+ _routing;
3790
+ get routing() {
3791
+ return this._routing ??= new Routing({ client: this.client });
3792
+ }
3793
+ _operations;
3794
+ get operations() {
3795
+ return this._operations ??= new Operations({ client: this.client });
3796
+ }
3797
+ _artifacts;
3798
+ get artifacts() {
3799
+ return this._artifacts ??= new Artifacts({ client: this.client });
3800
+ }
3801
+ _images;
3802
+ get images() {
3803
+ return this._images ??= new Images({ client: this.client });
3804
+ }
3805
+ _processes;
3806
+ get processes() {
3807
+ return this._processes ??= new Processes({ client: this.client });
3808
+ }
3809
+ _credits;
3810
+ get credits() {
3811
+ return this._credits ??= new Credits({ client: this.client });
3812
+ }
3813
+ _spendLimits;
3814
+ get spendLimits() {
3815
+ return this._spendLimits ??= new SpendLimits({ client: this.client });
3816
+ }
3817
+ _usage;
3818
+ get usage() {
3819
+ return this._usage ??= new Usage({ client: this.client });
3820
+ }
3821
+ _terminals;
3822
+ get terminals() {
3823
+ return this._terminals ??= new Terminals({ client: this.client });
3824
+ }
3825
+ _secrets;
3826
+ get secrets() {
3827
+ return this._secrets ??= new Secrets({ client: this.client });
3828
+ }
3829
+ _previews;
3830
+ get previews() {
3831
+ return this._previews ??= new Previews({ client: this.client });
3832
+ }
3833
+ _sandboxes;
3834
+ get sandboxes() {
3835
+ return this._sandboxes ??= new Sandboxes({ client: this.client });
3836
+ }
3837
+ _providerAccounts;
3838
+ get providerAccounts() {
3839
+ return this._providerAccounts ??= new ProviderAccounts({ client: this.client });
3840
+ }
3841
+ _volumes;
3842
+ get volumes() {
3843
+ return this._volumes ??= new Volumes({ client: this.client });
3844
+ }
3845
+ _commands;
3846
+ get commands() {
3847
+ return this._commands ??= new Commands({ client: this.client });
3848
+ }
3849
+ _files;
3850
+ get files() {
3851
+ return this._files ??= new Files({ client: this.client });
3852
+ }
3853
+ _pricing;
3854
+ get pricing() {
3855
+ return this._pricing ??= new Pricing({ client: this.client });
3856
+ }
3857
+ _providers;
3858
+ get providers() {
3859
+ return this._providers ??= new Providers({ client: this.client });
3860
+ }
3861
+ }
3862
+ exports.BoxRouterApi = BoxRouterApi;