@vm0/cli 9.22.0 → 9.23.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 +440 -183
- 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.23.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 Command70 } from "commander";
|
|
76
76
|
|
|
77
77
|
// src/commands/auth/index.ts
|
|
78
78
|
import { Command as Command5 } from "commander";
|
|
@@ -3138,29 +3138,126 @@ 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/public/agents.ts
|
|
3239
|
+
import { z as z24 } from "zod";
|
|
3240
|
+
var c20 = initContract();
|
|
3241
|
+
var publicAgentSchema = z24.object({
|
|
3242
|
+
id: z24.string(),
|
|
3243
|
+
name: z24.string(),
|
|
3244
|
+
currentVersionId: z24.string().nullable(),
|
|
3148
3245
|
createdAt: timestampSchema,
|
|
3149
3246
|
updatedAt: timestampSchema
|
|
3150
3247
|
});
|
|
3151
|
-
var agentVersionSchema =
|
|
3152
|
-
id:
|
|
3153
|
-
agentId:
|
|
3154
|
-
versionNumber:
|
|
3248
|
+
var agentVersionSchema = z24.object({
|
|
3249
|
+
id: z24.string(),
|
|
3250
|
+
agentId: z24.string(),
|
|
3251
|
+
versionNumber: z24.number(),
|
|
3155
3252
|
createdAt: timestampSchema
|
|
3156
3253
|
});
|
|
3157
3254
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
3158
3255
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
3159
3256
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
3160
3257
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
3161
|
-
name:
|
|
3258
|
+
name: z24.string().optional()
|
|
3162
3259
|
});
|
|
3163
|
-
var publicAgentsListContract =
|
|
3260
|
+
var publicAgentsListContract = c20.router({
|
|
3164
3261
|
list: {
|
|
3165
3262
|
method: "GET",
|
|
3166
3263
|
path: "/v1/agents",
|
|
@@ -3175,13 +3272,13 @@ var publicAgentsListContract = c19.router({
|
|
|
3175
3272
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
3176
3273
|
}
|
|
3177
3274
|
});
|
|
3178
|
-
var publicAgentByIdContract =
|
|
3275
|
+
var publicAgentByIdContract = c20.router({
|
|
3179
3276
|
get: {
|
|
3180
3277
|
method: "GET",
|
|
3181
3278
|
path: "/v1/agents/:id",
|
|
3182
3279
|
headers: authHeadersSchema,
|
|
3183
|
-
pathParams:
|
|
3184
|
-
id:
|
|
3280
|
+
pathParams: z24.object({
|
|
3281
|
+
id: z24.string().min(1, "Agent ID is required")
|
|
3185
3282
|
}),
|
|
3186
3283
|
responses: {
|
|
3187
3284
|
200: publicAgentDetailSchema,
|
|
@@ -3193,13 +3290,13 @@ var publicAgentByIdContract = c19.router({
|
|
|
3193
3290
|
description: "Get agent details by ID"
|
|
3194
3291
|
}
|
|
3195
3292
|
});
|
|
3196
|
-
var publicAgentVersionsContract =
|
|
3293
|
+
var publicAgentVersionsContract = c20.router({
|
|
3197
3294
|
list: {
|
|
3198
3295
|
method: "GET",
|
|
3199
3296
|
path: "/v1/agents/:id/versions",
|
|
3200
3297
|
headers: authHeadersSchema,
|
|
3201
|
-
pathParams:
|
|
3202
|
-
id:
|
|
3298
|
+
pathParams: z24.object({
|
|
3299
|
+
id: z24.string().min(1, "Agent ID is required")
|
|
3203
3300
|
}),
|
|
3204
3301
|
query: listQuerySchema,
|
|
3205
3302
|
responses: {
|
|
@@ -3214,9 +3311,9 @@ var publicAgentVersionsContract = c19.router({
|
|
|
3214
3311
|
});
|
|
3215
3312
|
|
|
3216
3313
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
3217
|
-
import { z as
|
|
3218
|
-
var
|
|
3219
|
-
var publicRunStatusSchema =
|
|
3314
|
+
import { z as z25 } from "zod";
|
|
3315
|
+
var c21 = initContract();
|
|
3316
|
+
var publicRunStatusSchema = z25.enum([
|
|
3220
3317
|
"pending",
|
|
3221
3318
|
"running",
|
|
3222
3319
|
"completed",
|
|
@@ -3224,54 +3321,54 @@ var publicRunStatusSchema = z24.enum([
|
|
|
3224
3321
|
"timeout",
|
|
3225
3322
|
"cancelled"
|
|
3226
3323
|
]);
|
|
3227
|
-
var publicRunSchema =
|
|
3228
|
-
id:
|
|
3229
|
-
agentId:
|
|
3230
|
-
agentName:
|
|
3324
|
+
var publicRunSchema = z25.object({
|
|
3325
|
+
id: z25.string(),
|
|
3326
|
+
agentId: z25.string(),
|
|
3327
|
+
agentName: z25.string(),
|
|
3231
3328
|
status: publicRunStatusSchema,
|
|
3232
|
-
prompt:
|
|
3329
|
+
prompt: z25.string(),
|
|
3233
3330
|
createdAt: timestampSchema,
|
|
3234
3331
|
startedAt: timestampSchema.nullable(),
|
|
3235
3332
|
completedAt: timestampSchema.nullable()
|
|
3236
3333
|
});
|
|
3237
3334
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
3238
|
-
error:
|
|
3239
|
-
executionTimeMs:
|
|
3240
|
-
checkpointId:
|
|
3241
|
-
sessionId:
|
|
3242
|
-
artifactName:
|
|
3243
|
-
artifactVersion:
|
|
3244
|
-
volumes:
|
|
3335
|
+
error: z25.string().nullable(),
|
|
3336
|
+
executionTimeMs: z25.number().nullable(),
|
|
3337
|
+
checkpointId: z25.string().nullable(),
|
|
3338
|
+
sessionId: z25.string().nullable(),
|
|
3339
|
+
artifactName: z25.string().nullable(),
|
|
3340
|
+
artifactVersion: z25.string().nullable(),
|
|
3341
|
+
volumes: z25.record(z25.string(), z25.string()).optional()
|
|
3245
3342
|
});
|
|
3246
3343
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
3247
|
-
var createRunRequestSchema =
|
|
3344
|
+
var createRunRequestSchema = z25.object({
|
|
3248
3345
|
// Agent identification (one of: agent, agentId, sessionId, checkpointId)
|
|
3249
|
-
agent:
|
|
3346
|
+
agent: z25.string().optional(),
|
|
3250
3347
|
// Agent name
|
|
3251
|
-
agentId:
|
|
3348
|
+
agentId: z25.string().optional(),
|
|
3252
3349
|
// Agent ID
|
|
3253
|
-
agentVersion:
|
|
3350
|
+
agentVersion: z25.string().optional(),
|
|
3254
3351
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
3255
3352
|
// Continue session
|
|
3256
|
-
sessionId:
|
|
3353
|
+
sessionId: z25.string().optional(),
|
|
3257
3354
|
// Resume from checkpoint
|
|
3258
|
-
checkpointId:
|
|
3355
|
+
checkpointId: z25.string().optional(),
|
|
3259
3356
|
// Required
|
|
3260
|
-
prompt:
|
|
3357
|
+
prompt: z25.string().min(1, "Prompt is required"),
|
|
3261
3358
|
// Optional configuration
|
|
3262
|
-
variables:
|
|
3263
|
-
secrets:
|
|
3264
|
-
artifactName:
|
|
3359
|
+
variables: z25.record(z25.string(), z25.string()).optional(),
|
|
3360
|
+
secrets: z25.record(z25.string(), z25.string()).optional(),
|
|
3361
|
+
artifactName: z25.string().optional(),
|
|
3265
3362
|
// Artifact name to mount
|
|
3266
|
-
artifactVersion:
|
|
3363
|
+
artifactVersion: z25.string().optional(),
|
|
3267
3364
|
// Artifact version (defaults to latest)
|
|
3268
|
-
volumes:
|
|
3365
|
+
volumes: z25.record(z25.string(), z25.string()).optional()
|
|
3269
3366
|
// volume_name -> version
|
|
3270
3367
|
});
|
|
3271
3368
|
var runListQuerySchema = listQuerySchema.extend({
|
|
3272
3369
|
status: publicRunStatusSchema.optional()
|
|
3273
3370
|
});
|
|
3274
|
-
var publicRunsListContract =
|
|
3371
|
+
var publicRunsListContract = c21.router({
|
|
3275
3372
|
list: {
|
|
3276
3373
|
method: "GET",
|
|
3277
3374
|
path: "/v1/runs",
|
|
@@ -3303,13 +3400,13 @@ var publicRunsListContract = c20.router({
|
|
|
3303
3400
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
3304
3401
|
}
|
|
3305
3402
|
});
|
|
3306
|
-
var publicRunByIdContract =
|
|
3403
|
+
var publicRunByIdContract = c21.router({
|
|
3307
3404
|
get: {
|
|
3308
3405
|
method: "GET",
|
|
3309
3406
|
path: "/v1/runs/:id",
|
|
3310
3407
|
headers: authHeadersSchema,
|
|
3311
|
-
pathParams:
|
|
3312
|
-
id:
|
|
3408
|
+
pathParams: z25.object({
|
|
3409
|
+
id: z25.string().min(1, "Run ID is required")
|
|
3313
3410
|
}),
|
|
3314
3411
|
responses: {
|
|
3315
3412
|
200: publicRunDetailSchema,
|
|
@@ -3321,15 +3418,15 @@ var publicRunByIdContract = c20.router({
|
|
|
3321
3418
|
description: "Get run details by ID"
|
|
3322
3419
|
}
|
|
3323
3420
|
});
|
|
3324
|
-
var publicRunCancelContract =
|
|
3421
|
+
var publicRunCancelContract = c21.router({
|
|
3325
3422
|
cancel: {
|
|
3326
3423
|
method: "POST",
|
|
3327
3424
|
path: "/v1/runs/:id/cancel",
|
|
3328
3425
|
headers: authHeadersSchema,
|
|
3329
|
-
pathParams:
|
|
3330
|
-
id:
|
|
3426
|
+
pathParams: z25.object({
|
|
3427
|
+
id: z25.string().min(1, "Run ID is required")
|
|
3331
3428
|
}),
|
|
3332
|
-
body:
|
|
3429
|
+
body: z25.undefined(),
|
|
3333
3430
|
responses: {
|
|
3334
3431
|
200: publicRunDetailSchema,
|
|
3335
3432
|
400: publicApiErrorSchema,
|
|
@@ -3342,27 +3439,27 @@ var publicRunCancelContract = c20.router({
|
|
|
3342
3439
|
description: "Cancel a pending or running execution"
|
|
3343
3440
|
}
|
|
3344
3441
|
});
|
|
3345
|
-
var logEntrySchema =
|
|
3442
|
+
var logEntrySchema = z25.object({
|
|
3346
3443
|
timestamp: timestampSchema,
|
|
3347
|
-
type:
|
|
3348
|
-
level:
|
|
3349
|
-
message:
|
|
3350
|
-
metadata:
|
|
3444
|
+
type: z25.enum(["agent", "system", "network"]),
|
|
3445
|
+
level: z25.enum(["debug", "info", "warn", "error"]),
|
|
3446
|
+
message: z25.string(),
|
|
3447
|
+
metadata: z25.record(z25.string(), z25.unknown()).optional()
|
|
3351
3448
|
});
|
|
3352
3449
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
3353
3450
|
var logsQuerySchema = listQuerySchema.extend({
|
|
3354
|
-
type:
|
|
3451
|
+
type: z25.enum(["agent", "system", "network", "all"]).default("all"),
|
|
3355
3452
|
since: timestampSchema.optional(),
|
|
3356
3453
|
until: timestampSchema.optional(),
|
|
3357
|
-
order:
|
|
3454
|
+
order: z25.enum(["asc", "desc"]).default("asc")
|
|
3358
3455
|
});
|
|
3359
|
-
var publicRunLogsContract =
|
|
3456
|
+
var publicRunLogsContract = c21.router({
|
|
3360
3457
|
getLogs: {
|
|
3361
3458
|
method: "GET",
|
|
3362
3459
|
path: "/v1/runs/:id/logs",
|
|
3363
3460
|
headers: authHeadersSchema,
|
|
3364
|
-
pathParams:
|
|
3365
|
-
id:
|
|
3461
|
+
pathParams: z25.object({
|
|
3462
|
+
id: z25.string().min(1, "Run ID is required")
|
|
3366
3463
|
}),
|
|
3367
3464
|
query: logsQuerySchema,
|
|
3368
3465
|
responses: {
|
|
@@ -3375,30 +3472,30 @@ var publicRunLogsContract = c20.router({
|
|
|
3375
3472
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
3376
3473
|
}
|
|
3377
3474
|
});
|
|
3378
|
-
var metricPointSchema =
|
|
3475
|
+
var metricPointSchema = z25.object({
|
|
3379
3476
|
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:
|
|
3477
|
+
cpuPercent: z25.number(),
|
|
3478
|
+
memoryUsedMb: z25.number(),
|
|
3479
|
+
memoryTotalMb: z25.number(),
|
|
3480
|
+
diskUsedMb: z25.number(),
|
|
3481
|
+
diskTotalMb: z25.number()
|
|
3482
|
+
});
|
|
3483
|
+
var metricsSummarySchema = z25.object({
|
|
3484
|
+
avgCpuPercent: z25.number(),
|
|
3485
|
+
maxMemoryUsedMb: z25.number(),
|
|
3486
|
+
totalDurationMs: z25.number().nullable()
|
|
3487
|
+
});
|
|
3488
|
+
var metricsResponseSchema2 = z25.object({
|
|
3489
|
+
data: z25.array(metricPointSchema),
|
|
3393
3490
|
summary: metricsSummarySchema
|
|
3394
3491
|
});
|
|
3395
|
-
var publicRunMetricsContract =
|
|
3492
|
+
var publicRunMetricsContract = c21.router({
|
|
3396
3493
|
getMetrics: {
|
|
3397
3494
|
method: "GET",
|
|
3398
3495
|
path: "/v1/runs/:id/metrics",
|
|
3399
3496
|
headers: authHeadersSchema,
|
|
3400
|
-
pathParams:
|
|
3401
|
-
id:
|
|
3497
|
+
pathParams: z25.object({
|
|
3498
|
+
id: z25.string().min(1, "Run ID is required")
|
|
3402
3499
|
}),
|
|
3403
3500
|
responses: {
|
|
3404
3501
|
200: metricsResponseSchema2,
|
|
@@ -3410,7 +3507,7 @@ var publicRunMetricsContract = c20.router({
|
|
|
3410
3507
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
3411
3508
|
}
|
|
3412
3509
|
});
|
|
3413
|
-
var sseEventTypeSchema =
|
|
3510
|
+
var sseEventTypeSchema = z25.enum([
|
|
3414
3511
|
"status",
|
|
3415
3512
|
// Run status change
|
|
3416
3513
|
"output",
|
|
@@ -3422,26 +3519,26 @@ var sseEventTypeSchema = z24.enum([
|
|
|
3422
3519
|
"heartbeat"
|
|
3423
3520
|
// Keep-alive
|
|
3424
3521
|
]);
|
|
3425
|
-
var sseEventSchema =
|
|
3522
|
+
var sseEventSchema = z25.object({
|
|
3426
3523
|
event: sseEventTypeSchema,
|
|
3427
|
-
data:
|
|
3428
|
-
id:
|
|
3524
|
+
data: z25.unknown(),
|
|
3525
|
+
id: z25.string().optional()
|
|
3429
3526
|
// For Last-Event-ID reconnection
|
|
3430
3527
|
});
|
|
3431
|
-
var publicRunEventsContract =
|
|
3528
|
+
var publicRunEventsContract = c21.router({
|
|
3432
3529
|
streamEvents: {
|
|
3433
3530
|
method: "GET",
|
|
3434
3531
|
path: "/v1/runs/:id/events",
|
|
3435
3532
|
headers: authHeadersSchema,
|
|
3436
|
-
pathParams:
|
|
3437
|
-
id:
|
|
3533
|
+
pathParams: z25.object({
|
|
3534
|
+
id: z25.string().min(1, "Run ID is required")
|
|
3438
3535
|
}),
|
|
3439
|
-
query:
|
|
3440
|
-
lastEventId:
|
|
3536
|
+
query: z25.object({
|
|
3537
|
+
lastEventId: z25.string().optional()
|
|
3441
3538
|
// For reconnection
|
|
3442
3539
|
}),
|
|
3443
3540
|
responses: {
|
|
3444
|
-
200:
|
|
3541
|
+
200: z25.any(),
|
|
3445
3542
|
// SSE stream - actual content is text/event-stream
|
|
3446
3543
|
401: publicApiErrorSchema,
|
|
3447
3544
|
404: publicApiErrorSchema,
|
|
@@ -3453,28 +3550,28 @@ var publicRunEventsContract = c20.router({
|
|
|
3453
3550
|
});
|
|
3454
3551
|
|
|
3455
3552
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
3456
|
-
import { z as
|
|
3457
|
-
var
|
|
3458
|
-
var publicArtifactSchema =
|
|
3459
|
-
id:
|
|
3460
|
-
name:
|
|
3461
|
-
currentVersionId:
|
|
3462
|
-
size:
|
|
3553
|
+
import { z as z26 } from "zod";
|
|
3554
|
+
var c22 = initContract();
|
|
3555
|
+
var publicArtifactSchema = z26.object({
|
|
3556
|
+
id: z26.string(),
|
|
3557
|
+
name: z26.string(),
|
|
3558
|
+
currentVersionId: z26.string().nullable(),
|
|
3559
|
+
size: z26.number(),
|
|
3463
3560
|
// Total size in bytes
|
|
3464
|
-
fileCount:
|
|
3561
|
+
fileCount: z26.number(),
|
|
3465
3562
|
createdAt: timestampSchema,
|
|
3466
3563
|
updatedAt: timestampSchema
|
|
3467
3564
|
});
|
|
3468
|
-
var artifactVersionSchema =
|
|
3469
|
-
id:
|
|
3565
|
+
var artifactVersionSchema = z26.object({
|
|
3566
|
+
id: z26.string(),
|
|
3470
3567
|
// SHA-256 content hash
|
|
3471
|
-
artifactId:
|
|
3472
|
-
size:
|
|
3568
|
+
artifactId: z26.string(),
|
|
3569
|
+
size: z26.number(),
|
|
3473
3570
|
// Size in bytes
|
|
3474
|
-
fileCount:
|
|
3475
|
-
message:
|
|
3571
|
+
fileCount: z26.number(),
|
|
3572
|
+
message: z26.string().nullable(),
|
|
3476
3573
|
// Optional commit message
|
|
3477
|
-
createdBy:
|
|
3574
|
+
createdBy: z26.string(),
|
|
3478
3575
|
createdAt: timestampSchema
|
|
3479
3576
|
});
|
|
3480
3577
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -3484,7 +3581,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
3484
3581
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
3485
3582
|
artifactVersionSchema
|
|
3486
3583
|
);
|
|
3487
|
-
var publicArtifactsListContract =
|
|
3584
|
+
var publicArtifactsListContract = c22.router({
|
|
3488
3585
|
list: {
|
|
3489
3586
|
method: "GET",
|
|
3490
3587
|
path: "/v1/artifacts",
|
|
@@ -3499,13 +3596,13 @@ var publicArtifactsListContract = c21.router({
|
|
|
3499
3596
|
description: "List all artifacts in the current scope with pagination"
|
|
3500
3597
|
}
|
|
3501
3598
|
});
|
|
3502
|
-
var publicArtifactByIdContract =
|
|
3599
|
+
var publicArtifactByIdContract = c22.router({
|
|
3503
3600
|
get: {
|
|
3504
3601
|
method: "GET",
|
|
3505
3602
|
path: "/v1/artifacts/:id",
|
|
3506
3603
|
headers: authHeadersSchema,
|
|
3507
|
-
pathParams:
|
|
3508
|
-
id:
|
|
3604
|
+
pathParams: z26.object({
|
|
3605
|
+
id: z26.string().min(1, "Artifact ID is required")
|
|
3509
3606
|
}),
|
|
3510
3607
|
responses: {
|
|
3511
3608
|
200: publicArtifactDetailSchema,
|
|
@@ -3517,13 +3614,13 @@ var publicArtifactByIdContract = c21.router({
|
|
|
3517
3614
|
description: "Get artifact details by ID"
|
|
3518
3615
|
}
|
|
3519
3616
|
});
|
|
3520
|
-
var publicArtifactVersionsContract =
|
|
3617
|
+
var publicArtifactVersionsContract = c22.router({
|
|
3521
3618
|
list: {
|
|
3522
3619
|
method: "GET",
|
|
3523
3620
|
path: "/v1/artifacts/:id/versions",
|
|
3524
3621
|
headers: authHeadersSchema,
|
|
3525
|
-
pathParams:
|
|
3526
|
-
id:
|
|
3622
|
+
pathParams: z26.object({
|
|
3623
|
+
id: z26.string().min(1, "Artifact ID is required")
|
|
3527
3624
|
}),
|
|
3528
3625
|
query: listQuerySchema,
|
|
3529
3626
|
responses: {
|
|
@@ -3536,20 +3633,20 @@ var publicArtifactVersionsContract = c21.router({
|
|
|
3536
3633
|
description: "List all versions of an artifact with pagination"
|
|
3537
3634
|
}
|
|
3538
3635
|
});
|
|
3539
|
-
var publicArtifactDownloadContract =
|
|
3636
|
+
var publicArtifactDownloadContract = c22.router({
|
|
3540
3637
|
download: {
|
|
3541
3638
|
method: "GET",
|
|
3542
3639
|
path: "/v1/artifacts/:id/download",
|
|
3543
3640
|
headers: authHeadersSchema,
|
|
3544
|
-
pathParams:
|
|
3545
|
-
id:
|
|
3641
|
+
pathParams: z26.object({
|
|
3642
|
+
id: z26.string().min(1, "Artifact ID is required")
|
|
3546
3643
|
}),
|
|
3547
|
-
query:
|
|
3548
|
-
versionId:
|
|
3644
|
+
query: z26.object({
|
|
3645
|
+
versionId: z26.string().optional()
|
|
3549
3646
|
// Defaults to current version
|
|
3550
3647
|
}),
|
|
3551
3648
|
responses: {
|
|
3552
|
-
302:
|
|
3649
|
+
302: z26.undefined(),
|
|
3553
3650
|
// Redirect to presigned URL
|
|
3554
3651
|
401: publicApiErrorSchema,
|
|
3555
3652
|
404: publicApiErrorSchema,
|
|
@@ -3561,28 +3658,28 @@ var publicArtifactDownloadContract = c21.router({
|
|
|
3561
3658
|
});
|
|
3562
3659
|
|
|
3563
3660
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
3564
|
-
import { z as
|
|
3565
|
-
var
|
|
3566
|
-
var publicVolumeSchema =
|
|
3567
|
-
id:
|
|
3568
|
-
name:
|
|
3569
|
-
currentVersionId:
|
|
3570
|
-
size:
|
|
3661
|
+
import { z as z27 } from "zod";
|
|
3662
|
+
var c23 = initContract();
|
|
3663
|
+
var publicVolumeSchema = z27.object({
|
|
3664
|
+
id: z27.string(),
|
|
3665
|
+
name: z27.string(),
|
|
3666
|
+
currentVersionId: z27.string().nullable(),
|
|
3667
|
+
size: z27.number(),
|
|
3571
3668
|
// Total size in bytes
|
|
3572
|
-
fileCount:
|
|
3669
|
+
fileCount: z27.number(),
|
|
3573
3670
|
createdAt: timestampSchema,
|
|
3574
3671
|
updatedAt: timestampSchema
|
|
3575
3672
|
});
|
|
3576
|
-
var volumeVersionSchema =
|
|
3577
|
-
id:
|
|
3673
|
+
var volumeVersionSchema = z27.object({
|
|
3674
|
+
id: z27.string(),
|
|
3578
3675
|
// SHA-256 content hash
|
|
3579
|
-
volumeId:
|
|
3580
|
-
size:
|
|
3676
|
+
volumeId: z27.string(),
|
|
3677
|
+
size: z27.number(),
|
|
3581
3678
|
// Size in bytes
|
|
3582
|
-
fileCount:
|
|
3583
|
-
message:
|
|
3679
|
+
fileCount: z27.number(),
|
|
3680
|
+
message: z27.string().nullable(),
|
|
3584
3681
|
// Optional commit message
|
|
3585
|
-
createdBy:
|
|
3682
|
+
createdBy: z27.string(),
|
|
3586
3683
|
createdAt: timestampSchema
|
|
3587
3684
|
});
|
|
3588
3685
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -3590,7 +3687,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
3590
3687
|
});
|
|
3591
3688
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
3592
3689
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
3593
|
-
var publicVolumesListContract =
|
|
3690
|
+
var publicVolumesListContract = c23.router({
|
|
3594
3691
|
list: {
|
|
3595
3692
|
method: "GET",
|
|
3596
3693
|
path: "/v1/volumes",
|
|
@@ -3605,13 +3702,13 @@ var publicVolumesListContract = c22.router({
|
|
|
3605
3702
|
description: "List all volumes in the current scope with pagination"
|
|
3606
3703
|
}
|
|
3607
3704
|
});
|
|
3608
|
-
var publicVolumeByIdContract =
|
|
3705
|
+
var publicVolumeByIdContract = c23.router({
|
|
3609
3706
|
get: {
|
|
3610
3707
|
method: "GET",
|
|
3611
3708
|
path: "/v1/volumes/:id",
|
|
3612
3709
|
headers: authHeadersSchema,
|
|
3613
|
-
pathParams:
|
|
3614
|
-
id:
|
|
3710
|
+
pathParams: z27.object({
|
|
3711
|
+
id: z27.string().min(1, "Volume ID is required")
|
|
3615
3712
|
}),
|
|
3616
3713
|
responses: {
|
|
3617
3714
|
200: publicVolumeDetailSchema,
|
|
@@ -3623,13 +3720,13 @@ var publicVolumeByIdContract = c22.router({
|
|
|
3623
3720
|
description: "Get volume details by ID"
|
|
3624
3721
|
}
|
|
3625
3722
|
});
|
|
3626
|
-
var publicVolumeVersionsContract =
|
|
3723
|
+
var publicVolumeVersionsContract = c23.router({
|
|
3627
3724
|
list: {
|
|
3628
3725
|
method: "GET",
|
|
3629
3726
|
path: "/v1/volumes/:id/versions",
|
|
3630
3727
|
headers: authHeadersSchema,
|
|
3631
|
-
pathParams:
|
|
3632
|
-
id:
|
|
3728
|
+
pathParams: z27.object({
|
|
3729
|
+
id: z27.string().min(1, "Volume ID is required")
|
|
3633
3730
|
}),
|
|
3634
3731
|
query: listQuerySchema,
|
|
3635
3732
|
responses: {
|
|
@@ -3642,20 +3739,20 @@ var publicVolumeVersionsContract = c22.router({
|
|
|
3642
3739
|
description: "List all versions of a volume with pagination"
|
|
3643
3740
|
}
|
|
3644
3741
|
});
|
|
3645
|
-
var publicVolumeDownloadContract =
|
|
3742
|
+
var publicVolumeDownloadContract = c23.router({
|
|
3646
3743
|
download: {
|
|
3647
3744
|
method: "GET",
|
|
3648
3745
|
path: "/v1/volumes/:id/download",
|
|
3649
3746
|
headers: authHeadersSchema,
|
|
3650
|
-
pathParams:
|
|
3651
|
-
id:
|
|
3747
|
+
pathParams: z27.object({
|
|
3748
|
+
id: z27.string().min(1, "Volume ID is required")
|
|
3652
3749
|
}),
|
|
3653
|
-
query:
|
|
3654
|
-
versionId:
|
|
3750
|
+
query: z27.object({
|
|
3751
|
+
versionId: z27.string().optional()
|
|
3655
3752
|
// Defaults to current version
|
|
3656
3753
|
}),
|
|
3657
3754
|
responses: {
|
|
3658
|
-
302:
|
|
3755
|
+
302: z27.undefined(),
|
|
3659
3756
|
// Redirect to presigned URL
|
|
3660
3757
|
401: publicApiErrorSchema,
|
|
3661
3758
|
404: publicApiErrorSchema,
|
|
@@ -4373,8 +4470,8 @@ async function getUsage(options) {
|
|
|
4373
4470
|
}
|
|
4374
4471
|
|
|
4375
4472
|
// src/lib/domain/yaml-validator.ts
|
|
4376
|
-
import { z as
|
|
4377
|
-
var cliAgentNameSchema =
|
|
4473
|
+
import { z as z28 } from "zod";
|
|
4474
|
+
var cliAgentNameSchema = z28.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
4378
4475
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
4379
4476
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
4380
4477
|
);
|
|
@@ -4389,7 +4486,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4389
4486
|
const skillUrl = agent.skills[i];
|
|
4390
4487
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
4391
4488
|
ctx.addIssue({
|
|
4392
|
-
code:
|
|
4489
|
+
code: z28.ZodIssueCode.custom,
|
|
4393
4490
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
4394
4491
|
path: ["skills", i]
|
|
4395
4492
|
});
|
|
@@ -4398,15 +4495,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4398
4495
|
}
|
|
4399
4496
|
}
|
|
4400
4497
|
);
|
|
4401
|
-
var cliComposeSchema =
|
|
4402
|
-
version:
|
|
4403
|
-
agents:
|
|
4404
|
-
volumes:
|
|
4498
|
+
var cliComposeSchema = z28.object({
|
|
4499
|
+
version: z28.string().min(1, "Missing config.version"),
|
|
4500
|
+
agents: z28.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
4501
|
+
volumes: z28.record(z28.string(), volumeConfigSchema).optional()
|
|
4405
4502
|
}).superRefine((config, ctx) => {
|
|
4406
4503
|
const agentKeys = Object.keys(config.agents);
|
|
4407
4504
|
if (agentKeys.length === 0) {
|
|
4408
4505
|
ctx.addIssue({
|
|
4409
|
-
code:
|
|
4506
|
+
code: z28.ZodIssueCode.custom,
|
|
4410
4507
|
message: "agents must have at least one agent defined",
|
|
4411
4508
|
path: ["agents"]
|
|
4412
4509
|
});
|
|
@@ -4414,7 +4511,7 @@ var cliComposeSchema = z27.object({
|
|
|
4414
4511
|
}
|
|
4415
4512
|
if (agentKeys.length > 1) {
|
|
4416
4513
|
ctx.addIssue({
|
|
4417
|
-
code:
|
|
4514
|
+
code: z28.ZodIssueCode.custom,
|
|
4418
4515
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
4419
4516
|
path: ["agents"]
|
|
4420
4517
|
});
|
|
@@ -4426,7 +4523,7 @@ var cliComposeSchema = z27.object({
|
|
|
4426
4523
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
4427
4524
|
if (!config.volumes) {
|
|
4428
4525
|
ctx.addIssue({
|
|
4429
|
-
code:
|
|
4526
|
+
code: z28.ZodIssueCode.custom,
|
|
4430
4527
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
4431
4528
|
path: ["volumes"]
|
|
4432
4529
|
});
|
|
@@ -4436,7 +4533,7 @@ var cliComposeSchema = z27.object({
|
|
|
4436
4533
|
const parts = volDeclaration.split(":");
|
|
4437
4534
|
if (parts.length !== 2) {
|
|
4438
4535
|
ctx.addIssue({
|
|
4439
|
-
code:
|
|
4536
|
+
code: z28.ZodIssueCode.custom,
|
|
4440
4537
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
4441
4538
|
path: ["agents", agentName, "volumes"]
|
|
4442
4539
|
});
|
|
@@ -4445,7 +4542,7 @@ var cliComposeSchema = z27.object({
|
|
|
4445
4542
|
const volumeKey = parts[0].trim();
|
|
4446
4543
|
if (!config.volumes[volumeKey]) {
|
|
4447
4544
|
ctx.addIssue({
|
|
4448
|
-
code:
|
|
4545
|
+
code: z28.ZodIssueCode.custom,
|
|
4449
4546
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
4450
4547
|
path: ["volumes", volumeKey]
|
|
4451
4548
|
});
|
|
@@ -5614,7 +5711,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5614
5711
|
);
|
|
5615
5712
|
}
|
|
5616
5713
|
if (options.autoUpdate !== false) {
|
|
5617
|
-
await silentUpgradeAfterCommand("9.
|
|
5714
|
+
await silentUpgradeAfterCommand("9.23.0");
|
|
5618
5715
|
}
|
|
5619
5716
|
return result;
|
|
5620
5717
|
}
|
|
@@ -6077,8 +6174,8 @@ var EventRenderer = class _EventRenderer {
|
|
|
6077
6174
|
/**
|
|
6078
6175
|
* Format timestamp for display (without milliseconds, matching metrics format)
|
|
6079
6176
|
*/
|
|
6080
|
-
static formatTimestamp(
|
|
6081
|
-
return
|
|
6177
|
+
static formatTimestamp(timestamp2) {
|
|
6178
|
+
return timestamp2.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
6082
6179
|
}
|
|
6083
6180
|
/**
|
|
6084
6181
|
* Render a parsed event to console
|
|
@@ -6551,9 +6648,9 @@ var CodexEventParser = class {
|
|
|
6551
6648
|
}
|
|
6552
6649
|
}
|
|
6553
6650
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6554
|
-
const changes = item.changes.map((
|
|
6555
|
-
const action =
|
|
6556
|
-
return `${action}: ${
|
|
6651
|
+
const changes = item.changes.map((c24) => {
|
|
6652
|
+
const action = c24.kind === "add" ? "Created" : c24.kind === "modify" ? "Modified" : "Deleted";
|
|
6653
|
+
return `${action}: ${c24.path}`;
|
|
6557
6654
|
}).join("\n");
|
|
6558
6655
|
return {
|
|
6559
6656
|
type: "text",
|
|
@@ -6707,9 +6804,9 @@ var CodexEventRenderer = class {
|
|
|
6707
6804
|
return;
|
|
6708
6805
|
}
|
|
6709
6806
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6710
|
-
const summary = item.changes.map((
|
|
6711
|
-
const icon =
|
|
6712
|
-
return `${icon}${
|
|
6807
|
+
const summary = item.changes.map((c24) => {
|
|
6808
|
+
const icon = c24.kind === "add" ? "+" : c24.kind === "delete" ? "-" : "~";
|
|
6809
|
+
return `${icon}${c24.path}`;
|
|
6713
6810
|
}).join(", ");
|
|
6714
6811
|
console.log(chalk7.green("[files]") + ` ${summary}`);
|
|
6715
6812
|
return;
|
|
@@ -8056,7 +8153,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8056
8153
|
}
|
|
8057
8154
|
showNextSteps(result);
|
|
8058
8155
|
if (options.autoUpdate !== false) {
|
|
8059
|
-
await silentUpgradeAfterCommand("9.
|
|
8156
|
+
await silentUpgradeAfterCommand("9.23.0");
|
|
8060
8157
|
}
|
|
8061
8158
|
} catch (error) {
|
|
8062
8159
|
handleRunError(error, identifier);
|
|
@@ -9563,7 +9660,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9563
9660
|
).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
9661
|
async (prompt, options) => {
|
|
9565
9662
|
if (options.autoUpdate !== false) {
|
|
9566
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9663
|
+
const shouldExit = await checkAndUpgrade("9.23.0", prompt);
|
|
9567
9664
|
if (shouldExit) {
|
|
9568
9665
|
process.exit(0);
|
|
9569
9666
|
}
|
|
@@ -9763,11 +9860,11 @@ function parseTime(timeStr) {
|
|
|
9763
9860
|
return parseRelativeTime(value, unit);
|
|
9764
9861
|
}
|
|
9765
9862
|
if (/^\d+$/.test(timeStr)) {
|
|
9766
|
-
const
|
|
9767
|
-
if (
|
|
9768
|
-
return
|
|
9863
|
+
const timestamp2 = parseInt(timeStr, 10);
|
|
9864
|
+
if (timestamp2 < 1e10) {
|
|
9865
|
+
return timestamp2 * 1e3;
|
|
9769
9866
|
}
|
|
9770
|
-
return
|
|
9867
|
+
return timestamp2;
|
|
9771
9868
|
}
|
|
9772
9869
|
const date = new Date(timeStr);
|
|
9773
9870
|
if (!isNaN(date.getTime())) {
|
|
@@ -10278,7 +10375,7 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10278
10375
|
);
|
|
10279
10376
|
return;
|
|
10280
10377
|
}
|
|
10281
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
10378
|
+
const nameWidth = Math.max(4, ...data.composes.map((c24) => c24.name.length));
|
|
10282
10379
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
10283
10380
|
" "
|
|
10284
10381
|
);
|
|
@@ -11252,7 +11349,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
11252
11349
|
);
|
|
11253
11350
|
process.exit(1);
|
|
11254
11351
|
}
|
|
11255
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
11352
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c24) => c24.value === existingFrequency) : 0;
|
|
11256
11353
|
frequency = await promptSelect(
|
|
11257
11354
|
"Schedule frequency",
|
|
11258
11355
|
FREQUENCY_CHOICES,
|
|
@@ -11281,7 +11378,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11281
11378
|
process.exit(1);
|
|
11282
11379
|
}
|
|
11283
11380
|
if (frequency === "weekly") {
|
|
11284
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
11381
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c24) => c24.value === existingDay) : 0;
|
|
11285
11382
|
const day2 = await promptSelect(
|
|
11286
11383
|
"Day of week",
|
|
11287
11384
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -13464,16 +13561,16 @@ async function handleModelProvider(ctx) {
|
|
|
13464
13561
|
const providerType = await step.prompt(
|
|
13465
13562
|
() => promptSelect(
|
|
13466
13563
|
"Select provider type:",
|
|
13467
|
-
choices.map((
|
|
13468
|
-
title:
|
|
13469
|
-
value:
|
|
13564
|
+
choices.map((c24) => ({
|
|
13565
|
+
title: c24.label,
|
|
13566
|
+
value: c24.type
|
|
13470
13567
|
}))
|
|
13471
13568
|
)
|
|
13472
13569
|
);
|
|
13473
13570
|
if (!providerType) {
|
|
13474
13571
|
process.exit(0);
|
|
13475
13572
|
}
|
|
13476
|
-
const selectedChoice = choices.find((
|
|
13573
|
+
const selectedChoice = choices.find((c24) => c24.type === providerType);
|
|
13477
13574
|
if (selectedChoice?.helpText) {
|
|
13478
13575
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
13479
13576
|
step.detail(chalk66.dim(line));
|
|
@@ -13659,9 +13756,168 @@ var setupClaudeCommand = new Command67().name("setup-claude").description("Insta
|
|
|
13659
13756
|
);
|
|
13660
13757
|
});
|
|
13661
13758
|
|
|
13759
|
+
// src/commands/dev-tool/index.ts
|
|
13760
|
+
import { Command as Command69 } from "commander";
|
|
13761
|
+
|
|
13762
|
+
// src/commands/dev-tool/compose.ts
|
|
13763
|
+
import { Command as Command68 } from "commander";
|
|
13764
|
+
import chalk68 from "chalk";
|
|
13765
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
13766
|
+
function sleep2(ms) {
|
|
13767
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13768
|
+
}
|
|
13769
|
+
function timestamp() {
|
|
13770
|
+
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false });
|
|
13771
|
+
}
|
|
13772
|
+
async function createComposeJob(githubUrl, overwrite) {
|
|
13773
|
+
const config = await getClientConfig();
|
|
13774
|
+
const client = initClient11(composeJobsMainContract, config);
|
|
13775
|
+
const result = await client.create({
|
|
13776
|
+
body: { githubUrl, overwrite }
|
|
13777
|
+
});
|
|
13778
|
+
if (result.status === 200 || result.status === 201) {
|
|
13779
|
+
return {
|
|
13780
|
+
jobId: result.body.jobId,
|
|
13781
|
+
status: result.body.status
|
|
13782
|
+
};
|
|
13783
|
+
}
|
|
13784
|
+
if (result.status === 400 || result.status === 401) {
|
|
13785
|
+
throw new Error(result.body.error.message);
|
|
13786
|
+
}
|
|
13787
|
+
throw new Error(`Unexpected response: ${result.status}`);
|
|
13788
|
+
}
|
|
13789
|
+
async function getComposeJobStatus(jobId) {
|
|
13790
|
+
const config = await getClientConfig();
|
|
13791
|
+
const client = initClient11(composeJobsByIdContract, config);
|
|
13792
|
+
const result = await client.getById({
|
|
13793
|
+
params: { jobId }
|
|
13794
|
+
});
|
|
13795
|
+
if (result.status === 200) {
|
|
13796
|
+
return {
|
|
13797
|
+
status: result.body.status,
|
|
13798
|
+
result: result.body.result,
|
|
13799
|
+
error: result.body.error
|
|
13800
|
+
};
|
|
13801
|
+
}
|
|
13802
|
+
if (result.status === 404) {
|
|
13803
|
+
throw new Error(`Job not found: ${jobId}`);
|
|
13804
|
+
}
|
|
13805
|
+
if (result.status === 401) {
|
|
13806
|
+
throw new Error(result.body.error.message);
|
|
13807
|
+
}
|
|
13808
|
+
throw new Error(`Unexpected response: ${result.status}`);
|
|
13809
|
+
}
|
|
13810
|
+
async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
13811
|
+
const startTime = Date.now();
|
|
13812
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
13813
|
+
const job = await getComposeJobStatus(jobId);
|
|
13814
|
+
if (!jsonMode) {
|
|
13815
|
+
console.log(
|
|
13816
|
+
chalk68.dim(`[${timestamp()}] Polling... status=${job.status}`)
|
|
13817
|
+
);
|
|
13818
|
+
}
|
|
13819
|
+
if (job.status === "completed" || job.status === "failed") {
|
|
13820
|
+
return job;
|
|
13821
|
+
}
|
|
13822
|
+
await sleep2(intervalMs);
|
|
13823
|
+
}
|
|
13824
|
+
throw new Error(`Timeout after ${timeoutMs / 1e3} seconds`);
|
|
13825
|
+
}
|
|
13826
|
+
var composeCommand2 = new Command68().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
|
+
"--interval <seconds>",
|
|
13828
|
+
"Polling interval in seconds",
|
|
13829
|
+
(v) => parseInt(v, 10),
|
|
13830
|
+
5
|
|
13831
|
+
).option(
|
|
13832
|
+
"--timeout <seconds>",
|
|
13833
|
+
"Maximum wait time in seconds",
|
|
13834
|
+
(v) => parseInt(v, 10),
|
|
13835
|
+
300
|
|
13836
|
+
).option("--json", "Output result as JSON").action(
|
|
13837
|
+
async (githubUrl, options) => {
|
|
13838
|
+
const intervalMs = options.interval * 1e3;
|
|
13839
|
+
const timeoutMs = options.timeout * 1e3;
|
|
13840
|
+
try {
|
|
13841
|
+
if (!options.json) {
|
|
13842
|
+
console.log("Creating compose job...");
|
|
13843
|
+
}
|
|
13844
|
+
const { jobId, status: initialStatus } = await createComposeJob(
|
|
13845
|
+
githubUrl,
|
|
13846
|
+
options.overwrite
|
|
13847
|
+
);
|
|
13848
|
+
if (!options.json) {
|
|
13849
|
+
console.log(`Job ID: ${chalk68.cyan(jobId)}`);
|
|
13850
|
+
console.log();
|
|
13851
|
+
}
|
|
13852
|
+
if (initialStatus === "completed" || initialStatus === "failed") {
|
|
13853
|
+
const finalJob2 = await getComposeJobStatus(jobId);
|
|
13854
|
+
if (options.json) {
|
|
13855
|
+
console.log(JSON.stringify(finalJob2, null, 2));
|
|
13856
|
+
} else {
|
|
13857
|
+
displayResult(finalJob2);
|
|
13858
|
+
}
|
|
13859
|
+
process.exit(finalJob2.status === "completed" ? 0 : 1);
|
|
13860
|
+
}
|
|
13861
|
+
const finalJob = await pollUntilComplete(
|
|
13862
|
+
jobId,
|
|
13863
|
+
intervalMs,
|
|
13864
|
+
timeoutMs,
|
|
13865
|
+
!!options.json
|
|
13866
|
+
);
|
|
13867
|
+
if (options.json) {
|
|
13868
|
+
console.log(JSON.stringify(finalJob, null, 2));
|
|
13869
|
+
} else {
|
|
13870
|
+
console.log();
|
|
13871
|
+
displayResult(finalJob);
|
|
13872
|
+
}
|
|
13873
|
+
process.exit(finalJob.status === "completed" ? 0 : 1);
|
|
13874
|
+
} catch (error) {
|
|
13875
|
+
if (options.json) {
|
|
13876
|
+
console.log(
|
|
13877
|
+
JSON.stringify({
|
|
13878
|
+
error: error instanceof Error ? error.message : String(error)
|
|
13879
|
+
})
|
|
13880
|
+
);
|
|
13881
|
+
} else {
|
|
13882
|
+
console.error(
|
|
13883
|
+
chalk68.red(
|
|
13884
|
+
`\u2717 ${error instanceof Error ? error.message : String(error)}`
|
|
13885
|
+
)
|
|
13886
|
+
);
|
|
13887
|
+
}
|
|
13888
|
+
process.exit(1);
|
|
13889
|
+
}
|
|
13890
|
+
}
|
|
13891
|
+
);
|
|
13892
|
+
function displayResult(job) {
|
|
13893
|
+
if (job.status === "completed" && job.result) {
|
|
13894
|
+
console.log(chalk68.green("\u2713 Compose completed!"));
|
|
13895
|
+
console.log(` Compose ID: ${chalk68.cyan(job.result.composeId)}`);
|
|
13896
|
+
console.log(` Name: ${chalk68.cyan(job.result.composeName)}`);
|
|
13897
|
+
console.log(` Version: ${chalk68.cyan(job.result.versionId.slice(0, 8))}`);
|
|
13898
|
+
if (job.result.warnings.length > 0) {
|
|
13899
|
+
console.log();
|
|
13900
|
+
console.log(chalk68.yellow(" Warnings:"));
|
|
13901
|
+
for (const warning of job.result.warnings) {
|
|
13902
|
+
console.log(chalk68.yellow(` - ${warning}`));
|
|
13903
|
+
}
|
|
13904
|
+
}
|
|
13905
|
+
} else if (job.status === "failed") {
|
|
13906
|
+
console.log(chalk68.red("\u2717 Compose failed!"));
|
|
13907
|
+
if (job.error) {
|
|
13908
|
+
console.log(` Error: ${chalk68.red(job.error)}`);
|
|
13909
|
+
}
|
|
13910
|
+
} else {
|
|
13911
|
+
console.log(`Status: ${job.status}`);
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13914
|
+
|
|
13915
|
+
// src/commands/dev-tool/index.ts
|
|
13916
|
+
var devToolCommand = new Command69().name("dev-tool").description("Developer tools for testing and debugging").addCommand(composeCommand2);
|
|
13917
|
+
|
|
13662
13918
|
// src/index.ts
|
|
13663
|
-
var program = new
|
|
13664
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
13919
|
+
var program = new Command70();
|
|
13920
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.23.0");
|
|
13665
13921
|
program.addCommand(authCommand);
|
|
13666
13922
|
program.addCommand(infoCommand);
|
|
13667
13923
|
program.addCommand(composeCommand);
|
|
@@ -13680,6 +13936,7 @@ program.addCommand(variableCommand);
|
|
|
13680
13936
|
program.addCommand(modelProviderCommand);
|
|
13681
13937
|
program.addCommand(onboardCommand);
|
|
13682
13938
|
program.addCommand(setupClaudeCommand);
|
|
13939
|
+
program.addCommand(devToolCommand, { hidden: true });
|
|
13683
13940
|
if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
|
|
13684
13941
|
program.parse();
|
|
13685
13942
|
}
|