@vm0/runner 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +944 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4996,6 +4996,33 @@ var composesVersionsContract = c.router({
4996
4996
  summary: "Resolve version specifier to full version ID"
4997
4997
  }
4998
4998
  });
4999
+ var composeListItemSchema = z4.object({
5000
+ name: z4.string(),
5001
+ headVersionId: z4.string().nullable(),
5002
+ updatedAt: z4.string()
5003
+ });
5004
+ var composesListContract = c.router({
5005
+ /**
5006
+ * GET /api/agent/composes/list?scope={scope}
5007
+ * List all agent composes for a scope
5008
+ * If scope is not provided, uses the authenticated user's default scope
5009
+ */
5010
+ list: {
5011
+ method: "GET",
5012
+ path: "/api/agent/composes/list",
5013
+ query: z4.object({
5014
+ scope: z4.string().optional()
5015
+ }),
5016
+ responses: {
5017
+ 200: z4.object({
5018
+ composes: z4.array(composeListItemSchema)
5019
+ }),
5020
+ 400: apiErrorSchema,
5021
+ 401: apiErrorSchema
5022
+ },
5023
+ summary: "List all agent composes for a scope"
5024
+ }
5025
+ });
4999
5026
 
5000
5027
  // ../../packages/core/src/contracts/runs.ts
5001
5028
  import { z as z5 } from "zod";
@@ -6183,6 +6210,919 @@ var runnersJobClaimContract = c10.router({
6183
6210
  }
6184
6211
  });
6185
6212
 
6213
+ // ../../packages/core/src/contracts/public/common.ts
6214
+ import { z as z15 } from "zod";
6215
+ var publicApiErrorTypeSchema = z15.enum([
6216
+ "api_error",
6217
+ // Internal server error (5xx)
6218
+ "invalid_request_error",
6219
+ // Bad parameters (400)
6220
+ "authentication_error",
6221
+ // Auth failure (401)
6222
+ "not_found_error",
6223
+ // Resource missing (404)
6224
+ "conflict_error"
6225
+ // Resource conflict (409)
6226
+ ]);
6227
+ var publicApiErrorSchema = z15.object({
6228
+ error: z15.object({
6229
+ type: publicApiErrorTypeSchema,
6230
+ code: z15.string(),
6231
+ message: z15.string(),
6232
+ param: z15.string().optional(),
6233
+ doc_url: z15.string().url().optional()
6234
+ })
6235
+ });
6236
+ var paginationSchema = z15.object({
6237
+ has_more: z15.boolean(),
6238
+ next_cursor: z15.string().nullable()
6239
+ });
6240
+ function createPaginatedResponseSchema(dataSchema) {
6241
+ return z15.object({
6242
+ data: z15.array(dataSchema),
6243
+ pagination: paginationSchema
6244
+ });
6245
+ }
6246
+ var listQuerySchema = z15.object({
6247
+ cursor: z15.string().optional(),
6248
+ limit: z15.coerce.number().min(1).max(100).default(20)
6249
+ });
6250
+ var requestIdSchema = z15.string().uuid();
6251
+ var timestampSchema = z15.string().datetime();
6252
+
6253
+ // ../../packages/core/src/contracts/public/agents.ts
6254
+ import { z as z16 } from "zod";
6255
+ var c11 = initContract();
6256
+ var publicAgentSchema = z16.object({
6257
+ id: z16.string(),
6258
+ name: z16.string(),
6259
+ current_version_id: z16.string().nullable(),
6260
+ created_at: timestampSchema,
6261
+ updated_at: timestampSchema
6262
+ });
6263
+ var agentVersionSchema = z16.object({
6264
+ id: z16.string(),
6265
+ agent_id: z16.string(),
6266
+ version_number: z16.number(),
6267
+ config: z16.unknown(),
6268
+ // Agent YAML configuration
6269
+ created_at: timestampSchema
6270
+ });
6271
+ var publicAgentDetailSchema = publicAgentSchema.extend({
6272
+ config: z16.unknown().optional()
6273
+ });
6274
+ var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
6275
+ var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
6276
+ var createAgentRequestSchema = z16.object({
6277
+ name: z16.string().min(1).max(100).regex(
6278
+ /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
6279
+ "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
6280
+ ),
6281
+ config: z16.unknown()
6282
+ // Agent YAML configuration
6283
+ });
6284
+ var updateAgentRequestSchema = z16.object({
6285
+ config: z16.unknown()
6286
+ // New agent configuration (creates new version)
6287
+ });
6288
+ var publicAgentsListContract = c11.router({
6289
+ list: {
6290
+ method: "GET",
6291
+ path: "/v1/agents",
6292
+ query: listQuerySchema,
6293
+ responses: {
6294
+ 200: paginatedAgentsSchema,
6295
+ 401: publicApiErrorSchema,
6296
+ 500: publicApiErrorSchema
6297
+ },
6298
+ summary: "List agents",
6299
+ description: "List all agents in the current scope with pagination"
6300
+ },
6301
+ create: {
6302
+ method: "POST",
6303
+ path: "/v1/agents",
6304
+ body: createAgentRequestSchema,
6305
+ responses: {
6306
+ 201: publicAgentDetailSchema,
6307
+ 400: publicApiErrorSchema,
6308
+ 401: publicApiErrorSchema,
6309
+ 409: publicApiErrorSchema,
6310
+ 500: publicApiErrorSchema
6311
+ },
6312
+ summary: "Create agent",
6313
+ description: "Create a new agent with the given configuration"
6314
+ }
6315
+ });
6316
+ var publicAgentByIdContract = c11.router({
6317
+ get: {
6318
+ method: "GET",
6319
+ path: "/v1/agents/:id",
6320
+ pathParams: z16.object({
6321
+ id: z16.string().min(1, "Agent ID is required")
6322
+ }),
6323
+ responses: {
6324
+ 200: publicAgentDetailSchema,
6325
+ 401: publicApiErrorSchema,
6326
+ 404: publicApiErrorSchema,
6327
+ 500: publicApiErrorSchema
6328
+ },
6329
+ summary: "Get agent",
6330
+ description: "Get agent details by ID"
6331
+ },
6332
+ update: {
6333
+ method: "PUT",
6334
+ path: "/v1/agents/:id",
6335
+ pathParams: z16.object({
6336
+ id: z16.string().min(1, "Agent ID is required")
6337
+ }),
6338
+ body: updateAgentRequestSchema,
6339
+ responses: {
6340
+ 200: publicAgentDetailSchema,
6341
+ 400: publicApiErrorSchema,
6342
+ 401: publicApiErrorSchema,
6343
+ 404: publicApiErrorSchema,
6344
+ 500: publicApiErrorSchema
6345
+ },
6346
+ summary: "Update agent",
6347
+ description: "Update agent configuration. Creates a new version if config changes."
6348
+ },
6349
+ delete: {
6350
+ method: "DELETE",
6351
+ path: "/v1/agents/:id",
6352
+ pathParams: z16.object({
6353
+ id: z16.string().min(1, "Agent ID is required")
6354
+ }),
6355
+ body: z16.undefined(),
6356
+ responses: {
6357
+ 204: z16.undefined(),
6358
+ 401: publicApiErrorSchema,
6359
+ 404: publicApiErrorSchema,
6360
+ 500: publicApiErrorSchema
6361
+ },
6362
+ summary: "Delete agent",
6363
+ description: "Archive an agent (soft delete)"
6364
+ }
6365
+ });
6366
+ var publicAgentVersionsContract = c11.router({
6367
+ list: {
6368
+ method: "GET",
6369
+ path: "/v1/agents/:id/versions",
6370
+ pathParams: z16.object({
6371
+ id: z16.string().min(1, "Agent ID is required")
6372
+ }),
6373
+ query: listQuerySchema,
6374
+ responses: {
6375
+ 200: paginatedAgentVersionsSchema,
6376
+ 401: publicApiErrorSchema,
6377
+ 404: publicApiErrorSchema,
6378
+ 500: publicApiErrorSchema
6379
+ },
6380
+ summary: "List agent versions",
6381
+ description: "List all versions of an agent with pagination"
6382
+ }
6383
+ });
6384
+
6385
+ // ../../packages/core/src/contracts/public/runs.ts
6386
+ import { z as z17 } from "zod";
6387
+ var c12 = initContract();
6388
+ var publicRunStatusSchema = z17.enum([
6389
+ "pending",
6390
+ "running",
6391
+ "completed",
6392
+ "failed",
6393
+ "timeout",
6394
+ "cancelled"
6395
+ ]);
6396
+ var publicRunSchema = z17.object({
6397
+ id: z17.string(),
6398
+ agent_id: z17.string(),
6399
+ agent_name: z17.string(),
6400
+ status: publicRunStatusSchema,
6401
+ prompt: z17.string(),
6402
+ created_at: timestampSchema,
6403
+ started_at: timestampSchema.nullable(),
6404
+ completed_at: timestampSchema.nullable()
6405
+ });
6406
+ var publicRunDetailSchema = publicRunSchema.extend({
6407
+ output: z17.string().nullable(),
6408
+ error: z17.string().nullable(),
6409
+ execution_time_ms: z17.number().nullable(),
6410
+ checkpoint_id: z17.string().nullable(),
6411
+ session_id: z17.string().nullable(),
6412
+ artifacts: z17.record(z17.string(), z17.string()).optional(),
6413
+ volumes: z17.record(z17.string(), z17.string()).optional()
6414
+ });
6415
+ var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
6416
+ var createRunRequestSchema = z17.object({
6417
+ // Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
6418
+ agent: z17.string().optional(),
6419
+ // Agent name
6420
+ agent_id: z17.string().optional(),
6421
+ // Agent ID
6422
+ agent_version: z17.string().optional(),
6423
+ // Version specifier (e.g., "latest", "v1", specific ID)
6424
+ // Continue session
6425
+ session_id: z17.string().optional(),
6426
+ // Resume from checkpoint
6427
+ checkpoint_id: z17.string().optional(),
6428
+ // Required
6429
+ prompt: z17.string().min(1, "Prompt is required"),
6430
+ // Optional configuration
6431
+ variables: z17.record(z17.string(), z17.string()).optional(),
6432
+ secrets: z17.record(z17.string(), z17.string()).optional(),
6433
+ artifacts: z17.record(z17.string(), z17.string()).optional(),
6434
+ // artifact_name -> version
6435
+ volumes: z17.record(z17.string(), z17.string()).optional()
6436
+ // volume_name -> version
6437
+ });
6438
+ var runListQuerySchema = listQuerySchema.extend({
6439
+ agent_id: z17.string().optional(),
6440
+ status: publicRunStatusSchema.optional(),
6441
+ since: timestampSchema.optional()
6442
+ });
6443
+ var publicRunsListContract = c12.router({
6444
+ list: {
6445
+ method: "GET",
6446
+ path: "/v1/runs",
6447
+ query: runListQuerySchema,
6448
+ responses: {
6449
+ 200: paginatedRunsSchema,
6450
+ 401: publicApiErrorSchema,
6451
+ 500: publicApiErrorSchema
6452
+ },
6453
+ summary: "List runs",
6454
+ description: "List runs with optional filtering by agent, status, and time"
6455
+ },
6456
+ create: {
6457
+ method: "POST",
6458
+ path: "/v1/runs",
6459
+ body: createRunRequestSchema,
6460
+ responses: {
6461
+ 202: publicRunDetailSchema,
6462
+ // Async operation
6463
+ 400: publicApiErrorSchema,
6464
+ 401: publicApiErrorSchema,
6465
+ 404: publicApiErrorSchema,
6466
+ 500: publicApiErrorSchema
6467
+ },
6468
+ summary: "Create run",
6469
+ description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
6470
+ }
6471
+ });
6472
+ var publicRunByIdContract = c12.router({
6473
+ get: {
6474
+ method: "GET",
6475
+ path: "/v1/runs/:id",
6476
+ pathParams: z17.object({
6477
+ id: z17.string().min(1, "Run ID is required")
6478
+ }),
6479
+ responses: {
6480
+ 200: publicRunDetailSchema,
6481
+ 401: publicApiErrorSchema,
6482
+ 404: publicApiErrorSchema,
6483
+ 500: publicApiErrorSchema
6484
+ },
6485
+ summary: "Get run",
6486
+ description: "Get run details by ID"
6487
+ }
6488
+ });
6489
+ var publicRunCancelContract = c12.router({
6490
+ cancel: {
6491
+ method: "POST",
6492
+ path: "/v1/runs/:id/cancel",
6493
+ pathParams: z17.object({
6494
+ id: z17.string().min(1, "Run ID is required")
6495
+ }),
6496
+ body: z17.undefined(),
6497
+ responses: {
6498
+ 200: publicRunDetailSchema,
6499
+ 400: publicApiErrorSchema,
6500
+ // Run not in cancellable state
6501
+ 401: publicApiErrorSchema,
6502
+ 404: publicApiErrorSchema,
6503
+ 500: publicApiErrorSchema
6504
+ },
6505
+ summary: "Cancel run",
6506
+ description: "Cancel a pending or running execution"
6507
+ }
6508
+ });
6509
+ var logEntrySchema = z17.object({
6510
+ timestamp: timestampSchema,
6511
+ type: z17.enum(["agent", "system", "network"]),
6512
+ level: z17.enum(["debug", "info", "warn", "error"]),
6513
+ message: z17.string(),
6514
+ metadata: z17.record(z17.string(), z17.unknown()).optional()
6515
+ });
6516
+ var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
6517
+ var logsQuerySchema = listQuerySchema.extend({
6518
+ type: z17.enum(["agent", "system", "network", "all"]).default("all"),
6519
+ since: timestampSchema.optional(),
6520
+ until: timestampSchema.optional(),
6521
+ order: z17.enum(["asc", "desc"]).default("asc")
6522
+ });
6523
+ var publicRunLogsContract = c12.router({
6524
+ getLogs: {
6525
+ method: "GET",
6526
+ path: "/v1/runs/:id/logs",
6527
+ pathParams: z17.object({
6528
+ id: z17.string().min(1, "Run ID is required")
6529
+ }),
6530
+ query: logsQuerySchema,
6531
+ responses: {
6532
+ 200: paginatedLogsSchema,
6533
+ 401: publicApiErrorSchema,
6534
+ 404: publicApiErrorSchema,
6535
+ 500: publicApiErrorSchema
6536
+ },
6537
+ summary: "Get run logs",
6538
+ description: "Get unified logs for a run. Combines agent, system, and network logs."
6539
+ }
6540
+ });
6541
+ var metricPointSchema = z17.object({
6542
+ timestamp: timestampSchema,
6543
+ cpu_percent: z17.number(),
6544
+ memory_used_mb: z17.number(),
6545
+ memory_total_mb: z17.number(),
6546
+ disk_used_mb: z17.number(),
6547
+ disk_total_mb: z17.number()
6548
+ });
6549
+ var metricsSummarySchema = z17.object({
6550
+ avg_cpu_percent: z17.number(),
6551
+ max_memory_used_mb: z17.number(),
6552
+ total_duration_ms: z17.number().nullable()
6553
+ });
6554
+ var metricsResponseSchema2 = z17.object({
6555
+ data: z17.array(metricPointSchema),
6556
+ summary: metricsSummarySchema
6557
+ });
6558
+ var publicRunMetricsContract = c12.router({
6559
+ getMetrics: {
6560
+ method: "GET",
6561
+ path: "/v1/runs/:id/metrics",
6562
+ pathParams: z17.object({
6563
+ id: z17.string().min(1, "Run ID is required")
6564
+ }),
6565
+ responses: {
6566
+ 200: metricsResponseSchema2,
6567
+ 401: publicApiErrorSchema,
6568
+ 404: publicApiErrorSchema,
6569
+ 500: publicApiErrorSchema
6570
+ },
6571
+ summary: "Get run metrics",
6572
+ description: "Get CPU, memory, and disk metrics for a run"
6573
+ }
6574
+ });
6575
+ var sseEventTypeSchema = z17.enum([
6576
+ "status",
6577
+ // Run status change
6578
+ "output",
6579
+ // Agent output
6580
+ "error",
6581
+ // Error occurred
6582
+ "complete",
6583
+ // Run completed
6584
+ "heartbeat"
6585
+ // Keep-alive
6586
+ ]);
6587
+ var sseEventSchema = z17.object({
6588
+ event: sseEventTypeSchema,
6589
+ data: z17.unknown(),
6590
+ id: z17.string().optional()
6591
+ // For Last-Event-ID reconnection
6592
+ });
6593
+ var publicRunEventsContract = c12.router({
6594
+ streamEvents: {
6595
+ method: "GET",
6596
+ path: "/v1/runs/:id/events",
6597
+ pathParams: z17.object({
6598
+ id: z17.string().min(1, "Run ID is required")
6599
+ }),
6600
+ query: z17.object({
6601
+ last_event_id: z17.string().optional()
6602
+ // For reconnection
6603
+ }),
6604
+ responses: {
6605
+ 200: z17.any(),
6606
+ // SSE stream - actual content is text/event-stream
6607
+ 401: publicApiErrorSchema,
6608
+ 404: publicApiErrorSchema,
6609
+ 500: publicApiErrorSchema
6610
+ },
6611
+ summary: "Stream run events",
6612
+ description: "Stream real-time events for a run using Server-Sent Events (SSE). Set Accept: text/event-stream header."
6613
+ }
6614
+ });
6615
+
6616
+ // ../../packages/core/src/contracts/public/artifacts.ts
6617
+ import { z as z18 } from "zod";
6618
+ var c13 = initContract();
6619
+ var publicArtifactSchema = z18.object({
6620
+ id: z18.string(),
6621
+ name: z18.string(),
6622
+ current_version_id: z18.string().nullable(),
6623
+ size: z18.number(),
6624
+ // Total size in bytes
6625
+ file_count: z18.number(),
6626
+ created_at: timestampSchema,
6627
+ updated_at: timestampSchema
6628
+ });
6629
+ var artifactVersionSchema = z18.object({
6630
+ id: z18.string(),
6631
+ // SHA-256 content hash
6632
+ artifact_id: z18.string(),
6633
+ size: z18.number(),
6634
+ // Size in bytes
6635
+ file_count: z18.number(),
6636
+ message: z18.string().nullable(),
6637
+ // Optional commit message
6638
+ created_by: z18.string(),
6639
+ created_at: timestampSchema
6640
+ });
6641
+ var publicArtifactDetailSchema = publicArtifactSchema.extend({
6642
+ current_version: artifactVersionSchema.nullable()
6643
+ });
6644
+ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchema);
6645
+ var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
6646
+ artifactVersionSchema
6647
+ );
6648
+ var createArtifactRequestSchema = z18.object({
6649
+ name: z18.string().min(1).max(100).regex(
6650
+ /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
6651
+ "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
6652
+ )
6653
+ });
6654
+ var fileEntrySchema = z18.object({
6655
+ path: z18.string(),
6656
+ size: z18.number(),
6657
+ hash: z18.string().optional()
6658
+ // SHA-256 hash of file content
6659
+ });
6660
+ var prepareUploadRequestSchema = z18.object({
6661
+ files: z18.array(fileEntrySchema),
6662
+ message: z18.string().optional()
6663
+ // Optional commit message
6664
+ });
6665
+ var presignedUploadSchema2 = z18.object({
6666
+ path: z18.string(),
6667
+ upload_url: z18.string(),
6668
+ // Presigned S3 URL
6669
+ upload_id: z18.string()
6670
+ // For multi-part uploads
6671
+ });
6672
+ var prepareUploadResponseSchema = z18.object({
6673
+ upload_session_id: z18.string(),
6674
+ files: z18.array(presignedUploadSchema2),
6675
+ expires_at: timestampSchema
6676
+ });
6677
+ var commitUploadRequestSchema = z18.object({
6678
+ upload_session_id: z18.string(),
6679
+ message: z18.string().optional()
6680
+ });
6681
+ var downloadResponseSchema = z18.object({
6682
+ version_id: z18.string(),
6683
+ files: z18.array(
6684
+ z18.object({
6685
+ path: z18.string(),
6686
+ size: z18.number(),
6687
+ download_url: z18.string()
6688
+ // Presigned S3 URL
6689
+ })
6690
+ ),
6691
+ expires_at: timestampSchema
6692
+ });
6693
+ var publicArtifactsListContract = c13.router({
6694
+ list: {
6695
+ method: "GET",
6696
+ path: "/v1/artifacts",
6697
+ query: listQuerySchema,
6698
+ responses: {
6699
+ 200: paginatedArtifactsSchema,
6700
+ 401: publicApiErrorSchema,
6701
+ 500: publicApiErrorSchema
6702
+ },
6703
+ summary: "List artifacts",
6704
+ description: "List all artifacts in the current scope with pagination"
6705
+ },
6706
+ create: {
6707
+ method: "POST",
6708
+ path: "/v1/artifacts",
6709
+ body: createArtifactRequestSchema,
6710
+ responses: {
6711
+ 201: publicArtifactDetailSchema,
6712
+ 400: publicApiErrorSchema,
6713
+ 401: publicApiErrorSchema,
6714
+ 409: publicApiErrorSchema,
6715
+ 500: publicApiErrorSchema
6716
+ },
6717
+ summary: "Create artifact",
6718
+ description: "Create a new empty artifact container"
6719
+ }
6720
+ });
6721
+ var publicArtifactByIdContract = c13.router({
6722
+ get: {
6723
+ method: "GET",
6724
+ path: "/v1/artifacts/:id",
6725
+ pathParams: z18.object({
6726
+ id: z18.string().min(1, "Artifact ID is required")
6727
+ }),
6728
+ responses: {
6729
+ 200: publicArtifactDetailSchema,
6730
+ 401: publicApiErrorSchema,
6731
+ 404: publicApiErrorSchema,
6732
+ 500: publicApiErrorSchema
6733
+ },
6734
+ summary: "Get artifact",
6735
+ description: "Get artifact details by ID"
6736
+ },
6737
+ delete: {
6738
+ method: "DELETE",
6739
+ path: "/v1/artifacts/:id",
6740
+ pathParams: z18.object({
6741
+ id: z18.string().min(1, "Artifact ID is required")
6742
+ }),
6743
+ body: z18.undefined(),
6744
+ responses: {
6745
+ 204: z18.undefined(),
6746
+ 401: publicApiErrorSchema,
6747
+ 404: publicApiErrorSchema,
6748
+ 500: publicApiErrorSchema
6749
+ },
6750
+ summary: "Delete artifact",
6751
+ description: "Delete an artifact and all its versions"
6752
+ }
6753
+ });
6754
+ var publicArtifactVersionsContract = c13.router({
6755
+ list: {
6756
+ method: "GET",
6757
+ path: "/v1/artifacts/:id/versions",
6758
+ pathParams: z18.object({
6759
+ id: z18.string().min(1, "Artifact ID is required")
6760
+ }),
6761
+ query: listQuerySchema,
6762
+ responses: {
6763
+ 200: paginatedArtifactVersionsSchema,
6764
+ 401: publicApiErrorSchema,
6765
+ 404: publicApiErrorSchema,
6766
+ 500: publicApiErrorSchema
6767
+ },
6768
+ summary: "List artifact versions",
6769
+ description: "List all versions of an artifact with pagination"
6770
+ }
6771
+ });
6772
+ var publicArtifactUploadContract = c13.router({
6773
+ prepareUpload: {
6774
+ method: "POST",
6775
+ path: "/v1/artifacts/:id/upload",
6776
+ pathParams: z18.object({
6777
+ id: z18.string().min(1, "Artifact ID is required")
6778
+ }),
6779
+ body: prepareUploadRequestSchema,
6780
+ responses: {
6781
+ 200: prepareUploadResponseSchema,
6782
+ 400: publicApiErrorSchema,
6783
+ 401: publicApiErrorSchema,
6784
+ 404: publicApiErrorSchema,
6785
+ 500: publicApiErrorSchema
6786
+ },
6787
+ summary: "Prepare artifact upload",
6788
+ description: "Get presigned URLs for direct S3 upload. Returns upload URLs for each file."
6789
+ }
6790
+ });
6791
+ var publicArtifactCommitContract = c13.router({
6792
+ commitUpload: {
6793
+ method: "POST",
6794
+ path: "/v1/artifacts/:id/commit",
6795
+ pathParams: z18.object({
6796
+ id: z18.string().min(1, "Artifact ID is required")
6797
+ }),
6798
+ body: commitUploadRequestSchema,
6799
+ responses: {
6800
+ 200: artifactVersionSchema,
6801
+ 400: publicApiErrorSchema,
6802
+ 401: publicApiErrorSchema,
6803
+ 404: publicApiErrorSchema,
6804
+ 500: publicApiErrorSchema
6805
+ },
6806
+ summary: "Commit artifact upload",
6807
+ description: "Finalize an upload session and create a new artifact version."
6808
+ }
6809
+ });
6810
+ var publicArtifactDownloadContract = c13.router({
6811
+ download: {
6812
+ method: "GET",
6813
+ path: "/v1/artifacts/:id/download",
6814
+ pathParams: z18.object({
6815
+ id: z18.string().min(1, "Artifact ID is required")
6816
+ }),
6817
+ query: z18.object({
6818
+ version_id: z18.string().optional()
6819
+ // Defaults to current version
6820
+ }),
6821
+ responses: {
6822
+ 200: downloadResponseSchema,
6823
+ 401: publicApiErrorSchema,
6824
+ 404: publicApiErrorSchema,
6825
+ 500: publicApiErrorSchema
6826
+ },
6827
+ summary: "Download artifact",
6828
+ description: "Get presigned URLs for downloading artifact files. Defaults to current version."
6829
+ }
6830
+ });
6831
+
6832
+ // ../../packages/core/src/contracts/public/volumes.ts
6833
+ import { z as z19 } from "zod";
6834
+ var c14 = initContract();
6835
+ var publicVolumeSchema = z19.object({
6836
+ id: z19.string(),
6837
+ name: z19.string(),
6838
+ current_version_id: z19.string().nullable(),
6839
+ size: z19.number(),
6840
+ // Total size in bytes
6841
+ file_count: z19.number(),
6842
+ created_at: timestampSchema,
6843
+ updated_at: timestampSchema
6844
+ });
6845
+ var volumeVersionSchema = z19.object({
6846
+ id: z19.string(),
6847
+ // SHA-256 content hash
6848
+ volume_id: z19.string(),
6849
+ size: z19.number(),
6850
+ // Size in bytes
6851
+ file_count: z19.number(),
6852
+ message: z19.string().nullable(),
6853
+ // Optional commit message
6854
+ created_by: z19.string(),
6855
+ created_at: timestampSchema
6856
+ });
6857
+ var publicVolumeDetailSchema = publicVolumeSchema.extend({
6858
+ current_version: volumeVersionSchema.nullable()
6859
+ });
6860
+ var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
6861
+ var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
6862
+ var createVolumeRequestSchema = z19.object({
6863
+ name: z19.string().min(1).max(100).regex(
6864
+ /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
6865
+ "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
6866
+ )
6867
+ });
6868
+ var fileEntrySchema2 = z19.object({
6869
+ path: z19.string(),
6870
+ size: z19.number(),
6871
+ hash: z19.string().optional()
6872
+ // SHA-256 hash of file content
6873
+ });
6874
+ var prepareUploadRequestSchema2 = z19.object({
6875
+ files: z19.array(fileEntrySchema2),
6876
+ message: z19.string().optional()
6877
+ // Optional commit message
6878
+ });
6879
+ var presignedUploadSchema3 = z19.object({
6880
+ path: z19.string(),
6881
+ upload_url: z19.string(),
6882
+ // Presigned S3 URL
6883
+ upload_id: z19.string()
6884
+ // For multi-part uploads
6885
+ });
6886
+ var prepareUploadResponseSchema2 = z19.object({
6887
+ upload_session_id: z19.string(),
6888
+ files: z19.array(presignedUploadSchema3),
6889
+ expires_at: timestampSchema
6890
+ });
6891
+ var commitUploadRequestSchema2 = z19.object({
6892
+ upload_session_id: z19.string(),
6893
+ message: z19.string().optional()
6894
+ });
6895
+ var downloadResponseSchema2 = z19.object({
6896
+ version_id: z19.string(),
6897
+ files: z19.array(
6898
+ z19.object({
6899
+ path: z19.string(),
6900
+ size: z19.number(),
6901
+ download_url: z19.string()
6902
+ // Presigned S3 URL
6903
+ })
6904
+ ),
6905
+ expires_at: timestampSchema
6906
+ });
6907
+ var publicVolumesListContract = c14.router({
6908
+ list: {
6909
+ method: "GET",
6910
+ path: "/v1/volumes",
6911
+ query: listQuerySchema,
6912
+ responses: {
6913
+ 200: paginatedVolumesSchema,
6914
+ 401: publicApiErrorSchema,
6915
+ 500: publicApiErrorSchema
6916
+ },
6917
+ summary: "List volumes",
6918
+ description: "List all volumes in the current scope with pagination"
6919
+ },
6920
+ create: {
6921
+ method: "POST",
6922
+ path: "/v1/volumes",
6923
+ body: createVolumeRequestSchema,
6924
+ responses: {
6925
+ 201: publicVolumeDetailSchema,
6926
+ 400: publicApiErrorSchema,
6927
+ 401: publicApiErrorSchema,
6928
+ 409: publicApiErrorSchema,
6929
+ 500: publicApiErrorSchema
6930
+ },
6931
+ summary: "Create volume",
6932
+ description: "Create a new empty volume container"
6933
+ }
6934
+ });
6935
+ var publicVolumeByIdContract = c14.router({
6936
+ get: {
6937
+ method: "GET",
6938
+ path: "/v1/volumes/:id",
6939
+ pathParams: z19.object({
6940
+ id: z19.string().min(1, "Volume ID is required")
6941
+ }),
6942
+ responses: {
6943
+ 200: publicVolumeDetailSchema,
6944
+ 401: publicApiErrorSchema,
6945
+ 404: publicApiErrorSchema,
6946
+ 500: publicApiErrorSchema
6947
+ },
6948
+ summary: "Get volume",
6949
+ description: "Get volume details by ID"
6950
+ },
6951
+ delete: {
6952
+ method: "DELETE",
6953
+ path: "/v1/volumes/:id",
6954
+ pathParams: z19.object({
6955
+ id: z19.string().min(1, "Volume ID is required")
6956
+ }),
6957
+ body: z19.undefined(),
6958
+ responses: {
6959
+ 204: z19.undefined(),
6960
+ 401: publicApiErrorSchema,
6961
+ 404: publicApiErrorSchema,
6962
+ 500: publicApiErrorSchema
6963
+ },
6964
+ summary: "Delete volume",
6965
+ description: "Delete a volume and all its versions"
6966
+ }
6967
+ });
6968
+ var publicVolumeVersionsContract = c14.router({
6969
+ list: {
6970
+ method: "GET",
6971
+ path: "/v1/volumes/:id/versions",
6972
+ pathParams: z19.object({
6973
+ id: z19.string().min(1, "Volume ID is required")
6974
+ }),
6975
+ query: listQuerySchema,
6976
+ responses: {
6977
+ 200: paginatedVolumeVersionsSchema,
6978
+ 401: publicApiErrorSchema,
6979
+ 404: publicApiErrorSchema,
6980
+ 500: publicApiErrorSchema
6981
+ },
6982
+ summary: "List volume versions",
6983
+ description: "List all versions of a volume with pagination"
6984
+ }
6985
+ });
6986
+ var publicVolumeUploadContract = c14.router({
6987
+ prepareUpload: {
6988
+ method: "POST",
6989
+ path: "/v1/volumes/:id/upload",
6990
+ pathParams: z19.object({
6991
+ id: z19.string().min(1, "Volume ID is required")
6992
+ }),
6993
+ body: prepareUploadRequestSchema2,
6994
+ responses: {
6995
+ 200: prepareUploadResponseSchema2,
6996
+ 400: publicApiErrorSchema,
6997
+ 401: publicApiErrorSchema,
6998
+ 404: publicApiErrorSchema,
6999
+ 500: publicApiErrorSchema
7000
+ },
7001
+ summary: "Prepare volume upload",
7002
+ description: "Get presigned URLs for direct S3 upload. Returns upload URLs for each file."
7003
+ }
7004
+ });
7005
+ var publicVolumeCommitContract = c14.router({
7006
+ commitUpload: {
7007
+ method: "POST",
7008
+ path: "/v1/volumes/:id/commit",
7009
+ pathParams: z19.object({
7010
+ id: z19.string().min(1, "Volume ID is required")
7011
+ }),
7012
+ body: commitUploadRequestSchema2,
7013
+ responses: {
7014
+ 200: volumeVersionSchema,
7015
+ 400: publicApiErrorSchema,
7016
+ 401: publicApiErrorSchema,
7017
+ 404: publicApiErrorSchema,
7018
+ 500: publicApiErrorSchema
7019
+ },
7020
+ summary: "Commit volume upload",
7021
+ description: "Finalize an upload session and create a new volume version."
7022
+ }
7023
+ });
7024
+ var publicVolumeDownloadContract = c14.router({
7025
+ download: {
7026
+ method: "GET",
7027
+ path: "/v1/volumes/:id/download",
7028
+ pathParams: z19.object({
7029
+ id: z19.string().min(1, "Volume ID is required")
7030
+ }),
7031
+ query: z19.object({
7032
+ version_id: z19.string().optional()
7033
+ // Defaults to current version
7034
+ }),
7035
+ responses: {
7036
+ 200: downloadResponseSchema2,
7037
+ 401: publicApiErrorSchema,
7038
+ 404: publicApiErrorSchema,
7039
+ 500: publicApiErrorSchema
7040
+ },
7041
+ summary: "Download volume",
7042
+ description: "Get presigned URLs for downloading volume files. Defaults to current version."
7043
+ }
7044
+ });
7045
+
7046
+ // ../../packages/core/src/contracts/public/tokens.ts
7047
+ import { z as z20 } from "zod";
7048
+ var c15 = initContract();
7049
+ var publicTokenSchema = z20.object({
7050
+ id: z20.string(),
7051
+ name: z20.string(),
7052
+ token_prefix: z20.string(),
7053
+ // First 12 chars for identification (e.g., "vm0_live_abc")
7054
+ last_used_at: timestampSchema.nullable(),
7055
+ expires_at: timestampSchema,
7056
+ created_at: timestampSchema
7057
+ });
7058
+ var publicTokenDetailSchema = publicTokenSchema.extend({
7059
+ token: z20.string().optional()
7060
+ // Full token value, only returned on creation
7061
+ });
7062
+ var paginatedTokensSchema = createPaginatedResponseSchema(publicTokenSchema);
7063
+ var createTokenRequestSchema = z20.object({
7064
+ name: z20.string().min(1, "Name is required").max(100, "Name too long"),
7065
+ expires_in_days: z20.number().min(1).max(365).optional()
7066
+ // null for no expiry (default 90 days)
7067
+ });
7068
+ var publicTokensListContract = c15.router({
7069
+ list: {
7070
+ method: "GET",
7071
+ path: "/v1/tokens",
7072
+ query: listQuerySchema,
7073
+ responses: {
7074
+ 200: paginatedTokensSchema,
7075
+ 401: publicApiErrorSchema
7076
+ },
7077
+ summary: "List API tokens",
7078
+ description: "List all API tokens for the authenticated user"
7079
+ },
7080
+ create: {
7081
+ method: "POST",
7082
+ path: "/v1/tokens",
7083
+ body: createTokenRequestSchema,
7084
+ responses: {
7085
+ 201: publicTokenDetailSchema,
7086
+ // Includes full token value
7087
+ 400: publicApiErrorSchema,
7088
+ 401: publicApiErrorSchema
7089
+ },
7090
+ summary: "Create API token",
7091
+ description: "Create a new API token. The token value is only returned once on creation."
7092
+ }
7093
+ });
7094
+ var publicTokenByIdContract = c15.router({
7095
+ get: {
7096
+ method: "GET",
7097
+ path: "/v1/tokens/:id",
7098
+ pathParams: z20.object({
7099
+ id: z20.string()
7100
+ }),
7101
+ responses: {
7102
+ 200: publicTokenSchema,
7103
+ // Does NOT include token value
7104
+ 401: publicApiErrorSchema,
7105
+ 404: publicApiErrorSchema
7106
+ },
7107
+ summary: "Get API token",
7108
+ description: "Get details of an API token (does not include the token value)"
7109
+ },
7110
+ delete: {
7111
+ method: "DELETE",
7112
+ path: "/v1/tokens/:id",
7113
+ pathParams: z20.object({
7114
+ id: z20.string()
7115
+ }),
7116
+ responses: {
7117
+ 204: z20.undefined(),
7118
+ 401: publicApiErrorSchema,
7119
+ 404: publicApiErrorSchema
7120
+ },
7121
+ summary: "Revoke API token",
7122
+ description: "Permanently revoke an API token. This action cannot be undone."
7123
+ }
7124
+ });
7125
+
6186
7126
  // ../../packages/core/src/sandbox/scripts/lib/__init__.py.ts
6187
7127
  var INIT_SCRIPT = `#!/usr/bin/env python3
6188
7128
  """
@@ -9147,6 +10087,9 @@ function buildEnvironmentVariables(context, apiUrl) {
9147
10087
  envVars[key] = value;
9148
10088
  }
9149
10089
  }
10090
+ if (context.experimentalNetworkSecurity) {
10091
+ envVars.NODE_EXTRA_CA_CERTS = "/usr/local/share/ca-certificates/vm0-proxy-ca.crt";
10092
+ }
9150
10093
  return envVars;
9151
10094
  }
9152
10095
  var ENV_JSON_PATH = "/tmp/vm0-env.json";
@@ -9644,7 +10587,7 @@ var statusCommand = new Command2("status").description("Check runner connectivit
9644
10587
  });
9645
10588
 
9646
10589
  // src/index.ts
9647
- var version = true ? "2.3.0" : "0.1.0";
10590
+ var version = true ? "2.3.2" : "0.1.0";
9648
10591
  program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
9649
10592
  program.addCommand(startCommand);
9650
10593
  program.addCommand(statusCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/runner",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "Self-hosted runner for VM0 agents",
5
5
  "repository": {
6
6
  "type": "git",