@vm0/cli 5.0.0 → 5.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 +47 -91
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12750,12 +12750,19 @@ var agentEventsResponseSchema = external_exports.object({
|
|
|
12750
12750
|
});
|
|
12751
12751
|
var networkLogEntrySchema = external_exports.object({
|
|
12752
12752
|
timestamp: external_exports.string(),
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12753
|
+
// Common fields (all modes)
|
|
12754
|
+
mode: external_exports.enum(["mitm", "sni"]).optional(),
|
|
12755
|
+
action: external_exports.enum(["ALLOW", "DENY"]).optional(),
|
|
12756
|
+
host: external_exports.string().optional(),
|
|
12757
|
+
port: external_exports.number().optional(),
|
|
12758
|
+
rule_matched: external_exports.string().nullable().optional(),
|
|
12759
|
+
// MITM-only fields (optional)
|
|
12760
|
+
method: external_exports.string().optional(),
|
|
12761
|
+
url: external_exports.string().optional(),
|
|
12762
|
+
status: external_exports.number().optional(),
|
|
12763
|
+
latency_ms: external_exports.number().optional(),
|
|
12764
|
+
request_size: external_exports.number().optional(),
|
|
12765
|
+
response_size: external_exports.number().optional()
|
|
12759
12766
|
});
|
|
12760
12767
|
var networkLogsResponseSchema = external_exports.object({
|
|
12761
12768
|
networkLogs: external_exports.array(networkLogEntrySchema),
|
|
@@ -13287,12 +13294,19 @@ var metricDataSchema = external_exports.object({
|
|
|
13287
13294
|
});
|
|
13288
13295
|
var networkLogSchema = external_exports.object({
|
|
13289
13296
|
timestamp: external_exports.string(),
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13297
|
+
// Common fields (all modes)
|
|
13298
|
+
mode: external_exports.enum(["mitm", "sni"]).optional(),
|
|
13299
|
+
action: external_exports.enum(["ALLOW", "DENY"]).optional(),
|
|
13300
|
+
host: external_exports.string().optional(),
|
|
13301
|
+
port: external_exports.number().optional(),
|
|
13302
|
+
rule_matched: external_exports.string().nullable().optional(),
|
|
13303
|
+
// MITM-only fields (optional)
|
|
13304
|
+
method: external_exports.string().optional(),
|
|
13305
|
+
url: external_exports.string().optional(),
|
|
13306
|
+
status: external_exports.number().optional(),
|
|
13307
|
+
latency_ms: external_exports.number().optional(),
|
|
13308
|
+
request_size: external_exports.number().optional(),
|
|
13309
|
+
response_size: external_exports.number().optional()
|
|
13296
13310
|
});
|
|
13297
13311
|
var webhookTelemetryContract = c5.router({
|
|
13298
13312
|
/**
|
|
@@ -13726,14 +13740,6 @@ var publicAgentDetailSchema = publicAgentSchema.extend({
|
|
|
13726
13740
|
});
|
|
13727
13741
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
13728
13742
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
13729
|
-
var createAgentRequestSchema = external_exports.object({
|
|
13730
|
-
name: external_exports.string().min(1).max(100).regex(
|
|
13731
|
-
/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/,
|
|
13732
|
-
"Name must be lowercase alphanumeric with hyphens, not starting or ending with hyphen"
|
|
13733
|
-
),
|
|
13734
|
-
config: external_exports.unknown()
|
|
13735
|
-
// Agent YAML configuration
|
|
13736
|
-
});
|
|
13737
13743
|
var updateAgentRequestSchema = external_exports.object({
|
|
13738
13744
|
config: external_exports.unknown()
|
|
13739
13745
|
// New agent configuration (creates new version)
|
|
@@ -13753,20 +13759,6 @@ var publicAgentsListContract = c11.router({
|
|
|
13753
13759
|
},
|
|
13754
13760
|
summary: "List agents",
|
|
13755
13761
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
13756
|
-
},
|
|
13757
|
-
create: {
|
|
13758
|
-
method: "POST",
|
|
13759
|
-
path: "/v1/agents",
|
|
13760
|
-
body: createAgentRequestSchema,
|
|
13761
|
-
responses: {
|
|
13762
|
-
201: publicAgentDetailSchema,
|
|
13763
|
-
400: publicApiErrorSchema,
|
|
13764
|
-
401: publicApiErrorSchema,
|
|
13765
|
-
409: publicApiErrorSchema,
|
|
13766
|
-
500: publicApiErrorSchema
|
|
13767
|
-
},
|
|
13768
|
-
summary: "Create agent",
|
|
13769
|
-
description: "Create a new agent with the given configuration"
|
|
13770
13762
|
}
|
|
13771
13763
|
});
|
|
13772
13764
|
var publicAgentByIdContract = c11.router({
|
|
@@ -13801,22 +13793,6 @@ var publicAgentByIdContract = c11.router({
|
|
|
13801
13793
|
},
|
|
13802
13794
|
summary: "Update agent",
|
|
13803
13795
|
description: "Update agent configuration. Creates a new version if config changes."
|
|
13804
|
-
},
|
|
13805
|
-
delete: {
|
|
13806
|
-
method: "DELETE",
|
|
13807
|
-
path: "/v1/agents/:id",
|
|
13808
|
-
pathParams: external_exports.object({
|
|
13809
|
-
id: external_exports.string().min(1, "Agent ID is required")
|
|
13810
|
-
}),
|
|
13811
|
-
body: external_exports.undefined(),
|
|
13812
|
-
responses: {
|
|
13813
|
-
204: external_exports.undefined(),
|
|
13814
|
-
401: publicApiErrorSchema,
|
|
13815
|
-
404: publicApiErrorSchema,
|
|
13816
|
-
500: publicApiErrorSchema
|
|
13817
|
-
},
|
|
13818
|
-
summary: "Delete agent",
|
|
13819
|
-
description: "Archive an agent (soft delete)"
|
|
13820
13796
|
}
|
|
13821
13797
|
});
|
|
13822
13798
|
var publicAgentVersionsContract = c11.router({
|
|
@@ -14187,22 +14163,6 @@ var publicArtifactByIdContract = c13.router({
|
|
|
14187
14163
|
},
|
|
14188
14164
|
summary: "Get artifact",
|
|
14189
14165
|
description: "Get artifact details by ID"
|
|
14190
|
-
},
|
|
14191
|
-
delete: {
|
|
14192
|
-
method: "DELETE",
|
|
14193
|
-
path: "/v1/artifacts/:id",
|
|
14194
|
-
pathParams: external_exports.object({
|
|
14195
|
-
id: external_exports.string().min(1, "Artifact ID is required")
|
|
14196
|
-
}),
|
|
14197
|
-
body: external_exports.undefined(),
|
|
14198
|
-
responses: {
|
|
14199
|
-
204: external_exports.undefined(),
|
|
14200
|
-
401: publicApiErrorSchema,
|
|
14201
|
-
404: publicApiErrorSchema,
|
|
14202
|
-
500: publicApiErrorSchema
|
|
14203
|
-
},
|
|
14204
|
-
summary: "Delete artifact",
|
|
14205
|
-
description: "Delete an artifact and all its versions"
|
|
14206
14166
|
}
|
|
14207
14167
|
});
|
|
14208
14168
|
var publicArtifactVersionsContract = c13.router({
|
|
@@ -14400,22 +14360,6 @@ var publicVolumeByIdContract = c14.router({
|
|
|
14400
14360
|
},
|
|
14401
14361
|
summary: "Get volume",
|
|
14402
14362
|
description: "Get volume details by ID"
|
|
14403
|
-
},
|
|
14404
|
-
delete: {
|
|
14405
|
-
method: "DELETE",
|
|
14406
|
-
path: "/v1/volumes/:id",
|
|
14407
|
-
pathParams: external_exports.object({
|
|
14408
|
-
id: external_exports.string().min(1, "Volume ID is required")
|
|
14409
|
-
}),
|
|
14410
|
-
body: external_exports.undefined(),
|
|
14411
|
-
responses: {
|
|
14412
|
-
204: external_exports.undefined(),
|
|
14413
|
-
401: publicApiErrorSchema,
|
|
14414
|
-
404: publicApiErrorSchema,
|
|
14415
|
-
500: publicApiErrorSchema
|
|
14416
|
-
},
|
|
14417
|
-
summary: "Delete volume",
|
|
14418
|
-
description: "Delete a volume and all its versions"
|
|
14419
14363
|
}
|
|
14420
14364
|
});
|
|
14421
14365
|
var publicVolumeVersionsContract = c14.router({
|
|
@@ -18644,7 +18588,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
18644
18588
|
}
|
|
18645
18589
|
var cookCmd = new Command17().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
18646
18590
|
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").action(async (prompt, options) => {
|
|
18647
|
-
const shouldExit = await checkAndUpgrade("5.0.
|
|
18591
|
+
const shouldExit = await checkAndUpgrade("5.0.2", prompt);
|
|
18648
18592
|
if (shouldExit) {
|
|
18649
18593
|
process.exit(0);
|
|
18650
18594
|
}
|
|
@@ -18990,25 +18934,37 @@ function formatMetric(metric) {
|
|
|
18990
18934
|
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}%)`;
|
|
18991
18935
|
}
|
|
18992
18936
|
function formatNetworkLog(entry) {
|
|
18937
|
+
if (entry.mode === "sni" || !entry.method) {
|
|
18938
|
+
const actionColor = entry.action === "ALLOW" ? chalk22.green : chalk22.red;
|
|
18939
|
+
const host = entry.host || "unknown";
|
|
18940
|
+
const port = entry.port || 443;
|
|
18941
|
+
return `[${entry.timestamp}] ${chalk22.cyan("SNI")} ${actionColor(entry.action || "ALLOW")} ${host}:${port} ${chalk22.dim(entry.rule_matched || "")}`;
|
|
18942
|
+
}
|
|
18993
18943
|
let statusColor;
|
|
18994
|
-
|
|
18944
|
+
const status = entry.status || 0;
|
|
18945
|
+
if (status >= 200 && status < 300) {
|
|
18995
18946
|
statusColor = chalk22.green;
|
|
18996
|
-
} else if (
|
|
18947
|
+
} else if (status >= 300 && status < 400) {
|
|
18997
18948
|
statusColor = chalk22.yellow;
|
|
18998
|
-
} else if (
|
|
18949
|
+
} else if (status >= 400) {
|
|
18999
18950
|
statusColor = chalk22.red;
|
|
19000
18951
|
} else {
|
|
19001
18952
|
statusColor = chalk22.gray;
|
|
19002
18953
|
}
|
|
19003
18954
|
let latencyColor;
|
|
19004
|
-
|
|
18955
|
+
const latencyMs = entry.latency_ms || 0;
|
|
18956
|
+
if (latencyMs < 500) {
|
|
19005
18957
|
latencyColor = chalk22.green;
|
|
19006
|
-
} else if (
|
|
18958
|
+
} else if (latencyMs < 2e3) {
|
|
19007
18959
|
latencyColor = chalk22.yellow;
|
|
19008
18960
|
} else {
|
|
19009
18961
|
latencyColor = chalk22.red;
|
|
19010
18962
|
}
|
|
19011
|
-
|
|
18963
|
+
const method = entry.method || "???";
|
|
18964
|
+
const requestSize = entry.request_size || 0;
|
|
18965
|
+
const responseSize = entry.response_size || 0;
|
|
18966
|
+
const url2 = entry.url || entry.host || "unknown";
|
|
18967
|
+
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes8(requestSize)}/${formatBytes8(responseSize)} ${chalk22.dim(url2)}`;
|
|
19012
18968
|
}
|
|
19013
18969
|
function renderAgentEvent(event, provider) {
|
|
19014
18970
|
const eventData = event.eventData;
|
|
@@ -19142,7 +19098,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
19142
19098
|
if (response.networkLogs.length === 0) {
|
|
19143
19099
|
console.log(
|
|
19144
19100
|
chalk22.yellow(
|
|
19145
|
-
"No network logs found for this run. Network logs are only captured when experimental_firewall is enabled on
|
|
19101
|
+
"No network logs found for this run. Network logs are only captured when experimental_firewall is enabled on an experimental_runner."
|
|
19146
19102
|
)
|
|
19147
19103
|
);
|
|
19148
19104
|
return;
|
|
@@ -20195,7 +20151,7 @@ var setupGithubCommand = new Command26().name("setup-github").description("Initi
|
|
|
20195
20151
|
|
|
20196
20152
|
// src/index.ts
|
|
20197
20153
|
var program = new Command27();
|
|
20198
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("5.0.
|
|
20154
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("5.0.2");
|
|
20199
20155
|
program.command("info").description("Display environment information").action(async () => {
|
|
20200
20156
|
console.log(chalk29.bold("System Information:"));
|
|
20201
20157
|
console.log(`Node Version: ${process.version}`);
|