@vm0/cli 9.124.2 → 9.125.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-4XOZ4YXO.js → chunk-WAL2RDDA.js} +298 -208
- package/{chunk-4XOZ4YXO.js.map → chunk-WAL2RDDA.js.map} +1 -1
- package/index.js +9 -9
- package/package.json +1 -1
- package/zero.js +206 -64
- package/zero.js.map +1 -1
package/index.js
CHANGED
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
source_default,
|
|
66
66
|
volumeConfigSchema,
|
|
67
67
|
withErrorHandler
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-WAL2RDDA.js";
|
|
69
69
|
import {
|
|
70
70
|
__toESM,
|
|
71
71
|
init_esm_shims
|
|
@@ -398,7 +398,7 @@ function getConfigPath() {
|
|
|
398
398
|
return join(homedir(), ".vm0", "config.json");
|
|
399
399
|
}
|
|
400
400
|
var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
|
|
401
|
-
console.log(source_default.bold(`VM0 CLI v${"9.
|
|
401
|
+
console.log(source_default.bold(`VM0 CLI v${"9.125.0"}`));
|
|
402
402
|
console.log();
|
|
403
403
|
const config = await loadConfig();
|
|
404
404
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -4291,7 +4291,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4291
4291
|
options.autoUpdate = false;
|
|
4292
4292
|
}
|
|
4293
4293
|
if (options.autoUpdate !== false) {
|
|
4294
|
-
await startSilentUpgrade("9.
|
|
4294
|
+
await startSilentUpgrade("9.125.0");
|
|
4295
4295
|
}
|
|
4296
4296
|
try {
|
|
4297
4297
|
let result;
|
|
@@ -4381,7 +4381,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
|
|
|
4381
4381
|
withErrorHandler(
|
|
4382
4382
|
async (identifier, prompt, options) => {
|
|
4383
4383
|
if (options.autoUpdate !== false) {
|
|
4384
|
-
await startSilentUpgrade("9.
|
|
4384
|
+
await startSilentUpgrade("9.125.0");
|
|
4385
4385
|
}
|
|
4386
4386
|
const { name, version } = parseIdentifier(identifier);
|
|
4387
4387
|
let composeId;
|
|
@@ -6393,13 +6393,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6393
6393
|
if (latestVersion === null) {
|
|
6394
6394
|
throw new Error("Could not check for updates. Please try again later.");
|
|
6395
6395
|
}
|
|
6396
|
-
if (latestVersion === "9.
|
|
6397
|
-
console.log(source_default.green(`\u2713 Already up to date (${"9.
|
|
6396
|
+
if (latestVersion === "9.125.0") {
|
|
6397
|
+
console.log(source_default.green(`\u2713 Already up to date (${"9.125.0"})`));
|
|
6398
6398
|
return;
|
|
6399
6399
|
}
|
|
6400
6400
|
console.log(
|
|
6401
6401
|
source_default.yellow(
|
|
6402
|
-
`Current version: ${"9.
|
|
6402
|
+
`Current version: ${"9.125.0"} -> Latest version: ${latestVersion}`
|
|
6403
6403
|
)
|
|
6404
6404
|
);
|
|
6405
6405
|
console.log();
|
|
@@ -6426,7 +6426,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6426
6426
|
const success = await performUpgrade(packageManager);
|
|
6427
6427
|
if (success) {
|
|
6428
6428
|
console.log(
|
|
6429
|
-
source_default.green(`\u2713 Upgraded from ${"9.
|
|
6429
|
+
source_default.green(`\u2713 Upgraded from ${"9.125.0"} to ${latestVersion}`)
|
|
6430
6430
|
);
|
|
6431
6431
|
return;
|
|
6432
6432
|
}
|
|
@@ -6493,7 +6493,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
|
|
|
6493
6493
|
|
|
6494
6494
|
// src/index.ts
|
|
6495
6495
|
var program = new Command();
|
|
6496
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
6496
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.125.0");
|
|
6497
6497
|
program.addCommand(authCommand);
|
|
6498
6498
|
program.addCommand(infoCommand);
|
|
6499
6499
|
program.addCommand(composeCommand);
|
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -123,10 +123,11 @@ import {
|
|
|
123
123
|
updateZeroOrg,
|
|
124
124
|
updateZeroOrgModelProviderModel,
|
|
125
125
|
updateZeroUserPreferences,
|
|
126
|
+
uploadWebFile,
|
|
126
127
|
upsertZeroOrgModelProvider,
|
|
127
128
|
withErrorHandler,
|
|
128
129
|
zeroAgentCustomSkillNameSchema
|
|
129
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-WAL2RDDA.js";
|
|
130
131
|
import {
|
|
131
132
|
__toESM,
|
|
132
133
|
init_esm_shims
|
|
@@ -2968,6 +2969,7 @@ init_esm_shims();
|
|
|
2968
2969
|
|
|
2969
2970
|
// src/commands/zero/schedule/setup.ts
|
|
2970
2971
|
init_esm_shims();
|
|
2972
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
2971
2973
|
var FREQUENCY_CHOICES = [
|
|
2972
2974
|
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
2973
2975
|
{
|
|
@@ -3194,10 +3196,16 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
3194
3196
|
}
|
|
3195
3197
|
return await promptText("Timezone", existingTimezone || defaultTimezone);
|
|
3196
3198
|
}
|
|
3197
|
-
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
3199
|
+
async function gatherPromptText(optionPrompt, optionPromptFile, existingPrompt) {
|
|
3200
|
+
if (optionPrompt && optionPromptFile) {
|
|
3201
|
+
throw new Error("Cannot use --prompt and --prompt-file together");
|
|
3202
|
+
}
|
|
3203
|
+
if (optionPromptFile) {
|
|
3204
|
+
return readFileSync3(optionPromptFile, "utf-8");
|
|
3205
|
+
}
|
|
3198
3206
|
if (optionPrompt) return optionPrompt;
|
|
3199
3207
|
if (!isInteractive()) {
|
|
3200
|
-
throw new Error("--prompt is required");
|
|
3208
|
+
throw new Error("--prompt or --prompt-file is required");
|
|
3201
3209
|
}
|
|
3202
3210
|
return await promptText(
|
|
3203
3211
|
"Prompt to run",
|
|
@@ -3384,7 +3392,10 @@ async function handleScheduleEnabling(params) {
|
|
|
3384
3392
|
showEnableHint(agentName);
|
|
3385
3393
|
}
|
|
3386
3394
|
}
|
|
3387
|
-
var setupCommand2 = new Command().name("setup").description("Create or edit a schedule for a zero agent").argument("<agent-id>", "Agent ID").option("-n, --name <schedule-name>", 'Schedule name (default: "default")').option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once|loop").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-i, --interval <seconds>", "Interval in seconds for loop mode").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option(
|
|
3395
|
+
var setupCommand2 = new Command().name("setup").description("Create or edit a schedule for a zero agent").argument("<agent-id>", "Agent ID").option("-n, --name <schedule-name>", 'Schedule name (default: "default")').option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once|loop").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-i, --interval <seconds>", "Interval in seconds for loop mode").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option(
|
|
3396
|
+
"--prompt-file <path>",
|
|
3397
|
+
"Read prompt from file (cannot be used with --prompt)"
|
|
3398
|
+
).option("-e, --enable", "Enable schedule immediately after creation").option(
|
|
3388
3399
|
"--model-provider <id>",
|
|
3389
3400
|
"Model provider UUID, or 'default' to inherit from agent/org"
|
|
3390
3401
|
).option(
|
|
@@ -3399,6 +3410,7 @@ Examples:
|
|
|
3399
3410
|
Monthly on the 1st: zero schedule setup <agent-id> -f monthly -d 1 -t 08:00 -p "monthly review"
|
|
3400
3411
|
One-time: zero schedule setup <agent-id> -f once -d 2026-04-01 -t 14:00 -p "one-off task"
|
|
3401
3412
|
Loop every 5 minutes: zero schedule setup <agent-id> -f loop -i 300 -p "poll for updates"
|
|
3413
|
+
Prompt from file: zero schedule setup <agent-id> -f daily -t 09:00 --prompt-file ./prompt.md
|
|
3402
3414
|
Create and enable: zero schedule setup <agent-id> -f daily -t 09:00 -p "run report" --enable
|
|
3403
3415
|
Override model: zero schedule setup <agent-id> -f daily -t 09:00 -p "..." --model-provider <id> --model MiniMax-M2.7
|
|
3404
3416
|
Reset model override: zero schedule setup <agent-id> -f daily -t 09:00 -p "..." --model-provider default --model default
|
|
@@ -3453,6 +3465,7 @@ Notes:
|
|
|
3453
3465
|
}
|
|
3454
3466
|
const promptText_ = await gatherPromptText(
|
|
3455
3467
|
options.prompt,
|
|
3468
|
+
options.promptFile,
|
|
3456
3469
|
existingSchedule?.prompt
|
|
3457
3470
|
);
|
|
3458
3471
|
if (!promptText_) {
|
|
@@ -3564,12 +3577,16 @@ function formatTrigger(schedule) {
|
|
|
3564
3577
|
}
|
|
3565
3578
|
return source_default.dim("-");
|
|
3566
3579
|
}
|
|
3567
|
-
function printRunConfiguration(schedule) {
|
|
3580
|
+
function printRunConfiguration(schedule, showFullPrompt) {
|
|
3568
3581
|
const statusText = schedule.enabled ? source_default.green("enabled") : source_default.yellow("disabled");
|
|
3569
3582
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
3570
3583
|
console.log(`${"Agent:".padEnd(16)}${schedule.agentId}`);
|
|
3571
|
-
|
|
3572
|
-
|
|
3584
|
+
if (showFullPrompt) {
|
|
3585
|
+
console.log(`${"Prompt:".padEnd(16)}${source_default.dim(schedule.prompt)}`);
|
|
3586
|
+
} else {
|
|
3587
|
+
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
3588
|
+
console.log(`${"Prompt:".padEnd(16)}${source_default.dim(promptPreview)}`);
|
|
3589
|
+
}
|
|
3573
3590
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
3574
3591
|
console.log(
|
|
3575
3592
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -3601,25 +3618,28 @@ function printTimeSchedule(schedule) {
|
|
|
3601
3618
|
var statusCommand3 = new Command().name("status").description("Show detailed status of a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3602
3619
|
"-n, --name <schedule-name>",
|
|
3603
3620
|
"Schedule name (required when agent has multiple schedules)"
|
|
3604
|
-
).addHelpText(
|
|
3621
|
+
).option("-p, --prompt", "Show full prompt content without truncation").addHelpText(
|
|
3605
3622
|
"after",
|
|
3606
3623
|
`
|
|
3607
3624
|
Examples:
|
|
3608
3625
|
zero schedule status <agent-id>
|
|
3609
|
-
zero schedule status <agent-id> -n my-schedule
|
|
3626
|
+
zero schedule status <agent-id> -n my-schedule
|
|
3627
|
+
zero schedule status <agent-id> --prompt`
|
|
3610
3628
|
).action(
|
|
3611
|
-
withErrorHandler(
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3629
|
+
withErrorHandler(
|
|
3630
|
+
async (agentName, options) => {
|
|
3631
|
+
const schedule = await resolveZeroScheduleByAgent(
|
|
3632
|
+
agentName,
|
|
3633
|
+
options.name
|
|
3634
|
+
);
|
|
3635
|
+
console.log();
|
|
3636
|
+
console.log(`Schedule for agent: ${source_default.cyan(agentName)}`);
|
|
3637
|
+
console.log(source_default.dim("\u2501".repeat(50)));
|
|
3638
|
+
printRunConfiguration(schedule, options.prompt ?? false);
|
|
3639
|
+
printTimeSchedule(schedule);
|
|
3640
|
+
console.log();
|
|
3641
|
+
}
|
|
3642
|
+
)
|
|
3623
3643
|
);
|
|
3624
3644
|
|
|
3625
3645
|
// src/commands/zero/schedule/delete.ts
|
|
@@ -3865,7 +3885,7 @@ init_esm_shims();
|
|
|
3865
3885
|
|
|
3866
3886
|
// src/commands/zero/chat/message/send.ts
|
|
3867
3887
|
init_esm_shims();
|
|
3868
|
-
import { readFileSync as
|
|
3888
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
3869
3889
|
var sendCommand = new Command().name("send").description("Send a message to a web chat thread").option("-t, --thread <id>", "Existing chat thread ID").option("-a, --agent <agentId>", "Agent ID (creates a new thread)").option("--text <message>", "Message text").option("--title <title>", "Thread title (only with --agent)").addHelpText(
|
|
3870
3890
|
"after",
|
|
3871
3891
|
`
|
|
@@ -3896,7 +3916,7 @@ Notes:
|
|
|
3896
3916
|
});
|
|
3897
3917
|
}
|
|
3898
3918
|
if (!text && process.stdin.isTTY === false) {
|
|
3899
|
-
text =
|
|
3919
|
+
text = readFileSync4("/dev/stdin", "utf8").trim();
|
|
3900
3920
|
}
|
|
3901
3921
|
if (!text) {
|
|
3902
3922
|
throw new Error("--text is required", {
|
|
@@ -3945,7 +3965,7 @@ init_esm_shims();
|
|
|
3945
3965
|
|
|
3946
3966
|
// src/commands/zero/slack/message/send.ts
|
|
3947
3967
|
init_esm_shims();
|
|
3948
|
-
import { readFileSync as
|
|
3968
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
3949
3969
|
var sendCommand2 = new Command().name("send").description("Send a message to a Slack channel or DM a user").option("-c, --channel <id>", "Channel ID").option("-u, --user <id>", 'Slack user ID for DM (use "me" for yourself)').option("-t, --text <message>", "Message text").option("--thread <ts>", "Thread timestamp for replies").option("--blocks <json>", "Block Kit JSON string").addHelpText(
|
|
3950
3970
|
"after",
|
|
3951
3971
|
`
|
|
@@ -3979,7 +3999,7 @@ Notes:
|
|
|
3979
3999
|
});
|
|
3980
4000
|
}
|
|
3981
4001
|
if (!text && process.stdin.isTTY === false) {
|
|
3982
|
-
text =
|
|
4002
|
+
text = readFileSync5("/dev/stdin", "utf8").trim();
|
|
3983
4003
|
}
|
|
3984
4004
|
let blocks;
|
|
3985
4005
|
if (blocksStr) {
|
|
@@ -4023,7 +4043,7 @@ Examples:
|
|
|
4023
4043
|
|
|
4024
4044
|
// src/commands/zero/slack/upload-file.ts
|
|
4025
4045
|
init_esm_shims();
|
|
4026
|
-
import { statSync, readFileSync as
|
|
4046
|
+
import { statSync, readFileSync as readFileSync6 } from "fs";
|
|
4027
4047
|
import { basename } from "path";
|
|
4028
4048
|
var uploadFileCommand = new Command().name("upload-file").description("Upload a file to a Slack channel as the bot").requiredOption("-f, --file <path>", "Local file path to upload").requiredOption("-c, --channel <id>", "Slack channel ID").option("--thread <ts>", "Thread timestamp to post as a reply").option("--title <title>", "Display title for the file").option("--comment <text>", "Initial comment to accompany the file").addHelpText(
|
|
4029
4049
|
"after",
|
|
@@ -4054,7 +4074,7 @@ Notes:
|
|
|
4054
4074
|
filename,
|
|
4055
4075
|
length: fileSize
|
|
4056
4076
|
});
|
|
4057
|
-
const fileContent =
|
|
4077
|
+
const fileContent = readFileSync6(options.file);
|
|
4058
4078
|
const uploadResponse = await fetch(uploadUrl, {
|
|
4059
4079
|
method: "POST",
|
|
4060
4080
|
body: fileContent
|
|
@@ -4376,7 +4396,7 @@ init_esm_shims();
|
|
|
4376
4396
|
|
|
4377
4397
|
// src/lib/skill-directory.ts
|
|
4378
4398
|
init_esm_shims();
|
|
4379
|
-
import { readFileSync as
|
|
4399
|
+
import { readFileSync as readFileSync7, readdirSync } from "fs";
|
|
4380
4400
|
import { join as join2 } from "path";
|
|
4381
4401
|
var IGNORED_NAMES = /* @__PURE__ */ new Set(["node_modules", ".git", ".DS_Store"]);
|
|
4382
4402
|
function readSkillDirectory(dirPath) {
|
|
@@ -4391,7 +4411,7 @@ function readSkillDirectory(dirPath) {
|
|
|
4391
4411
|
} else {
|
|
4392
4412
|
files.push({
|
|
4393
4413
|
path: relPath,
|
|
4394
|
-
content:
|
|
4414
|
+
content: readFileSync7(join2(dir, entry.name), "utf-8")
|
|
4395
4415
|
});
|
|
4396
4416
|
}
|
|
4397
4417
|
}
|
|
@@ -4769,6 +4789,37 @@ function renderResults(response) {
|
|
|
4769
4789
|
);
|
|
4770
4790
|
}
|
|
4771
4791
|
}
|
|
4792
|
+
async function runLogsSearch(keyword, options) {
|
|
4793
|
+
const { before, after } = parseContextOptions(options);
|
|
4794
|
+
if (options.run && !isUUID(options.run)) {
|
|
4795
|
+
console.error(
|
|
4796
|
+
source_default.red(`\u2717 Invalid run ID "${options.run}" \u2014 expected a UUID`)
|
|
4797
|
+
);
|
|
4798
|
+
console.error(source_default.dim(" Run: zero logs list to find run IDs"));
|
|
4799
|
+
process.exit(1);
|
|
4800
|
+
}
|
|
4801
|
+
const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
|
|
4802
|
+
const limit = parseLimit2(options.limit);
|
|
4803
|
+
const response = await searchZeroLogs({
|
|
4804
|
+
keyword,
|
|
4805
|
+
agent: options.agent,
|
|
4806
|
+
runId: options.run,
|
|
4807
|
+
since,
|
|
4808
|
+
limit,
|
|
4809
|
+
before,
|
|
4810
|
+
after
|
|
4811
|
+
});
|
|
4812
|
+
if (response.results.length === 0) {
|
|
4813
|
+
console.log(source_default.dim("No matches found"));
|
|
4814
|
+
console.log(
|
|
4815
|
+
source_default.dim(
|
|
4816
|
+
" Try a broader search with --since 30d or a different keyword"
|
|
4817
|
+
)
|
|
4818
|
+
);
|
|
4819
|
+
return;
|
|
4820
|
+
}
|
|
4821
|
+
renderResults(response);
|
|
4822
|
+
}
|
|
4772
4823
|
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 <name>", "Filter by agent name").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(
|
|
4773
4824
|
"after",
|
|
4774
4825
|
`
|
|
@@ -4778,35 +4829,7 @@ Examples:
|
|
|
4778
4829
|
zero logs search "failed" --since 30d --limit 50`
|
|
4779
4830
|
).action(
|
|
4780
4831
|
withErrorHandler(async (keyword, options) => {
|
|
4781
|
-
|
|
4782
|
-
if (options.run && !isUUID(options.run)) {
|
|
4783
|
-
console.error(
|
|
4784
|
-
source_default.red(`\u2717 Invalid run ID "${options.run}" \u2014 expected a UUID`)
|
|
4785
|
-
);
|
|
4786
|
-
console.error(source_default.dim(" Run: zero logs list to find run IDs"));
|
|
4787
|
-
process.exit(1);
|
|
4788
|
-
}
|
|
4789
|
-
const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
|
|
4790
|
-
const limit = parseLimit2(options.limit);
|
|
4791
|
-
const response = await searchZeroLogs({
|
|
4792
|
-
keyword,
|
|
4793
|
-
agent: options.agent,
|
|
4794
|
-
runId: options.run,
|
|
4795
|
-
since,
|
|
4796
|
-
limit,
|
|
4797
|
-
before,
|
|
4798
|
-
after
|
|
4799
|
-
});
|
|
4800
|
-
if (response.results.length === 0) {
|
|
4801
|
-
console.log(source_default.dim("No matches found"));
|
|
4802
|
-
console.log(
|
|
4803
|
-
source_default.dim(
|
|
4804
|
-
" Try a broader search with --since 30d or a different keyword"
|
|
4805
|
-
)
|
|
4806
|
-
);
|
|
4807
|
-
return;
|
|
4808
|
-
}
|
|
4809
|
-
renderResults(response);
|
|
4832
|
+
await runLogsSearch(keyword, options);
|
|
4810
4833
|
})
|
|
4811
4834
|
);
|
|
4812
4835
|
|
|
@@ -4924,6 +4947,93 @@ Examples:
|
|
|
4924
4947
|
)
|
|
4925
4948
|
);
|
|
4926
4949
|
|
|
4950
|
+
// src/commands/zero/search/index.ts
|
|
4951
|
+
init_esm_shims();
|
|
4952
|
+
var SUPPORTED_SOURCES = ["logs", "chat", "slack"];
|
|
4953
|
+
var SEARCH_EXPLAINER = `
|
|
4954
|
+
Available sources:
|
|
4955
|
+
logs full agent event stream (tool calls, tokens, system events) from agent runs
|
|
4956
|
+
chat user/assistant text messages as shown in the web chat UI
|
|
4957
|
+
slack returns a recipe for calling the Slack API directly; requires the Slack connector
|
|
4958
|
+
|
|
4959
|
+
Usage: zero search <query> --source <logs|chat|slack> [flags]
|
|
4960
|
+
Run 'zero search --help' for all flags.`;
|
|
4961
|
+
function buildSlackRecipe(query) {
|
|
4962
|
+
const encoded = encodeURIComponent(query);
|
|
4963
|
+
return `The \`slack\` source does not call Slack from this CLI. Run the
|
|
4964
|
+
following inside an agent sandbox that has $SLACK_TOKEN available:
|
|
4965
|
+
|
|
4966
|
+
curl -H "Authorization: Bearer $SLACK_TOKEN" \\
|
|
4967
|
+
"https://slack.com/api/search.messages?query=${encoded}"
|
|
4968
|
+
|
|
4969
|
+
If you don't have $SLACK_TOKEN, check the connector status:
|
|
4970
|
+
zero connector status slack
|
|
4971
|
+
|
|
4972
|
+
To verify the token and network policy end-to-end:
|
|
4973
|
+
zero doctor check-connector --env-name SLACK_TOKEN
|
|
4974
|
+
|
|
4975
|
+
Slack API docs: https://api.slack.com/methods/search.messages
|
|
4976
|
+
|
|
4977
|
+
Note: CLI-local flags (--limit, --since, -A/-B/-C) are ignored for the
|
|
4978
|
+
slack source. Pass equivalents to Slack's API via count= / highlight=
|
|
4979
|
+
query parameters instead.`;
|
|
4980
|
+
}
|
|
4981
|
+
function collectSource(value, previous) {
|
|
4982
|
+
return [...previous, value];
|
|
4983
|
+
}
|
|
4984
|
+
async function runLogsSource(query, options) {
|
|
4985
|
+
const logsOptions = {
|
|
4986
|
+
afterContext: options.afterContext,
|
|
4987
|
+
beforeContext: options.beforeContext,
|
|
4988
|
+
context: options.context,
|
|
4989
|
+
agent: options.agent,
|
|
4990
|
+
run: options.run,
|
|
4991
|
+
since: options.since,
|
|
4992
|
+
limit: options.limit
|
|
4993
|
+
};
|
|
4994
|
+
await runLogsSearch(query, logsOptions);
|
|
4995
|
+
}
|
|
4996
|
+
async function runChatSource(_query, _options) {
|
|
4997
|
+
throw new Error("zero search --source chat: not yet implemented");
|
|
4998
|
+
}
|
|
4999
|
+
async function runSlackSource(query, _options) {
|
|
5000
|
+
console.log(buildSlackRecipe(query));
|
|
5001
|
+
}
|
|
5002
|
+
var zeroSearchCommand = new Command().name("search").description("Search logs, chat, or get a recipe for external sources").argument("<query>", "Search query").option(
|
|
5003
|
+
"--source <type>",
|
|
5004
|
+
"Source to search: logs | chat | slack (pass once)",
|
|
5005
|
+
collectSource,
|
|
5006
|
+
[]
|
|
5007
|
+
).option("--agent <name>", "Filter by agent name").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(
|
|
5008
|
+
withErrorHandler(async (query, options) => {
|
|
5009
|
+
const sources = options.source;
|
|
5010
|
+
if (sources.length === 0) {
|
|
5011
|
+
console.log(SEARCH_EXPLAINER);
|
|
5012
|
+
return;
|
|
5013
|
+
}
|
|
5014
|
+
if (sources.length > 1) {
|
|
5015
|
+
throw new Error("Only one --source is allowed.");
|
|
5016
|
+
}
|
|
5017
|
+
const source = sources[0];
|
|
5018
|
+
if (!SUPPORTED_SOURCES.includes(source)) {
|
|
5019
|
+
throw new Error(
|
|
5020
|
+
`Unknown --source "${source}". Expected one of: ${SUPPORTED_SOURCES.join(", ")}`
|
|
5021
|
+
);
|
|
5022
|
+
}
|
|
5023
|
+
switch (source) {
|
|
5024
|
+
case "logs":
|
|
5025
|
+
await runLogsSource(query, options);
|
|
5026
|
+
return;
|
|
5027
|
+
case "chat":
|
|
5028
|
+
await runChatSource(query, options);
|
|
5029
|
+
return;
|
|
5030
|
+
case "slack":
|
|
5031
|
+
await runSlackSource(query, options);
|
|
5032
|
+
return;
|
|
5033
|
+
}
|
|
5034
|
+
})
|
|
5035
|
+
);
|
|
5036
|
+
|
|
4927
5037
|
// src/commands/zero/developer-support.ts
|
|
4928
5038
|
init_esm_shims();
|
|
4929
5039
|
var zeroDeveloperSupportCommand = new Command().name("developer-support").description("Submit a diagnostic report to the dev team").requiredOption("--title <text>", "Issue title").requiredOption("--description <text>", "Diagnostic description").option("--consent-code <code>", "User-provided verification code").addHelpText(
|
|
@@ -6203,7 +6313,7 @@ var voiceChatContextGetCommand = new Command().name("get").description("Read sha
|
|
|
6203
6313
|
|
|
6204
6314
|
// src/commands/zero/voice-chat/context/append.ts
|
|
6205
6315
|
init_esm_shims();
|
|
6206
|
-
import { readFileSync as
|
|
6316
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
6207
6317
|
var voiceChatContextAppendCommand = new Command().name("append").description("Append an event to voice-chat shared context").argument("<session-id>", "Voice-chat session ID").requiredOption(
|
|
6208
6318
|
"--source <source>",
|
|
6209
6319
|
"Event source (system|user|fast-brain|slow-brain)"
|
|
@@ -6221,7 +6331,7 @@ Examples:
|
|
|
6221
6331
|
async (sessionId, options) => {
|
|
6222
6332
|
let content = options.content;
|
|
6223
6333
|
if (!content && process.stdin.isTTY === false) {
|
|
6224
|
-
content =
|
|
6334
|
+
content = readFileSync9("/dev/stdin", "utf8").trim();
|
|
6225
6335
|
}
|
|
6226
6336
|
const data = await appendVoiceChatContextEvent(sessionId, {
|
|
6227
6337
|
source: options.source,
|
|
@@ -6235,7 +6345,7 @@ Examples:
|
|
|
6235
6345
|
|
|
6236
6346
|
// src/commands/zero/voice-chat/context/prepare.ts
|
|
6237
6347
|
init_esm_shims();
|
|
6238
|
-
import { readFileSync as
|
|
6348
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
6239
6349
|
var voiceChatContextPrepareCommand = new Command().name("prepare").description("Submit preparation directive content for a voice-chat run").option(
|
|
6240
6350
|
"--content <content>",
|
|
6241
6351
|
"Directive content (reads from stdin if not provided)"
|
|
@@ -6249,7 +6359,7 @@ Examples:
|
|
|
6249
6359
|
withErrorHandler(async (options) => {
|
|
6250
6360
|
let content = options.content;
|
|
6251
6361
|
if (!content && process.stdin.isTTY === false) {
|
|
6252
|
-
content =
|
|
6362
|
+
content = readFileSync10("/dev/stdin", "utf8").trim();
|
|
6253
6363
|
}
|
|
6254
6364
|
if (!content) {
|
|
6255
6365
|
throw new Error(
|
|
@@ -6316,11 +6426,41 @@ Notes:
|
|
|
6316
6426
|
})
|
|
6317
6427
|
);
|
|
6318
6428
|
|
|
6429
|
+
// src/commands/zero/web/upload-file.ts
|
|
6430
|
+
init_esm_shims();
|
|
6431
|
+
var uploadFileCommand2 = new Command().name("upload-file").description("Upload a local file and print a 7-day presigned URL").requiredOption("-f, --file <path>", "Local file path to upload").option("--content-type <mime>", "Override inferred content type").addHelpText(
|
|
6432
|
+
"after",
|
|
6433
|
+
`
|
|
6434
|
+
Examples:
|
|
6435
|
+
Upload a file: zero web upload-file -f /tmp/report.pdf
|
|
6436
|
+
Override content-type: zero web upload-file -f /tmp/data --content-type text/csv
|
|
6437
|
+
|
|
6438
|
+
Output:
|
|
6439
|
+
Prints a JSON object to stdout on success:
|
|
6440
|
+
{"id":"...","filename":"...","contentType":"...","size":N,"url":"https://..."}
|
|
6441
|
+
|
|
6442
|
+
Notes:
|
|
6443
|
+
- Authenticates via ZERO_TOKEN (requires file:write capability)
|
|
6444
|
+
- Returned URL is a presigned GET valid for 7 days
|
|
6445
|
+
- Max file size: 10 MB
|
|
6446
|
+
- Allowed types: png / jpeg / gif / webp / svg / mp4 / webm / mov / pdf / txt / csv / md / json`
|
|
6447
|
+
).action(
|
|
6448
|
+
withErrorHandler(
|
|
6449
|
+
async (options) => {
|
|
6450
|
+
const result = await uploadWebFile(options.file, {
|
|
6451
|
+
contentType: options.contentType
|
|
6452
|
+
});
|
|
6453
|
+
console.log(JSON.stringify(result));
|
|
6454
|
+
}
|
|
6455
|
+
)
|
|
6456
|
+
);
|
|
6457
|
+
|
|
6319
6458
|
// src/commands/zero/web/index.ts
|
|
6320
|
-
var zeroWebCommand = new Command().name("web").description("
|
|
6459
|
+
var zeroWebCommand = new Command().name("web").description("Upload and download files via the web chat endpoint").addCommand(downloadFileCommand2).addCommand(uploadFileCommand2).addHelpText(
|
|
6321
6460
|
"after",
|
|
6322
6461
|
`
|
|
6323
6462
|
Examples:
|
|
6463
|
+
Upload a file: zero web upload-file -f /tmp/report.pdf
|
|
6324
6464
|
Download a file: zero web download-file <file-id> -o /tmp/out.pdf`
|
|
6325
6465
|
);
|
|
6326
6466
|
|
|
@@ -6333,6 +6473,7 @@ var COMMAND_CAPABILITY_MAP = {
|
|
|
6333
6473
|
schedule: "schedule:read",
|
|
6334
6474
|
doctor: null,
|
|
6335
6475
|
logs: "agent-run:read",
|
|
6476
|
+
search: "chat-message:read",
|
|
6336
6477
|
chat: "chat-message:write",
|
|
6337
6478
|
slack: "slack:write",
|
|
6338
6479
|
whoami: null,
|
|
@@ -6355,6 +6496,7 @@ var DEFAULT_COMMANDS = [
|
|
|
6355
6496
|
zeroSlackCommand,
|
|
6356
6497
|
zeroVariableCommand,
|
|
6357
6498
|
zeroLogsCommand,
|
|
6499
|
+
zeroSearchCommand,
|
|
6358
6500
|
zeroWhoamiCommand,
|
|
6359
6501
|
zeroSkillCommand,
|
|
6360
6502
|
zeroDeveloperSupportCommand,
|
|
@@ -6380,7 +6522,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
6380
6522
|
var program = new Command();
|
|
6381
6523
|
program.name("zero").description(
|
|
6382
6524
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
6383
|
-
).version("9.
|
|
6525
|
+
).version("9.125.0").addHelpText(
|
|
6384
6526
|
"after",
|
|
6385
6527
|
`
|
|
6386
6528
|
Examples:
|