@vm0/runner 2.0.1 → 2.0.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.
- package/index.js +15 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -105,7 +105,7 @@ async function claimJob(server, runId) {
|
|
|
105
105
|
}
|
|
106
106
|
return response.json();
|
|
107
107
|
}
|
|
108
|
-
async function completeJob(context, exitCode, error) {
|
|
108
|
+
async function completeJob(apiUrl, context, exitCode, error) {
|
|
109
109
|
const headers = {
|
|
110
110
|
Authorization: `Bearer ${context.sandboxToken}`,
|
|
111
111
|
"Content-Type": "application/json"
|
|
@@ -114,18 +114,15 @@ async function completeJob(context, exitCode, error) {
|
|
|
114
114
|
if (bypassSecret) {
|
|
115
115
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
116
116
|
}
|
|
117
|
-
const response = await fetch(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
);
|
|
117
|
+
const response = await fetch(`${apiUrl}/api/webhooks/agent/complete`, {
|
|
118
|
+
method: "POST",
|
|
119
|
+
headers,
|
|
120
|
+
body: JSON.stringify({
|
|
121
|
+
runId: context.runId,
|
|
122
|
+
exitCode,
|
|
123
|
+
error
|
|
124
|
+
})
|
|
125
|
+
});
|
|
129
126
|
if (!response.ok) {
|
|
130
127
|
const errorData = await response.json();
|
|
131
128
|
throw new Error(
|
|
@@ -6169,7 +6166,6 @@ var executionContextSchema = z15.object({
|
|
|
6169
6166
|
secretNames: z15.array(z15.string()).nullable(),
|
|
6170
6167
|
checkpointId: z15.string().uuid().nullable(),
|
|
6171
6168
|
sandboxToken: z15.string(),
|
|
6172
|
-
apiUrl: z15.string(),
|
|
6173
6169
|
// New fields for E2B parity:
|
|
6174
6170
|
workingDir: z15.string(),
|
|
6175
6171
|
storageManifest: storageManifestSchema.nullable(),
|
|
@@ -9010,9 +9006,9 @@ function getAllScripts() {
|
|
|
9010
9006
|
function getVmIdFromRunId(runId) {
|
|
9011
9007
|
return runId.split("-")[0] || runId.substring(0, 8);
|
|
9012
9008
|
}
|
|
9013
|
-
function buildEnvironmentVariables(context) {
|
|
9009
|
+
function buildEnvironmentVariables(context, apiUrl) {
|
|
9014
9010
|
const envVars = {
|
|
9015
|
-
VM0_API_URL:
|
|
9011
|
+
VM0_API_URL: apiUrl,
|
|
9016
9012
|
VM0_RUN_ID: context.runId,
|
|
9017
9013
|
VM0_API_TOKEN: context.sandboxToken,
|
|
9018
9014
|
VM0_PROMPT: context.prompt,
|
|
@@ -9152,7 +9148,7 @@ async function executeJob(context, config) {
|
|
|
9152
9148
|
context.cliAgentType || "claude-code"
|
|
9153
9149
|
);
|
|
9154
9150
|
}
|
|
9155
|
-
const envVars = buildEnvironmentVariables(context);
|
|
9151
|
+
const envVars = buildEnvironmentVariables(context, config.server.url);
|
|
9156
9152
|
const envJson = JSON.stringify(envVars);
|
|
9157
9153
|
console.log(
|
|
9158
9154
|
`[Executor] Writing env JSON (${envJson.length} bytes) to ${ENV_JSON_PATH}`
|
|
@@ -9232,7 +9228,7 @@ async function executeJob2(context, config) {
|
|
|
9232
9228
|
} catch (err) {
|
|
9233
9229
|
const error = err instanceof Error ? err.message : "Unknown execution error";
|
|
9234
9230
|
console.error(` Job ${context.runId} execution failed: ${error}`);
|
|
9235
|
-
const result = await completeJob(context, 1, error);
|
|
9231
|
+
const result = await completeJob(config.server.url, context, 1, error);
|
|
9236
9232
|
console.log(` Job ${context.runId} reported as ${result.status}`);
|
|
9237
9233
|
}
|
|
9238
9234
|
}
|
|
@@ -9337,7 +9333,7 @@ var statusCommand = new Command2("status").description("Show runner status").act
|
|
|
9337
9333
|
});
|
|
9338
9334
|
|
|
9339
9335
|
// src/index.ts
|
|
9340
|
-
var version = true ? "2.0.
|
|
9336
|
+
var version = true ? "2.0.2" : "0.1.0";
|
|
9341
9337
|
program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
|
|
9342
9338
|
program.addCommand(startCommand);
|
|
9343
9339
|
program.addCommand(statusCommand);
|