@vm0/cli 9.167.0 → 9.167.1
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-34LCMNHI.js → chunk-XK7CCHB4.js} +2717 -2762
- package/{chunk-34LCMNHI.js.map → chunk-XK7CCHB4.js.map} +1 -1
- package/index.js +23 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +69 -10
- package/zero.js.map +1 -1
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -152,7 +152,7 @@ import {
|
|
|
152
152
|
zeroAgentCustomSkillNameSchema,
|
|
153
153
|
zeroLocalAgentCommand,
|
|
154
154
|
zeroTokenAllowsFeatureSwitch
|
|
155
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-XK7CCHB4.js";
|
|
156
156
|
import {
|
|
157
157
|
__toESM,
|
|
158
158
|
init_esm_shims
|
|
@@ -2046,6 +2046,17 @@ async function getPlatformOrigin() {
|
|
|
2046
2046
|
|
|
2047
2047
|
// src/commands/zero/connector/status.ts
|
|
2048
2048
|
var LABEL_WIDTH = 16;
|
|
2049
|
+
function isConnectorType3(type) {
|
|
2050
|
+
return type in CONNECTOR_TYPES;
|
|
2051
|
+
}
|
|
2052
|
+
async function availableConnectorTypes() {
|
|
2053
|
+
const catalog = await searchZeroConnectors();
|
|
2054
|
+
return new Set(
|
|
2055
|
+
catalog.connectors.map((connector) => {
|
|
2056
|
+
return connector.id;
|
|
2057
|
+
}).filter(isConnectorType3)
|
|
2058
|
+
);
|
|
2059
|
+
}
|
|
2049
2060
|
function printConnectorDetails(type, connector) {
|
|
2050
2061
|
if (connector) {
|
|
2051
2062
|
console.log(
|
|
@@ -2147,18 +2158,25 @@ var statusCommand2 = new Command().name("status").description("Show detailed sta
|
|
|
2147
2158
|
withErrorHandler(async (type, options) => {
|
|
2148
2159
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
2149
2160
|
if (!parseResult.success) {
|
|
2150
|
-
const
|
|
2161
|
+
const available2 = CONNECTOR_TYPE_KEYS.join(", ");
|
|
2151
2162
|
throw new Error(`Unknown connector type: ${type}`, {
|
|
2152
|
-
cause: new Error(`Available connectors: ${
|
|
2163
|
+
cause: new Error(`Available connectors: ${available2}`)
|
|
2153
2164
|
});
|
|
2154
2165
|
}
|
|
2155
|
-
const [connector, agentCtx] = await Promise.all([
|
|
2166
|
+
const [connector, availableTypes, agentCtx] = await Promise.all([
|
|
2156
2167
|
getZeroConnector(parseResult.data),
|
|
2168
|
+
availableConnectorTypes(),
|
|
2157
2169
|
resolveAgentContext(options.agent)
|
|
2158
2170
|
]);
|
|
2171
|
+
const available = availableTypes.has(parseResult.data);
|
|
2159
2172
|
console.log(`Connector: ${source_default.cyan(type)}`);
|
|
2160
2173
|
console.log();
|
|
2161
2174
|
printConnectorDetails(parseResult.data, connector);
|
|
2175
|
+
if (!available) {
|
|
2176
|
+
console.log();
|
|
2177
|
+
console.log(`The ${type} connector is not available for this account.`);
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2162
2180
|
if (agentCtx) {
|
|
2163
2181
|
await printAgentAction(parseResult.data, connector, agentCtx);
|
|
2164
2182
|
} else {
|
|
@@ -2231,6 +2249,18 @@ init_esm_shims();
|
|
|
2231
2249
|
|
|
2232
2250
|
// src/commands/zero/doctor/check-connector.ts
|
|
2233
2251
|
init_esm_shims();
|
|
2252
|
+
function isConnectorType4(type) {
|
|
2253
|
+
return type in CONNECTOR_TYPES;
|
|
2254
|
+
}
|
|
2255
|
+
async function connectorTypeIsAvailable(type) {
|
|
2256
|
+
if (!isConnectorType4(type)) {
|
|
2257
|
+
return false;
|
|
2258
|
+
}
|
|
2259
|
+
const catalog = await searchZeroConnectors();
|
|
2260
|
+
return catalog.connectors.some((connector) => {
|
|
2261
|
+
return connector.id === type;
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2234
2264
|
function resolveConnectorFromUrl(url) {
|
|
2235
2265
|
const allTypes = CONNECTOR_TYPE_KEYS;
|
|
2236
2266
|
const normalized = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
@@ -2298,7 +2328,11 @@ async function checkConnectorStatus(ctx) {
|
|
|
2298
2328
|
`### 2a: Connector status (user must configure via OAuth login or API key)`
|
|
2299
2329
|
);
|
|
2300
2330
|
console.log("");
|
|
2301
|
-
if (!
|
|
2331
|
+
if (!ctx.connectorAvailable) {
|
|
2332
|
+
console.log(
|
|
2333
|
+
`The ${ctx.label} connector is not available for this account.`
|
|
2334
|
+
);
|
|
2335
|
+
} else if (!isConnected) {
|
|
2302
2336
|
console.log(`The ${ctx.label} connector is not connected.`);
|
|
2303
2337
|
if (ctx.agentId && hasPermission) {
|
|
2304
2338
|
const connectUrl = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/connect?agentId=${ctx.agentId}`;
|
|
@@ -2321,7 +2355,11 @@ async function checkConnectorStatus(ctx) {
|
|
|
2321
2355
|
`### 2b: Agent authorization (user must authorize agent to use this connector)`
|
|
2322
2356
|
);
|
|
2323
2357
|
console.log("");
|
|
2324
|
-
if (!ctx.
|
|
2358
|
+
if (!ctx.connectorAvailable) {
|
|
2359
|
+
console.log(
|
|
2360
|
+
`Skipped \u2014 the ${ctx.label} connector is not available for this account.`
|
|
2361
|
+
);
|
|
2362
|
+
} else if (!ctx.agentId) {
|
|
2325
2363
|
console.log("ZERO_AGENT_ID is not set \u2014 cannot check agent authorization.");
|
|
2326
2364
|
} else if (isExpired) {
|
|
2327
2365
|
console.log(
|
|
@@ -2588,12 +2626,16 @@ How connectors work:
|
|
|
2588
2626
|
}
|
|
2589
2627
|
console.log("");
|
|
2590
2628
|
const { label } = CONNECTOR_TYPES[connectorType];
|
|
2591
|
-
const apiUrl = await
|
|
2629
|
+
const [apiUrl, connectorAvailable] = await Promise.all([
|
|
2630
|
+
getApiUrl(),
|
|
2631
|
+
connectorTypeIsAvailable(connectorType)
|
|
2632
|
+
]);
|
|
2592
2633
|
const platformUrl = toPlatformUrl(apiUrl);
|
|
2593
2634
|
const ctx = {
|
|
2594
2635
|
envName,
|
|
2595
2636
|
connectorType,
|
|
2596
2637
|
label,
|
|
2638
|
+
connectorAvailable,
|
|
2597
2639
|
platformOrigin: platformUrl.origin,
|
|
2598
2640
|
agentId: process.env.ZERO_AGENT_ID || void 0
|
|
2599
2641
|
};
|
|
@@ -2944,6 +2986,17 @@ function getGenerationConnectors(generationType) {
|
|
|
2944
2986
|
return a.localeCompare(b);
|
|
2945
2987
|
});
|
|
2946
2988
|
}
|
|
2989
|
+
function isConnectorType5(type) {
|
|
2990
|
+
return type in CONNECTOR_TYPES;
|
|
2991
|
+
}
|
|
2992
|
+
async function getFeatureAvailableConnectorTypes() {
|
|
2993
|
+
const catalog = await searchZeroConnectors();
|
|
2994
|
+
return new Set(
|
|
2995
|
+
catalog.connectors.map((connector) => {
|
|
2996
|
+
return connector.id;
|
|
2997
|
+
}).filter(isConnectorType5)
|
|
2998
|
+
);
|
|
2999
|
+
}
|
|
2947
3000
|
function formatAccount(connector) {
|
|
2948
3001
|
if (connector.externalUsername) return `@${connector.externalUsername}`;
|
|
2949
3002
|
if (connector.externalEmail) return connector.externalEmail;
|
|
@@ -2983,13 +3036,17 @@ function toCandidate(params) {
|
|
|
2983
3036
|
config,
|
|
2984
3037
|
connector,
|
|
2985
3038
|
configuredTypes,
|
|
3039
|
+
availableTypes,
|
|
2986
3040
|
authorizedTypes,
|
|
2987
3041
|
agentId,
|
|
2988
3042
|
platformOrigin
|
|
2989
3043
|
} = params;
|
|
2990
3044
|
let status;
|
|
2991
3045
|
let reason;
|
|
2992
|
-
if (
|
|
3046
|
+
if (!availableTypes.has(type)) {
|
|
3047
|
+
status = "not-available";
|
|
3048
|
+
reason = "not available for this account";
|
|
3049
|
+
} else if (connector?.needsReconnect) {
|
|
2993
3050
|
status = "needs-reconnect";
|
|
2994
3051
|
reason = "connected, reconnect required";
|
|
2995
3052
|
} else if (!connector) {
|
|
@@ -3121,8 +3178,9 @@ var generateCommand = new Command().name("generate").description("Show generatio
|
|
|
3121
3178
|
const generationType = parseGenerationType(type);
|
|
3122
3179
|
const connectorGenerationType = getConnectorGenerationType(generationType);
|
|
3123
3180
|
const agentId = process.env.ZERO_AGENT_ID;
|
|
3124
|
-
const [connectorList, enabledTypes, platformOrigin] = await Promise.all([
|
|
3181
|
+
const [connectorList, availableTypes, enabledTypes, platformOrigin] = await Promise.all([
|
|
3125
3182
|
listZeroConnectors(),
|
|
3183
|
+
getFeatureAvailableConnectorTypes(),
|
|
3126
3184
|
agentId ? getZeroAgentUserConnectors(agentId) : Promise.resolve(null),
|
|
3127
3185
|
getPlatformOrigin()
|
|
3128
3186
|
]);
|
|
@@ -3140,6 +3198,7 @@ var generateCommand = new Command().name("generate").description("Show generatio
|
|
|
3140
3198
|
config,
|
|
3141
3199
|
connector: connectedMap.get(connectorType),
|
|
3142
3200
|
configuredTypes,
|
|
3201
|
+
availableTypes,
|
|
3143
3202
|
authorizedTypes,
|
|
3144
3203
|
agentId,
|
|
3145
3204
|
platformOrigin
|
|
@@ -10783,7 +10842,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
10783
10842
|
var program = new Command();
|
|
10784
10843
|
program.name("zero").description(
|
|
10785
10844
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
10786
|
-
).version("9.167.
|
|
10845
|
+
).version("9.167.1").addHelpText("after", () => {
|
|
10787
10846
|
return buildZeroHelpText();
|
|
10788
10847
|
});
|
|
10789
10848
|
if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {
|