@vm0/cli 9.92.0 → 9.93.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-7QKHF3FS.js → chunk-UEVD4XR7.js} +882 -25
- package/chunk-UEVD4XR7.js.map +1 -0
- package/index.js +10 -10
- package/package.json +1 -1
- package/zero.js +140 -146
- package/zero.js.map +1 -1
- package/chunk-7QKHF3FS.js.map +0 -1
package/zero.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
EventRenderer,
|
|
6
6
|
MODEL_PROVIDER_TYPES,
|
|
7
7
|
allowsCustomModel,
|
|
8
|
+
completeSlackFileUpload,
|
|
8
9
|
configureGlobalProxyFromEnv,
|
|
9
10
|
connectorTypeSchema,
|
|
10
11
|
createSkill,
|
|
@@ -58,6 +59,7 @@ import {
|
|
|
58
59
|
hasAuthMethods,
|
|
59
60
|
hasModelSelection,
|
|
60
61
|
hasRequiredScopes,
|
|
62
|
+
initSlackFileUpload,
|
|
61
63
|
inviteZeroOrgMember,
|
|
62
64
|
isFeatureEnabled,
|
|
63
65
|
isFirewallConnectorType,
|
|
@@ -100,10 +102,10 @@ import {
|
|
|
100
102
|
updateZeroUserPreferences,
|
|
101
103
|
upsertZeroOrgModelProvider,
|
|
102
104
|
withErrorHandler
|
|
103
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-UEVD4XR7.js";
|
|
104
106
|
|
|
105
107
|
// src/zero.ts
|
|
106
|
-
import { Command as
|
|
108
|
+
import { Command as Command69 } from "commander";
|
|
107
109
|
|
|
108
110
|
// src/commands/zero/org/index.ts
|
|
109
111
|
import { Command as Command23 } from "commander";
|
|
@@ -2366,9 +2368,6 @@ function showZeroNextSteps(result) {
|
|
|
2366
2368
|
|
|
2367
2369
|
// src/commands/zero/run/run.ts
|
|
2368
2370
|
var mainRunCommand = new Command39().name("run").description("Delegate a task to a teammate agent").argument("<agent-id>", "Agent UUID (from `zero agent list`)").argument("<prompt>", "Task prompt for the agent").option(
|
|
2369
|
-
"--append-system-prompt <text>",
|
|
2370
|
-
"Append text to the agent's system prompt"
|
|
2371
|
-
).option(
|
|
2372
2371
|
"--model-provider <type>",
|
|
2373
2372
|
"Override model provider (e.g., anthropic-api-key)"
|
|
2374
2373
|
).option("--verbose", "Show full tool inputs and outputs").addHelpText(
|
|
@@ -2395,7 +2394,6 @@ Notes:
|
|
|
2395
2394
|
const response = await createZeroRun({
|
|
2396
2395
|
agentId,
|
|
2397
2396
|
prompt,
|
|
2398
|
-
appendSystemPrompt: options.appendSystemPrompt,
|
|
2399
2397
|
modelProvider: options.modelProvider
|
|
2400
2398
|
});
|
|
2401
2399
|
if (response.status === "failed") {
|
|
@@ -2419,9 +2417,6 @@ Notes:
|
|
|
2419
2417
|
// src/commands/zero/run/continue.ts
|
|
2420
2418
|
import { Command as Command40 } from "commander";
|
|
2421
2419
|
var continueCommand = new Command40().name("continue").description("Continue a previous delegation from a session").argument("<session-id>", "Session ID from a previous run").argument("<prompt>", "Follow-up prompt for the agent").option(
|
|
2422
|
-
"--append-system-prompt <text>",
|
|
2423
|
-
"Append text to the agent's system prompt"
|
|
2424
|
-
).option(
|
|
2425
2420
|
"--model-provider <type>",
|
|
2426
2421
|
"Override model provider (e.g., anthropic-api-key)"
|
|
2427
2422
|
).option("--verbose", "Show full tool inputs and outputs").addHelpText(
|
|
@@ -2445,7 +2440,6 @@ Notes:
|
|
|
2445
2440
|
const response = await createZeroRun({
|
|
2446
2441
|
sessionId,
|
|
2447
2442
|
prompt,
|
|
2448
|
-
appendSystemPrompt: options.appendSystemPrompt,
|
|
2449
2443
|
modelProvider: options.modelProvider
|
|
2450
2444
|
});
|
|
2451
2445
|
if (response.status === "failed") {
|
|
@@ -2720,42 +2714,6 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
2720
2714
|
existingPrompt || "let's start working."
|
|
2721
2715
|
);
|
|
2722
2716
|
}
|
|
2723
|
-
async function gatherNotificationPreferences(optionNotifyEmail, optionNotifySlack, optionNotifySlackChannelId, existingSchedule) {
|
|
2724
|
-
if (optionNotifyEmail !== void 0 && optionNotifySlack !== void 0) {
|
|
2725
|
-
return {
|
|
2726
|
-
notifyEmail: optionNotifyEmail,
|
|
2727
|
-
notifySlack: optionNotifySlack,
|
|
2728
|
-
notifySlackChannelId: optionNotifySlackChannelId
|
|
2729
|
-
};
|
|
2730
|
-
}
|
|
2731
|
-
if (!isInteractive()) {
|
|
2732
|
-
return {
|
|
2733
|
-
notifyEmail: optionNotifyEmail,
|
|
2734
|
-
notifySlack: optionNotifySlack,
|
|
2735
|
-
notifySlackChannelId: optionNotifySlackChannelId
|
|
2736
|
-
};
|
|
2737
|
-
}
|
|
2738
|
-
const notifyEmail = optionNotifyEmail ?? await promptConfirm(
|
|
2739
|
-
"Enable email notifications?",
|
|
2740
|
-
existingSchedule?.notifyEmail ?? false
|
|
2741
|
-
);
|
|
2742
|
-
const notifySlack = optionNotifySlack ?? await promptConfirm(
|
|
2743
|
-
"Enable Slack notifications?",
|
|
2744
|
-
existingSchedule?.notifySlack ?? false
|
|
2745
|
-
);
|
|
2746
|
-
let notifySlackChannelId = optionNotifySlackChannelId;
|
|
2747
|
-
if (notifySlackChannelId === void 0 && notifySlack) {
|
|
2748
|
-
const defaultChannel = existingSchedule?.notifySlackChannelId ?? "";
|
|
2749
|
-
const channelInput = await promptText(
|
|
2750
|
-
"Slack channel ID (leave empty for DM)",
|
|
2751
|
-
defaultChannel
|
|
2752
|
-
);
|
|
2753
|
-
if (channelInput) {
|
|
2754
|
-
notifySlackChannelId = channelInput;
|
|
2755
|
-
}
|
|
2756
|
-
}
|
|
2757
|
-
return { notifyEmail, notifySlack, notifySlackChannelId };
|
|
2758
|
-
}
|
|
2759
2717
|
async function gatherInterval(optionInterval, existingInterval) {
|
|
2760
2718
|
if (optionInterval) {
|
|
2761
2719
|
const val = parseInt(optionInterval, 10);
|
|
@@ -2848,16 +2806,7 @@ Deploying schedule for agent ${chalk33.cyan(params.agentName)}...`
|
|
|
2848
2806
|
atTime: atTimeISO,
|
|
2849
2807
|
intervalSeconds: params.intervalSeconds,
|
|
2850
2808
|
timezone: params.timezone,
|
|
2851
|
-
prompt: params.prompt
|
|
2852
|
-
...params.notifyEmail !== void 0 && {
|
|
2853
|
-
notifyEmail: params.notifyEmail
|
|
2854
|
-
},
|
|
2855
|
-
...params.notifySlack !== void 0 && {
|
|
2856
|
-
notifySlack: params.notifySlack
|
|
2857
|
-
},
|
|
2858
|
-
...params.notifySlackChannelId !== void 0 && {
|
|
2859
|
-
notifySlackChannelId: params.notifySlackChannelId
|
|
2860
|
-
}
|
|
2809
|
+
prompt: params.prompt
|
|
2861
2810
|
});
|
|
2862
2811
|
return deployResult;
|
|
2863
2812
|
}
|
|
@@ -2936,10 +2885,7 @@ async function handleScheduleEnabling(params) {
|
|
|
2936
2885
|
showEnableHint(agentName);
|
|
2937
2886
|
}
|
|
2938
2887
|
}
|
|
2939
|
-
var setupCommand2 = new Command41().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("-e, --enable", "Enable schedule immediately after creation").
|
|
2940
|
-
"--notify-slack-channel-id <channel-id>",
|
|
2941
|
-
"Slack channel ID for notifications (default: DM)"
|
|
2942
|
-
).addHelpText(
|
|
2888
|
+
var setupCommand2 = new Command41().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("-e, --enable", "Enable schedule immediately after creation").addHelpText(
|
|
2943
2889
|
"after",
|
|
2944
2890
|
`
|
|
2945
2891
|
Examples:
|
|
@@ -2953,8 +2899,7 @@ Examples:
|
|
|
2953
2899
|
Notes:
|
|
2954
2900
|
- Re-running setup with the same agent updates the existing "default" schedule
|
|
2955
2901
|
- Use -n to manage multiple named schedules for the same agent
|
|
2956
|
-
- All flags are required in non-interactive mode; interactive mode prompts for missing values
|
|
2957
|
-
- When --notify-slack is enabled, run results are automatically posted to the Slack channel specified by --notify-slack-channel-id (or as a DM if not set). No need to include Slack delivery instructions in your prompt.`
|
|
2902
|
+
- All flags are required in non-interactive mode; interactive mode prompts for missing values`
|
|
2958
2903
|
).action(
|
|
2959
2904
|
withErrorHandler(async (agentIdentifier, options) => {
|
|
2960
2905
|
const compose = await resolveCompose(agentIdentifier);
|
|
@@ -3004,12 +2949,6 @@ Notes:
|
|
|
3004
2949
|
console.log(chalk33.dim("Cancelled"));
|
|
3005
2950
|
return;
|
|
3006
2951
|
}
|
|
3007
|
-
const { notifyEmail, notifySlack, notifySlackChannelId } = await gatherNotificationPreferences(
|
|
3008
|
-
options.notifyEmail,
|
|
3009
|
-
options.notifySlack,
|
|
3010
|
-
options.notifySlackChannelId,
|
|
3011
|
-
existingSchedule
|
|
3012
|
-
);
|
|
3013
2952
|
const deployResult = await buildAndDeploy({
|
|
3014
2953
|
scheduleName,
|
|
3015
2954
|
agentId,
|
|
@@ -3020,10 +2959,7 @@ Notes:
|
|
|
3020
2959
|
atTime,
|
|
3021
2960
|
intervalSeconds,
|
|
3022
2961
|
timezone,
|
|
3023
|
-
prompt: promptText_
|
|
3024
|
-
notifyEmail,
|
|
3025
|
-
notifySlack,
|
|
3026
|
-
notifySlackChannelId
|
|
2962
|
+
prompt: promptText_
|
|
3027
2963
|
});
|
|
3028
2964
|
displayDeployResult(scheduleName, deployResult);
|
|
3029
2965
|
const shouldPromptEnable = deployResult.created || existingSchedule !== void 0 && !existingSchedule.enabled;
|
|
@@ -3417,7 +3353,7 @@ var deleteCommand4 = new Command50().name("delete").description("Delete a secret
|
|
|
3417
3353
|
var zeroSecretCommand = new Command51().name("secret").description("Read or write secrets (API keys, tokens)").addCommand(listCommand8).addCommand(setCommand4).addCommand(deleteCommand4);
|
|
3418
3354
|
|
|
3419
3355
|
// src/commands/zero/slack/index.ts
|
|
3420
|
-
import { Command as
|
|
3356
|
+
import { Command as Command55 } from "commander";
|
|
3421
3357
|
|
|
3422
3358
|
// src/commands/zero/slack/message/index.ts
|
|
3423
3359
|
import { Command as Command53 } from "commander";
|
|
@@ -3483,58 +3419,116 @@ Examples:
|
|
|
3483
3419
|
zero slack message send -c <channel-id> -t "Hello!"`
|
|
3484
3420
|
);
|
|
3485
3421
|
|
|
3422
|
+
// src/commands/zero/slack/upload-file.ts
|
|
3423
|
+
import { statSync, readFileSync as readFileSync4 } from "fs";
|
|
3424
|
+
import { basename } from "path";
|
|
3425
|
+
import { Command as Command54 } from "commander";
|
|
3426
|
+
import chalk43 from "chalk";
|
|
3427
|
+
var uploadFileCommand = new Command54().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(
|
|
3428
|
+
"after",
|
|
3429
|
+
`
|
|
3430
|
+
Examples:
|
|
3431
|
+
Upload a file: zero slack upload-file -f /tmp/report.pdf -c C01234
|
|
3432
|
+
Upload to thread: zero slack upload-file -f /tmp/log.txt -c C01234 --thread 1234567890.123456
|
|
3433
|
+
With title and comment: zero slack upload-file -f /tmp/data.csv -c C01234 --title "Daily Report" --comment "Here's the report"
|
|
3434
|
+
|
|
3435
|
+
Notes:
|
|
3436
|
+
- Uses the bot token (not user SLACK_TOKEN), so no files:write firewall permission is needed
|
|
3437
|
+
- Returns file_id and permalink for reference`
|
|
3438
|
+
).action(
|
|
3439
|
+
withErrorHandler(
|
|
3440
|
+
async (options) => {
|
|
3441
|
+
let fileSize;
|
|
3442
|
+
try {
|
|
3443
|
+
const stat = statSync(options.file);
|
|
3444
|
+
fileSize = stat.size;
|
|
3445
|
+
} catch {
|
|
3446
|
+
throw new Error(`File not found: ${options.file}`);
|
|
3447
|
+
}
|
|
3448
|
+
if (fileSize === 0) {
|
|
3449
|
+
throw new Error("File is empty");
|
|
3450
|
+
}
|
|
3451
|
+
const filename = basename(options.file);
|
|
3452
|
+
const { uploadUrl, fileId } = await initSlackFileUpload({
|
|
3453
|
+
filename,
|
|
3454
|
+
length: fileSize
|
|
3455
|
+
});
|
|
3456
|
+
const fileContent = readFileSync4(options.file);
|
|
3457
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
3458
|
+
method: "POST",
|
|
3459
|
+
body: fileContent
|
|
3460
|
+
});
|
|
3461
|
+
if (!uploadResponse.ok) {
|
|
3462
|
+
throw new Error(
|
|
3463
|
+
`File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`
|
|
3464
|
+
);
|
|
3465
|
+
}
|
|
3466
|
+
const result = await completeSlackFileUpload({
|
|
3467
|
+
fileId,
|
|
3468
|
+
channel: options.channel,
|
|
3469
|
+
threadTs: options.thread,
|
|
3470
|
+
title: options.title,
|
|
3471
|
+
initialComment: options.comment
|
|
3472
|
+
});
|
|
3473
|
+
console.log(chalk43.green(`\u2713 File uploaded (file_id: ${result.fileId})`));
|
|
3474
|
+
console.log(chalk43.dim(` permalink: ${result.permalink}`));
|
|
3475
|
+
}
|
|
3476
|
+
)
|
|
3477
|
+
);
|
|
3478
|
+
|
|
3486
3479
|
// src/commands/zero/slack/index.ts
|
|
3487
|
-
var zeroSlackCommand = new
|
|
3480
|
+
var zeroSlackCommand = new Command55().name("slack").description("Send messages and upload files to Slack channels as the bot").addCommand(zeroSlackMessageCommand).addCommand(uploadFileCommand).addHelpText(
|
|
3488
3481
|
"after",
|
|
3489
3482
|
`
|
|
3490
3483
|
Examples:
|
|
3491
3484
|
Send a message: zero slack message send -c <channel-id> -t "Hello!"
|
|
3492
|
-
Reply in a thread: zero slack message send -c <channel-id> --thread <ts> -t "reply"
|
|
3485
|
+
Reply in a thread: zero slack message send -c <channel-id> --thread <ts> -t "reply"
|
|
3486
|
+
Upload a file: zero slack upload-file -f /tmp/report.pdf -c <channel-id>`
|
|
3493
3487
|
);
|
|
3494
3488
|
|
|
3495
3489
|
// src/commands/zero/variable/index.ts
|
|
3496
|
-
import { Command as
|
|
3490
|
+
import { Command as Command59 } from "commander";
|
|
3497
3491
|
|
|
3498
3492
|
// src/commands/zero/variable/list.ts
|
|
3499
|
-
import { Command as
|
|
3500
|
-
import
|
|
3493
|
+
import { Command as Command56 } from "commander";
|
|
3494
|
+
import chalk44 from "chalk";
|
|
3501
3495
|
function truncateValue2(value, maxLength = 60) {
|
|
3502
3496
|
if (value.length <= maxLength) {
|
|
3503
3497
|
return value;
|
|
3504
3498
|
}
|
|
3505
3499
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
3506
3500
|
}
|
|
3507
|
-
var listCommand9 = new
|
|
3501
|
+
var listCommand9 = new Command56().name("list").alias("ls").description("List all variables").action(
|
|
3508
3502
|
withErrorHandler(async () => {
|
|
3509
3503
|
const result = await listZeroVariables();
|
|
3510
3504
|
if (result.variables.length === 0) {
|
|
3511
|
-
console.log(
|
|
3505
|
+
console.log(chalk44.dim("No variables found"));
|
|
3512
3506
|
console.log();
|
|
3513
3507
|
console.log("To add a variable:");
|
|
3514
|
-
console.log(
|
|
3508
|
+
console.log(chalk44.cyan(" zero variable set MY_VAR <value>"));
|
|
3515
3509
|
return;
|
|
3516
3510
|
}
|
|
3517
|
-
console.log(
|
|
3511
|
+
console.log(chalk44.bold("Variables:"));
|
|
3518
3512
|
console.log();
|
|
3519
3513
|
for (const variable of result.variables) {
|
|
3520
3514
|
const displayValue = truncateValue2(variable.value);
|
|
3521
|
-
console.log(` ${
|
|
3515
|
+
console.log(` ${chalk44.cyan(variable.name)} = ${displayValue}`);
|
|
3522
3516
|
if (variable.description) {
|
|
3523
|
-
console.log(` ${
|
|
3517
|
+
console.log(` ${chalk44.dim(variable.description)}`);
|
|
3524
3518
|
}
|
|
3525
3519
|
console.log(
|
|
3526
|
-
` ${
|
|
3520
|
+
` ${chalk44.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
3527
3521
|
);
|
|
3528
3522
|
console.log();
|
|
3529
3523
|
}
|
|
3530
|
-
console.log(
|
|
3524
|
+
console.log(chalk44.dim(`Total: ${result.variables.length} variable(s)`));
|
|
3531
3525
|
})
|
|
3532
3526
|
);
|
|
3533
3527
|
|
|
3534
3528
|
// src/commands/zero/variable/set.ts
|
|
3535
|
-
import { Command as
|
|
3536
|
-
import
|
|
3537
|
-
var setCommand5 = new
|
|
3529
|
+
import { Command as Command57 } from "commander";
|
|
3530
|
+
import chalk45 from "chalk";
|
|
3531
|
+
var setCommand5 = new Command57().name("set").description("Create or update a variable").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
3538
3532
|
withErrorHandler(
|
|
3539
3533
|
async (name, value, options) => {
|
|
3540
3534
|
let variable;
|
|
@@ -3554,15 +3548,15 @@ var setCommand5 = new Command56().name("set").description("Create or update a va
|
|
|
3554
3548
|
}
|
|
3555
3549
|
throw error;
|
|
3556
3550
|
}
|
|
3557
|
-
console.log(
|
|
3551
|
+
console.log(chalk45.green(`\u2713 Variable "${variable.name}" saved`));
|
|
3558
3552
|
}
|
|
3559
3553
|
)
|
|
3560
3554
|
);
|
|
3561
3555
|
|
|
3562
3556
|
// src/commands/zero/variable/delete.ts
|
|
3563
|
-
import { Command as
|
|
3564
|
-
import
|
|
3565
|
-
var deleteCommand5 = new
|
|
3557
|
+
import { Command as Command58 } from "commander";
|
|
3558
|
+
import chalk46 from "chalk";
|
|
3559
|
+
var deleteCommand5 = new Command58().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
3566
3560
|
withErrorHandler(async (name, options) => {
|
|
3567
3561
|
if (!options.yes) {
|
|
3568
3562
|
if (!isInteractive()) {
|
|
@@ -3573,21 +3567,21 @@ var deleteCommand5 = new Command57().name("delete").description("Delete a variab
|
|
|
3573
3567
|
false
|
|
3574
3568
|
);
|
|
3575
3569
|
if (!confirmed) {
|
|
3576
|
-
console.log(
|
|
3570
|
+
console.log(chalk46.dim("Cancelled"));
|
|
3577
3571
|
return;
|
|
3578
3572
|
}
|
|
3579
3573
|
}
|
|
3580
3574
|
await deleteZeroVariable(name);
|
|
3581
|
-
console.log(
|
|
3575
|
+
console.log(chalk46.green(`\u2713 Variable "${name}" deleted`));
|
|
3582
3576
|
})
|
|
3583
3577
|
);
|
|
3584
3578
|
|
|
3585
3579
|
// src/commands/zero/variable/index.ts
|
|
3586
|
-
var zeroVariableCommand = new
|
|
3580
|
+
var zeroVariableCommand = new Command59().name("variable").description("Read or write non-sensitive configuration values").addCommand(listCommand9).addCommand(setCommand5).addCommand(deleteCommand5);
|
|
3587
3581
|
|
|
3588
3582
|
// src/commands/zero/whoami.ts
|
|
3589
|
-
import { Command as
|
|
3590
|
-
import
|
|
3583
|
+
import { Command as Command60 } from "commander";
|
|
3584
|
+
import chalk47 from "chalk";
|
|
3591
3585
|
function isInsideSandbox() {
|
|
3592
3586
|
return !!process.env.ZERO_AGENT_ID;
|
|
3593
3587
|
}
|
|
@@ -3595,11 +3589,11 @@ async function showSandboxInfo() {
|
|
|
3595
3589
|
const agentId = process.env.ZERO_AGENT_ID;
|
|
3596
3590
|
const payload = decodeZeroTokenPayload();
|
|
3597
3591
|
console.log(`Agent ID: ${agentId}`);
|
|
3598
|
-
console.log(`Run ID: ${payload?.runId ??
|
|
3599
|
-
console.log(`Org ID: ${payload?.orgId ??
|
|
3592
|
+
console.log(`Run ID: ${payload?.runId ?? chalk47.dim("unavailable")}`);
|
|
3593
|
+
console.log(`Org ID: ${payload?.orgId ?? chalk47.dim("unavailable")}`);
|
|
3600
3594
|
if (payload?.capabilities?.length) {
|
|
3601
3595
|
console.log();
|
|
3602
|
-
console.log(
|
|
3596
|
+
console.log(chalk47.bold("Capabilities:"));
|
|
3603
3597
|
console.log(` ${payload.capabilities.join(", ")}`);
|
|
3604
3598
|
}
|
|
3605
3599
|
}
|
|
@@ -3607,23 +3601,23 @@ async function showLocalInfo() {
|
|
|
3607
3601
|
const token = await getToken();
|
|
3608
3602
|
const apiUrl = await getApiUrl();
|
|
3609
3603
|
const activeOrg = await getActiveOrg();
|
|
3610
|
-
console.log(
|
|
3604
|
+
console.log(chalk47.bold("Auth:"));
|
|
3611
3605
|
if (token) {
|
|
3612
3606
|
const tokenSource = process.env.ZERO_TOKEN ? "ZERO_TOKEN env var" : process.env.VM0_TOKEN ? "VM0_TOKEN env var" : "config file";
|
|
3613
3607
|
console.log(
|
|
3614
|
-
` Status: ${
|
|
3608
|
+
` Status: ${chalk47.green("Authenticated")} (via ${tokenSource})`
|
|
3615
3609
|
);
|
|
3616
3610
|
} else {
|
|
3617
|
-
console.log(` Status: ${
|
|
3611
|
+
console.log(` Status: ${chalk47.dim("Not authenticated")}`);
|
|
3618
3612
|
}
|
|
3619
3613
|
console.log(` API: ${apiUrl}`);
|
|
3620
3614
|
console.log();
|
|
3621
3615
|
if (activeOrg) {
|
|
3622
|
-
console.log(
|
|
3616
|
+
console.log(chalk47.bold("Org:"));
|
|
3623
3617
|
console.log(` Active: ${activeOrg}`);
|
|
3624
3618
|
}
|
|
3625
3619
|
}
|
|
3626
|
-
var zeroWhoamiCommand = new
|
|
3620
|
+
var zeroWhoamiCommand = new Command60().name("whoami").description("Show agent identity, run ID, and capabilities").addHelpText(
|
|
3627
3621
|
"after",
|
|
3628
3622
|
`
|
|
3629
3623
|
Examples:
|
|
@@ -3643,11 +3637,11 @@ Notes:
|
|
|
3643
3637
|
);
|
|
3644
3638
|
|
|
3645
3639
|
// src/commands/zero/ask-user/index.ts
|
|
3646
|
-
import { Command as
|
|
3640
|
+
import { Command as Command62 } from "commander";
|
|
3647
3641
|
|
|
3648
3642
|
// src/commands/zero/ask-user/question.ts
|
|
3649
|
-
import { Command as
|
|
3650
|
-
import
|
|
3643
|
+
import { Command as Command61 } from "commander";
|
|
3644
|
+
import chalk48 from "chalk";
|
|
3651
3645
|
function collectOption(value, previous) {
|
|
3652
3646
|
const list = previous ?? [];
|
|
3653
3647
|
list.push({ label: value });
|
|
@@ -3658,7 +3652,7 @@ function collectDesc(value, previous) {
|
|
|
3658
3652
|
list.push(value);
|
|
3659
3653
|
return list;
|
|
3660
3654
|
}
|
|
3661
|
-
var questionCommand = new
|
|
3655
|
+
var questionCommand = new Command61().name("question").description("Ask the user a question and wait for the answer").argument("<question>", "The question to ask").option("--header <text>", "Short label displayed as chip/tag (max 12 chars)").option("--option <label>", "Add a choice option (repeatable)", collectOption).option(
|
|
3662
3656
|
"--desc <text>",
|
|
3663
3657
|
"Description for the preceding --option",
|
|
3664
3658
|
collectDesc
|
|
@@ -3714,7 +3708,7 @@ Notes:
|
|
|
3714
3708
|
questions: [questionItem]
|
|
3715
3709
|
});
|
|
3716
3710
|
console.error(
|
|
3717
|
-
|
|
3711
|
+
chalk48.dim(
|
|
3718
3712
|
`\u23F3 Waiting for user response... (pendingId: ${pendingId})`
|
|
3719
3713
|
)
|
|
3720
3714
|
);
|
|
@@ -3741,7 +3735,7 @@ Notes:
|
|
|
3741
3735
|
);
|
|
3742
3736
|
|
|
3743
3737
|
// src/commands/zero/ask-user/index.ts
|
|
3744
|
-
var zeroAskUserCommand = new
|
|
3738
|
+
var zeroAskUserCommand = new Command62().name("ask-user").description("Ask the user a question and wait for the answer").addCommand(questionCommand).addHelpText(
|
|
3745
3739
|
"after",
|
|
3746
3740
|
`
|
|
3747
3741
|
Examples:
|
|
@@ -3753,14 +3747,14 @@ Notes:
|
|
|
3753
3747
|
);
|
|
3754
3748
|
|
|
3755
3749
|
// src/commands/zero/skill/index.ts
|
|
3756
|
-
import { Command as
|
|
3750
|
+
import { Command as Command68 } from "commander";
|
|
3757
3751
|
|
|
3758
3752
|
// src/commands/zero/skill/create.ts
|
|
3759
|
-
import { Command as
|
|
3760
|
-
import { readFileSync as
|
|
3753
|
+
import { Command as Command63 } from "commander";
|
|
3754
|
+
import { readFileSync as readFileSync5, existsSync } from "fs";
|
|
3761
3755
|
import { join as join2 } from "path";
|
|
3762
|
-
import
|
|
3763
|
-
var createCommand2 = new
|
|
3756
|
+
import chalk49 from "chalk";
|
|
3757
|
+
var createCommand2 = new Command63().name("create").description("Create a custom skill in the organization").argument("<name>", "Skill name (lowercase alphanumeric with hyphens)").requiredOption("--dir <path>", "Path to directory containing SKILL.md").option("--display-name <name>", "Skill display name").option("--description <text>", "Skill description").addHelpText(
|
|
3764
3758
|
"after",
|
|
3765
3759
|
`
|
|
3766
3760
|
Examples:
|
|
@@ -3778,14 +3772,14 @@ Notes:
|
|
|
3778
3772
|
if (!existsSync(skillMdPath)) {
|
|
3779
3773
|
throw new Error(`SKILL.md not found in ${options.dir}`);
|
|
3780
3774
|
}
|
|
3781
|
-
const content =
|
|
3775
|
+
const content = readFileSync5(skillMdPath, "utf-8");
|
|
3782
3776
|
const skill = await createSkill({
|
|
3783
3777
|
name,
|
|
3784
3778
|
content,
|
|
3785
3779
|
displayName: options.displayName,
|
|
3786
3780
|
description: options.description
|
|
3787
3781
|
});
|
|
3788
|
-
console.log(
|
|
3782
|
+
console.log(chalk49.green(`\u2713 Skill "${skill.name}" created`));
|
|
3789
3783
|
console.log(` Name: ${skill.name}`);
|
|
3790
3784
|
if (skill.displayName) {
|
|
3791
3785
|
console.log(` Display Name: ${skill.displayName}`);
|
|
@@ -3798,11 +3792,11 @@ Notes:
|
|
|
3798
3792
|
);
|
|
3799
3793
|
|
|
3800
3794
|
// src/commands/zero/skill/edit.ts
|
|
3801
|
-
import { Command as
|
|
3802
|
-
import { readFileSync as
|
|
3795
|
+
import { Command as Command64 } from "commander";
|
|
3796
|
+
import { readFileSync as readFileSync6, existsSync as existsSync2 } from "fs";
|
|
3803
3797
|
import { join as join3 } from "path";
|
|
3804
|
-
import
|
|
3805
|
-
var editCommand2 = new
|
|
3798
|
+
import chalk50 from "chalk";
|
|
3799
|
+
var editCommand2 = new Command64().name("edit").description("Update a custom skill's content").argument("<name>", "Skill name").requiredOption(
|
|
3806
3800
|
"--dir <path>",
|
|
3807
3801
|
"Path to directory containing updated SKILL.md"
|
|
3808
3802
|
).addHelpText(
|
|
@@ -3816,16 +3810,16 @@ Examples:
|
|
|
3816
3810
|
if (!existsSync2(skillMdPath)) {
|
|
3817
3811
|
throw new Error(`SKILL.md not found in ${options.dir}`);
|
|
3818
3812
|
}
|
|
3819
|
-
const content =
|
|
3813
|
+
const content = readFileSync6(skillMdPath, "utf-8");
|
|
3820
3814
|
await updateSkill(name, { content });
|
|
3821
|
-
console.log(
|
|
3815
|
+
console.log(chalk50.green(`\u2713 Skill "${name}" updated`));
|
|
3822
3816
|
})
|
|
3823
3817
|
);
|
|
3824
3818
|
|
|
3825
3819
|
// src/commands/zero/skill/view.ts
|
|
3826
|
-
import { Command as
|
|
3827
|
-
import
|
|
3828
|
-
var viewCommand2 = new
|
|
3820
|
+
import { Command as Command65 } from "commander";
|
|
3821
|
+
import chalk51 from "chalk";
|
|
3822
|
+
var viewCommand2 = new Command65().name("view").description("View a custom skill").argument("<name>", "Skill name").addHelpText(
|
|
3829
3823
|
"after",
|
|
3830
3824
|
`
|
|
3831
3825
|
Examples:
|
|
@@ -3833,26 +3827,26 @@ Examples:
|
|
|
3833
3827
|
).action(
|
|
3834
3828
|
withErrorHandler(async (name) => {
|
|
3835
3829
|
const skill = await getSkill(name);
|
|
3836
|
-
console.log(
|
|
3837
|
-
if (skill.displayName) console.log(
|
|
3830
|
+
console.log(chalk51.bold(skill.name));
|
|
3831
|
+
if (skill.displayName) console.log(chalk51.dim(skill.displayName));
|
|
3838
3832
|
console.log();
|
|
3839
3833
|
console.log(`Name: ${skill.name}`);
|
|
3840
3834
|
if (skill.displayName) console.log(`Display Name: ${skill.displayName}`);
|
|
3841
3835
|
if (skill.description) console.log(`Description: ${skill.description}`);
|
|
3842
3836
|
console.log();
|
|
3843
3837
|
if (skill.content) {
|
|
3844
|
-
console.log(
|
|
3838
|
+
console.log(chalk51.dim("\u2500\u2500 SKILL.md \u2500\u2500"));
|
|
3845
3839
|
console.log(skill.content);
|
|
3846
3840
|
} else {
|
|
3847
|
-
console.log(
|
|
3841
|
+
console.log(chalk51.dim("No content"));
|
|
3848
3842
|
}
|
|
3849
3843
|
})
|
|
3850
3844
|
);
|
|
3851
3845
|
|
|
3852
3846
|
// src/commands/zero/skill/list.ts
|
|
3853
|
-
import { Command as
|
|
3854
|
-
import
|
|
3855
|
-
var listCommand10 = new
|
|
3847
|
+
import { Command as Command66 } from "commander";
|
|
3848
|
+
import chalk52 from "chalk";
|
|
3849
|
+
var listCommand10 = new Command66().name("list").alias("ls").description("List custom skills in the organization").addHelpText(
|
|
3856
3850
|
"after",
|
|
3857
3851
|
`
|
|
3858
3852
|
Examples:
|
|
@@ -3861,9 +3855,9 @@ Examples:
|
|
|
3861
3855
|
withErrorHandler(async () => {
|
|
3862
3856
|
const skills = await listSkills();
|
|
3863
3857
|
if (skills.length === 0) {
|
|
3864
|
-
console.log(
|
|
3858
|
+
console.log(chalk52.dim("No custom skills found"));
|
|
3865
3859
|
console.log(
|
|
3866
|
-
|
|
3860
|
+
chalk52.dim(" Create one with: zero skill create <name> --dir <path>")
|
|
3867
3861
|
);
|
|
3868
3862
|
return;
|
|
3869
3863
|
}
|
|
@@ -3884,7 +3878,7 @@ Examples:
|
|
|
3884
3878
|
"DISPLAY NAME".padEnd(displayWidth),
|
|
3885
3879
|
"DESCRIPTION"
|
|
3886
3880
|
].join(" ");
|
|
3887
|
-
console.log(
|
|
3881
|
+
console.log(chalk52.dim(header));
|
|
3888
3882
|
for (const skill of skills) {
|
|
3889
3883
|
const row = [
|
|
3890
3884
|
skill.name.padEnd(nameWidth),
|
|
@@ -3897,9 +3891,9 @@ Examples:
|
|
|
3897
3891
|
);
|
|
3898
3892
|
|
|
3899
3893
|
// src/commands/zero/skill/delete.ts
|
|
3900
|
-
import { Command as
|
|
3901
|
-
import
|
|
3902
|
-
var deleteCommand6 = new
|
|
3894
|
+
import { Command as Command67 } from "commander";
|
|
3895
|
+
import chalk53 from "chalk";
|
|
3896
|
+
var deleteCommand6 = new Command67().name("delete").alias("rm").description("Delete a custom skill from the organization").argument("<name>", "Skill name").option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
3903
3897
|
"after",
|
|
3904
3898
|
`
|
|
3905
3899
|
Examples:
|
|
@@ -3921,17 +3915,17 @@ Notes:
|
|
|
3921
3915
|
false
|
|
3922
3916
|
);
|
|
3923
3917
|
if (!confirmed) {
|
|
3924
|
-
console.log(
|
|
3918
|
+
console.log(chalk53.dim("Cancelled"));
|
|
3925
3919
|
return;
|
|
3926
3920
|
}
|
|
3927
3921
|
}
|
|
3928
3922
|
await deleteSkill(name);
|
|
3929
|
-
console.log(
|
|
3923
|
+
console.log(chalk53.green(`\u2713 Skill "${name}" deleted`));
|
|
3930
3924
|
})
|
|
3931
3925
|
);
|
|
3932
3926
|
|
|
3933
3927
|
// src/commands/zero/skill/index.ts
|
|
3934
|
-
var zeroSkillCommand = new
|
|
3928
|
+
var zeroSkillCommand = new Command68("skill").description("Manage custom skills").addCommand(createCommand2).addCommand(editCommand2).addCommand(viewCommand2).addCommand(listCommand10).addCommand(deleteCommand6).addHelpText(
|
|
3935
3929
|
"after",
|
|
3936
3930
|
`
|
|
3937
3931
|
Examples:
|
|
@@ -3987,10 +3981,10 @@ function registerZeroCommands(prog, commands) {
|
|
|
3987
3981
|
prog.addCommand(cmd, hidden ? { hidden: true } : {});
|
|
3988
3982
|
}
|
|
3989
3983
|
}
|
|
3990
|
-
var program = new
|
|
3984
|
+
var program = new Command69();
|
|
3991
3985
|
program.name("zero").description(
|
|
3992
3986
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
3993
|
-
).version("9.
|
|
3987
|
+
).version("9.93.0").addHelpText(
|
|
3994
3988
|
"after",
|
|
3995
3989
|
`
|
|
3996
3990
|
Examples:
|