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