@vm0/cli 5.0.1 → 5.1.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 +65 -33
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12339,7 +12339,9 @@ var storedExecutionContextSchema = external_exports.object({
12339
12339
  encryptedSecrets: external_exports.string().nullable(),
12340
12340
  // AES-256-GCM encrypted secrets
12341
12341
  cliAgentType: external_exports.string(),
12342
- experimentalFirewall: experimentalFirewallSchema.optional()
12342
+ experimentalFirewall: experimentalFirewallSchema.optional(),
12343
+ postCreateCommand: external_exports.string().nullable().optional()
12344
+ // Lifecycle hook
12343
12345
  });
12344
12346
  var executionContextSchema = external_exports.object({
12345
12347
  runId: external_exports.string().uuid(),
@@ -12357,7 +12359,9 @@ var executionContextSchema = external_exports.object({
12357
12359
  secretValues: external_exports.array(external_exports.string()).nullable(),
12358
12360
  cliAgentType: external_exports.string(),
12359
12361
  // Experimental firewall configuration
12360
- experimentalFirewall: experimentalFirewallSchema.optional()
12362
+ experimentalFirewall: experimentalFirewallSchema.optional(),
12363
+ // Lifecycle hook - command to run after working dir creation
12364
+ postCreateCommand: external_exports.string().nullable().optional()
12361
12365
  });
12362
12366
  var runnersJobClaimContract = c.router({
12363
12367
  claim: {
@@ -12750,12 +12754,19 @@ var agentEventsResponseSchema = external_exports.object({
12750
12754
  });
12751
12755
  var networkLogEntrySchema = external_exports.object({
12752
12756
  timestamp: external_exports.string(),
12753
- method: external_exports.string(),
12754
- url: external_exports.string(),
12755
- status: external_exports.number(),
12756
- latency_ms: external_exports.number(),
12757
- request_size: external_exports.number(),
12758
- response_size: external_exports.number()
12757
+ // Common fields (all modes)
12758
+ mode: external_exports.enum(["mitm", "sni"]).optional(),
12759
+ action: external_exports.enum(["ALLOW", "DENY"]).optional(),
12760
+ host: external_exports.string().optional(),
12761
+ port: external_exports.number().optional(),
12762
+ rule_matched: external_exports.string().nullable().optional(),
12763
+ // MITM-only fields (optional)
12764
+ method: external_exports.string().optional(),
12765
+ url: external_exports.string().optional(),
12766
+ status: external_exports.number().optional(),
12767
+ latency_ms: external_exports.number().optional(),
12768
+ request_size: external_exports.number().optional(),
12769
+ response_size: external_exports.number().optional()
12759
12770
  });
12760
12771
  var networkLogsResponseSchema = external_exports.object({
12761
12772
  networkLogs: external_exports.array(networkLogEntrySchema),
@@ -13287,12 +13298,19 @@ var metricDataSchema = external_exports.object({
13287
13298
  });
13288
13299
  var networkLogSchema = external_exports.object({
13289
13300
  timestamp: external_exports.string(),
13290
- method: external_exports.string(),
13291
- url: external_exports.string(),
13292
- status: external_exports.number(),
13293
- latency_ms: external_exports.number(),
13294
- request_size: external_exports.number(),
13295
- response_size: external_exports.number()
13301
+ // Common fields (all modes)
13302
+ mode: external_exports.enum(["mitm", "sni"]).optional(),
13303
+ action: external_exports.enum(["ALLOW", "DENY"]).optional(),
13304
+ host: external_exports.string().optional(),
13305
+ port: external_exports.number().optional(),
13306
+ rule_matched: external_exports.string().nullable().optional(),
13307
+ // MITM-only fields (optional)
13308
+ method: external_exports.string().optional(),
13309
+ url: external_exports.string().optional(),
13310
+ status: external_exports.number().optional(),
13311
+ latency_ms: external_exports.number().optional(),
13312
+ request_size: external_exports.number().optional(),
13313
+ response_size: external_exports.number().optional()
13296
13314
  });
13297
13315
  var webhookTelemetryContract = c5.router({
13298
13316
  /**
@@ -15161,17 +15179,19 @@ function validateAgentCompose(config2) {
15161
15179
  error: "Missing agent.image (required when provider is not auto-configured)"
15162
15180
  };
15163
15181
  }
15164
- if (agent.working_dir !== void 0 && typeof agent.working_dir !== "string") {
15165
- return {
15166
- valid: false,
15167
- error: "agent.working_dir must be a string if provided"
15168
- };
15169
- }
15170
- if (!agent.working_dir && !providerIsSupported) {
15171
- return {
15172
- valid: false,
15173
- error: "Missing agent.working_dir (required when provider is not auto-configured)"
15174
- };
15182
+ if (agent.postCreateCommand !== void 0) {
15183
+ if (typeof agent.postCreateCommand !== "string") {
15184
+ return {
15185
+ valid: false,
15186
+ error: "agent.postCreateCommand must be a string"
15187
+ };
15188
+ }
15189
+ if (agent.postCreateCommand.length === 0) {
15190
+ return {
15191
+ valid: false,
15192
+ error: "agent.postCreateCommand cannot be empty"
15193
+ };
15194
+ }
15175
15195
  }
15176
15196
  if (agent.instructions !== void 0) {
15177
15197
  if (typeof agent.instructions !== "string") {
@@ -18574,7 +18594,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
18574
18594
  }
18575
18595
  var cookCmd = new Command17().name("cook").description("One-click agent preparation and execution from vm0.yaml");
18576
18596
  cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").action(async (prompt, options) => {
18577
- const shouldExit = await checkAndUpgrade("5.0.1", prompt);
18597
+ const shouldExit = await checkAndUpgrade("5.1.0", prompt);
18578
18598
  if (shouldExit) {
18579
18599
  process.exit(0);
18580
18600
  }
@@ -18920,25 +18940,37 @@ function formatMetric(metric) {
18920
18940
  return `[${metric.ts}] CPU: ${metric.cpu.toFixed(1)}% | Mem: ${formatBytes8(metric.mem_used)}/${formatBytes8(metric.mem_total)} (${memPercent}%) | Disk: ${formatBytes8(metric.disk_used)}/${formatBytes8(metric.disk_total)} (${diskPercent}%)`;
18921
18941
  }
18922
18942
  function formatNetworkLog(entry) {
18943
+ if (entry.mode === "sni" || !entry.method) {
18944
+ const actionColor = entry.action === "ALLOW" ? chalk22.green : chalk22.red;
18945
+ const host = entry.host || "unknown";
18946
+ const port = entry.port || 443;
18947
+ return `[${entry.timestamp}] ${chalk22.cyan("SNI")} ${actionColor(entry.action || "ALLOW")} ${host}:${port} ${chalk22.dim(entry.rule_matched || "")}`;
18948
+ }
18923
18949
  let statusColor;
18924
- if (entry.status >= 200 && entry.status < 300) {
18950
+ const status = entry.status || 0;
18951
+ if (status >= 200 && status < 300) {
18925
18952
  statusColor = chalk22.green;
18926
- } else if (entry.status >= 300 && entry.status < 400) {
18953
+ } else if (status >= 300 && status < 400) {
18927
18954
  statusColor = chalk22.yellow;
18928
- } else if (entry.status >= 400) {
18955
+ } else if (status >= 400) {
18929
18956
  statusColor = chalk22.red;
18930
18957
  } else {
18931
18958
  statusColor = chalk22.gray;
18932
18959
  }
18933
18960
  let latencyColor;
18934
- if (entry.latency_ms < 500) {
18961
+ const latencyMs = entry.latency_ms || 0;
18962
+ if (latencyMs < 500) {
18935
18963
  latencyColor = chalk22.green;
18936
- } else if (entry.latency_ms < 2e3) {
18964
+ } else if (latencyMs < 2e3) {
18937
18965
  latencyColor = chalk22.yellow;
18938
18966
  } else {
18939
18967
  latencyColor = chalk22.red;
18940
18968
  }
18941
- return `[${entry.timestamp}] ${entry.method.padEnd(6)} ${statusColor(entry.status)} ${latencyColor(entry.latency_ms + "ms")} ${formatBytes8(entry.request_size)}/${formatBytes8(entry.response_size)} ${chalk22.dim(entry.url)}`;
18969
+ const method = entry.method || "???";
18970
+ const requestSize = entry.request_size || 0;
18971
+ const responseSize = entry.response_size || 0;
18972
+ const url2 = entry.url || entry.host || "unknown";
18973
+ return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes8(requestSize)}/${formatBytes8(responseSize)} ${chalk22.dim(url2)}`;
18942
18974
  }
18943
18975
  function renderAgentEvent(event, provider) {
18944
18976
  const eventData = event.eventData;
@@ -20125,7 +20157,7 @@ var setupGithubCommand = new Command26().name("setup-github").description("Initi
20125
20157
 
20126
20158
  // src/index.ts
20127
20159
  var program = new Command27();
20128
- program.name("vm0").description("VM0 CLI - A modern build tool").version("5.0.1");
20160
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("5.1.0");
20129
20161
  program.command("info").description("Display environment information").action(async () => {
20130
20162
  console.log(chalk29.bold("System Information:"));
20131
20163
  console.log(`Node Version: ${process.version}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",