ima2-gen 1.1.13 → 1.1.16
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.
- package/README.md +31 -7
- package/bin/commands/capabilities.js +5 -0
- package/bin/commands/capabilities.ts +5 -0
- package/bin/commands/doctor.js +195 -0
- package/bin/commands/doctor.ts +202 -0
- package/bin/commands/edit.js +6 -6
- package/bin/commands/edit.ts +6 -6
- package/bin/commands/gen.js +6 -6
- package/bin/commands/gen.ts +6 -6
- package/bin/commands/grok.js +61 -0
- package/bin/commands/grok.ts +67 -0
- package/bin/commands/multimode.js +3 -3
- package/bin/commands/multimode.ts +3 -3
- package/bin/commands/node.js +4 -4
- package/bin/commands/node.ts +4 -4
- package/bin/ima2.js +5 -105
- package/bin/ima2.ts +5 -109
- package/config.js +17 -0
- package/config.ts +21 -0
- package/docs/API.md +77 -8
- package/docs/CLI.md +65 -3
- package/docs/FAQ.ko.md +82 -2
- package/docs/FAQ.md +85 -2
- package/docs/PROMPT_STUDIO.ko.md +111 -0
- package/docs/PROMPT_STUDIO.md +115 -0
- package/docs/README.ko.md +27 -7
- package/docs/grok-video-i2v-plan.md +419 -0
- package/docs/grok-video-i2v-research.md +204 -0
- package/docs/migration/runtime-test-inventory.md +12 -1
- package/lib/agentRuntime.js +88 -19
- package/lib/agentRuntime.ts +97 -29
- package/lib/agentSettings.js +1 -1
- package/lib/agentSettings.ts +1 -1
- package/lib/agentTypes.ts +1 -1
- package/lib/capabilities.js +10 -2
- package/lib/capabilities.ts +10 -2
- package/lib/configKeys.js +6 -0
- package/lib/configKeys.ts +6 -1
- package/lib/errorClassify.js +1 -1
- package/lib/errorClassify.ts +1 -1
- package/lib/generationErrors.js +121 -23
- package/lib/generationErrors.ts +100 -13
- package/lib/grokImageAdapter.js +364 -0
- package/lib/grokImageAdapter.ts +483 -0
- package/lib/grokMultimodeAdapter.js +54 -0
- package/lib/grokMultimodeAdapter.ts +84 -0
- package/lib/grokProxyLauncher.js +105 -0
- package/lib/grokProxyLauncher.ts +129 -0
- package/lib/grokRuntime.js +18 -0
- package/lib/grokRuntime.ts +23 -0
- package/lib/grokSizeMapper.js +63 -0
- package/lib/grokSizeMapper.ts +71 -0
- package/lib/grokVideoAdapter.js +374 -0
- package/lib/grokVideoAdapter.ts +438 -0
- package/lib/historyList.js +5 -1
- package/lib/historyList.ts +5 -1
- package/lib/imageMetadata.js +2 -0
- package/lib/imageMetadata.ts +2 -0
- package/lib/imageModels.js +101 -0
- package/lib/imageModels.ts +111 -0
- package/lib/providerOptions.js +15 -1
- package/lib/providerOptions.ts +15 -1
- package/lib/responsesDoctor.js +386 -0
- package/lib/responsesDoctor.ts +456 -0
- package/lib/responsesErrors.js +57 -0
- package/lib/responsesErrors.ts +83 -0
- package/lib/responsesFallback.js +72 -0
- package/lib/responsesFallback.ts +114 -0
- package/lib/responsesImageAdapter.js +121 -174
- package/lib/responsesImageAdapter.ts +136 -211
- package/lib/responsesParse.js +324 -0
- package/lib/responsesParse.ts +452 -0
- package/lib/responsesTools.js +15 -0
- package/lib/responsesTools.ts +28 -0
- package/lib/runtimeContext.js +12 -0
- package/lib/runtimeContext.ts +15 -0
- package/node_modules/array-flatten/LICENSE +21 -0
- package/node_modules/array-flatten/README.md +43 -0
- package/node_modules/array-flatten/array-flatten.js +64 -0
- package/node_modules/array-flatten/package.json +39 -0
- package/node_modules/bundle-name/index.js +5 -0
- package/node_modules/bundle-name/license +9 -0
- package/node_modules/bundle-name/package.json +45 -0
- package/node_modules/bundle-name/readme.md +23 -0
- package/node_modules/bytes/History.md +97 -0
- package/node_modules/bytes/LICENSE +23 -0
- package/node_modules/bytes/Readme.md +152 -0
- package/node_modules/bytes/index.js +170 -0
- package/node_modules/bytes/package.json +42 -0
- package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/call-bound/.eslintrc +13 -0
- package/node_modules/call-bound/.github/FUNDING.yml +12 -0
- package/node_modules/call-bound/.nycrc +9 -0
- package/node_modules/call-bound/CHANGELOG.md +42 -0
- package/node_modules/call-bound/LICENSE +21 -0
- package/node_modules/call-bound/README.md +53 -0
- package/node_modules/call-bound/index.d.ts +94 -0
- package/node_modules/call-bound/index.js +19 -0
- package/node_modules/call-bound/package.json +99 -0
- package/node_modules/call-bound/test/index.js +61 -0
- package/node_modules/call-bound/tsconfig.json +10 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1149 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2662 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +709 -0
- package/node_modules/commander/lib/option.js +367 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +82 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +1045 -0
- package/node_modules/content-type/HISTORY.md +29 -0
- package/node_modules/content-type/LICENSE +22 -0
- package/node_modules/content-type/README.md +94 -0
- package/node_modules/content-type/index.js +225 -0
- package/node_modules/content-type/package.json +42 -0
- package/node_modules/cookie/LICENSE +24 -0
- package/node_modules/cookie/README.md +317 -0
- package/node_modules/cookie/SECURITY.md +25 -0
- package/node_modules/cookie/index.js +335 -0
- package/node_modules/cookie/package.json +44 -0
- package/node_modules/default-browser/index.d.ts +29 -0
- package/node_modules/default-browser/index.js +34 -0
- package/node_modules/default-browser/license +9 -0
- package/node_modules/default-browser/package.json +54 -0
- package/node_modules/default-browser/readme.md +24 -0
- package/node_modules/default-browser/windows.js +57 -0
- package/node_modules/default-browser-id/index.js +25 -0
- package/node_modules/default-browser-id/license +9 -0
- package/node_modules/default-browser-id/package.json +41 -0
- package/node_modules/default-browser-id/readme.md +19 -0
- package/node_modules/define-lazy-prop/index.d.ts +31 -0
- package/node_modules/define-lazy-prop/index.js +18 -0
- package/node_modules/define-lazy-prop/license +9 -0
- package/node_modules/define-lazy-prop/package.json +51 -0
- package/node_modules/define-lazy-prop/readme.md +55 -0
- package/node_modules/depd/History.md +103 -0
- package/node_modules/depd/LICENSE +22 -0
- package/node_modules/depd/Readme.md +280 -0
- package/node_modules/depd/index.js +538 -0
- package/node_modules/depd/lib/browser/index.js +77 -0
- package/node_modules/depd/package.json +45 -0
- package/node_modules/destroy/LICENSE +23 -0
- package/node_modules/destroy/README.md +63 -0
- package/node_modules/destroy/index.js +209 -0
- package/node_modules/destroy/package.json +48 -0
- package/node_modules/dunder-proto/.eslintrc +5 -0
- package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +24 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +30 -0
- package/node_modules/dunder-proto/package.json +76 -0
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +35 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +50 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- package/node_modules/ee-first/LICENSE +22 -0
- package/node_modules/ee-first/README.md +80 -0
- package/node_modules/ee-first/index.js +95 -0
- package/node_modules/ee-first/package.json +29 -0
- package/node_modules/encodeurl/LICENSE +22 -0
- package/node_modules/encodeurl/README.md +109 -0
- package/node_modules/encodeurl/index.js +60 -0
- package/node_modules/encodeurl/package.json +40 -0
- package/node_modules/es-define-property/.eslintrc +13 -0
- package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/node_modules/es-define-property/.nycrc +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/node_modules/es-define-property/LICENSE +21 -0
- package/node_modules/es-define-property/README.md +49 -0
- package/node_modules/es-define-property/index.d.ts +3 -0
- package/node_modules/es-define-property/index.js +14 -0
- package/node_modules/es-define-property/package.json +81 -0
- package/node_modules/es-define-property/test/index.js +56 -0
- package/node_modules/es-define-property/tsconfig.json +10 -0
- package/node_modules/es-errors/.eslintrc +5 -0
- package/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/node_modules/es-errors/CHANGELOG.md +40 -0
- package/node_modules/es-errors/LICENSE +21 -0
- package/node_modules/es-errors/README.md +55 -0
- package/node_modules/es-errors/eval.d.ts +3 -0
- package/node_modules/es-errors/eval.js +4 -0
- package/node_modules/es-errors/index.d.ts +3 -0
- package/node_modules/es-errors/index.js +4 -0
- package/node_modules/es-errors/package.json +80 -0
- package/node_modules/es-errors/range.d.ts +3 -0
- package/node_modules/es-errors/range.js +4 -0
- package/node_modules/es-errors/ref.d.ts +3 -0
- package/node_modules/es-errors/ref.js +4 -0
- package/node_modules/es-errors/syntax.d.ts +3 -0
- package/node_modules/es-errors/syntax.js +4 -0
- package/node_modules/es-errors/test/index.js +19 -0
- package/node_modules/es-errors/tsconfig.json +49 -0
- package/node_modules/es-errors/type.d.ts +3 -0
- package/node_modules/es-errors/type.js +4 -0
- package/node_modules/es-errors/uri.d.ts +3 -0
- package/node_modules/es-errors/uri.js +4 -0
- package/node_modules/es-object-atoms/.eslintrc +16 -0
- package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
- package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
- package/node_modules/es-object-atoms/LICENSE +21 -0
- package/node_modules/es-object-atoms/README.md +63 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/node_modules/es-object-atoms/ToObject.js +10 -0
- package/node_modules/es-object-atoms/index.d.ts +3 -0
- package/node_modules/es-object-atoms/index.js +4 -0
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +80 -0
- package/node_modules/es-object-atoms/test/index.js +38 -0
- package/node_modules/es-object-atoms/tsconfig.json +6 -0
- package/node_modules/escape-html/LICENSE +24 -0
- package/node_modules/escape-html/Readme.md +43 -0
- package/node_modules/escape-html/index.js +78 -0
- package/node_modules/escape-html/package.json +24 -0
- package/node_modules/etag/HISTORY.md +83 -0
- package/node_modules/etag/LICENSE +22 -0
- package/node_modules/etag/README.md +159 -0
- package/node_modules/etag/index.js +131 -0
- package/node_modules/etag/package.json +47 -0
- package/node_modules/forwarded/HISTORY.md +21 -0
- package/node_modules/forwarded/LICENSE +22 -0
- package/node_modules/forwarded/README.md +57 -0
- package/node_modules/forwarded/index.js +90 -0
- package/node_modules/forwarded/package.json +45 -0
- package/node_modules/function-bind/.eslintrc +21 -0
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/LICENSE +20 -0
- package/node_modules/function-bind/README.md +46 -0
- package/node_modules/function-bind/implementation.js +84 -0
- package/node_modules/function-bind/index.js +5 -0
- package/node_modules/function-bind/package.json +87 -0
- package/node_modules/function-bind/test/.eslintrc +9 -0
- package/node_modules/function-bind/test/index.js +252 -0
- package/node_modules/get-intrinsic/.eslintrc +42 -0
- package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/node_modules/get-intrinsic/.nycrc +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
- package/node_modules/get-intrinsic/LICENSE +21 -0
- package/node_modules/get-intrinsic/README.md +71 -0
- package/node_modules/get-intrinsic/index.js +378 -0
- package/node_modules/get-intrinsic/package.json +97 -0
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/node_modules/get-proto/.eslintrc +10 -0
- package/node_modules/get-proto/.github/FUNDING.yml +12 -0
- package/node_modules/get-proto/.nycrc +9 -0
- package/node_modules/get-proto/CHANGELOG.md +21 -0
- package/node_modules/get-proto/LICENSE +21 -0
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/node_modules/get-proto/README.md +50 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/node_modules/get-proto/index.d.ts +5 -0
- package/node_modules/get-proto/index.js +27 -0
- package/node_modules/get-proto/package.json +81 -0
- package/node_modules/get-proto/test/index.js +68 -0
- package/node_modules/get-proto/tsconfig.json +9 -0
- package/node_modules/gopd/.eslintrc +16 -0
- package/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/node_modules/gopd/CHANGELOG.md +45 -0
- package/node_modules/gopd/LICENSE +21 -0
- package/node_modules/gopd/README.md +40 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +15 -0
- package/node_modules/gopd/package.json +77 -0
- package/node_modules/gopd/test/index.js +36 -0
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-symbols/.eslintrc +11 -0
- package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/node_modules/has-symbols/.nycrc +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +91 -0
- package/node_modules/has-symbols/LICENSE +21 -0
- package/node_modules/has-symbols/README.md +46 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +14 -0
- package/node_modules/has-symbols/package.json +111 -0
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +45 -0
- package/node_modules/has-symbols/test/index.js +22 -0
- package/node_modules/has-symbols/test/shams/core-js.js +29 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
- package/node_modules/has-symbols/test/tests.js +58 -0
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +51 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +4 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +92 -0
- package/node_modules/hasown/tsconfig.json +6 -0
- package/node_modules/http-errors/HISTORY.md +186 -0
- package/node_modules/http-errors/LICENSE +23 -0
- package/node_modules/http-errors/README.md +169 -0
- package/node_modules/http-errors/index.js +290 -0
- package/node_modules/http-errors/package.json +54 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/ipaddr.js/LICENSE +19 -0
- package/node_modules/ipaddr.js/README.md +233 -0
- package/node_modules/ipaddr.js/ipaddr.min.js +1 -0
- package/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
- package/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
- package/node_modules/ipaddr.js/package.json +35 -0
- package/node_modules/is-docker/cli.js +5 -0
- package/node_modules/is-docker/index.d.ts +13 -0
- package/node_modules/is-docker/index.js +29 -0
- package/node_modules/is-docker/license +9 -0
- package/node_modules/is-docker/package.json +44 -0
- package/node_modules/is-docker/readme.md +27 -0
- package/node_modules/is-inside-container/cli.js +5 -0
- package/node_modules/is-inside-container/index.d.ts +13 -0
- package/node_modules/is-inside-container/index.js +23 -0
- package/node_modules/is-inside-container/license +9 -0
- package/node_modules/is-inside-container/package.json +51 -0
- package/node_modules/is-inside-container/readme.md +36 -0
- package/node_modules/is-wsl/index.d.ts +15 -0
- package/node_modules/is-wsl/index.js +36 -0
- package/node_modules/is-wsl/license +9 -0
- package/node_modules/is-wsl/package.json +58 -0
- package/node_modules/is-wsl/readme.md +21 -0
- package/node_modules/math-intrinsics/.eslintrc +16 -0
- package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/node_modules/math-intrinsics/LICENSE +21 -0
- package/node_modules/math-intrinsics/README.md +50 -0
- package/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/node_modules/math-intrinsics/abs.js +4 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/node_modules/math-intrinsics/floor.js +4 -0
- package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/node_modules/math-intrinsics/isFinite.js +12 -0
- package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/isInteger.js +16 -0
- package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/node_modules/math-intrinsics/isNaN.js +6 -0
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/node_modules/math-intrinsics/max.d.ts +1 -0
- package/node_modules/math-intrinsics/max.js +4 -0
- package/node_modules/math-intrinsics/min.d.ts +1 -0
- package/node_modules/math-intrinsics/min.js +4 -0
- package/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/node_modules/math-intrinsics/mod.js +9 -0
- package/node_modules/math-intrinsics/package.json +86 -0
- package/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/node_modules/math-intrinsics/pow.js +4 -0
- package/node_modules/math-intrinsics/round.d.ts +1 -0
- package/node_modules/math-intrinsics/round.js +4 -0
- package/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/node_modules/math-intrinsics/sign.js +11 -0
- package/node_modules/math-intrinsics/test/index.js +192 -0
- package/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/node_modules/methods/HISTORY.md +29 -0
- package/node_modules/methods/LICENSE +24 -0
- package/node_modules/methods/README.md +51 -0
- package/node_modules/methods/index.js +69 -0
- package/node_modules/methods/package.json +36 -0
- package/node_modules/mime/.npmignore +0 -0
- package/node_modules/mime/CHANGELOG.md +164 -0
- package/node_modules/mime/LICENSE +21 -0
- package/node_modules/mime/README.md +90 -0
- package/node_modules/mime/cli.js +8 -0
- package/node_modules/mime/mime.js +108 -0
- package/node_modules/mime/package.json +44 -0
- package/node_modules/mime/src/build.js +53 -0
- package/node_modules/mime/src/test.js +60 -0
- package/node_modules/mime/types.json +1 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/object-inspect/.eslintrc +53 -0
- package/node_modules/object-inspect/.github/FUNDING.yml +12 -0
- package/node_modules/object-inspect/.nycrc +13 -0
- package/node_modules/object-inspect/CHANGELOG.md +424 -0
- package/node_modules/object-inspect/LICENSE +21 -0
- package/node_modules/object-inspect/example/all.js +23 -0
- package/node_modules/object-inspect/example/circular.js +6 -0
- package/node_modules/object-inspect/example/fn.js +5 -0
- package/node_modules/object-inspect/example/inspect.js +10 -0
- package/node_modules/object-inspect/index.js +544 -0
- package/node_modules/object-inspect/package-support.json +20 -0
- package/node_modules/object-inspect/package.json +105 -0
- package/node_modules/object-inspect/readme.markdown +84 -0
- package/node_modules/object-inspect/test/bigint.js +58 -0
- package/node_modules/object-inspect/test/browser/dom.js +15 -0
- package/node_modules/object-inspect/test/circular.js +16 -0
- package/node_modules/object-inspect/test/deep.js +12 -0
- package/node_modules/object-inspect/test/element.js +53 -0
- package/node_modules/object-inspect/test/err.js +48 -0
- package/node_modules/object-inspect/test/fakes.js +29 -0
- package/node_modules/object-inspect/test/fn.js +76 -0
- package/node_modules/object-inspect/test/global.js +17 -0
- package/node_modules/object-inspect/test/has.js +15 -0
- package/node_modules/object-inspect/test/holes.js +15 -0
- package/node_modules/object-inspect/test/indent-option.js +271 -0
- package/node_modules/object-inspect/test/inspect.js +139 -0
- package/node_modules/object-inspect/test/lowbyte.js +12 -0
- package/node_modules/object-inspect/test/number.js +58 -0
- package/node_modules/object-inspect/test/quoteStyle.js +26 -0
- package/node_modules/object-inspect/test/toStringTag.js +40 -0
- package/node_modules/object-inspect/test/undef.js +12 -0
- package/node_modules/object-inspect/test/values.js +261 -0
- package/node_modules/object-inspect/test-core-js.js +26 -0
- package/node_modules/object-inspect/util.inspect.js +1 -0
- package/node_modules/on-finished/HISTORY.md +98 -0
- package/node_modules/on-finished/LICENSE +23 -0
- package/node_modules/on-finished/README.md +162 -0
- package/node_modules/on-finished/index.js +234 -0
- package/node_modules/on-finished/package.json +39 -0
- package/node_modules/open/index.d.ts +158 -0
- package/node_modules/open/index.js +366 -0
- package/node_modules/open/license +9 -0
- package/node_modules/open/node_modules/wsl-utils/index.d.ts +21 -0
- package/node_modules/open/node_modules/wsl-utils/index.js +57 -0
- package/node_modules/open/node_modules/wsl-utils/license +9 -0
- package/node_modules/open/node_modules/wsl-utils/package.json +46 -0
- package/node_modules/open/node_modules/wsl-utils/readme.md +50 -0
- package/node_modules/open/package.json +68 -0
- package/node_modules/open/readme.md +183 -0
- package/node_modules/open/xdg-open +1267 -0
- package/node_modules/parseurl/HISTORY.md +58 -0
- package/node_modules/parseurl/LICENSE +24 -0
- package/node_modules/parseurl/README.md +133 -0
- package/node_modules/parseurl/index.js +158 -0
- package/node_modules/parseurl/package.json +40 -0
- package/node_modules/progrok/LICENSE +21 -0
- package/node_modules/progrok/README.md +53 -0
- package/node_modules/progrok/THIRD_PARTY_NOTICES.md +13 -0
- package/node_modules/progrok/dist/index.js +1142 -0
- package/node_modules/progrok/dist/index.js.map +1 -0
- package/node_modules/progrok/dist/public/app.js +529 -0
- package/node_modules/progrok/dist/public/index.html +47 -0
- package/node_modules/progrok/dist/public/style.css +392 -0
- package/node_modules/progrok/node_modules/accepts/HISTORY.md +243 -0
- package/node_modules/progrok/node_modules/accepts/LICENSE +23 -0
- package/node_modules/progrok/node_modules/accepts/README.md +140 -0
- package/node_modules/progrok/node_modules/accepts/index.js +238 -0
- package/node_modules/progrok/node_modules/accepts/package.json +47 -0
- package/node_modules/progrok/node_modules/body-parser/HISTORY.md +686 -0
- package/node_modules/progrok/node_modules/body-parser/LICENSE +23 -0
- package/node_modules/progrok/node_modules/body-parser/README.md +476 -0
- package/node_modules/progrok/node_modules/body-parser/index.js +156 -0
- package/node_modules/progrok/node_modules/body-parser/lib/read.js +205 -0
- package/node_modules/progrok/node_modules/body-parser/lib/types/json.js +243 -0
- package/node_modules/progrok/node_modules/body-parser/lib/types/raw.js +101 -0
- package/node_modules/progrok/node_modules/body-parser/lib/types/text.js +121 -0
- package/node_modules/progrok/node_modules/body-parser/lib/types/urlencoded.js +299 -0
- package/node_modules/progrok/node_modules/body-parser/package.json +55 -0
- package/node_modules/progrok/node_modules/content-disposition/HISTORY.md +60 -0
- package/node_modules/progrok/node_modules/content-disposition/LICENSE +22 -0
- package/node_modules/progrok/node_modules/content-disposition/README.md +142 -0
- package/node_modules/progrok/node_modules/content-disposition/index.js +458 -0
- package/node_modules/progrok/node_modules/content-disposition/package.json +44 -0
- package/node_modules/progrok/node_modules/cookie-signature/History.md +42 -0
- package/node_modules/progrok/node_modules/cookie-signature/Readme.md +42 -0
- package/node_modules/progrok/node_modules/cookie-signature/index.js +51 -0
- package/node_modules/progrok/node_modules/cookie-signature/package.json +18 -0
- package/node_modules/progrok/node_modules/debug/.coveralls.yml +1 -0
- package/node_modules/progrok/node_modules/debug/.eslintrc +11 -0
- package/node_modules/progrok/node_modules/debug/.npmignore +9 -0
- package/node_modules/progrok/node_modules/debug/.travis.yml +14 -0
- package/node_modules/progrok/node_modules/debug/CHANGELOG.md +362 -0
- package/node_modules/progrok/node_modules/debug/LICENSE +19 -0
- package/node_modules/progrok/node_modules/debug/Makefile +50 -0
- package/node_modules/progrok/node_modules/debug/README.md +312 -0
- package/node_modules/progrok/node_modules/debug/component.json +19 -0
- package/node_modules/progrok/node_modules/debug/karma.conf.js +70 -0
- package/node_modules/progrok/node_modules/debug/node.js +1 -0
- package/node_modules/progrok/node_modules/debug/node_modules/ms/index.js +152 -0
- package/node_modules/progrok/node_modules/debug/node_modules/ms/license.md +21 -0
- package/node_modules/progrok/node_modules/debug/node_modules/ms/package.json +37 -0
- package/node_modules/progrok/node_modules/debug/node_modules/ms/readme.md +51 -0
- package/node_modules/progrok/node_modules/debug/package.json +49 -0
- package/node_modules/progrok/node_modules/debug/src/browser.js +185 -0
- package/node_modules/progrok/node_modules/debug/src/debug.js +202 -0
- package/node_modules/progrok/node_modules/debug/src/index.js +10 -0
- package/node_modules/progrok/node_modules/debug/src/inspector-log.js +15 -0
- package/node_modules/progrok/node_modules/debug/src/node.js +248 -0
- package/node_modules/progrok/node_modules/express/History.md +3676 -0
- package/node_modules/progrok/node_modules/express/LICENSE +24 -0
- package/node_modules/progrok/node_modules/express/Readme.md +260 -0
- package/node_modules/progrok/node_modules/express/index.js +11 -0
- package/node_modules/progrok/node_modules/express/lib/application.js +661 -0
- package/node_modules/progrok/node_modules/express/lib/express.js +116 -0
- package/node_modules/progrok/node_modules/express/lib/middleware/init.js +43 -0
- package/node_modules/progrok/node_modules/express/lib/middleware/query.js +47 -0
- package/node_modules/progrok/node_modules/express/lib/request.js +525 -0
- package/node_modules/progrok/node_modules/express/lib/response.js +1179 -0
- package/node_modules/progrok/node_modules/express/lib/router/index.js +673 -0
- package/node_modules/progrok/node_modules/express/lib/router/layer.js +181 -0
- package/node_modules/progrok/node_modules/express/lib/router/route.js +230 -0
- package/node_modules/progrok/node_modules/express/lib/utils.js +304 -0
- package/node_modules/progrok/node_modules/express/lib/view.js +182 -0
- package/node_modules/progrok/node_modules/express/package.json +102 -0
- package/node_modules/progrok/node_modules/finalhandler/HISTORY.md +216 -0
- package/node_modules/progrok/node_modules/finalhandler/LICENSE +22 -0
- package/node_modules/progrok/node_modules/finalhandler/README.md +147 -0
- package/node_modules/progrok/node_modules/finalhandler/SECURITY.md +25 -0
- package/node_modules/progrok/node_modules/finalhandler/index.js +341 -0
- package/node_modules/progrok/node_modules/finalhandler/package.json +47 -0
- package/node_modules/progrok/node_modules/fresh/HISTORY.md +70 -0
- package/node_modules/progrok/node_modules/fresh/LICENSE +23 -0
- package/node_modules/progrok/node_modules/fresh/README.md +119 -0
- package/node_modules/progrok/node_modules/fresh/index.js +137 -0
- package/node_modules/progrok/node_modules/fresh/package.json +46 -0
- package/node_modules/progrok/node_modules/iconv-lite/Changelog.md +162 -0
- package/node_modules/progrok/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules/progrok/node_modules/iconv-lite/README.md +156 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/index.js +22 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/node_modules/progrok/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/node_modules/progrok/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/node_modules/progrok/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/node_modules/progrok/node_modules/iconv-lite/lib/index.d.ts +24 -0
- package/node_modules/progrok/node_modules/iconv-lite/lib/index.js +153 -0
- package/node_modules/progrok/node_modules/iconv-lite/lib/streams.js +121 -0
- package/node_modules/progrok/node_modules/iconv-lite/package.json +46 -0
- package/node_modules/progrok/node_modules/media-typer/HISTORY.md +22 -0
- package/node_modules/progrok/node_modules/media-typer/LICENSE +22 -0
- package/node_modules/progrok/node_modules/media-typer/README.md +81 -0
- package/node_modules/progrok/node_modules/media-typer/index.js +270 -0
- package/node_modules/progrok/node_modules/media-typer/package.json +26 -0
- package/node_modules/progrok/node_modules/merge-descriptors/HISTORY.md +21 -0
- package/node_modules/progrok/node_modules/merge-descriptors/LICENSE +23 -0
- package/node_modules/progrok/node_modules/merge-descriptors/README.md +49 -0
- package/node_modules/progrok/node_modules/merge-descriptors/index.js +60 -0
- package/node_modules/progrok/node_modules/merge-descriptors/package.json +39 -0
- package/node_modules/progrok/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/progrok/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/progrok/node_modules/mime-db/README.md +100 -0
- package/node_modules/progrok/node_modules/mime-db/db.json +8519 -0
- package/node_modules/progrok/node_modules/mime-db/index.js +12 -0
- package/node_modules/progrok/node_modules/mime-db/package.json +60 -0
- package/node_modules/progrok/node_modules/mime-types/HISTORY.md +397 -0
- package/node_modules/progrok/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/progrok/node_modules/mime-types/README.md +113 -0
- package/node_modules/progrok/node_modules/mime-types/index.js +188 -0
- package/node_modules/progrok/node_modules/mime-types/package.json +44 -0
- package/node_modules/progrok/node_modules/negotiator/HISTORY.md +108 -0
- package/node_modules/progrok/node_modules/negotiator/LICENSE +24 -0
- package/node_modules/progrok/node_modules/negotiator/README.md +203 -0
- package/node_modules/progrok/node_modules/negotiator/index.js +82 -0
- package/node_modules/progrok/node_modules/negotiator/lib/charset.js +169 -0
- package/node_modules/progrok/node_modules/negotiator/lib/encoding.js +184 -0
- package/node_modules/progrok/node_modules/negotiator/lib/language.js +179 -0
- package/node_modules/progrok/node_modules/negotiator/lib/mediaType.js +294 -0
- package/node_modules/progrok/node_modules/negotiator/package.json +42 -0
- package/node_modules/progrok/node_modules/path-to-regexp/LICENSE +21 -0
- package/node_modules/progrok/node_modules/path-to-regexp/Readme.md +35 -0
- package/node_modules/progrok/node_modules/path-to-regexp/index.js +158 -0
- package/node_modules/progrok/node_modules/path-to-regexp/package.json +30 -0
- package/node_modules/progrok/node_modules/raw-body/LICENSE +22 -0
- package/node_modules/progrok/node_modules/raw-body/README.md +223 -0
- package/node_modules/progrok/node_modules/raw-body/index.d.ts +87 -0
- package/node_modules/progrok/node_modules/raw-body/index.js +336 -0
- package/node_modules/progrok/node_modules/raw-body/package.json +47 -0
- package/node_modules/progrok/node_modules/send/HISTORY.md +538 -0
- package/node_modules/progrok/node_modules/send/LICENSE +23 -0
- package/node_modules/progrok/node_modules/send/README.md +327 -0
- package/node_modules/progrok/node_modules/send/SECURITY.md +24 -0
- package/node_modules/progrok/node_modules/send/index.js +1142 -0
- package/node_modules/progrok/node_modules/send/package.json +62 -0
- package/node_modules/progrok/node_modules/serve-static/HISTORY.md +493 -0
- package/node_modules/progrok/node_modules/serve-static/LICENSE +25 -0
- package/node_modules/progrok/node_modules/serve-static/README.md +257 -0
- package/node_modules/progrok/node_modules/serve-static/index.js +209 -0
- package/node_modules/progrok/node_modules/serve-static/package.json +42 -0
- package/node_modules/progrok/node_modules/type-is/HISTORY.md +259 -0
- package/node_modules/progrok/node_modules/type-is/LICENSE +23 -0
- package/node_modules/progrok/node_modules/type-is/README.md +170 -0
- package/node_modules/progrok/node_modules/type-is/index.js +266 -0
- package/node_modules/progrok/node_modules/type-is/package.json +45 -0
- package/node_modules/progrok/package.json +52 -0
- package/node_modules/progrok/skills/progrok/SKILL.md +228 -0
- package/node_modules/proxy-addr/HISTORY.md +161 -0
- package/node_modules/proxy-addr/LICENSE +22 -0
- package/node_modules/proxy-addr/README.md +139 -0
- package/node_modules/proxy-addr/index.js +327 -0
- package/node_modules/proxy-addr/package.json +47 -0
- package/node_modules/qs/.editorconfig +46 -0
- package/node_modules/qs/.github/FUNDING.yml +12 -0
- package/node_modules/qs/.github/SECURITY.md +11 -0
- package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
- package/node_modules/qs/.nycrc +13 -0
- package/node_modules/qs/CHANGELOG.md +812 -0
- package/node_modules/qs/LICENSE.md +29 -0
- package/node_modules/qs/README.md +758 -0
- package/node_modules/qs/dist/qs.js +141 -0
- package/node_modules/qs/eslint.config.mjs +56 -0
- package/node_modules/qs/lib/formats.js +23 -0
- package/node_modules/qs/lib/index.js +11 -0
- package/node_modules/qs/lib/parse.js +373 -0
- package/node_modules/qs/lib/stringify.js +356 -0
- package/node_modules/qs/lib/utils.js +342 -0
- package/node_modules/qs/package.json +94 -0
- package/node_modules/qs/test/empty-keys-cases.js +267 -0
- package/node_modules/qs/test/parse.js +1654 -0
- package/node_modules/qs/test/stringify.js +1319 -0
- package/node_modules/qs/test/utils.js +432 -0
- package/node_modules/range-parser/HISTORY.md +56 -0
- package/node_modules/range-parser/LICENSE +23 -0
- package/node_modules/range-parser/README.md +84 -0
- package/node_modules/range-parser/index.js +162 -0
- package/node_modules/range-parser/package.json +44 -0
- package/node_modules/run-applescript/index.d.ts +66 -0
- package/node_modules/run-applescript/index.js +37 -0
- package/node_modules/run-applescript/license +9 -0
- package/node_modules/run-applescript/package.json +42 -0
- package/node_modules/run-applescript/readme.md +78 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +65 -0
- package/node_modules/safe-buffer/package.json +51 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/setprototypeof/LICENSE +13 -0
- package/node_modules/setprototypeof/README.md +31 -0
- package/node_modules/setprototypeof/index.d.ts +2 -0
- package/node_modules/setprototypeof/index.js +17 -0
- package/node_modules/setprototypeof/package.json +38 -0
- package/node_modules/setprototypeof/test/index.js +24 -0
- package/node_modules/side-channel/.editorconfig +9 -0
- package/node_modules/side-channel/.eslintrc +12 -0
- package/node_modules/side-channel/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel/.nycrc +13 -0
- package/node_modules/side-channel/CHANGELOG.md +110 -0
- package/node_modules/side-channel/LICENSE +21 -0
- package/node_modules/side-channel/README.md +61 -0
- package/node_modules/side-channel/index.d.ts +14 -0
- package/node_modules/side-channel/index.js +43 -0
- package/node_modules/side-channel/package.json +85 -0
- package/node_modules/side-channel/test/index.js +104 -0
- package/node_modules/side-channel/tsconfig.json +9 -0
- package/node_modules/side-channel-list/.editorconfig +9 -0
- package/node_modules/side-channel-list/.eslintrc +11 -0
- package/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel-list/.nycrc +13 -0
- package/node_modules/side-channel-list/CHANGELOG.md +36 -0
- package/node_modules/side-channel-list/LICENSE +21 -0
- package/node_modules/side-channel-list/README.md +62 -0
- package/node_modules/side-channel-list/index.d.ts +13 -0
- package/node_modules/side-channel-list/index.js +111 -0
- package/node_modules/side-channel-list/list.d.ts +14 -0
- package/node_modules/side-channel-list/package.json +77 -0
- package/node_modules/side-channel-list/test/index.js +154 -0
- package/node_modules/side-channel-list/tsconfig.json +9 -0
- package/node_modules/side-channel-map/.editorconfig +9 -0
- package/node_modules/side-channel-map/.eslintrc +11 -0
- package/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel-map/.nycrc +13 -0
- package/node_modules/side-channel-map/CHANGELOG.md +22 -0
- package/node_modules/side-channel-map/LICENSE +21 -0
- package/node_modules/side-channel-map/README.md +62 -0
- package/node_modules/side-channel-map/index.d.ts +15 -0
- package/node_modules/side-channel-map/index.js +68 -0
- package/node_modules/side-channel-map/package.json +80 -0
- package/node_modules/side-channel-map/test/index.js +114 -0
- package/node_modules/side-channel-map/tsconfig.json +9 -0
- package/node_modules/side-channel-weakmap/.editorconfig +9 -0
- package/node_modules/side-channel-weakmap/.eslintrc +12 -0
- package/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel-weakmap/.nycrc +13 -0
- package/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
- package/node_modules/side-channel-weakmap/LICENSE +21 -0
- package/node_modules/side-channel-weakmap/README.md +62 -0
- package/node_modules/side-channel-weakmap/index.d.ts +15 -0
- package/node_modules/side-channel-weakmap/index.js +84 -0
- package/node_modules/side-channel-weakmap/package.json +87 -0
- package/node_modules/side-channel-weakmap/test/index.js +114 -0
- package/node_modules/side-channel-weakmap/tsconfig.json +9 -0
- package/node_modules/statuses/HISTORY.md +87 -0
- package/node_modules/statuses/LICENSE +23 -0
- package/node_modules/statuses/README.md +139 -0
- package/node_modules/statuses/codes.json +65 -0
- package/node_modules/statuses/index.js +146 -0
- package/node_modules/statuses/package.json +49 -0
- package/node_modules/toidentifier/HISTORY.md +9 -0
- package/node_modules/toidentifier/LICENSE +21 -0
- package/node_modules/toidentifier/README.md +61 -0
- package/node_modules/toidentifier/index.js +32 -0
- package/node_modules/toidentifier/package.json +38 -0
- package/node_modules/unpipe/HISTORY.md +4 -0
- package/node_modules/unpipe/LICENSE +22 -0
- package/node_modules/unpipe/README.md +43 -0
- package/node_modules/unpipe/index.js +69 -0
- package/node_modules/unpipe/package.json +27 -0
- package/node_modules/utils-merge/.npmignore +9 -0
- package/node_modules/utils-merge/LICENSE +20 -0
- package/node_modules/utils-merge/README.md +34 -0
- package/node_modules/utils-merge/index.js +23 -0
- package/node_modules/utils-merge/package.json +40 -0
- package/node_modules/vary/HISTORY.md +39 -0
- package/node_modules/vary/LICENSE +22 -0
- package/node_modules/vary/README.md +101 -0
- package/node_modules/vary/index.js +149 -0
- package/node_modules/vary/package.json +43 -0
- package/package.json +7 -2
- package/routes/edit.js +85 -13
- package/routes/edit.ts +94 -23
- package/routes/generate.js +118 -11
- package/routes/generate.ts +127 -10
- package/routes/grok.js +22 -0
- package/routes/grok.ts +24 -0
- package/routes/health.js +5 -0
- package/routes/health.ts +5 -0
- package/routes/index.js +4 -0
- package/routes/index.ts +4 -0
- package/routes/multimode.js +71 -26
- package/routes/multimode.ts +80 -39
- package/routes/nodes.js +88 -33
- package/routes/nodes.ts +97 -42
- package/routes/video.js +197 -0
- package/routes/video.ts +216 -0
- package/server.js +42 -1
- package/server.ts +34 -1
- package/skills/ima2/SKILL.md +27 -0
- package/ui/dist/.vite/manifest.json +12 -12
- package/ui/dist/assets/AgentWorkspace-c1_kEfFN.js +3 -0
- package/ui/dist/assets/{CardNewsWorkspace-BBLdwzYU.js → CardNewsWorkspace-CTBT3MbP.js} +2 -2
- package/ui/dist/assets/NodeCanvas-D3ecSAEi.js +7 -0
- package/ui/dist/assets/{PromptBuilderPanel-Y2VygFc0.js → PromptBuilderPanel-CqepukCN.js} +2 -2
- package/ui/dist/assets/{PromptImportDialog-C6lFV-LL.js → PromptImportDialog-Bvr8Q8P2.js} +2 -2
- package/ui/dist/assets/{PromptImportDiscoverySection-D8YJFhND.js → PromptImportDiscoverySection-CyZEXyWP.js} +1 -1
- package/ui/dist/assets/{PromptImportFolderSection-ywfcQolW.js → PromptImportFolderSection-CIl-_pyV.js} +1 -1
- package/ui/dist/assets/{PromptLibraryPanel-fk4KmrGy.js → PromptLibraryPanel-Bj23Q6l9.js} +2 -2
- package/ui/dist/assets/SettingsWorkspace-D_GqtEsP.js +1 -0
- package/ui/dist/assets/index-DMjgFXdO.css +1 -0
- package/ui/dist/assets/index-DQ6jg4Ui.js +32 -0
- package/ui/dist/assets/index-DtSBvfgp.js +1 -0
- package/ui/dist/index.html +2 -2
- package/vendor/progrok-0.1.0.tgz +0 -0
- package/ui/dist/assets/AgentWorkspace-BJe9yxPA.js +0 -3
- package/ui/dist/assets/NodeCanvas-BSZ527J4.js +0 -7
- package/ui/dist/assets/SettingsWorkspace-DL5vhAHQ.js +0 -1
- package/ui/dist/assets/index-BLx55BOg.js +0 -1
- package/ui/dist/assets/index-ByViUJfx.css +0 -1
- package/ui/dist/assets/index-Ci36vcFD.js +0 -28
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { logEvent } from "./logger.js";
|
|
2
|
+
import type { RouteRuntimeContext } from "./runtimeContext.js";
|
|
3
|
+
import { getGrokProxyUrl } from "./grokRuntime.js";
|
|
4
|
+
import { grokError, searchGrokVisualContext } from "./grokImageAdapter.js";
|
|
5
|
+
import { detectImageMimeFromB64 } from "./refs.js";
|
|
6
|
+
import type { VideoAspectRatio, VideoMode, VideoResolution } from "./imageModels.js";
|
|
7
|
+
import { MAX_REF2V_REFERENCES } from "./imageModels.js";
|
|
8
|
+
|
|
9
|
+
export interface GrokVideoPlan {
|
|
10
|
+
prompt: string;
|
|
11
|
+
mode: VideoMode;
|
|
12
|
+
duration: number;
|
|
13
|
+
resolution: VideoResolution;
|
|
14
|
+
aspectRatio: VideoAspectRatio;
|
|
15
|
+
webSearchCalls: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type GrokVideoPhase = "planning" | "submitted" | "progress";
|
|
19
|
+
|
|
20
|
+
export interface GrokVideoEvent {
|
|
21
|
+
phase: GrokVideoPhase;
|
|
22
|
+
xaiVideoRequestId?: string;
|
|
23
|
+
progress?: number;
|
|
24
|
+
stalled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface GrokVideoPollResult {
|
|
28
|
+
status: "pending" | "done" | "failed" | "expired";
|
|
29
|
+
progress?: number;
|
|
30
|
+
videoUrl?: string;
|
|
31
|
+
duration?: number | null;
|
|
32
|
+
respectModeration?: boolean;
|
|
33
|
+
usage?: Record<string, number> | null;
|
|
34
|
+
failedCode?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface GrokVideoGenerateResult {
|
|
38
|
+
videoBuffer: Buffer;
|
|
39
|
+
contentType: string;
|
|
40
|
+
url: string;
|
|
41
|
+
duration: number | null;
|
|
42
|
+
resolution: VideoResolution;
|
|
43
|
+
aspectRatio: VideoAspectRatio;
|
|
44
|
+
mode: VideoMode;
|
|
45
|
+
usage: Record<string, number> | null;
|
|
46
|
+
revisedPrompt: string;
|
|
47
|
+
xaiVideoRequestId: string;
|
|
48
|
+
webSearchCalls: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface GrokVideoOptions {
|
|
52
|
+
model?: string;
|
|
53
|
+
mode?: VideoMode;
|
|
54
|
+
duration?: number;
|
|
55
|
+
resolution?: VideoResolution;
|
|
56
|
+
aspectRatio?: VideoAspectRatio;
|
|
57
|
+
sourceImage?: string;
|
|
58
|
+
sourceMime?: string | null;
|
|
59
|
+
referenceImages?: string[];
|
|
60
|
+
signal?: AbortSignal;
|
|
61
|
+
requestId?: string;
|
|
62
|
+
plannedPrompt?: string;
|
|
63
|
+
webSearchCalls?: number;
|
|
64
|
+
onEvent?: (ev: GrokVideoEvent) => void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface VideoConfig {
|
|
68
|
+
model: string;
|
|
69
|
+
startTimeoutMs: number;
|
|
70
|
+
pollIntervalMs: number;
|
|
71
|
+
totalTimeoutMs: number;
|
|
72
|
+
downloadTimeoutMs: number;
|
|
73
|
+
plannerModel: string;
|
|
74
|
+
plannerTimeoutMs: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const STALE_PROGRESS_MS = 180_000;
|
|
78
|
+
|
|
79
|
+
function videoConfig(ctx: RouteRuntimeContext): VideoConfig {
|
|
80
|
+
const g = (ctx.config as any).grokProvider || {};
|
|
81
|
+
return {
|
|
82
|
+
model: g.defaultVideoModel || "grok-imagine-video",
|
|
83
|
+
startTimeoutMs: g.videoStartTimeoutMs || 60_000,
|
|
84
|
+
pollIntervalMs: g.videoPollIntervalMs || 5_000,
|
|
85
|
+
totalTimeoutMs: g.videoTimeoutMs || 900_000,
|
|
86
|
+
downloadTimeoutMs: g.videoDownloadTimeoutMs || 120_000,
|
|
87
|
+
plannerModel: g.plannerModel || "grok-4.3",
|
|
88
|
+
plannerTimeoutMs: g.plannerTimeoutMs || 60_000,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function videoEndpoint(ctx: RouteRuntimeContext, path: string) {
|
|
93
|
+
return {
|
|
94
|
+
url: getGrokProxyUrl(ctx, path),
|
|
95
|
+
headers: { "Content-Type": "application/json", Authorization: "Bearer dummy" },
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function withTimeoutSignal(signal: AbortSignal | undefined, timeoutMs: number) {
|
|
100
|
+
const timeoutController = new AbortController();
|
|
101
|
+
const timer = setTimeout(() => timeoutController.abort(), timeoutMs);
|
|
102
|
+
const combinedSignal = signal ? AbortSignal.any([signal, timeoutController.signal]) : timeoutController.signal;
|
|
103
|
+
return { combinedSignal, timer };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function sleep(ms: number, signal?: AbortSignal): Promise<void> {
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
if (signal?.aborted) return reject(grokError("Generation canceled", 499, "GENERATION_CANCELED"));
|
|
109
|
+
const timer = setTimeout(resolve, ms);
|
|
110
|
+
signal?.addEventListener(
|
|
111
|
+
"abort",
|
|
112
|
+
() => {
|
|
113
|
+
clearTimeout(timer);
|
|
114
|
+
reject(grokError("Generation canceled", 499, "GENERATION_CANCELED"));
|
|
115
|
+
},
|
|
116
|
+
{ once: true },
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function sourceImageUrl(image: string, mime?: string | null): string {
|
|
122
|
+
if (image.startsWith("data:") || image.startsWith("http")) return image;
|
|
123
|
+
const detected = mime || detectImageMimeFromB64(image) || "image/png";
|
|
124
|
+
return `data:${detected};base64,${image}`;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const FAILED_CODE_MAP: Record<string, { code: string; status: number }> = {
|
|
128
|
+
invalid_argument: { code: "GROK_VIDEO_REQUEST_FAILED", status: 400 },
|
|
129
|
+
permission_denied: { code: "GROK_VIDEO_REQUEST_FAILED", status: 403 },
|
|
130
|
+
failed_precondition: { code: "GROK_VIDEO_REQUEST_FAILED", status: 412 },
|
|
131
|
+
service_unavailable: { code: "GROK_VIDEO_POLL_FAILED", status: 502 },
|
|
132
|
+
internal_error: { code: "GROK_VIDEO_FAILED", status: 502 },
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export function buildGrokVideoPlannerPayload(
|
|
136
|
+
prompt: string,
|
|
137
|
+
opts: { model: string; mode: VideoMode; duration: number; resolution: VideoResolution; aspectRatio: VideoAspectRatio; plannerModel?: string; searchSummary?: string; sourceImageUrl?: string; referenceImageUrls?: string[] },
|
|
138
|
+
) {
|
|
139
|
+
const isI2V = opts.mode === "image-to-video";
|
|
140
|
+
const isRef2V = opts.mode === "reference-to-video";
|
|
141
|
+
const continuity = isRef2V
|
|
142
|
+
? "This is reference-to-video: use the provided reference images (referred to as <IMAGE_1>..<IMAGE_N>) as subject/style guidance and keep their subjects recognizable in the generated video."
|
|
143
|
+
: isI2V
|
|
144
|
+
? "This is image-to-video: preserve subject identity and composition unless asked otherwise, and use the source image as the first frame / starting point."
|
|
145
|
+
: "This is text-to-video: describe motion, camera, and action clearly.";
|
|
146
|
+
const userContent: any[] = [
|
|
147
|
+
{
|
|
148
|
+
type: "text",
|
|
149
|
+
text: [
|
|
150
|
+
`Selected video model: ${opts.model}. Mode: ${opts.mode}.`,
|
|
151
|
+
`Requested duration: ${opts.duration}s, resolution: ${opts.resolution}, aspect ratio: ${opts.aspectRatio}.`,
|
|
152
|
+
continuity,
|
|
153
|
+
opts.searchSummary ? `Mandatory web-search brief:\n${opts.searchSummary}` : "Mandatory web-search brief: unavailable.",
|
|
154
|
+
"Return the generate_video.prompt argument in English only, except for exact visible text the user explicitly requested.",
|
|
155
|
+
"",
|
|
156
|
+
"User prompt:",
|
|
157
|
+
prompt,
|
|
158
|
+
].join("\n"),
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
if (isI2V && opts.sourceImageUrl) {
|
|
162
|
+
userContent.push({ type: "image_url", image_url: { url: opts.sourceImageUrl, detail: "high" } });
|
|
163
|
+
}
|
|
164
|
+
if (isRef2V) {
|
|
165
|
+
for (const url of opts.referenceImageUrls ?? []) {
|
|
166
|
+
userContent.push({ type: "image_url", image_url: { url, detail: "high" } });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
model: opts.plannerModel || "grok-4.3",
|
|
171
|
+
stream: false,
|
|
172
|
+
parallel_tool_calls: false,
|
|
173
|
+
messages: [
|
|
174
|
+
{
|
|
175
|
+
role: "system",
|
|
176
|
+
content: [
|
|
177
|
+
"You are ima2's video generation planner for xAI Grok Imagine.",
|
|
178
|
+
"Rewrite the user's request into one concise, production-ready video prompt with motion/camera/action guidance.",
|
|
179
|
+
"The final video prompt argument MUST be written in English, even when the user prompt is not English.",
|
|
180
|
+
"If the user requests exact visible text, keep that visible text verbatim inside the English prompt.",
|
|
181
|
+
"Call generate_video exactly once. Do not answer with plain text.",
|
|
182
|
+
].join(" "),
|
|
183
|
+
},
|
|
184
|
+
{ role: "user", content: userContent },
|
|
185
|
+
],
|
|
186
|
+
tools: [
|
|
187
|
+
{
|
|
188
|
+
type: "function",
|
|
189
|
+
function: {
|
|
190
|
+
name: "generate_video",
|
|
191
|
+
description: "Generate a single video through xAI Videos API.",
|
|
192
|
+
parameters: {
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {
|
|
195
|
+
prompt: { type: "string", description: "Final video-generation prompt to send to xAI Videos API." },
|
|
196
|
+
model: { type: "string", enum: ["grok-imagine-video"] },
|
|
197
|
+
mode: { type: "string", enum: ["text-to-video", "image-to-video", "reference-to-video"] },
|
|
198
|
+
duration: { type: "number" },
|
|
199
|
+
aspect_ratio: { type: "string" },
|
|
200
|
+
resolution: { type: "string", enum: ["480p", "720p"] },
|
|
201
|
+
},
|
|
202
|
+
required: ["prompt"],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
tool_choice: { type: "function", function: { name: "generate_video" } },
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function parseGrokVideoPlanPrompt(response: any): string {
|
|
212
|
+
const toolCalls = response?.choices?.[0]?.message?.tool_calls || [];
|
|
213
|
+
const call = toolCalls.find((item: any) => item.type === "function" && item.function?.name === "generate_video");
|
|
214
|
+
if (!call?.function?.arguments) {
|
|
215
|
+
throw grokError("Grok planner did not call generate_video", 502, "GROK_PLANNER_EMPTY_TOOL_CALL");
|
|
216
|
+
}
|
|
217
|
+
let args: any;
|
|
218
|
+
try {
|
|
219
|
+
args = JSON.parse(call.function.arguments);
|
|
220
|
+
} catch {
|
|
221
|
+
throw grokError("Grok planner returned invalid tool arguments", 502, "GROK_PLANNER_INVALID_TOOL_ARGS");
|
|
222
|
+
}
|
|
223
|
+
if (typeof args?.prompt !== "string" || !args.prompt.trim()) {
|
|
224
|
+
throw grokError("Grok planner returned an empty video prompt", 502, "GROK_PLANNER_INVALID_TOOL_ARGS");
|
|
225
|
+
}
|
|
226
|
+
return args.prompt.trim();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export async function planGrokVideo(prompt: string, ctx: RouteRuntimeContext, options: GrokVideoOptions = {}): Promise<GrokVideoPlan> {
|
|
230
|
+
const cfg = videoConfig(ctx);
|
|
231
|
+
const mode: VideoMode = options.mode || (options.sourceImage ? "image-to-video" : "text-to-video");
|
|
232
|
+
const duration = options.duration ?? 5;
|
|
233
|
+
const resolution = options.resolution || "480p";
|
|
234
|
+
const aspectRatio = options.aspectRatio || "auto";
|
|
235
|
+
const search = await searchGrokVisualContext(prompt, ctx, { signal: options.signal, requestId: options.requestId });
|
|
236
|
+
const referenceImageUrls = (options.referenceImages ?? []).map((img) => sourceImageUrl(img, undefined));
|
|
237
|
+
const payload = buildGrokVideoPlannerPayload(prompt, {
|
|
238
|
+
model: cfg.model,
|
|
239
|
+
mode,
|
|
240
|
+
duration,
|
|
241
|
+
resolution,
|
|
242
|
+
aspectRatio,
|
|
243
|
+
plannerModel: cfg.plannerModel,
|
|
244
|
+
searchSummary: search.summary,
|
|
245
|
+
sourceImageUrl: options.sourceImage ? sourceImageUrl(options.sourceImage, options.sourceMime) : undefined,
|
|
246
|
+
referenceImageUrls,
|
|
247
|
+
});
|
|
248
|
+
const { url, headers } = videoEndpoint(ctx, "/v1/chat/completions");
|
|
249
|
+
const { combinedSignal, timer } = withTimeoutSignal(options.signal, cfg.plannerTimeoutMs);
|
|
250
|
+
logEvent("grok", "video:planner:start", { requestId: options.requestId, mode, duration, resolution });
|
|
251
|
+
try {
|
|
252
|
+
const res = await fetch(url, { method: "POST", headers, body: JSON.stringify(payload), signal: combinedSignal });
|
|
253
|
+
clearTimeout(timer);
|
|
254
|
+
if (!res.ok) {
|
|
255
|
+
const text = await res.text().catch(() => "");
|
|
256
|
+
throw grokError(`Grok video planner failed: ${text || `HTTP ${res.status}`}`, res.status >= 500 ? 502 : res.status, "GROK_PLANNER_BAD_REQUEST");
|
|
257
|
+
}
|
|
258
|
+
const planPrompt = parseGrokVideoPlanPrompt(await res.json());
|
|
259
|
+
logEvent("grok", "video:planner:done", { requestId: options.requestId, mode, promptChars: planPrompt.length });
|
|
260
|
+
return { prompt: planPrompt, mode, duration, resolution, aspectRatio, webSearchCalls: 1 };
|
|
261
|
+
} catch (e: any) {
|
|
262
|
+
clearTimeout(timer);
|
|
263
|
+
if (e.name === "AbortError") {
|
|
264
|
+
if (options.signal?.aborted) throw grokError("Generation canceled", 499, "GENERATION_CANCELED");
|
|
265
|
+
throw grokError("Grok video planner timed out", 504, "GROK_PLANNER_TIMEOUT");
|
|
266
|
+
}
|
|
267
|
+
if (e.code && e.status) throw e;
|
|
268
|
+
throw grokError(`Grok video planner request failed: ${e.message}`, 502, "GROK_PLANNER_NETWORK_FAILED");
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function buildVideoGenerationPayload(plan: GrokVideoPlan, opts: { model: string; sourceImageUrl?: string; referenceImageUrls?: string[] }): Record<string, unknown> {
|
|
273
|
+
if (plan.mode === "image-to-video" && !opts.sourceImageUrl) {
|
|
274
|
+
throw grokError("image-to-video requires a source image", 400, "GROK_VIDEO_INVALID_MODE");
|
|
275
|
+
}
|
|
276
|
+
const refs = opts.referenceImageUrls ?? [];
|
|
277
|
+
if (plan.mode === "reference-to-video") {
|
|
278
|
+
if (refs.length < 2) throw grokError("reference-to-video requires at least 2 reference images", 400, "GROK_VIDEO_INVALID_MODE");
|
|
279
|
+
if (refs.length > MAX_REF2V_REFERENCES) throw grokError(`reference-to-video allows at most ${MAX_REF2V_REFERENCES} reference images`, 400, "GROK_VIDEO_REF_TOO_MANY");
|
|
280
|
+
if (opts.sourceImageUrl) throw grokError("reference-to-video cannot be combined with a single source image", 400, "GROK_VIDEO_INVALID_MODE");
|
|
281
|
+
}
|
|
282
|
+
const payload: Record<string, unknown> = { model: opts.model, prompt: plan.prompt, duration: plan.duration, resolution: plan.resolution };
|
|
283
|
+
if (plan.aspectRatio && plan.aspectRatio !== "auto") payload.aspect_ratio = plan.aspectRatio;
|
|
284
|
+
if (plan.mode === "image-to-video") payload.image = { url: opts.sourceImageUrl };
|
|
285
|
+
if (plan.mode === "reference-to-video") payload.reference_images = refs.map((url) => ({ url }));
|
|
286
|
+
return payload;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export async function startVideoRequest(ctx: RouteRuntimeContext, payload: Record<string, unknown>, options: GrokVideoOptions): Promise<string> {
|
|
290
|
+
const cfg = videoConfig(ctx);
|
|
291
|
+
const { url, headers } = videoEndpoint(ctx, "/v1/videos/generations");
|
|
292
|
+
const { combinedSignal, timer } = withTimeoutSignal(options.signal, cfg.startTimeoutMs);
|
|
293
|
+
try {
|
|
294
|
+
const res = await fetch(url, { method: "POST", headers, body: JSON.stringify(payload), signal: combinedSignal });
|
|
295
|
+
clearTimeout(timer);
|
|
296
|
+
if (!res.ok) {
|
|
297
|
+
const text = await res.text().catch(() => "");
|
|
298
|
+
throw grokError(`Grok video request failed: ${text || `HTTP ${res.status}`}`, res.status >= 500 ? 502 : res.status, "GROK_VIDEO_REQUEST_FAILED");
|
|
299
|
+
}
|
|
300
|
+
const data: any = await res.json();
|
|
301
|
+
const requestId = data?.request_id || data?.id;
|
|
302
|
+
if (!requestId) throw grokError("Grok video start returned no request id", 502, "GROK_VIDEO_REQUEST_FAILED");
|
|
303
|
+
return requestId;
|
|
304
|
+
} catch (e: any) {
|
|
305
|
+
clearTimeout(timer);
|
|
306
|
+
if (e.name === "AbortError") {
|
|
307
|
+
if (options.signal?.aborted) throw grokError("Generation canceled", 499, "GENERATION_CANCELED");
|
|
308
|
+
throw grokError("Grok video start timed out", 504, "GROK_VIDEO_TIMEOUT");
|
|
309
|
+
}
|
|
310
|
+
if (e.code && e.status) throw e;
|
|
311
|
+
throw grokError(`Grok video start request failed: ${e.message}`, 502, "GROK_VIDEO_REQUEST_FAILED");
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export function normalizeVideoPoll(data: any): GrokVideoPollResult {
|
|
316
|
+
const status = data?.status;
|
|
317
|
+
return {
|
|
318
|
+
status,
|
|
319
|
+
progress: typeof data?.progress === "number" ? data.progress : undefined,
|
|
320
|
+
videoUrl: data?.video?.url,
|
|
321
|
+
duration: data?.video?.duration ?? null,
|
|
322
|
+
respectModeration: data?.video?.respect_moderation,
|
|
323
|
+
usage: data?.usage ? { grok_cost_usd_ticks: data.usage.cost_in_usd_ticks ?? 0 } : null,
|
|
324
|
+
failedCode: data?.error?.code,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export async function pollVideoOnce(ctx: RouteRuntimeContext, requestId: string, signal?: AbortSignal): Promise<GrokVideoPollResult> {
|
|
329
|
+
const cfg = videoConfig(ctx);
|
|
330
|
+
const { url, headers } = videoEndpoint(ctx, `/v1/videos/${requestId}`);
|
|
331
|
+
const { combinedSignal, timer } = withTimeoutSignal(signal, cfg.startTimeoutMs);
|
|
332
|
+
try {
|
|
333
|
+
const res = await fetch(url, { method: "GET", headers, signal: combinedSignal });
|
|
334
|
+
clearTimeout(timer);
|
|
335
|
+
if (!res.ok) {
|
|
336
|
+
const text = await res.text().catch(() => "");
|
|
337
|
+
throw grokError(`Grok video poll failed: ${text || `HTTP ${res.status}`}`, res.status >= 500 ? 502 : res.status, "GROK_VIDEO_POLL_FAILED");
|
|
338
|
+
}
|
|
339
|
+
return normalizeVideoPoll(await res.json());
|
|
340
|
+
} catch (e: any) {
|
|
341
|
+
clearTimeout(timer);
|
|
342
|
+
if (e.name === "AbortError") {
|
|
343
|
+
if (signal?.aborted) throw grokError("Generation canceled", 499, "GENERATION_CANCELED");
|
|
344
|
+
throw grokError("Grok video poll timed out", 504, "GROK_VIDEO_TIMEOUT");
|
|
345
|
+
}
|
|
346
|
+
if (e.code && e.status) throw e;
|
|
347
|
+
throw grokError(`Grok video poll request failed: ${e.message}`, 502, "GROK_VIDEO_POLL_FAILED");
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function failedToError(poll: GrokVideoPollResult): Error {
|
|
352
|
+
if (poll.status === "expired") return grokError("Grok video job expired", 502, "GROK_VIDEO_EXPIRED");
|
|
353
|
+
const mapped = poll.failedCode ? FAILED_CODE_MAP[poll.failedCode] : undefined;
|
|
354
|
+
if (mapped) return grokError(`Grok video failed: ${poll.failedCode}`, mapped.status, mapped.code);
|
|
355
|
+
return grokError("Grok video generation failed", 502, "GROK_VIDEO_FAILED");
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export async function pollVideoUntilDone(ctx: RouteRuntimeContext, requestId: string, options: GrokVideoOptions): Promise<GrokVideoPollResult> {
|
|
359
|
+
const cfg = videoConfig(ctx);
|
|
360
|
+
const deadline = Date.now() + cfg.totalTimeoutMs;
|
|
361
|
+
let lastProgress = -1;
|
|
362
|
+
let lastProgressAt = Date.now();
|
|
363
|
+
for (;;) {
|
|
364
|
+
if (Date.now() > deadline) throw grokError("Grok video poll budget exceeded", 504, "GROK_VIDEO_TIMEOUT");
|
|
365
|
+
const poll = await pollVideoOnce(ctx, requestId, options.signal);
|
|
366
|
+
if (poll.status === "done") return poll;
|
|
367
|
+
if (poll.status === "failed" || poll.status === "expired") throw failedToError(poll);
|
|
368
|
+
const progress = poll.progress ?? lastProgress;
|
|
369
|
+
if (progress !== lastProgress) {
|
|
370
|
+
lastProgress = progress;
|
|
371
|
+
lastProgressAt = Date.now();
|
|
372
|
+
}
|
|
373
|
+
const stalled = Date.now() - lastProgressAt > STALE_PROGRESS_MS;
|
|
374
|
+
options.onEvent?.({ phase: "progress", progress: poll.progress, stalled });
|
|
375
|
+
await sleep(cfg.pollIntervalMs, options.signal);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export async function downloadVideo(ctx: RouteRuntimeContext, url: string, signal?: AbortSignal): Promise<{ buffer: Buffer; contentType: string }> {
|
|
380
|
+
const cfg = videoConfig(ctx);
|
|
381
|
+
const { combinedSignal, timer } = withTimeoutSignal(signal, cfg.downloadTimeoutMs);
|
|
382
|
+
try {
|
|
383
|
+
const res = await fetch(url, { signal: combinedSignal });
|
|
384
|
+
clearTimeout(timer);
|
|
385
|
+
if (!res.ok) throw grokError(`Grok video download failed: HTTP ${res.status}`, 502, "GROK_VIDEO_DOWNLOAD_FAILED");
|
|
386
|
+
const buffer = Buffer.from(await res.arrayBuffer());
|
|
387
|
+
if (buffer.length === 0) throw grokError("Grok video download was empty", 502, "GROK_VIDEO_DOWNLOAD_FAILED");
|
|
388
|
+
return { buffer, contentType: res.headers.get("content-type") || "video/mp4" };
|
|
389
|
+
} catch (e: any) {
|
|
390
|
+
clearTimeout(timer);
|
|
391
|
+
if (e.name === "AbortError") {
|
|
392
|
+
if (signal?.aborted) throw grokError("Generation canceled", 499, "GENERATION_CANCELED");
|
|
393
|
+
throw grokError("Grok video download timed out", 504, "GROK_VIDEO_TIMEOUT");
|
|
394
|
+
}
|
|
395
|
+
if (e.code && e.status) throw e;
|
|
396
|
+
throw grokError(`Grok video download request failed: ${e.message}`, 502, "GROK_VIDEO_DOWNLOAD_FAILED");
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export async function generateVideoViaGrok(prompt: string, ctx: RouteRuntimeContext, options: GrokVideoOptions = {}): Promise<GrokVideoGenerateResult> {
|
|
401
|
+
const cfg = videoConfig(ctx);
|
|
402
|
+
const model = options.model || cfg.model;
|
|
403
|
+
const srcUrl = options.sourceImage ? sourceImageUrl(options.sourceImage, options.sourceMime) : undefined;
|
|
404
|
+
const refUrls = (options.referenceImages ?? []).map((img) => sourceImageUrl(img, undefined));
|
|
405
|
+
options.onEvent?.({ phase: "planning" });
|
|
406
|
+
const plan = options.plannedPrompt
|
|
407
|
+
? {
|
|
408
|
+
prompt: options.plannedPrompt,
|
|
409
|
+
mode: (options.mode || (options.sourceImage ? "image-to-video" : "text-to-video")) as VideoMode,
|
|
410
|
+
duration: options.duration ?? 5,
|
|
411
|
+
resolution: options.resolution || "480p",
|
|
412
|
+
aspectRatio: options.aspectRatio || "auto",
|
|
413
|
+
webSearchCalls: options.webSearchCalls ?? 1,
|
|
414
|
+
}
|
|
415
|
+
: await planGrokVideo(prompt, ctx, options);
|
|
416
|
+
const payload = buildVideoGenerationPayload(plan, { model, sourceImageUrl: srcUrl, referenceImageUrls: refUrls });
|
|
417
|
+
const xaiVideoRequestId = await startVideoRequest(ctx, payload, options);
|
|
418
|
+
options.onEvent?.({ phase: "submitted", xaiVideoRequestId });
|
|
419
|
+
logEvent("grok", "video:submitted", { requestId: options.requestId, xaiVideoRequestId, mode: plan.mode });
|
|
420
|
+
const poll = await pollVideoUntilDone(ctx, xaiVideoRequestId, options);
|
|
421
|
+
if (!poll.videoUrl) throw grokError("Grok video done without a video url", 502, "GROK_VIDEO_EMPTY_RESPONSE");
|
|
422
|
+
if (poll.respectModeration === false) throw grokError("Grok video blocked by moderation", 502, "GROK_VIDEO_MODERATION_BLOCKED");
|
|
423
|
+
const { buffer, contentType } = await downloadVideo(ctx, poll.videoUrl, options.signal);
|
|
424
|
+
logEvent("grok", "video:done", { requestId: options.requestId, xaiVideoRequestId, bytes: buffer.length });
|
|
425
|
+
return {
|
|
426
|
+
videoBuffer: buffer,
|
|
427
|
+
contentType,
|
|
428
|
+
url: poll.videoUrl,
|
|
429
|
+
duration: poll.duration ?? plan.duration,
|
|
430
|
+
resolution: plan.resolution,
|
|
431
|
+
aspectRatio: plan.aspectRatio,
|
|
432
|
+
mode: plan.mode,
|
|
433
|
+
usage: poll.usage ?? null,
|
|
434
|
+
revisedPrompt: plan.prompt,
|
|
435
|
+
xaiVideoRequestId,
|
|
436
|
+
webSearchCalls: plan.webSearchCalls,
|
|
437
|
+
};
|
|
438
|
+
}
|
package/lib/historyList.js
CHANGED
|
@@ -14,7 +14,7 @@ async function listImageFiles(baseDir) {
|
|
|
14
14
|
if (entry.isDirectory() && depth > 0) {
|
|
15
15
|
await walk(full, depth - 1);
|
|
16
16
|
}
|
|
17
|
-
else if (entry.isFile() && /\.(png|jpe?g|webp)$/i.test(entry.name)) {
|
|
17
|
+
else if (entry.isFile() && /\.(png|jpe?g|webp|mp4)$/i.test(entry.name)) {
|
|
18
18
|
out.push({ full, rel: full.slice(baseDir.length + 1), name: entry.name });
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -32,6 +32,8 @@ export async function listHistoryRows(baseDir = config.storage.generatedDir) {
|
|
|
32
32
|
return {
|
|
33
33
|
filename: rel,
|
|
34
34
|
url: `/generated/${rel.split("/").map(encodeURIComponent).join("/")}`,
|
|
35
|
+
mediaType: meta?.mediaType || (/\.mp4$/i.test(name) ? "video" : "image"),
|
|
36
|
+
video: meta?.video || null,
|
|
35
37
|
createdAt: meta?.createdAt || st?.mtimeMs || 0,
|
|
36
38
|
prompt: meta?.prompt || null,
|
|
37
39
|
userPrompt: meta?.userPrompt || meta?.prompt || null,
|
|
@@ -43,6 +45,8 @@ export async function listHistoryRows(baseDir = config.storage.generatedDir) {
|
|
|
43
45
|
size: meta?.size || null,
|
|
44
46
|
format: meta?.format || name.split(".").pop(),
|
|
45
47
|
model: meta?.model || null,
|
|
48
|
+
reasoningEffort: meta?.reasoningEffort ?? null,
|
|
49
|
+
elapsed: meta?.elapsed ?? null,
|
|
46
50
|
provider: meta?.provider || "oauth",
|
|
47
51
|
usage: meta?.usage || null,
|
|
48
52
|
webSearchCalls: meta?.webSearchCalls || 0,
|
package/lib/historyList.ts
CHANGED
|
@@ -14,7 +14,7 @@ async function listImageFiles(baseDir: string) {
|
|
|
14
14
|
const full = join(dir, entry.name);
|
|
15
15
|
if (entry.isDirectory() && depth > 0) {
|
|
16
16
|
await walk(full, depth - 1);
|
|
17
|
-
} else if (entry.isFile() && /\.(png|jpe?g|webp)$/i.test(entry.name)) {
|
|
17
|
+
} else if (entry.isFile() && /\.(png|jpe?g|webp|mp4)$/i.test(entry.name)) {
|
|
18
18
|
out.push({ full, rel: full.slice(baseDir.length + 1), name: entry.name });
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -34,6 +34,8 @@ export async function listHistoryRows(baseDir = config.storage.generatedDir) {
|
|
|
34
34
|
return {
|
|
35
35
|
filename: rel,
|
|
36
36
|
url: `/generated/${rel.split("/").map(encodeURIComponent).join("/")}`,
|
|
37
|
+
mediaType: meta?.mediaType || (/\.mp4$/i.test(name) ? "video" : "image"),
|
|
38
|
+
video: meta?.video || null,
|
|
37
39
|
createdAt: meta?.createdAt || st?.mtimeMs || 0,
|
|
38
40
|
prompt: meta?.prompt || null,
|
|
39
41
|
userPrompt: meta?.userPrompt || meta?.prompt || null,
|
|
@@ -45,6 +47,8 @@ export async function listHistoryRows(baseDir = config.storage.generatedDir) {
|
|
|
45
47
|
size: meta?.size || null,
|
|
46
48
|
format: meta?.format || name.split(".").pop(),
|
|
47
49
|
model: meta?.model || null,
|
|
50
|
+
reasoningEffort: meta?.reasoningEffort ?? null,
|
|
51
|
+
elapsed: meta?.elapsed ?? null,
|
|
48
52
|
provider: meta?.provider || "oauth",
|
|
49
53
|
usage: meta?.usage || null,
|
|
50
54
|
webSearchCalls: meta?.webSearchCalls || 0,
|
package/lib/imageMetadata.js
CHANGED
|
@@ -47,6 +47,8 @@ export function buildIma2MetadataPayload(meta = {}, context = {}) {
|
|
|
47
47
|
format: stringOrNull(meta.format, 20),
|
|
48
48
|
moderation: stringOrNull(meta.moderation, 40),
|
|
49
49
|
model: stringOrNull(meta.model, 80),
|
|
50
|
+
reasoningEffort: stringOrNull(meta.reasoningEffort, 40),
|
|
51
|
+
elapsed: numberOrNull(meta.elapsed),
|
|
50
52
|
provider: stringOrNull(meta.provider, 40),
|
|
51
53
|
sessionId: stringOrNull(meta.sessionId, 120),
|
|
52
54
|
nodeId: stringOrNull(meta.nodeId, 120),
|
package/lib/imageMetadata.ts
CHANGED
|
@@ -52,6 +52,8 @@ export function buildIma2MetadataPayload(meta: any = {}, context: any = {}) {
|
|
|
52
52
|
format: stringOrNull(meta.format, 20),
|
|
53
53
|
moderation: stringOrNull(meta.moderation, 40),
|
|
54
54
|
model: stringOrNull(meta.model, 80),
|
|
55
|
+
reasoningEffort: stringOrNull(meta.reasoningEffort, 40),
|
|
56
|
+
elapsed: numberOrNull(meta.elapsed),
|
|
55
57
|
provider: stringOrNull(meta.provider, 40),
|
|
56
58
|
sessionId: stringOrNull(meta.sessionId, 120),
|
|
57
59
|
nodeId: stringOrNull(meta.nodeId, 120),
|
package/lib/imageModels.js
CHANGED
|
@@ -3,6 +3,8 @@ const VALID_IMAGE_MODELS = new Set(["gpt-5.5", "gpt-5.4", "gpt-5.4-mini"]);
|
|
|
3
3
|
const UNSUPPORTED_IMAGE_MODELS = new Set(["gpt-5.3-codex-spark"]);
|
|
4
4
|
const FALLBACK_REASONING_EFFORT = "none";
|
|
5
5
|
const VALID_REASONING_EFFORTS = new Set(["none", "low", "medium", "high", "xhigh"]);
|
|
6
|
+
const GROK_FALLBACK_IMAGE_MODEL = "grok-imagine-image";
|
|
7
|
+
const VALID_GROK_IMAGE_MODELS = new Set(["grok-imagine-image", "grok-imagine-image-quality"]);
|
|
6
8
|
export function normalizeReasoningEffort(ctx, rawEffort) {
|
|
7
9
|
const configured = ctx?.config?.imageModels;
|
|
8
10
|
const fallback = configured?.reasoningEffort ?? FALLBACK_REASONING_EFFORT;
|
|
@@ -43,3 +45,102 @@ export function normalizeImageModel(ctx, rawModel) {
|
|
|
43
45
|
}
|
|
44
46
|
return { model: rawModel };
|
|
45
47
|
}
|
|
48
|
+
export function normalizeGrokImageModel(rawModel) {
|
|
49
|
+
if (typeof rawModel !== "string" || rawModel.length === 0) {
|
|
50
|
+
return { model: GROK_FALLBACK_IMAGE_MODEL };
|
|
51
|
+
}
|
|
52
|
+
if (!VALID_GROK_IMAGE_MODELS.has(rawModel)) {
|
|
53
|
+
return {
|
|
54
|
+
error: `Grok image model must be one of: ${[...VALID_GROK_IMAGE_MODELS].join(", ")}`,
|
|
55
|
+
code: "INVALID_GROK_IMAGE_MODEL",
|
|
56
|
+
status: 400,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return { model: rawModel };
|
|
60
|
+
}
|
|
61
|
+
// ── Grok video (T2V/I2V) ─────────────────────────────────────────────────
|
|
62
|
+
// Video is a separate generation kind, not an image model. Keep it out of the
|
|
63
|
+
// image model unions/helpers above so `grok-` image classification is unaffected.
|
|
64
|
+
const GROK_FALLBACK_VIDEO_MODEL = "grok-imagine-video";
|
|
65
|
+
export const VALID_GROK_VIDEO_MODELS = new Set(["grok-imagine-video"]);
|
|
66
|
+
export const VALID_VIDEO_RESOLUTIONS = new Set(["480p", "720p"]);
|
|
67
|
+
export const VALID_VIDEO_ASPECT_RATIOS = new Set([
|
|
68
|
+
"1:1",
|
|
69
|
+
"16:9",
|
|
70
|
+
"9:16",
|
|
71
|
+
"4:3",
|
|
72
|
+
"3:4",
|
|
73
|
+
"3:2",
|
|
74
|
+
"2:3",
|
|
75
|
+
"auto",
|
|
76
|
+
]);
|
|
77
|
+
export const MIN_VIDEO_DURATION = 1;
|
|
78
|
+
export const MAX_VIDEO_DURATION = 15;
|
|
79
|
+
// reference-to-video (xAI): up to 7 reference images, max 10s duration.
|
|
80
|
+
export const MAX_REF2V_REFERENCES = 7;
|
|
81
|
+
export const MAX_REF2V_DURATION = 10;
|
|
82
|
+
// Mode is derived purely from the number of attached reference images.
|
|
83
|
+
export function deriveVideoMode(refCount) {
|
|
84
|
+
if (refCount >= 2)
|
|
85
|
+
return "reference-to-video";
|
|
86
|
+
if (refCount === 1)
|
|
87
|
+
return "image-to-video";
|
|
88
|
+
return "text-to-video";
|
|
89
|
+
}
|
|
90
|
+
// Clamp duration to the reference-to-video ceiling; other modes keep their value.
|
|
91
|
+
export function clampVideoDuration(duration, mode) {
|
|
92
|
+
return mode === "reference-to-video" ? Math.min(duration, MAX_REF2V_DURATION) : duration;
|
|
93
|
+
}
|
|
94
|
+
export function isGrokVideoModel(value) {
|
|
95
|
+
return typeof value === "string" && VALID_GROK_VIDEO_MODELS.has(value);
|
|
96
|
+
}
|
|
97
|
+
export function normalizeGrokVideoModel(rawModel) {
|
|
98
|
+
if (typeof rawModel !== "string" || rawModel.length === 0) {
|
|
99
|
+
return { model: GROK_FALLBACK_VIDEO_MODEL };
|
|
100
|
+
}
|
|
101
|
+
if (!VALID_GROK_VIDEO_MODELS.has(rawModel)) {
|
|
102
|
+
return {
|
|
103
|
+
error: `Grok video model must be one of: ${[...VALID_GROK_VIDEO_MODELS].join(", ")}`,
|
|
104
|
+
code: "INVALID_GROK_VIDEO_MODEL",
|
|
105
|
+
status: 400,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return { model: rawModel };
|
|
109
|
+
}
|
|
110
|
+
export function normalizeVideoResolution(raw) {
|
|
111
|
+
if (raw === undefined || raw === null || raw === "")
|
|
112
|
+
return { resolution: "480p" };
|
|
113
|
+
if (typeof raw !== "string" || !VALID_VIDEO_RESOLUTIONS.has(raw)) {
|
|
114
|
+
return {
|
|
115
|
+
error: `resolution must be one of: ${[...VALID_VIDEO_RESOLUTIONS].join(", ")}`,
|
|
116
|
+
code: "INVALID_VIDEO_RESOLUTION",
|
|
117
|
+
status: 400,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return { resolution: raw };
|
|
121
|
+
}
|
|
122
|
+
export function normalizeVideoAspectRatio(raw) {
|
|
123
|
+
if (raw === undefined || raw === null || raw === "")
|
|
124
|
+
return { aspectRatio: "auto" };
|
|
125
|
+
if (typeof raw !== "string" || !VALID_VIDEO_ASPECT_RATIOS.has(raw)) {
|
|
126
|
+
return {
|
|
127
|
+
error: `aspectRatio must be one of: ${[...VALID_VIDEO_ASPECT_RATIOS].join(", ")}`,
|
|
128
|
+
code: "INVALID_VIDEO_ASPECT_RATIO",
|
|
129
|
+
status: 400,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return { aspectRatio: raw };
|
|
133
|
+
}
|
|
134
|
+
export function normalizeVideoDuration(raw) {
|
|
135
|
+
if (raw === undefined || raw === null || raw === "")
|
|
136
|
+
return { duration: 5 };
|
|
137
|
+
const n = typeof raw === "number" ? raw : Number(raw);
|
|
138
|
+
if (!Number.isInteger(n) || n < MIN_VIDEO_DURATION || n > MAX_VIDEO_DURATION) {
|
|
139
|
+
return {
|
|
140
|
+
error: `duration must be an integer between ${MIN_VIDEO_DURATION} and ${MAX_VIDEO_DURATION} seconds`,
|
|
141
|
+
code: "INVALID_VIDEO_DURATION",
|
|
142
|
+
status: 400,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return { duration: n };
|
|
146
|
+
}
|