@vm0/runner 2.13.1 → 2.13.2
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 +228 -183
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -43,8 +43,9 @@ var runnerConfigSchema = z.object({
|
|
|
43
43
|
rootfs: z.string().min(1, "Rootfs path is required")
|
|
44
44
|
}),
|
|
45
45
|
proxy: z.object({
|
|
46
|
-
port: z.number().int().min(1024).max(65535).default(PROXY_DEFAULTS.port)
|
|
47
|
-
|
|
46
|
+
port: z.number().int().min(1024).max(65535).default(PROXY_DEFAULTS.port),
|
|
47
|
+
ca_dir: z.string().min(1, "Proxy CA directory is required")
|
|
48
|
+
})
|
|
48
49
|
});
|
|
49
50
|
var DEBUG_SERVER_DEFAULTS = {
|
|
50
51
|
url: "http://localhost:3000",
|
|
@@ -69,8 +70,9 @@ var debugConfigSchema = z.object({
|
|
|
69
70
|
rootfs: z.string().min(1, "Rootfs path is required")
|
|
70
71
|
}),
|
|
71
72
|
proxy: z.object({
|
|
72
|
-
port: z.number().int().min(1024).max(65535).default(PROXY_DEFAULTS.port)
|
|
73
|
-
|
|
73
|
+
port: z.number().int().min(1024).max(65535).default(PROXY_DEFAULTS.port),
|
|
74
|
+
ca_dir: z.string().default("/tmp/vm0-proxy")
|
|
75
|
+
}).default({ ...PROXY_DEFAULTS, ca_dir: "/tmp/vm0-proxy" })
|
|
74
76
|
});
|
|
75
77
|
function loadDebugConfig(configPath) {
|
|
76
78
|
if (!fs.existsSync(configPath)) {
|
|
@@ -7042,9 +7044,43 @@ var scheduleRunsContract = c12.router({
|
|
|
7042
7044
|
}
|
|
7043
7045
|
});
|
|
7044
7046
|
|
|
7045
|
-
// ../../packages/core/src/contracts/
|
|
7047
|
+
// ../../packages/core/src/contracts/realtime.ts
|
|
7046
7048
|
import { z as z17 } from "zod";
|
|
7047
|
-
var
|
|
7049
|
+
var c13 = initContract();
|
|
7050
|
+
var ablyTokenRequestSchema = z17.object({
|
|
7051
|
+
keyName: z17.string(),
|
|
7052
|
+
ttl: z17.number().optional(),
|
|
7053
|
+
timestamp: z17.number(),
|
|
7054
|
+
capability: z17.string(),
|
|
7055
|
+
clientId: z17.string().optional(),
|
|
7056
|
+
nonce: z17.string(),
|
|
7057
|
+
mac: z17.string()
|
|
7058
|
+
});
|
|
7059
|
+
var realtimeTokenContract = c13.router({
|
|
7060
|
+
/**
|
|
7061
|
+
* POST /api/realtime/token
|
|
7062
|
+
* Get an Ably token to subscribe to a run's events channel
|
|
7063
|
+
*/
|
|
7064
|
+
create: {
|
|
7065
|
+
method: "POST",
|
|
7066
|
+
path: "/api/realtime/token",
|
|
7067
|
+
body: z17.object({
|
|
7068
|
+
runId: z17.string().uuid("runId must be a valid UUID")
|
|
7069
|
+
}),
|
|
7070
|
+
responses: {
|
|
7071
|
+
200: ablyTokenRequestSchema,
|
|
7072
|
+
401: apiErrorSchema,
|
|
7073
|
+
403: apiErrorSchema,
|
|
7074
|
+
404: apiErrorSchema,
|
|
7075
|
+
500: apiErrorSchema
|
|
7076
|
+
},
|
|
7077
|
+
summary: "Get Ably token for run event subscription"
|
|
7078
|
+
}
|
|
7079
|
+
});
|
|
7080
|
+
|
|
7081
|
+
// ../../packages/core/src/contracts/public/common.ts
|
|
7082
|
+
import { z as z18 } from "zod";
|
|
7083
|
+
var publicApiErrorTypeSchema = z18.enum([
|
|
7048
7084
|
"api_error",
|
|
7049
7085
|
// Internal server error (5xx)
|
|
7050
7086
|
"invalid_request_error",
|
|
@@ -7056,55 +7092,55 @@ var publicApiErrorTypeSchema = z17.enum([
|
|
|
7056
7092
|
"conflict_error"
|
|
7057
7093
|
// Resource conflict (409)
|
|
7058
7094
|
]);
|
|
7059
|
-
var publicApiErrorSchema =
|
|
7060
|
-
error:
|
|
7095
|
+
var publicApiErrorSchema = z18.object({
|
|
7096
|
+
error: z18.object({
|
|
7061
7097
|
type: publicApiErrorTypeSchema,
|
|
7062
|
-
code:
|
|
7063
|
-
message:
|
|
7064
|
-
param:
|
|
7065
|
-
doc_url:
|
|
7098
|
+
code: z18.string(),
|
|
7099
|
+
message: z18.string(),
|
|
7100
|
+
param: z18.string().optional(),
|
|
7101
|
+
doc_url: z18.string().url().optional()
|
|
7066
7102
|
})
|
|
7067
7103
|
});
|
|
7068
|
-
var paginationSchema =
|
|
7069
|
-
has_more:
|
|
7070
|
-
next_cursor:
|
|
7104
|
+
var paginationSchema = z18.object({
|
|
7105
|
+
has_more: z18.boolean(),
|
|
7106
|
+
next_cursor: z18.string().nullable()
|
|
7071
7107
|
});
|
|
7072
7108
|
function createPaginatedResponseSchema(dataSchema) {
|
|
7073
|
-
return
|
|
7074
|
-
data:
|
|
7109
|
+
return z18.object({
|
|
7110
|
+
data: z18.array(dataSchema),
|
|
7075
7111
|
pagination: paginationSchema
|
|
7076
7112
|
});
|
|
7077
7113
|
}
|
|
7078
|
-
var listQuerySchema =
|
|
7079
|
-
cursor:
|
|
7080
|
-
limit:
|
|
7114
|
+
var listQuerySchema = z18.object({
|
|
7115
|
+
cursor: z18.string().optional(),
|
|
7116
|
+
limit: z18.coerce.number().min(1).max(100).default(20)
|
|
7081
7117
|
});
|
|
7082
|
-
var requestIdSchema =
|
|
7083
|
-
var timestampSchema =
|
|
7118
|
+
var requestIdSchema = z18.string().uuid();
|
|
7119
|
+
var timestampSchema = z18.string().datetime();
|
|
7084
7120
|
|
|
7085
7121
|
// ../../packages/core/src/contracts/public/agents.ts
|
|
7086
|
-
import { z as
|
|
7087
|
-
var
|
|
7088
|
-
var publicAgentSchema =
|
|
7089
|
-
id:
|
|
7090
|
-
name:
|
|
7091
|
-
current_version_id:
|
|
7122
|
+
import { z as z19 } from "zod";
|
|
7123
|
+
var c14 = initContract();
|
|
7124
|
+
var publicAgentSchema = z19.object({
|
|
7125
|
+
id: z19.string(),
|
|
7126
|
+
name: z19.string(),
|
|
7127
|
+
current_version_id: z19.string().nullable(),
|
|
7092
7128
|
created_at: timestampSchema,
|
|
7093
7129
|
updated_at: timestampSchema
|
|
7094
7130
|
});
|
|
7095
|
-
var agentVersionSchema =
|
|
7096
|
-
id:
|
|
7097
|
-
agent_id:
|
|
7098
|
-
version_number:
|
|
7131
|
+
var agentVersionSchema = z19.object({
|
|
7132
|
+
id: z19.string(),
|
|
7133
|
+
agent_id: z19.string(),
|
|
7134
|
+
version_number: z19.number(),
|
|
7099
7135
|
created_at: timestampSchema
|
|
7100
7136
|
});
|
|
7101
7137
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
7102
7138
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
7103
7139
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
7104
7140
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
7105
|
-
name:
|
|
7141
|
+
name: z19.string().optional()
|
|
7106
7142
|
});
|
|
7107
|
-
var publicAgentsListContract =
|
|
7143
|
+
var publicAgentsListContract = c14.router({
|
|
7108
7144
|
list: {
|
|
7109
7145
|
method: "GET",
|
|
7110
7146
|
path: "/v1/agents",
|
|
@@ -7118,12 +7154,12 @@ var publicAgentsListContract = c13.router({
|
|
|
7118
7154
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
7119
7155
|
}
|
|
7120
7156
|
});
|
|
7121
|
-
var publicAgentByIdContract =
|
|
7157
|
+
var publicAgentByIdContract = c14.router({
|
|
7122
7158
|
get: {
|
|
7123
7159
|
method: "GET",
|
|
7124
7160
|
path: "/v1/agents/:id",
|
|
7125
|
-
pathParams:
|
|
7126
|
-
id:
|
|
7161
|
+
pathParams: z19.object({
|
|
7162
|
+
id: z19.string().min(1, "Agent ID is required")
|
|
7127
7163
|
}),
|
|
7128
7164
|
responses: {
|
|
7129
7165
|
200: publicAgentDetailSchema,
|
|
@@ -7135,12 +7171,12 @@ var publicAgentByIdContract = c13.router({
|
|
|
7135
7171
|
description: "Get agent details by ID"
|
|
7136
7172
|
}
|
|
7137
7173
|
});
|
|
7138
|
-
var publicAgentVersionsContract =
|
|
7174
|
+
var publicAgentVersionsContract = c14.router({
|
|
7139
7175
|
list: {
|
|
7140
7176
|
method: "GET",
|
|
7141
7177
|
path: "/v1/agents/:id/versions",
|
|
7142
|
-
pathParams:
|
|
7143
|
-
id:
|
|
7178
|
+
pathParams: z19.object({
|
|
7179
|
+
id: z19.string().min(1, "Agent ID is required")
|
|
7144
7180
|
}),
|
|
7145
7181
|
query: listQuerySchema,
|
|
7146
7182
|
responses: {
|
|
@@ -7155,9 +7191,9 @@ var publicAgentVersionsContract = c13.router({
|
|
|
7155
7191
|
});
|
|
7156
7192
|
|
|
7157
7193
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
7158
|
-
import { z as
|
|
7159
|
-
var
|
|
7160
|
-
var publicRunStatusSchema =
|
|
7194
|
+
import { z as z20 } from "zod";
|
|
7195
|
+
var c15 = initContract();
|
|
7196
|
+
var publicRunStatusSchema = z20.enum([
|
|
7161
7197
|
"pending",
|
|
7162
7198
|
"running",
|
|
7163
7199
|
"completed",
|
|
@@ -7165,56 +7201,56 @@ var publicRunStatusSchema = z19.enum([
|
|
|
7165
7201
|
"timeout",
|
|
7166
7202
|
"cancelled"
|
|
7167
7203
|
]);
|
|
7168
|
-
var publicRunSchema =
|
|
7169
|
-
id:
|
|
7170
|
-
agent_id:
|
|
7171
|
-
agent_name:
|
|
7204
|
+
var publicRunSchema = z20.object({
|
|
7205
|
+
id: z20.string(),
|
|
7206
|
+
agent_id: z20.string(),
|
|
7207
|
+
agent_name: z20.string(),
|
|
7172
7208
|
status: publicRunStatusSchema,
|
|
7173
|
-
prompt:
|
|
7209
|
+
prompt: z20.string(),
|
|
7174
7210
|
created_at: timestampSchema,
|
|
7175
7211
|
started_at: timestampSchema.nullable(),
|
|
7176
7212
|
completed_at: timestampSchema.nullable()
|
|
7177
7213
|
});
|
|
7178
7214
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
7179
|
-
error:
|
|
7180
|
-
execution_time_ms:
|
|
7181
|
-
checkpoint_id:
|
|
7182
|
-
session_id:
|
|
7183
|
-
artifact_name:
|
|
7184
|
-
artifact_version:
|
|
7185
|
-
volumes:
|
|
7215
|
+
error: z20.string().nullable(),
|
|
7216
|
+
execution_time_ms: z20.number().nullable(),
|
|
7217
|
+
checkpoint_id: z20.string().nullable(),
|
|
7218
|
+
session_id: z20.string().nullable(),
|
|
7219
|
+
artifact_name: z20.string().nullable(),
|
|
7220
|
+
artifact_version: z20.string().nullable(),
|
|
7221
|
+
volumes: z20.record(z20.string(), z20.string()).optional()
|
|
7186
7222
|
});
|
|
7187
7223
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
7188
|
-
var createRunRequestSchema =
|
|
7224
|
+
var createRunRequestSchema = z20.object({
|
|
7189
7225
|
// Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
|
|
7190
|
-
agent:
|
|
7226
|
+
agent: z20.string().optional(),
|
|
7191
7227
|
// Agent name
|
|
7192
|
-
agent_id:
|
|
7228
|
+
agent_id: z20.string().optional(),
|
|
7193
7229
|
// Agent ID
|
|
7194
|
-
agent_version:
|
|
7230
|
+
agent_version: z20.string().optional(),
|
|
7195
7231
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
7196
7232
|
// Continue session
|
|
7197
|
-
session_id:
|
|
7233
|
+
session_id: z20.string().optional(),
|
|
7198
7234
|
// Resume from checkpoint
|
|
7199
|
-
checkpoint_id:
|
|
7235
|
+
checkpoint_id: z20.string().optional(),
|
|
7200
7236
|
// Required
|
|
7201
|
-
prompt:
|
|
7237
|
+
prompt: z20.string().min(1, "Prompt is required"),
|
|
7202
7238
|
// Optional configuration
|
|
7203
|
-
variables:
|
|
7204
|
-
secrets:
|
|
7205
|
-
artifact_name:
|
|
7239
|
+
variables: z20.record(z20.string(), z20.string()).optional(),
|
|
7240
|
+
secrets: z20.record(z20.string(), z20.string()).optional(),
|
|
7241
|
+
artifact_name: z20.string().optional(),
|
|
7206
7242
|
// Artifact name to mount
|
|
7207
|
-
artifact_version:
|
|
7243
|
+
artifact_version: z20.string().optional(),
|
|
7208
7244
|
// Artifact version (defaults to latest)
|
|
7209
|
-
volumes:
|
|
7245
|
+
volumes: z20.record(z20.string(), z20.string()).optional()
|
|
7210
7246
|
// volume_name -> version
|
|
7211
7247
|
});
|
|
7212
7248
|
var runListQuerySchema = listQuerySchema.extend({
|
|
7213
|
-
agent_id:
|
|
7249
|
+
agent_id: z20.string().optional(),
|
|
7214
7250
|
status: publicRunStatusSchema.optional(),
|
|
7215
7251
|
since: timestampSchema.optional()
|
|
7216
7252
|
});
|
|
7217
|
-
var publicRunsListContract =
|
|
7253
|
+
var publicRunsListContract = c15.router({
|
|
7218
7254
|
list: {
|
|
7219
7255
|
method: "GET",
|
|
7220
7256
|
path: "/v1/runs",
|
|
@@ -7243,12 +7279,12 @@ var publicRunsListContract = c14.router({
|
|
|
7243
7279
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
7244
7280
|
}
|
|
7245
7281
|
});
|
|
7246
|
-
var publicRunByIdContract =
|
|
7282
|
+
var publicRunByIdContract = c15.router({
|
|
7247
7283
|
get: {
|
|
7248
7284
|
method: "GET",
|
|
7249
7285
|
path: "/v1/runs/:id",
|
|
7250
|
-
pathParams:
|
|
7251
|
-
id:
|
|
7286
|
+
pathParams: z20.object({
|
|
7287
|
+
id: z20.string().min(1, "Run ID is required")
|
|
7252
7288
|
}),
|
|
7253
7289
|
responses: {
|
|
7254
7290
|
200: publicRunDetailSchema,
|
|
@@ -7260,14 +7296,14 @@ var publicRunByIdContract = c14.router({
|
|
|
7260
7296
|
description: "Get run details by ID"
|
|
7261
7297
|
}
|
|
7262
7298
|
});
|
|
7263
|
-
var publicRunCancelContract =
|
|
7299
|
+
var publicRunCancelContract = c15.router({
|
|
7264
7300
|
cancel: {
|
|
7265
7301
|
method: "POST",
|
|
7266
7302
|
path: "/v1/runs/:id/cancel",
|
|
7267
|
-
pathParams:
|
|
7268
|
-
id:
|
|
7303
|
+
pathParams: z20.object({
|
|
7304
|
+
id: z20.string().min(1, "Run ID is required")
|
|
7269
7305
|
}),
|
|
7270
|
-
body:
|
|
7306
|
+
body: z20.undefined(),
|
|
7271
7307
|
responses: {
|
|
7272
7308
|
200: publicRunDetailSchema,
|
|
7273
7309
|
400: publicApiErrorSchema,
|
|
@@ -7280,26 +7316,26 @@ var publicRunCancelContract = c14.router({
|
|
|
7280
7316
|
description: "Cancel a pending or running execution"
|
|
7281
7317
|
}
|
|
7282
7318
|
});
|
|
7283
|
-
var logEntrySchema =
|
|
7319
|
+
var logEntrySchema = z20.object({
|
|
7284
7320
|
timestamp: timestampSchema,
|
|
7285
|
-
type:
|
|
7286
|
-
level:
|
|
7287
|
-
message:
|
|
7288
|
-
metadata:
|
|
7321
|
+
type: z20.enum(["agent", "system", "network"]),
|
|
7322
|
+
level: z20.enum(["debug", "info", "warn", "error"]),
|
|
7323
|
+
message: z20.string(),
|
|
7324
|
+
metadata: z20.record(z20.string(), z20.unknown()).optional()
|
|
7289
7325
|
});
|
|
7290
7326
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
7291
7327
|
var logsQuerySchema = listQuerySchema.extend({
|
|
7292
|
-
type:
|
|
7328
|
+
type: z20.enum(["agent", "system", "network", "all"]).default("all"),
|
|
7293
7329
|
since: timestampSchema.optional(),
|
|
7294
7330
|
until: timestampSchema.optional(),
|
|
7295
|
-
order:
|
|
7331
|
+
order: z20.enum(["asc", "desc"]).default("asc")
|
|
7296
7332
|
});
|
|
7297
|
-
var publicRunLogsContract =
|
|
7333
|
+
var publicRunLogsContract = c15.router({
|
|
7298
7334
|
getLogs: {
|
|
7299
7335
|
method: "GET",
|
|
7300
7336
|
path: "/v1/runs/:id/logs",
|
|
7301
|
-
pathParams:
|
|
7302
|
-
id:
|
|
7337
|
+
pathParams: z20.object({
|
|
7338
|
+
id: z20.string().min(1, "Run ID is required")
|
|
7303
7339
|
}),
|
|
7304
7340
|
query: logsQuerySchema,
|
|
7305
7341
|
responses: {
|
|
@@ -7312,29 +7348,29 @@ var publicRunLogsContract = c14.router({
|
|
|
7312
7348
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
7313
7349
|
}
|
|
7314
7350
|
});
|
|
7315
|
-
var metricPointSchema =
|
|
7351
|
+
var metricPointSchema = z20.object({
|
|
7316
7352
|
timestamp: timestampSchema,
|
|
7317
|
-
cpu_percent:
|
|
7318
|
-
memory_used_mb:
|
|
7319
|
-
memory_total_mb:
|
|
7320
|
-
disk_used_mb:
|
|
7321
|
-
disk_total_mb:
|
|
7322
|
-
});
|
|
7323
|
-
var metricsSummarySchema =
|
|
7324
|
-
avg_cpu_percent:
|
|
7325
|
-
max_memory_used_mb:
|
|
7326
|
-
total_duration_ms:
|
|
7327
|
-
});
|
|
7328
|
-
var metricsResponseSchema2 =
|
|
7329
|
-
data:
|
|
7353
|
+
cpu_percent: z20.number(),
|
|
7354
|
+
memory_used_mb: z20.number(),
|
|
7355
|
+
memory_total_mb: z20.number(),
|
|
7356
|
+
disk_used_mb: z20.number(),
|
|
7357
|
+
disk_total_mb: z20.number()
|
|
7358
|
+
});
|
|
7359
|
+
var metricsSummarySchema = z20.object({
|
|
7360
|
+
avg_cpu_percent: z20.number(),
|
|
7361
|
+
max_memory_used_mb: z20.number(),
|
|
7362
|
+
total_duration_ms: z20.number().nullable()
|
|
7363
|
+
});
|
|
7364
|
+
var metricsResponseSchema2 = z20.object({
|
|
7365
|
+
data: z20.array(metricPointSchema),
|
|
7330
7366
|
summary: metricsSummarySchema
|
|
7331
7367
|
});
|
|
7332
|
-
var publicRunMetricsContract =
|
|
7368
|
+
var publicRunMetricsContract = c15.router({
|
|
7333
7369
|
getMetrics: {
|
|
7334
7370
|
method: "GET",
|
|
7335
7371
|
path: "/v1/runs/:id/metrics",
|
|
7336
|
-
pathParams:
|
|
7337
|
-
id:
|
|
7372
|
+
pathParams: z20.object({
|
|
7373
|
+
id: z20.string().min(1, "Run ID is required")
|
|
7338
7374
|
}),
|
|
7339
7375
|
responses: {
|
|
7340
7376
|
200: metricsResponseSchema2,
|
|
@@ -7346,7 +7382,7 @@ var publicRunMetricsContract = c14.router({
|
|
|
7346
7382
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
7347
7383
|
}
|
|
7348
7384
|
});
|
|
7349
|
-
var sseEventTypeSchema =
|
|
7385
|
+
var sseEventTypeSchema = z20.enum([
|
|
7350
7386
|
"status",
|
|
7351
7387
|
// Run status change
|
|
7352
7388
|
"output",
|
|
@@ -7358,25 +7394,25 @@ var sseEventTypeSchema = z19.enum([
|
|
|
7358
7394
|
"heartbeat"
|
|
7359
7395
|
// Keep-alive
|
|
7360
7396
|
]);
|
|
7361
|
-
var sseEventSchema =
|
|
7397
|
+
var sseEventSchema = z20.object({
|
|
7362
7398
|
event: sseEventTypeSchema,
|
|
7363
|
-
data:
|
|
7364
|
-
id:
|
|
7399
|
+
data: z20.unknown(),
|
|
7400
|
+
id: z20.string().optional()
|
|
7365
7401
|
// For Last-Event-ID reconnection
|
|
7366
7402
|
});
|
|
7367
|
-
var publicRunEventsContract =
|
|
7403
|
+
var publicRunEventsContract = c15.router({
|
|
7368
7404
|
streamEvents: {
|
|
7369
7405
|
method: "GET",
|
|
7370
7406
|
path: "/v1/runs/:id/events",
|
|
7371
|
-
pathParams:
|
|
7372
|
-
id:
|
|
7407
|
+
pathParams: z20.object({
|
|
7408
|
+
id: z20.string().min(1, "Run ID is required")
|
|
7373
7409
|
}),
|
|
7374
|
-
query:
|
|
7375
|
-
last_event_id:
|
|
7410
|
+
query: z20.object({
|
|
7411
|
+
last_event_id: z20.string().optional()
|
|
7376
7412
|
// For reconnection
|
|
7377
7413
|
}),
|
|
7378
7414
|
responses: {
|
|
7379
|
-
200:
|
|
7415
|
+
200: z20.any(),
|
|
7380
7416
|
// SSE stream - actual content is text/event-stream
|
|
7381
7417
|
401: publicApiErrorSchema,
|
|
7382
7418
|
404: publicApiErrorSchema,
|
|
@@ -7388,28 +7424,28 @@ var publicRunEventsContract = c14.router({
|
|
|
7388
7424
|
});
|
|
7389
7425
|
|
|
7390
7426
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
7391
|
-
import { z as
|
|
7392
|
-
var
|
|
7393
|
-
var publicArtifactSchema =
|
|
7394
|
-
id:
|
|
7395
|
-
name:
|
|
7396
|
-
current_version_id:
|
|
7397
|
-
size:
|
|
7427
|
+
import { z as z21 } from "zod";
|
|
7428
|
+
var c16 = initContract();
|
|
7429
|
+
var publicArtifactSchema = z21.object({
|
|
7430
|
+
id: z21.string(),
|
|
7431
|
+
name: z21.string(),
|
|
7432
|
+
current_version_id: z21.string().nullable(),
|
|
7433
|
+
size: z21.number(),
|
|
7398
7434
|
// Total size in bytes
|
|
7399
|
-
file_count:
|
|
7435
|
+
file_count: z21.number(),
|
|
7400
7436
|
created_at: timestampSchema,
|
|
7401
7437
|
updated_at: timestampSchema
|
|
7402
7438
|
});
|
|
7403
|
-
var artifactVersionSchema =
|
|
7404
|
-
id:
|
|
7439
|
+
var artifactVersionSchema = z21.object({
|
|
7440
|
+
id: z21.string(),
|
|
7405
7441
|
// SHA-256 content hash
|
|
7406
|
-
artifact_id:
|
|
7407
|
-
size:
|
|
7442
|
+
artifact_id: z21.string(),
|
|
7443
|
+
size: z21.number(),
|
|
7408
7444
|
// Size in bytes
|
|
7409
|
-
file_count:
|
|
7410
|
-
message:
|
|
7445
|
+
file_count: z21.number(),
|
|
7446
|
+
message: z21.string().nullable(),
|
|
7411
7447
|
// Optional commit message
|
|
7412
|
-
created_by:
|
|
7448
|
+
created_by: z21.string(),
|
|
7413
7449
|
created_at: timestampSchema
|
|
7414
7450
|
});
|
|
7415
7451
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -7419,7 +7455,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
7419
7455
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
7420
7456
|
artifactVersionSchema
|
|
7421
7457
|
);
|
|
7422
|
-
var publicArtifactsListContract =
|
|
7458
|
+
var publicArtifactsListContract = c16.router({
|
|
7423
7459
|
list: {
|
|
7424
7460
|
method: "GET",
|
|
7425
7461
|
path: "/v1/artifacts",
|
|
@@ -7433,12 +7469,12 @@ var publicArtifactsListContract = c15.router({
|
|
|
7433
7469
|
description: "List all artifacts in the current scope with pagination"
|
|
7434
7470
|
}
|
|
7435
7471
|
});
|
|
7436
|
-
var publicArtifactByIdContract =
|
|
7472
|
+
var publicArtifactByIdContract = c16.router({
|
|
7437
7473
|
get: {
|
|
7438
7474
|
method: "GET",
|
|
7439
7475
|
path: "/v1/artifacts/:id",
|
|
7440
|
-
pathParams:
|
|
7441
|
-
id:
|
|
7476
|
+
pathParams: z21.object({
|
|
7477
|
+
id: z21.string().min(1, "Artifact ID is required")
|
|
7442
7478
|
}),
|
|
7443
7479
|
responses: {
|
|
7444
7480
|
200: publicArtifactDetailSchema,
|
|
@@ -7450,12 +7486,12 @@ var publicArtifactByIdContract = c15.router({
|
|
|
7450
7486
|
description: "Get artifact details by ID"
|
|
7451
7487
|
}
|
|
7452
7488
|
});
|
|
7453
|
-
var publicArtifactVersionsContract =
|
|
7489
|
+
var publicArtifactVersionsContract = c16.router({
|
|
7454
7490
|
list: {
|
|
7455
7491
|
method: "GET",
|
|
7456
7492
|
path: "/v1/artifacts/:id/versions",
|
|
7457
|
-
pathParams:
|
|
7458
|
-
id:
|
|
7493
|
+
pathParams: z21.object({
|
|
7494
|
+
id: z21.string().min(1, "Artifact ID is required")
|
|
7459
7495
|
}),
|
|
7460
7496
|
query: listQuerySchema,
|
|
7461
7497
|
responses: {
|
|
@@ -7468,19 +7504,19 @@ var publicArtifactVersionsContract = c15.router({
|
|
|
7468
7504
|
description: "List all versions of an artifact with pagination"
|
|
7469
7505
|
}
|
|
7470
7506
|
});
|
|
7471
|
-
var publicArtifactDownloadContract =
|
|
7507
|
+
var publicArtifactDownloadContract = c16.router({
|
|
7472
7508
|
download: {
|
|
7473
7509
|
method: "GET",
|
|
7474
7510
|
path: "/v1/artifacts/:id/download",
|
|
7475
|
-
pathParams:
|
|
7476
|
-
id:
|
|
7511
|
+
pathParams: z21.object({
|
|
7512
|
+
id: z21.string().min(1, "Artifact ID is required")
|
|
7477
7513
|
}),
|
|
7478
|
-
query:
|
|
7479
|
-
version_id:
|
|
7514
|
+
query: z21.object({
|
|
7515
|
+
version_id: z21.string().optional()
|
|
7480
7516
|
// Defaults to current version
|
|
7481
7517
|
}),
|
|
7482
7518
|
responses: {
|
|
7483
|
-
302:
|
|
7519
|
+
302: z21.undefined(),
|
|
7484
7520
|
// Redirect to presigned URL
|
|
7485
7521
|
401: publicApiErrorSchema,
|
|
7486
7522
|
404: publicApiErrorSchema,
|
|
@@ -7492,28 +7528,28 @@ var publicArtifactDownloadContract = c15.router({
|
|
|
7492
7528
|
});
|
|
7493
7529
|
|
|
7494
7530
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
7495
|
-
import { z as
|
|
7496
|
-
var
|
|
7497
|
-
var publicVolumeSchema =
|
|
7498
|
-
id:
|
|
7499
|
-
name:
|
|
7500
|
-
current_version_id:
|
|
7501
|
-
size:
|
|
7531
|
+
import { z as z22 } from "zod";
|
|
7532
|
+
var c17 = initContract();
|
|
7533
|
+
var publicVolumeSchema = z22.object({
|
|
7534
|
+
id: z22.string(),
|
|
7535
|
+
name: z22.string(),
|
|
7536
|
+
current_version_id: z22.string().nullable(),
|
|
7537
|
+
size: z22.number(),
|
|
7502
7538
|
// Total size in bytes
|
|
7503
|
-
file_count:
|
|
7539
|
+
file_count: z22.number(),
|
|
7504
7540
|
created_at: timestampSchema,
|
|
7505
7541
|
updated_at: timestampSchema
|
|
7506
7542
|
});
|
|
7507
|
-
var volumeVersionSchema =
|
|
7508
|
-
id:
|
|
7543
|
+
var volumeVersionSchema = z22.object({
|
|
7544
|
+
id: z22.string(),
|
|
7509
7545
|
// SHA-256 content hash
|
|
7510
|
-
volume_id:
|
|
7511
|
-
size:
|
|
7546
|
+
volume_id: z22.string(),
|
|
7547
|
+
size: z22.number(),
|
|
7512
7548
|
// Size in bytes
|
|
7513
|
-
file_count:
|
|
7514
|
-
message:
|
|
7549
|
+
file_count: z22.number(),
|
|
7550
|
+
message: z22.string().nullable(),
|
|
7515
7551
|
// Optional commit message
|
|
7516
|
-
created_by:
|
|
7552
|
+
created_by: z22.string(),
|
|
7517
7553
|
created_at: timestampSchema
|
|
7518
7554
|
});
|
|
7519
7555
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -7521,7 +7557,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
7521
7557
|
});
|
|
7522
7558
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
7523
7559
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
7524
|
-
var publicVolumesListContract =
|
|
7560
|
+
var publicVolumesListContract = c17.router({
|
|
7525
7561
|
list: {
|
|
7526
7562
|
method: "GET",
|
|
7527
7563
|
path: "/v1/volumes",
|
|
@@ -7535,12 +7571,12 @@ var publicVolumesListContract = c16.router({
|
|
|
7535
7571
|
description: "List all volumes in the current scope with pagination"
|
|
7536
7572
|
}
|
|
7537
7573
|
});
|
|
7538
|
-
var publicVolumeByIdContract =
|
|
7574
|
+
var publicVolumeByIdContract = c17.router({
|
|
7539
7575
|
get: {
|
|
7540
7576
|
method: "GET",
|
|
7541
7577
|
path: "/v1/volumes/:id",
|
|
7542
|
-
pathParams:
|
|
7543
|
-
id:
|
|
7578
|
+
pathParams: z22.object({
|
|
7579
|
+
id: z22.string().min(1, "Volume ID is required")
|
|
7544
7580
|
}),
|
|
7545
7581
|
responses: {
|
|
7546
7582
|
200: publicVolumeDetailSchema,
|
|
@@ -7552,12 +7588,12 @@ var publicVolumeByIdContract = c16.router({
|
|
|
7552
7588
|
description: "Get volume details by ID"
|
|
7553
7589
|
}
|
|
7554
7590
|
});
|
|
7555
|
-
var publicVolumeVersionsContract =
|
|
7591
|
+
var publicVolumeVersionsContract = c17.router({
|
|
7556
7592
|
list: {
|
|
7557
7593
|
method: "GET",
|
|
7558
7594
|
path: "/v1/volumes/:id/versions",
|
|
7559
|
-
pathParams:
|
|
7560
|
-
id:
|
|
7595
|
+
pathParams: z22.object({
|
|
7596
|
+
id: z22.string().min(1, "Volume ID is required")
|
|
7561
7597
|
}),
|
|
7562
7598
|
query: listQuerySchema,
|
|
7563
7599
|
responses: {
|
|
@@ -7570,19 +7606,19 @@ var publicVolumeVersionsContract = c16.router({
|
|
|
7570
7606
|
description: "List all versions of a volume with pagination"
|
|
7571
7607
|
}
|
|
7572
7608
|
});
|
|
7573
|
-
var publicVolumeDownloadContract =
|
|
7609
|
+
var publicVolumeDownloadContract = c17.router({
|
|
7574
7610
|
download: {
|
|
7575
7611
|
method: "GET",
|
|
7576
7612
|
path: "/v1/volumes/:id/download",
|
|
7577
|
-
pathParams:
|
|
7578
|
-
id:
|
|
7613
|
+
pathParams: z22.object({
|
|
7614
|
+
id: z22.string().min(1, "Volume ID is required")
|
|
7579
7615
|
}),
|
|
7580
|
-
query:
|
|
7581
|
-
version_id:
|
|
7616
|
+
query: z22.object({
|
|
7617
|
+
version_id: z22.string().optional()
|
|
7582
7618
|
// Defaults to current version
|
|
7583
7619
|
}),
|
|
7584
7620
|
responses: {
|
|
7585
|
-
302:
|
|
7621
|
+
302: z22.undefined(),
|
|
7586
7622
|
// Redirect to presigned URL
|
|
7587
7623
|
401: publicApiErrorSchema,
|
|
7588
7624
|
404: publicApiErrorSchema,
|
|
@@ -8216,10 +8252,8 @@ addons = [tls_clienthello, request, response]
|
|
|
8216
8252
|
`;
|
|
8217
8253
|
|
|
8218
8254
|
// src/lib/proxy/proxy-manager.ts
|
|
8219
|
-
var
|
|
8255
|
+
var DEFAULT_PROXY_OPTIONS = {
|
|
8220
8256
|
port: 8080,
|
|
8221
|
-
caDir: "/opt/vm0-runner/proxy",
|
|
8222
|
-
addonPath: "/opt/vm0-runner/proxy/mitm_addon.py",
|
|
8223
8257
|
registryPath: DEFAULT_REGISTRY_PATH,
|
|
8224
8258
|
apiUrl: process.env.VM0_API_URL || "https://www.vm0.ai"
|
|
8225
8259
|
};
|
|
@@ -8227,8 +8261,13 @@ var ProxyManager = class {
|
|
|
8227
8261
|
config;
|
|
8228
8262
|
process = null;
|
|
8229
8263
|
isRunning = false;
|
|
8230
|
-
constructor(config
|
|
8231
|
-
|
|
8264
|
+
constructor(config) {
|
|
8265
|
+
const addonPath = path4.join(config.caDir, "mitm_addon.py");
|
|
8266
|
+
this.config = {
|
|
8267
|
+
...DEFAULT_PROXY_OPTIONS,
|
|
8268
|
+
...config,
|
|
8269
|
+
addonPath
|
|
8270
|
+
};
|
|
8232
8271
|
}
|
|
8233
8272
|
/**
|
|
8234
8273
|
* Check if mitmproxy is available
|
|
@@ -8399,7 +8438,9 @@ var ProxyManager = class {
|
|
|
8399
8438
|
var globalProxyManager = null;
|
|
8400
8439
|
function getProxyManager() {
|
|
8401
8440
|
if (!globalProxyManager) {
|
|
8402
|
-
|
|
8441
|
+
throw new Error(
|
|
8442
|
+
"ProxyManager not initialized. Call initProxyManager() first with caDir."
|
|
8443
|
+
);
|
|
8403
8444
|
}
|
|
8404
8445
|
return globalProxyManager;
|
|
8405
8446
|
}
|
|
@@ -8612,7 +8653,6 @@ async function withSandboxTiming(actionType, fn) {
|
|
|
8612
8653
|
|
|
8613
8654
|
// src/lib/executor-env.ts
|
|
8614
8655
|
var ENV_JSON_PATH = "/tmp/vm0-env.json";
|
|
8615
|
-
var PROXY_CA_CERT_PATH = "/opt/vm0-runner/proxy/mitmproxy-ca-cert.pem";
|
|
8616
8656
|
function buildEnvironmentVariables(context, apiUrl) {
|
|
8617
8657
|
const envVars = {
|
|
8618
8658
|
VM0_API_URL: apiUrl,
|
|
@@ -8786,13 +8826,13 @@ async function restoreSessionHistory(ssh, resumeSession, workingDir, cliAgentTyp
|
|
|
8786
8826
|
`[Executor] Session history restored (${sessionHistory.split("\n").length} lines)`
|
|
8787
8827
|
);
|
|
8788
8828
|
}
|
|
8789
|
-
async function installProxyCA(ssh) {
|
|
8790
|
-
if (!fs8.existsSync(
|
|
8829
|
+
async function installProxyCA(ssh, caCertPath) {
|
|
8830
|
+
if (!fs8.existsSync(caCertPath)) {
|
|
8791
8831
|
throw new Error(
|
|
8792
|
-
`Proxy CA certificate not found at ${
|
|
8832
|
+
`Proxy CA certificate not found at ${caCertPath}. Run generate-proxy-ca.sh first.`
|
|
8793
8833
|
);
|
|
8794
8834
|
}
|
|
8795
|
-
const caCert = fs8.readFileSync(
|
|
8835
|
+
const caCert = fs8.readFileSync(caCertPath, "utf-8");
|
|
8796
8836
|
console.log(
|
|
8797
8837
|
`[Executor] Installing proxy CA certificate (${caCert.length} bytes)`
|
|
8798
8838
|
);
|
|
@@ -8913,7 +8953,11 @@ async function executeJob(context, config, options = {}) {
|
|
|
8913
8953
|
sealSecretsEnabled
|
|
8914
8954
|
});
|
|
8915
8955
|
if (mitmEnabled) {
|
|
8916
|
-
|
|
8956
|
+
const caCertPath = path5.join(
|
|
8957
|
+
config.proxy.ca_dir,
|
|
8958
|
+
"mitmproxy-ca-cert.pem"
|
|
8959
|
+
);
|
|
8960
|
+
await installProxyCA(ssh, caCertPath);
|
|
8917
8961
|
}
|
|
8918
8962
|
}
|
|
8919
8963
|
log(`[Executor] Configuring DNS...`);
|
|
@@ -9179,7 +9223,8 @@ var startCommand = new Command("start").description("Start the runner").option("
|
|
|
9179
9223
|
initVMRegistry();
|
|
9180
9224
|
const proxyManager = initProxyManager({
|
|
9181
9225
|
apiUrl: config.server.url,
|
|
9182
|
-
port: config.proxy.port
|
|
9226
|
+
port: config.proxy.port,
|
|
9227
|
+
caDir: config.proxy.ca_dir
|
|
9183
9228
|
});
|
|
9184
9229
|
let proxyEnabled = false;
|
|
9185
9230
|
try {
|
|
@@ -9904,7 +9949,7 @@ var benchmarkCommand = new Command4("benchmark").description(
|
|
|
9904
9949
|
});
|
|
9905
9950
|
|
|
9906
9951
|
// src/index.ts
|
|
9907
|
-
var version = true ? "2.13.
|
|
9952
|
+
var version = true ? "2.13.2" : "0.1.0";
|
|
9908
9953
|
program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
|
|
9909
9954
|
program.addCommand(startCommand);
|
|
9910
9955
|
program.addCommand(doctorCommand);
|