@vm0/cli 9.60.1 → 9.61.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 +1199 -1106
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ if (DSN) {
|
|
|
45
45
|
Sentry.init({
|
|
46
46
|
dsn: DSN,
|
|
47
47
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
48
|
-
release: "9.
|
|
48
|
+
release: "9.61.0",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.
|
|
67
|
+
version: "9.61.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -83,7 +83,7 @@ process.stdout.on("error", handleEpipe);
|
|
|
83
83
|
process.stderr.on("error", handleEpipe);
|
|
84
84
|
|
|
85
85
|
// src/index.ts
|
|
86
|
-
import { Command as
|
|
86
|
+
import { Command as Command87 } from "commander";
|
|
87
87
|
|
|
88
88
|
// src/lib/network/proxy.ts
|
|
89
89
|
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
|
@@ -673,7 +673,7 @@ function getConfigPath() {
|
|
|
673
673
|
return join2(homedir2(), ".vm0", "config.json");
|
|
674
674
|
}
|
|
675
675
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
676
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.61.0"}`));
|
|
677
677
|
console.log();
|
|
678
678
|
const config = await loadConfig();
|
|
679
679
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1071,8 +1071,95 @@ var composesListContract = c.router({
|
|
|
1071
1071
|
});
|
|
1072
1072
|
|
|
1073
1073
|
// ../../packages/core/src/contracts/runs.ts
|
|
1074
|
+
import { z as z5 } from "zod";
|
|
1075
|
+
|
|
1076
|
+
// ../../packages/core/src/contracts/orgs.ts
|
|
1074
1077
|
import { z as z4 } from "zod";
|
|
1075
1078
|
var c2 = initContract();
|
|
1079
|
+
var orgTierSchema = z4.enum(["free", "pro", "max"]);
|
|
1080
|
+
var orgSlugSchema = z4.string().min(3, "Org slug must be at least 3 characters").max(64, "Org slug must be at most 64 characters").regex(
|
|
1081
|
+
/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]{1,2}$/,
|
|
1082
|
+
"Org slug must contain only lowercase letters, numbers, and hyphens, and must start and end with an alphanumeric character"
|
|
1083
|
+
).transform((s) => s.toLowerCase());
|
|
1084
|
+
var orgResponseSchema = z4.object({
|
|
1085
|
+
id: z4.string(),
|
|
1086
|
+
slug: z4.string(),
|
|
1087
|
+
tier: z4.string().optional()
|
|
1088
|
+
});
|
|
1089
|
+
var updateOrgRequestSchema = z4.object({
|
|
1090
|
+
slug: orgSlugSchema,
|
|
1091
|
+
force: z4.boolean().optional().default(false)
|
|
1092
|
+
});
|
|
1093
|
+
var orgContract = c2.router({
|
|
1094
|
+
/**
|
|
1095
|
+
* GET /api/org
|
|
1096
|
+
* Get current user's default org
|
|
1097
|
+
*/
|
|
1098
|
+
get: {
|
|
1099
|
+
method: "GET",
|
|
1100
|
+
path: "/api/org",
|
|
1101
|
+
headers: authHeadersSchema,
|
|
1102
|
+
responses: {
|
|
1103
|
+
200: orgResponseSchema,
|
|
1104
|
+
401: apiErrorSchema,
|
|
1105
|
+
404: apiErrorSchema,
|
|
1106
|
+
500: apiErrorSchema
|
|
1107
|
+
},
|
|
1108
|
+
summary: "Get current user's default org"
|
|
1109
|
+
},
|
|
1110
|
+
/**
|
|
1111
|
+
* PUT /api/org
|
|
1112
|
+
* Update org slug
|
|
1113
|
+
*/
|
|
1114
|
+
update: {
|
|
1115
|
+
method: "PUT",
|
|
1116
|
+
path: "/api/org",
|
|
1117
|
+
headers: authHeadersSchema,
|
|
1118
|
+
body: updateOrgRequestSchema,
|
|
1119
|
+
responses: {
|
|
1120
|
+
200: orgResponseSchema,
|
|
1121
|
+
400: apiErrorSchema,
|
|
1122
|
+
401: apiErrorSchema,
|
|
1123
|
+
403: apiErrorSchema,
|
|
1124
|
+
404: apiErrorSchema,
|
|
1125
|
+
409: apiErrorSchema,
|
|
1126
|
+
500: apiErrorSchema
|
|
1127
|
+
},
|
|
1128
|
+
summary: "Update org slug"
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
var orgDefaultAgentContract = c2.router({
|
|
1132
|
+
/**
|
|
1133
|
+
* PUT /api/orgs/default-agent?org={slug}
|
|
1134
|
+
* Set or unset the default agent for an org.
|
|
1135
|
+
* Only org admins can perform this action.
|
|
1136
|
+
* The agent must belong to the same org.
|
|
1137
|
+
*/
|
|
1138
|
+
setDefaultAgent: {
|
|
1139
|
+
method: "PUT",
|
|
1140
|
+
path: "/api/orgs/default-agent",
|
|
1141
|
+
headers: authHeadersSchema,
|
|
1142
|
+
query: z4.object({
|
|
1143
|
+
org: z4.string().optional()
|
|
1144
|
+
}),
|
|
1145
|
+
body: z4.object({
|
|
1146
|
+
agentComposeId: z4.string().uuid().nullable()
|
|
1147
|
+
}),
|
|
1148
|
+
responses: {
|
|
1149
|
+
200: z4.object({
|
|
1150
|
+
agentComposeId: z4.string().uuid().nullable()
|
|
1151
|
+
}),
|
|
1152
|
+
400: apiErrorSchema,
|
|
1153
|
+
401: apiErrorSchema,
|
|
1154
|
+
403: apiErrorSchema,
|
|
1155
|
+
404: apiErrorSchema
|
|
1156
|
+
},
|
|
1157
|
+
summary: "Set or unset the default agent for an org"
|
|
1158
|
+
}
|
|
1159
|
+
});
|
|
1160
|
+
|
|
1161
|
+
// ../../packages/core/src/contracts/runs.ts
|
|
1162
|
+
var c3 = initContract();
|
|
1076
1163
|
var ALL_RUN_STATUSES = [
|
|
1077
1164
|
"queued",
|
|
1078
1165
|
"pending",
|
|
@@ -1082,94 +1169,97 @@ var ALL_RUN_STATUSES = [
|
|
|
1082
1169
|
"timeout",
|
|
1083
1170
|
"cancelled"
|
|
1084
1171
|
];
|
|
1085
|
-
var runStatusSchema =
|
|
1086
|
-
var unifiedRunRequestSchema =
|
|
1172
|
+
var runStatusSchema = z5.enum(ALL_RUN_STATUSES);
|
|
1173
|
+
var unifiedRunRequestSchema = z5.object({
|
|
1087
1174
|
// High-level shortcuts (mutually exclusive with each other)
|
|
1088
|
-
checkpointId:
|
|
1089
|
-
sessionId:
|
|
1175
|
+
checkpointId: z5.string().optional(),
|
|
1176
|
+
sessionId: z5.string().optional(),
|
|
1090
1177
|
// Base parameters (can be used directly or overridden after shortcut expansion)
|
|
1091
|
-
agentComposeId:
|
|
1092
|
-
agentComposeVersionId:
|
|
1093
|
-
conversationId:
|
|
1094
|
-
artifactName:
|
|
1095
|
-
artifactVersion:
|
|
1096
|
-
vars:
|
|
1097
|
-
secrets:
|
|
1098
|
-
volumeVersions:
|
|
1099
|
-
memoryName:
|
|
1178
|
+
agentComposeId: z5.string().optional(),
|
|
1179
|
+
agentComposeVersionId: z5.string().optional(),
|
|
1180
|
+
conversationId: z5.string().optional(),
|
|
1181
|
+
artifactName: z5.string().optional(),
|
|
1182
|
+
artifactVersion: z5.string().optional(),
|
|
1183
|
+
vars: z5.record(z5.string(), z5.string()).optional(),
|
|
1184
|
+
secrets: z5.record(z5.string(), z5.string()).optional(),
|
|
1185
|
+
volumeVersions: z5.record(z5.string(), z5.string()).optional(),
|
|
1186
|
+
memoryName: z5.string().optional(),
|
|
1100
1187
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
1101
|
-
debugNoMockClaude:
|
|
1188
|
+
debugNoMockClaude: z5.boolean().optional(),
|
|
1102
1189
|
// Model provider for automatic secret injection
|
|
1103
|
-
modelProvider:
|
|
1190
|
+
modelProvider: z5.string().optional(),
|
|
1104
1191
|
// Environment validation flag - when true, validates secrets/vars before running
|
|
1105
|
-
checkEnv:
|
|
1192
|
+
checkEnv: z5.boolean().optional(),
|
|
1106
1193
|
// Required
|
|
1107
|
-
prompt:
|
|
1194
|
+
prompt: z5.string().min(1, "Missing prompt")
|
|
1108
1195
|
});
|
|
1109
|
-
var createRunResponseSchema =
|
|
1110
|
-
runId:
|
|
1196
|
+
var createRunResponseSchema = z5.object({
|
|
1197
|
+
runId: z5.string(),
|
|
1111
1198
|
status: runStatusSchema,
|
|
1112
|
-
sandboxId:
|
|
1113
|
-
output:
|
|
1114
|
-
error:
|
|
1115
|
-
executionTimeMs:
|
|
1116
|
-
createdAt:
|
|
1199
|
+
sandboxId: z5.string().optional(),
|
|
1200
|
+
output: z5.string().optional(),
|
|
1201
|
+
error: z5.string().optional(),
|
|
1202
|
+
executionTimeMs: z5.number().optional(),
|
|
1203
|
+
createdAt: z5.string()
|
|
1117
1204
|
});
|
|
1118
|
-
var getRunResponseSchema =
|
|
1119
|
-
runId:
|
|
1120
|
-
agentComposeVersionId:
|
|
1205
|
+
var getRunResponseSchema = z5.object({
|
|
1206
|
+
runId: z5.string(),
|
|
1207
|
+
agentComposeVersionId: z5.string().nullable(),
|
|
1121
1208
|
status: runStatusSchema,
|
|
1122
|
-
prompt:
|
|
1123
|
-
vars:
|
|
1124
|
-
sandboxId:
|
|
1125
|
-
result:
|
|
1126
|
-
output:
|
|
1127
|
-
executionTimeMs:
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1209
|
+
prompt: z5.string(),
|
|
1210
|
+
vars: z5.record(z5.string(), z5.string()).optional(),
|
|
1211
|
+
sandboxId: z5.string().optional(),
|
|
1212
|
+
result: z5.object({
|
|
1213
|
+
output: z5.string().optional(),
|
|
1214
|
+
executionTimeMs: z5.number().optional(),
|
|
1215
|
+
agentSessionId: z5.string().optional(),
|
|
1216
|
+
checkpointId: z5.string().optional(),
|
|
1217
|
+
conversationId: z5.string().optional()
|
|
1218
|
+
}).passthrough().optional(),
|
|
1219
|
+
error: z5.string().optional(),
|
|
1220
|
+
createdAt: z5.string(),
|
|
1221
|
+
startedAt: z5.string().optional(),
|
|
1222
|
+
completedAt: z5.string().optional()
|
|
1133
1223
|
});
|
|
1134
|
-
var runEventSchema =
|
|
1135
|
-
sequenceNumber:
|
|
1136
|
-
eventType:
|
|
1137
|
-
eventData:
|
|
1138
|
-
createdAt:
|
|
1224
|
+
var runEventSchema = z5.object({
|
|
1225
|
+
sequenceNumber: z5.number(),
|
|
1226
|
+
eventType: z5.string(),
|
|
1227
|
+
eventData: z5.unknown(),
|
|
1228
|
+
createdAt: z5.string()
|
|
1139
1229
|
});
|
|
1140
|
-
var runResultSchema =
|
|
1141
|
-
checkpointId:
|
|
1142
|
-
agentSessionId:
|
|
1143
|
-
conversationId:
|
|
1144
|
-
artifact:
|
|
1230
|
+
var runResultSchema = z5.object({
|
|
1231
|
+
checkpointId: z5.string(),
|
|
1232
|
+
agentSessionId: z5.string(),
|
|
1233
|
+
conversationId: z5.string(),
|
|
1234
|
+
artifact: z5.record(z5.string(), z5.string()).optional(),
|
|
1145
1235
|
// optional when run has no artifact
|
|
1146
|
-
volumes:
|
|
1147
|
-
memory:
|
|
1236
|
+
volumes: z5.record(z5.string(), z5.string()).optional(),
|
|
1237
|
+
memory: z5.record(z5.string(), z5.string()).optional()
|
|
1148
1238
|
});
|
|
1149
|
-
var runStateSchema =
|
|
1239
|
+
var runStateSchema = z5.object({
|
|
1150
1240
|
status: runStatusSchema,
|
|
1151
1241
|
result: runResultSchema.optional(),
|
|
1152
|
-
error:
|
|
1242
|
+
error: z5.string().optional()
|
|
1153
1243
|
});
|
|
1154
|
-
var eventsResponseSchema =
|
|
1155
|
-
events:
|
|
1156
|
-
hasMore:
|
|
1157
|
-
nextSequence:
|
|
1244
|
+
var eventsResponseSchema = z5.object({
|
|
1245
|
+
events: z5.array(runEventSchema),
|
|
1246
|
+
hasMore: z5.boolean(),
|
|
1247
|
+
nextSequence: z5.number(),
|
|
1158
1248
|
run: runStateSchema,
|
|
1159
|
-
framework:
|
|
1249
|
+
framework: z5.string()
|
|
1160
1250
|
});
|
|
1161
|
-
var runListItemSchema =
|
|
1162
|
-
id:
|
|
1163
|
-
agentName:
|
|
1251
|
+
var runListItemSchema = z5.object({
|
|
1252
|
+
id: z5.string(),
|
|
1253
|
+
agentName: z5.string(),
|
|
1164
1254
|
status: runStatusSchema,
|
|
1165
|
-
prompt:
|
|
1166
|
-
createdAt:
|
|
1167
|
-
startedAt:
|
|
1255
|
+
prompt: z5.string(),
|
|
1256
|
+
createdAt: z5.string(),
|
|
1257
|
+
startedAt: z5.string().nullable()
|
|
1168
1258
|
});
|
|
1169
|
-
var runsListResponseSchema =
|
|
1170
|
-
runs:
|
|
1259
|
+
var runsListResponseSchema = z5.object({
|
|
1260
|
+
runs: z5.array(runListItemSchema)
|
|
1171
1261
|
});
|
|
1172
|
-
var runsMainContract =
|
|
1262
|
+
var runsMainContract = c3.router({
|
|
1173
1263
|
/**
|
|
1174
1264
|
* GET /api/agent/runs
|
|
1175
1265
|
* List agent runs (pending and running by default)
|
|
@@ -1178,16 +1268,16 @@ var runsMainContract = c2.router({
|
|
|
1178
1268
|
method: "GET",
|
|
1179
1269
|
path: "/api/agent/runs",
|
|
1180
1270
|
headers: authHeadersSchema,
|
|
1181
|
-
query:
|
|
1182
|
-
status:
|
|
1271
|
+
query: z5.object({
|
|
1272
|
+
status: z5.string().optional(),
|
|
1183
1273
|
// comma-separated: "pending,running"
|
|
1184
|
-
agent:
|
|
1274
|
+
agent: z5.string().optional(),
|
|
1185
1275
|
// agent name filter
|
|
1186
|
-
since:
|
|
1276
|
+
since: z5.string().optional(),
|
|
1187
1277
|
// ISO timestamp
|
|
1188
|
-
until:
|
|
1278
|
+
until: z5.string().optional(),
|
|
1189
1279
|
// ISO timestamp
|
|
1190
|
-
limit:
|
|
1280
|
+
limit: z5.coerce.number().min(1).max(100).default(50)
|
|
1191
1281
|
}),
|
|
1192
1282
|
responses: {
|
|
1193
1283
|
200: runsListResponseSchema,
|
|
@@ -1214,7 +1304,7 @@ var runsMainContract = c2.router({
|
|
|
1214
1304
|
summary: "Create and execute agent run"
|
|
1215
1305
|
}
|
|
1216
1306
|
});
|
|
1217
|
-
var runsByIdContract =
|
|
1307
|
+
var runsByIdContract = c3.router({
|
|
1218
1308
|
/**
|
|
1219
1309
|
* GET /api/agent/runs/:id
|
|
1220
1310
|
* Get agent run status and results
|
|
@@ -1223,8 +1313,8 @@ var runsByIdContract = c2.router({
|
|
|
1223
1313
|
method: "GET",
|
|
1224
1314
|
path: "/api/agent/runs/:id",
|
|
1225
1315
|
headers: authHeadersSchema,
|
|
1226
|
-
pathParams:
|
|
1227
|
-
id:
|
|
1316
|
+
pathParams: z5.object({
|
|
1317
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1228
1318
|
}),
|
|
1229
1319
|
responses: {
|
|
1230
1320
|
200: getRunResponseSchema,
|
|
@@ -1235,12 +1325,12 @@ var runsByIdContract = c2.router({
|
|
|
1235
1325
|
summary: "Get agent run by ID"
|
|
1236
1326
|
}
|
|
1237
1327
|
});
|
|
1238
|
-
var cancelRunResponseSchema =
|
|
1239
|
-
id:
|
|
1240
|
-
status:
|
|
1241
|
-
message:
|
|
1328
|
+
var cancelRunResponseSchema = z5.object({
|
|
1329
|
+
id: z5.string(),
|
|
1330
|
+
status: z5.literal("cancelled"),
|
|
1331
|
+
message: z5.string()
|
|
1242
1332
|
});
|
|
1243
|
-
var runsCancelContract =
|
|
1333
|
+
var runsCancelContract = c3.router({
|
|
1244
1334
|
/**
|
|
1245
1335
|
* POST /api/agent/runs/:id/cancel
|
|
1246
1336
|
* Cancel a pending or running run
|
|
@@ -1249,10 +1339,10 @@ var runsCancelContract = c2.router({
|
|
|
1249
1339
|
method: "POST",
|
|
1250
1340
|
path: "/api/agent/runs/:id/cancel",
|
|
1251
1341
|
headers: authHeadersSchema,
|
|
1252
|
-
pathParams:
|
|
1253
|
-
id:
|
|
1342
|
+
pathParams: z5.object({
|
|
1343
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1254
1344
|
}),
|
|
1255
|
-
body:
|
|
1345
|
+
body: z5.undefined(),
|
|
1256
1346
|
responses: {
|
|
1257
1347
|
200: cancelRunResponseSchema,
|
|
1258
1348
|
400: apiErrorSchema,
|
|
@@ -1262,7 +1352,7 @@ var runsCancelContract = c2.router({
|
|
|
1262
1352
|
summary: "Cancel a pending or running run"
|
|
1263
1353
|
}
|
|
1264
1354
|
});
|
|
1265
|
-
var runEventsContract =
|
|
1355
|
+
var runEventsContract = c3.router({
|
|
1266
1356
|
/**
|
|
1267
1357
|
* GET /api/agent/runs/:id/events
|
|
1268
1358
|
* Poll for agent run events with pagination
|
|
@@ -1271,12 +1361,12 @@ var runEventsContract = c2.router({
|
|
|
1271
1361
|
method: "GET",
|
|
1272
1362
|
path: "/api/agent/runs/:id/events",
|
|
1273
1363
|
headers: authHeadersSchema,
|
|
1274
|
-
pathParams:
|
|
1275
|
-
id:
|
|
1364
|
+
pathParams: z5.object({
|
|
1365
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1276
1366
|
}),
|
|
1277
|
-
query:
|
|
1278
|
-
since:
|
|
1279
|
-
limit:
|
|
1367
|
+
query: z5.object({
|
|
1368
|
+
since: z5.coerce.number().default(-1),
|
|
1369
|
+
limit: z5.coerce.number().default(100)
|
|
1280
1370
|
}),
|
|
1281
1371
|
responses: {
|
|
1282
1372
|
200: eventsResponseSchema,
|
|
@@ -1286,50 +1376,50 @@ var runEventsContract = c2.router({
|
|
|
1286
1376
|
summary: "Get agent run events"
|
|
1287
1377
|
}
|
|
1288
1378
|
});
|
|
1289
|
-
var telemetryMetricSchema =
|
|
1290
|
-
ts:
|
|
1291
|
-
cpu:
|
|
1292
|
-
mem_used:
|
|
1293
|
-
mem_total:
|
|
1294
|
-
disk_used:
|
|
1295
|
-
disk_total:
|
|
1379
|
+
var telemetryMetricSchema = z5.object({
|
|
1380
|
+
ts: z5.string(),
|
|
1381
|
+
cpu: z5.number(),
|
|
1382
|
+
mem_used: z5.number(),
|
|
1383
|
+
mem_total: z5.number(),
|
|
1384
|
+
disk_used: z5.number(),
|
|
1385
|
+
disk_total: z5.number()
|
|
1296
1386
|
});
|
|
1297
|
-
var systemLogResponseSchema =
|
|
1298
|
-
systemLog:
|
|
1299
|
-
hasMore:
|
|
1387
|
+
var systemLogResponseSchema = z5.object({
|
|
1388
|
+
systemLog: z5.string(),
|
|
1389
|
+
hasMore: z5.boolean()
|
|
1300
1390
|
});
|
|
1301
|
-
var metricsResponseSchema =
|
|
1302
|
-
metrics:
|
|
1303
|
-
hasMore:
|
|
1391
|
+
var metricsResponseSchema = z5.object({
|
|
1392
|
+
metrics: z5.array(telemetryMetricSchema),
|
|
1393
|
+
hasMore: z5.boolean()
|
|
1304
1394
|
});
|
|
1305
|
-
var agentEventsResponseSchema =
|
|
1306
|
-
events:
|
|
1307
|
-
hasMore:
|
|
1308
|
-
framework:
|
|
1395
|
+
var agentEventsResponseSchema = z5.object({
|
|
1396
|
+
events: z5.array(runEventSchema),
|
|
1397
|
+
hasMore: z5.boolean(),
|
|
1398
|
+
framework: z5.string()
|
|
1309
1399
|
});
|
|
1310
|
-
var networkLogEntrySchema =
|
|
1311
|
-
timestamp:
|
|
1312
|
-
mode:
|
|
1313
|
-
action:
|
|
1314
|
-
host:
|
|
1315
|
-
port:
|
|
1316
|
-
rule_matched:
|
|
1317
|
-
method:
|
|
1318
|
-
url:
|
|
1319
|
-
status:
|
|
1320
|
-
latency_ms:
|
|
1321
|
-
request_size:
|
|
1322
|
-
response_size:
|
|
1400
|
+
var networkLogEntrySchema = z5.object({
|
|
1401
|
+
timestamp: z5.string(),
|
|
1402
|
+
mode: z5.literal("mitm").optional(),
|
|
1403
|
+
action: z5.enum(["ALLOW", "DENY"]).optional(),
|
|
1404
|
+
host: z5.string().optional(),
|
|
1405
|
+
port: z5.number().optional(),
|
|
1406
|
+
rule_matched: z5.string().nullable().optional(),
|
|
1407
|
+
method: z5.string().optional(),
|
|
1408
|
+
url: z5.string().optional(),
|
|
1409
|
+
status: z5.number().optional(),
|
|
1410
|
+
latency_ms: z5.number().optional(),
|
|
1411
|
+
request_size: z5.number().optional(),
|
|
1412
|
+
response_size: z5.number().optional()
|
|
1323
1413
|
});
|
|
1324
|
-
var networkLogsResponseSchema =
|
|
1325
|
-
networkLogs:
|
|
1326
|
-
hasMore:
|
|
1414
|
+
var networkLogsResponseSchema = z5.object({
|
|
1415
|
+
networkLogs: z5.array(networkLogEntrySchema),
|
|
1416
|
+
hasMore: z5.boolean()
|
|
1327
1417
|
});
|
|
1328
|
-
var telemetryResponseSchema =
|
|
1329
|
-
systemLog:
|
|
1330
|
-
metrics:
|
|
1418
|
+
var telemetryResponseSchema = z5.object({
|
|
1419
|
+
systemLog: z5.string(),
|
|
1420
|
+
metrics: z5.array(telemetryMetricSchema)
|
|
1331
1421
|
});
|
|
1332
|
-
var runTelemetryContract =
|
|
1422
|
+
var runTelemetryContract = c3.router({
|
|
1333
1423
|
/**
|
|
1334
1424
|
* GET /api/agent/runs/:id/telemetry
|
|
1335
1425
|
* Get aggregated telemetry data for a run (legacy combined format)
|
|
@@ -1338,8 +1428,8 @@ var runTelemetryContract = c2.router({
|
|
|
1338
1428
|
method: "GET",
|
|
1339
1429
|
path: "/api/agent/runs/:id/telemetry",
|
|
1340
1430
|
headers: authHeadersSchema,
|
|
1341
|
-
pathParams:
|
|
1342
|
-
id:
|
|
1431
|
+
pathParams: z5.object({
|
|
1432
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1343
1433
|
}),
|
|
1344
1434
|
responses: {
|
|
1345
1435
|
200: telemetryResponseSchema,
|
|
@@ -1349,7 +1439,7 @@ var runTelemetryContract = c2.router({
|
|
|
1349
1439
|
summary: "Get run telemetry data"
|
|
1350
1440
|
}
|
|
1351
1441
|
});
|
|
1352
|
-
var runSystemLogContract =
|
|
1442
|
+
var runSystemLogContract = c3.router({
|
|
1353
1443
|
/**
|
|
1354
1444
|
* GET /api/agent/runs/:id/telemetry/system-log
|
|
1355
1445
|
* Get system log with pagination
|
|
@@ -1358,13 +1448,13 @@ var runSystemLogContract = c2.router({
|
|
|
1358
1448
|
method: "GET",
|
|
1359
1449
|
path: "/api/agent/runs/:id/telemetry/system-log",
|
|
1360
1450
|
headers: authHeadersSchema,
|
|
1361
|
-
pathParams:
|
|
1362
|
-
id:
|
|
1451
|
+
pathParams: z5.object({
|
|
1452
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1363
1453
|
}),
|
|
1364
|
-
query:
|
|
1365
|
-
since:
|
|
1366
|
-
limit:
|
|
1367
|
-
order:
|
|
1454
|
+
query: z5.object({
|
|
1455
|
+
since: z5.coerce.number().optional(),
|
|
1456
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
1457
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
1368
1458
|
}),
|
|
1369
1459
|
responses: {
|
|
1370
1460
|
200: systemLogResponseSchema,
|
|
@@ -1374,7 +1464,7 @@ var runSystemLogContract = c2.router({
|
|
|
1374
1464
|
summary: "Get system log with pagination"
|
|
1375
1465
|
}
|
|
1376
1466
|
});
|
|
1377
|
-
var runMetricsContract =
|
|
1467
|
+
var runMetricsContract = c3.router({
|
|
1378
1468
|
/**
|
|
1379
1469
|
* GET /api/agent/runs/:id/telemetry/metrics
|
|
1380
1470
|
* Get metrics with pagination
|
|
@@ -1383,13 +1473,13 @@ var runMetricsContract = c2.router({
|
|
|
1383
1473
|
method: "GET",
|
|
1384
1474
|
path: "/api/agent/runs/:id/telemetry/metrics",
|
|
1385
1475
|
headers: authHeadersSchema,
|
|
1386
|
-
pathParams:
|
|
1387
|
-
id:
|
|
1476
|
+
pathParams: z5.object({
|
|
1477
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1388
1478
|
}),
|
|
1389
|
-
query:
|
|
1390
|
-
since:
|
|
1391
|
-
limit:
|
|
1392
|
-
order:
|
|
1479
|
+
query: z5.object({
|
|
1480
|
+
since: z5.coerce.number().optional(),
|
|
1481
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
1482
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
1393
1483
|
}),
|
|
1394
1484
|
responses: {
|
|
1395
1485
|
200: metricsResponseSchema,
|
|
@@ -1399,7 +1489,7 @@ var runMetricsContract = c2.router({
|
|
|
1399
1489
|
summary: "Get metrics with pagination"
|
|
1400
1490
|
}
|
|
1401
1491
|
});
|
|
1402
|
-
var runAgentEventsContract =
|
|
1492
|
+
var runAgentEventsContract = c3.router({
|
|
1403
1493
|
/**
|
|
1404
1494
|
* GET /api/agent/runs/:id/telemetry/agent
|
|
1405
1495
|
* Get agent events with pagination (for vm0 logs default)
|
|
@@ -1408,13 +1498,13 @@ var runAgentEventsContract = c2.router({
|
|
|
1408
1498
|
method: "GET",
|
|
1409
1499
|
path: "/api/agent/runs/:id/telemetry/agent",
|
|
1410
1500
|
headers: authHeadersSchema,
|
|
1411
|
-
pathParams:
|
|
1412
|
-
id:
|
|
1501
|
+
pathParams: z5.object({
|
|
1502
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1413
1503
|
}),
|
|
1414
|
-
query:
|
|
1415
|
-
since:
|
|
1416
|
-
limit:
|
|
1417
|
-
order:
|
|
1504
|
+
query: z5.object({
|
|
1505
|
+
since: z5.coerce.number().optional(),
|
|
1506
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
1507
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
1418
1508
|
}),
|
|
1419
1509
|
responses: {
|
|
1420
1510
|
200: agentEventsResponseSchema,
|
|
@@ -1424,7 +1514,7 @@ var runAgentEventsContract = c2.router({
|
|
|
1424
1514
|
summary: "Get agent events with pagination"
|
|
1425
1515
|
}
|
|
1426
1516
|
});
|
|
1427
|
-
var runNetworkLogsContract =
|
|
1517
|
+
var runNetworkLogsContract = c3.router({
|
|
1428
1518
|
/**
|
|
1429
1519
|
* GET /api/agent/runs/:id/telemetry/network
|
|
1430
1520
|
* Get network logs with pagination (for vm0 logs --network)
|
|
@@ -1433,13 +1523,13 @@ var runNetworkLogsContract = c2.router({
|
|
|
1433
1523
|
method: "GET",
|
|
1434
1524
|
path: "/api/agent/runs/:id/telemetry/network",
|
|
1435
1525
|
headers: authHeadersSchema,
|
|
1436
|
-
pathParams:
|
|
1437
|
-
id:
|
|
1526
|
+
pathParams: z5.object({
|
|
1527
|
+
id: z5.string().min(1, "Run ID is required")
|
|
1438
1528
|
}),
|
|
1439
|
-
query:
|
|
1440
|
-
since:
|
|
1441
|
-
limit:
|
|
1442
|
-
order:
|
|
1529
|
+
query: z5.object({
|
|
1530
|
+
since: z5.coerce.number().optional(),
|
|
1531
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
1532
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
1443
1533
|
}),
|
|
1444
1534
|
responses: {
|
|
1445
1535
|
200: networkLogsResponseSchema,
|
|
@@ -1449,18 +1539,18 @@ var runNetworkLogsContract = c2.router({
|
|
|
1449
1539
|
summary: "Get network logs with pagination"
|
|
1450
1540
|
}
|
|
1451
1541
|
});
|
|
1452
|
-
var searchResultSchema =
|
|
1453
|
-
runId:
|
|
1454
|
-
agentName:
|
|
1542
|
+
var searchResultSchema = z5.object({
|
|
1543
|
+
runId: z5.string(),
|
|
1544
|
+
agentName: z5.string(),
|
|
1455
1545
|
matchedEvent: runEventSchema,
|
|
1456
|
-
contextBefore:
|
|
1457
|
-
contextAfter:
|
|
1546
|
+
contextBefore: z5.array(runEventSchema),
|
|
1547
|
+
contextAfter: z5.array(runEventSchema)
|
|
1458
1548
|
});
|
|
1459
|
-
var logsSearchResponseSchema =
|
|
1460
|
-
results:
|
|
1461
|
-
hasMore:
|
|
1549
|
+
var logsSearchResponseSchema = z5.object({
|
|
1550
|
+
results: z5.array(searchResultSchema),
|
|
1551
|
+
hasMore: z5.boolean()
|
|
1462
1552
|
});
|
|
1463
|
-
var logsSearchContract =
|
|
1553
|
+
var logsSearchContract = c3.router({
|
|
1464
1554
|
/**
|
|
1465
1555
|
* GET /api/logs/search
|
|
1466
1556
|
* Search agent events across runs using keyword matching
|
|
@@ -1469,14 +1559,14 @@ var logsSearchContract = c2.router({
|
|
|
1469
1559
|
method: "GET",
|
|
1470
1560
|
path: "/api/logs/search",
|
|
1471
1561
|
headers: authHeadersSchema,
|
|
1472
|
-
query:
|
|
1473
|
-
keyword:
|
|
1474
|
-
agent:
|
|
1475
|
-
runId:
|
|
1476
|
-
since:
|
|
1477
|
-
limit:
|
|
1478
|
-
before:
|
|
1479
|
-
after:
|
|
1562
|
+
query: z5.object({
|
|
1563
|
+
keyword: z5.string().min(1),
|
|
1564
|
+
agent: z5.string().optional(),
|
|
1565
|
+
runId: z5.string().optional(),
|
|
1566
|
+
since: z5.coerce.number().optional(),
|
|
1567
|
+
limit: z5.coerce.number().min(1).max(50).default(20),
|
|
1568
|
+
before: z5.coerce.number().min(0).max(10).default(0),
|
|
1569
|
+
after: z5.coerce.number().min(0).max(10).default(0)
|
|
1480
1570
|
}),
|
|
1481
1571
|
responses: {
|
|
1482
1572
|
200: logsSearchResponseSchema,
|
|
@@ -1485,21 +1575,56 @@ var logsSearchContract = c2.router({
|
|
|
1485
1575
|
summary: "Search agent events across runs"
|
|
1486
1576
|
}
|
|
1487
1577
|
});
|
|
1578
|
+
var queueEntrySchema = z5.object({
|
|
1579
|
+
position: z5.number(),
|
|
1580
|
+
agentName: z5.string(),
|
|
1581
|
+
userEmail: z5.string(),
|
|
1582
|
+
createdAt: z5.string(),
|
|
1583
|
+
isOwner: z5.boolean(),
|
|
1584
|
+
runId: z5.string().nullable()
|
|
1585
|
+
});
|
|
1586
|
+
var concurrencyInfoSchema = z5.object({
|
|
1587
|
+
tier: orgTierSchema,
|
|
1588
|
+
limit: z5.number(),
|
|
1589
|
+
active: z5.number(),
|
|
1590
|
+
available: z5.number()
|
|
1591
|
+
});
|
|
1592
|
+
var queueResponseSchema = z5.object({
|
|
1593
|
+
concurrency: concurrencyInfoSchema,
|
|
1594
|
+
queue: z5.array(queueEntrySchema)
|
|
1595
|
+
});
|
|
1596
|
+
var runsQueueContract = c3.router({
|
|
1597
|
+
/**
|
|
1598
|
+
* GET /api/agent/runs/queue
|
|
1599
|
+
* Get org run queue status including concurrency context and queued entries
|
|
1600
|
+
*/
|
|
1601
|
+
getQueue: {
|
|
1602
|
+
method: "GET",
|
|
1603
|
+
path: "/api/agent/runs/queue",
|
|
1604
|
+
headers: authHeadersSchema,
|
|
1605
|
+
responses: {
|
|
1606
|
+
200: queueResponseSchema,
|
|
1607
|
+
401: apiErrorSchema,
|
|
1608
|
+
403: apiErrorSchema
|
|
1609
|
+
},
|
|
1610
|
+
summary: "Get org run queue status"
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1488
1613
|
|
|
1489
1614
|
// ../../packages/core/src/contracts/storages.ts
|
|
1490
|
-
import { z as
|
|
1491
|
-
var
|
|
1492
|
-
var storageTypeSchema =
|
|
1493
|
-
var versionQuerySchema =
|
|
1494
|
-
var uploadStorageResponseSchema =
|
|
1495
|
-
name:
|
|
1496
|
-
versionId:
|
|
1497
|
-
size:
|
|
1498
|
-
fileCount:
|
|
1615
|
+
import { z as z6 } from "zod";
|
|
1616
|
+
var c4 = initContract();
|
|
1617
|
+
var storageTypeSchema = z6.enum(["volume", "artifact", "memory"]);
|
|
1618
|
+
var versionQuerySchema = z6.string().regex(/^[a-f0-9]{8,64}$/i, "Version must be 8-64 hex characters").optional();
|
|
1619
|
+
var uploadStorageResponseSchema = z6.object({
|
|
1620
|
+
name: z6.string(),
|
|
1621
|
+
versionId: z6.string(),
|
|
1622
|
+
size: z6.number(),
|
|
1623
|
+
fileCount: z6.number(),
|
|
1499
1624
|
type: storageTypeSchema,
|
|
1500
|
-
deduplicated:
|
|
1625
|
+
deduplicated: z6.boolean()
|
|
1501
1626
|
});
|
|
1502
|
-
var storagesContract =
|
|
1627
|
+
var storagesContract = c4.router({
|
|
1503
1628
|
/**
|
|
1504
1629
|
* POST /api/storages
|
|
1505
1630
|
* Upload a storage (tar.gz file)
|
|
@@ -1516,7 +1641,7 @@ var storagesContract = c3.router({
|
|
|
1516
1641
|
path: "/api/storages",
|
|
1517
1642
|
headers: authHeadersSchema,
|
|
1518
1643
|
contentType: "multipart/form-data",
|
|
1519
|
-
body:
|
|
1644
|
+
body: c4.type(),
|
|
1520
1645
|
responses: {
|
|
1521
1646
|
200: uploadStorageResponseSchema,
|
|
1522
1647
|
400: apiErrorSchema,
|
|
@@ -1539,15 +1664,15 @@ var storagesContract = c3.router({
|
|
|
1539
1664
|
method: "GET",
|
|
1540
1665
|
path: "/api/storages",
|
|
1541
1666
|
headers: authHeadersSchema,
|
|
1542
|
-
query:
|
|
1543
|
-
name:
|
|
1667
|
+
query: z6.object({
|
|
1668
|
+
name: z6.string().min(1, "Storage name is required"),
|
|
1544
1669
|
version: versionQuerySchema
|
|
1545
1670
|
}),
|
|
1546
1671
|
responses: {
|
|
1547
1672
|
// Binary response - actual handling done at route level
|
|
1548
|
-
200:
|
|
1673
|
+
200: c4.otherResponse({
|
|
1549
1674
|
contentType: "application/gzip",
|
|
1550
|
-
body:
|
|
1675
|
+
body: c4.type()
|
|
1551
1676
|
}),
|
|
1552
1677
|
400: apiErrorSchema,
|
|
1553
1678
|
401: apiErrorSchema,
|
|
@@ -1558,41 +1683,41 @@ var storagesContract = c3.router({
|
|
|
1558
1683
|
}
|
|
1559
1684
|
});
|
|
1560
1685
|
var MAX_FILE_SIZE_BYTES = 104857600;
|
|
1561
|
-
var fileEntryWithHashSchema =
|
|
1562
|
-
path:
|
|
1563
|
-
hash:
|
|
1564
|
-
size:
|
|
1686
|
+
var fileEntryWithHashSchema = z6.object({
|
|
1687
|
+
path: z6.string().min(1, "File path is required"),
|
|
1688
|
+
hash: z6.string().length(64, "Hash must be SHA-256 (64 hex chars)"),
|
|
1689
|
+
size: z6.number().int().min(0, "Size must be non-negative").max(MAX_FILE_SIZE_BYTES, "File size exceeds 100MB limit")
|
|
1565
1690
|
});
|
|
1566
|
-
var storageChangesSchema =
|
|
1567
|
-
added:
|
|
1568
|
-
modified:
|
|
1569
|
-
deleted:
|
|
1691
|
+
var storageChangesSchema = z6.object({
|
|
1692
|
+
added: z6.array(z6.string()),
|
|
1693
|
+
modified: z6.array(z6.string()),
|
|
1694
|
+
deleted: z6.array(z6.string())
|
|
1570
1695
|
});
|
|
1571
|
-
var presignedUploadSchema =
|
|
1572
|
-
key:
|
|
1573
|
-
presignedUrl:
|
|
1696
|
+
var presignedUploadSchema = z6.object({
|
|
1697
|
+
key: z6.string(),
|
|
1698
|
+
presignedUrl: z6.string().url()
|
|
1574
1699
|
});
|
|
1575
|
-
var storagesPrepareContract =
|
|
1700
|
+
var storagesPrepareContract = c4.router({
|
|
1576
1701
|
prepare: {
|
|
1577
1702
|
method: "POST",
|
|
1578
1703
|
path: "/api/storages/prepare",
|
|
1579
1704
|
headers: authHeadersSchema,
|
|
1580
|
-
body:
|
|
1581
|
-
storageName:
|
|
1705
|
+
body: z6.object({
|
|
1706
|
+
storageName: z6.string().min(1, "Storage name is required"),
|
|
1582
1707
|
storageType: storageTypeSchema,
|
|
1583
|
-
files:
|
|
1584
|
-
force:
|
|
1585
|
-
runId:
|
|
1708
|
+
files: z6.array(fileEntryWithHashSchema),
|
|
1709
|
+
force: z6.boolean().optional(),
|
|
1710
|
+
runId: z6.string().optional(),
|
|
1586
1711
|
// For sandbox auth
|
|
1587
|
-
baseVersion:
|
|
1712
|
+
baseVersion: z6.string().optional(),
|
|
1588
1713
|
// For incremental uploads
|
|
1589
1714
|
changes: storageChangesSchema.optional()
|
|
1590
1715
|
}),
|
|
1591
1716
|
responses: {
|
|
1592
|
-
200:
|
|
1593
|
-
versionId:
|
|
1594
|
-
existing:
|
|
1595
|
-
uploads:
|
|
1717
|
+
200: z6.object({
|
|
1718
|
+
versionId: z6.string(),
|
|
1719
|
+
existing: z6.boolean(),
|
|
1720
|
+
uploads: z6.object({
|
|
1596
1721
|
archive: presignedUploadSchema,
|
|
1597
1722
|
manifest: presignedUploadSchema
|
|
1598
1723
|
}).optional()
|
|
@@ -1606,27 +1731,27 @@ var storagesPrepareContract = c3.router({
|
|
|
1606
1731
|
summary: "Prepare for direct S3 upload"
|
|
1607
1732
|
}
|
|
1608
1733
|
});
|
|
1609
|
-
var storagesCommitContract =
|
|
1734
|
+
var storagesCommitContract = c4.router({
|
|
1610
1735
|
commit: {
|
|
1611
1736
|
method: "POST",
|
|
1612
1737
|
path: "/api/storages/commit",
|
|
1613
1738
|
headers: authHeadersSchema,
|
|
1614
|
-
body:
|
|
1615
|
-
storageName:
|
|
1739
|
+
body: z6.object({
|
|
1740
|
+
storageName: z6.string().min(1, "Storage name is required"),
|
|
1616
1741
|
storageType: storageTypeSchema,
|
|
1617
|
-
versionId:
|
|
1618
|
-
files:
|
|
1619
|
-
runId:
|
|
1620
|
-
message:
|
|
1742
|
+
versionId: z6.string().min(1, "Version ID is required"),
|
|
1743
|
+
files: z6.array(fileEntryWithHashSchema),
|
|
1744
|
+
runId: z6.string().optional(),
|
|
1745
|
+
message: z6.string().optional()
|
|
1621
1746
|
}),
|
|
1622
1747
|
responses: {
|
|
1623
|
-
200:
|
|
1624
|
-
success:
|
|
1625
|
-
versionId:
|
|
1626
|
-
storageName:
|
|
1627
|
-
size:
|
|
1628
|
-
fileCount:
|
|
1629
|
-
deduplicated:
|
|
1748
|
+
200: z6.object({
|
|
1749
|
+
success: z6.literal(true),
|
|
1750
|
+
versionId: z6.string(),
|
|
1751
|
+
storageName: z6.string(),
|
|
1752
|
+
size: z6.number(),
|
|
1753
|
+
fileCount: z6.number(),
|
|
1754
|
+
deduplicated: z6.boolean().optional()
|
|
1630
1755
|
}),
|
|
1631
1756
|
400: apiErrorSchema,
|
|
1632
1757
|
401: apiErrorSchema,
|
|
@@ -1639,31 +1764,31 @@ var storagesCommitContract = c3.router({
|
|
|
1639
1764
|
summary: "Commit uploaded storage"
|
|
1640
1765
|
}
|
|
1641
1766
|
});
|
|
1642
|
-
var storagesDownloadContract =
|
|
1767
|
+
var storagesDownloadContract = c4.router({
|
|
1643
1768
|
download: {
|
|
1644
1769
|
method: "GET",
|
|
1645
1770
|
path: "/api/storages/download",
|
|
1646
1771
|
headers: authHeadersSchema,
|
|
1647
|
-
query:
|
|
1648
|
-
name:
|
|
1772
|
+
query: z6.object({
|
|
1773
|
+
name: z6.string().min(1, "Storage name is required"),
|
|
1649
1774
|
type: storageTypeSchema,
|
|
1650
1775
|
version: versionQuerySchema
|
|
1651
1776
|
}),
|
|
1652
1777
|
responses: {
|
|
1653
1778
|
// Normal response with presigned URL
|
|
1654
|
-
200:
|
|
1655
|
-
|
|
1656
|
-
url:
|
|
1657
|
-
versionId:
|
|
1658
|
-
fileCount:
|
|
1659
|
-
size:
|
|
1779
|
+
200: z6.union([
|
|
1780
|
+
z6.object({
|
|
1781
|
+
url: z6.string().url(),
|
|
1782
|
+
versionId: z6.string(),
|
|
1783
|
+
fileCount: z6.number(),
|
|
1784
|
+
size: z6.number()
|
|
1660
1785
|
}),
|
|
1661
1786
|
// Empty artifact response
|
|
1662
|
-
|
|
1663
|
-
empty:
|
|
1664
|
-
versionId:
|
|
1665
|
-
fileCount:
|
|
1666
|
-
size:
|
|
1787
|
+
z6.object({
|
|
1788
|
+
empty: z6.literal(true),
|
|
1789
|
+
versionId: z6.string(),
|
|
1790
|
+
fileCount: z6.literal(0),
|
|
1791
|
+
size: z6.literal(0)
|
|
1667
1792
|
})
|
|
1668
1793
|
]),
|
|
1669
1794
|
400: apiErrorSchema,
|
|
@@ -1674,21 +1799,21 @@ var storagesDownloadContract = c3.router({
|
|
|
1674
1799
|
summary: "Get presigned download URL"
|
|
1675
1800
|
}
|
|
1676
1801
|
});
|
|
1677
|
-
var storagesListContract =
|
|
1802
|
+
var storagesListContract = c4.router({
|
|
1678
1803
|
list: {
|
|
1679
1804
|
method: "GET",
|
|
1680
1805
|
path: "/api/storages/list",
|
|
1681
1806
|
headers: authHeadersSchema,
|
|
1682
|
-
query:
|
|
1807
|
+
query: z6.object({
|
|
1683
1808
|
type: storageTypeSchema
|
|
1684
1809
|
}),
|
|
1685
1810
|
responses: {
|
|
1686
|
-
200:
|
|
1687
|
-
|
|
1688
|
-
name:
|
|
1689
|
-
size:
|
|
1690
|
-
fileCount:
|
|
1691
|
-
updatedAt:
|
|
1811
|
+
200: z6.array(
|
|
1812
|
+
z6.object({
|
|
1813
|
+
name: z6.string(),
|
|
1814
|
+
size: z6.number(),
|
|
1815
|
+
fileCount: z6.number(),
|
|
1816
|
+
updatedAt: z6.string()
|
|
1692
1817
|
})
|
|
1693
1818
|
),
|
|
1694
1819
|
401: apiErrorSchema,
|
|
@@ -1699,24 +1824,24 @@ var storagesListContract = c3.router({
|
|
|
1699
1824
|
});
|
|
1700
1825
|
|
|
1701
1826
|
// ../../packages/core/src/contracts/webhooks.ts
|
|
1702
|
-
import { z as
|
|
1703
|
-
var
|
|
1704
|
-
var agentEventSchema =
|
|
1705
|
-
type:
|
|
1706
|
-
sequenceNumber:
|
|
1827
|
+
import { z as z7 } from "zod";
|
|
1828
|
+
var c5 = initContract();
|
|
1829
|
+
var agentEventSchema = z7.object({
|
|
1830
|
+
type: z7.string(),
|
|
1831
|
+
sequenceNumber: z7.number().int().nonnegative()
|
|
1707
1832
|
}).passthrough();
|
|
1708
|
-
var artifactSnapshotSchema =
|
|
1709
|
-
artifactName:
|
|
1710
|
-
artifactVersion:
|
|
1833
|
+
var artifactSnapshotSchema = z7.object({
|
|
1834
|
+
artifactName: z7.string(),
|
|
1835
|
+
artifactVersion: z7.string()
|
|
1711
1836
|
});
|
|
1712
|
-
var memorySnapshotSchema =
|
|
1713
|
-
memoryName:
|
|
1714
|
-
memoryVersion:
|
|
1837
|
+
var memorySnapshotSchema = z7.object({
|
|
1838
|
+
memoryName: z7.string(),
|
|
1839
|
+
memoryVersion: z7.string()
|
|
1715
1840
|
});
|
|
1716
|
-
var volumeVersionsSnapshotSchema =
|
|
1717
|
-
versions:
|
|
1841
|
+
var volumeVersionsSnapshotSchema = z7.object({
|
|
1842
|
+
versions: z7.record(z7.string(), z7.string())
|
|
1718
1843
|
});
|
|
1719
|
-
var webhookEventsContract =
|
|
1844
|
+
var webhookEventsContract = c5.router({
|
|
1720
1845
|
/**
|
|
1721
1846
|
* POST /api/webhooks/agent/events
|
|
1722
1847
|
* Receive agent events from sandbox
|
|
@@ -1725,15 +1850,15 @@ var webhookEventsContract = c4.router({
|
|
|
1725
1850
|
method: "POST",
|
|
1726
1851
|
path: "/api/webhooks/agent/events",
|
|
1727
1852
|
headers: authHeadersSchema,
|
|
1728
|
-
body:
|
|
1729
|
-
runId:
|
|
1730
|
-
events:
|
|
1853
|
+
body: z7.object({
|
|
1854
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1855
|
+
events: z7.array(agentEventSchema).min(1, "events array cannot be empty")
|
|
1731
1856
|
}),
|
|
1732
1857
|
responses: {
|
|
1733
|
-
200:
|
|
1734
|
-
received:
|
|
1735
|
-
firstSequence:
|
|
1736
|
-
lastSequence:
|
|
1858
|
+
200: z7.object({
|
|
1859
|
+
received: z7.number(),
|
|
1860
|
+
firstSequence: z7.number(),
|
|
1861
|
+
lastSequence: z7.number()
|
|
1737
1862
|
}),
|
|
1738
1863
|
400: apiErrorSchema,
|
|
1739
1864
|
401: apiErrorSchema,
|
|
@@ -1743,7 +1868,7 @@ var webhookEventsContract = c4.router({
|
|
|
1743
1868
|
summary: "Receive agent events from sandbox"
|
|
1744
1869
|
}
|
|
1745
1870
|
});
|
|
1746
|
-
var webhookCompleteContract =
|
|
1871
|
+
var webhookCompleteContract = c5.router({
|
|
1747
1872
|
/**
|
|
1748
1873
|
* POST /api/webhooks/agent/complete
|
|
1749
1874
|
* Handle agent run completion (success or failure)
|
|
@@ -1752,15 +1877,15 @@ var webhookCompleteContract = c4.router({
|
|
|
1752
1877
|
method: "POST",
|
|
1753
1878
|
path: "/api/webhooks/agent/complete",
|
|
1754
1879
|
headers: authHeadersSchema,
|
|
1755
|
-
body:
|
|
1756
|
-
runId:
|
|
1757
|
-
exitCode:
|
|
1758
|
-
error:
|
|
1880
|
+
body: z7.object({
|
|
1881
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1882
|
+
exitCode: z7.number(),
|
|
1883
|
+
error: z7.string().optional()
|
|
1759
1884
|
}),
|
|
1760
1885
|
responses: {
|
|
1761
|
-
200:
|
|
1762
|
-
success:
|
|
1763
|
-
status:
|
|
1886
|
+
200: z7.object({
|
|
1887
|
+
success: z7.boolean(),
|
|
1888
|
+
status: z7.enum(["completed", "failed"])
|
|
1764
1889
|
}),
|
|
1765
1890
|
400: apiErrorSchema,
|
|
1766
1891
|
401: apiErrorSchema,
|
|
@@ -1770,7 +1895,7 @@ var webhookCompleteContract = c4.router({
|
|
|
1770
1895
|
summary: "Handle agent run completion"
|
|
1771
1896
|
}
|
|
1772
1897
|
});
|
|
1773
|
-
var webhookCheckpointsContract =
|
|
1898
|
+
var webhookCheckpointsContract = c5.router({
|
|
1774
1899
|
/**
|
|
1775
1900
|
* POST /api/webhooks/agent/checkpoints
|
|
1776
1901
|
* Create checkpoint for completed agent run
|
|
@@ -1779,23 +1904,23 @@ var webhookCheckpointsContract = c4.router({
|
|
|
1779
1904
|
method: "POST",
|
|
1780
1905
|
path: "/api/webhooks/agent/checkpoints",
|
|
1781
1906
|
headers: authHeadersSchema,
|
|
1782
|
-
body:
|
|
1783
|
-
runId:
|
|
1784
|
-
cliAgentType:
|
|
1785
|
-
cliAgentSessionId:
|
|
1786
|
-
cliAgentSessionHistory:
|
|
1907
|
+
body: z7.object({
|
|
1908
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1909
|
+
cliAgentType: z7.string().min(1, "cliAgentType is required"),
|
|
1910
|
+
cliAgentSessionId: z7.string().min(1, "cliAgentSessionId is required"),
|
|
1911
|
+
cliAgentSessionHistory: z7.string().min(1, "cliAgentSessionHistory is required"),
|
|
1787
1912
|
artifactSnapshot: artifactSnapshotSchema.optional(),
|
|
1788
1913
|
memorySnapshot: memorySnapshotSchema.optional(),
|
|
1789
1914
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema.optional()
|
|
1790
1915
|
}),
|
|
1791
1916
|
responses: {
|
|
1792
|
-
200:
|
|
1793
|
-
checkpointId:
|
|
1794
|
-
agentSessionId:
|
|
1795
|
-
conversationId:
|
|
1917
|
+
200: z7.object({
|
|
1918
|
+
checkpointId: z7.string(),
|
|
1919
|
+
agentSessionId: z7.string(),
|
|
1920
|
+
conversationId: z7.string(),
|
|
1796
1921
|
artifact: artifactSnapshotSchema.optional(),
|
|
1797
1922
|
memory: memorySnapshotSchema.optional(),
|
|
1798
|
-
volumes:
|
|
1923
|
+
volumes: z7.record(z7.string(), z7.string()).optional()
|
|
1799
1924
|
}),
|
|
1800
1925
|
400: apiErrorSchema,
|
|
1801
1926
|
401: apiErrorSchema,
|
|
@@ -1805,7 +1930,7 @@ var webhookCheckpointsContract = c4.router({
|
|
|
1805
1930
|
summary: "Create checkpoint for agent run"
|
|
1806
1931
|
}
|
|
1807
1932
|
});
|
|
1808
|
-
var webhookHeartbeatContract =
|
|
1933
|
+
var webhookHeartbeatContract = c5.router({
|
|
1809
1934
|
/**
|
|
1810
1935
|
* POST /api/webhooks/agent/heartbeat
|
|
1811
1936
|
* Receive heartbeat signals from sandbox
|
|
@@ -1814,12 +1939,12 @@ var webhookHeartbeatContract = c4.router({
|
|
|
1814
1939
|
method: "POST",
|
|
1815
1940
|
path: "/api/webhooks/agent/heartbeat",
|
|
1816
1941
|
headers: authHeadersSchema,
|
|
1817
|
-
body:
|
|
1818
|
-
runId:
|
|
1942
|
+
body: z7.object({
|
|
1943
|
+
runId: z7.string().min(1, "runId is required")
|
|
1819
1944
|
}),
|
|
1820
1945
|
responses: {
|
|
1821
|
-
200:
|
|
1822
|
-
ok:
|
|
1946
|
+
200: z7.object({
|
|
1947
|
+
ok: z7.boolean()
|
|
1823
1948
|
}),
|
|
1824
1949
|
400: apiErrorSchema,
|
|
1825
1950
|
401: apiErrorSchema,
|
|
@@ -1829,7 +1954,7 @@ var webhookHeartbeatContract = c4.router({
|
|
|
1829
1954
|
summary: "Receive heartbeat from sandbox"
|
|
1830
1955
|
}
|
|
1831
1956
|
});
|
|
1832
|
-
var webhookStoragesContract =
|
|
1957
|
+
var webhookStoragesContract = c5.router({
|
|
1833
1958
|
/**
|
|
1834
1959
|
* POST /api/webhooks/agent/storages
|
|
1835
1960
|
* Create a new version of a storage from sandbox
|
|
@@ -1845,13 +1970,13 @@ var webhookStoragesContract = c4.router({
|
|
|
1845
1970
|
path: "/api/webhooks/agent/storages",
|
|
1846
1971
|
headers: authHeadersSchema,
|
|
1847
1972
|
contentType: "multipart/form-data",
|
|
1848
|
-
body:
|
|
1973
|
+
body: c5.type(),
|
|
1849
1974
|
responses: {
|
|
1850
|
-
200:
|
|
1851
|
-
versionId:
|
|
1852
|
-
storageName:
|
|
1853
|
-
size:
|
|
1854
|
-
fileCount:
|
|
1975
|
+
200: z7.object({
|
|
1976
|
+
versionId: z7.string(),
|
|
1977
|
+
storageName: z7.string(),
|
|
1978
|
+
size: z7.number(),
|
|
1979
|
+
fileCount: z7.number()
|
|
1855
1980
|
}),
|
|
1856
1981
|
400: apiErrorSchema,
|
|
1857
1982
|
401: apiErrorSchema,
|
|
@@ -1861,7 +1986,7 @@ var webhookStoragesContract = c4.router({
|
|
|
1861
1986
|
summary: "Upload storage version from sandbox"
|
|
1862
1987
|
}
|
|
1863
1988
|
});
|
|
1864
|
-
var webhookStoragesIncrementalContract =
|
|
1989
|
+
var webhookStoragesIncrementalContract = c5.router({
|
|
1865
1990
|
/**
|
|
1866
1991
|
* POST /api/webhooks/agent/storages/incremental
|
|
1867
1992
|
* Create a new version using incremental upload
|
|
@@ -1879,19 +2004,19 @@ var webhookStoragesIncrementalContract = c4.router({
|
|
|
1879
2004
|
path: "/api/webhooks/agent/storages/incremental",
|
|
1880
2005
|
headers: authHeadersSchema,
|
|
1881
2006
|
contentType: "multipart/form-data",
|
|
1882
|
-
body:
|
|
2007
|
+
body: c5.type(),
|
|
1883
2008
|
responses: {
|
|
1884
|
-
200:
|
|
1885
|
-
versionId:
|
|
1886
|
-
storageName:
|
|
1887
|
-
size:
|
|
1888
|
-
fileCount:
|
|
1889
|
-
incrementalStats:
|
|
1890
|
-
addedFiles:
|
|
1891
|
-
modifiedFiles:
|
|
1892
|
-
deletedFiles:
|
|
1893
|
-
unchangedFiles:
|
|
1894
|
-
bytesUploaded:
|
|
2009
|
+
200: z7.object({
|
|
2010
|
+
versionId: z7.string(),
|
|
2011
|
+
storageName: z7.string(),
|
|
2012
|
+
size: z7.number(),
|
|
2013
|
+
fileCount: z7.number(),
|
|
2014
|
+
incrementalStats: z7.object({
|
|
2015
|
+
addedFiles: z7.number(),
|
|
2016
|
+
modifiedFiles: z7.number(),
|
|
2017
|
+
deletedFiles: z7.number(),
|
|
2018
|
+
unchangedFiles: z7.number(),
|
|
2019
|
+
bytesUploaded: z7.number()
|
|
1895
2020
|
}).optional()
|
|
1896
2021
|
}),
|
|
1897
2022
|
400: apiErrorSchema,
|
|
@@ -1902,36 +2027,36 @@ var webhookStoragesIncrementalContract = c4.router({
|
|
|
1902
2027
|
summary: "Upload storage version incrementally from sandbox"
|
|
1903
2028
|
}
|
|
1904
2029
|
});
|
|
1905
|
-
var metricDataSchema =
|
|
1906
|
-
ts:
|
|
1907
|
-
cpu:
|
|
1908
|
-
mem_used:
|
|
1909
|
-
mem_total:
|
|
1910
|
-
disk_used:
|
|
1911
|
-
disk_total:
|
|
2030
|
+
var metricDataSchema = z7.object({
|
|
2031
|
+
ts: z7.string(),
|
|
2032
|
+
cpu: z7.number(),
|
|
2033
|
+
mem_used: z7.number(),
|
|
2034
|
+
mem_total: z7.number(),
|
|
2035
|
+
disk_used: z7.number(),
|
|
2036
|
+
disk_total: z7.number()
|
|
1912
2037
|
});
|
|
1913
|
-
var sandboxOperationSchema =
|
|
1914
|
-
ts:
|
|
1915
|
-
action_type:
|
|
1916
|
-
duration_ms:
|
|
1917
|
-
success:
|
|
1918
|
-
error:
|
|
2038
|
+
var sandboxOperationSchema = z7.object({
|
|
2039
|
+
ts: z7.string(),
|
|
2040
|
+
action_type: z7.string(),
|
|
2041
|
+
duration_ms: z7.number(),
|
|
2042
|
+
success: z7.boolean(),
|
|
2043
|
+
error: z7.string().optional()
|
|
1919
2044
|
});
|
|
1920
|
-
var networkLogSchema =
|
|
1921
|
-
timestamp:
|
|
1922
|
-
mode:
|
|
1923
|
-
action:
|
|
1924
|
-
host:
|
|
1925
|
-
port:
|
|
1926
|
-
rule_matched:
|
|
1927
|
-
method:
|
|
1928
|
-
url:
|
|
1929
|
-
status:
|
|
1930
|
-
latency_ms:
|
|
1931
|
-
request_size:
|
|
1932
|
-
response_size:
|
|
2045
|
+
var networkLogSchema = z7.object({
|
|
2046
|
+
timestamp: z7.string(),
|
|
2047
|
+
mode: z7.literal("mitm").optional(),
|
|
2048
|
+
action: z7.enum(["ALLOW", "DENY"]).optional(),
|
|
2049
|
+
host: z7.string().optional(),
|
|
2050
|
+
port: z7.number().optional(),
|
|
2051
|
+
rule_matched: z7.string().nullable().optional(),
|
|
2052
|
+
method: z7.string().optional(),
|
|
2053
|
+
url: z7.string().optional(),
|
|
2054
|
+
status: z7.number().optional(),
|
|
2055
|
+
latency_ms: z7.number().optional(),
|
|
2056
|
+
request_size: z7.number().optional(),
|
|
2057
|
+
response_size: z7.number().optional()
|
|
1933
2058
|
});
|
|
1934
|
-
var webhookTelemetryContract =
|
|
2059
|
+
var webhookTelemetryContract = c5.router({
|
|
1935
2060
|
/**
|
|
1936
2061
|
* POST /api/webhooks/agent/telemetry
|
|
1937
2062
|
* Receive telemetry data (system log, metrics, network logs, and sandbox operations) from sandbox
|
|
@@ -1940,17 +2065,17 @@ var webhookTelemetryContract = c4.router({
|
|
|
1940
2065
|
method: "POST",
|
|
1941
2066
|
path: "/api/webhooks/agent/telemetry",
|
|
1942
2067
|
headers: authHeadersSchema,
|
|
1943
|
-
body:
|
|
1944
|
-
runId:
|
|
1945
|
-
systemLog:
|
|
1946
|
-
metrics:
|
|
1947
|
-
networkLogs:
|
|
1948
|
-
sandboxOperations:
|
|
2068
|
+
body: z7.object({
|
|
2069
|
+
runId: z7.string().min(1, "runId is required"),
|
|
2070
|
+
systemLog: z7.string().optional(),
|
|
2071
|
+
metrics: z7.array(metricDataSchema).optional(),
|
|
2072
|
+
networkLogs: z7.array(networkLogSchema).optional(),
|
|
2073
|
+
sandboxOperations: z7.array(sandboxOperationSchema).optional()
|
|
1949
2074
|
}),
|
|
1950
2075
|
responses: {
|
|
1951
|
-
200:
|
|
1952
|
-
success:
|
|
1953
|
-
id:
|
|
2076
|
+
200: z7.object({
|
|
2077
|
+
success: z7.boolean(),
|
|
2078
|
+
id: z7.string()
|
|
1954
2079
|
}),
|
|
1955
2080
|
400: apiErrorSchema,
|
|
1956
2081
|
401: apiErrorSchema,
|
|
@@ -1960,26 +2085,26 @@ var webhookTelemetryContract = c4.router({
|
|
|
1960
2085
|
summary: "Receive telemetry data from sandbox"
|
|
1961
2086
|
}
|
|
1962
2087
|
});
|
|
1963
|
-
var webhookStoragesPrepareContract =
|
|
2088
|
+
var webhookStoragesPrepareContract = c5.router({
|
|
1964
2089
|
prepare: {
|
|
1965
2090
|
method: "POST",
|
|
1966
2091
|
path: "/api/webhooks/agent/storages/prepare",
|
|
1967
2092
|
headers: authHeadersSchema,
|
|
1968
|
-
body:
|
|
1969
|
-
runId:
|
|
2093
|
+
body: z7.object({
|
|
2094
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1970
2095
|
// Required for webhook auth
|
|
1971
|
-
storageName:
|
|
2096
|
+
storageName: z7.string().min(1, "Storage name is required"),
|
|
1972
2097
|
storageType: storageTypeSchema,
|
|
1973
|
-
files:
|
|
1974
|
-
force:
|
|
1975
|
-
baseVersion:
|
|
2098
|
+
files: z7.array(fileEntryWithHashSchema),
|
|
2099
|
+
force: z7.boolean().optional(),
|
|
2100
|
+
baseVersion: z7.string().optional(),
|
|
1976
2101
|
changes: storageChangesSchema.optional()
|
|
1977
2102
|
}),
|
|
1978
2103
|
responses: {
|
|
1979
|
-
200:
|
|
1980
|
-
versionId:
|
|
1981
|
-
existing:
|
|
1982
|
-
uploads:
|
|
2104
|
+
200: z7.object({
|
|
2105
|
+
versionId: z7.string(),
|
|
2106
|
+
existing: z7.boolean(),
|
|
2107
|
+
uploads: z7.object({
|
|
1983
2108
|
archive: presignedUploadSchema,
|
|
1984
2109
|
manifest: presignedUploadSchema
|
|
1985
2110
|
}).optional()
|
|
@@ -1993,28 +2118,28 @@ var webhookStoragesPrepareContract = c4.router({
|
|
|
1993
2118
|
summary: "Prepare for direct S3 upload from sandbox"
|
|
1994
2119
|
}
|
|
1995
2120
|
});
|
|
1996
|
-
var webhookStoragesCommitContract =
|
|
2121
|
+
var webhookStoragesCommitContract = c5.router({
|
|
1997
2122
|
commit: {
|
|
1998
2123
|
method: "POST",
|
|
1999
2124
|
path: "/api/webhooks/agent/storages/commit",
|
|
2000
2125
|
headers: authHeadersSchema,
|
|
2001
|
-
body:
|
|
2002
|
-
runId:
|
|
2126
|
+
body: z7.object({
|
|
2127
|
+
runId: z7.string().min(1, "runId is required"),
|
|
2003
2128
|
// Required for webhook auth
|
|
2004
|
-
storageName:
|
|
2129
|
+
storageName: z7.string().min(1, "Storage name is required"),
|
|
2005
2130
|
storageType: storageTypeSchema,
|
|
2006
|
-
versionId:
|
|
2007
|
-
files:
|
|
2008
|
-
message:
|
|
2131
|
+
versionId: z7.string().min(1, "Version ID is required"),
|
|
2132
|
+
files: z7.array(fileEntryWithHashSchema),
|
|
2133
|
+
message: z7.string().optional()
|
|
2009
2134
|
}),
|
|
2010
2135
|
responses: {
|
|
2011
|
-
200:
|
|
2012
|
-
success:
|
|
2013
|
-
versionId:
|
|
2014
|
-
storageName:
|
|
2015
|
-
size:
|
|
2016
|
-
fileCount:
|
|
2017
|
-
deduplicated:
|
|
2136
|
+
200: z7.object({
|
|
2137
|
+
success: z7.literal(true),
|
|
2138
|
+
versionId: z7.string(),
|
|
2139
|
+
storageName: z7.string(),
|
|
2140
|
+
size: z7.number(),
|
|
2141
|
+
fileCount: z7.number(),
|
|
2142
|
+
deduplicated: z7.boolean().optional()
|
|
2018
2143
|
}),
|
|
2019
2144
|
400: apiErrorSchema,
|
|
2020
2145
|
401: apiErrorSchema,
|
|
@@ -2029,13 +2154,13 @@ var webhookStoragesCommitContract = c4.router({
|
|
|
2029
2154
|
});
|
|
2030
2155
|
|
|
2031
2156
|
// ../../packages/core/src/contracts/cli-auth.ts
|
|
2032
|
-
import { z as
|
|
2033
|
-
var
|
|
2034
|
-
var oauthErrorSchema =
|
|
2035
|
-
error:
|
|
2036
|
-
error_description:
|
|
2157
|
+
import { z as z8 } from "zod";
|
|
2158
|
+
var c6 = initContract();
|
|
2159
|
+
var oauthErrorSchema = z8.object({
|
|
2160
|
+
error: z8.string(),
|
|
2161
|
+
error_description: z8.string()
|
|
2037
2162
|
});
|
|
2038
|
-
var cliAuthDeviceContract =
|
|
2163
|
+
var cliAuthDeviceContract = c6.router({
|
|
2039
2164
|
/**
|
|
2040
2165
|
* POST /api/cli/auth/device
|
|
2041
2166
|
* Initiate device authorization flow
|
|
@@ -2043,21 +2168,21 @@ var cliAuthDeviceContract = c5.router({
|
|
|
2043
2168
|
create: {
|
|
2044
2169
|
method: "POST",
|
|
2045
2170
|
path: "/api/cli/auth/device",
|
|
2046
|
-
body:
|
|
2171
|
+
body: z8.object({}).optional(),
|
|
2047
2172
|
responses: {
|
|
2048
|
-
200:
|
|
2049
|
-
device_code:
|
|
2050
|
-
user_code:
|
|
2051
|
-
verification_path:
|
|
2052
|
-
expires_in:
|
|
2053
|
-
interval:
|
|
2173
|
+
200: z8.object({
|
|
2174
|
+
device_code: z8.string(),
|
|
2175
|
+
user_code: z8.string(),
|
|
2176
|
+
verification_path: z8.string(),
|
|
2177
|
+
expires_in: z8.number(),
|
|
2178
|
+
interval: z8.number()
|
|
2054
2179
|
}),
|
|
2055
2180
|
500: oauthErrorSchema
|
|
2056
2181
|
},
|
|
2057
2182
|
summary: "Initiate device authorization flow"
|
|
2058
2183
|
}
|
|
2059
2184
|
});
|
|
2060
|
-
var cliAuthTokenContract =
|
|
2185
|
+
var cliAuthTokenContract = c6.router({
|
|
2061
2186
|
/**
|
|
2062
2187
|
* POST /api/cli/auth/token
|
|
2063
2188
|
* Exchange device code for access token
|
|
@@ -2065,16 +2190,16 @@ var cliAuthTokenContract = c5.router({
|
|
|
2065
2190
|
exchange: {
|
|
2066
2191
|
method: "POST",
|
|
2067
2192
|
path: "/api/cli/auth/token",
|
|
2068
|
-
body:
|
|
2069
|
-
device_code:
|
|
2193
|
+
body: z8.object({
|
|
2194
|
+
device_code: z8.string().min(1, "device_code is required")
|
|
2070
2195
|
}),
|
|
2071
2196
|
responses: {
|
|
2072
2197
|
// Success - token issued
|
|
2073
|
-
200:
|
|
2074
|
-
access_token:
|
|
2075
|
-
token_type:
|
|
2076
|
-
expires_in:
|
|
2077
|
-
org_slug:
|
|
2198
|
+
200: z8.object({
|
|
2199
|
+
access_token: z8.string(),
|
|
2200
|
+
token_type: z8.literal("Bearer"),
|
|
2201
|
+
expires_in: z8.number(),
|
|
2202
|
+
org_slug: z8.string().optional()
|
|
2078
2203
|
}),
|
|
2079
2204
|
// Authorization pending
|
|
2080
2205
|
202: oauthErrorSchema,
|
|
@@ -2087,9 +2212,9 @@ var cliAuthTokenContract = c5.router({
|
|
|
2087
2212
|
});
|
|
2088
2213
|
|
|
2089
2214
|
// ../../packages/core/src/contracts/auth.ts
|
|
2090
|
-
import { z as
|
|
2091
|
-
var
|
|
2092
|
-
var authContract =
|
|
2215
|
+
import { z as z9 } from "zod";
|
|
2216
|
+
var c7 = initContract();
|
|
2217
|
+
var authContract = c7.router({
|
|
2093
2218
|
/**
|
|
2094
2219
|
* GET /api/auth/me
|
|
2095
2220
|
* Get current user information
|
|
@@ -2099,9 +2224,9 @@ var authContract = c6.router({
|
|
|
2099
2224
|
path: "/api/auth/me",
|
|
2100
2225
|
headers: authHeadersSchema,
|
|
2101
2226
|
responses: {
|
|
2102
|
-
200:
|
|
2103
|
-
userId:
|
|
2104
|
-
email:
|
|
2227
|
+
200: z9.object({
|
|
2228
|
+
userId: z9.string(),
|
|
2229
|
+
email: z9.string()
|
|
2105
2230
|
}),
|
|
2106
2231
|
401: apiErrorSchema,
|
|
2107
2232
|
404: apiErrorSchema,
|
|
@@ -2112,23 +2237,23 @@ var authContract = c6.router({
|
|
|
2112
2237
|
});
|
|
2113
2238
|
|
|
2114
2239
|
// ../../packages/core/src/contracts/cron.ts
|
|
2115
|
-
import { z as
|
|
2116
|
-
var
|
|
2117
|
-
var cleanupResultSchema =
|
|
2118
|
-
runId:
|
|
2119
|
-
sandboxId:
|
|
2120
|
-
status:
|
|
2121
|
-
error:
|
|
2122
|
-
reason:
|
|
2240
|
+
import { z as z10 } from "zod";
|
|
2241
|
+
var c8 = initContract();
|
|
2242
|
+
var cleanupResultSchema = z10.object({
|
|
2243
|
+
runId: z10.string(),
|
|
2244
|
+
sandboxId: z10.string().nullable(),
|
|
2245
|
+
status: z10.enum(["cleaned", "error"]),
|
|
2246
|
+
error: z10.string().optional(),
|
|
2247
|
+
reason: z10.string().optional()
|
|
2123
2248
|
});
|
|
2124
|
-
var cleanupResponseSchema =
|
|
2125
|
-
cleaned:
|
|
2126
|
-
errors:
|
|
2127
|
-
results:
|
|
2128
|
-
composeJobsCleaned:
|
|
2129
|
-
composeJobErrors:
|
|
2249
|
+
var cleanupResponseSchema = z10.object({
|
|
2250
|
+
cleaned: z10.number(),
|
|
2251
|
+
errors: z10.number(),
|
|
2252
|
+
results: z10.array(cleanupResultSchema),
|
|
2253
|
+
composeJobsCleaned: z10.number(),
|
|
2254
|
+
composeJobErrors: z10.number()
|
|
2130
2255
|
});
|
|
2131
|
-
var cronCleanupSandboxesContract =
|
|
2256
|
+
var cronCleanupSandboxesContract = c8.router({
|
|
2132
2257
|
/**
|
|
2133
2258
|
* GET /api/cron/cleanup-sandboxes
|
|
2134
2259
|
* Cron job to cleanup sandboxes that have stopped sending heartbeats
|
|
@@ -2146,91 +2271,6 @@ var cronCleanupSandboxesContract = c7.router({
|
|
|
2146
2271
|
}
|
|
2147
2272
|
});
|
|
2148
2273
|
|
|
2149
|
-
// ../../packages/core/src/contracts/orgs.ts
|
|
2150
|
-
import { z as z10 } from "zod";
|
|
2151
|
-
var c8 = initContract();
|
|
2152
|
-
var orgTierSchema = z10.enum(["free", "pro", "max"]);
|
|
2153
|
-
var orgSlugSchema = z10.string().min(3, "Org slug must be at least 3 characters").max(64, "Org slug must be at most 64 characters").regex(
|
|
2154
|
-
/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]{1,2}$/,
|
|
2155
|
-
"Org slug must contain only lowercase letters, numbers, and hyphens, and must start and end with an alphanumeric character"
|
|
2156
|
-
).transform((s) => s.toLowerCase());
|
|
2157
|
-
var orgResponseSchema = z10.object({
|
|
2158
|
-
id: z10.string(),
|
|
2159
|
-
slug: z10.string(),
|
|
2160
|
-
tier: z10.string().optional()
|
|
2161
|
-
});
|
|
2162
|
-
var updateOrgRequestSchema = z10.object({
|
|
2163
|
-
slug: orgSlugSchema,
|
|
2164
|
-
force: z10.boolean().optional().default(false)
|
|
2165
|
-
});
|
|
2166
|
-
var orgContract = c8.router({
|
|
2167
|
-
/**
|
|
2168
|
-
* GET /api/org
|
|
2169
|
-
* Get current user's default org
|
|
2170
|
-
*/
|
|
2171
|
-
get: {
|
|
2172
|
-
method: "GET",
|
|
2173
|
-
path: "/api/org",
|
|
2174
|
-
headers: authHeadersSchema,
|
|
2175
|
-
responses: {
|
|
2176
|
-
200: orgResponseSchema,
|
|
2177
|
-
401: apiErrorSchema,
|
|
2178
|
-
404: apiErrorSchema,
|
|
2179
|
-
500: apiErrorSchema
|
|
2180
|
-
},
|
|
2181
|
-
summary: "Get current user's default org"
|
|
2182
|
-
},
|
|
2183
|
-
/**
|
|
2184
|
-
* PUT /api/org
|
|
2185
|
-
* Update org slug
|
|
2186
|
-
*/
|
|
2187
|
-
update: {
|
|
2188
|
-
method: "PUT",
|
|
2189
|
-
path: "/api/org",
|
|
2190
|
-
headers: authHeadersSchema,
|
|
2191
|
-
body: updateOrgRequestSchema,
|
|
2192
|
-
responses: {
|
|
2193
|
-
200: orgResponseSchema,
|
|
2194
|
-
400: apiErrorSchema,
|
|
2195
|
-
401: apiErrorSchema,
|
|
2196
|
-
403: apiErrorSchema,
|
|
2197
|
-
404: apiErrorSchema,
|
|
2198
|
-
409: apiErrorSchema,
|
|
2199
|
-
500: apiErrorSchema
|
|
2200
|
-
},
|
|
2201
|
-
summary: "Update org slug"
|
|
2202
|
-
}
|
|
2203
|
-
});
|
|
2204
|
-
var orgDefaultAgentContract = c8.router({
|
|
2205
|
-
/**
|
|
2206
|
-
* PUT /api/orgs/default-agent?org={slug}
|
|
2207
|
-
* Set or unset the default agent for an org.
|
|
2208
|
-
* Only org admins can perform this action.
|
|
2209
|
-
* The agent must belong to the same org.
|
|
2210
|
-
*/
|
|
2211
|
-
setDefaultAgent: {
|
|
2212
|
-
method: "PUT",
|
|
2213
|
-
path: "/api/orgs/default-agent",
|
|
2214
|
-
headers: authHeadersSchema,
|
|
2215
|
-
query: z10.object({
|
|
2216
|
-
org: z10.string().optional()
|
|
2217
|
-
}),
|
|
2218
|
-
body: z10.object({
|
|
2219
|
-
agentComposeId: z10.string().uuid().nullable()
|
|
2220
|
-
}),
|
|
2221
|
-
responses: {
|
|
2222
|
-
200: z10.object({
|
|
2223
|
-
agentComposeId: z10.string().uuid().nullable()
|
|
2224
|
-
}),
|
|
2225
|
-
400: apiErrorSchema,
|
|
2226
|
-
401: apiErrorSchema,
|
|
2227
|
-
403: apiErrorSchema,
|
|
2228
|
-
404: apiErrorSchema
|
|
2229
|
-
},
|
|
2230
|
-
summary: "Set or unset the default agent for an org"
|
|
2231
|
-
}
|
|
2232
|
-
});
|
|
2233
|
-
|
|
2234
2274
|
// ../../packages/core/src/contracts/secrets.ts
|
|
2235
2275
|
import { z as z11 } from "zod";
|
|
2236
2276
|
var c9 = initContract();
|
|
@@ -7227,19 +7267,22 @@ function expandFirewallConfigs(config) {
|
|
|
7227
7267
|
// ../../packages/core/src/contracts/user-preferences.ts
|
|
7228
7268
|
import { z as z21 } from "zod";
|
|
7229
7269
|
var c19 = initContract();
|
|
7270
|
+
var sendModeSchema = z21.enum(["enter", "cmd-enter"]);
|
|
7230
7271
|
var userPreferencesResponseSchema = z21.object({
|
|
7231
7272
|
timezone: z21.string().nullable(),
|
|
7232
7273
|
notifyEmail: z21.boolean(),
|
|
7233
7274
|
notifySlack: z21.boolean(),
|
|
7234
|
-
pinnedAgentIds: z21.array(z21.string())
|
|
7275
|
+
pinnedAgentIds: z21.array(z21.string()),
|
|
7276
|
+
sendMode: sendModeSchema
|
|
7235
7277
|
});
|
|
7236
7278
|
var updateUserPreferencesRequestSchema = z21.object({
|
|
7237
7279
|
timezone: z21.string().min(1).optional(),
|
|
7238
7280
|
notifyEmail: z21.boolean().optional(),
|
|
7239
7281
|
notifySlack: z21.boolean().optional(),
|
|
7240
|
-
pinnedAgentIds: z21.array(z21.string()).max(4).optional()
|
|
7282
|
+
pinnedAgentIds: z21.array(z21.string()).max(4).optional(),
|
|
7283
|
+
sendMode: sendModeSchema.optional()
|
|
7241
7284
|
}).refine(
|
|
7242
|
-
(data) => data.timezone !== void 0 || data.notifyEmail !== void 0 || data.notifySlack !== void 0 || data.pinnedAgentIds !== void 0,
|
|
7285
|
+
(data) => data.timezone !== void 0 || data.notifyEmail !== void 0 || data.notifySlack !== void 0 || data.pinnedAgentIds !== void 0 || data.sendMode !== void 0,
|
|
7243
7286
|
{
|
|
7244
7287
|
message: "At least one preference must be provided"
|
|
7245
7288
|
}
|
|
@@ -8110,6 +8153,15 @@ async function listRuns(params) {
|
|
|
8110
8153
|
}
|
|
8111
8154
|
handleError(result, "Failed to list runs");
|
|
8112
8155
|
}
|
|
8156
|
+
async function getRunQueue() {
|
|
8157
|
+
const config = await getClientConfig();
|
|
8158
|
+
const client = initClient2(runsQueueContract, config);
|
|
8159
|
+
const result = await client.getQueue({});
|
|
8160
|
+
if (result.status === 200) {
|
|
8161
|
+
return result.body;
|
|
8162
|
+
}
|
|
8163
|
+
handleError(result, "Failed to get run queue");
|
|
8164
|
+
}
|
|
8113
8165
|
async function cancelRun(runId) {
|
|
8114
8166
|
const config = await getClientConfig();
|
|
8115
8167
|
const client = initClient2(runsCancelContract, config);
|
|
@@ -9943,7 +9995,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9943
9995
|
options.autoUpdate = false;
|
|
9944
9996
|
}
|
|
9945
9997
|
if (options.autoUpdate !== false) {
|
|
9946
|
-
await startSilentUpgrade("9.
|
|
9998
|
+
await startSilentUpgrade("9.61.0");
|
|
9947
9999
|
}
|
|
9948
10000
|
try {
|
|
9949
10001
|
let result;
|
|
@@ -11114,7 +11166,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
11114
11166
|
withErrorHandler(
|
|
11115
11167
|
async (identifier, prompt, options) => {
|
|
11116
11168
|
if (options.autoUpdate !== false) {
|
|
11117
|
-
await startSilentUpgrade("9.
|
|
11169
|
+
await startSilentUpgrade("9.61.0");
|
|
11118
11170
|
}
|
|
11119
11171
|
const { org, name, version } = parseIdentifier(identifier);
|
|
11120
11172
|
let composeId;
|
|
@@ -11493,19 +11545,60 @@ var killCommand = new Command12().name("kill").description("Kill (cancel) a pend
|
|
|
11493
11545
|
})
|
|
11494
11546
|
);
|
|
11495
11547
|
|
|
11548
|
+
// src/commands/run/queue.ts
|
|
11549
|
+
import { Command as Command13 } from "commander";
|
|
11550
|
+
import chalk13 from "chalk";
|
|
11551
|
+
var queueCommand = new Command13().name("queue").description("Show org run queue status").action(
|
|
11552
|
+
withErrorHandler(async () => {
|
|
11553
|
+
const data = await getRunQueue();
|
|
11554
|
+
const { concurrency, queue } = data;
|
|
11555
|
+
const limitDisplay = concurrency.limit === 0 ? "unlimited" : `${concurrency.active}/${concurrency.limit} slots used`;
|
|
11556
|
+
console.log(`Concurrency: ${limitDisplay} (${concurrency.tier} tier)`);
|
|
11557
|
+
if (queue.length === 0) {
|
|
11558
|
+
console.log(chalk13.dim("Queue: empty \u2014 all slots available"));
|
|
11559
|
+
return;
|
|
11560
|
+
}
|
|
11561
|
+
console.log(
|
|
11562
|
+
`Queue: ${queue.length} run${queue.length > 1 ? "s" : ""} waiting`
|
|
11563
|
+
);
|
|
11564
|
+
console.log();
|
|
11565
|
+
const posWidth = Math.max(1, String(queue.length).length);
|
|
11566
|
+
const agentWidth = Math.max(5, ...queue.map((e) => e.agentName.length));
|
|
11567
|
+
const emailWidth = Math.max(4, ...queue.map((e) => e.userEmail.length));
|
|
11568
|
+
const header = [
|
|
11569
|
+
"#".padEnd(posWidth),
|
|
11570
|
+
"AGENT".padEnd(agentWidth),
|
|
11571
|
+
"USER".padEnd(emailWidth),
|
|
11572
|
+
"CREATED"
|
|
11573
|
+
].join(" ");
|
|
11574
|
+
console.log(chalk13.dim(header));
|
|
11575
|
+
for (const entry of queue) {
|
|
11576
|
+
const marker = entry.isOwner ? chalk13.cyan(" \u2190 you") : "";
|
|
11577
|
+
const row = [
|
|
11578
|
+
String(entry.position).padEnd(posWidth),
|
|
11579
|
+
entry.agentName.padEnd(agentWidth),
|
|
11580
|
+
entry.userEmail.padEnd(emailWidth),
|
|
11581
|
+
formatRelativeTime(entry.createdAt)
|
|
11582
|
+
].join(" ");
|
|
11583
|
+
console.log(row + marker);
|
|
11584
|
+
}
|
|
11585
|
+
})
|
|
11586
|
+
);
|
|
11587
|
+
|
|
11496
11588
|
// src/commands/run/index.ts
|
|
11497
11589
|
mainRunCommand.addCommand(resumeCommand);
|
|
11498
11590
|
mainRunCommand.addCommand(continueCommand);
|
|
11499
11591
|
mainRunCommand.addCommand(listCommand);
|
|
11500
11592
|
mainRunCommand.addCommand(killCommand);
|
|
11593
|
+
mainRunCommand.addCommand(queueCommand);
|
|
11501
11594
|
var runCommand = mainRunCommand;
|
|
11502
11595
|
|
|
11503
11596
|
// src/commands/volume/index.ts
|
|
11504
|
-
import { Command as
|
|
11597
|
+
import { Command as Command20 } from "commander";
|
|
11505
11598
|
|
|
11506
11599
|
// src/commands/volume/init.ts
|
|
11507
|
-
import { Command as
|
|
11508
|
-
import
|
|
11600
|
+
import { Command as Command14 } from "commander";
|
|
11601
|
+
import chalk14 from "chalk";
|
|
11509
11602
|
import path7 from "path";
|
|
11510
11603
|
|
|
11511
11604
|
// src/lib/storage/storage-utils.ts
|
|
@@ -11556,17 +11649,17 @@ async function writeStorageConfig(storageName, basePath = process.cwd(), type2 =
|
|
|
11556
11649
|
}
|
|
11557
11650
|
|
|
11558
11651
|
// src/commands/volume/init.ts
|
|
11559
|
-
var initCommand = new
|
|
11652
|
+
var initCommand = new Command14().name("init").description("Initialize a volume in the current directory").option("-n, --name <name>", "Volume name (required in non-interactive mode)").action(
|
|
11560
11653
|
withErrorHandler(async (options) => {
|
|
11561
11654
|
const cwd = process.cwd();
|
|
11562
11655
|
const dirName = path7.basename(cwd);
|
|
11563
11656
|
const existingConfig = await readStorageConfig(cwd);
|
|
11564
11657
|
if (existingConfig) {
|
|
11565
11658
|
console.log(
|
|
11566
|
-
|
|
11659
|
+
chalk14.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
11567
11660
|
);
|
|
11568
11661
|
console.log(
|
|
11569
|
-
|
|
11662
|
+
chalk14.dim(`Config file: ${path7.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11570
11663
|
);
|
|
11571
11664
|
return;
|
|
11572
11665
|
}
|
|
@@ -11590,7 +11683,7 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11590
11683
|
}
|
|
11591
11684
|
);
|
|
11592
11685
|
if (name === void 0) {
|
|
11593
|
-
console.log(
|
|
11686
|
+
console.log(chalk14.dim("Cancelled"));
|
|
11594
11687
|
return;
|
|
11595
11688
|
}
|
|
11596
11689
|
volumeName = name;
|
|
@@ -11603,9 +11696,9 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11603
11696
|
});
|
|
11604
11697
|
}
|
|
11605
11698
|
await writeStorageConfig(volumeName, cwd);
|
|
11606
|
-
console.log(
|
|
11699
|
+
console.log(chalk14.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
11607
11700
|
console.log(
|
|
11608
|
-
|
|
11701
|
+
chalk14.dim(
|
|
11609
11702
|
` Config saved to ${path7.join(cwd, ".vm0", "storage.yaml")}`
|
|
11610
11703
|
)
|
|
11611
11704
|
);
|
|
@@ -11613,9 +11706,9 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11613
11706
|
);
|
|
11614
11707
|
|
|
11615
11708
|
// src/commands/volume/push.ts
|
|
11616
|
-
import { Command as
|
|
11617
|
-
import
|
|
11618
|
-
var pushCommand = new
|
|
11709
|
+
import { Command as Command15 } from "commander";
|
|
11710
|
+
import chalk15 from "chalk";
|
|
11711
|
+
var pushCommand = new Command15().name("push").description("Push local files to cloud volume").option(
|
|
11619
11712
|
"-f, --force",
|
|
11620
11713
|
"Force upload even if content unchanged (recreate archive)"
|
|
11621
11714
|
).action(
|
|
@@ -11630,46 +11723,46 @@ var pushCommand = new Command14().name("push").description("Push local files to
|
|
|
11630
11723
|
console.log(`Pushing volume: ${config.name}`);
|
|
11631
11724
|
const result = await directUpload(config.name, "volume", cwd, {
|
|
11632
11725
|
onProgress: (message) => {
|
|
11633
|
-
console.log(
|
|
11726
|
+
console.log(chalk15.dim(message));
|
|
11634
11727
|
},
|
|
11635
11728
|
force: options.force
|
|
11636
11729
|
});
|
|
11637
11730
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11638
11731
|
if (result.empty) {
|
|
11639
|
-
console.log(
|
|
11732
|
+
console.log(chalk15.dim("No files found (empty volume)"));
|
|
11640
11733
|
} else if (result.deduplicated) {
|
|
11641
|
-
console.log(
|
|
11734
|
+
console.log(chalk15.green("\u2713 Content unchanged (deduplicated)"));
|
|
11642
11735
|
} else {
|
|
11643
|
-
console.log(
|
|
11736
|
+
console.log(chalk15.green("\u2713 Upload complete"));
|
|
11644
11737
|
}
|
|
11645
|
-
console.log(
|
|
11646
|
-
console.log(
|
|
11647
|
-
console.log(
|
|
11738
|
+
console.log(chalk15.dim(` Version: ${shortVersion}`));
|
|
11739
|
+
console.log(chalk15.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
11740
|
+
console.log(chalk15.dim(` Size: ${formatBytes(result.size)}`));
|
|
11648
11741
|
})
|
|
11649
11742
|
);
|
|
11650
11743
|
|
|
11651
11744
|
// src/commands/volume/pull.ts
|
|
11652
|
-
import { Command as
|
|
11653
|
-
import
|
|
11745
|
+
import { Command as Command16 } from "commander";
|
|
11746
|
+
import chalk17 from "chalk";
|
|
11654
11747
|
import path8 from "path";
|
|
11655
11748
|
import * as fs7 from "fs";
|
|
11656
11749
|
import * as os5 from "os";
|
|
11657
11750
|
import * as tar3 from "tar";
|
|
11658
11751
|
|
|
11659
11752
|
// src/lib/storage/pull-utils.ts
|
|
11660
|
-
import
|
|
11753
|
+
import chalk16 from "chalk";
|
|
11661
11754
|
async function handleEmptyStorageResponse(cwd) {
|
|
11662
|
-
console.log(
|
|
11755
|
+
console.log(chalk16.dim("Syncing local files..."));
|
|
11663
11756
|
const removedCount = await removeExtraFiles(cwd, /* @__PURE__ */ new Set());
|
|
11664
11757
|
if (removedCount > 0) {
|
|
11665
|
-
console.log(
|
|
11758
|
+
console.log(chalk16.green(`\u2713 Removed ${removedCount} files not in remote`));
|
|
11666
11759
|
}
|
|
11667
|
-
console.log(
|
|
11760
|
+
console.log(chalk16.green("\u2713 Synced (0 files)"));
|
|
11668
11761
|
return { removedCount };
|
|
11669
11762
|
}
|
|
11670
11763
|
|
|
11671
11764
|
// src/commands/volume/pull.ts
|
|
11672
|
-
var pullCommand = new
|
|
11765
|
+
var pullCommand = new Command16().name("pull").description("Pull cloud files to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(
|
|
11673
11766
|
withErrorHandler(async (versionId) => {
|
|
11674
11767
|
const cwd = process.cwd();
|
|
11675
11768
|
const config = await readStorageConfig(cwd);
|
|
@@ -11683,7 +11776,7 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11683
11776
|
} else {
|
|
11684
11777
|
console.log(`Pulling volume: ${config.name}`);
|
|
11685
11778
|
}
|
|
11686
|
-
console.log(
|
|
11779
|
+
console.log(chalk17.dim("Getting download URL..."));
|
|
11687
11780
|
const downloadInfo = await getStorageDownload({
|
|
11688
11781
|
name: config.name,
|
|
11689
11782
|
type: "volume",
|
|
@@ -11697,18 +11790,18 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11697
11790
|
if (!downloadUrl) {
|
|
11698
11791
|
throw new Error("No download URL returned");
|
|
11699
11792
|
}
|
|
11700
|
-
console.log(
|
|
11793
|
+
console.log(chalk17.dim("Downloading from S3..."));
|
|
11701
11794
|
const s3Response = await fetch(downloadUrl);
|
|
11702
11795
|
if (!s3Response.ok) {
|
|
11703
11796
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
11704
11797
|
}
|
|
11705
11798
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11706
11799
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11707
|
-
console.log(
|
|
11800
|
+
console.log(chalk17.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11708
11801
|
const tmpDir = fs7.mkdtempSync(path8.join(os5.tmpdir(), "vm0-"));
|
|
11709
11802
|
const tarPath = path8.join(tmpDir, "volume.tar.gz");
|
|
11710
11803
|
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
11711
|
-
console.log(
|
|
11804
|
+
console.log(chalk17.dim("Syncing local files..."));
|
|
11712
11805
|
const remoteFiles = await listTarFiles(tarPath);
|
|
11713
11806
|
const remoteFilesSet = new Set(
|
|
11714
11807
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -11716,10 +11809,10 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11716
11809
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
11717
11810
|
if (removedCount > 0) {
|
|
11718
11811
|
console.log(
|
|
11719
|
-
|
|
11812
|
+
chalk17.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
11720
11813
|
);
|
|
11721
11814
|
}
|
|
11722
|
-
console.log(
|
|
11815
|
+
console.log(chalk17.dim("Extracting files..."));
|
|
11723
11816
|
await tar3.extract({
|
|
11724
11817
|
file: tarPath,
|
|
11725
11818
|
cwd,
|
|
@@ -11727,14 +11820,14 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11727
11820
|
});
|
|
11728
11821
|
await fs7.promises.unlink(tarPath);
|
|
11729
11822
|
await fs7.promises.rmdir(tmpDir);
|
|
11730
|
-
console.log(
|
|
11823
|
+
console.log(chalk17.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
11731
11824
|
})
|
|
11732
11825
|
);
|
|
11733
11826
|
|
|
11734
11827
|
// src/commands/volume/status.ts
|
|
11735
|
-
import { Command as
|
|
11736
|
-
import
|
|
11737
|
-
var statusCommand2 = new
|
|
11828
|
+
import { Command as Command17 } from "commander";
|
|
11829
|
+
import chalk18 from "chalk";
|
|
11830
|
+
var statusCommand2 = new Command17().name("status").description("Show status of cloud volume").action(
|
|
11738
11831
|
withErrorHandler(async () => {
|
|
11739
11832
|
const cwd = process.cwd();
|
|
11740
11833
|
const config = await readStorageConfig(cwd);
|
|
@@ -11757,13 +11850,13 @@ var statusCommand2 = new Command16().name("status").description("Show status of
|
|
|
11757
11850
|
});
|
|
11758
11851
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11759
11852
|
if ("empty" in info) {
|
|
11760
|
-
console.log(
|
|
11761
|
-
console.log(
|
|
11853
|
+
console.log(chalk18.green("\u2713 Found (empty)"));
|
|
11854
|
+
console.log(chalk18.dim(` Version: ${shortVersion}`));
|
|
11762
11855
|
} else {
|
|
11763
|
-
console.log(
|
|
11764
|
-
console.log(
|
|
11765
|
-
console.log(
|
|
11766
|
-
console.log(
|
|
11856
|
+
console.log(chalk18.green("\u2713 Found"));
|
|
11857
|
+
console.log(chalk18.dim(` Version: ${shortVersion}`));
|
|
11858
|
+
console.log(chalk18.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
11859
|
+
console.log(chalk18.dim(` Size: ${formatBytes(info.size)}`));
|
|
11767
11860
|
}
|
|
11768
11861
|
} catch (error) {
|
|
11769
11862
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -11777,15 +11870,15 @@ var statusCommand2 = new Command16().name("status").description("Show status of
|
|
|
11777
11870
|
);
|
|
11778
11871
|
|
|
11779
11872
|
// src/commands/volume/list.ts
|
|
11780
|
-
import { Command as
|
|
11781
|
-
import
|
|
11782
|
-
var listCommand2 = new
|
|
11873
|
+
import { Command as Command18 } from "commander";
|
|
11874
|
+
import chalk19 from "chalk";
|
|
11875
|
+
var listCommand2 = new Command18().name("list").alias("ls").description("List all remote volumes").action(
|
|
11783
11876
|
withErrorHandler(async () => {
|
|
11784
11877
|
const items = await listStorages({ type: "volume" });
|
|
11785
11878
|
if (items.length === 0) {
|
|
11786
|
-
console.log(
|
|
11879
|
+
console.log(chalk19.dim("No volumes found"));
|
|
11787
11880
|
console.log(
|
|
11788
|
-
|
|
11881
|
+
chalk19.dim(" Create one with: vm0 volume init && vm0 volume push")
|
|
11789
11882
|
);
|
|
11790
11883
|
return;
|
|
11791
11884
|
}
|
|
@@ -11804,7 +11897,7 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List al
|
|
|
11804
11897
|
"FILES".padStart(filesWidth),
|
|
11805
11898
|
"UPDATED"
|
|
11806
11899
|
].join(" ");
|
|
11807
|
-
console.log(
|
|
11900
|
+
console.log(chalk19.dim(header));
|
|
11808
11901
|
for (const item of items) {
|
|
11809
11902
|
const row = [
|
|
11810
11903
|
item.name.padEnd(nameWidth),
|
|
@@ -11818,11 +11911,11 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List al
|
|
|
11818
11911
|
);
|
|
11819
11912
|
|
|
11820
11913
|
// src/commands/volume/clone.ts
|
|
11821
|
-
import { Command as
|
|
11822
|
-
import
|
|
11914
|
+
import { Command as Command19 } from "commander";
|
|
11915
|
+
import chalk21 from "chalk";
|
|
11823
11916
|
|
|
11824
11917
|
// src/lib/storage/clone-utils.ts
|
|
11825
|
-
import
|
|
11918
|
+
import chalk20 from "chalk";
|
|
11826
11919
|
import path9 from "path";
|
|
11827
11920
|
import * as fs8 from "fs";
|
|
11828
11921
|
import * as os6 from "os";
|
|
@@ -11833,18 +11926,18 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11833
11926
|
if (dirStatus.exists && !dirStatus.empty) {
|
|
11834
11927
|
throw new Error(`Directory "${destination}" is not empty`);
|
|
11835
11928
|
}
|
|
11836
|
-
console.log(
|
|
11929
|
+
console.log(chalk20.dim(`Checking remote ${typeLabel}...`));
|
|
11837
11930
|
const downloadInfo = await getStorageDownload({
|
|
11838
11931
|
name,
|
|
11839
11932
|
type: type2,
|
|
11840
11933
|
version: options.version
|
|
11841
11934
|
});
|
|
11842
|
-
console.log(
|
|
11935
|
+
console.log(chalk20.dim(`Creating directory: ${destination}/`));
|
|
11843
11936
|
await fs8.promises.mkdir(destination, { recursive: true });
|
|
11844
11937
|
if ("empty" in downloadInfo) {
|
|
11845
11938
|
await writeStorageConfig(name, destination, type2);
|
|
11846
|
-
console.log(
|
|
11847
|
-
console.log(
|
|
11939
|
+
console.log(chalk20.green(`\u2713 Cloned empty ${typeLabel}: ${name}`));
|
|
11940
|
+
console.log(chalk20.dim(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11848
11941
|
return {
|
|
11849
11942
|
success: true,
|
|
11850
11943
|
fileCount: 0,
|
|
@@ -11856,7 +11949,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11856
11949
|
if (!downloadUrl) {
|
|
11857
11950
|
throw new Error("No download URL returned");
|
|
11858
11951
|
}
|
|
11859
|
-
console.log(
|
|
11952
|
+
console.log(chalk20.dim("Downloading from S3..."));
|
|
11860
11953
|
const s3Response = await fetch(downloadUrl);
|
|
11861
11954
|
if (!s3Response.ok) {
|
|
11862
11955
|
await fs8.promises.rm(destination, { recursive: true, force: true });
|
|
@@ -11864,12 +11957,12 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11864
11957
|
}
|
|
11865
11958
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11866
11959
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11867
|
-
console.log(
|
|
11960
|
+
console.log(chalk20.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11868
11961
|
const tmpDir = fs8.mkdtempSync(path9.join(os6.tmpdir(), "vm0-clone-"));
|
|
11869
11962
|
const tarPath = path9.join(tmpDir, "archive.tar.gz");
|
|
11870
11963
|
await fs8.promises.writeFile(tarPath, tarBuffer);
|
|
11871
11964
|
const files = await listTarFiles(tarPath);
|
|
11872
|
-
console.log(
|
|
11965
|
+
console.log(chalk20.dim("Extracting files..."));
|
|
11873
11966
|
await tar4.extract({
|
|
11874
11967
|
file: tarPath,
|
|
11875
11968
|
cwd: destination,
|
|
@@ -11877,9 +11970,9 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11877
11970
|
});
|
|
11878
11971
|
await fs8.promises.unlink(tarPath);
|
|
11879
11972
|
await fs8.promises.rmdir(tmpDir);
|
|
11880
|
-
console.log(
|
|
11973
|
+
console.log(chalk20.green(`\u2713 Extracted ${files.length} files`));
|
|
11881
11974
|
await writeStorageConfig(name, destination, type2);
|
|
11882
|
-
console.log(
|
|
11975
|
+
console.log(chalk20.green(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11883
11976
|
return {
|
|
11884
11977
|
success: true,
|
|
11885
11978
|
fileCount: downloadInfo.fileCount,
|
|
@@ -11889,29 +11982,29 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11889
11982
|
}
|
|
11890
11983
|
|
|
11891
11984
|
// src/commands/volume/clone.ts
|
|
11892
|
-
var cloneCommand = new
|
|
11985
|
+
var cloneCommand = new Command19().name("clone").description("Clone a remote volume to local directory (latest version)").argument("<name>", "Volume name to clone").argument("[destination]", "Destination directory (default: volume name)").action(
|
|
11893
11986
|
withErrorHandler(async (name, destination) => {
|
|
11894
11987
|
const targetDir = destination || name;
|
|
11895
11988
|
console.log(`Cloning volume: ${name}`);
|
|
11896
11989
|
const result = await cloneStorage(name, "volume", targetDir);
|
|
11897
|
-
console.log(
|
|
11990
|
+
console.log(chalk21.green(`
|
|
11898
11991
|
\u2713 Successfully cloned volume: ${name}`));
|
|
11899
|
-
console.log(
|
|
11900
|
-
console.log(
|
|
11992
|
+
console.log(chalk21.dim(` Location: ${targetDir}/`));
|
|
11993
|
+
console.log(chalk21.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
11901
11994
|
})
|
|
11902
11995
|
);
|
|
11903
11996
|
|
|
11904
11997
|
// src/commands/volume/index.ts
|
|
11905
|
-
var volumeCommand = new
|
|
11998
|
+
var volumeCommand = new Command20().name("volume").description("Manage volumes (defined in compose, not versioned after run)").addCommand(initCommand).addCommand(pushCommand).addCommand(pullCommand).addCommand(statusCommand2).addCommand(listCommand2).addCommand(cloneCommand);
|
|
11906
11999
|
|
|
11907
12000
|
// src/commands/artifact/index.ts
|
|
11908
|
-
import { Command as
|
|
12001
|
+
import { Command as Command27 } from "commander";
|
|
11909
12002
|
|
|
11910
12003
|
// src/commands/artifact/init.ts
|
|
11911
|
-
import { Command as
|
|
11912
|
-
import
|
|
12004
|
+
import { Command as Command21 } from "commander";
|
|
12005
|
+
import chalk22 from "chalk";
|
|
11913
12006
|
import path10 from "path";
|
|
11914
|
-
var initCommand2 = new
|
|
12007
|
+
var initCommand2 = new Command21().name("init").description("Initialize an artifact in the current directory").option(
|
|
11915
12008
|
"-n, --name <name>",
|
|
11916
12009
|
"Artifact name (required in non-interactive mode)"
|
|
11917
12010
|
).action(
|
|
@@ -11922,24 +12015,24 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11922
12015
|
if (existingConfig) {
|
|
11923
12016
|
if (existingConfig.type === "artifact") {
|
|
11924
12017
|
console.log(
|
|
11925
|
-
|
|
12018
|
+
chalk22.yellow(
|
|
11926
12019
|
`Artifact already initialized: ${existingConfig.name}`
|
|
11927
12020
|
)
|
|
11928
12021
|
);
|
|
11929
12022
|
} else {
|
|
11930
12023
|
console.log(
|
|
11931
|
-
|
|
12024
|
+
chalk22.yellow(
|
|
11932
12025
|
`Directory already initialized as volume: ${existingConfig.name}`
|
|
11933
12026
|
)
|
|
11934
12027
|
);
|
|
11935
12028
|
console.log(
|
|
11936
|
-
|
|
12029
|
+
chalk22.dim(
|
|
11937
12030
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
11938
12031
|
)
|
|
11939
12032
|
);
|
|
11940
12033
|
}
|
|
11941
12034
|
console.log(
|
|
11942
|
-
|
|
12035
|
+
chalk22.dim(`Config file: ${path10.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11943
12036
|
);
|
|
11944
12037
|
return;
|
|
11945
12038
|
}
|
|
@@ -11963,7 +12056,7 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11963
12056
|
}
|
|
11964
12057
|
);
|
|
11965
12058
|
if (name === void 0) {
|
|
11966
|
-
console.log(
|
|
12059
|
+
console.log(chalk22.dim("Cancelled"));
|
|
11967
12060
|
return;
|
|
11968
12061
|
}
|
|
11969
12062
|
artifactName = name;
|
|
@@ -11976,9 +12069,9 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11976
12069
|
});
|
|
11977
12070
|
}
|
|
11978
12071
|
await writeStorageConfig(artifactName, cwd, "artifact");
|
|
11979
|
-
console.log(
|
|
12072
|
+
console.log(chalk22.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
11980
12073
|
console.log(
|
|
11981
|
-
|
|
12074
|
+
chalk22.dim(
|
|
11982
12075
|
` Config saved to ${path10.join(cwd, ".vm0", "storage.yaml")}`
|
|
11983
12076
|
)
|
|
11984
12077
|
);
|
|
@@ -11986,9 +12079,9 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11986
12079
|
);
|
|
11987
12080
|
|
|
11988
12081
|
// src/commands/artifact/push.ts
|
|
11989
|
-
import { Command as
|
|
11990
|
-
import
|
|
11991
|
-
var pushCommand2 = new
|
|
12082
|
+
import { Command as Command22 } from "commander";
|
|
12083
|
+
import chalk23 from "chalk";
|
|
12084
|
+
var pushCommand2 = new Command22().name("push").description("Push local files to cloud artifact").option(
|
|
11992
12085
|
"-f, --force",
|
|
11993
12086
|
"Force upload even if content unchanged (recreate archive)"
|
|
11994
12087
|
).action(
|
|
@@ -12009,32 +12102,32 @@ var pushCommand2 = new Command21().name("push").description("Push local files to
|
|
|
12009
12102
|
console.log(`Pushing artifact: ${config.name}`);
|
|
12010
12103
|
const result = await directUpload(config.name, "artifact", cwd, {
|
|
12011
12104
|
onProgress: (message) => {
|
|
12012
|
-
console.log(
|
|
12105
|
+
console.log(chalk23.dim(message));
|
|
12013
12106
|
},
|
|
12014
12107
|
force: options.force
|
|
12015
12108
|
});
|
|
12016
12109
|
const shortVersion = result.versionId.slice(0, 8);
|
|
12017
12110
|
if (result.empty) {
|
|
12018
|
-
console.log(
|
|
12111
|
+
console.log(chalk23.dim("No files found (empty artifact)"));
|
|
12019
12112
|
} else if (result.deduplicated) {
|
|
12020
|
-
console.log(
|
|
12113
|
+
console.log(chalk23.green("\u2713 Content unchanged (deduplicated)"));
|
|
12021
12114
|
} else {
|
|
12022
|
-
console.log(
|
|
12115
|
+
console.log(chalk23.green("\u2713 Upload complete"));
|
|
12023
12116
|
}
|
|
12024
|
-
console.log(
|
|
12025
|
-
console.log(
|
|
12026
|
-
console.log(
|
|
12117
|
+
console.log(chalk23.dim(` Version: ${shortVersion}`));
|
|
12118
|
+
console.log(chalk23.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
12119
|
+
console.log(chalk23.dim(` Size: ${formatBytes(result.size)}`));
|
|
12027
12120
|
})
|
|
12028
12121
|
);
|
|
12029
12122
|
|
|
12030
12123
|
// src/commands/artifact/pull.ts
|
|
12031
|
-
import { Command as
|
|
12032
|
-
import
|
|
12124
|
+
import { Command as Command23 } from "commander";
|
|
12125
|
+
import chalk24 from "chalk";
|
|
12033
12126
|
import path11 from "path";
|
|
12034
12127
|
import * as fs9 from "fs";
|
|
12035
12128
|
import * as os7 from "os";
|
|
12036
12129
|
import * as tar5 from "tar";
|
|
12037
|
-
var pullCommand2 = new
|
|
12130
|
+
var pullCommand2 = new Command23().name("pull").description("Pull cloud artifact to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(
|
|
12038
12131
|
withErrorHandler(async (versionId) => {
|
|
12039
12132
|
const cwd = process.cwd();
|
|
12040
12133
|
const config = await readStorageConfig(cwd);
|
|
@@ -12054,7 +12147,7 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
12054
12147
|
} else {
|
|
12055
12148
|
console.log(`Pulling artifact: ${config.name}`);
|
|
12056
12149
|
}
|
|
12057
|
-
console.log(
|
|
12150
|
+
console.log(chalk24.dim("Getting download URL..."));
|
|
12058
12151
|
const downloadInfo = await getStorageDownload({
|
|
12059
12152
|
name: config.name,
|
|
12060
12153
|
type: "artifact",
|
|
@@ -12068,18 +12161,18 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
12068
12161
|
if (!downloadUrl) {
|
|
12069
12162
|
throw new Error("No download URL returned");
|
|
12070
12163
|
}
|
|
12071
|
-
console.log(
|
|
12164
|
+
console.log(chalk24.dim("Downloading from S3..."));
|
|
12072
12165
|
const s3Response = await fetch(downloadUrl);
|
|
12073
12166
|
if (!s3Response.ok) {
|
|
12074
12167
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
12075
12168
|
}
|
|
12076
12169
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
12077
12170
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
12078
|
-
console.log(
|
|
12171
|
+
console.log(chalk24.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
12079
12172
|
const tmpDir = fs9.mkdtempSync(path11.join(os7.tmpdir(), "vm0-"));
|
|
12080
12173
|
const tarPath = path11.join(tmpDir, "artifact.tar.gz");
|
|
12081
12174
|
await fs9.promises.writeFile(tarPath, tarBuffer);
|
|
12082
|
-
console.log(
|
|
12175
|
+
console.log(chalk24.dim("Syncing local files..."));
|
|
12083
12176
|
const remoteFiles = await listTarFiles(tarPath);
|
|
12084
12177
|
const remoteFilesSet = new Set(
|
|
12085
12178
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -12087,10 +12180,10 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
12087
12180
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
12088
12181
|
if (removedCount > 0) {
|
|
12089
12182
|
console.log(
|
|
12090
|
-
|
|
12183
|
+
chalk24.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
12091
12184
|
);
|
|
12092
12185
|
}
|
|
12093
|
-
console.log(
|
|
12186
|
+
console.log(chalk24.dim("Extracting files..."));
|
|
12094
12187
|
await tar5.extract({
|
|
12095
12188
|
file: tarPath,
|
|
12096
12189
|
cwd,
|
|
@@ -12098,14 +12191,14 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
12098
12191
|
});
|
|
12099
12192
|
await fs9.promises.unlink(tarPath);
|
|
12100
12193
|
await fs9.promises.rmdir(tmpDir);
|
|
12101
|
-
console.log(
|
|
12194
|
+
console.log(chalk24.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
12102
12195
|
})
|
|
12103
12196
|
);
|
|
12104
12197
|
|
|
12105
12198
|
// src/commands/artifact/status.ts
|
|
12106
|
-
import { Command as
|
|
12107
|
-
import
|
|
12108
|
-
var statusCommand3 = new
|
|
12199
|
+
import { Command as Command24 } from "commander";
|
|
12200
|
+
import chalk25 from "chalk";
|
|
12201
|
+
var statusCommand3 = new Command24().name("status").description("Show status of cloud artifact").action(
|
|
12109
12202
|
withErrorHandler(async () => {
|
|
12110
12203
|
const cwd = process.cwd();
|
|
12111
12204
|
const config = await readStorageConfig(cwd);
|
|
@@ -12128,13 +12221,13 @@ var statusCommand3 = new Command23().name("status").description("Show status of
|
|
|
12128
12221
|
});
|
|
12129
12222
|
const shortVersion = info.versionId.slice(0, 8);
|
|
12130
12223
|
if ("empty" in info) {
|
|
12131
|
-
console.log(
|
|
12132
|
-
console.log(
|
|
12224
|
+
console.log(chalk25.green("\u2713 Found (empty)"));
|
|
12225
|
+
console.log(chalk25.dim(` Version: ${shortVersion}`));
|
|
12133
12226
|
} else {
|
|
12134
|
-
console.log(
|
|
12135
|
-
console.log(
|
|
12136
|
-
console.log(
|
|
12137
|
-
console.log(
|
|
12227
|
+
console.log(chalk25.green("\u2713 Found"));
|
|
12228
|
+
console.log(chalk25.dim(` Version: ${shortVersion}`));
|
|
12229
|
+
console.log(chalk25.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
12230
|
+
console.log(chalk25.dim(` Size: ${formatBytes(info.size)}`));
|
|
12138
12231
|
}
|
|
12139
12232
|
} catch (error) {
|
|
12140
12233
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -12148,15 +12241,15 @@ var statusCommand3 = new Command23().name("status").description("Show status of
|
|
|
12148
12241
|
);
|
|
12149
12242
|
|
|
12150
12243
|
// src/commands/artifact/list.ts
|
|
12151
|
-
import { Command as
|
|
12152
|
-
import
|
|
12153
|
-
var listCommand3 = new
|
|
12244
|
+
import { Command as Command25 } from "commander";
|
|
12245
|
+
import chalk26 from "chalk";
|
|
12246
|
+
var listCommand3 = new Command25().name("list").alias("ls").description("List all remote artifacts").action(
|
|
12154
12247
|
withErrorHandler(async () => {
|
|
12155
12248
|
const items = await listStorages({ type: "artifact" });
|
|
12156
12249
|
if (items.length === 0) {
|
|
12157
|
-
console.log(
|
|
12250
|
+
console.log(chalk26.dim("No artifacts found"));
|
|
12158
12251
|
console.log(
|
|
12159
|
-
|
|
12252
|
+
chalk26.dim(
|
|
12160
12253
|
" Create one with: vm0 artifact init && vm0 artifact push"
|
|
12161
12254
|
)
|
|
12162
12255
|
);
|
|
@@ -12177,7 +12270,7 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
12177
12270
|
"FILES".padStart(filesWidth),
|
|
12178
12271
|
"UPDATED"
|
|
12179
12272
|
].join(" ");
|
|
12180
|
-
console.log(
|
|
12273
|
+
console.log(chalk26.dim(header));
|
|
12181
12274
|
for (const item of items) {
|
|
12182
12275
|
const row = [
|
|
12183
12276
|
item.name.padEnd(nameWidth),
|
|
@@ -12191,31 +12284,31 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
12191
12284
|
);
|
|
12192
12285
|
|
|
12193
12286
|
// src/commands/artifact/clone.ts
|
|
12194
|
-
import { Command as
|
|
12195
|
-
import
|
|
12196
|
-
var cloneCommand2 = new
|
|
12287
|
+
import { Command as Command26 } from "commander";
|
|
12288
|
+
import chalk27 from "chalk";
|
|
12289
|
+
var cloneCommand2 = new Command26().name("clone").description("Clone a remote artifact to local directory (latest version)").argument("<name>", "Artifact name to clone").argument("[destination]", "Destination directory (default: artifact name)").action(
|
|
12197
12290
|
withErrorHandler(async (name, destination) => {
|
|
12198
12291
|
const targetDir = destination || name;
|
|
12199
12292
|
console.log(`Cloning artifact: ${name}`);
|
|
12200
12293
|
const result = await cloneStorage(name, "artifact", targetDir);
|
|
12201
|
-
console.log(
|
|
12294
|
+
console.log(chalk27.green(`
|
|
12202
12295
|
\u2713 Successfully cloned artifact: ${name}`));
|
|
12203
|
-
console.log(
|
|
12204
|
-
console.log(
|
|
12296
|
+
console.log(chalk27.dim(` Location: ${targetDir}/`));
|
|
12297
|
+
console.log(chalk27.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12205
12298
|
})
|
|
12206
12299
|
);
|
|
12207
12300
|
|
|
12208
12301
|
// src/commands/artifact/index.ts
|
|
12209
|
-
var artifactCommand = new
|
|
12302
|
+
var artifactCommand = new Command27().name("artifact").description("Manage artifacts (specified at run, versioned after run)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand3).addCommand(listCommand3).addCommand(cloneCommand2);
|
|
12210
12303
|
|
|
12211
12304
|
// src/commands/memory/index.ts
|
|
12212
|
-
import { Command as
|
|
12305
|
+
import { Command as Command34 } from "commander";
|
|
12213
12306
|
|
|
12214
12307
|
// src/commands/memory/init.ts
|
|
12215
|
-
import { Command as
|
|
12216
|
-
import
|
|
12308
|
+
import { Command as Command28 } from "commander";
|
|
12309
|
+
import chalk28 from "chalk";
|
|
12217
12310
|
import path12 from "path";
|
|
12218
|
-
var initCommand3 = new
|
|
12311
|
+
var initCommand3 = new Command28().name("init").description("Initialize a memory in the current directory").option("-n, --name <name>", "Memory name (required in non-interactive mode)").action(
|
|
12219
12312
|
withErrorHandler(async (options) => {
|
|
12220
12313
|
const cwd = process.cwd();
|
|
12221
12314
|
const dirName = path12.basename(cwd);
|
|
@@ -12223,22 +12316,22 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12223
12316
|
if (existingConfig) {
|
|
12224
12317
|
if (existingConfig.type === "memory") {
|
|
12225
12318
|
console.log(
|
|
12226
|
-
|
|
12319
|
+
chalk28.yellow(`Memory already initialized: ${existingConfig.name}`)
|
|
12227
12320
|
);
|
|
12228
12321
|
} else {
|
|
12229
12322
|
console.log(
|
|
12230
|
-
|
|
12323
|
+
chalk28.yellow(
|
|
12231
12324
|
`Directory already initialized as ${existingConfig.type}: ${existingConfig.name}`
|
|
12232
12325
|
)
|
|
12233
12326
|
);
|
|
12234
12327
|
console.log(
|
|
12235
|
-
|
|
12328
|
+
chalk28.dim(
|
|
12236
12329
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
12237
12330
|
)
|
|
12238
12331
|
);
|
|
12239
12332
|
}
|
|
12240
12333
|
console.log(
|
|
12241
|
-
|
|
12334
|
+
chalk28.dim(`Config file: ${path12.join(cwd, ".vm0", "storage.yaml")}`)
|
|
12242
12335
|
);
|
|
12243
12336
|
return;
|
|
12244
12337
|
}
|
|
@@ -12262,7 +12355,7 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12262
12355
|
}
|
|
12263
12356
|
);
|
|
12264
12357
|
if (name === void 0) {
|
|
12265
|
-
console.log(
|
|
12358
|
+
console.log(chalk28.dim("Cancelled"));
|
|
12266
12359
|
return;
|
|
12267
12360
|
}
|
|
12268
12361
|
memoryName = name;
|
|
@@ -12275,9 +12368,9 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12275
12368
|
});
|
|
12276
12369
|
}
|
|
12277
12370
|
await writeStorageConfig(memoryName, cwd, "memory");
|
|
12278
|
-
console.log(
|
|
12371
|
+
console.log(chalk28.green(`\u2713 Initialized memory: ${memoryName}`));
|
|
12279
12372
|
console.log(
|
|
12280
|
-
|
|
12373
|
+
chalk28.dim(
|
|
12281
12374
|
` Config saved to ${path12.join(cwd, ".vm0", "storage.yaml")}`
|
|
12282
12375
|
)
|
|
12283
12376
|
);
|
|
@@ -12285,9 +12378,9 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12285
12378
|
);
|
|
12286
12379
|
|
|
12287
12380
|
// src/commands/memory/push.ts
|
|
12288
|
-
import { Command as
|
|
12289
|
-
import
|
|
12290
|
-
var pushCommand3 = new
|
|
12381
|
+
import { Command as Command29 } from "commander";
|
|
12382
|
+
import chalk29 from "chalk";
|
|
12383
|
+
var pushCommand3 = new Command29().name("push").description("Push local files to cloud memory").option(
|
|
12291
12384
|
"-f, --force",
|
|
12292
12385
|
"Force upload even if content unchanged (recreate archive)"
|
|
12293
12386
|
).action(
|
|
@@ -12308,43 +12401,43 @@ var pushCommand3 = new Command28().name("push").description("Push local files to
|
|
|
12308
12401
|
console.log(`Pushing memory: ${config.name}`);
|
|
12309
12402
|
const result = await directUpload(config.name, "memory", cwd, {
|
|
12310
12403
|
onProgress: (message) => {
|
|
12311
|
-
console.log(
|
|
12404
|
+
console.log(chalk29.dim(message));
|
|
12312
12405
|
},
|
|
12313
12406
|
force: options.force
|
|
12314
12407
|
});
|
|
12315
12408
|
const shortVersion = result.versionId.slice(0, 8);
|
|
12316
12409
|
if (result.empty) {
|
|
12317
|
-
console.log(
|
|
12410
|
+
console.log(chalk29.dim("No files found (empty memory)"));
|
|
12318
12411
|
} else if (result.deduplicated) {
|
|
12319
|
-
console.log(
|
|
12412
|
+
console.log(chalk29.green("\u2713 Content unchanged (deduplicated)"));
|
|
12320
12413
|
} else {
|
|
12321
|
-
console.log(
|
|
12414
|
+
console.log(chalk29.green("\u2713 Upload complete"));
|
|
12322
12415
|
}
|
|
12323
|
-
console.log(
|
|
12324
|
-
console.log(
|
|
12325
|
-
console.log(
|
|
12416
|
+
console.log(chalk29.dim(` Version: ${shortVersion}`));
|
|
12417
|
+
console.log(chalk29.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
12418
|
+
console.log(chalk29.dim(` Size: ${formatBytes(result.size)}`));
|
|
12326
12419
|
})
|
|
12327
12420
|
);
|
|
12328
12421
|
|
|
12329
12422
|
// src/commands/memory/pull.ts
|
|
12330
|
-
import { Command as
|
|
12331
|
-
import
|
|
12332
|
-
var pullCommand3 = new
|
|
12423
|
+
import { Command as Command30 } from "commander";
|
|
12424
|
+
import chalk30 from "chalk";
|
|
12425
|
+
var pullCommand3 = new Command30().name("pull").description("Pull remote memory to local directory (latest version)").argument("[name]", "Memory name to pull", "memory").argument("[destination]", "Destination directory (default: memory name)").action(
|
|
12333
12426
|
withErrorHandler(async (name, destination) => {
|
|
12334
12427
|
const targetDir = destination || name;
|
|
12335
12428
|
console.log(`Pulling memory: ${name}`);
|
|
12336
12429
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
12337
|
-
console.log(
|
|
12430
|
+
console.log(chalk30.green(`
|
|
12338
12431
|
\u2713 Successfully pulled memory: ${name}`));
|
|
12339
|
-
console.log(
|
|
12340
|
-
console.log(
|
|
12432
|
+
console.log(chalk30.dim(` Location: ${targetDir}/`));
|
|
12433
|
+
console.log(chalk30.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12341
12434
|
})
|
|
12342
12435
|
);
|
|
12343
12436
|
|
|
12344
12437
|
// src/commands/memory/status.ts
|
|
12345
|
-
import { Command as
|
|
12346
|
-
import
|
|
12347
|
-
var statusCommand4 = new
|
|
12438
|
+
import { Command as Command31 } from "commander";
|
|
12439
|
+
import chalk31 from "chalk";
|
|
12440
|
+
var statusCommand4 = new Command31().name("status").description("Show status of cloud memory").action(
|
|
12348
12441
|
withErrorHandler(async () => {
|
|
12349
12442
|
const cwd = process.cwd();
|
|
12350
12443
|
const config = await readStorageConfig(cwd);
|
|
@@ -12367,13 +12460,13 @@ var statusCommand4 = new Command30().name("status").description("Show status of
|
|
|
12367
12460
|
});
|
|
12368
12461
|
const shortVersion = info.versionId.slice(0, 8);
|
|
12369
12462
|
if ("empty" in info) {
|
|
12370
|
-
console.log(
|
|
12371
|
-
console.log(
|
|
12463
|
+
console.log(chalk31.green("\u2713 Found (empty)"));
|
|
12464
|
+
console.log(chalk31.dim(` Version: ${shortVersion}`));
|
|
12372
12465
|
} else {
|
|
12373
|
-
console.log(
|
|
12374
|
-
console.log(
|
|
12375
|
-
console.log(
|
|
12376
|
-
console.log(
|
|
12466
|
+
console.log(chalk31.green("\u2713 Found"));
|
|
12467
|
+
console.log(chalk31.dim(` Version: ${shortVersion}`));
|
|
12468
|
+
console.log(chalk31.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
12469
|
+
console.log(chalk31.dim(` Size: ${formatBytes(info.size)}`));
|
|
12377
12470
|
}
|
|
12378
12471
|
} catch (error) {
|
|
12379
12472
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -12387,15 +12480,15 @@ var statusCommand4 = new Command30().name("status").description("Show status of
|
|
|
12387
12480
|
);
|
|
12388
12481
|
|
|
12389
12482
|
// src/commands/memory/list.ts
|
|
12390
|
-
import { Command as
|
|
12391
|
-
import
|
|
12392
|
-
var listCommand4 = new
|
|
12483
|
+
import { Command as Command32 } from "commander";
|
|
12484
|
+
import chalk32 from "chalk";
|
|
12485
|
+
var listCommand4 = new Command32().name("list").alias("ls").description("List all remote memory storages").action(
|
|
12393
12486
|
withErrorHandler(async () => {
|
|
12394
12487
|
const items = await listStorages({ type: "memory" });
|
|
12395
12488
|
if (items.length === 0) {
|
|
12396
|
-
console.log(
|
|
12489
|
+
console.log(chalk32.dim("No memory storages found"));
|
|
12397
12490
|
console.log(
|
|
12398
|
-
|
|
12491
|
+
chalk32.dim(" Memory is created automatically on first agent run")
|
|
12399
12492
|
);
|
|
12400
12493
|
return;
|
|
12401
12494
|
}
|
|
@@ -12414,7 +12507,7 @@ var listCommand4 = new Command31().name("list").alias("ls").description("List al
|
|
|
12414
12507
|
"FILES".padStart(filesWidth),
|
|
12415
12508
|
"UPDATED"
|
|
12416
12509
|
].join(" ");
|
|
12417
|
-
console.log(
|
|
12510
|
+
console.log(chalk32.dim(header));
|
|
12418
12511
|
for (const item of items) {
|
|
12419
12512
|
const row = [
|
|
12420
12513
|
item.name.padEnd(nameWidth),
|
|
@@ -12428,26 +12521,26 @@ var listCommand4 = new Command31().name("list").alias("ls").description("List al
|
|
|
12428
12521
|
);
|
|
12429
12522
|
|
|
12430
12523
|
// src/commands/memory/clone.ts
|
|
12431
|
-
import { Command as
|
|
12432
|
-
import
|
|
12433
|
-
var cloneCommand3 = new
|
|
12524
|
+
import { Command as Command33 } from "commander";
|
|
12525
|
+
import chalk33 from "chalk";
|
|
12526
|
+
var cloneCommand3 = new Command33().name("clone").description("Clone a remote memory to local directory (latest version)").argument("<name>", "Memory name to clone").argument("[destination]", "Destination directory (default: memory name)").action(
|
|
12434
12527
|
withErrorHandler(async (name, destination) => {
|
|
12435
12528
|
const targetDir = destination || name;
|
|
12436
12529
|
console.log(`Cloning memory: ${name}`);
|
|
12437
12530
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
12438
|
-
console.log(
|
|
12531
|
+
console.log(chalk33.green(`
|
|
12439
12532
|
\u2713 Successfully cloned memory: ${name}`));
|
|
12440
|
-
console.log(
|
|
12441
|
-
console.log(
|
|
12533
|
+
console.log(chalk33.dim(` Location: ${targetDir}/`));
|
|
12534
|
+
console.log(chalk33.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12442
12535
|
})
|
|
12443
12536
|
);
|
|
12444
12537
|
|
|
12445
12538
|
// src/commands/memory/index.ts
|
|
12446
|
-
var memoryCommand = new
|
|
12539
|
+
var memoryCommand = new Command34().name("memory").description("Manage agent long-term memory").addCommand(initCommand3).addCommand(pushCommand3).addCommand(pullCommand3).addCommand(statusCommand4).addCommand(listCommand4).addCommand(cloneCommand3);
|
|
12447
12540
|
|
|
12448
12541
|
// src/commands/cook/cook.ts
|
|
12449
|
-
import { Command as
|
|
12450
|
-
import
|
|
12542
|
+
import { Command as Command35, Option as Option5 } from "commander";
|
|
12543
|
+
import chalk35 from "chalk";
|
|
12451
12544
|
import { readFile as readFile7, mkdir as mkdir6 } from "fs/promises";
|
|
12452
12545
|
import { existsSync as existsSync10 } from "fs";
|
|
12453
12546
|
import path13 from "path";
|
|
@@ -12519,12 +12612,12 @@ async function saveCookState(state) {
|
|
|
12519
12612
|
}
|
|
12520
12613
|
|
|
12521
12614
|
// src/commands/cook/utils.ts
|
|
12522
|
-
import
|
|
12615
|
+
import chalk34 from "chalk";
|
|
12523
12616
|
import { existsSync as existsSync9 } from "fs";
|
|
12524
12617
|
var CONFIG_FILE2 = "vm0.yaml";
|
|
12525
12618
|
var ARTIFACT_DIR = "artifact";
|
|
12526
12619
|
function printCommand(cmd) {
|
|
12527
|
-
console.log(
|
|
12620
|
+
console.log(chalk34.dim(`> ${cmd}`));
|
|
12528
12621
|
}
|
|
12529
12622
|
function execVm0Command(args, options = {}) {
|
|
12530
12623
|
return new Promise((resolve2, reject) => {
|
|
@@ -12623,7 +12716,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12623
12716
|
);
|
|
12624
12717
|
if (serverVersion && existsSync9(artifactDir)) {
|
|
12625
12718
|
console.log();
|
|
12626
|
-
console.log(
|
|
12719
|
+
console.log(chalk34.bold("Pulling updated artifact:"));
|
|
12627
12720
|
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
12628
12721
|
printCommand(`vm0 artifact pull ${serverVersion}`);
|
|
12629
12722
|
try {
|
|
@@ -12633,9 +12726,9 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12633
12726
|
});
|
|
12634
12727
|
printCommand("cd ..");
|
|
12635
12728
|
} catch (error) {
|
|
12636
|
-
console.error(
|
|
12729
|
+
console.error(chalk34.red(`\u2717 Artifact pull failed`));
|
|
12637
12730
|
if (error instanceof Error) {
|
|
12638
|
-
console.error(
|
|
12731
|
+
console.error(chalk34.dim(` ${error.message}`));
|
|
12639
12732
|
}
|
|
12640
12733
|
}
|
|
12641
12734
|
}
|
|
@@ -12643,7 +12736,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12643
12736
|
|
|
12644
12737
|
// src/commands/cook/cook.ts
|
|
12645
12738
|
async function loadAndValidateConfig2() {
|
|
12646
|
-
console.log(
|
|
12739
|
+
console.log(chalk35.bold(`Reading config: ${CONFIG_FILE2}`));
|
|
12647
12740
|
if (!existsSync10(CONFIG_FILE2)) {
|
|
12648
12741
|
throw new Error(`Config file not found: ${CONFIG_FILE2}`);
|
|
12649
12742
|
}
|
|
@@ -12665,7 +12758,7 @@ async function loadAndValidateConfig2() {
|
|
|
12665
12758
|
const agentName = agentNames[0];
|
|
12666
12759
|
const volumeCount = config.volumes ? Object.keys(config.volumes).length : 0;
|
|
12667
12760
|
console.log(
|
|
12668
|
-
|
|
12761
|
+
chalk35.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
|
|
12669
12762
|
);
|
|
12670
12763
|
return { config, agentName, volumeCount };
|
|
12671
12764
|
}
|
|
@@ -12674,7 +12767,7 @@ async function processVolumes(config, cwd) {
|
|
|
12674
12767
|
return;
|
|
12675
12768
|
}
|
|
12676
12769
|
console.log();
|
|
12677
|
-
console.log(
|
|
12770
|
+
console.log(chalk35.bold("Processing volumes:"));
|
|
12678
12771
|
for (const volumeConfig of Object.values(config.volumes)) {
|
|
12679
12772
|
const volumeDir = path13.join(cwd, volumeConfig.name);
|
|
12680
12773
|
if (!existsSync10(volumeDir)) {
|
|
@@ -12708,7 +12801,7 @@ async function processVolumes(config, cwd) {
|
|
|
12708
12801
|
}
|
|
12709
12802
|
async function processArtifact(cwd) {
|
|
12710
12803
|
console.log();
|
|
12711
|
-
console.log(
|
|
12804
|
+
console.log(chalk35.bold("Processing artifact:"));
|
|
12712
12805
|
const artifactDir = path13.join(cwd, ARTIFACT_DIR);
|
|
12713
12806
|
try {
|
|
12714
12807
|
if (!existsSync10(artifactDir)) {
|
|
@@ -12740,7 +12833,7 @@ async function processArtifact(cwd) {
|
|
|
12740
12833
|
}
|
|
12741
12834
|
async function composeAgent(cwd, skipConfirm) {
|
|
12742
12835
|
console.log();
|
|
12743
|
-
console.log(
|
|
12836
|
+
console.log(chalk35.bold("Composing agent:"));
|
|
12744
12837
|
const composeArgs = skipConfirm ? ["compose", "--yes", CONFIG_FILE2] : ["compose", CONFIG_FILE2];
|
|
12745
12838
|
printCommand(`vm0 ${composeArgs.join(" ")}`);
|
|
12746
12839
|
try {
|
|
@@ -12754,7 +12847,7 @@ async function composeAgent(cwd, skipConfirm) {
|
|
|
12754
12847
|
}
|
|
12755
12848
|
async function runAgent(agentName, artifactDir, prompt, cwd, options) {
|
|
12756
12849
|
console.log();
|
|
12757
|
-
console.log(
|
|
12850
|
+
console.log(chalk35.bold("Running agent:"));
|
|
12758
12851
|
printCommand(
|
|
12759
12852
|
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
|
|
12760
12853
|
);
|
|
@@ -12780,14 +12873,14 @@ async function runAgent(agentName, artifactDir, prompt, cwd, options) {
|
|
|
12780
12873
|
}
|
|
12781
12874
|
await autoPullArtifact(runOutput, artifactDir);
|
|
12782
12875
|
}
|
|
12783
|
-
var cookAction = new
|
|
12876
|
+
var cookAction = new Command35().name("cook").description("Quick start: prepare, compose and run agent from vm0.yaml").argument("[prompt]", "Prompt for the agent").option(
|
|
12784
12877
|
"--env-file <path>",
|
|
12785
12878
|
"Load environment variables from file (priority: CLI flags > file > env vars)"
|
|
12786
12879
|
).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(
|
|
12787
12880
|
withErrorHandler(
|
|
12788
12881
|
async (prompt, options) => {
|
|
12789
12882
|
if (options.autoUpdate !== false) {
|
|
12790
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12883
|
+
const shouldExit = await checkAndUpgrade("9.61.0", prompt);
|
|
12791
12884
|
if (shouldExit) {
|
|
12792
12885
|
process.exit(0);
|
|
12793
12886
|
}
|
|
@@ -12815,8 +12908,8 @@ var cookAction = new Command34().name("cook").description("Quick start: prepare,
|
|
|
12815
12908
|
);
|
|
12816
12909
|
|
|
12817
12910
|
// src/commands/cook/logs.ts
|
|
12818
|
-
import { Command as
|
|
12819
|
-
var logsCommand = new
|
|
12911
|
+
import { Command as Command36 } from "commander";
|
|
12912
|
+
var logsCommand = new Command36().name("logs").description("View logs from the last cook run").option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
|
|
12820
12913
|
"--since <time>",
|
|
12821
12914
|
"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)"
|
|
12822
12915
|
).option("--tail <n>", "Show last N entries (default: 5, max: 100)").option("--head <n>", "Show first N entries (max: 100)").action(
|
|
@@ -12865,9 +12958,9 @@ var logsCommand = new Command35().name("logs").description("View logs from the l
|
|
|
12865
12958
|
);
|
|
12866
12959
|
|
|
12867
12960
|
// src/commands/cook/continue.ts
|
|
12868
|
-
import { Command as
|
|
12961
|
+
import { Command as Command37, Option as Option6 } from "commander";
|
|
12869
12962
|
import path14 from "path";
|
|
12870
|
-
var continueCommand2 = new
|
|
12963
|
+
var continueCommand2 = new Command37().name("continue").description(
|
|
12871
12964
|
"Continue from the last session (latest conversation and artifact)"
|
|
12872
12965
|
).argument("<prompt>", "Prompt for the continued agent").option(
|
|
12873
12966
|
"--env-file <path>",
|
|
@@ -12914,9 +13007,9 @@ var continueCommand2 = new Command36().name("continue").description(
|
|
|
12914
13007
|
);
|
|
12915
13008
|
|
|
12916
13009
|
// src/commands/cook/resume.ts
|
|
12917
|
-
import { Command as
|
|
13010
|
+
import { Command as Command38, Option as Option7 } from "commander";
|
|
12918
13011
|
import path15 from "path";
|
|
12919
|
-
var resumeCommand2 = new
|
|
13012
|
+
var resumeCommand2 = new Command38().name("resume").description(
|
|
12920
13013
|
"Resume from the last checkpoint (snapshotted conversation and artifact)"
|
|
12921
13014
|
).argument("<prompt>", "Prompt for the resumed agent").option(
|
|
12922
13015
|
"--env-file <path>",
|
|
@@ -12969,8 +13062,8 @@ cookAction.addCommand(resumeCommand2);
|
|
|
12969
13062
|
var cookCommand = cookAction;
|
|
12970
13063
|
|
|
12971
13064
|
// src/commands/logs/index.ts
|
|
12972
|
-
import { Command as
|
|
12973
|
-
import
|
|
13065
|
+
import { Command as Command40 } from "commander";
|
|
13066
|
+
import chalk37 from "chalk";
|
|
12974
13067
|
|
|
12975
13068
|
// src/lib/api/api-client.ts
|
|
12976
13069
|
import { initClient as initClient12 } from "@ts-rest/core";
|
|
@@ -13667,8 +13760,8 @@ async function paginate(options) {
|
|
|
13667
13760
|
}
|
|
13668
13761
|
|
|
13669
13762
|
// src/commands/logs/search.ts
|
|
13670
|
-
import { Command as
|
|
13671
|
-
import
|
|
13763
|
+
import { Command as Command39 } from "commander";
|
|
13764
|
+
import chalk36 from "chalk";
|
|
13672
13765
|
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
13673
13766
|
function renderEvent(event, renderer) {
|
|
13674
13767
|
const eventData = event.eventData;
|
|
@@ -13724,7 +13817,7 @@ function renderResults(response) {
|
|
|
13724
13817
|
isFirstGroup = false;
|
|
13725
13818
|
const firstTimestamp = group.results[0].matchedEvent.createdAt;
|
|
13726
13819
|
console.log(
|
|
13727
|
-
|
|
13820
|
+
chalk36.bold(formatRunHeader(runId, group.agentName, firstTimestamp))
|
|
13728
13821
|
);
|
|
13729
13822
|
for (const result of group.results) {
|
|
13730
13823
|
const renderer = new EventRenderer({
|
|
@@ -13744,13 +13837,13 @@ function renderResults(response) {
|
|
|
13744
13837
|
if (response.hasMore) {
|
|
13745
13838
|
console.log();
|
|
13746
13839
|
console.log(
|
|
13747
|
-
|
|
13840
|
+
chalk36.dim(
|
|
13748
13841
|
` Showing first ${response.results.length} matches. Use --limit to see more.`
|
|
13749
13842
|
)
|
|
13750
13843
|
);
|
|
13751
13844
|
}
|
|
13752
13845
|
}
|
|
13753
|
-
var searchCommand = new
|
|
13846
|
+
var searchCommand = new Command39().name("search").description("Search agent events across runs").argument("<keyword>", "Search keyword").option("-A, --after-context <n>", "Show n events after each match").option("-B, --before-context <n>", "Show n events before each match").option("-C, --context <n>", "Show n events before and after each match").option("--agent <name>", "Filter by agent name").option("--run <id>", "Filter by specific run ID").option("--since <time>", "Search logs since (default: 7d)").option("--limit <n>", "Maximum number of matches (default: 20)").action(
|
|
13754
13847
|
withErrorHandler(async (keyword, options) => {
|
|
13755
13848
|
const { before, after } = parseContextOptions(options);
|
|
13756
13849
|
const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
|
|
@@ -13765,9 +13858,9 @@ var searchCommand = new Command38().name("search").description("Search agent eve
|
|
|
13765
13858
|
after
|
|
13766
13859
|
});
|
|
13767
13860
|
if (response.results.length === 0) {
|
|
13768
|
-
console.log(
|
|
13861
|
+
console.log(chalk36.dim("No matches found"));
|
|
13769
13862
|
console.log(
|
|
13770
|
-
|
|
13863
|
+
chalk36.dim(
|
|
13771
13864
|
" Try a broader search with --since 30d or a different keyword"
|
|
13772
13865
|
)
|
|
13773
13866
|
);
|
|
@@ -13804,28 +13897,28 @@ function formatNetworkLog(entry) {
|
|
|
13804
13897
|
let statusColor;
|
|
13805
13898
|
const status = entry.status || 0;
|
|
13806
13899
|
if (status >= 200 && status < 300) {
|
|
13807
|
-
statusColor =
|
|
13900
|
+
statusColor = chalk37.green;
|
|
13808
13901
|
} else if (status >= 300 && status < 400) {
|
|
13809
|
-
statusColor =
|
|
13902
|
+
statusColor = chalk37.yellow;
|
|
13810
13903
|
} else if (status >= 400) {
|
|
13811
|
-
statusColor =
|
|
13904
|
+
statusColor = chalk37.red;
|
|
13812
13905
|
} else {
|
|
13813
|
-
statusColor =
|
|
13906
|
+
statusColor = chalk37.gray;
|
|
13814
13907
|
}
|
|
13815
13908
|
let latencyColor;
|
|
13816
13909
|
const latencyMs = entry.latency_ms || 0;
|
|
13817
13910
|
if (latencyMs < 500) {
|
|
13818
|
-
latencyColor =
|
|
13911
|
+
latencyColor = chalk37.green;
|
|
13819
13912
|
} else if (latencyMs < 2e3) {
|
|
13820
|
-
latencyColor =
|
|
13913
|
+
latencyColor = chalk37.yellow;
|
|
13821
13914
|
} else {
|
|
13822
|
-
latencyColor =
|
|
13915
|
+
latencyColor = chalk37.red;
|
|
13823
13916
|
}
|
|
13824
13917
|
const method = entry.method || "???";
|
|
13825
13918
|
const requestSize = entry.request_size || 0;
|
|
13826
13919
|
const responseSize = entry.response_size || 0;
|
|
13827
13920
|
const url = entry.url || entry.host || "unknown";
|
|
13828
|
-
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${
|
|
13921
|
+
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${chalk37.dim(url)}`;
|
|
13829
13922
|
}
|
|
13830
13923
|
function createLogRenderer(verbose) {
|
|
13831
13924
|
return new EventRenderer({
|
|
@@ -13862,7 +13955,7 @@ function getLogType(options) {
|
|
|
13862
13955
|
if (options.network) return "network";
|
|
13863
13956
|
return "agent";
|
|
13864
13957
|
}
|
|
13865
|
-
var logsCommand2 = new
|
|
13958
|
+
var logsCommand2 = new Command40().name("logs").description("View and search agent run logs").argument("[runId]", "Run ID to fetch logs for").addCommand(searchCommand).option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
|
|
13866
13959
|
"--since <time>",
|
|
13867
13960
|
"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z, 1705312200)"
|
|
13868
13961
|
).option("--tail <n>", "Show last N entries (default: 5)").option("--head <n>", "Show first N entries").option("--all", "Fetch all log entries").action(
|
|
@@ -13931,7 +14024,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13931
14024
|
order: options.order
|
|
13932
14025
|
});
|
|
13933
14026
|
if (firstResponse.events.length === 0) {
|
|
13934
|
-
console.log(
|
|
14027
|
+
console.log(chalk37.yellow("No agent events found for this run"));
|
|
13935
14028
|
return;
|
|
13936
14029
|
}
|
|
13937
14030
|
const framework = firstResponse.framework;
|
|
@@ -13964,7 +14057,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13964
14057
|
for (const event of events) {
|
|
13965
14058
|
renderAgentEvent(event, framework, renderer);
|
|
13966
14059
|
}
|
|
13967
|
-
console.log(
|
|
14060
|
+
console.log(chalk37.dim(`View on platform: ${platformUrl}`));
|
|
13968
14061
|
}
|
|
13969
14062
|
async function showSystemLog(runId, options) {
|
|
13970
14063
|
const limit = options.targetCount === "all" ? PAGE_LIMIT : Math.min(options.targetCount, PAGE_LIMIT);
|
|
@@ -13974,7 +14067,7 @@ async function showSystemLog(runId, options) {
|
|
|
13974
14067
|
order: options.order
|
|
13975
14068
|
});
|
|
13976
14069
|
if (!response.systemLog) {
|
|
13977
|
-
console.log(
|
|
14070
|
+
console.log(chalk37.yellow("No system log found for this run"));
|
|
13978
14071
|
return;
|
|
13979
14072
|
}
|
|
13980
14073
|
console.log(response.systemLog);
|
|
@@ -13986,7 +14079,7 @@ async function showMetrics(runId, options) {
|
|
|
13986
14079
|
order: options.order
|
|
13987
14080
|
});
|
|
13988
14081
|
if (firstResponse.metrics.length === 0) {
|
|
13989
|
-
console.log(
|
|
14082
|
+
console.log(chalk37.yellow("No metrics found for this run"));
|
|
13990
14083
|
return;
|
|
13991
14084
|
}
|
|
13992
14085
|
let allMetrics;
|
|
@@ -14026,7 +14119,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
14026
14119
|
});
|
|
14027
14120
|
if (firstResponse.networkLogs.length === 0) {
|
|
14028
14121
|
console.log(
|
|
14029
|
-
|
|
14122
|
+
chalk37.yellow(
|
|
14030
14123
|
"No network logs found for this run. Network logs are only captured when using a runner with proxy enabled"
|
|
14031
14124
|
)
|
|
14032
14125
|
);
|
|
@@ -14063,17 +14156,17 @@ async function showNetworkLogs(runId, options) {
|
|
|
14063
14156
|
}
|
|
14064
14157
|
|
|
14065
14158
|
// src/commands/org/index.ts
|
|
14066
|
-
import { Command as
|
|
14159
|
+
import { Command as Command49 } from "commander";
|
|
14067
14160
|
|
|
14068
14161
|
// src/commands/org/status.ts
|
|
14069
|
-
import { Command as
|
|
14070
|
-
import
|
|
14071
|
-
var statusCommand5 = new
|
|
14162
|
+
import { Command as Command41 } from "commander";
|
|
14163
|
+
import chalk38 from "chalk";
|
|
14164
|
+
var statusCommand5 = new Command41().name("status").description("View current organization status").action(
|
|
14072
14165
|
withErrorHandler(async () => {
|
|
14073
14166
|
try {
|
|
14074
14167
|
const org = await getOrg();
|
|
14075
|
-
console.log(
|
|
14076
|
-
console.log(` Slug: ${
|
|
14168
|
+
console.log(chalk38.bold("Organization Information:"));
|
|
14169
|
+
console.log(` Slug: ${chalk38.green(org.slug)}`);
|
|
14077
14170
|
} catch (error) {
|
|
14078
14171
|
if (error instanceof Error && error.message.includes("No org configured")) {
|
|
14079
14172
|
throw new Error("No organization configured", {
|
|
@@ -14086,9 +14179,9 @@ var statusCommand5 = new Command40().name("status").description("View current or
|
|
|
14086
14179
|
);
|
|
14087
14180
|
|
|
14088
14181
|
// src/commands/org/set.ts
|
|
14089
|
-
import { Command as
|
|
14090
|
-
import
|
|
14091
|
-
var setCommand = new
|
|
14182
|
+
import { Command as Command42 } from "commander";
|
|
14183
|
+
import chalk39 from "chalk";
|
|
14184
|
+
var setCommand = new Command42().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
14092
14185
|
"--force",
|
|
14093
14186
|
"Force change existing organization (may break references)"
|
|
14094
14187
|
).action(
|
|
@@ -14105,10 +14198,10 @@ var setCommand = new Command41().name("set").description("Rename your organizati
|
|
|
14105
14198
|
}
|
|
14106
14199
|
const org = await updateOrg({ slug, force: true });
|
|
14107
14200
|
await saveConfig({ activeOrg: org.slug });
|
|
14108
|
-
console.log(
|
|
14201
|
+
console.log(chalk39.green(`\u2713 Organization updated to ${org.slug}`));
|
|
14109
14202
|
console.log();
|
|
14110
14203
|
console.log("Your agents will now be namespaced as:");
|
|
14111
|
-
console.log(
|
|
14204
|
+
console.log(chalk39.cyan(` ${org.slug}/<agent-name>`));
|
|
14112
14205
|
} catch (error) {
|
|
14113
14206
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
14114
14207
|
throw new Error(
|
|
@@ -14121,32 +14214,32 @@ var setCommand = new Command41().name("set").description("Rename your organizati
|
|
|
14121
14214
|
);
|
|
14122
14215
|
|
|
14123
14216
|
// src/commands/org/list.ts
|
|
14124
|
-
import { Command as
|
|
14125
|
-
import
|
|
14126
|
-
var listCommand5 = new
|
|
14217
|
+
import { Command as Command43 } from "commander";
|
|
14218
|
+
import chalk40 from "chalk";
|
|
14219
|
+
var listCommand5 = new Command43().name("list").description("List all accessible organizations").action(
|
|
14127
14220
|
withErrorHandler(async () => {
|
|
14128
14221
|
const result = await listOrgs();
|
|
14129
14222
|
const activeOrg = await getActiveOrg();
|
|
14130
|
-
console.log(
|
|
14223
|
+
console.log(chalk40.bold("Available organizations:"));
|
|
14131
14224
|
for (const org of result.orgs) {
|
|
14132
14225
|
const isCurrent = org.slug === activeOrg;
|
|
14133
|
-
const marker = isCurrent ?
|
|
14226
|
+
const marker = isCurrent ? chalk40.green("* ") : " ";
|
|
14134
14227
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
14135
|
-
const currentLabel = isCurrent ?
|
|
14228
|
+
const currentLabel = isCurrent ? chalk40.dim(" \u2190 current") : "";
|
|
14136
14229
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
14137
14230
|
}
|
|
14138
14231
|
})
|
|
14139
14232
|
);
|
|
14140
14233
|
|
|
14141
14234
|
// src/commands/org/use.ts
|
|
14142
|
-
import { Command as
|
|
14143
|
-
import
|
|
14144
|
-
var useCommand = new
|
|
14235
|
+
import { Command as Command44 } from "commander";
|
|
14236
|
+
import chalk41 from "chalk";
|
|
14237
|
+
var useCommand = new Command44().name("use").description("Switch to a different organization").argument("[slug]", "Organization slug to switch to").option("--personal", "Switch to personal org").action(
|
|
14145
14238
|
withErrorHandler(
|
|
14146
14239
|
async (slug, options) => {
|
|
14147
14240
|
if (options.personal) {
|
|
14148
14241
|
await saveConfig({ activeOrg: void 0 });
|
|
14149
|
-
console.log(
|
|
14242
|
+
console.log(chalk41.green("\u2713 Switched to personal org."));
|
|
14150
14243
|
return;
|
|
14151
14244
|
}
|
|
14152
14245
|
if (!slug) {
|
|
@@ -14162,27 +14255,27 @@ var useCommand = new Command43().name("use").description("Switch to a different
|
|
|
14162
14255
|
);
|
|
14163
14256
|
}
|
|
14164
14257
|
await saveConfig({ activeOrg: slug });
|
|
14165
|
-
console.log(
|
|
14258
|
+
console.log(chalk41.green(`\u2713 Switched to organization: ${slug}`));
|
|
14166
14259
|
}
|
|
14167
14260
|
)
|
|
14168
14261
|
);
|
|
14169
14262
|
|
|
14170
14263
|
// src/commands/org/members.ts
|
|
14171
|
-
import { Command as
|
|
14172
|
-
import
|
|
14173
|
-
var membersCommand = new
|
|
14264
|
+
import { Command as Command45 } from "commander";
|
|
14265
|
+
import chalk42 from "chalk";
|
|
14266
|
+
var membersCommand = new Command45().name("members").description("View organization members").action(
|
|
14174
14267
|
withErrorHandler(async () => {
|
|
14175
14268
|
try {
|
|
14176
14269
|
const status = await getOrgMembers();
|
|
14177
|
-
console.log(
|
|
14270
|
+
console.log(chalk42.bold(`Organization: ${status.slug}`));
|
|
14178
14271
|
console.log(` Role: ${status.role}`);
|
|
14179
14272
|
console.log(
|
|
14180
14273
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
14181
14274
|
);
|
|
14182
14275
|
console.log();
|
|
14183
|
-
console.log(
|
|
14276
|
+
console.log(chalk42.bold("Members:"));
|
|
14184
14277
|
for (const member of status.members) {
|
|
14185
|
-
const roleTag = member.role === "admin" ?
|
|
14278
|
+
const roleTag = member.role === "admin" ? chalk42.yellow(` (${member.role})`) : chalk42.dim(` (${member.role})`);
|
|
14186
14279
|
console.log(` ${member.email}${roleTag}`);
|
|
14187
14280
|
}
|
|
14188
14281
|
} catch (error) {
|
|
@@ -14197,47 +14290,47 @@ var membersCommand = new Command44().name("members").description("View organizat
|
|
|
14197
14290
|
);
|
|
14198
14291
|
|
|
14199
14292
|
// src/commands/org/invite.ts
|
|
14200
|
-
import { Command as
|
|
14201
|
-
import
|
|
14202
|
-
var inviteCommand = new
|
|
14293
|
+
import { Command as Command46 } from "commander";
|
|
14294
|
+
import chalk43 from "chalk";
|
|
14295
|
+
var inviteCommand = new Command46().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").action(
|
|
14203
14296
|
withErrorHandler(async (options) => {
|
|
14204
14297
|
await inviteOrgMember(options.email);
|
|
14205
|
-
console.log(
|
|
14298
|
+
console.log(chalk43.green(`\u2713 Invitation sent to ${options.email}`));
|
|
14206
14299
|
})
|
|
14207
14300
|
);
|
|
14208
14301
|
|
|
14209
14302
|
// src/commands/org/remove.ts
|
|
14210
|
-
import { Command as
|
|
14211
|
-
import
|
|
14212
|
-
var removeCommand = new
|
|
14303
|
+
import { Command as Command47 } from "commander";
|
|
14304
|
+
import chalk44 from "chalk";
|
|
14305
|
+
var removeCommand = new Command47().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
14213
14306
|
withErrorHandler(async (email) => {
|
|
14214
14307
|
await removeOrgMember(email);
|
|
14215
|
-
console.log(
|
|
14308
|
+
console.log(chalk44.green(`\u2713 Removed ${email} from organization`));
|
|
14216
14309
|
})
|
|
14217
14310
|
);
|
|
14218
14311
|
|
|
14219
14312
|
// src/commands/org/leave.ts
|
|
14220
|
-
import { Command as
|
|
14221
|
-
import
|
|
14222
|
-
var leaveCommand = new
|
|
14313
|
+
import { Command as Command48 } from "commander";
|
|
14314
|
+
import chalk45 from "chalk";
|
|
14315
|
+
var leaveCommand = new Command48().name("leave").description("Leave the current organization").action(
|
|
14223
14316
|
withErrorHandler(async () => {
|
|
14224
14317
|
await leaveOrg();
|
|
14225
14318
|
await saveConfig({ activeOrg: void 0 });
|
|
14226
14319
|
console.log(
|
|
14227
|
-
|
|
14320
|
+
chalk45.green("\u2713 Left organization. Switched to personal org.")
|
|
14228
14321
|
);
|
|
14229
14322
|
})
|
|
14230
14323
|
);
|
|
14231
14324
|
|
|
14232
14325
|
// src/commands/org/index.ts
|
|
14233
|
-
var orgCommand = new
|
|
14326
|
+
var orgCommand = new Command49().name("org").description("Manage your organization (namespace for agents)").addCommand(statusCommand5).addCommand(setCommand).addCommand(listCommand5).addCommand(useCommand).addCommand(membersCommand).addCommand(inviteCommand).addCommand(removeCommand).addCommand(leaveCommand);
|
|
14234
14327
|
|
|
14235
14328
|
// src/commands/agent/index.ts
|
|
14236
|
-
import { Command as
|
|
14329
|
+
import { Command as Command54 } from "commander";
|
|
14237
14330
|
|
|
14238
14331
|
// src/commands/agent/clone.ts
|
|
14239
|
-
import { Command as
|
|
14240
|
-
import
|
|
14332
|
+
import { Command as Command50 } from "commander";
|
|
14333
|
+
import chalk46 from "chalk";
|
|
14241
14334
|
import { mkdtempSync as mkdtempSync5 } from "fs";
|
|
14242
14335
|
import { mkdir as mkdir7, writeFile as writeFile6, readdir as readdir2, copyFile, rm as rm4 } from "fs/promises";
|
|
14243
14336
|
import { join as join10, dirname as dirname3, resolve, sep } from "path";
|
|
@@ -14268,13 +14361,13 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
14268
14361
|
throw new Error("Invalid instructions path: path traversal detected");
|
|
14269
14362
|
}
|
|
14270
14363
|
const volumeName = getInstructionsStorageName(agentName);
|
|
14271
|
-
console.log(
|
|
14364
|
+
console.log(chalk46.dim("Downloading instructions..."));
|
|
14272
14365
|
const downloadInfo = await getStorageDownload({
|
|
14273
14366
|
name: volumeName,
|
|
14274
14367
|
type: "volume"
|
|
14275
14368
|
});
|
|
14276
14369
|
if ("empty" in downloadInfo) {
|
|
14277
|
-
console.log(
|
|
14370
|
+
console.log(chalk46.yellow("\u26A0 Instructions volume is empty"));
|
|
14278
14371
|
return false;
|
|
14279
14372
|
}
|
|
14280
14373
|
const response = await fetch(downloadInfo.url);
|
|
@@ -14289,7 +14382,7 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
14289
14382
|
const files = await readdir2(tmpDir);
|
|
14290
14383
|
const mdFile = files.find((f) => f === "CLAUDE.md" || f === "AGENTS.md");
|
|
14291
14384
|
if (!mdFile) {
|
|
14292
|
-
console.log(
|
|
14385
|
+
console.log(chalk46.yellow("\u26A0 No instructions file found in volume"));
|
|
14293
14386
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
14294
14387
|
return false;
|
|
14295
14388
|
}
|
|
@@ -14298,7 +14391,7 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
14298
14391
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
14299
14392
|
return true;
|
|
14300
14393
|
}
|
|
14301
|
-
var cloneCommand4 = new
|
|
14394
|
+
var cloneCommand4 = new Command50().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(
|
|
14302
14395
|
withErrorHandler(async (name, destination) => {
|
|
14303
14396
|
const targetDir = destination || name;
|
|
14304
14397
|
const dirStatus = checkDirectoryStatus(targetDir);
|
|
@@ -14319,7 +14412,7 @@ var cloneCommand4 = new Command49().name("clone").description("Clone agent compo
|
|
|
14319
14412
|
await mkdir7(targetDir, { recursive: true });
|
|
14320
14413
|
const yamlPath = join10(targetDir, "vm0.yaml");
|
|
14321
14414
|
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
14322
|
-
console.log(
|
|
14415
|
+
console.log(chalk46.green("\u2713 Created vm0.yaml"));
|
|
14323
14416
|
const agentKey = Object.keys(content.agents)[0];
|
|
14324
14417
|
const agent = agentKey ? content.agents[agentKey] : void 0;
|
|
14325
14418
|
if (agent?.instructions) {
|
|
@@ -14330,27 +14423,27 @@ var cloneCommand4 = new Command49().name("clone").description("Clone agent compo
|
|
|
14330
14423
|
targetDir
|
|
14331
14424
|
);
|
|
14332
14425
|
if (instructionsDownloaded) {
|
|
14333
|
-
console.log(
|
|
14426
|
+
console.log(chalk46.green(`\u2713 Downloaded ${agent.instructions}`));
|
|
14334
14427
|
}
|
|
14335
14428
|
} catch (error) {
|
|
14336
14429
|
console.log(
|
|
14337
|
-
|
|
14430
|
+
chalk46.yellow(
|
|
14338
14431
|
`\u26A0 Could not download instructions: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
14339
14432
|
)
|
|
14340
14433
|
);
|
|
14341
14434
|
}
|
|
14342
14435
|
}
|
|
14343
14436
|
console.log();
|
|
14344
|
-
console.log(
|
|
14345
|
-
console.log(
|
|
14346
|
-
console.log(
|
|
14437
|
+
console.log(chalk46.green(`\u2713 Successfully cloned agent: ${name}`));
|
|
14438
|
+
console.log(chalk46.dim(` Location: ${targetDir}/`));
|
|
14439
|
+
console.log(chalk46.dim(` Version: ${compose.headVersionId.slice(0, 8)}`));
|
|
14347
14440
|
})
|
|
14348
14441
|
);
|
|
14349
14442
|
|
|
14350
14443
|
// src/commands/agent/delete.ts
|
|
14351
|
-
import { Command as
|
|
14352
|
-
import
|
|
14353
|
-
var deleteCommand = new
|
|
14444
|
+
import { Command as Command51 } from "commander";
|
|
14445
|
+
import chalk47 from "chalk";
|
|
14446
|
+
var deleteCommand = new Command51().name("delete").alias("rm").description("Delete an agent").argument("<name>", "Agent name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
14354
14447
|
withErrorHandler(async (name, options) => {
|
|
14355
14448
|
const compose = await getComposeByName(name);
|
|
14356
14449
|
if (!compose) {
|
|
@@ -14364,7 +14457,7 @@ var deleteCommand = new Command50().name("delete").alias("rm").description("Dele
|
|
|
14364
14457
|
}
|
|
14365
14458
|
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
14366
14459
|
if (!confirmed) {
|
|
14367
|
-
console.log(
|
|
14460
|
+
console.log(chalk47.dim("Cancelled"));
|
|
14368
14461
|
return;
|
|
14369
14462
|
}
|
|
14370
14463
|
}
|
|
@@ -14378,14 +14471,14 @@ var deleteCommand = new Command50().name("delete").alias("rm").description("Dele
|
|
|
14378
14471
|
}
|
|
14379
14472
|
throw error;
|
|
14380
14473
|
}
|
|
14381
|
-
console.log(
|
|
14474
|
+
console.log(chalk47.green(`\u2713 Agent '${name}' deleted`));
|
|
14382
14475
|
})
|
|
14383
14476
|
);
|
|
14384
14477
|
|
|
14385
14478
|
// src/commands/agent/list.ts
|
|
14386
|
-
import { Command as
|
|
14387
|
-
import
|
|
14388
|
-
var listCommand6 = new
|
|
14479
|
+
import { Command as Command52 } from "commander";
|
|
14480
|
+
import chalk48 from "chalk";
|
|
14481
|
+
var listCommand6 = new Command52().name("list").alias("ls").description("List all agent composes").action(
|
|
14389
14482
|
withErrorHandler(async () => {
|
|
14390
14483
|
const response = await httpGet("/api/agent/composes/list");
|
|
14391
14484
|
if (!response.ok) {
|
|
@@ -14394,9 +14487,9 @@ var listCommand6 = new Command51().name("list").alias("ls").description("List al
|
|
|
14394
14487
|
}
|
|
14395
14488
|
const data = await response.json();
|
|
14396
14489
|
if (data.composes.length === 0) {
|
|
14397
|
-
console.log(
|
|
14490
|
+
console.log(chalk48.dim("No agent composes found"));
|
|
14398
14491
|
console.log(
|
|
14399
|
-
|
|
14492
|
+
chalk48.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
14400
14493
|
);
|
|
14401
14494
|
return;
|
|
14402
14495
|
}
|
|
@@ -14404,9 +14497,9 @@ var listCommand6 = new Command51().name("list").alias("ls").description("List al
|
|
|
14404
14497
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
14405
14498
|
" "
|
|
14406
14499
|
);
|
|
14407
|
-
console.log(
|
|
14500
|
+
console.log(chalk48.dim(header));
|
|
14408
14501
|
for (const compose of data.composes) {
|
|
14409
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) :
|
|
14502
|
+
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk48.dim("-");
|
|
14410
14503
|
const row = [
|
|
14411
14504
|
compose.name.padEnd(nameWidth),
|
|
14412
14505
|
versionShort,
|
|
@@ -14418,8 +14511,8 @@ var listCommand6 = new Command51().name("list").alias("ls").description("List al
|
|
|
14418
14511
|
);
|
|
14419
14512
|
|
|
14420
14513
|
// src/commands/agent/status.ts
|
|
14421
|
-
import { Command as
|
|
14422
|
-
import
|
|
14514
|
+
import { Command as Command53 } from "commander";
|
|
14515
|
+
import chalk49 from "chalk";
|
|
14423
14516
|
|
|
14424
14517
|
// src/lib/domain/source-derivation.ts
|
|
14425
14518
|
import * as fs10 from "fs/promises";
|
|
@@ -14533,20 +14626,20 @@ function formatVariableSources(sources) {
|
|
|
14533
14626
|
if (sources.secrets.length > 0) {
|
|
14534
14627
|
console.log(` Secrets:`);
|
|
14535
14628
|
for (const secret of sources.secrets) {
|
|
14536
|
-
const sourceInfo =
|
|
14629
|
+
const sourceInfo = chalk49.dim(`(${secret.source})`);
|
|
14537
14630
|
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
14538
14631
|
}
|
|
14539
14632
|
}
|
|
14540
14633
|
if (sources.vars.length > 0) {
|
|
14541
14634
|
console.log(` Vars:`);
|
|
14542
14635
|
for (const v of sources.vars) {
|
|
14543
|
-
const sourceInfo =
|
|
14636
|
+
const sourceInfo = chalk49.dim(`(${v.source})`);
|
|
14544
14637
|
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
14545
14638
|
}
|
|
14546
14639
|
}
|
|
14547
14640
|
}
|
|
14548
14641
|
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
14549
|
-
console.log(` ${
|
|
14642
|
+
console.log(` ${chalk49.cyan(agentName)}:`);
|
|
14550
14643
|
console.log(` Framework: ${agent.framework}`);
|
|
14551
14644
|
if (agent.image) {
|
|
14552
14645
|
console.log(` Image: ${agent.image}`);
|
|
@@ -14564,16 +14657,16 @@ function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
|
14564
14657
|
}
|
|
14565
14658
|
}
|
|
14566
14659
|
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
14567
|
-
console.log(
|
|
14568
|
-
console.log(
|
|
14660
|
+
console.log(chalk49.bold("Name:") + ` ${name}`);
|
|
14661
|
+
console.log(chalk49.bold("Version:") + ` ${versionId}`);
|
|
14569
14662
|
console.log();
|
|
14570
|
-
console.log(
|
|
14663
|
+
console.log(chalk49.bold("Agents:"));
|
|
14571
14664
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
14572
14665
|
const agentSources = variableSources?.get(agentName);
|
|
14573
14666
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
14574
14667
|
}
|
|
14575
14668
|
}
|
|
14576
|
-
var statusCommand6 = new
|
|
14669
|
+
var statusCommand6 = new Command53().name("status").description("Show status of agent compose").argument(
|
|
14577
14670
|
"<name[:version]>",
|
|
14578
14671
|
"Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
|
|
14579
14672
|
).option("--no-sources", "Skip fetching skills to determine variable sources").action(
|
|
@@ -14626,7 +14719,7 @@ var statusCommand6 = new Command52().name("status").description("Show status of
|
|
|
14626
14719
|
});
|
|
14627
14720
|
} catch {
|
|
14628
14721
|
console.error(
|
|
14629
|
-
|
|
14722
|
+
chalk49.yellow(
|
|
14630
14723
|
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
14631
14724
|
)
|
|
14632
14725
|
);
|
|
@@ -14642,11 +14735,11 @@ var statusCommand6 = new Command52().name("status").description("Show status of
|
|
|
14642
14735
|
);
|
|
14643
14736
|
|
|
14644
14737
|
// src/commands/agent/index.ts
|
|
14645
|
-
var agentCommand = new
|
|
14738
|
+
var agentCommand = new Command54().name("agent").description("Manage agent composes").addCommand(cloneCommand4).addCommand(deleteCommand).addCommand(listCommand6).addCommand(statusCommand6);
|
|
14646
14739
|
|
|
14647
14740
|
// src/commands/init/index.ts
|
|
14648
|
-
import { Command as
|
|
14649
|
-
import
|
|
14741
|
+
import { Command as Command55 } from "commander";
|
|
14742
|
+
import chalk50 from "chalk";
|
|
14650
14743
|
import path17 from "path";
|
|
14651
14744
|
import { existsSync as existsSync11 } from "fs";
|
|
14652
14745
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -14684,7 +14777,7 @@ function checkExistingFiles() {
|
|
|
14684
14777
|
if (existsSync11(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
14685
14778
|
return existingFiles;
|
|
14686
14779
|
}
|
|
14687
|
-
var initCommand4 = new
|
|
14780
|
+
var initCommand4 = new Command55().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(
|
|
14688
14781
|
withErrorHandler(async (options) => {
|
|
14689
14782
|
const existingFiles = checkExistingFiles();
|
|
14690
14783
|
if (existingFiles.length > 0 && !options.force) {
|
|
@@ -14713,7 +14806,7 @@ var initCommand4 = new Command54().name("init").description("Initialize a new VM
|
|
|
14713
14806
|
}
|
|
14714
14807
|
);
|
|
14715
14808
|
if (name === void 0) {
|
|
14716
|
-
console.log(
|
|
14809
|
+
console.log(chalk50.dim("Cancelled"));
|
|
14717
14810
|
return;
|
|
14718
14811
|
}
|
|
14719
14812
|
agentName = name;
|
|
@@ -14727,33 +14820,33 @@ var initCommand4 = new Command54().name("init").description("Initialize a new VM
|
|
|
14727
14820
|
}
|
|
14728
14821
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
14729
14822
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
14730
|
-
console.log(
|
|
14823
|
+
console.log(chalk50.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
14731
14824
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
14732
14825
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
14733
|
-
console.log(
|
|
14826
|
+
console.log(chalk50.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
14734
14827
|
console.log();
|
|
14735
14828
|
console.log("Next steps:");
|
|
14736
14829
|
console.log(
|
|
14737
|
-
` 1. Set up model provider (one-time): ${
|
|
14830
|
+
` 1. Set up model provider (one-time): ${chalk50.cyan("vm0 model-provider setup")}`
|
|
14738
14831
|
);
|
|
14739
14832
|
console.log(
|
|
14740
|
-
` 2. Edit ${
|
|
14833
|
+
` 2. Edit ${chalk50.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
14741
14834
|
);
|
|
14742
14835
|
console.log(
|
|
14743
|
-
` Or install Claude plugin: ${
|
|
14836
|
+
` Or install Claude plugin: ${chalk50.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
14744
14837
|
);
|
|
14745
14838
|
console.log(
|
|
14746
|
-
` 3. Run your agent: ${
|
|
14839
|
+
` 3. Run your agent: ${chalk50.cyan(`vm0 cook "let's start working"`)}`
|
|
14747
14840
|
);
|
|
14748
14841
|
})
|
|
14749
14842
|
);
|
|
14750
14843
|
|
|
14751
14844
|
// src/commands/schedule/index.ts
|
|
14752
|
-
import { Command as
|
|
14845
|
+
import { Command as Command62 } from "commander";
|
|
14753
14846
|
|
|
14754
14847
|
// src/commands/schedule/setup.ts
|
|
14755
|
-
import { Command as
|
|
14756
|
-
import
|
|
14848
|
+
import { Command as Command56 } from "commander";
|
|
14849
|
+
import chalk51 from "chalk";
|
|
14757
14850
|
|
|
14758
14851
|
// src/lib/domain/schedule-utils.ts
|
|
14759
14852
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -15243,7 +15336,7 @@ async function buildAndDeploy(params) {
|
|
|
15243
15336
|
}
|
|
15244
15337
|
console.log(
|
|
15245
15338
|
`
|
|
15246
|
-
Deploying schedule for agent ${
|
|
15339
|
+
Deploying schedule for agent ${chalk51.cyan(params.agentName)}...`
|
|
15247
15340
|
);
|
|
15248
15341
|
const deployResult = await deploySchedule({
|
|
15249
15342
|
name: params.scheduleName,
|
|
@@ -15266,62 +15359,62 @@ Deploying schedule for agent ${chalk50.cyan(params.agentName)}...`
|
|
|
15266
15359
|
function displayDeployResult(agentName, deployResult) {
|
|
15267
15360
|
if (deployResult.created) {
|
|
15268
15361
|
console.log(
|
|
15269
|
-
|
|
15362
|
+
chalk51.green(`\u2713 Created schedule for agent ${chalk51.cyan(agentName)}`)
|
|
15270
15363
|
);
|
|
15271
15364
|
} else {
|
|
15272
15365
|
console.log(
|
|
15273
|
-
|
|
15366
|
+
chalk51.green(`\u2713 Updated schedule for agent ${chalk51.cyan(agentName)}`)
|
|
15274
15367
|
);
|
|
15275
15368
|
}
|
|
15276
|
-
console.log(
|
|
15369
|
+
console.log(chalk51.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
15277
15370
|
if (deployResult.schedule.triggerType === "loop" && deployResult.schedule.intervalSeconds != null) {
|
|
15278
15371
|
console.log(
|
|
15279
|
-
|
|
15372
|
+
chalk51.dim(
|
|
15280
15373
|
` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`
|
|
15281
15374
|
)
|
|
15282
15375
|
);
|
|
15283
15376
|
} else if (deployResult.schedule.cronExpression) {
|
|
15284
|
-
console.log(
|
|
15377
|
+
console.log(chalk51.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
15285
15378
|
if (deployResult.schedule.nextRunAt) {
|
|
15286
15379
|
const nextRun = formatInTimezone(
|
|
15287
15380
|
deployResult.schedule.nextRunAt,
|
|
15288
15381
|
deployResult.schedule.timezone
|
|
15289
15382
|
);
|
|
15290
|
-
console.log(
|
|
15383
|
+
console.log(chalk51.dim(` Next run: ${nextRun}`));
|
|
15291
15384
|
}
|
|
15292
15385
|
} else if (deployResult.schedule.atTime) {
|
|
15293
15386
|
const atTimeFormatted = formatInTimezone(
|
|
15294
15387
|
deployResult.schedule.atTime,
|
|
15295
15388
|
deployResult.schedule.timezone
|
|
15296
15389
|
);
|
|
15297
|
-
console.log(
|
|
15390
|
+
console.log(chalk51.dim(` At: ${atTimeFormatted}`));
|
|
15298
15391
|
}
|
|
15299
15392
|
}
|
|
15300
15393
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
15301
15394
|
try {
|
|
15302
15395
|
await enableSchedule({ name: scheduleName, composeId });
|
|
15303
15396
|
console.log(
|
|
15304
|
-
|
|
15397
|
+
chalk51.green(`\u2713 Enabled schedule for agent ${chalk51.cyan(agentName)}`)
|
|
15305
15398
|
);
|
|
15306
15399
|
} catch (error) {
|
|
15307
|
-
console.error(
|
|
15400
|
+
console.error(chalk51.yellow("\u26A0 Failed to enable schedule"));
|
|
15308
15401
|
if (error instanceof ApiRequestError) {
|
|
15309
15402
|
if (error.code === "SCHEDULE_PAST") {
|
|
15310
|
-
console.error(
|
|
15403
|
+
console.error(chalk51.dim(" Scheduled time has already passed"));
|
|
15311
15404
|
} else {
|
|
15312
|
-
console.error(
|
|
15405
|
+
console.error(chalk51.dim(` ${error.message}`));
|
|
15313
15406
|
}
|
|
15314
15407
|
} else if (error instanceof Error) {
|
|
15315
|
-
console.error(
|
|
15408
|
+
console.error(chalk51.dim(` ${error.message}`));
|
|
15316
15409
|
}
|
|
15317
15410
|
console.log(
|
|
15318
|
-
` To enable manually: ${
|
|
15411
|
+
` To enable manually: ${chalk51.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
15319
15412
|
);
|
|
15320
15413
|
}
|
|
15321
15414
|
}
|
|
15322
15415
|
function showEnableHint(agentName) {
|
|
15323
15416
|
console.log();
|
|
15324
|
-
console.log(` To enable: ${
|
|
15417
|
+
console.log(` To enable: ${chalk51.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
15325
15418
|
}
|
|
15326
15419
|
async function handleScheduleEnabling(params) {
|
|
15327
15420
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -15342,7 +15435,7 @@ async function handleScheduleEnabling(params) {
|
|
|
15342
15435
|
showEnableHint(agentName);
|
|
15343
15436
|
}
|
|
15344
15437
|
}
|
|
15345
|
-
var setupCommand = new
|
|
15438
|
+
var setupCommand = new Command56().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-n, --name <schedule-name>", 'Schedule name (default: "default")').option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once|loop").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("-i, --interval <seconds>", "Interval in seconds for loop mode").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").option("--notify-email", "Enable email notifications (default: true)").option("--no-notify-email", "Disable email notifications").option("--notify-slack", "Enable Slack notifications (default: true)").option("--no-notify-slack", "Disable Slack notifications").action(
|
|
15346
15439
|
withErrorHandler(async (agentName, options) => {
|
|
15347
15440
|
const { composeId, scheduleName } = await resolveAgent(
|
|
15348
15441
|
agentName,
|
|
@@ -15353,7 +15446,7 @@ var setupCommand = new Command55().name("setup").description("Create or edit a s
|
|
|
15353
15446
|
scheduleName
|
|
15354
15447
|
);
|
|
15355
15448
|
console.log(
|
|
15356
|
-
|
|
15449
|
+
chalk51.dim(
|
|
15357
15450
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
15358
15451
|
)
|
|
15359
15452
|
);
|
|
@@ -15363,12 +15456,12 @@ var setupCommand = new Command55().name("setup").description("Create or edit a s
|
|
|
15363
15456
|
defaults.frequency
|
|
15364
15457
|
);
|
|
15365
15458
|
if (!frequency) {
|
|
15366
|
-
console.log(
|
|
15459
|
+
console.log(chalk51.dim("Cancelled"));
|
|
15367
15460
|
return;
|
|
15368
15461
|
}
|
|
15369
15462
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
15370
15463
|
if (!timing) {
|
|
15371
|
-
console.log(
|
|
15464
|
+
console.log(chalk51.dim("Cancelled"));
|
|
15372
15465
|
return;
|
|
15373
15466
|
}
|
|
15374
15467
|
const { day, time, atTime, intervalSeconds } = timing;
|
|
@@ -15377,7 +15470,7 @@ var setupCommand = new Command55().name("setup").description("Create or edit a s
|
|
|
15377
15470
|
existingSchedule?.timezone
|
|
15378
15471
|
);
|
|
15379
15472
|
if (!timezone) {
|
|
15380
|
-
console.log(
|
|
15473
|
+
console.log(chalk51.dim("Cancelled"));
|
|
15381
15474
|
return;
|
|
15382
15475
|
}
|
|
15383
15476
|
const promptText_ = await gatherPromptText(
|
|
@@ -15385,7 +15478,7 @@ var setupCommand = new Command55().name("setup").description("Create or edit a s
|
|
|
15385
15478
|
existingSchedule?.prompt
|
|
15386
15479
|
);
|
|
15387
15480
|
if (!promptText_) {
|
|
15388
|
-
console.log(
|
|
15481
|
+
console.log(chalk51.dim("Cancelled"));
|
|
15389
15482
|
return;
|
|
15390
15483
|
}
|
|
15391
15484
|
const { notifyEmail, notifySlack } = await gatherNotificationPreferences(
|
|
@@ -15421,15 +15514,15 @@ var setupCommand = new Command55().name("setup").description("Create or edit a s
|
|
|
15421
15514
|
);
|
|
15422
15515
|
|
|
15423
15516
|
// src/commands/schedule/list.ts
|
|
15424
|
-
import { Command as
|
|
15425
|
-
import
|
|
15426
|
-
var listCommand7 = new
|
|
15517
|
+
import { Command as Command57 } from "commander";
|
|
15518
|
+
import chalk52 from "chalk";
|
|
15519
|
+
var listCommand7 = new Command57().name("list").alias("ls").description("List all schedules").action(
|
|
15427
15520
|
withErrorHandler(async () => {
|
|
15428
15521
|
const result = await listSchedules();
|
|
15429
15522
|
if (result.schedules.length === 0) {
|
|
15430
|
-
console.log(
|
|
15523
|
+
console.log(chalk52.dim("No schedules found"));
|
|
15431
15524
|
console.log(
|
|
15432
|
-
|
|
15525
|
+
chalk52.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
15433
15526
|
);
|
|
15434
15527
|
return;
|
|
15435
15528
|
}
|
|
@@ -15454,10 +15547,10 @@ var listCommand7 = new Command56().name("list").alias("ls").description("List al
|
|
|
15454
15547
|
"STATUS".padEnd(8),
|
|
15455
15548
|
"NEXT RUN"
|
|
15456
15549
|
].join(" ");
|
|
15457
|
-
console.log(
|
|
15550
|
+
console.log(chalk52.dim(header));
|
|
15458
15551
|
for (const schedule of result.schedules) {
|
|
15459
15552
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
15460
|
-
const status = schedule.enabled ?
|
|
15553
|
+
const status = schedule.enabled ? chalk52.green("enabled") : chalk52.yellow("disabled");
|
|
15461
15554
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
15462
15555
|
const row = [
|
|
15463
15556
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -15473,48 +15566,48 @@ var listCommand7 = new Command56().name("list").alias("ls").description("List al
|
|
|
15473
15566
|
);
|
|
15474
15567
|
|
|
15475
15568
|
// src/commands/schedule/status.ts
|
|
15476
|
-
import { Command as
|
|
15477
|
-
import
|
|
15569
|
+
import { Command as Command58 } from "commander";
|
|
15570
|
+
import chalk53 from "chalk";
|
|
15478
15571
|
function formatDateTimeStyled(dateStr) {
|
|
15479
|
-
if (!dateStr) return
|
|
15572
|
+
if (!dateStr) return chalk53.dim("-");
|
|
15480
15573
|
const formatted = formatDateTime(dateStr);
|
|
15481
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
15574
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk53.dim("($1)"));
|
|
15482
15575
|
}
|
|
15483
15576
|
function formatTrigger(schedule) {
|
|
15484
15577
|
if (schedule.triggerType === "loop" && schedule.intervalSeconds !== null) {
|
|
15485
|
-
return `interval ${schedule.intervalSeconds}s ${
|
|
15578
|
+
return `interval ${schedule.intervalSeconds}s ${chalk53.dim("(loop)")}`;
|
|
15486
15579
|
}
|
|
15487
15580
|
if (schedule.cronExpression) {
|
|
15488
15581
|
return schedule.cronExpression;
|
|
15489
15582
|
}
|
|
15490
15583
|
if (schedule.atTime) {
|
|
15491
|
-
return `${schedule.atTime} ${
|
|
15584
|
+
return `${schedule.atTime} ${chalk53.dim("(one-time)")}`;
|
|
15492
15585
|
}
|
|
15493
|
-
return
|
|
15586
|
+
return chalk53.dim("-");
|
|
15494
15587
|
}
|
|
15495
15588
|
function formatRunStatus2(status) {
|
|
15496
15589
|
switch (status) {
|
|
15497
15590
|
case "completed":
|
|
15498
|
-
return
|
|
15591
|
+
return chalk53.green(status);
|
|
15499
15592
|
case "failed":
|
|
15500
15593
|
case "timeout":
|
|
15501
|
-
return
|
|
15594
|
+
return chalk53.red(status);
|
|
15502
15595
|
case "running":
|
|
15503
|
-
return
|
|
15596
|
+
return chalk53.cyan(status);
|
|
15504
15597
|
case "pending":
|
|
15505
|
-
return
|
|
15598
|
+
return chalk53.yellow(status);
|
|
15506
15599
|
default:
|
|
15507
15600
|
return status;
|
|
15508
15601
|
}
|
|
15509
15602
|
}
|
|
15510
15603
|
function printRunConfiguration(schedule) {
|
|
15511
|
-
const statusText = schedule.enabled ?
|
|
15604
|
+
const statusText = schedule.enabled ? chalk53.green("enabled") : chalk53.yellow("disabled");
|
|
15512
15605
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
15513
15606
|
console.log(
|
|
15514
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
15607
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk53.dim(`(${schedule.orgSlug})`)}`
|
|
15515
15608
|
);
|
|
15516
15609
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
15517
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
15610
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk53.dim(promptPreview)}`);
|
|
15518
15611
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
15519
15612
|
console.log(
|
|
15520
15613
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -15543,7 +15636,7 @@ function printTimeSchedule(schedule) {
|
|
|
15543
15636
|
);
|
|
15544
15637
|
}
|
|
15545
15638
|
if (schedule.triggerType === "loop") {
|
|
15546
|
-
const failureText = schedule.consecutiveFailures > 0 ?
|
|
15639
|
+
const failureText = schedule.consecutiveFailures > 0 ? chalk53.yellow(`${schedule.consecutiveFailures}/3`) : chalk53.dim("0/3");
|
|
15547
15640
|
console.log(`${"Failures:".padEnd(16)}${failureText}`);
|
|
15548
15641
|
}
|
|
15549
15642
|
}
|
|
@@ -15559,7 +15652,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15559
15652
|
console.log();
|
|
15560
15653
|
console.log("Recent Runs:");
|
|
15561
15654
|
console.log(
|
|
15562
|
-
|
|
15655
|
+
chalk53.dim("RUN ID STATUS CREATED")
|
|
15563
15656
|
);
|
|
15564
15657
|
for (const run of runs) {
|
|
15565
15658
|
const id = run.id;
|
|
@@ -15570,10 +15663,10 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15570
15663
|
}
|
|
15571
15664
|
} catch {
|
|
15572
15665
|
console.log();
|
|
15573
|
-
console.log(
|
|
15666
|
+
console.log(chalk53.dim("Recent Runs: (unable to fetch)"));
|
|
15574
15667
|
}
|
|
15575
15668
|
}
|
|
15576
|
-
var statusCommand7 = new
|
|
15669
|
+
var statusCommand7 = new Command58().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
15577
15670
|
"-n, --name <schedule-name>",
|
|
15578
15671
|
"Schedule name (required when agent has multiple schedules)"
|
|
15579
15672
|
).option(
|
|
@@ -15587,8 +15680,8 @@ var statusCommand7 = new Command57().name("status").description("Show detailed s
|
|
|
15587
15680
|
const { name, composeId } = resolved;
|
|
15588
15681
|
const schedule = await getScheduleByName({ name, composeId });
|
|
15589
15682
|
console.log();
|
|
15590
|
-
console.log(`Schedule for agent: ${
|
|
15591
|
-
console.log(
|
|
15683
|
+
console.log(`Schedule for agent: ${chalk53.cyan(agentName)}`);
|
|
15684
|
+
console.log(chalk53.dim("\u2501".repeat(50)));
|
|
15592
15685
|
printRunConfiguration(schedule);
|
|
15593
15686
|
printTimeSchedule(schedule);
|
|
15594
15687
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -15603,9 +15696,9 @@ var statusCommand7 = new Command57().name("status").description("Show detailed s
|
|
|
15603
15696
|
);
|
|
15604
15697
|
|
|
15605
15698
|
// src/commands/schedule/delete.ts
|
|
15606
|
-
import { Command as
|
|
15607
|
-
import
|
|
15608
|
-
var deleteCommand2 = new
|
|
15699
|
+
import { Command as Command59 } from "commander";
|
|
15700
|
+
import chalk54 from "chalk";
|
|
15701
|
+
var deleteCommand2 = new Command59().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option(
|
|
15609
15702
|
"-n, --name <schedule-name>",
|
|
15610
15703
|
"Schedule name (required when agent has multiple schedules)"
|
|
15611
15704
|
).option("-y, --yes", "Skip confirmation prompt").action(
|
|
@@ -15617,11 +15710,11 @@ var deleteCommand2 = new Command58().name("delete").alias("rm").description("Del
|
|
|
15617
15710
|
throw new Error("--yes flag is required in non-interactive mode");
|
|
15618
15711
|
}
|
|
15619
15712
|
const confirmed = await promptConfirm(
|
|
15620
|
-
`Delete schedule for agent ${
|
|
15713
|
+
`Delete schedule for agent ${chalk54.cyan(agentName)}?`,
|
|
15621
15714
|
false
|
|
15622
15715
|
);
|
|
15623
15716
|
if (!confirmed) {
|
|
15624
|
-
console.log(
|
|
15717
|
+
console.log(chalk54.dim("Cancelled"));
|
|
15625
15718
|
return;
|
|
15626
15719
|
}
|
|
15627
15720
|
}
|
|
@@ -15630,16 +15723,16 @@ var deleteCommand2 = new Command58().name("delete").alias("rm").description("Del
|
|
|
15630
15723
|
composeId: resolved.composeId
|
|
15631
15724
|
});
|
|
15632
15725
|
console.log(
|
|
15633
|
-
|
|
15726
|
+
chalk54.green(`\u2713 Deleted schedule for agent ${chalk54.cyan(agentName)}`)
|
|
15634
15727
|
);
|
|
15635
15728
|
}
|
|
15636
15729
|
)
|
|
15637
15730
|
);
|
|
15638
15731
|
|
|
15639
15732
|
// src/commands/schedule/enable.ts
|
|
15640
|
-
import { Command as
|
|
15641
|
-
import
|
|
15642
|
-
var enableCommand = new
|
|
15733
|
+
import { Command as Command60 } from "commander";
|
|
15734
|
+
import chalk55 from "chalk";
|
|
15735
|
+
var enableCommand = new Command60().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15643
15736
|
"-n, --name <schedule-name>",
|
|
15644
15737
|
"Schedule name (required when agent has multiple schedules)"
|
|
15645
15738
|
).action(
|
|
@@ -15650,15 +15743,15 @@ var enableCommand = new Command59().name("enable").description("Enable a schedul
|
|
|
15650
15743
|
composeId: resolved.composeId
|
|
15651
15744
|
});
|
|
15652
15745
|
console.log(
|
|
15653
|
-
|
|
15746
|
+
chalk55.green(`\u2713 Enabled schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15654
15747
|
);
|
|
15655
15748
|
})
|
|
15656
15749
|
);
|
|
15657
15750
|
|
|
15658
15751
|
// src/commands/schedule/disable.ts
|
|
15659
|
-
import { Command as
|
|
15660
|
-
import
|
|
15661
|
-
var disableCommand = new
|
|
15752
|
+
import { Command as Command61 } from "commander";
|
|
15753
|
+
import chalk56 from "chalk";
|
|
15754
|
+
var disableCommand = new Command61().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15662
15755
|
"-n, --name <schedule-name>",
|
|
15663
15756
|
"Schedule name (required when agent has multiple schedules)"
|
|
15664
15757
|
).action(
|
|
@@ -15669,17 +15762,17 @@ var disableCommand = new Command60().name("disable").description("Disable a sche
|
|
|
15669
15762
|
composeId: resolved.composeId
|
|
15670
15763
|
});
|
|
15671
15764
|
console.log(
|
|
15672
|
-
|
|
15765
|
+
chalk56.green(`\u2713 Disabled schedule for agent ${chalk56.cyan(agentName)}`)
|
|
15673
15766
|
);
|
|
15674
15767
|
})
|
|
15675
15768
|
);
|
|
15676
15769
|
|
|
15677
15770
|
// src/commands/schedule/index.ts
|
|
15678
|
-
var scheduleCommand = new
|
|
15771
|
+
var scheduleCommand = new Command62().name("schedule").description("Manage agent schedules").addCommand(setupCommand).addCommand(listCommand7).addCommand(statusCommand7).addCommand(deleteCommand2).addCommand(enableCommand).addCommand(disableCommand);
|
|
15679
15772
|
|
|
15680
15773
|
// src/commands/usage/index.ts
|
|
15681
|
-
import { Command as
|
|
15682
|
-
import
|
|
15774
|
+
import { Command as Command63 } from "commander";
|
|
15775
|
+
import chalk57 from "chalk";
|
|
15683
15776
|
|
|
15684
15777
|
// src/lib/utils/duration-formatter.ts
|
|
15685
15778
|
function formatDuration(ms) {
|
|
@@ -15752,7 +15845,7 @@ function fillMissingDates(daily, startDate, endDate) {
|
|
|
15752
15845
|
result.sort((a, b) => b.date.localeCompare(a.date));
|
|
15753
15846
|
return result;
|
|
15754
15847
|
}
|
|
15755
|
-
var usageCommand = new
|
|
15848
|
+
var usageCommand = new Command63().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
|
|
15756
15849
|
"--until <date>",
|
|
15757
15850
|
"End date (ISO format or relative, defaults to now)"
|
|
15758
15851
|
).action(
|
|
@@ -15804,19 +15897,19 @@ var usageCommand = new Command62().name("usage").description("View usage statist
|
|
|
15804
15897
|
);
|
|
15805
15898
|
console.log();
|
|
15806
15899
|
console.log(
|
|
15807
|
-
|
|
15900
|
+
chalk57.bold(
|
|
15808
15901
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
15809
15902
|
)
|
|
15810
15903
|
);
|
|
15811
15904
|
console.log();
|
|
15812
|
-
console.log(
|
|
15905
|
+
console.log(chalk57.dim("DATE RUNS RUN TIME"));
|
|
15813
15906
|
for (const day of filledDaily) {
|
|
15814
15907
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
15815
15908
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
15816
15909
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
15817
15910
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
15818
15911
|
}
|
|
15819
|
-
console.log(
|
|
15912
|
+
console.log(chalk57.dim("\u2500".repeat(29)));
|
|
15820
15913
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
15821
15914
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
15822
15915
|
console.log(
|
|
@@ -15827,67 +15920,67 @@ var usageCommand = new Command62().name("usage").description("View usage statist
|
|
|
15827
15920
|
);
|
|
15828
15921
|
|
|
15829
15922
|
// src/commands/secret/index.ts
|
|
15830
|
-
import { Command as
|
|
15923
|
+
import { Command as Command67 } from "commander";
|
|
15831
15924
|
|
|
15832
15925
|
// src/commands/secret/list.ts
|
|
15833
|
-
import { Command as
|
|
15834
|
-
import
|
|
15835
|
-
var listCommand8 = new
|
|
15926
|
+
import { Command as Command64 } from "commander";
|
|
15927
|
+
import chalk58 from "chalk";
|
|
15928
|
+
var listCommand8 = new Command64().name("list").alias("ls").description("List all secrets").action(
|
|
15836
15929
|
withErrorHandler(async () => {
|
|
15837
15930
|
const result = await listSecrets();
|
|
15838
15931
|
if (result.secrets.length === 0) {
|
|
15839
|
-
console.log(
|
|
15932
|
+
console.log(chalk58.dim("No secrets found"));
|
|
15840
15933
|
console.log();
|
|
15841
15934
|
console.log("To add a secret:");
|
|
15842
|
-
console.log(
|
|
15935
|
+
console.log(chalk58.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
15843
15936
|
return;
|
|
15844
15937
|
}
|
|
15845
|
-
console.log(
|
|
15938
|
+
console.log(chalk58.bold("Secrets:"));
|
|
15846
15939
|
console.log();
|
|
15847
15940
|
for (const secret of result.secrets) {
|
|
15848
15941
|
let typeIndicator = "";
|
|
15849
15942
|
let derivedLine = null;
|
|
15850
15943
|
if (secret.type === "model-provider") {
|
|
15851
|
-
typeIndicator =
|
|
15944
|
+
typeIndicator = chalk58.dim(" [model-provider]");
|
|
15852
15945
|
} else if (secret.type === "connector") {
|
|
15853
15946
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15854
15947
|
if (derived) {
|
|
15855
|
-
typeIndicator =
|
|
15856
|
-
derivedLine =
|
|
15948
|
+
typeIndicator = chalk58.dim(` [${derived.connectorLabel} connector]`);
|
|
15949
|
+
derivedLine = chalk58.dim(
|
|
15857
15950
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15858
15951
|
);
|
|
15859
15952
|
} else {
|
|
15860
|
-
typeIndicator =
|
|
15953
|
+
typeIndicator = chalk58.dim(" [connector]");
|
|
15861
15954
|
}
|
|
15862
15955
|
} else if (secret.type === "user") {
|
|
15863
15956
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15864
15957
|
if (derived) {
|
|
15865
|
-
typeIndicator =
|
|
15866
|
-
derivedLine =
|
|
15958
|
+
typeIndicator = chalk58.dim(` [${derived.connectorLabel} connector]`);
|
|
15959
|
+
derivedLine = chalk58.dim(
|
|
15867
15960
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15868
15961
|
);
|
|
15869
15962
|
}
|
|
15870
15963
|
}
|
|
15871
|
-
console.log(` ${
|
|
15964
|
+
console.log(` ${chalk58.cyan(secret.name)}${typeIndicator}`);
|
|
15872
15965
|
if (derivedLine) {
|
|
15873
15966
|
console.log(` ${derivedLine}`);
|
|
15874
15967
|
}
|
|
15875
15968
|
if (secret.description) {
|
|
15876
|
-
console.log(` ${
|
|
15969
|
+
console.log(` ${chalk58.dim(secret.description)}`);
|
|
15877
15970
|
}
|
|
15878
15971
|
console.log(
|
|
15879
|
-
` ${
|
|
15972
|
+
` ${chalk58.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
15880
15973
|
);
|
|
15881
15974
|
console.log();
|
|
15882
15975
|
}
|
|
15883
|
-
console.log(
|
|
15976
|
+
console.log(chalk58.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
15884
15977
|
})
|
|
15885
15978
|
);
|
|
15886
15979
|
|
|
15887
15980
|
// src/commands/secret/set.ts
|
|
15888
|
-
import { Command as
|
|
15889
|
-
import
|
|
15890
|
-
var setCommand2 = new
|
|
15981
|
+
import { Command as Command65 } from "commander";
|
|
15982
|
+
import chalk59 from "chalk";
|
|
15983
|
+
var setCommand2 = new Command65().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
15891
15984
|
"-b, --body <value>",
|
|
15892
15985
|
"Secret value (required in non-interactive mode)"
|
|
15893
15986
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -15926,19 +16019,19 @@ var setCommand2 = new Command64().name("set").description("Create or update a se
|
|
|
15926
16019
|
}
|
|
15927
16020
|
throw error;
|
|
15928
16021
|
}
|
|
15929
|
-
console.log(
|
|
16022
|
+
console.log(chalk59.green(`\u2713 Secret "${secret.name}" saved`));
|
|
15930
16023
|
console.log();
|
|
15931
16024
|
console.log("Use in vm0.yaml:");
|
|
15932
|
-
console.log(
|
|
15933
|
-
console.log(
|
|
16025
|
+
console.log(chalk59.cyan(` environment:`));
|
|
16026
|
+
console.log(chalk59.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
15934
16027
|
}
|
|
15935
16028
|
)
|
|
15936
16029
|
);
|
|
15937
16030
|
|
|
15938
16031
|
// src/commands/secret/delete.ts
|
|
15939
|
-
import { Command as
|
|
15940
|
-
import
|
|
15941
|
-
var deleteCommand3 = new
|
|
16032
|
+
import { Command as Command66 } from "commander";
|
|
16033
|
+
import chalk60 from "chalk";
|
|
16034
|
+
var deleteCommand3 = new Command66().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
15942
16035
|
withErrorHandler(async (name, options) => {
|
|
15943
16036
|
try {
|
|
15944
16037
|
await getSecret(name);
|
|
@@ -15957,61 +16050,61 @@ var deleteCommand3 = new Command65().name("delete").description("Delete a secret
|
|
|
15957
16050
|
false
|
|
15958
16051
|
);
|
|
15959
16052
|
if (!confirmed) {
|
|
15960
|
-
console.log(
|
|
16053
|
+
console.log(chalk60.dim("Cancelled"));
|
|
15961
16054
|
return;
|
|
15962
16055
|
}
|
|
15963
16056
|
}
|
|
15964
16057
|
await deleteSecret(name);
|
|
15965
|
-
console.log(
|
|
16058
|
+
console.log(chalk60.green(`\u2713 Secret "${name}" deleted`));
|
|
15966
16059
|
})
|
|
15967
16060
|
);
|
|
15968
16061
|
|
|
15969
16062
|
// src/commands/secret/index.ts
|
|
15970
|
-
var secretCommand = new
|
|
16063
|
+
var secretCommand = new Command67().name("secret").description("Manage stored secrets for agent runs").addCommand(listCommand8).addCommand(setCommand2).addCommand(deleteCommand3);
|
|
15971
16064
|
|
|
15972
16065
|
// src/commands/variable/index.ts
|
|
15973
|
-
import { Command as
|
|
16066
|
+
import { Command as Command71 } from "commander";
|
|
15974
16067
|
|
|
15975
16068
|
// src/commands/variable/list.ts
|
|
15976
|
-
import { Command as
|
|
15977
|
-
import
|
|
16069
|
+
import { Command as Command68 } from "commander";
|
|
16070
|
+
import chalk61 from "chalk";
|
|
15978
16071
|
function truncateValue(value, maxLength = 60) {
|
|
15979
16072
|
if (value.length <= maxLength) {
|
|
15980
16073
|
return value;
|
|
15981
16074
|
}
|
|
15982
16075
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
15983
16076
|
}
|
|
15984
|
-
var listCommand9 = new
|
|
16077
|
+
var listCommand9 = new Command68().name("list").alias("ls").description("List all variables").action(
|
|
15985
16078
|
withErrorHandler(async () => {
|
|
15986
16079
|
const result = await listVariables();
|
|
15987
16080
|
if (result.variables.length === 0) {
|
|
15988
|
-
console.log(
|
|
16081
|
+
console.log(chalk61.dim("No variables found"));
|
|
15989
16082
|
console.log();
|
|
15990
16083
|
console.log("To add a variable:");
|
|
15991
|
-
console.log(
|
|
16084
|
+
console.log(chalk61.cyan(" vm0 variable set MY_VAR <value>"));
|
|
15992
16085
|
return;
|
|
15993
16086
|
}
|
|
15994
|
-
console.log(
|
|
16087
|
+
console.log(chalk61.bold("Variables:"));
|
|
15995
16088
|
console.log();
|
|
15996
16089
|
for (const variable of result.variables) {
|
|
15997
16090
|
const displayValue = truncateValue(variable.value);
|
|
15998
|
-
console.log(` ${
|
|
16091
|
+
console.log(` ${chalk61.cyan(variable.name)} = ${displayValue}`);
|
|
15999
16092
|
if (variable.description) {
|
|
16000
|
-
console.log(` ${
|
|
16093
|
+
console.log(` ${chalk61.dim(variable.description)}`);
|
|
16001
16094
|
}
|
|
16002
16095
|
console.log(
|
|
16003
|
-
` ${
|
|
16096
|
+
` ${chalk61.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
16004
16097
|
);
|
|
16005
16098
|
console.log();
|
|
16006
16099
|
}
|
|
16007
|
-
console.log(
|
|
16100
|
+
console.log(chalk61.dim(`Total: ${result.variables.length} variable(s)`));
|
|
16008
16101
|
})
|
|
16009
16102
|
);
|
|
16010
16103
|
|
|
16011
16104
|
// src/commands/variable/set.ts
|
|
16012
|
-
import { Command as
|
|
16013
|
-
import
|
|
16014
|
-
var setCommand3 = new
|
|
16105
|
+
import { Command as Command69 } from "commander";
|
|
16106
|
+
import chalk62 from "chalk";
|
|
16107
|
+
var setCommand3 = new Command69().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(
|
|
16015
16108
|
withErrorHandler(
|
|
16016
16109
|
async (name, value, options) => {
|
|
16017
16110
|
let variable;
|
|
@@ -16031,19 +16124,19 @@ var setCommand3 = new Command68().name("set").description("Create or update a va
|
|
|
16031
16124
|
}
|
|
16032
16125
|
throw error;
|
|
16033
16126
|
}
|
|
16034
|
-
console.log(
|
|
16127
|
+
console.log(chalk62.green(`\u2713 Variable "${variable.name}" saved`));
|
|
16035
16128
|
console.log();
|
|
16036
16129
|
console.log("Use in vm0.yaml:");
|
|
16037
|
-
console.log(
|
|
16038
|
-
console.log(
|
|
16130
|
+
console.log(chalk62.cyan(` environment:`));
|
|
16131
|
+
console.log(chalk62.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
16039
16132
|
}
|
|
16040
16133
|
)
|
|
16041
16134
|
);
|
|
16042
16135
|
|
|
16043
16136
|
// src/commands/variable/delete.ts
|
|
16044
|
-
import { Command as
|
|
16045
|
-
import
|
|
16046
|
-
var deleteCommand4 = new
|
|
16137
|
+
import { Command as Command70 } from "commander";
|
|
16138
|
+
import chalk63 from "chalk";
|
|
16139
|
+
var deleteCommand4 = new Command70().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
16047
16140
|
withErrorHandler(async (name, options) => {
|
|
16048
16141
|
try {
|
|
16049
16142
|
await getVariable(name);
|
|
@@ -16062,32 +16155,32 @@ var deleteCommand4 = new Command69().name("delete").description("Delete a variab
|
|
|
16062
16155
|
false
|
|
16063
16156
|
);
|
|
16064
16157
|
if (!confirmed) {
|
|
16065
|
-
console.log(
|
|
16158
|
+
console.log(chalk63.dim("Cancelled"));
|
|
16066
16159
|
return;
|
|
16067
16160
|
}
|
|
16068
16161
|
}
|
|
16069
16162
|
await deleteVariable(name);
|
|
16070
|
-
console.log(
|
|
16163
|
+
console.log(chalk63.green(`\u2713 Variable "${name}" deleted`));
|
|
16071
16164
|
})
|
|
16072
16165
|
);
|
|
16073
16166
|
|
|
16074
16167
|
// src/commands/variable/index.ts
|
|
16075
|
-
var variableCommand = new
|
|
16168
|
+
var variableCommand = new Command71().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand9).addCommand(setCommand3).addCommand(deleteCommand4);
|
|
16076
16169
|
|
|
16077
16170
|
// src/commands/model-provider/index.ts
|
|
16078
|
-
import { Command as
|
|
16171
|
+
import { Command as Command76 } from "commander";
|
|
16079
16172
|
|
|
16080
16173
|
// src/commands/model-provider/list.ts
|
|
16081
|
-
import { Command as
|
|
16082
|
-
import
|
|
16083
|
-
var listCommand10 = new
|
|
16174
|
+
import { Command as Command72 } from "commander";
|
|
16175
|
+
import chalk64 from "chalk";
|
|
16176
|
+
var listCommand10 = new Command72().name("list").alias("ls").description("List all model providers").action(
|
|
16084
16177
|
withErrorHandler(async () => {
|
|
16085
16178
|
const result = await listModelProviders();
|
|
16086
16179
|
if (result.modelProviders.length === 0) {
|
|
16087
|
-
console.log(
|
|
16180
|
+
console.log(chalk64.dim("No model providers configured"));
|
|
16088
16181
|
console.log();
|
|
16089
16182
|
console.log("To add a model provider:");
|
|
16090
|
-
console.log(
|
|
16183
|
+
console.log(chalk64.cyan(" vm0 model-provider setup"));
|
|
16091
16184
|
return;
|
|
16092
16185
|
}
|
|
16093
16186
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -16101,16 +16194,16 @@ var listCommand10 = new Command71().name("list").alias("ls").description("List a
|
|
|
16101
16194
|
},
|
|
16102
16195
|
{}
|
|
16103
16196
|
);
|
|
16104
|
-
console.log(
|
|
16197
|
+
console.log(chalk64.bold("Model Providers:"));
|
|
16105
16198
|
console.log();
|
|
16106
16199
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
16107
|
-
console.log(` ${
|
|
16200
|
+
console.log(` ${chalk64.cyan(framework)}:`);
|
|
16108
16201
|
for (const provider of providers) {
|
|
16109
|
-
const defaultTag = provider.isDefault ?
|
|
16110
|
-
const modelTag = provider.selectedModel ?
|
|
16202
|
+
const defaultTag = provider.isDefault ? chalk64.green(" (default)") : "";
|
|
16203
|
+
const modelTag = provider.selectedModel ? chalk64.dim(` [${provider.selectedModel}]`) : "";
|
|
16111
16204
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
16112
16205
|
console.log(
|
|
16113
|
-
|
|
16206
|
+
chalk64.dim(
|
|
16114
16207
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
16115
16208
|
)
|
|
16116
16209
|
);
|
|
@@ -16118,14 +16211,14 @@ var listCommand10 = new Command71().name("list").alias("ls").description("List a
|
|
|
16118
16211
|
console.log();
|
|
16119
16212
|
}
|
|
16120
16213
|
console.log(
|
|
16121
|
-
|
|
16214
|
+
chalk64.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
16122
16215
|
);
|
|
16123
16216
|
})
|
|
16124
16217
|
);
|
|
16125
16218
|
|
|
16126
16219
|
// src/commands/model-provider/setup.ts
|
|
16127
|
-
import { Command as
|
|
16128
|
-
import
|
|
16220
|
+
import { Command as Command73 } from "commander";
|
|
16221
|
+
import chalk65 from "chalk";
|
|
16129
16222
|
import prompts2 from "prompts";
|
|
16130
16223
|
function validateProviderType(typeStr) {
|
|
16131
16224
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
@@ -16309,7 +16402,7 @@ async function promptForModelSelection(type2) {
|
|
|
16309
16402
|
if (selected === "__custom__") {
|
|
16310
16403
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
16311
16404
|
if (placeholder) {
|
|
16312
|
-
console.log(
|
|
16405
|
+
console.log(chalk65.dim(`Example: ${placeholder}`));
|
|
16313
16406
|
}
|
|
16314
16407
|
const customResponse = await prompts2(
|
|
16315
16408
|
{
|
|
@@ -16359,7 +16452,7 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
16359
16452
|
const secrets = {};
|
|
16360
16453
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
16361
16454
|
if (fieldConfig.helpText) {
|
|
16362
|
-
console.log(
|
|
16455
|
+
console.log(chalk65.dim(fieldConfig.helpText));
|
|
16363
16456
|
}
|
|
16364
16457
|
const isSensitive = isSensitiveSecret(name);
|
|
16365
16458
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -16411,7 +16504,7 @@ async function handleInteractiveMode() {
|
|
|
16411
16504
|
title = `${title} \u2713`;
|
|
16412
16505
|
}
|
|
16413
16506
|
if (isExperimental) {
|
|
16414
|
-
title = `${title} ${
|
|
16507
|
+
title = `${title} ${chalk65.dim("(experimental)")}`;
|
|
16415
16508
|
}
|
|
16416
16509
|
return {
|
|
16417
16510
|
title,
|
|
@@ -16458,7 +16551,7 @@ async function handleInteractiveMode() {
|
|
|
16458
16551
|
}
|
|
16459
16552
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
16460
16553
|
console.log();
|
|
16461
|
-
console.log(
|
|
16554
|
+
console.log(chalk65.dim(config.helpText));
|
|
16462
16555
|
console.log();
|
|
16463
16556
|
if (hasAuthMethods(type2)) {
|
|
16464
16557
|
const authMethod = await promptForAuthMethod(type2);
|
|
@@ -16499,13 +16592,13 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
16499
16592
|
);
|
|
16500
16593
|
if (response.setDefault) {
|
|
16501
16594
|
await setModelProviderDefault(type2);
|
|
16502
|
-
console.log(
|
|
16595
|
+
console.log(chalk65.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
16503
16596
|
}
|
|
16504
16597
|
}
|
|
16505
16598
|
function collectSecrets(value, previous) {
|
|
16506
16599
|
return previous.concat([value]);
|
|
16507
16600
|
}
|
|
16508
|
-
var setupCommand2 = new
|
|
16601
|
+
var setupCommand2 = new Command73().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
16509
16602
|
"-s, --secret <value>",
|
|
16510
16603
|
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
16511
16604
|
collectSecrets,
|
|
@@ -16543,11 +16636,11 @@ var setupCommand2 = new Command72().name("setup").description("Configure a model
|
|
|
16543
16636
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
16544
16637
|
if (!hasModelSelection(input.type)) {
|
|
16545
16638
|
console.log(
|
|
16546
|
-
|
|
16639
|
+
chalk65.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
16547
16640
|
);
|
|
16548
16641
|
} else {
|
|
16549
16642
|
console.log(
|
|
16550
|
-
|
|
16643
|
+
chalk65.green(
|
|
16551
16644
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
16552
16645
|
)
|
|
16553
16646
|
);
|
|
@@ -16572,7 +16665,7 @@ var setupCommand2 = new Command72().name("setup").description("Configure a model
|
|
|
16572
16665
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
16573
16666
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
16574
16667
|
console.log(
|
|
16575
|
-
|
|
16668
|
+
chalk65.green(
|
|
16576
16669
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
16577
16670
|
)
|
|
16578
16671
|
);
|
|
@@ -16588,9 +16681,9 @@ var setupCommand2 = new Command72().name("setup").description("Configure a model
|
|
|
16588
16681
|
);
|
|
16589
16682
|
|
|
16590
16683
|
// src/commands/model-provider/delete.ts
|
|
16591
|
-
import { Command as
|
|
16592
|
-
import
|
|
16593
|
-
var deleteCommand5 = new
|
|
16684
|
+
import { Command as Command74 } from "commander";
|
|
16685
|
+
import chalk66 from "chalk";
|
|
16686
|
+
var deleteCommand5 = new Command74().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(
|
|
16594
16687
|
withErrorHandler(async (type2) => {
|
|
16595
16688
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
16596
16689
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -16599,14 +16692,14 @@ var deleteCommand5 = new Command73().name("delete").description("Delete a model
|
|
|
16599
16692
|
});
|
|
16600
16693
|
}
|
|
16601
16694
|
await deleteModelProvider(type2);
|
|
16602
|
-
console.log(
|
|
16695
|
+
console.log(chalk66.green(`\u2713 Model provider "${type2}" deleted`));
|
|
16603
16696
|
})
|
|
16604
16697
|
);
|
|
16605
16698
|
|
|
16606
16699
|
// src/commands/model-provider/set-default.ts
|
|
16607
|
-
import { Command as
|
|
16608
|
-
import
|
|
16609
|
-
var setDefaultCommand = new
|
|
16700
|
+
import { Command as Command75 } from "commander";
|
|
16701
|
+
import chalk67 from "chalk";
|
|
16702
|
+
var setDefaultCommand = new Command75().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
16610
16703
|
withErrorHandler(async (type2) => {
|
|
16611
16704
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
16612
16705
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -16616,7 +16709,7 @@ var setDefaultCommand = new Command74().name("set-default").description("Set a m
|
|
|
16616
16709
|
}
|
|
16617
16710
|
const provider = await setModelProviderDefault(type2);
|
|
16618
16711
|
console.log(
|
|
16619
|
-
|
|
16712
|
+
chalk67.green(
|
|
16620
16713
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
16621
16714
|
)
|
|
16622
16715
|
);
|
|
@@ -16624,14 +16717,14 @@ var setDefaultCommand = new Command74().name("set-default").description("Set a m
|
|
|
16624
16717
|
);
|
|
16625
16718
|
|
|
16626
16719
|
// src/commands/model-provider/index.ts
|
|
16627
|
-
var modelProviderCommand = new
|
|
16720
|
+
var modelProviderCommand = new Command76().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand10).addCommand(setupCommand2).addCommand(deleteCommand5).addCommand(setDefaultCommand);
|
|
16628
16721
|
|
|
16629
16722
|
// src/commands/connector/index.ts
|
|
16630
|
-
import { Command as
|
|
16723
|
+
import { Command as Command81 } from "commander";
|
|
16631
16724
|
|
|
16632
16725
|
// src/commands/connector/connect.ts
|
|
16633
|
-
import { Command as
|
|
16634
|
-
import
|
|
16726
|
+
import { Command as Command77 } from "commander";
|
|
16727
|
+
import chalk69 from "chalk";
|
|
16635
16728
|
import { initClient as initClient13 } from "@ts-rest/core";
|
|
16636
16729
|
|
|
16637
16730
|
// src/commands/connector/lib/computer/start-services.ts
|
|
@@ -16640,7 +16733,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
16640
16733
|
import { createServer } from "net";
|
|
16641
16734
|
import { homedir as homedir4 } from "os";
|
|
16642
16735
|
import { join as join12 } from "path";
|
|
16643
|
-
import
|
|
16736
|
+
import chalk68 from "chalk";
|
|
16644
16737
|
|
|
16645
16738
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
16646
16739
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -16714,7 +16807,7 @@ async function checkComputerDependencies() {
|
|
|
16714
16807
|
}
|
|
16715
16808
|
}
|
|
16716
16809
|
async function startComputerServices(credentials) {
|
|
16717
|
-
console.log(
|
|
16810
|
+
console.log(chalk68.cyan("Starting computer connector services..."));
|
|
16718
16811
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
16719
16812
|
if (!wsgidavBinary) {
|
|
16720
16813
|
throw new Error(
|
|
@@ -16741,7 +16834,7 @@ async function startComputerServices(credentials) {
|
|
|
16741
16834
|
);
|
|
16742
16835
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16743
16836
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16744
|
-
console.log(
|
|
16837
|
+
console.log(chalk68.green("\u2713 WebDAV server started"));
|
|
16745
16838
|
const chrome = spawn2(
|
|
16746
16839
|
chromeBinary,
|
|
16747
16840
|
[
|
|
@@ -16755,7 +16848,7 @@ async function startComputerServices(credentials) {
|
|
|
16755
16848
|
);
|
|
16756
16849
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16757
16850
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16758
|
-
console.log(
|
|
16851
|
+
console.log(chalk68.green("\u2713 Chrome started"));
|
|
16759
16852
|
try {
|
|
16760
16853
|
await startNgrokTunnels(
|
|
16761
16854
|
credentials.ngrokToken,
|
|
@@ -16764,18 +16857,18 @@ async function startComputerServices(credentials) {
|
|
|
16764
16857
|
cdpPort
|
|
16765
16858
|
);
|
|
16766
16859
|
console.log(
|
|
16767
|
-
|
|
16860
|
+
chalk68.green(
|
|
16768
16861
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
16769
16862
|
)
|
|
16770
16863
|
);
|
|
16771
16864
|
console.log();
|
|
16772
|
-
console.log(
|
|
16865
|
+
console.log(chalk68.green("\u2713 Computer connector active"));
|
|
16773
16866
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
16774
16867
|
console.log(
|
|
16775
16868
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
16776
16869
|
);
|
|
16777
16870
|
console.log();
|
|
16778
|
-
console.log(
|
|
16871
|
+
console.log(chalk68.dim("Press ^C twice to disconnect"));
|
|
16779
16872
|
console.log();
|
|
16780
16873
|
let sigintCount = 0;
|
|
16781
16874
|
await new Promise((resolve2) => {
|
|
@@ -16789,7 +16882,7 @@ async function startComputerServices(credentials) {
|
|
|
16789
16882
|
const onSigint = () => {
|
|
16790
16883
|
sigintCount++;
|
|
16791
16884
|
if (sigintCount === 1) {
|
|
16792
|
-
console.log(
|
|
16885
|
+
console.log(chalk68.dim("\nPress ^C again to disconnect and exit..."));
|
|
16793
16886
|
} else {
|
|
16794
16887
|
done();
|
|
16795
16888
|
}
|
|
@@ -16799,11 +16892,11 @@ async function startComputerServices(credentials) {
|
|
|
16799
16892
|
});
|
|
16800
16893
|
} finally {
|
|
16801
16894
|
console.log();
|
|
16802
|
-
console.log(
|
|
16895
|
+
console.log(chalk68.cyan("Stopping services..."));
|
|
16803
16896
|
wsgidav.kill("SIGTERM");
|
|
16804
16897
|
chrome.kill("SIGTERM");
|
|
16805
16898
|
await stopNgrokTunnels();
|
|
16806
|
-
console.log(
|
|
16899
|
+
console.log(chalk68.green("\u2713 Services stopped"));
|
|
16807
16900
|
}
|
|
16808
16901
|
}
|
|
16809
16902
|
|
|
@@ -16828,10 +16921,10 @@ async function getHeaders2() {
|
|
|
16828
16921
|
function renderHelpText(text) {
|
|
16829
16922
|
return text.replace(
|
|
16830
16923
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
16831
|
-
(_m, label, url) => `${label} (${
|
|
16832
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
16924
|
+
(_m, label, url) => `${label} (${chalk69.cyan(url)})`
|
|
16925
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk69.bold(content)).replace(
|
|
16833
16926
|
/^> (.+)$/gm,
|
|
16834
|
-
(_m, content) =>
|
|
16927
|
+
(_m, content) => chalk69.yellow(` ${content}`)
|
|
16835
16928
|
);
|
|
16836
16929
|
}
|
|
16837
16930
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -16856,7 +16949,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16856
16949
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
16857
16950
|
if (!secretConfig.required) continue;
|
|
16858
16951
|
const value = await promptPassword(
|
|
16859
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
16952
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk69.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
16860
16953
|
);
|
|
16861
16954
|
if (!value) {
|
|
16862
16955
|
throw new Error("Cancelled");
|
|
@@ -16872,13 +16965,13 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16872
16965
|
});
|
|
16873
16966
|
}
|
|
16874
16967
|
console.log(
|
|
16875
|
-
|
|
16968
|
+
chalk69.green(`
|
|
16876
16969
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
16877
16970
|
);
|
|
16878
16971
|
}
|
|
16879
16972
|
async function connectComputer(apiUrl, headers) {
|
|
16880
16973
|
await checkComputerDependencies();
|
|
16881
|
-
console.log(
|
|
16974
|
+
console.log(chalk69.cyan("Setting up computer connector..."));
|
|
16882
16975
|
const computerClient = initClient13(computerConnectorContract, {
|
|
16883
16976
|
baseUrl: apiUrl,
|
|
16884
16977
|
baseHeaders: headers,
|
|
@@ -16893,9 +16986,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
16893
16986
|
}
|
|
16894
16987
|
const credentials = createResult.body;
|
|
16895
16988
|
await startComputerServices(credentials);
|
|
16896
|
-
console.log(
|
|
16989
|
+
console.log(chalk69.cyan("Disconnecting computer connector..."));
|
|
16897
16990
|
await deleteConnector("computer");
|
|
16898
|
-
console.log(
|
|
16991
|
+
console.log(chalk69.green("\u2713 Disconnected computer"));
|
|
16899
16992
|
process.exit(0);
|
|
16900
16993
|
}
|
|
16901
16994
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -16934,7 +17027,7 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
16934
17027
|
);
|
|
16935
17028
|
}
|
|
16936
17029
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
16937
|
-
console.log(`Connecting ${
|
|
17030
|
+
console.log(`Connecting ${chalk69.cyan(connectorType)}...`);
|
|
16938
17031
|
const sessionsClient = initClient13(connectorSessionsContract, {
|
|
16939
17032
|
baseUrl: apiUrl,
|
|
16940
17033
|
baseHeaders: headers,
|
|
@@ -16950,8 +17043,8 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
16950
17043
|
}
|
|
16951
17044
|
const session = createResult.body;
|
|
16952
17045
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
16953
|
-
console.log(
|
|
16954
|
-
console.log(
|
|
17046
|
+
console.log(chalk69.green("\nSession created"));
|
|
17047
|
+
console.log(chalk69.cyan(`
|
|
16955
17048
|
To connect, visit: ${verificationUrl}`));
|
|
16956
17049
|
console.log(
|
|
16957
17050
|
`
|
|
@@ -16983,7 +17076,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
16983
17076
|
switch (status.status) {
|
|
16984
17077
|
case "complete":
|
|
16985
17078
|
console.log(
|
|
16986
|
-
|
|
17079
|
+
chalk69.green(`
|
|
16987
17080
|
|
|
16988
17081
|
${connectorType} connected successfully!`)
|
|
16989
17082
|
);
|
|
@@ -16995,13 +17088,13 @@ ${connectorType} connected successfully!`)
|
|
|
16995
17088
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
16996
17089
|
);
|
|
16997
17090
|
case "pending":
|
|
16998
|
-
process.stdout.write(
|
|
17091
|
+
process.stdout.write(chalk69.dim("."));
|
|
16999
17092
|
break;
|
|
17000
17093
|
}
|
|
17001
17094
|
}
|
|
17002
17095
|
throw new Error("Session timed out, please try again");
|
|
17003
17096
|
}
|
|
17004
|
-
var connectCommand = new
|
|
17097
|
+
var connectCommand = new Command77().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").option("--token <value>", "API token value (skip interactive prompt)").action(
|
|
17005
17098
|
withErrorHandler(async (type2, options) => {
|
|
17006
17099
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17007
17100
|
if (!parseResult.success) {
|
|
@@ -17026,9 +17119,9 @@ var connectCommand = new Command76().name("connect").description("Connect a thir
|
|
|
17026
17119
|
);
|
|
17027
17120
|
|
|
17028
17121
|
// src/commands/connector/list.ts
|
|
17029
|
-
import { Command as
|
|
17030
|
-
import
|
|
17031
|
-
var listCommand11 = new
|
|
17122
|
+
import { Command as Command78 } from "commander";
|
|
17123
|
+
import chalk70 from "chalk";
|
|
17124
|
+
var listCommand11 = new Command78().name("list").alias("ls").description("List all connectors and their status").action(
|
|
17032
17125
|
withErrorHandler(async () => {
|
|
17033
17126
|
const result = await listConnectors();
|
|
17034
17127
|
const connectedMap = new Map(result.connectors.map((c24) => [c24.type, c24]));
|
|
@@ -17050,25 +17143,25 @@ var listCommand11 = new Command77().name("list").alias("ls").description("List a
|
|
|
17050
17143
|
statusText.padEnd(statusWidth),
|
|
17051
17144
|
"ACCOUNT"
|
|
17052
17145
|
].join(" ");
|
|
17053
|
-
console.log(
|
|
17146
|
+
console.log(chalk70.dim(header));
|
|
17054
17147
|
for (const type2 of allTypes) {
|
|
17055
17148
|
const connector = connectedMap.get(type2);
|
|
17056
|
-
const status = connector ?
|
|
17057
|
-
const account = connector?.externalUsername ? `@${connector.externalUsername}` :
|
|
17149
|
+
const status = connector ? chalk70.green("\u2713".padEnd(statusWidth)) : chalk70.dim("-".padEnd(statusWidth));
|
|
17150
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk70.dim("-");
|
|
17058
17151
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
17059
17152
|
console.log(row);
|
|
17060
17153
|
}
|
|
17061
17154
|
console.log();
|
|
17062
|
-
console.log(
|
|
17063
|
-
console.log(
|
|
17155
|
+
console.log(chalk70.dim("To connect a service:"));
|
|
17156
|
+
console.log(chalk70.dim(" vm0 connector connect <type>"));
|
|
17064
17157
|
})
|
|
17065
17158
|
);
|
|
17066
17159
|
|
|
17067
17160
|
// src/commands/connector/status.ts
|
|
17068
|
-
import { Command as
|
|
17069
|
-
import
|
|
17161
|
+
import { Command as Command79 } from "commander";
|
|
17162
|
+
import chalk71 from "chalk";
|
|
17070
17163
|
var LABEL_WIDTH = 16;
|
|
17071
|
-
var statusCommand8 = new
|
|
17164
|
+
var statusCommand8 = new Command79().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
17072
17165
|
withErrorHandler(async (type2) => {
|
|
17073
17166
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17074
17167
|
if (!parseResult.success) {
|
|
@@ -17078,11 +17171,11 @@ var statusCommand8 = new Command78().name("status").description("Show detailed s
|
|
|
17078
17171
|
});
|
|
17079
17172
|
}
|
|
17080
17173
|
const connector = await getConnector(parseResult.data);
|
|
17081
|
-
console.log(`Connector: ${
|
|
17174
|
+
console.log(`Connector: ${chalk71.cyan(type2)}`);
|
|
17082
17175
|
console.log();
|
|
17083
17176
|
if (connector) {
|
|
17084
17177
|
console.log(
|
|
17085
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17178
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk71.green("connected")}`
|
|
17086
17179
|
);
|
|
17087
17180
|
console.log(
|
|
17088
17181
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -17104,23 +17197,23 @@ var statusCommand8 = new Command78().name("status").description("Show detailed s
|
|
|
17104
17197
|
);
|
|
17105
17198
|
}
|
|
17106
17199
|
console.log();
|
|
17107
|
-
console.log(
|
|
17108
|
-
console.log(
|
|
17200
|
+
console.log(chalk71.dim("To disconnect:"));
|
|
17201
|
+
console.log(chalk71.dim(` vm0 connector disconnect ${type2}`));
|
|
17109
17202
|
} else {
|
|
17110
17203
|
console.log(
|
|
17111
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17204
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk71.dim("not connected")}`
|
|
17112
17205
|
);
|
|
17113
17206
|
console.log();
|
|
17114
|
-
console.log(
|
|
17115
|
-
console.log(
|
|
17207
|
+
console.log(chalk71.dim("To connect:"));
|
|
17208
|
+
console.log(chalk71.dim(` vm0 connector connect ${type2}`));
|
|
17116
17209
|
}
|
|
17117
17210
|
})
|
|
17118
17211
|
);
|
|
17119
17212
|
|
|
17120
17213
|
// src/commands/connector/disconnect.ts
|
|
17121
|
-
import { Command as
|
|
17122
|
-
import
|
|
17123
|
-
var disconnectCommand = new
|
|
17214
|
+
import { Command as Command80 } from "commander";
|
|
17215
|
+
import chalk72 from "chalk";
|
|
17216
|
+
var disconnectCommand = new Command80().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
17124
17217
|
withErrorHandler(async (type2) => {
|
|
17125
17218
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17126
17219
|
if (!parseResult.success) {
|
|
@@ -17131,33 +17224,33 @@ var disconnectCommand = new Command79().name("disconnect").description("Disconne
|
|
|
17131
17224
|
}
|
|
17132
17225
|
const connectorType = parseResult.data;
|
|
17133
17226
|
await deleteConnector(connectorType);
|
|
17134
|
-
console.log(
|
|
17227
|
+
console.log(chalk72.green(`\u2713 Disconnected ${type2}`));
|
|
17135
17228
|
})
|
|
17136
17229
|
);
|
|
17137
17230
|
|
|
17138
17231
|
// src/commands/connector/index.ts
|
|
17139
|
-
var connectorCommand = new
|
|
17232
|
+
var connectorCommand = new Command81().name("connector").description("Manage third-party service connections").addCommand(listCommand11).addCommand(statusCommand8).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
17140
17233
|
|
|
17141
17234
|
// src/commands/onboard/index.ts
|
|
17142
|
-
import { Command as
|
|
17143
|
-
import
|
|
17235
|
+
import { Command as Command82 } from "commander";
|
|
17236
|
+
import chalk76 from "chalk";
|
|
17144
17237
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
17145
17238
|
import { existsSync as existsSync12 } from "fs";
|
|
17146
17239
|
|
|
17147
17240
|
// src/lib/ui/welcome-box.ts
|
|
17148
|
-
import
|
|
17241
|
+
import chalk73 from "chalk";
|
|
17149
17242
|
var gradientColors = [
|
|
17150
|
-
|
|
17243
|
+
chalk73.hex("#FFAB5E"),
|
|
17151
17244
|
// Line 1 - lightest
|
|
17152
|
-
|
|
17245
|
+
chalk73.hex("#FF9642"),
|
|
17153
17246
|
// Line 2
|
|
17154
|
-
|
|
17247
|
+
chalk73.hex("#FF8228"),
|
|
17155
17248
|
// Line 3
|
|
17156
|
-
|
|
17249
|
+
chalk73.hex("#FF6D0A"),
|
|
17157
17250
|
// Line 4
|
|
17158
|
-
|
|
17251
|
+
chalk73.hex("#E85D00"),
|
|
17159
17252
|
// Line 5
|
|
17160
|
-
|
|
17253
|
+
chalk73.hex("#CC4E00")
|
|
17161
17254
|
// Line 6 - darkest
|
|
17162
17255
|
];
|
|
17163
17256
|
var vm0LogoLines = [
|
|
@@ -17179,15 +17272,15 @@ function renderVm0Banner() {
|
|
|
17179
17272
|
function renderOnboardWelcome() {
|
|
17180
17273
|
renderVm0Banner();
|
|
17181
17274
|
console.log(` Build agentic workflows using natural language.`);
|
|
17182
|
-
console.log(` ${
|
|
17275
|
+
console.log(` ${chalk73.dim("Currently in beta, enjoy it free")}`);
|
|
17183
17276
|
console.log(
|
|
17184
|
-
` ${
|
|
17277
|
+
` ${chalk73.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
17185
17278
|
);
|
|
17186
17279
|
console.log();
|
|
17187
17280
|
}
|
|
17188
17281
|
|
|
17189
17282
|
// src/lib/ui/step-runner.ts
|
|
17190
|
-
import
|
|
17283
|
+
import chalk74 from "chalk";
|
|
17191
17284
|
function createStepRunner(options = true) {
|
|
17192
17285
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
17193
17286
|
const interactive = opts.interactive ?? true;
|
|
@@ -17202,25 +17295,25 @@ function createStepRunner(options = true) {
|
|
|
17202
17295
|
}
|
|
17203
17296
|
for (const [i, step] of completedSteps.entries()) {
|
|
17204
17297
|
if (step.failed) {
|
|
17205
|
-
console.log(
|
|
17298
|
+
console.log(chalk74.red(`\u2717 ${step.label}`));
|
|
17206
17299
|
} else {
|
|
17207
|
-
console.log(
|
|
17300
|
+
console.log(chalk74.green(`\u25CF ${step.label}`));
|
|
17208
17301
|
}
|
|
17209
17302
|
const isLastStep = i === completedSteps.length - 1;
|
|
17210
17303
|
if (!isLastStep || !isFinal) {
|
|
17211
|
-
console.log(
|
|
17304
|
+
console.log(chalk74.dim("\u2502"));
|
|
17212
17305
|
}
|
|
17213
17306
|
}
|
|
17214
17307
|
}
|
|
17215
17308
|
async function executeStep(label, fn, isFinal) {
|
|
17216
17309
|
let stepFailed = false;
|
|
17217
|
-
console.log(
|
|
17310
|
+
console.log(chalk74.yellow(`\u25CB ${label}`));
|
|
17218
17311
|
const ctx = {
|
|
17219
17312
|
connector() {
|
|
17220
|
-
console.log(
|
|
17313
|
+
console.log(chalk74.dim("\u2502"));
|
|
17221
17314
|
},
|
|
17222
17315
|
detail(message) {
|
|
17223
|
-
console.log(`${
|
|
17316
|
+
console.log(`${chalk74.dim("\u2502")} ${message}`);
|
|
17224
17317
|
},
|
|
17225
17318
|
async prompt(promptFn) {
|
|
17226
17319
|
return await promptFn();
|
|
@@ -17237,12 +17330,12 @@ function createStepRunner(options = true) {
|
|
|
17237
17330
|
redrawCompletedSteps(isFinal);
|
|
17238
17331
|
} else {
|
|
17239
17332
|
if (stepFailed) {
|
|
17240
|
-
console.log(
|
|
17333
|
+
console.log(chalk74.red(`\u2717 ${label}`));
|
|
17241
17334
|
} else {
|
|
17242
|
-
console.log(
|
|
17335
|
+
console.log(chalk74.green(`\u25CF ${label}`));
|
|
17243
17336
|
}
|
|
17244
17337
|
if (!isFinal) {
|
|
17245
|
-
console.log(
|
|
17338
|
+
console.log(chalk74.dim("\u2502"));
|
|
17246
17339
|
}
|
|
17247
17340
|
}
|
|
17248
17341
|
}
|
|
@@ -17402,7 +17495,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
17402
17495
|
|
|
17403
17496
|
// src/lib/domain/onboard/claude-setup.ts
|
|
17404
17497
|
import { spawn as spawn3 } from "child_process";
|
|
17405
|
-
import
|
|
17498
|
+
import chalk75 from "chalk";
|
|
17406
17499
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
17407
17500
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
17408
17501
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -17439,12 +17532,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
17439
17532
|
}
|
|
17440
17533
|
function handlePluginError(error, context) {
|
|
17441
17534
|
const displayContext = context ?? "Claude plugin";
|
|
17442
|
-
console.error(
|
|
17535
|
+
console.error(chalk75.red(`\u2717 Failed to install ${displayContext}`));
|
|
17443
17536
|
if (error instanceof Error) {
|
|
17444
|
-
console.error(
|
|
17537
|
+
console.error(chalk75.red(`\u2717 ${error.message}`));
|
|
17445
17538
|
}
|
|
17446
17539
|
console.error(
|
|
17447
|
-
|
|
17540
|
+
chalk75.dim("Please ensure Claude CLI is installed and accessible.")
|
|
17448
17541
|
);
|
|
17449
17542
|
process.exit(1);
|
|
17450
17543
|
}
|
|
@@ -17487,7 +17580,7 @@ async function updateMarketplace() {
|
|
|
17487
17580
|
]);
|
|
17488
17581
|
if (!result.success) {
|
|
17489
17582
|
console.warn(
|
|
17490
|
-
|
|
17583
|
+
chalk75.yellow(
|
|
17491
17584
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
17492
17585
|
)
|
|
17493
17586
|
);
|
|
@@ -17533,9 +17626,9 @@ async function handleAuthentication(ctx) {
|
|
|
17533
17626
|
onInitiating: () => {
|
|
17534
17627
|
},
|
|
17535
17628
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
17536
|
-
step.detail(`Copy code: ${
|
|
17537
|
-
step.detail(`Open: ${
|
|
17538
|
-
step.detail(
|
|
17629
|
+
step.detail(`Copy code: ${chalk76.cyan.bold(code)}`);
|
|
17630
|
+
step.detail(`Open: ${chalk76.cyan(url)}`);
|
|
17631
|
+
step.detail(chalk76.dim(`Expires in ${expiresIn} minutes`));
|
|
17539
17632
|
},
|
|
17540
17633
|
onPolling: () => {
|
|
17541
17634
|
},
|
|
@@ -17575,14 +17668,14 @@ async function handleModelProvider(ctx) {
|
|
|
17575
17668
|
const selectedChoice = choices.find((c24) => c24.type === providerType);
|
|
17576
17669
|
if (selectedChoice?.helpText) {
|
|
17577
17670
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
17578
|
-
step.detail(
|
|
17671
|
+
step.detail(chalk76.dim(line));
|
|
17579
17672
|
}
|
|
17580
17673
|
}
|
|
17581
17674
|
const secret = await step.prompt(
|
|
17582
17675
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
17583
17676
|
);
|
|
17584
17677
|
if (!secret) {
|
|
17585
|
-
console.log(
|
|
17678
|
+
console.log(chalk76.dim("Cancelled"));
|
|
17586
17679
|
process.exit(0);
|
|
17587
17680
|
}
|
|
17588
17681
|
let selectedModel;
|
|
@@ -17601,7 +17694,7 @@ async function handleModelProvider(ctx) {
|
|
|
17601
17694
|
() => promptSelect("Select model:", modelChoices)
|
|
17602
17695
|
);
|
|
17603
17696
|
if (modelSelection === void 0) {
|
|
17604
|
-
console.log(
|
|
17697
|
+
console.log(chalk76.dim("Cancelled"));
|
|
17605
17698
|
process.exit(0);
|
|
17606
17699
|
}
|
|
17607
17700
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -17611,7 +17704,7 @@ async function handleModelProvider(ctx) {
|
|
|
17611
17704
|
});
|
|
17612
17705
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
17613
17706
|
step.detail(
|
|
17614
|
-
|
|
17707
|
+
chalk76.green(
|
|
17615
17708
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
17616
17709
|
)
|
|
17617
17710
|
);
|
|
@@ -17642,7 +17735,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17642
17735
|
agentName = inputName;
|
|
17643
17736
|
if (existsSync12(agentName)) {
|
|
17644
17737
|
step.detail(
|
|
17645
|
-
|
|
17738
|
+
chalk76.yellow(`${agentName}/ already exists, choose another name`)
|
|
17646
17739
|
);
|
|
17647
17740
|
} else {
|
|
17648
17741
|
folderExists = false;
|
|
@@ -17663,7 +17756,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17663
17756
|
}
|
|
17664
17757
|
}
|
|
17665
17758
|
await mkdir8(agentName, { recursive: true });
|
|
17666
|
-
step.detail(
|
|
17759
|
+
step.detail(chalk76.green(`Created ${agentName}/`));
|
|
17667
17760
|
});
|
|
17668
17761
|
return agentName;
|
|
17669
17762
|
}
|
|
@@ -17679,7 +17772,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17679
17772
|
shouldInstall = confirmed ?? true;
|
|
17680
17773
|
}
|
|
17681
17774
|
if (!shouldInstall) {
|
|
17682
|
-
step.detail(
|
|
17775
|
+
step.detail(chalk76.dim("Skipped"));
|
|
17683
17776
|
return;
|
|
17684
17777
|
}
|
|
17685
17778
|
const scope = "project";
|
|
@@ -17687,7 +17780,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17687
17780
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
17688
17781
|
const result = await installVm0Plugin(scope, agentDir);
|
|
17689
17782
|
step.detail(
|
|
17690
|
-
|
|
17783
|
+
chalk76.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17691
17784
|
);
|
|
17692
17785
|
pluginInstalled = true;
|
|
17693
17786
|
} catch (error) {
|
|
@@ -17698,18 +17791,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17698
17791
|
}
|
|
17699
17792
|
function printNextSteps(agentName, pluginInstalled) {
|
|
17700
17793
|
console.log();
|
|
17701
|
-
console.log(
|
|
17794
|
+
console.log(chalk76.bold("Next step:"));
|
|
17702
17795
|
console.log();
|
|
17703
17796
|
if (pluginInstalled) {
|
|
17704
17797
|
console.log(
|
|
17705
|
-
` ${
|
|
17798
|
+
` ${chalk76.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
17706
17799
|
);
|
|
17707
17800
|
} else {
|
|
17708
|
-
console.log(` ${
|
|
17801
|
+
console.log(` ${chalk76.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
17709
17802
|
}
|
|
17710
17803
|
console.log();
|
|
17711
17804
|
}
|
|
17712
|
-
var onboardCommand = new
|
|
17805
|
+
var onboardCommand = new Command82().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(
|
|
17713
17806
|
withErrorHandler(async (options) => {
|
|
17714
17807
|
const interactive = isInteractive();
|
|
17715
17808
|
if (interactive) {
|
|
@@ -17734,21 +17827,21 @@ var onboardCommand = new Command81().name("onboard").description("Guided setup f
|
|
|
17734
17827
|
);
|
|
17735
17828
|
|
|
17736
17829
|
// src/commands/setup-claude/index.ts
|
|
17737
|
-
import { Command as
|
|
17738
|
-
import
|
|
17739
|
-
var setupClaudeCommand = new
|
|
17830
|
+
import { Command as Command83 } from "commander";
|
|
17831
|
+
import chalk77 from "chalk";
|
|
17832
|
+
var setupClaudeCommand = new Command83().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(
|
|
17740
17833
|
withErrorHandler(async (options) => {
|
|
17741
|
-
console.log(
|
|
17834
|
+
console.log(chalk77.dim("Installing VM0 Claude Plugin..."));
|
|
17742
17835
|
const scope = options.scope === "user" ? "user" : "project";
|
|
17743
17836
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
17744
17837
|
console.log(
|
|
17745
|
-
|
|
17838
|
+
chalk77.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17746
17839
|
);
|
|
17747
17840
|
console.log();
|
|
17748
17841
|
console.log("Next step:");
|
|
17749
17842
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
17750
17843
|
console.log(
|
|
17751
|
-
|
|
17844
|
+
chalk77.cyan(
|
|
17752
17845
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
17753
17846
|
)
|
|
17754
17847
|
);
|
|
@@ -17756,36 +17849,36 @@ var setupClaudeCommand = new Command82().name("setup-claude").description("Insta
|
|
|
17756
17849
|
);
|
|
17757
17850
|
|
|
17758
17851
|
// src/commands/dashboard/index.ts
|
|
17759
|
-
import { Command as
|
|
17760
|
-
import
|
|
17761
|
-
var dashboardCommand = new
|
|
17852
|
+
import { Command as Command84 } from "commander";
|
|
17853
|
+
import chalk78 from "chalk";
|
|
17854
|
+
var dashboardCommand = new Command84().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
17762
17855
|
console.log();
|
|
17763
|
-
console.log(
|
|
17856
|
+
console.log(chalk78.bold("VM0 Dashboard"));
|
|
17764
17857
|
console.log();
|
|
17765
|
-
console.log(
|
|
17766
|
-
console.log(
|
|
17858
|
+
console.log(chalk78.bold("Agents"));
|
|
17859
|
+
console.log(chalk78.dim(" List agents: ") + "vm0 agent list");
|
|
17767
17860
|
console.log();
|
|
17768
|
-
console.log(
|
|
17769
|
-
console.log(
|
|
17770
|
-
console.log(
|
|
17861
|
+
console.log(chalk78.bold("Runs"));
|
|
17862
|
+
console.log(chalk78.dim(" Recent runs: ") + "vm0 run list");
|
|
17863
|
+
console.log(chalk78.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
17771
17864
|
console.log();
|
|
17772
|
-
console.log(
|
|
17773
|
-
console.log(
|
|
17865
|
+
console.log(chalk78.bold("Schedules"));
|
|
17866
|
+
console.log(chalk78.dim(" List schedules: ") + "vm0 schedule list");
|
|
17774
17867
|
console.log();
|
|
17775
|
-
console.log(
|
|
17776
|
-
console.log(
|
|
17777
|
-
console.log(
|
|
17778
|
-
console.log(
|
|
17868
|
+
console.log(chalk78.bold("Account"));
|
|
17869
|
+
console.log(chalk78.dim(" Usage stats: ") + "vm0 usage");
|
|
17870
|
+
console.log(chalk78.dim(" List secrets: ") + "vm0 secret list");
|
|
17871
|
+
console.log(chalk78.dim(" List variables: ") + "vm0 variable list");
|
|
17779
17872
|
console.log();
|
|
17780
17873
|
console.log(
|
|
17781
|
-
|
|
17874
|
+
chalk78.dim("Not logged in? Run: ") + chalk78.cyan("vm0 auth login")
|
|
17782
17875
|
);
|
|
17783
17876
|
console.log();
|
|
17784
17877
|
});
|
|
17785
17878
|
|
|
17786
17879
|
// src/commands/preference/index.ts
|
|
17787
|
-
import { Command as
|
|
17788
|
-
import
|
|
17880
|
+
import { Command as Command85 } from "commander";
|
|
17881
|
+
import chalk79 from "chalk";
|
|
17789
17882
|
function detectTimezone2() {
|
|
17790
17883
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
17791
17884
|
}
|
|
@@ -17806,15 +17899,15 @@ function parseOnOff(flag, value) {
|
|
|
17806
17899
|
);
|
|
17807
17900
|
}
|
|
17808
17901
|
function displayPreferences(prefs) {
|
|
17809
|
-
console.log(
|
|
17902
|
+
console.log(chalk79.bold("Current preferences:"));
|
|
17810
17903
|
console.log(
|
|
17811
|
-
` Timezone: ${prefs.timezone ?
|
|
17904
|
+
` Timezone: ${prefs.timezone ? chalk79.cyan(prefs.timezone) : chalk79.dim("not set")}`
|
|
17812
17905
|
);
|
|
17813
17906
|
console.log(
|
|
17814
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
17907
|
+
` Email notify: ${prefs.notifyEmail ? chalk79.green("on") : chalk79.dim("off")}`
|
|
17815
17908
|
);
|
|
17816
17909
|
console.log(
|
|
17817
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
17910
|
+
` Slack notify: ${prefs.notifySlack ? chalk79.green("on") : chalk79.dim("off")}`
|
|
17818
17911
|
);
|
|
17819
17912
|
}
|
|
17820
17913
|
function buildUpdates(opts) {
|
|
@@ -17844,21 +17937,21 @@ function buildUpdates(opts) {
|
|
|
17844
17937
|
function printUpdateResult(updates, result) {
|
|
17845
17938
|
if (updates.timezone !== void 0) {
|
|
17846
17939
|
console.log(
|
|
17847
|
-
|
|
17848
|
-
`Timezone set to ${
|
|
17940
|
+
chalk79.green(
|
|
17941
|
+
`Timezone set to ${chalk79.cyan(result.timezone ?? updates.timezone)}`
|
|
17849
17942
|
)
|
|
17850
17943
|
);
|
|
17851
17944
|
}
|
|
17852
17945
|
if (updates.notifyEmail !== void 0) {
|
|
17853
17946
|
console.log(
|
|
17854
|
-
|
|
17947
|
+
chalk79.green(
|
|
17855
17948
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
17856
17949
|
)
|
|
17857
17950
|
);
|
|
17858
17951
|
}
|
|
17859
17952
|
if (updates.notifySlack !== void 0) {
|
|
17860
17953
|
console.log(
|
|
17861
|
-
|
|
17954
|
+
chalk79.green(
|
|
17862
17955
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
17863
17956
|
)
|
|
17864
17957
|
);
|
|
@@ -17867,7 +17960,7 @@ function printUpdateResult(updates, result) {
|
|
|
17867
17960
|
async function interactiveSetup(prefs) {
|
|
17868
17961
|
if (!prefs.timezone) {
|
|
17869
17962
|
const detectedTz = detectTimezone2();
|
|
17870
|
-
console.log(
|
|
17963
|
+
console.log(chalk79.dim(`
|
|
17871
17964
|
System timezone detected: ${detectedTz}`));
|
|
17872
17965
|
const tz = await promptText(
|
|
17873
17966
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -17878,7 +17971,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
17878
17971
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
17879
17972
|
}
|
|
17880
17973
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
17881
|
-
console.log(
|
|
17974
|
+
console.log(chalk79.green(`Timezone set to ${chalk79.cyan(tz.trim())}`));
|
|
17882
17975
|
}
|
|
17883
17976
|
}
|
|
17884
17977
|
if (!prefs.notifyEmail) {
|
|
@@ -17888,11 +17981,11 @@ System timezone detected: ${detectedTz}`));
|
|
|
17888
17981
|
);
|
|
17889
17982
|
if (enable) {
|
|
17890
17983
|
await updateUserPreferences({ notifyEmail: true });
|
|
17891
|
-
console.log(
|
|
17984
|
+
console.log(chalk79.green("Email notifications enabled"));
|
|
17892
17985
|
}
|
|
17893
17986
|
}
|
|
17894
17987
|
}
|
|
17895
|
-
var preferenceCommand = new
|
|
17988
|
+
var preferenceCommand = new Command85().name("preference").description("View or update your preferences").option("--timezone <timezone>", "IANA timezone (e.g., America/New_York)").option("--notify-email <on|off>", "Enable or disable email notifications").option("--notify-slack <on|off>", "Enable or disable Slack notifications").action(
|
|
17896
17989
|
withErrorHandler(async (opts) => {
|
|
17897
17990
|
const updates = buildUpdates(opts);
|
|
17898
17991
|
if (updates) {
|
|
@@ -17907,32 +18000,32 @@ var preferenceCommand = new Command84().name("preference").description("View or
|
|
|
17907
18000
|
} else if (!prefs.timezone) {
|
|
17908
18001
|
console.log();
|
|
17909
18002
|
console.log(
|
|
17910
|
-
`To set timezone: ${
|
|
18003
|
+
`To set timezone: ${chalk79.cyan("vm0 preference --timezone <timezone>")}`
|
|
17911
18004
|
);
|
|
17912
18005
|
console.log(
|
|
17913
|
-
|
|
18006
|
+
chalk79.dim("Example: vm0 preference --timezone America/New_York")
|
|
17914
18007
|
);
|
|
17915
18008
|
}
|
|
17916
18009
|
})
|
|
17917
18010
|
);
|
|
17918
18011
|
|
|
17919
18012
|
// src/commands/upgrade/index.ts
|
|
17920
|
-
import { Command as
|
|
17921
|
-
import
|
|
17922
|
-
var upgradeCommand = new
|
|
18013
|
+
import { Command as Command86 } from "commander";
|
|
18014
|
+
import chalk80 from "chalk";
|
|
18015
|
+
var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
17923
18016
|
withErrorHandler(async () => {
|
|
17924
18017
|
console.log("Checking for updates...");
|
|
17925
18018
|
const latestVersion = await getLatestVersion();
|
|
17926
18019
|
if (latestVersion === null) {
|
|
17927
18020
|
throw new Error("Could not check for updates. Please try again later.");
|
|
17928
18021
|
}
|
|
17929
|
-
if (latestVersion === "9.
|
|
17930
|
-
console.log(
|
|
18022
|
+
if (latestVersion === "9.61.0") {
|
|
18023
|
+
console.log(chalk80.green(`\u2713 Already up to date (${"9.61.0"})`));
|
|
17931
18024
|
return;
|
|
17932
18025
|
}
|
|
17933
18026
|
console.log(
|
|
17934
|
-
|
|
17935
|
-
`Current version: ${"9.
|
|
18027
|
+
chalk80.yellow(
|
|
18028
|
+
`Current version: ${"9.61.0"} -> Latest version: ${latestVersion}`
|
|
17936
18029
|
)
|
|
17937
18030
|
);
|
|
17938
18031
|
console.log();
|
|
@@ -17940,26 +18033,26 @@ var upgradeCommand = new Command85().name("upgrade").description("Upgrade vm0 CL
|
|
|
17940
18033
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
17941
18034
|
if (packageManager === "unknown") {
|
|
17942
18035
|
console.log(
|
|
17943
|
-
|
|
18036
|
+
chalk80.yellow(
|
|
17944
18037
|
"Could not detect your package manager for auto-upgrade."
|
|
17945
18038
|
)
|
|
17946
18039
|
);
|
|
17947
18040
|
} else {
|
|
17948
18041
|
console.log(
|
|
17949
|
-
|
|
18042
|
+
chalk80.yellow(
|
|
17950
18043
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
17951
18044
|
)
|
|
17952
18045
|
);
|
|
17953
18046
|
}
|
|
17954
|
-
console.log(
|
|
17955
|
-
console.log(
|
|
18047
|
+
console.log(chalk80.yellow("Please upgrade manually:"));
|
|
18048
|
+
console.log(chalk80.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
17956
18049
|
return;
|
|
17957
18050
|
}
|
|
17958
18051
|
console.log(`Upgrading via ${packageManager}...`);
|
|
17959
18052
|
const success = await performUpgrade(packageManager);
|
|
17960
18053
|
if (success) {
|
|
17961
18054
|
console.log(
|
|
17962
|
-
|
|
18055
|
+
chalk80.green(`\u2713 Upgraded from ${"9.61.0"} to ${latestVersion}`)
|
|
17963
18056
|
);
|
|
17964
18057
|
return;
|
|
17965
18058
|
}
|
|
@@ -17972,8 +18065,8 @@ var upgradeCommand = new Command85().name("upgrade").description("Upgrade vm0 CL
|
|
|
17972
18065
|
);
|
|
17973
18066
|
|
|
17974
18067
|
// src/index.ts
|
|
17975
|
-
var program = new
|
|
17976
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
18068
|
+
var program = new Command87();
|
|
18069
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.61.0");
|
|
17977
18070
|
program.addCommand(authCommand);
|
|
17978
18071
|
program.addCommand(infoCommand);
|
|
17979
18072
|
program.addCommand(composeCommand);
|