@vm0/cli 9.17.1 → 9.18.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 +1038 -717
- 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 Command63 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth/index.ts
|
|
7
7
|
import { Command as Command5 } from "commander";
|
|
@@ -237,7 +237,7 @@ var infoCommand = new Command6().name("info").description("Display environment i
|
|
|
237
237
|
import { Command as Command7, Option } from "commander";
|
|
238
238
|
import chalk4 from "chalk";
|
|
239
239
|
import { readFile as readFile4 } from "fs/promises";
|
|
240
|
-
import { existsSync as
|
|
240
|
+
import { existsSync as existsSync4 } from "fs";
|
|
241
241
|
import { dirname as dirname2 } from "path";
|
|
242
242
|
import { parse as parseYaml2 } from "yaml";
|
|
243
243
|
|
|
@@ -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",
|
|
@@ -2109,6 +2208,41 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
2109
2208
|
models: ["GLM-4.7", "GLM-4.5-Air"],
|
|
2110
2209
|
defaultModel: "GLM-4.7"
|
|
2111
2210
|
},
|
|
2211
|
+
"azure-foundry": {
|
|
2212
|
+
framework: "claude-code",
|
|
2213
|
+
label: "Azure Foundry",
|
|
2214
|
+
helpText: "Run Claude on Microsoft Azure Foundry.\nSetup guide: https://code.claude.com/docs/en/microsoft-foundry",
|
|
2215
|
+
authMethods: {
|
|
2216
|
+
"api-key": {
|
|
2217
|
+
label: "API Key",
|
|
2218
|
+
helpText: "Use an Azure Foundry API key for authentication",
|
|
2219
|
+
credentials: {
|
|
2220
|
+
ANTHROPIC_FOUNDRY_API_KEY: {
|
|
2221
|
+
label: "ANTHROPIC_FOUNDRY_API_KEY",
|
|
2222
|
+
required: true,
|
|
2223
|
+
helpText: "API key from Azure Foundry portal (Endpoints and keys)"
|
|
2224
|
+
},
|
|
2225
|
+
ANTHROPIC_FOUNDRY_RESOURCE: {
|
|
2226
|
+
label: "ANTHROPIC_FOUNDRY_RESOURCE",
|
|
2227
|
+
required: true,
|
|
2228
|
+
placeholder: "my-resource",
|
|
2229
|
+
helpText: "Azure resource name (from portal URL)"
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
},
|
|
2234
|
+
defaultAuthMethod: "api-key",
|
|
2235
|
+
environmentMapping: {
|
|
2236
|
+
CLAUDE_CODE_USE_FOUNDRY: "1",
|
|
2237
|
+
ANTHROPIC_FOUNDRY_API_KEY: "$credentials.ANTHROPIC_FOUNDRY_API_KEY",
|
|
2238
|
+
ANTHROPIC_FOUNDRY_RESOURCE: "$credentials.ANTHROPIC_FOUNDRY_RESOURCE",
|
|
2239
|
+
ANTHROPIC_MODEL: "$model"
|
|
2240
|
+
},
|
|
2241
|
+
models: [],
|
|
2242
|
+
defaultModel: "",
|
|
2243
|
+
allowCustomModel: true,
|
|
2244
|
+
customModelPlaceholder: "claude-sonnet-4-5"
|
|
2245
|
+
},
|
|
2112
2246
|
"aws-bedrock": {
|
|
2113
2247
|
framework: "claude-code",
|
|
2114
2248
|
label: "AWS Bedrock",
|
|
@@ -2175,7 +2309,7 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
2175
2309
|
customModelPlaceholder: "anthropic.claude-sonnet-4-20250514-v1:0"
|
|
2176
2310
|
}
|
|
2177
2311
|
};
|
|
2178
|
-
var modelProviderTypeSchema =
|
|
2312
|
+
var modelProviderTypeSchema = z16.enum([
|
|
2179
2313
|
"claude-code-oauth-token",
|
|
2180
2314
|
"anthropic-api-key",
|
|
2181
2315
|
"openrouter-api-key",
|
|
@@ -2183,9 +2317,10 @@ var modelProviderTypeSchema = z15.enum([
|
|
|
2183
2317
|
"minimax-api-key",
|
|
2184
2318
|
"deepseek-api-key",
|
|
2185
2319
|
"zai-api-key",
|
|
2320
|
+
"azure-foundry",
|
|
2186
2321
|
"aws-bedrock"
|
|
2187
2322
|
]);
|
|
2188
|
-
var modelProviderFrameworkSchema =
|
|
2323
|
+
var modelProviderFrameworkSchema = z16.enum(["claude-code", "codex"]);
|
|
2189
2324
|
function hasAuthMethods(type) {
|
|
2190
2325
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
2191
2326
|
return "authMethods" in config;
|
|
@@ -2226,45 +2361,45 @@ function getCustomModelPlaceholder(type) {
|
|
|
2226
2361
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
2227
2362
|
return "customModelPlaceholder" in config ? config.customModelPlaceholder : void 0;
|
|
2228
2363
|
}
|
|
2229
|
-
var modelProviderResponseSchema =
|
|
2230
|
-
id:
|
|
2364
|
+
var modelProviderResponseSchema = z16.object({
|
|
2365
|
+
id: z16.string().uuid(),
|
|
2231
2366
|
type: modelProviderTypeSchema,
|
|
2232
2367
|
framework: modelProviderFrameworkSchema,
|
|
2233
|
-
credentialName:
|
|
2368
|
+
credentialName: z16.string().nullable(),
|
|
2234
2369
|
// Legacy single-credential (deprecated for multi-auth)
|
|
2235
|
-
authMethod:
|
|
2370
|
+
authMethod: z16.string().nullable(),
|
|
2236
2371
|
// For multi-auth providers
|
|
2237
|
-
credentialNames:
|
|
2372
|
+
credentialNames: z16.array(z16.string()).nullable(),
|
|
2238
2373
|
// For multi-auth providers
|
|
2239
|
-
isDefault:
|
|
2240
|
-
selectedModel:
|
|
2241
|
-
createdAt:
|
|
2242
|
-
updatedAt:
|
|
2374
|
+
isDefault: z16.boolean(),
|
|
2375
|
+
selectedModel: z16.string().nullable(),
|
|
2376
|
+
createdAt: z16.string(),
|
|
2377
|
+
updatedAt: z16.string()
|
|
2243
2378
|
});
|
|
2244
|
-
var modelProviderListResponseSchema =
|
|
2245
|
-
modelProviders:
|
|
2379
|
+
var modelProviderListResponseSchema = z16.object({
|
|
2380
|
+
modelProviders: z16.array(modelProviderResponseSchema)
|
|
2246
2381
|
});
|
|
2247
|
-
var upsertModelProviderRequestSchema =
|
|
2382
|
+
var upsertModelProviderRequestSchema = z16.object({
|
|
2248
2383
|
type: modelProviderTypeSchema,
|
|
2249
|
-
credential:
|
|
2384
|
+
credential: z16.string().min(1).optional(),
|
|
2250
2385
|
// Legacy single credential
|
|
2251
|
-
authMethod:
|
|
2386
|
+
authMethod: z16.string().optional(),
|
|
2252
2387
|
// For multi-auth providers
|
|
2253
|
-
credentials:
|
|
2388
|
+
credentials: z16.record(z16.string(), z16.string()).optional(),
|
|
2254
2389
|
// For multi-auth providers
|
|
2255
|
-
convert:
|
|
2256
|
-
selectedModel:
|
|
2390
|
+
convert: z16.boolean().optional(),
|
|
2391
|
+
selectedModel: z16.string().optional()
|
|
2257
2392
|
});
|
|
2258
|
-
var upsertModelProviderResponseSchema =
|
|
2393
|
+
var upsertModelProviderResponseSchema = z16.object({
|
|
2259
2394
|
provider: modelProviderResponseSchema,
|
|
2260
|
-
created:
|
|
2395
|
+
created: z16.boolean()
|
|
2261
2396
|
});
|
|
2262
|
-
var checkCredentialResponseSchema =
|
|
2263
|
-
exists:
|
|
2264
|
-
credentialName:
|
|
2265
|
-
currentType:
|
|
2397
|
+
var checkCredentialResponseSchema = z16.object({
|
|
2398
|
+
exists: z16.boolean(),
|
|
2399
|
+
credentialName: z16.string(),
|
|
2400
|
+
currentType: z16.enum(["user", "model-provider"]).optional()
|
|
2266
2401
|
});
|
|
2267
|
-
var modelProvidersMainContract =
|
|
2402
|
+
var modelProvidersMainContract = c13.router({
|
|
2268
2403
|
list: {
|
|
2269
2404
|
method: "GET",
|
|
2270
2405
|
path: "/api/model-providers",
|
|
@@ -2292,12 +2427,12 @@ var modelProvidersMainContract = c12.router({
|
|
|
2292
2427
|
summary: "Create or update a model provider"
|
|
2293
2428
|
}
|
|
2294
2429
|
});
|
|
2295
|
-
var modelProvidersCheckContract =
|
|
2430
|
+
var modelProvidersCheckContract = c13.router({
|
|
2296
2431
|
check: {
|
|
2297
2432
|
method: "GET",
|
|
2298
2433
|
path: "/api/model-providers/check/:type",
|
|
2299
2434
|
headers: authHeadersSchema,
|
|
2300
|
-
pathParams:
|
|
2435
|
+
pathParams: z16.object({
|
|
2301
2436
|
type: modelProviderTypeSchema
|
|
2302
2437
|
}),
|
|
2303
2438
|
responses: {
|
|
@@ -2308,16 +2443,16 @@ var modelProvidersCheckContract = c12.router({
|
|
|
2308
2443
|
summary: "Check if credential exists for a model provider type"
|
|
2309
2444
|
}
|
|
2310
2445
|
});
|
|
2311
|
-
var modelProvidersByTypeContract =
|
|
2446
|
+
var modelProvidersByTypeContract = c13.router({
|
|
2312
2447
|
delete: {
|
|
2313
2448
|
method: "DELETE",
|
|
2314
2449
|
path: "/api/model-providers/:type",
|
|
2315
2450
|
headers: authHeadersSchema,
|
|
2316
|
-
pathParams:
|
|
2451
|
+
pathParams: z16.object({
|
|
2317
2452
|
type: modelProviderTypeSchema
|
|
2318
2453
|
}),
|
|
2319
2454
|
responses: {
|
|
2320
|
-
204:
|
|
2455
|
+
204: c13.noBody(),
|
|
2321
2456
|
401: apiErrorSchema,
|
|
2322
2457
|
404: apiErrorSchema,
|
|
2323
2458
|
500: apiErrorSchema
|
|
@@ -2325,15 +2460,15 @@ var modelProvidersByTypeContract = c12.router({
|
|
|
2325
2460
|
summary: "Delete a model provider"
|
|
2326
2461
|
}
|
|
2327
2462
|
});
|
|
2328
|
-
var modelProvidersConvertContract =
|
|
2463
|
+
var modelProvidersConvertContract = c13.router({
|
|
2329
2464
|
convert: {
|
|
2330
2465
|
method: "POST",
|
|
2331
2466
|
path: "/api/model-providers/:type/convert",
|
|
2332
2467
|
headers: authHeadersSchema,
|
|
2333
|
-
pathParams:
|
|
2468
|
+
pathParams: z16.object({
|
|
2334
2469
|
type: modelProviderTypeSchema
|
|
2335
2470
|
}),
|
|
2336
|
-
body:
|
|
2471
|
+
body: z16.undefined(),
|
|
2337
2472
|
responses: {
|
|
2338
2473
|
200: modelProviderResponseSchema,
|
|
2339
2474
|
400: apiErrorSchema,
|
|
@@ -2344,15 +2479,15 @@ var modelProvidersConvertContract = c12.router({
|
|
|
2344
2479
|
summary: "Convert existing user credential to model provider"
|
|
2345
2480
|
}
|
|
2346
2481
|
});
|
|
2347
|
-
var modelProvidersSetDefaultContract =
|
|
2482
|
+
var modelProvidersSetDefaultContract = c13.router({
|
|
2348
2483
|
setDefault: {
|
|
2349
2484
|
method: "POST",
|
|
2350
2485
|
path: "/api/model-providers/:type/set-default",
|
|
2351
2486
|
headers: authHeadersSchema,
|
|
2352
|
-
pathParams:
|
|
2487
|
+
pathParams: z16.object({
|
|
2353
2488
|
type: modelProviderTypeSchema
|
|
2354
2489
|
}),
|
|
2355
|
-
body:
|
|
2490
|
+
body: z16.undefined(),
|
|
2356
2491
|
responses: {
|
|
2357
2492
|
200: modelProviderResponseSchema,
|
|
2358
2493
|
401: apiErrorSchema,
|
|
@@ -2362,15 +2497,15 @@ var modelProvidersSetDefaultContract = c12.router({
|
|
|
2362
2497
|
summary: "Set a model provider as default for its framework"
|
|
2363
2498
|
}
|
|
2364
2499
|
});
|
|
2365
|
-
var updateModelRequestSchema =
|
|
2366
|
-
selectedModel:
|
|
2500
|
+
var updateModelRequestSchema = z16.object({
|
|
2501
|
+
selectedModel: z16.string().optional()
|
|
2367
2502
|
});
|
|
2368
|
-
var modelProvidersUpdateModelContract =
|
|
2503
|
+
var modelProvidersUpdateModelContract = c13.router({
|
|
2369
2504
|
updateModel: {
|
|
2370
2505
|
method: "PATCH",
|
|
2371
2506
|
path: "/api/model-providers/:type/model",
|
|
2372
2507
|
headers: authHeadersSchema,
|
|
2373
|
-
pathParams:
|
|
2508
|
+
pathParams: z16.object({
|
|
2374
2509
|
type: modelProviderTypeSchema
|
|
2375
2510
|
}),
|
|
2376
2511
|
body: updateModelRequestSchema,
|
|
@@ -2385,42 +2520,42 @@ var modelProvidersUpdateModelContract = c12.router({
|
|
|
2385
2520
|
});
|
|
2386
2521
|
|
|
2387
2522
|
// ../../packages/core/src/contracts/sessions.ts
|
|
2388
|
-
import { z as
|
|
2389
|
-
var
|
|
2390
|
-
var sessionResponseSchema =
|
|
2391
|
-
id:
|
|
2392
|
-
agentComposeId:
|
|
2393
|
-
agentComposeVersionId:
|
|
2394
|
-
conversationId:
|
|
2395
|
-
artifactName:
|
|
2396
|
-
vars:
|
|
2397
|
-
secretNames:
|
|
2398
|
-
volumeVersions:
|
|
2399
|
-
createdAt:
|
|
2400
|
-
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()
|
|
2401
2536
|
});
|
|
2402
|
-
var agentComposeSnapshotSchema =
|
|
2403
|
-
agentComposeVersionId:
|
|
2404
|
-
vars:
|
|
2405
|
-
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()
|
|
2406
2541
|
});
|
|
2407
|
-
var artifactSnapshotSchema2 =
|
|
2408
|
-
artifactName:
|
|
2409
|
-
artifactVersion:
|
|
2542
|
+
var artifactSnapshotSchema2 = z17.object({
|
|
2543
|
+
artifactName: z17.string(),
|
|
2544
|
+
artifactVersion: z17.string()
|
|
2410
2545
|
});
|
|
2411
|
-
var volumeVersionsSnapshotSchema2 =
|
|
2412
|
-
versions:
|
|
2546
|
+
var volumeVersionsSnapshotSchema2 = z17.object({
|
|
2547
|
+
versions: z17.record(z17.string(), z17.string())
|
|
2413
2548
|
});
|
|
2414
|
-
var checkpointResponseSchema =
|
|
2415
|
-
id:
|
|
2416
|
-
runId:
|
|
2417
|
-
conversationId:
|
|
2549
|
+
var checkpointResponseSchema = z17.object({
|
|
2550
|
+
id: z17.string(),
|
|
2551
|
+
runId: z17.string(),
|
|
2552
|
+
conversationId: z17.string(),
|
|
2418
2553
|
agentComposeSnapshot: agentComposeSnapshotSchema,
|
|
2419
2554
|
artifactSnapshot: artifactSnapshotSchema2.nullable(),
|
|
2420
2555
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
|
|
2421
|
-
createdAt:
|
|
2556
|
+
createdAt: z17.string()
|
|
2422
2557
|
});
|
|
2423
|
-
var sessionsByIdContract =
|
|
2558
|
+
var sessionsByIdContract = c14.router({
|
|
2424
2559
|
/**
|
|
2425
2560
|
* GET /api/agent/sessions/:id
|
|
2426
2561
|
* Get session by ID
|
|
@@ -2429,8 +2564,8 @@ var sessionsByIdContract = c13.router({
|
|
|
2429
2564
|
method: "GET",
|
|
2430
2565
|
path: "/api/agent/sessions/:id",
|
|
2431
2566
|
headers: authHeadersSchema,
|
|
2432
|
-
pathParams:
|
|
2433
|
-
id:
|
|
2567
|
+
pathParams: z17.object({
|
|
2568
|
+
id: z17.string().min(1, "Session ID is required")
|
|
2434
2569
|
}),
|
|
2435
2570
|
responses: {
|
|
2436
2571
|
200: sessionResponseSchema,
|
|
@@ -2441,7 +2576,7 @@ var sessionsByIdContract = c13.router({
|
|
|
2441
2576
|
summary: "Get session by ID"
|
|
2442
2577
|
}
|
|
2443
2578
|
});
|
|
2444
|
-
var checkpointsByIdContract =
|
|
2579
|
+
var checkpointsByIdContract = c14.router({
|
|
2445
2580
|
/**
|
|
2446
2581
|
* GET /api/agent/checkpoints/:id
|
|
2447
2582
|
* Get checkpoint by ID
|
|
@@ -2450,8 +2585,8 @@ var checkpointsByIdContract = c13.router({
|
|
|
2450
2585
|
method: "GET",
|
|
2451
2586
|
path: "/api/agent/checkpoints/:id",
|
|
2452
2587
|
headers: authHeadersSchema,
|
|
2453
|
-
pathParams:
|
|
2454
|
-
id:
|
|
2588
|
+
pathParams: z17.object({
|
|
2589
|
+
id: z17.string().min(1, "Checkpoint ID is required")
|
|
2455
2590
|
}),
|
|
2456
2591
|
responses: {
|
|
2457
2592
|
200: checkpointResponseSchema,
|
|
@@ -2464,93 +2599,93 @@ var checkpointsByIdContract = c13.router({
|
|
|
2464
2599
|
});
|
|
2465
2600
|
|
|
2466
2601
|
// ../../packages/core/src/contracts/schedules.ts
|
|
2467
|
-
import { z as
|
|
2468
|
-
var
|
|
2469
|
-
var scheduleTriggerSchema =
|
|
2470
|
-
cron:
|
|
2471
|
-
at:
|
|
2472
|
-
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")
|
|
2473
2608
|
}).refine((data) => data.cron && !data.at || !data.cron && data.at, {
|
|
2474
2609
|
message: "Exactly one of 'cron' or 'at' must be specified"
|
|
2475
2610
|
});
|
|
2476
|
-
var scheduleRunConfigSchema =
|
|
2477
|
-
agent:
|
|
2478
|
-
prompt:
|
|
2479
|
-
vars:
|
|
2480
|
-
secrets:
|
|
2481
|
-
artifactName:
|
|
2482
|
-
artifactVersion:
|
|
2483
|
-
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()
|
|
2484
2619
|
});
|
|
2485
|
-
var scheduleDefinitionSchema =
|
|
2620
|
+
var scheduleDefinitionSchema = z18.object({
|
|
2486
2621
|
on: scheduleTriggerSchema,
|
|
2487
2622
|
run: scheduleRunConfigSchema
|
|
2488
2623
|
});
|
|
2489
|
-
var scheduleYamlSchema =
|
|
2490
|
-
version:
|
|
2491
|
-
schedules:
|
|
2492
|
-
});
|
|
2493
|
-
var deployScheduleRequestSchema =
|
|
2494
|
-
name:
|
|
2495
|
-
cronExpression:
|
|
2496
|
-
atTime:
|
|
2497
|
-
timezone:
|
|
2498
|
-
prompt:
|
|
2499
|
-
vars:
|
|
2500
|
-
secrets:
|
|
2501
|
-
artifactName:
|
|
2502
|
-
artifactVersion:
|
|
2503
|
-
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(),
|
|
2504
2639
|
// Resolved agent compose ID (CLI resolves scope/name:version → composeId)
|
|
2505
|
-
composeId:
|
|
2640
|
+
composeId: z18.string().uuid("Invalid compose ID")
|
|
2506
2641
|
}).refine(
|
|
2507
2642
|
(data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
|
|
2508
2643
|
{
|
|
2509
2644
|
message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
|
|
2510
2645
|
}
|
|
2511
2646
|
);
|
|
2512
|
-
var scheduleResponseSchema =
|
|
2513
|
-
id:
|
|
2514
|
-
composeId:
|
|
2515
|
-
composeName:
|
|
2516
|
-
scopeSlug:
|
|
2517
|
-
name:
|
|
2518
|
-
cronExpression:
|
|
2519
|
-
atTime:
|
|
2520
|
-
timezone:
|
|
2521
|
-
prompt:
|
|
2522
|
-
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(),
|
|
2523
2658
|
// Secret names only (values are never returned)
|
|
2524
|
-
secretNames:
|
|
2525
|
-
artifactName:
|
|
2526
|
-
artifactVersion:
|
|
2527
|
-
volumeVersions:
|
|
2528
|
-
enabled:
|
|
2529
|
-
nextRunAt:
|
|
2530
|
-
lastRunAt:
|
|
2531
|
-
retryStartedAt:
|
|
2532
|
-
createdAt:
|
|
2533
|
-
updatedAt:
|
|
2534
|
-
});
|
|
2535
|
-
var runSummarySchema =
|
|
2536
|
-
id:
|
|
2537
|
-
status:
|
|
2538
|
-
createdAt:
|
|
2539
|
-
completedAt:
|
|
2540
|
-
error:
|
|
2541
|
-
});
|
|
2542
|
-
var scheduleRunsResponseSchema =
|
|
2543
|
-
runs:
|
|
2544
|
-
});
|
|
2545
|
-
var scheduleListResponseSchema =
|
|
2546
|
-
schedules:
|
|
2547
|
-
});
|
|
2548
|
-
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({
|
|
2549
2684
|
schedule: scheduleResponseSchema,
|
|
2550
|
-
created:
|
|
2685
|
+
created: z18.boolean()
|
|
2551
2686
|
// true if created, false if updated
|
|
2552
2687
|
});
|
|
2553
|
-
var schedulesMainContract =
|
|
2688
|
+
var schedulesMainContract = c15.router({
|
|
2554
2689
|
/**
|
|
2555
2690
|
* POST /api/agent/schedules
|
|
2556
2691
|
* Deploy (create or update) a schedule
|
|
@@ -2588,7 +2723,7 @@ var schedulesMainContract = c14.router({
|
|
|
2588
2723
|
summary: "List all schedules"
|
|
2589
2724
|
}
|
|
2590
2725
|
});
|
|
2591
|
-
var schedulesByNameContract =
|
|
2726
|
+
var schedulesByNameContract = c15.router({
|
|
2592
2727
|
/**
|
|
2593
2728
|
* GET /api/agent/schedules/:name
|
|
2594
2729
|
* Get schedule by name
|
|
@@ -2597,11 +2732,11 @@ var schedulesByNameContract = c14.router({
|
|
|
2597
2732
|
method: "GET",
|
|
2598
2733
|
path: "/api/agent/schedules/:name",
|
|
2599
2734
|
headers: authHeadersSchema,
|
|
2600
|
-
pathParams:
|
|
2601
|
-
name:
|
|
2735
|
+
pathParams: z18.object({
|
|
2736
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2602
2737
|
}),
|
|
2603
|
-
query:
|
|
2604
|
-
composeId:
|
|
2738
|
+
query: z18.object({
|
|
2739
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2605
2740
|
}),
|
|
2606
2741
|
responses: {
|
|
2607
2742
|
200: scheduleResponseSchema,
|
|
@@ -2618,21 +2753,21 @@ var schedulesByNameContract = c14.router({
|
|
|
2618
2753
|
method: "DELETE",
|
|
2619
2754
|
path: "/api/agent/schedules/:name",
|
|
2620
2755
|
headers: authHeadersSchema,
|
|
2621
|
-
pathParams:
|
|
2622
|
-
name:
|
|
2756
|
+
pathParams: z18.object({
|
|
2757
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2623
2758
|
}),
|
|
2624
|
-
query:
|
|
2625
|
-
composeId:
|
|
2759
|
+
query: z18.object({
|
|
2760
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2626
2761
|
}),
|
|
2627
2762
|
responses: {
|
|
2628
|
-
204:
|
|
2763
|
+
204: c15.noBody(),
|
|
2629
2764
|
401: apiErrorSchema,
|
|
2630
2765
|
404: apiErrorSchema
|
|
2631
2766
|
},
|
|
2632
2767
|
summary: "Delete schedule"
|
|
2633
2768
|
}
|
|
2634
2769
|
});
|
|
2635
|
-
var schedulesEnableContract =
|
|
2770
|
+
var schedulesEnableContract = c15.router({
|
|
2636
2771
|
/**
|
|
2637
2772
|
* POST /api/agent/schedules/:name/enable
|
|
2638
2773
|
* Enable a disabled schedule
|
|
@@ -2641,11 +2776,11 @@ var schedulesEnableContract = c14.router({
|
|
|
2641
2776
|
method: "POST",
|
|
2642
2777
|
path: "/api/agent/schedules/:name/enable",
|
|
2643
2778
|
headers: authHeadersSchema,
|
|
2644
|
-
pathParams:
|
|
2645
|
-
name:
|
|
2779
|
+
pathParams: z18.object({
|
|
2780
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2646
2781
|
}),
|
|
2647
|
-
body:
|
|
2648
|
-
composeId:
|
|
2782
|
+
body: z18.object({
|
|
2783
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2649
2784
|
}),
|
|
2650
2785
|
responses: {
|
|
2651
2786
|
200: scheduleResponseSchema,
|
|
@@ -2662,11 +2797,11 @@ var schedulesEnableContract = c14.router({
|
|
|
2662
2797
|
method: "POST",
|
|
2663
2798
|
path: "/api/agent/schedules/:name/disable",
|
|
2664
2799
|
headers: authHeadersSchema,
|
|
2665
|
-
pathParams:
|
|
2666
|
-
name:
|
|
2800
|
+
pathParams: z18.object({
|
|
2801
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2667
2802
|
}),
|
|
2668
|
-
body:
|
|
2669
|
-
composeId:
|
|
2803
|
+
body: z18.object({
|
|
2804
|
+
composeId: z18.string().uuid("Compose ID required")
|
|
2670
2805
|
}),
|
|
2671
2806
|
responses: {
|
|
2672
2807
|
200: scheduleResponseSchema,
|
|
@@ -2676,7 +2811,7 @@ var schedulesEnableContract = c14.router({
|
|
|
2676
2811
|
summary: "Disable schedule"
|
|
2677
2812
|
}
|
|
2678
2813
|
});
|
|
2679
|
-
var scheduleRunsContract =
|
|
2814
|
+
var scheduleRunsContract = c15.router({
|
|
2680
2815
|
/**
|
|
2681
2816
|
* GET /api/agent/schedules/:name/runs
|
|
2682
2817
|
* List recent runs for a schedule
|
|
@@ -2685,12 +2820,12 @@ var scheduleRunsContract = c14.router({
|
|
|
2685
2820
|
method: "GET",
|
|
2686
2821
|
path: "/api/agent/schedules/:name/runs",
|
|
2687
2822
|
headers: authHeadersSchema,
|
|
2688
|
-
pathParams:
|
|
2689
|
-
name:
|
|
2823
|
+
pathParams: z18.object({
|
|
2824
|
+
name: z18.string().min(1, "Schedule name required")
|
|
2690
2825
|
}),
|
|
2691
|
-
query:
|
|
2692
|
-
composeId:
|
|
2693
|
-
limit:
|
|
2826
|
+
query: z18.object({
|
|
2827
|
+
composeId: z18.string().uuid("Compose ID required"),
|
|
2828
|
+
limit: z18.coerce.number().min(0).max(100).default(5)
|
|
2694
2829
|
}),
|
|
2695
2830
|
responses: {
|
|
2696
2831
|
200: scheduleRunsResponseSchema,
|
|
@@ -2702,18 +2837,18 @@ var scheduleRunsContract = c14.router({
|
|
|
2702
2837
|
});
|
|
2703
2838
|
|
|
2704
2839
|
// ../../packages/core/src/contracts/realtime.ts
|
|
2705
|
-
import { z as
|
|
2706
|
-
var
|
|
2707
|
-
var ablyTokenRequestSchema =
|
|
2708
|
-
keyName:
|
|
2709
|
-
ttl:
|
|
2710
|
-
timestamp:
|
|
2711
|
-
capability:
|
|
2712
|
-
clientId:
|
|
2713
|
-
nonce:
|
|
2714
|
-
mac:
|
|
2715
|
-
});
|
|
2716
|
-
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({
|
|
2717
2852
|
/**
|
|
2718
2853
|
* POST /api/realtime/token
|
|
2719
2854
|
* Get an Ably token to subscribe to a run's events channel
|
|
@@ -2722,8 +2857,8 @@ var realtimeTokenContract = c15.router({
|
|
|
2722
2857
|
method: "POST",
|
|
2723
2858
|
path: "/api/realtime/token",
|
|
2724
2859
|
headers: authHeadersSchema,
|
|
2725
|
-
body:
|
|
2726
|
-
runId:
|
|
2860
|
+
body: z19.object({
|
|
2861
|
+
runId: z19.string().uuid("runId must be a valid UUID")
|
|
2727
2862
|
}),
|
|
2728
2863
|
responses: {
|
|
2729
2864
|
200: ablyTokenRequestSchema,
|
|
@@ -2735,7 +2870,7 @@ var realtimeTokenContract = c15.router({
|
|
|
2735
2870
|
summary: "Get Ably token for run event subscription"
|
|
2736
2871
|
}
|
|
2737
2872
|
});
|
|
2738
|
-
var runnerRealtimeTokenContract =
|
|
2873
|
+
var runnerRealtimeTokenContract = c16.router({
|
|
2739
2874
|
/**
|
|
2740
2875
|
* POST /api/runners/realtime/token
|
|
2741
2876
|
* Get an Ably token to subscribe to a runner group's job notification channel
|
|
@@ -2744,7 +2879,7 @@ var runnerRealtimeTokenContract = c15.router({
|
|
|
2744
2879
|
method: "POST",
|
|
2745
2880
|
path: "/api/runners/realtime/token",
|
|
2746
2881
|
headers: authHeadersSchema,
|
|
2747
|
-
body:
|
|
2882
|
+
body: z19.object({
|
|
2748
2883
|
group: runnerGroupSchema
|
|
2749
2884
|
}),
|
|
2750
2885
|
responses: {
|
|
@@ -2758,11 +2893,11 @@ var runnerRealtimeTokenContract = c15.router({
|
|
|
2758
2893
|
});
|
|
2759
2894
|
|
|
2760
2895
|
// ../../packages/core/src/contracts/platform.ts
|
|
2761
|
-
import { z as
|
|
2896
|
+
import { z as z21 } from "zod";
|
|
2762
2897
|
|
|
2763
2898
|
// ../../packages/core/src/contracts/public/common.ts
|
|
2764
|
-
import { z as
|
|
2765
|
-
var publicApiErrorTypeSchema =
|
|
2899
|
+
import { z as z20 } from "zod";
|
|
2900
|
+
var publicApiErrorTypeSchema = z20.enum([
|
|
2766
2901
|
"api_error",
|
|
2767
2902
|
// Internal server error (5xx)
|
|
2768
2903
|
"invalid_request_error",
|
|
@@ -2776,40 +2911,40 @@ var publicApiErrorTypeSchema = z19.enum([
|
|
|
2776
2911
|
"rate_limit_error"
|
|
2777
2912
|
// Rate limit exceeded (429)
|
|
2778
2913
|
]);
|
|
2779
|
-
var publicApiErrorSchema =
|
|
2780
|
-
error:
|
|
2914
|
+
var publicApiErrorSchema = z20.object({
|
|
2915
|
+
error: z20.object({
|
|
2781
2916
|
type: publicApiErrorTypeSchema,
|
|
2782
|
-
code:
|
|
2783
|
-
message:
|
|
2784
|
-
param:
|
|
2785
|
-
docUrl:
|
|
2917
|
+
code: z20.string(),
|
|
2918
|
+
message: z20.string(),
|
|
2919
|
+
param: z20.string().optional(),
|
|
2920
|
+
docUrl: z20.string().url().optional()
|
|
2786
2921
|
})
|
|
2787
2922
|
});
|
|
2788
|
-
var paginationSchema =
|
|
2789
|
-
hasMore:
|
|
2790
|
-
nextCursor:
|
|
2923
|
+
var paginationSchema = z20.object({
|
|
2924
|
+
hasMore: z20.boolean(),
|
|
2925
|
+
nextCursor: z20.string().nullable()
|
|
2791
2926
|
});
|
|
2792
2927
|
function createPaginatedResponseSchema(dataSchema) {
|
|
2793
|
-
return
|
|
2794
|
-
data:
|
|
2928
|
+
return z20.object({
|
|
2929
|
+
data: z20.array(dataSchema),
|
|
2795
2930
|
pagination: paginationSchema
|
|
2796
2931
|
});
|
|
2797
2932
|
}
|
|
2798
|
-
var listQuerySchema =
|
|
2799
|
-
cursor:
|
|
2800
|
-
limit:
|
|
2933
|
+
var listQuerySchema = z20.object({
|
|
2934
|
+
cursor: z20.string().optional(),
|
|
2935
|
+
limit: z20.coerce.number().min(1).max(100).default(20)
|
|
2801
2936
|
});
|
|
2802
|
-
var requestIdSchema =
|
|
2803
|
-
var timestampSchema =
|
|
2937
|
+
var requestIdSchema = z20.string().uuid();
|
|
2938
|
+
var timestampSchema = z20.string().datetime();
|
|
2804
2939
|
|
|
2805
2940
|
// ../../packages/core/src/contracts/platform.ts
|
|
2806
|
-
var
|
|
2807
|
-
var platformPaginationSchema =
|
|
2808
|
-
hasMore:
|
|
2809
|
-
nextCursor:
|
|
2810
|
-
totalPages:
|
|
2941
|
+
var c17 = initContract();
|
|
2942
|
+
var platformPaginationSchema = z21.object({
|
|
2943
|
+
hasMore: z21.boolean(),
|
|
2944
|
+
nextCursor: z21.string().nullable(),
|
|
2945
|
+
totalPages: z21.number()
|
|
2811
2946
|
});
|
|
2812
|
-
var platformLogStatusSchema =
|
|
2947
|
+
var platformLogStatusSchema = z21.enum([
|
|
2813
2948
|
"pending",
|
|
2814
2949
|
"running",
|
|
2815
2950
|
"completed",
|
|
@@ -2817,41 +2952,41 @@ var platformLogStatusSchema = z20.enum([
|
|
|
2817
2952
|
"timeout",
|
|
2818
2953
|
"cancelled"
|
|
2819
2954
|
]);
|
|
2820
|
-
var platformLogEntrySchema =
|
|
2821
|
-
id:
|
|
2822
|
-
sessionId:
|
|
2823
|
-
agentName:
|
|
2824
|
-
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(),
|
|
2825
2960
|
status: platformLogStatusSchema,
|
|
2826
|
-
createdAt:
|
|
2961
|
+
createdAt: z21.string()
|
|
2827
2962
|
});
|
|
2828
|
-
var platformLogsListResponseSchema =
|
|
2829
|
-
data:
|
|
2963
|
+
var platformLogsListResponseSchema = z21.object({
|
|
2964
|
+
data: z21.array(platformLogEntrySchema),
|
|
2830
2965
|
pagination: platformPaginationSchema
|
|
2831
2966
|
});
|
|
2832
|
-
var artifactSchema =
|
|
2833
|
-
name:
|
|
2834
|
-
version:
|
|
2967
|
+
var artifactSchema = z21.object({
|
|
2968
|
+
name: z21.string().nullable(),
|
|
2969
|
+
version: z21.string().nullable()
|
|
2835
2970
|
});
|
|
2836
|
-
var platformLogDetailSchema =
|
|
2837
|
-
id:
|
|
2838
|
-
sessionId:
|
|
2839
|
-
agentName:
|
|
2840
|
-
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(),
|
|
2841
2976
|
status: platformLogStatusSchema,
|
|
2842
|
-
prompt:
|
|
2843
|
-
error:
|
|
2844
|
-
createdAt:
|
|
2845
|
-
startedAt:
|
|
2846
|
-
completedAt:
|
|
2977
|
+
prompt: z21.string(),
|
|
2978
|
+
error: z21.string().nullable(),
|
|
2979
|
+
createdAt: z21.string(),
|
|
2980
|
+
startedAt: z21.string().nullable(),
|
|
2981
|
+
completedAt: z21.string().nullable(),
|
|
2847
2982
|
artifact: artifactSchema
|
|
2848
2983
|
});
|
|
2849
|
-
var platformLogsListContract =
|
|
2984
|
+
var platformLogsListContract = c17.router({
|
|
2850
2985
|
list: {
|
|
2851
2986
|
method: "GET",
|
|
2852
2987
|
path: "/api/platform/logs",
|
|
2853
2988
|
query: listQuerySchema.extend({
|
|
2854
|
-
search:
|
|
2989
|
+
search: z21.string().optional()
|
|
2855
2990
|
}),
|
|
2856
2991
|
responses: {
|
|
2857
2992
|
200: platformLogsListResponseSchema,
|
|
@@ -2860,12 +2995,12 @@ var platformLogsListContract = c16.router({
|
|
|
2860
2995
|
summary: "List agent run logs with pagination"
|
|
2861
2996
|
}
|
|
2862
2997
|
});
|
|
2863
|
-
var platformLogsByIdContract =
|
|
2998
|
+
var platformLogsByIdContract = c17.router({
|
|
2864
2999
|
getById: {
|
|
2865
3000
|
method: "GET",
|
|
2866
3001
|
path: "/api/platform/logs/:id",
|
|
2867
|
-
pathParams:
|
|
2868
|
-
id:
|
|
3002
|
+
pathParams: z21.object({
|
|
3003
|
+
id: z21.string().uuid("Invalid log ID")
|
|
2869
3004
|
}),
|
|
2870
3005
|
responses: {
|
|
2871
3006
|
200: platformLogDetailSchema,
|
|
@@ -2875,17 +3010,17 @@ var platformLogsByIdContract = c16.router({
|
|
|
2875
3010
|
summary: "Get agent run log details by ID"
|
|
2876
3011
|
}
|
|
2877
3012
|
});
|
|
2878
|
-
var artifactDownloadResponseSchema =
|
|
2879
|
-
url:
|
|
2880
|
-
expiresAt:
|
|
3013
|
+
var artifactDownloadResponseSchema = z21.object({
|
|
3014
|
+
url: z21.string().url(),
|
|
3015
|
+
expiresAt: z21.string()
|
|
2881
3016
|
});
|
|
2882
|
-
var platformArtifactDownloadContract =
|
|
3017
|
+
var platformArtifactDownloadContract = c17.router({
|
|
2883
3018
|
getDownloadUrl: {
|
|
2884
3019
|
method: "GET",
|
|
2885
3020
|
path: "/api/platform/artifacts/download",
|
|
2886
|
-
query:
|
|
2887
|
-
name:
|
|
2888
|
-
version:
|
|
3021
|
+
query: z21.object({
|
|
3022
|
+
name: z21.string().min(1, "Artifact name is required"),
|
|
3023
|
+
version: z21.string().optional()
|
|
2889
3024
|
}),
|
|
2890
3025
|
responses: {
|
|
2891
3026
|
200: artifactDownloadResponseSchema,
|
|
@@ -2897,29 +3032,29 @@ var platformArtifactDownloadContract = c16.router({
|
|
|
2897
3032
|
});
|
|
2898
3033
|
|
|
2899
3034
|
// ../../packages/core/src/contracts/llm.ts
|
|
2900
|
-
import { z as
|
|
2901
|
-
var
|
|
2902
|
-
var messageRoleSchema =
|
|
2903
|
-
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({
|
|
2904
3039
|
role: messageRoleSchema,
|
|
2905
|
-
content:
|
|
3040
|
+
content: z22.string()
|
|
2906
3041
|
});
|
|
2907
|
-
var tokenUsageSchema =
|
|
2908
|
-
promptTokens:
|
|
2909
|
-
completionTokens:
|
|
2910
|
-
totalTokens:
|
|
3042
|
+
var tokenUsageSchema = z22.object({
|
|
3043
|
+
promptTokens: z22.number(),
|
|
3044
|
+
completionTokens: z22.number(),
|
|
3045
|
+
totalTokens: z22.number()
|
|
2911
3046
|
});
|
|
2912
|
-
var llmChatRequestSchema =
|
|
2913
|
-
model:
|
|
2914
|
-
messages:
|
|
2915
|
-
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)
|
|
2916
3051
|
});
|
|
2917
|
-
var llmChatResponseSchema =
|
|
2918
|
-
content:
|
|
2919
|
-
model:
|
|
3052
|
+
var llmChatResponseSchema = z22.object({
|
|
3053
|
+
content: z22.string(),
|
|
3054
|
+
model: z22.string(),
|
|
2920
3055
|
usage: tokenUsageSchema
|
|
2921
3056
|
});
|
|
2922
|
-
var llmChatContract =
|
|
3057
|
+
var llmChatContract = c18.router({
|
|
2923
3058
|
chat: {
|
|
2924
3059
|
method: "POST",
|
|
2925
3060
|
path: "/api/llm/chat",
|
|
@@ -2935,28 +3070,28 @@ var llmChatContract = c17.router({
|
|
|
2935
3070
|
});
|
|
2936
3071
|
|
|
2937
3072
|
// ../../packages/core/src/contracts/public/agents.ts
|
|
2938
|
-
import { z as
|
|
2939
|
-
var
|
|
2940
|
-
var publicAgentSchema =
|
|
2941
|
-
id:
|
|
2942
|
-
name:
|
|
2943
|
-
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(),
|
|
2944
3079
|
createdAt: timestampSchema,
|
|
2945
3080
|
updatedAt: timestampSchema
|
|
2946
3081
|
});
|
|
2947
|
-
var agentVersionSchema =
|
|
2948
|
-
id:
|
|
2949
|
-
agentId:
|
|
2950
|
-
versionNumber:
|
|
3082
|
+
var agentVersionSchema = z23.object({
|
|
3083
|
+
id: z23.string(),
|
|
3084
|
+
agentId: z23.string(),
|
|
3085
|
+
versionNumber: z23.number(),
|
|
2951
3086
|
createdAt: timestampSchema
|
|
2952
3087
|
});
|
|
2953
3088
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
2954
3089
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
2955
3090
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
2956
3091
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
2957
|
-
name:
|
|
3092
|
+
name: z23.string().optional()
|
|
2958
3093
|
});
|
|
2959
|
-
var publicAgentsListContract =
|
|
3094
|
+
var publicAgentsListContract = c19.router({
|
|
2960
3095
|
list: {
|
|
2961
3096
|
method: "GET",
|
|
2962
3097
|
path: "/v1/agents",
|
|
@@ -2971,13 +3106,13 @@ var publicAgentsListContract = c18.router({
|
|
|
2971
3106
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
2972
3107
|
}
|
|
2973
3108
|
});
|
|
2974
|
-
var publicAgentByIdContract =
|
|
3109
|
+
var publicAgentByIdContract = c19.router({
|
|
2975
3110
|
get: {
|
|
2976
3111
|
method: "GET",
|
|
2977
3112
|
path: "/v1/agents/:id",
|
|
2978
3113
|
headers: authHeadersSchema,
|
|
2979
|
-
pathParams:
|
|
2980
|
-
id:
|
|
3114
|
+
pathParams: z23.object({
|
|
3115
|
+
id: z23.string().min(1, "Agent ID is required")
|
|
2981
3116
|
}),
|
|
2982
3117
|
responses: {
|
|
2983
3118
|
200: publicAgentDetailSchema,
|
|
@@ -2989,13 +3124,13 @@ var publicAgentByIdContract = c18.router({
|
|
|
2989
3124
|
description: "Get agent details by ID"
|
|
2990
3125
|
}
|
|
2991
3126
|
});
|
|
2992
|
-
var publicAgentVersionsContract =
|
|
3127
|
+
var publicAgentVersionsContract = c19.router({
|
|
2993
3128
|
list: {
|
|
2994
3129
|
method: "GET",
|
|
2995
3130
|
path: "/v1/agents/:id/versions",
|
|
2996
3131
|
headers: authHeadersSchema,
|
|
2997
|
-
pathParams:
|
|
2998
|
-
id:
|
|
3132
|
+
pathParams: z23.object({
|
|
3133
|
+
id: z23.string().min(1, "Agent ID is required")
|
|
2999
3134
|
}),
|
|
3000
3135
|
query: listQuerySchema,
|
|
3001
3136
|
responses: {
|
|
@@ -3010,9 +3145,9 @@ var publicAgentVersionsContract = c18.router({
|
|
|
3010
3145
|
});
|
|
3011
3146
|
|
|
3012
3147
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
3013
|
-
import { z as
|
|
3014
|
-
var
|
|
3015
|
-
var publicRunStatusSchema =
|
|
3148
|
+
import { z as z24 } from "zod";
|
|
3149
|
+
var c20 = initContract();
|
|
3150
|
+
var publicRunStatusSchema = z24.enum([
|
|
3016
3151
|
"pending",
|
|
3017
3152
|
"running",
|
|
3018
3153
|
"completed",
|
|
@@ -3020,54 +3155,54 @@ var publicRunStatusSchema = z23.enum([
|
|
|
3020
3155
|
"timeout",
|
|
3021
3156
|
"cancelled"
|
|
3022
3157
|
]);
|
|
3023
|
-
var publicRunSchema =
|
|
3024
|
-
id:
|
|
3025
|
-
agentId:
|
|
3026
|
-
agentName:
|
|
3158
|
+
var publicRunSchema = z24.object({
|
|
3159
|
+
id: z24.string(),
|
|
3160
|
+
agentId: z24.string(),
|
|
3161
|
+
agentName: z24.string(),
|
|
3027
3162
|
status: publicRunStatusSchema,
|
|
3028
|
-
prompt:
|
|
3163
|
+
prompt: z24.string(),
|
|
3029
3164
|
createdAt: timestampSchema,
|
|
3030
3165
|
startedAt: timestampSchema.nullable(),
|
|
3031
3166
|
completedAt: timestampSchema.nullable()
|
|
3032
3167
|
});
|
|
3033
3168
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
3034
|
-
error:
|
|
3035
|
-
executionTimeMs:
|
|
3036
|
-
checkpointId:
|
|
3037
|
-
sessionId:
|
|
3038
|
-
artifactName:
|
|
3039
|
-
artifactVersion:
|
|
3040
|
-
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()
|
|
3041
3176
|
});
|
|
3042
3177
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
3043
|
-
var createRunRequestSchema =
|
|
3178
|
+
var createRunRequestSchema = z24.object({
|
|
3044
3179
|
// Agent identification (one of: agent, agentId, sessionId, checkpointId)
|
|
3045
|
-
agent:
|
|
3180
|
+
agent: z24.string().optional(),
|
|
3046
3181
|
// Agent name
|
|
3047
|
-
agentId:
|
|
3182
|
+
agentId: z24.string().optional(),
|
|
3048
3183
|
// Agent ID
|
|
3049
|
-
agentVersion:
|
|
3184
|
+
agentVersion: z24.string().optional(),
|
|
3050
3185
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
3051
3186
|
// Continue session
|
|
3052
|
-
sessionId:
|
|
3187
|
+
sessionId: z24.string().optional(),
|
|
3053
3188
|
// Resume from checkpoint
|
|
3054
|
-
checkpointId:
|
|
3189
|
+
checkpointId: z24.string().optional(),
|
|
3055
3190
|
// Required
|
|
3056
|
-
prompt:
|
|
3191
|
+
prompt: z24.string().min(1, "Prompt is required"),
|
|
3057
3192
|
// Optional configuration
|
|
3058
|
-
variables:
|
|
3059
|
-
secrets:
|
|
3060
|
-
artifactName:
|
|
3193
|
+
variables: z24.record(z24.string(), z24.string()).optional(),
|
|
3194
|
+
secrets: z24.record(z24.string(), z24.string()).optional(),
|
|
3195
|
+
artifactName: z24.string().optional(),
|
|
3061
3196
|
// Artifact name to mount
|
|
3062
|
-
artifactVersion:
|
|
3197
|
+
artifactVersion: z24.string().optional(),
|
|
3063
3198
|
// Artifact version (defaults to latest)
|
|
3064
|
-
volumes:
|
|
3199
|
+
volumes: z24.record(z24.string(), z24.string()).optional()
|
|
3065
3200
|
// volume_name -> version
|
|
3066
3201
|
});
|
|
3067
3202
|
var runListQuerySchema = listQuerySchema.extend({
|
|
3068
3203
|
status: publicRunStatusSchema.optional()
|
|
3069
3204
|
});
|
|
3070
|
-
var publicRunsListContract =
|
|
3205
|
+
var publicRunsListContract = c20.router({
|
|
3071
3206
|
list: {
|
|
3072
3207
|
method: "GET",
|
|
3073
3208
|
path: "/v1/runs",
|
|
@@ -3099,13 +3234,13 @@ var publicRunsListContract = c19.router({
|
|
|
3099
3234
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
3100
3235
|
}
|
|
3101
3236
|
});
|
|
3102
|
-
var publicRunByIdContract =
|
|
3237
|
+
var publicRunByIdContract = c20.router({
|
|
3103
3238
|
get: {
|
|
3104
3239
|
method: "GET",
|
|
3105
3240
|
path: "/v1/runs/:id",
|
|
3106
3241
|
headers: authHeadersSchema,
|
|
3107
|
-
pathParams:
|
|
3108
|
-
id:
|
|
3242
|
+
pathParams: z24.object({
|
|
3243
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3109
3244
|
}),
|
|
3110
3245
|
responses: {
|
|
3111
3246
|
200: publicRunDetailSchema,
|
|
@@ -3117,15 +3252,15 @@ var publicRunByIdContract = c19.router({
|
|
|
3117
3252
|
description: "Get run details by ID"
|
|
3118
3253
|
}
|
|
3119
3254
|
});
|
|
3120
|
-
var publicRunCancelContract =
|
|
3255
|
+
var publicRunCancelContract = c20.router({
|
|
3121
3256
|
cancel: {
|
|
3122
3257
|
method: "POST",
|
|
3123
3258
|
path: "/v1/runs/:id/cancel",
|
|
3124
3259
|
headers: authHeadersSchema,
|
|
3125
|
-
pathParams:
|
|
3126
|
-
id:
|
|
3260
|
+
pathParams: z24.object({
|
|
3261
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3127
3262
|
}),
|
|
3128
|
-
body:
|
|
3263
|
+
body: z24.undefined(),
|
|
3129
3264
|
responses: {
|
|
3130
3265
|
200: publicRunDetailSchema,
|
|
3131
3266
|
400: publicApiErrorSchema,
|
|
@@ -3138,27 +3273,27 @@ var publicRunCancelContract = c19.router({
|
|
|
3138
3273
|
description: "Cancel a pending or running execution"
|
|
3139
3274
|
}
|
|
3140
3275
|
});
|
|
3141
|
-
var logEntrySchema =
|
|
3276
|
+
var logEntrySchema = z24.object({
|
|
3142
3277
|
timestamp: timestampSchema,
|
|
3143
|
-
type:
|
|
3144
|
-
level:
|
|
3145
|
-
message:
|
|
3146
|
-
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()
|
|
3147
3282
|
});
|
|
3148
3283
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
3149
3284
|
var logsQuerySchema = listQuerySchema.extend({
|
|
3150
|
-
type:
|
|
3285
|
+
type: z24.enum(["agent", "system", "network", "all"]).default("all"),
|
|
3151
3286
|
since: timestampSchema.optional(),
|
|
3152
3287
|
until: timestampSchema.optional(),
|
|
3153
|
-
order:
|
|
3288
|
+
order: z24.enum(["asc", "desc"]).default("asc")
|
|
3154
3289
|
});
|
|
3155
|
-
var publicRunLogsContract =
|
|
3290
|
+
var publicRunLogsContract = c20.router({
|
|
3156
3291
|
getLogs: {
|
|
3157
3292
|
method: "GET",
|
|
3158
3293
|
path: "/v1/runs/:id/logs",
|
|
3159
3294
|
headers: authHeadersSchema,
|
|
3160
|
-
pathParams:
|
|
3161
|
-
id:
|
|
3295
|
+
pathParams: z24.object({
|
|
3296
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3162
3297
|
}),
|
|
3163
3298
|
query: logsQuerySchema,
|
|
3164
3299
|
responses: {
|
|
@@ -3171,30 +3306,30 @@ var publicRunLogsContract = c19.router({
|
|
|
3171
3306
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
3172
3307
|
}
|
|
3173
3308
|
});
|
|
3174
|
-
var metricPointSchema =
|
|
3309
|
+
var metricPointSchema = z24.object({
|
|
3175
3310
|
timestamp: timestampSchema,
|
|
3176
|
-
cpuPercent:
|
|
3177
|
-
memoryUsedMb:
|
|
3178
|
-
memoryTotalMb:
|
|
3179
|
-
diskUsedMb:
|
|
3180
|
-
diskTotalMb:
|
|
3181
|
-
});
|
|
3182
|
-
var metricsSummarySchema =
|
|
3183
|
-
avgCpuPercent:
|
|
3184
|
-
maxMemoryUsedMb:
|
|
3185
|
-
totalDurationMs:
|
|
3186
|
-
});
|
|
3187
|
-
var metricsResponseSchema2 =
|
|
3188
|
-
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),
|
|
3189
3324
|
summary: metricsSummarySchema
|
|
3190
3325
|
});
|
|
3191
|
-
var publicRunMetricsContract =
|
|
3326
|
+
var publicRunMetricsContract = c20.router({
|
|
3192
3327
|
getMetrics: {
|
|
3193
3328
|
method: "GET",
|
|
3194
3329
|
path: "/v1/runs/:id/metrics",
|
|
3195
3330
|
headers: authHeadersSchema,
|
|
3196
|
-
pathParams:
|
|
3197
|
-
id:
|
|
3331
|
+
pathParams: z24.object({
|
|
3332
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3198
3333
|
}),
|
|
3199
3334
|
responses: {
|
|
3200
3335
|
200: metricsResponseSchema2,
|
|
@@ -3206,7 +3341,7 @@ var publicRunMetricsContract = c19.router({
|
|
|
3206
3341
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
3207
3342
|
}
|
|
3208
3343
|
});
|
|
3209
|
-
var sseEventTypeSchema =
|
|
3344
|
+
var sseEventTypeSchema = z24.enum([
|
|
3210
3345
|
"status",
|
|
3211
3346
|
// Run status change
|
|
3212
3347
|
"output",
|
|
@@ -3218,26 +3353,26 @@ var sseEventTypeSchema = z23.enum([
|
|
|
3218
3353
|
"heartbeat"
|
|
3219
3354
|
// Keep-alive
|
|
3220
3355
|
]);
|
|
3221
|
-
var sseEventSchema =
|
|
3356
|
+
var sseEventSchema = z24.object({
|
|
3222
3357
|
event: sseEventTypeSchema,
|
|
3223
|
-
data:
|
|
3224
|
-
id:
|
|
3358
|
+
data: z24.unknown(),
|
|
3359
|
+
id: z24.string().optional()
|
|
3225
3360
|
// For Last-Event-ID reconnection
|
|
3226
3361
|
});
|
|
3227
|
-
var publicRunEventsContract =
|
|
3362
|
+
var publicRunEventsContract = c20.router({
|
|
3228
3363
|
streamEvents: {
|
|
3229
3364
|
method: "GET",
|
|
3230
3365
|
path: "/v1/runs/:id/events",
|
|
3231
3366
|
headers: authHeadersSchema,
|
|
3232
|
-
pathParams:
|
|
3233
|
-
id:
|
|
3367
|
+
pathParams: z24.object({
|
|
3368
|
+
id: z24.string().min(1, "Run ID is required")
|
|
3234
3369
|
}),
|
|
3235
|
-
query:
|
|
3236
|
-
lastEventId:
|
|
3370
|
+
query: z24.object({
|
|
3371
|
+
lastEventId: z24.string().optional()
|
|
3237
3372
|
// For reconnection
|
|
3238
3373
|
}),
|
|
3239
3374
|
responses: {
|
|
3240
|
-
200:
|
|
3375
|
+
200: z24.any(),
|
|
3241
3376
|
// SSE stream - actual content is text/event-stream
|
|
3242
3377
|
401: publicApiErrorSchema,
|
|
3243
3378
|
404: publicApiErrorSchema,
|
|
@@ -3249,28 +3384,28 @@ var publicRunEventsContract = c19.router({
|
|
|
3249
3384
|
});
|
|
3250
3385
|
|
|
3251
3386
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
3252
|
-
import { z as
|
|
3253
|
-
var
|
|
3254
|
-
var publicArtifactSchema =
|
|
3255
|
-
id:
|
|
3256
|
-
name:
|
|
3257
|
-
currentVersionId:
|
|
3258
|
-
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(),
|
|
3259
3394
|
// Total size in bytes
|
|
3260
|
-
fileCount:
|
|
3395
|
+
fileCount: z25.number(),
|
|
3261
3396
|
createdAt: timestampSchema,
|
|
3262
3397
|
updatedAt: timestampSchema
|
|
3263
3398
|
});
|
|
3264
|
-
var artifactVersionSchema =
|
|
3265
|
-
id:
|
|
3399
|
+
var artifactVersionSchema = z25.object({
|
|
3400
|
+
id: z25.string(),
|
|
3266
3401
|
// SHA-256 content hash
|
|
3267
|
-
artifactId:
|
|
3268
|
-
size:
|
|
3402
|
+
artifactId: z25.string(),
|
|
3403
|
+
size: z25.number(),
|
|
3269
3404
|
// Size in bytes
|
|
3270
|
-
fileCount:
|
|
3271
|
-
message:
|
|
3405
|
+
fileCount: z25.number(),
|
|
3406
|
+
message: z25.string().nullable(),
|
|
3272
3407
|
// Optional commit message
|
|
3273
|
-
createdBy:
|
|
3408
|
+
createdBy: z25.string(),
|
|
3274
3409
|
createdAt: timestampSchema
|
|
3275
3410
|
});
|
|
3276
3411
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -3280,7 +3415,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
3280
3415
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
3281
3416
|
artifactVersionSchema
|
|
3282
3417
|
);
|
|
3283
|
-
var publicArtifactsListContract =
|
|
3418
|
+
var publicArtifactsListContract = c21.router({
|
|
3284
3419
|
list: {
|
|
3285
3420
|
method: "GET",
|
|
3286
3421
|
path: "/v1/artifacts",
|
|
@@ -3295,13 +3430,13 @@ var publicArtifactsListContract = c20.router({
|
|
|
3295
3430
|
description: "List all artifacts in the current scope with pagination"
|
|
3296
3431
|
}
|
|
3297
3432
|
});
|
|
3298
|
-
var publicArtifactByIdContract =
|
|
3433
|
+
var publicArtifactByIdContract = c21.router({
|
|
3299
3434
|
get: {
|
|
3300
3435
|
method: "GET",
|
|
3301
3436
|
path: "/v1/artifacts/:id",
|
|
3302
3437
|
headers: authHeadersSchema,
|
|
3303
|
-
pathParams:
|
|
3304
|
-
id:
|
|
3438
|
+
pathParams: z25.object({
|
|
3439
|
+
id: z25.string().min(1, "Artifact ID is required")
|
|
3305
3440
|
}),
|
|
3306
3441
|
responses: {
|
|
3307
3442
|
200: publicArtifactDetailSchema,
|
|
@@ -3313,13 +3448,13 @@ var publicArtifactByIdContract = c20.router({
|
|
|
3313
3448
|
description: "Get artifact details by ID"
|
|
3314
3449
|
}
|
|
3315
3450
|
});
|
|
3316
|
-
var publicArtifactVersionsContract =
|
|
3451
|
+
var publicArtifactVersionsContract = c21.router({
|
|
3317
3452
|
list: {
|
|
3318
3453
|
method: "GET",
|
|
3319
3454
|
path: "/v1/artifacts/:id/versions",
|
|
3320
3455
|
headers: authHeadersSchema,
|
|
3321
|
-
pathParams:
|
|
3322
|
-
id:
|
|
3456
|
+
pathParams: z25.object({
|
|
3457
|
+
id: z25.string().min(1, "Artifact ID is required")
|
|
3323
3458
|
}),
|
|
3324
3459
|
query: listQuerySchema,
|
|
3325
3460
|
responses: {
|
|
@@ -3332,20 +3467,20 @@ var publicArtifactVersionsContract = c20.router({
|
|
|
3332
3467
|
description: "List all versions of an artifact with pagination"
|
|
3333
3468
|
}
|
|
3334
3469
|
});
|
|
3335
|
-
var publicArtifactDownloadContract =
|
|
3470
|
+
var publicArtifactDownloadContract = c21.router({
|
|
3336
3471
|
download: {
|
|
3337
3472
|
method: "GET",
|
|
3338
3473
|
path: "/v1/artifacts/:id/download",
|
|
3339
3474
|
headers: authHeadersSchema,
|
|
3340
|
-
pathParams:
|
|
3341
|
-
id:
|
|
3475
|
+
pathParams: z25.object({
|
|
3476
|
+
id: z25.string().min(1, "Artifact ID is required")
|
|
3342
3477
|
}),
|
|
3343
|
-
query:
|
|
3344
|
-
versionId:
|
|
3478
|
+
query: z25.object({
|
|
3479
|
+
versionId: z25.string().optional()
|
|
3345
3480
|
// Defaults to current version
|
|
3346
3481
|
}),
|
|
3347
3482
|
responses: {
|
|
3348
|
-
302:
|
|
3483
|
+
302: z25.undefined(),
|
|
3349
3484
|
// Redirect to presigned URL
|
|
3350
3485
|
401: publicApiErrorSchema,
|
|
3351
3486
|
404: publicApiErrorSchema,
|
|
@@ -3357,28 +3492,28 @@ var publicArtifactDownloadContract = c20.router({
|
|
|
3357
3492
|
});
|
|
3358
3493
|
|
|
3359
3494
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
3360
|
-
import { z as
|
|
3361
|
-
var
|
|
3362
|
-
var publicVolumeSchema =
|
|
3363
|
-
id:
|
|
3364
|
-
name:
|
|
3365
|
-
currentVersionId:
|
|
3366
|
-
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(),
|
|
3367
3502
|
// Total size in bytes
|
|
3368
|
-
fileCount:
|
|
3503
|
+
fileCount: z26.number(),
|
|
3369
3504
|
createdAt: timestampSchema,
|
|
3370
3505
|
updatedAt: timestampSchema
|
|
3371
3506
|
});
|
|
3372
|
-
var volumeVersionSchema =
|
|
3373
|
-
id:
|
|
3507
|
+
var volumeVersionSchema = z26.object({
|
|
3508
|
+
id: z26.string(),
|
|
3374
3509
|
// SHA-256 content hash
|
|
3375
|
-
volumeId:
|
|
3376
|
-
size:
|
|
3510
|
+
volumeId: z26.string(),
|
|
3511
|
+
size: z26.number(),
|
|
3377
3512
|
// Size in bytes
|
|
3378
|
-
fileCount:
|
|
3379
|
-
message:
|
|
3513
|
+
fileCount: z26.number(),
|
|
3514
|
+
message: z26.string().nullable(),
|
|
3380
3515
|
// Optional commit message
|
|
3381
|
-
createdBy:
|
|
3516
|
+
createdBy: z26.string(),
|
|
3382
3517
|
createdAt: timestampSchema
|
|
3383
3518
|
});
|
|
3384
3519
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -3386,7 +3521,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
3386
3521
|
});
|
|
3387
3522
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
3388
3523
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
3389
|
-
var publicVolumesListContract =
|
|
3524
|
+
var publicVolumesListContract = c22.router({
|
|
3390
3525
|
list: {
|
|
3391
3526
|
method: "GET",
|
|
3392
3527
|
path: "/v1/volumes",
|
|
@@ -3401,13 +3536,13 @@ var publicVolumesListContract = c21.router({
|
|
|
3401
3536
|
description: "List all volumes in the current scope with pagination"
|
|
3402
3537
|
}
|
|
3403
3538
|
});
|
|
3404
|
-
var publicVolumeByIdContract =
|
|
3539
|
+
var publicVolumeByIdContract = c22.router({
|
|
3405
3540
|
get: {
|
|
3406
3541
|
method: "GET",
|
|
3407
3542
|
path: "/v1/volumes/:id",
|
|
3408
3543
|
headers: authHeadersSchema,
|
|
3409
|
-
pathParams:
|
|
3410
|
-
id:
|
|
3544
|
+
pathParams: z26.object({
|
|
3545
|
+
id: z26.string().min(1, "Volume ID is required")
|
|
3411
3546
|
}),
|
|
3412
3547
|
responses: {
|
|
3413
3548
|
200: publicVolumeDetailSchema,
|
|
@@ -3419,13 +3554,13 @@ var publicVolumeByIdContract = c21.router({
|
|
|
3419
3554
|
description: "Get volume details by ID"
|
|
3420
3555
|
}
|
|
3421
3556
|
});
|
|
3422
|
-
var publicVolumeVersionsContract =
|
|
3557
|
+
var publicVolumeVersionsContract = c22.router({
|
|
3423
3558
|
list: {
|
|
3424
3559
|
method: "GET",
|
|
3425
3560
|
path: "/v1/volumes/:id/versions",
|
|
3426
3561
|
headers: authHeadersSchema,
|
|
3427
|
-
pathParams:
|
|
3428
|
-
id:
|
|
3562
|
+
pathParams: z26.object({
|
|
3563
|
+
id: z26.string().min(1, "Volume ID is required")
|
|
3429
3564
|
}),
|
|
3430
3565
|
query: listQuerySchema,
|
|
3431
3566
|
responses: {
|
|
@@ -3438,20 +3573,20 @@ var publicVolumeVersionsContract = c21.router({
|
|
|
3438
3573
|
description: "List all versions of a volume with pagination"
|
|
3439
3574
|
}
|
|
3440
3575
|
});
|
|
3441
|
-
var publicVolumeDownloadContract =
|
|
3576
|
+
var publicVolumeDownloadContract = c22.router({
|
|
3442
3577
|
download: {
|
|
3443
3578
|
method: "GET",
|
|
3444
3579
|
path: "/v1/volumes/:id/download",
|
|
3445
3580
|
headers: authHeadersSchema,
|
|
3446
|
-
pathParams:
|
|
3447
|
-
id:
|
|
3581
|
+
pathParams: z26.object({
|
|
3582
|
+
id: z26.string().min(1, "Volume ID is required")
|
|
3448
3583
|
}),
|
|
3449
|
-
query:
|
|
3450
|
-
versionId:
|
|
3584
|
+
query: z26.object({
|
|
3585
|
+
versionId: z26.string().optional()
|
|
3451
3586
|
// Defaults to current version
|
|
3452
3587
|
}),
|
|
3453
3588
|
responses: {
|
|
3454
|
-
302:
|
|
3589
|
+
302: z26.undefined(),
|
|
3455
3590
|
// Redirect to presigned URL
|
|
3456
3591
|
401: publicApiErrorSchema,
|
|
3457
3592
|
404: publicApiErrorSchema,
|
|
@@ -3926,54 +4061,97 @@ async function listScheduleRuns(params) {
|
|
|
3926
4061
|
handleError(result, `Failed to list runs for schedule "${params.name}"`);
|
|
3927
4062
|
}
|
|
3928
4063
|
|
|
3929
|
-
// src/lib/api/domains/
|
|
4064
|
+
// src/lib/api/domains/secrets.ts
|
|
3930
4065
|
import { initClient as initClient7 } from "@ts-rest/core";
|
|
3931
|
-
async function
|
|
4066
|
+
async function listSecrets() {
|
|
3932
4067
|
const config = await getClientConfig();
|
|
3933
|
-
const client = initClient7(
|
|
4068
|
+
const client = initClient7(secretsMainContract, config);
|
|
3934
4069
|
const result = await client.list({ headers: {} });
|
|
3935
4070
|
if (result.status === 200) {
|
|
3936
4071
|
return result.body;
|
|
3937
4072
|
}
|
|
3938
|
-
handleError(result, "Failed to list
|
|
4073
|
+
handleError(result, "Failed to list secrets");
|
|
3939
4074
|
}
|
|
3940
|
-
async function
|
|
4075
|
+
async function getSecret(name) {
|
|
3941
4076
|
const config = await getClientConfig();
|
|
3942
|
-
const client = initClient7(
|
|
4077
|
+
const client = initClient7(secretsByNameContract, config);
|
|
3943
4078
|
const result = await client.get({
|
|
3944
4079
|
params: { name }
|
|
3945
4080
|
});
|
|
3946
4081
|
if (result.status === 200) {
|
|
3947
4082
|
return result.body;
|
|
3948
4083
|
}
|
|
3949
|
-
handleError(result, `
|
|
4084
|
+
handleError(result, `Secret "${name}" not found`);
|
|
3950
4085
|
}
|
|
3951
|
-
async function
|
|
4086
|
+
async function setSecret(body) {
|
|
3952
4087
|
const config = await getClientConfig();
|
|
3953
|
-
const client = initClient7(
|
|
4088
|
+
const client = initClient7(secretsMainContract, config);
|
|
3954
4089
|
const result = await client.set({ body });
|
|
3955
4090
|
if (result.status === 200 || result.status === 201) {
|
|
3956
4091
|
return result.body;
|
|
3957
4092
|
}
|
|
3958
|
-
handleError(result, "Failed to set
|
|
4093
|
+
handleError(result, "Failed to set secret");
|
|
3959
4094
|
}
|
|
3960
|
-
async function
|
|
4095
|
+
async function deleteSecret(name) {
|
|
3961
4096
|
const config = await getClientConfig();
|
|
3962
|
-
const client = initClient7(
|
|
4097
|
+
const client = initClient7(secretsByNameContract, config);
|
|
3963
4098
|
const result = await client.delete({
|
|
3964
4099
|
params: { name }
|
|
3965
4100
|
});
|
|
3966
4101
|
if (result.status === 204) {
|
|
3967
4102
|
return;
|
|
3968
4103
|
}
|
|
3969
|
-
handleError(result, `
|
|
4104
|
+
handleError(result, `Secret "${name}" not found`);
|
|
3970
4105
|
}
|
|
3971
4106
|
|
|
3972
|
-
// src/lib/api/domains/
|
|
4107
|
+
// src/lib/api/domains/variables.ts
|
|
3973
4108
|
import { initClient as initClient8 } from "@ts-rest/core";
|
|
4109
|
+
async function listVariables() {
|
|
4110
|
+
const config = await getClientConfig();
|
|
4111
|
+
const client = initClient8(variablesMainContract, config);
|
|
4112
|
+
const result = await client.list({ headers: {} });
|
|
4113
|
+
if (result.status === 200) {
|
|
4114
|
+
return result.body;
|
|
4115
|
+
}
|
|
4116
|
+
handleError(result, "Failed to list variables");
|
|
4117
|
+
}
|
|
4118
|
+
async function getVariable(name) {
|
|
4119
|
+
const config = await getClientConfig();
|
|
4120
|
+
const client = initClient8(variablesByNameContract, config);
|
|
4121
|
+
const result = await client.get({
|
|
4122
|
+
params: { name }
|
|
4123
|
+
});
|
|
4124
|
+
if (result.status === 200) {
|
|
4125
|
+
return result.body;
|
|
4126
|
+
}
|
|
4127
|
+
handleError(result, `Variable "${name}" not found`);
|
|
4128
|
+
}
|
|
4129
|
+
async function setVariable(body) {
|
|
4130
|
+
const config = await getClientConfig();
|
|
4131
|
+
const client = initClient8(variablesMainContract, config);
|
|
4132
|
+
const result = await client.set({ body });
|
|
4133
|
+
if (result.status === 200 || result.status === 201) {
|
|
4134
|
+
return result.body;
|
|
4135
|
+
}
|
|
4136
|
+
handleError(result, "Failed to set variable");
|
|
4137
|
+
}
|
|
4138
|
+
async function deleteVariable(name) {
|
|
4139
|
+
const config = await getClientConfig();
|
|
4140
|
+
const client = initClient8(variablesByNameContract, config);
|
|
4141
|
+
const result = await client.delete({
|
|
4142
|
+
params: { name }
|
|
4143
|
+
});
|
|
4144
|
+
if (result.status === 204) {
|
|
4145
|
+
return;
|
|
4146
|
+
}
|
|
4147
|
+
handleError(result, `Variable "${name}" not found`);
|
|
4148
|
+
}
|
|
4149
|
+
|
|
4150
|
+
// src/lib/api/domains/model-providers.ts
|
|
4151
|
+
import { initClient as initClient9 } from "@ts-rest/core";
|
|
3974
4152
|
async function listModelProviders() {
|
|
3975
4153
|
const config = await getClientConfig();
|
|
3976
|
-
const client =
|
|
4154
|
+
const client = initClient9(modelProvidersMainContract, config);
|
|
3977
4155
|
const result = await client.list({ headers: {} });
|
|
3978
4156
|
if (result.status === 200) {
|
|
3979
4157
|
return result.body;
|
|
@@ -3982,7 +4160,7 @@ async function listModelProviders() {
|
|
|
3982
4160
|
}
|
|
3983
4161
|
async function upsertModelProvider(body) {
|
|
3984
4162
|
const config = await getClientConfig();
|
|
3985
|
-
const client =
|
|
4163
|
+
const client = initClient9(modelProvidersMainContract, config);
|
|
3986
4164
|
const result = await client.upsert({ body });
|
|
3987
4165
|
if (result.status === 200 || result.status === 201) {
|
|
3988
4166
|
return result.body;
|
|
@@ -3991,7 +4169,7 @@ async function upsertModelProvider(body) {
|
|
|
3991
4169
|
}
|
|
3992
4170
|
async function checkModelProviderCredential(type) {
|
|
3993
4171
|
const config = await getClientConfig();
|
|
3994
|
-
const client =
|
|
4172
|
+
const client = initClient9(modelProvidersCheckContract, config);
|
|
3995
4173
|
const result = await client.check({
|
|
3996
4174
|
params: { type }
|
|
3997
4175
|
});
|
|
@@ -4002,7 +4180,7 @@ async function checkModelProviderCredential(type) {
|
|
|
4002
4180
|
}
|
|
4003
4181
|
async function deleteModelProvider(type) {
|
|
4004
4182
|
const config = await getClientConfig();
|
|
4005
|
-
const client =
|
|
4183
|
+
const client = initClient9(modelProvidersByTypeContract, config);
|
|
4006
4184
|
const result = await client.delete({
|
|
4007
4185
|
params: { type }
|
|
4008
4186
|
});
|
|
@@ -4013,7 +4191,7 @@ async function deleteModelProvider(type) {
|
|
|
4013
4191
|
}
|
|
4014
4192
|
async function convertModelProviderCredential(type) {
|
|
4015
4193
|
const config = await getClientConfig();
|
|
4016
|
-
const client =
|
|
4194
|
+
const client = initClient9(modelProvidersConvertContract, config);
|
|
4017
4195
|
const result = await client.convert({
|
|
4018
4196
|
params: { type }
|
|
4019
4197
|
});
|
|
@@ -4024,7 +4202,7 @@ async function convertModelProviderCredential(type) {
|
|
|
4024
4202
|
}
|
|
4025
4203
|
async function setModelProviderDefault(type) {
|
|
4026
4204
|
const config = await getClientConfig();
|
|
4027
|
-
const client =
|
|
4205
|
+
const client = initClient9(modelProvidersSetDefaultContract, config);
|
|
4028
4206
|
const result = await client.setDefault({
|
|
4029
4207
|
params: { type }
|
|
4030
4208
|
});
|
|
@@ -4035,7 +4213,7 @@ async function setModelProviderDefault(type) {
|
|
|
4035
4213
|
}
|
|
4036
4214
|
async function updateModelProviderModel(type, selectedModel) {
|
|
4037
4215
|
const config = await getClientConfig();
|
|
4038
|
-
const client =
|
|
4216
|
+
const client = initClient9(modelProvidersUpdateModelContract, config);
|
|
4039
4217
|
const result = await client.updateModel({
|
|
4040
4218
|
params: { type },
|
|
4041
4219
|
body: { selectedModel }
|
|
@@ -4066,8 +4244,8 @@ async function getUsage(options) {
|
|
|
4066
4244
|
}
|
|
4067
4245
|
|
|
4068
4246
|
// src/lib/domain/yaml-validator.ts
|
|
4069
|
-
import { z as
|
|
4070
|
-
var cliAgentNameSchema =
|
|
4247
|
+
import { z as z27 } from "zod";
|
|
4248
|
+
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(
|
|
4071
4249
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
4072
4250
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
4073
4251
|
);
|
|
@@ -4082,7 +4260,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4082
4260
|
const skillUrl = agent.skills[i];
|
|
4083
4261
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
4084
4262
|
ctx.addIssue({
|
|
4085
|
-
code:
|
|
4263
|
+
code: z27.ZodIssueCode.custom,
|
|
4086
4264
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
4087
4265
|
path: ["skills", i]
|
|
4088
4266
|
});
|
|
@@ -4091,15 +4269,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
4091
4269
|
}
|
|
4092
4270
|
}
|
|
4093
4271
|
);
|
|
4094
|
-
var cliComposeSchema =
|
|
4095
|
-
version:
|
|
4096
|
-
agents:
|
|
4097
|
-
volumes:
|
|
4272
|
+
var cliComposeSchema = z27.object({
|
|
4273
|
+
version: z27.string().min(1, "Missing config.version"),
|
|
4274
|
+
agents: z27.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
4275
|
+
volumes: z27.record(z27.string(), volumeConfigSchema).optional()
|
|
4098
4276
|
}).superRefine((config, ctx) => {
|
|
4099
4277
|
const agentKeys = Object.keys(config.agents);
|
|
4100
4278
|
if (agentKeys.length === 0) {
|
|
4101
4279
|
ctx.addIssue({
|
|
4102
|
-
code:
|
|
4280
|
+
code: z27.ZodIssueCode.custom,
|
|
4103
4281
|
message: "agents must have at least one agent defined",
|
|
4104
4282
|
path: ["agents"]
|
|
4105
4283
|
});
|
|
@@ -4107,7 +4285,7 @@ var cliComposeSchema = z26.object({
|
|
|
4107
4285
|
}
|
|
4108
4286
|
if (agentKeys.length > 1) {
|
|
4109
4287
|
ctx.addIssue({
|
|
4110
|
-
code:
|
|
4288
|
+
code: z27.ZodIssueCode.custom,
|
|
4111
4289
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
4112
4290
|
path: ["agents"]
|
|
4113
4291
|
});
|
|
@@ -4119,7 +4297,7 @@ var cliComposeSchema = z26.object({
|
|
|
4119
4297
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
4120
4298
|
if (!config.volumes) {
|
|
4121
4299
|
ctx.addIssue({
|
|
4122
|
-
code:
|
|
4300
|
+
code: z27.ZodIssueCode.custom,
|
|
4123
4301
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
4124
4302
|
path: ["volumes"]
|
|
4125
4303
|
});
|
|
@@ -4129,7 +4307,7 @@ var cliComposeSchema = z26.object({
|
|
|
4129
4307
|
const parts = volDeclaration.split(":");
|
|
4130
4308
|
if (parts.length !== 2) {
|
|
4131
4309
|
ctx.addIssue({
|
|
4132
|
-
code:
|
|
4310
|
+
code: z27.ZodIssueCode.custom,
|
|
4133
4311
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
4134
4312
|
path: ["agents", agentName, "volumes"]
|
|
4135
4313
|
});
|
|
@@ -4138,7 +4316,7 @@ var cliComposeSchema = z26.object({
|
|
|
4138
4316
|
const volumeKey = parts[0].trim();
|
|
4139
4317
|
if (!config.volumes[volumeKey]) {
|
|
4140
4318
|
ctx.addIssue({
|
|
4141
|
-
code:
|
|
4319
|
+
code: z27.ZodIssueCode.custom,
|
|
4142
4320
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
4143
4321
|
path: ["volumes", volumeKey]
|
|
4144
4322
|
});
|
|
@@ -4349,6 +4527,17 @@ import * as tar2 from "tar";
|
|
|
4349
4527
|
import * as fs2 from "fs";
|
|
4350
4528
|
import * as path2 from "path";
|
|
4351
4529
|
import * as tar from "tar";
|
|
4530
|
+
function checkDirectoryStatus(dirPath) {
|
|
4531
|
+
if (!fs2.existsSync(dirPath)) {
|
|
4532
|
+
return { exists: false, empty: true };
|
|
4533
|
+
}
|
|
4534
|
+
const stat = fs2.statSync(dirPath);
|
|
4535
|
+
if (!stat.isDirectory()) {
|
|
4536
|
+
return { exists: true, empty: false };
|
|
4537
|
+
}
|
|
4538
|
+
const entries = fs2.readdirSync(dirPath);
|
|
4539
|
+
return { exists: true, empty: entries.length === 0 };
|
|
4540
|
+
}
|
|
4352
4541
|
function formatBytes(bytes) {
|
|
4353
4542
|
if (bytes === 0) return "0 B";
|
|
4354
4543
|
const k = 1024;
|
|
@@ -4961,7 +5150,7 @@ function getSecretsFromComposeContent(content) {
|
|
|
4961
5150
|
return new Set(grouped.secrets.map((r) => r.name));
|
|
4962
5151
|
}
|
|
4963
5152
|
async function loadAndValidateConfig(configFile) {
|
|
4964
|
-
if (!
|
|
5153
|
+
if (!existsSync4(configFile)) {
|
|
4965
5154
|
console.error(chalk4.red(`\u2717 Config file not found: ${configFile}`));
|
|
4966
5155
|
process.exit(1);
|
|
4967
5156
|
}
|
|
@@ -5177,7 +5366,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
5177
5366
|
)
|
|
5178
5367
|
);
|
|
5179
5368
|
if (options.autoUpdate !== false) {
|
|
5180
|
-
await silentUpgradeAfterCommand("9.
|
|
5369
|
+
await silentUpgradeAfterCommand("9.18.0");
|
|
5181
5370
|
}
|
|
5182
5371
|
} catch (error) {
|
|
5183
5372
|
if (error instanceof Error) {
|
|
@@ -5932,9 +6121,9 @@ var CodexEventParser = class {
|
|
|
5932
6121
|
}
|
|
5933
6122
|
}
|
|
5934
6123
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
5935
|
-
const changes = item.changes.map((
|
|
5936
|
-
const action =
|
|
5937
|
-
return `${action}: ${
|
|
6124
|
+
const changes = item.changes.map((c23) => {
|
|
6125
|
+
const action = c23.kind === "add" ? "Created" : c23.kind === "modify" ? "Modified" : "Deleted";
|
|
6126
|
+
return `${action}: ${c23.path}`;
|
|
5938
6127
|
}).join("\n");
|
|
5939
6128
|
return {
|
|
5940
6129
|
type: "text",
|
|
@@ -6088,9 +6277,9 @@ var CodexEventRenderer = class {
|
|
|
6088
6277
|
return;
|
|
6089
6278
|
}
|
|
6090
6279
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
6091
|
-
const summary = item.changes.map((
|
|
6092
|
-
const icon =
|
|
6093
|
-
return `${icon}${
|
|
6280
|
+
const summary = item.changes.map((c23) => {
|
|
6281
|
+
const icon = c23.kind === "add" ? "+" : c23.kind === "delete" ? "-" : "~";
|
|
6282
|
+
return `${icon}${c23.path}`;
|
|
6094
6283
|
}).join(", ");
|
|
6095
6284
|
console.log(chalk7.green("[files]") + ` ${summary}`);
|
|
6096
6285
|
return;
|
|
@@ -6111,7 +6300,7 @@ var CodexEventRenderer = class {
|
|
|
6111
6300
|
};
|
|
6112
6301
|
|
|
6113
6302
|
// src/lib/api/api-client.ts
|
|
6114
|
-
import { initClient as
|
|
6303
|
+
import { initClient as initClient10 } from "@ts-rest/core";
|
|
6115
6304
|
var ApiClient = class {
|
|
6116
6305
|
async getHeaders() {
|
|
6117
6306
|
const token = await getToken();
|
|
@@ -6137,7 +6326,7 @@ var ApiClient = class {
|
|
|
6137
6326
|
async getComposeByName(name, scope) {
|
|
6138
6327
|
const baseUrl = await this.getBaseUrl();
|
|
6139
6328
|
const headers = await this.getHeaders();
|
|
6140
|
-
const client =
|
|
6329
|
+
const client = initClient10(composesMainContract, {
|
|
6141
6330
|
baseUrl,
|
|
6142
6331
|
baseHeaders: headers,
|
|
6143
6332
|
jsonQuery: true
|
|
@@ -6158,7 +6347,7 @@ var ApiClient = class {
|
|
|
6158
6347
|
async getComposeById(id) {
|
|
6159
6348
|
const baseUrl = await this.getBaseUrl();
|
|
6160
6349
|
const headers = await this.getHeaders();
|
|
6161
|
-
const client =
|
|
6350
|
+
const client = initClient10(composesByIdContract, {
|
|
6162
6351
|
baseUrl,
|
|
6163
6352
|
baseHeaders: headers,
|
|
6164
6353
|
jsonQuery: true
|
|
@@ -6180,7 +6369,7 @@ var ApiClient = class {
|
|
|
6180
6369
|
async getComposeVersion(composeId, version) {
|
|
6181
6370
|
const baseUrl = await this.getBaseUrl();
|
|
6182
6371
|
const headers = await this.getHeaders();
|
|
6183
|
-
const client =
|
|
6372
|
+
const client = initClient10(composesVersionsContract, {
|
|
6184
6373
|
baseUrl,
|
|
6185
6374
|
baseHeaders: headers,
|
|
6186
6375
|
jsonQuery: true
|
|
@@ -6201,7 +6390,7 @@ var ApiClient = class {
|
|
|
6201
6390
|
async createOrUpdateCompose(body) {
|
|
6202
6391
|
const baseUrl = await this.getBaseUrl();
|
|
6203
6392
|
const headers = await this.getHeaders();
|
|
6204
|
-
const client =
|
|
6393
|
+
const client = initClient10(composesMainContract, {
|
|
6205
6394
|
baseUrl,
|
|
6206
6395
|
baseHeaders: headers,
|
|
6207
6396
|
jsonQuery: true
|
|
@@ -6224,7 +6413,7 @@ var ApiClient = class {
|
|
|
6224
6413
|
async createRun(body) {
|
|
6225
6414
|
const baseUrl = await this.getBaseUrl();
|
|
6226
6415
|
const headers = await this.getHeaders();
|
|
6227
|
-
const client =
|
|
6416
|
+
const client = initClient10(runsMainContract, {
|
|
6228
6417
|
baseUrl,
|
|
6229
6418
|
baseHeaders: headers,
|
|
6230
6419
|
jsonQuery: true
|
|
@@ -6240,7 +6429,7 @@ var ApiClient = class {
|
|
|
6240
6429
|
async getEvents(runId, options) {
|
|
6241
6430
|
const baseUrl = await this.getBaseUrl();
|
|
6242
6431
|
const headers = await this.getHeaders();
|
|
6243
|
-
const client =
|
|
6432
|
+
const client = initClient10(runEventsContract, {
|
|
6244
6433
|
baseUrl,
|
|
6245
6434
|
baseHeaders: headers,
|
|
6246
6435
|
jsonQuery: true
|
|
@@ -6262,7 +6451,7 @@ var ApiClient = class {
|
|
|
6262
6451
|
async getSystemLog(runId, options) {
|
|
6263
6452
|
const baseUrl = await this.getBaseUrl();
|
|
6264
6453
|
const headers = await this.getHeaders();
|
|
6265
|
-
const client =
|
|
6454
|
+
const client = initClient10(runSystemLogContract, {
|
|
6266
6455
|
baseUrl,
|
|
6267
6456
|
baseHeaders: headers,
|
|
6268
6457
|
jsonQuery: true
|
|
@@ -6285,7 +6474,7 @@ var ApiClient = class {
|
|
|
6285
6474
|
async getMetrics(runId, options) {
|
|
6286
6475
|
const baseUrl = await this.getBaseUrl();
|
|
6287
6476
|
const headers = await this.getHeaders();
|
|
6288
|
-
const client =
|
|
6477
|
+
const client = initClient10(runMetricsContract, {
|
|
6289
6478
|
baseUrl,
|
|
6290
6479
|
baseHeaders: headers,
|
|
6291
6480
|
jsonQuery: true
|
|
@@ -6308,7 +6497,7 @@ var ApiClient = class {
|
|
|
6308
6497
|
async getAgentEvents(runId, options) {
|
|
6309
6498
|
const baseUrl = await this.getBaseUrl();
|
|
6310
6499
|
const headers = await this.getHeaders();
|
|
6311
|
-
const client =
|
|
6500
|
+
const client = initClient10(runAgentEventsContract, {
|
|
6312
6501
|
baseUrl,
|
|
6313
6502
|
baseHeaders: headers,
|
|
6314
6503
|
jsonQuery: true
|
|
@@ -6331,7 +6520,7 @@ var ApiClient = class {
|
|
|
6331
6520
|
async getNetworkLogs(runId, options) {
|
|
6332
6521
|
const baseUrl = await this.getBaseUrl();
|
|
6333
6522
|
const headers = await this.getHeaders();
|
|
6334
|
-
const client =
|
|
6523
|
+
const client = initClient10(runNetworkLogsContract, {
|
|
6335
6524
|
baseUrl,
|
|
6336
6525
|
baseHeaders: headers,
|
|
6337
6526
|
jsonQuery: true
|
|
@@ -6357,7 +6546,7 @@ var ApiClient = class {
|
|
|
6357
6546
|
async getScope() {
|
|
6358
6547
|
const baseUrl = await this.getBaseUrl();
|
|
6359
6548
|
const headers = await this.getHeaders();
|
|
6360
|
-
const client =
|
|
6549
|
+
const client = initClient10(scopeContract, {
|
|
6361
6550
|
baseUrl,
|
|
6362
6551
|
baseHeaders: headers,
|
|
6363
6552
|
jsonQuery: true
|
|
@@ -6376,7 +6565,7 @@ var ApiClient = class {
|
|
|
6376
6565
|
async createScope(body) {
|
|
6377
6566
|
const baseUrl = await this.getBaseUrl();
|
|
6378
6567
|
const headers = await this.getHeaders();
|
|
6379
|
-
const client =
|
|
6568
|
+
const client = initClient10(scopeContract, {
|
|
6380
6569
|
baseUrl,
|
|
6381
6570
|
baseHeaders: headers,
|
|
6382
6571
|
jsonQuery: true
|
|
@@ -6395,7 +6584,7 @@ var ApiClient = class {
|
|
|
6395
6584
|
async updateScope(body) {
|
|
6396
6585
|
const baseUrl = await this.getBaseUrl();
|
|
6397
6586
|
const headers = await this.getHeaders();
|
|
6398
|
-
const client =
|
|
6587
|
+
const client = initClient10(scopeContract, {
|
|
6399
6588
|
baseUrl,
|
|
6400
6589
|
baseHeaders: headers,
|
|
6401
6590
|
jsonQuery: true
|
|
@@ -6415,7 +6604,7 @@ var ApiClient = class {
|
|
|
6415
6604
|
async getSession(sessionId) {
|
|
6416
6605
|
const baseUrl = await this.getBaseUrl();
|
|
6417
6606
|
const headers = await this.getHeaders();
|
|
6418
|
-
const client =
|
|
6607
|
+
const client = initClient10(sessionsByIdContract, {
|
|
6419
6608
|
baseUrl,
|
|
6420
6609
|
baseHeaders: headers,
|
|
6421
6610
|
jsonQuery: true
|
|
@@ -6437,7 +6626,7 @@ var ApiClient = class {
|
|
|
6437
6626
|
async getCheckpoint(checkpointId) {
|
|
6438
6627
|
const baseUrl = await this.getBaseUrl();
|
|
6439
6628
|
const headers = await this.getHeaders();
|
|
6440
|
-
const client =
|
|
6629
|
+
const client = initClient10(checkpointsByIdContract, {
|
|
6441
6630
|
baseUrl,
|
|
6442
6631
|
baseHeaders: headers,
|
|
6443
6632
|
jsonQuery: true
|
|
@@ -6458,7 +6647,7 @@ var ApiClient = class {
|
|
|
6458
6647
|
async prepareStorage(body) {
|
|
6459
6648
|
const baseUrl = await this.getBaseUrl();
|
|
6460
6649
|
const headers = await this.getHeaders();
|
|
6461
|
-
const client =
|
|
6650
|
+
const client = initClient10(storagesPrepareContract, {
|
|
6462
6651
|
baseUrl,
|
|
6463
6652
|
baseHeaders: headers,
|
|
6464
6653
|
jsonQuery: true
|
|
@@ -6477,7 +6666,7 @@ var ApiClient = class {
|
|
|
6477
6666
|
async commitStorage(body) {
|
|
6478
6667
|
const baseUrl = await this.getBaseUrl();
|
|
6479
6668
|
const headers = await this.getHeaders();
|
|
6480
|
-
const client =
|
|
6669
|
+
const client = initClient10(storagesCommitContract, {
|
|
6481
6670
|
baseUrl,
|
|
6482
6671
|
baseHeaders: headers,
|
|
6483
6672
|
jsonQuery: true
|
|
@@ -6496,7 +6685,7 @@ var ApiClient = class {
|
|
|
6496
6685
|
async getStorageDownload(query) {
|
|
6497
6686
|
const baseUrl = await this.getBaseUrl();
|
|
6498
6687
|
const headers = await this.getHeaders();
|
|
6499
|
-
const client =
|
|
6688
|
+
const client = initClient10(storagesDownloadContract, {
|
|
6500
6689
|
baseUrl,
|
|
6501
6690
|
baseHeaders: headers,
|
|
6502
6691
|
jsonQuery: true
|
|
@@ -6521,7 +6710,7 @@ var ApiClient = class {
|
|
|
6521
6710
|
async listStorages(query) {
|
|
6522
6711
|
const baseUrl = await this.getBaseUrl();
|
|
6523
6712
|
const headers = await this.getHeaders();
|
|
6524
|
-
const client =
|
|
6713
|
+
const client = initClient10(storagesListContract, {
|
|
6525
6714
|
baseUrl,
|
|
6526
6715
|
baseHeaders: headers,
|
|
6527
6716
|
jsonQuery: true
|
|
@@ -6540,7 +6729,7 @@ var ApiClient = class {
|
|
|
6540
6729
|
async deploySchedule(body) {
|
|
6541
6730
|
const baseUrl = await this.getBaseUrl();
|
|
6542
6731
|
const headers = await this.getHeaders();
|
|
6543
|
-
const client =
|
|
6732
|
+
const client = initClient10(schedulesMainContract, {
|
|
6544
6733
|
baseUrl,
|
|
6545
6734
|
baseHeaders: headers,
|
|
6546
6735
|
jsonQuery: true
|
|
@@ -6559,7 +6748,7 @@ var ApiClient = class {
|
|
|
6559
6748
|
async listSchedules() {
|
|
6560
6749
|
const baseUrl = await this.getBaseUrl();
|
|
6561
6750
|
const headers = await this.getHeaders();
|
|
6562
|
-
const client =
|
|
6751
|
+
const client = initClient10(schedulesMainContract, {
|
|
6563
6752
|
baseUrl,
|
|
6564
6753
|
baseHeaders: headers,
|
|
6565
6754
|
jsonQuery: true
|
|
@@ -6578,7 +6767,7 @@ var ApiClient = class {
|
|
|
6578
6767
|
async getScheduleByName(params) {
|
|
6579
6768
|
const baseUrl = await this.getBaseUrl();
|
|
6580
6769
|
const headers = await this.getHeaders();
|
|
6581
|
-
const client =
|
|
6770
|
+
const client = initClient10(schedulesByNameContract, {
|
|
6582
6771
|
baseUrl,
|
|
6583
6772
|
baseHeaders: headers,
|
|
6584
6773
|
jsonQuery: true
|
|
@@ -6600,7 +6789,7 @@ var ApiClient = class {
|
|
|
6600
6789
|
async deleteSchedule(params) {
|
|
6601
6790
|
const baseUrl = await this.getBaseUrl();
|
|
6602
6791
|
const headers = await this.getHeaders();
|
|
6603
|
-
const client =
|
|
6792
|
+
const client = initClient10(schedulesByNameContract, {
|
|
6604
6793
|
baseUrl,
|
|
6605
6794
|
baseHeaders: headers,
|
|
6606
6795
|
jsonQuery: true
|
|
@@ -6622,7 +6811,7 @@ var ApiClient = class {
|
|
|
6622
6811
|
async enableSchedule(params) {
|
|
6623
6812
|
const baseUrl = await this.getBaseUrl();
|
|
6624
6813
|
const headers = await this.getHeaders();
|
|
6625
|
-
const client =
|
|
6814
|
+
const client = initClient10(schedulesEnableContract, {
|
|
6626
6815
|
baseUrl,
|
|
6627
6816
|
baseHeaders: headers,
|
|
6628
6817
|
jsonQuery: true
|
|
@@ -6644,7 +6833,7 @@ var ApiClient = class {
|
|
|
6644
6833
|
async disableSchedule(params) {
|
|
6645
6834
|
const baseUrl = await this.getBaseUrl();
|
|
6646
6835
|
const headers = await this.getHeaders();
|
|
6647
|
-
const client =
|
|
6836
|
+
const client = initClient10(schedulesEnableContract, {
|
|
6648
6837
|
baseUrl,
|
|
6649
6838
|
baseHeaders: headers,
|
|
6650
6839
|
jsonQuery: true
|
|
@@ -6666,7 +6855,7 @@ var ApiClient = class {
|
|
|
6666
6855
|
async listScheduleRuns(params) {
|
|
6667
6856
|
const baseUrl = await this.getBaseUrl();
|
|
6668
6857
|
const headers = await this.getHeaders();
|
|
6669
|
-
const client =
|
|
6858
|
+
const client = initClient10(scheduleRunsContract, {
|
|
6670
6859
|
baseUrl,
|
|
6671
6860
|
baseHeaders: headers,
|
|
6672
6861
|
jsonQuery: true
|
|
@@ -6691,7 +6880,7 @@ var ApiClient = class {
|
|
|
6691
6880
|
async listPublicAgents(query) {
|
|
6692
6881
|
const baseUrl = await this.getBaseUrl();
|
|
6693
6882
|
const headers = await this.getHeaders();
|
|
6694
|
-
const client =
|
|
6883
|
+
const client = initClient10(publicAgentsListContract, {
|
|
6695
6884
|
baseUrl,
|
|
6696
6885
|
baseHeaders: headers,
|
|
6697
6886
|
jsonQuery: true
|
|
@@ -6710,7 +6899,7 @@ var ApiClient = class {
|
|
|
6710
6899
|
async listPublicArtifacts(query) {
|
|
6711
6900
|
const baseUrl = await this.getBaseUrl();
|
|
6712
6901
|
const headers = await this.getHeaders();
|
|
6713
|
-
const client =
|
|
6902
|
+
const client = initClient10(publicArtifactsListContract, {
|
|
6714
6903
|
baseUrl,
|
|
6715
6904
|
baseHeaders: headers,
|
|
6716
6905
|
jsonQuery: true
|
|
@@ -6729,7 +6918,7 @@ var ApiClient = class {
|
|
|
6729
6918
|
async getPublicArtifact(id) {
|
|
6730
6919
|
const baseUrl = await this.getBaseUrl();
|
|
6731
6920
|
const headers = await this.getHeaders();
|
|
6732
|
-
const client =
|
|
6921
|
+
const client = initClient10(publicArtifactByIdContract, {
|
|
6733
6922
|
baseUrl,
|
|
6734
6923
|
baseHeaders: headers,
|
|
6735
6924
|
jsonQuery: true
|
|
@@ -6748,7 +6937,7 @@ var ApiClient = class {
|
|
|
6748
6937
|
async listPublicVolumes(query) {
|
|
6749
6938
|
const baseUrl = await this.getBaseUrl();
|
|
6750
6939
|
const headers = await this.getHeaders();
|
|
6751
|
-
const client =
|
|
6940
|
+
const client = initClient10(publicVolumesListContract, {
|
|
6752
6941
|
baseUrl,
|
|
6753
6942
|
baseHeaders: headers,
|
|
6754
6943
|
jsonQuery: true
|
|
@@ -6767,7 +6956,7 @@ var ApiClient = class {
|
|
|
6767
6956
|
async getPublicVolume(id) {
|
|
6768
6957
|
const baseUrl = await this.getBaseUrl();
|
|
6769
6958
|
const headers = await this.getHeaders();
|
|
6770
|
-
const client =
|
|
6959
|
+
const client = initClient10(publicVolumeByIdContract, {
|
|
6771
6960
|
baseUrl,
|
|
6772
6961
|
baseHeaders: headers,
|
|
6773
6962
|
jsonQuery: true
|
|
@@ -6806,7 +6995,7 @@ var ApiClient = class {
|
|
|
6806
6995
|
async listCredentials() {
|
|
6807
6996
|
const baseUrl = await this.getBaseUrl();
|
|
6808
6997
|
const headers = await this.getHeaders();
|
|
6809
|
-
const client =
|
|
6998
|
+
const client = initClient10(credentialsMainContract, {
|
|
6810
6999
|
baseUrl,
|
|
6811
7000
|
baseHeaders: headers,
|
|
6812
7001
|
jsonQuery: true
|
|
@@ -6825,7 +7014,7 @@ var ApiClient = class {
|
|
|
6825
7014
|
async getCredential(name) {
|
|
6826
7015
|
const baseUrl = await this.getBaseUrl();
|
|
6827
7016
|
const headers = await this.getHeaders();
|
|
6828
|
-
const client =
|
|
7017
|
+
const client = initClient10(credentialsByNameContract, {
|
|
6829
7018
|
baseUrl,
|
|
6830
7019
|
baseHeaders: headers,
|
|
6831
7020
|
jsonQuery: true
|
|
@@ -6846,7 +7035,7 @@ var ApiClient = class {
|
|
|
6846
7035
|
async setCredential(body) {
|
|
6847
7036
|
const baseUrl = await this.getBaseUrl();
|
|
6848
7037
|
const headers = await this.getHeaders();
|
|
6849
|
-
const client =
|
|
7038
|
+
const client = initClient10(credentialsMainContract, {
|
|
6850
7039
|
baseUrl,
|
|
6851
7040
|
baseHeaders: headers,
|
|
6852
7041
|
jsonQuery: true
|
|
@@ -6865,7 +7054,7 @@ var ApiClient = class {
|
|
|
6865
7054
|
async deleteCredential(name) {
|
|
6866
7055
|
const baseUrl = await this.getBaseUrl();
|
|
6867
7056
|
const headers = await this.getHeaders();
|
|
6868
|
-
const client =
|
|
7057
|
+
const client = initClient10(credentialsByNameContract, {
|
|
6869
7058
|
baseUrl,
|
|
6870
7059
|
baseHeaders: headers,
|
|
6871
7060
|
jsonQuery: true
|
|
@@ -6886,7 +7075,7 @@ var ApiClient = class {
|
|
|
6886
7075
|
async getRealtimeToken(runId) {
|
|
6887
7076
|
const baseUrl = await this.getBaseUrl();
|
|
6888
7077
|
const headers = await this.getHeaders();
|
|
6889
|
-
const client =
|
|
7078
|
+
const client = initClient10(realtimeTokenContract, {
|
|
6890
7079
|
baseUrl,
|
|
6891
7080
|
baseHeaders: headers,
|
|
6892
7081
|
jsonQuery: true
|
|
@@ -7408,7 +7597,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
7408
7597
|
}
|
|
7409
7598
|
showNextSteps(result);
|
|
7410
7599
|
if (options.autoUpdate !== false) {
|
|
7411
|
-
await silentUpgradeAfterCommand("9.
|
|
7600
|
+
await silentUpgradeAfterCommand("9.18.0");
|
|
7412
7601
|
}
|
|
7413
7602
|
} catch (error) {
|
|
7414
7603
|
handleRunError(error, identifier);
|
|
@@ -7685,7 +7874,7 @@ import path6 from "path";
|
|
|
7685
7874
|
|
|
7686
7875
|
// src/lib/storage/storage-utils.ts
|
|
7687
7876
|
import { readFile as readFile5, writeFile as writeFile4, mkdir as mkdir4 } from "fs/promises";
|
|
7688
|
-
import { existsSync as
|
|
7877
|
+
import { existsSync as existsSync6 } from "fs";
|
|
7689
7878
|
import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
|
|
7690
7879
|
import path5 from "path";
|
|
7691
7880
|
var CONFIG_DIR = ".vm0";
|
|
@@ -7701,9 +7890,9 @@ async function readStorageConfig(basePath = process.cwd()) {
|
|
|
7701
7890
|
const configPath = path5.join(basePath, CONFIG_DIR, CONFIG_FILE);
|
|
7702
7891
|
const legacyConfigPath = path5.join(basePath, CONFIG_DIR, "volume.yaml");
|
|
7703
7892
|
let actualPath = null;
|
|
7704
|
-
if (
|
|
7893
|
+
if (existsSync6(configPath)) {
|
|
7705
7894
|
actualPath = configPath;
|
|
7706
|
-
} else if (
|
|
7895
|
+
} else if (existsSync6(legacyConfigPath)) {
|
|
7707
7896
|
actualPath = legacyConfigPath;
|
|
7708
7897
|
}
|
|
7709
7898
|
if (!actualPath) {
|
|
@@ -7719,7 +7908,7 @@ async function readStorageConfig(basePath = process.cwd()) {
|
|
|
7719
7908
|
async function writeStorageConfig(storageName, basePath = process.cwd(), type = "volume") {
|
|
7720
7909
|
const configDir = path5.join(basePath, CONFIG_DIR);
|
|
7721
7910
|
const configPath = path5.join(configDir, CONFIG_FILE);
|
|
7722
|
-
if (!
|
|
7911
|
+
if (!existsSync6(configDir)) {
|
|
7723
7912
|
await mkdir4(configDir, { recursive: true });
|
|
7724
7913
|
}
|
|
7725
7914
|
const config = {
|
|
@@ -8058,8 +8247,9 @@ import * as os5 from "os";
|
|
|
8058
8247
|
import * as tar4 from "tar";
|
|
8059
8248
|
async function cloneStorage(name, type, destination, options = {}) {
|
|
8060
8249
|
const typeLabel = type === "artifact" ? "artifact" : "volume";
|
|
8061
|
-
|
|
8062
|
-
|
|
8250
|
+
const dirStatus = checkDirectoryStatus(destination);
|
|
8251
|
+
if (dirStatus.exists && !dirStatus.empty) {
|
|
8252
|
+
throw new Error(`Directory "${destination}" is not empty`);
|
|
8063
8253
|
}
|
|
8064
8254
|
console.log(chalk20.dim(`Checking remote ${typeLabel}...`));
|
|
8065
8255
|
const downloadInfo = await getStorageDownload({
|
|
@@ -8914,7 +9104,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
8914
9104
|
).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(
|
|
8915
9105
|
async (prompt, options) => {
|
|
8916
9106
|
if (options.autoUpdate !== false) {
|
|
8917
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9107
|
+
const shouldExit = await checkAndUpgrade("9.18.0", prompt);
|
|
8918
9108
|
if (shouldExit) {
|
|
8919
9109
|
process.exit(0);
|
|
8920
9110
|
}
|
|
@@ -9494,7 +9684,7 @@ import { Command as Command38 } from "commander";
|
|
|
9494
9684
|
// src/commands/agent/clone.ts
|
|
9495
9685
|
import { Command as Command35 } from "commander";
|
|
9496
9686
|
import chalk36 from "chalk";
|
|
9497
|
-
import {
|
|
9687
|
+
import { mkdtempSync as mkdtempSync5 } from "fs";
|
|
9498
9688
|
import { mkdir as mkdir7, writeFile as writeFile6, readdir, copyFile, rm as rm3 } from "fs/promises";
|
|
9499
9689
|
import { join as join7, dirname as dirname3 } from "path";
|
|
9500
9690
|
import { tmpdir as tmpdir7 } from "os";
|
|
@@ -9552,8 +9742,9 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
9552
9742
|
var cloneCommand3 = new Command35().name("clone").description("Clone agent compose to local directory (latest version)").argument("<name>", "Agent compose name to clone").argument("[destination]", "Destination directory (default: agent name)").action(async (name, destination) => {
|
|
9553
9743
|
try {
|
|
9554
9744
|
const targetDir = destination || name;
|
|
9555
|
-
|
|
9556
|
-
|
|
9745
|
+
const dirStatus = checkDirectoryStatus(targetDir);
|
|
9746
|
+
if (dirStatus.exists && !dirStatus.empty) {
|
|
9747
|
+
console.error(chalk36.red(`\u2717 Directory "${targetDir}" is not empty`));
|
|
9557
9748
|
process.exit(1);
|
|
9558
9749
|
}
|
|
9559
9750
|
console.log(`Cloning agent compose: ${name}`);
|
|
@@ -9628,7 +9819,7 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
9628
9819
|
);
|
|
9629
9820
|
return;
|
|
9630
9821
|
}
|
|
9631
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
9822
|
+
const nameWidth = Math.max(4, ...data.composes.map((c23) => c23.name.length));
|
|
9632
9823
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
9633
9824
|
" "
|
|
9634
9825
|
);
|
|
@@ -9915,7 +10106,7 @@ var agentCommand = new Command38().name("agent").description("Manage agent compo
|
|
|
9915
10106
|
import { Command as Command39 } from "commander";
|
|
9916
10107
|
import chalk39 from "chalk";
|
|
9917
10108
|
import path15 from "path";
|
|
9918
|
-
import { existsSync as
|
|
10109
|
+
import { existsSync as existsSync10 } from "fs";
|
|
9919
10110
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
9920
10111
|
var VM0_YAML_FILE = "vm0.yaml";
|
|
9921
10112
|
var AGENTS_MD_FILE = "AGENTS.md";
|
|
@@ -9947,8 +10138,8 @@ You are a HackerNews AI content curator.
|
|
|
9947
10138
|
}
|
|
9948
10139
|
function checkExistingFiles() {
|
|
9949
10140
|
const existingFiles = [];
|
|
9950
|
-
if (
|
|
9951
|
-
if (
|
|
10141
|
+
if (existsSync10(VM0_YAML_FILE)) existingFiles.push(VM0_YAML_FILE);
|
|
10142
|
+
if (existsSync10(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
9952
10143
|
return existingFiles;
|
|
9953
10144
|
}
|
|
9954
10145
|
var initCommand3 = new Command39().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) => {
|
|
@@ -10170,7 +10361,6 @@ import chalk40 from "chalk";
|
|
|
10170
10361
|
var defaultPromptDeps = {
|
|
10171
10362
|
isInteractive,
|
|
10172
10363
|
promptConfirm,
|
|
10173
|
-
promptPassword,
|
|
10174
10364
|
promptText
|
|
10175
10365
|
};
|
|
10176
10366
|
function parseKeyValuePairs(pairs) {
|
|
@@ -10185,25 +10375,23 @@ function parseKeyValuePairs(pairs) {
|
|
|
10185
10375
|
}
|
|
10186
10376
|
return result;
|
|
10187
10377
|
}
|
|
10188
|
-
async function
|
|
10189
|
-
if (optionSecrets.length > 0) {
|
|
10190
|
-
return {
|
|
10191
|
-
secrets: parseKeyValuePairs(optionSecrets),
|
|
10192
|
-
preserveExistingSecrets: false
|
|
10193
|
-
};
|
|
10194
|
-
}
|
|
10378
|
+
async function handleExistingSecrets(existingSecretNames, deps) {
|
|
10195
10379
|
if (existingSecretNames.length > 0 && deps.isInteractive()) {
|
|
10196
10380
|
const keepSecrets = await deps.promptConfirm(
|
|
10197
10381
|
`Keep existing secrets? (${existingSecretNames.join(", ")})`,
|
|
10198
10382
|
true
|
|
10199
10383
|
);
|
|
10200
10384
|
if (keepSecrets) {
|
|
10201
|
-
return
|
|
10385
|
+
return true;
|
|
10202
10386
|
}
|
|
10203
|
-
console.log(
|
|
10204
|
-
|
|
10387
|
+
console.log(
|
|
10388
|
+
chalk40.dim(
|
|
10389
|
+
" Note: Secrets will be cleared. Use 'vm0 secret set' to add platform secrets."
|
|
10390
|
+
)
|
|
10391
|
+
);
|
|
10392
|
+
return false;
|
|
10205
10393
|
}
|
|
10206
|
-
return
|
|
10394
|
+
return false;
|
|
10207
10395
|
}
|
|
10208
10396
|
async function handleVars(optionVars, existingVars, deps) {
|
|
10209
10397
|
if (optionVars.length > 0) {
|
|
@@ -10221,29 +10409,24 @@ async function handleVars(optionVars, existingVars, deps) {
|
|
|
10221
10409
|
return {};
|
|
10222
10410
|
}
|
|
10223
10411
|
function displayMissingRequirements(missingSecrets, missingVars) {
|
|
10224
|
-
console.log(chalk40.yellow("\nAgent requires the following configuration:"));
|
|
10225
10412
|
if (missingSecrets.length > 0) {
|
|
10226
|
-
console.log(chalk40.
|
|
10413
|
+
console.log(chalk40.yellow("\nAgent requires the following secrets:"));
|
|
10414
|
+
for (const name of missingSecrets) {
|
|
10415
|
+
console.log(chalk40.dim(` ${name}`));
|
|
10416
|
+
}
|
|
10417
|
+
console.log();
|
|
10418
|
+
console.log("Set secrets using the platform:");
|
|
10227
10419
|
for (const name of missingSecrets) {
|
|
10228
|
-
console.log(chalk40.
|
|
10420
|
+
console.log(chalk40.cyan(` vm0 secret set ${name} <value>`));
|
|
10229
10421
|
}
|
|
10422
|
+
console.log();
|
|
10230
10423
|
}
|
|
10231
10424
|
if (missingVars.length > 0) {
|
|
10232
|
-
console.log(chalk40.
|
|
10425
|
+
console.log(chalk40.yellow("\nAgent requires the following variables:"));
|
|
10233
10426
|
for (const name of missingVars) {
|
|
10234
|
-
console.log(chalk40.dim(`
|
|
10235
|
-
}
|
|
10236
|
-
}
|
|
10237
|
-
console.log("");
|
|
10238
|
-
}
|
|
10239
|
-
async function promptForMissingSecrets(missingSecrets, secrets, deps) {
|
|
10240
|
-
for (const name of missingSecrets) {
|
|
10241
|
-
const value = await deps.promptPassword(
|
|
10242
|
-
`Enter value for secret ${chalk40.cyan(name)}`
|
|
10243
|
-
);
|
|
10244
|
-
if (value) {
|
|
10245
|
-
secrets[name] = value;
|
|
10427
|
+
console.log(chalk40.dim(` ${name}`));
|
|
10246
10428
|
}
|
|
10429
|
+
console.log();
|
|
10247
10430
|
}
|
|
10248
10431
|
}
|
|
10249
10432
|
async function promptForMissingVars(missingVars, vars, deps) {
|
|
@@ -10258,32 +10441,30 @@ async function promptForMissingVars(missingVars, vars, deps) {
|
|
|
10258
10441
|
}
|
|
10259
10442
|
}
|
|
10260
10443
|
async function gatherConfiguration(params, deps = defaultPromptDeps) {
|
|
10261
|
-
const { required,
|
|
10444
|
+
const { required, optionVars, existingSchedule } = params;
|
|
10262
10445
|
const existingSecretNames = existingSchedule?.secretNames ?? [];
|
|
10263
10446
|
const existingVars = existingSchedule?.vars ?? null;
|
|
10264
|
-
const
|
|
10265
|
-
optionSecrets,
|
|
10447
|
+
const preserveExistingSecrets = await handleExistingSecrets(
|
|
10266
10448
|
existingSecretNames,
|
|
10267
10449
|
deps
|
|
10268
10450
|
);
|
|
10269
10451
|
const vars = await handleVars(optionVars, existingVars, deps);
|
|
10270
10452
|
const effectiveExistingSecrets = preserveExistingSecrets ? existingSecretNames : [];
|
|
10271
10453
|
const missingSecrets = required.secrets.filter(
|
|
10272
|
-
(name) => !
|
|
10454
|
+
(name) => !effectiveExistingSecrets.includes(name)
|
|
10273
10455
|
);
|
|
10274
10456
|
const missingVars = required.vars.filter(
|
|
10275
10457
|
(name) => !Object.keys(vars).includes(name)
|
|
10276
10458
|
);
|
|
10277
10459
|
if (missingSecrets.length === 0 && missingVars.length === 0) {
|
|
10278
|
-
return {
|
|
10460
|
+
return { vars, preserveExistingSecrets };
|
|
10279
10461
|
}
|
|
10280
10462
|
if (!deps.isInteractive()) {
|
|
10281
|
-
return {
|
|
10463
|
+
return { vars, preserveExistingSecrets };
|
|
10282
10464
|
}
|
|
10283
10465
|
displayMissingRequirements(missingSecrets, missingVars);
|
|
10284
|
-
await promptForMissingSecrets(missingSecrets, secrets, deps);
|
|
10285
10466
|
await promptForMissingVars(missingVars, vars, deps);
|
|
10286
|
-
return {
|
|
10467
|
+
return { vars, preserveExistingSecrets };
|
|
10287
10468
|
}
|
|
10288
10469
|
|
|
10289
10470
|
// src/commands/schedule/setup.ts
|
|
@@ -10410,7 +10591,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
10410
10591
|
);
|
|
10411
10592
|
process.exit(1);
|
|
10412
10593
|
}
|
|
10413
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
10594
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c23) => c23.value === existingFrequency) : 0;
|
|
10414
10595
|
frequency = await promptSelect(
|
|
10415
10596
|
"Schedule frequency",
|
|
10416
10597
|
FREQUENCY_CHOICES,
|
|
@@ -10439,7 +10620,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
10439
10620
|
process.exit(1);
|
|
10440
10621
|
}
|
|
10441
10622
|
if (frequency === "weekly") {
|
|
10442
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
10623
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c23) => c23.value === existingDay) : 0;
|
|
10443
10624
|
const day2 = await promptSelect(
|
|
10444
10625
|
"Day of week",
|
|
10445
10626
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -10688,7 +10869,7 @@ async function handleScheduleEnabling(params) {
|
|
|
10688
10869
|
showEnableHint(agentName);
|
|
10689
10870
|
}
|
|
10690
10871
|
}
|
|
10691
|
-
var setupCommand = new Command40().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("--
|
|
10872
|
+
var setupCommand = new Command40().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) => {
|
|
10692
10873
|
try {
|
|
10693
10874
|
const { composeId, scheduleName, composeContent } = await resolveAgent(agentName);
|
|
10694
10875
|
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
@@ -10731,7 +10912,8 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10731
10912
|
}
|
|
10732
10913
|
const config = await gatherConfiguration({
|
|
10733
10914
|
required: requiredConfig,
|
|
10734
|
-
optionSecrets:
|
|
10915
|
+
optionSecrets: [],
|
|
10916
|
+
// Secrets are no longer passed via CLI
|
|
10735
10917
|
optionVars: options.var || [],
|
|
10736
10918
|
existingSchedule
|
|
10737
10919
|
});
|
|
@@ -10746,7 +10928,8 @@ var setupCommand = new Command40().name("setup").description("Create or edit a s
|
|
|
10746
10928
|
timezone,
|
|
10747
10929
|
prompt: promptText_,
|
|
10748
10930
|
vars: Object.keys(config.vars).length > 0 ? config.vars : void 0,
|
|
10749
|
-
secrets:
|
|
10931
|
+
secrets: void 0,
|
|
10932
|
+
// Secrets managed via platform, not schedule
|
|
10750
10933
|
artifactName: options.artifactName
|
|
10751
10934
|
});
|
|
10752
10935
|
displayDeployResult(agentName, deployResult);
|
|
@@ -11246,38 +11429,36 @@ var usageCommand = new Command47().name("usage").description("View usage statist
|
|
|
11246
11429
|
}
|
|
11247
11430
|
});
|
|
11248
11431
|
|
|
11249
|
-
// src/commands/
|
|
11432
|
+
// src/commands/secret/index.ts
|
|
11250
11433
|
import { Command as Command51 } from "commander";
|
|
11251
11434
|
|
|
11252
|
-
// src/commands/
|
|
11435
|
+
// src/commands/secret/list.ts
|
|
11253
11436
|
import { Command as Command48 } from "commander";
|
|
11254
11437
|
import chalk48 from "chalk";
|
|
11255
|
-
var listCommand6 = new Command48().name("list").alias("ls").description("List all
|
|
11438
|
+
var listCommand6 = new Command48().name("list").alias("ls").description("List all secrets").action(async () => {
|
|
11256
11439
|
try {
|
|
11257
|
-
const result = await
|
|
11258
|
-
if (result.
|
|
11259
|
-
console.log(chalk48.dim("No
|
|
11440
|
+
const result = await listSecrets();
|
|
11441
|
+
if (result.secrets.length === 0) {
|
|
11442
|
+
console.log(chalk48.dim("No secrets found"));
|
|
11260
11443
|
console.log();
|
|
11261
|
-
console.log("To add a
|
|
11262
|
-
console.log(chalk48.cyan(" vm0
|
|
11444
|
+
console.log("To add a secret:");
|
|
11445
|
+
console.log(chalk48.cyan(" vm0 secret set MY_API_KEY <value>"));
|
|
11263
11446
|
return;
|
|
11264
11447
|
}
|
|
11265
|
-
console.log(chalk48.bold("
|
|
11448
|
+
console.log(chalk48.bold("Secrets:"));
|
|
11266
11449
|
console.log();
|
|
11267
|
-
for (const
|
|
11268
|
-
const typeIndicator =
|
|
11269
|
-
console.log(` ${chalk48.cyan(
|
|
11270
|
-
if (
|
|
11271
|
-
console.log(` ${chalk48.dim(
|
|
11450
|
+
for (const secret of result.secrets) {
|
|
11451
|
+
const typeIndicator = secret.type === "model-provider" ? chalk48.dim(" [model-provider]") : "";
|
|
11452
|
+
console.log(` ${chalk48.cyan(secret.name)}${typeIndicator}`);
|
|
11453
|
+
if (secret.description) {
|
|
11454
|
+
console.log(` ${chalk48.dim(secret.description)}`);
|
|
11272
11455
|
}
|
|
11273
11456
|
console.log(
|
|
11274
|
-
` ${chalk48.dim(`Updated: ${new Date(
|
|
11457
|
+
` ${chalk48.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
11275
11458
|
);
|
|
11276
11459
|
console.log();
|
|
11277
11460
|
}
|
|
11278
|
-
console.log(
|
|
11279
|
-
chalk48.dim(`Total: ${result.credentials.length} credential(s)`)
|
|
11280
|
-
);
|
|
11461
|
+
console.log(chalk48.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
11281
11462
|
} catch (error) {
|
|
11282
11463
|
if (error instanceof Error) {
|
|
11283
11464
|
if (error.message.includes("Not authenticated")) {
|
|
@@ -11292,22 +11473,22 @@ var listCommand6 = new Command48().name("list").alias("ls").description("List al
|
|
|
11292
11473
|
}
|
|
11293
11474
|
});
|
|
11294
11475
|
|
|
11295
|
-
// src/commands/
|
|
11476
|
+
// src/commands/secret/set.ts
|
|
11296
11477
|
import { Command as Command49 } from "commander";
|
|
11297
11478
|
import chalk49 from "chalk";
|
|
11298
|
-
var setCommand2 = new Command49().name("set").description("Create or update a
|
|
11479
|
+
var setCommand2 = new Command49().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(
|
|
11299
11480
|
async (name, value, options) => {
|
|
11300
11481
|
try {
|
|
11301
|
-
const
|
|
11482
|
+
const secret = await setSecret({
|
|
11302
11483
|
name,
|
|
11303
11484
|
value,
|
|
11304
11485
|
description: options.description
|
|
11305
11486
|
});
|
|
11306
|
-
console.log(chalk49.green(`\u2713
|
|
11487
|
+
console.log(chalk49.green(`\u2713 Secret "${secret.name}" saved`));
|
|
11307
11488
|
console.log();
|
|
11308
11489
|
console.log("Use in vm0.yaml:");
|
|
11309
11490
|
console.log(chalk49.cyan(` environment:`));
|
|
11310
|
-
console.log(chalk49.cyan(` ${name}: \${{
|
|
11491
|
+
console.log(chalk49.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
11311
11492
|
} catch (error) {
|
|
11312
11493
|
if (error instanceof Error) {
|
|
11313
11494
|
if (error.message.includes("Not authenticated")) {
|
|
@@ -11317,7 +11498,7 @@ var setCommand2 = new Command49().name("set").description("Create or update a cr
|
|
|
11317
11498
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
11318
11499
|
console.error(chalk49.red(`\u2717 ${error.message}`));
|
|
11319
11500
|
console.log();
|
|
11320
|
-
console.log("Examples of valid
|
|
11501
|
+
console.log("Examples of valid secret names:");
|
|
11321
11502
|
console.log(chalk49.dim(" MY_API_KEY"));
|
|
11322
11503
|
console.log(chalk49.dim(" GITHUB_TOKEN"));
|
|
11323
11504
|
console.log(chalk49.dim(" AWS_ACCESS_KEY_ID"));
|
|
@@ -11332,15 +11513,15 @@ var setCommand2 = new Command49().name("set").description("Create or update a cr
|
|
|
11332
11513
|
}
|
|
11333
11514
|
);
|
|
11334
11515
|
|
|
11335
|
-
// src/commands/
|
|
11516
|
+
// src/commands/secret/delete.ts
|
|
11336
11517
|
import { Command as Command50 } from "commander";
|
|
11337
11518
|
import chalk50 from "chalk";
|
|
11338
|
-
var deleteCommand2 = new Command50().name("delete").description("Delete a
|
|
11519
|
+
var deleteCommand2 = new Command50().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
11339
11520
|
try {
|
|
11340
11521
|
try {
|
|
11341
|
-
await
|
|
11522
|
+
await getSecret(name);
|
|
11342
11523
|
} catch {
|
|
11343
|
-
console.error(chalk50.red(`\u2717
|
|
11524
|
+
console.error(chalk50.red(`\u2717 Secret "${name}" not found`));
|
|
11344
11525
|
process.exit(1);
|
|
11345
11526
|
}
|
|
11346
11527
|
if (!options.yes) {
|
|
@@ -11351,7 +11532,7 @@ var deleteCommand2 = new Command50().name("delete").description("Delete a creden
|
|
|
11351
11532
|
process.exit(1);
|
|
11352
11533
|
}
|
|
11353
11534
|
const confirmed = await promptConfirm(
|
|
11354
|
-
`Are you sure you want to delete
|
|
11535
|
+
`Are you sure you want to delete secret "${name}"?`,
|
|
11355
11536
|
false
|
|
11356
11537
|
);
|
|
11357
11538
|
if (!confirmed) {
|
|
@@ -11359,8 +11540,8 @@ var deleteCommand2 = new Command50().name("delete").description("Delete a creden
|
|
|
11359
11540
|
return;
|
|
11360
11541
|
}
|
|
11361
11542
|
}
|
|
11362
|
-
await
|
|
11363
|
-
console.log(chalk50.green(`\u2713
|
|
11543
|
+
await deleteSecret(name);
|
|
11544
|
+
console.log(chalk50.green(`\u2713 Secret "${name}" deleted`));
|
|
11364
11545
|
} catch (error) {
|
|
11365
11546
|
if (error instanceof Error) {
|
|
11366
11547
|
if (error.message.includes("Not authenticated")) {
|
|
@@ -11375,23 +11556,162 @@ var deleteCommand2 = new Command50().name("delete").description("Delete a creden
|
|
|
11375
11556
|
}
|
|
11376
11557
|
});
|
|
11377
11558
|
|
|
11378
|
-
// src/commands/
|
|
11379
|
-
var
|
|
11559
|
+
// src/commands/secret/index.ts
|
|
11560
|
+
var secretCommand = new Command51().name("secret").description("Manage stored secrets for agent runs").addCommand(listCommand6).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
11380
11561
|
|
|
11381
|
-
// src/commands/
|
|
11382
|
-
import { Command as
|
|
11562
|
+
// src/commands/variable/index.ts
|
|
11563
|
+
import { Command as Command55 } from "commander";
|
|
11383
11564
|
|
|
11384
|
-
// src/commands/
|
|
11565
|
+
// src/commands/variable/list.ts
|
|
11385
11566
|
import { Command as Command52 } from "commander";
|
|
11386
11567
|
import chalk51 from "chalk";
|
|
11387
|
-
|
|
11568
|
+
function truncateValue(value, maxLength = 60) {
|
|
11569
|
+
if (value.length <= maxLength) {
|
|
11570
|
+
return value;
|
|
11571
|
+
}
|
|
11572
|
+
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
11573
|
+
}
|
|
11574
|
+
var listCommand7 = new Command52().name("list").alias("ls").description("List all variables").action(async () => {
|
|
11575
|
+
try {
|
|
11576
|
+
const result = await listVariables();
|
|
11577
|
+
if (result.variables.length === 0) {
|
|
11578
|
+
console.log(chalk51.dim("No variables found"));
|
|
11579
|
+
console.log();
|
|
11580
|
+
console.log("To add a variable:");
|
|
11581
|
+
console.log(chalk51.cyan(" vm0 variable set MY_VAR <value>"));
|
|
11582
|
+
return;
|
|
11583
|
+
}
|
|
11584
|
+
console.log(chalk51.bold("Variables:"));
|
|
11585
|
+
console.log();
|
|
11586
|
+
for (const variable of result.variables) {
|
|
11587
|
+
const displayValue = truncateValue(variable.value);
|
|
11588
|
+
console.log(` ${chalk51.cyan(variable.name)} = ${displayValue}`);
|
|
11589
|
+
if (variable.description) {
|
|
11590
|
+
console.log(` ${chalk51.dim(variable.description)}`);
|
|
11591
|
+
}
|
|
11592
|
+
console.log(
|
|
11593
|
+
` ${chalk51.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
11594
|
+
);
|
|
11595
|
+
console.log();
|
|
11596
|
+
}
|
|
11597
|
+
console.log(chalk51.dim(`Total: ${result.variables.length} variable(s)`));
|
|
11598
|
+
} catch (error) {
|
|
11599
|
+
if (error instanceof Error) {
|
|
11600
|
+
if (error.message.includes("Not authenticated")) {
|
|
11601
|
+
console.error(chalk51.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11602
|
+
} else {
|
|
11603
|
+
console.error(chalk51.red(`\u2717 ${error.message}`));
|
|
11604
|
+
}
|
|
11605
|
+
} else {
|
|
11606
|
+
console.error(chalk51.red("\u2717 An unexpected error occurred"));
|
|
11607
|
+
}
|
|
11608
|
+
process.exit(1);
|
|
11609
|
+
}
|
|
11610
|
+
});
|
|
11611
|
+
|
|
11612
|
+
// src/commands/variable/set.ts
|
|
11613
|
+
import { Command as Command53 } from "commander";
|
|
11614
|
+
import chalk52 from "chalk";
|
|
11615
|
+
var setCommand3 = new Command53().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(
|
|
11616
|
+
async (name, value, options) => {
|
|
11617
|
+
try {
|
|
11618
|
+
const variable = await setVariable({
|
|
11619
|
+
name,
|
|
11620
|
+
value,
|
|
11621
|
+
description: options.description
|
|
11622
|
+
});
|
|
11623
|
+
console.log(chalk52.green(`\u2713 Variable "${variable.name}" saved`));
|
|
11624
|
+
console.log();
|
|
11625
|
+
console.log("Use in vm0.yaml:");
|
|
11626
|
+
console.log(chalk52.cyan(` environment:`));
|
|
11627
|
+
console.log(chalk52.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
11628
|
+
} catch (error) {
|
|
11629
|
+
if (error instanceof Error) {
|
|
11630
|
+
if (error.message.includes("Not authenticated")) {
|
|
11631
|
+
console.error(
|
|
11632
|
+
chalk52.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
11633
|
+
);
|
|
11634
|
+
} else if (error.message.includes("must contain only uppercase")) {
|
|
11635
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
11636
|
+
console.log();
|
|
11637
|
+
console.log("Examples of valid variable names:");
|
|
11638
|
+
console.log(chalk52.dim(" MY_VAR"));
|
|
11639
|
+
console.log(chalk52.dim(" API_URL"));
|
|
11640
|
+
console.log(chalk52.dim(" DEBUG_MODE"));
|
|
11641
|
+
} else {
|
|
11642
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
11643
|
+
}
|
|
11644
|
+
} else {
|
|
11645
|
+
console.error(chalk52.red("\u2717 An unexpected error occurred"));
|
|
11646
|
+
}
|
|
11647
|
+
process.exit(1);
|
|
11648
|
+
}
|
|
11649
|
+
}
|
|
11650
|
+
);
|
|
11651
|
+
|
|
11652
|
+
// src/commands/variable/delete.ts
|
|
11653
|
+
import { Command as Command54 } from "commander";
|
|
11654
|
+
import chalk53 from "chalk";
|
|
11655
|
+
var deleteCommand3 = new Command54().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
11656
|
+
try {
|
|
11657
|
+
try {
|
|
11658
|
+
await getVariable(name);
|
|
11659
|
+
} catch (error) {
|
|
11660
|
+
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
11661
|
+
console.error(chalk53.red(`\u2717 Variable "${name}" not found`));
|
|
11662
|
+
process.exit(1);
|
|
11663
|
+
}
|
|
11664
|
+
throw error;
|
|
11665
|
+
}
|
|
11666
|
+
if (!options.yes) {
|
|
11667
|
+
if (!isInteractive()) {
|
|
11668
|
+
console.error(
|
|
11669
|
+
chalk53.red("\u2717 --yes flag is required in non-interactive mode")
|
|
11670
|
+
);
|
|
11671
|
+
process.exit(1);
|
|
11672
|
+
}
|
|
11673
|
+
const confirmed = await promptConfirm(
|
|
11674
|
+
`Are you sure you want to delete variable "${name}"?`,
|
|
11675
|
+
false
|
|
11676
|
+
);
|
|
11677
|
+
if (!confirmed) {
|
|
11678
|
+
console.log(chalk53.dim("Cancelled"));
|
|
11679
|
+
return;
|
|
11680
|
+
}
|
|
11681
|
+
}
|
|
11682
|
+
await deleteVariable(name);
|
|
11683
|
+
console.log(chalk53.green(`\u2713 Variable "${name}" deleted`));
|
|
11684
|
+
} catch (error) {
|
|
11685
|
+
if (error instanceof Error) {
|
|
11686
|
+
if (error.message.includes("Not authenticated")) {
|
|
11687
|
+
console.error(chalk53.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11688
|
+
} else {
|
|
11689
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
11690
|
+
}
|
|
11691
|
+
} else {
|
|
11692
|
+
console.error(chalk53.red("\u2717 An unexpected error occurred"));
|
|
11693
|
+
}
|
|
11694
|
+
process.exit(1);
|
|
11695
|
+
}
|
|
11696
|
+
});
|
|
11697
|
+
|
|
11698
|
+
// src/commands/variable/index.ts
|
|
11699
|
+
var variableCommand = new Command55().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand7).addCommand(setCommand3).addCommand(deleteCommand3);
|
|
11700
|
+
|
|
11701
|
+
// src/commands/model-provider/index.ts
|
|
11702
|
+
import { Command as Command60 } from "commander";
|
|
11703
|
+
|
|
11704
|
+
// src/commands/model-provider/list.ts
|
|
11705
|
+
import { Command as Command56 } from "commander";
|
|
11706
|
+
import chalk54 from "chalk";
|
|
11707
|
+
var listCommand8 = new Command56().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
11388
11708
|
try {
|
|
11389
11709
|
const result = await listModelProviders();
|
|
11390
11710
|
if (result.modelProviders.length === 0) {
|
|
11391
|
-
console.log(
|
|
11711
|
+
console.log(chalk54.dim("No model providers configured"));
|
|
11392
11712
|
console.log();
|
|
11393
11713
|
console.log("To add a model provider:");
|
|
11394
|
-
console.log(
|
|
11714
|
+
console.log(chalk54.cyan(" vm0 model-provider setup"));
|
|
11395
11715
|
return;
|
|
11396
11716
|
}
|
|
11397
11717
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -11405,16 +11725,16 @@ var listCommand7 = new Command52().name("list").alias("ls").description("List al
|
|
|
11405
11725
|
},
|
|
11406
11726
|
{}
|
|
11407
11727
|
);
|
|
11408
|
-
console.log(
|
|
11728
|
+
console.log(chalk54.bold("Model Providers:"));
|
|
11409
11729
|
console.log();
|
|
11410
11730
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
11411
|
-
console.log(` ${
|
|
11731
|
+
console.log(` ${chalk54.cyan(framework)}:`);
|
|
11412
11732
|
for (const provider of providers) {
|
|
11413
|
-
const defaultTag = provider.isDefault ?
|
|
11414
|
-
const modelTag = provider.selectedModel ?
|
|
11733
|
+
const defaultTag = provider.isDefault ? chalk54.green(" (default)") : "";
|
|
11734
|
+
const modelTag = provider.selectedModel ? chalk54.dim(` [${provider.selectedModel}]`) : "";
|
|
11415
11735
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
11416
11736
|
console.log(
|
|
11417
|
-
|
|
11737
|
+
chalk54.dim(
|
|
11418
11738
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
11419
11739
|
)
|
|
11420
11740
|
);
|
|
@@ -11422,33 +11742,33 @@ var listCommand7 = new Command52().name("list").alias("ls").description("List al
|
|
|
11422
11742
|
console.log();
|
|
11423
11743
|
}
|
|
11424
11744
|
console.log(
|
|
11425
|
-
|
|
11745
|
+
chalk54.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
11426
11746
|
);
|
|
11427
11747
|
} catch (error) {
|
|
11428
11748
|
if (error instanceof Error) {
|
|
11429
11749
|
if (error.message.includes("Not authenticated")) {
|
|
11430
|
-
console.error(
|
|
11750
|
+
console.error(chalk54.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11431
11751
|
} else {
|
|
11432
|
-
console.error(
|
|
11752
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
11433
11753
|
}
|
|
11434
11754
|
} else {
|
|
11435
|
-
console.error(
|
|
11755
|
+
console.error(chalk54.red("\u2717 An unexpected error occurred"));
|
|
11436
11756
|
}
|
|
11437
11757
|
process.exit(1);
|
|
11438
11758
|
}
|
|
11439
11759
|
});
|
|
11440
11760
|
|
|
11441
11761
|
// src/commands/model-provider/setup.ts
|
|
11442
|
-
import { Command as
|
|
11443
|
-
import
|
|
11762
|
+
import { Command as Command57 } from "commander";
|
|
11763
|
+
import chalk55 from "chalk";
|
|
11444
11764
|
import prompts2 from "prompts";
|
|
11445
11765
|
function validateProviderType(typeStr) {
|
|
11446
11766
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
11447
|
-
console.error(
|
|
11767
|
+
console.error(chalk55.red(`\u2717 Invalid type "${typeStr}"`));
|
|
11448
11768
|
console.log();
|
|
11449
11769
|
console.log("Valid types:");
|
|
11450
11770
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11451
|
-
console.log(` ${
|
|
11771
|
+
console.log(` ${chalk55.cyan(t)} - ${config.label}`);
|
|
11452
11772
|
}
|
|
11453
11773
|
process.exit(1);
|
|
11454
11774
|
}
|
|
@@ -11460,11 +11780,11 @@ function validateModel(type, modelStr) {
|
|
|
11460
11780
|
return modelStr;
|
|
11461
11781
|
}
|
|
11462
11782
|
if (models && !models.includes(modelStr)) {
|
|
11463
|
-
console.error(
|
|
11783
|
+
console.error(chalk55.red(`\u2717 Invalid model "${modelStr}"`));
|
|
11464
11784
|
console.log();
|
|
11465
11785
|
console.log("Valid models:");
|
|
11466
11786
|
for (const m of models) {
|
|
11467
|
-
console.log(` ${
|
|
11787
|
+
console.log(` ${chalk55.cyan(m)}`);
|
|
11468
11788
|
}
|
|
11469
11789
|
process.exit(1);
|
|
11470
11790
|
}
|
|
@@ -11473,12 +11793,12 @@ function validateModel(type, modelStr) {
|
|
|
11473
11793
|
function validateAuthMethod(type, authMethodStr) {
|
|
11474
11794
|
const authMethods = getAuthMethodsForType(type);
|
|
11475
11795
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
11476
|
-
console.error(
|
|
11796
|
+
console.error(chalk55.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
11477
11797
|
console.log();
|
|
11478
11798
|
console.log("Valid auth methods:");
|
|
11479
11799
|
if (authMethods) {
|
|
11480
11800
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
11481
|
-
console.log(` ${
|
|
11801
|
+
console.log(` ${chalk55.cyan(method)} - ${config.label}`);
|
|
11482
11802
|
}
|
|
11483
11803
|
}
|
|
11484
11804
|
process.exit(1);
|
|
@@ -11488,7 +11808,7 @@ function validateAuthMethod(type, authMethodStr) {
|
|
|
11488
11808
|
function parseCredentials(type, authMethod, credentialArgs) {
|
|
11489
11809
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11490
11810
|
if (!credentialsConfig) {
|
|
11491
|
-
console.error(
|
|
11811
|
+
console.error(chalk55.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11492
11812
|
process.exit(1);
|
|
11493
11813
|
}
|
|
11494
11814
|
const credentialNames = Object.keys(credentialsConfig);
|
|
@@ -11496,7 +11816,7 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11496
11816
|
if (credentialArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
11497
11817
|
if (credentialNames.length !== 1) {
|
|
11498
11818
|
console.error(
|
|
11499
|
-
|
|
11819
|
+
chalk55.red(
|
|
11500
11820
|
"\u2717 Must use KEY=VALUE format for multi-credential auth methods"
|
|
11501
11821
|
)
|
|
11502
11822
|
);
|
|
@@ -11504,13 +11824,13 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11504
11824
|
console.log("Required credentials:");
|
|
11505
11825
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11506
11826
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
11507
|
-
console.log(` ${
|
|
11827
|
+
console.log(` ${chalk55.cyan(name)}${requiredNote}`);
|
|
11508
11828
|
}
|
|
11509
11829
|
process.exit(1);
|
|
11510
11830
|
}
|
|
11511
11831
|
const firstCredentialName = credentialNames[0];
|
|
11512
11832
|
if (!firstCredentialName) {
|
|
11513
|
-
console.error(
|
|
11833
|
+
console.error(chalk55.red("\u2717 No credentials defined for this auth method"));
|
|
11514
11834
|
process.exit(1);
|
|
11515
11835
|
}
|
|
11516
11836
|
return { [firstCredentialName]: firstArg };
|
|
@@ -11519,7 +11839,7 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11519
11839
|
for (const arg of credentialArgs) {
|
|
11520
11840
|
const eqIndex = arg.indexOf("=");
|
|
11521
11841
|
if (eqIndex === -1) {
|
|
11522
|
-
console.error(
|
|
11842
|
+
console.error(chalk55.red(`\u2717 Invalid credential format "${arg}"`));
|
|
11523
11843
|
console.log();
|
|
11524
11844
|
console.log("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
11525
11845
|
process.exit(1);
|
|
@@ -11533,17 +11853,17 @@ function parseCredentials(type, authMethod, credentialArgs) {
|
|
|
11533
11853
|
function validateCredentials(type, authMethod, credentials) {
|
|
11534
11854
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11535
11855
|
if (!credentialsConfig) {
|
|
11536
|
-
console.error(
|
|
11856
|
+
console.error(chalk55.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11537
11857
|
process.exit(1);
|
|
11538
11858
|
}
|
|
11539
11859
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11540
11860
|
if (fieldConfig.required && !credentials[name]) {
|
|
11541
|
-
console.error(
|
|
11861
|
+
console.error(chalk55.red(`\u2717 Missing required credential: ${name}`));
|
|
11542
11862
|
console.log();
|
|
11543
11863
|
console.log("Required credentials:");
|
|
11544
11864
|
for (const [n, fc] of Object.entries(credentialsConfig)) {
|
|
11545
11865
|
if (fc.required) {
|
|
11546
|
-
console.log(` ${
|
|
11866
|
+
console.log(` ${chalk55.cyan(n)} - ${fc.label}`);
|
|
11547
11867
|
}
|
|
11548
11868
|
}
|
|
11549
11869
|
process.exit(1);
|
|
@@ -11551,12 +11871,12 @@ function validateCredentials(type, authMethod, credentials) {
|
|
|
11551
11871
|
}
|
|
11552
11872
|
for (const name of Object.keys(credentials)) {
|
|
11553
11873
|
if (!(name in credentialsConfig)) {
|
|
11554
|
-
console.error(
|
|
11874
|
+
console.error(chalk55.red(`\u2717 Unknown credential: ${name}`));
|
|
11555
11875
|
console.log();
|
|
11556
11876
|
console.log("Valid credentials:");
|
|
11557
11877
|
for (const [n, fc] of Object.entries(credentialsConfig)) {
|
|
11558
11878
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
11559
|
-
console.log(` ${
|
|
11879
|
+
console.log(` ${chalk55.cyan(n)}${requiredNote}`);
|
|
11560
11880
|
}
|
|
11561
11881
|
process.exit(1);
|
|
11562
11882
|
}
|
|
@@ -11579,7 +11899,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11579
11899
|
const defaultAuthMethod = getDefaultAuthMethod(type);
|
|
11580
11900
|
const authMethods = getAuthMethodsForType(type);
|
|
11581
11901
|
if (!defaultAuthMethod || !authMethods) {
|
|
11582
|
-
console.error(
|
|
11902
|
+
console.error(chalk55.red(`\u2717 Provider "${type}" requires --auth-method`));
|
|
11583
11903
|
process.exit(1);
|
|
11584
11904
|
}
|
|
11585
11905
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -11587,7 +11907,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11587
11907
|
authMethod = authMethodNames[0];
|
|
11588
11908
|
} else {
|
|
11589
11909
|
console.error(
|
|
11590
|
-
|
|
11910
|
+
chalk55.red(
|
|
11591
11911
|
`\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
|
|
11592
11912
|
)
|
|
11593
11913
|
);
|
|
@@ -11596,13 +11916,13 @@ function handleNonInteractiveMode(options) {
|
|
|
11596
11916
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
11597
11917
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
11598
11918
|
console.log(
|
|
11599
|
-
` ${
|
|
11919
|
+
` ${chalk55.cyan(method)} - ${config.label}${defaultNote}`
|
|
11600
11920
|
);
|
|
11601
11921
|
}
|
|
11602
11922
|
console.log();
|
|
11603
11923
|
console.log("Example:");
|
|
11604
11924
|
console.log(
|
|
11605
|
-
|
|
11925
|
+
chalk55.cyan(
|
|
11606
11926
|
` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --credential KEY=VALUE`
|
|
11607
11927
|
)
|
|
11608
11928
|
);
|
|
@@ -11622,7 +11942,7 @@ function handleNonInteractiveMode(options) {
|
|
|
11622
11942
|
const credentialArgs = options.credential;
|
|
11623
11943
|
const firstArg = credentialArgs[0];
|
|
11624
11944
|
if (!firstArg) {
|
|
11625
|
-
console.error(
|
|
11945
|
+
console.error(chalk55.red("\u2717 Credential is required"));
|
|
11626
11946
|
process.exit(1);
|
|
11627
11947
|
}
|
|
11628
11948
|
let credential;
|
|
@@ -11671,7 +11991,7 @@ async function promptForModelSelection(type) {
|
|
|
11671
11991
|
if (selected === "__custom__") {
|
|
11672
11992
|
const placeholder = getCustomModelPlaceholder(type);
|
|
11673
11993
|
if (placeholder) {
|
|
11674
|
-
console.log(
|
|
11994
|
+
console.log(chalk55.dim(`Example: ${placeholder}`));
|
|
11675
11995
|
}
|
|
11676
11996
|
const customResponse = await prompts2(
|
|
11677
11997
|
{
|
|
@@ -11716,13 +12036,13 @@ function isSecretCredential(name) {
|
|
|
11716
12036
|
async function promptForCredentials(type, authMethod) {
|
|
11717
12037
|
const credentialsConfig = getCredentialsForAuthMethod(type, authMethod);
|
|
11718
12038
|
if (!credentialsConfig) {
|
|
11719
|
-
console.error(
|
|
12039
|
+
console.error(chalk55.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
11720
12040
|
process.exit(1);
|
|
11721
12041
|
}
|
|
11722
12042
|
const credentials = {};
|
|
11723
12043
|
for (const [name, fieldConfig] of Object.entries(credentialsConfig)) {
|
|
11724
12044
|
if (fieldConfig.helpText) {
|
|
11725
|
-
console.log(
|
|
12045
|
+
console.log(chalk55.dim(fieldConfig.helpText));
|
|
11726
12046
|
}
|
|
11727
12047
|
const isSecret = isSecretCredential(name);
|
|
11728
12048
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -11757,11 +12077,11 @@ async function promptForCredentials(type, authMethod) {
|
|
|
11757
12077
|
}
|
|
11758
12078
|
async function handleInteractiveMode() {
|
|
11759
12079
|
if (!isInteractive()) {
|
|
11760
|
-
console.error(
|
|
12080
|
+
console.error(chalk55.red("\u2717 Interactive mode requires a TTY"));
|
|
11761
12081
|
console.log();
|
|
11762
12082
|
console.log("Use non-interactive mode:");
|
|
11763
12083
|
console.log(
|
|
11764
|
-
|
|
12084
|
+
chalk55.cyan(
|
|
11765
12085
|
' vm0 model-provider setup --type <type> --credential "<value>"'
|
|
11766
12086
|
)
|
|
11767
12087
|
);
|
|
@@ -11778,7 +12098,7 @@ async function handleInteractiveMode() {
|
|
|
11778
12098
|
title = `${title} \u2713`;
|
|
11779
12099
|
}
|
|
11780
12100
|
if (isExperimental) {
|
|
11781
|
-
title = `${title} ${
|
|
12101
|
+
title = `${title} ${chalk55.dim("(experimental)")}`;
|
|
11782
12102
|
}
|
|
11783
12103
|
return {
|
|
11784
12104
|
title,
|
|
@@ -11811,14 +12131,14 @@ async function handleInteractiveMode() {
|
|
|
11811
12131
|
const provider = await convertModelProviderCredential(type);
|
|
11812
12132
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
11813
12133
|
console.log(
|
|
11814
|
-
|
|
12134
|
+
chalk55.green(
|
|
11815
12135
|
`\u2713 Converted "${checkResult.credentialName}" to model provider${defaultNote}`
|
|
11816
12136
|
)
|
|
11817
12137
|
);
|
|
11818
12138
|
await promptSetAsDefault(type, provider.framework, provider.isDefault);
|
|
11819
12139
|
return null;
|
|
11820
12140
|
}
|
|
11821
|
-
console.log(
|
|
12141
|
+
console.log(chalk55.dim("Aborted"));
|
|
11822
12142
|
process.exit(0);
|
|
11823
12143
|
}
|
|
11824
12144
|
if (checkResult.exists && checkResult.currentType === "model-provider") {
|
|
@@ -11849,7 +12169,7 @@ async function handleInteractiveMode() {
|
|
|
11849
12169
|
}
|
|
11850
12170
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
11851
12171
|
console.log();
|
|
11852
|
-
console.log(
|
|
12172
|
+
console.log(chalk55.dim(config.helpText));
|
|
11853
12173
|
console.log();
|
|
11854
12174
|
if (hasAuthMethods(type)) {
|
|
11855
12175
|
const authMethod = await promptForAuthMethod(type);
|
|
@@ -11880,17 +12200,17 @@ async function handleInteractiveMode() {
|
|
|
11880
12200
|
function handleSetupError2(error) {
|
|
11881
12201
|
if (error instanceof Error) {
|
|
11882
12202
|
if (error.message.includes("already exists")) {
|
|
11883
|
-
console.error(
|
|
12203
|
+
console.error(chalk55.red(`\u2717 ${error.message}`));
|
|
11884
12204
|
console.log();
|
|
11885
12205
|
console.log("To convert the existing credential, run:");
|
|
11886
|
-
console.log(
|
|
12206
|
+
console.log(chalk55.cyan(" vm0 model-provider setup --convert"));
|
|
11887
12207
|
} else if (error.message.includes("Not authenticated")) {
|
|
11888
|
-
console.error(
|
|
12208
|
+
console.error(chalk55.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
11889
12209
|
} else {
|
|
11890
|
-
console.error(
|
|
12210
|
+
console.error(chalk55.red(`\u2717 ${error.message}`));
|
|
11891
12211
|
}
|
|
11892
12212
|
} else {
|
|
11893
|
-
console.error(
|
|
12213
|
+
console.error(chalk55.red("\u2717 An unexpected error occurred"));
|
|
11894
12214
|
}
|
|
11895
12215
|
process.exit(1);
|
|
11896
12216
|
}
|
|
@@ -11907,13 +12227,13 @@ async function promptSetAsDefault(type, framework, isDefault) {
|
|
|
11907
12227
|
);
|
|
11908
12228
|
if (response.setDefault) {
|
|
11909
12229
|
await setModelProviderDefault(type);
|
|
11910
|
-
console.log(
|
|
12230
|
+
console.log(chalk55.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
11911
12231
|
}
|
|
11912
12232
|
}
|
|
11913
12233
|
function collectCredentials(value, previous) {
|
|
11914
12234
|
return previous.concat([value]);
|
|
11915
12235
|
}
|
|
11916
|
-
var setupCommand2 = new
|
|
12236
|
+
var setupCommand2 = new Command57().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
11917
12237
|
"-c, --credential <value>",
|
|
11918
12238
|
"Credential value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
11919
12239
|
collectCredentials,
|
|
@@ -11936,7 +12256,7 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
11936
12256
|
});
|
|
11937
12257
|
} else if (options.type || credentialArgs.length > 0) {
|
|
11938
12258
|
console.error(
|
|
11939
|
-
|
|
12259
|
+
chalk55.red("\u2717 Both --type and --credential are required")
|
|
11940
12260
|
);
|
|
11941
12261
|
process.exit(1);
|
|
11942
12262
|
} else {
|
|
@@ -11955,11 +12275,11 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
11955
12275
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
11956
12276
|
if (!hasModelSelection(input.type)) {
|
|
11957
12277
|
console.log(
|
|
11958
|
-
|
|
12278
|
+
chalk55.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
11959
12279
|
);
|
|
11960
12280
|
} else {
|
|
11961
12281
|
console.log(
|
|
11962
|
-
|
|
12282
|
+
chalk55.green(
|
|
11963
12283
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
11964
12284
|
)
|
|
11965
12285
|
);
|
|
@@ -11985,7 +12305,7 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
11985
12305
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
11986
12306
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
11987
12307
|
console.log(
|
|
11988
|
-
|
|
12308
|
+
chalk55.green(
|
|
11989
12309
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
11990
12310
|
)
|
|
11991
12311
|
);
|
|
@@ -12003,96 +12323,96 @@ var setupCommand2 = new Command53().name("setup").description("Configure a model
|
|
|
12003
12323
|
);
|
|
12004
12324
|
|
|
12005
12325
|
// src/commands/model-provider/delete.ts
|
|
12006
|
-
import { Command as
|
|
12007
|
-
import
|
|
12008
|
-
var
|
|
12326
|
+
import { Command as Command58 } from "commander";
|
|
12327
|
+
import chalk56 from "chalk";
|
|
12328
|
+
var deleteCommand4 = new Command58().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
12009
12329
|
try {
|
|
12010
12330
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
12011
|
-
console.error(
|
|
12331
|
+
console.error(chalk56.red(`\u2717 Invalid type "${type}"`));
|
|
12012
12332
|
console.log();
|
|
12013
12333
|
console.log("Valid types:");
|
|
12014
12334
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12015
|
-
console.log(` ${
|
|
12335
|
+
console.log(` ${chalk56.cyan(t)} - ${config.label}`);
|
|
12016
12336
|
}
|
|
12017
12337
|
process.exit(1);
|
|
12018
12338
|
}
|
|
12019
12339
|
await deleteModelProvider(type);
|
|
12020
|
-
console.log(
|
|
12340
|
+
console.log(chalk56.green(`\u2713 Model provider "${type}" deleted`));
|
|
12021
12341
|
} catch (error) {
|
|
12022
12342
|
if (error instanceof Error) {
|
|
12023
12343
|
if (error.message.includes("not found")) {
|
|
12024
|
-
console.error(
|
|
12344
|
+
console.error(chalk56.red(`\u2717 Model provider "${type}" not found`));
|
|
12025
12345
|
} else if (error.message.includes("Not authenticated")) {
|
|
12026
|
-
console.error(
|
|
12346
|
+
console.error(chalk56.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12027
12347
|
} else {
|
|
12028
|
-
console.error(
|
|
12348
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12029
12349
|
}
|
|
12030
12350
|
} else {
|
|
12031
|
-
console.error(
|
|
12351
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
12032
12352
|
}
|
|
12033
12353
|
process.exit(1);
|
|
12034
12354
|
}
|
|
12035
12355
|
});
|
|
12036
12356
|
|
|
12037
12357
|
// src/commands/model-provider/set-default.ts
|
|
12038
|
-
import { Command as
|
|
12039
|
-
import
|
|
12040
|
-
var setDefaultCommand = new
|
|
12358
|
+
import { Command as Command59 } from "commander";
|
|
12359
|
+
import chalk57 from "chalk";
|
|
12360
|
+
var setDefaultCommand = new Command59().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) => {
|
|
12041
12361
|
try {
|
|
12042
12362
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
12043
|
-
console.error(
|
|
12363
|
+
console.error(chalk57.red(`\u2717 Invalid type "${type}"`));
|
|
12044
12364
|
console.log();
|
|
12045
12365
|
console.log("Valid types:");
|
|
12046
12366
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12047
|
-
console.log(` ${
|
|
12367
|
+
console.log(` ${chalk57.cyan(t)} - ${config.label}`);
|
|
12048
12368
|
}
|
|
12049
12369
|
process.exit(1);
|
|
12050
12370
|
}
|
|
12051
12371
|
const provider = await setModelProviderDefault(type);
|
|
12052
12372
|
console.log(
|
|
12053
|
-
|
|
12373
|
+
chalk57.green(
|
|
12054
12374
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
12055
12375
|
)
|
|
12056
12376
|
);
|
|
12057
12377
|
} catch (error) {
|
|
12058
12378
|
if (error instanceof Error) {
|
|
12059
12379
|
if (error.message.includes("not found")) {
|
|
12060
|
-
console.error(
|
|
12380
|
+
console.error(chalk57.red(`\u2717 Model provider "${type}" not found`));
|
|
12061
12381
|
} else if (error.message.includes("Not authenticated")) {
|
|
12062
|
-
console.error(
|
|
12382
|
+
console.error(chalk57.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12063
12383
|
} else {
|
|
12064
|
-
console.error(
|
|
12384
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
12065
12385
|
}
|
|
12066
12386
|
} else {
|
|
12067
|
-
console.error(
|
|
12387
|
+
console.error(chalk57.red("\u2717 An unexpected error occurred"));
|
|
12068
12388
|
}
|
|
12069
12389
|
process.exit(1);
|
|
12070
12390
|
}
|
|
12071
12391
|
});
|
|
12072
12392
|
|
|
12073
12393
|
// src/commands/model-provider/index.ts
|
|
12074
|
-
var modelProviderCommand = new
|
|
12394
|
+
var modelProviderCommand = new Command60().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand4).addCommand(setDefaultCommand);
|
|
12075
12395
|
|
|
12076
12396
|
// src/commands/onboard/index.ts
|
|
12077
|
-
import { Command as
|
|
12078
|
-
import
|
|
12397
|
+
import { Command as Command61 } from "commander";
|
|
12398
|
+
import chalk61 from "chalk";
|
|
12079
12399
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
12080
|
-
import { existsSync as
|
|
12400
|
+
import { existsSync as existsSync11 } from "fs";
|
|
12081
12401
|
|
|
12082
12402
|
// src/lib/ui/welcome-box.ts
|
|
12083
|
-
import
|
|
12403
|
+
import chalk58 from "chalk";
|
|
12084
12404
|
var gradientColors = [
|
|
12085
|
-
|
|
12405
|
+
chalk58.hex("#FFAB5E"),
|
|
12086
12406
|
// Line 1 - lightest
|
|
12087
|
-
|
|
12407
|
+
chalk58.hex("#FF9642"),
|
|
12088
12408
|
// Line 2
|
|
12089
|
-
|
|
12409
|
+
chalk58.hex("#FF8228"),
|
|
12090
12410
|
// Line 3
|
|
12091
|
-
|
|
12411
|
+
chalk58.hex("#FF6D0A"),
|
|
12092
12412
|
// Line 4
|
|
12093
|
-
|
|
12413
|
+
chalk58.hex("#E85D00"),
|
|
12094
12414
|
// Line 5
|
|
12095
|
-
|
|
12415
|
+
chalk58.hex("#CC4E00")
|
|
12096
12416
|
// Line 6 - darkest
|
|
12097
12417
|
];
|
|
12098
12418
|
var vm0LogoLines = [
|
|
@@ -12114,15 +12434,15 @@ function renderVm0Banner() {
|
|
|
12114
12434
|
function renderOnboardWelcome() {
|
|
12115
12435
|
renderVm0Banner();
|
|
12116
12436
|
console.log(` Build agentic workflows using natural language.`);
|
|
12117
|
-
console.log(` ${
|
|
12437
|
+
console.log(` ${chalk58.dim("Currently in beta, enjoy it free.")}`);
|
|
12118
12438
|
console.log(
|
|
12119
|
-
` ${
|
|
12439
|
+
` ${chalk58.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
12120
12440
|
);
|
|
12121
12441
|
console.log();
|
|
12122
12442
|
}
|
|
12123
12443
|
|
|
12124
12444
|
// src/lib/ui/step-runner.ts
|
|
12125
|
-
import
|
|
12445
|
+
import chalk59 from "chalk";
|
|
12126
12446
|
function createStepRunner(options = true) {
|
|
12127
12447
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
12128
12448
|
const interactive = opts.interactive ?? true;
|
|
@@ -12137,25 +12457,25 @@ function createStepRunner(options = true) {
|
|
|
12137
12457
|
}
|
|
12138
12458
|
for (const [i, step] of completedSteps.entries()) {
|
|
12139
12459
|
if (step.failed) {
|
|
12140
|
-
console.log(
|
|
12460
|
+
console.log(chalk59.red(`\u2717 ${step.label}`));
|
|
12141
12461
|
} else {
|
|
12142
|
-
console.log(
|
|
12462
|
+
console.log(chalk59.green(`\u25CF ${step.label}`));
|
|
12143
12463
|
}
|
|
12144
12464
|
const isLastStep = i === completedSteps.length - 1;
|
|
12145
12465
|
if (!isLastStep || !isFinal) {
|
|
12146
|
-
console.log(
|
|
12466
|
+
console.log(chalk59.dim("\u2502"));
|
|
12147
12467
|
}
|
|
12148
12468
|
}
|
|
12149
12469
|
}
|
|
12150
12470
|
async function executeStep(label, fn, isFinal) {
|
|
12151
12471
|
let stepFailed = false;
|
|
12152
|
-
console.log(
|
|
12472
|
+
console.log(chalk59.yellow(`\u25CB ${label}`));
|
|
12153
12473
|
const ctx = {
|
|
12154
12474
|
connector() {
|
|
12155
|
-
console.log(
|
|
12475
|
+
console.log(chalk59.dim("\u2502"));
|
|
12156
12476
|
},
|
|
12157
12477
|
detail(message) {
|
|
12158
|
-
console.log(`${
|
|
12478
|
+
console.log(`${chalk59.dim("\u2502")} ${message}`);
|
|
12159
12479
|
},
|
|
12160
12480
|
async prompt(promptFn) {
|
|
12161
12481
|
return await promptFn();
|
|
@@ -12172,12 +12492,12 @@ function createStepRunner(options = true) {
|
|
|
12172
12492
|
redrawCompletedSteps(isFinal);
|
|
12173
12493
|
} else {
|
|
12174
12494
|
if (stepFailed) {
|
|
12175
|
-
console.log(
|
|
12495
|
+
console.log(chalk59.red(`\u2717 ${label}`));
|
|
12176
12496
|
} else {
|
|
12177
|
-
console.log(
|
|
12497
|
+
console.log(chalk59.green(`\u25CF ${label}`));
|
|
12178
12498
|
}
|
|
12179
12499
|
if (!isFinal) {
|
|
12180
|
-
console.log(
|
|
12500
|
+
console.log(chalk59.dim("\u2502"));
|
|
12181
12501
|
}
|
|
12182
12502
|
}
|
|
12183
12503
|
}
|
|
@@ -12335,7 +12655,7 @@ async function setupModelProvider(type, credential, options) {
|
|
|
12335
12655
|
|
|
12336
12656
|
// src/lib/domain/onboard/claude-setup.ts
|
|
12337
12657
|
import { spawn as spawn3 } from "child_process";
|
|
12338
|
-
import
|
|
12658
|
+
import chalk60 from "chalk";
|
|
12339
12659
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
12340
12660
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
12341
12661
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -12372,12 +12692,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
12372
12692
|
}
|
|
12373
12693
|
function handlePluginError(error, context) {
|
|
12374
12694
|
const displayContext = context ?? "Claude plugin";
|
|
12375
|
-
console.error(
|
|
12695
|
+
console.error(chalk60.red(`Failed to install ${displayContext}`));
|
|
12376
12696
|
if (error instanceof Error) {
|
|
12377
|
-
console.error(
|
|
12697
|
+
console.error(chalk60.red(error.message));
|
|
12378
12698
|
}
|
|
12379
12699
|
console.error(
|
|
12380
|
-
|
|
12700
|
+
chalk60.dim("Please ensure Claude CLI is installed and accessible.")
|
|
12381
12701
|
);
|
|
12382
12702
|
process.exit(1);
|
|
12383
12703
|
}
|
|
@@ -12420,7 +12740,7 @@ async function updateMarketplace() {
|
|
|
12420
12740
|
]);
|
|
12421
12741
|
if (!result.success) {
|
|
12422
12742
|
console.warn(
|
|
12423
|
-
|
|
12743
|
+
chalk60.yellow(
|
|
12424
12744
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
12425
12745
|
)
|
|
12426
12746
|
);
|
|
@@ -12458,7 +12778,7 @@ async function handleAuthentication(ctx) {
|
|
|
12458
12778
|
return;
|
|
12459
12779
|
}
|
|
12460
12780
|
if (!ctx.interactive) {
|
|
12461
|
-
console.error(
|
|
12781
|
+
console.error(chalk61.red("Error: Not authenticated"));
|
|
12462
12782
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
12463
12783
|
process.exit(1);
|
|
12464
12784
|
}
|
|
@@ -12466,16 +12786,16 @@ async function handleAuthentication(ctx) {
|
|
|
12466
12786
|
onInitiating: () => {
|
|
12467
12787
|
},
|
|
12468
12788
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
12469
|
-
step.detail(`Copy code: ${
|
|
12470
|
-
step.detail(`Open: ${
|
|
12471
|
-
step.detail(
|
|
12789
|
+
step.detail(`Copy code: ${chalk61.cyan.bold(code)}`);
|
|
12790
|
+
step.detail(`Open: ${chalk61.cyan(url)}`);
|
|
12791
|
+
step.detail(chalk61.dim(`Expires in ${expiresIn} minutes`));
|
|
12472
12792
|
},
|
|
12473
12793
|
onPolling: () => {
|
|
12474
12794
|
},
|
|
12475
12795
|
onSuccess: () => {
|
|
12476
12796
|
},
|
|
12477
12797
|
onError: (error) => {
|
|
12478
|
-
console.error(
|
|
12798
|
+
console.error(chalk61.red(`
|
|
12479
12799
|
${error.message}`));
|
|
12480
12800
|
process.exit(1);
|
|
12481
12801
|
}
|
|
@@ -12489,7 +12809,7 @@ async function handleModelProvider(ctx) {
|
|
|
12489
12809
|
return;
|
|
12490
12810
|
}
|
|
12491
12811
|
if (!ctx.interactive) {
|
|
12492
|
-
console.error(
|
|
12812
|
+
console.error(chalk61.red("Error: No model provider configured"));
|
|
12493
12813
|
console.error("Run 'vm0 model-provider setup' first");
|
|
12494
12814
|
process.exit(1);
|
|
12495
12815
|
}
|
|
@@ -12498,19 +12818,19 @@ async function handleModelProvider(ctx) {
|
|
|
12498
12818
|
const providerType = await step.prompt(
|
|
12499
12819
|
() => promptSelect(
|
|
12500
12820
|
"Select provider type:",
|
|
12501
|
-
choices.map((
|
|
12502
|
-
title:
|
|
12503
|
-
value:
|
|
12821
|
+
choices.map((c23) => ({
|
|
12822
|
+
title: c23.label,
|
|
12823
|
+
value: c23.type
|
|
12504
12824
|
}))
|
|
12505
12825
|
)
|
|
12506
12826
|
);
|
|
12507
12827
|
if (!providerType) {
|
|
12508
12828
|
process.exit(0);
|
|
12509
12829
|
}
|
|
12510
|
-
const selectedChoice = choices.find((
|
|
12830
|
+
const selectedChoice = choices.find((c23) => c23.type === providerType);
|
|
12511
12831
|
if (selectedChoice?.helpText) {
|
|
12512
12832
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
12513
|
-
step.detail(
|
|
12833
|
+
step.detail(chalk61.dim(line));
|
|
12514
12834
|
}
|
|
12515
12835
|
}
|
|
12516
12836
|
const credential = await step.prompt(
|
|
@@ -12519,7 +12839,7 @@ async function handleModelProvider(ctx) {
|
|
|
12519
12839
|
)
|
|
12520
12840
|
);
|
|
12521
12841
|
if (!credential) {
|
|
12522
|
-
console.log(
|
|
12842
|
+
console.log(chalk61.dim("Cancelled"));
|
|
12523
12843
|
process.exit(0);
|
|
12524
12844
|
}
|
|
12525
12845
|
let selectedModel;
|
|
@@ -12538,7 +12858,7 @@ async function handleModelProvider(ctx) {
|
|
|
12538
12858
|
() => promptSelect("Select model:", modelChoices)
|
|
12539
12859
|
);
|
|
12540
12860
|
if (modelSelection === void 0) {
|
|
12541
|
-
console.log(
|
|
12861
|
+
console.log(chalk61.dim("Cancelled"));
|
|
12542
12862
|
process.exit(0);
|
|
12543
12863
|
}
|
|
12544
12864
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -12548,7 +12868,7 @@ async function handleModelProvider(ctx) {
|
|
|
12548
12868
|
});
|
|
12549
12869
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
12550
12870
|
step.detail(
|
|
12551
|
-
|
|
12871
|
+
chalk61.green(
|
|
12552
12872
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
12553
12873
|
)
|
|
12554
12874
|
);
|
|
@@ -12577,9 +12897,9 @@ async function handleAgentCreation(ctx) {
|
|
|
12577
12897
|
process.exit(0);
|
|
12578
12898
|
}
|
|
12579
12899
|
agentName = inputName;
|
|
12580
|
-
if (
|
|
12900
|
+
if (existsSync11(agentName)) {
|
|
12581
12901
|
step.detail(
|
|
12582
|
-
|
|
12902
|
+
chalk61.yellow(`${agentName}/ already exists, choose another name`)
|
|
12583
12903
|
);
|
|
12584
12904
|
} else {
|
|
12585
12905
|
folderExists = false;
|
|
@@ -12588,22 +12908,22 @@ async function handleAgentCreation(ctx) {
|
|
|
12588
12908
|
} else {
|
|
12589
12909
|
if (!validateAgentName(agentName)) {
|
|
12590
12910
|
console.error(
|
|
12591
|
-
|
|
12911
|
+
chalk61.red(
|
|
12592
12912
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
12593
12913
|
)
|
|
12594
12914
|
);
|
|
12595
12915
|
process.exit(1);
|
|
12596
12916
|
}
|
|
12597
|
-
if (
|
|
12598
|
-
console.error(
|
|
12917
|
+
if (existsSync11(agentName)) {
|
|
12918
|
+
console.error(chalk61.red(`${agentName}/ already exists`));
|
|
12599
12919
|
console.log();
|
|
12600
12920
|
console.log("Remove it first or choose a different name:");
|
|
12601
|
-
console.log(
|
|
12921
|
+
console.log(chalk61.cyan(` rm -rf ${agentName}`));
|
|
12602
12922
|
process.exit(1);
|
|
12603
12923
|
}
|
|
12604
12924
|
}
|
|
12605
12925
|
await mkdir8(agentName, { recursive: true });
|
|
12606
|
-
step.detail(
|
|
12926
|
+
step.detail(chalk61.green(`Created ${agentName}/`));
|
|
12607
12927
|
});
|
|
12608
12928
|
return agentName;
|
|
12609
12929
|
}
|
|
@@ -12619,7 +12939,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12619
12939
|
shouldInstall = confirmed ?? true;
|
|
12620
12940
|
}
|
|
12621
12941
|
if (!shouldInstall) {
|
|
12622
|
-
step.detail(
|
|
12942
|
+
step.detail(chalk61.dim("Skipped"));
|
|
12623
12943
|
return;
|
|
12624
12944
|
}
|
|
12625
12945
|
const scope = "project";
|
|
@@ -12627,7 +12947,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12627
12947
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
12628
12948
|
const result = await installVm0Plugin(scope, agentDir);
|
|
12629
12949
|
step.detail(
|
|
12630
|
-
|
|
12950
|
+
chalk61.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
12631
12951
|
);
|
|
12632
12952
|
pluginInstalled = true;
|
|
12633
12953
|
} catch (error) {
|
|
@@ -12638,18 +12958,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
12638
12958
|
}
|
|
12639
12959
|
function printNextSteps(agentName, pluginInstalled) {
|
|
12640
12960
|
console.log();
|
|
12641
|
-
console.log(
|
|
12961
|
+
console.log(chalk61.bold("Next step:"));
|
|
12642
12962
|
console.log();
|
|
12643
12963
|
if (pluginInstalled) {
|
|
12644
12964
|
console.log(
|
|
12645
|
-
` ${
|
|
12965
|
+
` ${chalk61.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
12646
12966
|
);
|
|
12647
12967
|
} else {
|
|
12648
|
-
console.log(` ${
|
|
12968
|
+
console.log(` ${chalk61.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
12649
12969
|
}
|
|
12650
12970
|
console.log();
|
|
12651
12971
|
}
|
|
12652
|
-
var onboardCommand = new
|
|
12972
|
+
var onboardCommand = new Command61().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) => {
|
|
12653
12973
|
const interactive = isInteractive();
|
|
12654
12974
|
if (interactive) {
|
|
12655
12975
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -12672,15 +12992,15 @@ var onboardCommand = new Command57().name("onboard").description("Guided setup f
|
|
|
12672
12992
|
});
|
|
12673
12993
|
|
|
12674
12994
|
// src/commands/setup-claude/index.ts
|
|
12675
|
-
import { Command as
|
|
12676
|
-
import
|
|
12677
|
-
var setupClaudeCommand = new
|
|
12678
|
-
console.log(
|
|
12995
|
+
import { Command as Command62 } from "commander";
|
|
12996
|
+
import chalk62 from "chalk";
|
|
12997
|
+
var setupClaudeCommand = new Command62().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) => {
|
|
12998
|
+
console.log(chalk62.dim("Installing VM0 Claude Plugin..."));
|
|
12679
12999
|
const scope = options.scope === "user" ? "user" : "project";
|
|
12680
13000
|
try {
|
|
12681
13001
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
12682
13002
|
console.log(
|
|
12683
|
-
|
|
13003
|
+
chalk62.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
12684
13004
|
);
|
|
12685
13005
|
} catch (error) {
|
|
12686
13006
|
handlePluginError(error);
|
|
@@ -12689,15 +13009,15 @@ var setupClaudeCommand = new Command58().name("setup-claude").description("Insta
|
|
|
12689
13009
|
console.log("Next step:");
|
|
12690
13010
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
12691
13011
|
console.log(
|
|
12692
|
-
|
|
13012
|
+
chalk62.cyan(
|
|
12693
13013
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
12694
13014
|
)
|
|
12695
13015
|
);
|
|
12696
13016
|
});
|
|
12697
13017
|
|
|
12698
13018
|
// src/index.ts
|
|
12699
|
-
var program = new
|
|
12700
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
13019
|
+
var program = new Command63();
|
|
13020
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.18.0");
|
|
12701
13021
|
program.addCommand(authCommand);
|
|
12702
13022
|
program.addCommand(infoCommand);
|
|
12703
13023
|
program.addCommand(composeCommand);
|
|
@@ -12711,7 +13031,8 @@ program.addCommand(agentCommand);
|
|
|
12711
13031
|
program.addCommand(initCommand3);
|
|
12712
13032
|
program.addCommand(scheduleCommand);
|
|
12713
13033
|
program.addCommand(usageCommand);
|
|
12714
|
-
program.addCommand(
|
|
13034
|
+
program.addCommand(secretCommand);
|
|
13035
|
+
program.addCommand(variableCommand);
|
|
12715
13036
|
program.addCommand(modelProviderCommand);
|
|
12716
13037
|
program.addCommand(onboardCommand);
|
|
12717
13038
|
program.addCommand(setupClaudeCommand);
|