@vm0/runner 2.5.1 → 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.
- package/index.js +61 -17
- 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: {
|
|
@@ -5302,12 +5306,19 @@ var agentEventsResponseSchema = z6.object({
|
|
|
5302
5306
|
});
|
|
5303
5307
|
var networkLogEntrySchema = z6.object({
|
|
5304
5308
|
timestamp: z6.string(),
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5309
|
+
// Common fields (all modes)
|
|
5310
|
+
mode: z6.enum(["mitm", "sni"]).optional(),
|
|
5311
|
+
action: z6.enum(["ALLOW", "DENY"]).optional(),
|
|
5312
|
+
host: z6.string().optional(),
|
|
5313
|
+
port: z6.number().optional(),
|
|
5314
|
+
rule_matched: z6.string().nullable().optional(),
|
|
5315
|
+
// MITM-only fields (optional)
|
|
5316
|
+
method: z6.string().optional(),
|
|
5317
|
+
url: z6.string().optional(),
|
|
5318
|
+
status: z6.number().optional(),
|
|
5319
|
+
latency_ms: z6.number().optional(),
|
|
5320
|
+
request_size: z6.number().optional(),
|
|
5321
|
+
response_size: z6.number().optional()
|
|
5311
5322
|
});
|
|
5312
5323
|
var networkLogsResponseSchema = z6.object({
|
|
5313
5324
|
networkLogs: z6.array(networkLogEntrySchema),
|
|
@@ -5841,12 +5852,19 @@ var metricDataSchema = z8.object({
|
|
|
5841
5852
|
});
|
|
5842
5853
|
var networkLogSchema = z8.object({
|
|
5843
5854
|
timestamp: z8.string(),
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5855
|
+
// Common fields (all modes)
|
|
5856
|
+
mode: z8.enum(["mitm", "sni"]).optional(),
|
|
5857
|
+
action: z8.enum(["ALLOW", "DENY"]).optional(),
|
|
5858
|
+
host: z8.string().optional(),
|
|
5859
|
+
port: z8.number().optional(),
|
|
5860
|
+
rule_matched: z8.string().nullable().optional(),
|
|
5861
|
+
// MITM-only fields (optional)
|
|
5862
|
+
method: z8.string().optional(),
|
|
5863
|
+
url: z8.string().optional(),
|
|
5864
|
+
status: z8.number().optional(),
|
|
5865
|
+
latency_ms: z8.number().optional(),
|
|
5866
|
+
request_size: z8.number().optional(),
|
|
5867
|
+
response_size: z8.number().optional()
|
|
5850
5868
|
});
|
|
5851
5869
|
var webhookTelemetryContract = c5.router({
|
|
5852
5870
|
/**
|
|
@@ -7111,6 +7129,9 @@ ARTIFACT_MOUNT_PATH = os.environ.get("VM0_ARTIFACT_MOUNT_PATH", "")
|
|
|
7111
7129
|
ARTIFACT_VOLUME_NAME = os.environ.get("VM0_ARTIFACT_VOLUME_NAME", "")
|
|
7112
7130
|
ARTIFACT_VERSION_ID = os.environ.get("VM0_ARTIFACT_VERSION_ID", "")
|
|
7113
7131
|
|
|
7132
|
+
# Lifecycle hook - command to execute after working directory creation
|
|
7133
|
+
POST_CREATE_COMMAND = os.environ.get("VM0_POST_CREATE_COMMAND", "")
|
|
7134
|
+
|
|
7114
7135
|
# Construct webhook endpoint URLs
|
|
7115
7136
|
WEBHOOK_URL = f"{API_URL}/api/webhooks/agent/events"
|
|
7116
7137
|
CHECKPOINT_URL = f"{API_URL}/api/webhooks/agent/checkpoints"
|
|
@@ -8972,7 +8993,7 @@ sys.path.insert(0, "/usr/local/bin/vm0-agent/lib")
|
|
|
8972
8993
|
from common import (
|
|
8973
8994
|
WORKING_DIR, PROMPT, RESUME_SESSION_ID, COMPLETE_URL, RUN_ID,
|
|
8974
8995
|
EVENT_ERROR_FLAG, HEARTBEAT_URL, HEARTBEAT_INTERVAL, AGENT_LOG_FILE,
|
|
8975
|
-
CLI_AGENT_TYPE, OPENAI_MODEL, validate_config
|
|
8996
|
+
CLI_AGENT_TYPE, OPENAI_MODEL, POST_CREATE_COMMAND, validate_config
|
|
8976
8997
|
)
|
|
8977
8998
|
from log import log_info, log_error, log_warn
|
|
8978
8999
|
from events import send_event
|
|
@@ -9082,6 +9103,26 @@ def _run() -> tuple[int, str]:
|
|
|
9082
9103
|
except OSError as e:
|
|
9083
9104
|
raise RuntimeError(f"Failed to create/change to working directory: {WORKING_DIR} - {e}") from e
|
|
9084
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
|
+
|
|
9085
9126
|
# Set up Codex configuration if using Codex CLI
|
|
9086
9127
|
# Claude Code uses ~/.claude by default (no configuration needed)
|
|
9087
9128
|
if CLI_AGENT_TYPE == "codex":
|
|
@@ -10011,7 +10052,7 @@ def response(flow: http.HTTPFlow) -> None:
|
|
|
10011
10052
|
if run_id:
|
|
10012
10053
|
log_entry = {
|
|
10013
10054
|
"timestamp": time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()),
|
|
10014
|
-
"mode": "mitm" if mitm_enabled else "
|
|
10055
|
+
"mode": "mitm" if mitm_enabled else "sni",
|
|
10015
10056
|
"action": firewall_action,
|
|
10016
10057
|
"host": host,
|
|
10017
10058
|
"port": port,
|
|
@@ -10264,6 +10305,9 @@ function buildEnvironmentVariables(context, apiUrl) {
|
|
|
10264
10305
|
envVars.VM0_ARTIFACT_VOLUME_NAME = artifact.vasStorageName;
|
|
10265
10306
|
envVars.VM0_ARTIFACT_VERSION_ID = artifact.vasVersionId;
|
|
10266
10307
|
}
|
|
10308
|
+
if (context.postCreateCommand) {
|
|
10309
|
+
envVars.VM0_POST_CREATE_COMMAND = context.postCreateCommand;
|
|
10310
|
+
}
|
|
10267
10311
|
if (context.resumeSession) {
|
|
10268
10312
|
envVars.VM0_RESUME_SESSION_ID = context.resumeSession.sessionId;
|
|
10269
10313
|
}
|
|
@@ -10787,7 +10831,7 @@ var statusCommand = new Command2("status").description("Check runner connectivit
|
|
|
10787
10831
|
});
|
|
10788
10832
|
|
|
10789
10833
|
// src/index.ts
|
|
10790
|
-
var version = true ? "2.
|
|
10834
|
+
var version = true ? "2.6.0" : "0.1.0";
|
|
10791
10835
|
program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
|
|
10792
10836
|
program.addCommand(startCommand);
|
|
10793
10837
|
program.addCommand(statusCommand);
|