@vm0/cli 9.78.1 → 9.78.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +454 -438
- 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.78.
|
|
50
|
+
release: "9.78.2",
|
|
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.78.
|
|
69
|
+
version: "9.78.2",
|
|
70
70
|
command: process.argv.slice(2).join(" ")
|
|
71
71
|
});
|
|
72
72
|
Sentry.setContext("runtime", {
|
|
@@ -6684,6 +6684,32 @@ var ahrefsFirewall = {
|
|
|
6684
6684
|
]
|
|
6685
6685
|
};
|
|
6686
6686
|
|
|
6687
|
+
// ../../packages/core/src/firewalls/airtable.generated.ts
|
|
6688
|
+
var airtableFirewall = {
|
|
6689
|
+
name: "airtable",
|
|
6690
|
+
description: "Airtable API",
|
|
6691
|
+
placeholders: {
|
|
6692
|
+
AIRTABLE_TOKEN: "patVm0PlaceHolder.0000000000000000000000000000000000000000000000000000000000000000"
|
|
6693
|
+
},
|
|
6694
|
+
apis: [
|
|
6695
|
+
{
|
|
6696
|
+
base: "https://api.airtable.com",
|
|
6697
|
+
auth: {
|
|
6698
|
+
headers: {
|
|
6699
|
+
Authorization: "Bearer ${{ secrets.AIRTABLE_TOKEN }}"
|
|
6700
|
+
}
|
|
6701
|
+
},
|
|
6702
|
+
permissions: [
|
|
6703
|
+
{
|
|
6704
|
+
name: "unrestricted",
|
|
6705
|
+
description: "Allow all endpoints",
|
|
6706
|
+
rules: ["ANY /{path*}"]
|
|
6707
|
+
}
|
|
6708
|
+
]
|
|
6709
|
+
}
|
|
6710
|
+
]
|
|
6711
|
+
};
|
|
6712
|
+
|
|
6687
6713
|
// ../../packages/core/src/firewalls/confluence.generated.ts
|
|
6688
6714
|
var confluenceFirewall = {
|
|
6689
6715
|
name: "confluence",
|
|
@@ -12510,6 +12536,32 @@ var vercelFirewall = {
|
|
|
12510
12536
|
]
|
|
12511
12537
|
};
|
|
12512
12538
|
|
|
12539
|
+
// ../../packages/core/src/firewalls/zapsign.generated.ts
|
|
12540
|
+
var zapsignFirewall = {
|
|
12541
|
+
name: "zapsign",
|
|
12542
|
+
description: "ZapSign API",
|
|
12543
|
+
placeholders: {
|
|
12544
|
+
ZAPSIGN_TOKEN: "00000000-0000-0000-0000-00000000"
|
|
12545
|
+
},
|
|
12546
|
+
apis: [
|
|
12547
|
+
{
|
|
12548
|
+
base: "https://api.zapsign.com.br",
|
|
12549
|
+
auth: {
|
|
12550
|
+
headers: {
|
|
12551
|
+
Authorization: "Bearer ${{ secrets.ZAPSIGN_TOKEN }}"
|
|
12552
|
+
}
|
|
12553
|
+
},
|
|
12554
|
+
permissions: [
|
|
12555
|
+
{
|
|
12556
|
+
name: "unrestricted",
|
|
12557
|
+
description: "Allow all endpoints",
|
|
12558
|
+
rules: ["ANY /{path*}"]
|
|
12559
|
+
}
|
|
12560
|
+
]
|
|
12561
|
+
}
|
|
12562
|
+
]
|
|
12563
|
+
};
|
|
12564
|
+
|
|
12513
12565
|
// ../../packages/core/src/firewalls/zeptomail.generated.ts
|
|
12514
12566
|
var zeptomailFirewall = {
|
|
12515
12567
|
name: "zeptomail",
|
|
@@ -12540,6 +12592,7 @@ var zeptomailFirewall = {
|
|
|
12540
12592
|
var builtinFirewalls = {
|
|
12541
12593
|
agentmail: agentmailFirewall,
|
|
12542
12594
|
ahrefs: ahrefsFirewall,
|
|
12595
|
+
airtable: airtableFirewall,
|
|
12543
12596
|
confluence: confluenceFirewall,
|
|
12544
12597
|
figma: figmaFirewall,
|
|
12545
12598
|
github: githubFirewall,
|
|
@@ -12552,6 +12605,7 @@ var builtinFirewalls = {
|
|
|
12552
12605
|
notion: notionFirewall,
|
|
12553
12606
|
slack: slackFirewall,
|
|
12554
12607
|
vercel: vercelFirewall,
|
|
12608
|
+
zapsign: zapsignFirewall,
|
|
12555
12609
|
zeptomail: zeptomailFirewall
|
|
12556
12610
|
};
|
|
12557
12611
|
|
|
@@ -12783,7 +12837,7 @@ async function expandFirewallConfigs(config, fetchFn) {
|
|
|
12783
12837
|
}
|
|
12784
12838
|
}
|
|
12785
12839
|
|
|
12786
|
-
// ../../packages/core/src/contracts/user-preferences.ts
|
|
12840
|
+
// ../../packages/core/src/contracts/zero-user-preferences.ts
|
|
12787
12841
|
import { z as z22 } from "zod";
|
|
12788
12842
|
var c15 = initContract();
|
|
12789
12843
|
var sendModeSchema = z22.enum(["enter", "cmd-enter"]);
|
|
@@ -12806,14 +12860,10 @@ var updateUserPreferencesRequestSchema = z22.object({
|
|
|
12806
12860
|
message: "At least one preference must be provided"
|
|
12807
12861
|
}
|
|
12808
12862
|
);
|
|
12809
|
-
var
|
|
12810
|
-
/**
|
|
12811
|
-
* GET /api/user/preferences
|
|
12812
|
-
* Get current user's preferences
|
|
12813
|
-
*/
|
|
12863
|
+
var zeroUserPreferencesContract = c15.router({
|
|
12814
12864
|
get: {
|
|
12815
12865
|
method: "GET",
|
|
12816
|
-
path: "/api/user
|
|
12866
|
+
path: "/api/zero/user-preferences",
|
|
12817
12867
|
headers: authHeadersSchema,
|
|
12818
12868
|
responses: {
|
|
12819
12869
|
200: userPreferencesResponseSchema,
|
|
@@ -12822,13 +12872,9 @@ var userPreferencesContract = c15.router({
|
|
|
12822
12872
|
},
|
|
12823
12873
|
summary: "Get user preferences"
|
|
12824
12874
|
},
|
|
12825
|
-
/**
|
|
12826
|
-
* PUT /api/user/preferences
|
|
12827
|
-
* Update user preferences
|
|
12828
|
-
*/
|
|
12829
12875
|
update: {
|
|
12830
|
-
method: "
|
|
12831
|
-
path: "/api/user
|
|
12876
|
+
method: "POST",
|
|
12877
|
+
path: "/api/zero/user-preferences",
|
|
12832
12878
|
headers: authHeadersSchema,
|
|
12833
12879
|
body: updateUserPreferencesRequestSchema,
|
|
12834
12880
|
responses: {
|
|
@@ -13801,39 +13847,10 @@ var zeroModelProvidersUpdateModelContract = c26.router({
|
|
|
13801
13847
|
}
|
|
13802
13848
|
});
|
|
13803
13849
|
|
|
13804
|
-
// ../../packages/core/src/contracts/zero-user-preferences.ts
|
|
13805
|
-
var c27 = initContract();
|
|
13806
|
-
var zeroUserPreferencesContract = c27.router({
|
|
13807
|
-
get: {
|
|
13808
|
-
method: "GET",
|
|
13809
|
-
path: "/api/zero/user-preferences",
|
|
13810
|
-
headers: authHeadersSchema,
|
|
13811
|
-
responses: {
|
|
13812
|
-
200: userPreferencesResponseSchema,
|
|
13813
|
-
401: apiErrorSchema,
|
|
13814
|
-
500: apiErrorSchema
|
|
13815
|
-
},
|
|
13816
|
-
summary: "Get user preferences"
|
|
13817
|
-
},
|
|
13818
|
-
update: {
|
|
13819
|
-
method: "POST",
|
|
13820
|
-
path: "/api/zero/user-preferences",
|
|
13821
|
-
headers: authHeadersSchema,
|
|
13822
|
-
body: updateUserPreferencesRequestSchema,
|
|
13823
|
-
responses: {
|
|
13824
|
-
200: userPreferencesResponseSchema,
|
|
13825
|
-
400: apiErrorSchema,
|
|
13826
|
-
401: apiErrorSchema,
|
|
13827
|
-
500: apiErrorSchema
|
|
13828
|
-
},
|
|
13829
|
-
summary: "Update user preferences"
|
|
13830
|
-
}
|
|
13831
|
-
});
|
|
13832
|
-
|
|
13833
13850
|
// ../../packages/core/src/contracts/zero-secrets.ts
|
|
13834
13851
|
import { z as z33 } from "zod";
|
|
13835
|
-
var
|
|
13836
|
-
var zeroSecretsContract =
|
|
13852
|
+
var c27 = initContract();
|
|
13853
|
+
var zeroSecretsContract = c27.router({
|
|
13837
13854
|
list: {
|
|
13838
13855
|
method: "GET",
|
|
13839
13856
|
path: "/api/zero/secrets",
|
|
@@ -13860,7 +13877,7 @@ var zeroSecretsContract = c28.router({
|
|
|
13860
13877
|
summary: "Create or update a secret"
|
|
13861
13878
|
}
|
|
13862
13879
|
});
|
|
13863
|
-
var zeroSecretsByNameContract =
|
|
13880
|
+
var zeroSecretsByNameContract = c27.router({
|
|
13864
13881
|
delete: {
|
|
13865
13882
|
method: "DELETE",
|
|
13866
13883
|
path: "/api/zero/secrets/:name",
|
|
@@ -13869,7 +13886,7 @@ var zeroSecretsByNameContract = c28.router({
|
|
|
13869
13886
|
name: secretNameSchema
|
|
13870
13887
|
}),
|
|
13871
13888
|
responses: {
|
|
13872
|
-
204:
|
|
13889
|
+
204: c27.noBody(),
|
|
13873
13890
|
401: apiErrorSchema,
|
|
13874
13891
|
404: apiErrorSchema,
|
|
13875
13892
|
500: apiErrorSchema
|
|
@@ -13877,7 +13894,7 @@ var zeroSecretsByNameContract = c28.router({
|
|
|
13877
13894
|
summary: "Delete a secret by name"
|
|
13878
13895
|
}
|
|
13879
13896
|
});
|
|
13880
|
-
var zeroVariablesContract =
|
|
13897
|
+
var zeroVariablesContract = c27.router({
|
|
13881
13898
|
list: {
|
|
13882
13899
|
method: "GET",
|
|
13883
13900
|
path: "/api/zero/variables",
|
|
@@ -13904,7 +13921,7 @@ var zeroVariablesContract = c28.router({
|
|
|
13904
13921
|
summary: "Create or update a variable"
|
|
13905
13922
|
}
|
|
13906
13923
|
});
|
|
13907
|
-
var zeroVariablesByNameContract =
|
|
13924
|
+
var zeroVariablesByNameContract = c27.router({
|
|
13908
13925
|
delete: {
|
|
13909
13926
|
method: "DELETE",
|
|
13910
13927
|
path: "/api/zero/variables/:name",
|
|
@@ -13913,7 +13930,7 @@ var zeroVariablesByNameContract = c28.router({
|
|
|
13913
13930
|
name: variableNameSchema
|
|
13914
13931
|
}),
|
|
13915
13932
|
responses: {
|
|
13916
|
-
204:
|
|
13933
|
+
204: c27.noBody(),
|
|
13917
13934
|
401: apiErrorSchema,
|
|
13918
13935
|
404: apiErrorSchema,
|
|
13919
13936
|
500: apiErrorSchema
|
|
@@ -13924,8 +13941,8 @@ var zeroVariablesByNameContract = c28.router({
|
|
|
13924
13941
|
|
|
13925
13942
|
// ../../packages/core/src/contracts/zero-sessions.ts
|
|
13926
13943
|
import { z as z34 } from "zod";
|
|
13927
|
-
var
|
|
13928
|
-
var zeroSessionsByIdContract =
|
|
13944
|
+
var c28 = initContract();
|
|
13945
|
+
var zeroSessionsByIdContract = c28.router({
|
|
13929
13946
|
getById: {
|
|
13930
13947
|
method: "GET",
|
|
13931
13948
|
path: "/api/zero/sessions/:id",
|
|
@@ -13945,8 +13962,8 @@ var zeroSessionsByIdContract = c29.router({
|
|
|
13945
13962
|
|
|
13946
13963
|
// ../../packages/core/src/contracts/integrations.ts
|
|
13947
13964
|
import { z as z35 } from "zod";
|
|
13948
|
-
var
|
|
13949
|
-
var integrationsSlackMessageContract =
|
|
13965
|
+
var c29 = initContract();
|
|
13966
|
+
var integrationsSlackMessageContract = c29.router({
|
|
13950
13967
|
sendMessage: {
|
|
13951
13968
|
method: "POST",
|
|
13952
13969
|
path: "/api/zero/integrations/slack/message",
|
|
@@ -13974,7 +13991,7 @@ var integrationsSlackMessageContract = c30.router({
|
|
|
13974
13991
|
|
|
13975
13992
|
// ../../packages/core/src/contracts/zero-billing.ts
|
|
13976
13993
|
import { z as z36 } from "zod";
|
|
13977
|
-
var
|
|
13994
|
+
var c30 = initContract();
|
|
13978
13995
|
var autoRechargeSchema = z36.object({
|
|
13979
13996
|
enabled: z36.boolean(),
|
|
13980
13997
|
threshold: z36.number().nullable(),
|
|
@@ -14007,7 +14024,7 @@ var autoRechargeUpdateRequestSchema = z36.object({
|
|
|
14007
14024
|
threshold: z36.number().int().positive().optional(),
|
|
14008
14025
|
amount: z36.number().int().min(1e3).optional()
|
|
14009
14026
|
});
|
|
14010
|
-
var zeroBillingStatusContract =
|
|
14027
|
+
var zeroBillingStatusContract = c30.router({
|
|
14011
14028
|
get: {
|
|
14012
14029
|
method: "GET",
|
|
14013
14030
|
path: "/api/zero/billing/status",
|
|
@@ -14020,7 +14037,7 @@ var zeroBillingStatusContract = c31.router({
|
|
|
14020
14037
|
summary: "Get billing status for current org"
|
|
14021
14038
|
}
|
|
14022
14039
|
});
|
|
14023
|
-
var zeroBillingCheckoutContract =
|
|
14040
|
+
var zeroBillingCheckoutContract = c30.router({
|
|
14024
14041
|
create: {
|
|
14025
14042
|
method: "POST",
|
|
14026
14043
|
path: "/api/zero/billing/checkout",
|
|
@@ -14036,7 +14053,7 @@ var zeroBillingCheckoutContract = c31.router({
|
|
|
14036
14053
|
summary: "Create Stripe checkout session"
|
|
14037
14054
|
}
|
|
14038
14055
|
});
|
|
14039
|
-
var zeroBillingPortalContract =
|
|
14056
|
+
var zeroBillingPortalContract = c30.router({
|
|
14040
14057
|
create: {
|
|
14041
14058
|
method: "POST",
|
|
14042
14059
|
path: "/api/zero/billing/portal",
|
|
@@ -14052,7 +14069,7 @@ var zeroBillingPortalContract = c31.router({
|
|
|
14052
14069
|
summary: "Create Stripe billing portal session"
|
|
14053
14070
|
}
|
|
14054
14071
|
});
|
|
14055
|
-
var zeroBillingAutoRechargeContract =
|
|
14072
|
+
var zeroBillingAutoRechargeContract = c30.router({
|
|
14056
14073
|
get: {
|
|
14057
14074
|
method: "GET",
|
|
14058
14075
|
path: "/api/zero/billing/auto-recharge",
|
|
@@ -14082,7 +14099,7 @@ var zeroBillingAutoRechargeContract = c31.router({
|
|
|
14082
14099
|
|
|
14083
14100
|
// ../../packages/core/src/contracts/zero-usage.ts
|
|
14084
14101
|
import { z as z37 } from "zod";
|
|
14085
|
-
var
|
|
14102
|
+
var c31 = initContract();
|
|
14086
14103
|
var memberUsageSchema = z37.object({
|
|
14087
14104
|
userId: z37.string(),
|
|
14088
14105
|
email: z37.string(),
|
|
@@ -14099,7 +14116,7 @@ var usageMembersResponseSchema = z37.object({
|
|
|
14099
14116
|
}).nullable(),
|
|
14100
14117
|
members: z37.array(memberUsageSchema)
|
|
14101
14118
|
});
|
|
14102
|
-
var zeroUsageMembersContract =
|
|
14119
|
+
var zeroUsageMembersContract = c31.router({
|
|
14103
14120
|
get: {
|
|
14104
14121
|
method: "GET",
|
|
14105
14122
|
path: "/api/zero/usage/members",
|
|
@@ -14718,7 +14735,7 @@ function getConfigPath() {
|
|
|
14718
14735
|
return join2(homedir2(), ".vm0", "config.json");
|
|
14719
14736
|
}
|
|
14720
14737
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
14721
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.78.
|
|
14738
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.78.2"}`));
|
|
14722
14739
|
console.log();
|
|
14723
14740
|
const config = await loadConfig();
|
|
14724
14741
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -14941,20 +14958,20 @@ async function listStorages(query) {
|
|
|
14941
14958
|
handleError(result, `Failed to list ${query.type}s`);
|
|
14942
14959
|
}
|
|
14943
14960
|
|
|
14944
|
-
// src/lib/api/domains/user-preferences.ts
|
|
14961
|
+
// src/lib/api/domains/zero-user-preferences.ts
|
|
14945
14962
|
import { initClient as initClient5 } from "@ts-rest/core";
|
|
14946
|
-
async function
|
|
14963
|
+
async function getZeroUserPreferences() {
|
|
14947
14964
|
const config = await getClientConfig();
|
|
14948
|
-
const client = initClient5(
|
|
14965
|
+
const client = initClient5(zeroUserPreferencesContract, config);
|
|
14949
14966
|
const result = await client.get({ headers: {} });
|
|
14950
14967
|
if (result.status === 200) {
|
|
14951
14968
|
return result.body;
|
|
14952
14969
|
}
|
|
14953
14970
|
handleError(result, "Failed to get user preferences");
|
|
14954
14971
|
}
|
|
14955
|
-
async function
|
|
14972
|
+
async function updateZeroUserPreferences(body) {
|
|
14956
14973
|
const config = await getClientConfig();
|
|
14957
|
-
const client = initClient5(
|
|
14974
|
+
const client = initClient5(zeroUserPreferencesContract, config);
|
|
14958
14975
|
const result = await client.update({ body });
|
|
14959
14976
|
if (result.status === 200) {
|
|
14960
14977
|
return result.body;
|
|
@@ -16813,7 +16830,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
16813
16830
|
options.autoUpdate = false;
|
|
16814
16831
|
}
|
|
16815
16832
|
if (options.autoUpdate !== false) {
|
|
16816
|
-
await startSilentUpgrade("9.78.
|
|
16833
|
+
await startSilentUpgrade("9.78.2");
|
|
16817
16834
|
}
|
|
16818
16835
|
try {
|
|
16819
16836
|
let result;
|
|
@@ -17648,7 +17665,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
17648
17665
|
withErrorHandler(
|
|
17649
17666
|
async (identifier, prompt, options) => {
|
|
17650
17667
|
if (options.autoUpdate !== false) {
|
|
17651
|
-
await startSilentUpgrade("9.78.
|
|
17668
|
+
await startSilentUpgrade("9.78.2");
|
|
17652
17669
|
}
|
|
17653
17670
|
const { org, name, version } = parseIdentifier(identifier);
|
|
17654
17671
|
let composeId;
|
|
@@ -19404,7 +19421,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
19404
19421
|
withErrorHandler(
|
|
19405
19422
|
async (prompt, options) => {
|
|
19406
19423
|
if (options.autoUpdate !== false) {
|
|
19407
|
-
const shouldExit = await checkAndUpgrade("9.78.
|
|
19424
|
+
const shouldExit = await checkAndUpgrade("9.78.2", prompt);
|
|
19408
19425
|
if (shouldExit) {
|
|
19409
19426
|
process.exit(0);
|
|
19410
19427
|
}
|
|
@@ -20560,156 +20577,23 @@ var initCommand4 = new Command41().name("init").description("Initialize a new VM
|
|
|
20560
20577
|
})
|
|
20561
20578
|
);
|
|
20562
20579
|
|
|
20563
|
-
// src/commands/
|
|
20580
|
+
// src/commands/upgrade/index.ts
|
|
20564
20581
|
import { Command as Command42 } from "commander";
|
|
20565
20582
|
import chalk38 from "chalk";
|
|
20566
|
-
|
|
20567
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
20568
|
-
}
|
|
20569
|
-
function isValidTimezone(timezone) {
|
|
20570
|
-
try {
|
|
20571
|
-
Intl.DateTimeFormat(void 0, { timeZone: timezone });
|
|
20572
|
-
return true;
|
|
20573
|
-
} catch {
|
|
20574
|
-
return false;
|
|
20575
|
-
}
|
|
20576
|
-
}
|
|
20577
|
-
function parseOnOff(flag, value) {
|
|
20578
|
-
const lower = value.toLowerCase();
|
|
20579
|
-
if (lower === "on" || lower === "true" || lower === "1") return true;
|
|
20580
|
-
if (lower === "off" || lower === "false" || lower === "0") return false;
|
|
20581
|
-
throw new Error(
|
|
20582
|
-
`Invalid value for --${flag}: "${value}". Use "on" or "off".`
|
|
20583
|
-
);
|
|
20584
|
-
}
|
|
20585
|
-
function displayPreferences(prefs) {
|
|
20586
|
-
console.log(chalk38.bold("Current preferences:"));
|
|
20587
|
-
console.log(
|
|
20588
|
-
` Timezone: ${prefs.timezone ? chalk38.cyan(prefs.timezone) : chalk38.dim("not set")}`
|
|
20589
|
-
);
|
|
20590
|
-
console.log(
|
|
20591
|
-
` Email notify: ${prefs.notifyEmail ? chalk38.green("on") : chalk38.dim("off")}`
|
|
20592
|
-
);
|
|
20593
|
-
console.log(
|
|
20594
|
-
` Slack notify: ${prefs.notifySlack ? chalk38.green("on") : chalk38.dim("off")}`
|
|
20595
|
-
);
|
|
20596
|
-
}
|
|
20597
|
-
function buildUpdates(opts) {
|
|
20598
|
-
const hasTimezone = opts.timezone !== void 0;
|
|
20599
|
-
const hasNotifyEmail = opts.notifyEmail !== void 0;
|
|
20600
|
-
const hasNotifySlack = opts.notifySlack !== void 0;
|
|
20601
|
-
if (!hasTimezone && !hasNotifyEmail && !hasNotifySlack) return null;
|
|
20602
|
-
const updates = {};
|
|
20603
|
-
if (hasTimezone) {
|
|
20604
|
-
if (!isValidTimezone(opts.timezone)) {
|
|
20605
|
-
throw new Error(`Invalid timezone: ${opts.timezone}`, {
|
|
20606
|
-
cause: new Error(
|
|
20607
|
-
"Use an IANA timezone identifier (e.g., America/New_York, Asia/Shanghai)"
|
|
20608
|
-
)
|
|
20609
|
-
});
|
|
20610
|
-
}
|
|
20611
|
-
updates.timezone = opts.timezone;
|
|
20612
|
-
}
|
|
20613
|
-
if (hasNotifyEmail) {
|
|
20614
|
-
updates.notifyEmail = parseOnOff("notify-email", opts.notifyEmail);
|
|
20615
|
-
}
|
|
20616
|
-
if (hasNotifySlack) {
|
|
20617
|
-
updates.notifySlack = parseOnOff("notify-slack", opts.notifySlack);
|
|
20618
|
-
}
|
|
20619
|
-
return updates;
|
|
20620
|
-
}
|
|
20621
|
-
function printUpdateResult(updates, result) {
|
|
20622
|
-
if (updates.timezone !== void 0) {
|
|
20623
|
-
console.log(
|
|
20624
|
-
chalk38.green(
|
|
20625
|
-
`Timezone set to ${chalk38.cyan(result.timezone ?? updates.timezone)}`
|
|
20626
|
-
)
|
|
20627
|
-
);
|
|
20628
|
-
}
|
|
20629
|
-
if (updates.notifyEmail !== void 0) {
|
|
20630
|
-
console.log(
|
|
20631
|
-
chalk38.green(
|
|
20632
|
-
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
20633
|
-
)
|
|
20634
|
-
);
|
|
20635
|
-
}
|
|
20636
|
-
if (updates.notifySlack !== void 0) {
|
|
20637
|
-
console.log(
|
|
20638
|
-
chalk38.green(
|
|
20639
|
-
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
20640
|
-
)
|
|
20641
|
-
);
|
|
20642
|
-
}
|
|
20643
|
-
}
|
|
20644
|
-
async function interactiveSetup(prefs) {
|
|
20645
|
-
if (!prefs.timezone) {
|
|
20646
|
-
const detectedTz = detectTimezone();
|
|
20647
|
-
console.log(chalk38.dim(`
|
|
20648
|
-
System timezone detected: ${detectedTz}`));
|
|
20649
|
-
const tz = await promptText(
|
|
20650
|
-
"Set timezone? (enter timezone or leave empty to skip)",
|
|
20651
|
-
detectedTz
|
|
20652
|
-
);
|
|
20653
|
-
if (tz?.trim()) {
|
|
20654
|
-
if (!isValidTimezone(tz.trim())) {
|
|
20655
|
-
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
20656
|
-
}
|
|
20657
|
-
await updateUserPreferences({ timezone: tz.trim() });
|
|
20658
|
-
console.log(chalk38.green(`Timezone set to ${chalk38.cyan(tz.trim())}`));
|
|
20659
|
-
}
|
|
20660
|
-
}
|
|
20661
|
-
if (!prefs.notifyEmail) {
|
|
20662
|
-
const enable = await promptConfirm(
|
|
20663
|
-
"\nEnable email notifications for scheduled runs?",
|
|
20664
|
-
false
|
|
20665
|
-
);
|
|
20666
|
-
if (enable) {
|
|
20667
|
-
await updateUserPreferences({ notifyEmail: true });
|
|
20668
|
-
console.log(chalk38.green("Email notifications enabled"));
|
|
20669
|
-
}
|
|
20670
|
-
}
|
|
20671
|
-
}
|
|
20672
|
-
var preferenceCommand = new Command42().name("preference").description("View or update your preferences").option("--timezone <timezone>", "IANA timezone (e.g., America/New_York)").option("--notify-email <on|off>", "Enable or disable email notifications").option("--notify-slack <on|off>", "Enable or disable Slack notifications").action(
|
|
20673
|
-
withErrorHandler(async (opts) => {
|
|
20674
|
-
const updates = buildUpdates(opts);
|
|
20675
|
-
if (updates) {
|
|
20676
|
-
const result = await updateUserPreferences(updates);
|
|
20677
|
-
printUpdateResult(updates, result);
|
|
20678
|
-
return;
|
|
20679
|
-
}
|
|
20680
|
-
const prefs = await getUserPreferences();
|
|
20681
|
-
displayPreferences(prefs);
|
|
20682
|
-
if (isInteractive()) {
|
|
20683
|
-
await interactiveSetup(prefs);
|
|
20684
|
-
} else if (!prefs.timezone) {
|
|
20685
|
-
console.log();
|
|
20686
|
-
console.log(
|
|
20687
|
-
`To set timezone: ${chalk38.cyan("vm0 preference --timezone <timezone>")}`
|
|
20688
|
-
);
|
|
20689
|
-
console.log(
|
|
20690
|
-
chalk38.dim("Example: vm0 preference --timezone America/New_York")
|
|
20691
|
-
);
|
|
20692
|
-
}
|
|
20693
|
-
})
|
|
20694
|
-
);
|
|
20695
|
-
|
|
20696
|
-
// src/commands/upgrade/index.ts
|
|
20697
|
-
import { Command as Command43 } from "commander";
|
|
20698
|
-
import chalk39 from "chalk";
|
|
20699
|
-
var upgradeCommand = new Command43().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
20583
|
+
var upgradeCommand = new Command42().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
20700
20584
|
withErrorHandler(async () => {
|
|
20701
20585
|
console.log("Checking for updates...");
|
|
20702
20586
|
const latestVersion = await getLatestVersion();
|
|
20703
20587
|
if (latestVersion === null) {
|
|
20704
20588
|
throw new Error("Could not check for updates. Please try again later.");
|
|
20705
20589
|
}
|
|
20706
|
-
if (latestVersion === "9.78.
|
|
20707
|
-
console.log(
|
|
20590
|
+
if (latestVersion === "9.78.2") {
|
|
20591
|
+
console.log(chalk38.green(`\u2713 Already up to date (${"9.78.2"})`));
|
|
20708
20592
|
return;
|
|
20709
20593
|
}
|
|
20710
20594
|
console.log(
|
|
20711
|
-
|
|
20712
|
-
`Current version: ${"9.78.
|
|
20595
|
+
chalk38.yellow(
|
|
20596
|
+
`Current version: ${"9.78.2"} -> Latest version: ${latestVersion}`
|
|
20713
20597
|
)
|
|
20714
20598
|
);
|
|
20715
20599
|
console.log();
|
|
@@ -20717,26 +20601,26 @@ var upgradeCommand = new Command43().name("upgrade").description("Upgrade vm0 CL
|
|
|
20717
20601
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
20718
20602
|
if (packageManager === "unknown") {
|
|
20719
20603
|
console.log(
|
|
20720
|
-
|
|
20604
|
+
chalk38.yellow(
|
|
20721
20605
|
"Could not detect your package manager for auto-upgrade."
|
|
20722
20606
|
)
|
|
20723
20607
|
);
|
|
20724
20608
|
} else {
|
|
20725
20609
|
console.log(
|
|
20726
|
-
|
|
20610
|
+
chalk38.yellow(
|
|
20727
20611
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
20728
20612
|
)
|
|
20729
20613
|
);
|
|
20730
20614
|
}
|
|
20731
|
-
console.log(
|
|
20732
|
-
console.log(
|
|
20615
|
+
console.log(chalk38.yellow("Please upgrade manually:"));
|
|
20616
|
+
console.log(chalk38.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
20733
20617
|
return;
|
|
20734
20618
|
}
|
|
20735
20619
|
console.log(`Upgrading via ${packageManager}...`);
|
|
20736
20620
|
const success = await performUpgrade(packageManager);
|
|
20737
20621
|
if (success) {
|
|
20738
20622
|
console.log(
|
|
20739
|
-
|
|
20623
|
+
chalk38.green(`\u2713 Upgraded from ${"9.78.2"} to ${latestVersion}`)
|
|
20740
20624
|
);
|
|
20741
20625
|
return;
|
|
20742
20626
|
}
|
|
@@ -20749,8 +20633,8 @@ var upgradeCommand = new Command43().name("upgrade").description("Upgrade vm0 CL
|
|
|
20749
20633
|
);
|
|
20750
20634
|
|
|
20751
20635
|
// src/commands/whoami.ts
|
|
20752
|
-
import { Command as
|
|
20753
|
-
import
|
|
20636
|
+
import { Command as Command43 } from "commander";
|
|
20637
|
+
import chalk39 from "chalk";
|
|
20754
20638
|
function isInsideSandbox() {
|
|
20755
20639
|
return !!process.env.VM0_RUN_ID;
|
|
20756
20640
|
}
|
|
@@ -20765,7 +20649,7 @@ async function showSandboxInfo() {
|
|
|
20765
20649
|
const apiUrl = process.env.VM0_API_URL;
|
|
20766
20650
|
const hasAgentInfo = agentName || agentVersion || agentComposeId || agentOrgSlug || cliAgentType;
|
|
20767
20651
|
if (hasAgentInfo) {
|
|
20768
|
-
console.log(
|
|
20652
|
+
console.log(chalk39.bold("Agent:"));
|
|
20769
20653
|
if (agentName) console.log(` Name: ${agentName}`);
|
|
20770
20654
|
if (agentVersion) console.log(` Version: ${agentVersion}`);
|
|
20771
20655
|
if (agentComposeId) console.log(` Compose ID: ${agentComposeId}`);
|
|
@@ -20773,7 +20657,7 @@ async function showSandboxInfo() {
|
|
|
20773
20657
|
if (cliAgentType) console.log(` Framework: ${cliAgentType}`);
|
|
20774
20658
|
console.log();
|
|
20775
20659
|
}
|
|
20776
|
-
console.log(
|
|
20660
|
+
console.log(chalk39.bold("Run:"));
|
|
20777
20661
|
if (runId) console.log(` ID: ${runId}`);
|
|
20778
20662
|
if (activeOrg) console.log(` Org: ${activeOrg}`);
|
|
20779
20663
|
if (apiUrl) console.log(` API: ${apiUrl}`);
|
|
@@ -20782,23 +20666,23 @@ async function showLocalInfo() {
|
|
|
20782
20666
|
const token = await getToken();
|
|
20783
20667
|
const apiUrl = await getApiUrl();
|
|
20784
20668
|
const activeOrg = await getActiveOrg();
|
|
20785
|
-
console.log(
|
|
20669
|
+
console.log(chalk39.bold("Auth:"));
|
|
20786
20670
|
if (token) {
|
|
20787
20671
|
const tokenSource = process.env.VM0_TOKEN ? "VM0_TOKEN env var" : "config file";
|
|
20788
20672
|
console.log(
|
|
20789
|
-
` Status: ${
|
|
20673
|
+
` Status: ${chalk39.green("Authenticated")} (via ${tokenSource})`
|
|
20790
20674
|
);
|
|
20791
20675
|
} else {
|
|
20792
|
-
console.log(` Status: ${
|
|
20676
|
+
console.log(` Status: ${chalk39.dim("Not authenticated")}`);
|
|
20793
20677
|
}
|
|
20794
20678
|
console.log(` API: ${apiUrl}`);
|
|
20795
20679
|
console.log();
|
|
20796
20680
|
if (activeOrg) {
|
|
20797
|
-
console.log(
|
|
20681
|
+
console.log(chalk39.bold("Org:"));
|
|
20798
20682
|
console.log(` Active: ${activeOrg}`);
|
|
20799
20683
|
}
|
|
20800
20684
|
}
|
|
20801
|
-
var whoamiCommand = new
|
|
20685
|
+
var whoamiCommand = new Command43().name("whoami").description("Show current identity and environment information").action(
|
|
20802
20686
|
withErrorHandler(async () => {
|
|
20803
20687
|
if (isInsideSandbox()) {
|
|
20804
20688
|
await showSandboxInfo();
|
|
@@ -20812,17 +20696,17 @@ var whoamiCommand = new Command44().name("whoami").description("Show current ide
|
|
|
20812
20696
|
import { Command as Command94 } from "commander";
|
|
20813
20697
|
|
|
20814
20698
|
// src/commands/zero/org/index.ts
|
|
20815
|
-
import { Command as
|
|
20699
|
+
import { Command as Command66 } from "commander";
|
|
20816
20700
|
|
|
20817
20701
|
// src/commands/zero/org/status.ts
|
|
20818
|
-
import { Command as
|
|
20819
|
-
import
|
|
20820
|
-
var statusCommand5 = new
|
|
20702
|
+
import { Command as Command44 } from "commander";
|
|
20703
|
+
import chalk40 from "chalk";
|
|
20704
|
+
var statusCommand5 = new Command44().name("status").description("View current organization status").action(
|
|
20821
20705
|
withErrorHandler(async () => {
|
|
20822
20706
|
try {
|
|
20823
20707
|
const org = await getZeroOrg();
|
|
20824
|
-
console.log(
|
|
20825
|
-
console.log(` Slug: ${
|
|
20708
|
+
console.log(chalk40.bold("Organization Information:"));
|
|
20709
|
+
console.log(` Slug: ${chalk40.green(org.slug)}`);
|
|
20826
20710
|
} catch (error) {
|
|
20827
20711
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
20828
20712
|
throw new Error("No organization configured", {
|
|
@@ -20837,9 +20721,9 @@ var statusCommand5 = new Command45().name("status").description("View current or
|
|
|
20837
20721
|
);
|
|
20838
20722
|
|
|
20839
20723
|
// src/commands/zero/org/set.ts
|
|
20840
|
-
import { Command as
|
|
20841
|
-
import
|
|
20842
|
-
var setCommand = new
|
|
20724
|
+
import { Command as Command45 } from "commander";
|
|
20725
|
+
import chalk41 from "chalk";
|
|
20726
|
+
var setCommand = new Command45().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
20843
20727
|
"--force",
|
|
20844
20728
|
"Force change existing organization (may break references)"
|
|
20845
20729
|
).action(
|
|
@@ -20858,10 +20742,10 @@ var setCommand = new Command46().name("set").description("Rename your organizati
|
|
|
20858
20742
|
}
|
|
20859
20743
|
const org = await updateZeroOrg({ slug, force: true });
|
|
20860
20744
|
await saveConfig({ activeOrg: org.slug });
|
|
20861
|
-
console.log(
|
|
20745
|
+
console.log(chalk41.green(`\u2713 Organization updated to ${org.slug}`));
|
|
20862
20746
|
console.log();
|
|
20863
20747
|
console.log("Your agents will now be namespaced as:");
|
|
20864
|
-
console.log(
|
|
20748
|
+
console.log(chalk41.cyan(` ${org.slug}/<agent-name>`));
|
|
20865
20749
|
} catch (error) {
|
|
20866
20750
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
20867
20751
|
throw new Error(
|
|
@@ -20874,27 +20758,27 @@ var setCommand = new Command46().name("set").description("Rename your organizati
|
|
|
20874
20758
|
);
|
|
20875
20759
|
|
|
20876
20760
|
// src/commands/zero/org/list.ts
|
|
20877
|
-
import { Command as
|
|
20878
|
-
import
|
|
20879
|
-
var listCommand5 = new
|
|
20761
|
+
import { Command as Command46 } from "commander";
|
|
20762
|
+
import chalk42 from "chalk";
|
|
20763
|
+
var listCommand5 = new Command46().name("list").description("List all accessible organizations").action(
|
|
20880
20764
|
withErrorHandler(async () => {
|
|
20881
20765
|
const result = await listZeroOrgs();
|
|
20882
20766
|
const activeOrg = await getActiveOrg();
|
|
20883
|
-
console.log(
|
|
20767
|
+
console.log(chalk42.bold("Available organizations:"));
|
|
20884
20768
|
for (const org of result.orgs) {
|
|
20885
20769
|
const isCurrent = org.slug === activeOrg;
|
|
20886
|
-
const marker = isCurrent ?
|
|
20770
|
+
const marker = isCurrent ? chalk42.green("* ") : " ";
|
|
20887
20771
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
20888
|
-
const currentLabel = isCurrent ?
|
|
20772
|
+
const currentLabel = isCurrent ? chalk42.dim(" \u2190 current") : "";
|
|
20889
20773
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
20890
20774
|
}
|
|
20891
20775
|
})
|
|
20892
20776
|
);
|
|
20893
20777
|
|
|
20894
20778
|
// src/commands/zero/org/use.ts
|
|
20895
|
-
import { Command as
|
|
20896
|
-
import
|
|
20897
|
-
var useCommand = new
|
|
20779
|
+
import { Command as Command47 } from "commander";
|
|
20780
|
+
import chalk43 from "chalk";
|
|
20781
|
+
var useCommand = new Command47().name("use").description("Switch to a different organization").argument("<slug>", "Organization slug to switch to").action(
|
|
20898
20782
|
withErrorHandler(async (slug) => {
|
|
20899
20783
|
const orgList = await listZeroOrgs();
|
|
20900
20784
|
const target = orgList.orgs.find((s) => s.slug === slug);
|
|
@@ -20902,119 +20786,119 @@ var useCommand = new Command48().name("use").description("Switch to a different
|
|
|
20902
20786
|
throw new Error(`Organization '${slug}' not found or not accessible.`);
|
|
20903
20787
|
}
|
|
20904
20788
|
await saveConfig({ activeOrg: slug });
|
|
20905
|
-
console.log(
|
|
20789
|
+
console.log(chalk43.green(`\u2713 Switched to organization: ${slug}`));
|
|
20906
20790
|
})
|
|
20907
20791
|
);
|
|
20908
20792
|
|
|
20909
20793
|
// src/commands/zero/org/members.ts
|
|
20910
|
-
import { Command as
|
|
20911
|
-
import
|
|
20912
|
-
var membersCommand = new
|
|
20794
|
+
import { Command as Command48 } from "commander";
|
|
20795
|
+
import chalk44 from "chalk";
|
|
20796
|
+
var membersCommand = new Command48().name("members").description("View organization members").action(
|
|
20913
20797
|
withErrorHandler(async () => {
|
|
20914
20798
|
const status = await getZeroOrgMembers();
|
|
20915
|
-
console.log(
|
|
20799
|
+
console.log(chalk44.bold(`Organization: ${status.slug}`));
|
|
20916
20800
|
console.log(` Role: ${status.role}`);
|
|
20917
20801
|
console.log(
|
|
20918
20802
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
20919
20803
|
);
|
|
20920
20804
|
console.log();
|
|
20921
|
-
console.log(
|
|
20805
|
+
console.log(chalk44.bold("Members:"));
|
|
20922
20806
|
for (const member of status.members) {
|
|
20923
|
-
const roleTag = member.role === "admin" ?
|
|
20807
|
+
const roleTag = member.role === "admin" ? chalk44.yellow(` (${member.role})`) : chalk44.dim(` (${member.role})`);
|
|
20924
20808
|
console.log(` ${member.email}${roleTag}`);
|
|
20925
20809
|
}
|
|
20926
20810
|
})
|
|
20927
20811
|
);
|
|
20928
20812
|
|
|
20929
20813
|
// src/commands/zero/org/invite.ts
|
|
20930
|
-
import { Command as
|
|
20931
|
-
import
|
|
20932
|
-
var inviteCommand = new
|
|
20814
|
+
import { Command as Command49 } from "commander";
|
|
20815
|
+
import chalk45 from "chalk";
|
|
20816
|
+
var inviteCommand = new Command49().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").action(
|
|
20933
20817
|
withErrorHandler(async (options) => {
|
|
20934
20818
|
await inviteZeroOrgMember(options.email);
|
|
20935
|
-
console.log(
|
|
20819
|
+
console.log(chalk45.green(`\u2713 Invitation sent to ${options.email}`));
|
|
20936
20820
|
})
|
|
20937
20821
|
);
|
|
20938
20822
|
|
|
20939
20823
|
// src/commands/zero/org/remove.ts
|
|
20940
|
-
import { Command as
|
|
20941
|
-
import
|
|
20942
|
-
var removeCommand = new
|
|
20824
|
+
import { Command as Command50 } from "commander";
|
|
20825
|
+
import chalk46 from "chalk";
|
|
20826
|
+
var removeCommand = new Command50().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
20943
20827
|
withErrorHandler(async (email) => {
|
|
20944
20828
|
await removeZeroOrgMember(email);
|
|
20945
|
-
console.log(
|
|
20829
|
+
console.log(chalk46.green(`\u2713 Removed ${email} from organization`));
|
|
20946
20830
|
})
|
|
20947
20831
|
);
|
|
20948
20832
|
|
|
20949
20833
|
// src/commands/zero/org/leave.ts
|
|
20950
|
-
import { Command as
|
|
20951
|
-
import
|
|
20952
|
-
var leaveCommand = new
|
|
20834
|
+
import { Command as Command51 } from "commander";
|
|
20835
|
+
import chalk47 from "chalk";
|
|
20836
|
+
var leaveCommand = new Command51().name("leave").description("Leave the current organization").action(
|
|
20953
20837
|
withErrorHandler(async () => {
|
|
20954
20838
|
await leaveZeroOrg();
|
|
20955
20839
|
const { orgs } = await listZeroOrgs();
|
|
20956
20840
|
if (orgs.length === 0) {
|
|
20957
20841
|
await saveConfig({ activeOrg: void 0 });
|
|
20958
|
-
console.log(
|
|
20842
|
+
console.log(chalk47.green("\u2713 Left organization."));
|
|
20959
20843
|
console.log(
|
|
20960
|
-
|
|
20844
|
+
chalk47.yellow("No remaining organizations. Run: vm0 auth login")
|
|
20961
20845
|
);
|
|
20962
20846
|
return;
|
|
20963
20847
|
}
|
|
20964
20848
|
const nextOrg = orgs[0].slug;
|
|
20965
20849
|
await saveConfig({ activeOrg: nextOrg });
|
|
20966
|
-
console.log(
|
|
20850
|
+
console.log(chalk47.green(`\u2713 Left organization. Switched to: ${nextOrg}`));
|
|
20967
20851
|
})
|
|
20968
20852
|
);
|
|
20969
20853
|
|
|
20970
20854
|
// src/commands/zero/org/delete.ts
|
|
20971
|
-
import { Command as
|
|
20972
|
-
import
|
|
20973
|
-
var deleteCommand = new
|
|
20855
|
+
import { Command as Command52 } from "commander";
|
|
20856
|
+
import chalk48 from "chalk";
|
|
20857
|
+
var deleteCommand = new Command52().name("delete").description("Delete the current organization (admin only)").argument("<slug>", "Organization slug to confirm deletion").action(
|
|
20974
20858
|
withErrorHandler(async (slug) => {
|
|
20975
20859
|
await deleteZeroOrg(slug);
|
|
20976
|
-
console.log(
|
|
20860
|
+
console.log(chalk48.green(`\u2713 Organization '${slug}' has been deleted.`));
|
|
20977
20861
|
})
|
|
20978
20862
|
);
|
|
20979
20863
|
|
|
20980
20864
|
// src/commands/zero/org/secret/index.ts
|
|
20981
|
-
import { Command as
|
|
20865
|
+
import { Command as Command56 } from "commander";
|
|
20982
20866
|
|
|
20983
20867
|
// src/commands/zero/org/secret/list.ts
|
|
20984
|
-
import { Command as
|
|
20985
|
-
import
|
|
20986
|
-
var listCommand6 = new
|
|
20868
|
+
import { Command as Command53 } from "commander";
|
|
20869
|
+
import chalk49 from "chalk";
|
|
20870
|
+
var listCommand6 = new Command53().name("list").alias("ls").description("List all org-level secrets").action(
|
|
20987
20871
|
withErrorHandler(async () => {
|
|
20988
20872
|
const result = await listZeroOrgSecrets();
|
|
20989
20873
|
if (result.secrets.length === 0) {
|
|
20990
|
-
console.log(
|
|
20874
|
+
console.log(chalk49.dim("No org secrets found"));
|
|
20991
20875
|
console.log();
|
|
20992
20876
|
console.log("To add an org secret:");
|
|
20993
20877
|
console.log(
|
|
20994
|
-
|
|
20878
|
+
chalk49.cyan(" vm0 zero org secret set MY_API_KEY --body <value>")
|
|
20995
20879
|
);
|
|
20996
20880
|
return;
|
|
20997
20881
|
}
|
|
20998
|
-
console.log(
|
|
20882
|
+
console.log(chalk49.bold("Org Secrets:"));
|
|
20999
20883
|
console.log();
|
|
21000
20884
|
for (const secret of result.secrets) {
|
|
21001
|
-
console.log(` ${
|
|
20885
|
+
console.log(` ${chalk49.cyan(secret.name)}`);
|
|
21002
20886
|
if (secret.description) {
|
|
21003
|
-
console.log(` ${
|
|
20887
|
+
console.log(` ${chalk49.dim(secret.description)}`);
|
|
21004
20888
|
}
|
|
21005
20889
|
console.log(
|
|
21006
|
-
` ${
|
|
20890
|
+
` ${chalk49.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
21007
20891
|
);
|
|
21008
20892
|
console.log();
|
|
21009
20893
|
}
|
|
21010
|
-
console.log(
|
|
20894
|
+
console.log(chalk49.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
21011
20895
|
})
|
|
21012
20896
|
);
|
|
21013
20897
|
|
|
21014
20898
|
// src/commands/zero/org/secret/set.ts
|
|
21015
|
-
import { Command as
|
|
21016
|
-
import
|
|
21017
|
-
var setCommand2 = new
|
|
20899
|
+
import { Command as Command54 } from "commander";
|
|
20900
|
+
import chalk50 from "chalk";
|
|
20901
|
+
var setCommand2 = new Command54().name("set").description("Create or update an org-level secret (admin only)").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
21018
20902
|
"-b, --body <value>",
|
|
21019
20903
|
"Secret value (required in non-interactive mode)"
|
|
21020
20904
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -21053,19 +20937,19 @@ var setCommand2 = new Command55().name("set").description("Create or update an o
|
|
|
21053
20937
|
}
|
|
21054
20938
|
throw error;
|
|
21055
20939
|
}
|
|
21056
|
-
console.log(
|
|
20940
|
+
console.log(chalk50.green(`\u2713 Org secret "${secret.name}" saved`));
|
|
21057
20941
|
console.log();
|
|
21058
20942
|
console.log("Use in vm0.yaml:");
|
|
21059
|
-
console.log(
|
|
21060
|
-
console.log(
|
|
20943
|
+
console.log(chalk50.cyan(` environment:`));
|
|
20944
|
+
console.log(chalk50.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
21061
20945
|
}
|
|
21062
20946
|
)
|
|
21063
20947
|
);
|
|
21064
20948
|
|
|
21065
20949
|
// src/commands/zero/org/secret/remove.ts
|
|
21066
|
-
import { Command as
|
|
21067
|
-
import
|
|
21068
|
-
var removeCommand2 = new
|
|
20950
|
+
import { Command as Command55 } from "commander";
|
|
20951
|
+
import chalk51 from "chalk";
|
|
20952
|
+
var removeCommand2 = new Command55().name("remove").description("Delete an org-level secret (admin only)").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
21069
20953
|
withErrorHandler(async (name, options) => {
|
|
21070
20954
|
if (!options.yes) {
|
|
21071
20955
|
if (!isInteractive()) {
|
|
@@ -21076,61 +20960,61 @@ var removeCommand2 = new Command56().name("remove").description("Delete an org-l
|
|
|
21076
20960
|
false
|
|
21077
20961
|
);
|
|
21078
20962
|
if (!confirmed) {
|
|
21079
|
-
console.log(
|
|
20963
|
+
console.log(chalk51.dim("Cancelled"));
|
|
21080
20964
|
return;
|
|
21081
20965
|
}
|
|
21082
20966
|
}
|
|
21083
20967
|
await deleteZeroOrgSecret(name);
|
|
21084
|
-
console.log(
|
|
20968
|
+
console.log(chalk51.green(`\u2713 Org secret "${name}" deleted`));
|
|
21085
20969
|
})
|
|
21086
20970
|
);
|
|
21087
20971
|
|
|
21088
20972
|
// src/commands/zero/org/secret/index.ts
|
|
21089
|
-
var zeroOrgSecretCommand = new
|
|
20973
|
+
var zeroOrgSecretCommand = new Command56().name("secret").description("Manage org-level secrets (admin)").addCommand(listCommand6).addCommand(setCommand2).addCommand(removeCommand2);
|
|
21090
20974
|
|
|
21091
20975
|
// src/commands/zero/org/variable/index.ts
|
|
21092
|
-
import { Command as
|
|
20976
|
+
import { Command as Command60 } from "commander";
|
|
21093
20977
|
|
|
21094
20978
|
// src/commands/zero/org/variable/list.ts
|
|
21095
|
-
import { Command as
|
|
21096
|
-
import
|
|
20979
|
+
import { Command as Command57 } from "commander";
|
|
20980
|
+
import chalk52 from "chalk";
|
|
21097
20981
|
function truncateValue(value, maxLength = 60) {
|
|
21098
20982
|
if (value.length <= maxLength) {
|
|
21099
20983
|
return value;
|
|
21100
20984
|
}
|
|
21101
20985
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
21102
20986
|
}
|
|
21103
|
-
var listCommand7 = new
|
|
20987
|
+
var listCommand7 = new Command57().name("list").alias("ls").description("List all org-level variables").action(
|
|
21104
20988
|
withErrorHandler(async () => {
|
|
21105
20989
|
const result = await listZeroOrgVariables();
|
|
21106
20990
|
if (result.variables.length === 0) {
|
|
21107
|
-
console.log(
|
|
20991
|
+
console.log(chalk52.dim("No org variables found"));
|
|
21108
20992
|
console.log();
|
|
21109
20993
|
console.log("To add an org variable:");
|
|
21110
|
-
console.log(
|
|
20994
|
+
console.log(chalk52.cyan(" vm0 zero org variable set MY_VAR <value>"));
|
|
21111
20995
|
return;
|
|
21112
20996
|
}
|
|
21113
|
-
console.log(
|
|
20997
|
+
console.log(chalk52.bold("Org Variables:"));
|
|
21114
20998
|
console.log();
|
|
21115
20999
|
for (const variable of result.variables) {
|
|
21116
21000
|
const displayValue = truncateValue(variable.value);
|
|
21117
|
-
console.log(` ${
|
|
21001
|
+
console.log(` ${chalk52.cyan(variable.name)} = ${displayValue}`);
|
|
21118
21002
|
if (variable.description) {
|
|
21119
|
-
console.log(` ${
|
|
21003
|
+
console.log(` ${chalk52.dim(variable.description)}`);
|
|
21120
21004
|
}
|
|
21121
21005
|
console.log(
|
|
21122
|
-
` ${
|
|
21006
|
+
` ${chalk52.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
21123
21007
|
);
|
|
21124
21008
|
console.log();
|
|
21125
21009
|
}
|
|
21126
|
-
console.log(
|
|
21010
|
+
console.log(chalk52.dim(`Total: ${result.variables.length} variable(s)`));
|
|
21127
21011
|
})
|
|
21128
21012
|
);
|
|
21129
21013
|
|
|
21130
21014
|
// src/commands/zero/org/variable/set.ts
|
|
21131
|
-
import { Command as
|
|
21132
|
-
import
|
|
21133
|
-
var setCommand3 = new
|
|
21015
|
+
import { Command as Command58 } from "commander";
|
|
21016
|
+
import chalk53 from "chalk";
|
|
21017
|
+
var setCommand3 = new Command58().name("set").description("Create or update an org-level variable (admin only)").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
21134
21018
|
withErrorHandler(
|
|
21135
21019
|
async (name, value, options) => {
|
|
21136
21020
|
let variable;
|
|
@@ -21150,19 +21034,19 @@ var setCommand3 = new Command59().name("set").description("Create or update an o
|
|
|
21150
21034
|
}
|
|
21151
21035
|
throw error;
|
|
21152
21036
|
}
|
|
21153
|
-
console.log(
|
|
21037
|
+
console.log(chalk53.green(`\u2713 Org variable "${variable.name}" saved`));
|
|
21154
21038
|
console.log();
|
|
21155
21039
|
console.log("Use in vm0.yaml:");
|
|
21156
|
-
console.log(
|
|
21157
|
-
console.log(
|
|
21040
|
+
console.log(chalk53.cyan(` environment:`));
|
|
21041
|
+
console.log(chalk53.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
21158
21042
|
}
|
|
21159
21043
|
)
|
|
21160
21044
|
);
|
|
21161
21045
|
|
|
21162
21046
|
// src/commands/zero/org/variable/remove.ts
|
|
21163
|
-
import { Command as
|
|
21164
|
-
import
|
|
21165
|
-
var removeCommand3 = new
|
|
21047
|
+
import { Command as Command59 } from "commander";
|
|
21048
|
+
import chalk54 from "chalk";
|
|
21049
|
+
var removeCommand3 = new Command59().name("remove").description("Delete an org-level variable (admin only)").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
21166
21050
|
withErrorHandler(async (name, options) => {
|
|
21167
21051
|
if (!options.yes) {
|
|
21168
21052
|
if (!isInteractive()) {
|
|
@@ -21173,32 +21057,32 @@ var removeCommand3 = new Command60().name("remove").description("Delete an org-l
|
|
|
21173
21057
|
false
|
|
21174
21058
|
);
|
|
21175
21059
|
if (!confirmed) {
|
|
21176
|
-
console.log(
|
|
21060
|
+
console.log(chalk54.dim("Cancelled"));
|
|
21177
21061
|
return;
|
|
21178
21062
|
}
|
|
21179
21063
|
}
|
|
21180
21064
|
await deleteZeroOrgVariable(name);
|
|
21181
|
-
console.log(
|
|
21065
|
+
console.log(chalk54.green(`\u2713 Org variable "${name}" deleted`));
|
|
21182
21066
|
})
|
|
21183
21067
|
);
|
|
21184
21068
|
|
|
21185
21069
|
// src/commands/zero/org/variable/index.ts
|
|
21186
|
-
var zeroOrgVariableCommand = new
|
|
21070
|
+
var zeroOrgVariableCommand = new Command60().name("variable").description("Manage org-level variables (admin)").addCommand(listCommand7).addCommand(setCommand3).addCommand(removeCommand3);
|
|
21187
21071
|
|
|
21188
21072
|
// src/commands/zero/org/model-provider/index.ts
|
|
21189
|
-
import { Command as
|
|
21073
|
+
import { Command as Command65 } from "commander";
|
|
21190
21074
|
|
|
21191
21075
|
// src/commands/zero/org/model-provider/list.ts
|
|
21192
|
-
import { Command as
|
|
21193
|
-
import
|
|
21194
|
-
var listCommand8 = new
|
|
21076
|
+
import { Command as Command61 } from "commander";
|
|
21077
|
+
import chalk55 from "chalk";
|
|
21078
|
+
var listCommand8 = new Command61().name("list").alias("ls").description("List all org-level model providers").action(
|
|
21195
21079
|
withErrorHandler(async () => {
|
|
21196
21080
|
const result = await listZeroOrgModelProviders();
|
|
21197
21081
|
if (result.modelProviders.length === 0) {
|
|
21198
|
-
console.log(
|
|
21082
|
+
console.log(chalk55.dim("No org-level model providers configured"));
|
|
21199
21083
|
console.log();
|
|
21200
21084
|
console.log("To add an org-level model provider:");
|
|
21201
|
-
console.log(
|
|
21085
|
+
console.log(chalk55.cyan(" vm0 zero org model-provider setup"));
|
|
21202
21086
|
return;
|
|
21203
21087
|
}
|
|
21204
21088
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -21212,16 +21096,16 @@ var listCommand8 = new Command62().name("list").alias("ls").description("List al
|
|
|
21212
21096
|
},
|
|
21213
21097
|
{}
|
|
21214
21098
|
);
|
|
21215
|
-
console.log(
|
|
21099
|
+
console.log(chalk55.bold("Org Model Providers:"));
|
|
21216
21100
|
console.log();
|
|
21217
21101
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
21218
|
-
console.log(` ${
|
|
21102
|
+
console.log(` ${chalk55.cyan(framework)}:`);
|
|
21219
21103
|
for (const provider of providers) {
|
|
21220
|
-
const defaultTag = provider.isDefault ?
|
|
21221
|
-
const modelTag = provider.selectedModel ?
|
|
21104
|
+
const defaultTag = provider.isDefault ? chalk55.green(" (default)") : "";
|
|
21105
|
+
const modelTag = provider.selectedModel ? chalk55.dim(` [${provider.selectedModel}]`) : "";
|
|
21222
21106
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
21223
21107
|
console.log(
|
|
21224
|
-
|
|
21108
|
+
chalk55.dim(
|
|
21225
21109
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
21226
21110
|
)
|
|
21227
21111
|
);
|
|
@@ -21229,18 +21113,18 @@ var listCommand8 = new Command62().name("list").alias("ls").description("List al
|
|
|
21229
21113
|
console.log();
|
|
21230
21114
|
}
|
|
21231
21115
|
console.log(
|
|
21232
|
-
|
|
21116
|
+
chalk55.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
21233
21117
|
);
|
|
21234
21118
|
})
|
|
21235
21119
|
);
|
|
21236
21120
|
|
|
21237
21121
|
// src/commands/zero/org/model-provider/setup.ts
|
|
21238
|
-
import { Command as
|
|
21239
|
-
import
|
|
21122
|
+
import { Command as Command62 } from "commander";
|
|
21123
|
+
import chalk57 from "chalk";
|
|
21240
21124
|
import prompts3 from "prompts";
|
|
21241
21125
|
|
|
21242
21126
|
// src/lib/domain/model-provider/shared.ts
|
|
21243
|
-
import
|
|
21127
|
+
import chalk56 from "chalk";
|
|
21244
21128
|
import prompts2 from "prompts";
|
|
21245
21129
|
function validateProviderType(typeStr) {
|
|
21246
21130
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
@@ -21425,7 +21309,7 @@ async function promptForModelSelection(type2) {
|
|
|
21425
21309
|
if (selected === "__custom__") {
|
|
21426
21310
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
21427
21311
|
if (placeholder) {
|
|
21428
|
-
console.log(
|
|
21312
|
+
console.log(chalk56.dim(`Example: ${placeholder}`));
|
|
21429
21313
|
}
|
|
21430
21314
|
const customResponse = await prompts2(
|
|
21431
21315
|
{
|
|
@@ -21475,7 +21359,7 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
21475
21359
|
const secrets = {};
|
|
21476
21360
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
21477
21361
|
if (fieldConfig.helpText) {
|
|
21478
|
-
console.log(
|
|
21362
|
+
console.log(chalk56.dim(fieldConfig.helpText));
|
|
21479
21363
|
}
|
|
21480
21364
|
const isSensitive = isSensitiveSecret(name);
|
|
21481
21365
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -21532,7 +21416,7 @@ async function handleInteractiveMode() {
|
|
|
21532
21416
|
title = `${title} \u2713`;
|
|
21533
21417
|
}
|
|
21534
21418
|
if (isExperimental) {
|
|
21535
|
-
title = `${title} ${
|
|
21419
|
+
title = `${title} ${chalk57.dim("(experimental)")}`;
|
|
21536
21420
|
}
|
|
21537
21421
|
return {
|
|
21538
21422
|
title,
|
|
@@ -21579,7 +21463,7 @@ async function handleInteractiveMode() {
|
|
|
21579
21463
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
21580
21464
|
console.log();
|
|
21581
21465
|
if ("helpText" in config) {
|
|
21582
|
-
console.log(
|
|
21466
|
+
console.log(chalk57.dim(config.helpText));
|
|
21583
21467
|
}
|
|
21584
21468
|
console.log();
|
|
21585
21469
|
if (hasAuthMethods(type2)) {
|
|
@@ -21621,10 +21505,10 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
21621
21505
|
);
|
|
21622
21506
|
if (response.setDefault) {
|
|
21623
21507
|
await setZeroOrgModelProviderDefault(type2);
|
|
21624
|
-
console.log(
|
|
21508
|
+
console.log(chalk57.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
21625
21509
|
}
|
|
21626
21510
|
}
|
|
21627
|
-
var setupCommand = new
|
|
21511
|
+
var setupCommand = new Command62().name("setup").description("Configure an org-level model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
21628
21512
|
"-s, --secret <value>",
|
|
21629
21513
|
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
21630
21514
|
collectSecrets,
|
|
@@ -21663,11 +21547,11 @@ var setupCommand = new Command63().name("setup").description("Configure an org-l
|
|
|
21663
21547
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
21664
21548
|
if (!hasModelSelection(input.type)) {
|
|
21665
21549
|
console.log(
|
|
21666
|
-
|
|
21550
|
+
chalk57.green(`\u2713 Org model provider "${input.type}" unchanged`)
|
|
21667
21551
|
);
|
|
21668
21552
|
} else {
|
|
21669
21553
|
console.log(
|
|
21670
|
-
|
|
21554
|
+
chalk57.green(
|
|
21671
21555
|
`\u2713 Org model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
21672
21556
|
)
|
|
21673
21557
|
);
|
|
@@ -21692,7 +21576,7 @@ var setupCommand = new Command63().name("setup").description("Configure an org-l
|
|
|
21692
21576
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
21693
21577
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
21694
21578
|
console.log(
|
|
21695
|
-
|
|
21579
|
+
chalk57.green(
|
|
21696
21580
|
`\u2713 Org model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
21697
21581
|
)
|
|
21698
21582
|
);
|
|
@@ -21708,9 +21592,9 @@ var setupCommand = new Command63().name("setup").description("Configure an org-l
|
|
|
21708
21592
|
);
|
|
21709
21593
|
|
|
21710
21594
|
// src/commands/zero/org/model-provider/remove.ts
|
|
21711
|
-
import { Command as
|
|
21712
|
-
import
|
|
21713
|
-
var removeCommand4 = new
|
|
21595
|
+
import { Command as Command63 } from "commander";
|
|
21596
|
+
import chalk58 from "chalk";
|
|
21597
|
+
var removeCommand4 = new Command63().name("remove").description("Remove an org-level model provider").argument("<type>", "Model provider type to remove").action(
|
|
21714
21598
|
withErrorHandler(async (type2) => {
|
|
21715
21599
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
21716
21600
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -21719,14 +21603,14 @@ var removeCommand4 = new Command64().name("remove").description("Remove an org-l
|
|
|
21719
21603
|
});
|
|
21720
21604
|
}
|
|
21721
21605
|
await deleteZeroOrgModelProvider(type2);
|
|
21722
|
-
console.log(
|
|
21606
|
+
console.log(chalk58.green(`\u2713 Org model provider "${type2}" removed`));
|
|
21723
21607
|
})
|
|
21724
21608
|
);
|
|
21725
21609
|
|
|
21726
21610
|
// src/commands/zero/org/model-provider/set-default.ts
|
|
21727
|
-
import { Command as
|
|
21728
|
-
import
|
|
21729
|
-
var setDefaultCommand = new
|
|
21611
|
+
import { Command as Command64 } from "commander";
|
|
21612
|
+
import chalk59 from "chalk";
|
|
21613
|
+
var setDefaultCommand = new Command64().name("set-default").description("Set an org-level model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
21730
21614
|
withErrorHandler(async (type2) => {
|
|
21731
21615
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
21732
21616
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -21738,7 +21622,7 @@ var setDefaultCommand = new Command65().name("set-default").description("Set an
|
|
|
21738
21622
|
type2
|
|
21739
21623
|
);
|
|
21740
21624
|
console.log(
|
|
21741
|
-
|
|
21625
|
+
chalk59.green(
|
|
21742
21626
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
21743
21627
|
)
|
|
21744
21628
|
);
|
|
@@ -21746,19 +21630,19 @@ var setDefaultCommand = new Command65().name("set-default").description("Set an
|
|
|
21746
21630
|
);
|
|
21747
21631
|
|
|
21748
21632
|
// src/commands/zero/org/model-provider/index.ts
|
|
21749
|
-
var zeroOrgModelProviderCommand = new
|
|
21633
|
+
var zeroOrgModelProviderCommand = new Command65().name("model-provider").description("Manage org-level model providers").addCommand(listCommand8).addCommand(setupCommand).addCommand(removeCommand4).addCommand(setDefaultCommand);
|
|
21750
21634
|
|
|
21751
21635
|
// src/commands/zero/org/index.ts
|
|
21752
|
-
var zeroOrgCommand = new
|
|
21636
|
+
var zeroOrgCommand = new Command66().name("org").description("Manage your organization").addCommand(statusCommand5).addCommand(setCommand).addCommand(listCommand5).addCommand(useCommand).addCommand(membersCommand).addCommand(inviteCommand).addCommand(removeCommand).addCommand(leaveCommand).addCommand(deleteCommand).addCommand(zeroOrgSecretCommand).addCommand(zeroOrgVariableCommand).addCommand(zeroOrgModelProviderCommand);
|
|
21753
21637
|
|
|
21754
21638
|
// src/commands/zero/agent/index.ts
|
|
21755
|
-
import { Command as
|
|
21639
|
+
import { Command as Command72 } from "commander";
|
|
21756
21640
|
|
|
21757
21641
|
// src/commands/zero/agent/create.ts
|
|
21758
|
-
import { Command as
|
|
21642
|
+
import { Command as Command67 } from "commander";
|
|
21759
21643
|
import { readFileSync } from "fs";
|
|
21760
|
-
import
|
|
21761
|
-
var createCommand = new
|
|
21644
|
+
import chalk60 from "chalk";
|
|
21645
|
+
var createCommand = new Command67().name("create").description("Create a new zero agent").requiredOption(
|
|
21762
21646
|
"--connectors <items>",
|
|
21763
21647
|
"Comma-separated connector short names (e.g. github,linear)"
|
|
21764
21648
|
).option("--display-name <name>", "Agent display name").option("--description <text>", "Agent description").option(
|
|
@@ -21778,7 +21662,7 @@ var createCommand = new Command68().name("create").description("Create a new zer
|
|
|
21778
21662
|
const content = readFileSync(options.instructionsFile, "utf-8");
|
|
21779
21663
|
await updateZeroAgentInstructions(agent.name, content);
|
|
21780
21664
|
}
|
|
21781
|
-
console.log(
|
|
21665
|
+
console.log(chalk60.green(`\u2713 Zero agent '${agent.name}' created`));
|
|
21782
21666
|
console.log(` Compose ID: ${agent.agentComposeId}`);
|
|
21783
21667
|
console.log(` Connectors: ${agent.connectors.join(", ")}`);
|
|
21784
21668
|
if (agent.displayName) {
|
|
@@ -21789,10 +21673,10 @@ var createCommand = new Command68().name("create").description("Create a new zer
|
|
|
21789
21673
|
);
|
|
21790
21674
|
|
|
21791
21675
|
// src/commands/zero/agent/edit.ts
|
|
21792
|
-
import { Command as
|
|
21676
|
+
import { Command as Command68 } from "commander";
|
|
21793
21677
|
import { readFileSync as readFileSync2 } from "fs";
|
|
21794
|
-
import
|
|
21795
|
-
var editCommand = new
|
|
21678
|
+
import chalk61 from "chalk";
|
|
21679
|
+
var editCommand = new Command68().name("edit").description("Edit a zero agent").argument("<name>", "Agent name").option(
|
|
21796
21680
|
"--connectors <items>",
|
|
21797
21681
|
"Comma-separated connector short names (e.g. github,linear)"
|
|
21798
21682
|
).option("--display-name <name>", "New display name").option("--description <text>", "New description").option(
|
|
@@ -21821,20 +21705,20 @@ var editCommand = new Command69().name("edit").description("Edit a zero agent").
|
|
|
21821
21705
|
const content = readFileSync2(options.instructionsFile, "utf-8");
|
|
21822
21706
|
await updateZeroAgentInstructions(name, content);
|
|
21823
21707
|
}
|
|
21824
|
-
console.log(
|
|
21708
|
+
console.log(chalk61.green(`\u2713 Zero agent '${name}' updated`));
|
|
21825
21709
|
}
|
|
21826
21710
|
)
|
|
21827
21711
|
);
|
|
21828
21712
|
|
|
21829
21713
|
// src/commands/zero/agent/view.ts
|
|
21830
|
-
import { Command as
|
|
21831
|
-
import
|
|
21832
|
-
var viewCommand = new
|
|
21714
|
+
import { Command as Command69 } from "commander";
|
|
21715
|
+
import chalk62 from "chalk";
|
|
21716
|
+
var viewCommand = new Command69().name("view").description("View a zero agent").argument("<name>", "Agent name").option("--instructions", "Also show instructions content").action(
|
|
21833
21717
|
withErrorHandler(
|
|
21834
21718
|
async (name, options) => {
|
|
21835
21719
|
const agent = await getZeroAgent(name);
|
|
21836
|
-
console.log(
|
|
21837
|
-
if (agent.displayName) console.log(
|
|
21720
|
+
console.log(chalk62.bold(agent.name));
|
|
21721
|
+
if (agent.displayName) console.log(chalk62.dim(agent.displayName));
|
|
21838
21722
|
console.log();
|
|
21839
21723
|
console.log(`Compose ID: ${agent.agentComposeId}`);
|
|
21840
21724
|
console.log(`Connectors: ${agent.connectors.join(", ") || "-"}`);
|
|
@@ -21845,10 +21729,10 @@ var viewCommand = new Command70().name("view").description("View a zero agent").
|
|
|
21845
21729
|
console.log();
|
|
21846
21730
|
const result = await getZeroAgentInstructions(name);
|
|
21847
21731
|
if (result.content) {
|
|
21848
|
-
console.log(
|
|
21732
|
+
console.log(chalk62.dim("\u2500\u2500 Instructions \u2500\u2500"));
|
|
21849
21733
|
console.log(result.content);
|
|
21850
21734
|
} else {
|
|
21851
|
-
console.log(
|
|
21735
|
+
console.log(chalk62.dim("No instructions set"));
|
|
21852
21736
|
}
|
|
21853
21737
|
}
|
|
21854
21738
|
}
|
|
@@ -21856,15 +21740,15 @@ var viewCommand = new Command70().name("view").description("View a zero agent").
|
|
|
21856
21740
|
);
|
|
21857
21741
|
|
|
21858
21742
|
// src/commands/zero/agent/list.ts
|
|
21859
|
-
import { Command as
|
|
21860
|
-
import
|
|
21861
|
-
var listCommand9 = new
|
|
21743
|
+
import { Command as Command70 } from "commander";
|
|
21744
|
+
import chalk63 from "chalk";
|
|
21745
|
+
var listCommand9 = new Command70().name("list").alias("ls").description("List all zero agents").action(
|
|
21862
21746
|
withErrorHandler(async () => {
|
|
21863
21747
|
const agents = await listZeroAgents();
|
|
21864
21748
|
if (agents.length === 0) {
|
|
21865
|
-
console.log(
|
|
21749
|
+
console.log(chalk63.dim("No zero agents found"));
|
|
21866
21750
|
console.log(
|
|
21867
|
-
|
|
21751
|
+
chalk63.dim(
|
|
21868
21752
|
' Create one with: vm0 zero agent create --connectors github --display-name "My Agent"'
|
|
21869
21753
|
)
|
|
21870
21754
|
);
|
|
@@ -21880,7 +21764,7 @@ var listCommand9 = new Command71().name("list").alias("ls").description("List al
|
|
|
21880
21764
|
"DISPLAY NAME".padEnd(displayWidth),
|
|
21881
21765
|
"CONNECTORS"
|
|
21882
21766
|
].join(" ");
|
|
21883
|
-
console.log(
|
|
21767
|
+
console.log(chalk63.dim(header));
|
|
21884
21768
|
for (const agent of agents) {
|
|
21885
21769
|
const row = [
|
|
21886
21770
|
agent.name.padEnd(nameWidth),
|
|
@@ -21893,9 +21777,9 @@ var listCommand9 = new Command71().name("list").alias("ls").description("List al
|
|
|
21893
21777
|
);
|
|
21894
21778
|
|
|
21895
21779
|
// src/commands/zero/agent/delete.ts
|
|
21896
|
-
import { Command as
|
|
21897
|
-
import
|
|
21898
|
-
var deleteCommand2 = new
|
|
21780
|
+
import { Command as Command71 } from "commander";
|
|
21781
|
+
import chalk64 from "chalk";
|
|
21782
|
+
var deleteCommand2 = new Command71().name("delete").alias("rm").description("Delete a zero agent").argument("<name>", "Agent name").option("-y, --yes", "Skip confirmation prompt").action(
|
|
21899
21783
|
withErrorHandler(async (name, options) => {
|
|
21900
21784
|
await getZeroAgent(name);
|
|
21901
21785
|
if (!options.yes) {
|
|
@@ -21907,24 +21791,24 @@ var deleteCommand2 = new Command72().name("delete").alias("rm").description("Del
|
|
|
21907
21791
|
false
|
|
21908
21792
|
);
|
|
21909
21793
|
if (!confirmed) {
|
|
21910
|
-
console.log(
|
|
21794
|
+
console.log(chalk64.dim("Cancelled"));
|
|
21911
21795
|
return;
|
|
21912
21796
|
}
|
|
21913
21797
|
}
|
|
21914
21798
|
await deleteZeroAgent(name);
|
|
21915
|
-
console.log(
|
|
21799
|
+
console.log(chalk64.green(`\u2713 Zero agent '${name}' deleted`));
|
|
21916
21800
|
})
|
|
21917
21801
|
);
|
|
21918
21802
|
|
|
21919
21803
|
// src/commands/zero/agent/index.ts
|
|
21920
|
-
var agentCommand = new
|
|
21804
|
+
var agentCommand = new Command72("agent").description("Manage zero agents").addCommand(createCommand).addCommand(editCommand).addCommand(viewCommand).addCommand(listCommand9).addCommand(deleteCommand2);
|
|
21921
21805
|
|
|
21922
21806
|
// src/commands/zero/connector/index.ts
|
|
21923
|
-
import { Command as
|
|
21807
|
+
import { Command as Command77 } from "commander";
|
|
21924
21808
|
|
|
21925
21809
|
// src/commands/zero/connector/connect.ts
|
|
21926
|
-
import { Command as
|
|
21927
|
-
import
|
|
21810
|
+
import { Command as Command73 } from "commander";
|
|
21811
|
+
import chalk66 from "chalk";
|
|
21928
21812
|
|
|
21929
21813
|
// src/lib/computer/start-services.ts
|
|
21930
21814
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -21932,7 +21816,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
21932
21816
|
import { createServer } from "net";
|
|
21933
21817
|
import { homedir as homedir4 } from "os";
|
|
21934
21818
|
import { join as join10 } from "path";
|
|
21935
|
-
import
|
|
21819
|
+
import chalk65 from "chalk";
|
|
21936
21820
|
|
|
21937
21821
|
// src/lib/computer/ngrok.ts
|
|
21938
21822
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -22006,7 +21890,7 @@ async function checkComputerDependencies() {
|
|
|
22006
21890
|
}
|
|
22007
21891
|
}
|
|
22008
21892
|
async function startComputerServices(credentials) {
|
|
22009
|
-
console.log(
|
|
21893
|
+
console.log(chalk65.cyan("Starting computer connector services..."));
|
|
22010
21894
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
22011
21895
|
if (!wsgidavBinary) {
|
|
22012
21896
|
throw new Error(
|
|
@@ -22033,7 +21917,7 @@ async function startComputerServices(credentials) {
|
|
|
22033
21917
|
);
|
|
22034
21918
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
22035
21919
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
22036
|
-
console.log(
|
|
21920
|
+
console.log(chalk65.green("\u2713 WebDAV server started"));
|
|
22037
21921
|
const chrome = spawn2(
|
|
22038
21922
|
chromeBinary,
|
|
22039
21923
|
[
|
|
@@ -22047,7 +21931,7 @@ async function startComputerServices(credentials) {
|
|
|
22047
21931
|
);
|
|
22048
21932
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
22049
21933
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
22050
|
-
console.log(
|
|
21934
|
+
console.log(chalk65.green("\u2713 Chrome started"));
|
|
22051
21935
|
try {
|
|
22052
21936
|
await startNgrokTunnels(
|
|
22053
21937
|
credentials.ngrokToken,
|
|
@@ -22056,18 +21940,18 @@ async function startComputerServices(credentials) {
|
|
|
22056
21940
|
cdpPort
|
|
22057
21941
|
);
|
|
22058
21942
|
console.log(
|
|
22059
|
-
|
|
21943
|
+
chalk65.green(
|
|
22060
21944
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
22061
21945
|
)
|
|
22062
21946
|
);
|
|
22063
21947
|
console.log();
|
|
22064
|
-
console.log(
|
|
21948
|
+
console.log(chalk65.green("\u2713 Computer connector active"));
|
|
22065
21949
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
22066
21950
|
console.log(
|
|
22067
21951
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
22068
21952
|
);
|
|
22069
21953
|
console.log();
|
|
22070
|
-
console.log(
|
|
21954
|
+
console.log(chalk65.dim("Press ^C twice to disconnect"));
|
|
22071
21955
|
console.log();
|
|
22072
21956
|
let sigintCount = 0;
|
|
22073
21957
|
await new Promise((resolve) => {
|
|
@@ -22081,7 +21965,7 @@ async function startComputerServices(credentials) {
|
|
|
22081
21965
|
const onSigint = () => {
|
|
22082
21966
|
sigintCount++;
|
|
22083
21967
|
if (sigintCount === 1) {
|
|
22084
|
-
console.log(
|
|
21968
|
+
console.log(chalk65.dim("\nPress ^C again to disconnect and exit..."));
|
|
22085
21969
|
} else {
|
|
22086
21970
|
done();
|
|
22087
21971
|
}
|
|
@@ -22091,11 +21975,11 @@ async function startComputerServices(credentials) {
|
|
|
22091
21975
|
});
|
|
22092
21976
|
} finally {
|
|
22093
21977
|
console.log();
|
|
22094
|
-
console.log(
|
|
21978
|
+
console.log(chalk65.cyan("Stopping services..."));
|
|
22095
21979
|
wsgidav.kill("SIGTERM");
|
|
22096
21980
|
chrome.kill("SIGTERM");
|
|
22097
21981
|
await stopNgrokTunnels();
|
|
22098
|
-
console.log(
|
|
21982
|
+
console.log(chalk65.green("\u2713 Services stopped"));
|
|
22099
21983
|
}
|
|
22100
21984
|
}
|
|
22101
21985
|
|
|
@@ -22106,10 +21990,10 @@ function delay2(ms) {
|
|
|
22106
21990
|
function renderHelpText(text) {
|
|
22107
21991
|
return text.replace(
|
|
22108
21992
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
22109
|
-
(_m, label, url) => `${label} (${
|
|
22110
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
21993
|
+
(_m, label, url) => `${label} (${chalk66.cyan(url)})`
|
|
21994
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk66.bold(content)).replace(
|
|
22111
21995
|
/^> (.+)$/gm,
|
|
22112
|
-
(_m, content) =>
|
|
21996
|
+
(_m, content) => chalk66.yellow(` ${content}`)
|
|
22113
21997
|
);
|
|
22114
21998
|
}
|
|
22115
21999
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -22134,7 +22018,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
22134
22018
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
22135
22019
|
if (!secretConfig.required) continue;
|
|
22136
22020
|
const value = await promptPassword(
|
|
22137
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
22021
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk66.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
22138
22022
|
);
|
|
22139
22023
|
if (!value) {
|
|
22140
22024
|
throw new Error("Cancelled");
|
|
@@ -22150,18 +22034,18 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
22150
22034
|
});
|
|
22151
22035
|
}
|
|
22152
22036
|
console.log(
|
|
22153
|
-
|
|
22037
|
+
chalk66.green(`
|
|
22154
22038
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
22155
22039
|
);
|
|
22156
22040
|
}
|
|
22157
22041
|
async function connectComputer() {
|
|
22158
22042
|
await checkComputerDependencies();
|
|
22159
|
-
console.log(
|
|
22043
|
+
console.log(chalk66.cyan("Setting up computer connector..."));
|
|
22160
22044
|
const credentials = await createZeroComputerConnector();
|
|
22161
22045
|
await startComputerServices(credentials);
|
|
22162
|
-
console.log(
|
|
22046
|
+
console.log(chalk66.cyan("Disconnecting computer connector..."));
|
|
22163
22047
|
await deleteZeroComputerConnector();
|
|
22164
|
-
console.log(
|
|
22048
|
+
console.log(chalk66.green("\u2713 Disconnected computer"));
|
|
22165
22049
|
}
|
|
22166
22050
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
22167
22051
|
const config = CONNECTOR_TYPES[connectorType];
|
|
@@ -22199,12 +22083,12 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
22199
22083
|
);
|
|
22200
22084
|
}
|
|
22201
22085
|
async function connectViaOAuth(connectorType) {
|
|
22202
|
-
console.log(`Connecting ${
|
|
22086
|
+
console.log(`Connecting ${chalk66.cyan(connectorType)}...`);
|
|
22203
22087
|
const session = await createZeroConnectorSession(connectorType);
|
|
22204
22088
|
const apiUrl = await getBaseUrl();
|
|
22205
22089
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
22206
|
-
console.log(
|
|
22207
|
-
console.log(
|
|
22090
|
+
console.log(chalk66.green("\nSession created"));
|
|
22091
|
+
console.log(chalk66.cyan(`
|
|
22208
22092
|
To connect, visit: ${verificationUrl}`));
|
|
22209
22093
|
console.log(
|
|
22210
22094
|
`
|
|
@@ -22224,7 +22108,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
22224
22108
|
switch (status.status) {
|
|
22225
22109
|
case "complete":
|
|
22226
22110
|
console.log(
|
|
22227
|
-
|
|
22111
|
+
chalk66.green(`
|
|
22228
22112
|
|
|
22229
22113
|
${connectorType} connected successfully!`)
|
|
22230
22114
|
);
|
|
@@ -22236,13 +22120,13 @@ ${connectorType} connected successfully!`)
|
|
|
22236
22120
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
22237
22121
|
);
|
|
22238
22122
|
case "pending":
|
|
22239
|
-
process.stdout.write(
|
|
22123
|
+
process.stdout.write(chalk66.dim("."));
|
|
22240
22124
|
break;
|
|
22241
22125
|
}
|
|
22242
22126
|
}
|
|
22243
22127
|
throw new Error("Session timed out, please try again");
|
|
22244
22128
|
}
|
|
22245
|
-
var connectCommand = new
|
|
22129
|
+
var connectCommand = new Command73().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").option("--token <value>", "API token value (skip interactive prompt)").action(
|
|
22246
22130
|
withErrorHandler(async (type2, options) => {
|
|
22247
22131
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
22248
22132
|
if (!parseResult.success) {
|
|
@@ -22266,12 +22150,12 @@ var connectCommand = new Command74().name("connect").description("Connect a thir
|
|
|
22266
22150
|
);
|
|
22267
22151
|
|
|
22268
22152
|
// src/commands/zero/connector/list.ts
|
|
22269
|
-
import { Command as
|
|
22270
|
-
import
|
|
22271
|
-
var listCommand10 = new
|
|
22153
|
+
import { Command as Command74 } from "commander";
|
|
22154
|
+
import chalk67 from "chalk";
|
|
22155
|
+
var listCommand10 = new Command74().name("list").alias("ls").description("List all connectors and their status").action(
|
|
22272
22156
|
withErrorHandler(async () => {
|
|
22273
22157
|
const result = await listZeroConnectors();
|
|
22274
|
-
const connectedMap = new Map(result.connectors.map((
|
|
22158
|
+
const connectedMap = new Map(result.connectors.map((c32) => [c32.type, c32]));
|
|
22275
22159
|
const allTypesRaw = Object.keys(CONNECTOR_TYPES);
|
|
22276
22160
|
const allTypes = [];
|
|
22277
22161
|
for (const type2 of allTypesRaw) {
|
|
@@ -22290,24 +22174,24 @@ var listCommand10 = new Command75().name("list").alias("ls").description("List a
|
|
|
22290
22174
|
statusText.padEnd(statusWidth),
|
|
22291
22175
|
"ACCOUNT"
|
|
22292
22176
|
].join(" ");
|
|
22293
|
-
console.log(
|
|
22177
|
+
console.log(chalk67.dim(header));
|
|
22294
22178
|
for (const type2 of allTypes) {
|
|
22295
22179
|
const connector = connectedMap.get(type2);
|
|
22296
22180
|
const scopeMismatch = connector !== void 0 && connector.authMethod === "oauth" && !hasRequiredScopes(type2, connector.oauthScopes);
|
|
22297
|
-
const status = connector ? connector.needsReconnect ?
|
|
22298
|
-
const account = connector?.needsReconnect ?
|
|
22181
|
+
const status = connector ? connector.needsReconnect ? chalk67.yellow("!".padEnd(statusWidth)) : scopeMismatch ? chalk67.yellow("!".padEnd(statusWidth)) : chalk67.green("\u2713".padEnd(statusWidth)) : chalk67.dim("-".padEnd(statusWidth));
|
|
22182
|
+
const account = connector?.needsReconnect ? chalk67.yellow("(reconnect needed)") : scopeMismatch ? chalk67.yellow("(permissions update available)") : connector?.externalUsername ? `@${connector.externalUsername}` : chalk67.dim("-");
|
|
22299
22183
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
22300
22184
|
console.log(row);
|
|
22301
22185
|
}
|
|
22302
22186
|
console.log();
|
|
22303
|
-
console.log(
|
|
22304
|
-
console.log(
|
|
22187
|
+
console.log(chalk67.dim("To connect a service:"));
|
|
22188
|
+
console.log(chalk67.dim(" vm0 zero connector connect <type>"));
|
|
22305
22189
|
})
|
|
22306
22190
|
);
|
|
22307
22191
|
|
|
22308
22192
|
// src/commands/zero/connector/status.ts
|
|
22309
|
-
import { Command as
|
|
22310
|
-
import
|
|
22193
|
+
import { Command as Command75 } from "commander";
|
|
22194
|
+
import chalk68 from "chalk";
|
|
22311
22195
|
|
|
22312
22196
|
// src/lib/domain/schedule-utils.ts
|
|
22313
22197
|
function formatRelativeTime2(dateStr) {
|
|
@@ -22355,7 +22239,7 @@ function generateCronExpression(frequency, time, day) {
|
|
|
22355
22239
|
return `${minute} ${hour} ${day ?? 1} * *`;
|
|
22356
22240
|
}
|
|
22357
22241
|
}
|
|
22358
|
-
function
|
|
22242
|
+
function detectTimezone() {
|
|
22359
22243
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
22360
22244
|
}
|
|
22361
22245
|
function validateTimeFormat(time) {
|
|
@@ -22424,7 +22308,7 @@ function toISODateTime(dateTimeStr) {
|
|
|
22424
22308
|
|
|
22425
22309
|
// src/commands/zero/connector/status.ts
|
|
22426
22310
|
var LABEL_WIDTH = 16;
|
|
22427
|
-
var statusCommand6 = new
|
|
22311
|
+
var statusCommand6 = new Command75().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
22428
22312
|
withErrorHandler(async (type2) => {
|
|
22429
22313
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
22430
22314
|
if (!parseResult.success) {
|
|
@@ -22434,11 +22318,11 @@ var statusCommand6 = new Command76().name("status").description("Show detailed s
|
|
|
22434
22318
|
});
|
|
22435
22319
|
}
|
|
22436
22320
|
const connector = await getZeroConnector(parseResult.data);
|
|
22437
|
-
console.log(`Connector: ${
|
|
22321
|
+
console.log(`Connector: ${chalk68.cyan(type2)}`);
|
|
22438
22322
|
console.log();
|
|
22439
22323
|
if (connector) {
|
|
22440
22324
|
console.log(
|
|
22441
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
22325
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk68.green("connected")}`
|
|
22442
22326
|
);
|
|
22443
22327
|
console.log(
|
|
22444
22328
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -22454,7 +22338,7 @@ var statusCommand6 = new Command76().name("status").description("Show detailed s
|
|
|
22454
22338
|
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
22455
22339
|
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
22456
22340
|
console.log(
|
|
22457
|
-
`${"Permissions:".padEnd(LABEL_WIDTH)}${
|
|
22341
|
+
`${"Permissions:".padEnd(LABEL_WIDTH)}${chalk68.yellow("update available")}`
|
|
22458
22342
|
);
|
|
22459
22343
|
if (diff.addedScopes.length > 0) {
|
|
22460
22344
|
console.log(
|
|
@@ -22476,23 +22360,23 @@ var statusCommand6 = new Command76().name("status").description("Show detailed s
|
|
|
22476
22360
|
);
|
|
22477
22361
|
}
|
|
22478
22362
|
console.log();
|
|
22479
|
-
console.log(
|
|
22480
|
-
console.log(
|
|
22363
|
+
console.log(chalk68.dim("To disconnect:"));
|
|
22364
|
+
console.log(chalk68.dim(` vm0 zero connector disconnect ${type2}`));
|
|
22481
22365
|
} else {
|
|
22482
22366
|
console.log(
|
|
22483
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
22367
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk68.dim("not connected")}`
|
|
22484
22368
|
);
|
|
22485
22369
|
console.log();
|
|
22486
|
-
console.log(
|
|
22487
|
-
console.log(
|
|
22370
|
+
console.log(chalk68.dim("To connect:"));
|
|
22371
|
+
console.log(chalk68.dim(` vm0 zero connector connect ${type2}`));
|
|
22488
22372
|
}
|
|
22489
22373
|
})
|
|
22490
22374
|
);
|
|
22491
22375
|
|
|
22492
22376
|
// src/commands/zero/connector/disconnect.ts
|
|
22493
|
-
import { Command as
|
|
22494
|
-
import
|
|
22495
|
-
var disconnectCommand = new
|
|
22377
|
+
import { Command as Command76 } from "commander";
|
|
22378
|
+
import chalk69 from "chalk";
|
|
22379
|
+
var disconnectCommand = new Command76().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
22496
22380
|
withErrorHandler(async (type2) => {
|
|
22497
22381
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
22498
22382
|
if (!parseResult.success) {
|
|
@@ -22503,12 +22387,145 @@ var disconnectCommand = new Command77().name("disconnect").description("Disconne
|
|
|
22503
22387
|
}
|
|
22504
22388
|
const connectorType = parseResult.data;
|
|
22505
22389
|
await deleteZeroConnector(connectorType);
|
|
22506
|
-
console.log(
|
|
22390
|
+
console.log(chalk69.green(`\u2713 Disconnected ${type2}`));
|
|
22507
22391
|
})
|
|
22508
22392
|
);
|
|
22509
22393
|
|
|
22510
22394
|
// src/commands/zero/connector/index.ts
|
|
22511
|
-
var zeroConnectorCommand = new
|
|
22395
|
+
var zeroConnectorCommand = new Command77().name("connector").description("Manage third-party service connections (zero)").addCommand(listCommand10).addCommand(statusCommand6).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
22396
|
+
|
|
22397
|
+
// src/commands/zero/preference/index.ts
|
|
22398
|
+
import { Command as Command78 } from "commander";
|
|
22399
|
+
import chalk70 from "chalk";
|
|
22400
|
+
function detectTimezone2() {
|
|
22401
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
22402
|
+
}
|
|
22403
|
+
function isValidTimezone(timezone) {
|
|
22404
|
+
try {
|
|
22405
|
+
Intl.DateTimeFormat(void 0, { timeZone: timezone });
|
|
22406
|
+
return true;
|
|
22407
|
+
} catch {
|
|
22408
|
+
return false;
|
|
22409
|
+
}
|
|
22410
|
+
}
|
|
22411
|
+
function parseOnOff(flag, value) {
|
|
22412
|
+
const lower = value.toLowerCase();
|
|
22413
|
+
if (lower === "on" || lower === "true" || lower === "1") return true;
|
|
22414
|
+
if (lower === "off" || lower === "false" || lower === "0") return false;
|
|
22415
|
+
throw new Error(
|
|
22416
|
+
`Invalid value for --${flag}: "${value}". Use "on" or "off".`
|
|
22417
|
+
);
|
|
22418
|
+
}
|
|
22419
|
+
function displayPreferences(prefs) {
|
|
22420
|
+
console.log(chalk70.bold("Current preferences:"));
|
|
22421
|
+
console.log(
|
|
22422
|
+
` Timezone: ${prefs.timezone ? chalk70.cyan(prefs.timezone) : chalk70.dim("not set")}`
|
|
22423
|
+
);
|
|
22424
|
+
console.log(
|
|
22425
|
+
` Email notify: ${prefs.notifyEmail ? chalk70.green("on") : chalk70.dim("off")}`
|
|
22426
|
+
);
|
|
22427
|
+
console.log(
|
|
22428
|
+
` Slack notify: ${prefs.notifySlack ? chalk70.green("on") : chalk70.dim("off")}`
|
|
22429
|
+
);
|
|
22430
|
+
}
|
|
22431
|
+
function buildUpdates(opts) {
|
|
22432
|
+
const hasTimezone = opts.timezone !== void 0;
|
|
22433
|
+
const hasNotifyEmail = opts.notifyEmail !== void 0;
|
|
22434
|
+
const hasNotifySlack = opts.notifySlack !== void 0;
|
|
22435
|
+
if (!hasTimezone && !hasNotifyEmail && !hasNotifySlack) return null;
|
|
22436
|
+
const updates = {};
|
|
22437
|
+
if (hasTimezone) {
|
|
22438
|
+
if (!isValidTimezone(opts.timezone)) {
|
|
22439
|
+
throw new Error(`Invalid timezone: ${opts.timezone}`, {
|
|
22440
|
+
cause: new Error(
|
|
22441
|
+
"Use an IANA timezone identifier (e.g., America/New_York, Asia/Shanghai)"
|
|
22442
|
+
)
|
|
22443
|
+
});
|
|
22444
|
+
}
|
|
22445
|
+
updates.timezone = opts.timezone;
|
|
22446
|
+
}
|
|
22447
|
+
if (hasNotifyEmail) {
|
|
22448
|
+
updates.notifyEmail = parseOnOff("notify-email", opts.notifyEmail);
|
|
22449
|
+
}
|
|
22450
|
+
if (hasNotifySlack) {
|
|
22451
|
+
updates.notifySlack = parseOnOff("notify-slack", opts.notifySlack);
|
|
22452
|
+
}
|
|
22453
|
+
return updates;
|
|
22454
|
+
}
|
|
22455
|
+
function printUpdateResult(updates, result) {
|
|
22456
|
+
if (updates.timezone !== void 0) {
|
|
22457
|
+
console.log(
|
|
22458
|
+
chalk70.green(
|
|
22459
|
+
`Timezone set to ${chalk70.cyan(result.timezone ?? updates.timezone)}`
|
|
22460
|
+
)
|
|
22461
|
+
);
|
|
22462
|
+
}
|
|
22463
|
+
if (updates.notifyEmail !== void 0) {
|
|
22464
|
+
console.log(
|
|
22465
|
+
chalk70.green(
|
|
22466
|
+
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
22467
|
+
)
|
|
22468
|
+
);
|
|
22469
|
+
}
|
|
22470
|
+
if (updates.notifySlack !== void 0) {
|
|
22471
|
+
console.log(
|
|
22472
|
+
chalk70.green(
|
|
22473
|
+
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
22474
|
+
)
|
|
22475
|
+
);
|
|
22476
|
+
}
|
|
22477
|
+
}
|
|
22478
|
+
async function interactiveSetup(prefs) {
|
|
22479
|
+
if (!prefs.timezone) {
|
|
22480
|
+
const detectedTz = detectTimezone2();
|
|
22481
|
+
console.log(chalk70.dim(`
|
|
22482
|
+
System timezone detected: ${detectedTz}`));
|
|
22483
|
+
const tz = await promptText(
|
|
22484
|
+
"Set timezone? (enter timezone or leave empty to skip)",
|
|
22485
|
+
detectedTz
|
|
22486
|
+
);
|
|
22487
|
+
if (tz?.trim()) {
|
|
22488
|
+
if (!isValidTimezone(tz.trim())) {
|
|
22489
|
+
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
22490
|
+
}
|
|
22491
|
+
await updateZeroUserPreferences({ timezone: tz.trim() });
|
|
22492
|
+
console.log(chalk70.green(`Timezone set to ${chalk70.cyan(tz.trim())}`));
|
|
22493
|
+
}
|
|
22494
|
+
}
|
|
22495
|
+
if (!prefs.notifyEmail) {
|
|
22496
|
+
const enable = await promptConfirm(
|
|
22497
|
+
"\nEnable email notifications for scheduled runs?",
|
|
22498
|
+
false
|
|
22499
|
+
);
|
|
22500
|
+
if (enable) {
|
|
22501
|
+
await updateZeroUserPreferences({ notifyEmail: true });
|
|
22502
|
+
console.log(chalk70.green("Email notifications enabled"));
|
|
22503
|
+
}
|
|
22504
|
+
}
|
|
22505
|
+
}
|
|
22506
|
+
var zeroPreferenceCommand = new Command78().name("preference").description("View or update your preferences").option("--timezone <timezone>", "IANA timezone (e.g., America/New_York)").option("--notify-email <on|off>", "Enable or disable email notifications").option("--notify-slack <on|off>", "Enable or disable Slack notifications").action(
|
|
22507
|
+
withErrorHandler(async (opts) => {
|
|
22508
|
+
const updates = buildUpdates(opts);
|
|
22509
|
+
if (updates) {
|
|
22510
|
+
const result = await updateZeroUserPreferences(updates);
|
|
22511
|
+
printUpdateResult(updates, result);
|
|
22512
|
+
return;
|
|
22513
|
+
}
|
|
22514
|
+
const prefs = await getZeroUserPreferences();
|
|
22515
|
+
displayPreferences(prefs);
|
|
22516
|
+
if (isInteractive()) {
|
|
22517
|
+
await interactiveSetup(prefs);
|
|
22518
|
+
} else if (!prefs.timezone) {
|
|
22519
|
+
console.log();
|
|
22520
|
+
console.log(
|
|
22521
|
+
`To set timezone: ${chalk70.cyan("vm0 zero preference --timezone <timezone>")}`
|
|
22522
|
+
);
|
|
22523
|
+
console.log(
|
|
22524
|
+
chalk70.dim("Example: vm0 zero preference --timezone America/New_York")
|
|
22525
|
+
);
|
|
22526
|
+
}
|
|
22527
|
+
})
|
|
22528
|
+
);
|
|
22512
22529
|
|
|
22513
22530
|
// src/commands/zero/schedule/index.ts
|
|
22514
22531
|
import { Command as Command85 } from "commander";
|
|
@@ -22621,7 +22638,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
22621
22638
|
if (!isInteractive()) {
|
|
22622
22639
|
throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
|
|
22623
22640
|
}
|
|
22624
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
22641
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c32) => c32.value === existingFrequency) : 0;
|
|
22625
22642
|
frequency = await promptSelect(
|
|
22626
22643
|
"Schedule frequency",
|
|
22627
22644
|
FREQUENCY_CHOICES,
|
|
@@ -22646,7 +22663,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
22646
22663
|
throw new Error("--day is required for weekly/monthly");
|
|
22647
22664
|
}
|
|
22648
22665
|
if (frequency === "weekly") {
|
|
22649
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
22666
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c32) => c32.value === existingDay) : 0;
|
|
22650
22667
|
const day2 = await promptSelect(
|
|
22651
22668
|
"Day of week",
|
|
22652
22669
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -22721,14 +22738,14 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
22721
22738
|
if (optionTimezone) return optionTimezone;
|
|
22722
22739
|
let userTimezone = null;
|
|
22723
22740
|
try {
|
|
22724
|
-
const prefs = await
|
|
22741
|
+
const prefs = await getZeroUserPreferences();
|
|
22725
22742
|
userTimezone = prefs.timezone;
|
|
22726
22743
|
} catch {
|
|
22727
22744
|
console.log(
|
|
22728
22745
|
chalk71.dim("Could not fetch timezone preference, using detected timezone")
|
|
22729
22746
|
);
|
|
22730
22747
|
}
|
|
22731
|
-
const defaultTimezone = userTimezone ||
|
|
22748
|
+
const defaultTimezone = userTimezone || detectTimezone();
|
|
22732
22749
|
if (!isInteractive()) {
|
|
22733
22750
|
return defaultTimezone;
|
|
22734
22751
|
}
|
|
@@ -23128,7 +23145,7 @@ function printRunConfiguration(schedule) {
|
|
|
23128
23145
|
function printTimeSchedule(schedule) {
|
|
23129
23146
|
console.log();
|
|
23130
23147
|
console.log(`${"Trigger:".padEnd(16)}${formatTrigger(schedule)}`);
|
|
23131
|
-
console.log(`${"Timezone:".padEnd(16)}${
|
|
23148
|
+
console.log(`${"Timezone:".padEnd(16)}${detectTimezone()}`);
|
|
23132
23149
|
if (schedule.enabled) {
|
|
23133
23150
|
console.log(
|
|
23134
23151
|
`${"Next Run:".padEnd(16)}${formatDateTimeStyled(schedule.nextRunAt)}`
|
|
@@ -23476,11 +23493,11 @@ var deleteCommand5 = new Command92().name("delete").description("Delete a variab
|
|
|
23476
23493
|
var zeroVariableCommand = new Command93().name("variable").description("Manage variables").addCommand(listCommand13).addCommand(setCommand5).addCommand(deleteCommand5);
|
|
23477
23494
|
|
|
23478
23495
|
// src/commands/zero/index.ts
|
|
23479
|
-
var zeroCommand = new Command94("zero").description("Zero platform commands").addCommand(zeroOrgCommand).addCommand(agentCommand).addCommand(zeroConnectorCommand).addCommand(zeroScheduleCommand).addCommand(zeroSecretCommand).addCommand(zeroVariableCommand);
|
|
23496
|
+
var zeroCommand = new Command94("zero").description("Zero platform commands").addCommand(zeroOrgCommand).addCommand(agentCommand).addCommand(zeroConnectorCommand).addCommand(zeroPreferenceCommand).addCommand(zeroScheduleCommand).addCommand(zeroSecretCommand).addCommand(zeroVariableCommand);
|
|
23480
23497
|
|
|
23481
23498
|
// src/index.ts
|
|
23482
23499
|
var program = new Command95();
|
|
23483
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.78.
|
|
23500
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.78.2");
|
|
23484
23501
|
program.addCommand(authCommand);
|
|
23485
23502
|
program.addCommand(infoCommand);
|
|
23486
23503
|
program.addCommand(composeCommand);
|
|
@@ -23491,7 +23508,6 @@ program.addCommand(memoryCommand);
|
|
|
23491
23508
|
program.addCommand(cookCommand);
|
|
23492
23509
|
program.addCommand(logsCommand2);
|
|
23493
23510
|
program.addCommand(initCommand4);
|
|
23494
|
-
program.addCommand(preferenceCommand);
|
|
23495
23511
|
program.addCommand(upgradeCommand);
|
|
23496
23512
|
program.addCommand(whoamiCommand);
|
|
23497
23513
|
program.addCommand(zeroCommand);
|