flucto 1.18.0 → 1.21.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.
- package/CHANGELOG.md +36 -3
- package/README.md +172 -26
- package/dist-electron/cli/args.js +127 -2
- package/dist-electron/cli/args.js.map +1 -1
- package/dist-electron/cli/index.js +334 -9
- package/dist-electron/cli/index.js.map +1 -1
- package/dist-electron/cli/jobOutput.js.map +1 -1
- package/dist-electron/cli/output.js +24 -1
- package/dist-electron/cli/output.js.map +1 -1
- package/dist-electron/main/analysis/avCommands.js +144 -0
- package/dist-electron/main/analysis/avCommands.js.map +1 -0
- package/dist-electron/main/analysis/csvWriter.js +121 -0
- package/dist-electron/main/analysis/csvWriter.js.map +1 -0
- package/dist-electron/main/analysis/ffmpegSignals.js +337 -0
- package/dist-electron/main/analysis/ffmpegSignals.js.map +1 -0
- package/dist-electron/main/handlers.js +189 -2
- package/dist-electron/main/handlers.js.map +1 -1
- package/dist-electron/main/index.js +36 -1
- package/dist-electron/main/index.js.map +1 -1
- package/dist-electron/main/platforms/threads.js +128 -6
- package/dist-electron/main/platforms/threads.js.map +1 -1
- package/dist-electron/main/search/dailymotion.js +5 -1
- package/dist-electron/main/search/dailymotion.js.map +1 -1
- package/dist-electron/main/services/aiVideoDiscovery.js +193 -0
- package/dist-electron/main/services/aiVideoDiscovery.js.map +1 -0
- package/dist-electron/main/services/aiVideoEvidence.js +75 -0
- package/dist-electron/main/services/aiVideoEvidence.js.map +1 -0
- package/dist-electron/main/services/analysisReport.js +413 -0
- package/dist-electron/main/services/analysisReport.js.map +1 -0
- package/dist-electron/main/services/binaryInstaller.js +427 -108
- package/dist-electron/main/services/binaryInstaller.js.map +1 -1
- package/dist-electron/main/services/binaryResolver.js +2 -0
- package/dist-electron/main/services/binaryResolver.js.map +1 -1
- package/dist-electron/main/services/cinematicAnalysis.js +574 -0
- package/dist-electron/main/services/cinematicAnalysis.js.map +1 -0
- package/dist-electron/main/services/codexVisionRuntime.js +353 -0
- package/dist-electron/main/services/codexVisionRuntime.js.map +1 -0
- package/dist-electron/main/services/craftTaxonomy.js +373 -0
- package/dist-electron/main/services/craftTaxonomy.js.map +1 -0
- package/dist-electron/main/services/mediaDownload.js +50 -0
- package/dist-electron/main/services/mediaDownload.js.map +1 -1
- package/dist-electron/main/services/mediaInfo.js +44 -0
- package/dist-electron/main/services/mediaInfo.js.map +1 -1
- package/dist-electron/main/services/visionProvider.js +220 -0
- package/dist-electron/main/services/visionProvider.js.map +1 -0
- package/dist-electron/main/services/ytDlpRuntimeSources.js +24 -0
- package/dist-electron/main/services/ytDlpRuntimeSources.js.map +1 -0
- package/dist-electron/main/spawn.js +50 -4
- package/dist-electron/main/spawn.js.map +1 -1
- package/dist-electron/main/store.js +5 -0
- package/dist-electron/main/store.js.map +1 -1
- package/dist-electron/preload/index.js +24 -0
- package/dist-electron/preload/index.js.map +1 -1
- package/dist-electron/shared/analysisOutputPath.js +24 -0
- package/dist-electron/shared/analysisOutputPath.js.map +1 -0
- package/dist-electron/shared/analysisTypes.js +29 -0
- package/dist-electron/shared/analysisTypes.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/LICENSE +15 -0
- package/node_modules/@isaacs/fs-minipass/README.md +71 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +118 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +430 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +118 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +420 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/fs-minipass/package.json +72 -0
- package/node_modules/chownr/LICENSE.md +63 -0
- package/node_modules/chownr/README.md +3 -0
- package/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
- package/node_modules/chownr/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/node_modules/chownr/dist/commonjs/index.js.map +1 -0
- package/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/node_modules/chownr/dist/esm/index.d.ts +3 -0
- package/node_modules/chownr/dist/esm/index.d.ts.map +1 -0
- package/node_modules/chownr/dist/esm/index.js +85 -0
- package/node_modules/chownr/dist/esm/index.js.map +1 -0
- package/node_modules/chownr/dist/esm/package.json +3 -0
- package/node_modules/chownr/package.json +69 -0
- package/node_modules/minipass/LICENSE.md +55 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/commonjs/index.js +1038 -0
- package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.d.ts +545 -0
- package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/esm/index.js +1020 -0
- package/node_modules/minipass/dist/esm/index.js.map +1 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +77 -0
- package/node_modules/minizlib/LICENSE +26 -0
- package/node_modules/minizlib/README.md +64 -0
- package/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- package/node_modules/minizlib/dist/commonjs/constants.d.ts.map +1 -0
- package/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/node_modules/minizlib/dist/commonjs/constants.js.map +1 -0
- package/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- package/node_modules/minizlib/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/node_modules/minizlib/dist/commonjs/index.js.map +1 -0
- package/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- package/node_modules/minizlib/dist/esm/constants.d.ts.map +1 -0
- package/node_modules/minizlib/dist/esm/constants.js +117 -0
- package/node_modules/minizlib/dist/esm/constants.js.map +1 -0
- package/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- package/node_modules/minizlib/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minizlib/dist/esm/index.js +363 -0
- package/node_modules/minizlib/dist/esm/index.js.map +1 -0
- package/node_modules/minizlib/dist/esm/package.json +3 -0
- package/node_modules/minizlib/package.json +80 -0
- package/node_modules/tar/LICENSE.md +55 -0
- package/node_modules/tar/README.md +1233 -0
- package/node_modules/tar/dist/commonjs/create.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/create.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/create.js +82 -0
- package/node_modules/tar/dist/commonjs/create.js.map +1 -0
- package/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
- package/node_modules/tar/dist/commonjs/cwd-error.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/node_modules/tar/dist/commonjs/cwd-error.js.map +1 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/extract.js +88 -0
- package/node_modules/tar/dist/commonjs/extract.js.map +1 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.js.map +1 -0
- package/node_modules/tar/dist/commonjs/header.d.ts +53 -0
- package/node_modules/tar/dist/commonjs/header.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/header.js +348 -0
- package/node_modules/tar/dist/commonjs/header.js.map +1 -0
- package/node_modules/tar/dist/commonjs/index.d.ts +20 -0
- package/node_modules/tar/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/index.js +64 -0
- package/node_modules/tar/dist/commonjs/index.js.map +1 -0
- package/node_modules/tar/dist/commonjs/index.min.js +4 -0
- package/node_modules/tar/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/node_modules/tar/dist/commonjs/large-numbers.js.map +1 -0
- package/node_modules/tar/dist/commonjs/list.d.ts +7 -0
- package/node_modules/tar/dist/commonjs/list.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/list.js +153 -0
- package/node_modules/tar/dist/commonjs/list.js.map +1 -0
- package/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
- package/node_modules/tar/dist/commonjs/make-command.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/make-command.js +52 -0
- package/node_modules/tar/dist/commonjs/make-command.js.map +1 -0
- package/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
- package/node_modules/tar/dist/commonjs/mkdir.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/mkdir.js +187 -0
- package/node_modules/tar/dist/commonjs/mkdir.js.map +1 -0
- package/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/mode-fix.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/node_modules/tar/dist/commonjs/mode-fix.js.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.js.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js.map +1 -0
- package/node_modules/tar/dist/commonjs/options.d.ts +604 -0
- package/node_modules/tar/dist/commonjs/options.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/options.js +66 -0
- package/node_modules/tar/dist/commonjs/options.js.map +1 -0
- package/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
- package/node_modules/tar/dist/commonjs/pack.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/pack.js +544 -0
- package/node_modules/tar/dist/commonjs/pack.js.map +1 -0
- package/node_modules/tar/dist/commonjs/package.json +3 -0
- package/node_modules/tar/dist/commonjs/parse.d.ts +92 -0
- package/node_modules/tar/dist/commonjs/parse.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/parse.js +655 -0
- package/node_modules/tar/dist/commonjs/parse.js.map +1 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/node_modules/tar/dist/commonjs/path-reservations.js.map +1 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/pax.js +182 -0
- package/node_modules/tar/dist/commonjs/pax.js.map +1 -0
- package/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/process-umask.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/process-umask.js +7 -0
- package/node_modules/tar/dist/commonjs/process-umask.js.map +1 -0
- package/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
- package/node_modules/tar/dist/commonjs/read-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/read-entry.js +136 -0
- package/node_modules/tar/dist/commonjs/read-entry.js.map +1 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/replace.js +227 -0
- package/node_modules/tar/dist/commonjs/replace.js.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.js.map +1 -0
- package/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
- package/node_modules/tar/dist/commonjs/symlink-error.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/node_modules/tar/dist/commonjs/symlink-error.js.map +1 -0
- package/node_modules/tar/dist/commonjs/types.d.ts +16 -0
- package/node_modules/tar/dist/commonjs/types.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/types.js +70 -0
- package/node_modules/tar/dist/commonjs/types.js.map +1 -0
- package/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
- package/node_modules/tar/dist/commonjs/unpack.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/unpack.js +932 -0
- package/node_modules/tar/dist/commonjs/unpack.js.map +1 -0
- package/node_modules/tar/dist/commonjs/update.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/update.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/update.js +33 -0
- package/node_modules/tar/dist/commonjs/update.js.map +1 -0
- package/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
- package/node_modules/tar/dist/commonjs/warn-method.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/node_modules/tar/dist/commonjs/warn-method.js.map +1 -0
- package/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/winchars.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/node_modules/tar/dist/commonjs/winchars.js.map +1 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/write-entry.js +698 -0
- package/node_modules/tar/dist/commonjs/write-entry.js.map +1 -0
- package/node_modules/tar/dist/esm/create.d.ts +3 -0
- package/node_modules/tar/dist/esm/create.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/create.js +76 -0
- package/node_modules/tar/dist/esm/create.js.map +1 -0
- package/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
- package/node_modules/tar/dist/esm/cwd-error.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/cwd-error.js +14 -0
- package/node_modules/tar/dist/esm/cwd-error.js.map +1 -0
- package/node_modules/tar/dist/esm/extract.d.ts +3 -0
- package/node_modules/tar/dist/esm/extract.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/extract.js +49 -0
- package/node_modules/tar/dist/esm/extract.js.map +1 -0
- package/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
- package/node_modules/tar/dist/esm/get-write-flag.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/get-write-flag.js +26 -0
- package/node_modules/tar/dist/esm/get-write-flag.js.map +1 -0
- package/node_modules/tar/dist/esm/header.d.ts +53 -0
- package/node_modules/tar/dist/esm/header.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/header.js +311 -0
- package/node_modules/tar/dist/esm/header.js.map +1 -0
- package/node_modules/tar/dist/esm/index.d.ts +20 -0
- package/node_modules/tar/dist/esm/index.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/index.js +20 -0
- package/node_modules/tar/dist/esm/index.js.map +1 -0
- package/node_modules/tar/dist/esm/index.min.js +4 -0
- package/node_modules/tar/dist/esm/index.min.js.map +7 -0
- package/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
- package/node_modules/tar/dist/esm/large-numbers.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/large-numbers.js +94 -0
- package/node_modules/tar/dist/esm/large-numbers.js.map +1 -0
- package/node_modules/tar/dist/esm/list.d.ts +7 -0
- package/node_modules/tar/dist/esm/list.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/list.js +113 -0
- package/node_modules/tar/dist/esm/list.js.map +1 -0
- package/node_modules/tar/dist/esm/make-command.d.ts +49 -0
- package/node_modules/tar/dist/esm/make-command.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/make-command.js +48 -0
- package/node_modules/tar/dist/esm/make-command.js.map +1 -0
- package/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
- package/node_modules/tar/dist/esm/mkdir.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/mkdir.js +179 -0
- package/node_modules/tar/dist/esm/mkdir.js.map +1 -0
- package/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
- package/node_modules/tar/dist/esm/mode-fix.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/mode-fix.js +25 -0
- package/node_modules/tar/dist/esm/mode-fix.js.map +1 -0
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
- package/node_modules/tar/dist/esm/normalize-unicode.js.map +1 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.js.map +1 -0
- package/node_modules/tar/dist/esm/options.d.ts +604 -0
- package/node_modules/tar/dist/esm/options.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/options.js +54 -0
- package/node_modules/tar/dist/esm/options.js.map +1 -0
- package/node_modules/tar/dist/esm/pack.d.ts +105 -0
- package/node_modules/tar/dist/esm/pack.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/pack.js +502 -0
- package/node_modules/tar/dist/esm/pack.js.map +1 -0
- package/node_modules/tar/dist/esm/package.json +3 -0
- package/node_modules/tar/dist/esm/parse.d.ts +92 -0
- package/node_modules/tar/dist/esm/parse.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/parse.js +651 -0
- package/node_modules/tar/dist/esm/parse.js.map +1 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/path-reservations.js +166 -0
- package/node_modules/tar/dist/esm/path-reservations.js.map +1 -0
- package/node_modules/tar/dist/esm/pax.d.ts +26 -0
- package/node_modules/tar/dist/esm/pax.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/pax.js +178 -0
- package/node_modules/tar/dist/esm/pax.js.map +1 -0
- package/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
- package/node_modules/tar/dist/esm/process-umask.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/process-umask.js +3 -0
- package/node_modules/tar/dist/esm/process-umask.js.map +1 -0
- package/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
- package/node_modules/tar/dist/esm/read-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/read-entry.js +132 -0
- package/node_modules/tar/dist/esm/read-entry.js.map +1 -0
- package/node_modules/tar/dist/esm/replace.d.ts +2 -0
- package/node_modules/tar/dist/esm/replace.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/replace.js +221 -0
- package/node_modules/tar/dist/esm/replace.js.map +1 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js.map +1 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.js.map +1 -0
- package/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
- package/node_modules/tar/dist/esm/symlink-error.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/symlink-error.js +15 -0
- package/node_modules/tar/dist/esm/symlink-error.js.map +1 -0
- package/node_modules/tar/dist/esm/types.d.ts +16 -0
- package/node_modules/tar/dist/esm/types.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/types.js +65 -0
- package/node_modules/tar/dist/esm/types.js.map +1 -0
- package/node_modules/tar/dist/esm/unpack.d.ts +101 -0
- package/node_modules/tar/dist/esm/unpack.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/unpack.js +891 -0
- package/node_modules/tar/dist/esm/unpack.js.map +1 -0
- package/node_modules/tar/dist/esm/update.d.ts +2 -0
- package/node_modules/tar/dist/esm/update.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/update.js +30 -0
- package/node_modules/tar/dist/esm/update.js.map +1 -0
- package/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
- package/node_modules/tar/dist/esm/warn-method.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/warn-method.js +27 -0
- package/node_modules/tar/dist/esm/warn-method.js.map +1 -0
- package/node_modules/tar/dist/esm/winchars.d.ts +3 -0
- package/node_modules/tar/dist/esm/winchars.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/winchars.js +9 -0
- package/node_modules/tar/dist/esm/winchars.js.map +1 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/write-entry.js +656 -0
- package/node_modules/tar/dist/esm/write-entry.js.map +1 -0
- package/node_modules/tar/node_modules/yallist/LICENSE.md +63 -0
- package/node_modules/tar/node_modules/yallist/README.md +205 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/index.js.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts +39 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.js +379 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/index.js.map +1 -0
- package/node_modules/tar/node_modules/yallist/dist/esm/package.json +3 -0
- package/node_modules/tar/node_modules/yallist/package.json +68 -0
- package/node_modules/tar/package.json +298 -0
- package/package.json +7 -2
- package/schemas/analysis-run.v1.schema.json +66 -0
- package/skills/searching-social-media/SKILL.md +50 -0
- package/skills/searching-social-media/references/flucto-contract.md +37 -0
- package/skills/searching-social-media/references/search-workflow.md +39 -0
- package/skills/searching-social-media/scripts/social_search.py +431 -0
|
@@ -3,11 +3,51 @@ import os from 'os';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import zlib from 'zlib';
|
|
5
5
|
import { pipeline } from 'stream/promises';
|
|
6
|
+
import { Readable, Transform } from 'stream';
|
|
6
7
|
import { createRequire } from 'module';
|
|
8
|
+
import { createHash } from 'crypto';
|
|
9
|
+
import { spawn } from 'child_process';
|
|
7
10
|
import { execa } from '../spawn.js';
|
|
11
|
+
import { ytDlpRuntimeSources } from './ytDlpRuntimeSources.js';
|
|
8
12
|
import { resolveCliBinaries } from './binaryResolver.js';
|
|
9
13
|
const require = createRequire(import.meta.url);
|
|
10
14
|
const AdmZip = require('adm-zip');
|
|
15
|
+
const tar = require('tar');
|
|
16
|
+
const MAX_ARCHIVE_BYTES = 512 * 1024 * 1024;
|
|
17
|
+
const MAX_DECOMPRESSED_TAR_BYTES = 1024 * 1024 * 1024;
|
|
18
|
+
const MAX_EXECUTABLE_BYTES = 256 * 1024 * 1024;
|
|
19
|
+
const GYAN_WIN_X64 = {
|
|
20
|
+
url: 'https://github.com/GyanD/codexffmpeg/releases/download/8.1.2/ffmpeg-8.1.2-essentials_build.zip',
|
|
21
|
+
sha256: 'db580001caa24ac104c8cb856cd113a87b0a443f7bdf47d8c12b1d740584a2ec',
|
|
22
|
+
};
|
|
23
|
+
const BTBN_LINUX = {
|
|
24
|
+
x64: { url: 'https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2026-11-16-15-29/ffmpeg-N-128959-g4dbee3b241-linux64-gpl.tar.xz', sha256: '098bdc14d7a5a62d7f5a1452e748a192cef66e045146e869a15ae20d1ab50544' },
|
|
25
|
+
arm64: { url: 'https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2026-11-16-15-29/ffmpeg-N-128959-g4dbee3b241-linuxarm64-gpl.tar.xz', sha256: '59c27c4fbf895c12fa2e2add1847e90ade02582ace8dd58bda07089407033633' },
|
|
26
|
+
};
|
|
27
|
+
const MARTIN_MAC = {
|
|
28
|
+
x64: {
|
|
29
|
+
ffmpeg: { url: 'https://ffmpeg.martin-riedl.de/download/macos/amd64/1789931006_9.0.2/ffmpeg.zip', sha256: '7c6b4125b191cbf773832dc51f424cf2b6bb7da43007d1e066f95909e47cacd4' },
|
|
30
|
+
ffprobe: { url: 'https://ffmpeg.martin-riedl.de/download/macos/amd64/1789931006_9.0.2/ffprobe.zip', sha256: '2322438ed2f6319a691291b247d09c69dcaa3a982460d1f269a7e1af335cfdfd' },
|
|
31
|
+
},
|
|
32
|
+
arm64: {
|
|
33
|
+
ffmpeg: { url: 'https://ffmpeg.martin-riedl.de/download/macos/arm64/1789931890_9.0.2/ffmpeg.zip', sha256: 'c8ed4c4e6978a03c485edbfe4e0a5dc2380f8a30bba5150531b31b094492d924' },
|
|
34
|
+
ffprobe: { url: 'https://ffmpeg.martin-riedl.de/download/macos/arm64/1789931890_9.0.2/ffprobe.zip', sha256: 'fcbe839537485eaee7a7a8bc5cbc0f90d53617e80943e8a5b2e31cb851197ea6' },
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const pinnedAvSourceFor = (name, platform, arch) => {
|
|
38
|
+
if (platform === 'win32' && arch === 'x64')
|
|
39
|
+
return GYAN_WIN_X64;
|
|
40
|
+
if (platform === 'linux' && BTBN_LINUX[arch])
|
|
41
|
+
return BTBN_LINUX[arch];
|
|
42
|
+
if (platform === 'darwin' && MARTIN_MAC[arch])
|
|
43
|
+
return MARTIN_MAC[arch][name];
|
|
44
|
+
throw new Error(`No pinned ${name} source for ${platform}/${arch}`);
|
|
45
|
+
};
|
|
46
|
+
export const verifySha256 = (bytes, expected) => {
|
|
47
|
+
const actual = (awaitlessCreateHash(bytes));
|
|
48
|
+
return actual === expected.toLowerCase();
|
|
49
|
+
};
|
|
50
|
+
const awaitlessCreateHash = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
11
51
|
const YT_DLP_VERSION = 'latest';
|
|
12
52
|
const FFMPEG_RELEASE = '7.0.2';
|
|
13
53
|
const executableExtension = process.platform === 'win32' ? '.exe' : '';
|
|
@@ -42,41 +82,8 @@ export const ytDlpUrlFor = (platform = currentPlatform(), arch = process.arch) =
|
|
|
42
82
|
}
|
|
43
83
|
throw new Error(`No yt-dlp download source for platform ${platform}`);
|
|
44
84
|
};
|
|
45
|
-
export const ffmpegDownloadUrlsFor = (platform = currentPlatform(), arch = process.arch) =>
|
|
46
|
-
|
|
47
|
-
return [
|
|
48
|
-
'https://github.com/GyanD/codexffmpeg/releases/download/8.1.2/ffmpeg-8.1.2-essentials_build.zip',
|
|
49
|
-
'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip',
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
if (platform === 'darwin') {
|
|
53
|
-
return arch === 'arm64'
|
|
54
|
-
? [
|
|
55
|
-
'https://ffmpeg.martin-riedl.de/redirect/latest/macos/arm64/release/ffmpeg.zip',
|
|
56
|
-
'https://github.com/eugeneware/ffmpeg-static/releases/latest/download/ffmpeg-darwin-arm64.gz',
|
|
57
|
-
]
|
|
58
|
-
: [
|
|
59
|
-
'https://evermeet.cx/ffmpeg/getrelease/zip',
|
|
60
|
-
'https://ffmpeg.martin-riedl.de/redirect/latest/macos/amd64/release/ffmpeg.zip',
|
|
61
|
-
'https://github.com/eugeneware/ffmpeg-static/releases/latest/download/ffmpeg-darwin-x64.gz',
|
|
62
|
-
];
|
|
63
|
-
}
|
|
64
|
-
if (platform === 'linux') {
|
|
65
|
-
if (arch === 'arm64' || arch === 'arm' || arch === 'ia32') {
|
|
66
|
-
const archSlug = arch === 'arm64' ? 'arm64' : arch === 'arm' ? 'armhf' : 'i686';
|
|
67
|
-
const urls = [`https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${archSlug}-static.tar.xz`];
|
|
68
|
-
if (arch === 'arm64') {
|
|
69
|
-
urls.push('https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz');
|
|
70
|
-
}
|
|
71
|
-
return urls;
|
|
72
|
-
}
|
|
73
|
-
return [
|
|
74
|
-
'https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz',
|
|
75
|
-
'https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz',
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
throw new Error(`No FFmpeg download source for platform ${platform}`);
|
|
79
|
-
};
|
|
85
|
+
export const ffmpegDownloadUrlsFor = (platform = currentPlatform(), arch = process.arch) => [pinnedAvSourceFor('ffmpeg', platform, arch).url];
|
|
86
|
+
export const ffprobeDownloadUrlsFor = (platform = currentPlatform(), arch = process.arch) => [pinnedAvSourceFor('ffprobe', platform, arch).url];
|
|
80
87
|
export const utilitySpecs = () => {
|
|
81
88
|
return [
|
|
82
89
|
{
|
|
@@ -91,6 +98,15 @@ export const utilitySpecs = () => {
|
|
|
91
98
|
versionArgs: ['-version'],
|
|
92
99
|
downloadUrls: ffmpegDownloadUrlsFor(),
|
|
93
100
|
archiveMember: executableName('ffmpeg'),
|
|
101
|
+
archiveSha256: pinnedAvSourceFor('ffmpeg', currentPlatform(), process.arch).sha256,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'ffprobe',
|
|
105
|
+
executableName: executableName('ffprobe'),
|
|
106
|
+
versionArgs: ['-version'],
|
|
107
|
+
downloadUrls: ffprobeDownloadUrlsFor(),
|
|
108
|
+
archiveMember: executableName('ffprobe'),
|
|
109
|
+
archiveSha256: pinnedAvSourceFor('ffprobe', currentPlatform(), process.arch).sha256,
|
|
94
110
|
},
|
|
95
111
|
];
|
|
96
112
|
};
|
|
@@ -112,6 +128,7 @@ const normalizeYtDlpVersion = (value) => {
|
|
|
112
128
|
export const fetchLatestYtDlpVersion = async () => {
|
|
113
129
|
try {
|
|
114
130
|
const response = await fetch('https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest', {
|
|
131
|
+
signal: AbortSignal.timeout(15000),
|
|
115
132
|
headers: {
|
|
116
133
|
'user-agent': `Flucto/${YT_DLP_VERSION}`,
|
|
117
134
|
accept: 'application/vnd.github+json',
|
|
@@ -126,63 +143,197 @@ export const fetchLatestYtDlpVersion = async () => {
|
|
|
126
143
|
return null;
|
|
127
144
|
}
|
|
128
145
|
};
|
|
129
|
-
export const versionFor = async (filePath, args) => {
|
|
146
|
+
export const versionFor = async (filePath, args, timeoutMs = 15000) => {
|
|
130
147
|
if (!isExecutable(filePath))
|
|
131
148
|
return null;
|
|
132
|
-
const result = await execa(filePath, args, { reject: false });
|
|
149
|
+
const result = await execa(filePath, args, { reject: false, timeoutMs });
|
|
133
150
|
if (result.failed)
|
|
134
151
|
return null;
|
|
135
152
|
return (result.stdout || result.stderr).split(/\r?\n/).find((line) => line.trim())?.trim() ?? null;
|
|
136
153
|
};
|
|
137
|
-
const downloadFile = async (url, destination) => {
|
|
138
|
-
const response = await
|
|
139
|
-
if (!response.ok)
|
|
154
|
+
const downloadFile = async (url, destination, fetchImpl = fetch) => {
|
|
155
|
+
const response = await fetchImpl(url, { headers: { 'user-agent': `Flucto/${YT_DLP_VERSION} (${FFMPEG_RELEASE})` }, signal: AbortSignal.timeout(120000) });
|
|
156
|
+
if (!response.ok)
|
|
140
157
|
throw new Error(`Failed to download ${url}: HTTP ${response.status}`);
|
|
158
|
+
const contentLength = Number(response.headers.get('content-length'));
|
|
159
|
+
if (Number.isFinite(contentLength) && contentLength > MAX_ARCHIVE_BYTES)
|
|
160
|
+
throw new Error('Downloaded archive exceeds size limit');
|
|
161
|
+
if (!response.body)
|
|
162
|
+
throw new Error('Download response has no body');
|
|
163
|
+
let total = 0;
|
|
164
|
+
const limiter = new Transform({ transform(chunk, _encoding, callback) {
|
|
165
|
+
total += chunk.length;
|
|
166
|
+
callback(total > MAX_ARCHIVE_BYTES ? new Error('Downloaded archive exceeds size limit') : null, chunk);
|
|
167
|
+
} });
|
|
168
|
+
await pipeline(Readable.fromWeb(response.body), limiter, fs.createWriteStream(destination, { flags: 'wx' }));
|
|
169
|
+
};
|
|
170
|
+
const normalizeArchivePath = (name) => {
|
|
171
|
+
const value = name.replace(/\\/g, '/');
|
|
172
|
+
if (!value || value.startsWith('/') || /^[A-Za-z]:/.test(value) || value.split('/').some((part) => part === '..')) {
|
|
173
|
+
throw new Error(`Unsafe archive member path: ${name}`);
|
|
141
174
|
}
|
|
142
|
-
|
|
143
|
-
await fs.promises.writeFile(destination, Buffer.from(await response.arrayBuffer()));
|
|
175
|
+
return value.replace(/^\.\//, '');
|
|
144
176
|
};
|
|
145
|
-
const extractZipMember = async (archivePath, memberName, destination) => {
|
|
177
|
+
export const extractZipMember = async (archivePath, memberName, destination) => {
|
|
178
|
+
const archiveStat = await fs.promises.stat(archivePath);
|
|
179
|
+
if (archiveStat.size > MAX_ARCHIVE_BYTES)
|
|
180
|
+
throw new Error('ZIP archive exceeds size limit');
|
|
146
181
|
const archive = new AdmZip(archivePath);
|
|
147
|
-
const
|
|
148
|
-
const entry
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
182
|
+
const entries = archive.getEntries();
|
|
183
|
+
for (const entry of entries) {
|
|
184
|
+
normalizeArchivePath(entry.entryName);
|
|
185
|
+
const mode = entry.header?.attr ?? 0;
|
|
186
|
+
if (((mode >>> 16) & 0xf000) === 0xa000)
|
|
187
|
+
throw new Error(`Archive contains a symbolic link: ${entry.entryName}`);
|
|
188
|
+
}
|
|
189
|
+
const candidates = entries.filter((entry) => {
|
|
190
|
+
const normalized = normalizeArchivePath(entry.entryName);
|
|
191
|
+
return normalized === memberName || normalized.endsWith(`/${memberName}`);
|
|
192
|
+
});
|
|
193
|
+
if (candidates.length !== 1)
|
|
194
|
+
throw new Error(candidates.length ? `Ambiguous archive member: ${memberName}` : `Archive member not found: ${memberName}`);
|
|
195
|
+
const declared = candidates[0].header;
|
|
196
|
+
const compressedSize = declared?.compressedSize;
|
|
197
|
+
const size = declared?.size;
|
|
198
|
+
if (typeof size !== 'number' || size < 0 || size > MAX_EXECUTABLE_BYTES)
|
|
199
|
+
throw new Error('ZIP member exceeds size limit or has invalid size');
|
|
200
|
+
if (typeof compressedSize !== 'number' || compressedSize < 0 || size / Math.max(1, compressedSize) > 1000)
|
|
201
|
+
throw new Error('ZIP member compression ratio exceeds limit');
|
|
202
|
+
const data = candidates[0].getData();
|
|
203
|
+
if (data.length !== size || data.length > MAX_EXECUTABLE_BYTES)
|
|
204
|
+
throw new Error('ZIP member actual size does not match declared size');
|
|
205
|
+
await fs.promises.writeFile(destination, data);
|
|
153
206
|
};
|
|
154
|
-
const extractTarMember = async (archivePath, memberName, destination) => {
|
|
155
|
-
const
|
|
207
|
+
export const extractTarMember = async (archivePath, memberName, destination) => {
|
|
208
|
+
const stat = await fs.promises.stat(archivePath);
|
|
209
|
+
if (stat.size > MAX_DECOMPRESSED_TAR_BYTES)
|
|
210
|
+
throw new Error('TAR archive exceeds size limit');
|
|
211
|
+
const extractDir = await fs.promises.mkdtemp(path.join(path.dirname(destination), '.flucto-tar-'));
|
|
212
|
+
let expectedCount = 0;
|
|
213
|
+
let validationError = null;
|
|
214
|
+
const expectedMembers = new Set();
|
|
215
|
+
const filter = (rawPath, entry) => {
|
|
216
|
+
let normalized;
|
|
217
|
+
try {
|
|
218
|
+
normalized = normalizeArchivePath(rawPath);
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
validationError = error instanceof Error ? error : new Error(String(error));
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
if (entry.type && !['File', 'Directory'].includes(entry.type)) {
|
|
225
|
+
validationError = new Error(`TAR links/special entries are rejected: ${rawPath}`);
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
const isCandidate = normalized === memberName || normalized.endsWith(`/${memberName}`);
|
|
229
|
+
if (isCandidate) {
|
|
230
|
+
expectedCount += 1;
|
|
231
|
+
if (expectedCount > 1)
|
|
232
|
+
throw new Error(`Ambiguous TAR member: ${memberName}`);
|
|
233
|
+
if (entry.type !== 'File') {
|
|
234
|
+
validationError = new Error(`Expected regular TAR file: ${rawPath}`);
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
if (typeof entry.size !== 'number' || entry.size > MAX_EXECUTABLE_BYTES) {
|
|
238
|
+
validationError = new Error('TAR executable exceeds size limit');
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
expectedMembers.add(normalized);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
if (entry.type === 'Directory')
|
|
245
|
+
return true;
|
|
246
|
+
return false;
|
|
247
|
+
};
|
|
156
248
|
try {
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
-
throw
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
249
|
+
await tar.x({ file: archivePath, cwd: extractDir, strict: true, filter });
|
|
250
|
+
if (validationError)
|
|
251
|
+
throw validationError;
|
|
252
|
+
if (expectedCount !== 1 || expectedMembers.size !== 1)
|
|
253
|
+
throw new Error(`TAR member not found: ${memberName}`);
|
|
254
|
+
const found = path.join(extractDir, ...[...expectedMembers][0].split('/'));
|
|
255
|
+
if (!fs.existsSync(found))
|
|
256
|
+
throw new Error(`TAR member not extracted: ${memberName}`);
|
|
257
|
+
const extracted = await fs.promises.stat(found);
|
|
258
|
+
if (!extracted.isFile() || extracted.size > MAX_EXECUTABLE_BYTES)
|
|
259
|
+
throw new Error('Extracted TAR member exceeds size limit');
|
|
164
260
|
await fs.promises.copyFile(found, destination);
|
|
165
261
|
}
|
|
166
262
|
finally {
|
|
167
|
-
await fs.promises.rm(
|
|
263
|
+
await fs.promises.rm(extractDir, { recursive: true, force: true });
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const decompressXz = async (source, destination) => {
|
|
267
|
+
const child = spawn('xz', ['-dc', '--', source], { stdio: ['ignore', 'pipe', 'pipe'], shell: false, windowsHide: true });
|
|
268
|
+
let stderr = '';
|
|
269
|
+
let spawnError = null;
|
|
270
|
+
child.stderr.setEncoding('utf8');
|
|
271
|
+
child.stderr.on('data', (chunk) => { stderr = (stderr + chunk).slice(-8192); });
|
|
272
|
+
const exited = new Promise((resolve) => {
|
|
273
|
+
child.once('error', (error) => { spawnError = error; });
|
|
274
|
+
child.once('close', resolve);
|
|
275
|
+
});
|
|
276
|
+
let total = 0;
|
|
277
|
+
const limiter = new Transform({ transform(chunk, _encoding, callback) {
|
|
278
|
+
total += chunk.length;
|
|
279
|
+
callback(total > MAX_DECOMPRESSED_TAR_BYTES ? new Error('Decompressed TAR exceeds size limit') : null, chunk);
|
|
280
|
+
} });
|
|
281
|
+
let timedOut = false;
|
|
282
|
+
let forceKillTimer;
|
|
283
|
+
const timeout = setTimeout(() => {
|
|
284
|
+
timedOut = true;
|
|
285
|
+
child.kill('SIGTERM');
|
|
286
|
+
forceKillTimer = setTimeout(() => child.kill('SIGKILL'), 5000);
|
|
287
|
+
}, 120000);
|
|
288
|
+
const stopChild = async () => {
|
|
289
|
+
if (child.exitCode !== null || child.signalCode !== null)
|
|
290
|
+
return;
|
|
291
|
+
child.kill('SIGTERM');
|
|
292
|
+
const closed = await Promise.race([
|
|
293
|
+
exited.then(() => true),
|
|
294
|
+
new Promise((resolve) => setTimeout(() => resolve(false), 2000)),
|
|
295
|
+
]);
|
|
296
|
+
if (!closed && child.exitCode === null && child.signalCode === null)
|
|
297
|
+
child.kill('SIGKILL');
|
|
298
|
+
if (!closed)
|
|
299
|
+
await exited;
|
|
300
|
+
};
|
|
301
|
+
try {
|
|
302
|
+
await Promise.all([
|
|
303
|
+
pipeline(child.stdout, limiter, fs.createWriteStream(destination, { flags: 'wx' })),
|
|
304
|
+
exited.then((code) => {
|
|
305
|
+
if (spawnError)
|
|
306
|
+
throw spawnError;
|
|
307
|
+
if (timedOut)
|
|
308
|
+
throw new Error('xz decompression timed out');
|
|
309
|
+
if (code !== 0)
|
|
310
|
+
throw new Error(`xz decompression failed (${code}): ${stderr}`);
|
|
311
|
+
}),
|
|
312
|
+
]);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
await stopChild();
|
|
316
|
+
await fs.promises.rm(destination, { force: true });
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
finally {
|
|
320
|
+
clearTimeout(timeout);
|
|
321
|
+
if (forceKillTimer)
|
|
322
|
+
clearTimeout(forceKillTimer);
|
|
168
323
|
}
|
|
169
324
|
};
|
|
170
325
|
const extractGzipMember = async (archivePath, destination) => {
|
|
171
|
-
|
|
172
|
-
|
|
326
|
+
let total = 0;
|
|
327
|
+
const limiter = new Transform({ transform(chunk, _encoding, callback) {
|
|
328
|
+
total += chunk.length;
|
|
329
|
+
callback(total > MAX_EXECUTABLE_BYTES ? new Error('Gzip executable exceeds size limit') : null, chunk);
|
|
330
|
+
} });
|
|
331
|
+
await pipeline(fs.createReadStream(archivePath), zlib.createGunzip(), limiter, fs.createWriteStream(destination, { flags: 'wx' }));
|
|
173
332
|
};
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return candidate;
|
|
179
|
-
if (entry.isDirectory()) {
|
|
180
|
-
const nested = findFileNamed(candidate, filename);
|
|
181
|
-
if (nested)
|
|
182
|
-
return nested;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return null;
|
|
333
|
+
const replacePreservingOld = async (staged, target) => {
|
|
334
|
+
// Same-filesystem rename is atomic on POSIX. On platforms that reject
|
|
335
|
+
// replacement (notably Windows with a target in use), fail without moving it.
|
|
336
|
+
await fs.promises.rename(staged, target);
|
|
186
337
|
};
|
|
187
338
|
const isZipArchive = async (filePath) => {
|
|
188
339
|
if (filePath.toLowerCase().endsWith('.zip'))
|
|
@@ -197,52 +348,174 @@ const isZipArchive = async (filePath) => {
|
|
|
197
348
|
await file.close();
|
|
198
349
|
}
|
|
199
350
|
};
|
|
200
|
-
const
|
|
201
|
-
|
|
351
|
+
const extractValidateUtility = async (spec, archivePath, stagedPath, tempDir, decompressedTarCache = new Map()) => {
|
|
352
|
+
if (spec.name === 'yt-dlp')
|
|
353
|
+
await fs.promises.copyFile(archivePath, stagedPath);
|
|
354
|
+
else {
|
|
355
|
+
const lower = archivePath.toLowerCase();
|
|
356
|
+
const member = spec.archiveMember ?? spec.executableName;
|
|
357
|
+
if (await isZipArchive(archivePath))
|
|
358
|
+
await extractZipMember(archivePath, member, stagedPath);
|
|
359
|
+
else if (lower.endsWith('.gz') && !lower.endsWith('.tar.gz'))
|
|
360
|
+
await extractGzipMember(archivePath, stagedPath);
|
|
361
|
+
else if (lower.endsWith('.tar.xz')) {
|
|
362
|
+
let tarPath = decompressedTarCache.get(archivePath);
|
|
363
|
+
if (!tarPath) {
|
|
364
|
+
tarPath = path.join(tempDir, `archive-${decompressedTarCache.size}.decompressed.tar`);
|
|
365
|
+
await decompressXz(archivePath, tarPath);
|
|
366
|
+
decompressedTarCache.set(archivePath, tarPath);
|
|
367
|
+
}
|
|
368
|
+
await extractTarMember(tarPath, member, stagedPath);
|
|
369
|
+
}
|
|
370
|
+
else
|
|
371
|
+
await extractTarMember(archivePath, member, stagedPath);
|
|
372
|
+
}
|
|
373
|
+
if (process.platform !== 'win32')
|
|
374
|
+
await fs.promises.chmod(stagedPath, 0o755);
|
|
375
|
+
if (!await versionFor(stagedPath, spec.versionArgs))
|
|
376
|
+
throw new Error(`${spec.name} staged executable failed version validation`);
|
|
377
|
+
};
|
|
378
|
+
const provisionUtilityFromUrl = async (spec, url, targetPath, onStatus, fetchImpl = fetch) => {
|
|
379
|
+
await fs.promises.mkdir(path.dirname(targetPath), { recursive: true });
|
|
380
|
+
const tempDir = await fs.promises.mkdtemp(path.join(path.dirname(targetPath), '.flucto-download-'));
|
|
202
381
|
const archivePath = path.join(tempDir, path.basename(new URL(url).pathname) || `${spec.name}.download`);
|
|
382
|
+
const stagedPath = path.join(tempDir, spec.executableName);
|
|
203
383
|
try {
|
|
204
384
|
onStatus?.(`Downloading ${spec.name}...`);
|
|
205
|
-
await downloadFile(url, archivePath);
|
|
206
|
-
if (spec.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
else {
|
|
211
|
-
// Pick the extractor from the archive format, not the host platform:
|
|
212
|
-
// macOS sources ship both .zip (vendor builds) and .gz (ffmpeg-static).
|
|
213
|
-
const lower = archivePath.toLowerCase();
|
|
214
|
-
const member = spec.archiveMember ?? spec.executableName;
|
|
215
|
-
if (await isZipArchive(archivePath)) {
|
|
216
|
-
await extractZipMember(archivePath, member, targetPath);
|
|
217
|
-
}
|
|
218
|
-
else if (lower.endsWith('.gz') && !lower.endsWith('.tar.gz')) {
|
|
219
|
-
await extractGzipMember(archivePath, targetPath);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
await extractTarMember(archivePath, member, targetPath);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (process.platform !== 'win32')
|
|
226
|
-
await fs.promises.chmod(targetPath, 0o755);
|
|
385
|
+
await downloadFile(url, archivePath, fetchImpl);
|
|
386
|
+
if (spec.archiveSha256 && !verifySha256(await fs.promises.readFile(archivePath), spec.archiveSha256))
|
|
387
|
+
throw new Error(`${spec.name} archive SHA-256 mismatch`);
|
|
388
|
+
await extractValidateUtility(spec, archivePath, stagedPath, tempDir);
|
|
389
|
+
await replacePreservingOld(stagedPath, targetPath);
|
|
227
390
|
}
|
|
228
391
|
finally {
|
|
229
392
|
await fs.promises.rm(tempDir, { recursive: true, force: true });
|
|
230
393
|
}
|
|
231
394
|
};
|
|
232
|
-
export const provisionUtility = async (spec, targetPath, onStatus) => {
|
|
395
|
+
export const provisionUtility = async (spec, targetPath, onStatus, fetchImpl = fetch) => {
|
|
233
396
|
const errors = [];
|
|
234
|
-
|
|
397
|
+
const sources = spec.name === 'yt-dlp'
|
|
398
|
+
? await ytDlpRuntimeSources(spec.downloadUrls)
|
|
399
|
+
: spec.downloadUrls;
|
|
400
|
+
for (const url of sources) {
|
|
235
401
|
try {
|
|
236
|
-
await provisionUtilityFromUrl(spec, url, targetPath, onStatus);
|
|
402
|
+
await provisionUtilityFromUrl(spec, url, targetPath, onStatus, fetchImpl);
|
|
237
403
|
return;
|
|
238
404
|
}
|
|
239
405
|
catch (error) {
|
|
240
406
|
errors.push(error instanceof Error ? error.message : String(error));
|
|
241
407
|
}
|
|
242
408
|
}
|
|
243
|
-
throw new Error(`Failed to provision ${spec.name}: ${errors.join(' | ')}`);
|
|
409
|
+
throw new Error(`Failed to provision ${spec.name}: ${errors.length ? errors.join(' | ') : 'no verified download source is configured'}`);
|
|
244
410
|
};
|
|
245
411
|
const managedTargetPath = (binDir, name) => path.join(binDir, executableName(name));
|
|
412
|
+
const expectedAvVersionIdentity = (platform) => platform === 'win32' ? '8.1.2' : platform === 'darwin' ? '9.0.2' : 'N-128959-g4dbee3b241';
|
|
413
|
+
const versionIdentity = (value) => value?.match(/version ([^ ]+)/)?.[1] ?? null;
|
|
414
|
+
const versionsMatch = (left, right) => {
|
|
415
|
+
const leftIdentity = versionIdentity(left);
|
|
416
|
+
const rightIdentity = versionIdentity(right);
|
|
417
|
+
return leftIdentity !== null && rightIdentity !== null && leftIdentity === rightIdentity;
|
|
418
|
+
};
|
|
419
|
+
export const replaceManagedAvPair = async (pairs, binDir, operations = {}) => {
|
|
420
|
+
const rename = operations.rename ?? fs.promises.rename.bind(fs.promises);
|
|
421
|
+
const remove = operations.remove ?? fs.promises.rm.bind(fs.promises);
|
|
422
|
+
const backupDir = await fs.promises.mkdtemp(path.join(binDir, '.av-backup-'));
|
|
423
|
+
const backups = [];
|
|
424
|
+
const installed = [];
|
|
425
|
+
try {
|
|
426
|
+
for (const [i, pair] of pairs.entries()) {
|
|
427
|
+
try {
|
|
428
|
+
await fs.promises.access(pair.target);
|
|
429
|
+
const backup = path.join(backupDir, `${i}-${path.basename(pair.target)}`);
|
|
430
|
+
await rename(pair.target, backup);
|
|
431
|
+
backups.push({ target: pair.target, backup });
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
if (error.code !== 'ENOENT')
|
|
435
|
+
throw error;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
for (const pair of pairs) {
|
|
439
|
+
await rename(pair.staged, pair.target);
|
|
440
|
+
installed.push(pair.target);
|
|
441
|
+
}
|
|
442
|
+
await remove(backupDir, { recursive: true, force: true });
|
|
443
|
+
backups.length = 0;
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
const rollbackErrors = [];
|
|
447
|
+
for (const target of installed.reverse()) {
|
|
448
|
+
try {
|
|
449
|
+
await remove(target, { force: true });
|
|
450
|
+
}
|
|
451
|
+
catch (rollbackError) {
|
|
452
|
+
rollbackErrors.push(rollbackError);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
for (const item of backups.reverse()) {
|
|
456
|
+
try {
|
|
457
|
+
await rename(item.backup, item.target);
|
|
458
|
+
}
|
|
459
|
+
catch (rollbackError) {
|
|
460
|
+
rollbackErrors.push(rollbackError);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if (rollbackErrors.length)
|
|
464
|
+
throw new AggregateError([error, ...rollbackErrors], `FFmpeg/FFprobe replacement rollback incomplete; backups preserved in ${backupDir}`);
|
|
465
|
+
throw error;
|
|
466
|
+
}
|
|
467
|
+
finally {
|
|
468
|
+
if (!backups.some((item) => fs.existsSync(item.backup)))
|
|
469
|
+
await remove(backupDir, { recursive: true, force: true });
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
export const downloadUniquePinnedAvArchives = async (specs, directory, fetchImpl = fetch) => {
|
|
473
|
+
const archives = new Map();
|
|
474
|
+
for (const spec of specs) {
|
|
475
|
+
const url = spec.downloadUrls[0];
|
|
476
|
+
if (!url)
|
|
477
|
+
throw new Error(`No pinned source for ${spec.name}`);
|
|
478
|
+
if (!archives.has(url)) {
|
|
479
|
+
const archivePath = path.join(directory, `archive-${archives.size}-${path.basename(new URL(url).pathname)}`);
|
|
480
|
+
await downloadFile(url, archivePath, fetchImpl);
|
|
481
|
+
if (!spec.archiveSha256 || !verifySha256(await fs.promises.readFile(archivePath), spec.archiveSha256))
|
|
482
|
+
throw new Error(`${spec.name} archive SHA-256 mismatch`);
|
|
483
|
+
archives.set(url, archivePath);
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
const shared = archives.get(url);
|
|
487
|
+
if (!spec.archiveSha256 || !verifySha256(await fs.promises.readFile(shared), spec.archiveSha256))
|
|
488
|
+
throw new Error(`${spec.name} shared archive SHA-256 mismatch`);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return archives;
|
|
492
|
+
};
|
|
493
|
+
const provisionManagedAvPair = async (ffmpegSpec, ffprobeSpec, binDir, force, onStatus, fetchImpl = fetch) => {
|
|
494
|
+
const expected = expectedAvVersionIdentity(process.platform);
|
|
495
|
+
const targets = [managedTargetPath(binDir, 'ffmpeg'), managedTargetPath(binDir, 'ffprobe')];
|
|
496
|
+
const installedMatches = await Promise.all(targets.map(async (target) => (await versionFor(target, ['-version']))?.includes(expected) ?? false));
|
|
497
|
+
if (!force && installedMatches.every(Boolean))
|
|
498
|
+
return false;
|
|
499
|
+
const stageDir = await fs.promises.mkdtemp(path.join(binDir, '.av-stage-'));
|
|
500
|
+
try {
|
|
501
|
+
const specs = [ffmpegSpec, ffprobeSpec];
|
|
502
|
+
const stagePaths = specs.map((spec) => path.join(stageDir, spec.executableName));
|
|
503
|
+
onStatus?.('Downloading pinned FFmpeg/FFprobe archives...');
|
|
504
|
+
const archives = await downloadUniquePinnedAvArchives(specs, stageDir, fetchImpl);
|
|
505
|
+
const decompressedTarCache = new Map();
|
|
506
|
+
for (let index = 0; index < specs.length; index += 1) {
|
|
507
|
+
await extractValidateUtility(specs[index], archives.get(specs[index].downloadUrls[0]), stagePaths[index], stageDir, decompressedTarCache);
|
|
508
|
+
}
|
|
509
|
+
const versions = await Promise.all([versionFor(stagePaths[0], ffmpegSpec.versionArgs), versionFor(stagePaths[1], ffprobeSpec.versionArgs)]);
|
|
510
|
+
if (!versions[0]?.includes(expected) || !versions[1]?.includes(expected))
|
|
511
|
+
throw new Error('Staged FFmpeg/FFprobe pair does not match the pinned build identity');
|
|
512
|
+
await replaceManagedAvPair(stagePaths.map((staged, i) => ({ staged, target: targets[i] })), binDir);
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
finally {
|
|
516
|
+
await fs.promises.rm(stageDir, { recursive: true, force: true });
|
|
517
|
+
}
|
|
518
|
+
};
|
|
246
519
|
export const setupUtilities = async (options = {}) => {
|
|
247
520
|
const env = options.env ?? process.env;
|
|
248
521
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -250,19 +523,57 @@ export const setupUtilities = async (options = {}) => {
|
|
|
250
523
|
const utilities = [];
|
|
251
524
|
if (!options.checkOnly)
|
|
252
525
|
await fs.promises.mkdir(binDir, { recursive: true });
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
526
|
+
const allSpecs = utilitySpecs();
|
|
527
|
+
const specs = options.only?.length ? allSpecs.filter((spec) => options.only?.includes(spec.name)) : allSpecs;
|
|
528
|
+
const selectedAvPair = specs.some((spec) => spec.name === 'ffmpeg' || spec.name === 'ffprobe');
|
|
529
|
+
const customFfmpeg = options.ffmpegPath ?? env.FLUCTO_FFMPEG_PATH;
|
|
530
|
+
let avPairProvisioned = false;
|
|
531
|
+
let avPairError;
|
|
532
|
+
if (options.checkOnly && selectedAvPair) {
|
|
533
|
+
const ffmpegPath = customFfmpeg ? path.resolve(customFfmpeg) : managedTargetPath(binDir, 'ffmpeg');
|
|
534
|
+
const ffprobePath = customFfmpeg ? path.join(path.dirname(ffmpegPath), executableName('ffprobe')) : managedTargetPath(binDir, 'ffprobe');
|
|
535
|
+
const ffmpegVersion = await versionFor(ffmpegPath, ['-version']);
|
|
536
|
+
const ffprobeVersion = await versionFor(ffprobePath, ['-version']);
|
|
537
|
+
const identitiesMatch = versionsMatch(ffmpegVersion, ffprobeVersion);
|
|
538
|
+
const expectedMatch = customFfmpeg || (versionIdentity(ffmpegVersion) === expectedAvVersionIdentity(process.platform) && versionIdentity(ffprobeVersion) === expectedAvVersionIdentity(process.platform));
|
|
539
|
+
if (!identitiesMatch || !expectedMatch)
|
|
540
|
+
avPairError = customFfmpeg
|
|
541
|
+
? `Explicit FFmpeg/adjacent FFprobe pair is missing or version-incompatible (${ffmpegPath}, ${ffprobePath}).`
|
|
542
|
+
: 'Managed FFmpeg/FFprobe pair is missing, stale, or version-mismatched for the pinned build.';
|
|
543
|
+
}
|
|
544
|
+
if (!options.checkOnly && selectedAvPair && !customFfmpeg) {
|
|
545
|
+
try {
|
|
546
|
+
avPairProvisioned = await provisionManagedAvPair(allSpecs.find((spec) => spec.name === 'ffmpeg'), allSpecs.find((spec) => spec.name === 'ffprobe'), binDir, Boolean(options.force), options.onStatus, options.fetchImpl);
|
|
547
|
+
}
|
|
548
|
+
catch (error) {
|
|
549
|
+
avPairError = error instanceof Error ? error.message : String(error);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
256
552
|
for (const spec of specs) {
|
|
257
|
-
const explicitPath = spec.name === 'yt-dlp'
|
|
258
|
-
|
|
553
|
+
const explicitPath = spec.name === 'yt-dlp'
|
|
554
|
+
? options.ytDlpPath ?? env.FLUCTO_YT_DLP_PATH
|
|
555
|
+
: spec.name === 'ffmpeg' ? options.ffmpegPath ?? env.FLUCTO_FFMPEG_PATH : undefined;
|
|
556
|
+
const configuredFfmpegPath = options.ffmpegPath ?? env.FLUCTO_FFMPEG_PATH;
|
|
557
|
+
if (selectedAvPair && !customFfmpeg && !options.checkOnly && (spec.name === 'ffmpeg' || spec.name === 'ffprobe')) {
|
|
558
|
+
const target = managedTargetPath(binDir, spec.name);
|
|
559
|
+
const version = avPairError ? null : await versionFor(target, spec.versionArgs);
|
|
560
|
+
utilities.push({ name: spec.name, path: target, status: avPairError ? 'failed' : avPairProvisioned ? 'downloaded' : 'present', version, error: avPairError });
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
const targetPath = explicitPath
|
|
564
|
+
? path.resolve(explicitPath)
|
|
565
|
+
: spec.name === 'ffprobe' && configuredFfmpegPath
|
|
566
|
+
? path.join(path.dirname(path.resolve(configuredFfmpegPath)), executableName('ffprobe'))
|
|
567
|
+
: managedTargetPath(binDir, spec.name);
|
|
259
568
|
const present = isExecutable(targetPath);
|
|
260
569
|
if (options.checkOnly) {
|
|
570
|
+
const isAv = spec.name === 'ffmpeg' || spec.name === 'ffprobe';
|
|
261
571
|
utilities.push({
|
|
262
572
|
name: spec.name,
|
|
263
573
|
path: targetPath,
|
|
264
|
-
status: present ? 'present' : 'missing',
|
|
574
|
+
status: isAv && avPairError ? 'failed' : present ? 'present' : 'missing',
|
|
265
575
|
version: present ? await versionFor(targetPath, spec.versionArgs) : null,
|
|
576
|
+
error: isAv ? avPairError : undefined,
|
|
266
577
|
});
|
|
267
578
|
continue;
|
|
268
579
|
}
|
|
@@ -276,7 +587,15 @@ export const setupUtilities = async (options = {}) => {
|
|
|
276
587
|
});
|
|
277
588
|
continue;
|
|
278
589
|
}
|
|
279
|
-
|
|
590
|
+
const ffprobeBesideExplicitFfmpeg = spec.name === 'ffprobe' && Boolean(configuredFfmpegPath);
|
|
591
|
+
if (ffprobeBesideExplicitFfmpeg) {
|
|
592
|
+
const ffmpegVersion = await versionFor(path.resolve(configuredFfmpegPath), ['-version']);
|
|
593
|
+
const ffprobeVersion = await versionFor(targetPath, spec.versionArgs);
|
|
594
|
+
const compatible = versionsMatch(ffmpegVersion, ffprobeVersion);
|
|
595
|
+
utilities.push({ name: spec.name, path: targetPath, status: compatible ? 'present' : 'failed', version: ffprobeVersion, error: compatible ? undefined : `Explicit FFmpeg/adjacent FFprobe pair is missing or version-incompatible (${configuredFfmpegPath}, ${targetPath}).` });
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
if (present && (!options.force || ffprobeBesideExplicitFfmpeg)) {
|
|
280
599
|
const installedVersion = await versionFor(targetPath, spec.versionArgs);
|
|
281
600
|
if (spec.name === 'yt-dlp') {
|
|
282
601
|
const latestVersion = await fetchLatestYtDlpVersion();
|