@vm0/cli 9.142.0 → 9.143.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-OD6W3UMZ.js → chunk-FEQSPUBX.js} +121 -31
- package/{chunk-OD6W3UMZ.js.map → chunk-FEQSPUBX.js.map} +1 -1
- package/index.js +11 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +168 -76
- package/zero.js.map +1 -1
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
upsertZeroOrgModelProvider,
|
|
128
128
|
withErrorHandler,
|
|
129
129
|
zeroAgentCustomSkillNameSchema
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-FEQSPUBX.js";
|
|
131
131
|
import {
|
|
132
132
|
__toESM,
|
|
133
133
|
init_esm_shims
|
|
@@ -2192,6 +2192,18 @@ async function getPlatformOrigin() {
|
|
|
2192
2192
|
|
|
2193
2193
|
// src/commands/zero/connector/status.ts
|
|
2194
2194
|
var LABEL_WIDTH = 16;
|
|
2195
|
+
function getDoctorCommand(type) {
|
|
2196
|
+
const [envName] = Object.keys(getConnectorEnvironmentMapping(type));
|
|
2197
|
+
return envName ? `zero doctor check-connector --env-name ${envName}` : null;
|
|
2198
|
+
}
|
|
2199
|
+
function printDoctorHint(type) {
|
|
2200
|
+
const command = getDoctorCommand(type);
|
|
2201
|
+
if (command) {
|
|
2202
|
+
console.log(`Diagnose it with: ${command}`);
|
|
2203
|
+
} else {
|
|
2204
|
+
console.log("Having trouble? Run: zero doctor --help");
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2195
2207
|
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(
|
|
2196
2208
|
withErrorHandler(async (type, options) => {
|
|
2197
2209
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
@@ -2256,7 +2268,15 @@ var statusCommand2 = new Command().name("status").description("Show detailed sta
|
|
|
2256
2268
|
const isConnected = connector !== null;
|
|
2257
2269
|
const agentLabel = agentCtx.displayName === agentCtx.agentId ? agentCtx.agentId : `${agentCtx.displayName} (${agentCtx.agentId})`;
|
|
2258
2270
|
console.log();
|
|
2259
|
-
if (authorized) {
|
|
2271
|
+
if (authorized && !isConnected) {
|
|
2272
|
+
const origin = await getPlatformOrigin();
|
|
2273
|
+
const url = `${origin}/connectors/${parseResult.data}/connect?agentId=${agentCtx.agentId}`;
|
|
2274
|
+
console.log(
|
|
2275
|
+
`The ${parseResult.data} connector is authorized for agent ${agentLabel}, but it is not connected.`
|
|
2276
|
+
);
|
|
2277
|
+
console.log(`Connect it at: [Connect ${parseResult.data}](${url})`);
|
|
2278
|
+
printDoctorHint(parseResult.data);
|
|
2279
|
+
} else if (authorized) {
|
|
2260
2280
|
console.log(
|
|
2261
2281
|
`The ${parseResult.data} connector is authorized for agent ${agentLabel}.`
|
|
2262
2282
|
);
|
|
@@ -2267,6 +2287,7 @@ var statusCommand2 = new Command().name("status").description("Show detailed sta
|
|
|
2267
2287
|
`The ${parseResult.data} connector is not connected. Once connected, it will be authorized for agent ${agentLabel}.`
|
|
2268
2288
|
);
|
|
2269
2289
|
console.log(`Connect it at: [Connect ${parseResult.data}](${url})`);
|
|
2290
|
+
printDoctorHint(parseResult.data);
|
|
2270
2291
|
} else {
|
|
2271
2292
|
const origin = await getPlatformOrigin();
|
|
2272
2293
|
const url = `${origin}/connectors/${parseResult.data}/authorize?agentId=${agentCtx.agentId}`;
|
|
@@ -2277,6 +2298,9 @@ var statusCommand2 = new Command().name("status").description("Show detailed sta
|
|
|
2277
2298
|
`Authorize it at: [Authorize ${parseResult.data}](${url})`
|
|
2278
2299
|
);
|
|
2279
2300
|
}
|
|
2301
|
+
} else if (!connector) {
|
|
2302
|
+
console.log();
|
|
2303
|
+
printDoctorHint(parseResult.data);
|
|
2280
2304
|
}
|
|
2281
2305
|
})
|
|
2282
2306
|
);
|
|
@@ -2358,7 +2382,10 @@ async function checkConnectorStatus(ctx) {
|
|
|
2358
2382
|
console.log("");
|
|
2359
2383
|
if (!isConnected) {
|
|
2360
2384
|
console.log(`The ${ctx.label} connector is not connected.`);
|
|
2361
|
-
if (
|
|
2385
|
+
if (ctx.agentId && hasPermission) {
|
|
2386
|
+
const connectUrl = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/connect?agentId=${ctx.agentId}`;
|
|
2387
|
+
console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);
|
|
2388
|
+
} else if (!ctx.agentId) {
|
|
2362
2389
|
const connectUrl = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/connect`;
|
|
2363
2390
|
console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);
|
|
2364
2391
|
}
|
|
@@ -2383,7 +2410,9 @@ async function checkConnectorStatus(ctx) {
|
|
|
2383
2410
|
`Skipped \u2014 agent authorization can only be checked once the ${ctx.label} connector is reconnected (see 2a).`
|
|
2384
2411
|
);
|
|
2385
2412
|
} else if (hasPermission) {
|
|
2386
|
-
console.log(
|
|
2413
|
+
console.log(
|
|
2414
|
+
isConnected ? `The ${ctx.label} connector is authorized for this agent.` : `The ${ctx.label} connector is authorized for this agent, but it is not connected.`
|
|
2415
|
+
);
|
|
2387
2416
|
} else {
|
|
2388
2417
|
const url = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/authorize?agentId=${ctx.agentId}`;
|
|
2389
2418
|
console.log(
|
|
@@ -2696,10 +2725,16 @@ How connectors work:
|
|
|
2696
2725
|
|
|
2697
2726
|
// src/commands/zero/doctor/generate.ts
|
|
2698
2727
|
init_esm_shims();
|
|
2728
|
+
var BUILT_IN_GENERATION_OPTIONS = {
|
|
2729
|
+
voice: {
|
|
2730
|
+
description: "If the user did not explicitly request a specific connector or provider, you can use the official generation capability. Run `zero official generate voice -h` for options."
|
|
2731
|
+
}
|
|
2732
|
+
};
|
|
2699
2733
|
var GENERATION_TYPE_ORDER = [
|
|
2700
2734
|
"image",
|
|
2701
2735
|
"video",
|
|
2702
2736
|
"audio",
|
|
2737
|
+
"voice",
|
|
2703
2738
|
"text",
|
|
2704
2739
|
"code",
|
|
2705
2740
|
"document",
|
|
@@ -2714,8 +2749,15 @@ var GENERATION_TYPE_LABELS = {
|
|
|
2714
2749
|
presentation: "Presentation",
|
|
2715
2750
|
text: "Text",
|
|
2716
2751
|
video: "Video",
|
|
2752
|
+
voice: "Voice",
|
|
2717
2753
|
website: "Website"
|
|
2718
2754
|
};
|
|
2755
|
+
function getConnectorGenerationType(generationType) {
|
|
2756
|
+
if (generationType === "voice") {
|
|
2757
|
+
return "audio";
|
|
2758
|
+
}
|
|
2759
|
+
return generationType;
|
|
2760
|
+
}
|
|
2719
2761
|
function getAvailableGenerationTypes() {
|
|
2720
2762
|
const available = /* @__PURE__ */ new Set();
|
|
2721
2763
|
for (const config of Object.values(CONNECTOR_TYPES)) {
|
|
@@ -2724,7 +2766,7 @@ function getAvailableGenerationTypes() {
|
|
|
2724
2766
|
}
|
|
2725
2767
|
}
|
|
2726
2768
|
return GENERATION_TYPE_ORDER.filter((type) => {
|
|
2727
|
-
return available.has(type);
|
|
2769
|
+
return type in BUILT_IN_GENERATION_OPTIONS || available.has(getConnectorGenerationType(type));
|
|
2728
2770
|
});
|
|
2729
2771
|
}
|
|
2730
2772
|
function parseGenerationType(value) {
|
|
@@ -2845,6 +2887,13 @@ function renderActions(candidates) {
|
|
|
2845
2887
|
console.log(` [${candidate.actionLabel}](${candidate.actionUrl})`);
|
|
2846
2888
|
}
|
|
2847
2889
|
}
|
|
2890
|
+
function renderBuiltInOption(generationType) {
|
|
2891
|
+
const option = BUILT_IN_GENERATION_OPTIONS[generationType];
|
|
2892
|
+
if (!option) return;
|
|
2893
|
+
console.log("");
|
|
2894
|
+
console.log("Fallback option:");
|
|
2895
|
+
console.log(` ${option.description}`);
|
|
2896
|
+
}
|
|
2848
2897
|
function renderText(params) {
|
|
2849
2898
|
const { generationType, agentId, ready, other, showAll } = params;
|
|
2850
2899
|
const label = GENERATION_TYPE_LABELS[generationType];
|
|
@@ -2865,6 +2914,7 @@ function renderText(params) {
|
|
|
2865
2914
|
} else {
|
|
2866
2915
|
console.log(`No ready ${generationType} generation connectors found.`);
|
|
2867
2916
|
}
|
|
2917
|
+
renderBuiltInOption(generationType);
|
|
2868
2918
|
if (showAll && other.length > 0) {
|
|
2869
2919
|
console.log("");
|
|
2870
2920
|
console.log(`Other ${generationType} generation connectors`);
|
|
@@ -2881,6 +2931,7 @@ var generateCommand = new Command().name("generate").description("Show generatio
|
|
|
2881
2931
|
).option("--all", "Also show unavailable or not-yet-authorized connectors").option("--json", "Output machine-readable JSON").action(
|
|
2882
2932
|
withErrorHandler(async (type, options) => {
|
|
2883
2933
|
const generationType = parseGenerationType(type);
|
|
2934
|
+
const connectorGenerationType = getConnectorGenerationType(generationType);
|
|
2884
2935
|
const agentId = process.env.ZERO_AGENT_ID;
|
|
2885
2936
|
const [connectorList, enabledTypes, platformOrigin] = await Promise.all([
|
|
2886
2937
|
listZeroConnectors(),
|
|
@@ -2894,7 +2945,7 @@ var generateCommand = new Command().name("generate").description("Show generatio
|
|
|
2894
2945
|
);
|
|
2895
2946
|
const configuredTypes = new Set(connectorList.configuredTypes);
|
|
2896
2947
|
const authorizedTypes = enabledTypes ? new Set(enabledTypes) : null;
|
|
2897
|
-
const candidates = getGenerationConnectors(
|
|
2948
|
+
const candidates = getGenerationConnectors(connectorGenerationType).map(
|
|
2898
2949
|
([connectorType, config]) => {
|
|
2899
2950
|
return toCandidate({
|
|
2900
2951
|
type: connectorType,
|
|
@@ -2918,10 +2969,12 @@ var generateCommand = new Command().name("generate").description("Show generatio
|
|
|
2918
2969
|
JSON.stringify(
|
|
2919
2970
|
{
|
|
2920
2971
|
generationType,
|
|
2972
|
+
connectorGenerationType,
|
|
2921
2973
|
availableTypes: getAvailableGenerationTypes(),
|
|
2922
2974
|
agentId: agentId ?? null,
|
|
2923
2975
|
choices: ready,
|
|
2924
|
-
otherCandidates: other
|
|
2976
|
+
otherCandidates: other,
|
|
2977
|
+
builtInOption: BUILT_IN_GENERATION_OPTIONS[generationType] ?? null
|
|
2925
2978
|
},
|
|
2926
2979
|
null,
|
|
2927
2980
|
2
|
|
@@ -5518,7 +5571,7 @@ function formatStatus(status) {
|
|
|
5518
5571
|
function formatTime(iso) {
|
|
5519
5572
|
return new Date(iso).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
5520
5573
|
}
|
|
5521
|
-
var listCommand12 = new Command().name("list").alias("ls").description("List agent run logs").option("--agent <
|
|
5574
|
+
var listCommand12 = new Command().name("list").alias("ls").description("List agent run logs").option("--agent <id>", "Filter by Zero agent ID").option(
|
|
5522
5575
|
"--status <status>",
|
|
5523
5576
|
"Filter by status (queued|pending|running|completed|failed|timeout|cancelled)"
|
|
5524
5577
|
).option(
|
|
@@ -5529,7 +5582,7 @@ var listCommand12 = new Command().name("list").alias("ls").description("List age
|
|
|
5529
5582
|
`
|
|
5530
5583
|
Examples:
|
|
5531
5584
|
zero logs list
|
|
5532
|
-
zero logs list --agent
|
|
5585
|
+
zero logs list --agent 123e4567-e89b-12d3-a456-426614174000
|
|
5533
5586
|
zero logs list --status completed --limit 10
|
|
5534
5587
|
zero logs list --since 1h
|
|
5535
5588
|
zero logs list --since 1d --status completed`
|
|
@@ -5539,7 +5592,7 @@ Examples:
|
|
|
5539
5592
|
const limit = options.limit ? parseInt(options.limit, 10) : void 0;
|
|
5540
5593
|
const since = options.since ? parseTime(options.since) : void 0;
|
|
5541
5594
|
const result = await listZeroLogs({
|
|
5542
|
-
|
|
5595
|
+
agentId: options.agent,
|
|
5543
5596
|
status: options.status,
|
|
5544
5597
|
since,
|
|
5545
5598
|
limit
|
|
@@ -5685,7 +5738,7 @@ async function runLogsSearch(keyword, options) {
|
|
|
5685
5738
|
const limit = parseLimit2(options.limit);
|
|
5686
5739
|
const response = await searchZeroLogs({
|
|
5687
5740
|
keyword,
|
|
5688
|
-
|
|
5741
|
+
agentId: options.agentId,
|
|
5689
5742
|
runId: options.run,
|
|
5690
5743
|
since,
|
|
5691
5744
|
limit,
|
|
@@ -5703,17 +5756,20 @@ async function runLogsSearch(keyword, options) {
|
|
|
5703
5756
|
}
|
|
5704
5757
|
renderResults(response);
|
|
5705
5758
|
}
|
|
5706
|
-
var searchCommand2 = new Command().name("search").description("Search agent events across runs").argument("<keyword>", "Search keyword").option("-A, --after-context <n>", "Show n events after each match").option("-B, --before-context <n>", "Show n events before each match").option("-C, --context <n>", "Show n events before and after each match").option("--agent <
|
|
5759
|
+
var searchCommand2 = new Command().name("search").description("Search agent events across runs").argument("<keyword>", "Search keyword").option("-A, --after-context <n>", "Show n events after each match").option("-B, --before-context <n>", "Show n events before each match").option("-C, --context <n>", "Show n events before and after each match").option("--agent <id>", "Filter by Zero agent ID").option("--run <id>", "Filter by specific run ID").option("--since <time>", "Search logs since (default: 7d)").option("--limit <n>", "Maximum number of matches (default: 20)").addHelpText(
|
|
5707
5760
|
"after",
|
|
5708
5761
|
`
|
|
5709
5762
|
Examples:
|
|
5710
5763
|
zero logs search "error"
|
|
5711
|
-
zero logs search "timeout" --agent
|
|
5764
|
+
zero logs search "timeout" --agent 123e4567-e89b-12d3-a456-426614174000 -C 2
|
|
5712
5765
|
zero logs search "failed" --since 30d --limit 50`
|
|
5713
5766
|
).action(
|
|
5714
|
-
withErrorHandler(
|
|
5715
|
-
|
|
5716
|
-
|
|
5767
|
+
withErrorHandler(
|
|
5768
|
+
async (keyword, options) => {
|
|
5769
|
+
const { agent, ...searchOptions } = options;
|
|
5770
|
+
await runLogsSearch(keyword, { ...searchOptions, agentId: agent });
|
|
5771
|
+
}
|
|
5772
|
+
)
|
|
5717
5773
|
);
|
|
5718
5774
|
|
|
5719
5775
|
// src/commands/zero/logs/index.ts
|
|
@@ -5891,7 +5947,7 @@ async function runLogsSource(query, options) {
|
|
|
5891
5947
|
afterContext: options.afterContext,
|
|
5892
5948
|
beforeContext: options.beforeContext,
|
|
5893
5949
|
context: options.context,
|
|
5894
|
-
|
|
5950
|
+
agentId: options.agent,
|
|
5895
5951
|
run: options.run,
|
|
5896
5952
|
since: options.since,
|
|
5897
5953
|
limit: options.limit
|
|
@@ -5943,7 +5999,7 @@ async function runChatSource(query, options) {
|
|
|
5943
5999
|
const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS2;
|
|
5944
6000
|
const response = await searchZeroChat({
|
|
5945
6001
|
keyword: query,
|
|
5946
|
-
|
|
6002
|
+
agentId: options.agent,
|
|
5947
6003
|
since,
|
|
5948
6004
|
limit,
|
|
5949
6005
|
before,
|
|
@@ -5968,7 +6024,7 @@ var zeroSearchCommand = new Command().name("search").description("Search logs, c
|
|
|
5968
6024
|
"Source to search: logs | chat | slack (pass once)",
|
|
5969
6025
|
collectSource,
|
|
5970
6026
|
[]
|
|
5971
|
-
).option("--agent <
|
|
6027
|
+
).option("--agent <id>", "Filter by Zero agent ID").option("--run <id>", "Filter by run ID").option("--since <time>", "Time window (e.g., 7d, 2h)").option("--limit <n>", "Maximum number of matches").option("-A, --after-context <n>", "Show n items after each match").option("-B, --before-context <n>", "Show n items before each match").option("-C, --context <n>", "Show n items before and after each match").addHelpText("after", SEARCH_EXPLAINER).action(
|
|
5972
6028
|
withErrorHandler(async (query, options) => {
|
|
5973
6029
|
const sources = options.source;
|
|
5974
6030
|
if (sources.length === 0) {
|
|
@@ -7071,6 +7127,93 @@ Examples:
|
|
|
7071
7127
|
);
|
|
7072
7128
|
var zeroComputerUseCommand = new Command().name("computer-use").description("Remote desktop control for cloud agents").addCommand(hostCommand).addCommand(clientCommand);
|
|
7073
7129
|
|
|
7130
|
+
// src/commands/zero/official/index.ts
|
|
7131
|
+
init_esm_shims();
|
|
7132
|
+
|
|
7133
|
+
// src/commands/zero/official/generate/index.ts
|
|
7134
|
+
init_esm_shims();
|
|
7135
|
+
|
|
7136
|
+
// src/commands/zero/official/generate/voice.ts
|
|
7137
|
+
init_esm_shims();
|
|
7138
|
+
|
|
7139
|
+
// src/commands/zero/shared/voice-generate.ts
|
|
7140
|
+
init_esm_shims();
|
|
7141
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
7142
|
+
function readText(options, usageCommand) {
|
|
7143
|
+
if (options.text?.trim()) {
|
|
7144
|
+
return options.text.trim();
|
|
7145
|
+
}
|
|
7146
|
+
if (process.stdin.isTTY === false) {
|
|
7147
|
+
const text = readFileSync10("/dev/stdin", "utf8").trim();
|
|
7148
|
+
if (text.length > 0) {
|
|
7149
|
+
return text;
|
|
7150
|
+
}
|
|
7151
|
+
}
|
|
7152
|
+
throw new Error("--text is required", {
|
|
7153
|
+
cause: new Error(`Usage: ${usageCommand} --text "Hello"`)
|
|
7154
|
+
});
|
|
7155
|
+
}
|
|
7156
|
+
function createVoiceGenerateCommand(config) {
|
|
7157
|
+
return new Command().name(config.name).description("Generate a billed speech audio file from text").option("--text <text>", "Text to speak; can also be piped via stdin").option("--voice <voice>", "OpenAI voice to use", "marin").option("--instructions <text>", "Voice style instructions").option("--json", "Print metadata as JSON").addHelpText(
|
|
7158
|
+
"after",
|
|
7159
|
+
`
|
|
7160
|
+
Examples:
|
|
7161
|
+
${config.examples}
|
|
7162
|
+
|
|
7163
|
+
Output:
|
|
7164
|
+
Prints the generated /f/ audio file URL and metadata
|
|
7165
|
+
|
|
7166
|
+
Notes:
|
|
7167
|
+
- Authenticates via ZERO_TOKEN (requires file:write capability)
|
|
7168
|
+
- Charges org credits after successful audio generation
|
|
7169
|
+
- Uses gpt-4o-mini-tts with WAV output`
|
|
7170
|
+
).action(
|
|
7171
|
+
withErrorHandler(async (options) => {
|
|
7172
|
+
const text = readText(options, config.usageCommand);
|
|
7173
|
+
const result = await generateWebVoice({
|
|
7174
|
+
text,
|
|
7175
|
+
voice: options.voice,
|
|
7176
|
+
instructions: options.instructions
|
|
7177
|
+
});
|
|
7178
|
+
if (options.json) {
|
|
7179
|
+
console.log(JSON.stringify(result));
|
|
7180
|
+
return;
|
|
7181
|
+
}
|
|
7182
|
+
console.log(source_default.green(`\u2713 Voice generated: ${result.url}`));
|
|
7183
|
+
console.log(source_default.dim(` File: ${result.filename}`));
|
|
7184
|
+
console.log(source_default.dim(` Duration: ${result.durationSeconds}s`));
|
|
7185
|
+
console.log(source_default.dim(` Credits charged: ${result.creditsCharged}`));
|
|
7186
|
+
console.log(source_default.dim(` Model: ${result.model}`));
|
|
7187
|
+
console.log(source_default.dim(` Voice: ${result.voice}`));
|
|
7188
|
+
})
|
|
7189
|
+
);
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
// src/commands/zero/official/generate/voice.ts
|
|
7193
|
+
var voiceCommand = createVoiceGenerateCommand({
|
|
7194
|
+
name: "voice",
|
|
7195
|
+
usageCommand: "zero official generate voice",
|
|
7196
|
+
examples: ` Generate speech: zero official generate voice --text "Hello from vm0"
|
|
7197
|
+
Pipe text: cat script.txt | zero official generate voice
|
|
7198
|
+
Pick a voice: zero official generate voice --text "Ship it" --voice cedar`
|
|
7199
|
+
});
|
|
7200
|
+
|
|
7201
|
+
// src/commands/zero/official/generate/index.ts
|
|
7202
|
+
var generateCommand2 = new Command().name("generate").description("Generate assets with official Zero services").addCommand(voiceCommand).addHelpText(
|
|
7203
|
+
"after",
|
|
7204
|
+
`
|
|
7205
|
+
Examples:
|
|
7206
|
+
Generate speech: zero official generate voice --text "Hello"`
|
|
7207
|
+
);
|
|
7208
|
+
|
|
7209
|
+
// src/commands/zero/official/index.ts
|
|
7210
|
+
var zeroOfficialCommand = new Command().name("official").description("Use official Zero services").addCommand(generateCommand2).addHelpText(
|
|
7211
|
+
"after",
|
|
7212
|
+
`
|
|
7213
|
+
Examples:
|
|
7214
|
+
Generate speech: zero official generate voice --text "Hello"`
|
|
7215
|
+
);
|
|
7216
|
+
|
|
7074
7217
|
// src/commands/zero/web/index.ts
|
|
7075
7218
|
init_esm_shims();
|
|
7076
7219
|
|
|
@@ -7148,67 +7291,13 @@ Notes:
|
|
|
7148
7291
|
)
|
|
7149
7292
|
);
|
|
7150
7293
|
|
|
7151
|
-
// src/commands/zero/web/voice.ts
|
|
7152
|
-
init_esm_shims();
|
|
7153
|
-
import { readFileSync as readFileSync10 } from "fs";
|
|
7154
|
-
function readText(options) {
|
|
7155
|
-
if (options.text?.trim()) {
|
|
7156
|
-
return options.text.trim();
|
|
7157
|
-
}
|
|
7158
|
-
if (process.stdin.isTTY === false) {
|
|
7159
|
-
const text = readFileSync10("/dev/stdin", "utf8").trim();
|
|
7160
|
-
if (text.length > 0) {
|
|
7161
|
-
return text;
|
|
7162
|
-
}
|
|
7163
|
-
}
|
|
7164
|
-
throw new Error("--text is required", {
|
|
7165
|
-
cause: new Error('Usage: zero web voice --text "Hello"')
|
|
7166
|
-
});
|
|
7167
|
-
}
|
|
7168
|
-
var voiceCommand = new Command().name("voice").description("Generate a billed speech audio file from text").option("--text <text>", "Text to speak; can also be piped via stdin").option("--voice <voice>", "OpenAI voice to use", "marin").option("--instructions <text>", "Voice style instructions").option("--json", "Print metadata as JSON").addHelpText(
|
|
7169
|
-
"after",
|
|
7170
|
-
`
|
|
7171
|
-
Examples:
|
|
7172
|
-
Generate speech: zero web voice --text "Hello from vm0"
|
|
7173
|
-
Pipe text: cat script.txt | zero web voice
|
|
7174
|
-
Pick a voice: zero web voice --text "Ship it" --voice cedar
|
|
7175
|
-
|
|
7176
|
-
Output:
|
|
7177
|
-
Prints the generated /f/ audio file URL and metadata
|
|
7178
|
-
|
|
7179
|
-
Notes:
|
|
7180
|
-
- Authenticates via ZERO_TOKEN (requires file:write capability)
|
|
7181
|
-
- Charges org credits after successful audio generation
|
|
7182
|
-
- Uses gpt-4o-mini-tts with WAV output`
|
|
7183
|
-
).action(
|
|
7184
|
-
withErrorHandler(async (options) => {
|
|
7185
|
-
const text = readText(options);
|
|
7186
|
-
const result = await generateWebVoice({
|
|
7187
|
-
text,
|
|
7188
|
-
voice: options.voice,
|
|
7189
|
-
instructions: options.instructions
|
|
7190
|
-
});
|
|
7191
|
-
if (options.json) {
|
|
7192
|
-
console.log(JSON.stringify(result));
|
|
7193
|
-
return;
|
|
7194
|
-
}
|
|
7195
|
-
console.log(source_default.green(`\u2713 Voice generated: ${result.url}`));
|
|
7196
|
-
console.log(source_default.dim(` File: ${result.filename}`));
|
|
7197
|
-
console.log(source_default.dim(` Duration: ${result.durationSeconds}s`));
|
|
7198
|
-
console.log(source_default.dim(` Credits charged: ${result.creditsCharged}`));
|
|
7199
|
-
console.log(source_default.dim(` Model: ${result.model}`));
|
|
7200
|
-
console.log(source_default.dim(` Voice: ${result.voice}`));
|
|
7201
|
-
})
|
|
7202
|
-
);
|
|
7203
|
-
|
|
7204
7294
|
// src/commands/zero/web/index.ts
|
|
7205
|
-
var zeroWebCommand = new Command().name("web").description("Upload
|
|
7295
|
+
var zeroWebCommand = new Command().name("web").description("Upload and download files via the web chat endpoint").addCommand(downloadFileCommand3).addCommand(uploadFileCommand3).addHelpText(
|
|
7206
7296
|
"after",
|
|
7207
7297
|
`
|
|
7208
7298
|
Examples:
|
|
7209
7299
|
Upload a file: zero web upload-file -f /tmp/report.pdf
|
|
7210
|
-
Download a file: zero web download-file <file-id> -o /tmp/out.pdf
|
|
7211
|
-
Generate speech: zero web voice --text "Hello"`
|
|
7300
|
+
Download a file: zero web download-file <file-id> -o /tmp/out.pdf`
|
|
7212
7301
|
);
|
|
7213
7302
|
|
|
7214
7303
|
// src/zero.ts
|
|
@@ -7227,6 +7316,7 @@ var COMMAND_CAPABILITY_MAP = {
|
|
|
7227
7316
|
whoami: null,
|
|
7228
7317
|
"developer-support": null,
|
|
7229
7318
|
"computer-use": "computer-use:write",
|
|
7319
|
+
official: "file:write",
|
|
7230
7320
|
web: null
|
|
7231
7321
|
};
|
|
7232
7322
|
var DEFAULT_COMMANDS = [
|
|
@@ -7248,6 +7338,7 @@ var DEFAULT_COMMANDS = [
|
|
|
7248
7338
|
zeroSkillCommand,
|
|
7249
7339
|
zeroDeveloperSupportCommand,
|
|
7250
7340
|
zeroComputerUseCommand,
|
|
7341
|
+
zeroOfficialCommand,
|
|
7251
7342
|
zeroWebCommand
|
|
7252
7343
|
];
|
|
7253
7344
|
function shouldHideCommand(name, payload) {
|
|
@@ -7273,7 +7364,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
7273
7364
|
var program = new Command();
|
|
7274
7365
|
program.name("zero").description(
|
|
7275
7366
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
7276
|
-
).version("9.
|
|
7367
|
+
).version("9.143.0").addHelpText(
|
|
7277
7368
|
"after",
|
|
7278
7369
|
`
|
|
7279
7370
|
Examples:
|
|
@@ -7286,6 +7377,7 @@ Examples:
|
|
|
7286
7377
|
Set up a schedule? zero schedule setup --help
|
|
7287
7378
|
Update yourself? zero agent --help
|
|
7288
7379
|
Manage custom skills? zero skill --help
|
|
7380
|
+
Generate voice? zero official generate voice --help
|
|
7289
7381
|
Check your identity? zero whoami`
|
|
7290
7382
|
);
|
|
7291
7383
|
if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {
|