@vm0/cli 9.82.0 → 9.82.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/{chunk-RGS2GO4Q.js → chunk-2RXB3R33.js} +331 -181
- package/chunk-2RXB3R33.js.map +1 -0
- package/index.js +92 -452
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +49 -42
- package/zero.js.map +1 -1
- package/chunk-RGS2GO4Q.js.map +0 -1
package/index.js
CHANGED
|
@@ -4,19 +4,14 @@ import {
|
|
|
4
4
|
ApiRequestError,
|
|
5
5
|
agentDefinitionSchema,
|
|
6
6
|
cancelRun,
|
|
7
|
-
checkpointsByIdContract,
|
|
8
7
|
clearConfig,
|
|
9
8
|
commitStorage,
|
|
10
|
-
composesByIdContract,
|
|
11
|
-
composesMainContract,
|
|
12
|
-
composesVersionsContract,
|
|
13
9
|
configureGlobalProxyFromEnv,
|
|
14
10
|
createOrUpdateCompose,
|
|
15
11
|
createRun,
|
|
16
12
|
expandFirewallConfigs,
|
|
17
13
|
extractAndGroupVariables,
|
|
18
14
|
getActiveOrg,
|
|
19
|
-
getActiveToken,
|
|
20
15
|
getApiUrl,
|
|
21
16
|
getCheckpoint,
|
|
22
17
|
getClientConfig,
|
|
@@ -52,20 +47,13 @@ import {
|
|
|
52
47
|
resolveSkillRef,
|
|
53
48
|
resolveSkills,
|
|
54
49
|
runAgentEventsContract,
|
|
55
|
-
runEventsContract,
|
|
56
50
|
runMetricsContract,
|
|
57
51
|
runNetworkLogsContract,
|
|
58
52
|
runSystemLogContract,
|
|
59
|
-
runsMainContract,
|
|
60
53
|
saveConfig,
|
|
61
|
-
sessionsByIdContract,
|
|
62
|
-
storagesCommitContract,
|
|
63
|
-
storagesDownloadContract,
|
|
64
|
-
storagesListContract,
|
|
65
|
-
storagesPrepareContract,
|
|
66
54
|
volumeConfigSchema,
|
|
67
55
|
withErrorHandler
|
|
68
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-2RXB3R33.js";
|
|
69
57
|
|
|
70
58
|
// src/index.ts
|
|
71
59
|
import { Command as Command44 } from "commander";
|
|
@@ -451,7 +439,7 @@ function getConfigPath() {
|
|
|
451
439
|
return join(homedir(), ".vm0", "config.json");
|
|
452
440
|
}
|
|
453
441
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
454
|
-
console.log(chalk3.bold(`VM0 CLI v${"9.82.
|
|
442
|
+
console.log(chalk3.bold(`VM0 CLI v${"9.82.2"}`));
|
|
455
443
|
console.log();
|
|
456
444
|
const config = await loadConfig();
|
|
457
445
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1677,7 +1665,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
1677
1665
|
options.autoUpdate = false;
|
|
1678
1666
|
}
|
|
1679
1667
|
if (options.autoUpdate !== false) {
|
|
1680
|
-
await startSilentUpgrade("9.82.
|
|
1668
|
+
await startSilentUpgrade("9.82.2");
|
|
1681
1669
|
}
|
|
1682
1670
|
try {
|
|
1683
1671
|
let result;
|
|
@@ -2512,7 +2500,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
2512
2500
|
withErrorHandler(
|
|
2513
2501
|
async (identifier, prompt, options) => {
|
|
2514
2502
|
if (options.autoUpdate !== false) {
|
|
2515
|
-
await startSilentUpgrade("9.82.
|
|
2503
|
+
await startSilentUpgrade("9.82.2");
|
|
2516
2504
|
}
|
|
2517
2505
|
const { org, name, version } = parseIdentifier(identifier);
|
|
2518
2506
|
let composeId;
|
|
@@ -4268,7 +4256,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
4268
4256
|
withErrorHandler(
|
|
4269
4257
|
async (prompt, options) => {
|
|
4270
4258
|
if (options.autoUpdate !== false) {
|
|
4271
|
-
const shouldExit = await checkAndUpgrade("9.82.
|
|
4259
|
+
const shouldExit = await checkAndUpgrade("9.82.2", prompt);
|
|
4272
4260
|
if (shouldExit) {
|
|
4273
4261
|
process.exit(0);
|
|
4274
4262
|
}
|
|
@@ -4453,431 +4441,91 @@ var cookCommand = cookAction;
|
|
|
4453
4441
|
import { Command as Command40 } from "commander";
|
|
4454
4442
|
import chalk34 from "chalk";
|
|
4455
4443
|
|
|
4456
|
-
// src/lib/api/
|
|
4444
|
+
// src/lib/api/domains/logs.ts
|
|
4457
4445
|
import { initClient } from "@ts-rest/core";
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
4468
|
-
if (bypassSecret) {
|
|
4469
|
-
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
4470
|
-
}
|
|
4471
|
-
return headers;
|
|
4472
|
-
}
|
|
4473
|
-
async getBaseUrl() {
|
|
4474
|
-
const apiUrl = await getApiUrl();
|
|
4475
|
-
if (!apiUrl) {
|
|
4476
|
-
throw new Error("API URL not configured");
|
|
4477
|
-
}
|
|
4478
|
-
return apiUrl;
|
|
4479
|
-
}
|
|
4480
|
-
async getComposeByName(name, org) {
|
|
4481
|
-
const baseUrl = await this.getBaseUrl();
|
|
4482
|
-
const headers = await this.getHeaders();
|
|
4483
|
-
const client = initClient(composesMainContract, {
|
|
4484
|
-
baseUrl,
|
|
4485
|
-
baseHeaders: headers,
|
|
4486
|
-
jsonQuery: false
|
|
4487
|
-
});
|
|
4488
|
-
const result = await client.getByName({
|
|
4489
|
-
query: {
|
|
4490
|
-
name,
|
|
4491
|
-
org
|
|
4492
|
-
}
|
|
4493
|
-
});
|
|
4494
|
-
if (result.status === 200) {
|
|
4495
|
-
return result.body;
|
|
4496
|
-
}
|
|
4497
|
-
const errorBody = result.body;
|
|
4498
|
-
const message = errorBody.error?.message || `Compose not found: ${name}`;
|
|
4499
|
-
throw new Error(message);
|
|
4500
|
-
}
|
|
4501
|
-
async getComposeById(id) {
|
|
4502
|
-
const baseUrl = await this.getBaseUrl();
|
|
4503
|
-
const headers = await this.getHeaders();
|
|
4504
|
-
const client = initClient(composesByIdContract, {
|
|
4505
|
-
baseUrl,
|
|
4506
|
-
baseHeaders: headers,
|
|
4507
|
-
jsonQuery: false
|
|
4508
|
-
});
|
|
4509
|
-
const result = await client.getById({
|
|
4510
|
-
params: { id }
|
|
4511
|
-
});
|
|
4512
|
-
if (result.status === 200) {
|
|
4513
|
-
return result.body;
|
|
4514
|
-
}
|
|
4515
|
-
const errorBody = result.body;
|
|
4516
|
-
const message = errorBody.error?.message || `Compose not found: ${id}`;
|
|
4517
|
-
throw new Error(message);
|
|
4518
|
-
}
|
|
4519
|
-
/**
|
|
4520
|
-
* Resolve a version specifier to a full version ID
|
|
4521
|
-
* Supports: "latest", full hash (64 chars), or hash prefix (8+ chars)
|
|
4522
|
-
*/
|
|
4523
|
-
async getComposeVersion(composeId, version) {
|
|
4524
|
-
const baseUrl = await this.getBaseUrl();
|
|
4525
|
-
const headers = await this.getHeaders();
|
|
4526
|
-
const client = initClient(composesVersionsContract, {
|
|
4527
|
-
baseUrl,
|
|
4528
|
-
baseHeaders: headers,
|
|
4529
|
-
jsonQuery: false
|
|
4530
|
-
});
|
|
4531
|
-
const result = await client.resolveVersion({
|
|
4532
|
-
query: {
|
|
4533
|
-
composeId,
|
|
4534
|
-
version
|
|
4535
|
-
}
|
|
4536
|
-
});
|
|
4537
|
-
if (result.status === 200) {
|
|
4538
|
-
return result.body;
|
|
4539
|
-
}
|
|
4540
|
-
const errorBody = result.body;
|
|
4541
|
-
const message = errorBody.error?.message || `Version not found: ${version}`;
|
|
4542
|
-
throw new Error(message);
|
|
4543
|
-
}
|
|
4544
|
-
async createOrUpdateCompose(body) {
|
|
4545
|
-
const baseUrl = await this.getBaseUrl();
|
|
4546
|
-
const headers = await this.getHeaders();
|
|
4547
|
-
const client = initClient(composesMainContract, {
|
|
4548
|
-
baseUrl,
|
|
4549
|
-
baseHeaders: headers,
|
|
4550
|
-
jsonQuery: false
|
|
4551
|
-
});
|
|
4552
|
-
const result = await client.create({
|
|
4553
|
-
body
|
|
4554
|
-
});
|
|
4555
|
-
if (result.status === 200 || result.status === 201) {
|
|
4556
|
-
return result.body;
|
|
4557
|
-
}
|
|
4558
|
-
const errorBody = result.body;
|
|
4559
|
-
const message = errorBody.error?.message || "Failed to create compose";
|
|
4560
|
-
throw new Error(message);
|
|
4561
|
-
}
|
|
4562
|
-
/**
|
|
4563
|
-
* Create a run with unified request format
|
|
4564
|
-
* Supports new runs, checkpoint resume, and session continue
|
|
4565
|
-
* Note: Environment variables are expanded server-side from vars
|
|
4566
|
-
*/
|
|
4567
|
-
async createRun(body) {
|
|
4568
|
-
const baseUrl = await this.getBaseUrl();
|
|
4569
|
-
const headers = await this.getHeaders();
|
|
4570
|
-
const client = initClient(runsMainContract, {
|
|
4571
|
-
baseUrl,
|
|
4572
|
-
baseHeaders: headers,
|
|
4573
|
-
jsonQuery: false
|
|
4574
|
-
});
|
|
4575
|
-
const result = await client.create({ body });
|
|
4576
|
-
if (result.status === 201) {
|
|
4577
|
-
return result.body;
|
|
4578
|
-
}
|
|
4579
|
-
const errorBody = result.body;
|
|
4580
|
-
const message = errorBody.error?.message || "Failed to create run";
|
|
4581
|
-
throw new Error(message);
|
|
4582
|
-
}
|
|
4583
|
-
async getEvents(runId, options) {
|
|
4584
|
-
const config = await getClientConfig();
|
|
4585
|
-
const client = initClient(runEventsContract, config);
|
|
4586
|
-
const result = await client.getEvents({
|
|
4587
|
-
params: { id: runId },
|
|
4588
|
-
query: {
|
|
4589
|
-
since: options?.since ?? -1,
|
|
4590
|
-
limit: options?.limit ?? 100
|
|
4591
|
-
}
|
|
4592
|
-
});
|
|
4593
|
-
if (result.status === 200) {
|
|
4594
|
-
return result.body;
|
|
4595
|
-
}
|
|
4596
|
-
const errorBody = result.body;
|
|
4597
|
-
const message = errorBody.error?.message || "Failed to fetch events";
|
|
4598
|
-
throw new Error(message);
|
|
4599
|
-
}
|
|
4600
|
-
async getSystemLog(runId, options) {
|
|
4601
|
-
const config = await getClientConfig();
|
|
4602
|
-
const client = initClient(runSystemLogContract, config);
|
|
4603
|
-
const result = await client.getSystemLog({
|
|
4604
|
-
params: { id: runId },
|
|
4605
|
-
query: {
|
|
4606
|
-
since: options?.since,
|
|
4607
|
-
limit: options?.limit,
|
|
4608
|
-
order: options?.order
|
|
4609
|
-
}
|
|
4610
|
-
});
|
|
4611
|
-
if (result.status === 200) {
|
|
4612
|
-
return result.body;
|
|
4613
|
-
}
|
|
4614
|
-
const errorBody = result.body;
|
|
4615
|
-
const message = errorBody.error?.message || "Failed to fetch system log";
|
|
4616
|
-
throw new Error(message);
|
|
4617
|
-
}
|
|
4618
|
-
async getMetrics(runId, options) {
|
|
4619
|
-
const config = await getClientConfig();
|
|
4620
|
-
const client = initClient(runMetricsContract, config);
|
|
4621
|
-
const result = await client.getMetrics({
|
|
4622
|
-
params: { id: runId },
|
|
4623
|
-
query: {
|
|
4624
|
-
since: options?.since,
|
|
4625
|
-
limit: options?.limit,
|
|
4626
|
-
order: options?.order
|
|
4627
|
-
}
|
|
4628
|
-
});
|
|
4629
|
-
if (result.status === 200) {
|
|
4630
|
-
return result.body;
|
|
4631
|
-
}
|
|
4632
|
-
const errorBody = result.body;
|
|
4633
|
-
const message = errorBody.error?.message || "Failed to fetch metrics";
|
|
4634
|
-
throw new Error(message);
|
|
4635
|
-
}
|
|
4636
|
-
async getAgentEvents(runId, options) {
|
|
4637
|
-
const config = await getClientConfig();
|
|
4638
|
-
const client = initClient(runAgentEventsContract, config);
|
|
4639
|
-
const result = await client.getAgentEvents({
|
|
4640
|
-
params: { id: runId },
|
|
4641
|
-
query: {
|
|
4642
|
-
since: options?.since,
|
|
4643
|
-
limit: options?.limit,
|
|
4644
|
-
order: options?.order
|
|
4645
|
-
}
|
|
4646
|
-
});
|
|
4647
|
-
if (result.status === 200) {
|
|
4648
|
-
return result.body;
|
|
4649
|
-
}
|
|
4650
|
-
const errorBody = result.body;
|
|
4651
|
-
const message = errorBody.error?.message || "Failed to fetch agent events";
|
|
4652
|
-
throw new Error(message);
|
|
4653
|
-
}
|
|
4654
|
-
async getNetworkLogs(runId, options) {
|
|
4655
|
-
const config = await getClientConfig();
|
|
4656
|
-
const client = initClient(runNetworkLogsContract, config);
|
|
4657
|
-
const result = await client.getNetworkLogs({
|
|
4658
|
-
params: { id: runId },
|
|
4659
|
-
query: {
|
|
4660
|
-
since: options?.since,
|
|
4661
|
-
limit: options?.limit,
|
|
4662
|
-
order: options?.order
|
|
4663
|
-
}
|
|
4664
|
-
});
|
|
4665
|
-
if (result.status === 200) {
|
|
4666
|
-
return result.body;
|
|
4667
|
-
}
|
|
4668
|
-
const errorBody = result.body;
|
|
4669
|
-
const message = errorBody.error?.message || "Failed to fetch network logs";
|
|
4670
|
-
throw new Error(message);
|
|
4671
|
-
}
|
|
4672
|
-
/**
|
|
4673
|
-
* Get session by ID
|
|
4674
|
-
* Used by run continue to fetch session info including secretNames
|
|
4675
|
-
*/
|
|
4676
|
-
async getSession(sessionId) {
|
|
4677
|
-
const baseUrl = await this.getBaseUrl();
|
|
4678
|
-
const headers = await this.getHeaders();
|
|
4679
|
-
const client = initClient(sessionsByIdContract, {
|
|
4680
|
-
baseUrl,
|
|
4681
|
-
baseHeaders: headers,
|
|
4682
|
-
jsonQuery: false
|
|
4683
|
-
});
|
|
4684
|
-
const result = await client.getById({
|
|
4685
|
-
params: { id: sessionId }
|
|
4686
|
-
});
|
|
4687
|
-
if (result.status === 200) {
|
|
4688
|
-
return result.body;
|
|
4689
|
-
}
|
|
4690
|
-
const errorBody = result.body;
|
|
4691
|
-
const message = errorBody.error?.message || `Session not found: ${sessionId}`;
|
|
4692
|
-
throw new Error(message);
|
|
4693
|
-
}
|
|
4694
|
-
/**
|
|
4695
|
-
* Get checkpoint by ID
|
|
4696
|
-
* Used by run resume to fetch checkpoint info including secretNames
|
|
4697
|
-
*/
|
|
4698
|
-
async getCheckpoint(checkpointId) {
|
|
4699
|
-
const config = await getClientConfig();
|
|
4700
|
-
const client = initClient(checkpointsByIdContract, config);
|
|
4701
|
-
const result = await client.getById({
|
|
4702
|
-
params: { id: checkpointId }
|
|
4703
|
-
});
|
|
4704
|
-
if (result.status === 200) {
|
|
4705
|
-
return result.body;
|
|
4706
|
-
}
|
|
4707
|
-
const errorBody = result.body;
|
|
4708
|
-
const message = errorBody.error?.message || `Checkpoint not found: ${checkpointId}`;
|
|
4709
|
-
throw new Error(message);
|
|
4710
|
-
}
|
|
4711
|
-
/**
|
|
4712
|
-
* Prepare storage for direct S3 upload
|
|
4713
|
-
*/
|
|
4714
|
-
async prepareStorage(body) {
|
|
4715
|
-
const baseUrl = await this.getBaseUrl();
|
|
4716
|
-
const headers = await this.getHeaders();
|
|
4717
|
-
const client = initClient(storagesPrepareContract, {
|
|
4718
|
-
baseUrl,
|
|
4719
|
-
baseHeaders: headers,
|
|
4720
|
-
jsonQuery: false
|
|
4721
|
-
});
|
|
4722
|
-
const result = await client.prepare({ body });
|
|
4723
|
-
if (result.status === 200) {
|
|
4724
|
-
return result.body;
|
|
4446
|
+
async function getSystemLog(runId, options) {
|
|
4447
|
+
const config = await getClientConfig();
|
|
4448
|
+
const client = initClient(runSystemLogContract, config);
|
|
4449
|
+
const result = await client.getSystemLog({
|
|
4450
|
+
params: { id: runId },
|
|
4451
|
+
query: {
|
|
4452
|
+
since: options?.since,
|
|
4453
|
+
limit: options?.limit,
|
|
4454
|
+
order: options?.order
|
|
4725
4455
|
}
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
}
|
|
4730
|
-
/**
|
|
4731
|
-
* Commit storage after S3 upload
|
|
4732
|
-
*/
|
|
4733
|
-
async commitStorage(body) {
|
|
4734
|
-
const baseUrl = await this.getBaseUrl();
|
|
4735
|
-
const headers = await this.getHeaders();
|
|
4736
|
-
const client = initClient(storagesCommitContract, {
|
|
4737
|
-
baseUrl,
|
|
4738
|
-
baseHeaders: headers,
|
|
4739
|
-
jsonQuery: false
|
|
4740
|
-
});
|
|
4741
|
-
const result = await client.commit({ body });
|
|
4742
|
-
if (result.status === 200) {
|
|
4743
|
-
return result.body;
|
|
4744
|
-
}
|
|
4745
|
-
const errorBody = result.body;
|
|
4746
|
-
const message = errorBody.error?.message || "Failed to commit storage";
|
|
4747
|
-
throw new Error(message);
|
|
4748
|
-
}
|
|
4749
|
-
/**
|
|
4750
|
-
* Get download URL for storage (volume or artifact)
|
|
4751
|
-
*/
|
|
4752
|
-
async getStorageDownload(query) {
|
|
4753
|
-
const baseUrl = await this.getBaseUrl();
|
|
4754
|
-
const headers = await this.getHeaders();
|
|
4755
|
-
const client = initClient(storagesDownloadContract, {
|
|
4756
|
-
baseUrl,
|
|
4757
|
-
baseHeaders: headers,
|
|
4758
|
-
jsonQuery: false
|
|
4759
|
-
});
|
|
4760
|
-
const result = await client.download({
|
|
4761
|
-
query: {
|
|
4762
|
-
name: query.name,
|
|
4763
|
-
type: query.type,
|
|
4764
|
-
version: query.version
|
|
4765
|
-
}
|
|
4766
|
-
});
|
|
4767
|
-
if (result.status === 200) {
|
|
4768
|
-
return result.body;
|
|
4769
|
-
}
|
|
4770
|
-
const errorBody = result.body;
|
|
4771
|
-
const message = errorBody.error?.message || `Storage "${query.name}" not found`;
|
|
4772
|
-
throw new Error(message);
|
|
4773
|
-
}
|
|
4774
|
-
/**
|
|
4775
|
-
* List storages (volumes or artifacts)
|
|
4776
|
-
*/
|
|
4777
|
-
async listStorages(query) {
|
|
4778
|
-
const baseUrl = await this.getBaseUrl();
|
|
4779
|
-
const headers = await this.getHeaders();
|
|
4780
|
-
const client = initClient(storagesListContract, {
|
|
4781
|
-
baseUrl,
|
|
4782
|
-
baseHeaders: headers,
|
|
4783
|
-
jsonQuery: false
|
|
4784
|
-
});
|
|
4785
|
-
const result = await client.list({ query });
|
|
4786
|
-
if (result.status === 200) {
|
|
4787
|
-
return result.body;
|
|
4788
|
-
}
|
|
4789
|
-
const errorBody = result.body;
|
|
4790
|
-
const message = errorBody.error?.message || `Failed to list ${query.type}s`;
|
|
4791
|
-
throw new Error(message);
|
|
4456
|
+
});
|
|
4457
|
+
if (result.status === 200) {
|
|
4458
|
+
return result.body;
|
|
4792
4459
|
}
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
};
|
|
4805
|
-
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
4806
|
-
if (bypassSecret) {
|
|
4807
|
-
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
4460
|
+
handleError(result, "Failed to fetch system log");
|
|
4461
|
+
}
|
|
4462
|
+
async function getMetrics(runId, options) {
|
|
4463
|
+
const config = await getClientConfig();
|
|
4464
|
+
const client = initClient(runMetricsContract, config);
|
|
4465
|
+
const result = await client.getMetrics({
|
|
4466
|
+
params: { id: runId },
|
|
4467
|
+
query: {
|
|
4468
|
+
since: options?.since,
|
|
4469
|
+
limit: options?.limit,
|
|
4470
|
+
order: options?.order
|
|
4808
4471
|
}
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
});
|
|
4472
|
+
});
|
|
4473
|
+
if (result.status === 200) {
|
|
4474
|
+
return result.body;
|
|
4813
4475
|
}
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
};
|
|
4826
|
-
if (typeof options?.body === "string") {
|
|
4827
|
-
headers["Content-Type"] = "application/json";
|
|
4828
|
-
}
|
|
4829
|
-
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
4830
|
-
if (bypassSecret) {
|
|
4831
|
-
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
4476
|
+
handleError(result, "Failed to fetch metrics");
|
|
4477
|
+
}
|
|
4478
|
+
async function getAgentEvents(runId, options) {
|
|
4479
|
+
const config = await getClientConfig();
|
|
4480
|
+
const client = initClient(runAgentEventsContract, config);
|
|
4481
|
+
const result = await client.getAgentEvents({
|
|
4482
|
+
params: { id: runId },
|
|
4483
|
+
query: {
|
|
4484
|
+
since: options?.since,
|
|
4485
|
+
limit: options?.limit,
|
|
4486
|
+
order: options?.order
|
|
4832
4487
|
}
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
body: options?.body
|
|
4837
|
-
});
|
|
4488
|
+
});
|
|
4489
|
+
if (result.status === 200) {
|
|
4490
|
+
return result.body;
|
|
4838
4491
|
}
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
};
|
|
4851
|
-
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
4852
|
-
if (bypassSecret) {
|
|
4853
|
-
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
4492
|
+
handleError(result, "Failed to fetch agent events");
|
|
4493
|
+
}
|
|
4494
|
+
async function getNetworkLogs(runId, options) {
|
|
4495
|
+
const config = await getClientConfig();
|
|
4496
|
+
const client = initClient(runNetworkLogsContract, config);
|
|
4497
|
+
const result = await client.getNetworkLogs({
|
|
4498
|
+
params: { id: runId },
|
|
4499
|
+
query: {
|
|
4500
|
+
since: options?.since,
|
|
4501
|
+
limit: options?.limit,
|
|
4502
|
+
order: options?.order
|
|
4854
4503
|
}
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
});
|
|
4504
|
+
});
|
|
4505
|
+
if (result.status === 200) {
|
|
4506
|
+
return result.body;
|
|
4859
4507
|
}
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
if (result.status === 200) {
|
|
4875
|
-
return result.body;
|
|
4508
|
+
handleError(result, "Failed to fetch network logs");
|
|
4509
|
+
}
|
|
4510
|
+
async function searchLogs(options) {
|
|
4511
|
+
const config = await getClientConfig();
|
|
4512
|
+
const client = initClient(logsSearchContract, config);
|
|
4513
|
+
const result = await client.searchLogs({
|
|
4514
|
+
query: {
|
|
4515
|
+
keyword: options.keyword,
|
|
4516
|
+
agent: options.agent,
|
|
4517
|
+
runId: options.runId,
|
|
4518
|
+
since: options.since,
|
|
4519
|
+
limit: options.limit,
|
|
4520
|
+
before: options.before,
|
|
4521
|
+
after: options.after
|
|
4876
4522
|
}
|
|
4877
|
-
|
|
4523
|
+
});
|
|
4524
|
+
if (result.status === 200) {
|
|
4525
|
+
return result.body;
|
|
4878
4526
|
}
|
|
4879
|
-
|
|
4880
|
-
|
|
4527
|
+
handleError(result, "Failed to search logs");
|
|
4528
|
+
}
|
|
4881
4529
|
|
|
4882
4530
|
// src/lib/utils/paginate.ts
|
|
4883
4531
|
async function paginate(options) {
|
|
@@ -4991,7 +4639,7 @@ var searchCommand = new Command39().name("search").description("Search agent eve
|
|
|
4991
4639
|
const { before, after } = parseContextOptions(options);
|
|
4992
4640
|
const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
|
|
4993
4641
|
const limit = parseLimit2(options.limit);
|
|
4994
|
-
const response = await
|
|
4642
|
+
const response = await searchLogs({
|
|
4995
4643
|
keyword,
|
|
4996
4644
|
agent: options.agent,
|
|
4997
4645
|
runId: options.run,
|
|
@@ -5187,7 +4835,7 @@ var logsCommand2 = new Command40().name("logs").description("View and search age
|
|
|
5187
4835
|
)
|
|
5188
4836
|
);
|
|
5189
4837
|
async function showAgentEvents(runId, options, platformUrl) {
|
|
5190
|
-
const firstResponse = await
|
|
4838
|
+
const firstResponse = await getAgentEvents(runId, {
|
|
5191
4839
|
since: options.since,
|
|
5192
4840
|
limit: PAGE_LIMIT,
|
|
5193
4841
|
order: options.order
|
|
@@ -5204,7 +4852,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
5204
4852
|
const firstPageTimestamp = lastEvent ? new Date(lastEvent.createdAt).getTime() : void 0;
|
|
5205
4853
|
const remainingEvents = await paginate({
|
|
5206
4854
|
fetchPage: async (since) => {
|
|
5207
|
-
const response = await
|
|
4855
|
+
const response = await getAgentEvents(runId, {
|
|
5208
4856
|
since,
|
|
5209
4857
|
limit: PAGE_LIMIT,
|
|
5210
4858
|
order: options.order
|
|
@@ -5229,7 +4877,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
5229
4877
|
}
|
|
5230
4878
|
async function showSystemLog(runId, options) {
|
|
5231
4879
|
const limit = options.targetCount === "all" ? PAGE_LIMIT : Math.min(options.targetCount, PAGE_LIMIT);
|
|
5232
|
-
const response = await
|
|
4880
|
+
const response = await getSystemLog(runId, {
|
|
5233
4881
|
since: options.since,
|
|
5234
4882
|
limit,
|
|
5235
4883
|
order: options.order
|
|
@@ -5241,7 +4889,7 @@ async function showSystemLog(runId, options) {
|
|
|
5241
4889
|
console.log(response.systemLog);
|
|
5242
4890
|
}
|
|
5243
4891
|
async function showMetrics(runId, options) {
|
|
5244
|
-
const firstResponse = await
|
|
4892
|
+
const firstResponse = await getMetrics(runId, {
|
|
5245
4893
|
since: options.since,
|
|
5246
4894
|
limit: PAGE_LIMIT,
|
|
5247
4895
|
order: options.order
|
|
@@ -5258,7 +4906,7 @@ async function showMetrics(runId, options) {
|
|
|
5258
4906
|
const firstPageTimestamp = lastMetric ? new Date(lastMetric.ts).getTime() : void 0;
|
|
5259
4907
|
const remainingMetrics = await paginate({
|
|
5260
4908
|
fetchPage: async (since) => {
|
|
5261
|
-
const response = await
|
|
4909
|
+
const response = await getMetrics(runId, {
|
|
5262
4910
|
since,
|
|
5263
4911
|
limit: PAGE_LIMIT,
|
|
5264
4912
|
order: options.order
|
|
@@ -5280,7 +4928,7 @@ async function showMetrics(runId, options) {
|
|
|
5280
4928
|
}
|
|
5281
4929
|
}
|
|
5282
4930
|
async function showNetworkLogs(runId, options) {
|
|
5283
|
-
const firstResponse = await
|
|
4931
|
+
const firstResponse = await getNetworkLogs(runId, {
|
|
5284
4932
|
since: options.since,
|
|
5285
4933
|
limit: PAGE_LIMIT,
|
|
5286
4934
|
order: options.order
|
|
@@ -5301,7 +4949,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
5301
4949
|
const firstPageTimestamp = lastLog ? new Date(lastLog.timestamp).getTime() : void 0;
|
|
5302
4950
|
const remainingLogs = await paginate({
|
|
5303
4951
|
fetchPage: async (since) => {
|
|
5304
|
-
const response = await
|
|
4952
|
+
const response = await getNetworkLogs(runId, {
|
|
5305
4953
|
since,
|
|
5306
4954
|
limit: PAGE_LIMIT,
|
|
5307
4955
|
order: options.order
|
|
@@ -5434,13 +5082,13 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
|
|
|
5434
5082
|
if (latestVersion === null) {
|
|
5435
5083
|
throw new Error("Could not check for updates. Please try again later.");
|
|
5436
5084
|
}
|
|
5437
|
-
if (latestVersion === "9.82.
|
|
5438
|
-
console.log(chalk36.green(`\u2713 Already up to date (${"9.82.
|
|
5085
|
+
if (latestVersion === "9.82.2") {
|
|
5086
|
+
console.log(chalk36.green(`\u2713 Already up to date (${"9.82.2"})`));
|
|
5439
5087
|
return;
|
|
5440
5088
|
}
|
|
5441
5089
|
console.log(
|
|
5442
5090
|
chalk36.yellow(
|
|
5443
|
-
`Current version: ${"9.82.
|
|
5091
|
+
`Current version: ${"9.82.2"} -> Latest version: ${latestVersion}`
|
|
5444
5092
|
)
|
|
5445
5093
|
);
|
|
5446
5094
|
console.log();
|
|
@@ -5467,7 +5115,7 @@ var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CL
|
|
|
5467
5115
|
const success = await performUpgrade(packageManager);
|
|
5468
5116
|
if (success) {
|
|
5469
5117
|
console.log(
|
|
5470
|
-
chalk36.green(`\u2713 Upgraded from ${"9.82.
|
|
5118
|
+
chalk36.green(`\u2713 Upgraded from ${"9.82.2"} to ${latestVersion}`)
|
|
5471
5119
|
);
|
|
5472
5120
|
return;
|
|
5473
5121
|
}
|
|
@@ -5535,7 +5183,7 @@ var whoamiCommand = new Command43().name("whoami").description("Show current ide
|
|
|
5535
5183
|
|
|
5536
5184
|
// src/index.ts
|
|
5537
5185
|
var program = new Command44();
|
|
5538
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.82.
|
|
5186
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.82.2");
|
|
5539
5187
|
program.addCommand(authCommand);
|
|
5540
5188
|
program.addCommand(infoCommand);
|
|
5541
5189
|
program.addCommand(composeCommand);
|
|
@@ -5549,14 +5197,6 @@ program.addCommand(initCommand4);
|
|
|
5549
5197
|
program.addCommand(upgradeCommand);
|
|
5550
5198
|
program.addCommand(whoamiCommand);
|
|
5551
5199
|
if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
|
|
5552
|
-
process.stdout.on("error", (err) => {
|
|
5553
|
-
if (err.code === "EPIPE") process.exit(0);
|
|
5554
|
-
throw err;
|
|
5555
|
-
});
|
|
5556
|
-
process.stderr.on("error", (err) => {
|
|
5557
|
-
if (err.code === "EPIPE") process.exit(0);
|
|
5558
|
-
throw err;
|
|
5559
|
-
});
|
|
5560
5200
|
configureGlobalProxyFromEnv();
|
|
5561
5201
|
program.parse();
|
|
5562
5202
|
}
|