oz-agent-sdk 1.0.0-alpha.7

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 (399) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/LICENSE +201 -0
  3. package/README.md +422 -0
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +179 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +179 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +454 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +450 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +2 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +2 -0
  55. package/error.d.ts.map +1 -0
  56. package/error.js +6 -0
  57. package/error.js.map +1 -0
  58. package/error.mjs +2 -0
  59. package/error.mjs.map +1 -0
  60. package/index.d.mts +6 -0
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +6 -0
  63. package/index.d.ts.map +1 -0
  64. package/index.js +30 -0
  65. package/index.js.map +1 -0
  66. package/index.mjs +7 -0
  67. package/index.mjs.map +1 -0
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +40 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +37 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/qs/formats.d.mts +7 -0
  109. package/internal/qs/formats.d.mts.map +1 -0
  110. package/internal/qs/formats.d.ts +7 -0
  111. package/internal/qs/formats.d.ts.map +1 -0
  112. package/internal/qs/formats.js +13 -0
  113. package/internal/qs/formats.js.map +1 -0
  114. package/internal/qs/formats.mjs +9 -0
  115. package/internal/qs/formats.mjs.map +1 -0
  116. package/internal/qs/index.d.mts +10 -0
  117. package/internal/qs/index.d.mts.map +1 -0
  118. package/internal/qs/index.d.ts +10 -0
  119. package/internal/qs/index.d.ts.map +1 -0
  120. package/internal/qs/index.js +14 -0
  121. package/internal/qs/index.js.map +1 -0
  122. package/internal/qs/index.mjs +10 -0
  123. package/internal/qs/index.mjs.map +1 -0
  124. package/internal/qs/stringify.d.mts +3 -0
  125. package/internal/qs/stringify.d.mts.map +1 -0
  126. package/internal/qs/stringify.d.ts +3 -0
  127. package/internal/qs/stringify.d.ts.map +1 -0
  128. package/internal/qs/stringify.js +277 -0
  129. package/internal/qs/stringify.js.map +1 -0
  130. package/internal/qs/stringify.mjs +274 -0
  131. package/internal/qs/stringify.mjs.map +1 -0
  132. package/internal/qs/types.d.mts +57 -0
  133. package/internal/qs/types.d.mts.map +1 -0
  134. package/internal/qs/types.d.ts +57 -0
  135. package/internal/qs/types.d.ts.map +1 -0
  136. package/internal/qs/types.js +3 -0
  137. package/internal/qs/types.js.map +1 -0
  138. package/internal/qs/types.mjs +2 -0
  139. package/internal/qs/types.mjs.map +1 -0
  140. package/internal/qs/utils.d.mts +15 -0
  141. package/internal/qs/utils.d.mts.map +1 -0
  142. package/internal/qs/utils.d.ts +15 -0
  143. package/internal/qs/utils.d.ts.map +1 -0
  144. package/internal/qs/utils.js +230 -0
  145. package/internal/qs/utils.js.map +1 -0
  146. package/internal/qs/utils.mjs +217 -0
  147. package/internal/qs/utils.mjs.map +1 -0
  148. package/internal/request-options.d.mts +75 -0
  149. package/internal/request-options.d.mts.map +1 -0
  150. package/internal/request-options.d.ts +75 -0
  151. package/internal/request-options.d.ts.map +1 -0
  152. package/internal/request-options.js +14 -0
  153. package/internal/request-options.js.map +1 -0
  154. package/internal/request-options.mjs +10 -0
  155. package/internal/request-options.mjs.map +1 -0
  156. package/internal/shim-types.d.mts +17 -0
  157. package/internal/shim-types.d.mts.map +1 -0
  158. package/internal/shim-types.d.ts +17 -0
  159. package/internal/shim-types.d.ts.map +1 -0
  160. package/internal/shim-types.js +4 -0
  161. package/internal/shim-types.js.map +1 -0
  162. package/internal/shim-types.mjs +3 -0
  163. package/internal/shim-types.mjs.map +1 -0
  164. package/internal/shims.d.mts +20 -0
  165. package/internal/shims.d.mts.map +1 -0
  166. package/internal/shims.d.ts +20 -0
  167. package/internal/shims.d.ts.map +1 -0
  168. package/internal/shims.js +92 -0
  169. package/internal/shims.js.map +1 -0
  170. package/internal/shims.mjs +85 -0
  171. package/internal/shims.mjs.map +1 -0
  172. package/internal/to-file.d.mts +45 -0
  173. package/internal/to-file.d.mts.map +1 -0
  174. package/internal/to-file.d.ts +45 -0
  175. package/internal/to-file.d.ts.map +1 -0
  176. package/internal/to-file.js +91 -0
  177. package/internal/to-file.js.map +1 -0
  178. package/internal/to-file.mjs +88 -0
  179. package/internal/to-file.mjs.map +1 -0
  180. package/internal/tslib.js +81 -0
  181. package/internal/tslib.mjs +17 -0
  182. package/internal/types.d.mts +69 -0
  183. package/internal/types.d.mts.map +1 -0
  184. package/internal/types.d.ts +69 -0
  185. package/internal/types.d.ts.map +1 -0
  186. package/internal/types.js +4 -0
  187. package/internal/types.js.map +1 -0
  188. package/internal/types.mjs +3 -0
  189. package/internal/types.mjs.map +1 -0
  190. package/internal/uploads.d.mts +42 -0
  191. package/internal/uploads.d.mts.map +1 -0
  192. package/internal/uploads.d.ts +42 -0
  193. package/internal/uploads.d.ts.map +1 -0
  194. package/internal/uploads.js +141 -0
  195. package/internal/uploads.js.map +1 -0
  196. package/internal/uploads.mjs +131 -0
  197. package/internal/uploads.mjs.map +1 -0
  198. package/internal/utils/base64.d.mts +3 -0
  199. package/internal/utils/base64.d.mts.map +1 -0
  200. package/internal/utils/base64.d.ts +3 -0
  201. package/internal/utils/base64.d.ts.map +1 -0
  202. package/internal/utils/base64.js +38 -0
  203. package/internal/utils/base64.js.map +1 -0
  204. package/internal/utils/base64.mjs +33 -0
  205. package/internal/utils/base64.mjs.map +1 -0
  206. package/internal/utils/bytes.d.mts +4 -0
  207. package/internal/utils/bytes.d.mts.map +1 -0
  208. package/internal/utils/bytes.d.ts +4 -0
  209. package/internal/utils/bytes.d.ts.map +1 -0
  210. package/internal/utils/bytes.js +31 -0
  211. package/internal/utils/bytes.js.map +1 -0
  212. package/internal/utils/bytes.mjs +26 -0
  213. package/internal/utils/bytes.mjs.map +1 -0
  214. package/internal/utils/env.d.mts +9 -0
  215. package/internal/utils/env.d.mts.map +1 -0
  216. package/internal/utils/env.d.ts +9 -0
  217. package/internal/utils/env.d.ts.map +1 -0
  218. package/internal/utils/env.js +22 -0
  219. package/internal/utils/env.js.map +1 -0
  220. package/internal/utils/env.mjs +18 -0
  221. package/internal/utils/env.mjs.map +1 -0
  222. package/internal/utils/log.d.mts +37 -0
  223. package/internal/utils/log.d.mts.map +1 -0
  224. package/internal/utils/log.d.ts +37 -0
  225. package/internal/utils/log.d.ts.map +1 -0
  226. package/internal/utils/log.js +85 -0
  227. package/internal/utils/log.js.map +1 -0
  228. package/internal/utils/log.mjs +79 -0
  229. package/internal/utils/log.mjs.map +1 -0
  230. package/internal/utils/path.d.mts +15 -0
  231. package/internal/utils/path.d.mts.map +1 -0
  232. package/internal/utils/path.d.ts +15 -0
  233. package/internal/utils/path.d.ts.map +1 -0
  234. package/internal/utils/path.js +79 -0
  235. package/internal/utils/path.js.map +1 -0
  236. package/internal/utils/path.mjs +74 -0
  237. package/internal/utils/path.mjs.map +1 -0
  238. package/internal/utils/sleep.d.mts +2 -0
  239. package/internal/utils/sleep.d.mts.map +1 -0
  240. package/internal/utils/sleep.d.ts +2 -0
  241. package/internal/utils/sleep.d.ts.map +1 -0
  242. package/internal/utils/sleep.js +7 -0
  243. package/internal/utils/sleep.js.map +1 -0
  244. package/internal/utils/sleep.mjs +3 -0
  245. package/internal/utils/sleep.mjs.map +1 -0
  246. package/internal/utils/uuid.d.mts +5 -0
  247. package/internal/utils/uuid.d.mts.map +1 -0
  248. package/internal/utils/uuid.d.ts +5 -0
  249. package/internal/utils/uuid.d.ts.map +1 -0
  250. package/internal/utils/uuid.js +19 -0
  251. package/internal/utils/uuid.js.map +1 -0
  252. package/internal/utils/uuid.mjs +15 -0
  253. package/internal/utils/uuid.mjs.map +1 -0
  254. package/internal/utils/values.d.mts +18 -0
  255. package/internal/utils/values.d.mts.map +1 -0
  256. package/internal/utils/values.d.ts +18 -0
  257. package/internal/utils/values.d.ts.map +1 -0
  258. package/internal/utils/values.js +112 -0
  259. package/internal/utils/values.js.map +1 -0
  260. package/internal/utils/values.mjs +94 -0
  261. package/internal/utils/values.mjs.map +1 -0
  262. package/internal/utils.d.mts +7 -0
  263. package/internal/utils.d.mts.map +1 -0
  264. package/internal/utils.d.ts +7 -0
  265. package/internal/utils.d.ts.map +1 -0
  266. package/internal/utils.js +11 -0
  267. package/internal/utils.js.map +1 -0
  268. package/internal/utils.mjs +8 -0
  269. package/internal/utils.mjs.map +1 -0
  270. package/package.json +137 -0
  271. package/resource.d.mts +2 -0
  272. package/resource.d.mts.map +1 -0
  273. package/resource.d.ts +2 -0
  274. package/resource.d.ts.map +1 -0
  275. package/resource.js +6 -0
  276. package/resource.js.map +1 -0
  277. package/resource.mjs +2 -0
  278. package/resource.mjs.map +1 -0
  279. package/resources/agent/agent.d.mts +336 -0
  280. package/resources/agent/agent.d.mts.map +1 -0
  281. package/resources/agent/agent.d.ts +336 -0
  282. package/resources/agent/agent.d.ts.map +1 -0
  283. package/resources/agent/agent.js +47 -0
  284. package/resources/agent/agent.js.map +1 -0
  285. package/resources/agent/agent.mjs +42 -0
  286. package/resources/agent/agent.mjs.map +1 -0
  287. package/resources/agent/index.d.mts +4 -0
  288. package/resources/agent/index.d.mts.map +1 -0
  289. package/resources/agent/index.d.ts +4 -0
  290. package/resources/agent/index.d.ts.map +1 -0
  291. package/resources/agent/index.js +11 -0
  292. package/resources/agent/index.js.map +1 -0
  293. package/resources/agent/index.mjs +5 -0
  294. package/resources/agent/index.mjs.map +1 -0
  295. package/resources/agent/runs.d.mts +381 -0
  296. package/resources/agent/runs.d.mts.map +1 -0
  297. package/resources/agent/runs.d.ts +381 -0
  298. package/resources/agent/runs.d.ts.map +1 -0
  299. package/resources/agent/runs.js +46 -0
  300. package/resources/agent/runs.js.map +1 -0
  301. package/resources/agent/runs.mjs +42 -0
  302. package/resources/agent/runs.mjs.map +1 -0
  303. package/resources/agent/schedules.d.mts +240 -0
  304. package/resources/agent/schedules.d.mts.map +1 -0
  305. package/resources/agent/schedules.d.ts +240 -0
  306. package/resources/agent/schedules.d.ts.map +1 -0
  307. package/resources/agent/schedules.js +111 -0
  308. package/resources/agent/schedules.js.map +1 -0
  309. package/resources/agent/schedules.mjs +107 -0
  310. package/resources/agent/schedules.mjs.map +1 -0
  311. package/resources/agent.d.mts +2 -0
  312. package/resources/agent.d.mts.map +1 -0
  313. package/resources/agent.d.ts +2 -0
  314. package/resources/agent.d.ts.map +1 -0
  315. package/resources/agent.js +6 -0
  316. package/resources/agent.js.map +1 -0
  317. package/resources/agent.mjs +3 -0
  318. package/resources/agent.mjs.map +1 -0
  319. package/resources/index.d.mts +2 -0
  320. package/resources/index.d.mts.map +1 -0
  321. package/resources/index.d.ts +2 -0
  322. package/resources/index.d.ts.map +1 -0
  323. package/resources/index.js +7 -0
  324. package/resources/index.js.map +1 -0
  325. package/resources/index.mjs +3 -0
  326. package/resources/index.mjs.map +1 -0
  327. package/resources.d.mts +2 -0
  328. package/resources.d.mts.map +1 -0
  329. package/resources.d.ts +2 -0
  330. package/resources.d.ts.map +1 -0
  331. package/resources.js +5 -0
  332. package/resources.js.map +1 -0
  333. package/resources.mjs +2 -0
  334. package/resources.mjs.map +1 -0
  335. package/src/api-promise.ts +2 -0
  336. package/src/client.ts +741 -0
  337. package/src/core/README.md +3 -0
  338. package/src/core/api-promise.ts +92 -0
  339. package/src/core/error.ts +130 -0
  340. package/src/core/resource.ts +11 -0
  341. package/src/core/uploads.ts +2 -0
  342. package/src/error.ts +2 -0
  343. package/src/index.ts +22 -0
  344. package/src/internal/README.md +3 -0
  345. package/src/internal/builtin-types.ts +93 -0
  346. package/src/internal/detect-platform.ts +196 -0
  347. package/src/internal/errors.ts +33 -0
  348. package/src/internal/headers.ts +97 -0
  349. package/src/internal/parse.ts +56 -0
  350. package/src/internal/qs/LICENSE.md +13 -0
  351. package/src/internal/qs/README.md +3 -0
  352. package/src/internal/qs/formats.ts +10 -0
  353. package/src/internal/qs/index.ts +13 -0
  354. package/src/internal/qs/stringify.ts +385 -0
  355. package/src/internal/qs/types.ts +71 -0
  356. package/src/internal/qs/utils.ts +265 -0
  357. package/src/internal/request-options.ts +91 -0
  358. package/src/internal/shim-types.ts +26 -0
  359. package/src/internal/shims.ts +107 -0
  360. package/src/internal/to-file.ts +154 -0
  361. package/src/internal/types.ts +95 -0
  362. package/src/internal/uploads.ts +187 -0
  363. package/src/internal/utils/base64.ts +40 -0
  364. package/src/internal/utils/bytes.ts +32 -0
  365. package/src/internal/utils/env.ts +18 -0
  366. package/src/internal/utils/log.ts +126 -0
  367. package/src/internal/utils/path.ts +88 -0
  368. package/src/internal/utils/sleep.ts +3 -0
  369. package/src/internal/utils/uuid.ts +17 -0
  370. package/src/internal/utils/values.ts +105 -0
  371. package/src/internal/utils.ts +8 -0
  372. package/src/lib/.keep +4 -0
  373. package/src/resource.ts +2 -0
  374. package/src/resources/agent/agent.ts +443 -0
  375. package/src/resources/agent/index.ts +32 -0
  376. package/src/resources/agent/runs.ts +478 -0
  377. package/src/resources/agent/schedules.ts +305 -0
  378. package/src/resources/agent.ts +3 -0
  379. package/src/resources/index.ts +14 -0
  380. package/src/resources.ts +1 -0
  381. package/src/tsconfig.json +11 -0
  382. package/src/uploads.ts +2 -0
  383. package/src/version.ts +1 -0
  384. package/uploads.d.mts +2 -0
  385. package/uploads.d.mts.map +1 -0
  386. package/uploads.d.ts +2 -0
  387. package/uploads.d.ts.map +1 -0
  388. package/uploads.js +6 -0
  389. package/uploads.js.map +1 -0
  390. package/uploads.mjs +2 -0
  391. package/uploads.mjs.map +1 -0
  392. package/version.d.mts +2 -0
  393. package/version.d.mts.map +1 -0
  394. package/version.d.ts +2 -0
  395. package/version.d.ts.map +1 -0
  396. package/version.js +5 -0
  397. package/version.js.map +1 -0
  398. package/version.mjs +2 -0
  399. package/version.mjs.map +1 -0
@@ -0,0 +1,105 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { WarpAPIError } from '../../core/error';
4
+
5
+ // https://url.spec.whatwg.org/#url-scheme-string
6
+ const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
7
+
8
+ export const isAbsoluteURL = (url: string): boolean => {
9
+ return startsWithSchemeRegexp.test(url);
10
+ };
11
+
12
+ export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val));
13
+ export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[];
14
+
15
+ /** Returns an object if the given value isn't an object, otherwise returns as-is */
16
+ export function maybeObj(x: unknown): object {
17
+ if (typeof x !== 'object') {
18
+ return {};
19
+ }
20
+
21
+ return x ?? {};
22
+ }
23
+
24
+ // https://stackoverflow.com/a/34491287
25
+ export function isEmptyObj(obj: Object | null | undefined): boolean {
26
+ if (!obj) return true;
27
+ for (const _k in obj) return false;
28
+ return true;
29
+ }
30
+
31
+ // https://eslint.org/docs/latest/rules/no-prototype-builtins
32
+ export function hasOwn<T extends object = object>(obj: T, key: PropertyKey): key is keyof T {
33
+ return Object.prototype.hasOwnProperty.call(obj, key);
34
+ }
35
+
36
+ export function isObj(obj: unknown): obj is Record<string, unknown> {
37
+ return obj != null && typeof obj === 'object' && !Array.isArray(obj);
38
+ }
39
+
40
+ export const ensurePresent = <T>(value: T | null | undefined): T => {
41
+ if (value == null) {
42
+ throw new WarpAPIError(`Expected a value to be given but received ${value} instead.`);
43
+ }
44
+
45
+ return value;
46
+ };
47
+
48
+ export const validatePositiveInteger = (name: string, n: unknown): number => {
49
+ if (typeof n !== 'number' || !Number.isInteger(n)) {
50
+ throw new WarpAPIError(`${name} must be an integer`);
51
+ }
52
+ if (n < 0) {
53
+ throw new WarpAPIError(`${name} must be a positive integer`);
54
+ }
55
+ return n;
56
+ };
57
+
58
+ export const coerceInteger = (value: unknown): number => {
59
+ if (typeof value === 'number') return Math.round(value);
60
+ if (typeof value === 'string') return parseInt(value, 10);
61
+
62
+ throw new WarpAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
+ };
64
+
65
+ export const coerceFloat = (value: unknown): number => {
66
+ if (typeof value === 'number') return value;
67
+ if (typeof value === 'string') return parseFloat(value);
68
+
69
+ throw new WarpAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
+ };
71
+
72
+ export const coerceBoolean = (value: unknown): boolean => {
73
+ if (typeof value === 'boolean') return value;
74
+ if (typeof value === 'string') return value === 'true';
75
+ return Boolean(value);
76
+ };
77
+
78
+ export const maybeCoerceInteger = (value: unknown): number | undefined => {
79
+ if (value == null) {
80
+ return undefined;
81
+ }
82
+ return coerceInteger(value);
83
+ };
84
+
85
+ export const maybeCoerceFloat = (value: unknown): number | undefined => {
86
+ if (value == null) {
87
+ return undefined;
88
+ }
89
+ return coerceFloat(value);
90
+ };
91
+
92
+ export const maybeCoerceBoolean = (value: unknown): boolean | undefined => {
93
+ if (value == null) {
94
+ return undefined;
95
+ }
96
+ return coerceBoolean(value);
97
+ };
98
+
99
+ export const safeJSON = (text: string) => {
100
+ try {
101
+ return JSON.parse(text);
102
+ } catch (err) {
103
+ return undefined;
104
+ }
105
+ };
@@ -0,0 +1,8 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './utils/values';
4
+ export * from './utils/base64';
5
+ export * from './utils/env';
6
+ export * from './utils/log';
7
+ export * from './utils/uuid';
8
+ export * from './utils/sleep';
package/src/lib/.keep ADDED
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store custom files to expand the SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
@@ -0,0 +1,2 @@
1
+ /** @deprecated Import from ./core/resource instead */
2
+ export * from './core/resource';
@@ -0,0 +1,443 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as RunsAPI from './runs';
5
+ import {
6
+ ArtifactItem,
7
+ RunCancelResponse,
8
+ RunItem,
9
+ RunListParams,
10
+ RunListResponse,
11
+ RunSourceType,
12
+ RunState,
13
+ Runs,
14
+ } from './runs';
15
+ import * as SchedulesAPI from './schedules';
16
+ import {
17
+ ScheduleCreateParams,
18
+ ScheduleDeleteResponse,
19
+ ScheduleListResponse,
20
+ ScheduleUpdateParams,
21
+ ScheduledAgentItem,
22
+ Schedules,
23
+ } from './schedules';
24
+ import { APIPromise } from '../../core/api-promise';
25
+ import { RequestOptions } from '../../internal/request-options';
26
+
27
+ export class Agent extends APIResource {
28
+ runs: RunsAPI.Runs = new RunsAPI.Runs(this._client);
29
+ schedules: SchedulesAPI.Schedules = new SchedulesAPI.Schedules(this._client);
30
+
31
+ /**
32
+ * Retrieve a list of available agents (skills) that can be used to run tasks.
33
+ * Agents are discovered from environments or a specific repository.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const agents = await client.agent.list();
38
+ * ```
39
+ */
40
+ list(
41
+ query: AgentListParams | null | undefined = {},
42
+ options?: RequestOptions,
43
+ ): APIPromise<AgentListResponse> {
44
+ return this._client.get('/agent', { query, ...options });
45
+ }
46
+
47
+ /**
48
+ * Spawn an cloud agent with a prompt and optional configuration. The agent will be
49
+ * queued for execution and assigned a unique run ID.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const response = await client.agent.run({
54
+ * prompt: 'Fix the bug in auth.go',
55
+ * });
56
+ * ```
57
+ */
58
+ run(body: AgentRunParams, options?: RequestOptions): APIPromise<AgentRunResponse> {
59
+ return this._client.post('/agent/run', { body, ...options });
60
+ }
61
+ }
62
+
63
+ export interface AgentSkill {
64
+ /**
65
+ * Human-readable name of the agent
66
+ */
67
+ name: string;
68
+
69
+ /**
70
+ * Available variants of this agent
71
+ */
72
+ variants: Array<AgentSkill.Variant>;
73
+ }
74
+
75
+ export namespace AgentSkill {
76
+ export interface Variant {
77
+ /**
78
+ * Stable identifier for this skill variant. Format: "{owner}/{repo}:{skill_path}"
79
+ * Example: "warpdotdev/warp-server:.claude/skills/deploy/SKILL.md"
80
+ */
81
+ id: string;
82
+
83
+ /**
84
+ * Base prompt/instructions for the agent
85
+ */
86
+ base_prompt: string;
87
+
88
+ /**
89
+ * Description of the agent variant
90
+ */
91
+ description: string;
92
+
93
+ /**
94
+ * Environments where this agent variant is available
95
+ */
96
+ environments: Array<Variant.Environment>;
97
+
98
+ source: Variant.Source;
99
+
100
+ /**
101
+ * Timestamp of the last time this skill was run (RFC3339)
102
+ */
103
+ last_run_timestamp?: string | null;
104
+ }
105
+
106
+ export namespace Variant {
107
+ export interface Environment {
108
+ /**
109
+ * Human-readable name of the environment
110
+ */
111
+ name: string;
112
+
113
+ /**
114
+ * Unique identifier for the environment
115
+ */
116
+ uid: string;
117
+ }
118
+
119
+ export interface Source {
120
+ /**
121
+ * GitHub repository name
122
+ */
123
+ name: string;
124
+
125
+ /**
126
+ * GitHub repository owner
127
+ */
128
+ owner: string;
129
+
130
+ /**
131
+ * Path to the skill definition file within the repository
132
+ */
133
+ skill_path: string;
134
+ }
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Configuration for an cloud agent run
140
+ */
141
+ export interface AmbientAgentConfig {
142
+ /**
143
+ * Custom base prompt for the agent
144
+ */
145
+ base_prompt?: string;
146
+
147
+ /**
148
+ * Controls whether computer use is enabled for this agent. If not set, defaults to
149
+ * false.
150
+ */
151
+ computer_use_enabled?: boolean;
152
+
153
+ /**
154
+ * UID of the environment to run the agent in
155
+ */
156
+ environment_id?: string;
157
+
158
+ /**
159
+ * Map of MCP server configurations by name
160
+ */
161
+ mcp_servers?: { [key: string]: McpServerConfig };
162
+
163
+ /**
164
+ * LLM model to use (uses team default if not specified)
165
+ */
166
+ model_id?: string;
167
+
168
+ /**
169
+ * Config name for searchability and traceability
170
+ */
171
+ name?: string;
172
+
173
+ /**
174
+ * Skill specification identifying which agent skill to use. Format:
175
+ * "{owner}/{repo}:{skill_path}" Example:
176
+ * "warpdotdev/warp-server:.claude/skills/deploy/SKILL.md" Use the list agents
177
+ * endpoint to discover available skills.
178
+ */
179
+ skill_spec?: string;
180
+
181
+ /**
182
+ * Self-hosted worker ID that should execute this task. If not specified or set to
183
+ * "warp", the task runs on Warp-hosted workers.
184
+ */
185
+ worker_host?: string;
186
+ }
187
+
188
+ /**
189
+ * Configuration for a cloud environment used by scheduled agents
190
+ */
191
+ export interface CloudEnvironmentConfig {
192
+ /**
193
+ * Optional description of the environment
194
+ */
195
+ description?: string | null;
196
+
197
+ /**
198
+ * Docker image to use (e.g., "ubuntu:latest" or "registry/repo:tag")
199
+ */
200
+ docker_image?: string;
201
+
202
+ /**
203
+ * List of GitHub repositories to clone into the environment
204
+ */
205
+ github_repos?: Array<CloudEnvironmentConfig.GitHubRepo>;
206
+
207
+ /**
208
+ * Human-readable name for the environment
209
+ */
210
+ name?: string;
211
+
212
+ /**
213
+ * Shell commands to run during environment setup
214
+ */
215
+ setup_commands?: Array<string>;
216
+ }
217
+
218
+ export namespace CloudEnvironmentConfig {
219
+ export interface GitHubRepo {
220
+ /**
221
+ * GitHub repository owner (user or organization)
222
+ */
223
+ owner: string;
224
+
225
+ /**
226
+ * GitHub repository name
227
+ */
228
+ repo: string;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Configuration for an MCP server. Must have exactly one of: warp_id, command, or
234
+ * url.
235
+ */
236
+ export interface McpServerConfig {
237
+ /**
238
+ * Stdio transport - command arguments
239
+ */
240
+ args?: Array<string>;
241
+
242
+ /**
243
+ * Stdio transport - command to run
244
+ */
245
+ command?: string;
246
+
247
+ /**
248
+ * Environment variables for the server
249
+ */
250
+ env?: { [key: string]: string };
251
+
252
+ /**
253
+ * HTTP headers for SSE/HTTP transport
254
+ */
255
+ headers?: { [key: string]: string };
256
+
257
+ /**
258
+ * SSE/HTTP transport - server URL
259
+ */
260
+ url?: string;
261
+
262
+ /**
263
+ * Reference to a Warp shared MCP server by UUID
264
+ */
265
+ warp_id?: string;
266
+ }
267
+
268
+ export interface UserProfile {
269
+ /**
270
+ * Display name of the creator
271
+ */
272
+ display_name?: string;
273
+
274
+ /**
275
+ * URL to the creator's photo
276
+ */
277
+ photo_url?: string;
278
+
279
+ /**
280
+ * Type of the creator principal
281
+ */
282
+ type?: 'user' | 'service_account';
283
+
284
+ /**
285
+ * Unique identifier of the creator
286
+ */
287
+ uid?: string;
288
+ }
289
+
290
+ export interface AgentListResponse {
291
+ /**
292
+ * List of available agents
293
+ */
294
+ agents: Array<AgentSkill>;
295
+ }
296
+
297
+ export interface AgentRunResponse {
298
+ /**
299
+ * Unique identifier for the created run
300
+ */
301
+ run_id: string;
302
+
303
+ /**
304
+ * Current state of the run:
305
+ *
306
+ * - QUEUED: Run is waiting to be picked up
307
+ * - PENDING: Run is being prepared
308
+ * - CLAIMED: Run has been claimed by a worker
309
+ * - INPROGRESS: Run is actively being executed
310
+ * - SUCCEEDED: Run completed successfully
311
+ * - FAILED: Run failed
312
+ * - CANCELLED: Run was cancelled by user
313
+ */
314
+ state: RunsAPI.RunState;
315
+
316
+ /**
317
+ * @deprecated Use run_id instead.
318
+ */
319
+ task_id: string;
320
+ }
321
+
322
+ export interface AgentListParams {
323
+ /**
324
+ * When true, clears the agent list cache before fetching. Use this to force a
325
+ * refresh of the available agents.
326
+ */
327
+ refresh?: boolean;
328
+
329
+ /**
330
+ * Optional repository specification to list agents from (format: "owner/repo"). If
331
+ * not provided, lists agents from all accessible environments.
332
+ */
333
+ repo?: string;
334
+
335
+ /**
336
+ * Sort order for the returned agents.
337
+ *
338
+ * - "name": Sort alphabetically by name (default)
339
+ * - "last_run": Sort by most recently used
340
+ */
341
+ sort_by?: 'name' | 'last_run';
342
+ }
343
+
344
+ export interface AgentRunParams {
345
+ /**
346
+ * Configuration for an cloud agent run
347
+ */
348
+ config?: AmbientAgentConfig;
349
+
350
+ /**
351
+ * Optional conversation ID to continue an existing conversation. If provided, the
352
+ * agent will continue from where the previous run left off.
353
+ */
354
+ conversation_id?: string;
355
+
356
+ /**
357
+ * Optional images to include with the prompt (max 5). Images are uploaded to cloud
358
+ * storage and made available to the agent.
359
+ */
360
+ images?: Array<AgentRunParams.Image>;
361
+
362
+ /**
363
+ * The prompt/instruction for the agent to execute. Required unless a skill is
364
+ * specified via the skill field or config.skill_spec.
365
+ */
366
+ prompt?: string;
367
+
368
+ /**
369
+ * Skill specification to use as the base prompt for the agent. Supported formats:
370
+ *
371
+ * - "repo:skill_name" - Simple name in specific repo
372
+ * - "repo:skill_path" - Full path in specific repo
373
+ * - "org/repo:skill_name" - Simple name with org and repo
374
+ * - "org/repo:skill_path" - Full path with org and repo When provided, this takes
375
+ * precedence over config.skill_spec.
376
+ */
377
+ skill?: string;
378
+
379
+ /**
380
+ * Whether to create a team-owned run. Defaults to true for users on a single team.
381
+ */
382
+ team?: boolean;
383
+
384
+ /**
385
+ * Custom title for the run (auto-generated if not provided)
386
+ */
387
+ title?: string;
388
+ }
389
+
390
+ export namespace AgentRunParams {
391
+ /**
392
+ * A base64-encoded image to include with the prompt
393
+ */
394
+ export interface Image {
395
+ /**
396
+ * Base64-encoded image data
397
+ */
398
+ data: string;
399
+
400
+ /**
401
+ * MIME type of the image. Supported types: image/jpeg, image/png, image/gif,
402
+ * image/webp
403
+ */
404
+ mime_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
405
+ }
406
+ }
407
+
408
+ Agent.Runs = Runs;
409
+ Agent.Schedules = Schedules;
410
+
411
+ export declare namespace Agent {
412
+ export {
413
+ type AgentSkill as AgentSkill,
414
+ type AmbientAgentConfig as AmbientAgentConfig,
415
+ type CloudEnvironmentConfig as CloudEnvironmentConfig,
416
+ type McpServerConfig as McpServerConfig,
417
+ type UserProfile as UserProfile,
418
+ type AgentListResponse as AgentListResponse,
419
+ type AgentRunResponse as AgentRunResponse,
420
+ type AgentListParams as AgentListParams,
421
+ type AgentRunParams as AgentRunParams,
422
+ };
423
+
424
+ export {
425
+ Runs as Runs,
426
+ type ArtifactItem as ArtifactItem,
427
+ type RunItem as RunItem,
428
+ type RunSourceType as RunSourceType,
429
+ type RunState as RunState,
430
+ type RunListResponse as RunListResponse,
431
+ type RunCancelResponse as RunCancelResponse,
432
+ type RunListParams as RunListParams,
433
+ };
434
+
435
+ export {
436
+ Schedules as Schedules,
437
+ type ScheduledAgentItem as ScheduledAgentItem,
438
+ type ScheduleListResponse as ScheduleListResponse,
439
+ type ScheduleDeleteResponse as ScheduleDeleteResponse,
440
+ type ScheduleCreateParams as ScheduleCreateParams,
441
+ type ScheduleUpdateParams as ScheduleUpdateParams,
442
+ };
443
+ }
@@ -0,0 +1,32 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Agent,
5
+ type AgentSkill,
6
+ type AmbientAgentConfig,
7
+ type CloudEnvironmentConfig,
8
+ type McpServerConfig,
9
+ type UserProfile,
10
+ type AgentListResponse,
11
+ type AgentRunResponse,
12
+ type AgentListParams,
13
+ type AgentRunParams,
14
+ } from './agent';
15
+ export {
16
+ Runs,
17
+ type ArtifactItem,
18
+ type RunItem,
19
+ type RunSourceType,
20
+ type RunState,
21
+ type RunListResponse,
22
+ type RunCancelResponse,
23
+ type RunListParams,
24
+ } from './runs';
25
+ export {
26
+ Schedules,
27
+ type ScheduledAgentItem,
28
+ type ScheduleListResponse,
29
+ type ScheduleDeleteResponse,
30
+ type ScheduleCreateParams,
31
+ type ScheduleUpdateParams,
32
+ } from './schedules';