@koda-sl/baker-cli 0.192.4 → 0.196.0-dev.6d2f498f5
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 +93 -9
- package/dist/{chunk-PXXJ3HJW.js → chunk-34J26VIJ.js} +4 -4
- package/dist/chunk-F6OHDJIX.js +264 -0
- package/dist/chunk-F6OHDJIX.js.map +1 -0
- package/dist/{chunk-X5C6HE24.js → chunk-G3O4HRYR.js} +3 -3
- package/dist/{chunk-ZWYQIEBI.js → chunk-OB26WXHZ.js} +3 -3
- package/dist/{chunk-ISZWNERZ.js → chunk-SSDYBIZB.js} +293 -19
- package/dist/chunk-SSDYBIZB.js.map +1 -0
- package/dist/{chunk-K3PWXVF7.js → chunk-YUTDQ4PV.js} +2 -2
- package/dist/cli.js +7253 -5702
- package/dist/cli.js.map +1 -1
- package/dist/client-LTDQPQ7T.js +15 -0
- package/dist/engine/index.js +3 -3
- package/dist/env-GV4VDT5W.js +19 -0
- package/dist/{output-NWX3YW64.js → output-PXTEFDVX.js} +5 -5
- package/dist/{shared-5ZEOG664.js → shared-AR6VAAIE.js} +6 -6
- package/package.json +3 -1
- package/dist/chunk-ISZWNERZ.js.map +0 -1
- package/dist/chunk-YL3HDEIJ.js +0 -76
- package/dist/chunk-YL3HDEIJ.js.map +0 -1
- package/dist/client-PJ7ID35L.js +0 -15
- package/dist/env-6QJCMTRK.js +0 -13
- /package/dist/{chunk-PXXJ3HJW.js.map → chunk-34J26VIJ.js.map} +0 -0
- /package/dist/{chunk-X5C6HE24.js.map → chunk-G3O4HRYR.js.map} +0 -0
- /package/dist/{chunk-ZWYQIEBI.js.map → chunk-OB26WXHZ.js.map} +0 -0
- /package/dist/{chunk-K3PWXVF7.js.map → chunk-YUTDQ4PV.js.map} +0 -0
- /package/dist/{client-PJ7ID35L.js.map → client-LTDQPQ7T.js.map} +0 -0
- /package/dist/{env-6QJCMTRK.js.map → env-GV4VDT5W.js.map} +0 -0
- /package/dist/{output-NWX3YW64.js.map → output-PXTEFDVX.js.map} +0 -0
- /package/dist/{shared-5ZEOG664.js.map → shared-AR6VAAIE.js.map} +0 -0
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
debugLogHttp,
|
|
3
3
|
readBodyForLog
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YUTDQ4PV.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
|
-
__toESM
|
|
8
|
-
|
|
7
|
+
__toESM,
|
|
8
|
+
captureProxyCredentials,
|
|
9
|
+
childEnvWith,
|
|
10
|
+
isChallengeBody,
|
|
11
|
+
isProxyFailure,
|
|
12
|
+
plannedRoutes,
|
|
13
|
+
shouldEscalate
|
|
14
|
+
} from "./chunk-F6OHDJIX.js";
|
|
9
15
|
|
|
10
|
-
//
|
|
16
|
+
// ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/810146e81bae4e3a061fe487864f2fde80c4b03b886877dc0f1fffbc6480b67e/node_modules/safe-stable-stringify/index.js
|
|
11
17
|
var require_safe_stable_stringify = __commonJS({
|
|
12
|
-
"
|
|
18
|
+
"../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/810146e81bae4e3a061fe487864f2fde80c4b03b886877dc0f1fffbc6480b67e/node_modules/safe-stable-stringify/index.js"(exports, module) {
|
|
13
19
|
"use strict";
|
|
14
20
|
var { hasOwnProperty } = Object.prototype;
|
|
15
21
|
var stringify = configure2();
|
|
@@ -1083,7 +1089,7 @@ function resolveAdaptFormats(params) {
|
|
|
1083
1089
|
return params.formats ?? [];
|
|
1084
1090
|
}
|
|
1085
1091
|
|
|
1086
|
-
//
|
|
1092
|
+
// ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/810146e81bae4e3a061fe487864f2fde80c4b03b886877dc0f1fffbc6480b67e/node_modules/safe-stable-stringify/esm/wrapper.js
|
|
1087
1093
|
var import__ = __toESM(require_safe_stable_stringify(), 1);
|
|
1088
1094
|
var configure = import__.default.configure;
|
|
1089
1095
|
var wrapper_default = import__.default;
|
|
@@ -4909,6 +4915,227 @@ import path4 from "path";
|
|
|
4909
4915
|
import { promisify } from "util";
|
|
4910
4916
|
import { z as z5 } from "zod";
|
|
4911
4917
|
|
|
4918
|
+
// ../proxy/src/fetch.ts
|
|
4919
|
+
import { ProxyAgent, Response, fetch as undiciFetch } from "undici";
|
|
4920
|
+
|
|
4921
|
+
// ../proxy/src/fetchDecision.ts
|
|
4922
|
+
function classifyFetchOutcome(signal) {
|
|
4923
|
+
if (isProxyFailure(signal)) return "proxy_unavailable";
|
|
4924
|
+
if (shouldEscalate(signal)) return "blocked";
|
|
4925
|
+
if (signal.status != null && signal.status >= 200 && signal.status < 400 && !signal.challenge) return "ok";
|
|
4926
|
+
return "failed";
|
|
4927
|
+
}
|
|
4928
|
+
function shouldTryNextRoute(outcome) {
|
|
4929
|
+
return outcome === "blocked" || outcome === "proxy_unavailable";
|
|
4930
|
+
}
|
|
4931
|
+
var TIMEOUT_CODES = /* @__PURE__ */ new Set([
|
|
4932
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
4933
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
4934
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
4935
|
+
"ETIMEDOUT"
|
|
4936
|
+
]);
|
|
4937
|
+
var RESET_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "UND_ERR_SOCKET", "EPIPE"]);
|
|
4938
|
+
var PROXY_RESPONSE = /Proxy response \((\d+)\)/;
|
|
4939
|
+
function errorCode(error) {
|
|
4940
|
+
if (typeof error !== "object" || error === null) return null;
|
|
4941
|
+
const code = error.code;
|
|
4942
|
+
if (typeof code === "string") return code;
|
|
4943
|
+
const name = error.name;
|
|
4944
|
+
return typeof name === "string" ? name : null;
|
|
4945
|
+
}
|
|
4946
|
+
function errorMessage(error) {
|
|
4947
|
+
if (typeof error === "object" && error !== null) {
|
|
4948
|
+
const message2 = error.message;
|
|
4949
|
+
if (typeof message2 === "string") return message2;
|
|
4950
|
+
}
|
|
4951
|
+
return String(error);
|
|
4952
|
+
}
|
|
4953
|
+
function errorBlockSignal(error, proxied) {
|
|
4954
|
+
const proxyResponse = PROXY_RESPONSE.exec(errorMessage(error));
|
|
4955
|
+
if (proxyResponse) {
|
|
4956
|
+
const status = Number(proxyResponse[1]);
|
|
4957
|
+
return status === 407 ? { status: 407 } : { netError: "ERR_TUNNEL_CONNECTION_FAILED" };
|
|
4958
|
+
}
|
|
4959
|
+
const code = errorCode(error);
|
|
4960
|
+
if (code !== null && TIMEOUT_CODES.has(code)) return { timedOut: true };
|
|
4961
|
+
if (code === "AbortError" || code === "TimeoutError") return { timedOut: true };
|
|
4962
|
+
if (proxied) {
|
|
4963
|
+
return { netError: "ERR_PROXY_CONNECTION_FAILED" };
|
|
4964
|
+
}
|
|
4965
|
+
if (code !== null && RESET_CODES.has(code)) return { netError: "ERR_CONNECTION_RESET" };
|
|
4966
|
+
return { netError: code ?? "ERR_FAILED" };
|
|
4967
|
+
}
|
|
4968
|
+
function shouldSniffChallenge(contentType, contentLength, maxSniffBytes) {
|
|
4969
|
+
if (contentLength !== null && contentLength > maxSniffBytes) return false;
|
|
4970
|
+
if (contentType === null || contentType.trim() === "") return true;
|
|
4971
|
+
const type = contentType.toLowerCase();
|
|
4972
|
+
if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("audio/")) return false;
|
|
4973
|
+
return type.includes("text/") || type.includes("html") || type.includes("json") || type.includes("xml");
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
// ../proxy/src/fetch.ts
|
|
4977
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
4978
|
+
var MAX_SNIFF_BYTES = 64 * 1024;
|
|
4979
|
+
function tierOf(route) {
|
|
4980
|
+
return route.kind === "proxy" ? route.tier : "direct";
|
|
4981
|
+
}
|
|
4982
|
+
function agentFor(route) {
|
|
4983
|
+
if (route.kind !== "proxy") return null;
|
|
4984
|
+
const token = Buffer.from(`${route.username}:${route.password}`).toString("base64");
|
|
4985
|
+
return new ProxyAgent({ uri: route.server, token: `Basic ${token}` });
|
|
4986
|
+
}
|
|
4987
|
+
var NULL_BODY_STATUS = /* @__PURE__ */ new Set([101, 103, 204, 205, 304]);
|
|
4988
|
+
function rebuild(response, body) {
|
|
4989
|
+
if (response.status < 200 || response.status > 599 || NULL_BODY_STATUS.has(response.status)) {
|
|
4990
|
+
return new Response(null, { status: response.status, headers: response.headers });
|
|
4991
|
+
}
|
|
4992
|
+
return new Response(body, {
|
|
4993
|
+
status: response.status,
|
|
4994
|
+
statusText: response.statusText,
|
|
4995
|
+
headers: response.headers
|
|
4996
|
+
});
|
|
4997
|
+
}
|
|
4998
|
+
function declaredLength(response) {
|
|
4999
|
+
const raw = response.headers.get("content-length");
|
|
5000
|
+
if (raw === null) return null;
|
|
5001
|
+
const value = Number(raw);
|
|
5002
|
+
return Number.isFinite(value) ? value : null;
|
|
5003
|
+
}
|
|
5004
|
+
async function readOnce(response, sniff, maxBytes) {
|
|
5005
|
+
const declared = declaredLength(response);
|
|
5006
|
+
if (maxBytes !== void 0 && declared !== null && declared > maxBytes) {
|
|
5007
|
+
await response.body?.cancel();
|
|
5008
|
+
return { response: rebuild(response, new ArrayBuffer(0)), challenge: false };
|
|
5009
|
+
}
|
|
5010
|
+
const body = await response.arrayBuffer();
|
|
5011
|
+
const wantsSniff = sniff && shouldSniffChallenge(response.headers.get("content-type"), body.byteLength, MAX_SNIFF_BYTES);
|
|
5012
|
+
const challenge = wantsSniff ? isChallengeBody(new TextDecoder().decode(body)) : false;
|
|
5013
|
+
return { response: rebuild(response, body), challenge };
|
|
5014
|
+
}
|
|
5015
|
+
async function attemptRoute(url, init, route, options) {
|
|
5016
|
+
const tier = tierOf(route);
|
|
5017
|
+
const agent = agentFor(route);
|
|
5018
|
+
const startedAt = Date.now();
|
|
5019
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
5020
|
+
const signal = init.signal ? AbortSignal.any([init.signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs);
|
|
5021
|
+
try {
|
|
5022
|
+
const raw = await undiciFetch(url, { ...init, dispatcher: agent ?? void 0, signal });
|
|
5023
|
+
const read = await readOnce(raw, options.sniffChallenge ?? true, options.maxBytes);
|
|
5024
|
+
const outcome = classifyFetchOutcome({ status: raw.status, challenge: read.challenge });
|
|
5025
|
+
return {
|
|
5026
|
+
attempt: { tier, status: raw.status, ms: Date.now() - startedAt, outcome },
|
|
5027
|
+
response: outcome === "proxy_unavailable" ? null : read.response
|
|
5028
|
+
};
|
|
5029
|
+
} catch (error) {
|
|
5030
|
+
const blockSignal = errorBlockSignal(error, route.kind === "proxy");
|
|
5031
|
+
return {
|
|
5032
|
+
attempt: {
|
|
5033
|
+
tier,
|
|
5034
|
+
status: blockSignal.status ?? void 0,
|
|
5035
|
+
ms: Date.now() - startedAt,
|
|
5036
|
+
outcome: classifyFetchOutcome(blockSignal)
|
|
5037
|
+
},
|
|
5038
|
+
response: null,
|
|
5039
|
+
error
|
|
5040
|
+
};
|
|
5041
|
+
} finally {
|
|
5042
|
+
await agent?.close();
|
|
5043
|
+
}
|
|
5044
|
+
}
|
|
5045
|
+
async function fetchWithEscalation(url, init, options) {
|
|
5046
|
+
const attempts = [];
|
|
5047
|
+
let originResponse = null;
|
|
5048
|
+
let originTier = "direct";
|
|
5049
|
+
let lastError;
|
|
5050
|
+
for (const route of plannedRoutes(url, options.credentials, options.routeOptions)) {
|
|
5051
|
+
const rung = await attemptRoute(url, init, route, options);
|
|
5052
|
+
attempts.push(rung.attempt);
|
|
5053
|
+
if (rung.response !== null) {
|
|
5054
|
+
originResponse = rung.response;
|
|
5055
|
+
originTier = rung.attempt.tier;
|
|
5056
|
+
}
|
|
5057
|
+
if (rung.error !== void 0) lastError = rung.error;
|
|
5058
|
+
if (!shouldTryNextRoute(rung.attempt.outcome)) break;
|
|
5059
|
+
}
|
|
5060
|
+
return {
|
|
5061
|
+
response: originResponse,
|
|
5062
|
+
attempts,
|
|
5063
|
+
finalTier: originResponse !== null ? originTier : lastAttempt(attempts)?.tier ?? "direct",
|
|
5064
|
+
...originResponse === null && lastError !== void 0 ? { error: lastError } : {}
|
|
5065
|
+
};
|
|
5066
|
+
}
|
|
5067
|
+
function lastAttempt(attempts) {
|
|
5068
|
+
return attempts[attempts.length - 1];
|
|
5069
|
+
}
|
|
5070
|
+
function describeLadder(result) {
|
|
5071
|
+
const rungs = result.attempts.map((a) => `${a.tier}:${a.outcome}${a.status ? `(${a.status})` : ""}@${a.ms}ms`);
|
|
5072
|
+
return `${rungs.join(" \u2192 ")} | final=${result.finalTier}`;
|
|
5073
|
+
}
|
|
5074
|
+
function rescued(result) {
|
|
5075
|
+
return result.attempts.some((attempt) => attempt.outcome === "ok");
|
|
5076
|
+
}
|
|
5077
|
+
function endedBlocked(result) {
|
|
5078
|
+
if (rescued(result)) return false;
|
|
5079
|
+
return result.attempts.some((attempt) => attempt.outcome === "blocked");
|
|
5080
|
+
}
|
|
5081
|
+
function endedProxyUnavailable(result) {
|
|
5082
|
+
if (rescued(result) || endedBlocked(result)) return false;
|
|
5083
|
+
return result.attempts.some((attempt) => attempt.outcome === "proxy_unavailable");
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5086
|
+
// src/lib/externalFetch.ts
|
|
5087
|
+
var BROWSER_HEADERS = {
|
|
5088
|
+
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
|
5089
|
+
Accept: "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
|
|
5090
|
+
"Accept-Language": "en-US,en;q=0.9"
|
|
5091
|
+
};
|
|
5092
|
+
var ExternalFetchError = class extends Error {
|
|
5093
|
+
/** True when the fault was ours — a route we could not open, not a dead host. */
|
|
5094
|
+
ourFault;
|
|
5095
|
+
constructor(message2, ourFault) {
|
|
5096
|
+
super(message2);
|
|
5097
|
+
this.name = "ExternalFetchError";
|
|
5098
|
+
this.ourFault = ourFault;
|
|
5099
|
+
}
|
|
5100
|
+
};
|
|
5101
|
+
async function fetchExternal(url, options = {}) {
|
|
5102
|
+
const result = await fetchWithEscalation(
|
|
5103
|
+
url,
|
|
5104
|
+
{ headers: { ...BROWSER_HEADERS, ...options.headers } },
|
|
5105
|
+
{
|
|
5106
|
+
credentials: captureProxyCredentials(),
|
|
5107
|
+
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs },
|
|
5108
|
+
...options.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes },
|
|
5109
|
+
...options.sniffChallenge === void 0 ? {} : { sniffChallenge: options.sniffChallenge }
|
|
5110
|
+
}
|
|
5111
|
+
);
|
|
5112
|
+
if (result.attempts.length > 1) {
|
|
5113
|
+
process.stderr.write(`fetch ladder ${url} \u2014 ${describeLadder(result)}
|
|
5114
|
+
`);
|
|
5115
|
+
}
|
|
5116
|
+
if (result.response === null) {
|
|
5117
|
+
const ourFault = endedProxyUnavailable(result);
|
|
5118
|
+
throw new ExternalFetchError(
|
|
5119
|
+
ourFault ? "Could not open a route to that address." : "That address did not answer.",
|
|
5120
|
+
ourFault
|
|
5121
|
+
);
|
|
5122
|
+
}
|
|
5123
|
+
return { response: result.response, blocked: endedBlocked(result) };
|
|
5124
|
+
}
|
|
5125
|
+
async function fetchExternalBytes(url, options = {}) {
|
|
5126
|
+
const { response, blocked } = await fetchExternal(url, options);
|
|
5127
|
+
if (!response.ok) {
|
|
5128
|
+
throw new ExternalFetchError(`${response.status} ${response.statusText}`, false);
|
|
5129
|
+
}
|
|
5130
|
+
if (blocked) {
|
|
5131
|
+
throw new ExternalFetchError("That host served a security check instead of the file.", false);
|
|
5132
|
+
}
|
|
5133
|
+
return {
|
|
5134
|
+
buffer: Buffer.from(await response.arrayBuffer()),
|
|
5135
|
+
contentType: response.headers.get("content-type")
|
|
5136
|
+
};
|
|
5137
|
+
}
|
|
5138
|
+
|
|
4912
5139
|
// src/engine/schema/refs.ts
|
|
4913
5140
|
import { z as z4 } from "zod";
|
|
4914
5141
|
|
|
@@ -5104,6 +5331,25 @@ function mapClientError(ctx, e) {
|
|
|
5104
5331
|
return new NodeExecutionError(ctx.nodeId, ctx.nodeType, { kind: "local", cause: e });
|
|
5105
5332
|
}
|
|
5106
5333
|
|
|
5334
|
+
// src/engine/nodes/ytDlpSignal.ts
|
|
5335
|
+
var HTTP_ERROR = /HTTP Error (\d{3})/i;
|
|
5336
|
+
var CHALLENGE_PHRASES = [
|
|
5337
|
+
"sign in to confirm you're not a bot",
|
|
5338
|
+
"sign in to confirm you\u2019re not a bot",
|
|
5339
|
+
"confirm you are not a bot",
|
|
5340
|
+
"unusual traffic",
|
|
5341
|
+
"captcha"
|
|
5342
|
+
];
|
|
5343
|
+
var NOT_A_BLOCK_PHRASES = ["private video", "video unavailable", "members-only", "this video is available to"];
|
|
5344
|
+
function ytDlpBlockSignal(stderr) {
|
|
5345
|
+
const text = stderr.toLowerCase();
|
|
5346
|
+
if (NOT_A_BLOCK_PHRASES.some((phrase) => text.includes(phrase))) return {};
|
|
5347
|
+
const status = HTTP_ERROR.exec(stderr);
|
|
5348
|
+
if (status) return { status: Number(status[1]) };
|
|
5349
|
+
if (CHALLENGE_PHRASES.some((phrase) => text.includes(phrase))) return { challenge: true };
|
|
5350
|
+
return {};
|
|
5351
|
+
}
|
|
5352
|
+
|
|
5107
5353
|
// src/engine/nodes/ingest.ts
|
|
5108
5354
|
var execFile = promisify(execFileCb);
|
|
5109
5355
|
var ExpectEnum = z5.enum(["image", "video", "audio", "text", "json", "font"]);
|
|
@@ -5221,17 +5467,18 @@ async function execDirectFetch(params, ctx) {
|
|
|
5221
5467
|
return assertAssetOutput(result, params.expect);
|
|
5222
5468
|
}
|
|
5223
5469
|
async function ingestImageUrl(url, ctx) {
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5470
|
+
let bytes;
|
|
5471
|
+
try {
|
|
5472
|
+
({ buffer: bytes } = await fetchExternalBytes(url, { maxBytes: MAX_ASSET_BYTES }));
|
|
5473
|
+
} catch (e) {
|
|
5474
|
+
throw localExecError(ctx, `fetch ${url} \u2192 ${e.message}`);
|
|
5227
5475
|
}
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
throw localExecError(ctx, `file_too_large: ${url} is ${ab.byteLength} bytes (limit ${MAX_ASSET_BYTES})`);
|
|
5476
|
+
if (bytes.byteLength > MAX_ASSET_BYTES) {
|
|
5477
|
+
throw localExecError(ctx, `file_too_large: ${url} is ${bytes.byteLength} bytes (limit ${MAX_ASSET_BYTES})`);
|
|
5231
5478
|
}
|
|
5232
5479
|
let normalized;
|
|
5233
5480
|
try {
|
|
5234
|
-
normalized = await toModelSafeImage(
|
|
5481
|
+
normalized = await toModelSafeImage(bytes);
|
|
5235
5482
|
} catch (e) {
|
|
5236
5483
|
throw localExecError(ctx, `${url}: ${e.message}`);
|
|
5237
5484
|
}
|
|
@@ -5567,6 +5814,29 @@ async function execYtDlp(params, ctx) {
|
|
|
5567
5814
|
});
|
|
5568
5815
|
}
|
|
5569
5816
|
}
|
|
5817
|
+
async function runYtDlpViaLadder(url, argv, ctx) {
|
|
5818
|
+
const routes = plannedRoutes(url, captureProxyCredentials());
|
|
5819
|
+
let last = { code: -1, stderr: "" };
|
|
5820
|
+
for (const route of routes) {
|
|
5821
|
+
if (route.kind === "proxy") ctx.log(`ingest: retrying yt-dlp via ${route.tier}`);
|
|
5822
|
+
last = await spawnAndWait(YT_DLP_BIN, argv, YT_DLP_TIMEOUT_MS, proxyEnvFor(route));
|
|
5823
|
+
if (last.code === 0) return last;
|
|
5824
|
+
if (!shouldEscalate(ytDlpBlockSignal(last.stderr))) return last;
|
|
5825
|
+
}
|
|
5826
|
+
return last;
|
|
5827
|
+
}
|
|
5828
|
+
function proxyEnvFor(route) {
|
|
5829
|
+
if (route.kind !== "proxy") return void 0;
|
|
5830
|
+
const uri = new URL(route.server);
|
|
5831
|
+
uri.username = encodeURIComponent(route.username);
|
|
5832
|
+
uri.password = encodeURIComponent(route.password);
|
|
5833
|
+
return {
|
|
5834
|
+
HTTP_PROXY: uri.toString(),
|
|
5835
|
+
HTTPS_PROXY: uri.toString(),
|
|
5836
|
+
http_proxy: uri.toString(),
|
|
5837
|
+
https_proxy: uri.toString()
|
|
5838
|
+
};
|
|
5839
|
+
}
|
|
5570
5840
|
async function runYtDlp(args) {
|
|
5571
5841
|
const outTemplate = path4.join(args.workDir, "out.%(ext)s");
|
|
5572
5842
|
const infoPath = path4.join(args.workDir, "out.info.json");
|
|
@@ -5586,7 +5856,7 @@ async function runYtDlp(args) {
|
|
|
5586
5856
|
argv.push("--format", "bv*+ba/b", "--merge-output-format", "mp4");
|
|
5587
5857
|
}
|
|
5588
5858
|
args.ctx.log(`ingest: spawning yt-dlp (${args.audioOnly ? "audio" : "video"})`);
|
|
5589
|
-
const { code, stderr } = await
|
|
5859
|
+
const { code, stderr } = await runYtDlpViaLadder(args.url, argv, args.ctx);
|
|
5590
5860
|
if (code !== 0) {
|
|
5591
5861
|
throw new NodeExecutionError(args.ctx.nodeId, args.ctx.nodeType, {
|
|
5592
5862
|
kind: "local",
|
|
@@ -5633,9 +5903,12 @@ async function uploadAndIngest(args) {
|
|
|
5633
5903
|
});
|
|
5634
5904
|
return { ...localRef, url: publicUrl };
|
|
5635
5905
|
}
|
|
5636
|
-
function spawnAndWait(bin, argv, timeoutMs) {
|
|
5906
|
+
function spawnAndWait(bin, argv, timeoutMs, env) {
|
|
5637
5907
|
return new Promise((resolve, reject) => {
|
|
5638
|
-
const child = spawn(bin, argv, {
|
|
5908
|
+
const child = spawn(bin, argv, {
|
|
5909
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
5910
|
+
...env ? { env: childEnvWith(env) } : {}
|
|
5911
|
+
});
|
|
5639
5912
|
const stderrChunks = [];
|
|
5640
5913
|
let stderrLen = 0;
|
|
5641
5914
|
const MAX_STDERR = 256 * 1024;
|
|
@@ -5700,7 +5973,7 @@ import { tmpdir as tmpdir2 } from "os";
|
|
|
5700
5973
|
import path5 from "path";
|
|
5701
5974
|
import { promisify as promisify2 } from "util";
|
|
5702
5975
|
var execFile2 = promisify2(execFileCb2);
|
|
5703
|
-
var
|
|
5976
|
+
var DEFAULT_TIMEOUT_MS2 = 10 * 60 * 1e3;
|
|
5704
5977
|
var URL_SCHEME_RE = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//;
|
|
5705
5978
|
var MIME_BY_EXT = {
|
|
5706
5979
|
png: "image/png",
|
|
@@ -5852,7 +6125,7 @@ function tailLines(text, maxLines) {
|
|
|
5852
6125
|
return lines.slice(-maxLines).join("\n");
|
|
5853
6126
|
}
|
|
5854
6127
|
async function runCli(opts) {
|
|
5855
|
-
const { bin, args, inputs, outputs, ctx, timeoutMs =
|
|
6128
|
+
const { bin, args, inputs, outputs, ctx, timeoutMs = DEFAULT_TIMEOUT_MS2 } = opts;
|
|
5856
6129
|
const tmpDir = await mkdtemp2(path5.join(tmpdir2(), `cli-${bin.replace(/[^a-z0-9]/gi, "")}-`));
|
|
5857
6130
|
try {
|
|
5858
6131
|
const { lookup, stagedInputs, outputPaths } = planPlaceholders(tmpDir, inputs, outputs);
|
|
@@ -8365,6 +8638,7 @@ export {
|
|
|
8365
8638
|
spineInputFlags,
|
|
8366
8639
|
spineInputOps,
|
|
8367
8640
|
elementMentionKeywords,
|
|
8641
|
+
fetchExternalBytes,
|
|
8368
8642
|
toModelSafeImage,
|
|
8369
8643
|
BackendClient2,
|
|
8370
8644
|
Engine2 as Engine,
|
|
@@ -8376,4 +8650,4 @@ export {
|
|
|
8376
8650
|
defaultRegistry,
|
|
8377
8651
|
createEngineFromEnv
|
|
8378
8652
|
};
|
|
8379
|
-
//# sourceMappingURL=chunk-
|
|
8653
|
+
//# sourceMappingURL=chunk-SSDYBIZB.js.map
|