@vm0/cli 9.23.0 → 9.24.1
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/index.js +678 -603
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ if (DSN) {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
Sentry.setContext("cli", {
|
|
64
|
-
version: "9.
|
|
64
|
+
version: "9.24.1",
|
|
65
65
|
command: process.argv.slice(2).join(" ")
|
|
66
66
|
});
|
|
67
67
|
Sentry.setContext("runtime", {
|
|
@@ -72,7 +72,7 @@ if (DSN) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/index.ts
|
|
75
|
-
import { Command as
|
|
75
|
+
import { Command as Command72 } from "commander";
|
|
76
76
|
|
|
77
77
|
// src/commands/auth/index.ts
|
|
78
78
|
import { Command as Command5 } from "commander";
|
|
@@ -2594,12 +2594,9 @@ var c14 = initContract();
|
|
|
2594
2594
|
var sessionResponseSchema = z17.object({
|
|
2595
2595
|
id: z17.string(),
|
|
2596
2596
|
agentComposeId: z17.string(),
|
|
2597
|
-
agentComposeVersionId: z17.string().nullable(),
|
|
2598
2597
|
conversationId: z17.string().nullable(),
|
|
2599
2598
|
artifactName: z17.string().nullable(),
|
|
2600
|
-
vars: z17.record(z17.string(), z17.string()).nullable(),
|
|
2601
2599
|
secretNames: z17.array(z17.string()).nullable(),
|
|
2602
|
-
volumeVersions: z17.record(z17.string(), z17.string()).nullable(),
|
|
2603
2600
|
createdAt: z17.string(),
|
|
2604
2601
|
updatedAt: z17.string()
|
|
2605
2602
|
});
|
|
@@ -2700,8 +2697,7 @@ var deployScheduleRequestSchema = z18.object({
|
|
|
2700
2697
|
atTime: z18.string().optional(),
|
|
2701
2698
|
timezone: z18.string().default("UTC"),
|
|
2702
2699
|
prompt: z18.string().min(1, "Prompt required"),
|
|
2703
|
-
vars
|
|
2704
|
-
secrets: z18.record(z18.string(), z18.string()).optional(),
|
|
2700
|
+
// vars and secrets removed - now managed via platform tables
|
|
2705
2701
|
artifactName: z18.string().optional(),
|
|
2706
2702
|
artifactVersion: z18.string().optional(),
|
|
2707
2703
|
volumeVersions: z18.record(z18.string(), z18.string()).optional(),
|
|
@@ -3235,29 +3231,158 @@ var webhookComposeCompleteContract = c19.router({
|
|
|
3235
3231
|
}
|
|
3236
3232
|
});
|
|
3237
3233
|
|
|
3238
|
-
// ../../packages/core/src/contracts/
|
|
3234
|
+
// ../../packages/core/src/contracts/connectors.ts
|
|
3239
3235
|
import { z as z24 } from "zod";
|
|
3240
3236
|
var c20 = initContract();
|
|
3241
|
-
var
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3237
|
+
var connectorTypeSchema = z24.enum(["github"]);
|
|
3238
|
+
var connectorResponseSchema = z24.object({
|
|
3239
|
+
id: z24.string().uuid(),
|
|
3240
|
+
type: connectorTypeSchema,
|
|
3241
|
+
authMethod: z24.string(),
|
|
3242
|
+
externalId: z24.string().nullable(),
|
|
3243
|
+
externalUsername: z24.string().nullable(),
|
|
3244
|
+
externalEmail: z24.string().nullable(),
|
|
3245
|
+
oauthScopes: z24.array(z24.string()).nullable(),
|
|
3246
|
+
createdAt: z24.string(),
|
|
3247
|
+
updatedAt: z24.string()
|
|
3248
|
+
});
|
|
3249
|
+
var connectorListResponseSchema = z24.object({
|
|
3250
|
+
connectors: z24.array(connectorResponseSchema)
|
|
3251
|
+
});
|
|
3252
|
+
var connectorsMainContract = c20.router({
|
|
3253
|
+
list: {
|
|
3254
|
+
method: "GET",
|
|
3255
|
+
path: "/api/connectors",
|
|
3256
|
+
headers: authHeadersSchema,
|
|
3257
|
+
responses: {
|
|
3258
|
+
200: connectorListResponseSchema,
|
|
3259
|
+
401: apiErrorSchema,
|
|
3260
|
+
500: apiErrorSchema
|
|
3261
|
+
},
|
|
3262
|
+
summary: "List all connectors for the authenticated user"
|
|
3263
|
+
}
|
|
3264
|
+
});
|
|
3265
|
+
var connectorsByTypeContract = c20.router({
|
|
3266
|
+
get: {
|
|
3267
|
+
method: "GET",
|
|
3268
|
+
path: "/api/connectors/:type",
|
|
3269
|
+
headers: authHeadersSchema,
|
|
3270
|
+
pathParams: z24.object({
|
|
3271
|
+
type: connectorTypeSchema
|
|
3272
|
+
}),
|
|
3273
|
+
responses: {
|
|
3274
|
+
200: connectorResponseSchema,
|
|
3275
|
+
401: apiErrorSchema,
|
|
3276
|
+
404: apiErrorSchema,
|
|
3277
|
+
500: apiErrorSchema
|
|
3278
|
+
},
|
|
3279
|
+
summary: "Get connector status by type"
|
|
3280
|
+
},
|
|
3281
|
+
delete: {
|
|
3282
|
+
method: "DELETE",
|
|
3283
|
+
path: "/api/connectors/:type",
|
|
3284
|
+
headers: authHeadersSchema,
|
|
3285
|
+
pathParams: z24.object({
|
|
3286
|
+
type: connectorTypeSchema
|
|
3287
|
+
}),
|
|
3288
|
+
responses: {
|
|
3289
|
+
204: c20.noBody(),
|
|
3290
|
+
401: apiErrorSchema,
|
|
3291
|
+
404: apiErrorSchema,
|
|
3292
|
+
500: apiErrorSchema
|
|
3293
|
+
},
|
|
3294
|
+
summary: "Disconnect a connector"
|
|
3295
|
+
}
|
|
3296
|
+
});
|
|
3297
|
+
var connectorSessionStatusSchema = z24.enum([
|
|
3298
|
+
"pending",
|
|
3299
|
+
"complete",
|
|
3300
|
+
"expired",
|
|
3301
|
+
"error"
|
|
3302
|
+
]);
|
|
3303
|
+
var connectorSessionResponseSchema = z24.object({
|
|
3304
|
+
id: z24.string().uuid(),
|
|
3305
|
+
code: z24.string(),
|
|
3306
|
+
type: connectorTypeSchema,
|
|
3307
|
+
status: connectorSessionStatusSchema,
|
|
3308
|
+
verificationUrl: z24.string(),
|
|
3309
|
+
expiresIn: z24.number(),
|
|
3310
|
+
interval: z24.number(),
|
|
3311
|
+
errorMessage: z24.string().nullable().optional()
|
|
3312
|
+
});
|
|
3313
|
+
var connectorSessionStatusResponseSchema = z24.object({
|
|
3314
|
+
status: connectorSessionStatusSchema,
|
|
3315
|
+
errorMessage: z24.string().nullable().optional()
|
|
3316
|
+
});
|
|
3317
|
+
var connectorSessionsContract = c20.router({
|
|
3318
|
+
/**
|
|
3319
|
+
* POST /api/connectors/:type/sessions
|
|
3320
|
+
* Create a new connector session for CLI device flow
|
|
3321
|
+
*/
|
|
3322
|
+
create: {
|
|
3323
|
+
method: "POST",
|
|
3324
|
+
path: "/api/connectors/:type/sessions",
|
|
3325
|
+
headers: authHeadersSchema,
|
|
3326
|
+
pathParams: z24.object({
|
|
3327
|
+
type: connectorTypeSchema
|
|
3328
|
+
}),
|
|
3329
|
+
body: z24.object({}).optional(),
|
|
3330
|
+
responses: {
|
|
3331
|
+
200: connectorSessionResponseSchema,
|
|
3332
|
+
400: apiErrorSchema,
|
|
3333
|
+
401: apiErrorSchema,
|
|
3334
|
+
500: apiErrorSchema
|
|
3335
|
+
},
|
|
3336
|
+
summary: "Create connector session for CLI device flow"
|
|
3337
|
+
}
|
|
3338
|
+
});
|
|
3339
|
+
var connectorSessionByIdContract = c20.router({
|
|
3340
|
+
/**
|
|
3341
|
+
* GET /api/connectors/:type/sessions/:sessionId
|
|
3342
|
+
* Get connector session status (for CLI polling)
|
|
3343
|
+
*/
|
|
3344
|
+
get: {
|
|
3345
|
+
method: "GET",
|
|
3346
|
+
path: "/api/connectors/:type/sessions/:sessionId",
|
|
3347
|
+
headers: authHeadersSchema,
|
|
3348
|
+
pathParams: z24.object({
|
|
3349
|
+
type: connectorTypeSchema,
|
|
3350
|
+
sessionId: z24.string().uuid()
|
|
3351
|
+
}),
|
|
3352
|
+
responses: {
|
|
3353
|
+
200: connectorSessionStatusResponseSchema,
|
|
3354
|
+
400: apiErrorSchema,
|
|
3355
|
+
401: apiErrorSchema,
|
|
3356
|
+
404: apiErrorSchema,
|
|
3357
|
+
500: apiErrorSchema
|
|
3358
|
+
},
|
|
3359
|
+
summary: "Get connector session status"
|
|
3360
|
+
}
|
|
3361
|
+
});
|
|
3362
|
+
|
|
3363
|
+
// ../../packages/core/src/contracts/public/agents.ts
|
|
3364
|
+
import { z as z25 } from "zod";
|
|
3365
|
+
var c21 = initContract();
|
|
3366
|
+
var publicAgentSchema = z25.object({
|
|
3367
|
+
id: z25.string(),
|
|
3368
|
+
name: z25.string(),
|
|
3369
|
+
currentVersionId: z25.string().nullable(),
|
|
3245
3370
|
createdAt: timestampSchema,
|
|
3246
3371
|
updatedAt: timestampSchema
|
|
3247
3372
|
});
|
|
3248
|
-
var agentVersionSchema =
|
|
3249
|
-
id:
|
|
3250
|
-
agentId:
|
|
3251
|
-
versionNumber:
|
|
3373
|
+
var agentVersionSchema = z25.object({
|
|
3374
|
+
id: z25.string(),
|
|
3375
|
+
agentId: z25.string(),
|
|
3376
|
+
versionNumber: z25.number(),
|
|
3252
3377
|
createdAt: timestampSchema
|
|
3253
3378
|
});
|
|
3254
3379
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
3255
3380
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
3256
3381
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
3257
3382
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
3258
|
-
name:
|
|
3383
|
+
name: z25.string().optional()
|
|
3259
3384
|
});
|
|
3260
|
-
var publicAgentsListContract =
|
|
3385
|
+
var publicAgentsListContract = c21.router({
|
|
3261
3386
|
list: {
|
|
3262
3387
|
method: "GET",
|
|
3263
3388
|
path: "/v1/agents",
|
|
@@ -3272,13 +3397,13 @@ var publicAgentsListContract = c20.router({
|
|
|
3272
3397
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
3273
3398
|
}
|
|
3274
3399
|
});
|
|
3275
|
-
var publicAgentByIdContract =
|
|
3400
|
+
var publicAgentByIdContract = c21.router({
|
|
3276
3401
|
get: {
|
|
3277
3402
|
method: "GET",
|
|
3278
3403
|
path: "/v1/agents/:id",
|
|
3279
3404
|
headers: authHeadersSchema,
|
|
3280
|
-
pathParams:
|
|
3281
|
-
id:
|
|
3405
|
+
pathParams: z25.object({
|
|
3406
|
+
id: z25.string().min(1, "Agent ID is required")
|
|
3282
3407
|
}),
|
|
3283
3408
|
responses: {
|
|
3284
3409
|
200: publicAgentDetailSchema,
|
|
@@ -3290,13 +3415,13 @@ var publicAgentByIdContract = c20.router({
|
|
|
3290
3415
|
description: "Get agent details by ID"
|
|
3291
3416
|
}
|
|
3292
3417
|
});
|
|
3293
|
-
var publicAgentVersionsContract =
|
|
3418
|
+
var publicAgentVersionsContract = c21.router({
|
|
3294
3419
|
list: {
|
|
3295
3420
|
method: "GET",
|
|
3296
3421
|
path: "/v1/agents/:id/versions",
|
|
3297
3422
|
headers: authHeadersSchema,
|
|
3298
|
-
pathParams:
|
|
3299
|
-
id:
|
|
3423
|
+
pathParams: z25.object({
|
|
3424
|
+
id: z25.string().min(1, "Agent ID is required")
|
|
3300
3425
|
}),
|
|
3301
3426
|
query: listQuerySchema,
|
|
3302
3427
|
responses: {
|
|
@@ -3311,9 +3436,9 @@ var publicAgentVersionsContract = c20.router({
|
|
|
3311
3436
|
});
|
|
3312
3437
|
|
|
3313
3438
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
3314
|
-
import { z as
|
|
3315
|
-
var
|
|
3316
|
-
var publicRunStatusSchema =
|
|
3439
|
+
import { z as z26 } from "zod";
|
|
3440
|
+
var c22 = initContract();
|
|
3441
|
+
var publicRunStatusSchema = z26.enum([
|
|
3317
3442
|
"pending",
|
|
3318
3443
|
"running",
|
|
3319
3444
|
"completed",
|
|
@@ -3321,54 +3446,54 @@ var publicRunStatusSchema = z25.enum([
|
|
|
3321
3446
|
"timeout",
|
|
3322
3447
|
"cancelled"
|
|
3323
3448
|
]);
|
|
3324
|
-
var publicRunSchema =
|
|
3325
|
-
id:
|
|
3326
|
-
agentId:
|
|
3327
|
-
agentName:
|
|
3449
|
+
var publicRunSchema = z26.object({
|
|
3450
|
+
id: z26.string(),
|
|
3451
|
+
agentId: z26.string(),
|
|
3452
|
+
agentName: z26.string(),
|
|
3328
3453
|
status: publicRunStatusSchema,
|
|
3329
|
-
prompt:
|
|
3454
|
+
prompt: z26.string(),
|
|
3330
3455
|
createdAt: timestampSchema,
|
|
3331
3456
|
startedAt: timestampSchema.nullable(),
|
|
3332
3457
|
completedAt: timestampSchema.nullable()
|
|
3333
3458
|
});
|
|
3334
3459
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
3335
|
-
error:
|
|
3336
|
-
executionTimeMs:
|
|
3337
|
-
checkpointId:
|
|
3338
|
-
sessionId:
|
|
3339
|
-
artifactName:
|
|
3340
|
-
artifactVersion:
|
|
3341
|
-
volumes:
|
|
3460
|
+
error: z26.string().nullable(),
|
|
3461
|
+
executionTimeMs: z26.number().nullable(),
|
|
3462
|
+
checkpointId: z26.string().nullable(),
|
|
3463
|
+
sessionId: z26.string().nullable(),
|
|
3464
|
+
artifactName: z26.string().nullable(),
|
|
3465
|
+
artifactVersion: z26.string().nullable(),
|
|
3466
|
+
volumes: z26.record(z26.string(), z26.string()).optional()
|
|
3342
3467
|
});
|
|
3343
3468
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
3344
|
-
var createRunRequestSchema =
|
|
3469
|
+
var createRunRequestSchema = z26.object({
|
|
3345
3470
|
// Agent identification (one of: agent, agentId, sessionId, checkpointId)
|
|
3346
|
-
agent:
|
|
3471
|
+
agent: z26.string().optional(),
|
|
3347
3472
|
// Agent name
|
|
3348
|
-
agentId:
|
|
3473
|
+
agentId: z26.string().optional(),
|
|
3349
3474
|
// Agent ID
|
|
3350
|
-
agentVersion:
|
|
3475
|
+
agentVersion: z26.string().optional(),
|
|
3351
3476
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
3352
3477
|
// Continue session
|
|
3353
|
-
sessionId:
|
|
3478
|
+
sessionId: z26.string().optional(),
|
|
3354
3479
|
// Resume from checkpoint
|
|
3355
|
-
checkpointId:
|
|
3480
|
+
checkpointId: z26.string().optional(),
|
|
3356
3481
|
// Required
|
|
3357
|
-
prompt:
|
|
3482
|
+
prompt: z26.string().min(1, "Prompt is required"),
|
|
3358
3483
|
// Optional configuration
|
|
3359
|
-
variables:
|
|
3360
|
-
secrets:
|
|
3361
|
-
artifactName:
|
|
3484
|
+
variables: z26.record(z26.string(), z26.string()).optional(),
|
|
3485
|
+
secrets: z26.record(z26.string(), z26.string()).optional(),
|
|
3486
|
+
artifactName: z26.string().optional(),
|
|
3362
3487
|
// Artifact name to mount
|
|
3363
|
-
artifactVersion:
|
|
3488
|
+
artifactVersion: z26.string().optional(),
|
|
3364
3489
|
// Artifact version (defaults to latest)
|
|
3365
|
-
volumes:
|
|
3490
|
+
volumes: z26.record(z26.string(), z26.string()).optional()
|
|
3366
3491
|
// volume_name -> version
|
|
3367
3492
|
});
|
|
3368
3493
|
var runListQuerySchema = listQuerySchema.extend({
|
|
3369
3494
|
status: publicRunStatusSchema.optional()
|
|
3370
3495
|
});
|
|
3371
|
-
var publicRunsListContract =
|
|
3496
|
+
var publicRunsListContract = c22.router({
|
|
3372
3497
|
list: {
|
|
3373
3498
|
method: "GET",
|
|
3374
3499
|
path: "/v1/runs",
|
|
@@ -3400,13 +3525,13 @@ var publicRunsListContract = c21.router({
|
|
|
3400
3525
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
3401
3526
|
}
|
|
3402
3527
|
});
|
|
3403
|
-
var publicRunByIdContract =
|
|
3528
|
+
var publicRunByIdContract = c22.router({
|
|
3404
3529
|
get: {
|
|
3405
3530
|
method: "GET",
|
|
3406
3531
|
path: "/v1/runs/:id",
|
|
3407
3532
|
headers: authHeadersSchema,
|
|
3408
|
-
pathParams:
|
|
3409
|
-
id:
|
|
3533
|
+
pathParams: z26.object({
|
|
3534
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3410
3535
|
}),
|
|
3411
3536
|
responses: {
|
|
3412
3537
|
200: publicRunDetailSchema,
|
|
@@ -3418,15 +3543,15 @@ var publicRunByIdContract = c21.router({
|
|
|
3418
3543
|
description: "Get run details by ID"
|
|
3419
3544
|
}
|
|
3420
3545
|
});
|
|
3421
|
-
var publicRunCancelContract =
|
|
3546
|
+
var publicRunCancelContract = c22.router({
|
|
3422
3547
|
cancel: {
|
|
3423
3548
|
method: "POST",
|
|
3424
3549
|
path: "/v1/runs/:id/cancel",
|
|
3425
3550
|
headers: authHeadersSchema,
|
|
3426
|
-
pathParams:
|
|
3427
|
-
id:
|
|
3551
|
+
pathParams: z26.object({
|
|
3552
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3428
3553
|
}),
|
|
3429
|
-
body:
|
|
3554
|
+
body: z26.undefined(),
|
|
3430
3555
|
responses: {
|
|
3431
3556
|
200: publicRunDetailSchema,
|
|
3432
3557
|
400: publicApiErrorSchema,
|
|
@@ -3439,27 +3564,27 @@ var publicRunCancelContract = c21.router({
|
|
|
3439
3564
|
description: "Cancel a pending or running execution"
|
|
3440
3565
|
}
|
|
3441
3566
|
});
|
|
3442
|
-
var logEntrySchema =
|
|
3567
|
+
var logEntrySchema = z26.object({
|
|
3443
3568
|
timestamp: timestampSchema,
|
|
3444
|
-
type:
|
|
3445
|
-
level:
|
|
3446
|
-
message:
|
|
3447
|
-
metadata:
|
|
3569
|
+
type: z26.enum(["agent", "system", "network"]),
|
|
3570
|
+
level: z26.enum(["debug", "info", "warn", "error"]),
|
|
3571
|
+
message: z26.string(),
|
|
3572
|
+
metadata: z26.record(z26.string(), z26.unknown()).optional()
|
|
3448
3573
|
});
|
|
3449
3574
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
3450
3575
|
var logsQuerySchema = listQuerySchema.extend({
|
|
3451
|
-
type:
|
|
3576
|
+
type: z26.enum(["agent", "system", "network", "all"]).default("all"),
|
|
3452
3577
|
since: timestampSchema.optional(),
|
|
3453
3578
|
until: timestampSchema.optional(),
|
|
3454
|
-
order:
|
|
3579
|
+
order: z26.enum(["asc", "desc"]).default("asc")
|
|
3455
3580
|
});
|
|
3456
|
-
var publicRunLogsContract =
|
|
3581
|
+
var publicRunLogsContract = c22.router({
|
|
3457
3582
|
getLogs: {
|
|
3458
3583
|
method: "GET",
|
|
3459
3584
|
path: "/v1/runs/:id/logs",
|
|
3460
3585
|
headers: authHeadersSchema,
|
|
3461
|
-
pathParams:
|
|
3462
|
-
id:
|
|
3586
|
+
pathParams: z26.object({
|
|
3587
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3463
3588
|
}),
|
|
3464
3589
|
query: logsQuerySchema,
|
|
3465
3590
|
responses: {
|
|
@@ -3472,30 +3597,30 @@ var publicRunLogsContract = c21.router({
|
|
|
3472
3597
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
3473
3598
|
}
|
|
3474
3599
|
});
|
|
3475
|
-
var metricPointSchema =
|
|
3600
|
+
var metricPointSchema = z26.object({
|
|
3476
3601
|
timestamp: timestampSchema,
|
|
3477
|
-
cpuPercent:
|
|
3478
|
-
memoryUsedMb:
|
|
3479
|
-
memoryTotalMb:
|
|
3480
|
-
diskUsedMb:
|
|
3481
|
-
diskTotalMb:
|
|
3482
|
-
});
|
|
3483
|
-
var metricsSummarySchema =
|
|
3484
|
-
avgCpuPercent:
|
|
3485
|
-
maxMemoryUsedMb:
|
|
3486
|
-
totalDurationMs:
|
|
3487
|
-
});
|
|
3488
|
-
var metricsResponseSchema2 =
|
|
3489
|
-
data:
|
|
3602
|
+
cpuPercent: z26.number(),
|
|
3603
|
+
memoryUsedMb: z26.number(),
|
|
3604
|
+
memoryTotalMb: z26.number(),
|
|
3605
|
+
diskUsedMb: z26.number(),
|
|
3606
|
+
diskTotalMb: z26.number()
|
|
3607
|
+
});
|
|
3608
|
+
var metricsSummarySchema = z26.object({
|
|
3609
|
+
avgCpuPercent: z26.number(),
|
|
3610
|
+
maxMemoryUsedMb: z26.number(),
|
|
3611
|
+
totalDurationMs: z26.number().nullable()
|
|
3612
|
+
});
|
|
3613
|
+
var metricsResponseSchema2 = z26.object({
|
|
3614
|
+
data: z26.array(metricPointSchema),
|
|
3490
3615
|
summary: metricsSummarySchema
|
|
3491
3616
|
});
|
|
3492
|
-
var publicRunMetricsContract =
|
|
3617
|
+
var publicRunMetricsContract = c22.router({
|
|
3493
3618
|
getMetrics: {
|
|
3494
3619
|
method: "GET",
|
|
3495
3620
|
path: "/v1/runs/:id/metrics",
|
|
3496
3621
|
headers: authHeadersSchema,
|
|
3497
|
-
pathParams:
|
|
3498
|
-
id:
|
|
3622
|
+
pathParams: z26.object({
|
|
3623
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3499
3624
|
}),
|
|
3500
3625
|
responses: {
|
|
3501
3626
|
200: metricsResponseSchema2,
|
|
@@ -3507,7 +3632,7 @@ var publicRunMetricsContract = c21.router({
|
|
|
3507
3632
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
3508
3633
|
}
|
|
3509
3634
|
});
|
|
3510
|
-
var sseEventTypeSchema =
|
|
3635
|
+
var sseEventTypeSchema = z26.enum([
|
|
3511
3636
|
"status",
|
|
3512
3637
|
// Run status change
|
|
3513
3638
|
"output",
|
|
@@ -3519,26 +3644,26 @@ var sseEventTypeSchema = z25.enum([
|
|
|
3519
3644
|
"heartbeat"
|
|
3520
3645
|
// Keep-alive
|
|
3521
3646
|
]);
|
|
3522
|
-
var sseEventSchema =
|
|
3647
|
+
var sseEventSchema = z26.object({
|
|
3523
3648
|
event: sseEventTypeSchema,
|
|
3524
|
-
data:
|
|
3525
|
-
id:
|
|
3649
|
+
data: z26.unknown(),
|
|
3650
|
+
id: z26.string().optional()
|
|
3526
3651
|
// For Last-Event-ID reconnection
|
|
3527
3652
|
});
|
|
3528
|
-
var publicRunEventsContract =
|
|
3653
|
+
var publicRunEventsContract = c22.router({
|
|
3529
3654
|
streamEvents: {
|
|
3530
3655
|
method: "GET",
|
|
3531
3656
|
path: "/v1/runs/:id/events",
|
|
3532
3657
|
headers: authHeadersSchema,
|
|
3533
|
-
pathParams:
|
|
3534
|
-
id:
|
|
3658
|
+
pathParams: z26.object({
|
|
3659
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3535
3660
|
}),
|
|
3536
|
-
query:
|
|
3537
|
-
lastEventId:
|
|
3661
|
+
query: z26.object({
|
|
3662
|
+
lastEventId: z26.string().optional()
|
|
3538
3663
|
// For reconnection
|
|
3539
3664
|
}),
|
|
3540
3665
|
responses: {
|
|
3541
|
-
200:
|
|
3666
|
+
200: z26.any(),
|
|
3542
3667
|
// SSE stream - actual content is text/event-stream
|
|
3543
3668
|
401: publicApiErrorSchema,
|
|
3544
3669
|
404: publicApiErrorSchema,
|
|
@@ -3550,28 +3675,28 @@ var publicRunEventsContract = c21.router({
|
|
|
3550
3675
|
});
|
|
3551
3676
|
|
|
3552
3677
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
3553
|
-
import { z as
|
|
3554
|
-
var
|
|
3555
|
-
var publicArtifactSchema =
|
|
3556
|
-
id:
|
|
3557
|
-
name:
|
|
3558
|
-
currentVersionId:
|
|
3559
|
-
size:
|
|
3678
|
+
import { z as z27 } from "zod";
|
|
3679
|
+
var c23 = initContract();
|
|
3680
|
+
var publicArtifactSchema = z27.object({
|
|
3681
|
+
id: z27.string(),
|
|
3682
|
+
name: z27.string(),
|
|
3683
|
+
currentVersionId: z27.string().nullable(),
|
|
3684
|
+
size: z27.number(),
|
|
3560
3685
|
// Total size in bytes
|
|
3561
|
-
fileCount:
|
|
3686
|
+
fileCount: z27.number(),
|
|
3562
3687
|
createdAt: timestampSchema,
|
|
3563
3688
|
updatedAt: timestampSchema
|
|
3564
3689
|
});
|
|
3565
|
-
var artifactVersionSchema =
|
|
3566
|
-
id:
|
|
3690
|
+
var artifactVersionSchema = z27.object({
|
|
3691
|
+
id: z27.string(),
|
|
3567
3692
|
// SHA-256 content hash
|
|
3568
|
-
artifactId:
|
|
3569
|
-
size:
|
|
3693
|
+
artifactId: z27.string(),
|
|
3694
|
+
size: z27.number(),
|
|
3570
3695
|
// Size in bytes
|
|
3571
|
-
fileCount:
|
|
3572
|
-
message:
|
|
3696
|
+
fileCount: z27.number(),
|
|
3697
|
+
message: z27.string().nullable(),
|
|
3573
3698
|
// Optional commit message
|
|
3574
|
-
createdBy:
|
|
3699
|
+
createdBy: z27.string(),
|
|
3575
3700
|
createdAt: timestampSchema
|
|
3576
3701
|
});
|
|
3577
3702
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -3581,7 +3706,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
3581
3706
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
3582
3707
|
artifactVersionSchema
|
|
3583
3708
|
);
|
|
3584
|
-
var publicArtifactsListContract =
|
|
3709
|
+
var publicArtifactsListContract = c23.router({
|
|
3585
3710
|
list: {
|
|
3586
3711
|
method: "GET",
|
|
3587
3712
|
path: "/v1/artifacts",
|
|
@@ -3596,13 +3721,13 @@ var publicArtifactsListContract = c22.router({
|
|
|
3596
3721
|
description: "List all artifacts in the current scope with pagination"
|
|
3597
3722
|
}
|
|
3598
3723
|
});
|
|
3599
|
-
var publicArtifactByIdContract =
|
|
3724
|
+
var publicArtifactByIdContract = c23.router({
|
|
3600
3725
|
get: {
|
|
3601
3726
|
method: "GET",
|
|
3602
3727
|
path: "/v1/artifacts/:id",
|
|
3603
3728
|
headers: authHeadersSchema,
|
|
3604
|
-
pathParams:
|
|
3605
|
-
id:
|
|
3729
|
+
pathParams: z27.object({
|
|
3730
|
+
id: z27.string().min(1, "Artifact ID is required")
|
|
3606
3731
|
}),
|
|
3607
3732
|
responses: {
|
|
3608
3733
|
200: publicArtifactDetailSchema,
|
|
@@ -3614,13 +3739,13 @@ var publicArtifactByIdContract = c22.router({
|
|
|
3614
3739
|
description: "Get artifact details by ID"
|
|
3615
3740
|
}
|
|
3616
3741
|
});
|
|
3617
|
-
var publicArtifactVersionsContract =
|
|
3742
|
+
var publicArtifactVersionsContract = c23.router({
|
|
3618
3743
|
list: {
|
|
3619
3744
|
method: "GET",
|
|
3620
3745
|
path: "/v1/artifacts/:id/versions",
|
|
3621
3746
|
headers: authHeadersSchema,
|
|
3622
|
-
pathParams:
|
|
3623
|
-
id:
|
|
3747
|
+
pathParams: z27.object({
|
|
3748
|
+
id: z27.string().min(1, "Artifact ID is required")
|
|
3624
3749
|
}),
|
|
3625
3750
|
query: listQuerySchema,
|
|
3626
3751
|
responses: {
|
|
@@ -3633,20 +3758,20 @@ var publicArtifactVersionsContract = c22.router({
|
|
|
3633
3758
|
description: "List all versions of an artifact with pagination"
|
|
3634
3759
|
}
|
|
3635
3760
|
});
|
|
3636
|
-
var publicArtifactDownloadContract =
|
|
3761
|
+
var publicArtifactDownloadContract = c23.router({
|
|
3637
3762
|
download: {
|
|
3638
3763
|
method: "GET",
|
|
3639
3764
|
path: "/v1/artifacts/:id/download",
|
|
3640
3765
|
headers: authHeadersSchema,
|
|
3641
|
-
pathParams:
|
|
3642
|
-
id:
|
|
3766
|
+
pathParams: z27.object({
|
|
3767
|
+
id: z27.string().min(1, "Artifact ID is required")
|
|
3643
3768
|
}),
|
|
3644
|
-
query:
|
|
3645
|
-
versionId:
|
|
3769
|
+
query: z27.object({
|
|
3770
|
+
versionId: z27.string().optional()
|
|
3646
3771
|
// Defaults to current version
|
|
3647
3772
|
}),
|
|
3648
3773
|
responses: {
|
|
3649
|
-
302:
|
|
3774
|
+
302: z27.undefined(),
|
|
3650
3775
|
// Redirect to presigned URL
|
|
3651
3776
|
401: publicApiErrorSchema,
|
|
3652
3777
|
404: publicApiErrorSchema,
|
|
@@ -3658,28 +3783,28 @@ var publicArtifactDownloadContract = c22.router({
|
|
|
3658
3783
|
});
|
|
3659
3784
|
|
|
3660
3785
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
3661
|
-
import { z as
|
|
3662
|
-
var
|
|
3663
|
-
var publicVolumeSchema =
|
|
3664
|
-
id:
|
|
3665
|
-
name:
|
|
3666
|
-
currentVersionId:
|
|
3667
|
-
size:
|
|
3786
|
+
import { z as z28 } from "zod";
|
|
3787
|
+
var c24 = initContract();
|
|
3788
|
+
var publicVolumeSchema = z28.object({
|
|
3789
|
+
id: z28.string(),
|
|
3790
|
+
name: z28.string(),
|
|
3791
|
+
currentVersionId: z28.string().nullable(),
|
|
3792
|
+
size: z28.number(),
|
|
3668
3793
|
// Total size in bytes
|
|
3669
|
-
fileCount:
|
|
3794
|
+
fileCount: z28.number(),
|
|
3670
3795
|
createdAt: timestampSchema,
|
|
3671
3796
|
updatedAt: timestampSchema
|
|
3672
3797
|
});
|
|
3673
|
-
var volumeVersionSchema =
|
|
3674
|
-
id:
|
|
3798
|
+
var volumeVersionSchema = z28.object({
|
|
3799
|
+
id: z28.string(),
|
|
3675
3800
|
// SHA-256 content hash
|
|
3676
|
-
volumeId:
|
|
3677
|
-
size:
|
|
3801
|
+
volumeId: z28.string(),
|
|
3802
|
+
size: z28.number(),
|
|
3678
3803
|
// Size in bytes
|
|
3679
|
-
fileCount:
|
|
3680
|
-
message:
|
|
3804
|
+
fileCount: z28.number(),
|
|
3805
|
+
message: z28.string().nullable(),
|
|
3681
3806
|
// Optional commit message
|
|
3682
|
-
createdBy:
|
|
3807
|
+
createdBy: z28.string(),
|
|
3683
3808
|
createdAt: timestampSchema
|
|
3684
3809
|
});
|
|
3685
3810
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -3687,7 +3812,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
3687
3812
|
});
|
|
3688
3813
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
3689
3814
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
3690
|
-
var publicVolumesListContract =
|
|
3815
|
+
var publicVolumesListContract = c24.router({
|
|
3691
3816
|
list: {
|
|
3692
3817
|
method: "GET",
|
|
3693
3818
|
path: "/v1/volumes",
|
|
@@ -3702,13 +3827,13 @@ var publicVolumesListContract = c23.router({
|
|
|
3702
3827
|
description: "List all volumes in the current scope with pagination"
|
|
3703
3828
|
}
|
|
3704
3829
|
});
|
|
3705
|
-
var publicVolumeByIdContract =
|
|
3830
|
+
var publicVolumeByIdContract = c24.router({
|
|
3706
3831
|
get: {
|
|
3707
3832
|
method: "GET",
|
|
3708
3833
|
path: "/v1/volumes/:id",
|
|
3709
3834
|
headers: authHeadersSchema,
|
|
3710
|
-
pathParams:
|
|
3711
|
-
id:
|
|
3835
|
+
pathParams: z28.object({
|
|
3836
|
+
id: z28.string().min(1, "Volume ID is required")
|
|
3712
3837
|
}),
|
|
3713
3838
|
responses: {
|
|
3714
3839
|
200: publicVolumeDetailSchema,
|
|
@@ -3720,13 +3845,13 @@ var publicVolumeByIdContract = c23.router({
|
|
|
3720
3845
|
description: "Get volume details by ID"
|
|
3721
3846
|
}
|
|
3722
3847
|
});
|
|
3723
|
-
var publicVolumeVersionsContract =
|
|
3848
|
+
var publicVolumeVersionsContract = c24.router({
|
|
3724
3849
|
list: {
|
|
3725
3850
|
method: "GET",
|
|
3726
3851
|
path: "/v1/volumes/:id/versions",
|
|
3727
3852
|
headers: authHeadersSchema,
|
|
3728
|
-
pathParams:
|
|
3729
|
-
id:
|
|
3853
|
+
pathParams: z28.object({
|
|
3854
|
+
id: z28.string().min(1, "Volume ID is required")
|
|
3730
3855
|
}),
|
|
3731
3856
|
query: listQuerySchema,
|
|
3732
3857
|
responses: {
|
|
@@ -3739,20 +3864,20 @@ var publicVolumeVersionsContract = c23.router({
|
|
|
3739
3864
|
description: "List all versions of a volume with pagination"
|
|
3740
3865
|
}
|
|
3741
3866
|
});
|
|
3742
|
-
var publicVolumeDownloadContract =
|
|
3867
|
+
var publicVolumeDownloadContract = c24.router({
|
|
3743
3868
|
download: {
|
|
3744
3869
|
method: "GET",
|
|
3745
3870
|
path: "/v1/volumes/:id/download",
|
|
3746
3871
|
headers: authHeadersSchema,
|
|
3747
|
-
pathParams:
|
|
3748
|
-
id:
|
|
3872
|
+
pathParams: z28.object({
|
|
3873
|
+
id: z28.string().min(1, "Volume ID is required")
|
|
3749
3874
|
}),
|
|
3750
|
-
query:
|
|
3751
|
-
versionId:
|
|
3875
|
+
query: z28.object({
|
|
3876
|
+
versionId: z28.string().optional()
|
|
3752
3877
|
// Defaults to current version
|
|
3753
3878
|
}),
|
|
3754
3879
|
responses: {
|
|
3755
|
-
302:
|
|
3880
|
+
302: z28.undefined(),
|
|
3756
3881
|
// Redirect to presigned URL
|
|
3757
3882
|
401: publicApiErrorSchema,
|
|
3758
3883
|
404: publicApiErrorSchema,
|
|
@@ -4470,8 +4595,8 @@ async function getUsage(options) {
|
|
|
4470
4595
|
}
|
|
4471
4596
|
|
|
4472
4597
|
// src/lib/domain/yaml-validator.ts
|
|
4473
|
-
import { z as
|
|
4474
|
-
var cliAgentNameSchema =
|
|
4598
|
+
import { z as z29 } from "zod";
|
|
4599
|
+
var cliAgentNameSchema = z29.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
4475
4600
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
4476
4601
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
4477
4602
|
);
|
|
@@ -4486,7 +4611,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4486
4611
|
const skillUrl = agent.skills[i];
|
|
4487
4612
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
4488
4613
|
ctx.addIssue({
|
|
4489
|
-
code:
|
|
4614
|
+
code: z29.ZodIssueCode.custom,
|
|
4490
4615
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
4491
4616
|
path: ["skills", i]
|
|
4492
4617
|
});
|
|
@@ -4495,15 +4620,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4495
4620
|
}
|
|
4496
4621
|
}
|
|
4497
4622
|
);
|
|
4498
|
-
var cliComposeSchema =
|
|
4499
|
-
version:
|
|
4500
|
-
agents:
|
|
4501
|
-
volumes:
|
|
4623
|
+
var cliComposeSchema = z29.object({
|
|
4624
|
+
version: z29.string().min(1, "Missing config.version"),
|
|
4625
|
+
agents: z29.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
4626
|
+
volumes: z29.record(z29.string(), volumeConfigSchema).optional()
|
|
4502
4627
|
}).superRefine((config, ctx) => {
|
|
4503
4628
|
const agentKeys = Object.keys(config.agents);
|
|
4504
4629
|
if (agentKeys.length === 0) {
|
|
4505
4630
|
ctx.addIssue({
|
|
4506
|
-
code:
|
|
4631
|
+
code: z29.ZodIssueCode.custom,
|
|
4507
4632
|
message: "agents must have at least one agent defined",
|
|
4508
4633
|
path: ["agents"]
|
|
4509
4634
|
});
|
|
@@ -4511,7 +4636,7 @@ var cliComposeSchema = z28.object({
|
|
|
4511
4636
|
}
|
|
4512
4637
|
if (agentKeys.length > 1) {
|
|
4513
4638
|
ctx.addIssue({
|
|
4514
|
-
code:
|
|
4639
|
+
code: z29.ZodIssueCode.custom,
|
|
4515
4640
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
4516
4641
|
path: ["agents"]
|
|
4517
4642
|
});
|
|
@@ -4523,7 +4648,7 @@ var cliComposeSchema = z28.object({
|
|
|
4523
4648
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
4524
4649
|
if (!config.volumes) {
|
|
4525
4650
|
ctx.addIssue({
|
|
4526
|
-
code:
|
|
4651
|
+
code: z29.ZodIssueCode.custom,
|
|
4527
4652
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
4528
4653
|
path: ["volumes"]
|
|
4529
4654
|
});
|
|
@@ -4533,7 +4658,7 @@ var cliComposeSchema = z28.object({
|
|
|
4533
4658
|
const parts = volDeclaration.split(":");
|
|
4534
4659
|
if (parts.length !== 2) {
|
|
4535
4660
|
ctx.addIssue({
|
|
4536
|
-
code:
|
|
4661
|
+
code: z29.ZodIssueCode.custom,
|
|
4537
4662
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
4538
4663
|
path: ["agents", agentName, "volumes"]
|
|
4539
4664
|
});
|
|
@@ -4542,7 +4667,7 @@ var cliComposeSchema = z28.object({
|
|
|
4542
4667
|
const volumeKey = parts[0].trim();
|
|
4543
4668
|
if (!config.volumes[volumeKey]) {
|
|
4544
4669
|
ctx.addIssue({
|
|
4545
|
-
code:
|
|
4670
|
+
code: z29.ZodIssueCode.custom,
|
|
4546
4671
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
4547
4672
|
path: ["volumes", volumeKey]
|
|
4548
4673
|
});
|
|
@@ -5711,7 +5836,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5711
5836
|
);
|
|
5712
5837
|
}
|
|
5713
5838
|
if (options.autoUpdate !== false) {
|
|
5714
|
-
await silentUpgradeAfterCommand("9.
|
|
5839
|
+
await silentUpgradeAfterCommand("9.24.1");
|
|
5715
5840
|
}
|
|
5716
5841
|
return result;
|
|
5717
5842
|
}
|
|
@@ -6648,9 +6773,9 @@ var CodexEventParser = class {
|
|
|
6648
6773
|
}
|
|
6649
6774
|
}
|
|
6650
6775
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6651
|
-
const changes = item.changes.map((
|
|
6652
|
-
const action =
|
|
6653
|
-
return `${action}: ${
|
|
6776
|
+
const changes = item.changes.map((c25) => {
|
|
6777
|
+
const action = c25.kind === "add" ? "Created" : c25.kind === "modify" ? "Modified" : "Deleted";
|
|
6778
|
+
return `${action}: ${c25.path}`;
|
|
6654
6779
|
}).join("\n");
|
|
6655
6780
|
return {
|
|
6656
6781
|
type: "text",
|
|
@@ -6804,9 +6929,9 @@ var CodexEventRenderer = class {
|
|
|
6804
6929
|
return;
|
|
6805
6930
|
}
|
|
6806
6931
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6807
|
-
const summary = item.changes.map((
|
|
6808
|
-
const icon =
|
|
6809
|
-
return `${icon}${
|
|
6932
|
+
const summary = item.changes.map((c25) => {
|
|
6933
|
+
const icon = c25.kind === "add" ? "+" : c25.kind === "delete" ? "-" : "~";
|
|
6934
|
+
return `${icon}${c25.path}`;
|
|
6810
6935
|
}).join(", ");
|
|
6811
6936
|
console.log(chalk7.green("[files]") + ` ${summary}`);
|
|
6812
6937
|
return;
|
|
@@ -7252,6 +7377,7 @@ var ApiClient = class {
|
|
|
7252
7377
|
}
|
|
7253
7378
|
/**
|
|
7254
7379
|
* Deploy schedule (create or update)
|
|
7380
|
+
* Note: vars and secrets are now managed via platform tables (vm0 secret set, vm0 var set)
|
|
7255
7381
|
*/
|
|
7256
7382
|
async deploySchedule(body) {
|
|
7257
7383
|
const baseUrl = await this.getBaseUrl();
|
|
@@ -8153,7 +8279,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8153
8279
|
}
|
|
8154
8280
|
showNextSteps(result);
|
|
8155
8281
|
if (options.autoUpdate !== false) {
|
|
8156
|
-
await silentUpgradeAfterCommand("9.
|
|
8282
|
+
await silentUpgradeAfterCommand("9.24.1");
|
|
8157
8283
|
}
|
|
8158
8284
|
} catch (error) {
|
|
8159
8285
|
handleRunError(error, identifier);
|
|
@@ -8261,11 +8387,6 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8261
8387
|
"Secrets for ${{ secrets.xxx }} (repeatable, falls back to --env-file or env vars)",
|
|
8262
8388
|
collectKeyValue,
|
|
8263
8389
|
{}
|
|
8264
|
-
).option(
|
|
8265
|
-
"--volume-version <name=version>",
|
|
8266
|
-
"Volume version override (repeatable)",
|
|
8267
|
-
collectVolumeVersions,
|
|
8268
|
-
{}
|
|
8269
8390
|
).option(
|
|
8270
8391
|
"--experimental-realtime",
|
|
8271
8392
|
"Use realtime event streaming instead of polling (experimental)"
|
|
@@ -8294,7 +8415,6 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8294
8415
|
prompt,
|
|
8295
8416
|
vars: Object.keys(vars).length > 0 ? vars : void 0,
|
|
8296
8417
|
secrets: loadedSecrets,
|
|
8297
|
-
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
|
|
8298
8418
|
modelProvider: options.modelProvider || allOpts.modelProvider,
|
|
8299
8419
|
debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
|
|
8300
8420
|
});
|
|
@@ -9660,7 +9780,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9660
9780
|
).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
|
|
9661
9781
|
async (prompt, options) => {
|
|
9662
9782
|
if (options.autoUpdate !== false) {
|
|
9663
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9783
|
+
const shouldExit = await checkAndUpgrade("9.24.1", prompt);
|
|
9664
9784
|
if (shouldExit) {
|
|
9665
9785
|
process.exit(0);
|
|
9666
9786
|
}
|
|
@@ -10375,7 +10495,7 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10375
10495
|
);
|
|
10376
10496
|
return;
|
|
10377
10497
|
}
|
|
10378
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
10498
|
+
const nameWidth = Math.max(4, ...data.composes.map((c25) => c25.name.length));
|
|
10379
10499
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
10380
10500
|
" "
|
|
10381
10501
|
);
|
|
@@ -10973,7 +11093,7 @@ import { Command as Command51 } from "commander";
|
|
|
10973
11093
|
|
|
10974
11094
|
// src/commands/schedule/setup.ts
|
|
10975
11095
|
import { Command as Command45 } from "commander";
|
|
10976
|
-
import
|
|
11096
|
+
import chalk45 from "chalk";
|
|
10977
11097
|
|
|
10978
11098
|
// src/lib/domain/schedule-utils.ts
|
|
10979
11099
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -11085,22 +11205,6 @@ function toISODateTime(dateTimeStr) {
|
|
|
11085
11205
|
const date = new Date(isoStr);
|
|
11086
11206
|
return date.toISOString();
|
|
11087
11207
|
}
|
|
11088
|
-
function extractRequiredConfiguration(composeContent) {
|
|
11089
|
-
const result = {
|
|
11090
|
-
secrets: [],
|
|
11091
|
-
vars: [],
|
|
11092
|
-
credentials: []
|
|
11093
|
-
};
|
|
11094
|
-
if (!composeContent) {
|
|
11095
|
-
return result;
|
|
11096
|
-
}
|
|
11097
|
-
const refs = extractVariableReferences(composeContent);
|
|
11098
|
-
const grouped = groupVariablesBySource(refs);
|
|
11099
|
-
result.secrets = grouped.secrets.map((r) => r.name);
|
|
11100
|
-
result.vars = grouped.vars.map((r) => r.name);
|
|
11101
|
-
result.credentials = grouped.credentials.map((r) => r.name);
|
|
11102
|
-
return result;
|
|
11103
|
-
}
|
|
11104
11208
|
async function resolveScheduleByAgent(agentName) {
|
|
11105
11209
|
const { schedules } = await listSchedules();
|
|
11106
11210
|
const schedule = schedules.find((s) => s.composeName === agentName);
|
|
@@ -11114,117 +11218,6 @@ async function resolveScheduleByAgent(agentName) {
|
|
|
11114
11218
|
};
|
|
11115
11219
|
}
|
|
11116
11220
|
|
|
11117
|
-
// src/commands/schedule/gather-configuration.ts
|
|
11118
|
-
import chalk45 from "chalk";
|
|
11119
|
-
var defaultPromptDeps = {
|
|
11120
|
-
isInteractive,
|
|
11121
|
-
promptConfirm,
|
|
11122
|
-
promptText
|
|
11123
|
-
};
|
|
11124
|
-
function parseKeyValuePairs(pairs) {
|
|
11125
|
-
const result = {};
|
|
11126
|
-
for (const pair of pairs) {
|
|
11127
|
-
const eqIndex = pair.indexOf("=");
|
|
11128
|
-
if (eqIndex > 0) {
|
|
11129
|
-
const key = pair.slice(0, eqIndex);
|
|
11130
|
-
const value = pair.slice(eqIndex + 1);
|
|
11131
|
-
result[key] = value;
|
|
11132
|
-
}
|
|
11133
|
-
}
|
|
11134
|
-
return result;
|
|
11135
|
-
}
|
|
11136
|
-
async function handleExistingSecrets(existingSecretNames, deps) {
|
|
11137
|
-
if (existingSecretNames.length > 0 && deps.isInteractive()) {
|
|
11138
|
-
const keepSecrets = await deps.promptConfirm(
|
|
11139
|
-
`Keep existing secrets? (${existingSecretNames.join(", ")})`,
|
|
11140
|
-
true
|
|
11141
|
-
);
|
|
11142
|
-
if (keepSecrets) {
|
|
11143
|
-
return true;
|
|
11144
|
-
}
|
|
11145
|
-
console.log(
|
|
11146
|
-
chalk45.dim(
|
|
11147
|
-
" Note: Secrets will be cleared. Use 'vm0 secret set' to add platform secrets."
|
|
11148
|
-
)
|
|
11149
|
-
);
|
|
11150
|
-
return false;
|
|
11151
|
-
}
|
|
11152
|
-
return false;
|
|
11153
|
-
}
|
|
11154
|
-
async function handleVars(optionVars, existingVars, deps) {
|
|
11155
|
-
if (optionVars.length > 0) {
|
|
11156
|
-
return parseKeyValuePairs(optionVars);
|
|
11157
|
-
}
|
|
11158
|
-
if (existingVars && deps.isInteractive()) {
|
|
11159
|
-
const keepVars = await deps.promptConfirm(
|
|
11160
|
-
`Keep existing variables? (${Object.keys(existingVars).join(", ")})`,
|
|
11161
|
-
true
|
|
11162
|
-
);
|
|
11163
|
-
if (keepVars) {
|
|
11164
|
-
return { ...existingVars };
|
|
11165
|
-
}
|
|
11166
|
-
}
|
|
11167
|
-
return {};
|
|
11168
|
-
}
|
|
11169
|
-
function displayMissingRequirements(missingSecrets, missingVars) {
|
|
11170
|
-
if (missingSecrets.length > 0) {
|
|
11171
|
-
console.log(chalk45.yellow("\nAgent requires the following secrets:"));
|
|
11172
|
-
for (const name of missingSecrets) {
|
|
11173
|
-
console.log(chalk45.dim(` ${name}`));
|
|
11174
|
-
}
|
|
11175
|
-
console.log();
|
|
11176
|
-
console.log("Set secrets using the platform:");
|
|
11177
|
-
for (const name of missingSecrets) {
|
|
11178
|
-
console.log(chalk45.cyan(` vm0 secret set ${name} <value>`));
|
|
11179
|
-
}
|
|
11180
|
-
console.log();
|
|
11181
|
-
}
|
|
11182
|
-
if (missingVars.length > 0) {
|
|
11183
|
-
console.log(chalk45.yellow("\nAgent requires the following variables:"));
|
|
11184
|
-
for (const name of missingVars) {
|
|
11185
|
-
console.log(chalk45.dim(` ${name}`));
|
|
11186
|
-
}
|
|
11187
|
-
console.log();
|
|
11188
|
-
}
|
|
11189
|
-
}
|
|
11190
|
-
async function promptForMissingVars(missingVars, vars, deps) {
|
|
11191
|
-
for (const name of missingVars) {
|
|
11192
|
-
const value = await deps.promptText(
|
|
11193
|
-
`Enter value for var ${chalk45.cyan(name)}`,
|
|
11194
|
-
""
|
|
11195
|
-
);
|
|
11196
|
-
if (value) {
|
|
11197
|
-
vars[name] = value;
|
|
11198
|
-
}
|
|
11199
|
-
}
|
|
11200
|
-
}
|
|
11201
|
-
async function gatherConfiguration(params, deps = defaultPromptDeps) {
|
|
11202
|
-
const { required, optionVars, existingSchedule } = params;
|
|
11203
|
-
const existingSecretNames = existingSchedule?.secretNames ?? [];
|
|
11204
|
-
const existingVars = existingSchedule?.vars ?? null;
|
|
11205
|
-
const preserveExistingSecrets = await handleExistingSecrets(
|
|
11206
|
-
existingSecretNames,
|
|
11207
|
-
deps
|
|
11208
|
-
);
|
|
11209
|
-
const vars = await handleVars(optionVars, existingVars, deps);
|
|
11210
|
-
const effectiveExistingSecrets = preserveExistingSecrets ? existingSecretNames : [];
|
|
11211
|
-
const missingSecrets = required.secrets.filter(
|
|
11212
|
-
(name) => !effectiveExistingSecrets.includes(name)
|
|
11213
|
-
);
|
|
11214
|
-
const missingVars = required.vars.filter(
|
|
11215
|
-
(name) => !Object.keys(vars).includes(name)
|
|
11216
|
-
);
|
|
11217
|
-
if (missingSecrets.length === 0 && missingVars.length === 0) {
|
|
11218
|
-
return { vars, preserveExistingSecrets };
|
|
11219
|
-
}
|
|
11220
|
-
if (!deps.isInteractive()) {
|
|
11221
|
-
return { vars, preserveExistingSecrets };
|
|
11222
|
-
}
|
|
11223
|
-
displayMissingRequirements(missingSecrets, missingVars);
|
|
11224
|
-
await promptForMissingVars(missingVars, vars, deps);
|
|
11225
|
-
return { vars, preserveExistingSecrets };
|
|
11226
|
-
}
|
|
11227
|
-
|
|
11228
11221
|
// src/commands/schedule/setup.ts
|
|
11229
11222
|
var FREQUENCY_CHOICES = [
|
|
11230
11223
|
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
@@ -11273,26 +11266,6 @@ function parseDayOption(day, frequency) {
|
|
|
11273
11266
|
}
|
|
11274
11267
|
return void 0;
|
|
11275
11268
|
}
|
|
11276
|
-
function expandEnvVars(value) {
|
|
11277
|
-
return value.replace(/\$\{([^}]+)\}/g, (match, varName) => {
|
|
11278
|
-
const envValue = process.env[varName];
|
|
11279
|
-
if (envValue === void 0) {
|
|
11280
|
-
console.warn(
|
|
11281
|
-
chalk46.yellow(` Warning: Environment variable ${varName} not set`)
|
|
11282
|
-
);
|
|
11283
|
-
return match;
|
|
11284
|
-
}
|
|
11285
|
-
return envValue;
|
|
11286
|
-
});
|
|
11287
|
-
}
|
|
11288
|
-
function expandEnvVarsInObject(obj) {
|
|
11289
|
-
if (!obj) return void 0;
|
|
11290
|
-
const result = {};
|
|
11291
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
11292
|
-
result[key] = expandEnvVars(value);
|
|
11293
|
-
}
|
|
11294
|
-
return result;
|
|
11295
|
-
}
|
|
11296
11269
|
function formatInTimezone(isoDate, timezone) {
|
|
11297
11270
|
const date = new Date(isoDate);
|
|
11298
11271
|
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
@@ -11321,9 +11294,6 @@ function parseFrequencyFromCron(cron) {
|
|
|
11321
11294
|
}
|
|
11322
11295
|
return null;
|
|
11323
11296
|
}
|
|
11324
|
-
function collect(value, previous) {
|
|
11325
|
-
return previous.concat([value]);
|
|
11326
|
-
}
|
|
11327
11297
|
function getExistingDefaults(existingSchedule) {
|
|
11328
11298
|
const defaults = {};
|
|
11329
11299
|
if (existingSchedule?.cronExpression) {
|
|
@@ -11345,11 +11315,11 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
11345
11315
|
}
|
|
11346
11316
|
if (!isInteractive()) {
|
|
11347
11317
|
console.error(
|
|
11348
|
-
|
|
11318
|
+
chalk45.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
11349
11319
|
);
|
|
11350
11320
|
process.exit(1);
|
|
11351
11321
|
}
|
|
11352
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
11322
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c25) => c25.value === existingFrequency) : 0;
|
|
11353
11323
|
frequency = await promptSelect(
|
|
11354
11324
|
"Schedule frequency",
|
|
11355
11325
|
FREQUENCY_CHOICES,
|
|
@@ -11365,7 +11335,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11365
11335
|
const day2 = parseDayOption(optionDay, frequency);
|
|
11366
11336
|
if (day2 === void 0) {
|
|
11367
11337
|
console.error(
|
|
11368
|
-
|
|
11338
|
+
chalk45.red(
|
|
11369
11339
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
11370
11340
|
)
|
|
11371
11341
|
);
|
|
@@ -11374,11 +11344,11 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11374
11344
|
return day2;
|
|
11375
11345
|
}
|
|
11376
11346
|
if (!isInteractive()) {
|
|
11377
|
-
console.error(
|
|
11347
|
+
console.error(chalk45.red("\u2717 --day is required for weekly/monthly"));
|
|
11378
11348
|
process.exit(1);
|
|
11379
11349
|
}
|
|
11380
11350
|
if (frequency === "weekly") {
|
|
11381
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
11351
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c25) => c25.value === existingDay) : 0;
|
|
11382
11352
|
const day2 = await promptSelect(
|
|
11383
11353
|
"Day of week",
|
|
11384
11354
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -11393,7 +11363,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11393
11363
|
if (!dayStr) return null;
|
|
11394
11364
|
const day = parseInt(dayStr, 10);
|
|
11395
11365
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
11396
|
-
console.error(
|
|
11366
|
+
console.error(chalk45.red("\u2717 Day must be between 1 and 31"));
|
|
11397
11367
|
process.exit(1);
|
|
11398
11368
|
}
|
|
11399
11369
|
return day;
|
|
@@ -11402,13 +11372,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
11402
11372
|
if (optionTime) {
|
|
11403
11373
|
const validation = validateTimeFormat(optionTime);
|
|
11404
11374
|
if (validation !== true) {
|
|
11405
|
-
console.error(
|
|
11375
|
+
console.error(chalk45.red(`\u2717 Invalid time: ${validation}`));
|
|
11406
11376
|
process.exit(1);
|
|
11407
11377
|
}
|
|
11408
11378
|
return optionTime;
|
|
11409
11379
|
}
|
|
11410
11380
|
if (!isInteractive()) {
|
|
11411
|
-
console.error(
|
|
11381
|
+
console.error(chalk45.red("\u2717 --time is required (HH:MM format)"));
|
|
11412
11382
|
process.exit(1);
|
|
11413
11383
|
}
|
|
11414
11384
|
return await promptText(
|
|
@@ -11421,7 +11391,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11421
11391
|
if (optionDay && optionTime) {
|
|
11422
11392
|
if (!validateDateFormat(optionDay)) {
|
|
11423
11393
|
console.error(
|
|
11424
|
-
|
|
11394
|
+
chalk45.red(
|
|
11425
11395
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
11426
11396
|
)
|
|
11427
11397
|
);
|
|
@@ -11429,16 +11399,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11429
11399
|
}
|
|
11430
11400
|
if (!validateTimeFormat(optionTime)) {
|
|
11431
11401
|
console.error(
|
|
11432
|
-
|
|
11402
|
+
chalk45.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
11433
11403
|
);
|
|
11434
11404
|
process.exit(1);
|
|
11435
11405
|
}
|
|
11436
11406
|
return `${optionDay} ${optionTime}`;
|
|
11437
11407
|
}
|
|
11438
11408
|
if (!isInteractive()) {
|
|
11439
|
-
console.error(
|
|
11409
|
+
console.error(chalk45.red("\u2717 One-time schedules require interactive mode"));
|
|
11440
11410
|
console.error(
|
|
11441
|
-
|
|
11411
|
+
chalk45.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
11442
11412
|
);
|
|
11443
11413
|
process.exit(1);
|
|
11444
11414
|
}
|
|
@@ -11469,7 +11439,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
11469
11439
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
11470
11440
|
if (optionPrompt) return optionPrompt;
|
|
11471
11441
|
if (!isInteractive()) {
|
|
11472
|
-
console.error(
|
|
11442
|
+
console.error(chalk45.red("\u2717 --prompt is required"));
|
|
11473
11443
|
process.exit(1);
|
|
11474
11444
|
}
|
|
11475
11445
|
return await promptText(
|
|
@@ -11480,8 +11450,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
11480
11450
|
async function resolveAgent(agentName) {
|
|
11481
11451
|
const compose = await getComposeByName(agentName);
|
|
11482
11452
|
if (!compose) {
|
|
11483
|
-
console.error(
|
|
11484
|
-
console.error(
|
|
11453
|
+
console.error(chalk45.red(`\u2717 Agent not found: ${agentName}`));
|
|
11454
|
+
console.error(chalk45.dim(" Make sure the agent is composed first"));
|
|
11485
11455
|
process.exit(1);
|
|
11486
11456
|
}
|
|
11487
11457
|
return {
|
|
@@ -11524,11 +11494,9 @@ async function buildAndDeploy(params) {
|
|
|
11524
11494
|
params.day
|
|
11525
11495
|
);
|
|
11526
11496
|
}
|
|
11527
|
-
const expandedVars = expandEnvVarsInObject(params.vars);
|
|
11528
|
-
const expandedSecrets = expandEnvVarsInObject(params.secrets);
|
|
11529
11497
|
console.log(
|
|
11530
11498
|
`
|
|
11531
|
-
Deploying schedule for agent ${
|
|
11499
|
+
Deploying schedule for agent ${chalk45.cyan(params.agentName)}...`
|
|
11532
11500
|
);
|
|
11533
11501
|
const deployResult = await deploySchedule({
|
|
11534
11502
|
name: params.scheduleName,
|
|
@@ -11537,19 +11505,17 @@ Deploying schedule for agent ${chalk46.cyan(params.agentName)}...`
|
|
|
11537
11505
|
atTime: atTimeISO,
|
|
11538
11506
|
timezone: params.timezone,
|
|
11539
11507
|
prompt: params.prompt,
|
|
11540
|
-
vars: expandedVars,
|
|
11541
|
-
secrets: expandedSecrets,
|
|
11542
11508
|
artifactName: params.artifactName
|
|
11543
11509
|
});
|
|
11544
11510
|
return deployResult;
|
|
11545
11511
|
}
|
|
11546
11512
|
function handleSetupError(error) {
|
|
11547
|
-
console.error(
|
|
11513
|
+
console.error(chalk45.red("\u2717 Failed to setup schedule"));
|
|
11548
11514
|
if (error instanceof Error) {
|
|
11549
11515
|
if (error.message.includes("Not authenticated")) {
|
|
11550
|
-
console.error(
|
|
11516
|
+
console.error(chalk45.dim(" Run: vm0 auth login"));
|
|
11551
11517
|
} else {
|
|
11552
|
-
console.error(
|
|
11518
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11553
11519
|
}
|
|
11554
11520
|
}
|
|
11555
11521
|
process.exit(1);
|
|
@@ -11557,56 +11523,56 @@ function handleSetupError(error) {
|
|
|
11557
11523
|
function displayDeployResult(agentName, deployResult) {
|
|
11558
11524
|
if (deployResult.created) {
|
|
11559
11525
|
console.log(
|
|
11560
|
-
|
|
11526
|
+
chalk45.green(`\u2713 Created schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11561
11527
|
);
|
|
11562
11528
|
} else {
|
|
11563
11529
|
console.log(
|
|
11564
|
-
|
|
11530
|
+
chalk45.green(`\u2713 Updated schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11565
11531
|
);
|
|
11566
11532
|
}
|
|
11567
|
-
console.log(
|
|
11533
|
+
console.log(chalk45.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
11568
11534
|
if (deployResult.schedule.cronExpression) {
|
|
11569
|
-
console.log(
|
|
11535
|
+
console.log(chalk45.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
11570
11536
|
if (deployResult.schedule.nextRunAt) {
|
|
11571
11537
|
const nextRun = formatInTimezone(
|
|
11572
11538
|
deployResult.schedule.nextRunAt,
|
|
11573
11539
|
deployResult.schedule.timezone
|
|
11574
11540
|
);
|
|
11575
|
-
console.log(
|
|
11541
|
+
console.log(chalk45.dim(` Next run: ${nextRun}`));
|
|
11576
11542
|
}
|
|
11577
11543
|
} else if (deployResult.schedule.atTime) {
|
|
11578
11544
|
const atTimeFormatted = formatInTimezone(
|
|
11579
11545
|
deployResult.schedule.atTime,
|
|
11580
11546
|
deployResult.schedule.timezone
|
|
11581
11547
|
);
|
|
11582
|
-
console.log(
|
|
11548
|
+
console.log(chalk45.dim(` At: ${atTimeFormatted}`));
|
|
11583
11549
|
}
|
|
11584
11550
|
}
|
|
11585
11551
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
11586
11552
|
try {
|
|
11587
11553
|
await enableSchedule({ name: scheduleName, composeId });
|
|
11588
11554
|
console.log(
|
|
11589
|
-
|
|
11555
|
+
chalk45.green(`\u2713 Enabled schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11590
11556
|
);
|
|
11591
11557
|
} catch (error) {
|
|
11592
|
-
console.error(
|
|
11558
|
+
console.error(chalk45.yellow("\u26A0 Failed to enable schedule"));
|
|
11593
11559
|
if (error instanceof ApiRequestError) {
|
|
11594
11560
|
if (error.code === "SCHEDULE_PAST") {
|
|
11595
|
-
console.error(
|
|
11561
|
+
console.error(chalk45.dim(" Scheduled time has already passed"));
|
|
11596
11562
|
} else {
|
|
11597
|
-
console.error(
|
|
11563
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11598
11564
|
}
|
|
11599
11565
|
} else if (error instanceof Error) {
|
|
11600
|
-
console.error(
|
|
11566
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11601
11567
|
}
|
|
11602
11568
|
console.log(
|
|
11603
|
-
` To enable manually: ${
|
|
11569
|
+
` To enable manually: ${chalk45.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
11604
11570
|
);
|
|
11605
11571
|
}
|
|
11606
11572
|
}
|
|
11607
11573
|
function showEnableHint(agentName) {
|
|
11608
11574
|
console.log();
|
|
11609
|
-
console.log(` To enable: ${
|
|
11575
|
+
console.log(` To enable: ${chalk45.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
11610
11576
|
}
|
|
11611
11577
|
async function handleScheduleEnabling(params) {
|
|
11612
11578
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -11627,13 +11593,12 @@ async function handleScheduleEnabling(params) {
|
|
|
11627
11593
|
showEnableHint(agentName);
|
|
11628
11594
|
}
|
|
11629
11595
|
}
|
|
11630
|
-
var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").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("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--
|
|
11596
|
+
var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").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("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
|
|
11631
11597
|
try {
|
|
11632
|
-
const { composeId, scheduleName
|
|
11633
|
-
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
11598
|
+
const { composeId, scheduleName } = await resolveAgent(agentName);
|
|
11634
11599
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
11635
11600
|
console.log(
|
|
11636
|
-
|
|
11601
|
+
chalk45.dim(
|
|
11637
11602
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
11638
11603
|
)
|
|
11639
11604
|
);
|
|
@@ -11643,12 +11608,12 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11643
11608
|
defaults.frequency
|
|
11644
11609
|
);
|
|
11645
11610
|
if (!frequency) {
|
|
11646
|
-
console.log(
|
|
11611
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11647
11612
|
return;
|
|
11648
11613
|
}
|
|
11649
11614
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
11650
11615
|
if (!timing) {
|
|
11651
|
-
console.log(
|
|
11616
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11652
11617
|
return;
|
|
11653
11618
|
}
|
|
11654
11619
|
const { day, time, atTime } = timing;
|
|
@@ -11657,7 +11622,7 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11657
11622
|
existingSchedule?.timezone
|
|
11658
11623
|
);
|
|
11659
11624
|
if (!timezone) {
|
|
11660
|
-
console.log(
|
|
11625
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11661
11626
|
return;
|
|
11662
11627
|
}
|
|
11663
11628
|
const promptText_ = await gatherPromptText(
|
|
@@ -11665,16 +11630,9 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11665
11630
|
existingSchedule?.prompt
|
|
11666
11631
|
);
|
|
11667
11632
|
if (!promptText_) {
|
|
11668
|
-
console.log(
|
|
11633
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11669
11634
|
return;
|
|
11670
11635
|
}
|
|
11671
|
-
const config = await gatherConfiguration({
|
|
11672
|
-
required: requiredConfig,
|
|
11673
|
-
optionSecrets: [],
|
|
11674
|
-
// Secrets are no longer passed via CLI
|
|
11675
|
-
optionVars: options.var || [],
|
|
11676
|
-
existingSchedule
|
|
11677
|
-
});
|
|
11678
11636
|
const deployResult = await buildAndDeploy({
|
|
11679
11637
|
scheduleName,
|
|
11680
11638
|
composeId,
|
|
@@ -11685,9 +11643,6 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11685
11643
|
atTime,
|
|
11686
11644
|
timezone,
|
|
11687
11645
|
prompt: promptText_,
|
|
11688
|
-
vars: Object.keys(config.vars).length > 0 ? config.vars : void 0,
|
|
11689
|
-
secrets: void 0,
|
|
11690
|
-
// Secrets managed via platform, not schedule
|
|
11691
11646
|
artifactName: options.artifactName
|
|
11692
11647
|
});
|
|
11693
11648
|
displayDeployResult(agentName, deployResult);
|
|
@@ -11706,14 +11661,14 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11706
11661
|
|
|
11707
11662
|
// src/commands/schedule/list.ts
|
|
11708
11663
|
import { Command as Command46 } from "commander";
|
|
11709
|
-
import
|
|
11664
|
+
import chalk46 from "chalk";
|
|
11710
11665
|
var listCommand5 = new Command46().name("list").alias("ls").description("List all schedules").action(async () => {
|
|
11711
11666
|
try {
|
|
11712
11667
|
const result = await listSchedules();
|
|
11713
11668
|
if (result.schedules.length === 0) {
|
|
11714
|
-
console.log(
|
|
11669
|
+
console.log(chalk46.dim("No schedules found"));
|
|
11715
11670
|
console.log(
|
|
11716
|
-
|
|
11671
|
+
chalk46.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
11717
11672
|
);
|
|
11718
11673
|
return;
|
|
11719
11674
|
}
|
|
@@ -11733,10 +11688,10 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11733
11688
|
"STATUS".padEnd(8),
|
|
11734
11689
|
"NEXT RUN"
|
|
11735
11690
|
].join(" ");
|
|
11736
|
-
console.log(
|
|
11691
|
+
console.log(chalk46.dim(header));
|
|
11737
11692
|
for (const schedule of result.schedules) {
|
|
11738
11693
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
11739
|
-
const status = schedule.enabled ?
|
|
11694
|
+
const status = schedule.enabled ? chalk46.green("enabled") : chalk46.yellow("disabled");
|
|
11740
11695
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
11741
11696
|
const row = [
|
|
11742
11697
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -11748,12 +11703,12 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11748
11703
|
console.log(row);
|
|
11749
11704
|
}
|
|
11750
11705
|
} catch (error) {
|
|
11751
|
-
console.error(
|
|
11706
|
+
console.error(chalk46.red("\u2717 Failed to list schedules"));
|
|
11752
11707
|
if (error instanceof Error) {
|
|
11753
11708
|
if (error.message.includes("Not authenticated")) {
|
|
11754
|
-
console.error(
|
|
11709
|
+
console.error(chalk46.dim(" Run: vm0 auth login"));
|
|
11755
11710
|
} else {
|
|
11756
|
-
console.error(
|
|
11711
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
11757
11712
|
}
|
|
11758
11713
|
}
|
|
11759
11714
|
process.exit(1);
|
|
@@ -11762,44 +11717,44 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11762
11717
|
|
|
11763
11718
|
// src/commands/schedule/status.ts
|
|
11764
11719
|
import { Command as Command47 } from "commander";
|
|
11765
|
-
import
|
|
11720
|
+
import chalk47 from "chalk";
|
|
11766
11721
|
function formatDateTimeStyled(dateStr) {
|
|
11767
|
-
if (!dateStr) return
|
|
11722
|
+
if (!dateStr) return chalk47.dim("-");
|
|
11768
11723
|
const formatted = formatDateTime(dateStr);
|
|
11769
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
11724
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk47.dim("($1)"));
|
|
11770
11725
|
}
|
|
11771
11726
|
function formatTrigger(schedule) {
|
|
11772
11727
|
if (schedule.cronExpression) {
|
|
11773
11728
|
return schedule.cronExpression;
|
|
11774
11729
|
}
|
|
11775
11730
|
if (schedule.atTime) {
|
|
11776
|
-
return `${schedule.atTime} ${
|
|
11731
|
+
return `${schedule.atTime} ${chalk47.dim("(one-time)")}`;
|
|
11777
11732
|
}
|
|
11778
|
-
return
|
|
11733
|
+
return chalk47.dim("-");
|
|
11779
11734
|
}
|
|
11780
11735
|
function formatRunStatus2(status) {
|
|
11781
11736
|
switch (status) {
|
|
11782
11737
|
case "completed":
|
|
11783
|
-
return
|
|
11738
|
+
return chalk47.green(status);
|
|
11784
11739
|
case "failed":
|
|
11785
11740
|
case "timeout":
|
|
11786
|
-
return
|
|
11741
|
+
return chalk47.red(status);
|
|
11787
11742
|
case "running":
|
|
11788
|
-
return
|
|
11743
|
+
return chalk47.blue(status);
|
|
11789
11744
|
case "pending":
|
|
11790
|
-
return
|
|
11745
|
+
return chalk47.yellow(status);
|
|
11791
11746
|
default:
|
|
11792
11747
|
return status;
|
|
11793
11748
|
}
|
|
11794
11749
|
}
|
|
11795
11750
|
function printRunConfiguration(schedule) {
|
|
11796
|
-
const statusText = schedule.enabled ?
|
|
11751
|
+
const statusText = schedule.enabled ? chalk47.green("enabled") : chalk47.yellow("disabled");
|
|
11797
11752
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
11798
11753
|
console.log(
|
|
11799
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
11754
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk47.dim(`(${schedule.scopeSlug})`)}`
|
|
11800
11755
|
);
|
|
11801
11756
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
11802
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
11757
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk47.dim(promptPreview)}`);
|
|
11803
11758
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
11804
11759
|
console.log(
|
|
11805
11760
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -11836,7 +11791,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11836
11791
|
console.log();
|
|
11837
11792
|
console.log("Recent Runs:");
|
|
11838
11793
|
console.log(
|
|
11839
|
-
|
|
11794
|
+
chalk47.dim("RUN ID STATUS CREATED")
|
|
11840
11795
|
);
|
|
11841
11796
|
for (const run of runs) {
|
|
11842
11797
|
const id = run.id;
|
|
@@ -11847,19 +11802,19 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11847
11802
|
}
|
|
11848
11803
|
} catch {
|
|
11849
11804
|
console.log();
|
|
11850
|
-
console.log(
|
|
11805
|
+
console.log(chalk47.dim("Recent Runs: (unable to fetch)"));
|
|
11851
11806
|
}
|
|
11852
11807
|
}
|
|
11853
11808
|
function handleStatusError(error, agentName) {
|
|
11854
|
-
console.error(
|
|
11809
|
+
console.error(chalk47.red("\u2717 Failed to get schedule status"));
|
|
11855
11810
|
if (error instanceof Error) {
|
|
11856
11811
|
if (error.message.includes("Not authenticated")) {
|
|
11857
|
-
console.error(
|
|
11812
|
+
console.error(chalk47.dim(" Run: vm0 auth login"));
|
|
11858
11813
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
11859
|
-
console.error(
|
|
11860
|
-
console.error(
|
|
11814
|
+
console.error(chalk47.dim(` No schedule found for agent "${agentName}"`));
|
|
11815
|
+
console.error(chalk47.dim(" Run: vm0 schedule list"));
|
|
11861
11816
|
} else {
|
|
11862
|
-
console.error(
|
|
11817
|
+
console.error(chalk47.dim(` ${error.message}`));
|
|
11863
11818
|
}
|
|
11864
11819
|
}
|
|
11865
11820
|
process.exit(1);
|
|
@@ -11874,8 +11829,8 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
11874
11829
|
const { name, composeId } = resolved;
|
|
11875
11830
|
const schedule = await getScheduleByName({ name, composeId });
|
|
11876
11831
|
console.log();
|
|
11877
|
-
console.log(`Schedule for agent: ${
|
|
11878
|
-
console.log(
|
|
11832
|
+
console.log(`Schedule for agent: ${chalk47.cyan(agentName)}`);
|
|
11833
|
+
console.log(chalk47.dim("\u2501".repeat(50)));
|
|
11879
11834
|
printRunConfiguration(schedule);
|
|
11880
11835
|
printTimeSchedule(schedule);
|
|
11881
11836
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -11892,23 +11847,23 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
11892
11847
|
|
|
11893
11848
|
// src/commands/schedule/delete.ts
|
|
11894
11849
|
import { Command as Command48 } from "commander";
|
|
11895
|
-
import
|
|
11850
|
+
import chalk48 from "chalk";
|
|
11896
11851
|
var deleteCommand = new Command48().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
11897
11852
|
try {
|
|
11898
11853
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
11899
11854
|
if (!options.force) {
|
|
11900
11855
|
if (!isInteractive()) {
|
|
11901
11856
|
console.error(
|
|
11902
|
-
|
|
11857
|
+
chalk48.red("\u2717 --force required in non-interactive mode")
|
|
11903
11858
|
);
|
|
11904
11859
|
process.exit(1);
|
|
11905
11860
|
}
|
|
11906
11861
|
const confirmed = await promptConfirm(
|
|
11907
|
-
`Delete schedule for agent ${
|
|
11862
|
+
`Delete schedule for agent ${chalk48.cyan(agentName)}?`,
|
|
11908
11863
|
false
|
|
11909
11864
|
);
|
|
11910
11865
|
if (!confirmed) {
|
|
11911
|
-
console.log(
|
|
11866
|
+
console.log(chalk48.dim("Cancelled"));
|
|
11912
11867
|
return;
|
|
11913
11868
|
}
|
|
11914
11869
|
}
|
|
@@ -11917,20 +11872,20 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
11917
11872
|
composeId: resolved.composeId
|
|
11918
11873
|
});
|
|
11919
11874
|
console.log(
|
|
11920
|
-
|
|
11875
|
+
chalk48.green(`\u2713 Deleted schedule for agent ${chalk48.cyan(agentName)}`)
|
|
11921
11876
|
);
|
|
11922
11877
|
} catch (error) {
|
|
11923
|
-
console.error(
|
|
11878
|
+
console.error(chalk48.red("\u2717 Failed to delete schedule"));
|
|
11924
11879
|
if (error instanceof Error) {
|
|
11925
11880
|
if (error.message.includes("Not authenticated")) {
|
|
11926
|
-
console.error(
|
|
11881
|
+
console.error(chalk48.dim(" Run: vm0 auth login"));
|
|
11927
11882
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
11928
11883
|
console.error(
|
|
11929
|
-
|
|
11884
|
+
chalk48.dim(` No schedule found for agent "${agentName}"`)
|
|
11930
11885
|
);
|
|
11931
|
-
console.error(
|
|
11886
|
+
console.error(chalk48.dim(" Run: vm0 schedule list"));
|
|
11932
11887
|
} else {
|
|
11933
|
-
console.error(
|
|
11888
|
+
console.error(chalk48.dim(` ${error.message}`));
|
|
11934
11889
|
}
|
|
11935
11890
|
}
|
|
11936
11891
|
process.exit(1);
|
|
@@ -11939,7 +11894,7 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
11939
11894
|
|
|
11940
11895
|
// src/commands/schedule/enable.ts
|
|
11941
11896
|
import { Command as Command49 } from "commander";
|
|
11942
|
-
import
|
|
11897
|
+
import chalk49 from "chalk";
|
|
11943
11898
|
var enableCommand = new Command49().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
11944
11899
|
try {
|
|
11945
11900
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
@@ -11948,34 +11903,34 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
11948
11903
|
composeId: resolved.composeId
|
|
11949
11904
|
});
|
|
11950
11905
|
console.log(
|
|
11951
|
-
|
|
11906
|
+
chalk49.green(`\u2713 Enabled schedule for agent ${chalk49.cyan(agentName)}`)
|
|
11952
11907
|
);
|
|
11953
11908
|
} catch (error) {
|
|
11954
|
-
console.error(
|
|
11909
|
+
console.error(chalk49.red("\u2717 Failed to enable schedule"));
|
|
11955
11910
|
if (error instanceof ApiRequestError) {
|
|
11956
11911
|
if (error.code === "SCHEDULE_PAST") {
|
|
11957
|
-
console.error(
|
|
11958
|
-
console.error(
|
|
11912
|
+
console.error(chalk49.dim(" Scheduled time has already passed"));
|
|
11913
|
+
console.error(chalk49.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
11959
11914
|
} else if (error.code === "NOT_FOUND") {
|
|
11960
11915
|
console.error(
|
|
11961
|
-
|
|
11916
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
11962
11917
|
);
|
|
11963
|
-
console.error(
|
|
11918
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
11964
11919
|
} else if (error.code === "UNAUTHORIZED") {
|
|
11965
|
-
console.error(
|
|
11920
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
11966
11921
|
} else {
|
|
11967
|
-
console.error(
|
|
11922
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
11968
11923
|
}
|
|
11969
11924
|
} else if (error instanceof Error) {
|
|
11970
11925
|
if (error.message.includes("Not authenticated")) {
|
|
11971
|
-
console.error(
|
|
11926
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
11972
11927
|
} else if (error.message.includes("No schedule found")) {
|
|
11973
11928
|
console.error(
|
|
11974
|
-
|
|
11929
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
11975
11930
|
);
|
|
11976
|
-
console.error(
|
|
11931
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
11977
11932
|
} else {
|
|
11978
|
-
console.error(
|
|
11933
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
11979
11934
|
}
|
|
11980
11935
|
}
|
|
11981
11936
|
process.exit(1);
|
|
@@ -11984,7 +11939,7 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
11984
11939
|
|
|
11985
11940
|
// src/commands/schedule/disable.ts
|
|
11986
11941
|
import { Command as Command50 } from "commander";
|
|
11987
|
-
import
|
|
11942
|
+
import chalk50 from "chalk";
|
|
11988
11943
|
var disableCommand = new Command50().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
11989
11944
|
try {
|
|
11990
11945
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
@@ -11993,20 +11948,20 @@ var disableCommand = new Command50().name("disable").description("Disable a sche
|
|
|
11993
11948
|
composeId: resolved.composeId
|
|
11994
11949
|
});
|
|
11995
11950
|
console.log(
|
|
11996
|
-
|
|
11951
|
+
chalk50.green(`\u2713 Disabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11997
11952
|
);
|
|
11998
11953
|
} catch (error) {
|
|
11999
|
-
console.error(
|
|
11954
|
+
console.error(chalk50.red("\u2717 Failed to disable schedule"));
|
|
12000
11955
|
if (error instanceof Error) {
|
|
12001
11956
|
if (error.message.includes("Not authenticated")) {
|
|
12002
|
-
console.error(
|
|
11957
|
+
console.error(chalk50.dim(" Run: vm0 auth login"));
|
|
12003
11958
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12004
11959
|
console.error(
|
|
12005
|
-
|
|
11960
|
+
chalk50.dim(` No schedule found for agent "${agentName}"`)
|
|
12006
11961
|
);
|
|
12007
|
-
console.error(
|
|
11962
|
+
console.error(chalk50.dim(" Run: vm0 schedule list"));
|
|
12008
11963
|
} else {
|
|
12009
|
-
console.error(
|
|
11964
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
12010
11965
|
}
|
|
12011
11966
|
}
|
|
12012
11967
|
process.exit(1);
|
|
@@ -12018,7 +11973,7 @@ var scheduleCommand = new Command51().name("schedule").description("Manage agent
|
|
|
12018
11973
|
|
|
12019
11974
|
// src/commands/usage/index.ts
|
|
12020
11975
|
import { Command as Command52 } from "commander";
|
|
12021
|
-
import
|
|
11976
|
+
import chalk51 from "chalk";
|
|
12022
11977
|
|
|
12023
11978
|
// src/lib/utils/duration-formatter.ts
|
|
12024
11979
|
function formatDuration(ms) {
|
|
@@ -12105,7 +12060,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12105
12060
|
endDate = new Date(untilMs);
|
|
12106
12061
|
} catch {
|
|
12107
12062
|
console.error(
|
|
12108
|
-
|
|
12063
|
+
chalk51.red(
|
|
12109
12064
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12110
12065
|
)
|
|
12111
12066
|
);
|
|
@@ -12120,7 +12075,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12120
12075
|
startDate = new Date(sinceMs);
|
|
12121
12076
|
} catch {
|
|
12122
12077
|
console.error(
|
|
12123
|
-
|
|
12078
|
+
chalk51.red(
|
|
12124
12079
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12125
12080
|
)
|
|
12126
12081
|
);
|
|
@@ -12130,13 +12085,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12130
12085
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
12131
12086
|
}
|
|
12132
12087
|
if (startDate >= endDate) {
|
|
12133
|
-
console.error(
|
|
12088
|
+
console.error(chalk51.red("\u2717 --since must be before --until"));
|
|
12134
12089
|
process.exit(1);
|
|
12135
12090
|
}
|
|
12136
12091
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
12137
12092
|
if (rangeMs > MAX_RANGE_MS) {
|
|
12138
12093
|
console.error(
|
|
12139
|
-
|
|
12094
|
+
chalk51.red(
|
|
12140
12095
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
12141
12096
|
)
|
|
12142
12097
|
);
|
|
@@ -12153,19 +12108,19 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12153
12108
|
);
|
|
12154
12109
|
console.log();
|
|
12155
12110
|
console.log(
|
|
12156
|
-
|
|
12111
|
+
chalk51.bold(
|
|
12157
12112
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
12158
12113
|
)
|
|
12159
12114
|
);
|
|
12160
12115
|
console.log();
|
|
12161
|
-
console.log(
|
|
12116
|
+
console.log(chalk51.dim("DATE RUNS RUN TIME"));
|
|
12162
12117
|
for (const day of filledDaily) {
|
|
12163
12118
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
12164
12119
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
12165
12120
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
12166
12121
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
12167
12122
|
}
|
|
12168
|
-
console.log(
|
|
12123
|
+
console.log(chalk51.dim("\u2500".repeat(29)));
|
|
12169
12124
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
12170
12125
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
12171
12126
|
console.log(
|
|
@@ -12175,13 +12130,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12175
12130
|
} catch (error) {
|
|
12176
12131
|
if (error instanceof Error) {
|
|
12177
12132
|
if (error.message.includes("Not authenticated")) {
|
|
12178
|
-
console.error(
|
|
12179
|
-
console.error(
|
|
12133
|
+
console.error(chalk51.red("\u2717 Not authenticated"));
|
|
12134
|
+
console.error(chalk51.dim(" Run: vm0 auth login"));
|
|
12180
12135
|
} else {
|
|
12181
|
-
console.error(
|
|
12136
|
+
console.error(chalk51.red(`\u2717 ${error.message}`));
|
|
12182
12137
|
}
|
|
12183
12138
|
} else {
|
|
12184
|
-
console.error(
|
|
12139
|
+
console.error(chalk51.red("\u2717 An unexpected error occurred"));
|
|
12185
12140
|
}
|
|
12186
12141
|
process.exit(1);
|
|
12187
12142
|
}
|
|
@@ -12192,40 +12147,40 @@ import { Command as Command56 } from "commander";
|
|
|
12192
12147
|
|
|
12193
12148
|
// src/commands/secret/list.ts
|
|
12194
12149
|
import { Command as Command53 } from "commander";
|
|
12195
|
-
import
|
|
12150
|
+
import chalk52 from "chalk";
|
|
12196
12151
|
var listCommand6 = new Command53().name("list").alias("ls").description("List all secrets").action(async () => {
|
|
12197
12152
|
try {
|
|
12198
12153
|
const result = await listSecrets();
|
|
12199
12154
|
if (result.secrets.length === 0) {
|
|
12200
|
-
console.log(
|
|
12155
|
+
console.log(chalk52.dim("No secrets found"));
|
|
12201
12156
|
console.log();
|
|
12202
12157
|
console.log("To add a secret:");
|
|
12203
|
-
console.log(
|
|
12158
|
+
console.log(chalk52.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
12204
12159
|
return;
|
|
12205
12160
|
}
|
|
12206
|
-
console.log(
|
|
12161
|
+
console.log(chalk52.bold("Secrets:"));
|
|
12207
12162
|
console.log();
|
|
12208
12163
|
for (const secret of result.secrets) {
|
|
12209
|
-
const typeIndicator = secret.type === "model-provider" ?
|
|
12210
|
-
console.log(` ${
|
|
12164
|
+
const typeIndicator = secret.type === "model-provider" ? chalk52.dim(" [model-provider]") : "";
|
|
12165
|
+
console.log(` ${chalk52.cyan(secret.name)}${typeIndicator}`);
|
|
12211
12166
|
if (secret.description) {
|
|
12212
|
-
console.log(` ${
|
|
12167
|
+
console.log(` ${chalk52.dim(secret.description)}`);
|
|
12213
12168
|
}
|
|
12214
12169
|
console.log(
|
|
12215
|
-
` ${
|
|
12170
|
+
` ${chalk52.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
12216
12171
|
);
|
|
12217
12172
|
console.log();
|
|
12218
12173
|
}
|
|
12219
|
-
console.log(
|
|
12174
|
+
console.log(chalk52.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
12220
12175
|
} catch (error) {
|
|
12221
12176
|
if (error instanceof Error) {
|
|
12222
12177
|
if (error.message.includes("Not authenticated")) {
|
|
12223
|
-
console.error(
|
|
12178
|
+
console.error(chalk52.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12224
12179
|
} else {
|
|
12225
|
-
console.error(
|
|
12180
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
12226
12181
|
}
|
|
12227
12182
|
} else {
|
|
12228
|
-
console.error(
|
|
12183
|
+
console.error(chalk52.red("\u2717 An unexpected error occurred"));
|
|
12229
12184
|
}
|
|
12230
12185
|
process.exit(1);
|
|
12231
12186
|
}
|
|
@@ -12233,7 +12188,7 @@ var listCommand6 = new Command53().name("list").alias("ls").description("List al
|
|
|
12233
12188
|
|
|
12234
12189
|
// src/commands/secret/set.ts
|
|
12235
12190
|
import { Command as Command54 } from "commander";
|
|
12236
|
-
import
|
|
12191
|
+
import chalk53 from "chalk";
|
|
12237
12192
|
var setCommand2 = new Command54().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
12238
12193
|
"-b, --body <value>",
|
|
12239
12194
|
"Secret value (required in non-interactive mode)"
|
|
@@ -12251,12 +12206,12 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12251
12206
|
value = prompted;
|
|
12252
12207
|
} else {
|
|
12253
12208
|
console.error(
|
|
12254
|
-
|
|
12209
|
+
chalk53.red("\u2717 --body is required in non-interactive mode")
|
|
12255
12210
|
);
|
|
12256
12211
|
console.log();
|
|
12257
12212
|
console.log("Usage:");
|
|
12258
12213
|
console.log(
|
|
12259
|
-
|
|
12214
|
+
chalk53.cyan(` vm0 secret set ${name} --body "your-secret-value"`)
|
|
12260
12215
|
);
|
|
12261
12216
|
process.exit(1);
|
|
12262
12217
|
}
|
|
@@ -12265,29 +12220,29 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12265
12220
|
value,
|
|
12266
12221
|
description: options.description
|
|
12267
12222
|
});
|
|
12268
|
-
console.log(
|
|
12223
|
+
console.log(chalk53.green(`\u2713 Secret "${secret.name}" saved`));
|
|
12269
12224
|
console.log();
|
|
12270
12225
|
console.log("Use in vm0.yaml:");
|
|
12271
|
-
console.log(
|
|
12272
|
-
console.log(
|
|
12226
|
+
console.log(chalk53.cyan(` environment:`));
|
|
12227
|
+
console.log(chalk53.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
12273
12228
|
} catch (error) {
|
|
12274
12229
|
if (error instanceof Error) {
|
|
12275
12230
|
if (error.message.includes("Not authenticated")) {
|
|
12276
12231
|
console.error(
|
|
12277
|
-
|
|
12232
|
+
chalk53.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12278
12233
|
);
|
|
12279
12234
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12280
|
-
console.error(
|
|
12235
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12281
12236
|
console.log();
|
|
12282
12237
|
console.log("Examples of valid secret names:");
|
|
12283
|
-
console.log(
|
|
12284
|
-
console.log(
|
|
12285
|
-
console.log(
|
|
12238
|
+
console.log(chalk53.dim(" MY_API_KEY"));
|
|
12239
|
+
console.log(chalk53.dim(" GITHUB_TOKEN"));
|
|
12240
|
+
console.log(chalk53.dim(" AWS_ACCESS_KEY_ID"));
|
|
12286
12241
|
} else {
|
|
12287
|
-
console.error(
|
|
12242
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12288
12243
|
}
|
|
12289
12244
|
} else {
|
|
12290
|
-
console.error(
|
|
12245
|
+
console.error(chalk53.red("\u2717 An unexpected error occurred"));
|
|
12291
12246
|
}
|
|
12292
12247
|
process.exit(1);
|
|
12293
12248
|
}
|
|
@@ -12296,19 +12251,19 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12296
12251
|
|
|
12297
12252
|
// src/commands/secret/delete.ts
|
|
12298
12253
|
import { Command as Command55 } from "commander";
|
|
12299
|
-
import
|
|
12254
|
+
import chalk54 from "chalk";
|
|
12300
12255
|
var deleteCommand2 = new Command55().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12301
12256
|
try {
|
|
12302
12257
|
try {
|
|
12303
12258
|
await getSecret(name);
|
|
12304
12259
|
} catch {
|
|
12305
|
-
console.error(
|
|
12260
|
+
console.error(chalk54.red(`\u2717 Secret "${name}" not found`));
|
|
12306
12261
|
process.exit(1);
|
|
12307
12262
|
}
|
|
12308
12263
|
if (!options.yes) {
|
|
12309
12264
|
if (!isInteractive()) {
|
|
12310
12265
|
console.error(
|
|
12311
|
-
|
|
12266
|
+
chalk54.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12312
12267
|
);
|
|
12313
12268
|
process.exit(1);
|
|
12314
12269
|
}
|
|
@@ -12317,21 +12272,21 @@ var deleteCommand2 = new Command55().name("delete").description("Delete a secret
|
|
|
12317
12272
|
false
|
|
12318
12273
|
);
|
|
12319
12274
|
if (!confirmed) {
|
|
12320
|
-
console.log(
|
|
12275
|
+
console.log(chalk54.dim("Cancelled"));
|
|
12321
12276
|
return;
|
|
12322
12277
|
}
|
|
12323
12278
|
}
|
|
12324
12279
|
await deleteSecret(name);
|
|
12325
|
-
console.log(
|
|
12280
|
+
console.log(chalk54.green(`\u2713 Secret "${name}" deleted`));
|
|
12326
12281
|
} catch (error) {
|
|
12327
12282
|
if (error instanceof Error) {
|
|
12328
12283
|
if (error.message.includes("Not authenticated")) {
|
|
12329
|
-
console.error(
|
|
12284
|
+
console.error(chalk54.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12330
12285
|
} else {
|
|
12331
|
-
console.error(
|
|
12286
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
12332
12287
|
}
|
|
12333
12288
|
} else {
|
|
12334
|
-
console.error(
|
|
12289
|
+
console.error(chalk54.red("\u2717 An unexpected error occurred"));
|
|
12335
12290
|
}
|
|
12336
12291
|
process.exit(1);
|
|
12337
12292
|
}
|
|
@@ -12345,7 +12300,7 @@ import { Command as Command60 } from "commander";
|
|
|
12345
12300
|
|
|
12346
12301
|
// src/commands/variable/list.ts
|
|
12347
12302
|
import { Command as Command57 } from "commander";
|
|
12348
|
-
import
|
|
12303
|
+
import chalk55 from "chalk";
|
|
12349
12304
|
function truncateValue(value, maxLength = 60) {
|
|
12350
12305
|
if (value.length <= maxLength) {
|
|
12351
12306
|
return value;
|
|
@@ -12356,35 +12311,35 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
12356
12311
|
try {
|
|
12357
12312
|
const result = await listVariables();
|
|
12358
12313
|
if (result.variables.length === 0) {
|
|
12359
|
-
console.log(
|
|
12314
|
+
console.log(chalk55.dim("No variables found"));
|
|
12360
12315
|
console.log();
|
|
12361
12316
|
console.log("To add a variable:");
|
|
12362
|
-
console.log(
|
|
12317
|
+
console.log(chalk55.cyan(" vm0 variable set MY_VAR <value>"));
|
|
12363
12318
|
return;
|
|
12364
12319
|
}
|
|
12365
|
-
console.log(
|
|
12320
|
+
console.log(chalk55.bold("Variables:"));
|
|
12366
12321
|
console.log();
|
|
12367
12322
|
for (const variable of result.variables) {
|
|
12368
12323
|
const displayValue = truncateValue(variable.value);
|
|
12369
|
-
console.log(` ${
|
|
12324
|
+
console.log(` ${chalk55.cyan(variable.name)} = ${displayValue}`);
|
|
12370
12325
|
if (variable.description) {
|
|
12371
|
-
console.log(` ${
|
|
12326
|
+
console.log(` ${chalk55.dim(variable.description)}`);
|
|
12372
12327
|
}
|
|
12373
12328
|
console.log(
|
|
12374
|
-
` ${
|
|
12329
|
+
` ${chalk55.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
12375
12330
|
);
|
|
12376
12331
|
console.log();
|
|
12377
12332
|
}
|
|
12378
|
-
console.log(
|
|
12333
|
+
console.log(chalk55.dim(`Total: ${result.variables.length} variable(s)`));
|
|
12379
12334
|
} catch (error) {
|
|
12380
12335
|
if (error instanceof Error) {
|
|
12381
12336
|
if (error.message.includes("Not authenticated")) {
|
|
12382
|
-
console.error(
|
|
12337
|
+
console.error(chalk55.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12383
12338
|
} else {
|
|
12384
|
-
console.error(
|
|
12339
|
+
console.error(chalk55.red(`\u2717 ${error.message}`));
|
|
12385
12340
|
}
|
|
12386
12341
|
} else {
|
|
12387
|
-
console.error(
|
|
12342
|
+
console.error(chalk55.red("\u2717 An unexpected error occurred"));
|
|
12388
12343
|
}
|
|
12389
12344
|
process.exit(1);
|
|
12390
12345
|
}
|
|
@@ -12392,7 +12347,7 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
12392
12347
|
|
|
12393
12348
|
// src/commands/variable/set.ts
|
|
12394
12349
|
import { Command as Command58 } from "commander";
|
|
12395
|
-
import
|
|
12350
|
+
import chalk56 from "chalk";
|
|
12396
12351
|
var setCommand3 = 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(
|
|
12397
12352
|
async (name, value, options) => {
|
|
12398
12353
|
try {
|
|
@@ -12401,29 +12356,29 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12401
12356
|
value,
|
|
12402
12357
|
description: options.description
|
|
12403
12358
|
});
|
|
12404
|
-
console.log(
|
|
12359
|
+
console.log(chalk56.green(`\u2713 Variable "${variable.name}" saved`));
|
|
12405
12360
|
console.log();
|
|
12406
12361
|
console.log("Use in vm0.yaml:");
|
|
12407
|
-
console.log(
|
|
12408
|
-
console.log(
|
|
12362
|
+
console.log(chalk56.cyan(` environment:`));
|
|
12363
|
+
console.log(chalk56.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
12409
12364
|
} catch (error) {
|
|
12410
12365
|
if (error instanceof Error) {
|
|
12411
12366
|
if (error.message.includes("Not authenticated")) {
|
|
12412
12367
|
console.error(
|
|
12413
|
-
|
|
12368
|
+
chalk56.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12414
12369
|
);
|
|
12415
12370
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12416
|
-
console.error(
|
|
12371
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12417
12372
|
console.log();
|
|
12418
12373
|
console.log("Examples of valid variable names:");
|
|
12419
|
-
console.log(
|
|
12420
|
-
console.log(
|
|
12421
|
-
console.log(
|
|
12374
|
+
console.log(chalk56.dim(" MY_VAR"));
|
|
12375
|
+
console.log(chalk56.dim(" API_URL"));
|
|
12376
|
+
console.log(chalk56.dim(" DEBUG_MODE"));
|
|
12422
12377
|
} else {
|
|
12423
|
-
console.error(
|
|
12378
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12424
12379
|
}
|
|
12425
12380
|
} else {
|
|
12426
|
-
console.error(
|
|
12381
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
12427
12382
|
}
|
|
12428
12383
|
process.exit(1);
|
|
12429
12384
|
}
|
|
@@ -12432,14 +12387,14 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12432
12387
|
|
|
12433
12388
|
// src/commands/variable/delete.ts
|
|
12434
12389
|
import { Command as Command59 } from "commander";
|
|
12435
|
-
import
|
|
12390
|
+
import chalk57 from "chalk";
|
|
12436
12391
|
var deleteCommand3 = new Command59().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12437
12392
|
try {
|
|
12438
12393
|
try {
|
|
12439
12394
|
await getVariable(name);
|
|
12440
12395
|
} catch (error) {
|
|
12441
12396
|
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
12442
|
-
console.error(
|
|
12397
|
+
console.error(chalk57.red(`\u2717 Variable "${name}" not found`));
|
|
12443
12398
|
process.exit(1);
|
|
12444
12399
|
}
|
|
12445
12400
|
throw error;
|
|
@@ -12447,7 +12402,7 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12447
12402
|
if (!options.yes) {
|
|
12448
12403
|
if (!isInteractive()) {
|
|
12449
12404
|
console.error(
|
|
12450
|
-
|
|
12405
|
+
chalk57.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12451
12406
|
);
|
|
12452
12407
|
process.exit(1);
|
|
12453
12408
|
}
|
|
@@ -12456,21 +12411,21 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12456
12411
|
false
|
|
12457
12412
|
);
|
|
12458
12413
|
if (!confirmed) {
|
|
12459
|
-
console.log(
|
|
12414
|
+
console.log(chalk57.dim("Cancelled"));
|
|
12460
12415
|
return;
|
|
12461
12416
|
}
|
|
12462
12417
|
}
|
|
12463
12418
|
await deleteVariable(name);
|
|
12464
|
-
console.log(
|
|
12419
|
+
console.log(chalk57.green(`\u2713 Variable "${name}" deleted`));
|
|
12465
12420
|
} catch (error) {
|
|
12466
12421
|
if (error instanceof Error) {
|
|
12467
12422
|
if (error.message.includes("Not authenticated")) {
|
|
12468
|
-
console.error(
|
|
12423
|
+
console.error(chalk57.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12469
12424
|
} else {
|
|
12470
|
-
console.error(
|
|
12425
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
12471
12426
|
}
|
|
12472
12427
|
} else {
|
|
12473
|
-
console.error(
|
|
12428
|
+
console.error(chalk57.red("\u2717 An unexpected error occurred"));
|
|
12474
12429
|
}
|
|
12475
12430
|
process.exit(1);
|
|
12476
12431
|
}
|
|
@@ -12484,15 +12439,15 @@ import { Command as Command65 } from "commander";
|
|
|
12484
12439
|
|
|
12485
12440
|
// src/commands/model-provider/list.ts
|
|
12486
12441
|
import { Command as Command61 } from "commander";
|
|
12487
|
-
import
|
|
12442
|
+
import chalk58 from "chalk";
|
|
12488
12443
|
var listCommand8 = new Command61().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
12489
12444
|
try {
|
|
12490
12445
|
const result = await listModelProviders();
|
|
12491
12446
|
if (result.modelProviders.length === 0) {
|
|
12492
|
-
console.log(
|
|
12447
|
+
console.log(chalk58.dim("No model providers configured"));
|
|
12493
12448
|
console.log();
|
|
12494
12449
|
console.log("To add a model provider:");
|
|
12495
|
-
console.log(
|
|
12450
|
+
console.log(chalk58.cyan(" vm0 model-provider setup"));
|
|
12496
12451
|
return;
|
|
12497
12452
|
}
|
|
12498
12453
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -12506,16 +12461,16 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12506
12461
|
},
|
|
12507
12462
|
{}
|
|
12508
12463
|
);
|
|
12509
|
-
console.log(
|
|
12464
|
+
console.log(chalk58.bold("Model Providers:"));
|
|
12510
12465
|
console.log();
|
|
12511
12466
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
12512
|
-
console.log(` ${
|
|
12467
|
+
console.log(` ${chalk58.cyan(framework)}:`);
|
|
12513
12468
|
for (const provider of providers) {
|
|
12514
|
-
const defaultTag = provider.isDefault ?
|
|
12515
|
-
const modelTag = provider.selectedModel ?
|
|
12469
|
+
const defaultTag = provider.isDefault ? chalk58.green(" (default)") : "";
|
|
12470
|
+
const modelTag = provider.selectedModel ? chalk58.dim(` [${provider.selectedModel}]`) : "";
|
|
12516
12471
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
12517
12472
|
console.log(
|
|
12518
|
-
|
|
12473
|
+
chalk58.dim(
|
|
12519
12474
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
12520
12475
|
)
|
|
12521
12476
|
);
|
|
@@ -12523,17 +12478,17 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12523
12478
|
console.log();
|
|
12524
12479
|
}
|
|
12525
12480
|
console.log(
|
|
12526
|
-
|
|
12481
|
+
chalk58.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
12527
12482
|
);
|
|
12528
12483
|
} catch (error) {
|
|
12529
12484
|
if (error instanceof Error) {
|
|
12530
12485
|
if (error.message.includes("Not authenticated")) {
|
|
12531
|
-
console.error(
|
|
12486
|
+
console.error(chalk58.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12532
12487
|
} else {
|
|
12533
|
-
console.error(
|
|
12488
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
12534
12489
|
}
|
|
12535
12490
|
} else {
|
|
12536
|
-
console.error(
|
|
12491
|
+
console.error(chalk58.red("\u2717 An unexpected error occurred"));
|
|
12537
12492
|
}
|
|
12538
12493
|
process.exit(1);
|
|
12539
12494
|
}
|
|
@@ -12541,15 +12496,15 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12541
12496
|
|
|
12542
12497
|
// src/commands/model-provider/setup.ts
|
|
12543
12498
|
import { Command as Command62 } from "commander";
|
|
12544
|
-
import
|
|
12499
|
+
import chalk59 from "chalk";
|
|
12545
12500
|
import prompts2 from "prompts";
|
|
12546
12501
|
function validateProviderType(typeStr) {
|
|
12547
12502
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
12548
|
-
console.error(
|
|
12503
|
+
console.error(chalk59.red(`\u2717 Invalid type "${typeStr}"`));
|
|
12549
12504
|
console.log();
|
|
12550
12505
|
console.log("Valid types:");
|
|
12551
12506
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12552
|
-
console.log(` ${
|
|
12507
|
+
console.log(` ${chalk59.cyan(t)} - ${config.label}`);
|
|
12553
12508
|
}
|
|
12554
12509
|
process.exit(1);
|
|
12555
12510
|
}
|
|
@@ -12561,11 +12516,11 @@ function validateModel(type, modelStr) {
|
|
|
12561
12516
|
return modelStr;
|
|
12562
12517
|
}
|
|
12563
12518
|
if (models && !models.includes(modelStr)) {
|
|
12564
|
-
console.error(
|
|
12519
|
+
console.error(chalk59.red(`\u2717 Invalid model "${modelStr}"`));
|
|
12565
12520
|
console.log();
|
|
12566
12521
|
console.log("Valid models:");
|
|
12567
12522
|
for (const m of models) {
|
|
12568
|
-
console.log(` ${
|
|
12523
|
+
console.log(` ${chalk59.cyan(m)}`);
|
|
12569
12524
|
}
|
|
12570
12525
|
process.exit(1);
|
|
12571
12526
|
}
|
|
@@ -12574,12 +12529,12 @@ function validateModel(type, modelStr) {
|
|
|
12574
12529
|
function validateAuthMethod(type, authMethodStr) {
|
|
12575
12530
|
const authMethods = getAuthMethodsForType(type);
|
|
12576
12531
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
12577
|
-
console.error(
|
|
12532
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
12578
12533
|
console.log();
|
|
12579
12534
|
console.log("Valid auth methods:");
|
|
12580
12535
|
if (authMethods) {
|
|
12581
12536
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12582
|
-
console.log(` ${
|
|
12537
|
+
console.log(` ${chalk59.cyan(method)} - ${config.label}`);
|
|
12583
12538
|
}
|
|
12584
12539
|
}
|
|
12585
12540
|
process.exit(1);
|
|
@@ -12589,7 +12544,7 @@ function validateAuthMethod(type, authMethodStr) {
|
|
|
12589
12544
|
function parseSecrets(type, authMethod, secretArgs) {
|
|
12590
12545
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12591
12546
|
if (!secretsConfig) {
|
|
12592
|
-
console.error(
|
|
12547
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12593
12548
|
process.exit(1);
|
|
12594
12549
|
}
|
|
12595
12550
|
const secretNames = Object.keys(secretsConfig);
|
|
@@ -12597,19 +12552,19 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12597
12552
|
if (secretArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
12598
12553
|
if (secretNames.length !== 1) {
|
|
12599
12554
|
console.error(
|
|
12600
|
-
|
|
12555
|
+
chalk59.red("\u2717 Must use KEY=VALUE format for multi-secret auth methods")
|
|
12601
12556
|
);
|
|
12602
12557
|
console.log();
|
|
12603
12558
|
console.log("Required secrets:");
|
|
12604
12559
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12605
12560
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
12606
|
-
console.log(` ${
|
|
12561
|
+
console.log(` ${chalk59.cyan(name)}${requiredNote}`);
|
|
12607
12562
|
}
|
|
12608
12563
|
process.exit(1);
|
|
12609
12564
|
}
|
|
12610
12565
|
const firstSecretName = secretNames[0];
|
|
12611
12566
|
if (!firstSecretName) {
|
|
12612
|
-
console.error(
|
|
12567
|
+
console.error(chalk59.red("\u2717 No secrets defined for this auth method"));
|
|
12613
12568
|
process.exit(1);
|
|
12614
12569
|
}
|
|
12615
12570
|
return { [firstSecretName]: firstArg };
|
|
@@ -12618,7 +12573,7 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12618
12573
|
for (const arg of secretArgs) {
|
|
12619
12574
|
const eqIndex = arg.indexOf("=");
|
|
12620
12575
|
if (eqIndex === -1) {
|
|
12621
|
-
console.error(
|
|
12576
|
+
console.error(chalk59.red(`\u2717 Invalid secret format "${arg}"`));
|
|
12622
12577
|
console.log();
|
|
12623
12578
|
console.log("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
12624
12579
|
process.exit(1);
|
|
@@ -12632,17 +12587,17 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12632
12587
|
function validateSecrets(type, authMethod, secrets) {
|
|
12633
12588
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12634
12589
|
if (!secretsConfig) {
|
|
12635
|
-
console.error(
|
|
12590
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12636
12591
|
process.exit(1);
|
|
12637
12592
|
}
|
|
12638
12593
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12639
12594
|
if (fieldConfig.required && !secrets[name]) {
|
|
12640
|
-
console.error(
|
|
12595
|
+
console.error(chalk59.red(`\u2717 Missing required secret: ${name}`));
|
|
12641
12596
|
console.log();
|
|
12642
12597
|
console.log("Required secrets:");
|
|
12643
12598
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12644
12599
|
if (fc.required) {
|
|
12645
|
-
console.log(` ${
|
|
12600
|
+
console.log(` ${chalk59.cyan(n)} - ${fc.label}`);
|
|
12646
12601
|
}
|
|
12647
12602
|
}
|
|
12648
12603
|
process.exit(1);
|
|
@@ -12650,12 +12605,12 @@ function validateSecrets(type, authMethod, secrets) {
|
|
|
12650
12605
|
}
|
|
12651
12606
|
for (const name of Object.keys(secrets)) {
|
|
12652
12607
|
if (!(name in secretsConfig)) {
|
|
12653
|
-
console.error(
|
|
12608
|
+
console.error(chalk59.red(`\u2717 Unknown secret: ${name}`));
|
|
12654
12609
|
console.log();
|
|
12655
12610
|
console.log("Valid secrets:");
|
|
12656
12611
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12657
12612
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
12658
|
-
console.log(` ${
|
|
12613
|
+
console.log(` ${chalk59.cyan(n)}${requiredNote}`);
|
|
12659
12614
|
}
|
|
12660
12615
|
process.exit(1);
|
|
12661
12616
|
}
|
|
@@ -12678,7 +12633,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12678
12633
|
const defaultAuthMethod = getDefaultAuthMethod(type);
|
|
12679
12634
|
const authMethods = getAuthMethodsForType(type);
|
|
12680
12635
|
if (!defaultAuthMethod || !authMethods) {
|
|
12681
|
-
console.error(
|
|
12636
|
+
console.error(chalk59.red(`\u2717 Provider "${type}" requires --auth-method`));
|
|
12682
12637
|
process.exit(1);
|
|
12683
12638
|
}
|
|
12684
12639
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -12686,7 +12641,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12686
12641
|
authMethod = authMethodNames[0];
|
|
12687
12642
|
} else {
|
|
12688
12643
|
console.error(
|
|
12689
|
-
|
|
12644
|
+
chalk59.red(
|
|
12690
12645
|
`\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
|
|
12691
12646
|
)
|
|
12692
12647
|
);
|
|
@@ -12695,13 +12650,13 @@ function handleNonInteractiveMode(options) {
|
|
|
12695
12650
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12696
12651
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
12697
12652
|
console.log(
|
|
12698
|
-
` ${
|
|
12653
|
+
` ${chalk59.cyan(method)} - ${config.label}${defaultNote}`
|
|
12699
12654
|
);
|
|
12700
12655
|
}
|
|
12701
12656
|
console.log();
|
|
12702
12657
|
console.log("Example:");
|
|
12703
12658
|
console.log(
|
|
12704
|
-
|
|
12659
|
+
chalk59.cyan(
|
|
12705
12660
|
` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`
|
|
12706
12661
|
)
|
|
12707
12662
|
);
|
|
@@ -12721,7 +12676,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12721
12676
|
const secretArgs = options.secret;
|
|
12722
12677
|
const firstArg = secretArgs[0];
|
|
12723
12678
|
if (!firstArg) {
|
|
12724
|
-
console.error(
|
|
12679
|
+
console.error(chalk59.red("\u2717 Secret is required"));
|
|
12725
12680
|
process.exit(1);
|
|
12726
12681
|
}
|
|
12727
12682
|
let secret;
|
|
@@ -12770,7 +12725,7 @@ async function promptForModelSelection(type) {
|
|
|
12770
12725
|
if (selected === "__custom__") {
|
|
12771
12726
|
const placeholder = getCustomModelPlaceholder(type);
|
|
12772
12727
|
if (placeholder) {
|
|
12773
|
-
console.log(
|
|
12728
|
+
console.log(chalk59.dim(`Example: ${placeholder}`));
|
|
12774
12729
|
}
|
|
12775
12730
|
const customResponse = await prompts2(
|
|
12776
12731
|
{
|
|
@@ -12815,13 +12770,13 @@ function isSensitiveSecret(name) {
|
|
|
12815
12770
|
async function promptForSecrets(type, authMethod) {
|
|
12816
12771
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12817
12772
|
if (!secretsConfig) {
|
|
12818
|
-
console.error(
|
|
12773
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12819
12774
|
process.exit(1);
|
|
12820
12775
|
}
|
|
12821
12776
|
const secrets = {};
|
|
12822
12777
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12823
12778
|
if (fieldConfig.helpText) {
|
|
12824
|
-
console.log(
|
|
12779
|
+
console.log(chalk59.dim(fieldConfig.helpText));
|
|
12825
12780
|
}
|
|
12826
12781
|
const isSensitive = isSensitiveSecret(name);
|
|
12827
12782
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -12856,11 +12811,11 @@ async function promptForSecrets(type, authMethod) {
|
|
|
12856
12811
|
}
|
|
12857
12812
|
async function handleInteractiveMode() {
|
|
12858
12813
|
if (!isInteractive()) {
|
|
12859
|
-
console.error(
|
|
12814
|
+
console.error(chalk59.red("\u2717 Interactive mode requires a TTY"));
|
|
12860
12815
|
console.log();
|
|
12861
12816
|
console.log("Use non-interactive mode:");
|
|
12862
12817
|
console.log(
|
|
12863
|
-
|
|
12818
|
+
chalk59.cyan(' vm0 model-provider setup --type <type> --secret "<value>"')
|
|
12864
12819
|
);
|
|
12865
12820
|
process.exit(1);
|
|
12866
12821
|
}
|
|
@@ -12875,7 +12830,7 @@ async function handleInteractiveMode() {
|
|
|
12875
12830
|
title = `${title} \u2713`;
|
|
12876
12831
|
}
|
|
12877
12832
|
if (isExperimental) {
|
|
12878
|
-
title = `${title} ${
|
|
12833
|
+
title = `${title} ${chalk59.dim("(experimental)")}`;
|
|
12879
12834
|
}
|
|
12880
12835
|
return {
|
|
12881
12836
|
title,
|
|
@@ -12922,7 +12877,7 @@ async function handleInteractiveMode() {
|
|
|
12922
12877
|
}
|
|
12923
12878
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
12924
12879
|
console.log();
|
|
12925
|
-
console.log(
|
|
12880
|
+
console.log(chalk59.dim(config.helpText));
|
|
12926
12881
|
console.log();
|
|
12927
12882
|
if (hasAuthMethods(type)) {
|
|
12928
12883
|
const authMethod = await promptForAuthMethod(type);
|
|
@@ -12953,12 +12908,12 @@ async function handleInteractiveMode() {
|
|
|
12953
12908
|
function handleSetupError2(error) {
|
|
12954
12909
|
if (error instanceof Error) {
|
|
12955
12910
|
if (error.message.includes("Not authenticated")) {
|
|
12956
|
-
console.error(
|
|
12911
|
+
console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12957
12912
|
} else {
|
|
12958
|
-
console.error(
|
|
12913
|
+
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
12959
12914
|
}
|
|
12960
12915
|
} else {
|
|
12961
|
-
console.error(
|
|
12916
|
+
console.error(chalk59.red("\u2717 An unexpected error occurred"));
|
|
12962
12917
|
}
|
|
12963
12918
|
process.exit(1);
|
|
12964
12919
|
}
|
|
@@ -12975,7 +12930,7 @@ async function promptSetAsDefault(type, framework, isDefault) {
|
|
|
12975
12930
|
);
|
|
12976
12931
|
if (response.setDefault) {
|
|
12977
12932
|
await setModelProviderDefault(type);
|
|
12978
|
-
console.log(
|
|
12933
|
+
console.log(chalk59.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
12979
12934
|
}
|
|
12980
12935
|
}
|
|
12981
12936
|
function collectSecrets(value, previous) {
|
|
@@ -13002,7 +12957,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13002
12957
|
model: options.model
|
|
13003
12958
|
});
|
|
13004
12959
|
} else if (options.type || secretArgs.length > 0) {
|
|
13005
|
-
console.error(
|
|
12960
|
+
console.error(chalk59.red("\u2717 Both --type and --secret are required"));
|
|
13006
12961
|
process.exit(1);
|
|
13007
12962
|
} else {
|
|
13008
12963
|
const result = await handleInteractiveMode();
|
|
@@ -13020,11 +12975,11 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13020
12975
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
13021
12976
|
if (!hasModelSelection(input.type)) {
|
|
13022
12977
|
console.log(
|
|
13023
|
-
|
|
12978
|
+
chalk59.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
13024
12979
|
);
|
|
13025
12980
|
} else {
|
|
13026
12981
|
console.log(
|
|
13027
|
-
|
|
12982
|
+
chalk59.green(
|
|
13028
12983
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
13029
12984
|
)
|
|
13030
12985
|
);
|
|
@@ -13049,7 +13004,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13049
13004
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
13050
13005
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
13051
13006
|
console.log(
|
|
13052
|
-
|
|
13007
|
+
chalk59.green(
|
|
13053
13008
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
13054
13009
|
)
|
|
13055
13010
|
);
|
|
@@ -13068,31 +13023,31 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13068
13023
|
|
|
13069
13024
|
// src/commands/model-provider/delete.ts
|
|
13070
13025
|
import { Command as Command63 } from "commander";
|
|
13071
|
-
import
|
|
13026
|
+
import chalk60 from "chalk";
|
|
13072
13027
|
var deleteCommand4 = new Command63().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
13073
13028
|
try {
|
|
13074
13029
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
13075
|
-
console.error(
|
|
13030
|
+
console.error(chalk60.red(`\u2717 Invalid type "${type}"`));
|
|
13076
13031
|
console.log();
|
|
13077
13032
|
console.log("Valid types:");
|
|
13078
13033
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13079
|
-
console.log(` ${
|
|
13034
|
+
console.log(` ${chalk60.cyan(t)} - ${config.label}`);
|
|
13080
13035
|
}
|
|
13081
13036
|
process.exit(1);
|
|
13082
13037
|
}
|
|
13083
13038
|
await deleteModelProvider(type);
|
|
13084
|
-
console.log(
|
|
13039
|
+
console.log(chalk60.green(`\u2713 Model provider "${type}" deleted`));
|
|
13085
13040
|
} catch (error) {
|
|
13086
13041
|
if (error instanceof Error) {
|
|
13087
13042
|
if (error.message.includes("not found")) {
|
|
13088
|
-
console.error(
|
|
13043
|
+
console.error(chalk60.red(`\u2717 Model provider "${type}" not found`));
|
|
13089
13044
|
} else if (error.message.includes("Not authenticated")) {
|
|
13090
|
-
console.error(
|
|
13045
|
+
console.error(chalk60.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13091
13046
|
} else {
|
|
13092
|
-
console.error(
|
|
13047
|
+
console.error(chalk60.red(`\u2717 ${error.message}`));
|
|
13093
13048
|
}
|
|
13094
13049
|
} else {
|
|
13095
|
-
console.error(
|
|
13050
|
+
console.error(chalk60.red("\u2717 An unexpected error occurred"));
|
|
13096
13051
|
}
|
|
13097
13052
|
process.exit(1);
|
|
13098
13053
|
}
|
|
@@ -13100,35 +13055,35 @@ var deleteCommand4 = new Command63().name("delete").description("Delete a model
|
|
|
13100
13055
|
|
|
13101
13056
|
// src/commands/model-provider/set-default.ts
|
|
13102
13057
|
import { Command as Command64 } from "commander";
|
|
13103
|
-
import
|
|
13058
|
+
import chalk61 from "chalk";
|
|
13104
13059
|
var setDefaultCommand = new Command64().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type) => {
|
|
13105
13060
|
try {
|
|
13106
13061
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
13107
|
-
console.error(
|
|
13062
|
+
console.error(chalk61.red(`\u2717 Invalid type "${type}"`));
|
|
13108
13063
|
console.log();
|
|
13109
13064
|
console.log("Valid types:");
|
|
13110
13065
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13111
|
-
console.log(` ${
|
|
13066
|
+
console.log(` ${chalk61.cyan(t)} - ${config.label}`);
|
|
13112
13067
|
}
|
|
13113
13068
|
process.exit(1);
|
|
13114
13069
|
}
|
|
13115
13070
|
const provider = await setModelProviderDefault(type);
|
|
13116
13071
|
console.log(
|
|
13117
|
-
|
|
13072
|
+
chalk61.green(
|
|
13118
13073
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
13119
13074
|
)
|
|
13120
13075
|
);
|
|
13121
13076
|
} catch (error) {
|
|
13122
13077
|
if (error instanceof Error) {
|
|
13123
13078
|
if (error.message.includes("not found")) {
|
|
13124
|
-
console.error(
|
|
13079
|
+
console.error(chalk61.red(`\u2717 Model provider "${type}" not found`));
|
|
13125
13080
|
} else if (error.message.includes("Not authenticated")) {
|
|
13126
|
-
console.error(
|
|
13081
|
+
console.error(chalk61.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13127
13082
|
} else {
|
|
13128
|
-
console.error(
|
|
13083
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
13129
13084
|
}
|
|
13130
13085
|
} else {
|
|
13131
|
-
console.error(
|
|
13086
|
+
console.error(chalk61.red("\u2717 An unexpected error occurred"));
|
|
13132
13087
|
}
|
|
13133
13088
|
process.exit(1);
|
|
13134
13089
|
}
|
|
@@ -13137,8 +13092,127 @@ var setDefaultCommand = new Command64().name("set-default").description("Set a m
|
|
|
13137
13092
|
// src/commands/model-provider/index.ts
|
|
13138
13093
|
var modelProviderCommand = new Command65().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand4).addCommand(setDefaultCommand);
|
|
13139
13094
|
|
|
13140
|
-
// src/commands/
|
|
13095
|
+
// src/commands/connector/index.ts
|
|
13096
|
+
import { Command as Command67 } from "commander";
|
|
13097
|
+
|
|
13098
|
+
// src/commands/connector/connect.ts
|
|
13141
13099
|
import { Command as Command66 } from "commander";
|
|
13100
|
+
import chalk62 from "chalk";
|
|
13101
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
13102
|
+
function delay2(ms) {
|
|
13103
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13104
|
+
}
|
|
13105
|
+
async function getHeaders2() {
|
|
13106
|
+
const token = await getToken();
|
|
13107
|
+
if (!token) {
|
|
13108
|
+
throw new Error("Not authenticated. Run: vm0 auth login");
|
|
13109
|
+
}
|
|
13110
|
+
const headers = {
|
|
13111
|
+
Authorization: `Bearer ${token}`
|
|
13112
|
+
};
|
|
13113
|
+
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
13114
|
+
if (bypassSecret) {
|
|
13115
|
+
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
13116
|
+
}
|
|
13117
|
+
return headers;
|
|
13118
|
+
}
|
|
13119
|
+
var connectCommand = new Command66().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type) => {
|
|
13120
|
+
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13121
|
+
if (!parseResult.success) {
|
|
13122
|
+
console.error(chalk62.red(`Unknown connector type: ${type}`));
|
|
13123
|
+
console.error("Available connectors: github");
|
|
13124
|
+
process.exit(1);
|
|
13125
|
+
}
|
|
13126
|
+
const connectorType = parseResult.data;
|
|
13127
|
+
const apiUrl = await getApiUrl();
|
|
13128
|
+
const headers = await getHeaders2();
|
|
13129
|
+
console.log(`Connecting ${chalk62.cyan(type)}...`);
|
|
13130
|
+
const sessionsClient = initClient11(connectorSessionsContract, {
|
|
13131
|
+
baseUrl: apiUrl,
|
|
13132
|
+
baseHeaders: headers,
|
|
13133
|
+
jsonQuery: true
|
|
13134
|
+
});
|
|
13135
|
+
const createResult = await sessionsClient.create({
|
|
13136
|
+
params: { type: connectorType },
|
|
13137
|
+
body: {}
|
|
13138
|
+
});
|
|
13139
|
+
if (createResult.status !== 200) {
|
|
13140
|
+
const errorBody = createResult.body;
|
|
13141
|
+
console.error(
|
|
13142
|
+
chalk62.red(`Failed to create session: ${errorBody.error?.message}`)
|
|
13143
|
+
);
|
|
13144
|
+
process.exit(1);
|
|
13145
|
+
}
|
|
13146
|
+
const session = createResult.body;
|
|
13147
|
+
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13148
|
+
console.log(chalk62.green("\nSession created"));
|
|
13149
|
+
console.log(chalk62.cyan(`
|
|
13150
|
+
To connect, visit: ${verificationUrl}`));
|
|
13151
|
+
console.log(`Session code: ${chalk62.bold(session.code)}`);
|
|
13152
|
+
console.log(
|
|
13153
|
+
`
|
|
13154
|
+
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
13155
|
+
);
|
|
13156
|
+
console.log("\nWaiting for authorization...");
|
|
13157
|
+
const sessionClient = initClient11(connectorSessionByIdContract, {
|
|
13158
|
+
baseUrl: apiUrl,
|
|
13159
|
+
baseHeaders: headers,
|
|
13160
|
+
jsonQuery: true
|
|
13161
|
+
});
|
|
13162
|
+
const startTime = Date.now();
|
|
13163
|
+
const maxWaitTime = session.expiresIn * 1e3;
|
|
13164
|
+
const pollInterval = (session.interval || 5) * 1e3;
|
|
13165
|
+
let isFirstPoll = true;
|
|
13166
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
13167
|
+
if (!isFirstPoll) {
|
|
13168
|
+
await delay2(pollInterval);
|
|
13169
|
+
}
|
|
13170
|
+
isFirstPoll = false;
|
|
13171
|
+
const statusResult = await sessionClient.get({
|
|
13172
|
+
params: { type: connectorType, sessionId: session.id }
|
|
13173
|
+
});
|
|
13174
|
+
if (statusResult.status !== 200) {
|
|
13175
|
+
const errorBody = statusResult.body;
|
|
13176
|
+
console.error(
|
|
13177
|
+
chalk62.red(`
|
|
13178
|
+
Failed to check status: ${errorBody.error?.message}`)
|
|
13179
|
+
);
|
|
13180
|
+
process.exit(1);
|
|
13181
|
+
}
|
|
13182
|
+
const status = statusResult.body;
|
|
13183
|
+
switch (status.status) {
|
|
13184
|
+
case "complete":
|
|
13185
|
+
console.log(chalk62.green(`
|
|
13186
|
+
|
|
13187
|
+
${type} connected successfully!`));
|
|
13188
|
+
return;
|
|
13189
|
+
case "expired":
|
|
13190
|
+
console.log(chalk62.red("\nSession expired. Please try again."));
|
|
13191
|
+
process.exit(1);
|
|
13192
|
+
break;
|
|
13193
|
+
case "error":
|
|
13194
|
+
console.log(
|
|
13195
|
+
chalk62.red(
|
|
13196
|
+
`
|
|
13197
|
+
Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13198
|
+
)
|
|
13199
|
+
);
|
|
13200
|
+
process.exit(1);
|
|
13201
|
+
break;
|
|
13202
|
+
case "pending":
|
|
13203
|
+
process.stdout.write(chalk62.dim("."));
|
|
13204
|
+
break;
|
|
13205
|
+
}
|
|
13206
|
+
}
|
|
13207
|
+
console.log(chalk62.red("\nSession timed out. Please try again."));
|
|
13208
|
+
process.exit(1);
|
|
13209
|
+
});
|
|
13210
|
+
|
|
13211
|
+
// src/commands/connector/index.ts
|
|
13212
|
+
var connectorCommand = new Command67().name("connector").description("Manage third-party service connections").addCommand(connectCommand);
|
|
13213
|
+
|
|
13214
|
+
// src/commands/onboard/index.ts
|
|
13215
|
+
import { Command as Command68 } from "commander";
|
|
13142
13216
|
import chalk66 from "chalk";
|
|
13143
13217
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
13144
13218
|
import { existsSync as existsSync11 } from "fs";
|
|
@@ -13286,7 +13360,7 @@ async function exchangeToken2(apiUrl, deviceCode) {
|
|
|
13286
13360
|
});
|
|
13287
13361
|
return response.json();
|
|
13288
13362
|
}
|
|
13289
|
-
function
|
|
13363
|
+
function delay3(ms) {
|
|
13290
13364
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13291
13365
|
}
|
|
13292
13366
|
async function isAuthenticated() {
|
|
@@ -13317,7 +13391,7 @@ async function pollForToken(apiUrl, deviceAuth, callbacks) {
|
|
|
13317
13391
|
let isFirstPoll = true;
|
|
13318
13392
|
while (Date.now() - startTime < maxWaitTime) {
|
|
13319
13393
|
if (!isFirstPoll) {
|
|
13320
|
-
await
|
|
13394
|
+
await delay3(pollInterval);
|
|
13321
13395
|
}
|
|
13322
13396
|
isFirstPoll = false;
|
|
13323
13397
|
const tokenResult = await exchangeToken2(apiUrl, deviceAuth.device_code);
|
|
@@ -13561,16 +13635,16 @@ async function handleModelProvider(ctx) {
|
|
|
13561
13635
|
const providerType = await step.prompt(
|
|
13562
13636
|
() => promptSelect(
|
|
13563
13637
|
"Select provider type:",
|
|
13564
|
-
choices.map((
|
|
13565
|
-
title:
|
|
13566
|
-
value:
|
|
13638
|
+
choices.map((c25) => ({
|
|
13639
|
+
title: c25.label,
|
|
13640
|
+
value: c25.type
|
|
13567
13641
|
}))
|
|
13568
13642
|
)
|
|
13569
13643
|
);
|
|
13570
13644
|
if (!providerType) {
|
|
13571
13645
|
process.exit(0);
|
|
13572
13646
|
}
|
|
13573
|
-
const selectedChoice = choices.find((
|
|
13647
|
+
const selectedChoice = choices.find((c25) => c25.type === providerType);
|
|
13574
13648
|
if (selectedChoice?.helpText) {
|
|
13575
13649
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
13576
13650
|
step.detail(chalk66.dim(line));
|
|
@@ -13710,7 +13784,7 @@ function printNextSteps(agentName, pluginInstalled) {
|
|
|
13710
13784
|
}
|
|
13711
13785
|
console.log();
|
|
13712
13786
|
}
|
|
13713
|
-
var onboardCommand = new
|
|
13787
|
+
var onboardCommand = new Command68().name("onboard").description("Guided setup for new VM0 users").option("-y, --yes", "Skip confirmation prompts").option("--name <name>", `Agent name (default: ${DEFAULT_AGENT_NAME})`).action(async (options) => {
|
|
13714
13788
|
const interactive = isInteractive();
|
|
13715
13789
|
if (interactive) {
|
|
13716
13790
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -13733,9 +13807,9 @@ var onboardCommand = new Command66().name("onboard").description("Guided setup f
|
|
|
13733
13807
|
});
|
|
13734
13808
|
|
|
13735
13809
|
// src/commands/setup-claude/index.ts
|
|
13736
|
-
import { Command as
|
|
13810
|
+
import { Command as Command69 } from "commander";
|
|
13737
13811
|
import chalk67 from "chalk";
|
|
13738
|
-
var setupClaudeCommand = new
|
|
13812
|
+
var setupClaudeCommand = new Command69().name("setup-claude").description("Install VM0 Claude Plugin").option("--agent-dir <dir>", "Agent directory to run install in").option("--scope <scope>", "Installation scope (user or project)", "project").action(async (options) => {
|
|
13739
13813
|
console.log(chalk67.dim("Installing VM0 Claude Plugin..."));
|
|
13740
13814
|
const scope = options.scope === "user" ? "user" : "project";
|
|
13741
13815
|
try {
|
|
@@ -13757,12 +13831,12 @@ var setupClaudeCommand = new Command67().name("setup-claude").description("Insta
|
|
|
13757
13831
|
});
|
|
13758
13832
|
|
|
13759
13833
|
// src/commands/dev-tool/index.ts
|
|
13760
|
-
import { Command as
|
|
13834
|
+
import { Command as Command71 } from "commander";
|
|
13761
13835
|
|
|
13762
13836
|
// src/commands/dev-tool/compose.ts
|
|
13763
|
-
import { Command as
|
|
13837
|
+
import { Command as Command70 } from "commander";
|
|
13764
13838
|
import chalk68 from "chalk";
|
|
13765
|
-
import { initClient as
|
|
13839
|
+
import { initClient as initClient12 } from "@ts-rest/core";
|
|
13766
13840
|
function sleep2(ms) {
|
|
13767
13841
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13768
13842
|
}
|
|
@@ -13771,7 +13845,7 @@ function timestamp() {
|
|
|
13771
13845
|
}
|
|
13772
13846
|
async function createComposeJob(githubUrl, overwrite) {
|
|
13773
13847
|
const config = await getClientConfig();
|
|
13774
|
-
const client =
|
|
13848
|
+
const client = initClient12(composeJobsMainContract, config);
|
|
13775
13849
|
const result = await client.create({
|
|
13776
13850
|
body: { githubUrl, overwrite }
|
|
13777
13851
|
});
|
|
@@ -13788,7 +13862,7 @@ async function createComposeJob(githubUrl, overwrite) {
|
|
|
13788
13862
|
}
|
|
13789
13863
|
async function getComposeJobStatus(jobId) {
|
|
13790
13864
|
const config = await getClientConfig();
|
|
13791
|
-
const client =
|
|
13865
|
+
const client = initClient12(composeJobsByIdContract, config);
|
|
13792
13866
|
const result = await client.getById({
|
|
13793
13867
|
params: { jobId }
|
|
13794
13868
|
});
|
|
@@ -13823,7 +13897,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
13823
13897
|
}
|
|
13824
13898
|
throw new Error(`Timeout after ${timeoutMs / 1e3} seconds`);
|
|
13825
13899
|
}
|
|
13826
|
-
var composeCommand2 = new
|
|
13900
|
+
var composeCommand2 = new Command70().name("compose").description("Test server-side GitHub compose API").argument("<github-url>", "GitHub URL to compose from").option("--overwrite", "Overwrite existing compose", false).option(
|
|
13827
13901
|
"--interval <seconds>",
|
|
13828
13902
|
"Polling interval in seconds",
|
|
13829
13903
|
(v) => parseInt(v, 10),
|
|
@@ -13913,11 +13987,11 @@ function displayResult(job) {
|
|
|
13913
13987
|
}
|
|
13914
13988
|
|
|
13915
13989
|
// src/commands/dev-tool/index.ts
|
|
13916
|
-
var devToolCommand = new
|
|
13990
|
+
var devToolCommand = new Command71().name("dev-tool").description("Developer tools for testing and debugging").addCommand(composeCommand2);
|
|
13917
13991
|
|
|
13918
13992
|
// src/index.ts
|
|
13919
|
-
var program = new
|
|
13920
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
13993
|
+
var program = new Command72();
|
|
13994
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.24.1");
|
|
13921
13995
|
program.addCommand(authCommand);
|
|
13922
13996
|
program.addCommand(infoCommand);
|
|
13923
13997
|
program.addCommand(composeCommand);
|
|
@@ -13934,6 +14008,7 @@ program.addCommand(usageCommand);
|
|
|
13934
14008
|
program.addCommand(secretCommand);
|
|
13935
14009
|
program.addCommand(variableCommand);
|
|
13936
14010
|
program.addCommand(modelProviderCommand);
|
|
14011
|
+
program.addCommand(connectorCommand);
|
|
13937
14012
|
program.addCommand(onboardCommand);
|
|
13938
14013
|
program.addCommand(setupClaudeCommand);
|
|
13939
14014
|
program.addCommand(devToolCommand, { hidden: true });
|