@vm0/cli 9.76.0 → 9.77.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.
- package/index.js +1818 -77
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -47,7 +47,7 @@ if (DSN) {
|
|
|
47
47
|
Sentry.init({
|
|
48
48
|
dsn: DSN,
|
|
49
49
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
50
|
-
release: "9.
|
|
50
|
+
release: "9.77.0",
|
|
51
51
|
sendDefaultPii: false,
|
|
52
52
|
tracesSampleRate: 0,
|
|
53
53
|
shutdownTimeout: 500,
|
|
@@ -66,7 +66,7 @@ if (DSN) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
Sentry.setContext("cli", {
|
|
69
|
-
version: "9.
|
|
69
|
+
version: "9.77.0",
|
|
70
70
|
command: process.argv.slice(2).join(" ")
|
|
71
71
|
});
|
|
72
72
|
Sentry.setContext("runtime", {
|
|
@@ -85,7 +85,7 @@ process.stdout.on("error", handleEpipe);
|
|
|
85
85
|
process.stderr.on("error", handleEpipe);
|
|
86
86
|
|
|
87
87
|
// src/index.ts
|
|
88
|
-
import { Command as
|
|
88
|
+
import { Command as Command137 } from "commander";
|
|
89
89
|
|
|
90
90
|
// src/lib/network/proxy.ts
|
|
91
91
|
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
|
@@ -3410,6 +3410,8 @@ var scheduleResponseSchema = z20.object({
|
|
|
3410
3410
|
id: z20.uuid(),
|
|
3411
3411
|
composeId: z20.uuid(),
|
|
3412
3412
|
composeName: z20.string(),
|
|
3413
|
+
zeroAgentId: z20.uuid(),
|
|
3414
|
+
agentName: z20.string(),
|
|
3413
3415
|
orgSlug: z20.string(),
|
|
3414
3416
|
userId: z20.string(),
|
|
3415
3417
|
name: z20.string(),
|
|
@@ -12446,6 +12448,598 @@ var slackFirewall = {
|
|
|
12446
12448
|
]
|
|
12447
12449
|
};
|
|
12448
12450
|
|
|
12451
|
+
// ../../packages/core/src/firewalls/vercel.generated.ts
|
|
12452
|
+
var vercelFirewall = {
|
|
12453
|
+
name: "vercel",
|
|
12454
|
+
description: "Vercel API",
|
|
12455
|
+
placeholders: {
|
|
12456
|
+
VERCEL_TOKEN: "vcp_Vm0PlaceHolder000000000000000000000000000000000000000000"
|
|
12457
|
+
},
|
|
12458
|
+
apis: [
|
|
12459
|
+
{
|
|
12460
|
+
base: "https://api.vercel.com",
|
|
12461
|
+
auth: {
|
|
12462
|
+
headers: {
|
|
12463
|
+
Authorization: "Bearer ${{ secrets.VERCEL_TOKEN }}"
|
|
12464
|
+
}
|
|
12465
|
+
},
|
|
12466
|
+
permissions: [
|
|
12467
|
+
{
|
|
12468
|
+
name: "unrestricted",
|
|
12469
|
+
description: "Allow all endpoints",
|
|
12470
|
+
rules: ["ANY /{path*}"]
|
|
12471
|
+
},
|
|
12472
|
+
{
|
|
12473
|
+
name: "access-groups:read",
|
|
12474
|
+
rules: [
|
|
12475
|
+
"GET /v1/access-groups",
|
|
12476
|
+
"GET /v1/access-groups/{accessGroupIdOrName}/projects/{projectId}",
|
|
12477
|
+
"GET /v1/access-groups/{idOrName}",
|
|
12478
|
+
"GET /v1/access-groups/{idOrName}/members",
|
|
12479
|
+
"GET /v1/access-groups/{idOrName}/projects"
|
|
12480
|
+
]
|
|
12481
|
+
},
|
|
12482
|
+
{
|
|
12483
|
+
name: "access-groups:write",
|
|
12484
|
+
rules: [
|
|
12485
|
+
"POST /v1/access-groups",
|
|
12486
|
+
"POST /v1/access-groups/{accessGroupIdOrName}/projects",
|
|
12487
|
+
"PATCH /v1/access-groups/{accessGroupIdOrName}/projects/{projectId}",
|
|
12488
|
+
"DELETE /v1/access-groups/{accessGroupIdOrName}/projects/{projectId}",
|
|
12489
|
+
"POST /v1/access-groups/{idOrName}",
|
|
12490
|
+
"DELETE /v1/access-groups/{idOrName}"
|
|
12491
|
+
]
|
|
12492
|
+
},
|
|
12493
|
+
{
|
|
12494
|
+
name: "aliases:read",
|
|
12495
|
+
rules: [
|
|
12496
|
+
"GET /v2/deployments/{id}/aliases",
|
|
12497
|
+
"GET /v4/aliases",
|
|
12498
|
+
"GET /v4/aliases/{idOrAlias}"
|
|
12499
|
+
]
|
|
12500
|
+
},
|
|
12501
|
+
{
|
|
12502
|
+
name: "aliases:write",
|
|
12503
|
+
rules: [
|
|
12504
|
+
"PATCH /aliases/{id}/protection-bypass",
|
|
12505
|
+
"DELETE /v2/aliases/{aliasId}",
|
|
12506
|
+
"POST /v2/deployments/{id}/aliases"
|
|
12507
|
+
]
|
|
12508
|
+
},
|
|
12509
|
+
{
|
|
12510
|
+
name: "artifacts:read",
|
|
12511
|
+
rules: [
|
|
12512
|
+
"GET /v8/artifacts/status",
|
|
12513
|
+
"GET /v8/artifacts/{hash}",
|
|
12514
|
+
"HEAD /v8/artifacts/{hash}"
|
|
12515
|
+
]
|
|
12516
|
+
},
|
|
12517
|
+
{
|
|
12518
|
+
name: "artifacts:write",
|
|
12519
|
+
rules: [
|
|
12520
|
+
"POST /v8/artifacts",
|
|
12521
|
+
"POST /v8/artifacts/events",
|
|
12522
|
+
"PUT /v8/artifacts/{hash}"
|
|
12523
|
+
]
|
|
12524
|
+
},
|
|
12525
|
+
{
|
|
12526
|
+
name: "authentication:read",
|
|
12527
|
+
rules: ["GET /v5/user/tokens", "GET /v5/user/tokens/{tokenId}"]
|
|
12528
|
+
},
|
|
12529
|
+
{
|
|
12530
|
+
name: "authentication:write",
|
|
12531
|
+
rules: ["POST /v3/user/tokens", "DELETE /v3/user/tokens/{tokenId}"]
|
|
12532
|
+
},
|
|
12533
|
+
{
|
|
12534
|
+
name: "billing:read",
|
|
12535
|
+
rules: [
|
|
12536
|
+
"GET /v1/billing/charges",
|
|
12537
|
+
"GET /v1/billing/contract-commitments"
|
|
12538
|
+
]
|
|
12539
|
+
},
|
|
12540
|
+
{
|
|
12541
|
+
name: "billing:write",
|
|
12542
|
+
rules: ["POST /v1/billing/buy"]
|
|
12543
|
+
},
|
|
12544
|
+
{
|
|
12545
|
+
name: "bulk-redirects:read",
|
|
12546
|
+
rules: ["GET /v1/bulk-redirects", "GET /v1/bulk-redirects/versions"]
|
|
12547
|
+
},
|
|
12548
|
+
{
|
|
12549
|
+
name: "bulk-redirects:write",
|
|
12550
|
+
rules: [
|
|
12551
|
+
"PUT /v1/bulk-redirects",
|
|
12552
|
+
"PATCH /v1/bulk-redirects",
|
|
12553
|
+
"DELETE /v1/bulk-redirects",
|
|
12554
|
+
"POST /v1/bulk-redirects/restore",
|
|
12555
|
+
"POST /v1/bulk-redirects/versions"
|
|
12556
|
+
]
|
|
12557
|
+
},
|
|
12558
|
+
{
|
|
12559
|
+
name: "certs:read",
|
|
12560
|
+
rules: ["GET /v8/certs/{id}"]
|
|
12561
|
+
},
|
|
12562
|
+
{
|
|
12563
|
+
name: "certs:write",
|
|
12564
|
+
rules: ["POST /v8/certs", "PUT /v8/certs", "DELETE /v8/certs/{id}"]
|
|
12565
|
+
},
|
|
12566
|
+
{
|
|
12567
|
+
name: "checks-v2:read",
|
|
12568
|
+
rules: [
|
|
12569
|
+
"GET /v2/deployments/{deploymentId}/check-runs",
|
|
12570
|
+
"GET /v2/deployments/{deploymentId}/check-runs/{checkRunId}",
|
|
12571
|
+
"GET /v2/projects/{projectIdOrName}/checks",
|
|
12572
|
+
"GET /v2/projects/{projectIdOrName}/checks/{checkId}",
|
|
12573
|
+
"GET /v2/projects/{projectIdOrName}/checks/{checkId}/runs"
|
|
12574
|
+
]
|
|
12575
|
+
},
|
|
12576
|
+
{
|
|
12577
|
+
name: "checks-v2:write",
|
|
12578
|
+
rules: [
|
|
12579
|
+
"POST /v2/deployments/{deploymentId}/check-runs",
|
|
12580
|
+
"PATCH /v2/deployments/{deploymentId}/check-runs/{checkRunId}",
|
|
12581
|
+
"POST /v2/projects/{projectIdOrName}/checks",
|
|
12582
|
+
"PATCH /v2/projects/{projectIdOrName}/checks/{checkId}",
|
|
12583
|
+
"DELETE /v2/projects/{projectIdOrName}/checks/{checkId}"
|
|
12584
|
+
]
|
|
12585
|
+
},
|
|
12586
|
+
{
|
|
12587
|
+
name: "checks:read",
|
|
12588
|
+
rules: [
|
|
12589
|
+
"GET /v1/deployments/{deploymentId}/checks",
|
|
12590
|
+
"GET /v1/deployments/{deploymentId}/checks/{checkId}"
|
|
12591
|
+
]
|
|
12592
|
+
},
|
|
12593
|
+
{
|
|
12594
|
+
name: "checks:write",
|
|
12595
|
+
rules: [
|
|
12596
|
+
"POST /v1/deployments/{deploymentId}/checks",
|
|
12597
|
+
"PATCH /v1/deployments/{deploymentId}/checks/{checkId}",
|
|
12598
|
+
"POST /v1/deployments/{deploymentId}/checks/{checkId}/rerequest"
|
|
12599
|
+
]
|
|
12600
|
+
},
|
|
12601
|
+
{
|
|
12602
|
+
name: "connect:read",
|
|
12603
|
+
rules: [
|
|
12604
|
+
"GET /v1/connect/networks",
|
|
12605
|
+
"GET /v1/connect/networks/{networkId}"
|
|
12606
|
+
]
|
|
12607
|
+
},
|
|
12608
|
+
{
|
|
12609
|
+
name: "connect:write",
|
|
12610
|
+
rules: [
|
|
12611
|
+
"POST /v1/connect/networks",
|
|
12612
|
+
"PATCH /v1/connect/networks/{networkId}",
|
|
12613
|
+
"DELETE /v1/connect/networks/{networkId}",
|
|
12614
|
+
"PATCH /v1/projects/{idOrName}/shared-connect-links"
|
|
12615
|
+
]
|
|
12616
|
+
},
|
|
12617
|
+
{
|
|
12618
|
+
name: "deployments:read",
|
|
12619
|
+
rules: [
|
|
12620
|
+
"GET /v13/deployments/{idOrUrl}",
|
|
12621
|
+
"GET /v3/deployments/{idOrUrl}/events",
|
|
12622
|
+
"GET /v6/deployments",
|
|
12623
|
+
"GET /v6/deployments/{id}/files",
|
|
12624
|
+
"GET /v8/deployments/{id}/files/{fileId}"
|
|
12625
|
+
]
|
|
12626
|
+
},
|
|
12627
|
+
{
|
|
12628
|
+
name: "deployments:write",
|
|
12629
|
+
rules: [
|
|
12630
|
+
"PATCH /v1/deployments/{deploymentId}/integrations/{integrationConfigurationId}/resources/{resourceId}/actions/{action}",
|
|
12631
|
+
"PATCH /v12/deployments/{id}/cancel",
|
|
12632
|
+
"POST /v13/deployments",
|
|
12633
|
+
"DELETE /v13/deployments/{id}",
|
|
12634
|
+
"POST /v2/files"
|
|
12635
|
+
]
|
|
12636
|
+
},
|
|
12637
|
+
{
|
|
12638
|
+
name: "dns:read",
|
|
12639
|
+
rules: ["GET /v5/domains/{domain}/records"]
|
|
12640
|
+
},
|
|
12641
|
+
{
|
|
12642
|
+
name: "dns:write",
|
|
12643
|
+
rules: [
|
|
12644
|
+
"PATCH /v1/domains/records/{recordId}",
|
|
12645
|
+
"POST /v2/domains/{domain}/records",
|
|
12646
|
+
"DELETE /v2/domains/{domain}/records/{recordId}"
|
|
12647
|
+
]
|
|
12648
|
+
},
|
|
12649
|
+
{
|
|
12650
|
+
name: "domains-registrar:read",
|
|
12651
|
+
rules: [
|
|
12652
|
+
"GET /v1/registrar/domains/{domain}/auth-code",
|
|
12653
|
+
"GET /v1/registrar/domains/{domain}/availability",
|
|
12654
|
+
"GET /v1/registrar/domains/{domain}/contact-info/schema",
|
|
12655
|
+
"GET /v1/registrar/domains/{domain}/price",
|
|
12656
|
+
"GET /v1/registrar/domains/{domain}/transfer",
|
|
12657
|
+
"GET /v1/registrar/orders/{orderId}",
|
|
12658
|
+
"GET /v1/registrar/tlds/supported",
|
|
12659
|
+
"GET /v1/registrar/tlds/{tld}",
|
|
12660
|
+
"GET /v1/registrar/tlds/{tld}/price"
|
|
12661
|
+
]
|
|
12662
|
+
},
|
|
12663
|
+
{
|
|
12664
|
+
name: "domains-registrar:write",
|
|
12665
|
+
rules: [
|
|
12666
|
+
"POST /v1/registrar/domains/availability",
|
|
12667
|
+
"POST /v1/registrar/domains/buy",
|
|
12668
|
+
"PATCH /v1/registrar/domains/{domain}/auto-renew",
|
|
12669
|
+
"POST /v1/registrar/domains/{domain}/buy",
|
|
12670
|
+
"PATCH /v1/registrar/domains/{domain}/nameservers",
|
|
12671
|
+
"POST /v1/registrar/domains/{domain}/renew",
|
|
12672
|
+
"POST /v1/registrar/domains/{domain}/transfer"
|
|
12673
|
+
]
|
|
12674
|
+
},
|
|
12675
|
+
{
|
|
12676
|
+
name: "domains:read",
|
|
12677
|
+
rules: [
|
|
12678
|
+
"GET /v5/domains",
|
|
12679
|
+
"GET /v5/domains/{domain}",
|
|
12680
|
+
"GET /v6/domains/{domain}/config"
|
|
12681
|
+
]
|
|
12682
|
+
},
|
|
12683
|
+
{
|
|
12684
|
+
name: "domains:write",
|
|
12685
|
+
rules: [
|
|
12686
|
+
"PATCH /v3/domains/{domain}",
|
|
12687
|
+
"DELETE /v6/domains/{domain}",
|
|
12688
|
+
"POST /v7/domains"
|
|
12689
|
+
]
|
|
12690
|
+
},
|
|
12691
|
+
{
|
|
12692
|
+
name: "drains:read",
|
|
12693
|
+
rules: ["GET /v1/drains", "GET /v1/drains/{id}"]
|
|
12694
|
+
},
|
|
12695
|
+
{
|
|
12696
|
+
name: "drains:write",
|
|
12697
|
+
rules: [
|
|
12698
|
+
"POST /v1/drains",
|
|
12699
|
+
"POST /v1/drains/test",
|
|
12700
|
+
"PATCH /v1/drains/{id}",
|
|
12701
|
+
"DELETE /v1/drains/{id}"
|
|
12702
|
+
]
|
|
12703
|
+
},
|
|
12704
|
+
{
|
|
12705
|
+
name: "edge-cache:write",
|
|
12706
|
+
rules: [
|
|
12707
|
+
"POST /v1/edge-cache/dangerously-delete-by-src-images",
|
|
12708
|
+
"POST /v1/edge-cache/dangerously-delete-by-tags",
|
|
12709
|
+
"POST /v1/edge-cache/invalidate-by-src-images",
|
|
12710
|
+
"POST /v1/edge-cache/invalidate-by-tags"
|
|
12711
|
+
]
|
|
12712
|
+
},
|
|
12713
|
+
{
|
|
12714
|
+
name: "edge-config:read",
|
|
12715
|
+
rules: [
|
|
12716
|
+
"GET /v1/edge-config",
|
|
12717
|
+
"GET /v1/edge-config/{edgeConfigId}",
|
|
12718
|
+
"GET /v1/edge-config/{edgeConfigId}/backups",
|
|
12719
|
+
"GET /v1/edge-config/{edgeConfigId}/backups/{edgeConfigBackupVersionId}",
|
|
12720
|
+
"GET /v1/edge-config/{edgeConfigId}/item/{edgeConfigItemKey}",
|
|
12721
|
+
"GET /v1/edge-config/{edgeConfigId}/items",
|
|
12722
|
+
"GET /v1/edge-config/{edgeConfigId}/schema",
|
|
12723
|
+
"GET /v1/edge-config/{edgeConfigId}/token/{token}",
|
|
12724
|
+
"GET /v1/edge-config/{edgeConfigId}/tokens"
|
|
12725
|
+
]
|
|
12726
|
+
},
|
|
12727
|
+
{
|
|
12728
|
+
name: "edge-config:write",
|
|
12729
|
+
rules: [
|
|
12730
|
+
"POST /v1/edge-config",
|
|
12731
|
+
"PUT /v1/edge-config/{edgeConfigId}",
|
|
12732
|
+
"DELETE /v1/edge-config/{edgeConfigId}",
|
|
12733
|
+
"PATCH /v1/edge-config/{edgeConfigId}/items",
|
|
12734
|
+
"POST /v1/edge-config/{edgeConfigId}/schema",
|
|
12735
|
+
"DELETE /v1/edge-config/{edgeConfigId}/schema",
|
|
12736
|
+
"POST /v1/edge-config/{edgeConfigId}/token",
|
|
12737
|
+
"DELETE /v1/edge-config/{edgeConfigId}/tokens"
|
|
12738
|
+
]
|
|
12739
|
+
},
|
|
12740
|
+
{
|
|
12741
|
+
name: "environment:read",
|
|
12742
|
+
rules: [
|
|
12743
|
+
"GET /v1/env",
|
|
12744
|
+
"GET /v1/env/{id}",
|
|
12745
|
+
"GET /v9/projects/{idOrName}/custom-environments",
|
|
12746
|
+
"GET /v9/projects/{idOrName}/custom-environments/{environmentSlugOrId}"
|
|
12747
|
+
]
|
|
12748
|
+
},
|
|
12749
|
+
{
|
|
12750
|
+
name: "environment:write",
|
|
12751
|
+
rules: [
|
|
12752
|
+
"POST /v1/env",
|
|
12753
|
+
"PATCH /v1/env",
|
|
12754
|
+
"DELETE /v1/env",
|
|
12755
|
+
"PATCH /v1/env/{id}/unlink/{projectId}",
|
|
12756
|
+
"POST /v9/projects/{idOrName}/custom-environments",
|
|
12757
|
+
"PATCH /v9/projects/{idOrName}/custom-environments/{environmentSlugOrId}",
|
|
12758
|
+
"DELETE /v9/projects/{idOrName}/custom-environments/{environmentSlugOrId}"
|
|
12759
|
+
]
|
|
12760
|
+
},
|
|
12761
|
+
{
|
|
12762
|
+
name: "feature-flags:read",
|
|
12763
|
+
rules: [
|
|
12764
|
+
"GET /v1/deployments/{deploymentId}/feature-flags",
|
|
12765
|
+
"GET /v1/projects/{projectIdOrName}/feature-flags/flags",
|
|
12766
|
+
"GET /v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}",
|
|
12767
|
+
"GET /v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}/versions",
|
|
12768
|
+
"GET /v1/projects/{projectIdOrName}/feature-flags/sdk-keys",
|
|
12769
|
+
"GET /v1/projects/{projectIdOrName}/feature-flags/segments",
|
|
12770
|
+
"GET /v1/projects/{projectIdOrName}/feature-flags/segments/{segmentIdOrSlug}",
|
|
12771
|
+
"GET /v1/projects/{projectIdOrName}/feature-flags/settings",
|
|
12772
|
+
"GET /v1/teams/{teamId}/feature-flags/flags",
|
|
12773
|
+
"GET /v1/teams/{teamId}/feature-flags/settings"
|
|
12774
|
+
]
|
|
12775
|
+
},
|
|
12776
|
+
{
|
|
12777
|
+
name: "feature-flags:write",
|
|
12778
|
+
rules: [
|
|
12779
|
+
"PUT /v1/projects/{projectIdOrName}/feature-flags/flags",
|
|
12780
|
+
"PATCH /v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}",
|
|
12781
|
+
"DELETE /v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}",
|
|
12782
|
+
"PUT /v1/projects/{projectIdOrName}/feature-flags/sdk-keys",
|
|
12783
|
+
"DELETE /v1/projects/{projectIdOrName}/feature-flags/sdk-keys/{hashKey}",
|
|
12784
|
+
"PUT /v1/projects/{projectIdOrName}/feature-flags/segments",
|
|
12785
|
+
"PATCH /v1/projects/{projectIdOrName}/feature-flags/segments/{segmentIdOrSlug}",
|
|
12786
|
+
"DELETE /v1/projects/{projectIdOrName}/feature-flags/segments/{segmentIdOrSlug}",
|
|
12787
|
+
"PATCH /v1/projects/{projectIdOrName}/feature-flags/settings"
|
|
12788
|
+
]
|
|
12789
|
+
},
|
|
12790
|
+
{
|
|
12791
|
+
name: "integrations:read",
|
|
12792
|
+
rules: [
|
|
12793
|
+
"GET /v1/integrations/configuration/{id}",
|
|
12794
|
+
"GET /v1/integrations/configuration/{id}/products",
|
|
12795
|
+
"GET /v1/integrations/configurations",
|
|
12796
|
+
"GET /v1/integrations/git-namespaces",
|
|
12797
|
+
"GET /v1/integrations/integration/{integrationIdOrSlug}/products/{productIdOrSlug}/plans",
|
|
12798
|
+
"GET /v1/integrations/search-repo"
|
|
12799
|
+
]
|
|
12800
|
+
},
|
|
12801
|
+
{
|
|
12802
|
+
name: "integrations:write",
|
|
12803
|
+
rules: [
|
|
12804
|
+
"PATCH /v1/deployments/{deploymentId}/integrations/{integrationConfigurationId}/resources/{resourceId}/actions/{action}",
|
|
12805
|
+
"DELETE /v1/integrations/configuration/{id}",
|
|
12806
|
+
"POST /v1/integrations/installations/{integrationConfigurationId}/resources/{resourceId}/connections",
|
|
12807
|
+
"POST /v1/storage/stores/integration/direct"
|
|
12808
|
+
]
|
|
12809
|
+
},
|
|
12810
|
+
{
|
|
12811
|
+
name: "logDrains:read",
|
|
12812
|
+
rules: [
|
|
12813
|
+
"GET /v1/log-drains",
|
|
12814
|
+
"GET /v1/log-drains/{id}",
|
|
12815
|
+
"GET /v2/integrations/log-drains"
|
|
12816
|
+
]
|
|
12817
|
+
},
|
|
12818
|
+
{
|
|
12819
|
+
name: "logDrains:write",
|
|
12820
|
+
rules: [
|
|
12821
|
+
"DELETE /v1/integrations/log-drains/{id}",
|
|
12822
|
+
"POST /v1/log-drains",
|
|
12823
|
+
"DELETE /v1/log-drains/{id}",
|
|
12824
|
+
"POST /v2/integrations/log-drains"
|
|
12825
|
+
]
|
|
12826
|
+
},
|
|
12827
|
+
{
|
|
12828
|
+
name: "logs:read",
|
|
12829
|
+
rules: [
|
|
12830
|
+
"GET /v1/projects/{projectId}/deployments/{deploymentId}/runtime-logs"
|
|
12831
|
+
]
|
|
12832
|
+
},
|
|
12833
|
+
{
|
|
12834
|
+
name: "marketplace:read",
|
|
12835
|
+
rules: [
|
|
12836
|
+
"GET /v1/installations/{integrationConfigurationId}/account",
|
|
12837
|
+
"GET /v1/installations/{integrationConfigurationId}/billing/invoices/{invoiceId}",
|
|
12838
|
+
"GET /v1/installations/{integrationConfigurationId}/member/{memberId}",
|
|
12839
|
+
"GET /v1/installations/{integrationConfigurationId}/resources",
|
|
12840
|
+
"GET /v1/installations/{integrationConfigurationId}/resources/{resourceId}",
|
|
12841
|
+
"GET /v1/installations/{integrationConfigurationId}/resources/{resourceId}/experimentation/edge-config",
|
|
12842
|
+
"HEAD /v1/installations/{integrationConfigurationId}/resources/{resourceId}/experimentation/edge-config"
|
|
12843
|
+
]
|
|
12844
|
+
},
|
|
12845
|
+
{
|
|
12846
|
+
name: "marketplace:write",
|
|
12847
|
+
rules: [
|
|
12848
|
+
"PATCH /v1/installations/{integrationConfigurationId}",
|
|
12849
|
+
"POST /v1/installations/{integrationConfigurationId}/billing",
|
|
12850
|
+
"POST /v1/installations/{integrationConfigurationId}/billing/balance",
|
|
12851
|
+
"POST /v1/installations/{integrationConfigurationId}/billing/finalize",
|
|
12852
|
+
"POST /v1/installations/{integrationConfigurationId}/billing/invoices",
|
|
12853
|
+
"POST /v1/installations/{integrationConfigurationId}/billing/invoices/{invoiceId}/actions",
|
|
12854
|
+
"POST /v1/installations/{integrationConfigurationId}/events",
|
|
12855
|
+
"PUT /v1/installations/{integrationConfigurationId}/products/{integrationProductIdOrSlug}/resources/{resourceId}/secrets",
|
|
12856
|
+
"PUT /v1/installations/{integrationConfigurationId}/resources/{resourceId}",
|
|
12857
|
+
"PATCH /v1/installations/{integrationConfigurationId}/resources/{resourceId}",
|
|
12858
|
+
"DELETE /v1/installations/{integrationConfigurationId}/resources/{resourceId}",
|
|
12859
|
+
"PUT /v1/installations/{integrationConfigurationId}/resources/{resourceId}/experimentation/edge-config",
|
|
12860
|
+
"POST /v1/installations/{integrationConfigurationId}/resources/{resourceId}/experimentation/items",
|
|
12861
|
+
"PATCH /v1/installations/{integrationConfigurationId}/resources/{resourceId}/experimentation/items/{itemId}",
|
|
12862
|
+
"DELETE /v1/installations/{integrationConfigurationId}/resources/{resourceId}/experimentation/items/{itemId}",
|
|
12863
|
+
"PUT /v1/installations/{integrationConfigurationId}/resources/{resourceId}/secrets"
|
|
12864
|
+
]
|
|
12865
|
+
},
|
|
12866
|
+
{
|
|
12867
|
+
name: "project-routes:read",
|
|
12868
|
+
rules: [
|
|
12869
|
+
"GET /v1/projects/{projectId}/routes",
|
|
12870
|
+
"GET /v1/projects/{projectId}/routes/versions"
|
|
12871
|
+
]
|
|
12872
|
+
},
|
|
12873
|
+
{
|
|
12874
|
+
name: "project-routes:write",
|
|
12875
|
+
rules: [
|
|
12876
|
+
"POST /v1/projects/{projectId}/routes",
|
|
12877
|
+
"PUT /v1/projects/{projectId}/routes",
|
|
12878
|
+
"DELETE /v1/projects/{projectId}/routes",
|
|
12879
|
+
"POST /v1/projects/{projectId}/routes/generate",
|
|
12880
|
+
"POST /v1/projects/{projectId}/routes/versions",
|
|
12881
|
+
"PATCH /v1/projects/{projectId}/routes/{routeId}"
|
|
12882
|
+
]
|
|
12883
|
+
},
|
|
12884
|
+
{
|
|
12885
|
+
name: "projectMembers:read",
|
|
12886
|
+
rules: ["GET /v1/projects/{idOrName}/members"]
|
|
12887
|
+
},
|
|
12888
|
+
{
|
|
12889
|
+
name: "projectMembers:write",
|
|
12890
|
+
rules: [
|
|
12891
|
+
"POST /v1/projects/{idOrName}/members",
|
|
12892
|
+
"DELETE /v1/projects/{idOrName}/members/{uid}"
|
|
12893
|
+
]
|
|
12894
|
+
},
|
|
12895
|
+
{
|
|
12896
|
+
name: "projects:read",
|
|
12897
|
+
rules: [
|
|
12898
|
+
"GET /v1/projects/{idOrName}/env/{id}",
|
|
12899
|
+
"GET /v1/projects/{projectId}/promote/aliases",
|
|
12900
|
+
"GET /v10/projects",
|
|
12901
|
+
"GET /v10/projects/{idOrName}/env",
|
|
12902
|
+
"GET /v9/projects/{idOrName}",
|
|
12903
|
+
"GET /v9/projects/{idOrName}/domains",
|
|
12904
|
+
"GET /v9/projects/{idOrName}/domains/{domain}"
|
|
12905
|
+
]
|
|
12906
|
+
},
|
|
12907
|
+
{
|
|
12908
|
+
name: "projects:write",
|
|
12909
|
+
rules: [
|
|
12910
|
+
"PUT /projects/transfer-request/{code}",
|
|
12911
|
+
"POST /projects/{idOrName}/transfer-request",
|
|
12912
|
+
"POST /v1/projects/{idOrName}/domains/{domain}/move",
|
|
12913
|
+
"DELETE /v1/projects/{idOrName}/env",
|
|
12914
|
+
"PATCH /v1/projects/{idOrName}/protection-bypass",
|
|
12915
|
+
"POST /v1/projects/{projectId}/pause",
|
|
12916
|
+
"POST /v1/projects/{projectId}/rollback/{deploymentId}",
|
|
12917
|
+
"POST /v1/projects/{projectId}/unpause",
|
|
12918
|
+
"POST /v10/projects/{idOrName}/domains",
|
|
12919
|
+
"POST /v10/projects/{idOrName}/env",
|
|
12920
|
+
"POST /v10/projects/{projectId}/promote/{deploymentId}",
|
|
12921
|
+
"POST /v11/projects",
|
|
12922
|
+
"PATCH /v9/projects/{idOrName}",
|
|
12923
|
+
"DELETE /v9/projects/{idOrName}",
|
|
12924
|
+
"PATCH /v9/projects/{idOrName}/domains/{domain}",
|
|
12925
|
+
"DELETE /v9/projects/{idOrName}/domains/{domain}",
|
|
12926
|
+
"POST /v9/projects/{idOrName}/domains/{domain}/verify",
|
|
12927
|
+
"PATCH /v9/projects/{idOrName}/env/{id}",
|
|
12928
|
+
"DELETE /v9/projects/{idOrName}/env/{id}"
|
|
12929
|
+
]
|
|
12930
|
+
},
|
|
12931
|
+
{
|
|
12932
|
+
name: "rolling-release:read",
|
|
12933
|
+
rules: [
|
|
12934
|
+
"GET /v1/projects/{idOrName}/rolling-release",
|
|
12935
|
+
"GET /v1/projects/{idOrName}/rolling-release/billing",
|
|
12936
|
+
"GET /v1/projects/{idOrName}/rolling-release/config"
|
|
12937
|
+
]
|
|
12938
|
+
},
|
|
12939
|
+
{
|
|
12940
|
+
name: "rolling-release:write",
|
|
12941
|
+
rules: [
|
|
12942
|
+
"POST /v1/projects/{idOrName}/rolling-release/approve-stage",
|
|
12943
|
+
"POST /v1/projects/{idOrName}/rolling-release/complete",
|
|
12944
|
+
"PATCH /v1/projects/{idOrName}/rolling-release/config",
|
|
12945
|
+
"DELETE /v1/projects/{idOrName}/rolling-release/config"
|
|
12946
|
+
]
|
|
12947
|
+
},
|
|
12948
|
+
{
|
|
12949
|
+
name: "sandboxes:read",
|
|
12950
|
+
rules: [
|
|
12951
|
+
"GET /v1/sandboxes",
|
|
12952
|
+
"GET /v1/sandboxes/snapshots",
|
|
12953
|
+
"GET /v1/sandboxes/snapshots/{snapshotId}",
|
|
12954
|
+
"GET /v1/sandboxes/{sandboxId}",
|
|
12955
|
+
"GET /v1/sandboxes/{sandboxId}/cmd",
|
|
12956
|
+
"GET /v1/sandboxes/{sandboxId}/cmd/{cmdId}",
|
|
12957
|
+
"GET /v1/sandboxes/{sandboxId}/cmd/{cmdId}/logs"
|
|
12958
|
+
]
|
|
12959
|
+
},
|
|
12960
|
+
{
|
|
12961
|
+
name: "sandboxes:write",
|
|
12962
|
+
rules: [
|
|
12963
|
+
"POST /v1/sandboxes",
|
|
12964
|
+
"DELETE /v1/sandboxes/snapshots/{snapshotId}",
|
|
12965
|
+
"POST /v1/sandboxes/{sandboxId}/cmd",
|
|
12966
|
+
"POST /v1/sandboxes/{sandboxId}/extend-timeout",
|
|
12967
|
+
"POST /v1/sandboxes/{sandboxId}/fs/mkdir",
|
|
12968
|
+
"POST /v1/sandboxes/{sandboxId}/fs/read",
|
|
12969
|
+
"POST /v1/sandboxes/{sandboxId}/fs/write",
|
|
12970
|
+
"POST /v1/sandboxes/{sandboxId}/network-policy",
|
|
12971
|
+
"POST /v1/sandboxes/{sandboxId}/snapshot",
|
|
12972
|
+
"POST /v1/sandboxes/{sandboxId}/stop",
|
|
12973
|
+
"POST /v1/sandboxes/{sandboxId}/{cmdId}/kill"
|
|
12974
|
+
]
|
|
12975
|
+
},
|
|
12976
|
+
{
|
|
12977
|
+
name: "security:read",
|
|
12978
|
+
rules: [
|
|
12979
|
+
"GET /v1/security/firewall/attack-status",
|
|
12980
|
+
"GET /v1/security/firewall/bypass",
|
|
12981
|
+
"GET /v1/security/firewall/config/{configVersion}"
|
|
12982
|
+
]
|
|
12983
|
+
},
|
|
12984
|
+
{
|
|
12985
|
+
name: "security:write",
|
|
12986
|
+
rules: [
|
|
12987
|
+
"POST /v1/security/attack-mode",
|
|
12988
|
+
"POST /v1/security/firewall/bypass",
|
|
12989
|
+
"DELETE /v1/security/firewall/bypass",
|
|
12990
|
+
"PUT /v1/security/firewall/config",
|
|
12991
|
+
"PATCH /v1/security/firewall/config"
|
|
12992
|
+
]
|
|
12993
|
+
},
|
|
12994
|
+
{
|
|
12995
|
+
name: "static-ips:write",
|
|
12996
|
+
rules: ["PATCH /v1/projects/{idOrName}/shared-connect-links"]
|
|
12997
|
+
},
|
|
12998
|
+
{
|
|
12999
|
+
name: "teams:read",
|
|
13000
|
+
rules: [
|
|
13001
|
+
"GET /v1/teams/{teamId}/request/{userId}",
|
|
13002
|
+
"GET /v2/teams",
|
|
13003
|
+
"GET /v2/teams/{teamId}",
|
|
13004
|
+
"GET /v3/teams/{teamId}/members"
|
|
13005
|
+
]
|
|
13006
|
+
},
|
|
13007
|
+
{
|
|
13008
|
+
name: "teams:write",
|
|
13009
|
+
rules: [
|
|
13010
|
+
"POST /v1/teams",
|
|
13011
|
+
"DELETE /v1/teams/{teamId}",
|
|
13012
|
+
"POST /v1/teams/{teamId}/dsync-roles",
|
|
13013
|
+
"DELETE /v1/teams/{teamId}/invites/{inviteId}",
|
|
13014
|
+
"POST /v1/teams/{teamId}/members/teams/join",
|
|
13015
|
+
"PATCH /v1/teams/{teamId}/members/{uid}",
|
|
13016
|
+
"DELETE /v1/teams/{teamId}/members/{uid}",
|
|
13017
|
+
"POST /v1/teams/{teamId}/request",
|
|
13018
|
+
"PATCH /v2/teams/{teamId}",
|
|
13019
|
+
"POST /v2/teams/{teamId}/members"
|
|
13020
|
+
]
|
|
13021
|
+
},
|
|
13022
|
+
{
|
|
13023
|
+
name: "user:read",
|
|
13024
|
+
rules: ["GET /v1/events/types", "GET /v2/user", "GET /v3/events"]
|
|
13025
|
+
},
|
|
13026
|
+
{
|
|
13027
|
+
name: "user:write",
|
|
13028
|
+
rules: ["DELETE /v1/user"]
|
|
13029
|
+
},
|
|
13030
|
+
{
|
|
13031
|
+
name: "webhooks:read",
|
|
13032
|
+
rules: ["GET /v1/webhooks", "GET /v1/webhooks/{id}"]
|
|
13033
|
+
},
|
|
13034
|
+
{
|
|
13035
|
+
name: "webhooks:write",
|
|
13036
|
+
rules: ["POST /v1/webhooks", "DELETE /v1/webhooks/{id}"]
|
|
13037
|
+
}
|
|
13038
|
+
]
|
|
13039
|
+
}
|
|
13040
|
+
]
|
|
13041
|
+
};
|
|
13042
|
+
|
|
12449
13043
|
// ../../packages/core/src/firewalls/index.ts
|
|
12450
13044
|
var builtinFirewalls = {
|
|
12451
13045
|
confluence: confluenceFirewall,
|
|
@@ -12458,7 +13052,8 @@ var builtinFirewalls = {
|
|
|
12458
13052
|
"google-sheets": googleSheetsFirewall,
|
|
12459
13053
|
jira: jiraFirewall,
|
|
12460
13054
|
notion: notionFirewall,
|
|
12461
|
-
slack: slackFirewall
|
|
13055
|
+
slack: slackFirewall,
|
|
13056
|
+
vercel: vercelFirewall
|
|
12462
13057
|
};
|
|
12463
13058
|
|
|
12464
13059
|
// ../../packages/core/src/firewall-loader.ts
|
|
@@ -13581,12 +14176,42 @@ var zeroRunAgentEventsContract = c33.router({
|
|
|
13581
14176
|
// ../../packages/core/src/contracts/zero-schedules.ts
|
|
13582
14177
|
import { z as z36 } from "zod";
|
|
13583
14178
|
var c34 = initContract();
|
|
13584
|
-
var
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
14179
|
+
var zeroDeployScheduleRequestSchema = z36.object({
|
|
14180
|
+
name: z36.string().min(1).max(64, "Schedule name max 64 chars"),
|
|
14181
|
+
cronExpression: z36.string().optional(),
|
|
14182
|
+
atTime: z36.string().optional(),
|
|
14183
|
+
intervalSeconds: z36.number().int().min(0).optional(),
|
|
14184
|
+
timezone: z36.string().default("UTC"),
|
|
14185
|
+
prompt: z36.string().min(1, "Prompt required"),
|
|
14186
|
+
description: z36.string().optional(),
|
|
14187
|
+
appendSystemPrompt: z36.string().optional(),
|
|
14188
|
+
artifactName: z36.string().optional(),
|
|
14189
|
+
artifactVersion: z36.string().optional(),
|
|
14190
|
+
volumeVersions: z36.record(z36.string(), z36.string()).optional(),
|
|
14191
|
+
// Resolved zero agent ID (platform resolves org/name → zeroAgentId)
|
|
14192
|
+
zeroAgentId: z36.string().uuid("Invalid agent ID"),
|
|
14193
|
+
enabled: z36.boolean().optional(),
|
|
14194
|
+
notifyEmail: z36.boolean().optional(),
|
|
14195
|
+
notifySlack: z36.boolean().optional()
|
|
14196
|
+
}).refine(
|
|
14197
|
+
(data) => {
|
|
14198
|
+
const triggers = [
|
|
14199
|
+
data.cronExpression,
|
|
14200
|
+
data.atTime,
|
|
14201
|
+
data.intervalSeconds
|
|
14202
|
+
].filter((v) => v !== void 0);
|
|
14203
|
+
return triggers.length === 1;
|
|
14204
|
+
},
|
|
14205
|
+
{
|
|
14206
|
+
message: "Exactly one of 'cronExpression', 'atTime', or 'intervalSeconds' must be specified"
|
|
14207
|
+
}
|
|
14208
|
+
);
|
|
14209
|
+
var zeroSchedulesMainContract = c34.router({
|
|
14210
|
+
deploy: {
|
|
14211
|
+
method: "POST",
|
|
14212
|
+
path: "/api/zero/schedules",
|
|
13588
14213
|
headers: authHeadersSchema,
|
|
13589
|
-
body:
|
|
14214
|
+
body: zeroDeployScheduleRequestSchema,
|
|
13590
14215
|
responses: {
|
|
13591
14216
|
200: deployScheduleResponseSchema,
|
|
13592
14217
|
201: deployScheduleResponseSchema,
|
|
@@ -13618,7 +14243,7 @@ var zeroSchedulesByNameContract = c34.router({
|
|
|
13618
14243
|
name: z36.string().min(1, "Schedule name required")
|
|
13619
14244
|
}),
|
|
13620
14245
|
query: z36.object({
|
|
13621
|
-
|
|
14246
|
+
zeroAgentId: z36.string().uuid("Agent ID required")
|
|
13622
14247
|
}),
|
|
13623
14248
|
responses: {
|
|
13624
14249
|
204: c34.noBody(),
|
|
@@ -13638,7 +14263,7 @@ var zeroSchedulesEnableContract = c34.router({
|
|
|
13638
14263
|
name: z36.string().min(1, "Schedule name required")
|
|
13639
14264
|
}),
|
|
13640
14265
|
body: z36.object({
|
|
13641
|
-
|
|
14266
|
+
zeroAgentId: z36.string().uuid("Agent ID required")
|
|
13642
14267
|
}),
|
|
13643
14268
|
responses: {
|
|
13644
14269
|
200: scheduleResponseSchema,
|
|
@@ -13657,7 +14282,7 @@ var zeroSchedulesEnableContract = c34.router({
|
|
|
13657
14282
|
name: z36.string().min(1, "Schedule name required")
|
|
13658
14283
|
}),
|
|
13659
14284
|
body: z36.object({
|
|
13660
|
-
|
|
14285
|
+
zeroAgentId: z36.string().uuid("Agent ID required")
|
|
13661
14286
|
}),
|
|
13662
14287
|
responses: {
|
|
13663
14288
|
200: scheduleResponseSchema,
|
|
@@ -14709,7 +15334,7 @@ function getConfigPath() {
|
|
|
14709
15334
|
return join2(homedir2(), ".vm0", "config.json");
|
|
14710
15335
|
}
|
|
14711
15336
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
14712
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
15337
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.77.0"}`));
|
|
14713
15338
|
console.log();
|
|
14714
15339
|
const config = await loadConfig();
|
|
14715
15340
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -15566,11 +16191,75 @@ async function deleteZeroOrg(slug) {
|
|
|
15566
16191
|
handleError(result, "Failed to delete organization");
|
|
15567
16192
|
}
|
|
15568
16193
|
|
|
15569
|
-
// src/lib/api/domains/zero-
|
|
16194
|
+
// src/lib/api/domains/zero-secrets.ts
|
|
15570
16195
|
import { initClient as initClient15 } from "@ts-rest/core";
|
|
15571
|
-
async function
|
|
16196
|
+
async function listZeroSecrets() {
|
|
16197
|
+
const config = await getClientConfig();
|
|
16198
|
+
const client = initClient15(zeroSecretsContract, config);
|
|
16199
|
+
const result = await client.list({ headers: {} });
|
|
16200
|
+
if (result.status === 200) {
|
|
16201
|
+
return result.body;
|
|
16202
|
+
}
|
|
16203
|
+
handleError(result, "Failed to list secrets");
|
|
16204
|
+
}
|
|
16205
|
+
async function setZeroSecret(body) {
|
|
15572
16206
|
const config = await getClientConfig();
|
|
15573
16207
|
const client = initClient15(zeroSecretsContract, config);
|
|
16208
|
+
const result = await client.set({ body });
|
|
16209
|
+
if (result.status === 200 || result.status === 201) {
|
|
16210
|
+
return result.body;
|
|
16211
|
+
}
|
|
16212
|
+
handleError(result, "Failed to set secret");
|
|
16213
|
+
}
|
|
16214
|
+
async function deleteZeroSecret(name) {
|
|
16215
|
+
const config = await getClientConfig();
|
|
16216
|
+
const client = initClient15(zeroSecretsByNameContract, config);
|
|
16217
|
+
const result = await client.delete({
|
|
16218
|
+
params: { name }
|
|
16219
|
+
});
|
|
16220
|
+
if (result.status === 204) {
|
|
16221
|
+
return;
|
|
16222
|
+
}
|
|
16223
|
+
handleError(result, `Secret "${name}" not found`);
|
|
16224
|
+
}
|
|
16225
|
+
|
|
16226
|
+
// src/lib/api/domains/zero-variables.ts
|
|
16227
|
+
import { initClient as initClient16 } from "@ts-rest/core";
|
|
16228
|
+
async function listZeroVariables() {
|
|
16229
|
+
const config = await getClientConfig();
|
|
16230
|
+
const client = initClient16(zeroVariablesContract, config);
|
|
16231
|
+
const result = await client.list({ headers: {} });
|
|
16232
|
+
if (result.status === 200) {
|
|
16233
|
+
return result.body;
|
|
16234
|
+
}
|
|
16235
|
+
handleError(result, "Failed to list variables");
|
|
16236
|
+
}
|
|
16237
|
+
async function setZeroVariable(body) {
|
|
16238
|
+
const config = await getClientConfig();
|
|
16239
|
+
const client = initClient16(zeroVariablesContract, config);
|
|
16240
|
+
const result = await client.set({ body });
|
|
16241
|
+
if (result.status === 200 || result.status === 201) {
|
|
16242
|
+
return result.body;
|
|
16243
|
+
}
|
|
16244
|
+
handleError(result, "Failed to set variable");
|
|
16245
|
+
}
|
|
16246
|
+
async function deleteZeroVariable(name) {
|
|
16247
|
+
const config = await getClientConfig();
|
|
16248
|
+
const client = initClient16(zeroVariablesByNameContract, config);
|
|
16249
|
+
const result = await client.delete({
|
|
16250
|
+
params: { name }
|
|
16251
|
+
});
|
|
16252
|
+
if (result.status === 204) {
|
|
16253
|
+
return;
|
|
16254
|
+
}
|
|
16255
|
+
handleError(result, `Variable "${name}" not found`);
|
|
16256
|
+
}
|
|
16257
|
+
|
|
16258
|
+
// src/lib/api/domains/zero-org-secrets.ts
|
|
16259
|
+
import { initClient as initClient17 } from "@ts-rest/core";
|
|
16260
|
+
async function listZeroOrgSecrets() {
|
|
16261
|
+
const config = await getClientConfig();
|
|
16262
|
+
const client = initClient17(zeroSecretsContract, config);
|
|
15574
16263
|
const result = await client.list({ headers: {} });
|
|
15575
16264
|
if (result.status === 200) {
|
|
15576
16265
|
return result.body;
|
|
@@ -15579,7 +16268,7 @@ async function listZeroOrgSecrets() {
|
|
|
15579
16268
|
}
|
|
15580
16269
|
async function setZeroOrgSecret(body) {
|
|
15581
16270
|
const config = await getClientConfig();
|
|
15582
|
-
const client =
|
|
16271
|
+
const client = initClient17(zeroSecretsContract, config);
|
|
15583
16272
|
const result = await client.set({ body });
|
|
15584
16273
|
if (result.status === 200 || result.status === 201) {
|
|
15585
16274
|
return result.body;
|
|
@@ -15588,7 +16277,7 @@ async function setZeroOrgSecret(body) {
|
|
|
15588
16277
|
}
|
|
15589
16278
|
async function deleteZeroOrgSecret(name) {
|
|
15590
16279
|
const config = await getClientConfig();
|
|
15591
|
-
const client =
|
|
16280
|
+
const client = initClient17(zeroSecretsByNameContract, config);
|
|
15592
16281
|
const result = await client.delete({
|
|
15593
16282
|
params: { name }
|
|
15594
16283
|
});
|
|
@@ -15599,10 +16288,10 @@ async function deleteZeroOrgSecret(name) {
|
|
|
15599
16288
|
}
|
|
15600
16289
|
|
|
15601
16290
|
// src/lib/api/domains/zero-org-variables.ts
|
|
15602
|
-
import { initClient as
|
|
16291
|
+
import { initClient as initClient18 } from "@ts-rest/core";
|
|
15603
16292
|
async function listZeroOrgVariables() {
|
|
15604
16293
|
const config = await getClientConfig();
|
|
15605
|
-
const client =
|
|
16294
|
+
const client = initClient18(zeroVariablesContract, config);
|
|
15606
16295
|
const result = await client.list({ headers: {} });
|
|
15607
16296
|
if (result.status === 200) {
|
|
15608
16297
|
return result.body;
|
|
@@ -15611,7 +16300,7 @@ async function listZeroOrgVariables() {
|
|
|
15611
16300
|
}
|
|
15612
16301
|
async function setZeroOrgVariable(body) {
|
|
15613
16302
|
const config = await getClientConfig();
|
|
15614
|
-
const client =
|
|
16303
|
+
const client = initClient18(zeroVariablesContract, config);
|
|
15615
16304
|
const result = await client.set({ body });
|
|
15616
16305
|
if (result.status === 200 || result.status === 201) {
|
|
15617
16306
|
return result.body;
|
|
@@ -15620,7 +16309,7 @@ async function setZeroOrgVariable(body) {
|
|
|
15620
16309
|
}
|
|
15621
16310
|
async function deleteZeroOrgVariable(name) {
|
|
15622
16311
|
const config = await getClientConfig();
|
|
15623
|
-
const client =
|
|
16312
|
+
const client = initClient18(zeroVariablesByNameContract, config);
|
|
15624
16313
|
const result = await client.delete({
|
|
15625
16314
|
params: { name }
|
|
15626
16315
|
});
|
|
@@ -15631,10 +16320,10 @@ async function deleteZeroOrgVariable(name) {
|
|
|
15631
16320
|
}
|
|
15632
16321
|
|
|
15633
16322
|
// src/lib/api/domains/zero-org-model-providers.ts
|
|
15634
|
-
import { initClient as
|
|
16323
|
+
import { initClient as initClient19 } from "@ts-rest/core";
|
|
15635
16324
|
async function listZeroOrgModelProviders() {
|
|
15636
16325
|
const config = await getClientConfig();
|
|
15637
|
-
const client =
|
|
16326
|
+
const client = initClient19(zeroModelProvidersMainContract, config);
|
|
15638
16327
|
const result = await client.list({ headers: {} });
|
|
15639
16328
|
if (result.status === 200) {
|
|
15640
16329
|
return result.body;
|
|
@@ -15643,7 +16332,7 @@ async function listZeroOrgModelProviders() {
|
|
|
15643
16332
|
}
|
|
15644
16333
|
async function upsertZeroOrgModelProvider(body) {
|
|
15645
16334
|
const config = await getClientConfig();
|
|
15646
|
-
const client =
|
|
16335
|
+
const client = initClient19(zeroModelProvidersMainContract, config);
|
|
15647
16336
|
const result = await client.upsert({ body });
|
|
15648
16337
|
if (result.status === 200 || result.status === 201) {
|
|
15649
16338
|
return result.body;
|
|
@@ -15652,7 +16341,7 @@ async function upsertZeroOrgModelProvider(body) {
|
|
|
15652
16341
|
}
|
|
15653
16342
|
async function deleteZeroOrgModelProvider(type2) {
|
|
15654
16343
|
const config = await getClientConfig();
|
|
15655
|
-
const client =
|
|
16344
|
+
const client = initClient19(zeroModelProvidersByTypeContract, config);
|
|
15656
16345
|
const result = await client.delete({
|
|
15657
16346
|
params: { type: type2 }
|
|
15658
16347
|
});
|
|
@@ -15663,7 +16352,7 @@ async function deleteZeroOrgModelProvider(type2) {
|
|
|
15663
16352
|
}
|
|
15664
16353
|
async function setZeroOrgModelProviderDefault(type2) {
|
|
15665
16354
|
const config = await getClientConfig();
|
|
15666
|
-
const client =
|
|
16355
|
+
const client = initClient19(zeroModelProvidersDefaultContract, config);
|
|
15667
16356
|
const result = await client.setDefault({
|
|
15668
16357
|
params: { type: type2 }
|
|
15669
16358
|
});
|
|
@@ -15674,7 +16363,7 @@ async function setZeroOrgModelProviderDefault(type2) {
|
|
|
15674
16363
|
}
|
|
15675
16364
|
async function updateZeroOrgModelProviderModel(type2, selectedModel) {
|
|
15676
16365
|
const config = await getClientConfig();
|
|
15677
|
-
const client =
|
|
16366
|
+
const client = initClient19(zeroModelProvidersUpdateModelContract, config);
|
|
15678
16367
|
const result = await client.updateModel({
|
|
15679
16368
|
params: { type: type2 },
|
|
15680
16369
|
body: { selectedModel }
|
|
@@ -15686,52 +16375,52 @@ async function updateZeroOrgModelProviderModel(type2, selectedModel) {
|
|
|
15686
16375
|
}
|
|
15687
16376
|
|
|
15688
16377
|
// src/lib/api/domains/zero-agents.ts
|
|
15689
|
-
import { initClient as
|
|
16378
|
+
import { initClient as initClient20 } from "@ts-rest/core";
|
|
15690
16379
|
async function createZeroAgent(body) {
|
|
15691
16380
|
const config = await getClientConfig();
|
|
15692
|
-
const client =
|
|
16381
|
+
const client = initClient20(zeroAgentsMainContract, config);
|
|
15693
16382
|
const result = await client.create({ body });
|
|
15694
16383
|
if (result.status === 201) return result.body;
|
|
15695
16384
|
handleError(result, "Failed to create zero agent");
|
|
15696
16385
|
}
|
|
15697
16386
|
async function listZeroAgents() {
|
|
15698
16387
|
const config = await getClientConfig();
|
|
15699
|
-
const client =
|
|
16388
|
+
const client = initClient20(zeroAgentsMainContract, config);
|
|
15700
16389
|
const result = await client.list({ headers: {} });
|
|
15701
16390
|
if (result.status === 200) return result.body;
|
|
15702
16391
|
handleError(result, "Failed to list zero agents");
|
|
15703
16392
|
}
|
|
15704
16393
|
async function getZeroAgent(name) {
|
|
15705
16394
|
const config = await getClientConfig();
|
|
15706
|
-
const client =
|
|
16395
|
+
const client = initClient20(zeroAgentsByNameContract, config);
|
|
15707
16396
|
const result = await client.get({ params: { name } });
|
|
15708
16397
|
if (result.status === 200) return result.body;
|
|
15709
16398
|
handleError(result, `Zero agent "${name}" not found`);
|
|
15710
16399
|
}
|
|
15711
16400
|
async function updateZeroAgent(name, body) {
|
|
15712
16401
|
const config = await getClientConfig();
|
|
15713
|
-
const client =
|
|
16402
|
+
const client = initClient20(zeroAgentsByNameContract, config);
|
|
15714
16403
|
const result = await client.update({ params: { name }, body });
|
|
15715
16404
|
if (result.status === 200) return result.body;
|
|
15716
16405
|
handleError(result, `Failed to update zero agent "${name}"`);
|
|
15717
16406
|
}
|
|
15718
16407
|
async function deleteZeroAgent(name) {
|
|
15719
16408
|
const config = await getClientConfig();
|
|
15720
|
-
const client =
|
|
16409
|
+
const client = initClient20(zeroAgentsByNameContract, config);
|
|
15721
16410
|
const result = await client.delete({ params: { name } });
|
|
15722
16411
|
if (result.status === 204) return;
|
|
15723
16412
|
handleError(result, `Zero agent "${name}" not found`);
|
|
15724
16413
|
}
|
|
15725
16414
|
async function getZeroAgentInstructions(name) {
|
|
15726
16415
|
const config = await getClientConfig();
|
|
15727
|
-
const client =
|
|
16416
|
+
const client = initClient20(zeroAgentInstructionsContract, config);
|
|
15728
16417
|
const result = await client.get({ params: { name } });
|
|
15729
16418
|
if (result.status === 200) return result.body;
|
|
15730
16419
|
handleError(result, `Failed to get instructions for zero agent "${name}"`);
|
|
15731
16420
|
}
|
|
15732
16421
|
async function updateZeroAgentInstructions(name, content) {
|
|
15733
16422
|
const config = await getClientConfig();
|
|
15734
|
-
const client =
|
|
16423
|
+
const client = initClient20(zeroAgentInstructionsContract, config);
|
|
15735
16424
|
const result = await client.update({
|
|
15736
16425
|
params: { name },
|
|
15737
16426
|
body: { content }
|
|
@@ -15740,6 +16429,87 @@ async function updateZeroAgentInstructions(name, content) {
|
|
|
15740
16429
|
handleError(result, `Failed to update instructions for zero agent "${name}"`);
|
|
15741
16430
|
}
|
|
15742
16431
|
|
|
16432
|
+
// src/lib/api/domains/zero-schedules.ts
|
|
16433
|
+
import { initClient as initClient21 } from "@ts-rest/core";
|
|
16434
|
+
async function deployZeroSchedule(body) {
|
|
16435
|
+
const config = await getClientConfig();
|
|
16436
|
+
const client = initClient21(zeroSchedulesMainContract, config);
|
|
16437
|
+
const result = await client.deploy({ body });
|
|
16438
|
+
if (result.status === 200 || result.status === 201) {
|
|
16439
|
+
return result.body;
|
|
16440
|
+
}
|
|
16441
|
+
handleError(result, "Failed to deploy schedule");
|
|
16442
|
+
}
|
|
16443
|
+
async function listZeroSchedules() {
|
|
16444
|
+
const config = await getClientConfig();
|
|
16445
|
+
const client = initClient21(zeroSchedulesMainContract, config);
|
|
16446
|
+
const result = await client.list({ headers: {} });
|
|
16447
|
+
if (result.status === 200) {
|
|
16448
|
+
return result.body;
|
|
16449
|
+
}
|
|
16450
|
+
handleError(result, "Failed to list schedules");
|
|
16451
|
+
}
|
|
16452
|
+
async function deleteZeroSchedule(params) {
|
|
16453
|
+
const config = await getClientConfig();
|
|
16454
|
+
const client = initClient21(zeroSchedulesByNameContract, config);
|
|
16455
|
+
const result = await client.delete({
|
|
16456
|
+
params: { name: params.name },
|
|
16457
|
+
query: { zeroAgentId: params.zeroAgentId }
|
|
16458
|
+
});
|
|
16459
|
+
if (result.status === 204) {
|
|
16460
|
+
return;
|
|
16461
|
+
}
|
|
16462
|
+
handleError(result, `Schedule "${params.name}" not found on remote`);
|
|
16463
|
+
}
|
|
16464
|
+
async function enableZeroSchedule(params) {
|
|
16465
|
+
const config = await getClientConfig();
|
|
16466
|
+
const client = initClient21(zeroSchedulesEnableContract, config);
|
|
16467
|
+
const result = await client.enable({
|
|
16468
|
+
params: { name: params.name },
|
|
16469
|
+
body: { zeroAgentId: params.zeroAgentId }
|
|
16470
|
+
});
|
|
16471
|
+
if (result.status === 200) {
|
|
16472
|
+
return result.body;
|
|
16473
|
+
}
|
|
16474
|
+
handleError(result, `Failed to enable schedule "${params.name}"`);
|
|
16475
|
+
}
|
|
16476
|
+
async function disableZeroSchedule(params) {
|
|
16477
|
+
const config = await getClientConfig();
|
|
16478
|
+
const client = initClient21(zeroSchedulesEnableContract, config);
|
|
16479
|
+
const result = await client.disable({
|
|
16480
|
+
params: { name: params.name },
|
|
16481
|
+
body: { zeroAgentId: params.zeroAgentId }
|
|
16482
|
+
});
|
|
16483
|
+
if (result.status === 200) {
|
|
16484
|
+
return result.body;
|
|
16485
|
+
}
|
|
16486
|
+
handleError(result, `Failed to disable schedule "${params.name}"`);
|
|
16487
|
+
}
|
|
16488
|
+
async function resolveZeroScheduleByAgent(agentName, scheduleName) {
|
|
16489
|
+
const { schedules } = await listZeroSchedules();
|
|
16490
|
+
const agentSchedules = schedules.filter((s) => s.agentName === agentName);
|
|
16491
|
+
if (agentSchedules.length === 0) {
|
|
16492
|
+
throw new Error(`No schedule found for agent "${agentName}"`);
|
|
16493
|
+
}
|
|
16494
|
+
if (scheduleName) {
|
|
16495
|
+
const match = agentSchedules.find((s) => s.name === scheduleName);
|
|
16496
|
+
if (!match) {
|
|
16497
|
+
const available2 = agentSchedules.map((s) => s.name).join(", ");
|
|
16498
|
+
throw new Error(
|
|
16499
|
+
`Schedule "${scheduleName}" not found for agent "${agentName}". Available schedules: ${available2}`
|
|
16500
|
+
);
|
|
16501
|
+
}
|
|
16502
|
+
return match;
|
|
16503
|
+
}
|
|
16504
|
+
if (agentSchedules.length === 1) {
|
|
16505
|
+
return agentSchedules[0];
|
|
16506
|
+
}
|
|
16507
|
+
const available = agentSchedules.map((s) => s.name).join(", ");
|
|
16508
|
+
throw new Error(
|
|
16509
|
+
`Agent "${agentName}" has multiple schedules. Use --name to specify which one: ${available}`
|
|
16510
|
+
);
|
|
16511
|
+
}
|
|
16512
|
+
|
|
15743
16513
|
// src/lib/domain/yaml-validator.ts
|
|
15744
16514
|
import { z as z43 } from "zod";
|
|
15745
16515
|
var cliAgentNameSchema = z43.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
@@ -17012,7 +17782,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
17012
17782
|
options.autoUpdate = false;
|
|
17013
17783
|
}
|
|
17014
17784
|
if (options.autoUpdate !== false) {
|
|
17015
|
-
await startSilentUpgrade("9.
|
|
17785
|
+
await startSilentUpgrade("9.77.0");
|
|
17016
17786
|
}
|
|
17017
17787
|
try {
|
|
17018
17788
|
let result;
|
|
@@ -17847,7 +18617,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
17847
18617
|
withErrorHandler(
|
|
17848
18618
|
async (identifier, prompt, options) => {
|
|
17849
18619
|
if (options.autoUpdate !== false) {
|
|
17850
|
-
await startSilentUpgrade("9.
|
|
18620
|
+
await startSilentUpgrade("9.77.0");
|
|
17851
18621
|
}
|
|
17852
18622
|
const { org, name, version } = parseIdentifier(identifier);
|
|
17853
18623
|
let composeId;
|
|
@@ -19603,7 +20373,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
19603
20373
|
withErrorHandler(
|
|
19604
20374
|
async (prompt, options) => {
|
|
19605
20375
|
if (options.autoUpdate !== false) {
|
|
19606
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
20376
|
+
const shouldExit = await checkAndUpgrade("9.77.0", prompt);
|
|
19607
20377
|
if (shouldExit) {
|
|
19608
20378
|
process.exit(0);
|
|
19609
20379
|
}
|
|
@@ -19789,7 +20559,7 @@ import { Command as Command40 } from "commander";
|
|
|
19789
20559
|
import chalk36 from "chalk";
|
|
19790
20560
|
|
|
19791
20561
|
// src/lib/api/api-client.ts
|
|
19792
|
-
import { initClient as
|
|
20562
|
+
import { initClient as initClient22 } from "@ts-rest/core";
|
|
19793
20563
|
var ApiClient = class {
|
|
19794
20564
|
async getHeaders() {
|
|
19795
20565
|
const token = await getActiveToken();
|
|
@@ -19815,7 +20585,7 @@ var ApiClient = class {
|
|
|
19815
20585
|
async getComposeByName(name, org) {
|
|
19816
20586
|
const baseUrl = await this.getBaseUrl();
|
|
19817
20587
|
const headers = await this.getHeaders();
|
|
19818
|
-
const client =
|
|
20588
|
+
const client = initClient22(composesMainContract, {
|
|
19819
20589
|
baseUrl,
|
|
19820
20590
|
baseHeaders: headers,
|
|
19821
20591
|
jsonQuery: false
|
|
@@ -19836,7 +20606,7 @@ var ApiClient = class {
|
|
|
19836
20606
|
async getComposeById(id) {
|
|
19837
20607
|
const baseUrl = await this.getBaseUrl();
|
|
19838
20608
|
const headers = await this.getHeaders();
|
|
19839
|
-
const client =
|
|
20609
|
+
const client = initClient22(composesByIdContract, {
|
|
19840
20610
|
baseUrl,
|
|
19841
20611
|
baseHeaders: headers,
|
|
19842
20612
|
jsonQuery: false
|
|
@@ -19858,7 +20628,7 @@ var ApiClient = class {
|
|
|
19858
20628
|
async getComposeVersion(composeId, version) {
|
|
19859
20629
|
const baseUrl = await this.getBaseUrl();
|
|
19860
20630
|
const headers = await this.getHeaders();
|
|
19861
|
-
const client =
|
|
20631
|
+
const client = initClient22(composesVersionsContract, {
|
|
19862
20632
|
baseUrl,
|
|
19863
20633
|
baseHeaders: headers,
|
|
19864
20634
|
jsonQuery: false
|
|
@@ -19879,7 +20649,7 @@ var ApiClient = class {
|
|
|
19879
20649
|
async createOrUpdateCompose(body) {
|
|
19880
20650
|
const baseUrl = await this.getBaseUrl();
|
|
19881
20651
|
const headers = await this.getHeaders();
|
|
19882
|
-
const client =
|
|
20652
|
+
const client = initClient22(composesMainContract, {
|
|
19883
20653
|
baseUrl,
|
|
19884
20654
|
baseHeaders: headers,
|
|
19885
20655
|
jsonQuery: false
|
|
@@ -19902,7 +20672,7 @@ var ApiClient = class {
|
|
|
19902
20672
|
async createRun(body) {
|
|
19903
20673
|
const baseUrl = await this.getBaseUrl();
|
|
19904
20674
|
const headers = await this.getHeaders();
|
|
19905
|
-
const client =
|
|
20675
|
+
const client = initClient22(runsMainContract, {
|
|
19906
20676
|
baseUrl,
|
|
19907
20677
|
baseHeaders: headers,
|
|
19908
20678
|
jsonQuery: false
|
|
@@ -19917,7 +20687,7 @@ var ApiClient = class {
|
|
|
19917
20687
|
}
|
|
19918
20688
|
async getEvents(runId, options) {
|
|
19919
20689
|
const config = await getClientConfig();
|
|
19920
|
-
const client =
|
|
20690
|
+
const client = initClient22(runEventsContract, config);
|
|
19921
20691
|
const result = await client.getEvents({
|
|
19922
20692
|
params: { id: runId },
|
|
19923
20693
|
query: {
|
|
@@ -19934,7 +20704,7 @@ var ApiClient = class {
|
|
|
19934
20704
|
}
|
|
19935
20705
|
async getSystemLog(runId, options) {
|
|
19936
20706
|
const config = await getClientConfig();
|
|
19937
|
-
const client =
|
|
20707
|
+
const client = initClient22(runSystemLogContract, config);
|
|
19938
20708
|
const result = await client.getSystemLog({
|
|
19939
20709
|
params: { id: runId },
|
|
19940
20710
|
query: {
|
|
@@ -19952,7 +20722,7 @@ var ApiClient = class {
|
|
|
19952
20722
|
}
|
|
19953
20723
|
async getMetrics(runId, options) {
|
|
19954
20724
|
const config = await getClientConfig();
|
|
19955
|
-
const client =
|
|
20725
|
+
const client = initClient22(runMetricsContract, config);
|
|
19956
20726
|
const result = await client.getMetrics({
|
|
19957
20727
|
params: { id: runId },
|
|
19958
20728
|
query: {
|
|
@@ -19970,7 +20740,7 @@ var ApiClient = class {
|
|
|
19970
20740
|
}
|
|
19971
20741
|
async getAgentEvents(runId, options) {
|
|
19972
20742
|
const config = await getClientConfig();
|
|
19973
|
-
const client =
|
|
20743
|
+
const client = initClient22(runAgentEventsContract, config);
|
|
19974
20744
|
const result = await client.getAgentEvents({
|
|
19975
20745
|
params: { id: runId },
|
|
19976
20746
|
query: {
|
|
@@ -19988,7 +20758,7 @@ var ApiClient = class {
|
|
|
19988
20758
|
}
|
|
19989
20759
|
async getNetworkLogs(runId, options) {
|
|
19990
20760
|
const config = await getClientConfig();
|
|
19991
|
-
const client =
|
|
20761
|
+
const client = initClient22(runNetworkLogsContract, config);
|
|
19992
20762
|
const result = await client.getNetworkLogs({
|
|
19993
20763
|
params: { id: runId },
|
|
19994
20764
|
query: {
|
|
@@ -20010,7 +20780,7 @@ var ApiClient = class {
|
|
|
20010
20780
|
async getOrg() {
|
|
20011
20781
|
const baseUrl = await this.getBaseUrl();
|
|
20012
20782
|
const headers = await this.getHeaders();
|
|
20013
|
-
const client =
|
|
20783
|
+
const client = initClient22(orgContract, {
|
|
20014
20784
|
baseUrl,
|
|
20015
20785
|
baseHeaders: headers,
|
|
20016
20786
|
jsonQuery: false
|
|
@@ -20029,7 +20799,7 @@ var ApiClient = class {
|
|
|
20029
20799
|
async updateOrg(body) {
|
|
20030
20800
|
const baseUrl = await this.getBaseUrl();
|
|
20031
20801
|
const headers = await this.getHeaders();
|
|
20032
|
-
const client =
|
|
20802
|
+
const client = initClient22(orgContract, {
|
|
20033
20803
|
baseUrl,
|
|
20034
20804
|
baseHeaders: headers,
|
|
20035
20805
|
jsonQuery: false
|
|
@@ -20049,7 +20819,7 @@ var ApiClient = class {
|
|
|
20049
20819
|
async getSession(sessionId) {
|
|
20050
20820
|
const baseUrl = await this.getBaseUrl();
|
|
20051
20821
|
const headers = await this.getHeaders();
|
|
20052
|
-
const client =
|
|
20822
|
+
const client = initClient22(sessionsByIdContract, {
|
|
20053
20823
|
baseUrl,
|
|
20054
20824
|
baseHeaders: headers,
|
|
20055
20825
|
jsonQuery: false
|
|
@@ -20070,7 +20840,7 @@ var ApiClient = class {
|
|
|
20070
20840
|
*/
|
|
20071
20841
|
async getCheckpoint(checkpointId) {
|
|
20072
20842
|
const config = await getClientConfig();
|
|
20073
|
-
const client =
|
|
20843
|
+
const client = initClient22(checkpointsByIdContract, config);
|
|
20074
20844
|
const result = await client.getById({
|
|
20075
20845
|
params: { id: checkpointId }
|
|
20076
20846
|
});
|
|
@@ -20087,7 +20857,7 @@ var ApiClient = class {
|
|
|
20087
20857
|
async prepareStorage(body) {
|
|
20088
20858
|
const baseUrl = await this.getBaseUrl();
|
|
20089
20859
|
const headers = await this.getHeaders();
|
|
20090
|
-
const client =
|
|
20860
|
+
const client = initClient22(storagesPrepareContract, {
|
|
20091
20861
|
baseUrl,
|
|
20092
20862
|
baseHeaders: headers,
|
|
20093
20863
|
jsonQuery: false
|
|
@@ -20106,7 +20876,7 @@ var ApiClient = class {
|
|
|
20106
20876
|
async commitStorage(body) {
|
|
20107
20877
|
const baseUrl = await this.getBaseUrl();
|
|
20108
20878
|
const headers = await this.getHeaders();
|
|
20109
|
-
const client =
|
|
20879
|
+
const client = initClient22(storagesCommitContract, {
|
|
20110
20880
|
baseUrl,
|
|
20111
20881
|
baseHeaders: headers,
|
|
20112
20882
|
jsonQuery: false
|
|
@@ -20125,7 +20895,7 @@ var ApiClient = class {
|
|
|
20125
20895
|
async getStorageDownload(query) {
|
|
20126
20896
|
const baseUrl = await this.getBaseUrl();
|
|
20127
20897
|
const headers = await this.getHeaders();
|
|
20128
|
-
const client =
|
|
20898
|
+
const client = initClient22(storagesDownloadContract, {
|
|
20129
20899
|
baseUrl,
|
|
20130
20900
|
baseHeaders: headers,
|
|
20131
20901
|
jsonQuery: false
|
|
@@ -20150,7 +20920,7 @@ var ApiClient = class {
|
|
|
20150
20920
|
async listStorages(query) {
|
|
20151
20921
|
const baseUrl = await this.getBaseUrl();
|
|
20152
20922
|
const headers = await this.getHeaders();
|
|
20153
|
-
const client =
|
|
20923
|
+
const client = initClient22(storagesListContract, {
|
|
20154
20924
|
baseUrl,
|
|
20155
20925
|
baseHeaders: headers,
|
|
20156
20926
|
jsonQuery: false
|
|
@@ -20170,7 +20940,7 @@ var ApiClient = class {
|
|
|
20170
20940
|
async deploySchedule(body) {
|
|
20171
20941
|
const baseUrl = await this.getBaseUrl();
|
|
20172
20942
|
const headers = await this.getHeaders();
|
|
20173
|
-
const client =
|
|
20943
|
+
const client = initClient22(schedulesMainContract, {
|
|
20174
20944
|
baseUrl,
|
|
20175
20945
|
baseHeaders: headers,
|
|
20176
20946
|
jsonQuery: false
|
|
@@ -20189,7 +20959,7 @@ var ApiClient = class {
|
|
|
20189
20959
|
async listSchedules() {
|
|
20190
20960
|
const baseUrl = await this.getBaseUrl();
|
|
20191
20961
|
const headers = await this.getHeaders();
|
|
20192
|
-
const client =
|
|
20962
|
+
const client = initClient22(schedulesMainContract, {
|
|
20193
20963
|
baseUrl,
|
|
20194
20964
|
baseHeaders: headers,
|
|
20195
20965
|
jsonQuery: false
|
|
@@ -20208,7 +20978,7 @@ var ApiClient = class {
|
|
|
20208
20978
|
async getScheduleByName(params) {
|
|
20209
20979
|
const baseUrl = await this.getBaseUrl();
|
|
20210
20980
|
const headers = await this.getHeaders();
|
|
20211
|
-
const client =
|
|
20981
|
+
const client = initClient22(schedulesByNameContract, {
|
|
20212
20982
|
baseUrl,
|
|
20213
20983
|
baseHeaders: headers,
|
|
20214
20984
|
jsonQuery: false
|
|
@@ -20230,7 +21000,7 @@ var ApiClient = class {
|
|
|
20230
21000
|
async deleteSchedule(params) {
|
|
20231
21001
|
const baseUrl = await this.getBaseUrl();
|
|
20232
21002
|
const headers = await this.getHeaders();
|
|
20233
|
-
const client =
|
|
21003
|
+
const client = initClient22(schedulesByNameContract, {
|
|
20234
21004
|
baseUrl,
|
|
20235
21005
|
baseHeaders: headers,
|
|
20236
21006
|
jsonQuery: false
|
|
@@ -20252,7 +21022,7 @@ var ApiClient = class {
|
|
|
20252
21022
|
async enableSchedule(params) {
|
|
20253
21023
|
const baseUrl = await this.getBaseUrl();
|
|
20254
21024
|
const headers = await this.getHeaders();
|
|
20255
|
-
const client =
|
|
21025
|
+
const client = initClient22(schedulesEnableContract, {
|
|
20256
21026
|
baseUrl,
|
|
20257
21027
|
baseHeaders: headers,
|
|
20258
21028
|
jsonQuery: false
|
|
@@ -20274,7 +21044,7 @@ var ApiClient = class {
|
|
|
20274
21044
|
async disableSchedule(params) {
|
|
20275
21045
|
const baseUrl = await this.getBaseUrl();
|
|
20276
21046
|
const headers = await this.getHeaders();
|
|
20277
|
-
const client =
|
|
21047
|
+
const client = initClient22(schedulesDisableContract, {
|
|
20278
21048
|
baseUrl,
|
|
20279
21049
|
baseHeaders: headers,
|
|
20280
21050
|
jsonQuery: false
|
|
@@ -20296,7 +21066,7 @@ var ApiClient = class {
|
|
|
20296
21066
|
async listScheduleRuns(params) {
|
|
20297
21067
|
const baseUrl = await this.getBaseUrl();
|
|
20298
21068
|
const headers = await this.getHeaders();
|
|
20299
|
-
const client =
|
|
21069
|
+
const client = initClient22(scheduleRunsContract, {
|
|
20300
21070
|
baseUrl,
|
|
20301
21071
|
baseHeaders: headers,
|
|
20302
21072
|
jsonQuery: false
|
|
@@ -20384,7 +21154,7 @@ var ApiClient = class {
|
|
|
20384
21154
|
}
|
|
20385
21155
|
async searchLogs(options) {
|
|
20386
21156
|
const config = await getClientConfig();
|
|
20387
|
-
const client =
|
|
21157
|
+
const client = initClient22(logsSearchContract, config);
|
|
20388
21158
|
const result = await client.searchLogs({
|
|
20389
21159
|
query: {
|
|
20390
21160
|
keyword: options.keyword,
|
|
@@ -23490,7 +24260,7 @@ import { Command as Command88 } from "commander";
|
|
|
23490
24260
|
// src/commands/connector/connect.ts
|
|
23491
24261
|
import { Command as Command84 } from "commander";
|
|
23492
24262
|
import chalk74 from "chalk";
|
|
23493
|
-
import { initClient as
|
|
24263
|
+
import { initClient as initClient23 } from "@ts-rest/core";
|
|
23494
24264
|
|
|
23495
24265
|
// src/commands/connector/lib/computer/start-services.ts
|
|
23496
24266
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -23737,7 +24507,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
23737
24507
|
async function connectComputer(apiUrl, headers) {
|
|
23738
24508
|
await checkComputerDependencies();
|
|
23739
24509
|
console.log(chalk74.cyan("Setting up computer connector..."));
|
|
23740
|
-
const computerClient =
|
|
24510
|
+
const computerClient = initClient23(computerConnectorContract, {
|
|
23741
24511
|
baseUrl: apiUrl,
|
|
23742
24512
|
baseHeaders: headers,
|
|
23743
24513
|
jsonQuery: false
|
|
@@ -23793,7 +24563,7 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
23793
24563
|
}
|
|
23794
24564
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
23795
24565
|
console.log(`Connecting ${chalk74.cyan(connectorType)}...`);
|
|
23796
|
-
const sessionsClient =
|
|
24566
|
+
const sessionsClient = initClient23(connectorSessionsContract, {
|
|
23797
24567
|
baseUrl: apiUrl,
|
|
23798
24568
|
baseHeaders: headers,
|
|
23799
24569
|
jsonQuery: false
|
|
@@ -23816,7 +24586,7 @@ To connect, visit: ${verificationUrl}`));
|
|
|
23816
24586
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
23817
24587
|
);
|
|
23818
24588
|
console.log("\nWaiting for authorization...");
|
|
23819
|
-
const sessionClient =
|
|
24589
|
+
const sessionClient = initClient23(connectorSessionByIdContract, {
|
|
23820
24590
|
baseUrl: apiUrl,
|
|
23821
24591
|
baseHeaders: headers,
|
|
23822
24592
|
jsonQuery: false
|
|
@@ -24156,13 +24926,13 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
24156
24926
|
if (latestVersion === null) {
|
|
24157
24927
|
throw new Error("Could not check for updates. Please try again later.");
|
|
24158
24928
|
}
|
|
24159
|
-
if (latestVersion === "9.
|
|
24160
|
-
console.log(chalk79.green(`\u2713 Already up to date (${"9.
|
|
24929
|
+
if (latestVersion === "9.77.0") {
|
|
24930
|
+
console.log(chalk79.green(`\u2713 Already up to date (${"9.77.0"})`));
|
|
24161
24931
|
return;
|
|
24162
24932
|
}
|
|
24163
24933
|
console.log(
|
|
24164
24934
|
chalk79.yellow(
|
|
24165
|
-
`Current version: ${"9.
|
|
24935
|
+
`Current version: ${"9.77.0"} -> Latest version: ${latestVersion}`
|
|
24166
24936
|
)
|
|
24167
24937
|
);
|
|
24168
24938
|
console.log();
|
|
@@ -24189,7 +24959,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
24189
24959
|
const success = await performUpgrade(packageManager);
|
|
24190
24960
|
if (success) {
|
|
24191
24961
|
console.log(
|
|
24192
|
-
chalk79.green(`\u2713 Upgraded from ${"9.
|
|
24962
|
+
chalk79.green(`\u2713 Upgraded from ${"9.77.0"} to ${latestVersion}`)
|
|
24193
24963
|
);
|
|
24194
24964
|
return;
|
|
24195
24965
|
}
|
|
@@ -24262,7 +25032,7 @@ var whoamiCommand = new Command91().name("whoami").description("Show current ide
|
|
|
24262
25032
|
);
|
|
24263
25033
|
|
|
24264
25034
|
// src/commands/zero/index.ts
|
|
24265
|
-
import { Command as
|
|
25035
|
+
import { Command as Command136 } from "commander";
|
|
24266
25036
|
|
|
24267
25037
|
// src/commands/zero/org/index.ts
|
|
24268
25038
|
import { Command as Command114 } from "commander";
|
|
@@ -25097,12 +25867,983 @@ var deleteCommand6 = new Command119().name("delete").alias("rm").description("De
|
|
|
25097
25867
|
// src/commands/zero/agent/index.ts
|
|
25098
25868
|
var agentCommand2 = new Command120("agent").description("Manage zero agents").addCommand(createCommand).addCommand(editCommand).addCommand(viewCommand).addCommand(listCommand18).addCommand(deleteCommand6);
|
|
25099
25869
|
|
|
25870
|
+
// src/commands/zero/schedule/index.ts
|
|
25871
|
+
import { Command as Command127 } from "commander";
|
|
25872
|
+
|
|
25873
|
+
// src/commands/zero/schedule/setup.ts
|
|
25874
|
+
import { Command as Command121 } from "commander";
|
|
25875
|
+
import chalk105 from "chalk";
|
|
25876
|
+
var FREQUENCY_CHOICES2 = [
|
|
25877
|
+
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
25878
|
+
{
|
|
25879
|
+
title: "Weekly",
|
|
25880
|
+
value: "weekly",
|
|
25881
|
+
description: "Run once per week"
|
|
25882
|
+
},
|
|
25883
|
+
{
|
|
25884
|
+
title: "Monthly",
|
|
25885
|
+
value: "monthly",
|
|
25886
|
+
description: "Run once per month"
|
|
25887
|
+
},
|
|
25888
|
+
{
|
|
25889
|
+
title: "One-time",
|
|
25890
|
+
value: "once",
|
|
25891
|
+
description: "Run once at specific time"
|
|
25892
|
+
},
|
|
25893
|
+
{
|
|
25894
|
+
title: "Loop",
|
|
25895
|
+
value: "loop",
|
|
25896
|
+
description: "Run repeatedly at fixed intervals"
|
|
25897
|
+
}
|
|
25898
|
+
];
|
|
25899
|
+
var DAY_OF_WEEK_CHOICES2 = [
|
|
25900
|
+
{ title: "Monday", value: 1 },
|
|
25901
|
+
{ title: "Tuesday", value: 2 },
|
|
25902
|
+
{ title: "Wednesday", value: 3 },
|
|
25903
|
+
{ title: "Thursday", value: 4 },
|
|
25904
|
+
{ title: "Friday", value: 5 },
|
|
25905
|
+
{ title: "Saturday", value: 6 },
|
|
25906
|
+
{ title: "Sunday", value: 0 }
|
|
25907
|
+
];
|
|
25908
|
+
function parseDayOption2(day, frequency) {
|
|
25909
|
+
if (frequency === "weekly") {
|
|
25910
|
+
const dayMap = {
|
|
25911
|
+
sun: 0,
|
|
25912
|
+
mon: 1,
|
|
25913
|
+
tue: 2,
|
|
25914
|
+
wed: 3,
|
|
25915
|
+
thu: 4,
|
|
25916
|
+
fri: 5,
|
|
25917
|
+
sat: 6
|
|
25918
|
+
};
|
|
25919
|
+
return dayMap[day.toLowerCase()];
|
|
25920
|
+
} else if (frequency === "monthly") {
|
|
25921
|
+
const num = parseInt(day, 10);
|
|
25922
|
+
if (num >= 1 && num <= 31) {
|
|
25923
|
+
return num;
|
|
25924
|
+
}
|
|
25925
|
+
}
|
|
25926
|
+
return void 0;
|
|
25927
|
+
}
|
|
25928
|
+
function formatInTimezone2(isoDate, timezone) {
|
|
25929
|
+
const date = new Date(isoDate);
|
|
25930
|
+
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
25931
|
+
timeZone: timezone,
|
|
25932
|
+
year: "numeric",
|
|
25933
|
+
month: "2-digit",
|
|
25934
|
+
day: "2-digit",
|
|
25935
|
+
hour: "2-digit",
|
|
25936
|
+
minute: "2-digit",
|
|
25937
|
+
hour12: false
|
|
25938
|
+
}).formatToParts(date);
|
|
25939
|
+
const get = (type2) => parts.find((p) => p.type === type2)?.value ?? "";
|
|
25940
|
+
return `${get("year")}-${get("month")}-${get("day")} ${get("hour")}:${get("minute")}`;
|
|
25941
|
+
}
|
|
25942
|
+
function parseFrequencyFromCron2(cron) {
|
|
25943
|
+
const parts = cron.split(" ");
|
|
25944
|
+
if (parts.length !== 5) return null;
|
|
25945
|
+
const [minute, hour, dayOfMonth, , dayOfWeek] = parts;
|
|
25946
|
+
const time = `${hour.padStart(2, "0")}:${minute.padStart(2, "0")}`;
|
|
25947
|
+
if (dayOfMonth === "*" && dayOfWeek === "*") {
|
|
25948
|
+
return { frequency: "daily", time };
|
|
25949
|
+
} else if (dayOfMonth === "*" && dayOfWeek !== "*") {
|
|
25950
|
+
return { frequency: "weekly", day: parseInt(dayOfWeek, 10), time };
|
|
25951
|
+
} else if (dayOfMonth !== "*" && dayOfWeek === "*") {
|
|
25952
|
+
return { frequency: "monthly", day: parseInt(dayOfMonth, 10), time };
|
|
25953
|
+
}
|
|
25954
|
+
return null;
|
|
25955
|
+
}
|
|
25956
|
+
function getExistingDefaults2(existingSchedule) {
|
|
25957
|
+
const defaults = {};
|
|
25958
|
+
if (existingSchedule?.triggerType === "loop") {
|
|
25959
|
+
defaults.frequency = "loop";
|
|
25960
|
+
defaults.intervalSeconds = existingSchedule.intervalSeconds ?? void 0;
|
|
25961
|
+
} else if (existingSchedule?.cronExpression) {
|
|
25962
|
+
const parsed = parseFrequencyFromCron2(existingSchedule.cronExpression);
|
|
25963
|
+
if (parsed) {
|
|
25964
|
+
defaults.frequency = parsed.frequency;
|
|
25965
|
+
defaults.day = parsed.day;
|
|
25966
|
+
defaults.time = parsed.time;
|
|
25967
|
+
}
|
|
25968
|
+
} else if (existingSchedule?.atTime) {
|
|
25969
|
+
defaults.frequency = "once";
|
|
25970
|
+
}
|
|
25971
|
+
return defaults;
|
|
25972
|
+
}
|
|
25973
|
+
async function gatherFrequency2(optionFrequency, existingFrequency) {
|
|
25974
|
+
let frequency = optionFrequency;
|
|
25975
|
+
if (frequency && ["daily", "weekly", "monthly", "once", "loop"].includes(frequency)) {
|
|
25976
|
+
return frequency;
|
|
25977
|
+
}
|
|
25978
|
+
if (!isInteractive()) {
|
|
25979
|
+
throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
|
|
25980
|
+
}
|
|
25981
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES2.findIndex((c42) => c42.value === existingFrequency) : 0;
|
|
25982
|
+
frequency = await promptSelect(
|
|
25983
|
+
"Schedule frequency",
|
|
25984
|
+
FREQUENCY_CHOICES2,
|
|
25985
|
+
defaultIndex >= 0 ? defaultIndex : 0
|
|
25986
|
+
);
|
|
25987
|
+
return frequency || null;
|
|
25988
|
+
}
|
|
25989
|
+
async function gatherDay2(frequency, optionDay, existingDay) {
|
|
25990
|
+
if (frequency !== "weekly" && frequency !== "monthly") {
|
|
25991
|
+
return null;
|
|
25992
|
+
}
|
|
25993
|
+
if (optionDay) {
|
|
25994
|
+
const day2 = parseDayOption2(optionDay, frequency);
|
|
25995
|
+
if (day2 === void 0) {
|
|
25996
|
+
throw new Error(
|
|
25997
|
+
`Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
25998
|
+
);
|
|
25999
|
+
}
|
|
26000
|
+
return day2;
|
|
26001
|
+
}
|
|
26002
|
+
if (!isInteractive()) {
|
|
26003
|
+
throw new Error("--day is required for weekly/monthly");
|
|
26004
|
+
}
|
|
26005
|
+
if (frequency === "weekly") {
|
|
26006
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES2.findIndex((c42) => c42.value === existingDay) : 0;
|
|
26007
|
+
const day2 = await promptSelect(
|
|
26008
|
+
"Day of week",
|
|
26009
|
+
DAY_OF_WEEK_CHOICES2,
|
|
26010
|
+
defaultDayIndex >= 0 ? defaultDayIndex : 0
|
|
26011
|
+
);
|
|
26012
|
+
return day2 ?? null;
|
|
26013
|
+
}
|
|
26014
|
+
const dayStr = await promptText(
|
|
26015
|
+
"Day of month (1-31)",
|
|
26016
|
+
existingDay?.toString() || "1"
|
|
26017
|
+
);
|
|
26018
|
+
if (!dayStr) return null;
|
|
26019
|
+
const day = parseInt(dayStr, 10);
|
|
26020
|
+
if (isNaN(day) || day < 1 || day > 31) {
|
|
26021
|
+
throw new Error("Day must be between 1 and 31");
|
|
26022
|
+
}
|
|
26023
|
+
return day;
|
|
26024
|
+
}
|
|
26025
|
+
async function gatherRecurringTime2(optionTime, existingTime) {
|
|
26026
|
+
if (optionTime) {
|
|
26027
|
+
const validation = validateTimeFormat(optionTime);
|
|
26028
|
+
if (validation !== true) {
|
|
26029
|
+
throw new Error(`Invalid time: ${validation}`);
|
|
26030
|
+
}
|
|
26031
|
+
return optionTime;
|
|
26032
|
+
}
|
|
26033
|
+
if (!isInteractive()) {
|
|
26034
|
+
throw new Error("--time is required (HH:MM format)");
|
|
26035
|
+
}
|
|
26036
|
+
return await promptText(
|
|
26037
|
+
"Time (HH:MM)",
|
|
26038
|
+
existingTime || "09:00",
|
|
26039
|
+
validateTimeFormat
|
|
26040
|
+
);
|
|
26041
|
+
}
|
|
26042
|
+
async function gatherOneTimeSchedule2(optionDay, optionTime, existingTime) {
|
|
26043
|
+
if (optionDay && optionTime) {
|
|
26044
|
+
if (!validateDateFormat(optionDay)) {
|
|
26045
|
+
throw new Error(
|
|
26046
|
+
`Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
26047
|
+
);
|
|
26048
|
+
}
|
|
26049
|
+
if (!validateTimeFormat(optionTime)) {
|
|
26050
|
+
throw new Error(`Invalid time format: ${optionTime}. Use HH:MM format.`);
|
|
26051
|
+
}
|
|
26052
|
+
return `${optionDay} ${optionTime}`;
|
|
26053
|
+
}
|
|
26054
|
+
if (!isInteractive()) {
|
|
26055
|
+
throw new Error("One-time schedules require interactive mode", {
|
|
26056
|
+
cause: new Error(
|
|
26057
|
+
"Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags"
|
|
26058
|
+
)
|
|
26059
|
+
});
|
|
26060
|
+
}
|
|
26061
|
+
const tomorrowDate = getTomorrowDateLocal();
|
|
26062
|
+
const date = await promptText(
|
|
26063
|
+
"Date (YYYY-MM-DD, default tomorrow)",
|
|
26064
|
+
tomorrowDate,
|
|
26065
|
+
validateDateFormat
|
|
26066
|
+
);
|
|
26067
|
+
if (!date) return null;
|
|
26068
|
+
const currentTime = getCurrentTimeLocal();
|
|
26069
|
+
const time = await promptText(
|
|
26070
|
+
"Time (HH:MM)",
|
|
26071
|
+
existingTime || currentTime,
|
|
26072
|
+
validateTimeFormat
|
|
26073
|
+
);
|
|
26074
|
+
if (!time) return null;
|
|
26075
|
+
return `${date} ${time}`;
|
|
26076
|
+
}
|
|
26077
|
+
async function gatherTimezone2(optionTimezone, existingTimezone) {
|
|
26078
|
+
if (optionTimezone) return optionTimezone;
|
|
26079
|
+
let userTimezone = null;
|
|
26080
|
+
try {
|
|
26081
|
+
const prefs = await getUserPreferences();
|
|
26082
|
+
userTimezone = prefs.timezone;
|
|
26083
|
+
} catch {
|
|
26084
|
+
console.log(
|
|
26085
|
+
chalk105.dim("Could not fetch timezone preference, using detected timezone")
|
|
26086
|
+
);
|
|
26087
|
+
}
|
|
26088
|
+
const defaultTimezone = userTimezone || detectTimezone();
|
|
26089
|
+
if (!isInteractive()) {
|
|
26090
|
+
return defaultTimezone;
|
|
26091
|
+
}
|
|
26092
|
+
return await promptText("Timezone", existingTimezone || defaultTimezone);
|
|
26093
|
+
}
|
|
26094
|
+
async function gatherPromptText2(optionPrompt, existingPrompt) {
|
|
26095
|
+
if (optionPrompt) return optionPrompt;
|
|
26096
|
+
if (!isInteractive()) {
|
|
26097
|
+
throw new Error("--prompt is required");
|
|
26098
|
+
}
|
|
26099
|
+
return await promptText(
|
|
26100
|
+
"Prompt to run",
|
|
26101
|
+
existingPrompt || "let's start working."
|
|
26102
|
+
);
|
|
26103
|
+
}
|
|
26104
|
+
async function gatherNotificationPreferences2(optionNotifyEmail, optionNotifySlack, existingSchedule) {
|
|
26105
|
+
if (optionNotifyEmail !== void 0 && optionNotifySlack !== void 0) {
|
|
26106
|
+
return {
|
|
26107
|
+
notifyEmail: optionNotifyEmail,
|
|
26108
|
+
notifySlack: optionNotifySlack
|
|
26109
|
+
};
|
|
26110
|
+
}
|
|
26111
|
+
if (!isInteractive()) {
|
|
26112
|
+
return {
|
|
26113
|
+
notifyEmail: optionNotifyEmail,
|
|
26114
|
+
notifySlack: optionNotifySlack
|
|
26115
|
+
};
|
|
26116
|
+
}
|
|
26117
|
+
const notifyEmail = optionNotifyEmail ?? await promptConfirm(
|
|
26118
|
+
"Enable email notifications?",
|
|
26119
|
+
existingSchedule?.notifyEmail ?? true
|
|
26120
|
+
);
|
|
26121
|
+
const notifySlack = optionNotifySlack ?? await promptConfirm(
|
|
26122
|
+
"Enable Slack notifications?",
|
|
26123
|
+
existingSchedule?.notifySlack ?? true
|
|
26124
|
+
);
|
|
26125
|
+
return { notifyEmail, notifySlack };
|
|
26126
|
+
}
|
|
26127
|
+
async function gatherInterval2(optionInterval, existingInterval) {
|
|
26128
|
+
if (optionInterval) {
|
|
26129
|
+
const val = parseInt(optionInterval, 10);
|
|
26130
|
+
if (isNaN(val) || val < 0) {
|
|
26131
|
+
throw new Error(
|
|
26132
|
+
"Invalid interval. Must be a non-negative integer (seconds)"
|
|
26133
|
+
);
|
|
26134
|
+
}
|
|
26135
|
+
return val;
|
|
26136
|
+
}
|
|
26137
|
+
if (!isInteractive()) {
|
|
26138
|
+
throw new Error("--interval is required for loop schedules (seconds)");
|
|
26139
|
+
}
|
|
26140
|
+
const defaultVal = existingInterval !== void 0 ? String(existingInterval) : "300";
|
|
26141
|
+
const result = await promptText(
|
|
26142
|
+
"Interval in seconds (time between runs)",
|
|
26143
|
+
defaultVal,
|
|
26144
|
+
(v) => {
|
|
26145
|
+
const n = parseInt(v, 10);
|
|
26146
|
+
if (isNaN(n) || n < 0) return "Must be a non-negative integer";
|
|
26147
|
+
return true;
|
|
26148
|
+
}
|
|
26149
|
+
);
|
|
26150
|
+
if (!result) return null;
|
|
26151
|
+
return parseInt(result, 10);
|
|
26152
|
+
}
|
|
26153
|
+
async function gatherTiming2(frequency, options, defaults) {
|
|
26154
|
+
if (frequency === "loop") {
|
|
26155
|
+
const intervalSeconds = await gatherInterval2(
|
|
26156
|
+
options.interval,
|
|
26157
|
+
defaults.intervalSeconds
|
|
26158
|
+
);
|
|
26159
|
+
if (intervalSeconds === null) return null;
|
|
26160
|
+
return {
|
|
26161
|
+
day: void 0,
|
|
26162
|
+
time: void 0,
|
|
26163
|
+
atTime: void 0,
|
|
26164
|
+
intervalSeconds
|
|
26165
|
+
};
|
|
26166
|
+
}
|
|
26167
|
+
if (frequency === "once") {
|
|
26168
|
+
const result = await gatherOneTimeSchedule2(
|
|
26169
|
+
options.day,
|
|
26170
|
+
options.time,
|
|
26171
|
+
defaults.time
|
|
26172
|
+
);
|
|
26173
|
+
if (!result) return null;
|
|
26174
|
+
return {
|
|
26175
|
+
day: void 0,
|
|
26176
|
+
time: void 0,
|
|
26177
|
+
atTime: result,
|
|
26178
|
+
intervalSeconds: void 0
|
|
26179
|
+
};
|
|
26180
|
+
}
|
|
26181
|
+
const day = await gatherDay2(frequency, options.day, defaults.day) ?? void 0;
|
|
26182
|
+
if (day === null && (frequency === "weekly" || frequency === "monthly")) {
|
|
26183
|
+
return null;
|
|
26184
|
+
}
|
|
26185
|
+
const time = await gatherRecurringTime2(options.time, defaults.time);
|
|
26186
|
+
if (!time) return null;
|
|
26187
|
+
return { day, time, atTime: void 0, intervalSeconds: void 0 };
|
|
26188
|
+
}
|
|
26189
|
+
async function findExistingSchedule2(agentName, scheduleName) {
|
|
26190
|
+
const { schedules } = await listZeroSchedules();
|
|
26191
|
+
return schedules.find(
|
|
26192
|
+
(s) => s.agentName === agentName && s.name === scheduleName
|
|
26193
|
+
);
|
|
26194
|
+
}
|
|
26195
|
+
async function buildAndDeploy2(params) {
|
|
26196
|
+
let cronExpression;
|
|
26197
|
+
let atTimeISO;
|
|
26198
|
+
if (params.frequency === "loop") {
|
|
26199
|
+
} else if (params.atTime) {
|
|
26200
|
+
atTimeISO = toISODateTime(params.atTime);
|
|
26201
|
+
} else if (params.time && params.frequency !== "once") {
|
|
26202
|
+
cronExpression = generateCronExpression(
|
|
26203
|
+
params.frequency,
|
|
26204
|
+
params.time,
|
|
26205
|
+
params.day
|
|
26206
|
+
);
|
|
26207
|
+
}
|
|
26208
|
+
console.log(
|
|
26209
|
+
`
|
|
26210
|
+
Deploying schedule for agent ${chalk105.cyan(params.agentName)}...`
|
|
26211
|
+
);
|
|
26212
|
+
const deployResult = await deployZeroSchedule({
|
|
26213
|
+
name: params.scheduleName,
|
|
26214
|
+
zeroAgentId: params.zeroAgentId,
|
|
26215
|
+
cronExpression,
|
|
26216
|
+
atTime: atTimeISO,
|
|
26217
|
+
intervalSeconds: params.intervalSeconds,
|
|
26218
|
+
timezone: params.timezone,
|
|
26219
|
+
prompt: params.prompt,
|
|
26220
|
+
artifactName: params.artifactName,
|
|
26221
|
+
...params.notifyEmail !== void 0 && {
|
|
26222
|
+
notifyEmail: params.notifyEmail
|
|
26223
|
+
},
|
|
26224
|
+
...params.notifySlack !== void 0 && {
|
|
26225
|
+
notifySlack: params.notifySlack
|
|
26226
|
+
}
|
|
26227
|
+
});
|
|
26228
|
+
return deployResult;
|
|
26229
|
+
}
|
|
26230
|
+
function displayDeployResult2(agentName, deployResult) {
|
|
26231
|
+
if (deployResult.created) {
|
|
26232
|
+
console.log(
|
|
26233
|
+
chalk105.green(`\u2713 Created schedule for agent ${chalk105.cyan(agentName)}`)
|
|
26234
|
+
);
|
|
26235
|
+
} else {
|
|
26236
|
+
console.log(
|
|
26237
|
+
chalk105.green(`\u2713 Updated schedule for agent ${chalk105.cyan(agentName)}`)
|
|
26238
|
+
);
|
|
26239
|
+
}
|
|
26240
|
+
console.log(chalk105.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
26241
|
+
if (deployResult.schedule.triggerType === "loop" && deployResult.schedule.intervalSeconds != null) {
|
|
26242
|
+
console.log(
|
|
26243
|
+
chalk105.dim(
|
|
26244
|
+
` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`
|
|
26245
|
+
)
|
|
26246
|
+
);
|
|
26247
|
+
} else if (deployResult.schedule.cronExpression) {
|
|
26248
|
+
console.log(chalk105.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
26249
|
+
if (deployResult.schedule.nextRunAt) {
|
|
26250
|
+
const nextRun = formatInTimezone2(
|
|
26251
|
+
deployResult.schedule.nextRunAt,
|
|
26252
|
+
deployResult.schedule.timezone
|
|
26253
|
+
);
|
|
26254
|
+
console.log(chalk105.dim(` Next run: ${nextRun}`));
|
|
26255
|
+
}
|
|
26256
|
+
} else if (deployResult.schedule.atTime) {
|
|
26257
|
+
const atTimeFormatted = formatInTimezone2(
|
|
26258
|
+
deployResult.schedule.atTime,
|
|
26259
|
+
deployResult.schedule.timezone
|
|
26260
|
+
);
|
|
26261
|
+
console.log(chalk105.dim(` At: ${atTimeFormatted}`));
|
|
26262
|
+
}
|
|
26263
|
+
}
|
|
26264
|
+
async function tryEnableSchedule2(scheduleName, zeroAgentId, agentName) {
|
|
26265
|
+
try {
|
|
26266
|
+
await enableZeroSchedule({ name: scheduleName, zeroAgentId });
|
|
26267
|
+
console.log(
|
|
26268
|
+
chalk105.green(`\u2713 Enabled schedule for agent ${chalk105.cyan(agentName)}`)
|
|
26269
|
+
);
|
|
26270
|
+
} catch (error) {
|
|
26271
|
+
console.error(chalk105.yellow("\u26A0 Failed to enable schedule"));
|
|
26272
|
+
if (error instanceof ApiRequestError) {
|
|
26273
|
+
if (error.code === "SCHEDULE_PAST") {
|
|
26274
|
+
console.error(chalk105.dim(" Scheduled time has already passed"));
|
|
26275
|
+
} else {
|
|
26276
|
+
console.error(chalk105.dim(` ${error.message}`));
|
|
26277
|
+
}
|
|
26278
|
+
} else if (error instanceof Error) {
|
|
26279
|
+
console.error(chalk105.dim(` ${error.message}`));
|
|
26280
|
+
}
|
|
26281
|
+
console.log(
|
|
26282
|
+
` To enable manually: ${chalk105.cyan(`vm0 zero schedule enable ${agentName}`)}`
|
|
26283
|
+
);
|
|
26284
|
+
}
|
|
26285
|
+
}
|
|
26286
|
+
function showEnableHint2(agentName) {
|
|
26287
|
+
console.log();
|
|
26288
|
+
console.log(
|
|
26289
|
+
` To enable: ${chalk105.cyan(`vm0 zero schedule enable ${agentName}`)}`
|
|
26290
|
+
);
|
|
26291
|
+
}
|
|
26292
|
+
async function handleScheduleEnabling2(params) {
|
|
26293
|
+
const {
|
|
26294
|
+
scheduleName,
|
|
26295
|
+
zeroAgentId,
|
|
26296
|
+
agentName,
|
|
26297
|
+
enableFlag,
|
|
26298
|
+
shouldPromptEnable
|
|
26299
|
+
} = params;
|
|
26300
|
+
if (enableFlag) {
|
|
26301
|
+
await tryEnableSchedule2(scheduleName, zeroAgentId, agentName);
|
|
26302
|
+
return;
|
|
26303
|
+
}
|
|
26304
|
+
if (shouldPromptEnable && isInteractive()) {
|
|
26305
|
+
const enableNow = await promptConfirm("Enable this schedule?", true);
|
|
26306
|
+
if (enableNow) {
|
|
26307
|
+
await tryEnableSchedule2(scheduleName, zeroAgentId, agentName);
|
|
26308
|
+
} else {
|
|
26309
|
+
showEnableHint2(agentName);
|
|
26310
|
+
}
|
|
26311
|
+
return;
|
|
26312
|
+
}
|
|
26313
|
+
if (shouldPromptEnable) {
|
|
26314
|
+
showEnableHint2(agentName);
|
|
26315
|
+
}
|
|
26316
|
+
}
|
|
26317
|
+
var setupCommand4 = new Command121().name("setup").description("Create or edit a schedule for a zero agent").argument("<agent-name>", "Agent name to configure schedule for").option("-n, --name <schedule-name>", 'Schedule name (default: "default")').option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once|loop").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-i, --interval <seconds>", "Interval in seconds for loop mode").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").option("--notify-email", "Enable email notifications (default: true)").option("--no-notify-email", "Disable email notifications").option("--notify-slack", "Enable Slack notifications (default: true)").option("--no-notify-slack", "Disable Slack notifications").action(
|
|
26318
|
+
withErrorHandler(async (agentName, options) => {
|
|
26319
|
+
const agent = await getZeroAgent(agentName);
|
|
26320
|
+
const zeroAgentId = agent.agentComposeId;
|
|
26321
|
+
const scheduleName = options.name || "default";
|
|
26322
|
+
const existingSchedule = await findExistingSchedule2(
|
|
26323
|
+
agentName,
|
|
26324
|
+
scheduleName
|
|
26325
|
+
);
|
|
26326
|
+
console.log(
|
|
26327
|
+
chalk105.dim(
|
|
26328
|
+
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
26329
|
+
)
|
|
26330
|
+
);
|
|
26331
|
+
const defaults = getExistingDefaults2(existingSchedule);
|
|
26332
|
+
const frequency = await gatherFrequency2(
|
|
26333
|
+
options.frequency,
|
|
26334
|
+
defaults.frequency
|
|
26335
|
+
);
|
|
26336
|
+
if (!frequency) {
|
|
26337
|
+
console.log(chalk105.dim("Cancelled"));
|
|
26338
|
+
return;
|
|
26339
|
+
}
|
|
26340
|
+
const timing = await gatherTiming2(frequency, options, defaults);
|
|
26341
|
+
if (!timing) {
|
|
26342
|
+
console.log(chalk105.dim("Cancelled"));
|
|
26343
|
+
return;
|
|
26344
|
+
}
|
|
26345
|
+
const { day, time, atTime, intervalSeconds } = timing;
|
|
26346
|
+
const timezone = await gatherTimezone2(
|
|
26347
|
+
options.timezone,
|
|
26348
|
+
existingSchedule?.timezone
|
|
26349
|
+
);
|
|
26350
|
+
if (!timezone) {
|
|
26351
|
+
console.log(chalk105.dim("Cancelled"));
|
|
26352
|
+
return;
|
|
26353
|
+
}
|
|
26354
|
+
const promptText_ = await gatherPromptText2(
|
|
26355
|
+
options.prompt,
|
|
26356
|
+
existingSchedule?.prompt
|
|
26357
|
+
);
|
|
26358
|
+
if (!promptText_) {
|
|
26359
|
+
console.log(chalk105.dim("Cancelled"));
|
|
26360
|
+
return;
|
|
26361
|
+
}
|
|
26362
|
+
const { notifyEmail, notifySlack } = await gatherNotificationPreferences2(
|
|
26363
|
+
options.notifyEmail,
|
|
26364
|
+
options.notifySlack,
|
|
26365
|
+
existingSchedule
|
|
26366
|
+
);
|
|
26367
|
+
const deployResult = await buildAndDeploy2({
|
|
26368
|
+
scheduleName,
|
|
26369
|
+
zeroAgentId,
|
|
26370
|
+
agentName,
|
|
26371
|
+
frequency,
|
|
26372
|
+
time,
|
|
26373
|
+
day,
|
|
26374
|
+
atTime,
|
|
26375
|
+
intervalSeconds,
|
|
26376
|
+
timezone,
|
|
26377
|
+
prompt: promptText_,
|
|
26378
|
+
artifactName: options.artifactName,
|
|
26379
|
+
notifyEmail,
|
|
26380
|
+
notifySlack
|
|
26381
|
+
});
|
|
26382
|
+
displayDeployResult2(agentName, deployResult);
|
|
26383
|
+
const shouldPromptEnable = deployResult.created || existingSchedule !== void 0 && !existingSchedule.enabled;
|
|
26384
|
+
await handleScheduleEnabling2({
|
|
26385
|
+
scheduleName,
|
|
26386
|
+
zeroAgentId,
|
|
26387
|
+
agentName,
|
|
26388
|
+
enableFlag: options.enable ?? false,
|
|
26389
|
+
shouldPromptEnable
|
|
26390
|
+
});
|
|
26391
|
+
})
|
|
26392
|
+
);
|
|
26393
|
+
|
|
26394
|
+
// src/commands/zero/schedule/list.ts
|
|
26395
|
+
import { Command as Command122 } from "commander";
|
|
26396
|
+
import chalk106 from "chalk";
|
|
26397
|
+
var listCommand19 = new Command122().name("list").alias("ls").description("List all zero schedules").action(
|
|
26398
|
+
withErrorHandler(async () => {
|
|
26399
|
+
const result = await listZeroSchedules();
|
|
26400
|
+
if (result.schedules.length === 0) {
|
|
26401
|
+
console.log(chalk106.dim("No schedules found"));
|
|
26402
|
+
console.log(
|
|
26403
|
+
chalk106.dim(" Create one with: vm0 zero schedule setup <agent-name>")
|
|
26404
|
+
);
|
|
26405
|
+
return;
|
|
26406
|
+
}
|
|
26407
|
+
const agentWidth = Math.max(
|
|
26408
|
+
5,
|
|
26409
|
+
...result.schedules.map((s) => s.agentName.length)
|
|
26410
|
+
);
|
|
26411
|
+
const scheduleWidth = Math.max(
|
|
26412
|
+
8,
|
|
26413
|
+
...result.schedules.map((s) => s.name.length)
|
|
26414
|
+
);
|
|
26415
|
+
const triggerWidth = Math.max(
|
|
26416
|
+
7,
|
|
26417
|
+
...result.schedules.map(
|
|
26418
|
+
(s) => s.cronExpression ? s.cronExpression.length + s.timezone.length + 3 : s.atTime?.length || 0
|
|
26419
|
+
)
|
|
26420
|
+
);
|
|
26421
|
+
const header = [
|
|
26422
|
+
"AGENT".padEnd(agentWidth),
|
|
26423
|
+
"SCHEDULE".padEnd(scheduleWidth),
|
|
26424
|
+
"TRIGGER".padEnd(triggerWidth),
|
|
26425
|
+
"STATUS".padEnd(8),
|
|
26426
|
+
"NEXT RUN"
|
|
26427
|
+
].join(" ");
|
|
26428
|
+
console.log(chalk106.dim(header));
|
|
26429
|
+
for (const schedule of result.schedules) {
|
|
26430
|
+
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
26431
|
+
const status = schedule.enabled ? chalk106.green("enabled") : chalk106.yellow("disabled");
|
|
26432
|
+
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
26433
|
+
const row = [
|
|
26434
|
+
schedule.agentName.padEnd(agentWidth),
|
|
26435
|
+
schedule.name.padEnd(scheduleWidth),
|
|
26436
|
+
trigger.padEnd(triggerWidth),
|
|
26437
|
+
status.padEnd(8 + (schedule.enabled ? 0 : 2)),
|
|
26438
|
+
nextRun
|
|
26439
|
+
].join(" ");
|
|
26440
|
+
console.log(row);
|
|
26441
|
+
}
|
|
26442
|
+
})
|
|
26443
|
+
);
|
|
26444
|
+
|
|
26445
|
+
// src/commands/zero/schedule/status.ts
|
|
26446
|
+
import { Command as Command123 } from "commander";
|
|
26447
|
+
import chalk107 from "chalk";
|
|
26448
|
+
function formatDateTimeStyled2(dateStr) {
|
|
26449
|
+
if (!dateStr) return chalk107.dim("-");
|
|
26450
|
+
const formatted = formatDateTime(dateStr);
|
|
26451
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk107.dim("($1)"));
|
|
26452
|
+
}
|
|
26453
|
+
function formatTrigger2(schedule) {
|
|
26454
|
+
if (schedule.triggerType === "loop" && schedule.intervalSeconds !== null) {
|
|
26455
|
+
return `interval ${schedule.intervalSeconds}s ${chalk107.dim("(loop)")}`;
|
|
26456
|
+
}
|
|
26457
|
+
if (schedule.cronExpression) {
|
|
26458
|
+
return schedule.cronExpression;
|
|
26459
|
+
}
|
|
26460
|
+
if (schedule.atTime) {
|
|
26461
|
+
return `${schedule.atTime} ${chalk107.dim("(one-time)")}`;
|
|
26462
|
+
}
|
|
26463
|
+
return chalk107.dim("-");
|
|
26464
|
+
}
|
|
26465
|
+
function printRunConfiguration2(schedule) {
|
|
26466
|
+
const statusText = schedule.enabled ? chalk107.green("enabled") : chalk107.yellow("disabled");
|
|
26467
|
+
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
26468
|
+
console.log(
|
|
26469
|
+
`${"Agent:".padEnd(16)}${schedule.agentName} ${chalk107.dim(`(${schedule.orgSlug})`)}`
|
|
26470
|
+
);
|
|
26471
|
+
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
26472
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk107.dim(promptPreview)}`);
|
|
26473
|
+
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
26474
|
+
console.log(
|
|
26475
|
+
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
26476
|
+
);
|
|
26477
|
+
}
|
|
26478
|
+
if (schedule.secretNames && schedule.secretNames.length > 0) {
|
|
26479
|
+
console.log(`${"Secrets:".padEnd(16)}${schedule.secretNames.join(", ")}`);
|
|
26480
|
+
}
|
|
26481
|
+
if (schedule.artifactName) {
|
|
26482
|
+
const artifactInfo = schedule.artifactVersion ? `${schedule.artifactName}:${schedule.artifactVersion}` : schedule.artifactName;
|
|
26483
|
+
console.log(`${"Artifact:".padEnd(16)}${artifactInfo}`);
|
|
26484
|
+
}
|
|
26485
|
+
if (schedule.volumeVersions && Object.keys(schedule.volumeVersions).length > 0) {
|
|
26486
|
+
console.log(
|
|
26487
|
+
`${"Volumes:".padEnd(16)}${Object.keys(schedule.volumeVersions).join(", ")}`
|
|
26488
|
+
);
|
|
26489
|
+
}
|
|
26490
|
+
}
|
|
26491
|
+
function printTimeSchedule2(schedule) {
|
|
26492
|
+
console.log();
|
|
26493
|
+
console.log(`${"Trigger:".padEnd(16)}${formatTrigger2(schedule)}`);
|
|
26494
|
+
console.log(`${"Timezone:".padEnd(16)}${detectTimezone()}`);
|
|
26495
|
+
if (schedule.enabled) {
|
|
26496
|
+
console.log(
|
|
26497
|
+
`${"Next Run:".padEnd(16)}${formatDateTimeStyled2(schedule.nextRunAt)}`
|
|
26498
|
+
);
|
|
26499
|
+
}
|
|
26500
|
+
if (schedule.triggerType === "loop") {
|
|
26501
|
+
const failureText = schedule.consecutiveFailures > 0 ? chalk107.yellow(`${schedule.consecutiveFailures}/3`) : chalk107.dim("0/3");
|
|
26502
|
+
console.log(`${"Failures:".padEnd(16)}${failureText}`);
|
|
26503
|
+
}
|
|
26504
|
+
}
|
|
26505
|
+
var statusCommand10 = new Command123().name("status").description("Show detailed status of a zero schedule").argument("<agent-name>", "Agent name").option(
|
|
26506
|
+
"-n, --name <schedule-name>",
|
|
26507
|
+
"Schedule name (required when agent has multiple schedules)"
|
|
26508
|
+
).action(
|
|
26509
|
+
withErrorHandler(async (agentName, options) => {
|
|
26510
|
+
const schedule = await resolveZeroScheduleByAgent(
|
|
26511
|
+
agentName,
|
|
26512
|
+
options.name
|
|
26513
|
+
);
|
|
26514
|
+
console.log();
|
|
26515
|
+
console.log(`Schedule for agent: ${chalk107.cyan(agentName)}`);
|
|
26516
|
+
console.log(chalk107.dim("\u2501".repeat(50)));
|
|
26517
|
+
printRunConfiguration2(schedule);
|
|
26518
|
+
printTimeSchedule2(schedule);
|
|
26519
|
+
console.log();
|
|
26520
|
+
})
|
|
26521
|
+
);
|
|
26522
|
+
|
|
26523
|
+
// src/commands/zero/schedule/delete.ts
|
|
26524
|
+
import { Command as Command124 } from "commander";
|
|
26525
|
+
import chalk108 from "chalk";
|
|
26526
|
+
var deleteCommand7 = new Command124().name("delete").alias("rm").description("Delete a zero schedule").argument("<agent-name>", "Agent name").option(
|
|
26527
|
+
"-n, --name <schedule-name>",
|
|
26528
|
+
"Schedule name (required when agent has multiple schedules)"
|
|
26529
|
+
).option("-y, --yes", "Skip confirmation prompt").action(
|
|
26530
|
+
withErrorHandler(
|
|
26531
|
+
async (agentName, options) => {
|
|
26532
|
+
const resolved = await resolveZeroScheduleByAgent(
|
|
26533
|
+
agentName,
|
|
26534
|
+
options.name
|
|
26535
|
+
);
|
|
26536
|
+
if (!options.yes) {
|
|
26537
|
+
if (!isInteractive()) {
|
|
26538
|
+
throw new Error("--yes flag is required in non-interactive mode");
|
|
26539
|
+
}
|
|
26540
|
+
const confirmed = await promptConfirm(
|
|
26541
|
+
`Delete schedule for agent ${chalk108.cyan(agentName)}?`,
|
|
26542
|
+
false
|
|
26543
|
+
);
|
|
26544
|
+
if (!confirmed) {
|
|
26545
|
+
console.log(chalk108.dim("Cancelled"));
|
|
26546
|
+
return;
|
|
26547
|
+
}
|
|
26548
|
+
}
|
|
26549
|
+
await deleteZeroSchedule({
|
|
26550
|
+
name: resolved.name,
|
|
26551
|
+
zeroAgentId: resolved.zeroAgentId
|
|
26552
|
+
});
|
|
26553
|
+
console.log(
|
|
26554
|
+
chalk108.green(`\u2713 Deleted schedule for agent ${chalk108.cyan(agentName)}`)
|
|
26555
|
+
);
|
|
26556
|
+
}
|
|
26557
|
+
)
|
|
26558
|
+
);
|
|
26559
|
+
|
|
26560
|
+
// src/commands/zero/schedule/enable.ts
|
|
26561
|
+
import { Command as Command125 } from "commander";
|
|
26562
|
+
import chalk109 from "chalk";
|
|
26563
|
+
var enableCommand2 = new Command125().name("enable").description("Enable a zero schedule").argument("<agent-name>", "Agent name").option(
|
|
26564
|
+
"-n, --name <schedule-name>",
|
|
26565
|
+
"Schedule name (required when agent has multiple schedules)"
|
|
26566
|
+
).action(
|
|
26567
|
+
withErrorHandler(async (agentName, options) => {
|
|
26568
|
+
const resolved = await resolveZeroScheduleByAgent(
|
|
26569
|
+
agentName,
|
|
26570
|
+
options.name
|
|
26571
|
+
);
|
|
26572
|
+
await enableZeroSchedule({
|
|
26573
|
+
name: resolved.name,
|
|
26574
|
+
zeroAgentId: resolved.zeroAgentId
|
|
26575
|
+
});
|
|
26576
|
+
console.log(
|
|
26577
|
+
chalk109.green(`\u2713 Enabled schedule for agent ${chalk109.cyan(agentName)}`)
|
|
26578
|
+
);
|
|
26579
|
+
})
|
|
26580
|
+
);
|
|
26581
|
+
|
|
26582
|
+
// src/commands/zero/schedule/disable.ts
|
|
26583
|
+
import { Command as Command126 } from "commander";
|
|
26584
|
+
import chalk110 from "chalk";
|
|
26585
|
+
var disableCommand2 = new Command126().name("disable").description("Disable a zero schedule").argument("<agent-name>", "Agent name").option(
|
|
26586
|
+
"-n, --name <schedule-name>",
|
|
26587
|
+
"Schedule name (required when agent has multiple schedules)"
|
|
26588
|
+
).action(
|
|
26589
|
+
withErrorHandler(async (agentName, options) => {
|
|
26590
|
+
const resolved = await resolveZeroScheduleByAgent(
|
|
26591
|
+
agentName,
|
|
26592
|
+
options.name
|
|
26593
|
+
);
|
|
26594
|
+
await disableZeroSchedule({
|
|
26595
|
+
name: resolved.name,
|
|
26596
|
+
zeroAgentId: resolved.zeroAgentId
|
|
26597
|
+
});
|
|
26598
|
+
console.log(
|
|
26599
|
+
chalk110.green(`\u2713 Disabled schedule for agent ${chalk110.cyan(agentName)}`)
|
|
26600
|
+
);
|
|
26601
|
+
})
|
|
26602
|
+
);
|
|
26603
|
+
|
|
26604
|
+
// src/commands/zero/schedule/index.ts
|
|
26605
|
+
var zeroScheduleCommand = new Command127().name("schedule").description("Manage zero agent schedules").addCommand(setupCommand4).addCommand(listCommand19).addCommand(statusCommand10).addCommand(deleteCommand7).addCommand(enableCommand2).addCommand(disableCommand2);
|
|
26606
|
+
|
|
26607
|
+
// src/commands/zero/secret/index.ts
|
|
26608
|
+
import { Command as Command131 } from "commander";
|
|
26609
|
+
|
|
26610
|
+
// src/commands/zero/secret/list.ts
|
|
26611
|
+
import { Command as Command128 } from "commander";
|
|
26612
|
+
import chalk111 from "chalk";
|
|
26613
|
+
var listCommand20 = new Command128().name("list").alias("ls").description("List all secrets").action(
|
|
26614
|
+
withErrorHandler(async () => {
|
|
26615
|
+
const result = await listZeroSecrets();
|
|
26616
|
+
if (result.secrets.length === 0) {
|
|
26617
|
+
console.log(chalk111.dim("No secrets found"));
|
|
26618
|
+
console.log();
|
|
26619
|
+
console.log("To add a secret:");
|
|
26620
|
+
console.log(
|
|
26621
|
+
chalk111.cyan(" vm0 zero secret set MY_API_KEY --body <value>")
|
|
26622
|
+
);
|
|
26623
|
+
return;
|
|
26624
|
+
}
|
|
26625
|
+
console.log(chalk111.bold("Secrets:"));
|
|
26626
|
+
console.log();
|
|
26627
|
+
for (const secret of result.secrets) {
|
|
26628
|
+
let typeIndicator = "";
|
|
26629
|
+
let derivedLine = null;
|
|
26630
|
+
if (secret.type === "model-provider") {
|
|
26631
|
+
typeIndicator = chalk111.dim(" [model-provider]");
|
|
26632
|
+
} else if (secret.type === "connector") {
|
|
26633
|
+
const derived = getConnectorDerivedNames(secret.name);
|
|
26634
|
+
if (derived) {
|
|
26635
|
+
typeIndicator = chalk111.dim(` [${derived.connectorLabel} connector]`);
|
|
26636
|
+
derivedLine = chalk111.dim(
|
|
26637
|
+
`Available as: ${derived.envVarNames.join(", ")}`
|
|
26638
|
+
);
|
|
26639
|
+
} else {
|
|
26640
|
+
typeIndicator = chalk111.dim(" [connector]");
|
|
26641
|
+
}
|
|
26642
|
+
} else if (secret.type === "user") {
|
|
26643
|
+
const derived = getConnectorDerivedNames(secret.name);
|
|
26644
|
+
if (derived) {
|
|
26645
|
+
typeIndicator = chalk111.dim(` [${derived.connectorLabel} connector]`);
|
|
26646
|
+
derivedLine = chalk111.dim(
|
|
26647
|
+
`Available as: ${derived.envVarNames.join(", ")}`
|
|
26648
|
+
);
|
|
26649
|
+
}
|
|
26650
|
+
}
|
|
26651
|
+
console.log(` ${chalk111.cyan(secret.name)}${typeIndicator}`);
|
|
26652
|
+
if (derivedLine) {
|
|
26653
|
+
console.log(` ${derivedLine}`);
|
|
26654
|
+
}
|
|
26655
|
+
if (secret.description) {
|
|
26656
|
+
console.log(` ${chalk111.dim(secret.description)}`);
|
|
26657
|
+
}
|
|
26658
|
+
console.log(
|
|
26659
|
+
` ${chalk111.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
26660
|
+
);
|
|
26661
|
+
console.log();
|
|
26662
|
+
}
|
|
26663
|
+
console.log(chalk111.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
26664
|
+
})
|
|
26665
|
+
);
|
|
26666
|
+
|
|
26667
|
+
// src/commands/zero/secret/set.ts
|
|
26668
|
+
import { Command as Command129 } from "commander";
|
|
26669
|
+
import chalk112 from "chalk";
|
|
26670
|
+
var setCommand9 = new Command129().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
26671
|
+
"-b, --body <value>",
|
|
26672
|
+
"Secret value (required in non-interactive mode)"
|
|
26673
|
+
).option("-d, --description <description>", "Optional description").action(
|
|
26674
|
+
withErrorHandler(
|
|
26675
|
+
async (name, options) => {
|
|
26676
|
+
let value;
|
|
26677
|
+
if (options.body !== void 0) {
|
|
26678
|
+
value = options.body;
|
|
26679
|
+
} else if (isInteractive()) {
|
|
26680
|
+
const prompted = await promptPassword("Enter secret value:");
|
|
26681
|
+
if (prompted === void 0) {
|
|
26682
|
+
process.exit(0);
|
|
26683
|
+
}
|
|
26684
|
+
value = prompted;
|
|
26685
|
+
} else {
|
|
26686
|
+
throw new Error("--body is required in non-interactive mode", {
|
|
26687
|
+
cause: new Error(
|
|
26688
|
+
`Usage: vm0 zero secret set ${name} --body "your-secret-value"`
|
|
26689
|
+
)
|
|
26690
|
+
});
|
|
26691
|
+
}
|
|
26692
|
+
let secret;
|
|
26693
|
+
try {
|
|
26694
|
+
secret = await setZeroSecret({
|
|
26695
|
+
name,
|
|
26696
|
+
value,
|
|
26697
|
+
description: options.description
|
|
26698
|
+
});
|
|
26699
|
+
} catch (error) {
|
|
26700
|
+
if (error instanceof Error && error.message.includes("must contain only uppercase")) {
|
|
26701
|
+
throw new Error(error.message, {
|
|
26702
|
+
cause: new Error(
|
|
26703
|
+
"Examples of valid secret names: MY_API_KEY, GITHUB_TOKEN, AWS_ACCESS_KEY_ID"
|
|
26704
|
+
)
|
|
26705
|
+
});
|
|
26706
|
+
}
|
|
26707
|
+
throw error;
|
|
26708
|
+
}
|
|
26709
|
+
console.log(chalk112.green(`\u2713 Secret "${secret.name}" saved`));
|
|
26710
|
+
console.log();
|
|
26711
|
+
console.log("Use in vm0.yaml:");
|
|
26712
|
+
console.log(chalk112.cyan(` environment:`));
|
|
26713
|
+
console.log(chalk112.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
26714
|
+
}
|
|
26715
|
+
)
|
|
26716
|
+
);
|
|
26717
|
+
|
|
26718
|
+
// src/commands/zero/secret/delete.ts
|
|
26719
|
+
import { Command as Command130 } from "commander";
|
|
26720
|
+
import chalk113 from "chalk";
|
|
26721
|
+
var deleteCommand8 = new Command130().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
26722
|
+
withErrorHandler(async (name, options) => {
|
|
26723
|
+
if (!options.yes) {
|
|
26724
|
+
if (!isInteractive()) {
|
|
26725
|
+
throw new Error("--yes flag is required in non-interactive mode");
|
|
26726
|
+
}
|
|
26727
|
+
const confirmed = await promptConfirm(
|
|
26728
|
+
`Are you sure you want to delete secret "${name}"?`,
|
|
26729
|
+
false
|
|
26730
|
+
);
|
|
26731
|
+
if (!confirmed) {
|
|
26732
|
+
console.log(chalk113.dim("Cancelled"));
|
|
26733
|
+
return;
|
|
26734
|
+
}
|
|
26735
|
+
}
|
|
26736
|
+
await deleteZeroSecret(name);
|
|
26737
|
+
console.log(chalk113.green(`\u2713 Secret "${name}" deleted`));
|
|
26738
|
+
})
|
|
26739
|
+
);
|
|
26740
|
+
|
|
26741
|
+
// src/commands/zero/secret/index.ts
|
|
26742
|
+
var zeroSecretCommand = new Command131().name("secret").description("Manage secrets").addCommand(listCommand20).addCommand(setCommand9).addCommand(deleteCommand8);
|
|
26743
|
+
|
|
26744
|
+
// src/commands/zero/variable/index.ts
|
|
26745
|
+
import { Command as Command135 } from "commander";
|
|
26746
|
+
|
|
26747
|
+
// src/commands/zero/variable/list.ts
|
|
26748
|
+
import { Command as Command132 } from "commander";
|
|
26749
|
+
import chalk114 from "chalk";
|
|
26750
|
+
function truncateValue4(value, maxLength = 60) {
|
|
26751
|
+
if (value.length <= maxLength) {
|
|
26752
|
+
return value;
|
|
26753
|
+
}
|
|
26754
|
+
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
26755
|
+
}
|
|
26756
|
+
var listCommand21 = new Command132().name("list").alias("ls").description("List all variables").action(
|
|
26757
|
+
withErrorHandler(async () => {
|
|
26758
|
+
const result = await listZeroVariables();
|
|
26759
|
+
if (result.variables.length === 0) {
|
|
26760
|
+
console.log(chalk114.dim("No variables found"));
|
|
26761
|
+
console.log();
|
|
26762
|
+
console.log("To add a variable:");
|
|
26763
|
+
console.log(chalk114.cyan(" vm0 zero variable set MY_VAR <value>"));
|
|
26764
|
+
return;
|
|
26765
|
+
}
|
|
26766
|
+
console.log(chalk114.bold("Variables:"));
|
|
26767
|
+
console.log();
|
|
26768
|
+
for (const variable of result.variables) {
|
|
26769
|
+
const displayValue = truncateValue4(variable.value);
|
|
26770
|
+
console.log(` ${chalk114.cyan(variable.name)} = ${displayValue}`);
|
|
26771
|
+
if (variable.description) {
|
|
26772
|
+
console.log(` ${chalk114.dim(variable.description)}`);
|
|
26773
|
+
}
|
|
26774
|
+
console.log(
|
|
26775
|
+
` ${chalk114.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
26776
|
+
);
|
|
26777
|
+
console.log();
|
|
26778
|
+
}
|
|
26779
|
+
console.log(chalk114.dim(`Total: ${result.variables.length} variable(s)`));
|
|
26780
|
+
})
|
|
26781
|
+
);
|
|
26782
|
+
|
|
26783
|
+
// src/commands/zero/variable/set.ts
|
|
26784
|
+
import { Command as Command133 } from "commander";
|
|
26785
|
+
import chalk115 from "chalk";
|
|
26786
|
+
var setCommand10 = new Command133().name("set").description("Create or update a variable").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
26787
|
+
withErrorHandler(
|
|
26788
|
+
async (name, value, options) => {
|
|
26789
|
+
let variable;
|
|
26790
|
+
try {
|
|
26791
|
+
variable = await setZeroVariable({
|
|
26792
|
+
name,
|
|
26793
|
+
value,
|
|
26794
|
+
description: options.description
|
|
26795
|
+
});
|
|
26796
|
+
} catch (error) {
|
|
26797
|
+
if (error instanceof Error && error.message.includes("must contain only uppercase")) {
|
|
26798
|
+
throw new Error(error.message, {
|
|
26799
|
+
cause: new Error(
|
|
26800
|
+
"Examples of valid variable names: MY_VAR, API_URL, DEBUG_MODE"
|
|
26801
|
+
)
|
|
26802
|
+
});
|
|
26803
|
+
}
|
|
26804
|
+
throw error;
|
|
26805
|
+
}
|
|
26806
|
+
console.log(chalk115.green(`\u2713 Variable "${variable.name}" saved`));
|
|
26807
|
+
console.log();
|
|
26808
|
+
console.log("Use in vm0.yaml:");
|
|
26809
|
+
console.log(chalk115.cyan(` environment:`));
|
|
26810
|
+
console.log(chalk115.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
26811
|
+
}
|
|
26812
|
+
)
|
|
26813
|
+
);
|
|
26814
|
+
|
|
26815
|
+
// src/commands/zero/variable/delete.ts
|
|
26816
|
+
import { Command as Command134 } from "commander";
|
|
26817
|
+
import chalk116 from "chalk";
|
|
26818
|
+
var deleteCommand9 = new Command134().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
26819
|
+
withErrorHandler(async (name, options) => {
|
|
26820
|
+
if (!options.yes) {
|
|
26821
|
+
if (!isInteractive()) {
|
|
26822
|
+
throw new Error("--yes flag is required in non-interactive mode");
|
|
26823
|
+
}
|
|
26824
|
+
const confirmed = await promptConfirm(
|
|
26825
|
+
`Are you sure you want to delete variable "${name}"?`,
|
|
26826
|
+
false
|
|
26827
|
+
);
|
|
26828
|
+
if (!confirmed) {
|
|
26829
|
+
console.log(chalk116.dim("Cancelled"));
|
|
26830
|
+
return;
|
|
26831
|
+
}
|
|
26832
|
+
}
|
|
26833
|
+
await deleteZeroVariable(name);
|
|
26834
|
+
console.log(chalk116.green(`\u2713 Variable "${name}" deleted`));
|
|
26835
|
+
})
|
|
26836
|
+
);
|
|
26837
|
+
|
|
26838
|
+
// src/commands/zero/variable/index.ts
|
|
26839
|
+
var zeroVariableCommand = new Command135().name("variable").description("Manage variables").addCommand(listCommand21).addCommand(setCommand10).addCommand(deleteCommand9);
|
|
26840
|
+
|
|
25100
26841
|
// src/commands/zero/index.ts
|
|
25101
|
-
var zeroCommand = new
|
|
26842
|
+
var zeroCommand = new Command136("zero").description("Zero platform commands").addCommand(zeroOrgCommand).addCommand(agentCommand2).addCommand(zeroScheduleCommand).addCommand(zeroSecretCommand).addCommand(zeroVariableCommand);
|
|
25102
26843
|
|
|
25103
26844
|
// src/index.ts
|
|
25104
|
-
var program = new
|
|
25105
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
26845
|
+
var program = new Command137();
|
|
26846
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.77.0");
|
|
25106
26847
|
program.addCommand(authCommand);
|
|
25107
26848
|
program.addCommand(infoCommand);
|
|
25108
26849
|
program.addCommand(composeCommand);
|