@vm0/cli 9.148.1 → 9.149.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/{chunk-WSZTOGEW.js → chunk-APA2EBPJ.js} +737 -401
- package/{chunk-WSZTOGEW.js.map → chunk-APA2EBPJ.js.map} +1 -1
- package/index.js +22 -15
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +300 -123
- package/zero.js.map +1 -1
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
CONNECTOR_TYPES,
|
|
7
7
|
Command,
|
|
8
8
|
EventRenderer,
|
|
9
|
+
EventStreamNormalizer,
|
|
10
|
+
InvalidArgumentError,
|
|
9
11
|
MODEL_PROVIDER_TYPES,
|
|
10
12
|
Option,
|
|
11
13
|
completePhoneFileUpload,
|
|
@@ -37,6 +39,7 @@ import {
|
|
|
37
39
|
extractSecretNamesFromApis,
|
|
38
40
|
findMatchingPermissions,
|
|
39
41
|
generateWebImage,
|
|
42
|
+
generateWebVideo,
|
|
40
43
|
generateWebVoice,
|
|
41
44
|
getActiveOrg,
|
|
42
45
|
getApiUrl,
|
|
@@ -126,7 +129,7 @@ import {
|
|
|
126
129
|
withErrorHandler,
|
|
127
130
|
zeroAgentCustomSkillNameSchema,
|
|
128
131
|
zeroRemoteAgentCommand
|
|
129
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-APA2EBPJ.js";
|
|
130
133
|
import {
|
|
131
134
|
__toESM,
|
|
132
135
|
init_esm_shims
|
|
@@ -1986,16 +1989,101 @@ async function getPlatformOrigin() {
|
|
|
1986
1989
|
|
|
1987
1990
|
// src/commands/zero/connector/status.ts
|
|
1988
1991
|
var LABEL_WIDTH = 16;
|
|
1989
|
-
function
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1992
|
+
function printConnectorDetails(type, connector) {
|
|
1993
|
+
if (connector) {
|
|
1994
|
+
console.log(
|
|
1995
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${connector.needsReconnect ? source_default.yellow("reconnect needed") : source_default.green("connected")}`
|
|
1996
|
+
);
|
|
1997
|
+
console.log(
|
|
1998
|
+
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
1999
|
+
);
|
|
2000
|
+
console.log(`${"Auth Method:".padEnd(LABEL_WIDTH)}${connector.authMethod}`);
|
|
2001
|
+
if (connector.oauthScopes && connector.oauthScopes.length > 0) {
|
|
2002
|
+
console.log(
|
|
2003
|
+
`${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
|
|
2004
|
+
);
|
|
2005
|
+
}
|
|
2006
|
+
if (connector.authMethod === "oauth" && !hasRequiredScopes(type, connector.oauthScopes)) {
|
|
2007
|
+
const diff = getScopeDiff(type, connector.oauthScopes);
|
|
2008
|
+
console.log(
|
|
2009
|
+
`${"Permissions:".padEnd(LABEL_WIDTH)}${source_default.yellow("update available")}`
|
|
2010
|
+
);
|
|
2011
|
+
if (diff.addedScopes.length > 0) {
|
|
2012
|
+
console.log(
|
|
2013
|
+
`${" Added:".padEnd(LABEL_WIDTH)}${diff.addedScopes.join(", ")}`
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
if (diff.removedScopes.length > 0) {
|
|
2017
|
+
console.log(
|
|
2018
|
+
`${" Removed:".padEnd(LABEL_WIDTH)}${diff.removedScopes.join(", ")}`
|
|
2019
|
+
);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
console.log(
|
|
2023
|
+
`${"Connected:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`
|
|
2024
|
+
);
|
|
2025
|
+
if (connector.updatedAt !== connector.createdAt) {
|
|
2026
|
+
console.log(
|
|
2027
|
+
`${"Last Updated:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.updatedAt)}`
|
|
2028
|
+
);
|
|
2029
|
+
}
|
|
1997
2030
|
} else {
|
|
1998
|
-
console.log(
|
|
2031
|
+
console.log(
|
|
2032
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${source_default.dim("not connected")}`
|
|
2033
|
+
);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
async function printAgentAction(type, connector, agentCtx) {
|
|
2037
|
+
const authorized = agentCtx.authorizedTypes.has(type);
|
|
2038
|
+
const isConnected = connector !== null;
|
|
2039
|
+
const needsReconnect = connector?.needsReconnect === true;
|
|
2040
|
+
const agentLabel = agentCtx.displayName === agentCtx.agentId ? agentCtx.agentId : `${agentCtx.displayName} (${agentCtx.agentId})`;
|
|
2041
|
+
console.log();
|
|
2042
|
+
if (needsReconnect) {
|
|
2043
|
+
const origin = await getPlatformOrigin();
|
|
2044
|
+
const url = `${origin}/connectors`;
|
|
2045
|
+
console.log(
|
|
2046
|
+
`The ${type} connector is connected but needs to be reconnected before agent ${agentLabel} can use it.`
|
|
2047
|
+
);
|
|
2048
|
+
console.log(`Reconnect it at: [Reconnect ${type}](${url})`);
|
|
2049
|
+
} else if (authorized && !isConnected) {
|
|
2050
|
+
const origin = await getPlatformOrigin();
|
|
2051
|
+
const url = `${origin}/connectors/${type}/connect?agentId=${agentCtx.agentId}`;
|
|
2052
|
+
console.log(
|
|
2053
|
+
`The ${type} connector is authorized for agent ${agentLabel}, but it is not connected.`
|
|
2054
|
+
);
|
|
2055
|
+
console.log(`Connect it at: [Connect ${type}](${url})`);
|
|
2056
|
+
} else if (authorized) {
|
|
2057
|
+
console.log(`The ${type} connector is authorized for agent ${agentLabel}.`);
|
|
2058
|
+
} else if (!isConnected) {
|
|
2059
|
+
const origin = await getPlatformOrigin();
|
|
2060
|
+
const url = `${origin}/connectors/${type}/connect?agentId=${agentCtx.agentId}`;
|
|
2061
|
+
console.log(
|
|
2062
|
+
`The ${type} connector is not connected. Once connected, it will be authorized for agent ${agentLabel}.`
|
|
2063
|
+
);
|
|
2064
|
+
console.log(`Connect and authorize it at: [Connect ${type}](${url})`);
|
|
2065
|
+
} else {
|
|
2066
|
+
const origin = await getPlatformOrigin();
|
|
2067
|
+
const url = `${origin}/connectors/${type}/authorize?agentId=${agentCtx.agentId}`;
|
|
2068
|
+
console.log(
|
|
2069
|
+
`The ${type} connector is not authorized for agent ${agentLabel}.`
|
|
2070
|
+
);
|
|
2071
|
+
console.log(`Authorize it at: [Authorize ${type}](${url})`);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
async function printStandaloneAction(type, connector) {
|
|
2075
|
+
if (connector && !connector.needsReconnect) return;
|
|
2076
|
+
const origin = await getPlatformOrigin();
|
|
2077
|
+
console.log();
|
|
2078
|
+
if (connector?.needsReconnect) {
|
|
2079
|
+
const url = `${origin}/connectors`;
|
|
2080
|
+
console.log(
|
|
2081
|
+
`The ${type} connector is connected but needs to be reconnected.`
|
|
2082
|
+
);
|
|
2083
|
+
console.log(`Reconnect it at: [Reconnect ${type}](${url})`);
|
|
2084
|
+
} else {
|
|
2085
|
+
const url = `${origin}/connectors/${type}/connect`;
|
|
2086
|
+
console.log(`Connect it at: [Connect ${type}](${url})`);
|
|
1999
2087
|
}
|
|
2000
2088
|
}
|
|
2001
2089
|
var statusCommand2 = new Command().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").option("--agent <id>", "Show authorization state for the given agent").action(
|
|
@@ -2013,88 +2101,11 @@ var statusCommand2 = new Command().name("status").description("Show detailed sta
|
|
|
2013
2101
|
]);
|
|
2014
2102
|
console.log(`Connector: ${source_default.cyan(type)}`);
|
|
2015
2103
|
console.log();
|
|
2016
|
-
|
|
2017
|
-
console.log(
|
|
2018
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${source_default.green("connected")}`
|
|
2019
|
-
);
|
|
2020
|
-
console.log(
|
|
2021
|
-
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
2022
|
-
);
|
|
2023
|
-
console.log(
|
|
2024
|
-
`${"Auth Method:".padEnd(LABEL_WIDTH)}${connector.authMethod}`
|
|
2025
|
-
);
|
|
2026
|
-
if (connector.oauthScopes && connector.oauthScopes.length > 0) {
|
|
2027
|
-
console.log(
|
|
2028
|
-
`${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
|
|
2029
|
-
);
|
|
2030
|
-
}
|
|
2031
|
-
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
2032
|
-
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
2033
|
-
console.log(
|
|
2034
|
-
`${"Permissions:".padEnd(LABEL_WIDTH)}${source_default.yellow("update available")}`
|
|
2035
|
-
);
|
|
2036
|
-
if (diff.addedScopes.length > 0) {
|
|
2037
|
-
console.log(
|
|
2038
|
-
`${" Added:".padEnd(LABEL_WIDTH)}${diff.addedScopes.join(", ")}`
|
|
2039
|
-
);
|
|
2040
|
-
}
|
|
2041
|
-
if (diff.removedScopes.length > 0) {
|
|
2042
|
-
console.log(
|
|
2043
|
-
`${" Removed:".padEnd(LABEL_WIDTH)}${diff.removedScopes.join(", ")}`
|
|
2044
|
-
);
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
console.log(
|
|
2048
|
-
`${"Connected:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`
|
|
2049
|
-
);
|
|
2050
|
-
if (connector.updatedAt !== connector.createdAt) {
|
|
2051
|
-
console.log(
|
|
2052
|
-
`${"Last Updated:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.updatedAt)}`
|
|
2053
|
-
);
|
|
2054
|
-
}
|
|
2055
|
-
} else {
|
|
2056
|
-
console.log(
|
|
2057
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${source_default.dim("not connected")}`
|
|
2058
|
-
);
|
|
2059
|
-
}
|
|
2104
|
+
printConnectorDetails(parseResult.data, connector);
|
|
2060
2105
|
if (agentCtx) {
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
console.log();
|
|
2065
|
-
if (authorized && !isConnected) {
|
|
2066
|
-
const origin = await getPlatformOrigin();
|
|
2067
|
-
const url = `${origin}/connectors/${parseResult.data}/connect?agentId=${agentCtx.agentId}`;
|
|
2068
|
-
console.log(
|
|
2069
|
-
`The ${parseResult.data} connector is authorized for agent ${agentLabel}, but it is not connected.`
|
|
2070
|
-
);
|
|
2071
|
-
console.log(`Connect it at: [Connect ${parseResult.data}](${url})`);
|
|
2072
|
-
printDoctorHint(parseResult.data);
|
|
2073
|
-
} else if (authorized) {
|
|
2074
|
-
console.log(
|
|
2075
|
-
`The ${parseResult.data} connector is authorized for agent ${agentLabel}.`
|
|
2076
|
-
);
|
|
2077
|
-
} else if (!isConnected) {
|
|
2078
|
-
const origin = await getPlatformOrigin();
|
|
2079
|
-
const url = `${origin}/connectors/${parseResult.data}/connect?agentId=${agentCtx.agentId}`;
|
|
2080
|
-
console.log(
|
|
2081
|
-
`The ${parseResult.data} connector is not connected. Once connected, it will be authorized for agent ${agentLabel}.`
|
|
2082
|
-
);
|
|
2083
|
-
console.log(`Connect it at: [Connect ${parseResult.data}](${url})`);
|
|
2084
|
-
printDoctorHint(parseResult.data);
|
|
2085
|
-
} else {
|
|
2086
|
-
const origin = await getPlatformOrigin();
|
|
2087
|
-
const url = `${origin}/connectors/${parseResult.data}/authorize?agentId=${agentCtx.agentId}`;
|
|
2088
|
-
console.log(
|
|
2089
|
-
`The ${parseResult.data} connector is not authorized for agent ${agentLabel}.`
|
|
2090
|
-
);
|
|
2091
|
-
console.log(
|
|
2092
|
-
`Authorize it at: [Authorize ${parseResult.data}](${url})`
|
|
2093
|
-
);
|
|
2094
|
-
}
|
|
2095
|
-
} else if (!connector) {
|
|
2096
|
-
console.log();
|
|
2097
|
-
printDoctorHint(parseResult.data);
|
|
2106
|
+
await printAgentAction(parseResult.data, connector, agentCtx);
|
|
2107
|
+
} else {
|
|
2108
|
+
await printStandaloneAction(parseResult.data, connector);
|
|
2098
2109
|
}
|
|
2099
2110
|
})
|
|
2100
2111
|
);
|
|
@@ -2520,18 +2531,60 @@ How connectors work:
|
|
|
2520
2531
|
// src/commands/zero/doctor/generate.ts
|
|
2521
2532
|
init_esm_shims();
|
|
2522
2533
|
var BUILT_IN_GENERATION_PROVIDERS = {
|
|
2523
|
-
image:
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2534
|
+
image: [
|
|
2535
|
+
{
|
|
2536
|
+
label: "Built-in",
|
|
2537
|
+
model: "gpt-image-2",
|
|
2538
|
+
command: "zero built-in generate image -h",
|
|
2539
|
+
reason: "available without connector setup"
|
|
2540
|
+
}
|
|
2541
|
+
],
|
|
2542
|
+
video: [
|
|
2543
|
+
{
|
|
2544
|
+
label: "Built-in",
|
|
2545
|
+
model: "fal-ai/veo3.1/fast",
|
|
2546
|
+
command: "zero built-in generate video --model veo3.1-fast -h",
|
|
2547
|
+
reason: "available without connector setup"
|
|
2548
|
+
},
|
|
2549
|
+
{
|
|
2550
|
+
label: "Built-in",
|
|
2551
|
+
model: "fal-ai/veo3.1",
|
|
2552
|
+
command: "zero built-in generate video --model veo3.1 -h",
|
|
2553
|
+
reason: "available without connector setup"
|
|
2554
|
+
},
|
|
2555
|
+
{
|
|
2556
|
+
label: "Built-in",
|
|
2557
|
+
model: "fal-ai/kling-video/o3/standard/text-to-video",
|
|
2558
|
+
command: "zero built-in generate video --model kling-o3-standard -h",
|
|
2559
|
+
reason: "available without connector setup"
|
|
2560
|
+
},
|
|
2561
|
+
{
|
|
2562
|
+
label: "Built-in",
|
|
2563
|
+
model: "fal-ai/kling-video/v3/4k/text-to-video",
|
|
2564
|
+
command: "zero built-in generate video --model kling-v3-4k -h",
|
|
2565
|
+
reason: "available without connector setup"
|
|
2566
|
+
},
|
|
2567
|
+
{
|
|
2568
|
+
label: "Built-in",
|
|
2569
|
+
model: "bytedance/seedance-2.0/text-to-video",
|
|
2570
|
+
command: "zero built-in generate video --model seedance2.0 -h",
|
|
2571
|
+
reason: "available without connector setup"
|
|
2572
|
+
},
|
|
2573
|
+
{
|
|
2574
|
+
label: "Built-in",
|
|
2575
|
+
model: "bytedance/seedance-2.0/fast/text-to-video",
|
|
2576
|
+
command: "zero built-in generate video --model seedance2.0-fast -h",
|
|
2577
|
+
reason: "available without connector setup"
|
|
2578
|
+
}
|
|
2579
|
+
],
|
|
2580
|
+
voice: [
|
|
2581
|
+
{
|
|
2582
|
+
label: "Built-in",
|
|
2583
|
+
model: "gpt-4o-mini-tts",
|
|
2584
|
+
command: "zero built-in generate voice -h",
|
|
2585
|
+
reason: "available without connector setup"
|
|
2586
|
+
}
|
|
2587
|
+
]
|
|
2535
2588
|
};
|
|
2536
2589
|
var GENERATION_TYPE_ORDER = [
|
|
2537
2590
|
"image",
|
|
@@ -2561,6 +2614,9 @@ function getConnectorGenerationType(generationType) {
|
|
|
2561
2614
|
}
|
|
2562
2615
|
return generationType;
|
|
2563
2616
|
}
|
|
2617
|
+
function getBuiltInProviders(generationType) {
|
|
2618
|
+
return BUILT_IN_GENERATION_PROVIDERS[generationType] ?? [];
|
|
2619
|
+
}
|
|
2564
2620
|
function getAvailableGenerationTypes() {
|
|
2565
2621
|
const available = /* @__PURE__ */ new Set();
|
|
2566
2622
|
for (const config of Object.values(CONNECTOR_TYPES)) {
|
|
@@ -2569,7 +2625,7 @@ function getAvailableGenerationTypes() {
|
|
|
2569
2625
|
}
|
|
2570
2626
|
}
|
|
2571
2627
|
return GENERATION_TYPE_ORDER.filter((type) => {
|
|
2572
|
-
return type
|
|
2628
|
+
return getBuiltInProviders(type).length > 0 || available.has(getConnectorGenerationType(type));
|
|
2573
2629
|
});
|
|
2574
2630
|
}
|
|
2575
2631
|
function parseGenerationType(value) {
|
|
@@ -2691,12 +2747,16 @@ function renderActions(candidates) {
|
|
|
2691
2747
|
}
|
|
2692
2748
|
}
|
|
2693
2749
|
function renderBuiltInProvider(generationType) {
|
|
2694
|
-
const
|
|
2695
|
-
if (
|
|
2750
|
+
const providers = getBuiltInProviders(generationType);
|
|
2751
|
+
if (providers.length === 0) return;
|
|
2696
2752
|
console.log("");
|
|
2697
|
-
console.log(
|
|
2698
|
-
|
|
2699
|
-
|
|
2753
|
+
console.log(
|
|
2754
|
+
providers.length === 1 ? "Built-in provider:" : "Built-in providers:"
|
|
2755
|
+
);
|
|
2756
|
+
for (const provider of providers) {
|
|
2757
|
+
console.log(` vm0 ${provider.label} Model: ${provider.model}`);
|
|
2758
|
+
console.log(` Use: ${provider.command}`);
|
|
2759
|
+
}
|
|
2700
2760
|
}
|
|
2701
2761
|
function renderText(params) {
|
|
2702
2762
|
const { generationType, agentId, ready, other, showAll } = params;
|
|
@@ -2769,6 +2829,7 @@ var generateCommand = new Command().name("generate").description("Show generatio
|
|
|
2769
2829
|
const other = candidates.filter((candidate) => {
|
|
2770
2830
|
return candidate.status !== "ready";
|
|
2771
2831
|
});
|
|
2832
|
+
const builtInProviders = getBuiltInProviders(generationType);
|
|
2772
2833
|
if (options.json) {
|
|
2773
2834
|
console.log(
|
|
2774
2835
|
JSON.stringify(
|
|
@@ -2779,7 +2840,8 @@ var generateCommand = new Command().name("generate").description("Show generatio
|
|
|
2779
2840
|
agentId: agentId ?? null,
|
|
2780
2841
|
choices: ready,
|
|
2781
2842
|
otherCandidates: other,
|
|
2782
|
-
builtInProvider:
|
|
2843
|
+
builtInProvider: builtInProviders[0] ?? null,
|
|
2844
|
+
builtInProviders
|
|
2783
2845
|
},
|
|
2784
2846
|
null,
|
|
2785
2847
|
2
|
|
@@ -3038,6 +3100,7 @@ Examples:
|
|
|
3038
3100
|
Check a connector? zero doctor check-connector --env-name GITHUB_TOKEN
|
|
3039
3101
|
Check a URL? zero doctor check-connector --url https://api.github.com/repos/owner/repo
|
|
3040
3102
|
Generate with image? zero doctor generate image
|
|
3103
|
+
Generate with video? zero doctor generate video
|
|
3041
3104
|
Check with permission? zero doctor check-connector --env-name SLACK_TOKEN --check-permission chat:write
|
|
3042
3105
|
Permission denied? zero doctor permission-deny github --method GET --path /repos/owner/repo
|
|
3043
3106
|
Change a permission? zero doctor permission-change github --permission contents:read --enable
|
|
@@ -3215,12 +3278,18 @@ function sleep(ms) {
|
|
|
3215
3278
|
}
|
|
3216
3279
|
async function pollZeroEvents(runId, options) {
|
|
3217
3280
|
const renderer = new EventRenderer({ verbose: options?.verbose });
|
|
3281
|
+
const normalizer = new EventStreamNormalizer();
|
|
3218
3282
|
let lastSequence = -1;
|
|
3219
3283
|
let complete = false;
|
|
3220
3284
|
let result = { succeeded: true, runId };
|
|
3221
3285
|
let terminalRunResponse;
|
|
3222
3286
|
let terminalSeenAt = 0;
|
|
3223
3287
|
let lastTerminalProgressAt = 0;
|
|
3288
|
+
const flushPendingEvents = () => {
|
|
3289
|
+
for (const parsed of normalizer.flush()) {
|
|
3290
|
+
renderer.render(parsed);
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3224
3293
|
while (!complete) {
|
|
3225
3294
|
const eventsResponse = await getZeroRunAgentEvents(runId, {
|
|
3226
3295
|
since: lastSequence,
|
|
@@ -3232,9 +3301,11 @@ async function pollZeroEvents(runId, options) {
|
|
|
3232
3301
|
lastSequence
|
|
3233
3302
|
);
|
|
3234
3303
|
for (const event of contiguousEvents) {
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3237
|
-
|
|
3304
|
+
const parsedEvents = normalizer.process(
|
|
3305
|
+
event.eventData,
|
|
3306
|
+
eventsResponse.framework
|
|
3307
|
+
);
|
|
3308
|
+
for (const parsed of parsedEvents) {
|
|
3238
3309
|
renderer.render(parsed);
|
|
3239
3310
|
}
|
|
3240
3311
|
}
|
|
@@ -3262,6 +3333,7 @@ async function pollZeroEvents(runId, options) {
|
|
|
3262
3333
|
lastTerminalProgressAt,
|
|
3263
3334
|
blockedByGap
|
|
3264
3335
|
)) {
|
|
3336
|
+
flushPendingEvents();
|
|
3265
3337
|
result = renderTerminalRunResult(runId, terminalRunResponse);
|
|
3266
3338
|
complete = true;
|
|
3267
3339
|
}
|
|
@@ -5734,11 +5806,13 @@ Examples:
|
|
|
5734
5806
|
|
|
5735
5807
|
// src/commands/zero/logs/index.ts
|
|
5736
5808
|
var PAGE_LIMIT = 100;
|
|
5737
|
-
function renderAgentEvent(event, renderer, framework) {
|
|
5738
|
-
const
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5809
|
+
function renderAgentEvent(event, renderer, normalizer, framework) {
|
|
5810
|
+
const parsedEvents = normalizer.process(
|
|
5811
|
+
event.eventData,
|
|
5812
|
+
framework,
|
|
5813
|
+
new Date(event.createdAt)
|
|
5814
|
+
);
|
|
5815
|
+
for (const parsed of parsedEvents) {
|
|
5742
5816
|
renderer.render(parsed);
|
|
5743
5817
|
}
|
|
5744
5818
|
}
|
|
@@ -5783,9 +5857,13 @@ async function showAgentEvents(runId, options) {
|
|
|
5783
5857
|
showTimestamp: true,
|
|
5784
5858
|
verbose: true
|
|
5785
5859
|
});
|
|
5860
|
+
const normalizer = new EventStreamNormalizer();
|
|
5786
5861
|
const framework = firstResponse.framework;
|
|
5787
5862
|
for (const event of events) {
|
|
5788
|
-
renderAgentEvent(event, renderer, framework);
|
|
5863
|
+
renderAgentEvent(event, renderer, normalizer, framework);
|
|
5864
|
+
}
|
|
5865
|
+
for (const parsed of normalizer.flush()) {
|
|
5866
|
+
renderer.render(parsed);
|
|
5789
5867
|
}
|
|
5790
5868
|
}
|
|
5791
5869
|
var zeroLogsCommand = new Command().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to view agent events for").addCommand(listCommand12).addCommand(searchCommand2).option(
|
|
@@ -7182,18 +7260,115 @@ var imageCommand = createImageGenerateCommand({
|
|
|
7182
7260
|
Pick size/quality: zero built-in generate image --prompt "A poster" --size 1024x1536 --quality high`
|
|
7183
7261
|
});
|
|
7184
7262
|
|
|
7263
|
+
// src/commands/zero/built-in/generate/video.ts
|
|
7264
|
+
init_esm_shims();
|
|
7265
|
+
|
|
7266
|
+
// src/commands/zero/shared/video-generate.ts
|
|
7267
|
+
init_esm_shims();
|
|
7268
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
7269
|
+
function parseSeed(value) {
|
|
7270
|
+
const seed = Number(value);
|
|
7271
|
+
if (!Number.isInteger(seed) || seed < 0 || !Number.isSafeInteger(seed)) {
|
|
7272
|
+
throw new InvalidArgumentError("seed must be a non-negative safe integer");
|
|
7273
|
+
}
|
|
7274
|
+
return seed;
|
|
7275
|
+
}
|
|
7276
|
+
function readPrompt2(options, usageCommand) {
|
|
7277
|
+
if (options.prompt?.trim()) {
|
|
7278
|
+
return options.prompt.trim();
|
|
7279
|
+
}
|
|
7280
|
+
if (process.stdin.isTTY === false) {
|
|
7281
|
+
const prompt = readFileSync13("/dev/stdin", "utf8").trim();
|
|
7282
|
+
if (prompt.length > 0) {
|
|
7283
|
+
return prompt;
|
|
7284
|
+
}
|
|
7285
|
+
}
|
|
7286
|
+
throw new Error("--prompt is required", {
|
|
7287
|
+
cause: new Error(`Usage: ${usageCommand} --prompt "A cinematic city shot"`)
|
|
7288
|
+
});
|
|
7289
|
+
}
|
|
7290
|
+
function createVideoGenerateCommand(config) {
|
|
7291
|
+
return new Command().name(config.name).description("Generate a billed video file from a prompt").option("--prompt <text>", "Video prompt; can also be piped via stdin").option(
|
|
7292
|
+
"--model <model>",
|
|
7293
|
+
"Model: veo3.1-fast, veo3.1, kling-o3-standard, kling-v3-4k, seedance2.0, or seedance2.0-fast",
|
|
7294
|
+
"veo3.1-fast"
|
|
7295
|
+
).option(
|
|
7296
|
+
"--aspect-ratio <ratio>",
|
|
7297
|
+
"Aspect ratio: 16:9 or 9:16; Seedance also supports 21:9, 4:3, 1:1, 3:4",
|
|
7298
|
+
"16:9"
|
|
7299
|
+
).option(
|
|
7300
|
+
"--duration <duration>",
|
|
7301
|
+
"Duration: 3s-15s; Veo supports 4s/6s/8s",
|
|
7302
|
+
"8s"
|
|
7303
|
+
).option("--resolution <resolution>", "Resolution: 720p, 1080p, or 4k").option("--no-audio", "Generate a silent video").option("--negative-prompt <text>", "Negative prompt").option("--seed <integer>", "Deterministic seed", parseSeed).option("--no-auto-fix", "Disable fal prompt auto-fix").option("--safety-tolerance <level>", "Safety tolerance: 1-6", "4").option("--json", "Print metadata as JSON").addHelpText(
|
|
7304
|
+
"after",
|
|
7305
|
+
`
|
|
7306
|
+
Examples:
|
|
7307
|
+
${config.examples}
|
|
7308
|
+
|
|
7309
|
+
Output:
|
|
7310
|
+
Prints the generated /f/ video file URL and metadata
|
|
7311
|
+
|
|
7312
|
+
Notes:
|
|
7313
|
+
- Authenticates via ZERO_TOKEN (requires file:write capability)
|
|
7314
|
+
- Charges org credits after successful video generation
|
|
7315
|
+
- Uses fal video models with configured usage pricing`
|
|
7316
|
+
).action(
|
|
7317
|
+
withErrorHandler(async (options) => {
|
|
7318
|
+
const prompt = readPrompt2(options, config.usageCommand);
|
|
7319
|
+
const result = await generateWebVideo({
|
|
7320
|
+
prompt,
|
|
7321
|
+
model: options.model,
|
|
7322
|
+
aspectRatio: options.aspectRatio,
|
|
7323
|
+
duration: options.duration,
|
|
7324
|
+
resolution: options.resolution,
|
|
7325
|
+
generateAudio: options.audio !== false,
|
|
7326
|
+
negativePrompt: options.negativePrompt,
|
|
7327
|
+
seed: options.seed,
|
|
7328
|
+
autoFix: options.autoFix !== false,
|
|
7329
|
+
safetyTolerance: options.safetyTolerance
|
|
7330
|
+
});
|
|
7331
|
+
if (options.json) {
|
|
7332
|
+
console.log(JSON.stringify(result));
|
|
7333
|
+
return;
|
|
7334
|
+
}
|
|
7335
|
+
console.log(source_default.green(`\u2713 Video generated: ${result.url}`));
|
|
7336
|
+
console.log(source_default.dim(` File: ${result.filename}`));
|
|
7337
|
+
console.log(source_default.dim(` Duration: ${result.duration}`));
|
|
7338
|
+
console.log(source_default.dim(` Resolution: ${result.resolution}`));
|
|
7339
|
+
console.log(source_default.dim(` Aspect ratio: ${result.aspectRatio}`));
|
|
7340
|
+
console.log(
|
|
7341
|
+
source_default.dim(` Audio: ${result.generateAudio ? "on" : "off"}`)
|
|
7342
|
+
);
|
|
7343
|
+
console.log(source_default.dim(` Credits charged: ${result.creditsCharged}`));
|
|
7344
|
+
console.log(source_default.dim(` Model: ${result.model}`));
|
|
7345
|
+
})
|
|
7346
|
+
);
|
|
7347
|
+
}
|
|
7348
|
+
|
|
7349
|
+
// src/commands/zero/built-in/generate/video.ts
|
|
7350
|
+
var videoCommand = createVideoGenerateCommand({
|
|
7351
|
+
name: "video",
|
|
7352
|
+
usageCommand: "zero built-in generate video",
|
|
7353
|
+
examples: ` Generate video: zero built-in generate video --prompt "A tracking shot through a neon market"
|
|
7354
|
+
Pipe prompt: cat prompt.txt | zero built-in generate video
|
|
7355
|
+
Use Kling: zero built-in generate video --model kling-o3-standard --prompt "A product reveal" --duration 10s
|
|
7356
|
+
Use Seedance: zero built-in generate video --model seedance2.0-fast --prompt "A multi-shot chase scene" --duration 8s --resolution 480p
|
|
7357
|
+
Use Veo 3.1: zero built-in generate video --model veo3.1 --prompt "A cinematic product reveal" --duration 6s --resolution 1080p`
|
|
7358
|
+
});
|
|
7359
|
+
|
|
7185
7360
|
// src/commands/zero/built-in/generate/voice.ts
|
|
7186
7361
|
init_esm_shims();
|
|
7187
7362
|
|
|
7188
7363
|
// src/commands/zero/shared/voice-generate.ts
|
|
7189
7364
|
init_esm_shims();
|
|
7190
|
-
import { readFileSync as
|
|
7365
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
7191
7366
|
function readText(options, usageCommand) {
|
|
7192
7367
|
if (options.text?.trim()) {
|
|
7193
7368
|
return options.text.trim();
|
|
7194
7369
|
}
|
|
7195
7370
|
if (process.stdin.isTTY === false) {
|
|
7196
|
-
const text =
|
|
7371
|
+
const text = readFileSync14("/dev/stdin", "utf8").trim();
|
|
7197
7372
|
if (text.length > 0) {
|
|
7198
7373
|
return text;
|
|
7199
7374
|
}
|
|
@@ -7248,11 +7423,12 @@ var voiceCommand = createVoiceGenerateCommand({
|
|
|
7248
7423
|
});
|
|
7249
7424
|
|
|
7250
7425
|
// src/commands/zero/built-in/generate/index.ts
|
|
7251
|
-
var generateCommand2 = new Command().name("generate").description("Generate assets with built-in vm0 services").addCommand(imageCommand).addCommand(voiceCommand).addHelpText(
|
|
7426
|
+
var generateCommand2 = new Command().name("generate").description("Generate assets with built-in vm0 services").addCommand(imageCommand).addCommand(videoCommand).addCommand(voiceCommand).addHelpText(
|
|
7252
7427
|
"after",
|
|
7253
7428
|
`
|
|
7254
7429
|
Examples:
|
|
7255
7430
|
Generate image: zero built-in generate image --prompt "A watercolor fox"
|
|
7431
|
+
Generate video: zero built-in generate video --prompt "A cinematic city shot"
|
|
7256
7432
|
Generate speech: zero built-in generate voice --text "Hello"`
|
|
7257
7433
|
);
|
|
7258
7434
|
|
|
@@ -7262,6 +7438,7 @@ var zeroBuiltInCommand = new Command().name("built-in").description("Use built-i
|
|
|
7262
7438
|
`
|
|
7263
7439
|
Examples:
|
|
7264
7440
|
Generate image: zero built-in generate image --prompt "A watercolor fox"
|
|
7441
|
+
Generate video: zero built-in generate video --prompt "A cinematic city shot"
|
|
7265
7442
|
Generate speech: zero built-in generate voice --text "Hello"`
|
|
7266
7443
|
);
|
|
7267
7444
|
|
|
@@ -7419,7 +7596,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
7419
7596
|
var program = new Command();
|
|
7420
7597
|
program.name("zero").description(
|
|
7421
7598
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
7422
|
-
).version("9.
|
|
7599
|
+
).version("9.149.0").addHelpText(
|
|
7423
7600
|
"after",
|
|
7424
7601
|
`
|
|
7425
7602
|
Examples:
|