@vm0/cli 9.59.0 → 9.59.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 +219 -210
- 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.59.
|
|
48
|
+
release: "9.59.2",
|
|
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.59.
|
|
67
|
+
version: "9.59.2",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -673,7 +673,7 @@ function getConfigPath() {
|
|
|
673
673
|
return join2(homedir2(), ".vm0", "config.json");
|
|
674
674
|
}
|
|
675
675
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
676
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.59.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.59.2"}`));
|
|
677
677
|
console.log();
|
|
678
678
|
const config = await loadConfig();
|
|
679
679
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1227,7 +1227,8 @@ var ALL_RUN_STATUSES = [
|
|
|
1227
1227
|
"running",
|
|
1228
1228
|
"completed",
|
|
1229
1229
|
"failed",
|
|
1230
|
-
"timeout"
|
|
1230
|
+
"timeout",
|
|
1231
|
+
"cancelled"
|
|
1231
1232
|
];
|
|
1232
1233
|
var runStatusSchema = z5.enum(ALL_RUN_STATUSES);
|
|
1233
1234
|
var unifiedRunRequestSchema = z5.object({
|
|
@@ -7005,6 +7006,191 @@ function getServiceConfig(type2) {
|
|
|
7005
7006
|
return { ...config, name: type2 };
|
|
7006
7007
|
}
|
|
7007
7008
|
|
|
7009
|
+
// ../../packages/core/src/contracts/service-expander.ts
|
|
7010
|
+
var VALID_RULE_METHODS = /* @__PURE__ */ new Set([
|
|
7011
|
+
"GET",
|
|
7012
|
+
"POST",
|
|
7013
|
+
"PUT",
|
|
7014
|
+
"PATCH",
|
|
7015
|
+
"DELETE",
|
|
7016
|
+
"HEAD",
|
|
7017
|
+
"OPTIONS",
|
|
7018
|
+
"ANY"
|
|
7019
|
+
]);
|
|
7020
|
+
function validateRule(rule, permName, serviceName) {
|
|
7021
|
+
const parts = rule.split(" ", 2);
|
|
7022
|
+
if (parts.length !== 2 || !parts[1]) {
|
|
7023
|
+
throw new Error(
|
|
7024
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": must be "METHOD /path"`
|
|
7025
|
+
);
|
|
7026
|
+
}
|
|
7027
|
+
const [method, path18] = parts;
|
|
7028
|
+
if (!VALID_RULE_METHODS.has(method)) {
|
|
7029
|
+
throw new Error(
|
|
7030
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": unknown method "${method}" (must be uppercase)`
|
|
7031
|
+
);
|
|
7032
|
+
}
|
|
7033
|
+
if (!path18.startsWith("/")) {
|
|
7034
|
+
throw new Error(
|
|
7035
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": path must start with "/"`
|
|
7036
|
+
);
|
|
7037
|
+
}
|
|
7038
|
+
if (path18.includes("?") || path18.includes("#")) {
|
|
7039
|
+
throw new Error(
|
|
7040
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": path must not contain query string or fragment`
|
|
7041
|
+
);
|
|
7042
|
+
}
|
|
7043
|
+
const segments = path18.split("/").filter(Boolean);
|
|
7044
|
+
const paramNames = /* @__PURE__ */ new Set();
|
|
7045
|
+
for (let i = 0; i < segments.length; i++) {
|
|
7046
|
+
const seg = segments[i];
|
|
7047
|
+
if (seg.startsWith("{") && seg.endsWith("}")) {
|
|
7048
|
+
const name = seg.slice(1, -1);
|
|
7049
|
+
const baseName = name.endsWith("+") ? name.slice(0, -1) : name;
|
|
7050
|
+
if (!baseName) {
|
|
7051
|
+
throw new Error(
|
|
7052
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": empty parameter name`
|
|
7053
|
+
);
|
|
7054
|
+
}
|
|
7055
|
+
if (paramNames.has(baseName)) {
|
|
7056
|
+
throw new Error(
|
|
7057
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": duplicate parameter name "{${baseName}}"`
|
|
7058
|
+
);
|
|
7059
|
+
}
|
|
7060
|
+
paramNames.add(baseName);
|
|
7061
|
+
if (name.endsWith("+") && i !== segments.length - 1) {
|
|
7062
|
+
throw new Error(
|
|
7063
|
+
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": {${name}} must be the last segment`
|
|
7064
|
+
);
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
7069
|
+
function validateBaseUrl(base, serviceName) {
|
|
7070
|
+
let url;
|
|
7071
|
+
try {
|
|
7072
|
+
url = new URL(base);
|
|
7073
|
+
} catch {
|
|
7074
|
+
throw new Error(
|
|
7075
|
+
`Invalid base URL "${base}" in service "${serviceName}": not a valid URL`
|
|
7076
|
+
);
|
|
7077
|
+
}
|
|
7078
|
+
if (url.search) {
|
|
7079
|
+
throw new Error(
|
|
7080
|
+
`Invalid base URL "${base}" in service "${serviceName}": must not contain query string`
|
|
7081
|
+
);
|
|
7082
|
+
}
|
|
7083
|
+
if (url.hash) {
|
|
7084
|
+
throw new Error(
|
|
7085
|
+
`Invalid base URL "${base}" in service "${serviceName}": must not contain fragment`
|
|
7086
|
+
);
|
|
7087
|
+
}
|
|
7088
|
+
}
|
|
7089
|
+
function resolveServiceConfig(ref) {
|
|
7090
|
+
const parsed = connectorTypeSchema.safeParse(ref);
|
|
7091
|
+
if (!parsed.success) {
|
|
7092
|
+
throw new Error(
|
|
7093
|
+
`Cannot resolve service ref "${ref}": no built-in service with this name`
|
|
7094
|
+
);
|
|
7095
|
+
}
|
|
7096
|
+
const serviceConfig = getServiceConfig(parsed.data);
|
|
7097
|
+
if (!serviceConfig) {
|
|
7098
|
+
throw new Error(
|
|
7099
|
+
`Service ref "${ref}" resolved to "${parsed.data}" but it does not support proxy-side token replacement`
|
|
7100
|
+
);
|
|
7101
|
+
}
|
|
7102
|
+
return serviceConfig;
|
|
7103
|
+
}
|
|
7104
|
+
function collectAndValidatePermissions(ref, serviceConfig) {
|
|
7105
|
+
if (serviceConfig.apis.length === 0) {
|
|
7106
|
+
throw new Error(
|
|
7107
|
+
`Service "${serviceConfig.name}" (ref "${ref}") has no api entries`
|
|
7108
|
+
);
|
|
7109
|
+
}
|
|
7110
|
+
const available = /* @__PURE__ */ new Set();
|
|
7111
|
+
for (const api2 of serviceConfig.apis) {
|
|
7112
|
+
validateBaseUrl(api2.base, serviceConfig.name);
|
|
7113
|
+
if (!api2.permissions || api2.permissions.length === 0) {
|
|
7114
|
+
throw new Error(
|
|
7115
|
+
`API entry "${api2.base}" in service "${serviceConfig.name}" (ref "${ref}") has no permissions`
|
|
7116
|
+
);
|
|
7117
|
+
}
|
|
7118
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7119
|
+
for (const perm of api2.permissions) {
|
|
7120
|
+
if (!perm.name) {
|
|
7121
|
+
throw new Error(
|
|
7122
|
+
`Service "${serviceConfig.name}" (ref "${ref}") has a permission with empty name`
|
|
7123
|
+
);
|
|
7124
|
+
}
|
|
7125
|
+
if (perm.name === "all") {
|
|
7126
|
+
throw new Error(
|
|
7127
|
+
`Service "${serviceConfig.name}" (ref "${ref}") has a permission named "all", which is a reserved keyword`
|
|
7128
|
+
);
|
|
7129
|
+
}
|
|
7130
|
+
if (seen.has(perm.name)) {
|
|
7131
|
+
throw new Error(
|
|
7132
|
+
`Duplicate permission name "${perm.name}" in API entry "${api2.base}" of service "${serviceConfig.name}" (ref "${ref}")`
|
|
7133
|
+
);
|
|
7134
|
+
}
|
|
7135
|
+
if (perm.rules.length === 0) {
|
|
7136
|
+
throw new Error(
|
|
7137
|
+
`Permission "${perm.name}" in service "${serviceConfig.name}" (ref "${ref}") has no rules`
|
|
7138
|
+
);
|
|
7139
|
+
}
|
|
7140
|
+
for (const rule of perm.rules) {
|
|
7141
|
+
validateRule(rule, perm.name, serviceConfig.name);
|
|
7142
|
+
}
|
|
7143
|
+
seen.add(perm.name);
|
|
7144
|
+
available.add(perm.name);
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
return available;
|
|
7148
|
+
}
|
|
7149
|
+
function expandServiceConfigs(config) {
|
|
7150
|
+
const compose = config;
|
|
7151
|
+
if (!compose?.agents) return;
|
|
7152
|
+
for (const agent of Object.values(compose.agents)) {
|
|
7153
|
+
const services = agent.experimental_services;
|
|
7154
|
+
if (!services) continue;
|
|
7155
|
+
if (Array.isArray(services)) continue;
|
|
7156
|
+
const expanded = [];
|
|
7157
|
+
for (const [ref, selection] of Object.entries(services)) {
|
|
7158
|
+
const serviceConfig = resolveServiceConfig(ref);
|
|
7159
|
+
const availablePermissions = collectAndValidatePermissions(
|
|
7160
|
+
ref,
|
|
7161
|
+
serviceConfig
|
|
7162
|
+
);
|
|
7163
|
+
if (selection.permissions !== "all") {
|
|
7164
|
+
for (const name of selection.permissions) {
|
|
7165
|
+
if (!availablePermissions.has(name)) {
|
|
7166
|
+
const available = [...availablePermissions].join(", ");
|
|
7167
|
+
throw new Error(
|
|
7168
|
+
`Permission "${name}" does not exist in service "${serviceConfig.name}" (ref "${ref}"). Available: ${available}`
|
|
7169
|
+
);
|
|
7170
|
+
}
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
7173
|
+
const selectedSet = selection.permissions === "all" ? null : new Set(selection.permissions);
|
|
7174
|
+
const filteredApis = serviceConfig.apis.map((api2) => ({
|
|
7175
|
+
...api2,
|
|
7176
|
+
permissions: selectedSet ? (api2.permissions ?? []).filter((p) => selectedSet.has(p.name)) : api2.permissions
|
|
7177
|
+
})).filter((api2) => (api2.permissions ?? []).length > 0);
|
|
7178
|
+
if (filteredApis.length === 0) continue;
|
|
7179
|
+
const entry = {
|
|
7180
|
+
name: serviceConfig.name,
|
|
7181
|
+
ref,
|
|
7182
|
+
apis: filteredApis
|
|
7183
|
+
};
|
|
7184
|
+
if (serviceConfig.description !== void 0)
|
|
7185
|
+
entry.description = serviceConfig.description;
|
|
7186
|
+
if (serviceConfig.placeholders !== void 0)
|
|
7187
|
+
entry.placeholders = serviceConfig.placeholders;
|
|
7188
|
+
expanded.push(entry);
|
|
7189
|
+
}
|
|
7190
|
+
agent.experimental_services = expanded;
|
|
7191
|
+
}
|
|
7192
|
+
}
|
|
7193
|
+
|
|
7008
7194
|
// ../../packages/core/src/contracts/user-preferences.ts
|
|
7009
7195
|
import { z as z21 } from "zod";
|
|
7010
7196
|
var c19 = initContract();
|
|
@@ -9393,7 +9579,7 @@ async function uploadAssets(agentName, agent, basePath, jsonMode) {
|
|
|
9393
9579
|
}
|
|
9394
9580
|
return skillResults;
|
|
9395
9581
|
}
|
|
9396
|
-
async function collectSkillVariables(skillResults, environment, agentName) {
|
|
9582
|
+
async function collectSkillVariables(skillResults, environment, agentName, options) {
|
|
9397
9583
|
const skillSecrets = /* @__PURE__ */ new Map();
|
|
9398
9584
|
const skillVars = /* @__PURE__ */ new Map();
|
|
9399
9585
|
for (const result of skillResults) {
|
|
@@ -9421,12 +9607,15 @@ async function collectSkillVariables(skillResults, environment, agentName) {
|
|
|
9421
9607
|
const newVars = [...skillVars.entries()].filter(
|
|
9422
9608
|
([name]) => !(name in environment)
|
|
9423
9609
|
);
|
|
9424
|
-
let
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9610
|
+
let trulyNewSecrets = [];
|
|
9611
|
+
if (!options.json) {
|
|
9612
|
+
let headSecrets = /* @__PURE__ */ new Set();
|
|
9613
|
+
const existingCompose = await getComposeByName(agentName);
|
|
9614
|
+
if (existingCompose?.content) {
|
|
9615
|
+
headSecrets = getSecretsFromComposeContent(existingCompose.content);
|
|
9616
|
+
}
|
|
9617
|
+
trulyNewSecrets = newSecrets.map(([name]) => name).filter((name) => !headSecrets.has(name));
|
|
9428
9618
|
}
|
|
9429
|
-
const trulyNewSecrets = newSecrets.map(([name]) => name).filter((name) => !headSecrets.has(name));
|
|
9430
9619
|
return { newSecrets, newVars, trulyNewSecrets };
|
|
9431
9620
|
}
|
|
9432
9621
|
async function displayAndConfirmVariables(variables, options) {
|
|
@@ -9495,189 +9684,6 @@ function mergeSkillVariables(agent, variables) {
|
|
|
9495
9684
|
agent.environment = environment;
|
|
9496
9685
|
}
|
|
9497
9686
|
}
|
|
9498
|
-
function resolveServiceConfig(ref) {
|
|
9499
|
-
const parsed = connectorTypeSchema.safeParse(ref);
|
|
9500
|
-
if (!parsed.success) {
|
|
9501
|
-
throw new Error(
|
|
9502
|
-
`Cannot resolve service ref "${ref}": no built-in service with this name`
|
|
9503
|
-
);
|
|
9504
|
-
}
|
|
9505
|
-
const serviceConfig = getServiceConfig(parsed.data);
|
|
9506
|
-
if (!serviceConfig) {
|
|
9507
|
-
throw new Error(
|
|
9508
|
-
`Service ref "${ref}" resolved to "${parsed.data}" but it does not support proxy-side token replacement`
|
|
9509
|
-
);
|
|
9510
|
-
}
|
|
9511
|
-
return serviceConfig;
|
|
9512
|
-
}
|
|
9513
|
-
var VALID_RULE_METHODS = /* @__PURE__ */ new Set([
|
|
9514
|
-
"GET",
|
|
9515
|
-
"POST",
|
|
9516
|
-
"PUT",
|
|
9517
|
-
"PATCH",
|
|
9518
|
-
"DELETE",
|
|
9519
|
-
"HEAD",
|
|
9520
|
-
"OPTIONS",
|
|
9521
|
-
"ANY"
|
|
9522
|
-
]);
|
|
9523
|
-
function validateRule(rule, permName, serviceName) {
|
|
9524
|
-
const parts = rule.split(" ", 2);
|
|
9525
|
-
if (parts.length !== 2 || !parts[1]) {
|
|
9526
|
-
throw new Error(
|
|
9527
|
-
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": must be "METHOD /path"`
|
|
9528
|
-
);
|
|
9529
|
-
}
|
|
9530
|
-
const [method, path18] = parts;
|
|
9531
|
-
if (!VALID_RULE_METHODS.has(method)) {
|
|
9532
|
-
throw new Error(
|
|
9533
|
-
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": unknown method "${method}" (must be uppercase)`
|
|
9534
|
-
);
|
|
9535
|
-
}
|
|
9536
|
-
if (!path18.startsWith("/")) {
|
|
9537
|
-
throw new Error(
|
|
9538
|
-
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": path must start with "/"`
|
|
9539
|
-
);
|
|
9540
|
-
}
|
|
9541
|
-
if (path18.includes("?") || path18.includes("#")) {
|
|
9542
|
-
throw new Error(
|
|
9543
|
-
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": path must not contain query string or fragment`
|
|
9544
|
-
);
|
|
9545
|
-
}
|
|
9546
|
-
const segments = path18.split("/").filter(Boolean);
|
|
9547
|
-
const paramNames = /* @__PURE__ */ new Set();
|
|
9548
|
-
for (let i = 0; i < segments.length; i++) {
|
|
9549
|
-
const seg = segments[i];
|
|
9550
|
-
if (seg.startsWith("{") && seg.endsWith("}")) {
|
|
9551
|
-
const name = seg.slice(1, -1);
|
|
9552
|
-
const baseName = name.endsWith("+") ? name.slice(0, -1) : name;
|
|
9553
|
-
if (!baseName) {
|
|
9554
|
-
throw new Error(
|
|
9555
|
-
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": empty parameter name`
|
|
9556
|
-
);
|
|
9557
|
-
}
|
|
9558
|
-
if (paramNames.has(baseName)) {
|
|
9559
|
-
throw new Error(
|
|
9560
|
-
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": duplicate parameter name "{${baseName}}"`
|
|
9561
|
-
);
|
|
9562
|
-
}
|
|
9563
|
-
paramNames.add(baseName);
|
|
9564
|
-
if (name.endsWith("+") && i !== segments.length - 1) {
|
|
9565
|
-
throw new Error(
|
|
9566
|
-
`Invalid rule "${rule}" in permission "${permName}" of service "${serviceName}": {${name}} must be the last segment`
|
|
9567
|
-
);
|
|
9568
|
-
}
|
|
9569
|
-
}
|
|
9570
|
-
}
|
|
9571
|
-
}
|
|
9572
|
-
function validateBaseUrl(base, serviceName) {
|
|
9573
|
-
let url;
|
|
9574
|
-
try {
|
|
9575
|
-
url = new URL(base);
|
|
9576
|
-
} catch {
|
|
9577
|
-
throw new Error(
|
|
9578
|
-
`Invalid base URL "${base}" in service "${serviceName}": not a valid URL`
|
|
9579
|
-
);
|
|
9580
|
-
}
|
|
9581
|
-
if (url.search) {
|
|
9582
|
-
throw new Error(
|
|
9583
|
-
`Invalid base URL "${base}" in service "${serviceName}": must not contain query string`
|
|
9584
|
-
);
|
|
9585
|
-
}
|
|
9586
|
-
if (url.hash) {
|
|
9587
|
-
throw new Error(
|
|
9588
|
-
`Invalid base URL "${base}" in service "${serviceName}": must not contain fragment`
|
|
9589
|
-
);
|
|
9590
|
-
}
|
|
9591
|
-
}
|
|
9592
|
-
function collectAndValidatePermissions(ref, serviceConfig) {
|
|
9593
|
-
if (serviceConfig.apis.length === 0) {
|
|
9594
|
-
throw new Error(
|
|
9595
|
-
`Service "${serviceConfig.name}" (ref "${ref}") has no api entries`
|
|
9596
|
-
);
|
|
9597
|
-
}
|
|
9598
|
-
const available = /* @__PURE__ */ new Set();
|
|
9599
|
-
for (const api2 of serviceConfig.apis) {
|
|
9600
|
-
validateBaseUrl(api2.base, serviceConfig.name);
|
|
9601
|
-
if (!api2.permissions || api2.permissions.length === 0) {
|
|
9602
|
-
throw new Error(
|
|
9603
|
-
`API entry "${api2.base}" in service "${serviceConfig.name}" (ref "${ref}") has no permissions`
|
|
9604
|
-
);
|
|
9605
|
-
}
|
|
9606
|
-
const seen = /* @__PURE__ */ new Set();
|
|
9607
|
-
for (const perm of api2.permissions) {
|
|
9608
|
-
if (!perm.name) {
|
|
9609
|
-
throw new Error(
|
|
9610
|
-
`Service "${serviceConfig.name}" (ref "${ref}") has a permission with empty name`
|
|
9611
|
-
);
|
|
9612
|
-
}
|
|
9613
|
-
if (perm.name === "all") {
|
|
9614
|
-
throw new Error(
|
|
9615
|
-
`Service "${serviceConfig.name}" (ref "${ref}") has a permission named "all", which is a reserved keyword`
|
|
9616
|
-
);
|
|
9617
|
-
}
|
|
9618
|
-
if (seen.has(perm.name)) {
|
|
9619
|
-
throw new Error(
|
|
9620
|
-
`Duplicate permission name "${perm.name}" in API entry "${api2.base}" of service "${serviceConfig.name}" (ref "${ref}")`
|
|
9621
|
-
);
|
|
9622
|
-
}
|
|
9623
|
-
if (perm.rules.length === 0) {
|
|
9624
|
-
throw new Error(
|
|
9625
|
-
`Permission "${perm.name}" in service "${serviceConfig.name}" (ref "${ref}") has no rules`
|
|
9626
|
-
);
|
|
9627
|
-
}
|
|
9628
|
-
for (const rule of perm.rules) {
|
|
9629
|
-
validateRule(rule, perm.name, serviceConfig.name);
|
|
9630
|
-
}
|
|
9631
|
-
seen.add(perm.name);
|
|
9632
|
-
available.add(perm.name);
|
|
9633
|
-
}
|
|
9634
|
-
}
|
|
9635
|
-
return available;
|
|
9636
|
-
}
|
|
9637
|
-
function expandServiceConfigs(config) {
|
|
9638
|
-
const compose = config;
|
|
9639
|
-
if (!compose?.agents) return;
|
|
9640
|
-
for (const agent of Object.values(compose.agents)) {
|
|
9641
|
-
const services = agent.experimental_services;
|
|
9642
|
-
if (!services) continue;
|
|
9643
|
-
if (Array.isArray(services)) continue;
|
|
9644
|
-
const expanded = [];
|
|
9645
|
-
for (const [ref, selection] of Object.entries(services)) {
|
|
9646
|
-
const serviceConfig = resolveServiceConfig(ref);
|
|
9647
|
-
const availablePermissions = collectAndValidatePermissions(
|
|
9648
|
-
ref,
|
|
9649
|
-
serviceConfig
|
|
9650
|
-
);
|
|
9651
|
-
if (selection.permissions !== "all") {
|
|
9652
|
-
for (const name of selection.permissions) {
|
|
9653
|
-
if (!availablePermissions.has(name)) {
|
|
9654
|
-
const available = [...availablePermissions].join(", ");
|
|
9655
|
-
throw new Error(
|
|
9656
|
-
`Permission "${name}" does not exist in service "${serviceConfig.name}" (ref "${ref}"). Available: ${available}`
|
|
9657
|
-
);
|
|
9658
|
-
}
|
|
9659
|
-
}
|
|
9660
|
-
}
|
|
9661
|
-
const selectedSet = selection.permissions === "all" ? null : new Set(selection.permissions);
|
|
9662
|
-
const filteredApis = serviceConfig.apis.map((api2) => ({
|
|
9663
|
-
...api2,
|
|
9664
|
-
permissions: selectedSet ? (api2.permissions ?? []).filter((p) => selectedSet.has(p.name)) : api2.permissions
|
|
9665
|
-
})).filter((api2) => (api2.permissions ?? []).length > 0);
|
|
9666
|
-
if (filteredApis.length === 0) continue;
|
|
9667
|
-
const entry = {
|
|
9668
|
-
name: serviceConfig.name,
|
|
9669
|
-
ref,
|
|
9670
|
-
apis: filteredApis
|
|
9671
|
-
};
|
|
9672
|
-
if (serviceConfig.description !== void 0)
|
|
9673
|
-
entry.description = serviceConfig.description;
|
|
9674
|
-
if (serviceConfig.placeholders !== void 0)
|
|
9675
|
-
entry.placeholders = serviceConfig.placeholders;
|
|
9676
|
-
expanded.push(entry);
|
|
9677
|
-
}
|
|
9678
|
-
agent.experimental_services = expanded;
|
|
9679
|
-
}
|
|
9680
|
-
}
|
|
9681
9687
|
function getPlatformUrl(apiUrl) {
|
|
9682
9688
|
const url = new URL(apiUrl);
|
|
9683
9689
|
url.hostname = url.hostname.replace("www", "platform");
|
|
@@ -9745,9 +9751,8 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
9745
9751
|
console.log("Uploading compose...");
|
|
9746
9752
|
}
|
|
9747
9753
|
const response = await createOrUpdateCompose({ content: config });
|
|
9748
|
-
const orgResponse = await getOrg();
|
|
9749
9754
|
const shortVersionId = response.versionId.slice(0, 8);
|
|
9750
|
-
const displayName = `${
|
|
9755
|
+
const displayName = options.json ? response.name : `${(await getOrg()).slug}/${response.name}`;
|
|
9751
9756
|
const result = {
|
|
9752
9757
|
composeId: response.composeId,
|
|
9753
9758
|
composeName: response.name,
|
|
@@ -9755,11 +9760,13 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
9755
9760
|
action: response.action,
|
|
9756
9761
|
displayName
|
|
9757
9762
|
};
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
+
if (!options.json) {
|
|
9764
|
+
const missingItems = await checkAndPromptMissingItems(config, options);
|
|
9765
|
+
if (missingItems.missingSecrets.length > 0 || missingItems.missingVars.length > 0) {
|
|
9766
|
+
result.missingSecrets = missingItems.missingSecrets;
|
|
9767
|
+
result.missingVars = missingItems.missingVars;
|
|
9768
|
+
result.setupUrl = missingItems.setupUrl;
|
|
9769
|
+
}
|
|
9763
9770
|
}
|
|
9764
9771
|
if (!options.json) {
|
|
9765
9772
|
if (response.action === "created") {
|
|
@@ -9846,7 +9853,8 @@ async function handleGitHubCompose(url, options) {
|
|
|
9846
9853
|
const variables = await collectSkillVariables(
|
|
9847
9854
|
skillResults,
|
|
9848
9855
|
environment,
|
|
9849
|
-
agentName
|
|
9856
|
+
agentName,
|
|
9857
|
+
options
|
|
9850
9858
|
);
|
|
9851
9859
|
return await finalizeCompose(config, agent, variables, options);
|
|
9852
9860
|
} finally {
|
|
@@ -9878,7 +9886,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9878
9886
|
options.autoUpdate = false;
|
|
9879
9887
|
}
|
|
9880
9888
|
if (options.autoUpdate !== false) {
|
|
9881
|
-
await startSilentUpgrade("9.59.
|
|
9889
|
+
await startSilentUpgrade("9.59.2");
|
|
9882
9890
|
}
|
|
9883
9891
|
try {
|
|
9884
9892
|
let result;
|
|
@@ -9899,7 +9907,8 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9899
9907
|
const variables = await collectSkillVariables(
|
|
9900
9908
|
skillResults,
|
|
9901
9909
|
environment,
|
|
9902
|
-
agentName
|
|
9910
|
+
agentName,
|
|
9911
|
+
options
|
|
9903
9912
|
);
|
|
9904
9913
|
result = await finalizeCompose(config, agent, variables, options);
|
|
9905
9914
|
}
|
|
@@ -11051,7 +11060,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
11051
11060
|
withErrorHandler(
|
|
11052
11061
|
async (identifier, prompt, options) => {
|
|
11053
11062
|
if (options.autoUpdate !== false) {
|
|
11054
|
-
await startSilentUpgrade("9.59.
|
|
11063
|
+
await startSilentUpgrade("9.59.2");
|
|
11055
11064
|
}
|
|
11056
11065
|
const { org, name, version } = parseIdentifier(identifier);
|
|
11057
11066
|
if (org && !options.experimentalSharedAgent) {
|
|
@@ -12738,7 +12747,7 @@ var cookAction = new Command34().name("cook").description("Quick start: prepare,
|
|
|
12738
12747
|
withErrorHandler(
|
|
12739
12748
|
async (prompt, options) => {
|
|
12740
12749
|
if (options.autoUpdate !== false) {
|
|
12741
|
-
const shouldExit = await checkAndUpgrade("9.59.
|
|
12750
|
+
const shouldExit = await checkAndUpgrade("9.59.2", prompt);
|
|
12742
12751
|
if (shouldExit) {
|
|
12743
12752
|
process.exit(0);
|
|
12744
12753
|
}
|
|
@@ -18089,13 +18098,13 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18089
18098
|
if (latestVersion === null) {
|
|
18090
18099
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18091
18100
|
}
|
|
18092
|
-
if (latestVersion === "9.59.
|
|
18093
|
-
console.log(chalk84.green(`\u2713 Already up to date (${"9.59.
|
|
18101
|
+
if (latestVersion === "9.59.2") {
|
|
18102
|
+
console.log(chalk84.green(`\u2713 Already up to date (${"9.59.2"})`));
|
|
18094
18103
|
return;
|
|
18095
18104
|
}
|
|
18096
18105
|
console.log(
|
|
18097
18106
|
chalk84.yellow(
|
|
18098
|
-
`Current version: ${"9.59.
|
|
18107
|
+
`Current version: ${"9.59.2"} -> Latest version: ${latestVersion}`
|
|
18099
18108
|
)
|
|
18100
18109
|
);
|
|
18101
18110
|
console.log();
|
|
@@ -18122,7 +18131,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18122
18131
|
const success = await performUpgrade(packageManager);
|
|
18123
18132
|
if (success) {
|
|
18124
18133
|
console.log(
|
|
18125
|
-
chalk84.green(`\u2713 Upgraded from ${"9.59.
|
|
18134
|
+
chalk84.green(`\u2713 Upgraded from ${"9.59.2"} to ${latestVersion}`)
|
|
18126
18135
|
);
|
|
18127
18136
|
return;
|
|
18128
18137
|
}
|
|
@@ -18136,7 +18145,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18136
18145
|
|
|
18137
18146
|
// src/index.ts
|
|
18138
18147
|
var program = new Command91();
|
|
18139
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.59.
|
|
18148
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.59.2");
|
|
18140
18149
|
program.addCommand(authCommand);
|
|
18141
18150
|
program.addCommand(infoCommand);
|
|
18142
18151
|
program.addCommand(composeCommand);
|