@vm0/runner 3.10.0 → 3.10.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 +53 -20
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -13,6 +13,16 @@ import yaml from "yaml";
13
13
 
14
14
  // src/lib/paths.ts
15
15
  import path from "path";
16
+
17
+ // src/lib/firecracker/vm-id.ts
18
+ function createVmId(runId) {
19
+ return runId.substring(0, 8).padStart(8, "0");
20
+ }
21
+ function vmIdValue(vmId) {
22
+ return vmId;
23
+ }
24
+
25
+ // src/lib/paths.ts
16
26
  var VM0_RUN_DIR = "/var/run/vm0";
17
27
  var VM0_TMP_PREFIX = "/tmp/vm0";
18
28
  var runtimePaths = {
@@ -34,7 +44,7 @@ var runnerPaths = {
34
44
  /** Check if a directory name is a VM workspace */
35
45
  isVmWorkspace: (dirname) => dirname.startsWith(VM_WORKSPACE_PREFIX),
36
46
  /** Extract vmId from workspace directory name */
37
- extractVmId: (dirname) => dirname.replace(VM_WORKSPACE_PREFIX, "")
47
+ extractVmId: (dirname) => createVmId(dirname.replace(VM_WORKSPACE_PREFIX, ""))
38
48
  };
39
49
  var vmPaths = {
40
50
  /** Firecracker config file (used with --config-file --no-api) */
@@ -360,7 +370,7 @@ function hashString(str) {
360
370
  return Math.abs(hash);
361
371
  }
362
372
  function generateMacAddress(vmId) {
363
- const hash = hashString(vmId);
373
+ const hash = hashString(vmIdValue(vmId));
364
374
  const b1 = hash >> 16 & 255;
365
375
  const b2 = hash >> 8 & 255;
366
376
  const b3 = hash & 255;
@@ -1089,7 +1099,7 @@ var IPRegistry = class {
1089
1099
  return this.withIPLock(async () => {
1090
1100
  const registry = this.readRegistry();
1091
1101
  if (registry.allocations[ip]) {
1092
- registry.allocations[ip].vmId = vmId;
1102
+ registry.allocations[ip].vmId = vmIdValue(vmId);
1093
1103
  this.writeRegistry(registry);
1094
1104
  }
1095
1105
  });
@@ -1102,7 +1112,7 @@ var IPRegistry = class {
1102
1112
  async clearVmIdFromIP(ip, expectedVmId) {
1103
1113
  return this.withIPLock(async () => {
1104
1114
  const registry = this.readRegistry();
1105
- if (registry.allocations[ip] && registry.allocations[ip].vmId === expectedVmId) {
1115
+ if (registry.allocations[ip] && registry.allocations[ip].vmId === vmIdValue(expectedVmId)) {
1106
1116
  registry.allocations[ip].vmId = null;
1107
1117
  this.writeRegistry(registry);
1108
1118
  }
@@ -1122,8 +1132,9 @@ var IPRegistry = class {
1122
1132
  */
1123
1133
  getIPForVm(vmId) {
1124
1134
  const registry = this.readRegistry();
1135
+ const vmIdStr = vmIdValue(vmId);
1125
1136
  for (const [ip, allocation] of Object.entries(registry.allocations)) {
1126
- if (allocation.vmId === vmId) {
1137
+ if (allocation.vmId === vmIdStr) {
1127
1138
  return ip;
1128
1139
  }
1129
1140
  }
@@ -7767,7 +7778,9 @@ var c11 = initContract();
7767
7778
  var modelProviderTypeSchema = z17.enum([
7768
7779
  "claude-code-oauth-token",
7769
7780
  "anthropic-api-key",
7770
- "moonshot-api-key"
7781
+ "openrouter-api-key",
7782
+ "moonshot-api-key",
7783
+ "minimax-api-key"
7771
7784
  ]);
7772
7785
  var modelProviderFrameworkSchema = z17.enum(["claude-code", "codex"]);
7773
7786
  var modelProviderResponseSchema = z17.object({
@@ -7896,6 +7909,27 @@ var modelProvidersSetDefaultContract = c11.router({
7896
7909
  summary: "Set a model provider as default for its framework"
7897
7910
  }
7898
7911
  });
7912
+ var updateModelRequestSchema = z17.object({
7913
+ selectedModel: z17.string().optional()
7914
+ });
7915
+ var modelProvidersUpdateModelContract = c11.router({
7916
+ updateModel: {
7917
+ method: "PATCH",
7918
+ path: "/api/model-providers/:type/model",
7919
+ headers: authHeadersSchema,
7920
+ pathParams: z17.object({
7921
+ type: modelProviderTypeSchema
7922
+ }),
7923
+ body: updateModelRequestSchema,
7924
+ responses: {
7925
+ 200: modelProviderResponseSchema,
7926
+ 401: apiErrorSchema,
7927
+ 404: apiErrorSchema,
7928
+ 500: apiErrorSchema
7929
+ },
7930
+ summary: "Update model selection for an existing provider"
7931
+ }
7932
+ });
7899
7933
 
7900
7934
  // ../../packages/core/src/contracts/sessions.ts
7901
7935
  import { z as z18 } from "zod";
@@ -8331,7 +8365,10 @@ var platformLogStatusSchema = z22.enum([
8331
8365
  "cancelled"
8332
8366
  ]);
8333
8367
  var platformLogEntrySchema = z22.object({
8334
- id: z22.string().uuid()
8368
+ id: z22.string().uuid(),
8369
+ agentName: z22.string(),
8370
+ status: platformLogStatusSchema,
8371
+ createdAt: z22.string()
8335
8372
  });
8336
8373
  var platformLogsListResponseSchema = z22.object({
8337
8374
  data: z22.array(platformLogEntrySchema),
@@ -10037,9 +10074,6 @@ async function uploadNetworkLogs(apiUrl, sandboxToken, runId) {
10037
10074
 
10038
10075
  // src/lib/executor.ts
10039
10076
  var logger10 = createLogger("Executor");
10040
- function getVmIdFromRunId(runId) {
10041
- return runId.split("-")[0] || runId.substring(0, 8);
10042
- }
10043
10077
  async function executeJob(context, config, options = {}) {
10044
10078
  setSandboxContext({
10045
10079
  apiUrl: config.server.url,
@@ -10053,7 +10087,7 @@ async function executeJob(context, config, options = {}) {
10053
10087
  success: true
10054
10088
  });
10055
10089
  }
10056
- const vmId = getVmIdFromRunId(context.runId);
10090
+ const vmId = createVmId(context.runId);
10057
10091
  let vm = null;
10058
10092
  let guestIp = null;
10059
10093
  let vsockClient = null;
@@ -10695,7 +10729,7 @@ function parseFirecrackerCmdline(cmdline) {
10695
10729
  if (sockIdx === -1 || !socketPath) return null;
10696
10730
  const match = socketPath.match(/vm0-([a-f0-9]+)\/firecracker\.sock$/);
10697
10731
  if (!match?.[1]) return null;
10698
- return { vmId: match[1], socketPath };
10732
+ return { vmId: createVmId(match[1]), socketPath };
10699
10733
  }
10700
10734
  function parseMitmproxyCmdline(cmdline) {
10701
10735
  if (!cmdline.includes("mitmproxy") && !cmdline.includes("mitmdump")) {
@@ -10735,7 +10769,8 @@ function findFirecrackerProcesses() {
10735
10769
  }
10736
10770
  function findProcessByVmId(vmId) {
10737
10771
  const processes = findFirecrackerProcesses();
10738
- return processes.find((p) => p.vmId === vmId) || null;
10772
+ const vmIdStr = vmIdValue(vmId);
10773
+ return processes.find((p) => vmIdValue(p.vmId) === vmIdStr) || null;
10739
10774
  }
10740
10775
  function isProcessRunning3(pid) {
10741
10776
  try {
@@ -10870,8 +10905,7 @@ var doctorCommand = new Command2("doctor").description("Diagnose runner health,
10870
10905
  const allocations = getAllocations();
10871
10906
  if (status?.active_run_ids) {
10872
10907
  for (const runId of status.active_run_ids) {
10873
- const vmId = runId.split("-")[0];
10874
- if (!vmId) continue;
10908
+ const vmId = createVmId(runId);
10875
10909
  statusVmIds.add(vmId);
10876
10910
  const proc = processes.find((p) => p.vmId === vmId);
10877
10911
  const ip = getIPForVm(vmId) ?? "not allocated";
@@ -11116,8 +11150,7 @@ var killCommand = new Command3("kill").description("Force terminate a run and cl
11116
11150
  );
11117
11151
  function resolveRunId(input, statusFilePath) {
11118
11152
  if (input.includes("-")) {
11119
- const vmId = input.split("-")[0];
11120
- return { vmId: vmId ?? input, runId: input };
11153
+ return { vmId: createVmId(input), runId: input };
11121
11154
  }
11122
11155
  if (existsSync5(statusFilePath)) {
11123
11156
  try {
@@ -11128,12 +11161,12 @@ function resolveRunId(input, statusFilePath) {
11128
11161
  (id) => id.startsWith(input)
11129
11162
  );
11130
11163
  if (match) {
11131
- return { vmId: input, runId: match };
11164
+ return { vmId: createVmId(match), runId: match };
11132
11165
  }
11133
11166
  } catch {
11134
11167
  }
11135
11168
  }
11136
- return { vmId: input, runId: null };
11169
+ return { vmId: createVmId(input), runId: null };
11137
11170
  }
11138
11171
  async function confirm(message) {
11139
11172
  const rl = readline2.createInterface({
@@ -11260,7 +11293,7 @@ var benchmarkCommand = new Command4("benchmark").description(
11260
11293
  });
11261
11294
 
11262
11295
  // src/index.ts
11263
- var version = true ? "3.10.0" : "0.1.0";
11296
+ var version = true ? "3.10.1" : "0.1.0";
11264
11297
  program.name("vm0-runner").version(version).description("Self-hosted runner for VM0 agents");
11265
11298
  program.addCommand(startCommand);
11266
11299
  program.addCommand(doctorCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/runner",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "description": "Self-hosted runner for VM0 agents",
5
5
  "repository": {
6
6
  "type": "git",