@vm0/cli 6.4.1 → 7.0.1
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 +913 -906
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -247,58 +247,63 @@ function groupVariablesBySource(refs) {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
// ../../packages/core/src/contracts/base.ts
|
|
250
|
+
import { z } from "zod";
|
|
250
251
|
import { initContract } from "@ts-rest/core";
|
|
252
|
+
var authHeadersSchema = z.object({
|
|
253
|
+
authorization: z.string().optional()
|
|
254
|
+
});
|
|
251
255
|
|
|
252
256
|
// ../../packages/core/src/contracts/errors.ts
|
|
253
|
-
import { z } from "zod";
|
|
254
|
-
var apiErrorSchema =
|
|
255
|
-
error:
|
|
256
|
-
message:
|
|
257
|
-
code:
|
|
257
|
+
import { z as z2 } from "zod";
|
|
258
|
+
var apiErrorSchema = z2.object({
|
|
259
|
+
error: z2.object({
|
|
260
|
+
message: z2.string(),
|
|
261
|
+
code: z2.string()
|
|
258
262
|
})
|
|
259
263
|
});
|
|
260
264
|
|
|
261
265
|
// ../../packages/core/src/contracts/composes.ts
|
|
262
|
-
import { z as
|
|
266
|
+
import { z as z4 } from "zod";
|
|
263
267
|
|
|
264
268
|
// ../../packages/core/src/contracts/runners.ts
|
|
265
|
-
import { z as
|
|
269
|
+
import { z as z3 } from "zod";
|
|
266
270
|
var c = initContract();
|
|
267
|
-
var firewallRuleSchema =
|
|
268
|
-
domain:
|
|
269
|
-
ip:
|
|
271
|
+
var firewallRuleSchema = z3.object({
|
|
272
|
+
domain: z3.string().optional(),
|
|
273
|
+
ip: z3.string().optional(),
|
|
270
274
|
/** Terminal rule - value is the action (ALLOW or DENY) */
|
|
271
|
-
final:
|
|
275
|
+
final: z3.enum(["ALLOW", "DENY"]).optional(),
|
|
272
276
|
/** Action for domain/ip rules */
|
|
273
|
-
action:
|
|
277
|
+
action: z3.enum(["ALLOW", "DENY"]).optional()
|
|
274
278
|
});
|
|
275
|
-
var experimentalFirewallSchema =
|
|
276
|
-
enabled:
|
|
277
|
-
rules:
|
|
278
|
-
experimental_mitm:
|
|
279
|
-
experimental_seal_secrets:
|
|
279
|
+
var experimentalFirewallSchema = z3.object({
|
|
280
|
+
enabled: z3.boolean(),
|
|
281
|
+
rules: z3.array(firewallRuleSchema).optional(),
|
|
282
|
+
experimental_mitm: z3.boolean().optional(),
|
|
283
|
+
experimental_seal_secrets: z3.boolean().optional()
|
|
280
284
|
});
|
|
281
|
-
var runnerGroupSchema =
|
|
285
|
+
var runnerGroupSchema = z3.string().regex(
|
|
282
286
|
/^[a-z0-9-]+\/[a-z0-9-]+$/,
|
|
283
287
|
"Runner group must be in scope/name format (e.g., acme/production)"
|
|
284
288
|
);
|
|
285
|
-
var jobSchema =
|
|
286
|
-
runId:
|
|
287
|
-
prompt:
|
|
288
|
-
agentComposeVersionId:
|
|
289
|
-
vars:
|
|
290
|
-
secretNames:
|
|
291
|
-
checkpointId:
|
|
289
|
+
var jobSchema = z3.object({
|
|
290
|
+
runId: z3.string().uuid(),
|
|
291
|
+
prompt: z3.string(),
|
|
292
|
+
agentComposeVersionId: z3.string(),
|
|
293
|
+
vars: z3.record(z3.string(), z3.string()).nullable(),
|
|
294
|
+
secretNames: z3.array(z3.string()).nullable(),
|
|
295
|
+
checkpointId: z3.string().uuid().nullable()
|
|
292
296
|
});
|
|
293
297
|
var runnersPollContract = c.router({
|
|
294
298
|
poll: {
|
|
295
299
|
method: "POST",
|
|
296
300
|
path: "/api/runners/poll",
|
|
297
|
-
|
|
301
|
+
headers: authHeadersSchema,
|
|
302
|
+
body: z3.object({
|
|
298
303
|
group: runnerGroupSchema
|
|
299
304
|
}),
|
|
300
305
|
responses: {
|
|
301
|
-
200:
|
|
306
|
+
200: z3.object({
|
|
302
307
|
job: jobSchema.nullable()
|
|
303
308
|
}),
|
|
304
309
|
400: apiErrorSchema,
|
|
@@ -308,64 +313,65 @@ var runnersPollContract = c.router({
|
|
|
308
313
|
summary: "Poll for pending jobs (long-polling with 30s timeout)"
|
|
309
314
|
}
|
|
310
315
|
});
|
|
311
|
-
var storageEntrySchema =
|
|
312
|
-
mountPath:
|
|
313
|
-
archiveUrl:
|
|
316
|
+
var storageEntrySchema = z3.object({
|
|
317
|
+
mountPath: z3.string(),
|
|
318
|
+
archiveUrl: z3.string().nullable()
|
|
314
319
|
});
|
|
315
|
-
var artifactEntrySchema =
|
|
316
|
-
mountPath:
|
|
317
|
-
archiveUrl:
|
|
318
|
-
vasStorageName:
|
|
319
|
-
vasVersionId:
|
|
320
|
+
var artifactEntrySchema = z3.object({
|
|
321
|
+
mountPath: z3.string(),
|
|
322
|
+
archiveUrl: z3.string().nullable(),
|
|
323
|
+
vasStorageName: z3.string(),
|
|
324
|
+
vasVersionId: z3.string()
|
|
320
325
|
});
|
|
321
|
-
var storageManifestSchema =
|
|
322
|
-
storages:
|
|
326
|
+
var storageManifestSchema = z3.object({
|
|
327
|
+
storages: z3.array(storageEntrySchema),
|
|
323
328
|
artifact: artifactEntrySchema.nullable()
|
|
324
329
|
});
|
|
325
|
-
var resumeSessionSchema =
|
|
326
|
-
sessionId:
|
|
327
|
-
sessionHistory:
|
|
330
|
+
var resumeSessionSchema = z3.object({
|
|
331
|
+
sessionId: z3.string(),
|
|
332
|
+
sessionHistory: z3.string()
|
|
328
333
|
});
|
|
329
|
-
var storedExecutionContextSchema =
|
|
330
|
-
workingDir:
|
|
334
|
+
var storedExecutionContextSchema = z3.object({
|
|
335
|
+
workingDir: z3.string(),
|
|
331
336
|
storageManifest: storageManifestSchema.nullable(),
|
|
332
|
-
environment:
|
|
337
|
+
environment: z3.record(z3.string(), z3.string()).nullable(),
|
|
333
338
|
resumeSession: resumeSessionSchema.nullable(),
|
|
334
|
-
encryptedSecrets:
|
|
339
|
+
encryptedSecrets: z3.string().nullable(),
|
|
335
340
|
// AES-256-GCM encrypted secrets
|
|
336
|
-
cliAgentType:
|
|
341
|
+
cliAgentType: z3.string(),
|
|
337
342
|
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
338
343
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
339
|
-
debugNoMockClaude:
|
|
340
|
-
});
|
|
341
|
-
var executionContextSchema =
|
|
342
|
-
runId:
|
|
343
|
-
prompt:
|
|
344
|
-
agentComposeVersionId:
|
|
345
|
-
vars:
|
|
346
|
-
secretNames:
|
|
347
|
-
checkpointId:
|
|
348
|
-
sandboxToken:
|
|
344
|
+
debugNoMockClaude: z3.boolean().optional()
|
|
345
|
+
});
|
|
346
|
+
var executionContextSchema = z3.object({
|
|
347
|
+
runId: z3.string().uuid(),
|
|
348
|
+
prompt: z3.string(),
|
|
349
|
+
agentComposeVersionId: z3.string(),
|
|
350
|
+
vars: z3.record(z3.string(), z3.string()).nullable(),
|
|
351
|
+
secretNames: z3.array(z3.string()).nullable(),
|
|
352
|
+
checkpointId: z3.string().uuid().nullable(),
|
|
353
|
+
sandboxToken: z3.string(),
|
|
349
354
|
// New fields for E2B parity:
|
|
350
|
-
workingDir:
|
|
355
|
+
workingDir: z3.string(),
|
|
351
356
|
storageManifest: storageManifestSchema.nullable(),
|
|
352
|
-
environment:
|
|
357
|
+
environment: z3.record(z3.string(), z3.string()).nullable(),
|
|
353
358
|
resumeSession: resumeSessionSchema.nullable(),
|
|
354
|
-
secretValues:
|
|
355
|
-
cliAgentType:
|
|
359
|
+
secretValues: z3.array(z3.string()).nullable(),
|
|
360
|
+
cliAgentType: z3.string(),
|
|
356
361
|
// Experimental firewall configuration
|
|
357
362
|
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
358
363
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
359
|
-
debugNoMockClaude:
|
|
364
|
+
debugNoMockClaude: z3.boolean().optional()
|
|
360
365
|
});
|
|
361
366
|
var runnersJobClaimContract = c.router({
|
|
362
367
|
claim: {
|
|
363
368
|
method: "POST",
|
|
364
369
|
path: "/api/runners/jobs/:id/claim",
|
|
365
|
-
|
|
366
|
-
|
|
370
|
+
headers: authHeadersSchema,
|
|
371
|
+
pathParams: z3.object({
|
|
372
|
+
id: z3.string().uuid()
|
|
367
373
|
}),
|
|
368
|
-
body:
|
|
374
|
+
body: z3.object({}),
|
|
369
375
|
responses: {
|
|
370
376
|
200: executionContextSchema,
|
|
371
377
|
400: apiErrorSchema,
|
|
@@ -383,85 +389,82 @@ var runnersJobClaimContract = c.router({
|
|
|
383
389
|
|
|
384
390
|
// ../../packages/core/src/contracts/composes.ts
|
|
385
391
|
var c2 = initContract();
|
|
386
|
-
var composeVersionQuerySchema =
|
|
392
|
+
var composeVersionQuerySchema = z4.preprocess(
|
|
387
393
|
(val) => val === void 0 || val === null ? void 0 : String(val),
|
|
388
|
-
|
|
394
|
+
z4.string().min(1, "Missing version query parameter").regex(
|
|
389
395
|
/^[a-f0-9]{8,64}$|^latest$/i,
|
|
390
396
|
"Version must be 8-64 hex characters or 'latest'"
|
|
391
397
|
)
|
|
392
398
|
);
|
|
393
|
-
var agentNameSchema =
|
|
399
|
+
var agentNameSchema = z4.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
394
400
|
/^[a-zA-Z0-9][a-zA-Z0-9-]{1,62}[a-zA-Z0-9]$/,
|
|
395
401
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
396
402
|
);
|
|
397
|
-
var volumeConfigSchema =
|
|
398
|
-
name:
|
|
399
|
-
version:
|
|
403
|
+
var volumeConfigSchema = z4.object({
|
|
404
|
+
name: z4.string().min(1, "Volume name is required"),
|
|
405
|
+
version: z4.string().min(1, "Volume version is required")
|
|
400
406
|
});
|
|
401
407
|
var SUPPORTED_APPS = ["github"];
|
|
402
408
|
var SUPPORTED_APP_TAGS = ["latest", "dev"];
|
|
403
409
|
var APP_NAME_REGEX = /^[a-z0-9-]+$/;
|
|
404
|
-
var appStringSchema =
|
|
410
|
+
var appStringSchema = z4.string().superRefine((val, ctx) => {
|
|
405
411
|
const [appName, tag] = val.split(":");
|
|
406
412
|
if (!appName || !APP_NAME_REGEX.test(appName)) {
|
|
407
413
|
ctx.addIssue({
|
|
408
|
-
code:
|
|
414
|
+
code: z4.ZodIssueCode.custom,
|
|
409
415
|
message: "App name must contain only lowercase letters, numbers, and hyphens"
|
|
410
416
|
});
|
|
411
417
|
return;
|
|
412
418
|
}
|
|
413
419
|
if (!SUPPORTED_APPS.includes(appName)) {
|
|
414
420
|
ctx.addIssue({
|
|
415
|
-
code:
|
|
421
|
+
code: z4.ZodIssueCode.custom,
|
|
416
422
|
message: `Invalid app: "${appName}". Supported apps: ${SUPPORTED_APPS.join(", ")}`
|
|
417
423
|
});
|
|
418
424
|
return;
|
|
419
425
|
}
|
|
420
426
|
if (tag !== void 0 && !SUPPORTED_APP_TAGS.includes(tag)) {
|
|
421
427
|
ctx.addIssue({
|
|
422
|
-
code:
|
|
428
|
+
code: z4.ZodIssueCode.custom,
|
|
423
429
|
message: `Invalid app tag: "${tag}". Supported tags: ${SUPPORTED_APP_TAGS.join(", ")}`
|
|
424
430
|
});
|
|
425
431
|
}
|
|
426
432
|
});
|
|
427
|
-
var
|
|
428
|
-
|
|
429
|
-
);
|
|
430
|
-
var agentDefinitionSchema = z3.object({
|
|
431
|
-
description: z3.string().optional(),
|
|
433
|
+
var agentDefinitionSchema = z4.object({
|
|
434
|
+
description: z4.string().optional(),
|
|
432
435
|
/**
|
|
433
436
|
* @deprecated Use `apps` field instead for pre-installed tools.
|
|
434
437
|
* This field will be removed in a future version.
|
|
435
438
|
*/
|
|
436
|
-
image:
|
|
437
|
-
framework:
|
|
439
|
+
image: z4.string().optional(),
|
|
440
|
+
framework: z4.string().min(1, "Framework is required"),
|
|
438
441
|
/**
|
|
439
442
|
* Array of pre-installed apps/tools for the agent environment.
|
|
440
443
|
* Format: "app" or "app:tag" (e.g., "github", "github:dev", "github:latest")
|
|
441
444
|
* Default tag is "latest" if not specified.
|
|
442
445
|
* Currently supported apps: "github" (includes GitHub CLI)
|
|
443
446
|
*/
|
|
444
|
-
apps:
|
|
445
|
-
volumes:
|
|
446
|
-
working_dir:
|
|
447
|
+
apps: z4.array(appStringSchema).optional(),
|
|
448
|
+
volumes: z4.array(z4.string()).optional(),
|
|
449
|
+
working_dir: z4.string().optional(),
|
|
447
450
|
// Optional when provider supports auto-config
|
|
448
|
-
environment:
|
|
451
|
+
environment: z4.record(z4.string(), z4.string()).optional(),
|
|
449
452
|
/**
|
|
450
453
|
* Path to instructions file (e.g., AGENTS.md).
|
|
451
454
|
* Auto-uploaded as volume and mounted at /home/user/.claude/CLAUDE.md
|
|
452
455
|
*/
|
|
453
|
-
instructions:
|
|
456
|
+
instructions: z4.string().min(1, "Instructions path cannot be empty").optional(),
|
|
454
457
|
/**
|
|
455
458
|
* Array of GitHub tree URLs for agent skills.
|
|
456
459
|
* Each skill is auto-downloaded and mounted at /home/user/.claude/skills/{skillName}/
|
|
457
460
|
*/
|
|
458
|
-
skills:
|
|
461
|
+
skills: z4.array(z4.string()).optional(),
|
|
459
462
|
/**
|
|
460
463
|
* Route this agent to a self-hosted runner instead of E2B.
|
|
461
464
|
* When specified, runs will be queued for the specified runner group.
|
|
462
465
|
*/
|
|
463
|
-
experimental_runner:
|
|
464
|
-
group:
|
|
466
|
+
experimental_runner: z4.object({
|
|
467
|
+
group: z4.string().regex(
|
|
465
468
|
/^[a-z0-9-]+\/[a-z0-9-]+$/,
|
|
466
469
|
"Runner group must be in scope/name format (e.g., acme/production)"
|
|
467
470
|
)
|
|
@@ -471,37 +474,27 @@ var agentDefinitionSchema = z3.object({
|
|
|
471
474
|
* Requires experimental_runner to be configured.
|
|
472
475
|
* When enabled, filters outbound traffic by domain/IP rules.
|
|
473
476
|
*/
|
|
474
|
-
experimental_firewall: experimentalFirewallSchema.optional()
|
|
475
|
-
/**
|
|
476
|
-
* Array of secret names to inject from the scope's secret store.
|
|
477
|
-
* Each entry must be a non-empty string.
|
|
478
|
-
*/
|
|
479
|
-
experimental_secrets: nonEmptyStringArraySchema.optional(),
|
|
480
|
-
/**
|
|
481
|
-
* Array of variable names to inject from the scope's variable store.
|
|
482
|
-
* Each entry must be a non-empty string.
|
|
483
|
-
*/
|
|
484
|
-
experimental_vars: nonEmptyStringArraySchema.optional()
|
|
477
|
+
experimental_firewall: experimentalFirewallSchema.optional()
|
|
485
478
|
});
|
|
486
|
-
var agentComposeContentSchema =
|
|
487
|
-
version:
|
|
488
|
-
agents:
|
|
489
|
-
volumes:
|
|
479
|
+
var agentComposeContentSchema = z4.object({
|
|
480
|
+
version: z4.string().min(1, "Version is required"),
|
|
481
|
+
agents: z4.record(z4.string(), agentDefinitionSchema),
|
|
482
|
+
volumes: z4.record(z4.string(), volumeConfigSchema).optional()
|
|
490
483
|
});
|
|
491
|
-
var composeResponseSchema =
|
|
492
|
-
id:
|
|
493
|
-
name:
|
|
494
|
-
headVersionId:
|
|
484
|
+
var composeResponseSchema = z4.object({
|
|
485
|
+
id: z4.string(),
|
|
486
|
+
name: z4.string(),
|
|
487
|
+
headVersionId: z4.string().nullable(),
|
|
495
488
|
content: agentComposeContentSchema.nullable(),
|
|
496
|
-
createdAt:
|
|
497
|
-
updatedAt:
|
|
489
|
+
createdAt: z4.string(),
|
|
490
|
+
updatedAt: z4.string()
|
|
498
491
|
});
|
|
499
|
-
var createComposeResponseSchema =
|
|
500
|
-
composeId:
|
|
501
|
-
name:
|
|
502
|
-
versionId:
|
|
503
|
-
action:
|
|
504
|
-
updatedAt:
|
|
492
|
+
var createComposeResponseSchema = z4.object({
|
|
493
|
+
composeId: z4.string(),
|
|
494
|
+
name: z4.string(),
|
|
495
|
+
versionId: z4.string(),
|
|
496
|
+
action: z4.enum(["created", "existing"]),
|
|
497
|
+
updatedAt: z4.string()
|
|
505
498
|
});
|
|
506
499
|
var composesMainContract = c2.router({
|
|
507
500
|
/**
|
|
@@ -512,9 +505,10 @@ var composesMainContract = c2.router({
|
|
|
512
505
|
getByName: {
|
|
513
506
|
method: "GET",
|
|
514
507
|
path: "/api/agent/composes",
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
508
|
+
headers: authHeadersSchema,
|
|
509
|
+
query: z4.object({
|
|
510
|
+
name: z4.string().min(1, "Missing name query parameter"),
|
|
511
|
+
scope: z4.string().optional()
|
|
518
512
|
}),
|
|
519
513
|
responses: {
|
|
520
514
|
200: composeResponseSchema,
|
|
@@ -533,7 +527,8 @@ var composesMainContract = c2.router({
|
|
|
533
527
|
create: {
|
|
534
528
|
method: "POST",
|
|
535
529
|
path: "/api/agent/composes",
|
|
536
|
-
|
|
530
|
+
headers: authHeadersSchema,
|
|
531
|
+
body: z4.object({
|
|
537
532
|
content: agentComposeContentSchema
|
|
538
533
|
}),
|
|
539
534
|
responses: {
|
|
@@ -553,8 +548,9 @@ var composesByIdContract = c2.router({
|
|
|
553
548
|
getById: {
|
|
554
549
|
method: "GET",
|
|
555
550
|
path: "/api/agent/composes/:id",
|
|
556
|
-
|
|
557
|
-
|
|
551
|
+
headers: authHeadersSchema,
|
|
552
|
+
pathParams: z4.object({
|
|
553
|
+
id: z4.string().min(1, "Compose ID is required")
|
|
558
554
|
}),
|
|
559
555
|
responses: {
|
|
560
556
|
200: composeResponseSchema,
|
|
@@ -572,14 +568,15 @@ var composesVersionsContract = c2.router({
|
|
|
572
568
|
resolveVersion: {
|
|
573
569
|
method: "GET",
|
|
574
570
|
path: "/api/agent/composes/versions",
|
|
575
|
-
|
|
576
|
-
|
|
571
|
+
headers: authHeadersSchema,
|
|
572
|
+
query: z4.object({
|
|
573
|
+
composeId: z4.string().min(1, "Missing composeId query parameter"),
|
|
577
574
|
version: composeVersionQuerySchema
|
|
578
575
|
}),
|
|
579
576
|
responses: {
|
|
580
|
-
200:
|
|
581
|
-
versionId:
|
|
582
|
-
tag:
|
|
577
|
+
200: z4.object({
|
|
578
|
+
versionId: z4.string(),
|
|
579
|
+
tag: z4.string().optional()
|
|
583
580
|
}),
|
|
584
581
|
400: apiErrorSchema,
|
|
585
582
|
401: apiErrorSchema,
|
|
@@ -588,10 +585,10 @@ var composesVersionsContract = c2.router({
|
|
|
588
585
|
summary: "Resolve version specifier to full version ID"
|
|
589
586
|
}
|
|
590
587
|
});
|
|
591
|
-
var composeListItemSchema =
|
|
592
|
-
name:
|
|
593
|
-
headVersionId:
|
|
594
|
-
updatedAt:
|
|
588
|
+
var composeListItemSchema = z4.object({
|
|
589
|
+
name: z4.string(),
|
|
590
|
+
headVersionId: z4.string().nullable(),
|
|
591
|
+
updatedAt: z4.string()
|
|
595
592
|
});
|
|
596
593
|
var composesListContract = c2.router({
|
|
597
594
|
/**
|
|
@@ -602,12 +599,13 @@ var composesListContract = c2.router({
|
|
|
602
599
|
list: {
|
|
603
600
|
method: "GET",
|
|
604
601
|
path: "/api/agent/composes/list",
|
|
605
|
-
|
|
606
|
-
|
|
602
|
+
headers: authHeadersSchema,
|
|
603
|
+
query: z4.object({
|
|
604
|
+
scope: z4.string().optional()
|
|
607
605
|
}),
|
|
608
606
|
responses: {
|
|
609
|
-
200:
|
|
610
|
-
composes:
|
|
607
|
+
200: z4.object({
|
|
608
|
+
composes: z4.array(composeListItemSchema)
|
|
611
609
|
}),
|
|
612
610
|
400: apiErrorSchema,
|
|
613
611
|
401: apiErrorSchema
|
|
@@ -617,85 +615,85 @@ var composesListContract = c2.router({
|
|
|
617
615
|
});
|
|
618
616
|
|
|
619
617
|
// ../../packages/core/src/contracts/runs.ts
|
|
620
|
-
import { z as
|
|
618
|
+
import { z as z5 } from "zod";
|
|
621
619
|
var c3 = initContract();
|
|
622
|
-
var runStatusSchema =
|
|
620
|
+
var runStatusSchema = z5.enum([
|
|
623
621
|
"pending",
|
|
624
622
|
"running",
|
|
625
623
|
"completed",
|
|
626
624
|
"failed",
|
|
627
625
|
"timeout"
|
|
628
626
|
]);
|
|
629
|
-
var unifiedRunRequestSchema =
|
|
627
|
+
var unifiedRunRequestSchema = z5.object({
|
|
630
628
|
// High-level shortcuts (mutually exclusive with each other)
|
|
631
|
-
checkpointId:
|
|
632
|
-
sessionId:
|
|
629
|
+
checkpointId: z5.string().optional(),
|
|
630
|
+
sessionId: z5.string().optional(),
|
|
633
631
|
// Base parameters (can be used directly or overridden after shortcut expansion)
|
|
634
|
-
agentComposeId:
|
|
635
|
-
agentComposeVersionId:
|
|
636
|
-
conversationId:
|
|
637
|
-
artifactName:
|
|
638
|
-
artifactVersion:
|
|
639
|
-
vars:
|
|
640
|
-
secrets:
|
|
641
|
-
volumeVersions:
|
|
632
|
+
agentComposeId: z5.string().optional(),
|
|
633
|
+
agentComposeVersionId: z5.string().optional(),
|
|
634
|
+
conversationId: z5.string().optional(),
|
|
635
|
+
artifactName: z5.string().optional(),
|
|
636
|
+
artifactVersion: z5.string().optional(),
|
|
637
|
+
vars: z5.record(z5.string(), z5.string()).optional(),
|
|
638
|
+
secrets: z5.record(z5.string(), z5.string()).optional(),
|
|
639
|
+
volumeVersions: z5.record(z5.string(), z5.string()).optional(),
|
|
642
640
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
643
|
-
debugNoMockClaude:
|
|
641
|
+
debugNoMockClaude: z5.boolean().optional(),
|
|
644
642
|
// Model provider for automatic credential injection
|
|
645
|
-
modelProvider:
|
|
643
|
+
modelProvider: z5.string().optional(),
|
|
646
644
|
// Required
|
|
647
|
-
prompt:
|
|
645
|
+
prompt: z5.string().min(1, "Missing prompt")
|
|
648
646
|
});
|
|
649
|
-
var createRunResponseSchema =
|
|
650
|
-
runId:
|
|
647
|
+
var createRunResponseSchema = z5.object({
|
|
648
|
+
runId: z5.string(),
|
|
651
649
|
status: runStatusSchema,
|
|
652
|
-
sandboxId:
|
|
653
|
-
output:
|
|
654
|
-
error:
|
|
655
|
-
executionTimeMs:
|
|
656
|
-
createdAt:
|
|
657
|
-
});
|
|
658
|
-
var getRunResponseSchema =
|
|
659
|
-
runId:
|
|
660
|
-
agentComposeVersionId:
|
|
650
|
+
sandboxId: z5.string().optional(),
|
|
651
|
+
output: z5.string().optional(),
|
|
652
|
+
error: z5.string().optional(),
|
|
653
|
+
executionTimeMs: z5.number().optional(),
|
|
654
|
+
createdAt: z5.string()
|
|
655
|
+
});
|
|
656
|
+
var getRunResponseSchema = z5.object({
|
|
657
|
+
runId: z5.string(),
|
|
658
|
+
agentComposeVersionId: z5.string(),
|
|
661
659
|
status: runStatusSchema,
|
|
662
|
-
prompt:
|
|
663
|
-
vars:
|
|
664
|
-
sandboxId:
|
|
665
|
-
result:
|
|
666
|
-
output:
|
|
667
|
-
executionTimeMs:
|
|
660
|
+
prompt: z5.string(),
|
|
661
|
+
vars: z5.record(z5.string(), z5.string()).optional(),
|
|
662
|
+
sandboxId: z5.string().optional(),
|
|
663
|
+
result: z5.object({
|
|
664
|
+
output: z5.string(),
|
|
665
|
+
executionTimeMs: z5.number()
|
|
668
666
|
}).optional(),
|
|
669
|
-
error:
|
|
670
|
-
createdAt:
|
|
671
|
-
startedAt:
|
|
672
|
-
completedAt:
|
|
673
|
-
});
|
|
674
|
-
var runEventSchema =
|
|
675
|
-
sequenceNumber:
|
|
676
|
-
eventType:
|
|
677
|
-
eventData:
|
|
678
|
-
createdAt:
|
|
679
|
-
});
|
|
680
|
-
var runResultSchema =
|
|
681
|
-
checkpointId:
|
|
682
|
-
agentSessionId:
|
|
683
|
-
conversationId:
|
|
684
|
-
artifact:
|
|
667
|
+
error: z5.string().optional(),
|
|
668
|
+
createdAt: z5.string(),
|
|
669
|
+
startedAt: z5.string().optional(),
|
|
670
|
+
completedAt: z5.string().optional()
|
|
671
|
+
});
|
|
672
|
+
var runEventSchema = z5.object({
|
|
673
|
+
sequenceNumber: z5.number(),
|
|
674
|
+
eventType: z5.string(),
|
|
675
|
+
eventData: z5.unknown(),
|
|
676
|
+
createdAt: z5.string()
|
|
677
|
+
});
|
|
678
|
+
var runResultSchema = z5.object({
|
|
679
|
+
checkpointId: z5.string(),
|
|
680
|
+
agentSessionId: z5.string(),
|
|
681
|
+
conversationId: z5.string(),
|
|
682
|
+
artifact: z5.record(z5.string(), z5.string()).optional(),
|
|
685
683
|
// optional when run has no artifact
|
|
686
|
-
volumes:
|
|
684
|
+
volumes: z5.record(z5.string(), z5.string()).optional()
|
|
687
685
|
});
|
|
688
|
-
var runStateSchema =
|
|
686
|
+
var runStateSchema = z5.object({
|
|
689
687
|
status: runStatusSchema,
|
|
690
688
|
result: runResultSchema.optional(),
|
|
691
|
-
error:
|
|
689
|
+
error: z5.string().optional()
|
|
692
690
|
});
|
|
693
|
-
var eventsResponseSchema =
|
|
694
|
-
events:
|
|
695
|
-
hasMore:
|
|
696
|
-
nextSequence:
|
|
691
|
+
var eventsResponseSchema = z5.object({
|
|
692
|
+
events: z5.array(runEventSchema),
|
|
693
|
+
hasMore: z5.boolean(),
|
|
694
|
+
nextSequence: z5.number(),
|
|
697
695
|
run: runStateSchema,
|
|
698
|
-
framework:
|
|
696
|
+
framework: z5.string()
|
|
699
697
|
});
|
|
700
698
|
var runsMainContract = c3.router({
|
|
701
699
|
/**
|
|
@@ -705,6 +703,7 @@ var runsMainContract = c3.router({
|
|
|
705
703
|
create: {
|
|
706
704
|
method: "POST",
|
|
707
705
|
path: "/api/agent/runs",
|
|
706
|
+
headers: authHeadersSchema,
|
|
708
707
|
body: unifiedRunRequestSchema,
|
|
709
708
|
responses: {
|
|
710
709
|
201: createRunResponseSchema,
|
|
@@ -723,8 +722,9 @@ var runsByIdContract = c3.router({
|
|
|
723
722
|
getById: {
|
|
724
723
|
method: "GET",
|
|
725
724
|
path: "/api/agent/runs/:id",
|
|
726
|
-
|
|
727
|
-
|
|
725
|
+
headers: authHeadersSchema,
|
|
726
|
+
pathParams: z5.object({
|
|
727
|
+
id: z5.string().min(1, "Run ID is required")
|
|
728
728
|
}),
|
|
729
729
|
responses: {
|
|
730
730
|
200: getRunResponseSchema,
|
|
@@ -743,12 +743,13 @@ var runEventsContract = c3.router({
|
|
|
743
743
|
getEvents: {
|
|
744
744
|
method: "GET",
|
|
745
745
|
path: "/api/agent/runs/:id/events",
|
|
746
|
-
|
|
747
|
-
|
|
746
|
+
headers: authHeadersSchema,
|
|
747
|
+
pathParams: z5.object({
|
|
748
|
+
id: z5.string().min(1, "Run ID is required")
|
|
748
749
|
}),
|
|
749
|
-
query:
|
|
750
|
-
since:
|
|
751
|
-
limit:
|
|
750
|
+
query: z5.object({
|
|
751
|
+
since: z5.coerce.number().default(-1),
|
|
752
|
+
limit: z5.coerce.number().default(100)
|
|
752
753
|
}),
|
|
753
754
|
responses: {
|
|
754
755
|
200: eventsResponseSchema,
|
|
@@ -758,50 +759,50 @@ var runEventsContract = c3.router({
|
|
|
758
759
|
summary: "Get agent run events"
|
|
759
760
|
}
|
|
760
761
|
});
|
|
761
|
-
var telemetryMetricSchema =
|
|
762
|
-
ts:
|
|
763
|
-
cpu:
|
|
764
|
-
mem_used:
|
|
765
|
-
mem_total:
|
|
766
|
-
disk_used:
|
|
767
|
-
disk_total:
|
|
762
|
+
var telemetryMetricSchema = z5.object({
|
|
763
|
+
ts: z5.string(),
|
|
764
|
+
cpu: z5.number(),
|
|
765
|
+
mem_used: z5.number(),
|
|
766
|
+
mem_total: z5.number(),
|
|
767
|
+
disk_used: z5.number(),
|
|
768
|
+
disk_total: z5.number()
|
|
768
769
|
});
|
|
769
|
-
var systemLogResponseSchema =
|
|
770
|
-
systemLog:
|
|
771
|
-
hasMore:
|
|
770
|
+
var systemLogResponseSchema = z5.object({
|
|
771
|
+
systemLog: z5.string(),
|
|
772
|
+
hasMore: z5.boolean()
|
|
772
773
|
});
|
|
773
|
-
var metricsResponseSchema =
|
|
774
|
-
metrics:
|
|
775
|
-
hasMore:
|
|
774
|
+
var metricsResponseSchema = z5.object({
|
|
775
|
+
metrics: z5.array(telemetryMetricSchema),
|
|
776
|
+
hasMore: z5.boolean()
|
|
776
777
|
});
|
|
777
|
-
var agentEventsResponseSchema =
|
|
778
|
-
events:
|
|
779
|
-
hasMore:
|
|
780
|
-
framework:
|
|
778
|
+
var agentEventsResponseSchema = z5.object({
|
|
779
|
+
events: z5.array(runEventSchema),
|
|
780
|
+
hasMore: z5.boolean(),
|
|
781
|
+
framework: z5.string()
|
|
781
782
|
});
|
|
782
|
-
var networkLogEntrySchema =
|
|
783
|
-
timestamp:
|
|
783
|
+
var networkLogEntrySchema = z5.object({
|
|
784
|
+
timestamp: z5.string(),
|
|
784
785
|
// Common fields (all modes)
|
|
785
|
-
mode:
|
|
786
|
-
action:
|
|
787
|
-
host:
|
|
788
|
-
port:
|
|
789
|
-
rule_matched:
|
|
786
|
+
mode: z5.enum(["mitm", "sni"]).optional(),
|
|
787
|
+
action: z5.enum(["ALLOW", "DENY"]).optional(),
|
|
788
|
+
host: z5.string().optional(),
|
|
789
|
+
port: z5.number().optional(),
|
|
790
|
+
rule_matched: z5.string().nullable().optional(),
|
|
790
791
|
// MITM-only fields (optional)
|
|
791
|
-
method:
|
|
792
|
-
url:
|
|
793
|
-
status:
|
|
794
|
-
latency_ms:
|
|
795
|
-
request_size:
|
|
796
|
-
response_size:
|
|
792
|
+
method: z5.string().optional(),
|
|
793
|
+
url: z5.string().optional(),
|
|
794
|
+
status: z5.number().optional(),
|
|
795
|
+
latency_ms: z5.number().optional(),
|
|
796
|
+
request_size: z5.number().optional(),
|
|
797
|
+
response_size: z5.number().optional()
|
|
797
798
|
});
|
|
798
|
-
var networkLogsResponseSchema =
|
|
799
|
-
networkLogs:
|
|
800
|
-
hasMore:
|
|
799
|
+
var networkLogsResponseSchema = z5.object({
|
|
800
|
+
networkLogs: z5.array(networkLogEntrySchema),
|
|
801
|
+
hasMore: z5.boolean()
|
|
801
802
|
});
|
|
802
|
-
var telemetryResponseSchema =
|
|
803
|
-
systemLog:
|
|
804
|
-
metrics:
|
|
803
|
+
var telemetryResponseSchema = z5.object({
|
|
804
|
+
systemLog: z5.string(),
|
|
805
|
+
metrics: z5.array(telemetryMetricSchema)
|
|
805
806
|
});
|
|
806
807
|
var runTelemetryContract = c3.router({
|
|
807
808
|
/**
|
|
@@ -811,8 +812,9 @@ var runTelemetryContract = c3.router({
|
|
|
811
812
|
getTelemetry: {
|
|
812
813
|
method: "GET",
|
|
813
814
|
path: "/api/agent/runs/:id/telemetry",
|
|
814
|
-
|
|
815
|
-
|
|
815
|
+
headers: authHeadersSchema,
|
|
816
|
+
pathParams: z5.object({
|
|
817
|
+
id: z5.string().min(1, "Run ID is required")
|
|
816
818
|
}),
|
|
817
819
|
responses: {
|
|
818
820
|
200: telemetryResponseSchema,
|
|
@@ -830,13 +832,14 @@ var runSystemLogContract = c3.router({
|
|
|
830
832
|
getSystemLog: {
|
|
831
833
|
method: "GET",
|
|
832
834
|
path: "/api/agent/runs/:id/telemetry/system-log",
|
|
833
|
-
|
|
834
|
-
|
|
835
|
+
headers: authHeadersSchema,
|
|
836
|
+
pathParams: z5.object({
|
|
837
|
+
id: z5.string().min(1, "Run ID is required")
|
|
835
838
|
}),
|
|
836
|
-
query:
|
|
837
|
-
since:
|
|
838
|
-
limit:
|
|
839
|
-
order:
|
|
839
|
+
query: z5.object({
|
|
840
|
+
since: z5.coerce.number().optional(),
|
|
841
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
842
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
840
843
|
}),
|
|
841
844
|
responses: {
|
|
842
845
|
200: systemLogResponseSchema,
|
|
@@ -854,13 +857,14 @@ var runMetricsContract = c3.router({
|
|
|
854
857
|
getMetrics: {
|
|
855
858
|
method: "GET",
|
|
856
859
|
path: "/api/agent/runs/:id/telemetry/metrics",
|
|
857
|
-
|
|
858
|
-
|
|
860
|
+
headers: authHeadersSchema,
|
|
861
|
+
pathParams: z5.object({
|
|
862
|
+
id: z5.string().min(1, "Run ID is required")
|
|
859
863
|
}),
|
|
860
|
-
query:
|
|
861
|
-
since:
|
|
862
|
-
limit:
|
|
863
|
-
order:
|
|
864
|
+
query: z5.object({
|
|
865
|
+
since: z5.coerce.number().optional(),
|
|
866
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
867
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
864
868
|
}),
|
|
865
869
|
responses: {
|
|
866
870
|
200: metricsResponseSchema,
|
|
@@ -878,13 +882,14 @@ var runAgentEventsContract = c3.router({
|
|
|
878
882
|
getAgentEvents: {
|
|
879
883
|
method: "GET",
|
|
880
884
|
path: "/api/agent/runs/:id/telemetry/agent",
|
|
881
|
-
|
|
882
|
-
|
|
885
|
+
headers: authHeadersSchema,
|
|
886
|
+
pathParams: z5.object({
|
|
887
|
+
id: z5.string().min(1, "Run ID is required")
|
|
883
888
|
}),
|
|
884
|
-
query:
|
|
885
|
-
since:
|
|
886
|
-
limit:
|
|
887
|
-
order:
|
|
889
|
+
query: z5.object({
|
|
890
|
+
since: z5.coerce.number().optional(),
|
|
891
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
892
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
888
893
|
}),
|
|
889
894
|
responses: {
|
|
890
895
|
200: agentEventsResponseSchema,
|
|
@@ -902,13 +907,14 @@ var runNetworkLogsContract = c3.router({
|
|
|
902
907
|
getNetworkLogs: {
|
|
903
908
|
method: "GET",
|
|
904
909
|
path: "/api/agent/runs/:id/telemetry/network",
|
|
905
|
-
|
|
906
|
-
|
|
910
|
+
headers: authHeadersSchema,
|
|
911
|
+
pathParams: z5.object({
|
|
912
|
+
id: z5.string().min(1, "Run ID is required")
|
|
907
913
|
}),
|
|
908
|
-
query:
|
|
909
|
-
since:
|
|
910
|
-
limit:
|
|
911
|
-
order:
|
|
914
|
+
query: z5.object({
|
|
915
|
+
since: z5.coerce.number().optional(),
|
|
916
|
+
limit: z5.coerce.number().min(1).max(100).default(5),
|
|
917
|
+
order: z5.enum(["asc", "desc"]).default("desc")
|
|
912
918
|
}),
|
|
913
919
|
responses: {
|
|
914
920
|
200: networkLogsResponseSchema,
|
|
@@ -920,20 +926,20 @@ var runNetworkLogsContract = c3.router({
|
|
|
920
926
|
});
|
|
921
927
|
|
|
922
928
|
// ../../packages/core/src/contracts/storages.ts
|
|
923
|
-
import { z as
|
|
929
|
+
import { z as z6 } from "zod";
|
|
924
930
|
var c4 = initContract();
|
|
925
|
-
var storageTypeSchema =
|
|
926
|
-
var versionQuerySchema =
|
|
931
|
+
var storageTypeSchema = z6.enum(["volume", "artifact"]);
|
|
932
|
+
var versionQuerySchema = z6.preprocess(
|
|
927
933
|
(val) => val === void 0 || val === null ? void 0 : String(val),
|
|
928
|
-
|
|
934
|
+
z6.string().regex(/^[a-f0-9]{8,64}$/i, "Version must be 8-64 hex characters").optional()
|
|
929
935
|
);
|
|
930
|
-
var uploadStorageResponseSchema =
|
|
931
|
-
name:
|
|
932
|
-
versionId:
|
|
933
|
-
size:
|
|
934
|
-
fileCount:
|
|
936
|
+
var uploadStorageResponseSchema = z6.object({
|
|
937
|
+
name: z6.string(),
|
|
938
|
+
versionId: z6.string(),
|
|
939
|
+
size: z6.number(),
|
|
940
|
+
fileCount: z6.number(),
|
|
935
941
|
type: storageTypeSchema,
|
|
936
|
-
deduplicated:
|
|
942
|
+
deduplicated: z6.boolean()
|
|
937
943
|
});
|
|
938
944
|
var storagesContract = c4.router({
|
|
939
945
|
/**
|
|
@@ -950,6 +956,7 @@ var storagesContract = c4.router({
|
|
|
950
956
|
upload: {
|
|
951
957
|
method: "POST",
|
|
952
958
|
path: "/api/storages",
|
|
959
|
+
headers: authHeadersSchema,
|
|
953
960
|
contentType: "multipart/form-data",
|
|
954
961
|
body: c4.type(),
|
|
955
962
|
responses: {
|
|
@@ -973,8 +980,9 @@ var storagesContract = c4.router({
|
|
|
973
980
|
download: {
|
|
974
981
|
method: "GET",
|
|
975
982
|
path: "/api/storages",
|
|
976
|
-
|
|
977
|
-
|
|
983
|
+
headers: authHeadersSchema,
|
|
984
|
+
query: z6.object({
|
|
985
|
+
name: z6.string().min(1, "Storage name is required"),
|
|
978
986
|
version: versionQuerySchema
|
|
979
987
|
}),
|
|
980
988
|
responses: {
|
|
@@ -991,40 +999,41 @@ var storagesContract = c4.router({
|
|
|
991
999
|
summary: "Download storage archive"
|
|
992
1000
|
}
|
|
993
1001
|
});
|
|
994
|
-
var fileEntryWithHashSchema =
|
|
995
|
-
path:
|
|
996
|
-
hash:
|
|
997
|
-
size:
|
|
1002
|
+
var fileEntryWithHashSchema = z6.object({
|
|
1003
|
+
path: z6.string().min(1, "File path is required"),
|
|
1004
|
+
hash: z6.string().length(64, "Hash must be SHA-256 (64 hex chars)"),
|
|
1005
|
+
size: z6.number().int().min(0, "Size must be non-negative")
|
|
998
1006
|
});
|
|
999
|
-
var storageChangesSchema =
|
|
1000
|
-
added:
|
|
1001
|
-
modified:
|
|
1002
|
-
deleted:
|
|
1007
|
+
var storageChangesSchema = z6.object({
|
|
1008
|
+
added: z6.array(z6.string()),
|
|
1009
|
+
modified: z6.array(z6.string()),
|
|
1010
|
+
deleted: z6.array(z6.string())
|
|
1003
1011
|
});
|
|
1004
|
-
var presignedUploadSchema =
|
|
1005
|
-
key:
|
|
1006
|
-
presignedUrl:
|
|
1012
|
+
var presignedUploadSchema = z6.object({
|
|
1013
|
+
key: z6.string(),
|
|
1014
|
+
presignedUrl: z6.string().url()
|
|
1007
1015
|
});
|
|
1008
1016
|
var storagesPrepareContract = c4.router({
|
|
1009
1017
|
prepare: {
|
|
1010
1018
|
method: "POST",
|
|
1011
1019
|
path: "/api/storages/prepare",
|
|
1012
|
-
|
|
1013
|
-
|
|
1020
|
+
headers: authHeadersSchema,
|
|
1021
|
+
body: z6.object({
|
|
1022
|
+
storageName: z6.string().min(1, "Storage name is required"),
|
|
1014
1023
|
storageType: storageTypeSchema,
|
|
1015
|
-
files:
|
|
1016
|
-
force:
|
|
1017
|
-
runId:
|
|
1024
|
+
files: z6.array(fileEntryWithHashSchema),
|
|
1025
|
+
force: z6.boolean().optional(),
|
|
1026
|
+
runId: z6.string().optional(),
|
|
1018
1027
|
// For sandbox auth
|
|
1019
|
-
baseVersion:
|
|
1028
|
+
baseVersion: z6.string().optional(),
|
|
1020
1029
|
// For incremental uploads
|
|
1021
1030
|
changes: storageChangesSchema.optional()
|
|
1022
1031
|
}),
|
|
1023
1032
|
responses: {
|
|
1024
|
-
200:
|
|
1025
|
-
versionId:
|
|
1026
|
-
existing:
|
|
1027
|
-
uploads:
|
|
1033
|
+
200: z6.object({
|
|
1034
|
+
versionId: z6.string(),
|
|
1035
|
+
existing: z6.boolean(),
|
|
1036
|
+
uploads: z6.object({
|
|
1028
1037
|
archive: presignedUploadSchema,
|
|
1029
1038
|
manifest: presignedUploadSchema
|
|
1030
1039
|
}).optional()
|
|
@@ -1041,22 +1050,23 @@ var storagesCommitContract = c4.router({
|
|
|
1041
1050
|
commit: {
|
|
1042
1051
|
method: "POST",
|
|
1043
1052
|
path: "/api/storages/commit",
|
|
1044
|
-
|
|
1045
|
-
|
|
1053
|
+
headers: authHeadersSchema,
|
|
1054
|
+
body: z6.object({
|
|
1055
|
+
storageName: z6.string().min(1, "Storage name is required"),
|
|
1046
1056
|
storageType: storageTypeSchema,
|
|
1047
|
-
versionId:
|
|
1048
|
-
files:
|
|
1049
|
-
runId:
|
|
1050
|
-
message:
|
|
1057
|
+
versionId: z6.string().min(1, "Version ID is required"),
|
|
1058
|
+
files: z6.array(fileEntryWithHashSchema),
|
|
1059
|
+
runId: z6.string().optional(),
|
|
1060
|
+
message: z6.string().optional()
|
|
1051
1061
|
}),
|
|
1052
1062
|
responses: {
|
|
1053
|
-
200:
|
|
1054
|
-
success:
|
|
1055
|
-
versionId:
|
|
1056
|
-
storageName:
|
|
1057
|
-
size:
|
|
1058
|
-
fileCount:
|
|
1059
|
-
deduplicated:
|
|
1063
|
+
200: z6.object({
|
|
1064
|
+
success: z6.literal(true),
|
|
1065
|
+
versionId: z6.string(),
|
|
1066
|
+
storageName: z6.string(),
|
|
1067
|
+
size: z6.number(),
|
|
1068
|
+
fileCount: z6.number(),
|
|
1069
|
+
deduplicated: z6.boolean().optional()
|
|
1060
1070
|
}),
|
|
1061
1071
|
400: apiErrorSchema,
|
|
1062
1072
|
401: apiErrorSchema,
|
|
@@ -1072,26 +1082,27 @@ var storagesDownloadContract = c4.router({
|
|
|
1072
1082
|
download: {
|
|
1073
1083
|
method: "GET",
|
|
1074
1084
|
path: "/api/storages/download",
|
|
1075
|
-
|
|
1076
|
-
|
|
1085
|
+
headers: authHeadersSchema,
|
|
1086
|
+
query: z6.object({
|
|
1087
|
+
name: z6.string().min(1, "Storage name is required"),
|
|
1077
1088
|
type: storageTypeSchema,
|
|
1078
1089
|
version: versionQuerySchema
|
|
1079
1090
|
}),
|
|
1080
1091
|
responses: {
|
|
1081
1092
|
// Normal response with presigned URL
|
|
1082
|
-
200:
|
|
1083
|
-
|
|
1084
|
-
url:
|
|
1085
|
-
versionId:
|
|
1086
|
-
fileCount:
|
|
1087
|
-
size:
|
|
1093
|
+
200: z6.union([
|
|
1094
|
+
z6.object({
|
|
1095
|
+
url: z6.string().url(),
|
|
1096
|
+
versionId: z6.string(),
|
|
1097
|
+
fileCount: z6.number(),
|
|
1098
|
+
size: z6.number()
|
|
1088
1099
|
}),
|
|
1089
1100
|
// Empty artifact response
|
|
1090
|
-
|
|
1091
|
-
empty:
|
|
1092
|
-
versionId:
|
|
1093
|
-
fileCount:
|
|
1094
|
-
size:
|
|
1101
|
+
z6.object({
|
|
1102
|
+
empty: z6.literal(true),
|
|
1103
|
+
versionId: z6.string(),
|
|
1104
|
+
fileCount: z6.literal(0),
|
|
1105
|
+
size: z6.literal(0)
|
|
1095
1106
|
})
|
|
1096
1107
|
]),
|
|
1097
1108
|
400: apiErrorSchema,
|
|
@@ -1106,16 +1117,17 @@ var storagesListContract = c4.router({
|
|
|
1106
1117
|
list: {
|
|
1107
1118
|
method: "GET",
|
|
1108
1119
|
path: "/api/storages/list",
|
|
1109
|
-
|
|
1120
|
+
headers: authHeadersSchema,
|
|
1121
|
+
query: z6.object({
|
|
1110
1122
|
type: storageTypeSchema
|
|
1111
1123
|
}),
|
|
1112
1124
|
responses: {
|
|
1113
|
-
200:
|
|
1114
|
-
|
|
1115
|
-
name:
|
|
1116
|
-
size:
|
|
1117
|
-
fileCount:
|
|
1118
|
-
updatedAt:
|
|
1125
|
+
200: z6.array(
|
|
1126
|
+
z6.object({
|
|
1127
|
+
name: z6.string(),
|
|
1128
|
+
size: z6.number(),
|
|
1129
|
+
fileCount: z6.number(),
|
|
1130
|
+
updatedAt: z6.string()
|
|
1119
1131
|
})
|
|
1120
1132
|
),
|
|
1121
1133
|
401: apiErrorSchema,
|
|
@@ -1126,18 +1138,18 @@ var storagesListContract = c4.router({
|
|
|
1126
1138
|
});
|
|
1127
1139
|
|
|
1128
1140
|
// ../../packages/core/src/contracts/webhooks.ts
|
|
1129
|
-
import { z as
|
|
1141
|
+
import { z as z7 } from "zod";
|
|
1130
1142
|
var c5 = initContract();
|
|
1131
|
-
var agentEventSchema =
|
|
1132
|
-
type:
|
|
1133
|
-
sequenceNumber:
|
|
1143
|
+
var agentEventSchema = z7.object({
|
|
1144
|
+
type: z7.string(),
|
|
1145
|
+
sequenceNumber: z7.number().int().nonnegative()
|
|
1134
1146
|
}).passthrough();
|
|
1135
|
-
var artifactSnapshotSchema =
|
|
1136
|
-
artifactName:
|
|
1137
|
-
artifactVersion:
|
|
1147
|
+
var artifactSnapshotSchema = z7.object({
|
|
1148
|
+
artifactName: z7.string(),
|
|
1149
|
+
artifactVersion: z7.string()
|
|
1138
1150
|
});
|
|
1139
|
-
var volumeVersionsSnapshotSchema =
|
|
1140
|
-
versions:
|
|
1151
|
+
var volumeVersionsSnapshotSchema = z7.object({
|
|
1152
|
+
versions: z7.record(z7.string(), z7.string())
|
|
1141
1153
|
});
|
|
1142
1154
|
var webhookEventsContract = c5.router({
|
|
1143
1155
|
/**
|
|
@@ -1147,15 +1159,16 @@ var webhookEventsContract = c5.router({
|
|
|
1147
1159
|
send: {
|
|
1148
1160
|
method: "POST",
|
|
1149
1161
|
path: "/api/webhooks/agent/events",
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1162
|
+
headers: authHeadersSchema,
|
|
1163
|
+
body: z7.object({
|
|
1164
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1165
|
+
events: z7.array(agentEventSchema).min(1, "events array cannot be empty")
|
|
1153
1166
|
}),
|
|
1154
1167
|
responses: {
|
|
1155
|
-
200:
|
|
1156
|
-
received:
|
|
1157
|
-
firstSequence:
|
|
1158
|
-
lastSequence:
|
|
1168
|
+
200: z7.object({
|
|
1169
|
+
received: z7.number(),
|
|
1170
|
+
firstSequence: z7.number(),
|
|
1171
|
+
lastSequence: z7.number()
|
|
1159
1172
|
}),
|
|
1160
1173
|
400: apiErrorSchema,
|
|
1161
1174
|
401: apiErrorSchema,
|
|
@@ -1173,15 +1186,16 @@ var webhookCompleteContract = c5.router({
|
|
|
1173
1186
|
complete: {
|
|
1174
1187
|
method: "POST",
|
|
1175
1188
|
path: "/api/webhooks/agent/complete",
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1189
|
+
headers: authHeadersSchema,
|
|
1190
|
+
body: z7.object({
|
|
1191
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1192
|
+
exitCode: z7.number(),
|
|
1193
|
+
error: z7.string().optional()
|
|
1180
1194
|
}),
|
|
1181
1195
|
responses: {
|
|
1182
|
-
200:
|
|
1183
|
-
success:
|
|
1184
|
-
status:
|
|
1196
|
+
200: z7.object({
|
|
1197
|
+
success: z7.boolean(),
|
|
1198
|
+
status: z7.enum(["completed", "failed"])
|
|
1185
1199
|
}),
|
|
1186
1200
|
400: apiErrorSchema,
|
|
1187
1201
|
401: apiErrorSchema,
|
|
@@ -1199,21 +1213,22 @@ var webhookCheckpointsContract = c5.router({
|
|
|
1199
1213
|
create: {
|
|
1200
1214
|
method: "POST",
|
|
1201
1215
|
path: "/api/webhooks/agent/checkpoints",
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1216
|
+
headers: authHeadersSchema,
|
|
1217
|
+
body: z7.object({
|
|
1218
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1219
|
+
cliAgentType: z7.string().min(1, "cliAgentType is required"),
|
|
1220
|
+
cliAgentSessionId: z7.string().min(1, "cliAgentSessionId is required"),
|
|
1221
|
+
cliAgentSessionHistory: z7.string().min(1, "cliAgentSessionHistory is required"),
|
|
1207
1222
|
artifactSnapshot: artifactSnapshotSchema.optional(),
|
|
1208
1223
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema.optional()
|
|
1209
1224
|
}),
|
|
1210
1225
|
responses: {
|
|
1211
|
-
200:
|
|
1212
|
-
checkpointId:
|
|
1213
|
-
agentSessionId:
|
|
1214
|
-
conversationId:
|
|
1226
|
+
200: z7.object({
|
|
1227
|
+
checkpointId: z7.string(),
|
|
1228
|
+
agentSessionId: z7.string(),
|
|
1229
|
+
conversationId: z7.string(),
|
|
1215
1230
|
artifact: artifactSnapshotSchema.optional(),
|
|
1216
|
-
volumes:
|
|
1231
|
+
volumes: z7.record(z7.string(), z7.string()).optional()
|
|
1217
1232
|
}),
|
|
1218
1233
|
400: apiErrorSchema,
|
|
1219
1234
|
401: apiErrorSchema,
|
|
@@ -1231,12 +1246,13 @@ var webhookHeartbeatContract = c5.router({
|
|
|
1231
1246
|
send: {
|
|
1232
1247
|
method: "POST",
|
|
1233
1248
|
path: "/api/webhooks/agent/heartbeat",
|
|
1234
|
-
|
|
1235
|
-
|
|
1249
|
+
headers: authHeadersSchema,
|
|
1250
|
+
body: z7.object({
|
|
1251
|
+
runId: z7.string().min(1, "runId is required")
|
|
1236
1252
|
}),
|
|
1237
1253
|
responses: {
|
|
1238
|
-
200:
|
|
1239
|
-
ok:
|
|
1254
|
+
200: z7.object({
|
|
1255
|
+
ok: z7.boolean()
|
|
1240
1256
|
}),
|
|
1241
1257
|
400: apiErrorSchema,
|
|
1242
1258
|
401: apiErrorSchema,
|
|
@@ -1260,14 +1276,15 @@ var webhookStoragesContract = c5.router({
|
|
|
1260
1276
|
upload: {
|
|
1261
1277
|
method: "POST",
|
|
1262
1278
|
path: "/api/webhooks/agent/storages",
|
|
1279
|
+
headers: authHeadersSchema,
|
|
1263
1280
|
contentType: "multipart/form-data",
|
|
1264
1281
|
body: c5.type(),
|
|
1265
1282
|
responses: {
|
|
1266
|
-
200:
|
|
1267
|
-
versionId:
|
|
1268
|
-
storageName:
|
|
1269
|
-
size:
|
|
1270
|
-
fileCount:
|
|
1283
|
+
200: z7.object({
|
|
1284
|
+
versionId: z7.string(),
|
|
1285
|
+
storageName: z7.string(),
|
|
1286
|
+
size: z7.number(),
|
|
1287
|
+
fileCount: z7.number()
|
|
1271
1288
|
}),
|
|
1272
1289
|
400: apiErrorSchema,
|
|
1273
1290
|
401: apiErrorSchema,
|
|
@@ -1293,20 +1310,21 @@ var webhookStoragesIncrementalContract = c5.router({
|
|
|
1293
1310
|
upload: {
|
|
1294
1311
|
method: "POST",
|
|
1295
1312
|
path: "/api/webhooks/agent/storages/incremental",
|
|
1313
|
+
headers: authHeadersSchema,
|
|
1296
1314
|
contentType: "multipart/form-data",
|
|
1297
1315
|
body: c5.type(),
|
|
1298
1316
|
responses: {
|
|
1299
|
-
200:
|
|
1300
|
-
versionId:
|
|
1301
|
-
storageName:
|
|
1302
|
-
size:
|
|
1303
|
-
fileCount:
|
|
1304
|
-
incrementalStats:
|
|
1305
|
-
addedFiles:
|
|
1306
|
-
modifiedFiles:
|
|
1307
|
-
deletedFiles:
|
|
1308
|
-
unchangedFiles:
|
|
1309
|
-
bytesUploaded:
|
|
1317
|
+
200: z7.object({
|
|
1318
|
+
versionId: z7.string(),
|
|
1319
|
+
storageName: z7.string(),
|
|
1320
|
+
size: z7.number(),
|
|
1321
|
+
fileCount: z7.number(),
|
|
1322
|
+
incrementalStats: z7.object({
|
|
1323
|
+
addedFiles: z7.number(),
|
|
1324
|
+
modifiedFiles: z7.number(),
|
|
1325
|
+
deletedFiles: z7.number(),
|
|
1326
|
+
unchangedFiles: z7.number(),
|
|
1327
|
+
bytesUploaded: z7.number()
|
|
1310
1328
|
}).optional()
|
|
1311
1329
|
}),
|
|
1312
1330
|
400: apiErrorSchema,
|
|
@@ -1317,36 +1335,36 @@ var webhookStoragesIncrementalContract = c5.router({
|
|
|
1317
1335
|
summary: "Upload storage version incrementally from sandbox"
|
|
1318
1336
|
}
|
|
1319
1337
|
});
|
|
1320
|
-
var metricDataSchema =
|
|
1321
|
-
ts:
|
|
1322
|
-
cpu:
|
|
1323
|
-
mem_used:
|
|
1324
|
-
mem_total:
|
|
1325
|
-
disk_used:
|
|
1326
|
-
disk_total:
|
|
1338
|
+
var metricDataSchema = z7.object({
|
|
1339
|
+
ts: z7.string(),
|
|
1340
|
+
cpu: z7.number(),
|
|
1341
|
+
mem_used: z7.number(),
|
|
1342
|
+
mem_total: z7.number(),
|
|
1343
|
+
disk_used: z7.number(),
|
|
1344
|
+
disk_total: z7.number()
|
|
1327
1345
|
});
|
|
1328
|
-
var sandboxOperationSchema =
|
|
1329
|
-
ts:
|
|
1330
|
-
action_type:
|
|
1331
|
-
duration_ms:
|
|
1332
|
-
success:
|
|
1333
|
-
error:
|
|
1346
|
+
var sandboxOperationSchema = z7.object({
|
|
1347
|
+
ts: z7.string(),
|
|
1348
|
+
action_type: z7.string(),
|
|
1349
|
+
duration_ms: z7.number(),
|
|
1350
|
+
success: z7.boolean(),
|
|
1351
|
+
error: z7.string().optional()
|
|
1334
1352
|
});
|
|
1335
|
-
var networkLogSchema =
|
|
1336
|
-
timestamp:
|
|
1353
|
+
var networkLogSchema = z7.object({
|
|
1354
|
+
timestamp: z7.string(),
|
|
1337
1355
|
// Common fields (all modes)
|
|
1338
|
-
mode:
|
|
1339
|
-
action:
|
|
1340
|
-
host:
|
|
1341
|
-
port:
|
|
1342
|
-
rule_matched:
|
|
1356
|
+
mode: z7.enum(["mitm", "sni"]).optional(),
|
|
1357
|
+
action: z7.enum(["ALLOW", "DENY"]).optional(),
|
|
1358
|
+
host: z7.string().optional(),
|
|
1359
|
+
port: z7.number().optional(),
|
|
1360
|
+
rule_matched: z7.string().nullable().optional(),
|
|
1343
1361
|
// MITM-only fields (optional)
|
|
1344
|
-
method:
|
|
1345
|
-
url:
|
|
1346
|
-
status:
|
|
1347
|
-
latency_ms:
|
|
1348
|
-
request_size:
|
|
1349
|
-
response_size:
|
|
1362
|
+
method: z7.string().optional(),
|
|
1363
|
+
url: z7.string().optional(),
|
|
1364
|
+
status: z7.number().optional(),
|
|
1365
|
+
latency_ms: z7.number().optional(),
|
|
1366
|
+
request_size: z7.number().optional(),
|
|
1367
|
+
response_size: z7.number().optional()
|
|
1350
1368
|
});
|
|
1351
1369
|
var webhookTelemetryContract = c5.router({
|
|
1352
1370
|
/**
|
|
@@ -1356,17 +1374,18 @@ var webhookTelemetryContract = c5.router({
|
|
|
1356
1374
|
send: {
|
|
1357
1375
|
method: "POST",
|
|
1358
1376
|
path: "/api/webhooks/agent/telemetry",
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1377
|
+
headers: authHeadersSchema,
|
|
1378
|
+
body: z7.object({
|
|
1379
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1380
|
+
systemLog: z7.string().optional(),
|
|
1381
|
+
metrics: z7.array(metricDataSchema).optional(),
|
|
1382
|
+
networkLogs: z7.array(networkLogSchema).optional(),
|
|
1383
|
+
sandboxOperations: z7.array(sandboxOperationSchema).optional()
|
|
1365
1384
|
}),
|
|
1366
1385
|
responses: {
|
|
1367
|
-
200:
|
|
1368
|
-
success:
|
|
1369
|
-
id:
|
|
1386
|
+
200: z7.object({
|
|
1387
|
+
success: z7.boolean(),
|
|
1388
|
+
id: z7.string()
|
|
1370
1389
|
}),
|
|
1371
1390
|
400: apiErrorSchema,
|
|
1372
1391
|
401: apiErrorSchema,
|
|
@@ -1380,21 +1399,22 @@ var webhookStoragesPrepareContract = c5.router({
|
|
|
1380
1399
|
prepare: {
|
|
1381
1400
|
method: "POST",
|
|
1382
1401
|
path: "/api/webhooks/agent/storages/prepare",
|
|
1383
|
-
|
|
1384
|
-
|
|
1402
|
+
headers: authHeadersSchema,
|
|
1403
|
+
body: z7.object({
|
|
1404
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1385
1405
|
// Required for webhook auth
|
|
1386
|
-
storageName:
|
|
1406
|
+
storageName: z7.string().min(1, "Storage name is required"),
|
|
1387
1407
|
storageType: storageTypeSchema,
|
|
1388
|
-
files:
|
|
1389
|
-
force:
|
|
1390
|
-
baseVersion:
|
|
1408
|
+
files: z7.array(fileEntryWithHashSchema),
|
|
1409
|
+
force: z7.boolean().optional(),
|
|
1410
|
+
baseVersion: z7.string().optional(),
|
|
1391
1411
|
changes: storageChangesSchema.optional()
|
|
1392
1412
|
}),
|
|
1393
1413
|
responses: {
|
|
1394
|
-
200:
|
|
1395
|
-
versionId:
|
|
1396
|
-
existing:
|
|
1397
|
-
uploads:
|
|
1414
|
+
200: z7.object({
|
|
1415
|
+
versionId: z7.string(),
|
|
1416
|
+
existing: z7.boolean(),
|
|
1417
|
+
uploads: z7.object({
|
|
1398
1418
|
archive: presignedUploadSchema,
|
|
1399
1419
|
manifest: presignedUploadSchema
|
|
1400
1420
|
}).optional()
|
|
@@ -1411,23 +1431,24 @@ var webhookStoragesCommitContract = c5.router({
|
|
|
1411
1431
|
commit: {
|
|
1412
1432
|
method: "POST",
|
|
1413
1433
|
path: "/api/webhooks/agent/storages/commit",
|
|
1414
|
-
|
|
1415
|
-
|
|
1434
|
+
headers: authHeadersSchema,
|
|
1435
|
+
body: z7.object({
|
|
1436
|
+
runId: z7.string().min(1, "runId is required"),
|
|
1416
1437
|
// Required for webhook auth
|
|
1417
|
-
storageName:
|
|
1438
|
+
storageName: z7.string().min(1, "Storage name is required"),
|
|
1418
1439
|
storageType: storageTypeSchema,
|
|
1419
|
-
versionId:
|
|
1420
|
-
files:
|
|
1421
|
-
message:
|
|
1440
|
+
versionId: z7.string().min(1, "Version ID is required"),
|
|
1441
|
+
files: z7.array(fileEntryWithHashSchema),
|
|
1442
|
+
message: z7.string().optional()
|
|
1422
1443
|
}),
|
|
1423
1444
|
responses: {
|
|
1424
|
-
200:
|
|
1425
|
-
success:
|
|
1426
|
-
versionId:
|
|
1427
|
-
storageName:
|
|
1428
|
-
size:
|
|
1429
|
-
fileCount:
|
|
1430
|
-
deduplicated:
|
|
1445
|
+
200: z7.object({
|
|
1446
|
+
success: z7.literal(true),
|
|
1447
|
+
versionId: z7.string(),
|
|
1448
|
+
storageName: z7.string(),
|
|
1449
|
+
size: z7.number(),
|
|
1450
|
+
fileCount: z7.number(),
|
|
1451
|
+
deduplicated: z7.boolean().optional()
|
|
1431
1452
|
}),
|
|
1432
1453
|
400: apiErrorSchema,
|
|
1433
1454
|
401: apiErrorSchema,
|
|
@@ -1441,11 +1462,11 @@ var webhookStoragesCommitContract = c5.router({
|
|
|
1441
1462
|
});
|
|
1442
1463
|
|
|
1443
1464
|
// ../../packages/core/src/contracts/cli-auth.ts
|
|
1444
|
-
import { z as
|
|
1465
|
+
import { z as z8 } from "zod";
|
|
1445
1466
|
var c6 = initContract();
|
|
1446
|
-
var oauthErrorSchema =
|
|
1447
|
-
error:
|
|
1448
|
-
error_description:
|
|
1467
|
+
var oauthErrorSchema = z8.object({
|
|
1468
|
+
error: z8.string(),
|
|
1469
|
+
error_description: z8.string()
|
|
1449
1470
|
});
|
|
1450
1471
|
var cliAuthDeviceContract = c6.router({
|
|
1451
1472
|
/**
|
|
@@ -1455,14 +1476,14 @@ var cliAuthDeviceContract = c6.router({
|
|
|
1455
1476
|
create: {
|
|
1456
1477
|
method: "POST",
|
|
1457
1478
|
path: "/api/cli/auth/device",
|
|
1458
|
-
body:
|
|
1479
|
+
body: z8.object({}).optional(),
|
|
1459
1480
|
responses: {
|
|
1460
|
-
200:
|
|
1461
|
-
device_code:
|
|
1462
|
-
user_code:
|
|
1463
|
-
verification_url:
|
|
1464
|
-
expires_in:
|
|
1465
|
-
interval:
|
|
1481
|
+
200: z8.object({
|
|
1482
|
+
device_code: z8.string(),
|
|
1483
|
+
user_code: z8.string(),
|
|
1484
|
+
verification_url: z8.string(),
|
|
1485
|
+
expires_in: z8.number(),
|
|
1486
|
+
interval: z8.number()
|
|
1466
1487
|
}),
|
|
1467
1488
|
500: oauthErrorSchema
|
|
1468
1489
|
},
|
|
@@ -1477,16 +1498,16 @@ var cliAuthTokenContract = c6.router({
|
|
|
1477
1498
|
exchange: {
|
|
1478
1499
|
method: "POST",
|
|
1479
1500
|
path: "/api/cli/auth/token",
|
|
1480
|
-
body:
|
|
1481
|
-
device_code:
|
|
1501
|
+
body: z8.object({
|
|
1502
|
+
device_code: z8.string().min(1, "device_code is required")
|
|
1482
1503
|
}),
|
|
1483
1504
|
responses: {
|
|
1484
1505
|
// Success - token issued
|
|
1485
|
-
200:
|
|
1486
|
-
access_token:
|
|
1487
|
-
refresh_token:
|
|
1488
|
-
token_type:
|
|
1489
|
-
expires_in:
|
|
1506
|
+
200: z8.object({
|
|
1507
|
+
access_token: z8.string(),
|
|
1508
|
+
refresh_token: z8.string(),
|
|
1509
|
+
token_type: z8.literal("Bearer"),
|
|
1510
|
+
expires_in: z8.number()
|
|
1490
1511
|
}),
|
|
1491
1512
|
// Authorization pending
|
|
1492
1513
|
202: oauthErrorSchema,
|
|
@@ -1499,7 +1520,7 @@ var cliAuthTokenContract = c6.router({
|
|
|
1499
1520
|
});
|
|
1500
1521
|
|
|
1501
1522
|
// ../../packages/core/src/contracts/auth.ts
|
|
1502
|
-
import { z as
|
|
1523
|
+
import { z as z9 } from "zod";
|
|
1503
1524
|
var c7 = initContract();
|
|
1504
1525
|
var authContract = c7.router({
|
|
1505
1526
|
/**
|
|
@@ -1509,10 +1530,11 @@ var authContract = c7.router({
|
|
|
1509
1530
|
me: {
|
|
1510
1531
|
method: "GET",
|
|
1511
1532
|
path: "/api/auth/me",
|
|
1533
|
+
headers: authHeadersSchema,
|
|
1512
1534
|
responses: {
|
|
1513
|
-
200:
|
|
1514
|
-
userId:
|
|
1515
|
-
email:
|
|
1535
|
+
200: z9.object({
|
|
1536
|
+
userId: z9.string(),
|
|
1537
|
+
email: z9.string()
|
|
1516
1538
|
}),
|
|
1517
1539
|
401: apiErrorSchema,
|
|
1518
1540
|
404: apiErrorSchema,
|
|
@@ -1523,18 +1545,18 @@ var authContract = c7.router({
|
|
|
1523
1545
|
});
|
|
1524
1546
|
|
|
1525
1547
|
// ../../packages/core/src/contracts/cron.ts
|
|
1526
|
-
import { z as
|
|
1548
|
+
import { z as z10 } from "zod";
|
|
1527
1549
|
var c8 = initContract();
|
|
1528
|
-
var cleanupResultSchema =
|
|
1529
|
-
runId:
|
|
1530
|
-
sandboxId:
|
|
1531
|
-
status:
|
|
1532
|
-
error:
|
|
1550
|
+
var cleanupResultSchema = z10.object({
|
|
1551
|
+
runId: z10.string(),
|
|
1552
|
+
sandboxId: z10.string().nullable(),
|
|
1553
|
+
status: z10.enum(["cleaned", "error"]),
|
|
1554
|
+
error: z10.string().optional()
|
|
1533
1555
|
});
|
|
1534
|
-
var cleanupResponseSchema =
|
|
1535
|
-
cleaned:
|
|
1536
|
-
errors:
|
|
1537
|
-
results:
|
|
1556
|
+
var cleanupResponseSchema = z10.object({
|
|
1557
|
+
cleaned: z10.number(),
|
|
1558
|
+
errors: z10.number(),
|
|
1559
|
+
results: z10.array(cleanupResultSchema)
|
|
1538
1560
|
});
|
|
1539
1561
|
var cronCleanupSandboxesContract = c8.router({
|
|
1540
1562
|
/**
|
|
@@ -1544,6 +1566,7 @@ var cronCleanupSandboxesContract = c8.router({
|
|
|
1544
1566
|
cleanup: {
|
|
1545
1567
|
method: "GET",
|
|
1546
1568
|
path: "/api/cron/cleanup-sandboxes",
|
|
1569
|
+
headers: authHeadersSchema,
|
|
1547
1570
|
responses: {
|
|
1548
1571
|
200: cleanupResponseSchema,
|
|
1549
1572
|
401: apiErrorSchema,
|
|
@@ -1554,46 +1577,46 @@ var cronCleanupSandboxesContract = c8.router({
|
|
|
1554
1577
|
});
|
|
1555
1578
|
|
|
1556
1579
|
// ../../packages/core/src/contracts/proxy.ts
|
|
1557
|
-
import { z as
|
|
1558
|
-
var proxyErrorSchema =
|
|
1559
|
-
error:
|
|
1560
|
-
message:
|
|
1561
|
-
code:
|
|
1580
|
+
import { z as z11 } from "zod";
|
|
1581
|
+
var proxyErrorSchema = z11.object({
|
|
1582
|
+
error: z11.object({
|
|
1583
|
+
message: z11.string(),
|
|
1584
|
+
code: z11.enum([
|
|
1562
1585
|
"UNAUTHORIZED",
|
|
1563
1586
|
"BAD_REQUEST",
|
|
1564
1587
|
"BAD_GATEWAY",
|
|
1565
1588
|
"INTERNAL_ERROR"
|
|
1566
1589
|
]),
|
|
1567
|
-
targetUrl:
|
|
1590
|
+
targetUrl: z11.string().optional()
|
|
1568
1591
|
})
|
|
1569
1592
|
});
|
|
1570
1593
|
|
|
1571
1594
|
// ../../packages/core/src/contracts/scopes.ts
|
|
1572
|
-
import { z as
|
|
1595
|
+
import { z as z12 } from "zod";
|
|
1573
1596
|
var c9 = initContract();
|
|
1574
|
-
var scopeTypeSchema =
|
|
1575
|
-
var scopeSlugSchema =
|
|
1597
|
+
var scopeTypeSchema = z12.enum(["personal", "organization", "system"]);
|
|
1598
|
+
var scopeSlugSchema = z12.string().min(3, "Scope slug must be at least 3 characters").max(64, "Scope slug must be at most 64 characters").regex(
|
|
1576
1599
|
/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]{1,2}$/,
|
|
1577
1600
|
"Scope slug must contain only lowercase letters, numbers, and hyphens, and must start and end with an alphanumeric character"
|
|
1578
1601
|
).refine(
|
|
1579
1602
|
(slug) => !slug.startsWith("vm0"),
|
|
1580
1603
|
"Scope slug cannot start with 'vm0' (reserved)"
|
|
1581
1604
|
).transform((s) => s.toLowerCase());
|
|
1582
|
-
var scopeResponseSchema =
|
|
1583
|
-
id:
|
|
1584
|
-
slug:
|
|
1605
|
+
var scopeResponseSchema = z12.object({
|
|
1606
|
+
id: z12.string().uuid(),
|
|
1607
|
+
slug: z12.string(),
|
|
1585
1608
|
type: scopeTypeSchema,
|
|
1586
|
-
displayName:
|
|
1587
|
-
createdAt:
|
|
1588
|
-
updatedAt:
|
|
1609
|
+
displayName: z12.string().nullable(),
|
|
1610
|
+
createdAt: z12.string(),
|
|
1611
|
+
updatedAt: z12.string()
|
|
1589
1612
|
});
|
|
1590
|
-
var createScopeRequestSchema =
|
|
1613
|
+
var createScopeRequestSchema = z12.object({
|
|
1591
1614
|
slug: scopeSlugSchema,
|
|
1592
|
-
displayName:
|
|
1615
|
+
displayName: z12.string().max(128).optional()
|
|
1593
1616
|
});
|
|
1594
|
-
var updateScopeRequestSchema =
|
|
1617
|
+
var updateScopeRequestSchema = z12.object({
|
|
1595
1618
|
slug: scopeSlugSchema,
|
|
1596
|
-
force:
|
|
1619
|
+
force: z12.boolean().optional().default(false)
|
|
1597
1620
|
});
|
|
1598
1621
|
var scopeContract = c9.router({
|
|
1599
1622
|
/**
|
|
@@ -1603,6 +1626,7 @@ var scopeContract = c9.router({
|
|
|
1603
1626
|
get: {
|
|
1604
1627
|
method: "GET",
|
|
1605
1628
|
path: "/api/scope",
|
|
1629
|
+
headers: authHeadersSchema,
|
|
1606
1630
|
responses: {
|
|
1607
1631
|
200: scopeResponseSchema,
|
|
1608
1632
|
401: apiErrorSchema,
|
|
@@ -1618,6 +1642,7 @@ var scopeContract = c9.router({
|
|
|
1618
1642
|
create: {
|
|
1619
1643
|
method: "POST",
|
|
1620
1644
|
path: "/api/scope",
|
|
1645
|
+
headers: authHeadersSchema,
|
|
1621
1646
|
body: createScopeRequestSchema,
|
|
1622
1647
|
responses: {
|
|
1623
1648
|
201: scopeResponseSchema,
|
|
@@ -1635,6 +1660,7 @@ var scopeContract = c9.router({
|
|
|
1635
1660
|
update: {
|
|
1636
1661
|
method: "PUT",
|
|
1637
1662
|
path: "/api/scope",
|
|
1663
|
+
headers: authHeadersSchema,
|
|
1638
1664
|
body: updateScopeRequestSchema,
|
|
1639
1665
|
responses: {
|
|
1640
1666
|
200: scopeResponseSchema,
|
|
@@ -1650,28 +1676,28 @@ var scopeContract = c9.router({
|
|
|
1650
1676
|
});
|
|
1651
1677
|
|
|
1652
1678
|
// ../../packages/core/src/contracts/credentials.ts
|
|
1653
|
-
import { z as
|
|
1679
|
+
import { z as z13 } from "zod";
|
|
1654
1680
|
var c10 = initContract();
|
|
1655
|
-
var credentialNameSchema =
|
|
1681
|
+
var credentialNameSchema = z13.string().min(1, "Credential name is required").max(255, "Credential name must be at most 255 characters").regex(
|
|
1656
1682
|
/^[A-Z][A-Z0-9_]*$/,
|
|
1657
1683
|
"Credential name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
|
|
1658
1684
|
);
|
|
1659
|
-
var credentialTypeSchema =
|
|
1660
|
-
var credentialResponseSchema =
|
|
1661
|
-
id:
|
|
1662
|
-
name:
|
|
1663
|
-
description:
|
|
1685
|
+
var credentialTypeSchema = z13.enum(["user", "model-provider"]);
|
|
1686
|
+
var credentialResponseSchema = z13.object({
|
|
1687
|
+
id: z13.string().uuid(),
|
|
1688
|
+
name: z13.string(),
|
|
1689
|
+
description: z13.string().nullable(),
|
|
1664
1690
|
type: credentialTypeSchema,
|
|
1665
|
-
createdAt:
|
|
1666
|
-
updatedAt:
|
|
1691
|
+
createdAt: z13.string(),
|
|
1692
|
+
updatedAt: z13.string()
|
|
1667
1693
|
});
|
|
1668
|
-
var credentialListResponseSchema =
|
|
1669
|
-
credentials:
|
|
1694
|
+
var credentialListResponseSchema = z13.object({
|
|
1695
|
+
credentials: z13.array(credentialResponseSchema)
|
|
1670
1696
|
});
|
|
1671
|
-
var setCredentialRequestSchema =
|
|
1697
|
+
var setCredentialRequestSchema = z13.object({
|
|
1672
1698
|
name: credentialNameSchema,
|
|
1673
|
-
value:
|
|
1674
|
-
description:
|
|
1699
|
+
value: z13.string().min(1, "Credential value is required"),
|
|
1700
|
+
description: z13.string().max(1e3).optional()
|
|
1675
1701
|
});
|
|
1676
1702
|
var credentialsMainContract = c10.router({
|
|
1677
1703
|
/**
|
|
@@ -1681,6 +1707,7 @@ var credentialsMainContract = c10.router({
|
|
|
1681
1707
|
list: {
|
|
1682
1708
|
method: "GET",
|
|
1683
1709
|
path: "/api/credentials",
|
|
1710
|
+
headers: authHeadersSchema,
|
|
1684
1711
|
responses: {
|
|
1685
1712
|
200: credentialListResponseSchema,
|
|
1686
1713
|
401: apiErrorSchema,
|
|
@@ -1695,6 +1722,7 @@ var credentialsMainContract = c10.router({
|
|
|
1695
1722
|
set: {
|
|
1696
1723
|
method: "PUT",
|
|
1697
1724
|
path: "/api/credentials",
|
|
1725
|
+
headers: authHeadersSchema,
|
|
1698
1726
|
body: setCredentialRequestSchema,
|
|
1699
1727
|
responses: {
|
|
1700
1728
|
200: credentialResponseSchema,
|
|
@@ -1714,7 +1742,8 @@ var credentialsByNameContract = c10.router({
|
|
|
1714
1742
|
get: {
|
|
1715
1743
|
method: "GET",
|
|
1716
1744
|
path: "/api/credentials/:name",
|
|
1717
|
-
|
|
1745
|
+
headers: authHeadersSchema,
|
|
1746
|
+
pathParams: z13.object({
|
|
1718
1747
|
name: credentialNameSchema
|
|
1719
1748
|
}),
|
|
1720
1749
|
responses: {
|
|
@@ -1732,11 +1761,12 @@ var credentialsByNameContract = c10.router({
|
|
|
1732
1761
|
delete: {
|
|
1733
1762
|
method: "DELETE",
|
|
1734
1763
|
path: "/api/credentials/:name",
|
|
1735
|
-
|
|
1764
|
+
headers: authHeadersSchema,
|
|
1765
|
+
pathParams: z13.object({
|
|
1736
1766
|
name: credentialNameSchema
|
|
1737
1767
|
}),
|
|
1738
1768
|
responses: {
|
|
1739
|
-
204:
|
|
1769
|
+
204: z13.undefined(),
|
|
1740
1770
|
401: apiErrorSchema,
|
|
1741
1771
|
404: apiErrorSchema,
|
|
1742
1772
|
500: apiErrorSchema
|
|
@@ -1746,7 +1776,7 @@ var credentialsByNameContract = c10.router({
|
|
|
1746
1776
|
});
|
|
1747
1777
|
|
|
1748
1778
|
// ../../packages/core/src/contracts/model-providers.ts
|
|
1749
|
-
import { z as
|
|
1779
|
+
import { z as z14 } from "zod";
|
|
1750
1780
|
var c11 = initContract();
|
|
1751
1781
|
var MODEL_PROVIDER_TYPES = {
|
|
1752
1782
|
"claude-code-oauth-token": {
|
|
@@ -1771,42 +1801,43 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
1771
1801
|
helpText: "Get your API key at: https://platform.openai.com/api-keys"
|
|
1772
1802
|
}
|
|
1773
1803
|
};
|
|
1774
|
-
var modelProviderTypeSchema =
|
|
1804
|
+
var modelProviderTypeSchema = z14.enum([
|
|
1775
1805
|
"claude-code-oauth-token",
|
|
1776
1806
|
"anthropic-api-key",
|
|
1777
1807
|
"openai-api-key"
|
|
1778
1808
|
]);
|
|
1779
|
-
var modelProviderFrameworkSchema =
|
|
1780
|
-
var modelProviderResponseSchema =
|
|
1781
|
-
id:
|
|
1809
|
+
var modelProviderFrameworkSchema = z14.enum(["claude-code", "codex"]);
|
|
1810
|
+
var modelProviderResponseSchema = z14.object({
|
|
1811
|
+
id: z14.string().uuid(),
|
|
1782
1812
|
type: modelProviderTypeSchema,
|
|
1783
1813
|
framework: modelProviderFrameworkSchema,
|
|
1784
|
-
credentialName:
|
|
1785
|
-
isDefault:
|
|
1786
|
-
createdAt:
|
|
1787
|
-
updatedAt:
|
|
1814
|
+
credentialName: z14.string(),
|
|
1815
|
+
isDefault: z14.boolean(),
|
|
1816
|
+
createdAt: z14.string(),
|
|
1817
|
+
updatedAt: z14.string()
|
|
1788
1818
|
});
|
|
1789
|
-
var modelProviderListResponseSchema =
|
|
1790
|
-
modelProviders:
|
|
1819
|
+
var modelProviderListResponseSchema = z14.object({
|
|
1820
|
+
modelProviders: z14.array(modelProviderResponseSchema)
|
|
1791
1821
|
});
|
|
1792
|
-
var upsertModelProviderRequestSchema =
|
|
1822
|
+
var upsertModelProviderRequestSchema = z14.object({
|
|
1793
1823
|
type: modelProviderTypeSchema,
|
|
1794
|
-
credential:
|
|
1795
|
-
convert:
|
|
1824
|
+
credential: z14.string().min(1, "Credential is required"),
|
|
1825
|
+
convert: z14.boolean().optional()
|
|
1796
1826
|
});
|
|
1797
|
-
var upsertModelProviderResponseSchema =
|
|
1827
|
+
var upsertModelProviderResponseSchema = z14.object({
|
|
1798
1828
|
provider: modelProviderResponseSchema,
|
|
1799
|
-
created:
|
|
1829
|
+
created: z14.boolean()
|
|
1800
1830
|
});
|
|
1801
|
-
var checkCredentialResponseSchema =
|
|
1802
|
-
exists:
|
|
1803
|
-
credentialName:
|
|
1804
|
-
currentType:
|
|
1831
|
+
var checkCredentialResponseSchema = z14.object({
|
|
1832
|
+
exists: z14.boolean(),
|
|
1833
|
+
credentialName: z14.string(),
|
|
1834
|
+
currentType: z14.enum(["user", "model-provider"]).optional()
|
|
1805
1835
|
});
|
|
1806
1836
|
var modelProvidersMainContract = c11.router({
|
|
1807
1837
|
list: {
|
|
1808
1838
|
method: "GET",
|
|
1809
1839
|
path: "/api/model-providers",
|
|
1840
|
+
headers: authHeadersSchema,
|
|
1810
1841
|
responses: {
|
|
1811
1842
|
200: modelProviderListResponseSchema,
|
|
1812
1843
|
401: apiErrorSchema,
|
|
@@ -1817,6 +1848,7 @@ var modelProvidersMainContract = c11.router({
|
|
|
1817
1848
|
upsert: {
|
|
1818
1849
|
method: "PUT",
|
|
1819
1850
|
path: "/api/model-providers",
|
|
1851
|
+
headers: authHeadersSchema,
|
|
1820
1852
|
body: upsertModelProviderRequestSchema,
|
|
1821
1853
|
responses: {
|
|
1822
1854
|
200: upsertModelProviderResponseSchema,
|
|
@@ -1833,7 +1865,8 @@ var modelProvidersCheckContract = c11.router({
|
|
|
1833
1865
|
check: {
|
|
1834
1866
|
method: "GET",
|
|
1835
1867
|
path: "/api/model-providers/check/:type",
|
|
1836
|
-
|
|
1868
|
+
headers: authHeadersSchema,
|
|
1869
|
+
pathParams: z14.object({
|
|
1837
1870
|
type: modelProviderTypeSchema
|
|
1838
1871
|
}),
|
|
1839
1872
|
responses: {
|
|
@@ -1848,11 +1881,12 @@ var modelProvidersByTypeContract = c11.router({
|
|
|
1848
1881
|
delete: {
|
|
1849
1882
|
method: "DELETE",
|
|
1850
1883
|
path: "/api/model-providers/:type",
|
|
1851
|
-
|
|
1884
|
+
headers: authHeadersSchema,
|
|
1885
|
+
pathParams: z14.object({
|
|
1852
1886
|
type: modelProviderTypeSchema
|
|
1853
1887
|
}),
|
|
1854
1888
|
responses: {
|
|
1855
|
-
204:
|
|
1889
|
+
204: z14.undefined(),
|
|
1856
1890
|
401: apiErrorSchema,
|
|
1857
1891
|
404: apiErrorSchema,
|
|
1858
1892
|
500: apiErrorSchema
|
|
@@ -1864,10 +1898,11 @@ var modelProvidersConvertContract = c11.router({
|
|
|
1864
1898
|
convert: {
|
|
1865
1899
|
method: "POST",
|
|
1866
1900
|
path: "/api/model-providers/:type/convert",
|
|
1867
|
-
|
|
1901
|
+
headers: authHeadersSchema,
|
|
1902
|
+
pathParams: z14.object({
|
|
1868
1903
|
type: modelProviderTypeSchema
|
|
1869
1904
|
}),
|
|
1870
|
-
body:
|
|
1905
|
+
body: z14.undefined(),
|
|
1871
1906
|
responses: {
|
|
1872
1907
|
200: modelProviderResponseSchema,
|
|
1873
1908
|
400: apiErrorSchema,
|
|
@@ -1882,10 +1917,11 @@ var modelProvidersSetDefaultContract = c11.router({
|
|
|
1882
1917
|
setDefault: {
|
|
1883
1918
|
method: "POST",
|
|
1884
1919
|
path: "/api/model-providers/:type/set-default",
|
|
1885
|
-
|
|
1920
|
+
headers: authHeadersSchema,
|
|
1921
|
+
pathParams: z14.object({
|
|
1886
1922
|
type: modelProviderTypeSchema
|
|
1887
1923
|
}),
|
|
1888
|
-
body:
|
|
1924
|
+
body: z14.undefined(),
|
|
1889
1925
|
responses: {
|
|
1890
1926
|
200: modelProviderResponseSchema,
|
|
1891
1927
|
401: apiErrorSchema,
|
|
@@ -1897,40 +1933,40 @@ var modelProvidersSetDefaultContract = c11.router({
|
|
|
1897
1933
|
});
|
|
1898
1934
|
|
|
1899
1935
|
// ../../packages/core/src/contracts/sessions.ts
|
|
1900
|
-
import { z as
|
|
1936
|
+
import { z as z15 } from "zod";
|
|
1901
1937
|
var c12 = initContract();
|
|
1902
|
-
var sessionResponseSchema =
|
|
1903
|
-
id:
|
|
1904
|
-
agentComposeId:
|
|
1905
|
-
agentComposeVersionId:
|
|
1906
|
-
conversationId:
|
|
1907
|
-
artifactName:
|
|
1908
|
-
vars:
|
|
1909
|
-
secretNames:
|
|
1910
|
-
volumeVersions:
|
|
1911
|
-
createdAt:
|
|
1912
|
-
updatedAt:
|
|
1938
|
+
var sessionResponseSchema = z15.object({
|
|
1939
|
+
id: z15.string(),
|
|
1940
|
+
agentComposeId: z15.string(),
|
|
1941
|
+
agentComposeVersionId: z15.string().nullable(),
|
|
1942
|
+
conversationId: z15.string().nullable(),
|
|
1943
|
+
artifactName: z15.string().nullable(),
|
|
1944
|
+
vars: z15.record(z15.string(), z15.string()).nullable(),
|
|
1945
|
+
secretNames: z15.array(z15.string()).nullable(),
|
|
1946
|
+
volumeVersions: z15.record(z15.string(), z15.string()).nullable(),
|
|
1947
|
+
createdAt: z15.string(),
|
|
1948
|
+
updatedAt: z15.string()
|
|
1913
1949
|
});
|
|
1914
|
-
var agentComposeSnapshotSchema =
|
|
1915
|
-
agentComposeVersionId:
|
|
1916
|
-
vars:
|
|
1917
|
-
secretNames:
|
|
1950
|
+
var agentComposeSnapshotSchema = z15.object({
|
|
1951
|
+
agentComposeVersionId: z15.string(),
|
|
1952
|
+
vars: z15.record(z15.string(), z15.string()).optional(),
|
|
1953
|
+
secretNames: z15.array(z15.string()).optional()
|
|
1918
1954
|
});
|
|
1919
|
-
var artifactSnapshotSchema2 =
|
|
1920
|
-
artifactName:
|
|
1921
|
-
artifactVersion:
|
|
1955
|
+
var artifactSnapshotSchema2 = z15.object({
|
|
1956
|
+
artifactName: z15.string(),
|
|
1957
|
+
artifactVersion: z15.string()
|
|
1922
1958
|
});
|
|
1923
|
-
var volumeVersionsSnapshotSchema2 =
|
|
1924
|
-
versions:
|
|
1959
|
+
var volumeVersionsSnapshotSchema2 = z15.object({
|
|
1960
|
+
versions: z15.record(z15.string(), z15.string())
|
|
1925
1961
|
});
|
|
1926
|
-
var checkpointResponseSchema =
|
|
1927
|
-
id:
|
|
1928
|
-
runId:
|
|
1929
|
-
conversationId:
|
|
1962
|
+
var checkpointResponseSchema = z15.object({
|
|
1963
|
+
id: z15.string(),
|
|
1964
|
+
runId: z15.string(),
|
|
1965
|
+
conversationId: z15.string(),
|
|
1930
1966
|
agentComposeSnapshot: agentComposeSnapshotSchema,
|
|
1931
1967
|
artifactSnapshot: artifactSnapshotSchema2.nullable(),
|
|
1932
1968
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
|
|
1933
|
-
createdAt:
|
|
1969
|
+
createdAt: z15.string()
|
|
1934
1970
|
});
|
|
1935
1971
|
var sessionsByIdContract = c12.router({
|
|
1936
1972
|
/**
|
|
@@ -1940,8 +1976,9 @@ var sessionsByIdContract = c12.router({
|
|
|
1940
1976
|
getById: {
|
|
1941
1977
|
method: "GET",
|
|
1942
1978
|
path: "/api/agent/sessions/:id",
|
|
1943
|
-
|
|
1944
|
-
|
|
1979
|
+
headers: authHeadersSchema,
|
|
1980
|
+
pathParams: z15.object({
|
|
1981
|
+
id: z15.string().min(1, "Session ID is required")
|
|
1945
1982
|
}),
|
|
1946
1983
|
responses: {
|
|
1947
1984
|
200: sessionResponseSchema,
|
|
@@ -1960,8 +1997,9 @@ var checkpointsByIdContract = c12.router({
|
|
|
1960
1997
|
getById: {
|
|
1961
1998
|
method: "GET",
|
|
1962
1999
|
path: "/api/agent/checkpoints/:id",
|
|
1963
|
-
|
|
1964
|
-
|
|
2000
|
+
headers: authHeadersSchema,
|
|
2001
|
+
pathParams: z15.object({
|
|
2002
|
+
id: z15.string().min(1, "Checkpoint ID is required")
|
|
1965
2003
|
}),
|
|
1966
2004
|
responses: {
|
|
1967
2005
|
200: checkpointResponseSchema,
|
|
@@ -1974,88 +2012,88 @@ var checkpointsByIdContract = c12.router({
|
|
|
1974
2012
|
});
|
|
1975
2013
|
|
|
1976
2014
|
// ../../packages/core/src/contracts/schedules.ts
|
|
1977
|
-
import { z as
|
|
2015
|
+
import { z as z16 } from "zod";
|
|
1978
2016
|
var c13 = initContract();
|
|
1979
|
-
var scheduleTriggerSchema =
|
|
1980
|
-
cron:
|
|
1981
|
-
at:
|
|
1982
|
-
timezone:
|
|
2017
|
+
var scheduleTriggerSchema = z16.object({
|
|
2018
|
+
cron: z16.string().optional(),
|
|
2019
|
+
at: z16.string().optional(),
|
|
2020
|
+
timezone: z16.string().default("UTC")
|
|
1983
2021
|
}).refine((data) => data.cron && !data.at || !data.cron && data.at, {
|
|
1984
2022
|
message: "Exactly one of 'cron' or 'at' must be specified"
|
|
1985
2023
|
});
|
|
1986
|
-
var scheduleRunConfigSchema =
|
|
1987
|
-
agent:
|
|
1988
|
-
prompt:
|
|
1989
|
-
vars:
|
|
1990
|
-
secrets:
|
|
1991
|
-
artifactName:
|
|
1992
|
-
artifactVersion:
|
|
1993
|
-
volumeVersions:
|
|
2024
|
+
var scheduleRunConfigSchema = z16.object({
|
|
2025
|
+
agent: z16.string().min(1, "Agent reference required"),
|
|
2026
|
+
prompt: z16.string().min(1, "Prompt required"),
|
|
2027
|
+
vars: z16.record(z16.string(), z16.string()).optional(),
|
|
2028
|
+
secrets: z16.record(z16.string(), z16.string()).optional(),
|
|
2029
|
+
artifactName: z16.string().optional(),
|
|
2030
|
+
artifactVersion: z16.string().optional(),
|
|
2031
|
+
volumeVersions: z16.record(z16.string(), z16.string()).optional()
|
|
1994
2032
|
});
|
|
1995
|
-
var scheduleDefinitionSchema =
|
|
2033
|
+
var scheduleDefinitionSchema = z16.object({
|
|
1996
2034
|
on: scheduleTriggerSchema,
|
|
1997
2035
|
run: scheduleRunConfigSchema
|
|
1998
2036
|
});
|
|
1999
|
-
var scheduleYamlSchema =
|
|
2000
|
-
version:
|
|
2001
|
-
schedules:
|
|
2002
|
-
});
|
|
2003
|
-
var deployScheduleRequestSchema =
|
|
2004
|
-
name:
|
|
2005
|
-
cronExpression:
|
|
2006
|
-
atTime:
|
|
2007
|
-
timezone:
|
|
2008
|
-
prompt:
|
|
2009
|
-
vars:
|
|
2010
|
-
secrets:
|
|
2011
|
-
artifactName:
|
|
2012
|
-
artifactVersion:
|
|
2013
|
-
volumeVersions:
|
|
2037
|
+
var scheduleYamlSchema = z16.object({
|
|
2038
|
+
version: z16.literal("1.0"),
|
|
2039
|
+
schedules: z16.record(z16.string(), scheduleDefinitionSchema)
|
|
2040
|
+
});
|
|
2041
|
+
var deployScheduleRequestSchema = z16.object({
|
|
2042
|
+
name: z16.string().min(1).max(64, "Schedule name max 64 chars"),
|
|
2043
|
+
cronExpression: z16.string().optional(),
|
|
2044
|
+
atTime: z16.string().optional(),
|
|
2045
|
+
timezone: z16.string().default("UTC"),
|
|
2046
|
+
prompt: z16.string().min(1, "Prompt required"),
|
|
2047
|
+
vars: z16.record(z16.string(), z16.string()).optional(),
|
|
2048
|
+
secrets: z16.record(z16.string(), z16.string()).optional(),
|
|
2049
|
+
artifactName: z16.string().optional(),
|
|
2050
|
+
artifactVersion: z16.string().optional(),
|
|
2051
|
+
volumeVersions: z16.record(z16.string(), z16.string()).optional(),
|
|
2014
2052
|
// Resolved agent compose ID (CLI resolves scope/name:version → composeId)
|
|
2015
|
-
composeId:
|
|
2053
|
+
composeId: z16.string().uuid("Invalid compose ID")
|
|
2016
2054
|
}).refine(
|
|
2017
2055
|
(data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
|
|
2018
2056
|
{
|
|
2019
2057
|
message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
|
|
2020
2058
|
}
|
|
2021
2059
|
);
|
|
2022
|
-
var scheduleResponseSchema =
|
|
2023
|
-
id:
|
|
2024
|
-
composeId:
|
|
2025
|
-
composeName:
|
|
2026
|
-
scopeSlug:
|
|
2027
|
-
name:
|
|
2028
|
-
cronExpression:
|
|
2029
|
-
atTime:
|
|
2030
|
-
timezone:
|
|
2031
|
-
prompt:
|
|
2032
|
-
vars:
|
|
2060
|
+
var scheduleResponseSchema = z16.object({
|
|
2061
|
+
id: z16.string().uuid(),
|
|
2062
|
+
composeId: z16.string().uuid(),
|
|
2063
|
+
composeName: z16.string(),
|
|
2064
|
+
scopeSlug: z16.string(),
|
|
2065
|
+
name: z16.string(),
|
|
2066
|
+
cronExpression: z16.string().nullable(),
|
|
2067
|
+
atTime: z16.string().nullable(),
|
|
2068
|
+
timezone: z16.string(),
|
|
2069
|
+
prompt: z16.string(),
|
|
2070
|
+
vars: z16.record(z16.string(), z16.string()).nullable(),
|
|
2033
2071
|
// Secret names only (values are never returned)
|
|
2034
|
-
secretNames:
|
|
2035
|
-
artifactName:
|
|
2036
|
-
artifactVersion:
|
|
2037
|
-
volumeVersions:
|
|
2038
|
-
enabled:
|
|
2039
|
-
nextRunAt:
|
|
2040
|
-
createdAt:
|
|
2041
|
-
updatedAt:
|
|
2042
|
-
});
|
|
2043
|
-
var runSummarySchema =
|
|
2044
|
-
id:
|
|
2045
|
-
status:
|
|
2046
|
-
createdAt:
|
|
2047
|
-
completedAt:
|
|
2048
|
-
error:
|
|
2049
|
-
});
|
|
2050
|
-
var scheduleRunsResponseSchema =
|
|
2051
|
-
runs:
|
|
2052
|
-
});
|
|
2053
|
-
var scheduleListResponseSchema =
|
|
2054
|
-
schedules:
|
|
2055
|
-
});
|
|
2056
|
-
var deployScheduleResponseSchema =
|
|
2072
|
+
secretNames: z16.array(z16.string()).nullable(),
|
|
2073
|
+
artifactName: z16.string().nullable(),
|
|
2074
|
+
artifactVersion: z16.string().nullable(),
|
|
2075
|
+
volumeVersions: z16.record(z16.string(), z16.string()).nullable(),
|
|
2076
|
+
enabled: z16.boolean(),
|
|
2077
|
+
nextRunAt: z16.string().nullable(),
|
|
2078
|
+
createdAt: z16.string(),
|
|
2079
|
+
updatedAt: z16.string()
|
|
2080
|
+
});
|
|
2081
|
+
var runSummarySchema = z16.object({
|
|
2082
|
+
id: z16.string().uuid(),
|
|
2083
|
+
status: z16.enum(["pending", "running", "completed", "failed", "timeout"]),
|
|
2084
|
+
createdAt: z16.string(),
|
|
2085
|
+
completedAt: z16.string().nullable(),
|
|
2086
|
+
error: z16.string().nullable()
|
|
2087
|
+
});
|
|
2088
|
+
var scheduleRunsResponseSchema = z16.object({
|
|
2089
|
+
runs: z16.array(runSummarySchema)
|
|
2090
|
+
});
|
|
2091
|
+
var scheduleListResponseSchema = z16.object({
|
|
2092
|
+
schedules: z16.array(scheduleResponseSchema)
|
|
2093
|
+
});
|
|
2094
|
+
var deployScheduleResponseSchema = z16.object({
|
|
2057
2095
|
schedule: scheduleResponseSchema,
|
|
2058
|
-
created:
|
|
2096
|
+
created: z16.boolean()
|
|
2059
2097
|
// true if created, false if updated
|
|
2060
2098
|
});
|
|
2061
2099
|
var schedulesMainContract = c13.router({
|
|
@@ -2066,6 +2104,7 @@ var schedulesMainContract = c13.router({
|
|
|
2066
2104
|
deploy: {
|
|
2067
2105
|
method: "POST",
|
|
2068
2106
|
path: "/api/agent/schedules",
|
|
2107
|
+
headers: authHeadersSchema,
|
|
2069
2108
|
body: deployScheduleRequestSchema,
|
|
2070
2109
|
responses: {
|
|
2071
2110
|
200: deployScheduleResponseSchema,
|
|
@@ -2087,6 +2126,7 @@ var schedulesMainContract = c13.router({
|
|
|
2087
2126
|
list: {
|
|
2088
2127
|
method: "GET",
|
|
2089
2128
|
path: "/api/agent/schedules",
|
|
2129
|
+
headers: authHeadersSchema,
|
|
2090
2130
|
responses: {
|
|
2091
2131
|
200: scheduleListResponseSchema,
|
|
2092
2132
|
401: apiErrorSchema
|
|
@@ -2102,11 +2142,12 @@ var schedulesByNameContract = c13.router({
|
|
|
2102
2142
|
getByName: {
|
|
2103
2143
|
method: "GET",
|
|
2104
2144
|
path: "/api/agent/schedules/:name",
|
|
2105
|
-
|
|
2106
|
-
|
|
2145
|
+
headers: authHeadersSchema,
|
|
2146
|
+
pathParams: z16.object({
|
|
2147
|
+
name: z16.string().min(1, "Schedule name required")
|
|
2107
2148
|
}),
|
|
2108
|
-
query:
|
|
2109
|
-
composeId:
|
|
2149
|
+
query: z16.object({
|
|
2150
|
+
composeId: z16.string().uuid("Compose ID required")
|
|
2110
2151
|
}),
|
|
2111
2152
|
responses: {
|
|
2112
2153
|
200: scheduleResponseSchema,
|
|
@@ -2122,14 +2163,15 @@ var schedulesByNameContract = c13.router({
|
|
|
2122
2163
|
delete: {
|
|
2123
2164
|
method: "DELETE",
|
|
2124
2165
|
path: "/api/agent/schedules/:name",
|
|
2125
|
-
|
|
2126
|
-
|
|
2166
|
+
headers: authHeadersSchema,
|
|
2167
|
+
pathParams: z16.object({
|
|
2168
|
+
name: z16.string().min(1, "Schedule name required")
|
|
2127
2169
|
}),
|
|
2128
|
-
query:
|
|
2129
|
-
composeId:
|
|
2170
|
+
query: z16.object({
|
|
2171
|
+
composeId: z16.string().uuid("Compose ID required")
|
|
2130
2172
|
}),
|
|
2131
2173
|
responses: {
|
|
2132
|
-
204:
|
|
2174
|
+
204: z16.undefined(),
|
|
2133
2175
|
401: apiErrorSchema,
|
|
2134
2176
|
404: apiErrorSchema
|
|
2135
2177
|
},
|
|
@@ -2144,11 +2186,12 @@ var schedulesEnableContract = c13.router({
|
|
|
2144
2186
|
enable: {
|
|
2145
2187
|
method: "POST",
|
|
2146
2188
|
path: "/api/agent/schedules/:name/enable",
|
|
2147
|
-
|
|
2148
|
-
|
|
2189
|
+
headers: authHeadersSchema,
|
|
2190
|
+
pathParams: z16.object({
|
|
2191
|
+
name: z16.string().min(1, "Schedule name required")
|
|
2149
2192
|
}),
|
|
2150
|
-
body:
|
|
2151
|
-
composeId:
|
|
2193
|
+
body: z16.object({
|
|
2194
|
+
composeId: z16.string().uuid("Compose ID required")
|
|
2152
2195
|
}),
|
|
2153
2196
|
responses: {
|
|
2154
2197
|
200: scheduleResponseSchema,
|
|
@@ -2164,11 +2207,12 @@ var schedulesEnableContract = c13.router({
|
|
|
2164
2207
|
disable: {
|
|
2165
2208
|
method: "POST",
|
|
2166
2209
|
path: "/api/agent/schedules/:name/disable",
|
|
2167
|
-
|
|
2168
|
-
|
|
2210
|
+
headers: authHeadersSchema,
|
|
2211
|
+
pathParams: z16.object({
|
|
2212
|
+
name: z16.string().min(1, "Schedule name required")
|
|
2169
2213
|
}),
|
|
2170
|
-
body:
|
|
2171
|
-
composeId:
|
|
2214
|
+
body: z16.object({
|
|
2215
|
+
composeId: z16.string().uuid("Compose ID required")
|
|
2172
2216
|
}),
|
|
2173
2217
|
responses: {
|
|
2174
2218
|
200: scheduleResponseSchema,
|
|
@@ -2186,12 +2230,13 @@ var scheduleRunsContract = c13.router({
|
|
|
2186
2230
|
listRuns: {
|
|
2187
2231
|
method: "GET",
|
|
2188
2232
|
path: "/api/agent/schedules/:name/runs",
|
|
2189
|
-
|
|
2190
|
-
|
|
2233
|
+
headers: authHeadersSchema,
|
|
2234
|
+
pathParams: z16.object({
|
|
2235
|
+
name: z16.string().min(1, "Schedule name required")
|
|
2191
2236
|
}),
|
|
2192
|
-
query:
|
|
2193
|
-
composeId:
|
|
2194
|
-
limit:
|
|
2237
|
+
query: z16.object({
|
|
2238
|
+
composeId: z16.string().uuid("Compose ID required"),
|
|
2239
|
+
limit: z16.coerce.number().min(0).max(100).default(5)
|
|
2195
2240
|
}),
|
|
2196
2241
|
responses: {
|
|
2197
2242
|
200: scheduleRunsResponseSchema,
|
|
@@ -2203,16 +2248,16 @@ var scheduleRunsContract = c13.router({
|
|
|
2203
2248
|
});
|
|
2204
2249
|
|
|
2205
2250
|
// ../../packages/core/src/contracts/realtime.ts
|
|
2206
|
-
import { z as
|
|
2251
|
+
import { z as z17 } from "zod";
|
|
2207
2252
|
var c14 = initContract();
|
|
2208
|
-
var ablyTokenRequestSchema =
|
|
2209
|
-
keyName:
|
|
2210
|
-
ttl:
|
|
2211
|
-
timestamp:
|
|
2212
|
-
capability:
|
|
2213
|
-
clientId:
|
|
2214
|
-
nonce:
|
|
2215
|
-
mac:
|
|
2253
|
+
var ablyTokenRequestSchema = z17.object({
|
|
2254
|
+
keyName: z17.string(),
|
|
2255
|
+
ttl: z17.number().optional(),
|
|
2256
|
+
timestamp: z17.number(),
|
|
2257
|
+
capability: z17.string(),
|
|
2258
|
+
clientId: z17.string().optional(),
|
|
2259
|
+
nonce: z17.string(),
|
|
2260
|
+
mac: z17.string()
|
|
2216
2261
|
});
|
|
2217
2262
|
var realtimeTokenContract = c14.router({
|
|
2218
2263
|
/**
|
|
@@ -2222,8 +2267,9 @@ var realtimeTokenContract = c14.router({
|
|
|
2222
2267
|
create: {
|
|
2223
2268
|
method: "POST",
|
|
2224
2269
|
path: "/api/realtime/token",
|
|
2225
|
-
|
|
2226
|
-
|
|
2270
|
+
headers: authHeadersSchema,
|
|
2271
|
+
body: z17.object({
|
|
2272
|
+
runId: z17.string().uuid("runId must be a valid UUID")
|
|
2227
2273
|
}),
|
|
2228
2274
|
responses: {
|
|
2229
2275
|
200: ablyTokenRequestSchema,
|
|
@@ -2237,8 +2283,8 @@ var realtimeTokenContract = c14.router({
|
|
|
2237
2283
|
});
|
|
2238
2284
|
|
|
2239
2285
|
// ../../packages/core/src/contracts/public/common.ts
|
|
2240
|
-
import { z as
|
|
2241
|
-
var publicApiErrorTypeSchema =
|
|
2286
|
+
import { z as z18 } from "zod";
|
|
2287
|
+
var publicApiErrorTypeSchema = z18.enum([
|
|
2242
2288
|
"api_error",
|
|
2243
2289
|
// Internal server error (5xx)
|
|
2244
2290
|
"invalid_request_error",
|
|
@@ -2250,58 +2296,59 @@ var publicApiErrorTypeSchema = z17.enum([
|
|
|
2250
2296
|
"conflict_error"
|
|
2251
2297
|
// Resource conflict (409)
|
|
2252
2298
|
]);
|
|
2253
|
-
var publicApiErrorSchema =
|
|
2254
|
-
error:
|
|
2299
|
+
var publicApiErrorSchema = z18.object({
|
|
2300
|
+
error: z18.object({
|
|
2255
2301
|
type: publicApiErrorTypeSchema,
|
|
2256
|
-
code:
|
|
2257
|
-
message:
|
|
2258
|
-
param:
|
|
2259
|
-
doc_url:
|
|
2302
|
+
code: z18.string(),
|
|
2303
|
+
message: z18.string(),
|
|
2304
|
+
param: z18.string().optional(),
|
|
2305
|
+
doc_url: z18.string().url().optional()
|
|
2260
2306
|
})
|
|
2261
2307
|
});
|
|
2262
|
-
var paginationSchema =
|
|
2263
|
-
has_more:
|
|
2264
|
-
next_cursor:
|
|
2308
|
+
var paginationSchema = z18.object({
|
|
2309
|
+
has_more: z18.boolean(),
|
|
2310
|
+
next_cursor: z18.string().nullable()
|
|
2265
2311
|
});
|
|
2266
2312
|
function createPaginatedResponseSchema(dataSchema) {
|
|
2267
|
-
return
|
|
2268
|
-
data:
|
|
2313
|
+
return z18.object({
|
|
2314
|
+
data: z18.array(dataSchema),
|
|
2269
2315
|
pagination: paginationSchema
|
|
2270
2316
|
});
|
|
2271
2317
|
}
|
|
2272
|
-
var listQuerySchema =
|
|
2273
|
-
cursor:
|
|
2274
|
-
limit:
|
|
2318
|
+
var listQuerySchema = z18.object({
|
|
2319
|
+
cursor: z18.string().optional(),
|
|
2320
|
+
limit: z18.coerce.number().min(1).max(100).default(20)
|
|
2275
2321
|
});
|
|
2276
|
-
var requestIdSchema =
|
|
2277
|
-
var timestampSchema =
|
|
2322
|
+
var requestIdSchema = z18.string().uuid();
|
|
2323
|
+
var timestampSchema = z18.string().datetime();
|
|
2278
2324
|
|
|
2279
2325
|
// ../../packages/core/src/contracts/public/agents.ts
|
|
2280
|
-
import { z as
|
|
2326
|
+
import { z as z19 } from "zod";
|
|
2281
2327
|
var c15 = initContract();
|
|
2282
|
-
var publicAgentSchema =
|
|
2283
|
-
id:
|
|
2284
|
-
name:
|
|
2285
|
-
current_version_id:
|
|
2328
|
+
var publicAgentSchema = z19.object({
|
|
2329
|
+
id: z19.string(),
|
|
2330
|
+
name: z19.string(),
|
|
2331
|
+
current_version_id: z19.string().nullable(),
|
|
2286
2332
|
created_at: timestampSchema,
|
|
2287
2333
|
updated_at: timestampSchema
|
|
2288
2334
|
});
|
|
2289
|
-
var agentVersionSchema =
|
|
2290
|
-
id:
|
|
2291
|
-
agent_id:
|
|
2292
|
-
version_number:
|
|
2335
|
+
var agentVersionSchema = z19.object({
|
|
2336
|
+
id: z19.string(),
|
|
2337
|
+
agent_id: z19.string(),
|
|
2338
|
+
version_number: z19.number(),
|
|
2293
2339
|
created_at: timestampSchema
|
|
2294
2340
|
});
|
|
2295
2341
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
2296
2342
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
2297
2343
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
2298
2344
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
2299
|
-
name:
|
|
2345
|
+
name: z19.string().optional()
|
|
2300
2346
|
});
|
|
2301
2347
|
var publicAgentsListContract = c15.router({
|
|
2302
2348
|
list: {
|
|
2303
2349
|
method: "GET",
|
|
2304
2350
|
path: "/v1/agents",
|
|
2351
|
+
headers: authHeadersSchema,
|
|
2305
2352
|
query: agentListQuerySchema,
|
|
2306
2353
|
responses: {
|
|
2307
2354
|
200: paginatedAgentsSchema,
|
|
@@ -2316,8 +2363,9 @@ var publicAgentByIdContract = c15.router({
|
|
|
2316
2363
|
get: {
|
|
2317
2364
|
method: "GET",
|
|
2318
2365
|
path: "/v1/agents/:id",
|
|
2319
|
-
|
|
2320
|
-
|
|
2366
|
+
headers: authHeadersSchema,
|
|
2367
|
+
pathParams: z19.object({
|
|
2368
|
+
id: z19.string().min(1, "Agent ID is required")
|
|
2321
2369
|
}),
|
|
2322
2370
|
responses: {
|
|
2323
2371
|
200: publicAgentDetailSchema,
|
|
@@ -2333,8 +2381,9 @@ var publicAgentVersionsContract = c15.router({
|
|
|
2333
2381
|
list: {
|
|
2334
2382
|
method: "GET",
|
|
2335
2383
|
path: "/v1/agents/:id/versions",
|
|
2336
|
-
|
|
2337
|
-
|
|
2384
|
+
headers: authHeadersSchema,
|
|
2385
|
+
pathParams: z19.object({
|
|
2386
|
+
id: z19.string().min(1, "Agent ID is required")
|
|
2338
2387
|
}),
|
|
2339
2388
|
query: listQuerySchema,
|
|
2340
2389
|
responses: {
|
|
@@ -2349,9 +2398,9 @@ var publicAgentVersionsContract = c15.router({
|
|
|
2349
2398
|
});
|
|
2350
2399
|
|
|
2351
2400
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
2352
|
-
import { z as
|
|
2401
|
+
import { z as z20 } from "zod";
|
|
2353
2402
|
var c16 = initContract();
|
|
2354
|
-
var publicRunStatusSchema =
|
|
2403
|
+
var publicRunStatusSchema = z20.enum([
|
|
2355
2404
|
"pending",
|
|
2356
2405
|
"running",
|
|
2357
2406
|
"completed",
|
|
@@ -2359,52 +2408,52 @@ var publicRunStatusSchema = z19.enum([
|
|
|
2359
2408
|
"timeout",
|
|
2360
2409
|
"cancelled"
|
|
2361
2410
|
]);
|
|
2362
|
-
var publicRunSchema =
|
|
2363
|
-
id:
|
|
2364
|
-
agent_id:
|
|
2365
|
-
agent_name:
|
|
2411
|
+
var publicRunSchema = z20.object({
|
|
2412
|
+
id: z20.string(),
|
|
2413
|
+
agent_id: z20.string(),
|
|
2414
|
+
agent_name: z20.string(),
|
|
2366
2415
|
status: publicRunStatusSchema,
|
|
2367
|
-
prompt:
|
|
2416
|
+
prompt: z20.string(),
|
|
2368
2417
|
created_at: timestampSchema,
|
|
2369
2418
|
started_at: timestampSchema.nullable(),
|
|
2370
2419
|
completed_at: timestampSchema.nullable()
|
|
2371
2420
|
});
|
|
2372
2421
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
2373
|
-
error:
|
|
2374
|
-
execution_time_ms:
|
|
2375
|
-
checkpoint_id:
|
|
2376
|
-
session_id:
|
|
2377
|
-
artifact_name:
|
|
2378
|
-
artifact_version:
|
|
2379
|
-
volumes:
|
|
2422
|
+
error: z20.string().nullable(),
|
|
2423
|
+
execution_time_ms: z20.number().nullable(),
|
|
2424
|
+
checkpoint_id: z20.string().nullable(),
|
|
2425
|
+
session_id: z20.string().nullable(),
|
|
2426
|
+
artifact_name: z20.string().nullable(),
|
|
2427
|
+
artifact_version: z20.string().nullable(),
|
|
2428
|
+
volumes: z20.record(z20.string(), z20.string()).optional()
|
|
2380
2429
|
});
|
|
2381
2430
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
2382
|
-
var createRunRequestSchema =
|
|
2431
|
+
var createRunRequestSchema = z20.object({
|
|
2383
2432
|
// Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
|
|
2384
|
-
agent:
|
|
2433
|
+
agent: z20.string().optional(),
|
|
2385
2434
|
// Agent name
|
|
2386
|
-
agent_id:
|
|
2435
|
+
agent_id: z20.string().optional(),
|
|
2387
2436
|
// Agent ID
|
|
2388
|
-
agent_version:
|
|
2437
|
+
agent_version: z20.string().optional(),
|
|
2389
2438
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
2390
2439
|
// Continue session
|
|
2391
|
-
session_id:
|
|
2440
|
+
session_id: z20.string().optional(),
|
|
2392
2441
|
// Resume from checkpoint
|
|
2393
|
-
checkpoint_id:
|
|
2442
|
+
checkpoint_id: z20.string().optional(),
|
|
2394
2443
|
// Required
|
|
2395
|
-
prompt:
|
|
2444
|
+
prompt: z20.string().min(1, "Prompt is required"),
|
|
2396
2445
|
// Optional configuration
|
|
2397
|
-
variables:
|
|
2398
|
-
secrets:
|
|
2399
|
-
artifact_name:
|
|
2446
|
+
variables: z20.record(z20.string(), z20.string()).optional(),
|
|
2447
|
+
secrets: z20.record(z20.string(), z20.string()).optional(),
|
|
2448
|
+
artifact_name: z20.string().optional(),
|
|
2400
2449
|
// Artifact name to mount
|
|
2401
|
-
artifact_version:
|
|
2450
|
+
artifact_version: z20.string().optional(),
|
|
2402
2451
|
// Artifact version (defaults to latest)
|
|
2403
|
-
volumes:
|
|
2452
|
+
volumes: z20.record(z20.string(), z20.string()).optional()
|
|
2404
2453
|
// volume_name -> version
|
|
2405
2454
|
});
|
|
2406
2455
|
var runListQuerySchema = listQuerySchema.extend({
|
|
2407
|
-
agent_id:
|
|
2456
|
+
agent_id: z20.string().optional(),
|
|
2408
2457
|
status: publicRunStatusSchema.optional(),
|
|
2409
2458
|
since: timestampSchema.optional()
|
|
2410
2459
|
});
|
|
@@ -2412,6 +2461,7 @@ var publicRunsListContract = c16.router({
|
|
|
2412
2461
|
list: {
|
|
2413
2462
|
method: "GET",
|
|
2414
2463
|
path: "/v1/runs",
|
|
2464
|
+
headers: authHeadersSchema,
|
|
2415
2465
|
query: runListQuerySchema,
|
|
2416
2466
|
responses: {
|
|
2417
2467
|
200: paginatedRunsSchema,
|
|
@@ -2424,6 +2474,7 @@ var publicRunsListContract = c16.router({
|
|
|
2424
2474
|
create: {
|
|
2425
2475
|
method: "POST",
|
|
2426
2476
|
path: "/v1/runs",
|
|
2477
|
+
headers: authHeadersSchema,
|
|
2427
2478
|
body: createRunRequestSchema,
|
|
2428
2479
|
responses: {
|
|
2429
2480
|
202: publicRunDetailSchema,
|
|
@@ -2441,8 +2492,9 @@ var publicRunByIdContract = c16.router({
|
|
|
2441
2492
|
get: {
|
|
2442
2493
|
method: "GET",
|
|
2443
2494
|
path: "/v1/runs/:id",
|
|
2444
|
-
|
|
2445
|
-
|
|
2495
|
+
headers: authHeadersSchema,
|
|
2496
|
+
pathParams: z20.object({
|
|
2497
|
+
id: z20.string().min(1, "Run ID is required")
|
|
2446
2498
|
}),
|
|
2447
2499
|
responses: {
|
|
2448
2500
|
200: publicRunDetailSchema,
|
|
@@ -2458,10 +2510,11 @@ var publicRunCancelContract = c16.router({
|
|
|
2458
2510
|
cancel: {
|
|
2459
2511
|
method: "POST",
|
|
2460
2512
|
path: "/v1/runs/:id/cancel",
|
|
2461
|
-
|
|
2462
|
-
|
|
2513
|
+
headers: authHeadersSchema,
|
|
2514
|
+
pathParams: z20.object({
|
|
2515
|
+
id: z20.string().min(1, "Run ID is required")
|
|
2463
2516
|
}),
|
|
2464
|
-
body:
|
|
2517
|
+
body: z20.undefined(),
|
|
2465
2518
|
responses: {
|
|
2466
2519
|
200: publicRunDetailSchema,
|
|
2467
2520
|
400: publicApiErrorSchema,
|
|
@@ -2474,26 +2527,27 @@ var publicRunCancelContract = c16.router({
|
|
|
2474
2527
|
description: "Cancel a pending or running execution"
|
|
2475
2528
|
}
|
|
2476
2529
|
});
|
|
2477
|
-
var logEntrySchema =
|
|
2530
|
+
var logEntrySchema = z20.object({
|
|
2478
2531
|
timestamp: timestampSchema,
|
|
2479
|
-
type:
|
|
2480
|
-
level:
|
|
2481
|
-
message:
|
|
2482
|
-
metadata:
|
|
2532
|
+
type: z20.enum(["agent", "system", "network"]),
|
|
2533
|
+
level: z20.enum(["debug", "info", "warn", "error"]),
|
|
2534
|
+
message: z20.string(),
|
|
2535
|
+
metadata: z20.record(z20.string(), z20.unknown()).optional()
|
|
2483
2536
|
});
|
|
2484
2537
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
2485
2538
|
var logsQuerySchema = listQuerySchema.extend({
|
|
2486
|
-
type:
|
|
2539
|
+
type: z20.enum(["agent", "system", "network", "all"]).default("all"),
|
|
2487
2540
|
since: timestampSchema.optional(),
|
|
2488
2541
|
until: timestampSchema.optional(),
|
|
2489
|
-
order:
|
|
2542
|
+
order: z20.enum(["asc", "desc"]).default("asc")
|
|
2490
2543
|
});
|
|
2491
2544
|
var publicRunLogsContract = c16.router({
|
|
2492
2545
|
getLogs: {
|
|
2493
2546
|
method: "GET",
|
|
2494
2547
|
path: "/v1/runs/:id/logs",
|
|
2495
|
-
|
|
2496
|
-
|
|
2548
|
+
headers: authHeadersSchema,
|
|
2549
|
+
pathParams: z20.object({
|
|
2550
|
+
id: z20.string().min(1, "Run ID is required")
|
|
2497
2551
|
}),
|
|
2498
2552
|
query: logsQuerySchema,
|
|
2499
2553
|
responses: {
|
|
@@ -2506,29 +2560,30 @@ var publicRunLogsContract = c16.router({
|
|
|
2506
2560
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
2507
2561
|
}
|
|
2508
2562
|
});
|
|
2509
|
-
var metricPointSchema =
|
|
2563
|
+
var metricPointSchema = z20.object({
|
|
2510
2564
|
timestamp: timestampSchema,
|
|
2511
|
-
cpu_percent:
|
|
2512
|
-
memory_used_mb:
|
|
2513
|
-
memory_total_mb:
|
|
2514
|
-
disk_used_mb:
|
|
2515
|
-
disk_total_mb:
|
|
2516
|
-
});
|
|
2517
|
-
var metricsSummarySchema =
|
|
2518
|
-
avg_cpu_percent:
|
|
2519
|
-
max_memory_used_mb:
|
|
2520
|
-
total_duration_ms:
|
|
2521
|
-
});
|
|
2522
|
-
var metricsResponseSchema2 =
|
|
2523
|
-
data:
|
|
2565
|
+
cpu_percent: z20.number(),
|
|
2566
|
+
memory_used_mb: z20.number(),
|
|
2567
|
+
memory_total_mb: z20.number(),
|
|
2568
|
+
disk_used_mb: z20.number(),
|
|
2569
|
+
disk_total_mb: z20.number()
|
|
2570
|
+
});
|
|
2571
|
+
var metricsSummarySchema = z20.object({
|
|
2572
|
+
avg_cpu_percent: z20.number(),
|
|
2573
|
+
max_memory_used_mb: z20.number(),
|
|
2574
|
+
total_duration_ms: z20.number().nullable()
|
|
2575
|
+
});
|
|
2576
|
+
var metricsResponseSchema2 = z20.object({
|
|
2577
|
+
data: z20.array(metricPointSchema),
|
|
2524
2578
|
summary: metricsSummarySchema
|
|
2525
2579
|
});
|
|
2526
2580
|
var publicRunMetricsContract = c16.router({
|
|
2527
2581
|
getMetrics: {
|
|
2528
2582
|
method: "GET",
|
|
2529
2583
|
path: "/v1/runs/:id/metrics",
|
|
2530
|
-
|
|
2531
|
-
|
|
2584
|
+
headers: authHeadersSchema,
|
|
2585
|
+
pathParams: z20.object({
|
|
2586
|
+
id: z20.string().min(1, "Run ID is required")
|
|
2532
2587
|
}),
|
|
2533
2588
|
responses: {
|
|
2534
2589
|
200: metricsResponseSchema2,
|
|
@@ -2540,7 +2595,7 @@ var publicRunMetricsContract = c16.router({
|
|
|
2540
2595
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
2541
2596
|
}
|
|
2542
2597
|
});
|
|
2543
|
-
var sseEventTypeSchema =
|
|
2598
|
+
var sseEventTypeSchema = z20.enum([
|
|
2544
2599
|
"status",
|
|
2545
2600
|
// Run status change
|
|
2546
2601
|
"output",
|
|
@@ -2552,25 +2607,26 @@ var sseEventTypeSchema = z19.enum([
|
|
|
2552
2607
|
"heartbeat"
|
|
2553
2608
|
// Keep-alive
|
|
2554
2609
|
]);
|
|
2555
|
-
var sseEventSchema =
|
|
2610
|
+
var sseEventSchema = z20.object({
|
|
2556
2611
|
event: sseEventTypeSchema,
|
|
2557
|
-
data:
|
|
2558
|
-
id:
|
|
2612
|
+
data: z20.unknown(),
|
|
2613
|
+
id: z20.string().optional()
|
|
2559
2614
|
// For Last-Event-ID reconnection
|
|
2560
2615
|
});
|
|
2561
2616
|
var publicRunEventsContract = c16.router({
|
|
2562
2617
|
streamEvents: {
|
|
2563
2618
|
method: "GET",
|
|
2564
2619
|
path: "/v1/runs/:id/events",
|
|
2565
|
-
|
|
2566
|
-
|
|
2620
|
+
headers: authHeadersSchema,
|
|
2621
|
+
pathParams: z20.object({
|
|
2622
|
+
id: z20.string().min(1, "Run ID is required")
|
|
2567
2623
|
}),
|
|
2568
|
-
query:
|
|
2569
|
-
last_event_id:
|
|
2624
|
+
query: z20.object({
|
|
2625
|
+
last_event_id: z20.string().optional()
|
|
2570
2626
|
// For reconnection
|
|
2571
2627
|
}),
|
|
2572
2628
|
responses: {
|
|
2573
|
-
200:
|
|
2629
|
+
200: z20.any(),
|
|
2574
2630
|
// SSE stream - actual content is text/event-stream
|
|
2575
2631
|
401: publicApiErrorSchema,
|
|
2576
2632
|
404: publicApiErrorSchema,
|
|
@@ -2582,28 +2638,28 @@ var publicRunEventsContract = c16.router({
|
|
|
2582
2638
|
});
|
|
2583
2639
|
|
|
2584
2640
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
2585
|
-
import { z as
|
|
2641
|
+
import { z as z21 } from "zod";
|
|
2586
2642
|
var c17 = initContract();
|
|
2587
|
-
var publicArtifactSchema =
|
|
2588
|
-
id:
|
|
2589
|
-
name:
|
|
2590
|
-
current_version_id:
|
|
2591
|
-
size:
|
|
2643
|
+
var publicArtifactSchema = z21.object({
|
|
2644
|
+
id: z21.string(),
|
|
2645
|
+
name: z21.string(),
|
|
2646
|
+
current_version_id: z21.string().nullable(),
|
|
2647
|
+
size: z21.number(),
|
|
2592
2648
|
// Total size in bytes
|
|
2593
|
-
file_count:
|
|
2649
|
+
file_count: z21.number(),
|
|
2594
2650
|
created_at: timestampSchema,
|
|
2595
2651
|
updated_at: timestampSchema
|
|
2596
2652
|
});
|
|
2597
|
-
var artifactVersionSchema =
|
|
2598
|
-
id:
|
|
2653
|
+
var artifactVersionSchema = z21.object({
|
|
2654
|
+
id: z21.string(),
|
|
2599
2655
|
// SHA-256 content hash
|
|
2600
|
-
artifact_id:
|
|
2601
|
-
size:
|
|
2656
|
+
artifact_id: z21.string(),
|
|
2657
|
+
size: z21.number(),
|
|
2602
2658
|
// Size in bytes
|
|
2603
|
-
file_count:
|
|
2604
|
-
message:
|
|
2659
|
+
file_count: z21.number(),
|
|
2660
|
+
message: z21.string().nullable(),
|
|
2605
2661
|
// Optional commit message
|
|
2606
|
-
created_by:
|
|
2662
|
+
created_by: z21.string(),
|
|
2607
2663
|
created_at: timestampSchema
|
|
2608
2664
|
});
|
|
2609
2665
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -2617,6 +2673,7 @@ var publicArtifactsListContract = c17.router({
|
|
|
2617
2673
|
list: {
|
|
2618
2674
|
method: "GET",
|
|
2619
2675
|
path: "/v1/artifacts",
|
|
2676
|
+
headers: authHeadersSchema,
|
|
2620
2677
|
query: listQuerySchema,
|
|
2621
2678
|
responses: {
|
|
2622
2679
|
200: paginatedArtifactsSchema,
|
|
@@ -2631,8 +2688,9 @@ var publicArtifactByIdContract = c17.router({
|
|
|
2631
2688
|
get: {
|
|
2632
2689
|
method: "GET",
|
|
2633
2690
|
path: "/v1/artifacts/:id",
|
|
2634
|
-
|
|
2635
|
-
|
|
2691
|
+
headers: authHeadersSchema,
|
|
2692
|
+
pathParams: z21.object({
|
|
2693
|
+
id: z21.string().min(1, "Artifact ID is required")
|
|
2636
2694
|
}),
|
|
2637
2695
|
responses: {
|
|
2638
2696
|
200: publicArtifactDetailSchema,
|
|
@@ -2648,8 +2706,9 @@ var publicArtifactVersionsContract = c17.router({
|
|
|
2648
2706
|
list: {
|
|
2649
2707
|
method: "GET",
|
|
2650
2708
|
path: "/v1/artifacts/:id/versions",
|
|
2651
|
-
|
|
2652
|
-
|
|
2709
|
+
headers: authHeadersSchema,
|
|
2710
|
+
pathParams: z21.object({
|
|
2711
|
+
id: z21.string().min(1, "Artifact ID is required")
|
|
2653
2712
|
}),
|
|
2654
2713
|
query: listQuerySchema,
|
|
2655
2714
|
responses: {
|
|
@@ -2666,15 +2725,16 @@ var publicArtifactDownloadContract = c17.router({
|
|
|
2666
2725
|
download: {
|
|
2667
2726
|
method: "GET",
|
|
2668
2727
|
path: "/v1/artifacts/:id/download",
|
|
2669
|
-
|
|
2670
|
-
|
|
2728
|
+
headers: authHeadersSchema,
|
|
2729
|
+
pathParams: z21.object({
|
|
2730
|
+
id: z21.string().min(1, "Artifact ID is required")
|
|
2671
2731
|
}),
|
|
2672
|
-
query:
|
|
2673
|
-
version_id:
|
|
2732
|
+
query: z21.object({
|
|
2733
|
+
version_id: z21.string().optional()
|
|
2674
2734
|
// Defaults to current version
|
|
2675
2735
|
}),
|
|
2676
2736
|
responses: {
|
|
2677
|
-
302:
|
|
2737
|
+
302: z21.undefined(),
|
|
2678
2738
|
// Redirect to presigned URL
|
|
2679
2739
|
401: publicApiErrorSchema,
|
|
2680
2740
|
404: publicApiErrorSchema,
|
|
@@ -2686,28 +2746,28 @@ var publicArtifactDownloadContract = c17.router({
|
|
|
2686
2746
|
});
|
|
2687
2747
|
|
|
2688
2748
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
2689
|
-
import { z as
|
|
2749
|
+
import { z as z22 } from "zod";
|
|
2690
2750
|
var c18 = initContract();
|
|
2691
|
-
var publicVolumeSchema =
|
|
2692
|
-
id:
|
|
2693
|
-
name:
|
|
2694
|
-
current_version_id:
|
|
2695
|
-
size:
|
|
2751
|
+
var publicVolumeSchema = z22.object({
|
|
2752
|
+
id: z22.string(),
|
|
2753
|
+
name: z22.string(),
|
|
2754
|
+
current_version_id: z22.string().nullable(),
|
|
2755
|
+
size: z22.number(),
|
|
2696
2756
|
// Total size in bytes
|
|
2697
|
-
file_count:
|
|
2757
|
+
file_count: z22.number(),
|
|
2698
2758
|
created_at: timestampSchema,
|
|
2699
2759
|
updated_at: timestampSchema
|
|
2700
2760
|
});
|
|
2701
|
-
var volumeVersionSchema =
|
|
2702
|
-
id:
|
|
2761
|
+
var volumeVersionSchema = z22.object({
|
|
2762
|
+
id: z22.string(),
|
|
2703
2763
|
// SHA-256 content hash
|
|
2704
|
-
volume_id:
|
|
2705
|
-
size:
|
|
2764
|
+
volume_id: z22.string(),
|
|
2765
|
+
size: z22.number(),
|
|
2706
2766
|
// Size in bytes
|
|
2707
|
-
file_count:
|
|
2708
|
-
message:
|
|
2767
|
+
file_count: z22.number(),
|
|
2768
|
+
message: z22.string().nullable(),
|
|
2709
2769
|
// Optional commit message
|
|
2710
|
-
created_by:
|
|
2770
|
+
created_by: z22.string(),
|
|
2711
2771
|
created_at: timestampSchema
|
|
2712
2772
|
});
|
|
2713
2773
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -2719,6 +2779,7 @@ var publicVolumesListContract = c18.router({
|
|
|
2719
2779
|
list: {
|
|
2720
2780
|
method: "GET",
|
|
2721
2781
|
path: "/v1/volumes",
|
|
2782
|
+
headers: authHeadersSchema,
|
|
2722
2783
|
query: listQuerySchema,
|
|
2723
2784
|
responses: {
|
|
2724
2785
|
200: paginatedVolumesSchema,
|
|
@@ -2733,8 +2794,9 @@ var publicVolumeByIdContract = c18.router({
|
|
|
2733
2794
|
get: {
|
|
2734
2795
|
method: "GET",
|
|
2735
2796
|
path: "/v1/volumes/:id",
|
|
2736
|
-
|
|
2737
|
-
|
|
2797
|
+
headers: authHeadersSchema,
|
|
2798
|
+
pathParams: z22.object({
|
|
2799
|
+
id: z22.string().min(1, "Volume ID is required")
|
|
2738
2800
|
}),
|
|
2739
2801
|
responses: {
|
|
2740
2802
|
200: publicVolumeDetailSchema,
|
|
@@ -2750,8 +2812,9 @@ var publicVolumeVersionsContract = c18.router({
|
|
|
2750
2812
|
list: {
|
|
2751
2813
|
method: "GET",
|
|
2752
2814
|
path: "/v1/volumes/:id/versions",
|
|
2753
|
-
|
|
2754
|
-
|
|
2815
|
+
headers: authHeadersSchema,
|
|
2816
|
+
pathParams: z22.object({
|
|
2817
|
+
id: z22.string().min(1, "Volume ID is required")
|
|
2755
2818
|
}),
|
|
2756
2819
|
query: listQuerySchema,
|
|
2757
2820
|
responses: {
|
|
@@ -2768,15 +2831,16 @@ var publicVolumeDownloadContract = c18.router({
|
|
|
2768
2831
|
download: {
|
|
2769
2832
|
method: "GET",
|
|
2770
2833
|
path: "/v1/volumes/:id/download",
|
|
2771
|
-
|
|
2772
|
-
|
|
2834
|
+
headers: authHeadersSchema,
|
|
2835
|
+
pathParams: z22.object({
|
|
2836
|
+
id: z22.string().min(1, "Volume ID is required")
|
|
2773
2837
|
}),
|
|
2774
|
-
query:
|
|
2775
|
-
version_id:
|
|
2838
|
+
query: z22.object({
|
|
2839
|
+
version_id: z22.string().optional()
|
|
2776
2840
|
// Defaults to current version
|
|
2777
2841
|
}),
|
|
2778
2842
|
responses: {
|
|
2779
|
-
302:
|
|
2843
|
+
302: z22.undefined(),
|
|
2780
2844
|
// Redirect to presigned URL
|
|
2781
2845
|
401: publicApiErrorSchema,
|
|
2782
2846
|
404: publicApiErrorSchema,
|
|
@@ -2980,6 +3044,9 @@ async function getComposeByName(name, scope) {
|
|
|
2980
3044
|
if (result.status === 200) {
|
|
2981
3045
|
return result.body;
|
|
2982
3046
|
}
|
|
3047
|
+
if (result.status === 404) {
|
|
3048
|
+
return null;
|
|
3049
|
+
}
|
|
2983
3050
|
handleError(result, `Compose not found: ${name}`);
|
|
2984
3051
|
}
|
|
2985
3052
|
async function getComposeById(id) {
|
|
@@ -3357,7 +3424,7 @@ async function getUsage(options) {
|
|
|
3357
3424
|
}
|
|
3358
3425
|
|
|
3359
3426
|
// src/lib/domain/yaml-validator.ts
|
|
3360
|
-
import { z as
|
|
3427
|
+
import { z as z23 } from "zod";
|
|
3361
3428
|
|
|
3362
3429
|
// src/lib/domain/framework-config.ts
|
|
3363
3430
|
var FRAMEWORK_DEFAULTS = {
|
|
@@ -3424,7 +3491,7 @@ function getDefaultImageWithApps(framework, apps) {
|
|
|
3424
3491
|
}
|
|
3425
3492
|
|
|
3426
3493
|
// src/lib/domain/yaml-validator.ts
|
|
3427
|
-
var cliAgentNameSchema =
|
|
3494
|
+
var cliAgentNameSchema = z23.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
3428
3495
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
3429
3496
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
3430
3497
|
);
|
|
@@ -3437,14 +3504,14 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3437
3504
|
const frameworkSupported = isFrameworkSupported(agent.framework);
|
|
3438
3505
|
if (!agent.image && !frameworkSupported) {
|
|
3439
3506
|
ctx.addIssue({
|
|
3440
|
-
code:
|
|
3507
|
+
code: z23.ZodIssueCode.custom,
|
|
3441
3508
|
message: "Missing agent.image (required when framework is not auto-configured)",
|
|
3442
3509
|
path: ["image"]
|
|
3443
3510
|
});
|
|
3444
3511
|
}
|
|
3445
3512
|
if (!agent.working_dir && !frameworkSupported) {
|
|
3446
3513
|
ctx.addIssue({
|
|
3447
|
-
code:
|
|
3514
|
+
code: z23.ZodIssueCode.custom,
|
|
3448
3515
|
message: "Missing agent.working_dir (required when framework is not auto-configured)",
|
|
3449
3516
|
path: ["working_dir"]
|
|
3450
3517
|
});
|
|
@@ -3454,7 +3521,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3454
3521
|
const skillUrl = agent.skills[i];
|
|
3455
3522
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
3456
3523
|
ctx.addIssue({
|
|
3457
|
-
code:
|
|
3524
|
+
code: z23.ZodIssueCode.custom,
|
|
3458
3525
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
3459
3526
|
path: ["skills", i]
|
|
3460
3527
|
});
|
|
@@ -3463,15 +3530,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3463
3530
|
}
|
|
3464
3531
|
}
|
|
3465
3532
|
);
|
|
3466
|
-
var cliComposeSchema =
|
|
3467
|
-
version:
|
|
3468
|
-
agents:
|
|
3469
|
-
volumes:
|
|
3533
|
+
var cliComposeSchema = z23.object({
|
|
3534
|
+
version: z23.string().min(1, "Missing config.version"),
|
|
3535
|
+
agents: z23.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
3536
|
+
volumes: z23.record(z23.string(), volumeConfigSchema).optional()
|
|
3470
3537
|
}).superRefine((config, ctx) => {
|
|
3471
3538
|
const agentKeys = Object.keys(config.agents);
|
|
3472
3539
|
if (agentKeys.length === 0) {
|
|
3473
3540
|
ctx.addIssue({
|
|
3474
|
-
code:
|
|
3541
|
+
code: z23.ZodIssueCode.custom,
|
|
3475
3542
|
message: "agents must have at least one agent defined",
|
|
3476
3543
|
path: ["agents"]
|
|
3477
3544
|
});
|
|
@@ -3479,7 +3546,7 @@ var cliComposeSchema = z22.object({
|
|
|
3479
3546
|
}
|
|
3480
3547
|
if (agentKeys.length > 1) {
|
|
3481
3548
|
ctx.addIssue({
|
|
3482
|
-
code:
|
|
3549
|
+
code: z23.ZodIssueCode.custom,
|
|
3483
3550
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
3484
3551
|
path: ["agents"]
|
|
3485
3552
|
});
|
|
@@ -3491,7 +3558,7 @@ var cliComposeSchema = z22.object({
|
|
|
3491
3558
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
3492
3559
|
if (!config.volumes) {
|
|
3493
3560
|
ctx.addIssue({
|
|
3494
|
-
code:
|
|
3561
|
+
code: z23.ZodIssueCode.custom,
|
|
3495
3562
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
3496
3563
|
path: ["volumes"]
|
|
3497
3564
|
});
|
|
@@ -3501,7 +3568,7 @@ var cliComposeSchema = z22.object({
|
|
|
3501
3568
|
const parts = volDeclaration.split(":");
|
|
3502
3569
|
if (parts.length !== 2) {
|
|
3503
3570
|
ctx.addIssue({
|
|
3504
|
-
code:
|
|
3571
|
+
code: z23.ZodIssueCode.custom,
|
|
3505
3572
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
3506
3573
|
path: ["agents", agentName, "volumes"]
|
|
3507
3574
|
});
|
|
@@ -3510,7 +3577,7 @@ var cliComposeSchema = z22.object({
|
|
|
3510
3577
|
const volumeKey = parts[0].trim();
|
|
3511
3578
|
if (!config.volumes[volumeKey]) {
|
|
3512
3579
|
ctx.addIssue({
|
|
3513
|
-
code:
|
|
3580
|
+
code: z23.ZodIssueCode.custom,
|
|
3514
3581
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
3515
3582
|
path: ["volumes", volumeKey]
|
|
3516
3583
|
});
|
|
@@ -4066,33 +4133,6 @@ function getSecretsFromComposeContent(content) {
|
|
|
4066
4133
|
const grouped = groupVariablesBySource(refs);
|
|
4067
4134
|
return new Set(grouped.secrets.map((r) => r.name));
|
|
4068
4135
|
}
|
|
4069
|
-
function transformExperimentalShorthand(agent) {
|
|
4070
|
-
const experimentalSecrets = agent.experimental_secrets;
|
|
4071
|
-
const experimentalVars = agent.experimental_vars;
|
|
4072
|
-
if (!experimentalSecrets && !experimentalVars) {
|
|
4073
|
-
return;
|
|
4074
|
-
}
|
|
4075
|
-
const environment = agent.environment || {};
|
|
4076
|
-
if (experimentalSecrets) {
|
|
4077
|
-
for (const secretName of experimentalSecrets) {
|
|
4078
|
-
if (!(secretName in environment)) {
|
|
4079
|
-
environment[secretName] = "${{ secrets." + secretName + " }}";
|
|
4080
|
-
}
|
|
4081
|
-
}
|
|
4082
|
-
delete agent.experimental_secrets;
|
|
4083
|
-
}
|
|
4084
|
-
if (experimentalVars) {
|
|
4085
|
-
for (const varName of experimentalVars) {
|
|
4086
|
-
if (!(varName in environment)) {
|
|
4087
|
-
environment[varName] = "${{ vars." + varName + " }}";
|
|
4088
|
-
}
|
|
4089
|
-
}
|
|
4090
|
-
delete agent.experimental_vars;
|
|
4091
|
-
}
|
|
4092
|
-
if (Object.keys(environment).length > 0) {
|
|
4093
|
-
agent.environment = environment;
|
|
4094
|
-
}
|
|
4095
|
-
}
|
|
4096
4136
|
var composeCommand = new Command().name("compose").description("Create or update agent compose").argument("<config-file>", "Path to config YAML file").option("-y, --yes", "Skip confirmation prompts for skill requirements").action(async (configFile, options) => {
|
|
4097
4137
|
try {
|
|
4098
4138
|
if (!existsSync3(configFile)) {
|
|
@@ -4117,9 +4157,6 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4117
4157
|
}
|
|
4118
4158
|
const cfg = config;
|
|
4119
4159
|
const agentsConfig = cfg.agents;
|
|
4120
|
-
for (const agentConfig of Object.values(agentsConfig)) {
|
|
4121
|
-
transformExperimentalShorthand(agentConfig);
|
|
4122
|
-
}
|
|
4123
4160
|
for (const [name, agentConfig] of Object.entries(agentsConfig)) {
|
|
4124
4161
|
const image = agentConfig.image;
|
|
4125
4162
|
if (image) {
|
|
@@ -4216,12 +4253,9 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4216
4253
|
([name]) => !(name in environment)
|
|
4217
4254
|
);
|
|
4218
4255
|
let headSecrets = /* @__PURE__ */ new Set();
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
headSecrets = getSecretsFromComposeContent(existingCompose.content);
|
|
4223
|
-
}
|
|
4224
|
-
} catch {
|
|
4256
|
+
const existingCompose = await getComposeByName(agentName);
|
|
4257
|
+
if (existingCompose?.content) {
|
|
4258
|
+
headSecrets = getSecretsFromComposeContent(existingCompose.content);
|
|
4225
4259
|
}
|
|
4226
4260
|
const trulyNewSecrets = newSecrets.map(([name]) => name).filter((name) => !headSecrets.has(name));
|
|
4227
4261
|
if (newSecrets.length > 0 || newVars.length > 0) {
|
|
@@ -4469,16 +4503,14 @@ var EventRenderer = class {
|
|
|
4469
4503
|
static renderToolResult(event, prefix, suffix) {
|
|
4470
4504
|
const isError = Boolean(event.data.isError);
|
|
4471
4505
|
const status = isError ? "Error" : "Completed";
|
|
4472
|
-
|
|
4473
|
-
console.log(prefix + color("[tool_result]") + suffix + " " + status);
|
|
4506
|
+
console.log(prefix + "[tool_result]" + suffix + " " + status);
|
|
4474
4507
|
const result = String(event.data.result || "");
|
|
4475
4508
|
console.log(` ${chalk3.dim(result)}`);
|
|
4476
4509
|
}
|
|
4477
4510
|
static renderResult(event, prefix, suffix) {
|
|
4478
4511
|
const success = Boolean(event.data.success);
|
|
4479
4512
|
const status = success ? "\u2713 completed successfully" : "\u2717 failed";
|
|
4480
|
-
|
|
4481
|
-
console.log(prefix + color("[result]") + suffix + " " + status);
|
|
4513
|
+
console.log(prefix + "[result]" + suffix + " " + status);
|
|
4482
4514
|
const durationMs = Number(event.data.durationMs || 0);
|
|
4483
4515
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
4484
4516
|
console.log(` Duration: ${chalk3.dim(durationSec + "s")}`);
|
|
@@ -6189,6 +6221,15 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
|
|
|
6189
6221
|
console.log(chalk6.dim(` Resolving agent: ${displayRef}`));
|
|
6190
6222
|
}
|
|
6191
6223
|
const compose = await getComposeByName(name, scope);
|
|
6224
|
+
if (!compose) {
|
|
6225
|
+
console.error(chalk6.red(`\u2717 Agent not found: ${identifier}`));
|
|
6226
|
+
console.error(
|
|
6227
|
+
chalk6.dim(
|
|
6228
|
+
" Make sure you've composed the agent with: vm0 compose"
|
|
6229
|
+
)
|
|
6230
|
+
);
|
|
6231
|
+
process.exit(1);
|
|
6232
|
+
}
|
|
6192
6233
|
composeId = compose.id;
|
|
6193
6234
|
composeContent = compose.content;
|
|
6194
6235
|
if (verbose) {
|
|
@@ -7889,7 +7930,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip c
|
|
|
7889
7930
|
// eslint-disable-next-line complexity -- TODO: refactor complex function
|
|
7890
7931
|
async (prompt, options) => {
|
|
7891
7932
|
if (!options.noAutoUpdate) {
|
|
7892
|
-
const shouldExit = await checkAndUpgrade("
|
|
7933
|
+
const shouldExit = await checkAndUpgrade("7.0.1", prompt);
|
|
7893
7934
|
if (shouldExit) {
|
|
7894
7935
|
process.exit(0);
|
|
7895
7936
|
}
|
|
@@ -8804,16 +8845,11 @@ var inspectCommand = new Command25().name("inspect").description("Inspect an age
|
|
|
8804
8845
|
name = argument.slice(0, colonIndex);
|
|
8805
8846
|
version = argument.slice(colonIndex + 1) || "latest";
|
|
8806
8847
|
}
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
compose
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
console.error(chalk29.red(`\u2717 Agent compose not found: ${name}`));
|
|
8813
|
-
console.error(chalk29.dim(" Run: vm0 agent list"));
|
|
8814
|
-
process.exit(1);
|
|
8815
|
-
}
|
|
8816
|
-
throw error;
|
|
8848
|
+
const compose = await getComposeByName(name, options.scope);
|
|
8849
|
+
if (!compose) {
|
|
8850
|
+
console.error(chalk29.red(`\u2717 Agent compose not found: ${name}`));
|
|
8851
|
+
console.error(chalk29.dim(" Run: vm0 agent list"));
|
|
8852
|
+
process.exit(1);
|
|
8817
8853
|
}
|
|
8818
8854
|
let resolvedVersionId = compose.headVersionId;
|
|
8819
8855
|
if (version !== "latest" && compose.headVersionId) {
|
|
@@ -9175,25 +9211,6 @@ function extractSecretsAndVars(config) {
|
|
|
9175
9211
|
for (const ref of grouped.vars) {
|
|
9176
9212
|
vars.add(ref.name);
|
|
9177
9213
|
}
|
|
9178
|
-
const cfg = config;
|
|
9179
|
-
const agents = cfg.agents;
|
|
9180
|
-
if (agents) {
|
|
9181
|
-
const agentConfig = Object.values(agents)[0];
|
|
9182
|
-
if (agentConfig) {
|
|
9183
|
-
const expSecrets = agentConfig.experimental_secrets;
|
|
9184
|
-
const expVars = agentConfig.experimental_vars;
|
|
9185
|
-
if (expSecrets) {
|
|
9186
|
-
for (const s of expSecrets) {
|
|
9187
|
-
secrets.add(s);
|
|
9188
|
-
}
|
|
9189
|
-
}
|
|
9190
|
-
if (expVars) {
|
|
9191
|
-
for (const v of expVars) {
|
|
9192
|
-
vars.add(v);
|
|
9193
|
-
}
|
|
9194
|
-
}
|
|
9195
|
-
}
|
|
9196
|
-
}
|
|
9197
9214
|
secrets.add("VM0_TOKEN");
|
|
9198
9215
|
return {
|
|
9199
9216
|
secrets: Array.from(secrets).sort(),
|
|
@@ -9579,12 +9596,6 @@ function extractVarsAndSecrets() {
|
|
|
9579
9596
|
if (!agent) {
|
|
9580
9597
|
return result;
|
|
9581
9598
|
}
|
|
9582
|
-
if (agent.experimental_vars) {
|
|
9583
|
-
result.vars.push(...agent.experimental_vars);
|
|
9584
|
-
}
|
|
9585
|
-
if (agent.experimental_secrets) {
|
|
9586
|
-
result.secrets.push(...agent.experimental_secrets);
|
|
9587
|
-
}
|
|
9588
9599
|
if (agent.environment) {
|
|
9589
9600
|
for (const value of Object.values(agent.environment)) {
|
|
9590
9601
|
const varsMatches = value.matchAll(/\$\{\{\s*vars\.(\w+)\s*\}\}/g);
|
|
@@ -10077,17 +10088,15 @@ var deployCommand = new Command30().name("deploy").description("Deploy a schedul
|
|
|
10077
10088
|
const [scheduleName, schedule] = scheduleEntries[0];
|
|
10078
10089
|
console.log(`Deploying schedule ${chalk33.cyan(scheduleName)}...`);
|
|
10079
10090
|
const agentRef = schedule.run.agent;
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
const compose = await getComposeByName(agentName);
|
|
10085
|
-
composeId = compose.id;
|
|
10086
|
-
} catch {
|
|
10091
|
+
const namePart = agentRef.includes("/") ? agentRef.split("/").pop() : agentRef;
|
|
10092
|
+
const agentName = namePart.includes(":") ? namePart.split(":")[0] : namePart;
|
|
10093
|
+
const compose = await getComposeByName(agentName);
|
|
10094
|
+
if (!compose) {
|
|
10087
10095
|
console.error(chalk33.red(`\u2717 Agent not found: ${agentRef}`));
|
|
10088
10096
|
console.error(chalk33.dim(" Make sure the agent is pushed first"));
|
|
10089
10097
|
process.exit(1);
|
|
10090
10098
|
}
|
|
10099
|
+
const composeId = compose.id;
|
|
10091
10100
|
const expandedVars = expandEnvVarsInObject(schedule.run.vars);
|
|
10092
10101
|
const expandedSecrets = expandEnvVarsInObject(schedule.run.secrets);
|
|
10093
10102
|
const atTime = schedule.on.at ? toISODateTime(schedule.on.at) : void 0;
|
|
@@ -10700,9 +10709,7 @@ var listCommand5 = new Command38().name("list").alias("ls").description("List al
|
|
|
10700
10709
|
console.log(chalk40.dim("No credentials found."));
|
|
10701
10710
|
console.log();
|
|
10702
10711
|
console.log("To add a credential:");
|
|
10703
|
-
console.log(
|
|
10704
|
-
chalk40.cyan(" vm0 experimental-credential set MY_API_KEY <value>")
|
|
10705
|
-
);
|
|
10712
|
+
console.log(chalk40.cyan(" vm0 credential set MY_API_KEY <value>"));
|
|
10706
10713
|
return;
|
|
10707
10714
|
}
|
|
10708
10715
|
console.log(chalk40.bold("Credentials:"));
|
|
@@ -10825,7 +10832,7 @@ var deleteCommand2 = new Command40().name("delete").description("Delete a creden
|
|
|
10825
10832
|
});
|
|
10826
10833
|
|
|
10827
10834
|
// src/commands/credential/index.ts
|
|
10828
|
-
var credentialCommand = new Command41().name("
|
|
10835
|
+
var credentialCommand = new Command41().name("credential").description("Manage stored credentials for agent runs").addCommand(listCommand5).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
10829
10836
|
|
|
10830
10837
|
// src/commands/model-provider/index.ts
|
|
10831
10838
|
import { Command as Command46 } from "commander";
|
|
@@ -11089,7 +11096,7 @@ var modelProviderCommand = new Command46().name("model-provider").description("M
|
|
|
11089
11096
|
|
|
11090
11097
|
// src/index.ts
|
|
11091
11098
|
var program = new Command47();
|
|
11092
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("
|
|
11099
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("7.0.1");
|
|
11093
11100
|
program.command("info").description("Display environment information").action(async () => {
|
|
11094
11101
|
console.log(chalk47.bold("System Information:"));
|
|
11095
11102
|
console.log(`Node Version: ${process.version}`);
|