@vm0/cli 9.85.1 → 9.86.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-FEUDHROP.js → chunk-MAYVCUG7.js} +804 -12
- package/chunk-MAYVCUG7.js.map +1 -0
- package/index.js +253 -993
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +326 -139
- package/zero.js.map +1 -1
- package/chunk-FEUDHROP.js.map +0 -1
package/zero.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ApiRequestError,
|
|
4
4
|
CONNECTOR_TYPES,
|
|
5
|
+
EventRenderer,
|
|
5
6
|
MODEL_PROVIDER_TYPES,
|
|
6
7
|
allowsCustomModel,
|
|
7
8
|
configureGlobalProxyFromEnv,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
createZeroAgent,
|
|
10
11
|
createZeroComputerConnector,
|
|
11
12
|
createZeroConnectorSession,
|
|
13
|
+
createZeroRun,
|
|
12
14
|
decodeZeroTokenPayload,
|
|
13
15
|
deleteZeroAgent,
|
|
14
16
|
deleteZeroComputerConnector,
|
|
@@ -44,6 +46,8 @@ import {
|
|
|
44
46
|
getZeroConnectorSession,
|
|
45
47
|
getZeroOrg,
|
|
46
48
|
getZeroOrgMembers,
|
|
49
|
+
getZeroRun,
|
|
50
|
+
getZeroRunAgentEvents,
|
|
47
51
|
getZeroUserPreferences,
|
|
48
52
|
hasAuthMethods,
|
|
49
53
|
hasModelSelection,
|
|
@@ -51,6 +55,7 @@ import {
|
|
|
51
55
|
inviteZeroOrgMember,
|
|
52
56
|
isFeatureEnabled,
|
|
53
57
|
isInteractive,
|
|
58
|
+
isUUID,
|
|
54
59
|
leaveZeroOrg,
|
|
55
60
|
listZeroAgents,
|
|
56
61
|
listZeroConnectors,
|
|
@@ -61,12 +66,14 @@ import {
|
|
|
61
66
|
listZeroSchedules,
|
|
62
67
|
listZeroSecrets,
|
|
63
68
|
listZeroVariables,
|
|
69
|
+
parseEvent,
|
|
64
70
|
postAskUserQuestion,
|
|
65
71
|
promptConfirm,
|
|
66
72
|
promptPassword,
|
|
67
73
|
promptSelect,
|
|
68
74
|
promptText,
|
|
69
75
|
removeZeroOrgMember,
|
|
76
|
+
renderRunCreated,
|
|
70
77
|
resolveCompose,
|
|
71
78
|
resolveZeroScheduleByAgent,
|
|
72
79
|
saveConfig,
|
|
@@ -84,10 +91,10 @@ import {
|
|
|
84
91
|
updateZeroUserPreferences,
|
|
85
92
|
upsertZeroOrgModelProvider,
|
|
86
93
|
withErrorHandler
|
|
87
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-MAYVCUG7.js";
|
|
88
95
|
|
|
89
96
|
// src/zero.ts
|
|
90
|
-
import { Command as
|
|
97
|
+
import { Command as Command61 } from "commander";
|
|
91
98
|
|
|
92
99
|
// src/commands/zero/org/index.ts
|
|
93
100
|
import { Command as Command23 } from "commander";
|
|
@@ -1955,12 +1962,184 @@ var zeroPreferenceCommand = new Command37().name("preference").description("View
|
|
|
1955
1962
|
})
|
|
1956
1963
|
);
|
|
1957
1964
|
|
|
1965
|
+
// src/commands/zero/run/run.ts
|
|
1966
|
+
import { Command as Command38 } from "commander";
|
|
1967
|
+
|
|
1968
|
+
// src/commands/zero/run/shared.ts
|
|
1969
|
+
import chalk32 from "chalk";
|
|
1970
|
+
function toRunResult(result) {
|
|
1971
|
+
const { checkpointId, agentSessionId, conversationId } = result;
|
|
1972
|
+
if (!checkpointId || !agentSessionId || !conversationId) {
|
|
1973
|
+
return void 0;
|
|
1974
|
+
}
|
|
1975
|
+
return { checkpointId, agentSessionId, conversationId };
|
|
1976
|
+
}
|
|
1977
|
+
async function pollZeroEvents(runId, options) {
|
|
1978
|
+
const renderer = new EventRenderer({ verbose: options?.verbose });
|
|
1979
|
+
let lastSequence = -1;
|
|
1980
|
+
let complete = false;
|
|
1981
|
+
let result = { succeeded: true, runId };
|
|
1982
|
+
const pollIntervalMs = 1e3;
|
|
1983
|
+
while (!complete) {
|
|
1984
|
+
const eventsResponse = await getZeroRunAgentEvents(runId, {
|
|
1985
|
+
since: lastSequence,
|
|
1986
|
+
limit: 100,
|
|
1987
|
+
order: "asc"
|
|
1988
|
+
});
|
|
1989
|
+
for (const event of eventsResponse.events) {
|
|
1990
|
+
const eventData = event.eventData;
|
|
1991
|
+
const parsed = parseEvent(eventData);
|
|
1992
|
+
if (parsed) {
|
|
1993
|
+
renderer.render(parsed);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
if (eventsResponse.events.length > 0) {
|
|
1997
|
+
lastSequence = Math.max(
|
|
1998
|
+
...eventsResponse.events.map((e) => e.sequenceNumber)
|
|
1999
|
+
);
|
|
2000
|
+
}
|
|
2001
|
+
const runResponse = await getZeroRun(runId);
|
|
2002
|
+
const runStatus = runResponse.status;
|
|
2003
|
+
if (runStatus === "completed") {
|
|
2004
|
+
complete = true;
|
|
2005
|
+
EventRenderer.renderRunCompleted(
|
|
2006
|
+
runResponse.result ? toRunResult(runResponse.result) : void 0
|
|
2007
|
+
);
|
|
2008
|
+
result = {
|
|
2009
|
+
succeeded: true,
|
|
2010
|
+
runId,
|
|
2011
|
+
sessionId: runResponse.result?.agentSessionId,
|
|
2012
|
+
checkpointId: runResponse.result?.checkpointId
|
|
2013
|
+
};
|
|
2014
|
+
} else if (runStatus === "failed") {
|
|
2015
|
+
complete = true;
|
|
2016
|
+
EventRenderer.renderRunFailed(runResponse.error, runId);
|
|
2017
|
+
result = { succeeded: false, runId };
|
|
2018
|
+
} else if (runStatus === "timeout") {
|
|
2019
|
+
complete = true;
|
|
2020
|
+
console.error(chalk32.red("\n\u2717 Run timed out"));
|
|
2021
|
+
result = { succeeded: false, runId };
|
|
2022
|
+
} else if (runStatus === "cancelled") {
|
|
2023
|
+
complete = true;
|
|
2024
|
+
console.error(chalk32.yellow("\n\u2717 Run cancelled"));
|
|
2025
|
+
result = { succeeded: false, runId };
|
|
2026
|
+
}
|
|
2027
|
+
if (!complete) {
|
|
2028
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
return result;
|
|
2032
|
+
}
|
|
2033
|
+
function showZeroNextSteps(result) {
|
|
2034
|
+
const { sessionId } = result;
|
|
2035
|
+
console.log();
|
|
2036
|
+
if (sessionId) {
|
|
2037
|
+
console.log(" Continue delegation:");
|
|
2038
|
+
console.log(
|
|
2039
|
+
chalk32.cyan(` zero run continue ${sessionId} "your next prompt"`)
|
|
2040
|
+
);
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
// src/commands/zero/run/run.ts
|
|
2045
|
+
var mainRunCommand = new Command38().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(
|
|
2046
|
+
"--append-system-prompt <text>",
|
|
2047
|
+
"Append text to the agent's system prompt"
|
|
2048
|
+
).option(
|
|
2049
|
+
"--model-provider <type>",
|
|
2050
|
+
"Override model provider (e.g., anthropic-api-key)"
|
|
2051
|
+
).option("--verbose", "Show full tool inputs and outputs").action(
|
|
2052
|
+
withErrorHandler(
|
|
2053
|
+
async (agentId, prompt, options) => {
|
|
2054
|
+
if (!isUUID(agentId)) {
|
|
2055
|
+
throw new Error(`Invalid agent ID format: ${agentId}`, {
|
|
2056
|
+
cause: new Error(
|
|
2057
|
+
"Agent ID must be a valid UUID. Use `zero agent list` to find agent IDs."
|
|
2058
|
+
)
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
const response = await createZeroRun({
|
|
2062
|
+
agentId,
|
|
2063
|
+
prompt,
|
|
2064
|
+
appendSystemPrompt: options.appendSystemPrompt,
|
|
2065
|
+
modelProvider: options.modelProvider
|
|
2066
|
+
});
|
|
2067
|
+
if (response.status === "failed") {
|
|
2068
|
+
throw new Error(
|
|
2069
|
+
"Run preparation failed",
|
|
2070
|
+
response.error ? { cause: new Error(response.error) } : void 0
|
|
2071
|
+
);
|
|
2072
|
+
}
|
|
2073
|
+
renderRunCreated(response);
|
|
2074
|
+
const result = await pollZeroEvents(response.runId, {
|
|
2075
|
+
verbose: options.verbose
|
|
2076
|
+
});
|
|
2077
|
+
if (!result.succeeded) {
|
|
2078
|
+
throw new Error("Run failed");
|
|
2079
|
+
}
|
|
2080
|
+
showZeroNextSteps(result);
|
|
2081
|
+
}
|
|
2082
|
+
)
|
|
2083
|
+
);
|
|
2084
|
+
|
|
2085
|
+
// src/commands/zero/run/continue.ts
|
|
2086
|
+
import { Command as Command39 } from "commander";
|
|
2087
|
+
var continueCommand = new Command39().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(
|
|
2088
|
+
"--append-system-prompt <text>",
|
|
2089
|
+
"Append text to the agent's system prompt"
|
|
2090
|
+
).option(
|
|
2091
|
+
"--model-provider <type>",
|
|
2092
|
+
"Override model provider (e.g., anthropic-api-key)"
|
|
2093
|
+
).option("--verbose", "Show full tool inputs and outputs").action(
|
|
2094
|
+
withErrorHandler(
|
|
2095
|
+
async (sessionId, prompt, options) => {
|
|
2096
|
+
if (!isUUID(sessionId)) {
|
|
2097
|
+
throw new Error(`Invalid session ID format: ${sessionId}`, {
|
|
2098
|
+
cause: new Error("Session ID must be a valid UUID")
|
|
2099
|
+
});
|
|
2100
|
+
}
|
|
2101
|
+
const response = await createZeroRun({
|
|
2102
|
+
sessionId,
|
|
2103
|
+
prompt,
|
|
2104
|
+
appendSystemPrompt: options.appendSystemPrompt,
|
|
2105
|
+
modelProvider: options.modelProvider
|
|
2106
|
+
});
|
|
2107
|
+
if (response.status === "failed") {
|
|
2108
|
+
throw new Error(
|
|
2109
|
+
"Run preparation failed",
|
|
2110
|
+
response.error ? { cause: new Error(response.error) } : void 0
|
|
2111
|
+
);
|
|
2112
|
+
}
|
|
2113
|
+
renderRunCreated(response);
|
|
2114
|
+
const result = await pollZeroEvents(response.runId, {
|
|
2115
|
+
verbose: options.verbose
|
|
2116
|
+
});
|
|
2117
|
+
if (!result.succeeded) {
|
|
2118
|
+
throw new Error("Run failed");
|
|
2119
|
+
}
|
|
2120
|
+
showZeroNextSteps(result);
|
|
2121
|
+
}
|
|
2122
|
+
)
|
|
2123
|
+
);
|
|
2124
|
+
|
|
2125
|
+
// src/commands/zero/run/index.ts
|
|
2126
|
+
mainRunCommand.addCommand(continueCommand);
|
|
2127
|
+
mainRunCommand.addHelpText(
|
|
2128
|
+
"after",
|
|
2129
|
+
`
|
|
2130
|
+
Delegation workflow:
|
|
2131
|
+
Discover teammates: zero agent list
|
|
2132
|
+
Delegate a task: zero run <agent-id> "your task"
|
|
2133
|
+
Continue delegation: zero run continue <session-id> "follow up"`
|
|
2134
|
+
);
|
|
2135
|
+
var zeroRunCommand = mainRunCommand;
|
|
2136
|
+
|
|
1958
2137
|
// src/commands/zero/schedule/index.ts
|
|
1959
|
-
import { Command as
|
|
2138
|
+
import { Command as Command46 } from "commander";
|
|
1960
2139
|
|
|
1961
2140
|
// src/commands/zero/schedule/setup.ts
|
|
1962
|
-
import { Command as
|
|
1963
|
-
import
|
|
2141
|
+
import { Command as Command40 } from "commander";
|
|
2142
|
+
import chalk33 from "chalk";
|
|
1964
2143
|
var FREQUENCY_CHOICES = [
|
|
1965
2144
|
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
1966
2145
|
{
|
|
@@ -2170,7 +2349,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
2170
2349
|
userTimezone = prefs.timezone;
|
|
2171
2350
|
} catch {
|
|
2172
2351
|
console.log(
|
|
2173
|
-
|
|
2352
|
+
chalk33.dim("Could not fetch timezone preference, using detected timezone")
|
|
2174
2353
|
);
|
|
2175
2354
|
}
|
|
2176
2355
|
const defaultTimezone = userTimezone || detectTimezone();
|
|
@@ -2295,7 +2474,7 @@ async function buildAndDeploy(params) {
|
|
|
2295
2474
|
}
|
|
2296
2475
|
console.log(
|
|
2297
2476
|
`
|
|
2298
|
-
Deploying schedule for agent ${
|
|
2477
|
+
Deploying schedule for agent ${chalk33.cyan(params.agentName)}...`
|
|
2299
2478
|
);
|
|
2300
2479
|
const deployResult = await deployZeroSchedule({
|
|
2301
2480
|
name: params.scheduleName,
|
|
@@ -2317,58 +2496,58 @@ Deploying schedule for agent ${chalk32.cyan(params.agentName)}...`
|
|
|
2317
2496
|
}
|
|
2318
2497
|
function displayDeployResult(scheduleName, deployResult) {
|
|
2319
2498
|
if (deployResult.created) {
|
|
2320
|
-
console.log(
|
|
2499
|
+
console.log(chalk33.green(`\u2713 Schedule "${scheduleName}" created`));
|
|
2321
2500
|
} else {
|
|
2322
|
-
console.log(
|
|
2501
|
+
console.log(chalk33.green(`\u2713 Schedule "${scheduleName}" updated`));
|
|
2323
2502
|
}
|
|
2324
|
-
console.log(
|
|
2503
|
+
console.log(chalk33.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
2325
2504
|
if (deployResult.schedule.triggerType === "loop" && deployResult.schedule.intervalSeconds != null) {
|
|
2326
2505
|
console.log(
|
|
2327
|
-
|
|
2506
|
+
chalk33.dim(
|
|
2328
2507
|
` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`
|
|
2329
2508
|
)
|
|
2330
2509
|
);
|
|
2331
2510
|
} else if (deployResult.schedule.cronExpression) {
|
|
2332
|
-
console.log(
|
|
2511
|
+
console.log(chalk33.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
2333
2512
|
if (deployResult.schedule.nextRunAt) {
|
|
2334
2513
|
const nextRun = formatInTimezone(
|
|
2335
2514
|
deployResult.schedule.nextRunAt,
|
|
2336
2515
|
deployResult.schedule.timezone
|
|
2337
2516
|
);
|
|
2338
|
-
console.log(
|
|
2517
|
+
console.log(chalk33.dim(` Next run: ${nextRun}`));
|
|
2339
2518
|
}
|
|
2340
2519
|
} else if (deployResult.schedule.atTime) {
|
|
2341
2520
|
const atTimeFormatted = formatInTimezone(
|
|
2342
2521
|
deployResult.schedule.atTime,
|
|
2343
2522
|
deployResult.schedule.timezone
|
|
2344
2523
|
);
|
|
2345
|
-
console.log(
|
|
2524
|
+
console.log(chalk33.dim(` At: ${atTimeFormatted}`));
|
|
2346
2525
|
}
|
|
2347
2526
|
}
|
|
2348
2527
|
async function tryEnableSchedule(scheduleName, agentId, agentName) {
|
|
2349
2528
|
try {
|
|
2350
2529
|
await enableZeroSchedule({ name: scheduleName, agentId });
|
|
2351
|
-
console.log(
|
|
2530
|
+
console.log(chalk33.green(`\u2713 Schedule "${scheduleName}" enabled`));
|
|
2352
2531
|
} catch (error) {
|
|
2353
|
-
console.error(
|
|
2532
|
+
console.error(chalk33.yellow("\u26A0 Failed to enable schedule"));
|
|
2354
2533
|
if (error instanceof ApiRequestError) {
|
|
2355
2534
|
if (error.code === "SCHEDULE_PAST") {
|
|
2356
|
-
console.error(
|
|
2535
|
+
console.error(chalk33.dim(" Scheduled time has already passed"));
|
|
2357
2536
|
} else {
|
|
2358
|
-
console.error(
|
|
2537
|
+
console.error(chalk33.dim(` ${error.message}`));
|
|
2359
2538
|
}
|
|
2360
2539
|
} else if (error instanceof Error) {
|
|
2361
|
-
console.error(
|
|
2540
|
+
console.error(chalk33.dim(` ${error.message}`));
|
|
2362
2541
|
}
|
|
2363
2542
|
console.log(
|
|
2364
|
-
` To enable manually: ${
|
|
2543
|
+
` To enable manually: ${chalk33.cyan(`zero schedule enable ${agentName}`)}`
|
|
2365
2544
|
);
|
|
2366
2545
|
}
|
|
2367
2546
|
}
|
|
2368
2547
|
function showEnableHint(agentName) {
|
|
2369
2548
|
console.log();
|
|
2370
2549
|
console.log(
|
|
2371
|
-
` To enable: ${
|
|
2550
|
+
` To enable: ${chalk33.cyan(`zero schedule enable ${agentName}`)}`
|
|
2372
2551
|
);
|
|
2373
2552
|
}
|
|
2374
2553
|
async function handleScheduleEnabling(params) {
|
|
@@ -2390,7 +2569,7 @@ async function handleScheduleEnabling(params) {
|
|
|
2390
2569
|
showEnableHint(agentName);
|
|
2391
2570
|
}
|
|
2392
2571
|
}
|
|
2393
|
-
var setupCommand2 = new
|
|
2572
|
+
var setupCommand2 = new Command40().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("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").option("--notify-email", "Enable email notifications (default: true)").option("--no-notify-email", "Disable email notifications").option("--notify-slack", "Enable Slack notifications (default: true)").option("--no-notify-slack", "Disable Slack notifications").action(
|
|
2394
2573
|
withErrorHandler(async (agentIdentifier, options) => {
|
|
2395
2574
|
const compose = await resolveCompose(agentIdentifier);
|
|
2396
2575
|
if (!compose) {
|
|
@@ -2404,7 +2583,7 @@ var setupCommand2 = new Command38().name("setup").description("Create or edit a
|
|
|
2404
2583
|
);
|
|
2405
2584
|
const agentName = compose.name;
|
|
2406
2585
|
console.log(
|
|
2407
|
-
|
|
2586
|
+
chalk33.dim(
|
|
2408
2587
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
2409
2588
|
)
|
|
2410
2589
|
);
|
|
@@ -2414,12 +2593,12 @@ var setupCommand2 = new Command38().name("setup").description("Create or edit a
|
|
|
2414
2593
|
defaults.frequency
|
|
2415
2594
|
);
|
|
2416
2595
|
if (!frequency) {
|
|
2417
|
-
console.log(
|
|
2596
|
+
console.log(chalk33.dim("Cancelled"));
|
|
2418
2597
|
return;
|
|
2419
2598
|
}
|
|
2420
2599
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
2421
2600
|
if (!timing) {
|
|
2422
|
-
console.log(
|
|
2601
|
+
console.log(chalk33.dim("Cancelled"));
|
|
2423
2602
|
return;
|
|
2424
2603
|
}
|
|
2425
2604
|
const { day, time, atTime, intervalSeconds } = timing;
|
|
@@ -2428,7 +2607,7 @@ var setupCommand2 = new Command38().name("setup").description("Create or edit a
|
|
|
2428
2607
|
existingSchedule?.timezone
|
|
2429
2608
|
);
|
|
2430
2609
|
if (!timezone) {
|
|
2431
|
-
console.log(
|
|
2610
|
+
console.log(chalk33.dim("Cancelled"));
|
|
2432
2611
|
return;
|
|
2433
2612
|
}
|
|
2434
2613
|
const promptText_ = await gatherPromptText(
|
|
@@ -2436,7 +2615,7 @@ var setupCommand2 = new Command38().name("setup").description("Create or edit a
|
|
|
2436
2615
|
existingSchedule?.prompt
|
|
2437
2616
|
);
|
|
2438
2617
|
if (!promptText_) {
|
|
2439
|
-
console.log(
|
|
2618
|
+
console.log(chalk33.dim("Cancelled"));
|
|
2440
2619
|
return;
|
|
2441
2620
|
}
|
|
2442
2621
|
const { notifyEmail, notifySlack } = await gatherNotificationPreferences(
|
|
@@ -2472,15 +2651,15 @@ var setupCommand2 = new Command38().name("setup").description("Create or edit a
|
|
|
2472
2651
|
);
|
|
2473
2652
|
|
|
2474
2653
|
// src/commands/zero/schedule/list.ts
|
|
2475
|
-
import { Command as
|
|
2476
|
-
import
|
|
2477
|
-
var listCommand7 = new
|
|
2654
|
+
import { Command as Command41 } from "commander";
|
|
2655
|
+
import chalk34 from "chalk";
|
|
2656
|
+
var listCommand7 = new Command41().name("list").alias("ls").description("List all zero schedules").action(
|
|
2478
2657
|
withErrorHandler(async () => {
|
|
2479
2658
|
const result = await listZeroSchedules();
|
|
2480
2659
|
if (result.schedules.length === 0) {
|
|
2481
|
-
console.log(
|
|
2660
|
+
console.log(chalk34.dim("No schedules found"));
|
|
2482
2661
|
console.log(
|
|
2483
|
-
|
|
2662
|
+
chalk34.dim(" Create one with: zero schedule setup <agent-id>")
|
|
2484
2663
|
);
|
|
2485
2664
|
return;
|
|
2486
2665
|
}
|
|
@@ -2505,10 +2684,10 @@ var listCommand7 = new Command39().name("list").alias("ls").description("List al
|
|
|
2505
2684
|
"STATUS".padEnd(8),
|
|
2506
2685
|
"NEXT RUN"
|
|
2507
2686
|
].join(" ");
|
|
2508
|
-
console.log(
|
|
2687
|
+
console.log(chalk34.dim(header));
|
|
2509
2688
|
for (const schedule of result.schedules) {
|
|
2510
2689
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
2511
|
-
const status = schedule.enabled ?
|
|
2690
|
+
const status = schedule.enabled ? chalk34.green("enabled") : chalk34.yellow("disabled");
|
|
2512
2691
|
const nextRun = schedule.enabled ? formatRelativeTime(schedule.nextRunAt) : "-";
|
|
2513
2692
|
const row = [
|
|
2514
2693
|
schedule.agentId.padEnd(agentWidth),
|
|
@@ -2523,33 +2702,33 @@ var listCommand7 = new Command39().name("list").alias("ls").description("List al
|
|
|
2523
2702
|
);
|
|
2524
2703
|
|
|
2525
2704
|
// src/commands/zero/schedule/status.ts
|
|
2526
|
-
import { Command as
|
|
2527
|
-
import
|
|
2705
|
+
import { Command as Command42 } from "commander";
|
|
2706
|
+
import chalk35 from "chalk";
|
|
2528
2707
|
function formatDateTimeStyled(dateStr) {
|
|
2529
|
-
if (!dateStr) return
|
|
2708
|
+
if (!dateStr) return chalk35.dim("-");
|
|
2530
2709
|
const formatted = formatDateTime(dateStr);
|
|
2531
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
2710
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk35.dim("($1)"));
|
|
2532
2711
|
}
|
|
2533
2712
|
function formatTrigger(schedule) {
|
|
2534
2713
|
if (schedule.triggerType === "loop" && schedule.intervalSeconds !== null) {
|
|
2535
|
-
return `interval ${schedule.intervalSeconds}s ${
|
|
2714
|
+
return `interval ${schedule.intervalSeconds}s ${chalk35.dim("(loop)")}`;
|
|
2536
2715
|
}
|
|
2537
2716
|
if (schedule.cronExpression) {
|
|
2538
2717
|
return schedule.cronExpression;
|
|
2539
2718
|
}
|
|
2540
2719
|
if (schedule.atTime) {
|
|
2541
|
-
return `${schedule.atTime} ${
|
|
2720
|
+
return `${schedule.atTime} ${chalk35.dim("(one-time)")}`;
|
|
2542
2721
|
}
|
|
2543
|
-
return
|
|
2722
|
+
return chalk35.dim("-");
|
|
2544
2723
|
}
|
|
2545
2724
|
function printRunConfiguration(schedule) {
|
|
2546
|
-
const statusText = schedule.enabled ?
|
|
2725
|
+
const statusText = schedule.enabled ? chalk35.green("enabled") : chalk35.yellow("disabled");
|
|
2547
2726
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
2548
2727
|
console.log(
|
|
2549
|
-
`${"Agent:".padEnd(16)}${schedule.agentId} ${
|
|
2728
|
+
`${"Agent:".padEnd(16)}${schedule.agentId} ${chalk35.dim(`(${schedule.orgSlug})`)}`
|
|
2550
2729
|
);
|
|
2551
2730
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
2552
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
2731
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk35.dim(promptPreview)}`);
|
|
2553
2732
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
2554
2733
|
console.log(
|
|
2555
2734
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -2578,11 +2757,11 @@ function printTimeSchedule(schedule) {
|
|
|
2578
2757
|
);
|
|
2579
2758
|
}
|
|
2580
2759
|
if (schedule.triggerType === "loop") {
|
|
2581
|
-
const failureText = schedule.consecutiveFailures > 0 ?
|
|
2760
|
+
const failureText = schedule.consecutiveFailures > 0 ? chalk35.yellow(`${schedule.consecutiveFailures}/3`) : chalk35.dim("0/3");
|
|
2582
2761
|
console.log(`${"Failures:".padEnd(16)}${failureText}`);
|
|
2583
2762
|
}
|
|
2584
2763
|
}
|
|
2585
|
-
var statusCommand3 = new
|
|
2764
|
+
var statusCommand3 = new Command42().name("status").description("Show detailed status of a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
2586
2765
|
"-n, --name <schedule-name>",
|
|
2587
2766
|
"Schedule name (required when agent has multiple schedules)"
|
|
2588
2767
|
).action(
|
|
@@ -2592,8 +2771,8 @@ var statusCommand3 = new Command40().name("status").description("Show detailed s
|
|
|
2592
2771
|
options.name
|
|
2593
2772
|
);
|
|
2594
2773
|
console.log();
|
|
2595
|
-
console.log(`Schedule for agent: ${
|
|
2596
|
-
console.log(
|
|
2774
|
+
console.log(`Schedule for agent: ${chalk35.cyan(agentName)}`);
|
|
2775
|
+
console.log(chalk35.dim("\u2501".repeat(50)));
|
|
2597
2776
|
printRunConfiguration(schedule);
|
|
2598
2777
|
printTimeSchedule(schedule);
|
|
2599
2778
|
console.log();
|
|
@@ -2601,9 +2780,9 @@ var statusCommand3 = new Command40().name("status").description("Show detailed s
|
|
|
2601
2780
|
);
|
|
2602
2781
|
|
|
2603
2782
|
// src/commands/zero/schedule/delete.ts
|
|
2604
|
-
import { Command as
|
|
2605
|
-
import
|
|
2606
|
-
var deleteCommand3 = new
|
|
2783
|
+
import { Command as Command43 } from "commander";
|
|
2784
|
+
import chalk36 from "chalk";
|
|
2785
|
+
var deleteCommand3 = new Command43().name("delete").alias("rm").description("Delete a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
2607
2786
|
"-n, --name <schedule-name>",
|
|
2608
2787
|
"Schedule name (required when agent has multiple schedules)"
|
|
2609
2788
|
).option("-y, --yes", "Skip confirmation prompt").action(
|
|
@@ -2618,11 +2797,11 @@ var deleteCommand3 = new Command41().name("delete").alias("rm").description("Del
|
|
|
2618
2797
|
throw new Error("--yes flag is required in non-interactive mode");
|
|
2619
2798
|
}
|
|
2620
2799
|
const confirmed = await promptConfirm(
|
|
2621
|
-
`Delete schedule for agent ${
|
|
2800
|
+
`Delete schedule for agent ${chalk36.cyan(agentName)}?`,
|
|
2622
2801
|
false
|
|
2623
2802
|
);
|
|
2624
2803
|
if (!confirmed) {
|
|
2625
|
-
console.log(
|
|
2804
|
+
console.log(chalk36.dim("Cancelled"));
|
|
2626
2805
|
return;
|
|
2627
2806
|
}
|
|
2628
2807
|
}
|
|
@@ -2630,15 +2809,15 @@ var deleteCommand3 = new Command41().name("delete").alias("rm").description("Del
|
|
|
2630
2809
|
name: resolved.name,
|
|
2631
2810
|
agentId: resolved.agentId
|
|
2632
2811
|
});
|
|
2633
|
-
console.log(
|
|
2812
|
+
console.log(chalk36.green(`\u2713 Schedule "${resolved.name}" deleted`));
|
|
2634
2813
|
}
|
|
2635
2814
|
)
|
|
2636
2815
|
);
|
|
2637
2816
|
|
|
2638
2817
|
// src/commands/zero/schedule/enable.ts
|
|
2639
|
-
import { Command as
|
|
2640
|
-
import
|
|
2641
|
-
var enableCommand = new
|
|
2818
|
+
import { Command as Command44 } from "commander";
|
|
2819
|
+
import chalk37 from "chalk";
|
|
2820
|
+
var enableCommand = new Command44().name("enable").description("Enable a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
2642
2821
|
"-n, --name <schedule-name>",
|
|
2643
2822
|
"Schedule name (required when agent has multiple schedules)"
|
|
2644
2823
|
).action(
|
|
@@ -2651,14 +2830,14 @@ var enableCommand = new Command42().name("enable").description("Enable a zero sc
|
|
|
2651
2830
|
name: resolved.name,
|
|
2652
2831
|
agentId: resolved.agentId
|
|
2653
2832
|
});
|
|
2654
|
-
console.log(
|
|
2833
|
+
console.log(chalk37.green(`\u2713 Schedule "${resolved.name}" enabled`));
|
|
2655
2834
|
})
|
|
2656
2835
|
);
|
|
2657
2836
|
|
|
2658
2837
|
// src/commands/zero/schedule/disable.ts
|
|
2659
|
-
import { Command as
|
|
2660
|
-
import
|
|
2661
|
-
var disableCommand = new
|
|
2838
|
+
import { Command as Command45 } from "commander";
|
|
2839
|
+
import chalk38 from "chalk";
|
|
2840
|
+
var disableCommand = new Command45().name("disable").description("Disable a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
2662
2841
|
"-n, --name <schedule-name>",
|
|
2663
2842
|
"Schedule name (required when agent has multiple schedules)"
|
|
2664
2843
|
).action(
|
|
@@ -2671,75 +2850,75 @@ var disableCommand = new Command43().name("disable").description("Disable a zero
|
|
|
2671
2850
|
name: resolved.name,
|
|
2672
2851
|
agentId: resolved.agentId
|
|
2673
2852
|
});
|
|
2674
|
-
console.log(
|
|
2853
|
+
console.log(chalk38.green(`\u2713 Schedule "${resolved.name}" disabled`));
|
|
2675
2854
|
})
|
|
2676
2855
|
);
|
|
2677
2856
|
|
|
2678
2857
|
// src/commands/zero/schedule/index.ts
|
|
2679
|
-
var zeroScheduleCommand = new
|
|
2858
|
+
var zeroScheduleCommand = new Command46().name("schedule").description("Create or manage recurring scheduled tasks").addCommand(setupCommand2).addCommand(listCommand7).addCommand(statusCommand3).addCommand(deleteCommand3).addCommand(enableCommand).addCommand(disableCommand);
|
|
2680
2859
|
|
|
2681
2860
|
// src/commands/zero/secret/index.ts
|
|
2682
|
-
import { Command as
|
|
2861
|
+
import { Command as Command50 } from "commander";
|
|
2683
2862
|
|
|
2684
2863
|
// src/commands/zero/secret/list.ts
|
|
2685
|
-
import { Command as
|
|
2686
|
-
import
|
|
2687
|
-
var listCommand8 = new
|
|
2864
|
+
import { Command as Command47 } from "commander";
|
|
2865
|
+
import chalk39 from "chalk";
|
|
2866
|
+
var listCommand8 = new Command47().name("list").alias("ls").description("List all secrets").action(
|
|
2688
2867
|
withErrorHandler(async () => {
|
|
2689
2868
|
const result = await listZeroSecrets();
|
|
2690
2869
|
if (result.secrets.length === 0) {
|
|
2691
|
-
console.log(
|
|
2870
|
+
console.log(chalk39.dim("No secrets found"));
|
|
2692
2871
|
console.log();
|
|
2693
2872
|
console.log("To add a secret:");
|
|
2694
|
-
console.log(
|
|
2873
|
+
console.log(chalk39.cyan(" zero secret set MY_API_KEY --body <value>"));
|
|
2695
2874
|
return;
|
|
2696
2875
|
}
|
|
2697
|
-
console.log(
|
|
2876
|
+
console.log(chalk39.bold("Secrets:"));
|
|
2698
2877
|
console.log();
|
|
2699
2878
|
for (const secret of result.secrets) {
|
|
2700
2879
|
let typeIndicator = "";
|
|
2701
2880
|
let derivedLine = null;
|
|
2702
2881
|
if (secret.type === "model-provider") {
|
|
2703
|
-
typeIndicator =
|
|
2882
|
+
typeIndicator = chalk39.dim(" [model-provider]");
|
|
2704
2883
|
} else if (secret.type === "connector") {
|
|
2705
2884
|
const derived = getConnectorDerivedNames(secret.name);
|
|
2706
2885
|
if (derived) {
|
|
2707
|
-
typeIndicator =
|
|
2708
|
-
derivedLine =
|
|
2886
|
+
typeIndicator = chalk39.dim(` [${derived.connectorLabel} connector]`);
|
|
2887
|
+
derivedLine = chalk39.dim(
|
|
2709
2888
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
2710
2889
|
);
|
|
2711
2890
|
} else {
|
|
2712
|
-
typeIndicator =
|
|
2891
|
+
typeIndicator = chalk39.dim(" [connector]");
|
|
2713
2892
|
}
|
|
2714
2893
|
} else if (secret.type === "user") {
|
|
2715
2894
|
const derived = getConnectorDerivedNames(secret.name);
|
|
2716
2895
|
if (derived) {
|
|
2717
|
-
typeIndicator =
|
|
2718
|
-
derivedLine =
|
|
2896
|
+
typeIndicator = chalk39.dim(` [${derived.connectorLabel} connector]`);
|
|
2897
|
+
derivedLine = chalk39.dim(
|
|
2719
2898
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
2720
2899
|
);
|
|
2721
2900
|
}
|
|
2722
2901
|
}
|
|
2723
|
-
console.log(` ${
|
|
2902
|
+
console.log(` ${chalk39.cyan(secret.name)}${typeIndicator}`);
|
|
2724
2903
|
if (derivedLine) {
|
|
2725
2904
|
console.log(` ${derivedLine}`);
|
|
2726
2905
|
}
|
|
2727
2906
|
if (secret.description) {
|
|
2728
|
-
console.log(` ${
|
|
2907
|
+
console.log(` ${chalk39.dim(secret.description)}`);
|
|
2729
2908
|
}
|
|
2730
2909
|
console.log(
|
|
2731
|
-
` ${
|
|
2910
|
+
` ${chalk39.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
2732
2911
|
);
|
|
2733
2912
|
console.log();
|
|
2734
2913
|
}
|
|
2735
|
-
console.log(
|
|
2914
|
+
console.log(chalk39.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
2736
2915
|
})
|
|
2737
2916
|
);
|
|
2738
2917
|
|
|
2739
2918
|
// src/commands/zero/secret/set.ts
|
|
2740
|
-
import { Command as
|
|
2741
|
-
import
|
|
2742
|
-
var setCommand4 = new
|
|
2919
|
+
import { Command as Command48 } from "commander";
|
|
2920
|
+
import chalk40 from "chalk";
|
|
2921
|
+
var setCommand4 = new Command48().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
2743
2922
|
"-b, --body <value>",
|
|
2744
2923
|
"Secret value (required in non-interactive mode)"
|
|
2745
2924
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -2751,7 +2930,7 @@ var setCommand4 = new Command46().name("set").description("Create or update a se
|
|
|
2751
2930
|
} else if (isInteractive()) {
|
|
2752
2931
|
const prompted = await promptPassword("Enter secret value:");
|
|
2753
2932
|
if (prompted === void 0) {
|
|
2754
|
-
console.log(
|
|
2933
|
+
console.log(chalk40.dim("Cancelled"));
|
|
2755
2934
|
return;
|
|
2756
2935
|
}
|
|
2757
2936
|
value = prompted;
|
|
@@ -2779,15 +2958,15 @@ var setCommand4 = new Command46().name("set").description("Create or update a se
|
|
|
2779
2958
|
}
|
|
2780
2959
|
throw error;
|
|
2781
2960
|
}
|
|
2782
|
-
console.log(
|
|
2961
|
+
console.log(chalk40.green(`\u2713 Secret "${secret.name}" saved`));
|
|
2783
2962
|
}
|
|
2784
2963
|
)
|
|
2785
2964
|
);
|
|
2786
2965
|
|
|
2787
2966
|
// src/commands/zero/secret/delete.ts
|
|
2788
|
-
import { Command as
|
|
2789
|
-
import
|
|
2790
|
-
var deleteCommand4 = new
|
|
2967
|
+
import { Command as Command49 } from "commander";
|
|
2968
|
+
import chalk41 from "chalk";
|
|
2969
|
+
var deleteCommand4 = new Command49().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
2791
2970
|
withErrorHandler(async (name, options) => {
|
|
2792
2971
|
if (!options.yes) {
|
|
2793
2972
|
if (!isInteractive()) {
|
|
@@ -2798,29 +2977,29 @@ var deleteCommand4 = new Command47().name("delete").description("Delete a secret
|
|
|
2798
2977
|
false
|
|
2799
2978
|
);
|
|
2800
2979
|
if (!confirmed) {
|
|
2801
|
-
console.log(
|
|
2980
|
+
console.log(chalk41.dim("Cancelled"));
|
|
2802
2981
|
return;
|
|
2803
2982
|
}
|
|
2804
2983
|
}
|
|
2805
2984
|
await deleteZeroSecret(name);
|
|
2806
|
-
console.log(
|
|
2985
|
+
console.log(chalk41.green(`\u2713 Secret "${name}" deleted`));
|
|
2807
2986
|
})
|
|
2808
2987
|
);
|
|
2809
2988
|
|
|
2810
2989
|
// src/commands/zero/secret/index.ts
|
|
2811
|
-
var zeroSecretCommand = new
|
|
2990
|
+
var zeroSecretCommand = new Command50().name("secret").description("Read or write secrets (API keys, tokens)").addCommand(listCommand8).addCommand(setCommand4).addCommand(deleteCommand4);
|
|
2812
2991
|
|
|
2813
2992
|
// src/commands/zero/slack/index.ts
|
|
2814
|
-
import { Command as
|
|
2993
|
+
import { Command as Command53 } from "commander";
|
|
2815
2994
|
|
|
2816
2995
|
// src/commands/zero/slack/message/index.ts
|
|
2817
|
-
import { Command as
|
|
2996
|
+
import { Command as Command52 } from "commander";
|
|
2818
2997
|
|
|
2819
2998
|
// src/commands/zero/slack/message/send.ts
|
|
2820
2999
|
import { readFileSync as readFileSync3 } from "fs";
|
|
2821
|
-
import { Command as
|
|
2822
|
-
import
|
|
2823
|
-
var sendCommand = new
|
|
3000
|
+
import { Command as Command51 } from "commander";
|
|
3001
|
+
import chalk42 from "chalk";
|
|
3002
|
+
var sendCommand = new Command51().name("send").description("Send a message to a Slack channel").requiredOption("-c, --channel <id>", "Channel ID").option("-t, --text <message>", "Message text").option("--thread <ts>", "Thread timestamp for replies").option("--blocks <json>", "Block Kit JSON string").action(
|
|
2824
3003
|
withErrorHandler(
|
|
2825
3004
|
async (options) => {
|
|
2826
3005
|
let text = options.text;
|
|
@@ -2854,60 +3033,60 @@ var sendCommand = new Command49().name("send").description("Send a message to a
|
|
|
2854
3033
|
blocks
|
|
2855
3034
|
});
|
|
2856
3035
|
const tsInfo = result.ts ? ` (ts: ${result.ts})` : "";
|
|
2857
|
-
console.log(
|
|
3036
|
+
console.log(chalk42.green(`\u2713 Message sent${tsInfo}`));
|
|
2858
3037
|
}
|
|
2859
3038
|
)
|
|
2860
3039
|
);
|
|
2861
3040
|
|
|
2862
3041
|
// src/commands/zero/slack/message/index.ts
|
|
2863
|
-
var zeroSlackMessageCommand = new
|
|
3042
|
+
var zeroSlackMessageCommand = new Command52().name("message").description("Manage Slack messages").addCommand(sendCommand);
|
|
2864
3043
|
|
|
2865
3044
|
// src/commands/zero/slack/index.ts
|
|
2866
|
-
var zeroSlackCommand = new
|
|
3045
|
+
var zeroSlackCommand = new Command53().name("slack").description("Send messages to Slack channels as the bot").addCommand(zeroSlackMessageCommand);
|
|
2867
3046
|
|
|
2868
3047
|
// src/commands/zero/variable/index.ts
|
|
2869
|
-
import { Command as
|
|
3048
|
+
import { Command as Command57 } from "commander";
|
|
2870
3049
|
|
|
2871
3050
|
// src/commands/zero/variable/list.ts
|
|
2872
|
-
import { Command as
|
|
2873
|
-
import
|
|
3051
|
+
import { Command as Command54 } from "commander";
|
|
3052
|
+
import chalk43 from "chalk";
|
|
2874
3053
|
function truncateValue2(value, maxLength = 60) {
|
|
2875
3054
|
if (value.length <= maxLength) {
|
|
2876
3055
|
return value;
|
|
2877
3056
|
}
|
|
2878
3057
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
2879
3058
|
}
|
|
2880
|
-
var listCommand9 = new
|
|
3059
|
+
var listCommand9 = new Command54().name("list").alias("ls").description("List all variables").action(
|
|
2881
3060
|
withErrorHandler(async () => {
|
|
2882
3061
|
const result = await listZeroVariables();
|
|
2883
3062
|
if (result.variables.length === 0) {
|
|
2884
|
-
console.log(
|
|
3063
|
+
console.log(chalk43.dim("No variables found"));
|
|
2885
3064
|
console.log();
|
|
2886
3065
|
console.log("To add a variable:");
|
|
2887
|
-
console.log(
|
|
3066
|
+
console.log(chalk43.cyan(" zero variable set MY_VAR <value>"));
|
|
2888
3067
|
return;
|
|
2889
3068
|
}
|
|
2890
|
-
console.log(
|
|
3069
|
+
console.log(chalk43.bold("Variables:"));
|
|
2891
3070
|
console.log();
|
|
2892
3071
|
for (const variable of result.variables) {
|
|
2893
3072
|
const displayValue = truncateValue2(variable.value);
|
|
2894
|
-
console.log(` ${
|
|
3073
|
+
console.log(` ${chalk43.cyan(variable.name)} = ${displayValue}`);
|
|
2895
3074
|
if (variable.description) {
|
|
2896
|
-
console.log(` ${
|
|
3075
|
+
console.log(` ${chalk43.dim(variable.description)}`);
|
|
2897
3076
|
}
|
|
2898
3077
|
console.log(
|
|
2899
|
-
` ${
|
|
3078
|
+
` ${chalk43.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
2900
3079
|
);
|
|
2901
3080
|
console.log();
|
|
2902
3081
|
}
|
|
2903
|
-
console.log(
|
|
3082
|
+
console.log(chalk43.dim(`Total: ${result.variables.length} variable(s)`));
|
|
2904
3083
|
})
|
|
2905
3084
|
);
|
|
2906
3085
|
|
|
2907
3086
|
// src/commands/zero/variable/set.ts
|
|
2908
|
-
import { Command as
|
|
2909
|
-
import
|
|
2910
|
-
var setCommand5 = new
|
|
3087
|
+
import { Command as Command55 } from "commander";
|
|
3088
|
+
import chalk44 from "chalk";
|
|
3089
|
+
var setCommand5 = new Command55().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(
|
|
2911
3090
|
withErrorHandler(
|
|
2912
3091
|
async (name, value, options) => {
|
|
2913
3092
|
let variable;
|
|
@@ -2927,15 +3106,15 @@ var setCommand5 = new Command53().name("set").description("Create or update a va
|
|
|
2927
3106
|
}
|
|
2928
3107
|
throw error;
|
|
2929
3108
|
}
|
|
2930
|
-
console.log(
|
|
3109
|
+
console.log(chalk44.green(`\u2713 Variable "${variable.name}" saved`));
|
|
2931
3110
|
}
|
|
2932
3111
|
)
|
|
2933
3112
|
);
|
|
2934
3113
|
|
|
2935
3114
|
// src/commands/zero/variable/delete.ts
|
|
2936
|
-
import { Command as
|
|
2937
|
-
import
|
|
2938
|
-
var deleteCommand5 = new
|
|
3115
|
+
import { Command as Command56 } from "commander";
|
|
3116
|
+
import chalk45 from "chalk";
|
|
3117
|
+
var deleteCommand5 = new Command56().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
2939
3118
|
withErrorHandler(async (name, options) => {
|
|
2940
3119
|
if (!options.yes) {
|
|
2941
3120
|
if (!isInteractive()) {
|
|
@@ -2946,21 +3125,21 @@ var deleteCommand5 = new Command54().name("delete").description("Delete a variab
|
|
|
2946
3125
|
false
|
|
2947
3126
|
);
|
|
2948
3127
|
if (!confirmed) {
|
|
2949
|
-
console.log(
|
|
3128
|
+
console.log(chalk45.dim("Cancelled"));
|
|
2950
3129
|
return;
|
|
2951
3130
|
}
|
|
2952
3131
|
}
|
|
2953
3132
|
await deleteZeroVariable(name);
|
|
2954
|
-
console.log(
|
|
3133
|
+
console.log(chalk45.green(`\u2713 Variable "${name}" deleted`));
|
|
2955
3134
|
})
|
|
2956
3135
|
);
|
|
2957
3136
|
|
|
2958
3137
|
// src/commands/zero/variable/index.ts
|
|
2959
|
-
var zeroVariableCommand = new
|
|
3138
|
+
var zeroVariableCommand = new Command57().name("variable").description("Read or write non-sensitive configuration values").addCommand(listCommand9).addCommand(setCommand5).addCommand(deleteCommand5);
|
|
2960
3139
|
|
|
2961
3140
|
// src/commands/zero/whoami.ts
|
|
2962
|
-
import { Command as
|
|
2963
|
-
import
|
|
3141
|
+
import { Command as Command58 } from "commander";
|
|
3142
|
+
import chalk46 from "chalk";
|
|
2964
3143
|
function isInsideSandbox() {
|
|
2965
3144
|
return !!process.env.ZERO_AGENT_ID;
|
|
2966
3145
|
}
|
|
@@ -2968,11 +3147,11 @@ async function showSandboxInfo() {
|
|
|
2968
3147
|
const agentId = process.env.ZERO_AGENT_ID;
|
|
2969
3148
|
const payload = decodeZeroTokenPayload();
|
|
2970
3149
|
console.log(`Agent ID: ${agentId}`);
|
|
2971
|
-
console.log(`Run ID: ${payload?.runId ??
|
|
2972
|
-
console.log(`Org ID: ${payload?.orgId ??
|
|
3150
|
+
console.log(`Run ID: ${payload?.runId ?? chalk46.dim("unavailable")}`);
|
|
3151
|
+
console.log(`Org ID: ${payload?.orgId ?? chalk46.dim("unavailable")}`);
|
|
2973
3152
|
if (payload?.capabilities?.length) {
|
|
2974
3153
|
console.log();
|
|
2975
|
-
console.log(
|
|
3154
|
+
console.log(chalk46.bold("Capabilities:"));
|
|
2976
3155
|
console.log(` ${payload.capabilities.join(", ")}`);
|
|
2977
3156
|
}
|
|
2978
3157
|
}
|
|
@@ -2980,23 +3159,23 @@ async function showLocalInfo() {
|
|
|
2980
3159
|
const token = await getToken();
|
|
2981
3160
|
const apiUrl = await getApiUrl();
|
|
2982
3161
|
const activeOrg = await getActiveOrg();
|
|
2983
|
-
console.log(
|
|
3162
|
+
console.log(chalk46.bold("Auth:"));
|
|
2984
3163
|
if (token) {
|
|
2985
3164
|
const tokenSource = process.env.ZERO_TOKEN ? "ZERO_TOKEN env var" : process.env.VM0_TOKEN ? "VM0_TOKEN env var" : "config file";
|
|
2986
3165
|
console.log(
|
|
2987
|
-
` Status: ${
|
|
3166
|
+
` Status: ${chalk46.green("Authenticated")} (via ${tokenSource})`
|
|
2988
3167
|
);
|
|
2989
3168
|
} else {
|
|
2990
|
-
console.log(` Status: ${
|
|
3169
|
+
console.log(` Status: ${chalk46.dim("Not authenticated")}`);
|
|
2991
3170
|
}
|
|
2992
3171
|
console.log(` API: ${apiUrl}`);
|
|
2993
3172
|
console.log();
|
|
2994
3173
|
if (activeOrg) {
|
|
2995
|
-
console.log(
|
|
3174
|
+
console.log(chalk46.bold("Org:"));
|
|
2996
3175
|
console.log(` Active: ${activeOrg}`);
|
|
2997
3176
|
}
|
|
2998
3177
|
}
|
|
2999
|
-
var zeroWhoamiCommand = new
|
|
3178
|
+
var zeroWhoamiCommand = new Command58().name("whoami").description("Show agent identity, run ID, and capabilities").action(
|
|
3000
3179
|
withErrorHandler(async () => {
|
|
3001
3180
|
if (isInsideSandbox()) {
|
|
3002
3181
|
await showSandboxInfo();
|
|
@@ -3007,11 +3186,11 @@ var zeroWhoamiCommand = new Command56().name("whoami").description("Show agent i
|
|
|
3007
3186
|
);
|
|
3008
3187
|
|
|
3009
3188
|
// src/commands/zero/ask-user/index.ts
|
|
3010
|
-
import { Command as
|
|
3189
|
+
import { Command as Command60 } from "commander";
|
|
3011
3190
|
|
|
3012
3191
|
// src/commands/zero/ask-user/question.ts
|
|
3013
|
-
import { Command as
|
|
3014
|
-
import
|
|
3192
|
+
import { Command as Command59 } from "commander";
|
|
3193
|
+
import chalk47 from "chalk";
|
|
3015
3194
|
function collectOption(value, previous) {
|
|
3016
3195
|
const list = previous ?? [];
|
|
3017
3196
|
list.push({ label: value });
|
|
@@ -3022,7 +3201,7 @@ function collectDesc(value, previous) {
|
|
|
3022
3201
|
list.push(value);
|
|
3023
3202
|
return list;
|
|
3024
3203
|
}
|
|
3025
|
-
var questionCommand = new
|
|
3204
|
+
var questionCommand = new Command59().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(
|
|
3026
3205
|
"--desc <text>",
|
|
3027
3206
|
"Description for the preceding --option",
|
|
3028
3207
|
collectDesc
|
|
@@ -3038,6 +3217,11 @@ var questionCommand = new Command57().name("question").description("Ask the user
|
|
|
3038
3217
|
}
|
|
3039
3218
|
opt.description = descItems[i];
|
|
3040
3219
|
}
|
|
3220
|
+
if (optionItems.length === 0) {
|
|
3221
|
+
throw new Error(
|
|
3222
|
+
'At least one --option is required. Example: zero ask-user question "Pick one" --option "Yes" --option "No"'
|
|
3223
|
+
);
|
|
3224
|
+
}
|
|
3041
3225
|
const timeoutMs = parseInt(options.timeout, 10) * 1e3;
|
|
3042
3226
|
if (isNaN(timeoutMs) || timeoutMs <= 0) {
|
|
3043
3227
|
throw new Error("--timeout must be a positive number of seconds");
|
|
@@ -3045,14 +3229,14 @@ var questionCommand = new Command57().name("question").description("Ask the user
|
|
|
3045
3229
|
const questionItem = {
|
|
3046
3230
|
question,
|
|
3047
3231
|
header: options.header,
|
|
3048
|
-
options: optionItems
|
|
3232
|
+
options: optionItems,
|
|
3049
3233
|
multiSelect: options.multiSelect
|
|
3050
3234
|
};
|
|
3051
3235
|
const { pendingId } = await postAskUserQuestion({
|
|
3052
3236
|
questions: [questionItem]
|
|
3053
3237
|
});
|
|
3054
3238
|
console.error(
|
|
3055
|
-
|
|
3239
|
+
chalk47.dim(
|
|
3056
3240
|
`\u23F3 Waiting for user response... (pendingId: ${pendingId})`
|
|
3057
3241
|
)
|
|
3058
3242
|
);
|
|
@@ -3077,11 +3261,12 @@ var questionCommand = new Command57().name("question").description("Ask the user
|
|
|
3077
3261
|
);
|
|
3078
3262
|
|
|
3079
3263
|
// src/commands/zero/ask-user/index.ts
|
|
3080
|
-
var zeroAskUserCommand = new
|
|
3264
|
+
var zeroAskUserCommand = new Command60().name("ask-user").description("Ask the user a question and wait for the answer").addCommand(questionCommand);
|
|
3081
3265
|
|
|
3082
3266
|
// src/zero.ts
|
|
3083
3267
|
var COMMAND_CAPABILITY_MAP = {
|
|
3084
3268
|
agent: "agent:read",
|
|
3269
|
+
run: "agent-run:write",
|
|
3085
3270
|
schedule: "schedule:read",
|
|
3086
3271
|
doctor: null,
|
|
3087
3272
|
slack: "slack:write",
|
|
@@ -3094,6 +3279,7 @@ var DEFAULT_COMMANDS = [
|
|
|
3094
3279
|
zeroConnectorCommand,
|
|
3095
3280
|
zeroDoctorCommand,
|
|
3096
3281
|
zeroPreferenceCommand,
|
|
3282
|
+
zeroRunCommand,
|
|
3097
3283
|
zeroScheduleCommand,
|
|
3098
3284
|
zeroSecretCommand,
|
|
3099
3285
|
zeroSlackCommand,
|
|
@@ -3115,14 +3301,15 @@ function registerZeroCommands(prog, commands) {
|
|
|
3115
3301
|
prog.addCommand(cmd, hidden ? { hidden: true } : {});
|
|
3116
3302
|
}
|
|
3117
3303
|
}
|
|
3118
|
-
var program = new
|
|
3304
|
+
var program = new Command61();
|
|
3119
3305
|
program.name("zero").description(
|
|
3120
3306
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
3121
|
-
).version("9.
|
|
3307
|
+
).version("9.86.0").addHelpText(
|
|
3122
3308
|
"after",
|
|
3123
3309
|
`
|
|
3124
3310
|
Common scenarios:
|
|
3125
3311
|
Missing a token? zero doctor missing-token <TOKEN_NAME>
|
|
3312
|
+
Delegate to teammate? zero run <agent-id> "your task"
|
|
3126
3313
|
Send a Slack message? zero slack message send -c <channel> -t "text"
|
|
3127
3314
|
Set up a schedule? zero schedule setup <agent-name>
|
|
3128
3315
|
Update yourself? zero agent --help
|