@vm0/cli 9.104.1 → 9.106.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-227J7VAZ.js +85741 -0
- package/chunk-227J7VAZ.js.map +1 -0
- package/index.js +3380 -459
- package/index.js.map +1 -1
- package/package.json +2 -11
- package/zero.js +495 -529
- package/zero.js.map +1 -1
- package/chunk-FYV4IKTF.js +0 -32247
- package/chunk-FYV4IKTF.js.map +0 -1
package/zero.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from "node:module";
|
|
3
|
+
const require = __createRequire(import.meta.url);
|
|
2
4
|
import {
|
|
3
5
|
ApiRequestError,
|
|
4
6
|
CONNECTOR_TYPES,
|
|
5
7
|
ClaudeEventParser,
|
|
8
|
+
Command,
|
|
6
9
|
EventRenderer,
|
|
7
10
|
MODEL_PROVIDER_TYPES,
|
|
11
|
+
Option,
|
|
12
|
+
__toESM,
|
|
8
13
|
allowsCustomModel,
|
|
9
14
|
completeSlackFileUpload,
|
|
10
15
|
configureGlobalProxyFromEnv,
|
|
@@ -63,6 +68,7 @@ import {
|
|
|
63
68
|
hasModelSelection,
|
|
64
69
|
hasRequiredScopes,
|
|
65
70
|
initSlackFileUpload,
|
|
71
|
+
init_esm_shims,
|
|
66
72
|
inviteZeroOrgMember,
|
|
67
73
|
isFeatureEnabled,
|
|
68
74
|
isFirewallConnectorType,
|
|
@@ -92,6 +98,7 @@ import {
|
|
|
92
98
|
removeZeroOrgMember,
|
|
93
99
|
renderRunCreated,
|
|
94
100
|
requestDeveloperSupportConsent,
|
|
101
|
+
require_prompts,
|
|
95
102
|
resolveCompose,
|
|
96
103
|
resolveFirewallPolicies,
|
|
97
104
|
resolveZeroScheduleByAgent,
|
|
@@ -103,6 +110,7 @@ import {
|
|
|
103
110
|
setZeroOrgVariable,
|
|
104
111
|
setZeroSecret,
|
|
105
112
|
setZeroVariable,
|
|
113
|
+
source_default,
|
|
106
114
|
submitDeveloperSupport,
|
|
107
115
|
switchZeroOrg,
|
|
108
116
|
unregisterComputerUseHost,
|
|
@@ -115,23 +123,22 @@ import {
|
|
|
115
123
|
upsertZeroOrgModelProvider,
|
|
116
124
|
withErrorHandler,
|
|
117
125
|
zeroAgentCustomSkillNameSchema
|
|
118
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-227J7VAZ.js";
|
|
119
127
|
|
|
120
128
|
// src/zero.ts
|
|
121
|
-
|
|
129
|
+
init_esm_shims();
|
|
122
130
|
|
|
123
131
|
// src/commands/zero/org/index.ts
|
|
124
|
-
|
|
132
|
+
init_esm_shims();
|
|
125
133
|
|
|
126
134
|
// src/commands/zero/org/status.ts
|
|
127
|
-
|
|
128
|
-
import chalk from "chalk";
|
|
135
|
+
init_esm_shims();
|
|
129
136
|
var statusCommand = new Command().name("status").description("View current organization status").action(
|
|
130
137
|
withErrorHandler(async () => {
|
|
131
138
|
try {
|
|
132
139
|
const org = await getZeroOrg();
|
|
133
|
-
console.log(
|
|
134
|
-
console.log(` Slug: ${
|
|
140
|
+
console.log(source_default.bold("Organization Information:"));
|
|
141
|
+
console.log(` Slug: ${source_default.green(org.slug)}`);
|
|
135
142
|
} catch (error) {
|
|
136
143
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
137
144
|
throw new Error("No organization configured", {
|
|
@@ -144,9 +151,8 @@ var statusCommand = new Command().name("status").description("View current organ
|
|
|
144
151
|
);
|
|
145
152
|
|
|
146
153
|
// src/commands/zero/org/set.ts
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
var setCommand = new Command2().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
154
|
+
init_esm_shims();
|
|
155
|
+
var setCommand = new Command().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
150
156
|
"--force",
|
|
151
157
|
"Force change existing organization (may break references)"
|
|
152
158
|
).action(
|
|
@@ -166,10 +172,10 @@ var setCommand = new Command2().name("set").description("Rename your organizatio
|
|
|
166
172
|
await saveConfig({
|
|
167
173
|
token: result.access_token
|
|
168
174
|
});
|
|
169
|
-
console.log(
|
|
175
|
+
console.log(source_default.green(`\u2713 Organization updated to ${org.slug}`));
|
|
170
176
|
console.log();
|
|
171
177
|
console.log("Your agents will now be namespaced as:");
|
|
172
|
-
console.log(
|
|
178
|
+
console.log(source_default.cyan(` ${org.slug}/<agent-name>`));
|
|
173
179
|
} catch (error) {
|
|
174
180
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
175
181
|
throw new Error(
|
|
@@ -182,27 +188,25 @@ var setCommand = new Command2().name("set").description("Rename your organizatio
|
|
|
182
188
|
);
|
|
183
189
|
|
|
184
190
|
// src/commands/zero/org/list.ts
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var listCommand = new Command3().name("list").description("List all accessible organizations").action(
|
|
191
|
+
init_esm_shims();
|
|
192
|
+
var listCommand = new Command().name("list").description("List all accessible organizations").action(
|
|
188
193
|
withErrorHandler(async () => {
|
|
189
194
|
const result = await listZeroOrgs();
|
|
190
195
|
const activeOrg = await getActiveOrg();
|
|
191
|
-
console.log(
|
|
196
|
+
console.log(source_default.bold("Available organizations:"));
|
|
192
197
|
for (const org of result.orgs) {
|
|
193
198
|
const isCurrent = org.slug === activeOrg;
|
|
194
|
-
const marker = isCurrent ?
|
|
199
|
+
const marker = isCurrent ? source_default.green("* ") : " ";
|
|
195
200
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
196
|
-
const currentLabel = isCurrent ?
|
|
201
|
+
const currentLabel = isCurrent ? source_default.dim(" \u2190 current") : "";
|
|
197
202
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
198
203
|
}
|
|
199
204
|
})
|
|
200
205
|
);
|
|
201
206
|
|
|
202
207
|
// src/commands/zero/org/use.ts
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
var useCommand = new Command4().name("use").description("Switch to a different organization").argument("<slug>", "Organization slug to switch to").action(
|
|
208
|
+
init_esm_shims();
|
|
209
|
+
var useCommand = new Command().name("use").description("Switch to a different organization").argument("<slug>", "Organization slug to switch to").action(
|
|
206
210
|
withErrorHandler(async (slug) => {
|
|
207
211
|
const orgList = await listZeroOrgs();
|
|
208
212
|
const target = orgList.orgs.find((s) => {
|
|
@@ -215,34 +219,32 @@ var useCommand = new Command4().name("use").description("Switch to a different o
|
|
|
215
219
|
await saveConfig({
|
|
216
220
|
token: result.access_token
|
|
217
221
|
});
|
|
218
|
-
console.log(
|
|
222
|
+
console.log(source_default.green(`\u2713 Switched to organization: ${slug}`));
|
|
219
223
|
})
|
|
220
224
|
);
|
|
221
225
|
|
|
222
226
|
// src/commands/zero/org/members.ts
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var membersCommand = new Command5().name("members").description("View organization members").action(
|
|
227
|
+
init_esm_shims();
|
|
228
|
+
var membersCommand = new Command().name("members").description("View organization members").action(
|
|
226
229
|
withErrorHandler(async () => {
|
|
227
230
|
const status = await getZeroOrgMembers();
|
|
228
|
-
console.log(
|
|
231
|
+
console.log(source_default.bold(`Organization: ${status.slug}`));
|
|
229
232
|
console.log(` Role: ${status.role}`);
|
|
230
233
|
console.log(
|
|
231
234
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
232
235
|
);
|
|
233
236
|
console.log();
|
|
234
|
-
console.log(
|
|
237
|
+
console.log(source_default.bold("Members:"));
|
|
235
238
|
for (const member of status.members) {
|
|
236
|
-
const roleTag = member.role === "admin" ?
|
|
239
|
+
const roleTag = member.role === "admin" ? source_default.yellow(` (${member.role})`) : source_default.dim(` (${member.role})`);
|
|
237
240
|
console.log(` ${member.email}${roleTag}`);
|
|
238
241
|
}
|
|
239
242
|
})
|
|
240
243
|
);
|
|
241
244
|
|
|
242
245
|
// src/commands/zero/org/invite.ts
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
var inviteCommand = new Command6().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").option(
|
|
246
|
+
init_esm_shims();
|
|
247
|
+
var inviteCommand = new Command().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").option(
|
|
246
248
|
"--role <role>",
|
|
247
249
|
"Role for the invited member (member or admin)",
|
|
248
250
|
"member"
|
|
@@ -255,33 +257,31 @@ var inviteCommand = new Command6().name("invite").description("Invite a member t
|
|
|
255
257
|
}
|
|
256
258
|
await inviteZeroOrgMember(options.email, options.role);
|
|
257
259
|
console.log(
|
|
258
|
-
|
|
260
|
+
source_default.green(`\u2713 Invitation sent to ${options.email} as ${options.role}`)
|
|
259
261
|
);
|
|
260
262
|
})
|
|
261
263
|
);
|
|
262
264
|
|
|
263
265
|
// src/commands/zero/org/remove.ts
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
var removeCommand = new Command7().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
266
|
+
init_esm_shims();
|
|
267
|
+
var removeCommand = new Command().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
267
268
|
withErrorHandler(async (email) => {
|
|
268
269
|
await removeZeroOrgMember(email);
|
|
269
|
-
console.log(
|
|
270
|
+
console.log(source_default.green(`\u2713 Removed ${email} from organization`));
|
|
270
271
|
})
|
|
271
272
|
);
|
|
272
273
|
|
|
273
274
|
// src/commands/zero/org/leave.ts
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
var leaveCommand = new Command8().name("leave").description("Leave the current organization").action(
|
|
275
|
+
init_esm_shims();
|
|
276
|
+
var leaveCommand = new Command().name("leave").description("Leave the current organization").action(
|
|
277
277
|
withErrorHandler(async () => {
|
|
278
278
|
await leaveZeroOrg();
|
|
279
279
|
const { orgs } = await listZeroOrgs();
|
|
280
280
|
if (orgs.length === 0) {
|
|
281
281
|
await saveConfig({ token: void 0 });
|
|
282
|
-
console.log(
|
|
282
|
+
console.log(source_default.green("\u2713 Left organization."));
|
|
283
283
|
console.log(
|
|
284
|
-
|
|
284
|
+
source_default.yellow("No remaining organizations. Run: vm0 auth login")
|
|
285
285
|
);
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
@@ -290,58 +290,55 @@ var leaveCommand = new Command8().name("leave").description("Leave the current o
|
|
|
290
290
|
await saveConfig({
|
|
291
291
|
token: result.access_token
|
|
292
292
|
});
|
|
293
|
-
console.log(
|
|
293
|
+
console.log(source_default.green(`\u2713 Left organization. Switched to: ${nextOrg}`));
|
|
294
294
|
})
|
|
295
295
|
);
|
|
296
296
|
|
|
297
297
|
// src/commands/zero/org/delete.ts
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
var deleteCommand = new Command9().name("delete").description("Delete the current organization (admin only)").argument("<slug>", "Organization slug to confirm deletion").action(
|
|
298
|
+
init_esm_shims();
|
|
299
|
+
var deleteCommand = new Command().name("delete").description("Delete the current organization (admin only)").argument("<slug>", "Organization slug to confirm deletion").action(
|
|
301
300
|
withErrorHandler(async (slug) => {
|
|
302
301
|
await deleteZeroOrg(slug);
|
|
303
|
-
console.log(
|
|
302
|
+
console.log(source_default.green(`\u2713 Organization '${slug}' has been deleted.`));
|
|
304
303
|
})
|
|
305
304
|
);
|
|
306
305
|
|
|
307
306
|
// src/commands/zero/org/secret/index.ts
|
|
308
|
-
|
|
307
|
+
init_esm_shims();
|
|
309
308
|
|
|
310
309
|
// src/commands/zero/org/secret/list.ts
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
var listCommand2 = new Command10().name("list").alias("ls").description("List all org-level secrets").action(
|
|
310
|
+
init_esm_shims();
|
|
311
|
+
var listCommand2 = new Command().name("list").alias("ls").description("List all org-level secrets").action(
|
|
314
312
|
withErrorHandler(async () => {
|
|
315
313
|
const result = await listZeroOrgSecrets();
|
|
316
314
|
if (result.secrets.length === 0) {
|
|
317
|
-
console.log(
|
|
315
|
+
console.log(source_default.dim("No org secrets found"));
|
|
318
316
|
console.log();
|
|
319
317
|
console.log("To add an org secret:");
|
|
320
318
|
console.log(
|
|
321
|
-
|
|
319
|
+
source_default.cyan(" zero org secret set MY_API_KEY --body <value>")
|
|
322
320
|
);
|
|
323
321
|
return;
|
|
324
322
|
}
|
|
325
|
-
console.log(
|
|
323
|
+
console.log(source_default.bold("Org Secrets:"));
|
|
326
324
|
console.log();
|
|
327
325
|
for (const secret of result.secrets) {
|
|
328
|
-
console.log(` ${
|
|
326
|
+
console.log(` ${source_default.cyan(secret.name)}`);
|
|
329
327
|
if (secret.description) {
|
|
330
|
-
console.log(` ${
|
|
328
|
+
console.log(` ${source_default.dim(secret.description)}`);
|
|
331
329
|
}
|
|
332
330
|
console.log(
|
|
333
|
-
` ${
|
|
331
|
+
` ${source_default.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
334
332
|
);
|
|
335
333
|
console.log();
|
|
336
334
|
}
|
|
337
|
-
console.log(
|
|
335
|
+
console.log(source_default.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
338
336
|
})
|
|
339
337
|
);
|
|
340
338
|
|
|
341
339
|
// src/commands/zero/org/secret/set.ts
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
var setCommand2 = new Command11().name("set").description("Create or update an org-level secret (admin only)").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
340
|
+
init_esm_shims();
|
|
341
|
+
var setCommand2 = new Command().name("set").description("Create or update an org-level secret (admin only)").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
345
342
|
"-b, --body <value>",
|
|
346
343
|
"Secret value (required in non-interactive mode)"
|
|
347
344
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -353,7 +350,7 @@ var setCommand2 = new Command11().name("set").description("Create or update an o
|
|
|
353
350
|
} else if (isInteractive()) {
|
|
354
351
|
const prompted = await promptPassword("Enter secret value:");
|
|
355
352
|
if (prompted === void 0) {
|
|
356
|
-
console.log(
|
|
353
|
+
console.log(source_default.dim("Cancelled"));
|
|
357
354
|
return;
|
|
358
355
|
}
|
|
359
356
|
value = prompted;
|
|
@@ -381,15 +378,14 @@ var setCommand2 = new Command11().name("set").description("Create or update an o
|
|
|
381
378
|
}
|
|
382
379
|
throw error;
|
|
383
380
|
}
|
|
384
|
-
console.log(
|
|
381
|
+
console.log(source_default.green(`\u2713 Org secret "${secret.name}" saved`));
|
|
385
382
|
}
|
|
386
383
|
)
|
|
387
384
|
);
|
|
388
385
|
|
|
389
386
|
// src/commands/zero/org/secret/remove.ts
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
var removeCommand2 = new Command12().name("remove").description("Delete an org-level secret (admin only)").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
387
|
+
init_esm_shims();
|
|
388
|
+
var removeCommand2 = new Command().name("remove").description("Delete an org-level secret (admin only)").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
393
389
|
withErrorHandler(async (name, options) => {
|
|
394
390
|
if (!options.yes) {
|
|
395
391
|
if (!isInteractive()) {
|
|
@@ -400,61 +396,59 @@ var removeCommand2 = new Command12().name("remove").description("Delete an org-l
|
|
|
400
396
|
false
|
|
401
397
|
);
|
|
402
398
|
if (!confirmed) {
|
|
403
|
-
console.log(
|
|
399
|
+
console.log(source_default.dim("Cancelled"));
|
|
404
400
|
return;
|
|
405
401
|
}
|
|
406
402
|
}
|
|
407
403
|
await deleteZeroOrgSecret(name);
|
|
408
|
-
console.log(
|
|
404
|
+
console.log(source_default.green(`\u2713 Org secret "${name}" deleted`));
|
|
409
405
|
})
|
|
410
406
|
);
|
|
411
407
|
|
|
412
408
|
// src/commands/zero/org/secret/index.ts
|
|
413
|
-
var zeroOrgSecretCommand = new
|
|
409
|
+
var zeroOrgSecretCommand = new Command().name("secret").description("Manage org-level secrets (admin)").addCommand(listCommand2).addCommand(setCommand2).addCommand(removeCommand2);
|
|
414
410
|
|
|
415
411
|
// src/commands/zero/org/variable/index.ts
|
|
416
|
-
|
|
412
|
+
init_esm_shims();
|
|
417
413
|
|
|
418
414
|
// src/commands/zero/org/variable/list.ts
|
|
419
|
-
|
|
420
|
-
import chalk13 from "chalk";
|
|
415
|
+
init_esm_shims();
|
|
421
416
|
function truncateValue(value, maxLength = 60) {
|
|
422
417
|
if (value.length <= maxLength) {
|
|
423
418
|
return value;
|
|
424
419
|
}
|
|
425
420
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
426
421
|
}
|
|
427
|
-
var listCommand3 = new
|
|
422
|
+
var listCommand3 = new Command().name("list").alias("ls").description("List all org-level variables").action(
|
|
428
423
|
withErrorHandler(async () => {
|
|
429
424
|
const result = await listZeroOrgVariables();
|
|
430
425
|
if (result.variables.length === 0) {
|
|
431
|
-
console.log(
|
|
426
|
+
console.log(source_default.dim("No org variables found"));
|
|
432
427
|
console.log();
|
|
433
428
|
console.log("To add an org variable:");
|
|
434
|
-
console.log(
|
|
429
|
+
console.log(source_default.cyan(" zero org variable set MY_VAR <value>"));
|
|
435
430
|
return;
|
|
436
431
|
}
|
|
437
|
-
console.log(
|
|
432
|
+
console.log(source_default.bold("Org Variables:"));
|
|
438
433
|
console.log();
|
|
439
434
|
for (const variable of result.variables) {
|
|
440
435
|
const displayValue = truncateValue(variable.value);
|
|
441
|
-
console.log(` ${
|
|
436
|
+
console.log(` ${source_default.cyan(variable.name)} = ${displayValue}`);
|
|
442
437
|
if (variable.description) {
|
|
443
|
-
console.log(` ${
|
|
438
|
+
console.log(` ${source_default.dim(variable.description)}`);
|
|
444
439
|
}
|
|
445
440
|
console.log(
|
|
446
|
-
` ${
|
|
441
|
+
` ${source_default.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
447
442
|
);
|
|
448
443
|
console.log();
|
|
449
444
|
}
|
|
450
|
-
console.log(
|
|
445
|
+
console.log(source_default.dim(`Total: ${result.variables.length} variable(s)`));
|
|
451
446
|
})
|
|
452
447
|
);
|
|
453
448
|
|
|
454
449
|
// src/commands/zero/org/variable/set.ts
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
var setCommand3 = new Command15().name("set").description("Create or update an org-level variable (admin only)").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
450
|
+
init_esm_shims();
|
|
451
|
+
var setCommand3 = new Command().name("set").description("Create or update an org-level variable (admin only)").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
458
452
|
withErrorHandler(
|
|
459
453
|
async (name, value, options) => {
|
|
460
454
|
let variable;
|
|
@@ -474,15 +468,14 @@ var setCommand3 = new Command15().name("set").description("Create or update an o
|
|
|
474
468
|
}
|
|
475
469
|
throw error;
|
|
476
470
|
}
|
|
477
|
-
console.log(
|
|
471
|
+
console.log(source_default.green(`\u2713 Org variable "${variable.name}" saved`));
|
|
478
472
|
}
|
|
479
473
|
)
|
|
480
474
|
);
|
|
481
475
|
|
|
482
476
|
// src/commands/zero/org/variable/remove.ts
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
var removeCommand3 = new Command16().name("remove").description("Delete an org-level variable (admin only)").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
477
|
+
init_esm_shims();
|
|
478
|
+
var removeCommand3 = new Command().name("remove").description("Delete an org-level variable (admin only)").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
486
479
|
withErrorHandler(async (name, options) => {
|
|
487
480
|
if (!options.yes) {
|
|
488
481
|
if (!isInteractive()) {
|
|
@@ -493,32 +486,31 @@ var removeCommand3 = new Command16().name("remove").description("Delete an org-l
|
|
|
493
486
|
false
|
|
494
487
|
);
|
|
495
488
|
if (!confirmed) {
|
|
496
|
-
console.log(
|
|
489
|
+
console.log(source_default.dim("Cancelled"));
|
|
497
490
|
return;
|
|
498
491
|
}
|
|
499
492
|
}
|
|
500
493
|
await deleteZeroOrgVariable(name);
|
|
501
|
-
console.log(
|
|
494
|
+
console.log(source_default.green(`\u2713 Org variable "${name}" deleted`));
|
|
502
495
|
})
|
|
503
496
|
);
|
|
504
497
|
|
|
505
498
|
// src/commands/zero/org/variable/index.ts
|
|
506
|
-
var zeroOrgVariableCommand = new
|
|
499
|
+
var zeroOrgVariableCommand = new Command().name("variable").description("Manage org-level variables (admin)").addCommand(listCommand3).addCommand(setCommand3).addCommand(removeCommand3);
|
|
507
500
|
|
|
508
501
|
// src/commands/zero/org/model-provider/index.ts
|
|
509
|
-
|
|
502
|
+
init_esm_shims();
|
|
510
503
|
|
|
511
504
|
// src/commands/zero/org/model-provider/list.ts
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
var listCommand4 = new Command18().name("list").alias("ls").description("List all org-level model providers").action(
|
|
505
|
+
init_esm_shims();
|
|
506
|
+
var listCommand4 = new Command().name("list").alias("ls").description("List all org-level model providers").action(
|
|
515
507
|
withErrorHandler(async () => {
|
|
516
508
|
const result = await listZeroOrgModelProviders();
|
|
517
509
|
if (result.modelProviders.length === 0) {
|
|
518
|
-
console.log(
|
|
510
|
+
console.log(source_default.dim("No org-level model providers configured"));
|
|
519
511
|
console.log();
|
|
520
512
|
console.log("To add an org-level model provider:");
|
|
521
|
-
console.log(
|
|
513
|
+
console.log(source_default.cyan(" zero org model-provider setup"));
|
|
522
514
|
return;
|
|
523
515
|
}
|
|
524
516
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -532,16 +524,16 @@ var listCommand4 = new Command18().name("list").alias("ls").description("List al
|
|
|
532
524
|
},
|
|
533
525
|
{}
|
|
534
526
|
);
|
|
535
|
-
console.log(
|
|
527
|
+
console.log(source_default.bold("Org Model Providers:"));
|
|
536
528
|
console.log();
|
|
537
529
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
538
|
-
console.log(` ${
|
|
530
|
+
console.log(` ${source_default.cyan(framework)}:`);
|
|
539
531
|
for (const provider of providers) {
|
|
540
|
-
const defaultTag = provider.isDefault ?
|
|
541
|
-
const modelTag = provider.selectedModel ?
|
|
532
|
+
const defaultTag = provider.isDefault ? source_default.green(" (default)") : "";
|
|
533
|
+
const modelTag = provider.selectedModel ? source_default.dim(` [${provider.selectedModel}]`) : "";
|
|
542
534
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
543
535
|
console.log(
|
|
544
|
-
|
|
536
|
+
source_default.dim(
|
|
545
537
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
546
538
|
)
|
|
547
539
|
);
|
|
@@ -549,19 +541,18 @@ var listCommand4 = new Command18().name("list").alias("ls").description("List al
|
|
|
549
541
|
console.log();
|
|
550
542
|
}
|
|
551
543
|
console.log(
|
|
552
|
-
|
|
544
|
+
source_default.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
553
545
|
);
|
|
554
546
|
})
|
|
555
547
|
);
|
|
556
548
|
|
|
557
549
|
// src/commands/zero/org/model-provider/setup.ts
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
import prompts2 from "prompts";
|
|
550
|
+
init_esm_shims();
|
|
551
|
+
var import_prompts2 = __toESM(require_prompts(), 1);
|
|
561
552
|
|
|
562
553
|
// src/lib/domain/model-provider/shared.ts
|
|
563
|
-
|
|
564
|
-
|
|
554
|
+
init_esm_shims();
|
|
555
|
+
var import_prompts = __toESM(require_prompts(), 1);
|
|
565
556
|
function validateProviderType(typeStr) {
|
|
566
557
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
567
558
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -736,7 +727,7 @@ async function promptForModelSelection(type) {
|
|
|
736
727
|
if (supportsCustomModel) {
|
|
737
728
|
modelChoices.push({ title: "Custom model ID", value: "__custom__" });
|
|
738
729
|
}
|
|
739
|
-
const modelResponse = await
|
|
730
|
+
const modelResponse = await (0, import_prompts.default)(
|
|
740
731
|
{
|
|
741
732
|
type: "select",
|
|
742
733
|
name: "model",
|
|
@@ -753,9 +744,9 @@ async function promptForModelSelection(type) {
|
|
|
753
744
|
if (selected === "__custom__") {
|
|
754
745
|
const placeholder = getCustomModelPlaceholder(type);
|
|
755
746
|
if (placeholder) {
|
|
756
|
-
console.log(
|
|
747
|
+
console.log(source_default.dim(`Example: ${placeholder}`));
|
|
757
748
|
}
|
|
758
|
-
const customResponse = await
|
|
749
|
+
const customResponse = await (0, import_prompts.default)(
|
|
759
750
|
{
|
|
760
751
|
type: "text",
|
|
761
752
|
name: "customModel",
|
|
@@ -786,7 +777,7 @@ async function promptForAuthMethod(type) {
|
|
|
786
777
|
value: method
|
|
787
778
|
};
|
|
788
779
|
});
|
|
789
|
-
const response = await
|
|
780
|
+
const response = await (0, import_prompts.default)(
|
|
790
781
|
{
|
|
791
782
|
type: "select",
|
|
792
783
|
name: "authMethod",
|
|
@@ -815,12 +806,12 @@ async function promptForSecrets(type, authMethod) {
|
|
|
815
806
|
const secrets = {};
|
|
816
807
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
817
808
|
if (fieldConfig.helpText) {
|
|
818
|
-
console.log(
|
|
809
|
+
console.log(source_default.dim(fieldConfig.helpText));
|
|
819
810
|
}
|
|
820
811
|
const isSensitive = isSensitiveSecret(name);
|
|
821
812
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
822
813
|
if (fieldConfig.required) {
|
|
823
|
-
const response = await
|
|
814
|
+
const response = await (0, import_prompts.default)(
|
|
824
815
|
{
|
|
825
816
|
type: isSensitive ? "password" : "text",
|
|
826
817
|
name: "value",
|
|
@@ -838,7 +829,7 @@ async function promptForSecrets(type, authMethod) {
|
|
|
838
829
|
);
|
|
839
830
|
secrets[name] = response.value;
|
|
840
831
|
} else {
|
|
841
|
-
const response = await
|
|
832
|
+
const response = await (0, import_prompts.default)(
|
|
842
833
|
{
|
|
843
834
|
type: isSensitive ? "password" : "text",
|
|
844
835
|
name: "value",
|
|
@@ -891,14 +882,14 @@ async function handleInteractiveMode() {
|
|
|
891
882
|
title = `${title} \u2713`;
|
|
892
883
|
}
|
|
893
884
|
if (isExperimental) {
|
|
894
|
-
title = `${title} ${
|
|
885
|
+
title = `${title} ${source_default.dim("(experimental)")}`;
|
|
895
886
|
}
|
|
896
887
|
return {
|
|
897
888
|
title,
|
|
898
889
|
value: type2
|
|
899
890
|
};
|
|
900
891
|
});
|
|
901
|
-
const typeResponse = await
|
|
892
|
+
const typeResponse = await (0, import_prompts2.default)(
|
|
902
893
|
{
|
|
903
894
|
type: "select",
|
|
904
895
|
name: "type",
|
|
@@ -908,7 +899,7 @@ async function handleInteractiveMode() {
|
|
|
908
899
|
{ onCancel }
|
|
909
900
|
);
|
|
910
901
|
if (cancelled) {
|
|
911
|
-
console.log(
|
|
902
|
+
console.log(source_default.dim("Cancelled"));
|
|
912
903
|
return null;
|
|
913
904
|
}
|
|
914
905
|
const type = typeResponse.type;
|
|
@@ -919,7 +910,7 @@ async function handleInteractiveMode() {
|
|
|
919
910
|
console.log();
|
|
920
911
|
console.log(`"${type}" is already configured`);
|
|
921
912
|
console.log();
|
|
922
|
-
const actionResponse = await
|
|
913
|
+
const actionResponse = await (0, import_prompts2.default)(
|
|
923
914
|
{
|
|
924
915
|
type: "select",
|
|
925
916
|
name: "action",
|
|
@@ -932,7 +923,7 @@ async function handleInteractiveMode() {
|
|
|
932
923
|
{ onCancel }
|
|
933
924
|
);
|
|
934
925
|
if (cancelled) {
|
|
935
|
-
console.log(
|
|
926
|
+
console.log(source_default.dim("Cancelled"));
|
|
936
927
|
return null;
|
|
937
928
|
}
|
|
938
929
|
if (actionResponse.action === "keep") {
|
|
@@ -948,7 +939,7 @@ async function handleInteractiveMode() {
|
|
|
948
939
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
949
940
|
console.log();
|
|
950
941
|
if ("helpText" in config) {
|
|
951
|
-
console.log(
|
|
942
|
+
console.log(source_default.dim(config.helpText));
|
|
952
943
|
}
|
|
953
944
|
console.log();
|
|
954
945
|
if (hasAuthMethods(type)) {
|
|
@@ -964,7 +955,7 @@ async function handleInteractiveMode() {
|
|
|
964
955
|
};
|
|
965
956
|
}
|
|
966
957
|
const secretLabel = "secretLabel" in config ? config.secretLabel : "secret";
|
|
967
|
-
const secretResponse = await
|
|
958
|
+
const secretResponse = await (0, import_prompts2.default)(
|
|
968
959
|
{
|
|
969
960
|
type: "password",
|
|
970
961
|
name: "secret",
|
|
@@ -976,7 +967,7 @@ async function handleInteractiveMode() {
|
|
|
976
967
|
{ onCancel }
|
|
977
968
|
);
|
|
978
969
|
if (cancelled) {
|
|
979
|
-
console.log(
|
|
970
|
+
console.log(source_default.dim("Cancelled"));
|
|
980
971
|
return null;
|
|
981
972
|
}
|
|
982
973
|
const secret = secretResponse.secret;
|
|
@@ -986,7 +977,7 @@ async function handleInteractiveMode() {
|
|
|
986
977
|
async function promptSetAsDefault(type, framework, isDefault) {
|
|
987
978
|
if (isDefault) return;
|
|
988
979
|
let cancelled = false;
|
|
989
|
-
const response = await
|
|
980
|
+
const response = await (0, import_prompts2.default)(
|
|
990
981
|
{
|
|
991
982
|
type: "confirm",
|
|
992
983
|
name: "setDefault",
|
|
@@ -1001,15 +992,15 @@ async function promptSetAsDefault(type, framework, isDefault) {
|
|
|
1001
992
|
}
|
|
1002
993
|
);
|
|
1003
994
|
if (cancelled) {
|
|
1004
|
-
console.log(
|
|
995
|
+
console.log(source_default.dim("Cancelled"));
|
|
1005
996
|
return;
|
|
1006
997
|
}
|
|
1007
998
|
if (response.setDefault) {
|
|
1008
999
|
await setZeroOrgModelProviderDefault(type);
|
|
1009
|
-
console.log(
|
|
1000
|
+
console.log(source_default.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
1010
1001
|
}
|
|
1011
1002
|
}
|
|
1012
|
-
var setupCommand = new
|
|
1003
|
+
var setupCommand = new Command().name("setup").description("Configure an org-level model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
1013
1004
|
"-s, --secret <value>",
|
|
1014
1005
|
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
1015
1006
|
collectSecrets,
|
|
@@ -1048,11 +1039,11 @@ var setupCommand = new Command19().name("setup").description("Configure an org-l
|
|
|
1048
1039
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
1049
1040
|
if (!hasModelSelection(input.type)) {
|
|
1050
1041
|
console.log(
|
|
1051
|
-
|
|
1042
|
+
source_default.green(`\u2713 Org model provider "${input.type}" unchanged`)
|
|
1052
1043
|
);
|
|
1053
1044
|
} else {
|
|
1054
1045
|
console.log(
|
|
1055
|
-
|
|
1046
|
+
source_default.green(
|
|
1056
1047
|
`\u2713 Org model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
1057
1048
|
)
|
|
1058
1049
|
);
|
|
@@ -1077,7 +1068,7 @@ var setupCommand = new Command19().name("setup").description("Configure an org-l
|
|
|
1077
1068
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
1078
1069
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
1079
1070
|
console.log(
|
|
1080
|
-
|
|
1071
|
+
source_default.green(
|
|
1081
1072
|
`\u2713 Org model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
1082
1073
|
)
|
|
1083
1074
|
);
|
|
@@ -1093,9 +1084,8 @@ var setupCommand = new Command19().name("setup").description("Configure an org-l
|
|
|
1093
1084
|
);
|
|
1094
1085
|
|
|
1095
1086
|
// src/commands/zero/org/model-provider/remove.ts
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
var removeCommand4 = new Command20().name("remove").description("Remove an org-level model provider").argument("<type>", "Model provider type to remove").action(
|
|
1087
|
+
init_esm_shims();
|
|
1088
|
+
var removeCommand4 = new Command().name("remove").description("Remove an org-level model provider").argument("<type>", "Model provider type to remove").action(
|
|
1099
1089
|
withErrorHandler(async (type) => {
|
|
1100
1090
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
1101
1091
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -1104,14 +1094,13 @@ var removeCommand4 = new Command20().name("remove").description("Remove an org-l
|
|
|
1104
1094
|
});
|
|
1105
1095
|
}
|
|
1106
1096
|
await deleteZeroOrgModelProvider(type);
|
|
1107
|
-
console.log(
|
|
1097
|
+
console.log(source_default.green(`\u2713 Org model provider "${type}" removed`));
|
|
1108
1098
|
})
|
|
1109
1099
|
);
|
|
1110
1100
|
|
|
1111
1101
|
// src/commands/zero/org/model-provider/set-default.ts
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
var setDefaultCommand = new Command21().name("set-default").description("Set an org-level model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
1102
|
+
init_esm_shims();
|
|
1103
|
+
var setDefaultCommand = new Command().name("set-default").description("Set an org-level model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
1115
1104
|
withErrorHandler(async (type) => {
|
|
1116
1105
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
1117
1106
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -1123,7 +1112,7 @@ var setDefaultCommand = new Command21().name("set-default").description("Set an
|
|
|
1123
1112
|
type
|
|
1124
1113
|
);
|
|
1125
1114
|
console.log(
|
|
1126
|
-
|
|
1115
|
+
source_default.green(
|
|
1127
1116
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
1128
1117
|
)
|
|
1129
1118
|
);
|
|
@@ -1131,19 +1120,18 @@ var setDefaultCommand = new Command21().name("set-default").description("Set an
|
|
|
1131
1120
|
);
|
|
1132
1121
|
|
|
1133
1122
|
// src/commands/zero/org/model-provider/index.ts
|
|
1134
|
-
var zeroOrgModelProviderCommand = new
|
|
1123
|
+
var zeroOrgModelProviderCommand = new Command().name("model-provider").description("Manage org-level model providers").addCommand(listCommand4).addCommand(setupCommand).addCommand(removeCommand4).addCommand(setDefaultCommand);
|
|
1135
1124
|
|
|
1136
1125
|
// src/commands/zero/org/index.ts
|
|
1137
|
-
var zeroOrgCommand = new
|
|
1126
|
+
var zeroOrgCommand = new Command().name("org").description("Manage organization settings, members, and providers").addCommand(statusCommand).addCommand(setCommand).addCommand(listCommand).addCommand(useCommand).addCommand(membersCommand).addCommand(inviteCommand).addCommand(removeCommand).addCommand(leaveCommand).addCommand(deleteCommand).addCommand(zeroOrgSecretCommand).addCommand(zeroOrgVariableCommand).addCommand(zeroOrgModelProviderCommand);
|
|
1138
1127
|
|
|
1139
1128
|
// src/commands/zero/agent/index.ts
|
|
1140
|
-
|
|
1129
|
+
init_esm_shims();
|
|
1141
1130
|
|
|
1142
1131
|
// src/commands/zero/agent/create.ts
|
|
1143
|
-
|
|
1132
|
+
init_esm_shims();
|
|
1144
1133
|
import { readFileSync } from "fs";
|
|
1145
|
-
|
|
1146
|
-
var createCommand = new Command24().name("create").description("Create a new zero agent").option(
|
|
1134
|
+
var createCommand = new Command().name("create").description("Create a new zero agent").option(
|
|
1147
1135
|
"--skills <items>",
|
|
1148
1136
|
"Comma-separated custom skill names to attach (e.g. my-skill,other-skill)"
|
|
1149
1137
|
).option("--display-name <name>", "Agent display name").option("--description <text>", "Agent description").option(
|
|
@@ -1182,7 +1170,7 @@ Examples:
|
|
|
1182
1170
|
const content = readFileSync(options.instructionsFile, "utf-8");
|
|
1183
1171
|
await updateZeroAgentInstructions(agent.agentId, content);
|
|
1184
1172
|
}
|
|
1185
|
-
console.log(
|
|
1173
|
+
console.log(source_default.green(`\u2713 Agent "${agent.agentId}" created`));
|
|
1186
1174
|
console.log(` Agent ID: ${agent.agentId}`);
|
|
1187
1175
|
if (customSkills?.length) {
|
|
1188
1176
|
console.log(` Skills: ${customSkills.join(", ")}`);
|
|
@@ -1195,9 +1183,8 @@ Examples:
|
|
|
1195
1183
|
);
|
|
1196
1184
|
|
|
1197
1185
|
// src/commands/zero/agent/edit.ts
|
|
1198
|
-
|
|
1186
|
+
init_esm_shims();
|
|
1199
1187
|
import { readFileSync as readFileSync2 } from "fs";
|
|
1200
|
-
import chalk22 from "chalk";
|
|
1201
1188
|
function validateSkillName(name) {
|
|
1202
1189
|
const result = zeroAgentCustomSkillNameSchema.safeParse(name);
|
|
1203
1190
|
if (!result.success) {
|
|
@@ -1240,7 +1227,7 @@ function resolveCustomSkills(options, existing) {
|
|
|
1240
1227
|
}
|
|
1241
1228
|
return void 0;
|
|
1242
1229
|
}
|
|
1243
|
-
var editCommand = new
|
|
1230
|
+
var editCommand = new Command().name("edit").description("Edit a zero agent").argument("<agent-id>", "Agent ID").option("--display-name <name>", "New display name").option("--description <text>", "New description").option(
|
|
1244
1231
|
"--sound <tone>",
|
|
1245
1232
|
"New tone: professional, friendly, direct, supportive"
|
|
1246
1233
|
).option(
|
|
@@ -1290,14 +1277,13 @@ Notes:
|
|
|
1290
1277
|
const content = readFileSync2(options.instructionsFile, "utf-8");
|
|
1291
1278
|
await updateZeroAgentInstructions(agentId, content);
|
|
1292
1279
|
}
|
|
1293
|
-
console.log(
|
|
1280
|
+
console.log(source_default.green(`\u2713 Agent "${agentId}" updated`));
|
|
1294
1281
|
}
|
|
1295
1282
|
)
|
|
1296
1283
|
);
|
|
1297
1284
|
|
|
1298
1285
|
// src/commands/zero/agent/view.ts
|
|
1299
|
-
|
|
1300
|
-
import chalk23 from "chalk";
|
|
1286
|
+
init_esm_shims();
|
|
1301
1287
|
function getConnectorPermissionInfo(type, resolvedPolicies) {
|
|
1302
1288
|
if (!isFirewallConnectorType(type)) {
|
|
1303
1289
|
return {
|
|
@@ -1345,11 +1331,11 @@ function formatDetailIdentity(connector) {
|
|
|
1345
1331
|
}
|
|
1346
1332
|
if (!identity) return "";
|
|
1347
1333
|
if (connector.needsReconnect) {
|
|
1348
|
-
identity += ` ${
|
|
1334
|
+
identity += ` ${source_default.yellow("(needs reconnect)")}`;
|
|
1349
1335
|
}
|
|
1350
1336
|
return identity;
|
|
1351
1337
|
}
|
|
1352
|
-
var viewCommand = new
|
|
1338
|
+
var viewCommand = new Command().name("view").description("View a zero agent").argument("<agent-id>", "Agent ID").option("--instructions", "Also show instructions content").option("--permissions", "Show full permission details for each connector").addHelpText(
|
|
1353
1339
|
"after",
|
|
1354
1340
|
`
|
|
1355
1341
|
Examples:
|
|
@@ -1372,8 +1358,8 @@ Examples:
|
|
|
1372
1358
|
return [c.type, c];
|
|
1373
1359
|
})
|
|
1374
1360
|
);
|
|
1375
|
-
console.log(
|
|
1376
|
-
if (agent.displayName) console.log(
|
|
1361
|
+
console.log(source_default.bold(agent.agentId));
|
|
1362
|
+
if (agent.displayName) console.log(source_default.dim(agent.displayName));
|
|
1377
1363
|
console.log();
|
|
1378
1364
|
console.log(`Agent ID: ${agent.agentId}`);
|
|
1379
1365
|
const resolvedPolicies = resolveFirewallPolicies(
|
|
@@ -1397,14 +1383,14 @@ Examples:
|
|
|
1397
1383
|
if (agent.sound) console.log(`Sound: ${agent.sound}`);
|
|
1398
1384
|
if (options.permissions && connectorInfos.length > 0) {
|
|
1399
1385
|
console.log();
|
|
1400
|
-
console.log(
|
|
1386
|
+
console.log(source_default.bold("Connectors:"));
|
|
1401
1387
|
for (const info of connectorInfos) {
|
|
1402
1388
|
const identity = formatDetailIdentity(identityMap.get(info.type));
|
|
1403
1389
|
console.log(` ${info.type.padEnd(14)}${identity}`);
|
|
1404
1390
|
if (!info.hasFirewall) continue;
|
|
1405
1391
|
if (!info.policies) {
|
|
1406
1392
|
console.log(
|
|
1407
|
-
|
|
1393
|
+
source_default.dim(" full access \u2014 no permission rules configured")
|
|
1408
1394
|
);
|
|
1409
1395
|
continue;
|
|
1410
1396
|
}
|
|
@@ -1415,7 +1401,7 @@ Examples:
|
|
|
1415
1401
|
);
|
|
1416
1402
|
for (const perm of info.permissions) {
|
|
1417
1403
|
const policy = info.policies[perm.name] ?? "deny";
|
|
1418
|
-
const icon = policy === "allow" ?
|
|
1404
|
+
const icon = policy === "allow" ? source_default.green("\u2713") : policy === "ask" ? source_default.yellow("?") : source_default.dim("\u2717");
|
|
1419
1405
|
const desc = perm.description ?? "";
|
|
1420
1406
|
console.log(
|
|
1421
1407
|
` ${icon} ${perm.name.padEnd(nameWidth)} ${desc}`
|
|
@@ -1427,10 +1413,10 @@ Examples:
|
|
|
1427
1413
|
console.log();
|
|
1428
1414
|
const result = await getZeroAgentInstructions(agentId);
|
|
1429
1415
|
if (result.content) {
|
|
1430
|
-
console.log(
|
|
1416
|
+
console.log(source_default.dim("\u2500\u2500 Instructions \u2500\u2500"));
|
|
1431
1417
|
console.log(result.content);
|
|
1432
1418
|
} else {
|
|
1433
|
-
console.log(
|
|
1419
|
+
console.log(source_default.dim("No instructions set"));
|
|
1434
1420
|
}
|
|
1435
1421
|
}
|
|
1436
1422
|
}
|
|
@@ -1438,9 +1424,8 @@ Examples:
|
|
|
1438
1424
|
);
|
|
1439
1425
|
|
|
1440
1426
|
// src/commands/zero/agent/list.ts
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
var listCommand5 = new Command27().name("list").alias("ls").description("List all zero agents").addHelpText(
|
|
1427
|
+
init_esm_shims();
|
|
1428
|
+
var listCommand5 = new Command().name("list").alias("ls").description("List all zero agents").addHelpText(
|
|
1444
1429
|
"after",
|
|
1445
1430
|
`
|
|
1446
1431
|
Examples:
|
|
@@ -1452,9 +1437,9 @@ Notes:
|
|
|
1452
1437
|
withErrorHandler(async () => {
|
|
1453
1438
|
const agents = await listZeroAgents();
|
|
1454
1439
|
if (agents.length === 0) {
|
|
1455
|
-
console.log(
|
|
1440
|
+
console.log(source_default.dim("No zero agents found"));
|
|
1456
1441
|
console.log(
|
|
1457
|
-
|
|
1442
|
+
source_default.dim(
|
|
1458
1443
|
' Create one with: zero agent create --display-name "My Agent"'
|
|
1459
1444
|
)
|
|
1460
1445
|
);
|
|
@@ -1476,7 +1461,7 @@ Notes:
|
|
|
1476
1461
|
"AGENT ID".padEnd(idWidth),
|
|
1477
1462
|
"DISPLAY NAME".padEnd(displayWidth)
|
|
1478
1463
|
].join(" ");
|
|
1479
|
-
console.log(
|
|
1464
|
+
console.log(source_default.dim(header));
|
|
1480
1465
|
for (const agent of agents) {
|
|
1481
1466
|
const row = [
|
|
1482
1467
|
agent.agentId.padEnd(idWidth),
|
|
@@ -1488,9 +1473,8 @@ Notes:
|
|
|
1488
1473
|
);
|
|
1489
1474
|
|
|
1490
1475
|
// src/commands/zero/agent/delete.ts
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
var deleteCommand2 = new Command28().name("delete").alias("rm").description("Delete a zero agent").argument("<agent-id>", "Agent ID").option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
1476
|
+
init_esm_shims();
|
|
1477
|
+
var deleteCommand2 = new Command().name("delete").alias("rm").description("Delete a zero agent").argument("<agent-id>", "Agent ID").option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
1494
1478
|
"after",
|
|
1495
1479
|
`
|
|
1496
1480
|
Examples:
|
|
@@ -1511,17 +1495,17 @@ Notes:
|
|
|
1511
1495
|
false
|
|
1512
1496
|
);
|
|
1513
1497
|
if (!confirmed) {
|
|
1514
|
-
console.log(
|
|
1498
|
+
console.log(source_default.dim("Cancelled"));
|
|
1515
1499
|
return;
|
|
1516
1500
|
}
|
|
1517
1501
|
}
|
|
1518
1502
|
await deleteZeroAgent(agentId);
|
|
1519
|
-
console.log(
|
|
1503
|
+
console.log(source_default.green(`\u2713 Agent "${agentId}" deleted`));
|
|
1520
1504
|
})
|
|
1521
1505
|
);
|
|
1522
1506
|
|
|
1523
1507
|
// src/commands/zero/agent/index.ts
|
|
1524
|
-
var zeroAgentCommand = new
|
|
1508
|
+
var zeroAgentCommand = new Command("agent").description("View or manage zero agents").addCommand(createCommand).addCommand(editCommand).addCommand(viewCommand).addCommand(listCommand5).addCommand(deleteCommand2).addHelpText(
|
|
1525
1509
|
"after",
|
|
1526
1510
|
`
|
|
1527
1511
|
Examples:
|
|
@@ -1538,21 +1522,21 @@ Notes:
|
|
|
1538
1522
|
);
|
|
1539
1523
|
|
|
1540
1524
|
// src/commands/zero/connector/index.ts
|
|
1541
|
-
|
|
1525
|
+
init_esm_shims();
|
|
1542
1526
|
|
|
1543
1527
|
// src/commands/zero/connector/connect.ts
|
|
1544
|
-
|
|
1545
|
-
import chalk27 from "chalk";
|
|
1528
|
+
init_esm_shims();
|
|
1546
1529
|
|
|
1547
1530
|
// src/lib/computer/start-services.ts
|
|
1531
|
+
init_esm_shims();
|
|
1548
1532
|
import { spawn } from "child_process";
|
|
1549
1533
|
import { access, constants } from "fs/promises";
|
|
1550
1534
|
import { createServer } from "net";
|
|
1551
1535
|
import { homedir } from "os";
|
|
1552
1536
|
import { join } from "path";
|
|
1553
|
-
import chalk26 from "chalk";
|
|
1554
1537
|
|
|
1555
1538
|
// src/lib/computer/ngrok.ts
|
|
1539
|
+
init_esm_shims();
|
|
1556
1540
|
async function loadNgrok() {
|
|
1557
1541
|
try {
|
|
1558
1542
|
const mod = await import("@ngrok/ngrok");
|
|
@@ -1640,7 +1624,7 @@ async function checkComputerDependencies() {
|
|
|
1640
1624
|
}
|
|
1641
1625
|
}
|
|
1642
1626
|
async function startComputerServices(credentials) {
|
|
1643
|
-
console.log(
|
|
1627
|
+
console.log(source_default.cyan("Starting computer connector services..."));
|
|
1644
1628
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
1645
1629
|
if (!wsgidavBinary) {
|
|
1646
1630
|
throw new Error(
|
|
@@ -1671,7 +1655,7 @@ async function startComputerServices(credentials) {
|
|
|
1671
1655
|
wsgidav.stderr?.on("data", (data) => {
|
|
1672
1656
|
return process.stderr.write(data);
|
|
1673
1657
|
});
|
|
1674
|
-
console.log(
|
|
1658
|
+
console.log(source_default.green("\u2713 WebDAV server started"));
|
|
1675
1659
|
const chrome = spawn(
|
|
1676
1660
|
chromeBinary,
|
|
1677
1661
|
[
|
|
@@ -1689,7 +1673,7 @@ async function startComputerServices(credentials) {
|
|
|
1689
1673
|
chrome.stderr?.on("data", (data) => {
|
|
1690
1674
|
return process.stderr.write(data);
|
|
1691
1675
|
});
|
|
1692
|
-
console.log(
|
|
1676
|
+
console.log(source_default.green("\u2713 Chrome started"));
|
|
1693
1677
|
try {
|
|
1694
1678
|
await startNgrokTunnels(
|
|
1695
1679
|
credentials.ngrokToken,
|
|
@@ -1698,18 +1682,18 @@ async function startComputerServices(credentials) {
|
|
|
1698
1682
|
cdpPort
|
|
1699
1683
|
);
|
|
1700
1684
|
console.log(
|
|
1701
|
-
|
|
1685
|
+
source_default.green(
|
|
1702
1686
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
1703
1687
|
)
|
|
1704
1688
|
);
|
|
1705
1689
|
console.log();
|
|
1706
|
-
console.log(
|
|
1690
|
+
console.log(source_default.green("\u2713 Computer connector active"));
|
|
1707
1691
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
1708
1692
|
console.log(
|
|
1709
1693
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
1710
1694
|
);
|
|
1711
1695
|
console.log();
|
|
1712
|
-
console.log(
|
|
1696
|
+
console.log(source_default.dim("Press ^C twice to disconnect"));
|
|
1713
1697
|
console.log();
|
|
1714
1698
|
let sigintCount = 0;
|
|
1715
1699
|
await new Promise((resolve) => {
|
|
@@ -1723,7 +1707,7 @@ async function startComputerServices(credentials) {
|
|
|
1723
1707
|
const onSigint = () => {
|
|
1724
1708
|
sigintCount++;
|
|
1725
1709
|
if (sigintCount === 1) {
|
|
1726
|
-
console.log(
|
|
1710
|
+
console.log(source_default.dim("\nPress ^C again to disconnect and exit..."));
|
|
1727
1711
|
} else {
|
|
1728
1712
|
done();
|
|
1729
1713
|
}
|
|
@@ -1733,11 +1717,11 @@ async function startComputerServices(credentials) {
|
|
|
1733
1717
|
});
|
|
1734
1718
|
} finally {
|
|
1735
1719
|
console.log();
|
|
1736
|
-
console.log(
|
|
1720
|
+
console.log(source_default.cyan("Stopping services..."));
|
|
1737
1721
|
wsgidav.kill("SIGTERM");
|
|
1738
1722
|
chrome.kill("SIGTERM");
|
|
1739
1723
|
await stopNgrokTunnels();
|
|
1740
|
-
console.log(
|
|
1724
|
+
console.log(source_default.green("\u2713 Services stopped"));
|
|
1741
1725
|
}
|
|
1742
1726
|
}
|
|
1743
1727
|
|
|
@@ -1749,11 +1733,11 @@ function delay(ms) {
|
|
|
1749
1733
|
}
|
|
1750
1734
|
function renderHelpText(text) {
|
|
1751
1735
|
return text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, label, url) => {
|
|
1752
|
-
return `${label} (${
|
|
1736
|
+
return `${label} (${source_default.cyan(url)})`;
|
|
1753
1737
|
}).replace(/\*\*([^*]+)\*\*/g, (_m, content) => {
|
|
1754
|
-
return
|
|
1738
|
+
return source_default.bold(content);
|
|
1755
1739
|
}).replace(/^> (.+)$/gm, (_m, content) => {
|
|
1756
|
-
return
|
|
1740
|
+
return source_default.yellow(` ${content}`);
|
|
1757
1741
|
});
|
|
1758
1742
|
}
|
|
1759
1743
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -1778,10 +1762,10 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
1778
1762
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
1779
1763
|
if (!secretConfig.required) continue;
|
|
1780
1764
|
const value = await promptPassword(
|
|
1781
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
1765
|
+
`${secretConfig.label}${secretConfig.placeholder ? source_default.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
1782
1766
|
);
|
|
1783
1767
|
if (!value) {
|
|
1784
|
-
console.log(
|
|
1768
|
+
console.log(source_default.dim("Cancelled"));
|
|
1785
1769
|
return;
|
|
1786
1770
|
}
|
|
1787
1771
|
inputSecrets[secretName] = value;
|
|
@@ -1794,17 +1778,17 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
1794
1778
|
description: `API token for ${config.label} connector`
|
|
1795
1779
|
});
|
|
1796
1780
|
}
|
|
1797
|
-
console.log(
|
|
1781
|
+
console.log(source_default.green(`
|
|
1798
1782
|
\u2713 Connector "${connectorType}" connected`));
|
|
1799
1783
|
}
|
|
1800
1784
|
async function connectComputer() {
|
|
1801
1785
|
await checkComputerDependencies();
|
|
1802
|
-
console.log(
|
|
1786
|
+
console.log(source_default.cyan("Setting up computer connector..."));
|
|
1803
1787
|
const credentials = await createZeroComputerConnector();
|
|
1804
1788
|
await startComputerServices(credentials);
|
|
1805
|
-
console.log(
|
|
1789
|
+
console.log(source_default.cyan("Disconnecting computer connector..."));
|
|
1806
1790
|
await deleteZeroComputerConnector();
|
|
1807
|
-
console.log(
|
|
1791
|
+
console.log(source_default.green("\u2713 Disconnected computer"));
|
|
1808
1792
|
}
|
|
1809
1793
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
1810
1794
|
const config = CONNECTOR_TYPES[connectorType];
|
|
@@ -1832,7 +1816,7 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
1832
1816
|
]
|
|
1833
1817
|
);
|
|
1834
1818
|
if (!selected) {
|
|
1835
|
-
console.log(
|
|
1819
|
+
console.log(source_default.dim("Cancelled"));
|
|
1836
1820
|
return null;
|
|
1837
1821
|
}
|
|
1838
1822
|
return selected;
|
|
@@ -1844,12 +1828,12 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
1844
1828
|
);
|
|
1845
1829
|
}
|
|
1846
1830
|
async function connectViaOAuth(connectorType) {
|
|
1847
|
-
console.log(`Connecting ${
|
|
1831
|
+
console.log(`Connecting ${source_default.cyan(connectorType)}...`);
|
|
1848
1832
|
const session = await createZeroConnectorSession(connectorType);
|
|
1849
1833
|
const apiUrl = await getBaseUrl();
|
|
1850
1834
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
1851
|
-
console.log(
|
|
1852
|
-
console.log(
|
|
1835
|
+
console.log(source_default.green("\nSession created"));
|
|
1836
|
+
console.log(source_default.cyan(`
|
|
1853
1837
|
To connect, visit: ${verificationUrl}`));
|
|
1854
1838
|
console.log(
|
|
1855
1839
|
`
|
|
@@ -1869,7 +1853,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
1869
1853
|
switch (status.status) {
|
|
1870
1854
|
case "complete":
|
|
1871
1855
|
console.log(
|
|
1872
|
-
|
|
1856
|
+
source_default.green(`
|
|
1873
1857
|
|
|
1874
1858
|
\u2713 Connector "${connectorType}" connected`)
|
|
1875
1859
|
);
|
|
@@ -1881,13 +1865,13 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
1881
1865
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
1882
1866
|
);
|
|
1883
1867
|
case "pending":
|
|
1884
|
-
process.stdout.write(
|
|
1868
|
+
process.stdout.write(source_default.dim("."));
|
|
1885
1869
|
break;
|
|
1886
1870
|
}
|
|
1887
1871
|
}
|
|
1888
1872
|
throw new Error("Session timed out, please try again");
|
|
1889
1873
|
}
|
|
1890
|
-
var connectCommand = new
|
|
1874
|
+
var connectCommand = new Command().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").option("--token <value>", "API token value (skip interactive prompt)").action(
|
|
1891
1875
|
withErrorHandler(async (type, options) => {
|
|
1892
1876
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
1893
1877
|
if (!parseResult.success) {
|
|
@@ -1912,9 +1896,8 @@ var connectCommand = new Command30().name("connect").description("Connect a thir
|
|
|
1912
1896
|
);
|
|
1913
1897
|
|
|
1914
1898
|
// src/commands/zero/connector/list.ts
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
var listCommand6 = new Command31().name("list").alias("ls").description("List all connectors and their status").action(
|
|
1899
|
+
init_esm_shims();
|
|
1900
|
+
var listCommand6 = new Command().name("list").alias("ls").description("List all connectors and their status").action(
|
|
1918
1901
|
withErrorHandler(async () => {
|
|
1919
1902
|
const result = await listZeroConnectors();
|
|
1920
1903
|
const connectedMap = new Map(
|
|
@@ -1946,26 +1929,26 @@ var listCommand6 = new Command31().name("list").alias("ls").description("List al
|
|
|
1946
1929
|
statusText.padEnd(statusWidth),
|
|
1947
1930
|
"ACCOUNT"
|
|
1948
1931
|
].join(" ");
|
|
1949
|
-
console.log(
|
|
1932
|
+
console.log(source_default.dim(header));
|
|
1950
1933
|
for (const type of allTypes) {
|
|
1951
1934
|
const connector = connectedMap.get(type);
|
|
1952
1935
|
const scopeMismatch = connector !== void 0 && connector.authMethod === "oauth" && !hasRequiredScopes(type, connector.oauthScopes);
|
|
1953
|
-
const status = connector ? connector.needsReconnect ?
|
|
1954
|
-
const account = connector?.needsReconnect ?
|
|
1936
|
+
const status = connector ? connector.needsReconnect ? source_default.yellow("!".padEnd(statusWidth)) : scopeMismatch ? source_default.yellow("!".padEnd(statusWidth)) : source_default.green("\u2713".padEnd(statusWidth)) : source_default.dim("-".padEnd(statusWidth));
|
|
1937
|
+
const account = connector?.needsReconnect ? source_default.yellow("(reconnect needed)") : scopeMismatch ? source_default.yellow("(permissions update available)") : connector?.externalUsername ? `@${connector.externalUsername}` : source_default.dim("-");
|
|
1955
1938
|
const row = [type.padEnd(typeWidth), status, account].join(" ");
|
|
1956
1939
|
console.log(row);
|
|
1957
1940
|
}
|
|
1958
1941
|
console.log();
|
|
1959
|
-
console.log(
|
|
1960
|
-
console.log(
|
|
1942
|
+
console.log(source_default.dim("To connect a service:"));
|
|
1943
|
+
console.log(source_default.dim(" zero connector connect <type>"));
|
|
1961
1944
|
})
|
|
1962
1945
|
);
|
|
1963
1946
|
|
|
1964
1947
|
// src/commands/zero/connector/status.ts
|
|
1965
|
-
|
|
1966
|
-
import chalk29 from "chalk";
|
|
1948
|
+
init_esm_shims();
|
|
1967
1949
|
|
|
1968
1950
|
// src/lib/domain/schedule-utils.ts
|
|
1951
|
+
init_esm_shims();
|
|
1969
1952
|
function formatRelativeTime(dateStr) {
|
|
1970
1953
|
if (!dateStr) return "-";
|
|
1971
1954
|
const date = new Date(dateStr);
|
|
@@ -2080,7 +2063,7 @@ function toISODateTime(dateTimeStr) {
|
|
|
2080
2063
|
|
|
2081
2064
|
// src/commands/zero/connector/status.ts
|
|
2082
2065
|
var LABEL_WIDTH = 16;
|
|
2083
|
-
var statusCommand2 = new
|
|
2066
|
+
var statusCommand2 = new Command().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
2084
2067
|
withErrorHandler(async (type) => {
|
|
2085
2068
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
2086
2069
|
if (!parseResult.success) {
|
|
@@ -2090,11 +2073,11 @@ var statusCommand2 = new Command32().name("status").description("Show detailed s
|
|
|
2090
2073
|
});
|
|
2091
2074
|
}
|
|
2092
2075
|
const connector = await getZeroConnector(parseResult.data);
|
|
2093
|
-
console.log(`Connector: ${
|
|
2076
|
+
console.log(`Connector: ${source_default.cyan(type)}`);
|
|
2094
2077
|
console.log();
|
|
2095
2078
|
if (connector) {
|
|
2096
2079
|
console.log(
|
|
2097
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
2080
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${source_default.green("connected")}`
|
|
2098
2081
|
);
|
|
2099
2082
|
console.log(
|
|
2100
2083
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -2110,7 +2093,7 @@ var statusCommand2 = new Command32().name("status").description("Show detailed s
|
|
|
2110
2093
|
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
2111
2094
|
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
2112
2095
|
console.log(
|
|
2113
|
-
`${"Permissions:".padEnd(LABEL_WIDTH)}${
|
|
2096
|
+
`${"Permissions:".padEnd(LABEL_WIDTH)}${source_default.yellow("update available")}`
|
|
2114
2097
|
);
|
|
2115
2098
|
if (diff.addedScopes.length > 0) {
|
|
2116
2099
|
console.log(
|
|
@@ -2132,23 +2115,22 @@ var statusCommand2 = new Command32().name("status").description("Show detailed s
|
|
|
2132
2115
|
);
|
|
2133
2116
|
}
|
|
2134
2117
|
console.log();
|
|
2135
|
-
console.log(
|
|
2136
|
-
console.log(
|
|
2118
|
+
console.log(source_default.dim("To disconnect:"));
|
|
2119
|
+
console.log(source_default.dim(` zero connector disconnect ${type}`));
|
|
2137
2120
|
} else {
|
|
2138
2121
|
console.log(
|
|
2139
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
2122
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${source_default.dim("not connected")}`
|
|
2140
2123
|
);
|
|
2141
2124
|
console.log();
|
|
2142
|
-
console.log(
|
|
2143
|
-
console.log(
|
|
2125
|
+
console.log(source_default.dim("To connect:"));
|
|
2126
|
+
console.log(source_default.dim(` zero connector connect ${type}`));
|
|
2144
2127
|
}
|
|
2145
2128
|
})
|
|
2146
2129
|
);
|
|
2147
2130
|
|
|
2148
2131
|
// src/commands/zero/connector/disconnect.ts
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
var disconnectCommand = new Command33().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
2132
|
+
init_esm_shims();
|
|
2133
|
+
var disconnectCommand = new Command().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
2152
2134
|
withErrorHandler(async (type) => {
|
|
2153
2135
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
2154
2136
|
if (!parseResult.success) {
|
|
@@ -2159,20 +2141,21 @@ var disconnectCommand = new Command33().name("disconnect").description("Disconne
|
|
|
2159
2141
|
}
|
|
2160
2142
|
const connectorType = parseResult.data;
|
|
2161
2143
|
await deleteZeroConnector(connectorType);
|
|
2162
|
-
console.log(
|
|
2144
|
+
console.log(source_default.green(`\u2713 Disconnected ${type}`));
|
|
2163
2145
|
})
|
|
2164
2146
|
);
|
|
2165
2147
|
|
|
2166
2148
|
// src/commands/zero/connector/index.ts
|
|
2167
|
-
var zeroConnectorCommand = new
|
|
2149
|
+
var zeroConnectorCommand = new Command().name("connector").description("Check or connect third-party services (GitHub, Slack, etc.)").addCommand(listCommand6).addCommand(statusCommand2).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
2168
2150
|
|
|
2169
2151
|
// src/commands/zero/doctor/index.ts
|
|
2170
|
-
|
|
2152
|
+
init_esm_shims();
|
|
2171
2153
|
|
|
2172
2154
|
// src/commands/zero/doctor/missing-token.ts
|
|
2173
|
-
|
|
2155
|
+
init_esm_shims();
|
|
2174
2156
|
|
|
2175
2157
|
// src/commands/zero/doctor/platform-url.ts
|
|
2158
|
+
init_esm_shims();
|
|
2176
2159
|
function toPlatformUrl(apiUrl) {
|
|
2177
2160
|
const parsed = new URL(apiUrl);
|
|
2178
2161
|
const parts = parsed.hostname.split(".");
|
|
@@ -2192,7 +2175,7 @@ async function getPlatformOrigin() {
|
|
|
2192
2175
|
}
|
|
2193
2176
|
|
|
2194
2177
|
// src/commands/zero/doctor/missing-token.ts
|
|
2195
|
-
var missingTokenCommand = new
|
|
2178
|
+
var missingTokenCommand = new Command().name("missing-token").description(
|
|
2196
2179
|
"Diagnose a missing token and find the connector that provides it"
|
|
2197
2180
|
).argument("<token-name>", "The environment variable / token name to look up").addHelpText(
|
|
2198
2181
|
"after",
|
|
@@ -2231,10 +2214,12 @@ Notes:
|
|
|
2231
2214
|
]);
|
|
2232
2215
|
const isConnected = connector !== null;
|
|
2233
2216
|
const hasPermission = enabledTypes !== null && enabledTypes.includes(connectorType);
|
|
2217
|
+
const rediagnoseHint = `Important: if ${tokenName} is still missing after the user takes action, run \`zero doctor missing-token ${tokenName}\` again to re-diagnose instead of assuming the status.`;
|
|
2234
2218
|
if (!isConnected) {
|
|
2235
|
-
const
|
|
2219
|
+
const connectUrl = agentId ? `${platformUrl.origin}/connectors/${connectorType}/connect?agentId=${agentId}` : `${platformUrl.origin}/connectors/${connectorType}/connect`;
|
|
2236
2220
|
console.log(
|
|
2237
|
-
`The ${label} connector is not connected. Ask the user to connect it at: [Connect ${label}](${
|
|
2221
|
+
`The ${label} connector is not connected. Ask the user to connect it at: [Connect ${label}](${connectUrl})
|
|
2222
|
+
${rediagnoseHint}`
|
|
2238
2223
|
);
|
|
2239
2224
|
return;
|
|
2240
2225
|
}
|
|
@@ -2255,18 +2240,20 @@ Notes:
|
|
|
2255
2240
|
for (const issue of issues) {
|
|
2256
2241
|
console.log(issue);
|
|
2257
2242
|
}
|
|
2243
|
+
console.log(rediagnoseHint);
|
|
2258
2244
|
} else {
|
|
2259
2245
|
const url = `${platformUrl.origin}/connectors`;
|
|
2260
2246
|
console.log(
|
|
2261
|
-
`The ${label} connector is connected and authorized, but the token is still missing. Ask VM0 developer to resolve this issue. Connector status: [Check ${label} status](${url})
|
|
2247
|
+
`The ${label} connector is connected and authorized, but the token is still missing. Ask VM0 developer to resolve this issue. Connector status: [Check ${label} status](${url})
|
|
2248
|
+
${rediagnoseHint}`
|
|
2262
2249
|
);
|
|
2263
2250
|
}
|
|
2264
2251
|
})
|
|
2265
2252
|
);
|
|
2266
2253
|
|
|
2267
2254
|
// src/commands/zero/doctor/firewall-deny.ts
|
|
2268
|
-
|
|
2269
|
-
var firewallDenyCommand = new
|
|
2255
|
+
init_esm_shims();
|
|
2256
|
+
var firewallDenyCommand = new Command().name("firewall-deny").description(
|
|
2270
2257
|
"Diagnose a firewall denial and find the permission that covers it"
|
|
2271
2258
|
).argument("<firewall-ref>", "The firewall connector type (e.g. github)").addOption(
|
|
2272
2259
|
new Option(
|
|
@@ -2315,9 +2302,10 @@ Notes:
|
|
|
2315
2302
|
);
|
|
2316
2303
|
|
|
2317
2304
|
// src/commands/zero/doctor/firewall-permissions-change.ts
|
|
2318
|
-
|
|
2305
|
+
init_esm_shims();
|
|
2319
2306
|
|
|
2320
2307
|
// src/commands/zero/doctor/resolve-role.ts
|
|
2308
|
+
init_esm_shims();
|
|
2321
2309
|
async function resolveUserId() {
|
|
2322
2310
|
const zeroPayload = decodeZeroTokenPayload();
|
|
2323
2311
|
if (zeroPayload?.userId) return zeroPayload.userId;
|
|
@@ -2410,21 +2398,21 @@ async function outputPermissionChangeMessage(firewallRef, permission, action, re
|
|
|
2410
2398
|
);
|
|
2411
2399
|
}
|
|
2412
2400
|
}
|
|
2413
|
-
var firewallPermissionsChangeCommand = new
|
|
2414
|
-
new
|
|
2401
|
+
var firewallPermissionsChangeCommand = new Command().name("firewall-permissions-change").description("Request a firewall permission change (enable or disable)").argument("<firewall-ref>", "The firewall connector type (e.g. github)").addOption(
|
|
2402
|
+
new Option(
|
|
2415
2403
|
"--permission <name>",
|
|
2416
2404
|
"The permission name to change"
|
|
2417
2405
|
).makeOptionMandatory()
|
|
2418
2406
|
).addOption(
|
|
2419
|
-
new
|
|
2407
|
+
new Option("--enable", "Request to enable the permission").conflicts(
|
|
2420
2408
|
"disable"
|
|
2421
2409
|
)
|
|
2422
2410
|
).addOption(
|
|
2423
|
-
new
|
|
2411
|
+
new Option("--disable", "Request to disable the permission").conflicts(
|
|
2424
2412
|
"enable"
|
|
2425
2413
|
)
|
|
2426
2414
|
).addOption(
|
|
2427
|
-
new
|
|
2415
|
+
new Option(
|
|
2428
2416
|
"--reason <text>",
|
|
2429
2417
|
"Brief reason why the permission is needed (max 500 chars)"
|
|
2430
2418
|
)
|
|
@@ -2464,7 +2452,7 @@ Notes:
|
|
|
2464
2452
|
);
|
|
2465
2453
|
|
|
2466
2454
|
// src/commands/zero/doctor/index.ts
|
|
2467
|
-
var zeroDoctorCommand = new
|
|
2455
|
+
var zeroDoctorCommand = new Command().name("doctor").description("Diagnose runtime issues (missing tokens, firewall denials)").addCommand(missingTokenCommand).addCommand(firewallDenyCommand).addCommand(firewallPermissionsChangeCommand).addHelpText(
|
|
2468
2456
|
"after",
|
|
2469
2457
|
`
|
|
2470
2458
|
Examples:
|
|
@@ -2478,8 +2466,7 @@ Notes:
|
|
|
2478
2466
|
);
|
|
2479
2467
|
|
|
2480
2468
|
// src/commands/zero/preference/index.ts
|
|
2481
|
-
|
|
2482
|
-
import chalk31 from "chalk";
|
|
2469
|
+
init_esm_shims();
|
|
2483
2470
|
function detectTimezone2() {
|
|
2484
2471
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2485
2472
|
}
|
|
@@ -2492,9 +2479,9 @@ function isValidTimezone(timezone) {
|
|
|
2492
2479
|
}
|
|
2493
2480
|
}
|
|
2494
2481
|
function displayPreferences(prefs) {
|
|
2495
|
-
console.log(
|
|
2482
|
+
console.log(source_default.bold("Current preferences:"));
|
|
2496
2483
|
console.log(
|
|
2497
|
-
` Timezone: ${prefs.timezone ?
|
|
2484
|
+
` Timezone: ${prefs.timezone ? source_default.cyan(prefs.timezone) : source_default.dim("not set")}`
|
|
2498
2485
|
);
|
|
2499
2486
|
}
|
|
2500
2487
|
function buildUpdates(opts) {
|
|
@@ -2511,8 +2498,8 @@ function buildUpdates(opts) {
|
|
|
2511
2498
|
function printUpdateResult(updates, result) {
|
|
2512
2499
|
if (updates.timezone !== void 0) {
|
|
2513
2500
|
console.log(
|
|
2514
|
-
|
|
2515
|
-
`Timezone set to ${
|
|
2501
|
+
source_default.green(
|
|
2502
|
+
`Timezone set to ${source_default.cyan(result.timezone ?? updates.timezone)}`
|
|
2516
2503
|
)
|
|
2517
2504
|
);
|
|
2518
2505
|
}
|
|
@@ -2520,7 +2507,7 @@ function printUpdateResult(updates, result) {
|
|
|
2520
2507
|
async function interactiveSetup(prefs) {
|
|
2521
2508
|
if (!prefs.timezone) {
|
|
2522
2509
|
const detectedTz = detectTimezone2();
|
|
2523
|
-
console.log(
|
|
2510
|
+
console.log(source_default.dim(`
|
|
2524
2511
|
System timezone detected: ${detectedTz}`));
|
|
2525
2512
|
const tz = await promptText(
|
|
2526
2513
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -2531,11 +2518,11 @@ System timezone detected: ${detectedTz}`));
|
|
|
2531
2518
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
2532
2519
|
}
|
|
2533
2520
|
await updateZeroUserPreferences({ timezone: tz.trim() });
|
|
2534
|
-
console.log(
|
|
2521
|
+
console.log(source_default.green(`Timezone set to ${source_default.cyan(tz.trim())}`));
|
|
2535
2522
|
}
|
|
2536
2523
|
}
|
|
2537
2524
|
}
|
|
2538
|
-
var zeroPreferenceCommand = new
|
|
2525
|
+
var zeroPreferenceCommand = new Command().name("preference").description("View or update user preferences (timezone, notifications)").option("--timezone <timezone>", "IANA timezone (e.g., America/New_York)").action(
|
|
2539
2526
|
withErrorHandler(async (opts) => {
|
|
2540
2527
|
const updates = buildUpdates(opts);
|
|
2541
2528
|
if (updates) {
|
|
@@ -2550,20 +2537,23 @@ var zeroPreferenceCommand = new Command39().name("preference").description("View
|
|
|
2550
2537
|
} else if (!prefs.timezone) {
|
|
2551
2538
|
console.log();
|
|
2552
2539
|
console.log(
|
|
2553
|
-
`To set timezone: ${
|
|
2540
|
+
`To set timezone: ${source_default.cyan("zero preference --timezone <timezone>")}`
|
|
2554
2541
|
);
|
|
2555
2542
|
console.log(
|
|
2556
|
-
|
|
2543
|
+
source_default.dim("Example: zero preference --timezone America/New_York")
|
|
2557
2544
|
);
|
|
2558
2545
|
}
|
|
2559
2546
|
})
|
|
2560
2547
|
);
|
|
2561
2548
|
|
|
2549
|
+
// src/commands/zero/run/index.ts
|
|
2550
|
+
init_esm_shims();
|
|
2551
|
+
|
|
2562
2552
|
// src/commands/zero/run/run.ts
|
|
2563
|
-
|
|
2553
|
+
init_esm_shims();
|
|
2564
2554
|
|
|
2565
2555
|
// src/commands/zero/run/shared.ts
|
|
2566
|
-
|
|
2556
|
+
init_esm_shims();
|
|
2567
2557
|
function toRunResult(result) {
|
|
2568
2558
|
const { checkpointId, agentSessionId, conversationId } = result;
|
|
2569
2559
|
if (!checkpointId || !agentSessionId || !conversationId) {
|
|
@@ -2616,11 +2606,11 @@ async function pollZeroEvents(runId, options) {
|
|
|
2616
2606
|
result = { succeeded: false, runId };
|
|
2617
2607
|
} else if (runStatus === "timeout") {
|
|
2618
2608
|
complete = true;
|
|
2619
|
-
console.error(
|
|
2609
|
+
console.error(source_default.red("\n\u2717 Run timed out"));
|
|
2620
2610
|
result = { succeeded: false, runId };
|
|
2621
2611
|
} else if (runStatus === "cancelled") {
|
|
2622
2612
|
complete = true;
|
|
2623
|
-
console.error(
|
|
2613
|
+
console.error(source_default.yellow("\n\u2717 Run cancelled"));
|
|
2624
2614
|
result = { succeeded: false, runId };
|
|
2625
2615
|
}
|
|
2626
2616
|
if (!complete) {
|
|
@@ -2637,13 +2627,13 @@ function showZeroNextSteps(result) {
|
|
|
2637
2627
|
if (sessionId) {
|
|
2638
2628
|
console.log(" Continue delegation:");
|
|
2639
2629
|
console.log(
|
|
2640
|
-
|
|
2630
|
+
source_default.cyan(` zero run continue ${sessionId} "your next prompt"`)
|
|
2641
2631
|
);
|
|
2642
2632
|
}
|
|
2643
2633
|
}
|
|
2644
2634
|
|
|
2645
2635
|
// src/commands/zero/run/run.ts
|
|
2646
|
-
var mainRunCommand = new
|
|
2636
|
+
var mainRunCommand = new Command().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(
|
|
2647
2637
|
"--model-provider <type>",
|
|
2648
2638
|
"Override model provider (e.g., anthropic-api-key)"
|
|
2649
2639
|
).option("--verbose", "Show full tool inputs and outputs").addHelpText(
|
|
@@ -2691,8 +2681,8 @@ Notes:
|
|
|
2691
2681
|
);
|
|
2692
2682
|
|
|
2693
2683
|
// src/commands/zero/run/continue.ts
|
|
2694
|
-
|
|
2695
|
-
var continueCommand = new
|
|
2684
|
+
init_esm_shims();
|
|
2685
|
+
var continueCommand = new Command().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(
|
|
2696
2686
|
"--model-provider <type>",
|
|
2697
2687
|
"Override model provider (e.g., anthropic-api-key)"
|
|
2698
2688
|
).option("--verbose", "Show full tool inputs and outputs").addHelpText(
|
|
@@ -2749,11 +2739,10 @@ Examples:
|
|
|
2749
2739
|
var zeroRunCommand = mainRunCommand;
|
|
2750
2740
|
|
|
2751
2741
|
// src/commands/zero/schedule/index.ts
|
|
2752
|
-
|
|
2742
|
+
init_esm_shims();
|
|
2753
2743
|
|
|
2754
2744
|
// src/commands/zero/schedule/setup.ts
|
|
2755
|
-
|
|
2756
|
-
import chalk33 from "chalk";
|
|
2745
|
+
init_esm_shims();
|
|
2757
2746
|
var FREQUENCY_CHOICES = [
|
|
2758
2747
|
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
2759
2748
|
{
|
|
@@ -2971,7 +2960,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
2971
2960
|
userTimezone = prefs.timezone;
|
|
2972
2961
|
} catch {
|
|
2973
2962
|
console.log(
|
|
2974
|
-
|
|
2963
|
+
source_default.dim("Could not fetch timezone preference, using detected timezone")
|
|
2975
2964
|
);
|
|
2976
2965
|
}
|
|
2977
2966
|
const defaultTimezone = userTimezone || detectTimezone();
|
|
@@ -3073,7 +3062,7 @@ async function buildAndDeploy(params) {
|
|
|
3073
3062
|
}
|
|
3074
3063
|
console.log(
|
|
3075
3064
|
`
|
|
3076
|
-
Deploying schedule for agent ${
|
|
3065
|
+
Deploying schedule for agent ${source_default.cyan(params.agentName)}...`
|
|
3077
3066
|
);
|
|
3078
3067
|
const deployResult = await deployZeroSchedule({
|
|
3079
3068
|
name: params.scheduleName,
|
|
@@ -3088,58 +3077,58 @@ Deploying schedule for agent ${chalk33.cyan(params.agentName)}...`
|
|
|
3088
3077
|
}
|
|
3089
3078
|
function displayDeployResult(scheduleName, deployResult) {
|
|
3090
3079
|
if (deployResult.created) {
|
|
3091
|
-
console.log(
|
|
3080
|
+
console.log(source_default.green(`\u2713 Schedule "${scheduleName}" created`));
|
|
3092
3081
|
} else {
|
|
3093
|
-
console.log(
|
|
3082
|
+
console.log(source_default.green(`\u2713 Schedule "${scheduleName}" updated`));
|
|
3094
3083
|
}
|
|
3095
|
-
console.log(
|
|
3084
|
+
console.log(source_default.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
3096
3085
|
if (deployResult.schedule.triggerType === "loop" && deployResult.schedule.intervalSeconds != null) {
|
|
3097
3086
|
console.log(
|
|
3098
|
-
|
|
3087
|
+
source_default.dim(
|
|
3099
3088
|
` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`
|
|
3100
3089
|
)
|
|
3101
3090
|
);
|
|
3102
3091
|
} else if (deployResult.schedule.cronExpression) {
|
|
3103
|
-
console.log(
|
|
3092
|
+
console.log(source_default.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
3104
3093
|
if (deployResult.schedule.nextRunAt) {
|
|
3105
3094
|
const nextRun = formatInTimezone(
|
|
3106
3095
|
deployResult.schedule.nextRunAt,
|
|
3107
3096
|
deployResult.schedule.timezone
|
|
3108
3097
|
);
|
|
3109
|
-
console.log(
|
|
3098
|
+
console.log(source_default.dim(` Next run: ${nextRun}`));
|
|
3110
3099
|
}
|
|
3111
3100
|
} else if (deployResult.schedule.atTime) {
|
|
3112
3101
|
const atTimeFormatted = formatInTimezone(
|
|
3113
3102
|
deployResult.schedule.atTime,
|
|
3114
3103
|
deployResult.schedule.timezone
|
|
3115
3104
|
);
|
|
3116
|
-
console.log(
|
|
3105
|
+
console.log(source_default.dim(` At: ${atTimeFormatted}`));
|
|
3117
3106
|
}
|
|
3118
3107
|
}
|
|
3119
3108
|
async function tryEnableSchedule(scheduleName, agentId, agentName) {
|
|
3120
3109
|
try {
|
|
3121
3110
|
await enableZeroSchedule({ name: scheduleName, agentId });
|
|
3122
|
-
console.log(
|
|
3111
|
+
console.log(source_default.green(`\u2713 Schedule "${scheduleName}" enabled`));
|
|
3123
3112
|
} catch (error) {
|
|
3124
|
-
console.error(
|
|
3113
|
+
console.error(source_default.yellow("\u26A0 Failed to enable schedule"));
|
|
3125
3114
|
if (error instanceof ApiRequestError) {
|
|
3126
3115
|
if (error.code === "SCHEDULE_PAST") {
|
|
3127
|
-
console.error(
|
|
3116
|
+
console.error(source_default.dim(" Scheduled time has already passed"));
|
|
3128
3117
|
} else {
|
|
3129
|
-
console.error(
|
|
3118
|
+
console.error(source_default.dim(` ${error.message}`));
|
|
3130
3119
|
}
|
|
3131
3120
|
} else if (error instanceof Error) {
|
|
3132
|
-
console.error(
|
|
3121
|
+
console.error(source_default.dim(` ${error.message}`));
|
|
3133
3122
|
}
|
|
3134
3123
|
console.log(
|
|
3135
|
-
` To enable manually: ${
|
|
3124
|
+
` To enable manually: ${source_default.cyan(`zero schedule enable ${agentName}`)}`
|
|
3136
3125
|
);
|
|
3137
3126
|
}
|
|
3138
3127
|
}
|
|
3139
3128
|
function showEnableHint(agentName) {
|
|
3140
3129
|
console.log();
|
|
3141
3130
|
console.log(
|
|
3142
|
-
` To enable: ${
|
|
3131
|
+
` To enable: ${source_default.cyan(`zero schedule enable ${agentName}`)}`
|
|
3143
3132
|
);
|
|
3144
3133
|
}
|
|
3145
3134
|
async function handleScheduleEnabling(params) {
|
|
@@ -3161,7 +3150,7 @@ async function handleScheduleEnabling(params) {
|
|
|
3161
3150
|
showEnableHint(agentName);
|
|
3162
3151
|
}
|
|
3163
3152
|
}
|
|
3164
|
-
var setupCommand2 = new
|
|
3153
|
+
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("-e, --enable", "Enable schedule immediately after creation").addHelpText(
|
|
3165
3154
|
"after",
|
|
3166
3155
|
`
|
|
3167
3156
|
Examples:
|
|
@@ -3190,7 +3179,7 @@ Notes:
|
|
|
3190
3179
|
);
|
|
3191
3180
|
const agentName = compose.name;
|
|
3192
3181
|
console.log(
|
|
3193
|
-
|
|
3182
|
+
source_default.dim(
|
|
3194
3183
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
3195
3184
|
)
|
|
3196
3185
|
);
|
|
@@ -3200,12 +3189,12 @@ Notes:
|
|
|
3200
3189
|
defaults.frequency
|
|
3201
3190
|
);
|
|
3202
3191
|
if (!frequency) {
|
|
3203
|
-
console.log(
|
|
3192
|
+
console.log(source_default.dim("Cancelled"));
|
|
3204
3193
|
return;
|
|
3205
3194
|
}
|
|
3206
3195
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
3207
3196
|
if (!timing) {
|
|
3208
|
-
console.log(
|
|
3197
|
+
console.log(source_default.dim("Cancelled"));
|
|
3209
3198
|
return;
|
|
3210
3199
|
}
|
|
3211
3200
|
const { day, time, atTime, intervalSeconds } = timing;
|
|
@@ -3214,7 +3203,7 @@ Notes:
|
|
|
3214
3203
|
existingSchedule?.timezone
|
|
3215
3204
|
);
|
|
3216
3205
|
if (!timezone) {
|
|
3217
|
-
console.log(
|
|
3206
|
+
console.log(source_default.dim("Cancelled"));
|
|
3218
3207
|
return;
|
|
3219
3208
|
}
|
|
3220
3209
|
const promptText_ = await gatherPromptText(
|
|
@@ -3222,7 +3211,7 @@ Notes:
|
|
|
3222
3211
|
existingSchedule?.prompt
|
|
3223
3212
|
);
|
|
3224
3213
|
if (!promptText_) {
|
|
3225
|
-
console.log(
|
|
3214
|
+
console.log(source_default.dim("Cancelled"));
|
|
3226
3215
|
return;
|
|
3227
3216
|
}
|
|
3228
3217
|
const deployResult = await buildAndDeploy({
|
|
@@ -3250,9 +3239,8 @@ Notes:
|
|
|
3250
3239
|
);
|
|
3251
3240
|
|
|
3252
3241
|
// src/commands/zero/schedule/list.ts
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
var listCommand7 = new Command43().name("list").alias("ls").description("List all zero schedules").addHelpText(
|
|
3242
|
+
init_esm_shims();
|
|
3243
|
+
var listCommand7 = new Command().name("list").alias("ls").description("List all zero schedules").addHelpText(
|
|
3256
3244
|
"after",
|
|
3257
3245
|
`
|
|
3258
3246
|
Examples:
|
|
@@ -3261,9 +3249,9 @@ Examples:
|
|
|
3261
3249
|
withErrorHandler(async () => {
|
|
3262
3250
|
const result = await listZeroSchedules();
|
|
3263
3251
|
if (result.schedules.length === 0) {
|
|
3264
|
-
console.log(
|
|
3252
|
+
console.log(source_default.dim("No schedules found"));
|
|
3265
3253
|
console.log(
|
|
3266
|
-
|
|
3254
|
+
source_default.dim(" Create one with: zero schedule setup <agent-id>")
|
|
3267
3255
|
);
|
|
3268
3256
|
return;
|
|
3269
3257
|
}
|
|
@@ -3292,10 +3280,10 @@ Examples:
|
|
|
3292
3280
|
"STATUS".padEnd(8),
|
|
3293
3281
|
"NEXT RUN"
|
|
3294
3282
|
].join(" ");
|
|
3295
|
-
console.log(
|
|
3283
|
+
console.log(source_default.dim(header));
|
|
3296
3284
|
for (const schedule of result.schedules) {
|
|
3297
3285
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
3298
|
-
const status = schedule.enabled ?
|
|
3286
|
+
const status = schedule.enabled ? source_default.green("enabled") : source_default.yellow("disabled");
|
|
3299
3287
|
const nextRun = schedule.enabled ? formatRelativeTime(schedule.nextRunAt) : "-";
|
|
3300
3288
|
const row = [
|
|
3301
3289
|
schedule.agentId.padEnd(agentWidth),
|
|
@@ -3310,31 +3298,30 @@ Examples:
|
|
|
3310
3298
|
);
|
|
3311
3299
|
|
|
3312
3300
|
// src/commands/zero/schedule/status.ts
|
|
3313
|
-
|
|
3314
|
-
import chalk35 from "chalk";
|
|
3301
|
+
init_esm_shims();
|
|
3315
3302
|
function formatDateTimeStyled(dateStr) {
|
|
3316
|
-
if (!dateStr) return
|
|
3303
|
+
if (!dateStr) return source_default.dim("-");
|
|
3317
3304
|
const formatted = formatDateTime(dateStr);
|
|
3318
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
3305
|
+
return formatted.replace(/\(([^)]+)\)$/, source_default.dim("($1)"));
|
|
3319
3306
|
}
|
|
3320
3307
|
function formatTrigger(schedule) {
|
|
3321
3308
|
if (schedule.triggerType === "loop" && schedule.intervalSeconds !== null) {
|
|
3322
|
-
return `interval ${schedule.intervalSeconds}s ${
|
|
3309
|
+
return `interval ${schedule.intervalSeconds}s ${source_default.dim("(loop)")}`;
|
|
3323
3310
|
}
|
|
3324
3311
|
if (schedule.cronExpression) {
|
|
3325
3312
|
return schedule.cronExpression;
|
|
3326
3313
|
}
|
|
3327
3314
|
if (schedule.atTime) {
|
|
3328
|
-
return `${schedule.atTime} ${
|
|
3315
|
+
return `${schedule.atTime} ${source_default.dim("(one-time)")}`;
|
|
3329
3316
|
}
|
|
3330
|
-
return
|
|
3317
|
+
return source_default.dim("-");
|
|
3331
3318
|
}
|
|
3332
3319
|
function printRunConfiguration(schedule) {
|
|
3333
|
-
const statusText = schedule.enabled ?
|
|
3320
|
+
const statusText = schedule.enabled ? source_default.green("enabled") : source_default.yellow("disabled");
|
|
3334
3321
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
3335
3322
|
console.log(`${"Agent:".padEnd(16)}${schedule.agentId}`);
|
|
3336
3323
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
3337
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
3324
|
+
console.log(`${"Prompt:".padEnd(16)}${source_default.dim(promptPreview)}`);
|
|
3338
3325
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
3339
3326
|
console.log(
|
|
3340
3327
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -3359,11 +3346,11 @@ function printTimeSchedule(schedule) {
|
|
|
3359
3346
|
);
|
|
3360
3347
|
}
|
|
3361
3348
|
if (schedule.triggerType === "loop") {
|
|
3362
|
-
const failureText = schedule.consecutiveFailures > 0 ?
|
|
3349
|
+
const failureText = schedule.consecutiveFailures > 0 ? source_default.yellow(`${schedule.consecutiveFailures}/3`) : source_default.dim("0/3");
|
|
3363
3350
|
console.log(`${"Failures:".padEnd(16)}${failureText}`);
|
|
3364
3351
|
}
|
|
3365
3352
|
}
|
|
3366
|
-
var statusCommand3 = new
|
|
3353
|
+
var statusCommand3 = new Command().name("status").description("Show detailed status of a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3367
3354
|
"-n, --name <schedule-name>",
|
|
3368
3355
|
"Schedule name (required when agent has multiple schedules)"
|
|
3369
3356
|
).addHelpText(
|
|
@@ -3379,8 +3366,8 @@ Examples:
|
|
|
3379
3366
|
options.name
|
|
3380
3367
|
);
|
|
3381
3368
|
console.log();
|
|
3382
|
-
console.log(`Schedule for agent: ${
|
|
3383
|
-
console.log(
|
|
3369
|
+
console.log(`Schedule for agent: ${source_default.cyan(agentName)}`);
|
|
3370
|
+
console.log(source_default.dim("\u2501".repeat(50)));
|
|
3384
3371
|
printRunConfiguration(schedule);
|
|
3385
3372
|
printTimeSchedule(schedule);
|
|
3386
3373
|
console.log();
|
|
@@ -3388,9 +3375,8 @@ Examples:
|
|
|
3388
3375
|
);
|
|
3389
3376
|
|
|
3390
3377
|
// src/commands/zero/schedule/delete.ts
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
var deleteCommand3 = new Command45().name("delete").alias("rm").description("Delete a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3378
|
+
init_esm_shims();
|
|
3379
|
+
var deleteCommand3 = new Command().name("delete").alias("rm").description("Delete a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3394
3380
|
"-n, --name <schedule-name>",
|
|
3395
3381
|
"Schedule name (required when agent has multiple schedules)"
|
|
3396
3382
|
).option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
@@ -3414,11 +3400,11 @@ Notes:
|
|
|
3414
3400
|
throw new Error("--yes flag is required in non-interactive mode");
|
|
3415
3401
|
}
|
|
3416
3402
|
const confirmed = await promptConfirm(
|
|
3417
|
-
`Delete schedule for agent ${
|
|
3403
|
+
`Delete schedule for agent ${source_default.cyan(agentName)}?`,
|
|
3418
3404
|
false
|
|
3419
3405
|
);
|
|
3420
3406
|
if (!confirmed) {
|
|
3421
|
-
console.log(
|
|
3407
|
+
console.log(source_default.dim("Cancelled"));
|
|
3422
3408
|
return;
|
|
3423
3409
|
}
|
|
3424
3410
|
}
|
|
@@ -3426,15 +3412,14 @@ Notes:
|
|
|
3426
3412
|
name: resolved.name,
|
|
3427
3413
|
agentId: resolved.agentId
|
|
3428
3414
|
});
|
|
3429
|
-
console.log(
|
|
3415
|
+
console.log(source_default.green(`\u2713 Schedule "${resolved.name}" deleted`));
|
|
3430
3416
|
}
|
|
3431
3417
|
)
|
|
3432
3418
|
);
|
|
3433
3419
|
|
|
3434
3420
|
// src/commands/zero/schedule/enable.ts
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
var enableCommand = new Command46().name("enable").description("Enable a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3421
|
+
init_esm_shims();
|
|
3422
|
+
var enableCommand = new Command().name("enable").description("Enable a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3438
3423
|
"-n, --name <schedule-name>",
|
|
3439
3424
|
"Schedule name (required when agent has multiple schedules)"
|
|
3440
3425
|
).addHelpText(
|
|
@@ -3453,14 +3438,13 @@ Examples:
|
|
|
3453
3438
|
name: resolved.name,
|
|
3454
3439
|
agentId: resolved.agentId
|
|
3455
3440
|
});
|
|
3456
|
-
console.log(
|
|
3441
|
+
console.log(source_default.green(`\u2713 Schedule "${resolved.name}" enabled`));
|
|
3457
3442
|
})
|
|
3458
3443
|
);
|
|
3459
3444
|
|
|
3460
3445
|
// src/commands/zero/schedule/disable.ts
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
var disableCommand = new Command47().name("disable").description("Disable a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3446
|
+
init_esm_shims();
|
|
3447
|
+
var disableCommand = new Command().name("disable").description("Disable a zero schedule").argument("<agent-id>", "Agent ID").option(
|
|
3464
3448
|
"-n, --name <schedule-name>",
|
|
3465
3449
|
"Schedule name (required when agent has multiple schedules)"
|
|
3466
3450
|
).addHelpText(
|
|
@@ -3479,12 +3463,12 @@ Examples:
|
|
|
3479
3463
|
name: resolved.name,
|
|
3480
3464
|
agentId: resolved.agentId
|
|
3481
3465
|
});
|
|
3482
|
-
console.log(
|
|
3466
|
+
console.log(source_default.green(`\u2713 Schedule "${resolved.name}" disabled`));
|
|
3483
3467
|
})
|
|
3484
3468
|
);
|
|
3485
3469
|
|
|
3486
3470
|
// src/commands/zero/schedule/index.ts
|
|
3487
|
-
var zeroScheduleCommand = new
|
|
3471
|
+
var zeroScheduleCommand = new Command().name("schedule").description("Create or manage recurring scheduled tasks").addCommand(setupCommand2).addCommand(listCommand7).addCommand(statusCommand3).addCommand(deleteCommand3).addCommand(enableCommand).addCommand(disableCommand).addHelpText(
|
|
3488
3472
|
"after",
|
|
3489
3473
|
`
|
|
3490
3474
|
Examples:
|
|
@@ -3497,67 +3481,65 @@ Examples:
|
|
|
3497
3481
|
);
|
|
3498
3482
|
|
|
3499
3483
|
// src/commands/zero/secret/index.ts
|
|
3500
|
-
|
|
3484
|
+
init_esm_shims();
|
|
3501
3485
|
|
|
3502
3486
|
// src/commands/zero/secret/list.ts
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
var listCommand8 = new Command49().name("list").alias("ls").description("List all secrets").action(
|
|
3487
|
+
init_esm_shims();
|
|
3488
|
+
var listCommand8 = new Command().name("list").alias("ls").description("List all secrets").action(
|
|
3506
3489
|
withErrorHandler(async () => {
|
|
3507
3490
|
const result = await listZeroSecrets();
|
|
3508
3491
|
if (result.secrets.length === 0) {
|
|
3509
|
-
console.log(
|
|
3492
|
+
console.log(source_default.dim("No secrets found"));
|
|
3510
3493
|
console.log();
|
|
3511
3494
|
console.log("To add a secret:");
|
|
3512
|
-
console.log(
|
|
3495
|
+
console.log(source_default.cyan(" zero secret set MY_API_KEY --body <value>"));
|
|
3513
3496
|
return;
|
|
3514
3497
|
}
|
|
3515
|
-
console.log(
|
|
3498
|
+
console.log(source_default.bold("Secrets:"));
|
|
3516
3499
|
console.log();
|
|
3517
3500
|
for (const secret of result.secrets) {
|
|
3518
3501
|
let typeIndicator = "";
|
|
3519
3502
|
let derivedLine = null;
|
|
3520
3503
|
if (secret.type === "model-provider") {
|
|
3521
|
-
typeIndicator =
|
|
3504
|
+
typeIndicator = source_default.dim(" [model-provider]");
|
|
3522
3505
|
} else if (secret.type === "connector") {
|
|
3523
3506
|
const derived = getConnectorDerivedNames(secret.name);
|
|
3524
3507
|
if (derived) {
|
|
3525
|
-
typeIndicator =
|
|
3526
|
-
derivedLine =
|
|
3508
|
+
typeIndicator = source_default.dim(` [${derived.connectorLabel} connector]`);
|
|
3509
|
+
derivedLine = source_default.dim(
|
|
3527
3510
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
3528
3511
|
);
|
|
3529
3512
|
} else {
|
|
3530
|
-
typeIndicator =
|
|
3513
|
+
typeIndicator = source_default.dim(" [connector]");
|
|
3531
3514
|
}
|
|
3532
3515
|
} else if (secret.type === "user") {
|
|
3533
3516
|
const derived = getConnectorDerivedNames(secret.name);
|
|
3534
3517
|
if (derived) {
|
|
3535
|
-
typeIndicator =
|
|
3536
|
-
derivedLine =
|
|
3518
|
+
typeIndicator = source_default.dim(` [${derived.connectorLabel} connector]`);
|
|
3519
|
+
derivedLine = source_default.dim(
|
|
3537
3520
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
3538
3521
|
);
|
|
3539
3522
|
}
|
|
3540
3523
|
}
|
|
3541
|
-
console.log(` ${
|
|
3524
|
+
console.log(` ${source_default.cyan(secret.name)}${typeIndicator}`);
|
|
3542
3525
|
if (derivedLine) {
|
|
3543
3526
|
console.log(` ${derivedLine}`);
|
|
3544
3527
|
}
|
|
3545
3528
|
if (secret.description) {
|
|
3546
|
-
console.log(` ${
|
|
3529
|
+
console.log(` ${source_default.dim(secret.description)}`);
|
|
3547
3530
|
}
|
|
3548
3531
|
console.log(
|
|
3549
|
-
` ${
|
|
3532
|
+
` ${source_default.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
3550
3533
|
);
|
|
3551
3534
|
console.log();
|
|
3552
3535
|
}
|
|
3553
|
-
console.log(
|
|
3536
|
+
console.log(source_default.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
3554
3537
|
})
|
|
3555
3538
|
);
|
|
3556
3539
|
|
|
3557
3540
|
// src/commands/zero/secret/set.ts
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
var setCommand4 = new Command50().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
3541
|
+
init_esm_shims();
|
|
3542
|
+
var setCommand4 = new Command().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
3561
3543
|
"-b, --body <value>",
|
|
3562
3544
|
"Secret value (required in non-interactive mode)"
|
|
3563
3545
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -3569,7 +3551,7 @@ var setCommand4 = new Command50().name("set").description("Create or update a se
|
|
|
3569
3551
|
} else if (isInteractive()) {
|
|
3570
3552
|
const prompted = await promptPassword("Enter secret value:");
|
|
3571
3553
|
if (prompted === void 0) {
|
|
3572
|
-
console.log(
|
|
3554
|
+
console.log(source_default.dim("Cancelled"));
|
|
3573
3555
|
return;
|
|
3574
3556
|
}
|
|
3575
3557
|
value = prompted;
|
|
@@ -3597,15 +3579,14 @@ var setCommand4 = new Command50().name("set").description("Create or update a se
|
|
|
3597
3579
|
}
|
|
3598
3580
|
throw error;
|
|
3599
3581
|
}
|
|
3600
|
-
console.log(
|
|
3582
|
+
console.log(source_default.green(`\u2713 Secret "${secret.name}" saved`));
|
|
3601
3583
|
}
|
|
3602
3584
|
)
|
|
3603
3585
|
);
|
|
3604
3586
|
|
|
3605
3587
|
// src/commands/zero/secret/delete.ts
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
var deleteCommand4 = new Command51().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
3588
|
+
init_esm_shims();
|
|
3589
|
+
var deleteCommand4 = new Command().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
3609
3590
|
withErrorHandler(async (name, options) => {
|
|
3610
3591
|
if (!options.yes) {
|
|
3611
3592
|
if (!isInteractive()) {
|
|
@@ -3616,43 +3597,58 @@ var deleteCommand4 = new Command51().name("delete").description("Delete a secret
|
|
|
3616
3597
|
false
|
|
3617
3598
|
);
|
|
3618
3599
|
if (!confirmed) {
|
|
3619
|
-
console.log(
|
|
3600
|
+
console.log(source_default.dim("Cancelled"));
|
|
3620
3601
|
return;
|
|
3621
3602
|
}
|
|
3622
3603
|
}
|
|
3623
3604
|
await deleteZeroSecret(name);
|
|
3624
|
-
console.log(
|
|
3605
|
+
console.log(source_default.green(`\u2713 Secret "${name}" deleted`));
|
|
3625
3606
|
})
|
|
3626
3607
|
);
|
|
3627
3608
|
|
|
3628
3609
|
// src/commands/zero/secret/index.ts
|
|
3629
|
-
var zeroSecretCommand = new
|
|
3610
|
+
var zeroSecretCommand = new Command().name("secret").description("Read or write secrets (API keys, tokens)").addCommand(listCommand8).addCommand(setCommand4).addCommand(deleteCommand4);
|
|
3630
3611
|
|
|
3631
3612
|
// src/commands/zero/slack/index.ts
|
|
3632
|
-
|
|
3613
|
+
init_esm_shims();
|
|
3633
3614
|
|
|
3634
3615
|
// src/commands/zero/slack/message/index.ts
|
|
3635
|
-
|
|
3616
|
+
init_esm_shims();
|
|
3636
3617
|
|
|
3637
3618
|
// src/commands/zero/slack/message/send.ts
|
|
3619
|
+
init_esm_shims();
|
|
3638
3620
|
import { readFileSync as readFileSync3 } from "fs";
|
|
3639
|
-
|
|
3640
|
-
import chalk42 from "chalk";
|
|
3641
|
-
var sendCommand = new Command53().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").addHelpText(
|
|
3621
|
+
var sendCommand = 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").option("-t, --text <message>", "Message text").option("--thread <ts>", "Thread timestamp for replies").option("--blocks <json>", "Block Kit JSON string").addHelpText(
|
|
3642
3622
|
"after",
|
|
3643
3623
|
`
|
|
3644
3624
|
Examples:
|
|
3645
3625
|
Simple message: zero slack message send -c C01234 -t "Hello!"
|
|
3626
|
+
DM a user: zero slack message send -u U0A8V9X98QJ -t "Hello!"
|
|
3646
3627
|
Reply in thread: zero slack message send -c C01234 --thread 1234567890.123456 -t "reply"
|
|
3647
3628
|
Rich blocks: zero slack message send -c C01234 --blocks '[{"type":"section","text":{"type":"mrkdwn","text":"*Bold*"}}]'
|
|
3648
3629
|
|
|
3649
3630
|
Notes:
|
|
3631
|
+
- Either --channel or --user is required; they are mutually exclusive
|
|
3650
3632
|
- Either --text or --blocks is required; both can be used together`
|
|
3651
3633
|
).action(
|
|
3652
3634
|
withErrorHandler(
|
|
3653
3635
|
async (options) => {
|
|
3654
3636
|
let text = options.text;
|
|
3655
|
-
const { channel, thread, blocks: blocksStr } = options;
|
|
3637
|
+
const { channel, user, thread, blocks: blocksStr } = options;
|
|
3638
|
+
if (!channel && !user) {
|
|
3639
|
+
throw new Error("Either --channel or --user must be provided", {
|
|
3640
|
+
cause: new Error(
|
|
3641
|
+
'Usage: zero slack message send -c CHANNEL_ID -t "your message"\n zero slack message send -u USER_ID -t "your message"'
|
|
3642
|
+
)
|
|
3643
|
+
});
|
|
3644
|
+
}
|
|
3645
|
+
if (channel && user) {
|
|
3646
|
+
throw new Error("--channel and --user are mutually exclusive", {
|
|
3647
|
+
cause: new Error(
|
|
3648
|
+
"Provide either --channel to send to a channel or --user to DM a user, not both"
|
|
3649
|
+
)
|
|
3650
|
+
});
|
|
3651
|
+
}
|
|
3656
3652
|
if (!text && process.stdin.isTTY === false) {
|
|
3657
3653
|
text = readFileSync3("/dev/stdin", "utf8").trim();
|
|
3658
3654
|
}
|
|
@@ -3676,19 +3672,20 @@ Notes:
|
|
|
3676
3672
|
});
|
|
3677
3673
|
}
|
|
3678
3674
|
const result = await sendSlackMessage({
|
|
3679
|
-
channel,
|
|
3675
|
+
channel: channel || void 0,
|
|
3676
|
+
user: user || void 0,
|
|
3680
3677
|
text: text || void 0,
|
|
3681
3678
|
threadTs: thread,
|
|
3682
3679
|
blocks
|
|
3683
3680
|
});
|
|
3684
3681
|
const tsInfo = result.ts ? ` (ts: ${result.ts})` : "";
|
|
3685
|
-
console.log(
|
|
3682
|
+
console.log(source_default.green(`\u2713 Message sent${tsInfo}`));
|
|
3686
3683
|
}
|
|
3687
3684
|
)
|
|
3688
3685
|
);
|
|
3689
3686
|
|
|
3690
3687
|
// src/commands/zero/slack/message/index.ts
|
|
3691
|
-
var zeroSlackMessageCommand = new
|
|
3688
|
+
var zeroSlackMessageCommand = new Command().name("message").description("Manage Slack messages").addCommand(sendCommand).addHelpText(
|
|
3692
3689
|
"after",
|
|
3693
3690
|
`
|
|
3694
3691
|
Examples:
|
|
@@ -3696,11 +3693,10 @@ Examples:
|
|
|
3696
3693
|
);
|
|
3697
3694
|
|
|
3698
3695
|
// src/commands/zero/slack/upload-file.ts
|
|
3696
|
+
init_esm_shims();
|
|
3699
3697
|
import { statSync, readFileSync as readFileSync4 } from "fs";
|
|
3700
3698
|
import { basename } from "path";
|
|
3701
|
-
|
|
3702
|
-
import chalk43 from "chalk";
|
|
3703
|
-
var uploadFileCommand = new Command55().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(
|
|
3699
|
+
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(
|
|
3704
3700
|
"after",
|
|
3705
3701
|
`
|
|
3706
3702
|
Examples:
|
|
@@ -3746,14 +3742,14 @@ Notes:
|
|
|
3746
3742
|
title: options.title,
|
|
3747
3743
|
initialComment: options.comment
|
|
3748
3744
|
});
|
|
3749
|
-
console.log(
|
|
3750
|
-
console.log(
|
|
3745
|
+
console.log(source_default.green(`\u2713 File uploaded (file_id: ${result.fileId})`));
|
|
3746
|
+
console.log(source_default.dim(` permalink: ${result.permalink}`));
|
|
3751
3747
|
}
|
|
3752
3748
|
)
|
|
3753
3749
|
);
|
|
3754
3750
|
|
|
3755
3751
|
// src/commands/zero/slack/index.ts
|
|
3756
|
-
var zeroSlackCommand = new
|
|
3752
|
+
var zeroSlackCommand = new Command().name("slack").description("Send messages and upload files to Slack channels as the bot").addCommand(zeroSlackMessageCommand).addCommand(uploadFileCommand).addHelpText(
|
|
3757
3753
|
"after",
|
|
3758
3754
|
`
|
|
3759
3755
|
Examples:
|
|
@@ -3763,48 +3759,46 @@ Examples:
|
|
|
3763
3759
|
);
|
|
3764
3760
|
|
|
3765
3761
|
// src/commands/zero/variable/index.ts
|
|
3766
|
-
|
|
3762
|
+
init_esm_shims();
|
|
3767
3763
|
|
|
3768
3764
|
// src/commands/zero/variable/list.ts
|
|
3769
|
-
|
|
3770
|
-
import chalk44 from "chalk";
|
|
3765
|
+
init_esm_shims();
|
|
3771
3766
|
function truncateValue2(value, maxLength = 60) {
|
|
3772
3767
|
if (value.length <= maxLength) {
|
|
3773
3768
|
return value;
|
|
3774
3769
|
}
|
|
3775
3770
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
3776
3771
|
}
|
|
3777
|
-
var listCommand9 = new
|
|
3772
|
+
var listCommand9 = new Command().name("list").alias("ls").description("List all variables").action(
|
|
3778
3773
|
withErrorHandler(async () => {
|
|
3779
3774
|
const result = await listZeroVariables();
|
|
3780
3775
|
if (result.variables.length === 0) {
|
|
3781
|
-
console.log(
|
|
3776
|
+
console.log(source_default.dim("No variables found"));
|
|
3782
3777
|
console.log();
|
|
3783
3778
|
console.log("To add a variable:");
|
|
3784
|
-
console.log(
|
|
3779
|
+
console.log(source_default.cyan(" zero variable set MY_VAR <value>"));
|
|
3785
3780
|
return;
|
|
3786
3781
|
}
|
|
3787
|
-
console.log(
|
|
3782
|
+
console.log(source_default.bold("Variables:"));
|
|
3788
3783
|
console.log();
|
|
3789
3784
|
for (const variable of result.variables) {
|
|
3790
3785
|
const displayValue = truncateValue2(variable.value);
|
|
3791
|
-
console.log(` ${
|
|
3786
|
+
console.log(` ${source_default.cyan(variable.name)} = ${displayValue}`);
|
|
3792
3787
|
if (variable.description) {
|
|
3793
|
-
console.log(` ${
|
|
3788
|
+
console.log(` ${source_default.dim(variable.description)}`);
|
|
3794
3789
|
}
|
|
3795
3790
|
console.log(
|
|
3796
|
-
` ${
|
|
3791
|
+
` ${source_default.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
3797
3792
|
);
|
|
3798
3793
|
console.log();
|
|
3799
3794
|
}
|
|
3800
|
-
console.log(
|
|
3795
|
+
console.log(source_default.dim(`Total: ${result.variables.length} variable(s)`));
|
|
3801
3796
|
})
|
|
3802
3797
|
);
|
|
3803
3798
|
|
|
3804
3799
|
// src/commands/zero/variable/set.ts
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
var setCommand5 = new Command58().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(
|
|
3800
|
+
init_esm_shims();
|
|
3801
|
+
var setCommand5 = new Command().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(
|
|
3808
3802
|
withErrorHandler(
|
|
3809
3803
|
async (name, value, options) => {
|
|
3810
3804
|
let variable;
|
|
@@ -3824,15 +3818,14 @@ var setCommand5 = new Command58().name("set").description("Create or update a va
|
|
|
3824
3818
|
}
|
|
3825
3819
|
throw error;
|
|
3826
3820
|
}
|
|
3827
|
-
console.log(
|
|
3821
|
+
console.log(source_default.green(`\u2713 Variable "${variable.name}" saved`));
|
|
3828
3822
|
}
|
|
3829
3823
|
)
|
|
3830
3824
|
);
|
|
3831
3825
|
|
|
3832
3826
|
// src/commands/zero/variable/delete.ts
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
var deleteCommand5 = new Command59().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
3827
|
+
init_esm_shims();
|
|
3828
|
+
var deleteCommand5 = new Command().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
3836
3829
|
withErrorHandler(async (name, options) => {
|
|
3837
3830
|
if (!options.yes) {
|
|
3838
3831
|
if (!isInteractive()) {
|
|
@@ -3843,21 +3836,20 @@ var deleteCommand5 = new Command59().name("delete").description("Delete a variab
|
|
|
3843
3836
|
false
|
|
3844
3837
|
);
|
|
3845
3838
|
if (!confirmed) {
|
|
3846
|
-
console.log(
|
|
3839
|
+
console.log(source_default.dim("Cancelled"));
|
|
3847
3840
|
return;
|
|
3848
3841
|
}
|
|
3849
3842
|
}
|
|
3850
3843
|
await deleteZeroVariable(name);
|
|
3851
|
-
console.log(
|
|
3844
|
+
console.log(source_default.green(`\u2713 Variable "${name}" deleted`));
|
|
3852
3845
|
})
|
|
3853
3846
|
);
|
|
3854
3847
|
|
|
3855
3848
|
// src/commands/zero/variable/index.ts
|
|
3856
|
-
var zeroVariableCommand = new
|
|
3849
|
+
var zeroVariableCommand = new Command().name("variable").description("Read or write non-sensitive configuration values").addCommand(listCommand9).addCommand(setCommand5).addCommand(deleteCommand5);
|
|
3857
3850
|
|
|
3858
3851
|
// src/commands/zero/whoami.ts
|
|
3859
|
-
|
|
3860
|
-
import chalk47 from "chalk";
|
|
3852
|
+
init_esm_shims();
|
|
3861
3853
|
function isInsideSandbox() {
|
|
3862
3854
|
return !!process.env.ZERO_AGENT_ID;
|
|
3863
3855
|
}
|
|
@@ -3871,7 +3863,7 @@ function formatConnectorIdentity2(connector) {
|
|
|
3871
3863
|
identity = connector.externalEmail;
|
|
3872
3864
|
}
|
|
3873
3865
|
if (connector.needsReconnect) {
|
|
3874
|
-
identity += ` ${
|
|
3866
|
+
identity += ` ${source_default.yellow("(needs reconnect)")}`;
|
|
3875
3867
|
}
|
|
3876
3868
|
return identity;
|
|
3877
3869
|
}
|
|
@@ -3879,7 +3871,7 @@ function printConnectorPermissions(type, resolvedPolicies) {
|
|
|
3879
3871
|
if (!isFirewallConnectorType(type)) return;
|
|
3880
3872
|
const policies = resolvedPolicies?.[type] ?? null;
|
|
3881
3873
|
if (!policies) {
|
|
3882
|
-
console.log(
|
|
3874
|
+
console.log(source_default.dim(" full access \u2014 no permission rules configured"));
|
|
3883
3875
|
return;
|
|
3884
3876
|
}
|
|
3885
3877
|
const config = getConnectorFirewall(type);
|
|
@@ -3894,7 +3886,7 @@ function printConnectorPermissions(type, resolvedPolicies) {
|
|
|
3894
3886
|
);
|
|
3895
3887
|
for (const perm of permissions) {
|
|
3896
3888
|
const policy = policies[perm.name] ?? "deny";
|
|
3897
|
-
const icon = policy === "allow" ?
|
|
3889
|
+
const icon = policy === "allow" ? source_default.green("\u2713") : policy === "ask" ? source_default.yellow("?") : source_default.dim("\u2717");
|
|
3898
3890
|
const desc = perm.description ?? "";
|
|
3899
3891
|
console.log(` ${icon} ${perm.name.padEnd(nameWidth)} ${desc}`);
|
|
3900
3892
|
}
|
|
@@ -3903,11 +3895,11 @@ async function showSandboxInfo(showPermissions) {
|
|
|
3903
3895
|
const agentId = process.env.ZERO_AGENT_ID;
|
|
3904
3896
|
const payload = decodeZeroTokenPayload();
|
|
3905
3897
|
console.log(`Agent ID: ${agentId}`);
|
|
3906
|
-
console.log(`Run ID: ${payload?.runId ??
|
|
3907
|
-
console.log(`Org ID: ${payload?.orgId ??
|
|
3898
|
+
console.log(`Run ID: ${payload?.runId ?? source_default.dim("unavailable")}`);
|
|
3899
|
+
console.log(`Org ID: ${payload?.orgId ?? source_default.dim("unavailable")}`);
|
|
3908
3900
|
if (payload?.capabilities?.length) {
|
|
3909
3901
|
console.log();
|
|
3910
|
-
console.log(
|
|
3902
|
+
console.log(source_default.bold("Capabilities:"));
|
|
3911
3903
|
console.log(` ${payload.capabilities.join(", ")}`);
|
|
3912
3904
|
}
|
|
3913
3905
|
try {
|
|
@@ -3931,7 +3923,7 @@ async function showSandboxInfo(showPermissions) {
|
|
|
3931
3923
|
);
|
|
3932
3924
|
}
|
|
3933
3925
|
console.log();
|
|
3934
|
-
console.log(
|
|
3926
|
+
console.log(source_default.bold("Connectors:"));
|
|
3935
3927
|
for (const connector of identities) {
|
|
3936
3928
|
const identity = formatConnectorIdentity2(connector);
|
|
3937
3929
|
console.log(` ${connector.type.padEnd(14)}${identity}`);
|
|
@@ -3946,7 +3938,7 @@ async function showSandboxInfo(showPermissions) {
|
|
|
3946
3938
|
});
|
|
3947
3939
|
if (identities.length === 0) return;
|
|
3948
3940
|
console.log();
|
|
3949
|
-
console.log(
|
|
3941
|
+
console.log(source_default.bold("Connectors:"));
|
|
3950
3942
|
for (const connector of identities) {
|
|
3951
3943
|
const identity = formatConnectorIdentity2(connector);
|
|
3952
3944
|
console.log(` ${connector.type.padEnd(14)}${identity}`);
|
|
@@ -3959,23 +3951,23 @@ async function showLocalInfo() {
|
|
|
3959
3951
|
const token = await getToken();
|
|
3960
3952
|
const apiUrl = await getApiUrl();
|
|
3961
3953
|
const activeOrg = await getActiveOrg();
|
|
3962
|
-
console.log(
|
|
3954
|
+
console.log(source_default.bold("Auth:"));
|
|
3963
3955
|
if (token) {
|
|
3964
3956
|
const tokenSource = process.env.ZERO_TOKEN ? "ZERO_TOKEN env var" : process.env.VM0_TOKEN ? "VM0_TOKEN env var" : "config file";
|
|
3965
3957
|
console.log(
|
|
3966
|
-
` Status: ${
|
|
3958
|
+
` Status: ${source_default.green("Authenticated")} (via ${tokenSource})`
|
|
3967
3959
|
);
|
|
3968
3960
|
} else {
|
|
3969
|
-
console.log(` Status: ${
|
|
3961
|
+
console.log(` Status: ${source_default.dim("Not authenticated")}`);
|
|
3970
3962
|
}
|
|
3971
3963
|
console.log(` API: ${apiUrl}`);
|
|
3972
3964
|
console.log();
|
|
3973
3965
|
if (activeOrg) {
|
|
3974
|
-
console.log(
|
|
3966
|
+
console.log(source_default.bold("Org:"));
|
|
3975
3967
|
console.log(` Active: ${activeOrg}`);
|
|
3976
3968
|
}
|
|
3977
3969
|
}
|
|
3978
|
-
var zeroWhoamiCommand = new
|
|
3970
|
+
var zeroWhoamiCommand = new Command().name("whoami").description("Show agent identity, run ID, and capabilities").option("--permissions", "Show full permission details for each connector").addHelpText(
|
|
3979
3971
|
"after",
|
|
3980
3972
|
`
|
|
3981
3973
|
Examples:
|
|
@@ -3997,11 +3989,10 @@ Notes:
|
|
|
3997
3989
|
);
|
|
3998
3990
|
|
|
3999
3991
|
// src/commands/zero/ask-user/index.ts
|
|
4000
|
-
|
|
3992
|
+
init_esm_shims();
|
|
4001
3993
|
|
|
4002
3994
|
// src/commands/zero/ask-user/question.ts
|
|
4003
|
-
|
|
4004
|
-
import chalk48 from "chalk";
|
|
3995
|
+
init_esm_shims();
|
|
4005
3996
|
function collectOption(value, previous) {
|
|
4006
3997
|
const list = previous ?? [];
|
|
4007
3998
|
list.push({ label: value });
|
|
@@ -4012,7 +4003,7 @@ function collectDesc(value, previous) {
|
|
|
4012
4003
|
list.push(value);
|
|
4013
4004
|
return list;
|
|
4014
4005
|
}
|
|
4015
|
-
var questionCommand = new
|
|
4006
|
+
var questionCommand = new Command().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(
|
|
4016
4007
|
"--desc <text>",
|
|
4017
4008
|
"Description for the preceding --option",
|
|
4018
4009
|
collectDesc
|
|
@@ -4068,7 +4059,7 @@ Notes:
|
|
|
4068
4059
|
questions: [questionItem]
|
|
4069
4060
|
});
|
|
4070
4061
|
console.error(
|
|
4071
|
-
|
|
4062
|
+
source_default.dim(
|
|
4072
4063
|
`\u23F3 Waiting for user response... (pendingId: ${pendingId})`
|
|
4073
4064
|
)
|
|
4074
4065
|
);
|
|
@@ -4095,7 +4086,7 @@ Notes:
|
|
|
4095
4086
|
);
|
|
4096
4087
|
|
|
4097
4088
|
// src/commands/zero/ask-user/index.ts
|
|
4098
|
-
var zeroAskUserCommand = new
|
|
4089
|
+
var zeroAskUserCommand = new Command().name("ask-user").description("Ask the user a question and wait for the answer").addCommand(questionCommand).addHelpText(
|
|
4099
4090
|
"after",
|
|
4100
4091
|
`
|
|
4101
4092
|
Examples:
|
|
@@ -4107,13 +4098,13 @@ Notes:
|
|
|
4107
4098
|
);
|
|
4108
4099
|
|
|
4109
4100
|
// src/commands/zero/skill/index.ts
|
|
4110
|
-
|
|
4101
|
+
init_esm_shims();
|
|
4111
4102
|
|
|
4112
4103
|
// src/commands/zero/skill/create.ts
|
|
4113
|
-
|
|
4114
|
-
import chalk49 from "chalk";
|
|
4104
|
+
init_esm_shims();
|
|
4115
4105
|
|
|
4116
4106
|
// src/lib/skill-directory.ts
|
|
4107
|
+
init_esm_shims();
|
|
4117
4108
|
import { readFileSync as readFileSync5, readdirSync } from "fs";
|
|
4118
4109
|
import { join as join2 } from "path";
|
|
4119
4110
|
var IGNORED_NAMES = /* @__PURE__ */ new Set(["node_modules", ".git", ".DS_Store"]);
|
|
@@ -4144,7 +4135,7 @@ function readSkillDirectory(dirPath) {
|
|
|
4144
4135
|
}
|
|
4145
4136
|
|
|
4146
4137
|
// src/commands/zero/skill/create.ts
|
|
4147
|
-
var createCommand2 = new
|
|
4138
|
+
var createCommand2 = new Command().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(
|
|
4148
4139
|
"after",
|
|
4149
4140
|
`
|
|
4150
4141
|
Examples:
|
|
@@ -4166,7 +4157,7 @@ Notes:
|
|
|
4166
4157
|
displayName: options.displayName,
|
|
4167
4158
|
description: options.description
|
|
4168
4159
|
});
|
|
4169
|
-
console.log(
|
|
4160
|
+
console.log(source_default.green(`\u2713 Skill "${skill.name}" created`));
|
|
4170
4161
|
console.log(` Name: ${skill.name}`);
|
|
4171
4162
|
console.log(` Files: ${files.length} file(s)`);
|
|
4172
4163
|
if (skill.displayName) {
|
|
@@ -4180,9 +4171,8 @@ Notes:
|
|
|
4180
4171
|
);
|
|
4181
4172
|
|
|
4182
4173
|
// src/commands/zero/skill/edit.ts
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
var editCommand2 = new Command65().name("edit").description("Update a custom skill's content").argument("<name>", "Skill name").requiredOption(
|
|
4174
|
+
init_esm_shims();
|
|
4175
|
+
var editCommand2 = new Command().name("edit").description("Update a custom skill's content").argument("<name>", "Skill name").requiredOption(
|
|
4186
4176
|
"--dir <path>",
|
|
4187
4177
|
"Path to directory containing updated skill files"
|
|
4188
4178
|
).addHelpText(
|
|
@@ -4195,15 +4185,14 @@ Examples:
|
|
|
4195
4185
|
const files = readSkillDirectory(options.dir);
|
|
4196
4186
|
await updateSkill(name, { files });
|
|
4197
4187
|
console.log(
|
|
4198
|
-
|
|
4188
|
+
source_default.green(`\u2713 Skill "${name}" updated (${files.length} file(s))`)
|
|
4199
4189
|
);
|
|
4200
4190
|
})
|
|
4201
4191
|
);
|
|
4202
4192
|
|
|
4203
4193
|
// src/commands/zero/skill/view.ts
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
var viewCommand2 = new Command66().name("view").description("View a custom skill").argument("<name>", "Skill name").addHelpText(
|
|
4194
|
+
init_esm_shims();
|
|
4195
|
+
var viewCommand2 = new Command().name("view").description("View a custom skill").argument("<name>", "Skill name").addHelpText(
|
|
4207
4196
|
"after",
|
|
4208
4197
|
`
|
|
4209
4198
|
Examples:
|
|
@@ -4211,33 +4200,32 @@ Examples:
|
|
|
4211
4200
|
).action(
|
|
4212
4201
|
withErrorHandler(async (name) => {
|
|
4213
4202
|
const skill = await getSkill(name);
|
|
4214
|
-
console.log(
|
|
4215
|
-
if (skill.displayName) console.log(
|
|
4203
|
+
console.log(source_default.bold(skill.name));
|
|
4204
|
+
if (skill.displayName) console.log(source_default.dim(skill.displayName));
|
|
4216
4205
|
console.log();
|
|
4217
4206
|
console.log(`Name: ${skill.name}`);
|
|
4218
4207
|
if (skill.displayName) console.log(`Display Name: ${skill.displayName}`);
|
|
4219
4208
|
if (skill.description) console.log(`Description: ${skill.description}`);
|
|
4220
4209
|
if (skill.files && skill.files.length > 0) {
|
|
4221
4210
|
console.log();
|
|
4222
|
-
console.log(
|
|
4211
|
+
console.log(source_default.dim("\u2500\u2500 Files \u2500\u2500"));
|
|
4223
4212
|
for (const f of skill.files) {
|
|
4224
4213
|
console.log(` ${f.path} (${f.size} bytes)`);
|
|
4225
4214
|
}
|
|
4226
4215
|
}
|
|
4227
4216
|
console.log();
|
|
4228
4217
|
if (skill.content) {
|
|
4229
|
-
console.log(
|
|
4218
|
+
console.log(source_default.dim("\u2500\u2500 SKILL.md \u2500\u2500"));
|
|
4230
4219
|
console.log(skill.content);
|
|
4231
4220
|
} else {
|
|
4232
|
-
console.log(
|
|
4221
|
+
console.log(source_default.dim("No content"));
|
|
4233
4222
|
}
|
|
4234
4223
|
})
|
|
4235
4224
|
);
|
|
4236
4225
|
|
|
4237
4226
|
// src/commands/zero/skill/list.ts
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
var listCommand10 = new Command67().name("list").alias("ls").description("List custom skills in the organization").addHelpText(
|
|
4227
|
+
init_esm_shims();
|
|
4228
|
+
var listCommand10 = new Command().name("list").alias("ls").description("List custom skills in the organization").addHelpText(
|
|
4241
4229
|
"after",
|
|
4242
4230
|
`
|
|
4243
4231
|
Examples:
|
|
@@ -4246,9 +4234,9 @@ Examples:
|
|
|
4246
4234
|
withErrorHandler(async () => {
|
|
4247
4235
|
const skills = await listSkills();
|
|
4248
4236
|
if (skills.length === 0) {
|
|
4249
|
-
console.log(
|
|
4237
|
+
console.log(source_default.dim("No custom skills found"));
|
|
4250
4238
|
console.log(
|
|
4251
|
-
|
|
4239
|
+
source_default.dim(" Create one with: zero skill create <name> --dir <path>")
|
|
4252
4240
|
);
|
|
4253
4241
|
return;
|
|
4254
4242
|
}
|
|
@@ -4269,7 +4257,7 @@ Examples:
|
|
|
4269
4257
|
"DISPLAY NAME".padEnd(displayWidth),
|
|
4270
4258
|
"DESCRIPTION"
|
|
4271
4259
|
].join(" ");
|
|
4272
|
-
console.log(
|
|
4260
|
+
console.log(source_default.dim(header));
|
|
4273
4261
|
for (const skill of skills) {
|
|
4274
4262
|
const row = [
|
|
4275
4263
|
skill.name.padEnd(nameWidth),
|
|
@@ -4282,9 +4270,8 @@ Examples:
|
|
|
4282
4270
|
);
|
|
4283
4271
|
|
|
4284
4272
|
// src/commands/zero/skill/delete.ts
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
var deleteCommand6 = new Command68().name("delete").alias("rm").description("Delete a custom skill from the organization").argument("<name>", "Skill name").option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
4273
|
+
init_esm_shims();
|
|
4274
|
+
var deleteCommand6 = new Command().name("delete").alias("rm").description("Delete a custom skill from the organization").argument("<name>", "Skill name").option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
4288
4275
|
"after",
|
|
4289
4276
|
`
|
|
4290
4277
|
Examples:
|
|
@@ -4306,17 +4293,17 @@ Notes:
|
|
|
4306
4293
|
false
|
|
4307
4294
|
);
|
|
4308
4295
|
if (!confirmed) {
|
|
4309
|
-
console.log(
|
|
4296
|
+
console.log(source_default.dim("Cancelled"));
|
|
4310
4297
|
return;
|
|
4311
4298
|
}
|
|
4312
4299
|
}
|
|
4313
4300
|
await deleteSkill(name);
|
|
4314
|
-
console.log(
|
|
4301
|
+
console.log(source_default.green(`\u2713 Skill "${name}" deleted`));
|
|
4315
4302
|
})
|
|
4316
4303
|
);
|
|
4317
4304
|
|
|
4318
4305
|
// src/commands/zero/skill/index.ts
|
|
4319
|
-
var zeroSkillCommand = new
|
|
4306
|
+
var zeroSkillCommand = new Command("skill").description("Manage custom skills").addCommand(createCommand2).addCommand(editCommand2).addCommand(viewCommand2).addCommand(listCommand10).addCommand(deleteCommand6).addHelpText(
|
|
4320
4307
|
"after",
|
|
4321
4308
|
`
|
|
4322
4309
|
Examples:
|
|
@@ -4333,25 +4320,23 @@ Skill Binding:
|
|
|
4333
4320
|
);
|
|
4334
4321
|
|
|
4335
4322
|
// src/commands/zero/logs/index.ts
|
|
4336
|
-
|
|
4337
|
-
import chalk56 from "chalk";
|
|
4323
|
+
init_esm_shims();
|
|
4338
4324
|
|
|
4339
4325
|
// src/commands/zero/logs/list.ts
|
|
4340
|
-
|
|
4341
|
-
import chalk54 from "chalk";
|
|
4326
|
+
init_esm_shims();
|
|
4342
4327
|
function formatStatus(status) {
|
|
4343
4328
|
switch (status) {
|
|
4344
4329
|
case "completed":
|
|
4345
|
-
return
|
|
4330
|
+
return source_default.green(status);
|
|
4346
4331
|
case "failed":
|
|
4347
4332
|
case "timeout":
|
|
4348
|
-
return
|
|
4333
|
+
return source_default.red(status);
|
|
4349
4334
|
case "running":
|
|
4350
4335
|
case "pending":
|
|
4351
4336
|
case "queued":
|
|
4352
|
-
return
|
|
4337
|
+
return source_default.yellow(status);
|
|
4353
4338
|
case "cancelled":
|
|
4354
|
-
return
|
|
4339
|
+
return source_default.dim(status);
|
|
4355
4340
|
default:
|
|
4356
4341
|
return status;
|
|
4357
4342
|
}
|
|
@@ -4359,7 +4344,7 @@ function formatStatus(status) {
|
|
|
4359
4344
|
function formatTime(iso) {
|
|
4360
4345
|
return new Date(iso).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
4361
4346
|
}
|
|
4362
|
-
var listCommand11 = new
|
|
4347
|
+
var listCommand11 = new Command().name("list").alias("ls").description("List agent run logs").option("--agent <name>", "Filter by agent name").option(
|
|
4363
4348
|
"--status <status>",
|
|
4364
4349
|
"Filter by status (queued|pending|running|completed|failed|timeout|cancelled)"
|
|
4365
4350
|
).option(
|
|
@@ -4386,7 +4371,7 @@ Examples:
|
|
|
4386
4371
|
limit
|
|
4387
4372
|
});
|
|
4388
4373
|
if (result.data.length === 0) {
|
|
4389
|
-
console.log(
|
|
4374
|
+
console.log(source_default.dim("No logs found"));
|
|
4390
4375
|
return;
|
|
4391
4376
|
}
|
|
4392
4377
|
const nameCol = Math.max(
|
|
@@ -4407,7 +4392,7 @@ Examples:
|
|
|
4407
4392
|
"STATUS".padEnd(statusCol),
|
|
4408
4393
|
"CREATED"
|
|
4409
4394
|
].join(" ");
|
|
4410
|
-
console.log(
|
|
4395
|
+
console.log(source_default.dim(header));
|
|
4411
4396
|
for (const entry of result.data) {
|
|
4412
4397
|
const runId = entry.id;
|
|
4413
4398
|
const name = entry.displayName || entry.agentId || "-";
|
|
@@ -4422,7 +4407,7 @@ Examples:
|
|
|
4422
4407
|
if (result.pagination.hasMore) {
|
|
4423
4408
|
console.log();
|
|
4424
4409
|
console.log(
|
|
4425
|
-
|
|
4410
|
+
source_default.dim(
|
|
4426
4411
|
` Showing ${result.data.length} of more results. Use --limit to adjust.`
|
|
4427
4412
|
)
|
|
4428
4413
|
);
|
|
@@ -4432,8 +4417,7 @@ Examples:
|
|
|
4432
4417
|
);
|
|
4433
4418
|
|
|
4434
4419
|
// src/commands/zero/logs/search.ts
|
|
4435
|
-
|
|
4436
|
-
import chalk55 from "chalk";
|
|
4420
|
+
init_esm_shims();
|
|
4437
4421
|
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4438
4422
|
function renderEvent(event, renderer) {
|
|
4439
4423
|
const eventData = event.eventData;
|
|
@@ -4488,7 +4472,7 @@ function renderResults(response) {
|
|
|
4488
4472
|
isFirstGroup = false;
|
|
4489
4473
|
const firstTimestamp = group.results[0].matchedEvent.createdAt;
|
|
4490
4474
|
console.log(
|
|
4491
|
-
|
|
4475
|
+
source_default.bold(formatRunHeader(runId, group.agentName, firstTimestamp))
|
|
4492
4476
|
);
|
|
4493
4477
|
for (const result of group.results) {
|
|
4494
4478
|
const renderer = new EventRenderer({
|
|
@@ -4508,13 +4492,13 @@ function renderResults(response) {
|
|
|
4508
4492
|
if (response.hasMore) {
|
|
4509
4493
|
console.log();
|
|
4510
4494
|
console.log(
|
|
4511
|
-
|
|
4495
|
+
source_default.dim(
|
|
4512
4496
|
` Showing first ${response.results.length} matches. Use --limit to see more.`
|
|
4513
4497
|
)
|
|
4514
4498
|
);
|
|
4515
4499
|
}
|
|
4516
4500
|
}
|
|
4517
|
-
var searchCommand = new
|
|
4501
|
+
var searchCommand = 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(
|
|
4518
4502
|
"after",
|
|
4519
4503
|
`
|
|
4520
4504
|
Examples:
|
|
@@ -4526,9 +4510,9 @@ Examples:
|
|
|
4526
4510
|
const { before, after } = parseContextOptions(options);
|
|
4527
4511
|
if (options.run && !isUUID(options.run)) {
|
|
4528
4512
|
console.error(
|
|
4529
|
-
|
|
4513
|
+
source_default.red(`\u2717 Invalid run ID "${options.run}" \u2014 expected a UUID`)
|
|
4530
4514
|
);
|
|
4531
|
-
console.error(
|
|
4515
|
+
console.error(source_default.dim(" Run: zero logs list to find run IDs"));
|
|
4532
4516
|
process.exit(1);
|
|
4533
4517
|
}
|
|
4534
4518
|
const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
|
|
@@ -4543,9 +4527,9 @@ Examples:
|
|
|
4543
4527
|
after
|
|
4544
4528
|
});
|
|
4545
4529
|
if (response.results.length === 0) {
|
|
4546
|
-
console.log(
|
|
4530
|
+
console.log(source_default.dim("No matches found"));
|
|
4547
4531
|
console.log(
|
|
4548
|
-
|
|
4532
|
+
source_default.dim(
|
|
4549
4533
|
" Try a broader search with --since 30d or a different keyword"
|
|
4550
4534
|
)
|
|
4551
4535
|
);
|
|
@@ -4572,7 +4556,7 @@ async function showAgentEvents(runId, options) {
|
|
|
4572
4556
|
order: options.order
|
|
4573
4557
|
});
|
|
4574
4558
|
if (firstResponse.events.length === 0) {
|
|
4575
|
-
console.log(
|
|
4559
|
+
console.log(source_default.yellow("No agent events found for this run"));
|
|
4576
4560
|
return;
|
|
4577
4561
|
}
|
|
4578
4562
|
let allEvents;
|
|
@@ -4610,7 +4594,7 @@ async function showAgentEvents(runId, options) {
|
|
|
4610
4594
|
renderAgentEvent(event, renderer);
|
|
4611
4595
|
}
|
|
4612
4596
|
}
|
|
4613
|
-
var zeroLogsCommand = new
|
|
4597
|
+
var zeroLogsCommand = new Command().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to view agent events for").addCommand(listCommand11).addCommand(searchCommand).option(
|
|
4614
4598
|
"--since <time>",
|
|
4615
4599
|
"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)"
|
|
4616
4600
|
).option("--tail <n>", "Show last N entries (default: 5)").option("--head <n>", "Show first N entries").option("--all", "Fetch all log entries").addHelpText(
|
|
@@ -4631,9 +4615,9 @@ Examples:
|
|
|
4631
4615
|
}
|
|
4632
4616
|
if (!isUUID(runId)) {
|
|
4633
4617
|
console.error(
|
|
4634
|
-
|
|
4618
|
+
source_default.red(`\u2717 Invalid run ID "${runId}" \u2014 expected a UUID`)
|
|
4635
4619
|
);
|
|
4636
|
-
console.error(
|
|
4620
|
+
console.error(source_default.dim(" Run: zero logs list to find run IDs"));
|
|
4637
4621
|
process.exit(1);
|
|
4638
4622
|
}
|
|
4639
4623
|
const countModes = [
|
|
@@ -4670,8 +4654,8 @@ Examples:
|
|
|
4670
4654
|
);
|
|
4671
4655
|
|
|
4672
4656
|
// src/commands/zero/developer-support.ts
|
|
4673
|
-
|
|
4674
|
-
var zeroDeveloperSupportCommand = new
|
|
4657
|
+
init_esm_shims();
|
|
4658
|
+
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(
|
|
4675
4659
|
"after",
|
|
4676
4660
|
`
|
|
4677
4661
|
Examples:
|
|
@@ -4711,19 +4695,20 @@ Notes:
|
|
|
4711
4695
|
);
|
|
4712
4696
|
|
|
4713
4697
|
// src/commands/zero/computer-use/index.ts
|
|
4714
|
-
|
|
4698
|
+
init_esm_shims();
|
|
4715
4699
|
|
|
4716
4700
|
// src/commands/zero/computer-use/host.ts
|
|
4717
|
-
|
|
4718
|
-
import chalk57 from "chalk";
|
|
4701
|
+
init_esm_shims();
|
|
4719
4702
|
|
|
4720
4703
|
// src/lib/computer-use/desktop-server.ts
|
|
4704
|
+
init_esm_shims();
|
|
4721
4705
|
import {
|
|
4722
4706
|
createServer as createServer2
|
|
4723
4707
|
} from "http";
|
|
4724
4708
|
import { createServer as createNetServer } from "net";
|
|
4725
4709
|
|
|
4726
4710
|
// src/lib/computer-use/screencapture.ts
|
|
4711
|
+
init_esm_shims();
|
|
4727
4712
|
import { execFile } from "child_process";
|
|
4728
4713
|
import { readFile, unlink } from "fs/promises";
|
|
4729
4714
|
import { randomUUID } from "crypto";
|
|
@@ -4841,6 +4826,7 @@ async function getScreenInfo() {
|
|
|
4841
4826
|
}
|
|
4842
4827
|
|
|
4843
4828
|
// src/lib/computer-use/cliclick.ts
|
|
4829
|
+
init_esm_shims();
|
|
4844
4830
|
import { execFile as execFile2 } from "child_process";
|
|
4845
4831
|
import { promisify as promisify2 } from "util";
|
|
4846
4832
|
import { setTimeout as sleep } from "timers/promises";
|
|
@@ -4984,6 +4970,7 @@ async function typeText(text) {
|
|
|
4984
4970
|
}
|
|
4985
4971
|
|
|
4986
4972
|
// src/lib/computer-use/scroll.ts
|
|
4973
|
+
init_esm_shims();
|
|
4987
4974
|
import { execFile as execFile3 } from "child_process";
|
|
4988
4975
|
import { promisify as promisify3 } from "util";
|
|
4989
4976
|
var execFileAsync3 = promisify3(execFile3);
|
|
@@ -5015,6 +5002,7 @@ async function scroll(x, y, direction, amount = DEFAULT_SCROLL_AMOUNT) {
|
|
|
5015
5002
|
}
|
|
5016
5003
|
|
|
5017
5004
|
// src/lib/computer-use/clipboard.ts
|
|
5005
|
+
init_esm_shims();
|
|
5018
5006
|
import { execFile as execFile4, spawn as spawn2 } from "child_process";
|
|
5019
5007
|
import { promisify as promisify4 } from "util";
|
|
5020
5008
|
var execFileAsync4 = promisify4(execFile4);
|
|
@@ -5038,6 +5026,7 @@ async function writeClipboard(text) {
|
|
|
5038
5026
|
}
|
|
5039
5027
|
|
|
5040
5028
|
// src/lib/computer-use/application.ts
|
|
5029
|
+
init_esm_shims();
|
|
5041
5030
|
import { execFile as execFile5 } from "child_process";
|
|
5042
5031
|
import { promisify as promisify5 } from "util";
|
|
5043
5032
|
var execFileAsync5 = promisify5(execFile5);
|
|
@@ -5340,6 +5329,7 @@ function startDesktopServer(token, port) {
|
|
|
5340
5329
|
}
|
|
5341
5330
|
|
|
5342
5331
|
// src/lib/computer-use/ngrok.ts
|
|
5332
|
+
init_esm_shims();
|
|
5343
5333
|
async function loadNgrok2() {
|
|
5344
5334
|
try {
|
|
5345
5335
|
const mod = await import("@ngrok/ngrok");
|
|
@@ -5365,7 +5355,7 @@ async function stopDesktopTunnel() {
|
|
|
5365
5355
|
}
|
|
5366
5356
|
|
|
5367
5357
|
// src/commands/zero/computer-use/host.ts
|
|
5368
|
-
var hostStartCommand = new
|
|
5358
|
+
var hostStartCommand = new Command().name("start").description("Start the computer-use host daemon (macOS only)").action(
|
|
5369
5359
|
withErrorHandler(async () => {
|
|
5370
5360
|
if (process.platform !== "darwin") {
|
|
5371
5361
|
throw new Error(
|
|
@@ -5374,13 +5364,13 @@ var hostStartCommand = new Command74().name("start").description("Start the comp
|
|
|
5374
5364
|
}
|
|
5375
5365
|
if (!await isCliclickInstalled()) {
|
|
5376
5366
|
console.log(
|
|
5377
|
-
|
|
5367
|
+
source_default.yellow(
|
|
5378
5368
|
"\u26A0 cliclick not found. Mouse and keyboard operations will not be available.\n Install with: brew install cliclick"
|
|
5379
5369
|
)
|
|
5380
5370
|
);
|
|
5381
5371
|
console.log();
|
|
5382
5372
|
}
|
|
5383
|
-
console.log(
|
|
5373
|
+
console.log(source_default.cyan("Registering computer-use host..."));
|
|
5384
5374
|
const credentials = await registerComputerUseHost();
|
|
5385
5375
|
const port = await getRandomPort2();
|
|
5386
5376
|
const server = await startDesktopServer(credentials.token, port);
|
|
@@ -5391,10 +5381,10 @@ var hostStartCommand = new Command74().name("start").description("Start the comp
|
|
|
5391
5381
|
port
|
|
5392
5382
|
);
|
|
5393
5383
|
console.log();
|
|
5394
|
-
console.log(
|
|
5384
|
+
console.log(source_default.green("\u2713 Computer-use host active"));
|
|
5395
5385
|
console.log(` Desktop: desktop.${credentials.domain}`);
|
|
5396
5386
|
console.log();
|
|
5397
|
-
console.log(
|
|
5387
|
+
console.log(source_default.dim("Press ^C twice to disconnect"));
|
|
5398
5388
|
console.log();
|
|
5399
5389
|
let sigintCount = 0;
|
|
5400
5390
|
await new Promise((resolve) => {
|
|
@@ -5409,7 +5399,7 @@ var hostStartCommand = new Command74().name("start").description("Start the comp
|
|
|
5409
5399
|
sigintCount++;
|
|
5410
5400
|
if (sigintCount === 1) {
|
|
5411
5401
|
console.log(
|
|
5412
|
-
|
|
5402
|
+
source_default.dim("\nPress ^C again to disconnect and exit...")
|
|
5413
5403
|
);
|
|
5414
5404
|
} else {
|
|
5415
5405
|
done();
|
|
@@ -5420,24 +5410,24 @@ var hostStartCommand = new Command74().name("start").description("Start the comp
|
|
|
5420
5410
|
});
|
|
5421
5411
|
} finally {
|
|
5422
5412
|
console.log();
|
|
5423
|
-
console.log(
|
|
5413
|
+
console.log(source_default.cyan("Stopping computer-use host..."));
|
|
5424
5414
|
server.close();
|
|
5425
5415
|
await stopDesktopTunnel();
|
|
5426
5416
|
await unregisterComputerUseHost().catch(() => {
|
|
5427
5417
|
});
|
|
5428
|
-
console.log(
|
|
5418
|
+
console.log(source_default.green("\u2713 Host stopped"));
|
|
5429
5419
|
}
|
|
5430
5420
|
})
|
|
5431
5421
|
);
|
|
5432
|
-
var hostStopCommand = new
|
|
5422
|
+
var hostStopCommand = new Command().name("stop").description("Stop and unregister the computer-use host").action(
|
|
5433
5423
|
withErrorHandler(async () => {
|
|
5434
|
-
console.log(
|
|
5424
|
+
console.log(source_default.cyan("Unregistering computer-use host..."));
|
|
5435
5425
|
try {
|
|
5436
5426
|
await unregisterComputerUseHost();
|
|
5437
|
-
console.log(
|
|
5427
|
+
console.log(source_default.green("\u2713 Host unregistered"));
|
|
5438
5428
|
} catch (error) {
|
|
5439
5429
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
5440
|
-
console.log(
|
|
5430
|
+
console.log(source_default.yellow("No active host registration found"));
|
|
5441
5431
|
return;
|
|
5442
5432
|
}
|
|
5443
5433
|
throw error;
|
|
@@ -5446,11 +5436,12 @@ var hostStopCommand = new Command74().name("stop").description("Stop and unregis
|
|
|
5446
5436
|
);
|
|
5447
5437
|
|
|
5448
5438
|
// src/commands/zero/computer-use/client.ts
|
|
5449
|
-
|
|
5439
|
+
init_esm_shims();
|
|
5450
5440
|
import { writeFile, mkdir } from "fs/promises";
|
|
5451
5441
|
import { join as join4 } from "path";
|
|
5452
5442
|
|
|
5453
5443
|
// src/lib/computer-use/client.ts
|
|
5444
|
+
init_esm_shims();
|
|
5454
5445
|
var cachedHost = null;
|
|
5455
5446
|
var CACHE_TTL_MS = 3e4;
|
|
5456
5447
|
async function discoverHost() {
|
|
@@ -5492,7 +5483,7 @@ async function callHost(path, options) {
|
|
|
5492
5483
|
|
|
5493
5484
|
// src/commands/zero/computer-use/client.ts
|
|
5494
5485
|
function mouseClickCommand(name, action, description) {
|
|
5495
|
-
return new
|
|
5486
|
+
return new Command().name(name).description(description).argument("<x>", "X coordinate (points)").argument("<y>", "Y coordinate (points)").action(
|
|
5496
5487
|
withErrorHandler(async (xStr, yStr) => {
|
|
5497
5488
|
const x = parseInt(xStr, 10);
|
|
5498
5489
|
const y = parseInt(yStr, 10);
|
|
@@ -5508,7 +5499,7 @@ function mouseClickCommand(name, action, description) {
|
|
|
5508
5499
|
})
|
|
5509
5500
|
);
|
|
5510
5501
|
}
|
|
5511
|
-
var clientScreenshotCommand = new
|
|
5502
|
+
var clientScreenshotCommand = new Command().name("screenshot").description("Capture a screenshot from the remote host").action(
|
|
5512
5503
|
withErrorHandler(async () => {
|
|
5513
5504
|
const response = await callHost("/screenshot");
|
|
5514
5505
|
const data = await response.json();
|
|
@@ -5529,7 +5520,7 @@ var clientScreenshotCommand = new Command75().name("screenshot").description("Ca
|
|
|
5529
5520
|
);
|
|
5530
5521
|
})
|
|
5531
5522
|
);
|
|
5532
|
-
var clientZoomCommand = new
|
|
5523
|
+
var clientZoomCommand = new Command().name("zoom").description("Capture a region screenshot from the remote host").requiredOption("--x <number>", "X coordinate of the region").requiredOption("--y <number>", "Y coordinate of the region").requiredOption("--width <number>", "Width of the region").requiredOption("--height <number>", "Height of the region").action(
|
|
5533
5524
|
withErrorHandler(
|
|
5534
5525
|
async (opts) => {
|
|
5535
5526
|
const params = new URLSearchParams({
|
|
@@ -5558,7 +5549,7 @@ var clientZoomCommand = new Command75().name("zoom").description("Capture a regi
|
|
|
5558
5549
|
}
|
|
5559
5550
|
)
|
|
5560
5551
|
);
|
|
5561
|
-
var clientInfoCommand = new
|
|
5552
|
+
var clientInfoCommand = new Command().name("info").description("Get screen info from the remote host").action(
|
|
5562
5553
|
withErrorHandler(async () => {
|
|
5563
5554
|
const response = await callHost("/info");
|
|
5564
5555
|
const data = await response.json();
|
|
@@ -5590,7 +5581,7 @@ var clientTripleClickCommand = mouseClickCommand(
|
|
|
5590
5581
|
"triple_click",
|
|
5591
5582
|
"Perform a triple click at coordinates"
|
|
5592
5583
|
);
|
|
5593
|
-
var clientLeftClickDragCommand = new
|
|
5584
|
+
var clientLeftClickDragCommand = new Command().name("left-click-drag").description("Drag from (startX, startY) to (endX, endY)").argument("<startX>", "Start X coordinate").argument("<startY>", "Start Y coordinate").argument("<endX>", "End X coordinate").argument("<endY>", "End Y coordinate").action(
|
|
5594
5585
|
withErrorHandler(
|
|
5595
5586
|
async (startX, startY, endX, endY) => {
|
|
5596
5587
|
await callHost("/mouse", {
|
|
@@ -5607,7 +5598,7 @@ var clientLeftClickDragCommand = new Command75().name("left-click-drag").descrip
|
|
|
5607
5598
|
}
|
|
5608
5599
|
)
|
|
5609
5600
|
);
|
|
5610
|
-
var clientLeftMouseDownCommand = new
|
|
5601
|
+
var clientLeftMouseDownCommand = new Command().name("left-mouse-down").description("Press and hold the left mouse button at (x, y)").argument("<x>", "X coordinate").argument("<y>", "Y coordinate").action(
|
|
5611
5602
|
withErrorHandler(async (x, y) => {
|
|
5612
5603
|
await callHost("/mouse", {
|
|
5613
5604
|
method: "POST",
|
|
@@ -5616,7 +5607,7 @@ var clientLeftMouseDownCommand = new Command75().name("left-mouse-down").descrip
|
|
|
5616
5607
|
process.stdout.write("ok\n");
|
|
5617
5608
|
})
|
|
5618
5609
|
);
|
|
5619
|
-
var clientLeftMouseUpCommand = new
|
|
5610
|
+
var clientLeftMouseUpCommand = new Command().name("left-mouse-up").description("Release the left mouse button at (x, y)").argument("<x>", "X coordinate").argument("<y>", "Y coordinate").action(
|
|
5620
5611
|
withErrorHandler(async (x, y) => {
|
|
5621
5612
|
await callHost("/mouse", {
|
|
5622
5613
|
method: "POST",
|
|
@@ -5625,7 +5616,7 @@ var clientLeftMouseUpCommand = new Command75().name("left-mouse-up").description
|
|
|
5625
5616
|
process.stdout.write("ok\n");
|
|
5626
5617
|
})
|
|
5627
5618
|
);
|
|
5628
|
-
var clientScrollCommand = new
|
|
5619
|
+
var clientScrollCommand = new Command().name("scroll").description("Scroll at the given screen position").argument("<x>", "X coordinate").argument("<y>", "Y coordinate").argument("<direction>", "Scroll direction: up, down, left, right").argument("[amount]", "Scroll amount in lines (default 3)").action(
|
|
5629
5620
|
withErrorHandler(
|
|
5630
5621
|
async (x, y, direction, amount) => {
|
|
5631
5622
|
await callHost("/mouse", {
|
|
@@ -5642,14 +5633,14 @@ var clientScrollCommand = new Command75().name("scroll").description("Scroll at
|
|
|
5642
5633
|
}
|
|
5643
5634
|
)
|
|
5644
5635
|
);
|
|
5645
|
-
var clientReadClipboardCommand = new
|
|
5636
|
+
var clientReadClipboardCommand = new Command().name("read-clipboard").description("Read text content from the remote clipboard").action(
|
|
5646
5637
|
withErrorHandler(async () => {
|
|
5647
5638
|
const response = await callHost("/clipboard");
|
|
5648
5639
|
const data = await response.json();
|
|
5649
5640
|
process.stdout.write(data.text);
|
|
5650
5641
|
})
|
|
5651
5642
|
);
|
|
5652
|
-
var clientWriteClipboardCommand = new
|
|
5643
|
+
var clientWriteClipboardCommand = new Command().name("write-clipboard").description("Write text content to the remote clipboard").argument("<text>", "Text to write to clipboard").action(
|
|
5653
5644
|
withErrorHandler(async (text) => {
|
|
5654
5645
|
await callHost("/clipboard", {
|
|
5655
5646
|
method: "POST",
|
|
@@ -5658,7 +5649,7 @@ var clientWriteClipboardCommand = new Command75().name("write-clipboard").descri
|
|
|
5658
5649
|
process.stdout.write("ok\n");
|
|
5659
5650
|
})
|
|
5660
5651
|
);
|
|
5661
|
-
var clientKeyCommand = new
|
|
5652
|
+
var clientKeyCommand = new Command().name("key").description("Press a key or key combination (e.g., cmd+c, return)").argument("<combo>", "Key combo string (e.g., cmd+c, ctrl+shift+s, return)").action(
|
|
5662
5653
|
withErrorHandler(async (combo) => {
|
|
5663
5654
|
await callHost("/keyboard", {
|
|
5664
5655
|
method: "POST",
|
|
@@ -5667,7 +5658,7 @@ var clientKeyCommand = new Command75().name("key").description("Press a key or k
|
|
|
5667
5658
|
process.stdout.write("ok\n");
|
|
5668
5659
|
})
|
|
5669
5660
|
);
|
|
5670
|
-
var clientHoldKeyCommand = new
|
|
5661
|
+
var clientHoldKeyCommand = new Command().name("hold-key").description("Hold a key or key combination for a duration").argument("<combo>", "Key combo string (e.g., shift, cmd+shift)").argument("<durationMs>", "Duration to hold in milliseconds").action(
|
|
5671
5662
|
withErrorHandler(async (combo, durationStr) => {
|
|
5672
5663
|
const durationMs = parseInt(durationStr, 10);
|
|
5673
5664
|
if (Number.isNaN(durationMs) || durationMs <= 0) {
|
|
@@ -5680,7 +5671,7 @@ var clientHoldKeyCommand = new Command75().name("hold-key").description("Hold a
|
|
|
5680
5671
|
process.stdout.write("ok\n");
|
|
5681
5672
|
})
|
|
5682
5673
|
);
|
|
5683
|
-
var clientTypeCommand = new
|
|
5674
|
+
var clientTypeCommand = new Command().name("type").description("Type text at the current cursor position").argument("<text>", "Text to type").action(
|
|
5684
5675
|
withErrorHandler(async (text) => {
|
|
5685
5676
|
await callHost("/keyboard", {
|
|
5686
5677
|
method: "POST",
|
|
@@ -5689,7 +5680,7 @@ var clientTypeCommand = new Command75().name("type").description("Type text at t
|
|
|
5689
5680
|
process.stdout.write("ok\n");
|
|
5690
5681
|
})
|
|
5691
5682
|
);
|
|
5692
|
-
var clientOpenAppCommand = new
|
|
5683
|
+
var clientOpenAppCommand = new Command().name("open-app").description("Open or activate a macOS application by name or bundle ID").argument(
|
|
5693
5684
|
"<nameOrBundleId>",
|
|
5694
5685
|
"App name (e.g., Safari) or bundle ID (e.g., com.apple.Safari)"
|
|
5695
5686
|
).action(
|
|
@@ -5706,7 +5697,7 @@ var clientMouseMoveCommand = mouseClickCommand(
|
|
|
5706
5697
|
"move",
|
|
5707
5698
|
"Move mouse pointer to coordinates"
|
|
5708
5699
|
);
|
|
5709
|
-
var clientCursorPositionCommand = new
|
|
5700
|
+
var clientCursorPositionCommand = new Command().name("cursor-position").description("Get current cursor position from the remote host").action(
|
|
5710
5701
|
withErrorHandler(async () => {
|
|
5711
5702
|
const response = await callHost("/cursor-position");
|
|
5712
5703
|
const data = await response.json();
|
|
@@ -5715,50 +5706,25 @@ var clientCursorPositionCommand = new Command75().name("cursor-position").descri
|
|
|
5715
5706
|
);
|
|
5716
5707
|
|
|
5717
5708
|
// src/commands/zero/computer-use/index.ts
|
|
5718
|
-
var hostCommand = new
|
|
5719
|
-
var clientCommand = new
|
|
5720
|
-
|
|
5709
|
+
var hostCommand = new Command().name("host").description("Manage computer-use host daemon").addCommand(hostStartCommand).addCommand(hostStopCommand);
|
|
5710
|
+
var clientCommand = new Command().name("client").description("Interact with remote computer-use host").addCommand(clientScreenshotCommand).addCommand(clientZoomCommand).addCommand(clientInfoCommand).addCommand(clientLeftClickCommand).addCommand(clientRightClickCommand).addCommand(clientMiddleClickCommand).addCommand(clientDoubleClickCommand).addCommand(clientTripleClickCommand).addCommand(clientLeftClickDragCommand).addCommand(clientLeftMouseDownCommand).addCommand(clientLeftMouseUpCommand).addCommand(clientScrollCommand).addCommand(clientReadClipboardCommand).addCommand(clientWriteClipboardCommand).addCommand(clientKeyCommand).addCommand(clientHoldKeyCommand).addCommand(clientTypeCommand).addCommand(clientOpenAppCommand).addCommand(clientMouseMoveCommand).addCommand(clientCursorPositionCommand);
|
|
5711
|
+
clientCommand.addHelpText(
|
|
5721
5712
|
"after",
|
|
5722
5713
|
`
|
|
5723
5714
|
Coordinate System:
|
|
5724
|
-
All
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
logical dimensions and scale factor.
|
|
5728
|
-
|
|
5729
|
-
The "screenshot" command returns an image at logical resolution. The "zoom"
|
|
5730
|
-
command accepts a region in logical coordinates but returns an image at physical
|
|
5731
|
-
resolution (logical size \xD7 scaleFactor), providing higher detail for precise
|
|
5732
|
-
element location.
|
|
5733
|
-
|
|
5734
|
-
Recommended AI agent workflow:
|
|
5735
|
-
1. screenshot \u2014 get a screen overview at logical resolution
|
|
5736
|
-
2. zoom --x --y ... \u2014 zoom into a region of interest for pixel-level detail
|
|
5737
|
-
3. Calculate the logical coordinates of the target element
|
|
5738
|
-
4. Execute click/type operations using those logical coordinates
|
|
5715
|
+
All coordinates use macOS logical points, not physical pixels.
|
|
5716
|
+
On Retina displays, logical size = physical size / scaleFactor.
|
|
5717
|
+
Run "info" to check your screen's logical dimensions.
|
|
5739
5718
|
|
|
5740
5719
|
Examples:
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
Double click at (100, 200): zero computer-use client double-click 100 200
|
|
5748
|
-
Drag from A to B: zero computer-use client left-click-drag 100 100 500 500
|
|
5749
|
-
Press mouse button: zero computer-use client left-mouse-down 200 300
|
|
5750
|
-
Release mouse button: zero computer-use client left-mouse-up 500 500
|
|
5751
|
-
Scroll down at position: zero computer-use client scroll 500 300 down 5
|
|
5752
|
-
Read clipboard text: zero computer-use client read-clipboard
|
|
5753
|
-
Write clipboard text: zero computer-use client write-clipboard "hello"
|
|
5754
|
-
Press key combo: zero computer-use client key "cmd+c"
|
|
5755
|
-
Hold shift for 2 seconds: zero computer-use client hold-key "shift" 2000
|
|
5756
|
-
Type text: zero computer-use client type "Hello, world!"
|
|
5757
|
-
Open an application: zero computer-use client open-app Safari
|
|
5758
|
-
Open by bundle ID: zero computer-use client open-app "com.apple.Safari"
|
|
5759
|
-
Move mouse to (100, 200): zero computer-use client mouse-move 100 200
|
|
5760
|
-
Get cursor position: zero computer-use client cursor-position`
|
|
5720
|
+
zero computer-use client screenshot
|
|
5721
|
+
zero computer-use client zoom --x 0 --y 0 --width 500 --height 500
|
|
5722
|
+
zero computer-use client info
|
|
5723
|
+
zero computer-use client left-click 500 300
|
|
5724
|
+
zero computer-use client scroll 500 300 down 5
|
|
5725
|
+
zero computer-use client key "cmd+c"`
|
|
5761
5726
|
);
|
|
5727
|
+
var zeroComputerUseCommand = new Command().name("computer-use").description("Remote desktop control for cloud agents").addCommand(hostCommand).addCommand(clientCommand);
|
|
5762
5728
|
|
|
5763
5729
|
// src/zero.ts
|
|
5764
5730
|
var COMMAND_CAPABILITY_MAP = {
|
|
@@ -5807,10 +5773,10 @@ function registerZeroCommands(prog, commands) {
|
|
|
5807
5773
|
prog.addCommand(cmd, hidden ? { hidden: true } : {});
|
|
5808
5774
|
}
|
|
5809
5775
|
}
|
|
5810
|
-
var program = new
|
|
5776
|
+
var program = new Command();
|
|
5811
5777
|
program.name("zero").description(
|
|
5812
5778
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
5813
|
-
).version("9.
|
|
5779
|
+
).version("9.106.0").addHelpText(
|
|
5814
5780
|
"after",
|
|
5815
5781
|
`
|
|
5816
5782
|
Examples:
|