@vm0/runner 2.5.2 → 2.6.0

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 +34 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4891,7 +4891,9 @@ 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()
4894
+ experimentalFirewall: experimentalFirewallSchema.optional(),
4895
+ postCreateCommand: z4.string().nullable().optional()
4896
+ // Lifecycle hook
4895
4897
  });
4896
4898
  var executionContextSchema = z4.object({
4897
4899
  runId: z4.string().uuid(),
@@ -4909,7 +4911,9 @@ var executionContextSchema = z4.object({
4909
4911
  secretValues: z4.array(z4.string()).nullable(),
4910
4912
  cliAgentType: z4.string(),
4911
4913
  // Experimental firewall configuration
4912
- experimentalFirewall: experimentalFirewallSchema.optional()
4914
+ experimentalFirewall: experimentalFirewallSchema.optional(),
4915
+ // Lifecycle hook - command to run after working dir creation
4916
+ postCreateCommand: z4.string().nullable().optional()
4913
4917
  });
4914
4918
  var runnersJobClaimContract = c.router({
4915
4919
  claim: {
@@ -7125,6 +7129,9 @@ ARTIFACT_MOUNT_PATH = os.environ.get("VM0_ARTIFACT_MOUNT_PATH", "")
7125
7129
  ARTIFACT_VOLUME_NAME = os.environ.get("VM0_ARTIFACT_VOLUME_NAME", "")
7126
7130
  ARTIFACT_VERSION_ID = os.environ.get("VM0_ARTIFACT_VERSION_ID", "")
7127
7131
 
7132
+ # Lifecycle hook - command to execute after working directory creation
7133
+ POST_CREATE_COMMAND = os.environ.get("VM0_POST_CREATE_COMMAND", "")
7134
+
7128
7135
  # Construct webhook endpoint URLs
7129
7136
  WEBHOOK_URL = f"{API_URL}/api/webhooks/agent/events"
7130
7137
  CHECKPOINT_URL = f"{API_URL}/api/webhooks/agent/checkpoints"
@@ -8986,7 +8993,7 @@ sys.path.insert(0, "/usr/local/bin/vm0-agent/lib")
8986
8993
  from common import (
8987
8994
  WORKING_DIR, PROMPT, RESUME_SESSION_ID, COMPLETE_URL, RUN_ID,
8988
8995
  EVENT_ERROR_FLAG, HEARTBEAT_URL, HEARTBEAT_INTERVAL, AGENT_LOG_FILE,
8989
- CLI_AGENT_TYPE, OPENAI_MODEL, validate_config
8996
+ CLI_AGENT_TYPE, OPENAI_MODEL, POST_CREATE_COMMAND, validate_config
8990
8997
  )
8991
8998
  from log import log_info, log_error, log_warn
8992
8999
  from events import send_event
@@ -9096,6 +9103,26 @@ def _run() -> tuple[int, str]:
9096
9103
  except OSError as e:
9097
9104
  raise RuntimeError(f"Failed to create/change to working directory: {WORKING_DIR} - {e}") from e
9098
9105
 
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
+
9099
9126
  # Set up Codex configuration if using Codex CLI
9100
9127
  # Claude Code uses ~/.claude by default (no configuration needed)
9101
9128
  if CLI_AGENT_TYPE == "codex":
@@ -10278,6 +10305,9 @@ function buildEnvironmentVariables(context, apiUrl) {
10278
10305
  envVars.VM0_ARTIFACT_VOLUME_NAME = artifact.vasStorageName;
10279
10306
  envVars.VM0_ARTIFACT_VERSION_ID = artifact.vasVersionId;
10280
10307
  }
10308
+ if (context.postCreateCommand) {
10309
+ envVars.VM0_POST_CREATE_COMMAND = context.postCreateCommand;
10310
+ }
10281
10311
  if (context.resumeSession) {
10282
10312
  envVars.VM0_RESUME_SESSION_ID = context.resumeSession.sessionId;
10283
10313
  }
@@ -10801,7 +10831,7 @@ var statusCommand = new Command2("status").description("Check runner connectivit
10801
10831
  });
10802
10832
 
10803
10833
  // src/index.ts
10804
- var version = true ? "2.5.2" : "0.1.0";
10834
+ var version = true ? "2.6.0" : "0.1.0";
10805
10835
  program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
10806
10836
  program.addCommand(startCommand);
10807
10837
  program.addCommand(statusCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/runner",
3
- "version": "2.5.2",
3
+ "version": "2.6.0",
4
4
  "description": "Self-hosted runner for VM0 agents",
5
5
  "repository": {
6
6
  "type": "git",