@vm0/cli 9.57.0 → 9.58.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 +269 -93
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ if (DSN) {
|
|
|
45
45
|
Sentry.init({
|
|
46
46
|
dsn: DSN,
|
|
47
47
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
48
|
-
release: "9.
|
|
48
|
+
release: "9.58.0",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.
|
|
67
|
+
version: "9.58.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -198,6 +198,13 @@ async function getApiUrl() {
|
|
|
198
198
|
}
|
|
199
199
|
return config.apiUrl ?? "https://www.vm0.ai";
|
|
200
200
|
}
|
|
201
|
+
async function getActiveOrg() {
|
|
202
|
+
if (process.env.VM0_ACTIVE_ORG) {
|
|
203
|
+
return process.env.VM0_ACTIVE_ORG;
|
|
204
|
+
}
|
|
205
|
+
const config = await loadConfig();
|
|
206
|
+
return config.activeOrg;
|
|
207
|
+
}
|
|
201
208
|
async function clearConfig() {
|
|
202
209
|
const configFile = getConfigFile();
|
|
203
210
|
if (existsSync(configFile)) {
|
|
@@ -271,7 +278,8 @@ The code expires in ${Math.floor(deviceAuth.expires_in / 60)} minutes.`
|
|
|
271
278
|
if (tokenResult.access_token) {
|
|
272
279
|
await saveConfig({
|
|
273
280
|
token: tokenResult.access_token,
|
|
274
|
-
apiUrl: targetApiUrl
|
|
281
|
+
apiUrl: targetApiUrl,
|
|
282
|
+
...tokenResult.org_slug && { activeOrg: tokenResult.org_slug }
|
|
275
283
|
});
|
|
276
284
|
console.log(chalk.green("\nAuthentication successful!"));
|
|
277
285
|
console.log("Your credentials have been saved");
|
|
@@ -371,8 +379,7 @@ async function getBaseUrl() {
|
|
|
371
379
|
async function getClientConfig() {
|
|
372
380
|
const baseUrl = await getBaseUrl();
|
|
373
381
|
const baseHeaders = await getHeaders();
|
|
374
|
-
const
|
|
375
|
-
const activeOrg = config.activeOrg;
|
|
382
|
+
const activeOrg = await getActiveOrg();
|
|
376
383
|
if (activeOrg) {
|
|
377
384
|
return {
|
|
378
385
|
baseUrl,
|
|
@@ -666,7 +673,7 @@ function getConfigPath() {
|
|
|
666
673
|
return join2(homedir2(), ".vm0", "config.json");
|
|
667
674
|
}
|
|
668
675
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
669
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.58.0"}`));
|
|
670
677
|
console.log();
|
|
671
678
|
const config = await loadConfig();
|
|
672
679
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1005,6 +1012,7 @@ var agentDefinitionSchema = z4.object({
|
|
|
1005
1012
|
*/
|
|
1006
1013
|
metadata: z4.object({
|
|
1007
1014
|
displayName: z4.string().optional(),
|
|
1015
|
+
description: z4.string().optional(),
|
|
1008
1016
|
sound: z4.string().optional()
|
|
1009
1017
|
}).optional(),
|
|
1010
1018
|
/**
|
|
@@ -1177,6 +1185,7 @@ var composeListItemSchema = z4.object({
|
|
|
1177
1185
|
id: z4.string(),
|
|
1178
1186
|
name: z4.string(),
|
|
1179
1187
|
displayName: z4.string().nullable().optional(),
|
|
1188
|
+
description: z4.string().nullable().optional(),
|
|
1180
1189
|
headVersionId: z4.string().nullable(),
|
|
1181
1190
|
updatedAt: z4.string(),
|
|
1182
1191
|
isOwner: z4.boolean()
|
|
@@ -2207,7 +2216,8 @@ var cliAuthTokenContract = c6.router({
|
|
|
2207
2216
|
200: z8.object({
|
|
2208
2217
|
access_token: z8.string(),
|
|
2209
2218
|
token_type: z8.literal("Bearer"),
|
|
2210
|
-
expires_in: z8.number()
|
|
2219
|
+
expires_in: z8.number(),
|
|
2220
|
+
org_slug: z8.string().optional()
|
|
2211
2221
|
}),
|
|
2212
2222
|
// Authorization pending
|
|
2213
2223
|
202: oauthErrorSchema,
|
|
@@ -3509,6 +3519,7 @@ var platformLogsByIdContract = c16.router({
|
|
|
3509
3519
|
getById: {
|
|
3510
3520
|
method: "GET",
|
|
3511
3521
|
path: "/api/platform/logs/:id",
|
|
3522
|
+
headers: authHeadersSchema,
|
|
3512
3523
|
pathParams: z18.object({
|
|
3513
3524
|
id: z18.string().uuid("Invalid log ID")
|
|
3514
3525
|
}),
|
|
@@ -6437,12 +6448,11 @@ var computerConnectorContract = c18.router({
|
|
|
6437
6448
|
function bearerAuth(secretName) {
|
|
6438
6449
|
return { headers: { Authorization: `Bearer \${secrets.${secretName}}` } };
|
|
6439
6450
|
}
|
|
6440
|
-
|
|
6441
|
-
name: "
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
return { base, auth, permissions: [FULL_ACCESS_PERMISSION] };
|
|
6451
|
+
function fullAccess(name = "full-access") {
|
|
6452
|
+
return { name, rules: ["ANY /{path+}"] };
|
|
6453
|
+
}
|
|
6454
|
+
function api(base, auth, permissionName = "full-access") {
|
|
6455
|
+
return { base, auth, permissions: [fullAccess(permissionName)] };
|
|
6446
6456
|
}
|
|
6447
6457
|
var SERVICE_CONFIGS = {
|
|
6448
6458
|
ahrefs: {
|
|
@@ -6645,8 +6655,16 @@ var SERVICE_CONFIGS = {
|
|
|
6645
6655
|
},
|
|
6646
6656
|
slack: {
|
|
6647
6657
|
apis: [
|
|
6648
|
-
api(
|
|
6649
|
-
|
|
6658
|
+
api(
|
|
6659
|
+
"https://slack.com/api",
|
|
6660
|
+
bearerAuth("SLACK_TOKEN"),
|
|
6661
|
+
"api-full-access"
|
|
6662
|
+
),
|
|
6663
|
+
api(
|
|
6664
|
+
"https://files.slack.com",
|
|
6665
|
+
bearerAuth("SLACK_TOKEN"),
|
|
6666
|
+
"files-full-access"
|
|
6667
|
+
)
|
|
6650
6668
|
],
|
|
6651
6669
|
placeholders: {
|
|
6652
6670
|
SLACK_TOKEN: "xoxb-0000-0000-vm0placeholder"
|
|
@@ -6654,14 +6672,30 @@ var SERVICE_CONFIGS = {
|
|
|
6654
6672
|
},
|
|
6655
6673
|
docusign: {
|
|
6656
6674
|
apis: [
|
|
6657
|
-
api(
|
|
6658
|
-
|
|
6675
|
+
api(
|
|
6676
|
+
"https://demo.docusign.net/restapi",
|
|
6677
|
+
bearerAuth("DOCUSIGN_TOKEN"),
|
|
6678
|
+
"demo-full-access"
|
|
6679
|
+
),
|
|
6680
|
+
api(
|
|
6681
|
+
"https://na1.docusign.net/restapi",
|
|
6682
|
+
bearerAuth("DOCUSIGN_TOKEN"),
|
|
6683
|
+
"na1-full-access"
|
|
6684
|
+
)
|
|
6659
6685
|
]
|
|
6660
6686
|
},
|
|
6661
6687
|
dropbox: {
|
|
6662
6688
|
apis: [
|
|
6663
|
-
api(
|
|
6664
|
-
|
|
6689
|
+
api(
|
|
6690
|
+
"https://api.dropboxapi.com/2",
|
|
6691
|
+
bearerAuth("DROPBOX_TOKEN"),
|
|
6692
|
+
"api-full-access"
|
|
6693
|
+
),
|
|
6694
|
+
api(
|
|
6695
|
+
"https://content.dropboxapi.com/2",
|
|
6696
|
+
bearerAuth("DROPBOX_TOKEN"),
|
|
6697
|
+
"content-full-access"
|
|
6698
|
+
)
|
|
6665
6699
|
]
|
|
6666
6700
|
},
|
|
6667
6701
|
linear: {
|
|
@@ -6669,9 +6703,21 @@ var SERVICE_CONFIGS = {
|
|
|
6669
6703
|
},
|
|
6670
6704
|
intercom: {
|
|
6671
6705
|
apis: [
|
|
6672
|
-
api(
|
|
6673
|
-
|
|
6674
|
-
|
|
6706
|
+
api(
|
|
6707
|
+
"https://api.intercom.io",
|
|
6708
|
+
bearerAuth("INTERCOM_TOKEN"),
|
|
6709
|
+
"us-full-access"
|
|
6710
|
+
),
|
|
6711
|
+
api(
|
|
6712
|
+
"https://api.eu.intercom.io",
|
|
6713
|
+
bearerAuth("INTERCOM_TOKEN"),
|
|
6714
|
+
"eu-full-access"
|
|
6715
|
+
),
|
|
6716
|
+
api(
|
|
6717
|
+
"https://api.au.intercom.io",
|
|
6718
|
+
bearerAuth("INTERCOM_TOKEN"),
|
|
6719
|
+
"au-full-access"
|
|
6720
|
+
)
|
|
6675
6721
|
]
|
|
6676
6722
|
},
|
|
6677
6723
|
jam: {
|
|
@@ -6679,16 +6725,24 @@ var SERVICE_CONFIGS = {
|
|
|
6679
6725
|
},
|
|
6680
6726
|
jotform: {
|
|
6681
6727
|
apis: [
|
|
6682
|
-
api(
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6728
|
+
api(
|
|
6729
|
+
"https://api.jotform.com",
|
|
6730
|
+
{
|
|
6731
|
+
headers: {
|
|
6732
|
+
APIKEY: "${secrets.JOTFORM_TOKEN}"
|
|
6733
|
+
}
|
|
6734
|
+
},
|
|
6735
|
+
"us-full-access"
|
|
6736
|
+
),
|
|
6737
|
+
api(
|
|
6738
|
+
"https://eu-api.jotform.com",
|
|
6739
|
+
{
|
|
6740
|
+
headers: {
|
|
6741
|
+
APIKEY: "${secrets.JOTFORM_TOKEN}"
|
|
6742
|
+
}
|
|
6743
|
+
},
|
|
6744
|
+
"eu-full-access"
|
|
6745
|
+
)
|
|
6692
6746
|
]
|
|
6693
6747
|
},
|
|
6694
6748
|
line: {
|
|
@@ -6696,26 +6750,42 @@ var SERVICE_CONFIGS = {
|
|
|
6696
6750
|
},
|
|
6697
6751
|
make: {
|
|
6698
6752
|
apis: [
|
|
6699
|
-
api(
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6753
|
+
api(
|
|
6754
|
+
"https://eu1.make.com/api/v2",
|
|
6755
|
+
{
|
|
6756
|
+
headers: {
|
|
6757
|
+
Authorization: "Token ${secrets.MAKE_TOKEN}"
|
|
6758
|
+
}
|
|
6759
|
+
},
|
|
6760
|
+
"eu1-full-access"
|
|
6761
|
+
),
|
|
6762
|
+
api(
|
|
6763
|
+
"https://eu2.make.com/api/v2",
|
|
6764
|
+
{
|
|
6765
|
+
headers: {
|
|
6766
|
+
Authorization: "Token ${secrets.MAKE_TOKEN}"
|
|
6767
|
+
}
|
|
6768
|
+
},
|
|
6769
|
+
"eu2-full-access"
|
|
6770
|
+
),
|
|
6771
|
+
api(
|
|
6772
|
+
"https://us1.make.com/api/v2",
|
|
6773
|
+
{
|
|
6774
|
+
headers: {
|
|
6775
|
+
Authorization: "Token ${secrets.MAKE_TOKEN}"
|
|
6776
|
+
}
|
|
6777
|
+
},
|
|
6778
|
+
"us1-full-access"
|
|
6779
|
+
),
|
|
6780
|
+
api(
|
|
6781
|
+
"https://us2.make.com/api/v2",
|
|
6782
|
+
{
|
|
6783
|
+
headers: {
|
|
6784
|
+
Authorization: "Token ${secrets.MAKE_TOKEN}"
|
|
6785
|
+
}
|
|
6786
|
+
},
|
|
6787
|
+
"us2-full-access"
|
|
6788
|
+
)
|
|
6719
6789
|
]
|
|
6720
6790
|
},
|
|
6721
6791
|
metabase: {
|
|
@@ -6800,8 +6870,16 @@ var SERVICE_CONFIGS = {
|
|
|
6800
6870
|
},
|
|
6801
6871
|
posthog: {
|
|
6802
6872
|
apis: [
|
|
6803
|
-
api(
|
|
6804
|
-
|
|
6873
|
+
api(
|
|
6874
|
+
"https://us.posthog.com/api",
|
|
6875
|
+
bearerAuth("POSTHOG_ACCESS_TOKEN"),
|
|
6876
|
+
"us-full-access"
|
|
6877
|
+
),
|
|
6878
|
+
api(
|
|
6879
|
+
"https://app.posthog.com/api",
|
|
6880
|
+
bearerAuth("POSTHOG_ACCESS_TOKEN"),
|
|
6881
|
+
"cloud-full-access"
|
|
6882
|
+
)
|
|
6805
6883
|
]
|
|
6806
6884
|
},
|
|
6807
6885
|
stripe: {
|
|
@@ -6829,29 +6907,14 @@ var SERVICE_CONFIGS = {
|
|
|
6829
6907
|
apis: [api("https://plausible.io/api", bearerAuth("PLAUSIBLE_TOKEN"))]
|
|
6830
6908
|
},
|
|
6831
6909
|
mailchimp: {
|
|
6832
|
-
apis:
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
api("https://us8.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6841
|
-
api("https://us9.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6842
|
-
api("https://us10.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6843
|
-
api("https://us11.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6844
|
-
api("https://us12.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6845
|
-
api("https://us13.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6846
|
-
api("https://us14.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6847
|
-
api("https://us15.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6848
|
-
api("https://us16.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6849
|
-
api("https://us17.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6850
|
-
api("https://us18.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6851
|
-
api("https://us19.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6852
|
-
api("https://us20.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN")),
|
|
6853
|
-
api("https://us21.api.mailchimp.com/3.0", bearerAuth("MAILCHIMP_TOKEN"))
|
|
6854
|
-
]
|
|
6910
|
+
apis: Array.from(
|
|
6911
|
+
{ length: 21 },
|
|
6912
|
+
(_, i) => api(
|
|
6913
|
+
`https://us${i + 1}.api.mailchimp.com/3.0`,
|
|
6914
|
+
bearerAuth("MAILCHIMP_TOKEN"),
|
|
6915
|
+
`us${i + 1}-full-access`
|
|
6916
|
+
)
|
|
6917
|
+
)
|
|
6855
6918
|
},
|
|
6856
6919
|
chatwoot: {
|
|
6857
6920
|
apis: [api("https://app.chatwoot.com", bearerAuth("CHATWOOT_TOKEN"))]
|
|
@@ -7012,14 +7075,16 @@ var c19 = initContract();
|
|
|
7012
7075
|
var userPreferencesResponseSchema = z21.object({
|
|
7013
7076
|
timezone: z21.string().nullable(),
|
|
7014
7077
|
notifyEmail: z21.boolean(),
|
|
7015
|
-
notifySlack: z21.boolean()
|
|
7078
|
+
notifySlack: z21.boolean(),
|
|
7079
|
+
pinnedAgentIds: z21.array(z21.string())
|
|
7016
7080
|
});
|
|
7017
7081
|
var updateUserPreferencesRequestSchema = z21.object({
|
|
7018
7082
|
timezone: z21.string().min(1).optional(),
|
|
7019
7083
|
notifyEmail: z21.boolean().optional(),
|
|
7020
|
-
notifySlack: z21.boolean().optional()
|
|
7084
|
+
notifySlack: z21.boolean().optional(),
|
|
7085
|
+
pinnedAgentIds: z21.array(z21.string()).max(4).optional()
|
|
7021
7086
|
}).refine(
|
|
7022
|
-
(data) => data.timezone !== void 0 || data.notifyEmail !== void 0 || data.notifySlack !== void 0,
|
|
7087
|
+
(data) => data.timezone !== void 0 || data.notifyEmail !== void 0 || data.notifySlack !== void 0 || data.pinnedAgentIds !== void 0,
|
|
7023
7088
|
{
|
|
7024
7089
|
message: "At least one preference must be provided"
|
|
7025
7090
|
}
|
|
@@ -7199,6 +7264,7 @@ var onboardingStatusResponseSchema = z24.object({
|
|
|
7199
7264
|
defaultAgentComposeId: z24.string().nullable(),
|
|
7200
7265
|
defaultAgentMetadata: z24.object({
|
|
7201
7266
|
displayName: z24.string().optional(),
|
|
7267
|
+
description: z24.string().optional(),
|
|
7202
7268
|
sound: z24.string().optional()
|
|
7203
7269
|
}).nullable()
|
|
7204
7270
|
});
|
|
@@ -7659,6 +7725,9 @@ function buildProfileParagraph(metadata) {
|
|
|
7659
7725
|
if (metadata.displayName) {
|
|
7660
7726
|
parts.push(`Your name is ${metadata.displayName}.`);
|
|
7661
7727
|
}
|
|
7728
|
+
if (metadata.description) {
|
|
7729
|
+
parts.push(metadata.description);
|
|
7730
|
+
}
|
|
7662
7731
|
if (metadata.sound) {
|
|
7663
7732
|
const desc = TONE_DESCRIPTIONS[metadata.sound] ?? metadata.sound;
|
|
7664
7733
|
parts.push(
|
|
@@ -7696,8 +7765,7 @@ ${block}
|
|
|
7696
7765
|
|
|
7697
7766
|
// src/lib/api/core/http.ts
|
|
7698
7767
|
async function appendOrgParam(path18) {
|
|
7699
|
-
const
|
|
7700
|
-
const activeOrg = config.activeOrg;
|
|
7768
|
+
const activeOrg = await getActiveOrg();
|
|
7701
7769
|
if (!activeOrg) {
|
|
7702
7770
|
return path18;
|
|
7703
7771
|
}
|
|
@@ -9419,15 +9487,123 @@ function resolveServiceConfig(ref) {
|
|
|
9419
9487
|
}
|
|
9420
9488
|
return serviceConfig;
|
|
9421
9489
|
}
|
|
9490
|
+
var VALID_RULE_METHODS = /* @__PURE__ */ new Set([
|
|
9491
|
+
"GET",
|
|
9492
|
+
"POST",
|
|
9493
|
+
"PUT",
|
|
9494
|
+
"PATCH",
|
|
9495
|
+
"DELETE",
|
|
9496
|
+
"HEAD",
|
|
9497
|
+
"OPTIONS",
|
|
9498
|
+
"ANY"
|
|
9499
|
+
]);
|
|
9500
|
+
function validateRule(rule, permName, serviceName) {
|
|
9501
|
+
const parts = rule.split(" ", 2);
|
|
9502
|
+
if (parts.length !== 2 || !parts[1]) {
|
|
9503
|
+
throw new Error(
|
|
9504
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": must be "METHOD /path"`
|
|
9505
|
+
);
|
|
9506
|
+
}
|
|
9507
|
+
const [method, path18] = parts;
|
|
9508
|
+
if (!VALID_RULE_METHODS.has(method)) {
|
|
9509
|
+
throw new Error(
|
|
9510
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": unknown method "${method}" (must be uppercase)`
|
|
9511
|
+
);
|
|
9512
|
+
}
|
|
9513
|
+
if (!path18.startsWith("/")) {
|
|
9514
|
+
throw new Error(
|
|
9515
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": path must start with "/"`
|
|
9516
|
+
);
|
|
9517
|
+
}
|
|
9518
|
+
if (path18.includes("?") || path18.includes("#")) {
|
|
9519
|
+
throw new Error(
|
|
9520
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": path must not contain query string or fragment`
|
|
9521
|
+
);
|
|
9522
|
+
}
|
|
9523
|
+
const segments = path18.split("/").filter(Boolean);
|
|
9524
|
+
const paramNames = /* @__PURE__ */ new Set();
|
|
9525
|
+
for (let i = 0; i < segments.length; i++) {
|
|
9526
|
+
const seg = segments[i];
|
|
9527
|
+
if (seg.startsWith("{") && seg.endsWith("}")) {
|
|
9528
|
+
const name = seg.slice(1, -1);
|
|
9529
|
+
const baseName = name.endsWith("+") ? name.slice(0, -1) : name;
|
|
9530
|
+
if (!baseName) {
|
|
9531
|
+
throw new Error(
|
|
9532
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": empty parameter name`
|
|
9533
|
+
);
|
|
9534
|
+
}
|
|
9535
|
+
if (paramNames.has(baseName)) {
|
|
9536
|
+
throw new Error(
|
|
9537
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": duplicate parameter name "{${baseName}}"`
|
|
9538
|
+
);
|
|
9539
|
+
}
|
|
9540
|
+
paramNames.add(baseName);
|
|
9541
|
+
if (name.endsWith("+") && i !== segments.length - 1) {
|
|
9542
|
+
throw new Error(
|
|
9543
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": {${name}} must be the last segment`
|
|
9544
|
+
);
|
|
9545
|
+
}
|
|
9546
|
+
}
|
|
9547
|
+
}
|
|
9548
|
+
}
|
|
9549
|
+
function validateBaseUrl(base, serviceName) {
|
|
9550
|
+
let url;
|
|
9551
|
+
try {
|
|
9552
|
+
url = new URL(base);
|
|
9553
|
+
} catch {
|
|
9554
|
+
throw new Error(
|
|
9555
|
+
`Invalid base URL "${base}" in service "${serviceName}": not a valid URL`
|
|
9556
|
+
);
|
|
9557
|
+
}
|
|
9558
|
+
if (url.search) {
|
|
9559
|
+
throw new Error(
|
|
9560
|
+
`Invalid base URL "${base}" in service "${serviceName}": must not contain query string`
|
|
9561
|
+
);
|
|
9562
|
+
}
|
|
9563
|
+
if (url.hash) {
|
|
9564
|
+
throw new Error(
|
|
9565
|
+
`Invalid base URL "${base}" in service "${serviceName}": must not contain fragment`
|
|
9566
|
+
);
|
|
9567
|
+
}
|
|
9568
|
+
}
|
|
9422
9569
|
function collectAndValidatePermissions(ref, serviceConfig) {
|
|
9570
|
+
if (serviceConfig.apis.length === 0) {
|
|
9571
|
+
throw new Error(
|
|
9572
|
+
`Service "${serviceConfig.name}" (ref "${ref}") has no api entries`
|
|
9573
|
+
);
|
|
9574
|
+
}
|
|
9423
9575
|
const available = /* @__PURE__ */ new Set();
|
|
9424
9576
|
for (const api2 of serviceConfig.apis) {
|
|
9425
|
-
|
|
9577
|
+
validateBaseUrl(api2.base, serviceConfig.name);
|
|
9578
|
+
if (!api2.permissions || api2.permissions.length === 0) {
|
|
9579
|
+
throw new Error(
|
|
9580
|
+
`API entry "${api2.base}" in service "${serviceConfig.name}" (ref "${ref}") has no permissions`
|
|
9581
|
+
);
|
|
9582
|
+
}
|
|
9583
|
+
for (const perm of api2.permissions) {
|
|
9584
|
+
if (!perm.name) {
|
|
9585
|
+
throw new Error(
|
|
9586
|
+
`Service "${serviceConfig.name}" (ref "${ref}") has a permission with empty name`
|
|
9587
|
+
);
|
|
9588
|
+
}
|
|
9426
9589
|
if (perm.name === "all") {
|
|
9427
9590
|
throw new Error(
|
|
9428
9591
|
`Service "${serviceConfig.name}" (ref "${ref}") has a permission named "all", which is a reserved keyword`
|
|
9429
9592
|
);
|
|
9430
9593
|
}
|
|
9594
|
+
if (available.has(perm.name)) {
|
|
9595
|
+
throw new Error(
|
|
9596
|
+
`Duplicate permission name "${perm.name}" in service "${serviceConfig.name}" (ref "${ref}")`
|
|
9597
|
+
);
|
|
9598
|
+
}
|
|
9599
|
+
if (perm.rules.length === 0) {
|
|
9600
|
+
throw new Error(
|
|
9601
|
+
`Permission "${perm.name}" in service "${serviceConfig.name}" (ref "${ref}") has no rules`
|
|
9602
|
+
);
|
|
9603
|
+
}
|
|
9604
|
+
for (const rule of perm.rules) {
|
|
9605
|
+
validateRule(rule, perm.name, serviceConfig.name);
|
|
9606
|
+
}
|
|
9431
9607
|
available.add(perm.name);
|
|
9432
9608
|
}
|
|
9433
9609
|
}
|
|
@@ -9677,7 +9853,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9677
9853
|
options.autoUpdate = false;
|
|
9678
9854
|
}
|
|
9679
9855
|
if (options.autoUpdate !== false) {
|
|
9680
|
-
await startSilentUpgrade("9.
|
|
9856
|
+
await startSilentUpgrade("9.58.0");
|
|
9681
9857
|
}
|
|
9682
9858
|
try {
|
|
9683
9859
|
let result;
|
|
@@ -10850,7 +11026,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10850
11026
|
withErrorHandler(
|
|
10851
11027
|
async (identifier, prompt, options) => {
|
|
10852
11028
|
if (options.autoUpdate !== false) {
|
|
10853
|
-
await startSilentUpgrade("9.
|
|
11029
|
+
await startSilentUpgrade("9.58.0");
|
|
10854
11030
|
}
|
|
10855
11031
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10856
11032
|
if (org && !options.experimentalSharedAgent) {
|
|
@@ -12537,7 +12713,7 @@ var cookAction = new Command34().name("cook").description("Quick start: prepare,
|
|
|
12537
12713
|
withErrorHandler(
|
|
12538
12714
|
async (prompt, options) => {
|
|
12539
12715
|
if (options.autoUpdate !== false) {
|
|
12540
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12716
|
+
const shouldExit = await checkAndUpgrade("9.58.0", prompt);
|
|
12541
12717
|
if (shouldExit) {
|
|
12542
12718
|
process.exit(0);
|
|
12543
12719
|
}
|
|
@@ -13854,6 +14030,7 @@ var setCommand = new Command41().name("set").description("Rename your organizati
|
|
|
13854
14030
|
);
|
|
13855
14031
|
}
|
|
13856
14032
|
const org = await updateOrg({ slug, force: true });
|
|
14033
|
+
await saveConfig({ activeOrg: org.slug });
|
|
13857
14034
|
console.log(chalk37.green(`\u2713 Organization updated to ${org.slug}`));
|
|
13858
14035
|
console.log();
|
|
13859
14036
|
console.log("Your agents will now be namespaced as:");
|
|
@@ -13875,8 +14052,7 @@ import chalk38 from "chalk";
|
|
|
13875
14052
|
var listCommand5 = new Command42().name("list").description("List all accessible organizations").action(
|
|
13876
14053
|
withErrorHandler(async () => {
|
|
13877
14054
|
const result = await listOrgs();
|
|
13878
|
-
const
|
|
13879
|
-
const activeOrg = config.activeOrg;
|
|
14055
|
+
const activeOrg = await getActiveOrg();
|
|
13880
14056
|
console.log(chalk38.bold("Available organizations:"));
|
|
13881
14057
|
for (const org of result.orgs) {
|
|
13882
14058
|
const isCurrent = org.slug === activeOrg;
|
|
@@ -17888,13 +18064,13 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
17888
18064
|
if (latestVersion === null) {
|
|
17889
18065
|
throw new Error("Could not check for updates. Please try again later.");
|
|
17890
18066
|
}
|
|
17891
|
-
if (latestVersion === "9.
|
|
17892
|
-
console.log(chalk83.green(`\u2713 Already up to date (${"9.
|
|
18067
|
+
if (latestVersion === "9.58.0") {
|
|
18068
|
+
console.log(chalk83.green(`\u2713 Already up to date (${"9.58.0"})`));
|
|
17893
18069
|
return;
|
|
17894
18070
|
}
|
|
17895
18071
|
console.log(
|
|
17896
18072
|
chalk83.yellow(
|
|
17897
|
-
`Current version: ${"9.
|
|
18073
|
+
`Current version: ${"9.58.0"} -> Latest version: ${latestVersion}`
|
|
17898
18074
|
)
|
|
17899
18075
|
);
|
|
17900
18076
|
console.log();
|
|
@@ -17921,7 +18097,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
17921
18097
|
const success = await performUpgrade(packageManager);
|
|
17922
18098
|
if (success) {
|
|
17923
18099
|
console.log(
|
|
17924
|
-
chalk83.green(`\u2713 Upgraded from ${"9.
|
|
18100
|
+
chalk83.green(`\u2713 Upgraded from ${"9.58.0"} to ${latestVersion}`)
|
|
17925
18101
|
);
|
|
17926
18102
|
return;
|
|
17927
18103
|
}
|
|
@@ -17935,7 +18111,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
17935
18111
|
|
|
17936
18112
|
// src/index.ts
|
|
17937
18113
|
var program = new Command91();
|
|
17938
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
18114
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.58.0");
|
|
17939
18115
|
program.addCommand(authCommand);
|
|
17940
18116
|
program.addCommand(infoCommand);
|
|
17941
18117
|
program.addCommand(composeCommand);
|