@vm0/cli 7.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +927 -850
  2. 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 = z.object({
255
- error: z.object({
256
- message: z.string(),
257
- code: z.string()
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 z3 } from "zod";
266
+ import { z as z4 } from "zod";
263
267
 
264
268
  // ../../packages/core/src/contracts/runners.ts
265
- import { z as z2 } from "zod";
269
+ import { z as z3 } from "zod";
266
270
  var c = initContract();
267
- var firewallRuleSchema = z2.object({
268
- domain: z2.string().optional(),
269
- ip: z2.string().optional(),
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: z2.enum(["ALLOW", "DENY"]).optional(),
275
+ final: z3.enum(["ALLOW", "DENY"]).optional(),
272
276
  /** Action for domain/ip rules */
273
- action: z2.enum(["ALLOW", "DENY"]).optional()
277
+ action: z3.enum(["ALLOW", "DENY"]).optional()
274
278
  });
275
- var experimentalFirewallSchema = z2.object({
276
- enabled: z2.boolean(),
277
- rules: z2.array(firewallRuleSchema).optional(),
278
- experimental_mitm: z2.boolean().optional(),
279
- experimental_seal_secrets: z2.boolean().optional()
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 = z2.string().regex(
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 = z2.object({
286
- runId: z2.string().uuid(),
287
- prompt: z2.string(),
288
- agentComposeVersionId: z2.string(),
289
- vars: z2.record(z2.string(), z2.string()).nullable(),
290
- secretNames: z2.array(z2.string()).nullable(),
291
- checkpointId: z2.string().uuid().nullable()
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
- body: z2.object({
301
+ headers: authHeadersSchema,
302
+ body: z3.object({
298
303
  group: runnerGroupSchema
299
304
  }),
300
305
  responses: {
301
- 200: z2.object({
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 = z2.object({
312
- mountPath: z2.string(),
313
- archiveUrl: z2.string().nullable()
316
+ var storageEntrySchema = z3.object({
317
+ mountPath: z3.string(),
318
+ archiveUrl: z3.string().nullable()
314
319
  });
315
- var artifactEntrySchema = z2.object({
316
- mountPath: z2.string(),
317
- archiveUrl: z2.string().nullable(),
318
- vasStorageName: z2.string(),
319
- vasVersionId: z2.string()
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 = z2.object({
322
- storages: z2.array(storageEntrySchema),
326
+ var storageManifestSchema = z3.object({
327
+ storages: z3.array(storageEntrySchema),
323
328
  artifact: artifactEntrySchema.nullable()
324
329
  });
325
- var resumeSessionSchema = z2.object({
326
- sessionId: z2.string(),
327
- sessionHistory: z2.string()
330
+ var resumeSessionSchema = z3.object({
331
+ sessionId: z3.string(),
332
+ sessionHistory: z3.string()
328
333
  });
329
- var storedExecutionContextSchema = z2.object({
330
- workingDir: z2.string(),
334
+ var storedExecutionContextSchema = z3.object({
335
+ workingDir: z3.string(),
331
336
  storageManifest: storageManifestSchema.nullable(),
332
- environment: z2.record(z2.string(), z2.string()).nullable(),
337
+ environment: z3.record(z3.string(), z3.string()).nullable(),
333
338
  resumeSession: resumeSessionSchema.nullable(),
334
- encryptedSecrets: z2.string().nullable(),
339
+ encryptedSecrets: z3.string().nullable(),
335
340
  // AES-256-GCM encrypted secrets
336
- cliAgentType: z2.string(),
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: z2.boolean().optional()
340
- });
341
- var executionContextSchema = z2.object({
342
- runId: z2.string().uuid(),
343
- prompt: z2.string(),
344
- agentComposeVersionId: z2.string(),
345
- vars: z2.record(z2.string(), z2.string()).nullable(),
346
- secretNames: z2.array(z2.string()).nullable(),
347
- checkpointId: z2.string().uuid().nullable(),
348
- sandboxToken: z2.string(),
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: z2.string(),
355
+ workingDir: z3.string(),
351
356
  storageManifest: storageManifestSchema.nullable(),
352
- environment: z2.record(z2.string(), z2.string()).nullable(),
357
+ environment: z3.record(z3.string(), z3.string()).nullable(),
353
358
  resumeSession: resumeSessionSchema.nullable(),
354
- secretValues: z2.array(z2.string()).nullable(),
355
- cliAgentType: z2.string(),
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: z2.boolean().optional()
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
- pathParams: z2.object({
366
- id: z2.string().uuid()
370
+ headers: authHeadersSchema,
371
+ pathParams: z3.object({
372
+ id: z3.string().uuid()
367
373
  }),
368
- body: z2.object({}),
374
+ body: z3.object({}),
369
375
  responses: {
370
376
  200: executionContextSchema,
371
377
  400: apiErrorSchema,
@@ -383,82 +389,82 @@ var runnersJobClaimContract = c.router({
383
389
 
384
390
  // ../../packages/core/src/contracts/composes.ts
385
391
  var c2 = initContract();
386
- var composeVersionQuerySchema = z3.preprocess(
392
+ var composeVersionQuerySchema = z4.preprocess(
387
393
  (val) => val === void 0 || val === null ? void 0 : String(val),
388
- z3.string().min(1, "Missing version query parameter").regex(
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 = z3.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
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 = z3.object({
398
- name: z3.string().min(1, "Volume name is required"),
399
- version: z3.string().min(1, "Volume version is required")
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 = z3.string().superRefine((val, ctx) => {
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: z3.ZodIssueCode.custom,
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: z3.ZodIssueCode.custom,
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: z3.ZodIssueCode.custom,
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 agentDefinitionSchema = z3.object({
428
- description: z3.string().optional(),
433
+ var agentDefinitionSchema = z4.object({
434
+ description: z4.string().optional(),
429
435
  /**
430
436
  * @deprecated Use `apps` field instead for pre-installed tools.
431
437
  * This field will be removed in a future version.
432
438
  */
433
- image: z3.string().optional(),
434
- framework: z3.string().min(1, "Framework is required"),
439
+ image: z4.string().optional(),
440
+ framework: z4.string().min(1, "Framework is required"),
435
441
  /**
436
442
  * Array of pre-installed apps/tools for the agent environment.
437
443
  * Format: "app" or "app:tag" (e.g., "github", "github:dev", "github:latest")
438
444
  * Default tag is "latest" if not specified.
439
445
  * Currently supported apps: "github" (includes GitHub CLI)
440
446
  */
441
- apps: z3.array(appStringSchema).optional(),
442
- volumes: z3.array(z3.string()).optional(),
443
- working_dir: z3.string().optional(),
447
+ apps: z4.array(appStringSchema).optional(),
448
+ volumes: z4.array(z4.string()).optional(),
449
+ working_dir: z4.string().optional(),
444
450
  // Optional when provider supports auto-config
445
- environment: z3.record(z3.string(), z3.string()).optional(),
451
+ environment: z4.record(z4.string(), z4.string()).optional(),
446
452
  /**
447
453
  * Path to instructions file (e.g., AGENTS.md).
448
454
  * Auto-uploaded as volume and mounted at /home/user/.claude/CLAUDE.md
449
455
  */
450
- instructions: z3.string().min(1, "Instructions path cannot be empty").optional(),
456
+ instructions: z4.string().min(1, "Instructions path cannot be empty").optional(),
451
457
  /**
452
458
  * Array of GitHub tree URLs for agent skills.
453
459
  * Each skill is auto-downloaded and mounted at /home/user/.claude/skills/{skillName}/
454
460
  */
455
- skills: z3.array(z3.string()).optional(),
461
+ skills: z4.array(z4.string()).optional(),
456
462
  /**
457
463
  * Route this agent to a self-hosted runner instead of E2B.
458
464
  * When specified, runs will be queued for the specified runner group.
459
465
  */
460
- experimental_runner: z3.object({
461
- group: z3.string().regex(
466
+ experimental_runner: z4.object({
467
+ group: z4.string().regex(
462
468
  /^[a-z0-9-]+\/[a-z0-9-]+$/,
463
469
  "Runner group must be in scope/name format (e.g., acme/production)"
464
470
  )
@@ -470,25 +476,25 @@ var agentDefinitionSchema = z3.object({
470
476
  */
471
477
  experimental_firewall: experimentalFirewallSchema.optional()
472
478
  });
473
- var agentComposeContentSchema = z3.object({
474
- version: z3.string().min(1, "Version is required"),
475
- agents: z3.record(z3.string(), agentDefinitionSchema),
476
- volumes: z3.record(z3.string(), volumeConfigSchema).optional()
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()
477
483
  });
478
- var composeResponseSchema = z3.object({
479
- id: z3.string(),
480
- name: z3.string(),
481
- headVersionId: z3.string().nullable(),
484
+ var composeResponseSchema = z4.object({
485
+ id: z4.string(),
486
+ name: z4.string(),
487
+ headVersionId: z4.string().nullable(),
482
488
  content: agentComposeContentSchema.nullable(),
483
- createdAt: z3.string(),
484
- updatedAt: z3.string()
489
+ createdAt: z4.string(),
490
+ updatedAt: z4.string()
485
491
  });
486
- var createComposeResponseSchema = z3.object({
487
- composeId: z3.string(),
488
- name: z3.string(),
489
- versionId: z3.string(),
490
- action: z3.enum(["created", "existing"]),
491
- updatedAt: z3.string()
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()
492
498
  });
493
499
  var composesMainContract = c2.router({
494
500
  /**
@@ -499,9 +505,10 @@ var composesMainContract = c2.router({
499
505
  getByName: {
500
506
  method: "GET",
501
507
  path: "/api/agent/composes",
502
- query: z3.object({
503
- name: z3.string().min(1, "Missing name query parameter"),
504
- scope: z3.string().optional()
508
+ headers: authHeadersSchema,
509
+ query: z4.object({
510
+ name: z4.string().min(1, "Missing name query parameter"),
511
+ scope: z4.string().optional()
505
512
  }),
506
513
  responses: {
507
514
  200: composeResponseSchema,
@@ -520,7 +527,8 @@ var composesMainContract = c2.router({
520
527
  create: {
521
528
  method: "POST",
522
529
  path: "/api/agent/composes",
523
- body: z3.object({
530
+ headers: authHeadersSchema,
531
+ body: z4.object({
524
532
  content: agentComposeContentSchema
525
533
  }),
526
534
  responses: {
@@ -540,8 +548,9 @@ var composesByIdContract = c2.router({
540
548
  getById: {
541
549
  method: "GET",
542
550
  path: "/api/agent/composes/:id",
543
- pathParams: z3.object({
544
- id: z3.string().min(1, "Compose ID is required")
551
+ headers: authHeadersSchema,
552
+ pathParams: z4.object({
553
+ id: z4.string().min(1, "Compose ID is required")
545
554
  }),
546
555
  responses: {
547
556
  200: composeResponseSchema,
@@ -559,14 +568,15 @@ var composesVersionsContract = c2.router({
559
568
  resolveVersion: {
560
569
  method: "GET",
561
570
  path: "/api/agent/composes/versions",
562
- query: z3.object({
563
- composeId: z3.string().min(1, "Missing composeId query parameter"),
571
+ headers: authHeadersSchema,
572
+ query: z4.object({
573
+ composeId: z4.string().min(1, "Missing composeId query parameter"),
564
574
  version: composeVersionQuerySchema
565
575
  }),
566
576
  responses: {
567
- 200: z3.object({
568
- versionId: z3.string(),
569
- tag: z3.string().optional()
577
+ 200: z4.object({
578
+ versionId: z4.string(),
579
+ tag: z4.string().optional()
570
580
  }),
571
581
  400: apiErrorSchema,
572
582
  401: apiErrorSchema,
@@ -575,10 +585,10 @@ var composesVersionsContract = c2.router({
575
585
  summary: "Resolve version specifier to full version ID"
576
586
  }
577
587
  });
578
- var composeListItemSchema = z3.object({
579
- name: z3.string(),
580
- headVersionId: z3.string().nullable(),
581
- updatedAt: z3.string()
588
+ var composeListItemSchema = z4.object({
589
+ name: z4.string(),
590
+ headVersionId: z4.string().nullable(),
591
+ updatedAt: z4.string()
582
592
  });
583
593
  var composesListContract = c2.router({
584
594
  /**
@@ -589,12 +599,13 @@ var composesListContract = c2.router({
589
599
  list: {
590
600
  method: "GET",
591
601
  path: "/api/agent/composes/list",
592
- query: z3.object({
593
- scope: z3.string().optional()
602
+ headers: authHeadersSchema,
603
+ query: z4.object({
604
+ scope: z4.string().optional()
594
605
  }),
595
606
  responses: {
596
- 200: z3.object({
597
- composes: z3.array(composeListItemSchema)
607
+ 200: z4.object({
608
+ composes: z4.array(composeListItemSchema)
598
609
  }),
599
610
  400: apiErrorSchema,
600
611
  401: apiErrorSchema
@@ -604,85 +615,85 @@ var composesListContract = c2.router({
604
615
  });
605
616
 
606
617
  // ../../packages/core/src/contracts/runs.ts
607
- import { z as z4 } from "zod";
618
+ import { z as z5 } from "zod";
608
619
  var c3 = initContract();
609
- var runStatusSchema = z4.enum([
620
+ var runStatusSchema = z5.enum([
610
621
  "pending",
611
622
  "running",
612
623
  "completed",
613
624
  "failed",
614
625
  "timeout"
615
626
  ]);
616
- var unifiedRunRequestSchema = z4.object({
627
+ var unifiedRunRequestSchema = z5.object({
617
628
  // High-level shortcuts (mutually exclusive with each other)
618
- checkpointId: z4.string().optional(),
619
- sessionId: z4.string().optional(),
629
+ checkpointId: z5.string().optional(),
630
+ sessionId: z5.string().optional(),
620
631
  // Base parameters (can be used directly or overridden after shortcut expansion)
621
- agentComposeId: z4.string().optional(),
622
- agentComposeVersionId: z4.string().optional(),
623
- conversationId: z4.string().optional(),
624
- artifactName: z4.string().optional(),
625
- artifactVersion: z4.string().optional(),
626
- vars: z4.record(z4.string(), z4.string()).optional(),
627
- secrets: z4.record(z4.string(), z4.string()).optional(),
628
- volumeVersions: z4.record(z4.string(), z4.string()).optional(),
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(),
629
640
  // Debug flag to force real Claude in mock environments (internal use only)
630
- debugNoMockClaude: z4.boolean().optional(),
641
+ debugNoMockClaude: z5.boolean().optional(),
631
642
  // Model provider for automatic credential injection
632
- modelProvider: z4.string().optional(),
643
+ modelProvider: z5.string().optional(),
633
644
  // Required
634
- prompt: z4.string().min(1, "Missing prompt")
645
+ prompt: z5.string().min(1, "Missing prompt")
635
646
  });
636
- var createRunResponseSchema = z4.object({
637
- runId: z4.string(),
647
+ var createRunResponseSchema = z5.object({
648
+ runId: z5.string(),
638
649
  status: runStatusSchema,
639
- sandboxId: z4.string().optional(),
640
- output: z4.string().optional(),
641
- error: z4.string().optional(),
642
- executionTimeMs: z4.number().optional(),
643
- createdAt: z4.string()
644
- });
645
- var getRunResponseSchema = z4.object({
646
- runId: z4.string(),
647
- agentComposeVersionId: z4.string(),
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(),
648
659
  status: runStatusSchema,
649
- prompt: z4.string(),
650
- vars: z4.record(z4.string(), z4.string()).optional(),
651
- sandboxId: z4.string().optional(),
652
- result: z4.object({
653
- output: z4.string(),
654
- executionTimeMs: z4.number()
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()
655
666
  }).optional(),
656
- error: z4.string().optional(),
657
- createdAt: z4.string(),
658
- startedAt: z4.string().optional(),
659
- completedAt: z4.string().optional()
660
- });
661
- var runEventSchema = z4.object({
662
- sequenceNumber: z4.number(),
663
- eventType: z4.string(),
664
- eventData: z4.unknown(),
665
- createdAt: z4.string()
666
- });
667
- var runResultSchema = z4.object({
668
- checkpointId: z4.string(),
669
- agentSessionId: z4.string(),
670
- conversationId: z4.string(),
671
- artifact: z4.record(z4.string(), z4.string()).optional(),
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(),
672
683
  // optional when run has no artifact
673
- volumes: z4.record(z4.string(), z4.string()).optional()
684
+ volumes: z5.record(z5.string(), z5.string()).optional()
674
685
  });
675
- var runStateSchema = z4.object({
686
+ var runStateSchema = z5.object({
676
687
  status: runStatusSchema,
677
688
  result: runResultSchema.optional(),
678
- error: z4.string().optional()
689
+ error: z5.string().optional()
679
690
  });
680
- var eventsResponseSchema = z4.object({
681
- events: z4.array(runEventSchema),
682
- hasMore: z4.boolean(),
683
- nextSequence: z4.number(),
691
+ var eventsResponseSchema = z5.object({
692
+ events: z5.array(runEventSchema),
693
+ hasMore: z5.boolean(),
694
+ nextSequence: z5.number(),
684
695
  run: runStateSchema,
685
- framework: z4.string()
696
+ framework: z5.string()
686
697
  });
687
698
  var runsMainContract = c3.router({
688
699
  /**
@@ -692,6 +703,7 @@ var runsMainContract = c3.router({
692
703
  create: {
693
704
  method: "POST",
694
705
  path: "/api/agent/runs",
706
+ headers: authHeadersSchema,
695
707
  body: unifiedRunRequestSchema,
696
708
  responses: {
697
709
  201: createRunResponseSchema,
@@ -710,8 +722,9 @@ var runsByIdContract = c3.router({
710
722
  getById: {
711
723
  method: "GET",
712
724
  path: "/api/agent/runs/:id",
713
- pathParams: z4.object({
714
- id: z4.string().min(1, "Run ID is required")
725
+ headers: authHeadersSchema,
726
+ pathParams: z5.object({
727
+ id: z5.string().min(1, "Run ID is required")
715
728
  }),
716
729
  responses: {
717
730
  200: getRunResponseSchema,
@@ -730,12 +743,13 @@ var runEventsContract = c3.router({
730
743
  getEvents: {
731
744
  method: "GET",
732
745
  path: "/api/agent/runs/:id/events",
733
- pathParams: z4.object({
734
- id: z4.string().min(1, "Run ID is required")
746
+ headers: authHeadersSchema,
747
+ pathParams: z5.object({
748
+ id: z5.string().min(1, "Run ID is required")
735
749
  }),
736
- query: z4.object({
737
- since: z4.coerce.number().default(-1),
738
- limit: z4.coerce.number().default(100)
750
+ query: z5.object({
751
+ since: z5.coerce.number().default(-1),
752
+ limit: z5.coerce.number().default(100)
739
753
  }),
740
754
  responses: {
741
755
  200: eventsResponseSchema,
@@ -745,50 +759,50 @@ var runEventsContract = c3.router({
745
759
  summary: "Get agent run events"
746
760
  }
747
761
  });
748
- var telemetryMetricSchema = z4.object({
749
- ts: z4.string(),
750
- cpu: z4.number(),
751
- mem_used: z4.number(),
752
- mem_total: z4.number(),
753
- disk_used: z4.number(),
754
- disk_total: z4.number()
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()
755
769
  });
756
- var systemLogResponseSchema = z4.object({
757
- systemLog: z4.string(),
758
- hasMore: z4.boolean()
770
+ var systemLogResponseSchema = z5.object({
771
+ systemLog: z5.string(),
772
+ hasMore: z5.boolean()
759
773
  });
760
- var metricsResponseSchema = z4.object({
761
- metrics: z4.array(telemetryMetricSchema),
762
- hasMore: z4.boolean()
774
+ var metricsResponseSchema = z5.object({
775
+ metrics: z5.array(telemetryMetricSchema),
776
+ hasMore: z5.boolean()
763
777
  });
764
- var agentEventsResponseSchema = z4.object({
765
- events: z4.array(runEventSchema),
766
- hasMore: z4.boolean(),
767
- framework: z4.string()
778
+ var agentEventsResponseSchema = z5.object({
779
+ events: z5.array(runEventSchema),
780
+ hasMore: z5.boolean(),
781
+ framework: z5.string()
768
782
  });
769
- var networkLogEntrySchema = z4.object({
770
- timestamp: z4.string(),
783
+ var networkLogEntrySchema = z5.object({
784
+ timestamp: z5.string(),
771
785
  // Common fields (all modes)
772
- mode: z4.enum(["mitm", "sni"]).optional(),
773
- action: z4.enum(["ALLOW", "DENY"]).optional(),
774
- host: z4.string().optional(),
775
- port: z4.number().optional(),
776
- rule_matched: z4.string().nullable().optional(),
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(),
777
791
  // MITM-only fields (optional)
778
- method: z4.string().optional(),
779
- url: z4.string().optional(),
780
- status: z4.number().optional(),
781
- latency_ms: z4.number().optional(),
782
- request_size: z4.number().optional(),
783
- response_size: z4.number().optional()
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()
784
798
  });
785
- var networkLogsResponseSchema = z4.object({
786
- networkLogs: z4.array(networkLogEntrySchema),
787
- hasMore: z4.boolean()
799
+ var networkLogsResponseSchema = z5.object({
800
+ networkLogs: z5.array(networkLogEntrySchema),
801
+ hasMore: z5.boolean()
788
802
  });
789
- var telemetryResponseSchema = z4.object({
790
- systemLog: z4.string(),
791
- metrics: z4.array(telemetryMetricSchema)
803
+ var telemetryResponseSchema = z5.object({
804
+ systemLog: z5.string(),
805
+ metrics: z5.array(telemetryMetricSchema)
792
806
  });
793
807
  var runTelemetryContract = c3.router({
794
808
  /**
@@ -798,8 +812,9 @@ var runTelemetryContract = c3.router({
798
812
  getTelemetry: {
799
813
  method: "GET",
800
814
  path: "/api/agent/runs/:id/telemetry",
801
- pathParams: z4.object({
802
- id: z4.string().min(1, "Run ID is required")
815
+ headers: authHeadersSchema,
816
+ pathParams: z5.object({
817
+ id: z5.string().min(1, "Run ID is required")
803
818
  }),
804
819
  responses: {
805
820
  200: telemetryResponseSchema,
@@ -817,13 +832,14 @@ var runSystemLogContract = c3.router({
817
832
  getSystemLog: {
818
833
  method: "GET",
819
834
  path: "/api/agent/runs/:id/telemetry/system-log",
820
- pathParams: z4.object({
821
- id: z4.string().min(1, "Run ID is required")
835
+ headers: authHeadersSchema,
836
+ pathParams: z5.object({
837
+ id: z5.string().min(1, "Run ID is required")
822
838
  }),
823
- query: z4.object({
824
- since: z4.coerce.number().optional(),
825
- limit: z4.coerce.number().min(1).max(100).default(5),
826
- order: z4.enum(["asc", "desc"]).default("desc")
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")
827
843
  }),
828
844
  responses: {
829
845
  200: systemLogResponseSchema,
@@ -841,13 +857,14 @@ var runMetricsContract = c3.router({
841
857
  getMetrics: {
842
858
  method: "GET",
843
859
  path: "/api/agent/runs/:id/telemetry/metrics",
844
- pathParams: z4.object({
845
- id: z4.string().min(1, "Run ID is required")
860
+ headers: authHeadersSchema,
861
+ pathParams: z5.object({
862
+ id: z5.string().min(1, "Run ID is required")
846
863
  }),
847
- query: z4.object({
848
- since: z4.coerce.number().optional(),
849
- limit: z4.coerce.number().min(1).max(100).default(5),
850
- order: z4.enum(["asc", "desc"]).default("desc")
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")
851
868
  }),
852
869
  responses: {
853
870
  200: metricsResponseSchema,
@@ -865,13 +882,14 @@ var runAgentEventsContract = c3.router({
865
882
  getAgentEvents: {
866
883
  method: "GET",
867
884
  path: "/api/agent/runs/:id/telemetry/agent",
868
- pathParams: z4.object({
869
- id: z4.string().min(1, "Run ID is required")
885
+ headers: authHeadersSchema,
886
+ pathParams: z5.object({
887
+ id: z5.string().min(1, "Run ID is required")
870
888
  }),
871
- query: z4.object({
872
- since: z4.coerce.number().optional(),
873
- limit: z4.coerce.number().min(1).max(100).default(5),
874
- order: z4.enum(["asc", "desc"]).default("desc")
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")
875
893
  }),
876
894
  responses: {
877
895
  200: agentEventsResponseSchema,
@@ -889,13 +907,14 @@ var runNetworkLogsContract = c3.router({
889
907
  getNetworkLogs: {
890
908
  method: "GET",
891
909
  path: "/api/agent/runs/:id/telemetry/network",
892
- pathParams: z4.object({
893
- id: z4.string().min(1, "Run ID is required")
910
+ headers: authHeadersSchema,
911
+ pathParams: z5.object({
912
+ id: z5.string().min(1, "Run ID is required")
894
913
  }),
895
- query: z4.object({
896
- since: z4.coerce.number().optional(),
897
- limit: z4.coerce.number().min(1).max(100).default(5),
898
- order: z4.enum(["asc", "desc"]).default("desc")
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")
899
918
  }),
900
919
  responses: {
901
920
  200: networkLogsResponseSchema,
@@ -907,20 +926,20 @@ var runNetworkLogsContract = c3.router({
907
926
  });
908
927
 
909
928
  // ../../packages/core/src/contracts/storages.ts
910
- import { z as z5 } from "zod";
929
+ import { z as z6 } from "zod";
911
930
  var c4 = initContract();
912
- var storageTypeSchema = z5.enum(["volume", "artifact"]);
913
- var versionQuerySchema = z5.preprocess(
931
+ var storageTypeSchema = z6.enum(["volume", "artifact"]);
932
+ var versionQuerySchema = z6.preprocess(
914
933
  (val) => val === void 0 || val === null ? void 0 : String(val),
915
- z5.string().regex(/^[a-f0-9]{8,64}$/i, "Version must be 8-64 hex characters").optional()
934
+ z6.string().regex(/^[a-f0-9]{8,64}$/i, "Version must be 8-64 hex characters").optional()
916
935
  );
917
- var uploadStorageResponseSchema = z5.object({
918
- name: z5.string(),
919
- versionId: z5.string(),
920
- size: z5.number(),
921
- fileCount: z5.number(),
936
+ var uploadStorageResponseSchema = z6.object({
937
+ name: z6.string(),
938
+ versionId: z6.string(),
939
+ size: z6.number(),
940
+ fileCount: z6.number(),
922
941
  type: storageTypeSchema,
923
- deduplicated: z5.boolean()
942
+ deduplicated: z6.boolean()
924
943
  });
925
944
  var storagesContract = c4.router({
926
945
  /**
@@ -937,6 +956,7 @@ var storagesContract = c4.router({
937
956
  upload: {
938
957
  method: "POST",
939
958
  path: "/api/storages",
959
+ headers: authHeadersSchema,
940
960
  contentType: "multipart/form-data",
941
961
  body: c4.type(),
942
962
  responses: {
@@ -960,8 +980,9 @@ var storagesContract = c4.router({
960
980
  download: {
961
981
  method: "GET",
962
982
  path: "/api/storages",
963
- query: z5.object({
964
- name: z5.string().min(1, "Storage name is required"),
983
+ headers: authHeadersSchema,
984
+ query: z6.object({
985
+ name: z6.string().min(1, "Storage name is required"),
965
986
  version: versionQuerySchema
966
987
  }),
967
988
  responses: {
@@ -978,40 +999,41 @@ var storagesContract = c4.router({
978
999
  summary: "Download storage archive"
979
1000
  }
980
1001
  });
981
- var fileEntryWithHashSchema = z5.object({
982
- path: z5.string().min(1, "File path is required"),
983
- hash: z5.string().length(64, "Hash must be SHA-256 (64 hex chars)"),
984
- size: z5.number().int().min(0, "Size must be non-negative")
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")
985
1006
  });
986
- var storageChangesSchema = z5.object({
987
- added: z5.array(z5.string()),
988
- modified: z5.array(z5.string()),
989
- deleted: z5.array(z5.string())
1007
+ var storageChangesSchema = z6.object({
1008
+ added: z6.array(z6.string()),
1009
+ modified: z6.array(z6.string()),
1010
+ deleted: z6.array(z6.string())
990
1011
  });
991
- var presignedUploadSchema = z5.object({
992
- key: z5.string(),
993
- presignedUrl: z5.string().url()
1012
+ var presignedUploadSchema = z6.object({
1013
+ key: z6.string(),
1014
+ presignedUrl: z6.string().url()
994
1015
  });
995
1016
  var storagesPrepareContract = c4.router({
996
1017
  prepare: {
997
1018
  method: "POST",
998
1019
  path: "/api/storages/prepare",
999
- body: z5.object({
1000
- storageName: z5.string().min(1, "Storage name is required"),
1020
+ headers: authHeadersSchema,
1021
+ body: z6.object({
1022
+ storageName: z6.string().min(1, "Storage name is required"),
1001
1023
  storageType: storageTypeSchema,
1002
- files: z5.array(fileEntryWithHashSchema),
1003
- force: z5.boolean().optional(),
1004
- runId: z5.string().optional(),
1024
+ files: z6.array(fileEntryWithHashSchema),
1025
+ force: z6.boolean().optional(),
1026
+ runId: z6.string().optional(),
1005
1027
  // For sandbox auth
1006
- baseVersion: z5.string().optional(),
1028
+ baseVersion: z6.string().optional(),
1007
1029
  // For incremental uploads
1008
1030
  changes: storageChangesSchema.optional()
1009
1031
  }),
1010
1032
  responses: {
1011
- 200: z5.object({
1012
- versionId: z5.string(),
1013
- existing: z5.boolean(),
1014
- uploads: z5.object({
1033
+ 200: z6.object({
1034
+ versionId: z6.string(),
1035
+ existing: z6.boolean(),
1036
+ uploads: z6.object({
1015
1037
  archive: presignedUploadSchema,
1016
1038
  manifest: presignedUploadSchema
1017
1039
  }).optional()
@@ -1028,22 +1050,23 @@ var storagesCommitContract = c4.router({
1028
1050
  commit: {
1029
1051
  method: "POST",
1030
1052
  path: "/api/storages/commit",
1031
- body: z5.object({
1032
- storageName: z5.string().min(1, "Storage name is required"),
1053
+ headers: authHeadersSchema,
1054
+ body: z6.object({
1055
+ storageName: z6.string().min(1, "Storage name is required"),
1033
1056
  storageType: storageTypeSchema,
1034
- versionId: z5.string().min(1, "Version ID is required"),
1035
- files: z5.array(fileEntryWithHashSchema),
1036
- runId: z5.string().optional(),
1037
- message: z5.string().optional()
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()
1038
1061
  }),
1039
1062
  responses: {
1040
- 200: z5.object({
1041
- success: z5.literal(true),
1042
- versionId: z5.string(),
1043
- storageName: z5.string(),
1044
- size: z5.number(),
1045
- fileCount: z5.number(),
1046
- deduplicated: z5.boolean().optional()
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()
1047
1070
  }),
1048
1071
  400: apiErrorSchema,
1049
1072
  401: apiErrorSchema,
@@ -1059,26 +1082,27 @@ var storagesDownloadContract = c4.router({
1059
1082
  download: {
1060
1083
  method: "GET",
1061
1084
  path: "/api/storages/download",
1062
- query: z5.object({
1063
- name: z5.string().min(1, "Storage name is required"),
1085
+ headers: authHeadersSchema,
1086
+ query: z6.object({
1087
+ name: z6.string().min(1, "Storage name is required"),
1064
1088
  type: storageTypeSchema,
1065
1089
  version: versionQuerySchema
1066
1090
  }),
1067
1091
  responses: {
1068
1092
  // Normal response with presigned URL
1069
- 200: z5.union([
1070
- z5.object({
1071
- url: z5.string().url(),
1072
- versionId: z5.string(),
1073
- fileCount: z5.number(),
1074
- size: z5.number()
1093
+ 200: z6.union([
1094
+ z6.object({
1095
+ url: z6.string().url(),
1096
+ versionId: z6.string(),
1097
+ fileCount: z6.number(),
1098
+ size: z6.number()
1075
1099
  }),
1076
1100
  // Empty artifact response
1077
- z5.object({
1078
- empty: z5.literal(true),
1079
- versionId: z5.string(),
1080
- fileCount: z5.literal(0),
1081
- size: z5.literal(0)
1101
+ z6.object({
1102
+ empty: z6.literal(true),
1103
+ versionId: z6.string(),
1104
+ fileCount: z6.literal(0),
1105
+ size: z6.literal(0)
1082
1106
  })
1083
1107
  ]),
1084
1108
  400: apiErrorSchema,
@@ -1093,16 +1117,17 @@ var storagesListContract = c4.router({
1093
1117
  list: {
1094
1118
  method: "GET",
1095
1119
  path: "/api/storages/list",
1096
- query: z5.object({
1120
+ headers: authHeadersSchema,
1121
+ query: z6.object({
1097
1122
  type: storageTypeSchema
1098
1123
  }),
1099
1124
  responses: {
1100
- 200: z5.array(
1101
- z5.object({
1102
- name: z5.string(),
1103
- size: z5.number(),
1104
- fileCount: z5.number(),
1105
- updatedAt: z5.string()
1125
+ 200: z6.array(
1126
+ z6.object({
1127
+ name: z6.string(),
1128
+ size: z6.number(),
1129
+ fileCount: z6.number(),
1130
+ updatedAt: z6.string()
1106
1131
  })
1107
1132
  ),
1108
1133
  401: apiErrorSchema,
@@ -1113,18 +1138,18 @@ var storagesListContract = c4.router({
1113
1138
  });
1114
1139
 
1115
1140
  // ../../packages/core/src/contracts/webhooks.ts
1116
- import { z as z6 } from "zod";
1141
+ import { z as z7 } from "zod";
1117
1142
  var c5 = initContract();
1118
- var agentEventSchema = z6.object({
1119
- type: z6.string(),
1120
- sequenceNumber: z6.number().int().nonnegative()
1143
+ var agentEventSchema = z7.object({
1144
+ type: z7.string(),
1145
+ sequenceNumber: z7.number().int().nonnegative()
1121
1146
  }).passthrough();
1122
- var artifactSnapshotSchema = z6.object({
1123
- artifactName: z6.string(),
1124
- artifactVersion: z6.string()
1147
+ var artifactSnapshotSchema = z7.object({
1148
+ artifactName: z7.string(),
1149
+ artifactVersion: z7.string()
1125
1150
  });
1126
- var volumeVersionsSnapshotSchema = z6.object({
1127
- versions: z6.record(z6.string(), z6.string())
1151
+ var volumeVersionsSnapshotSchema = z7.object({
1152
+ versions: z7.record(z7.string(), z7.string())
1128
1153
  });
1129
1154
  var webhookEventsContract = c5.router({
1130
1155
  /**
@@ -1134,15 +1159,16 @@ var webhookEventsContract = c5.router({
1134
1159
  send: {
1135
1160
  method: "POST",
1136
1161
  path: "/api/webhooks/agent/events",
1137
- body: z6.object({
1138
- runId: z6.string().min(1, "runId is required"),
1139
- events: z6.array(agentEventSchema).min(1, "events array cannot be empty")
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")
1140
1166
  }),
1141
1167
  responses: {
1142
- 200: z6.object({
1143
- received: z6.number(),
1144
- firstSequence: z6.number(),
1145
- lastSequence: z6.number()
1168
+ 200: z7.object({
1169
+ received: z7.number(),
1170
+ firstSequence: z7.number(),
1171
+ lastSequence: z7.number()
1146
1172
  }),
1147
1173
  400: apiErrorSchema,
1148
1174
  401: apiErrorSchema,
@@ -1160,15 +1186,16 @@ var webhookCompleteContract = c5.router({
1160
1186
  complete: {
1161
1187
  method: "POST",
1162
1188
  path: "/api/webhooks/agent/complete",
1163
- body: z6.object({
1164
- runId: z6.string().min(1, "runId is required"),
1165
- exitCode: z6.number(),
1166
- error: z6.string().optional()
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()
1167
1194
  }),
1168
1195
  responses: {
1169
- 200: z6.object({
1170
- success: z6.boolean(),
1171
- status: z6.enum(["completed", "failed"])
1196
+ 200: z7.object({
1197
+ success: z7.boolean(),
1198
+ status: z7.enum(["completed", "failed"])
1172
1199
  }),
1173
1200
  400: apiErrorSchema,
1174
1201
  401: apiErrorSchema,
@@ -1186,21 +1213,22 @@ var webhookCheckpointsContract = c5.router({
1186
1213
  create: {
1187
1214
  method: "POST",
1188
1215
  path: "/api/webhooks/agent/checkpoints",
1189
- body: z6.object({
1190
- runId: z6.string().min(1, "runId is required"),
1191
- cliAgentType: z6.string().min(1, "cliAgentType is required"),
1192
- cliAgentSessionId: z6.string().min(1, "cliAgentSessionId is required"),
1193
- cliAgentSessionHistory: z6.string().min(1, "cliAgentSessionHistory is required"),
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"),
1194
1222
  artifactSnapshot: artifactSnapshotSchema.optional(),
1195
1223
  volumeVersionsSnapshot: volumeVersionsSnapshotSchema.optional()
1196
1224
  }),
1197
1225
  responses: {
1198
- 200: z6.object({
1199
- checkpointId: z6.string(),
1200
- agentSessionId: z6.string(),
1201
- conversationId: z6.string(),
1226
+ 200: z7.object({
1227
+ checkpointId: z7.string(),
1228
+ agentSessionId: z7.string(),
1229
+ conversationId: z7.string(),
1202
1230
  artifact: artifactSnapshotSchema.optional(),
1203
- volumes: z6.record(z6.string(), z6.string()).optional()
1231
+ volumes: z7.record(z7.string(), z7.string()).optional()
1204
1232
  }),
1205
1233
  400: apiErrorSchema,
1206
1234
  401: apiErrorSchema,
@@ -1218,12 +1246,13 @@ var webhookHeartbeatContract = c5.router({
1218
1246
  send: {
1219
1247
  method: "POST",
1220
1248
  path: "/api/webhooks/agent/heartbeat",
1221
- body: z6.object({
1222
- runId: z6.string().min(1, "runId is required")
1249
+ headers: authHeadersSchema,
1250
+ body: z7.object({
1251
+ runId: z7.string().min(1, "runId is required")
1223
1252
  }),
1224
1253
  responses: {
1225
- 200: z6.object({
1226
- ok: z6.boolean()
1254
+ 200: z7.object({
1255
+ ok: z7.boolean()
1227
1256
  }),
1228
1257
  400: apiErrorSchema,
1229
1258
  401: apiErrorSchema,
@@ -1247,14 +1276,15 @@ var webhookStoragesContract = c5.router({
1247
1276
  upload: {
1248
1277
  method: "POST",
1249
1278
  path: "/api/webhooks/agent/storages",
1279
+ headers: authHeadersSchema,
1250
1280
  contentType: "multipart/form-data",
1251
1281
  body: c5.type(),
1252
1282
  responses: {
1253
- 200: z6.object({
1254
- versionId: z6.string(),
1255
- storageName: z6.string(),
1256
- size: z6.number(),
1257
- fileCount: z6.number()
1283
+ 200: z7.object({
1284
+ versionId: z7.string(),
1285
+ storageName: z7.string(),
1286
+ size: z7.number(),
1287
+ fileCount: z7.number()
1258
1288
  }),
1259
1289
  400: apiErrorSchema,
1260
1290
  401: apiErrorSchema,
@@ -1280,20 +1310,21 @@ var webhookStoragesIncrementalContract = c5.router({
1280
1310
  upload: {
1281
1311
  method: "POST",
1282
1312
  path: "/api/webhooks/agent/storages/incremental",
1313
+ headers: authHeadersSchema,
1283
1314
  contentType: "multipart/form-data",
1284
1315
  body: c5.type(),
1285
1316
  responses: {
1286
- 200: z6.object({
1287
- versionId: z6.string(),
1288
- storageName: z6.string(),
1289
- size: z6.number(),
1290
- fileCount: z6.number(),
1291
- incrementalStats: z6.object({
1292
- addedFiles: z6.number(),
1293
- modifiedFiles: z6.number(),
1294
- deletedFiles: z6.number(),
1295
- unchangedFiles: z6.number(),
1296
- bytesUploaded: z6.number()
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()
1297
1328
  }).optional()
1298
1329
  }),
1299
1330
  400: apiErrorSchema,
@@ -1304,36 +1335,36 @@ var webhookStoragesIncrementalContract = c5.router({
1304
1335
  summary: "Upload storage version incrementally from sandbox"
1305
1336
  }
1306
1337
  });
1307
- var metricDataSchema = z6.object({
1308
- ts: z6.string(),
1309
- cpu: z6.number(),
1310
- mem_used: z6.number(),
1311
- mem_total: z6.number(),
1312
- disk_used: z6.number(),
1313
- disk_total: z6.number()
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()
1314
1345
  });
1315
- var sandboxOperationSchema = z6.object({
1316
- ts: z6.string(),
1317
- action_type: z6.string(),
1318
- duration_ms: z6.number(),
1319
- success: z6.boolean(),
1320
- error: z6.string().optional()
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()
1321
1352
  });
1322
- var networkLogSchema = z6.object({
1323
- timestamp: z6.string(),
1353
+ var networkLogSchema = z7.object({
1354
+ timestamp: z7.string(),
1324
1355
  // Common fields (all modes)
1325
- mode: z6.enum(["mitm", "sni"]).optional(),
1326
- action: z6.enum(["ALLOW", "DENY"]).optional(),
1327
- host: z6.string().optional(),
1328
- port: z6.number().optional(),
1329
- rule_matched: z6.string().nullable().optional(),
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(),
1330
1361
  // MITM-only fields (optional)
1331
- method: z6.string().optional(),
1332
- url: z6.string().optional(),
1333
- status: z6.number().optional(),
1334
- latency_ms: z6.number().optional(),
1335
- request_size: z6.number().optional(),
1336
- response_size: z6.number().optional()
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()
1337
1368
  });
1338
1369
  var webhookTelemetryContract = c5.router({
1339
1370
  /**
@@ -1343,17 +1374,18 @@ var webhookTelemetryContract = c5.router({
1343
1374
  send: {
1344
1375
  method: "POST",
1345
1376
  path: "/api/webhooks/agent/telemetry",
1346
- body: z6.object({
1347
- runId: z6.string().min(1, "runId is required"),
1348
- systemLog: z6.string().optional(),
1349
- metrics: z6.array(metricDataSchema).optional(),
1350
- networkLogs: z6.array(networkLogSchema).optional(),
1351
- sandboxOperations: z6.array(sandboxOperationSchema).optional()
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()
1352
1384
  }),
1353
1385
  responses: {
1354
- 200: z6.object({
1355
- success: z6.boolean(),
1356
- id: z6.string()
1386
+ 200: z7.object({
1387
+ success: z7.boolean(),
1388
+ id: z7.string()
1357
1389
  }),
1358
1390
  400: apiErrorSchema,
1359
1391
  401: apiErrorSchema,
@@ -1367,21 +1399,22 @@ var webhookStoragesPrepareContract = c5.router({
1367
1399
  prepare: {
1368
1400
  method: "POST",
1369
1401
  path: "/api/webhooks/agent/storages/prepare",
1370
- body: z6.object({
1371
- runId: z6.string().min(1, "runId is required"),
1402
+ headers: authHeadersSchema,
1403
+ body: z7.object({
1404
+ runId: z7.string().min(1, "runId is required"),
1372
1405
  // Required for webhook auth
1373
- storageName: z6.string().min(1, "Storage name is required"),
1406
+ storageName: z7.string().min(1, "Storage name is required"),
1374
1407
  storageType: storageTypeSchema,
1375
- files: z6.array(fileEntryWithHashSchema),
1376
- force: z6.boolean().optional(),
1377
- baseVersion: z6.string().optional(),
1408
+ files: z7.array(fileEntryWithHashSchema),
1409
+ force: z7.boolean().optional(),
1410
+ baseVersion: z7.string().optional(),
1378
1411
  changes: storageChangesSchema.optional()
1379
1412
  }),
1380
1413
  responses: {
1381
- 200: z6.object({
1382
- versionId: z6.string(),
1383
- existing: z6.boolean(),
1384
- uploads: z6.object({
1414
+ 200: z7.object({
1415
+ versionId: z7.string(),
1416
+ existing: z7.boolean(),
1417
+ uploads: z7.object({
1385
1418
  archive: presignedUploadSchema,
1386
1419
  manifest: presignedUploadSchema
1387
1420
  }).optional()
@@ -1398,23 +1431,24 @@ var webhookStoragesCommitContract = c5.router({
1398
1431
  commit: {
1399
1432
  method: "POST",
1400
1433
  path: "/api/webhooks/agent/storages/commit",
1401
- body: z6.object({
1402
- runId: z6.string().min(1, "runId is required"),
1434
+ headers: authHeadersSchema,
1435
+ body: z7.object({
1436
+ runId: z7.string().min(1, "runId is required"),
1403
1437
  // Required for webhook auth
1404
- storageName: z6.string().min(1, "Storage name is required"),
1438
+ storageName: z7.string().min(1, "Storage name is required"),
1405
1439
  storageType: storageTypeSchema,
1406
- versionId: z6.string().min(1, "Version ID is required"),
1407
- files: z6.array(fileEntryWithHashSchema),
1408
- message: z6.string().optional()
1440
+ versionId: z7.string().min(1, "Version ID is required"),
1441
+ files: z7.array(fileEntryWithHashSchema),
1442
+ message: z7.string().optional()
1409
1443
  }),
1410
1444
  responses: {
1411
- 200: z6.object({
1412
- success: z6.literal(true),
1413
- versionId: z6.string(),
1414
- storageName: z6.string(),
1415
- size: z6.number(),
1416
- fileCount: z6.number(),
1417
- deduplicated: z6.boolean().optional()
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()
1418
1452
  }),
1419
1453
  400: apiErrorSchema,
1420
1454
  401: apiErrorSchema,
@@ -1428,11 +1462,11 @@ var webhookStoragesCommitContract = c5.router({
1428
1462
  });
1429
1463
 
1430
1464
  // ../../packages/core/src/contracts/cli-auth.ts
1431
- import { z as z7 } from "zod";
1465
+ import { z as z8 } from "zod";
1432
1466
  var c6 = initContract();
1433
- var oauthErrorSchema = z7.object({
1434
- error: z7.string(),
1435
- error_description: z7.string()
1467
+ var oauthErrorSchema = z8.object({
1468
+ error: z8.string(),
1469
+ error_description: z8.string()
1436
1470
  });
1437
1471
  var cliAuthDeviceContract = c6.router({
1438
1472
  /**
@@ -1442,14 +1476,14 @@ var cliAuthDeviceContract = c6.router({
1442
1476
  create: {
1443
1477
  method: "POST",
1444
1478
  path: "/api/cli/auth/device",
1445
- body: z7.object({}).optional(),
1479
+ body: z8.object({}).optional(),
1446
1480
  responses: {
1447
- 200: z7.object({
1448
- device_code: z7.string(),
1449
- user_code: z7.string(),
1450
- verification_url: z7.string(),
1451
- expires_in: z7.number(),
1452
- interval: z7.number()
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()
1453
1487
  }),
1454
1488
  500: oauthErrorSchema
1455
1489
  },
@@ -1464,16 +1498,16 @@ var cliAuthTokenContract = c6.router({
1464
1498
  exchange: {
1465
1499
  method: "POST",
1466
1500
  path: "/api/cli/auth/token",
1467
- body: z7.object({
1468
- device_code: z7.string().min(1, "device_code is required")
1501
+ body: z8.object({
1502
+ device_code: z8.string().min(1, "device_code is required")
1469
1503
  }),
1470
1504
  responses: {
1471
1505
  // Success - token issued
1472
- 200: z7.object({
1473
- access_token: z7.string(),
1474
- refresh_token: z7.string(),
1475
- token_type: z7.literal("Bearer"),
1476
- expires_in: z7.number()
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()
1477
1511
  }),
1478
1512
  // Authorization pending
1479
1513
  202: oauthErrorSchema,
@@ -1486,7 +1520,7 @@ var cliAuthTokenContract = c6.router({
1486
1520
  });
1487
1521
 
1488
1522
  // ../../packages/core/src/contracts/auth.ts
1489
- import { z as z8 } from "zod";
1523
+ import { z as z9 } from "zod";
1490
1524
  var c7 = initContract();
1491
1525
  var authContract = c7.router({
1492
1526
  /**
@@ -1496,10 +1530,11 @@ var authContract = c7.router({
1496
1530
  me: {
1497
1531
  method: "GET",
1498
1532
  path: "/api/auth/me",
1533
+ headers: authHeadersSchema,
1499
1534
  responses: {
1500
- 200: z8.object({
1501
- userId: z8.string(),
1502
- email: z8.string()
1535
+ 200: z9.object({
1536
+ userId: z9.string(),
1537
+ email: z9.string()
1503
1538
  }),
1504
1539
  401: apiErrorSchema,
1505
1540
  404: apiErrorSchema,
@@ -1510,18 +1545,18 @@ var authContract = c7.router({
1510
1545
  });
1511
1546
 
1512
1547
  // ../../packages/core/src/contracts/cron.ts
1513
- import { z as z9 } from "zod";
1548
+ import { z as z10 } from "zod";
1514
1549
  var c8 = initContract();
1515
- var cleanupResultSchema = z9.object({
1516
- runId: z9.string(),
1517
- sandboxId: z9.string().nullable(),
1518
- status: z9.enum(["cleaned", "error"]),
1519
- error: z9.string().optional()
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()
1520
1555
  });
1521
- var cleanupResponseSchema = z9.object({
1522
- cleaned: z9.number(),
1523
- errors: z9.number(),
1524
- results: z9.array(cleanupResultSchema)
1556
+ var cleanupResponseSchema = z10.object({
1557
+ cleaned: z10.number(),
1558
+ errors: z10.number(),
1559
+ results: z10.array(cleanupResultSchema)
1525
1560
  });
1526
1561
  var cronCleanupSandboxesContract = c8.router({
1527
1562
  /**
@@ -1531,6 +1566,7 @@ var cronCleanupSandboxesContract = c8.router({
1531
1566
  cleanup: {
1532
1567
  method: "GET",
1533
1568
  path: "/api/cron/cleanup-sandboxes",
1569
+ headers: authHeadersSchema,
1534
1570
  responses: {
1535
1571
  200: cleanupResponseSchema,
1536
1572
  401: apiErrorSchema,
@@ -1541,46 +1577,46 @@ var cronCleanupSandboxesContract = c8.router({
1541
1577
  });
1542
1578
 
1543
1579
  // ../../packages/core/src/contracts/proxy.ts
1544
- import { z as z10 } from "zod";
1545
- var proxyErrorSchema = z10.object({
1546
- error: z10.object({
1547
- message: z10.string(),
1548
- code: z10.enum([
1580
+ import { z as z11 } from "zod";
1581
+ var proxyErrorSchema = z11.object({
1582
+ error: z11.object({
1583
+ message: z11.string(),
1584
+ code: z11.enum([
1549
1585
  "UNAUTHORIZED",
1550
1586
  "BAD_REQUEST",
1551
1587
  "BAD_GATEWAY",
1552
1588
  "INTERNAL_ERROR"
1553
1589
  ]),
1554
- targetUrl: z10.string().optional()
1590
+ targetUrl: z11.string().optional()
1555
1591
  })
1556
1592
  });
1557
1593
 
1558
1594
  // ../../packages/core/src/contracts/scopes.ts
1559
- import { z as z11 } from "zod";
1595
+ import { z as z12 } from "zod";
1560
1596
  var c9 = initContract();
1561
- var scopeTypeSchema = z11.enum(["personal", "organization", "system"]);
1562
- var scopeSlugSchema = z11.string().min(3, "Scope slug must be at least 3 characters").max(64, "Scope slug must be at most 64 characters").regex(
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(
1563
1599
  /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]{1,2}$/,
1564
1600
  "Scope slug must contain only lowercase letters, numbers, and hyphens, and must start and end with an alphanumeric character"
1565
1601
  ).refine(
1566
1602
  (slug) => !slug.startsWith("vm0"),
1567
1603
  "Scope slug cannot start with 'vm0' (reserved)"
1568
1604
  ).transform((s) => s.toLowerCase());
1569
- var scopeResponseSchema = z11.object({
1570
- id: z11.string().uuid(),
1571
- slug: z11.string(),
1605
+ var scopeResponseSchema = z12.object({
1606
+ id: z12.string().uuid(),
1607
+ slug: z12.string(),
1572
1608
  type: scopeTypeSchema,
1573
- displayName: z11.string().nullable(),
1574
- createdAt: z11.string(),
1575
- updatedAt: z11.string()
1609
+ displayName: z12.string().nullable(),
1610
+ createdAt: z12.string(),
1611
+ updatedAt: z12.string()
1576
1612
  });
1577
- var createScopeRequestSchema = z11.object({
1613
+ var createScopeRequestSchema = z12.object({
1578
1614
  slug: scopeSlugSchema,
1579
- displayName: z11.string().max(128).optional()
1615
+ displayName: z12.string().max(128).optional()
1580
1616
  });
1581
- var updateScopeRequestSchema = z11.object({
1617
+ var updateScopeRequestSchema = z12.object({
1582
1618
  slug: scopeSlugSchema,
1583
- force: z11.boolean().optional().default(false)
1619
+ force: z12.boolean().optional().default(false)
1584
1620
  });
1585
1621
  var scopeContract = c9.router({
1586
1622
  /**
@@ -1590,6 +1626,7 @@ var scopeContract = c9.router({
1590
1626
  get: {
1591
1627
  method: "GET",
1592
1628
  path: "/api/scope",
1629
+ headers: authHeadersSchema,
1593
1630
  responses: {
1594
1631
  200: scopeResponseSchema,
1595
1632
  401: apiErrorSchema,
@@ -1605,6 +1642,7 @@ var scopeContract = c9.router({
1605
1642
  create: {
1606
1643
  method: "POST",
1607
1644
  path: "/api/scope",
1645
+ headers: authHeadersSchema,
1608
1646
  body: createScopeRequestSchema,
1609
1647
  responses: {
1610
1648
  201: scopeResponseSchema,
@@ -1622,6 +1660,7 @@ var scopeContract = c9.router({
1622
1660
  update: {
1623
1661
  method: "PUT",
1624
1662
  path: "/api/scope",
1663
+ headers: authHeadersSchema,
1625
1664
  body: updateScopeRequestSchema,
1626
1665
  responses: {
1627
1666
  200: scopeResponseSchema,
@@ -1637,28 +1676,28 @@ var scopeContract = c9.router({
1637
1676
  });
1638
1677
 
1639
1678
  // ../../packages/core/src/contracts/credentials.ts
1640
- import { z as z12 } from "zod";
1679
+ import { z as z13 } from "zod";
1641
1680
  var c10 = initContract();
1642
- var credentialNameSchema = z12.string().min(1, "Credential name is required").max(255, "Credential name must be at most 255 characters").regex(
1681
+ var credentialNameSchema = z13.string().min(1, "Credential name is required").max(255, "Credential name must be at most 255 characters").regex(
1643
1682
  /^[A-Z][A-Z0-9_]*$/,
1644
1683
  "Credential name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
1645
1684
  );
1646
- var credentialTypeSchema = z12.enum(["user", "model-provider"]);
1647
- var credentialResponseSchema = z12.object({
1648
- id: z12.string().uuid(),
1649
- name: z12.string(),
1650
- description: z12.string().nullable(),
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(),
1651
1690
  type: credentialTypeSchema,
1652
- createdAt: z12.string(),
1653
- updatedAt: z12.string()
1691
+ createdAt: z13.string(),
1692
+ updatedAt: z13.string()
1654
1693
  });
1655
- var credentialListResponseSchema = z12.object({
1656
- credentials: z12.array(credentialResponseSchema)
1694
+ var credentialListResponseSchema = z13.object({
1695
+ credentials: z13.array(credentialResponseSchema)
1657
1696
  });
1658
- var setCredentialRequestSchema = z12.object({
1697
+ var setCredentialRequestSchema = z13.object({
1659
1698
  name: credentialNameSchema,
1660
- value: z12.string().min(1, "Credential value is required"),
1661
- description: z12.string().max(1e3).optional()
1699
+ value: z13.string().min(1, "Credential value is required"),
1700
+ description: z13.string().max(1e3).optional()
1662
1701
  });
1663
1702
  var credentialsMainContract = c10.router({
1664
1703
  /**
@@ -1668,6 +1707,7 @@ var credentialsMainContract = c10.router({
1668
1707
  list: {
1669
1708
  method: "GET",
1670
1709
  path: "/api/credentials",
1710
+ headers: authHeadersSchema,
1671
1711
  responses: {
1672
1712
  200: credentialListResponseSchema,
1673
1713
  401: apiErrorSchema,
@@ -1682,6 +1722,7 @@ var credentialsMainContract = c10.router({
1682
1722
  set: {
1683
1723
  method: "PUT",
1684
1724
  path: "/api/credentials",
1725
+ headers: authHeadersSchema,
1685
1726
  body: setCredentialRequestSchema,
1686
1727
  responses: {
1687
1728
  200: credentialResponseSchema,
@@ -1701,7 +1742,8 @@ var credentialsByNameContract = c10.router({
1701
1742
  get: {
1702
1743
  method: "GET",
1703
1744
  path: "/api/credentials/:name",
1704
- pathParams: z12.object({
1745
+ headers: authHeadersSchema,
1746
+ pathParams: z13.object({
1705
1747
  name: credentialNameSchema
1706
1748
  }),
1707
1749
  responses: {
@@ -1719,11 +1761,12 @@ var credentialsByNameContract = c10.router({
1719
1761
  delete: {
1720
1762
  method: "DELETE",
1721
1763
  path: "/api/credentials/:name",
1722
- pathParams: z12.object({
1764
+ headers: authHeadersSchema,
1765
+ pathParams: z13.object({
1723
1766
  name: credentialNameSchema
1724
1767
  }),
1725
1768
  responses: {
1726
- 204: z12.undefined(),
1769
+ 204: z13.undefined(),
1727
1770
  401: apiErrorSchema,
1728
1771
  404: apiErrorSchema,
1729
1772
  500: apiErrorSchema
@@ -1733,7 +1776,7 @@ var credentialsByNameContract = c10.router({
1733
1776
  });
1734
1777
 
1735
1778
  // ../../packages/core/src/contracts/model-providers.ts
1736
- import { z as z13 } from "zod";
1779
+ import { z as z14 } from "zod";
1737
1780
  var c11 = initContract();
1738
1781
  var MODEL_PROVIDER_TYPES = {
1739
1782
  "claude-code-oauth-token": {
@@ -1758,42 +1801,43 @@ var MODEL_PROVIDER_TYPES = {
1758
1801
  helpText: "Get your API key at: https://platform.openai.com/api-keys"
1759
1802
  }
1760
1803
  };
1761
- var modelProviderTypeSchema = z13.enum([
1804
+ var modelProviderTypeSchema = z14.enum([
1762
1805
  "claude-code-oauth-token",
1763
1806
  "anthropic-api-key",
1764
1807
  "openai-api-key"
1765
1808
  ]);
1766
- var modelProviderFrameworkSchema = z13.enum(["claude-code", "codex"]);
1767
- var modelProviderResponseSchema = z13.object({
1768
- id: z13.string().uuid(),
1809
+ var modelProviderFrameworkSchema = z14.enum(["claude-code", "codex"]);
1810
+ var modelProviderResponseSchema = z14.object({
1811
+ id: z14.string().uuid(),
1769
1812
  type: modelProviderTypeSchema,
1770
1813
  framework: modelProviderFrameworkSchema,
1771
- credentialName: z13.string(),
1772
- isDefault: z13.boolean(),
1773
- createdAt: z13.string(),
1774
- updatedAt: z13.string()
1814
+ credentialName: z14.string(),
1815
+ isDefault: z14.boolean(),
1816
+ createdAt: z14.string(),
1817
+ updatedAt: z14.string()
1775
1818
  });
1776
- var modelProviderListResponseSchema = z13.object({
1777
- modelProviders: z13.array(modelProviderResponseSchema)
1819
+ var modelProviderListResponseSchema = z14.object({
1820
+ modelProviders: z14.array(modelProviderResponseSchema)
1778
1821
  });
1779
- var upsertModelProviderRequestSchema = z13.object({
1822
+ var upsertModelProviderRequestSchema = z14.object({
1780
1823
  type: modelProviderTypeSchema,
1781
- credential: z13.string().min(1, "Credential is required"),
1782
- convert: z13.boolean().optional()
1824
+ credential: z14.string().min(1, "Credential is required"),
1825
+ convert: z14.boolean().optional()
1783
1826
  });
1784
- var upsertModelProviderResponseSchema = z13.object({
1827
+ var upsertModelProviderResponseSchema = z14.object({
1785
1828
  provider: modelProviderResponseSchema,
1786
- created: z13.boolean()
1829
+ created: z14.boolean()
1787
1830
  });
1788
- var checkCredentialResponseSchema = z13.object({
1789
- exists: z13.boolean(),
1790
- credentialName: z13.string(),
1791
- currentType: z13.enum(["user", "model-provider"]).optional()
1831
+ var checkCredentialResponseSchema = z14.object({
1832
+ exists: z14.boolean(),
1833
+ credentialName: z14.string(),
1834
+ currentType: z14.enum(["user", "model-provider"]).optional()
1792
1835
  });
1793
1836
  var modelProvidersMainContract = c11.router({
1794
1837
  list: {
1795
1838
  method: "GET",
1796
1839
  path: "/api/model-providers",
1840
+ headers: authHeadersSchema,
1797
1841
  responses: {
1798
1842
  200: modelProviderListResponseSchema,
1799
1843
  401: apiErrorSchema,
@@ -1804,6 +1848,7 @@ var modelProvidersMainContract = c11.router({
1804
1848
  upsert: {
1805
1849
  method: "PUT",
1806
1850
  path: "/api/model-providers",
1851
+ headers: authHeadersSchema,
1807
1852
  body: upsertModelProviderRequestSchema,
1808
1853
  responses: {
1809
1854
  200: upsertModelProviderResponseSchema,
@@ -1820,7 +1865,8 @@ var modelProvidersCheckContract = c11.router({
1820
1865
  check: {
1821
1866
  method: "GET",
1822
1867
  path: "/api/model-providers/check/:type",
1823
- pathParams: z13.object({
1868
+ headers: authHeadersSchema,
1869
+ pathParams: z14.object({
1824
1870
  type: modelProviderTypeSchema
1825
1871
  }),
1826
1872
  responses: {
@@ -1835,11 +1881,12 @@ var modelProvidersByTypeContract = c11.router({
1835
1881
  delete: {
1836
1882
  method: "DELETE",
1837
1883
  path: "/api/model-providers/:type",
1838
- pathParams: z13.object({
1884
+ headers: authHeadersSchema,
1885
+ pathParams: z14.object({
1839
1886
  type: modelProviderTypeSchema
1840
1887
  }),
1841
1888
  responses: {
1842
- 204: z13.undefined(),
1889
+ 204: z14.undefined(),
1843
1890
  401: apiErrorSchema,
1844
1891
  404: apiErrorSchema,
1845
1892
  500: apiErrorSchema
@@ -1851,10 +1898,11 @@ var modelProvidersConvertContract = c11.router({
1851
1898
  convert: {
1852
1899
  method: "POST",
1853
1900
  path: "/api/model-providers/:type/convert",
1854
- pathParams: z13.object({
1901
+ headers: authHeadersSchema,
1902
+ pathParams: z14.object({
1855
1903
  type: modelProviderTypeSchema
1856
1904
  }),
1857
- body: z13.undefined(),
1905
+ body: z14.undefined(),
1858
1906
  responses: {
1859
1907
  200: modelProviderResponseSchema,
1860
1908
  400: apiErrorSchema,
@@ -1869,10 +1917,11 @@ var modelProvidersSetDefaultContract = c11.router({
1869
1917
  setDefault: {
1870
1918
  method: "POST",
1871
1919
  path: "/api/model-providers/:type/set-default",
1872
- pathParams: z13.object({
1920
+ headers: authHeadersSchema,
1921
+ pathParams: z14.object({
1873
1922
  type: modelProviderTypeSchema
1874
1923
  }),
1875
- body: z13.undefined(),
1924
+ body: z14.undefined(),
1876
1925
  responses: {
1877
1926
  200: modelProviderResponseSchema,
1878
1927
  401: apiErrorSchema,
@@ -1884,40 +1933,40 @@ var modelProvidersSetDefaultContract = c11.router({
1884
1933
  });
1885
1934
 
1886
1935
  // ../../packages/core/src/contracts/sessions.ts
1887
- import { z as z14 } from "zod";
1936
+ import { z as z15 } from "zod";
1888
1937
  var c12 = initContract();
1889
- var sessionResponseSchema = z14.object({
1890
- id: z14.string(),
1891
- agentComposeId: z14.string(),
1892
- agentComposeVersionId: z14.string().nullable(),
1893
- conversationId: z14.string().nullable(),
1894
- artifactName: z14.string().nullable(),
1895
- vars: z14.record(z14.string(), z14.string()).nullable(),
1896
- secretNames: z14.array(z14.string()).nullable(),
1897
- volumeVersions: z14.record(z14.string(), z14.string()).nullable(),
1898
- createdAt: z14.string(),
1899
- updatedAt: z14.string()
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()
1900
1949
  });
1901
- var agentComposeSnapshotSchema = z14.object({
1902
- agentComposeVersionId: z14.string(),
1903
- vars: z14.record(z14.string(), z14.string()).optional(),
1904
- secretNames: z14.array(z14.string()).optional()
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()
1905
1954
  });
1906
- var artifactSnapshotSchema2 = z14.object({
1907
- artifactName: z14.string(),
1908
- artifactVersion: z14.string()
1955
+ var artifactSnapshotSchema2 = z15.object({
1956
+ artifactName: z15.string(),
1957
+ artifactVersion: z15.string()
1909
1958
  });
1910
- var volumeVersionsSnapshotSchema2 = z14.object({
1911
- versions: z14.record(z14.string(), z14.string())
1959
+ var volumeVersionsSnapshotSchema2 = z15.object({
1960
+ versions: z15.record(z15.string(), z15.string())
1912
1961
  });
1913
- var checkpointResponseSchema = z14.object({
1914
- id: z14.string(),
1915
- runId: z14.string(),
1916
- conversationId: z14.string(),
1962
+ var checkpointResponseSchema = z15.object({
1963
+ id: z15.string(),
1964
+ runId: z15.string(),
1965
+ conversationId: z15.string(),
1917
1966
  agentComposeSnapshot: agentComposeSnapshotSchema,
1918
1967
  artifactSnapshot: artifactSnapshotSchema2.nullable(),
1919
1968
  volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
1920
- createdAt: z14.string()
1969
+ createdAt: z15.string()
1921
1970
  });
1922
1971
  var sessionsByIdContract = c12.router({
1923
1972
  /**
@@ -1927,8 +1976,9 @@ var sessionsByIdContract = c12.router({
1927
1976
  getById: {
1928
1977
  method: "GET",
1929
1978
  path: "/api/agent/sessions/:id",
1930
- pathParams: z14.object({
1931
- id: z14.string().min(1, "Session ID is required")
1979
+ headers: authHeadersSchema,
1980
+ pathParams: z15.object({
1981
+ id: z15.string().min(1, "Session ID is required")
1932
1982
  }),
1933
1983
  responses: {
1934
1984
  200: sessionResponseSchema,
@@ -1947,8 +1997,9 @@ var checkpointsByIdContract = c12.router({
1947
1997
  getById: {
1948
1998
  method: "GET",
1949
1999
  path: "/api/agent/checkpoints/:id",
1950
- pathParams: z14.object({
1951
- id: z14.string().min(1, "Checkpoint ID is required")
2000
+ headers: authHeadersSchema,
2001
+ pathParams: z15.object({
2002
+ id: z15.string().min(1, "Checkpoint ID is required")
1952
2003
  }),
1953
2004
  responses: {
1954
2005
  200: checkpointResponseSchema,
@@ -1961,88 +2012,88 @@ var checkpointsByIdContract = c12.router({
1961
2012
  });
1962
2013
 
1963
2014
  // ../../packages/core/src/contracts/schedules.ts
1964
- import { z as z15 } from "zod";
2015
+ import { z as z16 } from "zod";
1965
2016
  var c13 = initContract();
1966
- var scheduleTriggerSchema = z15.object({
1967
- cron: z15.string().optional(),
1968
- at: z15.string().optional(),
1969
- timezone: z15.string().default("UTC")
2017
+ var scheduleTriggerSchema = z16.object({
2018
+ cron: z16.string().optional(),
2019
+ at: z16.string().optional(),
2020
+ timezone: z16.string().default("UTC")
1970
2021
  }).refine((data) => data.cron && !data.at || !data.cron && data.at, {
1971
2022
  message: "Exactly one of 'cron' or 'at' must be specified"
1972
2023
  });
1973
- var scheduleRunConfigSchema = z15.object({
1974
- agent: z15.string().min(1, "Agent reference required"),
1975
- prompt: z15.string().min(1, "Prompt required"),
1976
- vars: z15.record(z15.string(), z15.string()).optional(),
1977
- secrets: z15.record(z15.string(), z15.string()).optional(),
1978
- artifactName: z15.string().optional(),
1979
- artifactVersion: z15.string().optional(),
1980
- volumeVersions: z15.record(z15.string(), z15.string()).optional()
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()
1981
2032
  });
1982
- var scheduleDefinitionSchema = z15.object({
2033
+ var scheduleDefinitionSchema = z16.object({
1983
2034
  on: scheduleTriggerSchema,
1984
2035
  run: scheduleRunConfigSchema
1985
2036
  });
1986
- var scheduleYamlSchema = z15.object({
1987
- version: z15.literal("1.0"),
1988
- schedules: z15.record(z15.string(), scheduleDefinitionSchema)
1989
- });
1990
- var deployScheduleRequestSchema = z15.object({
1991
- name: z15.string().min(1).max(64, "Schedule name max 64 chars"),
1992
- cronExpression: z15.string().optional(),
1993
- atTime: z15.string().optional(),
1994
- timezone: z15.string().default("UTC"),
1995
- prompt: z15.string().min(1, "Prompt required"),
1996
- vars: z15.record(z15.string(), z15.string()).optional(),
1997
- secrets: z15.record(z15.string(), z15.string()).optional(),
1998
- artifactName: z15.string().optional(),
1999
- artifactVersion: z15.string().optional(),
2000
- volumeVersions: z15.record(z15.string(), z15.string()).optional(),
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(),
2001
2052
  // Resolved agent compose ID (CLI resolves scope/name:version → composeId)
2002
- composeId: z15.string().uuid("Invalid compose ID")
2053
+ composeId: z16.string().uuid("Invalid compose ID")
2003
2054
  }).refine(
2004
2055
  (data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
2005
2056
  {
2006
2057
  message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
2007
2058
  }
2008
2059
  );
2009
- var scheduleResponseSchema = z15.object({
2010
- id: z15.string().uuid(),
2011
- composeId: z15.string().uuid(),
2012
- composeName: z15.string(),
2013
- scopeSlug: z15.string(),
2014
- name: z15.string(),
2015
- cronExpression: z15.string().nullable(),
2016
- atTime: z15.string().nullable(),
2017
- timezone: z15.string(),
2018
- prompt: z15.string(),
2019
- vars: z15.record(z15.string(), z15.string()).nullable(),
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(),
2020
2071
  // Secret names only (values are never returned)
2021
- secretNames: z15.array(z15.string()).nullable(),
2022
- artifactName: z15.string().nullable(),
2023
- artifactVersion: z15.string().nullable(),
2024
- volumeVersions: z15.record(z15.string(), z15.string()).nullable(),
2025
- enabled: z15.boolean(),
2026
- nextRunAt: z15.string().nullable(),
2027
- createdAt: z15.string(),
2028
- updatedAt: z15.string()
2029
- });
2030
- var runSummarySchema = z15.object({
2031
- id: z15.string().uuid(),
2032
- status: z15.enum(["pending", "running", "completed", "failed", "timeout"]),
2033
- createdAt: z15.string(),
2034
- completedAt: z15.string().nullable(),
2035
- error: z15.string().nullable()
2036
- });
2037
- var scheduleRunsResponseSchema = z15.object({
2038
- runs: z15.array(runSummarySchema)
2039
- });
2040
- var scheduleListResponseSchema = z15.object({
2041
- schedules: z15.array(scheduleResponseSchema)
2042
- });
2043
- var deployScheduleResponseSchema = z15.object({
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({
2044
2095
  schedule: scheduleResponseSchema,
2045
- created: z15.boolean()
2096
+ created: z16.boolean()
2046
2097
  // true if created, false if updated
2047
2098
  });
2048
2099
  var schedulesMainContract = c13.router({
@@ -2053,6 +2104,7 @@ var schedulesMainContract = c13.router({
2053
2104
  deploy: {
2054
2105
  method: "POST",
2055
2106
  path: "/api/agent/schedules",
2107
+ headers: authHeadersSchema,
2056
2108
  body: deployScheduleRequestSchema,
2057
2109
  responses: {
2058
2110
  200: deployScheduleResponseSchema,
@@ -2074,6 +2126,7 @@ var schedulesMainContract = c13.router({
2074
2126
  list: {
2075
2127
  method: "GET",
2076
2128
  path: "/api/agent/schedules",
2129
+ headers: authHeadersSchema,
2077
2130
  responses: {
2078
2131
  200: scheduleListResponseSchema,
2079
2132
  401: apiErrorSchema
@@ -2089,11 +2142,12 @@ var schedulesByNameContract = c13.router({
2089
2142
  getByName: {
2090
2143
  method: "GET",
2091
2144
  path: "/api/agent/schedules/:name",
2092
- pathParams: z15.object({
2093
- name: z15.string().min(1, "Schedule name required")
2145
+ headers: authHeadersSchema,
2146
+ pathParams: z16.object({
2147
+ name: z16.string().min(1, "Schedule name required")
2094
2148
  }),
2095
- query: z15.object({
2096
- composeId: z15.string().uuid("Compose ID required")
2149
+ query: z16.object({
2150
+ composeId: z16.string().uuid("Compose ID required")
2097
2151
  }),
2098
2152
  responses: {
2099
2153
  200: scheduleResponseSchema,
@@ -2109,14 +2163,15 @@ var schedulesByNameContract = c13.router({
2109
2163
  delete: {
2110
2164
  method: "DELETE",
2111
2165
  path: "/api/agent/schedules/:name",
2112
- pathParams: z15.object({
2113
- name: z15.string().min(1, "Schedule name required")
2166
+ headers: authHeadersSchema,
2167
+ pathParams: z16.object({
2168
+ name: z16.string().min(1, "Schedule name required")
2114
2169
  }),
2115
- query: z15.object({
2116
- composeId: z15.string().uuid("Compose ID required")
2170
+ query: z16.object({
2171
+ composeId: z16.string().uuid("Compose ID required")
2117
2172
  }),
2118
2173
  responses: {
2119
- 204: z15.undefined(),
2174
+ 204: z16.undefined(),
2120
2175
  401: apiErrorSchema,
2121
2176
  404: apiErrorSchema
2122
2177
  },
@@ -2131,11 +2186,12 @@ var schedulesEnableContract = c13.router({
2131
2186
  enable: {
2132
2187
  method: "POST",
2133
2188
  path: "/api/agent/schedules/:name/enable",
2134
- pathParams: z15.object({
2135
- name: z15.string().min(1, "Schedule name required")
2189
+ headers: authHeadersSchema,
2190
+ pathParams: z16.object({
2191
+ name: z16.string().min(1, "Schedule name required")
2136
2192
  }),
2137
- body: z15.object({
2138
- composeId: z15.string().uuid("Compose ID required")
2193
+ body: z16.object({
2194
+ composeId: z16.string().uuid("Compose ID required")
2139
2195
  }),
2140
2196
  responses: {
2141
2197
  200: scheduleResponseSchema,
@@ -2151,11 +2207,12 @@ var schedulesEnableContract = c13.router({
2151
2207
  disable: {
2152
2208
  method: "POST",
2153
2209
  path: "/api/agent/schedules/:name/disable",
2154
- pathParams: z15.object({
2155
- name: z15.string().min(1, "Schedule name required")
2210
+ headers: authHeadersSchema,
2211
+ pathParams: z16.object({
2212
+ name: z16.string().min(1, "Schedule name required")
2156
2213
  }),
2157
- body: z15.object({
2158
- composeId: z15.string().uuid("Compose ID required")
2214
+ body: z16.object({
2215
+ composeId: z16.string().uuid("Compose ID required")
2159
2216
  }),
2160
2217
  responses: {
2161
2218
  200: scheduleResponseSchema,
@@ -2173,12 +2230,13 @@ var scheduleRunsContract = c13.router({
2173
2230
  listRuns: {
2174
2231
  method: "GET",
2175
2232
  path: "/api/agent/schedules/:name/runs",
2176
- pathParams: z15.object({
2177
- name: z15.string().min(1, "Schedule name required")
2233
+ headers: authHeadersSchema,
2234
+ pathParams: z16.object({
2235
+ name: z16.string().min(1, "Schedule name required")
2178
2236
  }),
2179
- query: z15.object({
2180
- composeId: z15.string().uuid("Compose ID required"),
2181
- limit: z15.coerce.number().min(0).max(100).default(5)
2237
+ query: z16.object({
2238
+ composeId: z16.string().uuid("Compose ID required"),
2239
+ limit: z16.coerce.number().min(0).max(100).default(5)
2182
2240
  }),
2183
2241
  responses: {
2184
2242
  200: scheduleRunsResponseSchema,
@@ -2190,16 +2248,16 @@ var scheduleRunsContract = c13.router({
2190
2248
  });
2191
2249
 
2192
2250
  // ../../packages/core/src/contracts/realtime.ts
2193
- import { z as z16 } from "zod";
2251
+ import { z as z17 } from "zod";
2194
2252
  var c14 = initContract();
2195
- var ablyTokenRequestSchema = z16.object({
2196
- keyName: z16.string(),
2197
- ttl: z16.number().optional(),
2198
- timestamp: z16.number(),
2199
- capability: z16.string(),
2200
- clientId: z16.string().optional(),
2201
- nonce: z16.string(),
2202
- mac: z16.string()
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()
2203
2261
  });
2204
2262
  var realtimeTokenContract = c14.router({
2205
2263
  /**
@@ -2209,8 +2267,9 @@ var realtimeTokenContract = c14.router({
2209
2267
  create: {
2210
2268
  method: "POST",
2211
2269
  path: "/api/realtime/token",
2212
- body: z16.object({
2213
- runId: z16.string().uuid("runId must be a valid UUID")
2270
+ headers: authHeadersSchema,
2271
+ body: z17.object({
2272
+ runId: z17.string().uuid("runId must be a valid UUID")
2214
2273
  }),
2215
2274
  responses: {
2216
2275
  200: ablyTokenRequestSchema,
@@ -2224,8 +2283,8 @@ var realtimeTokenContract = c14.router({
2224
2283
  });
2225
2284
 
2226
2285
  // ../../packages/core/src/contracts/public/common.ts
2227
- import { z as z17 } from "zod";
2228
- var publicApiErrorTypeSchema = z17.enum([
2286
+ import { z as z18 } from "zod";
2287
+ var publicApiErrorTypeSchema = z18.enum([
2229
2288
  "api_error",
2230
2289
  // Internal server error (5xx)
2231
2290
  "invalid_request_error",
@@ -2237,58 +2296,59 @@ var publicApiErrorTypeSchema = z17.enum([
2237
2296
  "conflict_error"
2238
2297
  // Resource conflict (409)
2239
2298
  ]);
2240
- var publicApiErrorSchema = z17.object({
2241
- error: z17.object({
2299
+ var publicApiErrorSchema = z18.object({
2300
+ error: z18.object({
2242
2301
  type: publicApiErrorTypeSchema,
2243
- code: z17.string(),
2244
- message: z17.string(),
2245
- param: z17.string().optional(),
2246
- doc_url: z17.string().url().optional()
2302
+ code: z18.string(),
2303
+ message: z18.string(),
2304
+ param: z18.string().optional(),
2305
+ doc_url: z18.string().url().optional()
2247
2306
  })
2248
2307
  });
2249
- var paginationSchema = z17.object({
2250
- has_more: z17.boolean(),
2251
- next_cursor: z17.string().nullable()
2308
+ var paginationSchema = z18.object({
2309
+ has_more: z18.boolean(),
2310
+ next_cursor: z18.string().nullable()
2252
2311
  });
2253
2312
  function createPaginatedResponseSchema(dataSchema) {
2254
- return z17.object({
2255
- data: z17.array(dataSchema),
2313
+ return z18.object({
2314
+ data: z18.array(dataSchema),
2256
2315
  pagination: paginationSchema
2257
2316
  });
2258
2317
  }
2259
- var listQuerySchema = z17.object({
2260
- cursor: z17.string().optional(),
2261
- limit: z17.coerce.number().min(1).max(100).default(20)
2318
+ var listQuerySchema = z18.object({
2319
+ cursor: z18.string().optional(),
2320
+ limit: z18.coerce.number().min(1).max(100).default(20)
2262
2321
  });
2263
- var requestIdSchema = z17.string().uuid();
2264
- var timestampSchema = z17.string().datetime();
2322
+ var requestIdSchema = z18.string().uuid();
2323
+ var timestampSchema = z18.string().datetime();
2265
2324
 
2266
2325
  // ../../packages/core/src/contracts/public/agents.ts
2267
- import { z as z18 } from "zod";
2326
+ import { z as z19 } from "zod";
2268
2327
  var c15 = initContract();
2269
- var publicAgentSchema = z18.object({
2270
- id: z18.string(),
2271
- name: z18.string(),
2272
- current_version_id: z18.string().nullable(),
2328
+ var publicAgentSchema = z19.object({
2329
+ id: z19.string(),
2330
+ name: z19.string(),
2331
+ current_version_id: z19.string().nullable(),
2273
2332
  created_at: timestampSchema,
2274
2333
  updated_at: timestampSchema
2275
2334
  });
2276
- var agentVersionSchema = z18.object({
2277
- id: z18.string(),
2278
- agent_id: z18.string(),
2279
- version_number: z18.number(),
2335
+ var agentVersionSchema = z19.object({
2336
+ id: z19.string(),
2337
+ agent_id: z19.string(),
2338
+ version_number: z19.number(),
2280
2339
  created_at: timestampSchema
2281
2340
  });
2282
2341
  var publicAgentDetailSchema = publicAgentSchema;
2283
2342
  var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
2284
2343
  var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
2285
2344
  var agentListQuerySchema = listQuerySchema.extend({
2286
- name: z18.string().optional()
2345
+ name: z19.string().optional()
2287
2346
  });
2288
2347
  var publicAgentsListContract = c15.router({
2289
2348
  list: {
2290
2349
  method: "GET",
2291
2350
  path: "/v1/agents",
2351
+ headers: authHeadersSchema,
2292
2352
  query: agentListQuerySchema,
2293
2353
  responses: {
2294
2354
  200: paginatedAgentsSchema,
@@ -2303,8 +2363,9 @@ var publicAgentByIdContract = c15.router({
2303
2363
  get: {
2304
2364
  method: "GET",
2305
2365
  path: "/v1/agents/:id",
2306
- pathParams: z18.object({
2307
- id: z18.string().min(1, "Agent ID is required")
2366
+ headers: authHeadersSchema,
2367
+ pathParams: z19.object({
2368
+ id: z19.string().min(1, "Agent ID is required")
2308
2369
  }),
2309
2370
  responses: {
2310
2371
  200: publicAgentDetailSchema,
@@ -2320,8 +2381,9 @@ var publicAgentVersionsContract = c15.router({
2320
2381
  list: {
2321
2382
  method: "GET",
2322
2383
  path: "/v1/agents/:id/versions",
2323
- pathParams: z18.object({
2324
- id: z18.string().min(1, "Agent ID is required")
2384
+ headers: authHeadersSchema,
2385
+ pathParams: z19.object({
2386
+ id: z19.string().min(1, "Agent ID is required")
2325
2387
  }),
2326
2388
  query: listQuerySchema,
2327
2389
  responses: {
@@ -2336,9 +2398,9 @@ var publicAgentVersionsContract = c15.router({
2336
2398
  });
2337
2399
 
2338
2400
  // ../../packages/core/src/contracts/public/runs.ts
2339
- import { z as z19 } from "zod";
2401
+ import { z as z20 } from "zod";
2340
2402
  var c16 = initContract();
2341
- var publicRunStatusSchema = z19.enum([
2403
+ var publicRunStatusSchema = z20.enum([
2342
2404
  "pending",
2343
2405
  "running",
2344
2406
  "completed",
@@ -2346,52 +2408,52 @@ var publicRunStatusSchema = z19.enum([
2346
2408
  "timeout",
2347
2409
  "cancelled"
2348
2410
  ]);
2349
- var publicRunSchema = z19.object({
2350
- id: z19.string(),
2351
- agent_id: z19.string(),
2352
- agent_name: z19.string(),
2411
+ var publicRunSchema = z20.object({
2412
+ id: z20.string(),
2413
+ agent_id: z20.string(),
2414
+ agent_name: z20.string(),
2353
2415
  status: publicRunStatusSchema,
2354
- prompt: z19.string(),
2416
+ prompt: z20.string(),
2355
2417
  created_at: timestampSchema,
2356
2418
  started_at: timestampSchema.nullable(),
2357
2419
  completed_at: timestampSchema.nullable()
2358
2420
  });
2359
2421
  var publicRunDetailSchema = publicRunSchema.extend({
2360
- error: z19.string().nullable(),
2361
- execution_time_ms: z19.number().nullable(),
2362
- checkpoint_id: z19.string().nullable(),
2363
- session_id: z19.string().nullable(),
2364
- artifact_name: z19.string().nullable(),
2365
- artifact_version: z19.string().nullable(),
2366
- volumes: z19.record(z19.string(), z19.string()).optional()
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()
2367
2429
  });
2368
2430
  var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
2369
- var createRunRequestSchema = z19.object({
2431
+ var createRunRequestSchema = z20.object({
2370
2432
  // Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
2371
- agent: z19.string().optional(),
2433
+ agent: z20.string().optional(),
2372
2434
  // Agent name
2373
- agent_id: z19.string().optional(),
2435
+ agent_id: z20.string().optional(),
2374
2436
  // Agent ID
2375
- agent_version: z19.string().optional(),
2437
+ agent_version: z20.string().optional(),
2376
2438
  // Version specifier (e.g., "latest", "v1", specific ID)
2377
2439
  // Continue session
2378
- session_id: z19.string().optional(),
2440
+ session_id: z20.string().optional(),
2379
2441
  // Resume from checkpoint
2380
- checkpoint_id: z19.string().optional(),
2442
+ checkpoint_id: z20.string().optional(),
2381
2443
  // Required
2382
- prompt: z19.string().min(1, "Prompt is required"),
2444
+ prompt: z20.string().min(1, "Prompt is required"),
2383
2445
  // Optional configuration
2384
- variables: z19.record(z19.string(), z19.string()).optional(),
2385
- secrets: z19.record(z19.string(), z19.string()).optional(),
2386
- artifact_name: z19.string().optional(),
2446
+ variables: z20.record(z20.string(), z20.string()).optional(),
2447
+ secrets: z20.record(z20.string(), z20.string()).optional(),
2448
+ artifact_name: z20.string().optional(),
2387
2449
  // Artifact name to mount
2388
- artifact_version: z19.string().optional(),
2450
+ artifact_version: z20.string().optional(),
2389
2451
  // Artifact version (defaults to latest)
2390
- volumes: z19.record(z19.string(), z19.string()).optional()
2452
+ volumes: z20.record(z20.string(), z20.string()).optional()
2391
2453
  // volume_name -> version
2392
2454
  });
2393
2455
  var runListQuerySchema = listQuerySchema.extend({
2394
- agent_id: z19.string().optional(),
2456
+ agent_id: z20.string().optional(),
2395
2457
  status: publicRunStatusSchema.optional(),
2396
2458
  since: timestampSchema.optional()
2397
2459
  });
@@ -2399,6 +2461,7 @@ var publicRunsListContract = c16.router({
2399
2461
  list: {
2400
2462
  method: "GET",
2401
2463
  path: "/v1/runs",
2464
+ headers: authHeadersSchema,
2402
2465
  query: runListQuerySchema,
2403
2466
  responses: {
2404
2467
  200: paginatedRunsSchema,
@@ -2411,6 +2474,7 @@ var publicRunsListContract = c16.router({
2411
2474
  create: {
2412
2475
  method: "POST",
2413
2476
  path: "/v1/runs",
2477
+ headers: authHeadersSchema,
2414
2478
  body: createRunRequestSchema,
2415
2479
  responses: {
2416
2480
  202: publicRunDetailSchema,
@@ -2428,8 +2492,9 @@ var publicRunByIdContract = c16.router({
2428
2492
  get: {
2429
2493
  method: "GET",
2430
2494
  path: "/v1/runs/:id",
2431
- pathParams: z19.object({
2432
- id: z19.string().min(1, "Run ID is required")
2495
+ headers: authHeadersSchema,
2496
+ pathParams: z20.object({
2497
+ id: z20.string().min(1, "Run ID is required")
2433
2498
  }),
2434
2499
  responses: {
2435
2500
  200: publicRunDetailSchema,
@@ -2445,10 +2510,11 @@ var publicRunCancelContract = c16.router({
2445
2510
  cancel: {
2446
2511
  method: "POST",
2447
2512
  path: "/v1/runs/:id/cancel",
2448
- pathParams: z19.object({
2449
- id: z19.string().min(1, "Run ID is required")
2513
+ headers: authHeadersSchema,
2514
+ pathParams: z20.object({
2515
+ id: z20.string().min(1, "Run ID is required")
2450
2516
  }),
2451
- body: z19.undefined(),
2517
+ body: z20.undefined(),
2452
2518
  responses: {
2453
2519
  200: publicRunDetailSchema,
2454
2520
  400: publicApiErrorSchema,
@@ -2461,26 +2527,27 @@ var publicRunCancelContract = c16.router({
2461
2527
  description: "Cancel a pending or running execution"
2462
2528
  }
2463
2529
  });
2464
- var logEntrySchema = z19.object({
2530
+ var logEntrySchema = z20.object({
2465
2531
  timestamp: timestampSchema,
2466
- type: z19.enum(["agent", "system", "network"]),
2467
- level: z19.enum(["debug", "info", "warn", "error"]),
2468
- message: z19.string(),
2469
- metadata: z19.record(z19.string(), z19.unknown()).optional()
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()
2470
2536
  });
2471
2537
  var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
2472
2538
  var logsQuerySchema = listQuerySchema.extend({
2473
- type: z19.enum(["agent", "system", "network", "all"]).default("all"),
2539
+ type: z20.enum(["agent", "system", "network", "all"]).default("all"),
2474
2540
  since: timestampSchema.optional(),
2475
2541
  until: timestampSchema.optional(),
2476
- order: z19.enum(["asc", "desc"]).default("asc")
2542
+ order: z20.enum(["asc", "desc"]).default("asc")
2477
2543
  });
2478
2544
  var publicRunLogsContract = c16.router({
2479
2545
  getLogs: {
2480
2546
  method: "GET",
2481
2547
  path: "/v1/runs/:id/logs",
2482
- pathParams: z19.object({
2483
- id: z19.string().min(1, "Run ID is required")
2548
+ headers: authHeadersSchema,
2549
+ pathParams: z20.object({
2550
+ id: z20.string().min(1, "Run ID is required")
2484
2551
  }),
2485
2552
  query: logsQuerySchema,
2486
2553
  responses: {
@@ -2493,29 +2560,30 @@ var publicRunLogsContract = c16.router({
2493
2560
  description: "Get unified logs for a run. Combines agent, system, and network logs."
2494
2561
  }
2495
2562
  });
2496
- var metricPointSchema = z19.object({
2563
+ var metricPointSchema = z20.object({
2497
2564
  timestamp: timestampSchema,
2498
- cpu_percent: z19.number(),
2499
- memory_used_mb: z19.number(),
2500
- memory_total_mb: z19.number(),
2501
- disk_used_mb: z19.number(),
2502
- disk_total_mb: z19.number()
2503
- });
2504
- var metricsSummarySchema = z19.object({
2505
- avg_cpu_percent: z19.number(),
2506
- max_memory_used_mb: z19.number(),
2507
- total_duration_ms: z19.number().nullable()
2508
- });
2509
- var metricsResponseSchema2 = z19.object({
2510
- data: z19.array(metricPointSchema),
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),
2511
2578
  summary: metricsSummarySchema
2512
2579
  });
2513
2580
  var publicRunMetricsContract = c16.router({
2514
2581
  getMetrics: {
2515
2582
  method: "GET",
2516
2583
  path: "/v1/runs/:id/metrics",
2517
- pathParams: z19.object({
2518
- id: z19.string().min(1, "Run ID is required")
2584
+ headers: authHeadersSchema,
2585
+ pathParams: z20.object({
2586
+ id: z20.string().min(1, "Run ID is required")
2519
2587
  }),
2520
2588
  responses: {
2521
2589
  200: metricsResponseSchema2,
@@ -2527,7 +2595,7 @@ var publicRunMetricsContract = c16.router({
2527
2595
  description: "Get CPU, memory, and disk metrics for a run"
2528
2596
  }
2529
2597
  });
2530
- var sseEventTypeSchema = z19.enum([
2598
+ var sseEventTypeSchema = z20.enum([
2531
2599
  "status",
2532
2600
  // Run status change
2533
2601
  "output",
@@ -2539,25 +2607,26 @@ var sseEventTypeSchema = z19.enum([
2539
2607
  "heartbeat"
2540
2608
  // Keep-alive
2541
2609
  ]);
2542
- var sseEventSchema = z19.object({
2610
+ var sseEventSchema = z20.object({
2543
2611
  event: sseEventTypeSchema,
2544
- data: z19.unknown(),
2545
- id: z19.string().optional()
2612
+ data: z20.unknown(),
2613
+ id: z20.string().optional()
2546
2614
  // For Last-Event-ID reconnection
2547
2615
  });
2548
2616
  var publicRunEventsContract = c16.router({
2549
2617
  streamEvents: {
2550
2618
  method: "GET",
2551
2619
  path: "/v1/runs/:id/events",
2552
- pathParams: z19.object({
2553
- id: z19.string().min(1, "Run ID is required")
2620
+ headers: authHeadersSchema,
2621
+ pathParams: z20.object({
2622
+ id: z20.string().min(1, "Run ID is required")
2554
2623
  }),
2555
- query: z19.object({
2556
- last_event_id: z19.string().optional()
2624
+ query: z20.object({
2625
+ last_event_id: z20.string().optional()
2557
2626
  // For reconnection
2558
2627
  }),
2559
2628
  responses: {
2560
- 200: z19.any(),
2629
+ 200: z20.any(),
2561
2630
  // SSE stream - actual content is text/event-stream
2562
2631
  401: publicApiErrorSchema,
2563
2632
  404: publicApiErrorSchema,
@@ -2569,28 +2638,28 @@ var publicRunEventsContract = c16.router({
2569
2638
  });
2570
2639
 
2571
2640
  // ../../packages/core/src/contracts/public/artifacts.ts
2572
- import { z as z20 } from "zod";
2641
+ import { z as z21 } from "zod";
2573
2642
  var c17 = initContract();
2574
- var publicArtifactSchema = z20.object({
2575
- id: z20.string(),
2576
- name: z20.string(),
2577
- current_version_id: z20.string().nullable(),
2578
- size: z20.number(),
2643
+ var publicArtifactSchema = z21.object({
2644
+ id: z21.string(),
2645
+ name: z21.string(),
2646
+ current_version_id: z21.string().nullable(),
2647
+ size: z21.number(),
2579
2648
  // Total size in bytes
2580
- file_count: z20.number(),
2649
+ file_count: z21.number(),
2581
2650
  created_at: timestampSchema,
2582
2651
  updated_at: timestampSchema
2583
2652
  });
2584
- var artifactVersionSchema = z20.object({
2585
- id: z20.string(),
2653
+ var artifactVersionSchema = z21.object({
2654
+ id: z21.string(),
2586
2655
  // SHA-256 content hash
2587
- artifact_id: z20.string(),
2588
- size: z20.number(),
2656
+ artifact_id: z21.string(),
2657
+ size: z21.number(),
2589
2658
  // Size in bytes
2590
- file_count: z20.number(),
2591
- message: z20.string().nullable(),
2659
+ file_count: z21.number(),
2660
+ message: z21.string().nullable(),
2592
2661
  // Optional commit message
2593
- created_by: z20.string(),
2662
+ created_by: z21.string(),
2594
2663
  created_at: timestampSchema
2595
2664
  });
2596
2665
  var publicArtifactDetailSchema = publicArtifactSchema.extend({
@@ -2604,6 +2673,7 @@ var publicArtifactsListContract = c17.router({
2604
2673
  list: {
2605
2674
  method: "GET",
2606
2675
  path: "/v1/artifacts",
2676
+ headers: authHeadersSchema,
2607
2677
  query: listQuerySchema,
2608
2678
  responses: {
2609
2679
  200: paginatedArtifactsSchema,
@@ -2618,8 +2688,9 @@ var publicArtifactByIdContract = c17.router({
2618
2688
  get: {
2619
2689
  method: "GET",
2620
2690
  path: "/v1/artifacts/:id",
2621
- pathParams: z20.object({
2622
- id: z20.string().min(1, "Artifact ID is required")
2691
+ headers: authHeadersSchema,
2692
+ pathParams: z21.object({
2693
+ id: z21.string().min(1, "Artifact ID is required")
2623
2694
  }),
2624
2695
  responses: {
2625
2696
  200: publicArtifactDetailSchema,
@@ -2635,8 +2706,9 @@ var publicArtifactVersionsContract = c17.router({
2635
2706
  list: {
2636
2707
  method: "GET",
2637
2708
  path: "/v1/artifacts/:id/versions",
2638
- pathParams: z20.object({
2639
- id: z20.string().min(1, "Artifact ID is required")
2709
+ headers: authHeadersSchema,
2710
+ pathParams: z21.object({
2711
+ id: z21.string().min(1, "Artifact ID is required")
2640
2712
  }),
2641
2713
  query: listQuerySchema,
2642
2714
  responses: {
@@ -2653,15 +2725,16 @@ var publicArtifactDownloadContract = c17.router({
2653
2725
  download: {
2654
2726
  method: "GET",
2655
2727
  path: "/v1/artifacts/:id/download",
2656
- pathParams: z20.object({
2657
- id: z20.string().min(1, "Artifact ID is required")
2728
+ headers: authHeadersSchema,
2729
+ pathParams: z21.object({
2730
+ id: z21.string().min(1, "Artifact ID is required")
2658
2731
  }),
2659
- query: z20.object({
2660
- version_id: z20.string().optional()
2732
+ query: z21.object({
2733
+ version_id: z21.string().optional()
2661
2734
  // Defaults to current version
2662
2735
  }),
2663
2736
  responses: {
2664
- 302: z20.undefined(),
2737
+ 302: z21.undefined(),
2665
2738
  // Redirect to presigned URL
2666
2739
  401: publicApiErrorSchema,
2667
2740
  404: publicApiErrorSchema,
@@ -2673,28 +2746,28 @@ var publicArtifactDownloadContract = c17.router({
2673
2746
  });
2674
2747
 
2675
2748
  // ../../packages/core/src/contracts/public/volumes.ts
2676
- import { z as z21 } from "zod";
2749
+ import { z as z22 } from "zod";
2677
2750
  var c18 = initContract();
2678
- var publicVolumeSchema = z21.object({
2679
- id: z21.string(),
2680
- name: z21.string(),
2681
- current_version_id: z21.string().nullable(),
2682
- size: z21.number(),
2751
+ var publicVolumeSchema = z22.object({
2752
+ id: z22.string(),
2753
+ name: z22.string(),
2754
+ current_version_id: z22.string().nullable(),
2755
+ size: z22.number(),
2683
2756
  // Total size in bytes
2684
- file_count: z21.number(),
2757
+ file_count: z22.number(),
2685
2758
  created_at: timestampSchema,
2686
2759
  updated_at: timestampSchema
2687
2760
  });
2688
- var volumeVersionSchema = z21.object({
2689
- id: z21.string(),
2761
+ var volumeVersionSchema = z22.object({
2762
+ id: z22.string(),
2690
2763
  // SHA-256 content hash
2691
- volume_id: z21.string(),
2692
- size: z21.number(),
2764
+ volume_id: z22.string(),
2765
+ size: z22.number(),
2693
2766
  // Size in bytes
2694
- file_count: z21.number(),
2695
- message: z21.string().nullable(),
2767
+ file_count: z22.number(),
2768
+ message: z22.string().nullable(),
2696
2769
  // Optional commit message
2697
- created_by: z21.string(),
2770
+ created_by: z22.string(),
2698
2771
  created_at: timestampSchema
2699
2772
  });
2700
2773
  var publicVolumeDetailSchema = publicVolumeSchema.extend({
@@ -2706,6 +2779,7 @@ var publicVolumesListContract = c18.router({
2706
2779
  list: {
2707
2780
  method: "GET",
2708
2781
  path: "/v1/volumes",
2782
+ headers: authHeadersSchema,
2709
2783
  query: listQuerySchema,
2710
2784
  responses: {
2711
2785
  200: paginatedVolumesSchema,
@@ -2720,8 +2794,9 @@ var publicVolumeByIdContract = c18.router({
2720
2794
  get: {
2721
2795
  method: "GET",
2722
2796
  path: "/v1/volumes/:id",
2723
- pathParams: z21.object({
2724
- id: z21.string().min(1, "Volume ID is required")
2797
+ headers: authHeadersSchema,
2798
+ pathParams: z22.object({
2799
+ id: z22.string().min(1, "Volume ID is required")
2725
2800
  }),
2726
2801
  responses: {
2727
2802
  200: publicVolumeDetailSchema,
@@ -2737,8 +2812,9 @@ var publicVolumeVersionsContract = c18.router({
2737
2812
  list: {
2738
2813
  method: "GET",
2739
2814
  path: "/v1/volumes/:id/versions",
2740
- pathParams: z21.object({
2741
- id: z21.string().min(1, "Volume ID is required")
2815
+ headers: authHeadersSchema,
2816
+ pathParams: z22.object({
2817
+ id: z22.string().min(1, "Volume ID is required")
2742
2818
  }),
2743
2819
  query: listQuerySchema,
2744
2820
  responses: {
@@ -2755,15 +2831,16 @@ var publicVolumeDownloadContract = c18.router({
2755
2831
  download: {
2756
2832
  method: "GET",
2757
2833
  path: "/v1/volumes/:id/download",
2758
- pathParams: z21.object({
2759
- id: z21.string().min(1, "Volume ID is required")
2834
+ headers: authHeadersSchema,
2835
+ pathParams: z22.object({
2836
+ id: z22.string().min(1, "Volume ID is required")
2760
2837
  }),
2761
- query: z21.object({
2762
- version_id: z21.string().optional()
2838
+ query: z22.object({
2839
+ version_id: z22.string().optional()
2763
2840
  // Defaults to current version
2764
2841
  }),
2765
2842
  responses: {
2766
- 302: z21.undefined(),
2843
+ 302: z22.undefined(),
2767
2844
  // Redirect to presigned URL
2768
2845
  401: publicApiErrorSchema,
2769
2846
  404: publicApiErrorSchema,
@@ -2967,6 +3044,9 @@ async function getComposeByName(name, scope) {
2967
3044
  if (result.status === 200) {
2968
3045
  return result.body;
2969
3046
  }
3047
+ if (result.status === 404) {
3048
+ return null;
3049
+ }
2970
3050
  handleError(result, `Compose not found: ${name}`);
2971
3051
  }
2972
3052
  async function getComposeById(id) {
@@ -3062,7 +3142,7 @@ import { initClient as initClient4 } from "@ts-rest/core";
3062
3142
  async function getScope() {
3063
3143
  const config = await getClientConfig();
3064
3144
  const client = initClient4(scopeContract, config);
3065
- const result = await client.get();
3145
+ const result = await client.get({ headers: {} });
3066
3146
  if (result.status === 200) {
3067
3147
  return result.body;
3068
3148
  }
@@ -3146,7 +3226,7 @@ async function deploySchedule(body) {
3146
3226
  async function listSchedules() {
3147
3227
  const config = await getClientConfig();
3148
3228
  const client = initClient6(schedulesMainContract, config);
3149
- const result = await client.list();
3229
+ const result = await client.list({ headers: {} });
3150
3230
  if (result.status === 200) {
3151
3231
  return result.body;
3152
3232
  }
@@ -3221,7 +3301,7 @@ import { initClient as initClient7 } from "@ts-rest/core";
3221
3301
  async function listCredentials() {
3222
3302
  const config = await getClientConfig();
3223
3303
  const client = initClient7(credentialsMainContract, config);
3224
- const result = await client.list();
3304
+ const result = await client.list({ headers: {} });
3225
3305
  if (result.status === 200) {
3226
3306
  return result.body;
3227
3307
  }
@@ -3264,7 +3344,7 @@ import { initClient as initClient8 } from "@ts-rest/core";
3264
3344
  async function listModelProviders() {
3265
3345
  const config = await getClientConfig();
3266
3346
  const client = initClient8(modelProvidersMainContract, config);
3267
- const result = await client.list();
3347
+ const result = await client.list({ headers: {} });
3268
3348
  if (result.status === 200) {
3269
3349
  return result.body;
3270
3350
  }
@@ -3344,7 +3424,7 @@ async function getUsage(options) {
3344
3424
  }
3345
3425
 
3346
3426
  // src/lib/domain/yaml-validator.ts
3347
- import { z as z22 } from "zod";
3427
+ import { z as z23 } from "zod";
3348
3428
 
3349
3429
  // src/lib/domain/framework-config.ts
3350
3430
  var FRAMEWORK_DEFAULTS = {
@@ -3411,7 +3491,7 @@ function getDefaultImageWithApps(framework, apps) {
3411
3491
  }
3412
3492
 
3413
3493
  // src/lib/domain/yaml-validator.ts
3414
- var cliAgentNameSchema = z22.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
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(
3415
3495
  /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
3416
3496
  "Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
3417
3497
  );
@@ -3424,14 +3504,14 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3424
3504
  const frameworkSupported = isFrameworkSupported(agent.framework);
3425
3505
  if (!agent.image && !frameworkSupported) {
3426
3506
  ctx.addIssue({
3427
- code: z22.ZodIssueCode.custom,
3507
+ code: z23.ZodIssueCode.custom,
3428
3508
  message: "Missing agent.image (required when framework is not auto-configured)",
3429
3509
  path: ["image"]
3430
3510
  });
3431
3511
  }
3432
3512
  if (!agent.working_dir && !frameworkSupported) {
3433
3513
  ctx.addIssue({
3434
- code: z22.ZodIssueCode.custom,
3514
+ code: z23.ZodIssueCode.custom,
3435
3515
  message: "Missing agent.working_dir (required when framework is not auto-configured)",
3436
3516
  path: ["working_dir"]
3437
3517
  });
@@ -3441,7 +3521,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3441
3521
  const skillUrl = agent.skills[i];
3442
3522
  if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
3443
3523
  ctx.addIssue({
3444
- code: z22.ZodIssueCode.custom,
3524
+ code: z23.ZodIssueCode.custom,
3445
3525
  message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
3446
3526
  path: ["skills", i]
3447
3527
  });
@@ -3450,15 +3530,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3450
3530
  }
3451
3531
  }
3452
3532
  );
3453
- var cliComposeSchema = z22.object({
3454
- version: z22.string().min(1, "Missing config.version"),
3455
- agents: z22.record(cliAgentNameSchema, cliAgentDefinitionSchema),
3456
- volumes: z22.record(z22.string(), volumeConfigSchema).optional()
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()
3457
3537
  }).superRefine((config, ctx) => {
3458
3538
  const agentKeys = Object.keys(config.agents);
3459
3539
  if (agentKeys.length === 0) {
3460
3540
  ctx.addIssue({
3461
- code: z22.ZodIssueCode.custom,
3541
+ code: z23.ZodIssueCode.custom,
3462
3542
  message: "agents must have at least one agent defined",
3463
3543
  path: ["agents"]
3464
3544
  });
@@ -3466,7 +3546,7 @@ var cliComposeSchema = z22.object({
3466
3546
  }
3467
3547
  if (agentKeys.length > 1) {
3468
3548
  ctx.addIssue({
3469
- code: z22.ZodIssueCode.custom,
3549
+ code: z23.ZodIssueCode.custom,
3470
3550
  message: "Multiple agents not supported yet. Only one agent allowed.",
3471
3551
  path: ["agents"]
3472
3552
  });
@@ -3478,7 +3558,7 @@ var cliComposeSchema = z22.object({
3478
3558
  if (agentVolumes && agentVolumes.length > 0) {
3479
3559
  if (!config.volumes) {
3480
3560
  ctx.addIssue({
3481
- code: z22.ZodIssueCode.custom,
3561
+ code: z23.ZodIssueCode.custom,
3482
3562
  message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
3483
3563
  path: ["volumes"]
3484
3564
  });
@@ -3488,7 +3568,7 @@ var cliComposeSchema = z22.object({
3488
3568
  const parts = volDeclaration.split(":");
3489
3569
  if (parts.length !== 2) {
3490
3570
  ctx.addIssue({
3491
- code: z22.ZodIssueCode.custom,
3571
+ code: z23.ZodIssueCode.custom,
3492
3572
  message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
3493
3573
  path: ["agents", agentName, "volumes"]
3494
3574
  });
@@ -3497,7 +3577,7 @@ var cliComposeSchema = z22.object({
3497
3577
  const volumeKey = parts[0].trim();
3498
3578
  if (!config.volumes[volumeKey]) {
3499
3579
  ctx.addIssue({
3500
- code: z22.ZodIssueCode.custom,
3580
+ code: z23.ZodIssueCode.custom,
3501
3581
  message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
3502
3582
  path: ["volumes", volumeKey]
3503
3583
  });
@@ -4053,7 +4133,7 @@ function getSecretsFromComposeContent(content) {
4053
4133
  const grouped = groupVariablesBySource(refs);
4054
4134
  return new Set(grouped.secrets.map((r) => r.name));
4055
4135
  }
4056
- 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) => {
4136
+ var composeCommand = new Command().name("compose").description("Create or update agent compose (e.g., vm0.yaml)").argument("<agent-yaml>", "Path to agent YAML file").option("-y, --yes", "Skip confirmation prompts for skill requirements").action(async (configFile, options) => {
4057
4137
  try {
4058
4138
  if (!existsSync3(configFile)) {
4059
4139
  console.error(chalk2.red(`\u2717 Config file not found: ${configFile}`));
@@ -4173,12 +4253,9 @@ var composeCommand = new Command().name("compose").description("Create or update
4173
4253
  ([name]) => !(name in environment)
4174
4254
  );
4175
4255
  let headSecrets = /* @__PURE__ */ new Set();
4176
- try {
4177
- const existingCompose = await getComposeByName(agentName);
4178
- if (existingCompose.content) {
4179
- headSecrets = getSecretsFromComposeContent(existingCompose.content);
4180
- }
4181
- } catch {
4256
+ const existingCompose = await getComposeByName(agentName);
4257
+ if (existingCompose?.content) {
4258
+ headSecrets = getSecretsFromComposeContent(existingCompose.content);
4182
4259
  }
4183
4260
  const trulyNewSecrets = newSecrets.map(([name]) => name).filter((name) => !headSecrets.has(name));
4184
4261
  if (newSecrets.length > 0 || newVars.length > 0) {
@@ -4426,16 +4503,14 @@ var EventRenderer = class {
4426
4503
  static renderToolResult(event, prefix, suffix) {
4427
4504
  const isError = Boolean(event.data.isError);
4428
4505
  const status = isError ? "Error" : "Completed";
4429
- const color = isError ? chalk3.red : chalk3.green;
4430
- console.log(prefix + color("[tool_result]") + suffix + " " + status);
4506
+ console.log(prefix + "[tool_result]" + suffix + " " + status);
4431
4507
  const result = String(event.data.result || "");
4432
4508
  console.log(` ${chalk3.dim(result)}`);
4433
4509
  }
4434
4510
  static renderResult(event, prefix, suffix) {
4435
4511
  const success = Boolean(event.data.success);
4436
4512
  const status = success ? "\u2713 completed successfully" : "\u2717 failed";
4437
- const color = success ? chalk3.green : chalk3.red;
4438
- console.log(prefix + color("[result]") + suffix + " " + status);
4513
+ console.log(prefix + "[result]" + suffix + " " + status);
4439
4514
  const durationMs = Number(event.data.durationMs || 0);
4440
4515
  const durationSec = (durationMs / 1e3).toFixed(1);
4441
4516
  console.log(` Duration: ${chalk3.dim(durationSec + "s")}`);
@@ -5166,7 +5241,7 @@ var ApiClient = class {
5166
5241
  baseHeaders: headers,
5167
5242
  jsonQuery: true
5168
5243
  });
5169
- const result = await client.get();
5244
+ const result = await client.get({ headers: {} });
5170
5245
  if (result.status === 200) {
5171
5246
  return result.body;
5172
5247
  }
@@ -5368,7 +5443,7 @@ var ApiClient = class {
5368
5443
  baseHeaders: headers,
5369
5444
  jsonQuery: true
5370
5445
  });
5371
- const result = await client.list();
5446
+ const result = await client.list({ headers: {} });
5372
5447
  if (result.status === 200) {
5373
5448
  return result.body;
5374
5449
  }
@@ -5615,7 +5690,7 @@ var ApiClient = class {
5615
5690
  baseHeaders: headers,
5616
5691
  jsonQuery: true
5617
5692
  });
5618
- const result = await client.list();
5693
+ const result = await client.list({ headers: {} });
5619
5694
  if (result.status === 200) {
5620
5695
  return result.body;
5621
5696
  }
@@ -6094,8 +6169,8 @@ function showNextSteps(result) {
6094
6169
  }
6095
6170
 
6096
6171
  // src/commands/run/run.ts
6097
- var mainRunCommand = new Command2().name("run").description("Execute an agent").argument(
6098
- "<identifier>",
6172
+ var mainRunCommand = new Command2().name("run").description("Run an agent").argument(
6173
+ "<agent-name>",
6099
6174
  "Agent reference: [scope/]name[:version] (e.g., 'my-agent', 'lancy/my-agent:abc123', 'my-agent:latest')"
6100
6175
  ).argument("<prompt>", "Prompt for the agent").option(
6101
6176
  "--vars <KEY=value>",
@@ -6146,6 +6221,15 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
6146
6221
  console.log(chalk6.dim(` Resolving agent: ${displayRef}`));
6147
6222
  }
6148
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
+ }
6149
6233
  composeId = compose.id;
6150
6234
  composeContent = compose.content;
6151
6235
  if (verbose) {
@@ -7084,7 +7168,7 @@ var cloneCommand = new Command10().name("clone").description("Clone a remote vol
7084
7168
  });
7085
7169
 
7086
7170
  // src/commands/volume/index.ts
7087
- var volumeCommand = new Command11().name("volume").description("Manage cloud volumes").addCommand(initCommand).addCommand(pushCommand).addCommand(pullCommand).addCommand(statusCommand).addCommand(listCommand).addCommand(cloneCommand);
7171
+ var volumeCommand = new Command11().name("volume").description("Manage volumes (defined in compose, not versioned after run)").addCommand(initCommand).addCommand(pushCommand).addCommand(pullCommand).addCommand(statusCommand).addCommand(listCommand).addCommand(cloneCommand);
7088
7172
 
7089
7173
  // src/commands/artifact/index.ts
7090
7174
  import { Command as Command18 } from "commander";
@@ -7467,7 +7551,7 @@ var cloneCommand2 = new Command17().name("clone").description("Clone a remote ar
7467
7551
  });
7468
7552
 
7469
7553
  // src/commands/artifact/index.ts
7470
- var artifactCommand = new Command18().name("artifact").description("Manage cloud artifacts (work products)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand2).addCommand(listCommand2).addCommand(cloneCommand2);
7554
+ var artifactCommand = new Command18().name("artifact").description("Manage artifacts (specified at run, versioned after run)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand2).addCommand(listCommand2).addCommand(cloneCommand2);
7471
7555
 
7472
7556
  // src/commands/cook.ts
7473
7557
  import { Command as Command19, Option as Option4 } from "commander";
@@ -7846,7 +7930,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip c
7846
7930
  // eslint-disable-next-line complexity -- TODO: refactor complex function
7847
7931
  async (prompt, options) => {
7848
7932
  if (!options.noAutoUpdate) {
7849
- const shouldExit = await checkAndUpgrade("7.0.0", prompt);
7933
+ const shouldExit = await checkAndUpgrade("7.0.2", prompt);
7850
7934
  if (shouldExit) {
7851
7935
  process.exit(0);
7852
7936
  }
@@ -8475,7 +8559,7 @@ var setCommand = new Command22().name("set").description("Set your scope slug").
8475
8559
  console.error();
8476
8560
  console.error(
8477
8561
  chalk27.yellow(
8478
- "Warning: Changing your scope may break existing image references."
8562
+ "Warning: Changing your scope may break existing agent references."
8479
8563
  )
8480
8564
  );
8481
8565
  process.exit(1);
@@ -8490,8 +8574,8 @@ var setCommand = new Command22().name("set").description("Set your scope slug").
8490
8574
  console.log(chalk27.green(`\u2713 Scope created: ${scope.slug}`));
8491
8575
  }
8492
8576
  console.log();
8493
- console.log("Your images will now be namespaced as:");
8494
- console.log(chalk27.cyan(` ${scope.slug}/<image-name>`));
8577
+ console.log("Your agents will now be namespaced as:");
8578
+ console.log(chalk27.cyan(` ${scope.slug}/<agent-name>`));
8495
8579
  } catch (error) {
8496
8580
  if (error instanceof Error) {
8497
8581
  if (error.message.includes("Not authenticated")) {
@@ -8524,7 +8608,7 @@ var setCommand = new Command22().name("set").description("Set your scope slug").
8524
8608
  );
8525
8609
 
8526
8610
  // src/commands/scope/index.ts
8527
- var scopeCommand = new Command23().name("scope").description("Manage your scope (namespace for images)").addCommand(statusCommand3).addCommand(setCommand);
8611
+ var scopeCommand = new Command23().name("scope").description("Manage your scope (namespace for agents)").addCommand(statusCommand3).addCommand(setCommand);
8528
8612
 
8529
8613
  // src/commands/agent/index.ts
8530
8614
  import { Command as Command26 } from "commander";
@@ -8761,16 +8845,11 @@ var inspectCommand = new Command25().name("inspect").description("Inspect an age
8761
8845
  name = argument.slice(0, colonIndex);
8762
8846
  version = argument.slice(colonIndex + 1) || "latest";
8763
8847
  }
8764
- let compose;
8765
- try {
8766
- compose = await getComposeByName(name, options.scope);
8767
- } catch (error) {
8768
- if (error instanceof Error && error.message.includes("not found")) {
8769
- console.error(chalk29.red(`\u2717 Agent compose not found: ${name}`));
8770
- console.error(chalk29.dim(" Run: vm0 agent list"));
8771
- process.exit(1);
8772
- }
8773
- 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);
8774
8853
  }
8775
8854
  let resolvedVersionId = compose.headVersionId;
8776
8855
  if (version !== "latest" && compose.headVersionId) {
@@ -10009,17 +10088,15 @@ var deployCommand = new Command30().name("deploy").description("Deploy a schedul
10009
10088
  const [scheduleName, schedule] = scheduleEntries[0];
10010
10089
  console.log(`Deploying schedule ${chalk33.cyan(scheduleName)}...`);
10011
10090
  const agentRef = schedule.run.agent;
10012
- let composeId;
10013
- try {
10014
- const namePart = agentRef.includes("/") ? agentRef.split("/").pop() : agentRef;
10015
- const agentName = namePart.includes(":") ? namePart.split(":")[0] : namePart;
10016
- const compose = await getComposeByName(agentName);
10017
- composeId = compose.id;
10018
- } 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) {
10019
10095
  console.error(chalk33.red(`\u2717 Agent not found: ${agentRef}`));
10020
10096
  console.error(chalk33.dim(" Make sure the agent is pushed first"));
10021
10097
  process.exit(1);
10022
10098
  }
10099
+ const composeId = compose.id;
10023
10100
  const expandedVars = expandEnvVarsInObject(schedule.run.vars);
10024
10101
  const expandedSecrets = expandEnvVarsInObject(schedule.run.secrets);
10025
10102
  const atTime = schedule.on.at ? toISODateTime(schedule.on.at) : void 0;
@@ -11019,7 +11096,7 @@ var modelProviderCommand = new Command46().name("model-provider").description("M
11019
11096
 
11020
11097
  // src/index.ts
11021
11098
  var program = new Command47();
11022
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("7.0.0");
11099
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("7.0.2");
11023
11100
  program.command("info").description("Display environment information").action(async () => {
11024
11101
  console.log(chalk47.bold("System Information:"));
11025
11102
  console.log(`Node Version: ${process.version}`);
@@ -11028,7 +11105,7 @@ program.command("info").description("Display environment information").action(as
11028
11105
  const apiUrl = await getApiUrl();
11029
11106
  console.log(`API Host: ${apiUrl}`);
11030
11107
  });
11031
- var authCommand = program.command("auth").description("Authentication commands");
11108
+ var authCommand = program.command("auth").description("Authenticate vm0");
11032
11109
  authCommand.command("login").description("Log in to VM0 (use VM0_API_URL env var to set API URL)").action(async () => {
11033
11110
  await authenticate();
11034
11111
  });