@vm0/cli 9.139.2 → 9.140.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/{chunk-WL4PGRGW.js → chunk-6LA4WVWX.js} +170 -14
- package/{chunk-WL4PGRGW.js.map → chunk-6LA4WVWX.js.map} +1 -1
- package/index.js +9 -9
- package/package.json +1 -1
- package/zero.js +257 -3
- package/zero.js.map +1 -1
package/index.js
CHANGED
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
source_default,
|
|
66
66
|
volumeConfigSchema,
|
|
67
67
|
withErrorHandler
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-6LA4WVWX.js";
|
|
69
69
|
import {
|
|
70
70
|
__toESM,
|
|
71
71
|
init_esm_shims
|
|
@@ -398,7 +398,7 @@ function getConfigPath() {
|
|
|
398
398
|
return join(homedir(), ".vm0", "config.json");
|
|
399
399
|
}
|
|
400
400
|
var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
|
|
401
|
-
console.log(source_default.bold(`VM0 CLI v${"9.
|
|
401
|
+
console.log(source_default.bold(`VM0 CLI v${"9.140.0"}`));
|
|
402
402
|
console.log();
|
|
403
403
|
const config = await loadConfig();
|
|
404
404
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -4291,7 +4291,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4291
4291
|
options.autoUpdate = false;
|
|
4292
4292
|
}
|
|
4293
4293
|
if (options.autoUpdate !== false) {
|
|
4294
|
-
await startSilentUpgrade("9.
|
|
4294
|
+
await startSilentUpgrade("9.140.0");
|
|
4295
4295
|
}
|
|
4296
4296
|
try {
|
|
4297
4297
|
let result;
|
|
@@ -4383,7 +4383,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
|
|
|
4383
4383
|
withErrorHandler(
|
|
4384
4384
|
async (identifier, prompt, options) => {
|
|
4385
4385
|
if (options.autoUpdate !== false) {
|
|
4386
|
-
await startSilentUpgrade("9.
|
|
4386
|
+
await startSilentUpgrade("9.140.0");
|
|
4387
4387
|
}
|
|
4388
4388
|
const { name, version } = parseIdentifier(identifier);
|
|
4389
4389
|
let composeId;
|
|
@@ -6170,13 +6170,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6170
6170
|
if (latestVersion === null) {
|
|
6171
6171
|
throw new Error("Could not check for updates. Please try again later.");
|
|
6172
6172
|
}
|
|
6173
|
-
if (latestVersion === "9.
|
|
6174
|
-
console.log(source_default.green(`\u2713 Already up to date (${"9.
|
|
6173
|
+
if (latestVersion === "9.140.0") {
|
|
6174
|
+
console.log(source_default.green(`\u2713 Already up to date (${"9.140.0"})`));
|
|
6175
6175
|
return;
|
|
6176
6176
|
}
|
|
6177
6177
|
console.log(
|
|
6178
6178
|
source_default.yellow(
|
|
6179
|
-
`Current version: ${"9.
|
|
6179
|
+
`Current version: ${"9.140.0"} -> Latest version: ${latestVersion}`
|
|
6180
6180
|
)
|
|
6181
6181
|
);
|
|
6182
6182
|
console.log();
|
|
@@ -6203,7 +6203,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6203
6203
|
const success = await performUpgrade(packageManager);
|
|
6204
6204
|
if (success) {
|
|
6205
6205
|
console.log(
|
|
6206
|
-
source_default.green(`\u2713 Upgraded from ${"9.
|
|
6206
|
+
source_default.green(`\u2713 Upgraded from ${"9.140.0"} to ${latestVersion}`)
|
|
6207
6207
|
);
|
|
6208
6208
|
return;
|
|
6209
6209
|
}
|
|
@@ -6270,7 +6270,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
|
|
|
6270
6270
|
|
|
6271
6271
|
// src/index.ts
|
|
6272
6272
|
var program = new Command();
|
|
6273
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
6273
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.140.0");
|
|
6274
6274
|
program.addCommand(authCommand);
|
|
6275
6275
|
program.addCommand(infoCommand);
|
|
6276
6276
|
program.addCommand(composeCommand);
|
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
upsertZeroOrgModelProvider,
|
|
128
128
|
withErrorHandler,
|
|
129
129
|
zeroAgentCustomSkillNameSchema
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-6LA4WVWX.js";
|
|
131
131
|
import {
|
|
132
132
|
__toESM,
|
|
133
133
|
init_esm_shims
|
|
@@ -2694,6 +2694,259 @@ How connectors work:
|
|
|
2694
2694
|
})
|
|
2695
2695
|
);
|
|
2696
2696
|
|
|
2697
|
+
// src/commands/zero/doctor/generate.ts
|
|
2698
|
+
init_esm_shims();
|
|
2699
|
+
var GENERATION_TYPE_ORDER = [
|
|
2700
|
+
"image",
|
|
2701
|
+
"video",
|
|
2702
|
+
"audio",
|
|
2703
|
+
"text",
|
|
2704
|
+
"code",
|
|
2705
|
+
"document",
|
|
2706
|
+
"presentation",
|
|
2707
|
+
"website"
|
|
2708
|
+
];
|
|
2709
|
+
var GENERATION_TYPE_LABELS = {
|
|
2710
|
+
audio: "Audio",
|
|
2711
|
+
code: "Code",
|
|
2712
|
+
document: "Document",
|
|
2713
|
+
image: "Image",
|
|
2714
|
+
presentation: "Presentation",
|
|
2715
|
+
text: "Text",
|
|
2716
|
+
video: "Video",
|
|
2717
|
+
website: "Website"
|
|
2718
|
+
};
|
|
2719
|
+
function getAvailableGenerationTypes() {
|
|
2720
|
+
const available = /* @__PURE__ */ new Set();
|
|
2721
|
+
for (const config of Object.values(CONNECTOR_TYPES)) {
|
|
2722
|
+
for (const generationType of config.generation ?? []) {
|
|
2723
|
+
available.add(generationType);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
return GENERATION_TYPE_ORDER.filter((type) => {
|
|
2727
|
+
return available.has(type);
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
function parseGenerationType(value) {
|
|
2731
|
+
const availableTypes = getAvailableGenerationTypes();
|
|
2732
|
+
if (availableTypes.includes(value)) {
|
|
2733
|
+
return value;
|
|
2734
|
+
}
|
|
2735
|
+
throw new Error(`Unknown generation type: ${value}`, {
|
|
2736
|
+
cause: new Error(`Available types: ${availableTypes.join(", ")}`)
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
function getGenerationConnectors(generationType) {
|
|
2740
|
+
return Object.entries(CONNECTOR_TYPES).filter(([, config]) => {
|
|
2741
|
+
return config.generation?.includes(generationType) === true;
|
|
2742
|
+
}).sort(([a], [b]) => {
|
|
2743
|
+
return a.localeCompare(b);
|
|
2744
|
+
});
|
|
2745
|
+
}
|
|
2746
|
+
function formatAccount(connector) {
|
|
2747
|
+
if (connector.externalUsername) return `@${connector.externalUsername}`;
|
|
2748
|
+
if (connector.externalEmail) return connector.externalEmail;
|
|
2749
|
+
if (connector.externalId) return connector.externalId;
|
|
2750
|
+
return void 0;
|
|
2751
|
+
}
|
|
2752
|
+
function getAction(status, type, label, agentId, platformOrigin) {
|
|
2753
|
+
if (status === "needs-reconnect") {
|
|
2754
|
+
return {
|
|
2755
|
+
actionLabel: `Reconnect ${label}`,
|
|
2756
|
+
actionUrl: `${platformOrigin}/connectors`
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2759
|
+
if (status === "not-authorized" && agentId) {
|
|
2760
|
+
return {
|
|
2761
|
+
actionLabel: `Authorize ${label}`,
|
|
2762
|
+
actionUrl: `${platformOrigin}/connectors/${type}/authorize?agentId=${agentId}`
|
|
2763
|
+
};
|
|
2764
|
+
}
|
|
2765
|
+
if (status === "not-connected") {
|
|
2766
|
+
if (agentId) {
|
|
2767
|
+
return {
|
|
2768
|
+
actionLabel: `Connect and authorize ${label}`,
|
|
2769
|
+
actionUrl: `${platformOrigin}/connectors/${type}/authorize?agentId=${agentId}`
|
|
2770
|
+
};
|
|
2771
|
+
}
|
|
2772
|
+
return {
|
|
2773
|
+
actionLabel: `Connect ${label}`,
|
|
2774
|
+
actionUrl: `${platformOrigin}/connectors/${type}/connect`
|
|
2775
|
+
};
|
|
2776
|
+
}
|
|
2777
|
+
return {};
|
|
2778
|
+
}
|
|
2779
|
+
function toCandidate(params) {
|
|
2780
|
+
const {
|
|
2781
|
+
type,
|
|
2782
|
+
config,
|
|
2783
|
+
connector,
|
|
2784
|
+
configuredTypes,
|
|
2785
|
+
authorizedTypes,
|
|
2786
|
+
agentId,
|
|
2787
|
+
platformOrigin
|
|
2788
|
+
} = params;
|
|
2789
|
+
let status;
|
|
2790
|
+
let reason;
|
|
2791
|
+
if (connector?.needsReconnect) {
|
|
2792
|
+
status = "needs-reconnect";
|
|
2793
|
+
reason = "connected, reconnect required";
|
|
2794
|
+
} else if (!connector) {
|
|
2795
|
+
status = configuredTypes.has(type) ? "not-connected" : "not-available";
|
|
2796
|
+
reason = status === "not-connected" ? agentId ? "not connected or authorized for current agent" : "not connected" : "not available in this environment";
|
|
2797
|
+
} else if (authorizedTypes && !authorizedTypes.has(type)) {
|
|
2798
|
+
status = "not-authorized";
|
|
2799
|
+
reason = "connected, not authorized for current agent";
|
|
2800
|
+
} else {
|
|
2801
|
+
status = "ready";
|
|
2802
|
+
reason = agentId ? "connected and authorized for current agent" : "connected; agent authorization was not checked";
|
|
2803
|
+
}
|
|
2804
|
+
return {
|
|
2805
|
+
type,
|
|
2806
|
+
label: config.label,
|
|
2807
|
+
status,
|
|
2808
|
+
reason,
|
|
2809
|
+
account: connector ? formatAccount(connector) : void 0,
|
|
2810
|
+
authMethod: connector?.authMethod,
|
|
2811
|
+
...getAction(status, type, config.label, agentId, platformOrigin)
|
|
2812
|
+
};
|
|
2813
|
+
}
|
|
2814
|
+
function pad(value, width) {
|
|
2815
|
+
return value.padEnd(width);
|
|
2816
|
+
}
|
|
2817
|
+
function renderRows(candidates) {
|
|
2818
|
+
const typeWidth = Math.max(
|
|
2819
|
+
4,
|
|
2820
|
+
...candidates.map((candidate) => {
|
|
2821
|
+
return candidate.type.length;
|
|
2822
|
+
})
|
|
2823
|
+
);
|
|
2824
|
+
const labelWidth = Math.max(
|
|
2825
|
+
5,
|
|
2826
|
+
...candidates.map((candidate) => {
|
|
2827
|
+
return candidate.label.length;
|
|
2828
|
+
})
|
|
2829
|
+
);
|
|
2830
|
+
for (const candidate of candidates) {
|
|
2831
|
+
const suffix = candidate.status === "ready" ? candidate.account ?? candidate.authMethod ?? "" : candidate.reason;
|
|
2832
|
+
console.log(
|
|
2833
|
+
` ${pad(candidate.type, typeWidth)} ${pad(candidate.label, labelWidth)} ${suffix}`
|
|
2834
|
+
);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
function renderActions(candidates) {
|
|
2838
|
+
const actionable = candidates.filter((candidate) => {
|
|
2839
|
+
return candidate.actionLabel && candidate.actionUrl;
|
|
2840
|
+
});
|
|
2841
|
+
if (actionable.length === 0) return;
|
|
2842
|
+
console.log("");
|
|
2843
|
+
console.log("Next actions:");
|
|
2844
|
+
for (const candidate of actionable) {
|
|
2845
|
+
console.log(` [${candidate.actionLabel}](${candidate.actionUrl})`);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
function renderText(params) {
|
|
2849
|
+
const { generationType, agentId, ready, other, showAll } = params;
|
|
2850
|
+
const label = GENERATION_TYPE_LABELS[generationType];
|
|
2851
|
+
const scope = agentId ? "for current agent" : "(connected connectors)";
|
|
2852
|
+
console.log(`${label} generation choices ${scope}`);
|
|
2853
|
+
console.log("");
|
|
2854
|
+
if (agentId) {
|
|
2855
|
+
console.log(`${"Agent:".padEnd(10)}${agentId}`);
|
|
2856
|
+
console.log("");
|
|
2857
|
+
} else {
|
|
2858
|
+
console.log(
|
|
2859
|
+
"ZERO_AGENT_ID is not set, so agent authorization could not be checked."
|
|
2860
|
+
);
|
|
2861
|
+
console.log("");
|
|
2862
|
+
}
|
|
2863
|
+
if (ready.length > 0) {
|
|
2864
|
+
renderRows(ready);
|
|
2865
|
+
} else {
|
|
2866
|
+
console.log(`No ready ${generationType} generation connectors found.`);
|
|
2867
|
+
}
|
|
2868
|
+
if (showAll && other.length > 0) {
|
|
2869
|
+
console.log("");
|
|
2870
|
+
console.log(`Other ${generationType} generation connectors`);
|
|
2871
|
+
console.log("");
|
|
2872
|
+
renderRows(other);
|
|
2873
|
+
}
|
|
2874
|
+
if (ready.length === 0 || showAll) {
|
|
2875
|
+
renderActions(other);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
var generateCommand = new Command().name("generate").description("Show generation connector choices for the current agent").argument(
|
|
2879
|
+
"<type>",
|
|
2880
|
+
`Generation type (${getAvailableGenerationTypes().join(", ")})`
|
|
2881
|
+
).option("--all", "Also show unavailable or not-yet-authorized connectors").option("--json", "Output machine-readable JSON").action(
|
|
2882
|
+
withErrorHandler(async (type, options) => {
|
|
2883
|
+
const generationType = parseGenerationType(type);
|
|
2884
|
+
const agentId = process.env.ZERO_AGENT_ID;
|
|
2885
|
+
const [connectorList, enabledTypes, platformOrigin] = await Promise.all([
|
|
2886
|
+
listZeroConnectors(),
|
|
2887
|
+
agentId ? getZeroAgentUserConnectors(agentId) : Promise.resolve(null),
|
|
2888
|
+
getPlatformOrigin()
|
|
2889
|
+
]);
|
|
2890
|
+
const connectedMap = new Map(
|
|
2891
|
+
connectorList.connectors.map((connector) => {
|
|
2892
|
+
return [connector.type, connector];
|
|
2893
|
+
})
|
|
2894
|
+
);
|
|
2895
|
+
const configuredTypes = new Set(connectorList.configuredTypes);
|
|
2896
|
+
const authorizedTypes = enabledTypes ? new Set(enabledTypes) : null;
|
|
2897
|
+
const candidates = getGenerationConnectors(generationType).map(
|
|
2898
|
+
([connectorType, config]) => {
|
|
2899
|
+
return toCandidate({
|
|
2900
|
+
type: connectorType,
|
|
2901
|
+
config,
|
|
2902
|
+
connector: connectedMap.get(connectorType),
|
|
2903
|
+
configuredTypes,
|
|
2904
|
+
authorizedTypes,
|
|
2905
|
+
agentId,
|
|
2906
|
+
platformOrigin
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
);
|
|
2910
|
+
const ready = candidates.filter((candidate) => {
|
|
2911
|
+
return candidate.status === "ready";
|
|
2912
|
+
});
|
|
2913
|
+
const other = candidates.filter((candidate) => {
|
|
2914
|
+
return candidate.status !== "ready";
|
|
2915
|
+
});
|
|
2916
|
+
if (options.json) {
|
|
2917
|
+
console.log(
|
|
2918
|
+
JSON.stringify(
|
|
2919
|
+
{
|
|
2920
|
+
generationType,
|
|
2921
|
+
availableTypes: getAvailableGenerationTypes(),
|
|
2922
|
+
agentId: agentId ?? null,
|
|
2923
|
+
choices: ready,
|
|
2924
|
+
otherCandidates: other
|
|
2925
|
+
},
|
|
2926
|
+
null,
|
|
2927
|
+
2
|
|
2928
|
+
)
|
|
2929
|
+
);
|
|
2930
|
+
return;
|
|
2931
|
+
}
|
|
2932
|
+
renderText({
|
|
2933
|
+
generationType,
|
|
2934
|
+
agentId,
|
|
2935
|
+
ready,
|
|
2936
|
+
other,
|
|
2937
|
+
showAll: options.all === true
|
|
2938
|
+
});
|
|
2939
|
+
if (!options.all && other.length > 0) {
|
|
2940
|
+
console.log("");
|
|
2941
|
+
console.log(
|
|
2942
|
+
source_default.dim(
|
|
2943
|
+
`Use --all to see every ${generationType} generation candidate.`
|
|
2944
|
+
)
|
|
2945
|
+
);
|
|
2946
|
+
}
|
|
2947
|
+
})
|
|
2948
|
+
);
|
|
2949
|
+
|
|
2697
2950
|
// src/commands/zero/doctor/permission-deny.ts
|
|
2698
2951
|
init_esm_shims();
|
|
2699
2952
|
var permissionDenyCommand = new Command().name("permission-deny").description(
|
|
@@ -2920,12 +3173,13 @@ Notes:
|
|
|
2920
3173
|
);
|
|
2921
3174
|
|
|
2922
3175
|
// src/commands/zero/doctor/index.ts
|
|
2923
|
-
var zeroDoctorCommand = new Command().name("doctor").description("Diagnose runtime issues (connector health, permission denials)").addCommand(checkConnectorCommand).addCommand(permissionDenyCommand).addCommand(permissionChangeCommand).addHelpText(
|
|
3176
|
+
var zeroDoctorCommand = new Command().name("doctor").description("Diagnose runtime issues (connector health, permission denials)").addCommand(checkConnectorCommand).addCommand(generateCommand).addCommand(permissionDenyCommand).addCommand(permissionChangeCommand).addHelpText(
|
|
2924
3177
|
"after",
|
|
2925
3178
|
`
|
|
2926
3179
|
Examples:
|
|
2927
3180
|
Check a connector? zero doctor check-connector --env-name GITHUB_TOKEN
|
|
2928
3181
|
Check a URL? zero doctor check-connector --url https://api.github.com/repos/owner/repo
|
|
3182
|
+
Generate with image? zero doctor generate image
|
|
2929
3183
|
Check with permission? zero doctor check-connector --env-name SLACK_TOKEN --check-permission chat:write
|
|
2930
3184
|
Permission denied? zero doctor permission-deny github --method GET --path /repos/owner/repo
|
|
2931
3185
|
Change a permission? zero doctor permission-change github --permission contents:read --enable
|
|
@@ -7018,7 +7272,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
7018
7272
|
var program = new Command();
|
|
7019
7273
|
program.name("zero").description(
|
|
7020
7274
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
7021
|
-
).version("9.
|
|
7275
|
+
).version("9.140.0").addHelpText(
|
|
7022
7276
|
"after",
|
|
7023
7277
|
`
|
|
7024
7278
|
Examples:
|