@vm0/cli 9.230.3 → 9.230.5
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/{agent-UDFUOQQT.js → agent-HBWN45EV.js} +4 -4
- package/{banking-VXIIOJL3.js → banking-JMGS7WKE.js} +2 -2
- package/{chat-BJDR72CU.js → chat-SEOXDINW.js} +3 -3
- package/{chunk-RWREJRBM.js → chunk-6LO5CNWO.js} +10 -70
- package/chunk-6LO5CNWO.js.map +1 -0
- package/{chunk-26JQTRTD.js → chunk-BNY74P3F.js} +229 -237
- package/chunk-BNY74P3F.js.map +1 -0
- package/{chunk-4O6L6IF2.js → chunk-ESH7U7H5.js} +2 -2
- package/{chunk-JV5HF7MH.js → chunk-FLPW5VN3.js} +2 -2
- package/{chunk-LCJX5RFE.js → chunk-JAXYYPOP.js} +3 -3
- package/{chunk-HDJ62TIP.js → chunk-NZWTBT6O.js} +2 -2
- package/{chunk-VSBQGITZ.js → chunk-XV6JC37K.js} +3 -3
- package/{chunk-KHYLB7DT.js → chunk-YADVRJUA.js} +2 -2
- package/{chunk-3GYNEDI5.js → chunk-YBYRLNXW.js} +2 -2
- package/chunk-YBYRLNXW.js.map +1 -0
- package/{computer-use-4CZFRH4I.js → computer-use-B5YIQEQK.js} +2 -2
- package/{connector-S7DXTIPZ.js → connector-ESSY2LRJ.js} +2 -2
- package/{credit-SWUGDE6H.js → credit-UJRUUGPI.js} +2 -2
- package/{developer-support-LPBBY62L.js → developer-support-TLZXURUI.js} +2 -2
- package/{doctor-U7KIT2W4.js → doctor-BCWZU6OP.js} +5 -5
- package/{generate-EKAAI4ZP.js → generate-YCHEAUAZ.js} +2 -2
- package/{github-YHE3OUED.js → github-ZUARIXXH.js} +2 -2
- package/{goal-32GUTO4I.js → goal-VNV2BIKX.js} +2 -2
- package/{host-VEZ6G4JF.js → host-XVIKZ7WV.js} +2 -2
- package/index.js +13 -13
- package/intro-MIVVJG7M.js +96 -0
- package/intro-MIVVJG7M.js.map +1 -0
- package/{logs-V7CN7HYO.js → logs-XAERDHHI.js} +6 -6
- package/{maps-CBXCDDDK.js → maps-DJPOTXP3.js} +2 -2
- package/{memory-IA55Z3EV.js → memory-55IE6T7V.js} +2 -2
- package/{model-U3QH2DSC.js → model-VRLA5PBK.js} +3 -3
- package/{model-provider-IVPPHFOQ.js → model-provider-FWEDML6X.js} +3 -3
- package/{org-HMDDNEVN.js → org-G2XUOWT5.js} +2 -2
- package/package.json +1 -1
- package/{phone-Y22VCLQF.js → phone-QCF7O36T.js} +2 -2
- package/{preference-GOLS6EAL.js → preference-NPSP5YVC.js} +2 -2
- package/{relationship-KJCB55CN.js → relationship-IXGN7PIO.js} +2 -2
- package/{resource-IOTGJRWG.js → resource-5ZG7SLC6.js} +2 -2
- package/{search-JEIVR7XU.js → search-6FRRSSRD.js} +6 -6
- package/{secret-I3E2QLUR.js → secret-CNQZQOYG.js} +3 -3
- package/{slack-Y2JXD6A7.js → slack-NKWDC2E7.js} +2 -2
- package/{telegram-WFTA6LYX.js → telegram-FBXMC25F.js} +2 -2
- package/{variable-4U5H2JUY.js → variable-HCCOIHN2.js} +2 -2
- package/{web-6WXT6GKE.js → web-2MFBZBZ4.js} +2 -2
- package/{whoami-ECXTHSLN.js → whoami-MX6ZZHTX.js} +4 -4
- package/{workflow-MH25NET4.js → workflow-HQOBMGBM.js} +2 -2
- package/zero.js +41 -32
- package/zero.js.map +1 -1
- package/chunk-26JQTRTD.js.map +0 -1
- package/chunk-3GYNEDI5.js.map +0 -1
- package/chunk-RWREJRBM.js.map +0 -1
- /package/{agent-UDFUOQQT.js.map → agent-HBWN45EV.js.map} +0 -0
- /package/{banking-VXIIOJL3.js.map → banking-JMGS7WKE.js.map} +0 -0
- /package/{chat-BJDR72CU.js.map → chat-SEOXDINW.js.map} +0 -0
- /package/{chunk-4O6L6IF2.js.map → chunk-ESH7U7H5.js.map} +0 -0
- /package/{chunk-JV5HF7MH.js.map → chunk-FLPW5VN3.js.map} +0 -0
- /package/{chunk-LCJX5RFE.js.map → chunk-JAXYYPOP.js.map} +0 -0
- /package/{chunk-HDJ62TIP.js.map → chunk-NZWTBT6O.js.map} +0 -0
- /package/{chunk-VSBQGITZ.js.map → chunk-XV6JC37K.js.map} +0 -0
- /package/{chunk-KHYLB7DT.js.map → chunk-YADVRJUA.js.map} +0 -0
- /package/{computer-use-4CZFRH4I.js.map → computer-use-B5YIQEQK.js.map} +0 -0
- /package/{connector-S7DXTIPZ.js.map → connector-ESSY2LRJ.js.map} +0 -0
- /package/{credit-SWUGDE6H.js.map → credit-UJRUUGPI.js.map} +0 -0
- /package/{developer-support-LPBBY62L.js.map → developer-support-TLZXURUI.js.map} +0 -0
- /package/{doctor-U7KIT2W4.js.map → doctor-BCWZU6OP.js.map} +0 -0
- /package/{generate-EKAAI4ZP.js.map → generate-YCHEAUAZ.js.map} +0 -0
- /package/{github-YHE3OUED.js.map → github-ZUARIXXH.js.map} +0 -0
- /package/{goal-32GUTO4I.js.map → goal-VNV2BIKX.js.map} +0 -0
- /package/{host-VEZ6G4JF.js.map → host-XVIKZ7WV.js.map} +0 -0
- /package/{logs-V7CN7HYO.js.map → logs-XAERDHHI.js.map} +0 -0
- /package/{maps-CBXCDDDK.js.map → maps-DJPOTXP3.js.map} +0 -0
- /package/{memory-IA55Z3EV.js.map → memory-55IE6T7V.js.map} +0 -0
- /package/{model-U3QH2DSC.js.map → model-VRLA5PBK.js.map} +0 -0
- /package/{model-provider-IVPPHFOQ.js.map → model-provider-FWEDML6X.js.map} +0 -0
- /package/{org-HMDDNEVN.js.map → org-G2XUOWT5.js.map} +0 -0
- /package/{phone-Y22VCLQF.js.map → phone-QCF7O36T.js.map} +0 -0
- /package/{preference-GOLS6EAL.js.map → preference-NPSP5YVC.js.map} +0 -0
- /package/{relationship-KJCB55CN.js.map → relationship-IXGN7PIO.js.map} +0 -0
- /package/{resource-IOTGJRWG.js.map → resource-5ZG7SLC6.js.map} +0 -0
- /package/{search-JEIVR7XU.js.map → search-6FRRSSRD.js.map} +0 -0
- /package/{secret-I3E2QLUR.js.map → secret-CNQZQOYG.js.map} +0 -0
- /package/{slack-Y2JXD6A7.js.map → slack-NKWDC2E7.js.map} +0 -0
- /package/{telegram-WFTA6LYX.js.map → telegram-FBXMC25F.js.map} +0 -0
- /package/{variable-4U5H2JUY.js.map → variable-HCCOIHN2.js.map} +0 -0
- /package/{web-6WXT6GKE.js.map → web-2MFBZBZ4.js.map} +0 -0
- /package/{whoami-ECXTHSLN.js.map → whoami-MX6ZZHTX.js.map} +0 -0
- /package/{workflow-MH25NET4.js.map → workflow-HQOBMGBM.js.map} +0 -0
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
loadFirewallPermissionMetadata,
|
|
6
6
|
resolveFirewallMetadataPolicies
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NZWTBT6O.js";
|
|
8
8
|
import {
|
|
9
9
|
source_default
|
|
10
10
|
} from "./chunk-JUTUEPIR.js";
|
|
@@ -87,4 +87,4 @@ export {
|
|
|
87
87
|
policyIcon,
|
|
88
88
|
loadConnectorPermissionInfos
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-ESH7U7H5.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
splitPathSegments,
|
|
11
11
|
validateAuthBaseUrl,
|
|
12
12
|
validateBaseUrl
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6LO5CNWO.js";
|
|
14
14
|
import {
|
|
15
15
|
init_esm_shims
|
|
16
16
|
} from "./chunk-DIRAZ3YX.js";
|
|
@@ -1175,4 +1175,4 @@ export {
|
|
|
1175
1175
|
matchFirewallBaseUrl,
|
|
1176
1176
|
matchFirewallRequestDecision
|
|
1177
1177
|
};
|
|
1178
|
-
//# sourceMappingURL=chunk-
|
|
1178
|
+
//# sourceMappingURL=chunk-FLPW5VN3.js.map
|
|
@@ -50,7 +50,7 @@ if (DSN) {
|
|
|
50
50
|
Sentry.init({
|
|
51
51
|
dsn: DSN,
|
|
52
52
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
53
|
-
release: "9.230.
|
|
53
|
+
release: "9.230.5",
|
|
54
54
|
sendDefaultPii: false,
|
|
55
55
|
tracesSampleRate: 0,
|
|
56
56
|
shutdownTimeout: 500,
|
|
@@ -69,7 +69,7 @@ if (DSN) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
Sentry.setContext("cli", {
|
|
72
|
-
version: "9.230.
|
|
72
|
+
version: "9.230.5",
|
|
73
73
|
command: process.argv.slice(2).join(" ")
|
|
74
74
|
});
|
|
75
75
|
Sentry.setContext("runtime", {
|
|
@@ -146,4 +146,4 @@ async function configureGlobalProxyFromEnv() {
|
|
|
146
146
|
export {
|
|
147
147
|
configureGlobalProxyFromEnv
|
|
148
148
|
};
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
149
|
+
//# sourceMappingURL=chunk-JAXYYPOP.js.map
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from "node:module";
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
UNKNOWN_PERMISSION_GRANT
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6LO5CNWO.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
9
|
} from "./chunk-DIRAZ3YX.js";
|
|
@@ -3120,4 +3120,4 @@ export {
|
|
|
3120
3120
|
getFirewallPermissionSummary,
|
|
3121
3121
|
loadFirewallPermissionMetadata
|
|
3122
3122
|
};
|
|
3123
|
-
//# sourceMappingURL=chunk-
|
|
3123
|
+
//# sourceMappingURL=chunk-NZWTBT6O.js.map
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
parseBoundedLogCount,
|
|
11
11
|
parseSearchQuery,
|
|
12
12
|
parseTime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BNY74P3F.js";
|
|
14
14
|
import {
|
|
15
15
|
searchZeroLogs
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6LO5CNWO.js";
|
|
17
17
|
import {
|
|
18
18
|
withErrorHandler
|
|
19
19
|
} from "./chunk-3F4RFLPX.js";
|
|
@@ -176,4 +176,4 @@ export {
|
|
|
176
176
|
runLogsSearch,
|
|
177
177
|
searchCommand
|
|
178
178
|
};
|
|
179
|
-
//# sourceMappingURL=chunk-
|
|
179
|
+
//# sourceMappingURL=chunk-XV6JC37K.js.map
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from "node:module";
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
MODEL_PROVIDER_TYPES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6LO5CNWO.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
9
|
} from "./chunk-DIRAZ3YX.js";
|
|
@@ -40,4 +40,4 @@ export {
|
|
|
40
40
|
formatModelProviderRoute,
|
|
41
41
|
formatModelPolicyStatus
|
|
42
42
|
};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-YADVRJUA.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
CONNECTOR_TYPES,
|
|
6
6
|
CONNECTOR_TYPE_KEYS,
|
|
7
7
|
connectorAuthMethodIdSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6LO5CNWO.js";
|
|
9
9
|
import {
|
|
10
10
|
init_esm_shims
|
|
11
11
|
} from "./chunk-DIRAZ3YX.js";
|
|
@@ -121,4 +121,4 @@ export {
|
|
|
121
121
|
getConnectorStoredSecretDisplayInfo,
|
|
122
122
|
getDiagnosticConnectorTypeForRuntimeEnvName
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-YBYRLNXW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/connectors/src/connector-utils.ts"],"sourcesContent":["import {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n connectorAuthMethodIdSchema,\n type ConnectorAuthMethodConfig,\n type ConnectorAuthMethodId,\n type ConnectorAuthCodeGrantAuthMethodId,\n type ConnectorDeviceAuthGrantAuthMethodId,\n type ConnectorExternalCodeGrantAuthMethodId,\n type ConnectorAuthMethodIds,\n type ConnectorAuthMethodIdsByAccessKind,\n type ConnectorAuthMethodIdsByGrantKind,\n type ConnectorAuthMethodIdsByRevokeKind,\n type ConnectorTypesByAccessKind,\n type ConnectorTypesByGrantKind,\n type ConnectorAuthClientConfigForMethod,\n type ConnectorAuthMethodConfigFor,\n type RefreshTokenAccessConnectorType,\n type ConnectorAccessConfig,\n type ConnectorAccessKind,\n type ConnectorBrowserAuthCallbackOrigin,\n type ConnectorAuthCodeCallbackOrigin,\n type ConnectorAuthCodeGrantConfig,\n type ConnectorAuthClientConfig,\n type ConnectorDeviceAuthGrantConfig,\n type ConnectorExternalCodeGrantConfig,\n type ConnectorOpenIdAuthGrantConfig,\n type ConnectorDeviceAuthStartOptionConfig,\n type ConnectorDeviceAuthStartOptions,\n type ConnectorDeviceAuthStartOptionsConfig,\n type ConnectorEnvBindings,\n type ConnectorGenerationType,\n type ConnectorGrantOutputBindings,\n type ConnectorGrantConfig,\n type ConnectorGrantKind,\n type ConnectorManualGrantFieldConfig,\n type ConnectorPlatformSecretName,\n type ConnectorRefreshTokenInputValueRef,\n type ConnectorRefreshTokenInputBindings,\n type ConnectorRefreshTokenOutputBindings,\n type ConnectorRevokeInputBindings,\n type ConnectorRevokeKind,\n type ConnectorSecretValueRef,\n type ConnectorOutputValueRef,\n type ConnectorVariableValueRef,\n type ConnectorEnvBindingValue,\n type ConnectorType,\n type AuthCodeGrantConnectorType,\n type DeviceAuthGrantConnectorType,\n type ExternalCodeGrantConnectorType,\n type OpenIdAuthGrantConnectorType,\n type ConnectorOpenIdAuthGrantAuthMethodId,\n type DynamicPublicConnectorAuthClientConfig,\n type StaticConfidentialConnectorAuthClientConfig,\n type StaticPublicConnectorAuthClientConfig,\n} from \"./connectors\";\nimport type { FeatureSwitchKey } from \"./feature-switch-key\";\n\nconst CONNECTOR_AUTH_METHOD_PRIORITY = {\n oauth: 0,\n openid: 1,\n cli: 2,\n \"api-token\": 3,\n api: 4,\n} as const satisfies Record<ConnectorAuthMethodId, number>;\nconst CONNECTOR_SECRET_REF_PREFIX = \"$secrets.\";\nconst CONNECTOR_VARIABLE_REF_PREFIX = \"$vars.\";\nconst DEFAULT_AUTH_CODE_CALLBACK_ORIGIN: ConnectorAuthCodeCallbackOrigin =\n \"web\";\n\nfunction connectorAuthMethodPriority(\n authMethod: ConnectorAuthMethodId,\n): number {\n return CONNECTOR_AUTH_METHOD_PRIORITY[authMethod];\n}\n\nexport function getConfiguredConnectorAuthMethodIds(\n type: ConnectorType,\n): ConnectorAuthMethodId[] {\n // Configured methods are raw registry entries; callers apply availability filters.\n return Object.keys(CONNECTOR_TYPES[type].authMethods)\n .map((authMethod) => {\n return connectorAuthMethodIdSchema.parse(authMethod);\n })\n .sort((a, b) => {\n const priorityDiff =\n connectorAuthMethodPriority(a) - connectorAuthMethodPriority(b);\n return priorityDiff === 0 ? a.localeCompare(b) : priorityDiff;\n });\n}\n\n/**\n * Connector utility vocabulary:\n *\n * - Available auth methods are user-selectable connection flows after\n * feature-switch and surface policy filtering.\n * - Runtime available connector types are connector types the current server\n * environment can offer as connection candidates.\n * - User connected connector types come from persisted connector rows.\n * - Runtime injection happens later when a run receives environment entries, secrets,\n * variables, and firewall context.\n */\n\n/**\n * Get one auth method config for a connector type.\n */\nexport function getConnectorAuthMethod<\n Type extends ConnectorType,\n Method extends ConnectorAuthMethodIds<Type>,\n>(type: Type, authMethod: Method): ConnectorAuthMethodConfigFor<Type, Method>;\nexport function getConnectorAuthMethod(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthMethodConfig | undefined;\nexport function getConnectorAuthMethod(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthMethodConfig | undefined {\n for (const [methodId, method] of Object.entries(\n CONNECTOR_TYPES[type].authMethods,\n )) {\n if (methodId === authMethod) {\n return method;\n }\n }\n return undefined;\n}\n\nexport function getConnectorAuthMethodIdsForGrantKind<\n Type extends ConnectorType,\n Kind extends ConnectorGrantKind,\n>(\n type: Type,\n grantKind: Kind,\n): ConnectorAuthMethodIdsByGrantKind<Type, Kind>[] {\n return getConfiguredConnectorAuthMethodIds(type).filter(\n (\n authMethod,\n ): authMethod is ConnectorAuthMethodIdsByGrantKind<Type, Kind> => {\n return connectorAuthMethodHasGrantKind(type, authMethod, grantKind);\n },\n );\n}\n\nfunction connectorAuthMethodHasAccessKind<\n Type extends ConnectorType,\n Kind extends ConnectorAccessKind,\n>(\n type: Type,\n authMethod: string,\n accessKind: Kind,\n): authMethod is ConnectorAuthMethodIdsByAccessKind<Type, Kind> {\n return getConnectorAuthMethod(type, authMethod)?.access.kind === accessKind;\n}\n\nexport function getConnectorAuthMethodIdsForAccessKind<\n Type extends ConnectorType,\n Kind extends ConnectorAccessKind,\n>(\n type: Type,\n accessKind: Kind,\n): ConnectorAuthMethodIdsByAccessKind<Type, Kind>[] {\n return getConfiguredConnectorAuthMethodIds(type).filter(\n (\n authMethod,\n ): authMethod is ConnectorAuthMethodIdsByAccessKind<Type, Kind> => {\n return connectorAuthMethodHasAccessKind(type, authMethod, accessKind);\n },\n );\n}\n\nfunction connectorAuthMethodHasRevokeKind<\n Type extends ConnectorType,\n Kind extends ConnectorRevokeKind,\n>(\n type: Type,\n authMethod: string,\n revokeKind: Kind,\n): authMethod is ConnectorAuthMethodIdsByRevokeKind<Type, Kind> {\n return getConnectorAuthMethod(type, authMethod)?.revoke.kind === revokeKind;\n}\n\nexport function getConnectorAuthMethodIdsForRevokeKind<\n Type extends ConnectorType,\n Kind extends ConnectorRevokeKind,\n>(\n type: Type,\n revokeKind: Kind,\n): ConnectorAuthMethodIdsByRevokeKind<Type, Kind>[] {\n return getConfiguredConnectorAuthMethodIds(type).filter(\n (\n authMethod,\n ): authMethod is ConnectorAuthMethodIdsByRevokeKind<Type, Kind> => {\n return connectorAuthMethodHasRevokeKind(type, authMethod, revokeKind);\n },\n );\n}\n\nfunction getManualGrantFields(\n method: ConnectorAuthMethodConfig | undefined,\n): Record<string, ConnectorManualGrantFieldConfig> | undefined {\n if (!method || method.grant.kind !== \"manual\") {\n return undefined;\n }\n return method.grant.fields;\n}\n\nexport interface ConnectorManualGrantFieldNames {\n readonly secrets: readonly string[];\n readonly variables: readonly string[];\n}\n\nfunction manualGrantFieldNames(\n fields: Record<string, ConnectorManualGrantFieldConfig>,\n): ConnectorManualGrantFieldNames {\n const secretNames: string[] = [];\n const variableNames: string[] = [];\n for (const [name, cfg] of Object.entries(fields)) {\n if (cfg.storage === \"variable\") {\n variableNames.push(name);\n } else {\n secretNames.push(name);\n }\n }\n return { secrets: secretNames, variables: variableNames };\n}\n\nexport function getConnectorManualGrantFieldNamesForAuthMethod(\n type: ConnectorType,\n authMethod: string,\n): ConnectorManualGrantFieldNames | null {\n const fields = getManualGrantFields(getConnectorAuthMethod(type, authMethod));\n return fields ? manualGrantFieldNames(fields) : null;\n}\n\nexport function getConnectorManualGrantFieldNames(\n type: ConnectorType,\n): ConnectorManualGrantFieldNames | null {\n const secretNames = new Set<string>();\n const variableNames = new Set<string>();\n for (const authMethod of getConfiguredConnectorAuthMethodIds(type)) {\n const fields = getConnectorManualGrantFieldNamesForAuthMethod(\n type,\n authMethod,\n );\n if (!fields) {\n continue;\n }\n fields.secrets.forEach((name) => {\n secretNames.add(name);\n });\n fields.variables.forEach((name) => {\n variableNames.add(name);\n });\n }\n\n if (secretNames.size === 0 && variableNames.size === 0) {\n return null;\n }\n return { secrets: [...secretNames], variables: [...variableNames] };\n}\n\nfunction addValueRefPrivateName(\n valueRef: ConnectorOutputValueRef,\n privateNames: Set<string>,\n): void {\n if (isConnectorSecretValueRef(valueRef)) {\n privateNames.add(connectorSecretNameFromValueRef(valueRef));\n return;\n }\n\n privateNames.add(connectorVariableNameFromValueRef(valueRef));\n}\n\nfunction addStoragePrivateNames(\n method: ConnectorAuthMethodConfig,\n privateNames: Set<string>,\n): void {\n for (const secret of method.storage.secrets) {\n privateNames.add(secret);\n }\n for (const variable of method.storage.variables) {\n privateNames.add(variable);\n }\n}\n\nfunction addGrantPrivateNames(\n method: ConnectorAuthMethodConfig,\n privateNames: Set<string>,\n): void {\n if (method.grant.kind === \"manual\") {\n for (const fieldName of Object.keys(method.grant.fields)) {\n privateNames.add(fieldName);\n }\n }\n if (\"outputs\" in method.grant) {\n for (const valueRef of Object.values(method.grant.outputs)) {\n addValueRefPrivateName(valueRef, privateNames);\n }\n }\n}\n\nfunction addAccessPrivateNames(\n method: ConnectorAuthMethodConfig,\n privateNames: Set<string>,\n): void {\n if (method.access.kind === \"none\") {\n return;\n }\n\n for (const [envName, binding] of Object.entries(method.access.envBindings)) {\n privateNames.add(envName);\n addValueRefPrivateName(\n typeof binding === \"string\" ? binding : binding.valueRef,\n privateNames,\n );\n }\n for (const platformSecret of method.access.platformSecrets ?? []) {\n privateNames.add(platformSecret);\n }\n}\n\nfunction addRefreshPrivateNames(\n method: ConnectorAuthMethodConfig,\n privateNames: Set<string>,\n): void {\n if (method.access.kind !== \"refresh-token\") {\n return;\n }\n\n for (const valueRef of Object.values(method.access.inputs)) {\n addValueRefPrivateName(valueRef, privateNames);\n }\n for (const valueRef of Object.values(method.access.outputs)) {\n addValueRefPrivateName(valueRef, privateNames);\n }\n for (const refreshableSecret of method.access.refreshableSecrets) {\n privateNames.add(refreshableSecret);\n }\n}\n\nfunction addRevokePrivateNames(\n method: ConnectorAuthMethodConfig,\n privateNames: Set<string>,\n): void {\n if (method.revoke.kind !== \"token-revoke\") {\n return;\n }\n\n for (const valueRef of Object.values(method.revoke.inputs)) {\n addValueRefPrivateName(valueRef, privateNames);\n }\n}\n\nfunction addClientPrivateNames(\n method: ConnectorAuthMethodConfig,\n privateNames: Set<string>,\n): void {\n if (!(\"client\" in method) || !method.client) {\n return;\n }\n\n if (\"clientIdEnv\" in method.client) {\n privateNames.add(method.client.clientIdEnv);\n }\n if (\"clientSecretEnv\" in method.client) {\n privateNames.add(method.client.clientSecretEnv);\n }\n}\n\nfunction addPrivateNamesForAuthMethod(\n method: ConnectorAuthMethodConfig,\n privateNames: Set<string>,\n): void {\n addStoragePrivateNames(method, privateNames);\n addGrantPrivateNames(method, privateNames);\n addAccessPrivateNames(method, privateNames);\n addRefreshPrivateNames(method, privateNames);\n addRevokePrivateNames(method, privateNames);\n addClientPrivateNames(method, privateNames);\n}\n\n/**\n * Private connector implementation names that must not appear in public\n * catalog surfaces or public form ids.\n */\nexport function getConnectorAuthMethodPrivateNames(\n type: ConnectorType,\n authMethod: string,\n): readonly string[] {\n const method = getConnectorAuthMethod(type, authMethod);\n if (!method) {\n return [];\n }\n const privateNames = new Set<string>();\n addPrivateNamesForAuthMethod(method, privateNames);\n return [...privateNames];\n}\n\nexport function getConnectorPrivateNames(\n type: ConnectorType,\n authMethods: readonly string[] = getConfiguredConnectorAuthMethodIds(type),\n): readonly string[] {\n const privateNames = new Set<string>();\n for (const authMethod of authMethods) {\n for (const privateName of getConnectorAuthMethodPrivateNames(\n type,\n authMethod,\n )) {\n privateNames.add(privateName);\n }\n }\n return [...privateNames];\n}\n\nfunction connectorAccessEnvBindings(\n access: ConnectorAccessConfig,\n): ConnectorEnvBindings {\n switch (access.kind) {\n case \"static\":\n case \"refresh-token\":\n return access.envBindings;\n case \"none\":\n return {};\n }\n}\n\nfunction connectorAccessRuntimeEnvBindings(\n access: ConnectorAccessConfig,\n): ConnectorRuntimeEnvBindings {\n return connectorRuntimeEnvBindings(connectorAccessEnvBindings(access));\n}\n\nfunction connectorAccessPlatformSecrets(\n access: ConnectorAccessConfig,\n): readonly ConnectorPlatformSecretName[] {\n switch (access.kind) {\n case \"static\":\n case \"refresh-token\":\n return access.platformSecrets ?? [];\n case \"none\":\n return [];\n }\n}\n\nexport type ConnectorAuthMethodAccessMetadata =\n | {\n readonly kind: \"static\";\n readonly envBindings: ConnectorRuntimeEnvBindings;\n readonly platformSecrets: readonly ConnectorPlatformSecretName[];\n }\n | {\n readonly kind: \"refresh-token\";\n readonly inputs: Readonly<\n Record<string, ConnectorRefreshTokenInputMetadata>\n >;\n readonly outputs: Readonly<\n Record<string, ConnectorRefreshTokenOutputMetadata>\n >;\n readonly refreshableSecrets: readonly string[];\n readonly envBindings: ConnectorRuntimeEnvBindings;\n readonly platformSecrets: readonly ConnectorPlatformSecretName[];\n }\n | {\n readonly kind: \"none\";\n readonly envBindings: ConnectorRuntimeEnvBindings;\n readonly platformSecrets: readonly ConnectorPlatformSecretName[];\n };\n\nexport type ConnectorRefreshTokenAccessMetadata = Extract<\n ConnectorAuthMethodAccessMetadata,\n { readonly kind: \"refresh-token\" }\n>;\n\nexport interface ConnectorRefreshTokenInputMetadata {\n readonly valueRef: string;\n readonly source: Extract<\n ConnectorRuntimeBindingSource,\n { readonly kind: \"connector-secret\" | \"connector-variable\" }\n >;\n}\n\nexport interface ConnectorRefreshTokenOutputMetadata {\n readonly valueRef: string;\n readonly target: ConnectorOutputTarget;\n}\n\nexport interface ConnectorRefreshTokenMetadata {\n readonly inputs: Readonly<Record<string, ConnectorRefreshTokenInputMetadata>>;\n readonly outputs: Readonly<\n Record<string, ConnectorRefreshTokenOutputMetadata>\n >;\n readonly refreshableSecrets: readonly string[];\n}\n\nexport interface ConnectorGrantOutputMetadata {\n readonly valueRef: string;\n readonly target: ConnectorOutputTarget;\n}\n\nexport type ConnectorAuthMethodGrantMetadata =\n | {\n readonly kind:\n | \"auth-code\"\n | \"openid-auth\"\n | \"external-code\"\n | \"device-auth\";\n readonly outputs: Readonly<Record<string, ConnectorGrantOutputMetadata>>;\n }\n | {\n readonly kind: \"manual\" | \"managed\";\n readonly outputs: Readonly<Record<string, ConnectorGrantOutputMetadata>>;\n };\n\nexport interface ConnectorRevokeInputMetadata {\n readonly valueRef: string;\n readonly secretName: string;\n}\n\nexport type ConnectorAuthMethodRevokeMetadata =\n | {\n readonly kind: \"token-revoke\";\n readonly inputs: Readonly<Record<string, ConnectorRevokeInputMetadata>>;\n }\n | {\n readonly kind: \"none\";\n readonly inputs: Readonly<Record<string, ConnectorRevokeInputMetadata>>;\n };\n\nexport type ConnectorRuntimeBindingSource =\n | {\n readonly kind: \"connector-secret\";\n readonly name: string;\n }\n | {\n readonly kind: \"connector-variable\";\n readonly name: string;\n }\n | {\n readonly kind: \"platform-secret\";\n readonly name: ConnectorPlatformSecretName;\n };\n\nexport type ConnectorOutputTarget =\n | {\n readonly kind: \"connector-secret\";\n readonly name: string;\n }\n | {\n readonly kind: \"connector-variable\";\n readonly name: string;\n };\n\nexport interface ConnectorRuntimeBindingEntry {\n readonly envName: string;\n readonly valueRef: string;\n readonly optional: boolean;\n readonly source: ConnectorRuntimeBindingSource;\n}\n\nexport interface ConnectorAuthMethodRuntimeMetadata {\n readonly storage: {\n readonly secrets: readonly string[];\n readonly variables: readonly string[];\n };\n readonly runtimeBindings: readonly ConnectorRuntimeBindingEntry[];\n}\n\nfunction isConnectorSecretValueRef(\n valueRef: ConnectorOutputValueRef,\n): valueRef is ConnectorSecretValueRef {\n return valueRef.startsWith(CONNECTOR_SECRET_REF_PREFIX);\n}\n\nfunction connectorSecretNameFromValueRef(\n valueRef: ConnectorSecretValueRef,\n): string {\n return valueRef.slice(CONNECTOR_SECRET_REF_PREFIX.length);\n}\n\nfunction connectorVariableNameFromValueRef(\n valueRef: ConnectorVariableValueRef,\n): string {\n return valueRef.slice(CONNECTOR_VARIABLE_REF_PREFIX.length);\n}\n\nfunction connectorRefreshInputMetadata(\n valueRef: ConnectorRefreshTokenInputValueRef,\n): ConnectorRefreshTokenInputMetadata {\n if (isConnectorSecretValueRef(valueRef)) {\n return {\n valueRef,\n source: {\n kind: \"connector-secret\",\n name: connectorSecretNameFromValueRef(valueRef),\n },\n };\n }\n\n const variableName = connectorVariableNameFromValueRef(valueRef);\n return {\n valueRef,\n source: { kind: \"connector-variable\", name: variableName },\n };\n}\n\nfunction connectorRefreshOutputMetadata(\n valueRef: ConnectorOutputValueRef,\n): ConnectorRefreshTokenOutputMetadata {\n return {\n valueRef,\n target: connectorOutputTargetFromValueRef(valueRef),\n };\n}\n\nfunction connectorGrantOutputMetadata(\n valueRef: ConnectorOutputValueRef,\n): ConnectorGrantOutputMetadata {\n return connectorRefreshOutputMetadata(valueRef);\n}\n\nfunction connectorOutputTargetFromValueRef(\n valueRef: ConnectorOutputValueRef,\n): ConnectorOutputTarget {\n if (isConnectorSecretValueRef(valueRef)) {\n return {\n kind: \"connector-secret\",\n name: connectorSecretNameFromValueRef(valueRef),\n };\n }\n\n return {\n kind: \"connector-variable\",\n name: connectorVariableNameFromValueRef(valueRef),\n };\n}\n\nfunction connectorRevokeInputMetadata(\n valueRef: ConnectorSecretValueRef,\n): ConnectorRevokeInputMetadata {\n return { valueRef, secretName: connectorSecretNameFromValueRef(valueRef) };\n}\n\nfunction connectorRefreshMetadata(args: {\n readonly inputs: ConnectorRefreshTokenInputBindings;\n readonly outputs: ConnectorRefreshTokenOutputBindings;\n readonly refreshableSecrets: readonly string[];\n}): ConnectorRefreshTokenMetadata {\n return {\n inputs: Object.fromEntries(\n Object.entries(args.inputs).map(([name, valueRef]) => {\n return [name, connectorRefreshInputMetadata(valueRef)];\n }),\n ),\n outputs: Object.fromEntries(\n Object.entries(args.outputs).map(([name, valueRef]) => {\n return [name, connectorRefreshOutputMetadata(valueRef)];\n }),\n ),\n refreshableSecrets: [...args.refreshableSecrets],\n };\n}\n\nexport function getConnectorAuthMethodAccessMetadata<\n Type extends RefreshTokenAccessConnectorType,\n Method extends ConnectorAuthMethodIdsByAccessKind<Type, \"refresh-token\">,\n>(type: Type, authMethod: Method): ConnectorRefreshTokenAccessMetadata;\nexport function getConnectorAuthMethodAccessMetadata(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthMethodAccessMetadata | undefined;\nexport function getConnectorAuthMethodAccessMetadata(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthMethodAccessMetadata | undefined {\n const method = getConnectorAuthMethod(type, authMethod);\n if (!method) {\n return undefined;\n }\n\n switch (method.access.kind) {\n case \"static\": {\n return {\n kind: \"static\",\n envBindings: connectorAccessRuntimeEnvBindings(method.access),\n platformSecrets: method.access.platformSecrets ?? [],\n };\n }\n case \"refresh-token\":\n return {\n kind: \"refresh-token\",\n ...connectorRefreshMetadata(method.access),\n envBindings: connectorAccessRuntimeEnvBindings(method.access),\n platformSecrets: method.access.platformSecrets ?? [],\n };\n case \"none\":\n return {\n kind: \"none\",\n envBindings: {},\n platformSecrets: [],\n };\n }\n}\n\nfunction connectorGrantOutputMetadataMap(\n outputs: ConnectorGrantOutputBindings,\n): Record<string, ConnectorGrantOutputMetadata> {\n return Object.fromEntries(\n Object.entries(outputs).map(([name, valueRef]) => {\n return [name, connectorGrantOutputMetadata(valueRef)];\n }),\n );\n}\n\nexport function getConnectorAuthMethodGrantMetadata(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthMethodGrantMetadata | undefined {\n const method = getConnectorAuthMethod(type, authMethod);\n if (!method) {\n return undefined;\n }\n\n switch (method.grant.kind) {\n case \"auth-code\":\n case \"openid-auth\":\n case \"external-code\":\n case \"device-auth\":\n return {\n kind: method.grant.kind,\n outputs: connectorGrantOutputMetadataMap(method.grant.outputs),\n };\n case \"manual\":\n case \"managed\":\n return {\n kind: method.grant.kind,\n outputs: {},\n };\n }\n}\n\nexport function getConnectorGrantOutputTarget(\n metadata: ConnectorAuthMethodGrantMetadata,\n outputName: string,\n): ConnectorOutputTarget | undefined {\n return metadata.outputs[outputName]?.target;\n}\n\nfunction connectorRevokeInputMetadataMap(\n inputs: ConnectorRevokeInputBindings,\n): Record<string, ConnectorRevokeInputMetadata> {\n return Object.fromEntries(\n Object.entries(inputs).map(([name, valueRef]) => {\n return [name, connectorRevokeInputMetadata(valueRef)];\n }),\n );\n}\n\nexport function getConnectorAuthMethodRevokeMetadata(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthMethodRevokeMetadata | undefined {\n const method = getConnectorAuthMethod(type, authMethod);\n if (!method) {\n return undefined;\n }\n\n switch (method.revoke.kind) {\n case \"token-revoke\":\n return {\n kind: \"token-revoke\",\n inputs: connectorRevokeInputMetadataMap(method.revoke.inputs),\n };\n case \"none\":\n return {\n kind: \"none\",\n inputs: {},\n };\n }\n}\n\nexport function getConnectorRefreshOutputTarget(\n metadata: ConnectorAuthMethodAccessMetadata,\n outputName: string,\n): ConnectorOutputTarget | undefined {\n return metadata.kind === \"refresh-token\"\n ? metadata.outputs[outputName]?.target\n : undefined;\n}\n\nexport function getConnectorRuntimeBindingSecretName(\n metadata: ConnectorAuthMethodRuntimeMetadata,\n envName: string,\n): string | undefined {\n const binding = metadata.runtimeBindings.find((entry) => {\n return (\n entry.envName === envName && entry.source.kind === \"connector-secret\"\n );\n });\n return binding?.source.kind === \"connector-secret\"\n ? binding.source.name\n : undefined;\n}\n\nexport function getConnectorRuntimeBindingPlatformSecretName(\n metadata: ConnectorAuthMethodRuntimeMetadata,\n envName: string,\n): ConnectorPlatformSecretName | undefined {\n const binding = metadata.runtimeBindings.find((entry) => {\n return entry.envName === envName && entry.source.kind === \"platform-secret\";\n });\n return binding?.source.kind === \"platform-secret\"\n ? binding.source.name\n : undefined;\n}\n\nexport function connectorRefreshMetadataHasRefreshableSecret(\n metadata: ConnectorAuthMethodAccessMetadata,\n secretName: string,\n): boolean {\n return (\n metadata.kind === \"refresh-token\" &&\n metadata.refreshableSecrets.includes(secretName)\n );\n}\n\nfunction connectorPlatformSecretSource(\n secretName: string,\n platformSecrets: readonly ConnectorPlatformSecretName[],\n): ConnectorPlatformSecretName | undefined {\n return platformSecrets.find((platformSecret) => {\n return platformSecret === secretName;\n });\n}\n\nexport type ConnectorRuntimeEnvBindings = Record<\n string,\n ConnectorRefreshTokenInputValueRef\n>;\n\nfunction connectorEnvBindingValueRef(\n binding: ConnectorEnvBindingValue,\n): ConnectorRefreshTokenInputValueRef {\n return typeof binding === \"string\" ? binding : binding.valueRef;\n}\n\nfunction connectorEnvBindingIsOptional(\n binding: ConnectorEnvBindingValue,\n): boolean {\n return typeof binding === \"string\" ? false : (binding.optional ?? false);\n}\n\nfunction connectorRuntimeEnvBindings(\n envBindings: ConnectorEnvBindings,\n): ConnectorRuntimeEnvBindings {\n return Object.fromEntries(\n Object.entries(envBindings).map(([envName, binding]) => {\n return [envName, connectorEnvBindingValueRef(binding)];\n }),\n );\n}\n\nfunction connectorRuntimeBindingEntries(args: {\n readonly envBindings: ConnectorEnvBindings;\n readonly platformSecrets: readonly ConnectorPlatformSecretName[];\n}): ConnectorRuntimeBindingEntry[] {\n const entries: ConnectorRuntimeBindingEntry[] = [];\n for (const [envName, binding] of Object.entries(args.envBindings)) {\n const valueRef = connectorEnvBindingValueRef(binding);\n const optional = connectorEnvBindingIsOptional(binding);\n if (valueRef.startsWith(CONNECTOR_SECRET_REF_PREFIX)) {\n const secretName = valueRef.slice(CONNECTOR_SECRET_REF_PREFIX.length);\n const platformSecret = connectorPlatformSecretSource(\n secretName,\n args.platformSecrets,\n );\n entries.push({\n envName,\n valueRef,\n optional,\n source: platformSecret\n ? { kind: \"platform-secret\", name: platformSecret }\n : { kind: \"connector-secret\", name: secretName },\n });\n continue;\n }\n\n if (valueRef.startsWith(CONNECTOR_VARIABLE_REF_PREFIX)) {\n entries.push({\n envName,\n valueRef,\n optional,\n source: {\n kind: \"connector-variable\",\n name: valueRef.slice(CONNECTOR_VARIABLE_REF_PREFIX.length),\n },\n });\n }\n }\n return entries;\n}\n\nexport function getConnectorAuthMethodRuntimeMetadata(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthMethodRuntimeMetadata | undefined {\n const method = getConnectorAuthMethod(type, authMethod);\n if (!method) {\n return undefined;\n }\n const platformSecrets = connectorAccessPlatformSecrets(method.access);\n return {\n storage: {\n secrets: [...method.storage.secrets],\n variables: [...method.storage.variables],\n },\n runtimeBindings: connectorRuntimeBindingEntries({\n envBindings: connectorAccessEnvBindings(method.access),\n platformSecrets,\n }),\n };\n}\n\nexport function connectorAuthMethodHasGrantKind<\n Type extends ConnectorType,\n Kind extends ConnectorGrantKind,\n>(\n type: Type,\n authMethod: string,\n grantKind: Kind,\n): authMethod is ConnectorAuthMethodIdsByGrantKind<Type, Kind> {\n const method = getConnectorAuthMethod(type, authMethod);\n return method?.grant.kind === grantKind;\n}\n\nexport interface ConnectorAuthMethodRef {\n readonly type: ConnectorType;\n readonly authMethod: ConnectorAuthMethodId;\n}\n\nexport type ConnectorAuthMethodRefByGrantKind<Kind extends ConnectorGrantKind> =\n {\n readonly [Type in ConnectorTypesByGrantKind<Kind>]: {\n readonly type: Type;\n readonly authMethod: ConnectorAuthMethodIdsByGrantKind<Type, Kind>;\n };\n }[ConnectorTypesByGrantKind<Kind>];\n\nexport type ConnectorAuthMethodRefByAccessKind<\n Kind extends ConnectorAccessKind,\n> = ConnectorAuthMethodRef & {\n readonly __connectorAuthMethodAccessKind?: Kind;\n};\n\nexport type ConnectorAuthMethodRefByRevokeKind<\n Kind extends ConnectorRevokeKind,\n> = ConnectorAuthMethodRef & {\n readonly __connectorAuthMethodRevokeKind?: Kind;\n};\n\nexport function connectorAuthMethodRefHasGrantKind<\n Kind extends ConnectorGrantKind,\n>(\n authMethodRef: ConnectorAuthMethodRef,\n grantKind: Kind,\n): authMethodRef is ConnectorAuthMethodRefByGrantKind<Kind> {\n return (\n getConnectorAuthMethod(authMethodRef.type, authMethodRef.authMethod)?.grant\n .kind === grantKind\n );\n}\n\nexport function connectorAuthMethodRefHasAccessKind<\n Kind extends ConnectorAccessKind,\n>(\n authMethodRef: ConnectorAuthMethodRef,\n accessKind: Kind,\n): authMethodRef is ConnectorAuthMethodRefByAccessKind<Kind> {\n return (\n getConnectorAuthMethod(authMethodRef.type, authMethodRef.authMethod)?.access\n .kind === accessKind\n );\n}\n\nexport function connectorAuthMethodRefHasRevokeKind<\n Kind extends ConnectorRevokeKind,\n>(\n authMethodRef: ConnectorAuthMethodRef,\n revokeKind: Kind,\n): authMethodRef is ConnectorAuthMethodRefByRevokeKind<Kind> {\n return (\n getConnectorAuthMethod(authMethodRef.type, authMethodRef.authMethod)?.revoke\n .kind === revokeKind\n );\n}\n\nexport function getConnectorAuthMethodAuthCodeGrantConfig<\n Type extends AuthCodeGrantConnectorType,\n>(\n type: Type,\n authMethod: ConnectorAuthCodeGrantAuthMethodId<Type>,\n): ConnectorAuthCodeGrantConfig;\nexport function getConnectorAuthMethodAuthCodeGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthCodeGrantConfig | undefined;\nexport function getConnectorAuthMethodAuthCodeGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthCodeGrantConfig | undefined {\n const grant = getConnectorAuthMethod(type, authMethod)?.grant;\n return grant?.kind === \"auth-code\" ? grant : undefined;\n}\n\nexport function getConnectorAuthMethodOpenIdAuthGrantConfig<\n Type extends OpenIdAuthGrantConnectorType,\n>(\n type: Type,\n authMethod: ConnectorOpenIdAuthGrantAuthMethodId<Type>,\n): ConnectorOpenIdAuthGrantConfig;\nexport function getConnectorAuthMethodOpenIdAuthGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorOpenIdAuthGrantConfig | undefined;\nexport function getConnectorAuthMethodOpenIdAuthGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorOpenIdAuthGrantConfig | undefined {\n const grant = getConnectorAuthMethod(type, authMethod)?.grant;\n return grant?.kind === \"openid-auth\" ? grant : undefined;\n}\n\nexport function getConnectorAuthMethodOpenIdAuthCallbackOrigin<\n Type extends OpenIdAuthGrantConnectorType,\n>(\n type: Type,\n authMethod: ConnectorOpenIdAuthGrantAuthMethodId<Type>,\n): ConnectorBrowserAuthCallbackOrigin;\nexport function getConnectorAuthMethodOpenIdAuthCallbackOrigin(\n type: ConnectorType,\n authMethod: string,\n): ConnectorBrowserAuthCallbackOrigin | undefined;\nexport function getConnectorAuthMethodOpenIdAuthCallbackOrigin(\n type: ConnectorType,\n authMethod: string,\n): ConnectorBrowserAuthCallbackOrigin | undefined {\n const grant = getConnectorAuthMethodOpenIdAuthGrantConfig(type, authMethod);\n if (!grant) {\n return undefined;\n }\n return grant.callbackOrigin ?? \"api\";\n}\n\nexport function getConnectorAuthMethodAuthCodeCallbackOrigin<\n Type extends AuthCodeGrantConnectorType,\n>(\n type: Type,\n authMethod: ConnectorAuthCodeGrantAuthMethodId<Type>,\n): ConnectorAuthCodeCallbackOrigin;\nexport function getConnectorAuthMethodAuthCodeCallbackOrigin(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthCodeCallbackOrigin | undefined;\nexport function getConnectorAuthMethodAuthCodeCallbackOrigin(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthCodeCallbackOrigin | undefined {\n const grant = getConnectorAuthMethodAuthCodeGrantConfig(type, authMethod);\n if (!grant) {\n return undefined;\n }\n return grant.callbackOrigin ?? DEFAULT_AUTH_CODE_CALLBACK_ORIGIN;\n}\n\nexport function connectorAuthCodeCallbacksUseOnlyApiOrigin(\n type: AuthCodeGrantConnectorType,\n): boolean {\n const authMethods = getConnectorAuthMethodIdsForGrantKind(type, \"auth-code\");\n return authMethods.every((authMethod) => {\n return (\n getConnectorAuthMethodAuthCodeCallbackOrigin(type, authMethod) === \"api\"\n );\n });\n}\n\nexport function getConnectorAuthMethodExternalCodeGrantConfig<\n Type extends ExternalCodeGrantConnectorType,\n>(\n type: Type,\n authMethod: ConnectorExternalCodeGrantAuthMethodId<Type>,\n): ConnectorExternalCodeGrantConfig;\nexport function getConnectorAuthMethodExternalCodeGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorExternalCodeGrantConfig | undefined;\nexport function getConnectorAuthMethodExternalCodeGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorExternalCodeGrantConfig | undefined {\n const grant = getConnectorAuthMethod(type, authMethod)?.grant;\n return grant?.kind === \"external-code\" ? grant : undefined;\n}\n\nexport function getConnectorAuthMethodDeviceAuthGrantConfig<\n Type extends DeviceAuthGrantConnectorType,\n>(\n type: Type,\n authMethod: ConnectorDeviceAuthGrantAuthMethodId<Type>,\n): ConnectorDeviceAuthGrantConfig;\nexport function getConnectorAuthMethodDeviceAuthGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorDeviceAuthGrantConfig | undefined;\nexport function getConnectorAuthMethodDeviceAuthGrantConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorDeviceAuthGrantConfig | undefined {\n const grant = getConnectorAuthMethod(type, authMethod)?.grant;\n return grant?.kind === \"device-auth\" ? grant : undefined;\n}\n\nexport function getConnectorAuthMethodDeviceAuthStartOptionsConfig<\n Type extends DeviceAuthGrantConnectorType,\n>(\n type: Type,\n authMethod: ConnectorDeviceAuthGrantAuthMethodId<Type>,\n): ConnectorDeviceAuthStartOptionsConfig | undefined;\nexport function getConnectorAuthMethodDeviceAuthStartOptionsConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorDeviceAuthStartOptionsConfig | undefined;\nexport function getConnectorAuthMethodDeviceAuthStartOptionsConfig(\n type: ConnectorType,\n authMethod: string,\n): ConnectorDeviceAuthStartOptionsConfig | undefined {\n return getConnectorAuthMethodDeviceAuthGrantConfig(type, authMethod)\n ?.startOptions;\n}\n\nexport type ConnectorDeviceAuthStartOptionsParseResult =\n | {\n readonly success: true;\n readonly options: ConnectorDeviceAuthStartOptions;\n }\n | {\n readonly success: false;\n readonly message: string;\n };\n\nfunction parseConnectorDeviceAuthStartOption(args: {\n readonly type: ConnectorType;\n readonly authMethod: string;\n readonly optionName: string;\n readonly config: ConnectorDeviceAuthStartOptionConfig;\n readonly requestedValue: string | undefined;\n}): ConnectorDeviceAuthStartOptionsParseResult {\n const value = args.requestedValue ?? args.config.defaultValue;\n if (value === undefined) {\n if (args.config.required) {\n return {\n success: false,\n message: `${args.type} ${args.authMethod} device-auth start option ${args.optionName} is required`,\n };\n }\n return { success: true, options: {} };\n }\n\n switch (args.config.kind) {\n case \"select\": {\n if (\n !args.config.options.some((option) => {\n return option.value === value;\n })\n ) {\n return {\n success: false,\n message: `${args.type} ${args.authMethod} device-auth start option ${args.optionName} must be one of: ${args.config.options\n .map((option) => {\n return option.value;\n })\n .join(\", \")}`,\n };\n }\n return { success: true, options: { [args.optionName]: value } };\n }\n }\n}\n\nfunction connectorDeviceAuthStartOptionValue(\n options: ConnectorDeviceAuthStartOptions | undefined,\n optionName: string,\n): string | undefined {\n if (!options || !Object.hasOwn(options, optionName)) {\n return undefined;\n }\n return options[optionName];\n}\n\nexport function parseConnectorDeviceAuthStartOptions(args: {\n readonly type: ConnectorType;\n readonly authMethod: string;\n readonly options: ConnectorDeviceAuthStartOptions | undefined;\n}): ConnectorDeviceAuthStartOptionsParseResult {\n const configuredOptions = getConnectorAuthMethodDeviceAuthStartOptionsConfig(\n args.type,\n args.authMethod,\n );\n const requestedOptionKeys = Object.keys(args.options ?? {});\n\n if (!configuredOptions || Object.keys(configuredOptions).length === 0) {\n if (requestedOptionKeys.length === 0) {\n return { success: true, options: {} };\n }\n return {\n success: false,\n message: `${args.type} ${args.authMethod} device-auth start options are not supported: ${requestedOptionKeys.join(\", \")}`,\n };\n }\n\n for (const optionName of requestedOptionKeys) {\n if (!Object.hasOwn(configuredOptions, optionName)) {\n return {\n success: false,\n message: `${args.type} ${args.authMethod} device-auth start option ${optionName} is not supported`,\n };\n }\n }\n\n const normalizedOptions: Record<string, string> = {};\n for (const [optionName, config] of Object.entries(configuredOptions)) {\n const parsedOption = parseConnectorDeviceAuthStartOption({\n type: args.type,\n authMethod: args.authMethod,\n optionName,\n config,\n requestedValue: connectorDeviceAuthStartOptionValue(\n args.options,\n optionName,\n ),\n });\n if (!parsedOption.success) {\n return parsedOption;\n }\n for (const [parsedOptionName, parsedOptionValue] of Object.entries(\n parsedOption.options,\n )) {\n normalizedOptions[parsedOptionName] = parsedOptionValue;\n }\n }\n\n return { success: true, options: normalizedOptions };\n}\n\nfunction connectorGrantScopes(\n grant: ConnectorGrantConfig | undefined,\n): readonly string[] {\n switch (grant?.kind) {\n case \"auth-code\":\n case \"external-code\":\n case \"device-auth\":\n return grant.scopes;\n case \"openid-auth\":\n case \"manual\":\n case \"managed\":\n case undefined:\n return [];\n }\n}\n\nexport function getConnectorAuthMethodGrantScopes(\n type: ConnectorType,\n authMethod: string,\n): string[] {\n return [\n ...connectorGrantScopes(getConnectorAuthMethod(type, authMethod)?.grant),\n ];\n}\n\nexport function getConnectorGenerationTypes(\n type: ConnectorType,\n): readonly ConnectorGenerationType[] {\n const config = CONNECTOR_TYPES[type];\n return \"generation\" in config ? (config.generation ?? []) : [];\n}\n\nexport function getConnectorTags(type: ConnectorType): readonly string[] {\n const config = CONNECTOR_TYPES[type];\n return \"tags\" in config ? (config.tags ?? []) : [];\n}\n\nexport type ConnectorFeatureStates =\n | Partial<Record<FeatureSwitchKey, boolean>>\n | null\n | undefined;\n\nexport type ApiAuthMethodPolicy =\n | \"exclude\"\n | \"include\"\n | { readonly includeForTypes: readonly ConnectorType[] };\n\nexport interface AvailableConnectorAuthMethodsOptions {\n readonly apiAuthMethodPolicy?: ApiAuthMethodPolicy;\n}\n\nexport function isConnectorAuthMethodAvailable(\n type: ConnectorType,\n authMethod: ConnectorAuthMethodId,\n featureStates: ConnectorFeatureStates,\n): boolean {\n const method = getConnectorAuthMethod(type, authMethod);\n if (!method) {\n return false;\n }\n if (method.visible === false) {\n return false;\n }\n return !method.featureFlag || !!featureStates?.[method.featureFlag];\n}\n\nfunction shouldIncludeApiAuthMethod(\n type: ConnectorType,\n policy: ApiAuthMethodPolicy | undefined,\n): boolean {\n switch (policy) {\n case \"include\":\n return true;\n case \"exclude\":\n case undefined:\n return false;\n }\n return policy.includeForTypes.includes(type);\n}\n\n/**\n * Return user-selectable connector connection flows for a surface.\n *\n * This includes static visibility, feature-switch, and surface policy filtering.\n * It does not describe persisted connected state.\n */\nexport function getAvailableConnectorAuthMethodIds(\n type: ConnectorType,\n featureStates: ConnectorFeatureStates,\n options: AvailableConnectorAuthMethodsOptions = {},\n): ConnectorAuthMethodId[] {\n const apiAuthMethodPolicy = options.apiAuthMethodPolicy ?? \"exclude\";\n const availableAuthMethodIds: ConnectorAuthMethodId[] = [];\n const configuredAuthMethodIds = getConfiguredConnectorAuthMethodIds(type);\n\n for (const authMethod of configuredAuthMethodIds) {\n const method = getConnectorAuthMethod(type, authMethod);\n switch (method?.grant.kind) {\n case \"managed\": {\n if (!shouldIncludeApiAuthMethod(type, apiAuthMethodPolicy)) {\n continue;\n }\n break;\n }\n case \"openid-auth\":\n case \"auth-code\":\n case \"external-code\":\n case \"device-auth\":\n case \"manual\": {\n break;\n }\n case undefined: {\n continue;\n }\n }\n if (isConnectorAuthMethodAvailable(type, authMethod, featureStates)) {\n availableAuthMethodIds.push(authMethod);\n }\n }\n\n return availableAuthMethodIds;\n}\n\nexport type ConnectorEnvReader = (name: string) => string | undefined;\n\nexport type StaticConfidentialConnectorAuthClient = {\n readonly clientRegistration: \"static\";\n readonly clientType: \"confidential\";\n readonly clientId: string;\n readonly clientSecret: string;\n};\n\nexport type StaticConfidentialConnectorAuthClientIdentity = {\n readonly clientRegistration: \"static\";\n readonly clientType: \"confidential\";\n readonly clientId: string;\n};\n\nexport type StaticPublicConnectorAuthClient = {\n readonly clientRegistration: \"static\";\n readonly clientType: \"public\";\n readonly clientId: string;\n};\n\nexport type DynamicPublicConnectorAuthClient = {\n readonly clientRegistration: \"dynamic\";\n readonly clientType: \"public\";\n};\n\nexport type StaticConnectorAuthClient =\n | StaticConfidentialConnectorAuthClient\n | StaticPublicConnectorAuthClient;\n\nexport type ConnectorAuthClient =\n | StaticConnectorAuthClient\n | DynamicPublicConnectorAuthClient;\n\nexport type ConnectorAuthClientIdentity =\n | StaticConfidentialConnectorAuthClientIdentity\n | StaticPublicConnectorAuthClient\n | DynamicPublicConnectorAuthClient;\n\nexport type ConnectorAuthClientForConfig<\n Client extends ConnectorAuthClientConfig,\n> = Client extends StaticConfidentialConnectorAuthClientConfig\n ? StaticConfidentialConnectorAuthClient\n : Client extends StaticPublicConnectorAuthClientConfig\n ? StaticPublicConnectorAuthClient\n : Client extends DynamicPublicConnectorAuthClientConfig\n ? DynamicPublicConnectorAuthClient\n : never;\n\nexport type ConnectorAuthClientForMethod<\n Type extends ConnectorType,\n Method extends ConnectorAuthMethodIds<Type>,\n> = ConnectorAuthClientForConfig<\n ConnectorAuthClientConfigForMethod<Type, Method>\n>;\n\nexport type ConnectorAuthClientIdentityForConfig<\n Client extends ConnectorAuthClientConfig,\n> = Client extends StaticConfidentialConnectorAuthClientConfig\n ? StaticConfidentialConnectorAuthClientIdentity\n : Client extends StaticPublicConnectorAuthClientConfig\n ? StaticPublicConnectorAuthClient\n : Client extends DynamicPublicConnectorAuthClientConfig\n ? DynamicPublicConnectorAuthClient\n : never;\n\nexport type ConnectorAuthClientIdentityForMethod<\n Type extends ConnectorType,\n Method extends ConnectorAuthMethodIds<Type>,\n> = ConnectorAuthClientIdentityForConfig<\n ConnectorAuthClientConfigForMethod<Type, Method>\n>;\n\nexport type ConnectorResolvedAuthMethodClient<\n Type extends ConnectorType,\n Method extends ConnectorAuthMethodIds<Type>,\n> = {\n readonly type: Type;\n readonly authMethod: Method;\n readonly authClient: ConnectorAuthClientForMethod<Type, Method>;\n};\n\nexport type ConnectorGrantKindWithAuthClient =\n | \"auth-code\"\n | \"external-code\"\n | \"device-auth\";\n\nexport type ConnectorResolvedAuthMethodClientByGrantKind<\n Kind extends ConnectorGrantKindWithAuthClient,\n> = {\n readonly [Type in ConnectorTypesByGrantKind<Kind>]: {\n readonly [Method in ConnectorAuthMethodIdsByGrantKind<\n Type,\n Kind\n >]: ConnectorResolvedAuthMethodClient<Type, Method>;\n }[ConnectorAuthMethodIdsByGrantKind<Type, Kind>];\n}[ConnectorTypesByGrantKind<Kind>];\n\nexport type ConnectorResolvedAuthMethodClientByAccessKind<\n Kind extends \"refresh-token\",\n> = {\n readonly [Type in ConnectorTypesByAccessKind<Kind>]: {\n readonly [Method in ConnectorAuthMethodIdsByAccessKind<\n Type,\n Kind\n >]: ConnectorResolvedAuthMethodClient<Type, Method>;\n }[ConnectorAuthMethodIdsByAccessKind<Type, Kind>];\n}[ConnectorTypesByAccessKind<Kind>];\n\nexport function isStaticConnectorAuthClient(\n authClient: ConnectorAuthClient,\n): authClient is StaticConnectorAuthClient {\n return authClient.clientRegistration === \"static\";\n}\n\nexport function isStaticConfidentialConnectorAuthClient(\n authClient: ConnectorAuthClient,\n): authClient is StaticConfidentialConnectorAuthClient {\n return (\n isStaticConnectorAuthClient(authClient) &&\n authClient.clientType === \"confidential\"\n );\n}\n\nexport function connectorAuthClientIdentity(\n authClient: StaticConfidentialConnectorAuthClient,\n): StaticConfidentialConnectorAuthClientIdentity;\nexport function connectorAuthClientIdentity(\n authClient: StaticPublicConnectorAuthClient,\n): StaticPublicConnectorAuthClient;\nexport function connectorAuthClientIdentity(\n authClient: DynamicPublicConnectorAuthClient,\n): DynamicPublicConnectorAuthClient;\nexport function connectorAuthClientIdentity(\n authClient: ConnectorAuthClient,\n): ConnectorAuthClientIdentity;\nexport function connectorAuthClientIdentity(\n authClient: ConnectorAuthClient,\n): ConnectorAuthClientIdentity {\n switch (authClient.clientRegistration) {\n case \"dynamic\":\n return authClient;\n case \"static\":\n return {\n clientRegistration: \"static\",\n clientType: authClient.clientType,\n clientId: authClient.clientId,\n };\n }\n}\n\nexport function connectorAuthClientIdentityForMethod<\n Type extends ConnectorType,\n Method extends ConnectorAuthMethodIds<Type>,\n>(\n authClient: ConnectorAuthClientForMethod<Type, Method>,\n): ConnectorAuthClientIdentityForMethod<Type, Method> {\n return connectorAuthClientIdentity(\n authClient,\n ) as ConnectorAuthClientIdentityForMethod<Type, Method>;\n}\n\nexport function getConnectorAuthClientConfigForMethod<\n Type extends ConnectorType,\n Method extends ConnectorAuthMethodIds<Type>,\n>(\n type: Type,\n authMethod: Method,\n): ConnectorAuthClientConfigForMethod<Type, Method> | undefined;\nexport function getConnectorAuthClientConfigForMethod(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthClientConfig | undefined;\nexport function getConnectorAuthClientConfigForMethod(\n type: ConnectorType,\n authMethod: string,\n): ConnectorAuthClientConfig | undefined {\n return getConnectorAuthMethod(type, authMethod)?.client;\n}\n\nexport function resolveConnectorAuthClient<\n Client extends ConnectorAuthClientConfig,\n>(\n client: Client,\n readEnv: ConnectorEnvReader,\n): ConnectorAuthClientForConfig<Client> | undefined;\nexport function resolveConnectorAuthClient(\n client: ConnectorAuthClientConfig,\n readEnv: ConnectorEnvReader,\n): ConnectorAuthClient | undefined {\n if (client.clientRegistration === \"dynamic\") {\n return { clientRegistration: \"dynamic\", clientType: \"public\" };\n }\n\n if (\"clientId\" in client) {\n if (client.clientType === \"confidential\") {\n return {\n clientRegistration: \"static\",\n clientType: \"confidential\",\n clientId: client.clientId,\n clientSecret: client.clientSecret,\n };\n }\n return {\n clientRegistration: \"static\",\n clientType: \"public\",\n clientId: client.clientId,\n };\n }\n\n const clientId = readEnv(client.clientIdEnv);\n if (!clientId) {\n return undefined;\n }\n\n if (client.clientType === \"public\") {\n return { clientRegistration: \"static\", clientType: \"public\", clientId };\n }\n\n const clientSecret = readEnv(client.clientSecretEnv);\n if (!clientSecret) {\n return undefined;\n }\n\n return {\n clientRegistration: \"static\",\n clientType: \"confidential\",\n clientId,\n clientSecret,\n };\n}\n\nexport function resolveConnectorAuthClientForMethod<\n Type extends ConnectorType,\n Method extends ConnectorAuthMethodIds<Type>,\n>(\n type: Type,\n authMethod: Method,\n readEnv: ConnectorEnvReader,\n): ConnectorAuthClientForMethod<Type, Method> | undefined;\nexport function resolveConnectorAuthClientForMethod(\n type: ConnectorType,\n authMethod: string,\n readEnv: ConnectorEnvReader,\n): ConnectorAuthClient | undefined;\nexport function resolveConnectorAuthClientForMethod(\n type: ConnectorType,\n authMethod: string,\n readEnv: ConnectorEnvReader,\n): ConnectorAuthClient | undefined {\n const clientConfig = getConnectorAuthClientConfigForMethod(type, authMethod);\n if (!clientConfig) {\n return undefined;\n }\n return resolveConnectorAuthClient(clientConfig, readEnv);\n}\n\ntype AnyConnectorResolvedAuthMethodClient = {\n readonly type: ConnectorType;\n readonly authMethod: ConnectorAuthMethodId;\n readonly authClient: ConnectorAuthClient;\n};\n\nfunction resolveConnectorResolvedAuthMethodClient(\n authMethodRef: ConnectorAuthMethodRef,\n readEnv: ConnectorEnvReader,\n): AnyConnectorResolvedAuthMethodClient | undefined {\n const authClient = resolveConnectorAuthClientForMethod(\n authMethodRef.type,\n authMethodRef.authMethod,\n readEnv,\n );\n if (!authClient) {\n return undefined;\n }\n return {\n type: authMethodRef.type,\n authMethod: authMethodRef.authMethod,\n authClient,\n };\n}\n\nexport function resolveConnectorResolvedAuthMethodClientByGrantKind(\n authMethodRef: ConnectorAuthMethodRefByGrantKind<\"auth-code\">,\n readEnv: ConnectorEnvReader,\n): ConnectorResolvedAuthMethodClientByGrantKind<\"auth-code\"> | undefined;\nexport function resolveConnectorResolvedAuthMethodClientByGrantKind(\n authMethodRef: ConnectorAuthMethodRefByGrantKind<\"external-code\">,\n readEnv: ConnectorEnvReader,\n): ConnectorResolvedAuthMethodClientByGrantKind<\"external-code\"> | undefined;\nexport function resolveConnectorResolvedAuthMethodClientByGrantKind(\n authMethodRef: ConnectorAuthMethodRefByGrantKind<\"device-auth\">,\n readEnv: ConnectorEnvReader,\n): ConnectorResolvedAuthMethodClientByGrantKind<\"device-auth\"> | undefined;\nexport function resolveConnectorResolvedAuthMethodClientByGrantKind(\n authMethodRef: ConnectorAuthMethodRefByGrantKind<ConnectorGrantKindWithAuthClient>,\n readEnv: ConnectorEnvReader,\n): AnyConnectorResolvedAuthMethodClient | undefined {\n return resolveConnectorResolvedAuthMethodClient(authMethodRef, readEnv);\n}\n\nexport function resolveConnectorResolvedAuthMethodClientByAccessKind(\n authMethodRef: ConnectorAuthMethodRefByAccessKind<\"refresh-token\">,\n readEnv: ConnectorEnvReader,\n): ConnectorResolvedAuthMethodClientByAccessKind<\"refresh-token\"> | undefined;\nexport function resolveConnectorResolvedAuthMethodClientByAccessKind(\n authMethodRef: ConnectorAuthMethodRefByAccessKind<\"refresh-token\">,\n readEnv: ConnectorEnvReader,\n): AnyConnectorResolvedAuthMethodClient | undefined {\n return resolveConnectorResolvedAuthMethodClient(authMethodRef, readEnv);\n}\n\nfunction hasRuntimeAvailableAuthMethod(\n readEnv: ConnectorEnvReader,\n type: ConnectorType,\n): boolean {\n for (const authMethod of getConfiguredConnectorAuthMethodIds(type)) {\n const method = getConnectorAuthMethod(type, authMethod);\n switch (method?.grant.kind) {\n case \"auth-code\":\n case \"external-code\":\n case \"device-auth\": {\n if (resolveConnectorAuthClientForMethod(type, authMethod, readEnv)) {\n return true;\n }\n break;\n }\n case \"openid-auth\": {\n return true;\n }\n case \"manual\": {\n return true;\n }\n case \"managed\":\n case undefined: {\n break;\n }\n }\n }\n return false;\n}\n\n/**\n * Return connector types the current runtime can offer as connection candidates.\n *\n * This is not user connected state and it does not evaluate feature switches.\n * It includes connectors with user-entered manual grant methods because they\n * do not require a server auth client, while auth-provider methods require\n * their runtime client env to exist unless their client config is static inline.\n */\nexport function getRuntimeAvailableConnectorTypes(\n readEnv: ConnectorEnvReader,\n): ConnectorType[] {\n const runtimeAvailable = new Set<ConnectorType>();\n\n for (const type of CONNECTOR_TYPE_KEYS) {\n if (hasRuntimeAvailableAuthMethod(readEnv, type)) {\n runtimeAvailable.add(type);\n }\n }\n\n return [...runtimeAvailable].sort();\n}\n\n/**\n * Get connector-owned secret storage names for a specific auth method.\n */\nexport function getConnectorOwnedSecretNames(\n type: ConnectorType,\n authMethod: string,\n): string[] {\n return connectorAuthMethodOwnedSecretNames(\n getConnectorAuthMethod(type, authMethod),\n );\n}\n\n/**\n * Get connector-owned variable storage names for a specific auth method.\n */\nexport function getConnectorOwnedVariableNames(\n type: ConnectorType,\n authMethod: string,\n): string[] {\n return connectorAuthMethodOwnedVariableNames(\n getConnectorAuthMethod(type, authMethod),\n );\n}\n\nfunction connectorAuthMethodOwnedSecretNames(\n method: ConnectorAuthMethodConfig | undefined,\n): string[] {\n return method ? [...method.storage.secrets] : [];\n}\n\nfunction connectorAuthMethodOwnedVariableNames(\n method: ConnectorAuthMethodConfig | undefined,\n): string[] {\n return method ? [...method.storage.variables] : [];\n}\n\n/**\n * Get runtime environment bindings for a specific connector auth method.\n */\nexport function getConnectorAuthMethodEnvBindings(\n type: ConnectorType,\n authMethod: string,\n): ConnectorRuntimeEnvBindings {\n const method = getConnectorAuthMethod(type, authMethod);\n return method ? connectorAccessRuntimeEnvBindings(method.access) : {};\n}\n\nexport interface ConnectorEnvBindingEntry {\n readonly authMethod: ConnectorAuthMethodId;\n readonly envName: string;\n readonly valueRef: string;\n}\n\n/**\n * Get all configured environment binding entries across auth methods.\n *\n * This is for discovery and reverse lookup. Runtime injection must use\n * getConnectorAuthMethodEnvBindings() with the selected auth method.\n */\nexport function getConnectorEnvBindingEntries(\n type: ConnectorType,\n): ConnectorEnvBindingEntry[] {\n const entries: ConnectorEnvBindingEntry[] = [];\n for (const authMethod of getConfiguredConnectorAuthMethodIds(type)) {\n const envBindings = getConnectorAuthMethodEnvBindings(type, authMethod);\n for (const [envName, valueRef] of Object.entries(envBindings)) {\n entries.push({ authMethod, envName, valueRef });\n }\n }\n return entries;\n}\n\nexport interface ConnectorStoredSecretDisplayInfo {\n readonly connectorLabel: string;\n readonly envNames: string[];\n}\n\n/**\n * Diagnostic/display lookup for a stored connector secret name.\n *\n * This reverse-searches registry metadata to explain which runtime env aliases\n * can expose a stored secret. Runtime injection must use selected auth method\n * storage metadata instead.\n */\nexport function getConnectorStoredSecretDisplayInfo(\n secretName: string,\n): ConnectorStoredSecretDisplayInfo | null {\n const allTypes = CONNECTOR_TYPE_KEYS;\n\n for (const type of allTypes) {\n const config = CONNECTOR_TYPES[type];\n\n const found = Object.values(config.authMethods).some((method) => {\n return connectorAuthMethodOwnedSecretNames(method).includes(secretName);\n });\n if (!found) {\n continue;\n }\n\n const envNames = [\n ...new Set(\n getConnectorEnvBindingEntries(type)\n .filter(({ valueRef }) => {\n return valueRef === `$secrets.${secretName}`;\n })\n .map(({ envName }) => {\n return envName;\n }),\n ),\n ];\n\n if (envNames.length > 0) {\n return { connectorLabel: config.label, envNames };\n }\n }\n\n return null;\n}\n\n/**\n * Diagnostic lookup for a runtime env alias declared by connector env bindings.\n *\n * This is for human-facing commands such as CLI doctor; runtime connector\n * behavior must use selected auth method metadata.\n */\nexport function getDiagnosticConnectorTypeForRuntimeEnvName(\n envName: string,\n): ConnectorType | null {\n for (const type of CONNECTOR_TYPE_KEYS) {\n const hasEnvName = getConnectorEnvBindingEntries(type).some((entry) => {\n return entry.envName === envName;\n });\n if (hasEnvName) {\n return type;\n }\n }\n return null;\n}\n\nexport function hasConnectorAuthCodeGrant(\n type: ConnectorType,\n): type is AuthCodeGrantConnectorType {\n return getConnectorAuthMethodIdsForGrantKind(type, \"auth-code\").length > 0;\n}\n\nexport function hasConnectorOpenIdAuthGrant(\n type: ConnectorType,\n): type is OpenIdAuthGrantConnectorType {\n return getConnectorAuthMethodIdsForGrantKind(type, \"openid-auth\").length > 0;\n}\n\nexport function hasConnectorExternalCodeGrant(\n type: ConnectorType,\n): type is ExternalCodeGrantConnectorType {\n return (\n getConnectorAuthMethodIdsForGrantKind(type, \"external-code\").length > 0\n );\n}\n\nexport function hasConnectorDeviceAuthGrant(\n type: ConnectorType,\n): type is DeviceAuthGrantConnectorType {\n return getConnectorAuthMethodIdsForGrantKind(type, \"device-auth\").length > 0;\n}\n\nfunction hasRequiredGrantScopes(\n requiredScopes: readonly string[],\n storedScopes: string[] | null,\n): boolean {\n if (requiredScopes.length === 0) return true;\n if (!storedScopes) return false;\n const storedSet = new Set(storedScopes);\n return requiredScopes.every((s) => {\n return storedSet.has(s);\n });\n}\n\n/**\n * Compute the diff between currently required scopes and stored scopes for a connector.\n */\nexport interface ScopeDiff {\n addedScopes: string[];\n removedScopes: string[];\n currentScopes: string[];\n storedScopes: string[];\n}\n\nfunction scopeDiff(\n currentScopes: readonly string[],\n storedScopes: string[] | null,\n): ScopeDiff {\n const stored = storedScopes ?? [];\n const storedSet = new Set(stored);\n const currentSet = new Set(currentScopes);\n\n return {\n addedScopes: currentScopes.filter((s) => {\n return !storedSet.has(s);\n }),\n removedScopes: stored.filter((s) => {\n return !currentSet.has(s);\n }),\n currentScopes: [...currentScopes],\n storedScopes: stored,\n };\n}\n\nexport function hasRequiredConnectorAuthMethodScopes(\n connectorType: ConnectorType,\n authMethod: string,\n storedScopes: string[] | null,\n): boolean {\n return hasRequiredGrantScopes(\n getConnectorAuthMethodGrantScopes(connectorType, authMethod),\n storedScopes,\n );\n}\n\nexport function getConnectorAuthMethodScopeDiff(\n connectorType: ConnectorType,\n authMethod: string,\n storedScopes: string[] | null,\n): ScopeDiff {\n return scopeDiff(\n getConnectorAuthMethodGrantScopes(connectorType, authMethod),\n storedScopes,\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AA0DA,IAAM,iCAAiC;AAAA,EACrC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AAAA,EACb,KAAK;AACP;AAMA,SAAS,4BACP,YACQ;AACR,SAAO,+BAA+B,UAAU;AAClD;AAEO,SAAS,oCACd,MACyB;AAEzB,SAAO,OAAO,KAAK,gBAAgB,IAAI,EAAE,WAAW,EACjD,IAAI,CAAC,eAAe;AACnB,WAAO,4BAA4B,MAAM,UAAU;AAAA,EACrD,CAAC,EACA,KAAK,CAAC,GAAG,MAAM;AACd,UAAM,eACJ,4BAA4B,CAAC,IAAI,4BAA4B,CAAC;AAChE,WAAO,iBAAiB,IAAI,EAAE,cAAc,CAAC,IAAI;AAAA,EACnD,CAAC;AACL;AAyBO,SAAS,uBACd,MACA,YACuC;AACvC,aAAW,CAAC,UAAU,MAAM,KAAK,OAAO;AAAA,IACtC,gBAAgB,IAAI,EAAE;AAAA,EACxB,GAAG;AACD,QAAI,aAAa,YAAY;AAC3B,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAiSA,SAAS,2BACP,QACsB;AACtB,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AAAA,IACL,KAAK;AACH,aAAO,OAAO;AAAA,IAChB,KAAK;AACH,aAAO,CAAC;AAAA,EACZ;AACF;AAEA,SAAS,kCACP,QAC6B;AAC7B,SAAO,4BAA4B,2BAA2B,MAAM,CAAC;AACvE;AAyZA,SAAS,4BACP,SACoC;AACpC,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ;AACzD;AAQA,SAAS,4BACP,aAC6B;AAC7B,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,WAAW,EAAE,IAAI,CAAC,CAAC,SAAS,OAAO,MAAM;AACtD,aAAO,CAAC,SAAS,4BAA4B,OAAO,CAAC;AAAA,IACvD,CAAC;AAAA,EACH;AACF;AAw4BA,SAAS,oCACP,QACU;AACV,SAAO,SAAS,CAAC,GAAG,OAAO,QAAQ,OAAO,IAAI,CAAC;AACjD;AAWO,SAAS,kCACd,MACA,YAC6B;AAC7B,QAAM,SAAS,uBAAuB,MAAM,UAAU;AACtD,SAAO,SAAS,kCAAkC,OAAO,MAAM,IAAI,CAAC;AACtE;AAcO,SAAS,8BACd,MAC4B;AAC5B,QAAM,UAAsC,CAAC;AAC7C,aAAW,cAAc,oCAAoC,IAAI,GAAG;AAClE,UAAM,cAAc,kCAAkC,MAAM,UAAU;AACtE,eAAW,CAAC,SAAS,QAAQ,KAAK,OAAO,QAAQ,WAAW,GAAG;AAC7D,cAAQ,KAAK,EAAE,YAAY,SAAS,SAAS,CAAC;AAAA,IAChD;AAAA,EACF;AACA,SAAO;AACT;AAcO,SAAS,oCACd,YACyC;AACzC,QAAM,WAAW;AAEjB,aAAW,QAAQ,UAAU;AAC3B,UAAM,SAAS,gBAAgB,IAAI;AAEnC,UAAM,QAAQ,OAAO,OAAO,OAAO,WAAW,EAAE,KAAK,CAAC,WAAW;AAC/D,aAAO,oCAAoC,MAAM,EAAE,SAAS,UAAU;AAAA,IACxE,CAAC;AACD,QAAI,CAAC,OAAO;AACV;AAAA,IACF;AAEA,UAAM,WAAW;AAAA,MACf,GAAG,IAAI;AAAA,QACL,8BAA8B,IAAI,EAC/B,OAAO,CAAC,EAAE,SAAS,MAAM;AACxB,iBAAO,aAAa,YAAY,UAAU;AAAA,QAC5C,CAAC,EACA,IAAI,CAAC,EAAE,QAAQ,MAAM;AACpB,iBAAO;AAAA,QACT,CAAC;AAAA,MACL;AAAA,IACF;AAEA,QAAI,SAAS,SAAS,GAAG;AACvB,aAAO,EAAE,gBAAgB,OAAO,OAAO,SAAS;AAAA,IAClD;AAAA,EACF;AAEA,SAAO;AACT;AAQO,SAAS,4CACd,SACsB;AACtB,aAAW,QAAQ,qBAAqB;AACtC,UAAM,aAAa,8BAA8B,IAAI,EAAE,KAAK,CAAC,UAAU;AACrE,aAAO,MAAM,YAAY;AAAA,IAC3B,CAAC;AACD,QAAI,YAAY;AACd,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
fetchComputerUsePluginContent,
|
|
10
10
|
fetchComputerUseScreenshot,
|
|
11
11
|
getComputerUseCommand
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6LO5CNWO.js";
|
|
13
13
|
import {
|
|
14
14
|
ApiRequestError,
|
|
15
15
|
withErrorHandler
|
|
@@ -881,4 +881,4 @@ export {
|
|
|
881
881
|
formatComputerUseResultForConsole,
|
|
882
882
|
zeroComputerUseCommand
|
|
883
883
|
};
|
|
884
|
-
//# sourceMappingURL=computer-use-
|
|
884
|
+
//# sourceMappingURL=computer-use-B5YIQEQK.js.map
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getZeroCustomConnector,
|
|
16
16
|
listZeroConnectorCatalogStatus,
|
|
17
17
|
listZeroCustomConnectors
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6LO5CNWO.js";
|
|
19
19
|
import "./chunk-LTDQISD7.js";
|
|
20
20
|
import {
|
|
21
21
|
withErrorHandler
|
|
@@ -832,4 +832,4 @@ var zeroConnectorCommand = new Command().name("connector").description("Check th
|
|
|
832
832
|
export {
|
|
833
833
|
zeroConnectorCommand
|
|
834
834
|
};
|
|
835
|
-
//# sourceMappingURL=connector-
|
|
835
|
+
//# sourceMappingURL=connector-ESSY2LRJ.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
createZeroCreditCheckout,
|
|
9
9
|
getZeroOrgMembers
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6LO5CNWO.js";
|
|
11
11
|
import "./chunk-LTDQISD7.js";
|
|
12
12
|
import {
|
|
13
13
|
withErrorHandler
|
|
@@ -87,4 +87,4 @@ var zeroCreditCommand = new Command().name("credit").description("Create a Strip
|
|
|
87
87
|
export {
|
|
88
88
|
zeroCreditCommand
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=credit-
|
|
90
|
+
//# sourceMappingURL=credit-UJRUUGPI.js.map
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
requestDeveloperSupportConsent,
|
|
6
6
|
submitDeveloperSupport
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6LO5CNWO.js";
|
|
8
8
|
import "./chunk-LTDQISD7.js";
|
|
9
9
|
import {
|
|
10
10
|
withErrorHandler
|
|
@@ -61,4 +61,4 @@ Notes:
|
|
|
61
61
|
export {
|
|
62
62
|
zeroDeveloperSupportCommand
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=developer-support-
|
|
64
|
+
//# sourceMappingURL=developer-support-TLZXURUI.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
findFirewallMetadataPermission,
|
|
6
6
|
getFirewallPermissionSummary,
|
|
7
7
|
loadFirewallPermissionMetadata
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NZWTBT6O.js";
|
|
9
9
|
import {
|
|
10
10
|
getPlatformOrigin,
|
|
11
11
|
toPlatformUrl
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
matchFirewallBaseUrl,
|
|
15
15
|
matchFirewallRequestDecision
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FLPW5VN3.js";
|
|
17
17
|
import {
|
|
18
18
|
getConnectorEnvBindingEntries,
|
|
19
19
|
getDiagnosticConnectorTypeForRuntimeEnvName
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YBYRLNXW.js";
|
|
21
21
|
import {
|
|
22
22
|
CONNECTOR_TYPES,
|
|
23
23
|
UNKNOWN_PERMISSION_GRANT,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
hasUnsafeFirewallPath,
|
|
32
32
|
resolveFirewallBaseUrlTemplate,
|
|
33
33
|
searchZeroConnectors
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-6LO5CNWO.js";
|
|
35
35
|
import "./chunk-LTDQISD7.js";
|
|
36
36
|
import {
|
|
37
37
|
ApiRequestError,
|
|
@@ -8704,4 +8704,4 @@ Notes:
|
|
|
8704
8704
|
export {
|
|
8705
8705
|
zeroDoctorCommand
|
|
8706
8706
|
};
|
|
8707
|
-
//# sourceMappingURL=doctor-
|
|
8707
|
+
//# sourceMappingURL=doctor-BCWZU6OP.js.map
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
getZeroAgentUserConnectors,
|
|
26
26
|
listZeroConnectorCatalog,
|
|
27
27
|
listZeroConnectorCatalogStatus
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-6LO5CNWO.js";
|
|
29
29
|
import "./chunk-LTDQISD7.js";
|
|
30
30
|
import {
|
|
31
31
|
generateWebImage,
|
|
@@ -2695,4 +2695,4 @@ var generateCommand = new Command().name("generate").description(
|
|
|
2695
2695
|
export {
|
|
2696
2696
|
generateCommand
|
|
2697
2697
|
};
|
|
2698
|
-
//# sourceMappingURL=generate-
|
|
2698
|
+
//# sourceMappingURL=generate-YCHEAUAZ.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
completeGithubFileUpload,
|
|
6
6
|
downloadGithubFile,
|
|
7
7
|
initGithubFileUpload
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6LO5CNWO.js";
|
|
9
9
|
import "./chunk-LTDQISD7.js";
|
|
10
10
|
import {
|
|
11
11
|
withErrorHandler
|
|
@@ -201,4 +201,4 @@ Examples:
|
|
|
201
201
|
export {
|
|
202
202
|
zeroGithubCommand
|
|
203
203
|
};
|
|
204
|
-
//# sourceMappingURL=github-
|
|
204
|
+
//# sourceMappingURL=github-ZUARIXXH.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getGoal,
|
|
11
11
|
pauseGoal,
|
|
12
12
|
resumeGoal
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6LO5CNWO.js";
|
|
14
14
|
import "./chunk-LTDQISD7.js";
|
|
15
15
|
import {
|
|
16
16
|
withErrorHandler
|
|
@@ -78,4 +78,4 @@ var zeroGoalCommand = new Command().name("goal").description("Manage the current
|
|
|
78
78
|
export {
|
|
79
79
|
zeroGoalCommand
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=goal-
|
|
81
|
+
//# sourceMappingURL=goal-VNV2BIKX.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getHostedSiteFiles,
|
|
12
12
|
hostedArtifactKindSchema,
|
|
13
13
|
prepareHostedSite
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6LO5CNWO.js";
|
|
15
15
|
import "./chunk-LTDQISD7.js";
|
|
16
16
|
import {
|
|
17
17
|
withErrorHandler
|
|
@@ -547,4 +547,4 @@ Notes:
|
|
|
547
547
|
export {
|
|
548
548
|
zeroHostCommand
|
|
549
549
|
};
|
|
550
|
-
//# sourceMappingURL=host-
|
|
550
|
+
//# sourceMappingURL=host-XVIKZ7WV.js.map
|
package/index.js
CHANGED
|
@@ -36,14 +36,14 @@ import {
|
|
|
36
36
|
renderRunCreated,
|
|
37
37
|
require_dist,
|
|
38
38
|
showNextSteps
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-BNY74P3F.js";
|
|
40
40
|
import {
|
|
41
41
|
Kn,
|
|
42
42
|
uo
|
|
43
43
|
} from "./chunk-J4HTPZIN.js";
|
|
44
44
|
import "./chunk-DKOCDBW4.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
45
|
+
import "./chunk-FLPW5VN3.js";
|
|
46
|
+
import "./chunk-YBYRLNXW.js";
|
|
47
47
|
import {
|
|
48
48
|
isInteractive,
|
|
49
49
|
promptText
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
prepareStorage,
|
|
77
77
|
searchLogs,
|
|
78
78
|
volumeConfigSchema
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-6LO5CNWO.js";
|
|
80
80
|
import "./chunk-LTDQISD7.js";
|
|
81
81
|
import {
|
|
82
82
|
ApiRequestError,
|
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
} from "./chunk-JUTUEPIR.js";
|
|
95
95
|
import {
|
|
96
96
|
configureGlobalProxyFromEnv
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-JAXYYPOP.js";
|
|
98
98
|
import "./chunk-LRHXR7JT.js";
|
|
99
99
|
import {
|
|
100
100
|
Command,
|
|
@@ -432,7 +432,7 @@ function getConfigPath() {
|
|
|
432
432
|
return join(os.homedir(), ".vm0", "config.json");
|
|
433
433
|
}
|
|
434
434
|
var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
|
|
435
|
-
console.log(source_default.bold(`VM0 CLI v${"9.230.
|
|
435
|
+
console.log(source_default.bold(`VM0 CLI v${"9.230.5"}`));
|
|
436
436
|
console.log();
|
|
437
437
|
const config = await loadConfig();
|
|
438
438
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1135,7 +1135,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
1135
1135
|
options.autoUpdate = false;
|
|
1136
1136
|
}
|
|
1137
1137
|
if (options.autoUpdate !== false) {
|
|
1138
|
-
await startSilentUpgrade("9.230.
|
|
1138
|
+
await startSilentUpgrade("9.230.5");
|
|
1139
1139
|
}
|
|
1140
1140
|
try {
|
|
1141
1141
|
const { config, agentName, agent, basePath } = await loadAndValidateConfig(resolvedConfigFile);
|
|
@@ -1232,7 +1232,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
|
|
|
1232
1232
|
withErrorHandler(
|
|
1233
1233
|
async (identifier, prompt, options) => {
|
|
1234
1234
|
if (options.autoUpdate !== false) {
|
|
1235
|
-
await startSilentUpgrade("9.230.
|
|
1235
|
+
await startSilentUpgrade("9.230.5");
|
|
1236
1236
|
}
|
|
1237
1237
|
const { name, version } = parseIdentifier(identifier);
|
|
1238
1238
|
let composeId;
|
|
@@ -3091,13 +3091,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
3091
3091
|
if (latestVersion === null) {
|
|
3092
3092
|
throw new Error("Could not check for updates. Please try again later.");
|
|
3093
3093
|
}
|
|
3094
|
-
if (latestVersion === "9.230.
|
|
3095
|
-
console.log(source_default.green(`\u2713 Already up to date (${"9.230.
|
|
3094
|
+
if (latestVersion === "9.230.5") {
|
|
3095
|
+
console.log(source_default.green(`\u2713 Already up to date (${"9.230.5"})`));
|
|
3096
3096
|
return;
|
|
3097
3097
|
}
|
|
3098
3098
|
console.log(
|
|
3099
3099
|
source_default.yellow(
|
|
3100
|
-
`Current version: ${"9.230.
|
|
3100
|
+
`Current version: ${"9.230.5"} -> Latest version: ${latestVersion}`
|
|
3101
3101
|
)
|
|
3102
3102
|
);
|
|
3103
3103
|
console.log();
|
|
@@ -3124,7 +3124,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
3124
3124
|
const success = await performUpgrade(packageManager);
|
|
3125
3125
|
if (success) {
|
|
3126
3126
|
console.log(
|
|
3127
|
-
source_default.green(`\u2713 Upgraded from ${"9.230.
|
|
3127
|
+
source_default.green(`\u2713 Upgraded from ${"9.230.5"} to ${latestVersion}`)
|
|
3128
3128
|
);
|
|
3129
3129
|
return;
|
|
3130
3130
|
}
|
|
@@ -3191,7 +3191,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
|
|
|
3191
3191
|
|
|
3192
3192
|
// src/index.ts
|
|
3193
3193
|
var program = new Command();
|
|
3194
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.230.
|
|
3194
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.230.5");
|
|
3195
3195
|
program.addCommand(authCommand);
|
|
3196
3196
|
program.addCommand(infoCommand);
|
|
3197
3197
|
program.addCommand(composeCommand);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from "node:module";
|
|
3
|
+
const require = __createRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
Command
|
|
6
|
+
} from "./chunk-B3W2RUBP.js";
|
|
7
|
+
import {
|
|
8
|
+
init_esm_shims
|
|
9
|
+
} from "./chunk-DIRAZ3YX.js";
|
|
10
|
+
|
|
11
|
+
// src/commands/zero/intro.ts
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
var ZERO_INTRO = `
|
|
14
|
+
# Zero Intro
|
|
15
|
+
|
|
16
|
+
Zero is an AI agent that works from cloud computers to complete real work: deep research, polished artifacts, lightweight coding, connector-backed automation, and 24/7 recurring workflows.
|
|
17
|
+
|
|
18
|
+
## Cloud Computer and 24/7 Automation
|
|
19
|
+
|
|
20
|
+
Zero runs on cloud computers, not just inside a chat box. It can use a terminal, files, browser automation, CLI tools, and connected services to complete work asynchronously.
|
|
21
|
+
|
|
22
|
+
Zero can also run recurring or event-triggered workflows 24/7 when configured:
|
|
23
|
+
- Check Sentry every hour, identify high-impact issues, create GitHub issues or focused PRs, and post a Slack update.
|
|
24
|
+
- Watch GitHub PRs labeled ready-to-merge, wait for CI, merge when safe, and notify Slack.
|
|
25
|
+
- Pull daily product, revenue, support, and engineering signals into a company brief.
|
|
26
|
+
- Triage Gmail, draft replies, enrich leads, and write structured rows to Google Sheets.
|
|
27
|
+
- Monitor deployments, metrics, alerts, customer feedback, or competitor changes on a schedule.
|
|
28
|
+
|
|
29
|
+
This means users can give Zero ongoing jobs, not just one-off questions. Availability depends on connected services, permissions, credits, and workflow configuration.
|
|
30
|
+
|
|
31
|
+
## Deep Research
|
|
32
|
+
|
|
33
|
+
Zero can investigate a topic, product question, market, company, customer signal, or codebase, then produce a structured brief with findings, risks, sources, and next steps.
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
- Research how a subsystem works in a codebase.
|
|
37
|
+
- Analyze a competitor, market, or pricing strategy.
|
|
38
|
+
- Investigate product usage, customer feedback, or operational signals.
|
|
39
|
+
- Turn messy context into a decision-ready brief.
|
|
40
|
+
|
|
41
|
+
## Presentations, Reports, and Websites
|
|
42
|
+
|
|
43
|
+
Zero can turn rough ideas, files, notes, or research into polished artifacts.
|
|
44
|
+
|
|
45
|
+
Examples:
|
|
46
|
+
- 15-slide launch decks, investor decks, business reviews, and research decks.
|
|
47
|
+
- Website reports, static microsites, landing pages, and portfolio sites.
|
|
48
|
+
- Data reports, company briefs, product updates, and executive summaries.
|
|
49
|
+
- Hosted static artifacts when appropriate.
|
|
50
|
+
|
|
51
|
+
## Lightweight Coding
|
|
52
|
+
|
|
53
|
+
Zero can help with practical coding work focused on concrete deliverables.
|
|
54
|
+
|
|
55
|
+
Examples:
|
|
56
|
+
- Read a repo and explain the architecture.
|
|
57
|
+
- Debug an error or trace a bug.
|
|
58
|
+
- Implement a small feature or UI change.
|
|
59
|
+
- Modify uploaded source files.
|
|
60
|
+
- Write scripts, automation, data transforms, or one-off tools.
|
|
61
|
+
- Create a PR and run targeted checks.
|
|
62
|
+
|
|
63
|
+
## Workflow Automation
|
|
64
|
+
|
|
65
|
+
Zero can create or remix recurring workflows across connected tools.
|
|
66
|
+
|
|
67
|
+
Examples:
|
|
68
|
+
- Gmail triage and draft replies.
|
|
69
|
+
- GitHub PR summaries, review flows, or auto-merge workflows.
|
|
70
|
+
- Sentry, Axiom, Vercel, or product-health digests.
|
|
71
|
+
- Slack reports, Notion updates, Google Sheets logging.
|
|
72
|
+
- Sales lead capture, meeting research, support routing, company briefs.
|
|
73
|
+
|
|
74
|
+
## Connectors
|
|
75
|
+
|
|
76
|
+
Zero can work with connected services when available. Common examples include GitHub, Gmail, Slack, Notion, Google Sheets, Google Calendar, Google Drive, Sentry, Axiom, Vercel, Linear, Figma, Stripe, PostHog, Apollo, HubSpot, Salesforce, X, Firecrawl, and Exa.
|
|
77
|
+
|
|
78
|
+
Connector availability depends on what the user or organization has connected and authorized.
|
|
79
|
+
|
|
80
|
+
## How to Answer Capability Questions
|
|
81
|
+
|
|
82
|
+
When a user asks what Zero can do:
|
|
83
|
+
- Do not paste this intro verbatim.
|
|
84
|
+
- Match the user's language.
|
|
85
|
+
- Answer with concrete deliverables, not a generic feature list.
|
|
86
|
+
- Prefer cloud computer, 24/7 workflow automation, deep research, artifact generation, and lightweight coding examples.
|
|
87
|
+
- Emphasize that Zero can run in the cloud and handle recurring automation when the user asks about ongoing work, monitoring, alerts, or scheduled tasks.
|
|
88
|
+
- Give 2-4 starter tasks the user can choose from.
|
|
89
|
+
`.trim();
|
|
90
|
+
var zeroIntroCommand = new Command().name("intro").description("Print Zero's self-introduction and capability guide for agents").action(() => {
|
|
91
|
+
console.log(ZERO_INTRO);
|
|
92
|
+
});
|
|
93
|
+
export {
|
|
94
|
+
zeroIntroCommand
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=intro-MIVVJG7M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/zero/intro.ts"],"sourcesContent":["import { Command } from \"commander\";\n\nconst ZERO_INTRO = `\n# Zero Intro\n\nZero is an AI agent that works from cloud computers to complete real work: deep research, polished artifacts, lightweight coding, connector-backed automation, and 24/7 recurring workflows.\n\n## Cloud Computer and 24/7 Automation\n\nZero runs on cloud computers, not just inside a chat box. It can use a terminal, files, browser automation, CLI tools, and connected services to complete work asynchronously.\n\nZero can also run recurring or event-triggered workflows 24/7 when configured:\n- Check Sentry every hour, identify high-impact issues, create GitHub issues or focused PRs, and post a Slack update.\n- Watch GitHub PRs labeled ready-to-merge, wait for CI, merge when safe, and notify Slack.\n- Pull daily product, revenue, support, and engineering signals into a company brief.\n- Triage Gmail, draft replies, enrich leads, and write structured rows to Google Sheets.\n- Monitor deployments, metrics, alerts, customer feedback, or competitor changes on a schedule.\n\nThis means users can give Zero ongoing jobs, not just one-off questions. Availability depends on connected services, permissions, credits, and workflow configuration.\n\n## Deep Research\n\nZero can investigate a topic, product question, market, company, customer signal, or codebase, then produce a structured brief with findings, risks, sources, and next steps.\n\nExamples:\n- Research how a subsystem works in a codebase.\n- Analyze a competitor, market, or pricing strategy.\n- Investigate product usage, customer feedback, or operational signals.\n- Turn messy context into a decision-ready brief.\n\n## Presentations, Reports, and Websites\n\nZero can turn rough ideas, files, notes, or research into polished artifacts.\n\nExamples:\n- 15-slide launch decks, investor decks, business reviews, and research decks.\n- Website reports, static microsites, landing pages, and portfolio sites.\n- Data reports, company briefs, product updates, and executive summaries.\n- Hosted static artifacts when appropriate.\n\n## Lightweight Coding\n\nZero can help with practical coding work focused on concrete deliverables.\n\nExamples:\n- Read a repo and explain the architecture.\n- Debug an error or trace a bug.\n- Implement a small feature or UI change.\n- Modify uploaded source files.\n- Write scripts, automation, data transforms, or one-off tools.\n- Create a PR and run targeted checks.\n\n## Workflow Automation\n\nZero can create or remix recurring workflows across connected tools.\n\nExamples:\n- Gmail triage and draft replies.\n- GitHub PR summaries, review flows, or auto-merge workflows.\n- Sentry, Axiom, Vercel, or product-health digests.\n- Slack reports, Notion updates, Google Sheets logging.\n- Sales lead capture, meeting research, support routing, company briefs.\n\n## Connectors\n\nZero can work with connected services when available. Common examples include GitHub, Gmail, Slack, Notion, Google Sheets, Google Calendar, Google Drive, Sentry, Axiom, Vercel, Linear, Figma, Stripe, PostHog, Apollo, HubSpot, Salesforce, X, Firecrawl, and Exa.\n\nConnector availability depends on what the user or organization has connected and authorized.\n\n## How to Answer Capability Questions\n\nWhen a user asks what Zero can do:\n- Do not paste this intro verbatim.\n- Match the user's language.\n- Answer with concrete deliverables, not a generic feature list.\n- Prefer cloud computer, 24/7 workflow automation, deep research, artifact generation, and lightweight coding examples.\n- Emphasize that Zero can run in the cloud and handle recurring automation when the user asks about ongoing work, monitoring, alerts, or scheduled tasks.\n- Give 2-4 starter tasks the user can choose from.\n`.trim();\n\nexport const zeroIntroCommand = new Command()\n .name(\"intro\")\n .description(\"Print Zero's self-introduction and capability guide for agents\")\n .action(() => {\n console.log(ZERO_INTRO);\n });\n"],"mappings":";;;;;;;;;;;AAAA;AAEA,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4EjB,KAAK;AAEA,IAAM,mBAAmB,IAAI,QAAQ,EACzC,KAAK,OAAO,EACZ,YAAY,gEAAgE,EAC5E,OAAO,MAAM;AACZ,UAAQ,IAAI,UAAU;AACxB,CAAC;","names":[]}
|