ima2-gen 3.15.1 → 3.16.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 (764) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +7 -6
  3. package/bin/commands/grok.js +150 -64
  4. package/bin/commands/service.js +5 -4
  5. package/bin/ima2.js +3 -3
  6. package/bin/lib/doctor-providers.js +6 -1
  7. package/bin/lib/doctor-runtime.js +1 -1
  8. package/config.js +0 -9
  9. package/docs/API.md +7 -7
  10. package/docs/API.zh-CN.md +7 -7
  11. package/docs/API.zh-TW.md +7 -7
  12. package/docs/CLI.md +9 -8
  13. package/docs/CLI.zh-CN.md +8 -8
  14. package/docs/CLI.zh-TW.md +8 -8
  15. package/docs/README.ko.md +5 -6
  16. package/docs/README.zh-CN.md +6 -5
  17. package/docs/README.zh-TW.md +6 -5
  18. package/docs/migration/runtime-test-inventory.md +4 -6
  19. package/lib/agentPlannerModel.js +17 -16
  20. package/lib/capabilities.js +3 -2
  21. package/lib/errors/providerMap.js +13 -0
  22. package/lib/grokImageCore.js +9 -16
  23. package/lib/grokImagePlanner.js +15 -3
  24. package/lib/grokRuntime.js +47 -16
  25. package/lib/grokVideoAdapter.js +23 -7
  26. package/lib/grokVideoPoll.js +3 -3
  27. package/lib/grokVideoShared.js +6 -13
  28. package/lib/promptBuilder/router.js +22 -6
  29. package/lib/providers/adapters/grokExecution.js +15 -14
  30. package/lib/providers/adapters/grokMultimodeOperations.js +9 -7
  31. package/lib/providers/adapters/grokOperations.js +19 -12
  32. package/lib/providers/execution/admission.js +20 -4
  33. package/lib/providers/registry.js +1 -1
  34. package/lib/runtimeContext.js +0 -12
  35. package/lib/videoExtendI2vOperation.js +5 -1
  36. package/lib/xaiAuth.js +369 -0
  37. package/lib/xaiDeviceLogin.js +157 -0
  38. package/package.json +2 -4
  39. package/routes/auth.js +18 -26
  40. package/routes/grok.js +25 -19
  41. package/routes/health.js +4 -5
  42. package/routes/models.js +12 -26
  43. package/routes/quota.js +2 -1
  44. package/routes/video.js +7 -2
  45. package/routes/videoExtended.js +37 -24
  46. package/server.js +7 -58
  47. package/skills/ima2/SKILL.md +2 -2
  48. package/ui/dist/.vite/manifest.json +56 -56
  49. package/ui/dist/assets/{AgentWorkspace-CLJDCRMQ.js → AgentWorkspace-DlLaTsPK.js} +1 -1
  50. package/ui/dist/assets/{App-DkvU6Sex.js → App-BfpvLzSs.js} +4 -4
  51. package/ui/dist/assets/{AssetGenWorkspace-BepUrz23.js → AssetGenWorkspace-C8eIs-bS.js} +2 -2
  52. package/ui/dist/assets/{AssetsWorkspace-IipC1FdD.js → AssetsWorkspace-BcbAM8uC.js} +1 -1
  53. package/ui/dist/assets/{CardNewsWorkspace-ZXDwYz4l.js → CardNewsWorkspace-CM5hwbRV.js} +1 -1
  54. package/ui/dist/assets/{GenerationRequestLogPanel-BL2C0DcW.js → GenerationRequestLogPanel-CTs8OymS.js} +1 -1
  55. package/ui/dist/assets/{HomeWorkspace-DFfrwS9a.js → HomeWorkspace-KGUtIZyG.js} +1 -1
  56. package/ui/dist/assets/{KeyingPanel-BQkEMTe9.js → KeyingPanel-D8ZHmWcC.js} +1 -1
  57. package/ui/dist/assets/{NodeCanvas-5u8IO1MA.js → NodeCanvas-D2N3m-1s.js} +1 -1
  58. package/ui/dist/assets/{PromptBuilderPanel-DNt7LHMi.js → PromptBuilderPanel-BolZnOa7.js} +1 -1
  59. package/ui/dist/assets/{PromptImportDialog-Bl-SB4mK.js → PromptImportDialog-DBpe7Vkj.js} +2 -2
  60. package/ui/dist/assets/{PromptImportDiscoverySection-DdZAdRMW.js → PromptImportDiscoverySection-Dk6v6lUZ.js} +1 -1
  61. package/ui/dist/assets/{PromptImportFolderSection-DLHQKl9T.js → PromptImportFolderSection-BE7Nfq9Y.js} +1 -1
  62. package/ui/dist/assets/{PromptLibraryPanel-PLWyvEz1.js → PromptLibraryPanel-Qdujpb4L.js} +2 -2
  63. package/ui/dist/assets/{SettingsWorkspace-Etfeu2IF.js → SettingsWorkspace-Dm4wezu_.js} +1 -1
  64. package/ui/dist/assets/{SpriteRecipeWorkspace-D7H5seOM.js → SpriteRecipeWorkspace-D9do9V7F.js} +1 -1
  65. package/ui/dist/assets/index-CfGRmfFv.js +22 -0
  66. package/ui/dist/assets/{index-BAkbTbUC.js → index-CfrOcJIe.js} +3 -3
  67. package/ui/dist/assets/{pptxgen.es-Apxh5DQ9.js → pptxgen.es-BLI_YKez.js} +1 -1
  68. package/ui/dist/assets/{promptBuilderStore-prvdLIUP.js → promptBuilderStore-BMiudG9n.js} +1 -1
  69. package/ui/dist/assets/useAgentDialogFocus-CCj5EYE9.js +1 -0
  70. package/ui/dist/index.html +1 -1
  71. package/lib/grokProxyLauncher.js +0 -279
  72. package/node_modules/array-flatten/LICENSE +0 -21
  73. package/node_modules/array-flatten/README.md +0 -43
  74. package/node_modules/array-flatten/array-flatten.js +0 -64
  75. package/node_modules/array-flatten/package.json +0 -39
  76. package/node_modules/bundle-name/index.js +0 -5
  77. package/node_modules/bundle-name/license +0 -9
  78. package/node_modules/bundle-name/package.json +0 -45
  79. package/node_modules/bundle-name/readme.md +0 -23
  80. package/node_modules/bytes/History.md +0 -97
  81. package/node_modules/bytes/LICENSE +0 -23
  82. package/node_modules/bytes/Readme.md +0 -152
  83. package/node_modules/bytes/index.js +0 -170
  84. package/node_modules/bytes/package.json +0 -42
  85. package/node_modules/call-bind-apply-helpers/.eslintrc +0 -17
  86. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +0 -12
  87. package/node_modules/call-bind-apply-helpers/.nycrc +0 -9
  88. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -30
  89. package/node_modules/call-bind-apply-helpers/LICENSE +0 -21
  90. package/node_modules/call-bind-apply-helpers/README.md +0 -62
  91. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +0 -1
  92. package/node_modules/call-bind-apply-helpers/actualApply.js +0 -10
  93. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +0 -19
  94. package/node_modules/call-bind-apply-helpers/applyBind.js +0 -10
  95. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +0 -1
  96. package/node_modules/call-bind-apply-helpers/functionApply.js +0 -4
  97. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +0 -1
  98. package/node_modules/call-bind-apply-helpers/functionCall.js +0 -4
  99. package/node_modules/call-bind-apply-helpers/index.d.ts +0 -64
  100. package/node_modules/call-bind-apply-helpers/index.js +0 -15
  101. package/node_modules/call-bind-apply-helpers/package.json +0 -85
  102. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +0 -3
  103. package/node_modules/call-bind-apply-helpers/reflectApply.js +0 -4
  104. package/node_modules/call-bind-apply-helpers/test/index.js +0 -63
  105. package/node_modules/call-bind-apply-helpers/tsconfig.json +0 -9
  106. package/node_modules/call-bound/.eslintrc +0 -13
  107. package/node_modules/call-bound/.github/FUNDING.yml +0 -12
  108. package/node_modules/call-bound/.nycrc +0 -9
  109. package/node_modules/call-bound/CHANGELOG.md +0 -42
  110. package/node_modules/call-bound/LICENSE +0 -21
  111. package/node_modules/call-bound/README.md +0 -53
  112. package/node_modules/call-bound/index.d.ts +0 -94
  113. package/node_modules/call-bound/index.js +0 -19
  114. package/node_modules/call-bound/package.json +0 -99
  115. package/node_modules/call-bound/test/index.js +0 -61
  116. package/node_modules/call-bound/tsconfig.json +0 -10
  117. package/node_modules/commander/LICENSE +0 -22
  118. package/node_modules/commander/Readme.md +0 -1149
  119. package/node_modules/commander/esm.mjs +0 -16
  120. package/node_modules/commander/index.js +0 -24
  121. package/node_modules/commander/lib/argument.js +0 -149
  122. package/node_modules/commander/lib/command.js +0 -2662
  123. package/node_modules/commander/lib/error.js +0 -39
  124. package/node_modules/commander/lib/help.js +0 -709
  125. package/node_modules/commander/lib/option.js +0 -367
  126. package/node_modules/commander/lib/suggestSimilar.js +0 -101
  127. package/node_modules/commander/package-support.json +0 -16
  128. package/node_modules/commander/package.json +0 -82
  129. package/node_modules/commander/typings/esm.d.mts +0 -3
  130. package/node_modules/commander/typings/index.d.ts +0 -1045
  131. package/node_modules/content-type/HISTORY.md +0 -29
  132. package/node_modules/content-type/LICENSE +0 -22
  133. package/node_modules/content-type/README.md +0 -94
  134. package/node_modules/content-type/index.js +0 -225
  135. package/node_modules/content-type/package.json +0 -42
  136. package/node_modules/cookie/LICENSE +0 -24
  137. package/node_modules/cookie/README.md +0 -317
  138. package/node_modules/cookie/SECURITY.md +0 -25
  139. package/node_modules/cookie/index.js +0 -335
  140. package/node_modules/cookie/package.json +0 -44
  141. package/node_modules/default-browser/index.d.ts +0 -29
  142. package/node_modules/default-browser/index.js +0 -34
  143. package/node_modules/default-browser/license +0 -9
  144. package/node_modules/default-browser/package.json +0 -54
  145. package/node_modules/default-browser/readme.md +0 -24
  146. package/node_modules/default-browser/windows.js +0 -57
  147. package/node_modules/default-browser-id/index.js +0 -25
  148. package/node_modules/default-browser-id/license +0 -9
  149. package/node_modules/default-browser-id/package.json +0 -41
  150. package/node_modules/default-browser-id/readme.md +0 -19
  151. package/node_modules/define-lazy-prop/index.d.ts +0 -31
  152. package/node_modules/define-lazy-prop/index.js +0 -18
  153. package/node_modules/define-lazy-prop/license +0 -9
  154. package/node_modules/define-lazy-prop/package.json +0 -51
  155. package/node_modules/define-lazy-prop/readme.md +0 -55
  156. package/node_modules/depd/History.md +0 -103
  157. package/node_modules/depd/LICENSE +0 -22
  158. package/node_modules/depd/Readme.md +0 -280
  159. package/node_modules/depd/index.js +0 -538
  160. package/node_modules/depd/lib/browser/index.js +0 -77
  161. package/node_modules/depd/package.json +0 -45
  162. package/node_modules/destroy/LICENSE +0 -23
  163. package/node_modules/destroy/README.md +0 -63
  164. package/node_modules/destroy/index.js +0 -209
  165. package/node_modules/destroy/package.json +0 -48
  166. package/node_modules/dunder-proto/.eslintrc +0 -5
  167. package/node_modules/dunder-proto/.github/FUNDING.yml +0 -12
  168. package/node_modules/dunder-proto/.nycrc +0 -13
  169. package/node_modules/dunder-proto/CHANGELOG.md +0 -24
  170. package/node_modules/dunder-proto/LICENSE +0 -21
  171. package/node_modules/dunder-proto/README.md +0 -54
  172. package/node_modules/dunder-proto/get.d.ts +0 -5
  173. package/node_modules/dunder-proto/get.js +0 -30
  174. package/node_modules/dunder-proto/package.json +0 -76
  175. package/node_modules/dunder-proto/set.d.ts +0 -5
  176. package/node_modules/dunder-proto/set.js +0 -35
  177. package/node_modules/dunder-proto/test/get.js +0 -34
  178. package/node_modules/dunder-proto/test/index.js +0 -4
  179. package/node_modules/dunder-proto/test/set.js +0 -50
  180. package/node_modules/dunder-proto/tsconfig.json +0 -9
  181. package/node_modules/ee-first/LICENSE +0 -22
  182. package/node_modules/ee-first/README.md +0 -80
  183. package/node_modules/ee-first/index.js +0 -95
  184. package/node_modules/ee-first/package.json +0 -29
  185. package/node_modules/encodeurl/LICENSE +0 -22
  186. package/node_modules/encodeurl/README.md +0 -109
  187. package/node_modules/encodeurl/index.js +0 -60
  188. package/node_modules/encodeurl/package.json +0 -40
  189. package/node_modules/es-define-property/.eslintrc +0 -13
  190. package/node_modules/es-define-property/.github/FUNDING.yml +0 -12
  191. package/node_modules/es-define-property/.nycrc +0 -9
  192. package/node_modules/es-define-property/CHANGELOG.md +0 -29
  193. package/node_modules/es-define-property/LICENSE +0 -21
  194. package/node_modules/es-define-property/README.md +0 -49
  195. package/node_modules/es-define-property/index.d.ts +0 -3
  196. package/node_modules/es-define-property/index.js +0 -14
  197. package/node_modules/es-define-property/package.json +0 -81
  198. package/node_modules/es-define-property/test/index.js +0 -56
  199. package/node_modules/es-define-property/tsconfig.json +0 -10
  200. package/node_modules/es-errors/.eslintrc +0 -5
  201. package/node_modules/es-errors/.github/FUNDING.yml +0 -12
  202. package/node_modules/es-errors/CHANGELOG.md +0 -40
  203. package/node_modules/es-errors/LICENSE +0 -21
  204. package/node_modules/es-errors/README.md +0 -55
  205. package/node_modules/es-errors/eval.d.ts +0 -3
  206. package/node_modules/es-errors/eval.js +0 -4
  207. package/node_modules/es-errors/index.d.ts +0 -3
  208. package/node_modules/es-errors/index.js +0 -4
  209. package/node_modules/es-errors/package.json +0 -80
  210. package/node_modules/es-errors/range.d.ts +0 -3
  211. package/node_modules/es-errors/range.js +0 -4
  212. package/node_modules/es-errors/ref.d.ts +0 -3
  213. package/node_modules/es-errors/ref.js +0 -4
  214. package/node_modules/es-errors/syntax.d.ts +0 -3
  215. package/node_modules/es-errors/syntax.js +0 -4
  216. package/node_modules/es-errors/test/index.js +0 -19
  217. package/node_modules/es-errors/tsconfig.json +0 -49
  218. package/node_modules/es-errors/type.d.ts +0 -3
  219. package/node_modules/es-errors/type.js +0 -4
  220. package/node_modules/es-errors/uri.d.ts +0 -3
  221. package/node_modules/es-errors/uri.js +0 -4
  222. package/node_modules/es-object-atoms/.eslintrc +0 -16
  223. package/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
  224. package/node_modules/es-object-atoms/CHANGELOG.md +0 -37
  225. package/node_modules/es-object-atoms/LICENSE +0 -21
  226. package/node_modules/es-object-atoms/README.md +0 -63
  227. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
  228. package/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
  229. package/node_modules/es-object-atoms/ToObject.d.ts +0 -7
  230. package/node_modules/es-object-atoms/ToObject.js +0 -10
  231. package/node_modules/es-object-atoms/index.d.ts +0 -3
  232. package/node_modules/es-object-atoms/index.js +0 -4
  233. package/node_modules/es-object-atoms/isObject.d.ts +0 -3
  234. package/node_modules/es-object-atoms/isObject.js +0 -6
  235. package/node_modules/es-object-atoms/package.json +0 -80
  236. package/node_modules/es-object-atoms/test/index.js +0 -38
  237. package/node_modules/es-object-atoms/tsconfig.json +0 -6
  238. package/node_modules/escape-html/LICENSE +0 -24
  239. package/node_modules/escape-html/Readme.md +0 -43
  240. package/node_modules/escape-html/index.js +0 -78
  241. package/node_modules/escape-html/package.json +0 -24
  242. package/node_modules/etag/HISTORY.md +0 -83
  243. package/node_modules/etag/LICENSE +0 -22
  244. package/node_modules/etag/README.md +0 -159
  245. package/node_modules/etag/index.js +0 -131
  246. package/node_modules/etag/package.json +0 -47
  247. package/node_modules/forwarded/HISTORY.md +0 -21
  248. package/node_modules/forwarded/LICENSE +0 -22
  249. package/node_modules/forwarded/README.md +0 -57
  250. package/node_modules/forwarded/index.js +0 -90
  251. package/node_modules/forwarded/package.json +0 -45
  252. package/node_modules/function-bind/.eslintrc +0 -21
  253. package/node_modules/function-bind/.github/FUNDING.yml +0 -12
  254. package/node_modules/function-bind/.github/SECURITY.md +0 -3
  255. package/node_modules/function-bind/.nycrc +0 -13
  256. package/node_modules/function-bind/CHANGELOG.md +0 -136
  257. package/node_modules/function-bind/LICENSE +0 -20
  258. package/node_modules/function-bind/README.md +0 -46
  259. package/node_modules/function-bind/implementation.js +0 -84
  260. package/node_modules/function-bind/index.js +0 -5
  261. package/node_modules/function-bind/package.json +0 -87
  262. package/node_modules/function-bind/test/.eslintrc +0 -9
  263. package/node_modules/function-bind/test/index.js +0 -252
  264. package/node_modules/get-intrinsic/.eslintrc +0 -42
  265. package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
  266. package/node_modules/get-intrinsic/.nycrc +0 -9
  267. package/node_modules/get-intrinsic/CHANGELOG.md +0 -186
  268. package/node_modules/get-intrinsic/LICENSE +0 -21
  269. package/node_modules/get-intrinsic/README.md +0 -71
  270. package/node_modules/get-intrinsic/index.js +0 -378
  271. package/node_modules/get-intrinsic/package.json +0 -97
  272. package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
  273. package/node_modules/get-proto/.eslintrc +0 -10
  274. package/node_modules/get-proto/.github/FUNDING.yml +0 -12
  275. package/node_modules/get-proto/.nycrc +0 -9
  276. package/node_modules/get-proto/CHANGELOG.md +0 -21
  277. package/node_modules/get-proto/LICENSE +0 -21
  278. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +0 -5
  279. package/node_modules/get-proto/Object.getPrototypeOf.js +0 -6
  280. package/node_modules/get-proto/README.md +0 -50
  281. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +0 -3
  282. package/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -4
  283. package/node_modules/get-proto/index.d.ts +0 -5
  284. package/node_modules/get-proto/index.js +0 -27
  285. package/node_modules/get-proto/package.json +0 -81
  286. package/node_modules/get-proto/test/index.js +0 -68
  287. package/node_modules/get-proto/tsconfig.json +0 -9
  288. package/node_modules/gopd/.eslintrc +0 -16
  289. package/node_modules/gopd/.github/FUNDING.yml +0 -12
  290. package/node_modules/gopd/CHANGELOG.md +0 -45
  291. package/node_modules/gopd/LICENSE +0 -21
  292. package/node_modules/gopd/README.md +0 -40
  293. package/node_modules/gopd/gOPD.d.ts +0 -1
  294. package/node_modules/gopd/gOPD.js +0 -4
  295. package/node_modules/gopd/index.d.ts +0 -5
  296. package/node_modules/gopd/index.js +0 -15
  297. package/node_modules/gopd/package.json +0 -77
  298. package/node_modules/gopd/test/index.js +0 -36
  299. package/node_modules/gopd/tsconfig.json +0 -9
  300. package/node_modules/has-symbols/.eslintrc +0 -11
  301. package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
  302. package/node_modules/has-symbols/.nycrc +0 -9
  303. package/node_modules/has-symbols/CHANGELOG.md +0 -91
  304. package/node_modules/has-symbols/LICENSE +0 -21
  305. package/node_modules/has-symbols/README.md +0 -46
  306. package/node_modules/has-symbols/index.d.ts +0 -3
  307. package/node_modules/has-symbols/index.js +0 -14
  308. package/node_modules/has-symbols/package.json +0 -111
  309. package/node_modules/has-symbols/shams.d.ts +0 -3
  310. package/node_modules/has-symbols/shams.js +0 -45
  311. package/node_modules/has-symbols/test/index.js +0 -22
  312. package/node_modules/has-symbols/test/shams/core-js.js +0 -29
  313. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
  314. package/node_modules/has-symbols/test/tests.js +0 -58
  315. package/node_modules/has-symbols/tsconfig.json +0 -10
  316. package/node_modules/hasown/.github/FUNDING.yml +0 -12
  317. package/node_modules/hasown/.nycrc +0 -13
  318. package/node_modules/hasown/CHANGELOG.md +0 -51
  319. package/node_modules/hasown/LICENSE +0 -21
  320. package/node_modules/hasown/README.md +0 -40
  321. package/node_modules/hasown/eslint.config.mjs +0 -6
  322. package/node_modules/hasown/index.d.ts +0 -4
  323. package/node_modules/hasown/index.js +0 -8
  324. package/node_modules/hasown/package.json +0 -92
  325. package/node_modules/hasown/tsconfig.json +0 -6
  326. package/node_modules/http-errors/HISTORY.md +0 -186
  327. package/node_modules/http-errors/LICENSE +0 -23
  328. package/node_modules/http-errors/README.md +0 -169
  329. package/node_modules/http-errors/index.js +0 -290
  330. package/node_modules/http-errors/package.json +0 -54
  331. package/node_modules/inherits/LICENSE +0 -16
  332. package/node_modules/inherits/README.md +0 -42
  333. package/node_modules/inherits/inherits.js +0 -9
  334. package/node_modules/inherits/inherits_browser.js +0 -27
  335. package/node_modules/inherits/package.json +0 -29
  336. package/node_modules/ipaddr.js/LICENSE +0 -19
  337. package/node_modules/ipaddr.js/README.md +0 -233
  338. package/node_modules/ipaddr.js/ipaddr.min.js +0 -1
  339. package/node_modules/ipaddr.js/lib/ipaddr.js +0 -673
  340. package/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +0 -68
  341. package/node_modules/ipaddr.js/package.json +0 -35
  342. package/node_modules/is-docker/cli.js +0 -5
  343. package/node_modules/is-docker/index.d.ts +0 -13
  344. package/node_modules/is-docker/index.js +0 -29
  345. package/node_modules/is-docker/license +0 -9
  346. package/node_modules/is-docker/package.json +0 -44
  347. package/node_modules/is-docker/readme.md +0 -27
  348. package/node_modules/is-inside-container/cli.js +0 -5
  349. package/node_modules/is-inside-container/index.d.ts +0 -13
  350. package/node_modules/is-inside-container/index.js +0 -23
  351. package/node_modules/is-inside-container/license +0 -9
  352. package/node_modules/is-inside-container/package.json +0 -51
  353. package/node_modules/is-inside-container/readme.md +0 -36
  354. package/node_modules/is-wsl/index.d.ts +0 -15
  355. package/node_modules/is-wsl/index.js +0 -36
  356. package/node_modules/is-wsl/license +0 -9
  357. package/node_modules/is-wsl/package.json +0 -58
  358. package/node_modules/is-wsl/readme.md +0 -21
  359. package/node_modules/math-intrinsics/.eslintrc +0 -16
  360. package/node_modules/math-intrinsics/.github/FUNDING.yml +0 -12
  361. package/node_modules/math-intrinsics/CHANGELOG.md +0 -24
  362. package/node_modules/math-intrinsics/LICENSE +0 -21
  363. package/node_modules/math-intrinsics/README.md +0 -50
  364. package/node_modules/math-intrinsics/abs.d.ts +0 -1
  365. package/node_modules/math-intrinsics/abs.js +0 -4
  366. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +0 -3
  367. package/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -4
  368. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +0 -3
  369. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -5
  370. package/node_modules/math-intrinsics/constants/maxValue.d.ts +0 -3
  371. package/node_modules/math-intrinsics/constants/maxValue.js +0 -5
  372. package/node_modules/math-intrinsics/floor.d.ts +0 -1
  373. package/node_modules/math-intrinsics/floor.js +0 -4
  374. package/node_modules/math-intrinsics/isFinite.d.ts +0 -3
  375. package/node_modules/math-intrinsics/isFinite.js +0 -12
  376. package/node_modules/math-intrinsics/isInteger.d.ts +0 -3
  377. package/node_modules/math-intrinsics/isInteger.js +0 -16
  378. package/node_modules/math-intrinsics/isNaN.d.ts +0 -1
  379. package/node_modules/math-intrinsics/isNaN.js +0 -6
  380. package/node_modules/math-intrinsics/isNegativeZero.d.ts +0 -3
  381. package/node_modules/math-intrinsics/isNegativeZero.js +0 -6
  382. package/node_modules/math-intrinsics/max.d.ts +0 -1
  383. package/node_modules/math-intrinsics/max.js +0 -4
  384. package/node_modules/math-intrinsics/min.d.ts +0 -1
  385. package/node_modules/math-intrinsics/min.js +0 -4
  386. package/node_modules/math-intrinsics/mod.d.ts +0 -3
  387. package/node_modules/math-intrinsics/mod.js +0 -9
  388. package/node_modules/math-intrinsics/package.json +0 -86
  389. package/node_modules/math-intrinsics/pow.d.ts +0 -1
  390. package/node_modules/math-intrinsics/pow.js +0 -4
  391. package/node_modules/math-intrinsics/round.d.ts +0 -1
  392. package/node_modules/math-intrinsics/round.js +0 -4
  393. package/node_modules/math-intrinsics/sign.d.ts +0 -3
  394. package/node_modules/math-intrinsics/sign.js +0 -11
  395. package/node_modules/math-intrinsics/test/index.js +0 -192
  396. package/node_modules/math-intrinsics/tsconfig.json +0 -3
  397. package/node_modules/methods/HISTORY.md +0 -29
  398. package/node_modules/methods/LICENSE +0 -24
  399. package/node_modules/methods/README.md +0 -51
  400. package/node_modules/methods/index.js +0 -69
  401. package/node_modules/methods/package.json +0 -36
  402. package/node_modules/mime/.npmignore +0 -0
  403. package/node_modules/mime/CHANGELOG.md +0 -164
  404. package/node_modules/mime/LICENSE +0 -21
  405. package/node_modules/mime/README.md +0 -90
  406. package/node_modules/mime/cli.js +0 -8
  407. package/node_modules/mime/mime.js +0 -108
  408. package/node_modules/mime/package.json +0 -44
  409. package/node_modules/mime/src/build.js +0 -53
  410. package/node_modules/mime/src/test.js +0 -60
  411. package/node_modules/mime/types.json +0 -1
  412. package/node_modules/ms/index.js +0 -162
  413. package/node_modules/ms/license.md +0 -21
  414. package/node_modules/ms/package.json +0 -38
  415. package/node_modules/ms/readme.md +0 -59
  416. package/node_modules/object-inspect/.eslintrc +0 -53
  417. package/node_modules/object-inspect/.github/FUNDING.yml +0 -12
  418. package/node_modules/object-inspect/.nycrc +0 -13
  419. package/node_modules/object-inspect/CHANGELOG.md +0 -424
  420. package/node_modules/object-inspect/LICENSE +0 -21
  421. package/node_modules/object-inspect/example/all.js +0 -23
  422. package/node_modules/object-inspect/example/circular.js +0 -6
  423. package/node_modules/object-inspect/example/fn.js +0 -5
  424. package/node_modules/object-inspect/example/inspect.js +0 -10
  425. package/node_modules/object-inspect/index.js +0 -544
  426. package/node_modules/object-inspect/package-support.json +0 -20
  427. package/node_modules/object-inspect/package.json +0 -105
  428. package/node_modules/object-inspect/readme.markdown +0 -84
  429. package/node_modules/object-inspect/test/bigint.js +0 -58
  430. package/node_modules/object-inspect/test/browser/dom.js +0 -15
  431. package/node_modules/object-inspect/test/circular.js +0 -16
  432. package/node_modules/object-inspect/test/deep.js +0 -12
  433. package/node_modules/object-inspect/test/element.js +0 -53
  434. package/node_modules/object-inspect/test/err.js +0 -48
  435. package/node_modules/object-inspect/test/fakes.js +0 -29
  436. package/node_modules/object-inspect/test/fn.js +0 -76
  437. package/node_modules/object-inspect/test/global.js +0 -17
  438. package/node_modules/object-inspect/test/has.js +0 -15
  439. package/node_modules/object-inspect/test/holes.js +0 -15
  440. package/node_modules/object-inspect/test/indent-option.js +0 -271
  441. package/node_modules/object-inspect/test/inspect.js +0 -139
  442. package/node_modules/object-inspect/test/lowbyte.js +0 -12
  443. package/node_modules/object-inspect/test/number.js +0 -58
  444. package/node_modules/object-inspect/test/quoteStyle.js +0 -26
  445. package/node_modules/object-inspect/test/toStringTag.js +0 -40
  446. package/node_modules/object-inspect/test/undef.js +0 -12
  447. package/node_modules/object-inspect/test/values.js +0 -261
  448. package/node_modules/object-inspect/test-core-js.js +0 -26
  449. package/node_modules/object-inspect/util.inspect.js +0 -1
  450. package/node_modules/on-finished/HISTORY.md +0 -98
  451. package/node_modules/on-finished/LICENSE +0 -23
  452. package/node_modules/on-finished/README.md +0 -162
  453. package/node_modules/on-finished/index.js +0 -234
  454. package/node_modules/on-finished/package.json +0 -39
  455. package/node_modules/open/index.d.ts +0 -158
  456. package/node_modules/open/index.js +0 -366
  457. package/node_modules/open/license +0 -9
  458. package/node_modules/open/node_modules/wsl-utils/index.d.ts +0 -21
  459. package/node_modules/open/node_modules/wsl-utils/index.js +0 -57
  460. package/node_modules/open/node_modules/wsl-utils/license +0 -9
  461. package/node_modules/open/node_modules/wsl-utils/package.json +0 -46
  462. package/node_modules/open/node_modules/wsl-utils/readme.md +0 -50
  463. package/node_modules/open/package.json +0 -68
  464. package/node_modules/open/readme.md +0 -183
  465. package/node_modules/open/xdg-open +0 -1267
  466. package/node_modules/parseurl/HISTORY.md +0 -58
  467. package/node_modules/parseurl/LICENSE +0 -24
  468. package/node_modules/parseurl/README.md +0 -133
  469. package/node_modules/parseurl/index.js +0 -158
  470. package/node_modules/parseurl/package.json +0 -40
  471. package/node_modules/progrok/LICENSE +0 -21
  472. package/node_modules/progrok/README.md +0 -331
  473. package/node_modules/progrok/THIRD_PARTY_NOTICES.md +0 -13
  474. package/node_modules/progrok/dist/index.js +0 -1626
  475. package/node_modules/progrok/dist/index.js.map +0 -1
  476. package/node_modules/progrok/dist/public/app.js +0 -529
  477. package/node_modules/progrok/dist/public/index.html +0 -47
  478. package/node_modules/progrok/dist/public/style.css +0 -392
  479. package/node_modules/progrok/node_modules/accepts/HISTORY.md +0 -243
  480. package/node_modules/progrok/node_modules/accepts/LICENSE +0 -23
  481. package/node_modules/progrok/node_modules/accepts/README.md +0 -140
  482. package/node_modules/progrok/node_modules/accepts/index.js +0 -238
  483. package/node_modules/progrok/node_modules/accepts/package.json +0 -47
  484. package/node_modules/progrok/node_modules/body-parser/HISTORY.md +0 -686
  485. package/node_modules/progrok/node_modules/body-parser/LICENSE +0 -23
  486. package/node_modules/progrok/node_modules/body-parser/README.md +0 -476
  487. package/node_modules/progrok/node_modules/body-parser/index.js +0 -156
  488. package/node_modules/progrok/node_modules/body-parser/lib/read.js +0 -205
  489. package/node_modules/progrok/node_modules/body-parser/lib/types/json.js +0 -243
  490. package/node_modules/progrok/node_modules/body-parser/lib/types/raw.js +0 -101
  491. package/node_modules/progrok/node_modules/body-parser/lib/types/text.js +0 -121
  492. package/node_modules/progrok/node_modules/body-parser/lib/types/urlencoded.js +0 -299
  493. package/node_modules/progrok/node_modules/body-parser/package.json +0 -55
  494. package/node_modules/progrok/node_modules/content-disposition/HISTORY.md +0 -60
  495. package/node_modules/progrok/node_modules/content-disposition/LICENSE +0 -22
  496. package/node_modules/progrok/node_modules/content-disposition/README.md +0 -142
  497. package/node_modules/progrok/node_modules/content-disposition/index.js +0 -458
  498. package/node_modules/progrok/node_modules/content-disposition/package.json +0 -44
  499. package/node_modules/progrok/node_modules/cookie-signature/History.md +0 -42
  500. package/node_modules/progrok/node_modules/cookie-signature/Readme.md +0 -42
  501. package/node_modules/progrok/node_modules/cookie-signature/index.js +0 -51
  502. package/node_modules/progrok/node_modules/cookie-signature/package.json +0 -18
  503. package/node_modules/progrok/node_modules/debug/.coveralls.yml +0 -1
  504. package/node_modules/progrok/node_modules/debug/.eslintrc +0 -11
  505. package/node_modules/progrok/node_modules/debug/.npmignore +0 -9
  506. package/node_modules/progrok/node_modules/debug/.travis.yml +0 -14
  507. package/node_modules/progrok/node_modules/debug/CHANGELOG.md +0 -362
  508. package/node_modules/progrok/node_modules/debug/LICENSE +0 -19
  509. package/node_modules/progrok/node_modules/debug/Makefile +0 -50
  510. package/node_modules/progrok/node_modules/debug/README.md +0 -312
  511. package/node_modules/progrok/node_modules/debug/component.json +0 -19
  512. package/node_modules/progrok/node_modules/debug/karma.conf.js +0 -70
  513. package/node_modules/progrok/node_modules/debug/node.js +0 -1
  514. package/node_modules/progrok/node_modules/debug/node_modules/ms/index.js +0 -152
  515. package/node_modules/progrok/node_modules/debug/node_modules/ms/license.md +0 -21
  516. package/node_modules/progrok/node_modules/debug/node_modules/ms/package.json +0 -37
  517. package/node_modules/progrok/node_modules/debug/node_modules/ms/readme.md +0 -51
  518. package/node_modules/progrok/node_modules/debug/package.json +0 -49
  519. package/node_modules/progrok/node_modules/debug/src/browser.js +0 -185
  520. package/node_modules/progrok/node_modules/debug/src/debug.js +0 -202
  521. package/node_modules/progrok/node_modules/debug/src/index.js +0 -10
  522. package/node_modules/progrok/node_modules/debug/src/inspector-log.js +0 -15
  523. package/node_modules/progrok/node_modules/debug/src/node.js +0 -248
  524. package/node_modules/progrok/node_modules/express/History.md +0 -3676
  525. package/node_modules/progrok/node_modules/express/LICENSE +0 -24
  526. package/node_modules/progrok/node_modules/express/Readme.md +0 -260
  527. package/node_modules/progrok/node_modules/express/index.js +0 -11
  528. package/node_modules/progrok/node_modules/express/lib/application.js +0 -661
  529. package/node_modules/progrok/node_modules/express/lib/express.js +0 -116
  530. package/node_modules/progrok/node_modules/express/lib/middleware/init.js +0 -43
  531. package/node_modules/progrok/node_modules/express/lib/middleware/query.js +0 -47
  532. package/node_modules/progrok/node_modules/express/lib/request.js +0 -525
  533. package/node_modules/progrok/node_modules/express/lib/response.js +0 -1179
  534. package/node_modules/progrok/node_modules/express/lib/router/index.js +0 -673
  535. package/node_modules/progrok/node_modules/express/lib/router/layer.js +0 -181
  536. package/node_modules/progrok/node_modules/express/lib/router/route.js +0 -230
  537. package/node_modules/progrok/node_modules/express/lib/utils.js +0 -304
  538. package/node_modules/progrok/node_modules/express/lib/view.js +0 -182
  539. package/node_modules/progrok/node_modules/express/package.json +0 -102
  540. package/node_modules/progrok/node_modules/finalhandler/HISTORY.md +0 -216
  541. package/node_modules/progrok/node_modules/finalhandler/LICENSE +0 -22
  542. package/node_modules/progrok/node_modules/finalhandler/README.md +0 -147
  543. package/node_modules/progrok/node_modules/finalhandler/SECURITY.md +0 -25
  544. package/node_modules/progrok/node_modules/finalhandler/index.js +0 -341
  545. package/node_modules/progrok/node_modules/finalhandler/package.json +0 -47
  546. package/node_modules/progrok/node_modules/fresh/HISTORY.md +0 -70
  547. package/node_modules/progrok/node_modules/fresh/LICENSE +0 -23
  548. package/node_modules/progrok/node_modules/fresh/README.md +0 -119
  549. package/node_modules/progrok/node_modules/fresh/index.js +0 -137
  550. package/node_modules/progrok/node_modules/fresh/package.json +0 -46
  551. package/node_modules/progrok/node_modules/iconv-lite/Changelog.md +0 -162
  552. package/node_modules/progrok/node_modules/iconv-lite/LICENSE +0 -21
  553. package/node_modules/progrok/node_modules/iconv-lite/README.md +0 -156
  554. package/node_modules/progrok/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -555
  555. package/node_modules/progrok/node_modules/iconv-lite/encodings/dbcs-data.js +0 -176
  556. package/node_modules/progrok/node_modules/iconv-lite/encodings/index.js +0 -22
  557. package/node_modules/progrok/node_modules/iconv-lite/encodings/internal.js +0 -188
  558. package/node_modules/progrok/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  559. package/node_modules/progrok/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  560. package/node_modules/progrok/node_modules/iconv-lite/encodings/sbcs-data.js +0 -174
  561. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  562. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  563. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  564. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  565. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  566. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  567. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -55
  568. package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  569. package/node_modules/progrok/node_modules/iconv-lite/encodings/utf16.js +0 -177
  570. package/node_modules/progrok/node_modules/iconv-lite/encodings/utf7.js +0 -290
  571. package/node_modules/progrok/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  572. package/node_modules/progrok/node_modules/iconv-lite/lib/extend-node.js +0 -217
  573. package/node_modules/progrok/node_modules/iconv-lite/lib/index.d.ts +0 -24
  574. package/node_modules/progrok/node_modules/iconv-lite/lib/index.js +0 -153
  575. package/node_modules/progrok/node_modules/iconv-lite/lib/streams.js +0 -121
  576. package/node_modules/progrok/node_modules/iconv-lite/package.json +0 -46
  577. package/node_modules/progrok/node_modules/media-typer/HISTORY.md +0 -22
  578. package/node_modules/progrok/node_modules/media-typer/LICENSE +0 -22
  579. package/node_modules/progrok/node_modules/media-typer/README.md +0 -81
  580. package/node_modules/progrok/node_modules/media-typer/index.js +0 -270
  581. package/node_modules/progrok/node_modules/media-typer/package.json +0 -26
  582. package/node_modules/progrok/node_modules/merge-descriptors/HISTORY.md +0 -21
  583. package/node_modules/progrok/node_modules/merge-descriptors/LICENSE +0 -23
  584. package/node_modules/progrok/node_modules/merge-descriptors/README.md +0 -49
  585. package/node_modules/progrok/node_modules/merge-descriptors/index.js +0 -60
  586. package/node_modules/progrok/node_modules/merge-descriptors/package.json +0 -39
  587. package/node_modules/progrok/node_modules/mime-db/HISTORY.md +0 -507
  588. package/node_modules/progrok/node_modules/mime-db/LICENSE +0 -23
  589. package/node_modules/progrok/node_modules/mime-db/README.md +0 -100
  590. package/node_modules/progrok/node_modules/mime-db/db.json +0 -8519
  591. package/node_modules/progrok/node_modules/mime-db/index.js +0 -12
  592. package/node_modules/progrok/node_modules/mime-db/package.json +0 -60
  593. package/node_modules/progrok/node_modules/mime-types/HISTORY.md +0 -397
  594. package/node_modules/progrok/node_modules/mime-types/LICENSE +0 -23
  595. package/node_modules/progrok/node_modules/mime-types/README.md +0 -113
  596. package/node_modules/progrok/node_modules/mime-types/index.js +0 -188
  597. package/node_modules/progrok/node_modules/mime-types/package.json +0 -44
  598. package/node_modules/progrok/node_modules/negotiator/HISTORY.md +0 -108
  599. package/node_modules/progrok/node_modules/negotiator/LICENSE +0 -24
  600. package/node_modules/progrok/node_modules/negotiator/README.md +0 -203
  601. package/node_modules/progrok/node_modules/negotiator/index.js +0 -82
  602. package/node_modules/progrok/node_modules/negotiator/lib/charset.js +0 -169
  603. package/node_modules/progrok/node_modules/negotiator/lib/encoding.js +0 -184
  604. package/node_modules/progrok/node_modules/negotiator/lib/language.js +0 -179
  605. package/node_modules/progrok/node_modules/negotiator/lib/mediaType.js +0 -294
  606. package/node_modules/progrok/node_modules/negotiator/package.json +0 -42
  607. package/node_modules/progrok/node_modules/path-to-regexp/LICENSE +0 -21
  608. package/node_modules/progrok/node_modules/path-to-regexp/Readme.md +0 -35
  609. package/node_modules/progrok/node_modules/path-to-regexp/index.js +0 -158
  610. package/node_modules/progrok/node_modules/path-to-regexp/package.json +0 -30
  611. package/node_modules/progrok/node_modules/raw-body/LICENSE +0 -22
  612. package/node_modules/progrok/node_modules/raw-body/README.md +0 -223
  613. package/node_modules/progrok/node_modules/raw-body/index.d.ts +0 -87
  614. package/node_modules/progrok/node_modules/raw-body/index.js +0 -336
  615. package/node_modules/progrok/node_modules/raw-body/package.json +0 -47
  616. package/node_modules/progrok/node_modules/send/HISTORY.md +0 -538
  617. package/node_modules/progrok/node_modules/send/LICENSE +0 -23
  618. package/node_modules/progrok/node_modules/send/README.md +0 -327
  619. package/node_modules/progrok/node_modules/send/SECURITY.md +0 -24
  620. package/node_modules/progrok/node_modules/send/index.js +0 -1142
  621. package/node_modules/progrok/node_modules/send/package.json +0 -62
  622. package/node_modules/progrok/node_modules/serve-static/HISTORY.md +0 -493
  623. package/node_modules/progrok/node_modules/serve-static/LICENSE +0 -25
  624. package/node_modules/progrok/node_modules/serve-static/README.md +0 -257
  625. package/node_modules/progrok/node_modules/serve-static/index.js +0 -209
  626. package/node_modules/progrok/node_modules/serve-static/package.json +0 -42
  627. package/node_modules/progrok/node_modules/type-is/HISTORY.md +0 -259
  628. package/node_modules/progrok/node_modules/type-is/LICENSE +0 -23
  629. package/node_modules/progrok/node_modules/type-is/README.md +0 -170
  630. package/node_modules/progrok/node_modules/type-is/index.js +0 -266
  631. package/node_modules/progrok/node_modules/type-is/package.json +0 -45
  632. package/node_modules/progrok/package.json +0 -52
  633. package/node_modules/progrok/skills/progrok/SKILL.md +0 -293
  634. package/node_modules/proxy-addr/HISTORY.md +0 -161
  635. package/node_modules/proxy-addr/LICENSE +0 -22
  636. package/node_modules/proxy-addr/README.md +0 -139
  637. package/node_modules/proxy-addr/index.js +0 -327
  638. package/node_modules/proxy-addr/package.json +0 -47
  639. package/node_modules/qs/.editorconfig +0 -46
  640. package/node_modules/qs/.github/FUNDING.yml +0 -12
  641. package/node_modules/qs/.github/SECURITY.md +0 -11
  642. package/node_modules/qs/.github/THREAT_MODEL.md +0 -78
  643. package/node_modules/qs/.nycrc +0 -13
  644. package/node_modules/qs/CHANGELOG.md +0 -822
  645. package/node_modules/qs/LICENSE.md +0 -29
  646. package/node_modules/qs/README.md +0 -758
  647. package/node_modules/qs/dist/qs.js +0 -141
  648. package/node_modules/qs/eslint.config.mjs +0 -57
  649. package/node_modules/qs/lib/formats.js +0 -23
  650. package/node_modules/qs/lib/index.js +0 -11
  651. package/node_modules/qs/lib/parse.js +0 -403
  652. package/node_modules/qs/lib/stringify.js +0 -363
  653. package/node_modules/qs/lib/utils.js +0 -342
  654. package/node_modules/qs/package.json +0 -94
  655. package/node_modules/qs/test/empty-keys-cases.js +0 -267
  656. package/node_modules/qs/test/parse.js +0 -1703
  657. package/node_modules/qs/test/stringify.js +0 -1448
  658. package/node_modules/qs/test/utils.js +0 -432
  659. package/node_modules/range-parser/HISTORY.md +0 -56
  660. package/node_modules/range-parser/LICENSE +0 -23
  661. package/node_modules/range-parser/README.md +0 -84
  662. package/node_modules/range-parser/index.js +0 -162
  663. package/node_modules/range-parser/package.json +0 -44
  664. package/node_modules/run-applescript/index.d.ts +0 -66
  665. package/node_modules/run-applescript/index.js +0 -37
  666. package/node_modules/run-applescript/license +0 -9
  667. package/node_modules/run-applescript/package.json +0 -42
  668. package/node_modules/run-applescript/readme.md +0 -78
  669. package/node_modules/safe-buffer/LICENSE +0 -21
  670. package/node_modules/safe-buffer/README.md +0 -584
  671. package/node_modules/safe-buffer/index.d.ts +0 -187
  672. package/node_modules/safe-buffer/index.js +0 -65
  673. package/node_modules/safe-buffer/package.json +0 -51
  674. package/node_modules/safer-buffer/LICENSE +0 -21
  675. package/node_modules/safer-buffer/Porting-Buffer.md +0 -268
  676. package/node_modules/safer-buffer/Readme.md +0 -156
  677. package/node_modules/safer-buffer/dangerous.js +0 -58
  678. package/node_modules/safer-buffer/package.json +0 -34
  679. package/node_modules/safer-buffer/safer.js +0 -77
  680. package/node_modules/safer-buffer/tests.js +0 -406
  681. package/node_modules/setprototypeof/LICENSE +0 -13
  682. package/node_modules/setprototypeof/README.md +0 -31
  683. package/node_modules/setprototypeof/index.d.ts +0 -2
  684. package/node_modules/setprototypeof/index.js +0 -17
  685. package/node_modules/setprototypeof/package.json +0 -38
  686. package/node_modules/setprototypeof/test/index.js +0 -24
  687. package/node_modules/side-channel/.editorconfig +0 -9
  688. package/node_modules/side-channel/.eslintrc +0 -12
  689. package/node_modules/side-channel/.github/FUNDING.yml +0 -12
  690. package/node_modules/side-channel/.nycrc +0 -13
  691. package/node_modules/side-channel/CHANGELOG.md +0 -110
  692. package/node_modules/side-channel/LICENSE +0 -21
  693. package/node_modules/side-channel/README.md +0 -61
  694. package/node_modules/side-channel/index.d.ts +0 -14
  695. package/node_modules/side-channel/index.js +0 -43
  696. package/node_modules/side-channel/package.json +0 -85
  697. package/node_modules/side-channel/test/index.js +0 -104
  698. package/node_modules/side-channel/tsconfig.json +0 -9
  699. package/node_modules/side-channel-list/.editorconfig +0 -9
  700. package/node_modules/side-channel-list/.eslintrc +0 -11
  701. package/node_modules/side-channel-list/.github/FUNDING.yml +0 -12
  702. package/node_modules/side-channel-list/.nycrc +0 -13
  703. package/node_modules/side-channel-list/CHANGELOG.md +0 -36
  704. package/node_modules/side-channel-list/LICENSE +0 -21
  705. package/node_modules/side-channel-list/README.md +0 -62
  706. package/node_modules/side-channel-list/index.d.ts +0 -13
  707. package/node_modules/side-channel-list/index.js +0 -111
  708. package/node_modules/side-channel-list/list.d.ts +0 -14
  709. package/node_modules/side-channel-list/package.json +0 -77
  710. package/node_modules/side-channel-list/test/index.js +0 -154
  711. package/node_modules/side-channel-list/tsconfig.json +0 -9
  712. package/node_modules/side-channel-map/.editorconfig +0 -9
  713. package/node_modules/side-channel-map/.eslintrc +0 -11
  714. package/node_modules/side-channel-map/.github/FUNDING.yml +0 -12
  715. package/node_modules/side-channel-map/.nycrc +0 -13
  716. package/node_modules/side-channel-map/CHANGELOG.md +0 -22
  717. package/node_modules/side-channel-map/LICENSE +0 -21
  718. package/node_modules/side-channel-map/README.md +0 -62
  719. package/node_modules/side-channel-map/index.d.ts +0 -15
  720. package/node_modules/side-channel-map/index.js +0 -68
  721. package/node_modules/side-channel-map/package.json +0 -80
  722. package/node_modules/side-channel-map/test/index.js +0 -114
  723. package/node_modules/side-channel-map/tsconfig.json +0 -9
  724. package/node_modules/side-channel-weakmap/.editorconfig +0 -9
  725. package/node_modules/side-channel-weakmap/.eslintrc +0 -12
  726. package/node_modules/side-channel-weakmap/.github/FUNDING.yml +0 -12
  727. package/node_modules/side-channel-weakmap/.nycrc +0 -13
  728. package/node_modules/side-channel-weakmap/CHANGELOG.md +0 -28
  729. package/node_modules/side-channel-weakmap/LICENSE +0 -21
  730. package/node_modules/side-channel-weakmap/README.md +0 -62
  731. package/node_modules/side-channel-weakmap/index.d.ts +0 -15
  732. package/node_modules/side-channel-weakmap/index.js +0 -84
  733. package/node_modules/side-channel-weakmap/package.json +0 -87
  734. package/node_modules/side-channel-weakmap/test/index.js +0 -114
  735. package/node_modules/side-channel-weakmap/tsconfig.json +0 -9
  736. package/node_modules/statuses/HISTORY.md +0 -87
  737. package/node_modules/statuses/LICENSE +0 -23
  738. package/node_modules/statuses/README.md +0 -139
  739. package/node_modules/statuses/codes.json +0 -65
  740. package/node_modules/statuses/index.js +0 -146
  741. package/node_modules/statuses/package.json +0 -49
  742. package/node_modules/toidentifier/HISTORY.md +0 -9
  743. package/node_modules/toidentifier/LICENSE +0 -21
  744. package/node_modules/toidentifier/README.md +0 -61
  745. package/node_modules/toidentifier/index.js +0 -32
  746. package/node_modules/toidentifier/package.json +0 -38
  747. package/node_modules/unpipe/HISTORY.md +0 -4
  748. package/node_modules/unpipe/LICENSE +0 -22
  749. package/node_modules/unpipe/README.md +0 -43
  750. package/node_modules/unpipe/index.js +0 -69
  751. package/node_modules/unpipe/package.json +0 -27
  752. package/node_modules/utils-merge/.npmignore +0 -9
  753. package/node_modules/utils-merge/LICENSE +0 -20
  754. package/node_modules/utils-merge/README.md +0 -34
  755. package/node_modules/utils-merge/index.js +0 -23
  756. package/node_modules/utils-merge/package.json +0 -40
  757. package/node_modules/vary/HISTORY.md +0 -39
  758. package/node_modules/vary/LICENSE +0 -22
  759. package/node_modules/vary/README.md +0 -101
  760. package/node_modules/vary/index.js +0 -149
  761. package/node_modules/vary/package.json +0 -43
  762. package/ui/dist/assets/index-DYtUJ4t0.js +0 -22
  763. package/ui/dist/assets/useAgentDialogFocus-B2snKbzK.js +0 -1
  764. package/vendor/progrok-0.2.0.tgz +0 -0
@@ -1,1626 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/index.ts
4
- import { Command as Command12 } from "commander";
5
-
6
- // src/commands/login.ts
7
- import { Command } from "commander";
8
-
9
- // src/auth/pkce.ts
10
- import { randomBytes, createHash } from "crypto";
11
- import { createInterface } from "readline";
12
-
13
- // src/auth/constants.ts
14
- import { homedir } from "os";
15
- import { join } from "path";
16
- var XAI_OAUTH_CLIENT_ID = "b1a00492-073a-47ea-816f-4c329264a828";
17
- var XAI_OAUTH_SCOPE = "openid profile email offline_access grok-cli:access api:access";
18
- var XAI_OAUTH_ISSUER = "https://auth.x.ai";
19
- var XAI_OAUTH_DISCOVERY_URL = `${XAI_OAUTH_ISSUER}/.well-known/openid-configuration`;
20
- var XAI_OAUTH_CALLBACK_HOST = "127.0.0.1";
21
- var XAI_OAUTH_CALLBACK_PORT = 56121;
22
- var XAI_OAUTH_CALLBACK_PATH = "/callback";
23
- var XAI_OAUTH_REDIRECT_URI = `http://${XAI_OAUTH_CALLBACK_HOST}:${XAI_OAUTH_CALLBACK_PORT}${XAI_OAUTH_CALLBACK_PATH}`;
24
- var XAI_OAUTH_CORS_ORIGINS = ["auth.x.ai", "accounts.x.ai"];
25
- var XAI_OAUTH_TIMEOUT_MS = 5 * 60 * 1e3;
26
- var XAI_OAUTH_FETCH_TIMEOUT_MS = 30 * 1e3;
27
- var XAI_DEVICE_CODE_POLL_INTERVAL_MS = 5 * 1e3;
28
- var TOKEN_REFRESH_SKEW_MS = 2 * 60 * 1e3;
29
- var XAI_API_BASE_URL = "https://api.x.ai/v1";
30
- var DEFAULT_MODEL = "grok-4.3";
31
- var PROXY_DEFAULT_PORT = 18645;
32
- var PROXY_DEFAULT_HOST = "127.0.0.1";
33
- var CHAT_DEFAULT_PORT = 18646;
34
- var CONFIG_DIR = join(homedir(), ".progrok");
35
- var AUTH_FILE = join(CONFIG_DIR, "auth.json");
36
- var CONFIG_FILE = join(CONFIG_DIR, "config.json");
37
- var GITHUB_REPO = "lidge-jun/progrok";
38
- var GITHUB_URL = `https://github.com/${GITHUB_REPO}`;
39
-
40
- // src/auth/discovery.ts
41
- function requireTrustedEndpoint(url, label) {
42
- try {
43
- const parsed = new URL(url);
44
- if (parsed.protocol !== "https:") {
45
- throw new Error("not HTTPS");
46
- }
47
- if (parsed.hostname !== "x.ai" && !parsed.hostname.endsWith(".x.ai")) {
48
- throw new Error("not *.x.ai");
49
- }
50
- return url;
51
- } catch {
52
- throw new Error(`OIDC discovery returned untrusted ${label}: ${url}`);
53
- }
54
- }
55
- async function fetchOIDCDiscovery() {
56
- const res = await fetch(XAI_OAUTH_DISCOVERY_URL, {
57
- signal: AbortSignal.timeout(XAI_OAUTH_FETCH_TIMEOUT_MS)
58
- });
59
- if (!res.ok) {
60
- throw new Error(`OIDC discovery failed: HTTP ${res.status}`);
61
- }
62
- const data = await res.json();
63
- const authorizationEndpoint = requireTrustedEndpoint(
64
- data.authorization_endpoint,
65
- "authorization_endpoint"
66
- );
67
- const tokenEndpoint = requireTrustedEndpoint(
68
- data.token_endpoint,
69
- "token_endpoint"
70
- );
71
- const deviceAuthorizationEndpoint = data.device_authorization_endpoint ? requireTrustedEndpoint(
72
- data.device_authorization_endpoint,
73
- "device_authorization_endpoint"
74
- ) : void 0;
75
- return { authorizationEndpoint, tokenEndpoint, deviceAuthorizationEndpoint };
76
- }
77
-
78
- // src/auth/callback-server.ts
79
- import { createServer } from "http";
80
- function startCallbackServer(expectedState) {
81
- return new Promise((resolve3, reject) => {
82
- let server;
83
- const timeout = setTimeout(() => {
84
- server?.close();
85
- reject(new Error("OAuth callback timed out (5 minutes)"));
86
- }, XAI_OAUTH_TIMEOUT_MS);
87
- server = createServer((req, res) => {
88
- const url = new URL(
89
- req.url || "/",
90
- `http://${XAI_OAUTH_CALLBACK_HOST}`
91
- );
92
- if (req.method === "OPTIONS") {
93
- const origin = req.headers.origin || "";
94
- try {
95
- const originHost = new URL(origin).hostname;
96
- if (XAI_OAUTH_CORS_ORIGINS.includes(originHost)) {
97
- res.writeHead(204, {
98
- "Access-Control-Allow-Origin": origin,
99
- "Access-Control-Allow-Methods": "GET",
100
- "Access-Control-Allow-Headers": "Content-Type"
101
- });
102
- } else {
103
- res.writeHead(204);
104
- }
105
- } catch {
106
- res.writeHead(204);
107
- }
108
- res.end();
109
- return;
110
- }
111
- if (url.pathname !== XAI_OAUTH_CALLBACK_PATH) {
112
- res.writeHead(404);
113
- res.end("Not found");
114
- return;
115
- }
116
- const code = url.searchParams.get("code");
117
- const state = url.searchParams.get("state");
118
- const error = url.searchParams.get("error");
119
- if (error) {
120
- const desc = url.searchParams.get("error_description") || error;
121
- res.writeHead(200, { "Content-Type": "text/html" });
122
- res.end(
123
- `<html><body><h2>Login failed</h2><p>${desc}</p><p>You can close this tab.</p></body></html>`
124
- );
125
- clearTimeout(timeout);
126
- server?.close();
127
- reject(new Error(`OAuth error: ${desc}`));
128
- return;
129
- }
130
- if (!code || state !== expectedState) {
131
- res.writeHead(400, { "Content-Type": "text/html" });
132
- res.end("<html><body><h2>Invalid callback</h2></body></html>");
133
- return;
134
- }
135
- res.writeHead(200, { "Content-Type": "text/html" });
136
- res.end(
137
- `<html><body style="font-family:system-ui;text-align:center;padding:60px"><h2>Logged in to progrok</h2><p>You can close this tab and return to the terminal.</p></body></html>`
138
- );
139
- clearTimeout(timeout);
140
- server?.close();
141
- resolve3({ code, state });
142
- });
143
- server.listen(XAI_OAUTH_CALLBACK_PORT, XAI_OAUTH_CALLBACK_HOST, () => {
144
- });
145
- server.on("error", (err) => {
146
- clearTimeout(timeout);
147
- reject(new Error(`Callback server failed: ${err.message}`));
148
- });
149
- });
150
- }
151
-
152
- // src/auth/token-store.ts
153
- import {
154
- readFileSync,
155
- writeFileSync,
156
- mkdirSync,
157
- existsSync,
158
- unlinkSync
159
- } from "fs";
160
-
161
- // src/utils/logger.ts
162
- var RESET = "\x1B[0m";
163
- var GREEN = "\x1B[32m";
164
- var RED = "\x1B[31m";
165
- var DIM = "\x1B[2m";
166
- var BOLD = "\x1B[1m";
167
- var log = {
168
- info: (msg) => {
169
- console.log(msg);
170
- },
171
- success: (msg) => {
172
- console.log(`${GREEN}${msg}${RESET}`);
173
- },
174
- error: (msg) => {
175
- console.error(`${RED}${msg}${RESET}`);
176
- },
177
- dim: (msg) => {
178
- console.log(`${DIM}${msg}${RESET}`);
179
- },
180
- bold: (msg) => {
181
- console.log(`${BOLD}${msg}${RESET}`);
182
- }
183
- };
184
-
185
- // src/auth/token-store.ts
186
- function ensureConfigDir() {
187
- if (!existsSync(CONFIG_DIR)) {
188
- mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
189
- }
190
- }
191
- async function saveTokens(input) {
192
- ensureConfigDir();
193
- const data = {
194
- accessToken: input.accessToken,
195
- refreshToken: input.refreshToken,
196
- expiresAt: input.expiresIn ? Date.now() + input.expiresIn * 1e3 : void 0,
197
- tokenEndpoint: input.tokenEndpoint,
198
- idToken: input.idToken
199
- };
200
- if (input.idToken) {
201
- try {
202
- const parts = input.idToken.split(".");
203
- if (parts[1]) {
204
- const payload = JSON.parse(
205
- Buffer.from(parts[1], "base64url").toString()
206
- );
207
- if (typeof payload.email === "string") {
208
- data.email = payload.email;
209
- }
210
- }
211
- } catch {
212
- }
213
- }
214
- writeFileSync(AUTH_FILE, JSON.stringify(data, null, 2), { mode: 384 });
215
- }
216
- function loadTokens() {
217
- try {
218
- const raw = readFileSync(AUTH_FILE, "utf8");
219
- return JSON.parse(raw);
220
- } catch {
221
- return null;
222
- }
223
- }
224
- function deleteTokens() {
225
- try {
226
- unlinkSync(AUTH_FILE);
227
- } catch {
228
- }
229
- }
230
- async function getValidBearer() {
231
- const tokens = loadTokens();
232
- if (!tokens?.accessToken) {
233
- throw new Error("Not logged in. Run `progrok login` first.");
234
- }
235
- if (tokens.expiresAt && Date.now() + TOKEN_REFRESH_SKEW_MS >= tokens.expiresAt) {
236
- if (!tokens.refreshToken || !tokens.tokenEndpoint) {
237
- throw new Error(
238
- "Token expired and no refresh token available. Run `progrok login` again."
239
- );
240
- }
241
- log.dim("Refreshing access token...");
242
- const res = await fetch(tokens.tokenEndpoint, {
243
- method: "POST",
244
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
245
- body: new URLSearchParams({
246
- grant_type: "refresh_token",
247
- client_id: XAI_OAUTH_CLIENT_ID,
248
- refresh_token: tokens.refreshToken
249
- }),
250
- signal: AbortSignal.timeout(XAI_OAUTH_FETCH_TIMEOUT_MS)
251
- });
252
- if (!res.ok) {
253
- throw new Error("Token refresh failed. Run `progrok login` again.");
254
- }
255
- const refreshed = await res.json();
256
- if (typeof refreshed.access_token !== "string" || !refreshed.access_token) {
257
- throw new Error(
258
- "Token refresh returned invalid access_token. Run `progrok login` again."
259
- );
260
- }
261
- await saveTokens({
262
- accessToken: refreshed.access_token,
263
- refreshToken: (typeof refreshed.refresh_token === "string" ? refreshed.refresh_token : void 0) || tokens.refreshToken,
264
- expiresIn: typeof refreshed.expires_in === "number" ? refreshed.expires_in : void 0,
265
- tokenEndpoint: tokens.tokenEndpoint
266
- });
267
- return refreshed.access_token;
268
- }
269
- return tokens.accessToken;
270
- }
271
-
272
- // src/utils/open-url.ts
273
- import open from "open";
274
- async function openUrl(url) {
275
- try {
276
- await open(url);
277
- } catch {
278
- }
279
- }
280
-
281
- // src/auth/pkce.ts
282
- function generatePKCE() {
283
- const verifier = randomBytes(32).toString("hex");
284
- const challenge = createHash("sha256").update(verifier).digest("base64url");
285
- return { verifier, challenge };
286
- }
287
- function extractCodeFromInput(input) {
288
- const trimmed = input.trim();
289
- try {
290
- const url = new URL(trimmed);
291
- const code = url.searchParams.get("code");
292
- if (code) return code;
293
- } catch {
294
- }
295
- if (trimmed.startsWith("?")) {
296
- const params = new URLSearchParams(trimmed.slice(1));
297
- const code = params.get("code");
298
- if (code) return code;
299
- }
300
- if (trimmed.length > 10 && !trimmed.includes(" ")) return trimmed;
301
- return null;
302
- }
303
- async function promptForCode() {
304
- const rl = createInterface({ input: process.stdin, output: process.stdout });
305
- return new Promise((resolve3, reject) => {
306
- rl.question("\n Paste the callback URL or authorization code: ", (answer) => {
307
- rl.close();
308
- const code = extractCodeFromInput(answer);
309
- if (!code) {
310
- reject(new Error("Could not extract authorization code from input."));
311
- } else {
312
- resolve3(code);
313
- }
314
- });
315
- });
316
- }
317
- async function loginWithPKCE(options = {}) {
318
- const discovery = await fetchOIDCDiscovery();
319
- const pkce = generatePKCE();
320
- const state = randomBytes(16).toString("hex");
321
- const authorizeUrl = new URL(discovery.authorizationEndpoint);
322
- authorizeUrl.searchParams.set("client_id", XAI_OAUTH_CLIENT_ID);
323
- authorizeUrl.searchParams.set("redirect_uri", XAI_OAUTH_REDIRECT_URI);
324
- authorizeUrl.searchParams.set("response_type", "code");
325
- authorizeUrl.searchParams.set("scope", XAI_OAUTH_SCOPE);
326
- authorizeUrl.searchParams.set("state", state);
327
- authorizeUrl.searchParams.set("code_challenge", pkce.challenge);
328
- authorizeUrl.searchParams.set("code_challenge_method", "S256");
329
- let code;
330
- if (options.manualPaste) {
331
- log.info("Opening browser for xAI login (manual-paste mode)...");
332
- log.dim(
333
- `Visit this URL to authorize:
334
- ${authorizeUrl.toString()}`
335
- );
336
- log.dim(
337
- `
338
- After approving, paste the callback URL or the authorization code shown on the page.`
339
- );
340
- await openUrl(authorizeUrl.toString());
341
- code = await promptForCode();
342
- } else {
343
- log.info("Opening browser for xAI login...");
344
- log.dim(
345
- `If the browser doesn't open, visit:
346
- ${authorizeUrl.toString()}`
347
- );
348
- const callbackPromise = startCallbackServer(state);
349
- await openUrl(authorizeUrl.toString());
350
- const result = await callbackPromise;
351
- code = result.code;
352
- }
353
- log.info("Exchanging authorization code...");
354
- const tokenRes = await fetch(discovery.tokenEndpoint, {
355
- method: "POST",
356
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
357
- body: new URLSearchParams({
358
- grant_type: "authorization_code",
359
- client_id: XAI_OAUTH_CLIENT_ID,
360
- code,
361
- redirect_uri: XAI_OAUTH_REDIRECT_URI,
362
- code_verifier: pkce.verifier
363
- }),
364
- signal: AbortSignal.timeout(XAI_OAUTH_FETCH_TIMEOUT_MS)
365
- });
366
- if (!tokenRes.ok) {
367
- const err = await tokenRes.text();
368
- throw new Error(`Token exchange failed: ${err}`);
369
- }
370
- const tokens = await tokenRes.json();
371
- await saveTokens({
372
- accessToken: tokens.access_token,
373
- refreshToken: tokens.refresh_token,
374
- expiresIn: tokens.expires_in,
375
- idToken: tokens.id_token,
376
- tokenEndpoint: discovery.tokenEndpoint
377
- });
378
- log.success("Logged in to xAI successfully!");
379
- }
380
-
381
- // src/auth/device-code.ts
382
- async function loginWithDeviceCode() {
383
- const discovery = await fetchOIDCDiscovery();
384
- if (!discovery.deviceAuthorizationEndpoint) {
385
- throw new Error(
386
- "xAI does not support device code flow via OIDC discovery"
387
- );
388
- }
389
- log.info("Requesting device code...");
390
- const dcRes = await fetch(discovery.deviceAuthorizationEndpoint, {
391
- method: "POST",
392
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
393
- body: new URLSearchParams({
394
- client_id: XAI_OAUTH_CLIENT_ID,
395
- scope: XAI_OAUTH_SCOPE
396
- }),
397
- signal: AbortSignal.timeout(XAI_OAUTH_FETCH_TIMEOUT_MS)
398
- });
399
- if (!dcRes.ok) {
400
- throw new Error(`Device code request failed: ${await dcRes.text()}`);
401
- }
402
- const dc = await dcRes.json();
403
- const url = dc.verification_uri_complete || dc.verification_uri;
404
- log.info(`
405
- Open this URL in your browser:
406
- ${url}
407
- `);
408
- log.info(`Enter code: ${dc.user_code}
409
- `);
410
- const intervalMs = Math.max(
411
- (dc.interval || 5) * 1e3,
412
- XAI_DEVICE_CODE_POLL_INTERVAL_MS
413
- );
414
- const deadline = Date.now() + dc.expires_in * 1e3;
415
- while (Date.now() < deadline) {
416
- await new Promise((r) => setTimeout(r, intervalMs));
417
- const pollRes = await fetch(discovery.tokenEndpoint, {
418
- method: "POST",
419
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
420
- body: new URLSearchParams({
421
- grant_type: "urn:ietf:params:oauth:grant-type:device_code",
422
- client_id: XAI_OAUTH_CLIENT_ID,
423
- device_code: dc.device_code
424
- }),
425
- signal: AbortSignal.timeout(XAI_OAUTH_FETCH_TIMEOUT_MS)
426
- });
427
- if (pollRes.ok) {
428
- const tokens = await pollRes.json();
429
- await saveTokens({
430
- accessToken: tokens.access_token,
431
- refreshToken: tokens.refresh_token,
432
- expiresIn: tokens.expires_in,
433
- idToken: tokens.id_token,
434
- tokenEndpoint: discovery.tokenEndpoint
435
- });
436
- log.success("Logged in to xAI successfully!");
437
- return;
438
- }
439
- const err = await pollRes.json();
440
- if (err.error === "authorization_pending") continue;
441
- if (err.error === "slow_down") {
442
- await new Promise((r) => setTimeout(r, 5e3));
443
- continue;
444
- }
445
- throw new Error(
446
- `Device code poll failed: ${err.error_description || err.error}`
447
- );
448
- }
449
- throw new Error("Device code expired. Please try again.");
450
- }
451
-
452
- // src/commands/login.ts
453
- function loginCommand() {
454
- const cmd = new Command("login").description(
455
- `Log in to xAI via OAuth (SuperGrok subscription required).
456
- Default: device-code flow \u2014 displays URL + code for manual entry.
457
- Browser: --browser \u2014 opens browser, callback on 127.0.0.1:56121.
458
- Manual: --manual-paste \u2014 PKCE flow but paste the callback code manually.
459
- Tokens saved to ~/.progrok/auth.json, auto-refreshed before expiry.`
460
- ).option(
461
- "--device-code",
462
- "Use device code flow (default)"
463
- ).option(
464
- "--browser",
465
- "Use PKCE browser flow with loopback callback"
466
- ).option(
467
- "--manual-paste",
468
- "Use PKCE flow but paste the authorization code manually"
469
- ).action(async (opts) => {
470
- try {
471
- if (opts.browser) {
472
- await loginWithPKCE();
473
- } else if (opts.manualPaste) {
474
- await loginWithPKCE({ manualPaste: true });
475
- } else {
476
- await loginWithDeviceCode();
477
- }
478
- } catch (err) {
479
- log.error(err.message);
480
- process.exit(1);
481
- }
482
- });
483
- return cmd;
484
- }
485
-
486
- // src/commands/logout.ts
487
- import { Command as Command2 } from "commander";
488
- function logoutCommand() {
489
- return new Command2("logout").description("Remove stored xAI credentials").action(() => {
490
- deleteTokens();
491
- log.success("Logged out. Credentials removed.");
492
- });
493
- }
494
-
495
- // src/commands/proxy.ts
496
- import { Command as Command3 } from "commander";
497
-
498
- // src/proxy/server.ts
499
- import express from "express";
500
- var HOP_BY_HOP = /* @__PURE__ */ new Set([
501
- "host",
502
- "content-length",
503
- "connection",
504
- "keep-alive",
505
- "proxy-authenticate",
506
- "proxy-authorization",
507
- "te",
508
- "trailers",
509
- "transfer-encoding",
510
- "upgrade",
511
- "authorization"
512
- ]);
513
- function filterHeaders(headers) {
514
- const out = {};
515
- for (const [key, value] of Object.entries(headers)) {
516
- if (!HOP_BY_HOP.has(key.toLowerCase()) && value) {
517
- out[key] = Array.isArray(value) ? value[0] : value;
518
- }
519
- }
520
- return out;
521
- }
522
- function createProxyApp() {
523
- const app = express();
524
- app.get("/health", (_req, res) => {
525
- res.json({ status: "ok", upstream: "xAI Grok", proxy: "progrok" });
526
- });
527
- app.all("/v1/*", (req, res) => {
528
- void handleProxy(req, res);
529
- });
530
- return app;
531
- }
532
- async function handleProxy(req, res) {
533
- const relPath = req.path.replace(/^\/v1/, "");
534
- let bearer;
535
- try {
536
- bearer = await getValidBearer();
537
- } catch (err) {
538
- res.status(401).json({
539
- error: { message: err.message, type: "auth_error" }
540
- });
541
- return;
542
- }
543
- const chunks = [];
544
- for await (const chunk of req) {
545
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
546
- }
547
- const body = Buffer.concat(chunks);
548
- const qs = req.url.includes("?") ? "?" + req.url.split("?")[1] : "";
549
- const upstreamUrl = `${XAI_API_BASE_URL}${relPath}${qs}`;
550
- const fwdHeaders = filterHeaders(
551
- req.headers
552
- );
553
- fwdHeaders["Authorization"] = `Bearer ${bearer}`;
554
- try {
555
- const upstream = await fetch(upstreamUrl, {
556
- method: req.method,
557
- headers: fwdHeaders,
558
- body: body.length > 0 ? body : void 0
559
- });
560
- res.status(upstream.status);
561
- for (const [key, value] of upstream.headers) {
562
- const lower = key.toLowerCase();
563
- if (!HOP_BY_HOP.has(lower) && lower !== "content-encoding" && lower !== "content-length") {
564
- res.setHeader(key, value);
565
- }
566
- }
567
- if (upstream.body) {
568
- const reader = upstream.body.getReader();
569
- try {
570
- for (; ; ) {
571
- const { done, value } = await reader.read();
572
- if (done) break;
573
- res.write(value);
574
- }
575
- } catch {
576
- }
577
- }
578
- res.end();
579
- } catch (err) {
580
- if (!res.headersSent) {
581
- res.status(502).json({
582
- error: {
583
- message: `Upstream error: ${err.message}`,
584
- type: "upstream_error"
585
- }
586
- });
587
- }
588
- }
589
- }
590
- async function startProxy(port = PROXY_DEFAULT_PORT, host = PROXY_DEFAULT_HOST) {
591
- const app = createProxyApp();
592
- return new Promise((resolve3, reject) => {
593
- const server = app.listen(port, host, () => {
594
- log.success("progrok proxy running");
595
- log.info(` Listening: http://${host}:${port}/v1`);
596
- log.info(` Forwarding: ${XAI_API_BASE_URL}`);
597
- log.dim(
598
- " Client auth: any bearer token (proxy injects your OAuth credential)"
599
- );
600
- log.info("\nPress Ctrl+C to stop.\n");
601
- resolve3();
602
- });
603
- server.on("error", (err) => {
604
- reject(new Error(`Proxy failed to start: ${err.message}`));
605
- });
606
- process.on("SIGINT", () => {
607
- log.info("\nprogrok proxy stopped.");
608
- server.close();
609
- process.exit(0);
610
- });
611
- });
612
- }
613
-
614
- // src/commands/proxy.ts
615
- function proxyCommand() {
616
- return new Command3("proxy").description(
617
- `Start OpenAI-compatible proxy server for Grok.
618
- Forwards ALL /v1/* requests to api.x.ai with your OAuth token injected.
619
- Any client (curl, OpenAI SDK, LangChain, etc.) can connect \u2014 no API key needed.
620
- Supports streaming (SSE), multipart (stt), and binary responses (tts).`
621
- ).option("-p, --port <port>", "Port number", String(PROXY_DEFAULT_PORT)).option("--host <host>", "Host to bind", PROXY_DEFAULT_HOST).action(async (opts) => {
622
- const tokens = loadTokens();
623
- if (!tokens?.accessToken) {
624
- log.error("Not logged in. Run `progrok login` first.");
625
- process.exit(1);
626
- }
627
- try {
628
- await startProxy(parseInt(opts.port, 10), opts.host);
629
- await new Promise(() => {
630
- });
631
- } catch (err) {
632
- log.error(err.message);
633
- process.exit(1);
634
- }
635
- });
636
- }
637
-
638
- // src/commands/chat.ts
639
- import { Command as Command4 } from "commander";
640
-
641
- // src/chat/server.ts
642
- import express2 from "express";
643
- import { join as join2, dirname } from "path";
644
- import { fileURLToPath } from "url";
645
- var __dirname = dirname(fileURLToPath(import.meta.url));
646
- async function startChat(port = CHAT_DEFAULT_PORT, host = PROXY_DEFAULT_HOST) {
647
- const app = createProxyApp();
648
- const publicDir = join2(__dirname, "public");
649
- app.use(express2.static(publicDir));
650
- app.get("/", (_req, res) => {
651
- res.sendFile(join2(publicDir, "index.html"));
652
- });
653
- return new Promise((resolve3, reject) => {
654
- const server = app.listen(port, host, () => {
655
- const url = `http://${host}:${port}`;
656
- log.success(`progrok chat running at ${url}`);
657
- log.dim(`Proxy also available at ${url}/v1`);
658
- log.info("Press Ctrl+C to stop.\n");
659
- void openUrl(url);
660
- resolve3();
661
- });
662
- server.on("error", (err) => {
663
- reject(new Error(`Chat server failed: ${err.message}`));
664
- });
665
- process.on("SIGINT", () => {
666
- log.info("\nprogrok chat stopped.");
667
- server.close();
668
- process.exit(0);
669
- });
670
- });
671
- }
672
-
673
- // src/commands/chat.ts
674
- function chatCommand() {
675
- return new Command4("chat").description(
676
- `Open Grok chat in your browser.
677
- Starts a web UI + proxy server on the same port.
678
- Features: sessions, markdown, code highlighting, tool results, model switching.
679
- Proxy is also available at the same port under /v1/*.`
680
- ).option("-p, --port <port>", "Port number", String(CHAT_DEFAULT_PORT)).option("--host <host>", "Host to bind", PROXY_DEFAULT_HOST).action(async (opts) => {
681
- const tokens = loadTokens();
682
- if (!tokens?.accessToken) {
683
- log.error("Not logged in. Run `progrok login` first.");
684
- process.exit(1);
685
- }
686
- try {
687
- await startChat(parseInt(opts.port, 10), opts.host);
688
- await new Promise(() => {
689
- });
690
- } catch (err) {
691
- log.error(err.message);
692
- process.exit(1);
693
- }
694
- });
695
- }
696
-
697
- // src/commands/models.ts
698
- import { Command as Command5 } from "commander";
699
- function formatPrice(ticks) {
700
- if (!ticks) return "-";
701
- return `$${(ticks / 1e4).toFixed(2)}`;
702
- }
703
- function modelsCommand() {
704
- return new Command5("models").description("List available Grok models").option("--detail", "Show pricing and aliases from /v1/language-models").action(async (opts) => {
705
- try {
706
- const bearer = await getValidBearer();
707
- if (opts.detail) {
708
- const res2 = await fetch(`${XAI_API_BASE_URL}/language-models`, {
709
- headers: { Authorization: `Bearer ${bearer}` }
710
- });
711
- if (!res2.ok) throw new Error(`HTTP ${res2.status}`);
712
- const data2 = await res2.json();
713
- log.info("Grok Models (detailed)\n");
714
- for (const m of data2.models) {
715
- const input = (m.input_modalities || []).join(", ");
716
- const inPrice = formatPrice(m.prompt_text_token_price);
717
- const outPrice = formatPrice(m.completion_text_token_price);
718
- console.log(` ${m.id}`);
719
- console.log(` Input: ${input} | Price: ${inPrice}/1M in, ${outPrice}/1M out`);
720
- if (m.aliases && m.aliases.length > 0) {
721
- console.log(` Aliases: ${m.aliases.slice(0, 5).join(", ")}${m.aliases.length > 5 ? ` (+${m.aliases.length - 5} more)` : ""}`);
722
- }
723
- console.log();
724
- }
725
- return;
726
- }
727
- const res = await fetch(`${XAI_API_BASE_URL}/models`, {
728
- headers: { Authorization: `Bearer ${bearer}` }
729
- });
730
- if (!res.ok) throw new Error(`HTTP ${res.status}`);
731
- const data = await res.json();
732
- log.info("Available Grok models:\n");
733
- for (const m of data.data) {
734
- const tag = m.id.includes("reasoning") ? " [reasoning]" : m.id.includes("non-reasoning") ? " [fast]" : m.id.includes("build") || m.id.includes("code") ? " [code]" : m.id.includes("imagine-video") ? " [video]" : m.id.includes("imagine") ? " [image]" : "";
735
- console.log(` ${m.id}${tag}`);
736
- }
737
- log.dim("\n Use --detail for pricing and aliases");
738
- } catch (err) {
739
- log.error(err.message);
740
- process.exit(1);
741
- }
742
- });
743
- }
744
-
745
- // src/commands/status.ts
746
- import { Command as Command6 } from "commander";
747
- function statusCommand() {
748
- return new Command6("status").description("Show authentication status").action(() => {
749
- const tokens = loadTokens();
750
- if (!tokens?.accessToken) {
751
- log.info("Status: Not logged in");
752
- log.dim("Run `progrok login` to authenticate.");
753
- return;
754
- }
755
- const expired = tokens.expiresAt !== void 0 && Date.now() >= tokens.expiresAt;
756
- const hasRefresh = !!tokens.refreshToken;
757
- log.info("Status: Logged in");
758
- if (tokens.email) log.info(` Account: ${tokens.email}`);
759
- if (tokens.expiresAt) {
760
- const remaining = Math.max(
761
- 0,
762
- Math.floor((tokens.expiresAt - Date.now()) / 6e4)
763
- );
764
- log.info(
765
- ` Token: ${expired ? "expired" : `valid (${remaining} min remaining)`}`
766
- );
767
- }
768
- log.info(` Refresh: ${hasRefresh ? "available" : "none"}`);
769
- });
770
- }
771
-
772
- // src/commands/skill.ts
773
- import { Command as Command7 } from "commander";
774
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
775
- import { fileURLToPath as fileURLToPath2 } from "url";
776
- import { dirname as dirname2, join as join3, relative } from "path";
777
- var ROOT = join3(dirname2(fileURLToPath2(import.meta.url)), "..");
778
- var SKILL_PATH = join3(ROOT, "skills", "progrok", "SKILL.md");
779
- var PACKAGE_PATH = join3(ROOT, "package.json");
780
- function readPackageVersion() {
781
- try {
782
- const pkg = JSON.parse(readFileSync2(PACKAGE_PATH, "utf-8"));
783
- return pkg.version || "?";
784
- } catch {
785
- return "?";
786
- }
787
- }
788
- function readSkill() {
789
- if (!existsSync2(SKILL_PATH)) {
790
- console.error(`packaged skill not found: ${SKILL_PATH}`);
791
- process.exit(5);
792
- }
793
- return readFileSync2(SKILL_PATH, "utf-8");
794
- }
795
- function skillCommand() {
796
- return new Command7("skill").description(
797
- `Print the packaged progrok Markdown skill for agents.
798
- Designed to be piped into agent context or read programmatically.`
799
- ).argument("[subcommand]", '"path" to print the resolved skill file path').option("--json", "Output as JSON wrapper around the Markdown skill").action((subcommand2, opts) => {
800
- if (subcommand2 === "path") {
801
- console.log(SKILL_PATH);
802
- return;
803
- }
804
- const content = readSkill();
805
- if (opts.json) {
806
- console.log(
807
- JSON.stringify(
808
- {
809
- name: "progrok",
810
- format: "markdown-skill",
811
- formatVersion: "1",
812
- packageVersion: readPackageVersion(),
813
- path: relative(ROOT, SKILL_PATH),
814
- source: "package",
815
- content
816
- },
817
- null,
818
- 2
819
- )
820
- );
821
- return;
822
- }
823
- console.log(content.replace(/\n$/, ""));
824
- });
825
- }
826
-
827
- // src/commands/capabilities.ts
828
- import { Command as Command8 } from "commander";
829
- import { readFileSync as readFileSync3 } from "fs";
830
- import { fileURLToPath as fileURLToPath3 } from "url";
831
- import { dirname as dirname3, join as join4 } from "path";
832
- var ROOT2 = join4(dirname3(fileURLToPath3(import.meta.url)), "..");
833
- function readPackageVersion2() {
834
- try {
835
- const pkg = JSON.parse(
836
- readFileSync3(join4(ROOT2, "package.json"), "utf-8")
837
- );
838
- return pkg.version || "?";
839
- } catch {
840
- return "?";
841
- }
842
- }
843
- var ENDPOINTS = [
844
- // Chat & Responses
845
- { category: "chat", method: "POST", path: "/v1/chat/completions", type: "streaming", description: "OpenAI-compatible chat + image understanding" },
846
- { category: "chat", method: "POST", path: "/v1/responses", type: "streaming", description: "Responses API \u2014 tools, reasoning, citations, stateful" },
847
- { category: "chat", method: "POST", path: "/v1/responses/compact", type: "sync", description: "Context compaction \u2014 shrink history for reuse" },
848
- { category: "chat", method: "GET", path: "/v1/responses/{id}", type: "sync", description: "Retrieve a stored response (kept 30 days)" },
849
- { category: "chat", method: "DELETE", path: "/v1/responses/{id}", type: "sync", description: "Delete a stored response" },
850
- { category: "chat", method: "GET", path: "/v1/chat/deferred-completion/{id}", type: "poll", description: "Fetch a deferred completion (202 pending / 200 done)" },
851
- // Images (Imagine API)
852
- { category: "images", method: "POST", path: "/v1/images/generations", type: "sync", description: "Text-to-image \u2014 aspect_ratio, resolution 1k/2k, n, url|b64_json" },
853
- { category: "images", method: "POST", path: "/v1/images/edits", type: "sync", description: "Edit / multi-image compose \u2014 image{} or images[] + prompt" },
854
- // Videos (Imagine API, async)
855
- { category: "videos", method: "POST", path: "/v1/videos/generations", type: "async", description: "T2V / I2V / R2V \u2014 duration 1-15s, resolution 480p/720p/1080p" },
856
- { category: "videos", method: "POST", path: "/v1/videos/edits", type: "async", description: "Edit a source video by prompt" },
857
- { category: "videos", method: "POST", path: "/v1/videos/extensions", type: "async", description: "Extend a video (1-10s continuation)" },
858
- { category: "videos", method: "GET", path: "/v1/videos/{id}", type: "poll", description: "Poll generation: pending(progress) \u2192 done(video.url)" },
859
- // Voice — HTTP
860
- { category: "voice", method: "POST", path: "/v1/tts", type: "binary", description: "Text-to-speech \u2014 voice_id, output_format, speed, speech tags" },
861
- { category: "voice", method: "GET", path: "/v1/tts/voices", type: "sync", description: "List built-in voices (ara, eve, leo, rex, sal)" },
862
- { category: "voice", method: "GET", path: "/v1/tts/voices/{voice_id}", type: "sync", description: "Get one built-in voice" },
863
- { category: "voice", method: "POST", path: "/v1/stt", type: "multipart", description: "Speech-to-text \u2014 diarize, multichannel, keyterm, word timestamps" },
864
- { category: "voice", method: "POST", path: "/v1/realtime/client_secrets", type: "sync", description: "Mint ephemeral token for browser Realtime/Voice Agent" },
865
- { category: "voice", method: "POST", path: "/v1/custom-voices", type: "multipart", description: "Clone a custom voice from reference audio (\u2264120s)" },
866
- { category: "voice", method: "GET", path: "/v1/custom-voices", type: "sync", description: "List custom voices (paginated)" },
867
- { category: "voice", method: "GET", path: "/v1/custom-voices/{voice_id}", type: "sync", description: "Get one custom voice" },
868
- { category: "voice", method: "PATCH", path: "/v1/custom-voices/{voice_id}", type: "sync", description: "Update custom voice metadata" },
869
- { category: "voice", method: "DELETE", path: "/v1/custom-voices/{voice_id}", type: "sync", description: "Delete a custom voice" },
870
- { category: "voice", method: "GET", path: "/v1/custom-voices/{voice_id}/audio", type: "binary", description: "Download a custom voice's reference audio" },
871
- // Models
872
- { category: "models", method: "GET", path: "/v1/models", type: "sync", description: "List models (id + pricing)" },
873
- { category: "models", method: "GET", path: "/v1/models/{model_id}", type: "sync", description: "Get one model" },
874
- { category: "models", method: "GET", path: "/v1/language-models", type: "sync", description: "Chat models with modalities + aliases + pricing" },
875
- { category: "models", method: "GET", path: "/v1/language-models/{model_id}", type: "sync", description: "Get one language model" },
876
- { category: "models", method: "GET", path: "/v1/image-generation-models", type: "sync", description: "Image models with per-image pricing" },
877
- { category: "models", method: "GET", path: "/v1/image-generation-models/{model_id}", type: "sync", description: "Get one image model" },
878
- { category: "models", method: "GET", path: "/v1/video-generation-models", type: "sync", description: "Video models with modalities" },
879
- { category: "models", method: "GET", path: "/v1/video-generation-models/{model_id}", type: "sync", description: "Get one video model" },
880
- // Batches
881
- { category: "batches", method: "POST", path: "/v1/batches", type: "sync", description: "Create a batch" },
882
- { category: "batches", method: "GET", path: "/v1/batches", type: "sync", description: "List batches" },
883
- { category: "batches", method: "GET", path: "/v1/batches/{id}", type: "sync", description: "Get batch state" },
884
- { category: "batches", method: "GET", path: "/v1/batches/{id}/requests", type: "sync", description: "List requests in a batch" },
885
- { category: "batches", method: "POST", path: "/v1/batches/{id}/requests", type: "sync", description: "Add requests to a batch" },
886
- { category: "batches", method: "GET", path: "/v1/batches/{id}/results", type: "sync", description: "List batch results" },
887
- { category: "batches", method: "POST", path: "/v1/batches/{id}:cancel", type: "sync", description: "Cancel all requests in a batch" },
888
- // Files
889
- { category: "files", method: "POST", path: "/v1/files", type: "multipart", description: "Upload a file (\u226450MB) \u2014 referenced by file_id" },
890
- { category: "files", method: "GET", path: "/v1/files", type: "sync", description: "List files (AIP-160 filter, paginated)" },
891
- { category: "files", method: "GET", path: "/v1/files/{file_id}", type: "sync", description: "Get file metadata" },
892
- { category: "files", method: "DELETE", path: "/v1/files/{file_id}", type: "sync", description: "Delete a file" },
893
- // Collections (search only via api.x.ai; management is on management-api.x.ai)
894
- { category: "collections", method: "POST", path: "/v1/documents/search", type: "sync", description: "Semantic search over collections (RAG)" },
895
- // Other
896
- { category: "other", method: "GET", path: "/v1/api-key", type: "sync", description: "Inspect the active API key / ACLs" },
897
- { category: "other", method: "POST", path: "/v1/tokenize-text", type: "sync", description: "Tokenize text for a model" },
898
- { category: "other", method: "POST", path: "/v1/embeddings", type: "sync", description: "Text embeddings" },
899
- { category: "other", method: "*", path: "/v1/*", type: "passthrough", description: "Any other path forwarded to api.x.ai unchanged" }
900
- ];
901
- var WEBSOCKET_ENDPOINTS = [
902
- { url: "wss://api.x.ai/v1/realtime", description: "Voice Agent \u2014 realtime speech conversations + MCP tools" },
903
- { url: "wss://api.x.ai/v1/tts", description: "Streaming text-to-speech (incremental text \u2192 audio)" },
904
- { url: "wss://api.x.ai/v1/stt", description: "Streaming speech-to-text (binary audio \u2192 transcript)" }
905
- ];
906
- function buildCapabilities() {
907
- return {
908
- ok: true,
909
- name: "progrok",
910
- version: readPackageVersion2(),
911
- source: "local",
912
- upstream: XAI_API_BASE_URL,
913
- commands: [
914
- "login",
915
- "logout",
916
- "proxy",
917
- "chat",
918
- "models",
919
- "status",
920
- "skill",
921
- "capabilities"
922
- ],
923
- proxy: {
924
- host: PROXY_DEFAULT_HOST,
925
- port: PROXY_DEFAULT_PORT,
926
- baseUrl: `http://${PROXY_DEFAULT_HOST}:${PROXY_DEFAULT_PORT}/v1`,
927
- forwarding: "all HTTP /v1/* paths \u2014 no whitelist"
928
- },
929
- chat: {
930
- port: CHAT_DEFAULT_PORT,
931
- url: `http://${PROXY_DEFAULT_HOST}:${CHAT_DEFAULT_PORT}`
932
- },
933
- defaults: {
934
- model: DEFAULT_MODEL
935
- },
936
- endpoints: ENDPOINTS,
937
- websocketEndpoints: WEBSOCKET_ENDPOINTS,
938
- models: [
939
- {
940
- id: "grok-4.3",
941
- type: "reasoning",
942
- use: "Flagship \u2014 chat, agentic tool calling, search, vision",
943
- input: ["text", "image"],
944
- output: ["text"],
945
- context: "1M tokens",
946
- pricing: { inputPer1M: 1.25, cachedInputPer1M: 0.2, outputPer1M: 2.5, longContext: { thresholdTokens: 2e5, inputPer1M: 2.5, cachedInputPer1M: 0.4, outputPer1M: 5 }, searchPer1KSources: 25, unit: "USD" },
947
- reasoning: { configurable: true, nonReasoningMode: true, note: "Supports non-reasoning mode for instant replies" },
948
- structuredOutput: true,
949
- functionCalling: true,
950
- tools: ["web_search", "x_search", "code_interpreter", "collections_search", "mcp", "function"],
951
- aliases: ["grok-4.3-latest", "grok-latest", "grok-4", "grok-4-latest", "grok-4-fast-reasoning", "grok-3", "grok-3-latest", "grok-3-mini"]
952
- },
953
- {
954
- id: "grok-4.20-0309-reasoning",
955
- type: "deep-reasoning",
956
- use: "Deep analysis, complex coding (legacy 4.20 line)",
957
- input: ["text", "image"],
958
- output: ["text"],
959
- context: "200K+ (long-context pricing above 200K tokens)",
960
- pricing: { inputPer1M: 1.25, cachedInputPer1M: 0.2, outputPer1M: 2.5, longContext: { thresholdTokens: 2e5, inputPer1M: 2.5, cachedInputPer1M: 0.4, outputPer1M: 5 }, searchPer1KSources: 25, unit: "USD" },
961
- reasoning: { effort: ["low", "high"], default: "low" },
962
- structuredOutput: true,
963
- functionCalling: true,
964
- tools: ["web_search", "x_search", "code_interpreter", "collections_search", "mcp", "function"],
965
- aliases: ["grok-4.20", "grok-4.20-reasoning", "grok-4.20-reasoning-latest", "grok-4.20-beta", "grok-4.20-beta-latest"]
966
- },
967
- {
968
- id: "grok-4.20-0309-non-reasoning",
969
- type: "fast",
970
- use: "Fast responses, no thinking overhead (legacy 4.20 line)",
971
- input: ["text", "image"],
972
- output: ["text"],
973
- context: "200K+ (long-context pricing above 200K tokens)",
974
- pricing: { inputPer1M: 1.25, cachedInputPer1M: 0.2, outputPer1M: 2.5, longContext: { thresholdTokens: 2e5, inputPer1M: 2.5, cachedInputPer1M: 0.4, outputPer1M: 5 }, searchPer1KSources: 25, unit: "USD" },
975
- reasoning: false,
976
- structuredOutput: true,
977
- functionCalling: true,
978
- tools: ["web_search", "x_search", "code_interpreter", "collections_search", "mcp", "function"],
979
- aliases: ["grok-4.20-non-reasoning", "grok-4.20-non-reasoning-latest", "grok-4.20-beta-non-reasoning", "grok-4.20-beta-latest-non-reasoning"]
980
- },
981
- {
982
- id: "grok-4.20-multi-agent-0309",
983
- type: "multi-agent",
984
- use: "Deep research \u2014 4 or 16 parallel agents (beta)",
985
- input: ["text", "image"],
986
- output: ["text"],
987
- context: "200K+ (long-context pricing above 200K tokens)",
988
- pricing: { inputPer1M: 1.25, cachedInputPer1M: 0.2, outputPer1M: 2.5, longContext: { thresholdTokens: 2e5, inputPer1M: 2.5, cachedInputPer1M: 0.4, outputPer1M: 5 }, searchPer1KSources: 25, unit: "USD" },
989
- reasoning: { effort: ["low", "medium", "high", "xhigh"], default: "low", note: "effort selects agent count: low/medium=4, high/xhigh=16" },
990
- structuredOutput: true,
991
- functionCalling: false,
992
- tools: ["web_search", "x_search", "code_interpreter", "collections_search", "mcp"],
993
- notes: "Responses API / xAI SDK only \u2014 not Chat Completions. No client-side function calling. No max_tokens.",
994
- aliases: ["grok-4.20-multi-agent", "grok-4.20-multi-agent-latest", "grok-4.20-multi-agent-beta-latest"]
995
- },
996
- {
997
- id: "grok-build-0.1",
998
- type: "code",
999
- use: "Fast agentic coding",
1000
- input: ["text", "image"],
1001
- output: ["text"],
1002
- context: "256K tokens",
1003
- pricing: { inputPer1M: 1, cachedInputPer1M: 0.2, outputPer1M: 2, longContext: { thresholdTokens: 2e5, inputPer1M: 2, cachedInputPer1M: 0.4, outputPer1M: 4 }, searchPer1KSources: 25, unit: "USD" },
1004
- reasoning: { effort: ["low", "high"], default: "low" },
1005
- structuredOutput: true,
1006
- functionCalling: true,
1007
- tools: ["web_search", "x_search", "code_interpreter", "function"],
1008
- aliases: ["grok-code-fast-1", "grok-code-fast", "grok-code-fast-1-0825"]
1009
- },
1010
- {
1011
- id: "grok-imagine-image",
1012
- type: "image",
1013
- use: "Fast image generation / editing",
1014
- input: ["text", "image"],
1015
- output: ["image"],
1016
- maxPromptLength: 8e3,
1017
- pricing: { perImage: 0.02, unit: "USD", note: "1k or 2k resolution" },
1018
- aliases: ["grok-imagine-image-2026-03-02"]
1019
- },
1020
- {
1021
- id: "grok-imagine-image-quality",
1022
- type: "image-hq",
1023
- use: "High-quality image generation / editing",
1024
- input: ["text", "image"],
1025
- output: ["image"],
1026
- maxPromptLength: 8e3,
1027
- pricing: { perImage: 0.04, unit: "USD", note: "1k or 2k resolution" },
1028
- aliases: ["grok-imagine-image-quality-latest", "grok-imagine-image-pro"]
1029
- },
1030
- {
1031
- id: "grok-imagine-video",
1032
- type: "video",
1033
- use: "Video generation / edit / extension (async)",
1034
- input: ["text", "image"],
1035
- output: ["video"],
1036
- pricing: { perSecond: 0.05, unit: "USD", note: "480p or 720p" },
1037
- aliases: []
1038
- },
1039
- {
1040
- id: "grok-imagine-video-1.5-preview",
1041
- type: "video",
1042
- use: "Video v1.5 (preview) \u2014 improved I2V, T2V via white-canvas workaround",
1043
- input: ["text", "image"],
1044
- output: ["video"],
1045
- pricing: { perSecond: 0.05, unit: "USD", note: "480p or 720p, T2V needs image injection" },
1046
- aliases: []
1047
- }
1048
- ],
1049
- voiceModels: [
1050
- { id: "grok-voice-latest", use: "Voice Agent / realtime \u2014 recommended" },
1051
- { id: "grok-voice-fast-1.0", use: "Lower-latency voice agent" },
1052
- { id: "grok-voice-think-fast-1.0", use: "Reasoning-capable voice agent" }
1053
- ],
1054
- voicePricing: {
1055
- agentPerHour: 3,
1056
- ttsPer1MChars: 15,
1057
- sttBatchPerHour: 0.1,
1058
- sttStreamingPerHour: 0.2,
1059
- unit: "USD"
1060
- },
1061
- tools: [
1062
- { type: "web_search", description: "Web search + browse. Params: allowed_domains, excluded_domains, enable_image_understanding, enable_image_search" },
1063
- { type: "x_search", description: "X (Twitter) search with citations" },
1064
- { type: "code_interpreter", description: "Server-side Python execution (a.k.a. Code Execution)" },
1065
- { type: "collections_search", description: "RAG over your uploaded collections" },
1066
- { type: "mcp", description: "Remote MCP server. Params: server_url, server_label, allowed_tools, authorization, headers" },
1067
- { type: "function", description: "Custom client-side function calling (max 128)" }
1068
- ],
1069
- searchParameters: {
1070
- mode: ["off", "on", "auto"],
1071
- sources: ["web", "x", "news", "rss"],
1072
- params: ["from_date", "to_date", "max_search_results", "return_citations"]
1073
- },
1074
- limitations: [
1075
- "WebSocket endpoints (wss /v1/realtime, /v1/tts, /v1/stt) are NOT proxied \u2014 connect directly with an ephemeral token from POST /v1/realtime/client_secrets.",
1076
- "Collection management lives on management-api.x.ai (Management API key) and is not reachable through this proxy; only POST /v1/documents/search is.",
1077
- "The multi-agent model requires the Responses API (not Chat Completions)."
1078
- ],
1079
- guidance: {
1080
- auth: "Run `progrok login` once. progrok activates the local xAI OAuth session for clients and commands.",
1081
- proxy: "`progrok proxy` forwards all HTTP /v1/* paths. Set OPENAI_BASE_URL=http://127.0.0.1:18645/v1 and OPENAI_API_KEY=anything.",
1082
- streaming: "Use stream:true for responses/chat. The proxy passes SSE through verbatim.",
1083
- video: "Video gen is async: POST /v1/videos/generations \u2192 poll GET /v1/videos/{id} until status=done.",
1084
- models: "Use the bare model name or `<model>-latest` to auto-track the newest version; `<model>-<date>` pins a specific release."
1085
- }
1086
- };
1087
- }
1088
- function printText(cap) {
1089
- console.log(`progrok capabilities (${cap.source})`);
1090
- console.log(`version: ${cap.version}`);
1091
- console.log(`upstream: ${cap.upstream}`);
1092
- console.log("");
1093
- console.log(`proxy: ${cap.proxy.baseUrl}`);
1094
- console.log(`chat: ${cap.chat.url}`);
1095
- console.log(`model: ${cap.defaults.model}`);
1096
- console.log("");
1097
- console.log("endpoints (HTTP \u2014 proxied):");
1098
- let lastCategory = "";
1099
- for (const ep of cap.endpoints) {
1100
- if (ep.category !== lastCategory) {
1101
- console.log(` [${ep.category}]`);
1102
- lastCategory = ep.category;
1103
- }
1104
- const label = ` ${ep.method.padEnd(6)} ${ep.path.padEnd(38)}`;
1105
- console.log(`${label} ${ep.description}`);
1106
- }
1107
- console.log("");
1108
- console.log("websocket (NOT proxied \u2014 connect directly):");
1109
- for (const ws of cap.websocketEndpoints) {
1110
- console.log(` ${ws.url.padEnd(30)} ${ws.description}`);
1111
- }
1112
- console.log("");
1113
- console.log("models:");
1114
- for (const m of cap.models) {
1115
- console.log(` ${m.id.padEnd(30)} ${m.use}`);
1116
- }
1117
- console.log("");
1118
- console.log("tools:");
1119
- for (const t of cap.tools) {
1120
- console.log(` ${t.type.padEnd(20)} ${t.description}`);
1121
- }
1122
- console.log("");
1123
- console.log("limitations:");
1124
- for (const l of cap.limitations) {
1125
- console.log(` - ${l}`);
1126
- }
1127
- console.log("");
1128
- console.log(`commands: ${cap.commands.join(", ")}`);
1129
- }
1130
- function capabilitiesCommand() {
1131
- return new Command8("capabilities").description("Print agent-friendly capability metadata.").option("--json", "Output as JSON").action((opts) => {
1132
- const cap = buildCapabilities();
1133
- if (opts.json) {
1134
- console.log(JSON.stringify(cap, null, 2));
1135
- } else {
1136
- printText(cap);
1137
- }
1138
- });
1139
- }
1140
-
1141
- // src/commands/search.ts
1142
- import { Command as Command9 } from "commander";
1143
- function buildSearchTools(opts) {
1144
- const explicit = Boolean(opts.web || opts.x);
1145
- const useWeb = explicit ? Boolean(opts.web) : true;
1146
- const useX = explicit ? Boolean(opts.x) : true;
1147
- const tools = [];
1148
- if (useWeb) tools.push({ type: "web_search" });
1149
- if (useX) tools.push({ type: "x_search" });
1150
- return tools;
1151
- }
1152
- function extractSearchResult(data) {
1153
- const citations = [];
1154
- const queries = [];
1155
- const seen = /* @__PURE__ */ new Set();
1156
- let answer = "";
1157
- for (const item of data.output ?? []) {
1158
- if (item.type === "message") {
1159
- for (const c of item.content ?? []) {
1160
- if (c.type === "output_text" && c.text) {
1161
- answer += c.text;
1162
- for (const a of c.annotations ?? []) {
1163
- if (a.type === "url_citation" && a.url && !seen.has(a.url)) {
1164
- seen.add(a.url);
1165
- citations.push({ url: a.url, title: a.title ?? "" });
1166
- }
1167
- }
1168
- }
1169
- }
1170
- } else if ((item.type === "web_search_call" || item.type === "x_search_call") && item.action?.query) {
1171
- queries.push(item.action.query);
1172
- }
1173
- }
1174
- return { answer: answer.trim(), citations, queries, usage: data.usage };
1175
- }
1176
- function searchCommand() {
1177
- return new Command9("search").description("Search the web and X with Grok \u2014 AI summary + citations (no API key)").argument("<query>", "what to search for").option("--web", "web search only (default: web + X)").option("--x", "X (Twitter) search only").option("--json", "output structured JSON").option("--model <id>", "model to use", DEFAULT_MODEL).option(
1178
- "--reasoning <effort>",
1179
- "reasoning effort: none|low|medium|high|xhigh (xhigh = multi-agent 16)"
1180
- ).action(async (query, opts) => {
1181
- try {
1182
- const VALID_EFFORTS = /* @__PURE__ */ new Set(["none", "low", "medium", "high", "xhigh"]);
1183
- if (opts.reasoning && !VALID_EFFORTS.has(opts.reasoning)) {
1184
- throw new Error(
1185
- `invalid --reasoning '${opts.reasoning}'. use: none|low|medium|high|xhigh`
1186
- );
1187
- }
1188
- const tools = buildSearchTools(opts);
1189
- const bearer = await getValidBearer();
1190
- const res = await fetch(`${XAI_API_BASE_URL}/responses`, {
1191
- method: "POST",
1192
- headers: {
1193
- Authorization: `Bearer ${bearer}`,
1194
- "Content-Type": "application/json"
1195
- },
1196
- body: JSON.stringify({
1197
- model: opts.model ?? DEFAULT_MODEL,
1198
- input: query,
1199
- tools,
1200
- stream: false,
1201
- ...opts.reasoning ? { reasoning: { effort: opts.reasoning } } : {}
1202
- })
1203
- });
1204
- if (!res.ok) {
1205
- const body = await res.text();
1206
- throw new Error(`HTTP ${res.status}: ${body.slice(0, 300)}`);
1207
- }
1208
- const result = extractSearchResult(await res.json());
1209
- if (opts.json) {
1210
- console.log(JSON.stringify(result, null, 2));
1211
- return;
1212
- }
1213
- log.bold(`
1214
- Search: ${query}
1215
- `);
1216
- console.log(result.answer || "(no answer returned)");
1217
- if (result.citations.length > 0) {
1218
- log.dim("\nSources:");
1219
- result.citations.forEach((c, i) => {
1220
- console.log(` [${i + 1}] ${c.url}`);
1221
- });
1222
- }
1223
- const d = result.usage?.server_side_tool_usage_details;
1224
- if (d) {
1225
- log.dim(
1226
- `
1227
- (${d.web_search_calls ?? 0} web \xB7 ${d.x_search_calls ?? 0} X searches)`
1228
- );
1229
- }
1230
- } catch (err) {
1231
- log.error(err.message);
1232
- process.exit(1);
1233
- }
1234
- });
1235
- }
1236
-
1237
- // src/commands/video.ts
1238
- import { Command as Command10 } from "commander";
1239
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
1240
- import { resolve } from "path";
1241
- var DEFAULT_VIDEO_MODEL = "grok-imagine-video";
1242
- var POLL_INTERVAL_MS = 5e3;
1243
- var WHITE_PIXEL_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/58BAwAHBQKhPX8EOAAAAABJRU5ErkJggg==";
1244
- function imageToDataUri(filePath) {
1245
- const abs = resolve(filePath);
1246
- const buf = readFileSync4(abs);
1247
- const ext = abs.toLowerCase().endsWith(".png") ? "png" : "jpeg";
1248
- return `data:image/${ext};base64,${buf.toString("base64")}`;
1249
- }
1250
- async function pollUntilDone(requestId, bearer, timeout, json) {
1251
- const deadline = Date.now() + timeout;
1252
- let lastProgress = -1;
1253
- while (Date.now() < deadline) {
1254
- await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
1255
- const poll = await fetch(`${XAI_API_BASE_URL}/videos/${requestId}`, {
1256
- headers: { Authorization: `Bearer ${bearer}` }
1257
- });
1258
- if (!poll.ok) {
1259
- throw new Error(`Poll HTTP ${poll.status}: ${(await poll.text()).slice(0, 200)}`);
1260
- }
1261
- const data = await poll.json();
1262
- const status = data.status;
1263
- if (status === "done") return data;
1264
- if (status === "failed") {
1265
- const err = data.error;
1266
- throw new Error(`Generation failed: ${err?.code ?? "unknown"} \u2014 ${err?.message ?? ""}`);
1267
- }
1268
- if (status === "expired") throw new Error("Generation expired");
1269
- if (!json && typeof data.progress === "number" && data.progress !== lastProgress) {
1270
- lastProgress = data.progress;
1271
- process.stdout.write(`\r Progress: ${Math.round(lastProgress * 100)}%`);
1272
- }
1273
- }
1274
- throw new Error(`Timeout after ${timeout / 1e3}s \u2014 video still pending`);
1275
- }
1276
- async function downloadAndSave(videoUrl, outPath) {
1277
- const videoRes = await fetch(videoUrl);
1278
- if (!videoRes.ok) throw new Error(`Download failed: HTTP ${videoRes.status}`);
1279
- const videoBuffer = Buffer.from(await videoRes.arrayBuffer());
1280
- writeFileSync2(outPath, videoBuffer);
1281
- }
1282
- function videoCommand() {
1283
- const cmd = new Command10("video").description(
1284
- `Generate, edit, or extend video with Grok Imagine Video.
1285
-
1286
- Subcommands:
1287
- generate (default) Text-to-video or image-to-video
1288
- edit Edit existing video with text prompt (V2V)
1289
- extend Continue video from its last frame
1290
-
1291
- Examples:
1292
- $ progrok video "A cat playing piano"
1293
- $ progrok video "Animate this" --image photo.jpg
1294
- $ progrok video edit "Make it sunset colors" --video input.mp4
1295
- $ progrok video extend "Camera pulls back slowly" --video input.mp4 --duration 5`
1296
- );
1297
- cmd.argument("[prompt]", "video generation prompt").option("--model <id>", "video model", DEFAULT_VIDEO_MODEL).option("--duration <s>", "duration in seconds (1-15)", "5").option("--aspect <ratio>", "aspect ratio", "16:9").option("--resolution <r>", "480p or 720p", "480p").option("--image <path>", "source image for image-to-video").option("--output <path>", "output file path").option("--json", "output structured JSON").option("--timeout <s>", "polling timeout in seconds", "600").action(async (prompt, opts) => {
1298
- if (!prompt) {
1299
- cmd.help();
1300
- return;
1301
- }
1302
- await generateAction(prompt, opts);
1303
- });
1304
- cmd.command("edit <prompt>").description("Edit existing video with a text prompt (real V2V). Model: grok-imagine-video only.").requiredOption("--video <url-or-path>", "source video URL or local .mp4 path").option("--model <id>", "video model (must be grok-imagine-video)", DEFAULT_VIDEO_MODEL).option("--output <path>", "output file path").option("--json", "output structured JSON").option("--timeout <s>", "polling timeout in seconds", "600").action(async (prompt, opts) => {
1305
- await editAction(prompt, opts);
1306
- });
1307
- cmd.command("extend <prompt>").description("Extend video from its last frame. Model: grok-imagine-video only.").requiredOption("--video <url-or-path>", "source video URL or local .mp4 path").option("--model <id>", "video model (must be grok-imagine-video)", DEFAULT_VIDEO_MODEL).option("--duration <s>", "extension duration 2-10s (default 6)", "6").option("--output <path>", "output file path").option("--json", "output structured JSON").option("--timeout <s>", "polling timeout in seconds", "600").action(async (prompt, opts) => {
1308
- await extendAction(prompt, opts);
1309
- });
1310
- return cmd;
1311
- }
1312
- async function generateAction(prompt, opts) {
1313
- try {
1314
- const bearer = await getValidBearer();
1315
- const duration = parseInt(opts.duration ?? "5", 10);
1316
- const timeout = parseInt(opts.timeout ?? "600", 10) * 1e3;
1317
- const body = {
1318
- model: opts.model ?? DEFAULT_VIDEO_MODEL,
1319
- prompt,
1320
- duration,
1321
- aspect_ratio: opts.aspect ?? "16:9",
1322
- resolution: opts.resolution ?? "480p"
1323
- };
1324
- if (opts.image) {
1325
- const uri = opts.image.startsWith("data:") ? opts.image : imageToDataUri(opts.image);
1326
- body.image = { url: uri };
1327
- } else if (opts.model?.includes("1.5") && !opts.image) {
1328
- body.image = { url: WHITE_PIXEL_PNG };
1329
- body.prompt = `${prompt}
1330
-
1331
- This is not a start frame \u2014 generate freely as a new video.`;
1332
- }
1333
- const res = await fetch(`${XAI_API_BASE_URL}/videos/generations`, {
1334
- method: "POST",
1335
- headers: { Authorization: `Bearer ${bearer}`, "Content-Type": "application/json" },
1336
- body: JSON.stringify(body)
1337
- });
1338
- if (!res.ok) throw new Error(`HTTP ${res.status}: ${(await res.text()).slice(0, 300)}`);
1339
- const { request_id } = await res.json();
1340
- if (!opts.json) {
1341
- log.info(`Video generation started (${request_id})`);
1342
- log.dim(`Model: ${body.model} | ${duration}s | ${opts.aspect} | ${opts.resolution}`);
1343
- }
1344
- const data = await pollUntilDone(request_id, bearer, timeout, opts.json);
1345
- if (opts.json) {
1346
- console.log(JSON.stringify(data, null, 2));
1347
- return;
1348
- }
1349
- const video = data.video;
1350
- if (!video) throw new Error("No video in response");
1351
- const outPath = opts.output ?? `progrok-video-${request_id.slice(0, 8)}.mp4`;
1352
- await downloadAndSave(video.url, outPath);
1353
- if (!opts.json) process.stdout.write("\n");
1354
- log.success(`Video saved: ${outPath}`);
1355
- log.info(`Duration: ${video.duration}s`);
1356
- const usage = data.usage;
1357
- if (usage?.cost_in_usd_ticks) log.dim(`Cost: $${(usage.cost_in_usd_ticks / 1e10).toFixed(4)}`);
1358
- } catch (err) {
1359
- log.error(err.message);
1360
- process.exit(1);
1361
- }
1362
- }
1363
- async function editAction(prompt, opts) {
1364
- try {
1365
- const bearer = await getValidBearer();
1366
- const timeout = parseInt(opts.timeout ?? "600", 10) * 1e3;
1367
- const model = opts.model ?? DEFAULT_VIDEO_MODEL;
1368
- if (model.includes("1.5")) {
1369
- throw new Error("Video editing is only supported by grok-imagine-video (not 1.5-preview).");
1370
- }
1371
- const videoUrl = opts.video.startsWith("http") ? opts.video : (() => {
1372
- throw new Error("--video must be a URL (local file upload not yet supported for editing).");
1373
- })();
1374
- const res = await fetch(`${XAI_API_BASE_URL}/videos/edits`, {
1375
- method: "POST",
1376
- headers: { Authorization: `Bearer ${bearer}`, "Content-Type": "application/json" },
1377
- body: JSON.stringify({ model, prompt, video: { url: videoUrl } })
1378
- });
1379
- if (!res.ok) throw new Error(`HTTP ${res.status}: ${(await res.text()).slice(0, 300)}`);
1380
- const { request_id } = await res.json();
1381
- if (!opts.json) {
1382
- log.info(`Video edit started (${request_id})`);
1383
- log.dim(`Model: ${model} | Edit: "${prompt.slice(0, 60)}"`);
1384
- }
1385
- const data = await pollUntilDone(request_id, bearer, timeout, opts.json);
1386
- if (opts.json) {
1387
- console.log(JSON.stringify(data, null, 2));
1388
- return;
1389
- }
1390
- const video = data.video;
1391
- if (!video) throw new Error("No video in response");
1392
- const outPath = opts.output ?? `progrok-edit-${request_id.slice(0, 8)}.mp4`;
1393
- await downloadAndSave(video.url, outPath);
1394
- if (!opts.json) process.stdout.write("\n");
1395
- log.success(`Edited video saved: ${outPath}`);
1396
- log.info(`Duration: ${video.duration}s`);
1397
- } catch (err) {
1398
- log.error(err.message);
1399
- process.exit(1);
1400
- }
1401
- }
1402
- async function extendAction(prompt, opts) {
1403
- try {
1404
- const bearer = await getValidBearer();
1405
- const timeout = parseInt(opts.timeout ?? "600", 10) * 1e3;
1406
- const duration = parseInt(opts.duration ?? "6", 10);
1407
- const model = opts.model ?? DEFAULT_VIDEO_MODEL;
1408
- if (model.includes("1.5")) {
1409
- throw new Error("Video extension is only supported by grok-imagine-video (not 1.5-preview).");
1410
- }
1411
- if (duration < 2 || duration > 10) {
1412
- throw new Error("Extension duration must be 2-10 seconds.");
1413
- }
1414
- const videoUrl = opts.video.startsWith("http") ? opts.video : (() => {
1415
- throw new Error("--video must be a URL (local file upload not yet supported for extension).");
1416
- })();
1417
- const res = await fetch(`${XAI_API_BASE_URL}/videos/extensions`, {
1418
- method: "POST",
1419
- headers: { Authorization: `Bearer ${bearer}`, "Content-Type": "application/json" },
1420
- body: JSON.stringify({ model, prompt, duration, video: { url: videoUrl } })
1421
- });
1422
- if (!res.ok) throw new Error(`HTTP ${res.status}: ${(await res.text()).slice(0, 300)}`);
1423
- const { request_id } = await res.json();
1424
- if (!opts.json) {
1425
- log.info(`Video extension started (${request_id})`);
1426
- log.dim(`Model: ${model} | Extend: +${duration}s | "${prompt.slice(0, 60)}"`);
1427
- }
1428
- const data = await pollUntilDone(request_id, bearer, timeout, opts.json);
1429
- if (opts.json) {
1430
- console.log(JSON.stringify(data, null, 2));
1431
- return;
1432
- }
1433
- const video = data.video;
1434
- if (!video) throw new Error("No video in response");
1435
- const outPath = opts.output ?? `progrok-extend-${request_id.slice(0, 8)}.mp4`;
1436
- await downloadAndSave(video.url, outPath);
1437
- if (!opts.json) process.stdout.write("\n");
1438
- log.success(`Extended video saved: ${outPath}`);
1439
- log.info(`Total duration: ${video.duration}s (original + ${duration}s extension)`);
1440
- } catch (err) {
1441
- log.error(err.message);
1442
- process.exit(1);
1443
- }
1444
- }
1445
-
1446
- // src/commands/image.ts
1447
- import { Command as Command11 } from "commander";
1448
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
1449
- import { resolve as resolve2 } from "path";
1450
- var DEFAULT_IMAGE_MODEL = "grok-imagine-image";
1451
- function imageToDataUri2(filePath) {
1452
- const abs = resolve2(filePath);
1453
- const buf = readFileSync5(abs);
1454
- const ext = abs.toLowerCase().endsWith(".png") ? "png" : "jpeg";
1455
- return `data:image/${ext};base64,${buf.toString("base64")}`;
1456
- }
1457
- function imageCommand() {
1458
- return new Command11("image").description(
1459
- `Generate or edit images with Grok Imagine.
1460
-
1461
- Examples:
1462
- $ progrok image "A sunset over mountains"
1463
- $ progrok image "Make it winter" --ref photo.jpg
1464
- $ progrok image "prompt" --model grok-imagine-image-quality --resolution 2k`
1465
- ).argument("<prompt>", "image generation/edit prompt").option("--model <id>", "image model", DEFAULT_IMAGE_MODEL).option("--aspect <ratio>", "aspect ratio (1:1, 16:9, 9:16, etc.)", "1:1").option("--resolution <r>", "1k or 2k", "1k").option("--ref <path>", "reference image(s) for editing (repeatable)", collectRefs, []).option("--output <path>", "output file path").option("--json", "output structured JSON").option("--n <count>", "number of images", "1").action(async (prompt, opts) => {
1466
- try {
1467
- const bearer = await getValidBearer();
1468
- const refs = opts.ref ?? [];
1469
- const n = parseInt(opts.n ?? "1", 10);
1470
- const isEdit = refs.length > 0;
1471
- const endpoint = isEdit ? "images/edits" : "images/generations";
1472
- const body = {
1473
- model: opts.model ?? DEFAULT_IMAGE_MODEL,
1474
- prompt,
1475
- n,
1476
- response_format: "b64_json",
1477
- aspect_ratio: opts.aspect ?? "1:1",
1478
- resolution: opts.resolution ?? "1k"
1479
- };
1480
- if (isEdit) {
1481
- if (refs.length === 1) {
1482
- body.image = { type: "image_url", url: imageToDataUri2(refs[0]) };
1483
- } else {
1484
- body.images = refs.map((r) => ({ type: "image_url", url: imageToDataUri2(r) }));
1485
- }
1486
- }
1487
- const res = await fetch(`${XAI_API_BASE_URL}/${endpoint}`, {
1488
- method: "POST",
1489
- headers: {
1490
- Authorization: `Bearer ${bearer}`,
1491
- "Content-Type": "application/json"
1492
- },
1493
- body: JSON.stringify(body)
1494
- });
1495
- if (!res.ok) {
1496
- const errBody = await res.text();
1497
- throw new Error(`HTTP ${res.status}: ${errBody.slice(0, 300)}`);
1498
- }
1499
- const data = await res.json();
1500
- if (opts.json) {
1501
- console.log(JSON.stringify(data, null, 2));
1502
- return;
1503
- }
1504
- for (let i = 0; i < data.data.length; i++) {
1505
- const item = data.data[i];
1506
- if (item.b64_json) {
1507
- const suffix = data.data.length > 1 ? `-${i + 1}` : "";
1508
- const outPath = opts.output ? opts.output.replace(/(\.\w+)$/, `${suffix}$1`) : `progrok-image${suffix}.png`;
1509
- writeFileSync3(outPath, Buffer.from(item.b64_json, "base64"));
1510
- log.success(`Image saved: ${outPath}`);
1511
- } else if (item.url) {
1512
- log.info(`Image URL: ${item.url}`);
1513
- }
1514
- if (item.revised_prompt) {
1515
- log.dim(`Revised: ${item.revised_prompt.slice(0, 100)}`);
1516
- }
1517
- }
1518
- if (data.usage?.cost_in_usd_ticks) {
1519
- log.dim(`Cost: $${(data.usage.cost_in_usd_ticks / 1e10).toFixed(4)}`);
1520
- }
1521
- } catch (err) {
1522
- log.error(err.message);
1523
- process.exit(1);
1524
- }
1525
- });
1526
- }
1527
- function collectRefs(value, prev) {
1528
- return [...prev, value];
1529
- }
1530
-
1531
- // src/utils/config.ts
1532
- import {
1533
- readFileSync as readFileSync6,
1534
- writeFileSync as writeFileSync4,
1535
- existsSync as existsSync3,
1536
- mkdirSync as mkdirSync2
1537
- } from "fs";
1538
- function ensureConfigDir2() {
1539
- if (!existsSync3(CONFIG_DIR)) {
1540
- mkdirSync2(CONFIG_DIR, { recursive: true, mode: 448 });
1541
- }
1542
- }
1543
- function readConfig() {
1544
- try {
1545
- return JSON.parse(readFileSync6(CONFIG_FILE, "utf8"));
1546
- } catch {
1547
- return {};
1548
- }
1549
- }
1550
- function writeConfig(config) {
1551
- ensureConfigDir2();
1552
- writeFileSync4(CONFIG_FILE, JSON.stringify(config, null, 2), { mode: 384 });
1553
- }
1554
-
1555
- // src/utils/star-prompt.ts
1556
- async function showStarPrompt() {
1557
- const config = readConfig();
1558
- if (config.onboarding?.starPrompted) return;
1559
- log.dim("\u2500".repeat(50));
1560
- log.info("\u2B50 If progrok is useful, star the repo!");
1561
- log.dim(` ${GITHUB_URL}`);
1562
- log.dim("\u2500".repeat(50) + "\n");
1563
- writeConfig({
1564
- ...config,
1565
- onboarding: { ...config.onboarding, starPrompted: true }
1566
- });
1567
- }
1568
-
1569
- // src/index.ts
1570
- import { readFileSync as readFileSync7 } from "fs";
1571
- import { fileURLToPath as fileURLToPath4 } from "url";
1572
- import { dirname as dirname4, join as join5 } from "path";
1573
- var __dirname2 = dirname4(fileURLToPath4(import.meta.url));
1574
- function getVersion() {
1575
- try {
1576
- const pkg = JSON.parse(
1577
- readFileSync7(join5(__dirname2, "..", "package.json"), "utf8")
1578
- );
1579
- return pkg.version;
1580
- } catch {
1581
- return "0.0.0";
1582
- }
1583
- }
1584
- var program = new Command12();
1585
- program.name("progrok").description(
1586
- `Activate your xAI OAuth session as a local Grok API proxy and CLI tool surface.
1587
-
1588
- SuperGrok OAuth \u2192 local proxy \u2192 OpenAI-compatible API for any client.
1589
- All xAI endpoints forwarded: responses, chat, images, video, tts, stt.
1590
-
1591
- Quick start:
1592
- $ progrok login # OAuth via browser (or --device-code for SSH)
1593
- $ progrok proxy # Start proxy on 127.0.0.1:18645
1594
- $ curl localhost:18645/v1/chat/completions -d '{"model":"grok-4.3",...}'
1595
-
1596
- Proxy forwards ALL /v1/* paths to api.x.ai \u2014 no whitelist.
1597
- Supported xAI surfaces:
1598
- /v1/responses Responses API (streaming, tools, reasoning)
1599
- /v1/chat/completions OpenAI-compatible chat
1600
- /v1/models Model list
1601
- /v1/language-models Detailed models (pricing, aliases, modalities)
1602
- /v1/images/generations Image generation (grok-imagine-image)
1603
- /v1/videos/generations Video generation (async, poll /v1/videos/{id})
1604
- /v1/tts Text-to-speech
1605
- /v1/stt Speech-to-text
1606
- /v1/batch/completions Batch processing
1607
- /v1/embeddings Embeddings`
1608
- ).version(getVersion());
1609
- program.addCommand(loginCommand());
1610
- program.addCommand(logoutCommand());
1611
- program.addCommand(proxyCommand());
1612
- program.addCommand(chatCommand());
1613
- program.addCommand(modelsCommand());
1614
- program.addCommand(statusCommand());
1615
- program.addCommand(skillCommand());
1616
- program.addCommand(capabilitiesCommand());
1617
- program.addCommand(searchCommand());
1618
- program.addCommand(videoCommand());
1619
- program.addCommand(imageCommand());
1620
- var REAL_COMMANDS = /* @__PURE__ */ new Set(["login", "logout", "proxy", "chat", "models", "status", "skill", "capabilities", "search", "video", "image"]);
1621
- var subcommand = process.argv[2];
1622
- if (subcommand && REAL_COMMANDS.has(subcommand)) {
1623
- await showStarPrompt();
1624
- }
1625
- program.parse();
1626
- //# sourceMappingURL=index.js.map