



















@@ -106,6 +106,7 @@ import {
106106getModelsCommandSecretTargetIds,
107107getTtsCommandSecretTargetIds,
108108} from "./command-secret-targets.js";
109+import { parseTimeoutMsWithFallback } from "./parse-timeout.js";
109110import { removeCommandByName } from "./program/command-tree.js";
110111import { collectOption } from "./program/helpers.js";
111112@@ -1179,6 +1180,13 @@ function parseOptionalPositiveInteger(raw: unknown, label: string): number | und
11791180return value;
11801181}
118111821183+function parseOptionalTimeoutMs(raw: string | number | undefined): number | undefined {
1184+if (raw === undefined || (typeof raw === "string" && raw.trim() === "")) {
1185+return undefined;
1186+}
1187+return parseTimeoutMsWithFallback(raw, 0, { invalidType: "error" });
1188+}
1189+11821190function normalizeImageOutputFormat(
11831191raw: string | undefined,
11841192): ImageGenerationOutputFormat | undefined {
@@ -1961,7 +1969,7 @@ export function registerCapabilityCli(program: Command) {
19611969opts.openaiBackground as string | undefined,
19621970"--openai-background",
19631971),
1964-timeoutMs: parseOptionalFiniteNumber(opts.timeoutMs, "--timeout-ms"),
1972+timeoutMs: parseOptionalTimeoutMs(opts.timeoutMs),
19651973output: opts.output as string | undefined,
19661974});
19671975emitJsonOrText(defaultRuntime, Boolean(opts.json), result, formatEnvelopeForText);
@@ -2000,7 +2008,7 @@ export function registerCapabilityCli(program: Command) {
20002008opts.openaiBackground as string | undefined,
20012009"--openai-background",
20022010),
2003-timeoutMs: parseOptionalFiniteNumber(opts.timeoutMs, "--timeout-ms"),
2011+timeoutMs: parseOptionalTimeoutMs(opts.timeoutMs),
20042012output: opts.output as string | undefined,
20052013});
20062014emitJsonOrText(defaultRuntime, Boolean(opts.json), result, formatEnvelopeForText);
@@ -2022,7 +2030,7 @@ export function registerCapabilityCli(program: Command) {
20222030files: [String(opts.file)],
20232031model: opts.model as string | undefined,
20242032prompt: opts.prompt as string | undefined,
2025-timeoutMs: parseOptionalFiniteNumber(opts.timeoutMs, "--timeout-ms"),
2033+timeoutMs: parseOptionalTimeoutMs(opts.timeoutMs),
20262034});
20272035emitJsonOrText(defaultRuntime, Boolean(opts.json), result, formatEnvelopeForText);
20282036});
@@ -2043,7 +2051,7 @@ export function registerCapabilityCli(program: Command) {
20432051files: opts.file as string[],
20442052model: opts.model as string | undefined,
20452053prompt: opts.prompt as string | undefined,
2046-timeoutMs: parseOptionalFiniteNumber(opts.timeoutMs, "--timeout-ms"),
2054+timeoutMs: parseOptionalTimeoutMs(opts.timeoutMs),
20472055});
20482056emitJsonOrText(defaultRuntime, Boolean(opts.json), result, formatEnvelopeForText);
20492057});
@@ -2352,7 +2360,7 @@ export function registerCapabilityCli(program: Command) {
23522360durationSeconds: parseOptionalFiniteNumber(opts.duration, "--duration"),
23532361audio: opts.audio === true ? true : undefined,
23542362watermark: opts.watermark === true ? true : undefined,
2355-timeoutMs: parseOptionalFiniteNumber(opts.timeoutMs, "--timeout-ms"),
2363+timeoutMs: parseOptionalTimeoutMs(opts.timeoutMs),
23562364});
23572365emitJsonOrText(defaultRuntime, Boolean(opts.json), result, formatEnvelopeForText);
23582366});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。