@vm0/cli 6.4.1 → 7.0.1

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