@vm0/cli 9.22.0 → 9.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +744 -238
- 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.0",
|
|
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";
|
|
@@ -3138,29 +3138,255 @@ var llmChatContract = c18.router({
|
|
|
3138
3138
|
}
|
|
3139
3139
|
});
|
|
3140
3140
|
|
|
3141
|
-
// ../../packages/core/src/contracts/
|
|
3141
|
+
// ../../packages/core/src/contracts/compose-jobs.ts
|
|
3142
3142
|
import { z as z23 } from "zod";
|
|
3143
3143
|
var c19 = initContract();
|
|
3144
|
-
var
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3144
|
+
var composeJobStatusSchema = z23.enum([
|
|
3145
|
+
"pending",
|
|
3146
|
+
"running",
|
|
3147
|
+
"completed",
|
|
3148
|
+
"failed"
|
|
3149
|
+
]);
|
|
3150
|
+
var composeJobResultSchema = z23.object({
|
|
3151
|
+
composeId: z23.string(),
|
|
3152
|
+
composeName: z23.string(),
|
|
3153
|
+
versionId: z23.string(),
|
|
3154
|
+
warnings: z23.array(z23.string())
|
|
3155
|
+
});
|
|
3156
|
+
var createComposeJobRequestSchema = z23.object({
|
|
3157
|
+
githubUrl: z23.string().url().startsWith("https://github.com/"),
|
|
3158
|
+
overwrite: z23.boolean().optional().default(false)
|
|
3159
|
+
});
|
|
3160
|
+
var composeJobResponseSchema = z23.object({
|
|
3161
|
+
jobId: z23.string(),
|
|
3162
|
+
status: composeJobStatusSchema,
|
|
3163
|
+
githubUrl: z23.string(),
|
|
3164
|
+
result: composeJobResultSchema.optional(),
|
|
3165
|
+
error: z23.string().optional(),
|
|
3166
|
+
createdAt: z23.string(),
|
|
3167
|
+
startedAt: z23.string().optional(),
|
|
3168
|
+
completedAt: z23.string().optional()
|
|
3169
|
+
});
|
|
3170
|
+
var composeJobsMainContract = c19.router({
|
|
3171
|
+
/**
|
|
3172
|
+
* POST /api/compose/from-github
|
|
3173
|
+
* Create a new compose job from GitHub URL
|
|
3174
|
+
*/
|
|
3175
|
+
create: {
|
|
3176
|
+
method: "POST",
|
|
3177
|
+
path: "/api/compose/from-github",
|
|
3178
|
+
headers: authHeadersSchema,
|
|
3179
|
+
body: createComposeJobRequestSchema,
|
|
3180
|
+
responses: {
|
|
3181
|
+
201: composeJobResponseSchema,
|
|
3182
|
+
200: composeJobResponseSchema,
|
|
3183
|
+
// Returned when existing job found (idempotency)
|
|
3184
|
+
400: apiErrorSchema,
|
|
3185
|
+
401: apiErrorSchema
|
|
3186
|
+
},
|
|
3187
|
+
summary: "Create compose job from GitHub URL"
|
|
3188
|
+
}
|
|
3189
|
+
});
|
|
3190
|
+
var composeJobsByIdContract = c19.router({
|
|
3191
|
+
/**
|
|
3192
|
+
* GET /api/compose/from-github/:jobId
|
|
3193
|
+
* Get compose job status and result
|
|
3194
|
+
*/
|
|
3195
|
+
getById: {
|
|
3196
|
+
method: "GET",
|
|
3197
|
+
path: "/api/compose/from-github/:jobId",
|
|
3198
|
+
headers: authHeadersSchema,
|
|
3199
|
+
pathParams: z23.object({
|
|
3200
|
+
jobId: z23.string().uuid()
|
|
3201
|
+
}),
|
|
3202
|
+
responses: {
|
|
3203
|
+
200: composeJobResponseSchema,
|
|
3204
|
+
401: apiErrorSchema,
|
|
3205
|
+
404: apiErrorSchema
|
|
3206
|
+
},
|
|
3207
|
+
summary: "Get compose job status"
|
|
3208
|
+
}
|
|
3209
|
+
});
|
|
3210
|
+
var webhookComposeCompleteContract = c19.router({
|
|
3211
|
+
/**
|
|
3212
|
+
* POST /api/webhooks/compose/complete
|
|
3213
|
+
* Handle compose job completion from sandbox
|
|
3214
|
+
*/
|
|
3215
|
+
complete: {
|
|
3216
|
+
method: "POST",
|
|
3217
|
+
path: "/api/webhooks/compose/complete",
|
|
3218
|
+
headers: authHeadersSchema,
|
|
3219
|
+
body: z23.object({
|
|
3220
|
+
jobId: z23.string().uuid(),
|
|
3221
|
+
success: z23.boolean(),
|
|
3222
|
+
// Result from CLI compose command
|
|
3223
|
+
result: composeJobResultSchema.optional(),
|
|
3224
|
+
error: z23.string().optional()
|
|
3225
|
+
}),
|
|
3226
|
+
responses: {
|
|
3227
|
+
200: z23.object({
|
|
3228
|
+
success: z23.boolean()
|
|
3229
|
+
}),
|
|
3230
|
+
400: apiErrorSchema,
|
|
3231
|
+
401: apiErrorSchema,
|
|
3232
|
+
404: apiErrorSchema
|
|
3233
|
+
},
|
|
3234
|
+
summary: "Handle compose job completion"
|
|
3235
|
+
}
|
|
3236
|
+
});
|
|
3237
|
+
|
|
3238
|
+
// ../../packages/core/src/contracts/connectors.ts
|
|
3239
|
+
import { z as z24 } from "zod";
|
|
3240
|
+
var c20 = initContract();
|
|
3241
|
+
var connectorTypeSchema = z24.enum(["github"]);
|
|
3242
|
+
var connectorResponseSchema = z24.object({
|
|
3243
|
+
id: z24.string().uuid(),
|
|
3244
|
+
type: connectorTypeSchema,
|
|
3245
|
+
authMethod: z24.string(),
|
|
3246
|
+
externalId: z24.string().nullable(),
|
|
3247
|
+
externalUsername: z24.string().nullable(),
|
|
3248
|
+
externalEmail: z24.string().nullable(),
|
|
3249
|
+
oauthScopes: z24.array(z24.string()).nullable(),
|
|
3250
|
+
createdAt: z24.string(),
|
|
3251
|
+
updatedAt: z24.string()
|
|
3252
|
+
});
|
|
3253
|
+
var connectorListResponseSchema = z24.object({
|
|
3254
|
+
connectors: z24.array(connectorResponseSchema)
|
|
3255
|
+
});
|
|
3256
|
+
var connectorsMainContract = c20.router({
|
|
3257
|
+
list: {
|
|
3258
|
+
method: "GET",
|
|
3259
|
+
path: "/api/connectors",
|
|
3260
|
+
headers: authHeadersSchema,
|
|
3261
|
+
responses: {
|
|
3262
|
+
200: connectorListResponseSchema,
|
|
3263
|
+
401: apiErrorSchema,
|
|
3264
|
+
500: apiErrorSchema
|
|
3265
|
+
},
|
|
3266
|
+
summary: "List all connectors for the authenticated user"
|
|
3267
|
+
}
|
|
3268
|
+
});
|
|
3269
|
+
var connectorsByTypeContract = c20.router({
|
|
3270
|
+
get: {
|
|
3271
|
+
method: "GET",
|
|
3272
|
+
path: "/api/connectors/:type",
|
|
3273
|
+
headers: authHeadersSchema,
|
|
3274
|
+
pathParams: z24.object({
|
|
3275
|
+
type: connectorTypeSchema
|
|
3276
|
+
}),
|
|
3277
|
+
responses: {
|
|
3278
|
+
200: connectorResponseSchema,
|
|
3279
|
+
401: apiErrorSchema,
|
|
3280
|
+
404: apiErrorSchema,
|
|
3281
|
+
500: apiErrorSchema
|
|
3282
|
+
},
|
|
3283
|
+
summary: "Get connector status by type"
|
|
3284
|
+
},
|
|
3285
|
+
delete: {
|
|
3286
|
+
method: "DELETE",
|
|
3287
|
+
path: "/api/connectors/:type",
|
|
3288
|
+
headers: authHeadersSchema,
|
|
3289
|
+
pathParams: z24.object({
|
|
3290
|
+
type: connectorTypeSchema
|
|
3291
|
+
}),
|
|
3292
|
+
responses: {
|
|
3293
|
+
204: c20.noBody(),
|
|
3294
|
+
401: apiErrorSchema,
|
|
3295
|
+
404: apiErrorSchema,
|
|
3296
|
+
500: apiErrorSchema
|
|
3297
|
+
},
|
|
3298
|
+
summary: "Disconnect a connector"
|
|
3299
|
+
}
|
|
3300
|
+
});
|
|
3301
|
+
var connectorSessionStatusSchema = z24.enum([
|
|
3302
|
+
"pending",
|
|
3303
|
+
"complete",
|
|
3304
|
+
"expired",
|
|
3305
|
+
"error"
|
|
3306
|
+
]);
|
|
3307
|
+
var connectorSessionResponseSchema = z24.object({
|
|
3308
|
+
id: z24.string().uuid(),
|
|
3309
|
+
code: z24.string(),
|
|
3310
|
+
type: connectorTypeSchema,
|
|
3311
|
+
status: connectorSessionStatusSchema,
|
|
3312
|
+
verificationUrl: z24.string(),
|
|
3313
|
+
expiresIn: z24.number(),
|
|
3314
|
+
interval: z24.number(),
|
|
3315
|
+
errorMessage: z24.string().nullable().optional()
|
|
3316
|
+
});
|
|
3317
|
+
var connectorSessionStatusResponseSchema = z24.object({
|
|
3318
|
+
status: connectorSessionStatusSchema,
|
|
3319
|
+
errorMessage: z24.string().nullable().optional()
|
|
3320
|
+
});
|
|
3321
|
+
var connectorSessionsContract = c20.router({
|
|
3322
|
+
/**
|
|
3323
|
+
* POST /api/connectors/:type/sessions
|
|
3324
|
+
* Create a new connector session for CLI device flow
|
|
3325
|
+
*/
|
|
3326
|
+
create: {
|
|
3327
|
+
method: "POST",
|
|
3328
|
+
path: "/api/connectors/:type/sessions",
|
|
3329
|
+
headers: authHeadersSchema,
|
|
3330
|
+
pathParams: z24.object({
|
|
3331
|
+
type: connectorTypeSchema
|
|
3332
|
+
}),
|
|
3333
|
+
body: z24.object({}).optional(),
|
|
3334
|
+
responses: {
|
|
3335
|
+
200: connectorSessionResponseSchema,
|
|
3336
|
+
400: apiErrorSchema,
|
|
3337
|
+
401: apiErrorSchema,
|
|
3338
|
+
500: apiErrorSchema
|
|
3339
|
+
},
|
|
3340
|
+
summary: "Create connector session for CLI device flow"
|
|
3341
|
+
}
|
|
3342
|
+
});
|
|
3343
|
+
var connectorSessionByIdContract = c20.router({
|
|
3344
|
+
/**
|
|
3345
|
+
* GET /api/connectors/:type/sessions/:sessionId
|
|
3346
|
+
* Get connector session status (for CLI polling)
|
|
3347
|
+
*/
|
|
3348
|
+
get: {
|
|
3349
|
+
method: "GET",
|
|
3350
|
+
path: "/api/connectors/:type/sessions/:sessionId",
|
|
3351
|
+
headers: authHeadersSchema,
|
|
3352
|
+
pathParams: z24.object({
|
|
3353
|
+
type: connectorTypeSchema,
|
|
3354
|
+
sessionId: z24.string().uuid()
|
|
3355
|
+
}),
|
|
3356
|
+
responses: {
|
|
3357
|
+
200: connectorSessionStatusResponseSchema,
|
|
3358
|
+
400: apiErrorSchema,
|
|
3359
|
+
401: apiErrorSchema,
|
|
3360
|
+
404: apiErrorSchema,
|
|
3361
|
+
500: apiErrorSchema
|
|
3362
|
+
},
|
|
3363
|
+
summary: "Get connector session status"
|
|
3364
|
+
}
|
|
3365
|
+
});
|
|
3366
|
+
|
|
3367
|
+
// ../../packages/core/src/contracts/public/agents.ts
|
|
3368
|
+
import { z as z25 } from "zod";
|
|
3369
|
+
var c21 = initContract();
|
|
3370
|
+
var publicAgentSchema = z25.object({
|
|
3371
|
+
id: z25.string(),
|
|
3372
|
+
name: z25.string(),
|
|
3373
|
+
currentVersionId: z25.string().nullable(),
|
|
3148
3374
|
createdAt: timestampSchema,
|
|
3149
3375
|
updatedAt: timestampSchema
|
|
3150
3376
|
});
|
|
3151
|
-
var agentVersionSchema =
|
|
3152
|
-
id:
|
|
3153
|
-
agentId:
|
|
3154
|
-
versionNumber:
|
|
3377
|
+
var agentVersionSchema = z25.object({
|
|
3378
|
+
id: z25.string(),
|
|
3379
|
+
agentId: z25.string(),
|
|
3380
|
+
versionNumber: z25.number(),
|
|
3155
3381
|
createdAt: timestampSchema
|
|
3156
3382
|
});
|
|
3157
3383
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
3158
3384
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
3159
3385
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
3160
3386
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
3161
|
-
name:
|
|
3387
|
+
name: z25.string().optional()
|
|
3162
3388
|
});
|
|
3163
|
-
var publicAgentsListContract =
|
|
3389
|
+
var publicAgentsListContract = c21.router({
|
|
3164
3390
|
list: {
|
|
3165
3391
|
method: "GET",
|
|
3166
3392
|
path: "/v1/agents",
|
|
@@ -3175,13 +3401,13 @@ var publicAgentsListContract = c19.router({
|
|
|
3175
3401
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
3176
3402
|
}
|
|
3177
3403
|
});
|
|
3178
|
-
var publicAgentByIdContract =
|
|
3404
|
+
var publicAgentByIdContract = c21.router({
|
|
3179
3405
|
get: {
|
|
3180
3406
|
method: "GET",
|
|
3181
3407
|
path: "/v1/agents/:id",
|
|
3182
3408
|
headers: authHeadersSchema,
|
|
3183
|
-
pathParams:
|
|
3184
|
-
id:
|
|
3409
|
+
pathParams: z25.object({
|
|
3410
|
+
id: z25.string().min(1, "Agent ID is required")
|
|
3185
3411
|
}),
|
|
3186
3412
|
responses: {
|
|
3187
3413
|
200: publicAgentDetailSchema,
|
|
@@ -3193,13 +3419,13 @@ var publicAgentByIdContract = c19.router({
|
|
|
3193
3419
|
description: "Get agent details by ID"
|
|
3194
3420
|
}
|
|
3195
3421
|
});
|
|
3196
|
-
var publicAgentVersionsContract =
|
|
3422
|
+
var publicAgentVersionsContract = c21.router({
|
|
3197
3423
|
list: {
|
|
3198
3424
|
method: "GET",
|
|
3199
3425
|
path: "/v1/agents/:id/versions",
|
|
3200
3426
|
headers: authHeadersSchema,
|
|
3201
|
-
pathParams:
|
|
3202
|
-
id:
|
|
3427
|
+
pathParams: z25.object({
|
|
3428
|
+
id: z25.string().min(1, "Agent ID is required")
|
|
3203
3429
|
}),
|
|
3204
3430
|
query: listQuerySchema,
|
|
3205
3431
|
responses: {
|
|
@@ -3214,9 +3440,9 @@ var publicAgentVersionsContract = c19.router({
|
|
|
3214
3440
|
});
|
|
3215
3441
|
|
|
3216
3442
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
3217
|
-
import { z as
|
|
3218
|
-
var
|
|
3219
|
-
var publicRunStatusSchema =
|
|
3443
|
+
import { z as z26 } from "zod";
|
|
3444
|
+
var c22 = initContract();
|
|
3445
|
+
var publicRunStatusSchema = z26.enum([
|
|
3220
3446
|
"pending",
|
|
3221
3447
|
"running",
|
|
3222
3448
|
"completed",
|
|
@@ -3224,54 +3450,54 @@ var publicRunStatusSchema = z24.enum([
|
|
|
3224
3450
|
"timeout",
|
|
3225
3451
|
"cancelled"
|
|
3226
3452
|
]);
|
|
3227
|
-
var publicRunSchema =
|
|
3228
|
-
id:
|
|
3229
|
-
agentId:
|
|
3230
|
-
agentName:
|
|
3453
|
+
var publicRunSchema = z26.object({
|
|
3454
|
+
id: z26.string(),
|
|
3455
|
+
agentId: z26.string(),
|
|
3456
|
+
agentName: z26.string(),
|
|
3231
3457
|
status: publicRunStatusSchema,
|
|
3232
|
-
prompt:
|
|
3458
|
+
prompt: z26.string(),
|
|
3233
3459
|
createdAt: timestampSchema,
|
|
3234
3460
|
startedAt: timestampSchema.nullable(),
|
|
3235
3461
|
completedAt: timestampSchema.nullable()
|
|
3236
3462
|
});
|
|
3237
3463
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
3238
|
-
error:
|
|
3239
|
-
executionTimeMs:
|
|
3240
|
-
checkpointId:
|
|
3241
|
-
sessionId:
|
|
3242
|
-
artifactName:
|
|
3243
|
-
artifactVersion:
|
|
3244
|
-
volumes:
|
|
3464
|
+
error: z26.string().nullable(),
|
|
3465
|
+
executionTimeMs: z26.number().nullable(),
|
|
3466
|
+
checkpointId: z26.string().nullable(),
|
|
3467
|
+
sessionId: z26.string().nullable(),
|
|
3468
|
+
artifactName: z26.string().nullable(),
|
|
3469
|
+
artifactVersion: z26.string().nullable(),
|
|
3470
|
+
volumes: z26.record(z26.string(), z26.string()).optional()
|
|
3245
3471
|
});
|
|
3246
3472
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
3247
|
-
var createRunRequestSchema =
|
|
3473
|
+
var createRunRequestSchema = z26.object({
|
|
3248
3474
|
// Agent identification (one of: agent, agentId, sessionId, checkpointId)
|
|
3249
|
-
agent:
|
|
3475
|
+
agent: z26.string().optional(),
|
|
3250
3476
|
// Agent name
|
|
3251
|
-
agentId:
|
|
3477
|
+
agentId: z26.string().optional(),
|
|
3252
3478
|
// Agent ID
|
|
3253
|
-
agentVersion:
|
|
3479
|
+
agentVersion: z26.string().optional(),
|
|
3254
3480
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
3255
3481
|
// Continue session
|
|
3256
|
-
sessionId:
|
|
3482
|
+
sessionId: z26.string().optional(),
|
|
3257
3483
|
// Resume from checkpoint
|
|
3258
|
-
checkpointId:
|
|
3484
|
+
checkpointId: z26.string().optional(),
|
|
3259
3485
|
// Required
|
|
3260
|
-
prompt:
|
|
3486
|
+
prompt: z26.string().min(1, "Prompt is required"),
|
|
3261
3487
|
// Optional configuration
|
|
3262
|
-
variables:
|
|
3263
|
-
secrets:
|
|
3264
|
-
artifactName:
|
|
3488
|
+
variables: z26.record(z26.string(), z26.string()).optional(),
|
|
3489
|
+
secrets: z26.record(z26.string(), z26.string()).optional(),
|
|
3490
|
+
artifactName: z26.string().optional(),
|
|
3265
3491
|
// Artifact name to mount
|
|
3266
|
-
artifactVersion:
|
|
3492
|
+
artifactVersion: z26.string().optional(),
|
|
3267
3493
|
// Artifact version (defaults to latest)
|
|
3268
|
-
volumes:
|
|
3494
|
+
volumes: z26.record(z26.string(), z26.string()).optional()
|
|
3269
3495
|
// volume_name -> version
|
|
3270
3496
|
});
|
|
3271
3497
|
var runListQuerySchema = listQuerySchema.extend({
|
|
3272
3498
|
status: publicRunStatusSchema.optional()
|
|
3273
3499
|
});
|
|
3274
|
-
var publicRunsListContract =
|
|
3500
|
+
var publicRunsListContract = c22.router({
|
|
3275
3501
|
list: {
|
|
3276
3502
|
method: "GET",
|
|
3277
3503
|
path: "/v1/runs",
|
|
@@ -3303,13 +3529,13 @@ var publicRunsListContract = c20.router({
|
|
|
3303
3529
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
3304
3530
|
}
|
|
3305
3531
|
});
|
|
3306
|
-
var publicRunByIdContract =
|
|
3532
|
+
var publicRunByIdContract = c22.router({
|
|
3307
3533
|
get: {
|
|
3308
3534
|
method: "GET",
|
|
3309
3535
|
path: "/v1/runs/:id",
|
|
3310
3536
|
headers: authHeadersSchema,
|
|
3311
|
-
pathParams:
|
|
3312
|
-
id:
|
|
3537
|
+
pathParams: z26.object({
|
|
3538
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3313
3539
|
}),
|
|
3314
3540
|
responses: {
|
|
3315
3541
|
200: publicRunDetailSchema,
|
|
@@ -3321,15 +3547,15 @@ var publicRunByIdContract = c20.router({
|
|
|
3321
3547
|
description: "Get run details by ID"
|
|
3322
3548
|
}
|
|
3323
3549
|
});
|
|
3324
|
-
var publicRunCancelContract =
|
|
3550
|
+
var publicRunCancelContract = c22.router({
|
|
3325
3551
|
cancel: {
|
|
3326
3552
|
method: "POST",
|
|
3327
3553
|
path: "/v1/runs/:id/cancel",
|
|
3328
3554
|
headers: authHeadersSchema,
|
|
3329
|
-
pathParams:
|
|
3330
|
-
id:
|
|
3555
|
+
pathParams: z26.object({
|
|
3556
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3331
3557
|
}),
|
|
3332
|
-
body:
|
|
3558
|
+
body: z26.undefined(),
|
|
3333
3559
|
responses: {
|
|
3334
3560
|
200: publicRunDetailSchema,
|
|
3335
3561
|
400: publicApiErrorSchema,
|
|
@@ -3342,27 +3568,27 @@ var publicRunCancelContract = c20.router({
|
|
|
3342
3568
|
description: "Cancel a pending or running execution"
|
|
3343
3569
|
}
|
|
3344
3570
|
});
|
|
3345
|
-
var logEntrySchema =
|
|
3571
|
+
var logEntrySchema = z26.object({
|
|
3346
3572
|
timestamp: timestampSchema,
|
|
3347
|
-
type:
|
|
3348
|
-
level:
|
|
3349
|
-
message:
|
|
3350
|
-
metadata:
|
|
3573
|
+
type: z26.enum(["agent", "system", "network"]),
|
|
3574
|
+
level: z26.enum(["debug", "info", "warn", "error"]),
|
|
3575
|
+
message: z26.string(),
|
|
3576
|
+
metadata: z26.record(z26.string(), z26.unknown()).optional()
|
|
3351
3577
|
});
|
|
3352
3578
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
3353
3579
|
var logsQuerySchema = listQuerySchema.extend({
|
|
3354
|
-
type:
|
|
3580
|
+
type: z26.enum(["agent", "system", "network", "all"]).default("all"),
|
|
3355
3581
|
since: timestampSchema.optional(),
|
|
3356
3582
|
until: timestampSchema.optional(),
|
|
3357
|
-
order:
|
|
3583
|
+
order: z26.enum(["asc", "desc"]).default("asc")
|
|
3358
3584
|
});
|
|
3359
|
-
var publicRunLogsContract =
|
|
3585
|
+
var publicRunLogsContract = c22.router({
|
|
3360
3586
|
getLogs: {
|
|
3361
3587
|
method: "GET",
|
|
3362
3588
|
path: "/v1/runs/:id/logs",
|
|
3363
3589
|
headers: authHeadersSchema,
|
|
3364
|
-
pathParams:
|
|
3365
|
-
id:
|
|
3590
|
+
pathParams: z26.object({
|
|
3591
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3366
3592
|
}),
|
|
3367
3593
|
query: logsQuerySchema,
|
|
3368
3594
|
responses: {
|
|
@@ -3375,30 +3601,30 @@ var publicRunLogsContract = c20.router({
|
|
|
3375
3601
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
3376
3602
|
}
|
|
3377
3603
|
});
|
|
3378
|
-
var metricPointSchema =
|
|
3604
|
+
var metricPointSchema = z26.object({
|
|
3379
3605
|
timestamp: timestampSchema,
|
|
3380
|
-
cpuPercent:
|
|
3381
|
-
memoryUsedMb:
|
|
3382
|
-
memoryTotalMb:
|
|
3383
|
-
diskUsedMb:
|
|
3384
|
-
diskTotalMb:
|
|
3385
|
-
});
|
|
3386
|
-
var metricsSummarySchema =
|
|
3387
|
-
avgCpuPercent:
|
|
3388
|
-
maxMemoryUsedMb:
|
|
3389
|
-
totalDurationMs:
|
|
3390
|
-
});
|
|
3391
|
-
var metricsResponseSchema2 =
|
|
3392
|
-
data:
|
|
3606
|
+
cpuPercent: z26.number(),
|
|
3607
|
+
memoryUsedMb: z26.number(),
|
|
3608
|
+
memoryTotalMb: z26.number(),
|
|
3609
|
+
diskUsedMb: z26.number(),
|
|
3610
|
+
diskTotalMb: z26.number()
|
|
3611
|
+
});
|
|
3612
|
+
var metricsSummarySchema = z26.object({
|
|
3613
|
+
avgCpuPercent: z26.number(),
|
|
3614
|
+
maxMemoryUsedMb: z26.number(),
|
|
3615
|
+
totalDurationMs: z26.number().nullable()
|
|
3616
|
+
});
|
|
3617
|
+
var metricsResponseSchema2 = z26.object({
|
|
3618
|
+
data: z26.array(metricPointSchema),
|
|
3393
3619
|
summary: metricsSummarySchema
|
|
3394
3620
|
});
|
|
3395
|
-
var publicRunMetricsContract =
|
|
3621
|
+
var publicRunMetricsContract = c22.router({
|
|
3396
3622
|
getMetrics: {
|
|
3397
3623
|
method: "GET",
|
|
3398
3624
|
path: "/v1/runs/:id/metrics",
|
|
3399
3625
|
headers: authHeadersSchema,
|
|
3400
|
-
pathParams:
|
|
3401
|
-
id:
|
|
3626
|
+
pathParams: z26.object({
|
|
3627
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3402
3628
|
}),
|
|
3403
3629
|
responses: {
|
|
3404
3630
|
200: metricsResponseSchema2,
|
|
@@ -3410,7 +3636,7 @@ var publicRunMetricsContract = c20.router({
|
|
|
3410
3636
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
3411
3637
|
}
|
|
3412
3638
|
});
|
|
3413
|
-
var sseEventTypeSchema =
|
|
3639
|
+
var sseEventTypeSchema = z26.enum([
|
|
3414
3640
|
"status",
|
|
3415
3641
|
// Run status change
|
|
3416
3642
|
"output",
|
|
@@ -3422,26 +3648,26 @@ var sseEventTypeSchema = z24.enum([
|
|
|
3422
3648
|
"heartbeat"
|
|
3423
3649
|
// Keep-alive
|
|
3424
3650
|
]);
|
|
3425
|
-
var sseEventSchema =
|
|
3651
|
+
var sseEventSchema = z26.object({
|
|
3426
3652
|
event: sseEventTypeSchema,
|
|
3427
|
-
data:
|
|
3428
|
-
id:
|
|
3653
|
+
data: z26.unknown(),
|
|
3654
|
+
id: z26.string().optional()
|
|
3429
3655
|
// For Last-Event-ID reconnection
|
|
3430
3656
|
});
|
|
3431
|
-
var publicRunEventsContract =
|
|
3657
|
+
var publicRunEventsContract = c22.router({
|
|
3432
3658
|
streamEvents: {
|
|
3433
3659
|
method: "GET",
|
|
3434
3660
|
path: "/v1/runs/:id/events",
|
|
3435
3661
|
headers: authHeadersSchema,
|
|
3436
|
-
pathParams:
|
|
3437
|
-
id:
|
|
3662
|
+
pathParams: z26.object({
|
|
3663
|
+
id: z26.string().min(1, "Run ID is required")
|
|
3438
3664
|
}),
|
|
3439
|
-
query:
|
|
3440
|
-
lastEventId:
|
|
3665
|
+
query: z26.object({
|
|
3666
|
+
lastEventId: z26.string().optional()
|
|
3441
3667
|
// For reconnection
|
|
3442
3668
|
}),
|
|
3443
3669
|
responses: {
|
|
3444
|
-
200:
|
|
3670
|
+
200: z26.any(),
|
|
3445
3671
|
// SSE stream - actual content is text/event-stream
|
|
3446
3672
|
401: publicApiErrorSchema,
|
|
3447
3673
|
404: publicApiErrorSchema,
|
|
@@ -3453,28 +3679,28 @@ var publicRunEventsContract = c20.router({
|
|
|
3453
3679
|
});
|
|
3454
3680
|
|
|
3455
3681
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
3456
|
-
import { z as
|
|
3457
|
-
var
|
|
3458
|
-
var publicArtifactSchema =
|
|
3459
|
-
id:
|
|
3460
|
-
name:
|
|
3461
|
-
currentVersionId:
|
|
3462
|
-
size:
|
|
3682
|
+
import { z as z27 } from "zod";
|
|
3683
|
+
var c23 = initContract();
|
|
3684
|
+
var publicArtifactSchema = z27.object({
|
|
3685
|
+
id: z27.string(),
|
|
3686
|
+
name: z27.string(),
|
|
3687
|
+
currentVersionId: z27.string().nullable(),
|
|
3688
|
+
size: z27.number(),
|
|
3463
3689
|
// Total size in bytes
|
|
3464
|
-
fileCount:
|
|
3690
|
+
fileCount: z27.number(),
|
|
3465
3691
|
createdAt: timestampSchema,
|
|
3466
3692
|
updatedAt: timestampSchema
|
|
3467
3693
|
});
|
|
3468
|
-
var artifactVersionSchema =
|
|
3469
|
-
id:
|
|
3694
|
+
var artifactVersionSchema = z27.object({
|
|
3695
|
+
id: z27.string(),
|
|
3470
3696
|
// SHA-256 content hash
|
|
3471
|
-
artifactId:
|
|
3472
|
-
size:
|
|
3697
|
+
artifactId: z27.string(),
|
|
3698
|
+
size: z27.number(),
|
|
3473
3699
|
// Size in bytes
|
|
3474
|
-
fileCount:
|
|
3475
|
-
message:
|
|
3700
|
+
fileCount: z27.number(),
|
|
3701
|
+
message: z27.string().nullable(),
|
|
3476
3702
|
// Optional commit message
|
|
3477
|
-
createdBy:
|
|
3703
|
+
createdBy: z27.string(),
|
|
3478
3704
|
createdAt: timestampSchema
|
|
3479
3705
|
});
|
|
3480
3706
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -3484,7 +3710,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
3484
3710
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
3485
3711
|
artifactVersionSchema
|
|
3486
3712
|
);
|
|
3487
|
-
var publicArtifactsListContract =
|
|
3713
|
+
var publicArtifactsListContract = c23.router({
|
|
3488
3714
|
list: {
|
|
3489
3715
|
method: "GET",
|
|
3490
3716
|
path: "/v1/artifacts",
|
|
@@ -3499,13 +3725,13 @@ var publicArtifactsListContract = c21.router({
|
|
|
3499
3725
|
description: "List all artifacts in the current scope with pagination"
|
|
3500
3726
|
}
|
|
3501
3727
|
});
|
|
3502
|
-
var publicArtifactByIdContract =
|
|
3728
|
+
var publicArtifactByIdContract = c23.router({
|
|
3503
3729
|
get: {
|
|
3504
3730
|
method: "GET",
|
|
3505
3731
|
path: "/v1/artifacts/:id",
|
|
3506
3732
|
headers: authHeadersSchema,
|
|
3507
|
-
pathParams:
|
|
3508
|
-
id:
|
|
3733
|
+
pathParams: z27.object({
|
|
3734
|
+
id: z27.string().min(1, "Artifact ID is required")
|
|
3509
3735
|
}),
|
|
3510
3736
|
responses: {
|
|
3511
3737
|
200: publicArtifactDetailSchema,
|
|
@@ -3517,13 +3743,13 @@ var publicArtifactByIdContract = c21.router({
|
|
|
3517
3743
|
description: "Get artifact details by ID"
|
|
3518
3744
|
}
|
|
3519
3745
|
});
|
|
3520
|
-
var publicArtifactVersionsContract =
|
|
3746
|
+
var publicArtifactVersionsContract = c23.router({
|
|
3521
3747
|
list: {
|
|
3522
3748
|
method: "GET",
|
|
3523
3749
|
path: "/v1/artifacts/:id/versions",
|
|
3524
3750
|
headers: authHeadersSchema,
|
|
3525
|
-
pathParams:
|
|
3526
|
-
id:
|
|
3751
|
+
pathParams: z27.object({
|
|
3752
|
+
id: z27.string().min(1, "Artifact ID is required")
|
|
3527
3753
|
}),
|
|
3528
3754
|
query: listQuerySchema,
|
|
3529
3755
|
responses: {
|
|
@@ -3536,20 +3762,20 @@ var publicArtifactVersionsContract = c21.router({
|
|
|
3536
3762
|
description: "List all versions of an artifact with pagination"
|
|
3537
3763
|
}
|
|
3538
3764
|
});
|
|
3539
|
-
var publicArtifactDownloadContract =
|
|
3765
|
+
var publicArtifactDownloadContract = c23.router({
|
|
3540
3766
|
download: {
|
|
3541
3767
|
method: "GET",
|
|
3542
3768
|
path: "/v1/artifacts/:id/download",
|
|
3543
3769
|
headers: authHeadersSchema,
|
|
3544
|
-
pathParams:
|
|
3545
|
-
id:
|
|
3770
|
+
pathParams: z27.object({
|
|
3771
|
+
id: z27.string().min(1, "Artifact ID is required")
|
|
3546
3772
|
}),
|
|
3547
|
-
query:
|
|
3548
|
-
versionId:
|
|
3773
|
+
query: z27.object({
|
|
3774
|
+
versionId: z27.string().optional()
|
|
3549
3775
|
// Defaults to current version
|
|
3550
3776
|
}),
|
|
3551
3777
|
responses: {
|
|
3552
|
-
302:
|
|
3778
|
+
302: z27.undefined(),
|
|
3553
3779
|
// Redirect to presigned URL
|
|
3554
3780
|
401: publicApiErrorSchema,
|
|
3555
3781
|
404: publicApiErrorSchema,
|
|
@@ -3561,28 +3787,28 @@ var publicArtifactDownloadContract = c21.router({
|
|
|
3561
3787
|
});
|
|
3562
3788
|
|
|
3563
3789
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
3564
|
-
import { z as
|
|
3565
|
-
var
|
|
3566
|
-
var publicVolumeSchema =
|
|
3567
|
-
id:
|
|
3568
|
-
name:
|
|
3569
|
-
currentVersionId:
|
|
3570
|
-
size:
|
|
3790
|
+
import { z as z28 } from "zod";
|
|
3791
|
+
var c24 = initContract();
|
|
3792
|
+
var publicVolumeSchema = z28.object({
|
|
3793
|
+
id: z28.string(),
|
|
3794
|
+
name: z28.string(),
|
|
3795
|
+
currentVersionId: z28.string().nullable(),
|
|
3796
|
+
size: z28.number(),
|
|
3571
3797
|
// Total size in bytes
|
|
3572
|
-
fileCount:
|
|
3798
|
+
fileCount: z28.number(),
|
|
3573
3799
|
createdAt: timestampSchema,
|
|
3574
3800
|
updatedAt: timestampSchema
|
|
3575
3801
|
});
|
|
3576
|
-
var volumeVersionSchema =
|
|
3577
|
-
id:
|
|
3802
|
+
var volumeVersionSchema = z28.object({
|
|
3803
|
+
id: z28.string(),
|
|
3578
3804
|
// SHA-256 content hash
|
|
3579
|
-
volumeId:
|
|
3580
|
-
size:
|
|
3805
|
+
volumeId: z28.string(),
|
|
3806
|
+
size: z28.number(),
|
|
3581
3807
|
// Size in bytes
|
|
3582
|
-
fileCount:
|
|
3583
|
-
message:
|
|
3808
|
+
fileCount: z28.number(),
|
|
3809
|
+
message: z28.string().nullable(),
|
|
3584
3810
|
// Optional commit message
|
|
3585
|
-
createdBy:
|
|
3811
|
+
createdBy: z28.string(),
|
|
3586
3812
|
createdAt: timestampSchema
|
|
3587
3813
|
});
|
|
3588
3814
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -3590,7 +3816,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
3590
3816
|
});
|
|
3591
3817
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
3592
3818
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
3593
|
-
var publicVolumesListContract =
|
|
3819
|
+
var publicVolumesListContract = c24.router({
|
|
3594
3820
|
list: {
|
|
3595
3821
|
method: "GET",
|
|
3596
3822
|
path: "/v1/volumes",
|
|
@@ -3605,13 +3831,13 @@ var publicVolumesListContract = c22.router({
|
|
|
3605
3831
|
description: "List all volumes in the current scope with pagination"
|
|
3606
3832
|
}
|
|
3607
3833
|
});
|
|
3608
|
-
var publicVolumeByIdContract =
|
|
3834
|
+
var publicVolumeByIdContract = c24.router({
|
|
3609
3835
|
get: {
|
|
3610
3836
|
method: "GET",
|
|
3611
3837
|
path: "/v1/volumes/:id",
|
|
3612
3838
|
headers: authHeadersSchema,
|
|
3613
|
-
pathParams:
|
|
3614
|
-
id:
|
|
3839
|
+
pathParams: z28.object({
|
|
3840
|
+
id: z28.string().min(1, "Volume ID is required")
|
|
3615
3841
|
}),
|
|
3616
3842
|
responses: {
|
|
3617
3843
|
200: publicVolumeDetailSchema,
|
|
@@ -3623,13 +3849,13 @@ var publicVolumeByIdContract = c22.router({
|
|
|
3623
3849
|
description: "Get volume details by ID"
|
|
3624
3850
|
}
|
|
3625
3851
|
});
|
|
3626
|
-
var publicVolumeVersionsContract =
|
|
3852
|
+
var publicVolumeVersionsContract = c24.router({
|
|
3627
3853
|
list: {
|
|
3628
3854
|
method: "GET",
|
|
3629
3855
|
path: "/v1/volumes/:id/versions",
|
|
3630
3856
|
headers: authHeadersSchema,
|
|
3631
|
-
pathParams:
|
|
3632
|
-
id:
|
|
3857
|
+
pathParams: z28.object({
|
|
3858
|
+
id: z28.string().min(1, "Volume ID is required")
|
|
3633
3859
|
}),
|
|
3634
3860
|
query: listQuerySchema,
|
|
3635
3861
|
responses: {
|
|
@@ -3642,20 +3868,20 @@ var publicVolumeVersionsContract = c22.router({
|
|
|
3642
3868
|
description: "List all versions of a volume with pagination"
|
|
3643
3869
|
}
|
|
3644
3870
|
});
|
|
3645
|
-
var publicVolumeDownloadContract =
|
|
3871
|
+
var publicVolumeDownloadContract = c24.router({
|
|
3646
3872
|
download: {
|
|
3647
3873
|
method: "GET",
|
|
3648
3874
|
path: "/v1/volumes/:id/download",
|
|
3649
3875
|
headers: authHeadersSchema,
|
|
3650
|
-
pathParams:
|
|
3651
|
-
id:
|
|
3876
|
+
pathParams: z28.object({
|
|
3877
|
+
id: z28.string().min(1, "Volume ID is required")
|
|
3652
3878
|
}),
|
|
3653
|
-
query:
|
|
3654
|
-
versionId:
|
|
3879
|
+
query: z28.object({
|
|
3880
|
+
versionId: z28.string().optional()
|
|
3655
3881
|
// Defaults to current version
|
|
3656
3882
|
}),
|
|
3657
3883
|
responses: {
|
|
3658
|
-
302:
|
|
3884
|
+
302: z28.undefined(),
|
|
3659
3885
|
// Redirect to presigned URL
|
|
3660
3886
|
401: publicApiErrorSchema,
|
|
3661
3887
|
404: publicApiErrorSchema,
|
|
@@ -4373,8 +4599,8 @@ async function getUsage(options) {
|
|
|
4373
4599
|
}
|
|
4374
4600
|
|
|
4375
4601
|
// src/lib/domain/yaml-validator.ts
|
|
4376
|
-
import { z as
|
|
4377
|
-
var cliAgentNameSchema =
|
|
4602
|
+
import { z as z29 } from "zod";
|
|
4603
|
+
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(
|
|
4378
4604
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
4379
4605
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
4380
4606
|
);
|
|
@@ -4389,7 +4615,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4389
4615
|
const skillUrl = agent.skills[i];
|
|
4390
4616
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
4391
4617
|
ctx.addIssue({
|
|
4392
|
-
code:
|
|
4618
|
+
code: z29.ZodIssueCode.custom,
|
|
4393
4619
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
4394
4620
|
path: ["skills", i]
|
|
4395
4621
|
});
|
|
@@ -4398,15 +4624,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4398
4624
|
}
|
|
4399
4625
|
}
|
|
4400
4626
|
);
|
|
4401
|
-
var cliComposeSchema =
|
|
4402
|
-
version:
|
|
4403
|
-
agents:
|
|
4404
|
-
volumes:
|
|
4627
|
+
var cliComposeSchema = z29.object({
|
|
4628
|
+
version: z29.string().min(1, "Missing config.version"),
|
|
4629
|
+
agents: z29.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
4630
|
+
volumes: z29.record(z29.string(), volumeConfigSchema).optional()
|
|
4405
4631
|
}).superRefine((config, ctx) => {
|
|
4406
4632
|
const agentKeys = Object.keys(config.agents);
|
|
4407
4633
|
if (agentKeys.length === 0) {
|
|
4408
4634
|
ctx.addIssue({
|
|
4409
|
-
code:
|
|
4635
|
+
code: z29.ZodIssueCode.custom,
|
|
4410
4636
|
message: "agents must have at least one agent defined",
|
|
4411
4637
|
path: ["agents"]
|
|
4412
4638
|
});
|
|
@@ -4414,7 +4640,7 @@ var cliComposeSchema = z27.object({
|
|
|
4414
4640
|
}
|
|
4415
4641
|
if (agentKeys.length > 1) {
|
|
4416
4642
|
ctx.addIssue({
|
|
4417
|
-
code:
|
|
4643
|
+
code: z29.ZodIssueCode.custom,
|
|
4418
4644
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
4419
4645
|
path: ["agents"]
|
|
4420
4646
|
});
|
|
@@ -4426,7 +4652,7 @@ var cliComposeSchema = z27.object({
|
|
|
4426
4652
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
4427
4653
|
if (!config.volumes) {
|
|
4428
4654
|
ctx.addIssue({
|
|
4429
|
-
code:
|
|
4655
|
+
code: z29.ZodIssueCode.custom,
|
|
4430
4656
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
4431
4657
|
path: ["volumes"]
|
|
4432
4658
|
});
|
|
@@ -4436,7 +4662,7 @@ var cliComposeSchema = z27.object({
|
|
|
4436
4662
|
const parts = volDeclaration.split(":");
|
|
4437
4663
|
if (parts.length !== 2) {
|
|
4438
4664
|
ctx.addIssue({
|
|
4439
|
-
code:
|
|
4665
|
+
code: z29.ZodIssueCode.custom,
|
|
4440
4666
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
4441
4667
|
path: ["agents", agentName, "volumes"]
|
|
4442
4668
|
});
|
|
@@ -4445,7 +4671,7 @@ var cliComposeSchema = z27.object({
|
|
|
4445
4671
|
const volumeKey = parts[0].trim();
|
|
4446
4672
|
if (!config.volumes[volumeKey]) {
|
|
4447
4673
|
ctx.addIssue({
|
|
4448
|
-
code:
|
|
4674
|
+
code: z29.ZodIssueCode.custom,
|
|
4449
4675
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
4450
4676
|
path: ["volumes", volumeKey]
|
|
4451
4677
|
});
|
|
@@ -5614,7 +5840,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5614
5840
|
);
|
|
5615
5841
|
}
|
|
5616
5842
|
if (options.autoUpdate !== false) {
|
|
5617
|
-
await silentUpgradeAfterCommand("9.
|
|
5843
|
+
await silentUpgradeAfterCommand("9.24.0");
|
|
5618
5844
|
}
|
|
5619
5845
|
return result;
|
|
5620
5846
|
}
|
|
@@ -6077,8 +6303,8 @@ var EventRenderer = class _EventRenderer {
|
|
|
6077
6303
|
/**
|
|
6078
6304
|
* Format timestamp for display (without milliseconds, matching metrics format)
|
|
6079
6305
|
*/
|
|
6080
|
-
static formatTimestamp(
|
|
6081
|
-
return
|
|
6306
|
+
static formatTimestamp(timestamp2) {
|
|
6307
|
+
return timestamp2.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
6082
6308
|
}
|
|
6083
6309
|
/**
|
|
6084
6310
|
* Render a parsed event to console
|
|
@@ -6551,9 +6777,9 @@ var CodexEventParser = class {
|
|
|
6551
6777
|
}
|
|
6552
6778
|
}
|
|
6553
6779
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6554
|
-
const changes = item.changes.map((
|
|
6555
|
-
const action =
|
|
6556
|
-
return `${action}: ${
|
|
6780
|
+
const changes = item.changes.map((c25) => {
|
|
6781
|
+
const action = c25.kind === "add" ? "Created" : c25.kind === "modify" ? "Modified" : "Deleted";
|
|
6782
|
+
return `${action}: ${c25.path}`;
|
|
6557
6783
|
}).join("\n");
|
|
6558
6784
|
return {
|
|
6559
6785
|
type: "text",
|
|
@@ -6707,9 +6933,9 @@ var CodexEventRenderer = class {
|
|
|
6707
6933
|
return;
|
|
6708
6934
|
}
|
|
6709
6935
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6710
|
-
const summary = item.changes.map((
|
|
6711
|
-
const icon =
|
|
6712
|
-
return `${icon}${
|
|
6936
|
+
const summary = item.changes.map((c25) => {
|
|
6937
|
+
const icon = c25.kind === "add" ? "+" : c25.kind === "delete" ? "-" : "~";
|
|
6938
|
+
return `${icon}${c25.path}`;
|
|
6713
6939
|
}).join(", ");
|
|
6714
6940
|
console.log(chalk7.green("[files]") + ` ${summary}`);
|
|
6715
6941
|
return;
|
|
@@ -8056,7 +8282,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8056
8282
|
}
|
|
8057
8283
|
showNextSteps(result);
|
|
8058
8284
|
if (options.autoUpdate !== false) {
|
|
8059
|
-
await silentUpgradeAfterCommand("9.
|
|
8285
|
+
await silentUpgradeAfterCommand("9.24.0");
|
|
8060
8286
|
}
|
|
8061
8287
|
} catch (error) {
|
|
8062
8288
|
handleRunError(error, identifier);
|
|
@@ -9563,7 +9789,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9563
9789
|
).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(
|
|
9564
9790
|
async (prompt, options) => {
|
|
9565
9791
|
if (options.autoUpdate !== false) {
|
|
9566
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9792
|
+
const shouldExit = await checkAndUpgrade("9.24.0", prompt);
|
|
9567
9793
|
if (shouldExit) {
|
|
9568
9794
|
process.exit(0);
|
|
9569
9795
|
}
|
|
@@ -9763,11 +9989,11 @@ function parseTime(timeStr) {
|
|
|
9763
9989
|
return parseRelativeTime(value, unit);
|
|
9764
9990
|
}
|
|
9765
9991
|
if (/^\d+$/.test(timeStr)) {
|
|
9766
|
-
const
|
|
9767
|
-
if (
|
|
9768
|
-
return
|
|
9992
|
+
const timestamp2 = parseInt(timeStr, 10);
|
|
9993
|
+
if (timestamp2 < 1e10) {
|
|
9994
|
+
return timestamp2 * 1e3;
|
|
9769
9995
|
}
|
|
9770
|
-
return
|
|
9996
|
+
return timestamp2;
|
|
9771
9997
|
}
|
|
9772
9998
|
const date = new Date(timeStr);
|
|
9773
9999
|
if (!isNaN(date.getTime())) {
|
|
@@ -10278,7 +10504,7 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10278
10504
|
);
|
|
10279
10505
|
return;
|
|
10280
10506
|
}
|
|
10281
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
10507
|
+
const nameWidth = Math.max(4, ...data.composes.map((c25) => c25.name.length));
|
|
10282
10508
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
10283
10509
|
" "
|
|
10284
10510
|
);
|
|
@@ -11252,7 +11478,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
11252
11478
|
);
|
|
11253
11479
|
process.exit(1);
|
|
11254
11480
|
}
|
|
11255
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
11481
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c25) => c25.value === existingFrequency) : 0;
|
|
11256
11482
|
frequency = await promptSelect(
|
|
11257
11483
|
"Schedule frequency",
|
|
11258
11484
|
FREQUENCY_CHOICES,
|
|
@@ -11281,7 +11507,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11281
11507
|
process.exit(1);
|
|
11282
11508
|
}
|
|
11283
11509
|
if (frequency === "weekly") {
|
|
11284
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
11510
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c25) => c25.value === existingDay) : 0;
|
|
11285
11511
|
const day2 = await promptSelect(
|
|
11286
11512
|
"Day of week",
|
|
11287
11513
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -13040,26 +13266,145 @@ var setDefaultCommand = new Command64().name("set-default").description("Set a m
|
|
|
13040
13266
|
// src/commands/model-provider/index.ts
|
|
13041
13267
|
var modelProviderCommand = new Command65().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand4).addCommand(setDefaultCommand);
|
|
13042
13268
|
|
|
13043
|
-
// src/commands/
|
|
13269
|
+
// src/commands/connector/index.ts
|
|
13270
|
+
import { Command as Command67 } from "commander";
|
|
13271
|
+
|
|
13272
|
+
// src/commands/connector/connect.ts
|
|
13044
13273
|
import { Command as Command66 } from "commander";
|
|
13045
|
-
import
|
|
13274
|
+
import chalk63 from "chalk";
|
|
13275
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
13276
|
+
function delay2(ms) {
|
|
13277
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13278
|
+
}
|
|
13279
|
+
async function getHeaders2() {
|
|
13280
|
+
const token = await getToken();
|
|
13281
|
+
if (!token) {
|
|
13282
|
+
throw new Error("Not authenticated. Run: vm0 auth login");
|
|
13283
|
+
}
|
|
13284
|
+
const headers = {
|
|
13285
|
+
Authorization: `Bearer ${token}`
|
|
13286
|
+
};
|
|
13287
|
+
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
13288
|
+
if (bypassSecret) {
|
|
13289
|
+
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
13290
|
+
}
|
|
13291
|
+
return headers;
|
|
13292
|
+
}
|
|
13293
|
+
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) => {
|
|
13294
|
+
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13295
|
+
if (!parseResult.success) {
|
|
13296
|
+
console.error(chalk63.red(`Unknown connector type: ${type}`));
|
|
13297
|
+
console.error("Available connectors: github");
|
|
13298
|
+
process.exit(1);
|
|
13299
|
+
}
|
|
13300
|
+
const connectorType = parseResult.data;
|
|
13301
|
+
const apiUrl = await getApiUrl();
|
|
13302
|
+
const headers = await getHeaders2();
|
|
13303
|
+
console.log(`Connecting ${chalk63.cyan(type)}...`);
|
|
13304
|
+
const sessionsClient = initClient11(connectorSessionsContract, {
|
|
13305
|
+
baseUrl: apiUrl,
|
|
13306
|
+
baseHeaders: headers,
|
|
13307
|
+
jsonQuery: true
|
|
13308
|
+
});
|
|
13309
|
+
const createResult = await sessionsClient.create({
|
|
13310
|
+
params: { type: connectorType },
|
|
13311
|
+
body: {}
|
|
13312
|
+
});
|
|
13313
|
+
if (createResult.status !== 200) {
|
|
13314
|
+
const errorBody = createResult.body;
|
|
13315
|
+
console.error(
|
|
13316
|
+
chalk63.red(`Failed to create session: ${errorBody.error?.message}`)
|
|
13317
|
+
);
|
|
13318
|
+
process.exit(1);
|
|
13319
|
+
}
|
|
13320
|
+
const session = createResult.body;
|
|
13321
|
+
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13322
|
+
console.log(chalk63.green("\nSession created"));
|
|
13323
|
+
console.log(chalk63.cyan(`
|
|
13324
|
+
To connect, visit: ${verificationUrl}`));
|
|
13325
|
+
console.log(`Session code: ${chalk63.bold(session.code)}`);
|
|
13326
|
+
console.log(
|
|
13327
|
+
`
|
|
13328
|
+
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
13329
|
+
);
|
|
13330
|
+
console.log("\nWaiting for authorization...");
|
|
13331
|
+
const sessionClient = initClient11(connectorSessionByIdContract, {
|
|
13332
|
+
baseUrl: apiUrl,
|
|
13333
|
+
baseHeaders: headers,
|
|
13334
|
+
jsonQuery: true
|
|
13335
|
+
});
|
|
13336
|
+
const startTime = Date.now();
|
|
13337
|
+
const maxWaitTime = session.expiresIn * 1e3;
|
|
13338
|
+
const pollInterval = (session.interval || 5) * 1e3;
|
|
13339
|
+
let isFirstPoll = true;
|
|
13340
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
13341
|
+
if (!isFirstPoll) {
|
|
13342
|
+
await delay2(pollInterval);
|
|
13343
|
+
}
|
|
13344
|
+
isFirstPoll = false;
|
|
13345
|
+
const statusResult = await sessionClient.get({
|
|
13346
|
+
params: { type: connectorType, sessionId: session.id }
|
|
13347
|
+
});
|
|
13348
|
+
if (statusResult.status !== 200) {
|
|
13349
|
+
const errorBody = statusResult.body;
|
|
13350
|
+
console.error(
|
|
13351
|
+
chalk63.red(`
|
|
13352
|
+
Failed to check status: ${errorBody.error?.message}`)
|
|
13353
|
+
);
|
|
13354
|
+
process.exit(1);
|
|
13355
|
+
}
|
|
13356
|
+
const status = statusResult.body;
|
|
13357
|
+
switch (status.status) {
|
|
13358
|
+
case "complete":
|
|
13359
|
+
console.log(chalk63.green(`
|
|
13360
|
+
|
|
13361
|
+
${type} connected successfully!`));
|
|
13362
|
+
return;
|
|
13363
|
+
case "expired":
|
|
13364
|
+
console.log(chalk63.red("\nSession expired. Please try again."));
|
|
13365
|
+
process.exit(1);
|
|
13366
|
+
break;
|
|
13367
|
+
case "error":
|
|
13368
|
+
console.log(
|
|
13369
|
+
chalk63.red(
|
|
13370
|
+
`
|
|
13371
|
+
Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13372
|
+
)
|
|
13373
|
+
);
|
|
13374
|
+
process.exit(1);
|
|
13375
|
+
break;
|
|
13376
|
+
case "pending":
|
|
13377
|
+
process.stdout.write(chalk63.dim("."));
|
|
13378
|
+
break;
|
|
13379
|
+
}
|
|
13380
|
+
}
|
|
13381
|
+
console.log(chalk63.red("\nSession timed out. Please try again."));
|
|
13382
|
+
process.exit(1);
|
|
13383
|
+
});
|
|
13384
|
+
|
|
13385
|
+
// src/commands/connector/index.ts
|
|
13386
|
+
var connectorCommand = new Command67().name("connector").description("Manage third-party service connections").addCommand(connectCommand);
|
|
13387
|
+
|
|
13388
|
+
// src/commands/onboard/index.ts
|
|
13389
|
+
import { Command as Command68 } from "commander";
|
|
13390
|
+
import chalk67 from "chalk";
|
|
13046
13391
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
13047
13392
|
import { existsSync as existsSync11 } from "fs";
|
|
13048
13393
|
|
|
13049
13394
|
// src/lib/ui/welcome-box.ts
|
|
13050
|
-
import
|
|
13395
|
+
import chalk64 from "chalk";
|
|
13051
13396
|
var gradientColors = [
|
|
13052
|
-
|
|
13397
|
+
chalk64.hex("#FFAB5E"),
|
|
13053
13398
|
// Line 1 - lightest
|
|
13054
|
-
|
|
13399
|
+
chalk64.hex("#FF9642"),
|
|
13055
13400
|
// Line 2
|
|
13056
|
-
|
|
13401
|
+
chalk64.hex("#FF8228"),
|
|
13057
13402
|
// Line 3
|
|
13058
|
-
|
|
13403
|
+
chalk64.hex("#FF6D0A"),
|
|
13059
13404
|
// Line 4
|
|
13060
|
-
|
|
13405
|
+
chalk64.hex("#E85D00"),
|
|
13061
13406
|
// Line 5
|
|
13062
|
-
|
|
13407
|
+
chalk64.hex("#CC4E00")
|
|
13063
13408
|
// Line 6 - darkest
|
|
13064
13409
|
];
|
|
13065
13410
|
var vm0LogoLines = [
|
|
@@ -13081,15 +13426,15 @@ function renderVm0Banner() {
|
|
|
13081
13426
|
function renderOnboardWelcome() {
|
|
13082
13427
|
renderVm0Banner();
|
|
13083
13428
|
console.log(` Build agentic workflows using natural language.`);
|
|
13084
|
-
console.log(` ${
|
|
13429
|
+
console.log(` ${chalk64.dim("Currently in beta, enjoy it free.")}`);
|
|
13085
13430
|
console.log(
|
|
13086
|
-
` ${
|
|
13431
|
+
` ${chalk64.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
13087
13432
|
);
|
|
13088
13433
|
console.log();
|
|
13089
13434
|
}
|
|
13090
13435
|
|
|
13091
13436
|
// src/lib/ui/step-runner.ts
|
|
13092
|
-
import
|
|
13437
|
+
import chalk65 from "chalk";
|
|
13093
13438
|
function createStepRunner(options = true) {
|
|
13094
13439
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
13095
13440
|
const interactive = opts.interactive ?? true;
|
|
@@ -13104,25 +13449,25 @@ function createStepRunner(options = true) {
|
|
|
13104
13449
|
}
|
|
13105
13450
|
for (const [i, step] of completedSteps.entries()) {
|
|
13106
13451
|
if (step.failed) {
|
|
13107
|
-
console.log(
|
|
13452
|
+
console.log(chalk65.red(`\u2717 ${step.label}`));
|
|
13108
13453
|
} else {
|
|
13109
|
-
console.log(
|
|
13454
|
+
console.log(chalk65.green(`\u25CF ${step.label}`));
|
|
13110
13455
|
}
|
|
13111
13456
|
const isLastStep = i === completedSteps.length - 1;
|
|
13112
13457
|
if (!isLastStep || !isFinal) {
|
|
13113
|
-
console.log(
|
|
13458
|
+
console.log(chalk65.dim("\u2502"));
|
|
13114
13459
|
}
|
|
13115
13460
|
}
|
|
13116
13461
|
}
|
|
13117
13462
|
async function executeStep(label, fn, isFinal) {
|
|
13118
13463
|
let stepFailed = false;
|
|
13119
|
-
console.log(
|
|
13464
|
+
console.log(chalk65.yellow(`\u25CB ${label}`));
|
|
13120
13465
|
const ctx = {
|
|
13121
13466
|
connector() {
|
|
13122
|
-
console.log(
|
|
13467
|
+
console.log(chalk65.dim("\u2502"));
|
|
13123
13468
|
},
|
|
13124
13469
|
detail(message) {
|
|
13125
|
-
console.log(`${
|
|
13470
|
+
console.log(`${chalk65.dim("\u2502")} ${message}`);
|
|
13126
13471
|
},
|
|
13127
13472
|
async prompt(promptFn) {
|
|
13128
13473
|
return await promptFn();
|
|
@@ -13139,12 +13484,12 @@ function createStepRunner(options = true) {
|
|
|
13139
13484
|
redrawCompletedSteps(isFinal);
|
|
13140
13485
|
} else {
|
|
13141
13486
|
if (stepFailed) {
|
|
13142
|
-
console.log(
|
|
13487
|
+
console.log(chalk65.red(`\u2717 ${label}`));
|
|
13143
13488
|
} else {
|
|
13144
|
-
console.log(
|
|
13489
|
+
console.log(chalk65.green(`\u25CF ${label}`));
|
|
13145
13490
|
}
|
|
13146
13491
|
if (!isFinal) {
|
|
13147
|
-
console.log(
|
|
13492
|
+
console.log(chalk65.dim("\u2502"));
|
|
13148
13493
|
}
|
|
13149
13494
|
}
|
|
13150
13495
|
}
|
|
@@ -13189,7 +13534,7 @@ async function exchangeToken2(apiUrl, deviceCode) {
|
|
|
13189
13534
|
});
|
|
13190
13535
|
return response.json();
|
|
13191
13536
|
}
|
|
13192
|
-
function
|
|
13537
|
+
function delay3(ms) {
|
|
13193
13538
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13194
13539
|
}
|
|
13195
13540
|
async function isAuthenticated() {
|
|
@@ -13220,7 +13565,7 @@ async function pollForToken(apiUrl, deviceAuth, callbacks) {
|
|
|
13220
13565
|
let isFirstPoll = true;
|
|
13221
13566
|
while (Date.now() - startTime < maxWaitTime) {
|
|
13222
13567
|
if (!isFirstPoll) {
|
|
13223
|
-
await
|
|
13568
|
+
await delay3(pollInterval);
|
|
13224
13569
|
}
|
|
13225
13570
|
isFirstPoll = false;
|
|
13226
13571
|
const tokenResult = await exchangeToken2(apiUrl, deviceAuth.device_code);
|
|
@@ -13301,7 +13646,7 @@ async function setupModelProvider(type, secret, options) {
|
|
|
13301
13646
|
|
|
13302
13647
|
// src/lib/domain/onboard/claude-setup.ts
|
|
13303
13648
|
import { spawn as spawn3 } from "child_process";
|
|
13304
|
-
import
|
|
13649
|
+
import chalk66 from "chalk";
|
|
13305
13650
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
13306
13651
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
13307
13652
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -13338,12 +13683,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
13338
13683
|
}
|
|
13339
13684
|
function handlePluginError(error, context) {
|
|
13340
13685
|
const displayContext = context ?? "Claude plugin";
|
|
13341
|
-
console.error(
|
|
13686
|
+
console.error(chalk66.red(`Failed to install ${displayContext}`));
|
|
13342
13687
|
if (error instanceof Error) {
|
|
13343
|
-
console.error(
|
|
13688
|
+
console.error(chalk66.red(error.message));
|
|
13344
13689
|
}
|
|
13345
13690
|
console.error(
|
|
13346
|
-
|
|
13691
|
+
chalk66.dim("Please ensure Claude CLI is installed and accessible.")
|
|
13347
13692
|
);
|
|
13348
13693
|
process.exit(1);
|
|
13349
13694
|
}
|
|
@@ -13386,7 +13731,7 @@ async function updateMarketplace() {
|
|
|
13386
13731
|
]);
|
|
13387
13732
|
if (!result.success) {
|
|
13388
13733
|
console.warn(
|
|
13389
|
-
|
|
13734
|
+
chalk66.yellow(
|
|
13390
13735
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
13391
13736
|
)
|
|
13392
13737
|
);
|
|
@@ -13424,7 +13769,7 @@ async function handleAuthentication(ctx) {
|
|
|
13424
13769
|
return;
|
|
13425
13770
|
}
|
|
13426
13771
|
if (!ctx.interactive) {
|
|
13427
|
-
console.error(
|
|
13772
|
+
console.error(chalk67.red("Error: Not authenticated"));
|
|
13428
13773
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
13429
13774
|
process.exit(1);
|
|
13430
13775
|
}
|
|
@@ -13432,16 +13777,16 @@ async function handleAuthentication(ctx) {
|
|
|
13432
13777
|
onInitiating: () => {
|
|
13433
13778
|
},
|
|
13434
13779
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
13435
|
-
step.detail(`Copy code: ${
|
|
13436
|
-
step.detail(`Open: ${
|
|
13437
|
-
step.detail(
|
|
13780
|
+
step.detail(`Copy code: ${chalk67.cyan.bold(code)}`);
|
|
13781
|
+
step.detail(`Open: ${chalk67.cyan(url)}`);
|
|
13782
|
+
step.detail(chalk67.dim(`Expires in ${expiresIn} minutes`));
|
|
13438
13783
|
},
|
|
13439
13784
|
onPolling: () => {
|
|
13440
13785
|
},
|
|
13441
13786
|
onSuccess: () => {
|
|
13442
13787
|
},
|
|
13443
13788
|
onError: (error) => {
|
|
13444
|
-
console.error(
|
|
13789
|
+
console.error(chalk67.red(`
|
|
13445
13790
|
${error.message}`));
|
|
13446
13791
|
process.exit(1);
|
|
13447
13792
|
}
|
|
@@ -13455,7 +13800,7 @@ async function handleModelProvider(ctx) {
|
|
|
13455
13800
|
return;
|
|
13456
13801
|
}
|
|
13457
13802
|
if (!ctx.interactive) {
|
|
13458
|
-
console.error(
|
|
13803
|
+
console.error(chalk67.red("Error: No model provider configured"));
|
|
13459
13804
|
console.error("Run 'vm0 model-provider setup' first");
|
|
13460
13805
|
process.exit(1);
|
|
13461
13806
|
}
|
|
@@ -13464,26 +13809,26 @@ async function handleModelProvider(ctx) {
|
|
|
13464
13809
|
const providerType = await step.prompt(
|
|
13465
13810
|
() => promptSelect(
|
|
13466
13811
|
"Select provider type:",
|
|
13467
|
-
choices.map((
|
|
13468
|
-
title:
|
|
13469
|
-
value:
|
|
13812
|
+
choices.map((c25) => ({
|
|
13813
|
+
title: c25.label,
|
|
13814
|
+
value: c25.type
|
|
13470
13815
|
}))
|
|
13471
13816
|
)
|
|
13472
13817
|
);
|
|
13473
13818
|
if (!providerType) {
|
|
13474
13819
|
process.exit(0);
|
|
13475
13820
|
}
|
|
13476
|
-
const selectedChoice = choices.find((
|
|
13821
|
+
const selectedChoice = choices.find((c25) => c25.type === providerType);
|
|
13477
13822
|
if (selectedChoice?.helpText) {
|
|
13478
13823
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
13479
|
-
step.detail(
|
|
13824
|
+
step.detail(chalk67.dim(line));
|
|
13480
13825
|
}
|
|
13481
13826
|
}
|
|
13482
13827
|
const secret = await step.prompt(
|
|
13483
13828
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
13484
13829
|
);
|
|
13485
13830
|
if (!secret) {
|
|
13486
|
-
console.log(
|
|
13831
|
+
console.log(chalk67.dim("Cancelled"));
|
|
13487
13832
|
process.exit(0);
|
|
13488
13833
|
}
|
|
13489
13834
|
let selectedModel;
|
|
@@ -13502,7 +13847,7 @@ async function handleModelProvider(ctx) {
|
|
|
13502
13847
|
() => promptSelect("Select model:", modelChoices)
|
|
13503
13848
|
);
|
|
13504
13849
|
if (modelSelection === void 0) {
|
|
13505
|
-
console.log(
|
|
13850
|
+
console.log(chalk67.dim("Cancelled"));
|
|
13506
13851
|
process.exit(0);
|
|
13507
13852
|
}
|
|
13508
13853
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -13512,7 +13857,7 @@ async function handleModelProvider(ctx) {
|
|
|
13512
13857
|
});
|
|
13513
13858
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
13514
13859
|
step.detail(
|
|
13515
|
-
|
|
13860
|
+
chalk67.green(
|
|
13516
13861
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
13517
13862
|
)
|
|
13518
13863
|
);
|
|
@@ -13543,7 +13888,7 @@ async function handleAgentCreation(ctx) {
|
|
|
13543
13888
|
agentName = inputName;
|
|
13544
13889
|
if (existsSync11(agentName)) {
|
|
13545
13890
|
step.detail(
|
|
13546
|
-
|
|
13891
|
+
chalk67.yellow(`${agentName}/ already exists, choose another name`)
|
|
13547
13892
|
);
|
|
13548
13893
|
} else {
|
|
13549
13894
|
folderExists = false;
|
|
@@ -13552,22 +13897,22 @@ async function handleAgentCreation(ctx) {
|
|
|
13552
13897
|
} else {
|
|
13553
13898
|
if (!validateAgentName(agentName)) {
|
|
13554
13899
|
console.error(
|
|
13555
|
-
|
|
13900
|
+
chalk67.red(
|
|
13556
13901
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
13557
13902
|
)
|
|
13558
13903
|
);
|
|
13559
13904
|
process.exit(1);
|
|
13560
13905
|
}
|
|
13561
13906
|
if (existsSync11(agentName)) {
|
|
13562
|
-
console.error(
|
|
13907
|
+
console.error(chalk67.red(`${agentName}/ already exists`));
|
|
13563
13908
|
console.log();
|
|
13564
13909
|
console.log("Remove it first or choose a different name:");
|
|
13565
|
-
console.log(
|
|
13910
|
+
console.log(chalk67.cyan(` rm -rf ${agentName}`));
|
|
13566
13911
|
process.exit(1);
|
|
13567
13912
|
}
|
|
13568
13913
|
}
|
|
13569
13914
|
await mkdir8(agentName, { recursive: true });
|
|
13570
|
-
step.detail(
|
|
13915
|
+
step.detail(chalk67.green(`Created ${agentName}/`));
|
|
13571
13916
|
});
|
|
13572
13917
|
return agentName;
|
|
13573
13918
|
}
|
|
@@ -13583,7 +13928,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13583
13928
|
shouldInstall = confirmed ?? true;
|
|
13584
13929
|
}
|
|
13585
13930
|
if (!shouldInstall) {
|
|
13586
|
-
step.detail(
|
|
13931
|
+
step.detail(chalk67.dim("Skipped"));
|
|
13587
13932
|
return;
|
|
13588
13933
|
}
|
|
13589
13934
|
const scope = "project";
|
|
@@ -13591,7 +13936,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13591
13936
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
13592
13937
|
const result = await installVm0Plugin(scope, agentDir);
|
|
13593
13938
|
step.detail(
|
|
13594
|
-
|
|
13939
|
+
chalk67.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13595
13940
|
);
|
|
13596
13941
|
pluginInstalled = true;
|
|
13597
13942
|
} catch (error) {
|
|
@@ -13602,18 +13947,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13602
13947
|
}
|
|
13603
13948
|
function printNextSteps(agentName, pluginInstalled) {
|
|
13604
13949
|
console.log();
|
|
13605
|
-
console.log(
|
|
13950
|
+
console.log(chalk67.bold("Next step:"));
|
|
13606
13951
|
console.log();
|
|
13607
13952
|
if (pluginInstalled) {
|
|
13608
13953
|
console.log(
|
|
13609
|
-
` ${
|
|
13954
|
+
` ${chalk67.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
13610
13955
|
);
|
|
13611
13956
|
} else {
|
|
13612
|
-
console.log(` ${
|
|
13957
|
+
console.log(` ${chalk67.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
13613
13958
|
}
|
|
13614
13959
|
console.log();
|
|
13615
13960
|
}
|
|
13616
|
-
var onboardCommand = new
|
|
13961
|
+
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) => {
|
|
13617
13962
|
const interactive = isInteractive();
|
|
13618
13963
|
if (interactive) {
|
|
13619
13964
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -13636,15 +13981,15 @@ var onboardCommand = new Command66().name("onboard").description("Guided setup f
|
|
|
13636
13981
|
});
|
|
13637
13982
|
|
|
13638
13983
|
// src/commands/setup-claude/index.ts
|
|
13639
|
-
import { Command as
|
|
13640
|
-
import
|
|
13641
|
-
var setupClaudeCommand = new
|
|
13642
|
-
console.log(
|
|
13984
|
+
import { Command as Command69 } from "commander";
|
|
13985
|
+
import chalk68 from "chalk";
|
|
13986
|
+
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) => {
|
|
13987
|
+
console.log(chalk68.dim("Installing VM0 Claude Plugin..."));
|
|
13643
13988
|
const scope = options.scope === "user" ? "user" : "project";
|
|
13644
13989
|
try {
|
|
13645
13990
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
13646
13991
|
console.log(
|
|
13647
|
-
|
|
13992
|
+
chalk68.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13648
13993
|
);
|
|
13649
13994
|
} catch (error) {
|
|
13650
13995
|
handlePluginError(error);
|
|
@@ -13653,15 +13998,174 @@ var setupClaudeCommand = new Command67().name("setup-claude").description("Insta
|
|
|
13653
13998
|
console.log("Next step:");
|
|
13654
13999
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
13655
14000
|
console.log(
|
|
13656
|
-
|
|
14001
|
+
chalk68.cyan(
|
|
13657
14002
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
13658
14003
|
)
|
|
13659
14004
|
);
|
|
13660
14005
|
});
|
|
13661
14006
|
|
|
14007
|
+
// src/commands/dev-tool/index.ts
|
|
14008
|
+
import { Command as Command71 } from "commander";
|
|
14009
|
+
|
|
14010
|
+
// src/commands/dev-tool/compose.ts
|
|
14011
|
+
import { Command as Command70 } from "commander";
|
|
14012
|
+
import chalk69 from "chalk";
|
|
14013
|
+
import { initClient as initClient12 } from "@ts-rest/core";
|
|
14014
|
+
function sleep2(ms) {
|
|
14015
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
14016
|
+
}
|
|
14017
|
+
function timestamp() {
|
|
14018
|
+
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false });
|
|
14019
|
+
}
|
|
14020
|
+
async function createComposeJob(githubUrl, overwrite) {
|
|
14021
|
+
const config = await getClientConfig();
|
|
14022
|
+
const client = initClient12(composeJobsMainContract, config);
|
|
14023
|
+
const result = await client.create({
|
|
14024
|
+
body: { githubUrl, overwrite }
|
|
14025
|
+
});
|
|
14026
|
+
if (result.status === 200 || result.status === 201) {
|
|
14027
|
+
return {
|
|
14028
|
+
jobId: result.body.jobId,
|
|
14029
|
+
status: result.body.status
|
|
14030
|
+
};
|
|
14031
|
+
}
|
|
14032
|
+
if (result.status === 400 || result.status === 401) {
|
|
14033
|
+
throw new Error(result.body.error.message);
|
|
14034
|
+
}
|
|
14035
|
+
throw new Error(`Unexpected response: ${result.status}`);
|
|
14036
|
+
}
|
|
14037
|
+
async function getComposeJobStatus(jobId) {
|
|
14038
|
+
const config = await getClientConfig();
|
|
14039
|
+
const client = initClient12(composeJobsByIdContract, config);
|
|
14040
|
+
const result = await client.getById({
|
|
14041
|
+
params: { jobId }
|
|
14042
|
+
});
|
|
14043
|
+
if (result.status === 200) {
|
|
14044
|
+
return {
|
|
14045
|
+
status: result.body.status,
|
|
14046
|
+
result: result.body.result,
|
|
14047
|
+
error: result.body.error
|
|
14048
|
+
};
|
|
14049
|
+
}
|
|
14050
|
+
if (result.status === 404) {
|
|
14051
|
+
throw new Error(`Job not found: ${jobId}`);
|
|
14052
|
+
}
|
|
14053
|
+
if (result.status === 401) {
|
|
14054
|
+
throw new Error(result.body.error.message);
|
|
14055
|
+
}
|
|
14056
|
+
throw new Error(`Unexpected response: ${result.status}`);
|
|
14057
|
+
}
|
|
14058
|
+
async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
14059
|
+
const startTime = Date.now();
|
|
14060
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
14061
|
+
const job = await getComposeJobStatus(jobId);
|
|
14062
|
+
if (!jsonMode) {
|
|
14063
|
+
console.log(
|
|
14064
|
+
chalk69.dim(`[${timestamp()}] Polling... status=${job.status}`)
|
|
14065
|
+
);
|
|
14066
|
+
}
|
|
14067
|
+
if (job.status === "completed" || job.status === "failed") {
|
|
14068
|
+
return job;
|
|
14069
|
+
}
|
|
14070
|
+
await sleep2(intervalMs);
|
|
14071
|
+
}
|
|
14072
|
+
throw new Error(`Timeout after ${timeoutMs / 1e3} seconds`);
|
|
14073
|
+
}
|
|
14074
|
+
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(
|
|
14075
|
+
"--interval <seconds>",
|
|
14076
|
+
"Polling interval in seconds",
|
|
14077
|
+
(v) => parseInt(v, 10),
|
|
14078
|
+
5
|
|
14079
|
+
).option(
|
|
14080
|
+
"--timeout <seconds>",
|
|
14081
|
+
"Maximum wait time in seconds",
|
|
14082
|
+
(v) => parseInt(v, 10),
|
|
14083
|
+
300
|
|
14084
|
+
).option("--json", "Output result as JSON").action(
|
|
14085
|
+
async (githubUrl, options) => {
|
|
14086
|
+
const intervalMs = options.interval * 1e3;
|
|
14087
|
+
const timeoutMs = options.timeout * 1e3;
|
|
14088
|
+
try {
|
|
14089
|
+
if (!options.json) {
|
|
14090
|
+
console.log("Creating compose job...");
|
|
14091
|
+
}
|
|
14092
|
+
const { jobId, status: initialStatus } = await createComposeJob(
|
|
14093
|
+
githubUrl,
|
|
14094
|
+
options.overwrite
|
|
14095
|
+
);
|
|
14096
|
+
if (!options.json) {
|
|
14097
|
+
console.log(`Job ID: ${chalk69.cyan(jobId)}`);
|
|
14098
|
+
console.log();
|
|
14099
|
+
}
|
|
14100
|
+
if (initialStatus === "completed" || initialStatus === "failed") {
|
|
14101
|
+
const finalJob2 = await getComposeJobStatus(jobId);
|
|
14102
|
+
if (options.json) {
|
|
14103
|
+
console.log(JSON.stringify(finalJob2, null, 2));
|
|
14104
|
+
} else {
|
|
14105
|
+
displayResult(finalJob2);
|
|
14106
|
+
}
|
|
14107
|
+
process.exit(finalJob2.status === "completed" ? 0 : 1);
|
|
14108
|
+
}
|
|
14109
|
+
const finalJob = await pollUntilComplete(
|
|
14110
|
+
jobId,
|
|
14111
|
+
intervalMs,
|
|
14112
|
+
timeoutMs,
|
|
14113
|
+
!!options.json
|
|
14114
|
+
);
|
|
14115
|
+
if (options.json) {
|
|
14116
|
+
console.log(JSON.stringify(finalJob, null, 2));
|
|
14117
|
+
} else {
|
|
14118
|
+
console.log();
|
|
14119
|
+
displayResult(finalJob);
|
|
14120
|
+
}
|
|
14121
|
+
process.exit(finalJob.status === "completed" ? 0 : 1);
|
|
14122
|
+
} catch (error) {
|
|
14123
|
+
if (options.json) {
|
|
14124
|
+
console.log(
|
|
14125
|
+
JSON.stringify({
|
|
14126
|
+
error: error instanceof Error ? error.message : String(error)
|
|
14127
|
+
})
|
|
14128
|
+
);
|
|
14129
|
+
} else {
|
|
14130
|
+
console.error(
|
|
14131
|
+
chalk69.red(
|
|
14132
|
+
`\u2717 ${error instanceof Error ? error.message : String(error)}`
|
|
14133
|
+
)
|
|
14134
|
+
);
|
|
14135
|
+
}
|
|
14136
|
+
process.exit(1);
|
|
14137
|
+
}
|
|
14138
|
+
}
|
|
14139
|
+
);
|
|
14140
|
+
function displayResult(job) {
|
|
14141
|
+
if (job.status === "completed" && job.result) {
|
|
14142
|
+
console.log(chalk69.green("\u2713 Compose completed!"));
|
|
14143
|
+
console.log(` Compose ID: ${chalk69.cyan(job.result.composeId)}`);
|
|
14144
|
+
console.log(` Name: ${chalk69.cyan(job.result.composeName)}`);
|
|
14145
|
+
console.log(` Version: ${chalk69.cyan(job.result.versionId.slice(0, 8))}`);
|
|
14146
|
+
if (job.result.warnings.length > 0) {
|
|
14147
|
+
console.log();
|
|
14148
|
+
console.log(chalk69.yellow(" Warnings:"));
|
|
14149
|
+
for (const warning of job.result.warnings) {
|
|
14150
|
+
console.log(chalk69.yellow(` - ${warning}`));
|
|
14151
|
+
}
|
|
14152
|
+
}
|
|
14153
|
+
} else if (job.status === "failed") {
|
|
14154
|
+
console.log(chalk69.red("\u2717 Compose failed!"));
|
|
14155
|
+
if (job.error) {
|
|
14156
|
+
console.log(` Error: ${chalk69.red(job.error)}`);
|
|
14157
|
+
}
|
|
14158
|
+
} else {
|
|
14159
|
+
console.log(`Status: ${job.status}`);
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14162
|
+
|
|
14163
|
+
// src/commands/dev-tool/index.ts
|
|
14164
|
+
var devToolCommand = new Command71().name("dev-tool").description("Developer tools for testing and debugging").addCommand(composeCommand2);
|
|
14165
|
+
|
|
13662
14166
|
// src/index.ts
|
|
13663
|
-
var program = new
|
|
13664
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
14167
|
+
var program = new Command72();
|
|
14168
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.24.0");
|
|
13665
14169
|
program.addCommand(authCommand);
|
|
13666
14170
|
program.addCommand(infoCommand);
|
|
13667
14171
|
program.addCommand(composeCommand);
|
|
@@ -13678,8 +14182,10 @@ program.addCommand(usageCommand);
|
|
|
13678
14182
|
program.addCommand(secretCommand);
|
|
13679
14183
|
program.addCommand(variableCommand);
|
|
13680
14184
|
program.addCommand(modelProviderCommand);
|
|
14185
|
+
program.addCommand(connectorCommand);
|
|
13681
14186
|
program.addCommand(onboardCommand);
|
|
13682
14187
|
program.addCommand(setupClaudeCommand);
|
|
14188
|
+
program.addCommand(devToolCommand, { hidden: true });
|
|
13683
14189
|
if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
|
|
13684
14190
|
program.parse();
|
|
13685
14191
|
}
|