dedalus-cli 0.0.0-stage → 0.7.0

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 (684) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +296 -2
  3. package/SKILL.md +73 -0
  4. package/api.md +340 -0
  5. package/dist/cjs/bin.d.ts +3 -0
  6. package/dist/cjs/bin.d.ts.map +1 -0
  7. package/dist/cjs/bin.js +7 -0
  8. package/dist/cjs/bin.js.map +1 -0
  9. package/dist/cjs/cli/completions.d.ts +6 -0
  10. package/dist/cjs/cli/completions.d.ts.map +1 -0
  11. package/dist/cjs/cli/completions.js +11 -0
  12. package/dist/cjs/cli/completions.js.map +1 -0
  13. package/dist/cjs/cli/credentials.d.ts +169 -0
  14. package/dist/cjs/cli/credentials.d.ts.map +1 -0
  15. package/dist/cjs/cli/credentials.js +630 -0
  16. package/dist/cjs/cli/credentials.js.map +1 -0
  17. package/dist/cjs/cli/keychain.d.ts +34 -0
  18. package/dist/cjs/cli/keychain.d.ts.map +1 -0
  19. package/dist/cjs/cli/keychain.js +246 -0
  20. package/dist/cjs/cli/keychain.js.map +1 -0
  21. package/dist/cjs/cli/list.d.ts +23 -0
  22. package/dist/cjs/cli/list.d.ts.map +1 -0
  23. package/dist/cjs/cli/list.js +32 -0
  24. package/dist/cjs/cli/list.js.map +1 -0
  25. package/dist/cjs/cli/login.d.ts +137 -0
  26. package/dist/cjs/cli/login.d.ts.map +1 -0
  27. package/dist/cjs/cli/login.js +2060 -0
  28. package/dist/cjs/cli/login.js.map +1 -0
  29. package/dist/cjs/cli/runtime.d.ts +98 -0
  30. package/dist/cjs/cli/runtime.d.ts.map +1 -0
  31. package/dist/cjs/cli/runtime.js +1356 -0
  32. package/dist/cjs/cli/runtime.js.map +1 -0
  33. package/dist/cjs/cli/toon.d.ts +6 -0
  34. package/dist/cjs/cli/toon.d.ts.map +1 -0
  35. package/dist/cjs/cli/toon.js +165 -0
  36. package/dist/cjs/cli/toon.js.map +1 -0
  37. package/dist/cjs/cli/upgrade.d.ts +28 -0
  38. package/dist/cjs/cli/upgrade.d.ts.map +1 -0
  39. package/dist/cjs/cli/upgrade.js +1191 -0
  40. package/dist/cjs/cli/upgrade.js.map +1 -0
  41. package/dist/cjs/commands/index.d.ts +47 -0
  42. package/dist/cjs/commands/index.d.ts.map +1 -0
  43. package/dist/cjs/commands/index.js +1202 -0
  44. package/dist/cjs/commands/index.js.map +1 -0
  45. package/dist/cjs/custom/browser-routing.d.ts +4 -0
  46. package/dist/cjs/custom/browser-routing.d.ts.map +1 -0
  47. package/dist/cjs/custom/browser-routing.js +51 -0
  48. package/dist/cjs/custom/browser-routing.js.map +1 -0
  49. package/dist/cjs/custom/images.d.ts +6 -0
  50. package/dist/cjs/custom/images.d.ts.map +1 -0
  51. package/dist/cjs/custom/images.js +74 -0
  52. package/dist/cjs/custom/images.js.map +1 -0
  53. package/dist/cjs/custom/machines.d.ts +20 -0
  54. package/dist/cjs/custom/machines.d.ts.map +1 -0
  55. package/dist/cjs/custom/machines.js +84 -0
  56. package/dist/cjs/custom/machines.js.map +1 -0
  57. package/dist/cjs/custom/ssh-picker.d.ts +19 -0
  58. package/dist/cjs/custom/ssh-picker.d.ts.map +1 -0
  59. package/dist/cjs/custom/ssh-picker.js +157 -0
  60. package/dist/cjs/custom/ssh-picker.js.map +1 -0
  61. package/dist/cjs/custom/ssh.d.ts +18 -0
  62. package/dist/cjs/custom/ssh.d.ts.map +1 -0
  63. package/dist/cjs/custom/ssh.js +152 -0
  64. package/dist/cjs/custom/ssh.js.map +1 -0
  65. package/dist/cjs/feedback/bundle.d.ts +41 -0
  66. package/dist/cjs/feedback/bundle.d.ts.map +1 -0
  67. package/dist/cjs/feedback/bundle.js +88 -0
  68. package/dist/cjs/feedback/bundle.js.map +1 -0
  69. package/dist/cjs/feedback/command.d.ts +6 -0
  70. package/dist/cjs/feedback/command.d.ts.map +1 -0
  71. package/dist/cjs/feedback/command.js +100 -0
  72. package/dist/cjs/feedback/command.js.map +1 -0
  73. package/dist/cjs/feedback/diagnostics.d.ts +30 -0
  74. package/dist/cjs/feedback/diagnostics.d.ts.map +1 -0
  75. package/dist/cjs/feedback/diagnostics.js +278 -0
  76. package/dist/cjs/feedback/diagnostics.js.map +1 -0
  77. package/dist/cjs/index.d.ts +4 -0
  78. package/dist/cjs/index.d.ts.map +1 -0
  79. package/dist/cjs/index.js +11 -0
  80. package/dist/cjs/index.js.map +1 -0
  81. package/dist/cjs/package.json +3 -0
  82. package/dist/cjs/sdk/api-promise.d.ts +31 -0
  83. package/dist/cjs/sdk/api-promise.d.ts.map +1 -0
  84. package/dist/cjs/sdk/api-promise.js +73 -0
  85. package/dist/cjs/sdk/api-promise.js.map +1 -0
  86. package/dist/cjs/sdk/client.d.ts +267 -0
  87. package/dist/cjs/sdk/client.d.ts.map +1 -0
  88. package/dist/cjs/sdk/client.js +965 -0
  89. package/dist/cjs/sdk/client.js.map +1 -0
  90. package/dist/cjs/sdk/core/api-promise.d.ts +3 -0
  91. package/dist/cjs/sdk/core/api-promise.d.ts.map +1 -0
  92. package/dist/cjs/sdk/core/api-promise.js +8 -0
  93. package/dist/cjs/sdk/core/api-promise.js.map +1 -0
  94. package/dist/cjs/sdk/core/error.d.ts +46 -0
  95. package/dist/cjs/sdk/core/error.d.ts.map +1 -0
  96. package/dist/cjs/sdk/core/error.js +135 -0
  97. package/dist/cjs/sdk/core/error.js.map +1 -0
  98. package/dist/cjs/sdk/core/pagination.d.ts +38 -0
  99. package/dist/cjs/sdk/core/pagination.d.ts.map +1 -0
  100. package/dist/cjs/sdk/core/pagination.js +98 -0
  101. package/dist/cjs/sdk/core/pagination.js.map +1 -0
  102. package/dist/cjs/sdk/core/resource.d.ts +2 -0
  103. package/dist/cjs/sdk/core/resource.d.ts.map +1 -0
  104. package/dist/cjs/sdk/core/resource.js +7 -0
  105. package/dist/cjs/sdk/core/resource.js.map +1 -0
  106. package/dist/cjs/sdk/core/uploads.d.ts +3 -0
  107. package/dist/cjs/sdk/core/uploads.d.ts.map +1 -0
  108. package/dist/cjs/sdk/core/uploads.js +7 -0
  109. package/dist/cjs/sdk/core/uploads.js.map +1 -0
  110. package/dist/cjs/sdk/error.d.ts +3 -0
  111. package/dist/cjs/sdk/error.d.ts.map +1 -0
  112. package/dist/cjs/sdk/error.js +20 -0
  113. package/dist/cjs/sdk/error.js.map +1 -0
  114. package/dist/cjs/sdk/helpers/images.d.ts +31 -0
  115. package/dist/cjs/sdk/helpers/images.d.ts.map +1 -0
  116. package/dist/cjs/sdk/helpers/images.js +195 -0
  117. package/dist/cjs/sdk/helpers/images.js.map +1 -0
  118. package/dist/cjs/sdk/index.d.ts +7 -0
  119. package/dist/cjs/sdk/index.d.ts.map +1 -0
  120. package/dist/cjs/sdk/index.js +29 -0
  121. package/dist/cjs/sdk/index.js.map +1 -0
  122. package/dist/cjs/sdk/internal/builtin-types.d.ts +73 -0
  123. package/dist/cjs/sdk/internal/builtin-types.d.ts.map +1 -0
  124. package/dist/cjs/sdk/internal/builtin-types.js +4 -0
  125. package/dist/cjs/sdk/internal/builtin-types.js.map +1 -0
  126. package/dist/cjs/sdk/internal/detect-platform.d.ts +15 -0
  127. package/dist/cjs/sdk/internal/detect-platform.d.ts.map +1 -0
  128. package/dist/cjs/sdk/internal/detect-platform.js +185 -0
  129. package/dist/cjs/sdk/internal/detect-platform.js.map +1 -0
  130. package/dist/cjs/sdk/internal/errors.d.ts +3 -0
  131. package/dist/cjs/sdk/internal/errors.d.ts.map +1 -0
  132. package/dist/cjs/sdk/internal/errors.js +41 -0
  133. package/dist/cjs/sdk/internal/errors.js.map +1 -0
  134. package/dist/cjs/sdk/internal/headers.d.ts +43 -0
  135. package/dist/cjs/sdk/internal/headers.d.ts.map +1 -0
  136. package/dist/cjs/sdk/internal/headers.js +142 -0
  137. package/dist/cjs/sdk/internal/headers.js.map +1 -0
  138. package/dist/cjs/sdk/internal/parse.d.ts +3 -0
  139. package/dist/cjs/sdk/internal/parse.d.ts.map +1 -0
  140. package/dist/cjs/sdk/internal/parse.js +7 -0
  141. package/dist/cjs/sdk/internal/parse.js.map +1 -0
  142. package/dist/cjs/sdk/internal/qs/formats.d.ts +7 -0
  143. package/dist/cjs/sdk/internal/qs/formats.d.ts.map +1 -0
  144. package/dist/cjs/sdk/internal/qs/formats.js +13 -0
  145. package/dist/cjs/sdk/internal/qs/formats.js.map +1 -0
  146. package/dist/cjs/sdk/internal/qs/index.d.ts +10 -0
  147. package/dist/cjs/sdk/internal/qs/index.d.ts.map +1 -0
  148. package/dist/cjs/sdk/internal/qs/index.js +14 -0
  149. package/dist/cjs/sdk/internal/qs/index.js.map +1 -0
  150. package/dist/cjs/sdk/internal/qs/stringify.d.ts +3 -0
  151. package/dist/cjs/sdk/internal/qs/stringify.d.ts.map +1 -0
  152. package/dist/cjs/sdk/internal/qs/stringify.js +278 -0
  153. package/dist/cjs/sdk/internal/qs/stringify.js.map +1 -0
  154. package/dist/cjs/sdk/internal/qs/types.d.ts +57 -0
  155. package/dist/cjs/sdk/internal/qs/types.d.ts.map +1 -0
  156. package/dist/cjs/sdk/internal/qs/types.js +3 -0
  157. package/dist/cjs/sdk/internal/qs/types.js.map +1 -0
  158. package/dist/cjs/sdk/internal/qs/utils.d.ts +15 -0
  159. package/dist/cjs/sdk/internal/qs/utils.d.ts.map +1 -0
  160. package/dist/cjs/sdk/internal/qs/utils.js +230 -0
  161. package/dist/cjs/sdk/internal/qs/utils.js.map +1 -0
  162. package/dist/cjs/sdk/internal/request-options.d.ts +33 -0
  163. package/dist/cjs/sdk/internal/request-options.d.ts.map +1 -0
  164. package/dist/cjs/sdk/internal/request-options.js +15 -0
  165. package/dist/cjs/sdk/internal/request-options.js.map +1 -0
  166. package/dist/cjs/sdk/internal/shim-types.d.ts +17 -0
  167. package/dist/cjs/sdk/internal/shim-types.d.ts.map +1 -0
  168. package/dist/cjs/sdk/internal/shim-types.js +4 -0
  169. package/dist/cjs/sdk/internal/shim-types.js.map +1 -0
  170. package/dist/cjs/sdk/internal/shims.d.ts +26 -0
  171. package/dist/cjs/sdk/internal/shims.d.ts.map +1 -0
  172. package/dist/cjs/sdk/internal/shims.js +92 -0
  173. package/dist/cjs/sdk/internal/shims.js.map +1 -0
  174. package/dist/cjs/sdk/internal/to-file.d.ts +45 -0
  175. package/dist/cjs/sdk/internal/to-file.d.ts.map +1 -0
  176. package/dist/cjs/sdk/internal/to-file.js +91 -0
  177. package/dist/cjs/sdk/internal/to-file.js.map +1 -0
  178. package/dist/cjs/sdk/internal/types.d.ts +63 -0
  179. package/dist/cjs/sdk/internal/types.d.ts.map +1 -0
  180. package/dist/cjs/sdk/internal/types.js +4 -0
  181. package/dist/cjs/sdk/internal/types.js.map +1 -0
  182. package/dist/cjs/sdk/internal/uploads.d.ts +42 -0
  183. package/dist/cjs/sdk/internal/uploads.d.ts.map +1 -0
  184. package/dist/cjs/sdk/internal/uploads.js +158 -0
  185. package/dist/cjs/sdk/internal/uploads.js.map +1 -0
  186. package/dist/cjs/sdk/internal/utils/base64.d.ts +3 -0
  187. package/dist/cjs/sdk/internal/utils/base64.d.ts.map +1 -0
  188. package/dist/cjs/sdk/internal/utils/base64.js +38 -0
  189. package/dist/cjs/sdk/internal/utils/base64.js.map +1 -0
  190. package/dist/cjs/sdk/internal/utils/body.d.ts +40 -0
  191. package/dist/cjs/sdk/internal/utils/body.d.ts.map +1 -0
  192. package/dist/cjs/sdk/internal/utils/body.js +148 -0
  193. package/dist/cjs/sdk/internal/utils/body.js.map +1 -0
  194. package/dist/cjs/sdk/internal/utils/bytes.d.ts +4 -0
  195. package/dist/cjs/sdk/internal/utils/bytes.d.ts.map +1 -0
  196. package/dist/cjs/sdk/internal/utils/bytes.js +31 -0
  197. package/dist/cjs/sdk/internal/utils/bytes.js.map +1 -0
  198. package/dist/cjs/sdk/internal/utils/env.d.ts +9 -0
  199. package/dist/cjs/sdk/internal/utils/env.d.ts.map +1 -0
  200. package/dist/cjs/sdk/internal/utils/env.js +22 -0
  201. package/dist/cjs/sdk/internal/utils/env.js.map +1 -0
  202. package/dist/cjs/sdk/internal/utils/log.d.ts +52 -0
  203. package/dist/cjs/sdk/internal/utils/log.d.ts.map +1 -0
  204. package/dist/cjs/sdk/internal/utils/log.js +413 -0
  205. package/dist/cjs/sdk/internal/utils/log.js.map +1 -0
  206. package/dist/cjs/sdk/internal/utils/path.d.ts +41 -0
  207. package/dist/cjs/sdk/internal/utils/path.d.ts.map +1 -0
  208. package/dist/cjs/sdk/internal/utils/path.js +115 -0
  209. package/dist/cjs/sdk/internal/utils/path.js.map +1 -0
  210. package/dist/cjs/sdk/internal/utils/query-string.d.ts +21 -0
  211. package/dist/cjs/sdk/internal/utils/query-string.d.ts.map +1 -0
  212. package/dist/cjs/sdk/internal/utils/query-string.js +128 -0
  213. package/dist/cjs/sdk/internal/utils/query-string.js.map +1 -0
  214. package/dist/cjs/sdk/internal/utils/query.d.ts +2 -0
  215. package/dist/cjs/sdk/internal/utils/query.d.ts.map +1 -0
  216. package/dist/cjs/sdk/internal/utils/query.js +12 -0
  217. package/dist/cjs/sdk/internal/utils/query.js.map +1 -0
  218. package/dist/cjs/sdk/internal/utils/sleep.d.ts +2 -0
  219. package/dist/cjs/sdk/internal/utils/sleep.d.ts.map +1 -0
  220. package/dist/cjs/sdk/internal/utils/sleep.js +7 -0
  221. package/dist/cjs/sdk/internal/utils/sleep.js.map +1 -0
  222. package/dist/cjs/sdk/internal/utils/uuid.d.ts +5 -0
  223. package/dist/cjs/sdk/internal/utils/uuid.d.ts.map +1 -0
  224. package/dist/cjs/sdk/internal/utils/uuid.js +19 -0
  225. package/dist/cjs/sdk/internal/utils/uuid.js.map +1 -0
  226. package/dist/cjs/sdk/internal/utils/values.d.ts +18 -0
  227. package/dist/cjs/sdk/internal/utils/values.d.ts.map +1 -0
  228. package/dist/cjs/sdk/internal/utils/values.js +112 -0
  229. package/dist/cjs/sdk/internal/utils/values.js.map +1 -0
  230. package/dist/cjs/sdk/internal/utils.d.ts +8 -0
  231. package/dist/cjs/sdk/internal/utils.d.ts.map +1 -0
  232. package/dist/cjs/sdk/internal/utils.js +25 -0
  233. package/dist/cjs/sdk/internal/utils.js.map +1 -0
  234. package/dist/cjs/sdk/pagination.d.ts +3 -0
  235. package/dist/cjs/sdk/pagination.d.ts.map +1 -0
  236. package/dist/cjs/sdk/pagination.js +20 -0
  237. package/dist/cjs/sdk/pagination.js.map +1 -0
  238. package/dist/cjs/sdk/resource.d.ts +6 -0
  239. package/dist/cjs/sdk/resource.d.ts.map +1 -0
  240. package/dist/cjs/sdk/resource.js +12 -0
  241. package/dist/cjs/sdk/resource.js.map +1 -0
  242. package/dist/cjs/sdk/resources/images/images.d.ts +202 -0
  243. package/dist/cjs/sdk/resources/images/images.d.ts.map +1 -0
  244. package/dist/cjs/sdk/resources/images/images.js +139 -0
  245. package/dist/cjs/sdk/resources/images/images.js.map +1 -0
  246. package/dist/cjs/sdk/resources/images/index.d.ts +5 -0
  247. package/dist/cjs/sdk/resources/images/index.d.ts.map +1 -0
  248. package/dist/cjs/sdk/resources/images/index.js +9 -0
  249. package/dist/cjs/sdk/resources/images/index.js.map +1 -0
  250. package/dist/cjs/sdk/resources/images/uploads.d.ts +50 -0
  251. package/dist/cjs/sdk/resources/images/uploads.d.ts.map +1 -0
  252. package/dist/cjs/sdk/resources/images/uploads.js +28 -0
  253. package/dist/cjs/sdk/resources/images/uploads.js.map +1 -0
  254. package/dist/cjs/sdk/resources/images.d.ts +2 -0
  255. package/dist/cjs/sdk/resources/images.d.ts.map +1 -0
  256. package/dist/cjs/sdk/resources/images.js +19 -0
  257. package/dist/cjs/sdk/resources/images.js.map +1 -0
  258. package/dist/cjs/sdk/resources/index.d.ts +6 -0
  259. package/dist/cjs/sdk/resources/index.d.ts.map +1 -0
  260. package/dist/cjs/sdk/resources/index.js +11 -0
  261. package/dist/cjs/sdk/resources/index.js.map +1 -0
  262. package/dist/cjs/sdk/resources/machines/autoresizing.d.ts +115 -0
  263. package/dist/cjs/sdk/resources/machines/autoresizing.d.ts.map +1 -0
  264. package/dist/cjs/sdk/resources/machines/autoresizing.js +46 -0
  265. package/dist/cjs/sdk/resources/machines/autoresizing.js.map +1 -0
  266. package/dist/cjs/sdk/resources/machines/executions/executions.d.ts +341 -0
  267. package/dist/cjs/sdk/resources/machines/executions/executions.d.ts.map +1 -0
  268. package/dist/cjs/sdk/resources/machines/executions/executions.js +161 -0
  269. package/dist/cjs/sdk/resources/machines/executions/executions.js.map +1 -0
  270. package/dist/cjs/sdk/resources/machines/executions/index.d.ts +5 -0
  271. package/dist/cjs/sdk/resources/machines/executions/index.d.ts.map +1 -0
  272. package/dist/cjs/sdk/resources/machines/executions/index.js +9 -0
  273. package/dist/cjs/sdk/resources/machines/executions/index.js.map +1 -0
  274. package/dist/cjs/sdk/resources/machines/executions/logs.d.ts +103 -0
  275. package/dist/cjs/sdk/resources/machines/executions/logs.d.ts.map +1 -0
  276. package/dist/cjs/sdk/resources/machines/executions/logs.js +48 -0
  277. package/dist/cjs/sdk/resources/machines/executions/logs.js.map +1 -0
  278. package/dist/cjs/sdk/resources/machines/executions.d.ts +2 -0
  279. package/dist/cjs/sdk/resources/machines/executions.d.ts.map +1 -0
  280. package/dist/cjs/sdk/resources/machines/executions.js +19 -0
  281. package/dist/cjs/sdk/resources/machines/executions.js.map +1 -0
  282. package/dist/cjs/sdk/resources/machines/index.d.ts +9 -0
  283. package/dist/cjs/sdk/resources/machines/index.d.ts.map +1 -0
  284. package/dist/cjs/sdk/resources/machines/index.js +13 -0
  285. package/dist/cjs/sdk/resources/machines/index.js.map +1 -0
  286. package/dist/cjs/sdk/resources/machines/machines.d.ts +496 -0
  287. package/dist/cjs/sdk/resources/machines/machines.d.ts.map +1 -0
  288. package/dist/cjs/sdk/resources/machines/machines.js +220 -0
  289. package/dist/cjs/sdk/resources/machines/machines.js.map +1 -0
  290. package/dist/cjs/sdk/resources/machines/ssh.d.ts +175 -0
  291. package/dist/cjs/sdk/resources/machines/ssh.d.ts.map +1 -0
  292. package/dist/cjs/sdk/resources/machines/ssh.js +89 -0
  293. package/dist/cjs/sdk/resources/machines/ssh.js.map +1 -0
  294. package/dist/cjs/sdk/resources/machines.d.ts +2 -0
  295. package/dist/cjs/sdk/resources/machines.d.ts.map +1 -0
  296. package/dist/cjs/sdk/resources/machines.js +19 -0
  297. package/dist/cjs/sdk/resources/machines.js.map +1 -0
  298. package/dist/cjs/sdk/resources/organization/autoresizing.d.ts +86 -0
  299. package/dist/cjs/sdk/resources/organization/autoresizing.d.ts.map +1 -0
  300. package/dist/cjs/sdk/resources/organization/autoresizing.js +38 -0
  301. package/dist/cjs/sdk/resources/organization/autoresizing.js.map +1 -0
  302. package/dist/cjs/sdk/resources/organization/index.d.ts +4 -0
  303. package/dist/cjs/sdk/resources/organization/index.d.ts.map +1 -0
  304. package/dist/cjs/sdk/resources/organization/index.js +9 -0
  305. package/dist/cjs/sdk/resources/organization/index.js.map +1 -0
  306. package/dist/cjs/sdk/resources/organization/organization.d.ts +10 -0
  307. package/dist/cjs/sdk/resources/organization/organization.d.ts.map +1 -0
  308. package/dist/cjs/sdk/resources/organization/organization.js +46 -0
  309. package/dist/cjs/sdk/resources/organization/organization.js.map +1 -0
  310. package/dist/cjs/sdk/resources/organization.d.ts +2 -0
  311. package/dist/cjs/sdk/resources/organization.d.ts.map +1 -0
  312. package/dist/cjs/sdk/resources/organization.js +19 -0
  313. package/dist/cjs/sdk/resources/organization.js.map +1 -0
  314. package/dist/cjs/sdk/resources.d.ts +3 -0
  315. package/dist/cjs/sdk/resources.d.ts.map +1 -0
  316. package/dist/cjs/sdk/resources.js +9 -0
  317. package/dist/cjs/sdk/resources.js.map +1 -0
  318. package/dist/cjs/sdk/uploads.d.ts +2 -0
  319. package/dist/cjs/sdk/uploads.d.ts.map +1 -0
  320. package/dist/cjs/sdk/uploads.js +7 -0
  321. package/dist/cjs/sdk/uploads.js.map +1 -0
  322. package/dist/cjs/sdk/version.d.ts +2 -0
  323. package/dist/cjs/sdk/version.d.ts.map +1 -0
  324. package/dist/cjs/sdk/version.js +6 -0
  325. package/dist/cjs/sdk/version.js.map +1 -0
  326. package/dist/esm/bin.d.ts +3 -0
  327. package/dist/esm/bin.d.ts.map +1 -0
  328. package/dist/esm/bin.js +5 -0
  329. package/dist/esm/bin.js.map +1 -0
  330. package/dist/esm/cli/completions.d.ts +6 -0
  331. package/dist/esm/cli/completions.d.ts.map +1 -0
  332. package/dist/esm/cli/completions.js +8 -0
  333. package/dist/esm/cli/completions.js.map +1 -0
  334. package/dist/esm/cli/credentials.d.ts +169 -0
  335. package/dist/esm/cli/credentials.d.ts.map +1 -0
  336. package/dist/esm/cli/credentials.js +614 -0
  337. package/dist/esm/cli/credentials.js.map +1 -0
  338. package/dist/esm/cli/keychain.d.ts +34 -0
  339. package/dist/esm/cli/keychain.d.ts.map +1 -0
  340. package/dist/esm/cli/keychain.js +237 -0
  341. package/dist/esm/cli/keychain.js.map +1 -0
  342. package/dist/esm/cli/list.d.ts +23 -0
  343. package/dist/esm/cli/list.d.ts.map +1 -0
  344. package/dist/esm/cli/list.js +27 -0
  345. package/dist/esm/cli/list.js.map +1 -0
  346. package/dist/esm/cli/login.d.ts +137 -0
  347. package/dist/esm/cli/login.d.ts.map +1 -0
  348. package/dist/esm/cli/login.js +2053 -0
  349. package/dist/esm/cli/login.js.map +1 -0
  350. package/dist/esm/cli/runtime.d.ts +98 -0
  351. package/dist/esm/cli/runtime.d.ts.map +1 -0
  352. package/dist/esm/cli/runtime.js +1345 -0
  353. package/dist/esm/cli/runtime.js.map +1 -0
  354. package/dist/esm/cli/toon.d.ts +6 -0
  355. package/dist/esm/cli/toon.d.ts.map +1 -0
  356. package/dist/esm/cli/toon.js +161 -0
  357. package/dist/esm/cli/toon.js.map +1 -0
  358. package/dist/esm/cli/upgrade.d.ts +28 -0
  359. package/dist/esm/cli/upgrade.d.ts.map +1 -0
  360. package/dist/esm/cli/upgrade.js +1186 -0
  361. package/dist/esm/cli/upgrade.js.map +1 -0
  362. package/dist/esm/commands/index.d.ts +47 -0
  363. package/dist/esm/commands/index.d.ts.map +1 -0
  364. package/dist/esm/commands/index.js +1195 -0
  365. package/dist/esm/commands/index.js.map +1 -0
  366. package/dist/esm/custom/browser-routing.d.ts +4 -0
  367. package/dist/esm/custom/browser-routing.d.ts.map +1 -0
  368. package/dist/esm/custom/browser-routing.js +47 -0
  369. package/dist/esm/custom/browser-routing.js.map +1 -0
  370. package/dist/esm/custom/images.d.ts +6 -0
  371. package/dist/esm/custom/images.d.ts.map +1 -0
  372. package/dist/esm/custom/images.js +68 -0
  373. package/dist/esm/custom/images.js.map +1 -0
  374. package/dist/esm/custom/machines.d.ts +20 -0
  375. package/dist/esm/custom/machines.d.ts.map +1 -0
  376. package/dist/esm/custom/machines.js +76 -0
  377. package/dist/esm/custom/machines.js.map +1 -0
  378. package/dist/esm/custom/ssh-picker.d.ts +19 -0
  379. package/dist/esm/custom/ssh-picker.d.ts.map +1 -0
  380. package/dist/esm/custom/ssh-picker.js +149 -0
  381. package/dist/esm/custom/ssh-picker.js.map +1 -0
  382. package/dist/esm/custom/ssh.d.ts +18 -0
  383. package/dist/esm/custom/ssh.d.ts.map +1 -0
  384. package/dist/esm/custom/ssh.js +147 -0
  385. package/dist/esm/custom/ssh.js.map +1 -0
  386. package/dist/esm/feedback/bundle.d.ts +41 -0
  387. package/dist/esm/feedback/bundle.d.ts.map +1 -0
  388. package/dist/esm/feedback/bundle.js +83 -0
  389. package/dist/esm/feedback/bundle.js.map +1 -0
  390. package/dist/esm/feedback/command.d.ts +6 -0
  391. package/dist/esm/feedback/command.d.ts.map +1 -0
  392. package/dist/esm/feedback/command.js +92 -0
  393. package/dist/esm/feedback/command.js.map +1 -0
  394. package/dist/esm/feedback/diagnostics.d.ts +30 -0
  395. package/dist/esm/feedback/diagnostics.d.ts.map +1 -0
  396. package/dist/esm/feedback/diagnostics.js +270 -0
  397. package/dist/esm/feedback/diagnostics.js.map +1 -0
  398. package/dist/esm/index.d.ts +4 -0
  399. package/dist/esm/index.d.ts.map +1 -0
  400. package/dist/esm/index.js +7 -0
  401. package/dist/esm/index.js.map +1 -0
  402. package/dist/esm/sdk/api-promise.d.ts +31 -0
  403. package/dist/esm/sdk/api-promise.d.ts.map +1 -0
  404. package/dist/esm/sdk/api-promise.js +68 -0
  405. package/dist/esm/sdk/api-promise.js.map +1 -0
  406. package/dist/esm/sdk/client.d.ts +267 -0
  407. package/dist/esm/sdk/client.d.ts.map +1 -0
  408. package/dist/esm/sdk/client.js +928 -0
  409. package/dist/esm/sdk/client.js.map +1 -0
  410. package/dist/esm/sdk/core/api-promise.d.ts +3 -0
  411. package/dist/esm/sdk/core/api-promise.d.ts.map +1 -0
  412. package/dist/esm/sdk/core/api-promise.js +3 -0
  413. package/dist/esm/sdk/core/api-promise.js.map +1 -0
  414. package/dist/esm/sdk/core/error.d.ts +46 -0
  415. package/dist/esm/sdk/core/error.d.ts.map +1 -0
  416. package/dist/esm/sdk/core/error.js +119 -0
  417. package/dist/esm/sdk/core/error.js.map +1 -0
  418. package/dist/esm/sdk/core/pagination.d.ts +38 -0
  419. package/dist/esm/sdk/core/pagination.d.ts.map +1 -0
  420. package/dist/esm/sdk/core/pagination.js +92 -0
  421. package/dist/esm/sdk/core/pagination.js.map +1 -0
  422. package/dist/esm/sdk/core/resource.d.ts +2 -0
  423. package/dist/esm/sdk/core/resource.d.ts.map +1 -0
  424. package/dist/esm/sdk/core/resource.js +3 -0
  425. package/dist/esm/sdk/core/resource.js.map +1 -0
  426. package/dist/esm/sdk/core/uploads.d.ts +3 -0
  427. package/dist/esm/sdk/core/uploads.d.ts.map +1 -0
  428. package/dist/esm/sdk/core/uploads.js +3 -0
  429. package/dist/esm/sdk/core/uploads.js.map +1 -0
  430. package/dist/esm/sdk/error.d.ts +3 -0
  431. package/dist/esm/sdk/error.d.ts.map +1 -0
  432. package/dist/esm/sdk/error.js +4 -0
  433. package/dist/esm/sdk/error.js.map +1 -0
  434. package/dist/esm/sdk/helpers/images.d.ts +31 -0
  435. package/dist/esm/sdk/helpers/images.d.ts.map +1 -0
  436. package/dist/esm/sdk/helpers/images.js +189 -0
  437. package/dist/esm/sdk/helpers/images.js.map +1 -0
  438. package/dist/esm/sdk/index.d.ts +7 -0
  439. package/dist/esm/sdk/index.d.ts.map +1 -0
  440. package/dist/esm/sdk/index.js +8 -0
  441. package/dist/esm/sdk/index.js.map +1 -0
  442. package/dist/esm/sdk/internal/builtin-types.d.ts +73 -0
  443. package/dist/esm/sdk/internal/builtin-types.d.ts.map +1 -0
  444. package/dist/esm/sdk/internal/builtin-types.js +3 -0
  445. package/dist/esm/sdk/internal/builtin-types.js.map +1 -0
  446. package/dist/esm/sdk/internal/detect-platform.d.ts +15 -0
  447. package/dist/esm/sdk/internal/detect-platform.d.ts.map +1 -0
  448. package/dist/esm/sdk/internal/detect-platform.js +180 -0
  449. package/dist/esm/sdk/internal/detect-platform.js.map +1 -0
  450. package/dist/esm/sdk/internal/errors.d.ts +3 -0
  451. package/dist/esm/sdk/internal/errors.d.ts.map +1 -0
  452. package/dist/esm/sdk/internal/errors.js +36 -0
  453. package/dist/esm/sdk/internal/errors.js.map +1 -0
  454. package/dist/esm/sdk/internal/headers.d.ts +43 -0
  455. package/dist/esm/sdk/internal/headers.d.ts.map +1 -0
  456. package/dist/esm/sdk/internal/headers.js +133 -0
  457. package/dist/esm/sdk/internal/headers.js.map +1 -0
  458. package/dist/esm/sdk/internal/parse.d.ts +3 -0
  459. package/dist/esm/sdk/internal/parse.d.ts.map +1 -0
  460. package/dist/esm/sdk/internal/parse.js +3 -0
  461. package/dist/esm/sdk/internal/parse.js.map +1 -0
  462. package/dist/esm/sdk/internal/qs/formats.d.ts +7 -0
  463. package/dist/esm/sdk/internal/qs/formats.d.ts.map +1 -0
  464. package/dist/esm/sdk/internal/qs/formats.js +9 -0
  465. package/dist/esm/sdk/internal/qs/formats.js.map +1 -0
  466. package/dist/esm/sdk/internal/qs/index.d.ts +10 -0
  467. package/dist/esm/sdk/internal/qs/index.d.ts.map +1 -0
  468. package/dist/esm/sdk/internal/qs/index.js +10 -0
  469. package/dist/esm/sdk/internal/qs/index.js.map +1 -0
  470. package/dist/esm/sdk/internal/qs/stringify.d.ts +3 -0
  471. package/dist/esm/sdk/internal/qs/stringify.d.ts.map +1 -0
  472. package/dist/esm/sdk/internal/qs/stringify.js +275 -0
  473. package/dist/esm/sdk/internal/qs/stringify.js.map +1 -0
  474. package/dist/esm/sdk/internal/qs/types.d.ts +57 -0
  475. package/dist/esm/sdk/internal/qs/types.d.ts.map +1 -0
  476. package/dist/esm/sdk/internal/qs/types.js +2 -0
  477. package/dist/esm/sdk/internal/qs/types.js.map +1 -0
  478. package/dist/esm/sdk/internal/qs/utils.d.ts +15 -0
  479. package/dist/esm/sdk/internal/qs/utils.d.ts.map +1 -0
  480. package/dist/esm/sdk/internal/qs/utils.js +217 -0
  481. package/dist/esm/sdk/internal/qs/utils.js.map +1 -0
  482. package/dist/esm/sdk/internal/request-options.d.ts +33 -0
  483. package/dist/esm/sdk/internal/request-options.d.ts.map +1 -0
  484. package/dist/esm/sdk/internal/request-options.js +11 -0
  485. package/dist/esm/sdk/internal/request-options.js.map +1 -0
  486. package/dist/esm/sdk/internal/shim-types.d.ts +17 -0
  487. package/dist/esm/sdk/internal/shim-types.d.ts.map +1 -0
  488. package/dist/esm/sdk/internal/shim-types.js +3 -0
  489. package/dist/esm/sdk/internal/shim-types.js.map +1 -0
  490. package/dist/esm/sdk/internal/shims.d.ts +26 -0
  491. package/dist/esm/sdk/internal/shims.d.ts.map +1 -0
  492. package/dist/esm/sdk/internal/shims.js +85 -0
  493. package/dist/esm/sdk/internal/shims.js.map +1 -0
  494. package/dist/esm/sdk/internal/to-file.d.ts +45 -0
  495. package/dist/esm/sdk/internal/to-file.d.ts.map +1 -0
  496. package/dist/esm/sdk/internal/to-file.js +88 -0
  497. package/dist/esm/sdk/internal/to-file.js.map +1 -0
  498. package/dist/esm/sdk/internal/types.d.ts +63 -0
  499. package/dist/esm/sdk/internal/types.d.ts.map +1 -0
  500. package/dist/esm/sdk/internal/types.js +3 -0
  501. package/dist/esm/sdk/internal/types.js.map +1 -0
  502. package/dist/esm/sdk/internal/uploads.d.ts +42 -0
  503. package/dist/esm/sdk/internal/uploads.d.ts.map +1 -0
  504. package/dist/esm/sdk/internal/uploads.js +148 -0
  505. package/dist/esm/sdk/internal/uploads.js.map +1 -0
  506. package/dist/esm/sdk/internal/utils/base64.d.ts +3 -0
  507. package/dist/esm/sdk/internal/utils/base64.d.ts.map +1 -0
  508. package/dist/esm/sdk/internal/utils/base64.js +33 -0
  509. package/dist/esm/sdk/internal/utils/base64.js.map +1 -0
  510. package/dist/esm/sdk/internal/utils/body.d.ts +40 -0
  511. package/dist/esm/sdk/internal/utils/body.d.ts.map +1 -0
  512. package/dist/esm/sdk/internal/utils/body.js +140 -0
  513. package/dist/esm/sdk/internal/utils/body.js.map +1 -0
  514. package/dist/esm/sdk/internal/utils/bytes.d.ts +4 -0
  515. package/dist/esm/sdk/internal/utils/bytes.d.ts.map +1 -0
  516. package/dist/esm/sdk/internal/utils/bytes.js +26 -0
  517. package/dist/esm/sdk/internal/utils/bytes.js.map +1 -0
  518. package/dist/esm/sdk/internal/utils/env.d.ts +9 -0
  519. package/dist/esm/sdk/internal/utils/env.d.ts.map +1 -0
  520. package/dist/esm/sdk/internal/utils/env.js +18 -0
  521. package/dist/esm/sdk/internal/utils/env.js.map +1 -0
  522. package/dist/esm/sdk/internal/utils/log.d.ts +52 -0
  523. package/dist/esm/sdk/internal/utils/log.d.ts.map +1 -0
  524. package/dist/esm/sdk/internal/utils/log.js +405 -0
  525. package/dist/esm/sdk/internal/utils/log.js.map +1 -0
  526. package/dist/esm/sdk/internal/utils/path.d.ts +41 -0
  527. package/dist/esm/sdk/internal/utils/path.d.ts.map +1 -0
  528. package/dist/esm/sdk/internal/utils/path.js +108 -0
  529. package/dist/esm/sdk/internal/utils/path.js.map +1 -0
  530. package/dist/esm/sdk/internal/utils/query-string.d.ts +21 -0
  531. package/dist/esm/sdk/internal/utils/query-string.d.ts.map +1 -0
  532. package/dist/esm/sdk/internal/utils/query-string.js +125 -0
  533. package/dist/esm/sdk/internal/utils/query-string.js.map +1 -0
  534. package/dist/esm/sdk/internal/utils/query.d.ts +2 -0
  535. package/dist/esm/sdk/internal/utils/query.d.ts.map +1 -0
  536. package/dist/esm/sdk/internal/utils/query.js +9 -0
  537. package/dist/esm/sdk/internal/utils/query.js.map +1 -0
  538. package/dist/esm/sdk/internal/utils/sleep.d.ts +2 -0
  539. package/dist/esm/sdk/internal/utils/sleep.d.ts.map +1 -0
  540. package/dist/esm/sdk/internal/utils/sleep.js +3 -0
  541. package/dist/esm/sdk/internal/utils/sleep.js.map +1 -0
  542. package/dist/esm/sdk/internal/utils/uuid.d.ts +5 -0
  543. package/dist/esm/sdk/internal/utils/uuid.d.ts.map +1 -0
  544. package/dist/esm/sdk/internal/utils/uuid.js +15 -0
  545. package/dist/esm/sdk/internal/utils/uuid.js.map +1 -0
  546. package/dist/esm/sdk/internal/utils/values.d.ts +18 -0
  547. package/dist/esm/sdk/internal/utils/values.d.ts.map +1 -0
  548. package/dist/esm/sdk/internal/utils/values.js +94 -0
  549. package/dist/esm/sdk/internal/utils/values.js.map +1 -0
  550. package/dist/esm/sdk/internal/utils.d.ts +8 -0
  551. package/dist/esm/sdk/internal/utils.d.ts.map +1 -0
  552. package/dist/esm/sdk/internal/utils.js +9 -0
  553. package/dist/esm/sdk/internal/utils.js.map +1 -0
  554. package/dist/esm/sdk/pagination.d.ts +3 -0
  555. package/dist/esm/sdk/pagination.d.ts.map +1 -0
  556. package/dist/esm/sdk/pagination.js +4 -0
  557. package/dist/esm/sdk/pagination.js.map +1 -0
  558. package/dist/esm/sdk/resource.d.ts +6 -0
  559. package/dist/esm/sdk/resource.d.ts.map +1 -0
  560. package/dist/esm/sdk/resource.js +8 -0
  561. package/dist/esm/sdk/resource.js.map +1 -0
  562. package/dist/esm/sdk/resources/images/images.d.ts +202 -0
  563. package/dist/esm/sdk/resources/images/images.d.ts.map +1 -0
  564. package/dist/esm/sdk/resources/images/images.js +102 -0
  565. package/dist/esm/sdk/resources/images/images.js.map +1 -0
  566. package/dist/esm/sdk/resources/images/index.d.ts +5 -0
  567. package/dist/esm/sdk/resources/images/index.d.ts.map +1 -0
  568. package/dist/esm/sdk/resources/images/index.js +4 -0
  569. package/dist/esm/sdk/resources/images/index.js.map +1 -0
  570. package/dist/esm/sdk/resources/images/uploads.d.ts +50 -0
  571. package/dist/esm/sdk/resources/images/uploads.d.ts.map +1 -0
  572. package/dist/esm/sdk/resources/images/uploads.js +24 -0
  573. package/dist/esm/sdk/resources/images/uploads.js.map +1 -0
  574. package/dist/esm/sdk/resources/images.d.ts +2 -0
  575. package/dist/esm/sdk/resources/images.d.ts.map +1 -0
  576. package/dist/esm/sdk/resources/images.js +3 -0
  577. package/dist/esm/sdk/resources/images.js.map +1 -0
  578. package/dist/esm/sdk/resources/index.d.ts +6 -0
  579. package/dist/esm/sdk/resources/index.d.ts.map +1 -0
  580. package/dist/esm/sdk/resources/index.js +5 -0
  581. package/dist/esm/sdk/resources/index.js.map +1 -0
  582. package/dist/esm/sdk/resources/machines/autoresizing.d.ts +115 -0
  583. package/dist/esm/sdk/resources/machines/autoresizing.d.ts.map +1 -0
  584. package/dist/esm/sdk/resources/machines/autoresizing.js +42 -0
  585. package/dist/esm/sdk/resources/machines/autoresizing.js.map +1 -0
  586. package/dist/esm/sdk/resources/machines/executions/executions.d.ts +341 -0
  587. package/dist/esm/sdk/resources/machines/executions/executions.d.ts.map +1 -0
  588. package/dist/esm/sdk/resources/machines/executions/executions.js +124 -0
  589. package/dist/esm/sdk/resources/machines/executions/executions.js.map +1 -0
  590. package/dist/esm/sdk/resources/machines/executions/index.d.ts +5 -0
  591. package/dist/esm/sdk/resources/machines/executions/index.d.ts.map +1 -0
  592. package/dist/esm/sdk/resources/machines/executions/index.js +4 -0
  593. package/dist/esm/sdk/resources/machines/executions/index.js.map +1 -0
  594. package/dist/esm/sdk/resources/machines/executions/logs.d.ts +103 -0
  595. package/dist/esm/sdk/resources/machines/executions/logs.d.ts.map +1 -0
  596. package/dist/esm/sdk/resources/machines/executions/logs.js +44 -0
  597. package/dist/esm/sdk/resources/machines/executions/logs.js.map +1 -0
  598. package/dist/esm/sdk/resources/machines/executions.d.ts +2 -0
  599. package/dist/esm/sdk/resources/machines/executions.d.ts.map +1 -0
  600. package/dist/esm/sdk/resources/machines/executions.js +3 -0
  601. package/dist/esm/sdk/resources/machines/executions.js.map +1 -0
  602. package/dist/esm/sdk/resources/machines/index.d.ts +9 -0
  603. package/dist/esm/sdk/resources/machines/index.d.ts.map +1 -0
  604. package/dist/esm/sdk/resources/machines/index.js +6 -0
  605. package/dist/esm/sdk/resources/machines/index.js.map +1 -0
  606. package/dist/esm/sdk/resources/machines/machines.d.ts +496 -0
  607. package/dist/esm/sdk/resources/machines/machines.d.ts.map +1 -0
  608. package/dist/esm/sdk/resources/machines/machines.js +183 -0
  609. package/dist/esm/sdk/resources/machines/machines.js.map +1 -0
  610. package/dist/esm/sdk/resources/machines/ssh.d.ts +175 -0
  611. package/dist/esm/sdk/resources/machines/ssh.d.ts.map +1 -0
  612. package/dist/esm/sdk/resources/machines/ssh.js +85 -0
  613. package/dist/esm/sdk/resources/machines/ssh.js.map +1 -0
  614. package/dist/esm/sdk/resources/machines.d.ts +2 -0
  615. package/dist/esm/sdk/resources/machines.d.ts.map +1 -0
  616. package/dist/esm/sdk/resources/machines.js +3 -0
  617. package/dist/esm/sdk/resources/machines.js.map +1 -0
  618. package/dist/esm/sdk/resources/organization/autoresizing.d.ts +86 -0
  619. package/dist/esm/sdk/resources/organization/autoresizing.d.ts.map +1 -0
  620. package/dist/esm/sdk/resources/organization/autoresizing.js +34 -0
  621. package/dist/esm/sdk/resources/organization/autoresizing.js.map +1 -0
  622. package/dist/esm/sdk/resources/organization/index.d.ts +4 -0
  623. package/dist/esm/sdk/resources/organization/index.d.ts.map +1 -0
  624. package/dist/esm/sdk/resources/organization/index.js +4 -0
  625. package/dist/esm/sdk/resources/organization/index.js.map +1 -0
  626. package/dist/esm/sdk/resources/organization/organization.d.ts +10 -0
  627. package/dist/esm/sdk/resources/organization/organization.d.ts.map +1 -0
  628. package/dist/esm/sdk/resources/organization/organization.js +9 -0
  629. package/dist/esm/sdk/resources/organization/organization.js.map +1 -0
  630. package/dist/esm/sdk/resources/organization.d.ts +2 -0
  631. package/dist/esm/sdk/resources/organization.d.ts.map +1 -0
  632. package/dist/esm/sdk/resources/organization.js +3 -0
  633. package/dist/esm/sdk/resources/organization.js.map +1 -0
  634. package/dist/esm/sdk/resources.d.ts +3 -0
  635. package/dist/esm/sdk/resources.d.ts.map +1 -0
  636. package/dist/esm/sdk/resources.js +3 -0
  637. package/dist/esm/sdk/resources.js.map +1 -0
  638. package/dist/esm/sdk/uploads.d.ts +2 -0
  639. package/dist/esm/sdk/uploads.d.ts.map +1 -0
  640. package/dist/esm/sdk/uploads.js +3 -0
  641. package/dist/esm/sdk/uploads.js.map +1 -0
  642. package/dist/esm/sdk/version.d.ts +2 -0
  643. package/dist/esm/sdk/version.d.ts.map +1 -0
  644. package/dist/esm/sdk/version.js +3 -0
  645. package/dist/esm/sdk/version.js.map +1 -0
  646. package/man/dedalus-completion.1 +35 -0
  647. package/man/dedalus-images-create.1 +126 -0
  648. package/man/dedalus-images-delete.1 +102 -0
  649. package/man/dedalus-images-import.1 +34 -0
  650. package/man/dedalus-images-list.1 +105 -0
  651. package/man/dedalus-images-retrieve.1 +102 -0
  652. package/man/dedalus-images-update.1 +108 -0
  653. package/man/dedalus-images-uploads-create.1 +112 -0
  654. package/man/dedalus-login.1 +47 -0
  655. package/man/dedalus-logout.1 +28 -0
  656. package/man/dedalus-machines-autoresizing-retrieve.1 +104 -0
  657. package/man/dedalus-machines-autoresizing-update.1 +116 -0
  658. package/man/dedalus-machines-create.1 +119 -0
  659. package/man/dedalus-machines-delete.1 +107 -0
  660. package/man/dedalus-machines-executions-create.1 +120 -0
  661. package/man/dedalus-machines-executions-delete.1 +108 -0
  662. package/man/dedalus-machines-executions-events.1 +118 -0
  663. package/man/dedalus-machines-executions-list.1 +114 -0
  664. package/man/dedalus-machines-executions-logs-create-token.1 +108 -0
  665. package/man/dedalus-machines-executions-logs-retrieve.1 +108 -0
  666. package/man/dedalus-machines-executions-output.1 +108 -0
  667. package/man/dedalus-machines-executions-retrieve.1 +108 -0
  668. package/man/dedalus-machines-list.1 +108 -0
  669. package/man/dedalus-machines-reboot.1 +107 -0
  670. package/man/dedalus-machines-resize.1 +110 -0
  671. package/man/dedalus-machines-retrieve.1 +104 -0
  672. package/man/dedalus-machines-sleep.1 +104 -0
  673. package/man/dedalus-machines-ssh-create.1 +108 -0
  674. package/man/dedalus-machines-ssh-delete.1 +108 -0
  675. package/man/dedalus-machines-ssh-list.1 +114 -0
  676. package/man/dedalus-machines-ssh-retrieve.1 +108 -0
  677. package/man/dedalus-machines-update.1 +110 -0
  678. package/man/dedalus-machines-wake.1 +104 -0
  679. package/man/dedalus-organization-autoresizing-retrieve.1 +99 -0
  680. package/man/dedalus-organization-autoresizing-update.1 +111 -0
  681. package/man/dedalus-uninstall.1 +23 -0
  682. package/man/dedalus-upgrade.1 +32 -0
  683. package/man/dedalus.1 +222 -0
  684. package/package.json +88 -4
@@ -0,0 +1,1345 @@
1
+ // File generated from our OpenAPI spec by Scalar. See README.md for details.
2
+ import { accessSync, constants as fsConstants, createReadStream, readFileSync } from 'node:fs';
3
+ import { stdin as processStdin, stdout as processStdout } from 'node:process';
4
+ import as from 'ansis';
5
+ import { Command } from 'commander';
6
+ import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
7
+ import { listRow } from './list.js';
8
+ import { encodeToon } from './toon.js';
9
+ import { takeWarnings } from './credentials.js';
10
+ import { UsageError, runLogin, runLogout, storedCredentials } from './login.js';
11
+ import { createDiagnostics, diagnosticScope } from '../feedback/diagnostics.js';
12
+ import { routeBrowserCredential } from '../custom/browser-routing.js';
13
+ const LOGIN_COMMAND = 'dedalus login';
14
+ // The sign-in command for the environment a request targeted.
15
+ const loginCommandFor = (environment) => {
16
+ if (environment === undefined)
17
+ return LOGIN_COMMAND;
18
+ const word = /^[A-Za-z0-9._-]+$/u.test(environment) ? environment : shellQuote(environment);
19
+ return LOGIN_COMMAND + ' --environment ' + word;
20
+ };
21
+ // Quotes one word for a POSIX shell so it reaches the command exactly as written.
22
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: dropping control characters is the point.
23
+ const shellQuote = (value) => "'" + value.replace(/[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/gu, '').replace(/'/gu, "'\\''") + "'";
24
+ export const createProgram = ({ SDK, binaryName, version, description, defaultFormat, defaultErrorFormat, clientOptions, commands, groups, completions, environments = [], defaultEnvironment, environmentEnv, baseUrlEnv, auth, }) => {
25
+ const selection = { environments, defaultEnvironment, environmentEnv, baseUrlEnv };
26
+ const program = usageExitCode(new Command());
27
+ program
28
+ .enablePositionalOptions()
29
+ .name(binaryName)
30
+ .description(description)
31
+ .version(version, '-v, --version')
32
+ .showHelpAfterError()
33
+ .option('--base-url <url>', 'Override the base URL for API requests')
34
+ .option('--timeout <ms>', 'Request timeout in milliseconds')
35
+ .option('--max-retries <count>', 'Number of retries for retryable failures')
36
+ .option('--format <format>', 'Output format: auto, json, jsonl, pretty, raw, toon, yaml', defaultFormat)
37
+ .option('--format-error <format>', 'Error output format: auto, json, jsonl, pretty, raw, toon, yaml', defaultErrorFormat)
38
+ .option('--transform <path>', 'Dot-path transform for data output')
39
+ .option('--transform-error <path>', 'Dot-path transform for error output')
40
+ .option('-r, --raw-output', 'Print transformed string values without JSON quotes')
41
+ .option('--debug', 'Enable SDK debug logging');
42
+ // Registered only for an API that declares more than one environment, because that is when the
43
+ // embedded SDK accepts an `environment` option at all. No Commander default is set: the SDK
44
+ // applies its own default, and a value here would look explicitly passed and trip the
45
+ // mutual-exclusion check below against a `--base-url` the user did pass on purpose.
46
+ if (environments.length > 0) {
47
+ program.option('--environment <name>', environmentFlagDescription(selection));
48
+ }
49
+ // Register configured client options (auth credentials, org headers, etc.) as global flags.
50
+ // Mirrored on each subcommand below so users can supply them either before or after the verb.
51
+ for (const option of clientOptions) {
52
+ program.option('--' + option.name + ' <value>', clientOptionDescription(option));
53
+ }
54
+ for (const definition of commands)
55
+ addGeneratedCommand(program, SDK, clientOptions, definition, groups, selection, auth);
56
+ if (environments.length > 0)
57
+ addEnvironmentsCommand(program, selection, defaultFormat);
58
+ if (completions)
59
+ addCompletionCommand(program, binaryName, completions);
60
+ if (auth)
61
+ addAuthCommands(program, auth, selection);
62
+ return program;
63
+ };
64
+ // Routes Commander's own exits through the documented status.
65
+ //
66
+ // Commander defaults every parse failure — unknown flag, missing option-argument, unknown
67
+ // command — to exit 1, which is the status reserved here for an unclassified API failure, so a
68
+ // caller branching on the status could not tell a typo from a request that actually ran and
69
+ // failed. Only a zero exit (--help, --version) is passed through unchanged; everything else
70
+ // Commander exits on is a usage error by definition.
71
+ //
72
+ // This has to be applied to every command object: `addCommand` does not copy the callback the
73
+ // way `.command()` does, so setting it on the program alone would leave the subcommands — where
74
+ // flags are actually parsed — still exiting 1.
75
+ const usageExitCode = (command) => command.exitOverride((error) => process.exit(error.exitCode === 0 ? 0 : 2));
76
+ // Prints the completion script for one shell. The scripts are generated from the same command
77
+ // table this program is built from, so they always describe the commands and flags below; nothing
78
+ // is derived from the live Commander tree, and no shell code is assembled at runtime.
79
+ const addCompletionCommand = (program, binaryName, completions) => {
80
+ const shells = Object.keys(completions);
81
+ program
82
+ .command('completion')
83
+ .description('Print a shell completion script (' + shells.join(', ') + ')')
84
+ .argument('<shell>', 'Shell to print a completion script for: ' + shells.join(', '))
85
+ .addHelpText('after', completionHelpExamples(binaryName, shells))
86
+ .action((shell) => {
87
+ // Own-property lookup only: a bare `completions[shell]` would resolve inherited keys like
88
+ // "constructor" or "__proto__" to something that is not a completion script.
89
+ const script = Object.prototype.hasOwnProperty.call(completions, shell)
90
+ ? completions[shell]
91
+ : undefined;
92
+ if (script === undefined) {
93
+ process.stderr.write("Unsupported shell '" + shell + "'. Supported shells: " + shells.join(', ') + '\n');
94
+ process.exitCode = 2;
95
+ return;
96
+ }
97
+ processStdout.write(script);
98
+ });
99
+ };
100
+ // Shows how to load each script, since every shell wires completions up differently.
101
+ const completionHelpExamples = (binaryName, shells) => {
102
+ const examples = {
103
+ bash: ' eval "$(' + binaryName + ' completion bash)" # or write it to /etc/bash_completion.d',
104
+ zsh: ' eval "$(' + binaryName + ' completion zsh)" # or write it to a directory on $fpath',
105
+ fish: ' ' + binaryName + ' completion fish | source # or write it to ~/.config/fish/completions',
106
+ };
107
+ const lines = shells.map((shell) => examples[shell]).filter((line) => line !== undefined);
108
+ return lines.length > 0 ? '\nAdd one of these to your shell startup file:\n' + lines.join('\n') : '';
109
+ };
110
+ // Help text for `--environment`, naming the environments the embedded SDK accepts and the one it
111
+ // falls back to.
112
+ //
113
+ // Kept in step with `environmentFlagDescription` in the generator's `helpers/environments.ts`, which
114
+ // renders the same sentence into the man pages, the README, and the completion scripts. It is built
115
+ // here rather than passed in because this runtime is one fixed file for every generated CLI: only
116
+ // the data handed to `createProgram` varies.
117
+ const environmentFlagDescription = ({ environments, defaultEnvironment, environmentEnv, }) => {
118
+ const names = environments.map((environment) => environmentLabel(environment.name)).join(', ');
119
+ return ('Named environment to target: ' +
120
+ names +
121
+ (environmentEnv ? ' (can also be set with ' + environmentEnv + ' env var)' : '') +
122
+ (defaultEnvironment ? ' (default: ' + environmentLabel(defaultEnvironment) + ')' : ''));
123
+ };
124
+ // Reduces a configured environment name to text that is safe on one line of the help column.
125
+ //
126
+ // Commander wraps a flag description into a column, so a newline in a name would tear the option
127
+ // list apart, and a control character would be written to the terminal as an escape sequence when
128
+ // help is printed. Only the description is reduced: `--environment` still matches against the name
129
+ // itself, and the `environments` command prints it unchanged.
130
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: dropping control characters is the point.
131
+ // Whitespace collapses first, so a line break becomes the space it reads as; dropping control
132
+ // characters first would swallow it and run the words either side of it together.
133
+ const environmentLabel = (name) => name
134
+ .replace(/\s+/gu, ' ')
135
+ .replace(/[\u0000-\u001F\u007F-\u009F]/gu, '')
136
+ .trim();
137
+ // Lists the configured environments, so what `--environment` accepts is discoverable from the CLI
138
+ // itself rather than only from its docs.
139
+ //
140
+ // It prints through the same writer every generated command uses and takes its own `--format`, so a
141
+ // script can read the URLs straight out of it (`--format json`) instead of parsing the table a human
142
+ // reads.
143
+ //
144
+ // "Default" is the environment a command without `--environment` uses, so an exported
145
+ // environment variable naming a configured one moves the mark there: every such command now goes
146
+ // to it. An unknown name leaves the configured default marked, since every other command refuses
147
+ // that value and this list is where a user looks up what it should have been.
148
+ const addEnvironmentsCommand = (program, { environments, defaultEnvironment, environmentEnv }, defaultFormat) => {
149
+ // Read when the command runs, not when it is registered, like every other environment variable.
150
+ const listRows = () => {
151
+ const ambient = ambientEnvironment(environmentEnv);
152
+ const effective = environments.some((environment) => environment.name === ambient)
153
+ ? ambient
154
+ : defaultEnvironment;
155
+ return environments.map((environment) => ({
156
+ name: environment.name,
157
+ url: environment.url,
158
+ default: environment.name === effective,
159
+ }));
160
+ };
161
+ program
162
+ .command('environments')
163
+ .description('List the named environments --environment can select')
164
+ .option('--format <format>', 'Output format: auto, json, jsonl, pretty, raw, toon, yaml')
165
+ .action(async (options) => {
166
+ // A machine format asked for by name is answered with the rows; anything else is a person
167
+ // reading, so the list is drawn the way the sign-in picker draws its own. `auto` lands here
168
+ // rather than on JSON because this command exists to be read, not parsed — a script names
169
+ // the format it wants, and `--format json` is what the README and the man page tell it to.
170
+ const rows = listRows();
171
+ const requested = options.format ?? program.opts().format;
172
+ if (requested === undefined || requested === 'auto' || requested === 'pretty') {
173
+ writeEnvironmentList(rows);
174
+ return;
175
+ }
176
+ await writeOutput(rows, { format: normalizeFormat(requested, defaultFormat), title: 'environments' });
177
+ });
178
+ };
179
+ // Draws the environments as the list a person reads: the default marked and coloured, each URL
180
+ // dimmed behind its name, through the same renderer the sign-in picker uses for its rows.
181
+ //
182
+ // Escapes only when stdout is a terminal, so a redirected list is the same text without them —
183
+ // and the names are printed as configured, since this is the one place they are the value to type
184
+ // rather than prose about it.
185
+ const writeEnvironmentList = (rows) => {
186
+ const columns = Number(processStdout.columns) || 80;
187
+ const color = Boolean(processStdout.isTTY);
188
+ const width = Math.max(0, ...rows.map((row) => row.name.length));
189
+ for (const row of rows) {
190
+ const label = row.name.padEnd(width, ' ');
191
+ const detail = row.url + (row.default ? ' (default)' : '');
192
+ processStdout.write(listRow(label, detail, { columns, selected: row.default, color }) + '\n');
193
+ }
194
+ };
195
+ // The environment the selecting variable names, or undefined when it is unset or not offered.
196
+ // Blank is unset, as the embedded SDK treats its own variables: an `export NAME=` left in a shell
197
+ // profile must not select an environment called "". Shared by `resolveEnvironment` and the
198
+ // `environments` list, so the two cannot disagree about which environment the variable picks.
199
+ const ambientEnvironment = (environmentEnv) => environmentEnv ? process.env[environmentEnv]?.trim() || undefined : undefined;
200
+ // Resolves the environment a command targets: `--environment`, else the environment variable that
201
+ // stands in for it, checked against the configured list.
202
+ //
203
+ // Every failure is a usage error: no request is built for any of them, and none is one the embedded
204
+ // SDK can report in command-line terms. An unknown name reaches the client as a key it cannot index,
205
+ // leaving it with no base URL at all, and a URL paired with an environment is rejected there with a
206
+ // message naming `baseURL: null` — a library construct a command line has no spelling for, which is
207
+ // the same reason `buildClient` restates the credential guard.
208
+ //
209
+ // `login` and `logout` resolve through here too, because the environment decides which stored
210
+ // credential a request carries: the two must agree on it or a sign-in lands where no request looks.
211
+ const resolveEnvironment = (options, command, { environments, environmentEnv, baseUrlEnv }) => {
212
+ // Answered before the option bag is read at all: with no environments configured the CLI never
213
+ // registers `--environment`, so an `environment` key here belongs to something else — a client
214
+ // option of that name, whose value would otherwise be rejected as an environment (and, for a
215
+ // credential, echoed into the error).
216
+ if (environments.length === 0)
217
+ return undefined;
218
+ const flagged = options.environment;
219
+ // A URL typed on this command line outranks an environment exported for the whole shell, the
220
+ // precedence every other option follows — so the variable is not even read, and a stale value in
221
+ // it cannot fail a command that named its URL. Trimmed, as the request path trims it: a blank
222
+ // `--base-url` is no flag at all, so it cannot outrank anything.
223
+ if (flagged === undefined && options.baseUrl?.trim())
224
+ return undefined;
225
+ const ambient = ambientEnvironment(environmentEnv);
226
+ const selected = flagged ?? ambient;
227
+ if (selected === undefined)
228
+ return undefined;
229
+ const names = environments.map((environment) => environment.name);
230
+ if (!names.includes(selected)) {
231
+ command.error("error: unknown environment '" +
232
+ environmentLabel(selected) +
233
+ "'" +
234
+ (flagged === undefined ? ' in ' + environmentEnv : '') +
235
+ '. Available environments: ' +
236
+ names.map(environmentLabel).join(', '), { exitCode: 2 });
237
+ }
238
+ if (flagged !== undefined) {
239
+ // Each names a base URL on its own, so honoring either would silently discard the other.
240
+ // Trimmed like every other reading of the flag: a blank `--base-url` names no URL, so it
241
+ // conflicts with nothing, and the variable form below already treats it that way.
242
+ if (options.baseUrl?.trim()) {
243
+ command.error('error: --environment cannot be combined with --base-url, which already names the URL to call', { exitCode: 2 });
244
+ }
245
+ return selected;
246
+ }
247
+ // Two exported variables, each naming where requests go, with nothing to say which was meant.
248
+ // The embedded SDK refuses a base URL beside an environment for the same reason, so this is not
249
+ // settled by picking one: a production URL exported last week must not quietly beat a staging
250
+ // environment exported today, or the other way round.
251
+ if (baseUrlEnv && process.env[baseUrlEnv]?.trim()) {
252
+ command.error('error: ' +
253
+ environmentEnv +
254
+ ' and ' +
255
+ baseUrlEnv +
256
+ ' are both set, and each names where requests go. Unset one, or pass --environment or --base-url to choose.', { exitCode: 2 });
257
+ }
258
+ return selected;
259
+ };
260
+ // `login`/`logout` sit at the top level unless the API already claims one of those names, in
261
+ // which case they fall back under an `auth` parent. That parent is created here rather than
262
+ // from the command table, so it needs its own description or `--help` lists a bare `auth`,
263
+ // which is the very thing the group table exists to prevent. Both paths are described so
264
+ // whichever one creates the group first carries it.
265
+ const authGroups = (auth) => [
266
+ { commandPath: auth.loginPath.slice(0, -1), description: 'Sign in and out' },
267
+ { commandPath: auth.logoutPath.slice(0, -1), description: 'Sign in and out' },
268
+ ];
269
+ const addAuthCommands = (program, auth, selection) => {
270
+ const flows = auth.methods.map((method) => method.name).join(', ');
271
+ const login = usageExitCode(new Command(auth.loginPath.at(-1) ?? 'login'))
272
+ .description('Sign in and save credentials for later commands')
273
+ .showHelpAfterError()
274
+ .option('--base-url <url>', 'Sign in against this base URL instead of the default')
275
+ .option('--flow <name>', 'Sign-in flow to use: ' + flows)
276
+ .addHelpText('after', authFlowHelp(auth))
277
+ .action(async (_options, command) => {
278
+ const options = command.optsWithGlobals();
279
+ const environment = resolveEnvironment(options, command, selection);
280
+ await runAuthCommand(() => runLogin(auth, credentialBaseUrl(auth, options.baseUrl, environment), options.flow, loginCommandFor(environment)));
281
+ });
282
+ addEnvironmentOption(login, selection);
283
+ ensureCommandPath(program, auth.loginPath.slice(0, -1), authGroups(auth)).addCommand(login);
284
+ const logout = usageExitCode(new Command(auth.logoutPath.at(-1) ?? 'logout'))
285
+ .description('Forget saved credentials, and revoke them if the provider supports it')
286
+ .showHelpAfterError()
287
+ .option('--base-url <url>', 'Forget the credentials saved for this base URL (not with --all)')
288
+ .option('--all', 'Forget every saved credential, for every base URL')
289
+ .action(async (_options, command) => {
290
+ const options = command.optsWithGlobals();
291
+ if (options.all === true) {
292
+ if (options.baseUrl?.trim()) {
293
+ command.error('error: --base-url cannot be combined with --all, which forgets the credentials of every base URL', { exitCode: 2 });
294
+ }
295
+ if (selection.environments.length > 0 && options.environment !== undefined) {
296
+ command.error('error: --environment cannot be combined with --all, which forgets the credentials of every environment', { exitCode: 2 });
297
+ }
298
+ await runAuthCommand(() => runLogout(auth, '', true));
299
+ return;
300
+ }
301
+ const environment = resolveEnvironment(options, command, selection);
302
+ await runAuthCommand(() => runLogout(auth, credentialBaseUrl(auth, options.baseUrl, environment), false));
303
+ });
304
+ addEnvironmentOption(logout, selection);
305
+ ensureCommandPath(program, auth.logoutPath.slice(0, -1), authGroups(auth)).addCommand(logout);
306
+ };
307
+ // Lets `login` and `logout` take `--environment` after the verb, as every request command does.
308
+ const addEnvironmentOption = (command, selection) => {
309
+ if (selection.environments.length > 0)
310
+ command.option('--environment <name>', environmentFlagDescription(selection));
311
+ };
312
+ const runAuthCommand = async (run) => {
313
+ try {
314
+ processStdout.write((await run()) + '\n');
315
+ }
316
+ catch (error) {
317
+ process.stderr.write((error instanceof Error ? error.message : String(error)) + '\n');
318
+ process.exitCode = error instanceof UsageError ? 2 : 10;
319
+ }
320
+ finally {
321
+ for (const warning of takeWarnings())
322
+ process.stderr.write(warning + '\n');
323
+ }
324
+ };
325
+ // The base URL a stored credential is filed under for this invocation. One resolver for `login`,
326
+ // `logout` and the request path, so a sign-in lands exactly where a later request looks.
327
+ const credentialBaseUrl = (auth, flag, environment) => flag?.trim() ||
328
+ auth.environments?.find((entry) => entry.name === environment)?.url ||
329
+ process.env[auth.baseUrlEnv]?.trim() ||
330
+ auth.defaultBaseUrl;
331
+ // Lists the flows by name so `--flow` can be used without first running the picker.
332
+ const authFlowHelp = (auth) => '\nSign-in flows:\n' + auth.methods.map((method) => ' ' + method.name + ' ' + method.label).join('\n');
333
+ const clientOptionDescription = (option) => {
334
+ const parts = [];
335
+ if (option.description)
336
+ parts.push(option.description);
337
+ if (option.env)
338
+ parts.push('(can also be set with ' + option.env + ' env var)');
339
+ // Stated last, matching resolution order: the flag wins, then the env var, then this value.
340
+ if (option.defaultValue !== undefined)
341
+ parts.push('(defaults to ' + option.defaultValue + ')');
342
+ return parts.join(' ');
343
+ };
344
+ // Constructs the embedded client, restating its credential guard in command-line terms.
345
+ //
346
+ // The SDK's own guard is worded for a library caller — "instantiate the X client with an apiKey
347
+ // option, like new X({ apiKey: ... })" — which names something a CLI user cannot do. That wording
348
+ // is fixed upstream to match the reference SDKs byte for byte, so it is restated here rather than
349
+ // changed there. The environment variable is the anchor for the match: it is the one token of the
350
+ // message this runtime also knows, so an unrelated constructor failure is rethrown untouched
351
+ // instead of being reported as a missing credential.
352
+ const buildClient = (SDK, options, clientOptions, environment) => {
353
+ try {
354
+ return new SDK(options);
355
+ }
356
+ catch (error) {
357
+ const message = error instanceof Error ? error.message : String(error);
358
+ const missing = clientOptions.find((option) => option.env !== undefined && message.includes(option.env));
359
+ if (!missing)
360
+ throw error;
361
+ throw new Error('Missing credential: run `' +
362
+ loginCommandFor(environment) +
363
+ '`, pass --' +
364
+ missing.name +
365
+ ' <value>' +
366
+ (missing.env ? ' or set the ' + missing.env + ' environment variable' : '') +
367
+ '.');
368
+ }
369
+ };
370
+ const addGeneratedCommand = (program, SDK, clientOptions, definition, groups, selection, auth) => {
371
+ const parent = ensureCommandPath(program, definition.commandPath.slice(0, -1), groups);
372
+ const commandName = definition.commandPath.at(-1) ?? definition.methodName;
373
+ const command = usageExitCode(new Command(commandName))
374
+ .description(definition.summary ?? definition.description ?? '')
375
+ .showHelpAfterError()
376
+ .option('--base-url <url>', 'Override the base URL for API requests')
377
+ .option('--timeout <ms>', 'Request timeout in milliseconds')
378
+ .option('--max-retries <count>', 'Number of retries for retryable failures')
379
+ .option('--format <format>', 'Output format: auto, json, jsonl, pretty, raw, toon, yaml')
380
+ .option('--format-error <format>', 'Error output format: auto, json, jsonl, pretty, raw, toon, yaml')
381
+ .option('--transform <path>', 'Dot-path transform for data output')
382
+ .option('--transform-error <path>', 'Dot-path transform for error output')
383
+ .option('-r, --raw-output', 'Print transformed string values without JSON quotes')
384
+ .option('--debug', 'Enable SDK debug logging');
385
+ // Mirrored on the subcommand for the same reason the client options below are: so it can be
386
+ // passed before or after the verb. Registered only when the API declares more than one
387
+ // environment, matching the program-level registration.
388
+ if (selection.environments.length > 0) {
389
+ command.option('--environment <name>', environmentFlagDescription(selection));
390
+ }
391
+ // Mirror configured client-option flags on the subcommand so they can appear before or after the verb.
392
+ for (const option of clientOptions) {
393
+ command.option('--' + option.name + ' <value>', clientOptionDescription(option));
394
+ }
395
+ if (definition.iterable)
396
+ command.option('--max-items <count>', 'Maximum number of streamed items to print; use -1 for unlimited');
397
+ // Positionals are registered as optional Commander arguments because each one is also
398
+ // accepted as an equivalent flag (e.g. `workers retrieve wkr_1` or `workers retrieve --id
399
+ // wkr_1`); requiredness is enforced at call time once both spellings have been merged.
400
+ for (const positional of definition.positional) {
401
+ command.argument('[' + positional.name + ']', positional.description ?? '');
402
+ }
403
+ for (const flag of definition.flags) {
404
+ // A file flag takes a filesystem path, so it says so: the placeholder is the only hint in
405
+ // `--help` that the value is opened rather than sent verbatim.
406
+ const isPath = flag.valueKind === 'file' || flag.itemKind === 'file';
407
+ const value = flag.valueKind === 'boolean' ? '' : isPath ? ' <path>' : ' <value>';
408
+ if (flag.name === 'send') {
409
+ command.option('--' + flag.name + value, flag.description ?? '', (value, previous) => [...(previous ?? []), value]);
410
+ continue;
411
+ }
412
+ // Array params are repeatable single-value switches (`--status a --status b`); the custom
413
+ // option-argument accumulates each occurrence so Commander does not overwrite the prior value.
414
+ if (flag.repeatable) {
415
+ command.option('--' + flag.name + value, flag.description ?? '', (value, previous) => [...(previous ?? []), value]);
416
+ continue;
417
+ }
418
+ command.option('--' + flag.name + value, flag.description ?? '');
419
+ }
420
+ // Flag spelling for path params (`--id wkr_1`). `flagName` is absent when the name is already
421
+ // taken — by a global flag, a client option, a generated flag, or Commander's own `--help`, which
422
+ // lives in `_helpOption` where no scan of `command.options` could see it — and the param is then
423
+ // accepted positionally only. The decision is made once, by the emitter, so the man pages and the
424
+ // completion scripts advertise exactly the spellings registered here.
425
+ for (const positional of definition.positional) {
426
+ if (!positional.flagName)
427
+ continue;
428
+ command.option('--' + positional.flagName + ' <value>', positional.description ?? '');
429
+ }
430
+ command.action(async (...args) => {
431
+ const command = args.at(-1);
432
+ if (!(command instanceof Command))
433
+ throw new Error('Expected Commander command context');
434
+ const positionalValues = args.slice(0, -1);
435
+ await runGeneratedCommand(SDK, clientOptions, definition, command, positionalValues, selection, auth);
436
+ });
437
+ parent.addCommand(command);
438
+ };
439
+ const ensureCommandPath = (program, path, groups) => {
440
+ let parent = program;
441
+ const walked = [];
442
+ for (const part of path) {
443
+ walked.push(part);
444
+ const existing = parent.commands.find((command) => command.name() === part);
445
+ if (existing) {
446
+ parent = existing;
447
+ continue;
448
+ }
449
+ const next = usageExitCode(new Command(part)).showHelpAfterError();
450
+ // A group is created as the parent of its first command, so this is the only moment it can be
451
+ // described: Commander never revisits it, and an undescribed group is a bare name in --help.
452
+ const description = groupDescription(groups, walked);
453
+ if (description)
454
+ next.description(description);
455
+ parent.addCommand(next);
456
+ parent = next;
457
+ }
458
+ return parent;
459
+ };
460
+ // Matched on the full walked path rather than the last segment, so a nested group is described by
461
+ // the resource it was actually built from and two resources sharing a leaf name cannot collide.
462
+ const groupDescription = (groups, path) => groups?.find((group) => group.commandPath.length === path.length &&
463
+ group.commandPath.every((part, index) => part === path[index]))?.description;
464
+ const runGeneratedCommand = async (SDK, clientOptions, definition, command, positionalValues, selection, auth) => {
465
+ const rootOptions = command.optsWithGlobals();
466
+ const commandOptions = command.opts();
467
+ // Resolved before the request is set up, not inside the try below: a rejected `--environment`
468
+ // is a usage error reported by Commander, and running it through the catch that classifies API
469
+ // failures would re-report it as one.
470
+ const environment = resolveEnvironment(rootOptions, command, selection);
471
+ const maxItems = definition.iterable ? normalizeMaxItems(commandOptions.maxItems) : undefined;
472
+ const outputOptions = {
473
+ format: normalizeFormat(commandOptions.format ?? rootOptions.format, 'auto'),
474
+ title: definition.commandPath.join(' '),
475
+ ...((commandOptions.transform ?? rootOptions.transform)
476
+ ? { transform: commandOptions.transform ?? rootOptions.transform }
477
+ : {}),
478
+ ...(commandOptions.rawOutput || rootOptions.rawOutput ? { rawOutput: true } : {}),
479
+ ...(maxItems !== undefined ? { maxItems } : {}),
480
+ };
481
+ const errorOptions = {
482
+ format: normalizeFormat(commandOptions.formatError ?? rootOptions.formatError, 'auto'),
483
+ ...((commandOptions.transformError ?? rootOptions.transformError)
484
+ ? { transform: commandOptions.transformError ?? rootOptions.transformError }
485
+ : {}),
486
+ ...(commandOptions.rawOutput || rootOptions.rawOutput ? { rawOutput: true } : {}),
487
+ };
488
+ let diagnostics;
489
+ try {
490
+ const clientConfig = await sdkClientOptions(rootOptions, command, clientOptions, auth, definition.authClientKeyRequirements, environment);
491
+ const call = await callArguments(definition, command.opts(), positionalValues);
492
+ const organization = call.params['X-Dedalus-Org-Id'];
493
+ const scopeOptions = organization === undefined ? clientConfig : { ...clientConfig, dedalusOrgID: organization };
494
+ diagnostics = createDiagnostics('dedalus ' + definition.commandPath.join(' '), diagnosticScope(scopeOptions));
495
+ const client = buildClient(SDK, { ...clientConfig, fetch: diagnostics.fetch }, clientOptions, environment);
496
+ const method = sdkMethod(client, definition);
497
+ // Required positionals are validated here (not by Commander) because each one may also be
498
+ // supplied through its flag spelling or stdin; `call.params` has all sources merged.
499
+ for (const param of definition.positional) {
500
+ if (param.required && call.params[param.paramKey] === undefined) {
501
+ command.error("error: missing required argument '" + param.name + "'", { exitCode: 2 });
502
+ }
503
+ }
504
+ const result = method(...call.args);
505
+ if (definition.transport === 'websocket') {
506
+ await handleWebSocket(result, call.params, outputOptions);
507
+ return;
508
+ }
509
+ if (definition.iterable && !definition.streaming) {
510
+ await writePaginated(result, outputOptions);
511
+ return;
512
+ }
513
+ const resolved = await result;
514
+ if (definition.streaming) {
515
+ await writeIterable(resolved, outputOptions);
516
+ return;
517
+ }
518
+ await writeOutput(resolved, outputOptions);
519
+ }
520
+ catch (error) {
521
+ diagnostics?.record({ kind: 'command_failure' });
522
+ await writeError(error, errorOptions, clientOptions, SDK, environment);
523
+ process.exitCode = errorExitCode(error, SDK);
524
+ }
525
+ finally {
526
+ diagnostics?.record({ kind: 'command_complete' });
527
+ }
528
+ };
529
+ // Generated commands pass operation-specific requirements. Custom commands use the API-wide requirements.
530
+ export const sdkClientOptions = async (options, command, clientOptions, auth, requirements = auth?.requirements ?? [], environment = undefined) => {
531
+ // Forward configured client-option flags (auth keys, org headers, etc.) to the embedded SDK
532
+ // using the SDK-facing camelCased key. Only forward values that were explicitly set so the
533
+ // SDK's own env-var fallback keeps working when no CLI flag was passed.
534
+ const rootOptions = options;
535
+ const commandOptions = command.opts();
536
+ const forwarded = {};
537
+ for (const option of clientOptions) {
538
+ const commandValue = commandOptions[option.optionKey];
539
+ const value = commandValue === undefined ? rootOptions[option.optionKey] : commandValue;
540
+ if (value === undefined)
541
+ continue;
542
+ // A credential is exactly the kind of value that belongs in a file rather than in shell
543
+ // history, so a client option reads `@path` like any other flag. It never reaches the
544
+ // structured decoding below it: an SDK client option is always a scalar.
545
+ forwarded[option.sdkKey] = typeof value === 'string' ? clientOptionValue(value, option) : value;
546
+ }
547
+ await applyStoredCredentials(forwarded, clientOptions, requirements, auth, options.baseUrl, environment);
548
+ const organization = commandOptions['xDedalusOrgId'] ?? rootOptions['xDedalusOrgId'] ??
549
+ forwarded['dedalusOrgID'] ?? process.env['DEDALUS_ORG_ID'];
550
+ if (organization !== undefined)
551
+ forwarded['dedalusOrgID'] = organization;
552
+ return routeBrowserCredential({
553
+ ...(options.baseUrl?.trim() ? { baseURL: options.baseUrl.trim() } : {}),
554
+ ...(environment !== undefined ? { environment, baseURL: null } : {}),
555
+ ...(options.timeout ? { timeout: Number(options.timeout) } : {}),
556
+ ...(options.maxRetries ? { maxRetries: Number(options.maxRetries) } : {}),
557
+ ...(options.debug ? { logLevel: 'debug' } : {}),
558
+ ...forwarded,
559
+ defaultHeaders: {
560
+ 'X-Request-ID': null,
561
+ ...(organization ? { 'X-Dedalus-Org-Id': organization } : {}),
562
+ 'X-Scalar-Lang': 'cli',
563
+ 'X-Scalar-Runtime': 'cli',
564
+ 'X-Scalar-CLI-Command': command.name(),
565
+ 'X-Dedalus-CLI-Command': commandPath(command),
566
+ 'User-Agent': 'Dedalus/CLI ' + rootCommand(command).version(),
567
+ },
568
+ });
569
+ };
570
+ const applyStoredCredentials = async (forwarded, clientOptions, authClientKeyRequirements, auth, baseUrl, environment) => {
571
+ if (!auth)
572
+ return;
573
+ if (authClientKeyRequirements.length === 0)
574
+ return;
575
+ const hasExplicitValue = (option) => forwarded[option.sdkKey] !== undefined || Boolean(option.env && (process.env[option.env] ?? '').trim());
576
+ const explicit = authClientKeyRequirements.find((keys) => keys.every((key) => {
577
+ const option = clientOptions.find((candidate) => candidate.clientKey === key);
578
+ return option !== undefined && hasExplicitValue(option);
579
+ }));
580
+ if (explicit)
581
+ return;
582
+ const stored = await storedCredentials(auth, credentialBaseUrl(auth, baseUrl, environment));
583
+ const isSatisfiable = (keys) => keys.every((key) => {
584
+ const option = clientOptions.find((candidate) => candidate.clientKey === key);
585
+ if (!option)
586
+ return false;
587
+ return hasExplicitValue(option) || (typeof stored[key] === 'string' && stored[key] !== '');
588
+ });
589
+ const selected = authClientKeyRequirements.find((keys) => isSatisfiable(keys)) ?? authClientKeyRequirements[0] ?? [];
590
+ const pending = clientOptions.filter((option) => option.auth && selected.includes(option.clientKey) && !hasExplicitValue(option));
591
+ for (const option of pending) {
592
+ // Own-property lookup only: the store is a JSON file, so a key like "constructor"
593
+ // would otherwise resolve to something off Object.prototype rather than a credential.
594
+ if (!Object.prototype.hasOwnProperty.call(stored, option.clientKey))
595
+ continue;
596
+ const value = stored[option.clientKey];
597
+ if (typeof value === 'string' && value)
598
+ forwarded[option.sdkKey] = value;
599
+ }
600
+ };
601
+ const commandPath = (command) => {
602
+ const parts = [];
603
+ for (let current = command; current; current = current.parent)
604
+ parts.unshift(current.name());
605
+ return parts.join(' ');
606
+ };
607
+ const rootCommand = (command) => {
608
+ let root = command;
609
+ while (root.parent)
610
+ root = root.parent;
611
+ return root;
612
+ };
613
+ const sdkMethod = (client, definition) => {
614
+ let target = client;
615
+ for (const resource of definition.resourcePath) {
616
+ target = target[resource];
617
+ }
618
+ const method = target[definition.methodName];
619
+ if (typeof method !== 'function') {
620
+ throw new Error('Generated CLI could not find SDK method ' +
621
+ [...definition.resourcePath, definition.methodName].join('.'));
622
+ }
623
+ return method.bind(target);
624
+ };
625
+ const callArguments = async (definition, options, positionalValues) => {
626
+ const positionalParams = {};
627
+ definition.positional.forEach((param, index) => {
628
+ // `optionKey` is only this positional's when it was given a flag spelling. Without one the key
629
+ // belongs to whatever took the name — a `--environment` selector, say — and reading it would
630
+ // fill the path param with that flag's value and satisfy the required-argument check below.
631
+ const value = positionalValues[index] ?? (param.flagName === undefined ? undefined : options[param.optionKey]);
632
+ if (value !== undefined)
633
+ positionalParams[param.paramKey] = coerceValue(value, param.valueKind, undefined, param.name);
634
+ });
635
+ const flagParams = {};
636
+ for (const flag of definition.flags) {
637
+ if (flag.objectPath)
638
+ continue;
639
+ const value = options[flag.optionKey];
640
+ if (value !== undefined)
641
+ flagParams[flag.paramKey] = coerceValue(value, flag.valueKind, flag.itemKind, '--' + flag.name);
642
+ }
643
+ // Dotted leaf flags (e.g. `--address.city`) are applied after the JSON-blob flag for the same
644
+ // param so an explicit leaf value always overrides the corresponding blob field.
645
+ for (const flag of definition.flags) {
646
+ if (!flag.objectPath || flag.objectPath.length === 0)
647
+ continue;
648
+ const value = options[flag.optionKey];
649
+ if (value === undefined)
650
+ continue;
651
+ flagParams[flag.paramKey] = setNestedValue(flagParams[flag.paramKey], flag.objectPath, coerceValue(value, flag.valueKind, flag.itemKind, '--' + flag.name));
652
+ }
653
+ const stdin = await readStdinValue();
654
+ const params = mergeObjects(stdin, { ...flagParams, ...positionalParams });
655
+ const positionalArgs = definition.positional.map((param) => params[param.paramKey]);
656
+ // A positional path param is handed to the SDK method as a leading argument, and the method
657
+ // never destructures it back out of `params` — only the path params it did *not* take
658
+ // positionally are pulled out there. Leaving it in `params` makes it fall through the
659
+ // method's `...query` / `...body` rest and reach the wire a second time, as
660
+ // `/version/1.0.0?semver=1.0.0` or as a `namespace` field in a body that has no such field.
661
+ //
662
+ // Dropping it cannot remove a field the call needs: a positional whose name collides with a
663
+ // params field is already disambiguated when the command table is built (a body `slug` beside
664
+ // a path one leaves the positional as `slug2`), so the two never share a key.
665
+ const omitted = definition.positional.map((param) => param.paramKey);
666
+ if (definition.transport === 'websocket')
667
+ omitted.push('send');
668
+ const sdkParams = omitParams(params, omitted);
669
+ if (definition.callShape === 'options')
670
+ return { args: [...positionalArgs, undefined], params };
671
+ if (definition.callShape === 'body')
672
+ return { args: [...positionalArgs, bodyValue(sdkParams, definition), undefined], params };
673
+ return { args: [...positionalArgs, paramsValue(sdkParams, definition), undefined], params };
674
+ };
675
+ const paramsValue = (params, definition) => {
676
+ if (definition.bodyParamKey === undefined)
677
+ return params;
678
+ const body = params[definition.bodyParamKey];
679
+ if (body === undefined)
680
+ return params;
681
+ // Scoped union bodies with headers are typed as the params root. A `--body` JSON blob therefore
682
+ // needs to sit beside header/query flags, or be passed as the root when it cannot be merged.
683
+ if (!isPlainObject(body))
684
+ return body;
685
+ return mergeObjects(body, omitParams(params, [definition.bodyParamKey]));
686
+ };
687
+ const bodyValue = (params, definition) => {
688
+ // A non-flattenable body is forwarded as a single value: the SDK method takes that param
689
+ // directly, so return it bare. Its dotted leaf flags (`--payload.city`) share this key and have
690
+ // already been merged into the param value, so counting body flags would wrongly treat one
691
+ // logical body as many and re-wrap it under the param key. `params.body` covers a bare value
692
+ // piped via stdin.
693
+ if (definition.bodyParamKey !== undefined) {
694
+ if (params[definition.bodyParamKey] !== undefined)
695
+ return params[definition.bodyParamKey];
696
+ if (params.body !== undefined)
697
+ return params.body;
698
+ }
699
+ // A flattenable body is reassembled from its per-property flags into a single object. Leaf flags
700
+ // share their parent property key, so keying by paramKey collapses them back onto that property.
701
+ const bodyFlags = definition.flags.filter((flag) => flag.location === 'body' && flag.paramKey !== 'send');
702
+ const body = {};
703
+ for (const flag of bodyFlags) {
704
+ if (params[flag.paramKey] !== undefined)
705
+ body[flag.paramKey] = params[flag.paramKey];
706
+ }
707
+ return Object.keys(body).length > 0 ? body : params;
708
+ };
709
+ const readStdinValue = async () => {
710
+ if (processStdin.isTTY)
711
+ return {};
712
+ const source = await readStdinSource();
713
+ if (!source)
714
+ return {};
715
+ const parsed = parseStructuredValue(source);
716
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed))
717
+ return parsed;
718
+ return { body: parsed };
719
+ };
720
+ const readStdinSource = async () => {
721
+ const chunks = [];
722
+ const done = new Promise((resolve, reject) => {
723
+ const cleanup = () => {
724
+ clearTimeout(timer);
725
+ processStdin.off('data', onData);
726
+ processStdin.off('end', onEnd);
727
+ processStdin.off('error', onError);
728
+ processStdin.pause();
729
+ };
730
+ const onData = (chunk) => {
731
+ clearTimeout(timer);
732
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
733
+ };
734
+ const onEnd = () => {
735
+ cleanup();
736
+ resolve(Buffer.concat(chunks).toString('utf8').trim());
737
+ };
738
+ const onError = (error) => {
739
+ cleanup();
740
+ reject(error);
741
+ };
742
+ const timer = setTimeout(() => {
743
+ cleanup();
744
+ resolve('');
745
+ }, 25);
746
+ processStdin.on('data', onData);
747
+ processStdin.on('end', onEnd);
748
+ processStdin.on('error', onError);
749
+ });
750
+ processStdin.resume();
751
+ return done;
752
+ };
753
+ // An empty argument is an empty STRING, not YAML's empty document. `--tag ''` asks for one
754
+ // empty tag; parsing it as YAML answers `null`, which the request builder then refuses
755
+ // ("Received null for "tags[]""). Only the empty case is special-cased: `--tag null` still
756
+ // means null, and every other value keeps the JSON-then-YAML reading.
757
+ const parseStructuredValue = (source) => {
758
+ if (source === '')
759
+ return source;
760
+ try {
761
+ return JSON.parse(source);
762
+ }
763
+ catch {
764
+ return parseYaml(source);
765
+ }
766
+ };
767
+ const setNestedValue = (target, path, value) => {
768
+ const root = isPlainObject(target) ? { ...target } : {};
769
+ let cursor = root;
770
+ for (const segment of path.slice(0, -1)) {
771
+ const existing = cursor[segment];
772
+ const next = isPlainObject(existing) ? { ...existing } : {};
773
+ cursor[segment] = next;
774
+ cursor = next;
775
+ }
776
+ const leaf = path.at(-1);
777
+ if (leaf !== undefined)
778
+ cursor[leaf] = value;
779
+ return root;
780
+ };
781
+ const isPlainObject = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
782
+ const mergeObjects = (base, overlay) => ({
783
+ ...base,
784
+ ...Object.fromEntries(Object.entries(overlay).filter(([, value]) => value !== undefined)),
785
+ });
786
+ const omitParams = (params, names) => {
787
+ const out = { ...params };
788
+ for (const name of names)
789
+ delete out[name];
790
+ return out;
791
+ };
792
+ // A file argument is spelled `@path`, the spelling curl and the reference CLIs already use, so a
793
+ // command written against one of those keeps working here. A command line carries a path but never
794
+ // the bytes behind it, and without this the path itself went on the wire as the value.
795
+ const FILE_ARG_PREFIX = '@';
796
+ // `@file://x` sends the bytes as text and `@data://x` sends them base64-encoded; a bare `@x` lets the
797
+ // file decide, which is what a caller who has not thought about encoding means.
798
+ const FILE_ARG_TEXT_SCHEME = 'file://';
799
+ const FILE_ARG_DATA_SCHEME = 'data://';
800
+ // `\@value` is how a value that genuinely begins with `@` (an npm scope, a handle) is spelled.
801
+ const ESCAPED_FILE_ARG_PREFIX = '\\@';
802
+ // The part after `@`, or `undefined` when the value is not a file argument at all.
803
+ const fileArgRest = (value) => value.startsWith(FILE_ARG_PREFIX) ? value.slice(FILE_ARG_PREFIX.length) : undefined;
804
+ // Drops the escape from `\@literal`, which is the only thing a leading backslash means here.
805
+ const unescapeFileArg = (value) => value.startsWith(ESCAPED_FILE_ARG_PREFIX) ? value.slice(1) : value;
806
+ // Resolves one scalar value: a file argument becomes the file's contents, `\@` becomes a literal `@`,
807
+ // and anything else is passed through untouched.
808
+ const flagValue = (value, label) => {
809
+ const rest = fileArgRest(value);
810
+ if (rest === undefined) {
811
+ const unescaped = unescapeFileArg(value);
812
+ return { text: unescaped, origin: unescaped === value ? 'literal' : 'escaped' };
813
+ }
814
+ if (rest.startsWith(FILE_ARG_TEXT_SCHEME)) {
815
+ return {
816
+ text: readFileArg(rest.slice(FILE_ARG_TEXT_SCHEME.length), label, true).toString('utf8'),
817
+ origin: 'file',
818
+ };
819
+ }
820
+ if (rest.startsWith(FILE_ARG_DATA_SCHEME)) {
821
+ return {
822
+ text: readFileArg(rest.slice(FILE_ARG_DATA_SCHEME.length), label, true).toString('base64'),
823
+ origin: 'encoded',
824
+ };
825
+ }
826
+ const bytes = readFileArg(rest, label, false);
827
+ // Bytes that are not text cannot travel as a JSON string, so they are base64-encoded. A caller who
828
+ // wants one encoding regardless of what the file holds spells it with `@file://` or `@data://`.
829
+ return looksBinary(bytes)
830
+ ? { text: bytes.toString('base64'), origin: 'encoded' }
831
+ : { text: bytes.toString('utf8'), origin: 'file' };
832
+ };
833
+ // A `file://` or `data://` value is a URL and is percent-decoded as one; a bare `@path` is not a URL
834
+ // and is opened exactly as typed, or a file genuinely named `100%20pct.txt` would be looked up as
835
+ // `100 pct.txt`.
836
+ const readFileArg = (source, label, url) => {
837
+ const path = url ? fileUrlToPath(source) : source;
838
+ try {
839
+ return readFileSync(path);
840
+ }
841
+ catch (error) {
842
+ throw new Error(fileArgFailure(label, path, error));
843
+ }
844
+ };
845
+ // A missing file names the flag, the path, and the escape, because the likeliest reason `@abe` names
846
+ // nothing on disk is that it was meant as a literal value.
847
+ const fileArgFailure = (label, path, error) => label +
848
+ ': could not read ' +
849
+ path +
850
+ ' (' +
851
+ (error instanceof Error ? error.message : String(error)) +
852
+ '). Write \\@ to send a literal value beginning with @.';
853
+ // Bytes are text when they round-trip through UTF-8. A NUL byte is checked separately because it is
854
+ // legal UTF-8, so it round-trips, yet no text field is meant to carry one.
855
+ const looksBinary = (bytes) => bytes.includes(0) || !Buffer.from(bytes.toString('utf8'), 'utf8').equals(bytes);
856
+ // `file://./x` and `file:///abs/x` are both spelled by hand often enough to accept: the first is not
857
+ // a legal file URL, so `new URL()` is not used and the remainder is treated as a path. The slash
858
+ // before a drive letter (`file:///C:/x`) is the Windows spelling of an absolute path and is dropped,
859
+ // since `/C:/x` names nothing.
860
+ const fileUrlToPath = (rest) => {
861
+ const decoded = decodeFileUrl(rest);
862
+ return /^\/[A-Za-z]:/u.test(decoded) ? decoded.slice(1) : decoded;
863
+ };
864
+ // Percent-decoding applies only when the value decodes cleanly. A literal `%` in a file name is
865
+ // likelier than a hand-encoded one, and letting `decodeURIComponent` throw would surface a bare
866
+ // "URI error" naming neither the flag nor the path.
867
+ const decodeFileUrl = (rest) => {
868
+ try {
869
+ return decodeURIComponent(rest);
870
+ }
871
+ catch {
872
+ return rest;
873
+ }
874
+ };
875
+ // The path a file-kinded flag names, with or without the `@`. An upload value is a path by
876
+ // definition, so the prefix is optional there and both spellings open the same file.
877
+ const uploadPath = (value) => {
878
+ const rest = fileArgRest(value);
879
+ if (rest === undefined)
880
+ return unescapeFileArg(value);
881
+ if (rest.startsWith(FILE_ARG_TEXT_SCHEME))
882
+ return fileUrlToPath(rest.slice(FILE_ARG_TEXT_SCHEME.length));
883
+ if (rest.startsWith(FILE_ARG_DATA_SCHEME))
884
+ return fileUrlToPath(rest.slice(FILE_ARG_DATA_SCHEME.length));
885
+ return rest;
886
+ };
887
+ // `createReadStream` defers a missing file to an asynchronous `error` event, which surfaces as an
888
+ // unhandled rejection rather than a usage error, so the path is checked before the stream is opened.
889
+ const uploadStream = (value, label) => {
890
+ const path = uploadPath(value);
891
+ try {
892
+ accessSync(path, fsConstants.R_OK);
893
+ }
894
+ catch (error) {
895
+ throw new Error(fileArgFailure(label, path, error));
896
+ }
897
+ return createReadStream(path);
898
+ };
899
+ // `@` works inside a JSON or YAML blob too (`--metadata '{"notes": "@notes.txt"}'`), so a nested
900
+ // field names a file the same way a flag does. Only a blob typed on the command line is walked; see
901
+ // `FlagValueOrigin` for why a blob read out of a file is not.
902
+ const expandFileArgs = (value, label) => {
903
+ if (typeof value === 'string')
904
+ return flagValue(value, label).text;
905
+ if (Array.isArray(value))
906
+ return value.map((item) => expandFileArgs(item, label));
907
+ if (isPlainObject(value)) {
908
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, expandFileArgs(item, label)]));
909
+ }
910
+ return value;
911
+ };
912
+ // `itemKind` types one occurrence of a repeatable array flag; a definition without one (an injected
913
+ // field with no item schema) falls back to parsing each occurrence as structured text. `label` names
914
+ // the flag a file-argument failure came from, since a path names no flag on its own.
915
+ // A failing client option cannot name the path it tried to open when the option carries a
916
+ // credential: the likeliest reason `@sk-live-...` names no file is that it *is* the key, and the
917
+ // message reaches stderr and every CI log capturing it.
918
+ const clientOptionValue = (value, option) => {
919
+ try {
920
+ return flagValue(value, '--' + option.name).text;
921
+ }
922
+ catch (error) {
923
+ if (!option.auth)
924
+ throw error;
925
+ throw new Error('--' +
926
+ option.name +
927
+ ': could not read the file it names. Write \\@ to send a literal value beginning with @.');
928
+ }
929
+ };
930
+ const coerceValue = (value, kind, itemKind, label = 'value') => {
931
+ if (Array.isArray(value)) {
932
+ const elementKind = kind === 'array' ? (itemKind ?? 'unknown') : kind;
933
+ return value.map((item) => coerceValue(item, elementKind, undefined, label));
934
+ }
935
+ if (typeof value !== 'string')
936
+ return value;
937
+ // A file field takes bytes, and a path is the only thing a command line can carry. The stream is
938
+ // what the SDK's multipart encoder detects (it is async iterable) and it names the part from the
939
+ // stream's `path`, so the upload keeps its file name.
940
+ if (kind === 'file')
941
+ return uploadStream(value, label);
942
+ const source = flagValue(value, label);
943
+ if (kind === 'boolean')
944
+ return source.text === 'true' || source.text === '1';
945
+ if (kind === 'number' || kind === 'integer')
946
+ return Number(source.text);
947
+ if (kind === 'object' || kind === 'array' || kind === 'unknown') {
948
+ // Base64 is the value itself, and an escaped literal was declared to be text: parsing
949
+ // either would read it as YAML, and `@remote` is not even legal YAML.
950
+ if (source.origin === 'encoded' || source.origin === 'escaped')
951
+ return source.text;
952
+ const parsed = parseStructuredValue(source.text);
953
+ return source.origin === 'literal' ? expandFileArgs(parsed, label) : parsed;
954
+ }
955
+ return source.text;
956
+ };
957
+ // Iterator commands print one item at a time so pipes can consume long-running streams immediately.
958
+ // One streamed item, framed so consecutive items stay separable.
959
+ //
960
+ // Every other format self-frames per item: `jsonl` is one record per line, `json` wraps each in
961
+ // braces. A TOON object is several bare `key: value` lines, so two events written back to back
962
+ // would run together with nothing marking the boundary — recoverable only by guessing that a
963
+ // repeated key starts a new record, which fails the moment a field is optional. Encoding the item
964
+ // as a one-element list gives each record its own `[1]` header at column 0, keeps the count
965
+ // marker honest about what follows, and leaves every other format untouched.
966
+ const streamItemText = (value, options) => {
967
+ if (options.format !== 'toon')
968
+ return serializeOutput(value, options);
969
+ if (options.rawOutput && typeof value === 'string')
970
+ return value;
971
+ return serializeOutput([value], options);
972
+ };
973
+ const writeIterable = async (value, options) => {
974
+ if (!isAsyncIterable(value)) {
975
+ await writeOutput(value, options);
976
+ return;
977
+ }
978
+ if (options.maxItems === 0) {
979
+ options.onLimit?.();
980
+ return;
981
+ }
982
+ let written = 0;
983
+ for await (const item of value) {
984
+ if (options.failOnWebSocketError)
985
+ throwWebSocketEventError(item);
986
+ processStdout.write(streamItemText(transformValue(item, options.transform), options) + '\n');
987
+ if (!countsTowardLimit(item, options))
988
+ continue;
989
+ written += 1;
990
+ if (options.maxItems !== undefined && options.maxItems > -1 && written >= options.maxItems) {
991
+ options.onLimit?.();
992
+ break;
993
+ }
994
+ }
995
+ };
996
+ // Paginated list commands auto-page across cursors: the SDK PagePromise iterates items across
997
+ // pages. `raw` is the explicit escape hatch for the unmodified single-response envelope, so it
998
+ // stays a single request with no auto-paging. For every other format we hand the page iterator
999
+ // to writeOutput, which already makes the right split: `jsonl` streams each item as it arrives,
1000
+ // while `json`/`auto`/`pretty`/`yaml` collect the fully auto-paged items into one value (honoring
1001
+ // --max-items either way). Routing through writeIterable here instead would stream items for
1002
+ // every format, emitting newline-delimited objects under `--format json` (invalid as a single
1003
+ // JSON document) and nothing at all for an empty result.
1004
+ const writePaginated = async (result, options) => {
1005
+ if (options.format === 'raw') {
1006
+ const page = await result;
1007
+ const envelope = page && typeof page === 'object' && 'body' in page ? page.body : undefined;
1008
+ await writeOutput(envelope ?? page, options);
1009
+ return;
1010
+ }
1011
+ if (isAsyncIterable(result)) {
1012
+ await writeOutput(result, options);
1013
+ return;
1014
+ }
1015
+ await writeOutput(await result, options);
1016
+ };
1017
+ const countsTowardLimit = (item, options) => {
1018
+ if (!options.failOnWebSocketError)
1019
+ return true;
1020
+ if (!item || typeof item !== 'object')
1021
+ return false;
1022
+ const type = item.type;
1023
+ return type === 'message' || type === 'raw';
1024
+ };
1025
+ // WebSocket SDKs expose lifecycle events as iterator values; error events should fail CLI commands.
1026
+ const handleWebSocket = async (socket, params, options) => {
1027
+ const closer = () => {
1028
+ closeSocket(socket, 'interrupted');
1029
+ };
1030
+ process.once('SIGINT', closer);
1031
+ try {
1032
+ const output = writeIterable(socket, {
1033
+ ...options,
1034
+ failOnWebSocketError: true,
1035
+ onLimit: () => closeSocket(socket, 'max-items reached'),
1036
+ });
1037
+ await Promise.resolve();
1038
+ const sendValue = params.send;
1039
+ if (sendValue !== undefined)
1040
+ sendSocketValue(socket, sendValue);
1041
+ if (!processStdin.isTTY) {
1042
+ const stdin = await readStdinValue();
1043
+ if (Object.keys(stdin).length > 0)
1044
+ sendSocketValue(socket, stdin.body ?? stdin);
1045
+ }
1046
+ await output;
1047
+ }
1048
+ finally {
1049
+ process.off('SIGINT', closer);
1050
+ }
1051
+ };
1052
+ const closeSocket = (socket, reason) => {
1053
+ const close = socket.close;
1054
+ if (typeof close === 'function')
1055
+ close.call(socket, { code: 1000, reason });
1056
+ };
1057
+ const sendSocketValue = (socket, value) => {
1058
+ const send = socket.send;
1059
+ if (typeof send !== 'function')
1060
+ throw new Error('Generated CLI could not send on SDK WebSocket client');
1061
+ if (Array.isArray(value)) {
1062
+ for (const item of value)
1063
+ send.call(socket, item);
1064
+ return;
1065
+ }
1066
+ send.call(socket, value);
1067
+ };
1068
+ export const writeOutput = async (value, options) => {
1069
+ if (isAsyncIterable(value)) {
1070
+ if (options.format === 'jsonl') {
1071
+ await writeIterable(value, options);
1072
+ return;
1073
+ }
1074
+ await writeOutput(await collectIterable(value, options.maxItems), options);
1075
+ return;
1076
+ }
1077
+ processStdout.write(serializeOutput(transformValue(value, options.transform), options) + '\n');
1078
+ };
1079
+ const collectIterable = async (value, maxItems) => {
1080
+ const items = [];
1081
+ for await (const item of value) {
1082
+ if (maxItems === 0)
1083
+ break;
1084
+ items.push(item);
1085
+ if (maxItems !== undefined && maxItems > -1 && items.length >= maxItems)
1086
+ break;
1087
+ }
1088
+ return items;
1089
+ };
1090
+ // `auto` renders like `json` (2-space pretty-printed): `pretty` is reserved for the distinct
1091
+ // human-readable card view, matching common CLI defaults.
1092
+ const serializeOutput = (value, options) => {
1093
+ const normalized = options.format === 'auto' ? 'json' : options.format;
1094
+ if (options.rawOutput && typeof value === 'string')
1095
+ return value;
1096
+ const safeValue = value === undefined ? null : value;
1097
+ if (normalized === 'raw')
1098
+ return typeof safeValue === 'string' ? safeValue : JSON.stringify(safeValue);
1099
+ if (normalized === 'yaml')
1100
+ return stringifyYaml(JSON.parse(JSON.stringify(safeValue))).trimEnd();
1101
+ if (normalized === 'jsonl')
1102
+ return JSON.stringify(safeValue);
1103
+ if (normalized === 'pretty')
1104
+ return prettyCard(safeValue, options);
1105
+ // TOON keeps the JSON data model but drops repeated syntax, so a list response costs an agent
1106
+ // markedly fewer context tokens than the same data as JSON.
1107
+ if (normalized === 'toon')
1108
+ return encodeToon(JSON.parse(JSON.stringify(safeValue)));
1109
+ return JSON.stringify(safeValue, null, 2);
1110
+ };
1111
+ // Human-readable `pretty` view: a bordered key/value card titled with the command path,
1112
+ // rendering booleans as yes/no and array entries as numbered items.
1113
+ const prettyCard = (value, options) => {
1114
+ const lines = prettyLines(value, '');
1115
+ const width = Math.max(0, ...lines.map((line) => line.length));
1116
+ const body = lines.length > 0 ? lines : [''];
1117
+ return [
1118
+ ...(options.title ? [' ' + options.title] : []),
1119
+ '\u256d' + '\u2500'.repeat(width + 2) + '\u256e',
1120
+ ...body.map((line) => '\u2502 ' + line.padEnd(width, ' ') + ' \u2502'),
1121
+ '\u2570' + '\u2500'.repeat(width + 2) + '\u256f',
1122
+ ].join('\n');
1123
+ };
1124
+ const prettyLines = (value, indent) => {
1125
+ if (Array.isArray(value)) {
1126
+ return value.flatMap((item, index) => {
1127
+ const label = indent + (index + 1) + '.';
1128
+ if (item && typeof item === 'object')
1129
+ return [label, ...prettyLines(item, indent + ' ')];
1130
+ return [label + ' ' + prettyScalar(item)];
1131
+ });
1132
+ }
1133
+ if (value && typeof value === 'object') {
1134
+ return Object.entries(value).flatMap(([key, entry]) => {
1135
+ if (entry && typeof entry === 'object')
1136
+ return [indent + key + ':', ...prettyLines(entry, indent + ' ')];
1137
+ return [indent + key + ': ' + prettyScalar(entry)];
1138
+ });
1139
+ }
1140
+ return [indent + prettyScalar(value)];
1141
+ };
1142
+ const prettyScalar = (value) => {
1143
+ if (value === true)
1144
+ return 'yes';
1145
+ if (value === false)
1146
+ return 'no';
1147
+ if (value === null || value === undefined)
1148
+ return '';
1149
+ return String(value);
1150
+ };
1151
+ export const writeError = async (error, options, clientOptions, SDK, environment = undefined) => {
1152
+ const body = transformValue(errorBody(error, clientOptions, SDK, environment), options.transform);
1153
+ if (options.rawOutput && typeof body === 'string') {
1154
+ process.stderr.write(body + '\n');
1155
+ return;
1156
+ }
1157
+ if (options.format === 'raw') {
1158
+ // The hint is appended rather than dropped: before failures were classified, the auth hint
1159
+ // *was* the message, so printing the message alone would lose advice `raw` used to show.
1160
+ const hint = errorHintText(body);
1161
+ process.stderr.write(String(errorMessage(body)) + (hint ? ' ' + hint : '') + '\n');
1162
+ return;
1163
+ }
1164
+ const output = options.format === 'auto' ? 'pretty' : options.format;
1165
+ const safeBody = body === undefined ? null : body;
1166
+ const serialized = serializeErrorBody(safeBody, output);
1167
+ process.stderr.write((output === 'pretty' ? as.red(serialized) : serialized) + '\n');
1168
+ };
1169
+ const serializeErrorBody = (body, format) => {
1170
+ if (format === 'yaml')
1171
+ return stringifyYaml(body).trimEnd();
1172
+ if (format === 'toon')
1173
+ return encodeToon(JSON.parse(JSON.stringify(body)));
1174
+ return JSON.stringify(body, null, format === 'jsonl' ? 0 : 2);
1175
+ };
1176
+ const errorMessage = (value) => value && typeof value === 'object' && 'message' in value ? value.message : value;
1177
+ /** The `hint` on an error body, when the body is one and carries a non-empty hint. */
1178
+ const errorHintText = (value) => {
1179
+ if (!value || typeof value !== 'object')
1180
+ return '';
1181
+ const hint = value.hint;
1182
+ return typeof hint === 'string' ? hint : '';
1183
+ };
1184
+ const errorBody = (error, clientOptions, SDK, environment) => {
1185
+ if (error && typeof error === 'object') {
1186
+ const record = error;
1187
+ const hint = errorHint(record, clientOptions, environment);
1188
+ return {
1189
+ name: record.name,
1190
+ // Stable class identifier so a caller can branch on the kind of failure without parsing prose.
1191
+ code: errorCode(record, SDK),
1192
+ // The upstream message is passed through untouched; advice goes in `hint` beside it, so a
1193
+ // caller logging the message never loses what the API actually said.
1194
+ message: record.message ?? String(error),
1195
+ status: record.status,
1196
+ requestId: record.requestID ?? record.requestId,
1197
+ ...(hint !== undefined ? { hint } : {}),
1198
+ body: record.body ?? record.error,
1199
+ };
1200
+ }
1201
+ return { code: 'error', message: String(error) };
1202
+ };
1203
+ // Stable error class for the failure, derived from the HTTP status, or from the SDK error class
1204
+ // for transport failures that never reached a response. Drives both the `code` field and the
1205
+ // process exit status.
1206
+ const errorCode = (record, SDK) => {
1207
+ const status = typeof record.status === 'number' ? record.status : undefined;
1208
+ if (status === 401 || status === 403)
1209
+ return 'auth-failed';
1210
+ if (status === 404)
1211
+ return 'not-found';
1212
+ if (status === 429)
1213
+ return 'rate-limited';
1214
+ if (status !== undefined && status >= 400 && status < 500)
1215
+ return 'client-error';
1216
+ if (status !== undefined && status >= 500)
1217
+ return 'server-error';
1218
+ if (isConnectionError(record, SDK))
1219
+ return 'connection-error';
1220
+ return 'error';
1221
+ };
1222
+ // Identifies a transport failure — one that never reached a response, so there is no status to
1223
+ // classify it by.
1224
+ //
1225
+ // Matched by identity against the error class the SDK exposes as a static, never by class name:
1226
+ // release binaries are built with `bun build --compile --minify`, which renames classes, so
1227
+ // `constructor.name` there is a mangled single letter and `.name` is the inherited "Error". The
1228
+ // name check stays only as a fallback for a host object that is not an SDK error at all (an
1229
+ // undici `ConnectTimeoutError` surfacing through a custom fetch, say).
1230
+ // Transport failure codes Node and undici set on the error, none of which are CamelCase.
1231
+ const CONNECTION_ERROR_CODE = /^(ECONN|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|EHOSTUNREACH|ENETUNREACH|EPIPE|UND_ERR)/u;
1232
+ const isConnectionError = (record, SDK) => {
1233
+ const connectionError = SDK.APIConnectionError;
1234
+ if (typeof connectionError === 'function' &&
1235
+ record instanceof connectionError)
1236
+ return true;
1237
+ const name = typeof record.name === 'string' ? record.name : '';
1238
+ const code = typeof record.code === 'string' ? record.code : '';
1239
+ // Class names are CamelCase (`ConnectTimeoutError`) but Node/undici transport codes are
1240
+ // SCREAMING_SNAKE_CASE (`ECONNREFUSED`, `UND_ERR_CONNECT_TIMEOUT`), so the two need different
1241
+ // tests: a substring match on the code would never fire, leaving a host that cannot be reached
1242
+ // through a custom fetch falling through to the unclassified status.
1243
+ if (name.includes('Connection') || name.includes('Timeout'))
1244
+ return true;
1245
+ return CONNECTION_ERROR_CODE.test(code);
1246
+ };
1247
+ // One exit status per error class so a caller can decide what to do next — fix credentials, back
1248
+ // off, retry, give up — from the status alone.
1249
+ const ERROR_EXIT_CODES = {
1250
+ error: 1,
1251
+ 'auth-failed': 10,
1252
+ 'not-found': 11,
1253
+ 'rate-limited': 12,
1254
+ 'client-error': 13,
1255
+ 'server-error': 14,
1256
+ 'connection-error': 15,
1257
+ };
1258
+ export const errorExitCode = (error, SDK) => {
1259
+ if (!error || typeof error !== 'object')
1260
+ return 1;
1261
+ return ERROR_EXIT_CODES[errorCode(error, SDK)] ?? 1;
1262
+ };
1263
+ // Actionable next step for the classes where one exists, surfaced beside the upstream message.
1264
+ const errorHint = (error, clientOptions, environment) => {
1265
+ const status = error.status;
1266
+ if (status === 401)
1267
+ return authHint(clientOptions, environment);
1268
+ // 403 is a permission failure, not a credential one: the request authenticated fine, so
1269
+ // telling the caller to set the auth env var would send it round the same loop again.
1270
+ if (status === 403)
1271
+ return 'Access denied. The credential is valid but lacks permission for this resource.';
1272
+ if (status === 404)
1273
+ return 'Resource not found. Check the identifier and path arguments.';
1274
+ if (status === 429)
1275
+ return 'Rate limited. Wait and retry, or reduce request frequency.';
1276
+ return undefined;
1277
+ };
1278
+ // Undefined when the SDK declares no authentication: there would be no variable to name, and a
1279
+ // generic "set the required environment variable" would point at something that does not exist.
1280
+ const authHint = (clientOptions, environment) => {
1281
+ const authOptions = clientOptions.filter((option) => option.auth);
1282
+ if (authOptions.length === 0)
1283
+ return undefined;
1284
+ const env = authOptions
1285
+ .map((option) => option.env)
1286
+ .filter((value) => !!value)
1287
+ .join(', ');
1288
+ return ('Authentication failed. Run `' +
1289
+ loginCommandFor(environment) +
1290
+ '`' +
1291
+ (env ? ', or set ' + env : '') +
1292
+ ', and try again.');
1293
+ };
1294
+ // Keep transforms small and dependency-free; the CLI supports the common dot-path extraction case.
1295
+ const transformValue = (value, transform) => {
1296
+ if (!transform)
1297
+ return value;
1298
+ return transform
1299
+ .split('.')
1300
+ .filter(Boolean)
1301
+ .reduce((current, segment) => {
1302
+ if (current === undefined || current === null)
1303
+ return undefined;
1304
+ if (Array.isArray(current) && /^\\d+$/u.test(segment))
1305
+ return current[Number(segment)];
1306
+ if (typeof current === 'object')
1307
+ return current[segment];
1308
+ return undefined;
1309
+ }, value);
1310
+ };
1311
+ const throwWebSocketEventError = (value) => {
1312
+ if (!value || typeof value !== 'object')
1313
+ return;
1314
+ const record = value;
1315
+ if (record.type !== 'error')
1316
+ return;
1317
+ const error = record.error;
1318
+ if (error instanceof Error)
1319
+ throw error;
1320
+ throw new Error(typeof error === 'string' ? error : JSON.stringify(error ?? record));
1321
+ };
1322
+ const normalizeFormat = (value, fallback) => {
1323
+ if (value === 'auto' ||
1324
+ value === 'json' ||
1325
+ value === 'jsonl' ||
1326
+ value === 'pretty' ||
1327
+ value === 'raw' ||
1328
+ value === 'toon' ||
1329
+ value === 'yaml') {
1330
+ return value;
1331
+ }
1332
+ return fallback;
1333
+ };
1334
+ const normalizeMaxItems = (value) => {
1335
+ if (value === undefined)
1336
+ return undefined;
1337
+ const parsed = Number(value);
1338
+ if (!Number.isFinite(parsed))
1339
+ return undefined;
1340
+ return Math.trunc(parsed);
1341
+ };
1342
+ const isAsyncIterable = (value) => !!value && typeof value[Symbol.asyncIterator] === 'function';
1343
+ // Custom commands share generated credential, output, and error conventions.
1344
+ export { normalizeFormat, usageExitCode };
1345
+ //# sourceMappingURL=runtime.js.map