@vm0/runner 2.6.0 → 2.6.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 +17 -342
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4891,9 +4891,7 @@ var storedExecutionContextSchema = z4.object({
4891
4891
  encryptedSecrets: z4.string().nullable(),
4892
4892
  // AES-256-GCM encrypted secrets
4893
4893
  cliAgentType: z4.string(),
4894
- experimentalFirewall: experimentalFirewallSchema.optional(),
4895
- postCreateCommand: z4.string().nullable().optional()
4896
- // Lifecycle hook
4894
+ experimentalFirewall: experimentalFirewallSchema.optional()
4897
4895
  });
4898
4896
  var executionContextSchema = z4.object({
4899
4897
  runId: z4.string().uuid(),
@@ -4911,9 +4909,7 @@ var executionContextSchema = z4.object({
4911
4909
  secretValues: z4.array(z4.string()).nullable(),
4912
4910
  cliAgentType: z4.string(),
4913
4911
  // Experimental firewall configuration
4914
- experimentalFirewall: experimentalFirewallSchema.optional(),
4915
- // Lifecycle hook - command to run after working dir creation
4916
- postCreateCommand: z4.string().nullable().optional()
4912
+ experimentalFirewall: experimentalFirewallSchema.optional()
4917
4913
  });
4918
4914
  var runnersJobClaimContract = c.router({
4919
4915
  claim: {
@@ -6297,19 +6293,11 @@ var agentVersionSchema = z16.object({
6297
6293
  id: z16.string(),
6298
6294
  agent_id: z16.string(),
6299
6295
  version_number: z16.number(),
6300
- config: z16.unknown(),
6301
- // Agent YAML configuration
6302
6296
  created_at: timestampSchema
6303
6297
  });
6304
- var publicAgentDetailSchema = publicAgentSchema.extend({
6305
- config: z16.unknown().optional()
6306
- });
6298
+ var publicAgentDetailSchema = publicAgentSchema;
6307
6299
  var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
6308
6300
  var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
6309
- var updateAgentRequestSchema = z16.object({
6310
- config: z16.unknown()
6311
- // New agent configuration (creates new version)
6312
- });
6313
6301
  var agentListQuerySchema = listQuerySchema.extend({
6314
6302
  name: z16.string().optional()
6315
6303
  });
@@ -6342,23 +6330,6 @@ var publicAgentByIdContract = c11.router({
6342
6330
  },
6343
6331
  summary: "Get agent",
6344
6332
  description: "Get agent details by ID"
6345
- },
6346
- update: {
6347
- method: "PUT",
6348
- path: "/v1/agents/:id",
6349
- pathParams: z16.object({
6350
- id: z16.string().min(1, "Agent ID is required")
6351
- }),
6352
- body: updateAgentRequestSchema,
6353
- responses: {
6354
- 200: publicAgentDetailSchema,
6355
- 400: publicApiErrorSchema,
6356
- 401: publicApiErrorSchema,
6357
- 404: publicApiErrorSchema,
6358
- 500: publicApiErrorSchema
6359
- },
6360
- summary: "Update agent",
6361
- description: "Update agent configuration. Creates a new version if config changes."
6362
6333
  }
6363
6334
  });
6364
6335
  var publicAgentVersionsContract = c11.router({
@@ -6402,12 +6373,12 @@ var publicRunSchema = z17.object({
6402
6373
  completed_at: timestampSchema.nullable()
6403
6374
  });
6404
6375
  var publicRunDetailSchema = publicRunSchema.extend({
6405
- output: z17.string().nullable(),
6406
6376
  error: z17.string().nullable(),
6407
6377
  execution_time_ms: z17.number().nullable(),
6408
6378
  checkpoint_id: z17.string().nullable(),
6409
6379
  session_id: z17.string().nullable(),
6410
- artifacts: z17.record(z17.string(), z17.string()).optional(),
6380
+ artifact_name: z17.string().nullable(),
6381
+ artifact_version: z17.string().nullable(),
6411
6382
  volumes: z17.record(z17.string(), z17.string()).optional()
6412
6383
  });
6413
6384
  var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
@@ -6428,8 +6399,10 @@ var createRunRequestSchema = z17.object({
6428
6399
  // Optional configuration
6429
6400
  variables: z17.record(z17.string(), z17.string()).optional(),
6430
6401
  secrets: z17.record(z17.string(), z17.string()).optional(),
6431
- artifacts: z17.record(z17.string(), z17.string()).optional(),
6432
- // artifact_name -> version
6402
+ artifact_name: z17.string().optional(),
6403
+ // Artifact name to mount
6404
+ artifact_version: z17.string().optional(),
6405
+ // Artifact version (defaults to latest)
6433
6406
  volumes: z17.record(z17.string(), z17.string()).optional()
6434
6407
  // volume_name -> version
6435
6408
  });
@@ -6643,51 +6616,6 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
6643
6616
  var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
6644
6617
  artifactVersionSchema
6645
6618
  );
6646
- var createArtifactRequestSchema = z18.object({
6647
- name: z18.string().min(1).max(100).regex(
6648
- /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
6649
- "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
6650
- )
6651
- });
6652
- var fileEntrySchema = z18.object({
6653
- path: z18.string(),
6654
- size: z18.number(),
6655
- hash: z18.string().optional()
6656
- // SHA-256 hash of file content
6657
- });
6658
- var prepareUploadRequestSchema = z18.object({
6659
- files: z18.array(fileEntrySchema),
6660
- message: z18.string().optional()
6661
- // Optional commit message
6662
- });
6663
- var presignedUploadSchema2 = z18.object({
6664
- path: z18.string(),
6665
- upload_url: z18.string(),
6666
- // Presigned S3 URL
6667
- upload_id: z18.string()
6668
- // For multi-part uploads
6669
- });
6670
- var prepareUploadResponseSchema = z18.object({
6671
- upload_session_id: z18.string(),
6672
- files: z18.array(presignedUploadSchema2),
6673
- expires_at: timestampSchema
6674
- });
6675
- var commitUploadRequestSchema = z18.object({
6676
- upload_session_id: z18.string(),
6677
- message: z18.string().optional()
6678
- });
6679
- var downloadResponseSchema = z18.object({
6680
- version_id: z18.string(),
6681
- files: z18.array(
6682
- z18.object({
6683
- path: z18.string(),
6684
- size: z18.number(),
6685
- download_url: z18.string()
6686
- // Presigned S3 URL
6687
- })
6688
- ),
6689
- expires_at: timestampSchema
6690
- });
6691
6619
  var publicArtifactsListContract = c13.router({
6692
6620
  list: {
6693
6621
  method: "GET",
@@ -6700,20 +6628,6 @@ var publicArtifactsListContract = c13.router({
6700
6628
  },
6701
6629
  summary: "List artifacts",
6702
6630
  description: "List all artifacts in the current scope with pagination"
6703
- },
6704
- create: {
6705
- method: "POST",
6706
- path: "/v1/artifacts",
6707
- body: createArtifactRequestSchema,
6708
- responses: {
6709
- 201: publicArtifactDetailSchema,
6710
- 400: publicApiErrorSchema,
6711
- 401: publicApiErrorSchema,
6712
- 409: publicApiErrorSchema,
6713
- 500: publicApiErrorSchema
6714
- },
6715
- summary: "Create artifact",
6716
- description: "Create a new empty artifact container"
6717
6631
  }
6718
6632
  });
6719
6633
  var publicArtifactByIdContract = c13.router({
@@ -6751,44 +6665,6 @@ var publicArtifactVersionsContract = c13.router({
6751
6665
  description: "List all versions of an artifact with pagination"
6752
6666
  }
6753
6667
  });
6754
- var publicArtifactUploadContract = c13.router({
6755
- prepareUpload: {
6756
- method: "POST",
6757
- path: "/v1/artifacts/:id/upload",
6758
- pathParams: z18.object({
6759
- id: z18.string().min(1, "Artifact ID is required")
6760
- }),
6761
- body: prepareUploadRequestSchema,
6762
- responses: {
6763
- 200: prepareUploadResponseSchema,
6764
- 400: publicApiErrorSchema,
6765
- 401: publicApiErrorSchema,
6766
- 404: publicApiErrorSchema,
6767
- 500: publicApiErrorSchema
6768
- },
6769
- summary: "Prepare artifact upload",
6770
- description: "Get presigned URLs for direct S3 upload. Returns upload URLs for each file."
6771
- }
6772
- });
6773
- var publicArtifactCommitContract = c13.router({
6774
- commitUpload: {
6775
- method: "POST",
6776
- path: "/v1/artifacts/:id/commit",
6777
- pathParams: z18.object({
6778
- id: z18.string().min(1, "Artifact ID is required")
6779
- }),
6780
- body: commitUploadRequestSchema,
6781
- responses: {
6782
- 200: artifactVersionSchema,
6783
- 400: publicApiErrorSchema,
6784
- 401: publicApiErrorSchema,
6785
- 404: publicApiErrorSchema,
6786
- 500: publicApiErrorSchema
6787
- },
6788
- summary: "Commit artifact upload",
6789
- description: "Finalize an upload session and create a new artifact version."
6790
- }
6791
- });
6792
6668
  var publicArtifactDownloadContract = c13.router({
6793
6669
  download: {
6794
6670
  method: "GET",
@@ -6801,13 +6677,14 @@ var publicArtifactDownloadContract = c13.router({
6801
6677
  // Defaults to current version
6802
6678
  }),
6803
6679
  responses: {
6804
- 200: downloadResponseSchema,
6680
+ 302: z18.undefined(),
6681
+ // Redirect to presigned URL
6805
6682
  401: publicApiErrorSchema,
6806
6683
  404: publicApiErrorSchema,
6807
6684
  500: publicApiErrorSchema
6808
6685
  },
6809
6686
  summary: "Download artifact",
6810
- description: "Get presigned URLs for downloading artifact files. Defaults to current version."
6687
+ description: "Redirect to presigned URL for downloading artifact as tar.gz archive. Defaults to current version."
6811
6688
  }
6812
6689
  });
6813
6690
 
@@ -6841,51 +6718,6 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
6841
6718
  });
6842
6719
  var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
6843
6720
  var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
6844
- var createVolumeRequestSchema = z19.object({
6845
- name: z19.string().min(1).max(100).regex(
6846
- /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
6847
- "Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
6848
- )
6849
- });
6850
- var fileEntrySchema2 = z19.object({
6851
- path: z19.string(),
6852
- size: z19.number(),
6853
- hash: z19.string().optional()
6854
- // SHA-256 hash of file content
6855
- });
6856
- var prepareUploadRequestSchema2 = z19.object({
6857
- files: z19.array(fileEntrySchema2),
6858
- message: z19.string().optional()
6859
- // Optional commit message
6860
- });
6861
- var presignedUploadSchema3 = z19.object({
6862
- path: z19.string(),
6863
- upload_url: z19.string(),
6864
- // Presigned S3 URL
6865
- upload_id: z19.string()
6866
- // For multi-part uploads
6867
- });
6868
- var prepareUploadResponseSchema2 = z19.object({
6869
- upload_session_id: z19.string(),
6870
- files: z19.array(presignedUploadSchema3),
6871
- expires_at: timestampSchema
6872
- });
6873
- var commitUploadRequestSchema2 = z19.object({
6874
- upload_session_id: z19.string(),
6875
- message: z19.string().optional()
6876
- });
6877
- var downloadResponseSchema2 = z19.object({
6878
- version_id: z19.string(),
6879
- files: z19.array(
6880
- z19.object({
6881
- path: z19.string(),
6882
- size: z19.number(),
6883
- download_url: z19.string()
6884
- // Presigned S3 URL
6885
- })
6886
- ),
6887
- expires_at: timestampSchema
6888
- });
6889
6721
  var publicVolumesListContract = c14.router({
6890
6722
  list: {
6891
6723
  method: "GET",
@@ -6898,20 +6730,6 @@ var publicVolumesListContract = c14.router({
6898
6730
  },
6899
6731
  summary: "List volumes",
6900
6732
  description: "List all volumes in the current scope with pagination"
6901
- },
6902
- create: {
6903
- method: "POST",
6904
- path: "/v1/volumes",
6905
- body: createVolumeRequestSchema,
6906
- responses: {
6907
- 201: publicVolumeDetailSchema,
6908
- 400: publicApiErrorSchema,
6909
- 401: publicApiErrorSchema,
6910
- 409: publicApiErrorSchema,
6911
- 500: publicApiErrorSchema
6912
- },
6913
- summary: "Create volume",
6914
- description: "Create a new empty volume container"
6915
6733
  }
6916
6734
  });
6917
6735
  var publicVolumeByIdContract = c14.router({
@@ -6949,44 +6767,6 @@ var publicVolumeVersionsContract = c14.router({
6949
6767
  description: "List all versions of a volume with pagination"
6950
6768
  }
6951
6769
  });
6952
- var publicVolumeUploadContract = c14.router({
6953
- prepareUpload: {
6954
- method: "POST",
6955
- path: "/v1/volumes/:id/upload",
6956
- pathParams: z19.object({
6957
- id: z19.string().min(1, "Volume ID is required")
6958
- }),
6959
- body: prepareUploadRequestSchema2,
6960
- responses: {
6961
- 200: prepareUploadResponseSchema2,
6962
- 400: publicApiErrorSchema,
6963
- 401: publicApiErrorSchema,
6964
- 404: publicApiErrorSchema,
6965
- 500: publicApiErrorSchema
6966
- },
6967
- summary: "Prepare volume upload",
6968
- description: "Get presigned URLs for direct S3 upload. Returns upload URLs for each file."
6969
- }
6970
- });
6971
- var publicVolumeCommitContract = c14.router({
6972
- commitUpload: {
6973
- method: "POST",
6974
- path: "/v1/volumes/:id/commit",
6975
- pathParams: z19.object({
6976
- id: z19.string().min(1, "Volume ID is required")
6977
- }),
6978
- body: commitUploadRequestSchema2,
6979
- responses: {
6980
- 200: volumeVersionSchema,
6981
- 400: publicApiErrorSchema,
6982
- 401: publicApiErrorSchema,
6983
- 404: publicApiErrorSchema,
6984
- 500: publicApiErrorSchema
6985
- },
6986
- summary: "Commit volume upload",
6987
- description: "Finalize an upload session and create a new volume version."
6988
- }
6989
- });
6990
6770
  var publicVolumeDownloadContract = c14.router({
6991
6771
  download: {
6992
6772
  method: "GET",
@@ -6999,93 +6779,14 @@ var publicVolumeDownloadContract = c14.router({
6999
6779
  // Defaults to current version
7000
6780
  }),
7001
6781
  responses: {
7002
- 200: downloadResponseSchema2,
6782
+ 302: z19.undefined(),
6783
+ // Redirect to presigned URL
7003
6784
  401: publicApiErrorSchema,
7004
6785
  404: publicApiErrorSchema,
7005
6786
  500: publicApiErrorSchema
7006
6787
  },
7007
6788
  summary: "Download volume",
7008
- description: "Get presigned URLs for downloading volume files. Defaults to current version."
7009
- }
7010
- });
7011
-
7012
- // ../../packages/core/src/contracts/public/tokens.ts
7013
- import { z as z20 } from "zod";
7014
- var c15 = initContract();
7015
- var publicTokenSchema = z20.object({
7016
- id: z20.string(),
7017
- name: z20.string(),
7018
- token_prefix: z20.string(),
7019
- // First 12 chars for identification (e.g., "vm0_live_abc")
7020
- last_used_at: timestampSchema.nullable(),
7021
- expires_at: timestampSchema,
7022
- created_at: timestampSchema
7023
- });
7024
- var publicTokenDetailSchema = publicTokenSchema.extend({
7025
- token: z20.string().optional()
7026
- // Full token value, only returned on creation
7027
- });
7028
- var paginatedTokensSchema = createPaginatedResponseSchema(publicTokenSchema);
7029
- var createTokenRequestSchema = z20.object({
7030
- name: z20.string().min(1, "Name is required").max(100, "Name too long"),
7031
- expires_in_days: z20.number().min(1).max(365).optional()
7032
- // null for no expiry (default 90 days)
7033
- });
7034
- var publicTokensListContract = c15.router({
7035
- list: {
7036
- method: "GET",
7037
- path: "/v1/tokens",
7038
- query: listQuerySchema,
7039
- responses: {
7040
- 200: paginatedTokensSchema,
7041
- 401: publicApiErrorSchema
7042
- },
7043
- summary: "List API tokens",
7044
- description: "List all API tokens for the authenticated user"
7045
- },
7046
- create: {
7047
- method: "POST",
7048
- path: "/v1/tokens",
7049
- body: createTokenRequestSchema,
7050
- responses: {
7051
- 201: publicTokenDetailSchema,
7052
- // Includes full token value
7053
- 400: publicApiErrorSchema,
7054
- 401: publicApiErrorSchema
7055
- },
7056
- summary: "Create API token",
7057
- description: "Create a new API token. The token value is only returned once on creation."
7058
- }
7059
- });
7060
- var publicTokenByIdContract = c15.router({
7061
- get: {
7062
- method: "GET",
7063
- path: "/v1/tokens/:id",
7064
- pathParams: z20.object({
7065
- id: z20.string()
7066
- }),
7067
- responses: {
7068
- 200: publicTokenSchema,
7069
- // Does NOT include token value
7070
- 401: publicApiErrorSchema,
7071
- 404: publicApiErrorSchema
7072
- },
7073
- summary: "Get API token",
7074
- description: "Get details of an API token (does not include the token value)"
7075
- },
7076
- delete: {
7077
- method: "DELETE",
7078
- path: "/v1/tokens/:id",
7079
- pathParams: z20.object({
7080
- id: z20.string()
7081
- }),
7082
- responses: {
7083
- 204: z20.undefined(),
7084
- 401: publicApiErrorSchema,
7085
- 404: publicApiErrorSchema
7086
- },
7087
- summary: "Revoke API token",
7088
- description: "Permanently revoke an API token. This action cannot be undone."
6789
+ description: "Redirect to presigned URL for downloading volume as tar.gz archive. Defaults to current version."
7089
6790
  }
7090
6791
  });
7091
6792
 
@@ -7129,9 +6830,6 @@ ARTIFACT_MOUNT_PATH = os.environ.get("VM0_ARTIFACT_MOUNT_PATH", "")
7129
6830
  ARTIFACT_VOLUME_NAME = os.environ.get("VM0_ARTIFACT_VOLUME_NAME", "")
7130
6831
  ARTIFACT_VERSION_ID = os.environ.get("VM0_ARTIFACT_VERSION_ID", "")
7131
6832
 
7132
- # Lifecycle hook - command to execute after working directory creation
7133
- POST_CREATE_COMMAND = os.environ.get("VM0_POST_CREATE_COMMAND", "")
7134
-
7135
6833
  # Construct webhook endpoint URLs
7136
6834
  WEBHOOK_URL = f"{API_URL}/api/webhooks/agent/events"
7137
6835
  CHECKPOINT_URL = f"{API_URL}/api/webhooks/agent/checkpoints"
@@ -8993,7 +8691,7 @@ sys.path.insert(0, "/usr/local/bin/vm0-agent/lib")
8993
8691
  from common import (
8994
8692
  WORKING_DIR, PROMPT, RESUME_SESSION_ID, COMPLETE_URL, RUN_ID,
8995
8693
  EVENT_ERROR_FLAG, HEARTBEAT_URL, HEARTBEAT_INTERVAL, AGENT_LOG_FILE,
8996
- CLI_AGENT_TYPE, OPENAI_MODEL, POST_CREATE_COMMAND, validate_config
8694
+ CLI_AGENT_TYPE, OPENAI_MODEL, validate_config
8997
8695
  )
8998
8696
  from log import log_info, log_error, log_warn
8999
8697
  from events import send_event
@@ -9103,26 +8801,6 @@ def _run() -> tuple[int, str]:
9103
8801
  except OSError as e:
9104
8802
  raise RuntimeError(f"Failed to create/change to working directory: {WORKING_DIR} - {e}") from e
9105
8803
 
9106
- # Execute postCreateCommand if specified (lifecycle hook)
9107
- # This runs after working directory is created but before agent execution
9108
- if POST_CREATE_COMMAND:
9109
- log_info(f"Running postCreateCommand: {POST_CREATE_COMMAND}")
9110
- try:
9111
- result = subprocess.run(
9112
- ["/bin/bash", "-c", POST_CREATE_COMMAND],
9113
- cwd=WORKING_DIR,
9114
- capture_output=True,
9115
- text=True
9116
- )
9117
- if result.returncode != 0:
9118
- stderr_output = result.stderr.strip() if result.stderr else "No error output"
9119
- raise RuntimeError(f"postCreateCommand failed with exit code {result.returncode}: {stderr_output}")
9120
- if result.stdout:
9121
- log_info(f"postCreateCommand output: {result.stdout.strip()}")
9122
- log_info("postCreateCommand completed successfully")
9123
- except subprocess.SubprocessError as e:
9124
- raise RuntimeError(f"Failed to execute postCreateCommand: {e}") from e
9125
-
9126
8804
  # Set up Codex configuration if using Codex CLI
9127
8805
  # Claude Code uses ~/.claude by default (no configuration needed)
9128
8806
  if CLI_AGENT_TYPE == "codex":
@@ -10305,9 +9983,6 @@ function buildEnvironmentVariables(context, apiUrl) {
10305
9983
  envVars.VM0_ARTIFACT_VOLUME_NAME = artifact.vasStorageName;
10306
9984
  envVars.VM0_ARTIFACT_VERSION_ID = artifact.vasVersionId;
10307
9985
  }
10308
- if (context.postCreateCommand) {
10309
- envVars.VM0_POST_CREATE_COMMAND = context.postCreateCommand;
10310
- }
10311
9986
  if (context.resumeSession) {
10312
9987
  envVars.VM0_RESUME_SESSION_ID = context.resumeSession.sessionId;
10313
9988
  }
@@ -10831,7 +10506,7 @@ var statusCommand = new Command2("status").description("Check runner connectivit
10831
10506
  });
10832
10507
 
10833
10508
  // src/index.ts
10834
- var version = true ? "2.6.0" : "0.1.0";
10509
+ var version = true ? "2.6.1" : "0.1.0";
10835
10510
  program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
10836
10511
  program.addCommand(startCommand);
10837
10512
  program.addCommand(statusCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/runner",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "Self-hosted runner for VM0 agents",
5
5
  "repository": {
6
6
  "type": "git",