@vm0/cli 9.17.2 → 9.19.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 +1318 -822
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command68 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth/index.ts
|
|
7
7
|
import { Command as Command5 } from "commander";
|
|
@@ -1987,9 +1987,108 @@ var secretsByNameContract = c11.router({
|
|
|
1987
1987
|
}
|
|
1988
1988
|
});
|
|
1989
1989
|
|
|
1990
|
-
// ../../packages/core/src/contracts/
|
|
1990
|
+
// ../../packages/core/src/contracts/variables.ts
|
|
1991
1991
|
import { z as z15 } from "zod";
|
|
1992
1992
|
var c12 = initContract();
|
|
1993
|
+
var variableNameSchema = z15.string().min(1, "Variable name is required").max(255, "Variable name must be at most 255 characters").regex(
|
|
1994
|
+
/^[A-Z][A-Z0-9_]*$/,
|
|
1995
|
+
"Variable name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_VAR)"
|
|
1996
|
+
);
|
|
1997
|
+
var variableResponseSchema = z15.object({
|
|
1998
|
+
id: z15.string().uuid(),
|
|
1999
|
+
name: z15.string(),
|
|
2000
|
+
value: z15.string(),
|
|
2001
|
+
description: z15.string().nullable(),
|
|
2002
|
+
createdAt: z15.string(),
|
|
2003
|
+
updatedAt: z15.string()
|
|
2004
|
+
});
|
|
2005
|
+
var variableListResponseSchema = z15.object({
|
|
2006
|
+
variables: z15.array(variableResponseSchema)
|
|
2007
|
+
});
|
|
2008
|
+
var setVariableRequestSchema = z15.object({
|
|
2009
|
+
name: variableNameSchema,
|
|
2010
|
+
value: z15.string().min(1, "Variable value is required"),
|
|
2011
|
+
description: z15.string().max(1e3).optional()
|
|
2012
|
+
});
|
|
2013
|
+
var variablesMainContract = c12.router({
|
|
2014
|
+
/**
|
|
2015
|
+
* GET /api/variables
|
|
2016
|
+
* List all variables for the current user's scope (includes values)
|
|
2017
|
+
*/
|
|
2018
|
+
list: {
|
|
2019
|
+
method: "GET",
|
|
2020
|
+
path: "/api/variables",
|
|
2021
|
+
headers: authHeadersSchema,
|
|
2022
|
+
responses: {
|
|
2023
|
+
200: variableListResponseSchema,
|
|
2024
|
+
401: apiErrorSchema,
|
|
2025
|
+
500: apiErrorSchema
|
|
2026
|
+
},
|
|
2027
|
+
summary: "List all variables (includes values)"
|
|
2028
|
+
},
|
|
2029
|
+
/**
|
|
2030
|
+
* PUT /api/variables
|
|
2031
|
+
* Create or update a variable
|
|
2032
|
+
*/
|
|
2033
|
+
set: {
|
|
2034
|
+
method: "PUT",
|
|
2035
|
+
path: "/api/variables",
|
|
2036
|
+
headers: authHeadersSchema,
|
|
2037
|
+
body: setVariableRequestSchema,
|
|
2038
|
+
responses: {
|
|
2039
|
+
200: variableResponseSchema,
|
|
2040
|
+
201: variableResponseSchema,
|
|
2041
|
+
400: apiErrorSchema,
|
|
2042
|
+
401: apiErrorSchema,
|
|
2043
|
+
500: apiErrorSchema
|
|
2044
|
+
},
|
|
2045
|
+
summary: "Create or update a variable"
|
|
2046
|
+
}
|
|
2047
|
+
});
|
|
2048
|
+
var variablesByNameContract = c12.router({
|
|
2049
|
+
/**
|
|
2050
|
+
* GET /api/variables/:name
|
|
2051
|
+
* Get a variable by name (includes value)
|
|
2052
|
+
*/
|
|
2053
|
+
get: {
|
|
2054
|
+
method: "GET",
|
|
2055
|
+
path: "/api/variables/:name",
|
|
2056
|
+
headers: authHeadersSchema,
|
|
2057
|
+
pathParams: z15.object({
|
|
2058
|
+
name: variableNameSchema
|
|
2059
|
+
}),
|
|
2060
|
+
responses: {
|
|
2061
|
+
200: variableResponseSchema,
|
|
2062
|
+
401: apiErrorSchema,
|
|
2063
|
+
404: apiErrorSchema,
|
|
2064
|
+
500: apiErrorSchema
|
|
2065
|
+
},
|
|
2066
|
+
summary: "Get variable by name"
|
|
2067
|
+
},
|
|
2068
|
+
/**
|
|
2069
|
+
* DELETE /api/variables/:name
|
|
2070
|
+
* Delete a variable by name
|
|
2071
|
+
*/
|
|
2072
|
+
delete: {
|
|
2073
|
+
method: "DELETE",
|
|
2074
|
+
path: "/api/variables/:name",
|
|
2075
|
+
headers: authHeadersSchema,
|
|
2076
|
+
pathParams: z15.object({
|
|
2077
|
+
name: variableNameSchema
|
|
2078
|
+
}),
|
|
2079
|
+
responses: {
|
|
2080
|
+
204: c12.noBody(),
|
|
2081
|
+
401: apiErrorSchema,
|
|
2082
|
+
404: apiErrorSchema,
|
|
2083
|
+
500: apiErrorSchema
|
|
2084
|
+
},
|
|
2085
|
+
summary: "Delete a variable"
|
|
2086
|
+
}
|
|
2087
|
+
});
|
|
2088
|
+
|
|
2089
|
+
// ../../packages/core/src/contracts/model-providers.ts
|
|
2090
|
+
import { z as z16 } from "zod";
|
|
2091
|
+
var c13 = initContract();
|
|
1993
2092
|
var MODEL_PROVIDER_TYPES = {
|
|
1994
2093
|
"claude-code-oauth-token": {
|
|
1995
2094
|
framework: "claude-code",
|
|
@@ -2210,7 +2309,7 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
2210
2309
|
customModelPlaceholder: "anthropic.claude-sonnet-4-20250514-v1:0"
|
|
2211
2310
|
}
|
|
2212
2311
|
};
|
|
2213
|
-
var modelProviderTypeSchema =
|
|
2312
|
+
var modelProviderTypeSchema = z16.enum([
|
|
2214
2313
|
"claude-code-oauth-token",
|
|
2215
2314
|
"anthropic-api-key",
|
|
2216
2315
|
"openrouter-api-key",
|
|
@@ -2221,7 +2320,7 @@ var modelProviderTypeSchema = z15.enum([
|
|
|
2221
2320
|
"azure-foundry",
|
|
2222
2321
|
"aws-bedrock"
|
|
2223
2322
|
]);
|
|
2224
|
-
var modelProviderFrameworkSchema =
|
|
2323
|
+
var modelProviderFrameworkSchema = z16.enum(["claude-code", "codex"]);
|
|
2225
2324
|
function hasAuthMethods(type) {
|
|
2226
2325
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
2227
2326
|
return "authMethods" in config;
|
|
@@ -2262,45 +2361,45 @@ function getCustomModelPlaceholder(type) {
|
|
|
2262
2361
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
2263
2362
|
return "customModelPlaceholder" in config ? config.customModelPlaceholder : void 0;
|
|
2264
2363
|
}
|
|
2265
|
-
var modelProviderResponseSchema =
|
|
2266
|
-
id:
|
|
2364
|
+
var modelProviderResponseSchema = z16.object({
|
|
2365
|
+
id: z16.string().uuid(),
|
|
2267
2366
|
type: modelProviderTypeSchema,
|
|
2268
2367
|
framework: modelProviderFrameworkSchema,
|
|
2269
|
-
credentialName:
|
|
2368
|
+
credentialName: z16.string().nullable(),
|
|
2270
2369
|
// Legacy single-credential (deprecated for multi-auth)
|
|
2271
|
-
authMethod:
|
|
2370
|
+
authMethod: z16.string().nullable(),
|
|
2272
2371
|
// For multi-auth providers
|
|
2273
|
-
credentialNames:
|
|
2372
|
+
credentialNames: z16.array(z16.string()).nullable(),
|
|
2274
2373
|
// For multi-auth providers
|
|
2275
|
-
isDefault:
|
|
2276
|
-
selectedModel:
|
|
2277
|
-
createdAt:
|
|
2278
|
-
updatedAt:
|
|
2374
|
+
isDefault: z16.boolean(),
|
|
2375
|
+
selectedModel: z16.string().nullable(),
|
|
2376
|
+
createdAt: z16.string(),
|
|
2377
|
+
updatedAt: z16.string()
|
|
2279
2378
|
});
|
|
2280
|
-
var modelProviderListResponseSchema =
|
|
2281
|
-
modelProviders:
|
|
2379
|
+
var modelProviderListResponseSchema = z16.object({
|
|
2380
|
+
modelProviders: z16.array(modelProviderResponseSchema)
|
|
2282
2381
|
});
|
|
2283
|
-
var upsertModelProviderRequestSchema =
|
|
2382
|
+
var upsertModelProviderRequestSchema = z16.object({
|
|
2284
2383
|
type: modelProviderTypeSchema,
|
|
2285
|
-
credential:
|
|
2384
|
+
credential: z16.string().min(1).optional(),
|
|
2286
2385
|
// Legacy single credential
|
|
2287
|
-
authMethod:
|
|
2386
|
+
authMethod: z16.string().optional(),
|
|
2288
2387
|
// For multi-auth providers
|
|
2289
|
-
credentials:
|
|
2388
|
+
credentials: z16.record(z16.string(), z16.string()).optional(),
|
|
2290
2389
|
// For multi-auth providers
|
|
2291
|
-
convert:
|
|
2292
|
-
selectedModel:
|
|
2390
|
+
convert: z16.boolean().optional(),
|
|
2391
|
+
selectedModel: z16.string().optional()
|
|
2293
2392
|
});
|
|
2294
|
-
var upsertModelProviderResponseSchema =
|
|
2393
|
+
var upsertModelProviderResponseSchema = z16.object({
|
|
2295
2394
|
provider: modelProviderResponseSchema,
|
|
2296
|
-
created:
|
|
2395
|
+
created: z16.boolean()
|
|
2297
2396
|
});
|
|
2298
|
-
var checkCredentialResponseSchema =
|
|
2299
|
-
exists:
|
|
2300
|
-
credentialName:
|
|
2301
|
-
currentType:
|
|
2397
|
+
var checkCredentialResponseSchema = z16.object({
|
|
2398
|
+
exists: z16.boolean(),
|
|
2399
|
+
credentialName: z16.string(),
|
|
2400
|
+
currentType: z16.enum(["user", "model-provider"]).optional()
|
|
2302
2401
|
});
|
|
2303
|
-
var modelProvidersMainContract =
|
|
2402
|
+
var modelProvidersMainContract = c13.router({
|
|
2304
2403
|
list: {
|
|
2305
2404
|
method: "GET",
|
|
2306
2405
|
path: "/api/model-providers",
|
|
@@ -2328,12 +2427,12 @@ var modelProvidersMainContract = c12.router({
|
|
|
2328
2427
|
summary: "Create or update a model provider"
|
|
2329
2428
|
}
|
|
2330
2429
|
});
|
|
2331
|
-
var modelProvidersCheckContract =
|
|
2430
|
+
var modelProvidersCheckContract = c13.router({
|
|
2332
2431
|
check: {
|
|
2333
2432
|
method: "GET",
|
|
2334
2433
|
path: "/api/model-providers/check/:type",
|
|
2335
2434
|
headers: authHeadersSchema,
|
|
2336
|
-
pathParams:
|
|
2435
|
+
pathParams: z16.object({
|
|
2337
2436
|
type: modelProviderTypeSchema
|
|
2338
2437
|
}),
|
|
2339
2438
|
responses: {
|
|
@@ -2344,16 +2443,16 @@ var modelProvidersCheckContract = c12.router({
|
|
|
2344
2443
|
summary: "Check if credential exists for a model provider type"
|
|
2345
2444
|
}
|
|
2346
2445
|
});
|
|
2347
|
-
var modelProvidersByTypeContract =
|
|
2446
|
+
var modelProvidersByTypeContract = c13.router({
|
|
2348
2447
|
delete: {
|
|
2349
2448
|
method: "DELETE",
|
|
2350
2449
|
path: "/api/model-providers/:type",
|
|
2351
2450
|
headers: authHeadersSchema,
|
|
2352
|
-
pathParams:
|
|
2451
|
+
pathParams: z16.object({
|
|
2353
2452
|
type: modelProviderTypeSchema
|
|
2354
2453
|
}),
|
|
2355
2454
|
responses: {
|
|
2356
|
-
204:
|
|
2455
|
+
204: c13.noBody(),
|
|
2357
2456
|
401: apiErrorSchema,
|
|
2358
2457
|
404: apiErrorSchema,
|
|
2359
2458
|
500: apiErrorSchema
|
|
@@ -2361,15 +2460,15 @@ var modelProvidersByTypeContract = c12.router({
|
|
|
2361
2460
|
summary: "Delete a model provider"
|
|
2362
2461
|
}
|
|
2363
2462
|
});
|
|
2364
|
-
var modelProvidersConvertContract =
|
|
2463
|
+
var modelProvidersConvertContract = c13.router({
|
|
2365
2464
|
convert: {
|
|
2366
2465
|
method: "POST",
|
|
2367
2466
|
path: "/api/model-providers/:type/convert",
|
|
2368
2467
|
headers: authHeadersSchema,
|
|
2369
|
-
pathParams:
|
|
2468
|
+
pathParams: z16.object({
|
|
2370
2469
|
type: modelProviderTypeSchema
|
|
2371
2470
|
}),
|
|
2372
|
-
body:
|
|
2471
|
+
body: z16.undefined(),
|
|
2373
2472
|
responses: {
|
|
2374
2473
|
200: modelProviderResponseSchema,
|
|
2375
2474
|
400: apiErrorSchema,
|
|
@@ -2380,15 +2479,15 @@ var modelProvidersConvertContract = c12.router({
|
|
|
2380
2479
|
summary: "Convert existing user credential to model provider"
|
|
2381
2480
|
}
|
|
2382
2481
|
});
|
|
2383
|
-
var modelProvidersSetDefaultContract =
|
|
2482
|
+
var modelProvidersSetDefaultContract = c13.router({
|
|
2384
2483
|
setDefault: {
|
|
2385
2484
|
method: "POST",
|
|
2386
2485
|
path: "/api/model-providers/:type/set-default",
|
|
2387
2486
|
headers: authHeadersSchema,
|
|
2388
|
-
pathParams:
|
|
2487
|
+
pathParams: z16.object({
|
|
2389
2488
|
type: modelProviderTypeSchema
|
|
2390
2489
|
}),
|
|
2391
|
-
body:
|
|
2490
|
+
body: z16.undefined(),
|
|
2392
2491
|
responses: {
|
|
2393
2492
|
200: modelProviderResponseSchema,
|
|
2394
2493
|
401: apiErrorSchema,
|
|
@@ -2398,15 +2497,15 @@ var modelProvidersSetDefaultContract = c12.router({
|
|
|
2398
2497
|
summary: "Set a model provider as default for its framework"
|
|
2399
2498
|
}
|
|
2400
2499
|
});
|
|
2401
|
-
var updateModelRequestSchema =
|
|
2402
|
-
selectedModel:
|
|
2500
|
+
var updateModelRequestSchema = z16.object({
|
|
2501
|
+
selectedModel: z16.string().optional()
|
|
2403
2502
|
});
|
|
2404
|
-
var modelProvidersUpdateModelContract =
|
|
2503
|
+
var modelProvidersUpdateModelContract = c13.router({
|
|
2405
2504
|
updateModel: {
|
|
2406
2505
|
method: "PATCH",
|
|
2407
2506
|
path: "/api/model-providers/:type/model",
|
|
2408
2507
|
headers: authHeadersSchema,
|
|
2409
|
-
pathParams:
|
|
2508
|
+
pathParams: z16.object({
|
|
2410
2509
|
type: modelProviderTypeSchema
|
|
2411
2510
|
}),
|
|
2412
2511
|
body: updateModelRequestSchema,
|
|
@@ -2421,42 +2520,42 @@ var modelProvidersUpdateModelContract = c12.router({
|
|
|
2421
2520
|
});
|
|
2422
2521
|
|
|
2423
2522
|
// ../../packages/core/src/contracts/sessions.ts
|
|
2424
|
-
import { z as
|
|
2425
|
-
var
|
|
2426
|
-
var sessionResponseSchema =
|
|
2427
|
-
id:
|
|
2428
|
-
agentComposeId:
|
|
2429
|
-
agentComposeVersionId:
|
|
2430
|
-
conversationId:
|
|
2431
|
-
artifactName:
|
|
2432
|
-
vars:
|
|
2433
|
-
secretNames:
|
|
2434
|
-
volumeVersions:
|
|
2435
|
-
createdAt:
|
|
2436
|
-
updatedAt:
|
|
2523
|
+
import { z as z17 } from "zod";
|
|
2524
|
+
var c14 = initContract();
|
|
2525
|
+
var sessionResponseSchema = z17.object({
|
|
2526
|
+
id: z17.string(),
|
|
2527
|
+
agentComposeId: z17.string(),
|
|
2528
|
+
agentComposeVersionId: z17.string().nullable(),
|
|
2529
|
+
conversationId: z17.string().nullable(),
|
|
2530
|
+
artifactName: z17.string().nullable(),
|
|
2531
|
+
vars: z17.record(z17.string(), z17.string()).nullable(),
|
|
2532
|
+
secretNames: z17.array(z17.string()).nullable(),
|
|
2533
|
+
volumeVersions: z17.record(z17.string(), z17.string()).nullable(),
|
|
2534
|
+
createdAt: z17.string(),
|
|
2535
|
+
updatedAt: z17.string()
|
|
2437
2536
|
});
|
|
2438
|
-
var agentComposeSnapshotSchema =
|
|
2439
|
-
agentComposeVersionId:
|
|
2440
|
-
vars:
|
|
2441
|
-
secretNames:
|
|
2537
|
+
var agentComposeSnapshotSchema = z17.object({
|
|
2538
|
+
agentComposeVersionId: z17.string(),
|
|
2539
|
+
vars: z17.record(z17.string(), z17.string()).optional(),
|
|
2540
|
+
secretNames: z17.array(z17.string()).optional()
|
|
2442
2541
|
});
|
|
2443
|
-
var artifactSnapshotSchema2 =
|
|
2444
|
-
artifactName:
|
|
2445
|
-
artifactVersion:
|
|
2542
|
+
var artifactSnapshotSchema2 = z17.object({
|
|
2543
|
+
artifactName: z17.string(),
|
|
2544
|
+
artifactVersion: z17.string()
|
|
2446
2545
|
});
|
|
2447
|
-
var volumeVersionsSnapshotSchema2 =
|
|
2448
|
-
versions:
|
|
2546
|
+
var volumeVersionsSnapshotSchema2 = z17.object({
|
|
2547
|
+
versions: z17.record(z17.string(), z17.string())
|
|
2449
2548
|
});
|
|
2450
|
-
var checkpointResponseSchema =
|
|
2451
|
-
id:
|
|
2452
|
-
runId:
|
|
2453
|
-
conversationId:
|
|
2549
|
+
var checkpointResponseSchema = z17.object({
|
|
2550
|
+
id: z17.string(),
|
|
2551
|
+
runId: z17.string(),
|
|
2552
|
+
conversationId: z17.string(),
|
|
2454
2553
|
agentComposeSnapshot: agentComposeSnapshotSchema,
|
|
2455
2554
|
artifactSnapshot: artifactSnapshotSchema2.nullable(),
|
|
2456
2555
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
|
|
2457
|
-
createdAt:
|
|
2556
|
+
createdAt: z17.string()
|
|
2458
2557
|
});
|
|
2459
|
-
var sessionsByIdContract =
|
|
2558
|
+
var sessionsByIdContract = c14.router({
|
|
2460
2559
|
/**
|
|
2461
2560
|
* GET /api/agent/sessions/:id
|
|
2462
2561
|
* Get session by ID
|
|
@@ -2465,8 +2564,8 @@ var sessionsByIdContract = c13.router({
|
|
|
2465
2564
|
method: "GET",
|
|
2466
2565
|
path: "/api/agent/sessions/:id",
|
|
2467
2566
|
headers: authHeadersSchema,
|
|
2468
|
-
pathParams:
|
|
2469
|
-
id:
|
|
2567
|
+
pathParams: z17.object({
|
|
2568
|
+
id: z17.string().min(1, "Session ID is required")
|
|
2470
2569
|
}),
|
|
2471
2570
|
responses: {
|
|
2472
2571
|
200: sessionResponseSchema,
|
|
@@ -2477,7 +2576,7 @@ var sessionsByIdContract = c13.router({
|
|
|
2477
2576
|
summary: "Get session by ID"
|
|
2478
2577
|
}
|
|
2479
2578
|
});
|
|
2480
|
-
var checkpointsByIdContract =
|
|
2579
|
+
var checkpointsByIdContract = c14.router({
|
|
2481
2580
|
/**
|
|
2482
2581
|
* GET /api/agent/checkpoints/:id
|
|
2483
2582
|
* Get checkpoint by ID
|
|
@@ -2486,8 +2585,8 @@ var checkpointsByIdContract = c13.router({
|
|
|
2486
2585
|
method: "GET",
|
|
2487
2586
|
path: "/api/agent/checkpoints/:id",
|
|
2488
2587
|
headers: authHeadersSchema,
|
|
2489
|
-
pathParams:
|
|
2490
|
-
id:
|
|
2588
|
+
pathParams: z17.object({
|
|
2589
|
+
id: z17.string().min(1, "Checkpoint ID is required")
|
|
2491
2590
|
}),
|
|
2492
2591
|
responses: {
|
|
2493
2592
|
200: checkpointResponseSchema,
|
|
@@ -2500,93 +2599,93 @@ var checkpointsByIdContract = c13.router({
|
|
|
2500
2599
|
});
|
|
2501
2600
|
|
|
2502
2601
|
// ../../packages/core/src/contracts/schedules.ts
|
|
2503
|
-
import { z as
|
|
2504
|
-
var
|
|
2505
|
-
var scheduleTriggerSchema =
|
|
2506
|
-
cron:
|
|
2507
|
-
at:
|
|
2508
|
-
timezone:
|
|
2602
|
+
import { z as z18 } from "zod";
|
|
2603
|
+
var c15 = initContract();
|
|
2604
|
+
var scheduleTriggerSchema = z18.object({
|
|
2605
|
+
cron: z18.string().optional(),
|
|
2606
|
+
at: z18.string().optional(),
|
|
2607
|
+
timezone: z18.string().default("UTC")
|
|
2509
2608
|
}).refine((data) => data.cron && !data.at || !data.cron && data.at, {
|
|
2510
2609
|
message: "Exactly one of 'cron' or 'at' must be specified"
|
|
2511
2610
|
});
|
|
2512
|
-
var scheduleRunConfigSchema =
|
|
2513
|
-
agent:
|
|
2514
|
-
prompt:
|
|
2515
|
-
vars:
|
|
2516
|
-
secrets:
|
|
2517
|
-
artifactName:
|
|
2518
|
-
artifactVersion:
|
|
2519
|
-
volumeVersions:
|
|
2611
|
+
var scheduleRunConfigSchema = z18.object({
|
|
2612
|
+
agent: z18.string().min(1, "Agent reference required"),
|
|
2613
|
+
prompt: z18.string().min(1, "Prompt required"),
|
|
2614
|
+
vars: z18.record(z18.string(), z18.string()).optional(),
|
|
2615
|
+
secrets: z18.record(z18.string(), z18.string()).optional(),
|
|
2616
|
+
artifactName: z18.string().optional(),
|
|
2617
|
+
artifactVersion: z18.string().optional(),
|
|
2618
|
+
volumeVersions: z18.record(z18.string(), z18.string()).optional()
|
|
2520
2619
|
});
|
|
2521
|
-
var scheduleDefinitionSchema =
|
|
2620
|
+
var scheduleDefinitionSchema = z18.object({
|
|
2522
2621
|
on: scheduleTriggerSchema,
|
|
2523
2622
|
run: scheduleRunConfigSchema
|
|
2524
2623
|
});
|
|
2525
|
-
var scheduleYamlSchema =
|
|
2526
|
-
version:
|
|
2527
|
-
schedules:
|
|
2528
|
-
});
|
|
2529
|
-
var deployScheduleRequestSchema =
|
|
2530
|
-
name:
|
|
2531
|
-
cronExpression:
|
|
2532
|
-
atTime:
|
|
2533
|
-
timezone:
|
|
2534
|
-
prompt:
|
|
2535
|
-
vars:
|
|
2536
|
-
secrets:
|
|
2537
|
-
artifactName:
|
|
2538
|
-
artifactVersion:
|
|
2539
|
-
volumeVersions:
|
|
2624
|
+
var scheduleYamlSchema = z18.object({
|
|
2625
|
+
version: z18.literal("1.0"),
|
|
2626
|
+
schedules: z18.record(z18.string(), scheduleDefinitionSchema)
|
|
2627
|
+
});
|
|
2628
|
+
var deployScheduleRequestSchema = z18.object({
|
|
2629
|
+
name: z18.string().min(1).max(64, "Schedule name max 64 chars"),
|
|
2630
|
+
cronExpression: z18.string().optional(),
|
|
2631
|
+
atTime: z18.string().optional(),
|
|
2632
|
+
timezone: z18.string().default("UTC"),
|
|
2633
|
+
prompt: z18.string().min(1, "Prompt required"),
|
|
2634
|
+
vars: z18.record(z18.string(), z18.string()).optional(),
|
|
2635
|
+
secrets: z18.record(z18.string(), z18.string()).optional(),
|
|
2636
|
+
artifactName: z18.string().optional(),
|
|
2637
|
+
artifactVersion: z18.string().optional(),
|
|
2638
|
+
volumeVersions: z18.record(z18.string(), z18.string()).optional(),
|
|
2540
2639
|
// Resolved agent compose ID (CLI resolves scope/name:version → composeId)
|
|
2541
|
-
composeId:
|
|
2640
|
+
composeId: z18.string().uuid("Invalid compose ID")
|
|
2542
2641
|
}).refine(
|
|
2543
2642
|
(data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
|
|
2544
2643
|
{
|
|
2545
2644
|
message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
|
|
2546
2645
|
}
|
|
2547
2646
|
);
|
|
2548
|
-
var scheduleResponseSchema =
|
|
2549
|
-
id:
|
|
2550
|
-
composeId:
|
|
2551
|
-
composeName:
|
|
2552
|
-
scopeSlug:
|
|
2553
|
-
name:
|
|
2554
|
-
cronExpression:
|
|
2555
|
-
atTime:
|
|
2556
|
-
timezone:
|
|
2557
|
-
prompt:
|
|
2558
|
-
vars:
|
|
2647
|
+
var scheduleResponseSchema = z18.object({
|
|
2648
|
+
id: z18.string().uuid(),
|
|
2649
|
+
composeId: z18.string().uuid(),
|
|
2650
|
+
composeName: z18.string(),
|
|
2651
|
+
scopeSlug: z18.string(),
|
|
2652
|
+
name: z18.string(),
|
|
2653
|
+
cronExpression: z18.string().nullable(),
|
|
2654
|
+
atTime: z18.string().nullable(),
|
|
2655
|
+
timezone: z18.string(),
|
|
2656
|
+
prompt: z18.string(),
|
|
2657
|
+
vars: z18.record(z18.string(), z18.string()).nullable(),
|
|
2559
2658
|
// Secret names only (values are never returned)
|
|
2560
|
-
secretNames:
|
|
2561
|
-
artifactName:
|
|
2562
|
-
artifactVersion:
|
|
2563
|
-
volumeVersions:
|
|
2564
|
-
enabled:
|
|
2565
|
-
nextRunAt:
|
|
2566
|
-
lastRunAt:
|
|
2567
|
-
retryStartedAt:
|
|
2568
|
-
createdAt:
|
|
2569
|
-
updatedAt:
|
|
2570
|
-
});
|
|
2571
|
-
var runSummarySchema =
|
|
2572
|
-
id:
|
|
2573
|
-
status:
|
|
2574
|
-
createdAt:
|
|
2575
|
-
completedAt:
|
|
2576
|
-
error:
|
|
2577
|
-
});
|
|
2578
|
-
var scheduleRunsResponseSchema =
|
|
2579
|
-
runs:
|
|
2580
|
-
});
|
|
2581
|
-
var scheduleListResponseSchema =
|
|
2582
|
-
schedules:
|
|
2583
|
-
});
|
|
2584
|
-
var deployScheduleResponseSchema =
|
|
2659
|
+
secretNames: z18.array(z18.string()).nullable(),
|
|
2660
|
+
artifactName: z18.string().nullable(),
|
|
2661
|
+
artifactVersion: z18.string().nullable(),
|
|
2662
|
+
volumeVersions: z18.record(z18.string(), z18.string()).nullable(),
|
|
2663
|
+
enabled: z18.boolean(),
|
|
2664
|
+
nextRunAt: z18.string().nullable(),
|
|
2665
|
+
lastRunAt: z18.string().nullable(),
|
|
2666
|
+
retryStartedAt: z18.string().nullable(),
|
|
2667
|
+
createdAt: z18.string(),
|
|
2668
|
+
updatedAt: z18.string()
|
|
2669
|
+
});
|
|
2670
|
+
var runSummarySchema = z18.object({
|
|
2671
|
+
id: z18.string().uuid(),
|
|
2672
|
+
status: z18.enum(["pending", "running", "completed", "failed", "timeout"]),
|
|
2673
|
+
createdAt: z18.string(),
|
|
2674
|
+
completedAt: z18.string().nullable(),
|
|
2675
|
+
error: z18.string().nullable()
|
|
2676
|
+
});
|
|
2677
|
+
var scheduleRunsResponseSchema = z18.object({
|
|
2678
|
+
runs: z18.array(runSummarySchema)
|
|
2679
|
+
});
|
|
2680
|
+
var scheduleListResponseSchema = z18.object({
|
|
2681
|
+
schedules: z18.array(scheduleResponseSchema)
|
|
2682
|
+
});
|
|
2683
|
+
var deployScheduleResponseSchema = z18.object({
|
|
2585
2684
|
schedule: scheduleResponseSchema,
|
|
2586
|
-
created:
|
|
2685
|
+
created: z18.boolean()
|
|
2587
2686
|
// true if created, false if updated
|
|
2588
2687
|
});
|
|
2589
|
-
var schedulesMainContract =
|
|
2688
|
+
var schedulesMainContract = c15.router({
|
|
2590
2689
|
/**
|
|
2591
2690
|
* POST /api/agent/schedules
|
|
2592
2691
|
* Deploy (create or update) a schedule
|
|
@@ -2624,7 +2723,7 @@ var schedulesMainContract = c14.router({
|
|
|
2624
2723
|
summary: "List all schedules"
|
|
2625
2724
|
}
|
|
2626
2725
|
});
|
|
2627
|
-
var schedulesByNameContract =
|
|
2726
|
+
var schedulesByNameContract = c15.router({
|
|
2628
2727
|
/**
|
|
2629
2728
|
* GET /api/agent/schedules/:name
|
|
2630
2729
|
* Get schedule by name
|
|
@@ -2633,11 +2732,11 @@ var schedulesByNameContract = c14.router({
|
|
|
2633
2732
|
method: "GET",
|
|
2634
2733
|
path: "/api/agent/schedules/:name",
|
|
2635
2734
|
headers: authHeadersSchema,
|
|
2636
|
-
pathParams:
|
|
2637
|
-
name:
|
|
2735
|
+
pathParams: z18.object({
|
|
2736
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2638
2737
|
}),
|
|
2639
|
-
query:
|
|
2640
|
-
composeId:
|
|
2738
|
+
query: z18.object({
|
|
2739
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2641
2740
|
}),
|
|
2642
2741
|
responses: {
|
|
2643
2742
|
200: scheduleResponseSchema,
|
|
@@ -2654,21 +2753,21 @@ var schedulesByNameContract = c14.router({
|
|
|
2654
2753
|
method: "DELETE",
|
|
2655
2754
|
path: "/api/agent/schedules/:name",
|
|
2656
2755
|
headers: authHeadersSchema,
|
|
2657
|
-
pathParams:
|
|
2658
|
-
name:
|
|
2756
|
+
pathParams: z18.object({
|
|
2757
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2659
2758
|
}),
|
|
2660
|
-
query:
|
|
2661
|
-
composeId:
|
|
2759
|
+
query: z18.object({
|
|
2760
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2662
2761
|
}),
|
|
2663
2762
|
responses: {
|
|
2664
|
-
204:
|
|
2763
|
+
204: c15.noBody(),
|
|
2665
2764
|
401: apiErrorSchema,
|
|
2666
2765
|
404: apiErrorSchema
|
|
2667
2766
|
},
|
|
2668
2767
|
summary: "Delete schedule"
|
|
2669
2768
|
}
|
|
2670
2769
|
});
|
|
2671
|
-
var schedulesEnableContract =
|
|
2770
|
+
var schedulesEnableContract = c15.router({
|
|
2672
2771
|
/**
|
|
2673
2772
|
* POST /api/agent/schedules/:name/enable
|
|
2674
2773
|
* Enable a disabled schedule
|
|
@@ -2677,11 +2776,11 @@ var schedulesEnableContract = c14.router({
|
|
|
2677
2776
|
method: "POST",
|
|
2678
2777
|
path: "/api/agent/schedules/:name/enable",
|
|
2679
2778
|
headers: authHeadersSchema,
|
|
2680
|
-
pathParams:
|
|
2681
|
-
name:
|
|
2779
|
+
pathParams: z18.object({
|
|
2780
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2682
2781
|
}),
|
|
2683
|
-
body:
|
|
2684
|
-
composeId:
|
|
2782
|
+
body: z18.object({
|
|
2783
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2685
2784
|
}),
|
|
2686
2785
|
responses: {
|
|
2687
2786
|
200: scheduleResponseSchema,
|
|
@@ -2698,11 +2797,11 @@ var schedulesEnableContract = c14.router({
|
|
|
2698
2797
|
method: "POST",
|
|
2699
2798
|
path: "/api/agent/schedules/:name/disable",
|
|
2700
2799
|
headers: authHeadersSchema,
|
|
2701
|
-
pathParams:
|
|
2702
|
-
name:
|
|
2800
|
+
pathParams: z18.object({
|
|
2801
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2703
2802
|
}),
|
|
2704
|
-
body:
|
|
2705
|
-
composeId:
|
|
2803
|
+
body: z18.object({
|
|
2804
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2706
2805
|
}),
|
|
2707
2806
|
responses: {
|
|
2708
2807
|
200: scheduleResponseSchema,
|
|
@@ -2712,7 +2811,7 @@ var schedulesEnableContract = c14.router({
|
|
|
2712
2811
|
summary: "Disable schedule"
|
|
2713
2812
|
}
|
|
2714
2813
|
});
|
|
2715
|
-
var scheduleRunsContract =
|
|
2814
|
+
var scheduleRunsContract = c15.router({
|
|
2716
2815
|
/**
|
|
2717
2816
|
* GET /api/agent/schedules/:name/runs
|
|
2718
2817
|
* List recent runs for a schedule
|
|
@@ -2721,12 +2820,12 @@ var scheduleRunsContract = c14.router({
|
|
|
2721
2820
|
method: "GET",
|
|
2722
2821
|
path: "/api/agent/schedules/:name/runs",
|
|
2723
2822
|
headers: authHeadersSchema,
|
|
2724
|
-
pathParams:
|
|
2725
|
-
name:
|
|
2823
|
+
pathParams: z18.object({
|
|
2824
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2726
2825
|
}),
|
|
2727
|
-
query:
|
|
2728
|
-
composeId:
|
|
2729
|
-
limit:
|
|
2826
|
+
query: z18.object({
|
|
2827
|
+
composeId: z18.string().uuid("Compose ID required"),
|
|
2828
|
+
limit: z18.coerce.number().min(0).max(100).default(5)
|
|
2730
2829
|
}),
|
|
2731
2830
|
responses: {
|
|
2732
2831
|
200: scheduleRunsResponseSchema,
|
|
@@ -2738,18 +2837,18 @@ var scheduleRunsContract = c14.router({
|
|
|
2738
2837
|
});
|
|
2739
2838
|
|
|
2740
2839
|
// ../../packages/core/src/contracts/realtime.ts
|
|
2741
|
-
import { z as
|
|
2742
|
-
var
|
|
2743
|
-
var ablyTokenRequestSchema =
|
|
2744
|
-
keyName:
|
|
2745
|
-
ttl:
|
|
2746
|
-
timestamp:
|
|
2747
|
-
capability:
|
|
2748
|
-
clientId:
|
|
2749
|
-
nonce:
|
|
2750
|
-
mac:
|
|
2751
|
-
});
|
|
2752
|
-
var realtimeTokenContract =
|
|
2840
|
+
import { z as z19 } from "zod";
|
|
2841
|
+
var c16 = initContract();
|
|
2842
|
+
var ablyTokenRequestSchema = z19.object({
|
|
2843
|
+
keyName: z19.string(),
|
|
2844
|
+
ttl: z19.number().optional(),
|
|
2845
|
+
timestamp: z19.number(),
|
|
2846
|
+
capability: z19.string(),
|
|
2847
|
+
clientId: z19.string().optional(),
|
|
2848
|
+
nonce: z19.string(),
|
|
2849
|
+
mac: z19.string()
|
|
2850
|
+
});
|
|
2851
|
+
var realtimeTokenContract = c16.router({
|
|
2753
2852
|
/**
|
|
2754
2853
|
* POST /api/realtime/token
|
|
2755
2854
|
* Get an Ably token to subscribe to a run's events channel
|
|
@@ -2758,8 +2857,8 @@ var realtimeTokenContract = c15.router({
|
|
|
2758
2857
|
method: "POST",
|
|
2759
2858
|
path: "/api/realtime/token",
|
|
2760
2859
|
headers: authHeadersSchema,
|
|
2761
|
-
body:
|
|
2762
|
-
runId:
|
|
2860
|
+
body: z19.object({
|
|
2861
|
+
runId: z19.string().uuid("runId must be a valid UUID")
|
|
2763
2862
|
}),
|
|
2764
2863
|
responses: {
|
|
2765
2864
|
200: ablyTokenRequestSchema,
|
|
@@ -2771,7 +2870,7 @@ var realtimeTokenContract = c15.router({
|
|
|
2771
2870
|
summary: "Get Ably token for run event subscription"
|
|
2772
2871
|
}
|
|
2773
2872
|
});
|
|
2774
|
-
var runnerRealtimeTokenContract =
|
|
2873
|
+
var runnerRealtimeTokenContract = c16.router({
|
|
2775
2874
|
/**
|
|
2776
2875
|
* POST /api/runners/realtime/token
|
|
2777
2876
|
* Get an Ably token to subscribe to a runner group's job notification channel
|
|
@@ -2780,7 +2879,7 @@ var runnerRealtimeTokenContract = c15.router({
|
|
|
2780
2879
|
method: "POST",
|
|
2781
2880
|
path: "/api/runners/realtime/token",
|
|
2782
2881
|
headers: authHeadersSchema,
|
|
2783
|
-
body:
|
|
2882
|
+
body: z19.object({
|
|
2784
2883
|
group: runnerGroupSchema
|
|
2785
2884
|
}),
|
|
2786
2885
|
responses: {
|
|
@@ -2794,11 +2893,11 @@ var runnerRealtimeTokenContract = c15.router({
|
|
|
2794
2893
|
});
|
|
2795
2894
|
|
|
2796
2895
|
// ../../packages/core/src/contracts/platform.ts
|
|
2797
|
-
import { z as
|
|
2896
|
+
import { z as z21 } from "zod";
|
|
2798
2897
|
|
|
2799
2898
|
// ../../packages/core/src/contracts/public/common.ts
|
|
2800
|
-
import { z as
|
|
2801
|
-
var publicApiErrorTypeSchema =
|
|
2899
|
+
import { z as z20 } from "zod";
|
|
2900
|
+
var publicApiErrorTypeSchema = z20.enum([
|
|
2802
2901
|
"api_error",
|
|
2803
2902
|
// Internal server error (5xx)
|
|
2804
2903
|
"invalid_request_error",
|
|
@@ -2812,40 +2911,40 @@ var publicApiErrorTypeSchema = z19.enum([
|
|
|
2812
2911
|
"rate_limit_error"
|
|
2813
2912
|
// Rate limit exceeded (429)
|
|
2814
2913
|
]);
|
|
2815
|
-
var publicApiErrorSchema =
|
|
2816
|
-
error:
|
|
2914
|
+
var publicApiErrorSchema = z20.object({
|
|
2915
|
+
error: z20.object({
|
|
2817
2916
|
type: publicApiErrorTypeSchema,
|
|
2818
|
-
code:
|
|
2819
|
-
message:
|
|
2820
|
-
param:
|
|
2821
|
-
docUrl:
|
|
2917
|
+
code: z20.string(),
|
|
2918
|
+
message: z20.string(),
|
|
2919
|
+
param: z20.string().optional(),
|
|
2920
|
+
docUrl: z20.string().url().optional()
|
|
2822
2921
|
})
|
|
2823
2922
|
});
|
|
2824
|
-
var paginationSchema =
|
|
2825
|
-
hasMore:
|
|
2826
|
-
nextCursor:
|
|
2923
|
+
var paginationSchema = z20.object({
|
|
2924
|
+
hasMore: z20.boolean(),
|
|
2925
|
+
nextCursor: z20.string().nullable()
|
|
2827
2926
|
});
|
|
2828
2927
|
function createPaginatedResponseSchema(dataSchema) {
|
|
2829
|
-
return
|
|
2830
|
-
data:
|
|
2928
|
+
return z20.object({
|
|
2929
|
+
data: z20.array(dataSchema),
|
|
2831
2930
|
pagination: paginationSchema
|
|
2832
2931
|
});
|
|
2833
2932
|
}
|
|
2834
|
-
var listQuerySchema =
|
|
2835
|
-
cursor:
|
|
2836
|
-
limit:
|
|
2933
|
+
var listQuerySchema = z20.object({
|
|
2934
|
+
cursor: z20.string().optional(),
|
|
2935
|
+
limit: z20.coerce.number().min(1).max(100).default(20)
|
|
2837
2936
|
});
|
|
2838
|
-
var requestIdSchema =
|
|
2839
|
-
var timestampSchema =
|
|
2937
|
+
var requestIdSchema = z20.string().uuid();
|
|
2938
|
+
var timestampSchema = z20.string().datetime();
|
|
2840
2939
|
|
|
2841
2940
|
// ../../packages/core/src/contracts/platform.ts
|
|
2842
|
-
var
|
|
2843
|
-
var platformPaginationSchema =
|
|
2844
|
-
hasMore:
|
|
2845
|
-
nextCursor:
|
|
2846
|
-
totalPages:
|
|
2941
|
+
var c17 = initContract();
|
|
2942
|
+
var platformPaginationSchema = z21.object({
|
|
2943
|
+
hasMore: z21.boolean(),
|
|
2944
|
+
nextCursor: z21.string().nullable(),
|
|
2945
|
+
totalPages: z21.number()
|
|
2847
2946
|
});
|
|
2848
|
-
var platformLogStatusSchema =
|
|
2947
|
+
var platformLogStatusSchema = z21.enum([
|
|
2849
2948
|
"pending",
|
|
2850
2949
|
"running",
|
|
2851
2950
|
"completed",
|
|
@@ -2853,41 +2952,41 @@ var platformLogStatusSchema = z20.enum([
|
|
|
2853
2952
|
"timeout",
|
|
2854
2953
|
"cancelled"
|
|
2855
2954
|
]);
|
|
2856
|
-
var platformLogEntrySchema =
|
|
2857
|
-
id:
|
|
2858
|
-
sessionId:
|
|
2859
|
-
agentName:
|
|
2860
|
-
framework:
|
|
2955
|
+
var platformLogEntrySchema = z21.object({
|
|
2956
|
+
id: z21.string().uuid(),
|
|
2957
|
+
sessionId: z21.string().nullable(),
|
|
2958
|
+
agentName: z21.string(),
|
|
2959
|
+
framework: z21.string().nullable(),
|
|
2861
2960
|
status: platformLogStatusSchema,
|
|
2862
|
-
createdAt:
|
|
2961
|
+
createdAt: z21.string()
|
|
2863
2962
|
});
|
|
2864
|
-
var platformLogsListResponseSchema =
|
|
2865
|
-
data:
|
|
2963
|
+
var platformLogsListResponseSchema = z21.object({
|
|
2964
|
+
data: z21.array(platformLogEntrySchema),
|
|
2866
2965
|
pagination: platformPaginationSchema
|
|
2867
2966
|
});
|
|
2868
|
-
var artifactSchema =
|
|
2869
|
-
name:
|
|
2870
|
-
version:
|
|
2967
|
+
var artifactSchema = z21.object({
|
|
2968
|
+
name: z21.string().nullable(),
|
|
2969
|
+
version: z21.string().nullable()
|
|
2871
2970
|
});
|
|
2872
|
-
var platformLogDetailSchema =
|
|
2873
|
-
id:
|
|
2874
|
-
sessionId:
|
|
2875
|
-
agentName:
|
|
2876
|
-
framework:
|
|
2971
|
+
var platformLogDetailSchema = z21.object({
|
|
2972
|
+
id: z21.string().uuid(),
|
|
2973
|
+
sessionId: z21.string().nullable(),
|
|
2974
|
+
agentName: z21.string(),
|
|
2975
|
+
framework: z21.string().nullable(),
|
|
2877
2976
|
status: platformLogStatusSchema,
|
|
2878
|
-
prompt:
|
|
2879
|
-
error:
|
|
2880
|
-
createdAt:
|
|
2881
|
-
startedAt:
|
|
2882
|
-
completedAt:
|
|
2977
|
+
prompt: z21.string(),
|
|
2978
|
+
error: z21.string().nullable(),
|
|
2979
|
+
createdAt: z21.string(),
|
|
2980
|
+
startedAt: z21.string().nullable(),
|
|
2981
|
+
completedAt: z21.string().nullable(),
|
|
2883
2982
|
artifact: artifactSchema
|
|
2884
2983
|
});
|
|
2885
|
-
var platformLogsListContract =
|
|
2984
|
+
var platformLogsListContract = c17.router({
|
|
2886
2985
|
list: {
|
|
2887
2986
|
method: "GET",
|
|
2888
2987
|
path: "/api/platform/logs",
|
|
2889
2988
|
query: listQuerySchema.extend({
|
|
2890
|
-
search:
|
|
2989
|
+
search: z21.string().optional()
|
|
2891
2990
|
}),
|
|
2892
2991
|
responses: {
|
|
2893
2992
|
200: platformLogsListResponseSchema,
|
|
@@ -2896,12 +2995,12 @@ var platformLogsListContract = c16.router({
|
|
|
2896
2995
|
summary: "List agent run logs with pagination"
|
|
2897
2996
|
}
|
|
2898
2997
|
});
|
|
2899
|
-
var platformLogsByIdContract =
|
|
2998
|
+
var platformLogsByIdContract = c17.router({
|
|
2900
2999
|
getById: {
|
|
2901
3000
|
method: "GET",
|
|
2902
3001
|
path: "/api/platform/logs/:id",
|
|
2903
|
-
pathParams:
|
|
2904
|
-
id:
|
|
3002
|
+
pathParams: z21.object({
|
|
3003
|
+
id: z21.string().uuid("Invalid log ID")
|
|
2905
3004
|
}),
|
|
2906
3005
|
responses: {
|
|
2907
3006
|
200: platformLogDetailSchema,
|
|
@@ -2911,17 +3010,17 @@ var platformLogsByIdContract = c16.router({
|
|
|
2911
3010
|
summary: "Get agent run log details by ID"
|
|
2912
3011
|
}
|
|
2913
3012
|
});
|
|
2914
|
-
var artifactDownloadResponseSchema =
|
|
2915
|
-
url:
|
|
2916
|
-
expiresAt:
|
|
3013
|
+
var artifactDownloadResponseSchema = z21.object({
|
|
3014
|
+
url: z21.string().url(),
|
|
3015
|
+
expiresAt: z21.string()
|
|
2917
3016
|
});
|
|
2918
|
-
var platformArtifactDownloadContract =
|
|
3017
|
+
var platformArtifactDownloadContract = c17.router({
|
|
2919
3018
|
getDownloadUrl: {
|
|
2920
3019
|
method: "GET",
|
|
2921
3020
|
path: "/api/platform/artifacts/download",
|
|
2922
|
-
query:
|
|
2923
|
-
name:
|
|
2924
|
-
version:
|
|
3021
|
+
query: z21.object({
|
|
3022
|
+
name: z21.string().min(1, "Artifact name is required"),
|
|
3023
|
+
version: z21.string().optional()
|
|
2925
3024
|
}),
|
|
2926
3025
|
responses: {
|
|
2927
3026
|
200: artifactDownloadResponseSchema,
|
|
@@ -2933,29 +3032,29 @@ var platformArtifactDownloadContract = c16.router({
|
|
|
2933
3032
|
});
|
|
2934
3033
|
|
|
2935
3034
|
// ../../packages/core/src/contracts/llm.ts
|
|
2936
|
-
import { z as
|
|
2937
|
-
var
|
|
2938
|
-
var messageRoleSchema =
|
|
2939
|
-
var chatMessageSchema =
|
|
3035
|
+
import { z as z22 } from "zod";
|
|
3036
|
+
var c18 = initContract();
|
|
3037
|
+
var messageRoleSchema = z22.enum(["user", "assistant", "system"]);
|
|
3038
|
+
var chatMessageSchema = z22.object({
|
|
2940
3039
|
role: messageRoleSchema,
|
|
2941
|
-
content:
|
|
3040
|
+
content: z22.string()
|
|
2942
3041
|
});
|
|
2943
|
-
var tokenUsageSchema =
|
|
2944
|
-
promptTokens:
|
|
2945
|
-
completionTokens:
|
|
2946
|
-
totalTokens:
|
|
3042
|
+
var tokenUsageSchema = z22.object({
|
|
3043
|
+
promptTokens: z22.number(),
|
|
3044
|
+
completionTokens: z22.number(),
|
|
3045
|
+
totalTokens: z22.number()
|
|
2947
3046
|
});
|
|
2948
|
-
var llmChatRequestSchema =
|
|
2949
|
-
model:
|
|
2950
|
-
messages:
|
|
2951
|
-
stream:
|
|
3047
|
+
var llmChatRequestSchema = z22.object({
|
|
3048
|
+
model: z22.string().min(1).optional(),
|
|
3049
|
+
messages: z22.array(chatMessageSchema).min(1, "At least one message is required"),
|
|
3050
|
+
stream: z22.boolean().optional().default(false)
|
|
2952
3051
|
});
|
|
2953
|
-
var llmChatResponseSchema =
|
|
2954
|
-
content:
|
|
2955
|
-
model:
|
|
3052
|
+
var llmChatResponseSchema = z22.object({
|
|
3053
|
+
content: z22.string(),
|
|
3054
|
+
model: z22.string(),
|
|
2956
3055
|
usage: tokenUsageSchema
|
|
2957
3056
|
});
|
|
2958
|
-
var llmChatContract =
|
|
3057
|
+
var llmChatContract = c18.router({
|
|
2959
3058
|
chat: {
|
|
2960
3059
|
method: "POST",
|
|
2961
3060
|
path: "/api/llm/chat",
|
|
@@ -2971,28 +3070,28 @@ var llmChatContract = c17.router({
|
|
|
2971
3070
|
});
|
|
2972
3071
|
|
|
2973
3072
|
// ../../packages/core/src/contracts/public/agents.ts
|
|
2974
|
-
import { z as
|
|
2975
|
-
var
|
|
2976
|
-
var publicAgentSchema =
|
|
2977
|
-
id:
|
|
2978
|
-
name:
|
|
2979
|
-
currentVersionId:
|
|
3073
|
+
import { z as z23 } from "zod";
|
|
3074
|
+
var c19 = initContract();
|
|
3075
|
+
var publicAgentSchema = z23.object({
|
|
3076
|
+
id: z23.string(),
|
|
3077
|
+
name: z23.string(),
|
|
3078
|
+
currentVersionId: z23.string().nullable(),
|
|
2980
3079
|
createdAt: timestampSchema,
|
|
2981
3080
|
updatedAt: timestampSchema
|
|
2982
3081
|
});
|
|
2983
|
-
var agentVersionSchema =
|
|
2984
|
-
id:
|
|
2985
|
-
agentId:
|
|
2986
|
-
versionNumber:
|
|
3082
|
+
var agentVersionSchema = z23.object({
|
|
3083
|
+
id: z23.string(),
|
|
3084
|
+
agentId: z23.string(),
|
|
3085
|
+
versionNumber: z23.number(),
|
|
2987
3086
|
createdAt: timestampSchema
|
|
2988
3087
|
});
|
|
2989
3088
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
2990
3089
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
2991
3090
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
2992
3091
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
2993
|
-
name:
|
|
3092
|
+
name: z23.string().optional()
|
|
2994
3093
|
});
|
|
2995
|
-
var publicAgentsListContract =
|
|
3094
|
+
var publicAgentsListContract = c19.router({
|
|
2996
3095
|
list: {
|
|
2997
3096
|
method: "GET",
|
|
2998
3097
|
path: "/v1/agents",
|
|
@@ -3007,13 +3106,13 @@ var publicAgentsListContract = c18.router({
|
|
|
3007
3106
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
3008
3107
|
}
|
|
3009
3108
|
});
|
|
3010
|
-
var publicAgentByIdContract =
|
|
3109
|
+
var publicAgentByIdContract = c19.router({
|
|
3011
3110
|
get: {
|
|
3012
3111
|
method: "GET",
|
|
3013
3112
|
path: "/v1/agents/:id",
|
|
3014
3113
|
headers: authHeadersSchema,
|
|
3015
|
-
pathParams:
|
|
3016
|
-
id:
|
|
3114
|
+
pathParams: z23.object({
|
|
3115
|
+
id: z23.string().min(1, "Agent ID is required")
|
|
3017
3116
|
}),
|
|
3018
3117
|
responses: {
|
|
3019
3118
|
200: publicAgentDetailSchema,
|
|
@@ -3025,13 +3124,13 @@ var publicAgentByIdContract = c18.router({
|
|
|
3025
3124
|
description: "Get agent details by ID"
|
|
3026
3125
|
}
|
|
3027
3126
|
});
|
|
3028
|
-
var publicAgentVersionsContract =
|
|
3127
|
+
var publicAgentVersionsContract = c19.router({
|
|
3029
3128
|
list: {
|
|
3030
3129
|
method: "GET",
|
|
3031
3130
|
path: "/v1/agents/:id/versions",
|
|
3032
3131
|
headers: authHeadersSchema,
|
|
3033
|
-
pathParams:
|
|
3034
|
-
id:
|
|
3132
|
+
pathParams: z23.object({
|
|
3133
|
+
id: z23.string().min(1, "Agent ID is required")
|
|
3035
3134
|
}),
|
|
3036
3135
|
query: listQuerySchema,
|
|
3037
3136
|
responses: {
|
|
@@ -3046,9 +3145,9 @@ var publicAgentVersionsContract = c18.router({
|
|
|
3046
3145
|
});
|
|
3047
3146
|
|
|
3048
3147
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
3049
|
-
import { z as
|
|
3050
|
-
var
|
|
3051
|
-
var publicRunStatusSchema =
|
|
3148
|
+
import { z as z24 } from "zod";
|
|
3149
|
+
var c20 = initContract();
|
|
3150
|
+
var publicRunStatusSchema = z24.enum([
|
|
3052
3151
|
"pending",
|
|
3053
3152
|
"running",
|
|
3054
3153
|
"completed",
|
|
@@ -3056,54 +3155,54 @@ var publicRunStatusSchema = z23.enum([
|
|
|
3056
3155
|
"timeout",
|
|
3057
3156
|
"cancelled"
|
|
3058
3157
|
]);
|
|
3059
|
-
var publicRunSchema =
|
|
3060
|
-
id:
|
|
3061
|
-
agentId:
|
|
3062
|
-
agentName:
|
|
3158
|
+
var publicRunSchema = z24.object({
|
|
3159
|
+
id: z24.string(),
|
|
3160
|
+
agentId: z24.string(),
|
|
3161
|
+
agentName: z24.string(),
|
|
3063
3162
|
status: publicRunStatusSchema,
|
|
3064
|
-
prompt:
|
|
3163
|
+
prompt: z24.string(),
|
|
3065
3164
|
createdAt: timestampSchema,
|
|
3066
3165
|
startedAt: timestampSchema.nullable(),
|
|
3067
3166
|
completedAt: timestampSchema.nullable()
|
|
3068
3167
|
});
|
|
3069
3168
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
3070
|
-
error:
|
|
3071
|
-
executionTimeMs:
|
|
3072
|
-
checkpointId:
|
|
3073
|
-
sessionId:
|
|
3074
|
-
artifactName:
|
|
3075
|
-
artifactVersion:
|
|
3076
|
-
volumes:
|
|
3169
|
+
error: z24.string().nullable(),
|
|
3170
|
+
executionTimeMs: z24.number().nullable(),
|
|
3171
|
+
checkpointId: z24.string().nullable(),
|
|
3172
|
+
sessionId: z24.string().nullable(),
|
|
3173
|
+
artifactName: z24.string().nullable(),
|
|
3174
|
+
artifactVersion: z24.string().nullable(),
|
|
3175
|
+
volumes: z24.record(z24.string(), z24.string()).optional()
|
|
3077
3176
|
});
|
|
3078
3177
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
3079
|
-
var createRunRequestSchema =
|
|
3178
|
+
var createRunRequestSchema = z24.object({
|
|
3080
3179
|
// Agent identification (one of: agent, agentId, sessionId, checkpointId)
|
|
3081
|
-
agent:
|
|
3180
|
+
agent: z24.string().optional(),
|
|
3082
3181
|
// Agent name
|
|
3083
|
-
agentId:
|
|
3182
|
+
agentId: z24.string().optional(),
|
|
3084
3183
|
// Agent ID
|
|
3085
|
-
agentVersion:
|
|
3184
|
+
agentVersion: z24.string().optional(),
|
|
3086
3185
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
3087
3186
|
// Continue session
|
|
3088
|
-
sessionId:
|
|
3187
|
+
sessionId: z24.string().optional(),
|
|
3089
3188
|
// Resume from checkpoint
|
|
3090
|
-
checkpointId:
|
|
3189
|
+
checkpointId: z24.string().optional(),
|
|
3091
3190
|
// Required
|
|
3092
|
-
prompt:
|
|
3191
|
+
prompt: z24.string().min(1, "Prompt is required"),
|
|
3093
3192
|
// Optional configuration
|
|
3094
|
-
variables:
|
|
3095
|
-
secrets:
|
|
3096
|
-
artifactName:
|
|
3193
|
+
variables: z24.record(z24.string(), z24.string()).optional(),
|
|
3194
|
+
secrets: z24.record(z24.string(), z24.string()).optional(),
|
|
3195
|
+
artifactName: z24.string().optional(),
|
|
3097
3196
|
// Artifact name to mount
|
|
3098
|
-
artifactVersion:
|
|
3197
|
+
artifactVersion: z24.string().optional(),
|
|
3099
3198
|
// Artifact version (defaults to latest)
|
|
3100
|
-
volumes:
|
|
3199
|
+
volumes: z24.record(z24.string(), z24.string()).optional()
|
|
3101
3200
|
// volume_name -> version
|
|
3102
3201
|
});
|
|
3103
3202
|
var runListQuerySchema = listQuerySchema.extend({
|
|
3104
3203
|
status: publicRunStatusSchema.optional()
|
|
3105
3204
|
});
|
|
3106
|
-
var publicRunsListContract =
|
|
3205
|
+
var publicRunsListContract = c20.router({
|
|
3107
3206
|
list: {
|
|
3108
3207
|
method: "GET",
|
|
3109
3208
|
path: "/v1/runs",
|
|
@@ -3135,13 +3234,13 @@ var publicRunsListContract = c19.router({
|
|
|
3135
3234
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
3136
3235
|
}
|
|
3137
3236
|
});
|
|
3138
|
-
var publicRunByIdContract =
|
|
3237
|
+
var publicRunByIdContract = c20.router({
|
|
3139
3238
|
get: {
|
|
3140
3239
|
method: "GET",
|
|
3141
3240
|
path: "/v1/runs/:id",
|
|
3142
3241
|
headers: authHeadersSchema,
|
|
3143
|
-
pathParams:
|
|
3144
|
-
id:
|
|
3242
|
+
pathParams: z24.object({
|
|
3243
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3145
3244
|
}),
|
|
3146
3245
|
responses: {
|
|
3147
3246
|
200: publicRunDetailSchema,
|
|
@@ -3153,15 +3252,15 @@ var publicRunByIdContract = c19.router({
|
|
|
3153
3252
|
description: "Get run details by ID"
|
|
3154
3253
|
}
|
|
3155
3254
|
});
|
|
3156
|
-
var publicRunCancelContract =
|
|
3255
|
+
var publicRunCancelContract = c20.router({
|
|
3157
3256
|
cancel: {
|
|
3158
3257
|
method: "POST",
|
|
3159
3258
|
path: "/v1/runs/:id/cancel",
|
|
3160
3259
|
headers: authHeadersSchema,
|
|
3161
|
-
pathParams:
|
|
3162
|
-
id:
|
|
3260
|
+
pathParams: z24.object({
|
|
3261
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3163
3262
|
}),
|
|
3164
|
-
body:
|
|
3263
|
+
body: z24.undefined(),
|
|
3165
3264
|
responses: {
|
|
3166
3265
|
200: publicRunDetailSchema,
|
|
3167
3266
|
400: publicApiErrorSchema,
|
|
@@ -3174,27 +3273,27 @@ var publicRunCancelContract = c19.router({
|
|
|
3174
3273
|
description: "Cancel a pending or running execution"
|
|
3175
3274
|
}
|
|
3176
3275
|
});
|
|
3177
|
-
var logEntrySchema =
|
|
3276
|
+
var logEntrySchema = z24.object({
|
|
3178
3277
|
timestamp: timestampSchema,
|
|
3179
|
-
type:
|
|
3180
|
-
level:
|
|
3181
|
-
message:
|
|
3182
|
-
metadata:
|
|
3278
|
+
type: z24.enum(["agent", "system", "network"]),
|
|
3279
|
+
level: z24.enum(["debug", "info", "warn", "error"]),
|
|
3280
|
+
message: z24.string(),
|
|
3281
|
+
metadata: z24.record(z24.string(), z24.unknown()).optional()
|
|
3183
3282
|
});
|
|
3184
3283
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
3185
3284
|
var logsQuerySchema = listQuerySchema.extend({
|
|
3186
|
-
type:
|
|
3285
|
+
type: z24.enum(["agent", "system", "network", "all"]).default("all"),
|
|
3187
3286
|
since: timestampSchema.optional(),
|
|
3188
3287
|
until: timestampSchema.optional(),
|
|
3189
|
-
order:
|
|
3288
|
+
order: z24.enum(["asc", "desc"]).default("asc")
|
|
3190
3289
|
});
|
|
3191
|
-
var publicRunLogsContract =
|
|
3290
|
+
var publicRunLogsContract = c20.router({
|
|
3192
3291
|
getLogs: {
|
|
3193
3292
|
method: "GET",
|
|
3194
3293
|
path: "/v1/runs/:id/logs",
|
|
3195
3294
|
headers: authHeadersSchema,
|
|
3196
|
-
pathParams:
|
|
3197
|
-
id:
|
|
3295
|
+
pathParams: z24.object({
|
|
3296
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3198
3297
|
}),
|
|
3199
3298
|
query: logsQuerySchema,
|
|
3200
3299
|
responses: {
|
|
@@ -3207,30 +3306,30 @@ var publicRunLogsContract = c19.router({
|
|
|
3207
3306
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
3208
3307
|
}
|
|
3209
3308
|
});
|
|
3210
|
-
var metricPointSchema =
|
|
3309
|
+
var metricPointSchema = z24.object({
|
|
3211
3310
|
timestamp: timestampSchema,
|
|
3212
|
-
cpuPercent:
|
|
3213
|
-
memoryUsedMb:
|
|
3214
|
-
memoryTotalMb:
|
|
3215
|
-
diskUsedMb:
|
|
3216
|
-
diskTotalMb:
|
|
3217
|
-
});
|
|
3218
|
-
var metricsSummarySchema =
|
|
3219
|
-
avgCpuPercent:
|
|
3220
|
-
maxMemoryUsedMb:
|
|
3221
|
-
totalDurationMs:
|
|
3222
|
-
});
|
|
3223
|
-
var metricsResponseSchema2 =
|
|
3224
|
-
data:
|
|
3311
|
+
cpuPercent: z24.number(),
|
|
3312
|
+
memoryUsedMb: z24.number(),
|
|
3313
|
+
memoryTotalMb: z24.number(),
|
|
3314
|
+
diskUsedMb: z24.number(),
|
|
3315
|
+
diskTotalMb: z24.number()
|
|
3316
|
+
});
|
|
3317
|
+
var metricsSummarySchema = z24.object({
|
|
3318
|
+
avgCpuPercent: z24.number(),
|
|
3319
|
+
maxMemoryUsedMb: z24.number(),
|
|
3320
|
+
totalDurationMs: z24.number().nullable()
|
|
3321
|
+
});
|
|
3322
|
+
var metricsResponseSchema2 = z24.object({
|
|
3323
|
+
data: z24.array(metricPointSchema),
|
|
3225
3324
|
summary: metricsSummarySchema
|
|
3226
3325
|
});
|
|
3227
|
-
var publicRunMetricsContract =
|
|
3326
|
+
var publicRunMetricsContract = c20.router({
|
|
3228
3327
|
getMetrics: {
|
|
3229
3328
|
method: "GET",
|
|
3230
3329
|
path: "/v1/runs/:id/metrics",
|
|
3231
3330
|
headers: authHeadersSchema,
|
|
3232
|
-
pathParams:
|
|
3233
|
-
id:
|
|
3331
|
+
pathParams: z24.object({
|
|
3332
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3234
3333
|
}),
|
|
3235
3334
|
responses: {
|
|
3236
3335
|
200: metricsResponseSchema2,
|
|
@@ -3242,7 +3341,7 @@ var publicRunMetricsContract = c19.router({
|
|
|
3242
3341
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
3243
3342
|
}
|
|
3244
3343
|
});
|
|
3245
|
-
var sseEventTypeSchema =
|
|
3344
|
+
var sseEventTypeSchema = z24.enum([
|
|
3246
3345
|
"status",
|
|
3247
3346
|
// Run status change
|
|
3248
3347
|
"output",
|
|
@@ -3254,26 +3353,26 @@ var sseEventTypeSchema = z23.enum([
|
|
|
3254
3353
|
"heartbeat"
|
|
3255
3354
|
// Keep-alive
|
|
3256
3355
|
]);
|
|
3257
|
-
var sseEventSchema =
|
|
3356
|
+
var sseEventSchema = z24.object({
|
|
3258
3357
|
event: sseEventTypeSchema,
|
|
3259
|
-
data:
|
|
3260
|
-
id:
|
|
3358
|
+
data: z24.unknown(),
|
|
3359
|
+
id: z24.string().optional()
|
|
3261
3360
|
// For Last-Event-ID reconnection
|
|
3262
3361
|
});
|
|
3263
|
-
var publicRunEventsContract =
|
|
3362
|
+
var publicRunEventsContract = c20.router({
|
|
3264
3363
|
streamEvents: {
|
|
3265
3364
|
method: "GET",
|
|
3266
3365
|
path: "/v1/runs/:id/events",
|
|
3267
3366
|
headers: authHeadersSchema,
|
|
3268
|
-
pathParams:
|
|
3269
|
-
id:
|
|
3367
|
+
pathParams: z24.object({
|
|
3368
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3270
3369
|
}),
|
|
3271
|
-
query:
|
|
3272
|
-
lastEventId:
|
|
3370
|
+
query: z24.object({
|
|
3371
|
+
lastEventId: z24.string().optional()
|
|
3273
3372
|
// For reconnection
|
|
3274
3373
|
}),
|
|
3275
3374
|
responses: {
|
|
3276
|
-
200:
|
|
3375
|
+
200: z24.any(),
|
|
3277
3376
|
// SSE stream - actual content is text/event-stream
|
|
3278
3377
|
401: publicApiErrorSchema,
|
|
3279
3378
|
404: publicApiErrorSchema,
|
|
@@ -3285,28 +3384,28 @@ var publicRunEventsContract = c19.router({
|
|
|
3285
3384
|
});
|
|
3286
3385
|
|
|
3287
3386
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
3288
|
-
import { z as
|
|
3289
|
-
var
|
|
3290
|
-
var publicArtifactSchema =
|
|
3291
|
-
id:
|
|
3292
|
-
name:
|
|
3293
|
-
currentVersionId:
|
|
3294
|
-
size:
|
|
3387
|
+
import { z as z25 } from "zod";
|
|
3388
|
+
var c21 = initContract();
|
|
3389
|
+
var publicArtifactSchema = z25.object({
|
|
3390
|
+
id: z25.string(),
|
|
3391
|
+
name: z25.string(),
|
|
3392
|
+
currentVersionId: z25.string().nullable(),
|
|
3393
|
+
size: z25.number(),
|
|
3295
3394
|
// Total size in bytes
|
|
3296
|
-
fileCount:
|
|
3395
|
+
fileCount: z25.number(),
|
|
3297
3396
|
createdAt: timestampSchema,
|
|
3298
3397
|
updatedAt: timestampSchema
|
|
3299
3398
|
});
|
|
3300
|
-
var artifactVersionSchema =
|
|
3301
|
-
id:
|
|
3399
|
+
var artifactVersionSchema = z25.object({
|
|
3400
|
+
id: z25.string(),
|
|
3302
3401
|
// SHA-256 content hash
|
|
3303
|
-
artifactId:
|
|
3304
|
-
size:
|
|
3402
|
+
artifactId: z25.string(),
|
|
3403
|
+
size: z25.number(),
|
|
3305
3404
|
// Size in bytes
|
|
3306
|
-
fileCount:
|
|
3307
|
-
message:
|
|
3405
|
+
fileCount: z25.number(),
|
|
3406
|
+
message: z25.string().nullable(),
|
|
3308
3407
|
// Optional commit message
|
|
3309
|
-
createdBy:
|
|
3408
|
+
createdBy: z25.string(),
|
|
3310
3409
|
createdAt: timestampSchema
|
|
3311
3410
|
});
|
|
3312
3411
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -3316,7 +3415,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
3316
3415
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
3317
3416
|
artifactVersionSchema
|
|
3318
3417
|
);
|
|
3319
|
-
var publicArtifactsListContract =
|
|
3418
|
+
var publicArtifactsListContract = c21.router({
|
|
3320
3419
|
list: {
|
|
3321
3420
|
method: "GET",
|
|
3322
3421
|
path: "/v1/artifacts",
|
|
@@ -3331,13 +3430,13 @@ var publicArtifactsListContract = c20.router({
|
|
|
3331
3430
|
description: "List all artifacts in the current scope with pagination"
|
|
3332
3431
|
}
|
|
3333
3432
|
});
|
|
3334
|
-
var publicArtifactByIdContract =
|
|
3433
|
+
var publicArtifactByIdContract = c21.router({
|
|
3335
3434
|
get: {
|
|
3336
3435
|
method: "GET",
|
|
3337
3436
|
path: "/v1/artifacts/:id",
|
|
3338
3437
|
headers: authHeadersSchema,
|
|
3339
|
-
pathParams:
|
|
3340
|
-
id:
|
|
3438
|
+
pathParams: z25.object({
|
|
3439
|
+
id: z25.string().min(1, "Artifact ID is required")
|
|
3341
3440
|
}),
|
|
3342
3441
|
responses: {
|
|
3343
3442
|
200: publicArtifactDetailSchema,
|
|
@@ -3349,13 +3448,13 @@ var publicArtifactByIdContract = c20.router({
|
|
|
3349
3448
|
description: "Get artifact details by ID"
|
|
3350
3449
|
}
|
|
3351
3450
|
});
|
|
3352
|
-
var publicArtifactVersionsContract =
|
|
3451
|
+
var publicArtifactVersionsContract = c21.router({
|
|
3353
3452
|
list: {
|
|
3354
3453
|
method: "GET",
|
|
3355
3454
|
path: "/v1/artifacts/:id/versions",
|
|
3356
3455
|
headers: authHeadersSchema,
|
|
3357
|
-
pathParams:
|
|
3358
|
-
id:
|
|
3456
|
+
pathParams: z25.object({
|
|
3457
|
+
id: z25.string().min(1, "Artifact ID is required")
|
|
3359
3458
|
}),
|
|
3360
3459
|
query: listQuerySchema,
|
|
3361
3460
|
responses: {
|
|
@@ -3368,20 +3467,20 @@ var publicArtifactVersionsContract = c20.router({
|
|
|
3368
3467
|
description: "List all versions of an artifact with pagination"
|
|
3369
3468
|
}
|
|
3370
3469
|
});
|
|
3371
|
-
var publicArtifactDownloadContract =
|
|
3470
|
+
var publicArtifactDownloadContract = c21.router({
|
|
3372
3471
|
download: {
|
|
3373
3472
|
method: "GET",
|
|
3374
3473
|
path: "/v1/artifacts/:id/download",
|
|
3375
3474
|
headers: authHeadersSchema,
|
|
3376
|
-
pathParams:
|
|
3377
|
-
id:
|
|
3475
|
+
pathParams: z25.object({
|
|
3476
|
+
id: z25.string().min(1, "Artifact ID is required")
|
|
3378
3477
|
}),
|
|
3379
|
-
query:
|
|
3380
|
-
versionId:
|
|
3478
|
+
query: z25.object({
|
|
3479
|
+
versionId: z25.string().optional()
|
|
3381
3480
|
// Defaults to current version
|
|
3382
3481
|
}),
|
|
3383
3482
|
responses: {
|
|
3384
|
-
302:
|
|
3483
|
+
302: z25.undefined(),
|
|
3385
3484
|
// Redirect to presigned URL
|
|
3386
3485
|
401: publicApiErrorSchema,
|
|
3387
3486
|
404: publicApiErrorSchema,
|
|
@@ -3393,28 +3492,28 @@ var publicArtifactDownloadContract = c20.router({
|
|
|
3393
3492
|
});
|
|
3394
3493
|
|
|
3395
3494
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
3396
|
-
import { z as
|
|
3397
|
-
var
|
|
3398
|
-
var publicVolumeSchema =
|
|
3399
|
-
id:
|
|
3400
|
-
name:
|
|
3401
|
-
currentVersionId:
|
|
3402
|
-
size:
|
|
3495
|
+
import { z as z26 } from "zod";
|
|
3496
|
+
var c22 = initContract();
|
|
3497
|
+
var publicVolumeSchema = z26.object({
|
|
3498
|
+
id: z26.string(),
|
|
3499
|
+
name: z26.string(),
|
|
3500
|
+
currentVersionId: z26.string().nullable(),
|
|
3501
|
+
size: z26.number(),
|
|
3403
3502
|
// Total size in bytes
|
|
3404
|
-
fileCount:
|
|
3503
|
+
fileCount: z26.number(),
|
|
3405
3504
|
createdAt: timestampSchema,
|
|
3406
3505
|
updatedAt: timestampSchema
|
|
3407
3506
|
});
|
|
3408
|
-
var volumeVersionSchema =
|
|
3409
|
-
id:
|
|
3507
|
+
var volumeVersionSchema = z26.object({
|
|
3508
|
+
id: z26.string(),
|
|
3410
3509
|
// SHA-256 content hash
|
|
3411
|
-
volumeId:
|
|
3412
|
-
size:
|
|
3510
|
+
volumeId: z26.string(),
|
|
3511
|
+
size: z26.number(),
|
|
3413
3512
|
// Size in bytes
|
|
3414
|
-
fileCount:
|
|
3415
|
-
message:
|
|
3513
|
+
fileCount: z26.number(),
|
|
3514
|
+
message: z26.string().nullable(),
|
|
3416
3515
|
// Optional commit message
|
|
3417
|
-
createdBy:
|
|
3516
|
+
createdBy: z26.string(),
|
|
3418
3517
|
createdAt: timestampSchema
|
|
3419
3518
|
});
|
|
3420
3519
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -3422,7 +3521,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
3422
3521
|
});
|
|
3423
3522
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
3424
3523
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
3425
|
-
var publicVolumesListContract =
|
|
3524
|
+
var publicVolumesListContract = c22.router({
|
|
3426
3525
|
list: {
|
|
3427
3526
|
method: "GET",
|
|
3428
3527
|
path: "/v1/volumes",
|
|
@@ -3437,13 +3536,13 @@ var publicVolumesListContract = c21.router({
|
|
|
3437
3536
|
description: "List all volumes in the current scope with pagination"
|
|
3438
3537
|
}
|
|
3439
3538
|
});
|
|
3440
|
-
var publicVolumeByIdContract =
|
|
3539
|
+
var publicVolumeByIdContract = c22.router({
|
|
3441
3540
|
get: {
|
|
3442
3541
|
method: "GET",
|
|
3443
3542
|
path: "/v1/volumes/:id",
|
|
3444
3543
|
headers: authHeadersSchema,
|
|
3445
|
-
pathParams:
|
|
3446
|
-
id:
|
|
3544
|
+
pathParams: z26.object({
|
|
3545
|
+
id: z26.string().min(1, "Volume ID is required")
|
|
3447
3546
|
}),
|
|
3448
3547
|
responses: {
|
|
3449
3548
|
200: publicVolumeDetailSchema,
|
|
@@ -3455,13 +3554,13 @@ var publicVolumeByIdContract = c21.router({
|
|
|
3455
3554
|
description: "Get volume details by ID"
|
|
3456
3555
|
}
|
|
3457
3556
|
});
|
|
3458
|
-
var publicVolumeVersionsContract =
|
|
3557
|
+
var publicVolumeVersionsContract = c22.router({
|
|
3459
3558
|
list: {
|
|
3460
3559
|
method: "GET",
|
|
3461
3560
|
path: "/v1/volumes/:id/versions",
|
|
3462
3561
|
headers: authHeadersSchema,
|
|
3463
|
-
pathParams:
|
|
3464
|
-
id:
|
|
3562
|
+
pathParams: z26.object({
|
|
3563
|
+
id: z26.string().min(1, "Volume ID is required")
|
|
3465
3564
|
}),
|
|
3466
3565
|
query: listQuerySchema,
|
|
3467
3566
|
responses: {
|
|
@@ -3474,20 +3573,20 @@ var publicVolumeVersionsContract = c21.router({
|
|
|
3474
3573
|
description: "List all versions of a volume with pagination"
|
|
3475
3574
|
}
|
|
3476
3575
|
});
|
|
3477
|
-
var publicVolumeDownloadContract =
|
|
3576
|
+
var publicVolumeDownloadContract = c22.router({
|
|
3478
3577
|
download: {
|
|
3479
3578
|
method: "GET",
|
|
3480
3579
|
path: "/v1/volumes/:id/download",
|
|
3481
3580
|
headers: authHeadersSchema,
|
|
3482
|
-
pathParams:
|
|
3483
|
-
id:
|
|
3581
|
+
pathParams: z26.object({
|
|
3582
|
+
id: z26.string().min(1, "Volume ID is required")
|
|
3484
3583
|
}),
|
|
3485
|
-
query:
|
|
3486
|
-
versionId:
|
|
3584
|
+
query: z26.object({
|
|
3585
|
+
versionId: z26.string().optional()
|
|
3487
3586
|
// Defaults to current version
|
|
3488
3587
|
}),
|
|
3489
3588
|
responses: {
|
|
3490
|
-
302:
|
|
3589
|
+
302: z26.undefined(),
|
|
3491
3590
|
// Redirect to presigned URL
|
|
3492
3591
|
401: publicApiErrorSchema,
|
|
3493
3592
|
404: publicApiErrorSchema,
|
|
@@ -3673,6 +3772,26 @@ async function httpGet(path16) {
|
|
|
3673
3772
|
headers
|
|
3674
3773
|
});
|
|
3675
3774
|
}
|
|
3775
|
+
async function httpPost(path16, body) {
|
|
3776
|
+
const baseUrl = await getBaseUrl();
|
|
3777
|
+
const headers = await getRawHeaders();
|
|
3778
|
+
return fetch(`${baseUrl}${path16}`, {
|
|
3779
|
+
method: "POST",
|
|
3780
|
+
headers: {
|
|
3781
|
+
...headers,
|
|
3782
|
+
"Content-Type": "application/json"
|
|
3783
|
+
},
|
|
3784
|
+
body: JSON.stringify(body)
|
|
3785
|
+
});
|
|
3786
|
+
}
|
|
3787
|
+
async function httpDelete(path16) {
|
|
3788
|
+
const baseUrl = await getBaseUrl();
|
|
3789
|
+
const headers = await getRawHeaders();
|
|
3790
|
+
return fetch(`${baseUrl}${path16}`, {
|
|
3791
|
+
method: "DELETE",
|
|
3792
|
+
headers
|
|
3793
|
+
});
|
|
3794
|
+
}
|
|
3676
3795
|
|
|
3677
3796
|
// src/lib/api/domains/composes.ts
|
|
3678
3797
|
import { initClient } from "@ts-rest/core";
|
|
@@ -4005,53 +4124,96 @@ async function deleteSecret(name) {
|
|
|
4005
4124
|
handleError(result, `Secret "${name}" not found`);
|
|
4006
4125
|
}
|
|
4007
4126
|
|
|
4008
|
-
// src/lib/api/domains/
|
|
4127
|
+
// src/lib/api/domains/variables.ts
|
|
4009
4128
|
import { initClient as initClient8 } from "@ts-rest/core";
|
|
4010
|
-
async function
|
|
4129
|
+
async function listVariables() {
|
|
4011
4130
|
const config = await getClientConfig();
|
|
4012
|
-
const client = initClient8(
|
|
4131
|
+
const client = initClient8(variablesMainContract, config);
|
|
4013
4132
|
const result = await client.list({ headers: {} });
|
|
4014
4133
|
if (result.status === 200) {
|
|
4015
4134
|
return result.body;
|
|
4016
4135
|
}
|
|
4017
|
-
handleError(result, "Failed to list
|
|
4136
|
+
handleError(result, "Failed to list variables");
|
|
4018
4137
|
}
|
|
4019
|
-
async function
|
|
4138
|
+
async function getVariable(name) {
|
|
4020
4139
|
const config = await getClientConfig();
|
|
4021
|
-
const client = initClient8(
|
|
4022
|
-
const result = await client.
|
|
4023
|
-
|
|
4140
|
+
const client = initClient8(variablesByNameContract, config);
|
|
4141
|
+
const result = await client.get({
|
|
4142
|
+
params: { name }
|
|
4143
|
+
});
|
|
4144
|
+
if (result.status === 200) {
|
|
4024
4145
|
return result.body;
|
|
4025
4146
|
}
|
|
4026
|
-
handleError(result, "
|
|
4147
|
+
handleError(result, `Variable "${name}" not found`);
|
|
4027
4148
|
}
|
|
4028
|
-
async function
|
|
4149
|
+
async function setVariable(body) {
|
|
4029
4150
|
const config = await getClientConfig();
|
|
4030
|
-
const client = initClient8(
|
|
4031
|
-
const result = await client.
|
|
4032
|
-
|
|
4033
|
-
});
|
|
4034
|
-
if (result.status === 200) {
|
|
4151
|
+
const client = initClient8(variablesMainContract, config);
|
|
4152
|
+
const result = await client.set({ body });
|
|
4153
|
+
if (result.status === 200 || result.status === 201) {
|
|
4035
4154
|
return result.body;
|
|
4036
4155
|
}
|
|
4037
|
-
handleError(result, "Failed to
|
|
4156
|
+
handleError(result, "Failed to set variable");
|
|
4038
4157
|
}
|
|
4039
|
-
async function
|
|
4158
|
+
async function deleteVariable(name) {
|
|
4040
4159
|
const config = await getClientConfig();
|
|
4041
|
-
const client = initClient8(
|
|
4160
|
+
const client = initClient8(variablesByNameContract, config);
|
|
4042
4161
|
const result = await client.delete({
|
|
4043
|
-
params: {
|
|
4162
|
+
params: { name }
|
|
4044
4163
|
});
|
|
4045
4164
|
if (result.status === 204) {
|
|
4046
4165
|
return;
|
|
4047
4166
|
}
|
|
4048
|
-
handleError(result, `
|
|
4167
|
+
handleError(result, `Variable "${name}" not found`);
|
|
4049
4168
|
}
|
|
4050
|
-
|
|
4169
|
+
|
|
4170
|
+
// src/lib/api/domains/model-providers.ts
|
|
4171
|
+
import { initClient as initClient9 } from "@ts-rest/core";
|
|
4172
|
+
async function listModelProviders() {
|
|
4051
4173
|
const config = await getClientConfig();
|
|
4052
|
-
const client =
|
|
4053
|
-
const result = await client.
|
|
4054
|
-
|
|
4174
|
+
const client = initClient9(modelProvidersMainContract, config);
|
|
4175
|
+
const result = await client.list({ headers: {} });
|
|
4176
|
+
if (result.status === 200) {
|
|
4177
|
+
return result.body;
|
|
4178
|
+
}
|
|
4179
|
+
handleError(result, "Failed to list model providers");
|
|
4180
|
+
}
|
|
4181
|
+
async function upsertModelProvider(body) {
|
|
4182
|
+
const config = await getClientConfig();
|
|
4183
|
+
const client = initClient9(modelProvidersMainContract, config);
|
|
4184
|
+
const result = await client.upsert({ body });
|
|
4185
|
+
if (result.status === 200 || result.status === 201) {
|
|
4186
|
+
return result.body;
|
|
4187
|
+
}
|
|
4188
|
+
handleError(result, "Failed to set model provider");
|
|
4189
|
+
}
|
|
4190
|
+
async function checkModelProviderCredential(type) {
|
|
4191
|
+
const config = await getClientConfig();
|
|
4192
|
+
const client = initClient9(modelProvidersCheckContract, config);
|
|
4193
|
+
const result = await client.check({
|
|
4194
|
+
params: { type }
|
|
4195
|
+
});
|
|
4196
|
+
if (result.status === 200) {
|
|
4197
|
+
return result.body;
|
|
4198
|
+
}
|
|
4199
|
+
handleError(result, "Failed to check credential");
|
|
4200
|
+
}
|
|
4201
|
+
async function deleteModelProvider(type) {
|
|
4202
|
+
const config = await getClientConfig();
|
|
4203
|
+
const client = initClient9(modelProvidersByTypeContract, config);
|
|
4204
|
+
const result = await client.delete({
|
|
4205
|
+
params: { type }
|
|
4206
|
+
});
|
|
4207
|
+
if (result.status === 204) {
|
|
4208
|
+
return;
|
|
4209
|
+
}
|
|
4210
|
+
handleError(result, `Model provider "${type}" not found`);
|
|
4211
|
+
}
|
|
4212
|
+
async function convertModelProviderCredential(type) {
|
|
4213
|
+
const config = await getClientConfig();
|
|
4214
|
+
const client = initClient9(modelProvidersConvertContract, config);
|
|
4215
|
+
const result = await client.convert({
|
|
4216
|
+
params: { type }
|
|
4055
4217
|
});
|
|
4056
4218
|
if (result.status === 200) {
|
|
4057
4219
|
return result.body;
|
|
@@ -4060,7 +4222,7 @@ async function convertModelProviderCredential(type) {
|
|
|
4060
4222
|
}
|
|
4061
4223
|
async function setModelProviderDefault(type) {
|
|
4062
4224
|
const config = await getClientConfig();
|
|
4063
|
-
const client =
|
|
4225
|
+
const client = initClient9(modelProvidersSetDefaultContract, config);
|
|
4064
4226
|
const result = await client.setDefault({
|
|
4065
4227
|
params: { type }
|
|
4066
4228
|
});
|
|
@@ -4071,7 +4233,7 @@ async function setModelProviderDefault(type) {
|
|
|
4071
4233
|
}
|
|
4072
4234
|
async function updateModelProviderModel(type, selectedModel) {
|
|
4073
4235
|
const config = await getClientConfig();
|
|
4074
|
-
const client =
|
|
4236
|
+
const client = initClient9(modelProvidersUpdateModelContract, config);
|
|
4075
4237
|
const result = await client.updateModel({
|
|
4076
4238
|
params: { type },
|
|
4077
4239
|
body: { selectedModel }
|
|
@@ -4102,8 +4264,8 @@ async function getUsage(options) {
|
|
|
4102
4264
|
}
|
|
4103
4265
|
|
|
4104
4266
|
// src/lib/domain/yaml-validator.ts
|
|
4105
|
-
import { z as
|
|
4106
|
-
var cliAgentNameSchema =
|
|
4267
|
+
import { z as z27 } from "zod";
|
|
4268
|
+
var cliAgentNameSchema = z27.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
4107
4269
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
4108
4270
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
4109
4271
|
);
|
|
@@ -4118,7 +4280,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4118
4280
|
const skillUrl = agent.skills[i];
|
|
4119
4281
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
4120
4282
|
ctx.addIssue({
|
|
4121
|
-
code:
|
|
4283
|
+
code: z27.ZodIssueCode.custom,
|
|
4122
4284
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
4123
4285
|
path: ["skills", i]
|
|
4124
4286
|
});
|
|
@@ -4127,15 +4289,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4127
4289
|
}
|
|
4128
4290
|
}
|
|
4129
4291
|
);
|
|
4130
|
-
var cliComposeSchema =
|
|
4131
|
-
version:
|
|
4132
|
-
agents:
|
|
4133
|
-
volumes:
|
|
4292
|
+
var cliComposeSchema = z27.object({
|
|
4293
|
+
version: z27.string().min(1, "Missing config.version"),
|
|
4294
|
+
agents: z27.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
4295
|
+
volumes: z27.record(z27.string(), volumeConfigSchema).optional()
|
|
4134
4296
|
}).superRefine((config, ctx) => {
|
|
4135
4297
|
const agentKeys = Object.keys(config.agents);
|
|
4136
4298
|
if (agentKeys.length === 0) {
|
|
4137
4299
|
ctx.addIssue({
|
|
4138
|
-
code:
|
|
4300
|
+
code: z27.ZodIssueCode.custom,
|
|
4139
4301
|
message: "agents must have at least one agent defined",
|
|
4140
4302
|
path: ["agents"]
|
|
4141
4303
|
});
|
|
@@ -4143,7 +4305,7 @@ var cliComposeSchema = z26.object({
|
|
|
4143
4305
|
}
|
|
4144
4306
|
if (agentKeys.length > 1) {
|
|
4145
4307
|
ctx.addIssue({
|
|
4146
|
-
code:
|
|
4308
|
+
code: z27.ZodIssueCode.custom,
|
|
4147
4309
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
4148
4310
|
path: ["agents"]
|
|
4149
4311
|
});
|
|
@@ -4155,7 +4317,7 @@ var cliComposeSchema = z26.object({
|
|
|
4155
4317
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
4156
4318
|
if (!config.volumes) {
|
|
4157
4319
|
ctx.addIssue({
|
|
4158
|
-
code:
|
|
4320
|
+
code: z27.ZodIssueCode.custom,
|
|
4159
4321
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
4160
4322
|
path: ["volumes"]
|
|
4161
4323
|
});
|
|
@@ -4165,7 +4327,7 @@ var cliComposeSchema = z26.object({
|
|
|
4165
4327
|
const parts = volDeclaration.split(":");
|
|
4166
4328
|
if (parts.length !== 2) {
|
|
4167
4329
|
ctx.addIssue({
|
|
4168
|
-
code:
|
|
4330
|
+
code: z27.ZodIssueCode.custom,
|
|
4169
4331
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
4170
4332
|
path: ["agents", agentName, "volumes"]
|
|
4171
4333
|
});
|
|
@@ -4174,7 +4336,7 @@ var cliComposeSchema = z26.object({
|
|
|
4174
4336
|
const volumeKey = parts[0].trim();
|
|
4175
4337
|
if (!config.volumes[volumeKey]) {
|
|
4176
4338
|
ctx.addIssue({
|
|
4177
|
-
code:
|
|
4339
|
+
code: z27.ZodIssueCode.custom,
|
|
4178
4340
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
4179
4341
|
path: ["volumes", volumeKey]
|
|
4180
4342
|
});
|
|
@@ -5224,7 +5386,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
5224
5386
|
)
|
|
5225
5387
|
);
|
|
5226
5388
|
if (options.autoUpdate !== false) {
|
|
5227
|
-
await silentUpgradeAfterCommand("9.
|
|
5389
|
+
await silentUpgradeAfterCommand("9.19.0");
|
|
5228
5390
|
}
|
|
5229
5391
|
} catch (error) {
|
|
5230
5392
|
if (error instanceof Error) {
|
|
@@ -5979,9 +6141,9 @@ var CodexEventParser = class {
|
|
|
5979
6141
|
}
|
|
5980
6142
|
}
|
|
5981
6143
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
5982
|
-
const changes = item.changes.map((
|
|
5983
|
-
const action =
|
|
5984
|
-
return `${action}: ${
|
|
6144
|
+
const changes = item.changes.map((c23) => {
|
|
6145
|
+
const action = c23.kind === "add" ? "Created" : c23.kind === "modify" ? "Modified" : "Deleted";
|
|
6146
|
+
return `${action}: ${c23.path}`;
|
|
5985
6147
|
}).join("\n");
|
|
5986
6148
|
return {
|
|
5987
6149
|
type: "text",
|
|
@@ -6135,9 +6297,9 @@ var CodexEventRenderer = class {
|
|
|
6135
6297
|
return;
|
|
6136
6298
|
}
|
|
6137
6299
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6138
|
-
const summary = item.changes.map((
|
|
6139
|
-
const icon =
|
|
6140
|
-
return `${icon}${
|
|
6300
|
+
const summary = item.changes.map((c23) => {
|
|
6301
|
+
const icon = c23.kind === "add" ? "+" : c23.kind === "delete" ? "-" : "~";
|
|
6302
|
+
return `${icon}${c23.path}`;
|
|
6141
6303
|
}).join(", ");
|
|
6142
6304
|
console.log(chalk7.green("[files]") + ` ${summary}`);
|
|
6143
6305
|
return;
|
|
@@ -6158,7 +6320,7 @@ var CodexEventRenderer = class {
|
|
|
6158
6320
|
};
|
|
6159
6321
|
|
|
6160
6322
|
// src/lib/api/api-client.ts
|
|
6161
|
-
import { initClient as
|
|
6323
|
+
import { initClient as initClient10 } from "@ts-rest/core";
|
|
6162
6324
|
var ApiClient = class {
|
|
6163
6325
|
async getHeaders() {
|
|
6164
6326
|
const token = await getToken();
|
|
@@ -6184,7 +6346,7 @@ var ApiClient = class {
|
|
|
6184
6346
|
async getComposeByName(name, scope) {
|
|
6185
6347
|
const baseUrl = await this.getBaseUrl();
|
|
6186
6348
|
const headers = await this.getHeaders();
|
|
6187
|
-
const client =
|
|
6349
|
+
const client = initClient10(composesMainContract, {
|
|
6188
6350
|
baseUrl,
|
|
6189
6351
|
baseHeaders: headers,
|
|
6190
6352
|
jsonQuery: true
|
|
@@ -6205,7 +6367,7 @@ var ApiClient = class {
|
|
|
6205
6367
|
async getComposeById(id) {
|
|
6206
6368
|
const baseUrl = await this.getBaseUrl();
|
|
6207
6369
|
const headers = await this.getHeaders();
|
|
6208
|
-
const client =
|
|
6370
|
+
const client = initClient10(composesByIdContract, {
|
|
6209
6371
|
baseUrl,
|
|
6210
6372
|
baseHeaders: headers,
|
|
6211
6373
|
jsonQuery: true
|
|
@@ -6227,7 +6389,7 @@ var ApiClient = class {
|
|
|
6227
6389
|
async getComposeVersion(composeId, version) {
|
|
6228
6390
|
const baseUrl = await this.getBaseUrl();
|
|
6229
6391
|
const headers = await this.getHeaders();
|
|
6230
|
-
const client =
|
|
6392
|
+
const client = initClient10(composesVersionsContract, {
|
|
6231
6393
|
baseUrl,
|
|
6232
6394
|
baseHeaders: headers,
|
|
6233
6395
|
jsonQuery: true
|
|
@@ -6248,7 +6410,7 @@ var ApiClient = class {
|
|
|
6248
6410
|
async createOrUpdateCompose(body) {
|
|
6249
6411
|
const baseUrl = await this.getBaseUrl();
|
|
6250
6412
|
const headers = await this.getHeaders();
|
|
6251
|
-
const client =
|
|
6413
|
+
const client = initClient10(composesMainContract, {
|
|
6252
6414
|
baseUrl,
|
|
6253
6415
|
baseHeaders: headers,
|
|
6254
6416
|
jsonQuery: true
|
|
@@ -6271,7 +6433,7 @@ var ApiClient = class {
|
|
|
6271
6433
|
async createRun(body) {
|
|
6272
6434
|
const baseUrl = await this.getBaseUrl();
|
|
6273
6435
|
const headers = await this.getHeaders();
|
|
6274
|
-
const client =
|
|
6436
|
+
const client = initClient10(runsMainContract, {
|
|
6275
6437
|
baseUrl,
|
|
6276
6438
|
baseHeaders: headers,
|
|
6277
6439
|
jsonQuery: true
|
|
@@ -6287,7 +6449,7 @@ var ApiClient = class {
|
|
|
6287
6449
|
async getEvents(runId, options) {
|
|
6288
6450
|
const baseUrl = await this.getBaseUrl();
|
|
6289
6451
|
const headers = await this.getHeaders();
|
|
6290
|
-
const client =
|
|
6452
|
+
const client = initClient10(runEventsContract, {
|
|
6291
6453
|
baseUrl,
|
|
6292
6454
|
baseHeaders: headers,
|
|
6293
6455
|
jsonQuery: true
|
|
@@ -6309,7 +6471,7 @@ var ApiClient = class {
|
|
|
6309
6471
|
async getSystemLog(runId, options) {
|
|
6310
6472
|
const baseUrl = await this.getBaseUrl();
|
|
6311
6473
|
const headers = await this.getHeaders();
|
|
6312
|
-
const client =
|
|
6474
|
+
const client = initClient10(runSystemLogContract, {
|
|
6313
6475
|
baseUrl,
|
|
6314
6476
|
baseHeaders: headers,
|
|
6315
6477
|
jsonQuery: true
|
|
@@ -6332,7 +6494,7 @@ var ApiClient = class {
|
|
|
6332
6494
|
async getMetrics(runId, options) {
|
|
6333
6495
|
const baseUrl = await this.getBaseUrl();
|
|
6334
6496
|
const headers = await this.getHeaders();
|
|
6335
|
-
const client =
|
|
6497
|
+
const client = initClient10(runMetricsContract, {
|
|
6336
6498
|
baseUrl,
|
|
6337
6499
|
baseHeaders: headers,
|
|
6338
6500
|
jsonQuery: true
|
|
@@ -6355,7 +6517,7 @@ var ApiClient = class {
|
|
|
6355
6517
|
async getAgentEvents(runId, options) {
|
|
6356
6518
|
const baseUrl = await this.getBaseUrl();
|
|
6357
6519
|
const headers = await this.getHeaders();
|
|
6358
|
-
const client =
|
|
6520
|
+
const client = initClient10(runAgentEventsContract, {
|
|
6359
6521
|
baseUrl,
|
|
6360
6522
|
baseHeaders: headers,
|
|
6361
6523
|
jsonQuery: true
|
|
@@ -6378,7 +6540,7 @@ var ApiClient = class {
|
|
|
6378
6540
|
async getNetworkLogs(runId, options) {
|
|
6379
6541
|
const baseUrl = await this.getBaseUrl();
|
|
6380
6542
|
const headers = await this.getHeaders();
|
|
6381
|
-
const client =
|
|
6543
|
+
const client = initClient10(runNetworkLogsContract, {
|
|
6382
6544
|
baseUrl,
|
|
6383
6545
|
baseHeaders: headers,
|
|
6384
6546
|
jsonQuery: true
|
|
@@ -6404,7 +6566,7 @@ var ApiClient = class {
|
|
|
6404
6566
|
async getScope() {
|
|
6405
6567
|
const baseUrl = await this.getBaseUrl();
|
|
6406
6568
|
const headers = await this.getHeaders();
|
|
6407
|
-
const client =
|
|
6569
|
+
const client = initClient10(scopeContract, {
|
|
6408
6570
|
baseUrl,
|
|
6409
6571
|
baseHeaders: headers,
|
|
6410
6572
|
jsonQuery: true
|
|
@@ -6423,7 +6585,7 @@ var ApiClient = class {
|
|
|
6423
6585
|
async createScope(body) {
|
|
6424
6586
|
const baseUrl = await this.getBaseUrl();
|
|
6425
6587
|
const headers = await this.getHeaders();
|
|
6426
|
-
const client =
|
|
6588
|
+
const client = initClient10(scopeContract, {
|
|
6427
6589
|
baseUrl,
|
|
6428
6590
|
baseHeaders: headers,
|
|
6429
6591
|
jsonQuery: true
|
|
@@ -6442,7 +6604,7 @@ var ApiClient = class {
|
|
|
6442
6604
|
async updateScope(body) {
|
|
6443
6605
|
const baseUrl = await this.getBaseUrl();
|
|
6444
6606
|
const headers = await this.getHeaders();
|
|
6445
|
-
const client =
|
|
6607
|
+
const client = initClient10(scopeContract, {
|
|
6446
6608
|
baseUrl,
|
|
6447
6609
|
baseHeaders: headers,
|
|
6448
6610
|
jsonQuery: true
|
|
@@ -6462,7 +6624,7 @@ var ApiClient = class {
|
|
|
6462
6624
|
async getSession(sessionId) {
|
|
6463
6625
|
const baseUrl = await this.getBaseUrl();
|
|
6464
6626
|
const headers = await this.getHeaders();
|
|
6465
|
-
const client =
|
|
6627
|
+
const client = initClient10(sessionsByIdContract, {
|
|
6466
6628
|
baseUrl,
|
|
6467
6629
|
baseHeaders: headers,
|
|
6468
6630
|
jsonQuery: true
|
|
@@ -6484,7 +6646,7 @@ var ApiClient = class {
|
|
|
6484
6646
|
async getCheckpoint(checkpointId) {
|
|
6485
6647
|
const baseUrl = await this.getBaseUrl();
|
|
6486
6648
|
const headers = await this.getHeaders();
|
|
6487
|
-
const client =
|
|
6649
|
+
const client = initClient10(checkpointsByIdContract, {
|
|
6488
6650
|
baseUrl,
|
|
6489
6651
|
baseHeaders: headers,
|
|
6490
6652
|
jsonQuery: true
|
|
@@ -6505,7 +6667,7 @@ var ApiClient = class {
|
|
|
6505
6667
|
async prepareStorage(body) {
|
|
6506
6668
|
const baseUrl = await this.getBaseUrl();
|
|
6507
6669
|
const headers = await this.getHeaders();
|
|
6508
|
-
const client =
|
|
6670
|
+
const client = initClient10(storagesPrepareContract, {
|
|
6509
6671
|
baseUrl,
|
|
6510
6672
|
baseHeaders: headers,
|
|
6511
6673
|
jsonQuery: true
|
|
@@ -6524,7 +6686,7 @@ var ApiClient = class {
|
|
|
6524
6686
|
async commitStorage(body) {
|
|
6525
6687
|
const baseUrl = await this.getBaseUrl();
|
|
6526
6688
|
const headers = await this.getHeaders();
|
|
6527
|
-
const client =
|
|
6689
|
+
const client = initClient10(storagesCommitContract, {
|
|
6528
6690
|
baseUrl,
|
|
6529
6691
|
baseHeaders: headers,
|
|
6530
6692
|
jsonQuery: true
|
|
@@ -6543,7 +6705,7 @@ var ApiClient = class {
|
|
|
6543
6705
|
async getStorageDownload(query) {
|
|
6544
6706
|
const baseUrl = await this.getBaseUrl();
|
|
6545
6707
|
const headers = await this.getHeaders();
|
|
6546
|
-
const client =
|
|
6708
|
+
const client = initClient10(storagesDownloadContract, {
|
|
6547
6709
|
baseUrl,
|
|
6548
6710
|
baseHeaders: headers,
|
|
6549
6711
|
jsonQuery: true
|
|
@@ -6568,7 +6730,7 @@ var ApiClient = class {
|
|
|
6568
6730
|
async listStorages(query) {
|
|
6569
6731
|
const baseUrl = await this.getBaseUrl();
|
|
6570
6732
|
const headers = await this.getHeaders();
|
|
6571
|
-
const client =
|
|
6733
|
+
const client = initClient10(storagesListContract, {
|
|
6572
6734
|
baseUrl,
|
|
6573
6735
|
baseHeaders: headers,
|
|
6574
6736
|
jsonQuery: true
|
|
@@ -6587,7 +6749,7 @@ var ApiClient = class {
|
|
|
6587
6749
|
async deploySchedule(body) {
|
|
6588
6750
|
const baseUrl = await this.getBaseUrl();
|
|
6589
6751
|
const headers = await this.getHeaders();
|
|
6590
|
-
const client =
|
|
6752
|
+
const client = initClient10(schedulesMainContract, {
|
|
6591
6753
|
baseUrl,
|
|
6592
6754
|
baseHeaders: headers,
|
|
6593
6755
|
jsonQuery: true
|
|
@@ -6606,7 +6768,7 @@ var ApiClient = class {
|
|
|
6606
6768
|
async listSchedules() {
|
|
6607
6769
|
const baseUrl = await this.getBaseUrl();
|
|
6608
6770
|
const headers = await this.getHeaders();
|
|
6609
|
-
const client =
|
|
6771
|
+
const client = initClient10(schedulesMainContract, {
|
|
6610
6772
|
baseUrl,
|
|
6611
6773
|
baseHeaders: headers,
|
|
6612
6774
|
jsonQuery: true
|
|
@@ -6625,7 +6787,7 @@ var ApiClient = class {
|
|
|
6625
6787
|
async getScheduleByName(params) {
|
|
6626
6788
|
const baseUrl = await this.getBaseUrl();
|
|
6627
6789
|
const headers = await this.getHeaders();
|
|
6628
|
-
const client =
|
|
6790
|
+
const client = initClient10(schedulesByNameContract, {
|
|
6629
6791
|
baseUrl,
|
|
6630
6792
|
baseHeaders: headers,
|
|
6631
6793
|
jsonQuery: true
|
|
@@ -6647,7 +6809,7 @@ var ApiClient = class {
|
|
|
6647
6809
|
async deleteSchedule(params) {
|
|
6648
6810
|
const baseUrl = await this.getBaseUrl();
|
|
6649
6811
|
const headers = await this.getHeaders();
|
|
6650
|
-
const client =
|
|
6812
|
+
const client = initClient10(schedulesByNameContract, {
|
|
6651
6813
|
baseUrl,
|
|
6652
6814
|
baseHeaders: headers,
|
|
6653
6815
|
jsonQuery: true
|
|
@@ -6669,7 +6831,7 @@ var ApiClient = class {
|
|
|
6669
6831
|
async enableSchedule(params) {
|
|
6670
6832
|
const baseUrl = await this.getBaseUrl();
|
|
6671
6833
|
const headers = await this.getHeaders();
|
|
6672
|
-
const client =
|
|
6834
|
+
const client = initClient10(schedulesEnableContract, {
|
|
6673
6835
|
baseUrl,
|
|
6674
6836
|
baseHeaders: headers,
|
|
6675
6837
|
jsonQuery: true
|
|
@@ -6691,7 +6853,7 @@ var ApiClient = class {
|
|
|
6691
6853
|
async disableSchedule(params) {
|
|
6692
6854
|
const baseUrl = await this.getBaseUrl();
|
|
6693
6855
|
const headers = await this.getHeaders();
|
|
6694
|
-
const client =
|
|
6856
|
+
const client = initClient10(schedulesEnableContract, {
|
|
6695
6857
|
baseUrl,
|
|
6696
6858
|
baseHeaders: headers,
|
|
6697
6859
|
jsonQuery: true
|
|
@@ -6713,7 +6875,7 @@ var ApiClient = class {
|
|
|
6713
6875
|
async listScheduleRuns(params) {
|
|
6714
6876
|
const baseUrl = await this.getBaseUrl();
|
|
6715
6877
|
const headers = await this.getHeaders();
|
|
6716
|
-
const client =
|
|
6878
|
+
const client = initClient10(scheduleRunsContract, {
|
|
6717
6879
|
baseUrl,
|
|
6718
6880
|
baseHeaders: headers,
|
|
6719
6881
|
jsonQuery: true
|
|
@@ -6738,7 +6900,7 @@ var ApiClient = class {
|
|
|
6738
6900
|
async listPublicAgents(query) {
|
|
6739
6901
|
const baseUrl = await this.getBaseUrl();
|
|
6740
6902
|
const headers = await this.getHeaders();
|
|
6741
|
-
const client =
|
|
6903
|
+
const client = initClient10(publicAgentsListContract, {
|
|
6742
6904
|
baseUrl,
|
|
6743
6905
|
baseHeaders: headers,
|
|
6744
6906
|
jsonQuery: true
|
|
@@ -6757,7 +6919,7 @@ var ApiClient = class {
|
|
|
6757
6919
|
async listPublicArtifacts(query) {
|
|
6758
6920
|
const baseUrl = await this.getBaseUrl();
|
|
6759
6921
|
const headers = await this.getHeaders();
|
|
6760
|
-
const client =
|
|
6922
|
+
const client = initClient10(publicArtifactsListContract, {
|
|
6761
6923
|
baseUrl,
|
|
6762
6924
|
baseHeaders: headers,
|
|
6763
6925
|
jsonQuery: true
|
|
@@ -6776,7 +6938,7 @@ var ApiClient = class {
|
|
|
6776
6938
|
async getPublicArtifact(id) {
|
|
6777
6939
|
const baseUrl = await this.getBaseUrl();
|
|
6778
6940
|
const headers = await this.getHeaders();
|
|
6779
|
-
const client =
|
|
6941
|
+
const client = initClient10(publicArtifactByIdContract, {
|
|
6780
6942
|
baseUrl,
|
|
6781
6943
|
baseHeaders: headers,
|
|
6782
6944
|
jsonQuery: true
|
|
@@ -6795,7 +6957,7 @@ var ApiClient = class {
|
|
|
6795
6957
|
async listPublicVolumes(query) {
|
|
6796
6958
|
const baseUrl = await this.getBaseUrl();
|
|
6797
6959
|
const headers = await this.getHeaders();
|
|
6798
|
-
const client =
|
|
6960
|
+
const client = initClient10(publicVolumesListContract, {
|
|
6799
6961
|
baseUrl,
|
|
6800
6962
|
baseHeaders: headers,
|
|
6801
6963
|
jsonQuery: true
|
|
@@ -6814,7 +6976,7 @@ var ApiClient = class {
|
|
|
6814
6976
|
async getPublicVolume(id) {
|
|
6815
6977
|
const baseUrl = await this.getBaseUrl();
|
|
6816
6978
|
const headers = await this.getHeaders();
|
|
6817
|
-
const client =
|
|
6979
|
+
const client = initClient10(publicVolumeByIdContract, {
|
|
6818
6980
|
baseUrl,
|
|
6819
6981
|
baseHeaders: headers,
|
|
6820
6982
|
jsonQuery: true
|
|
@@ -6853,7 +7015,7 @@ var ApiClient = class {
|
|
|
6853
7015
|
async listCredentials() {
|
|
6854
7016
|
const baseUrl = await this.getBaseUrl();
|
|
6855
7017
|
const headers = await this.getHeaders();
|
|
6856
|
-
const client =
|
|
7018
|
+
const client = initClient10(credentialsMainContract, {
|
|
6857
7019
|
baseUrl,
|
|
6858
7020
|
baseHeaders: headers,
|
|
6859
7021
|
jsonQuery: true
|
|
@@ -6872,7 +7034,7 @@ var ApiClient = class {
|
|
|
6872
7034
|
async getCredential(name) {
|
|
6873
7035
|
const baseUrl = await this.getBaseUrl();
|
|
6874
7036
|
const headers = await this.getHeaders();
|
|
6875
|
-
const client =
|
|
7037
|
+
const client = initClient10(credentialsByNameContract, {
|
|
6876
7038
|
baseUrl,
|
|
6877
7039
|
baseHeaders: headers,
|
|
6878
7040
|
jsonQuery: true
|
|
@@ -6893,7 +7055,7 @@ var ApiClient = class {
|
|
|
6893
7055
|
async setCredential(body) {
|
|
6894
7056
|
const baseUrl = await this.getBaseUrl();
|
|
6895
7057
|
const headers = await this.getHeaders();
|
|
6896
|
-
const client =
|
|
7058
|
+
const client = initClient10(credentialsMainContract, {
|
|
6897
7059
|
baseUrl,
|
|
6898
7060
|
baseHeaders: headers,
|
|
6899
7061
|
jsonQuery: true
|
|
@@ -6912,7 +7074,7 @@ var ApiClient = class {
|
|
|
6912
7074
|
async deleteCredential(name) {
|
|
6913
7075
|
const baseUrl = await this.getBaseUrl();
|
|
6914
7076
|
const headers = await this.getHeaders();
|
|
6915
|
-
const client =
|
|
7077
|
+
const client = initClient10(credentialsByNameContract, {
|
|
6916
7078
|
baseUrl,
|
|
6917
7079
|
baseHeaders: headers,
|
|
6918
7080
|
jsonQuery: true
|
|
@@ -6933,7 +7095,7 @@ var ApiClient = class {
|
|
|
6933
7095
|
async getRealtimeToken(runId) {
|
|
6934
7096
|
const baseUrl = await this.getBaseUrl();
|
|
6935
7097
|
const headers = await this.getHeaders();
|
|
6936
|
-
const client =
|
|
7098
|
+
const client = initClient10(realtimeTokenContract, {
|
|
6937
7099
|
baseUrl,
|
|
6938
7100
|
baseHeaders: headers,
|
|
6939
7101
|
jsonQuery: true
|
|
@@ -7455,7 +7617,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
7455
7617
|
}
|
|
7456
7618
|
showNextSteps(result);
|
|
7457
7619
|
if (options.autoUpdate !== false) {
|
|
7458
|
-
await silentUpgradeAfterCommand("9.
|
|
7620
|
+
await silentUpgradeAfterCommand("9.19.0");
|
|
7459
7621
|
}
|
|
7460
7622
|
} catch (error) {
|
|
7461
7623
|
handleRunError(error, identifier);
|
|
@@ -8962,7 +9124,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
8962
9124
|
).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(
|
|
8963
9125
|
async (prompt, options) => {
|
|
8964
9126
|
if (options.autoUpdate !== false) {
|
|
8965
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9127
|
+
const shouldExit = await checkAndUpgrade("9.19.0", prompt);
|
|
8966
9128
|
if (shouldExit) {
|
|
8967
9129
|
process.exit(0);
|
|
8968
9130
|
}
|
|
@@ -9537,7 +9699,7 @@ var setCommand = new Command33().name("set").description("Set your scope slug").
|
|
|
9537
9699
|
var scopeCommand = new Command34().name("scope").description("Manage your scope (namespace for agents)").addCommand(statusCommand4).addCommand(setCommand);
|
|
9538
9700
|
|
|
9539
9701
|
// src/commands/agent/index.ts
|
|
9540
|
-
import { Command as
|
|
9702
|
+
import { Command as Command43 } from "commander";
|
|
9541
9703
|
|
|
9542
9704
|
// src/commands/agent/clone.ts
|
|
9543
9705
|
import { Command as Command35 } from "commander";
|
|
@@ -9677,7 +9839,7 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
9677
9839
|
);
|
|
9678
9840
|
return;
|
|
9679
9841
|
}
|
|
9680
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
9842
|
+
const nameWidth = Math.max(4, ...data.composes.map((c23) => c23.name.length));
|
|
9681
9843
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
9682
9844
|
" "
|
|
9683
9845
|
);
|
|
@@ -9957,12 +10119,206 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
9957
10119
|
}
|
|
9958
10120
|
});
|
|
9959
10121
|
|
|
10122
|
+
// src/commands/agent/public.ts
|
|
10123
|
+
import { Command as Command38 } from "commander";
|
|
10124
|
+
import chalk39 from "chalk";
|
|
10125
|
+
var publicCommand = new Command38().name("public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").action(async (name) => {
|
|
10126
|
+
try {
|
|
10127
|
+
const compose = await getComposeByName(name);
|
|
10128
|
+
if (!compose) {
|
|
10129
|
+
console.error(chalk39.red(`\u2717 Agent not found: ${name}`));
|
|
10130
|
+
process.exit(1);
|
|
10131
|
+
}
|
|
10132
|
+
const scope = await getScope();
|
|
10133
|
+
const response = await httpPost(
|
|
10134
|
+
`/api/agent/composes/${compose.id}/permissions`,
|
|
10135
|
+
{ granteeType: "public" }
|
|
10136
|
+
);
|
|
10137
|
+
if (!response.ok) {
|
|
10138
|
+
const error = await response.json();
|
|
10139
|
+
if (response.status === 409) {
|
|
10140
|
+
console.log(chalk39.yellow(`Agent "${name}" is already public`));
|
|
10141
|
+
return;
|
|
10142
|
+
}
|
|
10143
|
+
throw new Error(error.error?.message || "Failed to make agent public");
|
|
10144
|
+
}
|
|
10145
|
+
const fullName = `${scope.slug}/${name}`;
|
|
10146
|
+
console.log(chalk39.green(`\u2713 Agent "${name}" is now public`));
|
|
10147
|
+
console.log();
|
|
10148
|
+
console.log("Others can now run your agent with:");
|
|
10149
|
+
console.log(chalk39.cyan(` vm0 run ${fullName} "your prompt"`));
|
|
10150
|
+
} catch (error) {
|
|
10151
|
+
console.error(chalk39.red("\u2717 Failed to make agent public"));
|
|
10152
|
+
if (error instanceof Error) {
|
|
10153
|
+
console.error(chalk39.dim(` ${error.message}`));
|
|
10154
|
+
}
|
|
10155
|
+
process.exit(1);
|
|
10156
|
+
}
|
|
10157
|
+
});
|
|
10158
|
+
|
|
10159
|
+
// src/commands/agent/private.ts
|
|
10160
|
+
import { Command as Command39 } from "commander";
|
|
10161
|
+
import chalk40 from "chalk";
|
|
10162
|
+
var privateCommand = new Command39().name("private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").action(async (name) => {
|
|
10163
|
+
try {
|
|
10164
|
+
const compose = await getComposeByName(name);
|
|
10165
|
+
if (!compose) {
|
|
10166
|
+
console.error(chalk40.red(`\u2717 Agent not found: ${name}`));
|
|
10167
|
+
process.exit(1);
|
|
10168
|
+
}
|
|
10169
|
+
const response = await httpDelete(
|
|
10170
|
+
`/api/agent/composes/${compose.id}/permissions?type=public`
|
|
10171
|
+
);
|
|
10172
|
+
if (!response.ok) {
|
|
10173
|
+
const error = await response.json();
|
|
10174
|
+
if (response.status === 404) {
|
|
10175
|
+
console.log(chalk40.yellow(`Agent "${name}" is already private`));
|
|
10176
|
+
return;
|
|
10177
|
+
}
|
|
10178
|
+
throw new Error(error.error?.message || "Failed to make agent private");
|
|
10179
|
+
}
|
|
10180
|
+
console.log(chalk40.green(`\u2713 Agent "${name}" is now private`));
|
|
10181
|
+
} catch (error) {
|
|
10182
|
+
console.error(chalk40.red("\u2717 Failed to make agent private"));
|
|
10183
|
+
if (error instanceof Error) {
|
|
10184
|
+
console.error(chalk40.dim(` ${error.message}`));
|
|
10185
|
+
}
|
|
10186
|
+
process.exit(1);
|
|
10187
|
+
}
|
|
10188
|
+
});
|
|
10189
|
+
|
|
10190
|
+
// src/commands/agent/share.ts
|
|
10191
|
+
import { Command as Command40 } from "commander";
|
|
10192
|
+
import chalk41 from "chalk";
|
|
10193
|
+
var shareCommand = new Command40().name("share").description("Share an agent with a user by email").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to share with").action(async (name, options) => {
|
|
10194
|
+
try {
|
|
10195
|
+
const compose = await getComposeByName(name);
|
|
10196
|
+
if (!compose) {
|
|
10197
|
+
console.error(chalk41.red(`\u2717 Agent not found: ${name}`));
|
|
10198
|
+
process.exit(1);
|
|
10199
|
+
}
|
|
10200
|
+
const scope = await getScope();
|
|
10201
|
+
const response = await httpPost(
|
|
10202
|
+
`/api/agent/composes/${compose.id}/permissions`,
|
|
10203
|
+
{ granteeType: "email", granteeEmail: options.email }
|
|
10204
|
+
);
|
|
10205
|
+
if (!response.ok) {
|
|
10206
|
+
const error = await response.json();
|
|
10207
|
+
if (response.status === 409) {
|
|
10208
|
+
console.log(
|
|
10209
|
+
chalk41.yellow(
|
|
10210
|
+
`Agent "${name}" is already shared with ${options.email}`
|
|
10211
|
+
)
|
|
10212
|
+
);
|
|
10213
|
+
return;
|
|
10214
|
+
}
|
|
10215
|
+
throw new Error(error.error?.message || "Failed to share agent");
|
|
10216
|
+
}
|
|
10217
|
+
const fullName = `${scope.slug}/${name}`;
|
|
10218
|
+
console.log(
|
|
10219
|
+
chalk41.green(`\u2713 Agent "${name}" shared with ${options.email}`)
|
|
10220
|
+
);
|
|
10221
|
+
console.log();
|
|
10222
|
+
console.log("They can now run your agent with:");
|
|
10223
|
+
console.log(chalk41.cyan(` vm0 run ${fullName} "your prompt"`));
|
|
10224
|
+
} catch (error) {
|
|
10225
|
+
console.error(chalk41.red("\u2717 Failed to share agent"));
|
|
10226
|
+
if (error instanceof Error) {
|
|
10227
|
+
console.error(chalk41.dim(` ${error.message}`));
|
|
10228
|
+
}
|
|
10229
|
+
process.exit(1);
|
|
10230
|
+
}
|
|
10231
|
+
});
|
|
10232
|
+
|
|
10233
|
+
// src/commands/agent/unshare.ts
|
|
10234
|
+
import { Command as Command41 } from "commander";
|
|
10235
|
+
import chalk42 from "chalk";
|
|
10236
|
+
var unshareCommand = new Command41().name("unshare").description("Remove sharing from a user").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to unshare").action(async (name, options) => {
|
|
10237
|
+
try {
|
|
10238
|
+
const compose = await getComposeByName(name);
|
|
10239
|
+
if (!compose) {
|
|
10240
|
+
console.error(chalk42.red(`\u2717 Agent not found: ${name}`));
|
|
10241
|
+
process.exit(1);
|
|
10242
|
+
}
|
|
10243
|
+
const response = await httpDelete(
|
|
10244
|
+
`/api/agent/composes/${compose.id}/permissions?type=email&email=${encodeURIComponent(options.email)}`
|
|
10245
|
+
);
|
|
10246
|
+
if (!response.ok) {
|
|
10247
|
+
const error = await response.json();
|
|
10248
|
+
if (response.status === 404) {
|
|
10249
|
+
console.log(
|
|
10250
|
+
chalk42.yellow(`Agent "${name}" is not shared with ${options.email}`)
|
|
10251
|
+
);
|
|
10252
|
+
return;
|
|
10253
|
+
}
|
|
10254
|
+
throw new Error(error.error?.message || "Failed to unshare agent");
|
|
10255
|
+
}
|
|
10256
|
+
console.log(
|
|
10257
|
+
chalk42.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
|
|
10258
|
+
);
|
|
10259
|
+
} catch (error) {
|
|
10260
|
+
console.error(chalk42.red("\u2717 Failed to unshare agent"));
|
|
10261
|
+
if (error instanceof Error) {
|
|
10262
|
+
console.error(chalk42.dim(` ${error.message}`));
|
|
10263
|
+
}
|
|
10264
|
+
process.exit(1);
|
|
10265
|
+
}
|
|
10266
|
+
});
|
|
10267
|
+
|
|
10268
|
+
// src/commands/agent/permission.ts
|
|
10269
|
+
import { Command as Command42 } from "commander";
|
|
10270
|
+
import chalk43 from "chalk";
|
|
10271
|
+
var permissionCommand = new Command42().name("permission").description("List all permissions for an agent").argument("<name>", "Agent name").action(async (name) => {
|
|
10272
|
+
try {
|
|
10273
|
+
const compose = await getComposeByName(name);
|
|
10274
|
+
if (!compose) {
|
|
10275
|
+
console.error(chalk43.red(`\u2717 Agent not found: ${name}`));
|
|
10276
|
+
process.exit(1);
|
|
10277
|
+
}
|
|
10278
|
+
const response = await httpGet(
|
|
10279
|
+
`/api/agent/composes/${compose.id}/permissions`
|
|
10280
|
+
);
|
|
10281
|
+
if (!response.ok) {
|
|
10282
|
+
const error = await response.json();
|
|
10283
|
+
throw new Error(error.error?.message || "Failed to list permissions");
|
|
10284
|
+
}
|
|
10285
|
+
const data = await response.json();
|
|
10286
|
+
if (data.permissions.length === 0) {
|
|
10287
|
+
console.log(chalk43.dim("No permissions set (private agent)"));
|
|
10288
|
+
return;
|
|
10289
|
+
}
|
|
10290
|
+
console.log(
|
|
10291
|
+
chalk43.dim(
|
|
10292
|
+
"TYPE EMAIL PERMISSION GRANTED"
|
|
10293
|
+
)
|
|
10294
|
+
);
|
|
10295
|
+
console.log(
|
|
10296
|
+
chalk43.dim(
|
|
10297
|
+
"------- ----------------------------- ---------- ----------"
|
|
10298
|
+
)
|
|
10299
|
+
);
|
|
10300
|
+
for (const p of data.permissions) {
|
|
10301
|
+
const type = p.granteeType.padEnd(7);
|
|
10302
|
+
const email = (p.granteeEmail ?? "-").padEnd(29);
|
|
10303
|
+
const permission = p.permission.padEnd(10);
|
|
10304
|
+
const granted = formatRelativeTime(p.createdAt);
|
|
10305
|
+
console.log(`${type} ${email} ${permission} ${granted}`);
|
|
10306
|
+
}
|
|
10307
|
+
} catch (error) {
|
|
10308
|
+
console.error(chalk43.red("\u2717 Failed to list permissions"));
|
|
10309
|
+
if (error instanceof Error) {
|
|
10310
|
+
console.error(chalk43.dim(` ${error.message}`));
|
|
10311
|
+
}
|
|
10312
|
+
process.exit(1);
|
|
10313
|
+
}
|
|
10314
|
+
});
|
|
10315
|
+
|
|
9960
10316
|
// src/commands/agent/index.ts
|
|
9961
|
-
var agentCommand = new
|
|
10317
|
+
var agentCommand = new Command43().name("agent").description("Manage agent composes").addCommand(cloneCommand3).addCommand(listCommand4).addCommand(statusCommand5).addCommand(publicCommand).addCommand(privateCommand).addCommand(shareCommand).addCommand(unshareCommand).addCommand(permissionCommand);
|
|
9962
10318
|
|
|
9963
10319
|
// src/commands/init/index.ts
|
|
9964
|
-
import { Command as
|
|
9965
|
-
import
|
|
10320
|
+
import { Command as Command44 } from "commander";
|
|
10321
|
+
import chalk44 from "chalk";
|
|
9966
10322
|
import path15 from "path";
|
|
9967
10323
|
import { existsSync as existsSync10 } from "fs";
|
|
9968
10324
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -10000,14 +10356,14 @@ function checkExistingFiles() {
|
|
|
10000
10356
|
if (existsSync10(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
10001
10357
|
return existingFiles;
|
|
10002
10358
|
}
|
|
10003
|
-
var initCommand3 = new
|
|
10359
|
+
var initCommand3 = new Command44().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(async (options) => {
|
|
10004
10360
|
const existingFiles = checkExistingFiles();
|
|
10005
10361
|
if (existingFiles.length > 0 && !options.force) {
|
|
10006
10362
|
for (const file of existingFiles) {
|
|
10007
|
-
console.log(
|
|
10363
|
+
console.log(chalk44.red(`\u2717 ${file} already exists`));
|
|
10008
10364
|
}
|
|
10009
10365
|
console.log();
|
|
10010
|
-
console.log(`To overwrite: ${
|
|
10366
|
+
console.log(`To overwrite: ${chalk44.cyan("vm0 init --force")}`);
|
|
10011
10367
|
process.exit(1);
|
|
10012
10368
|
}
|
|
10013
10369
|
let agentName;
|
|
@@ -10015,9 +10371,9 @@ var initCommand3 = new Command39().name("init").description("Initialize a new VM
|
|
|
10015
10371
|
agentName = options.name.trim();
|
|
10016
10372
|
} else if (!isInteractive()) {
|
|
10017
10373
|
console.error(
|
|
10018
|
-
|
|
10374
|
+
chalk44.red("\u2717 --name flag is required in non-interactive mode")
|
|
10019
10375
|
);
|
|
10020
|
-
console.error(
|
|
10376
|
+
console.error(chalk44.dim(" Usage: vm0 init --name <agent-name>"));
|
|
10021
10377
|
process.exit(1);
|
|
10022
10378
|
} else {
|
|
10023
10379
|
const dirName = path15.basename(process.cwd());
|
|
@@ -10033,47 +10389,47 @@ var initCommand3 = new Command39().name("init").description("Initialize a new VM
|
|
|
10033
10389
|
}
|
|
10034
10390
|
);
|
|
10035
10391
|
if (name === void 0) {
|
|
10036
|
-
console.log(
|
|
10392
|
+
console.log(chalk44.dim("Cancelled"));
|
|
10037
10393
|
return;
|
|
10038
10394
|
}
|
|
10039
10395
|
agentName = name;
|
|
10040
10396
|
}
|
|
10041
10397
|
if (!agentName || !validateAgentName(agentName)) {
|
|
10042
|
-
console.log(
|
|
10398
|
+
console.log(chalk44.red("\u2717 Invalid agent name"));
|
|
10043
10399
|
console.log(
|
|
10044
|
-
|
|
10400
|
+
chalk44.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
10045
10401
|
);
|
|
10046
|
-
console.log(
|
|
10402
|
+
console.log(chalk44.dim(" Must start and end with letter or number"));
|
|
10047
10403
|
process.exit(1);
|
|
10048
10404
|
}
|
|
10049
10405
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
10050
10406
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
10051
|
-
console.log(
|
|
10407
|
+
console.log(chalk44.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
10052
10408
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
10053
10409
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
10054
|
-
console.log(
|
|
10410
|
+
console.log(chalk44.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
10055
10411
|
console.log();
|
|
10056
10412
|
console.log("Next steps:");
|
|
10057
10413
|
console.log(
|
|
10058
|
-
` 1. Set up model provider (one-time): ${
|
|
10414
|
+
` 1. Set up model provider (one-time): ${chalk44.cyan("vm0 model-provider setup")}`
|
|
10059
10415
|
);
|
|
10060
10416
|
console.log(
|
|
10061
|
-
` 2. Edit ${
|
|
10417
|
+
` 2. Edit ${chalk44.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
10062
10418
|
);
|
|
10063
10419
|
console.log(
|
|
10064
|
-
` Or install Claude plugin: ${
|
|
10420
|
+
` Or install Claude plugin: ${chalk44.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
10065
10421
|
);
|
|
10066
10422
|
console.log(
|
|
10067
|
-
` 3. Run your agent: ${
|
|
10423
|
+
` 3. Run your agent: ${chalk44.cyan(`vm0 cook "let's start working"`)}`
|
|
10068
10424
|
);
|
|
10069
10425
|
});
|
|
10070
10426
|
|
|
10071
10427
|
// src/commands/schedule/index.ts
|
|
10072
|
-
import { Command as
|
|
10428
|
+
import { Command as Command51 } from "commander";
|
|
10073
10429
|
|
|
10074
10430
|
// src/commands/schedule/setup.ts
|
|
10075
|
-
import { Command as
|
|
10076
|
-
import
|
|
10431
|
+
import { Command as Command45 } from "commander";
|
|
10432
|
+
import chalk46 from "chalk";
|
|
10077
10433
|
|
|
10078
10434
|
// src/lib/domain/schedule-utils.ts
|
|
10079
10435
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -10215,7 +10571,7 @@ async function resolveScheduleByAgent(agentName) {
|
|
|
10215
10571
|
}
|
|
10216
10572
|
|
|
10217
10573
|
// src/commands/schedule/gather-configuration.ts
|
|
10218
|
-
import
|
|
10574
|
+
import chalk45 from "chalk";
|
|
10219
10575
|
var defaultPromptDeps = {
|
|
10220
10576
|
isInteractive,
|
|
10221
10577
|
promptConfirm,
|
|
@@ -10243,7 +10599,7 @@ async function handleExistingSecrets(existingSecretNames, deps) {
|
|
|
10243
10599
|
return true;
|
|
10244
10600
|
}
|
|
10245
10601
|
console.log(
|
|
10246
|
-
|
|
10602
|
+
chalk45.dim(
|
|
10247
10603
|
" Note: Secrets will be cleared. Use 'vm0 secret set' to add platform secrets."
|
|
10248
10604
|
)
|
|
10249
10605
|
);
|
|
@@ -10268,21 +10624,21 @@ async function handleVars(optionVars, existingVars, deps) {
|
|
|
10268
10624
|
}
|
|
10269
10625
|
function displayMissingRequirements(missingSecrets, missingVars) {
|
|
10270
10626
|
if (missingSecrets.length > 0) {
|
|
10271
|
-
console.log(
|
|
10627
|
+
console.log(chalk45.yellow("\nAgent requires the following secrets:"));
|
|
10272
10628
|
for (const name of missingSecrets) {
|
|
10273
|
-
console.log(
|
|
10629
|
+
console.log(chalk45.dim(` ${name}`));
|
|
10274
10630
|
}
|
|
10275
10631
|
console.log();
|
|
10276
10632
|
console.log("Set secrets using the platform:");
|
|
10277
10633
|
for (const name of missingSecrets) {
|
|
10278
|
-
console.log(
|
|
10634
|
+
console.log(chalk45.cyan(` vm0 secret set ${name} <value>`));
|
|
10279
10635
|
}
|
|
10280
10636
|
console.log();
|
|
10281
10637
|
}
|
|
10282
10638
|
if (missingVars.length > 0) {
|
|
10283
|
-
console.log(
|
|
10639
|
+
console.log(chalk45.yellow("\nAgent requires the following variables:"));
|
|
10284
10640
|
for (const name of missingVars) {
|
|
10285
|
-
console.log(
|
|
10641
|
+
console.log(chalk45.dim(` ${name}`));
|
|
10286
10642
|
}
|
|
10287
10643
|
console.log();
|
|
10288
10644
|
}
|
|
@@ -10290,7 +10646,7 @@ function displayMissingRequirements(missingSecrets, missingVars) {
|
|
|
10290
10646
|
async function promptForMissingVars(missingVars, vars, deps) {
|
|
10291
10647
|
for (const name of missingVars) {
|
|
10292
10648
|
const value = await deps.promptText(
|
|
10293
|
-
`Enter value for var ${
|
|
10649
|
+
`Enter value for var ${chalk45.cyan(name)}`,
|
|
10294
10650
|
""
|
|
10295
10651
|
);
|
|
10296
10652
|
if (value) {
|
|
@@ -10378,7 +10734,7 @@ function expandEnvVars(value) {
|
|
|
10378
10734
|
const envValue = process.env[varName];
|
|
10379
10735
|
if (envValue === void 0) {
|
|
10380
10736
|
console.warn(
|
|
10381
|
-
|
|
10737
|
+
chalk46.yellow(` Warning: Environment variable ${varName} not set`)
|
|
10382
10738
|
);
|
|
10383
10739
|
return match;
|
|
10384
10740
|
}
|
|
@@ -10445,11 +10801,11 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
10445
10801
|
}
|
|
10446
10802
|
if (!isInteractive()) {
|
|
10447
10803
|
console.error(
|
|
10448
|
-
|
|
10804
|
+
chalk46.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
10449
10805
|
);
|
|
10450
10806
|
process.exit(1);
|
|
10451
10807
|
}
|
|
10452
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
10808
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c23) => c23.value === existingFrequency) : 0;
|
|
10453
10809
|
frequency = await promptSelect(
|
|
10454
10810
|
"Schedule frequency",
|
|
10455
10811
|
FREQUENCY_CHOICES,
|
|
@@ -10465,7 +10821,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10465
10821
|
const day2 = parseDayOption(optionDay, frequency);
|
|
10466
10822
|
if (day2 === void 0) {
|
|
10467
10823
|
console.error(
|
|
10468
|
-
|
|
10824
|
+
chalk46.red(
|
|
10469
10825
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
10470
10826
|
)
|
|
10471
10827
|
);
|
|
@@ -10474,11 +10830,11 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10474
10830
|
return day2;
|
|
10475
10831
|
}
|
|
10476
10832
|
if (!isInteractive()) {
|
|
10477
|
-
console.error(
|
|
10833
|
+
console.error(chalk46.red("\u2717 --day is required for weekly/monthly"));
|
|
10478
10834
|
process.exit(1);
|
|
10479
10835
|
}
|
|
10480
10836
|
if (frequency === "weekly") {
|
|
10481
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
10837
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c23) => c23.value === existingDay) : 0;
|
|
10482
10838
|
const day2 = await promptSelect(
|
|
10483
10839
|
"Day of week",
|
|
10484
10840
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -10493,7 +10849,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10493
10849
|
if (!dayStr) return null;
|
|
10494
10850
|
const day = parseInt(dayStr, 10);
|
|
10495
10851
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
10496
|
-
console.error(
|
|
10852
|
+
console.error(chalk46.red("\u2717 Day must be between 1 and 31"));
|
|
10497
10853
|
process.exit(1);
|
|
10498
10854
|
}
|
|
10499
10855
|
return day;
|
|
@@ -10502,13 +10858,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
10502
10858
|
if (optionTime) {
|
|
10503
10859
|
const validation = validateTimeFormat(optionTime);
|
|
10504
10860
|
if (validation !== true) {
|
|
10505
|
-
console.error(
|
|
10861
|
+
console.error(chalk46.red(`\u2717 Invalid time: ${validation}`));
|
|
10506
10862
|
process.exit(1);
|
|
10507
10863
|
}
|
|
10508
10864
|
return optionTime;
|
|
10509
10865
|
}
|
|
10510
10866
|
if (!isInteractive()) {
|
|
10511
|
-
console.error(
|
|
10867
|
+
console.error(chalk46.red("\u2717 --time is required (HH:MM format)"));
|
|
10512
10868
|
process.exit(1);
|
|
10513
10869
|
}
|
|
10514
10870
|
return await promptText(
|
|
@@ -10521,7 +10877,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
10521
10877
|
if (optionDay && optionTime) {
|
|
10522
10878
|
if (!validateDateFormat(optionDay)) {
|
|
10523
10879
|
console.error(
|
|
10524
|
-
|
|
10880
|
+
chalk46.red(
|
|
10525
10881
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
10526
10882
|
)
|
|
10527
10883
|
);
|
|
@@ -10529,16 +10885,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
10529
10885
|
}
|
|
10530
10886
|
if (!validateTimeFormat(optionTime)) {
|
|
10531
10887
|
console.error(
|
|
10532
|
-
|
|
10888
|
+
chalk46.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
10533
10889
|
);
|
|
10534
10890
|
process.exit(1);
|
|
10535
10891
|
}
|
|
10536
10892
|
return `${optionDay} ${optionTime}`;
|
|
10537
10893
|
}
|
|
10538
10894
|
if (!isInteractive()) {
|
|
10539
|
-
console.error(
|
|
10895
|
+
console.error(chalk46.red("\u2717 One-time schedules require interactive mode"));
|
|
10540
10896
|
console.error(
|
|
10541
|
-
|
|
10897
|
+
chalk46.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
10542
10898
|
);
|
|
10543
10899
|
process.exit(1);
|
|
10544
10900
|
}
|
|
@@ -10569,7 +10925,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
10569
10925
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
10570
10926
|
if (optionPrompt) return optionPrompt;
|
|
10571
10927
|
if (!isInteractive()) {
|
|
10572
|
-
console.error(
|
|
10928
|
+
console.error(chalk46.red("\u2717 --prompt is required"));
|
|
10573
10929
|
process.exit(1);
|
|
10574
10930
|
}
|
|
10575
10931
|
return await promptText(
|
|
@@ -10580,8 +10936,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
10580
10936
|
async function resolveAgent(agentName) {
|
|
10581
10937
|
const compose = await getComposeByName(agentName);
|
|
10582
10938
|
if (!compose) {
|
|
10583
|
-
console.error(
|
|
10584
|
-
console.error(
|
|
10939
|
+
console.error(chalk46.red(`\u2717 Agent not found: ${agentName}`));
|
|
10940
|
+
console.error(chalk46.dim(" Make sure the agent is composed first"));
|
|
10585
10941
|
process.exit(1);
|
|
10586
10942
|
}
|
|
10587
10943
|
return {
|
|
@@ -10628,7 +10984,7 @@ async function buildAndDeploy(params) {
|
|
|
10628
10984
|
const expandedSecrets = expandEnvVarsInObject(params.secrets);
|
|
10629
10985
|
console.log(
|
|
10630
10986
|
`
|
|
10631
|
-
Deploying schedule for agent ${
|
|
10987
|
+
Deploying schedule for agent ${chalk46.cyan(params.agentName)}...`
|
|
10632
10988
|
);
|
|
10633
10989
|
const deployResult = await deploySchedule({
|
|
10634
10990
|
name: params.scheduleName,
|
|
@@ -10644,12 +11000,12 @@ Deploying schedule for agent ${chalk41.cyan(params.agentName)}...`
|
|
|
10644
11000
|
return deployResult;
|
|
10645
11001
|
}
|
|
10646
11002
|
function handleSetupError(error) {
|
|
10647
|
-
console.error(
|
|
11003
|
+
console.error(chalk46.red("\u2717 Failed to setup schedule"));
|
|
10648
11004
|
if (error instanceof Error) {
|
|
10649
11005
|
if (error.message.includes("Not authenticated")) {
|
|
10650
|
-
console.error(
|
|
11006
|
+
console.error(chalk46.dim(" Run: vm0 auth login"));
|
|
10651
11007
|
} else {
|
|
10652
|
-
console.error(
|
|
11008
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
10653
11009
|
}
|
|
10654
11010
|
}
|
|
10655
11011
|
process.exit(1);
|
|
@@ -10657,56 +11013,56 @@ function handleSetupError(error) {
|
|
|
10657
11013
|
function displayDeployResult(agentName, deployResult) {
|
|
10658
11014
|
if (deployResult.created) {
|
|
10659
11015
|
console.log(
|
|
10660
|
-
|
|
11016
|
+
chalk46.green(`\u2713 Created schedule for agent ${chalk46.cyan(agentName)}`)
|
|
10661
11017
|
);
|
|
10662
11018
|
} else {
|
|
10663
11019
|
console.log(
|
|
10664
|
-
|
|
11020
|
+
chalk46.green(`\u2713 Updated schedule for agent ${chalk46.cyan(agentName)}`)
|
|
10665
11021
|
);
|
|
10666
11022
|
}
|
|
10667
|
-
console.log(
|
|
11023
|
+
console.log(chalk46.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
10668
11024
|
if (deployResult.schedule.cronExpression) {
|
|
10669
|
-
console.log(
|
|
11025
|
+
console.log(chalk46.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
10670
11026
|
if (deployResult.schedule.nextRunAt) {
|
|
10671
11027
|
const nextRun = formatInTimezone(
|
|
10672
11028
|
deployResult.schedule.nextRunAt,
|
|
10673
11029
|
deployResult.schedule.timezone
|
|
10674
11030
|
);
|
|
10675
|
-
console.log(
|
|
11031
|
+
console.log(chalk46.dim(` Next run: ${nextRun}`));
|
|
10676
11032
|
}
|
|
10677
11033
|
} else if (deployResult.schedule.atTime) {
|
|
10678
11034
|
const atTimeFormatted = formatInTimezone(
|
|
10679
11035
|
deployResult.schedule.atTime,
|
|
10680
11036
|
deployResult.schedule.timezone
|
|
10681
11037
|
);
|
|
10682
|
-
console.log(
|
|
11038
|
+
console.log(chalk46.dim(` At: ${atTimeFormatted}`));
|
|
10683
11039
|
}
|
|
10684
11040
|
}
|
|
10685
11041
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
10686
11042
|
try {
|
|
10687
11043
|
await enableSchedule({ name: scheduleName, composeId });
|
|
10688
11044
|
console.log(
|
|
10689
|
-
|
|
11045
|
+
chalk46.green(`\u2713 Enabled schedule for agent ${chalk46.cyan(agentName)}`)
|
|
10690
11046
|
);
|
|
10691
11047
|
} catch (error) {
|
|
10692
|
-
console.error(
|
|
11048
|
+
console.error(chalk46.yellow("\u26A0 Failed to enable schedule"));
|
|
10693
11049
|
if (error instanceof ApiRequestError) {
|
|
10694
11050
|
if (error.code === "SCHEDULE_PAST") {
|
|
10695
|
-
console.error(
|
|
11051
|
+
console.error(chalk46.dim(" Scheduled time has already passed"));
|
|
10696
11052
|
} else {
|
|
10697
|
-
console.error(
|
|
11053
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
10698
11054
|
}
|
|
10699
11055
|
} else if (error instanceof Error) {
|
|
10700
|
-
console.error(
|
|
11056
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
10701
11057
|
}
|
|
10702
11058
|
console.log(
|
|
10703
|
-
` To enable manually: ${
|
|
11059
|
+
` To enable manually: ${chalk46.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
10704
11060
|
);
|
|
10705
11061
|
}
|
|
10706
11062
|
}
|
|
10707
11063
|
function showEnableHint(agentName) {
|
|
10708
11064
|
console.log();
|
|
10709
|
-
console.log(` To enable: ${
|
|
11065
|
+
console.log(` To enable: ${chalk46.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
10710
11066
|
}
|
|
10711
11067
|
async function handleScheduleEnabling(params) {
|
|
10712
11068
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -10727,13 +11083,13 @@ async function handleScheduleEnabling(params) {
|
|
|
10727
11083
|
showEnableHint(agentName);
|
|
10728
11084
|
}
|
|
10729
11085
|
}
|
|
10730
|
-
var setupCommand = new
|
|
11086
|
+
var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--var <name=value>", "Variable (can be repeated)", collect, []).option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
|
|
10731
11087
|
try {
|
|
10732
11088
|
const { composeId, scheduleName, composeContent } = await resolveAgent(agentName);
|
|
10733
11089
|
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
10734
11090
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
10735
11091
|
console.log(
|
|
10736
|
-
|
|
11092
|
+
chalk46.dim(
|
|
10737
11093
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
10738
11094
|
)
|
|
10739
11095
|
);
|
|
@@ -10743,12 +11099,12 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10743
11099
|
defaults.frequency
|
|
10744
11100
|
);
|
|
10745
11101
|
if (!frequency) {
|
|
10746
|
-
console.log(
|
|
11102
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10747
11103
|
return;
|
|
10748
11104
|
}
|
|
10749
11105
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
10750
11106
|
if (!timing) {
|
|
10751
|
-
console.log(
|
|
11107
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10752
11108
|
return;
|
|
10753
11109
|
}
|
|
10754
11110
|
const { day, time, atTime } = timing;
|
|
@@ -10757,7 +11113,7 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10757
11113
|
existingSchedule?.timezone
|
|
10758
11114
|
);
|
|
10759
11115
|
if (!timezone) {
|
|
10760
|
-
console.log(
|
|
11116
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10761
11117
|
return;
|
|
10762
11118
|
}
|
|
10763
11119
|
const promptText_ = await gatherPromptText(
|
|
@@ -10765,7 +11121,7 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10765
11121
|
existingSchedule?.prompt
|
|
10766
11122
|
);
|
|
10767
11123
|
if (!promptText_) {
|
|
10768
|
-
console.log(
|
|
11124
|
+
console.log(chalk46.dim("Cancelled"));
|
|
10769
11125
|
return;
|
|
10770
11126
|
}
|
|
10771
11127
|
const config = await gatherConfiguration({
|
|
@@ -10805,15 +11161,15 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10805
11161
|
});
|
|
10806
11162
|
|
|
10807
11163
|
// src/commands/schedule/list.ts
|
|
10808
|
-
import { Command as
|
|
10809
|
-
import
|
|
10810
|
-
var listCommand5 = new
|
|
11164
|
+
import { Command as Command46 } from "commander";
|
|
11165
|
+
import chalk47 from "chalk";
|
|
11166
|
+
var listCommand5 = new Command46().name("list").alias("ls").description("List all schedules").action(async () => {
|
|
10811
11167
|
try {
|
|
10812
11168
|
const result = await listSchedules();
|
|
10813
11169
|
if (result.schedules.length === 0) {
|
|
10814
|
-
console.log(
|
|
11170
|
+
console.log(chalk47.dim("No schedules found"));
|
|
10815
11171
|
console.log(
|
|
10816
|
-
|
|
11172
|
+
chalk47.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
10817
11173
|
);
|
|
10818
11174
|
return;
|
|
10819
11175
|
}
|
|
@@ -10833,10 +11189,10 @@ var listCommand5 = new Command41().name("list").alias("ls").description("List al
|
|
|
10833
11189
|
"STATUS".padEnd(8),
|
|
10834
11190
|
"NEXT RUN"
|
|
10835
11191
|
].join(" ");
|
|
10836
|
-
console.log(
|
|
11192
|
+
console.log(chalk47.dim(header));
|
|
10837
11193
|
for (const schedule of result.schedules) {
|
|
10838
11194
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
10839
|
-
const status = schedule.enabled ?
|
|
11195
|
+
const status = schedule.enabled ? chalk47.green("enabled") : chalk47.yellow("disabled");
|
|
10840
11196
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
10841
11197
|
const row = [
|
|
10842
11198
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -10848,12 +11204,12 @@ var listCommand5 = new Command41().name("list").alias("ls").description("List al
|
|
|
10848
11204
|
console.log(row);
|
|
10849
11205
|
}
|
|
10850
11206
|
} catch (error) {
|
|
10851
|
-
console.error(
|
|
11207
|
+
console.error(chalk47.red("\u2717 Failed to list schedules"));
|
|
10852
11208
|
if (error instanceof Error) {
|
|
10853
11209
|
if (error.message.includes("Not authenticated")) {
|
|
10854
|
-
console.error(
|
|
11210
|
+
console.error(chalk47.dim(" Run: vm0 auth login"));
|
|
10855
11211
|
} else {
|
|
10856
|
-
console.error(
|
|
11212
|
+
console.error(chalk47.dim(` ${error.message}`));
|
|
10857
11213
|
}
|
|
10858
11214
|
}
|
|
10859
11215
|
process.exit(1);
|
|
@@ -10861,45 +11217,45 @@ var listCommand5 = new Command41().name("list").alias("ls").description("List al
|
|
|
10861
11217
|
});
|
|
10862
11218
|
|
|
10863
11219
|
// src/commands/schedule/status.ts
|
|
10864
|
-
import { Command as
|
|
10865
|
-
import
|
|
11220
|
+
import { Command as Command47 } from "commander";
|
|
11221
|
+
import chalk48 from "chalk";
|
|
10866
11222
|
function formatDateTimeStyled(dateStr) {
|
|
10867
|
-
if (!dateStr) return
|
|
11223
|
+
if (!dateStr) return chalk48.dim("-");
|
|
10868
11224
|
const formatted = formatDateTime(dateStr);
|
|
10869
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
11225
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk48.dim("($1)"));
|
|
10870
11226
|
}
|
|
10871
11227
|
function formatTrigger(schedule) {
|
|
10872
11228
|
if (schedule.cronExpression) {
|
|
10873
11229
|
return schedule.cronExpression;
|
|
10874
11230
|
}
|
|
10875
11231
|
if (schedule.atTime) {
|
|
10876
|
-
return `${schedule.atTime} ${
|
|
11232
|
+
return `${schedule.atTime} ${chalk48.dim("(one-time)")}`;
|
|
10877
11233
|
}
|
|
10878
|
-
return
|
|
11234
|
+
return chalk48.dim("-");
|
|
10879
11235
|
}
|
|
10880
11236
|
function formatRunStatus2(status) {
|
|
10881
11237
|
switch (status) {
|
|
10882
11238
|
case "completed":
|
|
10883
|
-
return
|
|
11239
|
+
return chalk48.green(status);
|
|
10884
11240
|
case "failed":
|
|
10885
11241
|
case "timeout":
|
|
10886
|
-
return
|
|
11242
|
+
return chalk48.red(status);
|
|
10887
11243
|
case "running":
|
|
10888
|
-
return
|
|
11244
|
+
return chalk48.blue(status);
|
|
10889
11245
|
case "pending":
|
|
10890
|
-
return
|
|
11246
|
+
return chalk48.yellow(status);
|
|
10891
11247
|
default:
|
|
10892
11248
|
return status;
|
|
10893
11249
|
}
|
|
10894
11250
|
}
|
|
10895
11251
|
function printRunConfiguration(schedule) {
|
|
10896
|
-
const statusText = schedule.enabled ?
|
|
11252
|
+
const statusText = schedule.enabled ? chalk48.green("enabled") : chalk48.yellow("disabled");
|
|
10897
11253
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
10898
11254
|
console.log(
|
|
10899
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
11255
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk48.dim(`(${schedule.scopeSlug})`)}`
|
|
10900
11256
|
);
|
|
10901
11257
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
10902
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
11258
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk48.dim(promptPreview)}`);
|
|
10903
11259
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
10904
11260
|
console.log(
|
|
10905
11261
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -10936,7 +11292,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
10936
11292
|
console.log();
|
|
10937
11293
|
console.log("Recent Runs:");
|
|
10938
11294
|
console.log(
|
|
10939
|
-
|
|
11295
|
+
chalk48.dim("RUN ID STATUS CREATED")
|
|
10940
11296
|
);
|
|
10941
11297
|
for (const run of runs) {
|
|
10942
11298
|
const id = run.id;
|
|
@@ -10947,24 +11303,24 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
10947
11303
|
}
|
|
10948
11304
|
} catch {
|
|
10949
11305
|
console.log();
|
|
10950
|
-
console.log(
|
|
11306
|
+
console.log(chalk48.dim("Recent Runs: (unable to fetch)"));
|
|
10951
11307
|
}
|
|
10952
11308
|
}
|
|
10953
11309
|
function handleStatusError(error, agentName) {
|
|
10954
|
-
console.error(
|
|
11310
|
+
console.error(chalk48.red("\u2717 Failed to get schedule status"));
|
|
10955
11311
|
if (error instanceof Error) {
|
|
10956
11312
|
if (error.message.includes("Not authenticated")) {
|
|
10957
|
-
console.error(
|
|
11313
|
+
console.error(chalk48.dim(" Run: vm0 auth login"));
|
|
10958
11314
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
10959
|
-
console.error(
|
|
10960
|
-
console.error(
|
|
11315
|
+
console.error(chalk48.dim(` No schedule found for agent "${agentName}"`));
|
|
11316
|
+
console.error(chalk48.dim(" Run: vm0 schedule list"));
|
|
10961
11317
|
} else {
|
|
10962
|
-
console.error(
|
|
11318
|
+
console.error(chalk48.dim(` ${error.message}`));
|
|
10963
11319
|
}
|
|
10964
11320
|
}
|
|
10965
11321
|
process.exit(1);
|
|
10966
11322
|
}
|
|
10967
|
-
var statusCommand6 = new
|
|
11323
|
+
var statusCommand6 = new Command47().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
10968
11324
|
"-l, --limit <number>",
|
|
10969
11325
|
"Number of recent runs to show (0 to hide)",
|
|
10970
11326
|
"5"
|
|
@@ -10974,8 +11330,8 @@ var statusCommand6 = new Command42().name("status").description("Show detailed s
|
|
|
10974
11330
|
const { name, composeId } = resolved;
|
|
10975
11331
|
const schedule = await getScheduleByName({ name, composeId });
|
|
10976
11332
|
console.log();
|
|
10977
|
-
console.log(`Schedule for agent: ${
|
|
10978
|
-
console.log(
|
|
11333
|
+
console.log(`Schedule for agent: ${chalk48.cyan(agentName)}`);
|
|
11334
|
+
console.log(chalk48.dim("\u2501".repeat(50)));
|
|
10979
11335
|
printRunConfiguration(schedule);
|
|
10980
11336
|
printTimeSchedule(schedule);
|
|
10981
11337
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -10991,24 +11347,24 @@ var statusCommand6 = new Command42().name("status").description("Show detailed s
|
|
|
10991
11347
|
});
|
|
10992
11348
|
|
|
10993
11349
|
// src/commands/schedule/delete.ts
|
|
10994
|
-
import { Command as
|
|
10995
|
-
import
|
|
10996
|
-
var deleteCommand = new
|
|
11350
|
+
import { Command as Command48 } from "commander";
|
|
11351
|
+
import chalk49 from "chalk";
|
|
11352
|
+
var deleteCommand = new Command48().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
10997
11353
|
try {
|
|
10998
11354
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
10999
11355
|
if (!options.force) {
|
|
11000
11356
|
if (!isInteractive()) {
|
|
11001
11357
|
console.error(
|
|
11002
|
-
|
|
11358
|
+
chalk49.red("\u2717 --force required in non-interactive mode")
|
|
11003
11359
|
);
|
|
11004
11360
|
process.exit(1);
|
|
11005
11361
|
}
|
|
11006
11362
|
const confirmed = await promptConfirm(
|
|
11007
|
-
`Delete schedule for agent ${
|
|
11363
|
+
`Delete schedule for agent ${chalk49.cyan(agentName)}?`,
|
|
11008
11364
|
false
|
|
11009
11365
|
);
|
|
11010
11366
|
if (!confirmed) {
|
|
11011
|
-
console.log(
|
|
11367
|
+
console.log(chalk49.dim("Cancelled"));
|
|
11012
11368
|
return;
|
|
11013
11369
|
}
|
|
11014
11370
|
}
|
|
@@ -11017,20 +11373,20 @@ var deleteCommand = new Command43().name("delete").alias("rm").description("Dele
|
|
|
11017
11373
|
composeId: resolved.composeId
|
|
11018
11374
|
});
|
|
11019
11375
|
console.log(
|
|
11020
|
-
|
|
11376
|
+
chalk49.green(`\u2713 Deleted schedule for agent ${chalk49.cyan(agentName)}`)
|
|
11021
11377
|
);
|
|
11022
11378
|
} catch (error) {
|
|
11023
|
-
console.error(
|
|
11379
|
+
console.error(chalk49.red("\u2717 Failed to delete schedule"));
|
|
11024
11380
|
if (error instanceof Error) {
|
|
11025
11381
|
if (error.message.includes("Not authenticated")) {
|
|
11026
|
-
console.error(
|
|
11382
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
11027
11383
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
11028
11384
|
console.error(
|
|
11029
|
-
|
|
11385
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
11030
11386
|
);
|
|
11031
|
-
console.error(
|
|
11387
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
11032
11388
|
} else {
|
|
11033
|
-
console.error(
|
|
11389
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
11034
11390
|
}
|
|
11035
11391
|
}
|
|
11036
11392
|
process.exit(1);
|
|
@@ -11038,9 +11394,9 @@ var deleteCommand = new Command43().name("delete").alias("rm").description("Dele
|
|
|
11038
11394
|
});
|
|
11039
11395
|
|
|
11040
11396
|
// src/commands/schedule/enable.ts
|
|
11041
|
-
import { Command as
|
|
11042
|
-
import
|
|
11043
|
-
var enableCommand = new
|
|
11397
|
+
import { Command as Command49 } from "commander";
|
|
11398
|
+
import chalk50 from "chalk";
|
|
11399
|
+
var enableCommand = new Command49().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
11044
11400
|
try {
|
|
11045
11401
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
11046
11402
|
await enableSchedule({
|
|
@@ -11048,34 +11404,34 @@ var enableCommand = new Command44().name("enable").description("Enable a schedul
|
|
|
11048
11404
|
composeId: resolved.composeId
|
|
11049
11405
|
});
|
|
11050
11406
|
console.log(
|
|
11051
|
-
|
|
11407
|
+
chalk50.green(`\u2713 Enabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11052
11408
|
);
|
|
11053
11409
|
} catch (error) {
|
|
11054
|
-
console.error(
|
|
11410
|
+
console.error(chalk50.red("\u2717 Failed to enable schedule"));
|
|
11055
11411
|
if (error instanceof ApiRequestError) {
|
|
11056
11412
|
if (error.code === "SCHEDULE_PAST") {
|
|
11057
|
-
console.error(
|
|
11058
|
-
console.error(
|
|
11413
|
+
console.error(chalk50.dim(" Scheduled time has already passed"));
|
|
11414
|
+
console.error(chalk50.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
11059
11415
|
} else if (error.code === "NOT_FOUND") {
|
|
11060
11416
|
console.error(
|
|
11061
|
-
|
|
11417
|
+
chalk50.dim(` No schedule found for agent "${agentName}"`)
|
|
11062
11418
|
);
|
|
11063
|
-
console.error(
|
|
11419
|
+
console.error(chalk50.dim(" Run: vm0 schedule list"));
|
|
11064
11420
|
} else if (error.code === "UNAUTHORIZED") {
|
|
11065
|
-
console.error(
|
|
11421
|
+
console.error(chalk50.dim(" Run: vm0 auth login"));
|
|
11066
11422
|
} else {
|
|
11067
|
-
console.error(
|
|
11423
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11068
11424
|
}
|
|
11069
11425
|
} else if (error instanceof Error) {
|
|
11070
11426
|
if (error.message.includes("Not authenticated")) {
|
|
11071
|
-
console.error(
|
|
11427
|
+
console.error(chalk50.dim(" Run: vm0 auth login"));
|
|
11072
11428
|
} else if (error.message.includes("No schedule found")) {
|
|
11073
11429
|
console.error(
|
|
11074
|
-
|
|
11430
|
+
chalk50.dim(` No schedule found for agent "${agentName}"`)
|
|
11075
11431
|
);
|
|
11076
|
-
console.error(
|
|
11432
|
+
console.error(chalk50.dim(" Run: vm0 schedule list"));
|
|
11077
11433
|
} else {
|
|
11078
|
-
console.error(
|
|
11434
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11079
11435
|
}
|
|
11080
11436
|
}
|
|
11081
11437
|
process.exit(1);
|
|
@@ -11083,9 +11439,9 @@ var enableCommand = new Command44().name("enable").description("Enable a schedul
|
|
|
11083
11439
|
});
|
|
11084
11440
|
|
|
11085
11441
|
// src/commands/schedule/disable.ts
|
|
11086
|
-
import { Command as
|
|
11087
|
-
import
|
|
11088
|
-
var disableCommand = new
|
|
11442
|
+
import { Command as Command50 } from "commander";
|
|
11443
|
+
import chalk51 from "chalk";
|
|
11444
|
+
var disableCommand = new Command50().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
11089
11445
|
try {
|
|
11090
11446
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
11091
11447
|
await disableSchedule({
|
|
@@ -11093,20 +11449,20 @@ var disableCommand = new Command45().name("disable").description("Disable a sche
|
|
|
11093
11449
|
composeId: resolved.composeId
|
|
11094
11450
|
});
|
|
11095
11451
|
console.log(
|
|
11096
|
-
|
|
11452
|
+
chalk51.green(`\u2713 Disabled schedule for agent ${chalk51.cyan(agentName)}`)
|
|
11097
11453
|
);
|
|
11098
11454
|
} catch (error) {
|
|
11099
|
-
console.error(
|
|
11455
|
+
console.error(chalk51.red("\u2717 Failed to disable schedule"));
|
|
11100
11456
|
if (error instanceof Error) {
|
|
11101
11457
|
if (error.message.includes("Not authenticated")) {
|
|
11102
|
-
console.error(
|
|
11458
|
+
console.error(chalk51.dim(" Run: vm0 auth login"));
|
|
11103
11459
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
11104
11460
|
console.error(
|
|
11105
|
-
|
|
11461
|
+
chalk51.dim(` No schedule found for agent "${agentName}"`)
|
|
11106
11462
|
);
|
|
11107
|
-
console.error(
|
|
11463
|
+
console.error(chalk51.dim(" Run: vm0 schedule list"));
|
|
11108
11464
|
} else {
|
|
11109
|
-
console.error(
|
|
11465
|
+
console.error(chalk51.dim(` ${error.message}`));
|
|
11110
11466
|
}
|
|
11111
11467
|
}
|
|
11112
11468
|
process.exit(1);
|
|
@@ -11114,11 +11470,11 @@ var disableCommand = new Command45().name("disable").description("Disable a sche
|
|
|
11114
11470
|
});
|
|
11115
11471
|
|
|
11116
11472
|
// src/commands/schedule/index.ts
|
|
11117
|
-
var scheduleCommand = new
|
|
11473
|
+
var scheduleCommand = new Command51().name("schedule").description("Manage agent schedules").addCommand(setupCommand).addCommand(listCommand5).addCommand(statusCommand6).addCommand(deleteCommand).addCommand(enableCommand).addCommand(disableCommand);
|
|
11118
11474
|
|
|
11119
11475
|
// src/commands/usage/index.ts
|
|
11120
|
-
import { Command as
|
|
11121
|
-
import
|
|
11476
|
+
import { Command as Command52 } from "commander";
|
|
11477
|
+
import chalk52 from "chalk";
|
|
11122
11478
|
|
|
11123
11479
|
// src/lib/utils/duration-formatter.ts
|
|
11124
11480
|
function formatDuration(ms) {
|
|
@@ -11191,7 +11547,7 @@ function fillMissingDates(daily, startDate, endDate) {
|
|
|
11191
11547
|
result.sort((a, b) => b.date.localeCompare(a.date));
|
|
11192
11548
|
return result;
|
|
11193
11549
|
}
|
|
11194
|
-
var usageCommand = new
|
|
11550
|
+
var usageCommand = new Command52().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
|
|
11195
11551
|
"--until <date>",
|
|
11196
11552
|
"End date (ISO format or relative, defaults to now)"
|
|
11197
11553
|
).action(async (options) => {
|
|
@@ -11205,7 +11561,7 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11205
11561
|
endDate = new Date(untilMs);
|
|
11206
11562
|
} catch {
|
|
11207
11563
|
console.error(
|
|
11208
|
-
|
|
11564
|
+
chalk52.red(
|
|
11209
11565
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
11210
11566
|
)
|
|
11211
11567
|
);
|
|
@@ -11220,7 +11576,7 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11220
11576
|
startDate = new Date(sinceMs);
|
|
11221
11577
|
} catch {
|
|
11222
11578
|
console.error(
|
|
11223
|
-
|
|
11579
|
+
chalk52.red(
|
|
11224
11580
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
11225
11581
|
)
|
|
11226
11582
|
);
|
|
@@ -11230,13 +11586,13 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11230
11586
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
11231
11587
|
}
|
|
11232
11588
|
if (startDate >= endDate) {
|
|
11233
|
-
console.error(
|
|
11589
|
+
console.error(chalk52.red("\u2717 --since must be before --until"));
|
|
11234
11590
|
process.exit(1);
|
|
11235
11591
|
}
|
|
11236
11592
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
11237
11593
|
if (rangeMs > MAX_RANGE_MS) {
|
|
11238
11594
|
console.error(
|
|
11239
|
-
|
|
11595
|
+
chalk52.red(
|
|
11240
11596
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
11241
11597
|
)
|
|
11242
11598
|
);
|
|
@@ -11253,19 +11609,19 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11253
11609
|
);
|
|
11254
11610
|
console.log();
|
|
11255
11611
|
console.log(
|
|
11256
|
-
|
|
11612
|
+
chalk52.bold(
|
|
11257
11613
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
11258
11614
|
)
|
|
11259
11615
|
);
|
|
11260
11616
|
console.log();
|
|
11261
|
-
console.log(
|
|
11617
|
+
console.log(chalk52.dim("DATE RUNS RUN TIME"));
|
|
11262
11618
|
for (const day of filledDaily) {
|
|
11263
11619
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
11264
11620
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
11265
11621
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
11266
11622
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
11267
11623
|
}
|
|
11268
|
-
console.log(
|
|
11624
|
+
console.log(chalk52.dim("\u2500".repeat(29)));
|
|
11269
11625
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
11270
11626
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
11271
11627
|
console.log(
|
|
@@ -11275,66 +11631,66 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11275
11631
|
} catch (error) {
|
|
11276
11632
|
if (error instanceof Error) {
|
|
11277
11633
|
if (error.message.includes("Not authenticated")) {
|
|
11278
|
-
console.error(
|
|
11279
|
-
console.error(
|
|
11634
|
+
console.error(chalk52.red("\u2717 Not authenticated"));
|
|
11635
|
+
console.error(chalk52.dim(" Run: vm0 auth login"));
|
|
11280
11636
|
} else {
|
|
11281
|
-
console.error(
|
|
11637
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
11282
11638
|
}
|
|
11283
11639
|
} else {
|
|
11284
|
-
console.error(
|
|
11640
|
+
console.error(chalk52.red("\u2717 An unexpected error occurred"));
|
|
11285
11641
|
}
|
|
11286
11642
|
process.exit(1);
|
|
11287
11643
|
}
|
|
11288
11644
|
});
|
|
11289
11645
|
|
|
11290
11646
|
// src/commands/secret/index.ts
|
|
11291
|
-
import { Command as
|
|
11647
|
+
import { Command as Command56 } from "commander";
|
|
11292
11648
|
|
|
11293
11649
|
// src/commands/secret/list.ts
|
|
11294
|
-
import { Command as
|
|
11295
|
-
import
|
|
11296
|
-
var listCommand6 = new
|
|
11650
|
+
import { Command as Command53 } from "commander";
|
|
11651
|
+
import chalk53 from "chalk";
|
|
11652
|
+
var listCommand6 = new Command53().name("list").alias("ls").description("List all secrets").action(async () => {
|
|
11297
11653
|
try {
|
|
11298
11654
|
const result = await listSecrets();
|
|
11299
11655
|
if (result.secrets.length === 0) {
|
|
11300
|
-
console.log(
|
|
11656
|
+
console.log(chalk53.dim("No secrets found"));
|
|
11301
11657
|
console.log();
|
|
11302
11658
|
console.log("To add a secret:");
|
|
11303
|
-
console.log(
|
|
11659
|
+
console.log(chalk53.cyan(" vm0 secret set MY_API_KEY <value>"));
|
|
11304
11660
|
return;
|
|
11305
11661
|
}
|
|
11306
|
-
console.log(
|
|
11662
|
+
console.log(chalk53.bold("Secrets:"));
|
|
11307
11663
|
console.log();
|
|
11308
11664
|
for (const secret of result.secrets) {
|
|
11309
|
-
const typeIndicator = secret.type === "model-provider" ?
|
|
11310
|
-
console.log(` ${
|
|
11665
|
+
const typeIndicator = secret.type === "model-provider" ? chalk53.dim(" [model-provider]") : "";
|
|
11666
|
+
console.log(` ${chalk53.cyan(secret.name)}${typeIndicator}`);
|
|
11311
11667
|
if (secret.description) {
|
|
11312
|
-
console.log(` ${
|
|
11668
|
+
console.log(` ${chalk53.dim(secret.description)}`);
|
|
11313
11669
|
}
|
|
11314
11670
|
console.log(
|
|
11315
|
-
` ${
|
|
11671
|
+
` ${chalk53.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
11316
11672
|
);
|
|
11317
11673
|
console.log();
|
|
11318
11674
|
}
|
|
11319
|
-
console.log(
|
|
11675
|
+
console.log(chalk53.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
11320
11676
|
} catch (error) {
|
|
11321
11677
|
if (error instanceof Error) {
|
|
11322
11678
|
if (error.message.includes("Not authenticated")) {
|
|
11323
|
-
console.error(
|
|
11679
|
+
console.error(chalk53.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11324
11680
|
} else {
|
|
11325
|
-
console.error(
|
|
11681
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
11326
11682
|
}
|
|
11327
11683
|
} else {
|
|
11328
|
-
console.error(
|
|
11684
|
+
console.error(chalk53.red("\u2717 An unexpected error occurred"));
|
|
11329
11685
|
}
|
|
11330
11686
|
process.exit(1);
|
|
11331
11687
|
}
|
|
11332
11688
|
});
|
|
11333
11689
|
|
|
11334
11690
|
// src/commands/secret/set.ts
|
|
11335
|
-
import { Command as
|
|
11336
|
-
import
|
|
11337
|
-
var setCommand2 = new
|
|
11691
|
+
import { Command as Command54 } from "commander";
|
|
11692
|
+
import chalk54 from "chalk";
|
|
11693
|
+
var setCommand2 = new Command54().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").argument("<value>", "Secret value").option("-d, --description <description>", "Optional description").action(
|
|
11338
11694
|
async (name, value, options) => {
|
|
11339
11695
|
try {
|
|
11340
11696
|
const secret = await setSecret({
|
|
@@ -11342,29 +11698,29 @@ var setCommand2 = new Command49().name("set").description("Create or update a se
|
|
|
11342
11698
|
value,
|
|
11343
11699
|
description: options.description
|
|
11344
11700
|
});
|
|
11345
|
-
console.log(
|
|
11701
|
+
console.log(chalk54.green(`\u2713 Secret "${secret.name}" saved`));
|
|
11346
11702
|
console.log();
|
|
11347
11703
|
console.log("Use in vm0.yaml:");
|
|
11348
|
-
console.log(
|
|
11349
|
-
console.log(
|
|
11704
|
+
console.log(chalk54.cyan(` environment:`));
|
|
11705
|
+
console.log(chalk54.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
11350
11706
|
} catch (error) {
|
|
11351
11707
|
if (error instanceof Error) {
|
|
11352
11708
|
if (error.message.includes("Not authenticated")) {
|
|
11353
11709
|
console.error(
|
|
11354
|
-
|
|
11710
|
+
chalk54.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
11355
11711
|
);
|
|
11356
11712
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
11357
|
-
console.error(
|
|
11713
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
11358
11714
|
console.log();
|
|
11359
11715
|
console.log("Examples of valid secret names:");
|
|
11360
|
-
console.log(
|
|
11361
|
-
console.log(
|
|
11362
|
-
console.log(
|
|
11716
|
+
console.log(chalk54.dim(" MY_API_KEY"));
|
|
11717
|
+
console.log(chalk54.dim(" GITHUB_TOKEN"));
|
|
11718
|
+
console.log(chalk54.dim(" AWS_ACCESS_KEY_ID"));
|
|
11363
11719
|
} else {
|
|
11364
|
-
console.error(
|
|
11720
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
11365
11721
|
}
|
|
11366
11722
|
} else {
|
|
11367
|
-
console.error(
|
|
11723
|
+
console.error(chalk54.red("\u2717 An unexpected error occurred"));
|
|
11368
11724
|
}
|
|
11369
11725
|
process.exit(1);
|
|
11370
11726
|
}
|
|
@@ -11372,20 +11728,20 @@ var setCommand2 = new Command49().name("set").description("Create or update a se
|
|
|
11372
11728
|
);
|
|
11373
11729
|
|
|
11374
11730
|
// src/commands/secret/delete.ts
|
|
11375
|
-
import { Command as
|
|
11376
|
-
import
|
|
11377
|
-
var deleteCommand2 = new
|
|
11731
|
+
import { Command as Command55 } from "commander";
|
|
11732
|
+
import chalk55 from "chalk";
|
|
11733
|
+
var deleteCommand2 = new Command55().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
11378
11734
|
try {
|
|
11379
11735
|
try {
|
|
11380
11736
|
await getSecret(name);
|
|
11381
11737
|
} catch {
|
|
11382
|
-
console.error(
|
|
11738
|
+
console.error(chalk55.red(`\u2717 Secret "${name}" not found`));
|
|
11383
11739
|
process.exit(1);
|
|
11384
11740
|
}
|
|
11385
11741
|
if (!options.yes) {
|
|
11386
11742
|
if (!isInteractive()) {
|
|
11387
11743
|
console.error(
|
|
11388
|
-
|
|
11744
|
+
chalk55.red("\u2717 --yes flag is required in non-interactive mode")
|
|
11389
11745
|
);
|
|
11390
11746
|
process.exit(1);
|
|
11391
11747
|
}
|
|
@@ -11394,43 +11750,182 @@ var deleteCommand2 = new Command50().name("delete").description("Delete a secret
|
|
|
11394
11750
|
false
|
|
11395
11751
|
);
|
|
11396
11752
|
if (!confirmed) {
|
|
11397
|
-
console.log(
|
|
11753
|
+
console.log(chalk55.dim("Cancelled"));
|
|
11398
11754
|
return;
|
|
11399
11755
|
}
|
|
11400
11756
|
}
|
|
11401
11757
|
await deleteSecret(name);
|
|
11402
|
-
console.log(
|
|
11758
|
+
console.log(chalk55.green(`\u2713 Secret "${name}" deleted`));
|
|
11403
11759
|
} catch (error) {
|
|
11404
11760
|
if (error instanceof Error) {
|
|
11405
11761
|
if (error.message.includes("Not authenticated")) {
|
|
11406
|
-
console.error(
|
|
11762
|
+
console.error(chalk55.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11407
11763
|
} else {
|
|
11408
|
-
console.error(
|
|
11764
|
+
console.error(chalk55.red(`\u2717 ${error.message}`));
|
|
11409
11765
|
}
|
|
11410
11766
|
} else {
|
|
11411
|
-
console.error(
|
|
11767
|
+
console.error(chalk55.red("\u2717 An unexpected error occurred"));
|
|
11412
11768
|
}
|
|
11413
11769
|
process.exit(1);
|
|
11414
11770
|
}
|
|
11415
11771
|
});
|
|
11416
11772
|
|
|
11417
11773
|
// src/commands/secret/index.ts
|
|
11418
|
-
var secretCommand = new
|
|
11774
|
+
var secretCommand = new Command56().name("secret").description("Manage stored secrets for agent runs").addCommand(listCommand6).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
11775
|
+
|
|
11776
|
+
// src/commands/variable/index.ts
|
|
11777
|
+
import { Command as Command60 } from "commander";
|
|
11778
|
+
|
|
11779
|
+
// src/commands/variable/list.ts
|
|
11780
|
+
import { Command as Command57 } from "commander";
|
|
11781
|
+
import chalk56 from "chalk";
|
|
11782
|
+
function truncateValue(value, maxLength = 60) {
|
|
11783
|
+
if (value.length <= maxLength) {
|
|
11784
|
+
return value;
|
|
11785
|
+
}
|
|
11786
|
+
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
11787
|
+
}
|
|
11788
|
+
var listCommand7 = new Command57().name("list").alias("ls").description("List all variables").action(async () => {
|
|
11789
|
+
try {
|
|
11790
|
+
const result = await listVariables();
|
|
11791
|
+
if (result.variables.length === 0) {
|
|
11792
|
+
console.log(chalk56.dim("No variables found"));
|
|
11793
|
+
console.log();
|
|
11794
|
+
console.log("To add a variable:");
|
|
11795
|
+
console.log(chalk56.cyan(" vm0 variable set MY_VAR <value>"));
|
|
11796
|
+
return;
|
|
11797
|
+
}
|
|
11798
|
+
console.log(chalk56.bold("Variables:"));
|
|
11799
|
+
console.log();
|
|
11800
|
+
for (const variable of result.variables) {
|
|
11801
|
+
const displayValue = truncateValue(variable.value);
|
|
11802
|
+
console.log(` ${chalk56.cyan(variable.name)} = ${displayValue}`);
|
|
11803
|
+
if (variable.description) {
|
|
11804
|
+
console.log(` ${chalk56.dim(variable.description)}`);
|
|
11805
|
+
}
|
|
11806
|
+
console.log(
|
|
11807
|
+
` ${chalk56.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
11808
|
+
);
|
|
11809
|
+
console.log();
|
|
11810
|
+
}
|
|
11811
|
+
console.log(chalk56.dim(`Total: ${result.variables.length} variable(s)`));
|
|
11812
|
+
} catch (error) {
|
|
11813
|
+
if (error instanceof Error) {
|
|
11814
|
+
if (error.message.includes("Not authenticated")) {
|
|
11815
|
+
console.error(chalk56.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11816
|
+
} else {
|
|
11817
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
11818
|
+
}
|
|
11819
|
+
} else {
|
|
11820
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
11821
|
+
}
|
|
11822
|
+
process.exit(1);
|
|
11823
|
+
}
|
|
11824
|
+
});
|
|
11825
|
+
|
|
11826
|
+
// src/commands/variable/set.ts
|
|
11827
|
+
import { Command as Command58 } from "commander";
|
|
11828
|
+
import chalk57 from "chalk";
|
|
11829
|
+
var setCommand3 = new Command58().name("set").description("Create or update a variable").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
11830
|
+
async (name, value, options) => {
|
|
11831
|
+
try {
|
|
11832
|
+
const variable = await setVariable({
|
|
11833
|
+
name,
|
|
11834
|
+
value,
|
|
11835
|
+
description: options.description
|
|
11836
|
+
});
|
|
11837
|
+
console.log(chalk57.green(`\u2713 Variable "${variable.name}" saved`));
|
|
11838
|
+
console.log();
|
|
11839
|
+
console.log("Use in vm0.yaml:");
|
|
11840
|
+
console.log(chalk57.cyan(` environment:`));
|
|
11841
|
+
console.log(chalk57.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
11842
|
+
} catch (error) {
|
|
11843
|
+
if (error instanceof Error) {
|
|
11844
|
+
if (error.message.includes("Not authenticated")) {
|
|
11845
|
+
console.error(
|
|
11846
|
+
chalk57.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
11847
|
+
);
|
|
11848
|
+
} else if (error.message.includes("must contain only uppercase")) {
|
|
11849
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
11850
|
+
console.log();
|
|
11851
|
+
console.log("Examples of valid variable names:");
|
|
11852
|
+
console.log(chalk57.dim(" MY_VAR"));
|
|
11853
|
+
console.log(chalk57.dim(" API_URL"));
|
|
11854
|
+
console.log(chalk57.dim(" DEBUG_MODE"));
|
|
11855
|
+
} else {
|
|
11856
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
11857
|
+
}
|
|
11858
|
+
} else {
|
|
11859
|
+
console.error(chalk57.red("\u2717 An unexpected error occurred"));
|
|
11860
|
+
}
|
|
11861
|
+
process.exit(1);
|
|
11862
|
+
}
|
|
11863
|
+
}
|
|
11864
|
+
);
|
|
11865
|
+
|
|
11866
|
+
// src/commands/variable/delete.ts
|
|
11867
|
+
import { Command as Command59 } from "commander";
|
|
11868
|
+
import chalk58 from "chalk";
|
|
11869
|
+
var deleteCommand3 = new Command59().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
11870
|
+
try {
|
|
11871
|
+
try {
|
|
11872
|
+
await getVariable(name);
|
|
11873
|
+
} catch (error) {
|
|
11874
|
+
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
11875
|
+
console.error(chalk58.red(`\u2717 Variable "${name}" not found`));
|
|
11876
|
+
process.exit(1);
|
|
11877
|
+
}
|
|
11878
|
+
throw error;
|
|
11879
|
+
}
|
|
11880
|
+
if (!options.yes) {
|
|
11881
|
+
if (!isInteractive()) {
|
|
11882
|
+
console.error(
|
|
11883
|
+
chalk58.red("\u2717 --yes flag is required in non-interactive mode")
|
|
11884
|
+
);
|
|
11885
|
+
process.exit(1);
|
|
11886
|
+
}
|
|
11887
|
+
const confirmed = await promptConfirm(
|
|
11888
|
+
`Are you sure you want to delete variable "${name}"?`,
|
|
11889
|
+
false
|
|
11890
|
+
);
|
|
11891
|
+
if (!confirmed) {
|
|
11892
|
+
console.log(chalk58.dim("Cancelled"));
|
|
11893
|
+
return;
|
|
11894
|
+
}
|
|
11895
|
+
}
|
|
11896
|
+
await deleteVariable(name);
|
|
11897
|
+
console.log(chalk58.green(`\u2713 Variable "${name}" deleted`));
|
|
11898
|
+
} catch (error) {
|
|
11899
|
+
if (error instanceof Error) {
|
|
11900
|
+
if (error.message.includes("Not authenticated")) {
|
|
11901
|
+
console.error(chalk58.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11902
|
+
} else {
|
|
11903
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
11904
|
+
}
|
|
11905
|
+
} else {
|
|
11906
|
+
console.error(chalk58.red("\u2717 An unexpected error occurred"));
|
|
11907
|
+
}
|
|
11908
|
+
process.exit(1);
|
|
11909
|
+
}
|
|
11910
|
+
});
|
|
11911
|
+
|
|
11912
|
+
// src/commands/variable/index.ts
|
|
11913
|
+
var variableCommand = new Command60().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand7).addCommand(setCommand3).addCommand(deleteCommand3);
|
|
11419
11914
|
|
|
11420
11915
|
// src/commands/model-provider/index.ts
|
|
11421
|
-
import { Command as
|
|
11916
|
+
import { Command as Command65 } from "commander";
|
|
11422
11917
|
|
|
11423
11918
|
// src/commands/model-provider/list.ts
|
|
11424
|
-
import { Command as
|
|
11425
|
-
import
|
|
11426
|
-
var
|
|
11919
|
+
import { Command as Command61 } from "commander";
|
|
11920
|
+
import chalk59 from "chalk";
|
|
11921
|
+
var listCommand8 = new Command61().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
11427
11922
|
try {
|
|
11428
11923
|
const result = await listModelProviders();
|
|
11429
11924
|
if (result.modelProviders.length === 0) {
|
|
11430
|
-
console.log(
|
|
11925
|
+
console.log(chalk59.dim("No model providers configured"));
|
|
11431
11926
|
console.log();
|
|
11432
11927
|
console.log("To add a model provider:");
|
|
11433
|
-
console.log(
|
|
11928
|
+
console.log(chalk59.cyan(" vm0 model-provider setup"));
|
|
11434
11929
|
return;
|
|
11435
11930
|
}
|
|
11436
11931
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -11444,16 +11939,16 @@ var listCommand7 = new Command52().name("list").alias("ls").description("List al
|
|
|
11444
11939
|
},
|
|
11445
11940
|
{}
|
|
11446
11941
|
);
|
|
11447
|
-
console.log(
|
|
11942
|
+
console.log(chalk59.bold("Model Providers:"));
|
|
11448
11943
|
console.log();
|
|
11449
11944
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
11450
|
-
console.log(` ${
|
|
11945
|
+
console.log(` ${chalk59.cyan(framework)}:`);
|
|
11451
11946
|
for (const provider of providers) {
|
|
11452
|
-
const defaultTag = provider.isDefault ?
|
|
11453
|
-
const modelTag = provider.selectedModel ?
|
|
11947
|
+
const defaultTag = provider.isDefault ? chalk59.green(" (default)") : "";
|
|
11948
|
+
const modelTag = provider.selectedModel ? chalk59.dim(` [${provider.selectedModel}]`) : "";
|
|
11454
11949
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
11455
11950
|
console.log(
|
|
11456
|
-
|
|
11951
|
+
chalk59.dim(
|
|
11457
11952
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
11458
11953
|
)
|
|
11459
11954
|
);
|
|
@@ -11461,33 +11956,33 @@ var listCommand7 = new Command52().name("list").alias("ls").description("List al
|
|
|
11461
11956
|
console.log();
|
|
11462
11957
|
}
|
|
11463
11958
|
console.log(
|
|
11464
|
-
|
|
11959
|
+
chalk59.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
11465
11960
|
);
|
|
11466
11961
|
} catch (error) {
|
|
11467
11962
|
if (error instanceof Error) {
|
|
11468
11963
|
if (error.message.includes("Not authenticated")) {
|
|
11469
|
-
console.error(
|
|
11964
|
+
console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11470
11965
|
} else {
|
|
11471
|
-
console.error(
|
|
11966
|
+
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
11472
11967
|
}
|
|
11473
11968
|
} else {
|
|
11474
|
-
console.error(
|
|
11969
|
+
console.error(chalk59.red("\u2717 An unexpected error occurred"));
|
|
11475
11970
|
}
|
|
11476
11971
|
process.exit(1);
|
|
11477
11972
|
}
|
|
11478
11973
|
});
|
|
11479
11974
|
|
|
11480
11975
|
// src/commands/model-provider/setup.ts
|
|
11481
|
-
import { Command as
|
|
11482
|
-
import
|
|
11976
|
+
import { Command as Command62 } from "commander";
|
|
11977
|
+
import chalk60 from "chalk";
|
|
11483
11978
|
import prompts2 from "prompts";
|
|
11484
11979
|
function validateProviderType(typeStr) {
|
|
11485
11980
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
11486
|
-
console.error(
|
|
11981
|
+
console.error(chalk60.red(`\u2717 Invalid type "${typeStr}"`));
|
|
11487
11982
|
console.log();
|
|
11488
11983
|
console.log("Valid types:");
|
|
11489
11984
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11490
|
-
console.log(` ${
|
|
11985
|
+
console.log(` ${chalk60.cyan(t)} - ${config.label}`);
|
|
11491
11986
|
}
|
|
11492
11987
|
process.exit(1);
|
|
11493
11988
|
}
|
|
@@ -11499,11 +11994,11 @@ function validateModel(type, modelStr) {
|
|
|
11499
11994
|
return modelStr;
|
|
11500
11995
|
}
|
|
11501
11996
|
if (models && !models.includes(modelStr)) {
|
|
11502
|
-
console.error(
|
|
11997
|
+
console.error(chalk60.red(`\u2717 Invalid model "${modelStr}"`));
|
|
11503
11998
|
console.log();
|
|
11504
11999
|
console.log("Valid models:");
|
|
11505
12000
|
for (const m of models) {
|
|
11506
|
-
console.log(` ${
|
|
12001
|
+
console.log(` ${chalk60.cyan(m)}`);
|
|
11507
12002
|
}
|
|
11508
12003
|
process.exit(1);
|
|
11509
12004
|
}
|
|
@@ -11512,12 +12007,12 @@ function validateModel(type, modelStr) {
|
|
|
11512
12007
|
function validateAuthMethod(type, authMethodStr) {
|
|
11513
12008
|
const authMethods = getAuthMethodsForType(type);
|
|
11514
12009
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
11515
|
-
console.error(
|
|
12010
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
11516
12011
|
console.log();
|
|
11517
12012
|
console.log("Valid auth methods:");
|
|
11518
12013
|
if (authMethods) {
|
|
11519
12014
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
11520
|
-
console.log(` ${
|
|
12015
|
+
console.log(` ${chalk60.cyan(method)} - ${config.label}`);
|
|
11521
12016
|
}
|
|
11522
12017
|
}
|
|
11523
12018
|
process.exit(1);
|
|
@@ -11527,7 +12022,7 @@ function validateAuthMethod(type, authMethodStr) {
|
|
|
11527
12022
|
function parseCredentials(type, authMethod, credentialArgs) {
|
|
11528
12023
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11529
12024
|
if (!credentialsConfig) {
|
|
11530
|
-
console.error(
|
|
12025
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11531
12026
|
process.exit(1);
|
|
11532
12027
|
}
|
|
11533
12028
|
const credentialNames = Object.keys(credentialsConfig);
|
|
@@ -11535,7 +12030,7 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11535
12030
|
if (credentialArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
11536
12031
|
if (credentialNames.length !== 1) {
|
|
11537
12032
|
console.error(
|
|
11538
|
-
|
|
12033
|
+
chalk60.red(
|
|
11539
12034
|
"\u2717 Must use KEY=VALUE format for multi-credential auth methods"
|
|
11540
12035
|
)
|
|
11541
12036
|
);
|
|
@@ -11543,13 +12038,13 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11543
12038
|
console.log("Required credentials:");
|
|
11544
12039
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11545
12040
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
11546
|
-
console.log(` ${
|
|
12041
|
+
console.log(` ${chalk60.cyan(name)}${requiredNote}`);
|
|
11547
12042
|
}
|
|
11548
12043
|
process.exit(1);
|
|
11549
12044
|
}
|
|
11550
12045
|
const firstCredentialName = credentialNames[0];
|
|
11551
12046
|
if (!firstCredentialName) {
|
|
11552
|
-
console.error(
|
|
12047
|
+
console.error(chalk60.red("\u2717 No credentials defined for this auth method"));
|
|
11553
12048
|
process.exit(1);
|
|
11554
12049
|
}
|
|
11555
12050
|
return { [firstCredentialName]: firstArg };
|
|
@@ -11558,7 +12053,7 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11558
12053
|
for (const arg of credentialArgs) {
|
|
11559
12054
|
const eqIndex = arg.indexOf("=");
|
|
11560
12055
|
if (eqIndex === -1) {
|
|
11561
|
-
console.error(
|
|
12056
|
+
console.error(chalk60.red(`\u2717 Invalid credential format "${arg}"`));
|
|
11562
12057
|
console.log();
|
|
11563
12058
|
console.log("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
11564
12059
|
process.exit(1);
|
|
@@ -11572,17 +12067,17 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11572
12067
|
function validateCredentials(type, authMethod, credentials) {
|
|
11573
12068
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11574
12069
|
if (!credentialsConfig) {
|
|
11575
|
-
console.error(
|
|
12070
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11576
12071
|
process.exit(1);
|
|
11577
12072
|
}
|
|
11578
12073
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11579
12074
|
if (fieldConfig.required && !credentials[name]) {
|
|
11580
|
-
console.error(
|
|
12075
|
+
console.error(chalk60.red(`\u2717 Missing required credential: ${name}`));
|
|
11581
12076
|
console.log();
|
|
11582
12077
|
console.log("Required credentials:");
|
|
11583
12078
|
for (const [n, fc] of Object.entries(credentialsConfig)) {
|
|
11584
12079
|
if (fc.required) {
|
|
11585
|
-
console.log(` ${
|
|
12080
|
+
console.log(` ${chalk60.cyan(n)} - ${fc.label}`);
|
|
11586
12081
|
}
|
|
11587
12082
|
}
|
|
11588
12083
|
process.exit(1);
|
|
@@ -11590,12 +12085,12 @@ function validateCredentials(type, authMethod, credentials) {
|
|
|
11590
12085
|
}
|
|
11591
12086
|
for (const name of Object.keys(credentials)) {
|
|
11592
12087
|
if (!(name in credentialsConfig)) {
|
|
11593
|
-
console.error(
|
|
12088
|
+
console.error(chalk60.red(`\u2717 Unknown credential: ${name}`));
|
|
11594
12089
|
console.log();
|
|
11595
12090
|
console.log("Valid credentials:");
|
|
11596
12091
|
for (const [n, fc] of Object.entries(credentialsConfig)) {
|
|
11597
12092
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
11598
|
-
console.log(` ${
|
|
12093
|
+
console.log(` ${chalk60.cyan(n)}${requiredNote}`);
|
|
11599
12094
|
}
|
|
11600
12095
|
process.exit(1);
|
|
11601
12096
|
}
|
|
@@ -11618,7 +12113,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11618
12113
|
const defaultAuthMethod = getDefaultAuthMethod(type);
|
|
11619
12114
|
const authMethods = getAuthMethodsForType(type);
|
|
11620
12115
|
if (!defaultAuthMethod || !authMethods) {
|
|
11621
|
-
console.error(
|
|
12116
|
+
console.error(chalk60.red(`\u2717 Provider "${type}" requires --auth-method`));
|
|
11622
12117
|
process.exit(1);
|
|
11623
12118
|
}
|
|
11624
12119
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -11626,7 +12121,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11626
12121
|
authMethod = authMethodNames[0];
|
|
11627
12122
|
} else {
|
|
11628
12123
|
console.error(
|
|
11629
|
-
|
|
12124
|
+
chalk60.red(
|
|
11630
12125
|
`\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
|
|
11631
12126
|
)
|
|
11632
12127
|
);
|
|
@@ -11635,13 +12130,13 @@ function handleNonInteractiveMode(options) {
|
|
|
11635
12130
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
11636
12131
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
11637
12132
|
console.log(
|
|
11638
|
-
` ${
|
|
12133
|
+
` ${chalk60.cyan(method)} - ${config.label}${defaultNote}`
|
|
11639
12134
|
);
|
|
11640
12135
|
}
|
|
11641
12136
|
console.log();
|
|
11642
12137
|
console.log("Example:");
|
|
11643
12138
|
console.log(
|
|
11644
|
-
|
|
12139
|
+
chalk60.cyan(
|
|
11645
12140
|
` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --credential KEY=VALUE`
|
|
11646
12141
|
)
|
|
11647
12142
|
);
|
|
@@ -11661,7 +12156,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11661
12156
|
const credentialArgs = options.credential;
|
|
11662
12157
|
const firstArg = credentialArgs[0];
|
|
11663
12158
|
if (!firstArg) {
|
|
11664
|
-
console.error(
|
|
12159
|
+
console.error(chalk60.red("\u2717 Credential is required"));
|
|
11665
12160
|
process.exit(1);
|
|
11666
12161
|
}
|
|
11667
12162
|
let credential;
|
|
@@ -11710,7 +12205,7 @@ async function promptForModelSelection(type) {
|
|
|
11710
12205
|
if (selected === "__custom__") {
|
|
11711
12206
|
const placeholder = getCustomModelPlaceholder(type);
|
|
11712
12207
|
if (placeholder) {
|
|
11713
|
-
console.log(
|
|
12208
|
+
console.log(chalk60.dim(`Example: ${placeholder}`));
|
|
11714
12209
|
}
|
|
11715
12210
|
const customResponse = await prompts2(
|
|
11716
12211
|
{
|
|
@@ -11755,13 +12250,13 @@ function isSecretCredential(name) {
|
|
|
11755
12250
|
async function promptForCredentials(type, authMethod) {
|
|
11756
12251
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11757
12252
|
if (!credentialsConfig) {
|
|
11758
|
-
console.error(
|
|
12253
|
+
console.error(chalk60.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11759
12254
|
process.exit(1);
|
|
11760
12255
|
}
|
|
11761
12256
|
const credentials = {};
|
|
11762
12257
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11763
12258
|
if (fieldConfig.helpText) {
|
|
11764
|
-
console.log(
|
|
12259
|
+
console.log(chalk60.dim(fieldConfig.helpText));
|
|
11765
12260
|
}
|
|
11766
12261
|
const isSecret = isSecretCredential(name);
|
|
11767
12262
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -11796,11 +12291,11 @@ async function promptForCredentials(type, authMethod) {
|
|
|
11796
12291
|
}
|
|
11797
12292
|
async function handleInteractiveMode() {
|
|
11798
12293
|
if (!isInteractive()) {
|
|
11799
|
-
console.error(
|
|
12294
|
+
console.error(chalk60.red("\u2717 Interactive mode requires a TTY"));
|
|
11800
12295
|
console.log();
|
|
11801
12296
|
console.log("Use non-interactive mode:");
|
|
11802
12297
|
console.log(
|
|
11803
|
-
|
|
12298
|
+
chalk60.cyan(
|
|
11804
12299
|
' vm0 model-provider setup --type <type> --credential "<value>"'
|
|
11805
12300
|
)
|
|
11806
12301
|
);
|
|
@@ -11817,7 +12312,7 @@ async function handleInteractiveMode() {
|
|
|
11817
12312
|
title = `${title} \u2713`;
|
|
11818
12313
|
}
|
|
11819
12314
|
if (isExperimental) {
|
|
11820
|
-
title = `${title} ${
|
|
12315
|
+
title = `${title} ${chalk60.dim("(experimental)")}`;
|
|
11821
12316
|
}
|
|
11822
12317
|
return {
|
|
11823
12318
|
title,
|
|
@@ -11850,14 +12345,14 @@ async function handleInteractiveMode() {
|
|
|
11850
12345
|
const provider = await convertModelProviderCredential(type);
|
|
11851
12346
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
11852
12347
|
console.log(
|
|
11853
|
-
|
|
12348
|
+
chalk60.green(
|
|
11854
12349
|
`\u2713 Converted "${checkResult.credentialName}" to model provider${defaultNote}`
|
|
11855
12350
|
)
|
|
11856
12351
|
);
|
|
11857
12352
|
await promptSetAsDefault(type, provider.framework, provider.isDefault);
|
|
11858
12353
|
return null;
|
|
11859
12354
|
}
|
|
11860
|
-
console.log(
|
|
12355
|
+
console.log(chalk60.dim("Aborted"));
|
|
11861
12356
|
process.exit(0);
|
|
11862
12357
|
}
|
|
11863
12358
|
if (checkResult.exists && checkResult.currentType === "model-provider") {
|
|
@@ -11888,7 +12383,7 @@ async function handleInteractiveMode() {
|
|
|
11888
12383
|
}
|
|
11889
12384
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
11890
12385
|
console.log();
|
|
11891
|
-
console.log(
|
|
12386
|
+
console.log(chalk60.dim(config.helpText));
|
|
11892
12387
|
console.log();
|
|
11893
12388
|
if (hasAuthMethods(type)) {
|
|
11894
12389
|
const authMethod = await promptForAuthMethod(type);
|
|
@@ -11919,17 +12414,17 @@ async function handleInteractiveMode() {
|
|
|
11919
12414
|
function handleSetupError2(error) {
|
|
11920
12415
|
if (error instanceof Error) {
|
|
11921
12416
|
if (error.message.includes("already exists")) {
|
|
11922
|
-
console.error(
|
|
12417
|
+
console.error(chalk60.red(`\u2717 ${error.message}`));
|
|
11923
12418
|
console.log();
|
|
11924
12419
|
console.log("To convert the existing credential, run:");
|
|
11925
|
-
console.log(
|
|
12420
|
+
console.log(chalk60.cyan(" vm0 model-provider setup --convert"));
|
|
11926
12421
|
} else if (error.message.includes("Not authenticated")) {
|
|
11927
|
-
console.error(
|
|
12422
|
+
console.error(chalk60.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11928
12423
|
} else {
|
|
11929
|
-
console.error(
|
|
12424
|
+
console.error(chalk60.red(`\u2717 ${error.message}`));
|
|
11930
12425
|
}
|
|
11931
12426
|
} else {
|
|
11932
|
-
console.error(
|
|
12427
|
+
console.error(chalk60.red("\u2717 An unexpected error occurred"));
|
|
11933
12428
|
}
|
|
11934
12429
|
process.exit(1);
|
|
11935
12430
|
}
|
|
@@ -11946,13 +12441,13 @@ async function promptSetAsDefault(type, framework, isDefault) {
|
|
|
11946
12441
|
);
|
|
11947
12442
|
if (response.setDefault) {
|
|
11948
12443
|
await setModelProviderDefault(type);
|
|
11949
|
-
console.log(
|
|
12444
|
+
console.log(chalk60.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
11950
12445
|
}
|
|
11951
12446
|
}
|
|
11952
12447
|
function collectCredentials(value, previous) {
|
|
11953
12448
|
return previous.concat([value]);
|
|
11954
12449
|
}
|
|
11955
|
-
var setupCommand2 = new
|
|
12450
|
+
var setupCommand2 = new Command62().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
11956
12451
|
"-c, --credential <value>",
|
|
11957
12452
|
"Credential value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
11958
12453
|
collectCredentials,
|
|
@@ -11975,7 +12470,7 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
11975
12470
|
});
|
|
11976
12471
|
} else if (options.type || credentialArgs.length > 0) {
|
|
11977
12472
|
console.error(
|
|
11978
|
-
|
|
12473
|
+
chalk60.red("\u2717 Both --type and --credential are required")
|
|
11979
12474
|
);
|
|
11980
12475
|
process.exit(1);
|
|
11981
12476
|
} else {
|
|
@@ -11994,11 +12489,11 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
11994
12489
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
11995
12490
|
if (!hasModelSelection(input.type)) {
|
|
11996
12491
|
console.log(
|
|
11997
|
-
|
|
12492
|
+
chalk60.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
11998
12493
|
);
|
|
11999
12494
|
} else {
|
|
12000
12495
|
console.log(
|
|
12001
|
-
|
|
12496
|
+
chalk60.green(
|
|
12002
12497
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
12003
12498
|
)
|
|
12004
12499
|
);
|
|
@@ -12024,7 +12519,7 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
12024
12519
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
12025
12520
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
12026
12521
|
console.log(
|
|
12027
|
-
|
|
12522
|
+
chalk60.green(
|
|
12028
12523
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
12029
12524
|
)
|
|
12030
12525
|
);
|
|
@@ -12042,96 +12537,96 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
12042
12537
|
);
|
|
12043
12538
|
|
|
12044
12539
|
// src/commands/model-provider/delete.ts
|
|
12045
|
-
import { Command as
|
|
12046
|
-
import
|
|
12047
|
-
var
|
|
12540
|
+
import { Command as Command63 } from "commander";
|
|
12541
|
+
import chalk61 from "chalk";
|
|
12542
|
+
var deleteCommand4 = new Command63().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
12048
12543
|
try {
|
|
12049
12544
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
12050
|
-
console.error(
|
|
12545
|
+
console.error(chalk61.red(`\u2717 Invalid type "${type}"`));
|
|
12051
12546
|
console.log();
|
|
12052
12547
|
console.log("Valid types:");
|
|
12053
12548
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12054
|
-
console.log(` ${
|
|
12549
|
+
console.log(` ${chalk61.cyan(t)} - ${config.label}`);
|
|
12055
12550
|
}
|
|
12056
12551
|
process.exit(1);
|
|
12057
12552
|
}
|
|
12058
12553
|
await deleteModelProvider(type);
|
|
12059
|
-
console.log(
|
|
12554
|
+
console.log(chalk61.green(`\u2713 Model provider "${type}" deleted`));
|
|
12060
12555
|
} catch (error) {
|
|
12061
12556
|
if (error instanceof Error) {
|
|
12062
12557
|
if (error.message.includes("not found")) {
|
|
12063
|
-
console.error(
|
|
12558
|
+
console.error(chalk61.red(`\u2717 Model provider "${type}" not found`));
|
|
12064
12559
|
} else if (error.message.includes("Not authenticated")) {
|
|
12065
|
-
console.error(
|
|
12560
|
+
console.error(chalk61.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12066
12561
|
} else {
|
|
12067
|
-
console.error(
|
|
12562
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
12068
12563
|
}
|
|
12069
12564
|
} else {
|
|
12070
|
-
console.error(
|
|
12565
|
+
console.error(chalk61.red("\u2717 An unexpected error occurred"));
|
|
12071
12566
|
}
|
|
12072
12567
|
process.exit(1);
|
|
12073
12568
|
}
|
|
12074
12569
|
});
|
|
12075
12570
|
|
|
12076
12571
|
// src/commands/model-provider/set-default.ts
|
|
12077
|
-
import { Command as
|
|
12078
|
-
import
|
|
12079
|
-
var setDefaultCommand = new
|
|
12572
|
+
import { Command as Command64 } from "commander";
|
|
12573
|
+
import chalk62 from "chalk";
|
|
12574
|
+
var setDefaultCommand = new Command64().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type) => {
|
|
12080
12575
|
try {
|
|
12081
12576
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
12082
|
-
console.error(
|
|
12577
|
+
console.error(chalk62.red(`\u2717 Invalid type "${type}"`));
|
|
12083
12578
|
console.log();
|
|
12084
12579
|
console.log("Valid types:");
|
|
12085
12580
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12086
|
-
console.log(` ${
|
|
12581
|
+
console.log(` ${chalk62.cyan(t)} - ${config.label}`);
|
|
12087
12582
|
}
|
|
12088
12583
|
process.exit(1);
|
|
12089
12584
|
}
|
|
12090
12585
|
const provider = await setModelProviderDefault(type);
|
|
12091
12586
|
console.log(
|
|
12092
|
-
|
|
12587
|
+
chalk62.green(
|
|
12093
12588
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
12094
12589
|
)
|
|
12095
12590
|
);
|
|
12096
12591
|
} catch (error) {
|
|
12097
12592
|
if (error instanceof Error) {
|
|
12098
12593
|
if (error.message.includes("not found")) {
|
|
12099
|
-
console.error(
|
|
12594
|
+
console.error(chalk62.red(`\u2717 Model provider "${type}" not found`));
|
|
12100
12595
|
} else if (error.message.includes("Not authenticated")) {
|
|
12101
|
-
console.error(
|
|
12596
|
+
console.error(chalk62.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12102
12597
|
} else {
|
|
12103
|
-
console.error(
|
|
12598
|
+
console.error(chalk62.red(`\u2717 ${error.message}`));
|
|
12104
12599
|
}
|
|
12105
12600
|
} else {
|
|
12106
|
-
console.error(
|
|
12601
|
+
console.error(chalk62.red("\u2717 An unexpected error occurred"));
|
|
12107
12602
|
}
|
|
12108
12603
|
process.exit(1);
|
|
12109
12604
|
}
|
|
12110
12605
|
});
|
|
12111
12606
|
|
|
12112
12607
|
// src/commands/model-provider/index.ts
|
|
12113
|
-
var modelProviderCommand = new
|
|
12608
|
+
var modelProviderCommand = new Command65().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand4).addCommand(setDefaultCommand);
|
|
12114
12609
|
|
|
12115
12610
|
// src/commands/onboard/index.ts
|
|
12116
|
-
import { Command as
|
|
12117
|
-
import
|
|
12611
|
+
import { Command as Command66 } from "commander";
|
|
12612
|
+
import chalk66 from "chalk";
|
|
12118
12613
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
12119
12614
|
import { existsSync as existsSync11 } from "fs";
|
|
12120
12615
|
|
|
12121
12616
|
// src/lib/ui/welcome-box.ts
|
|
12122
|
-
import
|
|
12617
|
+
import chalk63 from "chalk";
|
|
12123
12618
|
var gradientColors = [
|
|
12124
|
-
|
|
12619
|
+
chalk63.hex("#FFAB5E"),
|
|
12125
12620
|
// Line 1 - lightest
|
|
12126
|
-
|
|
12621
|
+
chalk63.hex("#FF9642"),
|
|
12127
12622
|
// Line 2
|
|
12128
|
-
|
|
12623
|
+
chalk63.hex("#FF8228"),
|
|
12129
12624
|
// Line 3
|
|
12130
|
-
|
|
12625
|
+
chalk63.hex("#FF6D0A"),
|
|
12131
12626
|
// Line 4
|
|
12132
|
-
|
|
12627
|
+
chalk63.hex("#E85D00"),
|
|
12133
12628
|
// Line 5
|
|
12134
|
-
|
|
12629
|
+
chalk63.hex("#CC4E00")
|
|
12135
12630
|
// Line 6 - darkest
|
|
12136
12631
|
];
|
|
12137
12632
|
var vm0LogoLines = [
|
|
@@ -12153,15 +12648,15 @@ function renderVm0Banner() {
|
|
|
12153
12648
|
function renderOnboardWelcome() {
|
|
12154
12649
|
renderVm0Banner();
|
|
12155
12650
|
console.log(` Build agentic workflows using natural language.`);
|
|
12156
|
-
console.log(` ${
|
|
12651
|
+
console.log(` ${chalk63.dim("Currently in beta, enjoy it free.")}`);
|
|
12157
12652
|
console.log(
|
|
12158
|
-
` ${
|
|
12653
|
+
` ${chalk63.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
12159
12654
|
);
|
|
12160
12655
|
console.log();
|
|
12161
12656
|
}
|
|
12162
12657
|
|
|
12163
12658
|
// src/lib/ui/step-runner.ts
|
|
12164
|
-
import
|
|
12659
|
+
import chalk64 from "chalk";
|
|
12165
12660
|
function createStepRunner(options = true) {
|
|
12166
12661
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
12167
12662
|
const interactive = opts.interactive ?? true;
|
|
@@ -12176,25 +12671,25 @@ function createStepRunner(options = true) {
|
|
|
12176
12671
|
}
|
|
12177
12672
|
for (const [i, step] of completedSteps.entries()) {
|
|
12178
12673
|
if (step.failed) {
|
|
12179
|
-
console.log(
|
|
12674
|
+
console.log(chalk64.red(`\u2717 ${step.label}`));
|
|
12180
12675
|
} else {
|
|
12181
|
-
console.log(
|
|
12676
|
+
console.log(chalk64.green(`\u25CF ${step.label}`));
|
|
12182
12677
|
}
|
|
12183
12678
|
const isLastStep = i === completedSteps.length - 1;
|
|
12184
12679
|
if (!isLastStep || !isFinal) {
|
|
12185
|
-
console.log(
|
|
12680
|
+
console.log(chalk64.dim("\u2502"));
|
|
12186
12681
|
}
|
|
12187
12682
|
}
|
|
12188
12683
|
}
|
|
12189
12684
|
async function executeStep(label, fn, isFinal) {
|
|
12190
12685
|
let stepFailed = false;
|
|
12191
|
-
console.log(
|
|
12686
|
+
console.log(chalk64.yellow(`\u25CB ${label}`));
|
|
12192
12687
|
const ctx = {
|
|
12193
12688
|
connector() {
|
|
12194
|
-
console.log(
|
|
12689
|
+
console.log(chalk64.dim("\u2502"));
|
|
12195
12690
|
},
|
|
12196
12691
|
detail(message) {
|
|
12197
|
-
console.log(`${
|
|
12692
|
+
console.log(`${chalk64.dim("\u2502")} ${message}`);
|
|
12198
12693
|
},
|
|
12199
12694
|
async prompt(promptFn) {
|
|
12200
12695
|
return await promptFn();
|
|
@@ -12211,12 +12706,12 @@ function createStepRunner(options = true) {
|
|
|
12211
12706
|
redrawCompletedSteps(isFinal);
|
|
12212
12707
|
} else {
|
|
12213
12708
|
if (stepFailed) {
|
|
12214
|
-
console.log(
|
|
12709
|
+
console.log(chalk64.red(`\u2717 ${label}`));
|
|
12215
12710
|
} else {
|
|
12216
|
-
console.log(
|
|
12711
|
+
console.log(chalk64.green(`\u25CF ${label}`));
|
|
12217
12712
|
}
|
|
12218
12713
|
if (!isFinal) {
|
|
12219
|
-
console.log(
|
|
12714
|
+
console.log(chalk64.dim("\u2502"));
|
|
12220
12715
|
}
|
|
12221
12716
|
}
|
|
12222
12717
|
}
|
|
@@ -12374,7 +12869,7 @@ async function setupModelProvider(type, credential, options) {
|
|
|
12374
12869
|
|
|
12375
12870
|
// src/lib/domain/onboard/claude-setup.ts
|
|
12376
12871
|
import { spawn as spawn3 } from "child_process";
|
|
12377
|
-
import
|
|
12872
|
+
import chalk65 from "chalk";
|
|
12378
12873
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
12379
12874
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
12380
12875
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -12411,12 +12906,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
12411
12906
|
}
|
|
12412
12907
|
function handlePluginError(error, context) {
|
|
12413
12908
|
const displayContext = context ?? "Claude plugin";
|
|
12414
|
-
console.error(
|
|
12909
|
+
console.error(chalk65.red(`Failed to install ${displayContext}`));
|
|
12415
12910
|
if (error instanceof Error) {
|
|
12416
|
-
console.error(
|
|
12911
|
+
console.error(chalk65.red(error.message));
|
|
12417
12912
|
}
|
|
12418
12913
|
console.error(
|
|
12419
|
-
|
|
12914
|
+
chalk65.dim("Please ensure Claude CLI is installed and accessible.")
|
|
12420
12915
|
);
|
|
12421
12916
|
process.exit(1);
|
|
12422
12917
|
}
|
|
@@ -12459,7 +12954,7 @@ async function updateMarketplace() {
|
|
|
12459
12954
|
]);
|
|
12460
12955
|
if (!result.success) {
|
|
12461
12956
|
console.warn(
|
|
12462
|
-
|
|
12957
|
+
chalk65.yellow(
|
|
12463
12958
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
12464
12959
|
)
|
|
12465
12960
|
);
|
|
@@ -12497,7 +12992,7 @@ async function handleAuthentication(ctx) {
|
|
|
12497
12992
|
return;
|
|
12498
12993
|
}
|
|
12499
12994
|
if (!ctx.interactive) {
|
|
12500
|
-
console.error(
|
|
12995
|
+
console.error(chalk66.red("Error: Not authenticated"));
|
|
12501
12996
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
12502
12997
|
process.exit(1);
|
|
12503
12998
|
}
|
|
@@ -12505,16 +13000,16 @@ async function handleAuthentication(ctx) {
|
|
|
12505
13000
|
onInitiating: () => {
|
|
12506
13001
|
},
|
|
12507
13002
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
12508
|
-
step.detail(`Copy code: ${
|
|
12509
|
-
step.detail(`Open: ${
|
|
12510
|
-
step.detail(
|
|
13003
|
+
step.detail(`Copy code: ${chalk66.cyan.bold(code)}`);
|
|
13004
|
+
step.detail(`Open: ${chalk66.cyan(url)}`);
|
|
13005
|
+
step.detail(chalk66.dim(`Expires in ${expiresIn} minutes`));
|
|
12511
13006
|
},
|
|
12512
13007
|
onPolling: () => {
|
|
12513
13008
|
},
|
|
12514
13009
|
onSuccess: () => {
|
|
12515
13010
|
},
|
|
12516
13011
|
onError: (error) => {
|
|
12517
|
-
console.error(
|
|
13012
|
+
console.error(chalk66.red(`
|
|
12518
13013
|
${error.message}`));
|
|
12519
13014
|
process.exit(1);
|
|
12520
13015
|
}
|
|
@@ -12528,7 +13023,7 @@ async function handleModelProvider(ctx) {
|
|
|
12528
13023
|
return;
|
|
12529
13024
|
}
|
|
12530
13025
|
if (!ctx.interactive) {
|
|
12531
|
-
console.error(
|
|
13026
|
+
console.error(chalk66.red("Error: No model provider configured"));
|
|
12532
13027
|
console.error("Run 'vm0 model-provider setup' first");
|
|
12533
13028
|
process.exit(1);
|
|
12534
13029
|
}
|
|
@@ -12537,19 +13032,19 @@ async function handleModelProvider(ctx) {
|
|
|
12537
13032
|
const providerType = await step.prompt(
|
|
12538
13033
|
() => promptSelect(
|
|
12539
13034
|
"Select provider type:",
|
|
12540
|
-
choices.map((
|
|
12541
|
-
title:
|
|
12542
|
-
value:
|
|
13035
|
+
choices.map((c23) => ({
|
|
13036
|
+
title: c23.label,
|
|
13037
|
+
value: c23.type
|
|
12543
13038
|
}))
|
|
12544
13039
|
)
|
|
12545
13040
|
);
|
|
12546
13041
|
if (!providerType) {
|
|
12547
13042
|
process.exit(0);
|
|
12548
13043
|
}
|
|
12549
|
-
const selectedChoice = choices.find((
|
|
13044
|
+
const selectedChoice = choices.find((c23) => c23.type === providerType);
|
|
12550
13045
|
if (selectedChoice?.helpText) {
|
|
12551
13046
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
12552
|
-
step.detail(
|
|
13047
|
+
step.detail(chalk66.dim(line));
|
|
12553
13048
|
}
|
|
12554
13049
|
}
|
|
12555
13050
|
const credential = await step.prompt(
|
|
@@ -12558,7 +13053,7 @@ async function handleModelProvider(ctx) {
|
|
|
12558
13053
|
)
|
|
12559
13054
|
);
|
|
12560
13055
|
if (!credential) {
|
|
12561
|
-
console.log(
|
|
13056
|
+
console.log(chalk66.dim("Cancelled"));
|
|
12562
13057
|
process.exit(0);
|
|
12563
13058
|
}
|
|
12564
13059
|
let selectedModel;
|
|
@@ -12577,7 +13072,7 @@ async function handleModelProvider(ctx) {
|
|
|
12577
13072
|
() => promptSelect("Select model:", modelChoices)
|
|
12578
13073
|
);
|
|
12579
13074
|
if (modelSelection === void 0) {
|
|
12580
|
-
console.log(
|
|
13075
|
+
console.log(chalk66.dim("Cancelled"));
|
|
12581
13076
|
process.exit(0);
|
|
12582
13077
|
}
|
|
12583
13078
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -12587,7 +13082,7 @@ async function handleModelProvider(ctx) {
|
|
|
12587
13082
|
});
|
|
12588
13083
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
12589
13084
|
step.detail(
|
|
12590
|
-
|
|
13085
|
+
chalk66.green(
|
|
12591
13086
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
12592
13087
|
)
|
|
12593
13088
|
);
|
|
@@ -12618,7 +13113,7 @@ async function handleAgentCreation(ctx) {
|
|
|
12618
13113
|
agentName = inputName;
|
|
12619
13114
|
if (existsSync11(agentName)) {
|
|
12620
13115
|
step.detail(
|
|
12621
|
-
|
|
13116
|
+
chalk66.yellow(`${agentName}/ already exists, choose another name`)
|
|
12622
13117
|
);
|
|
12623
13118
|
} else {
|
|
12624
13119
|
folderExists = false;
|
|
@@ -12627,22 +13122,22 @@ async function handleAgentCreation(ctx) {
|
|
|
12627
13122
|
} else {
|
|
12628
13123
|
if (!validateAgentName(agentName)) {
|
|
12629
13124
|
console.error(
|
|
12630
|
-
|
|
13125
|
+
chalk66.red(
|
|
12631
13126
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
12632
13127
|
)
|
|
12633
13128
|
);
|
|
12634
13129
|
process.exit(1);
|
|
12635
13130
|
}
|
|
12636
13131
|
if (existsSync11(agentName)) {
|
|
12637
|
-
console.error(
|
|
13132
|
+
console.error(chalk66.red(`${agentName}/ already exists`));
|
|
12638
13133
|
console.log();
|
|
12639
13134
|
console.log("Remove it first or choose a different name:");
|
|
12640
|
-
console.log(
|
|
13135
|
+
console.log(chalk66.cyan(` rm -rf ${agentName}`));
|
|
12641
13136
|
process.exit(1);
|
|
12642
13137
|
}
|
|
12643
13138
|
}
|
|
12644
13139
|
await mkdir8(agentName, { recursive: true });
|
|
12645
|
-
step.detail(
|
|
13140
|
+
step.detail(chalk66.green(`Created ${agentName}/`));
|
|
12646
13141
|
});
|
|
12647
13142
|
return agentName;
|
|
12648
13143
|
}
|
|
@@ -12658,7 +13153,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12658
13153
|
shouldInstall = confirmed ?? true;
|
|
12659
13154
|
}
|
|
12660
13155
|
if (!shouldInstall) {
|
|
12661
|
-
step.detail(
|
|
13156
|
+
step.detail(chalk66.dim("Skipped"));
|
|
12662
13157
|
return;
|
|
12663
13158
|
}
|
|
12664
13159
|
const scope = "project";
|
|
@@ -12666,7 +13161,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12666
13161
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
12667
13162
|
const result = await installVm0Plugin(scope, agentDir);
|
|
12668
13163
|
step.detail(
|
|
12669
|
-
|
|
13164
|
+
chalk66.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
12670
13165
|
);
|
|
12671
13166
|
pluginInstalled = true;
|
|
12672
13167
|
} catch (error) {
|
|
@@ -12677,18 +13172,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12677
13172
|
}
|
|
12678
13173
|
function printNextSteps(agentName, pluginInstalled) {
|
|
12679
13174
|
console.log();
|
|
12680
|
-
console.log(
|
|
13175
|
+
console.log(chalk66.bold("Next step:"));
|
|
12681
13176
|
console.log();
|
|
12682
13177
|
if (pluginInstalled) {
|
|
12683
13178
|
console.log(
|
|
12684
|
-
` ${
|
|
13179
|
+
` ${chalk66.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
12685
13180
|
);
|
|
12686
13181
|
} else {
|
|
12687
|
-
console.log(` ${
|
|
13182
|
+
console.log(` ${chalk66.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
12688
13183
|
}
|
|
12689
13184
|
console.log();
|
|
12690
13185
|
}
|
|
12691
|
-
var onboardCommand = new
|
|
13186
|
+
var onboardCommand = new Command66().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) => {
|
|
12692
13187
|
const interactive = isInteractive();
|
|
12693
13188
|
if (interactive) {
|
|
12694
13189
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -12711,15 +13206,15 @@ var onboardCommand = new Command57().name("onboard").description("Guided setup f
|
|
|
12711
13206
|
});
|
|
12712
13207
|
|
|
12713
13208
|
// src/commands/setup-claude/index.ts
|
|
12714
|
-
import { Command as
|
|
12715
|
-
import
|
|
12716
|
-
var setupClaudeCommand = new
|
|
12717
|
-
console.log(
|
|
13209
|
+
import { Command as Command67 } from "commander";
|
|
13210
|
+
import chalk67 from "chalk";
|
|
13211
|
+
var setupClaudeCommand = new Command67().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) => {
|
|
13212
|
+
console.log(chalk67.dim("Installing VM0 Claude Plugin..."));
|
|
12718
13213
|
const scope = options.scope === "user" ? "user" : "project";
|
|
12719
13214
|
try {
|
|
12720
13215
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
12721
13216
|
console.log(
|
|
12722
|
-
|
|
13217
|
+
chalk67.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
12723
13218
|
);
|
|
12724
13219
|
} catch (error) {
|
|
12725
13220
|
handlePluginError(error);
|
|
@@ -12728,15 +13223,15 @@ var setupClaudeCommand = new Command58().name("setup-claude").description("Insta
|
|
|
12728
13223
|
console.log("Next step:");
|
|
12729
13224
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
12730
13225
|
console.log(
|
|
12731
|
-
|
|
13226
|
+
chalk67.cyan(
|
|
12732
13227
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
12733
13228
|
)
|
|
12734
13229
|
);
|
|
12735
13230
|
});
|
|
12736
13231
|
|
|
12737
13232
|
// src/index.ts
|
|
12738
|
-
var program = new
|
|
12739
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
13233
|
+
var program = new Command68();
|
|
13234
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.19.0");
|
|
12740
13235
|
program.addCommand(authCommand);
|
|
12741
13236
|
program.addCommand(infoCommand);
|
|
12742
13237
|
program.addCommand(composeCommand);
|
|
@@ -12751,6 +13246,7 @@ program.addCommand(initCommand3);
|
|
|
12751
13246
|
program.addCommand(scheduleCommand);
|
|
12752
13247
|
program.addCommand(usageCommand);
|
|
12753
13248
|
program.addCommand(secretCommand);
|
|
13249
|
+
program.addCommand(variableCommand);
|
|
12754
13250
|
program.addCommand(modelProviderCommand);
|
|
12755
13251
|
program.addCommand(onboardCommand);
|
|
12756
13252
|
program.addCommand(setupClaudeCommand);
|